00001
00002
00003
00004
00005
00006
00007
00008
00010
00011 #include <wx/wxprec.h>
00012 #include <wx/glcanvas.h>
00013 #include "gui.h"
00014
00015 #ifndef WX_PRECOMP
00016 #include <wx/wx.h>
00017 #endif
00018
00019 IMPLEMENT_APP(NGuiApp)
00020
00022
00024
00025 bool NGuiApp::OnInit()
00026 {
00027 mainFrame *main_frame = new mainFrame("NeReK Simulator",
00028 wxPoint (0,0), wxSize(450, 45), wxDEFAULT_FRAME_STYLE);
00029 main_frame->Show(TRUE);
00030 SetTopWindow(main_frame);
00031
00032
00033 return TRUE;
00034 }
00035
00037
00039
00040 mainFrame::mainFrame(const wxString &title, const wxPoint &pos, const wxSize &size, long style)
00041 : wxFrame((wxFrame *) NULL, -1, title, pos, size, style)
00042 {
00043 wxMenu *FileMenu = new wxMenu;
00044 wxMenu *NewMenu = new wxMenu;
00045 wxMenuBar *MenuBar = new wxMenuBar;
00046
00047
00048 FileMenu->Append(mainFrame_Quit, "&Quit");
00049 NewMenu->Append(mainFrame_NewPerceptron, "&Perceptron");
00050 NewMenu->Append(mainFrame_NewMultiPercp, "&Multi Layer Perceptron");
00051
00052
00053 MenuBar->Append(FileMenu, "&File");
00054 MenuBar->Append(NewMenu,"&New");
00055 SetMenuBar(MenuBar);
00056
00057
00058 CreateStatusBar(2);
00059 SetStatusText("Welcome To NeReK");
00060 }
00061
00062 void mainFrame::OnQuit(wxCommandEvent & WXUNUSED(event))
00063 {
00064
00065 Close(TRUE);
00066 }
00067
00068 void mainFrame::OnNewPerceptron(wxCommandEvent & WXUNUSED(event))
00069 {
00070 netDialog *dlg_perceptron = new netDialog(this, -1, "Perceptron Simulator",
00071 wxPoint(100,100), wxSize(125,250));
00072 dlg_perceptron->Show();
00073 }
00074
00075 void mainFrame::OnNewMultiPercp(wxCommandEvent & WXUNUSED(event))
00076 {
00077 }
00078
00079 BEGIN_EVENT_TABLE(mainFrame, wxFrame)
00080 EVT_MENU(mainFrame_Quit, mainFrame::OnQuit)
00081 EVT_MENU(mainFrame_NewPerceptron, mainFrame::OnNewPerceptron)
00082 EVT_MENU(mainFrame_NewMultiPercp, mainFrame::OnNewMultiPercp)
00083 END_EVENT_TABLE()
00084
00086
00088
00089 netDialog::netDialog(wxWindow *parent, wxWindowID id, const wxString &title,
00090 const wxPoint &position, const wxSize& size, long style) :
00091 wxDialog(parent, id, title, position, size, style)
00092 {
00093 btn_newinput = new wxButton(this, netDialog_NEWINPUT_BTN, "New Input", wxPoint(10,10), wxSize(70,17));
00094 btn_delinput = new wxButton(this, netDialog_DELINPUT_BTN, "Delete Input", wxPoint(10,30), wxSize(70,17));
00095 btn_setwghts = new wxButton(this, netDialog_SETWGHTS_BTN, "Set Weights", wxPoint(10,50), wxSize(70,17));
00096 btn_train = new wxButton(this, netDialog_TRAIN_BTN, "Train", wxPoint(10,90), wxSize(70,17));
00097 btn_run = new wxButton(this, netDialog_RUN_BTN, "Run", wxPoint(10,110), wxSize(70,17));
00098 btn_setdesrd = new wxButton(this, netDialog_SETDESRD_BTN, "Set Desired", wxPoint(10,70), wxSize(70,17));
00099 btn_showdiag = new wxButton(this, netDialog_SHOWDIAG_BTN, "Show Diag", wxPoint(10,170), wxSize(70,17));
00100 btn_quit = new wxButton(this, netDialog_QUIT_BTN, "Quit", wxPoint(10,200), wxSize(70,17));
00101 txt_bias = new wxTextCtrl(this, netDialog_BIAS_TXT, "", wxPoint(90,150), wxSize(25,22));
00102 txt_squashval = new wxTextCtrl(this, netDialog_SQUASHVAL_TXT, "", wxPoint(90,130), wxSize(25,22));
00103 stc_bias = new wxStaticText(this, -1, "Bias Value", wxPoint(10,150));
00104 stc_squashval = new wxStaticText(this, -1, "Squash Value", wxPoint(10,130));
00105 }
00106
00107 void netDialog::OnNewInput(wxCommandEvent &event)
00108 {
00109 }
00110
00111 void netDialog::OnDelInput(wxCommandEvent &event)
00112 {
00113 }
00114
00115 void netDialog::OnSetWghts(wxCommandEvent &event)
00116 {
00117 }
00118
00119 void netDialog::OnSetDesrd(wxCommandEvent &event)
00120 {
00121 }
00122
00123 void netDialog::OnTrain(wxCommandEvent &event)
00124 {
00125 }
00126
00127 void netDialog::OnRun(wxCommandEvent &event)
00128 {
00129 }
00130
00131 void netDialog::OnShowDiag(wxCommandEvent &event)
00132 {
00133 wxFrame *dlg_gldiagram = new wxFrame(this, -1, "Network Diagram",
00134 wxPoint(50,50), wxSize(450,340));
00135 wxGLCanvas *glc_netdiag = new wxGLCanvas(dlg_gldiagram, -1, wxPoint(0,0), wxSize(200,200));
00136 dlg_gldiagram->Show(TRUE);
00137 glc_netdiag->SetCurrent();
00138
00139 glClearColor(0.0, 0.0, 0.0, 0.0);
00140 glViewport(0, 0, (GLint)200, (GLint)200);
00141 glColor3f(1.0, 1.0, 1.0);
00142 glBegin(GL_POLYGON);
00143 glVertex2f(-0.5, -0.5);
00144 glVertex2f(-0.5, 0.5);
00145 glVertex2f(0.5, 0.5);
00146 glVertex2f(0.5, -0.5);
00147 glEnd();
00148 glFlush();
00149
00150 glc_netdiag->SwapBuffers();
00151 }
00152
00153 void netDialog::OnQuit(wxCommandEvent &event)
00154 {
00155 Close(TRUE);
00156 }
00157
00158 BEGIN_EVENT_TABLE(netDialog, wxDialog)
00159 EVT_BUTTON(netDialog_NEWINPUT_BTN, netDialog::OnNewInput)
00160 EVT_BUTTON(netDialog_DELINPUT_BTN, netDialog::OnDelInput)
00161 EVT_BUTTON(netDialog_SETWGHTS_BTN, netDialog::OnSetWghts)
00162 EVT_BUTTON(netDialog_TRAIN_BTN, netDialog::OnTrain)
00163 EVT_BUTTON(netDialog_RUN_BTN, netDialog::OnRun)
00164 EVT_BUTTON(netDialog_SETDESRD_BTN, netDialog::OnSetDesrd)
00165 EVT_BUTTON(netDialog_SHOWDIAG_BTN, netDialog::OnShowDiag)
00166 EVT_BUTTON(netDialog_QUIT_BTN, netDialog::OnQuit)
00167 END_EVENT_TABLE()
00168
00169