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

kalemas at crosswire.org kalemas at crosswire.org
Fri Jun 4 13:49:40 MST 2010


Author: kalemas
Date: 2010-06-04 13:49:39 -0700 (Fri, 04 Jun 2010)
New Revision: 239

Modified:
   trunk/src/SlideBible/SlideBible.vcproj
   trunk/src/SlideBible/bin/SlideBible.exe
   trunk/src/SlideBible/main.cpp
   trunk/src/SlideBible/sbControl.cpp
   trunk/src/SlideBible/sbCore.cpp
   trunk/src/SlideBible/sbCore.h
   trunk/src/SlideBible/sbItem.cpp
   trunk/src/SlideBible/sbList.cpp
   trunk/src/SlideBible/todo.txt
Log:
+	module manager
+		raise connection
+	mods.d and modules creation if not exists

Modified: trunk/src/SlideBible/SlideBible.vcproj
===================================================================
--- trunk/src/SlideBible/SlideBible.vcproj	2010-06-02 19:01:34 UTC (rev 238)
+++ trunk/src/SlideBible/SlideBible.vcproj	2010-06-04 20:49:39 UTC (rev 239)
@@ -115,7 +115,7 @@
 			/>
 			<DeploymentTool
 				ForceDirty="-1"
-				RemoteDirectory="\Storage Card\Program Files\SwordReader\"
+				RemoteDirectory="\Internal Storage\Program Files\SlideBible\"
 				RegisterOutput="0"
 				AdditionalFiles=""
 			/>
@@ -309,7 +309,7 @@
 			/>
 			<Tool
 				Name="VCPostBuildEventTool"
-				CommandLine=""
+				CommandLine="copy &quot;$(TargetPath)&quot; &quot;$(InputDir)\bin\SlideBible_Win32.exe&quot;"
 			/>
 		</Configuration>
 		<Configuration
@@ -395,6 +395,7 @@
 			/>
 			<Tool
 				Name="VCPostBuildEventTool"
+				CommandLine="copy &quot;$(TargetPath)&quot; &quot;$(InputDir)\bin\SlideBible.exe&quot;"
 			/>
 			<DeploymentTool
 				ForceDirty="-1"

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

Modified: trunk/src/SlideBible/main.cpp
===================================================================
--- trunk/src/SlideBible/main.cpp	2010-06-02 19:01:34 UTC (rev 238)
+++ trunk/src/SlideBible/main.cpp	2010-06-04 20:49:39 UTC (rev 239)
@@ -26,14 +26,10 @@
 #include <unistd.cpp>
 #include <fcntl.cpp>
 
-//#include <ruby/winsock2.c>
-
 #endif
 
 #include <filemgr.h>
 
-using sword::FileDesc;
-using sword::FileMgr;
 
 
 // Globals
@@ -59,7 +55,7 @@
 
 	//static FileDesc * file = NULL;
 	//file = FileMgr::getSystemFileMgr()->open(".\\log.txt", file == NULL ? FileMgr::WRONLY|FileMgr::CREAT|FileMgr::TRUNC : FileMgr::WRONLY|FileMgr::APPEND );
-	static FileDesc * file = FileMgr::getSystemFileMgr()->open(".\\log.txt", FileMgr::WRONLY|FileMgr::CREAT|FileMgr::TRUNC );
+	static sword::FileDesc * file = sword::FileMgr::getSystemFileMgr()->open(".\\log.txt", sword::FileMgr::WRONLY|sword::FileMgr::CREAT|sword::FileMgr::TRUNC );
 
 	if (file->getFd() > 0)
 	{
@@ -895,9 +891,14 @@
 			Window = CreateWindow( appClass, appTitle, WS_VISIBLE,
 				0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
 				NULL, NULL, hInstance, NULL );
+
+			// fix: if dirs does not exists module installation can't succeed
+			if (!sword::FileMgr::getSystemFileMgr()->existsDir(".\\mods.d\\"))
+				sword::FileMgr::getSystemFileMgr()->createParent(".\\mods.d\\");
+			if (!sword::FileMgr::getSystemFileMgr()->existsDir(".\\modules\\"))
+				sword::FileMgr::getSystemFileMgr()->createParent(".\\modules\\");
 #else
 			Window = CreateWindow( appClass, appTitle, WS_VISIBLE,
-				//CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
 				CW_USEDEFAULT, CW_USEDEFAULT, 480, 640,
 				NULL, NULL, hInstance, NULL );
 #endif

Modified: trunk/src/SlideBible/sbControl.cpp
===================================================================
--- trunk/src/SlideBible/sbControl.cpp	2010-06-02 19:01:34 UTC (rev 238)
+++ trunk/src/SlideBible/sbControl.cpp	2010-06-04 20:49:39 UTC (rev 239)
@@ -280,7 +280,7 @@
 	case TYPE_CAN_SWITCH_LEFT:
 	case TYPE_CAN_SWITCH_RIGHT:                                                            break;
 	case TYPE_INSTALLER_DISCLAIMER_ACCEPT:
-		Core->installMgr.setUserDisclaimerConfirmed(true);
+		Core->getInstallMgr()->setUserDisclaimerConfirmed(true);
 		Core->switchList(sbList::TYPE_MODULE_INSTALLER);
 		break;
 	case TYPE_INSTALLER_DISCLAIMER_DECLINE: Core->switchList(sbList::TYPE_SELECT_MODULE);      break;

Modified: trunk/src/SlideBible/sbCore.cpp
===================================================================
--- trunk/src/SlideBible/sbCore.cpp	2010-06-02 19:01:34 UTC (rev 238)
+++ trunk/src/SlideBible/sbCore.cpp	2010-06-04 20:49:39 UTC (rev 239)
@@ -29,7 +29,7 @@
 sbCore * Core;
 sbList * sbCore::backgroundList;
 
-sbCore::sbCore () : installMgr ("./install/",&installStatus)
+sbCore::sbCore ()
 {
 	sbMessage ("Launch SlideBible Core.\n");
 	
@@ -56,6 +56,7 @@
 	bScrollTimer         = false;
 
 	swordMgr             = NULL;
+	installManager       = NULL;
 	currentModule        = NULL;
 
 	changedGlobalOptions = false;
@@ -128,8 +129,9 @@
 	}
 
 	// clear sword
-	if (swordMgr != NULL) delete swordMgr;
-	if (options  != NULL) delete options;
+	if (swordMgr       != NULL) delete swordMgr;
+	if (installManager != NULL) delete installManager;
+	if (options        != NULL) delete options;
 
 	sbSurfaceDestroy(drawSurface);
 
@@ -385,9 +387,8 @@
 
 			features.save();
 
-			if (options != NULL) options->Save();
-
-			installMgr.saveInstallConf();
+			if (options        != NULL) options->Save();
+			if (installManager != NULL) installManager->saveInstallConf();
 		}
 		break;
 
@@ -678,3 +679,10 @@
 
 	currentModule = curMod == NULL ? NULL : swordMgr->getModule( curMod );
 }
+
+sword::InstallMgr * sbCore::getInstallMgr()
+{
+	if (installManager == NULL) 
+		installManager = new sword::InstallMgr ("./install/",&installStatus);
+	return installManager;
+}
\ No newline at end of file

Modified: trunk/src/SlideBible/sbCore.h
===================================================================
--- trunk/src/SlideBible/sbCore.h	2010-06-02 19:01:34 UTC (rev 238)
+++ trunk/src/SlideBible/sbCore.h	2010-06-04 20:49:39 UTC (rev 239)
@@ -69,6 +69,7 @@
 	void                         redraw           ();
 
 	sword::SWMgr *               getSword         ()                     {return swordMgr;}
+	sword::InstallMgr *          getInstallMgr    ();
 	sword::SWConfig *            getOptions       ()                     {return options;}
 	const INPUT *                getInput         ()                     {return &input;}
 	const sbRect &               getRect          ()                     {return rClient;}
@@ -126,8 +127,9 @@
 
 	std::vector<const char*>     strings;
 
+	sword::InstallMgr           *installManager;
+
 public:
-	sword::InstallMgr            installMgr;
 	sword::StatusReporter        installStatus;
 
 	sbFeatures                   features;

Modified: trunk/src/SlideBible/sbItem.cpp
===================================================================
--- trunk/src/SlideBible/sbItem.cpp	2010-06-02 19:01:34 UTC (rev 238)
+++ trunk/src/SlideBible/sbItem.cpp	2010-06-04 20:49:39 UTC (rev 239)
@@ -139,12 +139,15 @@
 
 	switch (type)
 	{
-	case LOOK_BANNER:
-	case TYPE_HISTORY:
 	case DO_SEARCH_RANGE_START:
 	case DO_SEARCH_RANGE_END:
+		minHeight   = Theme->size/6;
 		manualLines = true;
 		break;
+	case LOOK_BANNER:
+	case TYPE_HISTORY:
+		manualLines = true;
+		break;
 	case LOOK_SEPARATOR:
 		style       = sbTheme::STYLE::DESCRIPTION;
 		alignCenter = true;
@@ -163,6 +166,9 @@
 	case TYPE_BOOKMARK_VERSE_NUMBER:
 		textWidth = width;
 		break;
+	case TYPE_OPEN_MODULE_INSTALLER:
+		minHeight   = Theme->size/4;
+		break;
 	}
 
 	font = Theme->styles[style].font;
@@ -557,6 +563,25 @@
 		sbSelectFont (surface, Theme->styles[lines[2].style].font);
 		sbDrawText   (surface, rect.left + Theme->itemMargins.left, rect.top + Theme->itemMargins.top + lines[0].height, text.c_str() + lines[2].pos, lines[2].count);
 	}
+	else if (type > LOOK_MENU && type < LOOK_MENU_COUNT)
+	{
+		Theme->drawElement( surface, &rect, sbTheme::ELEMENT::ANOTHER_MENU );
+
+		for (int i = 0, lx = 0, ly = rect.top + Theme->itemMargins.top; i < lines.size(); i++)
+		{
+			int x = lx + Theme->itemMargins.left + rect.left;
+			int y = ly;
+
+			lines[i].ending ? lx = 0, ly += lines[i].height : lx += lines[i].width;
+
+			if (lines[i].count == 0) continue;
+
+			sbSelectFont(surface, Theme->styles[lines[i].style].font);
+			sbSelectColor (surface, Theme->fadeColor(Theme->elements[sbTheme::ELEMENT::ANOTHER_MENU].textColor,x,y));
+
+			sbDrawText (surface, x, y, text.c_str() + lines[i].pos, lines[i].count);
+		}
+	}
 	else if (type > LOOK_BUTTON && type < LOOK_BUTTON_COUNT)
 	{
 		Theme->drawElement( surface, &rect, sbTheme::ELEMENT::PANEL );

Modified: trunk/src/SlideBible/sbList.cpp
===================================================================
--- trunk/src/SlideBible/sbList.cpp	2010-06-02 19:01:34 UTC (rev 238)
+++ trunk/src/SlideBible/sbList.cpp	2010-06-04 20:49:39 UTC (rev 239)
@@ -818,7 +818,7 @@
 			_sntprintf(tempText,tempTextSize,L"Dou you want to install %S of size %S KB ?\n",module->Name(),module->getConfigEntry("InstallSize"));
 			
 			if (sbQueryBox(tempText))
-				success = Core->installMgr.installModule(Core->getSword(),"",module->Name(),source);
+				success = Core->getInstallMgr()->installModule(Core->getSword(),"",module->Name(),source);
 
 			if (success >= 0)
 			{
@@ -839,7 +839,7 @@
 			if (item->next == NULL || item->next->type == sbItem::TYPE_MODULE_INSTALLER_REPO)
 			{
 				sword::StringList sl;
-				std::map<sword::SWModule *,int> diff = Core->installMgr.getModuleStatus(*Core->getSword(),*source->getMgr());
+				std::map<sword::SWModule *,int> diff = Core->getInstallMgr()->getModuleStatus(*Core->getSword(),*source->getMgr());
 				sbItem * lastItem = item;
 
 				for (std::map<sword::SWModule *,int>::iterator it = diff.begin(); it != diff.end(); it++)
@@ -898,7 +898,7 @@
 
 	case sbItem::TYPE_OPEN_MODULE_INSTALLER:
 		{
-			if (!Core->installMgr.isUserDisclaimerConfirmed())
+			if (!Core->getInstallMgr()->isUserDisclaimerConfirmed())
 				Core->switchList(sbList::TYPE_MODULE_INSTALLER_DISCLAIMER);
 			else
 				Core->switchList(sbList::TYPE_MODULE_INSTALLER);
@@ -1059,8 +1059,8 @@
 	{
 		sbAssert (itemMenu != NULL);
 
-		itemMenu = new sbItem (sbItem::DO_SEARCH_RANGE_START,L"Search from",rect.width()/2,item->index);
-		itemMenu->attach(new sbItem (sbItem::DO_SEARCH_RANGE_END,L"Search to",rect.width()/2,item->index),DIRECTION_NEXT);
+		itemMenu = new sbItem (sbItem::DO_SEARCH_RANGE_START,L"<s t=\"3\">Search from</s>",rect.width()/2,item->index);
+		itemMenu->attach(new sbItem (sbItem::DO_SEARCH_RANGE_END,L"<s t=\"3\">Search to</s>",rect.width()/2,item->index),DIRECTION_NEXT);
 
 		menuPosition = sbPoint (max(Theme->size/10,x-itemMenu->width),max(Theme->size/10,y-itemMenu->height-itemMenu->next->height));
 	}
@@ -1566,35 +1566,35 @@
 	case TYPE_MODULE_INSTALLER:
 		{
 			sbItem * tempItem;
-			bool refreshed = atoi((*Core->installMgr.installConf)["General"].getWithDefault("Refreshed","0"))  == 0 ? false : true;
+			bool refreshed = atoi((*Core->getInstallMgr()->installConf)["General"].getWithDefault("Refreshed","0"))  == 0 ? false : true;
 
 			clear();
 
 			sbWaitMode ( true );
 
 			int success;
-			if (!refreshed) success = Core->installMgr.refreshRemoteSourceConfiguration();
+			if (!refreshed) success = Core->getInstallMgr()->refreshRemoteSourceConfiguration();
 
 			if (success != 0) sbMessage ("Install Manager Refresh Sources : %i\n",success);
 
 			tempItem = itemCurrent = sbItem::create(sbItem::LOOK_SEPARATOR,L"Available repositories:",rect.width());
 			
-			for (sword::InstallSourceMap::iterator it = Core->installMgr.sources.begin(); it != Core->installMgr.sources.end(); it++)
+			for (sword::InstallSourceMap::iterator it = Core->getInstallMgr()->sources.begin(); it != Core->getInstallMgr()->sources.end(); it++)
 			{
 				_sntprintf(tempText,tempTextSize,L"<s a=\"c\" t=\"5\">%S</s>",(*it).second->caption);
 
 				tempItem->attach(sbItem::create(sbItem::TYPE_MODULE_INSTALLER_REPO,tempText,rect.width(),(long)(*it).second),DIRECTION_NEXT);
 				tempItem = tempItem->next;
 
-				if (!refreshed) Core->installMgr.refreshRemoteSource((*it).second);
+				if (!refreshed) Core->getInstallMgr()->refreshRemoteSource((*it).second);
 
-				Core->installMgr.getModuleStatus(*Core->getSword(),*(*it).second->getMgr());
+				Core->getInstallMgr()->getModuleStatus(*Core->getSword(),*(*it).second->getMgr());
 			}
 
 			sbWaitMode ( false );
 
-			if (Core->installMgr.sources.size() > 0)
-				(*Core->installMgr.installConf)["General"]["Refreshed"] = "1";
+			if (Core->getInstallMgr()->sources.size() > 0)
+				(*Core->getInstallMgr()->installConf)["General"]["Refreshed"] = "1";
 		}
 		break;
 
@@ -1704,7 +1704,7 @@
 			{
 				itemCurrent->attach (new sbItem (sbItem::DO_NONE, L"No modules Found!\n\nPlease download any Bible module from www.crosswire.org and put \"mods.d\" and \"modules\" folders into application folder.", rect.width()), DIRECTION_NEXT);
 				itemCurrent = itemCurrent->next;
-				itemCurrent->attach (new sbItem (sbItem::TYPE_OPEN_MODULE_INSTALLER,L"Install Modules ...", rect.width()),DIRECTION_NEXT);
+				itemCurrent->attach (new sbItem (sbItem::TYPE_OPEN_MODULE_INSTALLER,L"<s a=\"c\" t=\"3\">Install Modules ...</s>", rect.width()),DIRECTION_NEXT);
 				itemCurrent = itemCurrent->next;
 			}
 
@@ -1890,7 +1890,7 @@
 				}
 			}
 
-			tempItem = sbItem::create (sbItem::TYPE_OPEN_MODULE_INSTALLER, L" \n<s a=\"c\" t=\"3\">Install Modules ...</s>\n ", rect.width());
+			tempItem = sbItem::create (sbItem::TYPE_OPEN_MODULE_INSTALLER, L"<s a=\"c\" t=\"3\">Install Modules ...</s>", rect.width());
 
 			itemCurrent == NULL ? itemCurrent = tempItem : itemCurrent->attach(tempItem,DIRECTION_NEXT);
 

Modified: trunk/src/SlideBible/todo.txt
===================================================================
--- trunk/src/SlideBible/todo.txt	2010-06-02 19:01:34 UTC (rev 238)
+++ trunk/src/SlideBible/todo.txt	2010-06-04 20:49:39 UTC (rev 239)
@@ -18,14 +18,16 @@
 +	better enumeration of modules in module selection and module installer
 +	warning war - clean build log from warnings
 ================================================================================
-	create patch for ftplibt
++	module manager
++		raise connection
++	create patch for ftplibt
++	mods.d and modules creation if not exists
+	check vga click
 	ring sensor support
-	panel on sbItem
+	panel driven on sbItem
 	scrollbar
 		count list height, if listStartConstructed and listEndConstructed
 		proper method to scroll list
-	module manager
-		raise connection
 	module features
 		words of Christ in red
 		headings
@@ -45,6 +47,7 @@
 		scroll item (tooltip for example)
 	switch sword to utf8 locale, fix skipped languages (hu)
 	drawing of two long long long items on screen reduce fps, i thik i need to optimize draw system
+	automatic sbItem width, remove from constructor
 	
 	XNA port
 




More information about the sword-cvs mailing list