mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-24 09:11:23 -06:00
Merge remote-tracking branch 'remotes/origin/gcode_preview'
This commit is contained in:
commit
8fb443522b
12 changed files with 175 additions and 38 deletions
|
|
@ -450,6 +450,25 @@ void GLVolumeCollection::render_legacy() const
|
|||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
}
|
||||
|
||||
std::vector<double> GLVolumeCollection::get_current_print_zs() const
|
||||
{
|
||||
std::vector<double> print_zs;
|
||||
|
||||
for (GLVolume *vol : this->volumes)
|
||||
{
|
||||
for (coordf_t z : vol->print_zs)
|
||||
{
|
||||
double round_z = (double)round(z * 100000.0f) / 100000.0f;
|
||||
if (std::find(print_zs.begin(), print_zs.end(), round_z) == print_zs.end())
|
||||
print_zs.push_back(round_z);
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(print_zs.begin(), print_zs.end());
|
||||
|
||||
return print_zs;
|
||||
}
|
||||
|
||||
// caller is responsible for supplying NO lines with zero length
|
||||
static void thick_lines_to_indexed_vertex_array(
|
||||
const Lines &lines,
|
||||
|
|
@ -2205,6 +2224,9 @@ void _3DScene::_update_gcode_volumes_visibility(const GCodePreviewData& preview_
|
|||
{
|
||||
case GCodePreviewVolumeIndex::Extrusion:
|
||||
{
|
||||
if ((ExtrusionRole)s_gcode_preview_volume_index.first_volumes[i].flag == erCustom)
|
||||
volume->zoom_to_volumes = false;
|
||||
|
||||
volume->is_active = preview_data.extrusion.is_role_flag_set((ExtrusionRole)s_gcode_preview_volume_index.first_volumes[i].flag);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -372,6 +372,9 @@ public:
|
|||
|
||||
void set_render_interleaved_only_volumes(const RenderInterleavedOnlyVolumes& render_interleaved_only_volumes) { _render_interleaved_only_volumes = render_interleaved_only_volumes; }
|
||||
|
||||
// Returns a vector containing the sorted list of all the print_zs of the volumes contained in this collection
|
||||
std::vector<double> get_current_print_zs() const;
|
||||
|
||||
private:
|
||||
GLVolumeCollection(const GLVolumeCollection &other);
|
||||
GLVolumeCollection& operator=(const GLVolumeCollection &);
|
||||
|
|
|
|||
|
|
@ -487,10 +487,17 @@ void create_combochecklist(wxComboCtrl* comboCtrl, std::string text, std::string
|
|||
wxCheckListBoxComboPopup* popup = new wxCheckListBoxComboPopup;
|
||||
if (popup != nullptr)
|
||||
{
|
||||
// FIXME If the following line is removed, the combo box popup list will not react to mouse clicks.
|
||||
// On the other side, with this line the combo box popup cannot be closed by clicking on the combo button on Windows 10.
|
||||
comboCtrl->UseAltPopupWindow();
|
||||
|
||||
comboCtrl->EnablePopupAnimation(false);
|
||||
comboCtrl->SetPopupControl(popup);
|
||||
popup->SetStringValue(text);
|
||||
popup->Connect(wxID_ANY, wxEVT_CHECKLISTBOX, wxCommandEventHandler(wxCheckListBoxComboPopup::OnCheckListBox), nullptr, popup);
|
||||
popup->Connect(wxID_ANY, wxEVT_LISTBOX, wxCommandEventHandler(wxCheckListBoxComboPopup::OnListBoxSelection), nullptr, popup);
|
||||
popup->Bind(wxEVT_CHECKLISTBOX, [popup](wxCommandEvent& evt) { popup->OnCheckListBox(evt); });
|
||||
popup->Bind(wxEVT_LISTBOX, [popup](wxCommandEvent& evt) { popup->OnListBoxSelection(evt); });
|
||||
popup->Bind(wxEVT_KEY_DOWN, [popup](wxKeyEvent& evt) { popup->OnKeyEvent(evt); });
|
||||
popup->Bind(wxEVT_KEY_UP, [popup](wxKeyEvent& evt) { popup->OnKeyEvent(evt); });
|
||||
|
||||
std::vector<std::string> items_str;
|
||||
boost::split(items_str, items, boost::is_any_of("|"), boost::token_compress_off);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#include "wxExtensions.hpp"
|
||||
|
||||
const unsigned int wxCheckListBoxComboPopup::Height = 210;
|
||||
const unsigned int wxCheckListBoxComboPopup::DefaultWidth = 200;
|
||||
const unsigned int wxCheckListBoxComboPopup::DefaultHeight = 200;
|
||||
const unsigned int wxCheckListBoxComboPopup::DefaultItemHeight = 18;
|
||||
|
||||
bool wxCheckListBoxComboPopup::Create(wxWindow* parent)
|
||||
{
|
||||
|
|
@ -25,16 +27,55 @@ wxString wxCheckListBoxComboPopup::GetStringValue() const
|
|||
wxSize wxCheckListBoxComboPopup::GetAdjustedSize(int minWidth, int prefHeight, int maxHeight)
|
||||
{
|
||||
// matches owner wxComboCtrl's width
|
||||
// and sets height dinamically in dependence of contained items count
|
||||
|
||||
wxComboCtrl* cmb = GetComboCtrl();
|
||||
if (cmb != nullptr)
|
||||
{
|
||||
wxSize size = GetComboCtrl()->GetSize();
|
||||
size.SetHeight(Height);
|
||||
|
||||
unsigned int count = GetCount();
|
||||
if (count > 0)
|
||||
size.SetHeight(count * DefaultItemHeight);
|
||||
else
|
||||
size.SetHeight(DefaultHeight);
|
||||
|
||||
return size;
|
||||
}
|
||||
else
|
||||
return wxSize(200, Height);
|
||||
return wxSize(DefaultWidth, DefaultHeight);
|
||||
}
|
||||
|
||||
void wxCheckListBoxComboPopup::OnKeyEvent(wxKeyEvent& evt)
|
||||
{
|
||||
// filters out all the keys which are not working properly
|
||||
switch (evt.GetKeyCode())
|
||||
{
|
||||
case WXK_LEFT:
|
||||
case WXK_UP:
|
||||
case WXK_RIGHT:
|
||||
case WXK_DOWN:
|
||||
case WXK_PAGEUP:
|
||||
case WXK_PAGEDOWN:
|
||||
case WXK_END:
|
||||
case WXK_HOME:
|
||||
case WXK_NUMPAD_LEFT:
|
||||
case WXK_NUMPAD_UP:
|
||||
case WXK_NUMPAD_RIGHT:
|
||||
case WXK_NUMPAD_DOWN:
|
||||
case WXK_NUMPAD_PAGEUP:
|
||||
case WXK_NUMPAD_PAGEDOWN:
|
||||
case WXK_NUMPAD_END:
|
||||
case WXK_NUMPAD_HOME:
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
evt.Skip();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxCheckListBoxComboPopup::OnCheckListBox(wxCommandEvent& evt)
|
||||
|
|
@ -48,6 +89,8 @@ void wxCheckListBoxComboPopup::OnCheckListBox(wxCommandEvent& evt)
|
|||
event.SetEventObject(cmb);
|
||||
cmb->ProcessWindowEvent(event);
|
||||
}
|
||||
|
||||
evt.Skip();
|
||||
}
|
||||
|
||||
void wxCheckListBoxComboPopup::OnListBoxSelection(wxCommandEvent& evt)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@
|
|||
|
||||
class wxCheckListBoxComboPopup : public wxCheckListBox, public wxComboPopup
|
||||
{
|
||||
static const unsigned int Height;
|
||||
static const unsigned int DefaultWidth;
|
||||
static const unsigned int DefaultHeight;
|
||||
static const unsigned int DefaultItemHeight;
|
||||
|
||||
wxString m_text;
|
||||
|
||||
|
|
@ -17,6 +19,8 @@ public:
|
|||
virtual wxString GetStringValue() const;
|
||||
virtual wxSize GetAdjustedSize(int minWidth, int prefHeight, int maxHeight);
|
||||
|
||||
virtual void OnKeyEvent(wxKeyEvent& evt);
|
||||
|
||||
void OnCheckListBox(wxCommandEvent& evt);
|
||||
void OnListBoxSelection(wxCommandEvent& evt);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue