45 #include <wx/choice.h>
46 #include <wx/statbox.h>
47 #include <wx/stattext.h>
48 #include <wx/msgdlg.h>
49 #include <wx/bitmap.h>
51 #include <wx/filename.h>
52 #include <wx/txtstrm.h>
53 #include <wx/sstream.h>
54 #include <wx/checkbox.h>
55 #include <wx/settings.h>
75 : m_Manager(), m_FileMRU(), m_MRUFileClicked(
false), m_MRUFormat(-1)
82 : m_Manager(), m_FileMRU(), m_MRUFileClicked(
false), m_MRUFormat(-1)
92 wxPanel::Create( parent,
id, pos,
size, style );
97 GetSizer()->SetSizeHints(
this);
129 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
130 itemPanel1->SetSizer(itemBoxSizer2);
132 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
133 itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALL, 0);
135 wxStaticText* itemStaticText4 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"File Format:"), wxDefaultPosition, wxDefaultSize, 0 );
136 itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
138 wxArrayString m_FormatListStrings;
139 m_FormatList =
new wxChoice( itemPanel1,
ID_CHOICE, wxDefaultPosition, wxDefaultSize, m_FormatListStrings, 0 );
140 itemBoxSizer3->Add(
m_FormatList, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
142 m_CheckFormat =
new wxCheckBox( itemPanel1,
ID_CHECKBOX6,
_(
"Verify that the file data match the selected file format"), wxDefaultPosition, wxDefaultSize, 0 );
144 itemBoxSizer2->Add(
m_CheckFormat, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT, 5);
146 wxStaticText* itemStaticText7 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Filenames or URLs:"), wxDefaultPosition, wxDefaultSize, 0 );
147 itemBoxSizer2->Add(itemStaticText7, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
150 itemBoxSizer2->Add(
m_FileInput, 1, wxGROW|wxALL, 5);
152 wxStaticText* itemStaticText9 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Recently used Files:"), wxDefaultPosition, wxDefaultSize, 0 );
153 itemBoxSizer2->Add(itemStaticText9, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
156 itemBoxSizer2->Add(
m_MRUWindow, 1, wxGROW|wxALL, 5);
201 wxStringOutputStream strstrm;
202 wxTextOutputStream os(strstrm);
204 os <<
wxT(
"<html><body>");
206 for( TMap::const_reverse_iterator it =
map.rbegin(); it !=
map.rend(); ++it) {
207 time_t
t = it->first;
209 wxString name, ext, filename = it->second.GetFileName();
211 wxFileName::SplitPath(filename, 0, &name, &ext);
213 name +=
wxT(
".") + ext;
217 <<
wxT(
"</a></b> ")
218 <<
wxT(
"<font color=#808080>last used ")
220 <<
wxT(
"<small>") << filename <<
wxT(
"</small><br />");
225 os <<
wxT(
"</body></html>");
230 m_MRUWindow->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
235 if (index == wxNOT_FOUND)
240 wxString manager_label =
m_MRUFilenames[index].GetFileLoaderLabel();
243 wxString err_msg =
wxT(
"The file: \"") + filename +
wxT(
"\" doesn't exist.");
244 wxMessageBox(err_msg,
wxT(
"Error"), wxOK | wxICON_ERROR,
this);
248 int format_index = -1;
251 format_index = (
int)
i;
256 if (format_index < 0) {
257 wxString err_msg =
wxT(
"File loader \"") + manager_label +
wxT(
"\" not found.");
258 wxMessageBox(err_msg,
wxT(
"Error"), wxOK | wxICON_ERROR,
this);
266 wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_FORWARD);
267 event.SetEventObject(
this);
268 AddPendingEvent(event);
277 for(
size_t i = 0;
i <
n;
i++) {
308 if (entryFormat ==
format) {
353 wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_FORWARD);
354 event.SetEventObject(
this);
355 AddPendingEvent(event);
380 const wxHtmlLinkInfo
info =
event.GetLinkInfo();
382 if (
info.GetHref().ToLong(&index))
static bool FileExists(const wxString &fileName)
CFileLoadManager CFileLoadManager - a Loader Manager implementing "File" option in "Open" dialog.
virtual void OnFormatChanged()
called by File Format panel when a user selects a format
void x_SetCurrentFormat(int index)
wxIcon GetIconResource(const wxString &name)
CFileLoadManager * m_Manager
static bool ShowToolTips()
void SetFilenames(const vector< wxString > &filenames)
void SetMRU(const TFileMRU &file_mru)
bool Create(wxWindow *parent, wxWindowID id=ID_CFILELOADOPTIONPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
const TFileMRU * m_FileMRU
void OnFormatListSelected(wxCommandEvent &event)
void SetManager(CFileLoadManager *manager)
void x_LoadMRUFile(int index)
vector< CFormatDescriptor > m_Formats
void SelectFormat(int format)
void GetFilenames(vector< wxString > &filenames) const
void SetCheckFormat(bool value=true)
CMultiFileInput * m_FileInput
void OnMRUWindowLinkClicked(wxHtmlLinkEvent &event)
wxBitmap GetBitmapResource(const wxString &name)
vector< CFileLoadManager::CFileDescriptor > m_MRUFilenames
CwxHtmlWindow * m_MRUWindow
void OnLoadFiles(wxCommandEvent &event)
void SetFormats(const vector< CFormatDescriptor > &formats)
wxCheckBox * m_CheckFormat
const TTimeToTMap & GetMap() const
static string sFormatTimePeriod(CTime &t_now, CTime &t_before)
#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.
unsigned int
A callback function used to compare two keys in a database.
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
wxString ToWxString(const string &s)