diff options
author | fluxgen <fluxgen> | 2005-07-04 18:19:09 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2005-07-04 18:19:09 (GMT) |
commit | 3626faea73a7e033e14ec2d06bdcb2b180d06172 (patch) | |
tree | e2f3cdc6928eb69fbd66f64a5ab82f5a56aa31cd /src | |
parent | 1727656e0a36cd9095e173dfa43200ed14c178d1 (diff) | |
download | fluxbox_pavel-3626faea73a7e033e14ec2d06bdcb2b180d06172.zip fluxbox_pavel-3626faea73a7e033e14ec2d06bdcb2b180d06172.tar.bz2 |
cleaning, change getCount to numberOfWorkspaces
Diffstat (limited to 'src')
-rw-r--r-- | src/IconMenu.cc | 4 | ||||
-rw-r--r-- | src/MenuCreator.cc | 4 | ||||
-rw-r--r-- | src/WorkspaceCmd.cc | 2 | ||||
-rw-r--r-- | src/WorkspaceMenu.cc | 29 |
4 files changed, 27 insertions, 12 deletions
diff --git a/src/IconMenu.cc b/src/IconMenu.cc index 195f79b..6fbe0a6 100644 --- a/src/IconMenu.cc +++ b/src/IconMenu.cc | |||
@@ -32,8 +32,8 @@ | |||
32 | 32 | ||
33 | static void updateItems(FbTk::Menu &menu, BScreen &screen) { | 33 | static void updateItems(FbTk::Menu &menu, BScreen &screen) { |
34 | menu.removeAll(); | 34 | menu.removeAll(); |
35 | BScreen::Icons::iterator it = screen.getIconList().begin(); | 35 | BScreen::Icons::iterator it = screen.iconList().begin(); |
36 | BScreen::Icons::iterator it_end = screen.getIconList().end(); | 36 | BScreen::Icons::iterator it_end = screen.iconList().end(); |
37 | for (; it != it_end; ++it) { | 37 | for (; it != it_end; ++it) { |
38 | FluxboxWindow::ClientList::iterator client_it = (*it)->clientList().begin(); | 38 | FluxboxWindow::ClientList::iterator client_it = (*it)->clientList().begin(); |
39 | FluxboxWindow::ClientList::iterator client_it_end = (*it)->clientList().end(); | 39 | FluxboxWindow::ClientList::iterator client_it_end = (*it)->clientList().end(); |
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc index 0bbd14f..cb1f33c 100644 --- a/src/MenuCreator.cc +++ b/src/MenuCreator.cc | |||
@@ -290,8 +290,8 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem) { | |||
290 | else if (str_key == "workspaces") { | 290 | else if (str_key == "workspaces") { |
291 | BScreen *screen = Fluxbox::instance()->findScreen(screen_number); | 291 | BScreen *screen = Fluxbox::instance()->findScreen(screen_number); |
292 | if (screen != 0) { | 292 | if (screen != 0) { |
293 | screen->getWorkspacemenu().setInternalMenu(); | 293 | screen->workspaceMenu().setInternalMenu(); |
294 | menu.insert(str_label.c_str(), &screen->getWorkspacemenu()); | 294 | menu.insert(str_label.c_str(), &screen->workspaceMenu()); |
295 | } | 295 | } |
296 | } else if (str_key == "separator") { | 296 | } else if (str_key == "separator") { |
297 | menu.insert(new FbTk::MenuSeparator()); | 297 | menu.insert(new FbTk::MenuSeparator()); |
diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc index 08473df..eba4616 100644 --- a/src/WorkspaceCmd.cc +++ b/src/WorkspaceCmd.cc | |||
@@ -127,7 +127,7 @@ JumpToWorkspaceCmd::JumpToWorkspaceCmd(int workspace_num):m_workspace_num(worksp | |||
127 | 127 | ||
128 | void JumpToWorkspaceCmd::execute() { | 128 | void JumpToWorkspaceCmd::execute() { |
129 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | 129 | BScreen *screen = Fluxbox::instance()->mouseScreen(); |
130 | if (screen != 0 && m_workspace_num >= 0 && m_workspace_num < screen->getNumberOfWorkspaces()) | 130 | if (screen != 0) |
131 | screen->changeWorkspaceID(m_workspace_num); | 131 | screen->changeWorkspaceID(m_workspace_num); |
132 | } | 132 | } |
133 | 133 | ||
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 | } |