some small cleanups

make style not take a screen separate from the image control
make style::load() take a const ref
This commit is contained in:
Dana Jansens 2002-11-11 10:03:11 +00:00
parent 590f7f58a6
commit fb0dd6cf9a
4 changed files with 19 additions and 20 deletions

View file

@ -29,9 +29,7 @@ OBProperty::OBProperty()
_atoms[Atom_String] = XA_STRING; _atoms[Atom_String] = XA_STRING;
_atoms[Atom_Utf8] = create("UTF8_STRING"); _atoms[Atom_Utf8] = create("UTF8_STRING");
#ifdef HAVE_GETPID
_atoms[openbox_pid] = create("_OPENBOX_PID"); _atoms[openbox_pid] = create("_OPENBOX_PID");
#endif // HAVE_GETPID
_atoms[wm_colormap_windows] = create("WM_COLORMAP_WINDOWS"); _atoms[wm_colormap_windows] = create("WM_COLORMAP_WINDOWS");
_atoms[wm_protocols] = create("WM_PROTOCOLS"); _atoms[wm_protocols] = create("WM_PROTOCOLS");
@ -162,7 +160,9 @@ OBProperty::~OBProperty()
*/ */
Atom OBProperty::create(const char *name) const Atom OBProperty::create(const char *name) const
{ {
return XInternAtom(OBDisplay::display, name, False); Atom a = XInternAtom(OBDisplay::display, name, False);
assert(a);
return a;
} }

View file

@ -33,9 +33,7 @@ public:
Atom_String, //!< The atom which represents ascii strings Atom_String, //!< The atom which represents ascii strings
Atom_Utf8, //!< The atom which represents utf8-encoded strings Atom_Utf8, //!< The atom which represents utf8-encoded strings
#ifdef HAVE_GETPID
openbox_pid, openbox_pid,
#endif // HAVE_GETPID
// window hints // window hints
wm_colormap_windows, wm_colormap_windows,

View file

@ -14,13 +14,9 @@ Style::Style() : font(NULL)
{ {
} }
Style::Style(unsigned int screen) Style::Style(BImageControl *ctrl)
: font(0), screen_number(screen) : image_control(ctrl), font(0),
{ screen_number(ctrl->getScreenInfo()->getScreenNumber())
}
Style::Style(unsigned int screen, BImageControl *ctrl)
: image_control(ctrl), font(0), screen_number(screen)
{ {
} }
@ -43,7 +39,7 @@ Style::~Style() {
stick_button.mask = None; stick_button.mask = None;
} }
void Style::load(Configuration &style) { void Style::load(const Configuration &style) {
std::string s; std::string s;
// load fonts/fontsets // load fonts/fontsets
@ -303,6 +299,10 @@ BFont *Style::readDatabaseFont(const std::string &rbasename,
delete b; delete b;
} }
if (style.getValue(rbasename + "xft.font", s))
printf("Unable to load font \"%s\". Exiting\n", s.c_str());
else
printf("Font not defined by style. Exiting\n");
exit(2); // can't continue without a font exit(2); // can't continue without a font
} }

View file

@ -62,8 +62,7 @@ public:
public: public:
Style(); Style();
Style(unsigned int); Style(BImageControl *);
Style(unsigned int, BImageControl *);
~Style(); ~Style();
void doJustify(const std::string &text, int &start_pos, void doJustify(const std::string &text, int &start_pos,
@ -85,7 +84,7 @@ public:
BFont *readDatabaseFont(const std::string &rbasename, BFont *readDatabaseFont(const std::string &rbasename,
const Configuration &style); const Configuration &style);
void load(Configuration &); void load(const Configuration &style);
inline BColor *getBorderColor(void) { return &border_color; } inline BColor *getBorderColor(void) { return &border_color; }
@ -134,8 +133,10 @@ public:
inline const BTexture &getFrameFocus() const { return f_focus; } inline const BTexture &getFrameFocus() const { return f_focus; }
inline const BTexture &getFrameUnfocus() const { return f_unfocus; } inline const BTexture &getFrameUnfocus() const { return f_unfocus; }
inline void setImageControl(BImageControl *c) { image_control = c; } inline void setImageControl(BImageControl *c) {
inline void setScreenNumber(unsigned int scr) { screen_number = scr; } image_control = c;
screen_number = c->getScreenInfo()->getScreenNumber();
}
inline unsigned int getScreen(void) { return screen_number; } inline unsigned int getScreen(void) { return screen_number; }
// XXX add inline accessors for the rest of the bummy // XXX add inline accessors for the rest of the bummy