ENH: adjust ExtrusionCalibration image related
Change-Id: Icca866dc5a164dee7da420f2fc04976bcfb42d04
This commit is contained in:
parent
07282cc078
commit
8a3b39345e
7 changed files with 53 additions and 19 deletions
|
@ -1,9 +1,6 @@
|
|||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect opacity="0.08" width="32" height="32" fill="black"/>
|
||||
<path d="M18 10H22V14" stroke="white" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M14 10H10V14" stroke="white" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M18 22H22V18" stroke="white" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M14 22H10V18" stroke="white" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M22.0013 10L17.668 14.3333" stroke="white" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M14.3333 17.666L10 21.9993" stroke="white" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.30078 2.00078C1.30078 1.61418 1.61418 1.30078 2.00078 1.30078H6.00078C6.38738 1.30078 6.70078 1.61418 6.70078 2.00078C6.70078 2.38738 6.38738 2.70078 6.00078 2.70078H2.70078V6.00078C2.70078 6.38738 2.38738 6.70078 2.00078 6.70078C1.61418 6.70078 1.30078 6.38738 1.30078 6.00078V2.00078Z" fill="white" fill-opacity="0.88"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.0008 9.30078C14.3874 9.30078 14.7008 9.61418 14.7008 10.0008V14.0008C14.7008 14.3874 14.3874 14.7008 14.0008 14.7008H10.0008C9.61418 14.7008 9.30078 14.3874 9.30078 14.0008C9.30078 13.6142 9.61418 13.3008 10.0008 13.3008H13.3008V10.0008C13.3008 9.61418 13.6142 9.30078 14.0008 9.30078Z" fill="white" fill-opacity="0.88"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.9982 1.30078H14.0008C14.3874 1.30078 14.7008 1.61418 14.7008 2.00078V6.00078C14.7008 6.38738 14.3874 6.70078 14.0008 6.70078C13.6142 6.70078 13.3008 6.38738 13.3008 6.00078V3.68813L10.1598 6.82909C9.88645 7.10246 9.44324 7.10246 9.16987 6.82909C8.8965 6.55572 8.8965 6.11251 9.16987 5.83914L12.3082 2.70078H10.0008C9.61418 2.70078 9.30078 2.38738 9.30078 2.00078C9.30078 1.61418 9.61418 1.30078 10.0008 1.30078H13.9982Z" fill="white" fill-opacity="0.88"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.82909 10.1618C7.10246 9.8884 7.10246 9.44519 6.82909 9.17182C6.55572 8.89846 6.11251 8.89846 5.83914 9.17182L2.70078 12.3102V10.0008C2.70078 9.61418 2.38738 9.30078 2.00078 9.30078C1.61418 9.30078 1.30078 9.61418 1.30078 10.0008V14.0001V14.0008C1.30078 14.3874 1.61418 14.7008 2.00078 14.7008H6.00078C6.38738 14.7008 6.70078 14.3874 6.70078 14.0008C6.70078 13.6142 6.38738 13.3008 6.00078 13.3008H3.69008L6.82909 10.1618Z" fill="white" fill-opacity="0.88"/>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 826 B After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.3 MiB |
BIN
resources/images/extrusion_calibration_tips_en.png
Normal file
BIN
resources/images/extrusion_calibration_tips_en.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 MiB |
BIN
resources/images/extrusion_calibration_tips_zh.png
Normal file
BIN
resources/images/extrusion_calibration_tips_zh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 MiB |
|
@ -431,7 +431,7 @@ bool MachineObject::is_in_extrusion_cali()
|
|||
{
|
||||
auto curr_time = std::chrono::system_clock::now();
|
||||
auto diff = std::chrono::duration_cast<std::chrono::milliseconds>(curr_time - last_extrusion_cali_start_time);
|
||||
if (diff.count() > EXTRUSION_OMIT_TIME) {
|
||||
if (diff.count() < EXTRUSION_OMIT_TIME) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -449,7 +449,7 @@ bool MachineObject::is_extrusion_cali_finished()
|
|||
{
|
||||
auto curr_time = std::chrono::system_clock::now();
|
||||
auto diff = std::chrono::duration_cast<std::chrono::milliseconds>(curr_time - last_extrusion_cali_start_time);
|
||||
if (diff.count() > EXTRUSION_OMIT_TIME) {
|
||||
if (diff.count() < EXTRUSION_OMIT_TIME) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "MsgDialog.hpp"
|
||||
#include "libslic3r/Preset.hpp"
|
||||
#include "I18N.hpp"
|
||||
#include <wx/dcgraph.h>
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
|
@ -15,8 +16,23 @@ ExtrusionCalibration::ExtrusionCalibration(wxWindow *parent, wxWindowID id)
|
|||
wxGetApp().UpdateDlgDarkUI(this);
|
||||
}
|
||||
|
||||
void ExtrusionCalibration::init_bitmaps()
|
||||
{
|
||||
auto lan = wxGetApp().app_config->get_language_code();
|
||||
if (lan == "zh-cn") {
|
||||
m_is_zh = true;
|
||||
m_calibration_tips_bmp_zh = create_scaled_bitmap("extrusion_calibration_tips_zh", nullptr, 256);
|
||||
}
|
||||
else{
|
||||
m_is_zh = false;
|
||||
m_calibration_tips_bmp_en = create_scaled_bitmap("extrusion_calibration_tips_en", nullptr, 256);
|
||||
}
|
||||
m_calibration_tips_open_btn_bmp = create_scaled_bitmap("extrusion_calibrati_open_button", nullptr, 16);
|
||||
}
|
||||
|
||||
void ExtrusionCalibration::create()
|
||||
{
|
||||
init_bitmaps();
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
wxBoxSizer* sizer_main = new wxBoxSizer(wxVERTICAL);
|
||||
m_step_1_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||
|
@ -219,8 +235,6 @@ void ExtrusionCalibration::create()
|
|||
auto content_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_calibration_tips_static_bmp = new wxStaticBitmap(m_step_2_panel, wxID_ANY, wxNullBitmap, wxDefaultPosition, EXTRUSION_CALIBRATION_BMP_SIZE, 0);
|
||||
content_sizer->Add(m_calibration_tips_static_bmp, 1, wxEXPAND | wxSHAPED);
|
||||
m_calibration_tips_bmp = create_scaled_bitmap("extrusion_calibration_tips", nullptr, 256);
|
||||
m_calibration_tips_open_btn_bmp = create_scaled_bitmap("extrusion_calibrati_open_button", nullptr, 32);
|
||||
content_sizer->Add(EXTRUSION_CALIBRATION_WIDGET_GAP, 0, 0, 0);
|
||||
// k/n input value
|
||||
auto kn_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
@ -319,25 +333,42 @@ ExtrusionCalibration::~ExtrusionCalibration()
|
|||
void ExtrusionCalibration::paint(wxPaintEvent&) {
|
||||
auto size = m_calibration_tips_static_bmp->GetSize();
|
||||
wxPaintDC dc(m_calibration_tips_static_bmp);
|
||||
dc.DrawBitmap(m_calibration_tips_bmp, wxPoint(0, 0));
|
||||
dc.DrawBitmap(m_calibration_tips_open_btn_bmp, wxPoint(0, size.y - EXTRUSION_CALIBRATION_BMP_BTN_SIZE.y));
|
||||
wxGCDC gcdc(dc);
|
||||
|
||||
dc.DrawBitmap(m_is_zh ? m_calibration_tips_bmp_zh : m_calibration_tips_bmp_en, wxPoint(0, 0));
|
||||
|
||||
gcdc.SetPen(wxColour(0, 0, 0, 61));
|
||||
gcdc.SetBrush(wxColour(0, 0, 0, 61));
|
||||
gcdc.DrawRectangle(wxPoint(0, 0), EXTRUSION_CALIBRATION_BMP_TIP_BAR);
|
||||
|
||||
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||
int pos_offset = (EXTRUSION_CALIBRATION_BMP_TIP_BAR.y - EXTRUSION_CALIBRATION_BMP_BTN_SIZE.y) / 2;
|
||||
wxPoint open_btn_pos = wxPoint(size.x - pos_offset - EXTRUSION_CALIBRATION_BMP_BTN_SIZE.x, pos_offset);
|
||||
dc.DrawBitmap(m_calibration_tips_open_btn_bmp, open_btn_pos);
|
||||
|
||||
gcdc.SetFont(Label::Head_14);
|
||||
gcdc.SetTextForeground(wxColour(255, 255, 255, 224));
|
||||
wxSize text_size = wxWindow::GetTextExtent(_L("Example"));
|
||||
gcdc.DrawText(_L("Example"), { (EXTRUSION_CALIBRATION_BMP_TIP_BAR.x - text_size.x) / 2, (EXTRUSION_CALIBRATION_BMP_TIP_BAR.y - text_size.y) / 2});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void ExtrusionCalibration::open_bitmap(wxMouseEvent& event) {
|
||||
auto pos = event.GetPosition();
|
||||
auto size = m_calibration_tips_static_bmp->GetSize();
|
||||
if (pos.x > 0 && pos.y > size.y - EXTRUSION_CALIBRATION_BMP_BTN_SIZE.y &&
|
||||
pos.x < EXTRUSION_CALIBRATION_BMP_BTN_SIZE.x && pos.y < size.y) {
|
||||
if (pos.x > size.x - EXTRUSION_CALIBRATION_BMP_TIP_BAR.y && pos.y > 0 &&
|
||||
pos.x < size.x && pos.y < EXTRUSION_CALIBRATION_BMP_TIP_BAR.y) {
|
||||
auto* popup = new wxDialog(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize);
|
||||
auto bmp_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxStaticBitmap* zoomed_bitmap = new wxStaticBitmap(popup, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0);
|
||||
zoomed_bitmap->SetBitmap(create_scaled_bitmap("extrusion_calibration_tips", nullptr, 720));
|
||||
zoomed_bitmap->SetBitmap(create_scaled_bitmap(m_is_zh ? "extrusion_calibration_tips_zh" : "extrusion_calibration_tips_en", nullptr, 720));
|
||||
bmp_sizer->Add(zoomed_bitmap, 1, wxEXPAND);
|
||||
popup->SetSizer(bmp_sizer);
|
||||
popup->Layout();
|
||||
popup->Fit();
|
||||
popup->CenterOnParent();
|
||||
wxGetApp().UpdateDlgDarkUI(popup);
|
||||
popup->ShowModal();
|
||||
}
|
||||
return;
|
||||
|
@ -678,6 +709,7 @@ void ExtrusionCalibration::Popup()
|
|||
update();
|
||||
Layout();
|
||||
Fit();
|
||||
wxGetApp().UpdateDlgDarkUI(this);
|
||||
ShowModal();
|
||||
}
|
||||
void ExtrusionCalibration::post_select_event() {
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
#define EXTRUSION_CALIBRATION_BUTTON_SIZE wxSize(FromDIP(72), FromDIP(24))
|
||||
#define EXTRUSION_CALIBRATION_INPUT_SIZE wxSize(FromDIP(100), FromDIP(24))
|
||||
#define EXTRUSION_CALIBRATION_BMP_SIZE wxSize(FromDIP(256), FromDIP(256))
|
||||
#define EXTRUSION_CALIBRATION_BMP_BTN_SIZE wxSize(FromDIP(32), FromDIP(32))
|
||||
#define EXTRUSION_CALIBRATION_BMP_TIP_BAR wxSize(FromDIP(256), FromDIP(40))
|
||||
#define EXTRUSION_CALIBRATION_BMP_BTN_SIZE wxSize(FromDIP(16), FromDIP(16))
|
||||
|
||||
|
||||
|
||||
|
@ -69,6 +70,7 @@ public:
|
|||
std::vector<Preset*> user_filaments;
|
||||
|
||||
protected:
|
||||
void init_bitmaps();
|
||||
void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||
void paint(wxPaintEvent&);
|
||||
void open_bitmap(wxMouseEvent& event);
|
||||
|
@ -128,7 +130,8 @@ protected:
|
|||
wxStaticText* m_error_text;
|
||||
|
||||
wxBitmap m_calibration_tips_open_btn_bmp;
|
||||
wxBitmap m_calibration_tips_bmp;
|
||||
wxBitmap m_calibration_tips_bmp_zh;
|
||||
wxBitmap m_calibration_tips_bmp_en;
|
||||
wxStaticBitmap* m_calibration_tips_static_bmp;
|
||||
// save n and k result
|
||||
wxStaticText* m_k_param;
|
||||
|
@ -137,6 +140,8 @@ protected:
|
|||
TextInput* m_n_val;
|
||||
Button* m_button_last_step;
|
||||
Button* m_button_save_result;
|
||||
|
||||
bool m_is_zh{ false };
|
||||
};
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
|
Loading…
Reference in a new issue