43 #include <wx/statbox.h>
44 #include <wx/stattext.h>
45 #include <wx/wupdlock.h>
46 #include <wx/tipwin.h>
47 #include <wx/dcclient.h>
48 #include <wx/tglbtn.h>
95 : m_EditedMacro(macro_rep)
109 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
110 wxPanel::Create( parent,
id, pos,
size, style );
115 GetSizer()->SetSizeHints(
this);
161 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
162 itemPanel1->SetSizer(itemBoxSizer2);
164 wxFlexGridSizer* itemFlexGridSizer3 =
new wxFlexGridSizer(0, 2, 0, 0);
165 itemBoxSizer2->Add(itemFlexGridSizer3, 1, wxEXPAND|wxALL, 5);
167 wxBoxSizer* itemBoxSizer4 =
new wxBoxSizer(wxVERTICAL);
168 itemFlexGridSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 0);
170 wxBoxSizer* itemBoxSizer5 =
new wxBoxSizer(wxHORIZONTAL);
171 itemBoxSizer4->Add(itemBoxSizer5, 0, wxGROW|wxALL, 0);
173 wxStaticText* itemStaticText6 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Action search:"), wxDefaultPosition, wxDefaultSize, 0 );
174 itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
185 wxBoxSizer* itemBoxSizer9 =
new wxBoxSizer(wxVERTICAL);
186 itemFlexGridSizer3->Add(itemBoxSizer9, 0, wxGROW|wxALL, 0);
188 wxStaticBox* itemStaticBoxSizer10Static =
new wxStaticBox(itemPanel1,
wxID_ANY,
_(
"Action"));
189 m_ActionSizer =
new wxStaticBoxSizer(itemStaticBoxSizer10Static, wxVERTICAL);
193 wxStaticBox* itemStaticBoxSizer13Static =
new wxStaticBox(itemPanel1,
wxID_ANY,
_(
"Constraints"));
194 m_ConstraintSizer =
new wxStaticBoxSizer(itemStaticBoxSizer13Static, wxHORIZONTAL);
212 x_Build(root, root_id, builder);
214 wxTreeItemIdValue cookie;
217 _ASSERT(action_tree->ReferencedOnlyOnce());
220 vector<EMActionType>
types;
235 wxTreeItemId item_id = it->second;
253 x_Build(*child, child_id, builder);
260 wxTreeItemId item_id =
event.GetItem();
261 if (!item_id.IsOk()) {
265 wxTreeItemId parent_id =
m_ActionTree->GetItemParent(item_id);
266 if (!parent_id.IsOk()) {
270 wxTreeItemData* data =
m_ActionTree->GetItemData(item_id);
272 #if defined __WINDOWS__
273 wxWindowUpdateLocker locker(
this);
280 auto current_target = edit_item->GetTarget().first;
281 bool enable_add_btn = (current_target == macro::CMacroBioData::sm_TSEntry ||
282 current_target == macro::CMacroBioData::sm_AutodefOpts) ?
false :
true;
360 if (iter_label.empty())
366 string macro_script =
"MACRO Macro_name \"" + description;
368 if (!constraints_description.empty())
369 macro_script +=
" where " +
NStr::Join(constraints_description,
" and ");
370 macro_script +=
"\"\n";
373 macro_script +=
"VAR\n";
382 macro_script +=
"FOR EACH " + iter_label +
"\n";
386 if (!constraints.empty()) {
387 vector<string> pure_constraints;
388 pure_constraints.reserve(constraints.size());
389 for (
auto p : constraints) {
390 pure_constraints.push_back(p.second);
393 macro_script +=
"WHERE " +
NStr::Join(pure_constraints,
"\n AND ") +
"\n";
396 macro_script +=
"DO\n";
397 macro_script += do_function +
"\n";
398 macro_script +=
"DONE\n";
399 macro_script +=
"---------------------------------------------------\n";
422 if (search.empty()) {
456 wxTreeItemIdValue cookie;
457 wxTreeItemId child, item_id =
m_ActionTree->GetFirstChild(root, cookie);
459 while (item_id.IsOk()) {
464 else if (wxTreeItemData* data =
m_ActionTree->GetItemData(item_id)) {
472 const vector<string>& keywords = edit_data->
GetKeywords();
473 if (!keywords.empty() &&
474 find_if(keywords.begin(), keywords.end(), [&search](
const string& it) { return NStr::FindNoCase(it, search) != NPOS; }) != keywords.end()) {
547 x_ShowTooltip(
false);
563 if (
flags & (wxTREE_HITTEST_ONITEMLABEL | wxTREE_HITTEST_ONITEMSTATEICON | wxTREE_HITTEST_ONITEMINDENT)) {
580 static wxTipWindow* s_tipWindow =
nullptr;
584 s_tipWindow->SetTipWindowPtr(
nullptr);
585 s_tipWindow->Close();
586 s_tipWindow =
nullptr;
593 wxTreeItemData* data = GetItemData(
m_SelItem);
612 r.SetPosition(ClientToScreen(
r.GetPosition()));
614 s_tipWindow =
new wxTipWindow(
this,
m_ToolTipText, w, &s_tipWindow, &
r);
EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX, CAdjustFeaturesForGaps::OnKnownUnknownSelected) EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX1
const string & GetLabel() const
const vector< CRef< CMActionNode > > & GetChildren() const
static CConstRef< CMActionTree > BuildActionTree()
EMActionType GetMActionType(const macro::CMacroRep ¯o_rep, const vector< EMActionType > &types, CMacroInterpreter ¯o_interpret) const
wxTreeItemData * GetTreeItemData(const CMActionNode &node) const
TStringPairsVector GetConstraints()
void ClearValues(bool enable_add)
void SetConstraints(const vector< CFuncWithArgs > &)
When setting constraints from a macro that's edited 1.
vector< string > GetDescription()
bool Create(wxWindow *parent, wxWindowID id=ID_CMACROEDITINGACTIONPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Creation.
wxStaticBoxSizer * m_ConstraintSizer
map< EMActionType, wxTreeItemId > m_ActionToNodeMap
void x_FindItem(const string &search, const wxTreeItemId &root)
void OnSearchCtrlClick(wxCommandEvent &event)
vector< wxTreeItemId >::const_iterator m_RecentIt
const string & GetWarning() const
void OnControlClick(wxCommandEvent &event)
CMacroEditor * m_ParentFrame
void x_FindText(const string &search)
wxSearchCtrl * m_SearchCtrl
wxStaticBoxSizer * m_ActionSizer
pair< string, string > GetForTarget()
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void OnHyperlinkClicked(wxHyperlinkEvent &event)
void OnSearchCtrlEnter(wxCommandEvent &event)
~CMacroEditingActionPanel()
Destructor.
vector< CFuncWithArgs > m_FuncInfo
Stores parsed information about functions of m_EditedMacro.
vector< wxTreeItemId > m_RecentItemIds
void OnControlInSubPanelChanged(wxCommandEvent &event)
CRef< macro::CMacroRep > m_EditedMacro
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
static bool ShowToolTips()
Should we show tooltips?
CMacroEditingActionPanel()
Constructors.
IMacroActionItemData * m_SelectedItem
wxTreeCtrl * m_ActionTree
void OnActionTreeItemChanged(wxTreeEvent &event)
wxEVT_TREE_SEL_CHANGED event handler for ID_MACROEDIT_TREECTRL
void x_PopulateTreeCtrl()
void CreateControls()
Creates the controls and sizers.
void x_Build(const CMActionNode &root, wxTreeItemId root_id, const CMTreeItemDataBuilder &builder)
void Init()
Initialises member variables.
@ ID_MACROEDIT_SEARCHCTRL
@ ID_MACROEDIT_CONSTRAINTPNL
CMacroCompoundConstraintPanel * m_ConstraintPanel
vector< CFuncWithArgs > m_WhereFuncInfo
bool InterpretDoFunctions(const macro::CMacroRep ¯o_rep)
const vector< CFuncWithArgs > & GetWhereFunctions() const
const vector< CFuncWithArgs > & GetInterpretedFunctions() const
void OnCollapseAllMenuItem(wxCommandEvent &event)
void OnTimer(wxTimerEvent &event)
void OnLeftDown(wxMouseEvent &event)
void OnExpandAllMenuItem(wxCommandEvent &event)
@ ID_MACROEDIT_POPUPEXPAND
@ ID_MACROEDIT_POPUPCOLLAPSE
void OnMouseMove(wxMouseEvent &event)
void x_ShowTooltip(bool show)
void OnContextMenu(wxContextMenuEvent &event)
const pair< string, string > GetTarget() const
virtual string GetVariables()
virtual string GetFunction(TConstraints &constraints) const =0
virtual bool HasVariables() const
bool TransferDataToPanel(const vector< CFuncWithArgs > &func_info)
virtual string GetMacroDescription() const
void CreateParamPanel(wxStaticBoxSizer &action_sizer, wxPanel *parent)
bool TransferDataFromPanel()
const string & GetWarning() const
const string & GetGeneralDescription() const
virtual const vector< string > & GetKeywords() const
virtual bool UpdateTarget()
const_iterator end() const
const_iterator find(const key_type &key) const
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
EDialogReturnValue NcbiInfoBox(const string &message, const string &title="Info")
specialized Message Box function for reporting general information messages
EDialogReturnValue NcbiMessageBox(const string &message, TDialogType type=eDialog_Ok, EDialogIcon icon=eIcon_Exclamation, const string &title="Error", EDialogTextMode text_mode=eRaw)
TObjectType * Release(void)
Release a reference to the object and return a pointer to the object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
vector< pair< string, string > > TStringPairsVector
static SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case insensitive search.
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.
const struct ncbi::grid::netcache::search::fields::SIZE size
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
ViewerWindowBase::OnEditMenu ViewerWindowBase::OnJustification EVT_MENU(MID_SHOW_GEOM_VLTNS, ViewerWindowBase::OnShowGeomVltns) EVT_MENU(MID_FIND_PATTERN
static void ExpandAll(wxTreeCtrl &tree, const wxTreeItemId &id, bool shouldExpand, int toLevel)
static const struct type types[]
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)