aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-05-18 22:04:06 (GMT)
committerfluxgen <fluxgen>2003-05-18 22:04:06 (GMT)
commit251ca294abe7af0cbe5caf3c33052292cad42fa5 (patch)
treea2e42c98b33940dd4f590faf8b3803cf31a3d334 /src
parentb90558a9a967ddd076ba5ed5fa02f0a6160760bd (diff)
downloadfluxbox-251ca294abe7af0cbe5caf3c33052292cad42fa5.zip
fluxbox-251ca294abe7af0cbe5caf3c33052292cad42fa5.tar.bz2
moved Resource to FbTk
Diffstat (limited to 'src')
-rw-r--r--src/IntResMenuItem.cc4
-rw-r--r--src/IntResMenuItem.hh6
-rw-r--r--src/Screen.hh36
-rw-r--r--src/fluxbox.cc31
-rw-r--r--src/fluxbox.hh14
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
39IntResMenuItem::IntResMenuItem(const char *label, Resource<int> &res, int min_val, int max_val): 39IntResMenuItem::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
31class IntResMenuItem: public FbTk::MenuItem { 31class IntResMenuItem: public FbTk::MenuItem {
32public: 32public:
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
158template<> 159template<>
159void Resource<int>:: 160void FbTk::Resource<int>::
160setFromString(const char* strval) { 161setFromString(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
166template<> 167template<>
167void Resource<std::string>:: 168void FbTk::Resource<std::string>::
168setFromString(const char *strval) { 169setFromString(const char *strval) {
169 *this = strval; 170 *this = strval;
170} 171}
171 172
172template<> 173template<>
173void Resource<bool>:: 174void FbTk::Resource<bool>::
174setFromString(char const *strval) { 175setFromString(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
181template<> 182template<>
182void Resource<Fluxbox::FocusModel>:: 183void FbTk::Resource<Fluxbox::FocusModel>::
183setFromString(char const *strval) { 184setFromString(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
199template<> 200template<>
200void Resource<Fluxbox::TitlebarList>:: 201void FbTk::Resource<Fluxbox::TitlebarList>::
201setFromString(char const *strval) { 202setFromString(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
224template<> 225template<>
225void Resource<unsigned int>:: 226void FbTk::Resource<unsigned int>::
226setFromString(const char *strval) { 227setFromString(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//-----------------------------------------------------------------
234template<> 235template<>
235std::string Resource<bool>:: 236std::string FbTk::Resource<bool>::
236getString() { 237getString() {
237 return std::string(**this == true ? "true" : "false"); 238 return std::string(**this == true ? "true" : "false");
238} 239}
239 240
240template<> 241template<>
241std::string Resource<int>:: 242std::string FbTk::Resource<int>::
242getString() { 243getString() {
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
248template<> 249template<>
249std::string Resource<std::string>:: 250std::string FbTk::Resource<std::string>::
250getString() { return **this; } 251getString() { return **this; }
251 252
252template<> 253template<>
253std::string Resource<Fluxbox::FocusModel>:: 254std::string FbTk::Resource<Fluxbox::FocusModel>::
254getString() { 255getString() {
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
267template<> 268template<>
268std::string Resource<Fluxbox::TitlebarList>:: 269std::string FbTk::Resource<Fluxbox::TitlebarList>::
269getString() { 270getString() {
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
301template<> 302template<>
302string Resource<unsigned int>:: 303string FbTk::Resource<unsigned int>::
303getString() { 304getString() {
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
309template<> 310template<>
310void Resource<Fluxbox::Layer>:: 311void FbTk::Resource<Fluxbox::Layer>::
311setFromString(const char *strval) { 312setFromString(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
334template<> 335template<>
335string Resource<Fluxbox::Layer>:: 336string FbTk::Resource<Fluxbox::Layer>::
336getString() { 337getString() {
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;