Esempio n. 1
0
// arguments need to remain int (instead of int32) since numbers are derived from TPL that uses int
void FLiveEditorWizardBase::ProcessMIDI( int Status, int Data1, int Data2, PmDeviceID DeviceID, struct FLiveEditorDeviceData &Data )
{
	//if we're restriced to a certain device, then discard information if the signal is not sent from that device
	if ( RestrictedToDeviceID != pmNoDevice && RestrictedToDeviceID != DeviceID )
	{
		return;
	}

	//sanity check. Should never == true
	if ( CurState < 0 )
	{
		if(FPlatformMisc::IsDebuggerPresent())
		{
			FPlatformMisc::DebugBreak();
		}
		return;
	}
	if ( !States.Contains(CurState) )
	{
		return;
	}

	if ( States[CurState]->ProcessMIDI( Status, Data1, Data2, Data ) )
	{
		if ( !bReadyToAdvance )
		{
			bReadyToAdvance = true;
			if ( IsOnLastStep() )
			{
				OnWizardFinished(Data);
			}
		}
	}
}
Esempio n. 2
0
void WeatherFaxWizard::OnWizardPageChanged( wxWizardEvent& event )
{
    if(event.GetPage() == m_pages[1]) {
        if(!event.GetDirection()) {
            /* if we backed up, convert the mapped coordinates back to the input */
            double x1, y1, mx1, my1;
            double x2, y2, mx2, my2;

            x1 = m_sCoord1X->GetValue(), y1 = m_sCoord1Y->GetValue();
            x2 = m_sCoord2X->GetValue(), y2 = m_sCoord2Y->GetValue();

            m_wfimg.MercatorToInput(x1, y1, mx1, my1);
            m_sCoord1XUnMapped->SetValue(round(mx1));
            m_sCoord1YUnMapped->SetValue(round(my1));

            m_wfimg.MercatorToInput(x2, y2, mx2, my2);
            m_sCoord2XUnMapped->SetValue(round(mx2));
            m_sCoord2YUnMapped->SetValue(round(my2));
    
            double coord1lat, coord1lon, coord2lat, coord2lon;
            m_tCoord1Lat->GetValue().ToDouble(&coord1lat);
            m_tCoord1Lon->GetValue().ToDouble(&coord1lon);
            m_tCoord2Lat->GetValue().ToDouble(&coord2lat);
            m_tCoord2Lon->GetValue().ToDouble(&coord2lon);
            WriteMappingLatLon(coord1lat, coord1lon, coord2lat, coord2lon);
        }

        SetUnMappedCoordRanges();
        UpdateMappingControls();

        m_rbCoord1UnMapped->SetValue(true);
        m_rbCoord2UnMapped->SetValue(false);
    } else if(event.GetPage() == m_pages[2]) {
        StoreMappingParams();
        /* invalidate mapped image */
        m_wfimg.m_mappedimg = wxNullImage;
        m_rbCoord1UnMapped->SetValue(true);
        m_rbCoord2UnMapped->SetValue(false);

        if(!ApplyMapping()) {
            wxMessageDialog w
                ( this, _("Failed to apply mapping\nCheck Mapping Correction Parameters"),
                  _("Mapping"), wxOK | wxICON_ERROR );
            w.ShowModal();
            ShowPage(m_pages[1], true);
        } else if(m_curCoords->mapping == WeatherFaxImageCoordinates::MERCATOR &&
                m_curCoords->mappingmultiplier == 1 &&
                  m_curCoords->mappingratio == 1) {
            wxWizardEvent dummy;
            OnWizardFinished( dummy );
            if(IsModal())
                EndModal(wxID_OK);
            else
                Hide();
        }
    }
}