A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/edit__macro__dlg_8cpp_source.html below:

NCBI C++ ToolKit: src/gui/widgets/macro_edit/edit_macro_dlg.cpp Source File

50 #include <wx/button.h> 51 #include <wx/bmpbuttn.h> 52 #include <wx/bitmap.h> 54 #include <wx/listbox.h> 55 #include <wx/textctrl.h> 56 #include <wx/stattext.h> 57 #include <wx/msgdlg.h> 58 #include <wx/filedlg.h> 59 #include <wx/wupdlock.h> 102  Create

(parent,

id

, caption, pos,

size

, style);

110 bool CEditMacroDlg::Create

( wxWindow* parent, wxWindowID

id

,

const

wxString& caption,

const

wxPoint& pos,

const

wxSize&

size

,

long

style )

113 

SetExtraStyle(wxWS_EX_BLOCK_EVENTS);

114

CDialog::Create( parent,

id

, caption, pos,

size

, style );

119

GetSizer()->SetSizeHints(

this

);

160 

wxBoxSizer* bs_vertical =

new

wxBoxSizer(wxVERTICAL);

161

SetSizer(bs_vertical);

163

wxBoxSizer* bs_hor_top =

new

wxBoxSizer(wxHORIZONTAL);

164

wxBoxSizer* bs_hor_bottom =

new

wxBoxSizer(wxHORIZONTAL);

166

bs_vertical->Add(bs_hor_top, 1, wxEXPAND | wxALL, 5);

169

wxArrayString wxMacrolist;

170  m_MacroList

=

new

wxListBox(

this

,

ID_LISTBOX

, wxDefaultPosition, wxSize(-1, 250), wxMacrolist, wxLB_SINGLE );

171

bs_hor_top->Add(

m_MacroList

, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP | wxALL, 5);

173  m_TextCtrl

=

new

wxTextCtrl(

this

,

ID_TEXTCTRL

, wxEmptyString, wxDefaultPosition, wxSize(350, 250), wxTE_MULTILINE );

174

bs_hor_top->Add(

m_TextCtrl

, 1, wxEXPAND | wxALL, 5);

176

wxBoxSizer* syn_sizer =

new

wxBoxSizer(wxHORIZONTAL);

177

bs_vertical->Add(syn_sizer, 0, wxEXPAND | wxALL, 0);

179

wxStaticText* syn_text =

new

wxStaticText(

this

, wxID_STATIC,

_

(

"Synonym file:"

), wxDefaultPosition, wxDefaultSize, 0);

180

syn_sizer->Add(syn_text, 0, wxALIGN_LEFT | wxALL, 5);

182  m_SynFile

=

new

wxTextCtrl(

this

,

wxID_ANY

, wxEmptyString, wxDefaultPosition, wxSize(270, -1));

183

syn_sizer->Add(

m_SynFile

, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);

185

wxButton* itemButton12 =

new

wxBitmapButton(

this

,

ID_LOADSYNFILE

, wxArtProvider::GetBitmap(

wxT

(

"menu::open"

)), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW);

186

syn_sizer->Add(itemButton12, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2);

189

wxButton* itemButton13 =

new

wxButton(

this

,

wxID_ANY

,

_

(

"Update macro with new syn file"

), wxDefaultPosition, wxDefaultSize, 0);

190

syn_sizer->Add(itemButton13, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);

193

wxButton* itemButton14 =

new

wxButton(

this

,

wxID_ANY

,

_

(

"Store synonyms from file"

), wxDefaultPosition, wxDefaultSize, 0);

194

itemButton14->SetToolTip(

"Store synonyms from selected file before executing the macro"

);

195

syn_sizer->Add(itemButton14, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);

198

bs_vertical->Add(bs_hor_bottom, 0, wxEXPAND | wxALL, 5);

201

wxButton* Autofix_GB =

new

wxButton(

this

,

ID_AUTOFIXGB

,

_

(

"Autofix(GB)"

), wxDefaultPosition, wxDefaultSize, 0);

202

bs_hor_bottom->Add(Autofix_GB, 0, wxALIGN_LEFT | wxALL, 5);

204

wxButton* Autofix_TSA =

new

wxButton(

this

,

ID_AUTOFIXTSA

,

_

(

"Autofix(TSA)"

), wxDefaultPosition, wxDefaultSize, 0);

205

bs_hor_bottom->Add(Autofix_TSA, 0, wxALIGN_LEFT | wxALL, 5);

207

wxButton* Autofix_WGS =

new

wxButton(

this

,

ID_AUTOFIXWGS

,

_

(

"Autofix(WGS)"

), wxDefaultPosition, wxDefaultSize, 0);

208

bs_hor_bottom->Add(Autofix_WGS, 0, wxALIGN_LEFT | wxALL, 5);

210

wxButton* Other =

new

wxButton(

this

,

ID_OTHERMACROS

,

_

(

"Other Macros"

), wxDefaultPosition, wxDefaultSize, 0);

211

bs_hor_bottom->Add(Other, 0, wxALIGN_LEFT | wxALL, 5);

213

bs_hor_bottom->AddStretchSpacer();

215

wxButton* RunButton =

new

wxButton(

this

,

ID_RUN

,

_

(

"Run"

), wxDefaultPosition, wxDefaultSize, 0 );

216

bs_hor_bottom->Add(RunButton, 0, wxALL, 5);

218

wxButton* PrintButton =

new

wxButton(

this

,

ID_PRINT

,

_

(

"Print"

), wxDefaultPosition, wxDefaultSize, 0);

219

bs_hor_bottom->Add(PrintButton, 0, wxALL, 5);

221

wxButton* PrintParallelButton =

new

wxButton(

this

,

ID_PRINTPARALLEL

,

_

(

"Parallel_Print"

), wxDefaultPosition, wxDefaultSize, 0);

222

bs_hor_bottom->Add(PrintParallelButton, 0, wxALL, 5);

224

wxButton* CloseButton =

new

wxButton(

this

, wxID_CANCEL,

_

(

"Close"

), wxDefaultPosition, wxDefaultSize, 0 );

225

bs_hor_bottom->Add(CloseButton, 0, wxALL, 5);

274

wxFileDialog file_dlg(

this

,

_

(

"Select Synonym File"

), wxEmptyString, wxEmptyString,

_

(

"All files (*.*)|*.*"

), wxFD_OPEN | wxFD_FILE_MUST_EXIST);

275  if

(file_dlg.ShowModal() == wxID_OK) {

284  bool

modified =

false

;

287  while

(pos != string::npos) {

288  size_t

right_end = pos + search.length();

289  if

(pos > 0 &&

str

.c_str()[pos - 1] ==

'"'

&&

str

.data()[right_end] ==

'"'

) {

290  string

this_replace = replace;

291  str

=

str

.substr(0, pos) + this_replace +

str

.substr(right_end);

292

right_end = pos + this_replace.length();

313

vector<CRef<CMacroRep>> macros = { macro_rep };

316  if

(syn_files.empty()) {

317  NcbiInfoBox

(

"No synonym file is found in the macro"

);

321  if

(syn_files.size() > 1) {

322  string msg

=

"Multiple synonym files are found:"

;

323  for

(

const auto

& it : syn_files) {

331  for

(

const auto

& syn_it : syn_files) {

343  if

(syn_file.empty()) {

350  NcbiInfoBox

(

"Synonym file was successfully stored"

);

373  bool

bResolved =

true

;

384

macro_engine.

Exec

(*macro_rep, bio_data,

cmd

,

true

);

391  if

(!report.GetLog().empty()) {

392  log

<< report.GetName() <<

":\n"

<< report.GetLog() <<

"\n"

;

395  const auto

& logs = macro_stat.GetFunctionsLog();

397  log

<< report.GetName() <<

":\n"

;

399  for

(

const auto

& it : logs) {

400  log

<< it->Print() <<

"\n"

;

404  if

(!report.GetErrorLog().empty()) {

405  log

<<

"\nERRORS:\n"

<< report.GetErrorLog();

408  const auto

& unmatched_entries = macro_stat.GetUnmatchedTableEntries();

409  if

(!unmatched_entries.empty()) {

410  log

<<

"\nUnmatched entries:\n"

;

411  log

<< unmatched_entries.front().first;

414  string msg

(

"Execution succeeded\n"

);

417  msg

.append(

"Macro had no effect."

);

430  string msg

=

"Execution of macro "

+ macro_rep->

GetName

() +

" has failed:"

;

434

errorDlg.ShowModal();

446

wxFileDialog dlg(

this

,

wxT

(

"Save CSV file"

), wxEmptyString, wxEmptyString,

448

wxFD_SAVE |wxFD_OVERWRITE_PROMPT);

450  if

(dlg.ShowModal() != wxID_OK)

453

unique_ptr<CNcbiOstream> ostr;

454

wxString path = dlg.GetPath();

455  if

(!path.IsEmpty()) {

468  auto

start = chrono::steady_clock::now();

480

macro_engine.

Exec

(*macro_rep, bio_data,

cmd

,

true

, ostr.get());

484  auto

stop = chrono::steady_clock::now();

485

chrono::duration<double> elapsed = stop - start;

486  LOG_POST

(

Info

<<

"Time to execute macro (normal): "

<< elapsed.count());

496  string msg

=

"Execution of macro "

+ macro_rep->

GetName

() +

" has failed:"

;

500

errorDlg.ShowModal();

506

wxFileDialog dlg(

this

,

wxT

(

"Select file"

), wxEmptyString, wxEmptyString,

508

wxFD_SAVE | wxFD_OVERWRITE_PROMPT);

510  if

(dlg.ShowModal() != wxID_OK)

513

unique_ptr<CNcbiOstream> ostr;

514

wxString path = dlg.GetPath();

515  if

(!path.IsEmpty()) {

528  auto

start = chrono::steady_clock::now();

540

macro_engine.

Exec

(*macro_rep, bio_data,

cmd

,

true

, ostr.get());

544  auto

stop = chrono::steady_clock::now();

545

chrono::duration<double> elapsed = stop - start;

546  LOG_POST

(

Info

<<

"Time to parallel execute macro: "

<< elapsed.count());

555  string msg

=

"Execution of macro "

+ macro_rep->

GetName

() +

" has failed:"

;

559

errorDlg.ShowModal();

virtual void SetRegistryPath(const string &path)

void LoadAutofix_WGS(wxCommandEvent &event)

void OnPrintParallelClick(wxCommandEvent &event)

void x_LoadAutofixMacro(const string &name)

ICommandProccessor * m_CmdProccessor

static bool ShowToolTips()

Should we show tooltips?

vector< string > m_Macros

wxIcon GetIconResource(const wxString &name)

Retrieves icon resources.

void StoreSynonyms(wxCommandEvent &event)

void CreateControls()

Creates the controls and sizers.

CEditMacroDlg()

Constructors.

~CEditMacroDlg()

Destructor.

wxBitmap GetBitmapResource(const wxString &name)

Retrieves bitmap resources.

void Init()

Initialises member variables.

CConstRef< objects::CSeq_submit > m_SeqSubmit

void LoadAutofix_GB(wxCommandEvent &event)

bool Create(wxWindow *parent, wxWindowID id=ID_CEDITMACRODLG, const wxString &caption=_("Run Macro"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)

Creation.

void OnRunClick(wxCommandEvent &event)

wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON

void LoadOtherMacros(wxCommandEvent &event)

void LoadAutofix_TSA(wxCommandEvent &event)

void OpenSynonymFile(wxCommandEvent &event)

void UpdateMacroWithSynFile(wxCommandEvent &event)

void OnListItemSelected(wxCommandEvent &event)

objects::CSeq_entry_Handle m_TopSeqEntry

void OnPrintClick(wxCommandEvent &event)

static wxString GetDialogFilter(EFileType fileType)

The following asn-selectors are defined to be used in the FOR EACH statement:

implements special composite command, which does not call to its internal commands when run the very ...

void SetException(const string &message, const CException &error)

Class for parsed macro representation.

CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:

virtual void Execute(IEditCommand *command, wxWindow *window=0)=0

static bool s_ReplaceInPlaceBetweenQuotes(string &str, const string &search, const string &replace)

std::ofstream out("events_result.xml")

main entry point for tests

static const char * str(char *buf, int n)

#define ERR_POST(message)

Error posting with file, line number information but without error codes.

#define LOG_POST(message)

This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...

string ReportAll(TDiagPostFlags flags=eDPF_Exception) const

Report all exceptions.

void Info(CExceptionArgs_Base &args)

bool GetStatus() const

Get status of most recent command.

bool StoreSynonymList(const string &filename)

Function builds a map of words and their corresponding synonyms.

bool Exec(const CMacroRep &macro_rep, const CMacroBioData &data, CRef< CMacroCmdComposite > CmdComposite, bool throw_on_error=false, CNcbiOstream *ostream=nullptr)

Execute a macro.

const string & GetName() const

Return macro name.

const string & GetParsingErrorMessage() const

Get error message in case previous command was unsuccessful.

const CMacroStat & GetStatistics() const

Gets the most recently executed macro statistics.

bool AreThereGUIResolvableVars() const

Return true if there are any GUI variables.

CMacroRep * GetMacroRep(const string &macro_name) const

Function gets the macro representation to let the gui resolve "ask" and "choice" variables.

CMacroRep * Parse(const string &macro_text)

Parse the macro script into its binary representation.

bool GetParsingStatus() const

Get status of most recent command.

static CMacroLib & GetInstance()

const CMacroLog & GetMacroReport() const

void GetMacroNames(vector< string > &macro_names) const

Function builds a list of macro names in the library to use for example in the toolbar.

const string & GetErrorMessage() const

Get error message in case previous command was unsuccessful.

vector< string > GetSynonymFilenames(const vector< CRef< CMacroRep >> &macro_list) const

Extracts synonym files present in the list of macros.

bool Exec(const CMacroRep &macro_rep, const CMacroBioData &data, CRef< CMacroCmdComposite > CmdComposite, bool throw_on_error=false, CNcbiOstream *ostream=nullptr)

Executes a macro.

const string & GetSource() const

CMacroRep * Parse(const string &macro_text)

Parses macro script into its binary representation.

EDialogReturnValue NcbiInfoBox(const string &message, const string &title="Info")

specialized Message Box function for reporting general information messages

void NcbiWarningBox(const string &message, const string &title="Warning")

specialized Message Box function for reporting non-critical errors

EDialogReturnValue NcbiMessageBox(const string &message, TDialogType type=eDialog_Ok, EDialogIcon icon=eIcon_Exclamation, const string &title="Error", EDialogTextMode text_mode=eRaw)

TObjectType * GetPointerOrNull(void) THROWS_NONE

Get pointer value.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

IO_PREFIX::ofstream CNcbiOfstream

Portable alias for ofstream.

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 bool IsBlank(const CTempString str, SIZE_TYPE pos=0)

Check if a string is blank (has no text).

EDialogReturnValue

enumerated return values for dialog boxes, starting from 1 to undermine attempts to cast it "bool"

Lightweight interface for getting lines of data with minimal memory copying.

Macro library for storing parsed macros.

const struct ncbi::grid::netcache::search::fields::SIZE size

static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)

wxString GetAbsolutePath(const wxString &localpath)

wxString ToWxString(const string &s)

string ToStdString(const wxString &s)


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