52 #include <wx/listctrl.h>
54 #include <wx/button.h>
56 #include <wx/msgdlg.h>
57 #include <wx/checkbox.h>
58 #include <wx/listbox.h>
84 COpenDlg::COpenDlg( wxWindow* parent, wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize&
size,
long style )
91 bool COpenDlg::Create( wxWindow* parent, wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize&
size,
long style )
94 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
95 CDialog::Create( parent,
id, caption, pos,
size, style );
134 class CUnfocusedListBox :
public wxListBox
137 CUnfocusedListBox(wxWindow *parent, wxWindowID
id,
138 const wxPoint& pos,
const wxSize&
size,
const wxArrayString &choices,
long style)
140 Create(parent,
id, pos,
size, choices, style);
143 virtual bool AcceptsFocus()
const {
return false; }
154 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
155 itemCDialog1->SetSizer(itemBoxSizer2);
158 itemBoxSizer2->Add(
m_Splitter, 1, wxGROW|wxALL, wxDLG_UNIT(itemCDialog1, wxSize(5, -1)).x);
160 wxArrayString m_OptionListStrings;
163 wxStaticLine* itemStaticLine5 =
new wxStaticLine( itemCDialog1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
164 itemBoxSizer2->Add(itemStaticLine5, 0, wxGROW|wxALL, wxDLG_UNIT(itemCDialog1, wxSize(5, -1)).x);
166 wxBoxSizer* itemBoxSizer6 =
new wxBoxSizer(wxHORIZONTAL);
167 itemBoxSizer2->Add(itemBoxSizer6, 0, wxGROW|wxLEFT|wxRIGHT, wxDLG_UNIT(itemCDialog1, wxSize(5, -1)).x);
169 wxHyperlinkCtrl* itemHyperlinkCtrl7 =
new wxHyperlinkCtrl( itemCDialog1, wxID_HELP,
_(
"Help"),
wxT(
"https://www.ncbi.nlm.nih.gov/tools/gbench"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
170 itemHyperlinkCtrl7->SetForegroundColour(wxColour(192, 192, 192));
171 itemBoxSizer6->Add(itemHyperlinkCtrl7, 0, wxALIGN_CENTER_VERTICAL|wxALL, wxDLG_UNIT(itemCDialog1, wxSize(5, -1)).x);
173 itemBoxSizer6->Add(wxDLG_UNIT(itemCDialog1, wxSize(2, -1)).x, wxDLG_UNIT(itemCDialog1, wxSize(-1, 2)).y, 1, wxALIGN_CENTER_VERTICAL|wxALL, wxDLG_UNIT(itemCDialog1, wxSize(5, -1)).x);
175 wxBoxSizer* itemBoxSizer9 =
new wxBoxSizer(wxHORIZONTAL);
176 itemBoxSizer6->Add(itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL, wxDLG_UNIT(itemCDialog1, wxSize(5, -1)).x);
178 m_BackBtn =
new wxButton( itemCDialog1, wxID_BACKWARD,
_(
"< &Back"), wxDefaultPosition, wxDefaultSize, 0 );
179 itemBoxSizer9->Add(
m_BackBtn, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, wxDLG_UNIT(itemCDialog1, wxSize(5, -1)).x);
184 bool spacer_code_included =
true;
185 #ifdef __WXOSX_COCOA__
186 itemBoxSizer9->AddSpacer(6);
189 m_NextBtn =
new wxButton( itemCDialog1, wxID_FORWARD,
_(
"&Next >"), wxDefaultPosition, wxDefaultSize, 0 );
191 itemBoxSizer9->Add(
m_NextBtn, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, wxDLG_UNIT(itemCDialog1, wxSize(5, -1)).x);
193 wxButton* itemButton12 =
new wxButton( itemCDialog1, wxID_CANCEL,
_(
"&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
194 itemBoxSizer6->Add(itemButton12, 0, wxALIGN_CENTER_VERTICAL|wxALL, wxDLG_UNIT(itemCDialog1, wxSize(5, -1)).x);
198 if (!spacer_code_included) {
217 int sizes[3] = { 170, 250, -1 };
221 wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
223 wxBoxSizer* itemBoxSizer_op =
new wxBoxSizer(wxVERTICAL);
251 manager->SetServiceLocator(
NULL);
252 manager->SetParentWindow(
NULL);
261 manager->SetParentWindow(
this);
282 string s = manager->GetDescriptor().GetLabel();
300 wxDialog::InitDialog();
407 if(panel->GetContainingSizer() !=
m_OptionPanel->GetSizer()) {
408 m_OptionPanel->GetSizer()->Insert(0, panel, 1, wxEXPAND | wxALL, 5);
414 if (panel->GetParent() !=
this) {
415 panel->Reparent(
this);
418 if (panel->GetContainingSizer() != GetSizer()) {
419 GetSizer()->Insert(0, panel, 1, wxEXPAND | wxALL, 5);
475 bool success =
false;
479 success = manager->DoTransition(action);
484 catch (
const exception& e) {
488 if (!errMsg.empty()) {
489 wxMessageBox (
ToWxString(errMsg),
wxT(
"Error"), wxOK | wxICON_ERROR);
495 if(manager->IsCompletedState()) {
504 const IUIObject& descriptor = manager->GetDescriptor();
505 const string& log_event = descriptor.
GetLogEvent();
506 if (!log_event.empty()) {
513 wxPanel* new_panel = manager->GetCurrentPanel();
562 m_NextBtn->SetLabel(manager->IsFinalState() ?
wxT(
"Finish") :
wxT(
"Next >"));
572 wxString s =
ToWxString(manager->GetDescriptor().GetLabel());
574 title +=
wxT(
" - ") + s;
584 manager->ResetState();
594 wxDialog::EndModal(ret_code);
608 string sub_section = manager->GetDescriptor().GetLabel();
609 string mgr_path =
m_RegPath +
"." + sub_section;
624 if (widths.size() == 2) {
640 string mgr_label = manager->GetDescriptor().GetLabel();
641 if (mgr_label == sel_mgr_label) {
657 string mgr_label = manager->GetDescriptor().GetLabel();
virtual void SaveSettings() const
virtual void SetRegistryPath(const string &path)
virtual void LoadSettings()
CFileLoadManager CFileLoadManager - a Loader Manager implementing "File" option in "Open" dialog.
void SetDialog(COpenDlg *dlg)
virtual void SetFilenames(vector< wxString > &filenames)
vector< wxString > GetFilenames() const
static CGuiRegistry & GetInstance()
access the application-wide singleton
void Set(const string &key, int val)
set specific values
void x_SelectManager(int index)
static bool ShowToolTips()
bool Create(wxWindow *parent, wxWindowID id=ID_COPENDLG, const wxString &caption=_("Open"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(450, 275), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxMAXIMIZE_BOX|wxTAB_TRAVERSAL)
virtual void SelectOptionByLabel(const string &label)
select loading options By Extension ID
virtual void SetRegistryPath(const string &path)
int m_RequestedManager
if >= 0, than the dialog shall show a particualr option
virtual void x_SaveSettings(CRegistryWriteView view) const
@ ID_OPEN_FOLDER_CHECKBOX
void OnBackwardClick(wxCommandEvent &event)
IServiceLocator * m_SrvLocator
void x_SetCurrentPanel(wxPanel *panel, bool firstPage)
virtual void InitDialog()
wxIcon GetIconResource(const wxString &name)
void OnListItemActivate(wxListEvent &event)
vector< wxString > m_Filenames
virtual void x_LoadSettings(const CRegistryReadView &view)
override these functions in derived classes
void OnForwardClick(wxCommandEvent &event)
void OnCancelClick(wxCommandEvent &event)
virtual void SetManagers(vector< TManagerRef > &managers)
virtual void SetFilenames(const vector< wxString > &filenames)
vector< TManagerRef > m_Managers
Load Managers corresponding to Loading Options.
void x_DoTransition(IUIToolManager::EAction action)
void OnOptionListSelected(wxCommandEvent &event)
virtual void EndModal(int ret_code)
wxCheckBox * m_OpenExportFolder
wxBitmap GetBitmapResource(const wxString &name)
void x_AppendOptionForManager(IUIToolManager &manager)
add a Loading Option (displayed in the list on the left) for the given Manager
virtual CIRef< IAppTask > GetLoadingTask()
CIRef< IAppTask > m_AppTask
void OnSkipClick(wxCommandEvent &event)
virtual void SetServiceLocator(IServiceLocator *srv_locator)
class CRegistryReadView provides a nested hierarchical view at a particular key.
void GetIntVec(const string &key, vector< int > &val) const
string GetString(const string &key, const string &default_val=kEmptyStr) const
void Set(const string &key, int val)
access a named key at this level, with no recursion
CSplitter - container with resizable separators.
virtual bool Show(bool show=true)
bool InsertToCell(wxWindow *child, int col, int row)
If cell [col, row] exists and vacant - adds widget to the container.
void GetWidths(TPosVector &widths) const
void SetWidths(const TPosVector &widths)
@ eHorizontal
vertical space is splitted
virtual void Split(ESplitType type)
Creates a splitter with a single cell.
IRegSettings An interface for objects that save / restore settings using CGuiRegistry.
virtual void SaveSettings() const =0
virtual void LoadSettings()=0
virtual void SetRegistryPath(const string &path)=0
IServiceLocator - an abstract mechanism for locating services.
IUIObject - object that provides basic properties often required in a UI object.
const string & GetMsg(void) const
Get message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
virtual const string & GetLogEvent() const =0
virtual const string & GetLabel() const =0
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static const char label[]
unsigned int
A callback function used to compare two keys in a database.
const struct ncbi::grid::netcache::search::fields::SIZE size
static const char * kExportOpenFolderTag
static const char * kSplitterWidthsTag
static const char * kSelOptionTag
#define SYMBOL_COPENDLG_SIZE
static void SetTitle(CRef< CSeq_entry > entry, string title)
#define REPORT_USAGE(event, args)
Convenience macro to log usage statisitics.
wxString ToWxString(const string &s)