[sword-svn] r216 - in trunk/src/SlideBible: . bin ui

kalemas at crosswire.org kalemas at crosswire.org
Sun Oct 25 11:21:36 MST 2009


Author: kalemas
Date: 2009-10-25 11:21:36 -0700 (Sun, 25 Oct 2009)
New Revision: 216

Added:
   trunk/src/SlideBible/bin/
   trunk/src/SlideBible/bin/SlideBible.exe
Modified:
   trunk/src/SlideBible/SlideBible.vcproj
   trunk/src/SlideBible/main.cpp
   trunk/src/SlideBible/sbControl.cpp
   trunk/src/SlideBible/sbControl.h
   trunk/src/SlideBible/sbCore.cpp
   trunk/src/SlideBible/sbCore.h
   trunk/src/SlideBible/sbItem.cpp
   trunk/src/SlideBible/sbItem.h
   trunk/src/SlideBible/sbList.cpp
   trunk/src/SlideBible/sbList.h
   trunk/src/SlideBible/sbTheme.cpp
   trunk/src/SlideBible/sbTheme.h
   trunk/src/SlideBible/todo.txt
   trunk/src/SlideBible/ui/scheme.txt
Log:
added binary, little change (look in todo)

Modified: trunk/src/SlideBible/SlideBible.vcproj
===================================================================
--- trunk/src/SlideBible/SlideBible.vcproj	2009-10-16 22:36:27 UTC (rev 215)
+++ trunk/src/SlideBible/SlideBible.vcproj	2009-10-25 18:21:36 UTC (rev 216)
@@ -44,7 +44,7 @@
 				Name="VCCLCompilerTool"
 				ExecutionBucket="7"
 				AdditionalOptions="/D "KOTIK" /D "NO_VSNPRINTF""
-				Optimization="3"
+				Optimization="0"
 				AdditionalIncludeDirectories="..\Dll1\winceSword\include\;..\..\..\..\sword\trunk\include\"
 				PreprocessorDefinitions="DEBUG;ARM;_ARM_;UNDER_CE=$(CEVER);_WIN32_WCE=$(CEVER);$(CePlatform);UNICODE;SIMPLE"
 				IgnoreStandardIncludePath="false"
@@ -102,10 +102,11 @@
 			/>
 			<Tool
 				Name="VCPostBuildEventTool"
+				CommandLine=""
 			/>
 			<DeploymentTool
 				ForceDirty="-1"
-				RemoteDirectory=""
+				RemoteDirectory="\StorageCard\Program Files\SwordReader\"
 				RegisterOutput="0"
 				AdditionalFiles=""
 			/>

Added: trunk/src/SlideBible/bin/SlideBible.exe
===================================================================
(Binary files differ)


Property changes on: trunk/src/SlideBible/bin/SlideBible.exe
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: trunk/src/SlideBible/main.cpp
===================================================================
--- trunk/src/SlideBible/main.cpp	2009-10-16 22:36:27 UTC (rev 215)
+++ trunk/src/SlideBible/main.cpp	2009-10-25 18:21:36 UTC (rev 216)
@@ -37,9 +37,9 @@
 		wc.hInstance     = 0;
 		wc.hIcon         = 0;
 		wc.hCursor       = 0;
-		wc.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
+		wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
 		wc.lpszMenuName  = 0;
-		wc.lpszClassName = L"SlideBible";
+		wc.lpszClassName = L"sbApp";
 
 		if (!RegisterClass(&wc))
 		{
@@ -96,13 +96,11 @@
 
 		case WM_PAINT:
 			return core->onPaint();
-			break;
 
 		case WM_LBUTTONDOWN:
 		case WM_LBUTTONUP:
 		case WM_MOUSEMOVE:
 			return core->onMouse(LOWORD(lParam), HIWORD(lParam), message);
-			break;
 
 		case WM_KEYDOWN:
 			break;
@@ -117,7 +115,12 @@
 		case WM_TIMER:
 			return core->onTimer(wParam);
 			break;
+
+		case WM_CREATE:
+			printf ("WM_CREATE\n");
+			break;
 		}
+
 		return DefWindowProc(hwnd, message, wParam, lParam);
 	}
 

Modified: trunk/src/SlideBible/sbControl.cpp
===================================================================
--- trunk/src/SlideBible/sbControl.cpp	2009-10-16 22:36:27 UTC (rev 215)
+++ trunk/src/SlideBible/sbControl.cpp	2009-10-25 18:21:36 UTC (rev 216)
@@ -93,8 +93,8 @@
 	case TYPE_MENU_EXIT:
 		rect = *screenRect;
 		
-		childrens.push_back(sbControl (sbControl::TYPE_MENU_EXIT_YES, layout(1,2,0), L"Yes"));
-		childrens.push_back(sbControl (sbControl::TYPE_MENU_EXIT_NO,  layout(2,2,0), L"No"));
+		childrens.push_back(new sbControl (sbControl::TYPE_MENU_EXIT_YES, layout(1,2,0), L"Yes"));
+		childrens.push_back(new sbControl (sbControl::TYPE_MENU_EXIT_NO,  layout(2,2,0), L"No"));
 
 		setText(L"Exit?");
 		break;
@@ -104,11 +104,11 @@
 
 		// get verse state
 
-		childrens.push_back(sbControl (sbControl::TYPE_MENU_VERSE_ADD_DYNAMIC_BOOKMARK, layout(1,4,0), L"DB"));
-		childrens.push_back(sbControl (sbControl::TYPE_MENU_VERSE_ADD_STATIC_BOOKMARK,  layout(2,4,0), L"SB"));
-		childrens.push_back(sbControl (sbControl::TYPE_MENU_VERSE_REMOVE_BOOKMARK,      layout(3,4,0), L"-B"));
-		childrens.push_back(sbControl (sbControl::TYPE_MENU_VERSE_START_EDITING,        layout(4,4,0), L"Edit"));
-		childrens.push_back(sbControl (sbControl::TYPE_MENU_CANCEL,                     layout(1,1,1), L"Cancel"));
+		childrens.push_back(new sbControl (sbControl::TYPE_MENU_VERSE_ADD_DYNAMIC_BOOKMARK, layout(1,4,0), L"DB"));
+		childrens.push_back(new sbControl (sbControl::TYPE_MENU_VERSE_ADD_STATIC_BOOKMARK,  layout(2,4,0), L"SB"));
+		childrens.push_back(new sbControl (sbControl::TYPE_MENU_VERSE_REMOVE_BOOKMARK,      layout(3,4,0), L"-B"));
+		childrens.push_back(new sbControl (sbControl::TYPE_MENU_VERSE_START_EDITING,        layout(4,4,0), L"Edit"));
+		childrens.push_back(new sbControl (sbControl::TYPE_MENU_CANCEL,                     layout(1,1,1), L"Cancel"));
 
 		setText(L"Verse");
 		break;
@@ -131,10 +131,10 @@
 				TCHAR* text = new TCHAR [5];
 				text = _itot ( i*step , text , 10 );
 				
-				childrens.push_back(sbControl ((TYPE)(TYPE_SET_VERSE+(i*step)), layout(i,count+1,0), text));
+				childrens.push_back( new sbControl ((TYPE)(TYPE_SET_VERSE+(i*step)), layout(i,count+1,0), text));
 			}
 
-			childrens.push_back(sbControl (sbControl::TYPE_MENU_CANCEL, layout(1,1,1), L"Cancel"));
+			childrens.push_back( new sbControl (sbControl::TYPE_MENU_CANCEL, layout(1,1,1), L"Cancel"));
 
 			setText ( L"Select Verse:" );
 		}
@@ -155,18 +155,15 @@
 
 sbControl::~sbControl()
 {
-	if (isMenu())
-	{
-		sbMessage("Delete Menu.\n");
-	}
-
 	// some menus own children text
 	if (type >= TYPE_MENU_SET_VERSE && type < TYPE_MENU_SET_VERSE_MAX)
 	{
 		for (int i=0; i < childrens.size(); i++)
-			if (childrens[i].type != TYPE_MENU_CANCEL)
-				delete [] childrens[i].text;
+			if (childrens[i]->type != TYPE_MENU_CANCEL)
+				delete [] childrens[i]->text;
 	}
+
+	for (int i = 0; i < childrens.size(); i++) delete childrens[i];
 }
 
 void sbControl::onPaint (HDC hdc) const
@@ -187,7 +184,7 @@
 
 			Core->getSurface(sbCore::SURFACE::TYPE_WHOLE)->fade = false;
 			
-			for (int i=0; i < childrens.size(); i++) childrens[i].onPaint( hdc );
+			for (int i=0; i < childrens.size(); i++) childrens[i]->onPaint( hdc );
 
 			SetTextColor(hdc, Core->getTheme()->ItemMenuTextColor);
 			ExtTextOut(hdc, textPos.x, textPos.y, ETO_OPAQUE, NULL, text, _tcslen(text), 0);
@@ -205,7 +202,7 @@
 	SetTextColor(hdc, color);
 }
 
-void sbControl::pressed()
+void sbControl::onPressed()
 {
 	switch (type)
 	{
@@ -243,9 +240,9 @@
 			{
 				for (int i=0; i < childrens.size(); i++)
 				{
-					if (childrens[i].hit(Core->getInput()->lastx, Core->getInput()->lasty))
+					if (childrens[i]->hit(Core->getInput()->lastx, Core->getInput()->lasty))
 					{
-						childrens[i].pressed();
+						childrens[i]->onPressed();
 					}
 				}
 			}
@@ -292,7 +289,7 @@
 		int bottom = rect.bottom();
 
 		for (int i=0; i<childrens.size(); i++)
-			bottom = min(childrens[i].rect.top(),bottom);
+			bottom = min(childrens[i]->rect.top(),bottom);
 
 		textPos.y = rect.top()+((bottom-rect.top()-sz.cy)/2);
 	}

Modified: trunk/src/SlideBible/sbControl.h
===================================================================
--- trunk/src/SlideBible/sbControl.h	2009-10-16 22:36:27 UTC (rev 215)
+++ trunk/src/SlideBible/sbControl.h	2009-10-25 18:21:36 UTC (rev 216)
@@ -68,13 +68,13 @@
 	                            ~sbControl         ( );
 
 private:
-								sbControl         ( TYPE type , sbRect rect , const TCHAR * text );
+								sbControl          ( TYPE type , sbRect rect , const TCHAR * text );
 
 public:
 
 	void                         operator =        ( const sbControl & control ) {;}
 
-	void                         pressed           ( );
+	void                         onPressed         ( );
 	void                         onPaint           ( HDC hdc ) const;
 
 	inline bool                  hit               ( int x , int y ) const {return (rect.pointInRect(x,y));}
@@ -93,7 +93,7 @@
 	sbTheme::STYLE::TYPE         style;
 	POINT                        textPos;
 
-	std::vector<sbControl>       childrens;
+	std::vector<sbControl*>      childrens;
 };
 
 #endif
\ No newline at end of file

Modified: trunk/src/SlideBible/sbCore.cpp
===================================================================
--- trunk/src/SlideBible/sbCore.cpp	2009-10-16 22:36:27 UTC (rev 215)
+++ trunk/src/SlideBible/sbCore.cpp	2009-10-25 18:21:36 UTC (rev 216)
@@ -64,7 +64,7 @@
 	memset(&threadData, 0, sizeof(THREAD_DATA));
 
 	// init windows
-	hContainer = CreateWindow(L"SlideBible", L"SlideBible", WS_VISIBLE,
+	hContainer = CreateWindow(L"sbApp", L"SlideBible", WS_VISIBLE,
 		0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
 		NULL, NULL, NULL, NULL);
 

Modified: trunk/src/SlideBible/sbCore.h
===================================================================
--- trunk/src/SlideBible/sbCore.h	2009-10-16 22:36:27 UTC (rev 215)
+++ trunk/src/SlideBible/sbCore.h	2009-10-25 18:21:36 UTC (rev 216)
@@ -81,12 +81,12 @@
 	sbCore();
 	~sbCore();
 	
-	bool                         onMouse        (int x, int y, const int state);
-	bool                         onPaint        ();
-	bool                         onTimer        (const int timer);
-	void                         onChar         (TCHAR c);
-	bool                         onKeyDown      (int key);
-	bool                         onKeyUp        (int key);
+	bool                         onMouse        ( int x, int y, const int state );
+	bool                         onPaint        ( );
+	bool                         onTimer        ( const int timer );
+	void                         onChar         ( TCHAR c );
+	bool                         onKeyDown      ( int key );
+	bool                         onKeyUp        ( int key );
 
 	void                         redraw         ();
 

Modified: trunk/src/SlideBible/sbItem.cpp
===================================================================
--- trunk/src/SlideBible/sbItem.cpp	2009-10-16 22:36:27 UTC (rev 215)
+++ trunk/src/SlideBible/sbItem.cpp	2009-10-25 18:21:36 UTC (rev 216)
@@ -16,28 +16,29 @@
 #include "sbCore.h"
 #include "sbItem.h"
 
-sbItem::sbItem (sbItem::TYPE _type_, const TCHAR *_text_, int _width_, long _index_, int _number_)
+sbItem::sbItem ( sbItem::TYPE _type_, const TCHAR *_text_, int _width_, long _index_, int _number_ )
 : type  ( _type_ )
 , width ( _width_ )
 , index ( _index_ )
 , sbObject ( "sbItem" )
 {
-	if (_number_ != -1)
+	if ( _number_ != -1 )
 	{
-		_itot(_number_, number, 10);
-		numberLength = _tcslen(number);
+		switch ( type )
+		{
+		case sbItem::TYPE_VERSE:
+			{
+				TCHAR number [10];
+				_itot(_number_, number, 10);
+				subtext = number;
+			}
+			break;
+		default:
+			sbAssert(true);
+		}
 	}
-	else
-	{
-		numberLength = 0;
-	}
 	
-	center      = false;
-	highlighted = false;
-	height      = max(Core->getTheme()->defaultItemHeight,Core->getTheme()->styles[sbTheme::STYLE::BUTTON].size*4/3);
-	expanding   = 0;
-	
-	switch (type)
+	switch ( type )
 	{
 	case TYPE_DESCRIPTION:
 	case TYPE_BUTTON_CHAPTER_NEXT:
@@ -61,12 +62,17 @@
 		style = sbTheme::STYLE::TEXT;
 	}
 
+	center      = false;
+	highlighted = false;
+	height      = Core->getTheme()->styles[style].size + Core->getTheme()->itemTopMargin + Core->getTheme()->itemBottomMargin;
+	expanding   = 0;
+
 	next  = NULL;
 	prev  = NULL;
 	left  = NULL;
 	right = NULL;
 
-	if (_text_ != NULL) setText(_text_);
+	if ( _text_ != NULL ) setText ( _text_ );
 }
 
 sbItem::~sbItem()
@@ -149,42 +155,35 @@
 	}
 }
 
-void sbItem::setText (const TCHAR* _text)
+void sbItem::setText ( const TCHAR* _text_ )
 {
 	SIZE sz;
+	int  lineWidth = 0;
+	bool skip      = false;
+	bool italic    = false;
+	int  length    = _tcslen( _text_ );
 
-	int lineWidth = 0;
-	bool skip     = false;
-	bool italic   = false;
-	int length    = _tcslen(_text);
-
-	sbAssert(_text == NULL);
+	sbAssert( _text_ == NULL );
 	
 	SelectObject (Core->getSurface(sbCore::SURFACE::TYPE_ZERO)->hdc, Core->getTheme()->styles[style].font);
 
-	if (!lines.empty())
-		lines.erase(lines.begin(),lines.end());
+	if ( ! lines.empty() ) lines.erase( lines.begin(), lines.end() );
 
-	LINE nl;
-	nl.width = nl.count = nl.pos = 0;
-	nl.newLine = false;
-	nl.style = style;
-	
-	lines.push_back(nl);
+	lines.push_back( LINE (style) );
 
 	for(int i=0; i<length; i++)
 	{
-		TCHAR c = *(_text+i);
+		TCHAR c = *(_text_+i);
 
 		if (c == L'<')
 		{
 			skip = true;
 
-			if (_tcsncmp(_text+i+1,L"transChange type=\"added\"",24) == 0)
+			if (_tcsncmp(_text_+i+1,L"transChange type=\"added\"",24) == 0)
 			{
 				italic = true;
 			}
-			else if (_tcsncmp(_text+i+1,L"/transChange", 12) == 0)
+			else if (_tcsncmp(_text_+i+1,L"/transChange", 12) == 0)
 			{
 				italic = false;
 			}
@@ -202,15 +201,11 @@
 			skip = false;
 			
 			lines.push_back(lines.back());
-			lines.back().width = 0;
-			lines.back().count = 0;
+			lines.back().width = lines.back().count = 0;
 			lines.back().pos = i+1;
 			lines.back().newLine = false;
 
-			if (italic)
-				lines.back().style = sbTheme::STYLE::TEXT_ITALIC;
-			else
-				lines.back().style = style;
+			lines.back().style = italic == true ? sbTheme::STYLE::TEXT_ITALIC : style;
 
 			SelectObject (Core->getSurface(sbCore::SURFACE::TYPE_ZERO)->hdc, Core->getTheme()->styles[lines.back().style].font);
 		}
@@ -224,8 +219,7 @@
 			lineWidth = 0;
 
 			lines.push_back(lines.back());
-			lines.back().width = 0;
-			lines.back().count = 0;
+			lines.back().width = lines.back().height = lines.back().count = 0;
 			lines.back().pos = i+1;
 			lines.back().newLine = false;
 		}
@@ -235,35 +229,48 @@
 			GetTextExtentPoint32(Core->getSurface(sbCore::SURFACE::TYPE_ZERO)->hdc,&c,1,&sz);
 			
 			// begin new line
-			if ((lineWidth + sz.cx > width - (Core->getTheme()->ListItemIndent*1.8f) \
-				&& c != L'.' && c != L',' && c != L' '))
+			if ((lineWidth + sz.cx > width-Core->getTheme()->itemLeftMargin-Core->getTheme()->itemRightMargin) \
+				&& c != L'.' && c != L',' && c != L' ')
 			{
 				lines.back().newLine = true;
 				lineWidth = 0;
 
 				lines.push_back(lines.back());
-				lines.back().width = 0;
-				lines.back().count = 0;
+				lines.back().width = lines.back().height = lines.back().count = 0;
 				lines.back().pos = i;
 				lines.back().newLine = false;
 			}
 
 			if (lines.back().count == 0) lines.back().pos = i;
 
-			lines.back().width += (unsigned short)sz.cx;
+			lines.back().width += (unsigned short) sz.cx;
+			
+			if (sz.cy > lines.back().height)
+				lines.back().height = (unsigned short) sz.cy;
+			
 			lines.back().count++;
 
-			lineWidth += (unsigned short)sz.cx;
+			lineWidth += (unsigned short) sz.cx;
 		}
 	}
 
 	lines.back().newLine = true;
 
-	int lineCount = 0;
+	height = Core->getTheme()->itemTopMargin + Core->getTheme()->itemBottomMargin;
 
-	for (int i=0; i<lines.size(); i++) if (lines[i].newLine) lineCount++;
+	for (int i=0; i<lines.size(); i++)
+	{
+		if (lines[i].newLine)
+		{
+			height += lines[i].height;
+		}
+	}
 
-	height = Core->getTheme()->defaultItemHeight + (Core->getTheme()->styles[style].size*lineCount);
-
-	text = _text;    // need to be set last
+	if (style == sbTheme::STYLE::BUTTON && height < Core->getTheme()->fingerSize)
+	{
+		lines.insert(lines.begin(),LINE(style,true,0,(Core->getTheme()->fingerSize-height)/2));
+		height = Core->getTheme()->fingerSize;
+	}
+	
+	text = _text_;    // need to be set last
 }

Modified: trunk/src/SlideBible/sbItem.h
===================================================================
--- trunk/src/SlideBible/sbItem.h	2009-10-16 22:36:27 UTC (rev 215)
+++ trunk/src/SlideBible/sbItem.h	2009-10-25 18:21:36 UTC (rev 216)
@@ -20,7 +20,7 @@
 #include <string>
 #include "sbObject.h"
 
-class sbItem : public sbObject
+class sbItem : private sbObject
 {
 public:
 	enum TYPE
@@ -35,7 +35,7 @@
 		TYPE_TEXT_WITH_DESCRIPTION,
 		TYPE_TEXT_FIELD,                    // this will require SIP, i think we will controll input panel, default input panel will be selected in options
 		TYPE_CHECKBOX,
-		TYPE_BUTTON_CHAPTER_NEXT,           // 10
+		TYPE_BUTTON_CHAPTER_NEXT,
 		TYPE_BUTTON_CHAPTER_PREV,
 		TYPE_BUTTON_SELECTION_MODULE,
 		TYPE_BUTTON_SELECTION_BOOK,
@@ -45,7 +45,7 @@
 		TYPE_BUTTON_OPEN_SELECT_BOOK,
 		TYPE_BUTTON_OPEN_SELECT_CHAPTER,
 		TYPE_BUTTON_OPEN_SELECT_VERSE,
-		TYPE_BUTTON_BOOKMARK,               // 20
+		TYPE_BUTTON_BOOKMARK,
 		TYPE_BUTTON_BOOKMARK_GO,
 		TYPE_BUTTON_BOOKMARK_DELETE,
 		TYPE_BUTTON_BOOKMARK_POSITION,
@@ -53,49 +53,42 @@
 		TYPE_BUTTON_ADD_FAVORITE
 	};
 	
-	sbItem(sbItem::TYPE type, const TCHAR *text, int width, long index = -1, int number = -1);
+	sbItem( sbItem::TYPE type, const TCHAR *text, int width, long index = -1, int number = -1 );
 	~sbItem();
 
-public:
-
 	const TYPE                    type;
+
 	char                          style;
 	std::wstring                  text;
+	std::wstring                  subtext;
 
 	bool                          center;
 	bool                          highlighted;
-	bool                          hidden;
-	bool                          button;
 	
 	unsigned short                height;
 	unsigned short                width;
 	
-	TCHAR                         number[5];
-	unsigned char                 numberLength;
-
 	unsigned short                expanding;
 	
 	struct LINE
 	{
+		LINE ( char _style_ = 0, bool _newLine_ = false , unsigned short _width_ = 0 ,unsigned short _height_ = 0 ,  unsigned short _pos_ = 0,
+			unsigned short _count_ = 0 ) : pos (_pos_) , width (_width_) , height (_height_) ,
+			style (_style_) , count (_count_) , newLine (_newLine_) { ; }
+
 		unsigned short            pos;
 		unsigned short            width;
+		unsigned short            height;
 		char                      style;
 		unsigned short            count;
 
-		bool                      newLine:1;
+		bool                      newLine;
 	};
 
 	std::vector<LINE>             lines;
 
-public:
-	void                          setText       ( const TCHAR* text );
+	void                          setText       ( const TCHAR * text );
 
-	int                           getCharLeft   ( const int from );
-	int                           getCharUp     ( const int from );
-	int                           getCharDown   ( const int from );
-
-	int                           getLastLineWidth ();
-
 	long                          index;
 
 	enum PIN

Modified: trunk/src/SlideBible/sbList.cpp
===================================================================
--- trunk/src/SlideBible/sbList.cpp	2009-10-16 22:36:27 UTC (rev 215)
+++ trunk/src/SlideBible/sbList.cpp	2009-10-25 18:21:36 UTC (rev 216)
@@ -446,7 +446,7 @@
 void sbList::render (HDC hdc)
 {
 	sbItem *oldItem,*dItem;
-	sbRect rItem (0,0,0,0);
+	sbRect rItem;
 	int screenHeight;
 
 	addBlankVerses();
@@ -457,10 +457,7 @@
 		while (displaceHeight > -Core->getTheme()->ListSeparatorHeight && itemCurrent->prev != NULL)
 		{
 			if (itemCurrent->type == sbItem::TYPE_VERSE)
-			{
-				versesBackward--;
-				versesForward++;
-			}
+				{ versesBackward--; versesForward++; }
 
 			itemCurrent = itemCurrent->prev;
 			displaceHeight -= itemCurrent->height + Core->getTheme()->ListSeparatorHeight;
@@ -473,10 +470,7 @@
 			displaceHeight += itemCurrent->height + Core->getTheme()->ListSeparatorHeight;
 
 			if (itemCurrent->type == sbItem::TYPE_VERSE)
-			{
-				versesBackward++;
-				versesForward--;
-			}
+				{ versesBackward++; versesForward--; }
 
 			itemCurrent = itemCurrent->next;
 		}
@@ -489,19 +483,17 @@
 	
 	while(true)
 	{
-		if (dItem == NULL)
-			break;
+		if (dItem == NULL) break;
 
-		if (screenHeight > rect->bottom())
-			break;
+		if (screenHeight > rect->bottom()) break;
 
 		oldItem = dItem;
 
 		if (Core->getTheme()->ListSeparatorHeight > 0 && dItem->prev == NULL)
 		{
-			rItem        = *rect;
-			rItem.bottom (screenHeight);
-			rItem.top    (rItem.bottom()-Core->getTheme()->ListSeparatorHeight);
+			rItem = *rect;
+			rItem.bottom ( screenHeight );
+			rItem.top ( rItem.bottom()-Core->getTheme()->ListSeparatorHeight );
 			Core->getTheme()->drawElement(hdc, &rItem, sbTheme::ELEMENT::SEPARATOR);
 		}
 
@@ -511,12 +503,12 @@
 		// horizontal parse
 		while (dItem != NULL)
 		{
-			rItem.top    (screenHeight);
-			rItem.bottom (rItem.top() + dItem->height);
-			rItem.left   (rItem.right());
-			rItem.right  (rItem.left() + dItem->width);
+			rItem.top    ( screenHeight );
+			rItem.bottom ( rItem.top() + dItem->height );
+			rItem.left   ( rItem.right() );
+			rItem.right  ( rItem.left() + dItem->width );
 
-			if(dItem == itemHover)
+			if ( dItem == itemHover )
 				Core->getTheme()->drawElement(hdc, &rItem, sbTheme::ELEMENT::ITEM_HOVER);
 			else if (dItem==itemSelected)
 				Core->getTheme()->drawElement(hdc, &rItem, sbTheme::ELEMENT::ITEM_SELECTED);
@@ -527,58 +519,59 @@
 
 			if (dItem->text.size() > 0)
 			{
-				if (dItem->numberLength > 0)
+				if (dItem->subtext.size() > 0)
 				{
 					SelectObject(hdc, Core->getTheme()->styles[sbTheme::STYLE::STANZA].font);
 					SetTextColor(hdc, Core->getTheme()->ItemSubTextColor);
 
 					SIZE sz;
-					GetTextExtentPoint32(hdc, dItem->number, dItem->numberLength, &sz);
+					GetTextExtentPoint32(hdc, dItem->subtext.c_str(), dItem->subtext.size(), &sz);
 
-					ExtTextOut(hdc, rItem.left()+((Core->getTheme()->ListItemIndent-sz.cx)/2), rItem.top(), ETO_OPAQUE, NULL, dItem->number, dItem->numberLength, 0);
+					ExtTextOut(hdc, rItem.left()+((Core->getTheme()->itemLeftMargin-sz.cx)/2), rItem.top(), ETO_OPAQUE, NULL, dItem->subtext.c_str(), dItem->subtext.size(), 0);
 				}
 			
 				SetTextColor(hdc, Core->getTheme()->ItemTextColor);
 
-				int lineWidth = 0;
-				int lineCount = 0;
+				int lx = 0;
+				int ly = rItem.top() + Core->getTheme()->itemTopMargin;
 				
 				for (int i=0; i < dItem->lines.size(); i++)
 				{
-					int x = lineWidth + Core->getTheme()->ListItemIndent + rItem.left() + (dItem->center ? (rItem.width()-(Core->getTheme()->ListItemIndent*2)-dItem->lines[i].width)/2 : 0);
-					int y = rItem.top() + (Core->getTheme()->defaultItemHeight/2) + (lineCount * Core->getTheme()->styles[dItem->style].size);
+					int x = lx + Core->getTheme()->itemLeftMargin + rItem.left();
+					int y = ly;
 
+					// possible BUG with center alignment and many text parts
+					if (dItem->center)
+						x += (rItem.width()-Core->getTheme()->itemLeftMargin-Core->getTheme()->itemRightMargin-dItem->lines[i].width)/2;
+
 					if (dItem->lines[i].newLine)
-					{
-						lineWidth = 0;
-						lineCount++;
-					}
+						{lx = 0; ly += dItem->lines[i].height;}
 					else
-					{
-						lineWidth += dItem->lines[i].width;
-					}
+						lx += dItem->lines[i].width;
 
+					if (dItem->lines[i].count == 0) continue;
+					
 					if (y + Core->getTheme()->styles[dItem->style].size >= rItem.bottom())
 						break;
 
+					if (y < rect->top() - Core->getTheme()->styles[dItem->style].size)
+						continue;
+
 					SelectObject (hdc, Core->getTheme()->styles[dItem->lines[i].style].font);
-
-					if (y < rect->bottom() && y > rect->top() - Core->getTheme()->styles[dItem->style].size)
-						ExtTextOut(hdc, x, y, ETO_OPAQUE, NULL,
-						i == 0 ? dItem->text.c_str() : dItem->text.c_str() + dItem->lines[i].pos, dItem->lines[i].count, 0);
+					ExtTextOut(hdc, x, y, ETO_OPAQUE, NULL, i == 0 ? dItem->text.c_str() : dItem->text.c_str() + dItem->lines[i].pos, dItem->lines[i].count, 0);
 				}
 			}
 			else
 			{
-				if (dItem->numberLength > 0)
+				if (dItem->subtext.size() > 0)
 				{
 					SelectObject(hdc, Core->getTheme()->styles[sbTheme::STYLE::BUTTON].font);
 					SetTextColor(hdc, Core->getTheme()->ItemSubTextColor);
 
 					SIZE sz;
-					GetTextExtentPoint32(hdc, dItem->number, dItem->numberLength, &sz);
+					GetTextExtentPoint32(hdc, dItem->subtext.c_str(), dItem->subtext.size(), &sz);
 
-					ExtTextOut(hdc, rItem.left()+((rItem.width()-sz.cx)/2), rItem.top()+((rItem.height()-sz.cy)/2), ETO_OPAQUE, NULL, dItem->number, dItem->numberLength, 0);
+					ExtTextOut(hdc, rItem.left()+((rItem.width()-sz.cx)/2), rItem.top()+((rItem.height()-sz.cy)/2), ETO_OPAQUE, NULL, dItem->subtext.c_str(), dItem->subtext.size(), 0);
 				}
 				else if (dItem->type != sbItem::TYPE_SPACE)
 					sbAssert(true);
@@ -684,12 +677,10 @@
 	displacePart = amount - (int)amount;
 
 	// don't allow scroll further then list is
-	if (amount < 0 && itemCurrent->next == NULL)
+	if (amount < 0 && itemCurrent->next == NULL && itemCurrent->height+Core->getTheme()->ListSeparatorHeight+displaceHeight+amount < 0)
 	{
-		float oldAmount = amount;
-		int otherValue = -(itemCurrent->height-displaceHeight-Core->getTheme()->ListSeparatorHeight);
-		amount = max(amount, -(itemCurrent->height-displaceHeight-Core->getTheme()->ListSeparatorHeight));
-		//sbAssert(amount > 0);
+		amount = -(itemCurrent->height+Core->getTheme()->ListSeparatorHeight+displaceHeight);
+		sbAssert (amount > 0);
 	}
 	if (amount > 0 && itemCurrent->prev == NULL)
 	{
@@ -697,6 +688,8 @@
 		sbAssert(amount < 0);
 	}
 
+	sbAssert (fabs(amount) > rect->height());
+
 	if ((int)amount == 0) return false;
 
 	displaceHeight += (int)amount;
@@ -709,10 +702,9 @@
  */
 sbItem * sbList::getItem (int x, int y) const
 {
-	if (itemCurrent == NULL)
-		return NULL;
+	if (itemCurrent == NULL) return NULL;
 
-	sbItem *i = itemCurrent;
+	sbItem* i = itemCurrent;
 	int top = displaceHeight;
 
 	while (i != NULL && top < rect->height())
@@ -783,7 +775,7 @@
 	{
 		if (controls[i]->hit(x,y))
 		{
-			controls[i]->pressed();
+			controls[i]->onPressed();
 			return;
 		}
 	}
@@ -792,9 +784,11 @@
 
 	sbItem *item = getItem(x,y);
 
-	if (item == NULL)
-		return;
+	if (item == NULL) return;
 
+	if (itemEdit != NULL && item != itemEdit)
+		setEditMode(false);
+
 	switch (item->type)
 	{
 	case sbItem::TYPE_BUTTON_BOOKMARK:
@@ -1065,9 +1059,15 @@
 						headerText[s++] = chap[i];
 
 					if (atEnd)
+					{
 						verseLast->attach(new sbItem (sbItem::TYPE_HEADER, headerText, rect->width(), tmpKey.Index()), sbItem::PREV);
+						verseLast->prev->center = true;
+					}
 					else
+					{
 						verseFirst->attach(new sbItem (sbItem::TYPE_HEADER, headerText, rect->width(), tmpKey.Index()), sbItem::PREV);
+						verseFirst->prev->center = true;
+					}
 				}
 				added++;
 			}

Modified: trunk/src/SlideBible/sbList.h
===================================================================
--- trunk/src/SlideBible/sbList.h	2009-10-16 22:36:27 UTC (rev 215)
+++ trunk/src/SlideBible/sbList.h	2009-10-25 18:21:36 UTC (rev 216)
@@ -16,6 +16,7 @@
 #ifndef SBLIST_H
 #define SBLIST_H
 
+#include <vector>
 #include <swmgr.h>
 #include <swmodule.h>
 #include <versekey.h>
@@ -23,10 +24,6 @@
 #include "sbControl.h"
 #include "sbObject.h"
 
-#include <vector>
-
-using std::vector;
-
 class sbList : public sbObject
 {
 public:

Modified: trunk/src/SlideBible/sbTheme.cpp
===================================================================
--- trunk/src/SlideBible/sbTheme.cpp	2009-10-16 22:36:27 UTC (rev 215)
+++ trunk/src/SlideBible/sbTheme.cpp	2009-10-25 18:21:36 UTC (rev 216)
@@ -60,9 +60,13 @@
 	ItemMenuTextColor    = getColor(themeConf["Color"].getWithDefault("MenuText", "E0E0E000"));
 	ItemSubTextColor     = getColor(themeConf["Color"].getWithDefault("ItemSubText", "AAAAAA00"));
 
-	defaultItemHeight    = size/atof(themeConf["Size"].getWithDefault("ItemHeightDiv", "50.0"));
-	ListItemIndent       = size/atof(themeConf["Size"].getWithDefault("IndentDiv", "9.0"));
-	
+	itemTopMargin        = size/atof(themeConf["Size"].getWithDefault("itemTopMarginDiv",    "200.0"));
+	itemLeftMargin       = size/atof(themeConf["Size"].getWithDefault("itemLeftMarginDiv",   "10.0"));
+	itemBottomMargin     = size/atof(themeConf["Size"].getWithDefault("itemBottomMarginDiv", "100.0"));
+	itemRightMargin      = size/atof(themeConf["Size"].getWithDefault("itemRightMarginDiv",  "14.0"));
+
+	fingerSize           = size/atof(themeConf["Size"].getWithDefault("fingerSizeDiv",       "6.0"));
+
 	// elements
 	for (int i=0; i<ELEMENT::COUNT; i++)
 	{
@@ -70,12 +74,13 @@
 		const char* type;
 		const char* color;
 		const char* color2;
+		const char* color3;
 
 		switch (i)
 		{
 		case ELEMENT::ITEM:
 			name   = "Element.Item";
-			type   = themeConf[name].getWithDefault("Type", "SOLID");
+			type   = themeConf[name].getWithDefault("Type", "HOLLOW");
 			color  = themeConf[name].getWithDefault("Color", "FFFFFF00");
 			color2 = themeConf[name].getWithDefault("Color2", "");
 			break;
@@ -87,15 +92,17 @@
 			break;
 		case ELEMENT::ITEM_HIGHLIGHTED:
 			name   = "Element.ItemHighlighted";
-			type   = themeConf[name].getWithDefault("Type", "SOLID");
-			color  = themeConf[name].getWithDefault("Color", "AAAAFF00");
-			color2 = themeConf[name].getWithDefault("Color2", "");
+			type   = themeConf[name].getWithDefault("Type", "VGRAD3");
+			color  = themeConf[name].getWithDefault("Color", "FFFFFFFF");
+			color2 = themeConf[name].getWithDefault("Color2", "FF55AA00");
+			color3 = themeConf[name].getWithDefault("Color3", "FFFFFFFF");
 			break;
 		case ELEMENT::ITEM_HOVER:
 			name   = "Element.ItemHover";
-			type   = themeConf[name].getWithDefault("Type", "VGRAD");
-			color  = themeConf[name].getWithDefault("Color", "CBDADD");
-			color2 = themeConf[name].getWithDefault("Color2", "FFFFFF");
+			type   = themeConf[name].getWithDefault("Type", "VGRAD3");
+			color  = themeConf[name].getWithDefault("Color", "FFFFFFFF");
+			color2 = themeConf[name].getWithDefault("Color2", "FFFF0000");
+			color3 = themeConf[name].getWithDefault("Color3", "FFFFFFFF");
 			break;
 		case ELEMENT::SEPARATOR:
 			name   = "Element.Separator";
@@ -106,9 +113,9 @@
 			break;
 		case ELEMENT::BACKGROUND:
 			name   = "Element.Background";
-			type   = themeConf[name].getWithDefault("Type", "SOLID");
-			color  = themeConf[name].getWithDefault("Color", "7C8A9700");
-			color2 = themeConf[name].getWithDefault("Color2", "");
+			type   = themeConf[name].getWithDefault("Type", "VGRAD");
+			color  = themeConf[name].getWithDefault("Color", "CBDADD00");
+			color2 = themeConf[name].getWithDefault("Color2", "FFFFFF00");
 			break;
 		case ELEMENT::CONTROL:
 			name   = "Element.Control";

Modified: trunk/src/SlideBible/sbTheme.h
===================================================================
--- trunk/src/SlideBible/sbTheme.h	2009-10-16 22:36:27 UTC (rev 215)
+++ trunk/src/SlideBible/sbTheme.h	2009-10-25 18:21:36 UTC (rev 216)
@@ -18,10 +18,6 @@
 
 #include "sbCross.h"
 
-//#include <imaging.h>
-//#include <initguid.h>
-//#include <imgguids.h>
-
 class sbTheme
 {
 public:
@@ -95,7 +91,6 @@
 		HBITMAP           bitmap;
 		char              tiling:1, stretch:1, centered:1, transparency:1;
 		DWORD             rop;
-		//IImage           *image;
 	};
 
 	ELEMENT               elements [ELEMENT::COUNT];
@@ -104,14 +99,13 @@
 
 	int                   ListSeparatorHeight;
 
-	int                   ListItemIndent;
-	
 	int                   size; // screen minimal dimention, determine font and control sizes
+	int                   fingerSize;
 
-	int                   defaultItemHeight;
-
-private:
-	//IImagingFactory      *imageFactory;
+	int                   itemTopMargin;
+	int                   itemBottomMargin;
+	int                   itemLeftMargin;
+	int                   itemRightMargin;
 };
 
 void DrawGradient (HDC tdc, const RECT* iRect, COLORREF StartRGB, COLORREF EndRGB, bool vertical=true);

Modified: trunk/src/SlideBible/todo.txt
===================================================================
--- trunk/src/SlideBible/todo.txt	2009-10-16 22:36:27 UTC (rev 215)
+++ trunk/src/SlideBible/todo.txt	2009-10-25 18:21:36 UTC (rev 216)
@@ -1,23 +1,27 @@
 alpha
-	* input-text items
++	make button-items min height of finger size
+
+	draw module view description on sbList activate
+
+*	navigation list from last place
+
+	search field, titles
 		cursor
-	
+		
 	bookmarks, history, ratings, verselists
 		dialog: verse actions(favorite|send to list...|send to new list)
 		dialog: select verse(s)
 		dialog: menu verse
 
-	draw module view description on sbList activate
-
-	* navigation list from last place
-	* static / dynamic bookmarks
+*	static / dynamic bookmarks
 		on screen item
 
 	text fade
 	2. Ïàðàëèïîìå\níîí\n4
 	daily devotionals
 	make list scrolling more smooth
-	? update theme from psd file
+	make verse expantion without jerks
+?	update theme from psd file
 	cross-references, footnotes
 	controls, pressed/released
 	link neighbor lists: items will be fitted by height, empty verses will be displayed hollow
@@ -26,7 +30,10 @@
 	screen rotation
 	slide list and stroke down/up - link list
 	search
-	? create base class for sbItem and sbControl for holding screen text
+?	data abort on emulator
+?	create base class for sbItem and sbControl for holding screen text
+?	make lists pins (next/prev/left/right) links constant. so instances of same type should not change their values direct
+?	moving to sdl
 	
 	verse features:
 		readings count (forgotten places/chapters)

Modified: trunk/src/SlideBible/ui/scheme.txt
===================================================================
--- trunk/src/SlideBible/ui/scheme.txt	2009-10-16 22:36:27 UTC (rev 215)
+++ trunk/src/SlideBible/ui/scheme.txt	2009-10-25 18:21:36 UTC (rev 216)
@@ -43,7 +43,7 @@
     Dynamic bookmark will follow you as you read, it can not jump throught chpters.
     ?Hitting cross-reference buttn under the verse will create new text list right of current and brong you there.
 
-  Какие требования к электронной Библии сегодгя?
+  Какие требования к электронной Библии сегодня?
     возможность поиска
     точность перевода
     простой интуитивный интерфейс




More information about the sword-cvs mailing list