diff options
Diffstat (limited to 'src/Workspacemenu.cc')
-rw-r--r-- | src/Workspacemenu.cc | 82 |
1 files changed, 37 insertions, 45 deletions
diff --git a/src/Workspacemenu.cc b/src/Workspacemenu.cc index 29033fa..16802f6 100644 --- a/src/Workspacemenu.cc +++ b/src/Workspacemenu.cc | |||
@@ -1,3 +1,5 @@ | |||
1 | // Workspacemenu.cc for Fluxbox | ||
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org) | ||
1 | // Workspacemenu.cc for Blackbox - an X11 Window manager | 3 | // Workspacemenu.cc for Blackbox - an X11 Window manager |
2 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | 4 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) |
3 | // | 5 | // |
@@ -19,66 +21,56 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 22 | // DEALINGS IN THE SOFTWARE. |
21 | 23 | ||
22 | // stupid macros needed to access some functions in version 2 of the GNU C | 24 | // $Id: Workspacemenu.cc,v 1.8 2002/08/14 22:57:55 fluxgen Exp $ |
23 | // library | ||
24 | #ifndef _GNU_SOURCE | ||
25 | #define _GNU_SOURCE | ||
26 | #endif // _GNU_SOURCE | ||
27 | 25 | ||
28 | #ifdef HAVE_CONFIG_H | 26 | #include "Workspacemenu.hh" |
29 | # include "../config.h" | ||
30 | #endif // HAVE_CONFIG_H | ||
31 | 27 | ||
32 | #include "i18n.hh" | 28 | #include "i18n.hh" |
33 | #include "fluxbox.hh" | ||
34 | #include "Screen.hh" | 29 | #include "Screen.hh" |
35 | #include "Toolbar.hh" | ||
36 | #include "Workspacemenu.hh" | ||
37 | #include "Workspace.hh" | 30 | #include "Workspace.hh" |
38 | 31 | ||
32 | //use GNU extension | ||
33 | #ifndef _GNU_SOURCE | ||
34 | #define _GNU_SOURCE | ||
35 | #endif // _GNU_SOURCE | ||
36 | |||
37 | #ifdef HAVE_CONFIG_H | ||
38 | #include "../config.h" | ||
39 | #endif // HAVE_CONFIG_H | ||
40 | |||
41 | #include <iostream> | ||
42 | #include <cassert> | ||
39 | 43 | ||
40 | Workspacemenu::Workspacemenu(BScreen *scrn) : Basemenu(scrn) { | 44 | Workspacemenu::Workspacemenu(BScreen *scrn) : Basemenu(scrn) { |
41 | screen = scrn; | ||
42 | 45 | ||
43 | setInternalMenu(); | 46 | setInternalMenu(); |
44 | I18n *i18n = I18n::instance(); | 47 | I18n *i18n = I18n::instance(); |
45 | 48 | using namespace FBNLS; | |
46 | setLabel(i18n->getMessage( | 49 | setLabel(i18n->getMessage( |
47 | #ifdef NLS | 50 | WorkspacemenuSet, WorkspacemenuWorkspacesTitle, |
48 | WorkspacemenuSet, WorkspacemenuWorkspacesTitle, | 51 | "Workspaces")); |
49 | #else // !NLS | ||
50 | 0, 0, | ||
51 | #endif // NLS | ||
52 | "Workspaces")); | ||
53 | |||
54 | insert(i18n->getMessage( | 52 | insert(i18n->getMessage( |
55 | #ifdef NLS | 53 | WorkspacemenuSet, WorkspacemenuNewWorkspace, |
56 | WorkspacemenuSet, WorkspacemenuNewWorkspace, | 54 | "New Workspace")); |
57 | #else // !NLS | ||
58 | 0, 0, | ||
59 | #endif // NLS | ||
60 | "New Workspace")); | ||
61 | insert(i18n->getMessage( | 55 | insert(i18n->getMessage( |
62 | #ifdef NLS | 56 | WorkspacemenuSet, WorkspacemenuRemoveLast, |
63 | WorkspacemenuSet, WorkspacemenuRemoveLast, | 57 | "Remove Last")); |
64 | #else // !NLS | ||
65 | 0, 0, | ||
66 | #endif // NLS | ||
67 | "Remove Last")); | ||
68 | } | 58 | } |
69 | 59 | ||
70 | 60 | ||
71 | void Workspacemenu::itemSelected(int button, int index) { | 61 | void Workspacemenu::itemSelected(int button, unsigned int index) { |
72 | if (button == 1) { | 62 | if (button == 1) { |
73 | if (index == 0) | 63 | if (index == 0) |
74 | screen->addWorkspace(); | 64 | screen()->addWorkspace(); |
75 | else if (index == 1) | 65 | else if (index == 1) |
76 | screen->removeLastWorkspace(); | 66 | screen()->removeLastWorkspace(); |
77 | else if ((screen->getCurrentWorkspace()->getWorkspaceID() != | 67 | else if ((screen()->getCurrentWorkspace()->workspaceID() != |
78 | (index - 2)) && ((index - 2) < screen->getCount())) | 68 | (index - 2)) && ((index - 2) < screen()->getCount())) { |
79 | screen->changeWorkspaceID(index - 2); | 69 | screen()->changeWorkspaceID(index - 2); |
80 | 70 | } | |
81 | if (! (screen->getWorkspacemenu()->isTorn() || isTorn())) | 71 | |
82 | hide(); | 72 | if (! (screen()->getWorkspacemenu()->isTorn() || isTorn())) |
83 | } | 73 | hide(); |
74 | } | ||
84 | } | 75 | } |
76 | |||