#include "GcodeEditorDialog.h" //(*InternalHeaders(GcodeEditorDialog) #include #include #include #include //*) //(*IdInit(GcodeEditorDialog) const long GcodeEditorDialog::ID_TEXTCTRL1 = wxNewId(); const long GcodeEditorDialog::ID_STATICTEXT1 = wxNewId(); const long GcodeEditorDialog::ID_BUTTON1 = wxNewId(); const long GcodeEditorDialog::ID_BUTTON2 = wxNewId(); //*) BEGIN_EVENT_TABLE(GcodeEditorDialog,wxDialog) //(*EventTable(GcodeEditorDialog) //*) END_EVENT_TABLE() GcodeEditorDialog::GcodeEditorDialog(wxWindow* parent,wxWindowID id,std::string* _gcode,const wxPoint& pos,const wxSize& size) { gcode=_gcode; //(*Initialize(GcodeEditorDialog) Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id")); SetClientSize(wxSize(902,565)); Move(wxDefaultPosition); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); GcodeText = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxPoint(16,48), wxSize(872,500), wxTE_MULTILINE, wxDefaultValidator, _T("ID_TEXTCTRL1")); wxFont GcodeTextFont(10,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Courier New"),wxFONTENCODING_DEFAULT); GcodeText->SetFont(GcodeTextFont); StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("G code editor"), wxPoint(24,16), wxDefaultSize, 0, _T("ID_STATICTEXT1")); wxFont StaticText1Font(16,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT); StaticText1->SetFont(StaticText1Font); SaveButton = new wxButton(this, ID_BUTTON1, _("Save"), wxPoint(704,16), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); CancelButton = new wxButton(this, ID_BUTTON2, _("Cancel"), wxPoint(792,16), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&GcodeEditorDialog::OnSaveButtonClick); Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&GcodeEditorDialog::OnCancelButtonClick); //*) GcodeText->SetValue(*gcode); } GcodeEditorDialog::~GcodeEditorDialog() { //(*Destroy(GcodeEditorDialog) //*) } void GcodeEditorDialog::OnSaveButtonClick(wxCommandEvent& event) { *gcode=GcodeText->GetValue(); } void GcodeEditorDialog::OnCancelButtonClick(wxCommandEvent& event) { GcodeText->SetValue(*gcode); }