Extra techniques that may be useful

[[Link to the additional techniques|Useful Stuff]].

Source Code Changes

Changes associated with API 16

  • The plugin api reference is changed from opencpn_plugin_110 to opencpn_plugin_116

Changes needed for the managed process

  • GetPluginDataDir is used instead of *GetpSharedDataLocation()

  • The plugin version (major/minor) are taken from the version number in CMakeLists.txt. The link is made by adding the include #include config.h to the main plugin src file.

  • The OpenCPN API version also comes from CMakeLists.txt. The functions GetAPIVersionMajor() and GetAPIVersionMinor() are edited accordingly.

Addition for MacOSX

  • wxInitAllImageHandlers(): Ensures the png image is recognised on the Mac

  wxFileName fn;

  auto path = GetPluginDataDir("TideFinder_pi");
  fn.SetPath(path);
  fn.AppendDir("data");
  fn.SetFullName("tidefinder_panel_icon.png");

  path = fn.GetFullPath();

  wxInitAllImageHandlers();

  wxLogDebug(wxString("Using icon path: ") + path);
  if (!wxImage::CanRead(path)) {
      wxLogDebug("Initiating image handlers.");
      wxInitAllImageHandlers();
  }
  wxImage panelIcon(path);
  if (panelIcon.IsOk())
      m_panelBitmap = wxBitmap(panelIcon);
  else
      wxLogWarning("TideFinder panel icon has NOT been loaded");

  m_bShowTideFinder = false;

}

Several source code files are involved in these changes, not just TideFinder_pi.cpp.

[[Back to the main guide|Alternative Workflow]]