using new font system for labelstyle, windowstyle
This commit is contained in:
parent
715f363016
commit
3e972e83bd
5 changed files with 98 additions and 132 deletions
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: IconBar.cc,v 1.15 2002/08/04 15:23:24 fluxgen Exp $
|
// $Id: IconBar.cc,v 1.16 2002/10/15 17:10:48 fluxgen Exp $
|
||||||
|
|
||||||
#include "IconBar.hh"
|
#include "IconBar.hh"
|
||||||
#include "i18n.hh"
|
#include "i18n.hh"
|
||||||
|
@ -261,9 +261,9 @@ void IconBar::draw(IconBarObj *obj, int width) {
|
||||||
FluxboxWindow *fluxboxwin = obj->getFluxboxWin();
|
FluxboxWindow *fluxboxwin = obj->getFluxboxWin();
|
||||||
Window iconwin = obj->getIconWin();
|
Window iconwin = obj->getIconWin();
|
||||||
unsigned int title_text_w;
|
unsigned int title_text_w;
|
||||||
|
/*
|
||||||
const int multibyte = I18n::instance()->multibyte();
|
const int multibyte = I18n::instance()->multibyte();
|
||||||
|
|
||||||
if (multibyte) {
|
if (multibyte) {
|
||||||
XRectangle ink, logical;
|
XRectangle ink, logical;
|
||||||
XmbTextExtents(m_screen->getWindowStyle()->font.set,
|
XmbTextExtents(m_screen->getWindowStyle()->font.set,
|
||||||
|
@ -273,14 +273,16 @@ void IconBar::draw(IconBarObj *obj, int width) {
|
||||||
title_text_w = XTextWidth(m_screen->getWindowStyle()->font.fontstruct,
|
title_text_w = XTextWidth(m_screen->getWindowStyle()->font.fontstruct,
|
||||||
fluxboxwin->getIconTitle().c_str(), fluxboxwin->getIconTitle().size());
|
fluxboxwin->getIconTitle().c_str(), fluxboxwin->getIconTitle().size());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
title_text_w = m_screen->getWindowStyle()->font.textWidth(
|
||||||
|
fluxboxwin->getIconTitle().c_str(), fluxboxwin->getIconTitle().size());
|
||||||
int l = title_text_w;
|
int l = title_text_w;
|
||||||
unsigned int dlen=fluxboxwin->getIconTitle().size();
|
unsigned int dlen=fluxboxwin->getIconTitle().size();
|
||||||
unsigned int bevel_w = m_screen->getBevelWidth();
|
unsigned int bevel_w = m_screen->getBevelWidth();
|
||||||
int dx=bevel_w*2;
|
int dx=bevel_w*2;
|
||||||
|
|
||||||
for (; dlen >= 0; dlen--) {
|
for (; dlen >= 0; dlen--) {
|
||||||
if (multibyte) {
|
/*if (multibyte) {
|
||||||
XRectangle ink, logical;
|
XRectangle ink, logical;
|
||||||
XmbTextExtents(m_screen->getWindowStyle()->tab.font.set,
|
XmbTextExtents(m_screen->getWindowStyle()->tab.font.set,
|
||||||
fluxboxwin->getIconTitle().c_str(), dlen,
|
fluxboxwin->getIconTitle().c_str(), dlen,
|
||||||
|
@ -289,13 +291,16 @@ void IconBar::draw(IconBarObj *obj, int width) {
|
||||||
} else
|
} else
|
||||||
l = XTextWidth(m_screen->getWindowStyle()->tab.font.fontstruct,
|
l = XTextWidth(m_screen->getWindowStyle()->tab.font.fontstruct,
|
||||||
fluxboxwin->getIconTitle().c_str(), dlen);
|
fluxboxwin->getIconTitle().c_str(), dlen);
|
||||||
l += (bevel_w * 4);
|
*/
|
||||||
|
l = m_screen->getWindowStyle()->tab.font.textWidth(
|
||||||
|
fluxboxwin->getIconTitle().c_str(), dlen);
|
||||||
|
l += (bevel_w * 4);
|
||||||
|
|
||||||
if (l < width)
|
if (l < width)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (m_screen->getWindowStyle()->tab.font.justify) {
|
switch (m_screen->getWindowStyle()->tab.justify) {
|
||||||
case DrawUtil::Font::RIGHT:
|
case DrawUtil::Font::RIGHT:
|
||||||
dx += width - l;
|
dx += width - l;
|
||||||
break;
|
break;
|
||||||
|
@ -309,7 +314,7 @@ void IconBar::draw(IconBarObj *obj, int width) {
|
||||||
//Draw title to m_iconwin
|
//Draw title to m_iconwin
|
||||||
|
|
||||||
XClearWindow(m_display, iconwin);
|
XClearWindow(m_display, iconwin);
|
||||||
|
/*
|
||||||
if (multibyte) {
|
if (multibyte) {
|
||||||
XmbDrawString(m_display, iconwin,
|
XmbDrawString(m_display, iconwin,
|
||||||
m_screen->getWindowStyle()->tab.font.set,
|
m_screen->getWindowStyle()->tab.font.set,
|
||||||
|
@ -322,6 +327,13 @@ void IconBar::draw(IconBarObj *obj, int width) {
|
||||||
m_screen->getWindowStyle()->tab.font.fontstruct->ascent + 1,
|
m_screen->getWindowStyle()->tab.font.fontstruct->ascent + 1,
|
||||||
fluxboxwin->getIconTitle().c_str(), dlen);
|
fluxboxwin->getIconTitle().c_str(), dlen);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
m_screen->getWindowStyle()->tab.font.drawText(
|
||||||
|
iconwin,
|
||||||
|
m_screen->getScreenNumber(),
|
||||||
|
m_screen->getWindowStyle()->tab.l_text_focus_gc,
|
||||||
|
fluxboxwin->getIconTitle().c_str(), dlen,
|
||||||
|
dx, m_screen->getWindowStyle()->tab.font.height());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Screen.cc,v 1.73 2002/10/15 13:05:55 fluxgen Exp $
|
// $Id: Screen.cc,v 1.74 2002/10/15 17:12:23 fluxgen Exp $
|
||||||
|
|
||||||
//use GNU extensions
|
//use GNU extensions
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
|
@ -288,7 +288,7 @@ resource(rm, screenname, altscreenname)
|
||||||
"0: 0000 x 0: 0000");
|
"0: 0000 x 0: 0000");
|
||||||
|
|
||||||
int l = strlen(s);
|
int l = strlen(s);
|
||||||
|
/*
|
||||||
if (i18n->multibyte()) {
|
if (i18n->multibyte()) {
|
||||||
XRectangle ink, logical;
|
XRectangle ink, logical;
|
||||||
XmbTextExtents(theme->getWindowStyle().font.set, s, l, &ink, &logical);
|
XmbTextExtents(theme->getWindowStyle().font.set, s, l, &ink, &logical);
|
||||||
|
@ -301,7 +301,10 @@ resource(rm, screenname, altscreenname)
|
||||||
|
|
||||||
geom_w = XTextWidth(theme->getWindowStyle().font.fontstruct, s, l);
|
geom_w = XTextWidth(theme->getWindowStyle().font.fontstruct, s, l);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
geom_h = theme->getWindowStyle().font.height();
|
||||||
|
geom_w = theme->getWindowStyle().font.textWidth(s, l);
|
||||||
|
|
||||||
geom_w += getBevelWidth()*2;
|
geom_w += getBevelWidth()*2;
|
||||||
geom_h += getBevelWidth()*2;
|
geom_h += getBevelWidth()*2;
|
||||||
|
|
||||||
|
@ -527,7 +530,7 @@ void BScreen::reconfigure() {
|
||||||
FBNLS::ScreenSet, FBNLS::ScreenPositionLength,
|
FBNLS::ScreenSet, FBNLS::ScreenPositionLength,
|
||||||
"0: 0000 x 0: 0000");
|
"0: 0000 x 0: 0000");
|
||||||
int l = strlen(s);
|
int l = strlen(s);
|
||||||
|
/*
|
||||||
if (i18n->multibyte()) {
|
if (i18n->multibyte()) {
|
||||||
XRectangle ink, logical;
|
XRectangle ink, logical;
|
||||||
XmbTextExtents(theme->getWindowStyle().font.set, s, l, &ink, &logical);
|
XmbTextExtents(theme->getWindowStyle().font.set, s, l, &ink, &logical);
|
||||||
|
@ -540,7 +543,10 @@ void BScreen::reconfigure() {
|
||||||
geom_h = theme->getWindowStyle().font.fontstruct->ascent +
|
geom_h = theme->getWindowStyle().font.fontstruct->ascent +
|
||||||
theme->getWindowStyle().font.fontstruct->descent;
|
theme->getWindowStyle().font.fontstruct->descent;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
//TODO: repeat from somewhere else?
|
||||||
|
geom_h = theme->getWindowStyle().font.height();
|
||||||
|
geom_w = theme->getWindowStyle().font.textWidth(s, l);
|
||||||
geom_w += getBevelWidth()*2;
|
geom_w += getBevelWidth()*2;
|
||||||
geom_h += getBevelWidth()*2;
|
geom_h += getBevelWidth()*2;
|
||||||
|
|
||||||
|
@ -1620,7 +1626,7 @@ void BScreen::showPosition(int x, int y) {
|
||||||
"X: %4d x Y: %4d"), x, y);
|
"X: %4d x Y: %4d"), x, y);
|
||||||
|
|
||||||
XClearWindow(getBaseDisplay()->getXDisplay(), geom_window);
|
XClearWindow(getBaseDisplay()->getXDisplay(), geom_window);
|
||||||
|
/*
|
||||||
if (I18n::instance()->multibyte())
|
if (I18n::instance()->multibyte())
|
||||||
XmbDrawString(getBaseDisplay()->getXDisplay(), geom_window,
|
XmbDrawString(getBaseDisplay()->getXDisplay(), geom_window,
|
||||||
theme->getWindowStyle().font.set, theme->getWindowStyle().l_text_focus_gc,
|
theme->getWindowStyle().font.set, theme->getWindowStyle().l_text_focus_gc,
|
||||||
|
@ -1633,7 +1639,15 @@ void BScreen::showPosition(int x, int y) {
|
||||||
theme->getBevelWidth(),
|
theme->getBevelWidth(),
|
||||||
theme->getWindowStyle().font.fontstruct->ascent +
|
theme->getWindowStyle().font.fontstruct->ascent +
|
||||||
theme->getBevelWidth(), label, strlen(label));
|
theme->getBevelWidth(), label, strlen(label));
|
||||||
|
*/
|
||||||
|
theme->getWindowStyle().font.drawText(
|
||||||
|
geom_window,
|
||||||
|
getScreenNumber(),
|
||||||
|
theme->getWindowStyle().l_text_focus_gc,
|
||||||
|
label, strlen(label),
|
||||||
|
theme->getBevelWidth(), theme->getBevelWidth() +
|
||||||
|
theme->getWindowStyle().font.height());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1664,7 +1678,7 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) {
|
||||||
"W: %4d x H: %4d"), gx, gy);
|
"W: %4d x H: %4d"), gx, gy);
|
||||||
|
|
||||||
XClearWindow(getBaseDisplay()->getXDisplay(), geom_window);
|
XClearWindow(getBaseDisplay()->getXDisplay(), geom_window);
|
||||||
|
/*
|
||||||
if (I18n::instance()->multibyte())
|
if (I18n::instance()->multibyte())
|
||||||
XmbDrawString(getBaseDisplay()->getXDisplay(), geom_window,
|
XmbDrawString(getBaseDisplay()->getXDisplay(), geom_window,
|
||||||
theme->getWindowStyle().font.set, theme->getWindowStyle().l_text_focus_gc,
|
theme->getWindowStyle().font.set, theme->getWindowStyle().l_text_focus_gc,
|
||||||
|
@ -1677,6 +1691,15 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) {
|
||||||
theme->getBevelWidth(),
|
theme->getBevelWidth(),
|
||||||
theme->getWindowStyle().font.fontstruct->ascent +
|
theme->getWindowStyle().font.fontstruct->ascent +
|
||||||
theme->getBevelWidth(), label, strlen(label));
|
theme->getBevelWidth(), label, strlen(label));
|
||||||
|
*/
|
||||||
|
//TODO: geom window again?! repeat
|
||||||
|
theme->getWindowStyle().font.drawText(
|
||||||
|
geom_window,
|
||||||
|
getScreenNumber(),
|
||||||
|
theme->getWindowStyle().l_text_focus_gc,
|
||||||
|
label, strlen(label),
|
||||||
|
theme->getBevelWidth(), theme->getBevelWidth() +
|
||||||
|
theme->getWindowStyle().font.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
101
src/Theme.cc
101
src/Theme.cc
|
@ -21,7 +21,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Theme.cc,v 1.30 2002/10/15 10:53:01 fluxgen Exp $
|
// $Id: Theme.cc,v 1.31 2002/10/15 17:08:45 fluxgen Exp $
|
||||||
|
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
@ -62,10 +62,8 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe
|
||||||
#endif //DEBUG
|
#endif //DEBUG
|
||||||
//default settings
|
//default settings
|
||||||
|
|
||||||
m_windowstyle.font.set = m_toolbarstyle.font.set = m_windowstyle.tab.font.set = 0;
|
m_toolbarstyle.font.set = 0;
|
||||||
|
m_toolbarstyle.font.fontstruct = 0;
|
||||||
m_toolbarstyle.font.fontstruct = m_windowstyle.font.fontstruct = m_windowstyle.tab.font.fontstruct = 0;
|
|
||||||
m_windowstyle.tab.rot_font = 0;
|
|
||||||
|
|
||||||
load(filename);
|
load(filename);
|
||||||
//-------- create gc for the styles ------------
|
//-------- create gc for the styles ------------
|
||||||
|
@ -74,9 +72,6 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
unsigned long gc_value_mask = GCForeground;
|
unsigned long gc_value_mask = GCForeground;
|
||||||
|
|
||||||
if (! I18n::instance()->multibyte())
|
|
||||||
gc_value_mask |= GCFont;
|
|
||||||
|
|
||||||
gcv.foreground = WhitePixel(m_display, screennum)^BlackPixel(m_display, screennum);
|
gcv.foreground = WhitePixel(m_display, screennum)^BlackPixel(m_display, screennum);
|
||||||
gcv.function = GXxor;
|
gcv.function = GXxor;
|
||||||
gcv.subwindow_mode = IncludeInferiors;
|
gcv.subwindow_mode = IncludeInferiors;
|
||||||
|
@ -84,24 +79,17 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe
|
||||||
GCForeground | GCFunction | GCSubwindowMode, &gcv);
|
GCForeground | GCFunction | GCSubwindowMode, &gcv);
|
||||||
|
|
||||||
gcv.foreground = m_windowstyle.l_text_focus.pixel();
|
gcv.foreground = m_windowstyle.l_text_focus.pixel();
|
||||||
if (m_windowstyle.font.fontstruct)
|
|
||||||
gcv.font = m_windowstyle.font.fontstruct->fid;
|
|
||||||
|
|
||||||
m_windowstyle.l_text_focus_gc =
|
m_windowstyle.l_text_focus_gc =
|
||||||
XCreateGC(m_display, rootwindow,
|
XCreateGC(m_display, rootwindow,
|
||||||
gc_value_mask, &gcv);
|
gc_value_mask, &gcv);
|
||||||
|
|
||||||
gcv.foreground = m_windowstyle.l_text_unfocus.pixel();
|
gcv.foreground = m_windowstyle.l_text_unfocus.pixel();
|
||||||
if (m_windowstyle.font.fontstruct)
|
|
||||||
gcv.font = m_windowstyle.font.fontstruct->fid;
|
|
||||||
m_windowstyle.l_text_unfocus_gc =
|
m_windowstyle.l_text_unfocus_gc =
|
||||||
XCreateGC(m_display, rootwindow,
|
XCreateGC(m_display, rootwindow,
|
||||||
gc_value_mask, &gcv);
|
gc_value_mask, &gcv);
|
||||||
|
|
||||||
//---- Tab
|
//---- Tab
|
||||||
gcv.foreground = m_windowstyle.tab.l_text_focus.pixel();
|
gcv.foreground = m_windowstyle.tab.l_text_focus.pixel();
|
||||||
if (m_windowstyle.tab.font.fontstruct)
|
|
||||||
gcv.font = m_windowstyle.tab.font.fontstruct->fid;
|
|
||||||
|
|
||||||
m_windowstyle.tab.l_text_focus_gc =
|
m_windowstyle.tab.l_text_focus_gc =
|
||||||
XCreateGC(m_display, rootwindow,
|
XCreateGC(m_display, rootwindow,
|
||||||
|
@ -202,15 +190,8 @@ void Theme::freeMenuStyle() {
|
||||||
|
|
||||||
//----- freeWindowStyle -----
|
//----- freeWindowStyle -----
|
||||||
// free memory allocated for m_windowstyle
|
// free memory allocated for m_windowstyle
|
||||||
// should only be called from ~Theme
|
|
||||||
//--------------------
|
//--------------------
|
||||||
void Theme::freeWindowStyle() {
|
void Theme::freeWindowStyle() {
|
||||||
if (m_windowstyle.font.set)
|
|
||||||
XFreeFontSet(m_display, m_windowstyle.font.set);
|
|
||||||
|
|
||||||
if (m_windowstyle.font.fontstruct)
|
|
||||||
XFreeFont(m_display, m_windowstyle.font.fontstruct);
|
|
||||||
|
|
||||||
XFreeGC(m_display, m_windowstyle.l_text_focus_gc);
|
XFreeGC(m_display, m_windowstyle.l_text_focus_gc);
|
||||||
XFreeGC(m_display, m_windowstyle.l_text_unfocus_gc);
|
XFreeGC(m_display, m_windowstyle.l_text_unfocus_gc);
|
||||||
XFreeGC(m_display, m_windowstyle.b_pic_focus_gc);
|
XFreeGC(m_display, m_windowstyle.b_pic_focus_gc);
|
||||||
|
@ -219,20 +200,8 @@ void Theme::freeWindowStyle() {
|
||||||
|
|
||||||
//----- freeTabStyle -----
|
//----- freeTabStyle -----
|
||||||
// free memory allocated for m_windowstyle.tab
|
// free memory allocated for m_windowstyle.tab
|
||||||
// should only be called from ~Theme
|
|
||||||
//--------------------
|
//--------------------
|
||||||
void Theme::freeTabStyle() {
|
void Theme::freeTabStyle() {
|
||||||
|
|
||||||
if (m_windowstyle.tab.font.set)
|
|
||||||
XFreeFontSet(m_display, m_windowstyle.tab.font.set);
|
|
||||||
|
|
||||||
if (m_windowstyle.tab.font.fontstruct)
|
|
||||||
XFreeFont(m_display, m_windowstyle.tab.font.fontstruct);
|
|
||||||
|
|
||||||
if (m_windowstyle.tab.rot_font)
|
|
||||||
DrawUtil::XRotUnloadFont(m_display, m_windowstyle.tab.rot_font);
|
|
||||||
|
|
||||||
|
|
||||||
XFreeGC(m_display, m_windowstyle.tab.l_text_focus_gc);
|
XFreeGC(m_display, m_windowstyle.tab.l_text_focus_gc);
|
||||||
XFreeGC(m_display, m_windowstyle.tab.l_text_unfocus_gc);
|
XFreeGC(m_display, m_windowstyle.tab.l_text_unfocus_gc);
|
||||||
}
|
}
|
||||||
|
@ -445,17 +414,7 @@ void Theme::loadWindowStyle() {
|
||||||
WhitePixel(m_display, m_screennum));
|
WhitePixel(m_display, m_screennum));
|
||||||
|
|
||||||
//----- font
|
//----- font
|
||||||
|
loadFontFromDatabase(m_windowstyle.font, "window.font", "Window.Font");
|
||||||
if (I18n::instance()->multibyte()) {
|
|
||||||
readDatabaseFontSet("window.font", "Window.Font",
|
|
||||||
&m_windowstyle.font.set);
|
|
||||||
|
|
||||||
m_windowstyle.font.set_extents =
|
|
||||||
XExtentsOfFontSet(m_windowstyle.font.set);
|
|
||||||
} else {
|
|
||||||
readDatabaseFont("window.font", "Window.Font",
|
|
||||||
&m_windowstyle.font.fontstruct);
|
|
||||||
}
|
|
||||||
|
|
||||||
XrmValue value;
|
XrmValue value;
|
||||||
char *value_type;
|
char *value_type;
|
||||||
|
@ -463,13 +422,13 @@ void Theme::loadWindowStyle() {
|
||||||
if (XrmGetResource(m_database, "window.justify", "Window.Justify",
|
if (XrmGetResource(m_database, "window.justify", "Window.Justify",
|
||||||
&value_type, &value)) {
|
&value_type, &value)) {
|
||||||
if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
|
if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
|
||||||
m_windowstyle.font.justify = DrawUtil::Font::RIGHT;
|
m_windowstyle.justify = DrawUtil::Font::RIGHT;
|
||||||
else if (strstr(value.addr, "center") || strstr(value.addr, "Center"))
|
else if (strstr(value.addr, "center") || strstr(value.addr, "Center"))
|
||||||
m_windowstyle.font.justify = DrawUtil::Font::CENTER;
|
m_windowstyle.justify = DrawUtil::Font::CENTER;
|
||||||
else
|
else
|
||||||
m_windowstyle.font.justify = DrawUtil::Font::LEFT;
|
m_windowstyle.justify = DrawUtil::Font::LEFT;
|
||||||
} else
|
} else
|
||||||
m_windowstyle.font.justify = DrawUtil::Font::LEFT;
|
m_windowstyle.justify = DrawUtil::Font::LEFT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,38 +482,29 @@ void Theme::loadTabStyle() {
|
||||||
|
|
||||||
m_windowstyle.tab.border_width_2x = m_windowstyle.tab.border_width*2;
|
m_windowstyle.tab.border_width_2x = m_windowstyle.tab.border_width*2;
|
||||||
|
|
||||||
//---------- font
|
loadFontFromDatabase(m_windowstyle.tab.font, "window.tab.font", "Window.Tab.Font");
|
||||||
|
|
||||||
if (I18n::instance()->multibyte()) {
|
|
||||||
readDatabaseFontSet("window.tab.font", "Window.Tab.Font",
|
|
||||||
&m_windowstyle.tab.font.set);
|
|
||||||
|
|
||||||
m_windowstyle.tab.font.set_extents =
|
|
||||||
XExtentsOfFontSet(m_windowstyle.tab.font.set);
|
|
||||||
} else {
|
|
||||||
readDatabaseFont("window.tab.font", "Window.Tab.Font",
|
|
||||||
&m_windowstyle.tab.font.fontstruct);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//TODO: fix rotated font
|
||||||
//--------- rotated font for left and right tabs
|
//--------- rotated font for left and right tabs
|
||||||
// TODO: add extra checking
|
// TODO: add extra checking
|
||||||
if (XrmGetResource(m_database, "window.tab.font", "Window.Tab.Font",
|
/*if (XrmGetResource(m_database, "window.tab.font", "Window.Tab.Font",
|
||||||
&value_type, &value)) {
|
&value_type, &value)) {
|
||||||
if (! (m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, value.addr, 90.0)) )
|
if (! (m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, value.addr, 90.0)) )
|
||||||
m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, "fixed", 90);
|
m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, "fixed", 90);
|
||||||
} else
|
} else
|
||||||
m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, "fixed", 90);
|
m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, "fixed", 90);
|
||||||
|
*/
|
||||||
|
|
||||||
if (XrmGetResource(m_database, "window.tab.justify", "Window.Tab.Justify",
|
if (XrmGetResource(m_database, "window.tab.justify", "Window.Tab.Justify",
|
||||||
&value_type, &value)) {
|
&value_type, &value)) {
|
||||||
if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
|
if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
|
||||||
m_windowstyle.tab.font.justify = DrawUtil::Font::RIGHT;
|
m_windowstyle.tab.justify = DrawUtil::Font::RIGHT;
|
||||||
else if (strstr(value.addr, "center") || strstr(value.addr, "Center"))
|
else if (strstr(value.addr, "center") || strstr(value.addr, "Center"))
|
||||||
m_windowstyle.tab.font.justify = DrawUtil::Font::CENTER;
|
m_windowstyle.tab.justify = DrawUtil::Font::CENTER;
|
||||||
else
|
else
|
||||||
m_windowstyle.tab.font.justify = DrawUtil::Font::LEFT;
|
m_windowstyle.tab.justify = DrawUtil::Font::LEFT;
|
||||||
} else
|
} else
|
||||||
m_windowstyle.tab.font.justify = DrawUtil::Font::LEFT;
|
m_windowstyle.tab.justify = DrawUtil::Font::LEFT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,8 +870,6 @@ void Theme::reconfigure(bool antialias) {
|
||||||
|
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
unsigned long gc_value_mask = GCForeground;
|
unsigned long gc_value_mask = GCForeground;
|
||||||
if (! I18n::instance()->multibyte())
|
|
||||||
gc_value_mask |= GCFont;
|
|
||||||
|
|
||||||
XChangeGC(m_display, m_opgc,
|
XChangeGC(m_display, m_opgc,
|
||||||
GCForeground | GCFunction | GCSubwindowMode, &gcv);
|
GCForeground | GCFunction | GCSubwindowMode, &gcv);
|
||||||
|
@ -933,8 +881,8 @@ void Theme::reconfigure(bool antialias) {
|
||||||
GCForeground | GCFunction | GCSubwindowMode, &gcv);
|
GCForeground | GCFunction | GCSubwindowMode, &gcv);
|
||||||
|
|
||||||
gcv.foreground = m_windowstyle.l_text_focus.pixel();
|
gcv.foreground = m_windowstyle.l_text_focus.pixel();
|
||||||
if (m_windowstyle.font.fontstruct)
|
if (m_windowstyle.font.isAntialias() != antialias)
|
||||||
gcv.font = m_windowstyle.font.fontstruct->fid;
|
m_windowstyle.font.setAntialias(antialias);
|
||||||
|
|
||||||
XChangeGC(m_display, m_windowstyle.l_text_focus_gc,
|
XChangeGC(m_display, m_windowstyle.l_text_focus_gc,
|
||||||
gc_value_mask, &gcv);
|
gc_value_mask, &gcv);
|
||||||
|
@ -945,9 +893,8 @@ void Theme::reconfigure(bool antialias) {
|
||||||
|
|
||||||
//---- Tab
|
//---- Tab
|
||||||
gcv.foreground = m_windowstyle.tab.l_text_focus.pixel();
|
gcv.foreground = m_windowstyle.tab.l_text_focus.pixel();
|
||||||
if (m_windowstyle.tab.font.fontstruct)
|
if (m_windowstyle.tab.font.isAntialias() != antialias)
|
||||||
gcv.font = m_windowstyle.tab.font.fontstruct->fid;
|
m_windowstyle.tab.font.setAntialias(antialias);
|
||||||
|
|
||||||
XChangeGC(m_display, m_windowstyle.tab.l_text_focus_gc,
|
XChangeGC(m_display, m_windowstyle.tab.l_text_focus_gc,
|
||||||
gc_value_mask, &gcv);
|
gc_value_mask, &gcv);
|
||||||
|
|
||||||
|
@ -970,7 +917,7 @@ void Theme::reconfigure(bool antialias) {
|
||||||
m_menustyle.titlefont.setAntialias(antialias);
|
m_menustyle.titlefont.setAntialias(antialias);
|
||||||
|
|
||||||
XChangeGC(m_display, m_menustyle.t_text_gc,
|
XChangeGC(m_display, m_menustyle.t_text_gc,
|
||||||
gc_value_mask, &gcv);
|
gc_value_mask|GCForeground, &gcv);
|
||||||
|
|
||||||
gcv.foreground = m_menustyle.f_text.pixel();
|
gcv.foreground = m_menustyle.f_text.pixel();
|
||||||
if (m_menustyle.framefont.isAntialias() != antialias)
|
if (m_menustyle.framefont.isAntialias() != antialias)
|
||||||
|
@ -994,7 +941,8 @@ void Theme::reconfigure(bool antialias) {
|
||||||
gcv.foreground = m_toolbarstyle.l_text.pixel();
|
gcv.foreground = m_toolbarstyle.l_text.pixel();
|
||||||
if (m_toolbarstyle.font.fontstruct)
|
if (m_toolbarstyle.font.fontstruct)
|
||||||
gcv.font = m_toolbarstyle.font.fontstruct->fid;
|
gcv.font = m_toolbarstyle.font.fontstruct->fid;
|
||||||
|
|
||||||
|
gc_value_mask |= GCFont;
|
||||||
XChangeGC(m_display, m_toolbarstyle.l_text_gc,
|
XChangeGC(m_display, m_toolbarstyle.l_text_gc,
|
||||||
gc_value_mask, &gcv);
|
gc_value_mask, &gcv);
|
||||||
|
|
||||||
|
@ -1138,7 +1086,8 @@ void Theme::loadFontFromDatabase(FbTk::Font &dest, const char *name, const char
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cerr<<__FILE__<<"("<<__LINE__<<"): Load font:"<<value.addr<<std::endl;
|
std::cerr<<__FILE__<<"("<<__LINE__<<"): Load font:"<<value.addr<<std::endl;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
dest.load(value.addr);
|
if (!dest.load(value.addr))
|
||||||
|
cerr<<"Failed to load font: "<<value.addr<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
10
src/Theme.hh
10
src/Theme.hh
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Theme.hh,v 1.15 2002/10/15 10:52:18 fluxgen Exp $
|
// $Id: Theme.hh,v 1.16 2002/10/15 17:07:32 fluxgen Exp $
|
||||||
|
|
||||||
#ifndef THEME_HH
|
#ifndef THEME_HH
|
||||||
#define THEME_HH
|
#define THEME_HH
|
||||||
|
@ -59,12 +59,14 @@ public:
|
||||||
int bullet, bullet_pos;
|
int bullet, bullet_pos;
|
||||||
} MenuStyle;
|
} MenuStyle;
|
||||||
|
|
||||||
typedef struct LabelStyle
|
typedef struct LabelStyle {
|
||||||
{
|
LabelStyle(const char *fontname="fixed"):font(fontname) { }
|
||||||
|
|
||||||
FbTk::Texture l_focus, l_unfocus,
|
FbTk::Texture l_focus, l_unfocus,
|
||||||
t_focus, t_unfocus;
|
t_focus, t_unfocus;
|
||||||
GC l_text_focus_gc, l_text_unfocus_gc;
|
GC l_text_focus_gc, l_text_unfocus_gc;
|
||||||
DrawUtil::Font font;
|
FbTk::Font font;
|
||||||
|
DrawUtil::Font::FontJustify justify;
|
||||||
FbTk::Color l_text_focus, l_text_unfocus;
|
FbTk::Color l_text_focus, l_text_unfocus;
|
||||||
} LabelStyle;
|
} LabelStyle;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Window.cc,v 1.88 2002/10/13 21:54:36 fluxgen Exp $
|
// $Id: Window.cc,v 1.89 2002/10/15 17:17:00 fluxgen Exp $
|
||||||
|
|
||||||
#include "Window.hh"
|
#include "Window.hh"
|
||||||
|
|
||||||
|
@ -1014,15 +1014,7 @@ void FluxboxWindow::reconfigure() {
|
||||||
screen->getBorderWidth();
|
screen->getBorderWidth();
|
||||||
|
|
||||||
if (getTitle().size() > 0) {
|
if (getTitle().size() > 0) {
|
||||||
if (I18n::instance()->multibyte()) {
|
client.title_text_w = screen->getWindowStyle()->font.textWidth(getTitle().c_str(), getTitle().size());
|
||||||
XRectangle ink, logical;
|
|
||||||
XmbTextExtents(screen->getWindowStyle()->font.set,
|
|
||||||
getTitle().c_str(), getTitle().size(), &ink, &logical);
|
|
||||||
client.title_text_w = logical.width;
|
|
||||||
} else {
|
|
||||||
client.title_text_w = XTextWidth(screen->getWindowStyle()->font.fontstruct,
|
|
||||||
getTitle().c_str(), getTitle().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
client.title_text_w += (frame.bevel_w * 4);
|
client.title_text_w += (frame.bevel_w * 4);
|
||||||
}
|
}
|
||||||
|
@ -1121,17 +1113,8 @@ void FluxboxWindow::getWMName() {
|
||||||
FBNLS::WindowSet, FBNLS::WindowUnnamed,
|
FBNLS::WindowSet, FBNLS::WindowUnnamed,
|
||||||
"Unnamed");
|
"Unnamed");
|
||||||
}
|
}
|
||||||
|
//Note: repeated?
|
||||||
if (i18n->multibyte()) {
|
client.title_text_w = screen->getWindowStyle()->font.textWidth(getTitle().c_str(), getTitle().size());
|
||||||
XRectangle ink, logical;
|
|
||||||
XmbTextExtents(screen->getWindowStyle()->font.set,
|
|
||||||
getTitle().c_str(), getTitle().size(), &ink, &logical);
|
|
||||||
client.title_text_w = logical.width;
|
|
||||||
} else {
|
|
||||||
client.title_text_w = XTextWidth(screen->getWindowStyle()->font.fontstruct,
|
|
||||||
getTitle().c_str(), getTitle().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
client.title_text_w += (frame.bevel_w * 4);
|
client.title_text_w += (frame.bevel_w * 4);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2445,15 +2428,18 @@ void FluxboxWindow::redrawLabel() {
|
||||||
XSetWindowBackground(display, frame.label, frame.ulabel_pixel);
|
XSetWindowBackground(display, frame.label, frame.ulabel_pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XClearWindow(display, frame.label);
|
||||||
|
|
||||||
//no need to draw the title if we don't have any
|
//no need to draw the title if we don't have any
|
||||||
if (getTitle().size()!=0) {
|
if (getTitle().size() != 0) {
|
||||||
GC gc = ((focused) ? screen->getWindowStyle()->l_text_focus_gc :
|
GC gc = ((focused) ? screen->getWindowStyle()->l_text_focus_gc :
|
||||||
screen->getWindowStyle()->l_text_unfocus_gc);
|
screen->getWindowStyle()->l_text_unfocus_gc);
|
||||||
|
screen->getWindowStyle()->font.drawText(
|
||||||
DrawUtil::DrawString(display, frame.label, gc,
|
frame.label,
|
||||||
&screen->getWindowStyle()->font,
|
screen->getScreenNumber(),
|
||||||
client.title_text_w, frame.label_w,
|
gc,
|
||||||
frame.bevel_w, getTitle().c_str());
|
getTitle().c_str(), getTitle().size(),
|
||||||
|
frame.bevel_w, frame.bevel_w + screen->getWindowStyle()->font.height());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3633,14 +3619,8 @@ void FluxboxWindow::upsize() {
|
||||||
frame.bevel_w = screen->getBevelWidth();
|
frame.bevel_w = screen->getBevelWidth();
|
||||||
frame.mwm_border_w = screen->getFrameWidth() * decorations.border;
|
frame.mwm_border_w = screen->getFrameWidth() * decorations.border;
|
||||||
|
|
||||||
if (I18n::instance()->multibyte()) {
|
frame.title_h = screen->getWindowStyle()->font.height() +
|
||||||
frame.title_h = (screen->getWindowStyle()->font.set_extents->
|
(frame.bevel_w*2 + 2)*decorations.titlebar;
|
||||||
max_ink_extent.height +
|
|
||||||
(frame.bevel_w * 2) + 2) * decorations.titlebar;
|
|
||||||
} else
|
|
||||||
frame.title_h = (screen->getWindowStyle()->font.fontstruct->ascent +
|
|
||||||
screen->getWindowStyle()->font.fontstruct->descent +
|
|
||||||
(frame.bevel_w * 2) + 2) * decorations.titlebar;
|
|
||||||
|
|
||||||
frame.label_h = (frame.title_h - (frame.bevel_w * 2)) * decorations.titlebar;
|
frame.label_h = (frame.title_h - (frame.bevel_w * 2)) * decorations.titlebar;
|
||||||
frame.button_w = frame.button_h = frame.label_h - 2;
|
frame.button_w = frame.button_h = frame.label_h - 2;
|
||||||
|
|
Loading…
Reference in a new issue