mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 10:02:12 +00:00
ENH: refine ui logic with filament group
1. Add filament group pop up when slice 2. Add more filament modes in filament dialog 3. Add capsule button jira:NONE Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I8bc3a2e08696e406b89e550a0335a1a36728ee65 (cherry picked from commit f1702a5c3604f685a3b35ea0e83d29bdbbd90f70)
This commit is contained in:
@@ -62,6 +62,7 @@
|
||||
#include "ConfigWizard.hpp"
|
||||
#include "Widgets/WebView.hpp"
|
||||
#include "DailyTips.hpp"
|
||||
#include "FilamentMapDialog.hpp"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <dbt.h>
|
||||
@@ -1578,20 +1579,7 @@ wxBoxSizer* MainFrame::create_side_tools()
|
||||
|
||||
sizer->Layout();
|
||||
|
||||
// m_publish_btn->Bind(wxEVT_BUTTON, [this](auto& e) {
|
||||
// CallAfter([this] {
|
||||
// wxGetApp().open_publish_page_dialog();
|
||||
|
||||
// if (!wxGetApp().getAgent()) {
|
||||
// BOOST_LOG_TRIVIAL(info) << "publish: no agent";
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // record
|
||||
// json j;
|
||||
// NetworkAgent* agent = GUI::wxGetApp().getAgent();
|
||||
// });
|
||||
// });
|
||||
m_filament_group_popup = new FilamentGroupPopup(m_slice_btn);
|
||||
|
||||
m_slice_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event)
|
||||
{
|
||||
@@ -1602,14 +1590,62 @@ wxBoxSizer* MainFrame::create_side_tools()
|
||||
//this->m_plater->select_view_3D("Preview");
|
||||
m_plater->exit_gizmo();
|
||||
m_plater->update(true, true);
|
||||
if (m_slice_select == eSliceAll)
|
||||
wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_ALL));
|
||||
else
|
||||
wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_PLATE));
|
||||
|
||||
this->m_tabpanel->SetSelection(tpPreview);
|
||||
bool slice = true;
|
||||
|
||||
auto full_config = wxGetApp().preset_bundle->full_config();
|
||||
std::vector<int>g_filament_map = full_config.option<ConfigOptionInts>("filament_map")->values;
|
||||
FilamentMapMode g_filament_map_mode = get_prefered_map_mode();
|
||||
if (is_pop_up_required()) {
|
||||
auto filament_colors = full_config.option<ConfigOptionStrings>("filament_colour")->values;
|
||||
g_filament_map.resize(filament_colors.size());
|
||||
std::vector<int> filament_lists(filament_colors.size());
|
||||
std::iota(filament_lists.begin(), filament_lists.end(), 1);
|
||||
|
||||
FilamentMapDialog filament_dlg(this,
|
||||
filament_colors,
|
||||
g_filament_map,
|
||||
filament_lists,
|
||||
FilamentMapMode::fmmManual,
|
||||
false
|
||||
);
|
||||
auto ret = filament_dlg.ShowModal();
|
||||
if (ret == wxID_OK) {
|
||||
g_filament_map_mode = filament_dlg.get_mode();
|
||||
g_filament_map = filament_dlg.get_filament_maps();
|
||||
}
|
||||
else {
|
||||
slice = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (slice) {
|
||||
m_plater->set_global_filament_map_mode(g_filament_map_mode);
|
||||
if (g_filament_map_mode == FilamentMapMode::fmmManual)
|
||||
m_plater->set_global_filament_map(g_filament_map);
|
||||
if (m_slice_select == eSliceAll)
|
||||
wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_ALL));
|
||||
else
|
||||
wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_PLATE));
|
||||
this->m_tabpanel->SetSelection(tpPreview);
|
||||
}
|
||||
});
|
||||
|
||||
m_slice_btn->Bind(wxEVT_ENTER_WINDOW, [this](wxMouseEvent& event) {
|
||||
m_filament_group_popup->SetSize(wxSize(FromDIP(380),-1));
|
||||
wxPoint pos = m_slice_btn->ClientToScreen(wxPoint(0, 0));
|
||||
pos.y += m_slice_btn->GetRect().height * 1.25;
|
||||
pos.x -= (m_slice_option_btn->GetRect().width + m_filament_group_popup->GetRect().width * 0.6);
|
||||
|
||||
m_filament_group_popup->SetPosition(pos);
|
||||
m_filament_group_popup->tryPopup(m_plater->check_ams_status());
|
||||
});
|
||||
|
||||
m_slice_btn->Bind(wxEVT_LEAVE_WINDOW, [this](auto& event) {
|
||||
m_filament_group_popup->tryClose();
|
||||
});
|
||||
|
||||
|
||||
m_print_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event)
|
||||
{
|
||||
//this->m_plater->select_view_3D("Preview");
|
||||
@@ -3870,6 +3906,7 @@ void MainFrame::technology_changed()
|
||||
m_menubar->SetMenuLabel(id, pt == ptSLA ? _omitL("Material Settings") : _L("Filament Settings"));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Called after the Preferences dialog is closed and the program settings are saved.
|
||||
// Update the UI based on the current preferences.
|
||||
|
||||
Reference in New Issue
Block a user