From fd6fbb80e7a6c1d62d696a4f598edc1101b13194 Mon Sep 17 00:00:00 2001 From: nacitar sevaht Date: Mon, 16 May 2011 12:21:47 -0500 Subject: TextDialog and ToolTipWindow style rendering bugs fixed TextDialog windows (such as 'set title', or 'edit clock format') now properly render their titlebar to match the current style. Previously, the titlebar font settings were controlled by window.font.*, and this became apparent because window.font.effect needed to be set to put 'halo' on the titlebar of these TextDialogs. However, window.font.effect controls the effect on the text within the editbox on these as well, having these set in the same location is far from desirable. Specifically because the TextDialog essentially emulates the titlebar of other windows. So, after this change, window.font.effect still controls the text in the editbox, but the titlebar area is themed as the titlebars of other windows. Text justification of titlebar and border width, is now respected in TextDialog. Also, previously the edit box was sized in an odd way; one which left part of the window actually undrawn (so you'd get artifacts from whatever happened to be on the screen in that position when it opened); this has been addressed. TextDialogs, rather than going to the center of the entire desktop, now center on the _current head_, which prevents the awful positioning where half of the window is on one screen and half is on another. Lastly, when hovering your mouse over the iconbar button for a window with a title that's too wide to fit on the button, a tooltip is displayed. This tooltip themes itself to match the button, however it wasn't using the theme properly (similarly to how TextDialog was)... and as such, also wasn't using the proper font effects. This has been addressed just as it was for the TextDialog. --- src/TextDialog.cc | 19 ++++++++++++------- src/TooltipWindow.cc | 9 +++++---- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/TextDialog.cc b/src/TextDialog.cc index 5e9ce82..dc35dbe 100644 --- a/src/TextDialog.cc +++ b/src/TextDialog.cc @@ -44,7 +44,7 @@ TextDialog::TextDialog(BScreen &screen, const string &title) : FbTk::FbWindow(screen.rootWindow().screenNumber(), 0, 0, 200, 1, ExposureMask), m_textbox(*this, screen.focusedWinFrameTheme()->font(), ""), - m_label(*this, screen.focusedWinFrameTheme()->font(), title), + m_label(*this, screen.focusedWinFrameTheme()->iconbarTheme().text().font(), title), m_gc(m_textbox), m_screen(screen), m_move_x(0), @@ -156,6 +156,7 @@ void TextDialog::init() { // we listen to motion notify too m_label.setEventMask(m_label.eventMask() | ButtonPressMask | ButtonMotionMask); m_label.setGC(m_screen.focusedWinFrameTheme()->iconbarTheme().text().textGC()); + m_label.setJustify(m_screen.focusedWinFrameTheme()->iconbarTheme().text().justify()); m_label.show(); // setup text box @@ -167,10 +168,14 @@ void TextDialog::init() { m_textbox.show(); // setup this window - setBorderWidth(1); - setBackgroundColor(white); - // move to center of the screen - move((m_screen.width() - width())/2, (m_screen.height() - height())/2); + setBorderWidth(m_screen.focusedWinFrameTheme()->border().width()); + setBorderColor(m_screen.focusedWinFrameTheme()->border().color()); + + // move to center of the current head + unsigned int head = m_screen.getCurrHead(); + move(m_screen.getHeadX(head) + (m_screen.getHeadWidth(head) - width()) / 2, + m_screen.getHeadY(head) + (m_screen.getHeadHeight(head) - height()) / 2); + updateSizes(); resize(width(), m_textbox.height() + m_label.height()); @@ -185,6 +190,6 @@ void TextDialog::updateSizes() { m_label.moveResize(0, 0, width(), m_textbox.font().height() + 2); - m_textbox.moveResize(2, m_label.height(), - width() - 4, m_textbox.font().height() + 2); + m_textbox.moveResize(0, m_label.height(), + width(), m_textbox.font().height() + 2); } diff --git a/src/TooltipWindow.cc b/src/TooltipWindow.cc index 79d4163..0fb7273 100644 --- a/src/TooltipWindow.cc +++ b/src/TooltipWindow.cc @@ -55,8 +55,8 @@ void TooltipWindow::raiseTooltip() { resize(m_lastText); reconfigTheme(); - int h = theme()->font().height() + theme()->bevelWidth() * 2; - int w = theme()->font().textWidth(m_lastText) + theme()->bevelWidth() * 2; + int h = theme()->iconbarTheme().text().font().height() + theme()->bevelWidth() * 2; + int w = theme()->iconbarTheme().text().font().textWidth(m_lastText) + theme()->bevelWidth() * 2; Window root_ret; // not used Window window_ret; // not used @@ -90,11 +90,12 @@ void TooltipWindow::raiseTooltip() { show(); clear(); - theme()->font().drawText(*this, screen().screenNumber(), + // TODO: make this use a TextButton like TextDialog does + theme()->iconbarTheme().text().font().drawText(*this, screen().screenNumber(), theme()->iconbarTheme().text().textGC(), m_lastText, theme()->bevelWidth(), - theme()->bevelWidth() + theme()->font().ascent()); + theme()->bevelWidth() + theme()->iconbarTheme().text().font().ascent()); } void TooltipWindow::updateText(const FbTk::BiDiString& text) { -- cgit v0.11.2