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

bdrake at www.crosswire.org bdrake at www.crosswire.org
Tue Jan 8 10:54:50 MST 2008


Author: bdrake
Date: 2008-01-08 10:54:49 -0700 (Tue, 08 Jan 2008)
New Revision: 88

Modified:
   trunk/src/gui/SimpleNavigator.cpp
Log:
Saved key on entering urlClicked ...  restored on exit.  If we don't do this, changing version or anything else looks up the chapter and verse last shown by a MessageBox inside the function.

Modified: trunk/src/gui/SimpleNavigator.cpp
===================================================================
--- trunk/src/gui/SimpleNavigator.cpp	2008-01-07 14:15:46 UTC (rev 87)
+++ trunk/src/gui/SimpleNavigator.cpp	2008-01-08 17:54:49 UTC (rev 88)
@@ -259,10 +259,11 @@
 
 void SimpleNavigator::urlClicked(const WCHAR *target) {
 	const char * t = wstrtostr(target);
+	SWKey *modKey = 0;
 	// MessageBox(0, strtowstr(t), L"This is 't'", MB_OK);
 	// SWMgr swmanager; // don't create new manager - use SwordIndex::manager
-	// TODO - make a copy of ["History"] ["LastModule"] and restore before leaving procedure
 	// Footnote MessageBox
+	UString oldPos = position.verseToString(); // information to restore the persistent key
 	if (strstr(t, "showNote")) {
 		URL footnote(t);  // t is char* to URL string
 		SWBuf module = footnote.getParameterValue("module");
@@ -273,7 +274,8 @@
 		// get the module it's in
 		SWModule *mod = SwordIndex::manager->getModule(module); // Thanks Troy for above ...  Nov 2007
 		// set that module to the correct entry
-		SWKey *modKey = mod->getKey(); // get the persistent key
+		// TODO - may need to re-set this afterwards - could save int SimpleNavigator::getID();
+		modKey = mod->getKey(); // get the persistent key
 		modKey->setText(key.c_str()); // set the key itself 
 		// force a parse of the entry
 		mod->RenderText(); 
@@ -297,7 +299,7 @@
 				L"Strong's", MB_OK);
 			return;
 		}
-		SWKey *modKey = mod->getKey(); 
+		modKey = mod->getKey(); 
 		modKey->setText(number.c_str()); 
 		mod->RenderText(); 
 		MessageBox(0, strtowstr(mod->StripText()), L"Strong's", MB_OK);
@@ -324,7 +326,7 @@
 			return;
 			}
 		}
-		SWKey *modKey = mod->getKey(); 
+		modKey = mod->getKey(); 
 		modKey->setText(number.c_str()); 
 		mod->RenderText(); 
 		MessageBox(0, strtowstr(mod->StripText()), L"Morph tags", MB_OK);
@@ -342,7 +344,7 @@
 				L"Cross referencing", MB_ICONWARNING);
 			return;
 			}
-		SWKey *modKey = mod->getKey(); // get the persistent key
+		modKey = mod->getKey(); // get the persistent key
 		modKey->setText(key.c_str()); // set the key itself 
 		mod->RenderText(); 
 		// strip out html if present
@@ -352,6 +354,7 @@
 		}
 //comment next line out in release version
 else MessageBox(0, strtowstr(t), L"Raw entry unresolved", MB_OK); // catch all 
+modKey->setText((const char *)oldPos.c_str()); // restore the key before leaving
 }
 
 




More information about the sword-cvs mailing list