[sword-svn] r70 - trunk/src/gui

dtrotzjr at www.crosswire.org dtrotzjr at www.crosswire.org
Sat Dec 22 18:40:40 MST 2007


Author: dtrotzjr
Date: 2007-12-22 18:40:38 -0700 (Sat, 22 Dec 2007)
New Revision: 70

Modified:
   trunk/src/gui/ApplicationInterface.cpp
   trunk/src/gui/ApplicationInterface.h
   trunk/src/gui/Main.cpp
   trunk/src/gui/NavRenderText.cpp
   trunk/src/gui/SimpleNavigator.cpp
   trunk/src/gui/gui.vcl
Log:
Some double buffering polishing. Events are now discarded while a chapter is being loaded. Buttons are grayed out, but need some work done on that still.

Modified: trunk/src/gui/ApplicationInterface.cpp
===================================================================
--- trunk/src/gui/ApplicationInterface.cpp	2007-12-22 22:16:40 UTC (rev 69)
+++ trunk/src/gui/ApplicationInterface.cpp	2007-12-23 01:40:38 UTC (rev 70)
@@ -7,6 +7,7 @@
 
 HINSTANCE	g_hInst;	// The current instance
 HWND		g_hWnd;		// The main window
+DWORD		g_tMain;	// The main thread id.
 HWND		g_hwndCB;	// The command bar handle
 HDC			hdc;		// Only valid when painting
 HBRUSH		background;

Modified: trunk/src/gui/ApplicationInterface.h
===================================================================
--- trunk/src/gui/ApplicationInterface.h	2007-12-22 22:16:40 UTC (rev 69)
+++ trunk/src/gui/ApplicationInterface.h	2007-12-23 01:40:38 UTC (rev 70)
@@ -21,10 +21,14 @@
 
 extern HDC			hdc;		// Only valid when painting
 extern HBRUSH		background;	
+extern DWORD		g_tMain;
 extern HINSTANCE	g_hInst;	// The current instance
 extern HWND			g_hWnd;		// The main window
 extern HWND			g_hwndCB;
 
+#define WM_TXT_START WM_USER + 0x0001
+#define WM_TXT_END   WM_USER + 0x0002
+
 #define MENU_HEIGHT		26
 #define MAX_LOADSTRING	100
 

Modified: trunk/src/gui/Main.cpp
===================================================================
--- trunk/src/gui/Main.cpp	2007-12-22 22:16:40 UTC (rev 69)
+++ trunk/src/gui/Main.cpp	2007-12-23 01:40:38 UTC (rev 70)
@@ -24,7 +24,10 @@
 {
 	MSG msg;
 	HACCEL hAccelTable;
+	bool ignoreMsgs = false;
+	DWORD ignoreTill = GetTickCount();
 
+	g_tMain = GetCurrentThreadId();
 	// Perform application initialization:
 	if (!InitInstance (hInstance, nCmdShow)) 
 	{
@@ -32,17 +35,25 @@
 	}
 
 	hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_BIBLEREADER);
-
 	// Main message loop:
 	while (GetMessage(&msg, NULL, 0, 0)) 
 	{
+		if(msg.message == WM_TXT_START){ 
+			ignoreMsgs = true;
+		}else if(msg.message == WM_TXT_END){
+			ignoreMsgs = false;
+			ignoreTill = msg.time;
+		}else
+
+		if(ignoreMsgs || msg.time < ignoreTill)
+			continue;
+
 		if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) 
 		{
 			TranslateMessage(&msg);
 			DispatchMessage(&msg);
 		}
 	}
-
 	return msg.wParam;
 }
 

Modified: trunk/src/gui/NavRenderText.cpp
===================================================================
--- trunk/src/gui/NavRenderText.cpp	2007-12-22 22:16:40 UTC (rev 69)
+++ trunk/src/gui/NavRenderText.cpp	2007-12-23 01:40:38 UTC (rev 70)
@@ -4,7 +4,17 @@
 
 
 #include <swordce.h>
+#include <windows.h>
+#include <sipapi.h>
+#include <shlobj.h>
+#include <prsht.h>
+#include <aygshell.h>
 
+#include "utils.h"
+
+
+//#define getMenu(window) (HMENU)SendMessage(window, SHCMBM_GETMENU, (WPARAM)0, (LPARAM)0)
+
 NavRenderText::NavRenderText(SimpleNavigator* navigator):NavPage(navigator) {
 	textControl = new VerseTextControl(RECT_SCREEN.left, RECT_SCREEN.top, RECT_SCREEN.right, RECT_SCREEN.bottom);
 }
@@ -40,6 +50,13 @@
 }
 
 void NavRenderText::load() {
+	int i;
+	for(i = MENU_BOOK; i <= MENU_MENU; i++){
+		SendMessage(g_hwndCB, TB_ENABLEBUTTON, i, false);
+	}
+
+	// Suspend user interaction until this page is fully loaded.
+	PostThreadMessage(g_tMain, WM_TXT_START, NULL, NULL); 
 	navigator->position.setMark();
 	navigator->position.setVerse(1);
 	textControl->addText(UString(L"<html><head><title></title></head><body>")); // a <style> section presumably gets skipped
@@ -72,6 +89,12 @@
 	navigator->position.jumpBack();
 
 	textControl->endOfText();
+	// Suspend user interaction until this page is fully loaded.
+	PostThreadMessage(g_tMain, WM_TXT_END, NULL, NULL);
+	for(i = MENU_BOOK; i <= MENU_MENU; i++){
+		SendMessage(g_hwndCB, TB_ENABLEBUTTON, i, true);
+	}
+	refreshScreen();
 }
 
 void NavRenderText::hide() {

Modified: trunk/src/gui/SimpleNavigator.cpp
===================================================================
--- trunk/src/gui/SimpleNavigator.cpp	2007-12-22 22:16:40 UTC (rev 69)
+++ trunk/src/gui/SimpleNavigator.cpp	2007-12-23 01:40:38 UTC (rev 70)
@@ -24,6 +24,7 @@
 
 RECT RECT_FIELD = {6,24,240,250};
 
+
 SimpleNavigator::SimpleNavigator(RECT* screen) {
 	RECT_SCREEN=*screen;
 	mode=-1;

Modified: trunk/src/gui/gui.vcl
===================================================================
--- trunk/src/gui/gui.vcl	2007-12-22 22:16:40 UTC (rev 69)
+++ trunk/src/gui/gui.vcl	2007-12-23 01:40:38 UTC (rev 70)
@@ -6,46 +6,46 @@
 --------------------Configuration: gui - Win32 (WCE ARM) Release--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating command line "rc.exe /l 0x409 /fo"ARMRel/BibleReader.res" /i "..\dll1\sword\include" /i "..\dll1\wincesword\include" /i "..\STL_eVC" /d UNDER_CE=300 /d _WIN32_WCE=300 /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "WIN32_PLATFORM_PSPC=310" /d "ARM" /d "_ARM_" /r "D:\src\swordreader\src\gui\BibleReader.rc"" 
-Creating temporary file "C:\DOCUME~1\Scribe\LOCALS~1\Temp\RSP1C.tmp" with contents
+Creating command line "rc.exe /l 0x409 /fo"ARMRel/BibleReader.res" /i "..\dll1\sword\include" /i "..\dll1\wincesword\include" /i "..\STL_eVC" /d UNDER_CE=300 /d _WIN32_WCE=300 /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "WIN32_PLATFORM_PSPC=310" /d "ARM" /d "_ARM_" /r "C:\cygwin\home\David Trotz\swordreader\src\gui\BibleReader.rc"" 
+Creating temporary file "C:\DOCUME~1\DAVIDT~1\LOCALS~1\Temp\RSP4B4.tmp" with contents
 [
-/nologo /W3 /I "..\STL_eVC" /I "..\..\..\sword\include" /I "..\dll1\wincesword\include" /D _WIN32_WCE=300 /D "WIN32_PLATFORM_PSPC=310" /D "ARM" /D "_ARM_" /D UNDER_CE=300 /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /FR"ARMRel/" /Fo"ARMRel/" /Oxs /MC /c 
-"D:\src\swordreader\src\gui\ApplicationInterface.cpp"
-"D:\src\swordreader\src\gui\Main.cpp"
-"D:\src\swordreader\src\gui\NavBooks.cpp"
-"D:\src\swordreader\src\gui\NavChap.cpp"
-"D:\src\swordreader\src\gui\NavFind.cpp"
-"D:\src\swordreader\src\gui\Navigator.cpp"
-"D:\src\swordreader\src\gui\NavNumbers.cpp"
-"D:\src\swordreader\src\gui\NavRenderText.cpp"
-"D:\src\swordreader\src\gui\NavVerse.cpp"
-"D:\src\swordreader\src\gui\SimpleNavigator.cpp"
-"D:\src\swordreader\src\gui\SwordIndex.cpp"
-"D:\src\swordreader\src\gui\TextControl.cpp"
-"D:\src\swordreader\src\gui\Utils.cpp"
-"D:\src\swordreader\src\gui\VerseTextControl.cpp"
+/nologo /W3 /O2 /I "..\STL_eVC" /I "..\..\..\sword\include" /I "..\dll1\wincesword\include" /D _WIN32_WCE=300 /D "WIN32_PLATFORM_PSPC=310" /D "ARM" /D "_ARM_" /D UNDER_CE=300 /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /FR"ARMRel/" /Fo"ARMRel/" /Oxs /MC /c 
+"C:\cygwin\home\David Trotz\swordreader\src\gui\ApplicationInterface.cpp"
+"C:\cygwin\home\David Trotz\swordreader\src\gui\Main.cpp"
+"C:\cygwin\home\David Trotz\swordreader\src\gui\NavBooks.cpp"
+"C:\cygwin\home\David Trotz\swordreader\src\gui\NavChap.cpp"
+"C:\cygwin\home\David Trotz\swordreader\src\gui\NavFind.cpp"
+"C:\cygwin\home\David Trotz\swordreader\src\gui\Navigator.cpp"
+"C:\cygwin\home\David Trotz\swordreader\src\gui\NavNumbers.cpp"
+"C:\cygwin\home\David Trotz\swordreader\src\gui\NavRenderText.cpp"
+"C:\cygwin\home\David Trotz\swordreader\src\gui\NavVerse.cpp"
+"C:\cygwin\home\David Trotz\swordreader\src\gui\SimpleNavigator.cpp"
+"C:\cygwin\home\David Trotz\swordreader\src\gui\SwordIndex.cpp"
+"C:\cygwin\home\David Trotz\swordreader\src\gui\TextControl.cpp"
+"C:\cygwin\home\David Trotz\swordreader\src\gui\Utils.cpp"
+"C:\cygwin\home\David Trotz\swordreader\src\gui\VerseTextControl.cpp"
 ]
-Creating command line "clarm.exe @C:\DOCUME~1\Scribe\LOCALS~1\Temp\RSP1C.tmp" 
-Creating temporary file "C:\DOCUME~1\Scribe\LOCALS~1\Temp\RSP1D.tmp" with contents
+Creating command line "clarm.exe @C:\DOCUME~1\DAVIDT~1\LOCALS~1\Temp\RSP4B4.tmp" 
+Creating temporary file "C:\DOCUME~1\DAVIDT~1\LOCALS~1\Temp\RSP4B5.tmp" with contents
 [
 ..\Dll1\ARMRel\sword.lib htmlview.lib oleaut32.lib commctrl.lib coredll.lib aygshell.lib ..\Dll1\ARMRel\sword.lib /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /incremental:no /pdb:"ARMRel/gui.pdb" /nodefaultlib:"libc.lib /nodefaultlib:libcd.lib /nodefaultlib:libcmt.lib /nodefaultlib:libcmtd.lib /nodefaultlib:msvcrt.lib /nodefaultlib:msvcrtd.lib /nodefaultlib:oldnames.lib" /out:"ARMRel/gui.exe" /libpath:"..\STL_eVC" /libpath:"C:\IpaqProgs\SwordReader\src\STL_eVC\\" /subsystem:windowsce,3.00 /align:"4096" /MACHINE:ARM 
-.\ARMRel\ApplicationInterface.obj
-.\ARMRel\Main.obj
-.\ARMRel\NavBooks.obj
-.\ARMRel\NavChap.obj
-.\ARMRel\NavFind.obj
-.\ARMRel\Navigator.obj
-.\ARMRel\NavNumbers.obj
-.\ARMRel\NavRenderText.obj
-.\ARMRel\NavVerse.obj
-.\ARMRel\SimpleNavigator.obj
-.\ARMRel\SwordIndex.obj
-.\ARMRel\TextControl.obj
-.\ARMRel\Utils.obj
-.\ARMRel\VerseTextControl.obj
-.\ARMRel\BibleReader.res
+".\ARMRel\ApplicationInterface.obj"
+".\ARMRel\Main.obj"
+".\ARMRel\NavBooks.obj"
+".\ARMRel\NavChap.obj"
+".\ARMRel\NavFind.obj"
+".\ARMRel\Navigator.obj"
+".\ARMRel\NavNumbers.obj"
+".\ARMRel\NavRenderText.obj"
+".\ARMRel\NavVerse.obj"
+".\ARMRel\SimpleNavigator.obj"
+".\ARMRel\SwordIndex.obj"
+".\ARMRel\TextControl.obj"
+".\ARMRel\Utils.obj"
+".\ARMRel\VerseTextControl.obj"
+".\ARMRel\BibleReader.res"
 ]
-Creating command line "link.exe @C:\DOCUME~1\Scribe\LOCALS~1\Temp\RSP1D.tmp"
+Creating command line "link.exe @C:\DOCUME~1\DAVIDT~1\LOCALS~1\Temp\RSP4B5.tmp"
 <h3>Output Window</h3>
 Compiling resources...
 Compiling...
@@ -65,24 +65,24 @@
 VerseTextControl.cpp
 Generating Code...
 Linking...
-Creating temporary file "C:\DOCUME~1\Scribe\LOCALS~1\Temp\RSP20.tmp" with contents
+Creating temporary file "C:\DOCUME~1\DAVIDT~1\LOCALS~1\Temp\RSP4B8.tmp" with contents
 [
 /nologo /o"ARMRel/gui.bsc" 
-.\ARMRel\ApplicationInterface.sbr
-.\ARMRel\Main.sbr
-.\ARMRel\NavBooks.sbr
-.\ARMRel\NavChap.sbr
-.\ARMRel\NavFind.sbr
-.\ARMRel\Navigator.sbr
-.\ARMRel\NavNumbers.sbr
-.\ARMRel\NavRenderText.sbr
-.\ARMRel\NavVerse.sbr
-.\ARMRel\SimpleNavigator.sbr
-.\ARMRel\SwordIndex.sbr
-.\ARMRel\TextControl.sbr
-.\ARMRel\Utils.sbr
-.\ARMRel\VerseTextControl.sbr]
-Creating command line "bscmake.exe @C:\DOCUME~1\Scribe\LOCALS~1\Temp\RSP20.tmp"
+".\ARMRel\ApplicationInterface.sbr"
+".\ARMRel\Main.sbr"
+".\ARMRel\NavBooks.sbr"
+".\ARMRel\NavChap.sbr"
+".\ARMRel\NavFind.sbr"
+".\ARMRel\Navigator.sbr"
+".\ARMRel\NavNumbers.sbr"
+".\ARMRel\NavRenderText.sbr"
+".\ARMRel\NavVerse.sbr"
+".\ARMRel\SimpleNavigator.sbr"
+".\ARMRel\SwordIndex.sbr"
+".\ARMRel\TextControl.sbr"
+".\ARMRel\Utils.sbr"
+".\ARMRel\VerseTextControl.sbr"]
+Creating command line "bscmake.exe @C:\DOCUME~1\DAVIDT~1\LOCALS~1\Temp\RSP4B8.tmp"
 Creating browse info file...
 <h3>Output Window</h3>
 




More information about the sword-cvs mailing list