add remembering of layer

This commit is contained in:
rathnor 2003-04-26 13:47:53 +00:00
parent 033f79b1d8
commit df8a780df1
3 changed files with 34 additions and 2 deletions

View file

@ -1,6 +1,8 @@
(Format: Year/Month/Day)
Changes for 0.9.2:
*03/04/26:
* Add remember layer (Simon)
Remember.hh/cc
* Add remember patch integration code (Simon)
- note: does not include "startup" menu
- save on close disabled atm, due to other issues...

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: Remember.cc,v 1.5 2003/04/26 13:14:37 fluxgen Exp $
// $Id: Remember.cc,v 1.6 2003/04/26 13:47:53 rathnor Exp $
#include "Remember.hh"
#include "StringUtil.hh"
@ -117,6 +117,8 @@ FbTk::Menu *createRememberMenu(Remember &remember, FluxboxWindow &win) {
Remember::REM_DECOSTATE));
menu->insert(new RememberMenuItem("Shaded", remember, win,
Remember::REM_SHADEDSTATE));
menu->insert(new RememberMenuItem("Layer", remember, win,
Remember::REM_LAYER));
// menu->insert(new RememberMenuItem("Tab", remember, win,
// Remember::REM_TABSTATE));
menu->insert(new RememberMenuItem("Save on close", remember, win,
@ -161,6 +163,7 @@ Application::Application() {
shadedstate_remember =
tabstate_remember =
jumpworkspace_remember =
layer_remember =
save_on_close_remember = false;
}
@ -222,6 +225,11 @@ int Remember::parseApp(ifstream &file, Application *a) {
istringstream iss(str_label.c_str());
iss >> w;
a->rememberWorkspace(w);
} else if (str_key == "Layer") {
unsigned int l;
istringstream iss(str_label.c_str());
iss >> l;
a->rememberLayer(l);
} else if (str_key == "Dimensions") {
unsigned int h,w;
istringstream iss(str_label.c_str());
@ -386,6 +394,9 @@ void Remember::save() {
if (a->jumpworkspace_remember) {
apps_file << " [Jump]\t{" << ((a->jumpworkspace)?"yes":"no") << "}" << endl;
}
if (a->layer_remember) {
apps_file << " [Layer]\t{" << a->layer << "}" << endl;
}
if (a->save_on_close_remember) {
apps_file << " [Close]\t{" << ((a->save_on_close)?"yes":"no") << "}" << endl;
}
@ -421,6 +432,9 @@ bool Remember::isRemembered(WinClient &winclient, Attribute attrib) {
case REM_JUMPWORKSPACE:
return app->jumpworkspace_remember;
break;
case REM_LAYER:
return app->layer_remember;
break;
case REM_SAVEONCLOSE:
return app->save_on_close_remember;
break;
@ -462,6 +476,9 @@ void Remember::rememberAttrib(WinClient &winclient, Attribute attrib) {
case REM_JUMPWORKSPACE:
app->rememberJumpworkspace(true);
break;
case REM_LAYER:
app->rememberLayer(win->getLayerNum());
break;
case REM_SAVEONCLOSE:
app->rememberSaveOnClose(true);
break;
@ -504,6 +521,9 @@ void Remember::forgetAttrib(WinClient &winclient, Attribute attrib) {
case REM_JUMPWORKSPACE:
app->forgetJumpworkspace();
break;
case REM_LAYER:
app->forgetLayer();
break;
case REM_SAVEONCLOSE:
app->forgetSaveOnClose();
break;
@ -558,6 +578,9 @@ void Remember::setupWindow(FluxboxWindow &win) {
!win.isStuck() && app->stuckstate)
win.stick(); // toggles
if (app->layer_remember)
win.moveToLayer(app->layer);
// add the menu, this -2 is somewhat dodgy... :-/
// TODO: nls
win.getWindowmenu().insert("Remember...",

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: Remember.hh,v 1.3 2003/04/26 12:44:53 fluxgen Exp $
// $Id: Remember.hh,v 1.4 2003/04/26 13:47:53 rathnor Exp $
/* Based on the original "Remember patch" by Xavier Brouckaert */
@ -44,6 +44,7 @@ public:
inline void forgetDecostate() { decostate_remember = false; }
inline void forgetStuckstate() { stuckstate_remember = false; }
inline void forgetJumpworkspace() { jumpworkspace_remember = false; }
inline void forgetLayer() { layer_remember = false; }
inline void forgetSaveOnClose() { save_on_close_remember = false; }
inline void rememberWorkspace(int ws)
@ -62,6 +63,8 @@ public:
{ stuckstate = state; stuckstate_remember = true; }
inline void rememberJumpworkspace(bool state)
{ jumpworkspace = state; jumpworkspace_remember = true; }
inline void rememberLayer(int layernum)
{ layer = layernum; layer_remember = true; }
inline void rememberSaveOnClose(bool state)
{ save_on_close = state; save_on_close_remember = true; }
@ -90,6 +93,9 @@ public:
bool jumpworkspace_remember;
bool jumpworkspace;
bool layer_remember;
int layer;
bool save_on_close_remember;
bool save_on_close;
};
@ -116,6 +122,7 @@ public:
REM_DECOSTATE,
REM_SHADEDSTATE,
//REM_TABSTATE, ... external tabs disabled atm
REM_LAYER,
REM_JUMPWORKSPACE,
REM_SAVEONCLOSE,
REM_LASTATTRIB // not actually used