diff options
author | fluxgen <fluxgen> | 2003-10-25 22:11:22 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-10-25 22:11:22 (GMT) |
commit | 9c35bbdd40ada59658feb9b98535f77a473bbaa5 (patch) | |
tree | 7e01708e15e011a4a45547f1e1552866498dafd8 /src | |
parent | 4d161094576b29ca1a41e807fabb80d672fc1852 (diff) | |
download | fluxbox-9c35bbdd40ada59658feb9b98535f77a473bbaa5.zip fluxbox-9c35bbdd40ada59658feb9b98535f77a473bbaa5.tar.bz2 |
added resizeto and moveto commands
Diffstat (limited to 'src')
-rw-r--r-- | src/CurrentWindowCmd.cc | 20 | ||||
-rw-r--r-- | src/CurrentWindowCmd.hh | 29 | ||||
-rw-r--r-- | 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 @@ | |||
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.6 2003/09/10 14:07:48 fluxgen Exp $ | 23 | // $Id: CurrentWindowCmd.cc,v 1.7 2003/10/25 22:11:22 fluxgen Exp $ |
24 | 24 | ||
25 | #include "CurrentWindowCmd.hh" | 25 | #include "CurrentWindowCmd.hh" |
26 | 26 | ||
@@ -80,3 +80,21 @@ void ResizeCmd::real_execute() { | |||
80 | fbwindow().width() + m_step_size_x * fbwindow().winClient().width_inc, | 80 | fbwindow().width() + m_step_size_x * fbwindow().winClient().width_inc, |
81 | fbwindow().height() + m_step_size_y * fbwindow().winClient().height_inc ); | 81 | fbwindow().height() + m_step_size_y * fbwindow().winClient().height_inc ); |
82 | } | 82 | } |
83 | |||
84 | MoveToCmd::MoveToCmd(const int step_size_x, const int step_size_y) : | ||
85 | m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } | ||
86 | |||
87 | void MoveToCmd::real_execute() { | ||
88 | fbwindow().move( | ||
89 | m_step_size_x, | ||
90 | m_step_size_y ); | ||
91 | } | ||
92 | |||
93 | ResizeToCmd::ResizeToCmd(const int step_size_x, const int step_size_y) : | ||
94 | m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } | ||
95 | |||
96 | void ResizeToCmd::real_execute() { | ||
97 | fbwindow().resize( | ||
98 | m_step_size_x * fbwindow().winClient().width_inc, | ||
99 | m_step_size_y * fbwindow().winClient().height_inc ); | ||
100 | } | ||
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 @@ | |||
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.5 2003/09/10 14:07:48 fluxgen Exp $ | 23 | // $Id: CurrentWindowCmd.hh,v 1.6 2003/10/25 22:11:22 fluxgen Exp $ |
24 | 24 | ||
25 | #ifndef CURRENTWINDOWCMD_HH | 25 | #ifndef CURRENTWINDOWCMD_HH |
26 | #define CURRENTWINDOWCMD_HH | 26 | #define CURRENTWINDOWCMD_HH |
@@ -69,6 +69,7 @@ private: | |||
69 | const int m_workspace_num; | 69 | const int m_workspace_num; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | // move cmd, relative position | ||
72 | class MoveCmd: public WindowHelperCmd { | 73 | class MoveCmd: public WindowHelperCmd { |
73 | public: | 74 | public: |
74 | explicit MoveCmd(const int step_size_x, const int step_size_y); | 75 | explicit MoveCmd(const int step_size_x, const int step_size_y); |
@@ -80,7 +81,7 @@ private: | |||
80 | const int m_step_size_y; | 81 | const int m_step_size_y; |
81 | }; | 82 | }; |
82 | 83 | ||
83 | // resize cmd | 84 | // resize cmd, relative size |
84 | class ResizeCmd: public WindowHelperCmd{ | 85 | class ResizeCmd: public WindowHelperCmd{ |
85 | public: | 86 | public: |
86 | explicit ResizeCmd(int step_size_x, int step_size_y); | 87 | explicit ResizeCmd(int step_size_x, int step_size_y); |
@@ -92,4 +93,28 @@ private: | |||
92 | const int m_step_size_x; | 93 | const int m_step_size_x; |
93 | const int m_step_size_y; | 94 | const int m_step_size_y; |
94 | }; | 95 | }; |
96 | |||
97 | class MoveToCmd: public WindowHelperCmd { | ||
98 | public: | ||
99 | explicit MoveToCmd(const int step_size_x, const int step_size_y); | ||
100 | protected: | ||
101 | void real_execute(); | ||
102 | |||
103 | private: | ||
104 | const int m_step_size_x; | ||
105 | const int m_step_size_y; | ||
106 | }; | ||
107 | |||
108 | // resize cmd | ||
109 | class ResizeToCmd: public WindowHelperCmd{ | ||
110 | public: | ||
111 | explicit ResizeToCmd(int step_size_x, int step_size_y); | ||
112 | protected: | ||
113 | void real_execute(); | ||
114 | |||
115 | private: | ||
116 | |||
117 | const int m_step_size_x; | ||
118 | const int m_step_size_y; | ||
119 | }; | ||
95 | #endif // CURRENTWINDOWCMD_HH | 120 | #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 @@ | |||
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.18 2003/09/29 14:22:07 fluxgen Exp $ | 23 | // $Id: FbCommandFactory.cc,v 1.19 2003/10/25 22:11:22 fluxgen Exp $ |
24 | 24 | ||
25 | #include "FbCommandFactory.hh" | 25 | #include "FbCommandFactory.hh" |
26 | 26 | ||
@@ -62,6 +62,7 @@ FbCommandFactory::FbCommandFactory() { | |||
62 | "maximizewindow", | 62 | "maximizewindow", |
63 | "minimize", | 63 | "minimize", |
64 | "minimizewindow", | 64 | "minimizewindow", |
65 | "moveto", | ||
65 | "move", | 66 | "move", |
66 | "movedown", | 67 | "movedown", |
67 | "moveleft", | 68 | "moveleft", |
@@ -80,6 +81,7 @@ FbCommandFactory::FbCommandFactory() { | |||
80 | "quit", | 81 | "quit", |
81 | "raise", | 82 | "raise", |
82 | "reconfigure", | 83 | "reconfigure", |
84 | "resizeto", | ||
83 | "resize", | 85 | "resize", |
84 | "resizehorizontal", | 86 | "resizehorizontal", |
85 | "resizevertical", | 87 | "resizevertical", |
@@ -144,10 +146,22 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, | |||
144 | is >> dx >> dy; | 146 | is >> dx >> dy; |
145 | return new ResizeCmd(dx, dy); | 147 | return new ResizeCmd(dx, dy); |
146 | } | 148 | } |
149 | else if (command == "resizeto") { | ||
150 | std::istringstream is(arguments); | ||
151 | int dx = 0, dy = 0; | ||
152 | is >> dx >> dy; | ||
153 | return new ResizeToCmd(dx, dy); | ||
154 | } | ||
147 | else if (command == "resizehorizontal") | 155 | else if (command == "resizehorizontal") |
148 | return new ResizeCmd(atoi(arguments.c_str()),0); | 156 | return new ResizeCmd(atoi(arguments.c_str()),0); |
149 | else if (command == "resizevertical") | 157 | else if (command == "resizevertical") |
150 | return new ResizeCmd(0,atoi(arguments.c_str())); | 158 | return new ResizeCmd(0,atoi(arguments.c_str())); |
159 | else if (command == "moveto") { | ||
160 | std::istringstream is(arguments); | ||
161 | int dx = 0, dy = 0; | ||
162 | is >> dx >> dy; | ||
163 | return new MoveToCmd(dx,dy); | ||
164 | } | ||
151 | else if (command == "move") { | 165 | else if (command == "move") { |
152 | std::istringstream is(arguments); | 166 | std::istringstream is(arguments); |
153 | int dx = 0, dy = 0; | 167 | int dx = 0, dy = 0; |