[project @ 13]
[mussa.git] / mussa_gui_seq_view.cc
index d0c58f14b937f24d7b084234346825e47b40820b..fc1408ab5de08a55caf0f0f42648664bde7410a6 100644 (file)
@@ -1,5 +1,15 @@
-#include "mussa_gui_seq.hh"
+//  This file is part of the Mussa source distribution.
+//  http://mussa.caltech.edu/
+//  Contact author: Tristan  De Buysscher, tristan@caltech.edu
+
+// This program and all associated source code files are Copyright (C) 2005
+// the California Institute of Technology, Pasadena, CA, 91125 USA.  It is
+// under the GNU Public License; please see the included LICENSE.txt
+// file for more information, or contact Tristan directly.
+
 
+#include "mussa_gui_seq.hh"
+#include <sstream>
 
 void
 SeqView::setup(string name, int sq_num, 
@@ -45,6 +55,27 @@ SeqView::setup(string name, int sq_num,
       cout << x() << " " << y() << " " << w() << " " << h() << endl;
 }
 
+void
+SeqView::resize(int new_x, int new_y, int new_w, int new_h)
+{
+  x(new_x);
+  y(new_y);
+  w(new_w);
+  h(new_h);
+
+  // hmmm, why do I use these values on the the widgets inherent ones?
+  // I think there was a reason...once?
+  x_max = new_w;
+  y_max = new_h;
+  x_min = new_x;
+  y_min = new_y;
+
+  // things that need to be recalculated
+  y_seq_incre = (y_max-10-10) / (seq_num - 1);
+}
+
+
+
 
 void
 SeqView::draw()
@@ -324,8 +355,9 @@ SeqView::draw_indices(double ch_width)
   int seq_i;
   Sequence a_seq;
   int y_loc;
-  string an_index;
+  ostringstream an_index;
   int shown_seq_len;
+  
 
   // clear out space on sides to draw in index values
   // I block out the sides rather than adding offsets to the drawing of seq
@@ -339,12 +371,14 @@ SeqView::draw_indices(double ch_width)
   y_loc = y_min + 10 + 5;
   for(seq_i = 0; seq_i < seq_num; seq_i++)
   {
-    an_index = int_to_str(seq_align_offsets[seq_i]-scroll_offset);
-    fl_draw(an_index.c_str(), 2, y_loc); 
+    an_index.str("");
+    an_index << (seq_align_offsets[seq_i]-scroll_offset);
+    fl_draw((an_index.str()).c_str(), 2, y_loc); 
 
     shown_seq_len = (w() - 2 * index_pad) / (int) ch_width;
-    an_index= int_to_str(seq_align_offsets[seq_i]-scroll_offset+shown_seq_len);
-    fl_draw(an_index.c_str(), w()-index_pad+2, y_loc); 
+    an_index.str("");
+    an_index << (seq_align_offsets[seq_i]-scroll_offset+shown_seq_len);
+    fl_draw((an_index.str()).c_str(), w()-index_pad+2, y_loc); 
     y_loc += y_seq_incre;
   }
 }