From 41c0ea543c68b54fd4eef78a773d8d8d179963fd Mon Sep 17 00:00:00 2001 From: rathnor Date: Mon, 28 Apr 2003 16:48:23 +0000 Subject: toolbar size + alignment fixes --- ChangeLog | 3 +++ src/IconBar.cc | 7 ++++--- src/Toolbar.cc | 56 +++++++++++++++++++++++++++++++++++++++++--------------- 3 files changed, 48 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 536e3a0..e5975e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ (Format: Year/Month/Day) Changes for 0.9.2: *03/04/28: + * Fix a bunch of alignment + size issues with toolbar (particularly + when vertical) (Simon) + Toolbar.cc Iconbar.cc * Fix remembering (and general init) of decorations (Simon) Window.hh/cc * Fix handleEvent issues, plus detachClient crash (Simon) diff --git a/src/IconBar.cc b/src/IconBar.cc index 5de8558..8e28f2a 100644 --- a/src/IconBar.cc +++ b/src/IconBar.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconBar.cc,v 1.31 2003/04/25 10:40:31 fluxgen Exp $ +// $Id: IconBar.cc,v 1.32 2003/04/28 16:48:22 rathnor Exp $ #include "IconBar.hh" @@ -339,8 +339,9 @@ void IconBar::draw(const IconBarObj * const obj, int width) const { if (m_vertical) { int tmp = dy; dy = obj->height() - dx; - dx = tmp; - } + dx = tmp + bevel_w; + } else + dy += bevel_w; m_font.drawText( iconwin, diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 349f1ea..541bdea 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.cc,v 1.76 2003/04/27 04:28:03 rathnor Exp $ +// $Id: Toolbar.cc,v 1.77 2003/04/28 16:48:23 rathnor Exp $ #include "Toolbar.hh" @@ -462,10 +462,27 @@ void Toolbar::reconfigure() { else if (frame.workspace_label_w > frame.clock_w) frame.clock_w = frame.workspace_label_w; - frame.window_label_w = - (frame.width - (frame.clock_w + (frame.button_w * 4) + - frame.workspace_label_w + (frame.bevel_w * 8) + 6)); - + // Right, let's break this one down.... + // full width, minus clock, workspace label and the 4 arrow buttons. + // each of the (6) aforementioned items are separated by a bevel width, + // plus outside (+1), plus the window label (+1). + + i = frame.clock_w + (frame.button_w * 4) + + frame.workspace_label_w + (frame.bevel_w * 8) + 6; + + // of course if your toolbar is set too small, this could go negative. + // which is bad mmmkay. Since we are unsigned, we check that *first*. + if (vertical) + w = frame.height; + else + w = frame.width; + + if (i > w) + frame.window_label_w = 0; + else + frame.window_label_w = w - i; + + if (hidden) frame.window.moveResize(frame.x_hidden, frame.y_hidden, frame.width, frame.height); @@ -477,6 +494,12 @@ void Toolbar::reconfigure() { unsigned int next_x = frame.workspace_label_w; unsigned int next_y = frame.window.height(); + unsigned int text_x=0, text_y=0; + if (vertical) + text_x = frame.bevel_w; + else + text_y = frame.bevel_w; + if (vertical) { next_x = frame.window.width(); @@ -507,12 +530,11 @@ void Toolbar::reconfigure() { if (vertical) { next_y += frame.nsbutton.height() + 1; label_w = frame.width; - label_h = frame.window_label_w - frame.width + frame.height; + label_h = frame.window_label_w/* - frame.width + frame.height*/; } else next_x += frame.nsbutton.width() + 1; - frame.window_label.moveResize(next_x, next_y, label_w, label_h); if (vertical) @@ -538,7 +560,7 @@ void Toolbar::reconfigure() { } else next_x += frame.nwbutton.width() + 1; - frame.clock.moveResize(next_x, next_y, + frame.clock.moveResize(next_x + text_x, next_y + text_y, clock_w, clock_h); Pixmap tmp = frame.base; @@ -650,6 +672,9 @@ void Toolbar::reconfigure() { frame.nwbutton.clear(); redrawWindowLabel(); + if (m_iconbar.get()) + m_iconbar->reconfigure(); + redrawWorkspaceLabel(); checkClock(true); @@ -775,8 +800,9 @@ void Toolbar::redrawWindowLabel(bool redraw) { if (m_theme.font().isRotated()) { int tmp = dy; dy = frame.window_label.height() - dx; - dx = tmp; - } + dx = tmp + frame.bevel_w; + } else + dy += frame.bevel_w; m_theme.font().drawText( frame.window_label.window(), @@ -1151,28 +1177,28 @@ void Toolbar::setPlacement(Toolbar::Placement where) { break; case LEFTBOTTOM: frame.x = head_x; - frame.y = head_y + head_h - frame.height; + frame.y = head_y + head_h - frame.height - screen().rootTheme().borderWidth()*2; frame.x_hidden = frame.x - frame.width + screen().rootTheme().bevelWidth() + screen().rootTheme().borderWidth(); frame.y_hidden = frame.y; break; case RIGHTCENTER: - frame.x = head_x + head_w - frame.width; + frame.x = head_x + head_w - frame.width - screen().rootTheme().borderWidth()*2; frame.y = head_y + (head_h - frame.height)/2; frame.x_hidden = frame.x + frame.width - screen().rootTheme().bevelWidth() - screen().rootTheme().borderWidth(); frame.y_hidden = frame.y; break; case RIGHTTOP: - frame.x = head_x + head_w - frame.width; + frame.x = head_x + head_w - frame.width - screen().rootTheme().borderWidth()*2; frame.y = head_y; frame.x_hidden = frame.x + frame.width - screen().rootTheme().bevelWidth() - screen().rootTheme().borderWidth(); frame.y_hidden = frame.y; break; case RIGHTBOTTOM: - frame.x = head_x + head_w - frame.width; - frame.y = head_y + head_h - frame.height; + frame.x = head_x + head_w - frame.width - screen().rootTheme().borderWidth()*2; + frame.y = head_y + head_h - frame.height - screen().rootTheme().borderWidth()*2; frame.x_hidden = frame.x + frame.width - screen().rootTheme().bevelWidth() - screen().rootTheme().borderWidth(); frame.y_hidden = frame.y; -- cgit v0.11.2