ENH:Text not centered on mac15
jira: STUDIO-11056 Change-Id: I1c651421f8914a25707ad5b5c1d3e3d56c2df959
This commit is contained in:
parent
5c83c35994
commit
7af3eba500
|
@ -4,7 +4,7 @@
|
|||
namespace Slic3r {
|
||||
|
||||
bool is_macos_support_boost_add_file_log();
|
||||
|
||||
int is_mac_version_15();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,10 +6,18 @@ namespace Slic3r {
|
|||
bool is_macos_support_boost_add_file_log()
|
||||
{
|
||||
if (@available(macOS 12.0, *)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -558,8 +558,6 @@ MeshErrorsInfo ObjectList::get_mesh_errors_info(wxString* sidebar_info /*= nullp
|
|||
else
|
||||
return { "", "" };
|
||||
}
|
||||
assert(obj_idx >= 0);
|
||||
|
||||
return get_mesh_errors_info(obj_idx, vol_idx, sidebar_info, non_manifold_edges);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
|
||||
#include <wx/dcclient.h>
|
||||
#include <wx/dcgraph.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "libslic3r/MacUtils.hpp"
|
||||
#endif
|
||||
BEGIN_EVENT_TABLE(Button, StaticBox)
|
||||
|
||||
EVT_LEFT_DOWN(Button::mouseDown)
|
||||
|
@ -272,6 +274,11 @@ void Button::render(wxDC& dc)
|
|||
#endif
|
||||
#ifdef __WXOSX__
|
||||
pt.y -= this->textSize.x / 2;
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
if (Slic3r::is_mac_version_15()) {
|
||||
pt.y -= FromDIP(1);
|
||||
}
|
||||
#endif
|
||||
dc.DrawText(text, pt);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
#include "../wxExtensions.hpp"
|
||||
#include "../Utils/MacDarkMode.hpp"
|
||||
#include "../Utils/WxFontUtils.hpp"
|
||||
#ifdef __APPLE__
|
||||
#include "libslic3r/MacUtils.hpp"
|
||||
#endif
|
||||
|
||||
#include <wx/dcclient.h>
|
||||
#include <wx/dcgraph.h>
|
||||
|
@ -140,9 +143,21 @@ void SwitchButton::Rescale()
|
|||
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.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.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);
|
||||
#ifdef __WXOSX__
|
||||
bmp = wxBitmap(bmp.ConvertToImage(), -1, scale);
|
||||
|
|
Loading…
Reference in New Issue