Skip to content

Commit 22d6300

Browse files
committed
feat: auto-save, 0.1/0.01mm arrow steps, dark mode contrast fix
- Preferences > General Settings: "Auto-save project every 5 minutes" checkbox (config key autosave_enabled); a wxTimer in MainFrame fires every 5 min and calls save_project() silently when the project has a filename, is dirty, and the option is enabled (closes #10334) - Alt+Arrow moves selected objects by 0.1 mm; Alt+Shift+Arrow by 0.01 mm; existing Shift+Arrow (1 mm) and plain Arrow (10 mm) are unchanged; added to the keyboard shortcuts dialog (closes #10194) - LayerRangeEditor now explicitly sets background/foreground to the app's dark-mode palette colours after UpdateDarkUI(), fixing the unreadable contrast in the Height Range Modifier field on Linux dark mode (closes #10685)
1 parent 5bbfc09 commit 22d6300

6 files changed

Lines changed: 29 additions & 4 deletions

File tree

src/slic3r/GUI/GLCanvas3D.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4329,7 +4329,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
43294329
class TranslationProcessor
43304330
{
43314331
using UpAction = std::function<void(void)>;
4332-
using DownAction = std::function<void(const Vec3d&, bool, bool)>;
4332+
using DownAction = std::function<void(const Vec3d&, bool, bool, bool)>;
43334333

43344334
UpAction m_up_action{ nullptr };
43354335
DownAction m_down_action{ nullptr };
@@ -4407,7 +4407,7 @@ class TranslationProcessor
44074407

44084408
if (apply) {
44094409
m_running = true;
4410-
m_down_action(m_direction, evt.ShiftDown(), evt.CmdDown());
4410+
m_down_action(m_direction, evt.ShiftDown(), evt.CmdDown(), evt.AltDown());
44114411
}
44124412
}
44134413
}
@@ -4433,12 +4433,12 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
44334433
refresh_camera_scene_box();
44344434
m_dirty = true;
44354435
},
4436-
[this](const Vec3d& direction, bool slow, bool camera_space) {
4436+
[this](const Vec3d& direction, bool slow, bool camera_space, bool fine) {
44374437
if (m_gizmos.is_ban_move_glvolume()) {
44384438
return;
44394439
}
44404440
m_selection.setup_cache();
4441-
double multiplier = slow ? 1.0 : 10.0;
4441+
double multiplier = fine ? (slow ? 0.01 : 0.1) : (slow ? 1.0 : 10.0);
44424442

44434443
Vec3d displacement;
44444444
if (camera_space) {

src/slic3r/GUI/GUI_ObjectLayers.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,10 @@ LayerRangeEditor::LayerRangeEditor( ObjectLayers* parent,
351351
{
352352
this->SetFont(wxGetApp().normal_font());
353353
wxGetApp().UpdateDarkUI(this);
354+
if (wxGetApp().dark_mode()) {
355+
SetBackgroundColour(wxGetApp().get_window_default_clr());
356+
SetForegroundColour(wxGetApp().get_label_clr_default());
357+
}
354358

355359
// Reset m_enter_pressed flag to _false_, when value is editing
356360
this->Bind(wxEVT_TEXT, [this](wxEvent&) { m_enter_pressed = false; }, this->GetId());

src/slic3r/GUI/KBShortcutsDialog.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ void KBShortcutsDialog::fill_shortcuts()
240240
{L("Arrow Left"), L("Move selection 10 mm in negative X direction")},
241241
{L("Arrow Right"), L("Move selection 10 mm in positive X direction")},
242242
{L("Shift+Any arrow"), L("Movement step set to 1 mm")},
243+
{L("Alt+Any arrow"), L("Movement step set to 0.1 mm")},
244+
{L("Alt+Shift+Any arrow"), L("Movement step set to 0.01 mm")},
243245
{"Esc", L("Deselect all")},
244246
{"1-9", L("keyboard 1-9: set filament for object/part")},
245247
{ctrl + "0", L("Camera view - Default")},

src/slic3r/GUI/MainFrame.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,19 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
296296
});
297297
#endif
298298

299+
// Auto-save timer: silently saves the open project every 5 minutes when enabled
300+
m_autosave_timer = new wxTimer(this);
301+
Bind(wxEVT_TIMER, [this](wxTimerEvent& e) {
302+
if (e.GetTimer().GetId() != m_autosave_timer->GetId()) { e.Skip(); return; }
303+
if (!wxGetApp().app_config || wxGetApp().app_config->get("autosave_enabled") != "1") return;
304+
if (!m_plater) return;
305+
if (!m_plater->is_project_dirty()) return;
306+
if (m_plater->get_project_filename(".3mf").IsEmpty()) return;
307+
BOOST_LOG_TRIVIAL(info) << "auto-save: saving project";
308+
m_plater->save_project(false);
309+
});
310+
m_autosave_timer->Start(5 * 60 * 1000); // every 5 minutes
311+
299312
#ifdef __APPLE__
300313
// Initialize the docker task bar icon.
301314
switch (wxGetApp().get_app_mode()) {

src/slic3r/GUI/MainFrame.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class MainFrame : public DPIFrame
9696
#endif
9797
bool m_loaded {false};
9898
wxTimer* m_reset_title_text_colour_timer{ nullptr };
99+
wxTimer* m_autosave_timer{ nullptr };
99100

100101
wxString m_qs_last_input_file = wxEmptyString;
101102
wxString m_qs_last_output_file = wxEmptyString;

src/slic3r/GUI/Preferences.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,10 @@ wxWindow* PreferencesDialog::create_general_page()
13191319
50, "single_instance");
13201320

13211321
auto item_auto_transfer_when_switch_preset = create_item_checkbox(_L("Automatically transfer modified value when switching process and filament presets"), page,_L("After closing, a popup will appear to ask each time"), 50, "auto_transfer_when_switch_preset");
1322+
auto item_autosave = create_item_checkbox(_L("Auto-save project every 5 minutes"), page,
1323+
_L("Automatically save the open project file every 5 minutes. Only saves if the project has a filename and unsaved changes."), 50,
1324+
"autosave_enabled");
1325+
13221326
auto item_bed_type_follow_preset = create_item_checkbox(_L("Auto plate type"), page,
13231327
_L("Studio will remember build plate selected last time for certain printer model."), 50,
13241328
"user_bed_type");
@@ -1529,6 +1533,7 @@ wxWindow* PreferencesDialog::create_general_page()
15291533
sizer_page->Add(item_region, 0, wxTOP, FromDIP(3));
15301534
sizer_page->Add(item_currency, 0, wxTOP, FromDIP(3));
15311535
sizer_page->Add(item_auto_flush, 0, wxTOP, FromDIP(3));
1536+
sizer_page->Add(item_autosave, 0, wxTOP, FromDIP(3));
15321537
sizer_page->Add(item_single_instance, 0, wxTOP, FromDIP(3));
15331538
sizer_page->Add(item_bed_type_follow_preset, 0, wxTOP, FromDIP(3));
15341539
//sizer_page->Add(item_hints, 0, wxTOP, FromDIP(3));

0 commit comments

Comments
 (0)