diff --git a/CMakeLists.txt b/CMakeLists.txt index 78340c2..f21b0e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ SET(TITLE_NAME DR) SET(CPACK_PACKAGE_CONTACT "Mike Rossiter") SET(VERSION_MAJOR "2") -SET(VERSION_MINOR "1") +SET(VERSION_MINOR "1.1") #SET(CMAKE_BUILD_TYPE Debug) SET( wxWidgets_USE_DEBUG OFF) @@ -23,8 +23,15 @@ SET( wxWidgets_USE_UNICODE ON) SET( wxWidgets_USE_UNIVERSAL OFF) SET( wxWidgets_USE_STATIC OFF) +#SET(CMAKE_BUILD_TYPE Debug) +OPTION(DR_USE_SVG "Use SVG graphics" ON) + INCLUDE("cmake/PluginConfigure.cmake") +IF(DR_USE_SVG) + ADD_DEFINITIONS(-DDR_USE_SVG) +ENDIF(DR_USE_SVG) + SET(SRC_DR src/DR_pi.h src/DR_pi.cpp diff --git a/data/blank.ico b/data/blank.ico new file mode 100644 index 0000000..71d6c98 Binary files /dev/null and b/data/blank.ico differ diff --git a/data/dr_pi.svg b/data/dr_pi.svg new file mode 100644 index 0000000..c59b294 --- /dev/null +++ b/data/dr_pi.svg @@ -0,0 +1,109 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/data/dr_pi_toggled.svg b/data/dr_pi_toggled.svg new file mode 100644 index 0000000..0a96b37 --- /dev/null +++ b/data/dr_pi_toggled.svg @@ -0,0 +1,209 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/DR_pi.cpp b/src/DR_pi.cpp index 3a73568..4cdcb12 100644 --- a/src/DR_pi.cpp +++ b/src/DR_pi.cpp @@ -97,9 +97,16 @@ int DR_pi::Init(void) // This PlugIn needs a toolbar icon, so request its insertion if(m_bDRShowIcon) - m_leftclick_tool_id = InsertPlugInTool(_T(""), _img_DR, _img_DR, wxITEM_CHECK, - _("DR"), _T(""), NULL, - CALCULATOR_TOOL_POSITION, 0, this); + +#ifdef DR_USE_SVG + m_leftclick_tool_id = InsertPlugInToolSVG(_T("DR"), _svg_dr, _svg_dr, _svg_dr_toggled, + wxITEM_CHECK, _("DR"), _T(""), NULL, CALCULATOR_TOOL_POSITION, 0, this); +#else + m_leftclick_tool_id = InsertPlugInTool(_T(""), _img_DR, _img_DR, wxITEM_CHECK, + _("DR"), _T(""), NULL, + CALCULATOR_TOOL_POSITION, 0, this); +#endif + m_pDialog = NULL; diff --git a/src/DRgui_impl.cpp b/src/DRgui_impl.cpp index 3247a0a..a8698f8 100644 --- a/src/DRgui_impl.cpp +++ b/src/DRgui_impl.cpp @@ -48,8 +48,10 @@ Dlg::Dlg(wxWindow *parent, DR_pi *ppi) pPlugIn = ppi; pParent = parent; - wxIcon icon; - icon.CopyFromBitmap(*_img_DR); + wxString blank_name = *GetpSharedDataLocation() + + _T("plugins/DR_pi/data/blank.ico"); + + wxIcon icon(blank_name, wxBITMAP_TYPE_ICO); SetIcon(icon); } diff --git a/src/icons.cpp b/src/icons.cpp index 1caae6d..a015996 100644 --- a/src/icons.cpp +++ b/src/icons.cpp @@ -5,10 +5,16 @@ #endif #include #include "icons.h" +#include wxBitmap *_img_DR_pi; wxBitmap *_img_DR; +#ifdef DR_USE_SVG +#include "ocpn_plugin.h" +wxString _svg_dr; +wxString _svg_dr_toggled; +#endif void initialize_images(void) { @@ -21,5 +27,16 @@ void initialize_images(void) _img_DR = new wxBitmap(wxImage(sm)); } +#ifdef DR_USE_SVG + wxFileName fn; + fn.SetPath(*GetpSharedDataLocation()); + fn.AppendDir(_T("plugins")); + fn.AppendDir(_T("dr_pi")); + fn.AppendDir(_T("data")); + fn.SetFullName(_T("dr_pi.svg")); + _svg_dr = fn.GetFullPath(); + fn.SetFullName(_T("dr_pi_toggled.svg")); + _svg_dr_toggled = fn.GetFullPath(); +#endif return; } diff --git a/src/icons.h b/src/icons.h index 3161b47..f1a219b 100644 --- a/src/icons.h +++ b/src/icons.h @@ -12,5 +12,9 @@ extern void initialize_images(void); extern wxBitmap *_img_DR_pi; extern wxBitmap *_img_DR; +#ifdef DR_USE_SVG +extern wxString _svg_dr; +extern wxString _svg_dr_toggled; +#endif #endif /* ICONS_H */