diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2007-12-16 03:36:01 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2007-12-16 03:36:01 (GMT) |
commit | 8516f1e2a21a374127ccfa3f7b8de2443e67fe33 (patch) | |
tree | a66f212f856981584b2b44bfc772096c5ee7bebe /src/WorkspaceCmd.cc | |
parent | 90f4f1ecc1635fd5d144f86d64b1674958d0a59f (diff) | |
download | fluxbox-8516f1e2a21a374127ccfa3f7b8de2443e67fe33.zip fluxbox-8516f1e2a21a374127ccfa3f7b8de2443e67fe33.tar.bz2 |
changed CommandRegistry to a template class, renamed to ObjectRegistry<Type>
Diffstat (limited to 'src/WorkspaceCmd.cc')
-rw-r--r-- | src/WorkspaceCmd.cc | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc index 5498b38..2d2964e 100644 --- a/src/WorkspaceCmd.cc +++ b/src/WorkspaceCmd.cc | |||
@@ -33,7 +33,7 @@ | |||
33 | #include "WindowCmd.hh" | 33 | #include "WindowCmd.hh" |
34 | 34 | ||
35 | #include "FbTk/KeyUtil.hh" | 35 | #include "FbTk/KeyUtil.hh" |
36 | #include "FbTk/CommandRegistry.hh" | 36 | #include "FbTk/ObjectRegistry.hh" |
37 | #include "FbTk/stringstream.hh" | 37 | #include "FbTk/stringstream.hh" |
38 | 38 | ||
39 | #ifdef HAVE_CMATH | 39 | #ifdef HAVE_CMATH |
@@ -45,6 +45,8 @@ | |||
45 | #include <functional> | 45 | #include <functional> |
46 | 46 | ||
47 | using std::string; | 47 | using std::string; |
48 | using FbTk::Command; | ||
49 | using FbTk::BoolCommand; | ||
48 | 50 | ||
49 | void WindowListCmd::execute() { | 51 | void WindowListCmd::execute() { |
50 | if (m_pat.error()) { | 52 | if (m_pat.error()) { |
@@ -72,8 +74,9 @@ void WindowListCmd::execute() { | |||
72 | 74 | ||
73 | FbTk::BoolCommand *SomeCmd::parse(const string &command, const string &args, | 75 | FbTk::BoolCommand *SomeCmd::parse(const string &command, const string &args, |
74 | bool trusted) { | 76 | bool trusted) { |
75 | BoolCommand *boolcmd = | 77 | FbTk::BoolCommand *boolcmd = |
76 | FbTk::CommandRegistry::instance().parseBoolLine(args, trusted); | 78 | FbTk::ObjectRegistry<FbTk::BoolCommand>::instance().parse(args, |
79 | trusted); | ||
77 | if (!boolcmd) | 80 | if (!boolcmd) |
78 | return 0; | 81 | return 0; |
79 | if (command == "some") | 82 | if (command == "some") |
@@ -81,8 +84,8 @@ FbTk::BoolCommand *SomeCmd::parse(const string &command, const string &args, | |||
81 | return new EveryCmd(FbTk::RefCount<FbTk::BoolCommand>(boolcmd)); | 84 | return new EveryCmd(FbTk::RefCount<FbTk::BoolCommand>(boolcmd)); |
82 | } | 85 | } |
83 | 86 | ||
84 | REGISTER_BOOLCOMMAND_PARSER(some, SomeCmd::parse); | 87 | REGISTER_OBJECT_PARSER(some, SomeCmd::parse, BoolCommand); |
85 | REGISTER_BOOLCOMMAND_PARSER(every, SomeCmd::parse); | 88 | REGISTER_OBJECT_PARSER(every, SomeCmd::parse, BoolCommand); |
86 | 89 | ||
87 | bool SomeCmd::bool_execute() { | 90 | bool SomeCmd::bool_execute() { |
88 | BScreen *screen = Fluxbox::instance()->keyScreen(); | 91 | BScreen *screen = Fluxbox::instance()->keyScreen(); |
@@ -149,11 +152,11 @@ FbTk::Command *parseWindowList(const string &command, | |||
149 | return 0; | 152 | return 0; |
150 | } | 153 | } |
151 | 154 | ||
152 | REGISTER_COMMAND_PARSER(attach, parseWindowList); | 155 | REGISTER_OBJECT_PARSER(attach, parseWindowList, Command); |
153 | REGISTER_COMMAND_PARSER(nextwindow, parseWindowList); | 156 | REGISTER_OBJECT_PARSER(nextwindow, parseWindowList, Command); |
154 | REGISTER_COMMAND_PARSER(nextgroup, parseWindowList); | 157 | REGISTER_OBJECT_PARSER(nextgroup, parseWindowList, Command); |
155 | REGISTER_COMMAND_PARSER(prevwindow, parseWindowList); | 158 | REGISTER_OBJECT_PARSER(prevwindow, parseWindowList, Command); |
156 | REGISTER_COMMAND_PARSER(prevgroup, parseWindowList); | 159 | REGISTER_OBJECT_PARSER(prevgroup, parseWindowList, Command); |
157 | 160 | ||
158 | }; // end anonymous namespace | 161 | }; // end anonymous namespace |
159 | 162 | ||
@@ -202,7 +205,7 @@ FbTk::Command *GoToWindowCmd::parse(const string &command, | |||
202 | return new GoToWindowCmd(num, opts, pat); | 205 | return new GoToWindowCmd(num, opts, pat); |
203 | } | 206 | } |
204 | 207 | ||
205 | REGISTER_COMMAND_PARSER(gotowindow, GoToWindowCmd::parse); | 208 | REGISTER_OBJECT_PARSER(gotowindow, GoToWindowCmd::parse, Command); |
206 | 209 | ||
207 | void GoToWindowCmd::execute() { | 210 | void GoToWindowCmd::execute() { |
208 | BScreen *screen = Fluxbox::instance()->keyScreen(); | 211 | BScreen *screen = Fluxbox::instance()->keyScreen(); |
@@ -226,10 +229,10 @@ FbTk::Command *DirFocusCmd::parse(const string &command, | |||
226 | return 0; | 229 | return 0; |
227 | } | 230 | } |
228 | 231 | ||
229 | REGISTER_COMMAND_PARSER(focusup, DirFocusCmd::parse); | 232 | REGISTER_OBJECT_PARSER(focusup, DirFocusCmd::parse, Command); |
230 | REGISTER_COMMAND_PARSER(focusdown, DirFocusCmd::parse); | 233 | REGISTER_OBJECT_PARSER(focusdown, DirFocusCmd::parse, Command); |
231 | REGISTER_COMMAND_PARSER(focusleft, DirFocusCmd::parse); | 234 | REGISTER_OBJECT_PARSER(focusleft, DirFocusCmd::parse, Command); |
232 | REGISTER_COMMAND_PARSER(focusright, DirFocusCmd::parse); | 235 | REGISTER_OBJECT_PARSER(focusright, DirFocusCmd::parse, Command); |
233 | 236 | ||
234 | void DirFocusCmd::execute() { | 237 | void DirFocusCmd::execute() { |
235 | BScreen *screen = Fluxbox::instance()->keyScreen(); | 238 | BScreen *screen = Fluxbox::instance()->keyScreen(); |
@@ -241,7 +244,7 @@ void DirFocusCmd::execute() { | |||
241 | screen->focusControl().dirFocus(*win, m_dir); | 244 | screen->focusControl().dirFocus(*win, m_dir); |
242 | } | 245 | } |
243 | 246 | ||
244 | REGISTER_COMMAND(addworkspace, AddWorkspaceCmd); | 247 | REGISTER_OBJECT(addworkspace, AddWorkspaceCmd, Command); |
245 | 248 | ||
246 | void AddWorkspaceCmd::execute() { | 249 | void AddWorkspaceCmd::execute() { |
247 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | 250 | BScreen *screen = Fluxbox::instance()->mouseScreen(); |
@@ -249,7 +252,7 @@ void AddWorkspaceCmd::execute() { | |||
249 | screen->addWorkspace(); | 252 | screen->addWorkspace(); |
250 | } | 253 | } |
251 | 254 | ||
252 | REGISTER_COMMAND(removelastworkspace, RemoveLastWorkspaceCmd); | 255 | REGISTER_OBJECT(removelastworkspace, RemoveLastWorkspaceCmd, Command); |
253 | 256 | ||
254 | void RemoveLastWorkspaceCmd::execute() { | 257 | void RemoveLastWorkspaceCmd::execute() { |
255 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | 258 | BScreen *screen = Fluxbox::instance()->mouseScreen(); |
@@ -278,11 +281,11 @@ FbTk::Command *parseIntCmd(const string &command, const string &args, | |||
278 | return 0; | 281 | return 0; |
279 | } | 282 | } |
280 | 283 | ||
281 | REGISTER_COMMAND_PARSER(nextworkspace, parseIntCmd); | 284 | REGISTER_OBJECT_PARSER(nextworkspace, parseIntCmd, Command); |
282 | REGISTER_COMMAND_PARSER(prevworkspace, parseIntCmd); | 285 | REGISTER_OBJECT_PARSER(prevworkspace, parseIntCmd, Command); |
283 | REGISTER_COMMAND_PARSER(rightworkspace, parseIntCmd); | 286 | REGISTER_OBJECT_PARSER(rightworkspace, parseIntCmd, Command); |
284 | REGISTER_COMMAND_PARSER(leftworkspace, parseIntCmd); | 287 | REGISTER_OBJECT_PARSER(leftworkspace, parseIntCmd, Command); |
285 | REGISTER_COMMAND_PARSER(workspace, parseIntCmd); | 288 | REGISTER_OBJECT_PARSER(workspace, parseIntCmd, Command); |
286 | 289 | ||
287 | }; // end anonymous namespace | 290 | }; // end anonymous namespace |
288 | 291 | ||
@@ -325,7 +328,7 @@ void JumpToWorkspaceCmd::execute() { | |||
325 | } | 328 | } |
326 | } | 329 | } |
327 | 330 | ||
328 | REGISTER_COMMAND(arrangewindows, ArrangeWindowsCmd); | 331 | REGISTER_OBJECT(arrangewindows, ArrangeWindowsCmd, Command); |
329 | 332 | ||
330 | /** | 333 | /** |
331 | try to arrange the windows on the current workspace in a 'clever' way. | 334 | try to arrange the windows on the current workspace in a 'clever' way. |
@@ -451,7 +454,7 @@ void ArrangeWindowsCmd::execute() { | |||
451 | } | 454 | } |
452 | } | 455 | } |
453 | 456 | ||
454 | REGISTER_COMMAND(showdesktop, ShowDesktopCmd); | 457 | REGISTER_OBJECT(showdesktop, ShowDesktopCmd, Command); |
455 | 458 | ||
456 | void ShowDesktopCmd::execute() { | 459 | void ShowDesktopCmd::execute() { |
457 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | 460 | BScreen *screen = Fluxbox::instance()->mouseScreen(); |
@@ -467,7 +470,7 @@ void ShowDesktopCmd::execute() { | |||
467 | } | 470 | } |
468 | } | 471 | } |
469 | 472 | ||
470 | REGISTER_COMMAND(closeallwindows, CloseAllWindowsCmd); | 473 | REGISTER_OBJECT(closeallwindows, CloseAllWindowsCmd, Command); |
471 | 474 | ||
472 | void CloseAllWindowsCmd::execute() { | 475 | void CloseAllWindowsCmd::execute() { |
473 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | 476 | BScreen *screen = Fluxbox::instance()->mouseScreen(); |