mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-05 16:51:07 -07:00
Upgrade wxWidgets to 3.2.1
Based on prusa3d/PrusaSlicer@9a7e024 Co-authored-by: tamasmeszaros <meszaros.q@gmail.com>
This commit is contained in:
parent
261393b649
commit
23022456b8
13 changed files with 668 additions and 4451 deletions
1
deps/CMakeLists.txt
vendored
1
deps/CMakeLists.txt
vendored
|
|
@ -235,6 +235,7 @@ endif ()
|
|||
|
||||
include(JPEG/JPEG.cmake)
|
||||
include(TIFF/TIFF.cmake)
|
||||
include(NanoSVG/NanoSVG.cmake)
|
||||
include(wxWidgets/wxWidgets.cmake)
|
||||
include(OCCT/OCCT.cmake)
|
||||
include(FREETYPE/FREETYPE.cmake)
|
||||
|
|
|
|||
4
deps/NanoSVG/NanoSVG.cmake
vendored
Normal file
4
deps/NanoSVG/NanoSVG.cmake
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
orcaslicer_add_cmake_project(NanoSVG
|
||||
URL https://github.com/memononen/nanosvg/archive/4c8f0139b62c6e7faa3b67ce1fbe6e63590ed148.zip
|
||||
URL_HASH SHA256=584e084af1a75bf633f79753ce2f6f6ec8686002ca27f35f1037c25675fecfb6
|
||||
)
|
||||
640
deps/wxWidgets/0001-patch-v3.2.1-for-OrcaSlicer.patch
vendored
Normal file
640
deps/wxWidgets/0001-patch-v3.2.1-for-OrcaSlicer.patch
vendored
Normal file
|
|
@ -0,0 +1,640 @@
|
|||
From c0d9541c8c2d729dd7c439a16ae34ffd7f292abc Mon Sep 17 00:00:00 2001
|
||||
From: Ocraftyone <Ocraftyone@users.noreply.github.com>
|
||||
Date: Sat, 4 Nov 2023 06:40:22 -0400
|
||||
Subject: [PATCH] patch v3.2.1 for OrcaSlicer
|
||||
|
||||
---
|
||||
build/cmake/lib/webview/CMakeLists.txt | 4 +-
|
||||
include/wx/fontutil.h | 15 +++++++-
|
||||
include/wx/gdicmn.h | 3 ++
|
||||
include/wx/generic/grid.h | 4 +-
|
||||
include/wx/msw/font.h | 2 +-
|
||||
include/wx/msw/tooltip.h | 4 +-
|
||||
include/wx/osx/app.h | 2 +-
|
||||
src/common/combocmn.cpp | 11 +++++-
|
||||
src/common/datavcmn.cpp | 6 ++-
|
||||
src/common/dcbufcmn.cpp | 6 +++
|
||||
src/common/gdicmn.cpp | 14 +++++++
|
||||
src/generic/grid.cpp | 50 ++++++++++++++++++++-----
|
||||
src/msw/bmpcbox.cpp | 9 ++++-
|
||||
src/msw/font.cpp | 14 +++----
|
||||
src/msw/menuitem.cpp | 2 +
|
||||
src/msw/window.cpp | 52 +++++++++++++++++---------
|
||||
src/osx/cocoa/dataview.mm | 26 +++++++++++--
|
||||
src/osx/cocoa/settings.mm | 6 +--
|
||||
18 files changed, 177 insertions(+), 53 deletions(-)
|
||||
|
||||
diff --git a/build/cmake/lib/webview/CMakeLists.txt b/build/cmake/lib/webview/CMakeLists.txt
|
||||
index 085381d785..62146abc04 100644
|
||||
--- a/build/cmake/lib/webview/CMakeLists.txt
|
||||
+++ b/build/cmake/lib/webview/CMakeLists.txt
|
||||
@@ -46,9 +46,9 @@ if(APPLE)
|
||||
elseif(WXMSW)
|
||||
if(wxUSE_WEBVIEW_EDGE)
|
||||
# Update the following variables if updating WebView2 SDK
|
||||
- set(WEBVIEW2_VERSION "1.0.705.50")
|
||||
+ set(WEBVIEW2_VERSION "1.0.1418.22")
|
||||
set(WEBVIEW2_URL "https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/${WEBVIEW2_VERSION}")
|
||||
- set(WEBVIEW2_SHA256 "6a34bb553e18cfac7297b4031f3eac2558e439f8d16a45945c22945ac404105d")
|
||||
+ set(WEBVIEW2_SHA256 "51d2ef56196e2a9d768a6843385bcb9c6baf9ed34b2603ddb074fb4995543a99")
|
||||
|
||||
set(WEBVIEW2_DEFAULT_PACKAGE_DIR "${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2.${WEBVIEW2_VERSION}")
|
||||
|
||||
diff --git a/include/wx/fontutil.h b/include/wx/fontutil.h
|
||||
index 30529db8ce..e6a12366d5 100644
|
||||
--- a/include/wx/fontutil.h
|
||||
+++ b/include/wx/fontutil.h
|
||||
@@ -294,7 +294,11 @@ public:
|
||||
wxFontEncoding GetEncoding() const;
|
||||
|
||||
void SetPointSize(int pointsize);
|
||||
- void SetFractionalPointSize(double pointsize);
|
||||
+ void SetFractionalPointSize(double pointsize
|
||||
+#if defined(__WXMSW__)
|
||||
+ , const wxWindow *window = nullptr
|
||||
+#endif
|
||||
+ );
|
||||
void SetPixelSize(const wxSize& pixelSize);
|
||||
void SetStyle(wxFontStyle style);
|
||||
void SetNumericWeight(int weight);
|
||||
@@ -307,12 +311,19 @@ public:
|
||||
|
||||
// Helper used in many ports: use the normal font size if the input is
|
||||
// negative, as we handle -1 as meaning this for compatibility.
|
||||
- void SetSizeOrDefault(double size)
|
||||
+ void SetSizeOrDefault(double size
|
||||
+#if defined(__WXMSW__)
|
||||
+ , const wxWindow *window = nullptr
|
||||
+#endif
|
||||
+ )
|
||||
{
|
||||
SetFractionalPointSize
|
||||
(
|
||||
size < 0 ? wxNORMAL_FONT->GetFractionalPointSize()
|
||||
: size
|
||||
+#if defined(__WXMSW__)
|
||||
+ ,window
|
||||
+#endif
|
||||
);
|
||||
}
|
||||
|
||||
diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h
|
||||
index 2f5f8ee99f..39e9317d40 100644
|
||||
--- a/include/wx/gdicmn.h
|
||||
+++ b/include/wx/gdicmn.h
|
||||
@@ -38,6 +38,7 @@ class WXDLLIMPEXP_FWD_CORE wxRegion;
|
||||
class WXDLLIMPEXP_FWD_BASE wxString;
|
||||
class WXDLLIMPEXP_FWD_CORE wxIconBundle;
|
||||
class WXDLLIMPEXP_FWD_CORE wxPoint;
|
||||
+class WXDLLIMPEXP_FWD_CORE wxWindow;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// constants
|
||||
@@ -1106,7 +1107,9 @@ extern int WXDLLIMPEXP_CORE wxDisplayDepth();
|
||||
|
||||
// get the display size
|
||||
extern void WXDLLIMPEXP_CORE wxDisplaySize(int *width, int *height);
|
||||
+extern void WXDLLIMPEXP_CORE wxDisplaySize(const wxWindow *window, int *width, int *height);
|
||||
extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySize();
|
||||
+extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySize(const wxWindow *window);
|
||||
extern void WXDLLIMPEXP_CORE wxDisplaySizeMM(int *width, int *height);
|
||||
extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySizeMM();
|
||||
extern wxSize WXDLLIMPEXP_CORE wxGetDisplayPPI();
|
||||
diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h
|
||||
index 1bd58bbf04..903cb81319 100644
|
||||
--- a/include/wx/generic/grid.h
|
||||
+++ b/include/wx/generic/grid.h
|
||||
@@ -3029,9 +3029,11 @@ private:
|
||||
// Update the width/height of the column/row being drag-resized.
|
||||
// Should be only called when m_dragRowOrCol != -1, i.e. dragging is
|
||||
// actually in progress.
|
||||
+ //BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
void DoGridDragResize(const wxPoint& position,
|
||||
const wxGridOperations& oper,
|
||||
- wxGridWindow* gridWindow);
|
||||
+ wxGridWindow* gridWindow,
|
||||
+ CursorMode mode);
|
||||
|
||||
// process different clicks on grid cells
|
||||
void DoGridCellLeftDown(wxMouseEvent& event,
|
||||
diff --git a/include/wx/msw/font.h b/include/wx/msw/font.h
|
||||
index 0f9768b44e..094d774918 100644
|
||||
--- a/include/wx/msw/font.h
|
||||
+++ b/include/wx/msw/font.h
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
// ctors and such
|
||||
wxFont() { }
|
||||
|
||||
- wxFont(const wxFontInfo& info);
|
||||
+ wxFont(const wxFontInfo& info, const wxWindow *window = nullptr);
|
||||
|
||||
wxFont(int size,
|
||||
wxFontFamily family,
|
||||
diff --git a/include/wx/msw/tooltip.h b/include/wx/msw/tooltip.h
|
||||
index 4c3be08cec..96fb378d01 100644
|
||||
--- a/include/wx/msw/tooltip.h
|
||||
+++ b/include/wx/msw/tooltip.h
|
||||
@@ -91,10 +91,10 @@ private:
|
||||
// the one and only one tooltip control we use - never access it directly
|
||||
// but use GetToolTipCtrl() which will create it when needed
|
||||
static WXHWND ms_hwndTT;
|
||||
-
|
||||
+public:
|
||||
// create the tooltip ctrl if it doesn't exist yet and return its HWND
|
||||
static WXHWND GetToolTipCtrl();
|
||||
-
|
||||
+private:
|
||||
// to be used in wxModule for deleting tooltip ctrl window when exiting mainloop
|
||||
static void DeleteToolTipCtrl();
|
||||
|
||||
diff --git a/include/wx/osx/app.h b/include/wx/osx/app.h
|
||||
index 317a0ca96f..58014ec1d4 100644
|
||||
--- a/include/wx/osx/app.h
|
||||
+++ b/include/wx/osx/app.h
|
||||
@@ -161,7 +161,7 @@ private:
|
||||
|
||||
public:
|
||||
bool OSXInitWasCalled() { return m_inited; }
|
||||
- void OSXStoreOpenFiles(const wxArrayString &files ) { m_openFiles = files ; }
|
||||
+ virtual void OSXStoreOpenFiles(const wxArrayString &files ) { m_openFiles = files ; }
|
||||
void OSXStorePrintFiles(const wxArrayString &files ) { m_printFiles = files ; }
|
||||
void OSXStoreOpenURL(const wxString &url ) { m_getURL = url ; }
|
||||
#endif
|
||||
diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp
|
||||
index 80408c6677..aa07caebdc 100644
|
||||
--- a/src/common/combocmn.cpp
|
||||
+++ b/src/common/combocmn.cpp
|
||||
@@ -2061,6 +2061,9 @@ void wxComboCtrlBase::ShowPopup()
|
||||
|
||||
SetFocus();
|
||||
|
||||
+ //int displayIdx = wxDisplay::GetFromWindow(this);
|
||||
+ //wxRect displayRect = wxDisplay(displayIdx != wxNOT_FOUND ? displayIdx : 0u).GetGeometry();
|
||||
+
|
||||
// Space above and below
|
||||
int screenHeight;
|
||||
wxPoint scrPos;
|
||||
@@ -2183,9 +2186,13 @@ void wxComboCtrlBase::ShowPopup()
|
||||
|
||||
int showFlags = CanDeferShow;
|
||||
|
||||
- if ( spaceBelow < szp.y )
|
||||
+ int anchorSideVertical = m_anchorSide & (wxUP | wxDOWN);
|
||||
+ if (// Pop up as asked for by the library user.
|
||||
+ (anchorSideVertical & wxUP) ||
|
||||
+ // Automatic: Pop up if it does not fit down.
|
||||
+ (anchorSideVertical == 0 && spaceBelow < szp.y ))
|
||||
{
|
||||
- popupY = scrPos.y - szp.y;
|
||||
+ popupY = scrPos.y - szp.y + displayRect.GetTop();
|
||||
showFlags |= ShowAbove;
|
||||
}
|
||||
|
||||
diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp
|
||||
index 0a1e43ad51..6c492aedab 100644
|
||||
--- a/src/common/datavcmn.cpp
|
||||
+++ b/src/common/datavcmn.cpp
|
||||
@@ -1334,7 +1334,11 @@ wxDataViewItem wxDataViewCtrlBase::GetSelection() const
|
||||
|
||||
wxDataViewItemArray selections;
|
||||
GetSelections(selections);
|
||||
- return selections[0];
|
||||
+ // BBS
|
||||
+ if (!selections.empty())
|
||||
+ return selections[0];
|
||||
+ else
|
||||
+ return wxDataViewItem(0);
|
||||
}
|
||||
|
||||
namespace
|
||||
diff --git a/src/common/dcbufcmn.cpp b/src/common/dcbufcmn.cpp
|
||||
index 9b1c1f3159..ef5865ed4b 100644
|
||||
--- a/src/common/dcbufcmn.cpp
|
||||
+++ b/src/common/dcbufcmn.cpp
|
||||
@@ -83,9 +83,15 @@ private:
|
||||
const double scale = dc ? dc->GetContentScaleFactor() : 1.0;
|
||||
wxBitmap* const buffer = new wxBitmap;
|
||||
|
||||
+#if __WXMSW__
|
||||
+ // we must always return a valid bitmap but creating a bitmap of
|
||||
+ // size 0 would fail, so create a 1*1 bitmap in this case
|
||||
+ buffer->Create(wxMax(w, 1), wxMax(h, 1), 24);
|
||||
+#else
|
||||
// we must always return a valid bitmap but creating a bitmap of
|
||||
// size 0 would fail, so create a 1*1 bitmap in this case
|
||||
buffer->CreateWithDIPSize(wxMax(w, 1), wxMax(h, 1), scale);
|
||||
+#endif
|
||||
|
||||
return buffer;
|
||||
}
|
||||
diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp
|
||||
index db8a01f961..162c1ce2dc 100644
|
||||
--- a/src/common/gdicmn.cpp
|
||||
+++ b/src/common/gdicmn.cpp
|
||||
@@ -863,11 +863,25 @@ void wxDisplaySize(int *width, int *height)
|
||||
*height = size.y;
|
||||
}
|
||||
|
||||
+void wxDisplaySize(const wxWindow *window, int *width, int *height)
|
||||
+{
|
||||
+ const wxSize size = wxGetDisplaySize(window);
|
||||
+ if ( width )
|
||||
+ *width = size.x;
|
||||
+ if ( height )
|
||||
+ *height = size.y;
|
||||
+}
|
||||
+
|
||||
wxSize wxGetDisplaySize()
|
||||
{
|
||||
return wxDisplay().GetGeometry().GetSize();
|
||||
}
|
||||
|
||||
+wxSize wxGetDisplaySize(const wxWindow *window)
|
||||
+{
|
||||
+ return window ? wxDisplay(window).GetGeometry().GetSize() : wxDisplay().GetGeometry().GetSize();
|
||||
+}
|
||||
+
|
||||
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
||||
{
|
||||
const wxRect rect = wxGetClientDisplayRect();
|
||||
diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp
|
||||
index ed3d988994..d71cda122d 100644
|
||||
--- a/src/generic/grid.cpp
|
||||
+++ b/src/generic/grid.cpp
|
||||
@@ -4068,7 +4068,8 @@ void wxGrid::ProcessRowColLabelMouseEvent( const wxGridOperations &oper, wxMouse
|
||||
{
|
||||
if ( m_cursorMode == oper.GetCursorModeResize() )
|
||||
{
|
||||
- DoGridDragResize(event.GetPosition(), oper, gridWindow);
|
||||
+ //BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
+ DoGridDragResize(event.GetPosition(), oper, gridWindow, m_cursorMode);
|
||||
}
|
||||
else if ( m_cursorMode == oper.GetCursorModeSelect() && line >=0 )
|
||||
{
|
||||
@@ -4691,12 +4692,14 @@ bool wxGrid::DoGridDragEvent(wxMouseEvent& event,
|
||||
|
||||
case WXGRID_CURSOR_RESIZE_ROW:
|
||||
if ( m_dragRowOrCol != -1 )
|
||||
- DoGridDragResize(event.GetPosition(), wxGridRowOperations(), gridWindow);
|
||||
+ //BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
+ DoGridDragResize(event.GetPosition(), wxGridRowOperations(), gridWindow, WXGRID_CURSOR_RESIZE_ROW);
|
||||
break;
|
||||
|
||||
case WXGRID_CURSOR_RESIZE_COL:
|
||||
if ( m_dragRowOrCol != -1 )
|
||||
- DoGridDragResize(event.GetPosition(), wxGridColumnOperations(), gridWindow);
|
||||
+ //BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
+ DoGridDragResize(event.GetPosition(), wxGridColumnOperations(), gridWindow, WXGRID_CURSOR_RESIZE_COL);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -4791,6 +4794,8 @@ wxGrid::DoGridCellLeftDown(wxMouseEvent& event,
|
||||
case wxGridSelectCells:
|
||||
case wxGridSelectRowsOrColumns:
|
||||
// nothing to do in these cases
|
||||
+ //BBS: select this cell when first click
|
||||
+ m_selection->SelectBlock(coords.GetRow(), coords.GetCol(), coords.GetRow(), coords.GetCol(), event);
|
||||
break;
|
||||
|
||||
case wxGridSelectRows:
|
||||
@@ -5049,9 +5054,11 @@ void wxGrid::ProcessGridCellMouseEvent(wxMouseEvent& event, wxGridWindow *eventG
|
||||
}
|
||||
}
|
||||
|
||||
+//BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
void wxGrid::DoGridDragResize(const wxPoint& position,
|
||||
const wxGridOperations& oper,
|
||||
- wxGridWindow* gridWindow)
|
||||
+ wxGridWindow* gridWindow,
|
||||
+ CursorMode mode)
|
||||
{
|
||||
wxCHECK_RET( m_dragRowOrCol != -1,
|
||||
"shouldn't be called when not drag resizing" );
|
||||
@@ -5064,10 +5071,28 @@ void wxGrid::DoGridDragResize(const wxPoint& position,
|
||||
// orthogonal direction.
|
||||
const int linePos = oper.Dual().Select(logicalPos);
|
||||
|
||||
- const int lineStart = oper.GetLineStartPos(this, m_dragRowOrCol);
|
||||
- oper.SetLineSize(this, m_dragRowOrCol,
|
||||
+ //BBS: add logic for resize multiplexed cols
|
||||
+ if (mode == WXGRID_CURSOR_RESIZE_COL) {
|
||||
+ int col_to_resize = m_dragRowOrCol;
|
||||
+ int num_rows, num_cols;
|
||||
+ this->GetCellSize(0, m_dragRowOrCol, &num_rows, &num_cols);
|
||||
+ if (num_cols < 1)
|
||||
+ col_to_resize = m_dragRowOrCol - 1;
|
||||
+
|
||||
+ const int lineEnd = oper.GetLineEndPos(this, m_dragRowOrCol);
|
||||
+ const int lineSize = oper.GetLineSize(this, col_to_resize);
|
||||
+ int size = linePos - lineEnd + lineSize;
|
||||
+ oper.SetLineSize(this, col_to_resize,
|
||||
+ wxMax(size,
|
||||
+ oper.GetMinimalLineSize(this, col_to_resize)));
|
||||
+ }
|
||||
+ else {
|
||||
+ const int lineStart = oper.GetLineStartPos(this, m_dragRowOrCol);
|
||||
+
|
||||
+ oper.SetLineSize(this, m_dragRowOrCol,
|
||||
wxMax(linePos - lineStart,
|
||||
oper.GetMinimalLineSize(this, m_dragRowOrCol)));
|
||||
+ }
|
||||
|
||||
// TODO: generate RESIZING event, see #10754, if the size has changed.
|
||||
}
|
||||
@@ -5090,7 +5115,8 @@ wxPoint wxGrid::GetPositionForResizeEvent(int width) const
|
||||
|
||||
void wxGrid::DoEndDragResizeRow(const wxMouseEvent& event, wxGridWindow* gridWindow)
|
||||
{
|
||||
- DoGridDragResize(event.GetPosition(), wxGridRowOperations(), gridWindow);
|
||||
+ //BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
+ DoGridDragResize(event.GetPosition(), wxGridRowOperations(), gridWindow, WXGRID_CURSOR_RESIZE_ROW);
|
||||
|
||||
SendGridSizeEvent(wxEVT_GRID_ROW_SIZE, m_dragRowOrCol, event);
|
||||
|
||||
@@ -5099,7 +5125,8 @@ void wxGrid::DoEndDragResizeRow(const wxMouseEvent& event, wxGridWindow* gridWin
|
||||
|
||||
void wxGrid::DoEndDragResizeCol(const wxMouseEvent& event, wxGridWindow* gridWindow)
|
||||
{
|
||||
- DoGridDragResize(event.GetPosition(), wxGridColumnOperations(), gridWindow);
|
||||
+ //BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
+ DoGridDragResize(event.GetPosition(), wxGridColumnOperations(), gridWindow, WXGRID_CURSOR_RESIZE_COL);
|
||||
|
||||
SendGridSizeEvent(wxEVT_GRID_COL_SIZE, m_dragRowOrCol, event);
|
||||
|
||||
@@ -5113,9 +5140,10 @@ void wxGrid::DoHeaderStartDragResizeCol(int col)
|
||||
|
||||
void wxGrid::DoHeaderDragResizeCol(int width)
|
||||
{
|
||||
+ //BBS: add cursor mode for DoGridDragResize's paremeters
|
||||
DoGridDragResize(GetPositionForResizeEvent(width),
|
||||
wxGridColumnOperations(),
|
||||
- m_gridWin);
|
||||
+ m_gridWin, WXGRID_CURSOR_RESIZE_COL);
|
||||
}
|
||||
|
||||
void wxGrid::DoHeaderEndDragResizeCol(int width)
|
||||
@@ -6013,6 +6041,10 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
|
||||
DisableCellEditControl();
|
||||
|
||||
MoveCursorDown( event.ShiftDown() );
|
||||
+ //BBS: select this cell when first click
|
||||
+ m_selection->SelectBlock(m_currentCellCoords.GetRow(), m_currentCellCoords.GetCol(),
|
||||
+ m_currentCellCoords.GetRow(), m_currentCellCoords.GetCol(),
|
||||
+ event);
|
||||
}
|
||||
break;
|
||||
|
||||
diff --git a/src/msw/bmpcbox.cpp b/src/msw/bmpcbox.cpp
|
||||
index 011bd4f534..17e7f18740 100644
|
||||
--- a/src/msw/bmpcbox.cpp
|
||||
+++ b/src/msw/bmpcbox.cpp
|
||||
@@ -156,13 +156,20 @@ void wxBitmapComboBox::RecreateControl()
|
||||
|
||||
wxComboBox::DoClear();
|
||||
|
||||
- HWND hwnd = GetHwnd();
|
||||
+ WNDPROC wndproc_edit = nullptr;
|
||||
+ WinStruct<COMBOBOXINFO> combobox_info;
|
||||
+ HWND hwnd = GetHwnd();
|
||||
+if (::GetComboBoxInfo(hwnd, &combobox_info))
|
||||
+ wndproc_edit = (WNDPROC)wxGetWindowProc(combobox_info.hwndItem);
|
||||
DissociateHandle();
|
||||
::DestroyWindow(hwnd);
|
||||
|
||||
if ( !MSWCreateControl(wxT("COMBOBOX"), wxEmptyString, pos, size) )
|
||||
return;
|
||||
|
||||
+if (::GetComboBoxInfo(GetHwnd(), &combobox_info))
|
||||
+ wxSetWindowProc(combobox_info.hwndItem, wndproc_edit);
|
||||
+
|
||||
// initialize the controls contents
|
||||
for ( i = 0; i < numItems; i++ )
|
||||
{
|
||||
diff --git a/src/msw/font.cpp b/src/msw/font.cpp
|
||||
index 434876939c..91d4603018 100644
|
||||
--- a/src/msw/font.cpp
|
||||
+++ b/src/msw/font.cpp
|
||||
@@ -54,7 +54,7 @@ static const int PITCH_MASK = FIXED_PITCH | VARIABLE_PITCH;
|
||||
class WXDLLEXPORT wxFontRefData: public wxGDIRefData
|
||||
{
|
||||
public:
|
||||
- wxFontRefData(const wxFontInfo& info = wxFontInfo());
|
||||
+ wxFontRefData(const wxFontInfo& info = wxFontInfo(), const wxWindow* window = nullptr);
|
||||
|
||||
wxFontRefData(const wxNativeFontInfo& info, WXHFONT hFont = 0)
|
||||
{
|
||||
@@ -324,7 +324,7 @@ protected:
|
||||
// wxFontRefData
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
-wxFontRefData::wxFontRefData(const wxFontInfo& info)
|
||||
+wxFontRefData::wxFontRefData(const wxFontInfo& info, const wxWindow *window)
|
||||
{
|
||||
m_hFont = NULL;
|
||||
|
||||
@@ -335,7 +335,7 @@ wxFontRefData::wxFontRefData(const wxFontInfo& info)
|
||||
}
|
||||
else
|
||||
{
|
||||
- m_nativeFontInfo.SetSizeOrDefault(info.GetFractionalPointSize());
|
||||
+ m_nativeFontInfo.SetSizeOrDefault(info.GetFractionalPointSize(), window);
|
||||
}
|
||||
|
||||
SetStyle(info.GetStyle());
|
||||
@@ -518,12 +518,12 @@ wxFontEncoding wxNativeFontInfo::GetEncoding() const
|
||||
return wxGetFontEncFromCharSet(lf.lfCharSet);
|
||||
}
|
||||
|
||||
-void wxNativeFontInfo::SetFractionalPointSize(double pointSizeNew)
|
||||
+void wxNativeFontInfo::SetFractionalPointSize(double pointSizeNew, const wxWindow *window)
|
||||
{
|
||||
// We don't have the correct DPI to use here, so use that of the
|
||||
// primary screen and rely on WXAdjustToPPI() changing it later if
|
||||
// necessary.
|
||||
- const int ppi = ::GetDeviceCaps(ScreenHDC(), LOGPIXELSY);
|
||||
+ const int ppi = window ? window->GetDPI().GetY() : ::GetDeviceCaps(ScreenHDC(), LOGPIXELSY);
|
||||
lf.lfHeight = GetLogFontHeightAtPPI(pointSizeNew, ppi);
|
||||
|
||||
pointSize = pointSizeNew;
|
||||
@@ -812,9 +812,9 @@ wxFont::wxFont(const wxString& fontdesc)
|
||||
(void)Create(info);
|
||||
}
|
||||
|
||||
-wxFont::wxFont(const wxFontInfo& info)
|
||||
+wxFont::wxFont(const wxFontInfo& info, const wxWindow *window)
|
||||
{
|
||||
- m_refData = new wxFontRefData(info);
|
||||
+ m_refData = new wxFontRefData(info, window);
|
||||
}
|
||||
|
||||
bool wxFont::Create(const wxNativeFontInfo& info, WXHFONT hFont)
|
||||
diff --git a/src/msw/menuitem.cpp b/src/msw/menuitem.cpp
|
||||
index 0bd017a36a..3b98bf1678 100644
|
||||
--- a/src/msw/menuitem.cpp
|
||||
+++ b/src/msw/menuitem.cpp
|
||||
@@ -368,6 +368,8 @@ void MenuDrawData::Init(wxWindow const* window)
|
||||
// native menu uses small top margin for separator
|
||||
if ( SeparatorMargin.cyTopHeight >= 2 )
|
||||
SeparatorMargin.cyTopHeight -= 2;
|
||||
+
|
||||
+ SeparatorSize.cy = 0;
|
||||
}
|
||||
else
|
||||
#endif // wxUSE_UXTHEME
|
||||
diff --git a/src/msw/window.cpp b/src/msw/window.cpp
|
||||
index c529a4fa3b..7e547c64df 100644
|
||||
--- a/src/msw/window.cpp
|
||||
+++ b/src/msw/window.cpp
|
||||
@@ -4809,33 +4809,49 @@ static wxSize GetWindowDPI(HWND hwnd)
|
||||
}
|
||||
|
||||
/*extern*/
|
||||
-int wxGetSystemMetrics(int nIndex, const wxWindow* window)
|
||||
+int wxGetSystemMetrics(int nIndex, const wxWindow* win)
|
||||
{
|
||||
#if wxUSE_DYNLIB_CLASS
|
||||
- if ( !window )
|
||||
- window = wxApp::GetMainTopWindow();
|
||||
+ const wxWindow* window = (!win && wxTheApp) ? wxTheApp->GetTopWindow() : win;
|
||||
|
||||
- if ( window )
|
||||
+ if (window)
|
||||
{
|
||||
- typedef int (WINAPI * GetSystemMetricsForDpi_t)(int nIndex, UINT dpi);
|
||||
- static GetSystemMetricsForDpi_t s_pfnGetSystemMetricsForDpi = NULL;
|
||||
- static bool s_initDone = false;
|
||||
-
|
||||
- if ( !s_initDone )
|
||||
- {
|
||||
- wxLoadedDLL dllUser32("user32.dll");
|
||||
- wxDL_INIT_FUNC(s_pfn, GetSystemMetricsForDpi, dllUser32);
|
||||
- s_initDone = true;
|
||||
+#if 1
|
||||
+ if (window->GetHWND() && (nIndex == SM_CXSCREEN || nIndex == SM_CYSCREEN)) {
|
||||
+ HDC hdc = GetDC(window->GetHWND());
|
||||
+#if 0
|
||||
+ double dim = GetDeviceCaps(hdc, nIndex == SM_CXSCREEN ? HORZRES : VERTRES);
|
||||
+ ReleaseDC(window->GetHWND(), hdc);
|
||||
+ wxSize dpi = window->GetDPI();
|
||||
+ dim *= 96.0 / (nIndex == SM_CXSCREEN ? dpi.x : dpi.y);
|
||||
+ return int(dim + 0.5);
|
||||
+#else
|
||||
+ return int(GetDeviceCaps(hdc, nIndex == SM_CXSCREEN ? HORZRES : VERTRES));
|
||||
+#endif
|
||||
}
|
||||
-
|
||||
- if ( s_pfnGetSystemMetricsForDpi )
|
||||
+ else
|
||||
+#endif
|
||||
{
|
||||
- const int dpi = window->GetDPI().y;
|
||||
- return s_pfnGetSystemMetricsForDpi(nIndex, (UINT)dpi);
|
||||
+ typedef int (WINAPI * GetSystemMetricsForDpi_t)(int nIndex, UINT dpi);
|
||||
+ static GetSystemMetricsForDpi_t s_pfnGetSystemMetricsForDpi = NULL;
|
||||
+ static bool s_initDone = false;
|
||||
+
|
||||
+ if ( !s_initDone )
|
||||
+ {
|
||||
+ wxLoadedDLL dllUser32("user32.dll");
|
||||
+ wxDL_INIT_FUNC(s_pfn, GetSystemMetricsForDpi, dllUser32);
|
||||
+ s_initDone = true;
|
||||
+ }
|
||||
+
|
||||
+ if ( s_pfnGetSystemMetricsForDpi )
|
||||
+ {
|
||||
+ const int dpi = window->GetDPI().y;
|
||||
+ return s_pfnGetSystemMetricsForDpi(nIndex, (UINT)dpi);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
#else
|
||||
- wxUnusedVar(window);
|
||||
+ wxUnusedVar(win);
|
||||
#endif // wxUSE_DYNLIB_CLASS
|
||||
|
||||
return ::GetSystemMetrics(nIndex);
|
||||
diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm
|
||||
index f188e61089..3d3159ce9d 100644
|
||||
--- a/src/osx/cocoa/dataview.mm
|
||||
+++ b/src/osx/cocoa/dataview.mm
|
||||
@@ -1604,6 +1604,15 @@ outlineView:(NSOutlineView*)outlineView
|
||||
}
|
||||
}
|
||||
|
||||
+//FIXME Vojtech: This is a workaround to get at least the "mouse move" events at the wxDataViewControl,
|
||||
+// so we can show the tooltips. The "mouse move" events are being send only if the wxDataViewControl
|
||||
+// has focus, which is a limitation of wxWidgets. We may grab focus on "mouse entry" though.
|
||||
+- (void)mouseMoved:(NSEvent *)event
|
||||
+{
|
||||
+if (! implementation->DoHandleMouseEvent(event))
|
||||
+ [super mouseMoved:event];
|
||||
+}
|
||||
+
|
||||
//
|
||||
// contextual menus
|
||||
//
|
||||
@@ -2006,7 +2015,8 @@ void wxCocoaDataViewControl::keyEvent(WX_NSEvent event, WXWidget slf, void *_cmd
|
||||
if ( !dvc->GetEventHandler()->ProcessEvent(eventDV) )
|
||||
wxWidgetCocoaImpl::keyEvent(event, slf, _cmd);
|
||||
}
|
||||
- else
|
||||
+ //FIXME Vojtech's hack to get the accelerators assigned to the wxDataViewControl working.
|
||||
+ else if (! implementation->DoHandleKeyEvent(event))
|
||||
{
|
||||
wxWidgetCocoaImpl::keyEvent(event, slf, _cmd); // all other keys
|
||||
}
|
||||
@@ -2540,12 +2550,22 @@ void wxCocoaDataViewControl::DoSetIndent(int indent)
|
||||
|
||||
void wxCocoaDataViewControl::HitTest(const wxPoint& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const
|
||||
{
|
||||
- NSPoint const nativePoint = wxToNSPoint((NSScrollView*) GetWXWidget(),point);
|
||||
+ NSTableHeaderView *headerView = [m_OutlineView headerView];
|
||||
+ if (headerView && point.y < headerView.visibleRect.size.height) {
|
||||
+ // The point is inside the header area.
|
||||
+ columnPtr = NULL;
|
||||
+ item = wxDataViewItem();
|
||||
+ return;
|
||||
+ }
|
||||
+ // Convert from the window coordinates to the virtual scrolled view coordinates.
|
||||
+ NSScrollView *scrollView = [m_OutlineView enclosingScrollView];
|
||||
+ const NSRect &visibleRect = scrollView.contentView.visibleRect;
|
||||
+ NSPoint const nativePoint = wxToNSPoint((NSScrollView*) GetWXWidget(),
|
||||
+ wxPoint(point.x + visibleRect.origin.x, point.y + visibleRect.origin.y));
|
||||
|
||||
int indexColumn;
|
||||
int indexRow;
|
||||
|
||||
-
|
||||
indexColumn = [m_OutlineView columnAtPoint:nativePoint];
|
||||
indexRow = [m_OutlineView rowAtPoint: nativePoint];
|
||||
if ((indexColumn >= 0) && (indexRow >= 0))
|
||||
diff --git a/src/osx/cocoa/settings.mm b/src/osx/cocoa/settings.mm
|
||||
index c819deeb0c..dc3c3b0b53 100644
|
||||
--- a/src/osx/cocoa/settings.mm
|
||||
+++ b/src/osx/cocoa/settings.mm
|
||||
@@ -222,7 +222,7 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Get a system metric, e.g. scrollbar size
|
||||
-int wxSystemSettingsNative::GetMetric(wxSystemMetric index, const wxWindow* WXUNUSED(win))
|
||||
+int wxSystemSettingsNative::GetMetric(wxSystemMetric index, const wxWindow* win)
|
||||
{
|
||||
int value;
|
||||
|
||||
@@ -257,11 +257,11 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, const wxWindow* WXUN
|
||||
// TODO case wxSYS_WINDOWMIN_Y:
|
||||
|
||||
case wxSYS_SCREEN_X:
|
||||
- wxDisplaySize(&value, NULL);
|
||||
+ wxDisplaySize(win, &value, NULL);
|
||||
return value;
|
||||
|
||||
case wxSYS_SCREEN_Y:
|
||||
- wxDisplaySize(NULL, &value);
|
||||
+ wxDisplaySize(win, NULL, &value);
|
||||
return value;
|
||||
|
||||
// TODO case wxSYS_FRAMESIZE_X:
|
||||
--
|
||||
2.42.0.windows.2
|
||||
|
||||
15
deps/wxWidgets/wxWidgets.cmake
vendored
15
deps/wxWidgets/wxWidgets.cmake
vendored
|
|
@ -1,4 +1,5 @@
|
|||
set(_wx_git_tag v3.1.5)
|
||||
set(_wx_git_tag v3.2.1)
|
||||
set(_wx_patch_name 0001-patch-v3.2.1-for-OrcaSlicer.patch)
|
||||
|
||||
set(_wx_toolkit "")
|
||||
set(_wx_private_font "-DwxUSE_PRIVATE_FONTS=1")
|
||||
|
|
@ -17,13 +18,13 @@ else ()
|
|||
endif ()
|
||||
|
||||
if (MSVC)
|
||||
set(_patch_cmd if not exist WXWIDGETS_PATCHED ( "${GIT_EXECUTABLE}" apply --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-wxWidget-fix.patch && type nul > WXWIDGETS_PATCHED ) )
|
||||
set(_patch_cmd if not exist WXWIDGETS_PATCHED ( "${GIT_EXECUTABLE}" apply --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/${_wx_patch_name} && type nul > WXWIDGETS_PATCHED ) )
|
||||
else ()
|
||||
set(_patch_cmd test -f WXWIDGETS_PATCHED || ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-wxWidget-fix.patch && touch WXWIDGETS_PATCHED)
|
||||
set(_patch_cmd test -f WXWIDGETS_PATCHED || ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/${_wx_patch_name} && touch WXWIDGETS_PATCHED)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(_patch_cmd ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-wxWidget-fix.patch)
|
||||
set(_patch_cmd ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/${_wx_patch_name})
|
||||
endif ()
|
||||
|
||||
orcaslicer_add_cmake_project(
|
||||
|
|
@ -31,7 +32,7 @@ orcaslicer_add_cmake_project(
|
|||
GIT_REPOSITORY "https://github.com/wxWidgets/wxWidgets"
|
||||
GIT_TAG ${_wx_git_tag}
|
||||
PATCH_COMMAND ${_patch_cmd}
|
||||
DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} dep_TIFF dep_JPEG
|
||||
DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} dep_TIFF dep_JPEG dep_NanoSVG
|
||||
CMAKE_ARGS
|
||||
-DwxBUILD_PRECOMP=ON
|
||||
${_wx_toolkit}
|
||||
|
|
@ -47,7 +48,9 @@ orcaslicer_add_cmake_project(
|
|||
-DwxUSE_WEBVIEW=ON
|
||||
${_wx_edge}
|
||||
-DwxUSE_WEBVIEW_IE=OFF
|
||||
-DwxUSE_REGEX=builtin
|
||||
-DwxUSE_NANOSVG=sys
|
||||
-DwxUSE_NANOSVG_EXTERNAL=ON
|
||||
-DwxUSE_REGEX=OFF
|
||||
-DwxUSE_LIBXPM=builtin
|
||||
-DwxUSE_LIBSDL=OFF
|
||||
-DwxUSE_XTEST=OFF
|
||||
|
|
|
|||
|
|
@ -95,6 +95,9 @@ if (SLIC3R_GUI)
|
|||
# libslic3r_gui will link to opengl anyway, so lets override wx
|
||||
list(FILTER wxWidgets_LIBRARIES EXCLUDE REGEX OpenGL)
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
list(APPEND wxWidgets_LIBRARIES X11 wayland-client wayland-egl EGL)
|
||||
endif ()
|
||||
# list(REMOVE_ITEM wxWidgets_LIBRARIES oleacc)
|
||||
message(STATUS "wx libs: ${wxWidgets_LIBRARIES}")
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Upstream source: https://github.com/memononen/nanosvg/tree/c1f6e209c16b18b46aa9f45d7e619acf42c29726
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -474,6 +474,8 @@ set(SLIC3R_GUI_SOURCES
|
|||
Utils/CalibUtils.hpp
|
||||
)
|
||||
|
||||
find_package(NanoSVG REQUIRED)
|
||||
|
||||
if (WIN32)
|
||||
list(APPEND SLIC3R_GUI_SOURCES
|
||||
GUI/dark_mode/dark_mode.hpp
|
||||
|
|
@ -521,7 +523,7 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SLIC3R_GUI_SOURCES})
|
|||
|
||||
encoding_check(libslic3r_gui)
|
||||
|
||||
target_link_libraries(libslic3r_gui libslic3r cereal::cereal imgui minilzo GLEW::GLEW OpenGL::GL hidapi ${wxWidgets_LIBRARIES} glfw libcurl OpenSSL::SSL OpenSSL::Crypto)
|
||||
target_link_libraries(libslic3r_gui libslic3r cereal::cereal imgui minilzo GLEW::GLEW OpenGL::GL hidapi ${wxWidgets_LIBRARIES} glfw libcurl OpenSSL::SSL OpenSSL::Crypto NanoSVG::nanosvg NanoSVG::nanosvgrast)
|
||||
#target_link_libraries(libslic3r_gui libslic3r cereal imgui minilzo GLEW::GLEW OpenGL::GL hidapi libcurl OpenSSL::SSL OpenSSL::Crypto ${wxWidgets_LIBRARIES} glfw)
|
||||
|
||||
if (MSVC)
|
||||
|
|
|
|||
|
|
@ -93,9 +93,7 @@ void BBLTopbarArt::DrawButton(wxDC& dc, wxWindow* wnd, const wxAuiToolBarItem& i
|
|||
int bmpX = 0, bmpY = 0;
|
||||
int textX = 0, textY = 0;
|
||||
|
||||
const wxBitmap& bmp = item.GetState() & wxAUI_BUTTON_STATE_DISABLED
|
||||
? item.GetDisabledBitmap()
|
||||
: item.GetBitmap();
|
||||
const wxBitmap &bmp = item.GetCurrentBitmapFor(wnd);
|
||||
|
||||
const wxSize bmpSize = bmp.IsOk() ? bmp.GetScaledSize() : wxSize(0, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,10 +13,8 @@
|
|||
#include <wx/rawbmp.h>
|
||||
#endif /* __WXGTK2__ */
|
||||
|
||||
#define NANOSVG_IMPLEMENTATION
|
||||
#include "nanosvg/nanosvg.h"
|
||||
#define NANOSVGRAST_IMPLEMENTATION
|
||||
#include "nanosvg/nanosvgrast.h"
|
||||
#include <nanosvg/nanosvg.h>
|
||||
#include <nanosvg/nanosvgrast.h>
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
#define STB_DXT_IMPLEMENTATION
|
||||
#include "stb_dxt/stb_dxt.h"
|
||||
|
||||
#include "nanosvg/nanosvg.h"
|
||||
#include "nanosvg/nanosvgrast.h"
|
||||
#include <nanosvg/nanosvg.h>
|
||||
#include <nanosvg/nanosvgrast.h>
|
||||
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@
|
|||
#include "BitmapCache.hpp"
|
||||
|
||||
#include "../Utils/MacDarkMode.hpp"
|
||||
#include "nanosvg/nanosvg.h"
|
||||
#include "nanosvg/nanosvgrast.h"
|
||||
#include <nanosvg/nanosvg.h>
|
||||
#include <nanosvg/nanosvgrast.h>
|
||||
#include "OpenGLManager.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue