54 #include <wx/msgdlg.h>
55 #include <wx/stattext.h>
56 #include <wx/settings.h>
58 #include <wx/clipbrd.h>
59 #include <wx/display.h>
60 #include <wx/hashmap.h>
62 #include <wx/colordlg.h>
63 #include <wx/stdpaths.h>
201 #define BUTTON_WIDTH 119
202 #define BUTTON_HEIGHT 23
204 #define BUTTON_WIDTH 150
205 #define BUTTON_HEIGHT 23
208 #define DIST_BETWEEN_BUTTONS 5
210 IMovableButton::IMovableButton(wxPanel* parent, wxWindowID
id,
const wxString &
label,
const wxPoint &pos,
const wxSize &
size,
long style) : wxButton(parent,
wxID_ANY,
label,pos,
size,style),
211 m_OrigId(id), m_Position(pos), m_dragging(
false),
212 m_locked(
true),m_removed(
false),m_Sizer(parent->GetSizer())
258 bool occupied =
false;
259 wxRect
r = GetRect();
261 wxSizerItemList& children =
m_Sizer->GetChildren();
262 for (wxSizerItemList::iterator child = children.begin(); child != children.end(); ++child)
264 wxWindow* w = (*child)->GetWindow();
267 if (w ==
dynamic_cast<wxWindow*
>(
this))
271 wxRect r1 = w->GetRect();
273 if (
r.Intersects(r1))
286 int width = GetRect().GetWidth();
287 int height = GetRect().GetHeight();
290 wxSizerItemList& children = sizer->GetChildren();
291 for (wxSizerItemList::iterator child = children.begin(); child != children.end(); ++child)
293 wxRect
r(x,y,width,height);
294 wxWindow* w = (*child)->GetWindow();
297 if (w ==
dynamic_cast<wxWindow*
>(
this))
301 wxRect r1 = w->GetRect();
302 if (r1.GetTop() >
r.GetTop())
309 if (
r.Intersects(r1))
313 if (x+width > sizer->GetContainingWindow()->GetRect().GetWidth() || row > 2)
334 if (p == wxDefaultPosition)
343 int bottom = panel->GetVirtualSize().y;
345 if (button_bottom > bottom)
346 panel->SetVirtualSize(panel->GetVirtualSize().x, button_bottom);
401 wxPoint mouseOnScreen = wxGetMousePosition();
403 if (
r.Contains(mouseOnScreen.x,mouseOnScreen.y))
416 if (!IsShownOnScreen())
418 wxPoint mouseOnScreen = wxGetMousePosition();
420 if (
r.Contains(mouseOnScreen.x,mouseOnScreen.y))
436 wxPoint mouseOnScreen = wxGetMousePosition();
454 GetPosition(&cx,&cy);
473 wxRect
r = w->GetScreenRect();
474 if (cx >
r.GetWidth())
483 SetPosition( wxPoint(cx, cy) );
484 m_Position = wxPoint(w->CalcUnscrolledPosition(GetPosition()));
485 int bottom = w->GetVirtualSize().y;
487 if (button_bottom > bottom)
489 w->SetVirtualSize(w->GetVirtualSize().x, button_bottom);
507 GetPosition(&cx,&cy);
511 switch ( event.GetKeyCode() )
513 case WXK_LEFT : pos.x--;
MoveButton(pos); found =
true;
break;
514 case WXK_RIGHT : pos.x += sdx+1;
MoveButton(pos); found =
true;
break;
515 case WXK_UP : pos.y--;
MoveButton(pos); found =
true;
break;
516 case WXK_DOWN : pos.y += sdy+1;
MoveButton(pos); found =
true;
break;
518 default:
event.Skip();
break;
530 CMovableButton(wxPanel* parent, wxWindowID
id,
const wxString &
label=wxEmptyString,
const wxPoint &pos=wxDefaultPosition,
const wxSize &
size=wxDefaultSize,
long style=0) :
IMovableButton(parent,id,
label,pos,
size,style) {}
558 CFeatureMovableButton(wxPanel* parent, wxWindowID
id,
CSeqFeatData::ESubtype subtype,
const wxString &
label=wxEmptyString,
const wxPoint &pos=wxDefaultPosition,
const wxSize &
size=wxDefaultSize,
long style=0) :
IMovableButton(parent,id,
label,pos,
size,style),
CFeatureSubtypeSelector(subtype) {}
575 CFeatureMovableButtonNa(wxPanel* parent, wxWindowID
id,
CSeqFeatData::ESubtype subtype,
const wxString &
label=wxEmptyString,
const wxPoint &pos=wxDefaultPosition,
const wxSize &
size=wxDefaultSize,
long style=0) :
IMovableButton(parent,id,
label,pos,
size,style),
CFeatureSubtypeSelector(subtype) {}
592 CFeatureMovableButtonAa(wxPanel* parent, wxWindowID
id,
CSeqFeatData::ESubtype subtype,
const wxString &
label=wxEmptyString,
const wxPoint &pos=wxDefaultPosition,
const wxSize &
size=wxDefaultSize,
long style=0) :
IMovableButton(parent,id,
label,pos,
size,style),
CFeatureSubtypeSelector(subtype) {}
607 m_MovingButton =
NULL;
636 wxWindow*
main = GetGrandParent()->GetParent();
638 if (!e)
return false;
640 wxSizer* sizer = GetSizer();
641 wxSizerItemList& children = sizer->GetChildren();
643 int bottom = GetVirtualSize().y;
644 for (wxSizerItemList::iterator child = children.begin(); child != children.end(); ++child)
646 wxWindow* w = (*child)->GetWindow();
653 if (p.x < 0 || p.y < 0)
657 button->SetPosition(CalcScrolledPosition(p));
666 bool auto_layout = GetAutoLayout();
667 SetAutoLayout(
false);
668 SetVirtualSize(GetVirtualSize().x, bottom);
669 SetAutoLayout(auto_layout);
678 wxPoint p = evt.GetPosition();
686 wxPoint scrollpos = GetViewStart();
688 GetScrollPixelsPerUnit(&x,&y);
748 wxString a_label =
a->GetLabel();
749 wxString b_label =
b->GetLabel();
750 if (a_label[0].GetValue() ==
'*' && b_label[0].GetValue() !=
'*')
752 if (a_label[0].GetValue() !=
'*' && b_label[0].GetValue() ==
'*')
754 return a_label.CmpNoCase(b_label) < 0;
757 IMPLEMENT_DYNAMIC_CLASS(
CButtonPanel, wxScrolledWindow )
920 if (autostart && !m_Instance->ShouldAutoStart())
922 m_Instance->Destroy();
926 m_Instance->Show(
true);
927 m_Instance->SetFocus();
946 if (!instance.empty())
949 title <<
" (" << instance <<
")";
962 wxFrame::Create( parent,
id,
_(
"Editing Buttons"), pos,
size, style );
966 GetSizer()->SetSizeHints(
this);
1042 wxColour bg_color = wxSystemSettings::GetColour(wxSYS_COLOUR_FRAMEBK);
1044 m_panel1->SetBackgroundColour(bg_color);
1045 m_panel2->SetBackgroundColour(bg_color);
1046 m_panel3->SetBackgroundColour(bg_color);
1083 wxColourDialog dlg(
this);
1084 if (dlg.ShowModal() == wxID_OK)
1086 m_bg_color = dlg.GetColourData().GetColour();
1109 wxPanel* itemPanel1 =
new wxPanel(
this,
wxID_ANY,wxPoint(0,20),wxSize(600,380));
1111 wxBoxSizer* itemBoxSizer1 =
new wxBoxSizer(wxVERTICAL);
1112 itemPanel1->SetSizer(itemBoxSizer1);
1115 itemBoxSizer1->Add(
m_Notebook, 2, wxALL|wxGROW, 0);
1118 m_panel1->SetVirtualSize(-1, 1500);
1123 m_panel2->SetVirtualSize(-1, 1500);
1128 m_panel3->SetVirtualSize(-1, 1500);
1137 m_Sizer1 =
new wxBoxSizer(wxVERTICAL);
1140 m_Sizer2 =
new wxBoxSizer(wxVERTICAL);
1143 m_Sizer3 =
new wxBoxSizer(wxVERTICAL);
1394 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxHORIZONTAL);
1395 itemBoxSizer1->Add(itemBoxSizer2, 0, wxALL|wxEXPAND, 0);
1399 itemBoxSizer2->Add(
m_CheckBox, 0, wxALIGN_LEFT|wxALL, 5);
1413 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
1414 itemBoxSizer1->Add(itemBoxSizer3, 0, wxALL|wxEXPAND, 0);
1418 itemBoxSizer3->Add(
m_AutoStart, 0, wxALIGN_LEFT|wxALL, 5);
1420 m_findButton =
new wxSearchCtrl( itemPanel1,
ID_FIND_BUTTON,wxEmptyString,wxDefaultPosition,wxDefaultSize,wxTE_PROCESS_ENTER);
1424 itemBoxSizer3->Add(
m_findButton, 0, wxALIGN_LEFT|wxALL, 5);
1430 wxBoxSizer* itemBoxSizer4 =
new wxBoxSizer(wxHORIZONTAL);
1431 itemBoxSizer1->Add(itemBoxSizer4, 0, wxALL|wxEXPAND, 0);
1433 wxHyperlinkCtrl* itemHyperLink1 =
new wxHyperlinkCtrl(itemPanel1,
ID_SET_BG_COLOR,
wxT(
"Set Background"),
wxT(
""));
1434 itemHyperLink1->SetVisitedColour(itemHyperLink1->GetNormalColour());
1435 itemBoxSizer4->Add(itemHyperLink1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5);
1437 wxHyperlinkCtrl* itemHyperLink2 =
new wxHyperlinkCtrl(itemPanel1,
ID_RESET_BG_COLOR,
wxT(
"Reset Background"),
wxT(
""));
1438 itemHyperLink2->SetVisitedColour(itemHyperLink2->GetNormalColour());
1439 itemBoxSizer4->Add(itemHyperLink2, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5);
1443 for (wxSizerItemList::iterator child = children1.begin(); child != children1.end(); ++child)
1445 wxWindow* w = (*child)->GetWindow();
1487 return wxFrame::TransferDataToWindow();
1492 wxSizerItemList& children = sizer->GetChildren();
1493 for (wxSizerItemList::iterator child = children.begin(); child != children.end(); ++child)
1495 wxWindow* w = (*child)->GetWindow();
1532 int old =
event.GetOldSelection();
1543 int current =
event.GetSelection();
1572 if (sel != wxNOT_FOUND)
1577 found = panel->
OnChar(evt);
1593 vector<wxSizer*> sizers;
1597 vector<IMovableButton*> buttons;
1598 for (
unsigned int i=0;
i<sizers.size();
i++)
1600 wxSizer *sz = sizers[
i];
1609 wxSizerItemList& children = sz->GetChildren();
1610 for (wxSizerItemList::iterator child = children.begin(); child != children.end(); ++child)
1612 wxWindow* w = (*child)->GetWindow();
1617 buttons.push_back(button);
1624 for (
unsigned int i=0;
i<buttons.size();
i++)
1625 buttons[
i]->DeleteButton();
1634 wxString
str =
event.GetString().Lower();
1640 if (
label.Lower().Find(
str) == wxNOT_FOUND)
1660 int button_id = btn.first;
1661 string filename = btn.second;
1670 if (report_required)
1687 for (wxSizerItemList::iterator child = children.begin(); child != children.end(); ++child)
1689 wxWindow* w = (*child)->GetWindow();
1694 id_to_win[button->
GetOrigId()] = button;
1701 int win_id =
i->first;
1705 for (vector<pair<int,wxPoint> >::const_iterator j =
i->second.begin(); j !=
i->second.end(); ++j)
1707 int x = j->second.x;
1708 int y = j->second.y;
1721 button->SetPosition(win->CalcScrolledPosition(p));
1773 string action =
"Loading toolbar buttons layout registry - ";
1775 if( !path.empty() ){
1776 if( wxFileName::FileExists( path ) ){
1782 LOG_POST(
Error << action <<
"registry file is invalid " << path );
1785 LOG_POST(
Info << action <<
"skipping, no file " << path );
1788 LOG_POST(
Info << action <<
"skipping, path is empty." );
1797 if (!coords.empty())
1800 while (
i < coords.size()-3 )
1803 int x = coords[
i+1];
1804 int y = coords[
i+2];
1805 int win = coords[
i+3];
1815 int width = 600,height = 400;
1819 int pos_x = 5, pos_y = 5;
1824 for (
unsigned int i = 0;
i < wxDisplay::GetCount();
i++)
1826 wxDisplay display(
i);
1827 max_x += display.GetGeometry().GetWidth();
1829 if (pos_x + width > max_x) pos_x = wxGetDisplaySize().GetWidth()-width-5;
1830 if (pos_x < 0) pos_x = 5;
1831 if (pos_y + height > wxGetDisplaySize().GetHeight()) pos_y = wxGetDisplaySize().GetHeight()-height-5;
1832 if (pos_y < 0) pos_y = 5;
1844 vector<string> button_names;
1846 vector<string> titles;
1858 for (
size_t i = 0;
i < ids.size();
i++)
1862 string button_name = button_names[
i];
1863 string title = titles[
i];
1875 for (
long i = ids.size() - 1;
i >= 0;
i--)
1880 ids.erase(ids.begin() +
i);
1882 button_names.erase(button_names.begin() +
i);
1883 titles.erase(titles.begin() +
i);
1907 vector<wxSizer*> sizers;
1911 for (
unsigned int i=0;
i<sizers.size();
i++)
1913 wxSizer *sz = sizers[
i];
1919 wxSizerItemList& children = sz->GetChildren();
1920 for (wxSizerItemList::iterator child = children.begin(); child != children.end(); ++child)
1922 wxWindow* w = (*child)->GetWindow();
1931 coords.push_back(col);
1932 coords.push_back(row);
1933 coords.push_back(panel->GetId());
1943 vector<string> button_names;
1944 vector<string> titles;
1947 int button_id = btn.first;
1948 string filename = btn.second;
1953 ids.push_back(button_id);
1955 button_names.push_back(button_name);
1956 titles.push_back(title);
1973 if( !path.empty() ){
1978 LOG_POST(
Info <<
"Saving window layout registry - skipping, path is empty" );
1985 if (dlg.ShowModal() == wxID_OK)
1987 wxString button_name = dlg.
GetName();
1990 if (filename.empty())
1996 button->AddDynamicMenu();
1997 button->SetRemoved(
true);
1999 if (report_required)
2016 button->GetPosition(
NULL, &y);
2045 pos =
static_cast<int>(
i);
2051 vector<wxSizer *> sizers;
2055 vector<IMovableButton *> buttons;
2056 for (
unsigned int i = 0;
i < sizers.size();
i++)
2058 wxSizer *sz = sizers[
i];
2067 wxSizerItemList& children = sz->GetChildren();
2068 for (wxSizerItemList::iterator child = children.begin(); child != children.end(); ++child)
2070 wxWindow* w = (*child)->GetWindow();
2075 buttons.push_back(btn);
2082 for (
size_t i=0;
i<buttons.size();
i++)
2083 buttons[
i]->Destroy();
2098 wxWindow* main_window =
NULL;
2110 wxFileDialog asn_save_file(
this,
wxT(
"Export settings to file"), wxEmptyString, wxEmptyString,
2113 wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
2115 if (asn_save_file.ShowModal() == wxID_OK)
2117 wxString path = asn_save_file.GetPath();
2125 wxFileDialog asn_save_file(
this,
wxT(
"Import settings from file"), wxEmptyString, wxEmptyString,
2128 wxFD_OPEN|wxFD_FILE_MUST_EXIST);
2130 if (asn_save_file.ShowModal() == wxID_OK)
2132 wxString path = asn_save_file.GetPath();
2161 return wxNullBitmap;
2192 sel_srv->GetActiveObjects(
objects);
2221 if (!ws)
return false;
2277 vector<CRef<CSeq_loc> > locs;
2284 if (!sel_srv)
return locs;
2285 sel_srv->GetCurrentSelection(
objects);
2288 sel_srv->GetActiveObjects(
objects);
2295 if (
objects.empty())
return locs;
2299 const CObject* ptr = it->object.GetPointer();
2302 const objects::CSeq_feat* seqfeat =
dynamic_cast<const objects::CSeq_feat*
>(ptr);
2303 const objects::CSeq_loc* seqloc =
dynamic_cast<const objects::CSeq_loc*
>(ptr);
2304 const objects::CBioseq* bioseq =
dynamic_cast<const objects::CBioseq*
>(ptr);
2305 const objects::CSeqdesc* seqdesc =
dynamic_cast<const objects::CSeqdesc*
>(ptr);
2306 const objects::CPubdesc* pubdesc =
dynamic_cast<const objects::CPubdesc*
>(ptr);
2307 const objects::CSeq_id* seq_id =
dynamic_cast<const objects::CSeq_id*
>(ptr);
2310 if (seqfeat->IsSetLocation()) {
2312 loc->
Assign(seqfeat->GetLocation());
2313 locs.push_back(loc);
2315 }
else if (seq_id) {
2321 locs.push_back(loc);
2323 }
else if (seqloc) {
2326 locs.push_back(loc);
2327 }
else if (bioseq) {
2329 loc->
SetInt().SetId().Assign(*(bioseq->GetId().front()));
2330 loc->
SetInt().SetFrom(0);
2331 loc->
SetInt().SetTo(bioseq->GetLength() - 1);
2332 locs.push_back(loc);
2333 }
else if (seqdesc) {
2338 loc->
SetInt().SetId().Assign(*(bi->
GetId().front().GetSeqId()));
2339 loc->
SetInt().SetFrom(0);
2341 locs.push_back(loc);
2344 }
else if (pubdesc) {
2349 loc->
SetInt().SetId().Assign(*(bi->
GetId().front().GetSeqId()));
2350 loc->
SetInt().SetFrom(0);
2352 locs.push_back(loc);
2395 sel_srv->GetCurrentSelection(
objects);
2398 sel_srv->GetActiveObjects(
objects);
2513 wxWindow* main_window =
NULL;
2527 wxWindow* main_window =
NULL;
2562 if (regpath.empty() || !dlg)
2577 if (regpath.empty() || !dlg)
2585 if (width >= 0 && height >= 0)
2586 dlg->SetSize(wxSize(width,height));
2591 if (pos_x >= 0 && pos_y >= 0)
2594 for (
auto i = 0;
i < wxDisplay::GetCount();
i++)
2596 wxDisplay display(
i);
2597 max_x += display.GetGeometry().GetWidth();
2599 if (pos_x + width > max_x) pos_x = wxGetDisplaySize().GetWidth()-width-5;
2600 if (pos_y + height > wxGetDisplaySize().GetHeight()) pos_y = wxGetDisplaySize().GetHeight()-height-5;
2602 dlg->SetPosition(wxPoint(pos_x,pos_y));
2604 wxTopLevelWindow* top_win =
dynamic_cast<wxTopLevelWindow*
>(dlg);
2607 wxRect rc = dlg->GetRect();
2610 dlg->Move(rc.GetLeftTop());
2619 vector< CIRef<IFileLoadPanelClientFactory> > file_formats;
2623 for (
size_t i = 0;
i < file_formats.size(); ++
i) {
2624 if (file_formats[
i]->GetFileLoaderId() ==
"file_loader_qual_table") {
2625 format_manager.
Reset(file_formats[
i]->CreateInstance());
2627 if (
"file_loader_qual_table" == format_manager->GetFileLoaderId()) {
2629 if (const_qual_mgr) {
2641 wxTextDataObject data;
2642 if (wxTheClipboard->Open())
2644 if (wxTheClipboard->IsSupported( wxDF_UNICODETEXT ))
2645 wxTheClipboard->GetData( data );
2646 wxTheClipboard->Close();
2649 if (data.GetText().length() == 0) {
2650 wxMessageBox(
"No data in clipboard for table");
2656 fname =
f.GetFileName();
2659 vector<wxString> fnames;
2667 dlg.SetSize(760, 940);
2668 dlg.Centre(wxBOTH | wxCENTRE_ON_SCREEN);
2669 dlg.SetMinSize(wxSize(760, 750));
2673 if (dlg.ShowModal() == wxID_OK) {
2677 CFile tmp_file(fname);
2738 wxWindow* main_window =
NULL;
2753 wxWindow* main_window =
NULL;
2781 wxWindow* editorWindow = editor->CreateWindow(edit_dlg);
2785 edit_dlg->Show(
true);
2819 wxWindow* main_window =
NULL;
2826 if (dlg.ShowModal() == wxID_OK) {
2898 if (dlg.ShowModal() == wxID_OK)
2938 if (dlg.ShowModal() == wxID_OK) {
2947 wxOK | wxICON_ERROR,
NULL);
2966 wxWindow* main_window =
NULL;
2988 if (dlg.ShowModal() == wxID_OK) {
2997 wxOK | wxICON_ERROR,
NULL);
3037 if (dlg.ShowModal() == wxID_OK)
3068 wxWindow* main_window =
NULL;
3088 if (dlg.ShowModal() == wxID_OK) {
3097 wxOK | wxICON_ERROR,
NULL);
3154 if (dlg.ShowModal() == wxID_OK)
3200 bool ispartial5 =
true, ispartial3 =
true;
3210 bool ispartial5 =
true, ispartial3 =
true;
3220 bool ispartial5 =
true, ispartial3 =
true;
3245 wxWindow* main_window =
NULL;
3340 wxWindow* main_window =
NULL;
3588 wxMessageBox(e.
GetMsg(),
wxT(
"Error"), wxOK | wxICON_ERROR,
NULL);
3602 wxMessageBox(e.
GetMsg(),
wxT(
"Error"), wxOK | wxICON_ERROR,
NULL);
3637 vector<string> format_ids;
3638 format_ids.push_back(
"file_loader_qual_table");
3639 fileManager->LoadFormats(format_ids);
3642 for(
size_t i = 0;
i < fileManager->GetFormatManagers().
size(); ++
i ) {
3647 if (const_qual_mgr) {
3655 vector<CIRef<IOpenObjectsPanelClient> > loadManagers;
3659 dlg.SetSize(760, 940);
3660 dlg.Centre(wxBOTH | wxCENTRE_ON_SCREEN);
3661 dlg.SetMinSize(wxSize(760, 750));
3666 if (dlg.ShowModal() == wxID_OK) {
3680 if (dlg.ShowModal() == wxID_OK) {
3691 if (dlg.ShowModal() == wxID_OK)
3713 return first->Compare(*second);
3719 return first->Equals(*second);
3729 if (dlg.ShowModal() == wxID_OK) {
3735 vector<CRef<CSeq_loc> > cpy = orig_locs;
3736 vector<CRef<CSeq_loc> >::iterator lit = cpy.begin();
3737 while (lit != cpy.end()) {
3739 if (!
b ||
b.IsAa()) {
3740 lit = cpy.erase(lit);
3751 stable_sort(cpy.begin(), cpy.end(),
CompLoc);
3752 cpy.erase(unique(cpy.begin(), cpy.end(),
EqualLoc), cpy.end());
3759 cmd->AddCommand(*subcmd);
3802 if (dlg.ShowModal() == wxID_OK)
3878 bool ispartial5 =
true;
3879 bool ispartial3 =
true;
3888 bool ispartial5 =
true;
3889 bool ispartial3 =
true;
3898 bool ispartial5 =
true;
3899 bool ispartial3 =
true;
3908 bool ispartial5 =
true;
3909 bool ispartial3 =
true;
3918 bool ispartial5 =
true;
3919 bool ispartial3 =
true;
3975 bool show_label =
true;
3984 bool show_label =
true;
3993 bool show_label =
true;
4002 bool show_label =
true;
4011 bool show_label =
true;
4025 if (dlg.ShowModal() == wxID_OK){
4038 wxMessageBox(
_(
"Please select a single Bioseq"),
wxT(
"Error"), wxOK | wxICON_ERROR,
NULL);
4055 wxWindow* editorWindow = editor->CreateWindow(edit_dlg);
4059 edit_dlg->Show(
true);
4067 wxWindow* main_window =
NULL;
4087 if (!macro_dir.DirExists()) {
4088 if (!macro_dir.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL)) {
4089 LOG_POST(
Error <<
"Cannot create directory '" <<
string(macro_dir.GetPath().ToUTF8()) <<
"'");
4094 wxFileName macro_file(macro_dir.GetPath(), filename);
4095 if (!macro_file.FileExists()) {
4096 const string orig_location =
"<std>/etc/macro_scripts/";
4098 if (!orig_path.DirExists()) {
4102 wxFileName orig_file(orig_path.GetPath(), filename);
4103 wxFileName dst_file(macro_dir.GetPath(), filename);
4104 if (!wxCopyFile(orig_file.GetFullPath(), dst_file.GetFullPath())) {
4105 LOG_POST(
Error <<
"Cannot copy '" << filename <<
"' to location '" <<
string(macro_dir.GetPath().ToUTF8()) <<
"'");
4109 return string(macro_file.GetFullPath().ToUTF8());
4121 char username[1024];
4131 if (orig_dir_path.empty() || upd_dir_path.empty()) {
4135 CDir dir(upd_dir_path);
4137 for (
auto& it : files) {
4141 string filename = it->GetName();
4152 if (lcl_chksum == upd_chksum) {
4155 else if (lcl_chksum == orig_chksum) {
4157 CFile lcl(lcl_filename);
4159 CFile upd(upd_filename);
4160 if (upd.
CopyToDir(
string(lcl_dir.GetFullPath().ToUTF8()))) {
4162 if (!username.empty()) {
4166 LOG_POST(
Error <<
"Cannot copy '" << upd_filename <<
"' to location '" <<
string(lcl_dir.GetFullPath().ToUTF8()) <<
"'");
4172 if (!username.empty()) {
4374 string title, filename;
4376 bool add_user_object =
false;
4378 switch (event.GetId()) {
4381 title =
"Autofix(WGS)";
4386 add_user_object =
true;
4390 title =
"Autofix(TSA)";
4396 int id =
event.GetId();
4403 if (macros.empty() && filename.empty()) {
4408 wxWindow* main_window =
NULL;
4413 const string kMacroReport(
" Macro Report");
4416 ITERATE(wxWindowList, wit, main_window->GetChildren()){
4417 wxWindow* child = *wit;
4425 bool status =
false;
4427 if (!macros.empty()) {
4430 else if (!filename.empty()) {
4436 if (!status || report_msg.empty()) {
4437 report_msg.assign(
"Macro had no effect");
4440 title.append(kMacroReport);
4455 vector<string> macro;
4457 bool add_user_object =
false;
4458 bool resolve_vars =
false;
4459 switch (event.GetId()) {
4462 add_user_object =
true;
4465 resolve_vars =
true;
4469 int id =
event.GetId();
4474 if (macro.empty() && filename.empty()) {
4481 if (!macro.empty()) {
4484 else if (!filename.empty()) {
4492 if (dlg.ShowModal() == wxID_OK)
4536 wxWindow* main_window =
NULL;