aboutsummaryrefslogtreecommitdiff
path: root/src/CurrentWindowCmd.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/CurrentWindowCmd.cc
parent90f4f1ecc1635fd5d144f86d64b1674958d0a59f (diff)
downloadfluxbox-8516f1e2a21a374127ccfa3f7b8de2443e67fe33.zip
fluxbox-8516f1e2a21a374127ccfa3f7b8de2443e67fe33.tar.bz2
changed CommandRegistry to a template class, renamed to ObjectRegistry<Type>
Diffstat (limited to 'src/CurrentWindowCmd.cc')
-rw-r--r--src/CurrentWindowCmd.cc108
1 files changed, 55 insertions, 53 deletions
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc
index 33d8e8a..d7b05ab 100644
--- a/src/CurrentWindowCmd.cc
+++ b/src/CurrentWindowCmd.cc
@@ -31,13 +31,15 @@
31#include "WinClient.hh" 31#include "WinClient.hh"
32 32
33#include "FocusControl.hh" 33#include "FocusControl.hh"
34#include "FbTk/CommandRegistry.hh" 34#include "FbTk/ObjectRegistry.hh"
35#include "FbTk/stringstream.hh" 35#include "FbTk/stringstream.hh"
36#include "FbTk/StringUtil.hh" 36#include "FbTk/StringUtil.hh"
37 37
38#include <string> 38#include <string>
39#include <vector> 39#include <vector>
40 40
41using FbTk::Command;
42
41namespace { 43namespace {
42 44
43FbTk::Command *createCurrentWindowCmd(const std::string &command, 45FbTk::Command *createCurrentWindowCmd(const std::string &command,
@@ -89,35 +91,35 @@ FbTk::Command *createCurrentWindowCmd(const std::string &command,
89 return 0; 91 return 0;
90} 92}
91 93
92REGISTER_COMMAND_PARSER(minimizewindow, createCurrentWindowCmd); 94REGISTER_OBJECT_PARSER(minimizewindow, createCurrentWindowCmd, Command);
93REGISTER_COMMAND_PARSER(minimize, createCurrentWindowCmd); 95REGISTER_OBJECT_PARSER(minimize, createCurrentWindowCmd, Command);
94REGISTER_COMMAND_PARSER(iconify, createCurrentWindowCmd); 96REGISTER_OBJECT_PARSER(iconify, createCurrentWindowCmd, Command);
95REGISTER_COMMAND_PARSER(maximizewindow, createCurrentWindowCmd); 97REGISTER_OBJECT_PARSER(maximizewindow, createCurrentWindowCmd, Command);
96REGISTER_COMMAND_PARSER(maximize, createCurrentWindowCmd); 98REGISTER_OBJECT_PARSER(maximize, createCurrentWindowCmd, Command);
97REGISTER_COMMAND_PARSER(maximizevertical, createCurrentWindowCmd); 99REGISTER_OBJECT_PARSER(maximizevertical, createCurrentWindowCmd, Command);
98REGISTER_COMMAND_PARSER(maximizehorizontal, createCurrentWindowCmd); 100REGISTER_OBJECT_PARSER(maximizehorizontal, createCurrentWindowCmd, Command);
99REGISTER_COMMAND_PARSER(raise, createCurrentWindowCmd); 101REGISTER_OBJECT_PARSER(raise, createCurrentWindowCmd, Command);
100REGISTER_COMMAND_PARSER(raiselayer, createCurrentWindowCmd); 102REGISTER_OBJECT_PARSER(raiselayer, createCurrentWindowCmd, Command);
101REGISTER_COMMAND_PARSER(lower, createCurrentWindowCmd); 103REGISTER_OBJECT_PARSER(lower, createCurrentWindowCmd, Command);
102REGISTER_COMMAND_PARSER(lowerlayer, createCurrentWindowCmd); 104REGISTER_OBJECT_PARSER(lowerlayer, createCurrentWindowCmd, Command);
103REGISTER_COMMAND_PARSER(activate, createCurrentWindowCmd); 105REGISTER_OBJECT_PARSER(activate, createCurrentWindowCmd, Command);
104REGISTER_COMMAND_PARSER(focus, createCurrentWindowCmd); 106REGISTER_OBJECT_PARSER(focus, createCurrentWindowCmd, Command);
105REGISTER_COMMAND_PARSER(close, createCurrentWindowCmd); 107REGISTER_OBJECT_PARSER(close, createCurrentWindowCmd, Command);
106REGISTER_COMMAND_PARSER(killwindow, createCurrentWindowCmd); 108REGISTER_OBJECT_PARSER(killwindow, createCurrentWindowCmd, Command);
107REGISTER_COMMAND_PARSER(kill, createCurrentWindowCmd); 109REGISTER_OBJECT_PARSER(kill, createCurrentWindowCmd, Command);
108REGISTER_COMMAND_PARSER(shade, createCurrentWindowCmd); 110REGISTER_OBJECT_PARSER(shade, createCurrentWindowCmd, Command);
109REGISTER_COMMAND_PARSER(shadewindow, createCurrentWindowCmd); 111REGISTER_OBJECT_PARSER(shadewindow, createCurrentWindowCmd, Command);
110REGISTER_COMMAND_PARSER(shadeon, createCurrentWindowCmd); 112REGISTER_OBJECT_PARSER(shadeon, createCurrentWindowCmd, Command);
111REGISTER_COMMAND_PARSER(shadeoff, createCurrentWindowCmd); 113REGISTER_OBJECT_PARSER(shadeoff, createCurrentWindowCmd, Command);
112REGISTER_COMMAND_PARSER(stick, createCurrentWindowCmd); 114REGISTER_OBJECT_PARSER(stick, createCurrentWindowCmd, Command);
113REGISTER_COMMAND_PARSER(stickwindow, createCurrentWindowCmd); 115REGISTER_OBJECT_PARSER(stickwindow, createCurrentWindowCmd, Command);
114REGISTER_COMMAND_PARSER(toggledecor, createCurrentWindowCmd); 116REGISTER_OBJECT_PARSER(toggledecor, createCurrentWindowCmd, Command);
115REGISTER_COMMAND_PARSER(nexttab, createCurrentWindowCmd); 117REGISTER_OBJECT_PARSER(nexttab, createCurrentWindowCmd, Command);
116REGISTER_COMMAND_PARSER(prevtab, createCurrentWindowCmd); 118REGISTER_OBJECT_PARSER(prevtab, createCurrentWindowCmd, Command);
117REGISTER_COMMAND_PARSER(movetableft, createCurrentWindowCmd); 119REGISTER_OBJECT_PARSER(movetableft, createCurrentWindowCmd, Command);
118REGISTER_COMMAND_PARSER(movetabright, createCurrentWindowCmd); 120REGISTER_OBJECT_PARSER(movetabright, createCurrentWindowCmd, Command);
119REGISTER_COMMAND_PARSER(detachclient, createCurrentWindowCmd); 121REGISTER_OBJECT_PARSER(detachclient, createCurrentWindowCmd, Command);
120REGISTER_COMMAND_PARSER(windowmenu, createCurrentWindowCmd); 122REGISTER_OBJECT_PARSER(windowmenu, createCurrentWindowCmd, Command);
121 123
122}; // end anonymous namespace 124}; // end anonymous namespace
123 125
@@ -184,14 +186,14 @@ FbTk::Command *parseIntCmd(const string &command, const string &args,
184 return 0; 186 return 0;
185} 187}
186 188
187REGISTER_COMMAND_PARSER(sethead, parseIntCmd); 189REGISTER_OBJECT_PARSER(sethead, parseIntCmd, Command);
188REGISTER_COMMAND_PARSER(tab, parseIntCmd); 190REGISTER_OBJECT_PARSER(tab, parseIntCmd, Command);
189REGISTER_COMMAND_PARSER(sendtonextworkspace, parseIntCmd); 191REGISTER_OBJECT_PARSER(sendtonextworkspace, parseIntCmd, Command);
190REGISTER_COMMAND_PARSER(sendtoprevworkspace, parseIntCmd); 192REGISTER_OBJECT_PARSER(sendtoprevworkspace, parseIntCmd, Command);
191REGISTER_COMMAND_PARSER(taketonextworkspace, parseIntCmd); 193REGISTER_OBJECT_PARSER(taketonextworkspace, parseIntCmd, Command);
192REGISTER_COMMAND_PARSER(taketoprevworkspace, parseIntCmd); 194REGISTER_OBJECT_PARSER(taketoprevworkspace, parseIntCmd, Command);
193REGISTER_COMMAND_PARSER(sendtoworkspace, parseIntCmd); 195REGISTER_OBJECT_PARSER(sendtoworkspace, parseIntCmd, Command);
194REGISTER_COMMAND_PARSER(taketoworkspace, parseIntCmd); 196REGISTER_OBJECT_PARSER(taketoworkspace, parseIntCmd, Command);
195 197
196}; // end anonymous namespace 198}; // end anonymous namespace
197 199
@@ -254,7 +256,7 @@ void GoToTabCmd::real_execute() {
254 (*it)->focus(); 256 (*it)->focus();
255} 257}
256 258
257REGISTER_COMMAND(startmoving, StartMovingCmd); 259REGISTER_OBJECT(startmoving, StartMovingCmd, Command);
258 260
259void StartMovingCmd::real_execute() { 261void StartMovingCmd::real_execute() {
260 const XEvent &last = Fluxbox::instance()->lastEvent(); 262 const XEvent &last = Fluxbox::instance()->lastEvent();
@@ -297,7 +299,7 @@ FbTk::Command *StartResizingCmd::parse(const string &cmd, const string &args,
297 return new StartResizingCmd(mode); 299 return new StartResizingCmd(mode);
298} 300}
299 301
300REGISTER_COMMAND_PARSER(startresizing, StartResizingCmd::parse); 302REGISTER_OBJECT_PARSER(startresizing, StartResizingCmd::parse, Command);
301 303
302void StartResizingCmd::real_execute() { 304void StartResizingCmd::real_execute() {
303 const XEvent &last = Fluxbox::instance()->lastEvent(); 305 const XEvent &last = Fluxbox::instance()->lastEvent();
@@ -332,11 +334,11 @@ FbTk::Command *MoveCmd::parse(const string &command, const string &args,
332 return new MoveCmd(dx, dy); 334 return new MoveCmd(dx, dy);
333} 335}
334 336
335REGISTER_COMMAND_PARSER(move, MoveCmd::parse); 337REGISTER_OBJECT_PARSER(move, MoveCmd::parse, Command);
336REGISTER_COMMAND_PARSER(moveright, MoveCmd::parse); 338REGISTER_OBJECT_PARSER(moveright, MoveCmd::parse, Command);
337REGISTER_COMMAND_PARSER(moveleft, MoveCmd::parse); 339REGISTER_OBJECT_PARSER(moveleft, MoveCmd::parse, Command);
338REGISTER_COMMAND_PARSER(moveup, MoveCmd::parse); 340REGISTER_OBJECT_PARSER(moveup, MoveCmd::parse, Command);
339REGISTER_COMMAND_PARSER(movedown, MoveCmd::parse); 341REGISTER_OBJECT_PARSER(movedown, MoveCmd::parse, Command);
340 342
341MoveCmd::MoveCmd(const int step_size_x, const int step_size_y) : 343MoveCmd::MoveCmd(const int step_size_x, const int step_size_y) :
342 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } 344 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
@@ -364,10 +366,10 @@ FbTk::Command *ResizeCmd::parse(const string &command, const string &args,
364 return new ResizeCmd(dx, dy); 366 return new ResizeCmd(dx, dy);
365} 367}
366 368
367REGISTER_COMMAND_PARSER(resize, ResizeCmd::parse); 369REGISTER_OBJECT_PARSER(resize, ResizeCmd::parse, Command);
368REGISTER_COMMAND_PARSER(resizeto, ResizeCmd::parse); 370REGISTER_OBJECT_PARSER(resizeto, ResizeCmd::parse, Command);
369REGISTER_COMMAND_PARSER(resizehorizontal, ResizeCmd::parse); 371REGISTER_OBJECT_PARSER(resizehorizontal, ResizeCmd::parse, Command);
370REGISTER_COMMAND_PARSER(resizevertical, ResizeCmd::parse); 372REGISTER_OBJECT_PARSER(resizevertical, ResizeCmd::parse, Command);
371 373
372ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) : 374ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) :
373 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } 375 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
@@ -428,7 +430,7 @@ FbTk::Command *MoveToCmd::parse(const string &cmd, const string &args,
428 430
429} 431}
430 432
431REGISTER_COMMAND_PARSER(moveto, MoveToCmd::parse); 433REGISTER_OBJECT_PARSER(moveto, MoveToCmd::parse, Command);
432 434
433MoveToCmd::MoveToCmd(const int step_size_x, const int step_size_y, const unsigned int refc) : 435MoveToCmd::MoveToCmd(const int step_size_x, const int step_size_y, const unsigned int refc) :
434 m_step_size_x(step_size_x), m_step_size_y(step_size_y), m_refc(refc) { } 436 m_step_size_x(step_size_x), m_step_size_y(step_size_y), m_refc(refc) { }
@@ -465,7 +467,7 @@ void ResizeToCmd::real_execute() {
465 fbwindow().resize(m_step_size_x, m_step_size_y); 467 fbwindow().resize(m_step_size_x, m_step_size_y);
466} 468}
467 469
468REGISTER_COMMAND(fullscreen, FullscreenCmd); 470REGISTER_OBJECT(fullscreen, FullscreenCmd, Command);
469 471
470FullscreenCmd::FullscreenCmd() { } 472FullscreenCmd::FullscreenCmd() { }
471void FullscreenCmd::real_execute() { 473void FullscreenCmd::real_execute() {
@@ -497,7 +499,7 @@ FbTk::Command *SetAlphaCmd::parse(const string &command, const string &args,
497 return new SetAlphaCmd(focused, relative, unfocused, un_rel); 499 return new SetAlphaCmd(focused, relative, unfocused, un_rel);
498} 500}
499 501
500REGISTER_COMMAND_PARSER(setalpha, SetAlphaCmd::parse); 502REGISTER_OBJECT_PARSER(setalpha, SetAlphaCmd::parse, Command);
501 503
502SetAlphaCmd::SetAlphaCmd(int focused, bool relative, 504SetAlphaCmd::SetAlphaCmd(int focused, bool relative,
503 int unfocused, bool un_relative) : 505 int unfocused, bool un_relative) :
@@ -529,7 +531,7 @@ void SetAlphaCmd::real_execute() {
529 fbwindow().setUnfocusedAlpha(m_unfocus); 531 fbwindow().setUnfocusedAlpha(m_unfocus);
530} 532}
531 533
532REGISTER_BOOLCOMMAND_WITH_ARGS(matches, MatchCmd); 534REGISTER_OBJECT_WITH_ARGS_NSBASE(matches, MatchCmd, FbTk, BoolCommand);
533 535
534bool MatchCmd::real_execute() { 536bool MatchCmd::real_execute() {
535 return m_pat.match(winclient()); 537 return m_pat.match(winclient());