diff options
author | rathnor <rathnor> | 2003-04-26 13:47:53 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-04-26 13:47:53 (GMT) |
commit | df8a780df164e4ed3b69a53a49686f51f2e96c04 (patch) | |
tree | a26778730279ebb06182f2752ae5d52d11268e74 | |
parent | 033f79b1d8c346331042095c4eced4485f528a1f (diff) | |
download | fluxbox-df8a780df164e4ed3b69a53a49686f51f2e96c04.zip fluxbox-df8a780df164e4ed3b69a53a49686f51f2e96c04.tar.bz2 |
add remembering of layer
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/Remember.cc | 25 | ||||
-rw-r--r-- | src/Remember.hh | 9 |
3 files changed, 34 insertions, 2 deletions
@@ -1,6 +1,8 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 0.9.2: | 2 | Changes for 0.9.2: |
3 | *03/04/26: | 3 | *03/04/26: |
4 | * Add remember layer (Simon) | ||
5 | Remember.hh/cc | ||
4 | * Add remember patch integration code (Simon) | 6 | * Add remember patch integration code (Simon) |
5 | - note: does not include "startup" menu | 7 | - note: does not include "startup" menu |
6 | - save on close disabled atm, due to other issues... | 8 | - save on close disabled atm, due to other issues... |
diff --git a/src/Remember.cc b/src/Remember.cc index 7a2a69a..05e397e 100644 --- a/src/Remember.cc +++ b/src/Remember.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: Remember.cc,v 1.5 2003/04/26 13:14:37 fluxgen Exp $ | 23 | // $Id: Remember.cc,v 1.6 2003/04/26 13:47:53 rathnor Exp $ |
24 | 24 | ||
25 | #include "Remember.hh" | 25 | #include "Remember.hh" |
26 | #include "StringUtil.hh" | 26 | #include "StringUtil.hh" |
@@ -117,6 +117,8 @@ FbTk::Menu *createRememberMenu(Remember &remember, FluxboxWindow &win) { | |||
117 | Remember::REM_DECOSTATE)); | 117 | Remember::REM_DECOSTATE)); |
118 | menu->insert(new RememberMenuItem("Shaded", remember, win, | 118 | menu->insert(new RememberMenuItem("Shaded", remember, win, |
119 | Remember::REM_SHADEDSTATE)); | 119 | Remember::REM_SHADEDSTATE)); |
120 | menu->insert(new RememberMenuItem("Layer", remember, win, | ||
121 | Remember::REM_LAYER)); | ||
120 | // menu->insert(new RememberMenuItem("Tab", remember, win, | 122 | // menu->insert(new RememberMenuItem("Tab", remember, win, |
121 | // Remember::REM_TABSTATE)); | 123 | // Remember::REM_TABSTATE)); |
122 | menu->insert(new RememberMenuItem("Save on close", remember, win, | 124 | menu->insert(new RememberMenuItem("Save on close", remember, win, |
@@ -161,6 +163,7 @@ Application::Application() { | |||
161 | shadedstate_remember = | 163 | shadedstate_remember = |
162 | tabstate_remember = | 164 | tabstate_remember = |
163 | jumpworkspace_remember = | 165 | jumpworkspace_remember = |
166 | layer_remember = | ||
164 | save_on_close_remember = false; | 167 | save_on_close_remember = false; |
165 | } | 168 | } |
166 | 169 | ||
@@ -222,6 +225,11 @@ int Remember::parseApp(ifstream &file, Application *a) { | |||
222 | istringstream iss(str_label.c_str()); | 225 | istringstream iss(str_label.c_str()); |
223 | iss >> w; | 226 | iss >> w; |
224 | a->rememberWorkspace(w); | 227 | a->rememberWorkspace(w); |
228 | } else if (str_key == "Layer") { | ||
229 | unsigned int l; | ||
230 | istringstream iss(str_label.c_str()); | ||
231 | iss >> l; | ||
232 | a->rememberLayer(l); | ||
225 | } else if (str_key == "Dimensions") { | 233 | } else if (str_key == "Dimensions") { |
226 | unsigned int h,w; | 234 | unsigned int h,w; |
227 | istringstream iss(str_label.c_str()); | 235 | istringstream iss(str_label.c_str()); |
@@ -386,6 +394,9 @@ void Remember::save() { | |||
386 | if (a->jumpworkspace_remember) { | 394 | if (a->jumpworkspace_remember) { |
387 | apps_file << " [Jump]\t{" << ((a->jumpworkspace)?"yes":"no") << "}" << endl; | 395 | apps_file << " [Jump]\t{" << ((a->jumpworkspace)?"yes":"no") << "}" << endl; |
388 | } | 396 | } |
397 | if (a->layer_remember) { | ||
398 | apps_file << " [Layer]\t{" << a->layer << "}" << endl; | ||
399 | } | ||
389 | if (a->save_on_close_remember) { | 400 | if (a->save_on_close_remember) { |
390 | apps_file << " [Close]\t{" << ((a->save_on_close)?"yes":"no") << "}" << endl; | 401 | apps_file << " [Close]\t{" << ((a->save_on_close)?"yes":"no") << "}" << endl; |
391 | } | 402 | } |
@@ -421,6 +432,9 @@ bool Remember::isRemembered(WinClient &winclient, Attribute attrib) { | |||
421 | case REM_JUMPWORKSPACE: | 432 | case REM_JUMPWORKSPACE: |
422 | return app->jumpworkspace_remember; | 433 | return app->jumpworkspace_remember; |
423 | break; | 434 | break; |
435 | case REM_LAYER: | ||
436 | return app->layer_remember; | ||
437 | break; | ||
424 | case REM_SAVEONCLOSE: | 438 | case REM_SAVEONCLOSE: |
425 | return app->save_on_close_remember; | 439 | return app->save_on_close_remember; |
426 | break; | 440 | break; |
@@ -462,6 +476,9 @@ void Remember::rememberAttrib(WinClient &winclient, Attribute attrib) { | |||
462 | case REM_JUMPWORKSPACE: | 476 | case REM_JUMPWORKSPACE: |
463 | app->rememberJumpworkspace(true); | 477 | app->rememberJumpworkspace(true); |
464 | break; | 478 | break; |
479 | case REM_LAYER: | ||
480 | app->rememberLayer(win->getLayerNum()); | ||
481 | break; | ||
465 | case REM_SAVEONCLOSE: | 482 | case REM_SAVEONCLOSE: |
466 | app->rememberSaveOnClose(true); | 483 | app->rememberSaveOnClose(true); |
467 | break; | 484 | break; |
@@ -504,6 +521,9 @@ void Remember::forgetAttrib(WinClient &winclient, Attribute attrib) { | |||
504 | case REM_JUMPWORKSPACE: | 521 | case REM_JUMPWORKSPACE: |
505 | app->forgetJumpworkspace(); | 522 | app->forgetJumpworkspace(); |
506 | break; | 523 | break; |
524 | case REM_LAYER: | ||
525 | app->forgetLayer(); | ||
526 | break; | ||
507 | case REM_SAVEONCLOSE: | 527 | case REM_SAVEONCLOSE: |
508 | app->forgetSaveOnClose(); | 528 | app->forgetSaveOnClose(); |
509 | break; | 529 | break; |
@@ -558,6 +578,9 @@ void Remember::setupWindow(FluxboxWindow &win) { | |||
558 | !win.isStuck() && app->stuckstate) | 578 | !win.isStuck() && app->stuckstate) |
559 | win.stick(); // toggles | 579 | win.stick(); // toggles |
560 | 580 | ||
581 | if (app->layer_remember) | ||
582 | win.moveToLayer(app->layer); | ||
583 | |||
561 | // add the menu, this -2 is somewhat dodgy... :-/ | 584 | // add the menu, this -2 is somewhat dodgy... :-/ |
562 | // TODO: nls | 585 | // TODO: nls |
563 | win.getWindowmenu().insert("Remember...", | 586 | win.getWindowmenu().insert("Remember...", |
diff --git a/src/Remember.hh b/src/Remember.hh index edfa97a..59d6d22 100644 --- a/src/Remember.hh +++ b/src/Remember.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: Remember.hh,v 1.3 2003/04/26 12:44:53 fluxgen Exp $ | 23 | // $Id: Remember.hh,v 1.4 2003/04/26 13:47:53 rathnor Exp $ |
24 | 24 | ||
25 | /* Based on the original "Remember patch" by Xavier Brouckaert */ | 25 | /* Based on the original "Remember patch" by Xavier Brouckaert */ |
26 | 26 | ||
@@ -44,6 +44,7 @@ public: | |||
44 | inline void forgetDecostate() { decostate_remember = false; } | 44 | inline void forgetDecostate() { decostate_remember = false; } |
45 | inline void forgetStuckstate() { stuckstate_remember = false; } | 45 | inline void forgetStuckstate() { stuckstate_remember = false; } |
46 | inline void forgetJumpworkspace() { jumpworkspace_remember = false; } | 46 | inline void forgetJumpworkspace() { jumpworkspace_remember = false; } |
47 | inline void forgetLayer() { layer_remember = false; } | ||
47 | inline void forgetSaveOnClose() { save_on_close_remember = false; } | 48 | inline void forgetSaveOnClose() { save_on_close_remember = false; } |
48 | 49 | ||
49 | inline void rememberWorkspace(int ws) | 50 | inline void rememberWorkspace(int ws) |
@@ -62,6 +63,8 @@ public: | |||
62 | { stuckstate = state; stuckstate_remember = true; } | 63 | { stuckstate = state; stuckstate_remember = true; } |
63 | inline void rememberJumpworkspace(bool state) | 64 | inline void rememberJumpworkspace(bool state) |
64 | { jumpworkspace = state; jumpworkspace_remember = true; } | 65 | { jumpworkspace = state; jumpworkspace_remember = true; } |
66 | inline void rememberLayer(int layernum) | ||
67 | { layer = layernum; layer_remember = true; } | ||
65 | inline void rememberSaveOnClose(bool state) | 68 | inline void rememberSaveOnClose(bool state) |
66 | { save_on_close = state; save_on_close_remember = true; } | 69 | { save_on_close = state; save_on_close_remember = true; } |
67 | 70 | ||
@@ -90,6 +93,9 @@ public: | |||
90 | bool jumpworkspace_remember; | 93 | bool jumpworkspace_remember; |
91 | bool jumpworkspace; | 94 | bool jumpworkspace; |
92 | 95 | ||
96 | bool layer_remember; | ||
97 | int layer; | ||
98 | |||
93 | bool save_on_close_remember; | 99 | bool save_on_close_remember; |
94 | bool save_on_close; | 100 | bool save_on_close; |
95 | }; | 101 | }; |
@@ -116,6 +122,7 @@ public: | |||
116 | REM_DECOSTATE, | 122 | REM_DECOSTATE, |
117 | REM_SHADEDSTATE, | 123 | REM_SHADEDSTATE, |
118 | //REM_TABSTATE, ... external tabs disabled atm | 124 | //REM_TABSTATE, ... external tabs disabled atm |
125 | REM_LAYER, | ||
119 | REM_JUMPWORKSPACE, | 126 | REM_JUMPWORKSPACE, |
120 | REM_SAVEONCLOSE, | 127 | REM_SAVEONCLOSE, |
121 | REM_LASTATTRIB // not actually used | 128 | REM_LASTATTRIB // not actually used |