From 251ca294abe7af0cbe5caf3c33052292cad42fa5 Mon Sep 17 00:00:00 2001 From: fluxgen <fluxgen> Date: Sun, 18 May 2003 22:04:06 +0000 Subject: moved Resource to FbTk --- src/IntResMenuItem.cc | 4 ++-- src/IntResMenuItem.hh | 6 +++--- src/Screen.hh | 36 ++++++++++++++++++------------------ src/fluxbox.cc | 31 ++++++++++++++++--------------- 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IntResMenuItem.cc,v 1.1 2003/02/17 12:45:59 fluxgen Exp $ +// $Id: IntResMenuItem.cc,v 1.2 2003/05/18 21:59:14 fluxgen Exp $ #include "IntResMenuItem.hh" #include <cstdio> @@ -36,7 +36,7 @@ std::string appendIntValue(const std::string &label, int value) { }; -IntResMenuItem::IntResMenuItem(const char *label, Resource<int> &res, int min_val, int max_val): +IntResMenuItem::IntResMenuItem(const char *label, FbTk::Resource<int> &res, int min_val, int max_val): FbTk::MenuItem(label), m_org_label(FbTk::MenuItem::label()), m_max(max_val), m_min(min_val), m_res(res) { 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IntResMenuItem.hh,v 1.1 2003/02/17 12:45:58 fluxgen Exp $ +// $Id: IntResMenuItem.hh,v 1.2 2003/05/18 21:59:14 fluxgen Exp $ #ifndef INTRESMENUITEM_HH #define INTRESMENUITEM_HH @@ -30,7 +30,7 @@ /// Changes an resource integer value between min and max class IntResMenuItem: public FbTk::MenuItem { public: - IntResMenuItem(const char *label, Resource<int> &res, int min_val, int max_val); + IntResMenuItem(const char *label, FbTk::Resource<int> &res, int min_val, int max_val); void click(int button, int time); @@ -38,7 +38,7 @@ private: std::string m_org_label; ///< original label const int m_max; ///< maximum value the integer can have const int m_min; ///< minimum value the integer can have - Resource<int> &m_res; ///< resource item to be changed + FbTk::Resource<int> &m_res; ///< resource item to be changed }; #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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.hh,v 1.98 2003/05/15 23:25:36 fluxgen Exp $ +// $Id: Screen.hh,v 1.99 2003/05/18 22:00:04 fluxgen Exp $ #ifndef SCREEN_HH #define SCREEN_HH @@ -69,7 +69,7 @@ public: typedef std::vector<Workspace *> Workspaces; typedef std::vector<std::string> WorkspaceNames; - BScreen(ResourceManager &rm, + BScreen(FbTk::ResourceManager &rm, const std::string &screenname, const std::string &altscreenname, int scrn, int number_of_layers); ~BScreen(); @@ -111,7 +111,7 @@ public: inline Slit::Placement getSlitPlacement() const { return *resource.slit_placement; } inline Slit::Direction getSlitDirection() const { return *resource.slit_direction; } - inline Resource<int> &slitAlphaResource() { return resource.slit_alpha; } + inline FbTk::Resource<int> &slitAlphaResource() { return resource.slit_alpha; } inline void saveSlitPlacement(Slit::Placement p) { resource.slit_placement = p; } inline void saveSlitDirection(Slit::Direction d) { resource.slit_direction = d; } inline void saveSlitAutoHide(bool t) { resource.slit_auto_hide = t; } @@ -178,8 +178,8 @@ public: inline int getToolbarOnHead() { return *resource.toolbar_on_head; } inline int getToolbarWidthPercent() const { return *resource.toolbar_width_percent; } - inline Resource<int> &getToolbarWidthPercentResource() { return resource.toolbar_width_percent; } - inline const Resource<int> &getToolbarWidthPercentResource() const { return resource.toolbar_width_percent; } + inline FbTk::Resource<int> &getToolbarWidthPercentResource() { return resource.toolbar_width_percent; } + inline const FbTk::Resource<int> &getToolbarWidthPercentResource() const { return resource.toolbar_width_percent; } inline ToolbarHandler::ToolbarMode toolbarMode() const { return *resource.toolbar_mode; } inline int getPlacementPolicy() const { return resource.placement_policy; } inline int getEdgeSnapThreshold() const { return *resource.edge_snap_threshold; } @@ -388,31 +388,31 @@ private: FbRootWindow m_root_window; struct ScreenResource { - ScreenResource(ResourceManager &rm, const std::string &scrname, + ScreenResource(FbTk::ResourceManager &rm, const std::string &scrname, const std::string &altscrname); - Resource<bool> toolbar_auto_hide, + FbTk::Resource<bool> toolbar_auto_hide, image_dither, opaque_move, full_max, max_over_slit, sloppy_window_grouping, workspace_warping, desktop_wheeling, show_window_pos, focus_last, focus_new, antialias, auto_raise, click_raises; - Resource<std::string> rootcommand; - Resource<Fluxbox::FocusModel> focus_model; + FbTk::Resource<std::string> rootcommand; + FbTk::Resource<Fluxbox::FocusModel> focus_model; bool ordered_dither; - Resource<int> workspaces, toolbar_width_percent, edge_snap_threshold, + FbTk::Resource<int> workspaces, toolbar_width_percent, edge_snap_threshold, menu_alpha; - Resource<Fluxbox::Layer> slit_layernum, toolbar_layernum; + FbTk::Resource<Fluxbox::Layer> slit_layernum, toolbar_layernum; int placement_policy, row_direction, col_direction; - Resource<ToolbarHandler::ToolbarMode> toolbar_mode; - Resource<int> toolbar_on_head; - Resource<Toolbar::Placement> toolbar_placement; - Resource<bool> slit_auto_hide; - Resource<Slit::Placement> slit_placement; - Resource<Slit::Direction> slit_direction; - Resource<int> slit_alpha; + FbTk::Resource<ToolbarHandler::ToolbarMode> toolbar_mode; + FbTk::Resource<int> toolbar_on_head; + FbTk::Resource<Toolbar::Placement> toolbar_placement; + FbTk::Resource<bool> slit_auto_hide; + FbTk::Resource<Slit::Placement> slit_placement; + FbTk::Resource<Slit::Direction> slit_direction; + FbTk::Resource<int> slit_alpha; unsigned int slit_on_head; 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.150 2003/05/15 23:30:03 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.151 2003/05/18 22:04:06 fluxgen Exp $ #include "fluxbox.hh" @@ -155,8 +155,9 @@ char *basename (char *s) { //----------------------------------------------------------------- //---- accessors for int, bool, and some enums with Resource ------ //----------------------------------------------------------------- + template<> -void Resource<int>:: +void FbTk::Resource<int>:: setFromString(const char* strval) { int val; if (sscanf(strval, "%d", &val)==1) @@ -164,13 +165,13 @@ setFromString(const char* strval) { } template<> -void Resource<std::string>:: +void FbTk::Resource<std::string>:: setFromString(const char *strval) { *this = strval; } template<> -void Resource<bool>:: +void FbTk::Resource<bool>:: setFromString(char const *strval) { if (strcasecmp(strval, "true")==0) *this = true; @@ -179,7 +180,7 @@ setFromString(char const *strval) { } template<> -void Resource<Fluxbox::FocusModel>:: +void FbTk::Resource<Fluxbox::FocusModel>:: setFromString(char const *strval) { // auto raise options here for backwards read compatibility // they are not supported for saving purposes. Nor does the "AutoRaise" @@ -197,7 +198,7 @@ setFromString(char const *strval) { } template<> -void Resource<Fluxbox::TitlebarList>:: +void FbTk::Resource<Fluxbox::TitlebarList>:: setFromString(char const *strval) { vector<std::string> val; StringUtil::stringtok(val, strval); @@ -222,7 +223,7 @@ setFromString(char const *strval) { } template<> -void Resource<unsigned int>:: +void FbTk::Resource<unsigned int>:: setFromString(const char *strval) { if (sscanf(strval, "%ul", &m_value) != 1) setDefaultValue(); @@ -232,13 +233,13 @@ setFromString(const char *strval) { //---- manipulators for int, bool, and some enums with Resource --- //----------------------------------------------------------------- template<> -std::string Resource<bool>:: +std::string FbTk::Resource<bool>:: getString() { return std::string(**this == true ? "true" : "false"); } template<> -std::string Resource<int>:: +std::string FbTk::Resource<int>:: getString() { char strval[256]; sprintf(strval, "%d", **this); @@ -246,11 +247,11 @@ getString() { } template<> -std::string Resource<std::string>:: +std::string FbTk::Resource<std::string>:: getString() { return **this; } template<> -std::string Resource<Fluxbox::FocusModel>:: +std::string FbTk::Resource<Fluxbox::FocusModel>:: getString() { switch (m_value) { case Fluxbox::SLOPPYFOCUS: @@ -265,7 +266,7 @@ getString() { } template<> -std::string Resource<Fluxbox::TitlebarList>:: +std::string FbTk::Resource<Fluxbox::TitlebarList>:: getString() { string retval; int size=m_value.size(); @@ -299,7 +300,7 @@ getString() { } template<> -string Resource<unsigned int>:: +string FbTk::Resource<unsigned int>:: getString() { char tmpstr[128]; sprintf(tmpstr, "%ul", m_value); @@ -307,7 +308,7 @@ getString() { } template<> -void Resource<Fluxbox::Layer>:: +void FbTk::Resource<Fluxbox::Layer>:: setFromString(const char *strval) { int tempnum = 0; if (sscanf(strval, "%d", &tempnum) == 1) @@ -332,7 +333,7 @@ setFromString(const char *strval) { template<> -string Resource<Fluxbox::Layer>:: +string FbTk::Resource<Fluxbox::Layer>:: getString() { 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.hh,v 1.59 2003/05/14 14:35:39 fluxgen Exp $ +// $Id: fluxbox.hh,v 1.60 2003/05/18 22:02:55 fluxgen Exp $ #ifndef FLUXBOX_HH #define FLUXBOX_HH @@ -227,18 +227,18 @@ private: std::auto_ptr<FbAtoms> m_fbatoms; - ResourceManager m_resourcemanager, m_screen_rm; + FbTk::ResourceManager m_resourcemanager, m_screen_rm; //--- Resources - Resource<bool> m_rc_tabs, m_rc_ignoreborder; - Resource<int> m_rc_colors_per_channel, m_rc_numlayers; - Resource<std::string> m_rc_stylefile, + FbTk::Resource<bool> m_rc_tabs, m_rc_ignoreborder; + FbTk::Resource<int> m_rc_colors_per_channel, m_rc_numlayers; + FbTk::Resource<std::string> m_rc_stylefile, m_rc_menufile, m_rc_keyfile, m_rc_slitlistfile, m_rc_groupfile; - Resource<TitlebarList> m_rc_titlebar_left, m_rc_titlebar_right; - Resource<unsigned int> m_rc_cache_life, m_rc_cache_max; + FbTk::Resource<TitlebarList> m_rc_titlebar_left, m_rc_titlebar_right; + FbTk::Resource<unsigned int> m_rc_cache_life, m_rc_cache_max; std::map<Window, FluxboxWindow *> m_window_search; -- cgit v0.11.2