mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-01 01:13:40 +00:00
Add option to change the "Stop" button behavior (fix #705)
This commit is contained in:
parent
b70be3ccd4
commit
401dd5362b
@ -43,6 +43,7 @@
|
||||
<option id="screen_scale" type="int" default="2" />
|
||||
<option id="visible_timeline" type="bool" default="false" />
|
||||
<option id="autoshow_timeline" type="bool" default="true" migrate="Options.AutoShowTimeline" />
|
||||
<option id="rewind_on_stop" type="bool" default="false" />
|
||||
<option id="expand_menubar_on_mouseover" type="bool" default="false" migrate="Options.ExpandMenuBarOnMouseover" />
|
||||
<option id="data_recovery" type="bool" default="true" />
|
||||
<option id="data_recovery_period" type="int" default="2" />
|
||||
|
@ -8,6 +8,7 @@
|
||||
<listbox id="section_listbox">
|
||||
<listitem text="General" value="section_general" />
|
||||
<listitem text="Editor" value="section_editor" />
|
||||
<listitem text="Timeline" value="section_timeline" />
|
||||
<listitem text="Grid && Background" value="section_grid" />
|
||||
<listitem text="Undo" value="section_undo" />
|
||||
<listitem text="Experimental" value="section_experimental" />
|
||||
@ -26,7 +27,6 @@
|
||||
<listitem text="400%" value="4" />
|
||||
</combobox>
|
||||
</hbox>
|
||||
<check text="Show timeline automatically" id="autotimeline" tooltip="Show the timeline automatically when a new frame or layer is added." />
|
||||
<check text="Expand menu bar items on mouseover" id="expand_menubar_on_mouseover" tooltip="Check this option to get this old menus behavior." />
|
||||
<hbox>
|
||||
<check text="Automatically save recovery data every" id="enable_data_recovery" tooltip="With this option you can recover your documents if the program finalizes unexpectedly." />
|
||||
@ -60,6 +60,13 @@
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
||||
<!-- Editor -->
|
||||
<vbox id="section_timeline">
|
||||
<separator text="Timeline" horizontal="true" />
|
||||
<check text="Show timeline automatically" id="autotimeline" tooltip="Show the timeline automatically when a new frame or layer is added." />
|
||||
<check text="Rewind on Stop" id="rewind_on_stop" tooltip="The 'Stop' button should rewind the animation where it was started." />
|
||||
</vbox>
|
||||
|
||||
<!-- Grid & background -->
|
||||
<vbox id="section_grid">
|
||||
<combobox id="grid_scope" />
|
||||
|
@ -65,6 +65,9 @@ public:
|
||||
if (m_preferences.general.autoshowTimeline())
|
||||
autotimeline()->setSelected(true);
|
||||
|
||||
if (m_preferences.general.rewindOnStop())
|
||||
rewindOnStop()->setSelected(true);
|
||||
|
||||
if (m_preferences.general.expandMenubarOnMouseover())
|
||||
expandMenubarOnMouseover()->setSelected(true);
|
||||
|
||||
@ -155,6 +158,7 @@ public:
|
||||
|
||||
void saveConfig() {
|
||||
m_preferences.general.autoshowTimeline(autotimeline()->isSelected());
|
||||
m_preferences.general.rewindOnStop(rewindOnStop()->isSelected());
|
||||
|
||||
bool expandOnMouseover = expandMenubarOnMouseover()->isSelected();
|
||||
m_preferences.general.expandMenubarOnMouseover(expandOnMouseover);
|
||||
|
@ -109,7 +109,7 @@ void AniControls::onRightClick(Item* item)
|
||||
ButtonSet::onRightClick(item);
|
||||
|
||||
if (item == getItem(ACTION_PLAY) && current_editor)
|
||||
current_editor->showAnimationSpeedMultiplierPopup();
|
||||
current_editor->showAnimationSpeedMultiplierPopup(true);
|
||||
}
|
||||
|
||||
} // namespace app
|
||||
|
@ -1599,18 +1599,31 @@ bool Editor::isPlaying() const
|
||||
return (dynamic_cast<PlayState*>(m_state.get()) != nullptr);
|
||||
}
|
||||
|
||||
void Editor::showAnimationSpeedMultiplierPopup()
|
||||
void Editor::showAnimationSpeedMultiplierPopup(bool withStopBehaviorOptions)
|
||||
{
|
||||
double options[] = { 0.25, 0.5, 1.0, 1.5, 2.0, 3.0 };
|
||||
Menu menu;
|
||||
|
||||
for (double option : options) {
|
||||
MenuItem* item = new MenuItem("x" + base::convert_to<std::string>(option));
|
||||
MenuItem* item = new MenuItem("Speed x" + base::convert_to<std::string>(option));
|
||||
item->Click.connect(Bind<void>(&Editor::setAnimationSpeedMultiplier, this, option));
|
||||
item->setSelected(m_aniSpeed == option);
|
||||
menu.addChild(item);
|
||||
}
|
||||
|
||||
if (withStopBehaviorOptions) {
|
||||
menu.addChild(new Separator("", JI_HORIZONTAL));
|
||||
MenuItem* item = new MenuItem("Rewind on Stop");
|
||||
item->Click.connect(
|
||||
[]() {
|
||||
// Switch the "rewind_on_stop" option
|
||||
Preferences::instance().general.rewindOnStop(
|
||||
!Preferences::instance().general.rewindOnStop());
|
||||
});
|
||||
item->setSelected(Preferences::instance().general.rewindOnStop());
|
||||
menu.addChild(item);
|
||||
}
|
||||
|
||||
menu.showPopup(ui::get_mouse_position());
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ namespace app {
|
||||
bool isPlaying() const;
|
||||
|
||||
// Shows a popup menu to change the editor animation speed.
|
||||
void showAnimationSpeedMultiplierPopup();
|
||||
void showAnimationSpeedMultiplierPopup(bool withStopBehaviorOptions);
|
||||
double getAnimationSpeedMultiplier() const;
|
||||
void setAnimationSpeedMultiplier(double speed);
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/commands.h"
|
||||
#include "app/loop_tag.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui/editor/scrolling_state.h"
|
||||
#include "app/ui_context.h"
|
||||
@ -64,7 +65,8 @@ void PlayState::onEnterState(Editor* editor)
|
||||
EditorState::LeaveAction PlayState::onLeaveState(Editor* editor, EditorState* newState)
|
||||
{
|
||||
if (!m_toScroll) {
|
||||
m_editor->setFrame(m_refFrame);
|
||||
if (Preferences::instance().general.rewindOnStop())
|
||||
m_editor->setFrame(m_refFrame);
|
||||
|
||||
// We don't stop the timer if we are going to the ScrollingState
|
||||
// (we keep playing the animation).
|
||||
|
@ -290,7 +290,7 @@ void PreviewEditorWindow::onPopupSpeed()
|
||||
if (!miniEditor || !miniEditor->document())
|
||||
return;
|
||||
|
||||
miniEditor->showAnimationSpeedMultiplierPopup();
|
||||
miniEditor->showAnimationSpeedMultiplierPopup(false);
|
||||
m_aniSpeed = miniEditor->getAnimationSpeedMultiplier();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user