diff options
Diffstat (limited to 'src/FbCommands.cc')
-rw-r--r-- | src/FbCommands.cc | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc index 0d4e0e3..747eb3c 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.cc | |||
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | #include "FbTk/Theme.hh" | 34 | #include "FbTk/Theme.hh" |
35 | #include "FbTk/Menu.hh" | 35 | #include "FbTk/Menu.hh" |
36 | #include "FbTk/CommandRegistry.hh" | 36 | #include "FbTk/ObjectRegistry.hh" |
37 | #include "FbTk/StringUtil.hh" | 37 | #include "FbTk/StringUtil.hh" |
38 | #include "FbTk/stringstream.hh" | 38 | #include "FbTk/stringstream.hh" |
39 | 39 | ||
@@ -123,9 +123,11 @@ void showMenu(const BScreen &screen, FbTk::Menu &menu) { | |||
123 | 123 | ||
124 | namespace FbCommands { | 124 | namespace FbCommands { |
125 | 125 | ||
126 | REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(exec, FbCommands::ExecuteCmd); | 126 | using FbTk::Command; |
127 | REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(execute, FbCommands::ExecuteCmd); | 127 | |
128 | REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(execcommand, FbCommands::ExecuteCmd); | 128 | REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(exec, FbCommands::ExecuteCmd, Command); |
129 | REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(execute, FbCommands::ExecuteCmd, Command); | ||
130 | REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(execcommand, FbCommands::ExecuteCmd, Command); | ||
129 | 131 | ||
130 | ExecuteCmd::ExecuteCmd(const string &cmd, int screen_num):m_cmd(cmd), m_screen_num(screen_num) { | 132 | ExecuteCmd::ExecuteCmd(const string &cmd, int screen_num):m_cmd(cmd), m_screen_num(screen_num) { |
131 | 133 | ||
@@ -193,9 +195,9 @@ FbTk::Command *ExportCmd::parse(const string &command, const string &args, | |||
193 | return new ExportCmd(name, value); | 195 | return new ExportCmd(name, value); |
194 | } | 196 | } |
195 | 197 | ||
196 | REGISTER_COMMAND_PARSER(setenv, ExportCmd::parse); | 198 | REGISTER_OBJECT_PARSER(setenv, ExportCmd::parse, Command); |
197 | REGISTER_COMMAND_PARSER(export, ExportCmd::parse); | 199 | REGISTER_OBJECT_PARSER(export, ExportCmd::parse, Command); |
198 | REGISTER_COMMAND_PARSER(setresourcevalue, ExportCmd::parse); | 200 | REGISTER_OBJECT_PARSER(setresourcevalue, ExportCmd::parse, Command); |
199 | 201 | ||
200 | ExportCmd::ExportCmd(const string& name, const string& value) : | 202 | ExportCmd::ExportCmd(const string& name, const string& value) : |
201 | m_name(name), m_value(value) { | 203 | m_name(name), m_value(value) { |
@@ -233,20 +235,20 @@ void ExportCmd::execute() { | |||
233 | } | 235 | } |
234 | } | 236 | } |
235 | 237 | ||
236 | REGISTER_COMMAND(exit, FbCommands::ExitFluxboxCmd); | 238 | REGISTER_OBJECT(exit, FbCommands::ExitFluxboxCmd, Command); |
237 | REGISTER_COMMAND(quit, FbCommands::ExitFluxboxCmd); | 239 | REGISTER_OBJECT(quit, FbCommands::ExitFluxboxCmd, Command); |
238 | 240 | ||
239 | void ExitFluxboxCmd::execute() { | 241 | void ExitFluxboxCmd::execute() { |
240 | Fluxbox::instance()->shutdown(); | 242 | Fluxbox::instance()->shutdown(); |
241 | } | 243 | } |
242 | 244 | ||
243 | REGISTER_COMMAND(saverc, FbCommands::SaveResources); | 245 | REGISTER_OBJECT(saverc, FbCommands::SaveResources, Command); |
244 | 246 | ||
245 | void SaveResources::execute() { | 247 | void SaveResources::execute() { |
246 | Fluxbox::instance()->save_rc(); | 248 | Fluxbox::instance()->save_rc(); |
247 | } | 249 | } |
248 | 250 | ||
249 | REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(restart, FbCommands::RestartFluxboxCmd); | 251 | REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(restart, FbCommands::RestartFluxboxCmd, Command); |
250 | 252 | ||
251 | RestartFluxboxCmd::RestartFluxboxCmd(const string &cmd):m_cmd(cmd){ | 253 | RestartFluxboxCmd::RestartFluxboxCmd(const string &cmd):m_cmd(cmd){ |
252 | } | 254 | } |
@@ -258,21 +260,21 @@ void RestartFluxboxCmd::execute() { | |||
258 | Fluxbox::instance()->restart(m_cmd.c_str()); | 260 | Fluxbox::instance()->restart(m_cmd.c_str()); |
259 | } | 261 | } |
260 | 262 | ||
261 | REGISTER_COMMAND(reconfigure, FbCommands::ReconfigureFluxboxCmd); | 263 | REGISTER_OBJECT(reconfigure, FbCommands::ReconfigureFluxboxCmd, Command); |
262 | REGISTER_COMMAND(reconfig, FbCommands::ReconfigureFluxboxCmd); | 264 | REGISTER_OBJECT(reconfig, FbCommands::ReconfigureFluxboxCmd, Command); |
263 | 265 | ||
264 | void ReconfigureFluxboxCmd::execute() { | 266 | void ReconfigureFluxboxCmd::execute() { |
265 | Fluxbox::instance()->reconfigure(); | 267 | Fluxbox::instance()->reconfigure(); |
266 | } | 268 | } |
267 | 269 | ||
268 | REGISTER_COMMAND(reloadstyle, FbCommands::ReloadStyleCmd); | 270 | REGISTER_OBJECT(reloadstyle, FbCommands::ReloadStyleCmd, Command); |
269 | 271 | ||
270 | void ReloadStyleCmd::execute() { | 272 | void ReloadStyleCmd::execute() { |
271 | SetStyleCmd cmd(Fluxbox::instance()->getStyleFilename()); | 273 | SetStyleCmd cmd(Fluxbox::instance()->getStyleFilename()); |
272 | cmd.execute(); | 274 | cmd.execute(); |
273 | } | 275 | } |
274 | 276 | ||
275 | REGISTER_COMMAND_WITH_ARGS(setstyle, FbCommands::SetStyleCmd); | 277 | REGISTER_OBJECT_WITH_ARGS(setstyle, FbCommands::SetStyleCmd, Command); |
276 | 278 | ||
277 | SetStyleCmd::SetStyleCmd(const string &filename):m_filename(filename) { | 279 | SetStyleCmd::SetStyleCmd(const string &filename):m_filename(filename) { |
278 | 280 | ||
@@ -285,7 +287,7 @@ void SetStyleCmd::execute() { | |||
285 | Fluxbox::instance()->getStyleOverlayFilename()); | 287 | Fluxbox::instance()->getStyleOverlayFilename()); |
286 | } | 288 | } |
287 | 289 | ||
288 | REGISTER_COMMAND_WITH_ARGS(keymode, FbCommands::KeyModeCmd); | 290 | REGISTER_OBJECT_WITH_ARGS(keymode, FbCommands::KeyModeCmd, Command); |
289 | 291 | ||
290 | KeyModeCmd::KeyModeCmd(const string &arguments):m_keymode(arguments),m_end_args("None Escape") { | 292 | KeyModeCmd::KeyModeCmd(const string &arguments):m_keymode(arguments),m_end_args("None Escape") { |
291 | string::size_type second_pos = m_keymode.find_first_of(" \t", 0); | 293 | string::size_type second_pos = m_keymode.find_first_of(" \t", 0); |
@@ -302,7 +304,7 @@ void KeyModeCmd::execute() { | |||
302 | Fluxbox::instance()->keys()->keyMode(m_keymode); | 304 | Fluxbox::instance()->keys()->keyMode(m_keymode); |
303 | } | 305 | } |
304 | 306 | ||
305 | REGISTER_COMMAND(hidemenus, FbCommands::HideMenuCmd); | 307 | REGISTER_OBJECT(hidemenus, FbCommands::HideMenuCmd, Command); |
306 | 308 | ||
307 | void HideMenuCmd::execute() { | 309 | void HideMenuCmd::execute() { |
308 | FbTk::Menu::hideShownMenu(); | 310 | FbTk::Menu::hideShownMenu(); |
@@ -316,7 +318,7 @@ FbTk::Command *ShowClientMenuCmd::parse(const string &command, | |||
316 | return new ShowClientMenuCmd(opts, pat); | 318 | return new ShowClientMenuCmd(opts, pat); |
317 | } | 319 | } |
318 | 320 | ||
319 | REGISTER_COMMAND_PARSER(clientmenu, ShowClientMenuCmd::parse); | 321 | REGISTER_OBJECT_PARSER(clientmenu, ShowClientMenuCmd::parse, Command); |
320 | 322 | ||
321 | void ShowClientMenuCmd::execute() { | 323 | void ShowClientMenuCmd::execute() { |
322 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | 324 | BScreen *screen = Fluxbox::instance()->mouseScreen(); |
@@ -339,7 +341,7 @@ void ShowClientMenuCmd::execute() { | |||
339 | ::showMenu(*screen, **m_menu); | 341 | ::showMenu(*screen, **m_menu); |
340 | } | 342 | } |
341 | 343 | ||
342 | REGISTER_COMMAND_WITH_ARGS(custommenu, FbCommands::ShowCustomMenuCmd); | 344 | REGISTER_OBJECT_WITH_ARGS(custommenu, FbCommands::ShowCustomMenuCmd, Command); |
343 | 345 | ||
344 | ShowCustomMenuCmd::ShowCustomMenuCmd(const string &arguments) : custom_menu_file(arguments) {} | 346 | ShowCustomMenuCmd::ShowCustomMenuCmd(const string &arguments) : custom_menu_file(arguments) {} |
345 | 347 | ||
@@ -354,7 +356,7 @@ void ShowCustomMenuCmd::execute() { | |||
354 | ::showMenu(*screen, **m_menu); | 356 | ::showMenu(*screen, **m_menu); |
355 | } | 357 | } |
356 | 358 | ||
357 | REGISTER_COMMAND(rootmenu, FbCommands::ShowRootMenuCmd); | 359 | REGISTER_OBJECT(rootmenu, FbCommands::ShowRootMenuCmd, Command); |
358 | 360 | ||
359 | void ShowRootMenuCmd::execute() { | 361 | void ShowRootMenuCmd::execute() { |
360 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | 362 | BScreen *screen = Fluxbox::instance()->mouseScreen(); |
@@ -364,7 +366,7 @@ void ShowRootMenuCmd::execute() { | |||
364 | ::showMenu(*screen, screen->rootMenu()); | 366 | ::showMenu(*screen, screen->rootMenu()); |
365 | } | 367 | } |
366 | 368 | ||
367 | REGISTER_COMMAND(workspacemenu, FbCommands::ShowWorkspaceMenuCmd); | 369 | REGISTER_OBJECT(workspacemenu, FbCommands::ShowWorkspaceMenuCmd, Command); |
368 | 370 | ||
369 | void ShowWorkspaceMenuCmd::execute() { | 371 | void ShowWorkspaceMenuCmd::execute() { |
370 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | 372 | BScreen *screen = Fluxbox::instance()->mouseScreen(); |
@@ -374,7 +376,7 @@ void ShowWorkspaceMenuCmd::execute() { | |||
374 | ::showMenu(*screen, screen->workspaceMenu()); | 376 | ::showMenu(*screen, screen->workspaceMenu()); |
375 | } | 377 | } |
376 | 378 | ||
377 | REGISTER_COMMAND_WITH_ARGS(setworkspacename, FbCommands::SetWorkspaceNameCmd); | 379 | REGISTER_OBJECT_WITH_ARGS(setworkspacename, FbCommands::SetWorkspaceNameCmd, Command); |
378 | 380 | ||
379 | SetWorkspaceNameCmd::SetWorkspaceNameCmd(const string &name, int spaceid): | 381 | SetWorkspaceNameCmd::SetWorkspaceNameCmd(const string &name, int spaceid): |
380 | m_name(name), m_workspace(spaceid) { | 382 | m_name(name), m_workspace(spaceid) { |
@@ -403,7 +405,7 @@ void SetWorkspaceNameCmd::execute() { | |||
403 | Fluxbox::instance()->save_rc(); | 405 | Fluxbox::instance()->save_rc(); |
404 | } | 406 | } |
405 | 407 | ||
406 | REGISTER_COMMAND(setworkspacenamedialog, FbCommands::WorkspaceNameDialogCmd); | 408 | REGISTER_OBJECT(setworkspacenamedialog, FbCommands::WorkspaceNameDialogCmd, Command); |
407 | 409 | ||
408 | void WorkspaceNameDialogCmd::execute() { | 410 | void WorkspaceNameDialogCmd::execute() { |
409 | 411 | ||
@@ -416,7 +418,7 @@ void WorkspaceNameDialogCmd::execute() { | |||
416 | win->show(); | 418 | win->show(); |
417 | } | 419 | } |
418 | 420 | ||
419 | REGISTER_COMMAND(commanddialog, FbCommands::CommandDialogCmd); | 421 | REGISTER_OBJECT(commanddialog, FbCommands::CommandDialogCmd, Command); |
420 | 422 | ||
421 | void CommandDialogCmd::execute() { | 423 | void CommandDialogCmd::execute() { |
422 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | 424 | BScreen *screen = Fluxbox::instance()->mouseScreen(); |
@@ -443,7 +445,7 @@ void SetResourceValueCmd::execute() { | |||
443 | Fluxbox::instance()->save_rc(); | 445 | Fluxbox::instance()->save_rc(); |
444 | } | 446 | } |
445 | 447 | ||
446 | REGISTER_COMMAND(setresourcevaluedialog, FbCommands::SetResourceValueDialogCmd); | 448 | REGISTER_OBJECT(setresourcevaluedialog, FbCommands::SetResourceValueDialogCmd, Command); |
447 | 449 | ||
448 | void SetResourceValueDialogCmd::execute() { | 450 | void SetResourceValueDialogCmd::execute() { |
449 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | 451 | BScreen *screen = Fluxbox::instance()->mouseScreen(); |
@@ -454,7 +456,7 @@ void SetResourceValueDialogCmd::execute() { | |||
454 | win->show(); | 456 | win->show(); |
455 | }; | 457 | }; |
456 | 458 | ||
457 | REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(bindkey, FbCommands::BindKeyCmd); | 459 | REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(bindkey, FbCommands::BindKeyCmd, Command); |
458 | 460 | ||
459 | BindKeyCmd::BindKeyCmd(const string &keybind):m_keybind(keybind) { } | 461 | BindKeyCmd::BindKeyCmd(const string &keybind):m_keybind(keybind) { } |
460 | 462 | ||
@@ -502,7 +504,7 @@ FbTk::Command *DeiconifyCmd::parse(const string &command, const string &args, | |||
502 | return new DeiconifyCmd(DeiconifyCmd::LASTWORKSPACE, dest); | 504 | return new DeiconifyCmd(DeiconifyCmd::LASTWORKSPACE, dest); |
503 | } | 505 | } |
504 | 506 | ||
505 | REGISTER_COMMAND_PARSER(deiconify, DeiconifyCmd::parse); | 507 | REGISTER_OBJECT_PARSER(deiconify, DeiconifyCmd::parse, Command); |
506 | 508 | ||
507 | DeiconifyCmd::DeiconifyCmd(Mode mode, | 509 | DeiconifyCmd::DeiconifyCmd(Mode mode, |
508 | Destination dest) : m_mode(mode), m_dest(dest) { } | 510 | Destination dest) : m_mode(mode), m_dest(dest) { } |