Implement UI for 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   //! copy selected track regions into a list of SequenceLocations
28   void copySelectedTracksAsSeqLocation(std::list<SequenceLocation>& );
29
30   //! return current zoom size
31   double zoom();
32
33   //! reset all of our stored data back to the empty state
34   void clear();
35
36   /* Attach sequences to our browser, its best to attach them all
37    * at once, as otherwise the Sidebar has some rendering trouble
38    * as it draw and redraws the SequenceDescriptions in the various
39    * positions.
40    */
41   //void push_sequences(std::vector<Sequence>& sequences);
42   void setSequences(
43       const std::vector< boost::shared_ptr<Sequence> >& sequences, 
44       boost::shared_ptr<AnnotationColors> cm);
45   void setSequences(std::vector<GlSequence>& sequences);
46   const std::vector<GlSequence>& sequences() const;
47
48   //! reset just the links we're displaying
49   void clear_links();
50   //! set per species links
51   void link(const std::vector<int> &path, const std::vector<bool>& isRC, int length);
52   // return set of pathids defined by order of link calls
53   const std::set<int> selectedPaths() const;
54   void centerOnPath(const std::vector<int>& paths);
55  
56 public slots:
57   //! copy selected sequence
58   void copySelectedSequenceAsFasta();
59
60   //! set the zoom level of our browser
61   void setZoom(double);
62   //! zoom to fit the whole scene on the screen
63   double zoomOut();
64   //! zoom to sequence
65   double zoomToSequence();
66
67   void updatePosition();
68   //! ask the user where to save an image of the current browser view
69   void promptSaveBrowserPixmap();
70
71   void update();
72
73 private:
74   ScrollableSequenceBrowser scrollable_browser;
75   SequenceBrowserSidebar left_sidebar;
76   SequenceBrowserSidebar right_sidebar;
77
78   //! sequences created by a setSequences(vector<Sequences>) call
79   /*! I need to save them so i can free them to avoid a memory leak 
80    */
81   std::vector<GlSequence> converted_sequences;
82 };
83 #endif