diff options
author | fluxgen <fluxgen> | 2003-05-18 22:04:06 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-05-18 22:04:06 (GMT) |
commit | 251ca294abe7af0cbe5caf3c33052292cad42fa5 (patch) | |
tree | a2e42c98b33940dd4f590faf8b3803cf31a3d334 | |
parent | b90558a9a967ddd076ba5ed5fa02f0a6160760bd (diff) | |
download | fluxbox_pavel-251ca294abe7af0cbe5caf3c33052292cad42fa5.zip fluxbox_pavel-251ca294abe7af0cbe5caf3c33052292cad42fa5.tar.bz2 |
moved Resource to FbTk
-rw-r--r-- | src/IntResMenuItem.cc | 4 | ||||
-rw-r--r-- | src/IntResMenuItem.hh | 6 | ||||
-rw-r--r-- | src/Screen.hh | 36 | ||||
-rw-r--r-- | src/fluxbox.cc | 31 | ||||
-rw-r--r-- | src/fluxbox.hh | 14 |
5 files changed, 46 insertions, 45 deletions
diff --git a/src/IntResMenuItem.cc b/src/IntResMenuItem.cc index b272268..8cdb9a8 100644 --- a/src/IntResMenuItem.cc +++ b/src/IntResMenuItem.cc | |||
@@ -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: IntResMenuItem.cc,v 1.1 2003/02/17 12:45:59 fluxgen Exp $ | 22 | // $Id: IntResMenuItem.cc,v 1.2 2003/05/18 21:59:14 fluxgen Exp $ |
23 | 23 | ||
24 | #include "IntResMenuItem.hh" | 24 | #include "IntResMenuItem.hh" |
25 | #include <cstdio> | 25 | #include <cstdio> |
@@ -36,7 +36,7 @@ std::string appendIntValue(const std::string &label, int value) { | |||
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | IntResMenuItem::IntResMenuItem(const char *label, Resource<int> &res, int min_val, int max_val): | 39 | IntResMenuItem::IntResMenuItem(const char *label, FbTk::Resource<int> &res, int min_val, int max_val): |
40 | FbTk::MenuItem(label), m_org_label(FbTk::MenuItem::label()), | 40 | FbTk::MenuItem(label), m_org_label(FbTk::MenuItem::label()), |
41 | m_max(max_val), m_min(min_val), m_res(res) { | 41 | m_max(max_val), m_min(min_val), m_res(res) { |
42 | setLabel(appendIntValue(m_org_label, *m_res).c_str()); | 42 | setLabel(appendIntValue(m_org_label, *m_res).c_str()); |
diff --git a/src/IntResMenuItem.hh b/src/IntResMenuItem.hh index 3466c91..6da3db9 100644 --- a/src/IntResMenuItem.hh +++ b/src/IntResMenuItem.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: IntResMenuItem.hh,v 1.1 2003/02/17 12:45:58 fluxgen Exp $ | 22 | // $Id: IntResMenuItem.hh,v 1.2 2003/05/18 21:59:14 fluxgen Exp $ |
23 | 23 | ||
24 | #ifndef INTRESMENUITEM_HH | 24 | #ifndef INTRESMENUITEM_HH |
25 | #define INTRESMENUITEM_HH | 25 | #define INTRESMENUITEM_HH |
@@ -30,7 +30,7 @@ | |||
30 | /// Changes an resource integer value between min and max | 30 | /// Changes an resource integer value between min and max |
31 | class IntResMenuItem: public FbTk::MenuItem { | 31 | class IntResMenuItem: public FbTk::MenuItem { |
32 | public: | 32 | public: |
33 | IntResMenuItem(const char *label, Resource<int> &res, int min_val, int max_val); | 33 | IntResMenuItem(const char *label, FbTk::Resource<int> &res, int min_val, int max_val); |
34 | 34 | ||
35 | void click(int button, int time); | 35 | void click(int button, int time); |
36 | 36 | ||
@@ -38,7 +38,7 @@ private: | |||
38 | std::string m_org_label; ///< original label | 38 | std::string m_org_label; ///< original label |
39 | const int m_max; ///< maximum value the integer can have | 39 | const int m_max; ///< maximum value the integer can have |
40 | const int m_min; ///< minimum value the integer can have | 40 | const int m_min; ///< minimum value the integer can have |
41 | Resource<int> &m_res; ///< resource item to be changed | 41 | FbTk::Resource<int> &m_res; ///< resource item to be changed |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif // INTRESMENUITEM_HH | 44 | #endif // INTRESMENUITEM_HH |
diff --git a/src/Screen.hh b/src/Screen.hh index 46f86c4..d06937b 100644 --- a/src/Screen.hh +++ b/src/Screen.hh | |||
@@ -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: Screen.hh,v 1.98 2003/05/15 23:25:36 fluxgen Exp $ | 25 | // $Id: Screen.hh,v 1.99 2003/05/18 22:00:04 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef SCREEN_HH | 27 | #ifndef SCREEN_HH |
28 | #define SCREEN_HH | 28 | #define SCREEN_HH |
@@ -69,7 +69,7 @@ public: | |||
69 | typedef std::vector<Workspace *> Workspaces; | 69 | typedef std::vector<Workspace *> Workspaces; |
70 | typedef std::vector<std::string> WorkspaceNames; | 70 | typedef std::vector<std::string> WorkspaceNames; |
71 | 71 | ||
72 | BScreen(ResourceManager &rm, | 72 | BScreen(FbTk::ResourceManager &rm, |
73 | const std::string &screenname, const std::string &altscreenname, | 73 | const std::string &screenname, const std::string &altscreenname, |
74 | int scrn, int number_of_layers); | 74 | int scrn, int number_of_layers); |
75 | ~BScreen(); | 75 | ~BScreen(); |
@@ -111,7 +111,7 @@ public: | |||
111 | 111 | ||
112 | inline Slit::Placement getSlitPlacement() const { return *resource.slit_placement; } | 112 | inline Slit::Placement getSlitPlacement() const { return *resource.slit_placement; } |
113 | inline Slit::Direction getSlitDirection() const { return *resource.slit_direction; } | 113 | inline Slit::Direction getSlitDirection() const { return *resource.slit_direction; } |
114 | inline Resource<int> &slitAlphaResource() { return resource.slit_alpha; } | 114 | inline FbTk::Resource<int> &slitAlphaResource() { return resource.slit_alpha; } |
115 | inline void saveSlitPlacement(Slit::Placement p) { resource.slit_placement = p; } | 115 | inline void saveSlitPlacement(Slit::Placement p) { resource.slit_placement = p; } |
116 | inline void saveSlitDirection(Slit::Direction d) { resource.slit_direction = d; } | 116 | inline void saveSlitDirection(Slit::Direction d) { resource.slit_direction = d; } |
117 | inline void saveSlitAutoHide(bool t) { resource.slit_auto_hide = t; } | 117 | inline void saveSlitAutoHide(bool t) { resource.slit_auto_hide = t; } |
@@ -178,8 +178,8 @@ public: | |||
178 | inline int getToolbarOnHead() { return *resource.toolbar_on_head; } | 178 | inline int getToolbarOnHead() { return *resource.toolbar_on_head; } |
179 | 179 | ||
180 | inline int getToolbarWidthPercent() const { return *resource.toolbar_width_percent; } | 180 | inline int getToolbarWidthPercent() const { return *resource.toolbar_width_percent; } |
181 | inline Resource<int> &getToolbarWidthPercentResource() { return resource.toolbar_width_percent; } | 181 | inline FbTk::Resource<int> &getToolbarWidthPercentResource() { return resource.toolbar_width_percent; } |
182 | inline const Resource<int> &getToolbarWidthPercentResource() const { return resource.toolbar_width_percent; } | 182 | inline const FbTk::Resource<int> &getToolbarWidthPercentResource() const { return resource.toolbar_width_percent; } |
183 | inline ToolbarHandler::ToolbarMode toolbarMode() const { return *resource.toolbar_mode; } | 183 | inline ToolbarHandler::ToolbarMode toolbarMode() const { return *resource.toolbar_mode; } |
184 | inline int getPlacementPolicy() const { return resource.placement_policy; } | 184 | inline int getPlacementPolicy() const { return resource.placement_policy; } |
185 | inline int getEdgeSnapThreshold() const { return *resource.edge_snap_threshold; } | 185 | inline int getEdgeSnapThreshold() const { return *resource.edge_snap_threshold; } |
@@ -388,31 +388,31 @@ private: | |||
388 | FbRootWindow m_root_window; | 388 | FbRootWindow m_root_window; |
389 | 389 | ||
390 | struct ScreenResource { | 390 | struct ScreenResource { |
391 | ScreenResource(ResourceManager &rm, const std::string &scrname, | 391 | ScreenResource(FbTk::ResourceManager &rm, const std::string &scrname, |
392 | const std::string &altscrname); | 392 | const std::string &altscrname); |
393 | 393 | ||
394 | Resource<bool> toolbar_auto_hide, | 394 | FbTk::Resource<bool> toolbar_auto_hide, |
395 | image_dither, opaque_move, full_max, | 395 | image_dither, opaque_move, full_max, |
396 | max_over_slit, | 396 | max_over_slit, |
397 | sloppy_window_grouping, workspace_warping, | 397 | sloppy_window_grouping, workspace_warping, |
398 | desktop_wheeling, show_window_pos, | 398 | desktop_wheeling, show_window_pos, |
399 | focus_last, focus_new, | 399 | focus_last, focus_new, |
400 | antialias, auto_raise, click_raises; | 400 | antialias, auto_raise, click_raises; |
401 | Resource<std::string> rootcommand; | 401 | FbTk::Resource<std::string> rootcommand; |
402 | Resource<Fluxbox::FocusModel> focus_model; | 402 | FbTk::Resource<Fluxbox::FocusModel> focus_model; |
403 | bool ordered_dither; | 403 | bool ordered_dither; |
404 | Resource<int> workspaces, toolbar_width_percent, edge_snap_threshold, | 404 | FbTk::Resource<int> workspaces, toolbar_width_percent, edge_snap_threshold, |
405 | menu_alpha; | 405 | menu_alpha; |
406 | Resource<Fluxbox::Layer> slit_layernum, toolbar_layernum; | 406 | FbTk::Resource<Fluxbox::Layer> slit_layernum, toolbar_layernum; |
407 | int placement_policy, row_direction, col_direction; | 407 | int placement_policy, row_direction, col_direction; |
408 | 408 | ||
409 | Resource<ToolbarHandler::ToolbarMode> toolbar_mode; | 409 | FbTk::Resource<ToolbarHandler::ToolbarMode> toolbar_mode; |
410 | Resource<int> toolbar_on_head; | 410 | FbTk::Resource<int> toolbar_on_head; |
411 | Resource<Toolbar::Placement> toolbar_placement; | 411 | FbTk::Resource<Toolbar::Placement> toolbar_placement; |
412 | Resource<bool> slit_auto_hide; | 412 | FbTk::Resource<bool> slit_auto_hide; |
413 | Resource<Slit::Placement> slit_placement; | 413 | FbTk::Resource<Slit::Placement> slit_placement; |
414 | Resource<Slit::Direction> slit_direction; | 414 | FbTk::Resource<Slit::Direction> slit_direction; |
415 | Resource<int> slit_alpha; | 415 | FbTk::Resource<int> slit_alpha; |
416 | 416 | ||
417 | unsigned int slit_on_head; | 417 | unsigned int slit_on_head; |
418 | 418 | ||
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 610ae13..5b39b2f 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.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: fluxbox.cc,v 1.150 2003/05/15 23:30:03 fluxgen Exp $ | 25 | // $Id: fluxbox.cc,v 1.151 2003/05/18 22:04:06 fluxgen Exp $ |
26 | 26 | ||
27 | #include "fluxbox.hh" | 27 | #include "fluxbox.hh" |
28 | 28 | ||
@@ -155,8 +155,9 @@ char *basename (char *s) { | |||
155 | //----------------------------------------------------------------- | 155 | //----------------------------------------------------------------- |
156 | //---- accessors for int, bool, and some enums with Resource ------ | 156 | //---- accessors for int, bool, and some enums with Resource ------ |
157 | //----------------------------------------------------------------- | 157 | //----------------------------------------------------------------- |
158 | |||
158 | template<> | 159 | template<> |
159 | void Resource<int>:: | 160 | void FbTk::Resource<int>:: |
160 | setFromString(const char* strval) { | 161 | setFromString(const char* strval) { |
161 | int val; | 162 | int val; |
162 | if (sscanf(strval, "%d", &val)==1) | 163 | if (sscanf(strval, "%d", &val)==1) |
@@ -164,13 +165,13 @@ setFromString(const char* strval) { | |||
164 | } | 165 | } |
165 | 166 | ||
166 | template<> | 167 | template<> |
167 | void Resource<std::string>:: | 168 | void FbTk::Resource<std::string>:: |
168 | setFromString(const char *strval) { | 169 | setFromString(const char *strval) { |
169 | *this = strval; | 170 | *this = strval; |
170 | } | 171 | } |
171 | 172 | ||
172 | template<> | 173 | template<> |
173 | void Resource<bool>:: | 174 | void FbTk::Resource<bool>:: |
174 | setFromString(char const *strval) { | 175 | setFromString(char const *strval) { |
175 | if (strcasecmp(strval, "true")==0) | 176 | if (strcasecmp(strval, "true")==0) |
176 | *this = true; | 177 | *this = true; |
@@ -179,7 +180,7 @@ setFromString(char const *strval) { | |||
179 | } | 180 | } |
180 | 181 | ||
181 | template<> | 182 | template<> |
182 | void Resource<Fluxbox::FocusModel>:: | 183 | void FbTk::Resource<Fluxbox::FocusModel>:: |
183 | setFromString(char const *strval) { | 184 | setFromString(char const *strval) { |
184 | // auto raise options here for backwards read compatibility | 185 | // auto raise options here for backwards read compatibility |
185 | // they are not supported for saving purposes. Nor does the "AutoRaise" | 186 | // they are not supported for saving purposes. Nor does the "AutoRaise" |
@@ -197,7 +198,7 @@ setFromString(char const *strval) { | |||
197 | } | 198 | } |
198 | 199 | ||
199 | template<> | 200 | template<> |
200 | void Resource<Fluxbox::TitlebarList>:: | 201 | void FbTk::Resource<Fluxbox::TitlebarList>:: |
201 | setFromString(char const *strval) { | 202 | setFromString(char const *strval) { |
202 | vector<std::string> val; | 203 | vector<std::string> val; |
203 | StringUtil::stringtok(val, strval); | 204 | StringUtil::stringtok(val, strval); |
@@ -222,7 +223,7 @@ setFromString(char const *strval) { | |||
222 | } | 223 | } |
223 | 224 | ||
224 | template<> | 225 | template<> |
225 | void Resource<unsigned int>:: | 226 | void FbTk::Resource<unsigned int>:: |
226 | setFromString(const char *strval) { | 227 | setFromString(const char *strval) { |
227 | if (sscanf(strval, "%ul", &m_value) != 1) | 228 | if (sscanf(strval, "%ul", &m_value) != 1) |
228 | setDefaultValue(); | 229 | setDefaultValue(); |
@@ -232,13 +233,13 @@ setFromString(const char *strval) { | |||
232 | //---- manipulators for int, bool, and some enums with Resource --- | 233 | //---- manipulators for int, bool, and some enums with Resource --- |
233 | //----------------------------------------------------------------- | 234 | //----------------------------------------------------------------- |
234 | template<> | 235 | template<> |
235 | std::string Resource<bool>:: | 236 | std::string FbTk::Resource<bool>:: |
236 | getString() { | 237 | getString() { |
237 | return std::string(**this == true ? "true" : "false"); | 238 | return std::string(**this == true ? "true" : "false"); |
238 | } | 239 | } |
239 | 240 | ||
240 | template<> | 241 | template<> |
241 | std::string Resource<int>:: | 242 | std::string FbTk::Resource<int>:: |
242 | getString() { | 243 | getString() { |
243 | char strval[256]; | 244 | char strval[256]; |
244 | sprintf(strval, "%d", **this); | 245 | sprintf(strval, "%d", **this); |
@@ -246,11 +247,11 @@ getString() { | |||
246 | } | 247 | } |
247 | 248 | ||
248 | template<> | 249 | template<> |
249 | std::string Resource<std::string>:: | 250 | std::string FbTk::Resource<std::string>:: |
250 | getString() { return **this; } | 251 | getString() { return **this; } |
251 | 252 | ||
252 | template<> | 253 | template<> |
253 | std::string Resource<Fluxbox::FocusModel>:: | 254 | std::string FbTk::Resource<Fluxbox::FocusModel>:: |
254 | getString() { | 255 | getString() { |
255 | switch (m_value) { | 256 | switch (m_value) { |
256 | case Fluxbox::SLOPPYFOCUS: | 257 | case Fluxbox::SLOPPYFOCUS: |
@@ -265,7 +266,7 @@ getString() { | |||
265 | } | 266 | } |
266 | 267 | ||
267 | template<> | 268 | template<> |
268 | std::string Resource<Fluxbox::TitlebarList>:: | 269 | std::string FbTk::Resource<Fluxbox::TitlebarList>:: |
269 | getString() { | 270 | getString() { |
270 | string retval; | 271 | string retval; |
271 | int size=m_value.size(); | 272 | int size=m_value.size(); |
@@ -299,7 +300,7 @@ getString() { | |||
299 | } | 300 | } |
300 | 301 | ||
301 | template<> | 302 | template<> |
302 | string Resource<unsigned int>:: | 303 | string FbTk::Resource<unsigned int>:: |
303 | getString() { | 304 | getString() { |
304 | char tmpstr[128]; | 305 | char tmpstr[128]; |
305 | sprintf(tmpstr, "%ul", m_value); | 306 | sprintf(tmpstr, "%ul", m_value); |
@@ -307,7 +308,7 @@ getString() { | |||
307 | } | 308 | } |
308 | 309 | ||
309 | template<> | 310 | template<> |
310 | void Resource<Fluxbox::Layer>:: | 311 | void FbTk::Resource<Fluxbox::Layer>:: |
311 | setFromString(const char *strval) { | 312 | setFromString(const char *strval) { |
312 | int tempnum = 0; | 313 | int tempnum = 0; |
313 | if (sscanf(strval, "%d", &tempnum) == 1) | 314 | if (sscanf(strval, "%d", &tempnum) == 1) |
@@ -332,7 +333,7 @@ setFromString(const char *strval) { | |||
332 | 333 | ||
333 | 334 | ||
334 | template<> | 335 | template<> |
335 | string Resource<Fluxbox::Layer>:: | 336 | string FbTk::Resource<Fluxbox::Layer>:: |
336 | getString() { | 337 | getString() { |
337 | 338 | ||
338 | if (m_value.getNum() == Fluxbox::instance()->getMenuLayer()) | 339 | if (m_value.getNum() == Fluxbox::instance()->getMenuLayer()) |
diff --git a/src/fluxbox.hh b/src/fluxbox.hh index e0cfc6c..2d03b07 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh | |||
@@ -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: fluxbox.hh,v 1.59 2003/05/14 14:35:39 fluxgen Exp $ | 25 | // $Id: fluxbox.hh,v 1.60 2003/05/18 22:02:55 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef FLUXBOX_HH | 27 | #ifndef FLUXBOX_HH |
28 | #define FLUXBOX_HH | 28 | #define FLUXBOX_HH |
@@ -227,18 +227,18 @@ private: | |||
227 | 227 | ||
228 | std::auto_ptr<FbAtoms> m_fbatoms; | 228 | std::auto_ptr<FbAtoms> m_fbatoms; |
229 | 229 | ||
230 | ResourceManager m_resourcemanager, m_screen_rm; | 230 | FbTk::ResourceManager m_resourcemanager, m_screen_rm; |
231 | 231 | ||
232 | //--- Resources | 232 | //--- Resources |
233 | Resource<bool> m_rc_tabs, m_rc_ignoreborder; | 233 | FbTk::Resource<bool> m_rc_tabs, m_rc_ignoreborder; |
234 | Resource<int> m_rc_colors_per_channel, m_rc_numlayers; | 234 | FbTk::Resource<int> m_rc_colors_per_channel, m_rc_numlayers; |
235 | Resource<std::string> m_rc_stylefile, | 235 | FbTk::Resource<std::string> m_rc_stylefile, |
236 | m_rc_menufile, m_rc_keyfile, m_rc_slitlistfile, | 236 | m_rc_menufile, m_rc_keyfile, m_rc_slitlistfile, |
237 | m_rc_groupfile; | 237 | m_rc_groupfile; |
238 | 238 | ||
239 | 239 | ||
240 | Resource<TitlebarList> m_rc_titlebar_left, m_rc_titlebar_right; | 240 | FbTk::Resource<TitlebarList> m_rc_titlebar_left, m_rc_titlebar_right; |
241 | Resource<unsigned int> m_rc_cache_life, m_rc_cache_max; | 241 | FbTk::Resource<unsigned int> m_rc_cache_life, m_rc_cache_max; |
242 | 242 | ||
243 | 243 | ||
244 | std::map<Window, FluxboxWindow *> m_window_search; | 244 | std::map<Window, FluxboxWindow *> m_window_search; |