/***************************************************************
 * Name:      PlottWareControlMain.h
 * Purpose:   Defines Application Frame
 * Author:    Fandly Gergo (fandlygergo@gmail.hu)
 * Created:   2017-11-25
 * Copyright: Fandly Gergo (systemtest.tk)
 * License:
 **************************************************************/

#ifndef PLOTTWARECONTROLMAIN_H
#define PLOTTWARECONTROLMAIN_H

#include <algorithm>
#include <cstdio>
#include <sstream>

#include "settings.h"
#include "project.h"

//(*Headers(PlottWareControlFrame)
#include <wx/notebook.h>
#include <wx/stattext.h>
#include <wx/menu.h>
#include <wx/textctrl.h>
#include <wx/msgdlg.h>
#include <wx/listbox.h>
#include <wx/spinctrl.h>
#include <wx/radiobut.h>
#include <wx/stopwatch.h>
#include <wx/slider.h>
#include <wx/panel.h>
#include <wx/filedlg.h>
#include <wx/choice.h>
#include <wx/button.h>
#include <wx/frame.h>
#include <wx/timer.h>
#include <wx/gauge.h>
#include <wx/statusbr.h>
//*)

class PlottWareControlFrame: public wxFrame
{
    public:

        PlottWareControlFrame(wxWindow* parent,wxWindowID id = -1);
        virtual ~PlottWareControlFrame();
        Settings* getSettings();
        Project* getProject();

    private:

        //(*Handlers(PlottWareControlFrame)
        void OnQuit(wxCommandEvent& event);
        void OnAbout(wxCommandEvent& event);
        void OnListBox1Select(wxCommandEvent& event);
        void OnScrollBar1Scroll(wxScrollEvent& event);
        void OnMenuItemSettingsSelected(wxCommandEvent& event);
        void OnProjNewButtonClick(wxCommandEvent& event);
        void OnProjOpenButtonClick(wxCommandEvent& event);
        void OnProjCloseButtonClick(wxCommandEvent& event);
        void OnImagesAddButtonClick(wxCommandEvent& event);
        void OnImagesDeleteButtonClick(wxCommandEvent& event);
        void OnImagesImageListBoxSelect(wxCommandEvent& event);
        void OnImagesPositionXSpinnerChange(wxSpinEvent& event);
        void OnImagesPositionYSpinnerChange(wxSpinEvent& event);
        void OnImagesCropX1SpinnerChange(wxSpinEvent& event);
        void OnImagesCropY1SpinnerChange(wxSpinEvent& event);
        void OnImagesCropX2SpinnerChange(wxSpinEvent& event);
        void OnImagesCropY2SpinnerChange(wxSpinEvent& event);
        void OnImagesPreviewButtonClick(wxCommandEvent& event);
        void OnImagesImageListMoveUpButtonClick(wxCommandEvent& event);
        void OnImagesImageListMoveDownButtonClick(wxCommandEvent& event);
        void OnImagesScaleTextText(wxCommandEvent& event);
        void OnProcessingRetrAllRadioSelect(wxCommandEvent& event);
        void OnProcessingRetrExtRadioSelect(wxCommandEvent& event);
        void OnProcessingCannyThreshSliderCmdScroll(wxScrollEvent& event);
        void OnProcessingPreviewButtonClick(wxCommandEvent& event);
        void OnProcessingColorLineSelectSelect(wxCommandEvent& event);
        void OnProcessingColorColorSelectSelect(wxCommandEvent& event);
        void OnProcessingColorForAllButtonClick(wxCommandEvent& event);
        void OnGcodeGenerateButtonClick(wxCommandEvent& event);
        void OnGcodeEditButtonClick(wxCommandEvent& event);
        void OnGcodeExportButtonClick(wxCommandEvent& event);
        void OnNotebook1PageChanged(wxNotebookEvent& event);
        void OnPrintingPrinterConnectButtonClick(wxCommandEvent& event);
        void OnPrintingPrinterHomeButtonClick(wxCommandEvent& event);
        void OnPrintingPrinterPowerButtonClick(wxCommandEvent& event);
        void OnPrintingPrinterHeadSelectSelect(wxCommandEvent& event);
        void OnPrintingPrinterUpButtonClick(wxCommandEvent& event);
        void OnPrintingPrinterDownButtonClick(wxCommandEvent& event);
        void OnPrintingPrinterRightButtonClick(wxCommandEvent& event);
        void OnPrintingPrinterLeftButtonClick(wxCommandEvent& event);
        void OnPrintingPrinterConsoleText(wxCommandEvent& event);
        void OnPrintingPrinterConsoleTextEnter(wxCommandEvent& event);
        void OnPrintingPrintButtonClick(wxCommandEvent& event);
        void OnPrintingElapsedTimeCheckerTimerTrigger(wxTimerEvent& event);
        void OnButton1Click(wxCommandEvent& event);
        void OnPrintingStopButtonClick(wxCommandEvent& event);
        void OnPrintingEmergencyButtonClick(wxCommandEvent& event);
        //*)

        //(*Identifiers(PlottWareControlFrame)
        static const long ID_BUTTON1;
        static const long ID_STATICTEXT1;
        static const long ID_BUTTON2;
        static const long ID_BUTTON3;
        static const long ID_BUTTON4;
        static const long ID_PANEL2;
        static const long ID_STATICTEXT2;
        static const long ID_LISTBOX1;
        static const long ID_BUTTON5;
        static const long ID_BUTTON6;
        static const long ID_BUTTON9;
        static const long ID_BUTTON23;
        static const long ID_BUTTON24;
        static const long ID_STATICTEXT25;
        static const long ID_STATICTEXT26;
        static const long ID_STATICTEXT27;
        static const long ID_TEXTCTRL2;
        static const long ID_SPINCTRL1;
        static const long ID_SPINCTRL2;
        static const long ID_SPINCTRL3;
        static const long ID_SPINCTRL4;
        static const long ID_SPINCTRL5;
        static const long ID_SPINCTRL6;
        static const long ID_STATICTEXT4;
        static const long ID_STATICTEXT5;
        static const long ID_STATICTEXT3;
        static const long ID_STATICTEXT7;
        static const long ID_STATICTEXT9;
        static const long ID_STATICTEXT8;
        static const long ID_STATICTEXT10;
        static const long ID_STATICTEXT6;
        static const long ID_PANEL3;
        static const long ID_STATICTEXT12;
        static const long ID_STATICTEXT11;
        static const long ID_RADIOBUTTON1;
        static const long ID_RADIOBUTTON2;
        static const long ID_STATICTEXT13;
        static const long ID_SLIDER1;
        static const long ID_STATICTEXT14;
        static const long ID_STATICTEXT15;
        static const long ID_STATICTEXT16;
        static const long ID_CHOICE1;
        static const long ID_CHOICE2;
        static const long ID_BUTTON25;
        static const long ID_BUTTON8;
        static const long ID_PANEL4;
        static const long ID_STATICTEXT17;
        static const long ID_BUTTON10;
        static const long ID_BUTTON12;
        static const long ID_BUTTON13;
        static const long ID_PANEL5;
        static const long ID_STATICTEXT18;
        static const long ID_STATICTEXT19;
        static const long ID_STATICTEXT20;
        static const long ID_STATICTEXT21;
        static const long ID_BUTTON7;
        static const long ID_BUTTON16;
        static const long ID_BUTTON17;
        static const long ID_BUTTON18;
        static const long ID_BUTTON19;
        static const long ID_BUTTON20;
        static const long ID_CHOICE3;
        static const long ID_STATICTEXT22;
        static const long ID_BUTTON21;
        static const long ID_SPINCTRL7;
        static const long ID_STATICTEXT24;
        static const long ID_STATICTEXT23;
        static const long ID_STATICTEXT28;
        static const long ID_STATICTEXT29;
        static const long ID_STATICTEXT30;
        static const long ID_STATICTEXT32;
        static const long ID_STATICTEXT33;
        static const long ID_STATICTEXT31;
        static const long ID_TEXTCTRL1;
        static const long ID_LISTBOX2;
        static const long ID_STATICTEXT34;
        static const long ID_PANEL1;
        static const long ID_BUTTON11;
        static const long ID_BUTTON14;
        static const long ID_BUTTON15;
        static const long ID_STATICTEXT35;
        static const long ID_GAUGE1;
        static const long ID_STATICTEXT36;
        static const long ID_STATICTEXT37;
        static const long ID_PANEL6;
        static const long ID_NOTEBOOK2;
        static const long MenuSettingItem;
        static const long MenuQuitItem;
        static const long idMenuAbout;
        static const long ID_STATUSBAR1;
        static const long ID_MESSAGEDIALOG1;
        static const long ID_TIMER1;
        //*)

        //(*Declarations(PlottWareControlFrame)
        wxStaticText* StaticText10;
        wxStaticText* StaticText22;
        wxSpinCtrl* ImagesCropX1Spinner;
        wxStaticText* StaticText9;
        wxStaticText* StaticText20;
        wxChoice* ProcessingColorLineSelect;
        wxButton* ProjCloseButton;
        wxListBox* ImagesImageListBox;
        wxNotebook* MenuChanger;
        wxButton* ProcessingColorForAllButton;
        wxButton* ImagesPreviewButton;
        wxStaticText* StaticText29;
        wxButton* PrintingEmergencyButton;
        wxStaticText* StaticText13;
        wxStaticText* StaticText2;
        wxStaticText* StaticText14;
        wxRadioButton* ProcessingRetrAllRadio;
        wxStaticText* PrintingStatusLabel;
        wxPanel* MenuChangerProjectPage;
        wxStaticText* StaticText26;
        wxStaticText* StaticText6;
        wxSpinCtrl* ImagesPositionXSpinner;
        wxPanel* MenuChangerPrintingPage;
        wxChoice* ProcessingColorColorSelect;
        wxButton* PrintingPrinterPowerButton;
        wxButton* PrintingPrinterConnectButton;
        wxSpinCtrl* ImagesCropY1Spinner;
        wxSpinCtrl* ImagesCropY2Spinner;
        wxButton* ImagesImageListMoveDownButton;
        wxStaticText* StaticText19;
        wxRadioButton* ProcessingRetrExtRadio;
        wxButton* ProjOpenButton;
        wxStaticText* StaticText8;
        wxTextCtrl* ImagesScaleText;
        wxStaticText* StaticText11;
        wxStaticText* StaticText18;
        wxButton* PrintingPrinterRightButton;
        wxButton* PrintingPrinterDownButton;
        wxStaticText* PrintingPrinterStatusLabel;
        wxPanel* Panel1;
        wxStaticText* StaticText1;
        wxStaticText* StaticText27;
        wxFileDialog* FileDialog1;
        wxButton* ImagesDeleteButton;
        wxPanel* MenuChangerProcessingPage;
        wxStaticText* StaticText3;
        wxSpinCtrl* ImagesCropX2Spinner;
        wxButton* PrintingStopButton;
        wxListBox* PrintingPrinterLog;
        wxButton* GcodeEditButton;
        wxTextCtrl* PrintingPrinterConsole;
        wxStaticText* StaticText21;
        wxTimer PrintingElapsedTimeCheckerTimer;
        wxStaticText* StaticText23;
        wxButton* ProcessingPreviewButton;
        wxStaticText* StaticText24;
        wxButton* ImagesAddButton;
        wxButton* PrintingPrinterUpButton;
        wxPanel* MenuChangerGcodePage;
        wxStaticText* PrintingPrinterPowerLabel;
        wxStaticText* StaticText5;
        wxStaticText* StaticText7;
        wxButton* ProjNewButton;
        wxButton* PrintingPrinterLeftButton;
        wxStatusBar* StatusBar1;
        wxButton* ImagesImageListMoveUpButton;
        wxStopWatch PrintingStopWatch;
        wxButton* PrintingPrinterHomeButton;
        wxSlider* ProcessingCannyThreshSlider;
        wxStaticText* StaticText28;
        wxGauge* PrintingStatusGauge;
        wxChoice* PrintingPrinterHeadSelect;
        wxPanel* MenuChangerImagesPage;
        wxStaticText* ImagesSizeLabel;
        wxStaticText* StaticText15;
        wxStaticText* StaticText12;
        wxButton* ProjSaveButton;
        wxStaticText* PrintingPrinterYLabel;
        wxStaticText* PrintingElapsedTimeLabelLabel;
        wxMessageDialog* MessageDialog1;
        wxMenuItem* MenuItemSettings;
        wxStaticText* StaticText25;
        wxStaticText* StaticText17;
        wxStaticText* StaticText4;
        wxButton* GcodeExportButton;
        wxStaticText* PrintingElapsedTimeLabel;
        wxStaticText* PrintingPrinterXLabel;
        wxStaticText* StaticText16;
        wxButton* PrintingPrintButton;
        wxSpinCtrl* PrintingPrinterMoveSpinner;
        wxSpinCtrl* ImagesPositionYSpinner;
        wxButton* GcodeGenerateButton;
        //*)

        DECLARE_EVENT_TABLE()

        Settings *settings;
        Project *project;

        //helper functions
        void projectControlEnable(bool to);
        void printerControlEnable(bool to);
        void printingControlShow(bool to);
};

#endif // PLOTTWARECONTROLMAIN_H
