mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-21 12:15:21 +00:00
Remove pre-wxWidgets 3.1.3 DPI fallback code
Since we now target wxWidgets 3.3, the custom DPI change event workaround (DpiChangedEvent, EVT_DPI_CHANGED_SLICER, register_win32_dpi_event) is dead code. wxWidgets 3.1.3+ provides native wxEVT_DPI_CHANGED / wxDPIChangedEvent which is already wired up in the "true" branch of the version guards. Removes: - DpiChangedEvent struct and EVT_DPI_CHANGED_SLICER declaration/definition - register_win32_dpi_event() function and its call site - All associated #if !wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3) guards
This commit is contained in:
@@ -633,24 +633,6 @@ wxString file_wildcards(FileType file_type, const std::string &custom_extension)
|
||||
static std::string libslic3r_translate_callback(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str().data(); }
|
||||
|
||||
#ifdef WIN32
|
||||
#if !wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
|
||||
static void register_win32_dpi_event()
|
||||
{
|
||||
enum { WM_DPICHANGED_ = 0x02e0 };
|
||||
|
||||
wxWindow::MSWRegisterMessageHandler(WM_DPICHANGED_, [](wxWindow *win, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) {
|
||||
const int dpi = wParam & 0xffff;
|
||||
const auto rect = reinterpret_cast<PRECT>(lParam);
|
||||
const wxRect wxrect(wxPoint(rect->top, rect->left), wxPoint(rect->bottom, rect->right));
|
||||
|
||||
DpiChangedEvent evt(EVT_DPI_CHANGED_SLICER, dpi, wxrect);
|
||||
win->GetEventHandler()->AddPendingEvent(evt);
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
#endif // !wxVERSION_EQUAL_OR_GREATER_THAN
|
||||
|
||||
static GUID GUID_DEVINTERFACE_HID = { 0x4D1E55B2, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 };
|
||||
|
||||
static void register_win32_device_notification_event()
|
||||
@@ -3094,9 +3076,6 @@ bool GUI_App::on_init_inner()
|
||||
//}
|
||||
|
||||
#ifdef WIN32
|
||||
#if !wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
|
||||
register_win32_dpi_event();
|
||||
#endif // !wxVERSION_EQUAL_OR_GREATER_THAN
|
||||
register_win32_device_notification_event();
|
||||
#endif // WIN32
|
||||
|
||||
|
||||
@@ -148,10 +148,6 @@ void on_window_geometry(wxTopLevelWindow *tlw, std::function<void()> callback)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
|
||||
wxDEFINE_EVENT(EVT_DPI_CHANGED_SLICER, DpiChangedEvent);
|
||||
#endif // !wxVERSION_EQUAL_OR_GREATER_THAN
|
||||
|
||||
#ifdef _WIN32
|
||||
template<class F> typename F::FN winapi_get_function(const wchar_t *dll, const char *fn_name) {
|
||||
static HINSTANCE dll_handle = LoadLibraryExW(dll, nullptr, 0);
|
||||
|
||||
@@ -81,24 +81,6 @@ void update_dark_config();
|
||||
void update_dark_ui(wxWindow* window);
|
||||
#endif
|
||||
|
||||
#if !wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
|
||||
struct DpiChangedEvent : public wxEvent {
|
||||
int dpi;
|
||||
wxRect rect;
|
||||
|
||||
DpiChangedEvent(wxEventType eventType, int dpi, wxRect rect)
|
||||
: wxEvent(0, eventType), dpi(dpi), rect(rect)
|
||||
{}
|
||||
|
||||
virtual wxEvent *Clone() const
|
||||
{
|
||||
return new DpiChangedEvent(*this);
|
||||
}
|
||||
};
|
||||
|
||||
wxDECLARE_EVENT(EVT_DPI_CHANGED_SLICER, DpiChangedEvent);
|
||||
#endif // !wxVERSION_EQUAL_OR_GREATER_THAN
|
||||
|
||||
extern std::deque<wxDialog*> dialogStack;
|
||||
|
||||
template<class P> class DPIAware : public P
|
||||
@@ -136,26 +118,12 @@ public:
|
||||
// recalc_font();
|
||||
|
||||
#ifndef __WXOSX__
|
||||
#if wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
|
||||
this->Bind(wxEVT_DPI_CHANGED, [this](wxDPIChangedEvent& evt) {
|
||||
m_scale_factor = (float)evt.GetNewDPI().x / (float)DPI_DEFAULT;
|
||||
m_new_font_point_size = get_default_font_for_dpi(this, evt.GetNewDPI().x).GetPointSize();
|
||||
if (m_can_rescale && (m_force_rescale || is_new_scale_factor()))
|
||||
rescale(wxRect());
|
||||
});
|
||||
#else
|
||||
this->Bind(EVT_DPI_CHANGED_SLICER, [this](const DpiChangedEvent& evt) {
|
||||
m_scale_factor = (float)evt.dpi / (float)DPI_DEFAULT;
|
||||
|
||||
m_new_font_point_size = get_default_font_for_dpi(this, evt.dpi).GetPointSize();
|
||||
|
||||
if (!m_can_rescale)
|
||||
return;
|
||||
|
||||
if (m_force_rescale || is_new_scale_factor())
|
||||
rescale(evt.rect);
|
||||
});
|
||||
#endif // wxVERSION_EQUAL_OR_GREATER_THAN
|
||||
#endif // no __WXOSX__
|
||||
|
||||
this->Bind(wxEVT_MOVE_START, [this](wxMoveEvent& event)
|
||||
|
||||
Reference in New Issue
Block a user