示例#1
0
文件: osm_pi.cpp 项目: ktec/osm_pi
void osm_pi::SetColorScheme(PI_ColorScheme cs)
{
    if (NULL == m_pOsmDialog)
        return;

    DimeWindow(m_pOsmDialog);
}
示例#2
0
void aisradar_pi::SetColorScheme(PI_ColorScheme cs) {
    // Colours changed, pass the event on to the radarframe
    if ( m_pRadarFrame ) {
        m_pRadarFrame->SetColourScheme(cs);
        DimeWindow(m_pRadarFrame);
    }
}
ClimatologyDialog::ClimatologyDialog(wxWindow *parent, climatology_pi *ppi)
#ifndef __WXOSX__
    : ClimatologyDialogBase(parent),
#else
    : ClimatologyDialogBase(parent, wxID_ANY, _("Climatology Display Control"), wxDefaultPosition, wxDefaultSize, wxCAPTION|wxCLOSE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU|wxSTAY_ON_TOP),
#endif
    pPlugIn(ppi), pParent(parent)
{
#ifdef __OCPN__ANDROID__
    GetHandle()->setStyleSheet( qtStyleSheet);
#endif
    m_cfgdlg = new ClimatologyConfigDialog(this);

    Now();

    m_cursorlat = m_cursorlon = 0;

    {
#include "now.xpm"
    m_bpNow->SetBitmapLabel(now);
    }
    DimeWindow( this );
    PopulateTrackingControls();

    // run fit delayed (buggy wxwidgets)
    m_fittimer.Connect(wxEVT_TIMER, wxTimerEventHandler
                       ( ClimatologyDialog::OnFitTimer ), NULL, this);
#ifdef __OCPN__ANDROID__ 
    GetHandle()->setAttribute(Qt::WA_AcceptTouchEvents);
    GetHandle()->grabGesture(Qt::PanGesture);
    GetHandle()->setStyleSheet( qtStyleSheet);
    Connect( wxEVT_QT_PANGESTURE,
                       (wxObjectEventFunction) (wxEventFunction) &ClimatologyDialog::OnEvtPanGesture, NULL, this );
#endif
}
示例#4
0
void route_pi::SetColorScheme(PI_ColorScheme cs)
{
      if (NULL == m_pDialog)
            return;

      DimeWindow(m_pDialog);
}
示例#5
0
ClimatologyConfigDialog::ClimatologyConfigDialog(ClimatologyDialog *parent)
  : ClimatologyConfigDialogBase(parent)
{
    pParent = parent;

#ifdef WIN32 // windows is too slow for very fine steps
    m_cIsoBarStep->Delete(4);
#endif

    m_Settings.Load();
    LoadSettings();
 
    for(int i=0; i<ClimatologyOverlaySettings::SETTINGS_COUNT; i++)
        m_cDataType->Append(SettingName(i));

    m_cDataType->SetSelection(m_lastdatatype);
    PopulateUnits(m_lastdatatype);
    ReadDataTypeSettings(m_lastdatatype);

    m_stVersion->SetLabel(wxString::Format(_T("%d.%d"),
                                           PLUGIN_VERSION_MAJOR, PLUGIN_VERSION_MINOR));
    m_tDataDirectory->SetValue(ClimatologyDataDirectory());

    m_refreshTimer.Connect(wxEVT_TIMER, wxTimerEventHandler( ClimatologyConfigDialog::OnRefreshTimer ), NULL, this);

    DimeWindow( this );
}
示例#6
0
void watchdog_pi::SetColorScheme(PI_ColorScheme cs)
{
    if (NULL == m_WatchdogDialog)
        return;

    DimeWindow(m_WatchdogDialog);
}
示例#7
0
void calculator_pi::SetColorScheme(PI_ColorScheme cs)
{
      if (NULL == m_pDialog)
            return;
#ifndef __WXOSX__
      DimeWindow(m_pDialog);
#endif
}
示例#8
0
bool RadarPanel::Create() {
  m_aui_mgr = GetFrameAuiManager();

  m_aui_name = wxString::Format(wxT("BR24radar_pi-%d"), m_ri->m_radar);
  wxAuiPaneInfo pane = wxAuiPaneInfo()
                           .Name(m_aui_name)
                           .Caption(m_ri->m_name)
                           .CaptionVisible(true)  // Show caption even when docked
                           .TopDockable(false)
                           .BottomDockable(false)
                           .RightDockable(true)
                           .LeftDockable(true)
                           .CloseButton(true)
                           .Gripper(false);

  m_sizer = new wxBoxSizer(wxHORIZONTAL);

  m_text = new wxStaticText(this, 0, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
  m_sizer->Add(m_text, 0, wxEXPAND | wxALL, 0);
  SetSizer(m_sizer);

  DimeWindow(this);
  Fit();
  Layout();
  // SetMinSize(GetBestSize());

  m_best_size = wxGetDisplaySize();
  m_best_size.x /= 2;
  m_best_size.y /= 2;

  pane.MinSize(256, 256);
  pane.BestSize(m_best_size);
  pane.FloatingSize(512, 512);
  pane.FloatingPosition(m_pi->m_settings.window_pos[m_ri->m_radar]);
  pane.Float();
  pane.dock_proportion = 100000;  // Secret sauce to get panels to use entire bar

  m_aui_mgr->AddPane(this, pane);
  m_aui_mgr->Update();
  m_aui_mgr->Connect(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(RadarPanel::close), NULL, this);

  m_dock_size = 0;

  if (m_pi->m_perspective[m_ri->m_radar].length()) {
    // Do this first and it doesn't work if the pane starts docked.
    LOG_DIALOG(wxT("BR24radar_pi: Restoring panel %s to AUI control manager: %s"), m_aui_name.c_str(),
               m_pi->m_perspective[m_ri->m_radar].c_str());
    m_aui_mgr->LoadPaneInfo(m_pi->m_perspective[m_ri->m_radar], pane);
    m_aui_mgr->Update();
  } else {
    LOG_DIALOG(wxT("BR24radar_pi: Added panel %s to AUI control manager"), m_aui_name.c_str());
  }

  return true;
}
示例#9
0
void calculator_pi::ShowPreferencesDialog( wxWindow* parent )
{
      CfgDlg *dialog = new CfgDlg( parent, wxID_ANY, _("Calculator Preferences"), wxPoint( m_calculator_dialog_x, m_calculator_dialog_y), wxDefaultSize, wxDEFAULT_DIALOG_STYLE );
      dialog->Fit();
      wxColour cl;
#ifndef __WXOSX__
      DimeWindow(dialog);
#endif
      dialog->m_sOpacity->SetValue(m_iOpacity);
      dialog->m_MaxResults->SetValue(m_iMaxResults);

      dialog->m_showhelpB->SetValue(m_bshowhelpB);
      dialog->m_showhistoryB->SetValue(m_bshowhistoryB);
      dialog->m_CalculateB->SetValue(m_bCalculateB);
      dialog->m_showfunction->SetValue(m_bshowFunction);
      dialog->m_showhistory->SetValue(m_bshowhistory);
      dialog->m_capturehidden->SetValue(m_bcapturehidden);
      dialog->m_logresults->SetValue(m_blogresults);

      //printf("Setting dialog value MaxResults %i \n",m_iMaxResults);

      if(dialog->ShowModal() == wxID_OK)
      {
            m_iOpacity = dialog->m_sOpacity->GetValue();
            m_iMaxResults = dialog->m_MaxResults->GetValue();
            m_bshowhelpB= dialog->m_showhelpB->GetValue();
            m_bshowhistoryB= dialog->m_showhistoryB->GetValue();
            m_bCalculateB= dialog->m_CalculateB->GetValue();
            m_bshowFunction= dialog->m_showfunction->GetValue();

            m_bshowhistory= dialog->m_showhistory->GetValue();
            m_bcapturehidden= dialog->m_capturehidden->GetValue();
            m_blogresults= dialog->m_logresults->GetValue();
            if (m_pDialog != NULL )
                this->SettingsPropagate(); //this will make a segfault if the plugin wasnt opened because the class doesn't exist yet.

/*
            printf("Just got Results from config window\n");
            printf("m_bshowhelpB: %s\n",(m_bshowhelpB)?"true":"false");
            printf("m_bshowhistoryB: %s\n",(m_bshowhistoryB)?"true":"false");
            printf("m_bCalculateB: %s\n",(m_bCalculateB)?"true":"false");
            printf("m_bshowhistory: %s\n",(m_bshowhistory)?"true":"false");
            printf("m_bcapturehidden: %s\n",(m_bcapturehidden)?"true":"false");
            printf("m_blogresults: %s\n",(m_blogresults)?"true":"false");
*/


            //printf("Just got MaxResults %i \n",m_MaxResults);
            SaveConfig();
      }
      delete dialog;
}
示例#10
0
void route_pi::ShowPreferencesDialog( wxWindow* parent )
{
      CfgDlg *dialog = new CfgDlg( parent, wxID_ANY, _("Route Preferences"), wxPoint( m_route_dialog_x, m_route_dialog_y), wxDefaultSize, wxDEFAULT_DIALOG_STYLE );
      dialog->Fit();
      wxColour cl;
      DimeWindow(dialog);
      dialog->m_sOpacity->SetValue(m_iOpacity);

      if(dialog->ShowModal() == wxID_OK)
      {
            m_iOpacity = dialog->m_sOpacity->GetValue();
            SaveConfig();
      }
      delete dialog;
}
示例#11
0
文件: osm_pi.cpp 项目: ktec/osm_pi
void osm_pi::ShowPreferencesDialog( wxWindow* parent )
{
    OsmCfgDlg *dialog = new OsmCfgDlg( parent, wxID_ANY, _("OSM Preferences"), 
        wxPoint( m_osm_dialog_x, m_osm_dialog_y), wxDefaultSize, wxDEFAULT_DIALOG_STYLE );
    dialog->Fit();
    wxColour cl;
    DimeWindow(dialog);
    //      dialog->m_tApi_url->SetValue(wxString::Format(wxT("%s"), m_sApi_url));

    if(dialog->ShowModal() == wxID_OK)
    {
    //            m_sApi_url = dialog->m_cpApi_url->GetUrl().GetAsString();
        SaveConfig();
    }

    delete dialog;
}
示例#12
0
//---------------------------------------------------------------------------------------
//               GRIB Cursor Data  implementation
//---------------------------------------------------------------------------------------
CursorData::CursorData( wxWindow *window, GRIBUICtrlBar &parent )
		: CursorDataBase(window),m_gparent(parent)
{

	//transform checkboxes ID to have a formal link to data type and set the initial value
    wxWindowListNode *node =  this->GetChildren().GetFirst();
    while( node ) {
        wxWindow *win = node->GetData();
        if( win->IsKindOf(CLASSINFO(wxCheckBox)) ) {
			int winId = ((wxCheckBox*) win )->GetId() - ID_CB_WIND;
			((wxCheckBox*) win )->SetId( winId );
			if (m_gparent.InDataPlot(winId))
                ((wxCheckBox*) win )->SetValue( m_gparent.m_bDataPlot[winId] );
		}
		node = node->GetNext();
	}

    m_bLeftDown = false;

    m_tCursorTrackTimer.Connect(wxEVT_TIMER, wxTimerEventHandler( CursorData::OnCursorTrackTimer ), NULL, this);

	DimeWindow( this );
}
示例#13
0
void GribRequestSetting::InitRequestConfig()
{
    wxFileConfig *pConf = GetOCPNConfigObject();

    if(pConf) {
        pConf->SetPath ( _T( "/PlugIns/GRIB" ) );
        wxString l;
        int m;
        pConf->Read ( _T( "MailRequestConfig" ), &m_RequestConfigBase, _T( "000220XX........0" ) );
        pConf->Read ( _T( "MailSenderAddress" ), &l, _T("") );
        m_pSenderAddress->ChangeValue( l );
        pConf->Read ( _T( "MailRequestAddresses" ), &m_MailToAddresses, _T("[email protected];[email protected]") );
        pConf->Read ( _T( "ZyGribLogin" ), &l, _T("") );
        m_pLogin->ChangeValue( l );
        pConf->Read ( _T( "ZyGribCode" ), &l, _T("") );
        m_pCode->ChangeValue( l );
        pConf->Read ( _T( "SendMailMethod" ), &m_SendMethod, 0 );
        pConf->Read ( _T( "MovingGribSpeed" ), &m, 0 );
        m_sMovingSpeed->SetValue( m );
        pConf->Read ( _T( "MovingGribCourse" ), &m, 0 );
        m_sMovingCourse->SetValue( m );
        m_cManualZoneSel->SetValue( m_SavedZoneSelMode != AUTO_SELECTION );      //has been read in GriUbICtrlBar dialog implementation or updated previously
        m_cUseSavedZone->SetValue( m_SavedZoneSelMode == SAVED_SELECTION );
        fgZoneCoordinatesSizer->ShowItems( m_SavedZoneSelMode != AUTO_SELECTION );
        m_cUseSavedZone->Show( m_SavedZoneSelMode != AUTO_SELECTION );
        if( m_cManualZoneSel->GetValue() ) {
            pConf->Read ( _T( "RequestZoneMaxLat" ), &m, 0 );
            m_spMaxLat->SetValue( m );
            pConf->Read ( _T( "RequestZoneMinLat" ), &m, 0 );
            m_spMinLat->SetValue( m );
            pConf->Read ( _T( "RequestZoneMaxLon" ), &m, 0 );
            m_spMaxLon->SetValue( m );
            pConf->Read ( _T( "RequestZoneMinLon" ), &m, 0 );
            m_spMinLon->SetValue( m );

            SetCoordinatesText();
        }
    //if GriDataConfig has been corrupted , take the standard one to fix a crash
    if( m_RequestConfigBase.Len() != wxString (_T( "000220XX.............." ) ).Len() )
        m_RequestConfigBase = _T( "000220XX.............." );
    }
    //populate model, mail to, waves model choices
    wxString s1[] = {_T("GFS"),_T("COAMPS"),_T("RTOFS")};
    for( unsigned int i= 0;  i<(sizeof(s1) / sizeof(wxString));i++)
        m_pModel->Append( s1[i] );
    wxString s2[] = {_T("Saildocs"),_T("zyGrib")};
    for( unsigned int i= 0;  i<(sizeof(s2) / sizeof(wxString));i++)
        m_pMailTo->Append( s2[i] );
    wxString s3[] = {_T("WW3-GLOBAL"),_T("WW3-MEDIT")};
    for( unsigned int i= 0;  i<(sizeof(s3) / sizeof(wxString));i++)
        m_pWModel->Append( s3[i] );
    m_rButtonYes->SetLabel(_("Send"));
    m_rButtonApply->SetLabel(_("Save"));
    m_tResUnit->SetLabel(wxString::Format( _T("\u00B0")));
    m_sCourseUnit->SetLabel(wxString::Format( _T("\u00B0")));

    //Set wxSpinCtrl sizing
    int w,h;
    GetTextExtent( _T("-360"), &w, &h, 0, 0, OCPNGetFont(_("Dialog"), 10)); // optimal text control size
    w += 30;
    h += 4;
    m_sMovingSpeed->SetMinSize( wxSize(w, h) );
    m_sMovingCourse->SetMinSize( wxSize(w, h) );
    m_spMaxLat->SetMinSize( wxSize(w, h) );
    m_spMinLat->SetMinSize( wxSize(w, h) );
    m_spMaxLon->SetMinSize( wxSize(w, h) );
    m_spMinLon->SetMinSize( wxSize(w, h) );

    //add tooltips
    m_pSenderAddress->SetToolTip(_("Address used to send request eMail. (Mandatory for LINUX)"));
    m_pLogin->SetToolTip(_("This is your zyGrib's forum access Login"));
    m_pCode->SetToolTip(_("Get this Code in zyGrib's forum ( This is not your password! )"));
    m_sMovingSpeed->SetToolTip(_("Enter your forescasted Speed (in Knots)"));
    m_sMovingCourse->SetToolTip(_("Enter your forecasted Course"));

    long i,j,k;
    ( (wxString) m_RequestConfigBase.GetChar(0) ).ToLong( &i );             //MailTo
    m_pMailTo->SetSelection(i);
    ( (wxString) m_RequestConfigBase.GetChar(1) ).ToLong( &i );             //Model
    m_pModel->SetSelection(i);
    m_cMovingGribEnabled->SetValue(m_RequestConfigBase.GetChar(16) == 'X' );//Moving Grib
    ( (wxString) m_RequestConfigBase.GetChar(2) ).ToLong( &i );             //Resolution
    ( (wxString) m_RequestConfigBase.GetChar(3) ).ToLong( &j );             //interval
    ( (wxString) m_RequestConfigBase.GetChar(4) ).ToLong( &k, 16 );         //Time Range
    k--;                                         // range max = 2 to 16 stored in hexa from 1 to f

#ifdef __WXMSW__                                 //show / hide sender elemants as necessary
    m_pSenderSizer->ShowItems(false);
#else
    if(m_SendMethod == 0 )
        m_pSenderSizer->ShowItems(false);
    else
        m_pSenderSizer->ShowItems(true);                //possibility to use "sendmail" method with Linux
#endif

    m_tMouseEventTimer.Connect(wxEVT_TIMER, wxTimerEventHandler( GribRequestSetting::OnMouseEventTimer ), NULL, this);

    m_RenderZoneOverlay = 0;

    ApplyRequestConfig( i, j ,k);

    ( (wxString) m_RequestConfigBase.GetChar(5) ).ToLong( &j );             //Waves model
    m_pWModel->SetSelection( j );

    m_pWind->Enable( false );                                               //always selected if available
    m_pPress->Enable( false );

    DimeWindow( this );                                                     //aplly global colours scheme

    m_AllowSend = true;
    m_MailImage->SetValue( WriteMail() );
}
void objsearch_pi::SetColorScheme ( PI_ColorScheme cs )
{
    DimeWindow ( m_pObjSearchDialog );
}
示例#15
0
GRIBUIDialog::GRIBUIDialog(wxWindow *parent, grib_pi *ppi)
: GRIBUIDialogBase(parent)
{
    pParent = parent;
    pPlugIn = ppi;

    m_bGRIBActiveFile = NULL;
    m_pTimelineSet = NULL;

    wxFileConfig *pConf = GetOCPNConfigObject();

    if(pConf) {
        pConf->SetPath ( _T ( "/Settings/GRIB" ) );

        bool value;
        pConf->Read( _T ( "WindPlot" ), &value, true );
        m_cbWind->SetValue(value);
        pConf->Read( _T ( "WindGustPlot" ), &value, true );
        m_cbWindGust->SetValue(value);
        pConf->Read( _T ( "PressurePlot" ), &value, true );
        m_cbPressure->SetValue(value);
        pConf->Read( _T ( "WavePlot" ), &value, false );
        m_cbWave->SetValue(value);
        pConf->Read( _T ( "CurrentPlot" ), &value, false );
        m_cbCurrent->SetValue(value);
        pConf->Read( _T ( "PrecipitationPlot" ), &value, false );
        m_cbPrecipitation->SetValue(value);
        pConf->Read( _T ( "CloudPlot" ), &value, false );
        m_cbCloud->SetValue(value);
        pConf->Read( _T ( "AirTemperaturePlot" ), &value, false );
        m_cbAirTemperature->SetValue(value);
        pConf->Read( _T ( "SeaTemperaturePlot" ), &value, false );
        m_cbSeaTemperature->SetValue(value);

        pConf->Read ( _T ( "lastdatatype" ), &m_lastdatatype, 0);

        pConf->Read ( _T ( "Filename" ), &m_file_name );

        wxStandardPaths spath;
        pConf->SetPath ( _T ( "/Directories" ) );
        pConf->Read ( _T ( "GRIBDirectory" ), &m_grib_dir, spath.GetDocumentsDir()  );
    }

#if !wxCHECK_VERSION(2,9,4) /* to work with wx 2.8 */
#define SetBitmap SetLabel
#endif

    m_bpPrev->SetBitmap(wxBitmap( prev ));
    m_bpNext->SetBitmap(wxBitmap( next ));
    m_bpNow->SetBitmap(wxBitmap( now ));
    m_bpOpenFile->SetBitmap(wxBitmap( openfile ));
    m_bpSettings->SetBitmap(wxBitmap( setting ));
    m_bpRequest->SetBitmap(wxBitmap( request ));

    m_tPlayStop.Connect(wxEVT_TIMER, wxTimerEventHandler( GRIBUIDialog::OnPlayStopTimer ), NULL, this);

    m_OverlaySettings.Read();

    DimeWindow( this );

    m_pTimelineSet = NULL;
    PopulateTrackingControls();

    Fit();
    SetMinSize( GetBestSize() );
}
示例#16
0
GribSettingsDialog::GribSettingsDialog(GRIBUICtrlBar &parent, GribOverlaySettings &Settings, int &lastdatatype, int fileIntervalIndex)
    : GribSettingsDialogBase(&parent),
      m_parent(parent), m_extSettings(Settings), m_lastdatatype(lastdatatype)
{
    m_Settings = m_extSettings;
    //populate interval choice
    m_sSlicesPerUpdate->Clear();
    for( int i=0; i < fileIntervalIndex + 1; i++){
        int mn = m_Settings.GetMinFromIndex(i);
        m_sSlicesPerUpdate->Append(wxString::Format(_T("%2d "), mn / 60) + _("h") + wxString::Format(_T(" %.2d "), mn % 60) + _("mn"));
    }
    //Set Bitmap
	m_biAltitude->SetBitmap(parent.GetScaledBitmap(wxBitmap(altitude), _T("altitude"), parent.m_ScaledFactor));
	m_biNow->SetBitmap(parent.GetScaledBitmap(wxBitmap(now), _T("now"), parent.m_ScaledFactor));
	m_biZoomToCenter->SetBitmap(parent.GetScaledBitmap(wxBitmap(zoomto), _T("zoomto"), parent.m_ScaledFactor));
	m_biShowCursorData->SetBitmap(parent.GetScaledBitmap(parent.m_CDataIsShown ? wxBitmap(curdata) : wxBitmap(ncurdata),
		parent.m_CDataIsShown ? _T("curdata") : _T("ncurdata"), parent.m_ScaledFactor));
	m_biPlay->SetBitmap(parent.GetScaledBitmap(wxBitmap(play), _T("play"), parent.m_ScaledFactor));
	m_biTimeSlider->SetBitmap(parent.GetScaledBitmap(wxBitmap(slider), _T("slider"), parent.m_ScaledFactor));
	m_biOpenFile->SetBitmap(parent.GetScaledBitmap(wxBitmap(openfile), _T("openfile"), parent.m_ScaledFactor));
	m_biSettings->SetBitmap(parent.GetScaledBitmap(wxBitmap(setting), _T("setting"), parent.m_ScaledFactor));
	m_biRequest->SetBitmap(parent.GetScaledBitmap(wxBitmap(request), _T("request"), parent.m_ScaledFactor));
	//read bookpage
	wxFileConfig *pConf = GetOCPNConfigObject();
     if(pConf) {
        pConf->SetPath ( _T ( "/Settings/GRIB" ) );
        pConf->Read( _T ( "GribSettingsBookPageIndex" ), &m_SetBookpageIndex, 0 );
	 }

    m_cInterpolate->SetValue(m_Settings.m_bInterpolate);
    m_cLoopMode->SetValue(m_Settings.m_bLoopMode);
    m_cLoopStartPoint->SetSelection(m_Settings.m_LoopStartPoint);
    m_sSlicesPerUpdate->SetSelection(m_Settings.m_SlicesPerUpdate);
    m_sUpdatesPerSecond->SetValue(m_Settings.m_UpdatesPerSecond);
    m_sTransparency->SetValue(100. - ((float) m_Settings.m_iOverlayTransparency * 100. / 254.));
    if(!m_cInterpolate->IsChecked() ) {              //eventually disable parameters
        m_tSlicesPerUpdate->Disable();
        m_sSlicesPerUpdate->Disable();
    }
    if( !m_cLoopMode->IsChecked() ) {
        m_staticText26->Disable();
        m_cLoopStartPoint->Disable();
    }

	m_rbCurDataAttaWCap->SetValue( m_Settings.m_iCtrlandDataStyle == 0 );
    m_rbCurDataAttaWoCap->SetValue( m_Settings.m_iCtrlandDataStyle == 1 );
	m_rbCurDataIsolHoriz->SetValue( m_Settings.m_iCtrlandDataStyle == 2 );
	m_rbCurDataIsolVertic->SetValue( m_Settings.m_iCtrlandDataStyle == 3 );

    for( unsigned int i = 0; i < (m_Settings.m_iCtrlBarCtrlVisible[0].Len() * 2) ; i += 2 ) {
        ((wxCheckBox*) FindWindow( i + AC0 ) )->SetValue( m_Settings.m_iCtrlBarCtrlVisible[0].GetChar(i / 2) == _T('X') );
        ((wxCheckBox*) FindWindow( i + 1 + AC0 ) )->SetValue( m_Settings.m_iCtrlBarCtrlVisible[1].GetChar(i / 2) == _T('X') );
    }

    m_cDataType->Clear();
    for(int i=0; i<GribOverlaySettings::SETTINGS_COUNT; i++)
        m_cDataType->Append( wxGetTranslation(tname_from_index[i]) );

    m_cDataType->SetSelection(m_lastdatatype);
    PopulateUnits(m_lastdatatype);
    ReadDataTypeSettings(m_lastdatatype);
    m_sButtonApply->SetLabel(_("Apply"));

    DimeWindow( this );                             //aplly global colours scheme

#ifdef __OCPN__ANDROID__
    GetHandle()->setStyleSheet( qtStyleSheet);
#endif

    Fit();
}
示例#17
0
void ocpndebugger_pi::SetColorScheme(PI_ColorScheme cs) {
    if (NULL == m_pOpenCPNDebuggerDialog) return;

    DimeWindow(m_pOpenCPNDebuggerDialog);
}
示例#18
0
void grib_pi::ShowPreferencesDialog( wxWindow* parent )
{
    GribPreferencesDialog *Pref = new GribPreferencesDialog(parent);

    DimeWindow( Pref );                                     //aplly global colours scheme
    SetDialogFont( Pref );                                  //Apply global font

    Pref->m_cbUseHiDef->SetValue(m_bGRIBUseHiDef);
    Pref->m_cbUseGradualColors->SetValue(m_bGRIBUseGradualColors);
    Pref->m_cbCopyFirstCumulativeRecord->SetValue(m_bCopyFirstCumRec);
    Pref->m_cbCopyMissingWaveRecord->SetValue(m_bCopyMissWaveRec);
    Pref->m_rbTimeFormat->SetSelection( m_bTimeZone );
    Pref->m_rbLoadOptions->SetSelection( m_bLoadLastOpenFile );
    Pref->m_rbStartOptions->SetSelection( m_bStartOptions );

     if( Pref->ShowModal() == wxID_OK ) {
         m_bGRIBUseHiDef= Pref->m_cbUseHiDef->GetValue();
         m_bGRIBUseGradualColors= Pref->m_cbUseGradualColors->GetValue();
         m_bLoadLastOpenFile= Pref->m_rbLoadOptions->GetSelection();
          if( m_pGRIBOverlayFactory )
              m_pGRIBOverlayFactory->SetSettings( m_bGRIBUseHiDef, m_bGRIBUseGradualColors );

         int updatelevel = 0;

         if( m_bStartOptions != Pref->m_rbStartOptions->GetSelection() ) {
             m_bStartOptions = Pref->m_rbStartOptions->GetSelection();
             updatelevel = 1;
         }

         if( m_bTimeZone != Pref->m_rbTimeFormat->GetSelection() ) {
             m_bTimeZone = Pref->m_rbTimeFormat->GetSelection();
             if( m_pGRIBOverlayFactory )
                m_pGRIBOverlayFactory->SetTimeZone( m_bTimeZone );
             updatelevel = 2;
         }

         bool copyrec = Pref->m_cbCopyFirstCumulativeRecord->GetValue();
         bool copywave = Pref->m_cbCopyMissingWaveRecord->GetValue();
         if( m_bCopyFirstCumRec != copyrec || m_bCopyMissWaveRec != copywave ) {
             m_bCopyFirstCumRec = copyrec;
             m_bCopyMissWaveRec = copywave;
             updatelevel = 3;
         }

         if(m_pGribCtrlBar ) {
             switch( updatelevel ) {
             case 0:
                 break;
             case 3:
                 //rebuild current activefile with new parameters and rebuil data list with current index
                 m_pGribCtrlBar->CreateActiveFileFromName( m_pGribCtrlBar->m_bGRIBActiveFile->GetFileName() );
                 m_pGribCtrlBar->PopulateComboDataList();
                 m_pGribCtrlBar->TimelineChanged();
                 break;
             case 2 :
                 //only rebuild  data list with current index and new timezone
                 m_pGribCtrlBar->PopulateComboDataList();
                 m_pGribCtrlBar->TimelineChanged();
                 break;
             case 1:
                 //only re-compute the best forecast
                 m_pGribCtrlBar->ComputeBestForecastForNow();
                 break;
             }
         }

         SaveConfig();
     }
}
bool BR24DisplayOptionsDialog::Create(wxWindow *parent, br24radar_pi *ppi)
{
    wxString m_temp;

    pParent = parent;
    pPlugIn = ppi;

    if (!wxDialog::Create(parent, wxID_ANY, _("BR24 Target Display Preferences"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)) {
        return false;
    }

    int font_size_y, font_descent, font_lead;
    GetTextExtent( _T("0"), NULL, &font_size_y, &font_descent, &font_lead );
    wxSize small_button_size( -1, (int) ( 1.4 * ( font_size_y + font_descent + font_lead ) ) );

    int border_size = 4;
    wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
    SetSizer(topSizer);

    wxFlexGridSizer * DisplayOptionsBox = new wxFlexGridSizer(2, 5, 5);
    topSizer->Add(DisplayOptionsBox, 0, wxALIGN_CENTER_HORIZONTAL | wxALL | wxEXPAND, 2);

    //  BR24 toolbox icon checkbox
    //    wxStaticBox* DisplayOptionsCheckBox = new wxStaticBox(this, wxID_ANY, _T(""));
    //    wxStaticBoxSizer* DisplayOptionsCheckBoxSizer = new wxStaticBoxSizer(DisplayOptionsCheckBox, wxVERTICAL);
    //    DisplayOptionsBox->Add(DisplayOptionsCheckBoxSizer, 0, wxEXPAND | wxALL, border_size);

    //  Range Units options

    wxString RangeModeStrings[] = {
        _("Nautical Miles"),
        _("Kilometers"),
    };

    pRangeUnits = new wxRadioBox(this, ID_RANGE_UNITS, _("Range Units"),
                                 wxDefaultPosition, wxDefaultSize,
                                 2, RangeModeStrings, 1, wxRA_SPECIFY_COLS);
    DisplayOptionsBox->Add(pRangeUnits, 0, wxALL | wxEXPAND, 2);

    pRangeUnits->Connect(wxEVT_COMMAND_RADIOBOX_SELECTED,
                         wxCommandEventHandler(BR24DisplayOptionsDialog::OnRangeUnitsClick), NULL, this);

    pRangeUnits->SetSelection(pPlugIn->settings.range_units);

    /// Option settings
    wxString Overlay_Display_Options[] = {
        _("Monocolor-Red"),
        _("Multi-color"),
        _("Multi-color 2"),
    };

    pOverlayDisplayOptions = new wxRadioBox(this, ID_OVERLAYDISPLAYOPTION, _("Overlay Display Options"),
                                            wxDefaultPosition, wxDefaultSize,
                                            3, Overlay_Display_Options, 1, wxRA_SPECIFY_COLS);

    DisplayOptionsBox->Add(pOverlayDisplayOptions, 0, wxALL | wxEXPAND, 2);

    pOverlayDisplayOptions->Connect(wxEVT_COMMAND_RADIOBOX_SELECTED,
                                    wxCommandEventHandler(BR24DisplayOptionsDialog::OnDisplayOptionClick), NULL, this);

    pOverlayDisplayOptions->SetSelection(pPlugIn->settings.display_option);

    /*
    pDisplayMode = new wxRadioBox(this, ID_DISPLAYTYPE, _("Radar Display"),
                                  wxDefaultPosition, wxDefaultSize,
                                  ARRAY_SIZE(DisplayModeStrings), DisplayModeStrings, 1, wxRA_SPECIFY_COLS);

    DisplayOptionsBox->Add(pDisplayMode, 0, wxALL | wxEXPAND, 2);

    pDisplayMode->Connect(wxEVT_COMMAND_RADIOBOX_SELECTED,
                          wxCommandEventHandler(BR24DisplayOptionsDialog::OnDisplayModeClick), NULL, this);

    pDisplayMode->SetSelection(pPlugIn->settings.display_mode[0]);
    */
    wxString GuardZoneStyleStrings[] = {
        _("Shading"),
        _("Outline"),
        _("Shading + Outline"),
    };
    pGuardZoneStyle = new wxRadioBox(this, ID_DISPLAYTYPE, _("Guard Zone Styling"),
                                     wxDefaultPosition, wxDefaultSize,
                                     3, GuardZoneStyleStrings, 1, wxRA_SPECIFY_COLS);

    DisplayOptionsBox->Add(pGuardZoneStyle, 0, wxALL | wxEXPAND, 2);
    pGuardZoneStyle->Connect(wxEVT_COMMAND_RADIOBOX_SELECTED,
                             wxCommandEventHandler(BR24DisplayOptionsDialog::OnGuardZoneStyleClick), NULL, this);
    pGuardZoneStyle->SetSelection(pPlugIn->settings.guard_zone_render_style);


    //  Calibration
    wxStaticBox* itemStaticBoxCalibration = new wxStaticBox(this, wxID_ANY, _("Calibration"));
    wxStaticBoxSizer* itemStaticBoxSizerCalibration = new wxStaticBoxSizer(itemStaticBoxCalibration, wxVERTICAL);
    DisplayOptionsBox->Add(itemStaticBoxSizerCalibration, 0, wxEXPAND | wxALL, border_size);

    // Heading correction
    wxStaticText *pStatic_Heading_Correction = new wxStaticText(this, wxID_ANY, _("Heading correction\n(-180 to +180)"));
    itemStaticBoxSizerCalibration->Add(pStatic_Heading_Correction, 1, wxALIGN_LEFT | wxALL, 2);

    pText_Heading_Correction_Value = new wxTextCtrl(this, wxID_ANY);
    itemStaticBoxSizerCalibration->Add(pText_Heading_Correction_Value, 1, wxALIGN_LEFT | wxALL, border_size);
    m_temp.Printf(wxT("%2.1f"), pPlugIn->settings.heading_correction);
    pText_Heading_Correction_Value->SetValue(m_temp);
    pText_Heading_Correction_Value->Connect(wxEVT_COMMAND_TEXT_UPDATED,
                                            wxCommandEventHandler(BR24DisplayOptionsDialog::OnHeading_Calibration_Value), NULL, this);

    // Guard Zone Alarm

    wxStaticBox* guardZoneBox = new wxStaticBox(this, wxID_ANY, _("Guard Zone Sound"));
    wxStaticBoxSizer* guardZoneSizer = new wxStaticBoxSizer(guardZoneBox, wxVERTICAL);
    DisplayOptionsBox->Add(guardZoneSizer, 0, wxEXPAND | wxALL, border_size);

    wxButton *pSelectSound = new wxButton(this, ID_SELECT_SOUND, _("Select Alert Sound"), wxDefaultPosition, small_button_size, 0);
    pSelectSound->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
                          wxCommandEventHandler(BR24DisplayOptionsDialog::OnSelectSoundClick), NULL, this);
    guardZoneSizer->Add(pSelectSound, 0, wxALL, border_size);

    wxButton *pTestSound = new wxButton(this, ID_TEST_SOUND, _("Test Alert Sound"), wxDefaultPosition, small_button_size, 0);
    pTestSound->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
                        wxCommandEventHandler(BR24DisplayOptionsDialog::OnTestSoundClick), NULL, this);
    guardZoneSizer->Add(pTestSound, 0, wxALL, border_size);

    //  Options
    wxStaticBox* itemStaticBoxOptions = new wxStaticBox(this, wxID_ANY, _("Options"));
    wxStaticBoxSizer* itemStaticBoxSizerOptions = new wxStaticBoxSizer(itemStaticBoxOptions, wxVERTICAL);
    topSizer->Add(itemStaticBoxSizerOptions, 0, wxEXPAND | wxALL, border_size);

    cbPassHeading = new wxCheckBox(this, ID_PASS_HEADING, _("Pass radar heading to OpenCPN"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE | wxST_NO_AUTORESIZE);
    itemStaticBoxSizerOptions->Add(cbPassHeading, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
    cbPassHeading->SetValue(pPlugIn->settings.passHeadingToOCPN ? true : false);
    cbPassHeading->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
                             wxCommandEventHandler(BR24DisplayOptionsDialog::OnPassHeadingClick), NULL, this);

    cbUseShader = new wxCheckBox(this, ID_USE_SHADER, _("Use GPU shader for rendering"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE | wxST_NO_AUTORESIZE);
    itemStaticBoxSizerOptions->Add(cbUseShader, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
    cbUseShader->SetValue(pPlugIn->settings.useShader);
    cbUseShader->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
                             wxCommandEventHandler(BR24DisplayOptionsDialog::OnUseShaderClick), NULL, this);

    cbEnableDualRadar = new wxCheckBox(this, ID_SELECT_AB, _("Enable dual radar, 4G only"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE | wxST_NO_AUTORESIZE);
    itemStaticBoxSizerOptions->Add(cbEnableDualRadar, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
    cbEnableDualRadar->SetValue(pPlugIn->settings.enable_dual_radar ? true : false);
    cbEnableDualRadar->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
        wxCommandEventHandler(BR24DisplayOptionsDialog::OnEnableDualRadarClick), NULL, this);

    cbEmulator = new wxCheckBox(this, ID_EMULATOR, _("Emulator mode"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE | wxST_NO_AUTORESIZE);
    itemStaticBoxSizerOptions->Add(cbEmulator, 0, wxALIGN_CENTER_VERTICAL | wxALL, border_size);
    cbEmulator->SetValue(pPlugIn->settings.emulator_on ? true : false);
    cbEmulator->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED,
        wxCommandEventHandler(BR24DisplayOptionsDialog::OnEmulatorClick), NULL, this);


    // Accept/Reject button
    wxStdDialogButtonSizer* DialogButtonSizer = wxDialog::CreateStdDialogButtonSizer(wxOK | wxCANCEL);
    topSizer->Add(DialogButtonSizer, 0, wxALIGN_RIGHT | wxALL, border_size);

    DimeWindow(this);

    Fit();
    SetMinSize(GetBestSize());

    return true;
}
示例#20
0
void RadarPanel::ShowFrame(bool visible) {
  LOG_DIALOG(wxT("BR24radar_pi %s: set visible %d"), m_ri->m_name.c_str(), visible);

  wxAuiPaneInfo& pane = m_aui_mgr->GetPane(this);

  if (!m_pi->m_opengl_mode && m_ri->m_radar_canvas) {
    m_sizer->Detach(m_ri->m_radar_canvas);
    delete m_ri->m_radar_canvas;
    m_ri->m_radar_canvas = 0;
    m_text->SetLabel(_("OpenGL mode required"));
    m_sizer->Show(m_text);
    DimeWindow(this);
    Fit();
    Layout();
  }
  if (visible) {
    if (m_pi->m_opengl_mode && !m_ri->m_radar_canvas) {
      LOG_DIALOG(wxT("BR24radar_pi %s: creating OpenGL canvas"), m_ri->m_name.c_str());
      m_ri->m_radar_canvas = new RadarCanvas(m_pi, m_ri, this, GetSize());
      if (!m_ri->m_radar_canvas) {
        m_text->SetLabel(_("Unable to create OpenGL canvas"));
        m_sizer->Show(m_text);
      } else {
        m_sizer->Hide(m_text);
        m_sizer->Add(m_ri->m_radar_canvas, 0, wxEXPAND | wxALL, 0);

        Fit();
        Layout();
      }
    }
  }

  if (visible) {
    m_pi->m_settings.show_radar[m_ri->m_radar] = 1;
    LOG_DIALOG(wxT("BR24radar_pi: RadarPanel::ShowFrame: show_radar[%d]=%d"), m_ri->m_radar, 1);
  }

  // What should have been a simple 'pane.Show(visible)' has devolved into a terrible hack.
  // When the entire dock row disappears because we're removing the last pane from it then the
  // next time we restore the dock gets its original size again. This is not want customers want.
  // So we store the size of the dock just before hiding the pane. This is done via parsing of the
  // perspective string, as there is no other way to access the dock information through wxAUI.

  if (!visible) {
    m_dock_size = 0;
    if (pane.IsDocked()) {
      m_dock = wxString::Format(wxT("|dock_size(%d,%d,%d)="), pane.dock_direction, pane.dock_layer, pane.dock_row);
      wxString perspective = m_aui_mgr->SavePerspective();

      int p = perspective.Find(m_dock);
      if (p != wxNOT_FOUND) {
        perspective = perspective.Mid(p + m_dock.length());
        perspective = perspective.BeforeFirst(wxT('|'));
        m_dock_size = wxAtoi(perspective);
        LOG_DIALOG(wxT("BR24radar_pi: %s: replaced=%s, saved dock_size = %d"), m_ri->m_name.c_str(), perspective.c_str(),
                   m_dock_size);
      }
    }
  } else {
    pane.Position(m_ri->m_radar);
  }

  pane.Show(visible);
  m_aui_mgr->Update();  // causes recursive calls on OS X when not in OpenGL mode

  if (visible && (m_dock_size > 0)) {
    // Now the reverse: take the new perspective string and replace the dock size of the dock that our pane is in and
    // reset it to the width it was before the hide.
    wxString perspective = m_aui_mgr->SavePerspective();

    int p = perspective.Find(m_dock);
    if (p != wxNOT_FOUND) {
      wxString newPerspective = perspective.Left(p);
      newPerspective << m_dock;
      newPerspective << m_dock_size;
      perspective = perspective.Mid(p + m_dock.length());
      newPerspective << wxT("|");
      newPerspective << perspective.AfterFirst(wxT('|'));

      m_aui_mgr->LoadPerspective(newPerspective);
      LOG_DIALOG(wxT("BR24radar_pi: %s: new perspective %s"), m_ri->m_name.c_str(), newPerspective.c_str());
    }
  }
}
示例#21
0
void climatology_pi::SetColorScheme(PI_ColorScheme cs)
{
    DimeWindow(m_pClimatologyDialog);
}
示例#22
0
//----------------------------------------------------------------------------------------------------------
//          GRIB Request Implementation
//----------------------------------------------------------------------------------------------------------
void GribRequestSetting::InitRequestConfig()
{
    DimeWindow( this );                             //aplly global colours scheme

    wxFileConfig *pConf = GetOCPNConfigObject();

    if(pConf) {
        pConf->SetPath ( _T( "/PlugIns/GRIB" ) );
    wxString l;
    int m;
    pConf->Read ( _T( "MailRequestConfig" ), &m_RequestConfigBase, _T( "000220XX........0" ) );
    pConf->Read ( _T( "MailSenderAddress" ), &l, _T("") );
    m_pSenderAddress->ChangeValue( l );
    pConf->Read ( _T( "MailRequestAddresses" ), &m_MailToAddresses, _T("[email protected];[email protected]") );
    pConf->Read ( _T( "ZyGribLogin" ), &l, _T("") );
    m_pLogin->ChangeValue( l );
    pConf->Read ( _T( "ZyGribCode" ), &l, _T("") );
    m_pCode->ChangeValue( l );
    pConf->Read ( _T( "SendMailMethod" ), &m_SendMethod, 0 );
    pConf->Read ( _T( "MovingGribSpeed" ), &m, 0 );
    m_sMovingSpeed->SetValue( m );
    pConf->Read ( _T( "MovingGribCourse" ), &m, 0 );
    m_sMovingCourse->SetValue( m );

    //if GriDataConfig has been corrupted , take the standard one to fix a crash
    if( m_RequestConfigBase.Len() != wxString (_T( "000220XX.............." ) ).Len() )
        m_RequestConfigBase = _T( "000220XX.............." );
    }
    //populate model, mail to, waves model choices
    wxString s1[] = {_T("GFS"),_T("COAMPS"),_T("RTOFS")};
    for( unsigned int i= 0;  i<(sizeof(s1) / sizeof(wxString));i++)
        m_pModel->Append( s1[i] );
    wxString s2[] = {_T("Saildocs"),_T("zyGrib")};
    for( unsigned int i= 0;  i<(sizeof(s2) / sizeof(wxString));i++)
        m_pMailTo->Append( s2[i] );
    wxString s3[] = {_T("WW3-GLOBAL"),_T("WW3-MEDIT")};
    for( unsigned int i= 0;  i<(sizeof(s3) / sizeof(wxString));i++)
        m_pWModel->Append( s3[i] );
    m_rButtonYes->SetLabel(_("Send"));
    m_rButtonApply->SetLabel(_("Save"));
    m_tResUnit->SetLabel(wxString::Format( _T("\u00B0")));
    m_sCourseUnit->SetLabel(wxString::Format( _T("\u00B0")));

    //add tooltips
    m_pSenderAddress->SetToolTip(_("Address used to send request eMail. (Mandatory for LINUX)"));
    m_pLogin->SetToolTip(_("This is your zyGrib's forum access Login"));
    m_pCode->SetToolTip(_("Get this Code in zyGrib's forum ( This is not your password! )"));
    m_sMovingSpeed->SetToolTip(_("Enter your forescasted Speed (in Knots)"));
    m_sMovingCourse->SetToolTip(_("Enter your forecasted Course"));

    long i,j,k;
    ( (wxString) m_RequestConfigBase.GetChar(0) ).ToLong( &i );             //MailTo
    m_pMailTo->SetSelection(i);
    ( (wxString) m_RequestConfigBase.GetChar(1) ).ToLong( &i );             //Model
    m_pModel->SetSelection(i);
    m_cMovingGribEnabled->SetValue(m_RequestConfigBase.GetChar(16) == 'X' );//Moving Grib
    ( (wxString) m_RequestConfigBase.GetChar(2) ).ToLong( &i );             //Resolution
    ( (wxString) m_RequestConfigBase.GetChar(3) ).ToLong( &j );             //interval
    ( (wxString) m_RequestConfigBase.GetChar(4) ).ToLong( &k, 16 );         //Time Range
    k--;                                         // range max = 2 to 16 stored in hexa from 1 to f

#ifdef __WXMSW__                                 //show / hide sender elemants as necessary
    m_pSenderSizer->ShowItems(false);
#else
    if(m_SendMethod == 0 )
        m_pSenderSizer->ShowItems(false);
    else
        m_pSenderSizer->ShowItems(true);                //possibility to use "sendmail" method with Linux
#endif

    ApplyRequestConfig( i, j ,k);

    ( (wxString) m_RequestConfigBase.GetChar(5) ).ToLong( &j );             //Waves model
    m_pWModel->SetSelection( j );

    m_pWind->Enable( false );                                               //always selected if available
    m_pPress->Enable( false );

    m_AllowSend = true;
    m_MailImage->SetValue( WriteMail() );

    SetMailImageSize();
}
示例#23
0
void weather_routing_pi::SetColorScheme(PI_ColorScheme cs)
{
      DimeWindow(m_pWeather_Routing);
}