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