removed Toolbar theme
This commit is contained in:
parent
ab1204e53a
commit
fdb116cec5
2 changed files with 15 additions and 143 deletions
130
src/Theme.cc
130
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.38 2002/12/01 13:42:00 rathnor Exp $
|
// $Id: Theme.cc,v 1.39 2002/12/02 20:54:30 fluxgen Exp $
|
||||||
|
|
||||||
|
|
||||||
#include "Theme.hh"
|
#include "Theme.hh"
|
||||||
|
@ -134,35 +134,12 @@ Theme::Theme(Display *display, Window rootwindow, Colormap colormap,
|
||||||
m_menustyle.hilite_gc =
|
m_menustyle.hilite_gc =
|
||||||
XCreateGC(m_display, rootwindow,
|
XCreateGC(m_display, rootwindow,
|
||||||
gc_value_mask, &gcv);
|
gc_value_mask, &gcv);
|
||||||
|
|
||||||
gcv.foreground = m_toolbarstyle.l_text.pixel();
|
|
||||||
|
|
||||||
m_toolbarstyle.l_text_gc =
|
|
||||||
XCreateGC(m_display, rootwindow,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
gcv.foreground = m_toolbarstyle.w_text.pixel();
|
|
||||||
m_toolbarstyle.w_text_gc =
|
|
||||||
XCreateGC(m_display, rootwindow,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
gcv.foreground = m_toolbarstyle.c_text.pixel();
|
|
||||||
m_toolbarstyle.c_text_gc =
|
|
||||||
XCreateGC(m_display, rootwindow,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
gcv.foreground = m_toolbarstyle.b_pic.pixel();
|
|
||||||
m_toolbarstyle.b_pic_gc =
|
|
||||||
XCreateGC(m_display, rootwindow,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Theme::~Theme() {
|
Theme::~Theme() {
|
||||||
|
|
||||||
freeMenuStyle();
|
freeMenuStyle();
|
||||||
freeWindowStyle();
|
freeWindowStyle();
|
||||||
freeToolbarStyle();
|
|
||||||
freeTabStyle();
|
freeTabStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,19 +174,6 @@ void Theme::freeTabStyle() {
|
||||||
XFreeGC(m_display, m_windowstyle.tab.l_text_unfocus_gc);
|
XFreeGC(m_display, m_windowstyle.tab.l_text_unfocus_gc);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----- freeToolbarStyle -----
|
|
||||||
// free memory allocated for m_toolbarstyle
|
|
||||||
// should only be called from ~Theme
|
|
||||||
//--------------------
|
|
||||||
void Theme::freeToolbarStyle() {
|
|
||||||
|
|
||||||
XFreeGC(m_display, m_toolbarstyle.l_text_gc);
|
|
||||||
XFreeGC(m_display, m_toolbarstyle.w_text_gc);
|
|
||||||
XFreeGC(m_display, m_toolbarstyle.c_text_gc);
|
|
||||||
XFreeGC(m_display, m_toolbarstyle.b_pic_gc);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------- load ------------
|
//---------- load ------------
|
||||||
// Loads a theme from a file
|
// Loads a theme from a file
|
||||||
//----------------------------
|
//----------------------------
|
||||||
|
@ -219,7 +183,6 @@ void Theme::load(const char *filename){
|
||||||
m_database = XrmGetFileDatabase(DEFAULTSTYLE);
|
m_database = XrmGetFileDatabase(DEFAULTSTYLE);
|
||||||
|
|
||||||
loadMenuStyle();
|
loadMenuStyle();
|
||||||
loadToolbarStyle();
|
|
||||||
loadWindowStyle();
|
loadWindowStyle();
|
||||||
loadTabStyle();
|
loadTabStyle();
|
||||||
loadRootCommand();
|
loadRootCommand();
|
||||||
|
@ -482,64 +445,6 @@ void Theme::loadTabStyle() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Theme::loadToolbarStyle() {
|
|
||||||
|
|
||||||
readDatabaseTexture("toolbar", "Toolbar",
|
|
||||||
&m_toolbarstyle.toolbar,
|
|
||||||
BlackPixel(m_display, m_screennum));
|
|
||||||
readDatabaseTexture("toolbar.label", "Toolbar.Label",
|
|
||||||
&m_toolbarstyle.label,
|
|
||||||
BlackPixel(m_display, m_screennum));
|
|
||||||
readDatabaseTexture("toolbar.windowLabel", "Toolbar.WindowLabel",
|
|
||||||
&m_toolbarstyle.window,
|
|
||||||
BlackPixel(m_display, m_screennum));
|
|
||||||
readDatabaseTexture("toolbar.button", "Toolbar.Button",
|
|
||||||
&m_toolbarstyle.button,
|
|
||||||
WhitePixel(m_display, m_screennum));
|
|
||||||
readDatabaseTexture("toolbar.button.pressed", "Toolbar.Button.Pressed",
|
|
||||||
&m_toolbarstyle.pressed,
|
|
||||||
BlackPixel(m_display, m_screennum));
|
|
||||||
readDatabaseTexture("toolbar.clock", "Toolbar.Clock",
|
|
||||||
&m_toolbarstyle.clock,
|
|
||||||
BlackPixel(m_display, m_screennum));
|
|
||||||
|
|
||||||
readDatabaseColor("toolbar.label.textColor", "Toolbar.Label.TextColor",
|
|
||||||
&m_toolbarstyle.l_text,
|
|
||||||
WhitePixel(m_display, m_screennum));
|
|
||||||
|
|
||||||
readDatabaseColor("toolbar.windowLabel.textColor",
|
|
||||||
"Toolbar.WindowLabel.TextColor",
|
|
||||||
&m_toolbarstyle.w_text,
|
|
||||||
WhitePixel(m_display, m_screennum));
|
|
||||||
|
|
||||||
readDatabaseColor("toolbar.clock.textColor", "Toolbar.Clock.TextColor",
|
|
||||||
&m_toolbarstyle.c_text,
|
|
||||||
WhitePixel(m_display, m_screennum));
|
|
||||||
readDatabaseColor("toolbar.button.picColor", "Toolbar.Button.PicColor",
|
|
||||||
&m_toolbarstyle.b_pic,
|
|
||||||
BlackPixel(m_display, m_screennum));
|
|
||||||
|
|
||||||
|
|
||||||
// ----------- load font
|
|
||||||
|
|
||||||
loadFontFromDatabase(m_toolbarstyle.font, "toolbar.font", "Toolbar.Font");
|
|
||||||
|
|
||||||
XrmValue value;
|
|
||||||
char *value_type;
|
|
||||||
|
|
||||||
if (XrmGetResource(m_database, "toolbar.justify",
|
|
||||||
"Toolbar.Justify", &value_type, &value)) {
|
|
||||||
if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
|
|
||||||
m_toolbarstyle.justify = DrawUtil::Font::RIGHT;
|
|
||||||
else if (strstr(value.addr, "center") || strstr(value.addr, "Center"))
|
|
||||||
m_toolbarstyle.justify = DrawUtil::Font::CENTER;
|
|
||||||
else
|
|
||||||
m_toolbarstyle.justify = DrawUtil::Font::LEFT;
|
|
||||||
} else
|
|
||||||
m_toolbarstyle.justify = DrawUtil::Font::LEFT;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Theme::loadRootCommand() {
|
void Theme::loadRootCommand() {
|
||||||
XrmValue value;
|
XrmValue value;
|
||||||
char *value_type;
|
char *value_type;
|
||||||
|
@ -627,7 +532,7 @@ void Theme::loadMisc() {
|
||||||
if (!readDatabaseTexture("slit", "Slit",
|
if (!readDatabaseTexture("slit", "Slit",
|
||||||
&m_slit_texture,
|
&m_slit_texture,
|
||||||
BlackPixel(m_display, m_screennum)) ) {
|
BlackPixel(m_display, m_screennum)) ) {
|
||||||
m_slit_texture = m_toolbarstyle.toolbar;
|
// m_slit_texture = m_toolbarstyle.toolbar; ///!!! TODO !!!
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -779,12 +684,11 @@ void Theme::readDatabaseFontSet(char *rname, char *rclass, XFontSet *fontset) {
|
||||||
*fontset = createFontSet(defaultFont);
|
*fontset = createFontSet(defaultFont);
|
||||||
|
|
||||||
if (! *fontset) {
|
if (! *fontset) {
|
||||||
fprintf(stderr,
|
throw string(
|
||||||
I18n::instance()->
|
I18n::instance()->
|
||||||
getMessage(
|
getMessage(
|
||||||
FBNLS::ScreenSet, FBNLS::ScreenDefaultFontLoadFail,
|
FBNLS::ScreenSet, FBNLS::ScreenDefaultFontLoadFail,
|
||||||
"BScreen::LoadStyle(): couldn't load default font.\n"));
|
"BScreen::LoadStyle(): couldn't load default font."));
|
||||||
throw 2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -822,12 +726,12 @@ void Theme::readDatabaseFont(char *rname, char *rclass, XFontStruct **font) {
|
||||||
|
|
||||||
if (load_default) {
|
if (load_default) {
|
||||||
if ((*font = XLoadQueryFont(m_display, defaultFont)) == 0) {
|
if ((*font = XLoadQueryFont(m_display, defaultFont)) == 0) {
|
||||||
fprintf(stderr,
|
throw string(
|
||||||
I18n::instance()->
|
I18n::instance()->
|
||||||
getMessage(
|
getMessage(
|
||||||
FBNLS::ScreenSet, FBNLS::ScreenDefaultFontLoadFail,
|
FBNLS::ScreenSet, FBNLS::ScreenDefaultFontLoadFail,
|
||||||
"BScreen::LoadStyle(): couldn't load default font.\n"));
|
"BScreen::LoadStyle(): couldn't load default font."));
|
||||||
throw 2; //fatal!
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -904,26 +808,6 @@ void Theme::reconfigure(bool antialias) {
|
||||||
XChangeGC(m_display, m_menustyle.hilite_gc,
|
XChangeGC(m_display, m_menustyle.hilite_gc,
|
||||||
gc_value_mask, &gcv);
|
gc_value_mask, &gcv);
|
||||||
|
|
||||||
// set antialias ?
|
|
||||||
if (m_toolbarstyle.font.isAntialias() != antialias)
|
|
||||||
m_toolbarstyle.font.setAntialias(antialias);
|
|
||||||
|
|
||||||
gcv.foreground = m_toolbarstyle.l_text.pixel();
|
|
||||||
XChangeGC(m_display, m_toolbarstyle.l_text_gc,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
gcv.foreground = m_toolbarstyle.w_text.pixel();
|
|
||||||
XChangeGC(m_display, m_toolbarstyle.w_text_gc,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
gcv.foreground = m_toolbarstyle.c_text.pixel();
|
|
||||||
XChangeGC(m_display, m_toolbarstyle.c_text_gc,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
gcv.foreground = m_toolbarstyle.b_pic.pixel();
|
|
||||||
XChangeGC(m_display, m_toolbarstyle.b_pic_gc,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XFontSet Theme::createFontSet(char *fontname) {
|
XFontSet Theme::createFontSet(char *fontname) {
|
||||||
|
|
18
src/Theme.hh
18
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.21 2002/12/01 13:42:00 rathnor Exp $
|
// $Id: Theme.hh,v 1.22 2002/12/02 20:52:50 fluxgen Exp $
|
||||||
|
|
||||||
#ifndef THEME_HH
|
#ifndef THEME_HH
|
||||||
#define THEME_HH
|
#define THEME_HH
|
||||||
|
@ -88,19 +88,8 @@ public:
|
||||||
|
|
||||||
} WindowStyle;
|
} WindowStyle;
|
||||||
|
|
||||||
|
|
||||||
typedef struct ToolbarStyle {
|
|
||||||
ToolbarStyle():font("fixed") { } // default font 'fixed'
|
|
||||||
FbTk::Color l_text, w_text, c_text, b_pic;
|
|
||||||
FbTk::Texture toolbar, label, window, button, pressed, clock;
|
|
||||||
GC l_text_gc, w_text_gc, c_text_gc, b_pic_gc;
|
|
||||||
FbTk::Font font;
|
|
||||||
DrawUtil::Font::FontJustify justify;
|
|
||||||
} ToolbarStyle;
|
|
||||||
|
|
||||||
inline WindowStyle &getWindowStyle() { return m_windowstyle; }
|
inline WindowStyle &getWindowStyle() { return m_windowstyle; }
|
||||||
inline MenuStyle &getMenuStyle() { return m_menustyle; }
|
inline MenuStyle &getMenuStyle() { return m_menustyle; }
|
||||||
inline ToolbarStyle &getToolbarStyle() { return m_toolbarstyle; }
|
|
||||||
inline const FbTk::Texture &getSlitTexture() const { return m_slit_texture; }
|
inline const FbTk::Texture &getSlitTexture() const { return m_slit_texture; }
|
||||||
inline unsigned int getBevelWidth() const { return m_bevel_width; }
|
inline unsigned int getBevelWidth() const { return m_bevel_width; }
|
||||||
inline unsigned int getBorderWidth() const { return m_border_width; }
|
inline unsigned int getBorderWidth() const { return m_border_width; }
|
||||||
|
@ -120,13 +109,12 @@ private:
|
||||||
void loadMenuStyle();
|
void loadMenuStyle();
|
||||||
void loadWindowStyle();
|
void loadWindowStyle();
|
||||||
void loadTabStyle();
|
void loadTabStyle();
|
||||||
void loadToolbarStyle();
|
|
||||||
void loadRootCommand();
|
void loadRootCommand();
|
||||||
void loadMisc();
|
void loadMisc();
|
||||||
void freeMenuStyle();
|
void freeMenuStyle();
|
||||||
void freeWindowStyle();
|
void freeWindowStyle();
|
||||||
void freeTabStyle();
|
void freeTabStyle();
|
||||||
void freeToolbarStyle();
|
|
||||||
void loadFontFromDatabase(FbTk::Font &dest, const char *name, const char *altname);
|
void loadFontFromDatabase(FbTk::Font &dest, const char *name, const char *altname);
|
||||||
bool readDatabaseTexture(char *, char *, FbTk::Texture *, unsigned long);
|
bool readDatabaseTexture(char *, char *, FbTk::Texture *, unsigned long);
|
||||||
bool readDatabaseColor(char *, char *, FbTk::Color *, unsigned long);
|
bool readDatabaseColor(char *, char *, FbTk::Color *, unsigned long);
|
||||||
|
@ -141,7 +129,7 @@ private:
|
||||||
|
|
||||||
WindowStyle m_windowstyle;
|
WindowStyle m_windowstyle;
|
||||||
MenuStyle m_menustyle;
|
MenuStyle m_menustyle;
|
||||||
ToolbarStyle m_toolbarstyle;
|
|
||||||
unsigned int m_bevel_width, m_border_width, m_handle_width, m_frame_width;
|
unsigned int m_bevel_width, m_border_width, m_handle_width, m_frame_width;
|
||||||
FbTk::Color m_border_color;
|
FbTk::Color m_border_color;
|
||||||
GC m_opgc;
|
GC m_opgc;
|
||||||
|
|
Loading…
Reference in a new issue