Add some theme dimensions to customize context bar and color bar size

This commit is contained in:
David Capello 2018-11-15 11:08:45 -03:00
parent 2029e029a6
commit 329c50bc2c
3 changed files with 11 additions and 5 deletions

View File

@ -24,6 +24,9 @@
<dim id="palette_outline_width" value="3" />
<dim id="color_slider_height" value="14" />
<dim id="timeline_base_size" value="12" />
<dim id="color_bar_buttons_height" value="16" />
<dim id="context_bar_height" value="18" />
<dim id="brush_type_width" value="16" />
</dimensions>
<colors>
<color id="text" value="#000000" />

View File

@ -223,13 +223,13 @@ ColorBar::ColorBar(int align)
m_bgColor.resetSizeHint();
m_fgColor.setSizeHint(0, m_fgColor.sizeHint().h);
m_bgColor.setSizeHint(0, m_bgColor.sizeHint().h);
m_buttons.setMinSize(gfx::Size(0, theme->dimensions.colorBarButtonsHeight()));
m_buttons.setMaxSize(gfx::Size(std::numeric_limits<int>::max(),
std::numeric_limits<int>::max())); // TODO add resetMaxSize
m_buttons.setMaxSize(gfx::Size(m_buttons.sizeHint().w,
16*ui::guiscale()));
theme->dimensions.colorBarButtonsHeight()));
// TODO hardcoded scroll bar width should be get from skin.xml file
int scrollBarWidth = 6*guiscale();
int scrollBarWidth = theme->dimensions.miniScrollbarSize();
m_scrollableView.horizontalBar()->setBarWidth(scrollBarWidth);
m_scrollableView.verticalBar()->setBarWidth(scrollBarWidth);

View File

@ -184,7 +184,9 @@ protected:
}
void onSizeHint(SizeHintEvent& ev) override {
ev.setSizeHint(Size(16, 18)*guiscale());
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
ev.setSizeHint(Size(theme->dimensions.brushTypeWidth(),
theme->dimensions.contextBarHeight()));
}
void onInitTheme(InitThemeEvent& ev) override {
@ -1178,7 +1180,8 @@ void ContextBar::onInitTheme(ui::InitThemeEvent& ev)
void ContextBar::onSizeHint(SizeHintEvent& ev)
{
ev.setSizeHint(gfx::Size(0, 18*guiscale())); // TODO calculate height
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
ev.setSizeHint(gfx::Size(0, theme->dimensions.contextBarHeight()));
}
void ContextBar::onToolSetOpacity(const int& newOpacity)