예제 #1
0
//------------------------------------------------------------------------------
void WizCompilerPanel::OnPageChanging(wxWizardEvent& event)
{
    if (event.GetDirection() != 0) // !=0 forward, ==0 backward
    {
        if (GetCompilerID().IsEmpty())
        {
            cbMessageBox(_("You must select a compiler for your project..."), _("Error"), wxICON_ERROR, GetParent());
            event.Veto();
            return;
        }
        if (m_AllowConfigChange && !GetWantDebug() && !GetWantRelease())
        {
            cbMessageBox(_("You must select at least one configuration..."), _("Error"), wxICON_ERROR, GetParent());
            event.Veto();
            return;
        }

        if (m_AllowConfigChange)
        {
            ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("scripts"));

            cfg->Write(_T("/generic_wizard/want_debug"), (bool)GetWantDebug());
            cfg->Write(_T("/generic_wizard/debug_name"), GetDebugName());
            cfg->Write(_T("/generic_wizard/debug_output"), GetDebugOutputDir());
            cfg->Write(_T("/generic_wizard/debug_objects_output"), GetDebugObjectOutputDir());

            cfg->Write(_T("/generic_wizard/want_release"), (bool)GetWantRelease());
            cfg->Write(_T("/generic_wizard/release_name"), GetReleaseName());
            cfg->Write(_T("/generic_wizard/release_output"), GetReleaseOutputDir());
            cfg->Write(_T("/generic_wizard/release_objects_output"), GetReleaseObjectOutputDir());
        }
    }
    WizPageBase::OnPageChanging(event); // let the base class handle it too
}
예제 #2
0
void MyWizard::OnPageChanging(wxWizardEvent &event)
{
	wxWizardPage *wp=event.GetPage();
	EnterLeavePage *elp=dynamic_cast<EnterLeavePage*>(wp);
	if (elp)
	{
		if (event.GetDirection())
		{
			//forward
			bool b=elp->OnLeave(true);
			if (!b) {event.Veto();return;}
			wxWizardPage *nwp=wp->GetNext();
			EnterLeavePage *nelp=dynamic_cast<EnterLeavePage*>(nwp);
			if (nelp)
			{
				bool b=nelp->OnEnter(true);
				if (!b) event.Veto();
			}
		}
		else
		{
			//backward
			bool b=elp->OnLeave(false);
			if (!b) {event.Veto();return;}
			wxWizardPage *nwp=wp->GetPrev();
			EnterLeavePage *nelp=dynamic_cast<EnterLeavePage*>(nwp);
			if (nelp)
			{
				bool b=nelp->OnEnter(false);
				if (!b) event.Veto();
			}
		}
	}
}
예제 #3
0
void CUpdateWizard::OnPageChanging(wxWizardEvent& event)
{
	if (m_skipPageChanging)
		return;
	m_skipPageChanging = true;

	if (event.GetPage() == m_pages[0])
	{
		event.Veto();

		PrepareUpdateCheckPage();
		StartUpdateCheck();
	}
	if (event.GetPage() == m_pages[1] && m_pages[1]->GetNext())
	{
		if (!SetLocalFile())
		{
			event.Veto();
			m_skipPageChanging = false;
			return;
		}
	}

	m_skipPageChanging = false;
}
예제 #4
0
void FirstTimeWizard::OnPageChanging( wxWizardEvent& evt )
{
	if( evt.GetPage() == NULL ) return;		// safety valve!

	sptr page = (sptr)evt.GetPage()->GetClientData();

	if( evt.GetDirection() )
	{
		// Moving forward:
		//   Apply settings from the current page...

		if( page >= 0 )
		{
			if( ApplicableWizardPage* page = wxDynamicCast( GetCurrentPage(), ApplicableWizardPage ) )
			{
				if( !page->PrepForApply() || !page->GetApplyState().ApplyAll() )
				{
					evt.Veto();
					return;
				}
			}
		}

		if( page == 0 )
		{
			if( wxFile::Exists(GetUiSettingsFilename()) || wxFile::Exists(GetVmSettingsFilename()) )
			{
				// Asks the user if they want to import or overwrite the existing settings.

				Dialogs::ImportSettingsDialog modal( this );
				if( modal.ShowModal() != wxID_OK )
				{
					evt.Veto();
					return;
				}
			}
		}
	}
	else
	{
		// Moving Backward:
		//   Some specific panels need per-init actions canceled.

		if( page == 1 )
		{
			m_panel_PluginSel.CancelRefresh();
		}
	}
}
예제 #5
0
파일: canalconfobj.cpp 프로젝트: ajje/vscp
void WizardPageFlagsConfig::OnWizardPageChanging( wxWizardEvent& event )
{
    uint32_t mask = ( 1 << m_pItem->m_width ) - 1;
    mask = mask << m_pItem->m_pos;

    if ( event.GetDirection() ) {  // Forward

        if ( flagtype_value == m_pItem->m_type ) {
            wxString str = m_textField->GetValue();
            if ( !str.IsNumber() ) {
                event.Veto();
            }
            else {
                m_value = vscp_readStringValue( str );
                m_value = ( m_value << m_pItem->m_pos ) & mask;
            }
        }
        else if ( flagtype_choice == m_pItem->m_type ) {
            m_value = m_listBox->GetSelection();
            m_value = ( m_value << m_pItem->m_pos ) & mask;
        }
        else {  // Boolean
            m_value = ( m_boolChoice->GetValue() ? 1 : 0 );
            m_value = ( m_value << m_pItem->m_pos ) & mask;
        }

    }
    else { // Backward

    }
}
예제 #6
0
void SelGenSchemaPage::OnWizardPageChanging(wxWizardEvent &event)
{
	if(event.GetDirection() && m_allSchemas->GetSelection() == wxNOT_FOUND)
	{
		wxMessageBox(_("Please select an item to move to next step."), _("No choice made"), wxICON_WARNING | wxOK, this);
		event.Veto();
	}
	else if(event.GetDirection())
	{
		if(m_allSchemas->GetSelection() > 0)
		{
			wparent->OIDSelectedSchema = schemasHM[schemasNames[m_allSchemas->GetSelection()]];
			wparent->schemaName = schemasNames[m_allSchemas->GetSelection()];
			wxArrayString tables = ddImportDBUtils::getTablesNames(wparent->getConnection(), wparent->schemaName);
			wparent->getDesign()->unMarkSchemaOnAll();
			wparent->getDesign()->markSchemaOn(tables);
		}
		else
		{
			wparent->OIDSelectedSchema = -1;
			wparent->schemaName = _("");
		}
		wparent->page4->populateGrid();
	}
}
예제 #7
0
void SelGenTablesPage::OnWizardPageChanging(wxWizardEvent &event)
{
	if(event.GetDirection() && m_selTables->GetCount() <= 0)
	{
		wxMessageBox(_("Please select at least one table to move to next step."), _("No tables selected"), wxICON_WARNING | wxOK, this);
		event.Veto();
	}
}
예제 #8
0
void CStartDialog::OnExit(wxWizardEvent &event)
{
	int style = wxYES_NO;
	if( wxMessageBox( "Are you sure you want to exit?", "Confirmation", style ) == wxYES )
		EndModal( wxID_CANCEL );
	else
		event.Veto();
}
void ConnectWizard::OnNextPage( wxWizardEvent& event ) {
	dout << "> OnNextPage" << std::endl;
	if( event.GetDirection() ) {
		if( GetCurrentPage()==hostPage ) {
			wxIPV4address addr;
			if( directRadio->GetValue() && addr.Hostname( hostName->GetValue() )==false ) {
		        wxMessageBox(_T("Please enter a valid internet (IP v4) address for the hostname."), _T("Invalid hostname"),
							 wxICON_ERROR | wxOK, this);
				event.Veto();
				return;
			}
                
			if( addr.Service( port->GetValue() )==false ) {
				wxMessageBox(_T("Please enter a valid port number (between 1 and 65535)."), 
							 _T("Invalid port"),
							 wxICON_ERROR | wxOK, this);
				event.Veto();
				return;
			}
		} else
		if( GetCurrentPage()==sessionlistPage ) {
			d->setup.stopSearch();

			// session selected?
			int selected = sessions->GetSelection();
			if( selected==wxNOT_FOUND ) {
				wxMessageBox(_T("Please select the host you want to connect to."), 
							 _T("No host selected"),
							 wxICON_ERROR | wxOK, this);
				event.Veto();
				return;
			}

			// connect finally
			d->con = d->setup.connect( d->hosts[selected] );
			if( d->con.isNull() ) {
				wxMessageBox( _T(d->setup.errorMessage().c_str()),
							  _T("Connection error"),
							  wxICON_ERROR | wxOK, this);
				event.Veto();
				return;
			}
		}
	}	
	dout << "< OnNextPage" << std::endl;
}
예제 #10
0
void HostWizard::OnNextPage( wxWizardEvent& event ) {
    if( event.GetDirection() )
        if( GetCurrentPage()==sessionPage ) {
            if( sessionNameEdit->GetValue().Length()==0 ) {
                wxMessageBox(_T("Please enter a session name. Empty session names are not allowed."), _T("Invalid session name"),
                             wxICON_ERROR | wxOK, this);
                event.Veto();
            } else {

                long ret;
                if( !portEdit->GetValue().ToLong( &ret ) || ret<=0 || ret>65535 ) {
                    wxMessageBox(_T("Please enter a valid port number (between 1 and 65535)."), _T("Invalid port"),
                                 wxICON_ERROR | wxOK, this);
                    event.Veto();
                }
            }
        }
}
예제 #11
0
파일: canalconfobj.cpp 프로젝트: ajje/vscp
void WizardPageCanalConfig::OnWizardPageChanging( wxWizardEvent& event )
{
    if ( event.GetDirection() ) {  // Forward
        
        if ( type_choice == m_pItem->m_type ) {
            int sel = m_listBox->GetSelection();
            if ( -1 != sel ) {
                if ( !m_bOptional ) {
                    wxMessageBox(_("This value is not optional. Please select a value!"));
                    event.Veto();
                }
                else {
                    m_strValue = wxString::Format( _( "%d" ), sel );
                }
            }
        }
        else if ( type_boolean == m_pItem->m_type ) {
            m_strValue = ( m_boolChoice->GetValue() ? _( "true" ) : _("false") );
        }
        else if ( type_string == m_pItem->m_type ) {
            m_strValue = m_textField->GetValue();
        }
        else if ( type_int32 == m_pItem->m_type ) {
            m_strValue = m_textField->GetValue();
        }
        else if ( type_uint32 == m_pItem->m_type ) {
            m_strValue = m_textField->GetValue();
        }
        else if ( type_float == m_pItem->m_type ) {
            m_strValue = m_textField->GetValue();
        }
        else if ( type_isotime == m_pItem->m_type ) {
            m_strValue = m_textField->GetValue();
        }
        else if ( type_isodate == m_pItem->m_type ) {
            m_strValue = m_textField->GetValue();
        }
        else if ( type_isodatetime == m_pItem->m_type ) {
            m_strValue = m_textField->GetValue();
        }
        else if ( type_guid == m_pItem->m_type ) {
            m_strValue = m_textField->GetValue();
        }
        else if ( type_event == m_pItem->m_type ) {
        
        }
        else if ( type_filter == m_pItem->m_type ) {
        
        }
        else if ( type_mask == m_pItem->m_type ) {
        
        }
    }
    else { // Backward

    }
}
예제 #12
0
 // wizard event handlers
 void OnWizardCancel(wxWizardEvent& event)
 {
     if ( wxMessageBox(wxT("Do you really want to cancel?"), wxT("Question"),
                       wxICON_QUESTION | wxYES_NO, this) != wxYES )
     {
         // not confirmed
         event.Veto();
     }
 }
예제 #13
0
//------------------------------------------------------------------------------
void WizProjectPathPanel::OnPageChanging(wxWizardEvent& event)
{
    if (event.GetDirection() != 0) // !=0 forward, ==0 backward
    {
        wxString dir = m_pProjectPathPanel->GetPath();
        wxString name = m_pProjectPathPanel->GetName();
        wxString fullname = m_pProjectPathPanel->GetFullFileName();
        wxString title = m_pProjectPathPanel->GetTitle();
//        if (!wxDirExists(dir))
//        {
//            cbMessageBox(_("Please select a valid path to create your project..."), _("Error"), wxICON_ERROR, GetParent());
//            event.Veto();
//            return;
//        }
        if (title.IsEmpty())
        {
            cbMessageBox(_("Please select a title for your project..."), _("Error"), wxICON_ERROR, GetParent());
            event.Veto();
            return;
        }
        if (name.IsEmpty())
        {
            cbMessageBox(_("Please select a name for your project..."), _("Error"), wxICON_ERROR, GetParent());
            event.Veto();
            return;
        }
        if (wxFileExists(fullname))
        {
            if (cbMessageBox(_("A project with the same name already exists in the project folder.\n"
                        "Are you sure you want to use this directory (files may be OVERWRITTEN)?"),
                        _("Confirmation"),
                        wxICON_QUESTION | wxYES_NO, GetParent()) != wxID_YES)
            {
//                cbMessageBox(_("A project with the same name already exists in the project folder.\n"
//                            "Please select a different project name..."), _("Warning"), wxICON_WARNING, GetParent());
                event.Veto();
                return;
            }
        }
        Manager::Get()->GetProjectManager()->SetDefaultPath(dir);
    }
    WizPageBase::OnPageChanging(event); // let the base class handle it too
}
예제 #14
0
void PluginWizardPage1::OnValidate(wxWizardEvent &event)
{
	wxString name = GetName();
	name = name.Trim().Trim(false);

	//we dont accept empty plugin names
	if(name.IsEmpty()){
		wxMessageBox(_("Missing plugin name"), wxT("EmbeddedLite"), wxOK | wxICON_WARNING);
		event.Veto();
		return;
	}
	//a valid name must contains only
	//[A-Za-z_]
	if(name.find_first_not_of(wxT("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_")) != wxString::npos){
		wxMessageBox(_("Invalid characters in plugin name\nonly [A-Za-z_0-9] are allowed"), wxT("EmbeddedLite"), wxOK | wxICON_WARNING);
		event.Veto();
		return;
	}
	event.Skip();
}
예제 #15
0
void OyunWizardPage::OnWizardCancel(wxWizardEvent &event) {
  if (wxMessageBox(_("Closing this wizard will quit Oyun.\n\n"
                     "Are you sure you want to quit?"),
                   _("Quit"), wxICON_QUESTION | wxYES_NO, this) != wxYES) {
    // User decided to cancel
    event.Veto();
    return;
  }

  // Otherwise, let this go
  event.Skip();
}
예제 #16
0
//------------------------------------------------------------------------------
void WizBuildTargetPanel::OnPageChanging(wxWizardEvent& event)
{
    if (event.GetDirection() != 0) // !=0 forward, ==0 backward
    {
        if (m_pBuildTargetPanel->GetCompilerCombo()->IsShown() && GetCompilerID().IsEmpty())
        {
            cbMessageBox(_("You must select a compiler for your build target..."), _("Error"), wxICON_ERROR, GetParent());
            event.Veto();
            return;
        }

        cbProject* theproject = Manager::Get()->GetProjectManager()->GetActiveProject(); // can't fail; if no project, the wizard didn't even run
        if (theproject->GetBuildTarget(m_pBuildTargetPanel->GetTargetName()))
        {
            cbMessageBox(_("A build target with that name already exists in the active project..."), _("Error"), wxICON_ERROR, GetParent());
            event.Veto();
            return;
        }
    }
    WizPageBase::OnPageChanging(event); // let the base class handle it too
}
예제 #17
0
void NewProjectWizard::OnPageChanging(wxWizardEvent& event)
{
    if ( event.GetDirection() ) {
        // -------------------------------------------------------
        // Switching from the Templates page
        // -------------------------------------------------------
        if ( event.GetPage() == m_wizardPageTemplate ) {
            if ( !CheckProjectTemplate() ) {
                event.Veto();
                return;
            }

        } else if ( event.GetPage() == m_wizardPageDetails ) {
            if( !CheckProjectName() || !CheckProjectPath() ) {
                event.Veto();
                return;
            }
        }
    }
    event.Skip();
}
예제 #18
0
void ReportGridPage::OnWizardPageChanging(wxWizardEvent &event)
{
	if(!event.GetDirection())
	{
		//Reset tables after a warning
		int answer = wxMessageBox(_("Going back to \"Select schema\" page will reinitialize all selections.\nDo you want to continue?"), _("Going back?"), wxYES_NO | wxCANCEL, this);
		if (answer != wxYES)
		{
			event.Veto();
		}
	}
}
예제 #19
0
void PluginWizard::OnPageChanging(wxWizardEvent& event)
{
    if ( event.GetDirection() && event.GetPage() == m_pages.at(0)) {
        wxString pluginName = m_textCtrlName->GetValue();
        pluginName.Trim();
        if ( pluginName.IsEmpty() || !::IsValidCppIndetifier(pluginName) ) {
            ::wxMessageBox(_("Invalid plugin name"), "codelite");
            event.Veto();
            return;
        }
    } else if ( event.GetDirection() && event.GetPage() == m_pages.at(1)) {
        if ( !wxDir::Exists( m_dirPickerCodeliteDir->GetPath() ) ) {
            ::wxMessageBox(_("codelite folder does not exists"), "codelite");
            event.Veto();
            return;
        }

        if ( !wxDir::Exists( m_dirPickerPluginPath->GetPath() ) ) {
            ::wxMessageBox(_("The selected plugin folder does not exist"), "codelite");
            event.Veto();
            return;
        }
    }
}
void proxy_wizardpage::on_wizardpage_changing( wxWizardEvent& event )
{
    // If proxy wizardpage values are not valid...
    if ( ! is_proxy_valid() ) 
    {
            wxMessageDialog invalid_proxy_messagedialog ( this,
              _( "Your proxy server is invalid. It must begin with either http:// or https://" ),
              _( "Proxy invalid" ),
              wxOK | wxICON_INFORMATION );
            // ...then show the message dialog...
            invalid_proxy_messagedialog.ShowModal();
            // .. and veto the wizardpagechanging event from moving off this wizardpage.
            event.Veto();
            return;
    }
}
예제 #21
0
    void OnWizardPageChanging(wxWizardEvent& event)
    {
        int sel = m_radio->GetSelection();

        if ( sel == Both )
            return;

        if ( event.GetDirection() && sel == Forward )
            return;

        if ( !event.GetDirection() && sel == Backward )
            return;

        wxMessageBox(wxT("You can't go there"), wxT("Not allowed"),
                     wxICON_WARNING | wxOK, this);

        event.Veto();
    }
예제 #22
0
void WizPageBase::OnPageChanging(wxWizardEvent& event)
{
    Manager::Get()->GetConfigManager(_T("scripts"))->Write(_T("/generic_wizard/") + m_PageName + _T("/skip"), (bool)m_SkipPage);

    try
    {
        wxString sig = _T("OnLeave_") + m_PageName;
        SqPlus::SquirrelFunction<bool> cb(cbU2C(sig));
        if (cb.func.IsNull())
            return;
        bool allow = cb(event.GetDirection() != 0); // !=0 forward, ==0 backward
        if (!allow)
            event.Veto();
    }
    catch (SquirrelError& e)
    {
        Manager::Get()->GetScriptingManager()->DisplayErrors(&e);
    }
}
예제 #23
0
//------------------------------------------------------------------------------
void WizGenericSelectPathPanel::OnPageChanging(wxWizardEvent& event)
{
    if (event.GetDirection() != 0) // !=0 forward, ==0 backward
    {
        wxString dir = Manager::Get()->GetMacrosManager()->ReplaceMacros(m_pGenericSelectPath->txtFolder->GetValue());
        if (!wxDirExists(dir))
        {
            cbMessageBox(_("Please select a valid location..."), _("Error"), wxICON_ERROR, GetParent());
            event.Veto();
            return;
        }
    }
    WizPageBase::OnPageChanging(event); // let the base class handle it too

    if (event.GetDirection() != 0 && event.IsAllowed())
    {
        Manager::Get()->GetConfigManager(_T("project_wizard"))->Write(_T("/generic_paths/") + GetPageName(), m_pGenericSelectPath->txtFolder->GetValue());
    }
}
예제 #24
0
void WizFilePathPanel::OnPageChanging(wxWizardEvent& event)
{
    if (event.GetDirection() != 0) // !=0 forward, ==0 backward
    {
        m_Filename = m_pFilePathPanel->GetFilename();
        m_HeaderGuard = m_pFilePathPanel->GetHeaderGuard();
        m_AddToProject = m_pFilePathPanel->GetAddToProject();

        if (m_Filename.IsEmpty() || !wxDirExists(wxPathOnly(m_Filename)))
        {
            cbMessageBox(_("Please select a filename with full path for your new file..."), _("Error"), wxICON_ERROR, GetParent());
            event.Veto();
            return;
        }

        ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("scripts"));
        cfg->Write(_T("/generic_wizard/add_file_to_project"), (bool)m_pFilePathPanel->GetAddToProject());
    }
    WizPageBase::OnPageChanging(event); // let the base class handle it too
}
예제 #25
0
void DriveSelectPage::OnWizardPageChanging(wxWizardEvent& event)
{
	m_filename = m_drivebox->GetValue();
	m_type     = wxString((char *)m_typebox->GetClientData(m_typebox->GetSelection()), wxConvUTF8);
	m_compress = wxString((char *)m_compbox->GetClientData(m_compbox->GetSelection()), wxConvUTF8);
	if (m_pageType == PT_FORMAT)
		 m_format   = (dsk_format_t)(m_formbox->GetSelection());
	else m_format   = (dsk_format_t)(m_formbox->GetSelection() - 1);

	m_forceHead  = m_head->GetSelection() - 1;
	m_doubleStep = m_dstep->GetValue();

	if (m_filename.IsEmpty() && event.GetDirection())
	{
		wxMessageBox(_T("You have not entered a filename."), _T("Choose disc"),
             wxICON_WARNING | wxOK, this);

        event.Veto();
	}
}
예제 #26
0
void NewProjectWizard::OnFinish(wxWizardEvent& event)
{
    wxFileName fn(m_stxtFullFileName->GetLabel());

    // Ensure that the target folder exists
    fn.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);

    // make sure that there is no conflict in files between the template project and the selected path
    if(m_projectData.m_srcProject) {
        ProjectPtr p = m_projectData.m_srcProject;
        wxString base_dir(fn.GetPath());
        std::vector<wxFileName> files;
        p->GetFiles(files);

        for(size_t i = 0; i < files.size(); ++i) {
            wxFileName f = files.at(i);
            wxString new_file = base_dir + wxT("/") + f.GetFullName();

            if(wxFileName::FileExists(new_file)) {
                // this file already - notify the user
                wxString msg;
                msg << _("The File '") << f.GetFullName() << _("' already exists at the target directory '") << base_dir
                    << wxT("'\n");
                msg << _("Please select a different project path\n");
                msg << _("The file '") << f.GetFullName() << _("' is part of the template project [") << p->GetName()
                    << wxT("]");
                wxMessageBox(msg, _("CodeLite"), wxOK | wxICON_HAND);
                event.Veto();
                return;
            }
        }
    }

    m_projectData.m_name = m_txtProjName->GetValue();
    m_projectData.m_path = fn.GetPath();
    m_projectData.m_cmpType = m_choiceCompiler->GetStringSelection();
    m_projectData.m_debuggerType = m_choiceDebugger->GetStringSelection();
    m_projectData.m_builderName = m_choiceBuildSystem->GetStringSelection();
    event.Skip();
}
예제 #27
0
// Prevent leaving the page if either the source or target language
// names are left blank
void CLanguagesPage::OnWizardPageChanging(wxWizardEvent& event)
{
	// Can put any code that needs to execute regardless of whether
	// Next or Prev button was pushed here.

	// Determine which direction we're going and implement
	// the MFC equivalent of OnWizardNext() and OnWizardBack() here
	bool bMovingForward = event.GetDirection();

	// Notes: Any changes made to OnOK should also be made to 
	// OnWizardPageChanging below.
	// In DoStartWorkingWizard, CLanguagesPage::OnWizardPageChanging() 
	// is called.
	if (bMovingForward)
	{
		if (pSrcBox->GetValue().IsEmpty())
		{
			// IDS_NULL_SOURCE_NAME
			wxMessageBox(_("Sorry, the source language name cannot be left blank."), _T(""), wxICON_INFORMATION | wxOK);
			pSrcBox->SetFocus();
			event.Veto();
			return;
		}
		if (pTgtBox->GetValue().IsEmpty())
		{
			// IDS_NULL_TARGET_NAME
			wxMessageBox(_("Sorry, the target language name cannot be left blank."), _T(""), wxICON_INFORMATION | wxOK);
			pTgtBox->SetFocus();
			event.Veto();
			return;
		}

		gpApp->LogUserAction(_T("In LanguagesPage: Next selected"));
		// if we get here the source and language name edits have values
		// moving forward toward fontPage, assume user wants to
		// store the dialog's values.
		// put the source & target language names in storage on the App
		CAdapt_ItApp* pApp = (CAdapt_ItApp*)&wxGetApp();

		// Retrieve languages page member data from text controls and update the
		// App's values
		pApp->m_sourceName = pSrcBox->GetValue();
		pApp->m_targetName = pTgtBox->GetValue();
		// get any final edits of lang codes from edit boxes
		pApp->m_sourceLanguageCode = pSrcLangCodeBox->GetValue();
		pApp->m_targetLanguageCode = pTgtLangCodeBox->GetValue();
		//gSFescapechar = pSfmBox->GetValue().GetChar(0);
		// BEW 8Jun10, removed support for checkbox "Recognise standard format
		// markers only following newlines"
		//gbSfmOnlyAfterNewlines = pSfmOnlyAfterNLCheckBox->GetValue();
		
		// whm: The stuff below was in MFC's fontPage, but it should go here in the languagesPage.
		// set up the directories using the new names, plus a KB, for the new project
		// (all the error conditions abort (I think), so ignore returned value)
		// (since this is a new project, we don't need to worry here about making a backup KB, nor
		// need we do any integrity checking). However, in case the user moved back to the fonts page
		// after having used Next> (which would have created a stub knowledge base), we would have
		// the m_pKB member still non-null, so SetupDirectories() would fail. Hence if so, delete the
		// stub from memory & reset member of null, so the call will not fail.
		if (pApp->m_pKB != NULL || pApp->m_pGlossingKB != NULL)
		{
			UnloadKBs(pApp);
		}
		/*
		if (gpApp->m_pKB != NULL)
		{
			// we have moved back, so clear the stub etc.
			delete gpApp->m_pKB;
			gpApp->m_pKB = (CKB*)NULL;
		}
		if (gpApp->m_pGlossingKB != NULL) // whm added
		{
			// we have moved back, so clear the stub etc.
			delete gpApp->m_pGlossingKB;
			gpApp->m_pGlossingKB = (CKB*)NULL;
		}
		*/
		bool bDirectoriesOK;
		bDirectoriesOK = gpApp->SetupDirectories();  // also sets KB paths and loads KBs & Guesser
		// needs to succeed, so wxCHECK_RET() call should be used here
		if (!bDirectoriesOK)
			gpApp->LogUserAction(_T("In LanguagesPage SetupDirectories() failed"));
		wxCHECK_RET(bDirectoriesOK, _T("OnWizardPageChanging(): SetupDirectories() failed, line 367 in LanguagesPage.cpp, processing will continue & app may be in an unstable state. Save and shutdown would be wise."));
		// SetupDirectories does not set the CWD but does set m_curAdaptationsPath
		
		// have the name for the new project into the projectPage's listBox
		pProjectPage->m_pListBox->Append(gpApp->m_curProjectName);
		// stuff above was in MFC's fontPage

		// Movement through wizard pages is sequential - the next page is the fontPage.
		// The pFontPageWiz's InitDialog need to be called here just before going to it
		wxInitDialogEvent idevent;
		pFontPageWiz->InitDialog(idevent);
	}
	else
	{
		gpApp->LogUserAction(_T("In LanguagesPage: Back selected"));
		// moving backward toward projectPage, so we may need to
		// undo some values
		CAdapt_ItApp* pApp = (CAdapt_ItApp*)&wxGetApp();

		pApp->m_sourceName = tempSourceName;
		pApp->m_targetName = tempTargetName;
		// whm Note: The tempSourceLangCode and tempTargetLangCode temp variables
		// are not modified within the languagesPage wizard page. Therefore, we
		// can roll back the App's stored values to what they were before if the
		// user backs up from the languagesPage to the projectPage.
		pApp->m_sourceLanguageCode = tempSourceLangCode; // whm added 10May10
		pApp->m_targetLanguageCode = tempTargetLangCode; // whm added 10May10
	}
}
예제 #28
0
void NewProjectWizard::OnPageChanging(wxWizardEvent& event)
{
    if(event.GetDirection()) {
        wxDataViewItem sel = m_dataviewTemplates->GetSelection();
        NewProjectClientData* cd = dynamic_cast<NewProjectClientData*>(m_dataviewTemplatesModel->GetClientObject(sel));

        if(event.GetPage() == m_wizardPageTemplate) {
            // -------------------------------------------------------
            // Switching from the Templates page
            // -------------------------------------------------------
            if(!CheckProjectTemplate()) {
                event.Veto();
                return;
            }

            // Test to see if the selected project allows enabling the 'Create under separate folder'
            if(cd && !cd->IsCanUseSeparateFolder()) {
                m_cbSeparateDir->SetValue(false);
                m_cbSeparateDir->Enable(false);
            } else {
                m_cbSeparateDir->Enable(true);
            }

            m_txtProjName->SetFocus(); // This should have happened in the base-class ctor, but in practice it doesn't

        } else if(event.GetPage() == m_wizardPageDetails) {
            // -------------------------------------------------------
            // Switching from the Name/Path page
            // -------------------------------------------------------
            if(!CheckProjectName() || !CheckProjectPath()) {
                event.Veto();
                return;
            }
        } else if(event.GetPage() == m_wizardPageToolchain) {
            wxFileName fn(m_stxtFullFileName->GetLabel());

            // make sure that there is no conflict in files between the template project and the selected path
            if(m_projectData.m_srcProject) {
                ProjectPtr p = m_projectData.m_srcProject;
                wxString base_dir(fn.GetPath());
                std::vector<wxFileName> files;
                p->GetFiles(files);

                for(size_t i = 0; i < files.size(); ++i) {
                    wxFileName f = files.at(i);
                    wxString new_file = base_dir + wxT("/") + f.GetFullName();

                    if(wxFileName::FileExists(new_file)) {
                        // this file already - notify the user
                        wxString msg;
                        msg << _("The File '") << f.GetFullName() << _("' already exists at the target directory '")
                            << base_dir << wxT("'\n");
                        msg << _("Please select a different project path\n");
                        msg << _("The file '") << f.GetFullName() << _("' is part of the template project [")
                            << p->GetName() << wxT("]");
                        wxMessageBox(msg, _("CodeLite"), wxOK | wxICON_HAND);
                        event.Veto();
                        return;
                    }
                }
            }
        }

        // Try to offer a sensible toolchain/debugger combination as default
        if(!m_selectionMade) {
            wxString defaultDebugger;
            if(cd && cd->GetTemplate().Lower().Contains("php")) {
                for(size_t n = 0; n < m_choiceCompiler->GetCount(); ++n) {
                    if(m_choiceCompiler->GetString(n).Lower().Contains("php")) {
                        m_choiceCompiler->SetSelection(n);
                        break;
                    }
                }
                defaultDebugger = "XDebug";

            } else {
                // If it's not a PHP project we can't be sure of anything except we don't want php tools; so select the
                // first that isn't
                for(size_t n = 0; n < m_choiceCompiler->GetCount(); ++n) {
                    if(!m_choiceCompiler->GetString(n).Lower().Contains("php")) {
                        m_choiceCompiler->SetSelection(n);
                        break;
                    }
                }
#if defined(__WXMAC__)
                defaultDebugger = "LLDB Debugger";
#else
                defaultDebugger = "GNU gdb debugger";
#endif
            }

            int index = m_choiceDebugger->FindString(defaultDebugger);
            if(index != wxNOT_FOUND) {
                m_choiceDebugger->SetSelection(index);
            }
        }
    }
    event.Skip();
}
예제 #29
0
void NewProjectWizard::OnPageChanging(wxWizardEvent& event)
{
    if(event.GetDirection()) {
        wxDataViewItem sel = m_dataviewTemplates->GetSelection();
        NewProjectClientData* cd = dynamic_cast<NewProjectClientData*>(m_dataviewTemplatesModel->GetClientObject(sel));

        if(event.GetPage() == m_wizardPageTemplate) {
            // -------------------------------------------------------
            // Switching from the Templates page
            // -------------------------------------------------------
            if(!CheckProjectTemplate()) {
                event.Veto();
                return;
            }

            // Test to see if the selected project allows enabling the 'Create under separate folder'
            if(cd && !cd->IsCanUseSeparateFolder()) {
                m_cbSeparateDir->SetValue(false);
                m_cbSeparateDir->Enable(false);
            } else {
                m_cbSeparateDir->Enable(true);
            }

            m_txtProjName->SetFocus(); // This should have happened in the base-class ctor, but in practice it doesn't

        } else if(event.GetPage() == m_wizardPageDetails) {
            // -------------------------------------------------------
            // Switching from the Name/Path page
            // -------------------------------------------------------
            if(!CheckProjectName() || !CheckProjectPath()) {
                event.Veto();
                return;
            }
        } else if(event.GetPage() == m_wizardPageToolchain) {
            wxFileName fn(m_stxtFullFileName->GetLabel());

            // make sure that there is no conflict in files between the template project and the selected path
            if(m_projectData.m_srcProject) {
                ProjectPtr p = m_projectData.m_srcProject;
                wxString base_dir(fn.GetPath());
                std::vector<wxFileName> files;
                p->GetFiles(files);

                for(size_t i = 0; i < files.size(); ++i) {
                    wxFileName f = files.at(i);
                    wxString new_file = base_dir + wxT("/") + f.GetFullName();

                    if(wxFileName::FileExists(new_file)) {
                        // this file already - notify the user
                        wxString msg;
                        msg << _("The File '") << f.GetFullName() << _("' already exists at the target directory '")
                            << base_dir << wxT("'\n");
                        msg << _("Please select a different project path\n");
                        msg << _("The file '") << f.GetFullName() << _("' is part of the template project [")
                            << p->GetName() << wxT("]");
                        wxMessageBox(msg, _("CodeLite"), wxOK | wxICON_HAND);
                        event.Veto();
                        return;
                    }
                }
            }
        }
    }
    event.Skip();
}