use the same options in Slit and Toolbar placement menus

This commit is contained in:
Mark Tiefenbruck 2008-08-05 17:11:55 -07:00
parent 22aa93c56d
commit 2df84f6687
6 changed files with 140 additions and 179 deletions

View file

@ -1,5 +1,4 @@
session.screen0.slit.placement: BottomRight session.screen0.slit.placement: RightBottom
session.screen0.slit.direction: Vertical
session.screen0.slit.onTop: False session.screen0.slit.onTop: False
session.screen0.slit.autoHide: False session.screen0.slit.autoHide: False
session.screen0.tab.placement: Top session.screen0.tab.placement: Top
@ -30,4 +29,4 @@ session.colorsPerChannel: 4
session.doubleClickInterval: 250 session.doubleClickInterval: 250
session.cacheMax: 200 session.cacheMax: 200
session.imageDither: True session.imageDither: True
session.configVersion: 8 session.configVersion: 9

View file

@ -93,8 +93,7 @@ template<>
void FbTk::Resource<Slit::Placement>::setFromString(const char *strval) { void FbTk::Resource<Slit::Placement>::setFromString(const char *strval) {
if (strcasecmp(strval, "TopLeft")==0) if (strcasecmp(strval, "TopLeft")==0)
m_value = Slit::TOPLEFT; m_value = Slit::TOPLEFT;
else if (strcasecmp(strval, "LeftCenter")==0 else if (strcasecmp(strval, "LeftCenter")==0)
|| strcasecmp(strval, "CenterLeft")==0)
m_value = Slit::LEFTCENTER; m_value = Slit::LEFTCENTER;
else if (strcasecmp(strval, "BottomLeft")==0) else if (strcasecmp(strval, "BottomLeft")==0)
m_value = Slit::BOTTOMLEFT; m_value = Slit::BOTTOMLEFT;
@ -104,21 +103,18 @@ void FbTk::Resource<Slit::Placement>::setFromString(const char *strval) {
m_value = Slit::BOTTOMCENTER; m_value = Slit::BOTTOMCENTER;
else if (strcasecmp(strval, "TopRight")==0) else if (strcasecmp(strval, "TopRight")==0)
m_value = Slit::TOPRIGHT; m_value = Slit::TOPRIGHT;
else if (strcasecmp(strval, "RightCenter")==0 else if (strcasecmp(strval, "RightCenter")==0)
|| strcasecmp(strval, "CenterRight")==0)
m_value = Slit::RIGHTCENTER; m_value = Slit::RIGHTCENTER;
else if (strcasecmp(strval, "BottomRight")==0) else if (strcasecmp(strval, "BottomRight")==0)
m_value = Slit::BOTTOMRIGHT; m_value = Slit::BOTTOMRIGHT;
else else if (strcasecmp(strval, "LeftTop")==0)
setDefaultValue(); m_value = Slit::LEFTTOP;
} else if (strcasecmp(strval, "LeftBottom")==0)
m_value = Slit::LEFTBOTTOM;
template<> else if (strcasecmp(strval, "RightTop")==0)
void FbTk::Resource<Slit::Direction>::setFromString(const char *strval) { m_value = Slit::RIGHTTOP;
if (strcasecmp(strval, "Vertical") == 0) else if (strcasecmp(strval, "RightBottom")==0)
m_value = Slit::VERTICAL; m_value = Slit::RIGHTBOTTOM;
else if (strcasecmp(strval, "Horizontal") == 0)
m_value = Slit::HORIZONTAL;
else else
setDefaultValue(); setDefaultValue();
} }
@ -150,24 +146,23 @@ string FbTk::Resource<Slit::Placement>::getString() const {
case Slit::BOTTOMRIGHT: case Slit::BOTTOMRIGHT:
return string("BottomRight"); return string("BottomRight");
break; break;
case Slit::LEFTTOP:
return string("LeftTop");
break;
case Slit::RIGHTTOP:
return string("RightTop");
break;
case Slit::LEFTBOTTOM:
return string("LeftBottom");
break;
case Slit::RIGHTBOTTOM:
return string("RightBottom");
break;
} }
//default string //default string
return string("BottomRight"); return string("RightBottom");
} }
template<>
string FbTk::Resource<Slit::Direction>::getString() const {
switch (m_value) {
case Slit::VERTICAL:
return string("Vertical");
break;
case Slit::HORIZONTAL:
return string("Horizontal");
break;
}
// default string
return string("Vertical");
}
} // end namespace FbTk } // end namespace FbTk
namespace { namespace {
@ -202,41 +197,6 @@ private:
SlitClient &m_client; SlitClient &m_client;
}; };
class SlitDirMenuItem: public FbTk::MenuItem {
public:
SlitDirMenuItem(const FbTk::FbString &label, Slit &slit, FbTk::RefCount<FbTk::Command<void> > &cmd)
:FbTk::MenuItem(label,cmd),
m_slit(slit),
m_label(label) {
setLabel(m_label); // update label
setCloseOnClick(false);
}
void click(int button, int time, unsigned int mods) {
// toggle direction
if (m_slit.direction() == Slit::HORIZONTAL)
m_slit.setDirection(Slit::VERTICAL);
else
m_slit.setDirection(Slit::HORIZONTAL);
setLabel(m_label);
FbTk::MenuItem::click(button, time, mods);
}
void setLabel(const FbTk::FbString &label) {
_FB_USES_NLS;
m_label = (label);
string reallabel = m_label + " " +
( m_slit.direction() == Slit::HORIZONTAL ?
_FB_XTEXT(Align, Horizontal, "Horizontal", "Horizontal"):
_FB_XTEXT(Align, Vertical, "Vertical", "Vertical"));
FbTk::MenuItem::setLabel(reallabel);
}
private:
Slit &m_slit;
string m_label;
};
class PlaceSlitMenuItem: public FbTk::RadioMenuItem { class PlaceSlitMenuItem: public FbTk::RadioMenuItem {
public: public:
PlaceSlitMenuItem(const FbTk::FbString &label, Slit &slit, Slit::Placement place, FbTk::RefCount<FbTk::Command<void> > &cmd): PlaceSlitMenuItem(const FbTk::FbString &label, Slit &slit, Slit::Placement place, FbTk::RefCount<FbTk::Command<void> > &cmd):
@ -290,10 +250,8 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
// TODO: this resource name must change // TODO: this resource name must change
m_rc_maximize_over(scr.resourceManager(), false, m_rc_maximize_over(scr.resourceManager(), false,
scr.name() + ".slit.maxOver", scr.altName() + ".Slit.MaxOver"), scr.name() + ".slit.maxOver", scr.altName() + ".Slit.MaxOver"),
m_rc_placement(scr.resourceManager(), BOTTOMRIGHT, m_rc_placement(scr.resourceManager(), RIGHTBOTTOM,
scr.name() + ".slit.placement", scr.altName() + ".Slit.Placement"), scr.name() + ".slit.placement", scr.altName() + ".Slit.Placement"),
m_rc_direction(scr.resourceManager(), VERTICAL,
scr.name() + ".slit.direction", scr.altName() + ".Slit.Direction"),
m_rc_alpha(scr.resourceManager(), 255, m_rc_alpha(scr.resourceManager(), 255,
scr.name() + ".slit.alpha", scr.altName() + ".Slit.Alpha"), scr.name() + ".slit.alpha", scr.altName() + ".Slit.Alpha"),
m_rc_on_head(scr.resourceManager(), 0, m_rc_on_head(scr.resourceManager(), 0,
@ -386,46 +344,40 @@ void Slit::updateStrut() {
int left = 0, right = 0, top = 0, bottom = 0; int left = 0, right = 0, top = 0, bottom = 0;
switch (placement()) { switch (placement()) {
case TOPLEFT: case TOPLEFT:
if (direction() == HORIZONTAL) top = height() + 2 * bw;
top = height() + 2 * bw; break;
else case LEFTTOP:
left = width() + 2 * bw; left = width() + 2 * bw;
break; break;
case TOPCENTER: case TOPCENTER:
if (direction() == HORIZONTAL) top = height() + 2 * bw;
top = height() + 2 * bw;
break; break;
case TOPRIGHT: case TOPRIGHT:
if (direction() == HORIZONTAL) top = height() + 2 * bw;
top = height() + 2 * bw; break;
else case RIGHTTOP:
right = width() + 2 * bw; right = width() + 2 * bw;
break; break;
case BOTTOMLEFT: case BOTTOMLEFT:
if (direction() == HORIZONTAL) bottom = height() + 2 * bw;
bottom = height() + 2 * bw; break;
else case LEFTBOTTOM:
left = width() + 2 * bw; left = width() + 2 * bw;
break; break;
case BOTTOMCENTER: case BOTTOMCENTER:
// would be strange to have it request size on vertical direction bottom = height() + 2 * bw;
// each time we add a client
if (direction() == HORIZONTAL)
bottom = height() + 2 * bw;
break; break;
case BOTTOMRIGHT: case BOTTOMRIGHT:
if (direction() == HORIZONTAL) bottom = height() + 2 * bw;
bottom = height() + 2 * bw; break;
else case RIGHTBOTTOM:
right = width() + 2 * bw; right = width() + 2 * bw;
break; break;
case LEFTCENTER: case LEFTCENTER:
if (direction() == VERTICAL) left = width() + 2 * bw;
left = width() + 2 * bw;
break; break;
case RIGHTCENTER: case RIGHTCENTER:
if (direction() == VERTICAL) right = width() + 2 * bw;
right = width() + 2 * bw;
break; break;
} }
@ -551,11 +503,6 @@ void Slit::addClient(Window w) {
} }
void Slit::setDirection(Direction dir) {
*m_rc_direction = dir;
reconfigure();
}
void Slit::setPlacement(Placement place) { void Slit::setPlacement(Placement place) {
*m_rc_placement = place; *m_rc_placement = place;
reconfigure(); reconfigure();
@ -636,11 +583,15 @@ void Slit::reconfigure() {
const int bevel_width = theme()->bevelWidth(); const int bevel_width = theme()->bevelWidth();
// determine width or height increase // determine width or height increase
bool height_inc = false; bool height_inc = false;
switch (direction()) { switch (placement()) {
case VERTICAL: case LEFTTOP:
case RIGHTTOP:
case LEFTCENTER:
case RIGHTCENTER:
case LEFTBOTTOM:
case RIGHTBOTTOM:
height_inc = true; height_inc = true;
break; default:
case HORIZONTAL: // already false
break; break;
} }
@ -724,19 +675,10 @@ void Slit::reconfigure() {
show(); show();
int x = 0, y = 0; int x = 0, y = 0;
height_inc = false; if (height_inc)
switch (direction()) {
case VERTICAL:
x = 0;
y = bevel_width; y = bevel_width;
height_inc = true; else
break;
case HORIZONTAL:
x = bevel_width; x = bevel_width;
y = 0;
break;
}
client_it = m_client_list.begin(); client_it = m_client_list.begin();
for (; client_it != client_it_end; ++client_it) { for (; client_it != client_it_end; ++client_it) {
@ -826,90 +768,86 @@ void Slit::reposition() {
case TOPLEFT: case TOPLEFT:
frame.x = head_x; frame.x = head_x;
frame.y = head_y; frame.y = head_y;
if (direction() == VERTICAL) { frame.x_hidden = head_x;
frame.x_hidden = bevel_width - frame.y_hidden = bevel_width - border_width - frame.height;
border_width - frame.width; break;
frame.y_hidden = head_y;
} else { case LEFTTOP:
frame.x_hidden = head_x; frame.x = head_x;
frame.y_hidden = bevel_width - frame.y = head_y;
border_width - frame.height; frame.x_hidden = bevel_width - border_width - frame.width;
} frame.y_hidden = head_y;
break; break;
case LEFTCENTER: case LEFTCENTER:
frame.x = head_x; frame.x = head_x;
frame.y = head_y + (head_h - frame.height) / 2; frame.y = head_y + (head_h - frame.height) / 2;
frame.x_hidden = head_x + bevel_width - frame.x_hidden = head_x + bevel_width - border_width - frame.width;
border_width - frame.width;
frame.y_hidden = frame.y; frame.y_hidden = frame.y;
break; break;
case BOTTOMLEFT: case BOTTOMLEFT:
frame.x = head_x; frame.x = head_x;
frame.y = head_y + head_h - frame.height - border_width*2; frame.y = head_y + head_h - frame.height - border_width*2;
if (direction() == VERTICAL) { frame.x_hidden = head_x;
frame.x_hidden = head_x + bevel_width - frame.y_hidden = head_y + head_h - bevel_width - border_width;
border_width - frame.width; break;
frame.y_hidden = frame.y;
} else { case LEFTBOTTOM:
frame.x_hidden = head_x; frame.x = head_x;
frame.y_hidden = head_y + head_h - frame.y = head_y + head_h - frame.height - border_width*2;
bevel_width - border_width; frame.x_hidden = head_x + bevel_width - border_width - frame.width;
} frame.y_hidden = frame.y;
break; break;
case TOPCENTER: case TOPCENTER:
frame.x = head_x + ((head_w - frame.width) / 2); frame.x = head_x + ((head_w - frame.width) / 2);
frame.y = head_y; frame.y = head_y;
frame.x_hidden = frame.x; frame.x_hidden = frame.x;
frame.y_hidden = head_y + bevel_width - frame.y_hidden = head_y + bevel_width - border_width - frame.height;
border_width - frame.height;
break; break;
case BOTTOMCENTER: case BOTTOMCENTER:
frame.x = head_x + ((head_w - frame.width) / 2); frame.x = head_x + ((head_w - frame.width) / 2);
frame.y = head_y + head_h - frame.height - border_width*2; frame.y = head_y + head_h - frame.height - border_width*2;
frame.x_hidden = frame.x; frame.x_hidden = frame.x;
frame.y_hidden = head_y + head_h - frame.y_hidden = head_y + head_h - bevel_width - border_width;
bevel_width - border_width;
break; break;
case TOPRIGHT: case TOPRIGHT:
frame.x = head_x + head_w - frame.width - border_width*2; frame.x = head_x + head_w - frame.width - border_width*2;
frame.y = head_y; frame.y = head_y;
if (direction() == VERTICAL) { frame.x_hidden = frame.x;
frame.x_hidden = head_x + head_w - frame.y_hidden = head_y + bevel_width - border_width - frame.height;
bevel_width - border_width; break;
frame.y_hidden = head_y;
} else { case RIGHTTOP:
frame.x_hidden = frame.x; frame.x = head_x + head_w - frame.width - border_width*2;
frame.y_hidden = head_y + bevel_width - frame.y = head_y;
border_width - frame.height; frame.x_hidden = head_x + head_w - bevel_width - border_width;
} frame.y_hidden = head_y;
break; break;
case RIGHTCENTER: case RIGHTCENTER:
default:
frame.x = head_x + head_w - frame.width - border_width*2; frame.x = head_x + head_w - frame.width - border_width*2;
frame.y = head_y + ((head_h - frame.height) / 2); frame.y = head_y + ((head_h - frame.height) / 2);
frame.x_hidden = head_x + head_w - frame.x_hidden = head_x + head_w - bevel_width - border_width;
bevel_width - border_width;
frame.y_hidden = frame.y; frame.y_hidden = frame.y;
break; break;
case BOTTOMRIGHT: case BOTTOMRIGHT:
frame.x = head_x + head_w - frame.width - border_width*2; frame.x = head_x + head_w - frame.width - border_width*2;
frame.y = head_y + head_h - frame.height - border_width*2; frame.y = head_y + head_h - frame.height - border_width*2;
if (direction() == VERTICAL) { frame.x_hidden = frame.x;
frame.x_hidden = head_x + head_w - frame.y_hidden = head_y + head_h - bevel_width - border_width;
bevel_width - border_width; break;
frame.y_hidden = frame.y;
} else { case RIGHTBOTTOM:
frame.x_hidden = frame.x; default:
frame.y_hidden = head_y + head_h - frame.x = head_x + head_w - frame.width - border_width*2;
bevel_width - border_width; frame.y = head_y + head_h - frame.height - border_width*2;
} frame.x_hidden = head_x + head_w - bevel_width - border_width;
frame.y_hidden = frame.y;
break; break;
} }
@ -1292,9 +1230,6 @@ void Slit::setupMenu() {
m_slitmenu.insert(alpha_menuitem); m_slitmenu.insert(alpha_menuitem);
m_slitmenu.insert(new SlitDirMenuItem(_FB_XTEXT(Slit, Direction, "Slit Direction:", "Orientation of slit"),
*this,
save_and_reconfigure));
m_slitmenu.insert(_FB_XTEXT(Slit, ClientsMenu, "Clients", "Slit client menu"), &m_clientlist_menu); m_slitmenu.insert(_FB_XTEXT(Slit, ClientsMenu, "Clients", "Slit client menu"), &m_clientlist_menu);
m_slitmenu.updateMenu(); m_slitmenu.updateMenu();
@ -1311,18 +1246,24 @@ void Slit::setupMenu() {
// menu is 3 wide, 5 down // menu is 3 wide, 5 down
place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopLeft, "Top Left", "Top Left"), Slit::TOPLEFT)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopLeft, "Top Left", "Top Left"), Slit::TOPLEFT));
place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftTop, "Left Top", "Left Top"), Slit::LEFTTOP));
place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftCenter, "Left Center", "Left Center"), Slit::LEFTCENTER)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftCenter, "Left Center", "Left Center"), Slit::LEFTCENTER));
place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftBottom, "Left Bottom", "Left Bottom"), Slit::LEFTBOTTOM));
place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomLeft, "Bottom Left", "Bottom Left"), Slit::BOTTOMLEFT)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomLeft, "Bottom Left", "Bottom Left"), Slit::BOTTOMLEFT));
place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopCenter, "Top Center", "Top Center"), Slit::TOPCENTER)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopCenter, "Top Center", "Top Center"), Slit::TOPCENTER));
place_menu.push_back(PlacementP("", Slit::TOPLEFT)); place_menu.push_back(PlacementP("", Slit::TOPLEFT));
place_menu.push_back(PlacementP("", Slit::TOPLEFT));
place_menu.push_back(PlacementP("", Slit::TOPLEFT));
place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomCenter, "Bottom Center", "Bottom Center"), Slit::BOTTOMCENTER)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomCenter, "Bottom Center", "Bottom Center"), Slit::BOTTOMCENTER));
place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopRight, "Top Right", "Top Right"), Slit::TOPRIGHT)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopRight, "Top Right", "Top Right"), Slit::TOPRIGHT));
place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightTop, "Right Top", "Right Top"), Slit::RIGHTTOP));
place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightCenter, "Right Center", "Right Center"), Slit::RIGHTCENTER)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightCenter, "Right Center", "Right Center"), Slit::RIGHTCENTER));
place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightBottom, "Right Bottom", "Right Bottom"), Slit::RIGHTBOTTOM));
place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomRight, "Bottom Right", "Bottom Right"), Slit::BOTTOMRIGHT)); place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomRight, "Bottom Right", "Bottom Right"), Slit::BOTTOMRIGHT));
// create items in sub menu // create items in sub menu
for (size_t i=0; i<9; ++i) { for (size_t i=0; i<15; ++i) {
const FbTk::FbString &str = place_menu.front().first; const FbTk::FbString &str = place_menu.front().first;
Slit::Placement placement = place_menu.front().second; Slit::Placement placement = place_menu.front().second;

View file

@ -54,22 +54,23 @@ class Layer;
class Slit: public FbTk::EventHandler, public FbTk::Observer, public LayerObject { class Slit: public FbTk::EventHandler, public FbTk::Observer, public LayerObject {
public: public:
typedef std::list<SlitClient *> SlitClients; typedef std::list<SlitClient *> SlitClients;
/**
Client alignment
*/
enum Direction { VERTICAL = 1, HORIZONTAL };
/** /**
Placement on screen Placement on screen
*/ */
enum Placement { TOPLEFT = 1, LEFTCENTER, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER, enum Placement {
TOPRIGHT, RIGHTCENTER, BOTTOMRIGHT }; // top and bottom placement
TOPLEFT = 1, TOPCENTER, TOPRIGHT,
BOTTOMLEFT, BOTTOMCENTER, BOTTOMRIGHT,
// left and right placement
LEFTBOTTOM, LEFTCENTER, LEFTTOP,
RIGHTBOTTOM, RIGHTCENTER, RIGHTTOP
};
Slit(BScreen &screen, FbTk::XLayer &layer, const char *filename = 0); Slit(BScreen &screen, FbTk::XLayer &layer, const char *filename = 0);
virtual ~Slit(); virtual ~Slit();
void show() { frame.window.show(); m_visible = true; } void show() { frame.window.show(); m_visible = true; }
void hide() { frame.window.hide(); m_visible = false; } void hide() { frame.window.hide(); m_visible = false; }
void setDirection(Direction dir);
void setPlacement(Placement place); void setPlacement(Placement place);
void addClient(Window clientwin); void addClient(Window clientwin);
void removeClient(Window clientwin, bool remap = true); void removeClient(Window clientwin, bool remap = true);
@ -113,7 +114,6 @@ public:
bool isHidden() const { return m_hidden; } bool isHidden() const { return m_hidden; }
bool acceptKdeDockapp() const { return *m_rc_kde_dockapp; } bool acceptKdeDockapp() const { return *m_rc_kde_dockapp; }
bool doAutoHide() const { return *m_rc_auto_hide; } bool doAutoHide() const { return *m_rc_auto_hide; }
Direction direction() const { return *m_rc_direction; }
Placement placement() const { return *m_rc_placement; } Placement placement() const { return *m_rc_placement; }
int getOnHead() const { return *m_rc_on_head; } int getOnHead() const { return *m_rc_on_head; }
void saveOnHead(int head); void saveOnHead(int head);
@ -178,7 +178,6 @@ private:
FbTk::Resource<bool> m_rc_kde_dockapp, m_rc_auto_hide, m_rc_maximize_over; FbTk::Resource<bool> m_rc_kde_dockapp, m_rc_auto_hide, m_rc_maximize_over;
FbTk::Resource<Slit::Placement> m_rc_placement; FbTk::Resource<Slit::Placement> m_rc_placement;
FbTk::Resource<Slit::Direction> m_rc_direction;
FbTk::Resource<int> m_rc_alpha, m_rc_on_head; FbTk::Resource<int> m_rc_alpha, m_rc_on_head;
FbTk::Resource<class Layer> m_rc_layernum; FbTk::Resource<class Layer> m_rc_layernum;
}; };

View file

@ -61,13 +61,13 @@ class Toolbar: public FbTk::EventHandler,
public: public:
/// Toolbar placement on the screen /// Toolbar placement on the screen
enum Placement{ enum Placement {
// top and bottom placement // top and bottom placement
TOPLEFT = 1, BOTTOMLEFT, TOPCENTER, TOPLEFT = 1, TOPCENTER, TOPRIGHT,
BOTTOMCENTER, TOPRIGHT, BOTTOMRIGHT, BOTTOMLEFT, BOTTOMCENTER, BOTTOMRIGHT,
// left and right placement // left and right placement
LEFTCENTER, LEFTBOTTOM, LEFTTOP, LEFTBOTTOM, LEFTCENTER, LEFTTOP,
RIGHTCENTER, RIGHTBOTTOM, RIGHTTOP RIGHTBOTTOM, RIGHTCENTER, RIGHTTOP
}; };
/// Create a toolbar on the screen with specific width /// Create a toolbar on the screen with specific width

View file

@ -594,7 +594,7 @@ void Fluxbox::setupConfigFiles() {
if (create_windowmenu) if (create_windowmenu)
FbTk::FileUtil::copyFile(DEFAULT_WINDOWMENU, windowmenu_file.c_str()); FbTk::FileUtil::copyFile(DEFAULT_WINDOWMENU, windowmenu_file.c_str());
#define CONFIG_VERSION 8 #define CONFIG_VERSION 9
FbTk::Resource<int> config_version(m_resourcemanager, 0, FbTk::Resource<int> config_version(m_resourcemanager, 0,
"session.configVersion", "Session.ConfigVersion"); "session.configVersion", "Session.ConfigVersion");
if (*config_version < CONFIG_VERSION) { if (*config_version < CONFIG_VERSION) {

View file

@ -301,6 +301,28 @@ int run_updates(int old_version, FbTk::ResourceManager &rm) {
new_version = 8; new_version = 8;
} }
if (old_version < 9) { // change format of slit placement menu
FbTk::Resource<string> *placement =
new FbTk::Resource<string>(rm, "BottomRight",
"session.screen0.slit.placement",
"Session.Screen0.Slit.Placement");
FbTk::Resource<string> *direction =
new FbTk::Resource<string>(rm, "Vertical",
"session.screen0.slit.direction",
"Session.Screen0.Slit.Direction");
if (strcasecmp((**direction).c_str(), "vertical") == 0) {
if (strcasecmp((**placement).c_str(), "BottomRight") == 0)
*placement = "RightBottom";
else if (strcasecmp((**placement).c_str(), "BottomLeft") == 0)
*placement = "LeftBottom";
else if (strcasecmp((**placement).c_str(), "TopRight") == 0)
*placement = "RightTop";
else if (strcasecmp((**placement).c_str(), "TopLeft") == 0)
*placement = "LeftTop";
}
new_version = 9;
}
return new_version; return new_version;
} }