[SCM] audacity/master: Improve label-region-relation patch.
bdrung at users.alioth.debian.org
bdrung at users.alioth.debian.org
Sat Feb 18 11:41:27 UTC 2012
The following commit has been merged in the master branch:
commit 92a6d54566b53475a134ec1f1a7998627ad3bea6
Author: Benjamin Drung <bdrung at debian.org>
Date: Sat Feb 18 12:40:15 2012 +0100
Improve label-region-relation patch.
diff --git a/debian/patches/label-region-relation.patch b/debian/patches/label-region-relation.patch
index 218895e..80700ca 100644
--- a/debian/patches/label-region-relation.patch
+++ b/debian/patches/label-region-relation.patch
@@ -1,12 +1,16 @@
-Description: Change the behaviour of point labels to behave like region labels.
+Description: Add an option to retain labels when they define the edge of a
+ selection.
Author: Benjamin Drung <bdrung at debian.org>
Bug: http://bugzilla.audacityteam.org/show_bug.cgi?id=466
--- a/src/LabelTrack.cpp
+++ b/src/LabelTrack.cpp
-@@ -1240,31 +1240,21 @@
+@@ -1238,36 +1238,64 @@
+ LabelStruct::TimeRelations LabelStruct::RegionRelation(
+ double reg_t0, double reg_t1, LabelTrack *parent)
{
- wxASSERT(reg_t0 <= reg_t1);
+- wxASSERT(reg_t0 <= reg_t1);
++ bool retainLabels = false;
- // AWD: Desired behavior for edge cases: point labels bordered by the
- // selection are included within it. Region labels are included in the
@@ -14,33 +18,96 @@ Bug: http://bugzilla.audacityteam.org/show_bug.cgi?id=466
- // they're not included at all if the selection borders them, and they're
- // fully included if the selection covers them fully, even if it just
- // borders their endpoints. This is just one of many possible schemes.
-+ // Desired behavior for edge cases: The length of the selection is smaller
-+ // than the length of the label if the selection is within the label.
-+ // Selections matching exactly a (region) label surround the label.
-
+-
- // The first test catches bordered point-labels and selected-through
- // region-labels; move it to third and selection edges become inclusive WRT
- // point-labels.
- if (reg_t0 <= t && reg_t1 >= t1)
-+ if ((reg_t0 < t && reg_t1 > t1) || (reg_t0 == t && reg_t1 == t1))
- return SURROUNDS_LABEL;
+- return SURROUNDS_LABEL;
- else if (reg_t1 <= t)
-+ else if (reg_t1 < t)
- return BEFORE_LABEL;
+- return BEFORE_LABEL;
- else if (reg_t0 >= t1)
-+ else if (reg_t0 > t1)
- return AFTER_LABEL;
-
+- return AFTER_LABEL;
+-
- // At this point, all point labels should have returned.
-
- else if (reg_t0 > t && reg_t0 < t1 && reg_t1 > t && reg_t1 < t1)
-+ else if (reg_t0 >= t && reg_t0 <= t1 && reg_t1 >= t && reg_t1 <= t1)
- return WITHIN_LABEL;
-
+- return WITHIN_LABEL;
+-
- // Knowing that none of the other relations match simplifies remaining
- // tests
- else if (reg_t0 > t && reg_t0 < t1)
-+ else if (reg_t0 >= t && reg_t0 <= t1)
- return BEGINS_IN_LABEL;
- else
- return ENDS_IN_LABEL;
+- return BEGINS_IN_LABEL;
+- else
+- return ENDS_IN_LABEL;
++ wxASSERT(reg_t0 <= reg_t1);
++ gPrefs->Read(wxT("/GUI/RetainLabels"), &retainLabels);
++
++ if(retainLabels) {
++
++ // Desired behavior for edge cases: The length of the selection is smaller
++ // than the length of the label if the selection is within the label.
++ // Selections matching exactly a (region) label surround the label.
++
++ if ((reg_t0 < t && reg_t1 > t1) || (reg_t0 == t && reg_t1 == t1))
++ return SURROUNDS_LABEL;
++ else if (reg_t1 < t)
++ return BEFORE_LABEL;
++ else if (reg_t0 > t1)
++ return AFTER_LABEL;
++
++ else if (reg_t0 >= t && reg_t0 <= t1 && reg_t1 >= t && reg_t1 <= t1)
++ return WITHIN_LABEL;
++
++ else if (reg_t0 >= t && reg_t0 <= t1)
++ return BEGINS_IN_LABEL;
++ else
++ return ENDS_IN_LABEL;
++
++ } else {
++
++ // AWD: Desired behavior for edge cases: point labels bordered by the
++ // selection are included within it. Region labels are included in the
++ // selection to the extent that the selection covers them; specifically,
++ // they're not included at all if the selection borders them, and they're
++ // fully included if the selection covers them fully, even if it just
++ // borders their endpoints. This is just one of many possible schemes.
++
++ // The first test catches bordered point-labels and selected-through
++ // region-labels; move it to third and selection edges become inclusive
++ // WRT point-labels.
++ if (reg_t0 <= t && reg_t1 >= t1)
++ return SURROUNDS_LABEL;
++ else if (reg_t1 <= t)
++ return BEFORE_LABEL;
++ else if (reg_t0 >= t1)
++ return AFTER_LABEL;
++
++ // At this point, all point labels should have returned.
++
++ else if (reg_t0 > t && reg_t0 < t1 && reg_t1 > t && reg_t1 < t1)
++ return WITHIN_LABEL;
++
++ // Knowing that none of the other relations match simplifies remaining
++ // tests
++ else if (reg_t0 > t && reg_t0 < t1)
++ return BEGINS_IN_LABEL;
++ else
++ return ENDS_IN_LABEL;
++
++ }
+ }
+
+ /// If the index is for a real label, adjust its left or right boundary.
+--- a/src/prefs/GUIPrefs.cpp
++++ b/src/prefs/GUIPrefs.cpp
+@@ -128,6 +128,9 @@
+ S.TieCheckBox(_("&Show track name in waveform display"),
+ wxT("/GUI/ShowTrackNameInWaveform"),
+ false);
++ S.TieCheckBox(_("&Retain labels when they define the edge of a selection"),
++ wxT("/GUI/RetainLabels"),
++ false);
+ }
+ S.EndStatic();
+
--
Audacity debian packaging
More information about the pkg-multimedia-commits
mailing list