diff options
author | fluxgen <fluxgen> | 2002-12-02 23:19:16 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-12-02 23:19:16 (GMT) |
commit | 29c647645b83c0f4a570305ee1daaa77bbd5b40a (patch) | |
tree | 234e795d33cdf32e7145392f1218a958b970ba03 | |
parent | 2b617dcea2de634f87b48c88c899394e149bcc02 (diff) | |
download | fluxbox_pavel-29c647645b83c0f4a570305ee1daaa77bbd5b40a.zip fluxbox_pavel-29c647645b83c0f4a570305ee1daaa77bbd5b40a.tar.bz2 |
using dirhelper and fixed toolbar reconfigure
-rw-r--r-- | src/Screen.cc | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index ece6796..ea2638a 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Screen.cc,v 1.89 2002/12/01 13:41:58 rathnor Exp $ | 25 | // $Id: Screen.cc,v 1.90 2002/12/02 23:19:16 fluxgen Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -39,6 +39,7 @@ | |||
39 | #include "Iconmenu.hh" | 39 | #include "Iconmenu.hh" |
40 | #include "StringUtil.hh" | 40 | #include "StringUtil.hh" |
41 | #include "Netizen.hh" | 41 | #include "Netizen.hh" |
42 | #include "DirHelper.hh" | ||
42 | 43 | ||
43 | //use GNU extensions | 44 | //use GNU extensions |
44 | #ifndef _GNU_SOURCE | 45 | #ifndef _GNU_SOURCE |
@@ -295,6 +296,9 @@ BScreen::BScreen(ResourceManager &rm, | |||
295 | fluxbox->getStyleFilename(), getRootCommand().c_str()); | 296 | fluxbox->getStyleFilename(), getRootCommand().c_str()); |
296 | 297 | ||
297 | theme->reconfigure(*resource.antialias); | 298 | theme->reconfigure(*resource.antialias); |
299 | // set database for new Theme Engine | ||
300 | FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename()); | ||
301 | |||
298 | // special case for tab rotated | 302 | // special case for tab rotated |
299 | if (*resource.tab_rotate_vertical && | 303 | if (*resource.tab_rotate_vertical && |
300 | ( *resource.tab_placement == Tab::PLEFT || *resource.tab_placement == Tab::PRIGHT)) { | 304 | ( *resource.tab_placement == Tab::PLEFT || *resource.tab_placement == Tab::PRIGHT)) { |
@@ -519,11 +523,15 @@ void BScreen::reconfigure() { | |||
519 | #endif // DEBUG | 523 | #endif // DEBUG |
520 | Fluxbox::instance()->loadRootCommand(this); | 524 | Fluxbox::instance()->loadRootCommand(this); |
521 | theme->setRootCommand(getRootCommand()); | 525 | theme->setRootCommand(getRootCommand()); |
522 | theme->load(Fluxbox::instance()->getStyleFilename()); | 526 | const string &filename = Fluxbox::instance()->getStyleFilename(); |
527 | theme->load(filename.c_str()); // old theme engine | ||
528 | FbTk::ThemeManager::instance().load(filename.c_str()); // new theme engine | ||
523 | theme->reconfigure(*resource.antialias); | 529 | theme->reconfigure(*resource.antialias); |
530 | |||
524 | // special case for tab rotated | 531 | // special case for tab rotated |
525 | if (*resource.tab_rotate_vertical && | 532 | if (*resource.tab_rotate_vertical && |
526 | ( *resource.tab_placement == Tab::PLEFT || *resource.tab_placement == Tab::PRIGHT)) { | 533 | ( *resource.tab_placement == Tab::PLEFT || |
534 | *resource.tab_placement == Tab::PRIGHT)) { | ||
527 | theme->getWindowStyle().tab.font.rotate(90); | 535 | theme->getWindowStyle().tab.font.rotate(90); |
528 | } else { | 536 | } else { |
529 | theme->getWindowStyle().tab.font.rotate(0); | 537 | theme->getWindowStyle().tab.font.rotate(0); |
@@ -532,11 +540,12 @@ void BScreen::reconfigure() { | |||
532 | I18n *i18n = I18n::instance(); | 540 | I18n *i18n = I18n::instance(); |
533 | 541 | ||
534 | const char *s = i18n->getMessage( | 542 | const char *s = i18n->getMessage( |
535 | FBNLS::ScreenSet, FBNLS::ScreenPositionLength, | 543 | FBNLS::ScreenSet, |
536 | "W: 0000 x H: 0000"); | 544 | FBNLS::ScreenPositionLength, |
545 | "W: 0000 x H: 0000"); | ||
537 | int l = strlen(s); | 546 | int l = strlen(s); |
538 | 547 | ||
539 | //TODO: repeat from somewhere else? | 548 | //TODO: repeated from somewhere else? |
540 | geom_h = theme->getWindowStyle().font.height(); | 549 | geom_h = theme->getWindowStyle().font.height(); |
541 | geom_w = theme->getWindowStyle().font.textWidth(s, l); | 550 | geom_w = theme->getWindowStyle().font.textWidth(s, l); |
542 | geom_w += getBevelWidth()*2; | 551 | geom_w += getBevelWidth()*2; |
@@ -591,8 +600,10 @@ void BScreen::reconfigure() { | |||
591 | 600 | ||
592 | 601 | ||
593 | m_toolbar->reconfigure(); | 602 | m_toolbar->reconfigure(); |
594 | 603 | if (m_toolbar->theme().font().isAntialias() != *resource.antialias) | |
595 | 604 | m_toolbar->theme().font().setAntialias(*resource.antialias); | |
605 | m_toolbar->setPlacement(*resource.toolbar_placement); | ||
606 | |||
596 | if (m_slit.get()) | 607 | if (m_slit.get()) |
597 | m_slit->reconfigure(); | 608 | m_slit->reconfigure(); |
598 | 609 | ||
@@ -1450,7 +1461,8 @@ bool BScreen::parseMenuFile(ifstream &file, Rootmenu *menu, int &row) { | |||
1450 | " error, no directory defined\n")); | 1461 | " error, no directory defined\n")); |
1451 | cerr<<"Row: "<<row<<endl; | 1462 | cerr<<"Row: "<<row<<endl; |
1452 | } else { // else 'y' | 1463 | } else { // else 'y' |
1453 | createStyleMenu(menu, newmenu, str_label.c_str(), (newmenu) ? str_cmd.c_str() : str_label.c_str()); | 1464 | createStyleMenu(menu, newmenu, str_label.c_str(), |
1465 | (newmenu) ? str_cmd.c_str() : str_label.c_str()); | ||
1454 | } // end of else 'y' | 1466 | } // end of else 'y' |
1455 | } // end of stylesdir | 1467 | } // end of stylesdir |
1456 | else if (str_key == "workspaces") { | 1468 | else if (str_key == "workspaces") { |
@@ -1487,18 +1499,18 @@ void BScreen::createStyleMenu(Rootmenu *menu, bool newmenu, const char *label, c | |||
1487 | else | 1499 | else |
1488 | stylesmenu = menu; | 1500 | stylesmenu = menu; |
1489 | 1501 | ||
1490 | DIR *d = opendir(stylesdir.c_str()); | 1502 | DirHelper d(stylesdir.c_str()); |
1491 | int entries = 0; | 1503 | int entries = 0; |
1492 | struct dirent *p; | 1504 | struct dirent *p; |
1493 | 1505 | ||
1494 | // get the total number of directory entries | 1506 | // get the total number of directory entries |
1495 | while ((p = readdir(d))) entries++; | 1507 | while ((p = d.read())) entries++; |
1496 | 1508 | ||
1497 | rewinddir(d); | 1509 | d.rewind(); |
1498 | 1510 | ||
1499 | char **ls = new char* [entries]; | 1511 | char **ls = new char* [entries]; |
1500 | int index = 0; | 1512 | int index = 0; |
1501 | while ((p = readdir(d))) | 1513 | while ((p = d.read())) |
1502 | ls[index++] = StringUtil::strdup(p->d_name); | 1514 | ls[index++] = StringUtil::strdup(p->d_name); |
1503 | 1515 | ||
1504 | qsort(ls, entries, sizeof(char *), dcmp); | 1516 | qsort(ls, entries, sizeof(char *), dcmp); |