49 #include "wx/wxprec.h"
59 #include "wx/imaglist.h"
60 #include <wx/artprov.h>
61 #include <wx/evtloop.h>
62 #include <wx/wfstream.h>
63 #include <wx/stdpaths.h>
64 #include <wx/display.h>
65 #include <wx/txtstrm.h>
66 #include <wx/bmpbuttn.h>
207 : m_standalone(
true), m_HideLibrary(
false), m_width(-1), m_height(-1), m_pos_x(-1), m_pos_y(-1),
208 m_width_add_macro(-1), m_height_add_macro(-1), m_pos_x_add_macro(-1), m_pos_y_add_macro(-1)
214 Create( parent,
id, caption, pos,
size, style );
220 wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize&
size,
long style )
221 : m_gui_core_helper(gui_core_helper), m_standalone(
false), m_HideLibrary(
false), m_width(-1), m_height(-1), m_pos_x(-1), m_pos_y(-1),
222 m_width_add_macro(-1), m_height_add_macro(-1), m_pos_x_add_macro(-1), m_pos_y_add_macro(-1)
228 Create( parent,
id, caption, pos,
size, style );
236 wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize&
size,
long style )
254 wxFrame::Create( parent,
id, caption, pos,
size, style );
261 wxSize sz = GetSize();
338 if( !path.IsEmpty() )
354 if( !wxFileName::FileExists( path ) )
392 for (
auto i = 0;
i < wxDisplay::GetCount();
i++)
394 wxDisplay display(
i);
395 max_x += display.GetGeometry().GetWidth();
397 if (
m_pos_x + width > max_x)
m_pos_x = wxGetDisplaySize().GetWidth()-width-5;
398 if (
m_pos_y + height > wxGetDisplaySize().GetHeight())
m_pos_y = wxGetDisplaySize().GetHeight()-height-5;
439 wxMenuBar* menuBar =
new wxMenuBar;
440 wxMenu* itemMenu3 =
new wxMenu;
441 itemMenu3->Append(
ID_MACROFLOW_NEW,
_(
"New Script\tCtrl+N"), wxEmptyString, wxITEM_NORMAL);
442 itemMenu3->Append(
ID_MACROFLOW_OPEN,
_(
"Open Script...\tCtrl+O"), wxEmptyString, wxITEM_NORMAL);
443 itemMenu3->Append(
ID_MACROFLOW_SAVE,
_(
"Save Script\tCtrl+S"), wxEmptyString, wxITEM_NORMAL);
452 itemMenu3->AppendSeparator();
454 wxMenu* autofix_menu =
new wxMenu;
455 itemMenu3->AppendSubMenu(autofix_menu,
"Save Autofix Scripts");
459 autofix_menu->Append(
ID_MACROFLOW_SAVESYN,
_(
"Default substitution file (\"synonyms.txt\")"), wxEmptyString, wxITEM_NORMAL);
460 itemMenu3->AppendSeparator();
462 itemMenu3->Append(
ID_IMPORT_MENU,
_(
"Import Library..."), wxEmptyString, wxITEM_NORMAL);
463 itemMenu3->Append(
ID_EXPORT_MENU,
_(
"Export Library..."), wxEmptyString, wxITEM_NORMAL);
464 itemMenu3->Append(
ID_SET_LIB_MENU,
_(
"Set Default Library..."), wxEmptyString, wxITEM_NORMAL);
465 itemMenu3->Append(
ID_EDIT_LIB_MENU,
_(
"Edit Library"), wxEmptyString, wxITEM_NORMAL);
466 itemMenu3->Append(wxID_EXIT,
_(
"Exit\tCtrl+Q"), wxEmptyString, wxITEM_NORMAL);
467 menuBar->Append(itemMenu3,
_(
"File"));
469 wxMenu* itemMenu8 =
new wxMenu;
470 itemMenu8->Append(
ID_MACROFLOW_CUT,
_(
"Cut\tCtrl+X"), wxEmptyString, wxITEM_NORMAL);
471 itemMenu8->Append(
ID_MACROFLOW_COPY,
_(
"Copy\tCtrl+C"), wxEmptyString, wxITEM_NORMAL);
475 itemMenu8->Append(
ID_MACROFLOW_APPEND,
_(
"Add To Library\tAlt+A"), wxEmptyString, wxITEM_NORMAL);
476 itemMenu8->Append(
ID_MACROFLOW_ADD,
_(
"Add New Macro..."), wxEmptyString, wxITEM_NORMAL);
480 menuBar->Append(itemMenu8,
_(
"Edit"));
481 wxMenu* itemMenu16 =
new wxMenu;
483 itemMenu16->Append(
ID_MACROFLOW_STOP,
_(
"Stop script\tF1"), wxEmptyString, wxITEM_NORMAL);
484 itemMenu16->Append(
ID_SKIP_STEP,
_(
"Enable/Disable Step\tF3"), wxEmptyString, wxITEM_NORMAL);
487 itemMenu16->Append(
ID_MACROFLOW_UNDO,
_(
"Revert data edits\tCtrl+Z"), wxEmptyString, wxITEM_NORMAL);
489 menuBar->Append(itemMenu16,
_(
"Run"));
494 wxArtProvider::Push(provider);
506 wxPanel* itemFrame1 =
new wxPanel(
this,
wxID_ANY);
507 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
508 itemFrame1->SetSizer(itemBoxSizer2);
513 wxStaticText* itemStaticText22 =
new wxStaticText(
m_toolbar, wxID_STATIC,
_(
"Input File(s): "), wxDefaultPosition, wxDefaultSize, 0 );
519 wxBitmap itemtool20Bitmap(wxArtProvider::GetBitmap(
wxT(
"menu::file_open"), wxART_TOOLBAR, wxSize(16,16)));
520 wxBitmap itemtool20BitmapDisabled;
521 m_toolbar->AddTool(
ID_FILECTRL,
_(
"File"), itemtool20Bitmap, itemtool20BitmapDisabled, wxITEM_NORMAL,
_(
"Input ASN.1 files"), wxEmptyString);
524 wxStaticText* itemStaticText24 =
new wxStaticText(
m_toolbar, wxID_STATIC,
_(
"Output Dir: "), wxDefaultPosition, wxDefaultSize, 0 );
537 wxBitmap itemtool21Bitmap(wxArtProvider::GetBitmap(
wxT(
"menu::search"), wxART_TOOLBAR, wxSize(16,16)));
538 wxBitmap itemtool21BitmapDisabled;
539 m_toolbar->AddTool(
ID_MACROFLOW_FIND,
_(
"Search"), itemtool21Bitmap, itemtool21BitmapDisabled, wxITEM_NORMAL,
_(
"Search for macro in the current script and the library"), wxEmptyString);
542 m_PlusBitmap = wxArtProvider::GetBitmap(
wxT(
"menu::plus"), wxART_TOOLBAR, wxSize(16,16));
543 wxBitmap itemtool22BitmapDisabled;
547 wxBitmap itemtool25Bitmap(wxArtProvider::GetBitmap(
wxT(
"menu::dm_undo"), wxART_TOOLBAR, wxSize(16,16)));
548 wxBitmap itemtool25BitmapDisabled;
549 m_toolbar->AddTool(
ID_MACROFLOW_UNDO,
_(
"Revert data edits"), itemtool25Bitmap, itemtool25BitmapDisabled, wxITEM_NORMAL,
_(
"Revert data edits"), wxEmptyString);
552 wxBitmap itemtool23Bitmap(wxArtProvider::GetBitmap(
wxT(
"menu::dm_start"), wxART_TOOLBAR, wxSize(16,16)));
553 wxBitmap itemtool23BitmapDisabled;
555 wxBitmap itemtool24Bitmap(wxArtProvider::GetBitmap(
wxT(
"menu::dm_stop"), wxART_TOOLBAR, wxSize(16,16)));
556 wxBitmap itemtool24BitmapDisabled;
557 m_toolbar->AddTool(
ID_MACROFLOW_STOP,
_(
"Stop"), itemtool24Bitmap, itemtool24BitmapDisabled, wxITEM_NORMAL,
_(
"Stop script"), wxEmptyString);
559 m_LockBitmap = wxArtProvider::GetBitmap(
wxT(
"menu::lock"), wxART_TOOLBAR, wxSize(16,16));
560 m_UnlockBitmap = wxArtProvider::GetBitmap(
wxT(
"menu::unlock"), wxART_TOOLBAR, wxSize(16,16));
561 wxBitmap itemtool25BitmapDisabled;
566 wxStaticText* syn_text =
new wxStaticText(
m_toolbar, wxID_STATIC,
_(
"Substitution File:"), wxDefaultPosition, wxDefaultSize, 0);
572 wxBitmap synBitmap(wxArtProvider::GetBitmap(
wxT(
"menu::file_open"), wxART_TOOLBAR, wxSize(16, 16)));
573 wxBitmap synBitmapDisabled;
581 reportsynfile->SetToolTip(
"Lookup existing word substitution files in the script");
586 wxBoxSizer* syn_sizer =
new wxBoxSizer(wxHORIZONTAL);
587 itemBoxSizer2->Add(syn_sizer, 0, wxGROW | wxALL, 0);
589 wxStaticText* syn_text =
new wxStaticText(itemFrame1, wxID_STATIC,
_(
"Substitution File:"), wxDefaultPosition, wxDefaultSize, 0);
590 syn_sizer->Add(syn_text, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
592 m_SynFileCtrl =
new wxTextCtrl(itemFrame1,
wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, -1));
593 syn_sizer->Add(
m_SynFileCtrl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
595 wxButton* syn_btn =
new wxBitmapButton(itemFrame1,
ID_MACROFLOW_OPENSYNFILE, wxArtProvider::GetBitmap(
wxT(
"menu::file_open")), wxDefaultPosition, wxDefaultSize);
596 syn_btn->SetToolTip(
wxT(
"Choose a word substitution file..."));
597 syn_sizer->Add(syn_btn, 0, wxALIGN_CENTER_VERTICAL | wxTOP|wxBOTTOM, 3);
599 wxButton* updatesynfile =
new wxButton(itemFrame1,
ID_MACROFLOW_UPDATESYNFILE,
_(
"Update Script"), wxDefaultPosition, wxDefaultSize, 0);
600 syn_sizer->Add(updatesynfile, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
602 wxButton* reportsynfile =
new wxButton(itemFrame1,
ID_MACROFLOW_REPORTSYNFILE,
_(
"Report Status"), wxDefaultPosition, wxDefaultSize, 0);
603 reportsynfile->SetToolTip(
"Lookup existing word substitution files in the script");
604 syn_sizer->Add(reportsynfile, 0, wxALIGN_CENTER_VERTICAL | wxTOP|wxBOTTOM, 5);
614 wxStatusBar* statusbar = CreateStatusBar();
615 SetStatusBar(statusbar);
617 wxBoxSizer* itemBoxSizer25 =
new wxBoxSizer(wxHORIZONTAL);
618 itemBoxSizer2->Add(itemBoxSizer25, 1, wxGROW|wxALL, 0);
624 wxBoxSizer* itemBoxSizer27 =
new wxBoxSizer(wxVERTICAL);
627 wxStaticText* itemStaticText1 =
new wxStaticText(
m_CollapsibleWindow, wxID_STATIC,
_(
"Library"), wxDefaultPosition, wxDefaultSize, 0 );
628 itemBoxSizer27->Add(itemStaticText1, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
631 itemBoxSizer27->Add(
m_TreeCtrl, 1, wxGROW|wxALL, 5);
634 m_Notebook =
new wxAuiNotebook( itemFrame1,
ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxAUI_NB_DEFAULT_STYLE );
635 itemBoxSizer25->Add(
m_Notebook, 1, wxGROW|wxALL, 5);
637 wxBoxSizer* itemBoxSizer66 =
new wxBoxSizer(wxHORIZONTAL);
638 itemBoxSizer2->Add(itemBoxSizer66, 0, wxGROW|wxALL, 5);
640 m_Progress =
new wxGauge( itemFrame1,
wxID_ANY, 100, wxDefaultPosition, wxSize(-1, 5), wxGA_HORIZONTAL);
642 itemBoxSizer66->Add(
m_Progress, 1, wxALIGN_BOTTOM|wxALL, 0);
648 wxString script = wxTheApp->argv[0];
649 wxString dir = wxTheApp->argv[1];
650 if (!script.IsEmpty()) {
657 if (!dir.IsEmpty()) {
673 itemBoxSizer2->SetSizeHints(itemFrame1);
680 if (library.IsEmpty())
683 const string doc_dir(stdp.GetDocumentsDir().ToUTF8());
689 LOG_POST(
Error <<
"Cannot create directory '" << macro_dir <<
"'");
693 string name =
"default_library";
697 while (
file.Exists()) {
699 str << name <<
" (" <<
i <<
")" <<
".mql";
706 if (orig_file.
Copy(macro_file)) {
718 wxFileName filename(*path_it);
719 wxMenuItem *script_item =
new wxMenuItem(
m_recent_submenu,
wxID_ANY, filename.GetFullName(), wxEmptyString, wxITEM_NORMAL);
767 wxString title =
_(
"New script ");
781 wxFileDialog
file(
this,
wxT(
"Load macro script"),
m_DefaultDir, wxEmptyString,
_(
"All files (*.*)|*.*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
782 if (
file.ShowModal() != wxID_OK)
784 wxString path =
file.GetPath();
794 wxFileName filename(path);
795 if (recent_scripts) {
798 if (!filename.FileExists() && !allow_empty) {
804 if (recent_scripts) {
814 macro::CMacroEngine engine;
815 vector<CRef<macro::CMacroRep>> macro_list;
816 bool status = engine.ReadAndParseMacros(path.ToStdString(), macro_list);
820 if (!allow_empty && macro_list.empty()) {
827 m_Notebook->AddPage(page, filename.GetFullName(),
true);
832 size_t total = macro_list.size();
836 size_t step = total / 100;
840 for (
auto &p : macro_list) {
843 Pulse(
static_cast<int>(100 *
i / total));
862 int id =
event.GetId();
882 const vector<pair<CRef<macro::CMacroRep>,
bool> >& script = page->
GetScript();
886 wxFileDialog
file(
this,
wxT(
"Save macro script"),
m_DefaultDir,
m_Notebook->GetPageText(page_num),
_(
"All files (*.*)|*.*"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
887 if (
file.ShowModal() != wxID_OK)
890 wxString path =
file.GetPath();
894 wxFileName filename(path);
901 m_Notebook->SetPageText(page_num, filename.GetFullName());
916 const vector<pair<CRef<macro::CMacroRep>,
bool> >& script = page->
GetScript();
928 "<std>/etc/macro_scripts/autofix_gb.mql",
929 "<std>/etc/macro_scripts/autofix_wgs.mql",
930 "<std>/etc/macro_scripts/autofix_tsa.mql",
931 "<std>/etc/synonyms.txt",
939 switch (event.GetId())
943 title =
"Save Autofix GenBank macro";
947 title =
"Save Autofix WGS macro";
951 title =
"Save Autofix TSA macro";
955 title =
"Save Default Synonym File";
967 if (!in_path.IsEmpty()) {
968 filename =
string(in_path.ToUTF8());
977 wxFileDialog save_dlg(
this,
ToWxString(title),
978 m_DefaultDir, wxEmptyString,
_(
"TXT files (*.txt)|*.txt|All files (*.*)|*.*"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
980 if (save_dlg.ShowModal() == wxID_OK) {
981 wxString out_path = save_dlg.GetPath();
982 if (!out_path.IsEmpty()) {
986 if (in_str.good() && out_str.good()) {
994 catch (
const exception& e) {
1011 wxFileDialog file_dlg(
this,
_(
"Select Word Substitution File"), wxEmptyString, wxEmptyString,
_(
"All files (*.*)|*.*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
1012 if (file_dlg.ShowModal() == wxID_OK) {
1021 bool modified =
false;
1024 while (pos != string::npos) {
1025 size_t right_end = pos + search.length();
1026 if (pos > 0 &&
str.c_str()[pos - 1] ==
'"' &&
str.data()[right_end] ==
'"') {
1027 string this_replace = replace;
1028 str =
str.substr(0, pos) + this_replace +
str.substr(right_end);
1029 right_end = pos + this_replace.length();
1049 if (new_syn_file.empty()) {
1054 macro::CMacroEngine macro_engine;
1055 vector<string> syn_files = macro_engine.GetSynonymFilenames(script);
1057 if (syn_files.empty()) {
1058 NcbiInfoBox(
"No word substitution file is found in the script");
1063 if (syn_files.size() > 1) {
1064 string msg =
"Multiple word substitution files are found:";
1065 for (
const auto& it : syn_files) {
1068 msg +=
"\nWould you like to replace all of them?";
1074 else if (ret ==
eYes) {
1075 for (
const auto& syn_it : syn_files) {
1076 for (
auto& it : script) {
1077 string macro_str = it->GetSource();
1079 it->SetSource(macro_str);
1086 NcbiInfoBox(
"Word substitution file instances were successfully replaced");
1089 NcbiErrorBox(
"Failed to update the word substitution filenames");
1102 if (syn_file.empty()) {
1125 macro::CMacroEngine macro_engine;
1126 vector<string> syn_files = macro_engine.GetSynonymFilenames(script);
1127 if (syn_files.empty()) {
1128 NcbiInfoBox(
"No word substitution file is found in the script");
1132 if (syn_files.size() > 1) {
1133 msg =
"Multiple word substitution files are found:";
1134 for (
const auto& it : syn_files) {
1139 msg =
"One word substitution file is found:\n";
1140 msg += syn_files.front();
1144 report->SetTitle(
wxT(
"Report existing word substitutions files"));
1154 wxWindow* win =
m_Notebook->GetCurrentPage();
1167 const vector<pair<CRef<macro::CMacroRep>,
bool> >& script = page->
GetScript();
1171 wxFileDialog
file(
this,
wxT(
"Export script steps"),
m_DefaultDir, wxEmptyString,
_(
"Text files (*.txt)|*.txt"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
1172 if (
file.ShowModal() != wxID_OK)
1175 wxString path =
file.GetPath();
1179 wxFileName filename(path);
1182 wxFFileOutputStream
output( path );
1183 wxTextOutputStream text_out(
output );
1184 size_t total = script.size();
1185 for (
size_t i = 0;
i < total;
i++)
1189 text_out << step <<
". ";
1190 text_out << script[
i].first->GetTitle() << endl;
1192 Pulse(
static_cast<int>(100 *
i / total));
1200 wxWindow *win =
m_Notebook->GetCurrentPage();
1208 const vector<pair<CRef<macro::CMacroRep>,
bool> >& script = page->
GetScript();
1212 wxString path = page->
GetPath();
1225 size_t total = script.size();
1226 for (
auto& it : script)
1228 os << it.first->GetSource();
1230 Pulse(
static_cast<int>(100 *
i / total));
1243 wxWindow *win =
m_Notebook->GetCurrentPage();
1249 const vector<pair<CRef<macro::CMacroRep>,
bool> >& script = page->
GetScript();
1257 event.Enable(
false);
1275 bool modified =
false;
1288 if ( event.CanVeto() && modified)
1290 if ( wxMessageBox(
"You have unsaved modified scripts, continue closing?",
"Please confirm", wxICON_QUESTION | wxYES_NO) != wxYES )
1301 int sel =
event.GetSelection();
1302 if (sel == wxNOT_FOUND)
1312 bool modified =
false;
1319 if ( wxMessageBox(
"The script has been modified, continue closing?",
"Please confirm", wxICON_QUESTION | wxYES_NO) != wxYES )
1329 SetStatusText(wxEmptyString);
1335 int sel =
event.GetOldSelection();
1336 if (sel == wxNOT_FOUND)
1348 int sel =
event.GetSelection();
1349 if (sel == wxNOT_FOUND)
1356 wxString path = page->
GetPath();
1357 SetStatusText(path);
1365 wxWindow *win =
m_Notebook->GetCurrentPage();
1380 wxWindow *win =
m_Notebook->GetCurrentPage();
1390 for (
auto &
label : labels)
1409 wxWindow *win =
m_Notebook->GetCurrentPage();
1419 event.Enable(
false);
1429 wxWindow *win =
m_Notebook->GetCurrentPage();
1438 for (
auto &
label : labels)
1458 wxWindow *win =
m_Notebook->GetCurrentPage();
1465 vector<CMacroLabel*> added;
1466 if (!labels.
empty())
1473 added.push_back(add);
1482 added.push_back(add);
1486 for (
size_t i = 0;
i < added.size();
i++)
1499 macros += it->GetSource();
1502 if (!macros.empty()) macros.pop_back();
1510 wxWindow *win =
m_Notebook->GetCurrentPage();
1520 event.Enable(
false);
1529 wxWindow *win =
m_Notebook->GetCurrentPage();
1543 wxWindow *win =
m_Notebook->GetCurrentPage();
1551 if (labels.
size() != 1)
1558 if (index < page->GetCount()) {
1565 if (
label->IsSkipped() && add) {
1574 wxWindow *win =
m_Notebook->GetCurrentPage();
1582 if (labels.
size() == 1) {
1588 event.Enable(
false);
1593 wxWindow *win =
m_Notebook->GetCurrentPage();
1608 existing.
insert(it.second->GetSource());
1614 size_t total = labels.
size();
1615 for (
auto &
label : labels)
1617 string source =
label.second->GetMacro()->GetSource();
1623 Pulse(
static_cast<int>(100 *
i / total));
1639 wxWindow *win =
m_Notebook->GetCurrentPage();
1650 wxWindow *win =
m_Notebook->GetCurrentPage();
1661 wxWindow *win =
m_Notebook->GetCurrentPage();
1669 if (labels.
size() != 1)
1677 if (dlg.ShowModal() != wxID_OK) {
1689 wxWindow *win =
m_Notebook->GetCurrentPage();
1697 if (labels.
size() == 1) {
1703 event.Enable(
false);
1739 NcbiWarningBox(
"Macro cannot be opened in the editor: " + e.
GetMsg() +
". Please modify it manually.");
1746 wxWindow* win =
m_Notebook->GetCurrentPage();
1758 if (!filename.empty())
1761 wxWindow* win =
m_Notebook->GetCurrentPage();
1766 if (!orig_file.empty()) {
1789 wxWindow *win =
m_Notebook->GetCurrentPage();
1796 if (scroll_to_end) {
1808 wxWindow *win =
m_Notebook->GetCurrentPage();
1818 event.Enable(
false);
1827 wxWindow *win =
m_Notebook->GetCurrentPage();
1834 const vector<pair<CRef<macro::CMacroRep>,
bool> >& script = page->
GetScript();
1849 bool aborted =
false;
1851 wxString last_out_file;
1852 for (
size_t i = 0;
i < num_files;
i++)
1855 if( !wxFileName::FileExists( path ) )
1858 unique_ptr<CNcbiIstream> InputStream(
new CNcbiIfstream (path.fn_str(), ios::binary));
1864 unique_ptr<CObjectIStream>
in;
1866 InputStream.release();
1869 scope->AddDefaults();
1872 wxFileName in_file(path);
1873 out_file.SetFullName(in_file.GetFullName());
1875 if (out_file == in_file && !shown)
1877 wxMessageBox(
wxT(
"Output file cannot be the same as input file"),
wxT(
"Warning"), wxOK | wxICON_WARNING);
1881 last_out_file = out_file.GetFullPath();
1882 string header =
in->ReadFileHeader();
1887 if (
"Seq-submit" == header )
1892 if (!ss->GetData().IsEntrys())
1894 size_t num_entries = ss->GetData().GetEntrys().size();
1895 NON_CONST_ITERATE(objects::CSeq_submit::TData::TEntrys, se_it, ss->SetData().SetEntrys())
1897 objects::CSeq_entry_Handle seh = scope->AddTopLevelSeqEntry(**se_it);
1898 RunScript(script, page,
log, num_files, num_entries, seh, ss);
1900 out->Write(ss, ss->GetThisTypeInfo());
1902 else if (
"Seq-entry" == header )
1905 objects::CSeq_entry_Handle seh = scope->AddTopLevelSeqEntry(*se);
1907 out->Write(se, se->GetThisTypeInfo());
1909 else if (
"Bioseq-set" == header )
1911 objects::CBioseq_set& bioseqset = se->SetSet();
1913 objects::CSeq_entry_Handle seh = scope->AddTopLevelSeqEntry(*se);
1915 out->Write(&bioseqset, bioseqset.GetThisTypeInfo());
1917 else if (
"Bioseq" == header )
1919 objects::CBioseq& bioseq = se->SetSeq();
1921 objects::CSeq_entry_Handle seh = scope->AddTopLevelSeqEntry(*se);
1923 out->Write(&bioseq, bioseq.GetThisTypeInfo());
1929 wxRemoveFile(out_file.GetFullPath());
1931 wxMessageBox(
wxT(
"Running script has been aborted"),
wxT(
"Warning"), wxOK | wxICON_WARNING);
1944 report->SetTitle(
wxT(
"Macro Script Report"));
1951 wxMessageBox(
wxT(
"No changes"),
wxT(
"Information"), wxOK | wxICON_INFORMATION);
1964 if (!tse || !cmdProcessor)
1968 bool aborted =
false;
1982 wxMessageBox(
wxT(
"Running script has been aborted"),
wxT(
"Warning"), wxOK | wxICON_WARNING);
2016 report->SetTitle(
wxT(
"Macro Script Report"));
2021 else if (!aborted && status)
2023 wxMessageBox(
wxT(
"No changes"),
wxT(
"Information"), wxOK | wxICON_INFORMATION);
2041 event.Enable(enable);
2051 size_t total = script.size();
2053 double interval = 100. / num_files;
2054 interval /= num_entries;
2057 bool lookup_synfile =
true;
2058 macro::CMacroEngine macroEngine(
false, lookup_synfile);
2060 for (
auto macro = script.begin(); macro != script.end() && status; ++macro)
2068 macro::CMacroBioData bioData(seh, submit);
2071 macroEngine.Exec(*macroRep, bioData, macro_cmd,
true);
2087 string msg =
"Execution of the macro has failed at '" + macroRep->GetTitle() +
"' step:";
2091 errorDlg.ShowModal();
2095 const auto& macro_stat = macroEngine.GetStatistics();
2096 size_t counter = macro_stat.GetCounter();
2099 const auto& report = macro_stat.GetMacroReport();
2101 if (!report.GetLog().empty()) {
2102 log << report.GetName() <<
":\n" << report.GetLog();
2105 const auto& logs = macro_stat.GetFunctionsLog();
2106 if (!logs.empty()) {
2107 log << report.GetName() <<
":\n";
2109 for (
const auto& it : logs) {
2110 log << it->Print() <<
"\n";
2114 if (!report.GetErrorLog().empty()) {
2115 log <<
"\nERRORS:\n" << report.GetErrorLog();
2118 const auto& unmatched_entries = macro_stat.GetUnmatchedTableEntries();
2119 if (!unmatched_entries.empty()) {
2120 log <<
"\nUnmatched entries:\n";
2121 log << unmatched_entries.front().first;
2125 if (
cmd && macro_cmd)
2126 cmd->AddCommand(*macro_cmd);
2142 wxWindow *win =
m_Notebook->GetCurrentPage();
2148 const vector<pair<CRef<macro::CMacroRep>,
bool> >& script = page->
GetScript();
2164 event.Enable(
false);
2170 if (wxTheApp && wxTheApp->GetMainLoop())
2172 if (wxUpdateUIEvent::CanUpdate(
m_toolbar))
2173 m_toolbar->UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
2174 if (!wxTheApp->GetMainLoop()->IsYielding())
2175 wxTheApp->Yield(
true);
2176 wxTheApp->ProcessPendingEvents();
2213 wxEmptyString,
_(
"All files (*.*)|*.*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);
2214 if (
file.ShowModal() != wxID_OK)
2222 wxFileName filename(path);
2236 if (
m_Search->GetValue().IsEmpty())
2241 string pattern =
m_Search->GetValue().ToStdString();
2247 if (pattern.empty())
2252 wxWindow *win =
m_Notebook->GetCurrentPage();
2259 const vector<pair<CRef<macro::CMacroRep>,
bool> >& script = page->
GetScript();
2261 for (
auto &it : script)
2263 const string &
value = it.first->GetTitle();
2300 wxMessageBox(
wxT(
"No more matches found, wrapping over"),
wxT(
"Information"), wxOK | wxICON_INFORMATION);
2302 wxMessageBox(
wxT(
"No match found"),
wxT(
"Information"), wxOK | wxICON_INFORMATION);
2312 bool script_avail =
false;
2313 wxWindow *win =
m_Notebook->GetCurrentPage();
2319 script_avail =
true;
2325 event.Enable(lib_avail || script_avail);
2339 wxWindow *win =
m_Notebook->GetCurrentPage();
2347 wxTreeItemId
id =
event.GetItem();
2363 wxWindow *win =
m_Notebook->GetCurrentPage();
2370 wxTreeItemId
id =
event.GetItem();
2376 wxPoint pos =
m_TreeCtrl->ScreenToClient(wxGetMousePosition());
2379 if (pos.x > w - 20 && pos.y > 0 && pos.y < h) {
2393 wxWindow *win =
m_Notebook->GetCurrentPage();
2406 wxPoint pos =
m_TreeCtrl->ScreenToClient(wxGetMousePosition());
2409 if (pos.x > w - 20 && pos.y > 0 && pos.y < h)
2433 wxWindow *win =
m_Notebook->GetCurrentPage();
2439 wxTreeItemId
id =
m_TreeCtrl->GetFocusedItem();
2451 wxWindow *win =
m_Notebook->GetCurrentPage();
2457 wxTreeItemId
id =
m_TreeCtrl->GetFocusedItem();
2466 event.Enable(
false);
2474 wxWindow *win =
m_Notebook->GetCurrentPage();
2494 wxWindow *win =
m_Notebook->GetCurrentPage();
2503 if (labels.
size() != 1)
2507 label->UpdateMacro(macro_rep);
2519 wxFileDialog
file(
this,
wxT(
"Import Macro Library"),
m_DefaultDir, wxEmptyString,
_(
"All files (*.*)|*.*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
2520 if (
file.ShowModal() != wxID_OK)
2523 wxString path =
file.GetPath();
2524 wxFileName filename(path);
2538 macro::CMacroEngine engine;
2539 vector<CRef<macro::CMacroRep>> macro_list;
2540 bool status = engine.ReadAndParseMacros(path.ToStdString(), macro_list);
2542 if (!status || macro_list.empty())
2545 wxMessageBox(
wxT(
"Error importing macro library"),
wxT(
"Error"), wxOK | wxICON_ERROR);
2550 for (
auto &p : macro_list)
2552 string target = p->GetForEachString();
2553 string title = p->GetTitle();
2554 string action,
dummy;
2561 wxTreeItemId root =
m_TreeCtrl->AddRoot(wxEmptyString);
2562 for (
auto &
t : for_type_macro)
2564 string target =
t.second.begin()->second.begin()->second.front()->GetForEachString();
2565 wxTreeItemId parent =
m_TreeCtrl->AppendItem(root,wxString(target));
2567 m_TreeCtrl->SetItemBackgroundColour(parent, bg);
2568 for (
auto &
a :
t.second)
2570 string title =
a.second.begin()->second.front()->GetTitle();
2571 string action,
dummy;
2573 wxTreeItemId second =
m_TreeCtrl->AppendItem(parent, wxString(action));
2574 m_TreeCtrl->SetItemBackgroundColour(second, bg);
2575 for (
auto &m :
a.second)
2577 for (
auto &
n : m.second)
2579 wxTreeItemId
id =
m_TreeCtrl->AppendItem(second, wxString(
n->GetTitle()));
2600 wxEmptyString,
_(
"All files (*.*)|*.*"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
2601 if (
file.ShowModal() != wxID_OK)
2604 wxString path =
file.GetPath();
2607 wxFileName filename(path);
2615 os << it.second->GetSource();
2617 Pulse(
static_cast<int>(100 *
i / total));
2632 if (library.IsEmpty())
2644 wxTreeItemId
id =
m_TreeCtrl->GetFocusedItem();
2651 wxMessageDialog msgBox(
this,
wxT(
"Delete from library?"),
wxT(
"Delete"), wxYES_NO | wxICON_NONE);
2652 int result = msgBox.ShowModal();
2664 os << it.second->GetSource();
2666 Pulse(
static_cast<int>(100 *
i / total));
2682 wxTreeItemId
id =
m_TreeCtrl->GetFocusedItem();
2706 wxTreeItemIdValue cookie;
2707 wxTreeItemId child =
m_TreeCtrl->GetFirstChild(
id, cookie);
2708 while (child.IsOk())
2715 child =
m_TreeCtrl->GetNextChild(
id, cookie);
2721 wxMessageDialog msgBox(
this,
wxT(
"Library has been modified, reload?"),
wxT(
"Library modified"), wxYES_NO | wxICON_NONE);
2722 int result = msgBox.ShowModal();
2723 if (
result == wxID_YES) {
2736 if (
id.IsOk() &&
m_TreeCtrl->ItemHasChildren(
id)) {
2743 wxTreeItemIdValue cookie;
2744 wxTreeItemId child =
m_TreeCtrl->GetFirstChild(
id, cookie);
2745 while (child.IsOk()) {
2747 child =
m_TreeCtrl->GetNextChild(
id, cookie);
2755 if (
id.IsOk() &&
m_TreeCtrl->ItemHasChildren(
id)) {
2758 if (expanded_nodes.
find(
label) != expanded_nodes.
end())
2763 wxTreeItemIdValue cookie;
2764 wxTreeItemId child =
m_TreeCtrl->GetFirstChild(
id, cookie);
2765 while (child.IsOk()) {
2767 child =
m_TreeCtrl->GetNextChild(
id, cookie);
2778 wxWindow *win =
m_Notebook->GetCurrentPage();
2795 wxWindow *win =
m_Notebook->GetCurrentPage();
2805 event.Enable(
false);
2810 wxMessageDialog msgBox(
this, wxEmptyString,
wxT(
"Set Default Library"), wxYES_NO | wxCANCEL | wxICON_NONE);
2811 msgBox.SetYesNoCancelLabels(
_(
"&Set current library as default"),
_(
"&Reset default library"),
_(
"&Cancel"));
2812 int result = msgBox.ShowModal();
2813 if (
result == wxID_CANCEL)
2842 wxPoint pos = GetPosition();
2843 SetPosition(wxPoint(pos.x + 5, pos.y));
2845 if (wxTheApp && wxTheApp->GetMainLoop()) {
2846 if (!wxTheApp->GetMainLoop()->IsYielding())
2847 wxTheApp->Yield(
true);
2848 wxTheApp->ProcessPendingEvents();
2851 SetPosition(wxPoint(pos.x - 5, pos.y));
2853 if (wxTheApp && wxTheApp->GetMainLoop()) {
2854 if (!wxTheApp->GetMainLoop()->IsYielding())
2855 wxTheApp->Yield(
true);
2856 wxTheApp->ProcessPendingEvents();
2864 bool maximized = IsMaximized();
2869 wxSize sz = GetSize();
2870 if (event.GetCollapsed())
void SetText(const wxString &text)
CRegistryWriteView GetWriteView(const string §ion)
get a read-write view at a particular level.
void Write(CNcbiOstream &ostr, int priority=ePriority_Local) const
Write the local policy to a specified stream.
static CGuiRegistry & GetInstance()
access the application-wide singleton
CRegistryReadView GetReadView(const string §ion) const
get a read-only view at a particular level.
CRef< CRegistryFile > AddSite(CNcbiIstream &istr, int priority)
Add a site-specific repository.
implements special composite command, which does not call to its internal commands when run the very ...
void SetException(const string &message, const CException &error)
void OnLibraryExpandUpdate(wxUpdateUIEvent &event)
void PopulateRecentMenu()
bool Create(wxWindow *parent, wxWindowID id=15000, const wxString &caption=_("Macro Flow Editor"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(1500, 1000), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxCLOSE_BOX)
void OnLibToScript(wxCommandEvent &event)
void OnPageChanging(wxAuiNotebookEvent &event)
void OnEditUpdate(wxUpdateUIEvent &event)
wxEVT_UPDATE_UI event handler for wxID_CUT
vector< CRef< macro::CMacroRep > > m_clipboard
map< wxTreeItemId, CRef< macro::CMacroRep > > m_id_to_macro
void OnOpenClick(wxCommandEvent &event)
wxEVT_COMMAND_MENU_SELECTED event handler for wxID_OPEN
void RunScriptStandalone(const vector< pair< CRef< macro::CMacroRep >, bool > > &script, CScriptPanel *page)
void OnAddUpdate(wxUpdateUIEvent &event)
wxEVT_UPDATE_UI event handler for wxID_ADD
void OnExportMenuClick(wxCommandEvent &event)
wxEVT_COMMAND_MENU_SELECTED event handler for ID_EXPORT_MENU
void OnForwardUpdate(wxUpdateUIEvent &event)
wxEVT_UPDATE_UI event handler for wxID_FORWARD
void OnEditLibrary(wxCommandEvent &event)
wxArrayString m_InputFiles
void OnPageChanged(wxAuiNotebookEvent &event)
void OnStopUpdate(wxUpdateUIEvent &event)
wxEVT_UPDATE_UI event handler for wxID_STOP
CRef< IGuiCoreHelper > m_gui_core_helper
void OnSaveAsClick(wxCommandEvent &event)
wxTextCtrl * m_InputFileText
void OnDeleteClick(wxCommandEvent &event)
wxEVT_COMMAND_MENU_SELECTED event handler for wxID_DELETE
void OnTreectrlItemDrag(wxTreeEvent &event)
wxMenu * m_recent_submenu
void OnDeleteFromLibrary(wxCommandEvent &event)
wxWindow * m_CollapsibleWindow
void OnCutClick(wxCommandEvent &event)
wxEVT_COMMAND_MENU_SELECTED event handler for wxID_CUT
void RemoveEditor(bool scroll_to_end)
void SetPositionAndSize()
void OnEditLibraryUpdate(wxUpdateUIEvent &event)
void OnPasteClick(wxCommandEvent &event)
wxEVT_COMMAND_MENU_SELECTED event handler for wxID_PASTE
void OnPageClose(wxAuiNotebookEvent &event)
void OnTreectrlItemDrop(wxTreeEvent &event)
void OnUpdateSynFileUpdate(wxUpdateUIEvent &event)
void OnExportUpdate(wxUpdateUIEvent &event)
void OnIncreaseFont(wxCommandEvent &event)
void OpenEditor(CRef< macro::CMacroRep > macro_rep)
void OnRecent(wxCommandEvent &event)
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void SetSynonymFile(const string &filename)
void OnSetDefaultLibrary(wxCommandEvent &event)
void OnTreectrlItemActivated(wxTreeEvent &event)
wxEVT_COMMAND_TREE_ITEM_ACTIVATED event handler for ID_TREECTRL
wxAuiNotebook * m_Notebook
void OnDecreaseFont(wxCommandEvent &event)
void OnUndoUpdate(wxUpdateUIEvent &event)
void OnTreectrlMenu(wxTreeEvent &event)
void OnSaveUpdate(wxUpdateUIEvent &event)
wxEVT_UPDATE_UI event handler for wxID_SAVE
void OnDeleteFromLibraryUpdate(wxUpdateUIEvent &event)
void OnLibToScriptUpdate(wxUpdateUIEvent &event)
void OnAddClick(wxCommandEvent &event)
wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ADD
void OpenSynonymFile(wxCommandEvent &event)
vector< wxTreeItemId > m_all_ids
void RunScriptInWidget(const vector< pair< CRef< macro::CMacroRep >, bool > > &script, CScriptPanel *page)
void OnInputFile(wxCommandEvent &event)
wxDirPickerCtrl * m_OutputFolder
void OnCopyClick(wxCommandEvent &event)
wxEVT_COMMAND_MENU_SELECTED event handler for wxID_COPY
wxTextCtrl * m_SynFileCtrl
void Init()
Initialises member variables.
void UpdateCounter(CScriptPanel *page, size_t i, size_t counter)
void OnManualEditMacroUpdate(wxUpdateUIEvent &event)
void OnForwardClick(wxCommandEvent &event)
wxEVT_COMMAND_MENU_SELECTED event handler for wxID_FORWARD
const string GetSynonymFile() const
void OnUpdateSynonymFile(wxCommandEvent &event)
void OnLibExpand(wxCommandEvent &event)
void x_PopulateSynonymFileCtrl()
void OnImportMenuClick(wxCommandEvent &event)
wxEVT_COMMAND_MENU_SELECTED event handler for ID_IMPORT_MENU
void OnDuplicateUpdate(wxUpdateUIEvent &event)
objects::CSeq_entry_Handle m_undo_tse
static CMacroFlowEditor * GetInstance(wxWindow *parent, CRef< IGuiCoreHelper > gui_core_helper, wxWindowID id=15000, const wxString &caption=_("Macro Flow Editor"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(1500, 1000), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxCLOSE_BOX)
virtual void SaveSettings() const
void OnExportStepsClick(wxCommandEvent &event)
map< int, string > m_id_to_path
void SaveScript(const wxString &path, const vector< pair< CRef< macro::CMacroRep >, bool > > &script)
void SaveAddMacroSizeAndPosition(int w, int h, int x, int y)
void GetExpandedNodes(wxTreeItemId id, set< string > &expanded_nodes, string label=kEmptyStr)
void OnDuplicateClick(wxCommandEvent &event)
void AddNewMacro(CRef< macro::CMacroRep > macro_rep)
void CopyDefaultLibrary()
list< string > m_opened_scripts
CMacroEditor * m_MacroEditor
void OpenScript(const wxString &path, bool recent_scripts, bool allow_empty)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
CMacroFlowEditor()
Constructors.
void CreateControls()
Creates the controls and sizers.
void OnCollapsiblePane(wxCollapsiblePaneEvent &event)
static bool ShowToolTips()
Should we show tooltips?
void OnSaveAsUpdate(wxUpdateUIEvent &event)
void OnFindClick(wxCommandEvent &event)
wxEVT_COMMAND_MENU_SELECTED event handler for wxID_FIND
void OnSkipStepUpdate(wxUpdateUIEvent &event)
wxEVT_UPDATE_UI event handler for ID_SKIP_STEP
wxString GetSettingsPath() const
IUndoManager * m_UndoManager
void OnNewClick(wxCommandEvent &event)
@begin CMacroFlowEditor event handler declarations
CScriptPanel::TVecMacroRep TVecMacroRep
CScriptPanel * x_GetCurrentPage() const
void UpdateEditedMacro(CRef< macro::CMacroRep > macro_rep)
void OnLibCollapse(wxCommandEvent &event)
virtual void SetRegistryPath(const string ®_path)
void OnManualEditMacro(wxCommandEvent &event)
void OnPasteUpdate(wxUpdateUIEvent &event)
void OnExitClick(wxCommandEvent &event)
wxEVT_COMMAND_MENU_SELECTED event handler for wxID_EXIT
void OnStopClick(wxCommandEvent &event)
wxEVT_COMMAND_MENU_SELECTED event handler for wxID_STOP
wxCollapsiblePane * m_CollapsiblePanel
virtual void LoadSettings()
void DeleteNode(wxTreeItemId &id)
void OnSaveClick(wxCommandEvent &event)
wxEVT_COMMAND_MENU_SELECTED event handler for wxID_SAVE
void OnClose(wxCloseEvent &event)
~CMacroFlowEditor()
Destructor.
void OnSkipStepClick(wxCommandEvent &event)
wxEVT_COMMAND_MENU_SELECTED event handler for ID_SKIP_STEP
void SetExpandedNodes(wxTreeItemId id, const set< string > &expanded_nodes, string label=kEmptyStr)
void OnReportSynFileStatus(wxCommandEvent &event)
vector< bool > m_clipboard_skipped
bool RunScript(const vector< pair< CRef< macro::CMacroRep >, bool > > &script, CScriptPanel *page, wxString &log, size_t num_files, size_t num_entries, objects::CSeq_entry_Handle seh, CConstRef< objects::CSeq_submit > submit=CConstRef< objects::CSeq_submit >(NULL), CRef< CCmdComposite > cmd=CRef< CCmdComposite >(NULL))
void OnAppendClick(wxCommandEvent &event)
void OnUndo(wxCommandEvent &event)
static CMacroFlowEditor * m_Instance
void OnFindUpdate(wxUpdateUIEvent &event)
wxEVT_UPDATE_UI event handler for wxID_FIND
void OnSaveCopies(wxCommandEvent &event)
void ImportLibrary(const wxString &path, bool report)
void OnLockDrag(wxCommandEvent &event)
static wxColour GetLabelColour(const string &str)
CRef< macro::CMacroRep > GetMacro()
class CRegistryReadView provides a nested hierarchical view at a particular key.
int GetInt(const string &key, int default_val=0) const
access a named key at this level, with no recursion
bool GetBool(const string &key, bool default_val=false) const
string GetString(const string &key, const string &default_val=kEmptyStr) const
void GetStringList(const string &key, list< string > &val) const
void Set(const string &key, int val)
access a named key at this level, with no recursion
void SetPath(const wxString &path)
void SetSynonymFile(const string &filename)
size_t GetIndex(CMacroLabel *label)
void SetModified(bool modified)
void SelectItem(size_t item)
const map< size_t, CMacroLabel * > & GetSelectedMacros()
CMacroLabel * AddMacro(CRef< macro::CMacroRep > macro)
static const string sm_Multiple
const string & GetSynonymFile() const
vector< pair< CRef< macro::CMacroRep >, bool > > GetScript()
bool UpdateMacroSources(const TVecMacroRep &script)
void UpdateCounter(size_t i, size_t counter)
void LookupSynonymFiles()
CMacroLabel * InsertMacro(CRef< macro::CMacroRep > macro, size_t index)
static wxString ResolvePath(const wxString &path, const wxString &rel_name)
Utility function to hide the platform specifics of locating our standard directories and files.
static wxString ResolvePathExisting(const wxString &path, const wxString &delim=wxT(","))
Utility function to hide the platform specifics of locating our standard directories.
CwxSplittingArtProvider - an adapter for old-style image aliases.
Undo/Redo interface for editing operations.
virtual void Execute(IEditCommand *command, wxWindow *window=0)=0
objects::CSeq_entry_Handle GetTopSeqEntry()
CConstRef< objects::CSeq_submit > GetSeqSubmit()
ICommandProccessor * GetCmdProcessor()
virtual bool RequestExclusiveEdit(wxWindow *window, const string &descr)=0
virtual bool ReleaseExclusiveEdit(wxWindow *window)=0
virtual void Undo(wxWindow *window=0)=0
const_iterator begin() const
const_iterator end() const
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
virtual void RegisterFileAlias(const wxArtID &anId, const wxArtClient &aClient, const wxSize &aSize, const wxString &aName, long aType=wxBITMAP_TYPE_ANY, int anIndex=-1)
int AddDirectory(wxString aDirName)
IMPLEMENT_CLASS(CFloatingFrame, CFloatingFrameBaseClass) const static long kFloatFrameStyle
CFloatingFrame.
std::ofstream out("events_result.xml")
main entry point for tests
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static SQLCHAR output[256]
static const char * str(char *buf, int n)
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
@ eTakeOwnership
An object can take ownership of another.
#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)
const string & GetMsg(void) const
Get message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
virtual bool Copy(const string &new_path, TCopyFlags flags=fCF_Default, size_t buf_size=0) const
Copy a file.
virtual bool Remove(TRemoveFlags flags=eRecursive) const
Remove a directory entry.
virtual bool Exists(void) const
Check if directory "dirname" exists.
static string ConcatPathEx(const string &first, const string &second)
Concatenate two parts of the path for any OS.
bool IsFile(EFollowLinks follow=eFollowLinks) const
Check whether a directory entry is a file.
bool Create(TCreateFlags flags=fCreate_Default) const
Create the directory using "dirname" passed in the constructor.
virtual bool Exists(void) const
Check existence of file.
virtual void Execute()
Do the editing action.
virtual void Unexecute()
Undo (opposite to Execute())
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
void NcbiErrorBox(const string &message, const string &title="Error")
specialized Message Box function for reporting critical errors
EDialogReturnValue NcbiMessageBox(const string &message, TDialogType type=eDialog_Ok, EDialogIcon icon=eIcon_Exclamation, const string &title="Error", EDialogTextMode text_mode=eRaw)
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
pair< TObjectPtr, TTypeInfo > ObjectInfo(C &obj)
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
void NcbiStreamCopyThrow(CNcbiOstream &os, CNcbiIstream &is)
Same as NcbiStreamCopy() but throws an CCoreException when copy fails.
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
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 SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
static string & ToLower(string &str)
Convert string to lower case – string& version.
static const char label[]
EDialogReturnValue
enumerated return values for dialog boxes, starting from 1 to undermine attempts to cast it "bool"
static bool s_ReplaceInPlaceBetweenQuotes(string &str, const string &search, const string &replace)
static const char * kFramePosX
static const char * sSaveLocalCopies[]
static const char * kFrameHeight
static const char * kHideLibrary
static const char * kOpenedScripts
static const char * kExclusiveEditDescr
static const char * kAddMacroPosX
static const char * kAddMacroWidth
static const char * kDefaultLibraryLocation
static const char * kDefaultLibrary
static const char * kAddMacroPosY
static const char * kFramePosY
static const char * kFrameWidth
static const char * kAddMacroHeight
#define ID_MACROFLOW_UNDO
#define ID_MACROFLOW_LIB_TO_SCRIPT
#define ID_MACROFLOW_UPDATESYNFILE
#define ID_MACROFLOW_REPORTSYNFILE
#define ID_MACROFLOW_STOP
#define ID_MACROFLOW_ZOOM_OUT
#define ID_MACROFLOW_SAVEAUTOFIXWGS
#define ID_MACROFLOW_LIB_EXPAND
#define ID_COLLAPSIBLE_PANE
#define ID_MACROFLOW_APPEND
#define ID_MACROFLOW_OPENSYNFILE
#define ID_MACROFLOW_FIND
#define ID_MACROFLOW_OPEN
#define ID_MACROFLOW_SAVE_AS
#define ID_MACROFLOW_LIB_COLLAPSE
#define ID_MACROFLOW_SAVEAUTOFIXGB
#define ID_MACROFLOW_LOCK_DRAG
#define ID_MACROFLOW_DELETE
#define ID_MACROFLOW_EXPORT_STEPS
#define ID_MACROFLOW_SAVESYN
#define ID_MACROFLOW_COPY
#define ID_MACROFLOW_PASTE
#define ID_MACROFLOW_ZOOM_IN
#define ID_MACROFLOW_FORWARD
#define ID_MACROFLOW_SAVEAUTOFIXTSA
#define ID_MACROFLOW_DEL_FROM_LIB
#define ID_MACROFLOW_SAVE
#define ID_MANUALEDITMACRO
#define ID_MACROFLOW_DUPLICATE
const TYPE & Get(const CNamedParameterList *param)
void SaveScriptFromLibrary(const string ¯o)
Save macro obtained from the library.
void ReportUsage(const wxString &dialog_name, const string &action_name)
Report events in the macro_flow_editor and in the macro_editor.
void ReportMacroExecution()
Report when a macro is executed.
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
const CharType(& source)[N]
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
std::istream & in(std::istream &in_, double &x_)
ViewerWindowBase::OnEditMenu ViewerWindowBase::OnJustification EVT_MENU(MID_SHOW_GEOM_VLTNS, ViewerWindowBase::OnShowGeomVltns) EVT_MENU(MID_FIND_PATTERN
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
void OpenFileBrowser(const wxString &path)
wxString GetAbsolutePath(const wxString &localpath)
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)
wxRect GetScreenRect(const wxWindow &win)