diff options
author | fluxgen <fluxgen> | 2002-04-09 23:18:12 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-04-09 23:18:12 (GMT) |
commit | bd7951bcdad7e1c4dd6b5ff267cb85fc8cbf6d7e (patch) | |
tree | 054a577207b64aa174213afd6024ab039cb3a4be /src | |
parent | 8afd178252147739025779bc8db906cabea488fe (diff) | |
download | fluxbox-bd7951bcdad7e1c4dd6b5ff267cb85fc8cbf6d7e.zip fluxbox-bd7951bcdad7e1c4dd6b5ff267cb85fc8cbf6d7e.tar.bz2 |
clean up
Diffstat (limited to 'src')
-rw-r--r-- | src/Workspace.cc | 43 | ||||
-rw-r--r-- | src/Workspace.hh | 32 |
2 files changed, 33 insertions, 42 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc index 6b93c5d..3f57e37 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Workspace.cc,v 1.17 2002/04/04 11:28:19 fluxgen Exp $ | 25 | // $Id: Workspace.cc,v 1.18 2002/04/09 23:18:12 fluxgen Exp $ |
26 | 26 | ||
27 | // use GNU extensions | 27 | // use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -58,23 +58,18 @@ | |||
58 | #include <iostream> | 58 | #include <iostream> |
59 | using namespace std; | 59 | using namespace std; |
60 | 60 | ||
61 | #ifdef DEBUG | ||
62 | #include <iostream> | ||
63 | using namespace std; | ||
64 | #endif | ||
65 | |||
66 | Workspace::Workspace(BScreen *scrn, unsigned int i): | 61 | Workspace::Workspace(BScreen *scrn, unsigned int i): |
67 | screen(scrn), | 62 | screen(scrn), |
68 | lastfocus(0), | 63 | lastfocus(0), |
69 | name(""), | 64 | m_name(""), |
70 | id(i), | 65 | m_id(i), |
71 | cascade_x(32), cascade_y(32) | 66 | cascade_x(32), cascade_y(32) |
72 | { | 67 | { |
73 | 68 | ||
74 | clientmenu = new Clientmenu(this); | 69 | clientmenu = new Clientmenu(this); |
75 | 70 | ||
76 | char *tmp; | 71 | char *tmp; |
77 | screen->getNameOfWorkspace(id, &tmp); | 72 | screen->getNameOfWorkspace(m_id, &tmp); |
78 | setName(tmp); | 73 | setName(tmp); |
79 | 74 | ||
80 | if (tmp) | 75 | if (tmp) |
@@ -94,7 +89,7 @@ const int Workspace::addWindow(FluxboxWindow *w, bool place) { | |||
94 | if (place) | 89 | if (place) |
95 | placeWindow(w); | 90 | placeWindow(w); |
96 | 91 | ||
97 | w->setWorkspace(id); | 92 | w->setWorkspace(m_id); |
98 | w->setWindowNumber(windowList.size()); | 93 | w->setWindowNumber(windowList.size()); |
99 | 94 | ||
100 | stackingList.push_front(w); | 95 | stackingList.push_front(w); |
@@ -118,7 +113,7 @@ const int Workspace::addWindow(FluxboxWindow *w, bool place) { | |||
118 | clientmenu->insert(w->getTitle().c_str()); | 113 | clientmenu->insert(w->getTitle().c_str()); |
119 | clientmenu->update(); | 114 | clientmenu->update(); |
120 | 115 | ||
121 | screen->updateNetizenWindowAdd(w->getClientWindow(), id); | 116 | screen->updateNetizenWindowAdd(w->getClientWindow(), m_id); |
122 | 117 | ||
123 | raiseWindow(w); | 118 | raiseWindow(w); |
124 | 119 | ||
@@ -310,7 +305,7 @@ void Workspace::reconfigure(void) { | |||
310 | } | 305 | } |
311 | 306 | ||
312 | 307 | ||
313 | FluxboxWindow *Workspace::getWindow(unsigned int index) { | 308 | FluxboxWindow *Workspace::getWindow(unsigned int index) const{ |
314 | if (index < windowList.size()) | 309 | if (index < windowList.size()) |
315 | return windowList[index]; | 310 | return windowList[index]; |
316 | 311 | ||
@@ -318,7 +313,7 @@ FluxboxWindow *Workspace::getWindow(unsigned int index) { | |||
318 | } | 313 | } |
319 | 314 | ||
320 | 315 | ||
321 | const int Workspace::getCount(void) { | 316 | const int Workspace::getCount(void) const { |
322 | return windowList.size(); | 317 | return windowList.size(); |
323 | } | 318 | } |
324 | 319 | ||
@@ -329,36 +324,36 @@ void Workspace::update(void) { | |||
329 | } | 324 | } |
330 | 325 | ||
331 | 326 | ||
332 | bool Workspace::isCurrent(void) { | 327 | bool Workspace::isCurrent(void) const{ |
333 | return (id == screen->getCurrentWorkspaceID()); | 328 | return (m_id == screen->getCurrentWorkspaceID()); |
334 | } | 329 | } |
335 | 330 | ||
336 | 331 | ||
337 | bool Workspace::isLastWindow(FluxboxWindow *w) { | 332 | bool Workspace::isLastWindow(FluxboxWindow *w) const{ |
338 | return (w == windowList.back()); | 333 | return (w == windowList.back()); |
339 | } | 334 | } |
340 | 335 | ||
341 | void Workspace::setCurrent(void) { | 336 | void Workspace::setCurrent(void) { |
342 | screen->changeWorkspaceID(id); | 337 | screen->changeWorkspaceID(m_id); |
343 | } | 338 | } |
344 | 339 | ||
345 | 340 | ||
346 | void Workspace::setName(char *new_name) { | 341 | void Workspace::setName(const char *name) { |
347 | 342 | ||
348 | if (new_name) { | 343 | if (name) { |
349 | name = new_name; | 344 | m_name = name; |
350 | } else { | 345 | } else { //if name == 0 then set default name from nls |
351 | char tname[128]; | 346 | char tname[128]; |
352 | sprintf(tname, I18n::instance()-> | 347 | sprintf(tname, I18n::instance()-> |
353 | getMessage( | 348 | getMessage( |
354 | FBNLS::WorkspaceSet, FBNLS::WorkspaceDefaultNameFormat, | 349 | FBNLS::WorkspaceSet, FBNLS::WorkspaceDefaultNameFormat, |
355 | "Workspace %d"), id + 1); | 350 | "Workspace %d"), m_id + 1); //m_id starts at 0 |
356 | name = tname; | 351 | m_name = tname; |
357 | } | 352 | } |
358 | 353 | ||
359 | screen->updateWorkspaceNamesAtom(); | 354 | screen->updateWorkspaceNamesAtom(); |
360 | 355 | ||
361 | clientmenu->setLabel(name.c_str()); | 356 | clientmenu->setLabel(m_name.c_str()); |
362 | clientmenu->update(); | 357 | clientmenu->update(); |
363 | } | 358 | } |
364 | 359 | ||
diff --git a/src/Workspace.hh b/src/Workspace.hh index f004fc5..5e4507b 100644 --- a/src/Workspace.hh +++ b/src/Workspace.hh | |||
@@ -42,23 +42,23 @@ class Workspace { | |||
42 | public: | 42 | public: |
43 | typedef std::vector<FluxboxWindow *> Windows; | 43 | typedef std::vector<FluxboxWindow *> Windows; |
44 | 44 | ||
45 | Workspace(BScreen *, unsigned int = 0); | 45 | Workspace(BScreen *screen, unsigned int workspaceid= 0); |
46 | ~Workspace(void); | 46 | ~Workspace(void); |
47 | 47 | ||
48 | inline BScreen *getScreen(void) { return screen; } | 48 | inline BScreen *getScreen(void) const { return screen; } |
49 | inline FluxboxWindow *getLastFocusedWindow(void) { return lastfocus; } | 49 | inline FluxboxWindow *getLastFocusedWindow(void) const { return lastfocus; } |
50 | inline Clientmenu *getMenu(void) { return clientmenu; } | 50 | inline Clientmenu *menu(void) const { return clientmenu; } |
51 | inline const char *getName(void) const { return name.c_str(); } | 51 | inline const std::string &name(void) const { return m_name; } |
52 | inline const unsigned int getWorkspaceID(void) const { return id; } | 52 | inline const unsigned int workspaceID(void) const { return m_id; } |
53 | inline void setLastFocusedWindow(FluxboxWindow *w) { lastfocus = w; } | 53 | inline void setLastFocusedWindow(FluxboxWindow *w) { lastfocus = w; } |
54 | FluxboxWindow *getWindow(unsigned int id); | 54 | FluxboxWindow *getWindow(unsigned int id) const; |
55 | inline Windows &getWindowList() { return windowList; } | 55 | inline Windows &getWindowList() { return windowList; } |
56 | bool isCurrent(void); | 56 | bool isCurrent(void) const; |
57 | bool isLastWindow(FluxboxWindow *); | 57 | bool isLastWindow(FluxboxWindow *window) const; |
58 | const int addWindow(FluxboxWindow *, bool = False); | 58 | const int addWindow(FluxboxWindow *window, bool place = false); |
59 | const int removeWindow(FluxboxWindow *); | 59 | const int removeWindow(FluxboxWindow *); |
60 | const int getCount(void); | 60 | const int getCount(void) const; |
61 | 61 | void setName(const char *name); | |
62 | void showAll(void); | 62 | void showAll(void); |
63 | void hideAll(void); | 63 | void hideAll(void); |
64 | void removeAll(void); | 64 | void removeAll(void); |
@@ -67,7 +67,6 @@ public: | |||
67 | void reconfigure(); | 67 | void reconfigure(); |
68 | void update(); | 68 | void update(); |
69 | void setCurrent(void); | 69 | void setCurrent(void); |
70 | void setName(char *); | ||
71 | void shutdown(void); | 70 | void shutdown(void); |
72 | 71 | ||
73 | private: | 72 | private: |
@@ -81,16 +80,13 @@ private: | |||
81 | WindowStack stackingList; | 80 | WindowStack stackingList; |
82 | Windows windowList; | 81 | Windows windowList; |
83 | 82 | ||
84 | std::string name; | 83 | std::string m_name; |
85 | unsigned int id; | 84 | unsigned int m_id; |
86 | int cascade_x, cascade_y; | 85 | int cascade_x, cascade_y; |
87 | 86 | ||
88 | 87 | ||
89 | protected: | 88 | protected: |
90 | void placeWindow(FluxboxWindow *); | 89 | void placeWindow(FluxboxWindow *); |
91 | |||
92 | |||
93 | |||
94 | }; | 90 | }; |
95 | 91 | ||
96 | 92 | ||