add show_gcode_window preference

This commit is contained in:
SoftFever 2023-03-14 21:29:58 +08:00
parent 5a986c18a1
commit 02b3cd119a
5 changed files with 19 additions and 2 deletions

View file

@ -175,6 +175,9 @@ void AppConfig::set_defaults()
set_bool("show_hints", true); set_bool("show_hints", true);
//#endif //#endif
if (get("show_gcode_window").empty())
set_bool("show_gcode_window", true);
#ifdef _WIN32 #ifdef _WIN32

View file

@ -579,7 +579,7 @@ void GCodeViewer::SequentialView::GCodeWindow::render(float top, float bottom, f
static const ImVec4 PARAMETERS_COLOR = { 1.0f, 1.0f, 1.0f, 1.0f }; static const ImVec4 PARAMETERS_COLOR = { 1.0f, 1.0f, 1.0f, 1.0f };
static const ImVec4 COMMENT_COLOR = { 0.7f, 0.7f, 0.7f, 1.0f }; static const ImVec4 COMMENT_COLOR = { 0.7f, 0.7f, 0.7f, 1.0f };
if (!m_visible || m_filename.empty() || m_lines_ends.empty() || curr_line_id == 0) if (!m_visible || !wxGetApp().show_gcode_window() || m_filename.empty() || m_lines_ends.empty() || curr_line_id == 0)
return; return;
// window height // window height

View file

@ -1096,6 +1096,7 @@ void GUI_App::post_init()
} }
#endif #endif
m_show_gcode_window = app_config->get("show_gcode_window") == "true";
if (m_networking_need_update) { if (m_networking_need_update) {
//updating networking //updating networking
int ret = updating_bambu_networking(); int ret = updating_bambu_networking();

View file

@ -290,6 +290,8 @@ private:
bool m_adding_script_handler { false }; bool m_adding_script_handler { false };
bool m_side_popup_status{false}; bool m_side_popup_status{false};
HttpServer m_http_server; HttpServer m_http_server;
bool m_show_gcode_window{true};
public: public:
void check_filaments_in_blacklist(std::string tag_supplier, std::string tag_material, bool& in_blacklist, std::string& action, std::string& info); void check_filaments_in_blacklist(std::string tag_supplier, std::string tag_material, bool& in_blacklist, std::string& action, std::string& info);
std::string get_local_models_path(); std::string get_local_models_path();
@ -311,6 +313,10 @@ public:
bool is_recreating_gui() const { return m_is_recreating_gui; } bool is_recreating_gui() const { return m_is_recreating_gui; }
std::string logo_name() const { return is_editor() ? "OrcaSlicer" : "BambuStudio-gcodeviewer"; } std::string logo_name() const { return is_editor() ? "OrcaSlicer" : "BambuStudio-gcodeviewer"; }
// SoftFever
bool show_gcode_window() const { return m_show_gcode_window; }
void set_show_gcode_window(bool val) { m_show_gcode_window = val; }
// To be called after the GUI is fully built up. // To be called after the GUI is fully built up.
// Process command line parameters cached in this->init_params, // Process command line parameters cached in this->init_params,
// load configs, STLs etc. // load configs, STLs etc.

View file

@ -593,6 +593,11 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
} }
} }
if (param == "show_gcode_window") {
bool pbool = app_config->get("show_gcode_window") == "true" ? true : false;
wxGetApp().set_show_gcode_window(pbool);
}
#endif // __WXMSW__ #endif // __WXMSW__
e.Skip(); e.Skip();
@ -821,6 +826,7 @@ wxWindow* PreferencesDialog::create_general_page()
auto item_currency = create_item_combobox(_L("Units"), page, _L("Units"), "use_inches", Units); auto item_currency = create_item_combobox(_L("Units"), page, _L("Units"), "use_inches", Units);
auto item_hints = create_item_checkbox(_L("Show \"Tip of the day\" notification after start"), page, _L("If enabled, useful hints are displayed at startup."), 50, "show_hints"); auto item_hints = create_item_checkbox(_L("Show \"Tip of the day\" notification after start"), page, _L("If enabled, useful hints are displayed at startup."), 50, "show_hints");
auto item_gcode_window = create_item_checkbox(_L("Show g-code window"), page, _L("If enabled, g-code window will be displayed."), 50, "show_gcode_window");
auto title_sync_settings = create_item_title(_L("User sync"), page, _L("User sync")); auto title_sync_settings = create_item_title(_L("User sync"), page, _L("User sync"));
auto item_user_sync = create_item_checkbox(_L("Auto sync user presets(Printer/Filament/Process)"), page, _L("User Sync"), 50, "sync_user_preset"); auto item_user_sync = create_item_checkbox(_L("Auto sync user presets(Printer/Filament/Process)"), page, _L("User Sync"), 50, "sync_user_preset");
@ -859,6 +865,7 @@ wxWindow* PreferencesDialog::create_general_page()
sizer_page->Add(item_region, 0, wxTOP, FromDIP(3)); sizer_page->Add(item_region, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_currency, 0, wxTOP, FromDIP(3)); sizer_page->Add(item_currency, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_hints, 0, wxTOP, FromDIP(3)); sizer_page->Add(item_hints, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_gcode_window, 0, wxTOP, FromDIP(3));
sizer_page->Add(title_sync_settings, 0, wxTOP | wxEXPAND, FromDIP(20)); sizer_page->Add(title_sync_settings, 0, wxTOP | wxEXPAND, FromDIP(20));
sizer_page->Add(item_user_sync, 0, wxTOP, FromDIP(3)); sizer_page->Add(item_user_sync, 0, wxTOP, FromDIP(3));
#ifdef _WIN32 #ifdef _WIN32