|
From: Markus R. <rol...@us...> - 2006-01-04 20:32:12
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1966 Modified Files: main.cpp mainframe.cpp mainframe.h Added Files: rsgedit.wxg Log Message: - added wxGlade project file for rsgedit - recreated RsgEdit classes with wxGlade Index: main.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/main.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.cpp 4 Jan 2006 19:11:16 -0000 1.3 --- main.cpp 4 Jan 2006 20:31:58 -0000 1.4 *************** *** 57,79 **** } ! MainFrame *frame = new MainFrame ! (NULL, wxString(_T("RSG-Edit")), wxDefaultPosition,wxSize(400, 300)); ! ! wxMenu *winMenu = new wxMenu; ! ! winMenu->Append(wxID_EXIT, _T("&Close")); ! wxMenuBar *menuBar = new wxMenuBar; ! menuBar->Append(winMenu, _T("&File")); ! ! frame->SetMenuBar(menuBar); ! ! frame->m_canvas = new SparkGLCanvas ! (frame, wxID_ANY, wxDefaultPosition, wxDefaultSize); ! frame->m_canvas->SetFocus(); // Show the frame frame->Show(true); - frame->Maximize(); - SetTopWindow(frame); --- 57,64 ---- } ! mainframe* frame = new mainframe(NULL, wxID_ANY, "RsgEdit"); // Show the frame frame->Show(true); SetTopWindow(frame); Index: mainframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mainframe.h 25 Dec 2005 15:06:28 -0000 1.1 --- mainframe.h 4 Jan 2006 20:31:58 -0000 1.2 *************** *** 1,49 **** ! /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D ! Fri May 9 2003 ! Copyright (C) 2003 Koblenz University ! $Id$ ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; version 2 of the License. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! */ ! #ifndef MAINFRAME_H__ ! #define MAINFRAME_H__ ! #include <wx/frame.h> ! #include <wx/timer.h> ! class SparkGLCanvas; - class MainFrame: public wxFrame - { - public: void OnExit(wxCommandEvent& event); - void OnNewWindow(wxCommandEvent& event); ! MainFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, ! const wxSize& size, long style = wxDEFAULT_FRAME_STYLE); protected: void OnTimer(wxTimerEvent& event); ! DECLARE_EVENT_TABLE() ! ! public: ! SparkGLCanvas* m_canvas; protected: wxTimer mTimer; - }; ! #endif // MAINFRAME_H__ --- 1,46 ---- ! /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ ! // -*- C++ -*- generated by wxGlade 0.4 on Wed Jan 4 20:26:10 2006 ! #include <wx/wx.h> ! #include <wx/image.h> ! #ifndef MAINFRAME_H ! #define MAINFRAME_H ! class SparkGLCanvas; ! // begin wxGlade: ::dependencies ! // end wxGlade ! class mainframe: public wxFrame { ! public: ! // begin wxGlade: mainframe::ids ! // end wxGlade ! mainframe(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE); void OnExit(wxCommandEvent& event); ! private: ! // begin wxGlade: mainframe::methods ! void set_properties(); ! void do_layout(); ! // end wxGlade protected: void OnTimer(wxTimerEvent& event); ! protected: ! // begin wxGlade: mainframe::attributes ! wxMenuBar* MainFrame_menubar; ! SparkGLCanvas* mCanvas; ! wxPanel* panel_1; ! wxStatusBar* MainFrame_statusbar; ! // end wxGlade protected: wxTimer mTimer; ! DECLARE_EVENT_TABLE() ! }; // wxGlade: end class ! ! #endif // MAINFRAME_H --- NEW FILE: rsgedit.wxg --- <?xml version="1.0"?> <!-- generated by wxGlade 0.4 on Wed Jan 4 21:31:51 2006 --> <application path="/home/markus/cvs/simspark/contrib/rsgedit" name="" class="" option="1" language="C++" top_window="MainFrame" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.6"> <object class="mainframe" name="MainFrame" base="EditFrame"> <style>wxICONIZE|wxCAPTION|wxMINIMIZE|wxCLOSE_BOX|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxSYSTEM_MENU|wxRESIZE_BORDER|wxCLIP_CHILDREN</style> <title>RsgEdit</title> <menubar>1</menubar> <statusbar>1</statusbar> <size>640, 480</size> <object class="wxMenuBar" name="MainFrame_menubar" base="EditMenuBar"> <menus> <menu name="" label="&File"> <item> <label>&Exit</label> <id>wxID_EXIT</id> </item> </menu> </menus> </object> <object class="wxBoxSizer" name="sizer_1" base="EditBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <flag>wxEXPAND</flag> <border>0</border> <option>1</option> <object class="wxPanel" name="panel_1" base="EditPanel"> <style>wxTAB_TRAVERSAL</style> <object class="wxBoxSizer" name="sizer_2" base="EditBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <flag>wxEXPAND</flag> <border>0</border> <option>1</option> <object class="SparkGLCanvas" name="mCanvas" base="CustomWidget"> <arguments> <argument>$parent</argument> <argument>$id</argument> </arguments> </object> </object> </object> </object> </object> </object> <object class="wxStatusBar" name="MainFrame_statusbar" base="EditStatusBar"> <fields> <field width="0">Welcome to RsgEdit</field> </fields> </object> </object> </application> Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mainframe.cpp 2 Jan 2006 20:28:49 -0000 1.2 --- mainframe.cpp 4 Jan 2006 20:31:58 -0000 1.3 *************** *** 1,21 **** ! /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D ! Fri May 9 2003 ! Copyright (C) 2003 Koblenz University ! $Id$ ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; version 2 of the License. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ #include "mainframe.h" #include "sparkglcanvas.h" --- 1,4 ---- ! // -*- C++ -*- generated by wxGlade 0.4 on Wed Jan 4 20:26:10 2006 #include "mainframe.h" #include "sparkglcanvas.h" *************** *** 30,37 **** #include "simspark.h" ! BEGIN_EVENT_TABLE(MainFrame, wxFrame) ! EVT_MENU(wxID_EXIT, MainFrame::OnExit) ! EVT_TIMER(1, MainFrame::OnTimer) ! END_EVENT_TABLE() using namespace boost; --- 13,20 ---- #include "simspark.h" ! BEGIN_EVENT_TABLE(mainframe, wxFrame) ! EVT_MENU(wxID_EXIT, mainframe::OnExit) ! EVT_TIMER(1, mainframe::OnTimer) ! END_EVENT_TABLE() using namespace boost; *************** *** 39,49 **** using namespace oxygen; ! // My frame constructor ! MainFrame::MainFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, ! const wxSize& size, long style) ! : wxFrame(parent, wxID_ANY, title, pos, size, style), ! mTimer(this,1) { ! m_canvas = NULL; // this is a one shot timer to kick off the rendering loop in --- 22,42 ---- using namespace oxygen; ! mainframe::mainframe(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style): ! wxFrame(parent, id, title, pos, size, wxDEFAULT_FRAME_STYLE), ! mTimer(this,1) { ! // begin wxGlade: mainframe::mainframe ! panel_1 = new wxPanel(this, -1); ! MainFrame_menubar = new wxMenuBar(); ! SetMenuBar(MainFrame_menubar); ! wxMenu* wxglade_tmp_menu_1 = new wxMenu(); ! wxglade_tmp_menu_1->Append(wxID_EXIT, wxT("&Exit"), wxT(""), wxITEM_NORMAL); ! MainFrame_menubar->Append(wxglade_tmp_menu_1, wxT("&File")); ! mCanvas = new SparkGLCanvas(panel_1, -1); ! MainFrame_statusbar = CreateStatusBar(1, 0); ! ! set_properties(); ! do_layout(); ! // end wxGlade // this is a one shot timer to kick off the rendering loop in *************** *** 52,57 **** } ! // Intercept menu commands ! void MainFrame::OnExit( wxCommandEvent& WXUNUSED(event) ) { // true is to force the frame to close --- 45,83 ---- } ! void mainframe::set_properties() ! { ! // begin wxGlade: mainframe::set_properties ! SetTitle(wxT("RsgEdit")); ! SetSize(wxSize(640, 480)); ! int MainFrame_statusbar_widths[] = { 0 }; ! MainFrame_statusbar->SetStatusWidths(1, MainFrame_statusbar_widths); ! const wxString MainFrame_statusbar_fields[] = { ! wxT("Welcome to RsgEdit") ! }; ! for(int i = 0; i < MainFrame_statusbar->GetFieldsCount(); ++i) { ! MainFrame_statusbar->SetStatusText(MainFrame_statusbar_fields[i], i); ! } ! // end wxGlade ! } ! ! ! void mainframe::do_layout() ! { ! // begin wxGlade: mainframe::do_layout ! wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL); ! wxBoxSizer* sizer_2 = new wxBoxSizer(wxVERTICAL); ! sizer_2->Add(mCanvas, 1, wxEXPAND, 0); ! panel_1->SetAutoLayout(true); ! panel_1->SetSizer(sizer_2); ! sizer_2->Fit(panel_1); ! sizer_2->SetSizeHints(panel_1); ! sizer_1->Add(panel_1, 1, wxEXPAND, 0); ! SetAutoLayout(true); ! SetSizer(sizer_1); ! Layout(); ! // end wxGlade ! } ! ! void mainframe::OnExit( wxCommandEvent& WXUNUSED(event) ) { // true is to force the frame to close *************** *** 59,63 **** } ! void MainFrame::OnTimer(wxTimerEvent& /*event*/) { shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); --- 85,89 ---- } ! void mainframe::OnTimer(wxTimerEvent& /*event*/) { shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); *************** *** 97,101 **** // refresh the display ! m_canvas->Render(); // pump the wxWidgets message loop --- 123,127 ---- // refresh the display ! mCanvas->Render(); // pump the wxWidgets message loop *************** *** 107,108 **** --- 133,136 ---- } + + |