Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

De-duplicate code #511

Merged
merged 1 commit into from
Sep 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/myframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,9 @@ struct MyFrame : wxFrame {
icons.AddIcon(iconbig);
SetIcons(icons);

wxImage foldiconi;
RenderFolderIcon();
line_nw.LoadFile(GetDataPath(L"images/render/line_nw.png"), wxBITMAP_TYPE_PNG);
line_sw.LoadFile(GetDataPath(L"images/render/line_sw.png"), wxBITMAP_TYPE_PNG);
foldiconi.LoadFile(GetDataPath(L"images/nuvola/fold.png"));
foldicon = wxBitmap(foldiconi);
ScaleBitmap(foldicon, FromDIP(1.0) / 3.0, foldicon);

imagepath = GetDataPath("images/nuvola/dropdown/");

Expand Down Expand Up @@ -1130,6 +1127,13 @@ struct MyFrame : wxFrame {
ReFocus();
}

void RenderFolderIcon() {
wxImage foldiconi;
foldiconi.LoadFile(GetDataPath(L"images/nuvola/fold.png"));
foldicon = wxBitmap(foldiconi);
ScaleBitmap(foldicon, FromDIP(1.0) / 3.0, foldicon);
}

void OnDPIChanged(wxDPIChangedEvent &dce) {
{ // block all other events until we finished preparing
wxEventBlocker blocker(this);
Expand All @@ -1144,10 +1148,7 @@ struct MyFrame : wxFrame {
}, sys->imagelist[i]);
}
} // wait until all tasks are finished
wxImage foldiconi;
foldiconi.LoadFile(GetDataPath(L"images/nuvola/fold.png"));
foldicon = wxBitmap(foldiconi);
ScaleBitmap(foldicon, FromDIP(1.0) / 3.0, foldicon);
RenderFolderIcon();
if (nb) {
loop(i, nb->GetPageCount()) {
TSCanvas *p = (TSCanvas *)nb->GetPage(i);
Expand Down