panel.hpp
来自「ncbi源码」· HPP 代码 · 共 252 行
HPP
252 行
/* * =========================================================================== * PRODUCTION $Log: panel.hpp,v $ * PRODUCTION Revision 1000.2 2004/06/01 21:07:58 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.10 * PRODUCTION * =========================================================================== */#ifndef GUI_WIDGETS_ALN_TEXTALN___PANEL__HPP#define GUI_WIDGETS_ALN_TEXTALN___PANEL__HPP/* $Id: panel.hpp,v 1000.2 2004/06/01 21:07:58 gouriano Exp $ * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * * Authors: Vlad Lebedev * * File Description: * Panel for the text alignment view widget * (see <gui/widgets/aln_textaln/textaln_view.hpp>) * */#include <gui/gui.hpp>#include <gui/opengl.h>#include <gui/opengl/glbitmapfont.hpp>#include <gui/widgets/aln_data/align_ds.hpp>#include <gui/widgets/aln_textaln/view.hpp>#include <gui/objutils/feature.hpp>#include <objects/seqloc/Na_strand.hpp>#include <objects/seqalign/Dense_seg.hpp>#include <objmgr/feat_ci.hpp>#include <FL/Fl.H>#include <FL/Fl_Gl_Window.H>#include <FL/Fl_Slider.H>BEGIN_NCBI_SCOPEclass CTextAlnPanel : public Fl_Gl_Window{public: typedef unsigned int TDim; typedef objects::CDense_seg::TNumseg TNumseg; typedef TDim TNumrow; CTextAlnPanel(int x, int y, int w, int h, const char* label = NULL); virtual ~CTextAlnPanel(); void SetDataSource(CAlignDataSource* ds); // features void SetFeatureDisplay(CTextAlnView::EFeatureDisplay disp); // Colors void SetColor(CTextAlnView::EDisplayElement elem, Fl_Color color); Fl_Color GetColor(CTextAlnView::EDisplayElement elem) const; void SelectAll(bool flag); void ShowSequenceAsDots (bool show_dots); void SetAnchor(size_t idx); void UnsetAnchor(void); void Scroll(TSeqPos xPos, TSeqPos yPos); class CParaG { public: enum EParaGLineType { eSequence, eFeature, eInsertion }; typedef int TParaGLineType; // EParaGLineType CParaG(TParaGLineType type, size_t idx, CLayoutFeat* feature = NULL) : m_type(type), m_idx(idx), m_feature(feature) {}; TParaGLineType GetType(void) const { return m_type; } size_t GetIndex(void) const { return m_idx; } const CLayoutFeat* Feature(void) const { return m_feature; } private: TParaGLineType m_type; size_t m_idx; // index in the CDens_seg CRef<CLayoutFeat> m_feature; };private: CRef<CAlignDataSource> m_DS; enum ESelectionType { eRow, eCol }; // Scrollbars values TSeqPos m_ScrX; TNumrow m_ScrY; TSeqPos m_AlnWidth; TNumrow m_AlnHeight; Fl_Color m_SelectionColor; // Color for selection Fl_Color m_BackgroundColor; // Color for background Fl_Color m_NumbersColor; // Color for grid numbers Fl_Color m_GridColor; // Color for this grid Fl_Color m_SequenceColor; // Color for sequence letters Fl_Color m_MismatchColor; // Color for mismatch letters CTextAlnView::TFeatureDisplay m_featDisp; int m_Width; // Window size in pixels int m_Height; TNumrow m_Anchor; // anchored sequence index // our font CGlBitmapFont m_Font_8x13; // Define viewport coordinates GLuint m_NP[4]; // Numbers panel GLuint m_BP[4]; // Text panel GLuint m_LP[4]; // Labels panel GLuint m_IP[4]; // Info panel //GLuint m_FontOffset; // Display list for sequence font bool m_ShowSeqAsDots; // Show letters for mismatches, dots otherwise vector<CParaG> m_ParaG; // info about alignment lines vector<bool> m_RowSelect; // info about selected lines (horisontal) vector<bool> m_ColSelect; // info about selected lines (vertical) // --- Virtual (FLTK) virtual void draw(); virtual int handle(int event); // --- Methods void x_PrepareData (void); void x_SetViewPorts (void); void x_AdjustScrollBars (void); void x_DrawSeqNumPanel (void); void x_DrawTextPanel (void); void x_DrawLabelPanel (void); void x_DrawInfoPanel (void); void x_DrawGrid (void); void x_DrawSelection (int size, ESelectionType type) const; void x_DrawSequence (TNumrow row, size_t idx) const; void x_DrawFeatures (TNumrow row, size_t idx) const; void x_DrawInsertions(TNumrow row, size_t idx) const; void x_DrawLine(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, GLfloat width = 1.0f) const; void x_DrawAnchorMark(TNumrow y) const; void x_AddFeaturesAtIndex(size_t idx); void x_AddInsertsAtIndex (size_t idx); void x_ActivateViewPort (GLuint* port) const; string x_PreprocessSeq(const string& s) const; size_t x_GetAtXY(int x, int y) const; TSeqPos x_GetAlnWidth (void) const; TNumrow x_GetAlnHeigth(void) const; TSignedSeqPos x_GetStartAt(size_t i, int seg) const;};END_NCBI_SCOPE/* * =========================================================================== * $Log: panel.hpp,v $ * Revision 1000.2 2004/06/01 21:07:58 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.10 * * Revision 1.10 2004/05/03 13:23:57 dicuccio * gui/utils --> gui/objutils where needed * * Revision 1.9 2004/03/11 17:50:41 dicuccio * Updated typedefs: dropped TDimension, TPosition, TIndex, TColor; use TSeqRange * instead of TRange * * Revision 1.8 2003/09/29 15:49:58 dicuccio * Use CGlBitmapFont instead of home-grown font. * * Revision 1.7 2003/09/24 18:34:58 dicuccio * Use new generic alignment data source. Removed USING_SCOPE(objects) from * headers; used objects:: where necessary * * Revision 1.6 2003/08/18 15:23:40 lebedev * Changed nales: CFeature -> CLayoutFeat * * Revision 1.5 2003/06/02 16:06:27 dicuccio * Rearranged src/objects/ subtree. This includes the following shifts: * - src/objects/asn2asn --> arc/app/asn2asn * - src/objects/testmedline --> src/objects/ncbimime/test * - src/objects/objmgr --> src/objmgr * - src/objects/util --> src/objmgr/util * - src/objects/alnmgr --> src/objtools/alnmgr * - src/objects/flat --> src/objtools/flat * - src/objects/validator --> src/objtools/validator * - src/objects/cddalignview --> src/objtools/cddalignview * In addition, libseq now includes six of the objects/seq... libs, and libmmdb * replaces the three libmmdb? libs. * * Revision 1.4 2003/03/28 18:05:19 dicuccio * Ooops. Use 'gui/opengl.h' instead of 'gui/opengl.hpp' * * Revision 1.3 2003/03/28 13:39:45 dicuccio * Use gui/opengl.h instead of OpenGL headers directly * * Revision 1.2 2003/03/27 20:38:57 dicuccio * Fixed compilation errors under Linux (gcc-3.0.4) * * Revision 1.1 2003/03/27 17:04:32 lebedev * Text Alignment Widget: Initial revision * * =========================================================================== */#endif /* GUI_WIDGETS_ALN_TEXTALN___PANEL__HPP */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?