aboutsummaryrefslogtreecommitdiff
path: root/src/Workspacemenu.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Workspacemenu.cc')
-rw-r--r--src/Workspacemenu.cc75
1 files changed, 33 insertions, 42 deletions
diff --git a/src/Workspacemenu.cc b/src/Workspacemenu.cc
index 29033fa..d13621b 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,55 @@
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.7 2002/05/07 14:05:00 fluxgen Exp $
23// library 25
26//use GNU extension
24#ifndef _GNU_SOURCE 27#ifndef _GNU_SOURCE
25#define _GNU_SOURCE 28#define _GNU_SOURCE
26#endif // _GNU_SOURCE 29#endif // _GNU_SOURCE
27 30
28#ifdef HAVE_CONFIG_H 31#ifdef HAVE_CONFIG_H
29# include "../config.h" 32#include "../config.h"
30#endif // HAVE_CONFIG_H 33#endif // HAVE_CONFIG_H
31 34
35#include "Workspacemenu.hh"
36
32#include "i18n.hh" 37#include "i18n.hh"
33#include "fluxbox.hh"
34#include "Screen.hh" 38#include "Screen.hh"
35#include "Toolbar.hh"
36#include "Workspacemenu.hh"
37#include "Workspace.hh" 39#include "Workspace.hh"
38 40#include <iostream>
41#include <cassert>
39 42
40Workspacemenu::Workspacemenu(BScreen *scrn) : Basemenu(scrn) { 43Workspacemenu::Workspacemenu(BScreen *scrn) : Basemenu(scrn) {
41 screen = scrn;
42 44
43 setInternalMenu(); 45 setInternalMenu();
44 I18n *i18n = I18n::instance(); 46 I18n *i18n = I18n::instance();
45 47 using namespace FBNLS;
46 setLabel(i18n->getMessage( 48 setLabel(i18n->getMessage(
47#ifdef NLS 49 WorkspacemenuSet, WorkspacemenuWorkspacesTitle,
48 WorkspacemenuSet, WorkspacemenuWorkspacesTitle, 50 "Workspaces"));
49#else // !NLS
50 0, 0,
51#endif // NLS
52 "Workspaces"));
53
54 insert(i18n->getMessage( 51 insert(i18n->getMessage(
55#ifdef NLS 52 WorkspacemenuSet, WorkspacemenuNewWorkspace,
56 WorkspacemenuSet, WorkspacemenuNewWorkspace, 53 "New Workspace"));
57#else // !NLS
58 0, 0,
59#endif // NLS
60 "New Workspace"));
61 insert(i18n->getMessage( 54 insert(i18n->getMessage(
62#ifdef NLS 55 WorkspacemenuSet, WorkspacemenuRemoveLast,
63 WorkspacemenuSet, WorkspacemenuRemoveLast, 56 "Remove Last"));
64#else // !NLS
65 0, 0,
66#endif // NLS
67 "Remove Last"));
68} 57}
69 58
70 59
71void Workspacemenu::itemSelected(int button, int index) { 60void Workspacemenu::itemSelected(int button, unsigned int index) {
72 if (button == 1) { 61 if (button == 1) {
73 if (index == 0) 62 if (index == 0)
74 screen->addWorkspace(); 63 screen()->addWorkspace();
75 else if (index == 1) 64 else if (index == 1)
76 screen->removeLastWorkspace(); 65 screen()->removeLastWorkspace();
77 else if ((screen->getCurrentWorkspace()->getWorkspaceID() != 66 else if ((screen()->getCurrentWorkspace()->workspaceID() !=
78 (index - 2)) && ((index - 2) < screen->getCount())) 67 (index - 2)) && ((index - 2) < screen()->getCount())) {
79 screen->changeWorkspaceID(index - 2); 68 screen()->changeWorkspaceID(index - 2);
80 69 }
81 if (! (screen->getWorkspacemenu()->isTorn() || isTorn())) 70
82 hide(); 71 if (! (screen()->getWorkspacemenu()->isTorn() || isTorn()))
83 } 72 hide();
73 }
84} 74}
75