Skip to content

Commit

Permalink
For -ov50
Browse files Browse the repository at this point in the history
  • Loading branch information
Rasbats committed Feb 16, 2019
1 parent 050d945 commit ac80f06
Show file tree
Hide file tree
Showing 9 changed files with 301 additions and 31 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ IF (MSVC)
INCLUDE_DIRECTORIES(${PLUGIN_SOURCE_DIR}/include/msvc)
ENDIF (MSVC)

OPTION(PHOTOLAYER_USE_SVG "Use SVG graphics" ON)

IF(PHOTOLAYER_USE_SVG)
ADD_DEFINITIONS(-DPHOTOLAYER_USE_SVG)
ENDIF(PHOTOLAYER_USE_SVG)

INCLUDE("cmake/PluginConfigure.cmake")


SET(SRC_PHOTOLAYER
src/PhotoLayer_pi.cpp
src/PhotoLayer_pi.h
Expand Down
21 changes: 3 additions & 18 deletions cmake/PluginPackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

# build a CPack driven installer package
#include (InstallRequiredSystemLibraries)
IF (COMMAND cmake_policy)
CMAKE_POLICY(SET CMP0002 OLD)
ENDIF (COMMAND cmake_policy)

SET(CPACK_PACKAGE_NAME "${PACKAGE_NAME}")
SET(CPACK_PACKAGE_VENDOR "opencpn.org")
Expand All @@ -31,7 +28,7 @@ IF(WIN32)
# CPACK_BUILDWIN_DIR ??
# CPACK_PACKAGE_ICON ??

SET(CPACK_NSIS_PACKAGE_NAME "${PACKAGE_NAME}")
SET(CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}-ov50")

# Let cmake find NSIS.template.in
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/buildwin")
Expand Down Expand Up @@ -150,9 +147,8 @@ ENDIF(TWIN32 AND NOT UNIX)

INCLUDE(CPack)

IF(NOT STANDALONE MATCHES "BUNDLED")

IF(APPLE)
MESSAGE (STATUS "*** Staging to build PlugIn OSX Package ***")

# Copy a bunch of files so the Packages installer builder can find them
# relative to ${CMAKE_CURRENT_BINARY_DIR}
Expand All @@ -172,21 +168,11 @@ configure_file(${PROJECT_SOURCE_DIR}/buildosx/InstallOSX/pkg_background.jpg
configure_file(${PROJECT_SOURCE_DIR}/buildosx/InstallOSX/${PACKAGE_NAME}.pkgproj.in
${CMAKE_CURRENT_BINARY_DIR}/${VERBOSE_NAME}.pkgproj)

#We depend on libgeotiff, let's assume it is available from Homebrew
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libgeotiff.2.dylib
COMMAND cp /usr/local/lib/libgeotiff.2.dylib ${CMAKE_CURRENT_BINARY_DIR}
COMMAND chmod 755 ${CMAKE_CURRENT_BINARY_DIR}/libgeotiff.2.dylib
COMMAND install_name_tool -change /usr/local/lib/libgeotiff.2.dylib @executable_path/../MacOS/libgeotiff.2.dylib libPhotoLayer_pi.dylib
COMMAND install_name_tool -change /usr/local/opt/libgeotiff/lib/libgeotiff.2.dylib @executable_path/../MacOS/libgeotiff.2.dylib libPhotoLayer_pi.dylib
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${PACKAGE_NAME}
)

ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${VERBOSE_NAME}-Plugin.pkg
COMMAND /usr/local/bin/packagesbuild -F ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${VERBOSE_NAME}.pkgproj
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libgeotiff.2.dylib
DEPENDS ${PACKAGE_NAME}
COMMENT "create-pkg [${PACKAGE_NAME}]: Generating pkg file."
)

Expand All @@ -195,4 +181,3 @@ configure_file(${PROJECT_SOURCE_DIR}/buildosx/InstallOSX/pkg_background.jpg


ENDIF(APPLE)
ENDIF(NOT STANDALONE MATCHES "BUNDLED")
97 changes: 97 additions & 0 deletions data/PhotoLayer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
97 changes: 97 additions & 0 deletions data/PhotoLayer_toggled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 26 additions & 4 deletions src/PhotoLayer_pi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,34 @@ PhotoLayer_pi::PhotoLayer_pi(void *ppimgr)
int PhotoLayer_pi::Init(void)
{
AddLocaleCatalog( _T("opencpn-PhotoLayer_pi") );
m_leftclick_tool_id = InsertPlugInTool(_T(""), _img_photolayer,
_img_photolayer, wxITEM_NORMAL,
_("PhotoLayer"), _T(""), NULL,
PHOTOLAYER_TOOL_POSITION, 0, this);
//m_leftclick_tool_id = InsertPlugInTool(_T(""), _img_photolayer,
// _img_photolayer, wxITEM_NORMAL,
// _("PhotoLayer"), _T(""), NULL,
// PHOTOLAYER_TOOL_POSITION, 0, this);
m_pPhotoLayer = NULL;


wxString shareLocn = *GetpSharedDataLocation() +
_T("plugins") + wxFileName::GetPathSeparator() +
_T("PhotoLayer_pi") + wxFileName::GetPathSeparator()
+ _T("data") + wxFileName::GetPathSeparator();

wxString normalIcon = shareLocn + _T("PhotoLayer.svg");
wxString toggledIcon = shareLocn + _T("PhotoLayer_toggled.svg");
wxString rolloverIcon = shareLocn + _T("PhotoLayer.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,
_("PhotoLayer"), _T(""), NULL, PHOTOLAYER_TOOL_POSITION, 0, this);


return (WANTS_OVERLAY_CALLBACK |
WANTS_OPENGL_OVERLAY_CALLBACK |
WANTS_TOOLBAR_CALLBACK |
Expand Down
3 changes: 2 additions & 1 deletion src/PhotoLayer_pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <wx/wx.h>
#include <wx/stdpaths.h>
#include <wx/fileconf.h>
#include "ocpn_plugin.h" //Required for OCPN plugin functions

#include "version.h"

Expand Down Expand Up @@ -111,7 +112,7 @@ class PhotoLayer_pi : public opencpn_plugin_113
bool LoadConfig(void);
bool SaveConfig(void);

void SetPositionFixEx(PlugIn_Position_Fix_Ex &pfix);
void SetPositionFixEx(PlugIn_Position_Fix_Ex &pfix);

int m_PhotoLayer_dialog_x, m_PhotoLayer_dialog_y;
int m_display_width, m_display_height;
Expand Down
25 changes: 25 additions & 0 deletions src/icons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@
#endif
#include <wx/mstream.h>
#include "icons.h"
#include <wx/fileconf.h>

wxBitmap *_img_photolayer;
wxBitmap *_img_photolayer_pi;

#ifdef PHOTOLAYER_USE_SVG
#include "ocpn_plugin.h"
wxString _svg_photolayer;
wxString _svg_photolayer_rollover;
wxString _svg_photolayer_toggled;
#endif



void initialize_images(void)
{
{
Expand All @@ -19,5 +29,20 @@ void initialize_images(void)
wxMemoryInputStream sm("\211PNG\r\n\032\n\000\000\000\rIHDR\000\000\000 \000\000\000 \b\006\000\000\000szz\364\000\000\000\011pHYs\000\000\016\304\000\000\016\304\001\225+\016\033\000\000\000\242IDATX\303\355\327\315\011\3030\014\206\341\327%K8\003v\216\316\321\001\3451\324[ $Nt\221>(\361\331\360\274\350\340\237ff\216p\275\020\257'@\036\260D7\366\365\253\233@\026\036\n\310\304\207\275\257\003\262\361\313\011T\340\323\200*\3744\240\022?\004T\343\273\000\005\276\005\250p\200\346|\\\205\247\336\005\021\034\240E\036$k\357\272\2438\023\277\r\310\306m\214y@\005>\235@\025~\032P\211\037\002\252\361]\200\002\337\002T8@\303\335Ux\372\263\374\016\aX\"\233\236\237\321_\a\374\000\301\351H\322C\226\a\357\000\000\000\000IEND\256B`\202", 240);
_img_photolayer_pi = new wxBitmap(wxImage(sm));
}

#ifdef PHOTOLAYER_USE_SVG
wxFileName fn;
fn.SetPath(*GetpSharedDataLocation());
fn.AppendDir(_T("plugins"));
fn.AppendDir(_T("PhotoLayer_pi"));
fn.AppendDir(_T("data"));
fn.SetFullName(_T("PhotoLayer_pi.svg"));
_svg_photolayer = fn.GetFullPath();
fn.SetFullName(_T("PhotoLayer_pi.svg"));
_svg_photolayer_rollover = fn.GetFullPath();
fn.SetFullName(_T("PhotoLayer_pi_toggled.svg"));
_svg_photolayer_toggled = fn.GetFullPath();
#endif

return;
}
6 changes: 6 additions & 0 deletions src/icons.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,11 @@ extern void initialize_images(void);
extern wxBitmap *_img_photolayer;
extern wxBitmap *_img_photolayer_pi;

#ifdef PHOTOLAYER_USE_SVG
extern wxString _svg_photolayer;
extern wxString _svg_photolayer_rollover;
extern wxString _svg_photolayer_toggled;
#endif


#endif /* ICONS_H */
Loading

0 comments on commit ac80f06

Please sign in to comment.