Code: Select all
/***************************************************************
* Name: WxWMain.cpp
* Purpose: Code for Application Frame
* Author: ()
* Created: 2016-01-15
* Copyright: ()
* License:
**************************************************************/
#include "wx_pch.h"
#include "WxWMain.h"
#include <wx/msgdlg.h>
#include <wx/textfile.h>
//(*InternalHeaders(WxWFrame)
#include <wx/intl.h>
#include <wx/string.h>
//*)
//helper functions
enum wxbuildinfoformat {
short_f, long_f };
wxString wxbuildinfo(wxbuildinfoformat format)
{
wxString wxbuild(wxVERSION_STRING);
if (format == long_f )
{
#if defined(__WXMSW__)
wxbuild << _T("-Windows");
#elif defined(__UNIX__)
wxbuild << _T("-Linux");
#endif
#if wxUSE_UNICODE
wxbuild << _T("-Unicode build");
#else
wxbuild << _T("-ANSI build");
#endif // wxUSE_UNICODE
}
return wxbuild;
}
//(*IdInit(WxWFrame)
const long WxWFrame::ID_STATICTEXT1 = wxNewId();
const long WxWFrame::ID_TEXTCTRL1 = wxNewId();
const long WxWFrame::ID_TOGGLEBUTTON1 = wxNewId();
const long WxWFrame::ID_PANEL1 = wxNewId();
const long WxWFrame::idMenuQuit = wxNewId();
const long WxWFrame::idMenuAbout = wxNewId();
//*)
BEGIN_EVENT_TABLE(WxWFrame,wxFrame)
//(*EventTable(WxWFrame)
//*)
END_EVENT_TABLE()
WxWFrame::WxWFrame(wxWindow* parent,wxWindowID id)
{
//(*Initialize(WxWFrame)
wxMenuItem* MenuItem2;
wxMenuItem* MenuItem1;
wxMenu* Menu1;
wxMenuBar* MenuBar1;
wxMenu* Menu2;
Create(parent, wxID_ANY, _("Konverter"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
SetClientSize(wxSize(1000,680));
Panel1 = new wxPanel(this, ID_PANEL1, wxPoint(320,336), wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
StaticText1 = new wxStaticText(Panel1, ID_STATICTEXT1, _("Vyber soubor urceny k prepisu do matice"), wxPoint(376,16), wxDefaultSize, 0, _T("ID_STATICTEXT1"));
TextCtrl1 = new wxTextCtrl(Panel1, ID_TEXTCTRL1, wxEmptyString, wxPoint(16,80), wxSize(968,560), wxTE_MULTILINE|wxTE_READONLY|wxVSCROLL|wxHSCROLL|wxALWAYS_SHOW_SB, wxDefaultValidator, _T("ID_TEXTCTRL1"));
ToggleButton1 = new wxToggleButton(Panel1, ID_TOGGLEBUTTON1, _("Nacist soubor"), wxPoint(448,40), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TOGGLEBUTTON1"));
MenuBar1 = new wxMenuBar();
Menu1 = new wxMenu();
MenuItem1 = new wxMenuItem(Menu1, idMenuQuit, _("Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL);
Menu1->Append(MenuItem1);
MenuBar1->Append(Menu1, _("&File"));
Menu2 = new wxMenu();
MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this application"), wxITEM_NORMAL);
Menu2->Append(MenuItem2);
MenuBar1->Append(Menu2, _("Help"));
SetMenuBar(MenuBar1);
Connect(ID_TOGGLEBUTTON1,wxEVT_COMMAND_TOGGLEBUTTON_CLICKED,(wxObjectEventFunction)&WxWFrame::OnToggleButton1Toggle);
Connect(idMenuQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&WxWFrame::OnQuit);
Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&WxWFrame::OnAbout);
//*)
}
WxWFrame::~WxWFrame()
{
//(*Destroy(WxWFrame)
//*)
}
void WxWFrame::OnQuit(wxCommandEvent& event)
{
Close();
}
void WxWFrame::OnAbout(wxCommandEvent& event)
{
wxString msg = wxbuildinfo(long_f);
wxMessageBox(msg, _("Welcome to..."));
}
void WxWFrame::OnToggleButton1Toggle(wxCommandEvent& event)
{
TextCtrl1->SetValue("");
wxString file;
wxFileDialog fdlog(this, _("Otevrit TXT soubor"), "", "",
"koncovka TXT (*.txt)|*.txt", wxFD_OPEN|wxFD_FILE_MUST_EXIST);
if(fdlog.ShowModal() != wxID_OK) return;
file.Clear();
file = fdlog.GetPath();
wxString str;
wxTextFile tfile;
tfile.Open(file);
size_t num = tfile.GetLineCount();
size_t cnt = 0;
str = tfile.GetFirstLine();
while(!tfile.Eof())
{
cnt++;
str = tfile.GetNextLine();
if (cnt == num-1) str = "\""+str+"\"";
else str = "\""+str+"\",";
str.Replace(wxT("\t"),wxT(""));
TextCtrl1->WriteText("\r\n");
if (str != "\"\",") TextCtrl1->WriteText(str);
}
}
So my question is - how can I add necessary dlls to the final release in order to function without Code:blocks installed? Or is there any other way around this?
I would be thankful for any help