mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 09:04:02 +00:00
Improve UI so undo limit = 0 means "no limit" (#1127)
By default we'll have "no undo limit".
This commit is contained in:
parent
f0c11ef567
commit
5cd368792c
@ -113,7 +113,7 @@
|
||||
<option id="show_menu_bar" type="bool" default="true" />
|
||||
</section>
|
||||
<section id="undo" text="Undo">
|
||||
<option id="size_limit" type="int" default="64" />
|
||||
<option id="size_limit" type="int" default="0" />
|
||||
<option id="goto_modified" type="bool" default="true" />
|
||||
<option id="allow_nonlinear_history" type="bool" default="false" />
|
||||
</section>
|
||||
|
@ -249,8 +249,8 @@
|
||||
<vbox id="section_undo">
|
||||
<separator text="@.section_undo" horizontal="true" />
|
||||
<hbox>
|
||||
<label text="@.undo_size_limit" />
|
||||
<entry id="undo_size_limit" maxsize="4" tooltip="@.undo_size_limit_tooltip" />
|
||||
<check id="limit_undo" text="@.undo_size_limit" />
|
||||
<entry id="undo_size_limit" maxsize="6" tooltip="@.undo_size_limit_tooltip" />
|
||||
<label text="@.undo_mb" />
|
||||
</hbox>
|
||||
|
||||
|
@ -44,6 +44,8 @@ static const char* kSectionGridId = "section_grid";
|
||||
static const char* kSectionThemeId = "section_theme";
|
||||
static const char* kSectionExtensionsId = "section_extensions";
|
||||
|
||||
static const char* kInfiniteSymbol = "\xE2\x88\x9E"; // Infinite symbol (UTF-8)
|
||||
|
||||
using namespace ui;
|
||||
|
||||
class OptionsWindow : public app::gen::Options {
|
||||
@ -321,7 +323,10 @@ public:
|
||||
#endif
|
||||
|
||||
// Undo preferences
|
||||
undoSizeLimit()->setTextf("%d", m_pref.undo.sizeLimit());
|
||||
limitUndo()->Click.connect(base::Bind<void>(&OptionsWindow::onLimitUndoCheck, this));
|
||||
limitUndo()->setSelected(m_pref.undo.sizeLimit() != 0);
|
||||
onLimitUndoCheck();
|
||||
|
||||
undoGotoModified()->setSelected(m_pref.undo.gotoModified());
|
||||
undoAllowNonlinearHistory()->setSelected(m_pref.undo.allowNonlinearHistory());
|
||||
|
||||
@ -418,7 +423,7 @@ public:
|
||||
|
||||
int undo_size_limit_value;
|
||||
undo_size_limit_value = undoSizeLimit()->textInt();
|
||||
undo_size_limit_value = MID(1, undo_size_limit_value, 9999);
|
||||
undo_size_limit_value = MID(0, undo_size_limit_value, 999999);
|
||||
|
||||
m_pref.undo.sizeLimit(undo_size_limit_value);
|
||||
m_pref.undo.gotoModified(undoGotoModified()->isSelected());
|
||||
@ -655,6 +660,17 @@ private:
|
||||
app::launcher::open_folder(app::main_config_filename());
|
||||
}
|
||||
|
||||
void onLimitUndoCheck() {
|
||||
if (limitUndo()->isSelected()) {
|
||||
undoSizeLimit()->setEnabled(true);
|
||||
undoSizeLimit()->setTextf("%d", m_pref.undo.sizeLimit());
|
||||
}
|
||||
else {
|
||||
undoSizeLimit()->setEnabled(false);
|
||||
undoSizeLimit()->setText(kInfiniteSymbol);
|
||||
}
|
||||
}
|
||||
|
||||
void reloadThemes() {
|
||||
while (themeList()->firstChild())
|
||||
delete themeList()->lastChild();
|
||||
|
Loading…
Reference in New Issue
Block a user