47 #include <wx/stattext.h>
48 #include <wx/textctrl.h>
49 #include <wx/choice.h>
50 #include <wx/combobox.h>
51 #include <wx/msgdlg.h>
103 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
109 GetSizer()->SetSizeHints(
this);
157 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
158 itemCBulkCmdDlg1->SetSizer(itemBoxSizer2);
163 wxStaticText* itemStaticText4 =
new wxStaticText( itemCBulkCmdDlg1, wxID_STATIC,
_(
"From"), wxDefaultPosition, wxDefaultSize, 0 );
164 m_FeatureChoiceSizer->Add(itemStaticText4, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
166 wxStaticText* itemStaticText5 =
new wxStaticText( itemCBulkCmdDlg1, wxID_STATIC,
_(
"To"), wxDefaultPosition, wxDefaultSize, 0 );
167 m_FeatureChoiceSizer->Add(itemStaticText5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
169 wxStaticText* itemStaticText6 =
new wxStaticText( itemCBulkCmdDlg1, wxID_STATIC,
_(
"Conversion Function"), wxDefaultPosition, wxDefaultSize, 0 );
170 m_FeatureChoiceSizer->Add(itemStaticText6, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
186 itemBoxSizer2->Add(
m_OptionsSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
188 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
189 itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
193 itemBoxSizer3->Add(
m_LeaveOriginal, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
197 itemBoxSizer3->Add(
m_AddUnverified, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
203 itemBoxSizer2->Add(
m_OkCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
250 m_ErrorMessage =
"You must select a supported conversion function.";
260 string field_name =
"";
273 vector<CConstRef<CObject> > objs;
276 bool ignore_selected =
true;
277 if (!sel_objs.empty()) {
278 bool any_feat =
false;
279 vector<CConstRef<CObject> > sel_no_match;
286 objs.push_back(it->object);
288 sel_no_match.push_back(it->object);
293 if (objs.empty() && any_feat) {
294 if (!sel_no_match.empty()) {
295 int answer = wxMessageBox(
wxT(
"Selected features do not match constraint - apply to selected feature anyway?"),
296 wxT(
"Error"), wxYES_NO | wxICON_QUESTION,
this);
297 if (answer == wxYES) {
301 int answer = wxMessageBox(
wxT(
"No selected features are of the correct type. Search all features?"),
302 wxT(
"Error"), wxYES_NO | wxICON_QUESTION,
this);
303 if (answer == wxNO) {
316 vector<CConstRef<CObject> > these_objs = col->
GetObjects(*bi);
319 objs.push_back (*it);
326 if (objs.size() == 0) {
331 bool any_change =
false;
340 if (
f->IsSetLocation())
343 if (bioseq_to_offset.
find(bsh) == bioseq_to_offset.
end())
344 bioseq_to_offset[bsh] = 1;
349 cmd->AddCommand(*subcmd);
365 if (seh && already_done.
find(seh) == already_done.
end())
372 new_desc->SetUser(*user);
381 for (CEnumeratedTypeValues::TValues::const_iterator
i = qual_names.begin();
i != qual_names.end(); ++
i)
383 string qual_name =
i->first;
398 if (!string_constraint)
401 bool negation = string_constraint->GetNegation();
406 string field_name = feat_type +
" " + *qi;
412 vector<string> val_list;
416 vector<string> add = col->
GetVals(**it);
417 val_list.insert(val_list.end(), add.begin(), add.end());
419 if (!val_list.empty())
422 res = res && string_constraint->DoesListMatch(val_list);
424 res = res || string_constraint->DoesListMatch(val_list);
495 if ((*it)->IsBool()) {
496 wxCheckBox* opt =
new wxCheckBox(
this,
wxID_ANY,
ToWxString((*it)->GetLabel()), wxDefaultPosition, wxDefaultSize, 0 );
498 opt->SetValue((*it)->GetBool()->GetDefaultVal());
500 }
else if ((*it)->IsString()) {
501 int remaining = num_cols - col;
503 for (
int i = 0;
i < remaining;
i++) {
505 m_OptionsSizer->Add(5, 15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
509 wxStaticText*
label =
new wxStaticText(
this, wxID_STATIC,
ToWxString((*it)->GetLabel()), wxDefaultPosition, wxDefaultSize, 0 );
511 const vector<string>& suggested_values = (*it)->GetString()->GetSuggestedValues();
512 if (suggested_values.size() == 0) {
513 wxTextCtrl*
val =
new wxTextCtrl(
this,
wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, -1), 0 );
514 m_OptionsSizer->Add(
val, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
515 val->SetValue((*it)->GetString()->GetDefaultVal());
516 }
else if ((*it)->GetString()->GetOnlySuggested()) {
517 wxArrayString choice_strings;
518 ITERATE(vector<string>, sit, suggested_values) {
521 wxChoice*
val =
new wxChoice(
this,
wxID_ANY, wxDefaultPosition, wxDefaultSize, choice_strings, 0 );
522 m_OptionsSizer->Add(
val, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
523 val->SetStringSelection((*it)->GetString()->GetDefaultVal());
525 wxArrayString choice_strings;
526 ITERATE(vector<string>, sit, suggested_values) {
529 wxComboBox*
val =
new wxComboBox(
this,
wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, choice_strings, 0 );
530 m_OptionsSizer->Add(
val, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
531 val->SetStringSelection((*it)->GetString()->GetDefaultVal());
535 col = col % num_cols;
556 size_t option_pos = 0;
558 for (
size_t pos = 0; pos <
m_OptionsSizer->GetItemCount() && option_pos < options.size(); pos++) {
560 wxCheckBox* checkbox =
dynamic_cast<wxCheckBox*
>(w);
562 if (options[option_pos]->IsBool()) {
563 options[option_pos]->SetBool()->SetVal(checkbox->GetValue());
567 wxTextCtrl*
val =
dynamic_cast<wxTextCtrl*
>(w);
569 if (options[option_pos]->IsString()) {
570 options[option_pos]->SetString()->SetVal(
ToStdString(
val->GetValue()));
574 wxComboBox* combo =
dynamic_cast<wxComboBox*
>(w);
576 if (options[option_pos]->IsString()) {
577 options[option_pos]->SetString()->SetVal(
ToStdString(combo->GetStringSelection()));
581 wxChoice* choice =
dynamic_cast<wxChoice*
>(w);
583 if (options[option_pos]->IsString()) {
584 options[option_pos]->SetString()->SetVal(
ToStdString(choice->GetStringSelection()));
User-defined methods of the data storage class.
bool IsGeneralIdProtPresent(objects::CSeq_entry_Handle tse)
TConstScopedObjects GetSelectedObjects()
objects::CSeq_entry_Handle m_TopSeqEntry
bool Create(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE, const wxString &name=wxFrameNameStr)
bool GetTopLevelSeqEntryAndProcessor()
void UpdateChildrenFeaturePanels(wxSizer *sizer)
virtual CRef< CCmdComposite > GetCommand()
void ProcessUpdateFeatEvent(wxCommandEvent &event)
wxCheckBox * m_AddUnverified
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
wxFlexGridSizer * m_OptionsSizer
bool DoesObjectAllQualsMatchFieldConstraint(const CObject &object, const set< string > &qual_list, CRef< edit::CStringConstraint > string_constraint, CRef< CScope > scope)
void CreateControls()
Creates the controls and sizers.
COkCancelPanel * m_OkCancel
CFeatureTypePanel * m_FeatureTypeFrom
void Init()
Initialises member variables.
void x_AddUnverified(objects::CBioseq_Handle bsh, CRef< CCmdComposite > cmd, set< objects::CSeq_entry_Handle > &already_done)
CConvertFeatDlg()
Constructors.
wxFlexGridSizer * m_FeatureChoiceSizer
~CConvertFeatDlg()
Destructor.
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
virtual string GetErrorMessage()
wxCheckBox * m_LeaveOriginal
bool Create(wxWindow *parent, wxWindowID id=10147, const wxString &caption=_("Convert Features"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
wxTextCtrl * m_FunctionDescriptionTxt
virtual void UpdateEditor()
CStringConstraintPanel * m_Constraint
set< string > GetQualList(void)
CFeatureTypePanel * m_FeatureTypeTo
CRef< CConvertFeatureBase > m_Converter
static bool ShowToolTips()
Should we show tooltips?
static CRef< CConvertFeatureBase > Create(objects::CSeqFeatData::ESubtype subtype_from, objects::CSeqFeatData::ESubtype subtype_to)
void SetCreateGeneralOnly(bool flag)
virtual bool CanConvertFrom(objects::CSeqFeatData::ESubtype subtype)
void SetOffset(int *offset)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
const TOptions & GetOptions() const
virtual string GetDescription()
vector< CRef< CConversionOption > > TOptions
void SetListAllFeats(bool flag)
virtual string GetFieldName(const bool subfield=false)
Returns the name of the field as selected in the panel.
void ListPresentFeaturesFirst(const objects::CSeq_entry_Handle &entry, vector< const objects::CFeatListItem * > *featlist=nullptr)
vector< CConstRef< CObject > > GetRelatedObjects(const CObject &object, CRef< objects::CScope > scope)
vector< string > GetVals(const CObject &object)
vector< CConstRef< CObject > > GetObjects(objects::CBioseq_Handle bsh)
@ eSubtype_transit_peptide_aa
@ eSubtype_sig_peptide_aa
@ eSubtype_mat_peptide_aa
static ESubtype SubtypeNameToValue(CTempString sName)
Turn a string into its ESubtype which is NOT necessarily related to the identifier of the enum.
namespace ncbi::objects::
CRef< edit::CStringConstraint > GetStringConstraint()
void SetObjectType(EObjectType obj_type)
void AddUnverifiedFeature()
IWorkbench is the central interface in the application framework.
const_iterator end() const
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
const_iterator begin() const
const_iterator find(const key_type &key) const
const_iterator end() const
static const string kConversionNotSupported
static CSeqFeatData::ESubtype s_GetFeatureSubtypeFromString(const string &key)
#define ID_CF_LEAVE_ORIGINAL
#define ID_CF_FEATURETYPEFROM
#define ID_CF_ADD_UNVERIFIED
#define ID_CF_FUNCTION_DESC
#define ID_CF_FEATURETYPETO
const string kPartialStart
#define EVT_UPDATE_FEATURE_LIST(id, fn)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
list< pair< string, TEnumValueType > > TValues
vector< SConstScopedObject > TConstScopedObjects
#define ENUM_METHOD_NAME(EnumName)
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static const char label[]
EFeat_qual_legal
Access to EFeat_qual_legal's attributes (values, names) as defined in spec.
const struct ncbi::grid::netcache::search::fields::SIZE size
const struct ncbi::grid::netcache::search::fields::KEY key
double f(double x_, const double &y_)
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)