Exemple #1
0
int locapi_pi::Init ( void )
{
	AddLocaleCatalog ( _T ( "opencpn-locapi_pi" ) );

	m_pconfig = GetOCPNConfigObject();
	LoadConfig();

	status = REPORT_NOT_SUPPORTED;
	if (SUCCEEDED(spLoc.CoCreateInstance(CLSID_Location))) // Create the Location object
	{
		wxLogMessage(_T("LOCAPI: Instance created"));
		// Array of report types of interest. Other ones include IID_ICivicAddressReport
		IID REPORT_TYPES[] = { IID_ILatLongReport };
		// Request permissions for this user account to receive location data for all the
		// types defined in REPORT_TYPES (which is currently just one report)
		if (FAILED(spLoc->RequestPermissions(NULL, REPORT_TYPES, ARRAYSIZE(REPORT_TYPES), TRUE))) // TRUE means a synchronous request
		{
			wxMessageBox( _("Warning: Unable to request permissions to receive location updates.") );
		}		
	}
	else
	{
		wxLogMessage(_T("LOCAPI: Instance creation failed"));
	}

	Start( m_interval, wxTIMER_CONTINUOUS );
	return (
		WANTS_CONFIG
		);
}
Exemple #2
0
int vdr_pi::Init(void)
{
      AddLocaleCatalog( _T("opencpn-vdr_pi") );

      //    Get a pointer to the opencpn configuration object
      m_pconfig = GetOCPNConfigObject();
      m_pauimgr = GetFrameAuiManager();
      m_pvdrcontrol = NULL;

      //    And load the configuration items
      LoadConfig();

      //    This PlugIn needs two toolbar icons
      m_tb_item_id_record = InsertPlugInTool(_T(""), _img_vdr_record, _img_vdr_record, wxITEM_CHECK,
            _("Record"), _T(""), NULL, VDR_TOOL_POSITION, 0, this);
      m_tb_item_id_play = InsertPlugInTool(_T(""), _img_vdr_play, _img_vdr_play, wxITEM_CHECK,
            _("Play"), _T(""), NULL, VDR_TOOL_POSITION, 0, this);
      m_recording = false;

      return (
           WANTS_TOOLBAR_CALLBACK    |
           INSTALLS_TOOLBAR_TOOL     |
           WANTS_CONFIG              |
           WANTS_NMEA_SENTENCES      |
           WANTS_AIS_SENTENCES
            );
}
Exemple #3
0
int calculator_pi::Init(void)
{
      AddLocaleCatalog( _T("opencpn-calculator_pi") );

      // Set some default private member parameters
      m_calculator_dialog_x = 0;
      m_calculator_dialog_y = 0;
      m_calculator_dialog_width = 20;
      m_calculator_dialog_height = 20;

      ::wxDisplaySize(&m_display_width, &m_display_height);

      //    Get a pointer to the opencpn display canvas, to use as a parent for the POI Manager dialog
      m_parent_window = GetOCPNCanvasWindow();

      //    Get a pointer to the opencpn configuration object
      m_pconfig = GetOCPNConfigObject();

      //    And load the configuration items
      LoadConfig();

      //    This PlugIn needs a toolbar icon, so request its insertion
      m_leftclick_tool_id  = InsertPlugInTool(_T(""), _img_calc, _img_calc, wxITEM_NORMAL,
            _("Calculator"), _T(""), NULL,
             CALCULATOR_TOOL_POSITION, 0, this);

      m_pDialog = NULL;

      return (WANTS_TOOLBAR_CALLBACK   |
              INSTALLS_TOOLBAR_TOOL     |
              WANTS_PREFERENCES         |
              WANTS_CONFIG
           );
}
Exemple #4
0
int weather_routing_pi::Init(void)
{
      AddLocaleCatalog( _T("opencpn-weather_routing_pi") );

      //    Get a pointer to the opencpn configuration object
      m_pconfig = GetOCPNConfigObject();

      // Get a pointer to the opencpn display canvas, to use as a parent for the WEATHER_ROUTING dialog
      m_parent_window = GetOCPNCanvasWindow();

      m_pWeather_Routing = NULL;

      m_leftclick_tool_id  = InsertPlugInTool
          (_T(""), _img_WeatherRouting, _img_WeatherRouting, wxITEM_CHECK,
           _("Weather_Routing"), _T(""), NULL,
           WEATHER_ROUTING_TOOL_POSITION, 0, this);

      wxMenu dummy_menu;
      m_position_menu_id = AddCanvasContextMenuItem
          (new wxMenuItem(&dummy_menu, -1, _("Weather Route Position")), this );
      SetCanvasContextMenuItemViz(m_position_menu_id, false);

      //    And load the configuration items
      LoadConfig();

      return (WANTS_OVERLAY_CALLBACK |
              WANTS_OPENGL_OVERLAY_CALLBACK |
              WANTS_TOOLBAR_CALLBACK    |
              WANTS_CONFIG              |
              WANTS_CURSOR_LATLON       |
              WANTS_NMEA_EVENTS         |
              WANTS_PLUGIN_MESSAGING
            );
}
Exemple #5
0
int findit_pi::Init(void)
{
	  AddLocaleCatalog( _T("opencpn-findit_pi") );

      m_pFindItWindow = NULL;

	  isLogbookReady = FALSE;;
	  isLogbookWindowShown = FALSE;

      // Get a pointer to the opencpn display canvas, to use as a parent for windows created
      m_parent_window = GetOCPNCanvasWindow();

	  m_pconfig = GetOCPNConfigObject();
	  LoadConfig();

      // Create the Context Menu Items

      //    In order to avoid an ASSERT on msw debug builds,
      //    we need to create a dummy menu to act as a surrogate parent of the created MenuItems
      //    The Items will be re-parented when added to the real context meenu
      wxMenu dummy_menu;
	  m_bFINDITShowIcon = true;
	  if(m_bFINDITShowIcon)
            m_leftclick_tool_id  = InsertPlugInTool(_T(""), _img_findit, _img_findit, wxITEM_NORMAL,
                  _("FindIt"), _T(""), NULL,
                   FINDIT_TOOL_POSITION, 0, this);

      return (
			WANTS_TOOLBAR_CALLBACK    |
		    WANTS_PREFERENCES         |
			WANTS_PLUGIN_MESSAGING 
            );
}
int kmloverlay_pi::Init(void)
{
      m_puserinput = NULL;

      AddLocaleCatalog( _T("opencpn-kmloverlay_pi") );

      m_toolbar_item_id  = InsertPlugInTool( _T(""), _img_kmloverlay, _img_kmloverlay, wxITEM_NORMAL,
            _("KML overlay"), _T(""), NULL, KMLOVERLAY_TOOL_POSITION, 0, this );

      m_pauimgr = GetFrameAuiManager();

      m_puserinput = new KMLOverlayUI( GetOCPNCanvasWindow(), wxID_ANY, _T("") );
      wxAuiPaneInfo pane = wxAuiPaneInfo().Name(_T("KMLOverlay")).Caption(_("KML overlay")).CaptionVisible(true).Float().FloatingPosition(50,150).Dockable(false).Resizable().CloseButton(true).Show(false);
      m_pauimgr->AddPane( m_puserinput, pane );
      m_pauimgr->Update();

      //    Get a pointer to the opencpn configuration object
      m_pconfig = GetOCPNConfigObject();
      //    And load the configuration items
      LoadConfig();
      ApplyConfig();

      return (
           WANTS_OVERLAY_CALLBACK    |
           WANTS_OPENGL_OVERLAY_CALLBACK |
           WANTS_TOOLBAR_CALLBACK    |
           INSTALLS_TOOLBAR_TOOL     |
// nothing yet //           WANTS_PREFERENCES         |
           WANTS_CONFIG
            );
}
int ocpndebugger_pi::Init(void) {
    AddLocaleCatalog(_T("opencpn-ocpndebugger_pi"));

    // Set some default private member parameters
    m_ocpndebugger_dialog_x = 0;
    m_ocpndebugger_dialog_y = 0;

    ::wxDisplaySize(&m_display_width, &m_display_height);

    //    Get a pointer to the opencpn display canvas, to use as a parent for
    //    the
    //    POI Manager dialog
    m_parent_window = GetOCPNCanvasWindow();

//    This PlugIn needs a toolbar icon, so request its insertion
#ifdef OCPNDEBUGGER_USE_SVG
    m_leftclick_tool_id = InsertPlugInToolSVG(
                              _T( "OpenCPNDebugger" ), _svg_ocpndebugger, _svg_ocpndebugger_rollover,
                              _svg_ocpndebugger_toggled, wxITEM_CHECK, _("OpenCPNDebugger"), _T( "" ),
                              NULL, OpenCPNDEBUGGER_TOOL_POSITION, 0, this);
#else
    m_leftclick_tool_id =
        InsertPlugInTool(_T(""), _img_ocpndebugger, _img_ocpndebugger,
                         wxITEM_NORMAL, _("OpenCPNDebugger"), _T(""), NULL,
                         OpenCPNDEBUGGER_TOOL_POSITION, 0, this);
#endif

    m_pOpenCPNDebuggerDialog = NULL;

    return (WANTS_TOOLBAR_CALLBACK | INSTALLS_TOOLBAR_TOOL |
            WANTS_NMEA_SENTENCES | WANTS_NMEA_EVENTS | WANTS_AIS_SENTENCES |
            WANTS_PLUGIN_MESSAGING | WANTS_SIGNALK_SENTENCES);
}
Exemple #8
0
int gecomapi_pi::Init(void)
{
      m_bshuttingDown = false;

      mPriPosition = 99;

      m_pgecomapi_window = NULL;

      AddLocaleCatalog( _T("opencpn-gecomapi_pi") );

      //    Get a pointer to the opencpn display canvas, to use as a parent for the POI Manager dialog
      m_parent_window = GetOCPNCanvasWindow();

      m_pauimgr = GetFrameAuiManager();

      //    Get a pointer to the opencpn configuration object
      m_pconfig = GetOCPNConfigObject();

      //    And load the configuration items
      LoadConfig();

      //    This PlugIn needs a toolbar icon
#ifdef GECOMAPI_USE_SVG
	  m_toolbar_item_id = InsertPlugInToolSVG(_T("GoogleEarth"), _svg_gecomapi, _svg_gecomapi_rollover, _svg_gecomapi_toggled, wxITEM_CHECK,
		  _T("GoogleEarth"), _T(""), NULL, GECOMAPI_TOOL_POSITION, 0, this);
#else           
	  m_toolbar_item_id = InsertPlugInTool(_T("GoogleEarth"), _img_gecomapi, _img_gecomapi, wxITEM_CHECK,
		  _T("GoogleEarth"), _T(""), NULL, GECOMAPI_TOOL_POSITION, 0, this); 
#endif

      m_pgecomapi_window = new GEUIDialog(GetOCPNCanvasWindow(), wxID_ANY, m_pauimgr, m_toolbar_item_id, this);

      wxAuiPaneInfo pane = wxAuiPaneInfo().Name(_T("GoogleEarth")).Caption(_T("GoogleEarth")).CaptionVisible(true).Float().FloatingPosition(0,0).Show(!m_bstartHidden).TopDockable(false).BottomDockable(false).LeftDockable(true).RightDockable(true).CaptionVisible(true).CloseButton(false).MinSize(300,300);

      m_pauimgr->AddPane(m_pgecomapi_window, pane);
      
      if(m_pgecomapi_window)
      {
            m_pgecomapi_window->SetCameraParameters(m_iCameraAzimuth, m_iCameraTilt, m_iCameraRange);
      }

      ApplyConfig();

      m_pauimgr->Update();

      //m_pauimgr->Connect( wxEVT_AUI_RENDER, wxAuiManagerEventHandler( gecomapi_pi::OnAuiRender ), NULL, this );

      return (WANTS_OVERLAY_CALLBACK |
           WANTS_CURSOR_LATLON       |
           WANTS_TOOLBAR_CALLBACK    |
           INSTALLS_TOOLBAR_TOOL     |
           WANTS_PREFERENCES         |
           WANTS_CONFIG              |
           WANTS_NMEA_EVENTS         |
           WANTS_NMEA_SENTENCES      |
           USES_AUI_MANAGER          |
           WANTS_ONPAINT_VIEWPORT
            );      
}
int connector_pi::Init(void)
{
    
      
      AddLocaleCatalog( _T("opencpn-connector_pi") );
		
      // Set some default private member parameters
      m_connector_dialog_x = 0;
      m_connector_dialog_y = 0;

      ::wxDisplaySize(&m_display_width, &m_display_height);

      //    Get a pointer to the opencpn display canvas, to use as a parent
      m_parent_window = GetOCPNCanvasWindow();

      //    Get a pointer to the opencpn configuration object
      m_pconfig = GetOCPNConfigObject();

      //    And load the configuration items
      LoadConfig();

      //    This PlugIn needs a toolbar icon, so request its insertion
      m_leftclick_tool_id  = InsertPlugInTool(_T(""), _img_connector, _img_connector, wxITEM_NORMAL,
            _("Connector"), _T(""), NULL,
             CONNECTOR_TOOL_POSITION, 0, this);

      m_pConnectorDialog = NULL;
/*
 * 
 * 
 * 
 */
 if (m_DataSources.GetCount() > 0)
 {
		unsigned int i;
		DataSource* p;
		for (i=0;i<m_DataSources.GetCount();i++){
			p = m_DataSources.Item(i);
		if( p->protocol==2) St_init(p);
		}
 }
      return (WANTS_CURSOR_LATLON       |
              WANTS_TOOLBAR_CALLBACK    |
              INSTALLS_TOOLBAR_TOOL     |
              WANTS_PREFERENCES         |
             // WANTS_NMEA_SENTENCES      |
			 // WANTS_NMEA_EVENTS 	    |
              WANTS_CONFIG
           );
}
Exemple #10
0
int route_pi::Init(void)
{
      AddLocaleCatalog( _T("opencpn-route_pi") );

      // Set some default private member parameters
      m_route_dialog_x = 0;
      m_route_dialog_y = 0;
      ::wxDisplaySize(&m_display_width, &m_display_height);

      //    Get a pointer to the opencpn display canvas, to use as a parent for the POI Manager dialog
      m_parent_window = GetOCPNCanvasWindow();

      //    Get a pointer to the opencpn configuration object
      m_pconfig = GetOCPNConfigObject();

      //    And load the configuration items
      LoadConfig();

        // Create the Context Menu Items

        //    In order to avoid an ASSERT on msw debug builds,
        //    we need to create a dummy menu to act as a surrogate parent of the created MenuItems
        //    The Items will be re-parented when added to the real context meenu

        wxMenu dummy_menu;

      wxMenuItem *pmi = new wxMenuItem(&dummy_menu, -1, _("Start Route_pi Here"));
      m_add_start = AddCanvasContextMenuItem(pmi, this );
      SetCanvasContextMenuItemViz(m_add_start, true);

      wxMenuItem *pmih = new wxMenuItem(&dummy_menu, -1, _("Finish Route_pi Here."));
      m_add_finish = AddCanvasContextMenuItem(pmih, this );
      SetCanvasContextMenuItemViz(m_add_finish, true);


      //    This PlugIn needs a toolbar icon, so request its insertion
      m_leftclick_tool_id  = InsertPlugInTool(_T(""), _img_route_pi, _img_route_pi, wxITEM_NORMAL,
            _("Route"), _T(""), NULL,
             CALCULATOR_TOOL_POSITION, 0, this);

      m_pDialog = NULL;

      return (WANTS_TOOLBAR_CALLBACK   |
              INSTALLS_TOOLBAR_TOOL    |
              WANTS_PREFERENCES        |
              WANTS_CURSOR_LATLON      |
              WANTS_CONFIG
           );
}
Exemple #11
0
int osm_pi::Init(void)
{

    m_bshuttingDown = false;
    m_lat = 999.0;
    m_lon = 999.0;

    AddLocaleCatalog( _T("opencpn-osm_pi") );

    // Set some default private member parameters
    m_osm_dialog_x = 0;
    m_osm_dialog_y = 0;
    m_osm_dialog_sx = 200;
    m_osm_dialog_sy = 200;
    m_pOsmDialog = NULL;
    m_bShowOsm = false;

    ::wxDisplaySize(&m_display_width, &m_display_height);

    //    Get a pointer to the opencpn display canvas, to use as a parent for the POI Manager dialog
    m_parent_window = GetOCPNCanvasWindow();

    //    Get a pointer to the opencpn configuration object
    m_pconfig = GetOCPNConfigObject();

    //    And load the configuration items
    LoadConfig();

    m_pDownloader = new OsmDownloader();
    m_pOsmDb = new OsmDb();

      //    This PlugIn needs a toolbar icon, so request its insertion
    m_leftclick_tool_id  = InsertPlugInTool(_T(""), _img_osm, _img_osm, 
        wxITEM_NORMAL,_("OpenSeaMap"), _T(""), NULL,
        OSM_TOOL_POSITION, 0, this);

    return (WANTS_TOOLBAR_CALLBACK    |
          INSTALLS_TOOLBAR_TOOL     |
          WANTS_CURSOR_LATLON       |
          WANTS_PREFERENCES         |
          WANTS_OVERLAY_CALLBACK    |
          WANTS_ONPAINT_VIEWPORT    |
          //WANTS_OPENGL_OVERLAY_CALLBACK |
          //WANTS_DYNAMIC_OPENGL_OVERLAY_CALLBACK |
          WANTS_CONFIG
       );
}
int objsearch_pi::Init ( void )
{
    AddLocaleCatalog ( _T ( "opencpn-objsearch_pi" ) );

    ::wxDisplaySize ( &m_display_width, &m_display_height );

    //    Get a pointer to the opencpn configuration object
    m_pconfig = GetOCPNConfigObject();
    
    //    And load the configuration items
    LoadConfig();

    // Get a pointer to the opencpn display canvas, to use as a parent for the OBJSEARCH dialog
    m_parent_window = GetOCPNCanvasWindow();

    m_leftclick_tool_id = InsertPlugInTool ( _T ( "" ), _img_objsearch, _img_objsearch, wxITEM_CHECK,
                          _ ( "Object Search" ), _T ( "" ), NULL,
                          OBJSEARCH_TOOL_POSITION, 0, this );

    m_pObjSearchDialog = new ObjSearchDialogImpl( this, m_parent_window );
    
    m_chartLoading = wxEmptyString;
    
    m_bWaitForDB = false;
    
    m_boatlat = NAN;
    m_boatlon = NAN;

    m_pThread = new DbThread(this);
    wxThreadError err = m_pThread->Run();

    if ( err != wxTHREAD_NO_ERROR )
    {
        delete m_pThread;
        m_pThread = NULL;
    }

    return ( WANTS_ONPAINT_VIEWPORT    |
             WANTS_TOOLBAR_CALLBACK    |
             INSTALLS_TOOLBAR_TOOL     |
             WANTS_CONFIG              |
             WANTS_NMEA_EVENTS         |
             WANTS_PREFERENCES         |
             WANTS_VECTOR_CHART_OBJECT_INFO
           );
}
Exemple #13
0
int watchdog_pi::Init(void)
{
    AddLocaleCatalog( PLUGIN_CATALOG_NAME );

    Alarm::LoadConfigAll();
    
    m_leftclick_tool_id  = InsertPlugInTool
        (_T(""), _img_watchdog, _img_watchdog, wxITEM_NORMAL,
         _("Watchdog"), _T(""), NULL, WATCHDOG_TOOL_POSITION, 0, this);
    
    m_WatchdogDialog = NULL;
    m_ConfigurationDialog = NULL;
    m_PropertiesDialog = NULL;
    m_Timer.Connect(wxEVT_TIMER, wxTimerEventHandler
                    ( watchdog_pi::OnTimer ), NULL, this);
    m_Timer.Start(3000);
    
    if(!m_WatchdogDialog)
    {
        m_WatchdogDialog = new WatchdogDialog(*this, GetOCPNCanvasWindow());
        m_ConfigurationDialog = new ConfigurationDialog(*this, m_WatchdogDialog);
        
        wxIcon icon;
        icon.CopyFromBitmap(*_img_watchdog);
        m_WatchdogDialog->SetIcon(icon);
        m_ConfigurationDialog->SetIcon(icon);
    }
    m_bWatchdogDialogShown = false;

    return (WANTS_OVERLAY_CALLBACK |
            WANTS_OPENGL_OVERLAY_CALLBACK |
            WANTS_TOOLBAR_CALLBACK    |
            WANTS_CURSOR_LATLON       |
            WANTS_NMEA_SENTENCES      |
            WANTS_NMEA_EVENTS         |
            WANTS_AIS_SENTENCES       |
            WANTS_PLUGIN_MESSAGING    |
            WANTS_PREFERENCES         |
            WANTS_CONFIG);
}
Exemple #14
0
int aisradar_pi::Init(void) {
    AddLocaleCatalog( _T("opencpn-aisradar_pi") );
    m_radar_frame_x = m_radar_frame_y = 0;
    m_radar_frame_sx = m_radar_frame_sy = 200;
    m_pRadarFrame = 0;
    m_lat= m_lon=0.;
    m_cog= m_sog=0.;
    m_sats=0;
    ::wxDisplaySize(&m_display_width, &m_display_height);
    m_pconfig = GetOCPNConfigObject();
    LoadConfig();
    if (AisTargets) {  // Init may be called more than once, check for cleanup
        WX_CLEAR_ARRAY(*AisTargets);     
        delete AisTargets;
	}
	AisTargets = GetAISTargetArray();
    m_parent_window = GetOCPNCanvasWindow();
    if(m_radar_show_icon) {
        m_leftclick_tool_id  = InsertPlugInTool(_T(""), 
            _img_radar, 
            _img_radar, 
            wxITEM_NORMAL, 
			wxString::Format(_T("AIS Radar View %d.%d"), 
                PLUGIN_VERSION_MAJOR, 
                PLUGIN_VERSION_MINOR
            ), 
			_T(""), 
            0,
            RADAR_TOOL_POSITION, 
            0,
            this
        );
    }
    return (WANTS_TOOLBAR_CALLBACK | INSTALLS_TOOLBAR_TOOL |
         WANTS_CONFIG | WANTS_PREFERENCES | WANTS_AIS_SENTENCES  |
         WANTS_NMEA_EVENTS | WANTS_PLUGIN_MESSAGING | USES_AUI_MANAGER
    );
}
int climatology_pi::Init()
{
      AddLocaleCatalog( _T("opencpn-climatology_pi") );

      // Set some default private member parameters
      m_climatology_dialog_x = 0;
      m_climatology_dialog_y = 0;
      m_climatology_dialog_sx = 200;
      m_climatology_dialog_sy = 400;

      ::wxDisplaySize(&m_display_width, &m_display_height);

      //    Get a pointer to the opencpn configuration object
      m_pconfig = GetOCPNConfigObject();

      // Get a pointer to the opencpn display canvas, to use as a parent for the  dialog
      m_parent_window = GetOCPNCanvasWindow();

      //    This PlugIn needs a toolbar icon, so request its insertion if enabled locally
#ifdef OCPN_USE_SVG
      m_leftclick_tool_id = InsertPlugInToolSVG( "Climatology" , _svg_climatology, _svg_climatology_rollover, _svg_climatology_toggled,
                                              wxITEM_CHECK, _("Climatology"),  "" , NULL, CLIMATOLOGY_TOOL_POSITION, 0, this);
#else
      m_leftclick_tool_id  = InsertPlugInTool("", _img_climatology, _img_climatology, wxITEM_NORMAL,
                                              _("Climatology"), "", NULL,
                                              CLIMATOLOGY_TOOL_POSITION, 0, this);
#endif
      SendClimatology(true);

      return (WANTS_OVERLAY_CALLBACK |
           WANTS_OPENGL_OVERLAY_CALLBACK |
           WANTS_CURSOR_LATLON       |
           WANTS_TOOLBAR_CALLBACK    |
           INSTALLS_TOOLBAR_TOOL     |
           WANTS_CONFIG              |
           WANTS_PLUGIN_MESSAGING
            );
}
Exemple #16
0
int iacfleet_pi::Init( void )
{
    AddLocaleCatalog( _T("opencpn-iacfleet_pi") );

    //    And load the configuration items
    LoadConfig();

    //    This PlugIn needs a toolbar icon, so request its insertion if enabled locally
#ifdef IACFLEET_USE_SVG
    m_leftclick_tool_id = InsertPlugInToolSVG( _T( "IACFleet" ), _svg_iacfleet, _svg_iacfleet_rollover, _svg_iacfleet_toggled, wxITEM_CHECK, _( "IACFleet" ), _T( "" ), NULL, IACFLEET_TOOL_POSITION, 0, this);
#else
    m_leftclick_tool_id  = InsertPlugInTool(_T(""), _img_iacfleet_pi, _img_iacfleet_pi, wxITEM_NORMAL,
            _("IACFleet"), _T(""), NULL,
            IACFLEET_TOOL_POSITION, 0, this);
#endif

    return (WANTS_OVERLAY_CALLBACK |
            WANTS_OPENGL_OVERLAY_CALLBACK |
            WANTS_CURSOR_LATLON       |
            WANTS_TOOLBAR_CALLBACK    |
            INSTALLS_TOOLBAR_TOOL     |
            WANTS_CONFIG
           );
}
Exemple #17
0
int grib_pi::Init(void)
{
      AddLocaleCatalog( _T("opencpn-grib_pi") );

      // Set some default private member parameters
      m_CtrlBarxy = wxPoint( 0 ,0 );
      m_CursorDataxy = wxPoint( 0, 0 );

      m_pGribCtrlBar = NULL;
      m_pGRIBOverlayFactory = NULL;

      ::wxDisplaySize(&m_display_width, &m_display_height);

      m_DialogStyleChanged = false;

      //    Get a pointer to the opencpn configuration object
      m_pconfig = GetOCPNConfigObject();

      //    And load the configuration items
      LoadConfig();

      // Get a pointer to the opencpn display canvas, to use as a parent for the GRIB dialog
      m_parent_window = GetOCPNCanvasWindow();

//      int m_height = GetChartbarHeight();
      //    This PlugIn needs a CtrlBar icon, so request its insertion if enabled locally
	  if (m_bGRIBShowIcon) {
		  wxString shareLocn = *GetpSharedDataLocation() +
			  _T("plugins") + wxFileName::GetPathSeparator() +
			  _T("grib_pi") + wxFileName::GetPathSeparator()
			  + _T("data") + wxFileName::GetPathSeparator();

		  wxString normalIcon = shareLocn + _T("grib.svg");
		  wxString toggledIcon = shareLocn + _T("grib_toggled.svg");
		  wxString rolloverIcon = shareLocn + _T("grib_rollover.svg");

		  //  For journeyman styles, we prefer the built-in raster icons which match the rest of the toolbar.
		  if (GetActiveStyleName().Lower() != _T("traditional")){
			  normalIcon = _T("");
			  toggledIcon = _T("");
			  rolloverIcon = _T("");
		  }

		  wxLogMessage(normalIcon);
		  m_leftclick_tool_id = InsertPlugInToolSVG(_T(""), normalIcon, rolloverIcon, toggledIcon, wxITEM_CHECK,
			  _("Grib"), _T(""), NULL, GRIB_TOOL_POSITION, 0, this);
	  }

      if( !QualifyCtrlBarPosition( m_CtrlBarxy, m_CtrlBar_Sizexy ) ) {
          m_CtrlBarxy = wxPoint( 20, 60 );   //reset to the default position
          m_CursorDataxy = wxPoint( 20, 170 );
      }

      return (WANTS_OVERLAY_CALLBACK |
              WANTS_OPENGL_OVERLAY_CALLBACK |
              WANTS_CURSOR_LATLON       |
              WANTS_TOOLBAR_CALLBACK    |
              INSTALLS_TOOLBAR_TOOL     |
              WANTS_CONFIG              |
              WANTS_PREFERENCES         |
              WANTS_PLUGIN_MESSAGING    |
              WANTS_MOUSE_EVENTS
            );
}