mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-03 20:54:01 +00:00
Don't show close buttons for small tabs
Only the selected tab has a visible close button regardless of its size.
This commit is contained in:
parent
8fa97cba32
commit
926e714f74
@ -444,7 +444,7 @@ void Tabs::drawTab(Graphics* g, const gfx::Rect& _box, Tab* tab, int dy,
|
|||||||
gfx::Color face_color;
|
gfx::Color face_color;
|
||||||
int clipTextRightSide;
|
int clipTextRightSide;
|
||||||
|
|
||||||
gfx::Rect closeBox = getTabCloseButtonBounds(box);
|
gfx::Rect closeBox = getTabCloseButtonBounds(tab, box);
|
||||||
if (closeBox.isEmpty())
|
if (closeBox.isEmpty())
|
||||||
clipTextRightSide = 4*ui::guiscale();
|
clipTextRightSide = 4*ui::guiscale();
|
||||||
else {
|
else {
|
||||||
@ -575,7 +575,7 @@ void Tabs::calculateHot()
|
|||||||
|
|
||||||
if (box.contains(mousePos)) {
|
if (box.contains(mousePos)) {
|
||||||
hot = tab;
|
hot = tab;
|
||||||
hotCloseButton = getTabCloseButtonBounds(box).contains(mousePos);
|
hotCloseButton = getTabCloseButtonBounds(tab, box).contains(mousePos);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,13 +594,13 @@ void Tabs::calculateHot()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Rect Tabs::getTabCloseButtonBounds(const gfx::Rect& box)
|
gfx::Rect Tabs::getTabCloseButtonBounds(Tab* tab, const gfx::Rect& box)
|
||||||
{
|
{
|
||||||
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
||||||
int iconW = theme->dimensions.tabsCloseIconWidth();
|
int iconW = theme->dimensions.tabsCloseIconWidth();
|
||||||
int iconH = theme->dimensions.tabsCloseIconHeight();
|
int iconH = theme->dimensions.tabsCloseIconHeight();
|
||||||
|
|
||||||
if (box.w-iconW > 4*ui::guiscale())
|
if (box.w-iconW > 32*ui::guiscale() || tab == m_selected)
|
||||||
return gfx::Rect(box.x2()-iconW, box.y+box.h/2-iconH/2, iconW, iconH);
|
return gfx::Rect(box.x2()-iconW, box.y+box.h/2-iconH/2, iconW, iconH);
|
||||||
else
|
else
|
||||||
return gfx::Rect();
|
return gfx::Rect();
|
||||||
|
@ -109,7 +109,7 @@ namespace app {
|
|||||||
int getMaxScrollX();
|
int getMaxScrollX();
|
||||||
void makeTabVisible(Tab* tab);
|
void makeTabVisible(Tab* tab);
|
||||||
void calculateHot();
|
void calculateHot();
|
||||||
gfx::Rect getTabCloseButtonBounds(const gfx::Rect& box);
|
gfx::Rect getTabCloseButtonBounds(Tab* tab, const gfx::Rect& box);
|
||||||
|
|
||||||
int m_border;
|
int m_border;
|
||||||
TabsList m_list;
|
TabsList m_list;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user