46 #include <wx/stattext.h>
47 #include <wx/statbox.h>
48 #include <wx/button.h>
49 #include <wx/msgdlg.h>
51 #include <wx/filename.h>
52 #include <wx/txtstrm.h>
53 #include <wx/sstream.h>
86 wxPanel::Create( parent,
id, pos,
size, style );
91 GetSizer()->SetSizeHints(
this);
122 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
123 itemPanel1->SetSizer(itemBoxSizer2);
125 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
126 itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW, 5);
128 wxStaticText* itemStaticText4 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Please select Projects."), wxDefaultPosition, wxDefaultSize, 0 );
129 itemBoxSizer3->Add(itemStaticText4, 0, wxGROW|wxALL, 5);
132 itemBoxSizer2->Add(
m_FilePanel, 1, wxGROW|wxALL, 5);
134 wxStaticText* itemStaticText6 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Recently used Projects:"), wxDefaultPosition, wxDefaultSize, 0 );
135 itemBoxSizer2->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
137 wxArrayString m_MRUListBoxStrings;
138 m_MRUListBox =
new wxSimpleHtmlListBox( itemPanel1,
ID_RECENT_LIST, wxDefaultPosition, wxSize(200, 100), m_MRUListBoxStrings, wxHLB_MULTIPLE|wxSUNKEN_BORDER );
145 static wxString wildcard(
wxT(
"Projects (*.gbp)|*.gbp|Projects(*.gbp)|*.gbp"));
168 for( TMap::const_reverse_iterator it =
map.rbegin(); it !=
map.rend(); ++it) {
169 time_t
t = it->first;
172 wxString name, ext, filename = it->second;
176 wxFileName::SplitPath(filename, 0, &name, &ext);
178 name +=
wxT(
".") + ext;
181 wxStringOutputStream strstrm;
182 wxTextOutputStream os(strstrm);
185 << name <<
wxT(
"</a></b> ")
187 <<
wxT(
"<small>") << filename <<
wxT(
"</small>");
209 wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_FORWARD);
210 new_event.SetEventObject(
this);
211 AddPendingEvent(new_event);
217 const wxHtmlLinkInfo
info =
event.GetLinkInfo();
219 if (
info.GetHref().ToLong(&index))
222 wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_FORWARD);
223 new_event.SetEventObject(
this);
224 AddPendingEvent(new_event);
231 unsigned long cookie;
234 while(index != wxNOT_FOUND) {
278 if(processed.
find(filename) != processed.
end()) {
279 duplicates.
insert(filename);
281 processed.
insert(filename);
285 wxFileName::SplitPath(filename, 0, 0, &ext);
286 if (ext ==
wxT(
"gbw")) {
288 }
else if (ext ==
wxT(
"gbp")) {
291 invalid_files.
insert(filename);
294 invalid_files.
insert(filename);
301 if( ! duplicates.
empty()) {
302 err_msg =
wxT(
"The following files are duplicated :\n\n");
304 }
else if( ! invalid_files.
empty()) {
305 err_msg =
wxT(
"The following files are invalid or do not exist:\n\n");
309 err_msg =
wxT(
"This version of Genome Workbench can't handle workspace files.");
315 err_msg =
wxT(
"Please select a Project to load!");
317 if( ! err_msg.empty()) {
318 wxMessageBox(err_msg,
wxT(
"Errors in input"),
319 wxOK | wxICON_ERROR,
this);
321 if( ! invalid_files.
empty()) {
static bool FileExists(const wxString &fileName)
CProjectLoadOptionPanel CProjectLoadOptionPanel - dialog panel for loading Projects and Workspaces.
wxBitmap GetBitmapResource(const wxString &name)
const TFileMRU * m_FileMRU
vector< wxString > m_MRUFilenames
set< wxString > m_InvalidFiles
void SetMRU(const TFileMRU &file_mru)
wxIcon GetIconResource(const wxString &name)
CProjectLoadOptionPanel()
vector< wxString > m_SelectedFilenames
void OnRecentListLinkClicked(wxHtmlLinkEvent &event)
void x_GetSelectedMRUFilenames(vector< wxString > &filenames)
~CProjectLoadOptionPanel()
void OnRecentListDoubleClicked(wxCommandEvent &event)
wxSimpleHtmlListBox * m_MRUListBox
static bool ShowToolTips()
bool x_Finish(const vector< wxString > &filenames)
bool Create(wxWindow *parent, wxWindowID id=ID_CPROJECTLOADOPTIONPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
CMultiFileInput * m_FilePanel
void GetProjectFilenames(vector< wxString > &filenames)
const TTimeToTMap & GetMap() const
iterator_bool insert(const value_type &val)
const_iterator begin() const
const_iterator find(const key_type &key) const
const_iterator end() const
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
CTime & ToLocalTime(void)
Convert the time into local time.
string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const
Transform time to string.
@ eCurrent
Use current time. See also CCurrentTime.
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines: CTimeFormat - storage class for time format.
wxString sFilenameSetToString(const set< wxString > &filenames)
string sFormatTimePeriod(CTime &t_now, CTime &t_before)
wxString ToWxString(const string &s)