From 7630be6cf119aace99e848a59a51de012ae2ed58 Mon Sep 17 00:00:00 2001
From: enricoturri1966 <enricoturri@seznam.cz>
Date: Mon, 12 Oct 2020 10:44:50 +0200
Subject: [PATCH] Extract icon from executable files on Windows

---
 src/slic3r/GUI/MainFrame.cpp | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp
index 00933d1cb..87864a096 100644
--- a/src/slic3r/GUI/MainFrame.cpp
+++ b/src/slic3r/GUI/MainFrame.cpp
@@ -114,20 +114,16 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
 #if _WIN32
     {
 #if ENABLE_GCODE_DRAG_AND_DROP_GCODE_FILES
-        switch (wxGetApp().get_app_mode())
-        {
+        wxString src_path;
+        wxFileName::SplitPath(wxStandardPaths::Get().GetExecutablePath(), &src_path, nullptr, nullptr, wxPATH_NATIVE);
+        switch (wxGetApp().get_app_mode()) {
         default:
-        case GUI_App::EAppMode::Editor:
-        {
-            SetIcon(wxIcon(Slic3r::var("PrusaSlicer.ico"), wxBITMAP_TYPE_ICO));
-            break;
-        }
-        case GUI_App::EAppMode::GCodeViewer:
-        {
-            SetIcon(wxIcon(Slic3r::var("PrusaSlicer-gcodeviewer.ico"), wxBITMAP_TYPE_ICO));
-            break;
-        }
+        case GUI_App::EAppMode::Editor:      { src_path += "\\prusa-slicer.exe"; break; }
+        case GUI_App::EAppMode::GCodeViewer: { src_path += "\\prusa-gcodeviewer.exe"; break; }
         }
+        wxIconLocation icon_location;
+        icon_location.SetFileName(src_path);
+        SetIcon(icon_location);
 #else
         TCHAR szExeFileName[MAX_PATH];
         GetModuleFileName(nullptr, szExeFileName, MAX_PATH);