diff options
-rw-r--r-- | src/Basemenu.cc | 17 | ||||
-rw-r--r-- | src/IconBar.cc | 4 | ||||
-rw-r--r-- | src/Screen.cc | 9 | ||||
-rw-r--r-- | src/Tab.cc | 13 | ||||
-rw-r--r-- | src/Theme.cc | 48 | ||||
-rw-r--r-- | src/Theme.hh | 12 | ||||
-rw-r--r-- | src/Toolbar.cc | 13 | ||||
-rw-r--r-- | src/Window.cc | 23 | ||||
-rw-r--r-- | src/Workspace.cc | 7 | ||||
-rw-r--r-- | src/fluxbox.cc | 48 |
10 files changed, 98 insertions, 96 deletions
diff --git a/src/Basemenu.cc b/src/Basemenu.cc index 8ed35ef..bf031dd 100644 --- a/src/Basemenu.cc +++ b/src/Basemenu.cc | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "fluxbox.hh" | 33 | #include "fluxbox.hh" |
34 | #include "Basemenu.hh" | 34 | #include "Basemenu.hh" |
35 | #include "Screen.hh" | 35 | #include "Screen.hh" |
36 | #include "StringUtil.hh" | ||
36 | 37 | ||
37 | #ifdef HAVE_STDIO_H | 38 | #ifdef HAVE_STDIO_H |
38 | # include <stdio.h> | 39 | # include <stdio.h> |
@@ -197,8 +198,8 @@ Basemenu::~Basemenu(void) { | |||
197 | int Basemenu::insert(const char *l, int function, const char *e, int pos) { | 198 | int Basemenu::insert(const char *l, int function, const char *e, int pos) { |
198 | char *label = 0, *exec = 0; | 199 | char *label = 0, *exec = 0; |
199 | 200 | ||
200 | if (l) label = Misc::strdup(l); | 201 | if (l) label = StringUtil::strdup(l); |
201 | if (e) exec = Misc::strdup(e); | 202 | if (e) exec = StringUtil::strdup(e); |
202 | 203 | ||
203 | BasemenuItem *item = new BasemenuItem(label, function, exec); | 204 | BasemenuItem *item = new BasemenuItem(label, function, exec); |
204 | menuitems->insert(item, pos); | 205 | menuitems->insert(item, pos); |
@@ -210,7 +211,7 @@ int Basemenu::insert(const char *l, int function, const char *e, int pos) { | |||
210 | int Basemenu::insert(const char *l, Basemenu *submenu, int pos) { | 211 | int Basemenu::insert(const char *l, Basemenu *submenu, int pos) { |
211 | char *label = 0; | 212 | char *label = 0; |
212 | 213 | ||
213 | if (l) label = Misc::strdup(l); | 214 | if (l) label = StringUtil::strdup(l); |
214 | 215 | ||
215 | BasemenuItem *item = new BasemenuItem(label, submenu); | 216 | BasemenuItem *item = new BasemenuItem(label, submenu); |
216 | menuitems->insert(item, pos); | 217 | menuitems->insert(item, pos); |
@@ -507,11 +508,11 @@ void Basemenu::redrawTitle(void) { | |||
507 | l += (menu.bevel_w * 2); | 508 | l += (menu.bevel_w * 2); |
508 | 509 | ||
509 | switch (screen->getMenuStyle()->titlefont.justify) { | 510 | switch (screen->getMenuStyle()->titlefont.justify) { |
510 | case Misc::Font::RIGHT: | 511 | case DrawUtil::Font::RIGHT: |
511 | dx += menu.width - l; | 512 | dx += menu.width - l; |
512 | break; | 513 | break; |
513 | 514 | ||
514 | case Misc::Font::CENTER: | 515 | case DrawUtil::Font::CENTER: |
515 | dx += (menu.width - l) / 2; | 516 | dx += (menu.width - l) / 2; |
516 | break; | 517 | break; |
517 | default: | 518 | default: |
@@ -644,11 +645,11 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear, | |||
644 | } | 645 | } |
645 | 646 | ||
646 | switch(screen->getMenuStyle()->framefont.justify) { | 647 | switch(screen->getMenuStyle()->framefont.justify) { |
647 | case Misc::Font::LEFT: | 648 | case DrawUtil::Font::LEFT: |
648 | text_x = item_x + menu.bevel_w + menu.item_h + 1; | 649 | text_x = item_x + menu.bevel_w + menu.item_h + 1; |
649 | break; | 650 | break; |
650 | 651 | ||
651 | case Misc::Font::RIGHT: | 652 | case DrawUtil::Font::RIGHT: |
652 | text_x = item_x + menu.item_w - (menu.item_h + menu.bevel_w + text_w); | 653 | text_x = item_x + menu.item_w - (menu.item_h + menu.bevel_w + text_w); |
653 | break; | 654 | break; |
654 | default: //center | 655 | default: //center |
@@ -789,7 +790,7 @@ void Basemenu::setLabel(const char *l) { | |||
789 | if (menu.label) | 790 | if (menu.label) |
790 | delete [] menu.label; | 791 | delete [] menu.label; |
791 | 792 | ||
792 | if (l) menu.label = Misc::strdup(l); | 793 | if (l) menu.label = StringUtil::strdup(l); |
793 | else menu.label = 0; | 794 | else menu.label = 0; |
794 | } | 795 | } |
795 | 796 | ||
diff --git a/src/IconBar.cc b/src/IconBar.cc index 49050e0..a20f1fd 100644 --- a/src/IconBar.cc +++ b/src/IconBar.cc | |||
@@ -273,10 +273,10 @@ void IconBar::draw(IconBarObj *obj, int width) { | |||
273 | } | 273 | } |
274 | 274 | ||
275 | switch (m_screen->getWindowStyle()->tab.font.justify) { | 275 | switch (m_screen->getWindowStyle()->tab.font.justify) { |
276 | case Misc::Font::RIGHT: | 276 | case DrawUtil::Font::RIGHT: |
277 | dx += width - l; | 277 | dx += width - l; |
278 | break; | 278 | break; |
279 | case Misc::Font::CENTER: | 279 | case DrawUtil::Font::CENTER: |
280 | dx += (width - l) / 2; | 280 | dx += (width - l) / 2; |
281 | break; | 281 | break; |
282 | default: | 282 | default: |
diff --git a/src/Screen.cc b/src/Screen.cc index 07185d3..6f83536 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -39,6 +39,7 @@ | |||
39 | #include "Icon.hh" | 39 | #include "Icon.hh" |
40 | #include "Image.hh" | 40 | #include "Image.hh" |
41 | #include "Screen.hh" | 41 | #include "Screen.hh" |
42 | #include "StringUtil.hh" | ||
42 | 43 | ||
43 | #ifdef SLIT | 44 | #ifdef SLIT |
44 | #include "Slit.hh" | 45 | #include "Slit.hh" |
@@ -831,13 +832,13 @@ void BScreen::saveStrftimeFormat(char *format) { | |||
831 | if (resource.strftime_format) | 832 | if (resource.strftime_format) |
832 | delete [] resource.strftime_format; | 833 | delete [] resource.strftime_format; |
833 | 834 | ||
834 | resource.strftime_format = Misc::strdup(format); | 835 | resource.strftime_format = StringUtil::strdup(format); |
835 | } | 836 | } |
836 | #endif // HAVE_STRFTIME | 837 | #endif // HAVE_STRFTIME |
837 | 838 | ||
838 | 839 | ||
839 | void BScreen::addWorkspaceName(char *name) { | 840 | void BScreen::addWorkspaceName(char *name) { |
840 | workspaceNames->insert(Misc::strdup(name)); | 841 | workspaceNames->insert(StringUtil::strdup(name)); |
841 | 842 | ||
842 | } | 843 | } |
843 | 844 | ||
@@ -847,7 +848,7 @@ void BScreen::getNameOfWorkspace(int id, char **name) { | |||
847 | char *wkspc_name = workspaceNames->find(id); | 848 | char *wkspc_name = workspaceNames->find(id); |
848 | 849 | ||
849 | if (wkspc_name) | 850 | if (wkspc_name) |
850 | *name = Misc::strdup(wkspc_name); | 851 | *name = StringUtil::strdup(wkspc_name); |
851 | } else | 852 | } else |
852 | *name = 0; | 853 | *name = 0; |
853 | } | 854 | } |
@@ -1460,7 +1461,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) { | |||
1460 | char **ls = new char* [entries]; | 1461 | char **ls = new char* [entries]; |
1461 | int index = 0; | 1462 | int index = 0; |
1462 | while ((p = readdir(d))) | 1463 | while ((p = readdir(d))) |
1463 | ls[index++] = Misc::strdup(p->d_name); | 1464 | ls[index++] = StringUtil::strdup(p->d_name); |
1464 | 1465 | ||
1465 | qsort(ls, entries, sizeof(char *), dcmp); | 1466 | qsort(ls, entries, sizeof(char *), dcmp); |
1466 | 1467 | ||
@@ -20,14 +20,15 @@ | |||
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | #include "Tab.hh" | 22 | #include "Tab.hh" |
23 | #include <iostream> | 23 | |
24 | #ifdef HAVE_CONFIG_H | 24 | #ifdef HAVE_CONFIG_H |
25 | # include "../config.h" | 25 | # include "../config.h" |
26 | #endif // HAVE_CONFIG_H | 26 | #endif // HAVE_CONFIG_H |
27 | #include "i18n.hh" | ||
28 | 27 | ||
29 | #include "misc.hh" | 28 | #include "i18n.hh" |
29 | #include "DrawUtil.hh" | ||
30 | 30 | ||
31 | #include <iostream> | ||
31 | using namespace std; | 32 | using namespace std; |
32 | 33 | ||
33 | bool Tab::m_stoptabs = false; | 34 | bool Tab::m_stoptabs = false; |
@@ -333,11 +334,11 @@ void Tab::draw(bool pressed) { | |||
333 | m_win->getScreen()->getTabPlacement() == PRIGHT) && | 334 | m_win->getScreen()->getTabPlacement() == PRIGHT) && |
334 | (!m_win->isShaded() && m_win->getScreen()->isTabRotateVertical())) { | 335 | (!m_win->isShaded() && m_win->getScreen()->isTabRotateVertical())) { |
335 | 336 | ||
336 | tabtext_w = Misc::XRotTextWidth(m_win->getScreen()->getWindowStyle()->tab.rot_font, | 337 | tabtext_w = DrawUtil::XRotTextWidth(m_win->getScreen()->getWindowStyle()->tab.rot_font, |
337 | m_win->client.title, m_win->client.title_len); | 338 | m_win->client.title, m_win->client.title_len); |
338 | tabtext_w += (m_win->frame.bevel_w * 4); | 339 | tabtext_w += (m_win->frame.bevel_w * 4); |
339 | 340 | ||
340 | Misc::DrawRotString(m_display, m_tabwin, gc, | 341 | DrawUtil::DrawRotString(m_display, m_tabwin, gc, |
341 | m_win->getScreen()->getWindowStyle()->tab.rot_font, | 342 | m_win->getScreen()->getWindowStyle()->tab.rot_font, |
342 | m_win->getScreen()->getWindowStyle()->tab.font.justify, | 343 | m_win->getScreen()->getWindowStyle()->tab.font.justify, |
343 | tabtext_w, m_size_w, m_size_h, | 344 | tabtext_w, m_size_w, m_size_h, |
@@ -357,7 +358,7 @@ void Tab::draw(bool pressed) { | |||
357 | } | 358 | } |
358 | tabtext_w += (m_win->frame.bevel_w * 4); | 359 | tabtext_w += (m_win->frame.bevel_w * 4); |
359 | 360 | ||
360 | Misc::DrawString(m_display, m_tabwin, gc, | 361 | DrawUtil::DrawString(m_display, m_tabwin, gc, |
361 | &m_win->getScreen()->getWindowStyle()->tab.font, | 362 | &m_win->getScreen()->getWindowStyle()->tab.font, |
362 | tabtext_w, m_size_w, | 363 | tabtext_w, m_size_w, |
363 | m_win->frame.bevel_w, m_win->client.title); | 364 | m_win->frame.bevel_w, m_win->client.title); |
diff --git a/src/Theme.cc b/src/Theme.cc index 80ab585..564a157 100644 --- a/src/Theme.cc +++ b/src/Theme.cc | |||
@@ -270,7 +270,7 @@ void Theme::freeTabStyle() { | |||
270 | XFreeFont(m_display, m_windowstyle.tab.font.fontstruct); | 270 | XFreeFont(m_display, m_windowstyle.tab.font.fontstruct); |
271 | 271 | ||
272 | if (m_windowstyle.tab.rot_font) | 272 | if (m_windowstyle.tab.rot_font) |
273 | Misc::XRotUnloadFont(m_display, m_windowstyle.tab.rot_font); | 273 | DrawUtil::XRotUnloadFont(m_display, m_windowstyle.tab.rot_font); |
274 | 274 | ||
275 | 275 | ||
276 | XFreeGC(m_display, m_windowstyle.tab.l_text_focus_gc); | 276 | XFreeGC(m_display, m_windowstyle.tab.l_text_focus_gc); |
@@ -345,27 +345,27 @@ void Theme::loadMenuStyle() { | |||
345 | "Menu.Title.Justify", &value_type, &value)) { | 345 | "Menu.Title.Justify", &value_type, &value)) { |
346 | 346 | ||
347 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) | 347 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) |
348 | m_menustyle.titlefont.justify = Misc::Font::RIGHT; | 348 | m_menustyle.titlefont.justify = DrawUtil::Font::RIGHT; |
349 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) | 349 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) |
350 | m_menustyle.titlefont.justify = Misc::Font::CENTER; | 350 | m_menustyle.titlefont.justify = DrawUtil::Font::CENTER; |
351 | else | 351 | else |
352 | m_menustyle.titlefont.justify = Misc::Font::LEFT; | 352 | m_menustyle.titlefont.justify = DrawUtil::Font::LEFT; |
353 | 353 | ||
354 | } else | 354 | } else |
355 | m_menustyle.titlefont.justify = Misc::Font::LEFT; | 355 | m_menustyle.titlefont.justify = DrawUtil::Font::LEFT; |
356 | 356 | ||
357 | if (XrmGetResource(m_database, "menu.frame.justify", | 357 | if (XrmGetResource(m_database, "menu.frame.justify", |
358 | "Menu.Frame.Justify", &value_type, &value)) { | 358 | "Menu.Frame.Justify", &value_type, &value)) { |
359 | 359 | ||
360 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) | 360 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) |
361 | m_menustyle.framefont.justify = Misc::Font::RIGHT; | 361 | m_menustyle.framefont.justify = DrawUtil::Font::RIGHT; |
362 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) | 362 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) |
363 | m_menustyle.framefont.justify = Misc::Font::CENTER; | 363 | m_menustyle.framefont.justify = DrawUtil::Font::CENTER; |
364 | else | 364 | else |
365 | m_menustyle.framefont.justify = Misc::Font::LEFT; | 365 | m_menustyle.framefont.justify = DrawUtil::Font::LEFT; |
366 | 366 | ||
367 | } else | 367 | } else |
368 | m_menustyle.framefont.justify = Misc::Font::LEFT; | 368 | m_menustyle.framefont.justify = DrawUtil::Font::LEFT; |
369 | 369 | ||
370 | if (XrmGetResource(m_database, "menu.bullet", "Menu.Bullet", | 370 | if (XrmGetResource(m_database, "menu.bullet", "Menu.Bullet", |
371 | &value_type, &value)) { | 371 | &value_type, &value)) { |
@@ -500,13 +500,13 @@ void Theme::loadWindowStyle() { | |||
500 | if (XrmGetResource(m_database, "window.justify", "Window.Justify", | 500 | if (XrmGetResource(m_database, "window.justify", "Window.Justify", |
501 | &value_type, &value)) { | 501 | &value_type, &value)) { |
502 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) | 502 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) |
503 | m_windowstyle.font.justify = Misc::Font::RIGHT; | 503 | m_windowstyle.font.justify = DrawUtil::Font::RIGHT; |
504 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) | 504 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) |
505 | m_windowstyle.font.justify = Misc::Font::CENTER; | 505 | m_windowstyle.font.justify = DrawUtil::Font::CENTER; |
506 | else | 506 | else |
507 | m_windowstyle.font.justify = Misc::Font::LEFT; | 507 | m_windowstyle.font.justify = DrawUtil::Font::LEFT; |
508 | } else | 508 | } else |
509 | m_windowstyle.font.justify = Misc::Font::LEFT; | 509 | m_windowstyle.font.justify = DrawUtil::Font::LEFT; |
510 | 510 | ||
511 | } | 511 | } |
512 | 512 | ||
@@ -578,21 +578,21 @@ void Theme::loadTabStyle() { | |||
578 | // TODO: add extra checking | 578 | // TODO: add extra checking |
579 | if (XrmGetResource(m_database, "window.tab.font", "Window.Tab.Font", | 579 | if (XrmGetResource(m_database, "window.tab.font", "Window.Tab.Font", |
580 | &value_type, &value)) { | 580 | &value_type, &value)) { |
581 | if (! (m_windowstyle.tab.rot_font = Misc::XRotLoadFont(m_display, value.addr, 90.0)) ) | 581 | if (! (m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, value.addr, 90.0)) ) |
582 | m_windowstyle.tab.rot_font = Misc::XRotLoadFont(m_display, "fixed", 90); | 582 | m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, "fixed", 90); |
583 | } else | 583 | } else |
584 | m_windowstyle.tab.rot_font = Misc::XRotLoadFont(m_display, "fixed", 90); | 584 | m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, "fixed", 90); |
585 | 585 | ||
586 | if (XrmGetResource(m_database, "window.tab.justify", "Window.Tab.Justify", | 586 | if (XrmGetResource(m_database, "window.tab.justify", "Window.Tab.Justify", |
587 | &value_type, &value)) { | 587 | &value_type, &value)) { |
588 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) | 588 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) |
589 | m_windowstyle.tab.font.justify = Misc::Font::RIGHT; | 589 | m_windowstyle.tab.font.justify = DrawUtil::Font::RIGHT; |
590 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) | 590 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) |
591 | m_windowstyle.tab.font.justify = Misc::Font::CENTER; | 591 | m_windowstyle.tab.font.justify = DrawUtil::Font::CENTER; |
592 | else | 592 | else |
593 | m_windowstyle.tab.font.justify = Misc::Font::LEFT; | 593 | m_windowstyle.tab.font.justify = DrawUtil::Font::LEFT; |
594 | } else | 594 | } else |
595 | m_windowstyle.tab.font.justify = Misc::Font::LEFT; | 595 | m_windowstyle.tab.font.justify = DrawUtil::Font::LEFT; |
596 | 596 | ||
597 | } | 597 | } |
598 | 598 | ||
@@ -649,13 +649,13 @@ void Theme::loadToolbarStyle() { | |||
649 | if (XrmGetResource(m_database, "toolbar.justify", | 649 | if (XrmGetResource(m_database, "toolbar.justify", |
650 | "Toolbar.Justify", &value_type, &value)) { | 650 | "Toolbar.Justify", &value_type, &value)) { |
651 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) | 651 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) |
652 | m_toolbarstyle.font.justify = Misc::Font::RIGHT; | 652 | m_toolbarstyle.font.justify = DrawUtil::Font::RIGHT; |
653 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) | 653 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) |
654 | m_toolbarstyle.font.justify = Misc::Font::CENTER; | 654 | m_toolbarstyle.font.justify = DrawUtil::Font::CENTER; |
655 | else | 655 | else |
656 | m_toolbarstyle.font.justify = Misc::Font::LEFT; | 656 | m_toolbarstyle.font.justify = DrawUtil::Font::LEFT; |
657 | } else | 657 | } else |
658 | m_toolbarstyle.font.justify = Misc::Font::LEFT; | 658 | m_toolbarstyle.font.justify = DrawUtil::Font::LEFT; |
659 | 659 | ||
660 | } | 660 | } |
661 | 661 | ||
diff --git a/src/Theme.hh b/src/Theme.hh index e02b8af..7b973d1 100644 --- a/src/Theme.hh +++ b/src/Theme.hh | |||
@@ -50,8 +50,8 @@ | |||
50 | #include "Image.hh" | 50 | #include "Image.hh" |
51 | #endif //_IMAGE_HH_ | 51 | #endif //_IMAGE_HH_ |
52 | 52 | ||
53 | #ifndef _MISC_HH_ | 53 | #ifndef _DRAWUTIL_HH_ |
54 | #include "misc.hh" | 54 | #include "DrawUtil.hh" |
55 | #endif //_MISC_HH_ | 55 | #endif //_MISC_HH_ |
56 | 56 | ||
57 | #include <X11/Xlib.h> | 57 | #include <X11/Xlib.h> |
@@ -70,7 +70,7 @@ public: | |||
70 | BColor t_text, f_text, h_text, d_text; | 70 | BColor t_text, f_text, h_text, d_text; |
71 | BTexture title, frame, hilite; | 71 | BTexture title, frame, hilite; |
72 | GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc; | 72 | GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc; |
73 | Misc::Font titlefont, framefont; | 73 | DrawUtil::Font titlefont, framefont; |
74 | int bullet, bullet_pos; | 74 | int bullet, bullet_pos; |
75 | } MenuStyle; | 75 | } MenuStyle; |
76 | 76 | ||
@@ -79,7 +79,7 @@ public: | |||
79 | BTexture l_focus, l_unfocus, | 79 | BTexture l_focus, l_unfocus, |
80 | t_focus, t_unfocus; | 80 | t_focus, t_unfocus; |
81 | GC l_text_focus_gc, l_text_unfocus_gc; | 81 | GC l_text_focus_gc, l_text_unfocus_gc; |
82 | Misc::Font font; | 82 | DrawUtil::Font font; |
83 | BColor l_text_focus, l_text_unfocus; | 83 | BColor l_text_focus, l_text_unfocus; |
84 | } LabelStyle; | 84 | } LabelStyle; |
85 | 85 | ||
@@ -95,7 +95,7 @@ public: | |||
95 | BColor border_color; | 95 | BColor border_color; |
96 | unsigned int border_width; | 96 | unsigned int border_width; |
97 | unsigned int border_width_2x; | 97 | unsigned int border_width_2x; |
98 | Misc::XRotFontStruct *rot_font; | 98 | DrawUtil::XRotFontStruct *rot_font; |
99 | } tab; | 99 | } tab; |
100 | 100 | ||
101 | } WindowStyle; | 101 | } WindowStyle; |
@@ -105,7 +105,7 @@ public: | |||
105 | BColor l_text, w_text, c_text, b_pic; | 105 | BColor l_text, w_text, c_text, b_pic; |
106 | BTexture toolbar, label, window, button, pressed, clock; | 106 | BTexture toolbar, label, window, button, pressed, clock; |
107 | GC l_text_gc, w_text_gc, c_text_gc, b_pic_gc; | 107 | GC l_text_gc, w_text_gc, c_text_gc, b_pic_gc; |
108 | Misc::Font font; | 108 | DrawUtil::Font font; |
109 | 109 | ||
110 | } ToolbarStyle; | 110 | } ToolbarStyle; |
111 | 111 | ||
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 6ad8327..c5a20e2 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc | |||
@@ -63,7 +63,6 @@ | |||
63 | #endif // TIME_WITH_SYS_TIME | 63 | #endif // TIME_WITH_SYS_TIME |
64 | 64 | ||
65 | #include <iostream> | 65 | #include <iostream> |
66 | #include "misc.hh" | ||
67 | 66 | ||
68 | using namespace std; | 67 | using namespace std; |
69 | 68 | ||
@@ -645,11 +644,11 @@ void Toolbar::checkClock(Bool redraw, Bool date) { | |||
645 | } | 644 | } |
646 | 645 | ||
647 | switch (screen->getToolbarStyle()->font.justify) { | 646 | switch (screen->getToolbarStyle()->font.justify) { |
648 | case Misc::Font::RIGHT: | 647 | case DrawUtil::Font::RIGHT: |
649 | dx += frame.clock_w - l; | 648 | dx += frame.clock_w - l; |
650 | break; | 649 | break; |
651 | 650 | ||
652 | case Misc::Font::CENTER: | 651 | case DrawUtil::Font::CENTER: |
653 | dx += (frame.clock_w - l) / 2; | 652 | dx += (frame.clock_w - l) / 2; |
654 | break; | 653 | break; |
655 | default: //LEFT | 654 | default: //LEFT |
@@ -711,11 +710,11 @@ void Toolbar::redrawWindowLabel(Bool redraw) { | |||
711 | } | 710 | } |
712 | } | 711 | } |
713 | switch (screen->getToolbarStyle()->font.justify) { | 712 | switch (screen->getToolbarStyle()->font.justify) { |
714 | case Misc::Font::RIGHT: | 713 | case DrawUtil::Font::RIGHT: |
715 | dx += frame.window_label_w - l; | 714 | dx += frame.window_label_w - l; |
716 | break; | 715 | break; |
717 | 716 | ||
718 | case Misc::Font::CENTER: | 717 | case DrawUtil::Font::CENTER: |
719 | dx += (frame.window_label_w - l) / 2; | 718 | dx += (frame.window_label_w - l) / 2; |
720 | break; | 719 | break; |
721 | default: | 720 | default: |
@@ -789,11 +788,11 @@ void Toolbar::redrawWorkspaceLabel(Bool redraw) { | |||
789 | } | 788 | } |
790 | 789 | ||
791 | switch (screen->getToolbarStyle()->font.justify) { | 790 | switch (screen->getToolbarStyle()->font.justify) { |
792 | case Misc::Font::RIGHT: | 791 | case DrawUtil::Font::RIGHT: |
793 | dx += frame.workspace_label_w - l; | 792 | dx += frame.workspace_label_w - l; |
794 | break; | 793 | break; |
795 | 794 | ||
796 | case Misc::Font::CENTER: | 795 | case DrawUtil::Font::CENTER: |
797 | dx += (frame.workspace_label_w - l) / 2; | 796 | dx += (frame.workspace_label_w - l) / 2; |
798 | break; | 797 | break; |
799 | default: | 798 | default: |
diff --git a/src/Window.cc b/src/Window.cc index 7275ba3..71ca471 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -41,6 +41,7 @@ | |||
41 | #include "Windowmenu.hh" | 41 | #include "Windowmenu.hh" |
42 | #include "Workspace.hh" | 42 | #include "Workspace.hh" |
43 | #include "misc.hh" | 43 | #include "misc.hh" |
44 | #include "StringUtil.hh" | ||
44 | 45 | ||
45 | #ifdef SLIT | 46 | #ifdef SLIT |
46 | # include "Slit.hh" | 47 | # include "Slit.hh" |
@@ -1201,17 +1202,17 @@ void FluxboxWindow::getWMName(void) { | |||
1201 | if ((XmbTextPropertyToTextList(display, &text_prop, | 1202 | if ((XmbTextPropertyToTextList(display, &text_prop, |
1202 | &list, &num) == Success) && | 1203 | &list, &num) == Success) && |
1203 | (num > 0) && *list) { | 1204 | (num > 0) && *list) { |
1204 | client.title = Misc::strdup(*list); | 1205 | client.title = StringUtil::strdup(*list); |
1205 | XFreeStringList(list); | 1206 | XFreeStringList(list); |
1206 | } else | 1207 | } else |
1207 | client.title = Misc::strdup((char *) text_prop.value); | 1208 | client.title = StringUtil::strdup((char *) text_prop.value); |
1208 | 1209 | ||
1209 | } else | 1210 | } else |
1210 | client.title = Misc::strdup((char *) text_prop.value); | 1211 | client.title = StringUtil::strdup((char *) text_prop.value); |
1211 | 1212 | ||
1212 | XFree((char *) text_prop.value); | 1213 | XFree((char *) text_prop.value); |
1213 | } else | 1214 | } else |
1214 | client.title = Misc::strdup(i18n->getMessage( | 1215 | client.title = StringUtil::strdup(i18n->getMessage( |
1215 | #ifdef NLS | 1216 | #ifdef NLS |
1216 | WindowSet, WindowUnnamed, | 1217 | WindowSet, WindowUnnamed, |
1217 | #else // !NLS | 1218 | #else // !NLS |
@@ -1219,7 +1220,7 @@ void FluxboxWindow::getWMName(void) { | |||
1219 | #endif // | 1220 | #endif // |
1220 | "Unnamed")); | 1221 | "Unnamed")); |
1221 | } else { | 1222 | } else { |
1222 | client.title = Misc::strdup(i18n->getMessage( | 1223 | client.title = StringUtil::strdup(i18n->getMessage( |
1223 | #ifdef NLS | 1224 | #ifdef NLS |
1224 | WindowSet, WindowUnnamed, | 1225 | WindowSet, WindowUnnamed, |
1225 | #else // !NLS | 1226 | #else // !NLS |
@@ -1263,18 +1264,18 @@ void FluxboxWindow::getWMIconName(void) { | |||
1263 | if ((XmbTextPropertyToTextList(display, &text_prop, | 1264 | if ((XmbTextPropertyToTextList(display, &text_prop, |
1264 | &list, &num) == Success) && | 1265 | &list, &num) == Success) && |
1265 | (num > 0) && *list) { | 1266 | (num > 0) && *list) { |
1266 | client.icon_title = Misc::strdup(*list); | 1267 | client.icon_title = StringUtil::strdup(*list); |
1267 | XFreeStringList(list); | 1268 | XFreeStringList(list); |
1268 | } else | 1269 | } else |
1269 | client.icon_title = Misc::strdup((char *) text_prop.value); | 1270 | client.icon_title = StringUtil::strdup((char *) text_prop.value); |
1270 | } else | 1271 | } else |
1271 | client.icon_title = Misc::strdup((char *) text_prop.value); | 1272 | client.icon_title = StringUtil::strdup((char *) text_prop.value); |
1272 | 1273 | ||
1273 | XFree((char *) text_prop.value); | 1274 | XFree((char *) text_prop.value); |
1274 | } else | 1275 | } else |
1275 | client.icon_title = Misc::strdup(client.title); | 1276 | client.icon_title = StringUtil::strdup(client.title); |
1276 | } else | 1277 | } else |
1277 | client.icon_title = Misc::strdup(client.title); | 1278 | client.icon_title = StringUtil::strdup(client.title); |
1278 | } | 1279 | } |
1279 | 1280 | ||
1280 | 1281 | ||
@@ -2416,7 +2417,7 @@ void FluxboxWindow::redrawLabel(void) { | |||
2416 | GC gc = ((focused) ? screen->getWindowStyle()->l_text_focus_gc : | 2417 | GC gc = ((focused) ? screen->getWindowStyle()->l_text_focus_gc : |
2417 | screen->getWindowStyle()->l_text_unfocus_gc); | 2418 | screen->getWindowStyle()->l_text_unfocus_gc); |
2418 | 2419 | ||
2419 | Misc::DrawString(display, frame.label, gc, | 2420 | DrawUtil::DrawString(display, frame.label, gc, |
2420 | &screen->getWindowStyle()->font, | 2421 | &screen->getWindowStyle()->font, |
2421 | client.title_text_w, frame.label_w, | 2422 | client.title_text_w, frame.label_w, |
2422 | frame.bevel_w, client.title); | 2423 | frame.bevel_w, client.title); |
diff --git a/src/Workspace.cc b/src/Workspace.cc index 5ce3771..ec61e39 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "Window.hh" | 40 | #include "Window.hh" |
41 | #include "Workspace.hh" | 41 | #include "Workspace.hh" |
42 | #include "Windowmenu.hh" | 42 | #include "Windowmenu.hh" |
43 | #include "StringUtil.hh" | ||
43 | 44 | ||
44 | #ifdef HAVE_STDIO_H | 45 | #ifdef HAVE_STDIO_H |
45 | # include <stdio.h> | 46 | # include <stdio.h> |
@@ -49,10 +50,6 @@ | |||
49 | # include <string.h> | 50 | # include <string.h> |
50 | #endif // STDC_HEADERS | 51 | #endif // STDC_HEADERS |
51 | 52 | ||
52 | #define MIN(x,y) ((x < y) ? x : y) | ||
53 | #define MAX(x,y) ((x > y) ? x : y) | ||
54 | |||
55 | |||
56 | Workspace::Workspace(BScreen *scrn, int i) { | 53 | Workspace::Workspace(BScreen *scrn, int i) { |
57 | screen = scrn; | 54 | screen = scrn; |
58 | 55 | ||
@@ -309,7 +306,7 @@ void Workspace::setName(char *new_name) { | |||
309 | delete [] name; | 306 | delete [] name; |
310 | 307 | ||
311 | if (new_name) { | 308 | if (new_name) { |
312 | name = Misc::strdup(new_name); | 309 | name = StringUtil::strdup(new_name); |
313 | } else { | 310 | } else { |
314 | name = new char[128]; | 311 | name = new char[128]; |
315 | sprintf(name, I18n::instance()-> | 312 | sprintf(name, I18n::instance()-> |
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index f9c3b6d..60faf2a 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -32,16 +32,6 @@ | |||
32 | # include "../config.h" | 32 | # include "../config.h" |
33 | #endif // HAVE_CONFIG_H | 33 | #endif // HAVE_CONFIG_H |
34 | 34 | ||
35 | #include <X11/Xlib.h> | ||
36 | #include <X11/Xutil.h> | ||
37 | #include <X11/Xresource.h> | ||
38 | #include <X11/Xatom.h> | ||
39 | #include <X11/keysym.h> | ||
40 | |||
41 | #ifdef SHAPE | ||
42 | #include <X11/extensions/shape.h> | ||
43 | #endif // SHAPE | ||
44 | |||
45 | #include "i18n.hh" | 35 | #include "i18n.hh" |
46 | #include "fluxbox.hh" | 36 | #include "fluxbox.hh" |
47 | #include "Basemenu.hh" | 37 | #include "Basemenu.hh" |
@@ -57,6 +47,18 @@ | |||
57 | #include "Window.hh" | 47 | #include "Window.hh" |
58 | #include "Workspace.hh" | 48 | #include "Workspace.hh" |
59 | #include "Workspacemenu.hh" | 49 | #include "Workspacemenu.hh" |
50 | #include "StringUtil.hh" | ||
51 | |||
52 | #include <X11/Xlib.h> | ||
53 | #include <X11/Xutil.h> | ||
54 | #include <X11/Xresource.h> | ||
55 | #include <X11/Xatom.h> | ||
56 | #include <X11/keysym.h> | ||
57 | |||
58 | #ifdef SHAPE | ||
59 | #include <X11/extensions/shape.h> | ||
60 | #endif // SHAPE | ||
61 | |||
60 | 62 | ||
61 | #ifdef HAVE_STDIO_H | 63 | #ifdef HAVE_STDIO_H |
62 | # include <stdio.h> | 64 | # include <stdio.h> |
@@ -1699,7 +1701,7 @@ char *Fluxbox::getRcFilename() { | |||
1699 | snprintf(dbfile, dbfile_size, "%s/.%s/%s", homedir, RC_PATH, RC_INIT_FILE); | 1701 | snprintf(dbfile, dbfile_size, "%s/.%s/%s", homedir, RC_PATH, RC_INIT_FILE); |
1700 | 1702 | ||
1701 | } else | 1703 | } else |
1702 | dbfile = Misc::strdup(rc_file); | 1704 | dbfile = StringUtil::strdup(rc_file); |
1703 | 1705 | ||
1704 | return dbfile; | 1706 | return dbfile; |
1705 | } | 1707 | } |
@@ -1731,9 +1733,9 @@ void Fluxbox::load_rc(void) { | |||
1731 | if (XrmGetResource(database, "session.menuFile", "Session.MenuFile", | 1733 | if (XrmGetResource(database, "session.menuFile", "Session.MenuFile", |
1732 | &value_type, &value)) { | 1734 | &value_type, &value)) { |
1733 | 1735 | ||
1734 | resource.menu_file = Misc::expandFilename(value.addr); // expand ~ to $HOME | 1736 | resource.menu_file = StringUtil::expandFilename(value.addr); // expand ~ to $HOME |
1735 | } else | 1737 | } else |
1736 | resource.menu_file = Misc::strdup(DEFAULTMENU); | 1738 | resource.menu_file = StringUtil::strdup(DEFAULTMENU); |
1737 | 1739 | ||
1738 | if (resource.titlebar_file) { | 1740 | if (resource.titlebar_file) { |
1739 | delete resource.titlebar_file; | 1741 | delete resource.titlebar_file; |
@@ -1743,9 +1745,9 @@ void Fluxbox::load_rc(void) { | |||
1743 | //get titlebar filename | 1745 | //get titlebar filename |
1744 | if (XrmGetResource(database, "session.titlebarFile", "Session.TitlebarFile", | 1746 | if (XrmGetResource(database, "session.titlebarFile", "Session.TitlebarFile", |
1745 | &value_type, &value)) { | 1747 | &value_type, &value)) { |
1746 | resource.titlebar_file = Misc::expandFilename(value.addr); //expand ~ to home | 1748 | resource.titlebar_file = StringUtil::expandFilename(value.addr); //expand ~ to home |
1747 | } else | 1749 | } else |
1748 | resource.titlebar_file = Misc::strdup(DEFAULTTITLEBAR); | 1750 | resource.titlebar_file = StringUtil::strdup(DEFAULTTITLEBAR); |
1749 | 1751 | ||
1750 | //if already allocated memory for keys_file destroy it | 1752 | //if already allocated memory for keys_file destroy it |
1751 | if (resource.keys_file) { | 1753 | if (resource.keys_file) { |
@@ -1756,9 +1758,9 @@ void Fluxbox::load_rc(void) { | |||
1756 | //get keys filename | 1758 | //get keys filename |
1757 | if (XrmGetResource(database, "session.keyFile", "Session.keyFile", | 1759 | if (XrmGetResource(database, "session.keyFile", "Session.keyFile", |
1758 | &value_type, &value)) { | 1760 | &value_type, &value)) { |
1759 | resource.keys_file = Misc::expandFilename(value.addr); //expand ~ to home | 1761 | resource.keys_file = StringUtil::expandFilename(value.addr); //expand ~ to home |
1760 | } else | 1762 | } else |
1761 | resource.keys_file = Misc::strdup(DEFAULTKEYSFILE); | 1763 | resource.keys_file = StringUtil::strdup(DEFAULTKEYSFILE); |
1762 | 1764 | ||
1763 | 1765 | ||
1764 | if (XrmGetResource(database, "session.iconbar", "Session.Iconbar", | 1766 | if (XrmGetResource(database, "session.iconbar", "Session.Iconbar", |
@@ -1797,9 +1799,9 @@ void Fluxbox::load_rc(void) { | |||
1797 | 1799 | ||
1798 | if (XrmGetResource(database, "session.styleFile", "Session.StyleFile", | 1800 | if (XrmGetResource(database, "session.styleFile", "Session.StyleFile", |
1799 | &value_type, &value)) | 1801 | &value_type, &value)) |
1800 | resource.style_file = Misc::expandFilename(value.addr); | 1802 | resource.style_file = StringUtil::expandFilename(value.addr); |
1801 | else | 1803 | else |
1802 | resource.style_file = Misc::strdup(DEFAULTSTYLE); | 1804 | resource.style_file = StringUtil::strdup(DEFAULTSTYLE); |
1803 | 1805 | ||
1804 | if (resource.root_cmd) { | 1806 | if (resource.root_cmd) { |
1805 | delete [] resource.root_cmd; | 1807 | delete [] resource.root_cmd; |
@@ -1807,7 +1809,7 @@ void Fluxbox::load_rc(void) { | |||
1807 | } | 1809 | } |
1808 | 1810 | ||
1809 | if (XrmGetResource(database, "session.rootCommand", "Session.RootCommand", &value_type, &value)) | 1811 | if (XrmGetResource(database, "session.rootCommand", "Session.RootCommand", &value_type, &value)) |
1810 | resource.root_cmd = Misc::expandFilename(value.addr); | 1812 | resource.root_cmd = StringUtil::expandFilename(value.addr); |
1811 | else | 1813 | else |
1812 | resource.root_cmd = 0; | 1814 | resource.root_cmd = 0; |
1813 | 1815 | ||
@@ -2058,7 +2060,7 @@ void Fluxbox::load_rc(BScreen *screen) { | |||
2058 | sprintf(class_lookup, "Session.Screen%d.WorkspaceNames", screen_number); | 2060 | sprintf(class_lookup, "Session.Screen%d.WorkspaceNames", screen_number); |
2059 | if (XrmGetResource(database, name_lookup, class_lookup, &value_type, | 2061 | if (XrmGetResource(database, name_lookup, class_lookup, &value_type, |
2060 | &value)) { | 2062 | &value)) { |
2061 | char *search = Misc::strdup(value.addr); | 2063 | char *search = StringUtil::strdup(value.addr); |
2062 | 2064 | ||
2063 | int i; | 2065 | int i; |
2064 | for (i = 0; i < screen->getNumberOfWorkspaces(); i++) { | 2066 | for (i = 0; i < screen->getNumberOfWorkspaces(); i++) { |
@@ -2504,7 +2506,7 @@ void Fluxbox::saveStyleFilename(const char *filename) { | |||
2504 | if (resource.style_file) | 2506 | if (resource.style_file) |
2505 | delete [] resource.style_file; | 2507 | delete [] resource.style_file; |
2506 | 2508 | ||
2507 | resource.style_file = Misc::strdup(filename); | 2509 | resource.style_file = StringUtil::strdup(filename); |
2508 | } | 2510 | } |
2509 | 2511 | ||
2510 | 2512 | ||
@@ -2521,7 +2523,7 @@ void Fluxbox::saveMenuFilename(const char *filename) { | |||
2521 | if (! stat(filename, &buf)) { | 2523 | if (! stat(filename, &buf)) { |
2522 | MenuTimestamp *ts = new MenuTimestamp; | 2524 | MenuTimestamp *ts = new MenuTimestamp; |
2523 | 2525 | ||
2524 | ts->filename = Misc::strdup(filename); | 2526 | ts->filename = StringUtil::strdup(filename); |
2525 | ts->timestamp = buf.st_ctime; | 2527 | ts->timestamp = buf.st_ctime; |
2526 | 2528 | ||
2527 | menuTimestamps->insert(ts); | 2529 | menuTimestamps->insert(ts); |