Skip to content

Commit

Permalink
Add compiler switch for managed plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Rasbats committed May 17, 2020
1 parent bc57b23 commit 7e65f2d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 145 deletions.
77 changes: 0 additions & 77 deletions .travis.yml

This file was deleted.

7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ SET( wxWidgets_USE_STATIC OFF)


OPTION(SHIPDRIVER_USE_SVG "Use SVG graphics" ON)
# For OpenCPN version 5.x, NOT 5.0 ON. For version 5.0 OFF
OPTION(MANAGED_PLUGIN "Use managed plugin" OFF)


INCLUDE("cmake/PluginConfigure.cmake")
INCLUDE("cmake/PluginJSON.cmake")
Expand All @@ -38,6 +41,10 @@ IF(SHIPDRIVER_USE_SVG)
ADD_DEFINITIONS(-DSHIPDRIVER_USE_SVG)
ENDIF(SHIPDRIVER_USE_SVG)

IF(MANAGED_PLUGIN)
ADD_DEFINITIONS(-DMANAGED_PLUGIN)
ENDIF(MANAGED_PLUGIN)

include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-std=c++11 HAS_STD_CPP11_FLAG)
if(HAS_STD_CPP11_FLAG)
Expand Down
63 changes: 0 additions & 63 deletions appveyor.yml

This file was deleted.

1 change: 0 additions & 1 deletion src/ShipDriver_pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ class ShipDriver_pi : public opencpn_plugin_16

wxString StandardPath();


private:

double m_cursor_lat;
Expand Down
25 changes: 21 additions & 4 deletions src/icons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "icons.h"

wxBitmap *_img_ShipDriverIcon;
bool m_managedPlugin;


#ifdef SHIPDRIVER_USE_SVG
#include "ocpn_plugin.h"
Expand All @@ -22,12 +24,27 @@ void initialize_images(void)
_img_ShipDriverIcon = new wxBitmap(wxImage(sm));
}

#ifdef MANAGED_PLUGIN
m_managedPlugin = true;
#else
m_managedPlugin = false;
#endif

#ifdef SHIPDRIVER_USE_SVG
wxFileName fn;
char * pName = "ShipDriver_pi";
wxString tmp_path = GetPluginDataDir(pName);
fn.SetPath(tmp_path);
fn.AppendDir(_T("data"));
wxString tmp_path;
if (m_managedPlugin) {
tmp_path = GetPluginDataDir("shipdriver_pi");
fn.SetPath(tmp_path);
fn.AppendDir(_T("data"));
}
else {
fn.SetPath(*GetpSharedDataLocation());
fn.AppendDir(_T("plugins"));
fn.AppendDir(_T("shipdriver_pi"));
fn.AppendDir(_T("data"));
}

fn.SetFullName(_T("shipdriver_pi.svg"));
_svg_shipdriver = fn.GetFullPath();
fn.SetFullName(_T("shipdriver_pi_toggled.svg"));
Expand Down

0 comments on commit 7e65f2d

Please sign in to comment.