forked from mia/Aegisub
Use INT_MIN as the invalid click position sentinel rather than -1
This commit is contained in:
parent
c13b026598
commit
fc662e0278
1 changed files with 5 additions and 5 deletions
|
@ -616,7 +616,7 @@ std::vector<AudioMarker*> AudioTimingControllerDialogue::OnLeftClick(int ms, boo
|
||||||
|
|
||||||
std::vector<AudioMarker*> ret;
|
std::vector<AudioMarker*> ret;
|
||||||
|
|
||||||
clicked_ms = -1;
|
clicked_ms = INT_MIN;
|
||||||
if (alt_down)
|
if (alt_down)
|
||||||
{
|
{
|
||||||
clicked_ms = ms;
|
clicked_ms = ms;
|
||||||
|
@ -668,7 +668,7 @@ std::vector<AudioMarker*> AudioTimingControllerDialogue::OnLeftClick(int ms, boo
|
||||||
|
|
||||||
std::vector<AudioMarker*> AudioTimingControllerDialogue::OnRightClick(int ms, bool, int sensitivity, int snap_range)
|
std::vector<AudioMarker*> AudioTimingControllerDialogue::OnRightClick(int ms, bool, int sensitivity, int snap_range)
|
||||||
{
|
{
|
||||||
clicked_ms = -1;
|
clicked_ms = INT_MIN;
|
||||||
std::vector<AudioMarker*> ret = GetRightMarkers();
|
std::vector<AudioMarker*> ret = GetRightMarkers();
|
||||||
SetMarkers(ret, ms, snap_range);
|
SetMarkers(ret, ms, snap_range);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -689,7 +689,7 @@ void AudioTimingControllerDialogue::SetMarkers(std::vector<AudioMarker*> const&
|
||||||
{
|
{
|
||||||
if (upd_markers.empty()) return;
|
if (upd_markers.empty()) return;
|
||||||
|
|
||||||
int shift = clicked_ms >= 0 ? ms - clicked_ms : 0;
|
int shift = clicked_ms != INT_MIN ? ms - clicked_ms : 0;
|
||||||
if (shift) clicked_ms = ms;
|
if (shift) clicked_ms = ms;
|
||||||
|
|
||||||
// Since we're moving markers, the sorted list of markers will need to be
|
// Since we're moving markers, the sorted list of markers will need to be
|
||||||
|
@ -717,12 +717,12 @@ void AudioTimingControllerDialogue::SetMarkers(std::vector<AudioMarker*> const&
|
||||||
for (auto upd_marker : upd_markers)
|
for (auto upd_marker : upd_markers)
|
||||||
{
|
{
|
||||||
auto marker = static_cast<DialogueTimingMarker*>(upd_marker);
|
auto marker = static_cast<DialogueTimingMarker*>(upd_marker);
|
||||||
marker->SetPosition(clicked_ms >= 0 ? *marker + shift : ms);
|
marker->SetPosition(clicked_ms != INT_MIN ? *marker + shift : ms);
|
||||||
modified_lines.insert(marker->GetLine());
|
modified_lines.insert(marker->GetLine());
|
||||||
}
|
}
|
||||||
|
|
||||||
int snap = SnapMarkers(snap_range, upd_markers);
|
int snap = SnapMarkers(snap_range, upd_markers);
|
||||||
if (clicked_ms >= 0)
|
if (clicked_ms != INT_MIN)
|
||||||
clicked_ms += snap;
|
clicked_ms += snap;
|
||||||
|
|
||||||
// Resort the range
|
// Resort the range
|
||||||
|
|
Loading…
Reference in a new issue