Add option to show the previous and next inactive lines in the audio display in addition to previous, all or none. Updates #1386.
Originally committed to SVN as r6260.
This commit is contained in:
parent
a0fcd535c1
commit
d451cf3e9c
2 changed files with 37 additions and 21 deletions
|
@ -192,6 +192,10 @@ class AudioTimingControllerDialogue : public AudioTimingController, private Sele
|
||||||
/// Regenerate markers for inactive lines
|
/// Regenerate markers for inactive lines
|
||||||
void RegenerateInactiveLines();
|
void RegenerateInactiveLines();
|
||||||
|
|
||||||
|
/// Add the inactive line markers for a single line
|
||||||
|
/// @param line Line to add markers for. May be NULL.
|
||||||
|
void AddInactiveMarkers(AssDialogue *line);
|
||||||
|
|
||||||
/// @brief Set the position of a marker and announce the change to the world
|
/// @brief Set the position of a marker and announce the change to the world
|
||||||
/// @param marker Marker to move
|
/// @param marker Marker to move
|
||||||
/// @param sample New position of the marker
|
/// @param sample New position of the marker
|
||||||
|
@ -552,39 +556,38 @@ void AudioTimingControllerDialogue::SetMarker(AudioMarkerDialogueTiming *marker,
|
||||||
|
|
||||||
void AudioTimingControllerDialogue::RegenerateInactiveLines()
|
void AudioTimingControllerDialogue::RegenerateInactiveLines()
|
||||||
{
|
{
|
||||||
switch (inactive_line_mode->GetInt())
|
switch (int mode = inactive_line_mode->GetInt())
|
||||||
{
|
{
|
||||||
case 1: // Preview line only
|
case 1: // Previous line only
|
||||||
|
case 2: // Previous and next lines
|
||||||
inactive_markers.clear();
|
inactive_markers.clear();
|
||||||
if (AssDialogue *line = context->selectionController->GetActiveLine())
|
if (AssDialogue *line = context->selectionController->GetActiveLine())
|
||||||
{
|
{
|
||||||
std::list<AssEntry*>::iterator it = find(context->ass->Line.begin(), context->ass->Line.end(), line);
|
std::list<AssEntry*>::iterator current_line =
|
||||||
while (--it != context->ass->Line.begin() && !dynamic_cast<AssDialogue*>(*it)) ;
|
find(context->ass->Line.begin(), context->ass->Line.end(), line);
|
||||||
if (AssDialogue *prev = dynamic_cast<AssDialogue*>(*it))
|
|
||||||
|
std::list<AssEntry*>::iterator prev = current_line;
|
||||||
|
while (--prev != context->ass->Line.begin() && !dynamic_cast<AssDialogue*>(*prev)) ;
|
||||||
|
AddInactiveMarkers(dynamic_cast<AssDialogue*>(*prev));
|
||||||
|
|
||||||
|
if (mode == 2)
|
||||||
{
|
{
|
||||||
inactive_markers.push_back(InactiveLineMarker(
|
std::list<AssEntry*>::iterator next =
|
||||||
context->audioController->SamplesFromMilliseconds(prev->Start), true));
|
find_if(++current_line, context->ass->Line.end(), cast<AssDialogue*>());
|
||||||
inactive_markers.push_back(InactiveLineMarker(
|
if (next != context->ass->Line.end())
|
||||||
context->audioController->SamplesFromMilliseconds(prev->End), false));
|
AddInactiveMarkers(dynamic_cast<AssDialogue*>(*next));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // All inactive lines
|
case 3: // All inactive lines
|
||||||
{
|
{
|
||||||
inactive_markers.clear();
|
inactive_markers.clear();
|
||||||
AssDialogue *active_line = context->selectionController->GetActiveLine();
|
AssDialogue *active_line = context->selectionController->GetActiveLine();
|
||||||
for (std::list<AssEntry*>::const_iterator it = context->ass->Line.begin(); it != context->ass->Line.end(); ++it)
|
for (std::list<AssEntry*>::const_iterator it = context->ass->Line.begin(); it != context->ass->Line.end(); ++it)
|
||||||
{
|
{
|
||||||
AssDialogue *line = dynamic_cast<AssDialogue*>(*it);
|
if (*it != active_line)
|
||||||
if (line && line != active_line)
|
AddInactiveMarkers(dynamic_cast<AssDialogue*>(*it));
|
||||||
{
|
|
||||||
inactive_markers.push_back(InactiveLineMarker(
|
|
||||||
context->audioController->SamplesFromMilliseconds(line->Start), true));
|
|
||||||
inactive_markers.push_back(InactiveLineMarker(
|
|
||||||
context->audioController->SamplesFromMilliseconds(line->End), false));
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
sort(inactive_markers.begin(), inactive_markers.end());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -592,6 +595,8 @@ void AudioTimingControllerDialogue::RegenerateInactiveLines()
|
||||||
return;
|
return;
|
||||||
inactive_markers.clear();
|
inactive_markers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sort(inactive_markers.begin(), inactive_markers.end());
|
||||||
AnnounceUpdatedStyleRanges();
|
AnnounceUpdatedStyleRanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,3 +624,14 @@ int64_t AudioTimingControllerDialogue::SnapPosition(int64_t position, int64_t sn
|
||||||
return snap_marker->GetPosition();
|
return snap_marker->GetPosition();
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AudioTimingControllerDialogue::AddInactiveMarkers(AssDialogue *line)
|
||||||
|
{
|
||||||
|
if (line)
|
||||||
|
{
|
||||||
|
inactive_markers.push_back(InactiveLineMarker(
|
||||||
|
context->audioController->SamplesFromMilliseconds(line->Start), true));
|
||||||
|
inactive_markers.push_back(InactiveLineMarker(
|
||||||
|
context->audioController->SamplesFromMilliseconds(line->End), false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -152,8 +152,8 @@ Audio::Audio(wxTreebook *book, Preferences *parent): OptionPage(book, parent, _(
|
||||||
OptionAdd(general, _("Default lead-in length"), "Audio/Lead/IN", 0, 36000);
|
OptionAdd(general, _("Default lead-in length"), "Audio/Lead/IN", 0, 36000);
|
||||||
OptionAdd(general, _("Default lead-out length"), "Audio/Lead/OUT", 0, 36000);
|
OptionAdd(general, _("Default lead-out length"), "Audio/Lead/OUT", 0, 36000);
|
||||||
|
|
||||||
const wxString dtl_arr[3] = { _("Don't show"), _("Show previous"), _("Show all") };
|
const wxString dtl_arr[] = { _("Don't show"), _("Show previous"), _("Show previous and next"), _("Show all") };
|
||||||
wxArrayString choice_dtl(3, dtl_arr);
|
wxArrayString choice_dtl(4, dtl_arr);
|
||||||
OptionChoice(general, _("Show inactive lines"), choice_dtl, "Audio/Inactive Lines Display Mode");
|
OptionChoice(general, _("Show inactive lines"), choice_dtl, "Audio/Inactive Lines Display Mode");
|
||||||
OptionAdd(general, _("Start-marker drag sensitivity"), "Audio/Start Drag Sensitivity", 1, 15);
|
OptionAdd(general, _("Start-marker drag sensitivity"), "Audio/Start Drag Sensitivity", 1, 15);
|
||||||
OptionAdd(general, _("Line boundry thickness"), "Audio/Line Boundaries Thickness", 1, 5);
|
OptionAdd(general, _("Line boundry thickness"), "Audio/Line Boundaries Thickness", 1, 5);
|
||||||
|
|
Loading…
Reference in a new issue