aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-08-16 11:35:11 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-08-16 11:35:11 (GMT)
commit733cdcb01bc2cd1e6451c3e34442a64eaaef7175 (patch)
tree02e7203029808118440c89f1eab4a8b9a736a0d4
parente49f8991e37b8eb25f1f8596d2a7446224a5a905 (diff)
downloadfluxbox_pavel-733cdcb01bc2cd1e6451c3e34442a64eaaef7175.zip
fluxbox_pavel-733cdcb01bc2cd1e6451c3e34442a64eaaef7175.tar.bz2
fluxbox-update_configs: add conversion of init files
-rw-r--r--src/FbTk/LResource.cc2
-rw-r--r--util/fluxbox-update_configs.cc295
2 files changed, 243 insertions, 54 deletions
diff --git a/src/FbTk/LResource.cc b/src/FbTk/LResource.cc
index 589e52f..cf6afaa 100644
--- a/src/FbTk/LResource.cc
+++ b/src/FbTk/LResource.cc
@@ -104,6 +104,8 @@ LResourceManager::LResourceManager(const std::string &root, Lua &l, unsigned int
104LResourceManager::LResourceManager(ResourceManager &old, Lua &l) 104LResourceManager::LResourceManager(ResourceManager &old, Lua &l)
105 : ResourceManager_base(old.root()), m_l(&l) { 105 : ResourceManager_base(old.root()), m_l(&l) {
106 106
107 setLua(l);
108
107 // We create a copy of the list so we can safely traverse it while the resources disassociate 109 // We create a copy of the list so we can safely traverse it while the resources disassociate
108 // themselves from the old resource manager 110 // themselves from the old resource manager
109 ResourceList list; 111 ResourceList list;
diff --git a/util/fluxbox-update_configs.cc b/util/fluxbox-update_configs.cc
index b486191..7450845 100644
--- a/util/fluxbox-update_configs.cc
+++ b/util/fluxbox-update_configs.cc
@@ -19,6 +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#include "../src/FbTk/Container.hh"
22#include "../src/FbTk/I18n.hh" 23#include "../src/FbTk/I18n.hh"
23#include "../src/FbTk/LResource.hh" 24#include "../src/FbTk/LResource.hh"
24#include "../src/FbTk/LuaUtil.hh" 25#include "../src/FbTk/LuaUtil.hh"
@@ -26,6 +27,7 @@
26#include "../src/FbTk/FileUtil.hh" 27#include "../src/FbTk/FileUtil.hh"
27 28
28#include "../src/defaults.hh" 29#include "../src/defaults.hh"
30#include "../src/Resources.hh"
29 31
30#ifdef HAVE_CONFIG_H 32#ifdef HAVE_CONFIG_H
31#include "config.h" 33#include "config.h"
@@ -54,6 +56,7 @@
54#include <map> 56#include <map>
55#include <cstdlib> 57#include <cstdlib>
56#include <list> 58#include <list>
59#include <vector>
57 60
58using std::cout; 61using std::cout;
59using std::cerr; 62using std::cerr;
@@ -75,7 +78,7 @@ void save_all_files();
75/*------------------------------------------------------------------*\ 78/*------------------------------------------------------------------*\
76\*------------------------------------------------------------------*/ 79\*------------------------------------------------------------------*/
77 80
78void update_add_mouse_evens_to_keys(std::auto_ptr<FbTk::ResourceManager_base>& rm) { 81void update_add_mouse_evens_to_keys(std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l) {
79 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile")); 82 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile"));
80 83
81 string whole_keyfile = read_file(keyfilename); 84 string whole_keyfile = read_file(keyfilename);
@@ -112,7 +115,7 @@ void update_add_mouse_evens_to_keys(std::auto_ptr<FbTk::ResourceManager_base>& r
112} 115}
113 116
114 117
115void update_move_groups_entries_to_apps_file(std::auto_ptr<FbTk::ResourceManager_base>& rm) { 118void update_move_groups_entries_to_apps_file(std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l) {
116 119
117 string appsfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("appsFile")); 120 string appsfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("appsFile"));
118 FbTk::StringResource rc_groupfile(*rm, "~/.fluxbox/groups", 121 FbTk::StringResource rc_groupfile(*rm, "~/.fluxbox/groups",
@@ -149,7 +152,7 @@ void update_move_groups_entries_to_apps_file(std::auto_ptr<FbTk::ResourceManager
149} 152}
150 153
151 154
152void update_move_toolbar_wheeling_to_keys_file(std::auto_ptr<FbTk::ResourceManager_base>& rm) { 155void update_move_toolbar_wheeling_to_keys_file(std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l) {
153 156
154 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile")); 157 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile"));
155 string whole_keyfile = read_file(keyfilename); 158 string whole_keyfile = read_file(keyfilename);
@@ -188,7 +191,7 @@ void update_move_toolbar_wheeling_to_keys_file(std::auto_ptr<FbTk::ResourceManag
188 191
189 192
190 193
191void update_move_modkey_to_keys_file(std::auto_ptr<FbTk::ResourceManager_base>& rm) { 194void update_move_modkey_to_keys_file(std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l) {
192 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile")); 195 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile"));
193 string whole_keyfile = read_file(keyfilename); 196 string whole_keyfile = read_file(keyfilename);
194 string new_keyfile = ""; 197 string new_keyfile = "";
@@ -223,35 +226,32 @@ void update_move_modkey_to_keys_file(std::auto_ptr<FbTk::ResourceManager_base>&
223 226
224 227
225 228
226void update_window_patterns_for_iconbar(std::auto_ptr<FbTk::ResourceManager_base>& rm) { 229void
230update_window_patterns_for_iconbar(std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l) {
227 231
228 // this needs to survive after going out of scope 232 FbTk::StringResource &rc_mode =
229 // it won't get freed, but that's ok 233 rm->getResource<string, FbTk::StringTraits>("screen0.iconbar.mode");
230 FbTk::StringResource *rc_mode =
231 new FbTk::StringResource(*rm, "Workspace",
232 "screen0.iconbar.mode",
233 "Screen0.Iconbar.Mode");
234 234
235 std::string mode = FbTk::StringUtil::toLower(**rc_mode); 235 std::string mode = FbTk::StringUtil::toLower(*rc_mode);
236 if (mode == "none") 236 if (mode == "none")
237 *rc_mode = "none"; 237 rc_mode = "none";
238 else if (mode == "icons") 238 else if (mode == "icons")
239 *rc_mode = "{static groups} (minimized=yes)"; 239 rc_mode = "{static groups} (minimized=yes)";
240 else if (mode == "noicons") 240 else if (mode == "noicons")
241 *rc_mode = "{static groups} (minimized=no)"; 241 rc_mode = "{static groups} (minimized=no)";
242 else if (mode == "workspaceicons") 242 else if (mode == "workspaceicons")
243 *rc_mode = "{static groups} (minimized=yes) (workspace)"; 243 rc_mode = "{static groups} (minimized=yes) (workspace)";
244 else if (mode == "workspacenoicons") 244 else if (mode == "workspacenoicons")
245 *rc_mode = "{static groups} (minimized=no) (workspace)"; 245 rc_mode = "{static groups} (minimized=no) (workspace)";
246 else if (mode == "allwindows") 246 else if (mode == "allwindows")
247 *rc_mode = "{static groups}"; 247 rc_mode = "{static groups}";
248 else 248 else
249 *rc_mode = "{static groups} (workspace)"; 249 rc_mode = "{static groups} (workspace)";
250 250
251} 251}
252 252
253 253
254void update_move_titlebar_actions_to_keys_file(std::auto_ptr<FbTk::ResourceManager_base>& rm) { 254void update_move_titlebar_actions_to_keys_file(std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l) {
255 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile")); 255 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile"));
256 string whole_keyfile = read_file(keyfilename); 256 string whole_keyfile = read_file(keyfilename);
257 string new_keyfile = ""; 257 string new_keyfile = "";
@@ -288,7 +288,7 @@ void update_move_titlebar_actions_to_keys_file(std::auto_ptr<FbTk::ResourceManag
288} 288}
289 289
290 290
291void update_added_starttabbing_command(std::auto_ptr<FbTk::ResourceManager_base>& rm) { 291void update_added_starttabbing_command(std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l) {
292 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile")); 292 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile"));
293 string whole_keyfile = read_file(keyfilename); 293 string whole_keyfile = read_file(keyfilename);
294 string new_keyfile = ""; 294 string new_keyfile = "";
@@ -302,47 +302,43 @@ void update_added_starttabbing_command(std::auto_ptr<FbTk::ResourceManager_base>
302 302
303 303
304 304
305void update_disable_icons_in_tabs_for_backwards_compatibility(std::auto_ptr<FbTk::ResourceManager_base>& rm) { 305void
306update_disable_icons_in_tabs_for_backwards_compatibility(
307 std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l) {
306 308
307 FbTk::BoolResource *show = 309 FbTk::BoolResource &show =
308 new FbTk::BoolResource(*rm, false, 310 rm->getResource<bool, FbTk::BoolTraits>("screen0.tabs.usePixmap");
309 "screen0.tabs.usePixmap", 311 if (!show) // only change if the setting didn't already exist
310 "Screen0.Tabs.UsePixmap"); 312 show = false;
311 if (!*show) // only change if the setting didn't already exist
312 *show = false;
313} 313}
314 314
315 315
316 316
317 317
318void update_change_format_of_split_placement_menu(std::auto_ptr<FbTk::ResourceManager_base>& rm) { 318void update_change_format_of_split_placement_menu(std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l) {
319 319
320 FbTk::StringResource *placement = 320 PlacementResource &placement =
321 new FbTk::StringResource(*rm, "BottomRight", 321 rm->getResource<Placement, FbTk::EnumTraits<Placement> >("screen0.slit.placement");
322 "screen0.slit.placement",
323 "Screen0.Slit.Placement");
324 322
325 FbTk::StringResource *direction = 323 FbTk::StringResource &direction =
326 new FbTk::StringResource(*rm, "Vertical", 324 rm->getResource<string, FbTk::StringTraits>("screen0.slit.direction");
327 "screen0.slit.direction",
328 "Screen0.Slit.Direction");
329 325
330 if (strcasecmp((*direction)->c_str(), "vertical") == 0) { 326 if (strcasecmp(direction->c_str(), "vertical") == 0) {
331 if (strcasecmp((*placement)->c_str(), "BottomRight") == 0) 327 if (*placement == BOTTOMRIGHT)
332 *placement = "RightBottom"; 328 placement = RIGHTBOTTOM;
333 else if (strcasecmp((*placement)->c_str(), "BottomLeft") == 0) 329 else if (*placement == BOTTOMLEFT)
334 *placement = "LeftBottom"; 330 placement = LEFTBOTTOM;
335 else if (strcasecmp((*placement)->c_str(), "TopRight") == 0) 331 else if (*placement == TOPRIGHT)
336 *placement = "RightTop"; 332 placement = RIGHTTOP;
337 else if (strcasecmp((*placement)->c_str(), "TopLeft") == 0) 333 else if (*placement == TOPLEFT)
338 *placement = "LeftTop"; 334 placement = LEFTTOP;
339 } 335 }
340} 336}
341 337
342 338
343 339
344 340
345void update_update_keys_file_for_nextwindow_syntax_changes(std::auto_ptr<FbTk::ResourceManager_base>& rm) { 341void update_update_keys_file_for_nextwindow_syntax_changes(std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l) {
346 342
347 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile")); 343 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile"));
348 string whole_keyfile = read_file(keyfilename); 344 string whole_keyfile = read_file(keyfilename);
@@ -399,7 +395,7 @@ void update_update_keys_file_for_nextwindow_syntax_changes(std::auto_ptr<FbTk::R
399 395
400 396
401 397
402void update_keys_for_ongrip_onwindowborder(std::auto_ptr<FbTk::ResourceManager_base>& rm) { 398void update_keys_for_ongrip_onwindowborder(std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l) {
403 399
404 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile")); 400 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile"));
405 string whole_keyfile = read_file(keyfilename); 401 string whole_keyfile = read_file(keyfilename);
@@ -419,7 +415,7 @@ void update_keys_for_ongrip_onwindowborder(std::auto_ptr<FbTk::ResourceManager_b
419 415
420 416
421 417
422void update_keys_for_activetab(std::auto_ptr<FbTk::ResourceManager_base>& rm) { 418void update_keys_for_activetab(std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l) {
423 419
424 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile")); 420 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile"));
425 string whole_file = read_file(keyfilename); 421 string whole_file = read_file(keyfilename);
@@ -437,7 +433,7 @@ void update_keys_for_activetab(std::auto_ptr<FbTk::ResourceManager_base>& rm) {
437 433
438 434
439// NextWindow {static groups} => NextWindow {static groups} (workspace=[current]) 435// NextWindow {static groups} => NextWindow {static groups} (workspace=[current])
440void update_limit_nextwindow_to_current_workspace(std::auto_ptr<FbTk::ResourceManager_base>& rm) { 436void update_limit_nextwindow_to_current_workspace(std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l) {
441 437
442 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile")); 438 string keyfilename = FbTk::StringUtil::expandFilename(rm->resourceValue("keyFile"));
443 string whole_file = read_file(keyfilename); 439 string whole_file = read_file(keyfilename);
@@ -523,14 +519,197 @@ void update_limit_nextwindow_to_current_workspace(std::auto_ptr<FbTk::ResourceMa
523 write_file(keyfilename, new_keyfile); 519 write_file(keyfilename, new_keyfile);
524} 520}
525 521
526void update_lua_resource_manager(std::auto_ptr<FbTk::ResourceManager_base>& rm) { 522struct ScreenResource {
523 typedef FbTk::VectorTraits<FbTk::EnumTraits<WinButtonType> > WinButtonsTraits;
524 static WinButtonType titlebar_left_[];
525 static WinButtonType titlebar_right_[];
526
527 ScreenResource(FbTk::ResourceManager_base &rm,
528 const std::string &name, const std::string &altname);
529
530 FbTk::Resource<
531 std::vector<std::string>, FbTk::VectorTraits<FbTk::StringTraits>
532 > workspace_names;
533
534 FbTk::BoolResource opaque_move, full_max,
535 max_ignore_inc, max_disable_move, max_disable_resize,
536 workspace_warping, show_window_pos, auto_raise, click_raises;
537 FbTk::StringResource default_deco;
538 PlacementResource tab_placement;
539 FbTk::StringResource windowmenufile;
540 FbTk::UIntResource typing_delay;
541 FbTk::IntResource workspaces, edge_snap_threshold, focused_alpha,
542 unfocused_alpha, menu_alpha;
543 FbTk::RangedIntResource menu_delay;
544 FbTk::IntResource tab_width, tooltip_delay;
545 FbTk::BoolResource allow_remote_actions;
546 FbTk::BoolResource clientmenu_use_pixmap;
547// FbTk::BoolResource tabs_use_pixmap;
548 FbTk::BoolResource max_over_tabs;
549 FbTk::BoolResource default_internal_tabs;
550
551 FbTk::IntResource demands_attention_timeout;
552 FbTk::StringResource timeformat;
553 FbTk::Resource<FocusModel, FbTk::EnumTraits<FocusModel> > focus_model;
554 FbTk::Resource<TabFocusModel, FbTk::EnumTraits<TabFocusModel> > tab_focus_model;
555 FbTk::BoolResource focus_new;
556// FbTk::StringResource mode;
557 FbTk::Resource<
558 FbTk::Container::Alignment, FbTk::EnumTraits<FbTk::Container::Alignment>
559 > alignment;
560 FbTk::IntResource client_width;
561 FbTk::UIntResource client_padding;
562 FbTk::BoolResource use_pixmap;
563 FbTk::Resource<RowDirection, FbTk::EnumTraits<RowDirection> > row_direction;
564 FbTk::Resource<ColumnDirection, FbTk::EnumTraits<ColumnDirection> > col_direction;
565 FbTk::Resource<PlacementPolicy, FbTk::EnumTraits<PlacementPolicy> > placement_policy;
566 FbTk::BoolResource kde_dockapp, slit_auto_hide, slit_maximize_over;
567// PlacementResource slit_placement;
568 FbTk::IntResource slit_alpha, slit_on_head;
569 FbTk::Resource<LayerType, FbTk::EnumTraits<LayerType> > slit_layernum;
570 FbTk::BoolResource toolbar_auto_hide, toolbar_maximize_over, visible;
571 FbTk::IntResource width_percent;
572 FbTk::IntResource toolbar_alpha;
573 FbTk::Resource<LayerType, FbTk::EnumTraits<LayerType> > toolbar_layernum;
574 FbTk::IntResource toolbar_on_head;
575 PlacementResource toolbar_placement;
576 FbTk::IntResource height;
577 FbTk::StringResource tools;
578 FbTk::Resource<std::vector<WinButtonType>, WinButtonsTraits> titlebar_left, titlebar_right;
579};
580
581WinButtonType ScreenResource::titlebar_left_[] = { STICKBUTTON };
582WinButtonType ScreenResource::titlebar_right_[] = {
583 MINIMIZEBUTTON,
584 MAXIMIZEBUTTON,
585 CLOSEBUTTON
586};
587
588ScreenResource::ScreenResource(FbTk::ResourceManager_base &rm,
589 const std::string &name, const std::string &altname) :
590 workspace_names(rm, std::vector<std::string>(), name + ".workspaceNames",
591 altname + ".WorkspaceNames", FbTk::VectorTraits<FbTk::StringTraits>(",") ),
592 opaque_move(rm, true, name + ".opaqueMove", altname + ".OpaqueMove"),
593 full_max(rm, false, name + ".fullMaximization", altname + ".FullMaximization"),
594 max_ignore_inc(rm, true, name + ".maxIgnoreIncrement", altname + ".MaxIgnoreIncrement"),
595 max_disable_move(rm, false, name + ".maxDisableMove", altname + ".MaxDisableMove"),
596 max_disable_resize(rm, false, name + ".maxDisableResize", altname + ".MaxDisableResize"),
597 workspace_warping(rm, true, name + ".workspacewarping", altname + ".WorkspaceWarping"),
598 show_window_pos(rm, false, name + ".showwindowposition", altname + ".ShowWindowPosition"),
599 auto_raise(rm, true, name + ".autoRaise", altname + ".AutoRaise"),
600 click_raises(rm, true, name + ".clickRaises", altname + ".ClickRaises"),
601 default_deco(rm, "NORMAL", name + ".defaultDeco", altname + ".DefaultDeco"),
602 tab_placement(rm, TOPLEFT, name + ".tab.placement", altname + ".Tab.Placement"),
603 windowmenufile(rm, getenv("HOME") + string("~/.fluxbox/windowmenu"),
604 name + ".windowMenu", altname + ".WindowMenu"),
605 typing_delay(rm, 0, name + ".noFocusWhileTypingDelay", altname + ".NoFocusWhileTypingDelay"),
606 workspaces(rm, 4, name + ".workspaces", altname + ".Workspaces"),
607 edge_snap_threshold(rm, 10, name + ".edgeSnapThreshold", altname + ".EdgeSnapThreshold"),
608 focused_alpha(rm, 255, name + ".window.focus.alpha", altname + ".Window.Focus.Alpha"),
609 unfocused_alpha(rm, 255, name + ".window.unfocus.alpha", altname + ".Window.Unfocus.Alpha"),
610 menu_alpha(rm, 255, name + ".menu.alpha", altname + ".Menu.Alpha"),
611 menu_delay(rm, 200, name + ".menuDelay", altname + ".MenuDelay",
612 FbTk::RangedIntTraits(0, 5000)),
613 tab_width(rm, 64, name + ".tab.width", altname + ".Tab.Width"),
614 tooltip_delay(rm, 500, name + ".tooltipDelay", altname + ".TooltipDelay"),
615 allow_remote_actions(rm, false,
616 name + ".allowRemoteActions", altname + ".AllowRemoteActions"),
617 clientmenu_use_pixmap(rm, true,
618 name + ".clientMenu.usePixmap", altname + ".ClientMenu.UsePixmap"),
619// declared in main()
620// tabs_use_pixmap(rm, true, name + ".tabs.usePixmap", altname + ".Tabs.UsePixmap"),
621 max_over_tabs(rm, false, name + ".tabs.maxOver", altname + ".Tabs.MaxOver"),
622 default_internal_tabs(rm, true, name + ".tabs.intitlebar", altname + ".Tabs.InTitlebar"),
623
624 demands_attention_timeout(rm, 500, name + ".demandsAttentionTimeout",
625 altname + ".DemandsAttentionTimeout"),
626 timeformat(rm, std::string("%k:%M"), name + ".strftimeFormat", altname + ".StrftimeFormat"),
627 focus_model(rm, CLICKFOCUS, name + ".focusModel", altname + ".FocusModel"),
628 tab_focus_model(rm, CLICKTABFOCUS,
629 name + ".tabFocusModel", altname + ".TabFocusModel"),
630 focus_new(rm, true, name + ".focusNewWindows", altname + ".FocusNewWindows"),
631// declared in main()
632// mode(rm, "{static groups} (workspace)", name + ".iconbar.mode", altname + ".Iconbar.Mode"),
633 alignment(rm, FbTk::Container::RELATIVE,
634 name + ".iconbar.alignment", altname + ".Iconbar.Alignment"),
635 client_width(rm, 128, name + ".iconbar.iconWidth", altname + ".Iconbar.IconWidth"),
636 client_padding(rm, 10,
637 name + ".iconbar.iconTextPadding", altname + ".Iconbar.IconTextPadding"),
638 use_pixmap(rm, true, name + ".iconbar.usePixmap", altname + ".Iconbar.UsePixmap"),
639 row_direction(rm, LEFTRIGHTDIRECTION,
640 name + ".rowPlacementDirection", altname + ".RowPlacementDirection"),
641 col_direction(rm, TOPBOTTOMDIRECTION,
642 name + ".colPlacementDirection", altname + ".ColPlacementDirection"),
643 placement_policy(rm, ROWMINOVERLAPPLACEMENT,
644 name + ".windowPlacement", altname + ".WindowPlacement"),
645 kde_dockapp(rm, true, name + ".slit.acceptKdeDockapps", altname + ".Slit.AcceptKdeDockapps"),
646 slit_auto_hide(rm, false, name + ".slit.autoHide", altname + ".Slit.AutoHide"),
647 slit_maximize_over(rm, false, name + ".slit.maxOver", altname + ".Slit.MaxOver"),
648// declared in main()
649// slit_placement(rm, RIGHTBOTTOM, name + ".slit.placement", altname + ".Slit.Placement"),
650 slit_alpha(rm, 255, name + ".slit.alpha", altname + ".Slit.Alpha"),
651 slit_on_head(rm, 0, name + ".slit.onhead", altname + ".Slit.onHead"),
652 slit_layernum(rm, LAYERDOCK, name + ".slit.layer", altname + ".Slit.Layer"),
653 toolbar_auto_hide(rm, false, name + ".toolbar.autoHide", altname + ".Toolbar.AutoHide"),
654 toolbar_maximize_over(rm, false, name + ".toolbar.maxOver", altname + ".Toolbar.MaxOver"),
655 visible(rm, true, name + ".toolbar.visible", altname + ".Toolbar.Visible"),
656 width_percent(rm, 100,
657 name + ".toolbar.widthPercent", altname + ".Toolbar.WidthPercent"),
658 toolbar_alpha(rm, 255,
659 name + ".toolbar.alpha", altname + ".Toolbar.Alpha"),
660 toolbar_layernum(rm, LAYERDOCK, name + ".toolbar.layer", altname + ".Toolbar.Layer"),
661 toolbar_on_head(rm, 1,
662 name + ".toolbar.onhead", altname + ".Toolbar.onHead"),
663 toolbar_placement(rm, BOTTOMCENTER,
664 name + ".toolbar.placement", altname + ".Toolbar.Placement"),
665 height(rm, 0, name + ".toolbar.height", altname + ".Toolbar.Height"),
666 tools(rm, "prevworkspace, workspacename, nextworkspace, iconbar, systemtray, clock",
667 name + ".toolbar.tools", altname + ".Toolbar.Tools"),
668 titlebar_left(rm, std::vector<WinButtonType>(titlebar_left_, titlebar_left_+1),
669 name + ".titlebar.left", altname + ".Titlebar.Left", WinButtonsTraits(" \t\n")),
670 titlebar_right(rm, std::vector<WinButtonType>(titlebar_right_, titlebar_right_+3),
671 name + ".titlebar.right", altname + ".Titlebar.Right", WinButtonsTraits(" \t\n"))
672{}
673
674
675void update_lua_resource_manager(std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l) {
527 if( dynamic_cast<FbTk::LResourceManager *>(rm.get()) ) { 676 if( dynamic_cast<FbTk::LResourceManager *>(rm.get()) ) {
528 // there's nothing to do, we already have a lua resource manager 677 // there's nothing to do, we already have a lua resource manager
529 // this shouldn't happen, since all lua init files should have versions >= 14 678 // this shouldn't happen, since all lua init files should have versions >= 14
530 return; 679 return;
531 } 680 }
532 681
682 FbTk::BoolResource rc_ignoreborder(*rm, false, "ignoreBorder", "IgnoreBorder");
683 FbTk::BoolResource rc_pseudotrans(*rm, false,
684 "forcePseudoTransparency", "forcePseudoTransparency");
685 FbTk::IntResource rc_colors_per_channel(*rm, 4, "colorsPerChannel", "ColorsPerChannel");
686 FbTk::IntResource rc_double_click_interval(*rm, 250,
687 "doubleClickInterval", "DoubleClickInterval");
688 FbTk::IntResource rc_tabs_padding(*rm, 0, "tabPadding", "TabPadding");
689 FbTk::StringResource rc_stylefile(*rm, DEFAULTSTYLE, "styleFile", "StyleFile");
690 FbTk::StringResource rc_styleoverlayfile(*rm, getenv("HOME") + string("/.fluxbox/overlay"),
691 "styleOverlay", "StyleOverlay");
692 FbTk::StringResource rc_menufile(*rm, getenv("HOME") + string("/.fluxbox/menu"),
693 "menuFile", "MenuFile");
694 FbTk::StringResource rc_slitlistfile(*rm, getenv("HOME") + string("/.fluxbox/slitlist"),
695 "slitlistFile", "SlitlistFile");
696
697/* Key and apps file resources are declared in run_updates
698 FbTk::StringResource rc_keyfile(*rm, getenv("HOME") + string("/.fluxbox/keys"),
699 "keyFile", "KeyFile");
700 FbTk::StringResource rc_appsfile(*rm, getenv("HOME") + string("/.fluxbox/apps"),
701 "appsFile", "AppsFile");*/
702
703 FbTk::Resource<
704 TabsAttachArea, FbTk::EnumTraits<TabsAttachArea>
705 > rc_tabs_attach_area(*rm, ATTACH_AREA_WINDOW, "tabsAttachArea", "TabsAttachArea");
706 FbTk::UIntResource rc_cache_life(*rm, 5, "cacheLife", "CacheLife");
707 FbTk::UIntResource rc_cache_max(*rm, 200, "cacheMax", "CacheMax");
708 FbTk::Resource<time_t, FbTk::IntTraits<time_t> > rc_auto_raise_delay(*rm, 250, "autoRaiseDelay", "AutoRaiseDelay");
709
710 ScreenResource screen_resource(*rm, "screen0", "Screen0");
533 711
712 rm.reset(new FbTk::LResourceManager(dynamic_cast<FbTk::ResourceManager &>(*rm), l));
534} 713}
535 714
536/*------------------------------------------------------------------*\ 715/*------------------------------------------------------------------*\
@@ -538,7 +717,7 @@ void update_lua_resource_manager(std::auto_ptr<FbTk::ResourceManager_base>& rm)
538 717
539struct Update { 718struct Update {
540 int version; 719 int version;
541 void (*update)(std::auto_ptr<FbTk::ResourceManager_base>& rm); 720 void (*update)(std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l);
542}; 721};
543 722
544const Update UPDATES[] = { 723const Update UPDATES[] = {
@@ -571,7 +750,7 @@ int run_updates(int old_version, std::auto_ptr<FbTk::ResourceManager_base> &rm,
571 750
572 for (size_t i = 0; i < sizeof(UPDATES) / sizeof(Update); ++i) { 751 for (size_t i = 0; i < sizeof(UPDATES) / sizeof(Update); ++i) {
573 if (old_version < UPDATES[i].version) { 752 if (old_version < UPDATES[i].version) {
574 UPDATES[i].update(rm); 753 UPDATES[i].update(rm, l);
575 new_version = UPDATES[i].version; 754 new_version = UPDATES[i].version;
576 } 755 }
577 } 756 }
@@ -644,7 +823,7 @@ int main(int argc, char **argv) {
644 } else if (arg == "-help" || arg == "-h") { 823 } else if (arg == "-help" || arg == "-h") {
645 // no NLS translations yet -- we'll just have to use English for now 824 // no NLS translations yet -- we'll just have to use English for now
646 cout << " -rc <string>\t\t\twhere to save the new resource file.\n" 825 cout << " -rc <string>\t\t\twhere to save the new resource file.\n"
647 << " -oldrc <string>\t\t\tfile from which to load old resources (default = same as -rc).\n" 826 << " -oldrc <string>\t\tfile from which to load old resources (default = same as -rc).\n"
648 << " -pid <int>\t\t\ttell fluxbox to reload configuration.\n" 827 << " -pid <int>\t\t\ttell fluxbox to reload configuration.\n"
649 << " -check\t\t\tcheck version of this tool and the fluxbox config.\n" 828 << " -check\t\t\tcheck version of this tool and the fluxbox config.\n"
650 << " -help\t\t\t\tdisplay this help text and exit.\n\n" 829 << " -help\t\t\t\tdisplay this help text and exit.\n\n"
@@ -697,6 +876,14 @@ int main(int argc, char **argv) {
697 return 0; 876 return 0;
698 } 877 }
699 878
879 FbTk::StringResource rc_iconbar_mode(*resource_manager, "{static groups} (workspace)",
880 "screen0.iconbar.mode", "Screen0.Iconbar.Mode");
881 FbTk::BoolResource rc_tabs_usepixmap(*resource_manager, true,
882 "screen0.tabs.usePixmap", "Screen0.Tabs.UsePixmap");
883 PlacementResource rc_slit_placement(*resource_manager, RIGHTBOTTOM,
884 "screen0.slit.placement", "Screen0.Slit.Placement");
885 FbTk::StringResource rc_slit_direction(*resource_manager, "Vertical",
886 "screen0.slit.direction", "Screen0.Slit.Direction");
700 887
701 int old_version = *config_version; 888 int old_version = *config_version;
702 int new_version = run_updates(old_version, resource_manager, l); 889 int new_version = run_updates(old_version, resource_manager, l);