mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 15:32:38 +00:00
Add option to disable the "open sequence of files" dialog
This commit is contained in:
parent
5e98b39944
commit
8b4746e813
@ -121,6 +121,11 @@
|
||||
<value id="HSV" value="1" />
|
||||
<value id="HSL" value="2" />
|
||||
</enum>
|
||||
<enum id="SequenceDecision">
|
||||
<value id="ASK" value="0" />
|
||||
<value id="YES" value="1" />
|
||||
<value id="NO" value="2" />
|
||||
</enum>
|
||||
</types>
|
||||
|
||||
<global>
|
||||
@ -313,6 +318,9 @@
|
||||
<section id="advanced_mode">
|
||||
<option id="show_alert" type="bool" default="true" />
|
||||
</section>
|
||||
<section id="open_file">
|
||||
<option id="open_sequence" type="SequenceDecision" default="SequenceDecision::ASK" />
|
||||
</section>
|
||||
<section id="save_file">
|
||||
<option id="show_file_format_doesnt_support_alert" type="bool" default="true" />
|
||||
<option id="show_export_animation_in_sequence_alert" type="bool" default="true" />
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Aseprite
|
||||
# Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
# Copyright (C) 2018-2021 Igara Studio S.A.
|
||||
# Copyright (C) 2016-2018 David Capello
|
||||
|
||||
[advanced_mode]
|
||||
@ -1228,6 +1228,10 @@ the current frame & layer will be modified
|
||||
to focus the undid/redid change.
|
||||
END
|
||||
undo_allow_nonlinear_history = Allow non-linear history
|
||||
open_sequence_alert = Open a sequence of static files as an animation
|
||||
open_sequence_alert_ask = Ask
|
||||
open_sequence_alert_no = No
|
||||
open_sequence_alert_yes = Yes
|
||||
file_format_doesnt_support_alert = Show warning when saving a file with unsupported features
|
||||
export_animation_in_sequence_alert = Show warning when saving an animation as a sequence of static images
|
||||
overwrite_files_on_export_alert = Show warning when overwriting files on File > Export
|
||||
|
@ -1,4 +1,5 @@
|
||||
<!-- Aseprite -->
|
||||
<!-- Copyright (C) 2021 by Igara Studio S.A. -->
|
||||
<!-- Copyright (C) 2016 by David Capello -->
|
||||
<gui>
|
||||
<window id="open_sequence" text="@.title">
|
||||
@ -9,6 +10,7 @@
|
||||
</view>
|
||||
<separator horizontal="true" />
|
||||
<check id="repeat" text="@.repeat" />
|
||||
<check id="dont_show" text="@general.dont_show" />
|
||||
<hbox>
|
||||
<boxfiller />
|
||||
<hbox homogeneous="true">
|
||||
|
@ -426,6 +426,14 @@
|
||||
<!-- Alerts -->
|
||||
<vbox id="section_alerts">
|
||||
<separator text="@.section_alerts" horizontal="true" />
|
||||
<hbox>
|
||||
<label text="@.open_sequence_alert" />
|
||||
<combobox id="open_sequence">
|
||||
<listitem text="@.open_sequence_alert_ask" value="0" />
|
||||
<listitem text="@.open_sequence_alert_yes" value="1" />
|
||||
<listitem text="@.open_sequence_alert_no" value="2" />
|
||||
</combobox>
|
||||
</hbox>
|
||||
<check id="file_format_doesnt_support_alert" text="@.file_format_doesnt_support_alert"
|
||||
pref="save_file.show_file_format_doesnt_support_alert" />
|
||||
<check id="export_animation_in_sequence_alert" text="@.export_animation_in_sequence_alert"
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2019-2021 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -78,7 +78,7 @@ OpenFileCommand::OpenFileCommand()
|
||||
: Command(CommandId::OpenFile(), CmdRecordableFlag)
|
||||
, m_repeatCheckbox(false)
|
||||
, m_oneFrame(false)
|
||||
, m_seqDecision(SequenceDecision::Ask)
|
||||
, m_seqDecision(gen::SequenceDecision::ASK)
|
||||
{
|
||||
}
|
||||
|
||||
@ -90,12 +90,18 @@ void OpenFileCommand::onLoadParams(const Params& params)
|
||||
m_oneFrame = params.get_as<bool>("oneframe");
|
||||
|
||||
std::string sequence = params.get("sequence");
|
||||
if (m_oneFrame || sequence == "skip")
|
||||
m_seqDecision = SequenceDecision::Skip;
|
||||
else if (sequence == "agree")
|
||||
m_seqDecision = SequenceDecision::Agree;
|
||||
else
|
||||
m_seqDecision = SequenceDecision::Ask;
|
||||
if (m_oneFrame ||
|
||||
sequence == "skip" ||
|
||||
sequence == "no") {
|
||||
m_seqDecision = gen::SequenceDecision::NO;
|
||||
}
|
||||
else if (sequence == "agree" ||
|
||||
sequence == "yes") {
|
||||
m_seqDecision = gen::SequenceDecision::YES;
|
||||
}
|
||||
else {
|
||||
m_seqDecision = gen::SequenceDecision::ASK;
|
||||
}
|
||||
}
|
||||
|
||||
void OpenFileCommand::onExecute(Context* context)
|
||||
@ -143,14 +149,25 @@ void OpenFileCommand::onExecute(Context* context)
|
||||
FILE_LOAD_CREATE_PALETTE |
|
||||
(m_repeatCheckbox ? FILE_LOAD_SEQUENCE_ASK_CHECKBOX: 0);
|
||||
|
||||
if (context->isUIAvailable() &&
|
||||
m_seqDecision == gen::SequenceDecision::ASK) {
|
||||
if (Preferences::instance().openFile.openSequence() == gen::SequenceDecision::ASK) {
|
||||
// Do nothing (ask by default, or whatever the command params
|
||||
// specified)
|
||||
}
|
||||
else {
|
||||
m_seqDecision = Preferences::instance().openFile.openSequence();
|
||||
}
|
||||
}
|
||||
|
||||
switch (m_seqDecision) {
|
||||
case SequenceDecision::Ask:
|
||||
case gen::SequenceDecision::ASK:
|
||||
flags |= FILE_LOAD_SEQUENCE_ASK;
|
||||
break;
|
||||
case SequenceDecision::Agree:
|
||||
case gen::SequenceDecision::YES:
|
||||
flags |= FILE_LOAD_SEQUENCE_YES;
|
||||
break;
|
||||
case SequenceDecision::Skip:
|
||||
case gen::SequenceDecision::NO:
|
||||
flags |= FILE_LOAD_SEQUENCE_NONE;
|
||||
break;
|
||||
}
|
||||
@ -179,12 +196,12 @@ void OpenFileCommand::onExecute(Context* context)
|
||||
else {
|
||||
if (fop->isSequence()) {
|
||||
if (fop->sequenceFlags() & FILE_LOAD_SEQUENCE_YES) {
|
||||
m_seqDecision = SequenceDecision::Agree;
|
||||
m_seqDecision = gen::SequenceDecision::YES;
|
||||
flags &= ~FILE_LOAD_SEQUENCE_ASK;
|
||||
flags |= FILE_LOAD_SEQUENCE_YES;
|
||||
}
|
||||
else if (fop->sequenceFlags() & FILE_LOAD_SEQUENCE_NONE) {
|
||||
m_seqDecision = SequenceDecision::Skip;
|
||||
m_seqDecision = gen::SequenceDecision::NO;
|
||||
flags &= ~FILE_LOAD_SEQUENCE_ASK;
|
||||
flags |= FILE_LOAD_SEQUENCE_NONE;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2020 Igara Studio S.A.
|
||||
// Copyright (C) 2020-2021 Igara Studio S.A.
|
||||
// Copyright (C) 2016-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -10,6 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "app/commands/command.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "base/paths.h"
|
||||
|
||||
#include <string>
|
||||
@ -18,17 +19,13 @@ namespace app {
|
||||
|
||||
class OpenFileCommand : public Command {
|
||||
public:
|
||||
enum class SequenceDecision {
|
||||
Ask, Agree, Skip,
|
||||
};
|
||||
|
||||
OpenFileCommand();
|
||||
|
||||
const base::paths& usedFiles() const {
|
||||
return m_usedFiles;
|
||||
}
|
||||
|
||||
SequenceDecision seqDecision() const {
|
||||
gen::SequenceDecision seqDecision() const {
|
||||
return m_seqDecision;
|
||||
}
|
||||
|
||||
@ -42,7 +39,7 @@ namespace app {
|
||||
bool m_repeatCheckbox;
|
||||
bool m_oneFrame;
|
||||
base::paths m_usedFiles;
|
||||
SequenceDecision m_seqDecision;
|
||||
gen::SequenceDecision m_seqDecision;
|
||||
};
|
||||
|
||||
} // namespace app
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2021 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -235,6 +235,7 @@ public:
|
||||
}
|
||||
|
||||
// Alerts
|
||||
openSequence()->setSelectedItemIndex(int(m_pref.openFile.openSequence()));
|
||||
resetAlerts()->Click.connect([this]{ onResetAlerts(); });
|
||||
|
||||
// Cursor
|
||||
@ -681,6 +682,9 @@ public:
|
||||
m_curPref->bg.color1(checkedBgColor1()->getColor());
|
||||
m_curPref->bg.color2(checkedBgColor2()->getColor());
|
||||
|
||||
// Alerts preferences
|
||||
m_pref.openFile.openSequence(gen::SequenceDecision(openSequence()->getSelectedItemIndex()));
|
||||
|
||||
int undo_size_limit_value;
|
||||
undo_size_limit_value = undoSizeLimit()->textInt();
|
||||
undo_size_limit_value = base::clamp(undo_size_limit_value, 0, 999999);
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2021 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -261,10 +261,19 @@ FileOp* FileOp::createLoadDocumentOperation(Context* context,
|
||||
|
||||
window.openWindowInForeground();
|
||||
|
||||
// Don't show this alert again.
|
||||
if (window.dontShow()->isSelected()) {
|
||||
Preferences::instance().openFile.openSequence(
|
||||
window.closer() == window.agree() ?
|
||||
gen::SequenceDecision::YES:
|
||||
gen::SequenceDecision::NO);
|
||||
}
|
||||
|
||||
// If the user selected the "do the same for other files"
|
||||
// checkbox, we've to save what the user want to do for the
|
||||
// following files.
|
||||
if (window.repeat()->isSelected()) {
|
||||
if (window.repeat()->isSelected() ||
|
||||
window.dontShow()->isSelected()) {
|
||||
if (window.closer() == window.agree())
|
||||
fop->m_seq.flags = FILE_LOAD_SEQUENCE_YES;
|
||||
else
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2019-2021 Igara Studio S.A.
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -174,11 +174,12 @@ FOR_ENUM(app::gen::PivotPosition)
|
||||
FOR_ENUM(app::gen::PixelConnectivity)
|
||||
FOR_ENUM(app::gen::RightClickMode)
|
||||
FOR_ENUM(app::gen::SelectionMode)
|
||||
FOR_ENUM(app::gen::SequenceDecision)
|
||||
FOR_ENUM(app::gen::StopAtGrid)
|
||||
FOR_ENUM(app::gen::SymmetryMode)
|
||||
FOR_ENUM(app::gen::TimelinePosition)
|
||||
FOR_ENUM(app::gen::WindowColorProfile)
|
||||
FOR_ENUM(app::gen::ToGrayAlgorithm)
|
||||
FOR_ENUM(app::gen::WindowColorProfile)
|
||||
FOR_ENUM(app::tools::FreehandAlgorithm)
|
||||
FOR_ENUM(app::tools::RotationAlgorithm)
|
||||
FOR_ENUM(doc::AniDir)
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2020 Igara Studio S.A.
|
||||
// Copyright (C) 2020-2021 Igara Studio S.A.
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -29,14 +29,14 @@ namespace app {
|
||||
params.set("oneframe", "true");
|
||||
else {
|
||||
switch (m_lastDecision) {
|
||||
case OpenFileCommand::SequenceDecision::Ask:
|
||||
case gen::SequenceDecision::ASK:
|
||||
params.set("sequence", "ask");
|
||||
params.set("repeat_checkbox", "true");
|
||||
break;
|
||||
case OpenFileCommand::SequenceDecision::Skip:
|
||||
case gen::SequenceDecision::NO:
|
||||
params.set("sequence", "skip");
|
||||
break;
|
||||
case OpenFileCommand::SequenceDecision::Agree:
|
||||
case gen::SequenceDecision::YES:
|
||||
params.set("sequence", "agree");
|
||||
break;
|
||||
}
|
||||
@ -49,7 +49,7 @@ namespace app {
|
||||
|
||||
// Future decision for other files in the CLI
|
||||
auto d = m_cmd.seqDecision();
|
||||
if (d != OpenFileCommand::SequenceDecision::Ask)
|
||||
if (d != gen::SequenceDecision::ASK)
|
||||
m_lastDecision = d;
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ namespace app {
|
||||
|
||||
private:
|
||||
OpenFileCommand m_cmd;
|
||||
OpenFileCommand::SequenceDecision m_lastDecision = OpenFileCommand::SequenceDecision::Ask;
|
||||
gen::SequenceDecision m_lastDecision = gen::SequenceDecision::ASK;
|
||||
};
|
||||
|
||||
} // namespace app
|
||||
|
Loading…
x
Reference in New Issue
Block a user