textaln_widget_demo.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:7k
- /*
- * ===========================================================================
- * PRODUCTION $Log: textaln_widget_demo.cpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 21:08:12 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- * PRODUCTION
- * ===========================================================================
- */
- // generated by Fast Light User Interface Designer (fluid) version 1.0105
- /* $Id: textaln_widget_demo.cpp,v 1000.1 2004/06/01 21:08:12 gouriano Exp $ */
- #include <ncbi_pch.hpp>
- #include "textaln_widget_demo.hpp"
- static void closeWindowCB( Fl_Widget*, void* ) {
- delete mainWindow;
- }
- void backColorBtnCB(Fl_Widget* o, void*) {
- Fl_Color c = fl_show_colormap( o->color() );
- o->color(c);
- m_TextAlnView->SetColor(CTextAlnView::eBackground, c);
- }
- void gridColorBtnCB(Fl_Widget* o, void*) {
- Fl_Color c = fl_show_colormap( o->color() );
- o->color(c);
- m_TextAlnView->SetColor(CTextAlnView::eGrid, c);
- }
- void numColorBtnCB(Fl_Widget* o, void*) {
- Fl_Color c = fl_show_colormap( o->color() );
- o->color(c);
- m_TextAlnView->SetColor(CTextAlnView::eNumbers, c);
- }
- void selColorBtnCB(Fl_Widget* o, void*) {
- Fl_Color c = fl_show_colormap( o->color() );
- o->color(c);
- m_TextAlnView->SetColor(CTextAlnView::eSelection, c);
- }
- void loadSeqCB(Fl_Widget* o, void*) {
- CTextAlnViewTestDS* ds = new CTextAlnViewTestDS();
-
- m_TextAlnView->SetDataSource( ds );
- }
- void showMMCB(Fl_Widget*, void*) {
- bool show_mm = m_ShowMM->value();
- m_TextAlnView->ShowSequenceAsDots(show_mm);
- }
- Fl_Double_Window *mainWindow=(Fl_Double_Window *)0;
- Fl_Menu_Item menu_[] = {
- {"&File", 0, 0, 0, 64, 0, 0, 14, 56},
- {"&Load Aln. results", 0, (Fl_Callback*)loadSeqCB, 0, 128, 0, 0, 14, 56},
- {"&Exit", 0, (Fl_Callback*)closeWindowCB, 0, 0, 0, 0, 14, 56},
- {0},
- {0}
- };
- CTextAlnView *m_TextAlnView=(CTextAlnView *)0;
- Fl_Check_Button *m_Anchor=(Fl_Check_Button *)0;
- Fl_Check_Button *m_ShowMM=(Fl_Check_Button *)0;
- Fl_Light_Button *m_EditMode=(Fl_Light_Button *)0;
- Fl_Round_Button *m_FeatOff=(Fl_Round_Button *)0;
- Fl_Round_Button *m_FeatBase=(Fl_Round_Button *)0;
- Fl_Round_Button *m_FeatAll=(Fl_Round_Button *)0;
- Fl_Check_Button *m_ShowLongInfo=(Fl_Check_Button *)0;
- int main(int argc, char **argv) {
- Fl_Double_Window* w;
- { Fl_Double_Window* o = mainWindow = new Fl_Double_Window(925, 527, "Text Alignment Viewer");
- w = o;
- { Fl_Menu_Bar* o = new Fl_Menu_Bar(0, 0, 925, 30);
- o->menu(menu_);
- }
- { Fl_Button* o = new Fl_Button(820, 485, 95, 25, "Close");
- o->tooltip("Click to close the window");
- o->callback((Fl_Callback*)closeWindowCB);
- }
- { CTextAlnView* o = m_TextAlnView = new CTextAlnView(10, 40, 695, 420);
- o->box(FL_FLAT_BOX);
- o->color(FL_BACKGROUND2_COLOR);
- o->selection_color(FL_BACKGROUND_COLOR);
- o->labeltype(FL_NO_LABEL);
- o->labelfont(0);
- o->labelsize(14);
- o->labelcolor(FL_BLACK);
- o->align(FL_ALIGN_CENTER);
- o->when(FL_WHEN_RELEASE);
- o->end();
- Fl_Group::current()->resizable(o);
- }
- { Fl_Button* o = new Fl_Button(715, 125, 35, 25, "Background Color");
- o->color((Fl_Color)55);
- o->callback((Fl_Callback*)backColorBtnCB);
- o->align(FL_ALIGN_RIGHT);
- }
- { Fl_Button* o = new Fl_Button(715, 155, 35, 25, "Selection Color");
- o->color((Fl_Color)4);
- o->callback((Fl_Callback*)selColorBtnCB);
- o->align(FL_ALIGN_RIGHT);
- }
- { Fl_Box* o = new Fl_Box(10, 470, 905, 5);
- o->box(FL_THIN_DOWN_FRAME);
- o->labeltype(FL_NO_LABEL);
- }
- { Fl_Button* o = new Fl_Button(715, 215, 35, 25, "Numbers Color");
- o->color((Fl_Color)4);
- o->callback((Fl_Callback*)numColorBtnCB);
- o->align(FL_ALIGN_RIGHT);
- }
- { Fl_Button* o = new Fl_Button(715, 185, 35, 25, "Grid Color");
- o->callback((Fl_Callback*)gridColorBtnCB);
- o->align(FL_ALIGN_RIGHT);
- }
- { Fl_Check_Button* o = m_Anchor = new Fl_Check_Button(715, 40, 185, 25, "Anchor Base Sequence");
- o->down_box(FL_DOWN_BOX);
- o->callback((Fl_Callback*)setAnchor);
- o->when(FL_WHEN_CHANGED);
- }
- { Fl_Check_Button* o = m_ShowMM = new Fl_Check_Button(715, 65, 185, 25, "Show Mismatches Only");
- o->down_box(FL_DOWN_BOX);
- o->callback((Fl_Callback*)showMMCB);
- o->when(FL_WHEN_CHANGED);
- }
- { Fl_Button* o = new Fl_Button(715, 245, 35, 25, "Sequence Color");
- o->color(FL_FOREGROUND_COLOR);
- o->callback((Fl_Callback*)seqColorBtnCB);
- o->align(FL_ALIGN_RIGHT);
- }
- { Fl_Button* o = new Fl_Button(715, 435, 160, 25, "Load Aln. results");
- o->callback((Fl_Callback*)loadSeqCB);
- }
- m_EditMode = new Fl_Light_Button(715, 405, 160, 25, "Edit Mode");
- { Fl_Group* o = new Fl_Group(715, 350, 160, 50, "Features Display:");
- o->box(FL_THIN_DOWN_FRAME);
- o->align(FL_ALIGN_TOP_LEFT);
- { Fl_Round_Button* o = m_FeatOff = new Fl_Round_Button(715, 350, 160, 20, "Off");
- o->type(102);
- o->down_box(FL_ROUND_DOWN_BOX);
- o->value(1);
- o->callback((Fl_Callback*)setFeatures);
- }
- { Fl_Round_Button* o = m_FeatBase = new Fl_Round_Button(715, 365, 160, 20, "Base Sequence");
- o->type(102);
- o->down_box(FL_ROUND_DOWN_BOX);
- o->callback((Fl_Callback*)setFeatures);
- }
- { Fl_Round_Button* o = m_FeatAll = new Fl_Round_Button(715, 380, 160, 20, "All Sequences");
- o->type(102);
- o->down_box(FL_ROUND_DOWN_BOX);
- o->callback((Fl_Callback*)setFeatures);
- }
- o->end();
- }
- { Fl_Check_Button* o = m_ShowLongInfo = new Fl_Check_Button(715, 90, 185, 25, "Show Long Name");
- o->down_box(FL_DOWN_BOX);
- }
- { Fl_Button* o = new Fl_Button(715, 285, 85, 25, "Select All");
- o->callback((Fl_Callback*)selectCB);
- }
- { Fl_Button* o = new Fl_Button(805, 285, 85, 25, "Deselect All");
- o->callback((Fl_Callback*)deselectCB);
- }
- o->end();
- }
- w->show(argc, argv);
- return Fl::run();
- }
- void seqColorBtnCB(Fl_Widget* o, void*) {
- Fl_Color c = fl_show_colormap( o->color() );
- o->color(c);
- m_TextAlnView->SetColor(CTextAlnView::eSequence, c);
- }
- void setAnchor(Fl_Widget*, void*) {
- bool anchor = m_Anchor->value();
- if (anchor) m_TextAlnView->SetAnchor(0);
- else m_TextAlnView->UnsetAnchor();
- }
- void setFeatures(Fl_Widget*, void*) {
- if (m_FeatOff->value()) m_TextAlnView->SetFeatureDisplay(CTextAlnView::eOff);
- if (m_FeatBase->value()) m_TextAlnView->SetFeatureDisplay(CTextAlnView::eBase);
- if (m_FeatAll->value()) m_TextAlnView->SetFeatureDisplay(CTextAlnView::eAll);
- }
- void selectCB(Fl_Widget* o, void*) {
- m_TextAlnView->SelectAll( true );
- }
- void deselectCB(Fl_Widget* o, void*) {
- m_TextAlnView->SelectAll( false );
- }