aboutsummaryrefslogtreecommitdiff
path: root/src/WorkspaceCmd.cc
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2007-12-16 03:36:01 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2007-12-16 03:36:01 (GMT)
commit8516f1e2a21a374127ccfa3f7b8de2443e67fe33 (patch)
treea66f212f856981584b2b44bfc772096c5ee7bebe /src/WorkspaceCmd.cc
parent90f4f1ecc1635fd5d144f86d64b1674958d0a59f (diff)
downloadfluxbox-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.cc53
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
47using std::string; 47using std::string;
48using FbTk::Command;
49using FbTk::BoolCommand;
48 50
49void WindowListCmd::execute() { 51void WindowListCmd::execute() {
50 if (m_pat.error()) { 52 if (m_pat.error()) {
@@ -72,8 +74,9 @@ void WindowListCmd::execute() {
72 74
73FbTk::BoolCommand *SomeCmd::parse(const string &command, const string &args, 75FbTk::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
84REGISTER_BOOLCOMMAND_PARSER(some, SomeCmd::parse); 87REGISTER_OBJECT_PARSER(some, SomeCmd::parse, BoolCommand);
85REGISTER_BOOLCOMMAND_PARSER(every, SomeCmd::parse); 88REGISTER_OBJECT_PARSER(every, SomeCmd::parse, BoolCommand);
86 89
87bool SomeCmd::bool_execute() { 90bool 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
152REGISTER_COMMAND_PARSER(attach, parseWindowList); 155REGISTER_OBJECT_PARSER(attach, parseWindowList, Command);
153REGISTER_COMMAND_PARSER(nextwindow, parseWindowList); 156REGISTER_OBJECT_PARSER(nextwindow, parseWindowList, Command);
154REGISTER_COMMAND_PARSER(nextgroup, parseWindowList); 157REGISTER_OBJECT_PARSER(nextgroup, parseWindowList, Command);
155REGISTER_COMMAND_PARSER(prevwindow, parseWindowList); 158REGISTER_OBJECT_PARSER(prevwindow, parseWindowList, Command);
156REGISTER_COMMAND_PARSER(prevgroup, parseWindowList); 159REGISTER_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
205REGISTER_COMMAND_PARSER(gotowindow, GoToWindowCmd::parse); 208REGISTER_OBJECT_PARSER(gotowindow, GoToWindowCmd::parse, Command);
206 209
207void GoToWindowCmd::execute() { 210void 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
229REGISTER_COMMAND_PARSER(focusup, DirFocusCmd::parse); 232REGISTER_OBJECT_PARSER(focusup, DirFocusCmd::parse, Command);
230REGISTER_COMMAND_PARSER(focusdown, DirFocusCmd::parse); 233REGISTER_OBJECT_PARSER(focusdown, DirFocusCmd::parse, Command);
231REGISTER_COMMAND_PARSER(focusleft, DirFocusCmd::parse); 234REGISTER_OBJECT_PARSER(focusleft, DirFocusCmd::parse, Command);
232REGISTER_COMMAND_PARSER(focusright, DirFocusCmd::parse); 235REGISTER_OBJECT_PARSER(focusright, DirFocusCmd::parse, Command);
233 236
234void DirFocusCmd::execute() { 237void 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
244REGISTER_COMMAND(addworkspace, AddWorkspaceCmd); 247REGISTER_OBJECT(addworkspace, AddWorkspaceCmd, Command);
245 248
246void AddWorkspaceCmd::execute() { 249void 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
252REGISTER_COMMAND(removelastworkspace, RemoveLastWorkspaceCmd); 255REGISTER_OBJECT(removelastworkspace, RemoveLastWorkspaceCmd, Command);
253 256
254void RemoveLastWorkspaceCmd::execute() { 257void 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
281REGISTER_COMMAND_PARSER(nextworkspace, parseIntCmd); 284REGISTER_OBJECT_PARSER(nextworkspace, parseIntCmd, Command);
282REGISTER_COMMAND_PARSER(prevworkspace, parseIntCmd); 285REGISTER_OBJECT_PARSER(prevworkspace, parseIntCmd, Command);
283REGISTER_COMMAND_PARSER(rightworkspace, parseIntCmd); 286REGISTER_OBJECT_PARSER(rightworkspace, parseIntCmd, Command);
284REGISTER_COMMAND_PARSER(leftworkspace, parseIntCmd); 287REGISTER_OBJECT_PARSER(leftworkspace, parseIntCmd, Command);
285REGISTER_COMMAND_PARSER(workspace, parseIntCmd); 288REGISTER_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
328REGISTER_COMMAND(arrangewindows, ArrangeWindowsCmd); 331REGISTER_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
454REGISTER_COMMAND(showdesktop, ShowDesktopCmd); 457REGISTER_OBJECT(showdesktop, ShowDesktopCmd, Command);
455 458
456void ShowDesktopCmd::execute() { 459void 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
470REGISTER_COMMAND(closeallwindows, CloseAllWindowsCmd); 473REGISTER_OBJECT(closeallwindows, CloseAllWindowsCmd, Command);
471 474
472void CloseAllWindowsCmd::execute() { 475void CloseAllWindowsCmd::execute() {
473 BScreen *screen = Fluxbox::instance()->mouseScreen(); 476 BScreen *screen = Fluxbox::instance()->mouseScreen();