summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-09-06 15:43:27 (GMT)
committerfluxgen <fluxgen>2003-09-06 15:43:27 (GMT)
commit39abccae4af9d290de33c7f7877f4f4af92c6db8 (patch)
tree4d313b4f1629ce3a668a24dccdcd28ae439b2af2
parentd75ac0afcc21375081000cbcb3bee763c90c8d08 (diff)
downloadfluxbox_lack-39abccae4af9d290de33c7f7877f4f4af92c6db8.zip
fluxbox_lack-39abccae4af9d290de33c7f7877f4f4af92c6db8.tar.bz2
resize command
-rw-r--r--src/CurrentWindowCmd.cc16
-rw-r--r--src/CurrentWindowCmd.hh19
-rw-r--r--src/FbCommandFactory.cc15
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 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: CurrentWindowCmd.cc,v 1.4 2003/08/19 23:37:31 fluxgen Exp $ 23// $Id: CurrentWindowCmd.cc,v 1.5 2003/09/06 15:43:27 fluxgen Exp $
24 24
25#include "CurrentWindowCmd.hh" 25#include "CurrentWindowCmd.hh"
26 26
@@ -85,13 +85,11 @@ void MoveUpCmd::real_execute() {
85 fbwindow().move(fbwindow().x(), fbwindow().y() - stepSize()); 85 fbwindow().move(fbwindow().x(), fbwindow().y() - stepSize());
86} 86}
87 87
88ResizeHorizontalCmd::ResizeHorizontalCmd(int step_size):MoveHelper(step_size) { } 88ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) :
89void ResizeHorizontalCmd::real_execute() { 89 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
90 fbwindow().resize(fbwindow().width() + stepSize() * fbwindow().winClient().width_inc, fbwindow().height());
91}
92 90
93ResizeVerticalCmd::ResizeVerticalCmd(int step_size):MoveHelper(step_size) { } 91void ResizeCmd::real_execute() {
94void ResizeVerticalCmd::real_execute() { 92 fbwindow().resize(
95 fbwindow().resize(fbwindow().width(), fbwindow().height() + stepSize() * fbwindow().winClient().height_inc); 93 fbwindow().width() + m_step_size_x * fbwindow().winClient().width_inc,
94 fbwindow().height() + m_step_size_y * fbwindow().winClient().height_inc );
96} 95}
97
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 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: CurrentWindowCmd.hh,v 1.3 2003/08/19 23:37:31 fluxgen Exp $ 23// $Id: CurrentWindowCmd.hh,v 1.4 2003/09/06 15:43:27 fluxgen Exp $
24 24
25#ifndef CURRENTWINDOWCMD_HH 25#ifndef CURRENTWINDOWCMD_HH
26#define CURRENTWINDOWCMD_HH 26#define CURRENTWINDOWCMD_HH
@@ -110,19 +110,16 @@ protected:
110 void real_execute(); 110 void real_execute();
111}; 111};
112 112
113// resize vertical
114class ResizeVerticalCmd: public MoveHelper {
115public:
116 explicit ResizeVerticalCmd(int step_size);
117protected:
118 void real_execute();
119};
120
121// resize horizontal 113// resize horizontal
122class ResizeHorizontalCmd: public MoveHelper{ 114class ResizeCmd: public WindowHelperCmd{
123public: 115public:
124 explicit ResizeHorizontalCmd(int step_size); 116 explicit ResizeCmd(int step_size_x, int step_size_y);
125protected: 117protected:
126 void real_execute(); 118 void real_execute();
119
120private:
121
122 const int m_step_size_x;
123 const int m_step_size_y;
127}; 124};
128#endif // CURRENTWINDOWCMD_HH 125#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 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: FbCommandFactory.cc,v 1.14 2003/08/30 11:59:29 fluxgen Exp $ 23// $Id: FbCommandFactory.cc,v 1.15 2003/09/06 15:43:27 fluxgen Exp $
24 24
25#include "FbCommandFactory.hh" 25#include "FbCommandFactory.hh"
26 26
@@ -32,6 +32,8 @@
32#include "SimpleCommand.hh" 32#include "SimpleCommand.hh"
33#include "Screen.hh" 33#include "Screen.hh"
34 34
35#include <sstream>
36
35// autoregister this module to command parser 37// autoregister this module to command parser
36FbCommandFactory FbCommandFactory::s_autoreg; 38FbCommandFactory FbCommandFactory::s_autoreg;
37 39
@@ -72,6 +74,7 @@ FbCommandFactory::FbCommandFactory() {
72 "quit", 74 "quit",
73 "raise", 75 "raise",
74 "reconfigure", 76 "reconfigure",
77 "resize",
75 "resizehorizontal", 78 "resizehorizontal",
76 "resizevertical", 79 "resizevertical",
77 "restart", 80 "restart",
@@ -129,10 +132,16 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
129 return new CurrentWindowCmd(&FluxboxWindow::maximizeVertical); 132 return new CurrentWindowCmd(&FluxboxWindow::maximizeVertical);
130 else if (command == "maximizehorizontal") 133 else if (command == "maximizehorizontal")
131 return new CurrentWindowCmd(&FluxboxWindow::maximizeHorizontal); 134 return new CurrentWindowCmd(&FluxboxWindow::maximizeHorizontal);
135 else if (command == "resize") {
136 std::istringstream is(arguments);
137 int dx = 0, dy = 0;
138 is >> dx >> dy;
139 return new ResizeCmd(dx, dy);
140 }
132 else if (command == "resizehorizontal") 141 else if (command == "resizehorizontal")
133 return new ResizeHorizontalCmd(atoi(arguments.c_str())); 142 return new ResizeCmd(atoi(arguments.c_str()),0);
134 else if (command == "resizevertical") 143 else if (command == "resizevertical")
135 return new ResizeVerticalCmd(atoi(arguments.c_str())); 144 return new ResizeCmd(0,atoi(arguments.c_str()));
136 else if (command == "moveright") 145 else if (command == "moveright")
137 return new MoveRightCmd(atoi(arguments.c_str())); 146 return new MoveRightCmd(atoi(arguments.c_str()));
138 else if (command == "moveleft") 147 else if (command == "moveleft")