diff options
author | fluxgen <fluxgen> | 2003-12-19 03:56:51 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-12-19 03:56:51 (GMT) |
commit | 63a5065d5e58e18e8f20fd53a6438413f1a5d42d (patch) | |
tree | c9309eedc2627fcdf2f9a31d09181bc908c5a3ee | |
parent | fbceff651a4e93638e7d44ab6a35ee3622793ff4 (diff) | |
download | fluxbox_pavel-63a5065d5e58e18e8f20fd53a6438413f1a5d42d.zip fluxbox_pavel-63a5065d5e58e18e8f20fd53a6438413f1a5d42d.tar.bz2 |
WorkspaceNameDialogCmd, CommandDialogCmd and changes in SetWorkspaceNameCmd
-rw-r--r-- | src/FbCommands.cc | 50 | ||||
-rw-r--r-- | src/FbCommands.hh | 16 |
2 files changed, 60 insertions, 6 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc index 1bec59a..1a1c74d 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.cc | |||
@@ -19,14 +19,16 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: FbCommands.cc,v 1.19 2003/12/19 00:47:30 fluxgen Exp $ | 22 | // $Id: FbCommands.cc,v 1.20 2003/12/19 03:56:51 fluxgen Exp $ |
23 | 23 | ||
24 | #include "FbCommands.hh" | 24 | #include "FbCommands.hh" |
25 | #include "fluxbox.hh" | 25 | #include "fluxbox.hh" |
26 | #include "FbTk/Theme.hh" | ||
27 | #include "Screen.hh" | 26 | #include "Screen.hh" |
28 | #include "Menu.hh" | 27 | #include "CommandDialog.hh" |
29 | #include "SetWorkspaceName.hh" | 28 | #include "Workspace.hh" |
29 | |||
30 | #include "FbTk/Theme.hh" | ||
31 | #include "FbTk/Menu.hh" | ||
30 | 32 | ||
31 | #include <sys/types.h> | 33 | #include <sys/types.h> |
32 | #include <unistd.h> | 34 | #include <unistd.h> |
@@ -163,13 +165,51 @@ void ShowWorkspaceMenuCmd::execute() { | |||
163 | 165 | ||
164 | } | 166 | } |
165 | 167 | ||
168 | |||
169 | |||
170 | SetWorkspaceNameCmd::SetWorkspaceNameCmd(const std::string &name, int spaceid): | ||
171 | m_name(name), m_workspace(spaceid) { } | ||
172 | |||
166 | void SetWorkspaceNameCmd::execute() { | 173 | void SetWorkspaceNameCmd::execute() { |
174 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | ||
175 | if (screen == 0) { | ||
176 | screen = Fluxbox::instance()->keyScreen(); | ||
177 | if (screen == 0) { | ||
178 | cerr<<"Screen == 0!"<<endl; | ||
179 | return; | ||
180 | } | ||
181 | } | ||
182 | |||
183 | if (m_workspace < 0) { | ||
184 | screen->currentWorkspace()->setName(m_name); | ||
185 | } else { | ||
186 | Workspace *space = screen->getWorkspace(m_workspace); | ||
187 | if (space == 0) | ||
188 | return; | ||
189 | space->setName(m_name); | ||
190 | } | ||
191 | |||
192 | screen->updateWorkspaceNamesAtom(); | ||
193 | Fluxbox::instance()->save_rc(); | ||
194 | } | ||
195 | |||
196 | void WorkspaceNameDialogCmd::execute() { | ||
197 | |||
198 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | ||
199 | if (screen == 0) | ||
200 | return; | ||
201 | |||
202 | CommandDialog *win = new CommandDialog(*screen, "Set Workspace Name:", "SetWorkspaceName "); | ||
203 | win->setText(screen->currentWorkspace()->name()); | ||
204 | win->show(); | ||
205 | } | ||
167 | 206 | ||
207 | void CommandDialogCmd::execute() { | ||
168 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | 208 | BScreen *screen = Fluxbox::instance()->mouseScreen(); |
169 | if (screen == 0) | 209 | if (screen == 0) |
170 | return; | 210 | return; |
171 | 211 | ||
172 | SetWorkspaceName *win = new SetWorkspaceName(*screen); | 212 | FbTk::FbWindow *win = new CommandDialog(*screen, "Fluxbox Command"); |
173 | win->show(); | 213 | win->show(); |
174 | } | 214 | } |
175 | 215 | ||
diff --git a/src/FbCommands.hh b/src/FbCommands.hh index fc97791..9c61259 100644 --- a/src/FbCommands.hh +++ b/src/FbCommands.hh | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: FbCommands.hh,v 1.14 2003/12/16 23:35:00 fluxgen Exp $ | 22 | // $Id: FbCommands.hh,v 1.15 2003/12/19 03:56:51 fluxgen Exp $ |
23 | 23 | ||
24 | // \file contains basic commands to restart, reconfigure, execute command and exit fluxbox | 24 | // \file contains basic commands to restart, reconfigure, execute command and exit fluxbox |
25 | 25 | ||
@@ -95,6 +95,20 @@ public: | |||
95 | 95 | ||
96 | class SetWorkspaceNameCmd: public FbTk::Command { | 96 | class SetWorkspaceNameCmd: public FbTk::Command { |
97 | public: | 97 | public: |
98 | SetWorkspaceNameCmd(const std::string &name, int spaceid = -1); | ||
99 | void execute(); | ||
100 | private: | ||
101 | std::string m_name; | ||
102 | int m_workspace; | ||
103 | }; | ||
104 | |||
105 | class WorkspaceNameDialogCmd: public FbTk::Command { | ||
106 | public: | ||
107 | void execute(); | ||
108 | }; | ||
109 | |||
110 | class CommandDialogCmd: public FbTk::Command { | ||
111 | public: | ||
98 | void execute(); | 112 | void execute(); |
99 | }; | 113 | }; |
100 | 114 | ||