37 #include <wx/button.h>
38 #include <wx/stattext.h>
39 #include <wx/choice.h>
40 #include <wx/dcclient.h>
41 #include <wx/settings.h>
43 #include <wx/msgdlg.h>
44 #include <wx/filedlg.h>
47 #include <wx/wfstream.h>
48 #include <wx/txtstrm.h>
109 Create(parent,
id, caption, pos,
size, style);
120 SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY|wxWS_EX_BLOCK_EVENTS);
121 wxDialog::Create( parent,
id, caption, pos,
size, style );
126 GetSizer()->SetSizeHints(
this);
162 CUser_object::GetTypeInfo();
175 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
176 itemDialog1->SetSizer(itemBoxSizer2);
178 CTextPanel* itemPanel3 =
new CTextPanel( itemDialog1,
ID_WINDOW, wxDefaultPosition, itemDialog1->ConvertDialogToPixels(wxSize(50, 50)), wxNO_BORDER );
179 itemBoxSizer2->Add(itemPanel3, 1, wxGROW|wxALL, 5);
181 wxBoxSizer* itemBoxSizer4 =
new wxBoxSizer(wxHORIZONTAL);
182 itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_LEFT|wxALL, 0);
184 m_LoadedStatus =
new wxStaticText( itemDialog1, wxID_STATIC,
_(
"Not loaded..."), wxDefaultPosition, wxDefaultSize, 0 );
185 itemBoxSizer4->Add(
m_LoadedStatus, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
187 wxStaticLine* itemStaticLine6 =
new wxStaticLine( itemDialog1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
188 itemBoxSizer2->Add(itemStaticLine6, 0, wxGROW|wxALL, 5);
190 wxBoxSizer* itemBoxSizer7 =
new wxBoxSizer(wxHORIZONTAL);
191 itemBoxSizer2->Add(itemBoxSizer7, 0, wxGROW|wxALL, 0);
193 wxFlexGridSizer* itemFlexGridSizer8 =
new wxFlexGridSizer(0, 2, 0, 0);
194 itemBoxSizer7->Add(itemFlexGridSizer8, 1, wxALIGN_CENTER_VERTICAL|wxALL, 0);
196 itemFlexGridSizer8->Add(0, 0, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
198 wxButton* itemButton10 =
new wxButton( itemDialog1,
ID_FILE,
_(
"Load File..."), wxDefaultPosition, wxDefaultSize, 0 );
199 itemFlexGridSizer8->Add(itemButton10, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
201 m_AccInput =
new wxTextCtrl( itemDialog1,
ID_ACC_TEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
206 itemFlexGridSizer8->Add(
m_AccInput, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
208 wxButton* itemButton12 =
new wxButton( itemDialog1,
ID_ACC,
_(
"Load Accession"), wxDefaultPosition, wxDefaultSize, 0 );
209 itemFlexGridSizer8->Add(itemButton12, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
211 itemFlexGridSizer8->AddGrowableCol(0);
213 wxStaticLine* itemStaticLine13 =
new wxStaticLine( itemDialog1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
214 itemBoxSizer7->Add(itemStaticLine13, 0, wxGROW|wxALL, 5);
216 wxBoxSizer* itemBoxSizer14 =
new wxBoxSizer(wxVERTICAL);
217 itemBoxSizer7->Add(itemBoxSizer14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
219 wxButton* itemButton15 =
new wxButton( itemDialog1,
ID_BUTTON1,
_(
"Save Text..."), wxDefaultPosition, wxDefaultSize, 0 );
220 itemButton15->Enable(
false);
221 itemBoxSizer14->Add(itemButton15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
223 wxButton* itemButton16 =
new wxButton( itemDialog1, wxID_CANCEL,
_(
"&Close"), wxDefaultPosition, wxDefaultSize, 0 );
224 itemBoxSizer14->Add(itemButton16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
230 FindWindow(
ID_ACC)->SetFocus();
284 string msg(
"Accession '");
285 msg += acc +
" not recognized as a valid accession";
287 wxOK | wxICON_ERROR);
318 wxFileDialog dlg(
this,
_(
"Select a file"),
_(
""),
_(
""),
319 _(
"ASN files (*.asn)|*.asn|All files (*.*)|*.*"),
322 if (dlg.ShowModal() != wxID_OK)
325 wxString fileName = dlg.GetPath();
326 if (fileName.empty())
335 string header = os->ReadFileHeader();
342 wxMessageBox(
ToWxString(s),
_(
"Error loading file."),
343 wxOK | wxICON_ERROR);
389 static wxString filePath;
390 wxFileDialog dlg(
this,
_(
"Select a file"),
_(
""), filePath,
391 _(
"All files (*.*)|*.*"),
392 wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
394 if (dlg.ShowModal() != wxID_OK)
397 filePath = dlg.GetPath();
402 if (!textItem)
return;
404 wxFFileOutputStream stream(filePath);
405 wxTextOutputStream os(stream);
408 if (stream.GetLastError() != wxSTREAM_NO_ERROR)
409 wxMessageBox(
_(
"Failed to write file: \"") + filePath +
_(
"\"."),
410 _(
"Write Error"), wxOK|wxICON_ERROR);
CFlatFileDemoDlg()
Constructors.
~CFlatFileDemoDlg()
Destructor.
wxStaticText * m_LoadedStatus
void OnLoadFileClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FILE
void OnCloseWindow(wxCloseEvent &event)
wxEVT_CLOSE_WINDOW event handler for ID_HIT_MATRIX_DEMO_DLG
bool Create(wxWindow *parent, wxWindowID id=ID_HIT_MATRIX_DEMO_DLG, const wxString &caption=_("CFlatFileDemoDlg"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 368), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxMAXIMIZE_BOX|wxMINIMIZE_BOX)
Creation.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void Init()
Initialises member variables.
void OnCancelClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnAccClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ACC
void OnSaveText(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
static bool ShowToolTips()
Should we show tooltips?
void CreateControls()
Creates the controls and sizers.
CRef< CObjectManager > m_ObjMgr
static TRegisterLoaderInfo RegisterInObjectManager(CObjectManager &om, CReader *reader=0, CObjectManager::EIsDefault is_default=CObjectManager::eDefault, CObjectManager::TPriority priority=CObjectManager::kPriority_NotSet)
Base class for all serializable objects.
ITextItem * GetRootItem()
CTextPanelContext * GetContext()
CTextItemPanel * GetWidget() const
virtual bool InitWidget(TConstScopedObjects &objects)
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
CTextBlock GetItemBlock() const
virtual void GetText(wxTextOutputStream &os, const CTextBlock &block, CTextPanelContext *context)=0
#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.
string ReportAll(TDiagPostFlags flags=eDPF_Exception) const
Report all exceptions.
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
vector< SConstScopedObject > TConstScopedObjects
@ eSerial_AsnText
ASN.1 text.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
CBioseq_Handle AddBioseq(CBioseq &bioseq, TPriority pri=kPriority_Default, EExist action=eExist_Throw)
Add bioseq, return bioseq handle.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CSeq_entry_Handle AddTopLevelSeqEntry(CSeq_entry &top_entry, TPriority pri=kPriority_Default, EExist action=eExist_Default)
Add seq_entry, default priority is higher than for defaults or loaders Add object to the score with p...
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
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.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static TTypeInfo GetClassInfoByName(const string &name)
TObjectPtr Create(CObjectMemoryPool *memoryPool=0) const
Create object of this type on heap (can be deleted by operator delete)
static const char label[]
const struct ncbi::grid::netcache::search::fields::SIZE size
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)