better tab outline width

This commit is contained in:
Manindra Moharana
2014-07-15 11:42:35 +05:30
parent 0e43695fe6
commit 2149db2204

View File

@@ -57,6 +57,7 @@ public class TabOutline {
int minWidth = (int) (editor.getMinimumSize().width * 0.7f), maxWidth = (int) (editor
.getMinimumSize().width * 0.9f);
minWidth = Math.min(minWidth, estimateFrameWidth());
frmOutlineView.setLayout(new BoxLayout(frmOutlineView.getContentPane(),
BoxLayout.Y_AXIS));
JPanel panelTop = new JPanel(), panelBottom = new JPanel();
@@ -278,6 +279,15 @@ public class TabOutline {
return found;
}
private int estimateFrameWidth() {
int w = 100;
for (int i = 0; i < editor.getSketch().getCodeCount(); i++) {
w = Math.max(w,
editor.getSketch().getCode(i).getPrettyName().length() * 10);
}
return w;
}
private int estimateFrameHeight(){
// Assuming each tree node height to be 25 pixels
return Math.min(20 * (editor.getSketch().getCodeCount() + 1),