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

kalemas at crosswire.org kalemas at crosswire.org
Fri Dec 11 13:44:50 MST 2009


Author: kalemas
Date: 2009-12-11 13:44:49 -0700 (Fri, 11 Dec 2009)
New Revision: 222

Modified:
   trunk/src/SlideBible.sln
   trunk/src/SlideBible/bin/SlideBible.exe
   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/sbCross.h
   trunk/src/SlideBible/sbItem.cpp
   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
Log:
added list description while slide left/right, several issues.

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

Modified: trunk/src/SlideBible/main.cpp
===================================================================
--- trunk/src/SlideBible/main.cpp	2009-11-13 22:57:11 UTC (rev 221)
+++ trunk/src/SlideBible/main.cpp	2009-12-11 20:44:49 UTC (rev 222)
@@ -15,130 +15,73 @@
 
 #include "sbCore.h"
 
-#define SR_NON_INSTANCE 0
+sbCore * Core;
 
-class sbApp
+LRESULT CALLBACK wndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-public:
-    sbApp(HINSTANCE hInstance) : m_hAccelTable(0)
+	switch ( message )
 	{
-		s_hInstance = hInstance;
+	case WM_HIBERNATE:
+		sbMessage ( "Message : WM_HIBERNATE\n" );
+		return 0;
 
-		memset(&s_sai, 0, sizeof(s_sai));
-		s_sai.cbSize = sizeof(s_sai);
-		m_hAccelTable = LoadAccelerators(hInstance, NULL);
+	case WM_ERASEBKGND:
+		return 1;
 
-		WNDCLASS wc;
+	case WM_KILLFOCUS: // loose focus
+		Core->setSipState ( false );
+		Core->switchList ( sbList::TYPE_NONE );
+		break;
 
-		wc.style         = 0;
-		wc.lpfnWndProc   = wndProc;
-		wc.cbClsExtra    = 0;
-		wc.cbWndExtra    = 0;
-		wc.hInstance     = 0;
-		wc.hIcon         = 0;
-		wc.hCursor       = 0;
-		wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
-		wc.lpszMenuName  = 0;
-		wc.lpszClassName = L"SlideBible Application";
+	case WM_SETFOCUS: // receive focus
+		Core->switchList ( sbList::TYPE_CURRENT );
+		break;
 
-		if (!RegisterClass(&wc))
-		{
-			PostQuitMessage(1);
-			return;
-		}
+	case WM_ACTIVATE:
+		SHFullScreen ( hwnd, SHFS_HIDESIPBUTTON | SHFS_HIDETASKBAR | SHFS_HIDESTARTICON );
+		break;
 
-		core = new sbCore ( hInstance );
-	}
-
-   	~sbApp()
-	{
-		if (core != NULL) delete core;
-	}
-
-	WPARAM Run()
-	{
-		MSG msg;
-
-		while (GetMessage(&msg, NULL, 0, 0)) 
+	case WM_PAINT:
 		{
-			if (!m_hAccelTable || !TranslateAccelerator(msg.hwnd, m_hAccelTable, &msg)) 
-			{
-				TranslateMessage(&msg);
-				DispatchMessage(&msg);
-			}
-		}
-		return msg.wParam;
-	}
+			PAINTSTRUCT ps;
+			HDC hdc = BeginPaint(hwnd, &ps);
 
-	static LRESULT CALLBACK wndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-	{
-		switch(message)
-		{
-		case WM_HIBERNATE:
-			printf("Message : WM_HIBERNATE\n");
-			return 0;
+			Core->onPaint(hdc);
 
-		case WM_ERASEBKGND:
+			EndPaint(hwnd, &ps);
+			DeleteDC(hdc);
 			return 1;
+		}
 
-		case WM_KILLFOCUS: // loose focus
-			core->setSipState(false);
-			core->switchList(sbList::TYPE_NONE);
-			break;
+	case WM_LBUTTONDOWN:
+	case WM_LBUTTONUP:
+	case WM_MOUSEMOVE:
+		return Core->onMouse(LOWORD(lParam), HIWORD(lParam), message);
 
-		case WM_SETFOCUS: // receive focus
-			core->switchList(sbList::TYPE_CURRENT);
-			break;
+	case WM_KEYDOWN:
+		break;
 
-		case WM_ACTIVATE:
-			SHFullScreen(hwnd, SHFS_HIDESIPBUTTON | SHFS_HIDETASKBAR | SHFS_HIDESTARTICON);
-			break;
+	case WM_KEYUP:
+		break;
 
-		case WM_PAINT:
-			return core->onPaint();
+	case WM_CHAR:
+		Core->onChar((TCHAR)wParam);
+		break;
 
-		case WM_LBUTTONDOWN:
-		case WM_LBUTTONUP:
-		case WM_MOUSEMOVE:
-			return core->onMouse(LOWORD(lParam), HIWORD(lParam), message);
+	case WM_TIMER:
+		return Core->onTimer(wParam);
+		break;
 
-		case WM_KEYDOWN:
-			break;
-
-		case WM_KEYUP:
-			break;
-
-		case WM_CHAR:
-			core->onChar((TCHAR)wParam);
-			break;
-
-		case WM_TIMER:
-			return core->onTimer(wParam);
-			break;
-
-		case WM_CREATE:
-			printf ("WM_CREATE\n");
-			break;
-		}
-
-		return DefWindowProc(hwnd, message, wParam, lParam);
+	case WM_CREATE:
+		break;
 	}
 
-private:
-    HINSTANCE               s_hInstance;
-    HACCEL                  m_hAccelTable;
-    SHACTIVATEINFO          s_sai;
-    static sbCore          *core;
-};
+	return DefWindowProc(hwnd, message, wParam, lParam);
+}
 
-sbCore * sbApp::core = NULL;
-
-int WINAPI WinMain(	HINSTANCE hInstance,
-					HINSTANCE hPrevInstance,
-					LPTSTR    lpCmdLine,
-					int       nCmdShow)
+int WINAPI WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow )
 {
-	HWND hwnd = FindWindow(L"SlideBible Application", L"SlideBible");
+	HWND hwnd = FindWindow ( L"SlideBible Application", L"SlideBible" );
 
 	if (hwnd)
 	{
@@ -146,11 +89,55 @@
 		return -1;
 	}
 
-	//HCURSOR hOldCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
+	HCURSOR oldCursor = SetCursor ( LoadCursor ( NULL, IDC_WAIT ) );
 
-	sbApp app(hInstance);
+	HACCEL accelTable = LoadAccelerators ( hInstance, NULL );
 
-	//SetCursor(hOldCursor);
+	WNDCLASS wc;
 
-	return app.Run();
+	wc.style         = 0;
+	wc.lpfnWndProc   = wndProc;
+	wc.cbClsExtra    = 0;
+	wc.cbWndExtra    = 0;
+	wc.hInstance     = 0;
+	wc.hIcon         = 0;
+	wc.hCursor       = 0;
+	wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
+	wc.lpszMenuName  = 0;
+	wc.lpszClassName = L"SlideBible Application";
+
+	SetCursor ( oldCursor );
+
+	if ( RegisterClass ( & wc ) )
+	{
+		HWND window = CreateWindow(L"SlideBible Application", L"SlideBible", WS_VISIBLE,
+			0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
+			NULL, NULL, hInstance, NULL);
+
+		if ( window == NULL )
+		{
+			sbMessage ( "Can not create window beacouse of %i error.\n", GetLastError() );
+			PostQuitMessage ( 1 );
+			return 0;
+		}
+		else
+		{
+			sbCore core ( window );
+
+			MSG message;
+
+			while ( GetMessage ( & message, NULL, 0, 0 ) )
+			{
+				if ( ! accelTable || ! TranslateAccelerator ( message.hwnd, accelTable, & message ) ) 
+				{
+					TranslateMessage ( & message );
+					DispatchMessage ( & message );
+				}
+			}
+
+			return message.wParam;
+		}
+	}
+
+	return 0;
 }

Modified: trunk/src/SlideBible/sbControl.cpp
===================================================================
--- trunk/src/SlideBible/sbControl.cpp	2009-11-13 22:57:11 UTC (rev 221)
+++ trunk/src/SlideBible/sbControl.cpp	2009-12-11 20:44:49 UTC (rev 222)
@@ -1,4 +1,4 @@
-/*************************************************************************
+/*************************************************************************
  * sbControl.cpp - items on screen
  *
  * author: Konstantin Maslyuk "Kalemas" mailto:kalemas at mail.ru
@@ -77,40 +77,44 @@
 
 	switch (type)
 	{
-	case TYPE_CLOSE:                 rect = layout(4,4,1);   setText(L"(X)"); break;
-	case TYPE_BUTTON_CLOSE:          rect = layout(4,4,1);   setText(L"X"); break;
-	case TYPE_OPEN_BOOK_SELECTION:   rect = layout(1,4,1);   setText(L"B"); break;
-	case TYPE_OPEN_MODULE_SELECTION: rect = layout(2,4,1);   setText(L"M"); break;
-	case TYPE_OPEN_NAVIGATION:       rect = layout(1,4,1);   setText(L"N"); break;
-	case TYPE_MODE_ADD_STAR:         rect = layout(3,4,1);   setText(L"*"); break;
-	case TYPE_OPEN_SEARCH:           rect = layout(3,4,1);   setText(L"S"); break;
-	case TYPE_BUTTON_OPEN_FILE:      rect = layout(1,4,1);   setText(L"O"); break;
-	case TYPE_OPEN_TEXT:             rect = layout(2,4,1);   setText(L"|^|"); break;
-	case TYPE_OPEN_HOME:             rect = layout(2,4,1);   setText(L"|v|"); break;
+	case TYPE_CLOSE:                 rect = layout(4,4,1);   setText(L"(X)");   break;
+	case TYPE_BUTTON_CLOSE:          rect = layout(4,4,1);   setText(L"X");     break;
+	case TYPE_OPEN_BOOK_SELECTION:   rect = layout(1,4,1);   setText(L"B");     break;
+	case TYPE_OPEN_MODULE_SELECTION: rect = layout(2,4,1);   setText(L"M");     break;
+	case TYPE_OPEN_NAVIGATION:       rect = layout(1,4,1);   setText(L"N");     break;
+	case TYPE_MODE_ADD_STAR:         rect = layout(2,4,1);   setText(L"*");     break;
+	case TYPE_OPEN_SEARCH:           rect = layout(3,4,1);   setText(L"S");     break;
+	case TYPE_OPEN_TEXT:             rect = layout(2,4,1);   setText(L"H");     break;
+	case TYPE_OPEN_HOME:             rect = layout(4,4,1);   setText(L"H");     break;
 	case TYPE_WIDE_CLOSE:            rect = layout(1,1,1);   setText(L"Close"); break;
-	case TYPE_CAN_SWITCH_LEFT:       rect = layout(1,12,2);  setText(L"<"); break;
-	case TYPE_CAN_SWITCH_RIGHT:      rect = layout(12,12,2); setText(L">"); break;
+	case TYPE_CAN_SWITCH_LEFT:       rect = layout(1,12,2);  setText(L"<");     break;
+	case TYPE_CAN_SWITCH_RIGHT:      rect = layout(12,12,2); setText(L">");     break;
+	case TYPE_BUTTON_OPEN_FILE:      rect = sbRect ( layout(1,4,1).left() , layout(1,4,1).top() , layout(3,4,1).right() , layout(3,4,1).bottom()); setText(L""); break;
 	case TYPE_MENU_EXIT:
-		rect = *screenRect;
+		{
+			rect = *screenRect;
 		
-		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"));
+			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?");
+			setText(L"Exit?");
+		}
 		break;
 
 	case TYPE_MENU_VERSE:
-		rect = *screenRect;
+		{
+			rect = *screenRect;
 
-		// get verse state
+			// get verse state
 
-		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"));
+			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");
+			setText(L"Verse");
+		}
 		break;
 
 	default:
@@ -173,6 +177,19 @@
 	
 	switch (type)
 	{
+	/*case TYPE_SHOW_CURRENT_PLACE:
+		{
+			const char * keyText = Core->currentKey.getText();
+			int length = strlen(keyText);
+			TCHAR * wideText = new TCHAR [length+1];
+			mbstowcs(wideText, keyText, length);
+			SIZE size;
+			GetTextExtentPoint32(hdc, wideText, length, &size);
+			const sbRect * rect = &Core->getSurface(sbCore::SURFACE::TYPE_WHOLE)->rect;
+			ExtTextOut (hdc, (rect->width()-size.cx)/2+rect->left(), Core->getTheme()->size/5, ETO_OPAQUE, NULL, wideText, length, 0);
+			delete [] wideText;
+		}
+		break;*/
 	case TYPE_CAN_SWITCH_LEFT:
 	case TYPE_CAN_SWITCH_RIGHT:
 		ExtTextOut ( hdc, textPos.x, textPos.y, ETO_OPAQUE, NULL, text, _tcslen(text), 0);
@@ -254,17 +271,15 @@
 	}
 }
 
-void sbControl::setText ( const TCHAR* _text_ )
+void sbControl::setText ( const TCHAR * _text_ )
 {
 	SIZE sz;
-	HDC hdc;
+	HDC hdc = CreateCompatibleDC ( NULL );
 
-	text = (TCHAR*) _text_;
+	text = (TCHAR*)_text_;
 
-	if (text[0]==0) return;
+	if ( text[0] == 0 ) return;
 
-	hdc = CreateCompatibleDC(NULL);
-
 	const int h = (rect.height())/2;
 
 	if (h < Core->getTheme()->styles[sbTheme::STYLE::BUTTON_SMALL].size)
@@ -276,15 +291,15 @@
 	else
 		style = sbTheme::STYLE::CAPTION;
 
-	SelectObject (hdc, Core->getTheme()->styles[style].font);
-	GetTextExtentPoint32(hdc, text, _tcslen(text), &sz);
+	SelectObject ( hdc, Core->getTheme()->styles[style].font );
+	GetTextExtentPoint32 ( hdc, text, _tcslen(text), &sz );
 
 	textPos.x = (rect.width() - sz.cx) / 2 + rect.left();
 	textPos.y = (rect.height() - sz.cy) / 2 + rect.top();
 
-	DeleteDC(hdc);
+	DeleteDC ( hdc );
 
-	if (isMenu())
+	if ( isMenu() )
 	{
 		int bottom = rect.bottom();
 

Modified: trunk/src/SlideBible/sbControl.h
===================================================================
--- trunk/src/SlideBible/sbControl.h	2009-11-13 22:57:11 UTC (rev 221)
+++ trunk/src/SlideBible/sbControl.h	2009-12-11 20:44:49 UTC (rev 222)
@@ -88,7 +88,7 @@
 private:
 	sbRect                       rect;
 
-	TCHAR                       *text;
+	const TCHAR                 *text;
 
 	sbTheme::STYLE::TYPE         style;
 	POINT                        textPos;

Modified: trunk/src/SlideBible/sbCore.cpp
===================================================================
--- trunk/src/SlideBible/sbCore.cpp	2009-11-13 22:57:11 UTC (rev 221)
+++ trunk/src/SlideBible/sbCore.cpp	2009-12-11 20:44:49 UTC (rev 222)
@@ -22,17 +22,15 @@
 
 #pragma warning(disable : 4018)
 
-sbCore* Core;
+std::map < const char *, int > sbObject::tracker;
 
-std::map<const char *, int> sbObject::tracker;
-
-void sbMessage(const char *format, ...)
+void sbMessage(const char *format , ...)
 {
 	va_list args;
 
 	static FILE * file = NULL;
 	
-	file = fopen("log.txt", file == NULL ? "w" : "a");
+	file = fopen( "log.txt", file == NULL ? "w" : "a" );
 
 	if (file == NULL) return;
 
@@ -44,43 +42,41 @@
 	fclose(file);
 }
 
-LRESULT CALLBACK sbCoreWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
-
-sbCore::sbCore( HINSTANCE hInstance ) : defaultModule (NULL)
+sbCore::sbCore( HWND _window_ )
+: defaultModule ( NULL )
+, hContainer ( _window_ )
 {
 	sbMessage ("Launch SlideBible Core.\n");
 
+	sbAssert ( hContainer == NULL );
+	
+	sbAssert ( Core != NULL );
+
+	Core = this;
+
 	// init data
-	Core            = this;
+	currentList         = NULL;
+	listModule          = NULL;
+	listModuleSelection = NULL;
+	listBookSelection   = NULL;
+	listNavigation      = NULL;
+	listSearch          = NULL;
+	listHome            = NULL;
 	
-	currentList     = NULL;
-	listModule      = NULL;
-	listNavigation  = NULL;
-	listSearch      = NULL;
-	listHome        = NULL;
+	redrawTimerOn       = false;
+	requestedRedraw     = false;
 
-	requestedRedraw = false;
+	listShift           = 0;
 
-	listShift       = 0;
+	showListBanner      = false;
 
 	memset(&threadData, 0, sizeof(THREAD_DATA));
 
-	// init windows
-	hContainer = CreateWindow(L"SlideBible Application", L"SlideBible", WS_VISIBLE,
-		0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
-		NULL, NULL, hInstance, NULL);
-
-	if (hContainer == NULL)
-	{
-		sbMessage ("Can not create window becouse of %i error.\n",GetLastError());
-		PostQuitMessage(1);
-		return;
-	}
-
 	// init surface
-	HDC hdc = BeginPaint( hContainer, &ps );
+	PAINTSTRUCT ps;
+	HDC hdc = BeginPaint ( hContainer, &ps );
 
-	GetClientRect(hContainer, &rClient);
+	GetClientRect( hContainer, &rClient );
 
 	surfaces[SURFACE::TYPE_WHOLE].rect = rClient;
 
@@ -100,17 +96,16 @@
 		surfaces[i].needRedraw = true;
 	}
 	
-	Core->getTheme()->drawElement(hdc, &rClient, sbTheme::ELEMENT::BACKGROUND);
+	theme.drawElement(hdc, &rClient, sbTheme::ELEMENT::BACKGROUND);
 	
-	EndPaint(hContainer, &ps);
-	DeleteDC(hdc);
+	EndPaint ( hContainer, &ps );
+	DeleteDC ( hdc );
 
 	//sword::SWLog::getSystemLog()->setLogLevel(5);
 
 	// load options
 	mpOptions = new sword::SWConfig(".\\options.conf");
-	
-	sbAssert(mpOptions == NULL);
+	sbAssert ( mpOptions == NULL );
 	mpOptions->Load();
 	
 	cineticDamping = (float)atof((*mpOptions)["Ui"].getWithDefault("CineticDamping", "0.95"));
@@ -121,38 +116,38 @@
 	versesOptimal  = atoi((*mpOptions)["Ui"].getWithDefault("versesOptimal", "50"));
 
 	// user locale
-	char *defLocale = "en_US";
+	char *defaultLocale = "en_US";
 
 	TCHAR userLocale [6];
 	GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, userLocale, 6);
 	
-	if (_tcscmp(userLocale, L"RUS")==0)          defLocale = "ru_RU-cp1251";
-	else if (_tcscmp(userLocale, L"AFK")==0)     defLocale = "af";
-	else if (_tcscmp(userLocale, L"BGR")==0)     defLocale = "bg_BG-cp1251";
-	else if (_tcscmp(userLocale, L"CSY")==0)     defLocale = "cs";
-	else if (_tcscmp(userLocale, L"DAN")==0)     defLocale = "da";
-	else if (_tcscmp(userLocale, L"ETI")==0)     defLocale = "et";
-	else if (_tcscmp(userLocale, L"FIN")==0)     defLocale = "fi";
-	else if (_tcscmp(userLocale, L"IND")==0)     defLocale = "id";
-	else if (_tcscmp(userLocale, L"KOR")==0)     defLocale = "ko";
-	else if (_tcscmp(userLocale, L"PLK")==0)     defLocale = "pl";
-	else if (_tcscmp(userLocale, L"ROM")==0)     defLocale = "ro";
-	else if (_tcscmp(userLocale, L"SKY")==0)     defLocale = "sk";
-	else if (_tcscmp(userLocale, L"SLV")==0)     defLocale = "sl";
-	else if (_tcscmp(userLocale, L"UKR")==0)     defLocale = "uk_UA-cp1251";
-	else if (_tcsnccmp(userLocale, L"AR", 2)==0) defLocale = "ar_EG-cp1256";
-	else if (_tcsnccmp(userLocale, L"EN", 2)==0) defLocale = "en_GB";
-	else if (_tcsnccmp(userLocale, L"DE", 2)==0) defLocale = "de";
-	else if (_tcsnccmp(userLocale, L"ES", 2)==0) defLocale = "es";
-	else if (_tcsnccmp(userLocale, L"FR", 2)==0) defLocale = "fr";
-	else if (_tcsnccmp(userLocale, L"IT", 2)==0) defLocale = "it";
-	else if (_tcsnccmp(userLocale, L"NL", 2)==0) defLocale = "nl";
-	else if (_tcsnccmp(userLocale, L"NO", 2)==0) defLocale = "no";
-	else if (_tcsnccmp(userLocale, L"PT", 2)==0) defLocale = "pt";
+	if (_tcscmp(userLocale, L"RUS")==0)          defaultLocale = "ru_RU-cp1251";
+	else if (_tcscmp(userLocale, L"AFK")==0)     defaultLocale = "af";
+	else if (_tcscmp(userLocale, L"BGR")==0)     defaultLocale = "bg_BG-cp1251";
+	else if (_tcscmp(userLocale, L"CSY")==0)     defaultLocale = "cs";
+	else if (_tcscmp(userLocale, L"DAN")==0)     defaultLocale = "da";
+	else if (_tcscmp(userLocale, L"ETI")==0)     defaultLocale = "et";
+	else if (_tcscmp(userLocale, L"FIN")==0)     defaultLocale = "fi";
+	else if (_tcscmp(userLocale, L"IND")==0)     defaultLocale = "id";
+	else if (_tcscmp(userLocale, L"KOR")==0)     defaultLocale = "ko";
+	else if (_tcscmp(userLocale, L"PLK")==0)     defaultLocale = "pl";
+	else if (_tcscmp(userLocale, L"ROM")==0)     defaultLocale = "ro";
+	else if (_tcscmp(userLocale, L"SKY")==0)     defaultLocale = "sk";
+	else if (_tcscmp(userLocale, L"SLV")==0)     defaultLocale = "sl";
+	else if (_tcscmp(userLocale, L"UKR")==0)     defaultLocale = "uk_UA-cp1251";
+	else if (_tcsnccmp(userLocale, L"AR", 2)==0) defaultLocale = "ar_EG-cp1256";
+	else if (_tcsnccmp(userLocale, L"EN", 2)==0) defaultLocale = "en_GB";
+	else if (_tcsnccmp(userLocale, L"DE", 2)==0) defaultLocale = "de";
+	else if (_tcsnccmp(userLocale, L"ES", 2)==0) defaultLocale = "es";
+	else if (_tcsnccmp(userLocale, L"FR", 2)==0) defaultLocale = "fr";
+	else if (_tcsnccmp(userLocale, L"IT", 2)==0) defaultLocale = "it";
+	else if (_tcsnccmp(userLocale, L"NL", 2)==0) defaultLocale = "nl";
+	else if (_tcsnccmp(userLocale, L"NO", 2)==0) defaultLocale = "no";
+	else if (_tcsnccmp(userLocale, L"PT", 2)==0) defaultLocale = "pt";
 	else if (_tcscmp(userLocale, L"USA")!=0)
 		sbMessage("Unsupported user locale: %s\n", userLocale);
 
-	sword::LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName((*mpOptions)["General"].getWithDefault("Locale", defLocale));
+	sword::LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName((*mpOptions)["General"].getWithDefault("Locale", defaultLocale));
 
 	// init sword
 	mpSwordMgr = new sword::SWMgr(new sword::MarkupFilterMgr(sword::FMT_OSIS, sword::ENC_UTF16));
@@ -169,7 +164,7 @@
 	bookmarks.load(".\\verselists.conf","Bookmarks");
 
 	// create ui
-	switchList(sbList::TYPE_HOME);
+	switchList ( sbList::TYPE_HOME );
 }
 
 sbCore::~sbCore()
@@ -216,21 +211,19 @@
 	sbMessage ("Shutdown SlideBible Core.\n");
 }
 
-bool sbCore::onPaint()
+void sbCore::onPaint ( HDC hdc )
 {
-	HDC hdc = BeginPaint(hContainer, &ps);
-
 	if (currentList != NULL)
 	{
 		if (listShift == 0)
 		{
-			currentList->render(surfaces[SURFACE::TYPE_WHOLE].hdc);
+			currentList->render(surfaces[SURFACE::TYPE_WHOLE].hdc,showListBanner);
 		}
 		else
 		{
 			if (surfaces[SURFACE::TYPE_LIST].needRedraw)
 			{
-				currentList->render(surfaces[SURFACE::TYPE_LIST].hdc);
+				currentList->render(surfaces[SURFACE::TYPE_LIST].hdc,true);
 				surfaces[SURFACE::TYPE_LIST].needRedraw = false;
 			}
 
@@ -239,7 +232,7 @@
 				if (surfaces[SURFACE::TYPE_BUFFER].needRedraw)
 				{
 					if (currentList->getNext() != NULL)
-						currentList->getNext()->render(surfaces[SURFACE::TYPE_BUFFER].hdc);
+						currentList->getNext()->render(surfaces[SURFACE::TYPE_BUFFER].hdc,true);
 					else
 						Core->getTheme()->drawElement(surfaces[SURFACE::TYPE_BUFFER].hdc, &surfaces[SURFACE::TYPE_BUFFER].rect, sbTheme::ELEMENT::BACKGROUND);
 
@@ -254,7 +247,7 @@
 				if (surfaces[SURFACE::TYPE_BUFFER].needRedraw)
 				{
 					if (currentList->getPrev() != NULL)
-						currentList->getPrev()->render(surfaces[SURFACE::TYPE_BUFFER].hdc);
+						currentList->getPrev()->render(surfaces[SURFACE::TYPE_BUFFER].hdc,true);
 					else
 						Core->getTheme()->drawElement(surfaces[SURFACE::TYPE_BUFFER].hdc, &surfaces[SURFACE::TYPE_BUFFER].rect, sbTheme::ELEMENT::BACKGROUND);
 
@@ -309,11 +302,6 @@
 	}
 	
 	BitBlt(hdc, surfaces[SURFACE::TYPE_WHOLE].rect.left(), surfaces[SURFACE::TYPE_WHOLE].rect.top(), surfaces[SURFACE::TYPE_WHOLE].rect.width(), surfaces[SURFACE::TYPE_WHOLE].rect.height(), surfaces[SURFACE::TYPE_WHOLE].hdc, 0, 0, SRCCOPY);
-	
-	EndPaint(hContainer, &ps);
-	DeleteDC(hdc);
-
-	return true;
 }
 
 bool sbCore::onMouse (int x, int y, const int state)
@@ -523,6 +511,14 @@
 			}
 		}
 		break;
+
+	case TIMER_BANNER:
+		{
+			showListBanner = false;
+			KillTimer(hContainer, TIMER_BANNER);
+			redraw();
+		}
+		break;
 	}
 	return true;
 }
@@ -689,6 +685,17 @@
 			threadCreate(currentList);
 	}
 
+	showListBanner = oldList != NULL && currentList != NULL && oldList->type == sbList::TYPE_MODULE_VIEW && currentList->type == sbList::TYPE_MODULE_VIEW;
+
+	if ( showListBanner )
+	{
+		SetTimer( hContainer, TIMER_BANNER , 5000 , (TIMERPROC) NULL );
+	}
+	else
+	{
+		KillTimer( hContainer, TIMER_BANNER );
+	}
+	
 	currentList->onActivate();
 
 	redraw();
@@ -819,4 +826,4 @@
 {
 	if (currentList != NULL)
 		currentList->onChar(character);
-}
\ No newline at end of file
+}

Modified: trunk/src/SlideBible/sbCore.h
===================================================================
--- trunk/src/SlideBible/sbCore.h	2009-11-13 22:57:11 UTC (rev 221)
+++ trunk/src/SlideBible/sbCore.h	2009-12-11 20:44:49 UTC (rev 222)
@@ -24,7 +24,7 @@
 #include "sbCollection.h"
 #include "sbCross.h"
 
-void sbMessage(const char *format, ...);
+void sbMessage ( const char *format , ... );
 
 #define sbAssert(condition) ((condition)?(sbMessage("sbAssert : " #condition ". at %s : %d\n", __FILE__, __LINE__), __debugbreak()) : 0)
 
@@ -33,12 +33,13 @@
 public:
 	struct SURFACE
 	{
+		SURFACE () : fade ( false ) , needRedraw ( false ) { ; }
+
 		enum TYPE
 		{
 			TYPE_LIST = 0,
 			TYPE_BUFFER,
 			TYPE_WHOLE,
-			TYPE_ZERO,           // for text size calculation
 			COUNT
 		};
 		
@@ -52,6 +53,8 @@
 	
 	struct INPUT
 	{
+		INPUT () : block ( false ) , startx ( 0 ) , starty ( 0 ) , tapCounter ( 0 ) { ; }
+
 		bool                     mousePressed;
 		
 		int                      startx;
@@ -71,15 +74,15 @@
 		TIMER_TAP,
 		TIMER_BANNER,
 		TIMER_REDRAW,
-		TIMER_BEFORE_REDRAW, // send only before calling redraw view
-		TIMER_SLIDE
+		TIMER_BEFORE_REDRAW, // send before redraw view
+		TIMER_SLIDE,
 	};
 
-	sbCore ( HINSTANCE hInstance );
+	sbCore ( HWND hwnd );
 	~sbCore();
 	
 	bool                         onMouse          ( int x, int y, const int state );
-	bool                         onPaint          ( );
+	void                         onPaint          ( HDC hdc );
 	bool                         onTimer          ( const int timer );
 	void                         onChar           ( TCHAR c );
 	bool                         onKeyDown        ( int key );
@@ -87,12 +90,12 @@
 
 	void                         redraw           ( );
 
-	const sbTheme*               getTheme         ( )                    {return &theme;}
-	sword::SWMgr*                getSword         ( )                    {return mpSwordMgr;}
-	sword::SWConfig*             getOptions       ( )                    {return mpOptions;}
-	const SURFACE*               getSurface       ( SURFACE::TYPE type ) {return &surfaces[type];}
-	const INPUT*                 getInput         ( )                    {return &input;}
-	sbCollection*                getBookmarks     ( )                    {return &bookmarks;}
+	const sbTheme *              getTheme         ( )                    {return &theme;}
+	sword::SWMgr *               getSword         ( )                    {return mpSwordMgr;}
+	sword::SWConfig *            getOptions       ( )                    {return mpOptions;}
+	const SURFACE *              getSurface       ( SURFACE::TYPE type ) {return &surfaces[type];}
+	const INPUT *                getInput         ( )                    {return &input;}
+	sbCollection *               getBookmarks     ( )                    {return &bookmarks;}
 	
 	void                         setSipState      ( bool on );
 	
@@ -103,6 +106,8 @@
 	
 	void                         controlPressed   ( sbControl::TYPE type );
 
+	//bool                         startTimer       ( TIMER timer );
+
 private:
 	struct THREAD_DATA
 	{
@@ -113,7 +118,7 @@
 		HANDLE                   handle;
 	};
 
-	static DWORD WINAPI          threadMain (LPVOID pData);
+	static DWORD WINAPI          threadMain ( LPVOID data );
 
 	THREAD_DATA                  threadData;
 
@@ -143,8 +148,6 @@
 	sbRect                       rClient;
 	HWND                         hContainer;
 	
-	PAINTSTRUCT                  ps;
-	
 	SURFACE                      surfaces[SURFACE::COUNT];
 
 	sword::SWMgr                *mpSwordMgr;
@@ -156,16 +159,17 @@
 	float                        cineticFactor;
 	int                          refreshRate;
 
+	bool                         showListBanner;
+
 public:
 	unsigned int                 scrollStep;
 	unsigned int                 versesMax;
 	unsigned int                 versesOptimal;
 
-
 	sword::SWModule * const      defaultModule;
 	sword::SWModule             *currentModule;
 };
 
-extern sbCore* Core;
+extern sbCore * Core;
 
 #endif

Modified: trunk/src/SlideBible/sbCross.h
===================================================================
--- trunk/src/SlideBible/sbCross.h	2009-11-13 22:57:11 UTC (rev 221)
+++ trunk/src/SlideBible/sbCross.h	2009-12-11 20:44:49 UTC (rev 222)
@@ -49,6 +49,7 @@
 	inline sbLong height () const {return RECT::bottom - RECT::top;}
 
 	inline bool pointInRect (sbLong x, sbLong y) const {return (x >= RECT::left && x < RECT::right && y >= RECT::top && y < RECT::bottom);}
+
 };
 
 #endif

Modified: trunk/src/SlideBible/sbItem.cpp
===================================================================
--- trunk/src/SlideBible/sbItem.cpp	2009-11-13 22:57:11 UTC (rev 221)
+++ trunk/src/SlideBible/sbItem.cpp	2009-12-11 20:44:49 UTC (rev 222)
@@ -164,10 +164,9 @@
 void sbItem::setText ( const TCHAR* _text_ )
 {
 	SIZE sz;
-	int  lineWidth = 0;
-	bool skip      = false;
-	bool italic    = false;
-	int  length    = _tcslen( _text_ );
+	int  lineWidth = 0, length = _tcslen( _text_ );
+	bool skip = false,  italic = false;
+	HDC  hdc = CreateCompatibleDC ( NULL );
 
 	sbAssert( _text_ == NULL );
 	
@@ -175,7 +174,7 @@
 
 	lines.push_back( LINE (style) );
 
-	SelectObject (Core->getSurface(sbCore::SURFACE::TYPE_ZERO)->hdc, Core->getTheme()->styles[style].font);
+	SelectObject ( hdc, Core->getTheme()->styles[style].font );
 
 	for(int i=0; i<length; i++)
 	{
@@ -213,7 +212,7 @@
 
 			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);
+			SelectObject ( hdc, Core->getTheme()->styles[lines.back().style].font );
 		}
 		else if (c == L'\t')
 		{
@@ -232,7 +231,7 @@
 		else if (!skip)
 		{
 			// add character
-			GetTextExtentPoint32(Core->getSurface(sbCore::SURFACE::TYPE_ZERO)->hdc,&c,1,&sz);
+			GetTextExtentPoint32(hdc,&c,1,&sz);
 			
 			// begin new line
 			if ((lineWidth + sz.cx > width-Core->getTheme()->itemLeftMargin-Core->getTheme()->itemRightMargin) \
@@ -263,6 +262,8 @@
 		}
 	}
 
+	DeleteDC ( hdc );
+
 	lines.back().newLine = true;
 
 	height = Core->getTheme()->itemTopMargin + Core->getTheme()->itemBottomMargin;

Modified: trunk/src/SlideBible/sbList.cpp
===================================================================
--- trunk/src/SlideBible/sbList.cpp	2009-11-13 22:57:11 UTC (rev 221)
+++ trunk/src/SlideBible/sbList.cpp	2009-12-11 20:44:49 UTC (rev 222)
@@ -25,26 +25,26 @@
 {
 	sbMessage("sbList of type %i initialized\n", _type_);
 
-	itemCurrent      = NULL;
-	itemHover        = NULL;
-	itemEdit         = NULL;
+	itemCurrent        = NULL;
+	itemHover          = NULL;
+	itemEdit           = NULL;
 
-	displaceHeight   = 0;
-	displacePart     = 0.0f;
+	displaceHeight     = 0;
+	displacePart       = 0.0f;
 	
-	module           = NULL;
+	module             = NULL;
 	
-	next             = NULL;
-	prev             = NULL;
-	parent           = NULL;
+	next               = NULL;
+	prev               = NULL;
+	parent             = NULL;
 
 	rect = &Core->getSurface(sbCore::SURFACE::TYPE_LIST)->rect;
 
-	verseFirst       = NULL;
-	verseLast        = NULL;
+	verseFirst         = NULL;
+	verseLast          = NULL;
 
-	versesForward    = 0;
-	versesBackward   = 0;
+	versesForward      = 0;
+	versesBackward     = 0;
 
 	listEndConstructed = listStartConstructed = true;
 
@@ -62,9 +62,9 @@
 	case TYPE_MODULE_VIEW:
 		{
 			addControl(sbControl::TYPE_OPEN_NAVIGATION);
+			addControl(sbControl::TYPE_MODE_ADD_STAR);
+			addControl(sbControl::TYPE_OPEN_SEARCH);
 			addControl(sbControl::TYPE_OPEN_HOME);
-			addControl(sbControl::TYPE_MODE_ADD_STAR);
-			addControl(sbControl::TYPE_BUTTON_CLOSE);
 
 			if (module != NULL)
 			{
@@ -88,6 +88,8 @@
 			itemCurrent = itemCurrent->next;
 			itemCurrent->center = true;
 
+			while ( itemCurrent->prev != NULL ) itemCurrent = itemCurrent->prev;
+
 			rect = &Core->getSurface(sbCore::SURFACE::TYPE_WHOLE)->rect;
 		}
 		break;
@@ -97,7 +99,6 @@
 			itemCurrent = new sbItem (sbItem::TYPE_HEADER, L"Welcome to\nSlideBible!", rect->width());
 
 			addControl(sbControl::TYPE_BUTTON_OPEN_FILE);
-			addControl(sbControl::TYPE_OPEN_SEARCH);
 			addControl(sbControl::TYPE_BUTTON_CLOSE);
 
 			if (Core->defaultModule != NULL)
@@ -150,7 +151,7 @@
 					delete [] text;
 				}
 
-				addControl ( sbControl::TYPE_OPEN_TEXT );
+				//addControl ( sbControl::TYPE_OPEN_TEXT );
 			}
 			else
 			{
@@ -168,6 +169,35 @@
 	}
 }
 
+sbList::~sbList()
+{
+	sbMessage("sbList of type %i deleted\n",type);
+
+	clear();
+
+	if (next != NULL)
+	{
+		next->prev = prev;
+	}
+	else
+	{
+		//if (type != TYPE_MODULE_VIEW)
+		//	addControl(sbControl::TYPE_CAN_SWITCH_RIGHT, false);
+	}
+
+	if (prev != NULL)
+	{
+		prev->next = next;
+	}
+	else
+	{
+		//if (type != TYPE_MODULE_VIEW)
+		//	addControl(sbControl::TYPE_CAN_SWITCH_LEFT, false);
+	}
+
+	for (int i=0; i < controls.size(); i++) delete controls[i];
+}
+
 void sbList::attach (sbList * list, sbList::TYPE to)
 {
 	switch (to)
@@ -225,35 +255,6 @@
 	}
 }
 
-sbList::~sbList()
-{
-	sbMessage("sbList of type %i deleted\n",type);
-
-	clear();
-
-	if (next != NULL)
-	{
-		next->prev = prev;
-	}
-	else
-	{
-		//if (type != TYPE_MODULE_VIEW)
-		//	addControl(sbControl::TYPE_CAN_SWITCH_RIGHT, false);
-	}
-	
-	if (prev != NULL)
-	{
-		prev->next = next;
-	}
-	else
-	{
-		//if (type != TYPE_MODULE_VIEW)
-		//	addControl(sbControl::TYPE_CAN_SWITCH_LEFT, false);
-	}
-
-	for (int i=0; i < controls.size(); i++) delete controls[i];
-}
-
 /*   sbList::setKey
  *   set current position of list module
  */
@@ -462,16 +463,16 @@
 }
 
 /*   sbList::render
- *   draw list
- */
-void sbList::render ( HDC hdc )
+*   draw list
+*/
+void sbList::render ( HDC hdc , bool showPlace )
 {
 	sbItem *oldItem , *workItem = itemCurrent;
 	sbRect workRect;
 	int screenHeight = displaceHeight;
 
 	Core->getTheme()->drawElement( hdc, rect, sbTheme::ELEMENT::BACKGROUND );
-	
+
 	while ( true )
 	{
 		if (workItem == NULL) break;
@@ -520,12 +521,12 @@
 
 					ExtTextOut(hdc, workRect.left()+((Core->getTheme()->itemLeftMargin-size.cx)/2), workRect.top(), ETO_OPAQUE, NULL, workItem->subtext.c_str(), workItem->subtext.size(), 0);
 				}
-			
+
 				SetTextColor(hdc, Core->getTheme()->ItemTextColor);
 
 				int lx = 0;
 				int ly = workRect.top() + Core->getTheme()->itemTopMargin;
-				
+
 				for (int i=0; i < workItem->lines.size(); i++)
 				{
 					int x = lx + Core->getTheme()->itemLeftMargin + workRect.left();
@@ -536,12 +537,12 @@
 						x += (workRect.width()-Core->getTheme()->itemLeftMargin-Core->getTheme()->itemRightMargin-workItem->lines[i].width)/2;
 
 					if (workItem->lines[i].newLine)
-						{lx = 0; ly += workItem->lines[i].height;}
+					{lx = 0; ly += workItem->lines[i].height;}
 					else
 						lx += workItem->lines[i].width;
 
 					if (workItem->lines[i].count == 0) continue;
-					
+
 					if (y + Core->getTheme()->styles[workItem->style].size >= workRect.bottom())
 						break;
 
@@ -610,26 +611,60 @@
 	//	time = GetTickCount();
 	//}
 
-	//if (drawBanner)
-	//{
-	//	TCHAR *place = new TCHAR [strlen(key.getText())+1];
-	//	
-	//	mbstowcs(place, key.getText(), strlen(key.getText())+1);
+	if ( showPlace && module != NULL )
+	{
+		SIZE         ks;
+		const char * kt = key.getShortText();
+		int          kl = strlen ( kt );
+		TCHAR      * kw = new TCHAR [ kl + 1 ];
+		const char * mt = module->Description();
+		int          ml = strlen ( mt );
+		TCHAR      * mw = new TCHAR [ ml + 1 ];
+		int          mc = 0;
+		
+		mbstowcs ( kw, kt, kl+1 );
+		mbstowcs ( mw, mt, ml+1 );
 
-	//	SIZE sz;
+		SelectObject ( hdc, Core->getTheme()->styles[sbTheme::STYLE::CAPTION].font );
+		GetTextExtentPoint32 ( hdc, kw, kl, &ks );
 
-	//	SelectObject (hdc, Core->getTheme()->styles[sbTheme::STYLE::CAPTION].font);
-	//	GetTextExtentPoint32(hdc,place,_tcsclen(place),&sz);
-	//	
-	//	workRect.bottom = rect->bottom/2+(sz.cy/2);
-	//	workRect.top = rect->bottom/2-(sz.cy/2);
-	//	workRect.right = rect->right/2+(sz.cx/2);
-	//	workRect.left = rect->right/2-(sz.cx/2);
+		sbRect tempRect ((rect->right()-ks.cx)/2, (Core->getTheme()->size/6)-(ks.cy/2), (rect->right()-ks.cx)/2+ks.cx, (Core->getTheme()->size/6)-(ks.cy/2)+ks.cy);
 
-	//	//FillRect(hdc, &workRect, CreateSolidBrush(Core->getTheme()->SeparatorColor));
-	//	ExtTextOut(hdc, workRect.left, workRect.top, ETO_OPAQUE, NULL, place, _tcsclen(place), 0);
-	//}
+		SelectObject ( hdc, Core->getTheme()->styles[sbTheme::STYLE::DESCRIPTION].font );
 
+		for (int width = 0; mc < ml; mc++)
+		{
+			SIZE sz;
+
+			GetTextExtentPoint32 ( hdc, mw+mc, 1, &sz );
+
+			if ( width + sz.cx > ks.cx ) break;
+
+			width += sz.cx;
+		}
+		
+		workRect = tempRect;
+
+		workRect.bottom ( workRect.bottom() + Core->getTheme()->styles[sbTheme::STYLE::DESCRIPTION].size );
+
+		workRect.bottom ( workRect.bottom() + Core->getTheme()->BannerBorderSize );
+		workRect.top    ( workRect.top()    - Core->getTheme()->BannerBorderSize );
+		workRect.left   ( workRect.left()   - Core->getTheme()->BannerBorderSize );
+		workRect.right  ( workRect.right()  + Core->getTheme()->BannerBorderSize );
+
+		Core->getTheme()->drawElement ( hdc, &workRect, sbTheme::ELEMENT::BANNER );
+
+		workRect = tempRect;
+
+		SetTextColor ( hdc, Core->getTheme()->ItemMenuTextColor );
+
+		SelectObject ( hdc, Core->getTheme()->styles[sbTheme::STYLE::CAPTION].font );
+		ExtTextOut   ( hdc, workRect.left(), workRect.top(), ETO_OPAQUE, NULL, kw, kl, 0);
+
+		SelectObject ( hdc, Core->getTheme()->styles[sbTheme::STYLE::DESCRIPTION].font );
+		ExtTextOut   ( hdc, workRect.left(), workRect.top() + Core->getTheme()->styles[sbTheme::STYLE::CAPTION].size , ETO_OPAQUE, NULL, mw, mc, 0);
+	}
+
 	if (displaceHeight >= 0)
 	{
 		needScroll = -displaceHeight;
@@ -935,46 +970,46 @@
  *   fill verses with text from module
  *   also delete unnecessary items
  */
-void sbList::updateVerses (bool *abort)
+void sbList::updateVerses ( bool * abort )
 {
-	sbAssert(module == NULL);
+	sbAssert ( module == NULL );
 
-	while (!*abort)
+	while ( ! *abort )
 	{
 		if (itemCurrent == NULL) return;
 		
-		int     displace  = displaceHeight;
-		sbItem* item      = itemCurrent;
-		bool    atEnd     = false;
+		int      displace  = displaceHeight;
+		sbItem * item      = itemCurrent;
+		bool     atEnd     = false;
 		
 		// delete unnecessary items
-		if (versesForward+versesBackward > Core->versesOptimal)
+		if ( versesForward + versesBackward > Core->versesOptimal )
 		{
 			int countDeleted = 0;
-			int needDelete = (versesForward+versesBackward)/Core->versesOptimal*10;
+			int needDelete = ( versesForward + versesBackward ) / Core->versesOptimal * 10;
 
-			if (versesForward>versesBackward)
+			if ( versesForward > versesBackward )
 			{
-				while (countDeleted<needDelete)
+				while ( countDeleted < needDelete )
 				{
 					verseLast = verseLast->prev;
 					while (verseLast->type != sbItem::TYPE_VERSE) verseLast = verseLast->prev;
 					while (verseLast->next != NULL)               delete verseLast->next;
 					countDeleted++;
 				}
-				if (listEndConstructed) listEndConstructed = false;
+				if ( listEndConstructed ) listEndConstructed = false;
 				versesForward-=countDeleted;
 			}
 			else
 			{
-				while (countDeleted<needDelete)
+				while ( countDeleted < needDelete )
 				{
 					verseFirst = verseFirst->next;
 					while (verseFirst->type != sbItem::TYPE_VERSE) verseFirst = verseFirst->next;
 					while (verseFirst->prev != NULL)               delete verseFirst->prev;
 					countDeleted++;
 				}
-				if (listStartConstructed) listStartConstructed = false;
+				if ( listStartConstructed ) listStartConstructed = false;
 				versesBackward -= countDeleted;
 			}
 		}
@@ -986,13 +1021,13 @@
 			item = item->next;
 		}
 		
-		sbItem* last      = item;
-		sbItem* first     = item;
+		sbItem * last      = item;
+		sbItem * first     = item;
 
-		while (!*abort)
+		while ( ! *abort )
 		{
 			// process item text
-			if (item->type == sbItem::TYPE_VERSE && item->text.size() == 0)
+			if ( item->type == sbItem::TYPE_VERSE && item->text.size() == 0 )
 			{
 				sword::VerseKey workKey ( key );
 
@@ -1000,21 +1035,24 @@
 
 				module->SetKey(workKey);
 
-				// TODO some times this cause crush, should i make it in try statement?
+				// TODO some times this cause crush, should i make it in try statement ?
 				TCHAR * text = (TCHAR*) module->RenderText();
+				int length = _tcslen ( text );
 
-				int len = _tcslen ( text );
-				TCHAR * add = new TCHAR [ len + 1 ];
-				for (int i=0; i <= len; i++) add[i] = text[i];
+				if ( length > 0 )
+				{
+					TCHAR * add = new TCHAR [ length + 1 ];
+					for ( int i=0; i <= length; i++ ) add[i] = text[i];
 
-				int oldHeight = item->height;
+					int oldHeight = item->height;
 
-				item->setText ( add );
+					item->setText ( add );
 
-				item->expanding = item->height;
-				item->height    = oldHeight;
+					item->expanding = item->height;
+					item->height    = oldHeight;
 
-				break;
+					return;
+				}
 			}
 
 			if (atEnd && last->next != NULL)
@@ -1293,19 +1331,19 @@
 
 						if (workKey.getVerse() == 1)
 						{
-							TCHAR headerText [16];
+							TCHAR headerText [32];
 
 							const char* book = workKey.getBookName();
-							int s = strlen(book);
-							mbstowcs(headerText,book,s);
+							int length = strlen(book);
+							mbstowcs(headerText,book,length);
 
 							char chap[8];
 							_itoa(workKey.getChapter(),chap,10);
 
-							headerText[s++] = s > 9 ? L'\n' : L' ';
+							headerText[length++] = length > 9 ? L'\n' : L' ';
 
 							for(int i=0;i<strlen(chap)+1;i++)
-								headerText[s++] = chap[i];
+								headerText[length++] = chap[i];
 
 							if (atEnd)
 							{
@@ -1362,7 +1400,7 @@
 /*  sbList::onActivate
  *  called before first redraw
  */
-void sbList::onActivate()
+void sbList::onActivate ( )
 {
 	Core->setSipState(itemEdit != NULL);
 
@@ -1375,12 +1413,11 @@
 /*  sbList::setEditMode
  *  controls list edit mode
  */
-void sbList::setEditMode (sbItem* item)
+void sbList::setEditMode ( sbItem * item )
 {
-	if (item == NULL && itemEdit != NULL)
+	if ( item == NULL && itemEdit != NULL )
 	{
-		// finish edit
-		// reallocate text
+		// finish edit , reallocate text
 		itemEdit = NULL;
 		Core->setSipState(false);
 	}
@@ -1420,4 +1457,4 @@
 		return true;
 	}	
 	return false;
-}
\ No newline at end of file
+}

Modified: trunk/src/SlideBible/sbList.h
===================================================================
--- trunk/src/SlideBible/sbList.h	2009-11-13 22:57:11 UTC (rev 221)
+++ trunk/src/SlideBible/sbList.h	2009-12-11 20:44:49 UTC (rev 222)
@@ -67,7 +67,7 @@
 	// methods
 	void                      attach         ( sbList * list, sbList::TYPE pin );
 	bool                      scroll         ( float amount );
-	void                      render         ( HDC hdc );
+	void                      render         ( HDC hdc , bool showPlace = false );
 
 	int                       displaceHeight;
 	float                     displacePart;
@@ -101,6 +101,7 @@
 	sbItem                   *itemEdit;
 	int                       itemEditCursor;
 
+	// Module List Related
 	sbItem                   *verseFirst;
 	sbItem                   *verseLast;
 
@@ -110,6 +111,7 @@
 	bool                      listStartConstructed;
 	bool                      listEndConstructed;
 	
+	// List Related
 	sbList                   *next;
 	sbList                   *prev;
 	sbList                   *parent;
@@ -122,6 +124,8 @@
 
 	const sbRect             *rect;
 
+	// Parameters
+
 	// Module View related
 	sword::SWModule          *module;
 	sword::VerseKey           key; // to cut

Modified: trunk/src/SlideBible/sbTheme.cpp
===================================================================
--- trunk/src/SlideBible/sbTheme.cpp	2009-11-13 22:57:11 UTC (rev 221)
+++ trunk/src/SlideBible/sbTheme.cpp	2009-12-11 20:44:49 UTC (rev 222)
@@ -135,6 +135,14 @@
 			color  = themeConf[name].getWithDefault("Color", "FF660000");
 			color2 = themeConf[name].getWithDefault("Color2", "");
 			break;
+		case ELEMENT::BANNER:
+			name   = "Element.Banner";
+			type   = themeConf[name].getWithDefault("Type", "VGRAD3");
+			color  = themeConf[name].getWithDefault("Color", "CBDADD00");
+			color2 = themeConf[name].getWithDefault("Color2", "B4CFD600");
+			color3 = themeConf[name].getWithDefault("Color3", "CBDADD00");
+			BannerBorderSize = size/atof(themeConf[name].getWithDefault("BorderDiv", "25.0"));
+			break;
 		default:
 			sbAssert(true);
 		}

Modified: trunk/src/SlideBible/sbTheme.h
===================================================================
--- trunk/src/SlideBible/sbTheme.h	2009-11-13 22:57:11 UTC (rev 221)
+++ trunk/src/SlideBible/sbTheme.h	2009-12-11 20:44:49 UTC (rev 222)
@@ -69,6 +69,7 @@
 			TAPPED,
 			CONTROL,
 			CONTROL_PRESSED,
+			BANNER,
 			COUNT
 		};
 
@@ -98,6 +99,7 @@
 	void                  drawElement (HDC hdc, const sbRect *rect, sbTheme::ELEMENT::TYPE type, const int animFrame=0) const;
 
 	int                   ListSeparatorHeight;
+	int                   BannerBorderSize;
 
 	int                   size; // screen minimal dimention, determine font and control sizes
 	int                   fingerSize;

Modified: trunk/src/SlideBible/todo.txt
===================================================================
--- trunk/src/SlideBible/todo.txt	2009-11-13 22:57:11 UTC (rev 221)
+++ trunk/src/SlideBible/todo.txt	2009-12-11 20:44:49 UTC (rev 222)
@@ -8,11 +8,12 @@
 +	on first use show "Read Bible ..."
 +	fix rect for Options View
 +	release congiguration
++	module view description
 ~	sometimes happens something wrong with height of empty verse and verse text line height
-	draw module view description on sbList activate
-	timer to save config
+	verse history
+	timer to save configs
 
-	bookmarks, history, ratings, verselists
+	bookmarks, history, ratings, thematic verse lists, tags, colors
 		dialog: verse actions(favorite|send to list...|send to new list)
 		dialog: select verse(s)
 		dialog: menu verse
@@ -33,8 +34,10 @@
 *	static / dynamic bookmarks
 		on screen marks
 
+	prepare to Huge Rewrite
 	text fade
-	2. Ïàðàëèïîìå\níîí\n4
+	2. Ïàðàëèïîìå\níîí\n4 in chapter title
+	start slide to empty list, but drop to not empty produces blank screen
 	daily devotionals
 	make list scrolling more smooth
 	make verse expantion without jerks

Modified: trunk/src/SlideBible.sln
===================================================================
--- trunk/src/SlideBible.sln	2009-11-13 22:57:11 UTC (rev 221)
+++ trunk/src/SlideBible.sln	2009-12-11 20:44:49 UTC (rev 222)
@@ -9,9 +9,9 @@
 		Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{F0CEF277-24C5-45BC-A0D0-56BE5A64AB94}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
-		{F0CEF277-24C5-45BC-A0D0-56BE5A64AB94}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
-		{F0CEF277-24C5-45BC-A0D0-56BE5A64AB94}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{F0CEF277-24C5-45BC-A0D0-56BE5A64AB94}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{F0CEF277-24C5-45BC-A0D0-56BE5A64AB94}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{F0CEF277-24C5-45BC-A0D0-56BE5A64AB94}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
 		{F0CEF277-24C5-45BC-A0D0-56BE5A64AB94}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
 		{F0CEF277-24C5-45BC-A0D0-56BE5A64AB94}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
 		{F0CEF277-24C5-45BC-A0D0-56BE5A64AB94}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)




More information about the sword-cvs mailing list