From 9ff23f01ca0a0a6c83a3a5e5d933fffbb59dfab8 Mon Sep 17 00:00:00 2001 From: simonb Date: Mon, 17 Apr 2006 13:35:20 +0000 Subject: fix some rotation issues --- ChangeLog | 2 ++ src/FbTk/TextButton.cc | 2 ++ src/IconbarTool.cc | 24 +++++++++++++++++------- src/Toolbar.cc | 35 ++++------------------------------- 4 files changed, 25 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 972b2f3..98c2640 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ (Format: Year/Month/Day) Changes for 0.9.16: *06/04/17: + * Fix some rotated toolbar+textbutton issues (Simon) + Toolbar.cc IconbarTool.cc FbTk/TextButton.cc * Fix /bin/sh portability for fbsetbg and startfluxbox (Simon) (fluxbox-generate_menu is seriously broken wrt portability atm though :-/) diff --git a/src/FbTk/TextButton.cc b/src/FbTk/TextButton.cc index 6bcb0e7..054995a 100644 --- a/src/FbTk/TextButton.cc +++ b/src/FbTk/TextButton.cc @@ -76,6 +76,8 @@ bool TextButton::setOrientation(FbTk::Orientation orient) { } else { m_orientation = orient; } + updateBackground(false); + clear(); return true; } diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc index f49a1fe..e2eede4 100644 --- a/src/IconbarTool.cc +++ b/src/IconbarTool.cc @@ -701,12 +701,16 @@ void IconbarTool::renderTheme() { Pixmap tmp = m_focused_pm; Pixmap err_tmp = m_focused_err_pm; unsigned int icon_width, icon_height; + unsigned int icon_width_off=0, icon_height_off=0; + if (orientation() == FbTk::ROT0 || orientation() == FbTk::ROT180) { icon_width = m_icon_container.maxWidthPerClient(); icon_height = m_icon_container.height(); + icon_width_off = 1; } else { icon_width = m_icon_container.width(); icon_height = m_icon_container.maxWidthPerClient(); + icon_height_off = 1; } if (!m_theme.focusedTexture().usePixmap()) { @@ -716,8 +720,8 @@ void IconbarTool::renderTheme() { m_focused_pm = m_screen.imageControl().renderImage(icon_width, icon_height, m_theme.focusedTexture(), orientation()); - m_focused_err_pm = m_screen.imageControl().renderImage(icon_width+1, - icon_height, + m_focused_err_pm = m_screen.imageControl().renderImage(icon_width+icon_width_off, + icon_height+icon_height_off, m_theme.focusedTexture(), orientation()); } @@ -736,8 +740,8 @@ void IconbarTool::renderTheme() { m_unfocused_pm = m_screen.imageControl().renderImage(icon_width, icon_height, m_theme.unfocusedTexture(), orientation()); - m_unfocused_err_pm = m_screen.imageControl().renderImage(icon_width+1, - icon_height, + m_unfocused_err_pm = m_screen.imageControl().renderImage(icon_width+icon_width_off, + icon_height+icon_height_off, m_theme.unfocusedTexture(), orientation()); } if (tmp) @@ -780,9 +784,15 @@ void IconbarTool::renderButton(IconButton &button, bool clear) { // The last button is always the regular width bool wider_button = false; - if (!m_icon_container.empty()) - wider_button = (button.width() != m_icon_container.back()->width() || // height to cover both orients - button.height() != m_icon_container.back()->height()); + if (!m_icon_container.empty()) { + if (button.orientation() == FbTk::ROT0 || button.orientation() == FbTk::ROT180) + wider_button = button.width() != m_icon_container.back()->width(); + else + wider_button = button.height() != m_icon_container.back()->height(); +// wider_button = (button.width() != m_icon_container.maxWidthPerClient() || // height to cover both orients + +// button.height() != m_icon_container.back()->height()); + } if (button.win().isFocused()) { // focused texture m_icon_container.setSelected(m_icon_container.find(&button)); diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 84a6afb..0a9461a 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -609,21 +609,6 @@ void Toolbar::update(FbTk::Subject *subj) { void Toolbar::setPlacement(Toolbar::Placement where) { // disable vertical toolbar -/* - switch (where) { - case LEFTTOP: - case LEFTCENTER: - case LEFTBOTTOM: - case RIGHTTOP: - case RIGHTCENTER: - case RIGHTBOTTOM: - where = BOTTOMCENTER; - break; - default: - break; - } -*/ - *m_rc_placement = where; int head_x = 0, head_y = 0, @@ -638,10 +623,6 @@ void Toolbar::setPlacement(Toolbar::Placement where) { head_h = screen().getHeadHeight(head); } - FbTk::Orientation was_orient = FbTk::ROT0; - if (!m_item_list.empty()) - was_orient = m_item_list.front()->orientation(); // all save orient (for rendering) - int bevel_width = theme().bevelWidth(); int border_width = theme().border().width(); @@ -784,18 +765,10 @@ void Toolbar::setPlacement(Toolbar::Placement where) { break; } - if (was_orient != orient) { - // hide for all this moving around - if (*m_rc_visible) - frame.window.hide(); - ItemList::iterator item_it = m_item_list.begin(); - ItemList::iterator item_it_end = m_item_list.end(); - for (; item_it != item_it_end; ++item_it) { - (*item_it)->setOrientation(orient); - } - if (*m_rc_visible) - frame.window.show(); - } + ItemList::iterator item_it = m_item_list.begin(); + ItemList::iterator item_it_end = m_item_list.end(); + for (; item_it != item_it_end; ++item_it) + (*item_it)->setOrientation(orient); } void Toolbar::updateVisibleState() { -- cgit v0.11.2