From c6877b531fb73d95db95e6f5c2145950268a82b9 Mon Sep 17 00:00:00 2001 From: luca Date: Wed, 8 Aug 2007 09:24:19 +0000 Subject: [PATCH] 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 --- setup/Setup.cpp | 78 +++++++++++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 31 deletions(-) diff --git a/setup/Setup.cpp b/setup/Setup.cpp index 3c27f2f6a..f7722031c 100755 --- a/setup/Setup.cpp +++ b/setup/Setup.cpp @@ -70,7 +70,7 @@ wxString GetDefaultDestination() return strDest; } -class RSDirCopier : public wxDirTraverser +class CampoDirCopier : public wxDirTraverser { wxString m_strSrc, m_strDst; @@ -83,12 +83,12 @@ public: 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; } -wxDirTraverseResult RSDirCopier::OnFile(const wxString& filename) +wxDirTraverseResult CampoDirCopier::OnFile(const wxString& filename) { wxFileName strSource(filename); strSource.MakeRelativeTo(m_strSrc); @@ -106,7 +106,7 @@ wxDirTraverseResult RSDirCopier::OnFile(const wxString& filename) 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); 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; m_strSrc = src; @@ -185,7 +185,8 @@ bool CreateDesktopIcon(const wxFileName& strExeFile) wxFileName strLnk(szDesktopPath, wxT("Campo.lnk")); // Save the link by calling IPersistFile::Save. wxString stringa = strLnk.GetFullPath(); - wchar_t buff[256]; + wchar_t buff[_MAX_PATH]; + memset(buff, 0, sizeof(buff)); wxConvLocal.MB2WC(buff, stringa, stringa.Len()); hres = ppf->Save(buff, true); ppf->Release(); @@ -236,6 +237,8 @@ class CampoWizard : public wxWizard wxString _strSrvAuth; //server authoriz bool _bInstUseDict; //installa/usa server diction wxString _strSrvDict; //server diction + + bool _bDesktopShortcut; //crea il link sul desktop protected: DECLARE_EVENT_TABLE(); @@ -275,6 +278,9 @@ public: void SetSrvDict(const wxString& strSrvDict); const wxString& GetSrvDict() const; + void SetDesktopShortcut(const bool bDesktopShortcut); + const bool GetDesktopShortcut() const; + CampoWizard(wxWindow* pParent); }; @@ -511,6 +517,7 @@ bool CampoWizardPage2::ForwardValidate() //setta alla pagina riassuntiva i valori della pagina attuale... 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!! } 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; } + +void CampoWizard::SetDesktopShortcut(const bool bDesktopShortcut) +{ + _bDesktopShortcut = bDesktopShortcut; +} + +const bool CampoWizard::GetDesktopShortcut() const +{ + return _bDesktopShortcut; +} //...fine litania metodi di passaggio valori tra le finestre @@ -1787,24 +1804,25 @@ CampoWizard::CampoWizard(wxWindow* pParent) GetPageAreaSizer()->Add(m_pPage[0]); } + /////////////////////////////////////////////////////////// -// RSFrame +// CampoFrame /////////////////////////////////////////////////////////// -class RSFrame : public wxFrame +class CampoFrame : public wxFrame { protected: DECLARE_EVENT_TABLE(); virtual void OnErase(wxEraseEvent& e); public: - RSFrame(); + CampoFrame(); }; -BEGIN_EVENT_TABLE(RSFrame, wxFrame) - EVT_ERASE_BACKGROUND(RSFrame::OnErase) +BEGIN_EVENT_TABLE(CampoFrame, wxFrame) + EVT_ERASE_BACKGROUND(CampoFrame::OnErase) END_EVENT_TABLE() -void RSFrame::OnErase(wxEraseEvent& e) +void CampoFrame::OnErase(wxEraseEvent& e) { //preparazione background wxDC& dc = *e.GetDC(); @@ -1842,19 +1860,19 @@ void RSFrame::OnErase(wxEraseEvent& e) dc.DrawText(strSetup, rect.GetRight()-w-k, rect.GetHeight()-h-k); } -RSFrame::RSFrame() +CampoFrame::CampoFrame() : wxFrame(NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0) { ShowFullScreen(true); } /////////////////////////////////////////////////////////// -// RSSetup +// CampoSetup /////////////////////////////////////////////////////////// - -class RSSetup : public wxApp +//classe principale, ovvero applicazione +class CampoSetup : public wxApp { - RSFrame* m_pMainFrame; + CampoFrame* m_pMainFrame; wxLocale m_locale; protected: @@ -1865,31 +1883,29 @@ public: virtual bool OnInit(); }; -IMPLEMENT_APP(RSSetup) +IMPLEMENT_APP(CampoSetup) -BEGIN_EVENT_TABLE(RSSetup, wxApp) +BEGIN_EVENT_TABLE(CampoSetup, wxApp) EVT_TIMER(883, OnTimer) END_EVENT_TABLE() -void RSSetup::OnTimer(wxTimerEvent& WXUNUSED(e)) +void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e)) { CampoWizard* pWizard = new CampoWizard(m_pMainFrame); + if (pWizard->Run()) { wxFileName strPath = argv[0]; strPath.SetCwd(); - const wxString strSrc = strPath.GetPath(); - 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 wxString& strDest = pWizard->GetPrgLocPath(); const wxFileName strExe(strDest, wxT("ba0.exe")); - if (pWizard->GetBool(401)) + const bool bDesktopShortcut = pWizard->GetDesktopShortcut(); + if (bDesktopShortcut) CreateDesktopIcon(strExe); - //if (pWizard->GetBool(402)) - // AssociateExtension(strExe, wxT(".rs1")); + //questo e' un esempio di associazione automatica di estensione file + //if (pWizard->GetBool(bAssocExtension)) + // AssociateExtension(strExe, wxT(".caz")); } pWizard->Destroy(); @@ -1897,12 +1913,12 @@ void RSSetup::OnTimer(wxTimerEvent& WXUNUSED(e)) m_pMainFrame->Destroy(); } -bool RSSetup::OnInit() +bool CampoSetup::OnInit() { wxInitAllImageHandlers(); m_locale.Init(); - m_pMainFrame = new RSFrame; + m_pMainFrame = new CampoFrame; SetTopWindow(m_pMainFrame); wxTimerEvent e(883);