Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_splitted_vbuffer

This commit is contained in:
enricoturri1966 2021-01-21 09:44:27 +01:00
commit 0f8e7f3e8b
3 changed files with 17 additions and 44 deletions

View File

@ -888,6 +888,7 @@ void SpinCtrl::msw_rescale()
} }
#ifdef __WXOSX__ #ifdef __WXOSX__
static_assert(wxMAJOR_VERSION >= 3, "Use of wxBitmapComboBox on Settings Tabs requires wxWidgets 3.0 and newer");
using choice_ctrl = wxBitmapComboBox; using choice_ctrl = wxBitmapComboBox;
#else #else
using choice_ctrl = wxComboBox; using choice_ctrl = wxComboBox;
@ -942,22 +943,6 @@ void Choice::BUILD() {
set_selection(); set_selection();
} }
#ifdef __WXOSX__
//#ifndef __WXGTK__
/* Workaround for a correct rendering of the control without Bitmap (under MSW and OSX):
*
* 1. We should create small Bitmap to fill Bitmaps RefData,
* ! in this case wxBitmap.IsOK() return true.
* 2. But then set width to 0 value for no using of bitmap left and right spacing
* 3. Set this empty bitmap to the at list one item and BitmapCombobox will be recreated correct
*
* Note: Set bitmap height to the Font size because of OSX rendering.
*/
wxBitmap empty_bmp(1, temp->GetFont().GetPixelSize().y + 2);
empty_bmp.SetWidth(0);
temp->SetItemBitmap(0, empty_bmp);
#endif
temp->Bind(wxEVT_MOUSEWHEEL, [this](wxMouseEvent& e) { temp->Bind(wxEVT_MOUSEWHEEL, [this](wxMouseEvent& e) {
if (m_suppress_scroll && !m_is_dropped) if (m_suppress_scroll && !m_is_dropped)
e.StopPropagation(); e.StopPropagation();
@ -1289,10 +1274,6 @@ void Choice::msw_rescale()
} }
} }
wxBitmap empty_bmp(1, field->GetFont().GetPixelSize().y + 2);
empty_bmp.SetWidth(0);
field->SetItemBitmap(0, empty_bmp);
idx == m_opt.enum_values.size() ? idx == m_opt.enum_values.size() ?
field->SetValue(selection) : field->SetValue(selection) :
field->SetSelection(idx); field->SetSelection(idx);

View File

@ -45,11 +45,11 @@ static double get_volume_min_z(const GLVolume* volume)
static wxBitmapComboBox* create_word_local_combo(wxWindow *parent) static choice_ctrl* create_word_local_combo(wxWindow *parent)
{ {
wxSize size(15 * wxGetApp().em_unit(), -1); wxSize size(15 * wxGetApp().em_unit(), -1);
wxBitmapComboBox *temp = nullptr; choice_ctrl* temp = nullptr;
#ifdef __WXOSX__ #ifdef __WXOSX__
/* wxBitmapComboBox with wxCB_READONLY style return NULL for GetTextCtrl(), /* wxBitmapComboBox with wxCB_READONLY style return NULL for GetTextCtrl(),
* so ToolTip doesn't shown. * so ToolTip doesn't shown.
@ -59,7 +59,7 @@ static wxBitmapComboBox* create_word_local_combo(wxWindow *parent)
temp->SetTextCtrlStyle(wxTE_READONLY); temp->SetTextCtrlStyle(wxTE_READONLY);
temp->Create(parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr); temp->Create(parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr);
#else #else
temp = new wxBitmapComboBox(parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxCB_READONLY); temp = new choice_ctrl(parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxCB_READONLY);
#endif //__WXOSX__ #endif //__WXOSX__
temp->SetFont(Slic3r::GUI::wxGetApp().normal_font()); temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
@ -70,26 +70,11 @@ static wxBitmapComboBox* create_word_local_combo(wxWindow *parent)
temp->SetSelection(0); temp->SetSelection(0);
temp->SetValue(temp->GetString(0)); temp->SetValue(temp->GetString(0));
#ifndef __WXGTK__
/* Workaround for a correct rendering of the control without Bitmap (under MSW and OSX):
*
* 1. We should create small Bitmap to fill Bitmaps RefData,
* ! in this case wxBitmap.IsOK() return true.
* 2. But then set width to 0 value for no using of bitmap left and right spacing
* 3. Set this empty bitmap to the at list one item and BitmapCombobox will be recreated correct
*
* Note: Set bitmap height to the Font size because of OSX rendering.
*/
wxBitmap empty_bmp(1, temp->GetFont().GetPixelSize().y + 2);
empty_bmp.SetWidth(0);
temp->SetItemBitmap(0, empty_bmp);
#endif
temp->SetToolTip(_L("Select coordinate space, in which the transformation will be performed.")); temp->SetToolTip(_L("Select coordinate space, in which the transformation will be performed."));
return temp; return temp;
} }
void msw_rescale_word_local_combo(wxBitmapComboBox* combo) void msw_rescale_word_local_combo(choice_ctrl* combo)
{ {
const wxString selection = combo->GetString(combo->GetSelection()); const wxString selection = combo->GetString(combo->GetSelection());
@ -111,10 +96,6 @@ void msw_rescale_word_local_combo(wxBitmapComboBox* combo)
combo->Append(_L("World coordinates")); combo->Append(_L("World coordinates"));
combo->Append(_L("Local coordinates")); combo->Append(_L("Local coordinates"));
wxBitmap empty_bmp(1, combo->GetFont().GetPixelSize().y + 2);
empty_bmp.SetWidth(0);
combo->SetItemBitmap(0, empty_bmp);
combo->SetValue(selection); combo->SetValue(selection);
} }

View File

@ -7,7 +7,11 @@
#include "libslic3r/Point.hpp" #include "libslic3r/Point.hpp"
#include <float.h> #include <float.h>
#ifdef __WXOSX__
class wxBitmapComboBox; class wxBitmapComboBox;
#else
class wxComboBox;
#endif // __WXOSX__
class wxStaticText; class wxStaticText;
class LockButton; class LockButton;
class wxStaticBitmap; class wxStaticBitmap;
@ -16,6 +20,13 @@ class wxCheckBox;
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
#ifdef __WXOSX__
static_assert(wxMAJOR_VERSION >= 3, "Use of wxBitmapComboBox on Manipulation panel requires wxWidgets 3.0 and newer");
using choice_ctrl = wxBitmapComboBox;
#else
using choice_ctrl = wxComboBox;
#endif // __WXOSX__
class Selection; class Selection;
class ObjectManipulation; class ObjectManipulation;
@ -125,7 +136,7 @@ private:
// Does the object manipulation panel work in World or Local coordinates? // Does the object manipulation panel work in World or Local coordinates?
bool m_world_coordinates = true; bool m_world_coordinates = true;
LockButton* m_lock_bnt{ nullptr }; LockButton* m_lock_bnt{ nullptr };
wxBitmapComboBox* m_word_local_combo = nullptr; choice_ctrl* m_word_local_combo { nullptr };
ScalableBitmap m_manifold_warning_bmp; ScalableBitmap m_manifold_warning_bmp;
wxStaticBitmap* m_fix_throught_netfab_bitmap; wxStaticBitmap* m_fix_throught_netfab_bitmap;