From 9c35bbdd40ada59658feb9b98535f77a473bbaa5 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sat, 25 Oct 2003 22:11:22 +0000 Subject: added resizeto and moveto commands --- src/CurrentWindowCmd.cc | 20 +++++++++++++++++++- src/CurrentWindowCmd.hh | 29 +++++++++++++++++++++++++++-- src/FbCommandFactory.cc | 16 +++++++++++++++- 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index 4f49362..37e4782 100644 --- a/src/CurrentWindowCmd.cc +++ b/src/CurrentWindowCmd.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: CurrentWindowCmd.cc,v 1.6 2003/09/10 14:07:48 fluxgen Exp $ +// $Id: CurrentWindowCmd.cc,v 1.7 2003/10/25 22:11:22 fluxgen Exp $ #include "CurrentWindowCmd.hh" @@ -80,3 +80,21 @@ void ResizeCmd::real_execute() { fbwindow().width() + m_step_size_x * fbwindow().winClient().width_inc, fbwindow().height() + m_step_size_y * fbwindow().winClient().height_inc ); } + +MoveToCmd::MoveToCmd(const int step_size_x, const int step_size_y) : + m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } + +void MoveToCmd::real_execute() { + fbwindow().move( + m_step_size_x, + m_step_size_y ); +} + +ResizeToCmd::ResizeToCmd(const int step_size_x, const int step_size_y) : + m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } + +void ResizeToCmd::real_execute() { + fbwindow().resize( + m_step_size_x * fbwindow().winClient().width_inc, + m_step_size_y * fbwindow().winClient().height_inc ); +} diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh index 18bcc45..c4c559b 100644 --- a/src/CurrentWindowCmd.hh +++ b/src/CurrentWindowCmd.hh @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: CurrentWindowCmd.hh,v 1.5 2003/09/10 14:07:48 fluxgen Exp $ +// $Id: CurrentWindowCmd.hh,v 1.6 2003/10/25 22:11:22 fluxgen Exp $ #ifndef CURRENTWINDOWCMD_HH #define CURRENTWINDOWCMD_HH @@ -69,6 +69,7 @@ private: const int m_workspace_num; }; +// move cmd, relative position class MoveCmd: public WindowHelperCmd { public: explicit MoveCmd(const int step_size_x, const int step_size_y); @@ -80,7 +81,7 @@ private: const int m_step_size_y; }; -// resize cmd +// resize cmd, relative size class ResizeCmd: public WindowHelperCmd{ public: explicit ResizeCmd(int step_size_x, int step_size_y); @@ -92,4 +93,28 @@ private: const int m_step_size_x; const int m_step_size_y; }; + +class MoveToCmd: public WindowHelperCmd { +public: + explicit MoveToCmd(const int step_size_x, const int step_size_y); +protected: + void real_execute(); + +private: + const int m_step_size_x; + const int m_step_size_y; +}; + +// resize cmd +class ResizeToCmd: public WindowHelperCmd{ +public: + explicit ResizeToCmd(int step_size_x, int step_size_y); +protected: + void real_execute(); + +private: + + const int m_step_size_x; + const int m_step_size_y; +}; #endif // CURRENTWINDOWCMD_HH diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc index 8e0a1fd..b0b5976 100644 --- a/src/FbCommandFactory.cc +++ b/src/FbCommandFactory.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbCommandFactory.cc,v 1.18 2003/09/29 14:22:07 fluxgen Exp $ +// $Id: FbCommandFactory.cc,v 1.19 2003/10/25 22:11:22 fluxgen Exp $ #include "FbCommandFactory.hh" @@ -62,6 +62,7 @@ FbCommandFactory::FbCommandFactory() { "maximizewindow", "minimize", "minimizewindow", + "moveto", "move", "movedown", "moveleft", @@ -80,6 +81,7 @@ FbCommandFactory::FbCommandFactory() { "quit", "raise", "reconfigure", + "resizeto", "resize", "resizehorizontal", "resizevertical", @@ -144,10 +146,22 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, is >> dx >> dy; return new ResizeCmd(dx, dy); } + else if (command == "resizeto") { + std::istringstream is(arguments); + int dx = 0, dy = 0; + is >> dx >> dy; + return new ResizeToCmd(dx, dy); + } else if (command == "resizehorizontal") return new ResizeCmd(atoi(arguments.c_str()),0); else if (command == "resizevertical") return new ResizeCmd(0,atoi(arguments.c_str())); + else if (command == "moveto") { + std::istringstream is(arguments); + int dx = 0, dy = 0; + is >> dx >> dy; + return new MoveToCmd(dx,dy); + } else if (command == "move") { std::istringstream is(arguments); int dx = 0, dy = 0; -- cgit v0.11.2