added resizeto and moveto commands

This commit is contained in:
fluxgen 2003-10-25 22:11:22 +00:00
parent 4d16109457
commit 9c35bbdd40
3 changed files with 61 additions and 4 deletions

View file

@ -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 );
}

View file

@ -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,13 +81,37 @@ 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);
protected:
void real_execute();
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;

View file

@ -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;