make Raise/LowerLayer accept integer argument for number of layers, default 2

This commit is contained in:
Mark Tiefenbruck 2009-06-28 10:15:06 -07:00
parent c1d9ae5068
commit 5f9f2475b7
7 changed files with 37 additions and 17 deletions

View file

@ -1,6 +1,8 @@
(Format: Year/Month/Day) (Format: Year/Month/Day)
Changes for 1.1.2 Changes for 1.1.2
*09/06/28: *09/06/28:
* Make Raise/LowerLayer commands accept integer argument, defualt 2 (Mark)
CurrentWindowCmd.cc/hh Window.cc/hh
* Change default toolbar head to 1 (Mark) * Change default toolbar head to 1 (Mark)
Toolbar.cc Toolbar.cc
* Add window menu and alt-tab to error case for keys file (Mark) * Add window menu and alt-tab to error case for keys file (Mark)

View file

@ -195,7 +195,7 @@ These commands ordinarily affect only the currently focused window. The
Reorder this window to the top or bottom of the window stack, within Reorder this window to the top or bottom of the window stack, within
its current layer. See 'fluxbox(1)' for a discussion of layers. its current layer. See 'fluxbox(1)' for a discussion of layers.
*RaiseLayer* / *LowerLayer*:: *RaiseLayer* / *LowerLayer* ['offset']::
Raise the window up to the layer above, or lower it to the layer Raise the window up to the layer above, or lower it to the layer
below. See 'fluxbox(1)' for a discussion of layers. below. See 'fluxbox(1)' for a discussion of layers.

View file

@ -278,7 +278,7 @@ Reorder this window to the top or bottom of the window stack, within its current
for a discussion of layers\&. for a discussion of layers\&.
.RE .RE
.PP .PP
\fBRaiseLayer\fR / \fBLowerLayer\fR \fBRaiseLayer\fR / \fBLowerLayer\fR [\fIoffset\fR]
.RS 4 .RS 4
Raise the window up to the layer above, or lower it to the layer below\&. See Raise the window up to the layer above, or lower it to the layer below\&. See
\fIfluxbox(1)\fR \fIfluxbox(1)\fR

View file

@ -52,12 +52,8 @@ FbTk::Command<void> *createCurrentWindowCmd(const std::string &command,
return new CurrentWindowCmd(&FluxboxWindow::maximizeHorizontal); return new CurrentWindowCmd(&FluxboxWindow::maximizeHorizontal);
else if (command == "raise") else if (command == "raise")
return new CurrentWindowCmd(&FluxboxWindow::raise); return new CurrentWindowCmd(&FluxboxWindow::raise);
else if (command == "raiselayer")
return new CurrentWindowCmd(&FluxboxWindow::raiseLayer);
else if (command == "lower") else if (command == "lower")
return new CurrentWindowCmd(&FluxboxWindow::lower); return new CurrentWindowCmd(&FluxboxWindow::lower);
else if (command == "lowerlayer")
return new CurrentWindowCmd(&FluxboxWindow::lowerLayer);
else if (command == "close") else if (command == "close")
return new CurrentWindowCmd(&FluxboxWindow::close); return new CurrentWindowCmd(&FluxboxWindow::close);
else if (command == "killwindow" || command == "kill") else if (command == "killwindow" || command == "kill")
@ -95,9 +91,7 @@ REGISTER_COMMAND_PARSER(maximize, createCurrentWindowCmd, void);
REGISTER_COMMAND_PARSER(maximizevertical, createCurrentWindowCmd, void); REGISTER_COMMAND_PARSER(maximizevertical, createCurrentWindowCmd, void);
REGISTER_COMMAND_PARSER(maximizehorizontal, createCurrentWindowCmd, void); REGISTER_COMMAND_PARSER(maximizehorizontal, createCurrentWindowCmd, void);
REGISTER_COMMAND_PARSER(raise, createCurrentWindowCmd, void); REGISTER_COMMAND_PARSER(raise, createCurrentWindowCmd, void);
REGISTER_COMMAND_PARSER(raiselayer, createCurrentWindowCmd, void);
REGISTER_COMMAND_PARSER(lower, createCurrentWindowCmd, void); REGISTER_COMMAND_PARSER(lower, createCurrentWindowCmd, void);
REGISTER_COMMAND_PARSER(lowerlayer, createCurrentWindowCmd, void);
REGISTER_COMMAND_PARSER(close, createCurrentWindowCmd, void); REGISTER_COMMAND_PARSER(close, createCurrentWindowCmd, void);
REGISTER_COMMAND_PARSER(killwindow, createCurrentWindowCmd, void); REGISTER_COMMAND_PARSER(killwindow, createCurrentWindowCmd, void);
REGISTER_COMMAND_PARSER(kill, createCurrentWindowCmd, void); REGISTER_COMMAND_PARSER(kill, createCurrentWindowCmd, void);
@ -466,6 +460,25 @@ void SetLayerCmd::real_execute() {
fbwindow().moveToLayer(m_layer); fbwindow().moveToLayer(m_layer);
} }
FbTk::Command<void> *ChangeLayerCmd::parse(const string &command,
const string &args, bool trusted) {
int num = 2;
FbTk_istringstream iss(args.c_str());
iss >> num;
if (command == "raiselayer")
return new ChangeLayerCmd(-num);
else if (command == "lowerlayer")
return new ChangeLayerCmd(num);
return 0;
}
REGISTER_COMMAND_PARSER(raiselayer, ChangeLayerCmd::parse, void);
REGISTER_COMMAND_PARSER(lowerlayer, ChangeLayerCmd::parse, void);
void ChangeLayerCmd::real_execute() {
fbwindow().changeLayer(m_diff);
}
namespace { namespace {
class SetTitleDialog: public TextDialog, public FbTk::Observer { class SetTitleDialog: public TextDialog, public FbTk::Observer {
public: public:

View file

@ -255,6 +255,17 @@ private:
int m_layer; int m_layer;
}; };
class ChangeLayerCmd: public WindowHelperCmd {
public:
explicit ChangeLayerCmd(int diff): m_diff(diff) { }
static FbTk::Command<void> *parse(const std::string &command,
const std::string &args, bool trusted);
protected:
void real_execute();
private:
int m_diff;
};
class MatchCmd: public WindowHelperBoolCmd { class MatchCmd: public WindowHelperBoolCmd {
public: public:
MatchCmd(const std::string &pat): m_pat(pat.c_str()) { }; MatchCmd(const std::string &pat): m_pat(pat.c_str()) { };

View file

@ -1697,15 +1697,10 @@ void FluxboxWindow::tempRaise() {
} }
void FluxboxWindow::raiseLayer() { void FluxboxWindow::changeLayer(int diff) {
moveToLayer(m_state.layernum-1); moveToLayer(m_state.layernum+diff);
} }
void FluxboxWindow::lowerLayer() {
moveToLayer(m_state.layernum+1);
}
void FluxboxWindow::moveToLayer(int layernum, bool force) { void FluxboxWindow::moveToLayer(int layernum, bool force) {
#ifdef DEBUG #ifdef DEBUG
cerr<<"FluxboxWindow("<<title()<<")::moveToLayer("<<layernum<<")"<<endl; cerr<<"FluxboxWindow("<<title()<<")::moveToLayer("<<layernum<<")"<<endl;

View file

@ -243,8 +243,7 @@ public:
void raise(); void raise();
void lower(); void lower();
void tempRaise(); void tempRaise();
void raiseLayer(); void changeLayer(int diff);
void lowerLayer();
/// moves the window to a new layer /// moves the window to a new layer
void moveToLayer(int layernum, bool force = false); void moveToLayer(int layernum, bool force = false);
int getOnHead() const; int getOnHead() const;