38 #include <wx/stattext.h>
39 #include <wx/textctrl.h>
40 #include <wx/choice.h>
41 #include <wx/valtext.h>
92 wxPanel::Create( parent,
id, pos,
size, style );
141 wxBoxSizer* itemBoxSizer1 =
new wxBoxSizer(wxVERTICAL);
142 itemPanel2->SetSizer(itemBoxSizer1);
144 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxHORIZONTAL);
145 itemBoxSizer1->Add(itemBoxSizer2, 0, wxALIGN_CENTER_HORIZONTAL, 0);
147 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxVERTICAL);
148 itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW, 0);
150 wxBoxSizer* itemBoxSizer4 =
new wxBoxSizer(wxHORIZONTAL);
151 itemBoxSizer3->Add(itemBoxSizer4, 0, wxGROW|wxALL, 5);
153 wxStaticText* itemStaticText5 =
new wxStaticText( itemPanel2, wxID_STATIC,
_(
"on"), wxDefaultPosition, wxDefaultSize, 0 );
154 itemBoxSizer4->Add(itemStaticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
156 wxArrayString m_StrandStrings;
157 m_StrandStrings.Add(
_(
"Any strand"));
158 m_StrandStrings.Add(
_(
"Plus strand"));
159 m_StrandStrings.Add(
_(
"Minus strand"));
160 m_Strand =
new wxChoice( itemPanel2,
wxID_ANY, wxDefaultPosition, wxDefaultSize, m_StrandStrings, 0 );
161 m_Strand->SetStringSelection(
_(
"Any strand"));
162 itemBoxSizer4->Add(
m_Strand, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
164 wxStaticText* itemStaticText7 =
new wxStaticText( itemPanel2, wxID_STATIC,
_(
"on"), wxDefaultPosition, wxDefaultSize, 0 );
165 itemBoxSizer4->Add(itemStaticText7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
167 wxArrayString m_NucOrProtStrings;
168 m_NucOrProtStrings.Add(
_(
"nucleotide and protein sequences"));
169 m_NucOrProtStrings.Add(
_(
"nucleotide sequences only"));
170 m_NucOrProtStrings.Add(
_(
"protein sequences only"));
171 m_NucOrProt =
new wxChoice( itemPanel2,
wxID_ANY, wxDefaultPosition, wxDefaultSize, m_NucOrProtStrings, 0 );
172 m_NucOrProt->SetStringSelection(
_(
"nucleotide and protein sequences"));
173 itemBoxSizer4->Add(
m_NucOrProt, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
175 wxBoxSizer* itemBoxSizer9 =
new wxBoxSizer(wxHORIZONTAL);
176 itemBoxSizer3->Add(itemBoxSizer9, 0, wxGROW|wxALL, 5);
178 wxStaticText* itemStaticText10 =
new wxStaticText( itemPanel2, wxID_STATIC,
_(
"5' end"), wxDefaultPosition, wxDefaultSize, 0 );
179 itemBoxSizer9->Add(itemStaticText10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
181 wxArrayString m_5PartialStrings;
182 m_5PartialStrings.Add(
_(
"Partial or Complete"));
183 m_5PartialStrings.Add(
_(
"Partial"));
184 m_5PartialStrings.Add(
_(
"Complete"));
185 m_5Partial =
new wxChoice( itemPanel2,
wxID_ANY, wxDefaultPosition, wxDefaultSize, m_5PartialStrings, 0 );
186 m_5Partial->SetStringSelection(
_(
"Partial or Complete"));
187 itemBoxSizer9->Add(
m_5Partial, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
189 wxStaticText* itemStaticText12 =
new wxStaticText( itemPanel2, wxID_STATIC,
_(
"3' end"), wxDefaultPosition, wxDefaultSize, 0 );
190 itemBoxSizer9->Add(itemStaticText12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
192 wxArrayString m_3PartialStrings;
193 m_3PartialStrings.Add(
_(
"Partial or Complete"));
194 m_3PartialStrings.Add(
_(
"Partial"));
195 m_3PartialStrings.Add(
_(
"Complete"));
196 m_3Partial =
new wxChoice( itemPanel2,
wxID_ANY, wxDefaultPosition, wxDefaultSize, m_3PartialStrings, 0 );
197 m_3Partial->SetStringSelection(
_(
"Partial or Complete"));
198 itemBoxSizer9->Add(
m_3Partial, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
200 wxBoxSizer* itemBoxSizer14 =
new wxBoxSizer(wxHORIZONTAL);
201 itemBoxSizer3->Add(itemBoxSizer14, 0, wxGROW|wxALL, 5);
203 wxStaticText* itemStaticText15 =
new wxStaticText( itemPanel2, wxID_STATIC,
_(
"location type"), wxDefaultPosition, wxDefaultSize, 0 );
204 itemBoxSizer14->Add(itemStaticText15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
206 wxArrayString m_LocTypeStrings;
207 m_LocTypeStrings.Add(
_(
"Any"));
208 m_LocTypeStrings.Add(
_(
"Single interval"));
209 m_LocTypeStrings.Add(
_(
"Joined"));
210 m_LocTypeStrings.Add(
_(
"Ordered"));
211 m_LocType =
new wxChoice( itemPanel2,
wxID_ANY, wxDefaultPosition, wxDefaultSize, m_LocTypeStrings, 0 );
213 itemBoxSizer14->Add(
m_LocType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
215 wxBoxSizer* itemBoxSizer17 =
new wxBoxSizer(wxHORIZONTAL);
216 itemBoxSizer3->Add(itemBoxSizer17, 0, wxGROW|wxALL, 5);
218 wxStaticText* itemStaticText18 =
new wxStaticText( itemPanel2, wxID_STATIC,
_(
"where end of sequence is"), wxDefaultPosition, wxDefaultSize, 0 );
219 itemBoxSizer17->Add(itemStaticText18, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
221 wxArrayString m_5DistTypeStrings;
222 m_5DistTypeStrings.Add(
_(
"Any distance"));
223 m_5DistTypeStrings.Add(
_(
"Exactly"));
224 m_5DistTypeStrings.Add(
_(
"No more than"));
225 m_5DistTypeStrings.Add(
_(
"No less than"));
226 m_5DistType =
new wxChoice( itemPanel2,
wxID_ANY, wxDefaultPosition, wxDefaultSize, m_5DistTypeStrings, 0 );
228 itemBoxSizer17->Add(
m_5DistType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
230 m_5Dist =
new wxTextCtrl( itemPanel2,
wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
231 itemBoxSizer17->Add(
m_5Dist, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
232 m_5Dist->SetValidator( wxTextValidator( wxFILTER_NUMERIC ) );
235 wxStaticText* itemStaticText21 =
new wxStaticText( itemPanel2, wxID_STATIC,
_(
"from 5' end of the feature"), wxDefaultPosition, wxDefaultSize, 0 );
236 itemBoxSizer17->Add(itemStaticText21, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
238 wxBoxSizer* itemBoxSizer22 =
new wxBoxSizer(wxHORIZONTAL);
239 itemBoxSizer3->Add(itemBoxSizer22, 0, wxGROW|wxALL, 5);
241 wxStaticText* itemStaticText23 =
new wxStaticText( itemPanel2, wxID_STATIC,
_(
"where end of sequence is"), wxDefaultPosition, wxDefaultSize, 0 );
242 itemBoxSizer22->Add(itemStaticText23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
244 wxArrayString m_3DistTypeStrings;
245 m_3DistTypeStrings.Add(
_(
"Any distance"));
246 m_3DistTypeStrings.Add(
_(
"Exactly"));
247 m_3DistTypeStrings.Add(
_(
"No more than"));
248 m_3DistTypeStrings.Add(
_(
"No less than"));
249 m_3DistType =
new wxChoice( itemPanel2,
wxID_ANY, wxDefaultPosition, wxDefaultSize, m_3DistTypeStrings, 0 );
251 itemBoxSizer22->Add(
m_3DistType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
253 m_3Dist =
new wxTextCtrl( itemPanel2,
wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
254 itemBoxSizer22->Add(
m_3Dist, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
255 m_3Dist->SetValidator( wxTextValidator( wxFILTER_NUMERIC ) );
258 wxStaticText* itemStaticText26 =
new wxStaticText( itemPanel2, wxID_STATIC,
_(
"from 3' end of the feature"), wxDefaultPosition, wxDefaultSize, 0 );
259 itemBoxSizer22->Add(itemStaticText26, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
311 m_5Dist->SetValue(wxEmptyString);
319 m_3Dist->SetValue(wxEmptyString);
334 if (
NStr::EqualNocase(fn_it.m_FName, CMacroFunction_LocationStrand::GetFuncName())) {
336 if (strand_it != fn_it.m_FArgs.end()) {
337 const int sel = (strand_it->second ==
"plus") ? 1 : (strand_it->second ==
"minus") ? 2 : 0;
348 const int sel = (fn_it.m_Negate) ? 2 : 1;
352 const int sel = (fn_it.m_Negate) ? 2 : 1;
358 if (type_it->second ==
"single-interval") {
361 else if (type_it->second ==
"joined") {
364 else if (type_it->second ==
"ordered") {
371 m_5Dist->ChangeValue(dist_it->second);
374 if (fn_it.m_ParentFnc ==
"=") {
377 else if (fn_it.m_ParentFnc ==
"<=") {
380 else if (fn_it.m_ParentFnc ==
">=") {
387 m_3Dist->ChangeValue(dist_it->second);
390 if (fn_it.m_ParentFnc ==
"=") {
393 else if (fn_it.m_ParentFnc ==
"<=") {
396 else if (fn_it.m_ParentFnc ==
">=") {
407 vector<CFuncWithArgs> functions;
412 fn.
m_FName = CMacroFunction_LocationStrand::GetFuncName();
414 if (sel == 1) strand =
"plus";
415 else if (sel == 2) strand =
"minus";
417 functions.push_back(fn);
425 functions.push_back(fn);
429 functions.push_back(fn);
440 functions.push_back(fn);
451 functions.push_back(fn);
460 if (sel == 1) loc_type =
"single-interval";
461 else if (sel == 2) loc_type =
"joined";
462 else if (sel == 3) loc_type =
"ordered";
464 functions.push_back(fn);
470 string dist =
m_5Dist->GetValue().ToStdString();
471 if (sel > 0 && !dist.empty()) {
480 functions.push_back(fn);
486 string dist =
m_3Dist->GetValue().ToStdString();
487 if (sel > 0 && !dist.empty()) {
496 functions.push_back(fn);
507 case 1 : c.push_back(CMacroFunction_LocationStrand::GetFuncName() +
"() = \"plus\"");
break;
508 case 2 : c.push_back(CMacroFunction_LocationStrand::GetFuncName() +
"() = \"minus\"");
break;
540 string d =
m_5Dist->GetValue().ToStdString();
544 case 1: c.push_back(func +
"= " + d);
break;
545 case 2: c.push_back(func +
"<= " + d);
break;
546 case 3: c.push_back(func +
">= " + d);
break;
553 string d =
m_3Dist->GetValue().ToStdString();
557 case 1: c.push_back(func +
"= " + d);
break;
558 case 2: c.push_back(func +
"<= " + d);
break;
559 case 3: c.push_back(func +
">= " + d);
break;
570 string label =
"only objects on ";
573 case 1 :
label +=
"plus strands of ";
break;
574 case 2 :
label +=
"minus strands of ";
break;
579 case 1 :
label +=
"nucleotide ";
break;
580 case 2 :
label +=
"protein ";
break;
583 label +=
"sequences ";
587 case 1 : label2 +=
"5' partial ";
break;
588 case 2 : label2 +=
"5' complete ";
break;
593 case 1 : label2 +=
"3' partial ";
break;
594 case 2 : label2 +=
"3' complete ";
break;
599 case 1 : label2 +=
"with single interval ";
break;
600 case 2 : label2 +=
"with joined intervals ";
break;
601 case 3 : label2 +=
"with ordered intervals ";
break;
606 label2 +=
"with 5' end ";
609 case 1: label2 +=
"exactly ";
break;
610 case 2: label2 +=
"no more than ";
break;
611 case 3: label2 +=
"no less than ";
break;
613 label2 +=
m_5Dist->GetValue().ToStdString();
614 label2 +=
" from end of sequence ";
618 label2 +=
"with 3' end ";
621 case 1: label2 +=
"exactly ";
break;
622 case 2: label2 +=
"no more than ";
break;
623 case 3: label2 +=
"no less than ";
break;
625 label2 +=
m_3Dist->GetValue().ToStdString();
626 label2 +=
" from end of sequence ";
629 label +=
"that are " + label2;
Class to store one function as it appears in the macro and its arguments (as GUI fieldnames)
string m_FName
Function name as it appears in the macro.
virtual pair< string, string > GetMatcher(const pair< string, string > &target, size_t num)
string GetDescription() const
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
virtual void SetMatcher(const vector< CFuncWithArgs > &func_info)
string GetLocationConstraint()
CMacroLocationConstraintPanel()
Constructors.
void Init()
Initialises member variables.
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void OnAnySelected(wxCommandEvent &event)
wxEVT_COMMAND_CHOICE_SELECTED event handler for wxID_ANY
virtual vector< CFuncWithArgs > GetFuncWithArgs(const pair< string, string > &target, size_t num) const
void CreateControls()
Creates the controls and sizers.
static bool ShowToolTips()
Should we show tooltips?
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
~CMacroLocationConstraintPanel()
Destructor.
IMPLEMENT_CLASS(CFloatingFrame, CFloatingFrameBaseClass) const static long kFloatFrameStyle
CFloatingFrame.
static const char * sm_SeqNa
class CMacroFunction_LocationSeqType IS_SEQ_AA(["location"]) - returns true if the sequence identifie...
static const char * sm_PartialStart
class CMacroFunction_LocPartialTest - tests whether the location is 5'/3' partial ISPARTIALSTART() - ...
static const char * sm_SeqAa
static const char * sm_FromStart
class CMacroFunction_LocationDistConstraint DISTFROMSTART() [>][=][<] distance DISTFROMSTOP()
static const char * sm_PartialStop
static CTempString GetFuncName()
static const char * sm_FromStop
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
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 const char label[]
const string kConstr_Strand
const string kConstr_LocType
const string kConstr_Distance
const struct ncbi::grid::netcache::search::fields::SIZE size