different row height for trees

dbus-notify
Zlatin Balevsky 2022-06-06 05:50:25 +01:00
parent 6b441d6ff9
commit 3465d89743
No known key found for this signature in database
GPG Key ID: A72832072D525E41
4 changed files with 12 additions and 4 deletions

View File

@ -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)

View File

@ -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)
}
}
}

View File

@ -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)
}
}
}

View File

@ -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)
}
}
}