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