root/trunk/FRII/gui/AlignedPairSequenceView.hh

Revision 10, 2.5 kB (checked in by t, 3 years ago)

Tailorization
Import of the upstream sources from

Repository: :pserver:anonymous@cvs.sf.net:/cvsroot/familyjewels

Kind: cvs

Module: FRII

Revision: 2005-12-09 09:00:54 by titus

Original author: tailor@vallista.idyll.org
Date: 2005-12-09 09:00:54

Line 
1 /*
2  * This file is part of the FamilyRelations II source distribution.
3  *
4  * FamilyRelations II is part of the FamilyJewels package for comparative
5  * sequence analysis: http://family.caltech.edu/.
6  *
7  * Contact author: C. Titus Brown, titus@caltech.edu.
8  *
9  * This program and all associated source code files are Copyright (C) 2003,
10  * 2004 the California Institute of Technology, Pasadena, CA, 91125 USA.  It
11  * is under the Lesser GNU Public License; please see the included
12  * LICENSE.txt file for more information, or contact Titus directly.
13  *
14  */
15
16 // A class to handle display pairwise alignments of DNA sequences.
17 // Subclass of SequenceView.
18
19 #ifndef ALIGNED_PAIR_SEQUENCE_VIEW_HH
20 #define ALIGNED_PAIR_SEQUENCE_VIEW_HH
21
22 #include "SequenceView.hh"
23 #include <string>
24
25 namespace gui {
26   class AlignedPairSequenceView : public SequenceView {
27   private:
28     float ch_width;
29   protected:
30     std::string _top_aln;
31     std::string _bot_aln;
32
33     void draw();
34     void draw_labels();
35     //void draw_selection_box();
36
37     int handle(int e);
38
39     // font size (in pixels)
40     const static unsigned int font_size = 14;
41
42     // border size (in pixels)
43     const static unsigned int border = 35;
44
45     // half the size of the text label
46     const static unsigned int half_label_height = 5;
47
48     // the width of the text label
49     const static unsigned int label_width = border - 2;
50
51     // half the size of the selection box
52     const static unsigned int half_selection_height = 10;
53
54     // make sure that the view size is sensible
55     void _resize_view(unsigned int& s, unsigned int& e);
56   public:
57     AlignedPairSequenceView(int _x, int _y, unsigned int _w,
58                             std::string top_aln, std::string bot_aln);
59
60     // public access to the height; this must be used by groups,
61     // before the sequence is instantiated, which is why it's static.
62     const static unsigned int height = 80;
63
64     unsigned int base_to_pos(int base);
65     unsigned int pos_to_base(int pos);
66
67     // public access to some of the drawing information
68     unsigned int get_left(), get_width(), get_mid();
69
70     // override set_visible_bases to constrain view size first...
71     void set_visible_bases(unsigned int start, unsigned int end) {
72       _resize_view(start, end);
73       SequenceView::set_visible_bases(start, end);
74     }
75
76     void resize(int a, int b, int c, int d) {
77       SequenceView::resize(a, b, c, d);
78       _resize_view(_start, _end);
79     }
80
81     void scroll_right(unsigned int n), scroll_left(unsigned int n);
82   };
83 }
84
85 #endif // ALIGNED_PAIR_SEQUENCE_VIEW_HH
86
Note: See TracBrowser for help on using the browser.