resize command

This commit is contained in:
fluxgen 2003-09-06 15:43:27 +00:00
parent d75ac0afcc
commit 39abccae4a
3 changed files with 27 additions and 23 deletions

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "CurrentWindowCmd.hh"
@ -85,13 +85,11 @@ void MoveUpCmd::real_execute() {
fbwindow().move(fbwindow().x(), fbwindow().y() - stepSize()); fbwindow().move(fbwindow().x(), fbwindow().y() - stepSize());
} }
ResizeHorizontalCmd::ResizeHorizontalCmd(int step_size):MoveHelper(step_size) { } ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) :
void ResizeHorizontalCmd::real_execute() { m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
fbwindow().resize(fbwindow().width() + stepSize() * fbwindow().winClient().width_inc, fbwindow().height());
}
ResizeVerticalCmd::ResizeVerticalCmd(int step_size):MoveHelper(step_size) { } void ResizeCmd::real_execute() {
void ResizeVerticalCmd::real_execute() { fbwindow().resize(
fbwindow().resize(fbwindow().width(), fbwindow().height() + stepSize() * fbwindow().winClient().height_inc); fbwindow().width() + m_step_size_x * fbwindow().winClient().width_inc,
fbwindow().height() + m_step_size_y * fbwindow().winClient().height_inc );
} }

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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 #ifndef CURRENTWINDOWCMD_HH
#define CURRENTWINDOWCMD_HH #define CURRENTWINDOWCMD_HH
@ -110,19 +110,16 @@ protected:
void real_execute(); void real_execute();
}; };
// resize vertical
class ResizeVerticalCmd: public MoveHelper {
public:
explicit ResizeVerticalCmd(int step_size);
protected:
void real_execute();
};
// resize horizontal // resize horizontal
class ResizeHorizontalCmd: public MoveHelper{ class ResizeCmd: public WindowHelperCmd{
public: public:
explicit ResizeHorizontalCmd(int step_size); explicit ResizeCmd(int step_size_x, int step_size_y);
protected: protected:
void real_execute(); void real_execute();
private:
const int m_step_size_x;
const int m_step_size_y;
}; };
#endif // CURRENTWINDOWCMD_HH #endif // CURRENTWINDOWCMD_HH

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "FbCommandFactory.hh"
@ -32,6 +32,8 @@
#include "SimpleCommand.hh" #include "SimpleCommand.hh"
#include "Screen.hh" #include "Screen.hh"
#include <sstream>
// autoregister this module to command parser // autoregister this module to command parser
FbCommandFactory FbCommandFactory::s_autoreg; FbCommandFactory FbCommandFactory::s_autoreg;
@ -72,6 +74,7 @@ FbCommandFactory::FbCommandFactory() {
"quit", "quit",
"raise", "raise",
"reconfigure", "reconfigure",
"resize",
"resizehorizontal", "resizehorizontal",
"resizevertical", "resizevertical",
"restart", "restart",
@ -129,10 +132,16 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
return new CurrentWindowCmd(&FluxboxWindow::maximizeVertical); return new CurrentWindowCmd(&FluxboxWindow::maximizeVertical);
else if (command == "maximizehorizontal") else if (command == "maximizehorizontal")
return new CurrentWindowCmd(&FluxboxWindow::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") else if (command == "resizehorizontal")
return new ResizeHorizontalCmd(atoi(arguments.c_str())); return new ResizeCmd(atoi(arguments.c_str()),0);
else if (command == "resizevertical") else if (command == "resizevertical")
return new ResizeVerticalCmd(atoi(arguments.c_str())); return new ResizeCmd(0,atoi(arguments.c_str()));
else if (command == "moveright") else if (command == "moveright")
return new MoveRightCmd(atoi(arguments.c_str())); return new MoveRightCmd(atoi(arguments.c_str()));
else if (command == "moveleft") else if (command == "moveleft")