Run clang-modernize on things
This commit is contained in:
parent
2e051a8fde
commit
a7f4fb5b87
180 changed files with 1045 additions and 1048 deletions
|
@ -39,7 +39,7 @@ class UCDetect : public nsUniversalDetector {
|
||||||
/// List of detected character sets
|
/// List of detected character sets
|
||||||
CharsetListDetected list;
|
CharsetListDetected list;
|
||||||
|
|
||||||
void Report(const char* aCharset) {}
|
void Report(const char*) override {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// @brief Detect character set of a file using UniversalCharDetect
|
/// @brief Detect character set of a file using UniversalCharDetect
|
||||||
|
@ -90,17 +90,16 @@ public:
|
||||||
list.emplace_back(1.f, mDetectedCharset);
|
list.emplace_back(1.f, mDetectedCharset);
|
||||||
else {
|
else {
|
||||||
switch (mInputState) {
|
switch (mInputState) {
|
||||||
case eHighbyte: {
|
case eHighbyte:
|
||||||
for (PRInt32 i=0; i<NUM_OF_CHARSET_PROBERS; i++) {
|
for (auto& elem : mCharSetProbers) {
|
||||||
if (!mCharSetProbers[i]) continue;
|
if (!elem) continue;
|
||||||
|
|
||||||
float conf = mCharSetProbers[i]->GetConfidence();
|
float conf = elem->GetConfidence();
|
||||||
if (conf > 0.01f)
|
if (conf > 0.01f)
|
||||||
list.emplace_back(conf, mCharSetProbers[i]->GetCharSetName());
|
list.emplace_back(conf, elem->GetCharSetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case ePureAscii:
|
case ePureAscii:
|
||||||
list.emplace_back(1.f, "US-ASCII");
|
list.emplace_back(1.f, "US-ASCII");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -241,7 +241,7 @@ namespace {
|
||||||
~ConverterImpl() {
|
~ConverterImpl() {
|
||||||
if (cd != iconv_invalid) iconv_close(cd);
|
if (cd != iconv_invalid) iconv_close(cd);
|
||||||
}
|
}
|
||||||
size_t Convert(const char** inbuf, size_t* inbytesleft, char** outbuf, size_t* outbytesleft) {
|
size_t Convert(const char** inbuf, size_t* inbytesleft, char** outbuf, size_t* outbytesleft) override {
|
||||||
eat_bom(cd, bomSize, inbuf, inbytesleft, outbuf, outbytesleft);
|
eat_bom(cd, bomSize, inbuf, inbytesleft, outbuf, outbytesleft);
|
||||||
size_t res = iconv(cd, ICONV_CONST_CAST(inbuf), inbytesleft, outbuf, outbytesleft);
|
size_t res = iconv(cd, ICONV_CONST_CAST(inbuf), inbytesleft, outbuf, outbytesleft);
|
||||||
|
|
||||||
|
|
|
@ -33,13 +33,13 @@ namespace {
|
||||||
std::atomic<uint_fast32_t> threads_running;
|
std::atomic<uint_fast32_t> threads_running;
|
||||||
|
|
||||||
class MainQueue : public agi::dispatch::Queue {
|
class MainQueue : public agi::dispatch::Queue {
|
||||||
void DoInvoke(agi::dispatch::Thunk thunk) {
|
void DoInvoke(agi::dispatch::Thunk thunk) override {
|
||||||
invoke_main(thunk);
|
invoke_main(thunk);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class BackgroundQueue : public agi::dispatch::Queue {
|
class BackgroundQueue : public agi::dispatch::Queue {
|
||||||
void DoInvoke(agi::dispatch::Thunk thunk) {
|
void DoInvoke(agi::dispatch::Thunk thunk) override {
|
||||||
service->post(thunk);
|
service->post(thunk);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -47,7 +47,7 @@ namespace {
|
||||||
class SerialQueue : public agi::dispatch::Queue {
|
class SerialQueue : public agi::dispatch::Queue {
|
||||||
boost::asio::io_service::strand strand;
|
boost::asio::io_service::strand strand;
|
||||||
|
|
||||||
void DoInvoke(agi::dispatch::Thunk thunk) {
|
void DoInvoke(agi::dispatch::Thunk thunk) override {
|
||||||
strand.post(thunk);
|
strand.post(thunk);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -56,7 +56,7 @@ MRUManager::~MRUManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
MRUManager::MRUListMap &MRUManager::Find(std::string const& key) {
|
MRUManager::MRUListMap &MRUManager::Find(std::string const& key) {
|
||||||
MRUMap::iterator index = mru.find(key);
|
auto index = mru.find(key);
|
||||||
if (index == mru.end())
|
if (index == mru.end())
|
||||||
throw MRUErrorInvalidKey("Invalid key value");
|
throw MRUErrorInvalidKey("Invalid key value");
|
||||||
return index->second;
|
return index->second;
|
||||||
|
|
|
@ -67,11 +67,11 @@ std::unique_ptr<OptionValue> ConfigVisitor::ReadArray(json::Array const& src, st
|
||||||
for (json::Object const& obj : src) {
|
for (json::Object const& obj : src) {
|
||||||
if (obj.size() != 1) {
|
if (obj.size() != 1) {
|
||||||
Error<OptionJsonValueArray>("Invalid array member");
|
Error<OptionJsonValueArray>("Invalid array member");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (obj.begin()->first != array_type) {
|
if (obj.begin()->first != array_type) {
|
||||||
Error<OptionJsonValueArray>("Attempt to insert value into array of wrong type");
|
Error<OptionJsonValueArray>("Attempt to insert value into array of wrong type");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
arr.push_back(ValueType(obj.begin()->second));
|
arr.push_back(ValueType(obj.begin()->second));
|
||||||
|
|
|
@ -66,7 +66,7 @@ fs::path Path::Decode(std::string const& path) const {
|
||||||
|
|
||||||
fs::path Path::MakeRelative(fs::path const& path, std::string const& token) const {
|
fs::path Path::MakeRelative(fs::path const& path, std::string const& token) const {
|
||||||
const auto it = tokens.find(token);
|
const auto it = tokens.find(token);
|
||||||
if (it == tokens.end()) throw agi::InternalError("Bad token: " + token, 0);
|
if (it == tokens.end()) throw agi::InternalError("Bad token: " + token, nullptr);
|
||||||
|
|
||||||
return MakeRelative(path, it->second);
|
return MakeRelative(path, it->second);
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ fs::path Path::MakeRelative(fs::path const& path, fs::path const& base) const {
|
||||||
|
|
||||||
fs::path Path::MakeAbsolute(fs::path path, std::string const& token) const {
|
fs::path Path::MakeAbsolute(fs::path path, std::string const& token) const {
|
||||||
const auto it = tokens.find(token);
|
const auto it = tokens.find(token);
|
||||||
if (it == tokens.end()) throw agi::InternalError("Bad token: " + token, 0);
|
if (it == tokens.end()) throw agi::InternalError("Bad token: " + token, nullptr);
|
||||||
if (path.empty()) return path;
|
if (path.empty()) return path;
|
||||||
|
|
||||||
path.make_preferred();
|
path.make_preferred();
|
||||||
|
@ -127,7 +127,7 @@ std::string Path::Encode(fs::path const& path) const {
|
||||||
|
|
||||||
void Path::SetToken(std::string const& token_name, fs::path const& token_value) {
|
void Path::SetToken(std::string const& token_name, fs::path const& token_value) {
|
||||||
const auto it = tokens.find(token_name);
|
const auto it = tokens.find(token_name);
|
||||||
if (it == tokens.end()) throw agi::InternalError("Bad token: " + token_name, 0);
|
if (it == tokens.end()) throw agi::InternalError("Bad token: " + token_name, nullptr);
|
||||||
|
|
||||||
if (token_value.empty())
|
if (token_value.empty())
|
||||||
it->second = token_value;
|
it->second = token_value;
|
||||||
|
|
|
@ -179,8 +179,8 @@ void Framerate::SetFromTimecodes() {
|
||||||
last = (timecodes.size() - 1) * denominator * 1000;
|
last = (timecodes.size() - 1) * denominator * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
Framerate::Framerate(std::vector<int> const& timecodes)
|
Framerate::Framerate(std::vector<int> timecodes)
|
||||||
: timecodes(timecodes)
|
: timecodes(std::move(timecodes))
|
||||||
, drop(false)
|
, drop(false)
|
||||||
{
|
{
|
||||||
SetFromTimecodes();
|
SetFromTimecodes();
|
||||||
|
|
|
@ -31,9 +31,9 @@ public:
|
||||||
// problems such as errant characters or corrupt/incomplete documents
|
// problems such as errant characters or corrupt/incomplete documents
|
||||||
class ScanException : public Exception {
|
class ScanException : public Exception {
|
||||||
public:
|
public:
|
||||||
ScanException(std::string const& sMessage, Reader::Location const& locError)
|
ScanException(std::string const& sMessage, Reader::Location locError)
|
||||||
: Exception(sMessage)
|
: Exception(sMessage)
|
||||||
, m_locError(locError)
|
, m_locError(std::move(locError))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
Reader::Location m_locError;
|
Reader::Location m_locError;
|
||||||
|
@ -43,10 +43,10 @@ public:
|
||||||
// higher-level problems such as missing commas or brackets
|
// higher-level problems such as missing commas or brackets
|
||||||
class ParseException : public Exception {
|
class ParseException : public Exception {
|
||||||
public:
|
public:
|
||||||
ParseException(std::string const& sMessage, Reader::Location const& locTokenBegin, Reader::Location const& locTokenEnd)
|
ParseException(std::string const& sMessage, Reader::Location locTokenBegin, Reader::Location locTokenEnd)
|
||||||
: Exception(sMessage)
|
: Exception(sMessage)
|
||||||
, m_locTokenBegin(locTokenBegin)
|
, m_locTokenBegin(std::move(locTokenBegin))
|
||||||
, m_locTokenEnd(locTokenEnd)
|
, m_locTokenEnd(std::move(locTokenEnd))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
Reader::Location m_locTokenBegin;
|
Reader::Location m_locTokenBegin;
|
||||||
|
|
|
@ -26,13 +26,13 @@ class Writer : private ConstVisitor {
|
||||||
void Write(const Null& null);
|
void Write(const Null& null);
|
||||||
void Write(const UnknownElement& unknown);
|
void Write(const UnknownElement& unknown);
|
||||||
|
|
||||||
void Visit(const Array& array);
|
void Visit(const Array& array) override;
|
||||||
void Visit(const Object& object);
|
void Visit(const Object& object) override;
|
||||||
void Visit(const Integer& number);
|
void Visit(const Integer& number) override;
|
||||||
void Visit(const Double& number);
|
void Visit(const Double& number) override;
|
||||||
void Visit(const String& string);
|
void Visit(const String& string) override;
|
||||||
void Visit(const Boolean& boolean);
|
void Visit(const Boolean& boolean) override;
|
||||||
void Visit(const Null& null);
|
void Visit(const Null& null) override;
|
||||||
|
|
||||||
std::ostream& m_ostr;
|
std::ostream& m_ostr;
|
||||||
int tab_depth;
|
int tab_depth;
|
||||||
|
|
|
@ -100,7 +100,7 @@ namespace agi {
|
||||||
///
|
///
|
||||||
/// Deriving classes should always use this constructor for initialising
|
/// Deriving classes should always use this constructor for initialising
|
||||||
/// the base class.
|
/// the base class.
|
||||||
Exception(const std::string &msg, const Exception *inr = 0) : message(msg) {
|
Exception(std::string msg, const Exception *inr = nullptr) : message(std::move(msg)) {
|
||||||
if (inr)
|
if (inr)
|
||||||
inner.reset(inr->Copy());
|
inner.reset(inr->Copy());
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,8 @@ namespace agi {
|
||||||
namespace hotkey {
|
namespace hotkey {
|
||||||
|
|
||||||
/// @class Combo
|
/// @class Combo
|
||||||
/// A Combo represents a linear sequence of characters set in an std::vector. This makes up
|
/// A Combo represents a linear sequence of characters set in an std::vector.
|
||||||
/// a single combination, or "Hotkey".
|
/// This makes up a single combination, or "Hotkey".
|
||||||
class Combo {
|
class Combo {
|
||||||
std::vector<std::string> key_map;
|
std::vector<std::string> key_map;
|
||||||
std::string cmd_name;
|
std::string cmd_name;
|
||||||
|
@ -44,10 +44,10 @@ public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// @param ctx Context
|
/// @param ctx Context
|
||||||
/// @param cmd Command name
|
/// @param cmd Command name
|
||||||
Combo(std::string const& ctx, std::string const& cmd, std::vector<std::string> const& keys)
|
Combo(std::string ctx, std::string cmd, std::vector<std::string> keys)
|
||||||
: key_map(keys)
|
: key_map(std::move(keys))
|
||||||
, cmd_name(cmd)
|
, cmd_name(std::move(cmd))
|
||||||
, context(ctx)
|
, context(std::move(ctx))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ public:
|
||||||
|
|
||||||
/// @brief Invalid iterator constructor; use for end iterator
|
/// @brief Invalid iterator constructor; use for end iterator
|
||||||
line_iterator()
|
line_iterator()
|
||||||
: stream(0)
|
: stream(nullptr)
|
||||||
, valid(false)
|
, valid(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,9 +43,9 @@ namespace agi {
|
||||||
template<class StartCont, class Iter, class WidthCont>
|
template<class StartCont, class Iter, class WidthCont>
|
||||||
inline void get_line_widths(StartCont const& line_start_points, Iter begin, Iter end, WidthCont &line_widths) {
|
inline void get_line_widths(StartCont const& line_start_points, Iter begin, Iter end, WidthCont &line_widths) {
|
||||||
size_t line_start = 0;
|
size_t line_start = 0;
|
||||||
for (size_t i = 0; i < line_start_points.size(); ++i) {
|
for (auto & line_start_point : line_start_points) {
|
||||||
line_widths.push_back(std::accumulate(begin + line_start, begin + line_start_points[i], 0));
|
line_widths.push_back(std::accumulate(begin + line_start, begin + line_start_point, 0));
|
||||||
line_start = line_start_points[i];
|
line_start = line_start_point;
|
||||||
}
|
}
|
||||||
line_widths.push_back(std::accumulate(begin + line_start, end, 0));
|
line_widths.push_back(std::accumulate(begin + line_start, end, 0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ public:
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~JsonEmitter();
|
~JsonEmitter();
|
||||||
|
|
||||||
void log(SinkMessage *);
|
void log(SinkMessage *) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Generates a message and submits it to the log sink.
|
/// Generates a message and submits it to the log sink.
|
||||||
|
@ -149,7 +149,7 @@ public:
|
||||||
/// Emit log entries to stdout.
|
/// Emit log entries to stdout.
|
||||||
class EmitSTDOUT: public Emitter {
|
class EmitSTDOUT: public Emitter {
|
||||||
public:
|
public:
|
||||||
void log(SinkMessage *sm);
|
void log(SinkMessage *sm) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace log
|
} // namespace log
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param config File to load MRU values from
|
/// @param config File to load MRU values from
|
||||||
MRUManager(agi::fs::path const& config, std::string const& default_config, agi::Options *options = 0);
|
MRUManager(agi::fs::path const& config, std::string const& default_config, agi::Options *options = nullptr);
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~MRUManager();
|
~MRUManager();
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace detail {
|
||||||
|
|
||||||
SlotMap slots; /// Signals currently connected to this slot
|
SlotMap slots; /// Signals currently connected to this slot
|
||||||
|
|
||||||
void Disconnect(ConnectionToken *tok) {
|
void Disconnect(ConnectionToken *tok) override {
|
||||||
slots.erase(tok);
|
slots.erase(tok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ public:
|
||||||
|
|
||||||
/// @brief VFR from frame times
|
/// @brief VFR from frame times
|
||||||
/// @param timecodes Vector of frame start times in milliseconds
|
/// @param timecodes Vector of frame start times in milliseconds
|
||||||
Framerate(std::vector<int> const& timecodes);
|
Framerate(std::vector<int> timecodes);
|
||||||
|
|
||||||
/// Helper function for the std::swap specialization
|
/// Helper function for the std::swap specialization
|
||||||
void swap(Framerate &right) throw();
|
void swap(Framerate &right) throw();
|
||||||
|
|
|
@ -93,12 +93,12 @@ wxString AegisubLocale::PickLanguage() {
|
||||||
|
|
||||||
// Generate names
|
// Generate names
|
||||||
wxArrayString langNames;
|
wxArrayString langNames;
|
||||||
for (size_t i = 0; i < langs.size(); ++i) {
|
for (auto const& lang : langs) {
|
||||||
const wxLanguageInfo *info = wxLocale::FindLanguageInfo(langs[i]);
|
const wxLanguageInfo *info = wxLocale::FindLanguageInfo(lang);
|
||||||
if (info)
|
if (info)
|
||||||
langNames.push_back(wxLocale::GetLanguageName(info->Language));
|
langNames.push_back(wxLocale::GetLanguageName(info->Language));
|
||||||
else
|
else
|
||||||
langNames.push_back(langs[i]);
|
langNames.push_back(lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCENTRE;
|
long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCENTRE;
|
||||||
|
@ -107,7 +107,7 @@ wxString AegisubLocale::PickLanguage() {
|
||||||
|
|
||||||
wxSingleChoiceDialog dialog(nullptr, "Please choose a language:", "Language", langNames,
|
wxSingleChoiceDialog dialog(nullptr, "Please choose a language:", "Language", langNames,
|
||||||
#if wxCHECK_VERSION(2, 9, 4)
|
#if wxCHECK_VERSION(2, 9, 4)
|
||||||
(void **)0,
|
(void **)nullptr,
|
||||||
#else
|
#else
|
||||||
0,
|
0,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -52,7 +52,7 @@ AssAttachment::AssAttachment(agi::fs::path const& name, AssEntryGroup group)
|
||||||
}
|
}
|
||||||
|
|
||||||
AssEntry *AssAttachment::Clone() const {
|
AssEntry *AssAttachment::Clone() const {
|
||||||
AssAttachment *clone = new AssAttachment(filename, group);
|
auto clone = new AssAttachment(filename, group);
|
||||||
clone->entry_data = entry_data;
|
clone->entry_data = entry_data;
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ public:
|
||||||
|
|
||||||
agi::StringRange next_tok() {
|
agi::StringRange next_tok() {
|
||||||
if (pos.eof())
|
if (pos.eof())
|
||||||
throw SubtitleFormatParseError("Failed parsing line: " + std::string(str.begin(), str.end()), 0);
|
throw SubtitleFormatParseError("Failed parsing line: " + std::string(str.begin(), str.end()), nullptr);
|
||||||
return *pos++;
|
return *pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ void AssDialogue::Parse(std::string const& raw) {
|
||||||
str = agi::StringRange(raw.begin() + 9, raw.end());
|
str = agi::StringRange(raw.begin() + 9, raw.end());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw SubtitleFormatParseError("Failed parsing line: " + raw, 0);
|
throw SubtitleFormatParseError("Failed parsing line: " + raw, nullptr);
|
||||||
|
|
||||||
tokenizer tkn(str);
|
tokenizer tkn(str);
|
||||||
|
|
||||||
|
@ -169,8 +169,8 @@ std::string AssDialogue::GetData(bool ssa) const {
|
||||||
append_str(str, End.GetAssFormated());
|
append_str(str, End.GetAssFormated());
|
||||||
append_unsafe_str(str, Style);
|
append_unsafe_str(str, Style);
|
||||||
append_unsafe_str(str, Actor);
|
append_unsafe_str(str, Actor);
|
||||||
for (int i = 0; i < 3; ++i)
|
for (auto margin : Margin)
|
||||||
append_int(str, Margin[i]);
|
append_int(str, margin);
|
||||||
append_unsafe_str(str, Effect);
|
append_unsafe_str(str, Effect);
|
||||||
str += Text.get();
|
str += Text.get();
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ std::auto_ptr<boost::ptr_vector<AssDialogueBlock>> AssDialogue::ParseTags() cons
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Create block
|
// Create block
|
||||||
AssDialogueBlockOverride *block = new AssDialogueBlockOverride(work);
|
auto block = new AssDialogueBlockOverride(work);
|
||||||
block->ParseTags();
|
block->ParseTags();
|
||||||
Blocks.push_back(block);
|
Blocks.push_back(block);
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ std::string AssDialogue::GetStrippedText() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
AssEntry *AssDialogue::Clone() const {
|
AssEntry *AssDialogue::Clone() const {
|
||||||
AssDialogue *clone = new AssDialogue(*this);
|
auto clone = new AssDialogue(*this);
|
||||||
*const_cast<int *>(&clone->Id) = Id;
|
*const_cast<int *>(&clone->Id) = Id;
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ protected:
|
||||||
/// Text of this block
|
/// Text of this block
|
||||||
std::string text;
|
std::string text;
|
||||||
public:
|
public:
|
||||||
AssDialogueBlock(std::string const& text) : text(text) { }
|
AssDialogueBlock(std::string text) : text(std::move(text)) { }
|
||||||
virtual ~AssDialogueBlock() { }
|
virtual ~AssDialogueBlock() { }
|
||||||
|
|
||||||
virtual AssBlockType GetType() const = 0;
|
virtual AssBlockType GetType() const = 0;
|
||||||
|
@ -174,7 +174,7 @@ public:
|
||||||
/// Does this line collide with the passed line?
|
/// Does this line collide with the passed line?
|
||||||
bool CollidesWith(const AssDialogue *target) const;
|
bool CollidesWith(const AssDialogue *target) const;
|
||||||
|
|
||||||
AssEntry *Clone() const;
|
AssEntry *Clone() const override;
|
||||||
|
|
||||||
AssDialogue();
|
AssDialogue();
|
||||||
AssDialogue(AssDialogue const&);
|
AssDialogue(AssDialogue const&);
|
||||||
|
|
|
@ -43,10 +43,10 @@ static FilterList& filters() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
AssExportFilter::AssExportFilter(std::string const& name, std::string const& description, int priority)
|
AssExportFilter::AssExportFilter(std::string name, std::string description, int priority)
|
||||||
: name(name)
|
: name(std::move(name))
|
||||||
, priority(priority)
|
, priority(priority)
|
||||||
, description(description)
|
, description(std::move(description))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ class AssExportFilter : public boost::intrusive::make_list_base_hook<boost::intr
|
||||||
std::string description;
|
std::string description;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AssExportFilter(std::string const& name, std::string const& description, int priority = 0);
|
AssExportFilter(std::string name, std::string description, int priority = 0);
|
||||||
virtual ~AssExportFilter() { };
|
virtual ~AssExportFilter() { };
|
||||||
|
|
||||||
std::string const& GetName() const { return name; }
|
std::string const& GetName() const { return name; }
|
||||||
|
@ -69,12 +69,12 @@ public:
|
||||||
/// @param subs Subtitles to process
|
/// @param subs Subtitles to process
|
||||||
/// @param parent_window Window to use as the parent if the filter wishes
|
/// @param parent_window Window to use as the parent if the filter wishes
|
||||||
/// to open a progress dialog
|
/// to open a progress dialog
|
||||||
virtual void ProcessSubs(AssFile *subs, wxWindow *parent_window=0)=0;
|
virtual void ProcessSubs(AssFile *subs, wxWindow *parent_window=nullptr)=0;
|
||||||
|
|
||||||
/// Draw setup controls
|
/// Draw setup controls
|
||||||
/// @param parent Parent window to add controls to
|
/// @param parent Parent window to add controls to
|
||||||
/// @param c Project context
|
/// @param c Project context
|
||||||
virtual wxWindow *GetConfigDialogWindow(wxWindow *parent, agi::Context *c) { return 0; }
|
virtual wxWindow *GetConfigDialogWindow(wxWindow *parent, agi::Context *c) { return nullptr; }
|
||||||
|
|
||||||
/// Load settings to use from the configuration dialog
|
/// Load settings to use from the configuration dialog
|
||||||
/// @param is_default If true use default settings instead
|
/// @param is_default If true use default settings instead
|
||||||
|
|
|
@ -74,7 +74,7 @@ public:
|
||||||
/// @param file Target filename
|
/// @param file Target filename
|
||||||
/// @param charset Target charset
|
/// @param charset Target charset
|
||||||
/// @param parent_window Parent window the filters should use when opening dialogs
|
/// @param parent_window Parent window the filters should use when opening dialogs
|
||||||
void Export(agi::fs::path const& file, std::string const& charset, wxWindow *parent_window= 0);
|
void Export(agi::fs::path const& file, std::string const& charset, wxWindow *parent_window= nullptr);
|
||||||
|
|
||||||
/// Add configuration panels for all registered filters to the target sizer
|
/// Add configuration panels for all registered filters to the target sizer
|
||||||
/// @param parent Parent window for controls
|
/// @param parent Parent window for controls
|
||||||
|
|
|
@ -138,7 +138,7 @@ public:
|
||||||
/// @param commitId Commit to amend rather than pushing a new commit
|
/// @param commitId Commit to amend rather than pushing a new commit
|
||||||
/// @param single_line Line which was changed, if only one line was
|
/// @param single_line Line which was changed, if only one line was
|
||||||
/// @return Unique identifier for the new undo group
|
/// @return Unique identifier for the new undo group
|
||||||
int Commit(wxString const& desc, int type, int commitId = -1, AssEntry *single_line = 0);
|
int Commit(wxString const& desc, int type, int commitId = -1, AssEntry *single_line = nullptr);
|
||||||
|
|
||||||
/// Comparison function for use when sorting
|
/// Comparison function for use when sorting
|
||||||
typedef bool (*CompFunc)(const AssDialogue* lft, const AssDialogue* rgt);
|
typedef bool (*CompFunc)(const AssDialogue* lft, const AssDialogue* rgt);
|
||||||
|
|
|
@ -24,7 +24,7 @@ class AssInfo : public AssEntry {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AssInfo(AssInfo const& o) : key(o.key), value(o.value) { }
|
AssInfo(AssInfo const& o) : key(o.key), value(o.value) { }
|
||||||
AssInfo(std::string const& key, std::string const& value) : key(key), value(value) { }
|
AssInfo(std::string key, std::string value) : key(std::move(key)), value(std::move(value)) { }
|
||||||
|
|
||||||
AssEntry *Clone() const override { return new AssInfo(*this); }
|
AssEntry *Clone() const override { return new AssInfo(*this); }
|
||||||
AssEntryGroup Group() const override { return AssEntryGroup::INFO; }
|
AssEntryGroup Group() const override { return AssEntryGroup::INFO; }
|
||||||
|
|
|
@ -294,7 +294,7 @@ void AssKaraoke::SplitLines(std::set<AssDialogue*> const& lines, agi::Context *c
|
||||||
bool in_sel = sel.count(diag) > 0;
|
bool in_sel = sel.count(diag) > 0;
|
||||||
|
|
||||||
for (auto const& syl : kara) {
|
for (auto const& syl : kara) {
|
||||||
AssDialogue *new_line = new AssDialogue(*diag);
|
auto new_line = new AssDialogue(*diag);
|
||||||
|
|
||||||
new_line->Start = syl.start_time;
|
new_line->Start = syl.start_time;
|
||||||
new_line->End = syl.start_time + syl.duration;
|
new_line->End = syl.start_time + syl.duration;
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
/// @param line Initial line
|
/// @param line Initial line
|
||||||
/// @param auto_split Should the line automatically be split on spaces if there are no k tags?
|
/// @param auto_split Should the line automatically be split on spaces if there are no k tags?
|
||||||
/// @param normalize Should the total duration of the syllables be forced to equal the line duration?
|
/// @param normalize Should the total duration of the syllables be forced to equal the line duration?
|
||||||
AssKaraoke(AssDialogue *line = 0, bool auto_split = false, bool normalize = true);
|
AssKaraoke(AssDialogue *line = nullptr, bool auto_split = false, bool normalize = true);
|
||||||
|
|
||||||
/// Parse a dialogue line
|
/// Parse a dialogue line
|
||||||
void SetLine(AssDialogue *line, bool auto_split = false, bool normalize = true);
|
void SetLine(AssDialogue *line, bool auto_split = false, bool normalize = true);
|
||||||
|
|
|
@ -79,7 +79,7 @@ AssOverrideParameter::~AssOverrideParameter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> std::string AssOverrideParameter::Get<std::string>() const {
|
template<> std::string AssOverrideParameter::Get<std::string>() const {
|
||||||
if (omitted) throw agi::InternalError("AssOverrideParameter::Get() called on omitted parameter", 0);
|
if (omitted) throw agi::InternalError("AssOverrideParameter::Get() called on omitted parameter", nullptr);
|
||||||
if (block.get()) {
|
if (block.get()) {
|
||||||
std::string str(block->GetText());
|
std::string str(block->GetText());
|
||||||
if (boost::starts_with(str, "{")) str.erase(begin(str));
|
if (boost::starts_with(str, "{")) str.erase(begin(str));
|
||||||
|
|
|
@ -81,7 +81,7 @@ void AssParser::ParseScriptInfoLine(std::string const& data) {
|
||||||
else if (version_str == "v4.00+")
|
else if (version_str == "v4.00+")
|
||||||
version = 1;
|
version = 1;
|
||||||
else
|
else
|
||||||
throw SubtitleFormatParseError("Unknown SSA file format version", 0);
|
throw SubtitleFormatParseError("Unknown SSA file format version", nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nothing actually supports the Collisions property and malformed values
|
// Nothing actually supports the Collisions property and malformed values
|
||||||
|
|
|
@ -80,7 +80,7 @@ class parser {
|
||||||
|
|
||||||
std::string next_tok() {
|
std::string next_tok() {
|
||||||
if (pos.eof())
|
if (pos.eof())
|
||||||
throw SubtitleFormatParseError("Malformed style: not enough fields", 0);
|
throw SubtitleFormatParseError("Malformed style: not enough fields", nullptr);
|
||||||
return agi::str(trim_copy(*pos++));
|
return agi::str(trim_copy(*pos++));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public:
|
||||||
|
|
||||||
void check_done() const {
|
void check_done() const {
|
||||||
if (!pos.eof())
|
if (!pos.eof())
|
||||||
throw SubtitleFormatParseError("Malformed style: too many fields", 0);
|
throw SubtitleFormatParseError("Malformed style: too many fields", nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string next_str() { return next_tok(); }
|
std::string next_str() { return next_tok(); }
|
||||||
|
@ -104,7 +104,7 @@ public:
|
||||||
return boost::lexical_cast<int>(next_tok());
|
return boost::lexical_cast<int>(next_tok());
|
||||||
}
|
}
|
||||||
catch (boost::bad_lexical_cast const&) {
|
catch (boost::bad_lexical_cast const&) {
|
||||||
throw SubtitleFormatParseError("Malformed style: bad int field", 0);
|
throw SubtitleFormatParseError("Malformed style: bad int field", nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ public:
|
||||||
return boost::lexical_cast<double>(next_tok());
|
return boost::lexical_cast<double>(next_tok());
|
||||||
}
|
}
|
||||||
catch (boost::bad_lexical_cast const&) {
|
catch (boost::bad_lexical_cast const&) {
|
||||||
throw SubtitleFormatParseError("Malformed style: bad double field", 0);
|
throw SubtitleFormatParseError("Malformed style: bad double field", nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,5 +97,5 @@ AssStyle *AssStyleStorage::GetStyle(std::string const& name) {
|
||||||
if (boost::iequals(cur->name, name))
|
if (boost::iequals(cur->name, name))
|
||||||
return cur.get();
|
return cur.get();
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,9 +89,9 @@ int AssTime::GetTimeSeconds() const { return (time % 60000) / 1000; }
|
||||||
int AssTime::GetTimeMiliseconds() const { return (time % 1000); }
|
int AssTime::GetTimeMiliseconds() const { return (time % 1000); }
|
||||||
int AssTime::GetTimeCentiseconds() const { return (time % 1000) / 10; }
|
int AssTime::GetTimeCentiseconds() const { return (time % 1000) / 10; }
|
||||||
|
|
||||||
SmpteFormatter::SmpteFormatter(agi::vfr::Framerate fps, std::string const& sep)
|
SmpteFormatter::SmpteFormatter(agi::vfr::Framerate fps, std::string sep)
|
||||||
: fps(fps)
|
: fps(std::move(fps))
|
||||||
, sep(sep)
|
, sep(std::move(sep))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ class SmpteFormatter {
|
||||||
std::string sep;
|
std::string sep;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SmpteFormatter(agi::vfr::Framerate fps, std::string const& sep=":");
|
SmpteFormatter(agi::vfr::Framerate fps, std::string sep=":");
|
||||||
|
|
||||||
/// Convert an AssTime to a SMPTE timecode
|
/// Convert an AssTime to a SMPTE timecode
|
||||||
std::string ToSMPTE(AssTime time) const;
|
std::string ToSMPTE(AssTime time) const;
|
||||||
|
|
|
@ -105,7 +105,7 @@ AudioBox::AudioBox(wxWindow *parent, agi::Context *context)
|
||||||
wxSizer *VertVolArea = new wxBoxSizer(wxVERTICAL);
|
wxSizer *VertVolArea = new wxBoxSizer(wxVERTICAL);
|
||||||
VertVolArea->Add(VertVol,1,wxEXPAND,0);
|
VertVolArea->Add(VertVol,1,wxEXPAND,0);
|
||||||
|
|
||||||
ToggleBitmap *link_btn = new ToggleBitmap(panel, context, "audio/opt/vertical_link", 16, "Audio", wxSize(20, -1));
|
auto link_btn = new ToggleBitmap(panel, context, "audio/opt/vertical_link", 16, "Audio", wxSize(20, -1));
|
||||||
link_btn->SetMaxSize(wxDefaultSize);
|
link_btn->SetMaxSize(wxDefaultSize);
|
||||||
VertVolArea->Add(link_btn, 0, wxRIGHT | wxALIGN_CENTER | wxEXPAND, 0);
|
VertVolArea->Add(link_btn, 0, wxRIGHT | wxALIGN_CENTER | wxEXPAND, 0);
|
||||||
OPT_SUB("Audio/Link", &AudioBox::OnVerticalLink, this);
|
OPT_SUB("Audio/Link", &AudioBox::OnVerticalLink, this);
|
||||||
|
@ -119,7 +119,7 @@ AudioBox::AudioBox(wxWindow *parent, agi::Context *context)
|
||||||
context->karaoke = new AudioKaraoke(panel, context);
|
context->karaoke = new AudioKaraoke(panel, context);
|
||||||
|
|
||||||
// Main sizer
|
// Main sizer
|
||||||
wxBoxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
|
auto MainSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
MainSizer->Add(TopSizer,1,wxEXPAND|wxALL,3);
|
MainSizer->Add(TopSizer,1,wxEXPAND|wxALL,3);
|
||||||
MainSizer->Add(toolbar::GetToolbar(panel, "audio", context, "Audio"),0,wxEXPAND|wxLEFT|wxRIGHT,3);
|
MainSizer->Add(toolbar::GetToolbar(panel, "audio", context, "Audio"),0,wxEXPAND|wxLEFT|wxRIGHT,3);
|
||||||
MainSizer->Add(context->karaoke,0,wxEXPAND|wxALL,3);
|
MainSizer->Add(context->karaoke,0,wxEXPAND|wxALL,3);
|
||||||
|
|
|
@ -55,7 +55,7 @@ AudioColorScheme::AudioColorScheme(int prec, std::string const& scheme_name, int
|
||||||
case AudioStyle_Inactive: opt_base += "Inactive/"; break;
|
case AudioStyle_Inactive: opt_base += "Inactive/"; break;
|
||||||
case AudioStyle_Selected: opt_base += "Selection/"; break;
|
case AudioStyle_Selected: opt_base += "Selection/"; break;
|
||||||
case AudioStyle_Primary: opt_base += "Primary/"; break;
|
case AudioStyle_Primary: opt_base += "Primary/"; break;
|
||||||
default: throw agi::InternalError("Unknown audio rendering styling", 0);
|
default: throw agi::InternalError("Unknown audio rendering styling", nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
double h_base = OPT_GET(opt_base + "Hue Offset")->GetDouble();
|
double h_base = OPT_GET(opt_base + "Hue Offset")->GetDouble();
|
||||||
|
|
|
@ -155,7 +155,7 @@ void AudioController::OnAudioProviderChanged()
|
||||||
void AudioController::OpenAudio(agi::fs::path const& url)
|
void AudioController::OpenAudio(agi::fs::path const& url)
|
||||||
{
|
{
|
||||||
if (url.empty())
|
if (url.empty())
|
||||||
throw agi::InternalError("AudioController::OpenAudio() was passed an empty string. This must not happen.", 0);
|
throw agi::InternalError("AudioController::OpenAudio() was passed an empty string. This must not happen.", nullptr);
|
||||||
|
|
||||||
std::unique_ptr<AudioProvider> new_provider;
|
std::unique_ptr<AudioProvider> new_provider;
|
||||||
try {
|
try {
|
||||||
|
@ -204,8 +204,8 @@ void AudioController::CloseAudio()
|
||||||
|
|
||||||
player.reset();
|
player.reset();
|
||||||
provider.reset();
|
provider.reset();
|
||||||
player = 0;
|
player = nullptr;
|
||||||
provider = 0;
|
provider = nullptr;
|
||||||
|
|
||||||
audio_url.clear();
|
audio_url.clear();
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ public:
|
||||||
RecalculateThumb();
|
RecalculateThumb();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OnMouseEvent(wxMouseEvent &event)
|
bool OnMouseEvent(wxMouseEvent &event) override
|
||||||
{
|
{
|
||||||
if (event.LeftIsDown())
|
if (event.LeftIsDown())
|
||||||
{
|
{
|
||||||
|
@ -357,7 +357,7 @@ public:
|
||||||
pixel_left = std::max(new_pixel_left, 0);
|
pixel_left = std::max(new_pixel_left, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OnMouseEvent(wxMouseEvent &event)
|
bool OnMouseEvent(wxMouseEvent &event) override
|
||||||
{
|
{
|
||||||
if (event.LeftDown())
|
if (event.LeftDown())
|
||||||
{
|
{
|
||||||
|
@ -475,7 +475,7 @@ class AudioMarkerInteractionObject : public AudioDisplayInteractionObject {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AudioMarkerInteractionObject(std::vector<AudioMarker*> markers, AudioTimingController *timing_controller, AudioDisplay *display, wxMouseButton button_used)
|
AudioMarkerInteractionObject(std::vector<AudioMarker*> markers, AudioTimingController *timing_controller, AudioDisplay *display, wxMouseButton button_used)
|
||||||
: markers(markers)
|
: markers(std::move(markers))
|
||||||
, timing_controller(timing_controller)
|
, timing_controller(timing_controller)
|
||||||
, display(display)
|
, display(display)
|
||||||
, button_used(button_used)
|
, button_used(button_used)
|
||||||
|
@ -484,7 +484,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OnMouseEvent(wxMouseEvent &event)
|
bool OnMouseEvent(wxMouseEvent &event) override
|
||||||
{
|
{
|
||||||
if (event.Dragging())
|
if (event.Dragging())
|
||||||
{
|
{
|
||||||
|
@ -512,7 +512,7 @@ private:
|
||||||
|
|
||||||
void Split(int point)
|
void Split(int point)
|
||||||
{
|
{
|
||||||
iterator it = points.lower_bound(point);
|
auto it = points.lower_bound(point);
|
||||||
if (it == points.end() || it->first != point)
|
if (it == points.end() || it->first != point)
|
||||||
{
|
{
|
||||||
assert(it != points.begin());
|
assert(it != points.begin());
|
||||||
|
@ -523,7 +523,7 @@ private:
|
||||||
void Restyle(int start, int end, AudioRenderingStyle style)
|
void Restyle(int start, int end, AudioRenderingStyle style)
|
||||||
{
|
{
|
||||||
assert(points.lower_bound(end) != points.end());
|
assert(points.lower_bound(end) != points.end());
|
||||||
for (iterator pt = points.lower_bound(start); pt->first < end; ++pt)
|
for (auto pt = points.lower_bound(start); pt->first < end; ++pt)
|
||||||
{
|
{
|
||||||
if (style > pt->second)
|
if (style > pt->second)
|
||||||
pt->second = style;
|
pt->second = style;
|
||||||
|
@ -536,7 +536,7 @@ public:
|
||||||
points[0] = AudioStyle_Normal;
|
points[0] = AudioStyle_Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddRange(int start, int end, AudioRenderingStyle style)
|
void AddRange(int start, int end, AudioRenderingStyle style) override
|
||||||
{
|
{
|
||||||
|
|
||||||
if (start < 0) start = 0;
|
if (start < 0) start = 0;
|
||||||
|
@ -559,7 +559,7 @@ AudioDisplay::AudioDisplay(wxWindow *parent, AudioController *controller, agi::C
|
||||||
, controller(controller)
|
, controller(controller)
|
||||||
, scrollbar(agi::util::make_unique<AudioDisplayScrollbar>(this))
|
, scrollbar(agi::util::make_unique<AudioDisplayScrollbar>(this))
|
||||||
, timeline(agi::util::make_unique<AudioDisplayTimeline>(this))
|
, timeline(agi::util::make_unique<AudioDisplayTimeline>(this))
|
||||||
, dragged_object(0)
|
, dragged_object(nullptr)
|
||||||
, scroll_left(0)
|
, scroll_left(0)
|
||||||
, pixel_audio_width(0)
|
, pixel_audio_width(0)
|
||||||
, ms_per_pixel(0.0)
|
, ms_per_pixel(0.0)
|
||||||
|
@ -1078,7 +1078,7 @@ bool AudioDisplay::ForwardMouseEvent(wxMouseEvent &event) {
|
||||||
if (!dragged_object->OnMouseEvent(event))
|
if (!dragged_object->OnMouseEvent(event))
|
||||||
{
|
{
|
||||||
scroll_timer.Stop();
|
scroll_timer.Stop();
|
||||||
SetDraggedObject(0);
|
SetDraggedObject(nullptr);
|
||||||
SetCursor(wxNullCursor);
|
SetCursor(wxNullCursor);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1087,12 +1087,12 @@ bool AudioDisplay::ForwardMouseEvent(wxMouseEvent &event) {
|
||||||
{
|
{
|
||||||
// Something is wrong, we might have lost capture somehow.
|
// Something is wrong, we might have lost capture somehow.
|
||||||
// Fix state and pretend it didn't happen.
|
// Fix state and pretend it didn't happen.
|
||||||
SetDraggedObject(0);
|
SetDraggedObject(nullptr);
|
||||||
SetCursor(wxNullCursor);
|
SetCursor(wxNullCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxPoint mousepos = event.GetPosition();
|
const wxPoint mousepos = event.GetPosition();
|
||||||
AudioDisplayInteractionObject *new_obj = 0;
|
AudioDisplayInteractionObject *new_obj = nullptr;
|
||||||
// Check for scrollbar action
|
// Check for scrollbar action
|
||||||
if (scrollbar->GetBounds().Contains(mousepos))
|
if (scrollbar->GetBounds().Contains(mousepos))
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
|
|
||||||
template<class Container, class Value>
|
template<class Container, class Value>
|
||||||
static inline size_t last_lt_or_eq(Container const& c, Value const& v) {
|
static inline size_t last_lt_or_eq(Container const& c, Value const& v) {
|
||||||
typename Container::const_iterator it = lower_bound(c.begin(), c.end(), v);
|
auto it = lower_bound(c.begin(), c.end(), v);
|
||||||
// lower_bound gives first >=
|
// lower_bound gives first >=
|
||||||
if (it == c.end() || *it > v)
|
if (it == c.end() || *it > v)
|
||||||
--it;
|
--it;
|
||||||
|
@ -137,7 +137,7 @@ void AudioKaraoke::OnAudioOpened() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioKaraoke::OnAudioClosed() {
|
void AudioKaraoke::OnAudioClosed() {
|
||||||
c->audioController->SetTimingController(0);
|
c->audioController->SetTimingController(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioKaraoke::SetEnabled(bool en) {
|
void AudioKaraoke::SetEnabled(bool en) {
|
||||||
|
@ -236,8 +236,8 @@ void AudioKaraoke::RenderText() {
|
||||||
|
|
||||||
// Draw the lines between each syllable
|
// Draw the lines between each syllable
|
||||||
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
|
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
|
||||||
for (size_t i = 0; i < syl_lines.size(); ++i)
|
for (auto syl_line : syl_lines)
|
||||||
dc.DrawLine(syl_lines[i], 0, syl_lines[i], bmp_size.GetHeight());
|
dc.DrawLine(syl_line, 0, syl_line, bmp_size.GetHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioKaraoke::AddMenuItem(wxMenu &menu, std::string const& tag, wxString const& help, std::string const& selected) {
|
void AudioKaraoke::AddMenuItem(wxMenu &menu, std::string const& tag, wxString const& help, std::string const& selected) {
|
||||||
|
|
|
@ -37,10 +37,10 @@ class AudioMarkerKeyframe : public AudioMarker {
|
||||||
int position;
|
int position;
|
||||||
public:
|
public:
|
||||||
AudioMarkerKeyframe(Pen *style, int position) : style(style), position(position) { }
|
AudioMarkerKeyframe(Pen *style, int position) : style(style), position(position) { }
|
||||||
int GetPosition() const { return position; }
|
int GetPosition() const override { return position; }
|
||||||
FeetStyle GetFeet() const { return Feet_None; }
|
FeetStyle GetFeet() const override { return Feet_None; }
|
||||||
bool CanSnap() const { return true; }
|
bool CanSnap() const override { return true; }
|
||||||
wxPen GetStyle() const { return *style; }
|
wxPen GetStyle() const override { return *style; }
|
||||||
operator int() const { return position; }
|
operator int() const { return position; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -99,10 +99,10 @@ public:
|
||||||
|
|
||||||
void SetPosition(int new_pos) { position = new_pos; }
|
void SetPosition(int new_pos) { position = new_pos; }
|
||||||
|
|
||||||
int GetPosition() const { return position; }
|
int GetPosition() const override { return position; }
|
||||||
FeetStyle GetFeet() const { return Feet_None; }
|
FeetStyle GetFeet() const override { return Feet_None; }
|
||||||
bool CanSnap() const { return true; }
|
bool CanSnap() const override { return true; }
|
||||||
wxPen GetStyle() const { return style; }
|
wxPen GetStyle() const override { return style; }
|
||||||
operator int() const { return position; }
|
operator int() const { return position; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ public:
|
||||||
/// Get all keyframe markers within a range
|
/// Get all keyframe markers within a range
|
||||||
/// @param range Time range to get markers for
|
/// @param range Time range to get markers for
|
||||||
/// @param[out] out Vector to fill with markers in the range
|
/// @param[out] out Vector to fill with markers in the range
|
||||||
void GetMarkers(TimeRange const& range, AudioMarkerVector &out) const;
|
void GetMarkers(TimeRange const& range, AudioMarkerVector &out) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Marker provider for the current video playback position
|
/// Marker provider for the current video playback position
|
||||||
|
@ -170,7 +170,7 @@ public:
|
||||||
VideoPositionMarkerProvider(agi::Context *c);
|
VideoPositionMarkerProvider(agi::Context *c);
|
||||||
~VideoPositionMarkerProvider();
|
~VideoPositionMarkerProvider();
|
||||||
|
|
||||||
void GetMarkers(const TimeRange &range, AudioMarkerVector &out) const;
|
void GetMarkers(const TimeRange &range, AudioMarkerVector &out) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Marker provider for lines every second
|
/// Marker provider for lines every second
|
||||||
|
@ -180,10 +180,10 @@ class SecondsMarkerProvider : public AudioMarkerProvider {
|
||||||
int position;
|
int position;
|
||||||
|
|
||||||
Marker(Pen *style) : style(style), position(0) { }
|
Marker(Pen *style) : style(style), position(0) { }
|
||||||
int GetPosition() const { return position; }
|
int GetPosition() const override { return position; }
|
||||||
FeetStyle GetFeet() const { return Feet_None; }
|
FeetStyle GetFeet() const override { return Feet_None; }
|
||||||
bool CanSnap() const { return false; }
|
bool CanSnap() const override { return false; }
|
||||||
wxPen GetStyle() const;
|
wxPen GetStyle() const override;
|
||||||
operator int() const { return position; }
|
operator int() const { return position; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -203,5 +203,5 @@ class SecondsMarkerProvider : public AudioMarkerProvider {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SecondsMarkerProvider();
|
SecondsMarkerProvider();
|
||||||
void GetMarkers(TimeRange const& range, AudioMarkerVector &out) const;
|
void GetMarkers(TimeRange const& range, AudioMarkerVector &out) const override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -53,7 +53,7 @@ AudioPlayer::AudioPlayer(AudioProvider *provider)
|
||||||
|
|
||||||
std::unique_ptr<AudioPlayer> AudioPlayerFactory::GetAudioPlayer(AudioProvider *provider) {
|
std::unique_ptr<AudioPlayer> AudioPlayerFactory::GetAudioPlayer(AudioProvider *provider) {
|
||||||
std::vector<std::string> list = GetClasses(OPT_GET("Audio/Player")->GetString());
|
std::vector<std::string> list = GetClasses(OPT_GET("Audio/Player")->GetString());
|
||||||
if (list.empty()) throw agi::NoAudioPlayersError("No audio players are available.", 0);
|
if (list.empty()) throw agi::NoAudioPlayersError("No audio players are available.", nullptr);
|
||||||
|
|
||||||
std::string error;
|
std::string error;
|
||||||
for (auto const& factory_name : list) {
|
for (auto const& factory_name : list) {
|
||||||
|
@ -64,7 +64,7 @@ std::unique_ptr<AudioPlayer> AudioPlayerFactory::GetAudioPlayer(AudioProvider *p
|
||||||
error += factory_name + " factory: " + err.GetChainedMessage() + "\n";
|
error += factory_name + " factory: " + err.GetChainedMessage() + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw agi::AudioPlayerOpenError(error, 0);
|
throw agi::AudioPlayerOpenError(error, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioPlayerFactory::RegisterProviders() {
|
void AudioPlayerFactory::RegisterProviders() {
|
||||||
|
|
|
@ -59,8 +59,8 @@ OpenALPlayer::OpenALPlayer(AudioProvider *provider)
|
||||||
, start_frame(0)
|
, start_frame(0)
|
||||||
, cur_frame(0)
|
, cur_frame(0)
|
||||||
, end_frame(0)
|
, end_frame(0)
|
||||||
, device(0)
|
, device(nullptr)
|
||||||
, context(0)
|
, context(nullptr)
|
||||||
, source(0)
|
, source(0)
|
||||||
, buf_first_free(0)
|
, buf_first_free(0)
|
||||||
, buf_first_queued(0)
|
, buf_first_queued(0)
|
||||||
|
@ -69,26 +69,26 @@ OpenALPlayer::OpenALPlayer(AudioProvider *provider)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// Open device
|
// Open device
|
||||||
device = alcOpenDevice(0);
|
device = alcOpenDevice(nullptr);
|
||||||
if (!device) throw OpenALException("Failed opening default OpenAL device", 0);
|
if (!device) throw OpenALException("Failed opening default OpenAL device", nullptr);
|
||||||
|
|
||||||
// Create context
|
// Create context
|
||||||
context = alcCreateContext(device, 0);
|
context = alcCreateContext(device, nullptr);
|
||||||
if (!context) throw OpenALException("Failed creating OpenAL context", 0);
|
if (!context) throw OpenALException("Failed creating OpenAL context", nullptr);
|
||||||
if (!alcMakeContextCurrent(context)) throw OpenALException("Failed selecting OpenAL context", 0);
|
if (!alcMakeContextCurrent(context)) throw OpenALException("Failed selecting OpenAL context", nullptr);
|
||||||
|
|
||||||
// Clear error code
|
// Clear error code
|
||||||
alGetError();
|
alGetError();
|
||||||
|
|
||||||
// Generate buffers
|
// Generate buffers
|
||||||
alGenBuffers(num_buffers, buffers);
|
alGenBuffers(num_buffers, buffers);
|
||||||
if (alGetError() != AL_NO_ERROR) throw OpenALException("Error generating OpenAL buffers", 0);
|
if (alGetError() != AL_NO_ERROR) throw OpenALException("Error generating OpenAL buffers", nullptr);
|
||||||
|
|
||||||
// Generate source
|
// Generate source
|
||||||
alGenSources(1, &source);
|
alGenSources(1, &source);
|
||||||
if (alGetError() != AL_NO_ERROR) {
|
if (alGetError() != AL_NO_ERROR) {
|
||||||
alDeleteBuffers(num_buffers, buffers);
|
alDeleteBuffers(num_buffers, buffers);
|
||||||
throw OpenALException("Error generating OpenAL source", 0);
|
throw OpenALException("Error generating OpenAL source", nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
|
|
|
@ -92,20 +92,20 @@ class OpenALPlayer : public AudioPlayer, wxTimer {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// wxTimer override to periodically fill available buffers
|
/// wxTimer override to periodically fill available buffers
|
||||||
void Notify();
|
void Notify() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OpenALPlayer(AudioProvider *provider);
|
OpenALPlayer(AudioProvider *provider);
|
||||||
~OpenALPlayer();
|
~OpenALPlayer();
|
||||||
|
|
||||||
void Play(int64_t start,int64_t count);
|
void Play(int64_t start,int64_t count) override;
|
||||||
void Stop();
|
void Stop() override;
|
||||||
bool IsPlaying() { return playing; }
|
bool IsPlaying() override { return playing; }
|
||||||
|
|
||||||
int64_t GetEndPosition() { return end_frame; }
|
int64_t GetEndPosition() override { return end_frame; }
|
||||||
int64_t GetCurrentPosition();
|
int64_t GetCurrentPosition() override;
|
||||||
void SetEndPosition(int64_t pos);
|
void SetEndPosition(int64_t pos) override;
|
||||||
|
|
||||||
void SetVolume(double vol) { volume = vol; }
|
void SetVolume(double vol) override { volume = vol; }
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -59,7 +59,7 @@ void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count,
|
||||||
|
|
||||||
if (volume == 1.0) return;
|
if (volume == 1.0) return;
|
||||||
if (bytes_per_sample != 2)
|
if (bytes_per_sample != 2)
|
||||||
throw agi::InternalError("GetAudioWithVolume called on unconverted audio stream", 0);
|
throw agi::InternalError("GetAudioWithVolume called on unconverted audio stream", nullptr);
|
||||||
|
|
||||||
short *buffer = static_cast<int16_t *>(buf);
|
short *buffer = static_cast<int16_t *>(buf);
|
||||||
for (size_t i = 0; i < (size_t)count; ++i)
|
for (size_t i = 0; i < (size_t)count; ++i)
|
||||||
|
@ -159,7 +159,7 @@ std::unique_ptr<AudioProvider> AudioProviderFactory::GetProvider(agi::fs::path c
|
||||||
|
|
||||||
if (!provider) {
|
if (!provider) {
|
||||||
std::vector<std::string> list = GetClasses(OPT_GET("Audio/Provider")->GetString());
|
std::vector<std::string> list = GetClasses(OPT_GET("Audio/Provider")->GetString());
|
||||||
if (list.empty()) throw agi::NoAudioProvidersError("No audio providers are available.", 0);
|
if (list.empty()) throw agi::NoAudioProvidersError("No audio providers are available.", nullptr);
|
||||||
|
|
||||||
for (auto const& name : list) {
|
for (auto const& name : list) {
|
||||||
provider = creator.try_create(name, [&]() { return Create(name, filename); });
|
provider = creator.try_create(name, [&]() { return Create(name, filename); });
|
||||||
|
@ -169,9 +169,9 @@ std::unique_ptr<AudioProvider> AudioProviderFactory::GetProvider(agi::fs::path c
|
||||||
|
|
||||||
if (!provider) {
|
if (!provider) {
|
||||||
if (creator.found_audio)
|
if (creator.found_audio)
|
||||||
throw agi::AudioProviderOpenError(creator.msg, 0);
|
throw agi::AudioProviderOpenError(creator.msg, nullptr);
|
||||||
if (creator.found_file)
|
if (creator.found_file)
|
||||||
throw agi::AudioDataNotFoundError(creator.msg, 0);
|
throw agi::AudioDataNotFoundError(creator.msg, nullptr);
|
||||||
throw agi::fs::FileNotFound(filename);
|
throw agi::fs::FileNotFound(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ std::unique_ptr<AudioProvider> AudioProviderFactory::GetProvider(agi::fs::path c
|
||||||
// Convert to HD
|
// Convert to HD
|
||||||
if (cache == 2) return agi::util::make_unique<HDAudioProvider>(std::move(provider), &progress);
|
if (cache == 2) return agi::util::make_unique<HDAudioProvider>(std::move(provider), &progress);
|
||||||
|
|
||||||
throw agi::AudioCacheOpenError("Unknown caching method", 0);
|
throw agi::AudioCacheOpenError("Unknown caching method", nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioProviderFactory::RegisterProviders() {
|
void AudioProviderFactory::RegisterProviders() {
|
||||||
|
|
|
@ -38,13 +38,13 @@ class BitdepthConvertAudioProvider : public AudioProviderWrapper {
|
||||||
public:
|
public:
|
||||||
BitdepthConvertAudioProvider(std::unique_ptr<AudioProvider> src) : AudioProviderWrapper(std::move(src)) {
|
BitdepthConvertAudioProvider(std::unique_ptr<AudioProvider> src) : AudioProviderWrapper(std::move(src)) {
|
||||||
if (bytes_per_sample > 8)
|
if (bytes_per_sample > 8)
|
||||||
throw agi::AudioProviderOpenError("Audio format converter: audio with bitdepths greater than 64 bits/sample is currently unsupported", 0);
|
throw agi::AudioProviderOpenError("Audio format converter: audio with bitdepths greater than 64 bits/sample is currently unsupported", nullptr);
|
||||||
|
|
||||||
src_bytes_per_sample = bytes_per_sample;
|
src_bytes_per_sample = bytes_per_sample;
|
||||||
bytes_per_sample = sizeof(Target);
|
bytes_per_sample = sizeof(Target);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FillBuffer(void *buf, int64_t start, int64_t count) const {
|
void FillBuffer(void *buf, int64_t start, int64_t count) const override {
|
||||||
std::vector<char> src_buf(count * src_bytes_per_sample * channels);
|
std::vector<char> src_buf(count * src_bytes_per_sample * channels);
|
||||||
source->GetAudio(&src_buf[0], start, count);
|
source->GetAudio(&src_buf[0], start, count);
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public:
|
||||||
float_samples = false;
|
float_samples = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FillBuffer(void *buf, int64_t start, int64_t count) const {
|
void FillBuffer(void *buf, int64_t start, int64_t count) const override {
|
||||||
std::vector<Source> src_buf(count * channels);
|
std::vector<Source> src_buf(count * channels);
|
||||||
source->GetAudio(&src_buf[0], start, count);
|
source->GetAudio(&src_buf[0], start, count);
|
||||||
|
|
||||||
|
@ -110,14 +110,14 @@ class DownmixAudioProvider : public AudioProviderWrapper {
|
||||||
public:
|
public:
|
||||||
DownmixAudioProvider(std::unique_ptr<AudioProvider> src) : AudioProviderWrapper(std::move(src)) {
|
DownmixAudioProvider(std::unique_ptr<AudioProvider> src) : AudioProviderWrapper(std::move(src)) {
|
||||||
if (bytes_per_sample != 2)
|
if (bytes_per_sample != 2)
|
||||||
throw agi::InternalError("DownmixAudioProvider requires 16-bit input", 0);
|
throw agi::InternalError("DownmixAudioProvider requires 16-bit input", nullptr);
|
||||||
if (channels == 1)
|
if (channels == 1)
|
||||||
throw agi::InternalError("DownmixAudioProvider requires multi-channel input", 0);
|
throw agi::InternalError("DownmixAudioProvider requires multi-channel input", nullptr);
|
||||||
src_channels = channels;
|
src_channels = channels;
|
||||||
channels = 1;
|
channels = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FillBuffer(void *buf, int64_t start, int64_t count) const {
|
void FillBuffer(void *buf, int64_t start, int64_t count) const override {
|
||||||
if (count == 0) return;
|
if (count == 0) return;
|
||||||
|
|
||||||
std::vector<int16_t> src_buf(count * src_channels);
|
std::vector<int16_t> src_buf(count * src_channels);
|
||||||
|
@ -140,15 +140,15 @@ class SampleDoublingAudioProvider : public AudioProviderWrapper {
|
||||||
public:
|
public:
|
||||||
SampleDoublingAudioProvider(std::unique_ptr<AudioProvider> src) : AudioProviderWrapper(std::move(src)) {
|
SampleDoublingAudioProvider(std::unique_ptr<AudioProvider> src) : AudioProviderWrapper(std::move(src)) {
|
||||||
if (source->GetBytesPerSample() != 2)
|
if (source->GetBytesPerSample() != 2)
|
||||||
throw agi::InternalError("UpsampleAudioProvider requires 16-bit input", 0);
|
throw agi::InternalError("UpsampleAudioProvider requires 16-bit input", nullptr);
|
||||||
if (source->GetChannels() != 1)
|
if (source->GetChannels() != 1)
|
||||||
throw agi::InternalError("UpsampleAudioProvider requires mono input", 0);
|
throw agi::InternalError("UpsampleAudioProvider requires mono input", nullptr);
|
||||||
|
|
||||||
sample_rate *= 2;
|
sample_rate *= 2;
|
||||||
num_samples *= 2;
|
num_samples *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FillBuffer(void *buf, int64_t start, int64_t count) const {
|
void FillBuffer(void *buf, int64_t start, int64_t count) const override {
|
||||||
if (count == 0) return;
|
if (count == 0) return;
|
||||||
|
|
||||||
int not_end = start + count < num_samples;
|
int not_end = start + count < num_samples;
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
class DummyAudioProvider : public AudioProvider {
|
class DummyAudioProvider : public AudioProvider {
|
||||||
bool noise;
|
bool noise;
|
||||||
void FillBuffer(void *buf, int64_t start, int64_t count) const;
|
void FillBuffer(void *buf, int64_t start, int64_t count) const override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DummyAudioProvider(agi::fs::path const& uri);
|
DummyAudioProvider(agi::fs::path const& uri);
|
||||||
|
|
|
@ -58,10 +58,10 @@ FFmpegSourceAudioProvider::FFmpegSourceAudioProvider(agi::fs::path const& filena
|
||||||
LoadAudio(filename);
|
LoadAudio(filename);
|
||||||
}
|
}
|
||||||
catch (std::string const& err) {
|
catch (std::string const& err) {
|
||||||
throw agi::AudioProviderOpenError(err, 0);
|
throw agi::AudioProviderOpenError(err, nullptr);
|
||||||
}
|
}
|
||||||
catch (const char *err) {
|
catch (const char *err) {
|
||||||
throw agi::AudioProviderOpenError(err, 0);
|
throw agi::AudioProviderOpenError(err, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FFmpegSourceAudioProvider::LoadAudio(agi::fs::path const& filename) {
|
void FFmpegSourceAudioProvider::LoadAudio(agi::fs::path const& filename) {
|
||||||
|
@ -70,12 +70,12 @@ void FFmpegSourceAudioProvider::LoadAudio(agi::fs::path const& filename) {
|
||||||
if (ErrInfo.SubType == FFMS_ERROR_FILE_READ)
|
if (ErrInfo.SubType == FFMS_ERROR_FILE_READ)
|
||||||
throw agi::fs::FileNotFound(std::string(ErrInfo.Buffer));
|
throw agi::fs::FileNotFound(std::string(ErrInfo.Buffer));
|
||||||
else
|
else
|
||||||
throw agi::AudioDataNotFoundError(ErrInfo.Buffer, 0);
|
throw agi::AudioDataNotFoundError(ErrInfo.Buffer, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<int, std::string> TrackList = GetTracksOfType(Indexer, FFMS_TYPE_AUDIO);
|
std::map<int, std::string> TrackList = GetTracksOfType(Indexer, FFMS_TYPE_AUDIO);
|
||||||
if (TrackList.empty())
|
if (TrackList.empty())
|
||||||
throw agi::AudioDataNotFoundError("no audio tracks found", 0);
|
throw agi::AudioDataNotFoundError("no audio tracks found", nullptr);
|
||||||
|
|
||||||
// initialize the track number to an invalid value so we can detect later on
|
// initialize the track number to an invalid value so we can detect later on
|
||||||
// whether the user actually had to choose a track or not
|
// whether the user actually had to choose a track or not
|
||||||
|
@ -103,7 +103,7 @@ void FFmpegSourceAudioProvider::LoadAudio(agi::fs::path const& filename) {
|
||||||
if (TrackNumber < 0)
|
if (TrackNumber < 0)
|
||||||
TrackNumber = FFMS_GetFirstTrackOfType(Index, FFMS_TYPE_AUDIO, &ErrInfo);
|
TrackNumber = FFMS_GetFirstTrackOfType(Index, FFMS_TYPE_AUDIO, &ErrInfo);
|
||||||
if (TrackNumber < 0)
|
if (TrackNumber < 0)
|
||||||
throw agi::AudioDataNotFoundError(std::string("Couldn't find any audio tracks: ") + ErrInfo.Buffer, 0);
|
throw agi::AudioDataNotFoundError(std::string("Couldn't find any audio tracks: ") + ErrInfo.Buffer, nullptr);
|
||||||
|
|
||||||
// index is valid and track number is now set,
|
// index is valid and track number is now set,
|
||||||
// but do we have indexing info for the desired audio track?
|
// but do we have indexing info for the desired audio track?
|
||||||
|
@ -145,7 +145,7 @@ void FFmpegSourceAudioProvider::LoadAudio(agi::fs::path const& filename) {
|
||||||
|
|
||||||
AudioSource = FFMS_CreateAudioSource(filename.string().c_str(), TrackNumber, Index, -1, &ErrInfo);
|
AudioSource = FFMS_CreateAudioSource(filename.string().c_str(), TrackNumber, Index, -1, &ErrInfo);
|
||||||
if (!AudioSource)
|
if (!AudioSource)
|
||||||
throw agi::AudioProviderOpenError(std::string("Failed to open audio track: ") + ErrInfo.Buffer, 0);
|
throw agi::AudioProviderOpenError(std::string("Failed to open audio track: ") + ErrInfo.Buffer, nullptr);
|
||||||
|
|
||||||
const FFMS_AudioProperties AudioInfo = *FFMS_GetAudioProperties(AudioSource);
|
const FFMS_AudioProperties AudioInfo = *FFMS_GetAudioProperties(AudioSource);
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ void FFmpegSourceAudioProvider::LoadAudio(agi::fs::path const& filename) {
|
||||||
sample_rate = AudioInfo.SampleRate;
|
sample_rate = AudioInfo.SampleRate;
|
||||||
num_samples = AudioInfo.NumSamples;
|
num_samples = AudioInfo.NumSamples;
|
||||||
if (channels <= 0 || sample_rate <= 0 || num_samples <= 0)
|
if (channels <= 0 || sample_rate <= 0 || num_samples <= 0)
|
||||||
throw agi::AudioProviderOpenError("sanity check failed, consult your local psychiatrist", 0);
|
throw agi::AudioProviderOpenError("sanity check failed, consult your local psychiatrist", nullptr);
|
||||||
|
|
||||||
switch (AudioInfo.SampleFormat) {
|
switch (AudioInfo.SampleFormat) {
|
||||||
case FFMS_FMT_U8: bytes_per_sample = 1; float_samples = false; break;
|
case FFMS_FMT_U8: bytes_per_sample = 1; float_samples = false; break;
|
||||||
|
@ -162,7 +162,7 @@ void FFmpegSourceAudioProvider::LoadAudio(agi::fs::path const& filename) {
|
||||||
case FFMS_FMT_FLT: bytes_per_sample = 4; float_samples = true; break;
|
case FFMS_FMT_FLT: bytes_per_sample = 4; float_samples = true; break;
|
||||||
case FFMS_FMT_DBL: bytes_per_sample = 8; float_samples = true; break;
|
case FFMS_FMT_DBL: bytes_per_sample = 8; float_samples = true; break;
|
||||||
default:
|
default:
|
||||||
throw agi::AudioProviderOpenError("unknown or unsupported sample format", 0);
|
throw agi::AudioProviderOpenError("unknown or unsupported sample format", nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FFMS_VERSION >= ((2 << 24) | (17 << 16) | (4 << 8) | 0)
|
#if FFMS_VERSION >= ((2 << 24) | (17 << 16) | (4 << 8) | 0)
|
||||||
|
|
|
@ -47,11 +47,11 @@ class FFmpegSourceAudioProvider : public AudioProvider, FFmpegSourceProvider {
|
||||||
mutable FFMS_ErrorInfo ErrInfo; ///< FFMS error codes/messages
|
mutable FFMS_ErrorInfo ErrInfo; ///< FFMS error codes/messages
|
||||||
|
|
||||||
void LoadAudio(agi::fs::path const& filename);
|
void LoadAudio(agi::fs::path const& filename);
|
||||||
void FillBuffer(void *buf, int64_t start, int64_t count) const;
|
void FillBuffer(void *buf, int64_t start, int64_t count) const override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FFmpegSourceAudioProvider(agi::fs::path const& filename);
|
FFmpegSourceAudioProvider(agi::fs::path const& filename);
|
||||||
|
|
||||||
bool NeedsCache() const { return true; }
|
bool NeedsCache() const override { return true; }
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -95,7 +95,7 @@ HDAudioProvider::HDAudioProvider(std::unique_ptr<AudioProvider> src, agi::Backgr
|
||||||
{
|
{
|
||||||
// Check free space
|
// Check free space
|
||||||
if ((uint64_t)num_samples * channels * bytes_per_sample > agi::fs::FreeSpace(cache_dir()))
|
if ((uint64_t)num_samples * channels * bytes_per_sample > agi::fs::FreeSpace(cache_dir()))
|
||||||
throw agi::AudioCacheOpenError("Not enough free disk space in " + cache_dir().string() + " to cache the audio", 0);
|
throw agi::AudioCacheOpenError("Not enough free disk space in " + cache_dir().string() + " to cache the audio", nullptr);
|
||||||
|
|
||||||
diskCacheFilename = cache_path();
|
diskCacheFilename = cache_path();
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class HDAudioProvider : public AudioProviderWrapper {
|
||||||
/// @param ps Sink for progress reporting
|
/// @param ps Sink for progress reporting
|
||||||
void FillCache(AudioProvider *src, std::ofstream *file, agi::ProgressSink *ps);
|
void FillCache(AudioProvider *src, std::ofstream *file, agi::ProgressSink *ps);
|
||||||
|
|
||||||
void FillBuffer(void *buf, int64_t start, int64_t count) const;
|
void FillBuffer(void *buf, int64_t start, int64_t count) const override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HDAudioProvider(std::unique_ptr<AudioProvider> source, agi::BackgroundRunner *br);
|
HDAudioProvider(std::unique_ptr<AudioProvider> source, agi::BackgroundRunner *br);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
class LockAudioProvider : public AudioProviderWrapper {
|
class LockAudioProvider : public AudioProviderWrapper {
|
||||||
mutable std::mutex mutex;
|
mutable std::mutex mutex;
|
||||||
|
|
||||||
void FillBuffer(void *buf, int64_t start, int64_t count) const;
|
void FillBuffer(void *buf, int64_t start, int64_t count) const override;
|
||||||
public:
|
public:
|
||||||
LockAudioProvider(std::unique_ptr<AudioProvider> source);
|
LockAudioProvider(std::unique_ptr<AudioProvider> source);
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PCMAudioProvider::PCMAudioProvider(agi::fs::path const& filename)
|
PCMAudioProvider::PCMAudioProvider(agi::fs::path const& filename)
|
||||||
: current_mapping(0)
|
: current_mapping(nullptr)
|
||||||
, mapping_start(0)
|
, mapping_start(0)
|
||||||
, mapping_length(0)
|
, mapping_length(0)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -154,7 +154,7 @@ char * PCMAudioProvider::EnsureRangeAccessible(int64_t range_start, int64_t rang
|
||||||
mapping_start_li.LowPart, // Offset low-part
|
mapping_start_li.LowPart, // Offset low-part
|
||||||
mapping_length); // Length of view
|
mapping_length); // Length of view
|
||||||
#else
|
#else
|
||||||
current_mapping = mmap(0, mapping_length, PROT_READ, MAP_PRIVATE, file_handle, mapping_start);
|
current_mapping = mmap(nullptr, mapping_length, PROT_READ, MAP_PRIVATE, file_handle, mapping_start);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!current_mapping)
|
if (!current_mapping)
|
||||||
|
@ -263,9 +263,9 @@ public:
|
||||||
|
|
||||||
// Check magic values
|
// Check magic values
|
||||||
if (!CheckFourcc(header.ch.type, "RIFF"))
|
if (!CheckFourcc(header.ch.type, "RIFF"))
|
||||||
throw agi::AudioDataNotFoundError("File is not a RIFF file", 0);
|
throw agi::AudioDataNotFoundError("File is not a RIFF file", nullptr);
|
||||||
if (!CheckFourcc(header.format, "WAVE"))
|
if (!CheckFourcc(header.format, "WAVE"))
|
||||||
throw agi::AudioDataNotFoundError("File is not a RIFF WAV file", 0);
|
throw agi::AudioDataNotFoundError("File is not a RIFF WAV file", nullptr);
|
||||||
|
|
||||||
// Count how much more data we can have in the entire file
|
// Count how much more data we can have in the entire file
|
||||||
// The first 4 bytes are already eaten by the header.format field
|
// The first 4 bytes are already eaten by the header.format field
|
||||||
|
@ -288,13 +288,13 @@ public:
|
||||||
filepos += sizeof(ch);
|
filepos += sizeof(ch);
|
||||||
|
|
||||||
if (CheckFourcc(ch.type, "fmt ")) {
|
if (CheckFourcc(ch.type, "fmt ")) {
|
||||||
if (got_fmt_header) throw agi::AudioProviderOpenError("Invalid file, multiple 'fmt ' chunks", 0);
|
if (got_fmt_header) throw agi::AudioProviderOpenError("Invalid file, multiple 'fmt ' chunks", nullptr);
|
||||||
got_fmt_header = true;
|
got_fmt_header = true;
|
||||||
|
|
||||||
fmtChunk &fmt = *(fmtChunk*)EnsureRangeAccessible(filepos, sizeof(fmtChunk));
|
fmtChunk &fmt = *(fmtChunk*)EnsureRangeAccessible(filepos, sizeof(fmtChunk));
|
||||||
|
|
||||||
if (fmt.compression != 1)
|
if (fmt.compression != 1)
|
||||||
throw agi::AudioProviderOpenError("Can't use file, not PCM encoding", 0);
|
throw agi::AudioProviderOpenError("Can't use file, not PCM encoding", nullptr);
|
||||||
|
|
||||||
// Set stuff inherited from the AudioProvider class
|
// Set stuff inherited from the AudioProvider class
|
||||||
sample_rate = fmt.samplerate;
|
sample_rate = fmt.samplerate;
|
||||||
|
@ -306,7 +306,7 @@ public:
|
||||||
// This won't pick up 'data' chunks inside 'wavl' chunks
|
// This won't pick up 'data' chunks inside 'wavl' chunks
|
||||||
// since the 'wavl' chunks wrap those.
|
// since the 'wavl' chunks wrap those.
|
||||||
|
|
||||||
if (!got_fmt_header) throw agi::AudioProviderOpenError("Found 'data' chunk before 'fmt ' chunk, file is invalid.", 0);
|
if (!got_fmt_header) throw agi::AudioProviderOpenError("Found 'data' chunk before 'fmt ' chunk, file is invalid.", nullptr);
|
||||||
|
|
||||||
int64_t samples = ch.size / bytes_per_sample;
|
int64_t samples = ch.size / bytes_per_sample;
|
||||||
int64_t frames = samples / channels;
|
int64_t frames = samples / channels;
|
||||||
|
@ -400,7 +400,7 @@ public:
|
||||||
int64_t smallest_possible_file = sizeof(RiffChunk) + sizeof(FormatChunk) + sizeof(DataChunk);
|
int64_t smallest_possible_file = sizeof(RiffChunk) + sizeof(FormatChunk) + sizeof(DataChunk);
|
||||||
|
|
||||||
if (file_size < smallest_possible_file)
|
if (file_size < smallest_possible_file)
|
||||||
throw agi::AudioDataNotFoundError("File is too small to be a Wave64 file", 0);
|
throw agi::AudioDataNotFoundError("File is too small to be a Wave64 file", nullptr);
|
||||||
|
|
||||||
// Read header
|
// Read header
|
||||||
// This should throw an exception if the mapping fails
|
// This should throw an exception if the mapping fails
|
||||||
|
@ -410,9 +410,9 @@ public:
|
||||||
|
|
||||||
// Check magic values
|
// Check magic values
|
||||||
if (!CheckGuid(header.riff_guid, w64GuidRIFF))
|
if (!CheckGuid(header.riff_guid, w64GuidRIFF))
|
||||||
throw agi::AudioDataNotFoundError("File is not a Wave64 RIFF file", 0);
|
throw agi::AudioDataNotFoundError("File is not a Wave64 RIFF file", nullptr);
|
||||||
if (!CheckGuid(header.format_guid, w64GuidWAVE))
|
if (!CheckGuid(header.format_guid, w64GuidWAVE))
|
||||||
throw agi::AudioDataNotFoundError("File is not a Wave64 WAVE file", 0);
|
throw agi::AudioDataNotFoundError("File is not a Wave64 WAVE file", nullptr);
|
||||||
|
|
||||||
// Count how much more data we can have in the entire file
|
// Count how much more data we can have in the entire file
|
||||||
uint64_t data_left = header.file_size - sizeof(RiffChunk);
|
uint64_t data_left = header.file_size - sizeof(RiffChunk);
|
||||||
|
@ -432,15 +432,15 @@ public:
|
||||||
|
|
||||||
if (CheckGuid(chunk_guid, w64Guidfmt)) {
|
if (CheckGuid(chunk_guid, w64Guidfmt)) {
|
||||||
if (got_fmt_header)
|
if (got_fmt_header)
|
||||||
throw agi::AudioProviderOpenError("Bad file, found more than one 'fmt' chunk", 0);
|
throw agi::AudioProviderOpenError("Bad file, found more than one 'fmt' chunk", nullptr);
|
||||||
|
|
||||||
FormatChunk &fmt = *(FormatChunk*)EnsureRangeAccessible(filepos, sizeof(FormatChunk));
|
FormatChunk &fmt = *(FormatChunk*)EnsureRangeAccessible(filepos, sizeof(FormatChunk));
|
||||||
got_fmt_header = true;
|
got_fmt_header = true;
|
||||||
|
|
||||||
if (fmt.format.wFormatTag == 3)
|
if (fmt.format.wFormatTag == 3)
|
||||||
throw agi::AudioProviderOpenError("File is IEEE 32 bit float format which isn't supported. Bug the developers if this matters.", 0);
|
throw agi::AudioProviderOpenError("File is IEEE 32 bit float format which isn't supported. Bug the developers if this matters.", nullptr);
|
||||||
if (fmt.format.wFormatTag != 1)
|
if (fmt.format.wFormatTag != 1)
|
||||||
throw agi::AudioProviderOpenError("Can't use file, not PCM encoding", 0);
|
throw agi::AudioProviderOpenError("Can't use file, not PCM encoding", nullptr);
|
||||||
|
|
||||||
// Set stuff inherited from the AudioProvider class
|
// Set stuff inherited from the AudioProvider class
|
||||||
sample_rate = fmt.format.nSamplesPerSec;
|
sample_rate = fmt.format.nSamplesPerSec;
|
||||||
|
@ -449,7 +449,7 @@ public:
|
||||||
}
|
}
|
||||||
else if (CheckGuid(chunk_guid, w64Guiddata)) {
|
else if (CheckGuid(chunk_guid, w64Guiddata)) {
|
||||||
if (!got_fmt_header)
|
if (!got_fmt_header)
|
||||||
throw agi::AudioProviderOpenError("Found 'data' chunk before 'fmt ' chunk, file is invalid.", 0);
|
throw agi::AudioProviderOpenError("Found 'data' chunk before 'fmt ' chunk, file is invalid.", nullptr);
|
||||||
|
|
||||||
int64_t samples = chunk_size / bytes_per_sample;
|
int64_t samples = chunk_size / bytes_per_sample;
|
||||||
int64_t frames = samples / channels;
|
int64_t frames = samples / channels;
|
||||||
|
@ -498,7 +498,7 @@ std::unique_ptr<AudioProvider> CreatePCMAudioProvider(agi::fs::path const& filen
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wrong_file_type)
|
if (wrong_file_type)
|
||||||
throw agi::AudioDataNotFoundError(msg, 0);
|
throw agi::AudioDataNotFoundError(msg, nullptr);
|
||||||
else
|
else
|
||||||
throw agi::AudioProviderOpenError(msg, 0);
|
throw agi::AudioProviderOpenError(msg, nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ protected:
|
||||||
|
|
||||||
IndexVector index_points;
|
IndexVector index_points;
|
||||||
|
|
||||||
void FillBuffer(void *buf, int64_t start, int64_t count) const;
|
void FillBuffer(void *buf, int64_t start, int64_t count) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Construct the right PCM audio provider (if any) for the file
|
// Construct the right PCM audio provider (if any) for the file
|
||||||
|
|
|
@ -53,7 +53,7 @@ RAMAudioProvider::RAMAudioProvider(std::unique_ptr<AudioProvider> src, agi::Back
|
||||||
blockcache.resize((source->GetNumSamples() * source->GetBytesPerSample() + CacheBlockSize - 1) >> CacheBits);
|
blockcache.resize((source->GetNumSamples() * source->GetBytesPerSample() + CacheBlockSize - 1) >> CacheBits);
|
||||||
}
|
}
|
||||||
catch (std::bad_alloc const&) {
|
catch (std::bad_alloc const&) {
|
||||||
throw agi::AudioCacheOpenError("Couldn't open audio, not enough ram available.", 0);
|
throw agi::AudioCacheOpenError("Couldn't open audio, not enough ram available.", nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
br->Run(std::bind(&RAMAudioProvider::FillCache, this, source.get(), std::placeholders::_1));
|
br->Run(std::bind(&RAMAudioProvider::FillCache, this, source.get(), std::placeholders::_1));
|
||||||
|
|
|
@ -50,7 +50,7 @@ class RAMAudioProvider : public AudioProviderWrapper {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void FillCache(AudioProvider *source, agi::ProgressSink *ps);
|
void FillCache(AudioProvider *source, agi::ProgressSink *ps);
|
||||||
void FillBuffer(void *buf, int64_t start, int64_t count) const;
|
void FillBuffer(void *buf, int64_t start, int64_t count) const override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RAMAudioProvider(std::unique_ptr<AudioProvider> source, agi::BackgroundRunner *br);
|
RAMAudioProvider(std::unique_ptr<AudioProvider> source, agi::BackgroundRunner *br);
|
||||||
|
|
|
@ -71,8 +71,8 @@ AudioRenderer::AudioRenderer()
|
||||||
, cache_bitmap_width(32) // arbitrary value for now
|
, cache_bitmap_width(32) // arbitrary value for now
|
||||||
, cache_bitmap_maxsize(0)
|
, cache_bitmap_maxsize(0)
|
||||||
, cache_renderer_maxsize(0)
|
, cache_renderer_maxsize(0)
|
||||||
, renderer(0)
|
, renderer(nullptr)
|
||||||
, provider(0)
|
, provider(nullptr)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < AudioStyle_MAX; ++i)
|
for (int i = 0; i < AudioStyle_MAX; ++i)
|
||||||
bitmaps.emplace_back(256, AudioRendererBitmapCacheBitmapFactory(this));
|
bitmaps.emplace_back(256, AudioRendererBitmapCacheBitmapFactory(this));
|
||||||
|
|
|
@ -254,7 +254,7 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
AudioRendererBitmapProvider() : provider(0), pixel_ms(0), amplitude_scale(0) { };
|
AudioRendererBitmapProvider() : provider(nullptr), pixel_ms(0), amplitude_scale(0) { };
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
virtual ~AudioRendererBitmapProvider() { }
|
virtual ~AudioRendererBitmapProvider() { }
|
||||||
|
|
|
@ -70,7 +70,7 @@ struct AudioSpectrumCacheBlockFactory {
|
||||||
/// The filling is delegated to the spectrum renderer
|
/// The filling is delegated to the spectrum renderer
|
||||||
BlockType ProduceBlock(size_t i)
|
BlockType ProduceBlock(size_t i)
|
||||||
{
|
{
|
||||||
float *res = new float[((size_t)1)<<spectrum->derivation_size];
|
auto res = new float[((size_t)1)<<spectrum->derivation_size];
|
||||||
spectrum->FillBlock(i, res);
|
spectrum->FillBlock(i, res);
|
||||||
return BlockType(res);
|
return BlockType(res);
|
||||||
}
|
}
|
||||||
|
@ -100,9 +100,9 @@ AudioSpectrumRenderer::AudioSpectrumRenderer(std::string const& color_scheme_nam
|
||||||
: derivation_size(8)
|
: derivation_size(8)
|
||||||
, derivation_dist(8)
|
, derivation_dist(8)
|
||||||
#ifdef WITH_FFTW3
|
#ifdef WITH_FFTW3
|
||||||
, dft_plan(0)
|
, dft_plan(nullptr)
|
||||||
, dft_input(0)
|
, dft_input(nullptr)
|
||||||
, dft_output(0)
|
, dft_output(nullptr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
colors.reserve(AudioStyle_MAX);
|
colors.reserve(AudioStyle_MAX);
|
||||||
|
@ -125,9 +125,9 @@ void AudioSpectrumRenderer::RecreateCache()
|
||||||
fftw_destroy_plan(dft_plan);
|
fftw_destroy_plan(dft_plan);
|
||||||
fftw_free(dft_input);
|
fftw_free(dft_input);
|
||||||
fftw_free(dft_output);
|
fftw_free(dft_output);
|
||||||
dft_plan = 0;
|
dft_plan = nullptr;
|
||||||
dft_input = 0;
|
dft_input = nullptr;
|
||||||
dft_output = 0;
|
dft_output = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class AudioSpectrumRenderer : public AudioRendererBitmapProvider {
|
||||||
///
|
///
|
||||||
/// Overrides the OnSetProvider event handler in the base class, to reset things
|
/// Overrides the OnSetProvider event handler in the base class, to reset things
|
||||||
/// when the audio provider is changed.
|
/// when the audio provider is changed.
|
||||||
void OnSetProvider();
|
void OnSetProvider() override;
|
||||||
|
|
||||||
/// @brief Recreates the cache
|
/// @brief Recreates the cache
|
||||||
///
|
///
|
||||||
|
@ -117,10 +117,10 @@ public:
|
||||||
/// @param bmp [in,out] Bitmap to render into, also carries length information
|
/// @param bmp [in,out] Bitmap to render into, also carries length information
|
||||||
/// @param start First column of pixel data in display to render
|
/// @param start First column of pixel data in display to render
|
||||||
/// @param style Style to render audio in
|
/// @param style Style to render audio in
|
||||||
void Render(wxBitmap &bmp, int start, AudioRenderingStyle style);
|
void Render(wxBitmap &bmp, int start, AudioRenderingStyle style) override;
|
||||||
|
|
||||||
/// @brief Render blank area
|
/// @brief Render blank area
|
||||||
void RenderBlank(wxDC &dc, const wxRect &rect, AudioRenderingStyle style);
|
void RenderBlank(wxDC &dc, const wxRect &rect, AudioRenderingStyle style) override;
|
||||||
|
|
||||||
/// @brief Set the derivation resolution
|
/// @brief Set the derivation resolution
|
||||||
/// @param derivation_size Binary logarithm of number of samples to use in deriving frequency-power data
|
/// @param derivation_size Binary logarithm of number of samples to use in deriving frequency-power data
|
||||||
|
@ -135,5 +135,5 @@ public:
|
||||||
|
|
||||||
/// @brief Cleans up the cache
|
/// @brief Cleans up the cache
|
||||||
/// @param max_size Maximum size in bytes for the cache
|
/// @param max_size Maximum size in bytes for the cache
|
||||||
void AgeCache(size_t max_size);
|
void AgeCache(size_t max_size) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,7 +55,7 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
AudioWaveformRenderer::AudioWaveformRenderer(std::string const& color_scheme_name)
|
AudioWaveformRenderer::AudioWaveformRenderer(std::string const& color_scheme_name)
|
||||||
: audio_buffer(0)
|
: audio_buffer(nullptr)
|
||||||
, render_averages(OPT_GET("Audio/Display/Waveform Style")->GetInt() == Waveform_MaxAvg)
|
, render_averages(OPT_GET("Audio/Display/Waveform Style")->GetInt() == Waveform_MaxAvg)
|
||||||
{
|
{
|
||||||
colors.reserve(AudioStyle_MAX);
|
colors.reserve(AudioStyle_MAX);
|
||||||
|
@ -168,13 +168,13 @@ void AudioWaveformRenderer::RenderBlank(wxDC &dc, const wxRect &rect, AudioRende
|
||||||
void AudioWaveformRenderer::OnSetProvider()
|
void AudioWaveformRenderer::OnSetProvider()
|
||||||
{
|
{
|
||||||
delete[] audio_buffer;
|
delete[] audio_buffer;
|
||||||
audio_buffer = 0;
|
audio_buffer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioWaveformRenderer::OnSetMillisecondsPerPixel()
|
void AudioWaveformRenderer::OnSetMillisecondsPerPixel()
|
||||||
{
|
{
|
||||||
delete[] audio_buffer;
|
delete[] audio_buffer;
|
||||||
audio_buffer = 0;
|
audio_buffer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxArrayString AudioWaveformRenderer::GetWaveformStyles() {
|
wxArrayString AudioWaveformRenderer::GetWaveformStyles() {
|
||||||
|
|
|
@ -50,8 +50,8 @@ class AudioWaveformRenderer : public AudioRendererBitmapProvider {
|
||||||
/// Whether to render max+avg or just max
|
/// Whether to render max+avg or just max
|
||||||
bool render_averages;
|
bool render_averages;
|
||||||
|
|
||||||
void OnSetProvider();
|
void OnSetProvider() override;
|
||||||
void OnSetMillisecondsPerPixel();
|
void OnSetMillisecondsPerPixel() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
|
@ -65,16 +65,16 @@ public:
|
||||||
/// @param bmp [in,out] Bitmap to render into, also carries length information
|
/// @param bmp [in,out] Bitmap to render into, also carries length information
|
||||||
/// @param start First column of pixel data in display to render
|
/// @param start First column of pixel data in display to render
|
||||||
/// @param style Style to render audio in
|
/// @param style Style to render audio in
|
||||||
void Render(wxBitmap &bmp, int start, AudioRenderingStyle style);
|
void Render(wxBitmap &bmp, int start, AudioRenderingStyle style) override;
|
||||||
|
|
||||||
/// @brief Render blank area
|
/// @brief Render blank area
|
||||||
void RenderBlank(wxDC &dc, const wxRect &rect, AudioRenderingStyle style);
|
void RenderBlank(wxDC &dc, const wxRect &rect, AudioRenderingStyle style) override;
|
||||||
|
|
||||||
/// @brief Cleans up the cache
|
/// @brief Cleans up the cache
|
||||||
/// @param max_size Maximum size in bytes for the cache
|
/// @param max_size Maximum size in bytes for the cache
|
||||||
///
|
///
|
||||||
/// Does nothing for waveform renderer, since it does not have a backend cache
|
/// Does nothing for waveform renderer, since it does not have a backend cache
|
||||||
void AgeCache(size_t max_size) { }
|
void AgeCache(size_t max_size) override { }
|
||||||
|
|
||||||
/// Get a list of waveform rendering modes
|
/// Get a list of waveform rendering modes
|
||||||
static wxArrayString GetWaveformStyles();
|
static wxArrayString GetWaveformStyles();
|
||||||
|
|
|
@ -71,10 +71,10 @@ class DialogueTimingMarker : public AudioMarker {
|
||||||
TimeableLine *line;
|
TimeableLine *line;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int GetPosition() const { return position; }
|
int GetPosition() const override { return position; }
|
||||||
wxPen GetStyle() const { return *style; }
|
wxPen GetStyle() const override { return *style; }
|
||||||
FeetStyle GetFeet() const { return feet; }
|
FeetStyle GetFeet() const override { return feet; }
|
||||||
bool CanSnap() const { return true; }
|
bool CanSnap() const override { return true; }
|
||||||
|
|
||||||
/// Move the marker to a new position
|
/// Move the marker to a new position
|
||||||
/// @param new_position The position to move the marker to, in milliseconds
|
/// @param new_position The position to move the marker to, in milliseconds
|
||||||
|
@ -179,7 +179,7 @@ public:
|
||||||
/// @param style_left The rendering style for the start marker
|
/// @param style_left The rendering style for the start marker
|
||||||
/// @param style_right The rendering style for the end marker
|
/// @param style_right The rendering style for the end marker
|
||||||
TimeableLine(AudioRenderingStyle style, const Pen *style_left, const Pen *style_right)
|
TimeableLine(AudioRenderingStyle style, const Pen *style_left, const Pen *style_right)
|
||||||
: line(0)
|
: line(nullptr)
|
||||||
, style(style)
|
, style(style)
|
||||||
, marker1(0, style_left, AudioMarker::Feet_Right, style, this)
|
, marker1(0, style_left, AudioMarker::Feet_Right, style, this)
|
||||||
, marker2(0, style_right, AudioMarker::Feet_Left, style, this)
|
, marker2(0, style_right, AudioMarker::Feet_Left, style, this)
|
||||||
|
@ -382,27 +382,27 @@ class AudioTimingControllerDialogue : public AudioTimingController {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// AudioMarkerProvider interface
|
// AudioMarkerProvider interface
|
||||||
void GetMarkers(const TimeRange &range, AudioMarkerVector &out_markers) const;
|
void GetMarkers(const TimeRange &range, AudioMarkerVector &out_markers) const override;
|
||||||
|
|
||||||
// AudioTimingController interface
|
// AudioTimingController interface
|
||||||
wxString GetWarningMessage() const;
|
wxString GetWarningMessage() const override;
|
||||||
TimeRange GetIdealVisibleTimeRange() const;
|
TimeRange GetIdealVisibleTimeRange() const override;
|
||||||
TimeRange GetPrimaryPlaybackRange() const;
|
TimeRange GetPrimaryPlaybackRange() const override;
|
||||||
TimeRange GetActiveLineRange() const;
|
TimeRange GetActiveLineRange() const override;
|
||||||
void GetRenderingStyles(AudioRenderingStyleRanges &ranges) const;
|
void GetRenderingStyles(AudioRenderingStyleRanges &ranges) const override;
|
||||||
void GetLabels(TimeRange const& range, std::vector<AudioLabel> &out) const { }
|
void GetLabels(TimeRange const& range, std::vector<AudioLabel> &out) const override { }
|
||||||
void Next(NextMode mode);
|
void Next(NextMode mode) override;
|
||||||
void Prev();
|
void Prev() override;
|
||||||
void Commit();
|
void Commit() override;
|
||||||
void Revert();
|
void Revert() override;
|
||||||
void AddLeadIn();
|
void AddLeadIn() override;
|
||||||
void AddLeadOut();
|
void AddLeadOut() override;
|
||||||
void ModifyLength(int delta, bool shift_following);
|
void ModifyLength(int delta, bool shift_following) override;
|
||||||
void ModifyStart(int delta);
|
void ModifyStart(int delta) override;
|
||||||
bool IsNearbyMarker(int ms, int sensitivity) const;
|
bool IsNearbyMarker(int ms, int sensitivity) const override;
|
||||||
std::vector<AudioMarker*> OnLeftClick(int ms, bool ctrl_down, int sensitivity, int snap_range);
|
std::vector<AudioMarker*> OnLeftClick(int ms, bool ctrl_down, int sensitivity, int snap_range) override;
|
||||||
std::vector<AudioMarker*> OnRightClick(int ms, bool, int sensitivity, int snap_range);
|
std::vector<AudioMarker*> OnRightClick(int ms, bool, int sensitivity, int snap_range) override;
|
||||||
void OnMarkerDrag(std::vector<AudioMarker*> const& markers, int new_position, int snap_range);
|
void OnMarkerDrag(std::vector<AudioMarker*> const& markers, int new_position, int snap_range) override;
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// @param c Project context
|
/// @param c Project context
|
||||||
|
@ -555,7 +555,7 @@ void AudioTimingControllerDialogue::DoCommit(bool user_triggered)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AssDialogue *amend = modified_lines.size() == 1 ? (*modified_lines.begin())->GetLine() : 0;
|
AssDialogue *amend = modified_lines.size() == 1 ? (*modified_lines.begin())->GetLine() : nullptr;
|
||||||
commit_id = context->ass->Commit(_("timing"), AssFile::COMMIT_DIAG_TIME, commit_id, amend);
|
commit_id = context->ass->Commit(_("timing"), AssFile::COMMIT_DIAG_TIME, commit_id, amend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,7 +857,7 @@ int AudioTimingControllerDialogue::SnapPosition(int position, int snap_range, st
|
||||||
return position;
|
return position;
|
||||||
|
|
||||||
TimeRange snap_time_range(position - snap_range, position + snap_range);
|
TimeRange snap_time_range(position - snap_range, position + snap_range);
|
||||||
const AudioMarker *snap_marker = 0;
|
const AudioMarker *snap_marker = nullptr;
|
||||||
AudioMarkerVector potential_snaps;
|
AudioMarkerVector potential_snaps;
|
||||||
GetMarkers(snap_time_range, potential_snaps);
|
GetMarkers(snap_time_range, potential_snaps);
|
||||||
for (auto marker : potential_snaps)
|
for (auto marker : potential_snaps)
|
||||||
|
|
|
@ -49,10 +49,10 @@ class KaraokeMarker : public AudioMarker {
|
||||||
FeetStyle style;
|
FeetStyle style;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int GetPosition() const { return position; }
|
int GetPosition() const override { return position; }
|
||||||
wxPen GetStyle() const { return *pen; }
|
wxPen GetStyle() const override { return *pen; }
|
||||||
FeetStyle GetFeet() const { return style; }
|
FeetStyle GetFeet() const override { return style; }
|
||||||
bool CanSnap() const { return false; }
|
bool CanSnap() const override { return false; }
|
||||||
|
|
||||||
void Move(int new_pos) { position = new_pos; }
|
void Move(int new_pos) { position = new_pos; }
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public:
|
||||||
|
|
||||||
KaraokeMarker(int position)
|
KaraokeMarker(int position)
|
||||||
: position(position)
|
: position(position)
|
||||||
, pen(0)
|
, pen(nullptr)
|
||||||
, style(Feet_None)
|
, style(Feet_None)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -127,25 +127,25 @@ class AudioTimingControllerKaraoke : public AudioTimingController {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// AudioTimingController implementation
|
// AudioTimingController implementation
|
||||||
void GetMarkers(const TimeRange &range, AudioMarkerVector &out_markers) const;
|
void GetMarkers(const TimeRange &range, AudioMarkerVector &out_markers) const override;
|
||||||
wxString GetWarningMessage() const { return ""; }
|
wxString GetWarningMessage() const override { return ""; }
|
||||||
TimeRange GetIdealVisibleTimeRange() const;
|
TimeRange GetIdealVisibleTimeRange() const override;
|
||||||
void GetRenderingStyles(AudioRenderingStyleRanges &ranges) const;
|
void GetRenderingStyles(AudioRenderingStyleRanges &ranges) const override;
|
||||||
TimeRange GetPrimaryPlaybackRange() const;
|
TimeRange GetPrimaryPlaybackRange() const override;
|
||||||
TimeRange GetActiveLineRange() const;
|
TimeRange GetActiveLineRange() const override;
|
||||||
void GetLabels(const TimeRange &range, std::vector<AudioLabel> &out_labels) const;
|
void GetLabels(const TimeRange &range, std::vector<AudioLabel> &out_labels) const override;
|
||||||
void Next(NextMode mode);
|
void Next(NextMode mode) override;
|
||||||
void Prev();
|
void Prev() override;
|
||||||
void Commit();
|
void Commit() override;
|
||||||
void Revert();
|
void Revert() override;
|
||||||
void AddLeadIn();
|
void AddLeadIn() override;
|
||||||
void AddLeadOut();
|
void AddLeadOut() override;
|
||||||
void ModifyLength(int delta, bool shift_following);
|
void ModifyLength(int delta, bool shift_following) override;
|
||||||
void ModifyStart(int delta);
|
void ModifyStart(int delta) override;
|
||||||
bool IsNearbyMarker(int ms, int sensitivity) const;
|
bool IsNearbyMarker(int ms, int sensitivity) const override;
|
||||||
std::vector<AudioMarker*> OnLeftClick(int ms, bool, int sensitivity, int);
|
std::vector<AudioMarker*> OnLeftClick(int ms, bool, int sensitivity, int) override;
|
||||||
std::vector<AudioMarker*> OnRightClick(int ms, bool, int, int);
|
std::vector<AudioMarker*> OnRightClick(int ms, bool, int, int) override;
|
||||||
void OnMarkerDrag(std::vector<AudioMarker*> const& marker, int new_position, int);
|
void OnMarkerDrag(std::vector<AudioMarker*> const& marker, int new_position, int) override;
|
||||||
|
|
||||||
AudioTimingControllerKaraoke(agi::Context *c, AssKaraoke *kara, agi::signal::Connection& file_changed);
|
AudioTimingControllerKaraoke(agi::Context *c, AssKaraoke *kara, agi::signal::Connection& file_changed);
|
||||||
};
|
};
|
||||||
|
|
|
@ -197,7 +197,7 @@ namespace Automation4 {
|
||||||
return config_dialog->CreateWindow(parent);
|
return config_dialog->CreateWindow(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportFilter::LoadSettings(bool is_default, agi::Context *c) {
|
void ExportFilter::LoadSettings(bool is_default, agi::Context *c) {
|
||||||
|
@ -222,7 +222,7 @@ namespace Automation4 {
|
||||||
wxDialog w; // container dialog box
|
wxDialog w; // container dialog box
|
||||||
w.SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
|
w.SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
|
||||||
w.Create(bsr->GetParentWindow(), -1, to_wx(bsr->GetTitle()));
|
w.Create(bsr->GetParentWindow(), -1, to_wx(bsr->GetTitle()));
|
||||||
wxBoxSizer *s = new wxBoxSizer(wxHORIZONTAL); // sizer for putting contents in
|
auto s = new wxBoxSizer(wxHORIZONTAL); // sizer for putting contents in
|
||||||
wxWindow *ww = config_dialog->CreateWindow(&w); // generate actual dialog contents
|
wxWindow *ww = config_dialog->CreateWindow(&w); // generate actual dialog contents
|
||||||
s->Add(ww, 0, wxALL, 5); // add contents to dialog
|
s->Add(ww, 0, wxALL, 5); // add contents to dialog
|
||||||
w.SetSizerAndFit(s);
|
w.SetSizerAndFit(s);
|
||||||
|
@ -331,8 +331,8 @@ namespace Automation4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// AutoloadScriptManager
|
// AutoloadScriptManager
|
||||||
AutoloadScriptManager::AutoloadScriptManager(std::string const& path)
|
AutoloadScriptManager::AutoloadScriptManager(std::string path)
|
||||||
: path(path)
|
: path(std::move(path))
|
||||||
{
|
{
|
||||||
Reload();
|
Reload();
|
||||||
}
|
}
|
||||||
|
@ -454,16 +454,16 @@ namespace Automation4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScriptFactory
|
// ScriptFactory
|
||||||
ScriptFactory::ScriptFactory(std::string const& engine_name, std::string const& filename_pattern)
|
ScriptFactory::ScriptFactory(std::string engine_name, std::string filename_pattern)
|
||||||
: engine_name(engine_name)
|
: engine_name(std::move(engine_name))
|
||||||
, filename_pattern(filename_pattern)
|
, filename_pattern(std::move(filename_pattern))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptFactory::Register(std::unique_ptr<ScriptFactory> factory)
|
void ScriptFactory::Register(std::unique_ptr<ScriptFactory> factory)
|
||||||
{
|
{
|
||||||
if (find(Factories().begin(), Factories().end(), factory) != Factories().end())
|
if (find(Factories().begin(), Factories().end(), factory) != Factories().end())
|
||||||
throw agi::InternalError("Automation 4: Attempt to register the same script factory multiple times. This should never happen.", 0);
|
throw agi::InternalError("Automation 4: Attempt to register the same script factory multiple times. This should never happen.", nullptr);
|
||||||
|
|
||||||
Factories().emplace_back(std::move(factory));
|
Factories().emplace_back(std::move(factory));
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,8 @@ namespace Automation4 {
|
||||||
public:
|
public:
|
||||||
ExportFilter(std::string const& name, std::string const& description, int priority);
|
ExportFilter(std::string const& name, std::string const& description, int priority);
|
||||||
|
|
||||||
wxWindow* GetConfigDialogWindow(wxWindow *parent, agi::Context *c);
|
wxWindow* GetConfigDialogWindow(wxWindow *parent, agi::Context *c) override;
|
||||||
void LoadSettings(bool is_default, agi::Context *c);
|
void LoadSettings(bool is_default, agi::Context *c) override;
|
||||||
|
|
||||||
// Subclasses must implement ProcessSubs from AssExportFilter
|
// Subclasses must implement ProcessSubs from AssExportFilter
|
||||||
};
|
};
|
||||||
|
@ -128,12 +128,12 @@ namespace Automation4 {
|
||||||
BackgroundScriptRunner *bsr;
|
BackgroundScriptRunner *bsr;
|
||||||
int trace_level;
|
int trace_level;
|
||||||
public:
|
public:
|
||||||
void SetIndeterminate() { impl->SetIndeterminate(); }
|
void SetIndeterminate() override { impl->SetIndeterminate(); }
|
||||||
void SetTitle(std::string const& title) { impl->SetTitle(title); }
|
void SetTitle(std::string const& title) override { impl->SetTitle(title); }
|
||||||
void SetMessage(std::string const& msg) { impl->SetMessage(msg); }
|
void SetMessage(std::string const& msg) override { impl->SetMessage(msg); }
|
||||||
void SetProgress(int64_t cur, int64_t max) { impl->SetProgress(cur, max); }
|
void SetProgress(int64_t cur, int64_t max) override { impl->SetProgress(cur, max); }
|
||||||
void Log(std::string const& str) { impl->Log(str); }
|
void Log(std::string const& str) override { impl->Log(str); }
|
||||||
bool IsCancelled() { return impl->IsCancelled(); }
|
bool IsCancelled() override { return impl->IsCancelled(); }
|
||||||
|
|
||||||
/// Show the passed dialog on the GUI thread, blocking the calling
|
/// Show the passed dialog on the GUI thread, blocking the calling
|
||||||
/// thread until it closes
|
/// thread until it closes
|
||||||
|
@ -225,15 +225,15 @@ namespace Automation4 {
|
||||||
void OnSubtitlesSave();
|
void OnSubtitlesSave();
|
||||||
public:
|
public:
|
||||||
LocalScriptManager(agi::Context *context);
|
LocalScriptManager(agi::Context *context);
|
||||||
void Reload();
|
void Reload() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Manager for scripts in the autoload directory
|
/// Manager for scripts in the autoload directory
|
||||||
class AutoloadScriptManager : public ScriptManager {
|
class AutoloadScriptManager : public ScriptManager {
|
||||||
std::string path;
|
std::string path;
|
||||||
public:
|
public:
|
||||||
AutoloadScriptManager(std::string const& path);
|
AutoloadScriptManager(std::string path);
|
||||||
void Reload();
|
void Reload() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Both a base class for script factories and a manager of registered
|
/// Both a base class for script factories and a manager of registered
|
||||||
|
@ -254,7 +254,7 @@ namespace Automation4 {
|
||||||
static std::vector<std::unique_ptr<ScriptFactory>>& Factories();
|
static std::vector<std::unique_ptr<ScriptFactory>>& Factories();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ScriptFactory(std::string const& engine_name, std::string const& filename_pattern);
|
ScriptFactory(std::string engine_name, std::string filename_pattern);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~ScriptFactory() { }
|
virtual ~ScriptFactory() { }
|
||||||
|
@ -285,16 +285,16 @@ namespace Automation4 {
|
||||||
public:
|
public:
|
||||||
UnknownScript(agi::fs::path const& filename) : Script(filename) { }
|
UnknownScript(agi::fs::path const& filename) : Script(filename) { }
|
||||||
|
|
||||||
void Reload() { }
|
void Reload() override { }
|
||||||
|
|
||||||
std::string GetName() const { return GetFilename().stem().string(); }
|
std::string GetName() const override { return GetFilename().stem().string(); }
|
||||||
std::string GetDescription() const { return from_wx(_("File was not recognized as a script")); }
|
std::string GetDescription() const override { return from_wx(_("File was not recognized as a script")); }
|
||||||
std::string GetAuthor() const { return ""; }
|
std::string GetAuthor() const override { return ""; }
|
||||||
std::string GetVersion() const { return ""; }
|
std::string GetVersion() const override { return ""; }
|
||||||
bool GetLoadedState() const { return false; }
|
bool GetLoadedState() const override { return false; }
|
||||||
|
|
||||||
std::vector<cmd::Command*> GetMacros() const { return std::vector<cmd::Command*>(); }
|
std::vector<cmd::Command*> GetMacros() const override { return std::vector<cmd::Command*>(); }
|
||||||
std::vector<ExportFilter*> GetFilters() const { return std::vector<ExportFilter*>(); }
|
std::vector<ExportFilter*> GetFilters() const override { return std::vector<ExportFilter*>(); }
|
||||||
std::vector<SubtitleFormat*> GetFormats() const { return std::vector<SubtitleFormat*>(); }
|
std::vector<SubtitleFormat*> GetFormats() const override { return std::vector<SubtitleFormat*>(); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace {
|
||||||
lua_getfield(L, LUA_REGISTRYINDEX, "project_context");
|
lua_getfield(L, LUA_REGISTRYINDEX, "project_context");
|
||||||
if (!lua_islightuserdata(L, -1)) {
|
if (!lua_islightuserdata(L, -1)) {
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
const agi::Context * c = static_cast<const agi::Context *>(lua_touserdata(L, -1));
|
const agi::Context * c = static_cast<const agi::Context *>(lua_touserdata(L, -1));
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
@ -328,17 +328,17 @@ namespace Automation4 {
|
||||||
static LuaScript* GetScriptObject(lua_State *L);
|
static LuaScript* GetScriptObject(lua_State *L);
|
||||||
|
|
||||||
// Script implementation
|
// Script implementation
|
||||||
void Reload() { Create(); }
|
void Reload() override { Create(); }
|
||||||
|
|
||||||
std::string GetName() const { return name; }
|
std::string GetName() const override { return name; }
|
||||||
std::string GetDescription() const { return description; }
|
std::string GetDescription() const override { return description; }
|
||||||
std::string GetAuthor() const { return author; }
|
std::string GetAuthor() const override { return author; }
|
||||||
std::string GetVersion() const { return version; }
|
std::string GetVersion() const override { return version; }
|
||||||
bool GetLoadedState() const { return L != 0; }
|
bool GetLoadedState() const override { return L != nullptr; }
|
||||||
|
|
||||||
std::vector<cmd::Command*> GetMacros() const { return macros; }
|
std::vector<cmd::Command*> GetMacros() const override { return macros; }
|
||||||
std::vector<ExportFilter*> GetFilters() const;
|
std::vector<ExportFilter*> GetFilters() const override;
|
||||||
std::vector<SubtitleFormat*> GetFormats() const { return std::vector<SubtitleFormat*>(); }
|
std::vector<SubtitleFormat*> GetFormats() const override { return std::vector<SubtitleFormat*>(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
LuaScript::LuaScript(agi::fs::path const& filename)
|
LuaScript::LuaScript(agi::fs::path const& filename)
|
||||||
|
@ -512,7 +512,7 @@ namespace Automation4 {
|
||||||
if (macro->name() == command->name()) {
|
if (macro->name() == command->name()) {
|
||||||
luaL_error(L,
|
luaL_error(L,
|
||||||
"A macro named '%s' is already defined in script '%s'",
|
"A macro named '%s' is already defined in script '%s'",
|
||||||
command->StrDisplay(0).utf8_str().data(), name.c_str());
|
command->StrDisplay(nullptr).utf8_str().data(), name.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
macros.push_back(command);
|
macros.push_back(command);
|
||||||
|
@ -858,7 +858,7 @@ namespace Automation4 {
|
||||||
set_context(L, c);
|
set_context(L, c);
|
||||||
|
|
||||||
GetFeatureFunction("validate");
|
GetFeatureFunction("validate");
|
||||||
LuaAssFile *subsobj = new LuaAssFile(L, c->ass);
|
auto subsobj = new LuaAssFile(L, c->ass);
|
||||||
push_value(L, transform_selection(L, c));
|
push_value(L, transform_selection(L, c));
|
||||||
|
|
||||||
int err = lua_pcall(L, 3, 2, 0);
|
int err = lua_pcall(L, 3, 2, 0);
|
||||||
|
@ -891,7 +891,7 @@ namespace Automation4 {
|
||||||
stackcheck.check_stack(0);
|
stackcheck.check_stack(0);
|
||||||
|
|
||||||
GetFeatureFunction("run");
|
GetFeatureFunction("run");
|
||||||
LuaAssFile *subsobj = new LuaAssFile(L, c->ass, true, true);
|
auto subsobj = new LuaAssFile(L, c->ass, true, true);
|
||||||
push_value(L, transform_selection(L, c));
|
push_value(L, transform_selection(L, c));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -968,7 +968,7 @@ namespace Automation4 {
|
||||||
stackcheck.check_stack(0);
|
stackcheck.check_stack(0);
|
||||||
|
|
||||||
GetFeatureFunction("isactive");
|
GetFeatureFunction("isactive");
|
||||||
LuaAssFile *subsobj = new LuaAssFile(L, c->ass);
|
auto subsobj = new LuaAssFile(L, c->ass);
|
||||||
push_value(L, transform_selection(L, c));
|
push_value(L, transform_selection(L, c));
|
||||||
|
|
||||||
int err = lua_pcall(L, 3, 1, 0);
|
int err = lua_pcall(L, 3, 1, 0);
|
||||||
|
@ -1035,7 +1035,7 @@ namespace Automation4 {
|
||||||
|
|
||||||
// The entire point of an export filter is to modify the file, but
|
// The entire point of an export filter is to modify the file, but
|
||||||
// setting undo points makes no sense
|
// setting undo points makes no sense
|
||||||
LuaAssFile *subsobj = new LuaAssFile(L, subs, true);
|
auto subsobj = new LuaAssFile(L, subs, true);
|
||||||
assert(lua_isuserdata(L, -1));
|
assert(lua_isuserdata(L, -1));
|
||||||
stackcheck.check_stack(2);
|
stackcheck.check_stack(2);
|
||||||
|
|
||||||
|
@ -1066,14 +1066,14 @@ namespace Automation4 {
|
||||||
ScriptDialog* LuaExportFilter::GenerateConfigDialog(wxWindow *parent, agi::Context *c)
|
ScriptDialog* LuaExportFilter::GenerateConfigDialog(wxWindow *parent, agi::Context *c)
|
||||||
{
|
{
|
||||||
if (!has_config)
|
if (!has_config)
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
set_context(L, c);
|
set_context(L, c);
|
||||||
|
|
||||||
GetFeatureFunction("config");
|
GetFeatureFunction("config");
|
||||||
|
|
||||||
// prepare function call
|
// prepare function call
|
||||||
LuaAssFile *subsobj = new LuaAssFile(L, c->ass);
|
auto subsobj = new LuaAssFile(L, c->ass);
|
||||||
// stored options
|
// stored options
|
||||||
lua_newtable(L); // TODO, nothing for now
|
lua_newtable(L); // TODO, nothing for now
|
||||||
|
|
||||||
|
|
|
@ -206,9 +206,9 @@ namespace Automation4 {
|
||||||
int LuaReadBack(lua_State *L);
|
int LuaReadBack(lua_State *L);
|
||||||
|
|
||||||
// ScriptDialog implementation
|
// ScriptDialog implementation
|
||||||
wxWindow* CreateWindow(wxWindow *parent);
|
wxWindow* CreateWindow(wxWindow *parent) override;
|
||||||
std::string Serialise();
|
std::string Serialise() override;
|
||||||
void Unserialise(const std::string &serialised);
|
void Unserialise(const std::string &serialised) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LuaFeature {
|
class LuaFeature {
|
||||||
|
@ -244,16 +244,16 @@ namespace Automation4 {
|
||||||
LuaCommand(lua_State *L);
|
LuaCommand(lua_State *L);
|
||||||
~LuaCommand();
|
~LuaCommand();
|
||||||
|
|
||||||
const char* name() const { return cmd_name.c_str(); }
|
const char* name() const override { return cmd_name.c_str(); }
|
||||||
wxString StrMenu(const agi::Context *) const { return display; }
|
wxString StrMenu(const agi::Context *) const override { return display; }
|
||||||
wxString StrDisplay(const agi::Context *) const { return display; }
|
wxString StrDisplay(const agi::Context *) const override { return display; }
|
||||||
wxString StrHelp() const { return help; }
|
wxString StrHelp() const override { return help; }
|
||||||
|
|
||||||
int Type() const { return cmd_type; }
|
int Type() const override { return cmd_type; }
|
||||||
|
|
||||||
void operator()(agi::Context *c);
|
void operator()(agi::Context *c) override;
|
||||||
bool Validate(const agi::Context *c);
|
bool Validate(const agi::Context *c) override;
|
||||||
virtual bool IsActive(const agi::Context *c);
|
virtual bool IsActive(const agi::Context *c) override;
|
||||||
|
|
||||||
static int LuaRegister(lua_State *L);
|
static int LuaRegister(lua_State *L);
|
||||||
};
|
};
|
||||||
|
@ -263,12 +263,12 @@ namespace Automation4 {
|
||||||
LuaDialog *config_dialog;
|
LuaDialog *config_dialog;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ScriptDialog* GenerateConfigDialog(wxWindow *parent, agi::Context *c);
|
ScriptDialog* GenerateConfigDialog(wxWindow *parent, agi::Context *c) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LuaExportFilter(lua_State *L);
|
LuaExportFilter(lua_State *L);
|
||||||
static int LuaRegister(lua_State *L);
|
static int LuaRegister(lua_State *L);
|
||||||
|
|
||||||
void ProcessSubs(AssFile *subs, wxWindow *export_dialog);
|
void ProcessSubs(AssFile *subs, wxWindow *export_dialog) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,7 +244,7 @@ namespace Automation4 {
|
||||||
if (lclass == "info")
|
if (lclass == "info")
|
||||||
result = agi::util::make_unique<AssInfo>(get_string_field(L, "key", "info"), get_string_field(L, "value", "info"));
|
result = agi::util::make_unique<AssInfo>(get_string_field(L, "key", "info"), get_string_field(L, "value", "info"));
|
||||||
else if (lclass == "style") {
|
else if (lclass == "style") {
|
||||||
AssStyle *sty = new AssStyle;
|
auto sty = new AssStyle;
|
||||||
result.reset(sty);
|
result.reset(sty);
|
||||||
sty->name = get_string_field(L, "name", "style");
|
sty->name = get_string_field(L, "name", "style");
|
||||||
sty->font = get_string_field(L, "fontname", "style");
|
sty->font = get_string_field(L, "fontname", "style");
|
||||||
|
@ -272,7 +272,7 @@ namespace Automation4 {
|
||||||
sty->UpdateData();
|
sty->UpdateData();
|
||||||
}
|
}
|
||||||
else if (lclass == "dialogue") {
|
else if (lclass == "dialogue") {
|
||||||
AssDialogue *dia = new AssDialogue;
|
auto dia = new AssDialogue;
|
||||||
result.reset(dia);
|
result.reset(dia);
|
||||||
|
|
||||||
dia->Comment = get_bool_field(L, "comment", "dialogue");
|
dia->Comment = get_bool_field(L, "comment", "dialogue");
|
||||||
|
@ -289,7 +289,7 @@ namespace Automation4 {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
luaL_error(L, "Found line with unknown class: %s", lclass.c_str());
|
luaL_error(L, "Found line with unknown class: %s", lclass.c_str());
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -146,13 +146,13 @@ namespace Automation4 {
|
||||||
public:
|
public:
|
||||||
Label(lua_State *L) : LuaDialogControl(L), label(get_field(L, "label")) { }
|
Label(lua_State *L) : LuaDialogControl(L), label(get_field(L, "label")) { }
|
||||||
|
|
||||||
wxControl *Create(wxWindow *parent) {
|
wxControl *Create(wxWindow *parent) override {
|
||||||
return new wxStaticText(parent, -1, to_wx(label));
|
return new wxStaticText(parent, -1, to_wx(label));
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetSizerFlags() const { return wxALIGN_CENTRE_VERTICAL | wxALIGN_LEFT; }
|
int GetSizerFlags() const override { return wxALIGN_CENTRE_VERTICAL | wxALIGN_LEFT; }
|
||||||
|
|
||||||
void LuaReadBack(lua_State *L) {
|
void LuaReadBack(lua_State *L) override {
|
||||||
// Label doesn't produce output, so let it be nil
|
// Label doesn't produce output, so let it be nil
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ namespace Automation4 {
|
||||||
Edit(lua_State *L)
|
Edit(lua_State *L)
|
||||||
: LuaDialogControl(L)
|
: LuaDialogControl(L)
|
||||||
, text(get_field(L, "value"))
|
, text(get_field(L, "value"))
|
||||||
, cw(0)
|
, cw(nullptr)
|
||||||
{
|
{
|
||||||
// Undocumented behaviour, 'value' is also accepted as key for text,
|
// Undocumented behaviour, 'value' is also accepted as key for text,
|
||||||
// mostly so a text control can stand in for other things.
|
// mostly so a text control can stand in for other things.
|
||||||
|
@ -176,18 +176,18 @@ namespace Automation4 {
|
||||||
text = get_field(L, "text", text);
|
text = get_field(L, "text", text);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanSerialiseValue() const { return true; }
|
bool CanSerialiseValue() const override { return true; }
|
||||||
std::string SerialiseValue() const { return inline_string_encode(text); }
|
std::string SerialiseValue() const override { return inline_string_encode(text); }
|
||||||
void UnserialiseValue(const std::string &serialised) { text = inline_string_decode(serialised); }
|
void UnserialiseValue(const std::string &serialised) override { text = inline_string_decode(serialised); }
|
||||||
|
|
||||||
wxControl *Create(wxWindow *parent) {
|
wxControl *Create(wxWindow *parent) override {
|
||||||
cw = new wxTextCtrl(parent, -1, to_wx(text));
|
cw = new wxTextCtrl(parent, -1, to_wx(text));
|
||||||
cw->SetValidator(StringBinder(&text));
|
cw->SetValidator(StringBinder(&text));
|
||||||
cw->SetToolTip(to_wx(hint));
|
cw->SetToolTip(to_wx(hint));
|
||||||
return cw;
|
return cw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaReadBack(lua_State *L) {
|
void LuaReadBack(lua_State *L) override {
|
||||||
lua_pushstring(L, text.c_str());
|
lua_pushstring(L, text.c_str());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -205,17 +205,17 @@ namespace Automation4 {
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanSerialiseValue() const { return true; }
|
bool CanSerialiseValue() const override { return true; }
|
||||||
std::string SerialiseValue() const { return inline_string_encode(color.GetHexFormatted()); }
|
std::string SerialiseValue() const override { return inline_string_encode(color.GetHexFormatted()); }
|
||||||
void UnserialiseValue(const std::string &serialised) { color = inline_string_decode(serialised); }
|
void UnserialiseValue(const std::string &serialised) override { color = inline_string_decode(serialised); }
|
||||||
|
|
||||||
wxControl *Create(wxWindow *parent) {
|
wxControl *Create(wxWindow *parent) override {
|
||||||
wxControl *cw = new ColourButton(parent, wxSize(50*width,10*height), alpha, color, ColorValidator(&color));
|
wxControl *cw = new ColourButton(parent, wxSize(50*width,10*height), alpha, color, ColorValidator(&color));
|
||||||
cw->SetToolTip(to_wx(hint));
|
cw->SetToolTip(to_wx(hint));
|
||||||
return cw;
|
return cw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaReadBack(lua_State *L) {
|
void LuaReadBack(lua_State *L) override {
|
||||||
lua_pushstring(L, color.GetHexFormatted().c_str());
|
lua_pushstring(L, color.GetHexFormatted().c_str());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -226,7 +226,7 @@ namespace Automation4 {
|
||||||
Textbox(lua_State *L) : Edit(L) { }
|
Textbox(lua_State *L) : Edit(L) { }
|
||||||
|
|
||||||
// Same serialisation interface as single-line edit
|
// Same serialisation interface as single-line edit
|
||||||
wxControl *Create(wxWindow *parent) {
|
wxControl *Create(wxWindow *parent) override {
|
||||||
cw = new wxTextCtrl(parent, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE, StringBinder(&text));
|
cw = new wxTextCtrl(parent, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE, StringBinder(&text));
|
||||||
cw->SetMinSize(wxSize(0, 30));
|
cw->SetMinSize(wxSize(0, 30));
|
||||||
cw->SetToolTip(to_wx(hint));
|
cw->SetToolTip(to_wx(hint));
|
||||||
|
@ -244,7 +244,7 @@ namespace Automation4 {
|
||||||
public:
|
public:
|
||||||
IntEdit(lua_State *L)
|
IntEdit(lua_State *L)
|
||||||
: Edit(L)
|
: Edit(L)
|
||||||
, cw(0)
|
, cw(nullptr)
|
||||||
, value(get_field(L, "value", 0))
|
, value(get_field(L, "value", 0))
|
||||||
, min(get_field(L, "min", INT_MIN))
|
, min(get_field(L, "min", INT_MIN))
|
||||||
, max(get_field(L, "max", INT_MAX))
|
, max(get_field(L, "max", INT_MAX))
|
||||||
|
@ -255,18 +255,18 @@ namespace Automation4 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanSerialiseValue() const { return true; }
|
bool CanSerialiseValue() const override { return true; }
|
||||||
std::string SerialiseValue() const { return std::to_string(value); }
|
std::string SerialiseValue() const override { return std::to_string(value); }
|
||||||
void UnserialiseValue(const std::string &serialised) { value = atoi(serialised.c_str()); }
|
void UnserialiseValue(const std::string &serialised) override { value = atoi(serialised.c_str()); }
|
||||||
|
|
||||||
wxControl *Create(wxWindow *parent) {
|
wxControl *Create(wxWindow *parent) override {
|
||||||
cw = new wxSpinCtrl(parent, -1, "", wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, min, max, value);
|
cw = new wxSpinCtrl(parent, -1, "", wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, min, max, value);
|
||||||
cw->SetValidator(wxGenericValidator(&value));
|
cw->SetValidator(wxGenericValidator(&value));
|
||||||
cw->SetToolTip(to_wx(hint));
|
cw->SetToolTip(to_wx(hint));
|
||||||
return cw;
|
return cw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaReadBack(lua_State *L) {
|
void LuaReadBack(lua_State *L) override {
|
||||||
lua_pushinteger(L, value);
|
lua_pushinteger(L, value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -282,15 +282,15 @@ namespace Automation4 {
|
||||||
struct DoubleValidator : public wxValidator {
|
struct DoubleValidator : public wxValidator {
|
||||||
double *value;
|
double *value;
|
||||||
DoubleValidator(double *value) : value(value) { }
|
DoubleValidator(double *value) : value(value) { }
|
||||||
wxValidator *Clone() const { return new DoubleValidator(value); }
|
wxValidator *Clone() const override { return new DoubleValidator(value); }
|
||||||
bool Validate(wxWindow*) { return true; }
|
bool Validate(wxWindow*) override { return true; }
|
||||||
|
|
||||||
bool TransferToWindow() {
|
bool TransferToWindow() override {
|
||||||
static_cast<wxSpinCtrlDouble*>(GetWindow())->SetValue(*value);
|
static_cast<wxSpinCtrlDouble*>(GetWindow())->SetValue(*value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TransferFromWindow() {
|
bool TransferFromWindow() override {
|
||||||
auto ctrl = static_cast<wxSpinCtrlDouble*>(GetWindow());
|
auto ctrl = static_cast<wxSpinCtrlDouble*>(GetWindow());
|
||||||
#ifndef wxHAS_NATIVE_SPINCTRLDOUBLE
|
#ifndef wxHAS_NATIVE_SPINCTRLDOUBLE
|
||||||
wxFocusEvent evt;
|
wxFocusEvent evt;
|
||||||
|
@ -308,7 +308,7 @@ namespace Automation4 {
|
||||||
, min(get_field(L, "min", -DBL_MAX))
|
, min(get_field(L, "min", -DBL_MAX))
|
||||||
, max(get_field(L, "max", DBL_MAX))
|
, max(get_field(L, "max", DBL_MAX))
|
||||||
, step(get_field(L, "step", 0.0))
|
, step(get_field(L, "step", 0.0))
|
||||||
, scd(0)
|
, scd(nullptr)
|
||||||
{
|
{
|
||||||
if (min >= max) {
|
if (min >= max) {
|
||||||
max = DBL_MAX;
|
max = DBL_MAX;
|
||||||
|
@ -316,11 +316,11 @@ namespace Automation4 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanSerialiseValue() const { return true; }
|
bool CanSerialiseValue() const override { return true; }
|
||||||
std::string SerialiseValue() const { return std::to_string(value); }
|
std::string SerialiseValue() const override { return std::to_string(value); }
|
||||||
void UnserialiseValue(const std::string &serialised) { value = atof(serialised.c_str()); }
|
void UnserialiseValue(const std::string &serialised) override { value = atof(serialised.c_str()); }
|
||||||
|
|
||||||
wxControl *Create(wxWindow *parent) {
|
wxControl *Create(wxWindow *parent) override {
|
||||||
if (step > 0) {
|
if (step > 0) {
|
||||||
scd = new wxSpinCtrlDouble(parent, -1, "", wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, min, max, value, step);
|
scd = new wxSpinCtrlDouble(parent, -1, "", wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, min, max, value, step);
|
||||||
scd->SetValidator(DoubleValidator(&value));
|
scd->SetValidator(DoubleValidator(&value));
|
||||||
|
@ -335,7 +335,7 @@ namespace Automation4 {
|
||||||
return cw;
|
return cw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaReadBack(lua_State *L) {
|
void LuaReadBack(lua_State *L) override {
|
||||||
lua_pushnumber(L, value);
|
lua_pushnumber(L, value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -350,23 +350,23 @@ namespace Automation4 {
|
||||||
Dropdown(lua_State *L)
|
Dropdown(lua_State *L)
|
||||||
: LuaDialogControl(L)
|
: LuaDialogControl(L)
|
||||||
, value(get_field(L, "value"))
|
, value(get_field(L, "value"))
|
||||||
, cw(0)
|
, cw(nullptr)
|
||||||
{
|
{
|
||||||
lua_getfield(L, -1, "items");
|
lua_getfield(L, -1, "items");
|
||||||
read_string_array(L, items);
|
read_string_array(L, items);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanSerialiseValue() const { return true; }
|
bool CanSerialiseValue() const override { return true; }
|
||||||
std::string SerialiseValue() const { return inline_string_encode(value); }
|
std::string SerialiseValue() const override { return inline_string_encode(value); }
|
||||||
void UnserialiseValue(const std::string &serialised) { value = inline_string_decode(serialised); }
|
void UnserialiseValue(const std::string &serialised) override { value = inline_string_decode(serialised); }
|
||||||
|
|
||||||
wxControl *Create(wxWindow *parent) {
|
wxControl *Create(wxWindow *parent) override {
|
||||||
cw = new wxComboBox(parent, -1, to_wx(value), wxDefaultPosition, wxDefaultSize, to_wx(items), wxCB_READONLY, StringBinder(&value));
|
cw = new wxComboBox(parent, -1, to_wx(value), wxDefaultPosition, wxDefaultSize, to_wx(items), wxCB_READONLY, StringBinder(&value));
|
||||||
cw->SetToolTip(to_wx(hint));
|
cw->SetToolTip(to_wx(hint));
|
||||||
return cw;
|
return cw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaReadBack(lua_State *L) {
|
void LuaReadBack(lua_State *L) override {
|
||||||
lua_pushstring(L, value.c_str());
|
lua_pushstring(L, value.c_str());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -381,15 +381,15 @@ namespace Automation4 {
|
||||||
: LuaDialogControl(L)
|
: LuaDialogControl(L)
|
||||||
, label(get_field(L, "label"))
|
, label(get_field(L, "label"))
|
||||||
, value(get_field(L, "value", false))
|
, value(get_field(L, "value", false))
|
||||||
, cw(0)
|
, cw(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanSerialiseValue() const { return true; }
|
bool CanSerialiseValue() const override { return true; }
|
||||||
std::string SerialiseValue() const { return value ? "1" : "0"; }
|
std::string SerialiseValue() const override { return value ? "1" : "0"; }
|
||||||
void UnserialiseValue(const std::string &serialised) { value = serialised != "0"; }
|
void UnserialiseValue(const std::string &serialised) override { value = serialised != "0"; }
|
||||||
|
|
||||||
wxControl *Create(wxWindow *parent) {
|
wxControl *Create(wxWindow *parent) override {
|
||||||
cw = new wxCheckBox(parent, -1, to_wx(label));
|
cw = new wxCheckBox(parent, -1, to_wx(label));
|
||||||
cw->SetValidator(wxGenericValidator(&value));
|
cw->SetValidator(wxGenericValidator(&value));
|
||||||
cw->SetToolTip(to_wx(hint));
|
cw->SetToolTip(to_wx(hint));
|
||||||
|
@ -397,7 +397,7 @@ namespace Automation4 {
|
||||||
return cw;
|
return cw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaReadBack(lua_State *L) {
|
void LuaReadBack(lua_State *L) override {
|
||||||
lua_pushboolean(L, value);
|
lua_pushboolean(L, value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -407,7 +407,7 @@ namespace Automation4 {
|
||||||
LuaDialog::LuaDialog(lua_State *L, bool include_buttons)
|
LuaDialog::LuaDialog(lua_State *L, bool include_buttons)
|
||||||
: use_buttons(include_buttons)
|
: use_buttons(include_buttons)
|
||||||
, button_pushed(-1)
|
, button_pushed(-1)
|
||||||
, window(0)
|
, window(nullptr)
|
||||||
{
|
{
|
||||||
LOG_D("automation/lua/dialog") << "creating LuaDialoug, addr: " << this;
|
LOG_D("automation/lua/dialog") << "creating LuaDialoug, addr: " << this;
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ namespace Automation4 {
|
||||||
if (must_exist)
|
if (must_exist)
|
||||||
flags |= wxFD_FILE_MUST_EXIST;
|
flags |= wxFD_FILE_MUST_EXIST;
|
||||||
|
|
||||||
wxFileDialog diag(0, message, dir, file, wildcard, flags);
|
wxFileDialog diag(nullptr, message, dir, file, wildcard, flags);
|
||||||
if (ps->ShowDialog(&diag) == wxID_CANCEL) {
|
if (ps->ShowDialog(&diag) == wxID_CANCEL) {
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -114,7 +114,7 @@ BaseGrid::BaseGrid(wxWindow* parent, agi::Context *context, const wxSize& size,
|
||||||
{
|
{
|
||||||
scrollBar->SetScrollbar(0,10,100,10);
|
scrollBar->SetScrollbar(0,10,100,10);
|
||||||
|
|
||||||
wxBoxSizer *scrollbarpositioner = new wxBoxSizer(wxHORIZONTAL);
|
auto scrollbarpositioner = new wxBoxSizer(wxHORIZONTAL);
|
||||||
scrollbarpositioner->AddStretchSpacer();
|
scrollbarpositioner->AddStretchSpacer();
|
||||||
scrollbarpositioner->Add(scrollBar, 0, wxEXPAND, 0);
|
scrollbarpositioner->Add(scrollBar, 0, wxEXPAND, 0);
|
||||||
|
|
||||||
|
@ -920,7 +920,7 @@ void BaseGrid::SetColumnWidths() {
|
||||||
}
|
}
|
||||||
|
|
||||||
AssDialogue *BaseGrid::GetDialogue(int n) const {
|
AssDialogue *BaseGrid::GetDialogue(int n) const {
|
||||||
if (static_cast<size_t>(n) >= index_line_map.size()) return 0;
|
if (static_cast<size_t>(n) >= index_line_map.size()) return nullptr;
|
||||||
return index_line_map[n];
|
return index_line_map[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1043,7 +1043,7 @@ void BaseGrid::SetSelectedSet(const Selection &new_selection) {
|
||||||
|
|
||||||
void BaseGrid::SetActiveLine(AssDialogue *new_line) {
|
void BaseGrid::SetActiveLine(AssDialogue *new_line) {
|
||||||
if (new_line != active_line) {
|
if (new_line != active_line) {
|
||||||
assert(new_line == 0 || line_index_map.count(new_line));
|
assert(new_line == nullptr || line_index_map.count(new_line));
|
||||||
active_line = new_line;
|
active_line = new_line;
|
||||||
AnnounceActiveLineChanged(active_line);
|
AnnounceActiveLineChanged(active_line);
|
||||||
MakeRowVisible(GetDialogueIndex(active_line));
|
MakeRowVisible(GetDialogueIndex(active_line));
|
||||||
|
|
|
@ -128,14 +128,14 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// SelectionController implementation
|
// SelectionController implementation
|
||||||
void SetActiveLine(AssDialogue *new_line);
|
void SetActiveLine(AssDialogue *new_line) override;
|
||||||
AssDialogue * GetActiveLine() const { return active_line; }
|
AssDialogue * GetActiveLine() const override { return active_line; }
|
||||||
void SetSelectedSet(const Selection &new_selection);
|
void SetSelectedSet(const Selection &new_selection) override;
|
||||||
void GetSelectedSet(Selection &res) const { res = selection; }
|
void GetSelectedSet(Selection &res) const override { res = selection; }
|
||||||
Selection const& GetSelectedSet() const { return selection; }
|
Selection const& GetSelectedSet() const override { return selection; }
|
||||||
void SetSelectionAndActive(Selection const& new_selection, AssDialogue *new_line);;
|
void SetSelectionAndActive(Selection const& new_selection, AssDialogue *new_line) override;;
|
||||||
void NextLine();
|
void NextLine() override;
|
||||||
void PrevLine();
|
void PrevLine() override;
|
||||||
|
|
||||||
void BeginBatch();
|
void BeginBatch();
|
||||||
void EndBatch();
|
void EndBatch();
|
||||||
|
|
|
@ -161,7 +161,7 @@ public:
|
||||||
///
|
///
|
||||||
/// The factory object passed must respond well to copying.
|
/// The factory object passed must respond well to copying.
|
||||||
DataBlockCache(size_t block_count, BlockFactoryT factory = BlockFactoryT())
|
DataBlockCache(size_t block_count, BlockFactoryT factory = BlockFactoryT())
|
||||||
: factory(factory)
|
: factory(std::move(factory))
|
||||||
{
|
{
|
||||||
SetBlockCount(block_count);
|
SetBlockCount(block_count);
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ public:
|
||||||
{
|
{
|
||||||
mb.blocks[block_index] = factory.ProduceBlock(i);
|
mb.blocks[block_index] = factory.ProduceBlock(i);
|
||||||
b = mb.blocks[block_index].get();
|
b = mb.blocks[block_index].get();
|
||||||
assert(b != 0);
|
assert(b != nullptr);
|
||||||
|
|
||||||
if (created) *created = true;
|
if (created) *created = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ wxDEFINE_EVENT(EVT_COLOR, wxThreadEvent);
|
||||||
ColourButton::ColourButton(wxWindow *parent, wxSize const& size, bool alpha, agi::Color col, wxValidator const& validator)
|
ColourButton::ColourButton(wxWindow *parent, wxSize const& size, bool alpha, agi::Color col, wxValidator const& validator)
|
||||||
: wxButton(parent, -1, "", wxDefaultPosition, wxSize(size.GetWidth() + 6, size.GetHeight() + 6), 0, validator)
|
: wxButton(parent, -1, "", wxDefaultPosition, wxSize(size.GetWidth() + 6, size.GetHeight() + 6), 0, validator)
|
||||||
, bmp(size)
|
, bmp(size)
|
||||||
, colour(col)
|
, colour(std::move(col))
|
||||||
{
|
{
|
||||||
UpdateBitmap();
|
UpdateBitmap();
|
||||||
Bind(wxEVT_COMMAND_BUTTON_CLICKED, [=](wxCommandEvent&) {
|
Bind(wxEVT_COMMAND_BUTTON_CLICKED, [=](wxCommandEvent&) {
|
||||||
|
|
|
@ -46,11 +46,11 @@ public:
|
||||||
struct ColorValidator : public wxValidator {
|
struct ColorValidator : public wxValidator {
|
||||||
agi::Color *color;
|
agi::Color *color;
|
||||||
ColorValidator(agi::Color *color) : color(color) { }
|
ColorValidator(agi::Color *color) : color(color) { }
|
||||||
wxValidator *Clone() const { return new ColorValidator(color); }
|
wxValidator *Clone() const override { return new ColorValidator(color); }
|
||||||
bool Validate(wxWindow*) { return true; }
|
bool Validate(wxWindow*) override { return true; }
|
||||||
bool TransferToWindow() { return true; }
|
bool TransferToWindow() override { return true; }
|
||||||
|
|
||||||
bool TransferFromWindow() {
|
bool TransferFromWindow() override {
|
||||||
*color = static_cast<ColourButton*>(GetWindow())->GetColor();
|
*color = static_cast<ColourButton*>(GetWindow())->GetColor();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ struct app_about : public Command {
|
||||||
STR_DISP("About")
|
STR_DISP("About")
|
||||||
STR_HELP("About Aegisub")
|
STR_HELP("About Aegisub")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AboutScreen(c->parent).ShowModal();
|
AboutScreen(c->parent).ShowModal();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -74,15 +74,15 @@ struct app_display_audio_subs : public Command {
|
||||||
STR_HELP("Display audio and the subtitles grid only")
|
STR_HELP("Display audio and the subtitles grid only")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
wxGetApp().frame->SetDisplayMode(0,1);
|
wxGetApp().frame->SetDisplayMode(0,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->audioController->IsAudioOpen();
|
return c->audioController->IsAudioOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return wxGetApp().frame->IsAudioShown() && !wxGetApp().frame->IsVideoShown();
|
return wxGetApp().frame->IsAudioShown() && !wxGetApp().frame->IsVideoShown();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -94,15 +94,15 @@ struct app_display_full : public Command {
|
||||||
STR_HELP("Display audio, video and then subtitles grid")
|
STR_HELP("Display audio, video and then subtitles grid")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
wxGetApp().frame->SetDisplayMode(1,1);
|
wxGetApp().frame->SetDisplayMode(1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->audioController->IsAudioOpen() && c->videoController->IsLoaded() && !c->dialog->Get<DialogDetachedVideo>();
|
return c->audioController->IsAudioOpen() && c->videoController->IsLoaded() && !c->dialog->Get<DialogDetachedVideo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return wxGetApp().frame->IsAudioShown() && wxGetApp().frame->IsVideoShown();
|
return wxGetApp().frame->IsAudioShown() && wxGetApp().frame->IsVideoShown();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -114,11 +114,11 @@ struct app_display_subs : public Command {
|
||||||
STR_HELP("Display the subtitles grid only")
|
STR_HELP("Display the subtitles grid only")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
wxGetApp().frame->SetDisplayMode(0,0);
|
wxGetApp().frame->SetDisplayMode(0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return !wxGetApp().frame->IsAudioShown() && !wxGetApp().frame->IsVideoShown();
|
return !wxGetApp().frame->IsAudioShown() && !wxGetApp().frame->IsVideoShown();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -130,15 +130,15 @@ struct app_display_video_subs : public Command {
|
||||||
STR_HELP("Display video and the subtitles grid only")
|
STR_HELP("Display video and the subtitles grid only")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
wxGetApp().frame->SetDisplayMode(1,0);
|
wxGetApp().frame->SetDisplayMode(1,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->videoController->IsLoaded() && !c->dialog->Get<DialogDetachedVideo>();
|
return c->videoController->IsLoaded() && !c->dialog->Get<DialogDetachedVideo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return !wxGetApp().frame->IsAudioShown() && wxGetApp().frame->IsVideoShown();
|
return !wxGetApp().frame->IsAudioShown() && wxGetApp().frame->IsVideoShown();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -149,7 +149,7 @@ struct app_exit : public Command {
|
||||||
STR_DISP("Exit")
|
STR_DISP("Exit")
|
||||||
STR_HELP("Exit the application")
|
STR_HELP("Exit the application")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
wxGetApp().frame->Close();
|
wxGetApp().frame->Close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -160,7 +160,7 @@ struct app_language : public Command {
|
||||||
STR_DISP("Language")
|
STR_DISP("Language")
|
||||||
STR_HELP("Select Aegisub interface language")
|
STR_HELP("Select Aegisub interface language")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
// Get language
|
// Get language
|
||||||
wxString new_language = wxGetApp().locale.PickLanguage();
|
wxString new_language = wxGetApp().locale.PickLanguage();
|
||||||
if (!new_language) return;
|
if (!new_language) return;
|
||||||
|
@ -184,7 +184,7 @@ struct app_log : public Command {
|
||||||
STR_DISP("Log window")
|
STR_DISP("Log window")
|
||||||
STR_HELP("View the event log")
|
STR_HELP("View the event log")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->dialog->Show<LogWindow>(c);
|
c->dialog->Show<LogWindow>(c);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -195,7 +195,7 @@ struct app_new_window : public Command {
|
||||||
STR_DISP("New Window")
|
STR_DISP("New Window")
|
||||||
STR_HELP("Open a new application window")
|
STR_HELP("Open a new application window")
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
RestartAegisub();
|
RestartAegisub();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -206,7 +206,7 @@ struct app_options : public Command {
|
||||||
STR_DISP("Options")
|
STR_DISP("Options")
|
||||||
STR_HELP("Configure Aegisub")
|
STR_HELP("Configure Aegisub")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
try {
|
try {
|
||||||
while (Preferences(c->parent).ShowModal() < 0);
|
while (Preferences(c->parent).ShowModal() < 0);
|
||||||
} catch (agi::Exception& e) {
|
} catch (agi::Exception& e) {
|
||||||
|
@ -222,11 +222,11 @@ struct app_toggle_global_hotkeys : public Command {
|
||||||
STR_HELP("Toggle global hotkey overrides (Medusa Mode)")
|
STR_HELP("Toggle global hotkey overrides (Medusa Mode)")
|
||||||
CMD_TYPE(COMMAND_TOGGLE)
|
CMD_TYPE(COMMAND_TOGGLE)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return OPT_GET("Audio/Medusa Timing Hotkeys")->GetBool();
|
return OPT_GET("Audio/Medusa Timing Hotkeys")->GetBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
agi::OptionValue *opt = OPT_SET("Audio/Medusa Timing Hotkeys");
|
agi::OptionValue *opt = OPT_SET("Audio/Medusa Timing Hotkeys");
|
||||||
opt->SetBool(!opt->GetBool());
|
opt->SetBool(!opt->GetBool());
|
||||||
}
|
}
|
||||||
|
@ -237,17 +237,17 @@ struct app_toggle_toolbar : public Command {
|
||||||
STR_HELP("Toggle the main toolbar")
|
STR_HELP("Toggle the main toolbar")
|
||||||
CMD_TYPE(COMMAND_DYNAMIC_NAME)
|
CMD_TYPE(COMMAND_DYNAMIC_NAME)
|
||||||
|
|
||||||
wxString StrMenu(const agi::Context *) const {
|
wxString StrMenu(const agi::Context *) const override {
|
||||||
return OPT_GET("App/Show Toolbar")->GetBool() ?
|
return OPT_GET("App/Show Toolbar")->GetBool() ?
|
||||||
_("Hide Toolbar") :
|
_("Hide Toolbar") :
|
||||||
_("Show Toolbar");
|
_("Show Toolbar");
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString StrDisplay(const agi::Context *) const {
|
wxString StrDisplay(const agi::Context *) const override {
|
||||||
return StrMenu(0);
|
return StrMenu(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
agi::OptionValue *opt = OPT_SET("App/Show Toolbar");
|
agi::OptionValue *opt = OPT_SET("App/Show Toolbar");
|
||||||
opt->SetBool(!opt->GetBool());
|
opt->SetBool(!opt->GetBool());
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ struct app_updates : public Command {
|
||||||
STR_DISP("Check for Updates")
|
STR_DISP("Check for Updates")
|
||||||
STR_HELP("Check to see if there is a new version of Aegisub available")
|
STR_HELP("Check to see if there is a new version of Aegisub available")
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
PerformVersionCheck(true);
|
PerformVersionCheck(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace {
|
||||||
|
|
||||||
struct validate_audio_open : public Command {
|
struct validate_audio_open : public Command {
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->audioController->IsAudioOpen();
|
return c->audioController->IsAudioOpen();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -65,7 +65,7 @@ struct audio_close : public validate_audio_open {
|
||||||
STR_DISP("Close Audio")
|
STR_DISP("Close Audio")
|
||||||
STR_HELP("Close the currently open audio file")
|
STR_HELP("Close the currently open audio file")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->audioController->CloseAudio();
|
c->audioController->CloseAudio();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -76,7 +76,7 @@ struct audio_open : public Command {
|
||||||
STR_DISP("Open Audio File")
|
STR_DISP("Open Audio File")
|
||||||
STR_HELP("Open an audio file")
|
STR_HELP("Open an audio file")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
wxString str = _("Audio Formats") + " (*.aac,*.ac3,*.ape,*.dts,*.flac,*.m4a,*.mka,*.mp3,*.mp4,*.ogg,*.w64,*.wav,*.wma)|*.aac;*.ac3;*.ape;*.dts;*.flac;*.m4a;*.mka;*.mp3;*.mp4;*.ogg;*.w64;*.wav;*.wma|"
|
wxString str = _("Audio Formats") + " (*.aac,*.ac3,*.ape,*.dts,*.flac,*.m4a,*.mka,*.mp3,*.mp4,*.ogg,*.w64,*.wav,*.wma)|*.aac;*.ac3;*.ape;*.dts;*.flac;*.m4a;*.mka;*.mp3;*.mp4;*.ogg;*.w64;*.wav;*.wma|"
|
||||||
+ _("Video Formats") + " (*.asf,*.avi,*.avs,*.d2v,*.m2ts,*.m4v,*.mkv,*.mov,*.mp4,*.mpeg,*.mpg,*.ogm,*.webm,*.wmv,*.ts)|*.asf;*.avi;*.avs;*.d2v;*.m2ts;*.m4v;*.mkv;*.mov;*.mp4;*.mpeg;*.mpg;*.ogm;*.webm;*.wmv;*.ts|"
|
+ _("Video Formats") + " (*.asf,*.avi,*.avs,*.d2v,*.m2ts,*.m4v,*.mkv,*.mov,*.mp4,*.mpeg,*.mpg,*.ogm,*.webm,*.wmv,*.ts)|*.asf;*.avi;*.avs;*.d2v;*.m2ts;*.m4v;*.mkv;*.mov;*.mp4;*.mpeg;*.mpg;*.ogm;*.webm;*.wmv;*.ts|"
|
||||||
+ _("All Files") + " (*.*)|*.*";
|
+ _("All Files") + " (*.*)|*.*";
|
||||||
|
@ -99,7 +99,7 @@ struct audio_open_blank : public Command {
|
||||||
STR_DISP("Open 2h30 Blank Audio")
|
STR_DISP("Open 2h30 Blank Audio")
|
||||||
STR_HELP("Open a 150 minutes blank audio clip, for debugging")
|
STR_HELP("Open a 150 minutes blank audio clip, for debugging")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
try {
|
try {
|
||||||
c->audioController->OpenAudio("dummy-audio:silence?sr=44100&bd=16&ch=1&ln=396900000");
|
c->audioController->OpenAudio("dummy-audio:silence?sr=44100&bd=16&ch=1&ln=396900000");
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ struct audio_open_noise : public Command {
|
||||||
STR_DISP("Open 2h30 Noise Audio")
|
STR_DISP("Open 2h30 Noise Audio")
|
||||||
STR_HELP("Open a 150 minutes noise-filled audio clip, for debugging")
|
STR_HELP("Open a 150 minutes noise-filled audio clip, for debugging")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
try {
|
try {
|
||||||
c->audioController->OpenAudio("dummy-audio:noise?sr=44100&bd=16&ch=1&ln=396900000");
|
c->audioController->OpenAudio("dummy-audio:noise?sr=44100&bd=16&ch=1&ln=396900000");
|
||||||
}
|
}
|
||||||
|
@ -132,11 +132,11 @@ struct audio_open_video : public Command {
|
||||||
STR_HELP("Open the audio from the current video file")
|
STR_HELP("Open the audio from the current video file")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->videoController->IsLoaded();
|
return c->videoController->IsLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
try {
|
try {
|
||||||
c->audioController->OpenAudio(c->videoController->GetVideoName());
|
c->audioController->OpenAudio(c->videoController->GetVideoName());
|
||||||
}
|
}
|
||||||
|
@ -154,11 +154,11 @@ struct audio_view_spectrum : public Command {
|
||||||
STR_HELP("Display audio as a frequency-power spectrograph")
|
STR_HELP("Display audio as a frequency-power spectrograph")
|
||||||
CMD_TYPE(COMMAND_RADIO)
|
CMD_TYPE(COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return OPT_GET("Audio/Spectrum")->GetBool();
|
return OPT_GET("Audio/Spectrum")->GetBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
OPT_SET("Audio/Spectrum")->SetBool(true);
|
OPT_SET("Audio/Spectrum")->SetBool(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -170,11 +170,11 @@ struct audio_view_waveform : public Command {
|
||||||
STR_HELP("Display audio as a linear amplitude graph")
|
STR_HELP("Display audio as a linear amplitude graph")
|
||||||
CMD_TYPE(COMMAND_RADIO)
|
CMD_TYPE(COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return !OPT_GET("Audio/Spectrum")->GetBool();
|
return !OPT_GET("Audio/Spectrum")->GetBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
OPT_SET("Audio/Spectrum")->SetBool(false);
|
OPT_SET("Audio/Spectrum")->SetBool(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -186,11 +186,11 @@ struct audio_save_clip : public Command {
|
||||||
STR_HELP("Save an audio clip of the selected line")
|
STR_HELP("Save an audio clip of the selected line")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->audioController->IsAudioOpen() && !c->selectionController->GetSelectedSet().empty();
|
return c->audioController->IsAudioOpen() && !c->selectionController->GetSelectedSet().empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
SubtitleSelection sel = c->selectionController->GetSelectedSet();
|
SubtitleSelection sel = c->selectionController->GetSelectedSet();
|
||||||
if (sel.empty()) return;
|
if (sel.empty()) return;
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ struct audio_play_current_selection : public validate_audio_open {
|
||||||
STR_DISP("Play current audio selection")
|
STR_DISP("Play current audio selection")
|
||||||
STR_HELP("Play the current audio selection, ignoring changes made while playing")
|
STR_HELP("Play the current audio selection, ignoring changes made while playing")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
c->audioController->PlayRange(c->audioController->GetPrimaryPlaybackRange());
|
c->audioController->PlayRange(c->audioController->GetPrimaryPlaybackRange());
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ struct audio_play_current_line : public validate_audio_open {
|
||||||
STR_DISP("Play current line")
|
STR_DISP("Play current line")
|
||||||
STR_HELP("Play the audio for the current line")
|
STR_HELP("Play the audio for the current line")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
AudioTimingController *tc = c->audioController->GetTimingController();
|
AudioTimingController *tc = c->audioController->GetTimingController();
|
||||||
if (tc)
|
if (tc)
|
||||||
|
@ -238,7 +238,7 @@ struct audio_play_selection : public validate_audio_open {
|
||||||
STR_DISP("Play audio selection")
|
STR_DISP("Play audio selection")
|
||||||
STR_HELP("Play audio until the end of the selection is reached")
|
STR_HELP("Play audio until the end of the selection is reached")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
c->audioController->PlayPrimaryRange();
|
c->audioController->PlayPrimaryRange();
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ struct audio_play_toggle : public validate_audio_open {
|
||||||
STR_DISP("Play audio selection or stop")
|
STR_DISP("Play audio selection or stop")
|
||||||
STR_HELP("Play selection, or stop playback if it's already playing")
|
STR_HELP("Play selection, or stop playback if it's already playing")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->audioController->IsPlaying())
|
if (c->audioController->IsPlaying())
|
||||||
c->audioController->Stop();
|
c->audioController->Stop();
|
||||||
else {
|
else {
|
||||||
|
@ -267,11 +267,11 @@ struct audio_stop : public Command {
|
||||||
STR_HELP("Stop audio and video playback")
|
STR_HELP("Stop audio and video playback")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->audioController->IsPlaying();
|
return c->audioController->IsPlaying();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->audioController->Stop();
|
c->audioController->Stop();
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@ struct audio_play_before : public validate_audio_open {
|
||||||
STR_DISP("Play 500 ms before selection")
|
STR_DISP("Play 500 ms before selection")
|
||||||
STR_HELP("Play 500 ms before selection")
|
STR_HELP("Play 500 ms before selection")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
int begin = c->audioController->GetPrimaryPlaybackRange().begin();
|
int begin = c->audioController->GetPrimaryPlaybackRange().begin();
|
||||||
c->audioController->PlayRange(TimeRange(begin - 500, begin));
|
c->audioController->PlayRange(TimeRange(begin - 500, begin));
|
||||||
|
@ -296,7 +296,7 @@ struct audio_play_after : public validate_audio_open {
|
||||||
STR_DISP("Play 500 ms after selection")
|
STR_DISP("Play 500 ms after selection")
|
||||||
STR_HELP("Play 500 ms after selection")
|
STR_HELP("Play 500 ms after selection")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
int end = c->audioController->GetPrimaryPlaybackRange().end();
|
int end = c->audioController->GetPrimaryPlaybackRange().end();
|
||||||
c->audioController->PlayRange(TimeRange(end, end + 500));
|
c->audioController->PlayRange(TimeRange(end, end + 500));
|
||||||
|
@ -309,7 +309,7 @@ struct audio_play_end : public validate_audio_open {
|
||||||
STR_DISP("Play last 500 ms of selection")
|
STR_DISP("Play last 500 ms of selection")
|
||||||
STR_HELP("Play last 500 ms of selection")
|
STR_HELP("Play last 500 ms of selection")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
TimeRange times(c->audioController->GetPrimaryPlaybackRange());
|
TimeRange times(c->audioController->GetPrimaryPlaybackRange());
|
||||||
c->audioController->PlayToEndOfPrimary(times.end() - std::min(500, times.length()));
|
c->audioController->PlayToEndOfPrimary(times.end() - std::min(500, times.length()));
|
||||||
|
@ -322,7 +322,7 @@ struct audio_play_begin : public validate_audio_open {
|
||||||
STR_DISP("Play first 500 ms of selection")
|
STR_DISP("Play first 500 ms of selection")
|
||||||
STR_HELP("Play first 500 ms of selection")
|
STR_HELP("Play first 500 ms of selection")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
TimeRange times(c->audioController->GetPrimaryPlaybackRange());
|
TimeRange times(c->audioController->GetPrimaryPlaybackRange());
|
||||||
c->audioController->PlayRange(TimeRange(
|
c->audioController->PlayRange(TimeRange(
|
||||||
|
@ -337,7 +337,7 @@ struct audio_play_to_end : public validate_audio_open {
|
||||||
STR_DISP("Play from selection start to end of file")
|
STR_DISP("Play from selection start to end of file")
|
||||||
STR_HELP("Play from selection start to end of file")
|
STR_HELP("Play from selection start to end of file")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
c->audioController->PlayToEnd(c->audioController->GetPrimaryPlaybackRange().begin());
|
c->audioController->PlayToEnd(c->audioController->GetPrimaryPlaybackRange().begin());
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ struct audio_commit : public validate_audio_open {
|
||||||
STR_DISP("Commit")
|
STR_DISP("Commit")
|
||||||
STR_HELP("Commit any pending audio timing changes")
|
STR_HELP("Commit any pending audio timing changes")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AudioTimingController *tc = c->audioController->GetTimingController();
|
AudioTimingController *tc = c->audioController->GetTimingController();
|
||||||
if (tc) {
|
if (tc) {
|
||||||
tc->Commit();
|
tc->Commit();
|
||||||
|
@ -365,7 +365,7 @@ struct audio_commit_default : public validate_audio_open {
|
||||||
STR_DISP("Commit and use default timing for next line")
|
STR_DISP("Commit and use default timing for next line")
|
||||||
STR_HELP("Commit any pending audio timing changes and reset the next line's times to the default")
|
STR_HELP("Commit any pending audio timing changes and reset the next line's times to the default")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AudioTimingController *tc = c->audioController->GetTimingController();
|
AudioTimingController *tc = c->audioController->GetTimingController();
|
||||||
if (tc) {
|
if (tc) {
|
||||||
tc->Commit();
|
tc->Commit();
|
||||||
|
@ -380,7 +380,7 @@ struct audio_commit_next : public validate_audio_open {
|
||||||
STR_DISP("Commit and move to next line")
|
STR_DISP("Commit and move to next line")
|
||||||
STR_HELP("Commit any pending audio timing changes and move to the next line")
|
STR_HELP("Commit any pending audio timing changes and move to the next line")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AudioTimingController *tc = c->audioController->GetTimingController();
|
AudioTimingController *tc = c->audioController->GetTimingController();
|
||||||
if (tc) {
|
if (tc) {
|
||||||
tc->Commit();
|
tc->Commit();
|
||||||
|
@ -395,7 +395,7 @@ struct audio_commit_stay : public validate_audio_open {
|
||||||
STR_DISP("Commit and stay on current line")
|
STR_DISP("Commit and stay on current line")
|
||||||
STR_HELP("Commit any pending audio timing changes and stay on the current line")
|
STR_HELP("Commit any pending audio timing changes and stay on the current line")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AudioTimingController *tc = c->audioController->GetTimingController();
|
AudioTimingController *tc = c->audioController->GetTimingController();
|
||||||
if (tc) tc->Commit();
|
if (tc) tc->Commit();
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ struct audio_go_to : public validate_audio_open {
|
||||||
STR_DISP("Go to selection")
|
STR_DISP("Go to selection")
|
||||||
STR_HELP("Scroll the audio display to center on the current audio selection")
|
STR_HELP("Scroll the audio display to center on the current audio selection")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->audioBox->ScrollToActiveLine();
|
c->audioBox->ScrollToActiveLine();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -418,7 +418,7 @@ struct audio_scroll_left : public validate_audio_open {
|
||||||
STR_DISP("Scroll left")
|
STR_DISP("Scroll left")
|
||||||
STR_HELP("Scroll the audio display left")
|
STR_HELP("Scroll the audio display left")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->audioBox->ScrollAudioBy(-128);
|
c->audioBox->ScrollAudioBy(-128);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -429,7 +429,7 @@ struct audio_scroll_right : public validate_audio_open {
|
||||||
STR_DISP("Scroll right")
|
STR_DISP("Scroll right")
|
||||||
STR_HELP("Scroll the audio display right")
|
STR_HELP("Scroll the audio display right")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->audioBox->ScrollAudioBy(128);
|
c->audioBox->ScrollAudioBy(128);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -445,11 +445,11 @@ struct audio_autoscroll : public Command {
|
||||||
STR_HELP("Auto scroll audio display to selected line")
|
STR_HELP("Auto scroll audio display to selected line")
|
||||||
CMD_TYPE(COMMAND_TOGGLE)
|
CMD_TYPE(COMMAND_TOGGLE)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return OPT_GET("Audio/Auto/Scroll")->GetBool();
|
return OPT_GET("Audio/Auto/Scroll")->GetBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
toggle("Audio/Auto/Scroll");
|
toggle("Audio/Auto/Scroll");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -461,11 +461,11 @@ struct audio_autocommit : public Command {
|
||||||
STR_HELP("Automatically commit all changes")
|
STR_HELP("Automatically commit all changes")
|
||||||
CMD_TYPE(COMMAND_TOGGLE)
|
CMD_TYPE(COMMAND_TOGGLE)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return OPT_GET("Audio/Auto/Commit")->GetBool();
|
return OPT_GET("Audio/Auto/Commit")->GetBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
toggle("Audio/Auto/Commit");
|
toggle("Audio/Auto/Commit");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -477,11 +477,11 @@ struct audio_autonext : public Command {
|
||||||
STR_HELP("Automatically go to next line on commit")
|
STR_HELP("Automatically go to next line on commit")
|
||||||
CMD_TYPE(COMMAND_TOGGLE)
|
CMD_TYPE(COMMAND_TOGGLE)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return OPT_GET("Audio/Next Line on Commit")->GetBool();
|
return OPT_GET("Audio/Next Line on Commit")->GetBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
toggle("Audio/Next Line on Commit");
|
toggle("Audio/Next Line on Commit");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -493,11 +493,11 @@ struct audio_toggle_spectrum : public Command {
|
||||||
STR_HELP("Spectrum analyzer mode")
|
STR_HELP("Spectrum analyzer mode")
|
||||||
CMD_TYPE(COMMAND_TOGGLE)
|
CMD_TYPE(COMMAND_TOGGLE)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return OPT_GET("Audio/Spectrum")->GetBool();
|
return OPT_GET("Audio/Spectrum")->GetBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
toggle("Audio/Spectrum");
|
toggle("Audio/Spectrum");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -509,11 +509,11 @@ struct audio_vertical_link : public Command {
|
||||||
STR_HELP("Link vertical zoom and volume sliders")
|
STR_HELP("Link vertical zoom and volume sliders")
|
||||||
CMD_TYPE(COMMAND_TOGGLE)
|
CMD_TYPE(COMMAND_TOGGLE)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return OPT_GET("Audio/Link")->GetBool();
|
return OPT_GET("Audio/Link")->GetBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
toggle("Audio/Link");
|
toggle("Audio/Link");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -525,10 +525,10 @@ struct audio_karaoke : public Command {
|
||||||
STR_HELP("Toggle karaoke mode")
|
STR_HELP("Toggle karaoke mode")
|
||||||
CMD_TYPE(COMMAND_TOGGLE)
|
CMD_TYPE(COMMAND_TOGGLE)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *c) {
|
bool IsActive(const agi::Context *c) override {
|
||||||
return c->karaoke->IsEnabled();
|
return c->karaoke->IsEnabled();
|
||||||
}
|
}
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->karaoke->SetEnabled(!c->karaoke->IsEnabled());
|
c->karaoke->SetEnabled(!c->karaoke->IsEnabled());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct reload_all : public Command {
|
||||||
STR_DISP("Reload Automation scripts")
|
STR_DISP("Reload Automation scripts")
|
||||||
STR_HELP("Reload all Automation scripts and rescan the autoload folder")
|
STR_HELP("Reload all Automation scripts and rescan the autoload folder")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
wxGetApp().global_scripts->Reload();
|
wxGetApp().global_scripts->Reload();
|
||||||
c->local_scripts->Reload();
|
c->local_scripts->Reload();
|
||||||
StatusTimeout(_("Reloaded all Automation scripts"));
|
StatusTimeout(_("Reloaded all Automation scripts"));
|
||||||
|
@ -67,7 +67,7 @@ struct reload_autoload : public Command {
|
||||||
STR_DISP("Reload autoload Automation scripts")
|
STR_DISP("Reload autoload Automation scripts")
|
||||||
STR_HELP("Rescan the Automation autoload folder")
|
STR_HELP("Rescan the Automation autoload folder")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
wxGetApp().global_scripts->Reload();
|
wxGetApp().global_scripts->Reload();
|
||||||
StatusTimeout(_("Reloaded autoload Automation scripts"));
|
StatusTimeout(_("Reloaded autoload Automation scripts"));
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ struct open_manager : public Command {
|
||||||
STR_DISP("Automation")
|
STR_DISP("Automation")
|
||||||
STR_HELP("Open automation manager")
|
STR_HELP("Open automation manager")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->dialog->Show<DialogAutomation>(c);
|
c->dialog->Show<DialogAutomation>(c);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -90,7 +90,7 @@ struct meta : public Command {
|
||||||
STR_DISP("Automation")
|
STR_DISP("Automation")
|
||||||
STR_HELP("Open automation manager. Ctrl: Rescan autoload folder. Ctrl+Shift: Rescan autoload folder and reload all automation scripts")
|
STR_HELP("Open automation manager. Ctrl: Rescan autoload folder. Ctrl+Shift: Rescan autoload folder and reload all automation scripts")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (wxGetMouseState().CmdDown()) {
|
if (wxGetMouseState().CmdDown()) {
|
||||||
if (wxGetMouseState().ShiftDown())
|
if (wxGetMouseState().ShiftDown())
|
||||||
cmd::call("am/reload", c);
|
cmd::call("am/reload", c);
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace cmd {
|
||||||
typedef std::map<std::string, std::unique_ptr<Command>>::iterator iterator;
|
typedef std::map<std::string, std::unique_ptr<Command>>::iterator iterator;
|
||||||
|
|
||||||
static iterator find_command(std::string const& name) {
|
static iterator find_command(std::string const& name) {
|
||||||
iterator it = cmd_map.find(name);
|
auto it = cmd_map.find(name);
|
||||||
if (it == cmd_map.end())
|
if (it == cmd_map.end())
|
||||||
throw CommandNotFound(from_wx(wxString::Format(_("'%s' is not a valid command name"), to_wx(name))));
|
throw CommandNotFound(from_wx(wxString::Format(_("'%s' is not a valid command name"), to_wx(name))));
|
||||||
return it;
|
return it;
|
||||||
|
|
|
@ -74,21 +74,21 @@ namespace {
|
||||||
|
|
||||||
struct validate_sel_nonempty : public Command {
|
struct validate_sel_nonempty : public Command {
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->selectionController->GetSelectedSet().size() > 0;
|
return c->selectionController->GetSelectedSet().size() > 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct validate_video_and_sel_nonempty : public Command {
|
struct validate_video_and_sel_nonempty : public Command {
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->videoController->IsLoaded() && !c->selectionController->GetSelectedSet().empty();
|
return c->videoController->IsLoaded() && !c->selectionController->GetSelectedSet().empty();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct validate_sel_multiple : public Command {
|
struct validate_sel_multiple : public Command {
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->selectionController->GetSelectedSet().size() > 1;
|
return c->selectionController->GetSelectedSet().size() > 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -202,8 +202,8 @@ void set_tag(AssDialogue *line, boost::ptr_vector<AssDialogueBlock> &blocks, std
|
||||||
int start = at_end ? sel_end : sel_start;
|
int start = at_end ? sel_end : sel_start;
|
||||||
int blockn = block_at_pos(line->Text, start);
|
int blockn = block_at_pos(line->Text, start);
|
||||||
|
|
||||||
AssDialogueBlockPlain *plain = 0;
|
AssDialogueBlockPlain *plain = nullptr;
|
||||||
AssDialogueBlockOverride *ovr = 0;
|
AssDialogueBlockOverride *ovr = nullptr;
|
||||||
while (blockn >= 0) {
|
while (blockn >= 0) {
|
||||||
AssDialogueBlock *block = &blocks[blockn];
|
AssDialogueBlock *block = &blocks[blockn];
|
||||||
if (dynamic_cast<AssDialogueBlockDrawing*>(block))
|
if (dynamic_cast<AssDialogueBlockDrawing*>(block))
|
||||||
|
@ -267,12 +267,12 @@ void set_tag(AssDialogue *line, boost::ptr_vector<AssDialogueBlock> &blocks, std
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void commit_text(agi::Context const * const c, wxString const& desc, int sel_start = -1, int sel_end = -1, int *commit_id = 0) {
|
void commit_text(agi::Context const * const c, wxString const& desc, int sel_start = -1, int sel_end = -1, int *commit_id = nullptr) {
|
||||||
SubtitleSelection const& sel = c->selectionController->GetSelectedSet();
|
SubtitleSelection const& sel = c->selectionController->GetSelectedSet();
|
||||||
std::string text = c->selectionController->GetActiveLine()->Text;
|
std::string text = c->selectionController->GetActiveLine()->Text;
|
||||||
for_each(sel.begin(), sel.end(), [&](AssDialogue *d) { d->Text = text; });
|
for_each(sel.begin(), sel.end(), [&](AssDialogue *d) { d->Text = text; });
|
||||||
|
|
||||||
int new_commit_id = c->ass->Commit(desc, AssFile::COMMIT_DIAG_TEXT, commit_id ? *commit_id : -1, sel.size() == 1 ? *sel.begin() : 0);
|
int new_commit_id = c->ass->Commit(desc, AssFile::COMMIT_DIAG_TEXT, commit_id ? *commit_id : -1, sel.size() == 1 ? *sel.begin() : nullptr);
|
||||||
if (commit_id)
|
if (commit_id)
|
||||||
*commit_id = new_commit_id;
|
*commit_id = new_commit_id;
|
||||||
if (sel_start >= 0 && sel_end >= 0)
|
if (sel_start >= 0 && sel_end >= 0)
|
||||||
|
@ -335,7 +335,7 @@ struct edit_color_primary : public Command {
|
||||||
STR_DISP("Primary Color")
|
STR_DISP("Primary Color")
|
||||||
STR_HELP("Set the primary fill color (\\c) at the cursor position")
|
STR_HELP("Set the primary fill color (\\c) at the cursor position")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
show_color_picker(c, &AssStyle::primary, "\\c", "\\1c", "\\1a");
|
show_color_picker(c, &AssStyle::primary, "\\c", "\\1c", "\\1a");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -346,7 +346,7 @@ struct edit_color_secondary : public Command {
|
||||||
STR_DISP("Secondary Color")
|
STR_DISP("Secondary Color")
|
||||||
STR_HELP("Set the secondary (karaoke) fill color (\\2c) at the cursor position")
|
STR_HELP("Set the secondary (karaoke) fill color (\\2c) at the cursor position")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
show_color_picker(c, &AssStyle::secondary, "\\2c", "", "\\2a");
|
show_color_picker(c, &AssStyle::secondary, "\\2c", "", "\\2a");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -357,7 +357,7 @@ struct edit_color_outline : public Command {
|
||||||
STR_DISP("Outline Color")
|
STR_DISP("Outline Color")
|
||||||
STR_HELP("Set the outline color (\\3c) at the cursor position")
|
STR_HELP("Set the outline color (\\3c) at the cursor position")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
show_color_picker(c, &AssStyle::outline, "\\3c", "", "\\3a");
|
show_color_picker(c, &AssStyle::outline, "\\3c", "", "\\3a");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -368,7 +368,7 @@ struct edit_color_shadow : public Command {
|
||||||
STR_DISP("Shadow Color")
|
STR_DISP("Shadow Color")
|
||||||
STR_HELP("Set the shadow color (\\4c) at the cursor position")
|
STR_HELP("Set the shadow color (\\4c) at the cursor position")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
show_color_picker(c, &AssStyle::shadow, "\\4c", "", "\\4a");
|
show_color_picker(c, &AssStyle::shadow, "\\4c", "", "\\4a");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -379,7 +379,7 @@ struct edit_style_bold : public Command {
|
||||||
STR_DISP("Toggle Bold")
|
STR_DISP("Toggle Bold")
|
||||||
STR_HELP("Toggle bold (\\b) for the current selection or at the current cursor position")
|
STR_HELP("Toggle bold (\\b) for the current selection or at the current cursor position")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
toggle_override_tag(c, &AssStyle::bold, "\\b", _("toggle bold"));
|
toggle_override_tag(c, &AssStyle::bold, "\\b", _("toggle bold"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -390,7 +390,7 @@ struct edit_style_italic : public Command {
|
||||||
STR_DISP("Toggle Italics")
|
STR_DISP("Toggle Italics")
|
||||||
STR_HELP("Toggle italics (\\i) for the current selection or at the current cursor position")
|
STR_HELP("Toggle italics (\\i) for the current selection or at the current cursor position")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
toggle_override_tag(c, &AssStyle::italic, "\\i", _("toggle italic"));
|
toggle_override_tag(c, &AssStyle::italic, "\\i", _("toggle italic"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -401,7 +401,7 @@ struct edit_style_underline : public Command {
|
||||||
STR_DISP("Toggle Underline")
|
STR_DISP("Toggle Underline")
|
||||||
STR_HELP("Toggle underline (\\u) for the current selection or at the current cursor position")
|
STR_HELP("Toggle underline (\\u) for the current selection or at the current cursor position")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
toggle_override_tag(c, &AssStyle::underline, "\\u", _("toggle underline"));
|
toggle_override_tag(c, &AssStyle::underline, "\\u", _("toggle underline"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -412,7 +412,7 @@ struct edit_style_strikeout : public Command {
|
||||||
STR_DISP("Toggle Strikeout")
|
STR_DISP("Toggle Strikeout")
|
||||||
STR_HELP("Toggle strikeout (\\s) for the current selection or at the current cursor position")
|
STR_HELP("Toggle strikeout (\\s) for the current selection or at the current cursor position")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
toggle_override_tag(c, &AssStyle::strikeout, "\\s", _("toggle strikeout"));
|
toggle_override_tag(c, &AssStyle::strikeout, "\\s", _("toggle strikeout"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -423,7 +423,7 @@ struct edit_font : public Command {
|
||||||
STR_DISP("Font Face")
|
STR_DISP("Font Face")
|
||||||
STR_HELP("Select a font face and size")
|
STR_HELP("Select a font face and size")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AssDialogue *const line = c->selectionController->GetActiveLine();
|
AssDialogue *const line = c->selectionController->GetActiveLine();
|
||||||
boost::ptr_vector<AssDialogueBlock> blocks(line->ParseTags());
|
boost::ptr_vector<AssDialogueBlock> blocks(line->ParseTags());
|
||||||
const int blockn = block_at_pos(line->Text, c->textSelectionController->GetInsertionPoint());
|
const int blockn = block_at_pos(line->Text, c->textSelectionController->GetInsertionPoint());
|
||||||
|
@ -468,7 +468,7 @@ struct edit_find_replace : public Command {
|
||||||
STR_DISP("Find and Replace")
|
STR_DISP("Find and Replace")
|
||||||
STR_HELP("Find and replace words in subtitles")
|
STR_HELP("Find and replace words in subtitles")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
DialogSearchReplace::Show(c, true);
|
DialogSearchReplace::Show(c, true);
|
||||||
}
|
}
|
||||||
|
@ -531,7 +531,7 @@ struct edit_line_copy : public validate_sel_nonempty {
|
||||||
STR_DISP("Copy Lines")
|
STR_DISP("Copy Lines")
|
||||||
STR_HELP("Copy subtitles to the clipboard")
|
STR_HELP("Copy subtitles to the clipboard")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
// Ideally we'd let the control's keydown handler run and only deal
|
// Ideally we'd let the control's keydown handler run and only deal
|
||||||
// with the events not processed by it, but that doesn't seem to be
|
// with the events not processed by it, but that doesn't seem to be
|
||||||
// possible with how wx implements key event handling - the native
|
// possible with how wx implements key event handling - the native
|
||||||
|
@ -553,7 +553,7 @@ struct edit_line_cut: public validate_sel_nonempty {
|
||||||
STR_DISP("Cut Lines")
|
STR_DISP("Cut Lines")
|
||||||
STR_HELP("Cut subtitles")
|
STR_HELP("Cut subtitles")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (wxTextEntryBase *ctrl = dynamic_cast<wxTextEntryBase*>(c->parent->FindFocus()))
|
if (wxTextEntryBase *ctrl = dynamic_cast<wxTextEntryBase*>(c->parent->FindFocus()))
|
||||||
ctrl->Cut();
|
ctrl->Cut();
|
||||||
else {
|
else {
|
||||||
|
@ -569,7 +569,7 @@ struct edit_line_delete : public validate_sel_nonempty {
|
||||||
STR_DISP("Delete Lines")
|
STR_DISP("Delete Lines")
|
||||||
STR_HELP("Delete currently selected lines")
|
STR_HELP("Delete currently selected lines")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
delete_lines(c, _("delete lines"));
|
delete_lines(c, _("delete lines"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -653,7 +653,7 @@ struct edit_line_duplicate : public validate_sel_nonempty {
|
||||||
STR_DISP("Duplicate Lines")
|
STR_DISP("Duplicate Lines")
|
||||||
STR_HELP("Duplicate the selected lines")
|
STR_HELP("Duplicate the selected lines")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
duplicate_lines(c, 0);
|
duplicate_lines(c, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -665,7 +665,7 @@ struct edit_line_duplicate_shift : public validate_video_and_sel_nonempty {
|
||||||
STR_HELP("Split the current line into a line which ends on the current frame and a line which starts on the next frame")
|
STR_HELP("Split the current line into a line which ends on the current frame and a line which starts on the next frame")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
duplicate_lines(c, 1);
|
duplicate_lines(c, 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -677,7 +677,7 @@ struct edit_line_duplicate_shift_back : public validate_video_and_sel_nonempty {
|
||||||
STR_HELP("Split the current line into a line which ends on the previous frame and a line which starts on the current frame")
|
STR_HELP("Split the current line into a line which ends on the previous frame and a line which starts on the current frame")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
duplicate_lines(c, -1);
|
duplicate_lines(c, -1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -685,7 +685,7 @@ struct edit_line_duplicate_shift_back : public validate_video_and_sel_nonempty {
|
||||||
static void combine_lines(agi::Context *c, void (*combiner)(AssDialogue *, AssDialogue *), wxString const& message) {
|
static void combine_lines(agi::Context *c, void (*combiner)(AssDialogue *, AssDialogue *), wxString const& message) {
|
||||||
SubtitleSelection sel = c->selectionController->GetSelectedSet();
|
SubtitleSelection sel = c->selectionController->GetSelectedSet();
|
||||||
|
|
||||||
AssDialogue *first = 0;
|
AssDialogue *first = nullptr;
|
||||||
for (entryIter it = c->ass->Line.begin(); it != c->ass->Line.end(); ) {
|
for (entryIter it = c->ass->Line.begin(); it != c->ass->Line.end(); ) {
|
||||||
AssDialogue *diag = dynamic_cast<AssDialogue*>(&*it++);
|
AssDialogue *diag = dynamic_cast<AssDialogue*>(&*it++);
|
||||||
if (!diag || !sel.count(diag))
|
if (!diag || !sel.count(diag))
|
||||||
|
@ -723,7 +723,7 @@ struct edit_line_join_as_karaoke : public validate_sel_multiple {
|
||||||
STR_DISP("As Karaoke")
|
STR_DISP("As Karaoke")
|
||||||
STR_HELP("Join selected lines in a single one, as karaoke")
|
STR_HELP("Join selected lines in a single one, as karaoke")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
combine_lines(c, combine_karaoke, _("join as karaoke"));
|
combine_lines(c, combine_karaoke, _("join as karaoke"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -734,7 +734,7 @@ struct edit_line_join_concatenate : public validate_sel_multiple {
|
||||||
STR_DISP("Concatenate")
|
STR_DISP("Concatenate")
|
||||||
STR_HELP("Join selected lines in a single one, concatenating text together")
|
STR_HELP("Join selected lines in a single one, concatenating text together")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
combine_lines(c, combine_concat, _("join lines"));
|
combine_lines(c, combine_concat, _("join lines"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -745,7 +745,7 @@ struct edit_line_join_keep_first : public validate_sel_multiple {
|
||||||
STR_DISP("Keep First")
|
STR_DISP("Keep First")
|
||||||
STR_HELP("Join selected lines in a single one, keeping text of first and discarding remaining")
|
STR_HELP("Join selected lines in a single one, keeping text of first and discarding remaining")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
combine_lines(c, combine_drop, _("join lines"));
|
combine_lines(c, combine_drop, _("join lines"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -788,7 +788,7 @@ struct edit_line_paste : public Command {
|
||||||
STR_HELP("Paste subtitles")
|
STR_HELP("Paste subtitles")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
bool Validate(const agi::Context *) {
|
bool Validate(const agi::Context *) override {
|
||||||
bool can_paste = false;
|
bool can_paste = false;
|
||||||
if (wxTheClipboard->Open()) {
|
if (wxTheClipboard->Open()) {
|
||||||
can_paste = wxTheClipboard->IsSupported(wxDF_TEXT);
|
can_paste = wxTheClipboard->IsSupported(wxDF_TEXT);
|
||||||
|
@ -797,7 +797,7 @@ struct edit_line_paste : public Command {
|
||||||
return can_paste;
|
return can_paste;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (wxTextEntryBase *ctrl = dynamic_cast<wxTextEntryBase*>(c->parent->FindFocus())) {
|
if (wxTextEntryBase *ctrl = dynamic_cast<wxTextEntryBase*>(c->parent->FindFocus())) {
|
||||||
if (!try_paste_lines(c))
|
if (!try_paste_lines(c))
|
||||||
ctrl->Paste();
|
ctrl->Paste();
|
||||||
|
@ -819,7 +819,7 @@ struct edit_line_paste_over : public Command {
|
||||||
STR_HELP("Paste subtitles over others")
|
STR_HELP("Paste subtitles over others")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
bool can_paste = !c->selectionController->GetSelectedSet().empty();
|
bool can_paste = !c->selectionController->GetSelectedSet().empty();
|
||||||
if (can_paste && wxTheClipboard->Open()) {
|
if (can_paste && wxTheClipboard->Open()) {
|
||||||
can_paste = wxTheClipboard->IsSupported(wxDF_TEXT);
|
can_paste = wxTheClipboard->IsSupported(wxDF_TEXT);
|
||||||
|
@ -828,7 +828,7 @@ struct edit_line_paste_over : public Command {
|
||||||
return can_paste;
|
return can_paste;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
auto const& sel = c->selectionController->GetSelectedSet();
|
auto const& sel = c->selectionController->GetSelectedSet();
|
||||||
std::vector<bool> pasteOverOptions;
|
std::vector<bool> pasteOverOptions;
|
||||||
|
|
||||||
|
@ -911,7 +911,7 @@ struct edit_line_recombine : public validate_sel_multiple {
|
||||||
STR_DISP("Recombine Lines")
|
STR_DISP("Recombine Lines")
|
||||||
STR_HELP("Recombine subtitles which have been split and merged")
|
STR_HELP("Recombine subtitles which have been split and merged")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
auto sel_set = c->selectionController->GetSelectedSet();
|
auto sel_set = c->selectionController->GetSelectedSet();
|
||||||
if (sel_set.size() < 2) return;
|
if (sel_set.size() < 2) return;
|
||||||
|
|
||||||
|
@ -986,7 +986,7 @@ struct edit_line_split_by_karaoke : public validate_sel_nonempty {
|
||||||
STR_DISP("Split Lines (by karaoke)")
|
STR_DISP("Split Lines (by karaoke)")
|
||||||
STR_HELP("Use karaoke timing to split line into multiple smaller lines")
|
STR_HELP("Use karaoke timing to split line into multiple smaller lines")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AssKaraoke::SplitLines(c->selectionController->GetSelectedSet(), c);
|
AssKaraoke::SplitLines(c->selectionController->GetSelectedSet(), c);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -996,7 +996,7 @@ void split_lines(agi::Context *c, Func&& set_time) {
|
||||||
int pos = c->textSelectionController->GetSelectionStart();
|
int pos = c->textSelectionController->GetSelectionStart();
|
||||||
|
|
||||||
AssDialogue *n1 = c->selectionController->GetActiveLine();
|
AssDialogue *n1 = c->selectionController->GetActiveLine();
|
||||||
AssDialogue *n2 = new AssDialogue(*n1);
|
auto n2 = new AssDialogue(*n1);
|
||||||
c->ass->Line.insert(++c->ass->Line.iterator_to(*n1), *n2);
|
c->ass->Line.insert(++c->ass->Line.iterator_to(*n1), *n2);
|
||||||
|
|
||||||
std::string orig = n1->Text;
|
std::string orig = n1->Text;
|
||||||
|
@ -1014,7 +1014,7 @@ struct edit_line_split_estimate : public validate_video_and_sel_nonempty {
|
||||||
STR_DISP("Split at cursor (estimate times)")
|
STR_DISP("Split at cursor (estimate times)")
|
||||||
STR_HELP("Split the current line at the cursor, dividing the original line's duration between the new ones")
|
STR_HELP("Split the current line at the cursor, dividing the original line's duration between the new ones")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
split_lines(c, [](AssDialogue *n1, AssDialogue *n2) {
|
split_lines(c, [](AssDialogue *n1, AssDialogue *n2) {
|
||||||
size_t len = n1->Text.get().size() + n2->Text.get().size();
|
size_t len = n1->Text.get().size() + n2->Text.get().size();
|
||||||
if (!len) return;
|
if (!len) return;
|
||||||
|
@ -1030,7 +1030,7 @@ struct edit_line_split_preserve : public validate_sel_nonempty {
|
||||||
STR_DISP("Split at cursor (preserve times)")
|
STR_DISP("Split at cursor (preserve times)")
|
||||||
STR_HELP("Split the current line at the cursor, setting both lines to the original line's times")
|
STR_HELP("Split the current line at the cursor, setting both lines to the original line's times")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
split_lines(c, [](AssDialogue *, AssDialogue *) { });
|
split_lines(c, [](AssDialogue *, AssDialogue *) { });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1041,7 +1041,7 @@ struct edit_line_split_video : public validate_video_and_sel_nonempty {
|
||||||
STR_DISP("Split at cursor (at video frame)")
|
STR_DISP("Split at cursor (at video frame)")
|
||||||
STR_HELP("Split the current line at the cursor, dividing the line's duration at the current video frame")
|
STR_HELP("Split the current line at the cursor, dividing the line's duration at the current video frame")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
split_lines(c, [&](AssDialogue *n1, AssDialogue *n2) {
|
split_lines(c, [&](AssDialogue *n1, AssDialogue *n2) {
|
||||||
int cur_frame = mid(
|
int cur_frame = mid(
|
||||||
c->videoController->FrameAtTime(n1->Start, agi::vfr::START),
|
c->videoController->FrameAtTime(n1->Start, agi::vfr::START),
|
||||||
|
@ -1057,22 +1057,22 @@ struct edit_redo : public Command {
|
||||||
STR_HELP("Redo last undone action")
|
STR_HELP("Redo last undone action")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_DYNAMIC_NAME)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_DYNAMIC_NAME)
|
||||||
|
|
||||||
wxString StrMenu(const agi::Context *c) const {
|
wxString StrMenu(const agi::Context *c) const override {
|
||||||
return c->subsController->IsRedoStackEmpty() ?
|
return c->subsController->IsRedoStackEmpty() ?
|
||||||
_("Nothing to &redo") :
|
_("Nothing to &redo") :
|
||||||
wxString::Format(_("&Redo %s"), c->subsController->GetRedoDescription());
|
wxString::Format(_("&Redo %s"), c->subsController->GetRedoDescription());
|
||||||
}
|
}
|
||||||
wxString StrDisplay(const agi::Context *c) const {
|
wxString StrDisplay(const agi::Context *c) const override {
|
||||||
return c->subsController->IsRedoStackEmpty() ?
|
return c->subsController->IsRedoStackEmpty() ?
|
||||||
_("Nothing to redo") :
|
_("Nothing to redo") :
|
||||||
wxString::Format(_("Redo %s"), c->subsController->GetRedoDescription());
|
wxString::Format(_("Redo %s"), c->subsController->GetRedoDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return !c->subsController->IsRedoStackEmpty();
|
return !c->subsController->IsRedoStackEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->subsController->Redo();
|
c->subsController->Redo();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1082,22 +1082,22 @@ struct edit_undo : public Command {
|
||||||
STR_HELP("Undo last action")
|
STR_HELP("Undo last action")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_DYNAMIC_NAME)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_DYNAMIC_NAME)
|
||||||
|
|
||||||
wxString StrMenu(const agi::Context *c) const {
|
wxString StrMenu(const agi::Context *c) const override {
|
||||||
return c->subsController->IsUndoStackEmpty() ?
|
return c->subsController->IsUndoStackEmpty() ?
|
||||||
_("Nothing to &undo") :
|
_("Nothing to &undo") :
|
||||||
wxString::Format(_("&Undo %s"), c->subsController->GetUndoDescription());
|
wxString::Format(_("&Undo %s"), c->subsController->GetUndoDescription());
|
||||||
}
|
}
|
||||||
wxString StrDisplay(const agi::Context *c) const {
|
wxString StrDisplay(const agi::Context *c) const override {
|
||||||
return c->subsController->IsUndoStackEmpty() ?
|
return c->subsController->IsUndoStackEmpty() ?
|
||||||
_("Nothing to undo") :
|
_("Nothing to undo") :
|
||||||
wxString::Format(_("Undo %s"), c->subsController->GetUndoDescription());
|
wxString::Format(_("Undo %s"), c->subsController->GetUndoDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return !c->subsController->IsUndoStackEmpty();
|
return !c->subsController->IsUndoStackEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->subsController->Undo();
|
c->subsController->Undo();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1108,7 +1108,7 @@ struct edit_revert : public Command {
|
||||||
STR_MENU("Revert")
|
STR_MENU("Revert")
|
||||||
STR_HELP("Revert the active line to its initial state (shown in the upper editor)")
|
STR_HELP("Revert the active line to its initial state (shown in the upper editor)")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AssDialogue *line = c->selectionController->GetActiveLine();
|
AssDialogue *line = c->selectionController->GetActiveLine();
|
||||||
line->Text = c->initialLineState->GetInitialText();
|
line->Text = c->initialLineState->GetInitialText();
|
||||||
c->ass->Commit(_("revert line"), AssFile::COMMIT_DIAG_TEXT, -1, line);
|
c->ass->Commit(_("revert line"), AssFile::COMMIT_DIAG_TEXT, -1, line);
|
||||||
|
@ -1121,7 +1121,7 @@ struct edit_clear : public Command {
|
||||||
STR_MENU("Clear")
|
STR_MENU("Clear")
|
||||||
STR_HELP("Clear the current line's text")
|
STR_HELP("Clear the current line's text")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AssDialogue *line = c->selectionController->GetActiveLine();
|
AssDialogue *line = c->selectionController->GetActiveLine();
|
||||||
line->Text = "";
|
line->Text = "";
|
||||||
c->ass->Commit(_("clear line"), AssFile::COMMIT_DIAG_TEXT, -1, line);
|
c->ass->Commit(_("clear line"), AssFile::COMMIT_DIAG_TEXT, -1, line);
|
||||||
|
@ -1135,7 +1135,7 @@ struct edit_clear_text : public Command {
|
||||||
STR_MENU("Clear Text")
|
STR_MENU("Clear Text")
|
||||||
STR_HELP("Clear the current line's text, leaving override tags")
|
STR_HELP("Clear the current line's text, leaving override tags")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AssDialogue *line = c->selectionController->GetActiveLine();
|
AssDialogue *line = c->selectionController->GetActiveLine();
|
||||||
boost::ptr_vector<AssDialogueBlock> blocks(line->ParseTags());
|
boost::ptr_vector<AssDialogueBlock> blocks(line->ParseTags());
|
||||||
line->Text = join(blocks
|
line->Text = join(blocks
|
||||||
|
@ -1152,7 +1152,7 @@ struct edit_insert_original : public Command {
|
||||||
STR_MENU("Insert Original")
|
STR_MENU("Insert Original")
|
||||||
STR_HELP("Insert the original line text at the cursor")
|
STR_HELP("Insert the original line text at the cursor")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AssDialogue *line = c->selectionController->GetActiveLine();
|
AssDialogue *line = c->selectionController->GetActiveLine();
|
||||||
int sel_start = c->textSelectionController->GetSelectionStart();
|
int sel_start = c->textSelectionController->GetSelectionStart();
|
||||||
int sel_end = c->textSelectionController->GetSelectionEnd();
|
int sel_end = c->textSelectionController->GetSelectionEnd();
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct grid_line_next : public Command {
|
||||||
STR_DISP("Next Line")
|
STR_DISP("Next Line")
|
||||||
STR_HELP("Move to the next subtitle line")
|
STR_HELP("Move to the next subtitle line")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->selectionController->NextLine();
|
c->selectionController->NextLine();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -64,7 +64,7 @@ struct grid_line_next_create : public Command {
|
||||||
STR_DISP("Next Line")
|
STR_DISP("Next Line")
|
||||||
STR_HELP("Move to the next subtitle line, creating a new one if needed")
|
STR_HELP("Move to the next subtitle line, creating a new one if needed")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AudioTimingController *tc = c->audioController->GetTimingController();
|
AudioTimingController *tc = c->audioController->GetTimingController();
|
||||||
if (tc)
|
if (tc)
|
||||||
tc->Commit();
|
tc->Commit();
|
||||||
|
@ -72,7 +72,7 @@ struct grid_line_next_create : public Command {
|
||||||
AssDialogue *cur = c->selectionController->GetActiveLine();
|
AssDialogue *cur = c->selectionController->GetActiveLine();
|
||||||
c->selectionController->NextLine();
|
c->selectionController->NextLine();
|
||||||
if (cur == c->selectionController->GetActiveLine()) {
|
if (cur == c->selectionController->GetActiveLine()) {
|
||||||
AssDialogue *newline = new AssDialogue;
|
auto newline = new AssDialogue;
|
||||||
newline->Start = cur->End;
|
newline->Start = cur->End;
|
||||||
newline->End = cur->End + OPT_GET("Timing/Default Duration")->GetInt();
|
newline->End = cur->End + OPT_GET("Timing/Default Duration")->GetInt();
|
||||||
newline->Style = cur->Style;
|
newline->Style = cur->Style;
|
||||||
|
@ -91,7 +91,7 @@ struct grid_line_prev : public Command {
|
||||||
STR_DISP("Previous Line")
|
STR_DISP("Previous Line")
|
||||||
STR_HELP("Move to the previous line")
|
STR_HELP("Move to the previous line")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->selectionController->PrevLine();
|
c->selectionController->PrevLine();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -102,7 +102,7 @@ struct grid_sort_actor : public Command {
|
||||||
STR_DISP("Actor Name")
|
STR_DISP("Actor Name")
|
||||||
STR_HELP("Sort all subtitles by their actor names")
|
STR_HELP("Sort all subtitles by their actor names")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->ass->Sort(AssFile::CompActor);
|
c->ass->Sort(AssFile::CompActor);
|
||||||
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ struct grid_sort_actor : public Command {
|
||||||
struct validate_sel_multiple : public Command {
|
struct validate_sel_multiple : public Command {
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->selectionController->GetSelectedSet().size() > 1;
|
return c->selectionController->GetSelectedSet().size() > 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -122,7 +122,7 @@ struct grid_sort_actor_selected : public validate_sel_multiple {
|
||||||
STR_DISP("Actor Name")
|
STR_DISP("Actor Name")
|
||||||
STR_HELP("Sort selected subtitles by their actor names")
|
STR_HELP("Sort selected subtitles by their actor names")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->ass->Sort(AssFile::CompActor, c->selectionController->GetSelectedSet());
|
c->ass->Sort(AssFile::CompActor, c->selectionController->GetSelectedSet());
|
||||||
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ struct grid_sort_effect : public Command {
|
||||||
STR_DISP("Effect")
|
STR_DISP("Effect")
|
||||||
STR_HELP("Sort all subtitles by their effects")
|
STR_HELP("Sort all subtitles by their effects")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->ass->Sort(AssFile::CompEffect);
|
c->ass->Sort(AssFile::CompEffect);
|
||||||
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ struct grid_sort_effect_selected : public validate_sel_multiple {
|
||||||
STR_DISP("Effect")
|
STR_DISP("Effect")
|
||||||
STR_HELP("Sort selected subtitles by their effects")
|
STR_HELP("Sort selected subtitles by their effects")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->ass->Sort(AssFile::CompEffect, c->selectionController->GetSelectedSet());
|
c->ass->Sort(AssFile::CompEffect, c->selectionController->GetSelectedSet());
|
||||||
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ struct grid_sort_end : public Command {
|
||||||
STR_DISP("End Time")
|
STR_DISP("End Time")
|
||||||
STR_HELP("Sort all subtitles by their end times")
|
STR_HELP("Sort all subtitles by their end times")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->ass->Sort(AssFile::CompEnd);
|
c->ass->Sort(AssFile::CompEnd);
|
||||||
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ struct grid_sort_end_selected : public validate_sel_multiple {
|
||||||
STR_DISP("End Time")
|
STR_DISP("End Time")
|
||||||
STR_HELP("Sort selected subtitles by their end times")
|
STR_HELP("Sort selected subtitles by their end times")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->ass->Sort(AssFile::CompEnd, c->selectionController->GetSelectedSet());
|
c->ass->Sort(AssFile::CompEnd, c->selectionController->GetSelectedSet());
|
||||||
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ struct grid_sort_layer : public Command {
|
||||||
STR_DISP("Layer")
|
STR_DISP("Layer")
|
||||||
STR_HELP("Sort all subtitles by their layer number")
|
STR_HELP("Sort all subtitles by their layer number")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->ass->Sort(AssFile::CompLayer);
|
c->ass->Sort(AssFile::CompLayer);
|
||||||
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ struct grid_sort_layer_selected : public validate_sel_multiple {
|
||||||
STR_DISP("Layer")
|
STR_DISP("Layer")
|
||||||
STR_HELP("Sort selected subtitles by their layer number")
|
STR_HELP("Sort selected subtitles by their layer number")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->ass->Sort(AssFile::CompLayer, c->selectionController->GetSelectedSet());
|
c->ass->Sort(AssFile::CompLayer, c->selectionController->GetSelectedSet());
|
||||||
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ struct grid_sort_start : public Command {
|
||||||
STR_DISP("Start Time")
|
STR_DISP("Start Time")
|
||||||
STR_HELP("Sort all subtitles by their start times")
|
STR_HELP("Sort all subtitles by their start times")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->ass->Sort();
|
c->ass->Sort();
|
||||||
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ struct grid_sort_start_selected : public validate_sel_multiple {
|
||||||
STR_DISP("Start Time")
|
STR_DISP("Start Time")
|
||||||
STR_HELP("Sort selected subtitles by their start times")
|
STR_HELP("Sort selected subtitles by their start times")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->ass->Sort(AssFile::CompStart, c->selectionController->GetSelectedSet());
|
c->ass->Sort(AssFile::CompStart, c->selectionController->GetSelectedSet());
|
||||||
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ struct grid_sort_style : public Command {
|
||||||
STR_DISP("Style Name")
|
STR_DISP("Style Name")
|
||||||
STR_HELP("Sort all subtitles by their style names")
|
STR_HELP("Sort all subtitles by their style names")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->ass->Sort(AssFile::CompStyle);
|
c->ass->Sort(AssFile::CompStyle);
|
||||||
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ struct grid_sort_style_selected : public validate_sel_multiple {
|
||||||
STR_DISP("Style Name")
|
STR_DISP("Style Name")
|
||||||
STR_HELP("Sort selected subtitles by their style names")
|
STR_HELP("Sort selected subtitles by their style names")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->ass->Sort(AssFile::CompStyle, c->selectionController->GetSelectedSet());
|
c->ass->Sort(AssFile::CompStyle, c->selectionController->GetSelectedSet());
|
||||||
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
c->ass->Commit(_("sort"), AssFile::COMMIT_ORDER);
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ struct grid_tag_cycle_hiding : public Command {
|
||||||
STR_DISP("Cycle Tag Hiding Mode")
|
STR_DISP("Cycle Tag Hiding Mode")
|
||||||
STR_HELP("Cycle through tag hiding modes")
|
STR_HELP("Cycle through tag hiding modes")
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
int tagMode = OPT_GET("Subtitle/Grid/Hide Overrides")->GetInt();
|
int tagMode = OPT_GET("Subtitle/Grid/Hide Overrides")->GetInt();
|
||||||
|
|
||||||
// Cycle to next
|
// Cycle to next
|
||||||
|
@ -279,11 +279,11 @@ struct grid_tags_hide : public Command {
|
||||||
STR_HELP("Hide override tags in the subtitle grid")
|
STR_HELP("Hide override tags in the subtitle grid")
|
||||||
CMD_TYPE(COMMAND_RADIO)
|
CMD_TYPE(COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return OPT_GET("Subtitle/Grid/Hide Overrides")->GetInt() == 2;
|
return OPT_GET("Subtitle/Grid/Hide Overrides")->GetInt() == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
OPT_SET("Subtitle/Grid/Hide Overrides")->SetInt(2);
|
OPT_SET("Subtitle/Grid/Hide Overrides")->SetInt(2);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -295,11 +295,11 @@ struct grid_tags_show : public Command {
|
||||||
STR_HELP("Show full override tags in the subtitle grid")
|
STR_HELP("Show full override tags in the subtitle grid")
|
||||||
CMD_TYPE(COMMAND_RADIO)
|
CMD_TYPE(COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return OPT_GET("Subtitle/Grid/Hide Overrides")->GetInt() == 0;
|
return OPT_GET("Subtitle/Grid/Hide Overrides")->GetInt() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
OPT_SET("Subtitle/Grid/Hide Overrides")->SetInt(0);
|
OPT_SET("Subtitle/Grid/Hide Overrides")->SetInt(0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -311,11 +311,11 @@ struct grid_tags_simplify : public Command {
|
||||||
STR_HELP("Replace override tags in the subtitle grid with a simplified placeholder")
|
STR_HELP("Replace override tags in the subtitle grid with a simplified placeholder")
|
||||||
CMD_TYPE(COMMAND_RADIO)
|
CMD_TYPE(COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return OPT_GET("Subtitle/Grid/Hide Overrides")->GetInt() == 1;
|
return OPT_GET("Subtitle/Grid/Hide Overrides")->GetInt() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
OPT_SET("Subtitle/Grid/Hide Overrides")->SetInt(1);
|
OPT_SET("Subtitle/Grid/Hide Overrides")->SetInt(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -348,11 +348,11 @@ struct grid_move_up : public Command {
|
||||||
STR_HELP("Move the selected lines up one row")
|
STR_HELP("Move the selected lines up one row")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->selectionController->GetSelectedSet().size() != 0;
|
return c->selectionController->GetSelectedSet().size() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (move_one(c->ass->Line.begin(), c->ass->Line.end(), c->selectionController->GetSelectedSet(), 1))
|
if (move_one(c->ass->Line.begin(), c->ass->Line.end(), c->selectionController->GetSelectedSet(), 1))
|
||||||
c->ass->Commit(_("move lines"), AssFile::COMMIT_ORDER);
|
c->ass->Commit(_("move lines"), AssFile::COMMIT_ORDER);
|
||||||
}
|
}
|
||||||
|
@ -365,11 +365,11 @@ struct grid_move_down : public Command {
|
||||||
STR_HELP("Move the selected lines down one row")
|
STR_HELP("Move the selected lines down one row")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->selectionController->GetSelectedSet().size() != 0;
|
return c->selectionController->GetSelectedSet().size() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (move_one(--c->ass->Line.end(), c->ass->Line.begin(), c->selectionController->GetSelectedSet(), -1))
|
if (move_one(--c->ass->Line.end(), c->ass->Line.begin(), c->selectionController->GetSelectedSet(), -1))
|
||||||
c->ass->Commit(_("move lines"), AssFile::COMMIT_ORDER);
|
c->ass->Commit(_("move lines"), AssFile::COMMIT_ORDER);
|
||||||
}
|
}
|
||||||
|
@ -382,11 +382,11 @@ struct grid_swap : public Command {
|
||||||
STR_HELP("Swap the two selected lines")
|
STR_HELP("Swap the two selected lines")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->selectionController->GetSelectedSet().size() == 2;
|
return c->selectionController->GetSelectedSet().size() == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
SubtitleSelection sel = c->selectionController->GetSelectedSet();
|
SubtitleSelection sel = c->selectionController->GetSelectedSet();
|
||||||
if (sel.size() == 2) {
|
if (sel.size() == 2) {
|
||||||
(*sel.begin())->swap_nodes(**sel.rbegin());
|
(*sel.begin())->swap_nodes(**sel.rbegin());
|
||||||
|
|
|
@ -50,11 +50,11 @@ struct help_bugs : public Command {
|
||||||
STR_DISP("Bug Tracker")
|
STR_DISP("Bug Tracker")
|
||||||
STR_HELP("Visit Aegisub's bug tracker to report bugs and request new features")
|
STR_HELP("Visit Aegisub's bug tracker to report bugs and request new features")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (wxGetMouseState().CmdDown()) {
|
if (wxGetMouseState().CmdDown()) {
|
||||||
if (wxGetMouseState().ShiftDown()) {
|
if (wxGetMouseState().ShiftDown()) {
|
||||||
wxMessageBox("Now crashing with an access violation...");
|
wxMessageBox("Now crashing with an access violation...");
|
||||||
for (char *foo = (char*)0;;) *foo++ = 42;
|
for (char *foo = (char*)nullptr;;) *foo++ = 42;
|
||||||
} else {
|
} else {
|
||||||
wxMessageBox("Now crashing with an unhandled exception...");
|
wxMessageBox("Now crashing with an unhandled exception...");
|
||||||
throw c->parent;
|
throw c->parent;
|
||||||
|
@ -70,7 +70,7 @@ struct help_contents : public Command {
|
||||||
STR_DISP("Contents")
|
STR_DISP("Contents")
|
||||||
STR_HELP("Help topics")
|
STR_HELP("Help topics")
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
HelpButton::OpenPage("Main");
|
HelpButton::OpenPage("Main");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -81,7 +81,7 @@ struct help_forums : public Command {
|
||||||
STR_DISP("Forums")
|
STR_DISP("Forums")
|
||||||
STR_HELP("Visit Aegisub's forums")
|
STR_HELP("Visit Aegisub's forums")
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
wxLaunchDefaultBrowser("http://forum.aegisub.org/", wxBROWSER_NEW_WINDOW);
|
wxLaunchDefaultBrowser("http://forum.aegisub.org/", wxBROWSER_NEW_WINDOW);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -92,7 +92,7 @@ struct help_irc : public Command {
|
||||||
STR_DISP("IRC Channel")
|
STR_DISP("IRC Channel")
|
||||||
STR_HELP("Visit Aegisub's official IRC channel")
|
STR_HELP("Visit Aegisub's official IRC channel")
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
wxLaunchDefaultBrowser("irc://irc.rizon.net/aegisub", wxBROWSER_NEW_WINDOW);
|
wxLaunchDefaultBrowser("irc://irc.rizon.net/aegisub", wxBROWSER_NEW_WINDOW);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -103,7 +103,7 @@ struct help_video : public Command {
|
||||||
STR_DISP("Visual Typesetting")
|
STR_DISP("Visual Typesetting")
|
||||||
STR_HELP("Open the manual page for Visual Typesetting")
|
STR_HELP("Open the manual page for Visual Typesetting")
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
HelpButton::OpenPage("Visual Typesetting");
|
HelpButton::OpenPage("Visual Typesetting");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -114,7 +114,7 @@ struct help_website : public Command {
|
||||||
STR_DISP("Website")
|
STR_DISP("Website")
|
||||||
STR_HELP("Visit Aegisub's official website")
|
STR_HELP("Visit Aegisub's official website")
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
wxLaunchDefaultBrowser("http://www.aegisub.org/", wxBROWSER_NEW_WINDOW);
|
wxLaunchDefaultBrowser("http://www.aegisub.org/", wxBROWSER_NEW_WINDOW);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,7 +59,7 @@ wxBitmap const& get(std::string const& name, const int size) {
|
||||||
|
|
||||||
void icon_init() {
|
void icon_init() {
|
||||||
// Seems that WX doesn't install the handlers early enough for our use.
|
// Seems that WX doesn't install the handlers early enough for our use.
|
||||||
wxPNGHandler *handler = new wxPNGHandler();
|
auto handler = new wxPNGHandler();
|
||||||
wxImage::AddHandler(handler);
|
wxImage::AddHandler(handler);
|
||||||
|
|
||||||
LOG_D("icon/init") << "Generating 24x24, 16x16 icons";
|
LOG_D("icon/init") << "Generating 24x24, 16x16 icons";
|
||||||
|
|
|
@ -50,11 +50,11 @@ struct keyframe_close : public Command {
|
||||||
STR_HELP("Discard the currently loaded keyframes and use those from the video, if any")
|
STR_HELP("Discard the currently loaded keyframes and use those from the video, if any")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->videoController->OverKeyFramesLoaded();
|
return c->videoController->OverKeyFramesLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->CloseKeyframes();
|
c->videoController->CloseKeyframes();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -65,7 +65,7 @@ struct keyframe_open : public Command {
|
||||||
STR_DISP("Open Keyframes")
|
STR_DISP("Open Keyframes")
|
||||||
STR_HELP("Open a keyframe list file")
|
STR_HELP("Open a keyframe list file")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
auto filename = OpenFileSelector(
|
auto filename = OpenFileSelector(
|
||||||
_("Open keyframes file"),
|
_("Open keyframes file"),
|
||||||
"Path/Last/Keyframes", "" ,".txt",
|
"Path/Last/Keyframes", "" ,".txt",
|
||||||
|
@ -84,11 +84,11 @@ struct keyframe_save : public Command {
|
||||||
STR_HELP("Save the current list of keyframes to a file")
|
STR_HELP("Save the current list of keyframes to a file")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->videoController->KeyFramesLoaded();
|
return c->videoController->KeyFramesLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
auto filename = SaveFileSelector(_("Save keyframes file"), "Path/Last/Keyframes", "", "*.key.txt", "Text files (*.txt)|*.txt", c->parent);
|
auto filename = SaveFileSelector(_("Save keyframes file"), "Path/Last/Keyframes", "", "*.key.txt", "Text files (*.txt)|*.txt", c->parent);
|
||||||
if (!filename.empty())
|
if (!filename.empty())
|
||||||
c->videoController->SaveKeyframes(filename);
|
c->videoController->SaveKeyframes(filename);
|
||||||
|
|
|
@ -63,14 +63,14 @@ namespace {
|
||||||
|
|
||||||
struct validate_nonempty_selection : public Command {
|
struct validate_nonempty_selection : public Command {
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return !c->selectionController->GetSelectedSet().empty();
|
return !c->selectionController->GetSelectedSet().empty();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct validate_nonempty_selection_video_loaded : public Command {
|
struct validate_nonempty_selection_video_loaded : public Command {
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->videoController->IsLoaded() && !c->selectionController->GetSelectedSet().empty();
|
return c->videoController->IsLoaded() && !c->selectionController->GetSelectedSet().empty();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -81,7 +81,7 @@ struct subtitle_attachment : public Command {
|
||||||
STR_DISP("Attachments")
|
STR_DISP("Attachments")
|
||||||
STR_HELP("Open the attachment manager dialog")
|
STR_HELP("Open the attachment manager dialog")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
DialogAttachments(c->parent, c->ass).ShowModal();
|
DialogAttachments(c->parent, c->ass).ShowModal();
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ struct subtitle_find : public Command {
|
||||||
STR_DISP("Find")
|
STR_DISP("Find")
|
||||||
STR_HELP("Search for text the in subtitles")
|
STR_HELP("Search for text the in subtitles")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
DialogSearchReplace::Show(c, false);
|
DialogSearchReplace::Show(c, false);
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ struct subtitle_find_next : public Command {
|
||||||
STR_DISP("Find Next")
|
STR_DISP("Find Next")
|
||||||
STR_HELP("Find next match of last search")
|
STR_HELP("Find next match of last search")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
if (!c->search->FindNext())
|
if (!c->search->FindNext())
|
||||||
DialogSearchReplace::Show(c, false);
|
DialogSearchReplace::Show(c, false);
|
||||||
|
@ -113,7 +113,7 @@ struct subtitle_find_next : public Command {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void insert_subtitle_at_video(agi::Context *c, bool after) {
|
static void insert_subtitle_at_video(agi::Context *c, bool after) {
|
||||||
AssDialogue *def = new AssDialogue;
|
auto def = new AssDialogue;
|
||||||
int video_ms = c->videoController->TimeAtFrame(c->videoController->GetFrameN(), agi::vfr::START);
|
int video_ms = c->videoController->TimeAtFrame(c->videoController->GetFrameN(), agi::vfr::START);
|
||||||
def->Start = video_ms;
|
def->Start = video_ms;
|
||||||
def->End = video_ms + OPT_GET("Timing/Default Duration")->GetInt();
|
def->End = video_ms + OPT_GET("Timing/Default Duration")->GetInt();
|
||||||
|
@ -136,10 +136,10 @@ struct subtitle_insert_after : public validate_nonempty_selection {
|
||||||
STR_DISP("After Current")
|
STR_DISP("After Current")
|
||||||
STR_HELP("Insert a new line after the current one")
|
STR_HELP("Insert a new line after the current one")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AssDialogue *active_line = c->selectionController->GetActiveLine();
|
AssDialogue *active_line = c->selectionController->GetActiveLine();
|
||||||
|
|
||||||
AssDialogue *new_line = new AssDialogue;
|
auto new_line = new AssDialogue;
|
||||||
new_line->Style = active_line->Style;
|
new_line->Style = active_line->Style;
|
||||||
new_line->Start = active_line->End;
|
new_line->Start = active_line->End;
|
||||||
new_line->End = new_line->Start + OPT_GET("Timing/Default Duration")->GetInt();
|
new_line->End = new_line->Start + OPT_GET("Timing/Default Duration")->GetInt();
|
||||||
|
@ -172,7 +172,7 @@ struct subtitle_insert_after_videotime : public validate_nonempty_selection_vide
|
||||||
STR_DISP("After Current, at Video Time")
|
STR_DISP("After Current, at Video Time")
|
||||||
STR_HELP("Insert a new line after the current one, starting at video time")
|
STR_HELP("Insert a new line after the current one, starting at video time")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
insert_subtitle_at_video(c, true);
|
insert_subtitle_at_video(c, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -183,10 +183,10 @@ struct subtitle_insert_before : public validate_nonempty_selection {
|
||||||
STR_DISP("Before Current")
|
STR_DISP("Before Current")
|
||||||
STR_HELP("Insert a new line before the current one")
|
STR_HELP("Insert a new line before the current one")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AssDialogue *active_line = c->selectionController->GetActiveLine();
|
AssDialogue *active_line = c->selectionController->GetActiveLine();
|
||||||
|
|
||||||
AssDialogue *new_line = new AssDialogue;
|
auto new_line = new AssDialogue;
|
||||||
new_line->Style = active_line->Style;
|
new_line->Style = active_line->Style;
|
||||||
new_line->End = active_line->Start;
|
new_line->End = active_line->Start;
|
||||||
new_line->Start = new_line->End - OPT_GET("Timing/Default Duration")->GetInt();
|
new_line->Start = new_line->End - OPT_GET("Timing/Default Duration")->GetInt();
|
||||||
|
@ -216,7 +216,7 @@ struct subtitle_insert_before_videotime : public validate_nonempty_selection_vid
|
||||||
STR_DISP("Before Current, at Video Time")
|
STR_DISP("Before Current, at Video Time")
|
||||||
STR_HELP("Insert a new line before the current one, starting at video time")
|
STR_HELP("Insert a new line before the current one, starting at video time")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
insert_subtitle_at_video(c, false);
|
insert_subtitle_at_video(c, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -227,7 +227,7 @@ struct subtitle_new : public Command {
|
||||||
STR_DISP("New Subtitles")
|
STR_DISP("New Subtitles")
|
||||||
STR_HELP("New subtitles")
|
STR_HELP("New subtitles")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->subsController->TryToClose() != wxCANCEL)
|
if (c->subsController->TryToClose() != wxCANCEL)
|
||||||
c->subsController->Close();
|
c->subsController->Close();
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ struct subtitle_open : public Command {
|
||||||
STR_DISP("Open Subtitles")
|
STR_DISP("Open Subtitles")
|
||||||
STR_HELP("Open a subtitles file")
|
STR_HELP("Open a subtitles file")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->subsController->TryToClose() == wxCANCEL) return;
|
if (c->subsController->TryToClose() == wxCANCEL) return;
|
||||||
auto filename = OpenFileSelector(_("Open subtitles file"), "Path/Last/Subtitles", "","", SubtitleFormat::GetWildcards(0), c->parent);
|
auto filename = OpenFileSelector(_("Open subtitles file"), "Path/Last/Subtitles", "","", SubtitleFormat::GetWildcards(0), c->parent);
|
||||||
if (!filename.empty())
|
if (!filename.empty())
|
||||||
|
@ -253,7 +253,7 @@ struct subtitle_open_autosave : public Command {
|
||||||
STR_DISP("Open Autosaved Subtitles")
|
STR_DISP("Open Autosaved Subtitles")
|
||||||
STR_HELP("Open a previous version of a file which was autosaved by Aegisub")
|
STR_HELP("Open a previous version of a file which was autosaved by Aegisub")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->subsController->TryToClose() == wxCANCEL) return;
|
if (c->subsController->TryToClose() == wxCANCEL) return;
|
||||||
DialogAutosave dialog(c->parent);
|
DialogAutosave dialog(c->parent);
|
||||||
if (dialog.ShowModal() == wxID_OK)
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
|
@ -267,7 +267,7 @@ struct subtitle_open_charset : public Command {
|
||||||
STR_DISP("Open Subtitles with Charset")
|
STR_DISP("Open Subtitles with Charset")
|
||||||
STR_HELP("Open a subtitles file with a specific file encoding")
|
STR_HELP("Open a subtitles file with a specific file encoding")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->subsController->TryToClose() == wxCANCEL) return;
|
if (c->subsController->TryToClose() == wxCANCEL) return;
|
||||||
|
|
||||||
auto filename = OpenFileSelector(_("Open subtitles file"), "Path/Last/Subtitles", "","", SubtitleFormat::GetWildcards(0), c->parent);
|
auto filename = OpenFileSelector(_("Open subtitles file"), "Path/Last/Subtitles", "","", SubtitleFormat::GetWildcards(0), c->parent);
|
||||||
|
@ -287,12 +287,12 @@ struct subtitle_open_video : public Command {
|
||||||
STR_HELP("Open the subtitles from the current video file")
|
STR_HELP("Open the subtitles from the current video file")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->subsController->TryToClose() == wxCANCEL) return;
|
if (c->subsController->TryToClose() == wxCANCEL) return;
|
||||||
c->subsController->Load(c->videoController->GetVideoName(), "binary");
|
c->subsController->Load(c->videoController->GetVideoName(), "binary");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->videoController->IsLoaded() && c->videoController->HasSubtitles();
|
return c->videoController->IsLoaded() && c->videoController->HasSubtitles();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -303,7 +303,7 @@ struct subtitle_properties : public Command {
|
||||||
STR_DISP("Properties")
|
STR_DISP("Properties")
|
||||||
STR_HELP("Open script properties window")
|
STR_HELP("Open script properties window")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
DialogProperties(c).ShowModal();
|
DialogProperties(c).ShowModal();
|
||||||
}
|
}
|
||||||
|
@ -339,11 +339,11 @@ struct subtitle_save : public Command {
|
||||||
STR_HELP("Save the current subtitles")
|
STR_HELP("Save the current subtitles")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
save_subtitles(c, c->subsController->CanSave() ? c->subsController->Filename() : "");
|
save_subtitles(c, c->subsController->CanSave() ? c->subsController->Filename() : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->subsController->IsModified();
|
return c->subsController->IsModified();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -354,7 +354,7 @@ struct subtitle_save_as : public Command {
|
||||||
STR_DISP("Save Subtitles as")
|
STR_DISP("Save Subtitles as")
|
||||||
STR_HELP("Save subtitles with another name")
|
STR_HELP("Save subtitles with another name")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
save_subtitles(c, "");
|
save_subtitles(c, "");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -365,7 +365,7 @@ struct subtitle_select_all : public Command {
|
||||||
STR_DISP("Select All")
|
STR_DISP("Select All")
|
||||||
STR_HELP("Select all dialogue lines")
|
STR_HELP("Select all dialogue lines")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
SubtitleSelection sel;
|
SubtitleSelection sel;
|
||||||
transform(c->ass->Line.begin(), c->ass->Line.end(),
|
transform(c->ass->Line.begin(), c->ass->Line.end(),
|
||||||
inserter(sel, sel.begin()), cast<AssDialogue*>());
|
inserter(sel, sel.begin()), cast<AssDialogue*>());
|
||||||
|
@ -381,7 +381,7 @@ struct subtitle_select_visible : public Command {
|
||||||
STR_HELP("Select all dialogue lines that visible on the current video frame")
|
STR_HELP("Select all dialogue lines that visible on the current video frame")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (!c->videoController->IsLoaded()) return;
|
if (!c->videoController->IsLoaded()) return;
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
|
|
||||||
|
@ -403,7 +403,7 @@ struct subtitle_select_visible : public Command {
|
||||||
c->selectionController->SetSelectedSet(new_selection);
|
c->selectionController->SetSelectedSet(new_selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->videoController->IsLoaded();
|
return c->videoController->IsLoaded();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -414,7 +414,7 @@ struct subtitle_spellcheck : public Command {
|
||||||
STR_DISP("Spell Checker")
|
STR_DISP("Spell Checker")
|
||||||
STR_HELP("Open spell checker")
|
STR_HELP("Open spell checker")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
c->dialog->Show<DialogSpellChecker>(c);
|
c->dialog->Show<DialogSpellChecker>(c);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,14 +54,14 @@ namespace {
|
||||||
|
|
||||||
struct validate_video_loaded : public Command {
|
struct validate_video_loaded : public Command {
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->videoController->IsLoaded();
|
return c->videoController->IsLoaded();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct validate_adjoinable : public Command {
|
struct validate_adjoinable : public Command {
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
SubtitleSelection sel = c->selectionController->GetSelectedSet();
|
SubtitleSelection sel = c->selectionController->GetSelectedSet();
|
||||||
if (sel.size() < 2) return !sel.empty();
|
if (sel.size() < 2) return !sel.empty();
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ struct time_continuous_end : public validate_adjoinable {
|
||||||
STR_DISP("Change End")
|
STR_DISP("Change End")
|
||||||
STR_HELP("Change end times of lines to the next line's start time")
|
STR_HELP("Change end times of lines to the next line's start time")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
adjoin_lines(c, false);
|
adjoin_lines(c, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -123,7 +123,7 @@ struct time_continuous_start : public validate_adjoinable {
|
||||||
STR_DISP("Change Start")
|
STR_DISP("Change Start")
|
||||||
STR_HELP("Change start times of lines to the previous line's end time")
|
STR_HELP("Change start times of lines to the previous line's end time")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
adjoin_lines(c, true);
|
adjoin_lines(c, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -134,7 +134,7 @@ struct time_frame_current : public validate_video_loaded {
|
||||||
STR_DISP("Shift to Current Frame")
|
STR_DISP("Shift to Current Frame")
|
||||||
STR_HELP("Shift selection so that the active line starts at current frame")
|
STR_HELP("Shift selection so that the active line starts at current frame")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (!c->videoController->IsLoaded()) return;
|
if (!c->videoController->IsLoaded()) return;
|
||||||
|
|
||||||
SubtitleSelection const& sel = c->selectionController->GetSelectedSet();
|
SubtitleSelection const& sel = c->selectionController->GetSelectedSet();
|
||||||
|
@ -160,7 +160,7 @@ struct time_shift : public Command {
|
||||||
STR_DISP("Shift Times")
|
STR_DISP("Shift Times")
|
||||||
STR_HELP("Shift subtitles by time or frames")
|
STR_HELP("Shift subtitles by time or frames")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->dialog->Show<DialogShiftTimes>(c);
|
c->dialog->Show<DialogShiftTimes>(c);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -189,7 +189,7 @@ struct time_snap_end_video : public validate_video_loaded {
|
||||||
STR_DISP("Snap End to Video")
|
STR_DISP("Snap End to Video")
|
||||||
STR_HELP("Set end of selected subtitles to current video frame")
|
STR_HELP("Set end of selected subtitles to current video frame")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
snap_subs_video(c, false);
|
snap_subs_video(c, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -200,7 +200,7 @@ struct time_snap_scene : public validate_video_loaded {
|
||||||
STR_DISP("Snap to Scene")
|
STR_DISP("Snap to Scene")
|
||||||
STR_HELP("Set start and end of subtitles to the keyframes around current video frame")
|
STR_HELP("Set start and end of subtitles to the keyframes around current video frame")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
VideoContext *con = c->videoController;
|
VideoContext *con = c->videoController;
|
||||||
if (!con->IsLoaded() || !con->KeyFramesLoaded()) return;
|
if (!con->IsLoaded() || !con->KeyFramesLoaded()) return;
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ struct time_add_lead_both : public Command {
|
||||||
STR_MENU("Add lead in and out")
|
STR_MENU("Add lead in and out")
|
||||||
STR_DISP("Add lead in and out")
|
STR_DISP("Add lead in and out")
|
||||||
STR_HELP("Add both lead in and out to the selected lines")
|
STR_HELP("Add both lead in and out to the selected lines")
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (AudioTimingController *tc = c->audioController->GetTimingController()) {
|
if (AudioTimingController *tc = c->audioController->GetTimingController()) {
|
||||||
tc->AddLeadIn();
|
tc->AddLeadIn();
|
||||||
tc->AddLeadOut();
|
tc->AddLeadOut();
|
||||||
|
@ -257,7 +257,7 @@ struct time_add_lead_in : public Command {
|
||||||
STR_MENU("Add lead in")
|
STR_MENU("Add lead in")
|
||||||
STR_DISP("Add lead in")
|
STR_DISP("Add lead in")
|
||||||
STR_HELP("Add the lead in time to the selected lines")
|
STR_HELP("Add the lead in time to the selected lines")
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->audioController->GetTimingController())
|
if (c->audioController->GetTimingController())
|
||||||
c->audioController->GetTimingController()->AddLeadIn();
|
c->audioController->GetTimingController()->AddLeadIn();
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ struct time_add_lead_out : public Command {
|
||||||
STR_MENU("Add lead out")
|
STR_MENU("Add lead out")
|
||||||
STR_DISP("Add lead out")
|
STR_DISP("Add lead out")
|
||||||
STR_HELP("Add the lead out time to the selected lines")
|
STR_HELP("Add the lead out time to the selected lines")
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->audioController->GetTimingController())
|
if (c->audioController->GetTimingController())
|
||||||
c->audioController->GetTimingController()->AddLeadOut();
|
c->audioController->GetTimingController()->AddLeadOut();
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ struct time_length_increase : public Command {
|
||||||
STR_MENU("Increase length")
|
STR_MENU("Increase length")
|
||||||
STR_DISP("Increase length")
|
STR_DISP("Increase length")
|
||||||
STR_HELP("Increase the length of the current timing unit")
|
STR_HELP("Increase the length of the current timing unit")
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->audioController->GetTimingController())
|
if (c->audioController->GetTimingController())
|
||||||
c->audioController->GetTimingController()->ModifyLength(1, false);
|
c->audioController->GetTimingController()->ModifyLength(1, false);
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ struct time_length_increase_shift : public Command {
|
||||||
STR_MENU("Increase length and shift")
|
STR_MENU("Increase length and shift")
|
||||||
STR_DISP("Increase length and shift")
|
STR_DISP("Increase length and shift")
|
||||||
STR_HELP("Increase the length of the current timing unit and shift the following items")
|
STR_HELP("Increase the length of the current timing unit and shift the following items")
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->audioController->GetTimingController())
|
if (c->audioController->GetTimingController())
|
||||||
c->audioController->GetTimingController()->ModifyLength(1, true);
|
c->audioController->GetTimingController()->ModifyLength(1, true);
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ struct time_length_decrease : public Command {
|
||||||
STR_MENU("Decrease length")
|
STR_MENU("Decrease length")
|
||||||
STR_DISP("Decrease length")
|
STR_DISP("Decrease length")
|
||||||
STR_HELP("Decrease the length of the current timing unit")
|
STR_HELP("Decrease the length of the current timing unit")
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->audioController->GetTimingController())
|
if (c->audioController->GetTimingController())
|
||||||
c->audioController->GetTimingController()->ModifyLength(-1, false);
|
c->audioController->GetTimingController()->ModifyLength(-1, false);
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ struct time_length_decrease_shift : public Command {
|
||||||
STR_MENU("Decrease length and shift")
|
STR_MENU("Decrease length and shift")
|
||||||
STR_DISP("Decrease length and shift")
|
STR_DISP("Decrease length and shift")
|
||||||
STR_HELP("Decrease the length of the current timing unit and shift the following items")
|
STR_HELP("Decrease the length of the current timing unit and shift the following items")
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->audioController->GetTimingController())
|
if (c->audioController->GetTimingController())
|
||||||
c->audioController->GetTimingController()->ModifyLength(-1, true);
|
c->audioController->GetTimingController()->ModifyLength(-1, true);
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ struct time_start_increase : public Command {
|
||||||
STR_MENU("Shift start time forward")
|
STR_MENU("Shift start time forward")
|
||||||
STR_DISP("Shift start time forward")
|
STR_DISP("Shift start time forward")
|
||||||
STR_HELP("Shift the start time of the current timing unit forward")
|
STR_HELP("Shift the start time of the current timing unit forward")
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->audioController->GetTimingController())
|
if (c->audioController->GetTimingController())
|
||||||
c->audioController->GetTimingController()->ModifyStart(1);
|
c->audioController->GetTimingController()->ModifyStart(1);
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ struct time_start_decrease : public Command {
|
||||||
STR_MENU("Shift start time backward")
|
STR_MENU("Shift start time backward")
|
||||||
STR_DISP("Shift start time backward")
|
STR_DISP("Shift start time backward")
|
||||||
STR_HELP("Shift the start time of the current timing unit backward")
|
STR_HELP("Shift the start time of the current timing unit backward")
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->audioController->GetTimingController())
|
if (c->audioController->GetTimingController())
|
||||||
c->audioController->GetTimingController()->ModifyStart(-1);
|
c->audioController->GetTimingController()->ModifyStart(-1);
|
||||||
}
|
}
|
||||||
|
@ -346,7 +346,7 @@ struct time_snap_start_video : public validate_video_loaded {
|
||||||
STR_DISP("Snap Start to Video")
|
STR_DISP("Snap Start to Video")
|
||||||
STR_HELP("Set start of selected subtitles to current video frame")
|
STR_HELP("Set start of selected subtitles to current video frame")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
snap_subs_video(c, true);
|
snap_subs_video(c, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -356,7 +356,7 @@ struct time_next : public Command {
|
||||||
STR_MENU("Next Line")
|
STR_MENU("Next Line")
|
||||||
STR_DISP("Next Line")
|
STR_DISP("Next Line")
|
||||||
STR_HELP("Next line or syllable")
|
STR_HELP("Next line or syllable")
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->audioController->GetTimingController())
|
if (c->audioController->GetTimingController())
|
||||||
c->audioController->GetTimingController()->Next(AudioTimingController::TIMING_UNIT);
|
c->audioController->GetTimingController()->Next(AudioTimingController::TIMING_UNIT);
|
||||||
}
|
}
|
||||||
|
@ -367,7 +367,7 @@ struct time_prev : public Command {
|
||||||
STR_MENU("Previous Line")
|
STR_MENU("Previous Line")
|
||||||
STR_DISP("Previous Line")
|
STR_DISP("Previous Line")
|
||||||
STR_HELP("Previous line or syllable")
|
STR_HELP("Previous line or syllable")
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (c->audioController->GetTimingController())
|
if (c->audioController->GetTimingController())
|
||||||
c->audioController->GetTimingController()->Prev();
|
c->audioController->GetTimingController()->Prev();
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,11 +50,11 @@ struct timecode_close : public Command {
|
||||||
STR_HELP("Close the currently open timecodes file")
|
STR_HELP("Close the currently open timecodes file")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->videoController->OverTimecodesLoaded();
|
return c->videoController->OverTimecodesLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->CloseTimecodes();
|
c->videoController->CloseTimecodes();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -65,7 +65,7 @@ struct timecode_open : public Command {
|
||||||
STR_DISP("Open Timecodes File")
|
STR_DISP("Open Timecodes File")
|
||||||
STR_HELP("Open a VFR timecodes v1 or v2 file")
|
STR_HELP("Open a VFR timecodes v1 or v2 file")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
auto str = _("All Supported Formats") + " (*.txt)|*.txt|" + _("All Files") + " (*.*)|*.*";
|
auto str = _("All Supported Formats") + " (*.txt)|*.txt|" + _("All Files") + " (*.*)|*.*";
|
||||||
auto filename = OpenFileSelector(_("Open Timecodes File"), "Path/Last/Timecodes", "", "", str, c->parent);
|
auto filename = OpenFileSelector(_("Open Timecodes File"), "Path/Last/Timecodes", "", "", str, c->parent);
|
||||||
if (!filename.empty())
|
if (!filename.empty())
|
||||||
|
@ -80,11 +80,11 @@ struct timecode_save : public Command {
|
||||||
STR_HELP("Save a VFR timecodes v2 file")
|
STR_HELP("Save a VFR timecodes v2 file")
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->videoController->TimecodesLoaded();
|
return c->videoController->TimecodesLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
auto str = _("All Supported Formats") + " (*.txt)|*.txt|" + _("All Files") + " (*.*)|*.*";
|
auto str = _("All Supported Formats") + " (*.txt)|*.txt|" + _("All Files") + " (*.*)|*.*";
|
||||||
auto filename = SaveFileSelector(_("Save Timecodes File"), "Path/Last/Timecodes", "", "", str, c->parent);
|
auto filename = SaveFileSelector(_("Save Timecodes File"), "Path/Last/Timecodes", "", "", str, c->parent);
|
||||||
if (!filename.empty())
|
if (!filename.empty())
|
||||||
|
|
|
@ -65,7 +65,7 @@ struct tool_assdraw : public Command {
|
||||||
STR_DISP("ASSDraw3")
|
STR_DISP("ASSDraw3")
|
||||||
STR_HELP("Launch the ASSDraw3 tool for vector drawing")
|
STR_HELP("Launch the ASSDraw3 tool for vector drawing")
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
wxExecute("\"" + config::path->Decode("?data/ASSDraw3.exe").wstring() + "\"");
|
wxExecute("\"" + config::path->Decode("?data/ASSDraw3.exe").wstring() + "\"");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -76,7 +76,7 @@ struct tool_export : public Command {
|
||||||
STR_DISP("Export Subtitles")
|
STR_DISP("Export Subtitles")
|
||||||
STR_HELP("Save a copy of subtitles in a different format or with processing applied to it")
|
STR_HELP("Save a copy of subtitles in a different format or with processing applied to it")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
DialogExport(c).ShowModal();
|
DialogExport(c).ShowModal();
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ struct tool_font_collector : public Command {
|
||||||
STR_DISP("Fonts Collector")
|
STR_DISP("Fonts Collector")
|
||||||
STR_HELP("Open fonts collector")
|
STR_HELP("Open fonts collector")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->dialog->Show<DialogFontsCollector>(c);
|
c->dialog->Show<DialogFontsCollector>(c);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -99,7 +99,7 @@ struct tool_line_select : public Command {
|
||||||
STR_DISP("Select Lines")
|
STR_DISP("Select Lines")
|
||||||
STR_HELP("Select lines based on defined criteria")
|
STR_HELP("Select lines based on defined criteria")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->dialog->Show<DialogSelection>(c);
|
c->dialog->Show<DialogSelection>(c);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -110,7 +110,7 @@ struct tool_resampleres : public Command {
|
||||||
STR_DISP("Resample Resolution")
|
STR_DISP("Resample Resolution")
|
||||||
STR_HELP("Resample subtitles to maintain their current appearance at a different script resolution")
|
STR_HELP("Resample subtitles to maintain their current appearance at a different script resolution")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
ResampleSettings settings;
|
ResampleSettings settings;
|
||||||
if (DialogResample(c, settings).ShowModal() == wxID_OK)
|
if (DialogResample(c, settings).ShowModal() == wxID_OK)
|
||||||
|
@ -124,7 +124,7 @@ struct tool_style_assistant : public Command {
|
||||||
STR_DISP("Styling Assistant")
|
STR_DISP("Styling Assistant")
|
||||||
STR_HELP("Open styling assistant")
|
STR_HELP("Open styling assistant")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->dialog->Show<DialogStyling>(c);
|
c->dialog->Show<DialogStyling>(c);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -132,7 +132,7 @@ struct tool_style_assistant : public Command {
|
||||||
struct tool_styling_assistant_validator : public Command {
|
struct tool_styling_assistant_validator : public Command {
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return !!c->dialog->Get<DialogStyling>();
|
return !!c->dialog->Get<DialogStyling>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -143,7 +143,7 @@ struct tool_styling_assistant_commit : public tool_styling_assistant_validator {
|
||||||
STR_DISP("Accept changes")
|
STR_DISP("Accept changes")
|
||||||
STR_HELP("Commit changes and move to the next line")
|
STR_HELP("Commit changes and move to the next line")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->dialog->Get<DialogStyling>()->Commit(true);
|
c->dialog->Get<DialogStyling>()->Commit(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -154,7 +154,7 @@ struct tool_styling_assistant_preview : public tool_styling_assistant_validator
|
||||||
STR_DISP("Preview changes")
|
STR_DISP("Preview changes")
|
||||||
STR_HELP("Commit changes and stay on the current line")
|
STR_HELP("Commit changes and stay on the current line")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->dialog->Get<DialogStyling>()->Commit(false);
|
c->dialog->Get<DialogStyling>()->Commit(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -165,7 +165,7 @@ struct tool_style_manager : public Command {
|
||||||
STR_DISP("Styles Manager")
|
STR_DISP("Styles Manager")
|
||||||
STR_HELP("Open the styles manager")
|
STR_HELP("Open the styles manager")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->dialog->Show<DialogStyleManager>(c);
|
c->dialog->Show<DialogStyleManager>(c);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -176,7 +176,7 @@ struct tool_time_kanji : public Command {
|
||||||
STR_DISP("Kanji Timer")
|
STR_DISP("Kanji Timer")
|
||||||
STR_HELP("Open the Kanji timer copier")
|
STR_HELP("Open the Kanji timer copier")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
DialogKanjiTimer(c).ShowModal();
|
DialogKanjiTimer(c).ShowModal();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -187,7 +187,7 @@ struct tool_time_postprocess : public Command {
|
||||||
STR_DISP("Timing Post-Processor")
|
STR_DISP("Timing Post-Processor")
|
||||||
STR_HELP("Post-process the subtitle timing to add lead-ins and lead-outs, snap timing to scene changes, etc.")
|
STR_HELP("Post-process the subtitle timing to add lead-ins and lead-outs, snap timing to scene changes, etc.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
DialogTimingProcessor(c).ShowModal();
|
DialogTimingProcessor(c).ShowModal();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -198,7 +198,7 @@ struct tool_translation_assistant : public Command {
|
||||||
STR_DISP("Translation Assistant")
|
STR_DISP("Translation Assistant")
|
||||||
STR_HELP("Open translation assistant")
|
STR_HELP("Open translation assistant")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
try {
|
try {
|
||||||
c->dialog->ShowModal<DialogTranslation>(c);
|
c->dialog->ShowModal<DialogTranslation>(c);
|
||||||
|
@ -212,7 +212,7 @@ struct tool_translation_assistant : public Command {
|
||||||
struct tool_translation_assistant_validator : public Command {
|
struct tool_translation_assistant_validator : public Command {
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return !!c->dialog->Get<DialogTranslation>();
|
return !!c->dialog->Get<DialogTranslation>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -223,7 +223,7 @@ struct tool_translation_assistant_commit : public tool_translation_assistant_val
|
||||||
STR_DISP("Accept changes")
|
STR_DISP("Accept changes")
|
||||||
STR_HELP("Commit changes and move to the next line")
|
STR_HELP("Commit changes and move to the next line")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->dialog->Get<DialogTranslation>()->Commit(true);
|
c->dialog->Get<DialogTranslation>()->Commit(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -234,7 +234,7 @@ struct tool_translation_assistant_preview : public tool_translation_assistant_va
|
||||||
STR_DISP("Preview changes")
|
STR_DISP("Preview changes")
|
||||||
STR_HELP("Commit changes and stay on the current line")
|
STR_HELP("Commit changes and stay on the current line")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->dialog->Get<DialogTranslation>()->Commit(false);
|
c->dialog->Get<DialogTranslation>()->Commit(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -245,7 +245,7 @@ struct tool_translation_assistant_next : public tool_translation_assistant_valid
|
||||||
STR_DISP("Next Line")
|
STR_DISP("Next Line")
|
||||||
STR_HELP("Move to the next line without committing changes")
|
STR_HELP("Move to the next line without committing changes")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->dialog->Get<DialogTranslation>()->NextBlock();
|
c->dialog->Get<DialogTranslation>()->NextBlock();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -256,7 +256,7 @@ struct tool_translation_assistant_prev : public tool_translation_assistant_valid
|
||||||
STR_DISP("Previous Line")
|
STR_DISP("Previous Line")
|
||||||
STR_HELP("Move to the previous line without committing changes")
|
STR_HELP("Move to the previous line without committing changes")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->dialog->Get<DialogTranslation>()->PrevBlock();
|
c->dialog->Get<DialogTranslation>()->PrevBlock();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -268,7 +268,7 @@ struct tool_translation_assistant_insert : public tool_translation_assistant_val
|
||||||
STR_DISP("Insert Original")
|
STR_DISP("Insert Original")
|
||||||
STR_HELP("Insert the untranslated text")
|
STR_HELP("Insert the untranslated text")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->dialog->Get<DialogTranslation>()->InsertOriginal();
|
c->dialog->Get<DialogTranslation>()->InsertOriginal();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -72,14 +72,14 @@ namespace {
|
||||||
|
|
||||||
struct validator_video_loaded : public Command {
|
struct validator_video_loaded : public Command {
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->videoController->IsLoaded();
|
return c->videoController->IsLoaded();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct validator_video_attached : public Command {
|
struct validator_video_attached : public Command {
|
||||||
CMD_TYPE(COMMAND_VALIDATE)
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->videoController->IsLoaded() && !c->dialog->Get<DialogDetachedVideo>();
|
return c->videoController->IsLoaded() && !c->dialog->Get<DialogDetachedVideo>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -91,11 +91,11 @@ struct video_aspect_cinematic : public validator_video_loaded {
|
||||||
STR_HELP("Force video to 2.35 aspect ratio")
|
STR_HELP("Force video to 2.35 aspect ratio")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *c) {
|
bool IsActive(const agi::Context *c) override {
|
||||||
return c->videoController->GetAspectRatioType() == AspectRatio::Cinematic;
|
return c->videoController->GetAspectRatioType() == AspectRatio::Cinematic;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
c->videoController->SetAspectRatio(AspectRatio::Cinematic);
|
c->videoController->SetAspectRatio(AspectRatio::Cinematic);
|
||||||
wxGetApp().frame->SetDisplayMode(1,-1);
|
wxGetApp().frame->SetDisplayMode(1,-1);
|
||||||
|
@ -109,11 +109,11 @@ struct video_aspect_custom : public validator_video_loaded {
|
||||||
STR_HELP("Force video to a custom aspect ratio")
|
STR_HELP("Force video to a custom aspect ratio")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *c) {
|
bool IsActive(const agi::Context *c) override {
|
||||||
return c->videoController->GetAspectRatioType() == AspectRatio::Custom;
|
return c->videoController->GetAspectRatioType() == AspectRatio::Custom;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
|
|
||||||
std::string value = from_wx(wxGetTextFromUser(
|
std::string value = from_wx(wxGetTextFromUser(
|
||||||
|
@ -152,11 +152,11 @@ struct video_aspect_default : public validator_video_loaded {
|
||||||
STR_HELP("Use video's original aspect ratio")
|
STR_HELP("Use video's original aspect ratio")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *c) {
|
bool IsActive(const agi::Context *c) override {
|
||||||
return c->videoController->GetAspectRatioType() == AspectRatio::Default;
|
return c->videoController->GetAspectRatioType() == AspectRatio::Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
c->videoController->SetAspectRatio(AspectRatio::Default);
|
c->videoController->SetAspectRatio(AspectRatio::Default);
|
||||||
wxGetApp().frame->SetDisplayMode(1,-1);
|
wxGetApp().frame->SetDisplayMode(1,-1);
|
||||||
|
@ -170,11 +170,11 @@ struct video_aspect_full : public validator_video_loaded {
|
||||||
STR_HELP("Force video to 4:3 aspect ratio")
|
STR_HELP("Force video to 4:3 aspect ratio")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *c) {
|
bool IsActive(const agi::Context *c) override {
|
||||||
return c->videoController->GetAspectRatioType() == AspectRatio::Fullscreen;
|
return c->videoController->GetAspectRatioType() == AspectRatio::Fullscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
c->videoController->SetAspectRatio(AspectRatio::Fullscreen);
|
c->videoController->SetAspectRatio(AspectRatio::Fullscreen);
|
||||||
wxGetApp().frame->SetDisplayMode(1,-1);
|
wxGetApp().frame->SetDisplayMode(1,-1);
|
||||||
|
@ -188,11 +188,11 @@ struct video_aspect_wide : public validator_video_loaded {
|
||||||
STR_HELP("Force video to 16:9 aspect ratio")
|
STR_HELP("Force video to 16:9 aspect ratio")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *c) {
|
bool IsActive(const agi::Context *c) override {
|
||||||
return c->videoController->GetAspectRatioType() == AspectRatio::Widescreen;
|
return c->videoController->GetAspectRatioType() == AspectRatio::Widescreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
c->videoController->SetAspectRatio(AspectRatio::Widescreen);
|
c->videoController->SetAspectRatio(AspectRatio::Widescreen);
|
||||||
wxGetApp().frame->SetDisplayMode(1,-1);
|
wxGetApp().frame->SetDisplayMode(1,-1);
|
||||||
|
@ -205,7 +205,7 @@ struct video_close : public validator_video_loaded {
|
||||||
STR_DISP("Close Video")
|
STR_DISP("Close Video")
|
||||||
STR_HELP("Close the currently open video file")
|
STR_HELP("Close the currently open video file")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->SetVideo("");
|
c->videoController->SetVideo("");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -216,7 +216,7 @@ struct video_copy_coordinates : public validator_video_loaded {
|
||||||
STR_DISP("Copy coordinates to Clipboard")
|
STR_DISP("Copy coordinates to Clipboard")
|
||||||
STR_HELP("Copy the current coordinates of the mouse over the video to the clipboard")
|
STR_HELP("Copy the current coordinates of the mouse over the video to the clipboard")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
SetClipboard(c->videoDisplay->GetMousePosition().Str());
|
SetClipboard(c->videoDisplay->GetMousePosition().Str());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -227,7 +227,7 @@ struct video_cycle_subtitles_provider : public cmd::Command {
|
||||||
STR_DISP("Cycle active subtitles provider")
|
STR_DISP("Cycle active subtitles provider")
|
||||||
STR_HELP("Cycle through the available subtitles providers")
|
STR_HELP("Cycle through the available subtitles providers")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
auto providers = SubtitlesProviderFactory::GetClasses();
|
auto providers = SubtitlesProviderFactory::GetClasses();
|
||||||
if (providers.empty()) return;
|
if (providers.empty()) return;
|
||||||
|
|
||||||
|
@ -247,11 +247,11 @@ struct video_detach : public validator_video_loaded {
|
||||||
STR_HELP("Detach the video display from the main window, displaying it in a separate Window")
|
STR_HELP("Detach the video display from the main window, displaying it in a separate Window")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_TOGGLE)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_TOGGLE)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *c) {
|
bool IsActive(const agi::Context *c) override {
|
||||||
return !!c->dialog->Get<DialogDetachedVideo>();
|
return !!c->dialog->Get<DialogDetachedVideo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (DialogDetachedVideo *d = c->dialog->Get<DialogDetachedVideo>())
|
if (DialogDetachedVideo *d = c->dialog->Get<DialogDetachedVideo>())
|
||||||
d->Close();
|
d->Close();
|
||||||
else
|
else
|
||||||
|
@ -265,7 +265,7 @@ struct video_details : public validator_video_loaded {
|
||||||
STR_DISP("Show Video Details")
|
STR_DISP("Show Video Details")
|
||||||
STR_HELP("Show video details")
|
STR_HELP("Show video details")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
DialogVideoDetails(c).ShowModal();
|
DialogVideoDetails(c).ShowModal();
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ struct video_focus_seek : public validator_video_loaded {
|
||||||
STR_DISP("Toggle video slider focus")
|
STR_DISP("Toggle video slider focus")
|
||||||
STR_HELP("Toggle focus between the video slider and the previous thing to have focus")
|
STR_HELP("Toggle focus between the video slider and the previous thing to have focus")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
wxWindow *curFocus = wxWindow::FindFocus();
|
wxWindow *curFocus = wxWindow::FindFocus();
|
||||||
if (curFocus == c->videoSlider) {
|
if (curFocus == c->videoSlider) {
|
||||||
if (c->previousFocus) c->previousFocus->SetFocus();
|
if (c->previousFocus) c->previousFocus->SetFocus();
|
||||||
|
@ -295,7 +295,7 @@ struct video_frame_copy : public validator_video_loaded {
|
||||||
STR_DISP("Copy image to Clipboard")
|
STR_DISP("Copy image to Clipboard")
|
||||||
STR_HELP("Copy the currently displayed frame to the clipboard")
|
STR_HELP("Copy the currently displayed frame to the clipboard")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
SetClipboard(wxBitmap(GetImage(*c->videoController->GetFrame(c->videoController->GetFrameN())), 24));
|
SetClipboard(wxBitmap(GetImage(*c->videoController->GetFrame(c->videoController->GetFrameN())), 24));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -306,7 +306,7 @@ struct video_frame_copy_raw : public validator_video_loaded {
|
||||||
STR_DISP("Copy image to Clipboard (no subtitles)")
|
STR_DISP("Copy image to Clipboard (no subtitles)")
|
||||||
STR_HELP("Copy the currently displayed frame to the clipboard, without the subtitles")
|
STR_HELP("Copy the currently displayed frame to the clipboard, without the subtitles")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
SetClipboard(wxBitmap(GetImage(*c->videoController->GetFrame(c->videoController->GetFrameN(), true)), 24));
|
SetClipboard(wxBitmap(GetImage(*c->videoController->GetFrame(c->videoController->GetFrameN(), true)), 24));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -317,7 +317,7 @@ struct video_frame_next : public validator_video_loaded {
|
||||||
STR_DISP("Next Frame")
|
STR_DISP("Next Frame")
|
||||||
STR_HELP("Seek to the next frame")
|
STR_HELP("Seek to the next frame")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->NextFrame();
|
c->videoController->NextFrame();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -328,7 +328,7 @@ struct video_frame_next_boundary : public validator_video_loaded {
|
||||||
STR_DISP("Next Boundary")
|
STR_DISP("Next Boundary")
|
||||||
STR_HELP("Seek to the next beginning or end of a subtitle")
|
STR_HELP("Seek to the next beginning or end of a subtitle")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AssDialogue *active_line = c->selectionController->GetActiveLine();
|
AssDialogue *active_line = c->selectionController->GetActiveLine();
|
||||||
if (!active_line) return;
|
if (!active_line) return;
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ struct video_frame_next_keyframe : public validator_video_loaded {
|
||||||
STR_DISP("Next Keyframe")
|
STR_DISP("Next Keyframe")
|
||||||
STR_HELP("Seek to the next keyframe")
|
STR_HELP("Seek to the next keyframe")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
auto const& kf = c->videoController->GetKeyFrames();
|
auto const& kf = c->videoController->GetKeyFrames();
|
||||||
auto pos = lower_bound(kf.begin(), kf.end(), c->videoController->GetFrameN() + 1);
|
auto pos = lower_bound(kf.begin(), kf.end(), c->videoController->GetFrameN() + 1);
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ struct video_frame_next_large : public validator_video_loaded {
|
||||||
STR_DISP("Fast jump forward")
|
STR_DISP("Fast jump forward")
|
||||||
STR_HELP("Fast jump forward")
|
STR_HELP("Fast jump forward")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->JumpToFrame(
|
c->videoController->JumpToFrame(
|
||||||
c->videoController->GetFrameN() +
|
c->videoController->GetFrameN() +
|
||||||
OPT_GET("Video/Slider/Fast Jump Step")->GetInt());
|
OPT_GET("Video/Slider/Fast Jump Step")->GetInt());
|
||||||
|
@ -384,7 +384,7 @@ struct video_frame_prev : public validator_video_loaded {
|
||||||
STR_DISP("Previous Frame")
|
STR_DISP("Previous Frame")
|
||||||
STR_HELP("Seek to the previous frame")
|
STR_HELP("Seek to the previous frame")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->PrevFrame();
|
c->videoController->PrevFrame();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -395,7 +395,7 @@ struct video_frame_prev_boundary : public validator_video_loaded {
|
||||||
STR_DISP("Previous Boundary")
|
STR_DISP("Previous Boundary")
|
||||||
STR_HELP("Seek to the previous beginning or end of a subtitle")
|
STR_HELP("Seek to the previous beginning or end of a subtitle")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
AssDialogue *active_line = c->selectionController->GetActiveLine();
|
AssDialogue *active_line = c->selectionController->GetActiveLine();
|
||||||
if (!active_line) return;
|
if (!active_line) return;
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ struct video_frame_prev_keyframe : public validator_video_loaded {
|
||||||
STR_DISP("Previous Keyframe")
|
STR_DISP("Previous Keyframe")
|
||||||
STR_HELP("Seek to the previous keyframe")
|
STR_HELP("Seek to the previous keyframe")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
auto const& kf = c->videoController->GetKeyFrames();
|
auto const& kf = c->videoController->GetKeyFrames();
|
||||||
if (kf.empty()) {
|
if (kf.empty()) {
|
||||||
c->videoController->JumpToFrame(0);
|
c->videoController->JumpToFrame(0);
|
||||||
|
@ -446,7 +446,7 @@ struct video_frame_prev_large : public validator_video_loaded {
|
||||||
STR_DISP("Fast jump backwards")
|
STR_DISP("Fast jump backwards")
|
||||||
STR_HELP("Fast jump backwards")
|
STR_HELP("Fast jump backwards")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->JumpToFrame(
|
c->videoController->JumpToFrame(
|
||||||
c->videoController->GetFrameN() -
|
c->videoController->GetFrameN() -
|
||||||
OPT_GET("Video/Slider/Fast Jump Step")->GetInt());
|
OPT_GET("Video/Slider/Fast Jump Step")->GetInt());
|
||||||
|
@ -497,7 +497,7 @@ struct video_frame_save : public validator_video_loaded {
|
||||||
STR_DISP("Save PNG snapshot")
|
STR_DISP("Save PNG snapshot")
|
||||||
STR_HELP("Save the currently displayed frame to a PNG file in the video's directory")
|
STR_HELP("Save the currently displayed frame to a PNG file in the video's directory")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
save_snapshot(c, false);
|
save_snapshot(c, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -508,7 +508,7 @@ struct video_frame_save_raw : public validator_video_loaded {
|
||||||
STR_DISP("Save PNG snapshot (no subtitles)")
|
STR_DISP("Save PNG snapshot (no subtitles)")
|
||||||
STR_HELP("Save the currently displayed frame without the subtitles to a PNG file in the video's directory")
|
STR_HELP("Save the currently displayed frame without the subtitles to a PNG file in the video's directory")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
save_snapshot(c, true);
|
save_snapshot(c, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -519,7 +519,7 @@ struct video_jump : public validator_video_loaded {
|
||||||
STR_DISP("Jump to")
|
STR_DISP("Jump to")
|
||||||
STR_HELP("Jump to frame or time")
|
STR_HELP("Jump to frame or time")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
if (c->videoController->IsLoaded()) {
|
if (c->videoController->IsLoaded()) {
|
||||||
DialogJumpTo(c).ShowModal();
|
DialogJumpTo(c).ShowModal();
|
||||||
|
@ -534,7 +534,7 @@ struct video_jump_end : public validator_video_loaded {
|
||||||
STR_DISP("Jump Video to End")
|
STR_DISP("Jump Video to End")
|
||||||
STR_HELP("Jump the video to the end frame of current subtitle")
|
STR_HELP("Jump the video to the end frame of current subtitle")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (AssDialogue *active_line = c->selectionController->GetActiveLine()) {
|
if (AssDialogue *active_line = c->selectionController->GetActiveLine()) {
|
||||||
c->videoController->JumpToTime(active_line->End, agi::vfr::END);
|
c->videoController->JumpToTime(active_line->End, agi::vfr::END);
|
||||||
}
|
}
|
||||||
|
@ -547,7 +547,7 @@ struct video_jump_start : public validator_video_loaded {
|
||||||
STR_DISP("Jump Video to Start")
|
STR_DISP("Jump Video to Start")
|
||||||
STR_HELP("Jump the video to the start frame of current subtitle")
|
STR_HELP("Jump the video to the start frame of current subtitle")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
if (AssDialogue *active_line = c->selectionController->GetActiveLine())
|
if (AssDialogue *active_line = c->selectionController->GetActiveLine())
|
||||||
c->videoController->JumpToTime(active_line->Start);
|
c->videoController->JumpToTime(active_line->Start);
|
||||||
}
|
}
|
||||||
|
@ -559,7 +559,7 @@ struct video_open : public Command {
|
||||||
STR_DISP("Open Video")
|
STR_DISP("Open Video")
|
||||||
STR_HELP("Open a video file")
|
STR_HELP("Open a video file")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
auto str = _("Video Formats") + " (*.asf,*.avi,*.avs,*.d2v,*.m2ts,*.m4v,*.mkv,*.mov,*.mp4,*.mpeg,*.mpg,*.ogm,*.webm,*.wmv,*.ts,*.y4m,*.yuv)|*.asf;*.avi;*.avs;*.d2v;*.m2ts;*.m4v;*.mkv;*.mov;*.mp4;*.mpeg;*.mpg;*.ogm;*.webm;*.wmv;*.ts;*.y4m;*.yuv|"
|
auto str = _("Video Formats") + " (*.asf,*.avi,*.avs,*.d2v,*.m2ts,*.m4v,*.mkv,*.mov,*.mp4,*.mpeg,*.mpg,*.ogm,*.webm,*.wmv,*.ts,*.y4m,*.yuv)|*.asf;*.avi;*.avs;*.d2v;*.m2ts;*.m4v;*.mkv;*.mov;*.mp4;*.mpeg;*.mpg;*.ogm;*.webm;*.wmv;*.ts;*.y4m;*.yuv|"
|
||||||
+ _("All Files") + " (*.*)|*.*";
|
+ _("All Files") + " (*.*)|*.*";
|
||||||
auto filename = OpenFileSelector(_("Open video file"), "Path/Last/Video", "", "", str, c->parent);
|
auto filename = OpenFileSelector(_("Open video file"), "Path/Last/Video", "", "", str, c->parent);
|
||||||
|
@ -574,7 +574,7 @@ struct video_open_dummy : public Command {
|
||||||
STR_DISP("Use Dummy Video")
|
STR_DISP("Use Dummy Video")
|
||||||
STR_HELP("Open a placeholder video clip with solid color")
|
STR_HELP("Open a placeholder video clip with solid color")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
std::string fn = DialogDummyVideo::CreateDummyVideo(c->parent);
|
std::string fn = DialogDummyVideo::CreateDummyVideo(c->parent);
|
||||||
if (!fn.empty())
|
if (!fn.empty())
|
||||||
c->videoController->SetVideo(fn);
|
c->videoController->SetVideo(fn);
|
||||||
|
@ -588,11 +588,11 @@ struct video_opt_autoscroll : public Command {
|
||||||
STR_HELP("Toggle automatically seeking video to the start time of selected lines")
|
STR_HELP("Toggle automatically seeking video to the start time of selected lines")
|
||||||
CMD_TYPE(COMMAND_TOGGLE)
|
CMD_TYPE(COMMAND_TOGGLE)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return OPT_GET("Video/Subtitle Sync")->GetBool();
|
return OPT_GET("Video/Subtitle Sync")->GetBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *) {
|
void operator()(agi::Context *) override {
|
||||||
OPT_SET("Video/Subtitle Sync")->SetBool(!OPT_GET("Video/Subtitle Sync")->GetBool());
|
OPT_SET("Video/Subtitle Sync")->SetBool(!OPT_GET("Video/Subtitle Sync")->GetBool());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -603,7 +603,7 @@ struct video_play : public validator_video_loaded {
|
||||||
STR_DISP("Play")
|
STR_DISP("Play")
|
||||||
STR_HELP("Play video starting on this position")
|
STR_HELP("Play video starting on this position")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Play();
|
c->videoController->Play();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -614,7 +614,7 @@ struct video_play_line : public validator_video_loaded {
|
||||||
STR_DISP("Play line")
|
STR_DISP("Play line")
|
||||||
STR_HELP("Play current line")
|
STR_HELP("Play current line")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->PlayLine();
|
c->videoController->PlayLine();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -626,11 +626,11 @@ struct video_show_overscan : public validator_video_loaded {
|
||||||
STR_HELP("Show a mask over the video, indicating areas that might get cropped off by overscan on televisions")
|
STR_HELP("Show a mask over the video, indicating areas that might get cropped off by overscan on televisions")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_TOGGLE)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_TOGGLE)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *) {
|
bool IsActive(const agi::Context *) override {
|
||||||
return OPT_GET("Video/Overscan Mask")->GetBool();
|
return OPT_GET("Video/Overscan Mask")->GetBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
OPT_SET("Video/Overscan Mask")->SetBool(!OPT_GET("Video/Overscan Mask")->GetBool());
|
OPT_SET("Video/Overscan Mask")->SetBool(!OPT_GET("Video/Overscan Mask")->GetBool());
|
||||||
c->videoDisplay->Render();
|
c->videoDisplay->Render();
|
||||||
}
|
}
|
||||||
|
@ -644,11 +644,11 @@ public:
|
||||||
STR_HELP("Set zoom to 100%")
|
STR_HELP("Set zoom to 100%")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *c) {
|
bool IsActive(const agi::Context *c) override {
|
||||||
return c->videoDisplay->GetZoom() == 1.;
|
return c->videoDisplay->GetZoom() == 1.;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
c->videoDisplay->SetZoom(1.);
|
c->videoDisplay->SetZoom(1.);
|
||||||
}
|
}
|
||||||
|
@ -661,7 +661,7 @@ public:
|
||||||
STR_DISP("Stop video")
|
STR_DISP("Stop video")
|
||||||
STR_HELP("Stop video playback")
|
STR_HELP("Stop video playback")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -674,11 +674,11 @@ public:
|
||||||
STR_HELP("Set zoom to 200%")
|
STR_HELP("Set zoom to 200%")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *c) {
|
bool IsActive(const agi::Context *c) override {
|
||||||
return c->videoDisplay->GetZoom() == 2.;
|
return c->videoDisplay->GetZoom() == 2.;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
c->videoDisplay->SetZoom(2.);
|
c->videoDisplay->SetZoom(2.);
|
||||||
}
|
}
|
||||||
|
@ -692,11 +692,11 @@ public:
|
||||||
STR_HELP("Set zoom to 50%")
|
STR_HELP("Set zoom to 50%")
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
bool IsActive(const agi::Context *c) {
|
bool IsActive(const agi::Context *c) override {
|
||||||
return c->videoDisplay->GetZoom() == .5;
|
return c->videoDisplay->GetZoom() == .5;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
c->videoDisplay->SetZoom(.5);
|
c->videoDisplay->SetZoom(.5);
|
||||||
}
|
}
|
||||||
|
@ -708,7 +708,7 @@ struct video_zoom_in : public validator_video_attached {
|
||||||
STR_DISP("Zoom In")
|
STR_DISP("Zoom In")
|
||||||
STR_HELP("Zoom video in")
|
STR_HELP("Zoom video in")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoDisplay->SetZoom(c->videoDisplay->GetZoom() + .125);
|
c->videoDisplay->SetZoom(c->videoDisplay->GetZoom() + .125);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -719,7 +719,7 @@ struct video_zoom_out : public validator_video_attached {
|
||||||
STR_DISP("Zoom Out")
|
STR_DISP("Zoom Out")
|
||||||
STR_HELP("Zoom video out")
|
STR_HELP("Zoom video out")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoDisplay->SetZoom(c->videoDisplay->GetZoom() - .125);
|
c->videoDisplay->SetZoom(c->videoDisplay->GetZoom() - .125);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,15 +39,15 @@ namespace {
|
||||||
struct visual_tool_command : public Command {
|
struct visual_tool_command : public Command {
|
||||||
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
||||||
|
|
||||||
bool Validate(const agi::Context *c) {
|
bool Validate(const agi::Context *c) override {
|
||||||
return c->videoController->IsLoaded();
|
return c->videoController->IsLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsActive(const agi::Context *c) {
|
bool IsActive(const agi::Context *c) override {
|
||||||
return c->videoDisplay->ToolIsType(typeid(T));
|
return c->videoDisplay->ToolIsType(typeid(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) override {
|
||||||
c->videoDisplay->SetTool(agi::util::make_unique<T>(c->videoDisplay, c));
|
c->videoDisplay->SetTool(agi::util::make_unique<T>(c->videoDisplay, c));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -240,7 +240,7 @@ static wxString form_to_str(const SubtitleFormat* f) {
|
||||||
void DialogAutomation::OnInfo(wxCommandEvent &)
|
void DialogAutomation::OnInfo(wxCommandEvent &)
|
||||||
{
|
{
|
||||||
int i = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
int i = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
||||||
ExtraScriptInfo *ei = i >= 0 ? &script_info[list->GetItemData(i)] : 0;
|
ExtraScriptInfo *ei = i >= 0 ? &script_info[list->GetItemData(i)] : nullptr;
|
||||||
|
|
||||||
wxArrayString info;
|
wxArrayString info;
|
||||||
std::back_insert_iterator<wxArrayString> append_info(info);
|
std::back_insert_iterator<wxArrayString> append_info(info);
|
||||||
|
|
|
@ -29,8 +29,8 @@ class DialogAutosave : public wxDialog {
|
||||||
wxString filename;
|
wxString filename;
|
||||||
wxDateTime date;
|
wxDateTime date;
|
||||||
wxString display;
|
wxString display;
|
||||||
Version(wxString const& filename, wxDateTime const& date, wxString const& display)
|
Version(wxString const& filename, wxDateTime date, wxString const& display)
|
||||||
: filename(filename), date(date), display(display) { }
|
: filename(filename), date(std::move(date)), display(display) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AutosaveFile {
|
struct AutosaveFile {
|
||||||
|
|
|
@ -195,14 +195,14 @@ class ColorPickerSpectrum : public wxControl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AcceptsFocusFromKeyboard() const { return false; }
|
bool AcceptsFocusFromKeyboard() const override { return false; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ColorPickerSpectrum(wxWindow *parent, PickerDirection direction, wxSize size)
|
ColorPickerSpectrum(wxWindow *parent, PickerDirection direction, wxSize size)
|
||||||
: wxControl(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE)
|
: wxControl(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE)
|
||||||
, x(-1)
|
, x(-1)
|
||||||
, y(-1)
|
, y(-1)
|
||||||
, background(0)
|
, background(nullptr)
|
||||||
, direction(direction)
|
, direction(direction)
|
||||||
{
|
{
|
||||||
size.x += 2;
|
size.x += 2;
|
||||||
|
@ -295,7 +295,7 @@ class ColorPickerRecent : public wxStaticBitmap {
|
||||||
Refresh(false);
|
Refresh(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AcceptsFocusFromKeyboard() const { return false; }
|
bool AcceptsFocusFromKeyboard() const override { return false; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ColorPickerRecent(wxWindow *parent, int cols, int rows, int cellsize)
|
ColorPickerRecent(wxWindow *parent, int cols, int rows, int cellsize)
|
||||||
|
@ -365,7 +365,7 @@ class ColorPickerScreenDropper : public wxControl {
|
||||||
wxPaintDC(this).DrawBitmap(capture, 0, 0);
|
wxPaintDC(this).DrawBitmap(capture, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AcceptsFocusFromKeyboard() const { return false; }
|
bool AcceptsFocusFromKeyboard() const override { return false; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ColorPickerScreenDropper(wxWindow *parent, int resx, int resy, int magnification)
|
ColorPickerScreenDropper(wxWindow *parent, int resx, int resy, int magnification)
|
||||||
|
@ -548,7 +548,7 @@ static wxBitmap make_slider(Func func) {
|
||||||
|
|
||||||
DialogColorPicker::DialogColorPicker(wxWindow *parent, agi::Color initial_color, std::function<void (agi::Color)> callback, bool alpha)
|
DialogColorPicker::DialogColorPicker(wxWindow *parent, agi::Color initial_color, std::function<void (agi::Color)> callback, bool alpha)
|
||||||
: wxDialog(parent, -1, _("Select Color"))
|
: wxDialog(parent, -1, _("Select Color"))
|
||||||
, callback(callback)
|
, callback(std::move(callback))
|
||||||
{
|
{
|
||||||
// generate spectrum slider bar images
|
// generate spectrum slider bar images
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
|
@ -576,18 +576,18 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, agi::Color initial_color,
|
||||||
wxSizer *hsl_box = new wxStaticBoxSizer(wxVERTICAL, this, _("HSL color"));
|
wxSizer *hsl_box = new wxStaticBoxSizer(wxVERTICAL, this, _("HSL color"));
|
||||||
wxSizer *hsv_box = new wxStaticBoxSizer(wxVERTICAL, this, _("HSV color"));
|
wxSizer *hsv_box = new wxStaticBoxSizer(wxVERTICAL, this, _("HSV color"));
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i)
|
for (auto& elem : rgb_input)
|
||||||
rgb_input[i] = new wxSpinCtrl(this, -1, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
elem = new wxSpinCtrl(this, -1, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
||||||
|
|
||||||
ass_input = new wxTextCtrl(this, -1, "", wxDefaultPosition, colorinput_size);
|
ass_input = new wxTextCtrl(this, -1, "", wxDefaultPosition, colorinput_size);
|
||||||
html_input = new wxTextCtrl(this, -1, "", wxDefaultPosition, colorinput_size);
|
html_input = new wxTextCtrl(this, -1, "", wxDefaultPosition, colorinput_size);
|
||||||
alpha_input = new wxSpinCtrl(this, -1, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
alpha_input = new wxSpinCtrl(this, -1, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i)
|
for (auto& elem : hsl_input)
|
||||||
hsl_input[i] = new wxSpinCtrl(this, -1, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
elem = new wxSpinCtrl(this, -1, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i)
|
for (auto& elem : hsv_input)
|
||||||
hsv_input[i] = new wxSpinCtrl(this, -1, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
elem = new wxSpinCtrl(this, -1, "", wxDefaultPosition, colorinput_size, wxSP_ARROW_KEYS, 0, 255);
|
||||||
|
|
||||||
preview_box = new wxStaticBitmap(this, -1, wxBitmap(40, 40, 24), wxDefaultPosition, wxSize(40, 40), STATIC_BORDER_FLAG);
|
preview_box = new wxStaticBitmap(this, -1, wxBitmap(40, 40, 24), wxDefaultPosition, wxSize(40, 40), STATIC_BORDER_FLAG);
|
||||||
recent_box = new ColorPickerRecent(this, 8, 4, 16);
|
recent_box = new ColorPickerRecent(this, 8, 4, 16);
|
||||||
|
@ -709,7 +709,7 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, agi::Color initial_color,
|
||||||
|
|
||||||
template<int N, class Control>
|
template<int N, class Control>
|
||||||
wxSizer *DialogColorPicker::MakeColorInputSizer(wxString (&labels)[N], Control *(&inputs)[N]) {
|
wxSizer *DialogColorPicker::MakeColorInputSizer(wxString (&labels)[N], Control *(&inputs)[N]) {
|
||||||
wxFlexGridSizer * sizer = new wxFlexGridSizer(2, 5, 5);
|
auto sizer = new wxFlexGridSizer(2, 5, 5);
|
||||||
for (int i = 0; i < N; ++i) {
|
for (int i = 0; i < N; ++i) {
|
||||||
sizer->Add(new wxStaticText(this, -1, labels[i]), wxSizerFlags(1).Center().Left());
|
sizer->Add(new wxStaticText(this, -1, labels[i]), wxSizerFlags(1).Center().Left());
|
||||||
sizer->Add(inputs[i]);
|
sizer->Add(inputs[i]);
|
||||||
|
|
|
@ -67,7 +67,7 @@ DialogDetachedVideo::DialogDetachedVideo(agi::Context *context)
|
||||||
old_display->Unload();
|
old_display->Unload();
|
||||||
|
|
||||||
// Video area;
|
// Video area;
|
||||||
VideoBox *videoBox = new VideoBox(this, true, context);
|
auto videoBox = new VideoBox(this, true, context);
|
||||||
context->videoDisplay->SetMinClientSize(old_display->GetClientSize());
|
context->videoDisplay->SetMinClientSize(old_display->GetClientSize());
|
||||||
videoBox->Layout();
|
videoBox->Layout();
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ wxControl *spin_ctrl(wxWindow *parent, double min, double max, double *value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
wxComboBox *resolution_shortcuts(wxWindow *parent, int width, int height) {
|
wxComboBox *resolution_shortcuts(wxWindow *parent, int width, int height) {
|
||||||
wxComboBox *ctrl = new wxComboBox(parent, -1, "", wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_READONLY);
|
wxComboBox *ctrl = new wxComboBox(parent, -1, "", wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY);
|
||||||
|
|
||||||
for (auto const& res : resolutions) {
|
for (auto const& res : resolutions) {
|
||||||
ctrl->Append(res.name);
|
ctrl->Append(res.name);
|
||||||
|
@ -97,13 +97,13 @@ DialogDummyVideo::DialogDummyVideo(wxWindow *parent)
|
||||||
{
|
{
|
||||||
SetIcon(GETICON(use_dummy_video_menu_16));
|
SetIcon(GETICON(use_dummy_video_menu_16));
|
||||||
|
|
||||||
wxBoxSizer *res_sizer = new wxBoxSizer(wxHORIZONTAL);
|
auto res_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
res_sizer->Add(spin_ctrl(this, 1, 10000, &width), wxSizerFlags(1).Expand());
|
res_sizer->Add(spin_ctrl(this, 1, 10000, &width), wxSizerFlags(1).Expand());
|
||||||
res_sizer->Add(new wxStaticText(this, -1, " x "), wxSizerFlags().Center());
|
res_sizer->Add(new wxStaticText(this, -1, " x "), wxSizerFlags().Center());
|
||||||
res_sizer->Add(spin_ctrl(this, 1, 10000, &height), wxSizerFlags(1).Expand());
|
res_sizer->Add(spin_ctrl(this, 1, 10000, &height), wxSizerFlags(1).Expand());
|
||||||
|
|
||||||
wxBoxSizer *color_sizer = new wxBoxSizer(wxHORIZONTAL);
|
auto color_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
ColourButton *color_btn = new ColourButton(this, wxSize(30, 17), false, color);
|
auto color_btn = new ColourButton(this, wxSize(30, 17), false, color);
|
||||||
color_sizer->Add(color_btn, wxSizerFlags().DoubleBorder(wxRIGHT));
|
color_sizer->Add(color_btn, wxSizerFlags().DoubleBorder(wxRIGHT));
|
||||||
color_sizer->Add(new wxCheckBox(this, -1, _("Checkerboard &pattern"), wxDefaultPosition, wxDefaultSize, 0, wxGenericValidator(&pattern)), wxSizerFlags(1).Center());
|
color_sizer->Add(new wxCheckBox(this, -1, _("Checkerboard &pattern"), wxDefaultPosition, wxDefaultSize, 0, wxGenericValidator(&pattern)), wxSizerFlags(1).Center());
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ DialogDummyVideo::DialogDummyVideo(wxWindow *parent)
|
||||||
wxStdDialogButtonSizer *btn_sizer = CreateStdDialogButtonSizer(wxOK | wxCANCEL | wxHELP);
|
wxStdDialogButtonSizer *btn_sizer = CreateStdDialogButtonSizer(wxOK | wxCANCEL | wxHELP);
|
||||||
btn_sizer->GetHelpButton()->Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::bind(&HelpButton::OpenPage, "Dummy Video"));
|
btn_sizer->GetHelpButton()->Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::bind(&HelpButton::OpenPage, "Dummy Video"));
|
||||||
|
|
||||||
wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);
|
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
main_sizer->Add(sizer, wxSizerFlags(1).Border().Expand());
|
main_sizer->Add(sizer, wxSizerFlags(1).Border().Expand());
|
||||||
main_sizer->Add(new wxStaticLine(this, wxHORIZONTAL), wxSizerFlags().HorzBorder().Expand());
|
main_sizer->Add(new wxStaticLine(this, wxHORIZONTAL), wxSizerFlags().HorzBorder().Expand());
|
||||||
main_sizer->Add(btn_sizer, wxSizerFlags().Expand().Border());
|
main_sizer->Add(btn_sizer, wxSizerFlags().Expand().Border());
|
||||||
|
|
|
@ -53,14 +53,14 @@ namespace {
|
||||||
|
|
||||||
wxTextCtrl *GetCtrl() const { return dynamic_cast<wxTextCtrl*>(GetWindow()); }
|
wxTextCtrl *GetCtrl() const { return dynamic_cast<wxTextCtrl*>(GetWindow()); }
|
||||||
|
|
||||||
bool TransferToWindow() {
|
bool TransferToWindow() override {
|
||||||
wxTextCtrl *ctrl = GetCtrl();
|
wxTextCtrl *ctrl = GetCtrl();
|
||||||
if (!ctrl) return false;
|
if (!ctrl) return false;
|
||||||
ctrl->SetValue(wxString::Format("%02d:%02d:%02d:%02d", (int)value->h, (int)value->m, (int)value->s, (int)value->f));
|
ctrl->SetValue(wxString::Format("%02d:%02d:%02d:%02d", (int)value->h, (int)value->m, (int)value->s, (int)value->f));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TransferFromWindow() {
|
bool TransferFromWindow() override {
|
||||||
wxTextCtrl *ctrl = GetCtrl();
|
wxTextCtrl *ctrl = GetCtrl();
|
||||||
if (!ctrl) return false;
|
if (!ctrl) return false;
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ namespace {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Validate(wxWindow *parent) {
|
bool Validate(wxWindow *parent) override {
|
||||||
wxTextCtrl *ctrl = GetCtrl();
|
wxTextCtrl *ctrl = GetCtrl();
|
||||||
if (!ctrl) return false;
|
if (!ctrl) return false;
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ namespace {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxObject *Clone() const { return new TimecodeValidator(*this); }
|
wxObject *Clone() const override { return new TimecodeValidator(*this); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TimecodeValidator(EbuTimecode *target) : value(target) { assert(target); }
|
TimecodeValidator(EbuTimecode *target) : value(target) { assert(target); }
|
||||||
|
|
|
@ -62,7 +62,7 @@ DialogJumpTo::DialogJumpTo(agi::Context *c)
|
||||||
JumpFrame->SetMaxLength(std::to_string(c->videoController->GetLength() - 1).size());
|
JumpFrame->SetMaxLength(std::to_string(c->videoController->GetLength() - 1).size());
|
||||||
JumpTime = new TimeEdit(this, -1, c, AssTime(c->videoController->TimeAtFrame(jumpframe)).GetAssFormated(), wxSize(-1,-1));
|
JumpTime = new TimeEdit(this, -1, c, AssTime(c->videoController->TimeAtFrame(jumpframe)).GetAssFormated(), wxSize(-1,-1));
|
||||||
|
|
||||||
wxGridSizer *TimesSizer = new wxGridSizer(2, 5, 5);
|
auto TimesSizer = new wxGridSizer(2, 5, 5);
|
||||||
|
|
||||||
TimesSizer->Add(LabelFrame, 1, wxALIGN_CENTER_VERTICAL);
|
TimesSizer->Add(LabelFrame, 1, wxALIGN_CENTER_VERTICAL);
|
||||||
TimesSizer->Add(JumpFrame, wxEXPAND);
|
TimesSizer->Add(JumpFrame, wxEXPAND);
|
||||||
|
|
|
@ -458,7 +458,7 @@ DialogKanjiTimer::DialogKanjiTimer(agi::Context *c)
|
||||||
|
|
||||||
wxSizer *DisplayBoxSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Text"));
|
wxSizer *DisplayBoxSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Text"));
|
||||||
wxSizer *StylesBoxSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Styles"));
|
wxSizer *StylesBoxSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Styles"));
|
||||||
wxFlexGridSizer *StylesGridSizer = new wxFlexGridSizer(2, 2, 6, 6);
|
auto StylesGridSizer = new wxFlexGridSizer(2, 2, 6, 6);
|
||||||
wxSizer *HelpBoxSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Shortcut Keys"));
|
wxSizer *HelpBoxSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Shortcut Keys"));
|
||||||
wxSizer *ButtonsBoxSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Commands"));
|
wxSizer *ButtonsBoxSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Commands"));
|
||||||
wxSizer *MainStackSizer = new wxBoxSizer(wxVERTICAL);
|
wxSizer *MainStackSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
@ -510,7 +510,7 @@ DialogKanjiTimer::DialogKanjiTimer(agi::Context *c)
|
||||||
ButtonsBoxSizer->AddStretchSpacer(1);
|
ButtonsBoxSizer->AddStretchSpacer(1);
|
||||||
|
|
||||||
// Button sizer
|
// Button sizer
|
||||||
wxStdDialogButtonSizer *buttonSizer = new wxStdDialogButtonSizer();
|
auto buttonSizer = new wxStdDialogButtonSizer();
|
||||||
buttonSizer->AddButton(new HelpButton(this,"Kanji Timer"));
|
buttonSizer->AddButton(new HelpButton(this,"Kanji Timer"));
|
||||||
buttonSizer->SetAffirmativeButton(CloseKT);
|
buttonSizer->SetAffirmativeButton(CloseKT);
|
||||||
buttonSizer->Realize();
|
buttonSizer->Realize();
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
log(&sm);
|
log(&sm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void log(agi::log::SinkMessage *sm) {
|
void log(agi::log::SinkMessage *sm) override {
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
tm tmtime;
|
tm tmtime;
|
||||||
localtime_r(&sm->tv.tv_sec, &tmtime);
|
localtime_r(&sm->tv.tv_sec, &tmtime);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue