Shove simple getters in AudioTimingControllerDialogue into the class declaration
This commit is contained in:
parent
6f36c75cfd
commit
8a49cf1c34
1 changed files with 12 additions and 44 deletions
|
@ -380,7 +380,6 @@ class AudioTimingControllerDialogue final : public AudioTimingController {
|
||||||
/// @param user_triggered Is this a user-initiated commit or an autocommit
|
/// @param user_triggered Is this a user-initiated commit or an autocommit
|
||||||
void DoCommit(bool user_triggered);
|
void DoCommit(bool user_triggered);
|
||||||
|
|
||||||
void OnActiveLineChanged();
|
|
||||||
void OnSelectedSetChanged();
|
void OnSelectedSetChanged();
|
||||||
|
|
||||||
// AssFile events
|
// AssFile events
|
||||||
|
@ -391,15 +390,10 @@ public:
|
||||||
void GetMarkers(const TimeRange &range, AudioMarkerVector &out_markers) const override;
|
void GetMarkers(const TimeRange &range, AudioMarkerVector &out_markers) const override;
|
||||||
|
|
||||||
// AudioTimingController interface
|
// AudioTimingController interface
|
||||||
wxString GetWarningMessage() const override;
|
|
||||||
TimeRange GetIdealVisibleTimeRange() const override;
|
|
||||||
TimeRange GetPrimaryPlaybackRange() const override;
|
|
||||||
TimeRange GetActiveLineRange() const override;
|
|
||||||
void GetRenderingStyles(AudioRenderingStyleRanges &ranges) const override;
|
void GetRenderingStyles(AudioRenderingStyleRanges &ranges) const override;
|
||||||
void GetLabels(TimeRange const& range, std::vector<AudioLabel> &out) const override { }
|
void GetLabels(TimeRange const& range, std::vector<AudioLabel> &out) const override { }
|
||||||
void Next(NextMode mode) override;
|
void Next(NextMode mode) override;
|
||||||
void Prev() override;
|
void Prev() override;
|
||||||
void Commit() override;
|
|
||||||
void Revert() override;
|
void Revert() override;
|
||||||
void AddLeadIn() override;
|
void AddLeadIn() override;
|
||||||
void AddLeadOut() override;
|
void AddLeadOut() override;
|
||||||
|
@ -410,6 +404,13 @@ public:
|
||||||
std::vector<AudioMarker*> OnRightClick(int ms, bool, int sensitivity, int snap_range) override;
|
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) override;
|
void OnMarkerDrag(std::vector<AudioMarker*> const& markers, int new_position, int snap_range) override;
|
||||||
|
|
||||||
|
// We have no warning messages currently, maybe add the old "Modified" message back later?
|
||||||
|
wxString GetWarningMessage() const override { return wxString(); }
|
||||||
|
TimeRange GetIdealVisibleTimeRange() const override { return active_line; }
|
||||||
|
TimeRange GetPrimaryPlaybackRange() const override { return active_line; }
|
||||||
|
TimeRange GetActiveLineRange() const override { return active_line; }
|
||||||
|
void Commit() override { DoCommit(true); }
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// @param c Project context
|
/// @param c Project context
|
||||||
AudioTimingControllerDialogue(agi::Context *c);
|
AudioTimingControllerDialogue(agi::Context *c);
|
||||||
|
@ -423,7 +424,7 @@ AudioTimingControllerDialogue::AudioTimingControllerDialogue(agi::Context *c)
|
||||||
, commit_connection(c->ass->AddCommitListener(&AudioTimingControllerDialogue::OnFileChanged, this))
|
, commit_connection(c->ass->AddCommitListener(&AudioTimingControllerDialogue::OnFileChanged, this))
|
||||||
, inactive_line_mode_connection(OPT_SUB("Audio/Inactive Lines Display Mode", &AudioTimingControllerDialogue::RegenerateInactiveLines, 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))
|
, inactive_line_comment_connection(OPT_SUB("Audio/Display/Draw/Inactive Comments", &AudioTimingControllerDialogue::RegenerateInactiveLines, this))
|
||||||
, active_line_connection(c->selectionController->AddActiveLineListener(&AudioTimingControllerDialogue::OnActiveLineChanged, this))
|
, active_line_connection(c->selectionController->AddActiveLineListener(&AudioTimingControllerDialogue::Revert, this))
|
||||||
, selection_connection(c->selectionController->AddSelectionListener(&AudioTimingControllerDialogue::OnSelectedSetChanged, this))
|
, selection_connection(c->selectionController->AddSelectionListener(&AudioTimingControllerDialogue::OnSelectedSetChanged, this))
|
||||||
{
|
{
|
||||||
keyframes_provider.AddMarkerMovedListener([=]{ AnnounceMarkerMoved(); });
|
keyframes_provider.AddMarkerMovedListener([=]{ AnnounceMarkerMoved(); });
|
||||||
|
@ -450,11 +451,6 @@ void AudioTimingControllerDialogue::GetMarkers(const TimeRange &range, AudioMark
|
||||||
video_position_provider.GetMarkers(range, out_markers);
|
video_position_provider.GetMarkers(range, out_markers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioTimingControllerDialogue::OnActiveLineChanged()
|
|
||||||
{
|
|
||||||
Revert();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudioTimingControllerDialogue::OnSelectedSetChanged()
|
void AudioTimingControllerDialogue::OnSelectedSetChanged()
|
||||||
{
|
{
|
||||||
RegenerateSelectedLines();
|
RegenerateSelectedLines();
|
||||||
|
@ -468,27 +464,6 @@ void AudioTimingControllerDialogue::OnFileChanged(int type) {
|
||||||
RegenerateInactiveLines();
|
RegenerateInactiveLines();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString AudioTimingControllerDialogue::GetWarningMessage() const
|
|
||||||
{
|
|
||||||
// We have no warning messages currently, maybe add the old "Modified" message back later?
|
|
||||||
return wxString();
|
|
||||||
}
|
|
||||||
|
|
||||||
TimeRange AudioTimingControllerDialogue::GetIdealVisibleTimeRange() const
|
|
||||||
{
|
|
||||||
return GetPrimaryPlaybackRange();
|
|
||||||
}
|
|
||||||
|
|
||||||
TimeRange AudioTimingControllerDialogue::GetPrimaryPlaybackRange() const
|
|
||||||
{
|
|
||||||
return active_line;
|
|
||||||
}
|
|
||||||
|
|
||||||
TimeRange AudioTimingControllerDialogue::GetActiveLineRange() const
|
|
||||||
{
|
|
||||||
return active_line;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudioTimingControllerDialogue::GetRenderingStyles(AudioRenderingStyleRanges &ranges) const
|
void AudioTimingControllerDialogue::GetRenderingStyles(AudioRenderingStyleRanges &ranges) const
|
||||||
{
|
{
|
||||||
active_line.GetStyleRange(&ranges);
|
active_line.GetStyleRange(&ranges);
|
||||||
|
@ -527,11 +502,6 @@ void AudioTimingControllerDialogue::Prev()
|
||||||
context->selectionController->PrevLine();
|
context->selectionController->PrevLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioTimingControllerDialogue::Commit()
|
|
||||||
{
|
|
||||||
DoCommit(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudioTimingControllerDialogue::DoCommit(bool user_triggered)
|
void AudioTimingControllerDialogue::DoCommit(bool user_triggered)
|
||||||
{
|
{
|
||||||
// Store back new times
|
// Store back new times
|
||||||
|
@ -735,14 +705,12 @@ void AudioTimingControllerDialogue::SetMarkers(std::vector<AudioMarker*> const&
|
||||||
AnnounceMarkerMoved();
|
AnnounceMarkerMoved();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool noncomment_dialogue(AssDialogue const& diag)
|
|
||||||
{
|
|
||||||
return !diag.Comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudioTimingControllerDialogue::RegenerateInactiveLines()
|
void AudioTimingControllerDialogue::RegenerateInactiveLines()
|
||||||
{
|
{
|
||||||
auto predicate = inactive_line_comments->GetBool() ? [](AssDialogue const&) { return true; } : noncomment_dialogue;
|
using pred = bool(*)(AssDialogue const&);
|
||||||
|
auto predicate = inactive_line_comments->GetBool()
|
||||||
|
? (pred)[](AssDialogue const&) { return true; }
|
||||||
|
: (pred)[](AssDialogue const& d) { return !d.Comment; };
|
||||||
|
|
||||||
bool was_empty = inactive_lines.empty();
|
bool was_empty = inactive_lines.empty();
|
||||||
inactive_lines.clear();
|
inactive_lines.clear();
|
||||||
|
|
Loading…
Reference in a new issue