Browser: hide "new tab" button with the max number of open tabs

git-svn-id: svn://kolibrios.org@7775 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
theonlymirage 2020-04-11 15:49:11 +00:00
parent 1ef8d92a9e
commit bacf93e817

View File

@ -69,6 +69,7 @@ int tab_w = DEFAULT_TABW;
int GetTabWidth() int GetTabWidth()
{ {
if (tab.count == TABS_MAX) return Form.cwidth / tab.count;
if (tab.count * DEFAULT_TABW + TAB_H < Form.cwidth) return DEFAULT_TABW; else if (tab.count * DEFAULT_TABW + TAB_H < Form.cwidth) return DEFAULT_TABW; else
return Form.cwidth - TAB_H - 2 / tab.count; return Form.cwidth - TAB_H - 2 / tab.count;
} }
@ -115,6 +116,8 @@ void DrawNewTabButton()
dword btn_light = MixColors(system.color.work_button, 0xFFFfff, 220); dword btn_light = MixColors(system.color.work_button, 0xFFFfff, 220);
dword btn_dark = MixColors(system.color.work_button, 0, 180); dword btn_dark = MixColors(system.color.work_button, 0, 180);
int xxx = tab.count * tab_w; int xxx = tab.count * tab_w;
if (tab.count < TABS_MAX) {
DrawBar(xxx, TOOLBAR_H, 1, TAB_H, system.color.work_graph); DrawBar(xxx, TOOLBAR_H, 1, TAB_H, system.color.work_graph);
DrawBar(xxx+1, TOOLBAR_H, TAB_H, TAB_H-1, system.color.work_button); DrawBar(xxx+1, TOOLBAR_H, TAB_H, TAB_H-1, system.color.work_button);
DrawRectangle3D(xxx+1, TOOLBAR_H, TAB_H, TAB_H-1, btn_light, btn_dark); DrawRectangle3D(xxx+1, TOOLBAR_H, TAB_H, TAB_H-1, btn_light, btn_dark);
@ -122,6 +125,7 @@ void DrawNewTabButton()
DefineHiddenButton(xxx+1, TOOLBAR_H, TAB_H-1, TAB_H-1, NEW_TAB); DefineHiddenButton(xxx+1, TOOLBAR_H, TAB_H-1, TAB_H-1, NEW_TAB);
WriteText(xxx+7, TOOLBAR_H+2, 0x90, system.color.work_button_text, "+"); WriteText(xxx+7, TOOLBAR_H+2, 0x90, system.color.work_button_text, "+");
} }
}
void DrawTabsBar() void DrawTabsBar()
{ {