From 3465d8974359baa8d93a600bcda1be4b8c6fab02 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Mon, 6 Jun 2022 05:50:25 +0100 Subject: [PATCH] different row height for trees --- gui/griffon-app/lifecycle/Initialize.groovy | 7 ++++++- gui/griffon-app/views/com/muwire/gui/BrowseView.groovy | 3 ++- gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy | 3 ++- gui/griffon-app/views/com/muwire/gui/SearchTabView.groovy | 3 ++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gui/griffon-app/lifecycle/Initialize.groovy b/gui/griffon-app/lifecycle/Initialize.groovy index 91aa59df..e7593b3f 100644 --- a/gui/griffon-app/lifecycle/Initialize.groovy +++ b/gui/griffon-app/lifecycle/Initialize.groovy @@ -1,4 +1,5 @@ import com.muwire.gui.LNFs +import com.muwire.gui.profile.ProfileConstants import com.muwire.gui.win.PrioritySetter import griffon.core.GriffonApplication import groovy.swing.SwingBuilder @@ -67,6 +68,7 @@ class Initialize extends AbstractLifecycleHandler { def guiPropsFile = new File(home, "gui.properties") UISettings uiSettings int rowHeight = 15 + int treeRowHeight = 15 if (guiPropsFile.exists()) { Properties props = new Properties() guiPropsFile.withInputStream { props.load(it) } @@ -105,7 +107,7 @@ class Initialize extends AbstractLifecycleHandler { } else { fontSize = uiSettings.fontSize } - rowHeight = Math.max(24, fontSize + 3) + rowHeight = fontSize + 3 FontUIResource font = new FontUIResource(fontName, uiSettings.fontStyle, fontSize) def keys = lnf.getDefaults().keys() @@ -136,6 +138,9 @@ class Initialize extends AbstractLifecycleHandler { uiSettings.locale = showLanguageDialog() } + treeRowHeight = rowHeight + rowHeight = Math.max(ProfileConstants.MAX_THUMBNAIL_SIZE, rowHeight) + application.context.put("tree-row-height", treeRowHeight) application.context.put("row-height", rowHeight) application.context.put("ui-settings", uiSettings) diff --git a/gui/griffon-app/views/com/muwire/gui/BrowseView.groovy b/gui/griffon-app/views/com/muwire/gui/BrowseView.groovy index 36d538af..7721b39e 100644 --- a/gui/griffon-app/views/com/muwire/gui/BrowseView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/BrowseView.groovy @@ -57,6 +57,7 @@ class BrowseView { void initUI() { int rowHeight = application.context.get("row-height") + int treeRowHeight = application.context.get("tree-row-height") p = builder.panel { borderLayout() @@ -94,7 +95,7 @@ class BrowseView { borderLayout() scrollPane(constraints: BorderLayout.CENTER) { resultsTree = new ResultTree(model.resultsTreeModel) - tree(id: "results-tree", rowHeight: rowHeight, resultsTree) + tree(id: "results-tree", rowHeight: treeRowHeight, resultsTree) } } } diff --git a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy index 878ed8fd..02f7dd15 100644 --- a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy @@ -126,6 +126,7 @@ class MainFrameView { settings = application.context.get("ui-settings") int rowHeight = application.context.get("row-height") + int treeRowHeight = application.context.get("tree-row-height") def screenDimensions = Toolkit.getDefaultToolkit().getScreenSize() int mainFrameX = (int)Math.min(1400.0d, screenDimensions.getWidth()) @@ -387,7 +388,7 @@ class MainFrameView { jtree.setDragEnabled(true) jtree.setTransferHandler(transferHandler) ToolTipManager.sharedInstance().registerComponent(jtree) - tree(id : "shared-files-tree", rowHeight : rowHeight, rootVisible : false, expandsSelectedPaths: true, largeModel : true, jtree) + tree(id : "shared-files-tree", rowHeight : treeRowHeight, rootVisible : false, expandsSelectedPaths: true, largeModel : true, jtree) } } } diff --git a/gui/griffon-app/views/com/muwire/gui/SearchTabView.groovy b/gui/griffon-app/views/com/muwire/gui/SearchTabView.groovy index 27ed8034..09dabf10 100644 --- a/gui/griffon-app/views/com/muwire/gui/SearchTabView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/SearchTabView.groovy @@ -91,6 +91,7 @@ class SearchTabView { void initUI() { int rowHeight = application.context.get("row-height") + int treeRowHeight = application.context.get("tree-row-height") pane = builder.panel { borderLayout() panel (id : "results-panel", constraints : BorderLayout.CENTER) { @@ -156,7 +157,7 @@ class SearchTabView { borderLayout() scrollPane(constraints: BorderLayout.CENTER) { resultTree = new ResultTree(model.treeModel) - tree(id: "results-tree", rowHeight: rowHeight, resultTree) + tree(id: "results-tree", rowHeight: treeRowHeight, resultTree) } } }