cleanup image save dialog aesthetics
[mussa.git] / qui / MussaAlignedWindow.hpp
1 #ifndef MUSSA_ALIGNED_WINDOW_H
2 #define MUSSA_ALIGNED_WINDOW_H
3
4 #include <set>
5
6 #include <boost/shared_ptr.hpp>
7
8 #include <QMainWindow>
9 #include <QMenu>
10 #include <QToolBar>
11 #include "alg/mussa.hpp"
12 #include "qui/IntAction.hpp"
13 #include "qui/ZoomWidget.hpp"
14 #include "qui/ThresholdWidget.hpp"
15 #include "qui/seqbrowser/SequenceBrowserWidget.hpp"
16 #include "qui/SubanalysisWindow.hpp"
17
18 //! Show sequence alignments
19 class MussaAlignedWindow : public QMainWindow
20 {
21   Q_OBJECT 
22
23 public:
24   //! construct an aligned window for an analysis and selected paths
25   /*! \param analysis is a shared_ptr to a mussa analysis 
26    *  \param paths is a set of "paths" AKA integer offsets into the sequences stored in mussa
27    *  \param window points to a SubanalysisWindowRef, so we can pick interesting
28    *         sequence portions from both the mussa window and the sequence view window
29    *  \param parent is the typical Qt pointer to a parent widget
30    */ 
31   MussaAlignedWindow(MussaRef analysis, const std::set<int>& paths, 
32                      SubanalysisWindowRef window, QWidget *parent=0);
33
34 public slots:
35   //! launch a sub analysis
36   void createSubAnalysis();
37   //! use selected_paths[pathid] to set the starting position of our sequence
38   void setAlignment(int pathid);
39   //! toggle whether or not to show the aligned basepairs of a window
40   void toggleViewAlignment(int alignment_index);
41
42   //! just force updating the window
43   void update();
44   
45   //! set the title based on the analysis
46   void updateTitle();
47
48 protected:
49   // figure out what Alignments we have (needed for setupAlignmentMenus)
50   void setSelectedPaths(MussaRef m, const std::set<int>& sel_paths);
51   // create our cations
52   void setupActions();
53   // create our menus
54   void setupMenus();
55   //! set menus (must be called after setSelectedPaths)
56   void setupAlignmentMenus();
57   void computeMatchLines();
58   
59   MussaRef analysis;  
60   //std::vector<Sequence> sequences;
61   //const std::set<int>& selected_paths;
62   std::vector<ConservedPath> selected_paths;
63   std::vector<bool> view_paths;
64   SubanalysisWindowRef subanalysis_window;
65   SequenceBrowserWidget browser;
66   QMenu pick_align_menu;
67   QMenu view_align_menu;
68
69   QAction *createSubAnalysisAction;
70   QAction *saveBrowserPixmapAction;
71
72   std::vector <IntAction *> pick_actions;
73   std::vector <IntAction *> view_actions;
74   ZoomWidget *zoom;
75   ThresholdWidget *threshold_widget;
76   QToolBar *alignTB;
77 };
78
79 //! reference to a MussaAlignedWindow
80 typedef boost::shared_ptr<MussaAlignedWindow> MussaAlignedWindowRef;
81 #endif