]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.45
authorfred <fred>
Sun, 24 Mar 2002 19:36:56 +0000 (19:36 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:36:56 +0000 (19:36 +0000)
flower/matrix.cc
lily/include/p-col.hh

index 9d229c0ae128c2deb53a7d0c72ff315f18aee64c..885d69f683c7a133e67dc7017c80ab1e122323a9 100644 (file)
@@ -201,9 +201,10 @@ Matrix::set_product(Matrix const &m1, Matrix const &m2)
 void
 Matrix::insert_row(Vector v, int k)
 {
+    int c = cols();
     assert(v.dim()==cols());
     dat->insert_row(k);
-    for (int j=0; j < cols(); j++)
+    for (int j=0; j < c; j++)
        dat->elem(k,j)=v(j);
 }
 
@@ -212,7 +213,8 @@ void
 Matrix::swap_columns(int c1, int c2)
 {
     assert(c1>=0&& c1 < cols()&&c2 < cols() && c2 >=0);
-    for (int i=0; i< rows(); i++) {
+    int r = rows();
+    for (int i=0; i< r; i++) {
        Real r=dat->elem(i,c1);
        dat->elem(i,c1) = dat->elem(i,c2);
        dat->elem(i,c2)=r;
@@ -223,7 +225,8 @@ void
 Matrix::swap_rows(int c1, int c2)
 {
     assert(c1>=0&& c1 < rows()&&c2 < rows() && c2 >=0);
-    for (int i=0; i< cols(); i++) {
+    int c = cols();
+    for (int i=0; i< c; i++) {
        Real r=dat->elem(c1,i);
        dat->elem(c1,i) = dat->elem(c2,i);
        dat->elem(c2,i)=r;
index 48d6c62a1958e7c01287d9ff25336e0bc02d2890..2a2dd92afc5d322a3ba9ac5b6327661f737d4e59 100644 (file)
     \end{itemize}
   */
 
-struct PCol { 
+class PCol { 
+public:
     PointerList<Item const *> its;
     PointerList<Spanner const *> stoppers, starters;
     
-
-
     /** prebreak is put before end of line.
     if broken here, then (*this) column is discarded, and prebreak
     is put at end of line, owned by Col
@@ -42,8 +41,10 @@ struct PCol {
     /// if lines are broken then this column is in #line#
     Line_of_score const *line_l_;
 
-    /// if lines are broken then this column x-coord #hpos#
-    Real hpos;
+    /** if lines are broken then this column x-coord #hpos# if not
+      known, then hpos == -1.(ugh?)  */
+
+    Real hpos;                 // should use ptr?
 
     PScore * pscore_l_;
 
@@ -68,13 +69,20 @@ struct PCol {
       signed compare on columns.
 
       @return < 0 if c1 < c2.
-    */static int compare(const PCol &c1, const PCol &c2);
-    
+    */
+    static int compare(const PCol &c1, const PCol &c2);
+    void set_rank(int);
 
     void OK() const;
     void set_breakable();
     void print()const;
 private:
+    
+    /**
+      The ranking: left is smaller than right 
+      -1 is uninitialised.
+     */
+    int rank_i_;
     PCol(PCol const&){}
 };