From 7f6880bbac9ffec3b6221eb04e0977b9a9c669b7 Mon Sep 17 00:00:00 2001
From: fluxgen <fluxgen>
Date: Tue, 23 Jul 2002 18:38:31 +0000
Subject: slit theme, which falls back on toolbar theme if it does not exist

---
 src/Slit.cc  |  4 ++--
 src/Theme.cc | 16 ++++++++++++----
 src/Theme.hh | 25 +++++++++++++------------
 3 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/src/Slit.cc b/src/Slit.cc
index 0dded4f..6eea94b 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -19,7 +19,7 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-// $Id: Slit.cc,v 1.18 2002/07/23 17:11:59 fluxgen Exp $
+// $Id: Slit.cc,v 1.19 2002/07/23 18:38:31 fluxgen Exp $
 
 //use GNU extensions
 #ifndef	 _GNU_SOURCE
@@ -408,7 +408,7 @@ void Slit::reconfigure(void) {
 
 	Pixmap tmp = frame.pixmap;
 	BImageControl *image_ctrl = screen->getImageControl();
-	FbTk::Texture *texture = &(screen->getToolbarStyle()->toolbar);
+	const FbTk::Texture *texture = &(screen->getTheme()->getSlitTexture());
 	if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) {
 		frame.pixmap = None;
 		XSetWindowBackground(display, frame.window,
diff --git a/src/Theme.cc b/src/Theme.cc
index 552cf8c..89db396 100644
--- a/src/Theme.cc
+++ b/src/Theme.cc
@@ -41,7 +41,7 @@
 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 //  DEALINGS IN THE SOFTWARE.
 
-// $Id: Theme.cc,v 1.23 2002/07/23 17:11:59 fluxgen Exp $
+// $Id: Theme.cc,v 1.24 2002/07/23 18:38:31 fluxgen Exp $
 
 #ifndef   _GNU_SOURCE
 #define   _GNU_SOURCE
@@ -286,7 +286,7 @@ void Theme::load(const char *filename){
 		m_database = XrmGetFileDatabase(DEFAULTSTYLE);
 
 	loadMenuStyle();
-	loadToolbarStyle();
+	loadToolbarStyle();	
 	loadWindowStyle();
 	loadTabStyle();
 	loadRootCommand();
@@ -665,7 +665,7 @@ void Theme::loadRootCommand() {
 
 }
 
-void Theme::loadMisc(void) {
+void Theme::loadMisc() {
 	unsigned int screen_width_div2 = WidthOfScreen(ScreenOfDisplay(m_display, m_screennum)) / 2;
 	XrmValue value;
 	char *value_type=0;
@@ -705,6 +705,14 @@ void Theme::loadMisc(void) {
 
 	readDatabaseColor("borderColor", "BorderColor", &m_border_color,
 		BlackPixel(m_display, m_screennum));		
+
+	// load slit style, if it wasn't found fall back to toolbarstyle
+	if (!readDatabaseTexture("slit", "Slit",
+		&m_slit_texture, 
+		BlackPixel(m_display, m_screennum)) ) {
+		m_slit_texture = m_toolbarstyle.toolbar;
+	}
+
 }
 
 
@@ -807,7 +815,7 @@ bool Theme::readDatabaseTexture(char *rname, char *rclass,
 	}
 
 	if (!retval)
-		fprintf(stderr, "Faild in readTexture\n");
+		cerr<<"Failed to load texture for: "<<rname<<endl;
 	
 	return retval;
 }
diff --git a/src/Theme.hh b/src/Theme.hh
index b892647..97fe9cd 100644
--- a/src/Theme.hh
+++ b/src/Theme.hh
@@ -42,7 +42,7 @@
 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 //  DEALINGS IN THE SOFTWARE.
 
-// $Id: Theme.hh,v 1.11 2002/07/23 17:11:59 fluxgen Exp $
+// $Id: Theme.hh,v 1.12 2002/07/23 18:38:31 fluxgen Exp $
 
 #ifndef THEME_HH
 #define THEME_HH
@@ -111,16 +111,17 @@ public:
 		DrawUtil::Font font;
 
 	} ToolbarStyle;	
-	
-	inline WindowStyle &getWindowStyle(void) { return m_windowstyle; }
-	inline MenuStyle &getMenuStyle(void) { return m_menustyle; }
-	inline ToolbarStyle &getToolbarStyle(void) { return m_toolbarstyle; }
-	inline unsigned int getBevelWidth(void) const { return m_bevel_width; }
-	inline unsigned int getBorderWidth(void) const { return m_border_width; }
-	inline unsigned int getHandleWidth(void) const { return m_handle_width; }
-	inline unsigned int getFrameWidth(void) const { return m_frame_width; }
-	inline const GC &getOpGC(void) const { return m_opgc; }
-	inline const FbTk::Color &getBorderColor(void) const { return m_border_color; }
+		
+	inline WindowStyle &getWindowStyle() { return m_windowstyle; }
+	inline MenuStyle &getMenuStyle() { return m_menustyle; }
+	inline ToolbarStyle &getToolbarStyle() { return m_toolbarstyle; }
+	inline const FbTk::Texture &getSlitTexture() const { return m_slit_texture; }
+	inline unsigned int getBevelWidth() const { return m_bevel_width; }
+	inline unsigned int getBorderWidth() const { return m_border_width; }
+	inline unsigned int getHandleWidth() const { return m_handle_width; }
+	inline unsigned int getFrameWidth() const { return m_frame_width; }
+	inline GC getOpGC() const { return m_opgc; }
+	inline const FbTk::Color &getBorderColor() const { return m_border_color; }
 	void load(const char *filename);
 	void reconfigure();
 	
@@ -164,7 +165,7 @@ private:
 	Colormap m_colormap;
 	int m_screennum;
 	std::string m_rootcommand;
-
+	FbTk::Texture m_slit_texture;
 };
 
 
-- 
cgit v0.11.2