📄 annotate_dialog.cpp
字号:
annotation->name = tName->GetValue().c_str(); DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(tDescr, ID_T_DESCR, wxTextCtrl) annotation->description = tDescr->GetValue().c_str(); structureSet->SetDataChanged(StructureSet::eStyleData); } else { // wxCANCEL // restore original settings *style = copy; GlobalMessenger()->PostRedrawAllStructures(); GlobalMessenger()->PostRedrawAllSequenceViewers(); }}void AnnotateDialog::MoveAnnotation(void){ DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(available, ID_L_AVAILABLE, wxListBox) if (available->GetSelection() < 0) return; StyleManager::UserAnnotation *annotation = ANNOT_FROM_CLIENT_DATA(available); if (!annotation) { ERRORMSG("AnnotateDialog::MoveAnnotation() - NULL annotation pointer"); return; } // make sure this is what the user wants wxString message; message.Printf("This will move the coverage of annotation '%s'\n" "to the currently highlighted region. Is this correct?", available->GetStringSelection().c_str()); int result = wxMessageBox(message, "Confirmation", wxOK | wxCANCEL | wxCENTRE, this); // copy current highlight list to selected annotation if (result == wxOK) { annotation->residues = highlightedResidues; GlobalMessenger()->PostRedrawAllStructures(); GlobalMessenger()->PostRedrawAllSequenceViewers(); structureSet->SetDataChanged(StructureSet::eStyleData); }}void AnnotateDialog::DeleteAnnotation(void){ DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(available, ID_L_AVAILABLE, wxListBox) if (available->GetSelection() < 0) return; StyleManager::UserAnnotation *annotation = ANNOT_FROM_CLIENT_DATA(available); if (!annotation) { ERRORMSG("AnnotateDialog::DeleteAnnotation() - NULL annotation pointer"); return; } // make sure this is what the user wants wxString message; message.Printf("This will permanently remove the annotation\n" "'%s'. Is this correct?", available->GetStringSelection().c_str()); int result = wxMessageBox(message, "Confirmation", wxOK | wxCANCEL | wxCENTRE, this); // copy current highlight list to selected annotation if (result == wxOK) { styleManager->RemoveUserAnnotation(annotation); ResetListBoxes(); SetButtonStates(); }}BEGIN_EVENT_TABLE(AnnotationEditorDialog, wxDialog) EVT_CLOSE ( AnnotationEditorDialog::OnCloseWindow) EVT_BUTTON (-1, AnnotationEditorDialog::OnButton)END_EVENT_TABLE()AnnotationEditorDialog::AnnotationEditorDialog(wxWindow *parent, StyleSettings *settings, const StructureSet *set, const StyleManager::UserAnnotation& initialText) : wxDialog(parent, -1, "Edit Annotation", wxPoint(450, 200), wxDefaultSize, wxCAPTION | wxSYSTEM_MENU), // not resizable styleSettings(settings), structureSet(set){ // construct the panel wxPanel *panel = new wxPanel(this, -1); wxSizer *topSizer = SetupAnnotationEditorDialog(panel, false); // set initial state DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(tName, ID_T_NAME, wxTextCtrl) tName->SetValue(initialText.name.c_str()); DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(tDescr, ID_T_DESCR, wxTextCtrl) tDescr->SetValue(initialText.description.c_str()); // call sizer stuff topSizer->Fit(this); topSizer->Fit(panel); topSizer->SetSizeHints(this); // select name, so user can quickly change it tName->SetFocus(); tName->SetSelection(0, initialText.name.size());}// same as hitting cancel buttonvoid AnnotationEditorDialog::OnCloseWindow(wxCloseEvent& event){ EndModal(wxCANCEL);}void AnnotationEditorDialog::OnButton(wxCommandEvent& event){ switch (event.GetId()) { case ID_B_EDIT_STYLE: { StyleDialog dialog(this, styleSettings, structureSet); dialog.ShowModal(); break; } case ID_B_EDIT_DONE: { DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(tName, ID_T_NAME, wxTextCtrl) if (tName->GetValue().size() == 0) wxMessageBox("The annotation must have a name!", "Input Error", wxOK | wxCENTRE | wxICON_ERROR, this); else EndModal(wxOK); break; } case ID_B_EDIT_CANCEL: EndModal(wxCANCEL); break; default: event.Skip(); }}END_SCOPE(Cn3D)//////////////////////////////////////////////////////////////////////////////////////////////////// The next following are taken *without* modification from wxDesigner C++ code generated from// annotate_dialog.wdr.//////////////////////////////////////////////////////////////////////////////////////////////////wxSizer *SetupAnnotationControlDialog( wxPanel *parent, bool call_fit, bool set_sizer ){ wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); wxStaticBox *item2 = new wxStaticBox( parent, -1, "Annotation Control" ); wxStaticBoxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL ); wxFlexGridSizer *item3 = new wxFlexGridSizer( 2, 0, 0, 0 ); item3->AddGrowableCol( 0 ); item3->AddGrowableCol( 2 ); wxStaticText *item4 = new wxStaticText( parent, ID_TEXT, "Available", wxDefaultPosition, wxDefaultSize, 0 ); item3->Add( item4, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxTOP, 5 ); item3->Add( 5, 5, 0, wxALIGN_CENTRE|wxALL, 5 ); wxStaticText *item5 = new wxStaticText( parent, ID_TEXT, "Displayed", wxDefaultPosition, wxDefaultSize, 0 ); item3->Add( item5, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxTOP, 5 ); wxString *strs6 = (wxString*) NULL; wxListBox *item6 = new wxListBox( parent, ID_L_AVAILABLE, wxDefaultPosition, wxSize(120,-1), 0, strs6, wxLB_SINGLE ); item3->Add( item6, 0, wxGROW|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); wxFlexGridSizer *item7 = new wxFlexGridSizer( 1, 0, 0 ); wxButton *item8 = new wxButton( parent, ID_B_TURN_ON, "Turn On", wxDefaultPosition, wxDefaultSize, 0 ); item8->SetToolTip( "Display the selected annotation" ); item8->Enable( FALSE ); item7->Add( item8, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxButton *item9 = new wxButton( parent, ID_B_TURN_OFF, "Turn Off", wxDefaultPosition, wxDefaultSize, 0 ); item9->SetToolTip( "Hide the selected annotation" ); item9->Enable( FALSE ); item7->Add( item9, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item7->Add( 20, 20, 0, wxALIGN_CENTRE|wxALL, 5 ); wxButton *item10 = new wxButton( parent, ID_B_MOVE_UP, "Move Up", wxDefaultPosition, wxDefaultSize, 0 ); item10->SetToolTip( "Move display annotation up in priority" ); item10->Enable( FALSE ); item7->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxButton *item11 = new wxButton( parent, ID_B_MOVE_DOWN, "Move Down", wxDefaultPosition, wxDefaultSize, 0 ); item11->SetToolTip( "Move display annotation down in priority" ); item11->Enable( FALSE ); item7->Add( item11, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item3->Add( item7, 0, wxALIGN_CENTRE, 5 ); wxString *strs12 = (wxString*) NULL; wxListBox *item12 = new wxListBox( parent, ID_L_DISPLAYED, wxDefaultPosition, wxSize(120,-1), 0, strs12, wxLB_SINGLE ); item3->Add( item12, 0, wxGROW|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); item1->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticLine *item13 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL ); item1->Add( item13, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxFlexGridSizer *item14 = new wxFlexGridSizer( 2, 0, 0, 0 ); item14->AddGrowableCol( 1 ); wxStaticText *item15 = new wxStaticText( parent, ID_TEXT, "Selection:", wxDefaultPosition, wxDefaultSize, 0 ); item14->Add( item15, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxFlexGridSizer *item16 = new wxFlexGridSizer( 1, 0, 0, 0 ); item16->AddGrowableCol( 0 ); wxStaticText *item17 = new wxStaticText( parent, ID_ST_NAME, "", wxDefaultPosition, wxSize(120,-1), 0 ); item16->Add( item17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxButton *item18 = new wxButton( parent, ID_B_NEW, "New", wxDefaultPosition, wxDefaultSize, 0 ); item16->Add( item18, 0, wxALIGN_CENTRE|wxALL, 5 ); item14->Add( item16, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); wxStaticText *item19 = new wxStaticText( parent, ID_TEXT, "Description:", wxDefaultPosition, wxDefaultSize, 0 ); item14->Add( item19, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item20 = new wxStaticText( parent, ID_ST_DESCR, "", wxDefaultPosition, wxDefaultSize, 0 ); item14->Add( item20, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item1->Add( item14, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticLine *item21 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL ); item1->Add( item21, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxBoxSizer *item22 = new wxBoxSizer( wxHORIZONTAL ); wxButton *item23 = new wxButton( parent, ID_B_SHOW, "Show", wxDefaultPosition, wxDefaultSize, 0 ); item22->Add( item23, 0, wxALIGN_CENTRE|wxALL, 5 ); wxButton *item24 = new wxButton( parent, ID_B_EDIT, "Edit", wxDefaultPosition, wxDefaultSize, 0 ); item24->Enable( FALSE ); item22->Add( item24, 0, wxALIGN_CENTRE|wxALL, 5 ); wxButton *item25 = new wxButton( parent, ID_B_MOVE, "Move", wxDefaultPosition, wxDefaultSize, 0 ); item25->Enable( FALSE ); item22->Add( item25, 0, wxALIGN_CENTRE|wxALL, 5 ); wxButton *item26 = new wxButton( parent, ID_B_DELETE, "Delete", wxDefaultPosition, wxDefaultSize, 0 ); item26->Enable( FALSE ); item22->Add( item26, 0, wxALIGN_CENTRE|wxALL, 5 ); item1->Add( item22, 0, wxALIGN_CENTRE|wxALL, 5 ); item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxBoxSizer *item27 = new wxBoxSizer( wxHORIZONTAL ); wxButton *item28 = new wxButton( parent, ID_B_DONE, "Done", wxDefaultPosition, wxDefaultSize, 0 ); item28->SetDefault(); item27->Add( item28, 0, wxALIGN_CENTRE|wxALL, 5 ); item0->Add( item27, 0, wxALIGN_CENTRE|wxALL, 5 ); if (set_sizer) { parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); if (call_fit) { item0->Fit( parent ); item0->SetSizeHints( parent ); } } return item0;}wxSizer *SetupAnnotationEditorDialog( wxPanel *parent, bool call_fit, bool set_sizer ){ wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); wxStaticBox *item2 = new wxStaticBox( parent, -1, "Edit Annotation" ); wxStaticBoxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL ); wxFlexGridSizer *item3 = new wxFlexGridSizer( 2, 0, 0, 0 ); item3->AddGrowableCol( 1 ); item3->AddGrowableRow( 1 ); wxStaticText *item4 = new wxStaticText( parent, ID_TEXT, "Name:", wxDefaultPosition, wxDefaultSize, 0 ); item4->SetToolTip( "cool!" ); item3->Add( item4, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5 ); wxFlexGridSizer *item5 = new wxFlexGridSizer( 1, 0, 0, 0 ); item5->AddGrowableCol( 1 ); wxTextCtrl *item6 = new wxTextCtrl( parent, ID_T_NAME, "", wxDefaultPosition, wxSize(120,-1), 0 ); item5->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 ); item5->Add( 20, 20, 0, wxALIGN_CENTRE|wxALL, 5 ); wxButton *item7 = new wxButton( parent, ID_B_EDIT_STYLE, "Edit Style", wxDefaultPosition, wxDefaultSize, 0 ); item5->Add( item7, 0, wxALIGN_CENTRE|wxALL, 5 ); item3->Add( item5, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); wxStaticText *item8 = new wxStaticText( parent, ID_TEXT, "Description:", wxDefaultPosition, wxDefaultSize, 0 ); item3->Add( item8, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5 ); wxTextCtrl *item9 = new wxTextCtrl( parent, ID_T_DESCR, "", wxDefaultPosition, wxDefaultSize, 0 ); item3->Add( item9, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item1->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxBoxSizer *item10 = new wxBoxSizer( wxHORIZONTAL ); wxButton *item11 = new wxButton( parent, ID_B_EDIT_DONE, "OK", wxDefaultPosition, wxDefaultSize, 0 ); item10->Add( item11, 0, wxALIGN_CENTRE|wxALL, 5 ); item10->Add( 20, 20, 0, wxALIGN_CENTRE|wxALL, 5 ); wxButton *item12 = new wxButton( parent, ID_B_EDIT_CANCEL, "Cancel", wxDefaultPosition, wxDefaultSize, 0 ); item10->Add( item12, 0, wxALIGN_CENTRE|wxALL, 5 ); item0->Add( item10, 0, wxALIGN_CENTRE|wxALL, 5 ); if (set_sizer) { parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); if (call_fit) { item0->Fit( parent ); item0->SetSizeHints( parent ); } } return item0;}/** ---------------------------------------------------------------------------* $Log: annotate_dialog.cpp,v $* Revision 1000.2 2004/06/01 18:27:40 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.15** Revision 1.15 2004/05/21 21:41:38 gorelenk* Added PCH ncbi_pch.hpp** Revision 1.14 2004/03/15 18:16:33 thiessen* prefer prefix vs. postfix ++/-- operators** Revision 1.13 2004/02/19 17:04:40 thiessen* remove cn3d/ from include paths; add pragma to disable annoying msvc warning** Revision 1.12 2003/02/03 19:20:00 thiessen* format changes: move CVS Log to bottom of file, remove std:: from .cpp files, and use new diagnostic macros** Revision 1.11 2002/10/28 21:36:01 thiessen* add show domains with highlights** Revision 1.10 2002/08/15 22:13:11 thiessen* update for wx2.3.2+ only; add structure pick dialog; fix MultitextDialog bug** Revision 1.9 2001/12/06 23:13:44 thiessen* finish import/align new sequences into single-structure data; many small tweaks** Revision 1.8 2001/11/27 16:26:06 thiessen* major update to data management system** Revision 1.7 2001/09/24 14:37:52 thiessen* more wxPanel stuff - fix for new heirarchy in wx 2.3.2+** Revision 1.6 2001/09/24 13:29:54 thiessen* fix wxPanel issues** Revision 1.5 2001/09/20 19:31:30 thiessen* fixes for SGI and wxWin 2.3.2** Revision 1.4 2001/08/06 20:22:00 thiessen* add preferences dialog ; make sure OnCloseWindow get wxCloseEvent** Revision 1.3 2001/07/19 19:14:38 thiessen* working CDD alignment annotator ; misc tweaks** Revision 1.2 2001/07/04 19:39:16 thiessen* finish user annotation system** Revision 1.1 2001/06/29 18:13:57 thiessen* initial (incomplete) user annotation system**/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -