Skip to content

Commit

Permalink
Allowed menu to 'stick' to the right when too many tabs exist. Tabs t…
Browse files Browse the repository at this point in the history
…hat cannot be displayed are automatically hidden. Removed old code which attempted to reduce tab size by hiding the text
  • Loading branch information
pvrs12 committed May 2, 2015
1 parent 319d549 commit 66e41a0
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions app/src/processing/app/EditorHeader.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ public void paintComponent(Graphics screen) {
tab.textWidth = (int)
font.getStringBounds(tab.text, g2.getFontRenderContext()).getWidth();
}

/* TODO eliminated 279-302 because it doesn't really work to reduce the tab size (by much anyways)

This comment has been minimized.

Copy link
@benfry

benfry May 19, 2015

Contributor

Ugh, just found this. Please don't remove working code because you don't find it convenient or to your liking. This makes a mess for me to have to come back and sort it out. I wouldn't have accepted this patch had I noticed this before.

This comment has been minimized.

Copy link
@pvrs12

pvrs12 May 19, 2015

Author Contributor

I'm sorry about that, won't happen again. What would the accepted protocol be for eventually removing old code? A separate issue? I can file a PR which puts back in the old code if you would like

This comment has been minimized.

Copy link
@benfry

benfry May 19, 2015

Contributor

Just keep them separate. If it's in there, most of the time it's there for a reason, and a PR to fix something else isn't the place to weigh in with personal takes on what is and isn't useful. If you don't like the behavior, that can be a separate issue and dealt with its own way (by the right people, with the right process, whatever).

* and makes it confusing to find the tab you want because the name is hidden
*
// make sure everything can fit
if (!placeTabs(MARGIN_WIDTH, tabMax, null)) {
//System.arraycopy(tabs, 0, visitOrder, 0, tabs.length);
Expand All @@ -297,14 +299,19 @@ public void paintComponent(Graphics screen) {
break;
}
}
}
}*/

// now actually draw the tabs
placeTabs(MARGIN_WIDTH, tabMax, g2);

// draw the dropdown menu target
menuLeft = tabs[tabs.length - 1].right + TAB_BETWEEN;
menuRight = menuLeft + ARROW_TAB_WIDTH;
if(!placeTabs(MARGIN_WIDTH, tabMax - ARROW_TAB_WIDTH, g2)){
// draw the dropdown menu target at the right of the window
menuRight = tabMax;
menuLeft = menuRight - ARROW_TAB_WIDTH;
} else {
// draw the dropdown menu target next to the tabs
menuLeft = tabs[tabs.length - 1].right + TAB_BETWEEN;
menuRight = menuLeft + ARROW_TAB_WIDTH;
}

g.setColor(tabColor[UNSELECTED]);
drawTab(g, menuLeft, menuRight);
// int arrowY = (getHeight() - TAB_HEIGHT - TAB_STRETCH) + (TAB_HEIGHT - ARROW_HEIGHT)/2;
Expand Down Expand Up @@ -370,7 +377,7 @@ private boolean placeTabs(int left, int right, Graphics2D g) {
// }
tab.right = x;

if (g != null) {
if (g != null && tab.right < right) {
g.setColor(tabColor[state]);
drawTab(g, tab.left, tab.right);
// path.lineTo(x - NOTCH, top);
Expand Down

0 comments on commit 66e41a0

Please sign in to comment.