1
0
Fork 0

Use more NSDMIs

This commit is contained in:
Thomas Goyne 2014-05-12 09:30:14 -07:00
parent 562a2259f5
commit 5da847e1ef
10 changed files with 27 additions and 54 deletions

View File

@ -56,7 +56,6 @@
AudioController::AudioController(agi::Context *context)
: context(context)
, subtitle_save_slot(context->subsController->AddFileSaveListener(&AudioController::OnSubtitlesSave, this))
, playback_mode(PM_NotPlaying)
, playback_timer(this)
{
Bind(wxEVT_TIMER, &AudioController::OnPlaybackTimer, this, playback_timer.GetId());

View File

@ -105,8 +105,7 @@ class AudioController final : public wxEvtHandler {
PM_ToEnd
};
/// The current playback mode
PlaybackMode playback_mode;
PlaybackMode playback_mode = PM_NotPlaying;
/// Timer used for playback position updates
wxTimer playback_timer;

View File

@ -514,9 +514,9 @@ class AudioMarkerInteractionObject final : public AudioDisplayInteractionObject
// Mouse button used to initiate the drag
wxMouseButton button_used;
// Default to snapping to snappable markers
bool default_snap;
bool default_snap = OPT_GET("Audio/Snap/Enable")->GetBool();
// Range in pixels to snap at
int snap_range;
int snap_range = OPT_GET("Audio/Snap/Distance")->GetInt();
public:
AudioMarkerInteractionObject(std::vector<AudioMarker*> markers, AudioTimingController *timing_controller, AudioDisplay *display, wxMouseButton button_used)
@ -524,8 +524,6 @@ public:
, timing_controller(timing_controller)
, display(display)
, button_used(button_used)
, default_snap(OPT_GET("Audio/Snap/Enable")->GetBool())
, snap_range(OPT_GET("Audio/Snap/Distance")->GetInt())
{
}

View File

@ -288,11 +288,11 @@ void DialogueTimingMarker::SetPosition(int new_position) {
/// active line's markers, updating those lines as well.
class AudioTimingControllerDialogue final : public AudioTimingController {
/// The rendering style for the active line's start marker
Pen style_left;
Pen style_left{"Colour/Audio Display/Line boundary Start", "Audio/Line Boundaries Thickness"};
/// The rendering style for the active line's end marker
Pen style_right;
Pen style_right{"Colour/Audio Display/Line boundary End", "Audio/Line Boundaries Thickness"};
/// The rendering style for the start and end markers of inactive lines
Pen style_inactive;
Pen style_inactive{"Colour/Audio Display/Line Boundary Inactive Line", "Audio/Line Boundaries Thickness"};
/// The currently active line
TimeableLine active_line;
@ -326,10 +326,10 @@ class AudioTimingControllerDialogue final : public AudioTimingController {
agi::Context *context;
/// Autocommit option
const agi::OptionValue *auto_commit;
const agi::OptionValue *inactive_line_mode;
const agi::OptionValue *inactive_line_comments;
const agi::OptionValue *drag_timing;
const agi::OptionValue *auto_commit = OPT_GET("Audio/Auto/Commit");
const agi::OptionValue *inactive_line_mode = OPT_GET("Audio/Inactive Lines Display Mode");
const agi::OptionValue *inactive_line_comments = OPT_GET("Audio/Display/Draw/Inactive Comments");
const agi::OptionValue *drag_timing = OPT_GET("Audio/Drag Timing");
agi::signal::Connection commit_connection;
agi::signal::Connection audio_open_connection;
@ -415,17 +415,10 @@ std::unique_ptr<AudioTimingController> CreateDialogueTimingController(agi::Conte
}
AudioTimingControllerDialogue::AudioTimingControllerDialogue(agi::Context *c)
: style_left("Colour/Audio Display/Line boundary Start", "Audio/Line Boundaries Thickness")
, style_right("Colour/Audio Display/Line boundary End", "Audio/Line Boundaries Thickness")
, style_inactive("Colour/Audio Display/Line Boundary Inactive Line", "Audio/Line Boundaries Thickness")
, active_line(AudioStyle_Primary, &style_left, &style_right)
: active_line(AudioStyle_Primary, &style_left, &style_right)
, keyframes_provider(c, "Audio/Display/Draw/Keyframes in Dialogue Mode")
, video_position_provider(c)
, context(c)
, auto_commit(OPT_GET("Audio/Auto/Commit"))
, inactive_line_mode(OPT_GET("Audio/Inactive Lines Display Mode"))
, inactive_line_comments(OPT_GET("Audio/Display/Draw/Inactive Comments"))
, drag_timing(OPT_GET("Audio/Drag Timing"))
, commit_connection(c->ass->AddCommitListener(&AudioTimingControllerDialogue::OnFileChanged, this))
, inactive_line_mode_connection(OPT_SUB("Audio/Inactive Lines Display Mode", &AudioTimingControllerDialogue::RegenerateInactiveLines, this))
, inactive_line_comment_connection(OPT_SUB("Audio/Display/Draw/Inactive Comments", &AudioTimingControllerDialogue::RegenerateInactiveLines, this))

View File

@ -45,8 +45,8 @@
/// @brief AudioMarker implementation for AudioTimingControllerKaraoke
class KaraokeMarker final : public AudioMarker {
int position;
Pen *pen;
FeetStyle style;
Pen *pen = nullptr;
FeetStyle style = Feet_None;
public:
int GetPosition() const override { return position; }
@ -65,8 +65,6 @@ public:
KaraokeMarker(int position)
: position(position)
, pen(nullptr)
, style(Feet_None)
{
}
@ -92,11 +90,11 @@ class AudioTimingControllerKaraoke final : public AudioTimingController {
size_t cur_syl = 0; ///< Index of currently selected syllable in the line
/// Pen used for the mid-syllable markers
Pen separator_pen;
Pen separator_pen{"Colour/Audio Display/Syllable Boundaries", "Audio/Line Boundaries Thickness", wxPENSTYLE_DOT};
/// Pen used for the start-of-line marker
Pen start_pen;
Pen start_pen{"Colour/Audio Display/Line boundary Start", "Audio/Line Boundaries Thickness"};
/// Pen used for the end-of-line marker
Pen end_pen;
Pen end_pen{"Colour/Audio Display/Line boundary End", "Audio/Line Boundaries Thickness"};
/// Immobile marker for the beginning of the line
KaraokeMarker start_marker;
@ -114,12 +112,11 @@ class AudioTimingControllerKaraoke final : public AudioTimingController {
/// Labels containing the stripped text of each syllable
std::vector<AudioLabel> labels;
bool auto_commit; ///< Should changes be automatically commited?
/// Should changes be automatically commited?
bool auto_commit = OPT_GET("Audio/Auto/Commit")->GetBool();
int commit_id = -1; ///< Last commit id used for an autocommit
bool pending_changes; ///< Are there any pending changes to be committed?
void OnAutoCommitChange(agi::OptionValue const& opt);
void DoCommit();
void ApplyLead(bool announce_primary);
int MoveMarker(KaraokeMarker *marker, int new_position);
@ -160,17 +157,13 @@ AudioTimingControllerKaraoke::AudioTimingControllerKaraoke(agi::Context *c, AssK
, c(c)
, active_line(c->selectionController->GetActiveLine())
, kara(kara)
, separator_pen("Colour/Audio Display/Syllable Boundaries", "Audio/Line Boundaries Thickness", wxPENSTYLE_DOT)
, start_pen("Colour/Audio Display/Line boundary Start", "Audio/Line Boundaries Thickness")
, end_pen("Colour/Audio Display/Line boundary End", "Audio/Line Boundaries Thickness")
, start_marker(active_line->Start, &start_pen, AudioMarker::Feet_Right)
, end_marker(active_line->End, &end_pen, AudioMarker::Feet_Left)
, keyframes_provider(c, "Audio/Display/Draw/Keyframes in Karaoke Mode")
, video_position_provider(c)
, auto_commit(OPT_GET("Audio/Auto/Commit")->GetBool())
{
slots.push_back(kara->AddSyllablesChangedListener(&AudioTimingControllerKaraoke::Revert, this));
slots.push_back(OPT_SUB("Audio/Auto/Commit", &AudioTimingControllerKaraoke::OnAutoCommitChange, this));
slots.push_back(OPT_SUB("Audio/Auto/Commit", [=](agi::OptionValue const& opt) { auto_commit = opt.GetBool(); }));
keyframes_provider.AddMarkerMovedListener([=]{ AnnounceMarkerMoved(); });
video_position_provider.AddMarkerMovedListener([=]{ AnnounceMarkerMoved(); });
@ -178,10 +171,6 @@ AudioTimingControllerKaraoke::AudioTimingControllerKaraoke(agi::Context *c, AssK
Revert();
}
void AudioTimingControllerKaraoke::OnAutoCommitChange(agi::OptionValue const& opt) {
auto_commit = opt.GetBool();
}
void AudioTimingControllerKaraoke::Next(NextMode mode) {
// Don't create new lines since it's almost never useful to k-time a line
// before dialogue timing it

View File

@ -88,7 +88,8 @@ class KaraokeLineMatchDisplay final : public wxControl {
void OnPaint(wxPaintEvent &event);
const wxString label_source, label_destination;
wxString const& label_source = TEXT_LABEL_SOURCE;
wxString const& label_destination = TEXT_LABEL_DEST;
public:
/// Start processing a new line pair
@ -120,8 +121,6 @@ public:
KaraokeLineMatchDisplay::KaraokeLineMatchDisplay(wxWindow *parent)
: wxControl(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE|wxWANTS_CHARS)
, label_source(TEXT_LABEL_SOURCE)
, label_destination(TEXT_LABEL_DEST)
{
InheritAttributes();
SetInputData(nullptr, nullptr);

View File

@ -203,7 +203,6 @@ std::function<MatchState (const AssDialogue*, size_t)> SearchReplaceEngine::GetM
SearchReplaceEngine::SearchReplaceEngine(agi::Context *c)
: context(c)
, initialized(false)
{
}

View File

@ -56,7 +56,7 @@ struct SearchReplaceSettings {
class SearchReplaceEngine {
agi::Context *context;
bool initialized;
bool initialized = false;
SearchReplaceSettings settings;
bool FindReplace(bool replace);

View File

@ -30,15 +30,8 @@
#include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp>
#ifdef _WIN32
#define NEWLINE "\r\n"
#else
#define NEWLINE "\n"
#endif
TextFileWriter::TextFileWriter(agi::fs::path const& filename, std::string encoding)
: file(new agi::io::Save(filename, true))
, newline(NEWLINE)
{
if (encoding.empty())
encoding = OPT_GET("App/Save Charset")->GetString();

View File

@ -32,7 +32,11 @@ namespace agi {
class TextFileWriter {
std::unique_ptr<agi::io::Save> file;
std::unique_ptr<agi::charset::IconvWrapper> conv;
std::string newline;
#ifdef _WIN32
std::string newline = "\r\n";
#else
std::string newline = "\n";
#endif
public:
TextFileWriter(agi::fs::path const& filename, std::string encoding="");