From bacf93e81782a4354cbd5644bfcc7b78d099c41f Mon Sep 17 00:00:00 2001 From: theonlymirage Date: Sat, 11 Apr 2020 15:49:11 +0000 Subject: [PATCH] Browser: hide "new tab" button with the max number of open tabs git-svn-id: svn://kolibrios.org@7775 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/browser/tabs.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/programs/cmm/browser/tabs.h b/programs/cmm/browser/tabs.h index ab73c5e0e4..82fb2eacd5 100644 --- a/programs/cmm/browser/tabs.h +++ b/programs/cmm/browser/tabs.h @@ -69,6 +69,7 @@ int tab_w = DEFAULT_TABW; 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 return Form.cwidth - TAB_H - 2 / tab.count; } @@ -115,12 +116,15 @@ void DrawNewTabButton() dword btn_light = MixColors(system.color.work_button, 0xFFFfff, 220); dword btn_dark = MixColors(system.color.work_button, 0, 180); int xxx = tab.count * tab_w; - 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); - DrawRectangle3D(xxx+1, TOOLBAR_H, TAB_H, TAB_H-1, btn_light, btn_dark); - PutPixel(xxx+1+TAB_H, TOOLBAR_H, btn_dark); - 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, "+"); + + if (tab.count < TABS_MAX) { + 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); + DrawRectangle3D(xxx+1, TOOLBAR_H, TAB_H, TAB_H-1, btn_light, btn_dark); + PutPixel(xxx+1+TAB_H, TOOLBAR_H, btn_dark); + 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, "+"); + } } void DrawTabsBar()