,
168 if(!m_QExec.IsNull())
169 returnm_QExec->GetExceptionCount();
229PopEventHandler(
true);
240 #ifdef __WXOSX_COCOA__ 241SetBackgroundStyle(wxBG_STYLE_COLOUR);
242SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_FRAMEBK));
245wxPanel::Create(parent,
id, pos,
size);
279wxBoxSizer* panel_sizer =
newwxBoxSizer(wxHORIZONTAL);
282 longstyles = wxTB_FLAT | wxTB_HORIZONTAL | wxTB_TEXT | wxTB_HORZ_LAYOUT;
285 longstyles = wxTB_FLAT | wxTB_HORIZONTAL;
288wxDefaultPosition, wxSize(-1, -1), styles);
380 intsearch_width = 180;
384 intsearch_height = tool_text->GetFont().GetPointSize()+8;
386 intsearch_height = -1;
391wxDefaultPosition, wxSize(search_width, search_height),
392wxTE_PROCESS_ENTER | wxTE_RICH );
395 1. A string to match against all fields\n\ 396 2. A query based on field names, e.g. :\n\ 397 dist > 0.2 and seq-id = \"NP_110296\""));
401wxBitmap bmp_selquery = wxArtProvider::GetBitmap(
wxT(
"menu::query_sel"));
402 m_ToolBar->AddTool(
eCmdSelQuery, wxEmptyString, bmp_selquery, wxNullBitmap, wxITEM_NORMAL,
wxT(
"Select Query"));
410 wxT(
"Exact Match"));
418wxBitmap bmp_start = wxArtProvider::GetBitmap(
wxT(
"menu::dm_start"));
423wxDefaultPosition, wxSize(22, 22));
424 m_Animation->SetToolTip(
wxT(
"Light moves while query is running"));
430wxBitmap bmp_stop = wxArtProvider::GetBitmap(
wxT(
"menu::dm_stop"));
436wxBitmap bmp_filter = wxArtProvider::GetBitmap(
wxT(
"menu::dm_filter"));
437 m_ToolBar->AddTool(
eCmdFilter,
wxT(
"Filter"), bmp_filter, wxNullBitmap, wxITEM_CHECK,
wxT(
"Only show query results"));
441wxDefaultPosition, wxDefaultSize, wxNO_BORDER );
443 m_pSelectAll->SetToolTip(
wxT(
"Check to show all matching nodes as selected\n\ 444 Uncheck to show one matching node at a time\n"));
447wxBitmap bmp_prev = wxArtProvider::GetBitmap(
wxT(
"menu::back"));
453wxBitmap bmp_next = wxArtProvider::GetBitmap(
wxT(
"menu::forward"));
459wxBitmap bmp_help = wxArtProvider::GetBitmap(
wxT(
"menu::help"));
464panel_sizer->Add(
m_ToolBar, 1, wxALL|wxGROW|wxALIGN_LEFT, 0);
466SetSizerAndFit(panel_sizer);
534vector<string> queries;
537 for(
size_t i=0;
i<queries.size(); ++
i) {
552vector<string> queries;
554vector<pair<string,string> >::const_iterator iter;
557queries.push_back((*iter).second);
560 if(queries.size() > 0)
573 if(new_query !=
"") {
581 if(
arr.size() > 0) {
582 stringlast_token =
arr[
arr.size()-1];
587new_query +=
" AND ";
597new_query +=
" "+
str;
611 unsigned intquery_idx = evt.GetId() -
ID_MRU1;
621wxCommandEvent evt_dummy;
649::wxLaunchDefaultBrowser(
ToWxString(help_addr));
659 boolfound_return =
false;
660 for(
size_t i=0;
i<evt.GetString().
size(); ++
i) {
661 if(evt.GetString()[
i] !=
wxT(
'\n'))
662no_return += evt.GetString()[
i];
664found_return =
true;
667 longcursor =
m_pSearch->GetInsertionPoint();
669cursor =
std::max(
long(0), cursor-1);
673wxCommandEvent dummy_evt;
682vector<std::pair<size_t, size_t> > fields;
689wxTextAttr attr(wxColour(wxString(
wxT(
"black"))));
690attr.SetFlags(wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_FONT_WEIGHT);
698 size_ttdelta =
str.length() - truncated_str.length();
710 if(valid || fields.size() > 0) {
711wxTextAttr attr(wxColour(wxString(
wxT(
"blue"))));
712attr.SetFlags(wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_FONT_WEIGHT);
715 for(
size_t i=0;
i<fields.size(); ++
i) {
717(
long)(fields[
i].second + tdelta),
735wxTextAttr attr(wxColour(wxString(
wxT(
"blue"))));
736attr.SetFlags(wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_FONT_WEIGHT);
739string::size_type idx;
761wxMenu* m =
newwxMenu();
763 unsigned intmax_id =
ID_MRU1;
766wxMenu* default_menu =
newwxMenu();
772m->AppendSubMenu(default_menu,
wxT(
"Saved Queries"));
843wxMenu* m =
newwxMenu();
846m->SetTitle(
wxT(
"String Matching Options"));
851m->AppendSeparator();
852m->AppendCheckItem(max_id,
ToWxString(
"Case Sensitive"));
888std::vector<std::pair<size_t, size_t> >
903std::pair<size_t, size_t> field_position;
906field_position.first = qnode.
GetLoc().
pos;
909m_FieldPositions.push_back(field_position);
923vector<std::pair<size_t, size_t> >& fields)
925 boolvalid = (
query.length() > 0);
929 if(
query.length() > 5 &&
931macro::CMacroRep* macro_rep =
NULL;
936macro::CMacroParser p;
938p.SetSource(
query.c_str());
939p.Parse(
true, qexec);
940macro_rep = p.DetachMacroRep();
942 if(macro_rep->GetWhereClause() !=
NULL&&
943macro_rep->GetDoTree() !=
NULL) {
982macro::CMacroParser p;
990p.GetWhereFunctions());
1044this->SetCursor(*wxSTANDARD_CURSOR);
1058wxWindow* fwin = wxWindow::FindFocus();
1060 if(fwin ==
NULL) {
1064 if(status !=
"") {
1073wxCommandEvent evt_dummy;
1079macro::CMacroRep* macro_rep,
1081 const string&
query)
1083 stringresult_status;
1145 _TRACE(
"Query job start failed");
1161this->SetCursor(*wxHOURGLASS_CURSOR);
1178 m_ToolBar->SetCursor(*wxSTANDARD_CURSOR);
1179 m_ToolBar->SetCursor(*wxSTANDARD_CURSOR);
1187macro::CMacroParser p;
1199macro::CMacroRep* macro_rep =
NULL;
1200 boolis_macro =
false;
1205 if(
query.length() > 5 &&
1210p.SetSource(
query.c_str());
1211p.Parse(
true, qexec);
1213macro_rep = p.DetachMacroRep();
1218status_msg =
"Macro parsing failed: "+ e.
GetMsg();
1236p.GetWhereFunctions());
1242qtree->
Print(strstrm);
1247vector<string>
arr;
1250 for(
size_t i= 0;
i<
arr.size(); ++
i)
1261status_msg =
"Query parsing failed: "+ e.
GetMsg();
1308 stringresult_status;
1314 m_Job->GetQueriedCount() <<
1315 " Number of query execution errors: "<<
1316 m_Job->GetExceptionCount() <<
1317 string(
" Query Time: ") <<
m_Job->GetQueryTime());
1319result_status =
string(
"Number evaluated: ") +
1321 string(
". Number Selected: ") +
1324 if(
m_Job->GetExceptionCount() > 0) {
1325result_status +=
string(
" Number with query errors: ") +
1335 LOG_POST(
Info<<
"Number evaluated (for cancelled search): "<<
1336 m_Job->GetQueriedCount() <<
1337 " Number with query execution errors: "<<
1338 m_Job->GetExceptionCount());
1340result_status =
string(
"Number evaluated (for cancelled search): ") +
1342 string(
". Number Selected: ") +
1344 if(
m_Job->GetExceptionCount() > 0) {
1345result_status +=
string(
" Number with query errors: ") +
1378vector<pair<string,string> >::iterator iter;
1380 if((*iter).second == q) {
EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX, CAdjustFeaturesForGaps::OnKnownUnknownSelected) EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX1
void GUI_AsyncJoinFuture(const job_future_base &future, const string &msg)
Checksum and hash calculation classes.
IAppJobListener Interface for components that need to be notified about changes in Jobs.
CChecksum â Checksum calculator.
CRegistryWriteView GetWriteView(const string §ion)
get a read-write view at a particular level.
static CGuiRegistry & GetInstance()
access the application-wide singleton
CRegistryReadView GetReadView(const string §ion) const
get a read-only view at a particular level.
virtual bool EvalNext(macro::CMacroRep &)
virtual void GetFunctionNames(macro::CMacroParser &parser) const
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
class CQueryExecException
class CQueryExecPreProcessFunc
Class for extracting positions of data fields from the query.
std::vector< std::pair< size_t, size_t > > GetFieldPositions() const
CQueryHighlightFunction()
ETreeTraverseCode operator()(const CTreeNode< CQueryParseNode > &tr, int delta)
std::vector< std::pair< size_t, size_t > > m_FieldPositions
Job class used to run query on separate thread.
CStringMatching::EStringMatching m_StringCompare
string m_QueryString
For simple string queries.
macro::CMacroRep * m_Macro
int GetExceptionCount() const
CQueryParseTree * m_QueryTree
Parsed query tree.
size_t GetQueriedCount() const
Get stats on how many elements were checked and how many were checked but failed for some reason (suc...
void Execute(ICanceled &canceled)
CRef< CMacroQueryExec > m_QExec
Query execution object.
bool m_PrevCaseSensitive
Value of case-sensitive button last time query was executed.
string GetLastQuery() const
Get the text for the most recently executed query.
void OnButtonNext(wxCommandEvent &evt)
void OnToggleSelectAll(wxCommandEvent &evt)
virtual void SaveSettings() const
void OnSearchctrlSearchButtonClick(wxCommandEvent &evt)
void x_ExecuteQuery(int search_dir)
Parse query and determine how to execute.
CIRef< CQueryJob > m_Job
Current tree-query job.
bool x_IsValidQuery(string query, bool casesensitive, vector< std::pair< size_t, size_t > > &fields)
Return true if query parses correctly, putting field names in 'fields'.
static const int m_MaxRecentQueries
Max number of recent queries to include in list.
virtual void SetRegistryPath(const string ®_path)
void OnIdle(wxIdleEvent &event)
void OnQuerySel(wxCommandEvent &evt)
void OnSearchctrlTextEnter(wxCommandEvent &evt)
static const int m_MaxDefaultQueries
wxCheckBox * m_pSelectAll
CStringMatching::EStringMatching m_StringCompare
How to compare strings in query - wildcards, exact match, etc.
void x_StartQueryJob(CRef< CMacroQueryExec > qexec, CQueryParseTree *qtree, macro::CMacroRep *macro_rep, bool casesensitive, const string &query)
Submit query job for asynch execution.
void OnStringMatchTypeSelected(wxCommandEvent &evt)
vector< pair< string, string > > m_RecentQueries
Set of recent queries.
void SetDefaultQueries(const TNamedQueries &q)
Set the set of default queries for the current data source.
void CompleteQuery(CMacroQueryExec *qexec, const string &status)
void HideSelectAll(void)
Hide the Select All checkbox.
bool IsSelectAll()
Return true if select all checkbox is checked.
virtual ~CQueryParsePanel()
void SetDataSource(IQueryDataSource *ds)
Set or update data source.
void OnButtonPrevious(wxCommandEvent &evt)
virtual void Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
Create window.
string m_PrevQuery
String of query last time query was executed.
void CreateControls()
Creates the controls and sizers.
void OnStringMatchTypeBtn(wxCommandEvent &evt)
CRichTextCtrl * m_pSearch
Widgets.
void x_CancelQueryInProgress()
If user presses cancel button, cancel running job.
void OnSearchHelp(wxCommandEvent &evt)
virtual void LoadSettings()
vector< pair< string, string > > TNamedQueries
string m_RegSection
Registry section for specific current data source (derived from columns)
IQueryWidget * m_QueryWidget
Interface to widget which will display query results.
std::string m_SearchString
current search string (as of previous update to m_pSearch)
string m_RegPath
Registry path for query panel.
void OnRecentQuery(wxCommandEvent &evt)
CStringMatching::EStringMatching m_PrevStringCompare
Value of string-matching selection last time query was executed.
wxAnimationCtrl * m_Animation
std::vector< std::pair< size_t, size_t > > m_SearchStringFields
positions of dictionary fields in current search string
CIRef< IQueryDataSource > m_QueryDataSource
Interface to data source that is being queried.
vector< pair< string, string > > m_DefaultQueries
Set of default queries.
void OnSearchctrlSearchStop(wxCommandEvent &evt)
void AddQueryText(const string &query_mod)
Add given string to currently displayed query text.
void OnCtrlKillFocus(wxFocusEvent &evt)
bool m_CaseSensitive
Current value for case-sensitive.
void Init()
Initialises member variables.
void OnToggleHideUnselected(wxCommandEvent &evt)
void x_AddRecentQuery(const std::string &q)
Add a query to the list of recently used queries, if it is unique.
void OnContextMenu(wxContextMenuEvent &)
wxStaticText * m_SearchType
static bool m_IconsInitialized
Only need to load icons into art provider once per run.
job_future< void > m_Future
Query tree and associated utility methods.
class CRegistryReadView provides a nested hierarchical view at a particular key.
void GetStringVec(const string &key, vector< string > &val) const
void Set(const string &key, int val)
access a named key at this level, with no recursion
CRichTextCtrl - a wrapper for wxRichTextCtrl that handles additional keyboard events (such as Clipboa...
EStringMatching
String matching algorithms.
@ eWildcardMatch
Wildcard pattern matching.
@ eRegex
Regular expression matching.
@ ePlainSearch
Plain search.
@ eMetaphone
Metaphone mathcing.
static wxString ResolvePath(const wxString &path, const wxString &rel_name)
Utility function to hide the platform specifics of locating our standard directories and files.
definition of a Culling tree
Interface for testing cancellation request in a long lasting operation.
virtual void ExecuteStringQuery(const string &query, size_t &num_selected, size_t &num_queried, CStringMatching::EStringMatching string_matching=CStringMatching::ePlainSearch, NStr::ECase use_case=NStr::eCase)=0
Execute a string-matching query on the underlying data.
Base class for query node user defined object.
virtual void RegisterFileAlias(const wxArtID &anId, const wxArtClient &aClient, const wxSize &aSize, const wxString &aName, long aType=wxBITMAP_TYPE_ANY, int anIndex=-1)
static void simple_string(void)
static vector< string > arr
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static const char * str(char *buf, int n)
void AddLine(const char *line, size_t len)
#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_CATCH(message)
Catch CExceptions as well This macro is deprecated - use *_X or *_XX variant instead of it.
const string & GetMsg(void) const
Get message string.
void Info(CExceptionArgs_Base &args)
virtual bool Send(CEvent *evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
Sends an event synchronously.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
bool IsNull(void) const THROWS_NONE
Check if pointer is null â same effect as Empty().
TObjectType * GetPointerOrNull(void) THROWS_NONE
Get pointer value.
const IQueryParseUserObject * GetUserObject() const
Get user object.
void Parse(const char *query_str, ECase case_sense=eCaseInsensitive, ESyntaxCheck syntax_check=eSyntaxCheck, bool verbose=false, const TFunctionNames &functions=TFunctionNames(0), unsigned line=0, unsigned linePos=0)
Query parser front-end function.
int GetQueriedCount() const
virtual bool EvalComplete()
unsigned pos
Position in the src line.
const TNode * GetQueryTree() const
void Print(CNcbiOstream &os) const
Print the query tree (debugging)
const string & GetStrValue() const
void Flatten_ParseTree(CQueryParseTree::TNode &node)
Flatten the AND and the OR subtrees transforming them from binary subtrees to n-ary subtrees.
const SSrcLoc & GetLoc() const
@ eCaseSensitiveUpper
Operators must come in upper case (AND)
@ eCaseInsensitive
Case insensitive parsing (AnD)
@ eSyntaxCheck
Best possible check for errors.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
virtual bool IsCanceled(void) const =0
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string.
@ eTrunc_Begin
Truncate leading whitespace only.
@ eNocase
Case insensitive compare.
@ eCase
Case sensitive compare.
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
void Start(void)
Start the timer.
Fun TreeDepthFirstTraverse(TTreeNode &tree_node, Fun func)
Depth-first tree traversal algorithm.
ETreeTraverseCode
Tree traverse code returned by the traverse predicate function.
unsigned int CountNodes(unsigned int depth=1, TCountNodes how=0) const
Count nodes of the tree of which this node is a root.
const TValue & GetValue(void) const
Return node's value.
@ eTreeTraverse
Keep traversal.
job_function_traits< _Fty >::future job_async(const _Fty &_Fnarg, const string &descr)
const struct ncbi::grid::netcache::search::fields::SIZE size
Int4 delta(size_t dimension_, const Int4 *score_)
Query string parsing components.
#define ID_STRING_MATCH_TYPE1
static const char * kRecentQueries
const char * kStringMatchTypes[kStringMatchTypesCount]
const int kStringMatchTypesCount
#define ID_QUERY_ANIMATIONCTRL
EVT_COMMAND_RANGE(13014, 13014+CQueryParsePanel::m_MaxRecentQueries+CQueryParsePanel::m_MaxDefaultQueries - 1, wxEVT_COMMAND_MENU_SELECTED, CQueryParsePanel::OnRecentQuery) EVT_COMMAND_RANGE(14014
static const char * kQueryPanel
CStringMatching::EStringMatching kStringMatchEnumTypes[kStringMatchTypesCount]
wxEVT_COMMAND_MENU_SELECTED
const char * kStringMatchTypesToolbar[kStringMatchTypesCount]
wxFileArtProvider * GetDefaultFileArtProvider()
wxString ToWxString(const string &s)
string GetMD5Digest(const CChecksum &cs)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4