From a48439992d4b1c896dd0beaff91d0a14361032b9 Mon Sep 17 00:00:00 2001 From: B Stack Date: Sun, 10 Feb 2019 16:47:23 -0500 Subject: 10.9 --- wx+/app_main.h | 0 wx+/async_task.h | 5 +++-- wx+/bitmap_button.h | 4 ++-- wx+/choice_enum.h | 0 wx+/context_menu.h | 0 wx+/dc.h | 4 ++-- wx+/file_drop.cpp | 0 wx+/file_drop.h | 0 wx+/focus.h | 0 wx+/font_size.h | 0 wx+/graph.cpp | 0 wx+/graph.h | 0 wx+/grid.cpp | 0 wx+/grid.h | 0 wx+/image_holder.h | 0 wx+/image_resources.cpp | 0 wx+/image_resources.h | 0 wx+/image_tools.cpp | 0 wx+/image_tools.h | 13 +++++++++++++ wx+/no_flicker.h | 0 wx+/popup_dlg.cpp | 0 wx+/popup_dlg.h | 0 wx+/popup_dlg_generated.cpp | 0 wx+/popup_dlg_generated.h | 0 wx+/rtl.h | 0 wx+/std_button_layout.h | 0 wx+/toggle_button.h | 0 wx+/tooltip.cpp | 0 wx+/tooltip.h | 0 29 files changed, 20 insertions(+), 6 deletions(-) mode change 100755 => 100644 wx+/app_main.h mode change 100755 => 100644 wx+/async_task.h mode change 100755 => 100644 wx+/bitmap_button.h mode change 100755 => 100644 wx+/choice_enum.h mode change 100755 => 100644 wx+/context_menu.h mode change 100755 => 100644 wx+/dc.h mode change 100755 => 100644 wx+/file_drop.cpp mode change 100755 => 100644 wx+/file_drop.h mode change 100755 => 100644 wx+/focus.h mode change 100755 => 100644 wx+/font_size.h mode change 100755 => 100644 wx+/graph.cpp mode change 100755 => 100644 wx+/graph.h mode change 100755 => 100644 wx+/grid.cpp mode change 100755 => 100644 wx+/grid.h mode change 100755 => 100644 wx+/image_holder.h mode change 100755 => 100644 wx+/image_resources.cpp mode change 100755 => 100644 wx+/image_resources.h mode change 100755 => 100644 wx+/image_tools.cpp mode change 100755 => 100644 wx+/image_tools.h mode change 100755 => 100644 wx+/no_flicker.h mode change 100755 => 100644 wx+/popup_dlg.cpp mode change 100755 => 100644 wx+/popup_dlg.h mode change 100755 => 100644 wx+/popup_dlg_generated.cpp mode change 100755 => 100644 wx+/popup_dlg_generated.h mode change 100755 => 100644 wx+/rtl.h mode change 100755 => 100644 wx+/std_button_layout.h mode change 100755 => 100644 wx+/toggle_button.h mode change 100755 => 100644 wx+/tooltip.cpp mode change 100755 => 100644 wx+/tooltip.h (limited to 'wx+') diff --git a/wx+/app_main.h b/wx+/app_main.h old mode 100755 new mode 100644 diff --git a/wx+/async_task.h b/wx+/async_task.h old mode 100755 new mode 100644 index 074f5337..04eac61c --- a/wx+/async_task.h +++ b/wx+/async_task.h @@ -115,7 +115,7 @@ private: class AsyncGuiQueue : private wxEvtHandler { public: - AsyncGuiQueue() { timer_.Connect(wxEVT_TIMER, wxEventHandler(AsyncGuiQueue::onTimerEvent), nullptr, this); } + AsyncGuiQueue(int pollingMs = 50) : pollingMs_(pollingMs) { timer_.Connect(wxEVT_TIMER, wxEventHandler(AsyncGuiQueue::onTimerEvent), nullptr, this); } template void processAsync(Fun&& evalAsync, Fun2&& evalOnGui) @@ -123,7 +123,7 @@ public: asyncTasks_.add(std::forward(evalAsync), std::forward(evalOnGui)); if (!timer_.IsRunning()) - timer_.Start(50 /*unit: [ms]*/); + timer_.Start(pollingMs_ /*unit: [ms]*/); } private: @@ -134,6 +134,7 @@ private: timer_.Stop(); } + const int pollingMs_; impl::AsyncTasks asyncTasks_; wxTimer timer_; //don't use wxWidgets' idle handling => repeated idle requests/consumption hogs 100% cpu! }; diff --git a/wx+/bitmap_button.h b/wx+/bitmap_button.h old mode 100755 new mode 100644 index 738a62ff..bcbc7328 --- a/wx+/bitmap_button.h +++ b/wx+/bitmap_button.h @@ -56,8 +56,8 @@ void setBitmapTextLabel(wxBitmapButton& btn, const wxImage& img, const wxString& wxImage dynImage = createImageFromText(text, btn.GetFont(), btn.GetForegroundColour()); if (img.IsOk()) dynImage = btn.GetLayoutDirection() != wxLayout_RightToLeft ? - stackImages(img, dynImage, ImageStackLayout::HORIZONTAL, ImageStackAlignment::CENTER, gap) : - stackImages(dynImage, img, ImageStackLayout::HORIZONTAL, ImageStackAlignment::CENTER, gap); + stackImages(img, dynImage, ImageStackLayout::HORIZONTAL, ImageStackAlignment::CENTER, gap) : + stackImages(dynImage, img, ImageStackLayout::HORIZONTAL, ImageStackAlignment::CENTER, gap); //SetMinSize() instead of SetSize() is needed here for wxWindows layout determination to work corretly const int defaultHeight = wxButton::GetDefaultSize().GetHeight(); diff --git a/wx+/choice_enum.h b/wx+/choice_enum.h old mode 100755 new mode 100644 diff --git a/wx+/context_menu.h b/wx+/context_menu.h old mode 100755 new mode 100644 diff --git a/wx+/dc.h b/wx+/dc.h old mode 100755 new mode 100644 index e1d803cb..311080dd --- a/wx+/dc.h +++ b/wx+/dc.h @@ -52,9 +52,9 @@ inline int fastFromDIP(int d) //like wxWindow::FromDIP (but tied to primary monitor and buffered) { -#ifdef wxHAVE_DPI_INDEPENDENT_PIXELS //pulled from wx/window.h +#ifdef wxHAVE_DPI_INDEPENDENT_PIXELS //pulled from wx/window.h: https://github.com/wxWidgets/wxWidgets/blob/master/include/wx/window.h#L2029 return d; //e.g. macOS, GTK3 -#else +#else //https://github.com/wxWidgets/wxWidgets/blob/master/src/common/wincmn.cpp#L2865 assert(wxTheApp); //only call after wxWidgets was initalized! static const int dpiY = wxScreenDC().GetPPI().y; //perf: buffering for calls to ::GetDeviceCaps() needed!? const int defaultDpi = 96; diff --git a/wx+/file_drop.cpp b/wx+/file_drop.cpp old mode 100755 new mode 100644 diff --git a/wx+/file_drop.h b/wx+/file_drop.h old mode 100755 new mode 100644 diff --git a/wx+/focus.h b/wx+/focus.h old mode 100755 new mode 100644 diff --git a/wx+/font_size.h b/wx+/font_size.h old mode 100755 new mode 100644 diff --git a/wx+/graph.cpp b/wx+/graph.cpp old mode 100755 new mode 100644 diff --git a/wx+/graph.h b/wx+/graph.h old mode 100755 new mode 100644 diff --git a/wx+/grid.cpp b/wx+/grid.cpp old mode 100755 new mode 100644 diff --git a/wx+/grid.h b/wx+/grid.h old mode 100755 new mode 100644 diff --git a/wx+/image_holder.h b/wx+/image_holder.h old mode 100755 new mode 100644 diff --git a/wx+/image_resources.cpp b/wx+/image_resources.cpp old mode 100755 new mode 100644 diff --git a/wx+/image_resources.h b/wx+/image_resources.h old mode 100755 new mode 100644 diff --git a/wx+/image_tools.cpp b/wx+/image_tools.cpp old mode 100755 new mode 100644 diff --git a/wx+/image_tools.h b/wx+/image_tools.h old mode 100755 new mode 100644 index bef4cb67..e1a6953c --- a/wx+/image_tools.h +++ b/wx+/image_tools.h @@ -52,6 +52,8 @@ void convertToVanillaImage(wxImage& img); //add alpha channel if missing + remov //wxColor hsvColor(double h, double s, double v); //h within [0, 360), s, v within [0, 1] +wxImage shrinkImage(const wxImage& img, int requestedSize); + inline wxImage getTransparentPixel() @@ -179,6 +181,17 @@ bool isEqual(const wxBitmap& lhs, const wxBitmap& rhs) return true; } + +inline +wxImage shrinkImage(const wxImage& img, int requestedSize) +{ + const int maxExtent = std::max(img.GetWidth(), img.GetHeight()); + assert(requestedSize <= maxExtent); + return img.Scale(img.GetWidth () * requestedSize / maxExtent, + img.GetHeight() * requestedSize / maxExtent, wxIMAGE_QUALITY_BILINEAR); //looks sharper than wxIMAGE_QUALITY_HIGH! +} + + /* inline wxColor gradient(const wxColor& from, const wxColor& to, double fraction) diff --git a/wx+/no_flicker.h b/wx+/no_flicker.h old mode 100755 new mode 100644 diff --git a/wx+/popup_dlg.cpp b/wx+/popup_dlg.cpp old mode 100755 new mode 100644 diff --git a/wx+/popup_dlg.h b/wx+/popup_dlg.h old mode 100755 new mode 100644 diff --git a/wx+/popup_dlg_generated.cpp b/wx+/popup_dlg_generated.cpp old mode 100755 new mode 100644 diff --git a/wx+/popup_dlg_generated.h b/wx+/popup_dlg_generated.h old mode 100755 new mode 100644 diff --git a/wx+/rtl.h b/wx+/rtl.h old mode 100755 new mode 100644 diff --git a/wx+/std_button_layout.h b/wx+/std_button_layout.h old mode 100755 new mode 100644 diff --git a/wx+/toggle_button.h b/wx+/toggle_button.h old mode 100755 new mode 100644 diff --git a/wx+/tooltip.cpp b/wx+/tooltip.cpp old mode 100755 new mode 100644 diff --git a/wx+/tooltip.h b/wx+/tooltip.h old mode 100755 new mode 100644 -- cgit