summaryrefslogtreecommitdiff
path: root/src/WorkspaceMenu.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2005-07-04 18:19:09 (GMT)
committerfluxgen <fluxgen>2005-07-04 18:19:09 (GMT)
commit3626faea73a7e033e14ec2d06bdcb2b180d06172 (patch)
treee2f3cdc6928eb69fbd66f64a5ab82f5a56aa31cd /src/WorkspaceMenu.cc
parent1727656e0a36cd9095e173dfa43200ed14c178d1 (diff)
downloadfluxbox_lack-3626faea73a7e033e14ec2d06bdcb2b180d06172.zip
fluxbox_lack-3626faea73a7e033e14ec2d06bdcb2b180d06172.tar.bz2
cleaning, change getCount to numberOfWorkspaces
Diffstat (limited to 'src/WorkspaceMenu.cc')
-rw-r--r--src/WorkspaceMenu.cc29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/WorkspaceMenu.cc b/src/WorkspaceMenu.cc
index 8642cc2..bb8ae4b 100644
--- a/src/WorkspaceMenu.cc
+++ b/src/WorkspaceMenu.cc
@@ -29,9 +29,11 @@
29#include "WorkspaceCmd.hh" 29#include "WorkspaceCmd.hh"
30#include "MenuCreator.hh" 30#include "MenuCreator.hh"
31#include "CommandParser.hh" 31#include "CommandParser.hh"
32#include "FbCommands.hh"
32 33
33#include "FbTk/I18n.hh" 34#include "FbTk/I18n.hh"
34#include "FbTk/SimpleCommand.hh" 35#include "FbTk/SimpleCommand.hh"
36#include "FbTk/MacroCommand.hh"
35#include "FbTk/RefCount.hh" 37#include "FbTk/RefCount.hh"
36#include "FbTk/MenuItem.hh" 38#include "FbTk/MenuItem.hh"
37#include "FbTk/MenuSeparator.hh" 39#include "FbTk/MenuSeparator.hh"
@@ -71,7 +73,7 @@ void WorkspaceMenu::update(FbTk::Subject *subj) {
71 BScreen &screen = screen_subj.screen(); 73 BScreen &screen = screen_subj.screen();
72 if (subj == &screen.currentWorkspaceSig()) { 74 if (subj == &screen.currentWorkspaceSig()) {
73 FbTk::MenuItem *item = 0; 75 FbTk::MenuItem *item = 0;
74 for (unsigned int i = 0; i < screen.getCount(); ++i) { 76 for (unsigned int i = 0; i < screen.numberOfWorkspaces(); ++i) {
75 item = find(i + IDX_AFTER_ICONS); 77 item = find(i + IDX_AFTER_ICONS);
76 if (item && item->isSelected()) { 78 if (item && item->isSelected()) {
77 setItemSelected(i + IDX_AFTER_ICONS, false); 79 setItemSelected(i + IDX_AFTER_ICONS, false);
@@ -88,7 +90,7 @@ void WorkspaceMenu::update(FbTk::Subject *subj) {
88 } 90 }
89 // for each workspace add workspace name and it's menu 91 // for each workspace add workspace name and it's menu
90 // to our workspace menu 92 // to our workspace menu
91 for (size_t workspace = 0; workspace < screen.getCount(); 93 for (size_t workspace = 0; workspace < screen.numberOfWorkspaces();
92 ++workspace) { 94 ++workspace) {
93 Workspace *wkspc = screen.getWorkspace(workspace); 95 Workspace *wkspc = screen.getWorkspace(workspace);
94 wkspc->menu().setInternalMenu(); 96 wkspc->menu().setInternalMenu();
@@ -121,7 +123,7 @@ void WorkspaceMenu::init(BScreen &screen) {
121 MenuCreator::createMenuType("iconmenu", screen.screenNumber())); 123 MenuCreator::createMenuType("iconmenu", screen.screenNumber()));
122 insert(new FbTk::MenuSeparator()); 124 insert(new FbTk::MenuSeparator());
123 // for each workspace add workspace name and it's menu to our workspace menu 125 // for each workspace add workspace name and it's menu to our workspace menu
124 for (size_t workspace = 0; workspace < screen.getCount(); ++workspace) { 126 for (size_t workspace = 0; workspace < screen.numberOfWorkspaces(); ++workspace) {
125 Workspace *wkspc = screen.getWorkspace(workspace); 127 Workspace *wkspc = screen.getWorkspace(workspace);
126 wkspc->menu().setInternalMenu(); 128 wkspc->menu().setInternalMenu();
127 FbTk::MultiButtonMenuItem* mb_menu = new FbTk::MultiButtonMenuItem(5, 129 FbTk::MultiButtonMenuItem* mb_menu = new FbTk::MultiButtonMenuItem(5,
@@ -133,17 +135,30 @@ void WorkspaceMenu::init(BScreen &screen) {
133 } 135 }
134 setItemSelected(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS, true); 136 setItemSelected(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS, true);
135 137
136 RefCount<Command> new_workspace(new SimpleCommand<BScreen, int>(screen, &BScreen::addWorkspace)); 138
137 RefCount<Command> remove_last(new SimpleCommand<BScreen, int>(screen, &BScreen::removeLastWorkspace)); 139 RefCount<Command> saverc_cmd(new FbCommands::SaveResources());
140
141 MacroCommand *new_workspace_macro = new MacroCommand();
142 RefCount<Command> addworkspace(new SimpleCommand<BScreen, int>(screen, &BScreen::addWorkspace));
143 new_workspace_macro->add(addworkspace);
144 new_workspace_macro->add(saverc_cmd);
145 RefCount<Command> new_workspace_cmd(new_workspace_macro);
146
147 MacroCommand *remove_workspace_macro = new MacroCommand();
148 RefCount<Command> rmworkspace(new SimpleCommand<BScreen, int>(screen, &BScreen::removeLastWorkspace));
149 remove_workspace_macro->add(rmworkspace);
150 remove_workspace_macro->add(saverc_cmd);
151 RefCount<Command> remove_last_cmd(remove_workspace_macro);
152
138 RefCount<Command> start_edit(CommandParser::instance().parseLine("setworkspacenamedialog")); 153 RefCount<Command> start_edit(CommandParser::instance().parseLine("setworkspacenamedialog"));
139 154
140 insert(new FbTk::MenuSeparator()); 155 insert(new FbTk::MenuSeparator());
141 insert(_FBTEXT(Workspace, NewWorkspace, "New Workspace", "Add a new workspace"), 156 insert(_FBTEXT(Workspace, NewWorkspace, "New Workspace", "Add a new workspace"),
142 new_workspace); 157 new_workspace_cmd);
143 insert(_FBTEXT(Toolbar, EditWkspcName, "Edit current workspace name", "Edit current workspace name"), 158 insert(_FBTEXT(Toolbar, EditWkspcName, "Edit current workspace name", "Edit current workspace name"),
144 start_edit); 159 start_edit);
145 insert(_FBTEXT(Workspace, RemoveLast, "Remove Last", "Remove the last workspace"), 160 insert(_FBTEXT(Workspace, RemoveLast, "Remove Last", "Remove the last workspace"),
146 remove_last); 161 remove_last_cmd);
147 162
148 updateMenu(); 163 updateMenu();
149} 164}