[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : phil
Repository : xara
Revision : 1156
Date : Mon May 22 12:25:32 BST 2006
Changed paths:
M /Trunk/XaraLX/Kernel/menuops.cpp
M /Trunk/XaraLX/wxOil/camelot.cpp
M /Trunk/XaraLX/wxOil/camelot.h
M /Trunk/XaraLX/wxOil/menucmds.cpp
Help menu items now link to various URLs.
Diff:
Index: Trunk/XaraLX/Kernel/menuops.cpp
===================================================================
--- Trunk/XaraLX/Kernel/menuops.cpp (revision 1155)
+++ Trunk/XaraLX/Kernel/menuops.cpp (revision 1156)
@@ -578,39 +578,29 @@
String_256 strPathOfAnimationTemplate=GetDefaultAnimationTemplate().GetPath(FALSE);
String_256 strPathOfFile;
- TRACEUSER( "jlh92", _T("DefPath = %s, %s
"), PCTSTR(strPathOfDrawingTemplate),
- PCTSTR(strPathOfAnimationTemplate) );
-
- std::set<String_256> setSortFilename;
-
- while( FileUtil::FindNextFile( &strNameOfFile ) )
+ for (INT32 i=0; i<iNumberOfTemplate; i++)
{
- pathOfFile.SetFileNameAndType(strNameOfFile);
- strPathOfFile=pathOfFile.GetFileName(TRUE);
-
- if( 0 != strPathOfFile.CompareTo( strPathOfDrawingTemplate, FALSE ) &&
- 0 != strPathOfFile.CompareTo( strPathOfAnimationTemplate, FALSE ) )
+ do
{
- setSortFilename.insert( strPathOfFile );
- TRACEUSER( "jlh92", _T("Curr = %s
"), PCTSTR(strPathOfFile) );
+ if (!FileUtil::FindNextFile(&strNameOfFile))
+ {
+ //We failed to find a template. So remove this
+ //item from the menu.
+ FileUtil::StopFindingFiles();
+ // Don't allow any errors set while searching to propagate outside this scope
+ Error::ClearError();
+ return OpState(FALSE, FALSE, TRUE);
+ }
+
+ pathOfFile.SetFileNameAndType(strNameOfFile);
+ strPathOfFile=pathOfFile.GetPath(FALSE);
}
+ while (strPathOfFile.CompareTo(strPathOfDrawingTemplate, FALSE)==0 ||
+ strPathOfFile.CompareTo(strPathOfAnimationTemplate, FALSE)==0);
}
+
FileUtil::StopFindingFiles();
- if( iNumberOfTemplate >= setSortFilename.size() )
- {
- // Don't allow any errors set while searching to propagate outside this scope
- Error::ClearError();
- return OpState(FALSE, FALSE, TRUE);
- }
-
- std::set<String_256>::iterator iter = setSortFilename.begin();
- for( INT32 i = 1; i < iNumberOfTemplate; ++i, ++iter )
- { /*Do nothing!*/ }
-
- strNameOfFile = *iter;
- TRACEUSER( "jlh92", _T("Final(%d) = %s
"), iNumberOfTemplate, PCTSTR(strPathOfFile) );
-
//We've found a file. So strip the .xar from the name, as follows...
pathTemplates.SetFileNameAndType(strNameOfFile);
*UIDescription=pathTemplates.GetFileName(FALSE);
@@ -1211,7 +1201,7 @@
FileNewTemplateAction(7);
else if ((WhichOp->Token) == String(OPTOKEN_FILENEW_TEMPLATE8))
FileNewTemplateAction(8);
- else if ((WhichOp->Token) == String(OPTOKEN_FILENEW_TEMPLATE9))
+ else if ((WhichOp->Token) == String(OPTOKEN_FILENEW_TEMPLATE9))
FileNewTemplateAction(9);
else if ((WhichOp->Token) == String(OPTOKEN_FILENEW_TEMPLATE10))
FileNewTemplateAction(10);
@@ -1596,6 +1586,8 @@
// REGOP(HELP, DEMOS, HelpOps);
+PORTNOTE("Movies", "Removed link to demo movies until we have some worth linking to")
+#if 0
OpDescriptor* DemosOp = new OpDescriptor(
0,
_R(IDS_HELP_MOVIES),
@@ -1607,6 +1599,7 @@
0 );
ERRORIF(!DemosOp, _R(IDE_NOMORE_MEMORY), FALSE);
+#endif
//Webster_Ranbir_12 \96
#ifdef INC_WEB_MENU_ITEMS
Index: Trunk/XaraLX/wxOil/menucmds.cpp
===================================================================
--- Trunk/XaraLX/wxOil/menucmds.cpp (revision 1155)
+++ Trunk/XaraLX/wxOil/menucmds.cpp (revision 1156)
@@ -1364,33 +1364,8 @@
void HelpXaraForumAction()
{
-PORTNOTETRACE("other","HelpXaraPurchasePage - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
- // Opens the default Browser on XaraX's Forum Page
- String_256 lpURL(_R(IDS_URL_FORUM));
- HINSTANCE hChild = ShellExecute(HWND_DESKTOP, "open", (TCHAR*)lpURL, NULL, NULL, SW_SHOW);
-
- // If the function (ShellExecute()) fails, then an error value that is less than or equal to 32 is returned.
- if ((INT32)hChild <= THIRTY_TWO )
- {
- switch ( (INT32)hChild )
- {
- case ERROR_FILE_NOT_FOUND:
- case ERROR_PATH_NOT_FOUND:
- case SE_ERR_ACCESSDENIED:
- case SE_ERR_ASSOCINCOMPLETE:
- {
- InformError(_R(IDS_NO_WEB_UTILITY),_R(IDS_OK)/*,_R(IDS_HELP)*/);
- }
- break;
- default:
- {
- InformError(_R(IDS_NO_WEB_PAGE),_R(IDS_OK)/*,_R(IDS_HELP)*/);
- }
- break;
- }
- }
-#endif
+ wxString strURL = CamResource::GetText(_R(IDS_URL_FORUM));
+ CCamApp::LaunchWebBrowser(strURL);
}
@@ -1410,33 +1385,8 @@
void HelpWebsterHomePage()
{
-PORTNOTETRACE("other","HelpXaraPurchasePage - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
- // Opens the default Browser on Webster's Home Page
- String_256 lpURL(_R(IDS_URL_PRODUCT));
- HINSTANCE hChild = ShellExecute(HWND_DESKTOP, "open", (TCHAR*)lpURL, NULL, NULL ,SW_SHOW);
-
- // If the function (ShellExecute()) fails, then an error value that is less than or equal to 32 is returned.
- if ( (INT32)hChild <= THIRTY_TWO )
- {
- switch ( (INT32)hChild )
- {
- case ERROR_FILE_NOT_FOUND:
- case ERROR_PATH_NOT_FOUND:
- case SE_ERR_ACCESSDENIED:
- case SE_ERR_ASSOCINCOMPLETE:
- {
- InformError(_R(IDS_NO_WEB_UTILITY),_R(IDS_OK)/*,_R(IDS_HELP)*/);
- }
- break;
- default:
- {
- InformError(_R(IDS_NO_WEB_PAGE),_R(IDS_OK)/*,_R(IDS_HELP)*/);
- }
- break;
- }
- }
-#endif
+ wxString strURL = CamResource::GetText(_R(IDS_URL_PRODUCT));
+ CCamApp::LaunchWebBrowser(strURL);
}
/*********************************************************************************************************************
void HelpXaraHomePage()
@@ -1453,33 +1403,8 @@
***********************************************************************************************************************/
void HelpXaraHomePage()
{
-PORTNOTETRACE("other","HelpXaraPurchasePage - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
- // Opens the default Browser on Xara's Home Page
- String_256 lpURL(_R(IDS_URL_XARASITE));
- HINSTANCE hChild = ShellExecute(HWND_DESKTOP, "open", (TCHAR*)lpURL, NULL, NULL ,SW_SHOW);
-
- // If the function (ShellExecute()) fails, then an error value that is less than or equal to 32 is returned.
- if ( (INT32)hChild <= THIRTY_TWO )
- {
- switch ( (INT32)hChild )
- {
- case ERROR_FILE_NOT_FOUND:
- case ERROR_PATH_NOT_FOUND:
- case SE_ERR_ACCESSDENIED:
- case SE_ERR_ASSOCINCOMPLETE:
- {
- InformError(_R(IDS_NO_WEB_UTILITY),_R(IDS_OK)/*,_R(IDS_HELP)*/);
- }
- break;
- default:
- {
- InformError(_R(IDS_NO_WEB_PAGE),_R(IDS_OK)/*,_R(IDS_HELP)*/);
- }
- break;
- }
- }
-#endif
+ wxString strURL = CamResource::GetText(_R(IDS_URL_XARASITE));
+ CCamApp::LaunchWebBrowser(strURL);
}
//#endif //webster
@@ -1567,38 +1492,8 @@
************************************************************************************************************************/
void WebsterHelpPages()
{
-PORTNOTETRACE("other","HelpXaraPurchasePage - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
-// Old weblink way of opening browser onto hints and tips page - doesn't seem to work
-// // Opens the default Browser on Xara's Home Page
-// const String_256 cmd = TEXT(PRODUCT_WEBLINKEXENAME " hints/index.htm");
-// InvokeWeblink(cmd);
-
- // Opens the default Browser on Xara Xone we pages
- String_256 lpURL(_R(IDS_URL_TUTORIALS));
- HINSTANCE hChild = ShellExecute(HWND_DESKTOP, "open", (TCHAR*)lpURL, NULL, NULL ,SW_SHOW);
-
- // If the function (ShellExecute()) fails, then an error value that is less than or equal to 32 is returned.
- if ( (INT32)hChild <= THIRTY_TWO )
- {
- switch ( (INT32)hChild )
- {
- case ERROR_FILE_NOT_FOUND:
- case ERROR_PATH_NOT_FOUND:
- case SE_ERR_ACCESSDENIED:
- case SE_ERR_ASSOCINCOMPLETE:
- {
- InformError(_R(IDS_NO_WEB_UTILITY),_R(IDS_OK)/*,_R(IDS_HELP)*/);
- }
- break;
- default:
- {
- InformError(_R(IDS_NO_WEB_PAGE),_R(IDS_OK)/*,_R(IDS_HELP)*/);
- }
- break;
- }
- }
-#endif
+ wxString strURL = CamResource::GetText(_R(IDS_URL_TUTORIALS));
+ CCamApp::LaunchWebBrowser(strURL);
}
/*********************************************************************************************************************
@@ -1616,33 +1511,8 @@
***********************************************************************************************************************/
void HelpXaraPurchasePage()
{
-PORTNOTETRACE("other","HelpXaraPurchasePage - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
- // Opens the default Browser on Xara's Purchase Page
- String_256 lpURL(_R(IDS_URL_PURCHASE));
- HINSTANCE hChild = ShellExecute(HWND_DESKTOP, "open", (TCHAR*)lpURL, NULL, NULL ,SW_SHOW);
-
- // If the function (ShellExecute()) fails, then an error value that is less than or equal to 32 is returned.
- if ( (INT32)hChild <= THIRTY_TWO )
- {
- switch ( (INT32)hChild )
- {
- case ERROR_FILE_NOT_FOUND:
- case ERROR_PATH_NOT_FOUND:
- case SE_ERR_ACCESSDENIED:
- case SE_ERR_ASSOCINCOMPLETE:
- {
- InformError(_R(IDS_NO_WEB_UTILITY),_R(IDS_OK)/*,_R(IDS_HELP)*/);
- }
- break;
- default:
- {
- InformError(_R(IDS_NO_WEB_PAGE),_R(IDS_OK)/*,_R(IDS_HELP)*/);
- }
- break;
- }
- }
-#endif
+ wxString strURL = CamResource::GetText(_R(IDS_URL_PURCHASE));
+ CCamApp::LaunchWebBrowser(strURL);
}
@@ -1664,35 +1534,7 @@
BOOL InvokeWeblink(const String_256& command)
{
-PORTNOTETRACE("other","InvokeWeblink - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
- //TCHAR* pCmd = (TCHAR*)command;
- UINT32 Error = WinExec(command, SW_SHOW);
-
- // If the function (WebExec()) fails, then an error value that is less than or equal to 32 is returned.
- if ( Error <= THIRTY_TWO )
- {
- switch ( Error )
- {
- case ERROR_FILE_NOT_FOUND:
- case ERROR_PATH_NOT_FOUND:
- case SE_ERR_ACCESSDENIED:
- case SE_ERR_ASSOCINCOMPLETE:
- {
- InformError(_R(IDS_NO_WEB_UTILITY),_R(IDS_OK));
- }
- break;
- default:
- {
- InformError(_R(IDS_NO_WEB_PAGE),_R(IDS_OK));
- }
- break;
- }
-
- return FALSE;
- }
-#endif
-
+ CCamApp::LaunchWebBrowser(command);
return TRUE;
}
Index: Trunk/XaraLX/wxOil/camelot.h
===================================================================
--- Trunk/XaraLX/wxOil/camelot.h (revision 1155)
+++ Trunk/XaraLX/wxOil/camelot.h (revision 1156)
@@ -146,6 +146,8 @@
void OnFatalException();
+ static BOOL LaunchWebBrowser(const wxString& strUrl);
+
private:
INT32 RunFalseMainLoop();
@@ -160,7 +162,7 @@
wxTimer m_Timer;
private:
- BOOL LaunchHelpApp(const wxString& strAppName, wxString strCommand);
+ static BOOL LaunchBrowserApp(const wxString& strAppName, wxString strCommand);
static DialogManager m_DlgMgr; // The dialog manager handles all oily dialog functions
Index: Trunk/XaraLX/wxOil/camelot.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camelot.cpp (revision 1155)
+++ Trunk/XaraLX/wxOil/camelot.cpp (revision 1156)
@@ -1349,41 +1349,68 @@
strUrl.Prepend(_T("file://"));
}
+ LaunchWebBrowser(strUrl);
+
+}
+
+
+/********************************************************************************************
+
+> static BOOL CCamApp::LaunchWebBrowser(const wxString& strUrl)
+
+ Author: Phil_Martin (Xara Group Ltd) <camelotdev@xxxxxxxx>
+ Created: 22/May/2006
+ Inputs: -
+ Outputs: -
+ Returns: -
+ Purpose: Launch a web browser referring to a given URL
+
+********************************************************************************************/
+
+BOOL CCamApp::LaunchWebBrowser(const wxString& strUrl)
+{
// --------------------------------------------------------------------------------------
// Attempt to launch common browsers to cope with our rich, Javascripted, HTML help files
+ //
+ // There are long-winded reasons for doing it this way which were discussed on the
+ // dev@xxxxxxxxxxxxxx mailing list.
+ //
BOOL ok;
- ok = LaunchHelpApp(_T("viewhtml"), strUrl);
- if (ok) return;
+ ok = LaunchBrowserApp(_T("viewhtml"), strUrl);
+ if (ok) return ok;
- ok = LaunchHelpApp(_T("firefox"), strUrl);
- if (ok) return;
+ ok = LaunchBrowserApp(_T("firefox"), strUrl);
+ if (ok) return ok;
- ok = LaunchHelpApp(_T("mozilla"), strUrl);
- if (ok) return;
+ ok = LaunchBrowserApp(_T("mozilla"), strUrl);
+ if (ok) return ok;
- ok = LaunchHelpApp(_T("konqueror"), strUrl);
- if (ok) return;
+ ok = LaunchBrowserApp(_T("konqueror"), strUrl);
+ if (ok) return ok;
- ok = LaunchHelpApp(_T("gnome-www-default-browser"), strUrl);
- if (ok) return;
+ ok = LaunchBrowserApp(_T("gnome-www-default-browser"), strUrl);
+ if (ok) return ok;
- ok = LaunchHelpApp(_T("epiphany"), strUrl);
- if (ok) return;
+ ok = LaunchBrowserApp(_T("epiphany"), strUrl);
+ if (ok) return ok;
- ok = LaunchHelpApp(_T("opera"), strUrl);
- if (ok) return;
+ ok = LaunchBrowserApp(_T("opera"), strUrl);
+ if (ok) return ok;
- ok = LaunchHelpApp(_T("iexplore"), strUrl);
- if (ok) return;
+ ok = LaunchBrowserApp(_T("iexplore"), strUrl);
+ if (ok) return ok;
- ok = LaunchHelpApp(_T("safari"), strUrl);
- if (ok) return;
+ ok = LaunchBrowserApp(_T("safari"), strUrl);
+ if (ok) return ok;
- wxLaunchDefaultBrowser( strUrl );
+ ok = wxLaunchDefaultBrowser(strUrl);
+
+ return ok;
}
-BOOL CCamApp::LaunchHelpApp(const wxString& strAppName, wxString strCommand)
+
+BOOL CCamApp::LaunchBrowserApp(const wxString& strAppName, wxString strCommand)
{
strCommand.Prepend(_T(" "));
strCommand.Prepend(strAppName);
Xara