mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	ENH: [STUDIO-2549] remember my choice on unsaved project/presets
Change-Id: Ib9fc9074075bfce19f9a02be3aff7b3d04e3802a
This commit is contained in:
		
							parent
							
								
									778761908a
								
							
						
					
					
						commit
						8c39fbaf22
					
				
					 10 changed files with 103 additions and 18 deletions
				
			
		|  | @ -1394,6 +1394,8 @@ std::string GUI_App::get_plugin_url(std::string name, std::string country_code) | ||||||
| 
 | 
 | ||||||
|     std::string curr_version = SLIC3R_VERSION; |     std::string curr_version = SLIC3R_VERSION; | ||||||
|     std::string using_version = curr_version.substr(0, 9) + "00"; |     std::string using_version = curr_version.substr(0, 9) + "00"; | ||||||
|  |     if (name == "cameratools") | ||||||
|  |         using_version = curr_version.substr(0, 6) + "00.00"; | ||||||
|     url += (boost::format("?slicer/%1%/cloud=%2%") % name % using_version).str(); |     url += (boost::format("?slicer/%1%/cloud=%2%") % name % using_version).str(); | ||||||
|     //url += (boost::format("?slicer/plugins/cloud=%1%") % "01.01.00.00").str();
 |     //url += (boost::format("?slicer/plugins/cloud=%1%") % "01.01.00.00").str();
 | ||||||
|     return url; |     return url; | ||||||
|  | @ -5246,6 +5248,8 @@ bool GUI_App::check_and_save_current_preset_changes(const wxString& caption, con | ||||||
|         int act_buttons = UnsavedChangesDialog::ActionButtons::SAVE; |         int act_buttons = UnsavedChangesDialog::ActionButtons::SAVE; | ||||||
|         if (dont_save_insted_of_discard) |         if (dont_save_insted_of_discard) | ||||||
|             act_buttons |= UnsavedChangesDialog::ActionButtons::DONT_SAVE; |             act_buttons |= UnsavedChangesDialog::ActionButtons::DONT_SAVE; | ||||||
|  |         if (remember_choice) | ||||||
|  |             act_buttons |= UnsavedChangesDialog::ActionButtons::REMEMBER_CHOISE; | ||||||
|         UnsavedChangesDialog dlg(caption, header, "", act_buttons); |         UnsavedChangesDialog dlg(caption, header, "", act_buttons); | ||||||
|         if (dlg.ShowModal() == wxID_CANCEL) |         if (dlg.ShowModal() == wxID_CANCEL) | ||||||
|             return false; |             return false; | ||||||
|  |  | ||||||
|  | @ -74,7 +74,7 @@ MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &he | ||||||
|     for (auto mb : m_buttons) { delete mb.second->buttondata ; delete mb.second; } |     for (auto mb : m_buttons) { delete mb.second->buttondata ; delete mb.second; } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void MsgDialog::show_dsa_button() | void MsgDialog::show_dsa_button(wxString const &title) | ||||||
| { | { | ||||||
|     m_checkbox_dsa = new CheckBox(this); |     m_checkbox_dsa = new CheckBox(this); | ||||||
|     m_dsa_sizer->Add(m_checkbox_dsa, 0, wxALL | wxALIGN_CENTER, FromDIP(2)); |     m_dsa_sizer->Add(m_checkbox_dsa, 0, wxALL | wxALIGN_CENTER, FromDIP(2)); | ||||||
|  | @ -86,7 +86,7 @@ void MsgDialog::show_dsa_button() | ||||||
|         e.Skip(); |         e.Skip(); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     auto  m_text_dsa = new wxStaticText(this, wxID_ANY, _L("Don't show again"), wxDefaultPosition, wxDefaultSize, 0); |     auto  m_text_dsa = new wxStaticText(this, wxID_ANY, title.IsEmpty() ? _L("Don't show again") : title, wxDefaultPosition, wxDefaultSize, 0); | ||||||
|     m_dsa_sizer->Add(m_text_dsa, 0, wxALL | wxALIGN_CENTER, FromDIP(2)); |     m_dsa_sizer->Add(m_text_dsa, 0, wxALL | wxALIGN_CENTER, FromDIP(2)); | ||||||
|     m_text_dsa->SetFont(::Label::Body_13); |     m_text_dsa->SetFont(::Label::Body_13); | ||||||
|     m_text_dsa->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3D"))); |     m_text_dsa->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3D"))); | ||||||
|  |  | ||||||
|  | @ -60,7 +60,7 @@ struct MsgDialog : DPIDialog | ||||||
| 	MsgDialog &operator=(const MsgDialog &) = delete; | 	MsgDialog &operator=(const MsgDialog &) = delete; | ||||||
| 	virtual ~MsgDialog(); | 	virtual ~MsgDialog(); | ||||||
| 
 | 
 | ||||||
| 	void show_dsa_button(); | 	void show_dsa_button(wxString const & title = {}); | ||||||
| 	bool get_checkbox_state(); | 	bool get_checkbox_state(); | ||||||
| 	virtual void on_dpi_changed(const wxRect& suggested_rect); | 	virtual void on_dpi_changed(const wxRect& suggested_rect); | ||||||
| 	void SetButtonLabel(wxWindowID btn_id, const wxString& label, bool set_focus = false); | 	void SetButtonLabel(wxWindowID btn_id, const wxString& label, bool set_focus = false); | ||||||
|  |  | ||||||
|  | @ -7555,7 +7555,7 @@ int Plater::new_project(bool skip_confirm, bool silent) | ||||||
|             (yes_or_no ? _L("You can keep the modified presets to the new project or discard them") : |             (yes_or_no ? _L("You can keep the modified presets to the new project or discard them") : | ||||||
|                 _L("You can keep the modifield presets to the new project, discard or save changes as new presets.")); |                 _L("You can keep the modifield presets to the new project, discard or save changes as new presets.")); | ||||||
|         using ab = UnsavedChangesDialog::ActionButtons; |         using ab = UnsavedChangesDialog::ActionButtons; | ||||||
|         int act_buttons = ab::KEEP; |         int act_buttons = ab::KEEP | ab::REMEMBER_CHOISE; | ||||||
|         if (!yes_or_no) |         if (!yes_or_no) | ||||||
|             act_buttons |= ab::SAVE; |             act_buttons |= ab::SAVE; | ||||||
|         return wxGetApp().check_and_keep_current_preset_changes(_L("Creating a new project"), header, act_buttons, &transfer_preset_changes); |         return wxGetApp().check_and_keep_current_preset_changes(_L("Creating a new project"), header, act_buttons, &transfer_preset_changes); | ||||||
|  | @ -8870,14 +8870,21 @@ int GUI::Plater::close_with_confirm(std::function<bool(bool)> second_check) | ||||||
|         return wxID_NO; |         return wxID_NO; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     auto result = MessageDialog(static_cast<wxWindow*>(this), _L("The current project has unsaved changes, save it before continue?"), |     MessageDialog dlg(static_cast<wxWindow*>(this), _L("The current project has unsaved changes, save it before continue?"), | ||||||
|         wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Save"), wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxCENTRE).ShowModal(); |         wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Save"), wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxCENTRE); | ||||||
|  |     dlg.show_dsa_button(_L("Remember my choice.")); | ||||||
|  |     auto choise = wxGetApp().app_config->get("save_project_choise"); | ||||||
|  |     auto result = choise.empty() ? dlg.ShowModal() : choise == "yes" ? wxID_YES : wxID_NO; | ||||||
|     if (result == wxID_CANCEL) |     if (result == wxID_CANCEL) | ||||||
|         return result; |         return result; | ||||||
|     else if (result == wxID_YES) { |     else { | ||||||
|         result = save_project(); |         if (dlg.get_checkbox_state()) | ||||||
|         if (result == wxID_CANCEL) |             wxGetApp().app_config->set("save_project_choise", result == wxID_YES ? "yes" : "no"); | ||||||
|             return result; |         if (result == wxID_YES) { | ||||||
|  |             result = save_project(); | ||||||
|  |             if (result == wxID_CANCEL) | ||||||
|  |                 return result; | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (second_check && !second_check(result == wxID_YES)) return wxID_CANCEL; |     if (second_check && !second_check(result == wxID_YES)) return wxID_CANCEL; | ||||||
|  |  | ||||||
|  | @ -666,6 +666,40 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa | ||||||
|     return m_sizer_checkbox; |     return m_sizer_checkbox; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | wxBoxSizer *PreferencesDialog::create_item_button(wxString title, wxString title2, wxWindow *parent, wxString tooltip, std::function<void()> onclick) | ||||||
|  | { | ||||||
|  |     wxBoxSizer *m_sizer_checkbox = new wxBoxSizer(wxHORIZONTAL); | ||||||
|  | 
 | ||||||
|  |     m_sizer_checkbox->Add(0, 0, 0, wxEXPAND | wxLEFT, 23); | ||||||
|  |     auto m_staticTextPath = new wxStaticText(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END); | ||||||
|  |     // m_staticTextPath->SetMaxSize(wxSize(FromDIP(440), -1));
 | ||||||
|  |     m_staticTextPath->SetForegroundColour(DESIGN_GRAY900_COLOR); | ||||||
|  |     m_staticTextPath->SetFont(::Label::Body_13); | ||||||
|  |     m_staticTextPath->Wrap(-1); | ||||||
|  | 
 | ||||||
|  |     auto m_button_download = new Button(parent, title2); | ||||||
|  | 
 | ||||||
|  |     StateColor abort_bg(std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Disabled), std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), | ||||||
|  |                         std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered), std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Enabled), | ||||||
|  |                         std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Normal)); | ||||||
|  |     m_button_download->SetBackgroundColor(abort_bg); | ||||||
|  |     StateColor abort_bd(std::pair<wxColour, int>(wxColour(144, 144, 144), StateColor::Disabled), std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Enabled)); | ||||||
|  |     m_button_download->SetBorderColor(abort_bd); | ||||||
|  |     StateColor abort_text(std::pair<wxColour, int>(wxColour(144, 144, 144), StateColor::Disabled), std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Enabled)); | ||||||
|  |     m_button_download->SetTextColor(abort_text); | ||||||
|  |     m_button_download->SetFont(Label::Body_10); | ||||||
|  |     m_button_download->SetMinSize(wxSize(FromDIP(58), FromDIP(22))); | ||||||
|  |     m_button_download->SetSize(wxSize(FromDIP(58), FromDIP(22))); | ||||||
|  |     m_button_download->SetCornerRadius(FromDIP(12)); | ||||||
|  | 
 | ||||||
|  |     m_button_download->Bind(wxEVT_BUTTON, [this, onclick](auto &e) { onclick(); }); | ||||||
|  | 
 | ||||||
|  |     m_sizer_checkbox->Add(m_staticTextPath, 0, wxALIGN_CENTER_VERTICAL | wxALL, FromDIP(5)); | ||||||
|  |     m_sizer_checkbox->Add(m_button_download, 0, wxALL, FromDIP(5)); | ||||||
|  | 
 | ||||||
|  |     return m_sizer_checkbox; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| wxWindow* PreferencesDialog::create_item_downloads(wxWindow* parent, int padding_left, std::string param) | wxWindow* PreferencesDialog::create_item_downloads(wxWindow* parent, int padding_left, std::string param) | ||||||
| { | { | ||||||
|     wxString download_path = wxString::FromUTF8(app_config->get("download_path")); |     wxString download_path = wxString::FromUTF8(app_config->get("download_path")); | ||||||
|  | @ -881,8 +915,11 @@ wxWindow* PreferencesDialog::create_general_page() | ||||||
| 
 | 
 | ||||||
|     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 title_sync_settings = create_item_title(_L("User sync"), page, _L("User sync")); |     auto title_presets = create_item_title(_L("Presets"), page, _L("Presets")); | ||||||
|     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"); | ||||||
|  |     auto item_save_presets = create_item_button(_L("Clear my choice on the unsaved presets."), _L("Clear"), page, _L("Clear my choice on the unsaved presets."), []() { | ||||||
|  |         wxGetApp().app_config->set("save_preset_choise", ""); | ||||||
|  |     }); | ||||||
| 
 | 
 | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
|     auto title_associate_file = create_item_title(_L("Associate files to BambuStudio"), page, _L("Associate files to BambuStudio")); |     auto title_associate_file = create_item_title(_L("Associate files to BambuStudio"), page, _L("Associate files to BambuStudio")); | ||||||
|  | @ -907,6 +944,9 @@ wxWindow* PreferencesDialog::create_general_page() | ||||||
|         if (value.ToLong(&max)) |         if (value.ToLong(&max)) | ||||||
|             wxGetApp().mainframe->set_max_recent_count(max); |             wxGetApp().mainframe->set_max_recent_count(max); | ||||||
|     }); |     }); | ||||||
|  |     auto item_save_choise = create_item_button(_L("Clear my choice on the unsaved projects."), _L("Clear"), page, _L("Clear my choice on the unsaved projects."), []() { | ||||||
|  |         wxGetApp().app_config->set("save_project_choise", ""); | ||||||
|  |     }); | ||||||
|     // auto item_backup = create_item_switch(_L("Backup switch"), page, _L("Backup switch"), "units");
 |     // auto item_backup = create_item_switch(_L("Backup switch"), page, _L("Backup switch"), "units");
 | ||||||
|     auto item_backup  = create_item_checkbox(_L("Auto-Backup"), page,_L("Backup your project periodically for restoring from the occasional crash."), 50, "backup_switch"); |     auto item_backup  = create_item_checkbox(_L("Auto-Backup"), page,_L("Backup your project periodically for restoring from the occasional crash."), 50, "backup_switch"); | ||||||
|     auto item_backup_interval = create_item_backup_input(_L("every"), page, _L("The peroid of backup in seconds."), "backup_interval"); |     auto item_backup_interval = create_item_backup_input(_L("every"), page, _L("The peroid of backup in seconds."), "backup_interval"); | ||||||
|  | @ -927,8 +967,9 @@ 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(title_sync_settings, 0, wxTOP | wxEXPAND, FromDIP(20)); |     sizer_page->Add(title_presets, 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)); | ||||||
|  |     sizer_page->Add(item_save_presets, 0, wxTOP, FromDIP(3)); | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
|     sizer_page->Add(title_associate_file, 0, wxTOP| wxEXPAND, FromDIP(20)); |     sizer_page->Add(title_associate_file, 0, wxTOP| wxEXPAND, FromDIP(20)); | ||||||
|     sizer_page->Add(item_associate_3mf, 0, wxTOP, FromDIP(3)); |     sizer_page->Add(item_associate_3mf, 0, wxTOP, FromDIP(3)); | ||||||
|  | @ -940,6 +981,7 @@ wxWindow* PreferencesDialog::create_general_page() | ||||||
| 
 | 
 | ||||||
|     sizer_page->Add(title_project, 0, wxTOP| wxEXPAND, FromDIP(20)); |     sizer_page->Add(title_project, 0, wxTOP| wxEXPAND, FromDIP(20)); | ||||||
|     sizer_page->Add(item_max_recent_count, 0, wxTOP, FromDIP(3)); |     sizer_page->Add(item_max_recent_count, 0, wxTOP, FromDIP(3)); | ||||||
|  |     sizer_page->Add(item_save_choise, 0, wxTOP, FromDIP(3)); | ||||||
|     sizer_page->Add(item_backup, 0, wxTOP,FromDIP(3)); |     sizer_page->Add(item_backup, 0, wxTOP,FromDIP(3)); | ||||||
|     item_backup->Add(item_backup_interval, 0, wxLEFT, 0); |     item_backup->Add(item_backup_interval, 0, wxLEFT, 0); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -110,6 +110,7 @@ public: | ||||||
|     wxBoxSizer *create_item_checkbox(wxString title, wxWindow *parent, wxString tooltip, int padding_left, std::string param); |     wxBoxSizer *create_item_checkbox(wxString title, wxWindow *parent, wxString tooltip, int padding_left, std::string param); | ||||||
|     wxBoxSizer *create_item_darkmode_checkbox(wxString title, wxWindow *parent, wxString tooltip, int padding_left, std::string param); |     wxBoxSizer *create_item_darkmode_checkbox(wxString title, wxWindow *parent, wxString tooltip, int padding_left, std::string param); | ||||||
|     void set_dark_mode(); |     void set_dark_mode(); | ||||||
|  |     wxBoxSizer *create_item_button(wxString title, wxString title2, wxWindow *parent, wxString tooltip, std::function<void()> onclick); | ||||||
|     wxWindow* create_item_downloads(wxWindow* parent, int padding_left, std::string param); |     wxWindow* create_item_downloads(wxWindow* parent, int padding_left, std::string param); | ||||||
|     wxBoxSizer *create_item_input(wxString title, wxString title2, wxWindow *parent, wxString tooltip, std::string param, std::function<void(wxString)> onchange = {}); |     wxBoxSizer *create_item_input(wxString title, wxString title2, wxWindow *parent, wxString tooltip, std::string param, std::function<void(wxString)> onchange = {}); | ||||||
|     wxBoxSizer *create_item_backup_input(wxString title, wxWindow *parent, wxString tooltip, std::string param); |     wxBoxSizer *create_item_backup_input(wxString title, wxWindow *parent, wxString tooltip, std::string param); | ||||||
|  |  | ||||||
|  | @ -27,6 +27,7 @@ | ||||||
| #include "BitmapCache.hpp" | #include "BitmapCache.hpp" | ||||||
| #include "PresetComboBoxes.hpp" | #include "PresetComboBoxes.hpp" | ||||||
| #include "Widgets/RoundedRectangle.hpp" | #include "Widgets/RoundedRectangle.hpp" | ||||||
|  | #include "Widgets/CheckBox.hpp" | ||||||
| 
 | 
 | ||||||
| using boost::optional; | using boost::optional; | ||||||
| 
 | 
 | ||||||
|  | @ -818,6 +819,22 @@ UnsavedChangesDialog::UnsavedChangesDialog(Preset::Type type, PresetCollection * | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | inline int UnsavedChangesDialog::ShowModal() | ||||||
|  | { | ||||||
|  |     auto choise_key = "save_preset_choise";  | ||||||
|  |     auto choise     = wxGetApp().app_config->get(choise_key); | ||||||
|  |     long result = 0; | ||||||
|  |     if ((m_buttons & REMEMBER_CHOISE) && !choise.empty() && wxString(choise).ToLong(&result) && (1 << result) & (m_buttons | DONT_SAVE)) { | ||||||
|  |         m_exit_action = Action(result); | ||||||
|  |         return 0; | ||||||
|  |     } | ||||||
|  |     int r = wxDialog::ShowModal(); | ||||||
|  |     if (r != wxID_CANCEL && dynamic_cast<::CheckBox*>(FindWindowById(wxID_APPLY))->GetValue()) { | ||||||
|  |         wxGetApp().app_config->set(choise_key, std::to_string(int(m_exit_action))); | ||||||
|  |     } | ||||||
|  |     return r; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void UnsavedChangesDialog::build(Preset::Type type, PresetCollection *dependent_presets, const std::string &new_selected_preset, const wxString &header) | void UnsavedChangesDialog::build(Preset::Type type, PresetCollection *dependent_presets, const std::string &new_selected_preset, const wxString &header) | ||||||
| { | { | ||||||
|     SetBackgroundColour(*wxWHITE); |     SetBackgroundColour(*wxWHITE); | ||||||
|  | @ -935,6 +952,17 @@ void UnsavedChangesDialog::build(Preset::Type type, PresetCollection *dependent_ | ||||||
| 
 | 
 | ||||||
|     wxBoxSizer *m_sizer_button = new wxBoxSizer(wxHORIZONTAL); |     wxBoxSizer *m_sizer_button = new wxBoxSizer(wxHORIZONTAL); | ||||||
| 
 | 
 | ||||||
|  |     auto checkbox_sizer = new wxBoxSizer(wxHORIZONTAL); | ||||||
|  |     auto checkbox       = new ::CheckBox(this, wxID_APPLY); | ||||||
|  |     checkbox_sizer->Add(checkbox, 0, wxALL | wxALIGN_CENTER, FromDIP(2)); | ||||||
|  | 
 | ||||||
|  |     auto checkbox_text = new wxStaticText(this, wxID_ANY, _L("Remember my choice."), wxDefaultPosition, wxDefaultSize, 0); | ||||||
|  |     checkbox_sizer->Add(checkbox_text, 0, wxALL | wxALIGN_CENTER, FromDIP(2)); | ||||||
|  |     checkbox_text->SetFont(::Label::Body_13); | ||||||
|  |     checkbox_text->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3D"))); | ||||||
|  |     m_sizer_button->Add(checkbox_sizer, 0, wxLEFT, FromDIP(22)); | ||||||
|  |     checkbox_sizer->Show(bool(m_buttons & REMEMBER_CHOISE)); | ||||||
|  | 
 | ||||||
|     m_sizer_button->Add(0, 0, 1, 0, 0); |     m_sizer_button->Add(0, 0, 1, 0, 0); | ||||||
| 
 | 
 | ||||||
|      // Add Buttons
 |      // Add Buttons
 | ||||||
|  |  | ||||||
|  | @ -277,9 +277,9 @@ protected: | ||||||
| 
 | 
 | ||||||
|     enum class Action { |     enum class Action { | ||||||
|         Undef, |         Undef, | ||||||
|         Transfer, |         Transfer, // Or KEEP
 | ||||||
|  |         Save, | ||||||
|         Discard, |         Discard, | ||||||
|         Save |  | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     static constexpr char ActTransfer[] = "transfer"; |     static constexpr char ActTransfer[] = "transfer"; | ||||||
|  | @ -320,6 +320,7 @@ public: | ||||||
|         KEEP      = 2, |         KEEP      = 2, | ||||||
|         SAVE      = 4, |         SAVE      = 4, | ||||||
|         DONT_SAVE = 8, |         DONT_SAVE = 8, | ||||||
|  |         REMEMBER_CHOISE = 0x10000 | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     // show unsaved changes when preset is switching
 |     // show unsaved changes when preset is switching
 | ||||||
|  | @ -328,7 +329,9 @@ public: | ||||||
|     UnsavedChangesDialog(const wxString& caption, const wxString& header, const std::string& app_config_key, int act_buttons); |     UnsavedChangesDialog(const wxString& caption, const wxString& header, const std::string& app_config_key, int act_buttons); | ||||||
|     ~UnsavedChangesDialog(){}; |     ~UnsavedChangesDialog(){}; | ||||||
| 
 | 
 | ||||||
|     void build(Preset::Type type, PresetCollection* dependent_presets, const std::string& new_selected_preset, const wxString& header = ""); |     int ShowModal(); | ||||||
|  | 
 | ||||||
|  |     void        build(Preset::Type type, PresetCollection *dependent_presets, const std::string &new_selected_preset, const wxString &header = ""); | ||||||
|     void update(Preset::Type type, PresetCollection* dependent_presets, const std::string& new_selected_preset, const wxString& header); |     void update(Preset::Type type, PresetCollection* dependent_presets, const std::string& new_selected_preset, const wxString& header); | ||||||
|     void update_list(); |     void update_list(); | ||||||
|     std::string subreplace(std::string resource_str, std::string sub_str, std::string new_str); |     std::string subreplace(std::string resource_str, std::string sub_str, std::string new_str); | ||||||
|  |  | ||||||
|  | @ -2,8 +2,8 @@ | ||||||
| 
 | 
 | ||||||
| #include "../wxExtensions.hpp" | #include "../wxExtensions.hpp" | ||||||
| 
 | 
 | ||||||
| CheckBox::CheckBox(wxWindow* parent) | CheckBox::CheckBox(wxWindow *parent, int id) | ||||||
| 	: wxBitmapToggleButton(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE) |     : wxBitmapToggleButton(parent, id, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE) | ||||||
|     , m_on(this, "check_on", 18) |     , m_on(this, "check_on", 18) | ||||||
|     , m_half(this, "check_half", 18) |     , m_half(this, "check_half", 18) | ||||||
|     , m_off(this, "check_off", 18) |     , m_off(this, "check_off", 18) | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ | ||||||
| class CheckBox : public wxBitmapToggleButton | class CheckBox : public wxBitmapToggleButton | ||||||
| { | { | ||||||
| public: | public: | ||||||
| 	CheckBox(wxWindow * parent = NULL); | 	CheckBox(wxWindow * parent, int id = wxID_ANY); | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
| 	void SetValue(bool value) override; | 	void SetValue(bool value) override; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 chunmao.guo
						chunmao.guo