mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 16:51:21 -06:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_sinking_contours
This commit is contained in:
commit
502906178f
58 changed files with 1855 additions and 2832 deletions
|
|
@ -1606,25 +1606,17 @@ ConfigWizardIndex::ConfigWizardIndex(wxWindow *parent)
|
|||
, item_hover(NO_ITEM)
|
||||
, last_page((size_t)-1)
|
||||
{
|
||||
#ifndef __WXOSX__
|
||||
SetDoubleBuffered(true);// SetDoubleBuffered exists on Win and Linux/GTK, but is missing on OSX
|
||||
#endif //__WXOSX__
|
||||
SetMinSize(bg.bmp().GetSize());
|
||||
|
||||
const wxSize size = GetTextExtent("m");
|
||||
em_w = size.x;
|
||||
em_h = size.y;
|
||||
|
||||
// Add logo bitmap.
|
||||
// This could be done in on_paint() along with the index labels, but I've found it tricky
|
||||
// to get the bitmap rendered well on all platforms with transparent background.
|
||||
// In some cases it didn't work at all. And so wxStaticBitmap is used here instead,
|
||||
// because it has all the platform quirks figured out.
|
||||
auto *sizer = new wxBoxSizer(wxVERTICAL);
|
||||
logo = new wxStaticBitmap(this, wxID_ANY, bg.bmp());
|
||||
sizer->AddStretchSpacer();
|
||||
sizer->Add(logo);
|
||||
SetSizer(sizer);
|
||||
logo_height = logo->GetBitmap().GetHeight();
|
||||
|
||||
Bind(wxEVT_PAINT, &ConfigWizardIndex::on_paint, this);
|
||||
Bind(wxEVT_SIZE, [this](wxEvent& e) { e.Skip(); Refresh(); });
|
||||
Bind(wxEVT_MOTION, &ConfigWizardIndex::on_mouse_move, this);
|
||||
|
||||
Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent &evt) {
|
||||
|
|
@ -1769,6 +1761,12 @@ void ConfigWizardIndex::on_paint(wxPaintEvent & evt)
|
|||
y += yinc;
|
||||
index_width = std::max(index_width, (int)x + text_size.x);
|
||||
}
|
||||
|
||||
//draw logo
|
||||
if (int y = size.y - bg.GetBmpHeight(); y>=0) {
|
||||
dc.DrawBitmap(bg.bmp(), 0, y, false);
|
||||
index_width = std::max(index_width, bg.GetBmpWidth() + em_w / 2);
|
||||
}
|
||||
|
||||
if (GetMinSize().x < index_width) {
|
||||
CallAfter([this, index_width]() {
|
||||
|
|
@ -1776,11 +1774,6 @@ void ConfigWizardIndex::on_paint(wxPaintEvent & evt)
|
|||
Refresh();
|
||||
});
|
||||
}
|
||||
|
||||
if ((int)y + logo_height > size.GetHeight())
|
||||
logo->Hide();
|
||||
else
|
||||
logo->Show();
|
||||
}
|
||||
|
||||
void ConfigWizardIndex::on_mouse_move(wxMouseEvent &evt)
|
||||
|
|
@ -1806,7 +1799,6 @@ void ConfigWizardIndex::msw_rescale()
|
|||
|
||||
bg.msw_rescale();
|
||||
SetMinSize(bg.bmp().GetSize());
|
||||
logo->SetBitmap(bg.bmp());
|
||||
|
||||
bullet_black.msw_rescale();
|
||||
bullet_blue.msw_rescale();
|
||||
|
|
|
|||
|
|
@ -512,15 +512,12 @@ private:
|
|||
ScalableBitmap bullet_black;
|
||||
ScalableBitmap bullet_blue;
|
||||
ScalableBitmap bullet_white;
|
||||
wxStaticBitmap* logo;
|
||||
|
||||
std::vector<Item> items;
|
||||
size_t item_active;
|
||||
ssize_t item_hover;
|
||||
size_t last_page;
|
||||
|
||||
int logo_height;
|
||||
|
||||
int item_height() const { return std::max(bullet_black.bmp().GetSize().GetHeight(), em_w) + em_w; }
|
||||
|
||||
void on_paint(wxPaintEvent &evt);
|
||||
|
|
|
|||
|
|
@ -3341,14 +3341,31 @@ void GCodeViewer::render_legend(float& legend_height) const
|
|||
if (show_estimated_time) {
|
||||
ImGui::Spacing();
|
||||
std::string time_title = _u8L("Estimated printing times");
|
||||
switch (m_time_estimate_mode)
|
||||
{
|
||||
case PrintEstimatedStatistics::ETimeMode::Normal: { time_title += " [" + _u8L("Normal mode") + "]:"; break; }
|
||||
case PrintEstimatedStatistics::ETimeMode::Stealth: { time_title += " [" + _u8L("Stealth mode") + "]:"; break; }
|
||||
default: { assert(false); break; }
|
||||
auto can_show_mode_button = [this](PrintEstimatedStatistics::ETimeMode mode) {
|
||||
bool show = false;
|
||||
if (m_print_statistics.modes.size() > 1 && m_print_statistics.modes[static_cast<size_t>(mode)].roles_times.size() > 0) {
|
||||
for (size_t i = 0; i < m_print_statistics.modes.size(); ++i) {
|
||||
if (i != static_cast<size_t>(mode) &&
|
||||
m_print_statistics.modes[i].time > 0.0f &&
|
||||
short_time(get_time_dhms(m_print_statistics.modes[static_cast<size_t>(mode)].time)) != short_time(get_time_dhms(m_print_statistics.modes[i].time))) {
|
||||
show = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return show;
|
||||
};
|
||||
|
||||
if (can_show_mode_button(m_time_estimate_mode)) {
|
||||
switch (m_time_estimate_mode)
|
||||
{
|
||||
case PrintEstimatedStatistics::ETimeMode::Normal: { time_title += " [" + _u8L("Normal mode") + "]"; break; }
|
||||
case PrintEstimatedStatistics::ETimeMode::Stealth: { time_title += " [" + _u8L("Stealth mode") + "]"; break; }
|
||||
default: { assert(false); break; }
|
||||
}
|
||||
}
|
||||
|
||||
imgui.title(time_title);
|
||||
imgui.title(time_title + ":");
|
||||
|
||||
std::string first_str = _u8L("First layer");
|
||||
std::string total_str = _u8L("Total");
|
||||
|
|
@ -3369,16 +3386,8 @@ void GCodeViewer::render_legend(float& legend_height) const
|
|||
ImGui::SameLine(max_len);
|
||||
imgui.text(short_time(get_time_dhms(time_mode.time)));
|
||||
|
||||
auto show_mode_button = [this, &imgui](const wxString& label, PrintEstimatedStatistics::ETimeMode mode) {
|
||||
bool show = false;
|
||||
for (size_t i = 0; i < m_print_statistics.modes.size(); ++i) {
|
||||
if (i != static_cast<size_t>(mode) &&
|
||||
short_time(get_time_dhms(m_print_statistics.modes[static_cast<size_t>(mode)].time)) != short_time(get_time_dhms(m_print_statistics.modes[i].time))) {
|
||||
show = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (show && m_print_statistics.modes[static_cast<size_t>(mode)].roles_times.size() > 0) {
|
||||
auto show_mode_button = [this, &imgui, can_show_mode_button](const wxString& label, PrintEstimatedStatistics::ETimeMode mode) {
|
||||
if (can_show_mode_button(mode)) {
|
||||
if (imgui.button(label)) {
|
||||
*const_cast<PrintEstimatedStatistics::ETimeMode*>(&m_time_estimate_mode) = mode;
|
||||
wxGetApp().plater()->get_current_canvas3D()->set_as_dirty();
|
||||
|
|
|
|||
|
|
@ -671,6 +671,7 @@ public:
|
|||
|
||||
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
|
||||
std::vector<CustomGCode::Item>& get_custom_gcode_per_print_z() { return m_custom_gcode_per_print_z; }
|
||||
size_t get_extruders_count() { return m_extruders_count; }
|
||||
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -636,6 +636,7 @@ public:
|
|||
void set_toolpaths_z_range(const std::array<unsigned int, 2>& range);
|
||||
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
|
||||
std::vector<CustomGCode::Item>& get_custom_gcode_per_print_z() { return m_gcode_viewer.get_custom_gcode_per_print_z(); }
|
||||
size_t get_gcode_extruders_count() { return m_gcode_viewer.get_extruders_count(); }
|
||||
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
|
||||
|
||||
std::vector<int> load_object(const ModelObject& model_object, int obj_idx, std::vector<int> instance_idxs);
|
||||
|
|
|
|||
|
|
@ -1780,7 +1780,7 @@ void GUI_App::update_mode()
|
|||
for (auto tab : tabs_list)
|
||||
tab->update_mode();
|
||||
|
||||
plater()->update_object_menu();
|
||||
plater()->update_menus();
|
||||
plater()->canvas3D()->update_gizmos_on_off_state();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -953,6 +953,12 @@ void MenuFactory::init(wxWindow* parent)
|
|||
create_instance_menu();
|
||||
}
|
||||
|
||||
void MenuFactory::update()
|
||||
{
|
||||
update_default_menu();
|
||||
update_object_menu();
|
||||
}
|
||||
|
||||
wxMenu* MenuFactory::default_menu()
|
||||
{
|
||||
return &m_default_menu;
|
||||
|
|
@ -1077,6 +1083,14 @@ void MenuFactory::update_object_menu()
|
|||
append_menu_items_add_volume(&m_object_menu);
|
||||
}
|
||||
|
||||
void MenuFactory::update_default_menu()
|
||||
{
|
||||
const auto menu_item_id = m_default_menu.FindItem(_("Add Shape"));
|
||||
if (menu_item_id != wxNOT_FOUND)
|
||||
m_default_menu.Destroy(menu_item_id);
|
||||
create_default_menu();
|
||||
}
|
||||
|
||||
void MenuFactory::msw_rescale()
|
||||
{
|
||||
for (MenuWithSeparators* menu : { &m_object_menu, &m_sla_object_menu, &m_part_menu, &m_default_menu })
|
||||
|
|
|
|||
|
|
@ -40,7 +40,9 @@ public:
|
|||
~MenuFactory() = default;
|
||||
|
||||
void init(wxWindow* parent);
|
||||
void update();
|
||||
void update_object_menu();
|
||||
void update_default_menu();
|
||||
void msw_rescale();
|
||||
void sys_color_changed();
|
||||
|
||||
|
|
|
|||
|
|
@ -910,6 +910,7 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
|||
|
||||
GCodeViewer::EViewType gcode_view_type = m_canvas->get_gcode_view_preview_type();
|
||||
bool gcode_preview_data_valid = !m_gcode_result->moves.empty();
|
||||
|
||||
// Collect colors per extruder.
|
||||
std::vector<std::string> colors;
|
||||
std::vector<CustomGCode::Item> color_print_values = {};
|
||||
|
|
@ -934,9 +935,9 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
|||
color_print_values.clear();
|
||||
}
|
||||
|
||||
if (IsShown()) {
|
||||
std::vector<double> zs;
|
||||
std::vector<double> zs;
|
||||
|
||||
if (IsShown()) {
|
||||
m_canvas->set_selected_extruder(0);
|
||||
if (gcode_preview_data_valid) {
|
||||
// Load the real G-code preview.
|
||||
|
|
@ -947,7 +948,12 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
|||
Refresh();
|
||||
zs = m_canvas->get_gcode_layers_zs();
|
||||
m_loaded = true;
|
||||
} else {
|
||||
}
|
||||
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
|
||||
else if (wxGetApp().is_editor()) {
|
||||
#else
|
||||
else {
|
||||
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
|
||||
// Load the initial preview based on slices, not the final G-code.
|
||||
m_canvas->load_preview(colors, color_print_values);
|
||||
m_left_sizer->Hide(m_bottom_toolbar_panel);
|
||||
|
|
@ -955,6 +961,33 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
|||
Refresh();
|
||||
zs = m_canvas->get_volumes_print_zs(true);
|
||||
}
|
||||
|
||||
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
|
||||
if (!zs.empty() && !m_keep_current_preview_type) {
|
||||
unsigned int number_extruders = wxGetApp().is_editor() ?
|
||||
(unsigned int)print->extruders().size() :
|
||||
m_canvas->get_gcode_extruders_count();
|
||||
std::vector<Item> gcodes = wxGetApp().is_editor() ?
|
||||
wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes :
|
||||
m_canvas->get_custom_gcode_per_print_z();
|
||||
const wxString choice = !gcodes.empty() ?
|
||||
_L("Color Print") :
|
||||
(number_extruders > 1) ? _L("Tool") : _L("Feature type");
|
||||
|
||||
int type = m_choice_view_type->FindString(choice);
|
||||
if (m_choice_view_type->GetSelection() != type) {
|
||||
if (0 <= type && type < static_cast<int>(GCodeViewer::EViewType::Count)) {
|
||||
m_choice_view_type->SetSelection(type);
|
||||
m_canvas->set_gcode_view_preview_type(static_cast<GCodeViewer::EViewType>(type));
|
||||
if (wxGetApp().is_gcode_viewer()) {
|
||||
m_keep_current_preview_type = true;
|
||||
refresh_print();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
|
||||
|
||||
if (zs.empty()) {
|
||||
// all layers filtered out
|
||||
hide_layers_slider();
|
||||
|
|
@ -963,9 +996,9 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
|||
update_layers_slider(zs, keep_z_range);
|
||||
}
|
||||
|
||||
unsigned int number_extruders = (unsigned int)print->extruders().size();
|
||||
|
||||
#if !ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
|
||||
if (!m_keep_current_preview_type) {
|
||||
unsigned int number_extruders = (unsigned int)print->extruders().size();
|
||||
const wxString choice = !wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes.empty() ?
|
||||
_L("Color Print") :
|
||||
(number_extruders > 1) ? _L("Tool") : _L("Feature type");
|
||||
|
|
@ -978,6 +1011,7 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif // !ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
|
||||
}
|
||||
|
||||
void Preview::load_print_as_sla()
|
||||
|
|
|
|||
|
|
@ -1120,6 +1120,11 @@ void ImGuiWrapper::init_style()
|
|||
set_color(ImGuiCol_TabActive, COL_ORANGE_LIGHT);
|
||||
set_color(ImGuiCol_TabUnfocused, COL_GREY_DARK);
|
||||
set_color(ImGuiCol_TabUnfocusedActive, COL_GREY_LIGHT);
|
||||
|
||||
// Scrollbars
|
||||
set_color(ImGuiCol_ScrollbarGrab, COL_ORANGE_DARK);
|
||||
set_color(ImGuiCol_ScrollbarGrabHovered, COL_ORANGE_LIGHT);
|
||||
set_color(ImGuiCol_ScrollbarGrabActive, COL_ORANGE_LIGHT);
|
||||
}
|
||||
|
||||
void ImGuiWrapper::render_draw_data(ImDrawData *draw_data)
|
||||
|
|
|
|||
|
|
@ -2653,8 +2653,10 @@ wxString Plater::priv::get_export_file(GUI::FileType file_type)
|
|||
default: break;
|
||||
}
|
||||
|
||||
std::string out_dir = (boost::filesystem::path(output_file).parent_path()).string();
|
||||
|
||||
wxFileDialog dlg(q, dlg_title,
|
||||
from_path(output_file.parent_path()), from_path(output_file.filename()),
|
||||
is_shapes_dir(out_dir) ? from_u8(wxGetApp().app_config->get_last_dir()) : from_path(output_file.parent_path()), from_path(output_file.filename()),
|
||||
wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
|
||||
if (dlg.ShowModal() != wxID_OK)
|
||||
|
|
@ -3533,7 +3535,6 @@ void Plater::priv::fix_through_netfabb(const int obj_idx, const int vol_idx/* =
|
|||
}
|
||||
|
||||
fix_model_by_win10_sdk_gui(*mo, vol_idx);
|
||||
q->SetFocus();
|
||||
sla::reproject_points_and_holes(mo);
|
||||
this->update();
|
||||
this->object_list_changed();
|
||||
|
|
@ -6267,7 +6268,7 @@ void Plater::mirror(Axis axis) { p->mirror(axis); }
|
|||
void Plater::split_object() { p->split_object(); }
|
||||
void Plater::split_volume() { p->split_volume(); }
|
||||
void Plater::optimize_rotation() { p->m_ui_jobs.optimize_rotation();}
|
||||
void Plater::update_object_menu() { p->menus.update_object_menu(); }
|
||||
void Plater::update_menus() { p->menus.update(); }
|
||||
void Plater::show_action_buttons(const bool ready_to_slice) const { p->show_action_buttons(ready_to_slice); }
|
||||
|
||||
void Plater::copy_selection_to_clipboard()
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ public:
|
|||
std::vector<std::string> get_extruder_colors_from_plater_config(const GCodeProcessor::Result* const result = nullptr) const;
|
||||
std::vector<std::string> get_colors_for_color_print(const GCodeProcessor::Result* const result = nullptr) const;
|
||||
|
||||
void update_object_menu();
|
||||
void update_menus();
|
||||
void show_action_buttons(const bool is_ready_to_slice) const;
|
||||
|
||||
wxString get_project_filename(const wxString& extension = wxEmptyString) const;
|
||||
|
|
|
|||
|
|
@ -1173,6 +1173,10 @@ void Tab::activate_option(const std::string& opt_key, const wxString& category)
|
|||
if (!cur_item)
|
||||
return;
|
||||
|
||||
// We should to activate a tab with searched option, if it doesn't.
|
||||
// And do it before finding of the cur_item to avoid a case when Tab isn't activated jet and all treeItems are invisible
|
||||
wxGetApp().mainframe->select_tab(this);
|
||||
|
||||
while (cur_item) {
|
||||
auto title = m_treectrl->GetItemText(cur_item);
|
||||
if (page_title != title) {
|
||||
|
|
@ -1184,8 +1188,6 @@ void Tab::activate_option(const std::string& opt_key, const wxString& category)
|
|||
break;
|
||||
}
|
||||
|
||||
// we should to activate a tab with searched option, if it doesn't.
|
||||
wxGetApp().mainframe->select_tab(this);
|
||||
Field* field = get_field(opt_key);
|
||||
|
||||
// focused selected field
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@
|
|||
#include "../GUI/GUI.hpp"
|
||||
#include "../GUI/I18N.hpp"
|
||||
#include "../GUI/MsgDialog.hpp"
|
||||
#include "../GUI/GUI_App.hpp"
|
||||
#include "../GUI/Mainframe.hpp"
|
||||
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/progdlg.h>
|
||||
|
|
@ -341,7 +343,7 @@ void fix_model_by_win10_sdk_gui(ModelObject &model_object, int volume_idx)
|
|||
wxProgressDialog progress_dialog(
|
||||
_L("Model fixing"),
|
||||
_L("Exporting model") + "...",
|
||||
100, nullptr, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT);
|
||||
100, GUI::wxGetApp().mainframe, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT);
|
||||
// Executing the calculation in a background thread, so that the COM context could be created with its own threading model.
|
||||
// (It seems like wxWidgets initialize the COM contex as single threaded and we need a multi-threaded context).
|
||||
bool success = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue