From bb0f5c242c6741e3acbdbfbdb3bdb4f7dcdb37c5 Mon Sep 17 00:00:00 2001
From: Robert Jonsson <spamatica@gmail.com>
Date: Thu, 20 Oct 2011 21:09:24 +0000
Subject: merged back release branch to trunk

---
 muse2/ChangeLog                                  |   2 +
 muse2/README.svn-branch                          | 125 +++++++++++++++++++++++
 muse2/muse/functions.cpp                         |  10 +-
 muse2/muse/midiedit/drumedit.cpp                 |   5 +-
 muse2/muse/widgets/function_dialogs/quantbase.ui |  24 ++++-
 muse2/muse/widgets/function_dialogs/quantize.cpp |  22 +++-
 muse2/muse/widgets/function_dialogs/quantize.h   |   5 +-
 7 files changed, 180 insertions(+), 13 deletions(-)
 create mode 100644 muse2/README.svn-branch

diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 26bb1f1e..fa26cc93 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,5 @@
+20.10.2011:
+        - Added missing triplets in quantisation dialog (rj)
 16.10.2011:
         - Fixed crashes reloading songs having open editors. Previous memleak fixes revealed some problems. (Tim)
           Installed bool TopWin::deleting(). It is set true when closeEvent() is called in any self-deleting TopWins.
diff --git a/muse2/README.svn-branch b/muse2/README.svn-branch
new file mode 100644
index 00000000..94e44ed8
--- /dev/null
+++ b/muse2/README.svn-branch
@@ -0,0 +1,125 @@
+Branches are handy for developing larger features (especially if you
+temporarily break muse and then fix it again). You might want to ask
+why you shouldn't simply develop in your local working copy, and then
+commit a huge chunk. Well, this has multiple reasons:
+  o with branches, you'll have a history, because there are many small
+    commits. this makes bisecting for finding a bug possible.
+  o when you develop your feature publicly, others can check out half-done
+    versions, and already test the one half. they also could fix bugs.
+  o another advantage of keeping it public is: others can see whether you
+    may exclude some use case and inform you about that in time. otherwise
+    you'd spend lots of work in a design which was obsolete from the
+    beginning.
+  o and it shows that there's something going on :)
+
+also, branching makes "feature freezes" easier, for release planning.
+
+General note: ^/trunk means [url of the repo]/trunk. when you're inside
+a working copy, svn understands the ^/trunk notation.
+i assume you're inside some working copy
+
+whenever merging, make sure you're in the correct directory!
+
+CREATING A BRANCH
+  the following command creates a branch called yourbranch in the branches
+  directory, which is built upon the current (NOT the checked out!) trunk
+  revision:
+
+  svn copy ^/trunk ^/branches/yourbranch
+
+  svn copy does a "light copy", that is, as long as you don't change files,
+  they don't occupy any disk space.
+
+USING THE BRANCH
+  you might want to checkout every branch relevant to you into another local
+  copy. believe me, it makes life easier. alternatively, svn switch is your
+  friend.
+  just develop inside the working copy, then commit.
+
+MERGING WITH THE PARENT BRANCH (in my example: the trunk)
+  from time to time, you want to update your branch to represent the
+  current trunk plus your changes (and not an ancient trunk plus your
+  changes). to be safe, only merge with the parent branch, and only
+  merge in one direction (usually from trunk into your branch), unless
+  you know what you're doing. if you're reading and not skimming this,
+  you're probably NOT knowing. svn help and google are your friends.
+
+  be in your branch'es working directory root (the dir which is containing
+  all the files/dirs also trunk (the parent) is containing as well.
+
+  svn merge ^/trunk --accept postpone
+
+  does the job for you. there might be conflicts, when both in your branch
+  and in trunk some file has been changes at a similar location. svn by
+  default asks you what to do then, which is annoying. --accept postpone
+  turns this off, and gives you a summary at the end of the merge.
+  
+  If There Were Conflicts:
+    if any file in "svn status"'s output has a C in front of it, there are
+    conflicts. open the file in your editor, and look for markers like
+    "<<<<<", "=====" and ">>>>>". these show what code is in the trunk
+    (between <<<< and ====), and what code is in your branch (between
+    ==== and >>>>) (or vice versa. svn tells you).
+    you have to make it work again and save the file.
+    
+    with "svn resolved FILENAME" or "svn resolved -R some/directory" you
+    mark the conflicts for FILENAME or all files below some/directory as
+    solved.
+  
+  Another word about conflicts: there may be conflicts, even if svn doesn't
+  note them. ALWAYS recompile the merged code and test it.
+  
+  if done, you can commit the merge normally using "svn commit"
+  
+PUTTING YOUR WORK BACK INTO THE PARENT BRANCH (in my example: trunk)
+  do a final merge from your parent branch into your branch. compile and
+  test.
+  then there are several ways to proceed:
+    o use svn merge --reintegrate, which doesn't work with the old repo
+      version muse is using :(
+    o go into the trunk (or the parent branch'es directory), and issue
+         svn merge ^/branches/yourbranch --accept theirs-full
+      the problem with the merge is, that every previous merge from trunk
+      into your branch will be applied a second time, which doesn't work.
+      --accept theirs-full will basically use the files in your branch.
+      you might want to verify with diff:
+         diff -R /path/to/local/trunk /path/to/local/yourbranch
+      there should be no differences.
+      
+      commit that to trunk: svn commit
+
+      then, "fake-merge" trunk into your branch again. otherwise, with the
+      next merge from trunk into your branch, we would have the duplicate
+      changes problem again. if you're _SURE_ that you aren't using the
+      branch any more, you can leave this step out.
+
+      svn merge ^/trunk ^/branches/yourbranch --record-only
+      svn commit
+     
+
+  this solution is a bit hackish :( but it works
+
+
+NOTES FOR RELEASE BRANCHES
+  after creating the release branch, ALL commits which are fixing bugs
+  must go into the release branch. ALL commits which are adding features
+  must go into trunk or other branches.
+  the team should focus on fixing bugs in the release branch.
+  to get the fixes into the trunk, from time to time run:
+
+  svn merge ^/branches/releasebranch ^/trunk
+  svn commit (in trunk's local copy)
+  
+  when releasing the release branch, merge it into the trunk a last time,
+  and then never touch the release branch again.
+  for the next release, create a new one.
+
+TAGGING
+  when there's any reason for tagging a revision, simply do
+  svn copy ^/whatever ^/tags/yourtagname
+  read the svn manual for details
+
+GETTING HELP:
+  svn help <command> (usage notes, short explanations)
+  google (everything)
+  the svn book (->google) (long explanations)
diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp
index e0f9690c..256e4ad0 100644
--- a/muse2/muse/functions.cpp
+++ b/muse2/muse/functions.cpp
@@ -177,8 +177,9 @@ bool quantize_notes(const set<Part*>& parts)
 {
 	if (!MusEGui::quantize_dialog->exec())
 		return false;
-		
-	quantize_notes(parts, MusEGui::quantize_dialog->range, (MusEGlobal::config.division*4)/(1<<MusEGui::quantize_dialog->raster_power2),
+//  (1<<MusEGui::quantize_dialog->raster_power2)
+  int raster = MusEGui::rasterVals[MusEGui::quantize_dialog->raster_index];
+  quantize_notes(parts, MusEGui::quantize_dialog->range, (MusEGlobal::config.division*4)/raster,
 	               MusEGui::quantize_dialog->quant_len, MusEGui::quantize_dialog->strength, MusEGui::quantize_dialog->swing,
 	               MusEGui::quantize_dialog->threshold);
 	
@@ -306,8 +307,9 @@ bool quantize_notes()
 		parts=get_all_selected_parts();
 	else
 		parts=get_all_parts();
-		
-	quantize_notes(parts, MusEGui::quantize_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, (config.division*4)/(1<<MusEGui::quantize_dialog->raster_power2),
+
+  int raster = MusEGui::rasterVals[MusEGui::quantize_dialog->raster_index];
+  quantize_notes(parts, MusEGui::quantize_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, (config.division*4)/raster,
 	               MusEGui::quantize_dialog->quant_len, MusEGui::quantize_dialog->strength, MusEGui::quantize_dialog->swing,
 	               MusEGui::quantize_dialog->threshold);
 	
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index 19700a4e..b07ebbbe 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -945,12 +945,15 @@ void DrumEdit::cmd(int cmd)
             case DrumCanvas::CMD_MODIFY_VELOCITY: modify_velocity(partlist_to_set(parts())); break;
             case DrumCanvas::CMD_CRESCENDO: crescendo(partlist_to_set(parts())); break;
             case DrumCanvas::CMD_QUANTIZE:
+                  {
+                  int raster = MusEGui::rasterVals[MusEGui::quantize_dialog->raster_index];
                   if (quantize_dialog->exec())
                         quantize_notes(partlist_to_set(parts()), quantize_dialog->range, 
-                                       (MusEGlobal::config.division*4)/(1<<quantize_dialog->raster_power2),
+                                       (MusEGlobal::config.division*4)/raster,
                                        /* quant_len= */false, quantize_dialog->strength, 
                                        quantize_dialog->swing, quantize_dialog->threshold);
                   break;
+                  }
             case DrumCanvas::CMD_ERASE_EVENT: erase_notes(partlist_to_set(parts())); break;
             case DrumCanvas::CMD_DEL: erase_notes(partlist_to_set(parts()),1); break; //delete selected events
             case DrumCanvas::CMD_DELETE_OVERLAPS: delete_overlaps(partlist_to_set(parts())); break;
diff --git a/muse2/muse/widgets/function_dialogs/quantbase.ui b/muse2/muse/widgets/function_dialogs/quantbase.ui
index 973be7b8..31173e46 100644
--- a/muse2/muse/widgets/function_dialogs/quantbase.ui
+++ b/muse2/muse/widgets/function_dialogs/quantbase.ui
@@ -157,7 +157,7 @@
          <bool>false</bool>
         </property>
         <property name="currentIndex">
-         <number>3</number>
+         <number>0</number>
         </property>
         <property name="frame">
          <bool>true</bool>
@@ -174,7 +174,12 @@
         </item>
         <item>
          <property name="text">
-          <string>Quarter</string>
+          <string>4th</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>4th Triplet</string>
          </property>
         </item>
         <item>
@@ -182,16 +187,31 @@
           <string>8th</string>
          </property>
         </item>
+        <item>
+         <property name="text">
+          <string>8th Triplet</string>
+         </property>
+        </item>
         <item>
          <property name="text">
           <string>16th</string>
          </property>
         </item>
+        <item>
+         <property name="text">
+          <string>16th Triplet</string>
+         </property>
+        </item>
         <item>
          <property name="text">
           <string>32th</string>
          </property>
         </item>
+        <item>
+         <property name="text">
+          <string>32th Triplet</string>
+         </property>
+        </item>
        </widget>
       </item>
       <item row="3" column="0">
diff --git a/muse2/muse/widgets/function_dialogs/quantize.cpp b/muse2/muse/widgets/function_dialogs/quantize.cpp
index df7c0298..7233c2b8 100644
--- a/muse2/muse/widgets/function_dialogs/quantize.cpp
+++ b/muse2/muse/widgets/function_dialogs/quantize.cpp
@@ -26,6 +26,20 @@
 
 namespace MusEGui {
 
+int rasterVals[] = {
+  1, // Whole note divisor
+  2, // Half note divisor
+  4, // 4th note divisor
+  6, // 4thT divisor
+  8, // 8th divisor
+  12,//8thT divisor
+  16,// ...
+  24,
+  32,
+  48,
+  64
+};
+
 Quantize::Quantize(QWidget* parent)
 	: QDialog(parent)
 {
@@ -44,7 +58,7 @@ void Quantize::pull_values()
 	range = range_group->checkedId();
 	strength = strength_spinbox->value();
 	threshold = threshold_spinbox->value();
-	raster_power2 = raster_combobox->currentIndex();
+  raster_index = raster_combobox->currentIndex();
 	quant_len = len_checkbox->isChecked();
 	swing = swing_spinbox->value();
 }
@@ -62,7 +76,7 @@ int Quantize::exec()
 	range_group->button(range)->setChecked(true);
 	strength_spinbox->setValue(strength);
 	threshold_spinbox->setValue(threshold);
-	raster_combobox->setCurrentIndex(raster_power2);
+  raster_combobox->setCurrentIndex(raster_index);
 	len_checkbox->setChecked(quant_len);
 	swing_spinbox->setValue(swing);
 	
@@ -88,7 +102,7 @@ void Quantize::read_configuration(MusECore::Xml& xml)
 				else if (tag == "threshold")
 					threshold=xml.parseInt();
 				else if (tag == "raster")
-					raster_power2=xml.parseInt();
+          raster_index=xml.parseInt();
 				else if (tag == "swing")
 					swing=xml.parseInt();
 				else if (tag == "quant_len")
@@ -113,7 +127,7 @@ void Quantize::write_configuration(int level, MusECore::Xml& xml)
 	xml.intTag(level, "range", range);
 	xml.intTag(level, "strength", strength);
 	xml.intTag(level, "threshold", threshold);
-	xml.intTag(level, "raster", raster_power2);
+  xml.intTag(level, "raster", raster_index);
 	xml.intTag(level, "swing", swing);
 	xml.intTag(level, "quant_len", quant_len);
 	xml.tag(level, "/quantize");
diff --git a/muse2/muse/widgets/function_dialogs/quantize.h b/muse2/muse/widgets/function_dialogs/quantize.h
index 6ce74215..b5229f9e 100644
--- a/muse2/muse/widgets/function_dialogs/quantize.h
+++ b/muse2/muse/widgets/function_dialogs/quantize.h
@@ -33,6 +33,7 @@ class Xml;
 
 namespace MusEGui {
 
+
 class Quantize : public QDialog, public Ui::QuantBase
 {
  	Q_OBJECT
@@ -50,18 +51,18 @@ class Quantize : public QDialog, public Ui::QuantBase
 		int range;
 		int strength;
 		int threshold;
-		int raster_power2;
+    int raster_index;
 		int swing;
 		bool quant_len;
 		
 		void read_configuration(MusECore::Xml& xml);
 		void write_configuration(int level, MusECore::Xml& xml);
 		
-		
 	public slots:
 		int exec();
 };
 
+extern int rasterVals[];
 } // namespace MusEGui
 
 #endif
-- 
cgit v1.2.3