Skip to content

Commit

Permalink
Add Split Pane
Browse files Browse the repository at this point in the history
  • Loading branch information
sotasan committed May 31, 2022
1 parent 8bbbd92 commit 1330a79
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 41 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "net.pryoscode"
version = "0.3.7"
version = "0.3.8"

kotlin {
jvmToolchain {
Expand Down
7 changes: 3 additions & 4 deletions src/main/kotlin/net/pryoscode/decompiler/window/Window.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import com.sun.javafx.tk.Toolkit
import javafx.application.Platform
import javafx.embed.swing.JFXPanel
import javafx.scene.Scene
import javafx.scene.control.SplitPane
import javafx.scene.input.TransferMode
import javafx.scene.layout.BorderPane
import javafx.scene.text.Font
import net.pryoscode.decompiler.window.container.Container
import net.pryoscode.decompiler.window.menu.Menu
Expand Down Expand Up @@ -40,9 +40,8 @@ object Window : JFrame() {
jMenuBar = Menu()

val panel = JFXPanel()
val root = BorderPane()
root.center = Container
root.left = Sidebar
val root = SplitPane(Sidebar, Container)
root.setDividerPositions(Sidebar.minWidth / (Sidebar.minWidth + Container.minWidth), Container.minWidth / (Sidebar.minWidth + Container.minWidth))

for (font in fonts)
Font.loadFont(javaClass.classLoader.getResourceAsStream("fonts/${font.split("-")[0]}/$font.ttf"), Toolkit.getToolkit().fontLoader.systemFontSize.toDouble())
Expand Down
23 changes: 0 additions & 23 deletions src/main/kotlin/net/pryoscode/decompiler/window/sidebar/Bar.kt

This file was deleted.

16 changes: 3 additions & 13 deletions src/main/kotlin/net/pryoscode/decompiler/window/sidebar/Sidebar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ package net.pryoscode.decompiler.window.sidebar
import javafx.scene.control.TreeView
import javafx.scene.input.KeyCode
import javafx.scene.input.KeyEvent
import javafx.scene.layout.AnchorPane
import javafx.scene.layout.BorderPane
import net.pryoscode.decompiler.window.container.Container
import java.io.File
import java.util.jar.JarEntry
import java.util.jar.JarFile

object Sidebar : AnchorPane() {
object Sidebar : BorderPane() {

private val tree = TreeView<Entry>()

init {
minWidth = 100.0

center = tree
tree.setCellFactory { Cell() }
tree.addEventHandler(KeyEvent.KEY_PRESSED) {
if (it.code == KeyCode.ENTER) {
Expand All @@ -28,17 +29,6 @@ object Sidebar : AnchorPane() {
}
}
}
setTopAnchor(tree, 0.0)
setRightAnchor(tree, 0.0)
setBottomAnchor(tree, 0.0)
setLeftAnchor(tree, 0.0)

val bar = Bar()
setTopAnchor(bar, 0.0)
setRightAnchor(bar, 0.0)
setBottomAnchor(bar, 0.0)

children.addAll(tree, bar)
}

fun open(file: File?) {
Expand Down
Binary file modified src/main/resources/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/main/resources/styles/global.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
-fx-font-family: "Open Sans";
}

.split-pane {
-fx-padding: 0;
-fx-background-insets: 0;

.split-pane-divider {
-fx-padding: 0;
}
}

.tree-view {
-fx-padding: 0;
-fx-background-color: none;
Expand Down

0 comments on commit 1330a79

Please sign in to comment.