aboutsummaryrefslogtreecommitdiff
path: root/src/MenuCreator.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2006-05-20 15:08:14 (GMT)
committersimonb <simonb>2006-05-20 15:08:14 (GMT)
commit0861f3a9073ccd016302af26ff992fa19331a02d (patch)
treef1a2276449a5fc9b27f2d1afa5ffff4410141345 /src/MenuCreator.cc
parent5ddabb0f390f69db793b5a6e40be9f94b8f83136 (diff)
downloadfluxbox-0861f3a9073ccd016302af26ff992fa19331a02d.zip
fluxbox-0861f3a9073ccd016302af26ff992fa19331a02d.tar.bz2
improve native language handling, move messages and menu labels to
FbTk::FbString
Diffstat (limited to 'src/MenuCreator.cc')
-rw-r--r--src/MenuCreator.cc48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc
index f920321..850c816 100644
--- a/src/MenuCreator.cc
+++ b/src/MenuCreator.cc
@@ -186,7 +186,7 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem) {
186 if (str_key == "end") { 186 if (str_key == "end") {
187 return; 187 return;
188 } else if (str_key == "nop") { 188 } else if (str_key == "nop") {
189 int menuSize = menu.insert(str_label.c_str()); 189 int menuSize = menu.insert(str_label);
190 menu.setItemEnabled(menuSize-1, false); 190 menu.setItemEnabled(menuSize-1, false);
191 } else if (str_key == "icons") { 191 } else if (str_key == "icons") {
192 FbTk::Menu *submenu = MenuCreator::createMenuType("iconmenu", menu.screenNumber()); 192 FbTk::Menu *submenu = MenuCreator::createMenuType("iconmenu", menu.screenNumber());
@@ -195,13 +195,13 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem) {
195 if (str_label.empty()) 195 if (str_label.empty())
196 menu.insert(_FBTEXT(Menu, Icons, "Icons", "Iconic windows menu title")); 196 menu.insert(_FBTEXT(Menu, Icons, "Icons", "Iconic windows menu title"));
197 else 197 else
198 menu.insert(str_label.c_str(), submenu); 198 menu.insert(str_label, submenu);
199 } else if (str_key == "exit") { // exit 199 } else if (str_key == "exit") { // exit
200 FbTk::RefCount<FbTk::Command> exit_cmd(CommandParser::instance().parseLine("exit")); 200 FbTk::RefCount<FbTk::Command> exit_cmd(CommandParser::instance().parseLine("exit"));
201 if (str_label.empty()) 201 if (str_label.empty())
202 menu.insert(_FBTEXT(Menu, Exit, "Exit", "Exit Command"), exit_cmd); 202 menu.insert(_FBTEXT(Menu, Exit, "Exit", "Exit Command"), exit_cmd);
203 else 203 else
204 menu.insert(str_label.c_str(), exit_cmd); 204 menu.insert(str_label, exit_cmd);
205 } else if (str_key == "exec") { 205 } else if (str_key == "exec") {
206 // execute and hide menu 206 // execute and hide menu
207 using namespace FbTk; 207 using namespace FbTk;
@@ -212,7 +212,7 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem) {
212 exec_and_hide->add(hide_menu); 212 exec_and_hide->add(hide_menu);
213 exec_and_hide->add(exec_cmd); 213 exec_and_hide->add(exec_cmd);
214 RefCount<Command> exec_and_hide_cmd(exec_and_hide); 214 RefCount<Command> exec_and_hide_cmd(exec_and_hide);
215 menu.insert(str_label.c_str(), exec_and_hide_cmd); 215 menu.insert(str_label, exec_and_hide_cmd);
216 } else if (str_key == "macrocmd") { 216 } else if (str_key == "macrocmd") {
217 using namespace FbTk; 217 using namespace FbTk;
218 RefCount<Command> macro_cmd(CommandParser::instance().parseLine("macrocmd " + str_cmd)); 218 RefCount<Command> macro_cmd(CommandParser::instance().parseLine("macrocmd " + str_cmd));
@@ -222,13 +222,13 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem) {
222 exec_and_hide->add(hide_menu); 222 exec_and_hide->add(hide_menu);
223 exec_and_hide->add(macro_cmd); 223 exec_and_hide->add(macro_cmd);
224 RefCount<Command> exec_and_hide_cmd(exec_and_hide); 224 RefCount<Command> exec_and_hide_cmd(exec_and_hide);
225 menu.insert(str_label.c_str(), exec_and_hide_cmd); 225 menu.insert(str_label, exec_and_hide_cmd);
226 } else if (str_key == "style") { // style 226 } else if (str_key == "style") { // style
227 menu.insert(new StyleMenuItem(str_label, str_cmd)); 227 menu.insert(new StyleMenuItem(str_label, str_cmd));
228 } else if (str_key == "config") { 228 } else if (str_key == "config") {
229 BScreen *screen = Fluxbox::instance()->findScreen(screen_number); 229 BScreen *screen = Fluxbox::instance()->findScreen(screen_number);
230 if (screen != 0) 230 if (screen != 0)
231 menu.insert(str_label.c_str(), &screen->configMenu()); 231 menu.insert(str_label, &screen->configMenu());
232 } // end of config 232 } // end of config
233 else if (str_key == "include") { // include 233 else if (str_key == "include") { // include
234 234
@@ -276,13 +276,13 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem) {
276 return; 276 return;
277 277
278 if (str_cmd.size()) 278 if (str_cmd.size())
279 submenu->setLabel(str_cmd.c_str()); 279 submenu->setLabel(str_cmd);
280 else 280 else
281 submenu->setLabel(str_label.c_str()); 281 submenu->setLabel(str_label);
282 282
283 parseMenu(parse, *submenu); 283 parseMenu(parse, *submenu);
284 submenu->updateMenu(); 284 submenu->updateMenu();
285 menu.insert(str_label.c_str(), submenu); 285 menu.insert(str_label, submenu);
286 // save to screen list so we can delete it later 286 // save to screen list so we can delete it later
287 BScreen *screen = Fluxbox::instance()->findScreen(screen_number); 287 BScreen *screen = Fluxbox::instance()->findScreen(screen_number);
288 if (screen != 0) 288 if (screen != 0)
@@ -306,7 +306,7 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem) {
306 BScreen *screen = Fluxbox::instance()->findScreen(screen_number); 306 BScreen *screen = Fluxbox::instance()->findScreen(screen_number);
307 if (screen != 0) { 307 if (screen != 0) {
308 screen->workspaceMenu().setInternalMenu(); 308 screen->workspaceMenu().setInternalMenu();
309 menu.insert(str_label.c_str(), &screen->workspaceMenu()); 309 menu.insert(str_label, &screen->workspaceMenu());
310 } 310 }
311 } else if (str_key == "separator") { 311 } else if (str_key == "separator") {
312 menu.insert(new FbTk::MenuSeparator()); 312 menu.insert(new FbTk::MenuSeparator());
@@ -326,13 +326,13 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem) {
326 return; 326 return;
327 } 327 }
328 } 328 }
329 menu.insert(str_label.c_str(), command); 329 menu.insert(str_label, command);
330 } 330 }
331 } 331 }
332 if (menu.numberOfItems() != 0) { 332 if (menu.numberOfItems() != 0) {
333 FbTk::MenuItem *item = menu.find(menu.numberOfItems() - 1); 333 FbTk::MenuItem *item = menu.find(menu.numberOfItems() - 1);
334 if (item != 0 && !pitem.icon().empty()) 334 if (item != 0 && !pitem.icon().empty())
335 item->setIcon(pitem.icon().c_str(), menu.screenNumber()); 335 item->setIcon(pitem.icon(), menu.screenNumber());
336 } 336 }
337} 337}
338 338
@@ -351,7 +351,7 @@ static void parseWindowMenu(Parser &parse, FbTk::Menu &menu) {
351 FbTk::Menu *submenu = MenuCreator::createMenu(pitem.label(), menu.screenNumber()); 351 FbTk::Menu *submenu = MenuCreator::createMenu(pitem.label(), menu.screenNumber());
352 parseWindowMenu(parse, *submenu); 352 parseWindowMenu(parse, *submenu);
353 submenu->updateMenu(); 353 submenu->updateMenu();
354 menu.insert(pitem.label().c_str(), submenu); 354 menu.insert(pitem.label(), submenu);
355 355
356 } else { // try non window menu specific stuff 356 } else { // try non window menu specific stuff
357 translateMenuItem(parse, pitem); 357 translateMenuItem(parse, pitem);
@@ -368,7 +368,7 @@ FbTk::Menu *MenuCreator::createMenu(const std::string &label, int screen_number)
368 screen->imageControl(), 368 screen->imageControl(),
369 *screen->layerManager().getLayer(Layer::MENU)); 369 *screen->layerManager().getLayer(Layer::MENU));
370 if (!label.empty()) 370 if (!label.empty())
371 menu->setLabel(label.c_str()); 371 menu->setLabel(label);
372 372
373 return menu; 373 return menu;
374} 374}
@@ -490,7 +490,7 @@ bool MenuCreator::createWindowMenuItem(const std::string &type,
490 490
491 if (type == "shade") { 491 if (type == "shade") {
492 RefCmd shade_cmd(new WindowCmd<void>(&FluxboxWindow::shade)); 492 RefCmd shade_cmd(new WindowCmd<void>(&FluxboxWindow::shade));
493 menu.insert(label.empty()?_FBTEXT(Windowmenu, Shade, "Shade", "Shade the window"):label.c_str(), shade_cmd); 493 menu.insert(label.empty()?_FBTEXT(Windowmenu, Shade, "Shade", "Shade the window"):label, shade_cmd);
494 } else if (type == "maximize") { 494 } else if (type == "maximize") {
495 RefCmd maximize_cmd(new WindowCmd<void>(&FluxboxWindow::maximizeFull)); 495 RefCmd maximize_cmd(new WindowCmd<void>(&FluxboxWindow::maximizeFull));
496 RefCmd maximize_vert_cmd(new WindowCmd<void>(&FluxboxWindow::maximizeVertical)); 496 RefCmd maximize_vert_cmd(new WindowCmd<void>(&FluxboxWindow::maximizeVertical));
@@ -500,7 +500,7 @@ bool MenuCreator::createWindowMenuItem(const std::string &type,
500 label.empty()? 500 label.empty()?
501 _FBTEXT(Windowmenu, Maximize, 501 _FBTEXT(Windowmenu, Maximize,
502 "Maximize", "Maximize the window"): 502 "Maximize", "Maximize the window"):
503 label.c_str()); 503 label);
504 // create maximize item with: 504 // create maximize item with:
505 // button1: Maximize normal 505 // button1: Maximize normal
506 // button2: Maximize Vertical 506 // button2: Maximize Vertical
@@ -514,37 +514,37 @@ bool MenuCreator::createWindowMenuItem(const std::string &type,
514 menu.insert(label.empty() ? 514 menu.insert(label.empty() ?
515 _FBTEXT(Windowmenu, Iconify, 515 _FBTEXT(Windowmenu, Iconify,
516 "Iconify", "Iconify the window") : 516 "Iconify", "Iconify the window") :
517 label.c_str(), iconify_cmd); 517 label, iconify_cmd);
518 } else if (type == "close") { 518 } else if (type == "close") {
519 RefCmd close_cmd(new WindowCmd<void>(&FluxboxWindow::close)); 519 RefCmd close_cmd(new WindowCmd<void>(&FluxboxWindow::close));
520 menu.insert(label.empty() ? 520 menu.insert(label.empty() ?
521 _FBTEXT(Windowmenu, Close, 521 _FBTEXT(Windowmenu, Close,
522 "Close", "Close the window") : 522 "Close", "Close the window") :
523 label.c_str(), close_cmd); 523 label, close_cmd);
524 } else if (type == "kill" || type == "killwindow") { 524 } else if (type == "kill" || type == "killwindow") {
525 RefCmd kill_cmd(new WindowCmd<void>(&FluxboxWindow::kill)); 525 RefCmd kill_cmd(new WindowCmd<void>(&FluxboxWindow::kill));
526 menu.insert(label.empty() ? 526 menu.insert(label.empty() ?
527 _FBTEXT(Windowmenu, Kill, 527 _FBTEXT(Windowmenu, Kill,
528 "Kill", "Kill the window"): 528 "Kill", "Kill the window"):
529 label.c_str(), kill_cmd); 529 label, kill_cmd);
530 } else if (type == "lower") { 530 } else if (type == "lower") {
531 RefCmd lower_cmd(new WindowCmd<void>(&FluxboxWindow::lower)); 531 RefCmd lower_cmd(new WindowCmd<void>(&FluxboxWindow::lower));
532 menu.insert( label.empty() ? 532 menu.insert( label.empty() ?
533 _FBTEXT(Windowmenu, Lower, 533 _FBTEXT(Windowmenu, Lower,
534 "Lower", "Lower the window"): 534 "Lower", "Lower the window"):
535 label.c_str(), lower_cmd); 535 label, lower_cmd);
536 } else if (type == "raise") { 536 } else if (type == "raise") {
537 RefCmd raise_cmd(new WindowCmd<void>(&FluxboxWindow::raise)); 537 RefCmd raise_cmd(new WindowCmd<void>(&FluxboxWindow::raise));
538 menu.insert(label.empty() ? 538 menu.insert(label.empty() ?
539 _FBTEXT(Windowmenu, Raise, 539 _FBTEXT(Windowmenu, Raise,
540 "Raise", "Raise the window"): 540 "Raise", "Raise the window"):
541 label.c_str(), raise_cmd); 541 label, raise_cmd);
542 } else if (type == "stick") { 542 } else if (type == "stick") {
543 RefCmd stick_cmd(new WindowCmd<void>(&FluxboxWindow::stick)); 543 RefCmd stick_cmd(new WindowCmd<void>(&FluxboxWindow::stick));
544 menu.insert(label.empty() ? 544 menu.insert(label.empty() ?
545 _FBTEXT(Windowmenu, Stick, 545 _FBTEXT(Windowmenu, Stick,
546 "Stick", "Stick the window"): 546 "Stick", "Stick the window"):
547 label.c_str(), stick_cmd); 547 label, stick_cmd);
548 } else if (type == "extramenus") { 548 } else if (type == "extramenus") {
549 BScreen *screen = Fluxbox::instance()->findScreen(menu.screenNumber()); 549 BScreen *screen = Fluxbox::instance()->findScreen(menu.screenNumber());
550 BScreen::ExtraMenus::iterator it = screen->extraWindowMenus().begin(); 550 BScreen::ExtraMenus::iterator it = screen->extraWindowMenus().begin();
@@ -556,7 +556,7 @@ bool MenuCreator::createWindowMenuItem(const std::string &type,
556 556
557 } else if (type == "sendto") { 557 } else if (type == "sendto") {
558 menu.insert(label.empty() ? _FBTEXT(Windowmenu, SendTo, "Send To...", "Send to menu item name"): 558 menu.insert(label.empty() ? _FBTEXT(Windowmenu, SendTo, "Send To...", "Send to menu item name"):
559 label.c_str(), new SendToMenu(*Fluxbox::instance()->findScreen(menu.screenNumber()))); 559 label, new SendToMenu(*Fluxbox::instance()->findScreen(menu.screenNumber())));
560 } else if (type == "layer") { 560 } else if (type == "layer") {
561 BScreen *screen = Fluxbox::instance()->findScreen(menu.screenNumber()); 561 BScreen *screen = Fluxbox::instance()->findScreen(menu.screenNumber());
562 if (screen == 0) 562 if (screen == 0)
@@ -570,7 +570,7 @@ bool MenuCreator::createWindowMenuItem(const std::string &type,
570 &context, 570 &context,
571 false); 571 false);
572 submenu->disableTitle(); 572 submenu->disableTitle();
573 menu.insert(label.empty()?_FBTEXT(Windowmenu, Layer, "Layer ...", "Layer menu"):label.c_str(), submenu); 573 menu.insert(label.empty()?_FBTEXT(Windowmenu, Layer, "Layer ...", "Layer menu"):label, submenu);
574 574
575 575
576 } else if (type == "separator") { 576 } else if (type == "separator") {