Patch level :4.0 setup

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :link sul desktop


git-svn-id: svn://10.65.10.50/trunk@15548 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2007-08-08 09:24:19 +00:00
parent ff8442f5ce
commit c6877b531f

View File

@ -70,7 +70,7 @@ wxString GetDefaultDestination()
return strDest; return strDest;
} }
class RSDirCopier : public wxDirTraverser class CampoDirCopier : public wxDirTraverser
{ {
wxString m_strSrc, m_strDst; wxString m_strSrc, m_strDst;
@ -83,12 +83,12 @@ public:
bool Copy(const wxString& src, const wxString& dst, bool bOpenGL); bool Copy(const wxString& src, const wxString& dst, bool bOpenGL);
}; };
wxDirTraverseResult RSDirCopier::OnDir(const wxString& dirname) wxDirTraverseResult CampoDirCopier::OnDir(const wxString& dirname)
{ {
return wxDIR_CONTINUE; return wxDIR_CONTINUE;
} }
wxDirTraverseResult RSDirCopier::OnFile(const wxString& filename) wxDirTraverseResult CampoDirCopier::OnFile(const wxString& filename)
{ {
wxFileName strSource(filename); wxFileName strSource(filename);
strSource.MakeRelativeTo(m_strSrc); strSource.MakeRelativeTo(m_strSrc);
@ -106,7 +106,7 @@ wxDirTraverseResult RSDirCopier::OnFile(const wxString& filename)
return wxDIR_CONTINUE; return wxDIR_CONTINUE;
} }
void RSDirCopier::RenameDLL(const wxString& strDLL, bool bOpenGL) const void CampoDirCopier::RenameDLL(const wxString& strDLL, bool bOpenGL) const
{ {
wxFileName file1(m_strDst, strDLL); wxFileName file1(m_strDst, strDLL);
file1.SetExt(bOpenGL ? wxT("dll") : wxT("old")); file1.SetExt(bOpenGL ? wxT("dll") : wxT("old"));
@ -119,7 +119,7 @@ void RSDirCopier::RenameDLL(const wxString& strDLL, bool bOpenGL) const
} }
} }
bool RSDirCopier::Copy(const wxString& src, const wxString& dst, bool bOpenGL) bool CampoDirCopier::Copy(const wxString& src, const wxString& dst, bool bOpenGL)
{ {
wxBusyCursor hourglass; wxBusyCursor hourglass;
m_strSrc = src; m_strSrc = src;
@ -185,7 +185,8 @@ bool CreateDesktopIcon(const wxFileName& strExeFile)
wxFileName strLnk(szDesktopPath, wxT("Campo.lnk")); wxFileName strLnk(szDesktopPath, wxT("Campo.lnk"));
// Save the link by calling IPersistFile::Save. // Save the link by calling IPersistFile::Save.
wxString stringa = strLnk.GetFullPath(); wxString stringa = strLnk.GetFullPath();
wchar_t buff[256]; wchar_t buff[_MAX_PATH];
memset(buff, 0, sizeof(buff));
wxConvLocal.MB2WC(buff, stringa, stringa.Len()); wxConvLocal.MB2WC(buff, stringa, stringa.Len());
hres = ppf->Save(buff, true); hres = ppf->Save(buff, true);
ppf->Release(); ppf->Release();
@ -236,6 +237,8 @@ class CampoWizard : public wxWizard
wxString _strSrvAuth; //server authoriz wxString _strSrvAuth; //server authoriz
bool _bInstUseDict; //installa/usa server diction bool _bInstUseDict; //installa/usa server diction
wxString _strSrvDict; //server diction wxString _strSrvDict; //server diction
bool _bDesktopShortcut; //crea il link sul desktop
protected: protected:
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
@ -275,6 +278,9 @@ public:
void SetSrvDict(const wxString& strSrvDict); void SetSrvDict(const wxString& strSrvDict);
const wxString& GetSrvDict() const; const wxString& GetSrvDict() const;
void SetDesktopShortcut(const bool bDesktopShortcut);
const bool GetDesktopShortcut() const;
CampoWizard(wxWindow* pParent); CampoWizard(wxWindow* pParent);
}; };
@ -511,6 +517,7 @@ bool CampoWizardPage2::ForwardValidate()
//setta alla pagina riassuntiva i valori della pagina attuale... //setta alla pagina riassuntiva i valori della pagina attuale...
GetWizard().SetDestinationPath(strPrgPath); //va alla pagina riassuntiva GetWizard().SetDestinationPath(strPrgPath); //va alla pagina riassuntiva
GetWizard().SetPrgLocPath(strPrgPath); //questo serve solo per la creazione del link sul desktop!
GetWizard().SetInstallationType(3); //e' un aggiornamento!! GetWizard().SetInstallationType(3); //e' un aggiornamento!!
} }
else //resetta il path in caso si scelga nuova installazione dopo aver scelto aggiornamento else //resetta il path in caso si scelga nuova installazione dopo aver scelto aggiornamento
@ -1752,6 +1759,16 @@ const bool CampoWizard::GetInstDemoData() const
{ {
return _bInstDemoData; return _bInstDemoData;
} }
void CampoWizard::SetDesktopShortcut(const bool bDesktopShortcut)
{
_bDesktopShortcut = bDesktopShortcut;
}
const bool CampoWizard::GetDesktopShortcut() const
{
return _bDesktopShortcut;
}
//...fine litania metodi di passaggio valori tra le finestre //...fine litania metodi di passaggio valori tra le finestre
@ -1787,24 +1804,25 @@ CampoWizard::CampoWizard(wxWindow* pParent)
GetPageAreaSizer()->Add(m_pPage[0]); GetPageAreaSizer()->Add(m_pPage[0]);
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// RSFrame // CampoFrame
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
class RSFrame : public wxFrame class CampoFrame : public wxFrame
{ {
protected: protected:
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
virtual void OnErase(wxEraseEvent& e); virtual void OnErase(wxEraseEvent& e);
public: public:
RSFrame(); CampoFrame();
}; };
BEGIN_EVENT_TABLE(RSFrame, wxFrame) BEGIN_EVENT_TABLE(CampoFrame, wxFrame)
EVT_ERASE_BACKGROUND(RSFrame::OnErase) EVT_ERASE_BACKGROUND(CampoFrame::OnErase)
END_EVENT_TABLE() END_EVENT_TABLE()
void RSFrame::OnErase(wxEraseEvent& e) void CampoFrame::OnErase(wxEraseEvent& e)
{ {
//preparazione background //preparazione background
wxDC& dc = *e.GetDC(); wxDC& dc = *e.GetDC();
@ -1842,19 +1860,19 @@ void RSFrame::OnErase(wxEraseEvent& e)
dc.DrawText(strSetup, rect.GetRight()-w-k, rect.GetHeight()-h-k); dc.DrawText(strSetup, rect.GetRight()-w-k, rect.GetHeight()-h-k);
} }
RSFrame::RSFrame() CampoFrame::CampoFrame()
: wxFrame(NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0) : wxFrame(NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0)
{ {
ShowFullScreen(true); ShowFullScreen(true);
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// RSSetup // CampoSetup
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
//classe principale, ovvero applicazione
class RSSetup : public wxApp class CampoSetup : public wxApp
{ {
RSFrame* m_pMainFrame; CampoFrame* m_pMainFrame;
wxLocale m_locale; wxLocale m_locale;
protected: protected:
@ -1865,31 +1883,29 @@ public:
virtual bool OnInit(); virtual bool OnInit();
}; };
IMPLEMENT_APP(RSSetup) IMPLEMENT_APP(CampoSetup)
BEGIN_EVENT_TABLE(RSSetup, wxApp) BEGIN_EVENT_TABLE(CampoSetup, wxApp)
EVT_TIMER(883, OnTimer) EVT_TIMER(883, OnTimer)
END_EVENT_TABLE() END_EVENT_TABLE()
void RSSetup::OnTimer(wxTimerEvent& WXUNUSED(e)) void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e))
{ {
CampoWizard* pWizard = new CampoWizard(m_pMainFrame); CampoWizard* pWizard = new CampoWizard(m_pMainFrame);
if (pWizard->Run()) if (pWizard->Run())
{ {
wxFileName strPath = argv[0]; wxFileName strPath = argv[0];
strPath.SetCwd(); strPath.SetCwd();
const wxString strSrc = strPath.GetPath(); const wxString& strDest = pWizard->GetPrgLocPath();
const wxString strDest = pWizard->Get(201); //*****SONO QUA!***// dare il percorso valido di installazione
const bool bOpenGL = pWizard->GetSelection(301)==0;
RSDirCopier dc;
dc.Copy(strSrc, strDest, bOpenGL);
const wxFileName strExe(strDest, wxT("ba0.exe")); const wxFileName strExe(strDest, wxT("ba0.exe"));
if (pWizard->GetBool(401)) const bool bDesktopShortcut = pWizard->GetDesktopShortcut();
if (bDesktopShortcut)
CreateDesktopIcon(strExe); CreateDesktopIcon(strExe);
//if (pWizard->GetBool(402)) //questo e' un esempio di associazione automatica di estensione file
// AssociateExtension(strExe, wxT(".rs1")); //if (pWizard->GetBool(bAssocExtension))
// AssociateExtension(strExe, wxT(".caz"));
} }
pWizard->Destroy(); pWizard->Destroy();
@ -1897,12 +1913,12 @@ void RSSetup::OnTimer(wxTimerEvent& WXUNUSED(e))
m_pMainFrame->Destroy(); m_pMainFrame->Destroy();
} }
bool RSSetup::OnInit() bool CampoSetup::OnInit()
{ {
wxInitAllImageHandlers(); wxInitAllImageHandlers();
m_locale.Init(); m_locale.Init();
m_pMainFrame = new RSFrame; m_pMainFrame = new CampoFrame;
SetTopWindow(m_pMainFrame); SetTopWindow(m_pMainFrame);
wxTimerEvent e(883); wxTimerEvent e(883);