Changed Misc::
This commit is contained in:
parent
ad3923a371
commit
68d83ecc98
10 changed files with 98 additions and 96 deletions
|
@ -33,6 +33,7 @@
|
||||||
#include "fluxbox.hh"
|
#include "fluxbox.hh"
|
||||||
#include "Basemenu.hh"
|
#include "Basemenu.hh"
|
||||||
#include "Screen.hh"
|
#include "Screen.hh"
|
||||||
|
#include "StringUtil.hh"
|
||||||
|
|
||||||
#ifdef HAVE_STDIO_H
|
#ifdef HAVE_STDIO_H
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
|
@ -197,8 +198,8 @@ Basemenu::~Basemenu(void) {
|
||||||
int Basemenu::insert(const char *l, int function, const char *e, int pos) {
|
int Basemenu::insert(const char *l, int function, const char *e, int pos) {
|
||||||
char *label = 0, *exec = 0;
|
char *label = 0, *exec = 0;
|
||||||
|
|
||||||
if (l) label = Misc::strdup(l);
|
if (l) label = StringUtil::strdup(l);
|
||||||
if (e) exec = Misc::strdup(e);
|
if (e) exec = StringUtil::strdup(e);
|
||||||
|
|
||||||
BasemenuItem *item = new BasemenuItem(label, function, exec);
|
BasemenuItem *item = new BasemenuItem(label, function, exec);
|
||||||
menuitems->insert(item, pos);
|
menuitems->insert(item, pos);
|
||||||
|
@ -210,7 +211,7 @@ int Basemenu::insert(const char *l, int function, const char *e, int pos) {
|
||||||
int Basemenu::insert(const char *l, Basemenu *submenu, int pos) {
|
int Basemenu::insert(const char *l, Basemenu *submenu, int pos) {
|
||||||
char *label = 0;
|
char *label = 0;
|
||||||
|
|
||||||
if (l) label = Misc::strdup(l);
|
if (l) label = StringUtil::strdup(l);
|
||||||
|
|
||||||
BasemenuItem *item = new BasemenuItem(label, submenu);
|
BasemenuItem *item = new BasemenuItem(label, submenu);
|
||||||
menuitems->insert(item, pos);
|
menuitems->insert(item, pos);
|
||||||
|
@ -507,11 +508,11 @@ void Basemenu::redrawTitle(void) {
|
||||||
l += (menu.bevel_w * 2);
|
l += (menu.bevel_w * 2);
|
||||||
|
|
||||||
switch (screen->getMenuStyle()->titlefont.justify) {
|
switch (screen->getMenuStyle()->titlefont.justify) {
|
||||||
case Misc::Font::RIGHT:
|
case DrawUtil::Font::RIGHT:
|
||||||
dx += menu.width - l;
|
dx += menu.width - l;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Misc::Font::CENTER:
|
case DrawUtil::Font::CENTER:
|
||||||
dx += (menu.width - l) / 2;
|
dx += (menu.width - l) / 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -644,11 +645,11 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear,
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(screen->getMenuStyle()->framefont.justify) {
|
switch(screen->getMenuStyle()->framefont.justify) {
|
||||||
case Misc::Font::LEFT:
|
case DrawUtil::Font::LEFT:
|
||||||
text_x = item_x + menu.bevel_w + menu.item_h + 1;
|
text_x = item_x + menu.bevel_w + menu.item_h + 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Misc::Font::RIGHT:
|
case DrawUtil::Font::RIGHT:
|
||||||
text_x = item_x + menu.item_w - (menu.item_h + menu.bevel_w + text_w);
|
text_x = item_x + menu.item_w - (menu.item_h + menu.bevel_w + text_w);
|
||||||
break;
|
break;
|
||||||
default: //center
|
default: //center
|
||||||
|
@ -789,7 +790,7 @@ void Basemenu::setLabel(const char *l) {
|
||||||
if (menu.label)
|
if (menu.label)
|
||||||
delete [] menu.label;
|
delete [] menu.label;
|
||||||
|
|
||||||
if (l) menu.label = Misc::strdup(l);
|
if (l) menu.label = StringUtil::strdup(l);
|
||||||
else menu.label = 0;
|
else menu.label = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -273,10 +273,10 @@ void IconBar::draw(IconBarObj *obj, int width) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (m_screen->getWindowStyle()->tab.font.justify) {
|
switch (m_screen->getWindowStyle()->tab.font.justify) {
|
||||||
case Misc::Font::RIGHT:
|
case DrawUtil::Font::RIGHT:
|
||||||
dx += width - l;
|
dx += width - l;
|
||||||
break;
|
break;
|
||||||
case Misc::Font::CENTER:
|
case DrawUtil::Font::CENTER:
|
||||||
dx += (width - l) / 2;
|
dx += (width - l) / 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "Icon.hh"
|
#include "Icon.hh"
|
||||||
#include "Image.hh"
|
#include "Image.hh"
|
||||||
#include "Screen.hh"
|
#include "Screen.hh"
|
||||||
|
#include "StringUtil.hh"
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
#include "Slit.hh"
|
#include "Slit.hh"
|
||||||
|
@ -831,13 +832,13 @@ void BScreen::saveStrftimeFormat(char *format) {
|
||||||
if (resource.strftime_format)
|
if (resource.strftime_format)
|
||||||
delete [] resource.strftime_format;
|
delete [] resource.strftime_format;
|
||||||
|
|
||||||
resource.strftime_format = Misc::strdup(format);
|
resource.strftime_format = StringUtil::strdup(format);
|
||||||
}
|
}
|
||||||
#endif // HAVE_STRFTIME
|
#endif // HAVE_STRFTIME
|
||||||
|
|
||||||
|
|
||||||
void BScreen::addWorkspaceName(char *name) {
|
void BScreen::addWorkspaceName(char *name) {
|
||||||
workspaceNames->insert(Misc::strdup(name));
|
workspaceNames->insert(StringUtil::strdup(name));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -847,7 +848,7 @@ void BScreen::getNameOfWorkspace(int id, char **name) {
|
||||||
char *wkspc_name = workspaceNames->find(id);
|
char *wkspc_name = workspaceNames->find(id);
|
||||||
|
|
||||||
if (wkspc_name)
|
if (wkspc_name)
|
||||||
*name = Misc::strdup(wkspc_name);
|
*name = StringUtil::strdup(wkspc_name);
|
||||||
} else
|
} else
|
||||||
*name = 0;
|
*name = 0;
|
||||||
}
|
}
|
||||||
|
@ -1460,7 +1461,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
|
||||||
char **ls = new char* [entries];
|
char **ls = new char* [entries];
|
||||||
int index = 0;
|
int index = 0;
|
||||||
while ((p = readdir(d)))
|
while ((p = readdir(d)))
|
||||||
ls[index++] = Misc::strdup(p->d_name);
|
ls[index++] = StringUtil::strdup(p->d_name);
|
||||||
|
|
||||||
qsort(ls, entries, sizeof(char *), dcmp);
|
qsort(ls, entries, sizeof(char *), dcmp);
|
||||||
|
|
||||||
|
|
13
src/Tab.cc
13
src/Tab.cc
|
@ -20,14 +20,15 @@
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include "Tab.hh"
|
#include "Tab.hh"
|
||||||
#include <iostream>
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "../config.h"
|
# include "../config.h"
|
||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
#include "i18n.hh"
|
#include "i18n.hh"
|
||||||
|
#include "DrawUtil.hh"
|
||||||
|
|
||||||
#include "misc.hh"
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
bool Tab::m_stoptabs = false;
|
bool Tab::m_stoptabs = false;
|
||||||
|
@ -333,11 +334,11 @@ void Tab::draw(bool pressed) {
|
||||||
m_win->getScreen()->getTabPlacement() == PRIGHT) &&
|
m_win->getScreen()->getTabPlacement() == PRIGHT) &&
|
||||||
(!m_win->isShaded() && m_win->getScreen()->isTabRotateVertical())) {
|
(!m_win->isShaded() && m_win->getScreen()->isTabRotateVertical())) {
|
||||||
|
|
||||||
tabtext_w = Misc::XRotTextWidth(m_win->getScreen()->getWindowStyle()->tab.rot_font,
|
tabtext_w = DrawUtil::XRotTextWidth(m_win->getScreen()->getWindowStyle()->tab.rot_font,
|
||||||
m_win->client.title, m_win->client.title_len);
|
m_win->client.title, m_win->client.title_len);
|
||||||
tabtext_w += (m_win->frame.bevel_w * 4);
|
tabtext_w += (m_win->frame.bevel_w * 4);
|
||||||
|
|
||||||
Misc::DrawRotString(m_display, m_tabwin, gc,
|
DrawUtil::DrawRotString(m_display, m_tabwin, gc,
|
||||||
m_win->getScreen()->getWindowStyle()->tab.rot_font,
|
m_win->getScreen()->getWindowStyle()->tab.rot_font,
|
||||||
m_win->getScreen()->getWindowStyle()->tab.font.justify,
|
m_win->getScreen()->getWindowStyle()->tab.font.justify,
|
||||||
tabtext_w, m_size_w, m_size_h,
|
tabtext_w, m_size_w, m_size_h,
|
||||||
|
@ -357,7 +358,7 @@ void Tab::draw(bool pressed) {
|
||||||
}
|
}
|
||||||
tabtext_w += (m_win->frame.bevel_w * 4);
|
tabtext_w += (m_win->frame.bevel_w * 4);
|
||||||
|
|
||||||
Misc::DrawString(m_display, m_tabwin, gc,
|
DrawUtil::DrawString(m_display, m_tabwin, gc,
|
||||||
&m_win->getScreen()->getWindowStyle()->tab.font,
|
&m_win->getScreen()->getWindowStyle()->tab.font,
|
||||||
tabtext_w, m_size_w,
|
tabtext_w, m_size_w,
|
||||||
m_win->frame.bevel_w, m_win->client.title);
|
m_win->frame.bevel_w, m_win->client.title);
|
||||||
|
|
48
src/Theme.cc
48
src/Theme.cc
|
@ -270,7 +270,7 @@ void Theme::freeTabStyle() {
|
||||||
XFreeFont(m_display, m_windowstyle.tab.font.fontstruct);
|
XFreeFont(m_display, m_windowstyle.tab.font.fontstruct);
|
||||||
|
|
||||||
if (m_windowstyle.tab.rot_font)
|
if (m_windowstyle.tab.rot_font)
|
||||||
Misc::XRotUnloadFont(m_display, 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);
|
||||||
|
@ -345,27 +345,27 @@ void Theme::loadMenuStyle() {
|
||||||
"Menu.Title.Justify", &value_type, &value)) {
|
"Menu.Title.Justify", &value_type, &value)) {
|
||||||
|
|
||||||
if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
|
if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
|
||||||
m_menustyle.titlefont.justify = Misc::Font::RIGHT;
|
m_menustyle.titlefont.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_menustyle.titlefont.justify = Misc::Font::CENTER;
|
m_menustyle.titlefont.justify = DrawUtil::Font::CENTER;
|
||||||
else
|
else
|
||||||
m_menustyle.titlefont.justify = Misc::Font::LEFT;
|
m_menustyle.titlefont.justify = DrawUtil::Font::LEFT;
|
||||||
|
|
||||||
} else
|
} else
|
||||||
m_menustyle.titlefont.justify = Misc::Font::LEFT;
|
m_menustyle.titlefont.justify = DrawUtil::Font::LEFT;
|
||||||
|
|
||||||
if (XrmGetResource(m_database, "menu.frame.justify",
|
if (XrmGetResource(m_database, "menu.frame.justify",
|
||||||
"Menu.Frame.Justify", &value_type, &value)) {
|
"Menu.Frame.Justify", &value_type, &value)) {
|
||||||
|
|
||||||
if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
|
if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
|
||||||
m_menustyle.framefont.justify = Misc::Font::RIGHT;
|
m_menustyle.framefont.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_menustyle.framefont.justify = Misc::Font::CENTER;
|
m_menustyle.framefont.justify = DrawUtil::Font::CENTER;
|
||||||
else
|
else
|
||||||
m_menustyle.framefont.justify = Misc::Font::LEFT;
|
m_menustyle.framefont.justify = DrawUtil::Font::LEFT;
|
||||||
|
|
||||||
} else
|
} else
|
||||||
m_menustyle.framefont.justify = Misc::Font::LEFT;
|
m_menustyle.framefont.justify = DrawUtil::Font::LEFT;
|
||||||
|
|
||||||
if (XrmGetResource(m_database, "menu.bullet", "Menu.Bullet",
|
if (XrmGetResource(m_database, "menu.bullet", "Menu.Bullet",
|
||||||
&value_type, &value)) {
|
&value_type, &value)) {
|
||||||
|
@ -500,13 +500,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 = Misc::Font::RIGHT;
|
m_windowstyle.font.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 = Misc::Font::CENTER;
|
m_windowstyle.font.justify = DrawUtil::Font::CENTER;
|
||||||
else
|
else
|
||||||
m_windowstyle.font.justify = Misc::Font::LEFT;
|
m_windowstyle.font.justify = DrawUtil::Font::LEFT;
|
||||||
} else
|
} else
|
||||||
m_windowstyle.font.justify = Misc::Font::LEFT;
|
m_windowstyle.font.justify = DrawUtil::Font::LEFT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,21 +578,21 @@ void Theme::loadTabStyle() {
|
||||||
// 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 = Misc::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 = Misc::XRotLoadFont(m_display, "fixed", 90);
|
m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, "fixed", 90);
|
||||||
} else
|
} else
|
||||||
m_windowstyle.tab.rot_font = Misc::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 = Misc::Font::RIGHT;
|
m_windowstyle.tab.font.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 = Misc::Font::CENTER;
|
m_windowstyle.tab.font.justify = DrawUtil::Font::CENTER;
|
||||||
else
|
else
|
||||||
m_windowstyle.tab.font.justify = Misc::Font::LEFT;
|
m_windowstyle.tab.font.justify = DrawUtil::Font::LEFT;
|
||||||
} else
|
} else
|
||||||
m_windowstyle.tab.font.justify = Misc::Font::LEFT;
|
m_windowstyle.tab.font.justify = DrawUtil::Font::LEFT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,13 +649,13 @@ void Theme::loadToolbarStyle() {
|
||||||
if (XrmGetResource(m_database, "toolbar.justify",
|
if (XrmGetResource(m_database, "toolbar.justify",
|
||||||
"Toolbar.Justify", &value_type, &value)) {
|
"Toolbar.Justify", &value_type, &value)) {
|
||||||
if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
|
if (strstr(value.addr, "right") || strstr(value.addr, "Right"))
|
||||||
m_toolbarstyle.font.justify = Misc::Font::RIGHT;
|
m_toolbarstyle.font.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_toolbarstyle.font.justify = Misc::Font::CENTER;
|
m_toolbarstyle.font.justify = DrawUtil::Font::CENTER;
|
||||||
else
|
else
|
||||||
m_toolbarstyle.font.justify = Misc::Font::LEFT;
|
m_toolbarstyle.font.justify = DrawUtil::Font::LEFT;
|
||||||
} else
|
} else
|
||||||
m_toolbarstyle.font.justify = Misc::Font::LEFT;
|
m_toolbarstyle.font.justify = DrawUtil::Font::LEFT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
src/Theme.hh
12
src/Theme.hh
|
@ -50,8 +50,8 @@
|
||||||
#include "Image.hh"
|
#include "Image.hh"
|
||||||
#endif //_IMAGE_HH_
|
#endif //_IMAGE_HH_
|
||||||
|
|
||||||
#ifndef _MISC_HH_
|
#ifndef _DRAWUTIL_HH_
|
||||||
#include "misc.hh"
|
#include "DrawUtil.hh"
|
||||||
#endif //_MISC_HH_
|
#endif //_MISC_HH_
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
@ -70,7 +70,7 @@ public:
|
||||||
BColor t_text, f_text, h_text, d_text;
|
BColor t_text, f_text, h_text, d_text;
|
||||||
BTexture title, frame, hilite;
|
BTexture title, frame, hilite;
|
||||||
GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc;
|
GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc;
|
||||||
Misc::Font titlefont, framefont;
|
DrawUtil::Font titlefont, framefont;
|
||||||
int bullet, bullet_pos;
|
int bullet, bullet_pos;
|
||||||
} MenuStyle;
|
} MenuStyle;
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public:
|
||||||
BTexture l_focus, l_unfocus,
|
BTexture 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;
|
||||||
Misc::Font font;
|
DrawUtil::Font font;
|
||||||
BColor l_text_focus, l_text_unfocus;
|
BColor l_text_focus, l_text_unfocus;
|
||||||
} LabelStyle;
|
} LabelStyle;
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public:
|
||||||
BColor border_color;
|
BColor border_color;
|
||||||
unsigned int border_width;
|
unsigned int border_width;
|
||||||
unsigned int border_width_2x;
|
unsigned int border_width_2x;
|
||||||
Misc::XRotFontStruct *rot_font;
|
DrawUtil::XRotFontStruct *rot_font;
|
||||||
} tab;
|
} tab;
|
||||||
|
|
||||||
} WindowStyle;
|
} WindowStyle;
|
||||||
|
@ -105,7 +105,7 @@ public:
|
||||||
BColor l_text, w_text, c_text, b_pic;
|
BColor l_text, w_text, c_text, b_pic;
|
||||||
BTexture toolbar, label, window, button, pressed, clock;
|
BTexture toolbar, label, window, button, pressed, clock;
|
||||||
GC l_text_gc, w_text_gc, c_text_gc, b_pic_gc;
|
GC l_text_gc, w_text_gc, c_text_gc, b_pic_gc;
|
||||||
Misc::Font font;
|
DrawUtil::Font font;
|
||||||
|
|
||||||
} ToolbarStyle;
|
} ToolbarStyle;
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,6 @@
|
||||||
#endif // TIME_WITH_SYS_TIME
|
#endif // TIME_WITH_SYS_TIME
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "misc.hh"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -645,11 +644,11 @@ void Toolbar::checkClock(Bool redraw, Bool date) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (screen->getToolbarStyle()->font.justify) {
|
switch (screen->getToolbarStyle()->font.justify) {
|
||||||
case Misc::Font::RIGHT:
|
case DrawUtil::Font::RIGHT:
|
||||||
dx += frame.clock_w - l;
|
dx += frame.clock_w - l;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Misc::Font::CENTER:
|
case DrawUtil::Font::CENTER:
|
||||||
dx += (frame.clock_w - l) / 2;
|
dx += (frame.clock_w - l) / 2;
|
||||||
break;
|
break;
|
||||||
default: //LEFT
|
default: //LEFT
|
||||||
|
@ -711,11 +710,11 @@ void Toolbar::redrawWindowLabel(Bool redraw) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (screen->getToolbarStyle()->font.justify) {
|
switch (screen->getToolbarStyle()->font.justify) {
|
||||||
case Misc::Font::RIGHT:
|
case DrawUtil::Font::RIGHT:
|
||||||
dx += frame.window_label_w - l;
|
dx += frame.window_label_w - l;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Misc::Font::CENTER:
|
case DrawUtil::Font::CENTER:
|
||||||
dx += (frame.window_label_w - l) / 2;
|
dx += (frame.window_label_w - l) / 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -789,11 +788,11 @@ void Toolbar::redrawWorkspaceLabel(Bool redraw) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (screen->getToolbarStyle()->font.justify) {
|
switch (screen->getToolbarStyle()->font.justify) {
|
||||||
case Misc::Font::RIGHT:
|
case DrawUtil::Font::RIGHT:
|
||||||
dx += frame.workspace_label_w - l;
|
dx += frame.workspace_label_w - l;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Misc::Font::CENTER:
|
case DrawUtil::Font::CENTER:
|
||||||
dx += (frame.workspace_label_w - l) / 2;
|
dx += (frame.workspace_label_w - l) / 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "Windowmenu.hh"
|
#include "Windowmenu.hh"
|
||||||
#include "Workspace.hh"
|
#include "Workspace.hh"
|
||||||
#include "misc.hh"
|
#include "misc.hh"
|
||||||
|
#include "StringUtil.hh"
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
# include "Slit.hh"
|
# include "Slit.hh"
|
||||||
|
@ -1201,17 +1202,17 @@ void FluxboxWindow::getWMName(void) {
|
||||||
if ((XmbTextPropertyToTextList(display, &text_prop,
|
if ((XmbTextPropertyToTextList(display, &text_prop,
|
||||||
&list, &num) == Success) &&
|
&list, &num) == Success) &&
|
||||||
(num > 0) && *list) {
|
(num > 0) && *list) {
|
||||||
client.title = Misc::strdup(*list);
|
client.title = StringUtil::strdup(*list);
|
||||||
XFreeStringList(list);
|
XFreeStringList(list);
|
||||||
} else
|
} else
|
||||||
client.title = Misc::strdup((char *) text_prop.value);
|
client.title = StringUtil::strdup((char *) text_prop.value);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
client.title = Misc::strdup((char *) text_prop.value);
|
client.title = StringUtil::strdup((char *) text_prop.value);
|
||||||
|
|
||||||
XFree((char *) text_prop.value);
|
XFree((char *) text_prop.value);
|
||||||
} else
|
} else
|
||||||
client.title = Misc::strdup(i18n->getMessage(
|
client.title = StringUtil::strdup(i18n->getMessage(
|
||||||
#ifdef NLS
|
#ifdef NLS
|
||||||
WindowSet, WindowUnnamed,
|
WindowSet, WindowUnnamed,
|
||||||
#else // !NLS
|
#else // !NLS
|
||||||
|
@ -1219,7 +1220,7 @@ void FluxboxWindow::getWMName(void) {
|
||||||
#endif //
|
#endif //
|
||||||
"Unnamed"));
|
"Unnamed"));
|
||||||
} else {
|
} else {
|
||||||
client.title = Misc::strdup(i18n->getMessage(
|
client.title = StringUtil::strdup(i18n->getMessage(
|
||||||
#ifdef NLS
|
#ifdef NLS
|
||||||
WindowSet, WindowUnnamed,
|
WindowSet, WindowUnnamed,
|
||||||
#else // !NLS
|
#else // !NLS
|
||||||
|
@ -1263,18 +1264,18 @@ void FluxboxWindow::getWMIconName(void) {
|
||||||
if ((XmbTextPropertyToTextList(display, &text_prop,
|
if ((XmbTextPropertyToTextList(display, &text_prop,
|
||||||
&list, &num) == Success) &&
|
&list, &num) == Success) &&
|
||||||
(num > 0) && *list) {
|
(num > 0) && *list) {
|
||||||
client.icon_title = Misc::strdup(*list);
|
client.icon_title = StringUtil::strdup(*list);
|
||||||
XFreeStringList(list);
|
XFreeStringList(list);
|
||||||
} else
|
} else
|
||||||
client.icon_title = Misc::strdup((char *) text_prop.value);
|
client.icon_title = StringUtil::strdup((char *) text_prop.value);
|
||||||
} else
|
} else
|
||||||
client.icon_title = Misc::strdup((char *) text_prop.value);
|
client.icon_title = StringUtil::strdup((char *) text_prop.value);
|
||||||
|
|
||||||
XFree((char *) text_prop.value);
|
XFree((char *) text_prop.value);
|
||||||
} else
|
} else
|
||||||
client.icon_title = Misc::strdup(client.title);
|
client.icon_title = StringUtil::strdup(client.title);
|
||||||
} else
|
} else
|
||||||
client.icon_title = Misc::strdup(client.title);
|
client.icon_title = StringUtil::strdup(client.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2416,7 +2417,7 @@ void FluxboxWindow::redrawLabel(void) {
|
||||||
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);
|
||||||
|
|
||||||
Misc::DrawString(display, frame.label, gc,
|
DrawUtil::DrawString(display, frame.label, gc,
|
||||||
&screen->getWindowStyle()->font,
|
&screen->getWindowStyle()->font,
|
||||||
client.title_text_w, frame.label_w,
|
client.title_text_w, frame.label_w,
|
||||||
frame.bevel_w, client.title);
|
frame.bevel_w, client.title);
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "Window.hh"
|
#include "Window.hh"
|
||||||
#include "Workspace.hh"
|
#include "Workspace.hh"
|
||||||
#include "Windowmenu.hh"
|
#include "Windowmenu.hh"
|
||||||
|
#include "StringUtil.hh"
|
||||||
|
|
||||||
#ifdef HAVE_STDIO_H
|
#ifdef HAVE_STDIO_H
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
|
@ -49,10 +50,6 @@
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
#endif // STDC_HEADERS
|
#endif // STDC_HEADERS
|
||||||
|
|
||||||
#define MIN(x,y) ((x < y) ? x : y)
|
|
||||||
#define MAX(x,y) ((x > y) ? x : y)
|
|
||||||
|
|
||||||
|
|
||||||
Workspace::Workspace(BScreen *scrn, int i) {
|
Workspace::Workspace(BScreen *scrn, int i) {
|
||||||
screen = scrn;
|
screen = scrn;
|
||||||
|
|
||||||
|
@ -309,7 +306,7 @@ void Workspace::setName(char *new_name) {
|
||||||
delete [] name;
|
delete [] name;
|
||||||
|
|
||||||
if (new_name) {
|
if (new_name) {
|
||||||
name = Misc::strdup(new_name);
|
name = StringUtil::strdup(new_name);
|
||||||
} else {
|
} else {
|
||||||
name = new char[128];
|
name = new char[128];
|
||||||
sprintf(name, I18n::instance()->
|
sprintf(name, I18n::instance()->
|
||||||
|
|
|
@ -32,16 +32,6 @@
|
||||||
# include "../config.h"
|
# include "../config.h"
|
||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/Xutil.h>
|
|
||||||
#include <X11/Xresource.h>
|
|
||||||
#include <X11/Xatom.h>
|
|
||||||
#include <X11/keysym.h>
|
|
||||||
|
|
||||||
#ifdef SHAPE
|
|
||||||
#include <X11/extensions/shape.h>
|
|
||||||
#endif // SHAPE
|
|
||||||
|
|
||||||
#include "i18n.hh"
|
#include "i18n.hh"
|
||||||
#include "fluxbox.hh"
|
#include "fluxbox.hh"
|
||||||
#include "Basemenu.hh"
|
#include "Basemenu.hh"
|
||||||
|
@ -57,6 +47,18 @@
|
||||||
#include "Window.hh"
|
#include "Window.hh"
|
||||||
#include "Workspace.hh"
|
#include "Workspace.hh"
|
||||||
#include "Workspacemenu.hh"
|
#include "Workspacemenu.hh"
|
||||||
|
#include "StringUtil.hh"
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/Xresource.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <X11/keysym.h>
|
||||||
|
|
||||||
|
#ifdef SHAPE
|
||||||
|
#include <X11/extensions/shape.h>
|
||||||
|
#endif // SHAPE
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_STDIO_H
|
#ifdef HAVE_STDIO_H
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
|
@ -1699,7 +1701,7 @@ char *Fluxbox::getRcFilename() {
|
||||||
snprintf(dbfile, dbfile_size, "%s/.%s/%s", homedir, RC_PATH, RC_INIT_FILE);
|
snprintf(dbfile, dbfile_size, "%s/.%s/%s", homedir, RC_PATH, RC_INIT_FILE);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
dbfile = Misc::strdup(rc_file);
|
dbfile = StringUtil::strdup(rc_file);
|
||||||
|
|
||||||
return dbfile;
|
return dbfile;
|
||||||
}
|
}
|
||||||
|
@ -1731,9 +1733,9 @@ void Fluxbox::load_rc(void) {
|
||||||
if (XrmGetResource(database, "session.menuFile", "Session.MenuFile",
|
if (XrmGetResource(database, "session.menuFile", "Session.MenuFile",
|
||||||
&value_type, &value)) {
|
&value_type, &value)) {
|
||||||
|
|
||||||
resource.menu_file = Misc::expandFilename(value.addr); // expand ~ to $HOME
|
resource.menu_file = StringUtil::expandFilename(value.addr); // expand ~ to $HOME
|
||||||
} else
|
} else
|
||||||
resource.menu_file = Misc::strdup(DEFAULTMENU);
|
resource.menu_file = StringUtil::strdup(DEFAULTMENU);
|
||||||
|
|
||||||
if (resource.titlebar_file) {
|
if (resource.titlebar_file) {
|
||||||
delete resource.titlebar_file;
|
delete resource.titlebar_file;
|
||||||
|
@ -1743,9 +1745,9 @@ void Fluxbox::load_rc(void) {
|
||||||
//get titlebar filename
|
//get titlebar filename
|
||||||
if (XrmGetResource(database, "session.titlebarFile", "Session.TitlebarFile",
|
if (XrmGetResource(database, "session.titlebarFile", "Session.TitlebarFile",
|
||||||
&value_type, &value)) {
|
&value_type, &value)) {
|
||||||
resource.titlebar_file = Misc::expandFilename(value.addr); //expand ~ to home
|
resource.titlebar_file = StringUtil::expandFilename(value.addr); //expand ~ to home
|
||||||
} else
|
} else
|
||||||
resource.titlebar_file = Misc::strdup(DEFAULTTITLEBAR);
|
resource.titlebar_file = StringUtil::strdup(DEFAULTTITLEBAR);
|
||||||
|
|
||||||
//if already allocated memory for keys_file destroy it
|
//if already allocated memory for keys_file destroy it
|
||||||
if (resource.keys_file) {
|
if (resource.keys_file) {
|
||||||
|
@ -1756,9 +1758,9 @@ void Fluxbox::load_rc(void) {
|
||||||
//get keys filename
|
//get keys filename
|
||||||
if (XrmGetResource(database, "session.keyFile", "Session.keyFile",
|
if (XrmGetResource(database, "session.keyFile", "Session.keyFile",
|
||||||
&value_type, &value)) {
|
&value_type, &value)) {
|
||||||
resource.keys_file = Misc::expandFilename(value.addr); //expand ~ to home
|
resource.keys_file = StringUtil::expandFilename(value.addr); //expand ~ to home
|
||||||
} else
|
} else
|
||||||
resource.keys_file = Misc::strdup(DEFAULTKEYSFILE);
|
resource.keys_file = StringUtil::strdup(DEFAULTKEYSFILE);
|
||||||
|
|
||||||
|
|
||||||
if (XrmGetResource(database, "session.iconbar", "Session.Iconbar",
|
if (XrmGetResource(database, "session.iconbar", "Session.Iconbar",
|
||||||
|
@ -1797,9 +1799,9 @@ void Fluxbox::load_rc(void) {
|
||||||
|
|
||||||
if (XrmGetResource(database, "session.styleFile", "Session.StyleFile",
|
if (XrmGetResource(database, "session.styleFile", "Session.StyleFile",
|
||||||
&value_type, &value))
|
&value_type, &value))
|
||||||
resource.style_file = Misc::expandFilename(value.addr);
|
resource.style_file = StringUtil::expandFilename(value.addr);
|
||||||
else
|
else
|
||||||
resource.style_file = Misc::strdup(DEFAULTSTYLE);
|
resource.style_file = StringUtil::strdup(DEFAULTSTYLE);
|
||||||
|
|
||||||
if (resource.root_cmd) {
|
if (resource.root_cmd) {
|
||||||
delete [] resource.root_cmd;
|
delete [] resource.root_cmd;
|
||||||
|
@ -1807,7 +1809,7 @@ void Fluxbox::load_rc(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XrmGetResource(database, "session.rootCommand", "Session.RootCommand", &value_type, &value))
|
if (XrmGetResource(database, "session.rootCommand", "Session.RootCommand", &value_type, &value))
|
||||||
resource.root_cmd = Misc::expandFilename(value.addr);
|
resource.root_cmd = StringUtil::expandFilename(value.addr);
|
||||||
else
|
else
|
||||||
resource.root_cmd = 0;
|
resource.root_cmd = 0;
|
||||||
|
|
||||||
|
@ -2058,7 +2060,7 @@ void Fluxbox::load_rc(BScreen *screen) {
|
||||||
sprintf(class_lookup, "Session.Screen%d.WorkspaceNames", screen_number);
|
sprintf(class_lookup, "Session.Screen%d.WorkspaceNames", screen_number);
|
||||||
if (XrmGetResource(database, name_lookup, class_lookup, &value_type,
|
if (XrmGetResource(database, name_lookup, class_lookup, &value_type,
|
||||||
&value)) {
|
&value)) {
|
||||||
char *search = Misc::strdup(value.addr);
|
char *search = StringUtil::strdup(value.addr);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < screen->getNumberOfWorkspaces(); i++) {
|
for (i = 0; i < screen->getNumberOfWorkspaces(); i++) {
|
||||||
|
@ -2504,7 +2506,7 @@ void Fluxbox::saveStyleFilename(const char *filename) {
|
||||||
if (resource.style_file)
|
if (resource.style_file)
|
||||||
delete [] resource.style_file;
|
delete [] resource.style_file;
|
||||||
|
|
||||||
resource.style_file = Misc::strdup(filename);
|
resource.style_file = StringUtil::strdup(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2521,7 +2523,7 @@ void Fluxbox::saveMenuFilename(const char *filename) {
|
||||||
if (! stat(filename, &buf)) {
|
if (! stat(filename, &buf)) {
|
||||||
MenuTimestamp *ts = new MenuTimestamp;
|
MenuTimestamp *ts = new MenuTimestamp;
|
||||||
|
|
||||||
ts->filename = Misc::strdup(filename);
|
ts->filename = StringUtil::strdup(filename);
|
||||||
ts->timestamp = buf.st_ctime;
|
ts->timestamp = buf.st_ctime;
|
||||||
|
|
||||||
menuTimestamps->insert(ts);
|
menuTimestamps->insert(ts);
|
||||||
|
|
Loading…
Reference in a new issue