NCBI C++ Toolkit Cross Reference

  C++/src/gui/packages/pkg_sequence_edit/bulk_molinfo_edit_dlg.cpp


/* $Id: bulk_molinfo_edit_dlg.cpp 28329 2013-06-19 11:58:38Z bollin $ * =========================================================================== * * 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: Colleen Bollin */ #include <ncbi_pch.hpp> ////@begin includes ////@end includes #include <gui/packages/pkg_sequence_edit/bulk_molinfo_edit_dlg.hpp> #include <gui/packages/pkg_sequence_edit/subprep_util.hpp> #include <gui/packages/pkg_sequence_edit/molinfoedit_util.hpp> #include <gui/widgets/wx/wx_utils.hpp> #include <wx/button.h> ////@begin XPM images ////@end XPM images BEGIN_NCBI_SCOPE USING_SCOPE(ncbi::objects); /*! * CBulkMolinfoEditDlg type definition */ IMPLEMENT_DYNAMIC_CLASS( CBulkMolinfoEditDlg, CBulkCmdDlg ) /*! * CBulkMolinfoEditDlg event table definition */ BEGIN_EVENT_TABLE( CBulkMolinfoEditDlg, CBulkCmdDlg ) ////@begin CBulkMolinfoEditDlg event table entries ////@end CBulkMolinfoEditDlg event table entries END_EVENT_TABLE() /*! * CBulkMolinfoEditDlg constructors */ CBulkMolinfoEditDlg::CBulkMolinfoEditDlg() { Init(); } CBulkMolinfoEditDlg::CBulkMolinfoEditDlg( wxWindow* parent, CSeq_entry_Handle seh, CSourceRequirements::EWizardType wizard_type, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) : m_TopSeqEntry(seh), m_WizardType(wizard_type) { Init(); Create(parent, id, caption, pos, size, style); } /*! * CBulkMolinfoEditDlg creator */ bool CBulkMolinfoEditDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { ////@begin CBulkMolinfoEditDlg creation SetExtraStyle(wxWS_EX_BLOCK_EVENTS); CBulkCmdDlg::Create( parent, id, caption, pos, size, style ); CreateControls(); if (GetSizer()) { GetSizer()->SetSizeHints(this); } Centre(); ////@end CBulkMolinfoEditDlg creation return true; } /*! * CBulkMolinfoEditDlg destructor */ CBulkMolinfoEditDlg::~CBulkMolinfoEditDlg() { ////@begin CBulkMolinfoEditDlg destruction ////@end CBulkMolinfoEditDlg destruction } /*! * Member initialisation */ void CBulkMolinfoEditDlg::Init() { ////@begin CBulkMolinfoEditDlg member initialisation ////@end CBulkMolinfoEditDlg member initialisation } /*! * Control creation for CBulkMolinfoEditDlg */ void CBulkMolinfoEditDlg::CreateControls() { ////@begin CBulkMolinfoEditDlg content construction // Generated by DialogBlocks, 10/06/2013 17:54:31 (unregistered) CBulkMolinfoEditDlg* itemCBulkCmdDlg1 = this; wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); itemCBulkCmdDlg1->SetSizer(itemBoxSizer2); wxGrid* itemGrid3 = new wxGrid( itemCBulkCmdDlg1, ID_GRID, wxDefaultPosition, wxSize(600, 300), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL ); itemGrid3->SetDefaultColSize(50); itemGrid3->SetDefaultRowSize(25); itemGrid3->SetColLabelSize(25); itemGrid3->SetRowLabelSize(100); itemGrid3->CreateGrid(5, 5, wxGrid::wxGridSelectCells); itemBoxSizer2->Add(itemGrid3, 0, wxGROW|wxALL, 5); wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxButton* itemButton5 = new wxButton( itemCBulkCmdDlg1, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer4->Add(itemButton5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxButton* itemButton6 = new wxButton( itemCBulkCmdDlg1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer4->Add(itemButton6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); ////@end CBulkMolinfoEditDlg content construction m_Grid = itemGrid3; if (m_TopSeqEntry) { /* this is where we need to construct a CSeqTable object from the BioSources in the record */ CRef<objects::CSeq_table> seqTable = BuildMolInfoValuesTableFromSeqEntry(m_TopSeqEntry, m_WizardType); CSeqTableGrid *gridAdapter = new CSeqTableGrid(seqTable); m_Grid->SetTable(gridAdapter, true); // TODO: Find column by label instead of making assumption // TODO: Add existing values as choices vector<string> mol_strings = GetMoleculeTypeOptions (m_WizardType); wxArrayString moltype_choices; for (size_t i = 0; i < mol_strings.size(); i++) { moltype_choices.push_back(ToWxString(mol_strings[i])); } wxArrayString topology_choices; topology_choices.push_back(wxT("linear")); topology_choices.push_back(wxT("circular")); for (int row = 0; row < seqTable->GetNum_rows(); row++) { m_Grid->SetCellEditor(row, 0, new wxGridCellChoiceEditor (moltype_choices, false)); m_Grid->SetCellEditor(row, 1, new wxGridCellChoiceEditor (topology_choices, false)); } m_Grid->AutoSizeColumns(); } } /*! * Should we show tooltips? */ bool CBulkMolinfoEditDlg::ShowToolTips() { return true; } /*! * Get bitmap resources */ wxBitmap CBulkMolinfoEditDlg::GetBitmapResource( const wxString& name ) { // Bitmap retrieval ////@begin CBulkMolinfoEditDlg bitmap retrieval wxUnusedVar(name); return wxNullBitmap; ////@end CBulkMolinfoEditDlg bitmap retrieval } /*! * Get icon resources */ wxIcon CBulkMolinfoEditDlg::GetIconResource( const wxString& name ) { // Icon retrieval ////@begin CBulkMolinfoEditDlg icon retrieval wxUnusedVar(name); return wxNullIcon; ////@end CBulkMolinfoEditDlg icon retrieval } CRef<CCmdComposite> CBulkMolinfoEditDlg::GetCommand() { CRef<CCmdComposite> cmd; CSeqTableGrid *gridAdapter = dynamic_cast<CSeqTableGrid*>(m_Grid->GetTable()); if( gridAdapter ) { CRef<objects::CSeq_table> values_table = gridAdapter->GetValuesTable(); cmd = ApplyMolInfoValuesTableToSeqEntry (values_table, m_TopSeqEntry); } return cmd; } string CBulkMolinfoEditDlg::GetErrorMessage() { return "Unknown error"; } END_NCBI_SCOPE

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.