mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-16 10:20:50 +00:00
Add "Apply" button (fix #4678)
This commit is contained in:
parent
4dd2b1877d
commit
6c714bfc05
@ -772,6 +772,7 @@ selected_cels = Selected
|
||||
selected_cels_tooltip = Apply to the active selection in the timeline
|
||||
all_cels = All
|
||||
all_cels_tooltip = Apply to all cels in the sprite
|
||||
apply = &Apply
|
||||
ok = &OK
|
||||
cancel = &Cancel
|
||||
preview = &Preview
|
||||
|
@ -265,6 +265,7 @@ void FilterManagerImpl::apply()
|
||||
|
||||
ASSERT(m_reader.context());
|
||||
m_reader.context()->setCommandResult(result);
|
||||
init(m_site.cel());
|
||||
}
|
||||
|
||||
void FilterManagerImpl::applyToTarget()
|
||||
@ -357,6 +358,7 @@ void FilterManagerImpl::commitTransaction()
|
||||
ASSERT(m_tx);
|
||||
m_tx->commit();
|
||||
m_writer.reset();
|
||||
m_tx.reset();
|
||||
}
|
||||
|
||||
void FilterManagerImpl::flush()
|
||||
|
@ -33,6 +33,7 @@ FilterWindow::FilterWindow(const char* title, const char* cfgSection,
|
||||
, m_hbox(HORIZONTAL)
|
||||
, m_vbox(VERTICAL)
|
||||
, m_container(VERTICAL)
|
||||
, m_applyButton(Strings::filters_apply())
|
||||
, m_okButton(Strings::filters_ok())
|
||||
, m_cancelButton(Strings::filters_cancel())
|
||||
, m_preview(filterMgr)
|
||||
@ -42,6 +43,7 @@ FilterWindow::FilterWindow(const char* title, const char* cfgSection,
|
||||
new CheckBox(Strings::filters_tiled()) :
|
||||
nullptr)
|
||||
{
|
||||
m_applyButton.processMnemonicFromText();
|
||||
m_okButton.processMnemonicFromText();
|
||||
m_cancelButton.processMnemonicFromText();
|
||||
m_showPreview.processMnemonicFromText();
|
||||
@ -54,6 +56,7 @@ FilterWindow::FilterWindow(const char* title, const char* cfgSection,
|
||||
m_targetButton.setTarget(filterMgr->getTarget());
|
||||
m_targetButton.setCelsTarget(celsTarget);
|
||||
m_targetButton.TargetChange.connect(&FilterWindow::onTargetButtonChange, this);
|
||||
m_applyButton.Click.connect(&FilterWindow::onApply, this);
|
||||
m_okButton.Click.connect(&FilterWindow::onOk, this);
|
||||
m_cancelButton.Click.connect(&FilterWindow::onCancel, this);
|
||||
m_showPreview.Click.connect(&FilterWindow::onShowPreview, this);
|
||||
@ -63,6 +66,7 @@ FilterWindow::FilterWindow(const char* title, const char* cfgSection,
|
||||
m_hbox.addChild(&m_container);
|
||||
m_hbox.addChild(&m_vbox);
|
||||
|
||||
m_vbox.addChild(&m_applyButton);
|
||||
m_vbox.addChild(&m_okButton);
|
||||
m_vbox.addChild(&m_cancelButton);
|
||||
m_vbox.addChild(&m_targetButton);
|
||||
@ -119,10 +123,7 @@ bool FilterWindow::doModal()
|
||||
|
||||
// Did the user press OK?
|
||||
if (closer() == &m_okButton) {
|
||||
stopPreview();
|
||||
|
||||
// Apply the filter in background
|
||||
m_filterMgr->startWorker();
|
||||
apply();
|
||||
result = true;
|
||||
}
|
||||
|
||||
@ -151,6 +152,21 @@ void FilterWindow::setNewTarget(Target target)
|
||||
m_targetButton.setTarget(target);
|
||||
}
|
||||
|
||||
void FilterWindow::apply()
|
||||
{
|
||||
stopPreview();
|
||||
|
||||
// Apply the filter in background
|
||||
m_filterMgr->startWorker();
|
||||
}
|
||||
|
||||
void FilterWindow::onApply()
|
||||
{
|
||||
apply();
|
||||
|
||||
restartPreview();
|
||||
}
|
||||
|
||||
void FilterWindow::onOk()
|
||||
{
|
||||
m_okButton.closeWindow();
|
||||
|
@ -54,6 +54,9 @@ namespace app {
|
||||
// Returns the container where derived classes should put controls.
|
||||
ui::Widget* getContainer() { return &m_container; }
|
||||
|
||||
void apply();
|
||||
|
||||
void onApply();
|
||||
void onOk();
|
||||
void onCancel();
|
||||
void onShowPreview();
|
||||
@ -78,6 +81,7 @@ namespace app {
|
||||
ui::Box m_hbox;
|
||||
ui::Box m_vbox;
|
||||
ui::Box m_container;
|
||||
ui::Button m_applyButton;
|
||||
ui::Button m_okButton;
|
||||
ui::Button m_cancelButton;
|
||||
FilterPreview m_preview;
|
||||
|
Loading…
x
Reference in New Issue
Block a user