clean up
fluxgen fluxgen
2 files changed,
33 insertions(+),
42 deletions(-)
M
src/Workspace.cc
→
src/Workspace.cc
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Workspace.cc,v 1.17 2002/04/04 11:28:19 fluxgen Exp $ +// $Id: Workspace.cc,v 1.18 2002/04/09 23:18:12 fluxgen Exp $ // use GNU extensions #ifndef _GNU_SOURCE@@ -58,23 +58,18 @@ #include <algorithm>
#include <iostream> using namespace std; -#ifdef DEBUG -#include <iostream> -using namespace std; -#endif - Workspace::Workspace(BScreen *scrn, unsigned int i): screen(scrn), lastfocus(0), -name(""), -id(i), +m_name(""), +m_id(i), cascade_x(32), cascade_y(32) { clientmenu = new Clientmenu(this); char *tmp; - screen->getNameOfWorkspace(id, &tmp); + screen->getNameOfWorkspace(m_id, &tmp); setName(tmp); if (tmp)@@ -94,7 +89,7 @@
if (place) placeWindow(w); - w->setWorkspace(id); + w->setWorkspace(m_id); w->setWindowNumber(windowList.size()); stackingList.push_front(w);@@ -118,7 +113,7 @@
clientmenu->insert(w->getTitle().c_str()); clientmenu->update(); - screen->updateNetizenWindowAdd(w->getClientWindow(), id); + screen->updateNetizenWindowAdd(w->getClientWindow(), m_id); raiseWindow(w);@@ -310,7 +305,7 @@ }
} -FluxboxWindow *Workspace::getWindow(unsigned int index) { +FluxboxWindow *Workspace::getWindow(unsigned int index) const{ if (index < windowList.size()) return windowList[index];@@ -318,7 +313,7 @@ return 0;
} -const int Workspace::getCount(void) { +const int Workspace::getCount(void) const { return windowList.size(); }@@ -329,36 +324,36 @@ screen->getToolbar()->redrawWindowLabel(True);
} -bool Workspace::isCurrent(void) { - return (id == screen->getCurrentWorkspaceID()); +bool Workspace::isCurrent(void) const{ + return (m_id == screen->getCurrentWorkspaceID()); } -bool Workspace::isLastWindow(FluxboxWindow *w) { +bool Workspace::isLastWindow(FluxboxWindow *w) const{ return (w == windowList.back()); } void Workspace::setCurrent(void) { - screen->changeWorkspaceID(id); + screen->changeWorkspaceID(m_id); } -void Workspace::setName(char *new_name) { +void Workspace::setName(const char *name) { - if (new_name) { - name = new_name; - } else { + if (name) { + m_name = name; + } else { //if name == 0 then set default name from nls char tname[128]; sprintf(tname, I18n::instance()-> getMessage( FBNLS::WorkspaceSet, FBNLS::WorkspaceDefaultNameFormat, - "Workspace %d"), id + 1); - name = tname; + "Workspace %d"), m_id + 1); //m_id starts at 0 + m_name = tname; } screen->updateWorkspaceNamesAtom(); - clientmenu->setLabel(name.c_str()); + clientmenu->setLabel(m_name.c_str()); clientmenu->update(); }
M
src/Workspace.hh
→
src/Workspace.hh
@@ -42,23 +42,23 @@ class Workspace {
public: typedef std::vector<FluxboxWindow *> Windows; - Workspace(BScreen *, unsigned int = 0); + Workspace(BScreen *screen, unsigned int workspaceid= 0); ~Workspace(void); - inline BScreen *getScreen(void) { return screen; } - inline FluxboxWindow *getLastFocusedWindow(void) { return lastfocus; } - inline Clientmenu *getMenu(void) { return clientmenu; } - inline const char *getName(void) const { return name.c_str(); } - inline const unsigned int getWorkspaceID(void) const { return id; } + inline BScreen *getScreen(void) const { return screen; } + inline FluxboxWindow *getLastFocusedWindow(void) const { return lastfocus; } + inline Clientmenu *menu(void) const { return clientmenu; } + inline const std::string &name(void) const { return m_name; } + inline const unsigned int workspaceID(void) const { return m_id; } inline void setLastFocusedWindow(FluxboxWindow *w) { lastfocus = w; } - FluxboxWindow *getWindow(unsigned int id); + FluxboxWindow *getWindow(unsigned int id) const; inline Windows &getWindowList() { return windowList; } - bool isCurrent(void); - bool isLastWindow(FluxboxWindow *); - const int addWindow(FluxboxWindow *, bool = False); + bool isCurrent(void) const; + bool isLastWindow(FluxboxWindow *window) const; + const int addWindow(FluxboxWindow *window, bool place = false); const int removeWindow(FluxboxWindow *); - const int getCount(void); - + const int getCount(void) const; + void setName(const char *name); void showAll(void); void hideAll(void); void removeAll(void);@@ -67,7 +67,6 @@ void lowerWindow(FluxboxWindow *);
void reconfigure(); void update(); void setCurrent(void); - void setName(char *); void shutdown(void); private:@@ -81,16 +80,13 @@
WindowStack stackingList; Windows windowList; - std::string name; - unsigned int id; + std::string m_name; + unsigned int m_id; int cascade_x, cascade_y; protected: void placeWindow(FluxboxWindow *); - - - };