removed menu style
This commit is contained in:
parent
0a24450afd
commit
84cb556961
2 changed files with 4 additions and 174 deletions
156
src/Theme.cc
156
src/Theme.cc
|
@ -21,13 +21,12 @@
|
||||||
// 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.40 2003/01/09 22:09:19 fluxgen Exp $
|
// $Id: Theme.cc,v 1.41 2003/01/12 18:48:14 fluxgen Exp $
|
||||||
|
|
||||||
|
|
||||||
#include "Theme.hh"
|
#include "Theme.hh"
|
||||||
|
|
||||||
#include "i18n.hh"
|
#include "i18n.hh"
|
||||||
#include "Basemenu.hh"
|
|
||||||
#include "StringUtil.hh"
|
#include "StringUtil.hh"
|
||||||
|
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
|
@ -108,54 +107,13 @@ Theme::Theme(Display *display, Window rootwindow, Colormap colormap,
|
||||||
XCreateGC(m_display, rootwindow,
|
XCreateGC(m_display, rootwindow,
|
||||||
GCForeground, &gcv);
|
GCForeground, &gcv);
|
||||||
|
|
||||||
gcv.foreground = m_menustyle.t_text.pixel();
|
|
||||||
|
|
||||||
m_menustyle.t_text_gc =
|
|
||||||
XCreateGC(m_display, rootwindow,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
gcv.foreground = m_menustyle.f_text.pixel();
|
|
||||||
|
|
||||||
m_menustyle.f_text_gc =
|
|
||||||
XCreateGC(m_display, rootwindow,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
gcv.foreground = m_menustyle.h_text.pixel();
|
|
||||||
m_menustyle.h_text_gc =
|
|
||||||
XCreateGC(m_display, rootwindow,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
gcv.foreground = m_menustyle.d_text.pixel();
|
|
||||||
m_menustyle.d_text_gc =
|
|
||||||
XCreateGC(m_display, rootwindow,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
gcv.foreground = m_menustyle.hilite.color().pixel();
|
|
||||||
m_menustyle.hilite_gc =
|
|
||||||
XCreateGC(m_display, rootwindow,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Theme::~Theme() {
|
Theme::~Theme() {
|
||||||
|
|
||||||
freeMenuStyle();
|
|
||||||
freeWindowStyle();
|
freeWindowStyle();
|
||||||
freeTabStyle();
|
freeTabStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----- freeMenuStyle -----
|
|
||||||
// free memory allocated for m_menustyle
|
|
||||||
// should only be called from ~Theme
|
|
||||||
//--------------------
|
|
||||||
void Theme::freeMenuStyle() {
|
|
||||||
|
|
||||||
XFreeGC(m_display, m_menustyle.t_text_gc);
|
|
||||||
XFreeGC(m_display, m_menustyle.f_text_gc);
|
|
||||||
XFreeGC(m_display, m_menustyle.h_text_gc);
|
|
||||||
XFreeGC(m_display, m_menustyle.d_text_gc);
|
|
||||||
XFreeGC(m_display, m_menustyle.hilite_gc);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----- freeWindowStyle -----
|
//----- freeWindowStyle -----
|
||||||
// free memory allocated for m_windowstyle
|
// free memory allocated for m_windowstyle
|
||||||
//--------------------
|
//--------------------
|
||||||
|
@ -182,7 +140,6 @@ void Theme::load(const char *filename){
|
||||||
if (!m_database)
|
if (!m_database)
|
||||||
m_database = XrmGetFileDatabase(DEFAULTSTYLE);
|
m_database = XrmGetFileDatabase(DEFAULTSTYLE);
|
||||||
|
|
||||||
loadMenuStyle();
|
|
||||||
loadWindowStyle();
|
loadWindowStyle();
|
||||||
loadTabStyle();
|
loadTabStyle();
|
||||||
loadRootCommand();
|
loadRootCommand();
|
||||||
|
@ -191,91 +148,6 @@ void Theme::load(const char *filename){
|
||||||
XrmDestroyDatabase(m_database);
|
XrmDestroyDatabase(m_database);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Theme::loadMenuStyle() {
|
|
||||||
|
|
||||||
readDatabaseTexture("menu.title", "Menu.Title",
|
|
||||||
&m_menustyle.title,
|
|
||||||
WhitePixel(m_display, m_screennum));
|
|
||||||
readDatabaseTexture("menu.frame", "Menu.Frame",
|
|
||||||
&m_menustyle.frame,
|
|
||||||
BlackPixel(m_display, m_screennum));
|
|
||||||
readDatabaseTexture("menu.hilite", "Menu.Hilite",
|
|
||||||
&m_menustyle.hilite,
|
|
||||||
WhitePixel(m_display, m_screennum));
|
|
||||||
readDatabaseColor("menu.title.textColor", "Menu.Title.TextColor",
|
|
||||||
&m_menustyle.t_text,
|
|
||||||
BlackPixel(m_display, m_screennum));
|
|
||||||
readDatabaseColor("menu.frame.textColor", "Menu.Frame.TextColor",
|
|
||||||
&m_menustyle.f_text,
|
|
||||||
WhitePixel(m_display, m_screennum));
|
|
||||||
readDatabaseColor("menu.frame.disableColor", "Menu.Frame.DisableColor",
|
|
||||||
&m_menustyle.d_text,
|
|
||||||
BlackPixel(m_display, m_screennum));
|
|
||||||
readDatabaseColor("menu.hilite.textColor", "Menu.Hilite.TextColor",
|
|
||||||
&m_menustyle.h_text,
|
|
||||||
BlackPixel(m_display, m_screennum));
|
|
||||||
|
|
||||||
XrmValue value;
|
|
||||||
char *value_type=0;
|
|
||||||
|
|
||||||
if (XrmGetResource(m_database, "menu.title.justify",
|
|
||||||
"Menu.Title.Justify", &value_type, &value)) {
|
|
||||||
|
|
||||||
if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
|
|
||||||
m_menustyle.titlefont_justify = DrawUtil::Font::RIGHT;
|
|
||||||
else if (strstr(value.addr, "center") || strstr(value.addr, "Center"))
|
|
||||||
m_menustyle.titlefont_justify = DrawUtil::Font::CENTER;
|
|
||||||
else
|
|
||||||
m_menustyle.titlefont_justify = DrawUtil::Font::LEFT;
|
|
||||||
|
|
||||||
} else
|
|
||||||
m_menustyle.titlefont_justify = DrawUtil::Font::LEFT;
|
|
||||||
|
|
||||||
if (XrmGetResource(m_database, "menu.frame.justify",
|
|
||||||
"Menu.Frame.Justify", &value_type, &value)) {
|
|
||||||
|
|
||||||
if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
|
|
||||||
m_menustyle.framefont_justify = DrawUtil::Font::RIGHT;
|
|
||||||
else if (strstr(value.addr, "center") || strstr(value.addr, "Center"))
|
|
||||||
m_menustyle.framefont_justify = DrawUtil::Font::CENTER;
|
|
||||||
else
|
|
||||||
m_menustyle.framefont_justify = DrawUtil::Font::LEFT;
|
|
||||||
|
|
||||||
} else
|
|
||||||
m_menustyle.framefont_justify = DrawUtil::Font::LEFT;
|
|
||||||
|
|
||||||
if (XrmGetResource(m_database, "menu.bullet", "Menu.Bullet",
|
|
||||||
&value_type, &value)) {
|
|
||||||
|
|
||||||
if (! strncasecmp(value.addr, "empty", value.size))
|
|
||||||
m_menustyle.bullet = Basemenu::EMPTY;
|
|
||||||
else if (! strncasecmp(value.addr, "square", value.size))
|
|
||||||
m_menustyle.bullet = Basemenu::SQUARE;
|
|
||||||
else if (! strncasecmp(value.addr, "diamond", value.size))
|
|
||||||
m_menustyle.bullet = Basemenu::DIAMOND;
|
|
||||||
else
|
|
||||||
m_menustyle.bullet = Basemenu::TRIANGLE;
|
|
||||||
|
|
||||||
} else
|
|
||||||
m_menustyle.bullet = Basemenu::TRIANGLE;
|
|
||||||
|
|
||||||
if (XrmGetResource(m_database, "menu.bullet.position",
|
|
||||||
"Menu.Bullet.Position", &value_type, &value)) {
|
|
||||||
|
|
||||||
if (! strncasecmp(value.addr, "right", value.size))
|
|
||||||
m_menustyle.bullet_pos = Basemenu::RIGHT;
|
|
||||||
else
|
|
||||||
m_menustyle.bullet_pos = Basemenu::LEFT;
|
|
||||||
|
|
||||||
} else
|
|
||||||
m_menustyle.bullet_pos = Basemenu::LEFT;
|
|
||||||
|
|
||||||
//---------- font
|
|
||||||
loadFontFromDatabase(m_menustyle.framefont, "menu.frame.font", "Menu.Frame.Font");
|
|
||||||
loadFontFromDatabase(m_menustyle.titlefont, "menu.title.font", "Menu.Title.Font");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Theme::loadWindowStyle() {
|
void Theme::loadWindowStyle() {
|
||||||
|
|
||||||
//read textures
|
//read textures
|
||||||
|
@ -743,32 +615,6 @@ void Theme::reconfigure(bool antialias) {
|
||||||
XChangeGC(m_display, m_windowstyle.b_pic_unfocus_gc,
|
XChangeGC(m_display, m_windowstyle.b_pic_unfocus_gc,
|
||||||
GCForeground, &gcv);
|
GCForeground, &gcv);
|
||||||
|
|
||||||
gcv.foreground = m_menustyle.t_text.pixel();
|
|
||||||
if (m_menustyle.titlefont.isAntialias() != antialias)
|
|
||||||
m_menustyle.titlefont.setAntialias(antialias);
|
|
||||||
|
|
||||||
XChangeGC(m_display, m_menustyle.t_text_gc,
|
|
||||||
gc_value_mask|GCForeground, &gcv);
|
|
||||||
|
|
||||||
gcv.foreground = m_menustyle.f_text.pixel();
|
|
||||||
if (m_menustyle.framefont.isAntialias() != antialias)
|
|
||||||
m_menustyle.framefont.setAntialias(antialias);
|
|
||||||
|
|
||||||
XChangeGC(m_display, m_menustyle.f_text_gc,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
gcv.foreground = m_menustyle.h_text.pixel();
|
|
||||||
XChangeGC(m_display, m_menustyle.h_text_gc,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
gcv.foreground = m_menustyle.d_text.pixel();
|
|
||||||
XChangeGC(m_display, m_menustyle.d_text_gc,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
gcv.foreground = m_menustyle.hilite.color().pixel();
|
|
||||||
XChangeGC(m_display, m_menustyle.hilite_gc,
|
|
||||||
gc_value_mask, &gcv);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XFontSet Theme::createFontSet(char *fontname) {
|
XFontSet Theme::createFontSet(char *fontname) {
|
||||||
|
|
22
src/Theme.hh
22
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.22 2002/12/02 20:52:50 fluxgen Exp $
|
// $Id: Theme.hh,v 1.23 2003/01/12 18:47:56 fluxgen Exp $
|
||||||
|
|
||||||
#ifndef THEME_HH
|
#ifndef THEME_HH
|
||||||
#define THEME_HH
|
#define THEME_HH
|
||||||
|
@ -37,9 +37,10 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
/// OBSOLETE
|
||||||
/**
|
/**
|
||||||
Main theme class, holds themes for
|
Main theme class, holds themes for
|
||||||
Window, toolbar, slit, menu and the rootCommand, for a specific screen.
|
Window, slit, and the rootCommand, for a specific screen.
|
||||||
*/
|
*/
|
||||||
class Theme {
|
class Theme {
|
||||||
public:
|
public:
|
||||||
|
@ -48,19 +49,6 @@ public:
|
||||||
int screennum, const char *filename, const char *rootcommand);
|
int screennum, const char *filename, const char *rootcommand);
|
||||||
~Theme();
|
~Theme();
|
||||||
|
|
||||||
|
|
||||||
typedef struct MenuStyle {
|
|
||||||
MenuStyle():titlefont("fixed"),
|
|
||||||
framefont("fixed") { }
|
|
||||||
FbTk::Color t_text, f_text, h_text, d_text;
|
|
||||||
FbTk::Texture title, frame, hilite;
|
|
||||||
GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc;
|
|
||||||
FbTk::Font titlefont, framefont;
|
|
||||||
DrawUtil::Font::FontJustify framefont_justify;
|
|
||||||
DrawUtil::Font::FontJustify titlefont_justify;
|
|
||||||
int bullet, bullet_pos;
|
|
||||||
} MenuStyle;
|
|
||||||
|
|
||||||
typedef struct LabelStyle {
|
typedef struct LabelStyle {
|
||||||
LabelStyle(const char *fontname="fixed"):font(fontname) { }
|
LabelStyle(const char *fontname="fixed"):font(fontname) { }
|
||||||
|
|
||||||
|
@ -89,7 +77,6 @@ public:
|
||||||
} WindowStyle;
|
} WindowStyle;
|
||||||
|
|
||||||
inline WindowStyle &getWindowStyle() { return m_windowstyle; }
|
inline WindowStyle &getWindowStyle() { return m_windowstyle; }
|
||||||
inline MenuStyle &getMenuStyle() { return m_menustyle; }
|
|
||||||
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; }
|
||||||
|
@ -106,12 +93,10 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void loadMenuStyle();
|
|
||||||
void loadWindowStyle();
|
void loadWindowStyle();
|
||||||
void loadTabStyle();
|
void loadTabStyle();
|
||||||
void loadRootCommand();
|
void loadRootCommand();
|
||||||
void loadMisc();
|
void loadMisc();
|
||||||
void freeMenuStyle();
|
|
||||||
void freeWindowStyle();
|
void freeWindowStyle();
|
||||||
void freeTabStyle();
|
void freeTabStyle();
|
||||||
|
|
||||||
|
@ -128,7 +113,6 @@ private:
|
||||||
|
|
||||||
|
|
||||||
WindowStyle m_windowstyle;
|
WindowStyle m_windowstyle;
|
||||||
MenuStyle m_menustyle;
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
Loading…
Reference in a new issue