9#include <wx/mimetype.h>
12#include "icons/defaultfile.xpm"
13#include "icons/closedfolder16x1632bpp.xpm"
14#include "icons/exe.xpm"
15#include "icons/doc.xpm"
17#include "../kernel/core/io/logger.hpp"
31 wxBitmap defaultfile(defaultfile_xpm);
34 wxBitmap closedfolder(closedfolder16x1632bpp_xpm);
38 wxBitmap document(doc_xpm);
43 wxIcon openfolder(programPath +
"/icons/folder.ico", wxBITMAP_TYPE_ICO);
47 wxIcon functions(programPath +
"/icons/fnc.ico", wxBITMAP_TYPE_ICO);
51 wxIcon commands(programPath +
"/icons/cmd.ico", wxBITMAP_TYPE_ICO);
55 wxIcon constants(programPath +
"/icons/cnst.ico", wxBITMAP_TYPE_ICO);
59 wxIcon methods(programPath +
"/icons/mthd.png", wxBITMAP_TYPE_PNG);
63 wxIcon NSCR(programPath +
"/icons/nscr.ico", wxBITMAP_TYPE_ICO);
68 wxIcon ICON(programPath +
"/icons/icon.ico", wxBITMAP_TYPE_ICO);
72 wxIcon NPRC(programPath +
"/icons/nprc.ico", wxBITMAP_TYPE_ICO);
77 wxIcon NDAT(programPath +
"/icons/ndat.ico", wxBITMAP_TYPE_ICO);
82 wxIcon NLYT(programPath +
"/icons/nlyt.ico", wxBITMAP_TYPE_ICO);
87 wxIcon NPKP(programPath +
"/icons/npkp.ico", wxBITMAP_TYPE_ICO);
92 wxIcon NHLP(programPath +
"/icons/nhlp.ico", wxBITMAP_TYPE_ICO);
97 wxIcon DAT(programPath +
"/icons/dat.ico", wxBITMAP_TYPE_ICO);
102 wxIcon JDX(programPath +
"/icons/jdx.ico", wxBITMAP_TYPE_ICO);
111 wxIcon LABX(programPath +
"/icons/labx.ico", wxBITMAP_TYPE_ICO);
116 wxIcon IBW(programPath +
"/icons/ibw.ico", wxBITMAP_TYPE_ICO);
121 wxIcon PDF(programPath +
"/icons/pdf.ico", wxBITMAP_TYPE_ICO);
126 wxIcon MATLAB(programPath +
"/icons/m.ico", wxBITMAP_TYPE_ICO);
146 wxBitmap exe(exe_xpm);
162 wxFileType* fileType = wxTheMimeTypesManager->GetFileTypeFromExtension(iconInfo);
164 if (fileType == NULL)
169 wxIconLocation iconLocation;
173 if (fileType->GetIcon(&iconLocation))
176 wxString fullname = iconLocation.GetFileName();
178 while (fullname.find(
'"') != std::string::npos)
179 fullname.erase(fullname.find(
'"'),1);
181 if (fullname == wxEmptyString || fullname ==
"%1" || fullname ==
"%2")
187 if (iconLocation.GetIndex())
188 fullname <<
_T(
';') << iconLocation.GetIndex();
198 std::vector<double> scaleFactors = {1.2, 1.25, 1.4, 1.5, 1.75, 1.8, 2.0};
201 for (
auto scale : scaleFactors)
203 if ((res = fileIcon.LoadFile(fullname, wxBITMAP_TYPE_ICO,
std::rint(16*scale),
std::rint(16*scale))))
216 int newIconIndex =
m_images->GetImageCount();
230 int currentExtensionIconNumber;
232 if (iconInfo == wxEmptyString)
253 return currentExtensionIconNumber;
260 wxIcon icon =
m_images->GetIcon(iconIndex);
262 iconBitmap.CopyFromIcon(icon);
265 wxPen pen(wxColour(
"navy"), 2);
268 dc.SelectObject(iconBitmap);
269 dc.DrawLine(0, 0, 15, 15);
270 dc.DrawLine(15, 0, 0, 15);
271 dc.SelectObject(wxNullBitmap);
274 disabledIcon.CopyFromBitmap(iconBitmap);
276 wxString disabledIconName = iconInfo +
"_disabled";
IconManager(const wxString &programPath)
void CreateDisabledIcon(wxString iconInfo)
bool AddIconToList(wxString iconInfo)
int GetIconIndex(wxString iconInfo)
wxImageList * GetImageList()
StringIntHashmap m_iconExtensionMapping
double m_imageScaleFactor
value_type rint(value_type v)