fix some rotation issues

This commit is contained in:
simonb 2006-04-17 13:35:20 +00:00
parent c5b67f9a42
commit 9ff23f01ca
4 changed files with 25 additions and 38 deletions

View file

@ -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 :-/)

View file

@ -76,6 +76,8 @@ bool TextButton::setOrientation(FbTk::Orientation orient) {
} else {
m_orientation = orient;
}
updateBackground(false);
clear();
return true;
}

View file

@ -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));

View file

@ -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() {