diff options
-rw-r--r-- | src/ClockTool.cc | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/ClockTool.cc b/src/ClockTool.cc index 10b9ad5..889c65e 100644 --- a/src/ClockTool.cc +++ b/src/ClockTool.cc | |||
@@ -20,13 +20,15 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: ClockTool.cc,v 1.8 2003/12/07 16:39:43 fluxgen Exp $ | 23 | // $Id: ClockTool.cc,v 1.9 2003/12/19 18:26:48 fluxgen Exp $ |
24 | 24 | ||
25 | #include "ClockTool.hh" | 25 | #include "ClockTool.hh" |
26 | 26 | ||
27 | #include "ToolTheme.hh" | 27 | #include "ToolTheme.hh" |
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
29 | #include "CommandParser.hh" | 29 | #include "CommandParser.hh" |
30 | #include "CommandDialog.hh" | ||
31 | #include "fluxbox.hh" | ||
30 | 32 | ||
31 | #include "FbTk/SimpleCommand.hh" | 33 | #include "FbTk/SimpleCommand.hh" |
32 | #include "FbTk/ImageControl.hh" | 34 | #include "FbTk/ImageControl.hh" |
@@ -38,6 +40,9 @@ | |||
38 | #endif // HAVE_CONFIG_H | 40 | #endif // HAVE_CONFIG_H |
39 | 41 | ||
40 | #include <ctime> | 42 | #include <ctime> |
43 | #include <string> | ||
44 | #include <iostream> | ||
45 | using namespace std; | ||
41 | 46 | ||
42 | class ClockMenuItem: public FbTk::MenuItem { | 47 | class ClockMenuItem: public FbTk::MenuItem { |
43 | public: | 48 | public: |
@@ -104,6 +109,23 @@ private: | |||
104 | ClockTool &m_tool; | 109 | ClockTool &m_tool; |
105 | }; | 110 | }; |
106 | 111 | ||
112 | class EditClockFormatCmd: public FbTk::Command { | ||
113 | public: | ||
114 | void execute() { | ||
115 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | ||
116 | if (screen == 0) | ||
117 | return; | ||
118 | std::string resourcename = screen->name() + ".strftimeFormat"; | ||
119 | |||
120 | CommandDialog *dialog = new CommandDialog(*screen, "Edit Clock Format", | ||
121 | "SetResourceValue " + resourcename + " "); | ||
122 | FbTk::RefCount<FbTk::Command> cmd(CommandParser::instance().parseLine("reconfigure")); | ||
123 | dialog->setPostCommand(cmd); | ||
124 | dialog->setText(screen->resourceManager().resourceValue(resourcename)); | ||
125 | dialog->show(); | ||
126 | } | ||
127 | }; | ||
128 | |||
107 | ClockTool::ClockTool(const FbTk::FbWindow &parent, | 129 | ClockTool::ClockTool(const FbTk::FbWindow &parent, |
108 | ToolTheme &theme, BScreen &screen, FbTk::Menu &menu): | 130 | ToolTheme &theme, BScreen &screen, FbTk::Menu &menu): |
109 | ToolbarItem(ToolbarItem::FIXED), | 131 | ToolbarItem(ToolbarItem::FIXED), |
@@ -127,10 +149,16 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent, | |||
127 | m_timer.start(); | 149 | m_timer.start(); |
128 | 150 | ||
129 | m_button.setGC(m_theme.textGC()); | 151 | m_button.setGC(m_theme.textGC()); |
152 | |||
153 | // setup menu | ||
130 | FbTk::RefCount<FbTk::Command> saverc(CommandParser::instance().parseLine("saverc")); | 154 | FbTk::RefCount<FbTk::Command> saverc(CommandParser::instance().parseLine("saverc")); |
131 | FbTk::MenuItem *item = new ClockMenuItem(*this); | 155 | FbTk::MenuItem *item = new ClockMenuItem(*this); |
132 | item->setCommand(saverc); | 156 | item->setCommand(saverc); |
133 | menu.insert(item); | 157 | menu.insert(item); |
158 | FbTk::RefCount<FbTk::Command> editformat_cmd(new EditClockFormatCmd()); | ||
159 | menu.insert("Edit Clock Format", editformat_cmd); | ||
160 | |||
161 | |||
134 | update(0); | 162 | update(0); |
135 | } | 163 | } |
136 | 164 | ||