aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--src/FbCommands.cc2
-rw-r--r--src/MenuCreator.cc57
-rw-r--r--src/MenuCreator.hh3
-rw-r--r--src/Screen.cc5
5 files changed, 10 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index a4750fd..8f0a6bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.1 2Changes for 1.1
3*08/06/06:
4 * Allow window menu items in ordinary menus (Mark)
5 MenuCreator.cc/hh
3*08/06/04: 6*08/06/04:
4 * Leave titlebar and handle borders alone with borderless windows (Mark) 7 * Leave titlebar and handle borders alone with borderless windows (Mark)
5 FbWinFrame.cc/hh 8 FbWinFrame.cc/hh
diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index 49f727c..e70cc61 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -80,6 +80,8 @@ void showMenu(const BScreen &screen, FbTk::Menu &menu) {
80 fbmenu->reloadHelper()->checkReload(); 80 fbmenu->reloadHelper()->checkReload();
81 } 81 }
82 82
83 FbMenu::setWindow(FocusControl::focusedFbWindow());
84
83 Window root_ret; // not used 85 Window root_ret; // not used
84 Window window_ret; // not used 86 Window window_ret; // not used
85 87
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc
index 8c3ee6b..34dce94 100644
--- a/src/MenuCreator.cc
+++ b/src/MenuCreator.cc
@@ -321,9 +321,9 @@ void translateMenuItem(FbTk::Parser &parse, ParseItem &pitem,
321 MenuCreator::startEncoding(str_cmd); 321 MenuCreator::startEncoding(str_cmd);
322 } else if (str_key == "endencoding") { 322 } else if (str_key == "endencoding") {
323 MenuCreator::endEncoding(); 323 MenuCreator::endEncoding();
324 } 324 } else if (!MenuCreator::createWindowMenuItem(str_key, str_label, menu)) {
325 else { // ok, if we didn't find any special menu item we try with command parser 325 // if we didn't find any special menu item we try with command parser
326 // we need to attach command with arguments so command parser can parse it 326 // we need to attach command to arguments so command parser can parse it
327 string line = str_key + " " + str_cmd; 327 string line = str_key + " " + str_cmd;
328 FbTk::RefCount<FbTk::Command<void> > command(FbTk::CommandParser<void>::instance().parse(line)); 328 FbTk::RefCount<FbTk::Command<void> > command(FbTk::CommandParser<void>::instance().parse(line));
329 if (*command != 0) { 329 if (*command != 0) {
@@ -347,32 +347,6 @@ void translateMenuItem(FbTk::Parser &parse, ParseItem &pitem,
347 } 347 }
348} 348}
349 349
350
351void parseWindowMenu(FbTk::Parser &parse, FbTk::Menu &menu,
352 FbTk::StringConvertor &labelconvertor,
353 AutoReloadHelper *reloader) {
354
355 ParseItem pitem(&menu);
356 while (!parse.eof()) {
357 pitem.load(parse, labelconvertor);
358 if (MenuCreator::createWindowMenuItem(pitem.key(), pitem.label(), menu))
359 continue;
360
361 if (pitem.key() == "end")
362 return;
363 if (pitem.key() == "submenu") {
364 FbTk::Menu *submenu = MenuCreator::createMenu(pitem.label(), menu.screenNumber());
365 parseWindowMenu(parse, *submenu, labelconvertor, reloader);
366 submenu->updateMenu();
367 menu.insert(pitem.label(), submenu);
368
369 } else { // try non window menu specific stuff
370 translateMenuItem(parse, pitem, labelconvertor, reloader);
371 }
372 }
373}
374
375
376bool getStart(FbMenuParser &parser, string &label, FbTk::StringConvertor &labelconvertor) { 350bool getStart(FbMenuParser &parser, string &label, FbTk::StringConvertor &labelconvertor) {
377 ParseItem pitem(0); 351 ParseItem pitem(0);
378 while (!parser.eof()) { 352 while (!parser.eof()) {
@@ -434,31 +408,6 @@ bool MenuCreator::createFromFile(const string &filename,
434 return true; 408 return true;
435} 409}
436 410
437
438void MenuCreator::createWindowMenuFromFile(const string &filename,
439 FbTk::Menu &inject_into,
440 AutoReloadHelper *reloader) {
441 string real_filename = FbTk::StringUtil::expandFilename(filename);
442 FbMenuParser parser(real_filename);
443 if (!parser.isLoaded())
444 return;
445
446 string label;
447
448 startFile();
449 if (!getStart(parser, label, m_stringconvertor)) {
450 endFile();
451 return;
452 }
453
454 if (reloader)
455 reloader->addFile(real_filename);
456
457 parseWindowMenu(parser, inject_into, m_stringconvertor, reloader);
458 endFile();
459}
460
461
462FbMenu *MenuCreator::createMenuType(const string &type, int screen_num) { 411FbMenu *MenuCreator::createMenuType(const string &type, int screen_num) {
463 BScreen *screen = Fluxbox::instance()->findScreen(screen_num); 412 BScreen *screen = Fluxbox::instance()->findScreen(screen_num);
464 if (screen == 0) 413 if (screen == 0)
diff --git a/src/MenuCreator.hh b/src/MenuCreator.hh
index 8fb0242..a9fb649 100644
--- a/src/MenuCreator.hh
+++ b/src/MenuCreator.hh
@@ -43,9 +43,6 @@ public:
43 FbTk::Menu &inject_into, 43 FbTk::Menu &inject_into,
44 FbTk::AutoReloadHelper *reloader = NULL, 44 FbTk::AutoReloadHelper *reloader = NULL,
45 bool begin = true); 45 bool begin = true);
46 static void createWindowMenuFromFile(const std::string &filename,
47 FbTk::Menu &inject_into,
48 FbTk::AutoReloadHelper *reloader);
49 static bool createWindowMenuItem(const std::string &type, const std::string &label, 46 static bool createWindowMenuItem(const std::string &type, const std::string &label,
50 FbTk::Menu &inject_into); 47 FbTk::Menu &inject_into);
51 48
diff --git a/src/Screen.cc b/src/Screen.cc
index b4905f2..1525db6 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -1527,9 +1527,8 @@ void BScreen::rereadWindowMenu() {
1527 1527
1528 m_windowmenu->removeAll(); 1528 m_windowmenu->removeAll();
1529 if (!windowMenuFilename().empty()) 1529 if (!windowMenuFilename().empty())
1530 MenuCreator::createWindowMenuFromFile(windowMenuFilename(), 1530 MenuCreator::createFromFile(windowMenuFilename(), *m_windowmenu,
1531 *m_windowmenu, 1531 m_windowmenu->reloadHelper());
1532 m_windowmenu->reloadHelper());
1533 1532
1534 if (m_windowmenu->numberOfItems() == 0) { 1533 if (m_windowmenu->numberOfItems() == 0) {
1535 const char *defaults[] = { 1534 const char *defaults[] = {