mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-27 19:01:02 +00:00
Make AMS trays read-only in laser mode and add the gradient fill helper
This commit is contained in:
@@ -927,6 +927,7 @@ void AMSControl::UpdateAms(const std::string &series_name,
|
||||
std::vector<AMSinfo> ext_info,
|
||||
DevExtderSystem data,
|
||||
std::string dev_id,
|
||||
MachineObject* obj,
|
||||
bool is_reset,
|
||||
bool test)
|
||||
{
|
||||
@@ -996,6 +997,18 @@ void AMSControl::UpdateAms(const std::string &series_name,
|
||||
}
|
||||
}
|
||||
|
||||
// 2D mode (laser/cut) makes every spool view-only: show the read-only (eye) icon while the spool
|
||||
// stays clickable to open the read-only filament dialog.
|
||||
// Orca: gated on the device mode via MachineObject::is_fdm_type(); obj is null for callers that do
|
||||
// not supply it, leaving spools editable.
|
||||
const bool view_only = obj && !obj->is_fdm_type();
|
||||
for (auto ams_item : m_ams_item_list) {
|
||||
if (ams_item.second == nullptr) { continue; }
|
||||
for (auto lib_it : ams_item.second->get_can_lib_list()) {
|
||||
if (lib_it.second) { lib_it.second->set_view_only(view_only); }
|
||||
}
|
||||
}
|
||||
|
||||
for (auto ams_prv : m_ams_preview_list) {
|
||||
std::string id = ams_prv.second->get_ams_id();
|
||||
auto item = m_ams_item_list.find(id);
|
||||
|
||||
@@ -179,8 +179,10 @@ public:
|
||||
std::vector<AMSinfo> ext_info,
|
||||
DevExtderSystem data,
|
||||
std::string dev_id,
|
||||
MachineObject* obj = nullptr,
|
||||
bool is_reset = true,
|
||||
bool test = false);
|
||||
// Orca: simulation-data generator for local AMS-layout testing (no device required)
|
||||
std::vector<AMSinfo> GenerateSimulateData();
|
||||
|
||||
void AddAms(AMSinfo info, AMSPanelPos pos = AMSPanelPos::LEFT_PANEL);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "../BitmapCache.hpp"
|
||||
#include "../I18N.hpp"
|
||||
#include "../GUI_App.hpp"
|
||||
#include "../FilamentBitmapUtils.hpp"
|
||||
#include "../Utils/WxFontUtils.hpp"
|
||||
|
||||
#include "slic3r/GUI/DeviceTab/uiAmsHumidityPopup.h"
|
||||
@@ -1374,6 +1375,11 @@ void AMSLib::render_lite_lib(wxDC& dc)
|
||||
}
|
||||
}
|
||||
|
||||
// View-only mode forces the read-only (eye) icon even for third-party spools.
|
||||
if (m_view_only) {
|
||||
temp_bitmap_third = temp_bitmap_brand;
|
||||
}
|
||||
|
||||
dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
|
||||
if (m_info.material_cols.size() > 1) {
|
||||
int left = FromDIP(10);
|
||||
@@ -1382,7 +1388,7 @@ void AMSLib::render_lite_lib(wxDC& dc)
|
||||
if (m_info.ctype == 0) {
|
||||
for (int i = 0; i < m_info.material_cols.size() - 1; i++) {
|
||||
auto rect = wxRect(left, FromDIP(10), libsize.x - FromDIP(18), libsize.y - FromDIP(18));
|
||||
dc.GradientFillLinear(rect, m_info.material_cols[i], m_info.material_cols[i + 1], wxEAST);
|
||||
fill_gradient_rect_east(dc, rect, m_info.material_cols[i], m_info.material_cols[i + 1]);
|
||||
left += gwidth;
|
||||
}
|
||||
}
|
||||
@@ -1465,6 +1471,11 @@ void AMSLib::render_generic_lib(wxDC &dc)
|
||||
temp_bitmap_brand = m_bitmap_readonly;
|
||||
}
|
||||
|
||||
// View-only mode forces the read-only (eye) icon even for third-party spools.
|
||||
if (m_view_only) {
|
||||
temp_bitmap_third = temp_bitmap_brand;
|
||||
}
|
||||
|
||||
dc.SetPen(wxPen(tmp_lib_colour, 1, wxPENSTYLE_SOLID));
|
||||
dc.SetBrush(wxBrush(tmp_lib_colour));
|
||||
|
||||
@@ -1575,7 +1586,7 @@ void AMSLib::render_generic_lib(wxDC &dc)
|
||||
}
|
||||
|
||||
auto rect = wxRect(left, height - curr_height, gwidth, curr_height);
|
||||
dc.GradientFillLinear(rect, m_info.material_cols[i], m_info.material_cols[i + 1], wxEAST);
|
||||
fill_gradient_rect_east(dc, rect, m_info.material_cols[i], m_info.material_cols[i + 1]);
|
||||
left += gwidth;
|
||||
}
|
||||
}
|
||||
@@ -2749,7 +2760,7 @@ void AMSPreview::doRender(wxDC &dc)
|
||||
}
|
||||
|
||||
auto rect = wxRect(fleft, (size.y - AMS_ITEM_CUBE_SIZE.y) / 2, gwidth, AMS_ITEM_CUBE_SIZE.y);
|
||||
dc.GradientFillLinear(rect, iter->material_cols[i], iter->material_cols[i + 1], wxEAST);
|
||||
fill_gradient_rect_east(dc, rect, iter->material_cols[i], iter->material_cols[i + 1]);
|
||||
fleft += gwidth;
|
||||
}
|
||||
}
|
||||
@@ -2821,7 +2832,7 @@ void AMSPreview::doRender(wxDC &dc)
|
||||
}
|
||||
|
||||
auto rect = wxRect(fleft, (size.y - AMS_ITEM_CUBE_SIZE.y) / 2, gwidth, AMS_ITEM_CUBE_SIZE.y);
|
||||
dc.GradientFillLinear(rect, iter.material_cols[i], iter.material_cols[i + 1], wxEAST);
|
||||
fill_gradient_rect_east(dc, rect, iter.material_cols[i], iter.material_cols[i + 1]);
|
||||
fleft += gwidth;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,6 +503,9 @@ public:
|
||||
void support_cali(bool sup) { m_support_cali = sup; Refresh(); };
|
||||
virtual bool Enable(bool enable = true);
|
||||
void set_disable_mode(bool disable) { m_disable_mode = disable; }
|
||||
// View-only mode (2D laser/cut): show the read-only (eye) icon for every editable spool
|
||||
// while keeping it clickable to open the read-only filament dialog.
|
||||
void set_view_only(bool view_only) { if (m_view_only != view_only) { m_view_only = view_only; Refresh(); } }
|
||||
void msw_rescale();
|
||||
void on_pass_road(bool pass);
|
||||
|
||||
@@ -542,6 +545,7 @@ protected:
|
||||
wxColour m_road_def_color;
|
||||
wxColour m_lib_color;
|
||||
bool m_disable_mode{ false };
|
||||
bool m_view_only{ false };
|
||||
bool m_pass_road{false};
|
||||
|
||||
void on_enter_window(wxMouseEvent &evt);
|
||||
|
||||
Reference in New Issue
Block a user