From 39abccae4af9d290de33c7f7877f4f4af92c6db8 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sat, 6 Sep 2003 15:43:27 +0000 Subject: resize command --- src/CurrentWindowCmd.cc | 16 +++++++--------- src/CurrentWindowCmd.hh | 19 ++++++++----------- src/FbCommandFactory.cc | 15 ++++++++++++--- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index 6906926..894eaa3 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.4 2003/08/19 23:37:31 fluxgen Exp $ +// $Id: CurrentWindowCmd.cc,v 1.5 2003/09/06 15:43:27 fluxgen Exp $ #include "CurrentWindowCmd.hh" @@ -85,13 +85,11 @@ void MoveUpCmd::real_execute() { fbwindow().move(fbwindow().x(), fbwindow().y() - stepSize()); } -ResizeHorizontalCmd::ResizeHorizontalCmd(int step_size):MoveHelper(step_size) { } -void ResizeHorizontalCmd::real_execute() { - fbwindow().resize(fbwindow().width() + stepSize() * fbwindow().winClient().width_inc, fbwindow().height()); -} +ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) : + m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } -ResizeVerticalCmd::ResizeVerticalCmd(int step_size):MoveHelper(step_size) { } -void ResizeVerticalCmd::real_execute() { - fbwindow().resize(fbwindow().width(), fbwindow().height() + stepSize() * fbwindow().winClient().height_inc); +void ResizeCmd::real_execute() { + fbwindow().resize( + fbwindow().width() + m_step_size_x * fbwindow().winClient().width_inc, + fbwindow().height() + m_step_size_y * fbwindow().winClient().height_inc ); } - diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh index 7927add..05015a0 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.3 2003/08/19 23:37:31 fluxgen Exp $ +// $Id: CurrentWindowCmd.hh,v 1.4 2003/09/06 15:43:27 fluxgen Exp $ #ifndef CURRENTWINDOWCMD_HH #define CURRENTWINDOWCMD_HH @@ -110,19 +110,16 @@ protected: void real_execute(); }; -// resize vertical -class ResizeVerticalCmd: public MoveHelper { -public: - explicit ResizeVerticalCmd(int step_size); -protected: - void real_execute(); -}; - // resize horizontal -class ResizeHorizontalCmd: public MoveHelper{ +class ResizeCmd: public WindowHelperCmd{ public: - explicit ResizeHorizontalCmd(int step_size); + explicit ResizeCmd(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 bdbe305..f9e22ce 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.14 2003/08/30 11:59:29 fluxgen Exp $ +// $Id: FbCommandFactory.cc,v 1.15 2003/09/06 15:43:27 fluxgen Exp $ #include "FbCommandFactory.hh" @@ -32,6 +32,8 @@ #include "SimpleCommand.hh" #include "Screen.hh" +#include + // autoregister this module to command parser FbCommandFactory FbCommandFactory::s_autoreg; @@ -72,6 +74,7 @@ FbCommandFactory::FbCommandFactory() { "quit", "raise", "reconfigure", + "resize", "resizehorizontal", "resizevertical", "restart", @@ -129,10 +132,16 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, return new CurrentWindowCmd(&FluxboxWindow::maximizeVertical); else if (command == "maximizehorizontal") return new CurrentWindowCmd(&FluxboxWindow::maximizeHorizontal); + else if (command == "resize") { + std::istringstream is(arguments); + int dx = 0, dy = 0; + is >> dx >> dy; + return new ResizeCmd(dx, dy); + } else if (command == "resizehorizontal") - return new ResizeHorizontalCmd(atoi(arguments.c_str())); + return new ResizeCmd(atoi(arguments.c_str()),0); else if (command == "resizevertical") - return new ResizeVerticalCmd(atoi(arguments.c_str())); + return new ResizeCmd(0,atoi(arguments.c_str())); else if (command == "moveright") return new MoveRightCmd(atoi(arguments.c_str())); else if (command == "moveleft") -- cgit v0.11.2