moved Resource to FbTk
This commit is contained in:
parent
b90558a9a9
commit
251ca294ab
5 changed files with 46 additions and 45 deletions
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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 "IntResMenuItem.hh"
|
||||||
#include <cstdio>
|
#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()),
|
FbTk::MenuItem(label), m_org_label(FbTk::MenuItem::label()),
|
||||||
m_max(max_val), m_min(min_val), m_res(res) {
|
m_max(max_val), m_min(min_val), m_res(res) {
|
||||||
setLabel(appendIntValue(m_org_label, *m_res).c_str());
|
setLabel(appendIntValue(m_org_label, *m_res).c_str());
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef INTRESMENUITEM_HH
|
||||||
#define INTRESMENUITEM_HH
|
#define INTRESMENUITEM_HH
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
/// Changes an resource integer value between min and max
|
/// Changes an resource integer value between min and max
|
||||||
class IntResMenuItem: public FbTk::MenuItem {
|
class IntResMenuItem: public FbTk::MenuItem {
|
||||||
public:
|
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);
|
void click(int button, int time);
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ private:
|
||||||
std::string m_org_label; ///< original label
|
std::string m_org_label; ///< original label
|
||||||
const int m_max; ///< maximum value the integer can have
|
const int m_max; ///< maximum value the integer can have
|
||||||
const int m_min; ///< minimum 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
|
#endif // INTRESMENUITEM_HH
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef SCREEN_HH
|
||||||
#define SCREEN_HH
|
#define SCREEN_HH
|
||||||
|
@ -69,7 +69,7 @@ public:
|
||||||
typedef std::vector<Workspace *> Workspaces;
|
typedef std::vector<Workspace *> Workspaces;
|
||||||
typedef std::vector<std::string> WorkspaceNames;
|
typedef std::vector<std::string> WorkspaceNames;
|
||||||
|
|
||||||
BScreen(ResourceManager &rm,
|
BScreen(FbTk::ResourceManager &rm,
|
||||||
const std::string &screenname, const std::string &altscreenname,
|
const std::string &screenname, const std::string &altscreenname,
|
||||||
int scrn, int number_of_layers);
|
int scrn, int number_of_layers);
|
||||||
~BScreen();
|
~BScreen();
|
||||||
|
@ -111,7 +111,7 @@ public:
|
||||||
|
|
||||||
inline Slit::Placement getSlitPlacement() const { return *resource.slit_placement; }
|
inline Slit::Placement getSlitPlacement() const { return *resource.slit_placement; }
|
||||||
inline Slit::Direction getSlitDirection() const { return *resource.slit_direction; }
|
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 saveSlitPlacement(Slit::Placement p) { resource.slit_placement = p; }
|
||||||
inline void saveSlitDirection(Slit::Direction d) { resource.slit_direction = d; }
|
inline void saveSlitDirection(Slit::Direction d) { resource.slit_direction = d; }
|
||||||
inline void saveSlitAutoHide(bool t) { resource.slit_auto_hide = t; }
|
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 getToolbarOnHead() { return *resource.toolbar_on_head; }
|
||||||
|
|
||||||
inline int getToolbarWidthPercent() const { return *resource.toolbar_width_percent; }
|
inline int getToolbarWidthPercent() const { return *resource.toolbar_width_percent; }
|
||||||
inline Resource<int> &getToolbarWidthPercentResource() { return resource.toolbar_width_percent; }
|
inline FbTk::Resource<int> &getToolbarWidthPercentResource() { return resource.toolbar_width_percent; }
|
||||||
inline const Resource<int> &getToolbarWidthPercentResource() const { 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 ToolbarHandler::ToolbarMode toolbarMode() const { return *resource.toolbar_mode; }
|
||||||
inline int getPlacementPolicy() const { return resource.placement_policy; }
|
inline int getPlacementPolicy() const { return resource.placement_policy; }
|
||||||
inline int getEdgeSnapThreshold() const { return *resource.edge_snap_threshold; }
|
inline int getEdgeSnapThreshold() const { return *resource.edge_snap_threshold; }
|
||||||
|
@ -388,31 +388,31 @@ private:
|
||||||
FbRootWindow m_root_window;
|
FbRootWindow m_root_window;
|
||||||
|
|
||||||
struct ScreenResource {
|
struct ScreenResource {
|
||||||
ScreenResource(ResourceManager &rm, const std::string &scrname,
|
ScreenResource(FbTk::ResourceManager &rm, const std::string &scrname,
|
||||||
const std::string &altscrname);
|
const std::string &altscrname);
|
||||||
|
|
||||||
Resource<bool> toolbar_auto_hide,
|
FbTk::Resource<bool> toolbar_auto_hide,
|
||||||
image_dither, opaque_move, full_max,
|
image_dither, opaque_move, full_max,
|
||||||
max_over_slit,
|
max_over_slit,
|
||||||
sloppy_window_grouping, workspace_warping,
|
sloppy_window_grouping, workspace_warping,
|
||||||
desktop_wheeling, show_window_pos,
|
desktop_wheeling, show_window_pos,
|
||||||
focus_last, focus_new,
|
focus_last, focus_new,
|
||||||
antialias, auto_raise, click_raises;
|
antialias, auto_raise, click_raises;
|
||||||
Resource<std::string> rootcommand;
|
FbTk::Resource<std::string> rootcommand;
|
||||||
Resource<Fluxbox::FocusModel> focus_model;
|
FbTk::Resource<Fluxbox::FocusModel> focus_model;
|
||||||
bool ordered_dither;
|
bool ordered_dither;
|
||||||
Resource<int> workspaces, toolbar_width_percent, edge_snap_threshold,
|
FbTk::Resource<int> workspaces, toolbar_width_percent, edge_snap_threshold,
|
||||||
menu_alpha;
|
menu_alpha;
|
||||||
Resource<Fluxbox::Layer> slit_layernum, toolbar_layernum;
|
FbTk::Resource<Fluxbox::Layer> slit_layernum, toolbar_layernum;
|
||||||
int placement_policy, row_direction, col_direction;
|
int placement_policy, row_direction, col_direction;
|
||||||
|
|
||||||
Resource<ToolbarHandler::ToolbarMode> toolbar_mode;
|
FbTk::Resource<ToolbarHandler::ToolbarMode> toolbar_mode;
|
||||||
Resource<int> toolbar_on_head;
|
FbTk::Resource<int> toolbar_on_head;
|
||||||
Resource<Toolbar::Placement> toolbar_placement;
|
FbTk::Resource<Toolbar::Placement> toolbar_placement;
|
||||||
Resource<bool> slit_auto_hide;
|
FbTk::Resource<bool> slit_auto_hide;
|
||||||
Resource<Slit::Placement> slit_placement;
|
FbTk::Resource<Slit::Placement> slit_placement;
|
||||||
Resource<Slit::Direction> slit_direction;
|
FbTk::Resource<Slit::Direction> slit_direction;
|
||||||
Resource<int> slit_alpha;
|
FbTk::Resource<int> slit_alpha;
|
||||||
|
|
||||||
unsigned int slit_on_head;
|
unsigned int slit_on_head;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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"
|
#include "fluxbox.hh"
|
||||||
|
|
||||||
|
@ -155,8 +155,9 @@ char *basename (char *s) {
|
||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
//---- accessors for int, bool, and some enums with Resource ------
|
//---- accessors for int, bool, and some enums with Resource ------
|
||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void Resource<int>::
|
void FbTk::Resource<int>::
|
||||||
setFromString(const char* strval) {
|
setFromString(const char* strval) {
|
||||||
int val;
|
int val;
|
||||||
if (sscanf(strval, "%d", &val)==1)
|
if (sscanf(strval, "%d", &val)==1)
|
||||||
|
@ -164,13 +165,13 @@ setFromString(const char* strval) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void Resource<std::string>::
|
void FbTk::Resource<std::string>::
|
||||||
setFromString(const char *strval) {
|
setFromString(const char *strval) {
|
||||||
*this = strval;
|
*this = strval;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void Resource<bool>::
|
void FbTk::Resource<bool>::
|
||||||
setFromString(char const *strval) {
|
setFromString(char const *strval) {
|
||||||
if (strcasecmp(strval, "true")==0)
|
if (strcasecmp(strval, "true")==0)
|
||||||
*this = true;
|
*this = true;
|
||||||
|
@ -179,7 +180,7 @@ setFromString(char const *strval) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void Resource<Fluxbox::FocusModel>::
|
void FbTk::Resource<Fluxbox::FocusModel>::
|
||||||
setFromString(char const *strval) {
|
setFromString(char const *strval) {
|
||||||
// auto raise options here for backwards read compatibility
|
// auto raise options here for backwards read compatibility
|
||||||
// they are not supported for saving purposes. Nor does the "AutoRaise"
|
// they are not supported for saving purposes. Nor does the "AutoRaise"
|
||||||
|
@ -197,7 +198,7 @@ setFromString(char const *strval) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void Resource<Fluxbox::TitlebarList>::
|
void FbTk::Resource<Fluxbox::TitlebarList>::
|
||||||
setFromString(char const *strval) {
|
setFromString(char const *strval) {
|
||||||
vector<std::string> val;
|
vector<std::string> val;
|
||||||
StringUtil::stringtok(val, strval);
|
StringUtil::stringtok(val, strval);
|
||||||
|
@ -222,7 +223,7 @@ setFromString(char const *strval) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void Resource<unsigned int>::
|
void FbTk::Resource<unsigned int>::
|
||||||
setFromString(const char *strval) {
|
setFromString(const char *strval) {
|
||||||
if (sscanf(strval, "%ul", &m_value) != 1)
|
if (sscanf(strval, "%ul", &m_value) != 1)
|
||||||
setDefaultValue();
|
setDefaultValue();
|
||||||
|
@ -232,13 +233,13 @@ setFromString(const char *strval) {
|
||||||
//---- manipulators for int, bool, and some enums with Resource ---
|
//---- manipulators for int, bool, and some enums with Resource ---
|
||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
template<>
|
template<>
|
||||||
std::string Resource<bool>::
|
std::string FbTk::Resource<bool>::
|
||||||
getString() {
|
getString() {
|
||||||
return std::string(**this == true ? "true" : "false");
|
return std::string(**this == true ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
std::string Resource<int>::
|
std::string FbTk::Resource<int>::
|
||||||
getString() {
|
getString() {
|
||||||
char strval[256];
|
char strval[256];
|
||||||
sprintf(strval, "%d", **this);
|
sprintf(strval, "%d", **this);
|
||||||
|
@ -246,11 +247,11 @@ getString() {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
std::string Resource<std::string>::
|
std::string FbTk::Resource<std::string>::
|
||||||
getString() { return **this; }
|
getString() { return **this; }
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
std::string Resource<Fluxbox::FocusModel>::
|
std::string FbTk::Resource<Fluxbox::FocusModel>::
|
||||||
getString() {
|
getString() {
|
||||||
switch (m_value) {
|
switch (m_value) {
|
||||||
case Fluxbox::SLOPPYFOCUS:
|
case Fluxbox::SLOPPYFOCUS:
|
||||||
|
@ -265,7 +266,7 @@ getString() {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
std::string Resource<Fluxbox::TitlebarList>::
|
std::string FbTk::Resource<Fluxbox::TitlebarList>::
|
||||||
getString() {
|
getString() {
|
||||||
string retval;
|
string retval;
|
||||||
int size=m_value.size();
|
int size=m_value.size();
|
||||||
|
@ -299,7 +300,7 @@ getString() {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
string Resource<unsigned int>::
|
string FbTk::Resource<unsigned int>::
|
||||||
getString() {
|
getString() {
|
||||||
char tmpstr[128];
|
char tmpstr[128];
|
||||||
sprintf(tmpstr, "%ul", m_value);
|
sprintf(tmpstr, "%ul", m_value);
|
||||||
|
@ -307,7 +308,7 @@ getString() {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void Resource<Fluxbox::Layer>::
|
void FbTk::Resource<Fluxbox::Layer>::
|
||||||
setFromString(const char *strval) {
|
setFromString(const char *strval) {
|
||||||
int tempnum = 0;
|
int tempnum = 0;
|
||||||
if (sscanf(strval, "%d", &tempnum) == 1)
|
if (sscanf(strval, "%d", &tempnum) == 1)
|
||||||
|
@ -332,7 +333,7 @@ setFromString(const char *strval) {
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
string Resource<Fluxbox::Layer>::
|
string FbTk::Resource<Fluxbox::Layer>::
|
||||||
getString() {
|
getString() {
|
||||||
|
|
||||||
if (m_value.getNum() == Fluxbox::instance()->getMenuLayer())
|
if (m_value.getNum() == Fluxbox::instance()->getMenuLayer())
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef FLUXBOX_HH
|
||||||
#define FLUXBOX_HH
|
#define FLUXBOX_HH
|
||||||
|
@ -227,18 +227,18 @@ private:
|
||||||
|
|
||||||
std::auto_ptr<FbAtoms> m_fbatoms;
|
std::auto_ptr<FbAtoms> m_fbatoms;
|
||||||
|
|
||||||
ResourceManager m_resourcemanager, m_screen_rm;
|
FbTk::ResourceManager m_resourcemanager, m_screen_rm;
|
||||||
|
|
||||||
//--- Resources
|
//--- Resources
|
||||||
Resource<bool> m_rc_tabs, m_rc_ignoreborder;
|
FbTk::Resource<bool> m_rc_tabs, m_rc_ignoreborder;
|
||||||
Resource<int> m_rc_colors_per_channel, m_rc_numlayers;
|
FbTk::Resource<int> m_rc_colors_per_channel, m_rc_numlayers;
|
||||||
Resource<std::string> m_rc_stylefile,
|
FbTk::Resource<std::string> m_rc_stylefile,
|
||||||
m_rc_menufile, m_rc_keyfile, m_rc_slitlistfile,
|
m_rc_menufile, m_rc_keyfile, m_rc_slitlistfile,
|
||||||
m_rc_groupfile;
|
m_rc_groupfile;
|
||||||
|
|
||||||
|
|
||||||
Resource<TitlebarList> m_rc_titlebar_left, m_rc_titlebar_right;
|
FbTk::Resource<TitlebarList> m_rc_titlebar_left, m_rc_titlebar_right;
|
||||||
Resource<unsigned int> m_rc_cache_life, m_rc_cache_max;
|
FbTk::Resource<unsigned int> m_rc_cache_life, m_rc_cache_max;
|
||||||
|
|
||||||
|
|
||||||
std::map<Window, FluxboxWindow *> m_window_search;
|
std::map<Window, FluxboxWindow *> m_window_search;
|
||||||
|
|
Loading…
Reference in a new issue