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