a few random fixes

This commit is contained in:
rathnor 2004-08-29 08:33:13 +00:00
parent 8a59b9b454
commit 97ef84da59
16 changed files with 79 additions and 29 deletions

View file

@ -1,5 +1,10 @@
(Format: Year/Month/Day)
Changes for 0.9.10:
*04/08/29:
* More random render fixes (Simon)
(font alignment in menu, menu optimisation, toolbar font/render)
FbTk/Menu.cc FbTk/MenuItem.cc FbTk/XftFontImp.cc
TextTheme.cc Toolbar.cc ToolbarItem.hh <ToolbarTools>.hh/cc
*04/08/28:
* Some more menu rendering fixes (Simon)
Thanks Florian Pigorsch for nice bug reports + debugging

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: ButtonTool.cc,v 1.4 2004/08/26 15:09:33 rathnor Exp $
// $Id: ButtonTool.cc,v 1.5 2004/08/29 08:33:12 rathnor Exp $
#include "ButtonTool.hh"
@ -48,6 +48,11 @@ ButtonTool::~ButtonTool() {
}
void ButtonTool::updateSizing() {
FbTk::Button &btn = static_cast<FbTk::Button &>(window());
btn.setBorderWidth(theme().border().width());
}
void ButtonTool::renderTheme() {
FbTk::Button &btn = static_cast<FbTk::Button &>(window());

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: ButtonTool.hh,v 1.1 2003/10/13 23:38:17 fluxgen Exp $
// $Id: ButtonTool.hh,v 1.2 2004/08/29 08:33:12 rathnor Exp $
#ifndef BUTTONTOOL_HH
#define BUTTONTOOL_HH
@ -42,6 +42,7 @@ public:
protected:
void renderTheme();
void updateSizing();
Pixmap m_cache_pm, m_cache_pressed_pm;
FbTk::ImageControl &m_image_ctrl;
};

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: ClockTool.cc,v 1.12 2004/08/25 17:16:40 rathnor Exp $
// $Id: ClockTool.cc,v 1.13 2004/08/29 08:33:12 rathnor Exp $
#include "ClockTool.hh"
@ -246,6 +246,11 @@ void ClockTool::updateTime() {
m_button.clear();
}
// Just change things that affect the size
void ClockTool::updateSizing() {
m_button.setBorderWidth(m_theme.border().width());
}
void ClockTool::renderTheme() {
Pixmap old_pm = m_pixmap;
if (!m_theme.texture().usePixmap()) {

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: ClockTool.hh,v 1.4 2003/12/04 23:02:23 fluxgen Exp $
// $Id: ClockTool.hh,v 1.5 2004/08/29 08:33:12 rathnor Exp $
#ifndef CLOCKTOOL_HH
#define CLOCKTOOL_HH
@ -66,6 +66,7 @@ private:
void updateTime();
void update(FbTk::Subject *subj);
void renderTheme();
void updateSizing();
FbTk::TextButton m_button;

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Menu.cc,v 1.74 2004/08/28 19:03:09 rathnor Exp $
// $Id: Menu.cc,v 1.75 2004/08/29 08:33:13 rathnor Exp $
//use GNU extensions
#ifndef _GNU_SOURCE
@ -777,12 +777,14 @@ void Menu::redrawTitle() {
0, 0,
m_title_pm.width(), m_title_pm.height());
// difference between height based on font, and style-set height
int height_offset = theme().titleHeight() - (font.height() + 2*theme().bevelWidth());
menu.title.updateTransparent();
font.drawText(m_real_title_pm.drawable(), // drawable
screenNumber(),
theme().titleTextGC().gc(), // graphic context
text, len, // text string with lenght
dx, theme().titleHeight()/2 + (font.ascent() - theme().bevelWidth())/2); // position
text, len, // text string with length
dx, font.ascent() + theme().bevelWidth() + height_offset/2); // position
}
@ -1196,6 +1198,9 @@ void Menu::motionNotifyEvent(XMotionEvent &me) {
int sbl = (me.x / menu.item_w),
i = (me.y / theme().itemHeight()),
w = (sbl * menu.persub) + i;
if (w == m_active_index)
return;
if (validIndex(m_active_index) && w != m_active_index) {

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: MenuItem.cc,v 1.5 2004/08/03 21:31:31 fluxgen Exp $
// $Id: MenuItem.cc,v 1.6 2004/08/29 08:33:13 rathnor Exp $
#include "MenuItem.hh"
#include "Command.hh"
@ -91,7 +91,8 @@ void MenuItem::draw(FbDrawable &draw,
int text_w = theme.frameFont().textWidth(label().c_str(), label().size());
text_y = y - theme.bevelWidth()/2 + theme.frameFont().ascent()/2 + height/2;
int height_offset = theme.itemHeight() - (theme.frameFont().height() + 2*theme.bevelWidth());
text_y = y + theme.bevelWidth() + theme.frameFont().ascent() + height_offset/2; ///2 + height/2;
switch(theme.frameFontJustify()) {
case FbTk::LEFT:

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//$Id: XftFontImp.cc,v 1.3 2004/08/10 11:57:35 fluxgen Exp $
//$Id: XftFontImp.cc,v 1.4 2004/08/29 08:33:13 rathnor Exp $
#include "XftFontImp.hh"
#include "App.hh"
@ -157,7 +157,10 @@ unsigned int XftFontImp::textWidth(const char * const text, unsigned int len) co
unsigned int XftFontImp::height() const {
if (m_xftfont == 0)
return 0;
return m_xftfont->height;
return m_xftfont->height;
//m_xftfont->ascent + m_xftfont->descent;
// curiously, fonts seem to have a smaller height, but the "height"
// is specified within the actual font, so it must be right, right?
}
}; // end namespace FbTk

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: IconbarTool.cc,v 1.42 2004/08/25 17:16:40 rathnor Exp $
// $Id: IconbarTool.cc,v 1.43 2004/08/29 08:33:12 rathnor Exp $
#include "IconbarTool.hh"
@ -543,10 +543,9 @@ void IconbarTool::renderWindow(FluxboxWindow &win) {
renderButton(*button);
}
void IconbarTool::updateSizing() {
m_icon_container.setBorderWidth(m_theme.border().width());
void IconbarTool::renderTheme() {
// update button sizes before we get max width per client!
IconList::iterator icon_it = m_icon_list.begin();
const IconList::iterator icon_it_end = m_icon_list.end();
for (; icon_it != icon_it_end; ++icon_it) {
@ -555,6 +554,13 @@ void IconbarTool::renderTheme() {
else // unfocused
(*icon_it)->setBorderWidth(m_theme.unfocusedBorder().width());
}
}
void IconbarTool::renderTheme() {
// update button sizes before we get max width per client!
updateSizing();
Pixmap tmp = m_focused_pm;
Pixmap err_tmp = m_focused_err_pm;
@ -616,7 +622,8 @@ void IconbarTool::renderTheme() {
m_icon_container.setAlpha(m_theme.alpha());
// update buttons
icon_it = m_icon_list.begin();
IconList::iterator icon_it = m_icon_list.begin();
const IconList::iterator icon_it_end = m_icon_list.end();
for (; icon_it != icon_it_end; ++icon_it) {
renderButton(*(*icon_it));
}

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: IconbarTool.hh,v 1.14 2004/06/16 15:38:19 rathnor Exp $
// $Id: IconbarTool.hh,v 1.15 2004/08/29 08:33:12 rathnor Exp $
#ifndef ICONBARTOOL_HH
#define ICONBARTOOL_HH
@ -79,6 +79,8 @@ private:
/// @return button associated with window
IconButton *findButton(FluxboxWindow &win);
void updateSizing();
/// render single button that holds win
void renderWindow(FluxboxWindow &win);
/// render single button, and probably apply changes (clear)

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: SystemTray.hh,v 1.5 2004/08/25 17:16:40 rathnor Exp $
// $Id: SystemTray.hh,v 1.6 2004/08/29 08:33:12 rathnor Exp $
#ifndef SYSTEMTRAY_HH
#define SYSTEMTRAY_HH
@ -66,6 +66,7 @@ public:
const FbTk::FbWindow &window() const { return m_window; }
inline void renderTheme() {}
inline void updateSizing() {}
private:
typedef std::list<FbTk::FbWindow *> ClientList;

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: TextTheme.cc,v 1.6 2003/08/27 18:05:12 fluxgen Exp $
// $Id: TextTheme.cc,v 1.7 2004/08/29 08:33:12 rathnor Exp $
#include "TextTheme.hh"
@ -28,7 +28,7 @@
#include <X11/Xlib.h>
TextTheme::TextTheme(FbTk::Theme &theme,
TextTheme::TextTheme(FbTk::Theme &theme,
const std::string &name, const std::string &altname):
m_font(theme, name + ".font", altname + ".Font"),
m_text_color(theme, name + ".textColor", altname + ".TextColor"),
@ -49,6 +49,7 @@ TextTheme::~TextTheme() {
void TextTheme::update() {
m_text_gc.setForeground(*m_text_color);
}
void TextTheme::setAntialias(bool value) {
font().setAntialias(value);

View file

@ -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.148 2004/08/25 17:16:40 rathnor Exp $
// $Id: Toolbar.cc,v 1.149 2004/08/29 08:33:12 rathnor Exp $
#include "Toolbar.hh"
@ -227,6 +227,7 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width):
m_theme.reconfigSig().attach(this);
// listen to screen size changes
screen().resizeSig().attach(this);
screen().reconfigureSig().attach(this); // get this on antialias change
moveToLayer((*m_rc_layernum).getNum());
@ -453,12 +454,16 @@ void Toolbar::reconfigure() {
ItemList::iterator item_it = m_item_list.begin();
ItemList::iterator item_it_end = m_item_list.end();
for (item_it = m_item_list.begin(); item_it != item_it_end; ++item_it) {
(*item_it)->renderTheme();
for (; item_it != item_it_end; ++item_it) {
(*item_it)->updateSizing();
}
rearrangeItems();
for (item_it = m_item_list.begin(); item_it != item_it_end; ++item_it) {
(*item_it)->renderTheme();
}
menu().reconfigure();
// we're done with all resizing and stuff now we can request a new
// area to be reserved on screen
@ -568,11 +573,11 @@ void Toolbar::update(FbTk::Subject *subj) {
// either screen reconfigured, theme was reloaded
// or a tool resized itself
if (typeid(*subj) == typeid(ToolbarItem::ToolbarItemSubject)) {
if (typeid(*subj) == typeid(ToolbarItem::ToolbarItemSubject))
rearrangeItems();
} else {
else
reconfigure();
}
}
void Toolbar::setPlacement(Toolbar::Placement where) {

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: ToolbarItem.hh,v 1.5 2004/08/25 17:16:40 rathnor Exp $
// $Id: ToolbarItem.hh,v 1.6 2004/08/29 08:33:13 rathnor Exp $
#ifndef TOOLBARITEM_HH
#define TOOLBARITEM_HH
@ -57,6 +57,9 @@ public:
// the toolbar instead. Otherwise there are ordering problems.
virtual void renderTheme() = 0;
// just update theme items that affect the size
virtual void updateSizing() = 0;
FbTk::Subject &resizeSig() { return m_resize_sig; }
void setType(Type type) { m_type = type; }

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: WorkspaceNameTool.cc,v 1.9 2004/08/25 17:16:40 rathnor Exp $
// $Id: WorkspaceNameTool.cc,v 1.10 2004/08/29 08:33:13 rathnor Exp $
#include "WorkspaceNameTool.hh"
@ -109,6 +109,10 @@ void WorkspaceNameTool::hide() {
m_button.hide();
}
void WorkspaceNameTool::updateSizing() {
m_button.setBorderWidth(m_theme.border().width());
}
void WorkspaceNameTool::renderTheme() {
Pixmap tmp = m_pixmap;
if (!m_theme.texture().usePixmap()) {

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: WorkspaceNameTool.hh,v 1.4 2003/08/23 15:45:38 fluxgen Exp $
// $Id: WorkspaceNameTool.hh,v 1.5 2004/08/29 08:33:13 rathnor Exp $
#ifndef WORKSPACENAMETOOL_HH
#define WORKSPACENAMETOOL_HH
@ -54,6 +54,7 @@ public:
const FbTk::Button &button() const { return m_button; }
private:
void renderTheme();
void updateSizing();
FbTk::TextButton m_button;
const ToolTheme &m_theme;
BScreen &m_screen;