From b0af80ec1dacccde14ec9ff4019b3db3b58a162c Mon Sep 17 00:00:00 2001 From: fluxgen Date: Mon, 22 Mar 2004 21:01:42 +0000 Subject: added screen resource .overlay.lineWidth, .overlay.lineStyle and .overlay.capStyle which defines the line style for resize and move actions on windows, patch from Mathias Gumz --- src/RootTheme.cc | 3 +- src/RootTheme.hh | 10 ++++- src/Screen.cc | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- src/Screen.hh | 6 ++- 4 files changed, 142 insertions(+), 5 deletions(-) diff --git a/src/RootTheme.cc b/src/RootTheme.cc index 03eb8b1..813d867 100644 --- a/src/RootTheme.cc +++ b/src/RootTheme.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: RootTheme.cc,v 1.7 2004/01/02 13:28:38 fluxgen Exp $ +// $Id: RootTheme.cc,v 1.8 2004/03/22 21:01:42 fluxgen Exp $ #include "RootTheme.hh" @@ -37,6 +37,7 @@ RootTheme::RootTheme(int screen_num, std::string &screen_root_command): m_opgc.setForeground(WhitePixel(disp, screen_num)^BlackPixel(disp, screen_num)); m_opgc.setFunction(GXxor); m_opgc.setSubwindowMode(IncludeInferiors); + m_opgc.setLineAttributes(1, LineSolid, CapNotLast, JoinMiter); } RootTheme::~RootTheme() { diff --git a/src/RootTheme.hh b/src/RootTheme.hh index 686a4ed..83ce2c8 100644 --- a/src/RootTheme.hh +++ b/src/RootTheme.hh @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: RootTheme.hh,v 1.6 2004/01/02 13:28:38 fluxgen Exp $ +// $Id: RootTheme.hh,v 1.7 2004/03/22 21:01:42 fluxgen Exp $ #ifndef ROOTTHEME_HH #define ROOTTHEME_HH @@ -44,6 +44,14 @@ public: void reconfigTheme(); GC opGC() const { return m_opgc.gc(); } + + void setLineAttributes(unsigned int width, + int line_style, + int cap_style, + int join_style) { + m_opgc.setLineAttributes(width, line_style, cap_style, join_style); + } + //!! TODO we should need this later void lock(bool value) { m_lock = value; } private: diff --git a/src/Screen.cc b/src/Screen.cc index 8c01402..a1a6dbc 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.270 2004/03/21 09:00:24 rathnor Exp $ +// $Id: Screen.cc,v 1.271 2004/03/22 21:01:10 fluxgen Exp $ #include "Screen.hh" @@ -306,6 +306,113 @@ setFromString(char const *strval) { setDefaultValue(); } +template<> +void FbTk::Resource::setDefaultValue() { + *(*this) = FbTk::GContext::LINESOLID; +} + +template<> +std::string FbTk::Resource::getString() { + switch(m_value) { + case FbTk::GContext::LINESOLID: + return "LineSolid"; + break; + case FbTk::GContext::LINEONOFFDASH: + return "LineOnOffDash"; + break; + case FbTk::GContext::LINEDOUBLEDASH: + return "LineDoubleDash"; + break; + }; +} + +template<> +void FbTk::Resource +::setFromString(char const *strval) { + + if (strcasecmp(strval, "LineSolid") == 0 ) + m_value = FbTk::GContext::LINESOLID; + else if (strcasecmp(strval, "LineOnOffDash") == 0 ) + m_value = FbTk::GContext::LINEONOFFDASH; + else if (strcasecmp(strval, "LineDoubleDash") == 0) + m_value = FbTk::GContext::LINEDOUBLEDASH; + else + setDefaultValue(); +} + +template<> +void FbTk::Resource::setDefaultValue() { + *(*this) = FbTk::GContext::JOINMITER; +} + +template<> +std::string FbTk::Resource::getString() { + switch(m_value) { + case FbTk::GContext::JOINMITER: + return "JoinMiter"; + break; + case FbTk::GContext::JOINBEVEL: + return "JoinBevel"; + break; + case FbTk::GContext::JOINROUND: + return "JoinRound"; + break; + }; +} + +template<> +void FbTk::Resource +::setFromString(char const *strval) { + + if (strcasecmp(strval, "JoinRound") == 0 ) + m_value = FbTk::GContext::JOINROUND; + else if (strcasecmp(strval, "JoinMiter") == 0 ) + m_value = FbTk::GContext::JOINMITER; + else if (strcasecmp(strval, "JoinBevel") == 0) + m_value = FbTk::GContext::JOINBEVEL; + else + setDefaultValue(); +} + +template<> +void FbTk::Resource::setDefaultValue() { + *(*this) = FbTk::GContext::CAPNOTLAST; +} + +template<> +std::string FbTk::Resource::getString() { + switch(m_value) { + case FbTk::GContext::CAPNOTLAST: + return "CapNotLast"; + break; + case FbTk::GContext::CAPBUTT: + return "CapButt"; + break; + case FbTk::GContext::CAPROUND: + return "CapRound"; + break; + case FbTk::GContext::CAPPROJECTING: + return "CapProjecting"; + break; + }; +} + +template<> +void FbTk::Resource +::setFromString(char const *strval) { + + if (strcasecmp(strval, "CapNotLast") == 0 ) + m_value = FbTk::GContext::CAPNOTLAST; + else if (strcasecmp(strval, "CapProjecting") == 0 ) + m_value = FbTk::GContext::CAPPROJECTING; + else if (strcasecmp(strval, "CapRound") == 0) + m_value = FbTk::GContext::CAPROUND; + else if (strcasecmp(strval, "CapButt" ) == 0) + m_value = FbTk::GContext::CAPBUTT; + else + setDefaultValue(); +} + namespace { class StyleMenuItem: public FbTk::MenuItem { @@ -378,7 +485,20 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm, menu_mode(rm, FbTk::MenuTheme::DELAY_OPEN, scrname+".menuMode", altscrname+".MenuMode"), placement_policy(rm, ROWSMARTPLACEMENT, scrname+".windowPlacement", altscrname+".WindowPlacement"), row_direction(rm, LEFTRIGHT, scrname+".rowPlacementDirection", altscrname+".RowPlacementDirection"), - col_direction(rm, TOPBOTTOM, scrname+".colPlacementDirection", altscrname+".ColPlacementDirection") { + col_direction(rm, TOPBOTTOM, scrname+".colPlacementDirection", altscrname+".ColPlacementDirection"), + gc_line_width(rm, 1, scrname+".overlay.lineWidth", altscrname+".Overlay.LineWidth"), + gc_line_style(rm, + FbTk::GContext::LINESOLID, + scrname+".overlay.lineStyle", + altscrname+".Overlay.LineStyle"), + gc_join_style(rm, + FbTk::GContext::JOINMITER, + scrname+".overlay.joinStyle", + altscrname+".Overlay.JoinStyle"), + gc_cap_style(rm, + FbTk::GContext::CAPNOTLAST, + scrname+".overlay.capStyle", + altscrname+".overlay.CapStyle") { } @@ -584,6 +704,10 @@ BScreen::BScreen(FbTk::ResourceManager &rm, m_root_theme->lock(true); FbTk::ThemeManager::instance().load(Fluxbox::instance()->getStyleFilename()); m_root_theme->lock(false); + m_root_theme->setLineAttributes(*resource.gc_line_width, + *resource.gc_line_style, + *resource.gc_cap_style, + *resource.gc_join_style); int i; unsigned int nchild; diff --git a/src/Screen.hh b/src/Screen.hh index 070c45a..707f831 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.135 2004/03/21 09:00:25 rathnor Exp $ +// $Id: Screen.hh,v 1.136 2004/03/22 21:01:10 fluxgen Exp $ #ifndef SCREEN_HH #define SCREEN_HH @@ -431,6 +431,10 @@ private: FbTk::Resource placement_policy; FbTk::Resource row_direction; FbTk::Resource col_direction; + FbTk::Resource gc_line_width; + FbTk::Resource gc_line_style; + FbTk::Resource gc_join_style; + FbTk::Resource gc_cap_style; } resource; -- cgit v0.11.2