X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Fstyle.cc;h=89c7b05d5cf0f81408c63b77453feb716696b3d1;hb=dca0c9f5a308e115ec308cdc8ca7987ff4fc0479;hp=aa8213007d93f390a627c089b2858ed562f7cc5f;hpb=ec4548a19b1d1172d031bee8b277089a59fcfd2f;p=chaz%2Fopenbox diff --git a/otk/style.cc b/otk/style.cc index aa821300..89c7b05d 100644 --- a/otk/style.cc +++ b/otk/style.cc @@ -1,10 +1,13 @@ -#ifdef HAVE_CONFIG_H -#include "../config.h" -#endif // HAVE_CONFIG_H +// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- + +#ifdef HAVE_CONFIG_H +# include "../config.h" +#endif #include -#include "display.hh" +#include +#include "display.hh" #include "util.hh" #include "style.hh" @@ -14,13 +17,9 @@ Style::Style() : font(NULL) { } -Style::Style(unsigned int screen) - : font(0), screen_number(screen) -{ -} - -Style::Style(unsigned int screen, BImageControl *ctrl) - : image_control(ctrl), font(0), screen_number(screen) +Style::Style(BImageControl *ctrl) + : image_control(ctrl), font(0), + screen_number(ctrl->getScreenInfo()->getScreenNumber()) { } @@ -43,7 +42,7 @@ Style::~Style() { stick_button.mask = None; } -void Style::load(Configuration &style) { +void Style::load(const Configuration &style) { std::string s; // load fonts/fontsets @@ -159,32 +158,6 @@ void Style::load(Configuration &style) { } -void Style::doJustify(const std::string &text, int &start_pos, - unsigned int max_length, - unsigned int modifier) const { - size_t text_len = text.size(); - unsigned int length; - - do { - length = font->measureString(std::string(text, 0, text_len)) + modifier; - } while (length > max_length && text_len-- > 0); - - switch (justify) { - case RightJustify: - start_pos += max_length - length; - break; - - case CenterJustify: - start_pos += (max_length - length) / 2; - break; - - case LeftJustify: - default: - break; - } -} - - void Style::readDatabaseMask(const std::string &rname, PixmapMask &pixmapMask, const Configuration &style) { Window root_window = OBDisplay::screenInfo(screen_number)->getRootWindow(); @@ -260,7 +233,7 @@ BColor Style::readDatabaseColor(const std::string &rname, BFont *Style::readDatabaseFont(const std::string &rbasename, - const Configuration &style) { + const Configuration &style) { std::string fontname; std::string s; @@ -302,7 +275,11 @@ BFont *Style::readDatabaseFont(const std::string &rbasename, return 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 }