mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-20 20:03:47 +00:00
ENH:Text not centered on mac15
jira: STUDIO-11056 Change-Id: I1c651421f8914a25707ad5b5c1d3e3d56c2df959 (cherry picked from commit 7af3eba50047c4b5f852f2ac3814243543a5019a)
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
bool is_macos_support_boost_add_file_log();
|
bool is_macos_support_boost_add_file_log();
|
||||||
|
int is_mac_version_15();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -12,4 +12,12 @@ bool is_macos_support_boost_add_file_log()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int is_mac_version_15()
|
||||||
|
{
|
||||||
|
if (@available(macOS 15.0, *)) {//This code runs on macOS 15 or later.
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}; // namespace Slic3r
|
}; // namespace Slic3r
|
||||||
|
|||||||
@@ -583,8 +583,6 @@ MeshErrorsInfo ObjectList::get_mesh_errors_info(wxString* sidebar_info /*= nullp
|
|||||||
else
|
else
|
||||||
return { "", "" };
|
return { "", "" };
|
||||||
}
|
}
|
||||||
assert(obj_idx >= 0);
|
|
||||||
|
|
||||||
return get_mesh_errors_info(obj_idx, vol_idx, sidebar_info, non_manifold_edges);
|
return get_mesh_errors_info(obj_idx, vol_idx, sidebar_info, non_manifold_edges);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
#include "Label.hpp"
|
#include "Label.hpp"
|
||||||
|
|
||||||
#include <wx/dcgraph.h>
|
#include <wx/dcgraph.h>
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include "libslic3r/MacUtils.hpp"
|
||||||
|
#endif
|
||||||
BEGIN_EVENT_TABLE(Button, StaticBox)
|
BEGIN_EVENT_TABLE(Button, StaticBox)
|
||||||
|
|
||||||
EVT_LEFT_DOWN(Button::mouseDown)
|
EVT_LEFT_DOWN(Button::mouseDown)
|
||||||
@@ -347,6 +349,11 @@ void Button::render(wxDC& dc)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef __WXOSX__
|
#ifdef __WXOSX__
|
||||||
pt.y -= textSize.x / 2;
|
pt.y -= textSize.x / 2;
|
||||||
|
#endif
|
||||||
|
#ifdef __APPLE__
|
||||||
|
if (Slic3r::is_mac_version_15()) {
|
||||||
|
pt.y -= FromDIP(1);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
dc.DrawText(text, pt);
|
dc.DrawText(text, pt);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
#include "../wxExtensions.hpp"
|
#include "../wxExtensions.hpp"
|
||||||
#include "../Utils/MacDarkMode.hpp"
|
#include "../Utils/MacDarkMode.hpp"
|
||||||
#include "../Utils/WxFontUtils.hpp"
|
#include "../Utils/WxFontUtils.hpp"
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include "libslic3r/MacUtils.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <wx/dcmemory.h>
|
#include <wx/dcmemory.h>
|
||||||
#include <wx/dcclient.h>
|
#include <wx/dcclient.h>
|
||||||
@@ -140,9 +143,21 @@ void SwitchButton::Rescale()
|
|||||||
dc2.DrawRoundedRectangle(wxRect({ i == 0 ? BS : (trackSize.x - thumbSize.x - BS), BS}, thumbSize), thumbSize.y / 2);
|
dc2.DrawRoundedRectangle(wxRect({ i == 0 ? BS : (trackSize.x - thumbSize.x - BS), BS}, thumbSize), thumbSize.y / 2);
|
||||||
}
|
}
|
||||||
memdc.SetTextForeground(text_color.colorForStates(state ^ StateColor::Checked));
|
memdc.SetTextForeground(text_color.colorForStates(state ^ StateColor::Checked));
|
||||||
memdc.DrawText(labels[0], {BS + (thumbSize.x - textSize[0].x) / 2, BS + (thumbSize.y - textSize[0].y) / 2});
|
auto text_y = BS + (thumbSize.y - textSize[0].y) / 2;
|
||||||
|
#ifdef __APPLE__
|
||||||
|
if (Slic3r::is_mac_version_15()) {
|
||||||
|
text_y -= FromDIP(2);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
memdc.DrawText(labels[0], {BS + (thumbSize.x - textSize[0].x) / 2, text_y});
|
||||||
memdc.SetTextForeground(text_color2.count() == 0 ? text_color.colorForStates(state) : text_color2.colorForStates(state));
|
memdc.SetTextForeground(text_color2.count() == 0 ? text_color.colorForStates(state) : text_color2.colorForStates(state));
|
||||||
memdc.DrawText(labels[1], {trackSize.x - thumbSize.x - BS + (thumbSize.x - textSize[1].x) / 2, BS + (thumbSize.y - textSize[1].y) / 2});
|
auto text_y_1 = BS + (thumbSize.y - textSize[1].y) / 2;
|
||||||
|
#ifdef __APPLE__
|
||||||
|
if (Slic3r::is_mac_version_15()) {
|
||||||
|
text_y_1 -= FromDIP(2);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
memdc.DrawText(labels[1], {trackSize.x - thumbSize.x - BS + (thumbSize.x - textSize[1].x) / 2, text_y_1});
|
||||||
memdc.SelectObject(wxNullBitmap);
|
memdc.SelectObject(wxNullBitmap);
|
||||||
#ifdef __WXOSX__
|
#ifdef __WXOSX__
|
||||||
bmp = wxBitmap(bmp.ConvertToImage(), -1, scale);
|
bmp = wxBitmap(bmp.ConvertToImage(), -1, scale);
|
||||||
|
|||||||
Reference in New Issue
Block a user