center on path
[mussa.git] / qui / seqbrowser / SequenceBrowserWidget.hpp
1 #ifndef _PATH_WIDGET_H_
2 #define _PATH_WIDGET_H_
3
4 #include <vector>
5
6 #include <QSplitter>
7
8 #include "alg/sequence.hpp"
9 #include "alg/glsequence.hpp"
10 #include "qui/seqbrowser/ScrollableSequenceBrowser.hpp"
11 #include "qui/seqbrowser/SequenceBrowserSidebar.hpp"
12
13 //! the master widget that makes a useful Sequence Browser
14 class SequenceBrowserWidget : public QSplitter
15 {
16   Q_OBJECT 
17
18 public:
19   SequenceBrowserWidget(QWidget *parent=0);
20
21   //SequenceBrowser& browser() { return scrollable_browser.browser(); }
22  
23   //! reset all of our stored data back to the empty state
24   void clear();
25
26   /* Attach sequences to our browser, its best to attach them all
27    * at once, as otherwise the Sidebar has some rendering trouble
28    * as it draw and redraws the SequenceDescriptions in the various
29    * positions.
30    */
31   //void push_sequences(std::vector<Sequence>& sequences);
32   void setSequences(const std::vector<Sequence>& sequences, AnnotationColors& cm);
33   void setSequences(std::vector<GlSequence>& sequences);
34   const std::vector<GlSequence>& sequences() const;
35
36   //! reset just the links we're displaying
37   void clear_links();
38   //! set per species links
39   void link(const std::vector<int> &path, const std::vector<bool>& isRC, int length);
40   // return set of pathids defined by order of link calls
41   const std::set<int> selectedPaths() const;
42   void centerOnPath(const std::vector<int>& paths);
43  
44 public slots:
45   //! set the zoom level of our browser
46   void setZoom(int);
47
48   void updatePosition();
49   //! ask the user where to save an image of the current browser view
50   void promptSaveBrowserPixmap();
51
52 private:
53   ScrollableSequenceBrowser scrollable_browser;
54   SequenceBrowserSidebar left_sidebar;
55   SequenceBrowserSidebar right_sidebar;
56
57   //! sequences created by a setSequences(vector<Sequences>) call
58   /*! I need to save them so i can free them to avoid a memory leak 
59    */
60   std::vector<GlSequence> converted_sequences;
61 };
62 #endif