aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-08-15 21:03:57 (GMT)
committerPavel Labath <pavelo@centrum.sk>2013-02-18 21:04:26 (GMT)
commitcab5fa69f059033c4e304076f1892d9cf7c84031 (patch)
treedd56d66c9f19dbdc606c144e8c6af2a6a444c324 /src/Screen.cc
parenta897844ea1cfa6303112fd3f0d472d3e135bdc6d (diff)
downloadfluxbox_pavel-cab5fa69f059033c4e304076f1892d9cf7c84031.zip
fluxbox_pavel-cab5fa69f059033c4e304076f1892d9cf7c84031.tar.bz2
Move declarations of Resource enums to a separate file
The reason for this is that I need to access those enums from fluxbox-update_configs and I don't want to #include and link everything in src. I also merged Slit::Placement, Toolbar::Placement and FbWinFrame::TabPlacement into one enum.
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc86
1 files changed, 28 insertions, 58 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 8ffaf4f..1e0e623 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -31,7 +31,6 @@
31#include "Workspace.hh" 31#include "Workspace.hh"
32 32
33#include "Layer.hh" 33#include "Layer.hh"
34#include "FocusControl.hh"
35#include "ScreenPlacement.hh" 34#include "ScreenPlacement.hh"
36 35
37// menu items 36// menu items
@@ -186,7 +185,7 @@ int calcSquareDistance(int x1, int y1, int x2, int y2) {
186class TabPlacementMenuItem: public FbTk::RadioMenuItem { 185class TabPlacementMenuItem: public FbTk::RadioMenuItem {
187public: 186public:
188 TabPlacementMenuItem(const FbTk::FbString & label, BScreen &screen, 187 TabPlacementMenuItem(const FbTk::FbString & label, BScreen &screen,
189 FbWinFrame::TabPlacement place): 188 Placement place):
190 FbTk::RadioMenuItem(label), 189 FbTk::RadioMenuItem(label),
191 m_screen(screen), 190 m_screen(screen),
192 m_place(place) { 191 m_place(place) {
@@ -202,12 +201,7 @@ public:
202 201
203private: 202private:
204 BScreen &m_screen; 203 BScreen &m_screen;
205 FbWinFrame::TabPlacement m_place; 204 Placement m_place;
206};
207
208struct TabPlacementString {
209 FbWinFrame::TabPlacement placement;
210 const char* str;
211}; 205};
212 206
213 207
@@ -227,33 +221,9 @@ void initAtoms(Display* dpy) {
227 atom_kwm1 = XInternAtom(dpy, "KWM_DOCKWINDOW", False); 221 atom_kwm1 = XInternAtom(dpy, "KWM_DOCKWINDOW", False);
228} 222}
229 223
230
231} // end anonymous namespace 224} // end anonymous namespace
232 225
233 226
234
235namespace FbTk {
236
237template<>
238const EnumTraits<FbWinFrame::TabPlacement>::Pair EnumTraits<FbWinFrame::TabPlacement>::s_map[] = {
239 { "TopLeft", FbWinFrame::TOPLEFT },
240 { "Top", FbWinFrame::TOP },
241 { "TopRight", FbWinFrame::TOPRIGHT },
242 { "BottomLeft", FbWinFrame::BOTTOMLEFT },
243 { "Bottom", FbWinFrame::BOTTOM },
244 { "BottomRight", FbWinFrame::BOTTOMRIGHT },
245 { "LeftBottom", FbWinFrame::LEFTBOTTOM },
246 { "Left", FbWinFrame::LEFT },
247 { "LeftTop", FbWinFrame::LEFTTOP },
248 { "RightBottom", FbWinFrame::RIGHTBOTTOM },
249 { "Right", FbWinFrame::RIGHT },
250 { "RightTop", FbWinFrame::RIGHTTOP },
251 { NULL, FbWinFrame::RIGHTTOP }
252};
253
254} // end namespace FbTk
255
256
257BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager_base &rm, 227BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager_base &rm,
258 const string &scrname): 228 const string &scrname):
259 workspace_names(rm, std::vector<std::string>(), scrname + ".workspaceNames", 229 workspace_names(rm, std::vector<std::string>(), scrname + ".workspaceNames",
@@ -268,7 +238,7 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager_base &rm,
268 auto_raise(rm, true, scrname+".autoRaise"), 238 auto_raise(rm, true, scrname+".autoRaise"),
269 click_raises(rm, true, scrname+".clickRaises"), 239 click_raises(rm, true, scrname+".clickRaises"),
270 default_deco(rm, "NORMAL", scrname+".defaultDeco"), 240 default_deco(rm, "NORMAL", scrname+".defaultDeco"),
271 tab_placement(rm, FbWinFrame::TOPLEFT, scrname+".tab.placement"), 241 tab_placement(rm, TOPLEFT, scrname+".tab.placement"),
272 windowmenufile(rm, Fluxbox::instance()->getDefaultDataFilename("windowmenu.lua"), scrname+".windowMenu"), 242 windowmenufile(rm, Fluxbox::instance()->getDefaultDataFilename("windowmenu.lua"), scrname+".windowMenu"),
273 typing_delay(rm, 0, scrname+".noFocusWhileTypingDelay"), 243 typing_delay(rm, 0, scrname+".noFocusWhileTypingDelay"),
274 workspaces(rm, 4, scrname+".workspaces"), 244 workspaces(rm, 4, scrname+".workspaces"),
@@ -485,7 +455,7 @@ BScreen::BScreen(FbTk::ResourceManager_base &rm,
485 changeWorkspaceID(first_desktop); 455 changeWorkspaceID(first_desktop);
486 456
487#ifdef USE_SLIT 457#ifdef USE_SLIT
488 m_slit.reset(new Slit(*this, *layerManager().getLayer(ResourceLayer::DESKTOP))); 458 m_slit.reset(new Slit(*this, *layerManager().getLayer(LAYERDESKTOP)));
489#endif // USE_SLIT 459#endif // USE_SLIT
490 460
491 XFlush(disp); 461 XFlush(disp);
@@ -564,7 +534,7 @@ void BScreen::initWindows() {
564 534
565#ifdef USE_TOOLBAR 535#ifdef USE_TOOLBAR
566 m_toolbar.reset(new Toolbar(*this, 536 m_toolbar.reset(new Toolbar(*this,
567 *layerManager().getLayer(::ResourceLayer::NORMAL))); 537 *layerManager().getLayer(LAYERNORMAL)));
568#endif // USE_TOOLBAR 538#endif // USE_TOOLBAR
569 539
570 unsigned int nchild; 540 unsigned int nchild;
@@ -819,7 +789,7 @@ void BScreen::cycleFocus(int options, const ClientPattern *pat, bool reverse) {
819} 789}
820 790
821FbMenu *BScreen::createMenu(const string &label) { 791FbMenu *BScreen::createMenu(const string &label) {
822 FbTk::Layer* layer = layerManager().getLayer(ResourceLayer::MENU); 792 FbTk::Layer* layer = layerManager().getLayer(LAYERMENU);
823 FbMenu *menu = new FbMenu(menuTheme(), imageControl(), *layer); 793 FbMenu *menu = new FbMenu(menuTheme(), imageControl(), *layer);
824 if (!label.empty()) 794 if (!label.empty())
825 menu->setLabel(label); 795 menu->setLabel(label);
@@ -828,7 +798,7 @@ FbMenu *BScreen::createMenu(const string &label) {
828} 798}
829 799
830FbMenu *BScreen::createToggleMenu(const string &label) { 800FbMenu *BScreen::createToggleMenu(const string &label) {
831 FbTk::Layer* layer = layerManager().getLayer(ResourceLayer::MENU); 801 FbTk::Layer* layer = layerManager().getLayer(LAYERMENU);
832 FbMenu *menu = new ToggleMenu(menuTheme(), imageControl(), *layer); 802 FbMenu *menu = new ToggleMenu(menuTheme(), imageControl(), *layer);
833 if (!label.empty()) 803 if (!label.empty())
834 menu->setLabel(label); 804 menu->setLabel(label);
@@ -1530,24 +1500,24 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
1530 1500
1531 _FOCUSITEM(Configmenu, ClickFocus, 1501 _FOCUSITEM(Configmenu, ClickFocus,
1532 "Click To Focus", "Click to focus", 1502 "Click To Focus", "Click to focus",
1533 FocusControl::CLICKFOCUS); 1503 CLICKFOCUS);
1534 _FOCUSITEM(Configmenu, MouseFocus, 1504 _FOCUSITEM(Configmenu, MouseFocus,
1535 "Mouse Focus (Keyboard Friendly)", 1505 "Mouse Focus (Keyboard Friendly)",
1536 "Mouse Focus (Keyboard Friendly)", 1506 "Mouse Focus (Keyboard Friendly)",
1537 FocusControl::MOUSEFOCUS); 1507 MOUSEFOCUS);
1538 _FOCUSITEM(Configmenu, StrictMouseFocus, 1508 _FOCUSITEM(Configmenu, StrictMouseFocus,
1539 "Mouse Focus (Strict)", 1509 "Mouse Focus (Strict)",
1540 "Mouse Focus (Strict)", 1510 "Mouse Focus (Strict)",
1541 FocusControl::STRICTMOUSEFOCUS); 1511 STRICTMOUSEFOCUS);
1542#undef _FOCUSITEM 1512#undef _FOCUSITEM
1543 1513
1544 focus_menu->insert(new FbTk::MenuSeparator()); 1514 focus_menu->insert(new FbTk::MenuSeparator());
1545 focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu, 1515 focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu,
1546 ClickTabFocus, "ClickTabFocus", "Click tab to focus windows"), 1516 ClickTabFocus, "ClickTabFocus", "Click tab to focus windows"),
1547 focusControl(), FocusControl::CLICKTABFOCUS, reconf_cmd)); 1517 focusControl(), CLICKTABFOCUS, reconf_cmd));
1548 focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu, 1518 focus_menu->insert(new TabFocusModelMenuItem(_FB_XTEXT(Configmenu,
1549 MouseTabFocus, "MouseTabFocus", "Hover over tab to focus windows"), 1519 MouseTabFocus, "MouseTabFocus", "Hover over tab to focus windows"),
1550 focusControl(), FocusControl::MOUSETABFOCUS, reconf_cmd)); 1520 focusControl(), MOUSETABFOCUS, reconf_cmd));
1551 focus_menu->insert(new FbTk::MenuSeparator()); 1521 focus_menu->insert(new FbTk::MenuSeparator());
1552 1522
1553 try { 1523 try {
@@ -1638,25 +1608,25 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
1638 // menu is 3 wide, 5 down 1608 // menu is 3 wide, 5 down
1639 struct PlacementP { 1609 struct PlacementP {
1640 const FbTk::FbString label; 1610 const FbTk::FbString label;
1641 FbWinFrame::TabPlacement placement; 1611 Placement placement;
1642 }; 1612 };
1643 static const PlacementP place_menu[] = { 1613 static const PlacementP place_menu[] = {
1644 1614
1645 { _FB_XTEXT(Align, TopLeft, "Top Left", "Top Left"), FbWinFrame::TOPLEFT}, 1615 { _FB_XTEXT(Align, TopLeft, "Top Left", "Top Left"), TOPLEFT},
1646 { _FB_XTEXT(Align, LeftTop, "Left Top", "Left Top"), FbWinFrame::LEFTTOP}, 1616 { _FB_XTEXT(Align, LeftTop, "Left Top", "Left Top"), LEFTTOP},
1647 { _FB_XTEXT(Align, LeftCenter, "Left Center", "Left Center"), FbWinFrame::LEFT}, 1617 { _FB_XTEXT(Align, LeftCenter, "Left Center", "Left Center"), LEFTCENTER},
1648 { _FB_XTEXT(Align, LeftBottom, "Left Bottom", "Left Bottom"), FbWinFrame::LEFTBOTTOM}, 1618 { _FB_XTEXT(Align, LeftBottom, "Left Bottom", "Left Bottom"), LEFTBOTTOM},
1649 { _FB_XTEXT(Align, BottomLeft, "Bottom Left", "Bottom Left"), FbWinFrame::BOTTOMLEFT}, 1619 { _FB_XTEXT(Align, BottomLeft, "Bottom Left", "Bottom Left"), BOTTOMLEFT},
1650 { _FB_XTEXT(Align, TopCenter, "Top Center", "Top Center"), FbWinFrame::TOP}, 1620 { _FB_XTEXT(Align, TopCenter, "Top Center", "Top Center"), TOPCENTER},
1651 { "", FbWinFrame::TOPLEFT}, 1621 { "", TOPLEFT},
1652 { "", FbWinFrame::TOPLEFT}, 1622 { "", TOPLEFT},
1653 { "", FbWinFrame::TOPLEFT}, 1623 { "", TOPLEFT},
1654 { _FB_XTEXT(Align, BottomCenter, "Bottom Center", "Bottom Center"), FbWinFrame::BOTTOM}, 1624 { _FB_XTEXT(Align, BottomCenter, "Bottom Center", "Bottom Center"), BOTTOMCENTER},
1655 { _FB_XTEXT(Align, TopRight, "Top Right", "Top Right"), FbWinFrame::TOPRIGHT}, 1625 { _FB_XTEXT(Align, TopRight, "Top Right", "Top Right"), TOPRIGHT},
1656 { _FB_XTEXT(Align, RightTop, "Right Top", "Right Top"), FbWinFrame::RIGHTTOP}, 1626 { _FB_XTEXT(Align, RightTop, "Right Top", "Right Top"), RIGHTTOP},
1657 { _FB_XTEXT(Align, RightCenter, "Right Center", "Right Center"), FbWinFrame::RIGHT}, 1627 { _FB_XTEXT(Align, RightCenter, "Right Center", "Right Center"), RIGHTCENTER},
1658 { _FB_XTEXT(Align, RightBottom, "Right Bottom", "Right Bottom"), FbWinFrame::RIGHTBOTTOM}, 1628 { _FB_XTEXT(Align, RightBottom, "Right Bottom", "Right Bottom"), RIGHTBOTTOM},
1659 { _FB_XTEXT(Align, BottomRight, "Bottom Right", "Bottom Right"), FbWinFrame::BOTTOMRIGHT} 1629 { _FB_XTEXT(Align, BottomRight, "Bottom Right", "Bottom Right"), BOTTOMRIGHT}
1660 }; 1630 };
1661 1631
1662 tabplacement_menu->setMinimumColumns(3); 1632 tabplacement_menu->setMinimumColumns(3);