You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(153) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(48) |
Feb
(46) |
Mar
(12) |
Apr
(4) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
(263) |
Mar
(235) |
Apr
(66) |
May
(42) |
Jun
(270) |
Jul
(65) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Markus R. <rol...@us...> - 2006-01-22 12:18:30
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5861 Added Files: propertyframe.h propertyframe.cpp Log Message: - added class propertyframe that displays a list control with name/value pairs describing a zeitgeist class instance --- NEW FILE: propertyframe.h --- /* -*- 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: propertyframe.h,v 1.1 2006/01/22 12:18:18 rollmark Exp $ 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. */ // -*- C++ -*- generated by wxGlade 0.4 on Sat Jan 21 16:34:57 2006 #include "property.h" #include <wx/wx.h> #include <wx/image.h> #ifndef PROPERTYFRAME_H #define PROPERTYFRAME_H // begin wxGlade: ::dependencies #include <wx/listctrl.h> // end wxGlade #include <boost/weak_ptr.hpp> namespace zeitgeist { class Leaf; } class propertyframe: public wxFrame { public: // begin wxGlade: propertyframe::ids // end wxGlade propertyframe(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE); void SetLeaf(boost::weak_ptr<zeitgeist::Leaf> leaf); void InitList(); void RefreshProperties(); private: // begin wxGlade: propertyframe::methods void set_properties(); void do_layout(); // end wxGlade protected: // begin wxGlade: propertyframe::attributes wxListCtrl* mCtrList; // end wxGlade boost::weak_ptr<zeitgeist::Leaf> mLeaf; Property::TClassList mClassList; }; // wxGlade: end class #endif // PROPERTYFRAME_H --- NEW FILE: propertyframe.cpp --- /* -*- 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: propertyframe.cpp,v 1.1 2006/01/22 12:18:18 rollmark Exp $ 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. */ // -*- C++ -*- generated by wxGlade 0.4 on Sat Jan 21 16:34:57 2006 #include "propertyframe.h" #include "main.h" //! wxWidgets and zeitgeist both use a 'DECLARE_CLASS' macro #undef DECLARE_CLASS #include <oxygen/sceneserver/basenode.h> using namespace boost; using namespace zeitgeist; propertyframe::propertyframe(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style): wxFrame(parent, id, title, pos, size, wxCAPTION|wxCLOSE_BOX|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxSYSTEM_MENU|wxRESIZE_BORDER|wxFRAME_TOOL_WINDOW|wxFRAME_FLOAT_ON_PARENT|wxCLIP_CHILDREN) { // begin wxGlade: propertyframe::propertyframe mCtrList = new wxListCtrl(this, -1, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxSUNKEN_BORDER); set_properties(); do_layout(); // end wxGlade } void propertyframe::set_properties() { // begin wxGlade: propertyframe::set_properties SetTitle(wxT("frame_1")); SetSize(wxSize(300, 150)); // end wxGlade } void propertyframe::do_layout() { // begin wxGlade: propertyframe::do_layout wxBoxSizer* sizer_3 = new wxBoxSizer(wxVERTICAL); sizer_3->Add(mCtrList, 1, wxEXPAND, 0); SetAutoLayout(true); SetSizer(sizer_3); Layout(); // end wxGlade } void propertyframe::SetLeaf(weak_ptr<Leaf> leaf) { mLeaf = leaf; shared_ptr<Property> property = wxGetApp().GetProperty(); if (property.get() != 0) { property->GetClassList(mLeaf.lock(), mClassList); } InitList(); } void propertyframe::RefreshProperties() { if (mLeaf.expired()) { return; } shared_ptr<Property> property = wxGetApp().GetProperty(); if (property.get() == 0) { return; } shared_ptr<Leaf> leaf = mLeaf.lock(); Property::TEntryList entries; property->GenEntries(leaf, mClassList, entries); int line = 0; bool valRefresh = (mCtrList->GetItemCount() == entries.size()); if (valRefresh) { // just refresh values to prevent flicker int line = 0; for ( Property::TEntryList::const_iterator iter = entries.begin(); iter != entries.end(); ++iter ) { const Property::Entry& entry = (*iter); mCtrList->SetItem(line, 1, entry.value); ++line; } } else { // complete refresh mCtrList->DeleteAllItems(); for ( Property::TEntryList::const_iterator iter = entries.begin(); iter != entries.end(); ++iter ) { const Property::Entry& entry = (*iter); int row = mCtrList->InsertItem(line, entry.name); mCtrList->SetItem(row, 1, entry.value); ++line; } } } void propertyframe::InitList() { mCtrList->ClearAll(); mCtrList->InsertColumn(0, _T("name"), wxLIST_FORMAT_LEFT, 120); mCtrList->InsertColumn(1, _T("value"), wxLIST_FORMAT_LEFT, 600); RefreshProperties(); } |
From: Markus R. <rol...@us...> - 2006-01-22 12:17:45
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5597 Added Files: property.h property.cpp Log Message: - added class Property that generates a list of name/value pairs to describe a zeitgeist class instance --- NEW FILE: property.cpp --- /* -*- 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: property.cpp,v 1.1 2006/01/22 12:17:33 rollmark Exp $ 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 "property.h" #include "main.h" //! wxWidgets and zeitgeist both use a 'DECLARE_CLASS' macro #undef DECLARE_CLASS #include "simspark.h" #include <salt/vector.h> #include <salt/bounds.h> #include <salt/matrix.h> #include <zeitgeist/logserver/logserver.h> #include <zeitgeist/class.h> #include <zeitgeist/core.h> #include <oxygen/sceneserver/basenode.h> #include <oxygen/sceneserver/transform.h> using namespace std; using namespace boost; using namespace salt; using namespace zeitgeist; using namespace oxygen; inline wxString FormatVector3(const Vector3f& vec) { return wxString::Format(_T("(%.2f, %.2f, %.2f)"),vec[0],vec[1],vec[2]); } inline wxString FormatAABB3(const AABB3& bound) { return FormatVector3(bound.minVec) + _T(" ") + FormatVector3(bound.maxVec); } inline wxString FormatMatrix(const Matrix& m) { wxString str = wxString::Format(_T("(%.2f"),m.m[0]); for (int i=1;i<16;++i) { str += wxString::Format(_T(", %.2f"),m.m[i]); } str += _T(")"); return str; } Property::Property() { Init(); } void Property::Init() { mClassMap.clear(); mClassMap["/classes/zeitgeist/Leaf"] = CL_LEAF; mClassMap["ClassClass"] = CL_CLASS; mClassMap["/classes/oxygen/BaseNode"] = CL_BASENODE; mClassMap["/classes/oxygen/Transform"] = CL_TRANSFORM; } void Property::GenLeafEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { entries.push_back(Entry(_T("GetFullPath"), leaf->GetFullPath())); } void Property::GenBaseNodeEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { shared_ptr<BaseNode> baseNode = shared_static_cast<BaseNode>(leaf); entries.push_back(Entry(_T("GetWorldBoundingBox"), FormatAABB3(baseNode->GetWorldBoundingBox()))); } void Property::GenClassEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { shared_ptr<Class> cl = shared_static_cast<Class>(leaf); // originating bundle shared_ptr<salt::SharedLibrary> bundle = cl->GetBundle(); entries.push_back( Entry( _T("GetBundle"), (bundle.get() != 0) ? bundle->GetName() : _T("<None>") ) ); // base classes const Class::TStringList& baseCl = cl->GetBaseClasses(); for ( Class::TStringList::const_iterator iter = baseCl.begin(); iter != baseCl.end(); ++iter ) { entries.push_back(Entry(_T("GetBaseClasses"), _T((*iter).c_str()))); } // supported functions const Class::TCommandMap& cmds = cl->GetCommandMap(); for ( Class::TCommandMap::const_iterator iter = cmds.begin(); iter != cmds.end(); ++iter ) { entries.push_back(Entry(_T("GetCommandMap"), _T((*iter).first.c_str()))); } } void Property::GenTransformEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { shared_ptr<Transform> trans = shared_static_cast<Transform>(leaf); entries.push_back(Entry(_T("GetChangedMark"), wxString::Format("%d",trans->GetChangedMark()))); entries.push_back(Entry(_T("GetLocalTransform"), FormatMatrix(trans->GetLocalTransform()))); entries.push_back(Entry(_T("GetWorldTransform"), FormatMatrix(trans->GetWorldTransform()))); } void Property::GetClassList(boost::shared_ptr<Class> cl, TClassList& clList) const { if (cl.get() == 0) { return; } shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); if (spark.get() == 0) { return; } TClassMap::const_iterator iter = mClassMap.find(cl->GetFullPath()); if (iter != mClassMap.end()) { clList.push_back((*iter).second); } const Class::TStringList& baseClasses = cl->GetBaseClasses(); for ( Class::TStringList::const_iterator iter = baseClasses.begin(); iter != baseClasses.end(); ++iter ) { string basePath = "/classes/"+(*iter); shared_ptr<Class> base = shared_dynamic_cast<Class> (spark->GetCore()->Get(basePath)); if (base.get() == 0) { cl->GetLog()->Error() << "(Property) invalid base class " << basePath << " defined for " << cl->GetFullPath() << std::endl; continue; } GetClassList(base, clList); } } void Property::GetClassList(boost::shared_ptr<Leaf> leaf, TClassList& clList) const { clList.clear(); if (leaf.get() == 0) { return; } shared_ptr<Class> cl = leaf->GetClass(); GetClassList(cl, clList); } void Property::GenEntries(shared_ptr<zeitgeist::Leaf> leaf, const TClassList& clList, TEntryList& entries) const { entries.clear(); if (leaf.get() == 0) { return; } for ( TClassList::const_reverse_iterator iter = clList.rbegin(); iter != clList.rend(); ++iter ) { switch (*iter) { default: break; case CL_LEAF: GenLeafEntries(leaf, entries); break; case CL_BASENODE: GenBaseNodeEntries(leaf, entries); break; case CL_CLASS: GenClassEntries(leaf, entries); break; case CL_TRANSFORM: GenTransformEntries(leaf, entries); break; } } } --- NEW FILE: property.h --- /* -*- 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: property.h,v 1.1 2006/01/22 12:17:33 rollmark Exp $ 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 <list> #include <map> #include <boost/weak_ptr.hpp> #include <wx/string.h> namespace zeitgeist { class Class; class Leaf; } class Property { public: enum EClass { CL_LEAF, CL_CLASS, CL_BASENODE, CL_TRANSFORM }; //! mapping from path of zeitgeist class to EClass value typedef std::map<wxString, EClass> TClassMap; //! list of base class types typedef std::list<EClass> TClassList; struct Entry { public: wxString name; wxString value; public: Entry(const wxString& n, const wxString& v) : name(n), value(v) {} }; typedef std::list<Entry> TEntryList; public: Property(); void GetClassList(boost::shared_ptr<zeitgeist::Leaf> leaf, TClassList& clList) const; void GenEntries(boost::shared_ptr<zeitgeist::Leaf> leaf, const TClassList& clList, TEntryList& entries) const; protected: void GenLeafEntries(boost::shared_ptr<zeitgeist::Leaf> leaf, TEntryList& entries) const; void GenClassEntries(boost::shared_ptr<zeitgeist::Leaf> leaf, TEntryList& entries) const; void GenBaseNodeEntries(boost::shared_ptr<zeitgeist::Leaf> leaf, TEntryList& entries) const; void GenTransformEntries(boost::shared_ptr<zeitgeist::Leaf> leaf, TEntryList& entries) const; void GetClassList(boost::shared_ptr<zeitgeist::Class> cl, TClassList& clList) const; void Init(); protected: TClassMap mClassMap; }; |
From: Markus R. <rol...@us...> - 2006-01-22 12:15:13
|
Update of /cvsroot/simspark/simspark/spark/zeitgeist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4526 Modified Files: class.h class.cpp Log Message: - made TCommandMap public - added method GetCommandMap that returns the map of registered functions - added method GetBundle that returns the bundle associated with this class Index: class.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/zeitgeist/class.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** class.cpp 5 Dec 2005 20:59:18 -0000 1.1 --- class.cpp 22 Jan 2006 12:14:57 -0000 1.2 *************** *** 132,135 **** --- 132,140 ---- } + const Class::TCommandMap& Class::GetCommandMap() const + { + return mFunctions; + } + Class::TCmdProc Class::GetCmdProc(const std::string &functionName) const { *************** *** 219,220 **** --- 224,230 ---- return false; } + + boost::shared_ptr<salt::SharedLibrary> Class::GetBundle() const + { + return mBundle; + } Index: class.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/zeitgeist/class.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** class.h 5 Dec 2005 20:59:18 -0000 1.1 --- class.h 22 Jan 2006 12:14:57 -0000 1.2 *************** *** 152,159 **** typedef std::list<std::string> TStringList; - private: - /** defines a list of pointers to object instances */ - typedef std::list< boost::weak_ptr<Object> > TObjectList; - /** defines a mapping from member names to command procedures */ #ifdef HAVE_HASH_MAP --- 152,155 ---- *************** *** 163,166 **** --- 159,167 ---- #endif + private: + /** defines a list of pointers to object instances */ + typedef std::list< boost::weak_ptr<Object> > TObjectList; + + // // functions *************** *** 197,200 **** --- 198,207 ---- bool SupportsCommand(const std::string &name) const; + /** returns the command map of this class */ + const TCommandMap& GetCommandMap() const; + + /** a shared pointer to the bundle, this class object came from */ + boost::shared_ptr<salt::SharedLibrary> GetBundle() const; + protected: /** adds an instance to the local list of instances */ |
From: Markus R. <rol...@us...> - 2006-01-22 12:13:19
|
Update of /cvsroot/simspark/simspark/spark/salt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3949 Modified Files: sharedlibrary.h sharedlibrary.cpp Log Message: - added method GetName() that returns the name of the managed shared library Index: sharedlibrary.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/salt/sharedlibrary.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sharedlibrary.cpp 19 Dec 2005 19:52:24 -0000 1.2 --- sharedlibrary.cpp 22 Jan 2006 12:13:08 -0000 1.3 *************** *** 44,47 **** --- 44,49 ---- } + mName = libName; + return (mLibHandle!=NULL); } *************** *** 62,67 **** --- 64,76 ---- if (mLibHandle) { + mName = ""; ::dlclose(mLibHandle); mLibHandle = NULL; } } + + const std::string& + SharedLibrary::GetName() const + { + return mName; + } Index: sharedlibrary.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/salt/sharedlibrary.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sharedlibrary.h 5 Dec 2005 20:56:00 -0000 1.1 --- sharedlibrary.h 22 Jan 2006 12:13:08 -0000 1.2 *************** *** 78,81 **** --- 78,84 ---- void Close(); + /** returns the name of the library */ + const std::string& GetName() const; + // // members *************** *** 84,87 **** --- 87,93 ---- /** a platform dependent handle to the managed library */ void *mLibHandle; + + /** the name of the library */ + std::string mName; }; |
From: Joschka B. <jbo...@us...> - 2006-01-22 11:57:57
|
Update of /cvsroot/simspark/simspark/spark/plugin/sparkagent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30965 Modified Files: universaljointaction.h universaljointperceptor.cpp Log Message: sync with rcssserver3D Index: universaljointaction.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/plugin/sparkagent/universaljointaction.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** universaljointaction.h 6 Jan 2006 13:57:36 -0000 1.1 --- universaljointaction.h 22 Jan 2006 11:57:40 -0000 1.2 *************** *** 27,31 **** public: UniversalJointAction(const std::string& predicate, float velocity1, float velocity2) ! : ActionObject(predicate), mVelocityAxis1(velocity1), mVelocityAxis2(velocity2) {}; virtual ~UniversalJointAction() {} --- 27,32 ---- public: UniversalJointAction(const std::string& predicate, float velocity1, float velocity2) ! : ActionObject(predicate), mVelocityAxis1(velocity1), mVelocityAxis2(velocity2) ! {}; virtual ~UniversalJointAction() {} *************** *** 33,37 **** float GetMotorVelocity(oxygen::Joint::EAxisIndex idx) { ! if (oxygen::Joint::AI_FIRST) return mVelocityAxis1; else --- 34,38 ---- float GetMotorVelocity(oxygen::Joint::EAxisIndex idx) { ! if (idx == oxygen::Joint::AI_FIRST) return mVelocityAxis1; else Index: universaljointperceptor.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/plugin/sparkagent/universaljointperceptor.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** universaljointperceptor.cpp 6 Jan 2006 13:57:36 -0000 1.1 --- universaljointperceptor.cpp 22 Jan 2006 11:57:40 -0000 1.2 *************** *** 54,59 **** { ParameterList& axisElement = predicate.parameter.AddList(); ! axisElement.AddValue(string("axis")); ! axisElement.AddValue(mJoint->GetAngle(idx)); } --- 54,67 ---- { ParameterList& axisElement = predicate.parameter.AddList(); ! if (idx == Joint::AI_FIRST) ! { ! axisElement.AddValue(string("axis1")); ! axisElement.AddValue(mJoint->GetAngle(Joint::AI_FIRST)); ! } ! else ! { ! axisElement.AddValue(string("axis2")); ! axisElement.AddValue(mJoint->GetAngle(Joint::AI_SECOND)); ! } } *************** *** 61,66 **** { ParameterList& axisElement = predicate.parameter.AddList(); ! axisElement.AddValue(string("rate")); ! axisElement.AddValue(mJoint->GetAngleRate(idx)); } --- 69,82 ---- { ParameterList& axisElement = predicate.parameter.AddList(); ! if (idx == Joint::AI_FIRST) ! { ! axisElement.AddValue(string("rate1")); ! axisElement.AddValue(mJoint->GetAngleRate(Joint::AI_FIRST)); ! } ! else ! { ! axisElement.AddValue(string("rate2")); ! axisElement.AddValue(mJoint->GetAngleRate(Joint::AI_SECOND)); ! } } |
From: Markus R. <rol...@us...> - 2006-01-21 13:54:00
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6470 Modified Files: sparktree.cpp Log Message: - wxWidgets unicode compile fixes (thanks Joschka) Index: sparktree.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparktree.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sparktree.cpp 16 Jan 2006 11:35:55 -0000 1.1 --- sparktree.cpp 21 Jan 2006 13:53:52 -0000 1.2 *************** *** 75,79 **** mCore = spark->GetCore(); ! mRootId = mTree->AddRoot("/"); shared_ptr<Leaf> root = mCore->GetRoot(); --- 75,79 ---- mCore = spark->GetCore(); ! mRootId = mTree->AddRoot(_T("/")); shared_ptr<Leaf> root = mCore->GetRoot(); *************** *** 114,123 **** { shared_ptr<Leaf> child = (*iter); ! wxString label = child->GetName(); shared_ptr<Class> childClass = child->GetClass(); if (childClass.get() != 0) { ! label += " (" + childClass->GetName() + ")"; } --- 114,125 ---- { shared_ptr<Leaf> child = (*iter); ! wxString label(child->GetName().c_str(), wxConvUTF8); shared_ptr<Class> childClass = child->GetClass(); if (childClass.get() != 0) { ! label << _T(" (") ! << wxString(childClass->GetName().c_str(), wxConvUTF8) ! << _T(")"); } *************** *** 144,148 **** } ! location = data->leaf.lock()->GetFullPath(); return true; } --- 146,150 ---- } ! location = wxString(data->leaf.lock()->GetFullPath().c_str(), wxConvUTF8); return true; } |
From: Markus R. <rol...@us...> - 2006-01-16 11:36:21
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2030 Added Files: sparktree.cpp sparktree.h Log Message: - added sparktree. A class that manages a tree control to display the zeitgeist object hierarchy --- NEW FILE: sparktree.h --- /* -*- 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: sparktree.h,v 1.1 2006/01/16 11:35:55 rollmark Exp $ 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 SPARKTREE_H__ #define SPARKTREE_H__ #include <zeitgeist/core.h> #include <wx/treectrl.h> class SparkTree { public: struct ItemData : public wxTreeItemData { public: boost::weak_ptr<zeitgeist::Leaf> leaf; public: ItemData(boost::weak_ptr<zeitgeist::Leaf> l) : wxTreeItemData(), leaf(l) {} }; public: SparkTree(); virtual ~SparkTree(); void Init(wxTreeCtrl* tree); bool CreateChildren(const wxTreeItemId id); bool GetLocation(const wxTreeItemId id, wxString& location); protected: void SetItemData(wxTreeItemId id, boost::weak_ptr<zeitgeist::Leaf> leaf); ItemData* GetItemData(wxTreeItemId id); protected: wxTreeCtrl* mTree; boost::shared_ptr<zeitgeist::Core> mCore; wxTreeItemId mRootId; }; #endif // SPARKTREE_H__ --- NEW FILE: sparktree.cpp --- /* -*- 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: sparktree.cpp,v 1.1 2006/01/16 11:35:55 rollmark Exp $ 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 "sparktree.h" #include "main.h" #include "simspark.h" //! wxWidgets and zeitgeist both use a 'DECLARE_CLASS' macro #undef DECLARE_CLASS #include <zeitgeist/leaf.h> #include <zeitgeist/class.h> using namespace boost; using namespace zeitgeist; SparkTree::SparkTree() : mTree(0) { } SparkTree::~SparkTree() { // remove but don't delete us from the event handler stack of the // tree mTree->PopEventHandler(false); } void SparkTree::SetItemData(wxTreeItemId id, weak_ptr<Leaf> leaf) { ItemData* data = new ItemData(leaf); mTree->SetItemData(id, data); } SparkTree::ItemData* SparkTree::GetItemData(wxTreeItemId id) { ItemData* data = static_cast<ItemData*>(mTree->GetItemData(id)); if ( (data == 0) || (data->leaf.expired()) ) { return 0; } return data; } void SparkTree::Init(wxTreeCtrl* ctrl) { mTree = ctrl; mTree->DeleteAllItems(); shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); if (spark.get() == 0) { return; } mCore = spark->GetCore(); mRootId = mTree->AddRoot("/"); shared_ptr<Leaf> root = mCore->GetRoot(); SetItemData(mRootId, root); if (! root->IsLeaf()) { mTree->SetItemHasChildren(mRootId,true); mTree->Expand(mRootId); } } bool SparkTree::CreateChildren(const wxTreeItemId id) { if (mTree->GetChildrenCount(id) > 0) { // already expanded return true; } ItemData* data = GetItemData(id); if (data == 0) { return false; } const Leaf& leaf = (*data->leaf.lock()); if (leaf.IsLeaf()) { return false; } for ( Leaf::TLeafList::const_iterator iter = leaf.begin(); iter != leaf.end(); ++iter ) { shared_ptr<Leaf> child = (*iter); wxString label = child->GetName(); shared_ptr<Class> childClass = child->GetClass(); if (childClass.get() != 0) { label += " (" + childClass->GetName() + ")"; } wxTreeItemId childId = mTree->AppendItem(id, label); SetItemData(childId, child); if ( (! child->IsLeaf()) && (child->begin() != child->end()) ) { // allow expansion but don't add children yet mTree->SetItemHasChildren(childId,true); } } } bool SparkTree::GetLocation(const wxTreeItemId id, wxString& location) { ItemData* data = GetItemData(id); if (data == 0) { return false; } location = data->leaf.lock()->GetFullPath(); return true; } |
From: Markus R. <rol...@us...> - 2006-01-09 11:28:32
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29981 Modified Files: Makefile.am main.cpp mainframe.cpp mainframe.h rsgedit.wxg simspark.cpp Log Message: - added compiles fixes from Joschka - added object hierarchy tree pane - added show/hide toggles for log and tree panes to menu Index: main.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/main.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** main.cpp 4 Jan 2006 20:31:58 -0000 1.4 --- main.cpp 9 Jan 2006 11:28:24 -0000 1.5 *************** *** 57,61 **** } ! mainframe* frame = new mainframe(NULL, wxID_ANY, "RsgEdit"); // Show the frame --- 57,61 ---- } ! mainframe* frame = new mainframe(NULL, wxID_ANY, _T("RsgEdit")); // Show the frame Index: mainframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mainframe.h 8 Jan 2006 15:37:36 -0000 1.4 --- mainframe.h 9 Jan 2006 11:28:24 -0000 1.5 *************** *** 21,24 **** --- 21,25 ---- #include <wx/wx.h> #include <wx/image.h> + #include "sparktree.h" #ifndef MAINFRAME_H *************** *** 29,36 **** // begin wxGlade: ::dependencies #include <wx/splitter.h> // end wxGlade ! #define ID_SIM_START (wxID_HIGHEST+1) ! #define ID_SIM_PAUSE (wxID_HIGHEST+2) class mainframe: public wxFrame { --- 30,42 ---- // begin wxGlade: ::dependencies #include <wx/splitter.h> + #include <wx/treectrl.h> // end wxGlade ! #define ID_SIM_START (wxID_HIGHEST+10) ! #define ID_SIM_PAUSE (wxID_HIGHEST+11) ! ! #define ID_VIEW_LOG (wxID_HIGHEST+20) ! #define ID_VIEW_TREE (wxID_HIGHEST+21) ! #define ID_VIEW_TOOLBAR (wxID_HIGHEST+22) class mainframe: public wxFrame { *************** *** 60,63 **** --- 66,75 ---- void OnPauseSimulation(wxCommandEvent& event); + void OnViewTree(wxCommandEvent& event); + void OnUpdateViewTree(wxUpdateUIEvent& event); + + void OnViewLog(wxCommandEvent& event); + void OnUpdateViewLog(wxUpdateUIEvent& event); + void OnExit(wxCommandEvent& event); void OnClose( wxCloseEvent& event ); *************** *** 71,82 **** bool CanClose(); protected: // begin wxGlade: mainframe::attributes wxMenuBar* MainFrame_menubar; wxStatusBar* MainFrame_statusbar; SparkGLCanvas* mCanvas; ! wxPanel* window_1_pane_1; wxTextCtrl* mCtrLog; ! wxPanel* window_1_pane_2; wxSplitterWindow* mCtrVertSplitter; // end wxGlade --- 83,105 ---- bool CanClose(); + void OnTreeItemExpanding(wxTreeEvent& event); + void OnTreeSelChanged(wxTreeEvent& event); + + void SplitHor(); + void SplitVert(); + protected: // begin wxGlade: mainframe::attributes wxMenuBar* MainFrame_menubar; wxStatusBar* MainFrame_statusbar; + wxTextCtrl* mCtrLocation; + wxTreeCtrl* mCtrTree; + wxPanel* mLeftPane; SparkGLCanvas* mCanvas; ! wxPanel* mTopPane; wxTextCtrl* mCtrLog; ! wxPanel* mBottomPane; ! wxSplitterWindow* mCtrHorSplitter; ! wxPanel* mRightPane; wxSplitterWindow* mCtrVertSplitter; // end wxGlade *************** *** 85,88 **** --- 108,115 ---- wxTimer mTimer; wxToolBar* mToolBar; + SparkTree mSparkTree; + + int mLastHorSashPosition; + int mLastVertSashPosition; DECLARE_EVENT_TABLE() Index: simspark.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/simspark.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** simspark.cpp 8 Jan 2006 15:37:37 -0000 1.3 --- simspark.cpp 9 Jan 2006 11:28:24 -0000 1.4 *************** *** 78,82 **** wxString SimSpark::GetLogBuffer() { ! return wxString(mLogStream.str().c_str()); } --- 78,82 ---- wxString SimSpark::GetLogBuffer() { ! return wxString(mLogStream.str().c_str(), wxConvUTF8); } Index: rsgedit.wxg =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/rsgedit.wxg,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rsgedit.wxg 8 Jan 2006 15:37:37 -0000 1.2 --- rsgedit.wxg 9 Jan 2006 11:28:24 -0000 1.3 *************** *** 1,4 **** <?xml version="1.0"?> ! <!-- generated by wxGlade 0.4 on Sun Jan 8 16:37:09 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"> --- 1,4 ---- <?xml version="1.0"?> ! <!-- generated by wxGlade 0.4 on Sun Jan 8 22:39:29 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"> *************** *** 43,70 **** <option>1</option> <object class="wxSplitterWindow" name="mCtrVertSplitter" base="EditSplitterWindow"> ! <style>wxSP_3D|wxSP_BORDER|wxSP_LIVE_UPDATE</style> ! <orientation>wxSPLIT_HORIZONTAL</orientation> ! <window_2>window_1_pane_2</window_2> ! <window_1>window_1_pane_1</window_1> ! <object class="wxPanel" name="window_1_pane_1" base="EditPanel"> <style>wxTAB_TRAVERSAL</style> ! <object class="wxBoxSizer" name="sizer_3" base="EditBoxSizer"> ! <orient>wxHORIZONTAL</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 class="wxPanel" name="window_1_pane_2" base="EditPanel"> <style>wxTAB_TRAVERSAL</style> ! <object class="wxBoxSizer" name="sizer_4" base="EditBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> --- 43,68 ---- <option>1</option> <object class="wxSplitterWindow" name="mCtrVertSplitter" base="EditSplitterWindow"> ! <style>wxSP_3D|wxSP_BORDER</style> ! <orientation>wxSPLIT_VERTICAL</orientation> ! <window_2>rightPane</window_2> ! <window_1>leftPane</window_1> ! <object class="wxPanel" name="leftPane" base="EditPanel"> <style>wxTAB_TRAVERSAL</style> ! <object class="wxBoxSizer" name="sizer_7" base="EditBoxSizer"> ! <orient>wxVERTICAL</orient> <object class="sizeritem"> <flag>wxEXPAND</flag> <border>0</border> <option>1</option> ! <object class="wxTreeCtrl" name="mCtrTree" base="EditTreeCtrl"> ! <style>wxTR_HAS_BUTTONS|wxTR_NO_LINES|wxTR_DEFAULT_STYLE|wxSUNKEN_BORDER</style> ! <id>1</id> </object> </object> </object> </object> ! <object class="wxPanel" name="rightPane" base="EditPanel"> <style>wxTAB_TRAVERSAL</style> ! <object class="wxBoxSizer" name="sizer_2" base="EditBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> *************** *** 72,77 **** <border>0</border> <option>1</option> ! <object class="wxTextCtrl" name="mCtrLog" base="EditTextCtrl"> ! <style>wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL|wxTE_LINEWRAP</style> </object> </object> --- 70,109 ---- <border>0</border> <option>1</option> ! <object class="wxSplitterWindow" name="mCtrHorSplitter" base="EditSplitterWindow"> ! <style>wxSP_3D|wxSP_BORDER</style> ! <orientation>wxSPLIT_HORIZONTAL</orientation> ! <window_2>bottomPane</window_2> ! <window_1>topPane</window_1> ! <object class="wxPanel" name="topPane" base="EditPanel"> ! <style>wxTAB_TRAVERSAL</style> ! <object class="wxBoxSizer" name="sizer_5" 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 class="wxPanel" name="bottomPane" base="EditPanel"> ! <style>wxTAB_TRAVERSAL</style> ! <object class="wxBoxSizer" name="sizer_6" base="EditBoxSizer"> ! <orient>wxVERTICAL</orient> ! <object class="sizeritem"> ! <flag>wxEXPAND</flag> ! <border>0</border> ! <option>1</option> ! <object class="wxTextCtrl" name="mCtrLog" base="EditTextCtrl"> ! <style>wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL|wxTE_LINEWRAP</style> ! </object> ! </object> ! </object> ! </object> </object> </object> Index: Makefile.am =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.am 2 Jan 2006 20:28:49 -0000 1.2 --- Makefile.am 9 Jan 2006 11:28:24 -0000 1.3 *************** *** 23,27 **** simspark.cpp\ sparkglrender.cpp\ ! inputwx.cpp --- 23,29 ---- simspark.cpp\ sparkglrender.cpp\ ! inputwx.cpp\ ! sparktree.cpp ! Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mainframe.cpp 8 Jan 2006 15:37:36 -0000 1.5 --- mainframe.cpp 9 Jan 2006 11:28:24 -0000 1.6 *************** *** 45,49 **** --- 45,59 ---- EVT_MENU(ID_SIM_PAUSE, mainframe::OnPauseSimulation) + EVT_MENU(ID_VIEW_LOG, mainframe::OnViewLog) + EVT_UPDATE_UI(ID_VIEW_LOG, mainframe::OnUpdateViewLog) + + EVT_MENU(ID_VIEW_TREE, mainframe::OnViewTree) + EVT_UPDATE_UI(ID_VIEW_TREE, mainframe::OnUpdateViewTree) + EVT_TIMER(1, mainframe::OnLogTimer) + + EVT_TREE_ITEM_EXPANDING(1, mainframe::OnTreeItemExpanding) + EVT_TREE_SEL_CHANGED(1, mainframe::OnTreeSelChanged) + END_EVENT_TABLE() *************** *** 58,61 **** --- 68,74 ---- static const int LOGWND_UPDATE_INTERVAL = 100; + // the default width of the tree window pane [pixel] + static const int TREEWND_DEFAULT_WIDTH = 150; + 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), *************** *** 63,69 **** { // begin wxGlade: mainframe::mainframe ! mCtrVertSplitter = new wxSplitterWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxSP_3D|wxSP_BORDER|wxSP_LIVE_UPDATE); ! window_1_pane_2 = new wxPanel(mCtrVertSplitter, -1); ! window_1_pane_1 = new wxPanel(mCtrVertSplitter, -1); MainFrame_menubar = new wxMenuBar(); SetMenuBar(MainFrame_menubar); --- 76,85 ---- { // begin wxGlade: mainframe::mainframe ! mCtrVertSplitter = new wxSplitterWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxSP_3D|wxSP_BORDER); ! mRightPane = new wxPanel(mCtrVertSplitter, -1); ! mCtrHorSplitter = new wxSplitterWindow(mRightPane, -1, wxDefaultPosition, wxDefaultSize, wxSP_3D|wxSP_BORDER); ! mBottomPane = new wxPanel(mCtrHorSplitter, -1); ! mTopPane = new wxPanel(mCtrHorSplitter, -1); ! mLeftPane = new wxPanel(mCtrVertSplitter, -1); MainFrame_menubar = new wxMenuBar(); SetMenuBar(MainFrame_menubar); *************** *** 72,81 **** MainFrame_menubar->Append(wxglade_tmp_menu_1, wxT("&File")); wxMenu* wxglade_tmp_menu_2 = new wxMenu(); ! wxglade_tmp_menu_2->Append(ID_SIM_START, wxT("&Start"), wxT("Start simulation"), wxITEM_NORMAL); ! wxglade_tmp_menu_2->Append(ID_SIM_PAUSE, wxT("&Pause"), wxT("Pause Simulation"), wxITEM_NORMAL); ! MainFrame_menubar->Append(wxglade_tmp_menu_2, wxT("&Simulation")); MainFrame_statusbar = CreateStatusBar(1, 0); ! mCanvas = new SparkGLCanvas(window_1_pane_1, -1); ! mCtrLog = new wxTextCtrl(window_1_pane_2, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL|wxTE_LINEWRAP); set_properties(); --- 88,103 ---- MainFrame_menubar->Append(wxglade_tmp_menu_1, wxT("&File")); wxMenu* wxglade_tmp_menu_2 = new wxMenu(); ! wxglade_tmp_menu_2->Append(ID_VIEW_LOG, wxT("message &log"), wxT("Show/Hide message log"), wxITEM_CHECK); ! wxglade_tmp_menu_2->Append(ID_VIEW_TREE, wxT("object &tree"), wxT("Show/Hide object tree"), wxITEM_CHECK); ! MainFrame_menubar->Append(wxglade_tmp_menu_2, wxT("&View")); ! wxMenu* wxglade_tmp_menu_3 = new wxMenu(); ! wxglade_tmp_menu_3->Append(ID_SIM_START, wxT("&Start"), wxT("Start simulation"), wxITEM_NORMAL); ! wxglade_tmp_menu_3->Append(ID_SIM_PAUSE, wxT("&Pause"), wxT("Pause Simulation"), wxITEM_NORMAL); ! MainFrame_menubar->Append(wxglade_tmp_menu_3, wxT("&Simulation")); MainFrame_statusbar = CreateStatusBar(1, 0); ! mCtrLocation = new wxTextCtrl(mLeftPane, -1, wxT("")); ! mCtrTree = new wxTreeCtrl(mLeftPane, 1, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS|wxTR_NO_LINES|wxTR_DEFAULT_STYLE|wxSUNKEN_BORDER); ! mCanvas = new SparkGLCanvas(mTopPane, -1); ! mCtrLog = new wxTextCtrl(mBottomPane, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL|wxTE_LINEWRAP); set_properties(); *************** *** 92,101 **** mToolBar->Realize(); ! // init vertical splitterwindow wxSize szClient = GetClientSize(); ! mCtrVertSplitter->SetSashPosition(std::max<int>(1,szClient.y - LOGWND_DEFAULT_HEIGHT)); ! // only resize top pane, when window is resized ! mCtrVertSplitter->SetSashGravity(1.0); // init log wnd timer --- 114,130 ---- mToolBar->Realize(); ! // ! // init horizontal splitterwindow (glcanvas / logwnd) wxSize szClient = GetClientSize(); ! mLastHorSashPosition = std::max<int>(1,szClient.y - LOGWND_DEFAULT_HEIGHT); ! SplitHor(); ! // init vertical splitterwindow ! mLastVertSashPosition = std::max<int>(1,TREEWND_DEFAULT_WIDTH); ! SplitVert(); ! ! // ! // init spark tree ! mSparkTree.Init(mCtrTree); // init log wnd timer *************** *** 103,106 **** --- 132,153 ---- } + void mainframe::SplitHor() + { + mCtrHorSplitter->SplitHorizontally(mTopPane, mBottomPane); + mCtrHorSplitter->SetSashPosition(mLastHorSashPosition); + + // only resize top pane, when window is resized + mCtrHorSplitter->SetSashGravity(1.0); + } + + void mainframe::SplitVert() + { + mCtrVertSplitter->SplitVertically(mLeftPane, mRightPane); + mCtrVertSplitter->SetSashPosition(mLastVertSashPosition); + + // only resize right pane when window is resized + mCtrVertSplitter->SetSashGravity(0.0); + } + void mainframe::set_properties() { *************** *** 123,139 **** // begin wxGlade: mainframe::do_layout wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL); ! wxBoxSizer* sizer_4 = new wxBoxSizer(wxVERTICAL); ! wxBoxSizer* sizer_3 = new wxBoxSizer(wxHORIZONTAL); ! sizer_3->Add(mCanvas, 1, wxEXPAND, 0); ! window_1_pane_1->SetAutoLayout(true); ! window_1_pane_1->SetSizer(sizer_3); ! sizer_3->Fit(window_1_pane_1); ! sizer_3->SetSizeHints(window_1_pane_1); ! sizer_4->Add(mCtrLog, 1, wxEXPAND, 0); ! window_1_pane_2->SetAutoLayout(true); ! window_1_pane_2->SetSizer(sizer_4); ! sizer_4->Fit(window_1_pane_2); ! sizer_4->SetSizeHints(window_1_pane_2); ! mCtrVertSplitter->SplitHorizontally(window_1_pane_1, window_1_pane_2); sizer_1->Add(mCtrVertSplitter, 1, wxEXPAND, 0); SetAutoLayout(true); --- 170,200 ---- // begin wxGlade: mainframe::do_layout wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL); ! wxBoxSizer* sizer_2 = new wxBoxSizer(wxVERTICAL); ! wxBoxSizer* sizer_6 = new wxBoxSizer(wxVERTICAL); ! wxBoxSizer* sizer_5 = new wxBoxSizer(wxVERTICAL); ! wxBoxSizer* sizer_7 = new wxBoxSizer(wxVERTICAL); ! sizer_7->Add(mCtrLocation, 0, wxEXPAND|wxADJUST_MINSIZE, 0); ! sizer_7->Add(mCtrTree, 1, wxEXPAND, 0); ! mLeftPane->SetAutoLayout(true); ! mLeftPane->SetSizer(sizer_7); ! sizer_7->Fit(mLeftPane); ! sizer_7->SetSizeHints(mLeftPane); ! sizer_5->Add(mCanvas, 1, wxEXPAND, 0); ! mTopPane->SetAutoLayout(true); ! mTopPane->SetSizer(sizer_5); ! sizer_5->Fit(mTopPane); ! sizer_5->SetSizeHints(mTopPane); ! sizer_6->Add(mCtrLog, 1, wxEXPAND, 0); ! mBottomPane->SetAutoLayout(true); ! mBottomPane->SetSizer(sizer_6); ! sizer_6->Fit(mBottomPane); ! sizer_6->SetSizeHints(mBottomPane); ! mCtrHorSplitter->SplitHorizontally(mTopPane, mBottomPane); ! sizer_2->Add(mCtrHorSplitter, 1, wxEXPAND, 0); ! mRightPane->SetAutoLayout(true); ! mRightPane->SetSizer(sizer_2); ! sizer_2->Fit(mRightPane); ! sizer_2->SetSizeHints(mRightPane); ! mCtrVertSplitter->SplitVertically(mLeftPane, mRightPane); sizer_1->Add(mCtrVertSplitter, 1, wxEXPAND, 0); SetAutoLayout(true); *************** *** 303,308 **** --- 364,420 ---- } + void mainframe::OnTreeItemExpanding(wxTreeEvent& event) + { + if (! mSparkTree.CreateChildren(event.GetItem())) + { + event.Veto(); + return; + } + } + void mainframe::OnTreeSelChanged(wxTreeEvent& event) + { + wxString location; + if (! mSparkTree.GetLocation(event.GetItem(), location)) + { + location = _T("?"); + } + + mCtrLocation->SetValue(location); + } + + + void mainframe::OnUpdateViewTree(wxUpdateUIEvent& event) + { + event.Check(mCtrVertSplitter->IsSplit()); + } + + void mainframe::OnViewTree(wxCommandEvent& event) + { + if (mCtrVertSplitter->IsSplit()) + { + mLastVertSashPosition = mCtrVertSplitter->GetSashPosition(); + mCtrVertSplitter->Unsplit(mLeftPane); + } else + { + SplitVert(); + } + } + void mainframe::OnUpdateViewLog(wxUpdateUIEvent& event) + { + event.Check(mCtrHorSplitter->IsSplit()); + } + void mainframe::OnViewLog(wxCommandEvent& event) + { + if (mCtrHorSplitter->IsSplit()) + { + mLastHorSashPosition = mCtrHorSplitter->GetSashPosition(); + mCtrHorSplitter->Unsplit(mBottomPane); + } else + { + SplitHor(); + } + } |
From: Markus R. <rol...@us...> - 2006-01-08 15:37:45
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5373 Modified Files: mainframe.cpp mainframe.h rsgedit.wxg simspark.cpp simspark.h Log Message: - splitted the main window into two panes, using the lower pane to display log messages from the LogServer Index: simspark.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/simspark.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** simspark.cpp 8 Jan 2006 14:15:27 -0000 1.2 --- simspark.cpp 8 Jan 2006 15:37:37 -0000 1.3 *************** *** 20,29 **** --- 20,33 ---- #include "simspark.h" #include <zeitgeist/scriptserver/scriptserver.h> + #include <zeitgeist/logserver/logserver.h> #include <oxygen/simulationserver/simulationserver.h> using namespace std; using namespace boost; + using namespace zeitgeist; using namespace spark; + ostringstream SimSpark::mLogStream; + SimSpark::SimSpark(const string& relPathPrefix) : Spark(relPathPrefix) *************** *** 34,38 **** bool SimSpark::InitApp(int argc, char** argv) { ! GetSimulationServer()->SetSimStep(0.02); PrintGreeting(); --- 38,42 ---- bool SimSpark::InitApp(int argc, char** argv) { ! GetLog()->AddStream(&mLogStream, LogServer::eAll); PrintGreeting(); *************** *** 71,72 **** --- 75,91 ---- mState = state; } + + wxString SimSpark::GetLogBuffer() + { + return wxString(mLogStream.str().c_str()); + } + + void SimSpark::ClearLogBuffer() + { + mLogStream.str(string()); + } + + bool SimSpark::HasLogContents() + { + return (! mLogStream.str().empty()); + } Index: mainframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mainframe.h 8 Jan 2006 14:15:27 -0000 1.3 --- mainframe.h 8 Jan 2006 15:37:36 -0000 1.4 *************** *** 1,3 **** ! /* -*- 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> --- 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. ! */ // -*- C++ -*- generated by wxGlade 0.4 on Wed Jan 4 20:26:10 2006 #include <wx/wx.h> *************** *** 10,13 **** --- 28,32 ---- // begin wxGlade: ::dependencies + #include <wx/splitter.h> // end wxGlade *************** *** 44,47 **** --- 63,71 ---- void OnClose( wxCloseEvent& event ); + void OnLogTimer(wxTimerEvent& event); + + /** appends the accumulated log buffer to the log window pane */ + void UpdateLogWindow(); + /** returns true iff its safe to close this frame now */ bool CanClose(); *************** *** 52,56 **** wxStatusBar* MainFrame_statusbar; SparkGLCanvas* mCanvas; ! wxPanel* panel_1; // end wxGlade --- 76,83 ---- wxStatusBar* MainFrame_statusbar; SparkGLCanvas* mCanvas; ! wxPanel* window_1_pane_1; ! wxTextCtrl* mCtrLog; ! wxPanel* window_1_pane_2; ! wxSplitterWindow* mCtrVertSplitter; // end wxGlade Index: simspark.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/simspark.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** simspark.h 8 Jan 2006 14:15:27 -0000 1.2 --- simspark.h 8 Jan 2006 15:37:37 -0000 1.3 *************** *** 7,15 **** 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 Founda shared_ptr<SimulationServer> sim = spark->GetSimulationServer(); ! if (sim.get() == 0) ! { ! return; ! tion; version 2 of the License. This program is distributed in the hope that it will be useful, --- 7,11 ---- 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, *************** *** 26,29 **** --- 22,27 ---- #include <spark/spark.h> + #include <wx/string.h> + #include <sstream> class SimSpark : public spark::Spark *************** *** 57,63 **** --- 55,73 ---- void SetSimState(ESimState state); + /** returns true iff the log buffer is filled */ + static bool HasLogContents(); + + /** returns the current log buffer */ + static wxString GetLogBuffer(); + + /** clears the log buffer */ + static void ClearLogBuffer(); + protected: //! the state of the current simulation ESimState mState; + + //! log buffer + static std::ostringstream mLogStream; }; Index: rsgedit.wxg =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/rsgedit.wxg,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** rsgedit.wxg 4 Jan 2006 20:31:58 -0000 1.1 --- rsgedit.wxg 8 Jan 2006 15:37:37 -0000 1.2 *************** *** 1,4 **** <?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"> --- 1,4 ---- <?xml version="1.0"?> ! <!-- generated by wxGlade 0.4 on Sun Jan 8 16:37:09 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"> *************** *** 17,22 **** --- 17,39 ---- </item> </menu> + <menu name="" label="&Simulation"> + <item> + <label>&Start</label> + <id>ID_SIM_START</id> + <help_str>Start simulation</help_str> + </item> + <item> + <label>&Pause</label> + <id>ID_SIM_PAUSE</id> + <help_str>Pause Simulation</help_str> + </item> + </menu> </menus> </object> + <object class="wxStatusBar" name="MainFrame_statusbar" base="EditStatusBar"> + <fields> + <field width="0">Welcome to RsgEdit</field> + </fields> + </object> <object class="wxBoxSizer" name="sizer_1" base="EditBoxSizer"> <orient>wxVERTICAL</orient> *************** *** 25,41 **** <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> --- 42,78 ---- <border>0</border> <option>1</option> ! <object class="wxSplitterWindow" name="mCtrVertSplitter" base="EditSplitterWindow"> ! <style>wxSP_3D|wxSP_BORDER|wxSP_LIVE_UPDATE</style> ! <orientation>wxSPLIT_HORIZONTAL</orientation> ! <window_2>window_1_pane_2</window_2> ! <window_1>window_1_pane_1</window_1> ! <object class="wxPanel" name="window_1_pane_1" base="EditPanel"> ! <style>wxTAB_TRAVERSAL</style> ! <object class="wxBoxSizer" name="sizer_3" base="EditBoxSizer"> ! <orient>wxHORIZONTAL</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 class="wxPanel" name="window_1_pane_2" base="EditPanel"> ! <style>wxTAB_TRAVERSAL</style> ! <object class="wxBoxSizer" name="sizer_4" base="EditBoxSizer"> ! <orient>wxVERTICAL</orient> ! <object class="sizeritem"> ! <flag>wxEXPAND</flag> ! <border>0</border> ! <option>1</option> ! <object class="wxTextCtrl" name="mCtrLog" base="EditTextCtrl"> ! <style>wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL|wxTE_LINEWRAP</style> ! </object> </object> </object> *************** *** 44,52 **** </object> </object> - <object class="wxStatusBar" name="MainFrame_statusbar" base="EditStatusBar"> - <fields> - <field width="0">Welcome to RsgEdit</field> - </fields> - </object> </object> </application> --- 81,84 ---- Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mainframe.cpp 8 Jan 2006 14:15:27 -0000 1.4 --- mainframe.cpp 8 Jan 2006 15:37:36 -0000 1.5 *************** *** 1,3 **** ! /* -*- 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 "mainframe.h" --- 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. ! */ // -*- C++ -*- generated by wxGlade 0.4 on Wed Jan 4 20:26:10 2006 #include "mainframe.h" *************** *** 11,14 **** --- 29,33 ---- #undef DECLARE_CLASS + #include <zeitgeist/logserver/logserver.h> #include <oxygen/simulationserver/simulationserver.h> #include <oxygen/sceneserver/sceneserver.h> *************** *** 25,28 **** --- 44,49 ---- EVT_UPDATE_UI(ID_SIM_PAUSE, mainframe::OnUpdatePauseSimulation) EVT_MENU(ID_SIM_PAUSE, mainframe::OnPauseSimulation) + + EVT_TIMER(1, mainframe::OnLogTimer) END_EVENT_TABLE() *************** *** 31,34 **** --- 52,61 ---- using namespace oxygen; + // the default height of the log window pane [pixel] + static const int LOGWND_DEFAULT_HEIGHT = 80; + + // the update interval of the log window [milliseconds} + static const int LOGWND_UPDATE_INTERVAL = 100; + 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), *************** *** 36,40 **** { // begin wxGlade: mainframe::mainframe ! panel_1 = new wxPanel(this, -1); MainFrame_menubar = new wxMenuBar(); SetMenuBar(MainFrame_menubar); --- 63,69 ---- { // begin wxGlade: mainframe::mainframe ! mCtrVertSplitter = new wxSplitterWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxSP_3D|wxSP_BORDER|wxSP_LIVE_UPDATE); ! window_1_pane_2 = new wxPanel(mCtrVertSplitter, -1); ! window_1_pane_1 = new wxPanel(mCtrVertSplitter, -1); MainFrame_menubar = new wxMenuBar(); SetMenuBar(MainFrame_menubar); *************** *** 47,51 **** MainFrame_menubar->Append(wxglade_tmp_menu_2, wxT("&Simulation")); MainFrame_statusbar = CreateStatusBar(1, 0); ! mCanvas = new SparkGLCanvas(panel_1, -1); set_properties(); --- 76,81 ---- MainFrame_menubar->Append(wxglade_tmp_menu_2, wxT("&Simulation")); MainFrame_statusbar = CreateStatusBar(1, 0); ! mCanvas = new SparkGLCanvas(window_1_pane_1, -1); ! mCtrLog = new wxTextCtrl(window_1_pane_2, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL|wxTE_LINEWRAP); set_properties(); *************** *** 53,56 **** --- 83,87 ---- // end wxGlade + // create toolbar mToolBar = new wxToolBar(this,-1); SetToolBar(mToolBar); *************** *** 60,63 **** --- 91,104 ---- mToolBar->Realize(); + + // init vertical splitterwindow + wxSize szClient = GetClientSize(); + mCtrVertSplitter->SetSashPosition(std::max<int>(1,szClient.y - LOGWND_DEFAULT_HEIGHT)); + + // only resize top pane, when window is resized + mCtrVertSplitter->SetSashGravity(1.0); + + // init log wnd timer + mTimer.Start(LOGWND_UPDATE_INTERVAL); } *************** *** 82,92 **** // 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); --- 123,140 ---- // begin wxGlade: mainframe::do_layout wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL); ! wxBoxSizer* sizer_4 = new wxBoxSizer(wxVERTICAL); ! wxBoxSizer* sizer_3 = new wxBoxSizer(wxHORIZONTAL); ! sizer_3->Add(mCanvas, 1, wxEXPAND, 0); ! window_1_pane_1->SetAutoLayout(true); ! window_1_pane_1->SetSizer(sizer_3); ! sizer_3->Fit(window_1_pane_1); ! sizer_3->SetSizeHints(window_1_pane_1); ! sizer_4->Add(mCtrLog, 1, wxEXPAND, 0); ! window_1_pane_2->SetAutoLayout(true); ! window_1_pane_2->SetSizer(sizer_4); ! sizer_4->Fit(window_1_pane_2); ! sizer_4->SetSizeHints(window_1_pane_2); ! mCtrVertSplitter->SplitHorizontally(window_1_pane_1, window_1_pane_2); ! sizer_1->Add(mCtrVertSplitter, 1, wxEXPAND, 0); SetAutoLayout(true); SetSizer(sizer_1); *************** *** 159,162 **** --- 207,228 ---- } + void mainframe::OnLogTimer(wxTimerEvent& /*event*/) + { + UpdateLogWindow(); + } + + void mainframe::UpdateLogWindow() + { + if (! SimSpark::HasLogContents()) + { + return; + } + + wxString buffer = SimSpark::GetLogBuffer(); + SimSpark::ClearLogBuffer(); + mCtrLog->AppendText(buffer); + mCtrLog->ShowPosition(mCtrLog->GetLastPosition() + 1); + } + void mainframe::PauseSimulation() { *************** *** 178,181 **** --- 244,248 ---- sim->Quit(); + spark->GetLog()->Normal() << "(RsgEdit) pausing simulation\n"; } *************** *** 207,213 **** --- 274,282 ---- } + sim->SetSimStep(0.0); sim->Init(0,0); sim->SetAutoTimeMode(false); + spark->GetLog()->Normal() << "(RsgEdit) starting simulation\n"; wxLongLong tLast = wxGetLocalTimeMillis(); *************** *** 231,234 **** --- 300,304 ---- sim->Done(); spark->SetSimState(SimSpark::S_PAUSED); + spark->GetLog()->Normal() << "(RsgEdit) simulation paused\n"; } *************** *** 236,237 **** --- 306,308 ---- + |
From: Markus R. <rol...@us...> - 2006-01-08 14:15:43
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21348 Modified Files: mainframe.cpp mainframe.h simspark.cpp simspark.h sparkglcanvas.cpp sparkglcanvas.h Log Message: - rsgedit no longer crashes, when window is closed via it's decoration - added toolbar buttons and menu entries to start and pause the simulation - the simulation is initially paused Index: mainframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mainframe.h 4 Jan 2006 20:31:58 -0000 1.2 --- mainframe.h 8 Jan 2006 14:15:27 -0000 1.3 *************** *** 12,15 **** --- 12,18 ---- // end wxGlade + #define ID_SIM_START (wxID_HIGHEST+1) + #define ID_SIM_PAUSE (wxID_HIGHEST+2) + class mainframe: public wxFrame { public: *************** *** 19,24 **** 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 --- 22,25 ---- *************** *** 28,43 **** 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() --- 29,61 ---- protected: ! /** start and run simulation */ ! void StartSimulation(); ! ! /** pause a running simulation */ ! void PauseSimulation(); ! ! void OnUpdateStartSimulation(wxUpdateUIEvent& event); ! void OnStartSimulation(wxCommandEvent& event); ! ! void OnUpdatePauseSimulation(wxUpdateUIEvent& event); ! void OnPauseSimulation(wxCommandEvent& event); ! ! void OnExit(wxCommandEvent& event); ! void OnClose( wxCloseEvent& event ); ! ! /** returns true iff its safe to close this frame now */ ! bool CanClose(); protected: // begin wxGlade: mainframe::attributes wxMenuBar* MainFrame_menubar; + wxStatusBar* MainFrame_statusbar; SparkGLCanvas* mCanvas; wxPanel* panel_1; // end wxGlade protected: wxTimer mTimer; + wxToolBar* mToolBar; DECLARE_EVENT_TABLE() Index: sparkglcanvas.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkglcanvas.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sparkglcanvas.cpp 2 Jan 2006 20:28:49 -0000 1.2 --- sparkglcanvas.cpp 8 Jan 2006 14:15:27 -0000 1.3 *************** *** 22,26 **** #include "sparkglcanvas.h" #include "simspark.h" - #include "inputwx.h" //! wxWidgets and zeitgeist both use a 'DECLARE_CLASS' macro --- 22,25 ---- *************** *** 140,150 **** { event.Skip(); ! if (mInputSystem.get() == 0) ! { ! return; ! } ! ! wxInput input(event,true); ! mInputSystem->AddInput(input); } --- 139,143 ---- { event.Skip(); ! AddInput(wxInput(event,true)); } *************** *** 152,162 **** { event.Skip(); ! if (mInputSystem.get() == 0) ! { ! return; ! } ! ! wxInput input(event,false); ! mInputSystem->AddInput(input); } --- 145,149 ---- { event.Skip(); ! AddInput(wxInput(event,false)); } *************** *** 164,175 **** { event.Skip(); - if (mInputSystem.get() == 0) - { - return; - } Input input(Input::eButton, Input::IC_MOUSE_LEFT, 1); input.mData.l = 1; ! mInputSystem->AddInput(input); } --- 151,159 ---- { event.Skip(); Input input(Input::eButton, Input::IC_MOUSE_LEFT, 1); input.mData.l = 1; ! ! AddInput(input); } *************** *** 177,188 **** { event.Skip(); - if (mInputSystem.get() == 0) - { - return; - } Input input(Input::eButton, Input::IC_MOUSE_LEFT); input.mData.l = 0; ! mInputSystem->AddInput(input); } --- 161,169 ---- { event.Skip(); Input input(Input::eButton, Input::IC_MOUSE_LEFT); input.mData.l = 0; ! ! AddInput(input); } *************** *** 190,201 **** { event.Skip(); - if (mInputSystem.get() == 0) - { - return; - } - Input input(Input::eButton, Input::IC_MOUSE_MIDDLE); input.mData.l = 1; ! mInputSystem->AddInput(input); } --- 171,178 ---- { event.Skip(); Input input(Input::eButton, Input::IC_MOUSE_MIDDLE); input.mData.l = 1; ! ! AddInput(input); } *************** *** 203,214 **** { event.Skip(); - if (mInputSystem.get() == 0) - { - return; - } Input input(Input::eButton, Input::IC_MOUSE_MIDDLE); input.mData.l = 0; ! mInputSystem->AddInput(input); } --- 180,188 ---- { event.Skip(); Input input(Input::eButton, Input::IC_MOUSE_MIDDLE); input.mData.l = 0; ! ! AddInput(input); } *************** *** 216,227 **** { event.Skip(); - if (mInputSystem.get() == 0) - { - return; - } Input input(Input::eButton, Input::IC_MOUSE_RIGHT); input.mData.l = 1; ! mInputSystem->AddInput(input); } --- 190,198 ---- { event.Skip(); Input input(Input::eButton, Input::IC_MOUSE_RIGHT); input.mData.l = 1; ! ! AddInput(input); } *************** *** 229,240 **** { event.Skip(); - if (mInputSystem.get() == 0) - { - return; - } Input input(Input::eButton, Input::IC_MOUSE_RIGHT, 0); input.mData.l = 0; ! mInputSystem->AddInput(input); } --- 200,208 ---- { event.Skip(); Input input(Input::eButton, Input::IC_MOUSE_RIGHT, 0); input.mData.l = 0; ! ! AddInput(input); } *************** *** 255,267 **** } - if (mInputSystem.get() == 0) - { - return; - } - { Input input(Input::eAxis, Input::IC_AXISX); input.mData.l = (event.GetX() - lastX); ! mInputSystem->AddInput(input); } --- 223,230 ---- } { Input input(Input::eAxis, Input::IC_AXISX); input.mData.l = (event.GetX() - lastX); ! AddInput(input); } *************** *** 269,273 **** Input input(Input::eAxis, Input::IC_AXISY); input.mData.l = (event.GetY() - lastY); ! mInputSystem->AddInput(input); } --- 232,236 ---- Input input(Input::eAxis, Input::IC_AXISY); input.mData.l = (event.GetY() - lastY); ! AddInput(input); } *************** *** 276,277 **** --- 239,258 ---- } + void SparkGLCanvas::AddInput(const kerosin::Input& input) + { + if (mInputSystem.get() == 0) + { + return; + } + + shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); + if ( + (spark.get() == 0) || + (spark->GetSimState() != SimSpark::S_RUNNING) + ) + { + return; + } + + mInputSystem->AddInput(input); + } Index: simspark.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/simspark.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** simspark.cpp 25 Dec 2005 15:06:28 -0000 1.1 --- simspark.cpp 8 Jan 2006 14:15:27 -0000 1.2 *************** *** 29,32 **** --- 29,33 ---- Spark(relPathPrefix) { + mState = S_PAUSED; } *************** *** 60,61 **** --- 61,72 ---- return true; } + + SimSpark::ESimState SimSpark::GetSimState() const + { + return mState; + } + + void SimSpark::SetSimState(ESimState state) + { + mState = state; + } Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mainframe.cpp 4 Jan 2006 20:31:58 -0000 1.3 --- mainframe.cpp 8 Jan 2006 14:15:27 -0000 1.4 *************** *** 1,8 **** // -*- C++ -*- generated by wxGlade 0.4 on Wed Jan 4 20:26:10 2006 - #include "mainframe.h" #include "sparkglcanvas.h" #include "main.h" //! wxWidgets and zeitgeist both use a 'DECLARE_CLASS' macro #undef DECLARE_CLASS --- 1,11 ---- + /* -*- 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 "mainframe.h" #include "sparkglcanvas.h" #include "main.h" + #include <rsgedit/res/xpm_play.xpm> + #include <rsgedit/res/xpm_pause.xpm> + //! wxWidgets and zeitgeist both use a 'DECLARE_CLASS' macro #undef DECLARE_CLASS *************** *** 15,19 **** BEGIN_EVENT_TABLE(mainframe, wxFrame) EVT_MENU(wxID_EXIT, mainframe::OnExit) ! EVT_TIMER(1, mainframe::OnTimer) END_EVENT_TABLE() --- 18,28 ---- BEGIN_EVENT_TABLE(mainframe, wxFrame) EVT_MENU(wxID_EXIT, mainframe::OnExit) ! EVT_CLOSE(mainframe::OnClose) ! ! EVT_UPDATE_UI(ID_SIM_START, mainframe::OnUpdateStartSimulation) ! EVT_MENU(ID_SIM_START, mainframe::OnStartSimulation) ! ! EVT_UPDATE_UI(ID_SIM_PAUSE, mainframe::OnUpdatePauseSimulation) ! EVT_MENU(ID_SIM_PAUSE, mainframe::OnPauseSimulation) END_EVENT_TABLE() *************** *** 33,38 **** 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(); --- 42,51 ---- wxglade_tmp_menu_1->Append(wxID_EXIT, wxT("&Exit"), wxT(""), wxITEM_NORMAL); MainFrame_menubar->Append(wxglade_tmp_menu_1, wxT("&File")); ! wxMenu* wxglade_tmp_menu_2 = new wxMenu(); ! wxglade_tmp_menu_2->Append(ID_SIM_START, wxT("&Start"), wxT("Start simulation"), wxITEM_NORMAL); ! wxglade_tmp_menu_2->Append(ID_SIM_PAUSE, wxT("&Pause"), wxT("Pause Simulation"), wxITEM_NORMAL); ! MainFrame_menubar->Append(wxglade_tmp_menu_2, wxT("&Simulation")); MainFrame_statusbar = CreateStatusBar(1, 0); + mCanvas = new SparkGLCanvas(panel_1, -1); set_properties(); *************** *** 40,46 **** // end wxGlade ! // this is a one shot timer to kick off the rendering loop in ! // response to an event ! mTimer.Start(1,true); } --- 53,63 ---- // end wxGlade ! mToolBar = new wxToolBar(this,-1); ! SetToolBar(mToolBar); ! ! mToolBar->AddTool(ID_SIM_START, wxT("Start"), wxBitmap(xpm_play)); ! mToolBar->AddTool(ID_SIM_PAUSE, wxT("Pause"), wxBitmap(xpm_pause)); ! ! mToolBar->Realize(); } *************** *** 61,65 **** } - void mainframe::do_layout() { --- 78,81 ---- *************** *** 79,92 **** } void mainframe::OnExit( wxCommandEvent& WXUNUSED(event) ) { ! // true is to force the frame to close ! Close(true); } ! void mainframe::OnTimer(wxTimerEvent& /*event*/) { shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); ! if (spark.get() == 0) { return; --- 95,170 ---- } + bool mainframe::CanClose() + { + shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); + if ( + (spark.get() != 0) && + (spark->GetSimState() == SimSpark::S_RUNNING) + ) + { + return false; + } + + return true; + } + + void mainframe::OnClose( wxCloseEvent& event ) + { + if (! CanClose()) + { + PauseSimulation(); + event.Veto(); + return; + } + + event.Skip(); + Destroy(); + } + void mainframe::OnExit( wxCommandEvent& WXUNUSED(event) ) { ! Close(); } ! void mainframe::OnUpdateStartSimulation(wxUpdateUIEvent& event) { shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); ! bool enable = ( ! (spark.get() != 0) && ! (spark->GetSimState() == SimSpark::S_PAUSED) ! ); ! ! event.Enable(enable); ! } ! ! void mainframe::OnStartSimulation(wxCommandEvent& /*event*/) ! { ! StartSimulation(); ! } ! ! void mainframe::OnUpdatePauseSimulation(wxUpdateUIEvent& event) ! { ! shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); ! bool enable = ( ! (spark.get() != 0) && ! (spark->GetSimState() == SimSpark::S_RUNNING) ! ); ! ! event.Enable(enable); ! } ! ! void mainframe::OnPauseSimulation(wxCommandEvent& /*event*/) ! { ! PauseSimulation(); ! } ! ! void mainframe::PauseSimulation() ! { ! shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); ! ! if ( ! (spark.get() == 0) || ! (spark->GetSimState() != SimSpark::S_RUNNING) ! ) { return; *************** *** 99,102 **** --- 177,202 ---- } + sim->Quit(); + } + + void mainframe::StartSimulation() + { + shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); + if ( + (spark.get() == 0) || + (spark->GetSimState() != SimSpark::S_PAUSED) + ) + { + return; + } + + shared_ptr<SimulationServer> sim = spark->GetSimulationServer(); + if (sim.get() == 0) + { + return; + } + + spark->SetSimState(SimSpark::S_RUNNING); + // tell the inputControl node the loaction of our camera shared_ptr<InputControl> inputCtr = spark->GetInputControl(); *************** *** 130,136 **** sim->Done(); ! Close(true); } --- 230,237 ---- sim->Done(); ! spark->SetSimState(SimSpark::S_PAUSED); } + Index: sparkglcanvas.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkglcanvas.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sparkglcanvas.h 2 Jan 2006 20:28:49 -0000 1.2 --- sparkglcanvas.h 8 Jan 2006 14:15:27 -0000 1.3 *************** *** 23,26 **** --- 23,27 ---- #include <wx/glcanvas.h> #include "sparkglrender.h" + #include "inputwx.h" namespace kerosin *************** *** 62,65 **** --- 63,67 ---- protected: bool Init(); + void AddInput(const kerosin::Input& input); protected: Index: simspark.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/simspark.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** simspark.h 25 Dec 2005 15:06:28 -0000 1.1 --- simspark.h 8 Jan 2006 14:15:27 -0000 1.2 *************** *** 7,11 **** 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, --- 7,15 ---- 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 Founda shared_ptr<SimulationServer> sim = spark->GetSimulationServer(); ! if (sim.get() == 0) ! { ! return; ! tion; version 2 of the License. This program is distributed in the hope that it will be useful, *************** *** 26,29 **** --- 30,40 ---- { public: + enum ESimState + { + S_PAUSED, + S_RUNNING + }; + + public: SimSpark(const std::string& relPathPrefix); *************** *** 39,42 **** --- 50,63 ---- /** process command line options */ bool ProcessCmdLine(int argc, char* argv[]); + + /** get the current simulation state */ + ESimState GetSimState() const; + + /** set the current simulationm state */ + void SetSimState(ESimState state); + + protected: + //! the state of the current simulation + ESimState mState; }; |
From: Markus R. <rol...@us...> - 2006-01-08 14:15:37
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit/res In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21348/res Added Files: xpm_pause.xpm xpm_play.xpm Log Message: - rsgedit no longer crashes, when window is closed via it's decoration - added toolbar buttons and menu entries to start and pause the simulation - the simulation is initially paused --- NEW FILE: xpm_pause.xpm --- /* XPM */ static char *xpm_pause[] = { /* columns rows colors chars-per-pixel */ "16 16 2 1", " c gray100", ". c black", /* pixels */ " ", " .. .. ", " .. .. ", " .. .. ", " .. .. ", " .. .. ", " .. .. ", " .. .. ", " .. .. ", " .. .. ", " .. .. ", " .. .. ", " .. .. ", " .. .. ", " ", " " }; --- NEW FILE: xpm_play.xpm --- /* XPM */ static char *xpm_play[] = { /* columns rows colors chars-per-pixel */ "16 16 2 1", " c gray100", ". c black", /* pixels */ " ", " ... ", " .... ", " ..... ", " .. ... ", " .. ... ", " .. ... ", " .. ... ", " .. ... ", " .. ... ", " .. ... ", " ..... ", " .... ", " ... ", " ", " " }; |
From: Markus R. <rol...@us...> - 2006-01-08 14:07:48
|
Update of /cvsroot/simspark/simspark/spark/oxygen/simulationserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19851 Modified Files: simulationserver.cpp Log Message: - reset quit flag in Init() Index: simulationserver.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/simulationserver/simulationserver.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** simulationserver.cpp 2 Jan 2006 20:37:41 -0000 1.2 --- simulationserver.cpp 8 Jan 2006 14:07:38 -0000 1.3 *************** *** 284,287 **** --- 284,288 ---- { GetLog()->Normal() << "(SimulationServer) init\n"; + mExit = false; // cache argc and argv, to make it accessible for registerd |
From: Markus R. <rol...@us...> - 2006-01-08 14:07:23
|
Update of /cvsroot/simspark/simspark/spark/plugin/inputsdl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19692 Modified Files: inputsystemsdl.cpp inputsystemsdl.h Log Message: - changed AddInput and AddInputInternal to take a const reference to an Input Struct Index: inputsystemsdl.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/plugin/inputsdl/inputsystemsdl.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** inputsystemsdl.h 25 Dec 2005 18:32:27 -0000 1.2 --- inputsystemsdl.h 8 Jan 2006 14:07:00 -0000 1.3 *************** *** 54,58 **** //! add the input to the queue ! virtual void AddInput(kerosin::Input::Input& input); //! retrieve an input from the queue virtual bool GetInput(kerosin::Input::Input& input); --- 54,58 ---- //! add the input to the queue ! virtual void AddInput(const kerosin::Input::Input& input); //! retrieve an input from the queue virtual bool GetInput(kerosin::Input::Input& input); Index: inputsystemsdl.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/plugin/inputsdl/inputsystemsdl.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** inputsystemsdl.cpp 25 Dec 2005 18:32:27 -0000 1.2 --- inputsystemsdl.cpp 8 Jan 2006 14:06:59 -0000 1.3 *************** *** 165,169 **** } ! void InputSystemSDL::AddInput(Input &input) { SDL_LockMutex(mMutex); --- 165,169 ---- } ! void InputSystemSDL::AddInput(const Input &input) { SDL_LockMutex(mMutex); |
From: Markus R. <rol...@us...> - 2006-01-08 14:07:04
|
Update of /cvsroot/simspark/simspark/spark/kerosin/inputserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19510 Modified Files: inputsystem.cpp inputsystem.h Log Message: - changed AddInput() and AddInputInternal() to take a const reference to an Input struct Index: inputsystem.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/inputserver/inputsystem.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** inputsystem.h 25 Dec 2005 18:32:27 -0000 1.2 --- inputsystem.h 8 Jan 2006 14:06:01 -0000 1.3 *************** *** 67,76 **** AddInputInternal(). */ ! virtual void AddInput(Input& input); /** this is the actual addition of input to the queue. It should only be used by InputDevices! */ ! void AddInputInternal(Input& input); //! retrieve an input from the queue --- 67,76 ---- AddInputInternal(). */ ! virtual void AddInput(const Input& input); /** this is the actual addition of input to the queue. It should only be used by InputDevices! */ ! void AddInputInternal(const Input& input); //! retrieve an input from the queue Index: inputsystem.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/inputserver/inputsystem.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** inputsystem.cpp 25 Dec 2005 18:32:27 -0000 1.2 --- inputsystem.cpp 8 Jan 2006 14:06:00 -0000 1.3 *************** *** 42,46 **** void ! InputSystem::AddInput(Input& input) { AddInputInternal(input); --- 42,46 ---- void ! InputSystem::AddInput(const Input& input) { AddInputInternal(input); *************** *** 71,75 **** void ! InputSystem::AddInputInternal(Input& input) { mInputQueue.push_back(input); --- 71,75 ---- void ! InputSystem::AddInputInternal(const Input& input) { mInputQueue.push_back(input); |
From: Markus R. <rol...@us...> - 2006-01-08 14:04:32
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit/res In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19353/res Log Message: Directory /cvsroot/simspark/simspark/contrib/rsgedit/res added to the repository |
From: Joschka B. <jbo...@us...> - 2006-01-08 10:20:09
|
Update of /cvsroot/simspark/simspark/spark/oxygen/physicsserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11655 Modified Files: universaljoint_c.cpp Log Message: (sync with rcssserver3D cvs) corrected bug in function setAxis2 Index: universaljoint_c.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/physicsserver/universaljoint_c.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** universaljoint_c.cpp 6 Jan 2006 13:53:38 -0000 1.2 --- universaljoint_c.cpp 8 Jan 2006 10:19:55 -0000 1.3 *************** *** 71,75 **** } ! obj->SetAxis1(inAxis2); return true; } --- 71,75 ---- } ! obj->SetAxis2(inAxis2); return true; } |
From: Markus R. <rol...@us...> - 2006-01-06 13:57:44
|
Update of /cvsroot/simspark/simspark/spark/plugin/sparkagent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2082 Modified Files: Makefile.am export.cpp hingeeffector.cpp Added Files: universaljointaction.h universaljointeffector.cpp universaljointeffector.h universaljointeffector_c.cpp universaljointperceptor.cpp universaljointperceptor.h universaljointperceptor_c.cpp Log Message: (sync with rcssserver3d cvs, thanks Joschka) - initial version of action, perceptor, and effector for the universal joint - removed some commented out code in hingeeffector.cpp - added exports for the universal joint perceptor and effector --- NEW FILE: universaljointperceptor.h --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of rcssserver3D Thu Jan 4 2006 Copyright (C) 2006 RoboCup Soccer Server 3D Maintenance Group 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 UNIVERSALJOINTPERCEPTOR_H #define UNIVERSALJOINTPERCEPTOR_H #include <oxygen/agentaspect/perceptor.h> #include <oxygen/physicsserver/universaljoint.h> class UniversalJointPerceptor : public oxygen::Perceptor { public: UniversalJointPerceptor(); virtual ~UniversalJointPerceptor(); //! \return true, if valid data is available and false otherwise. bool Percept(boost::shared_ptr<oxygen::PredicateList> predList); protected: virtual void OnLink(); virtual void OnUnlink(); void InsertAxisAngle(oxygen::Predicate& predicate, oxygen::Joint::EAxisIndex idx); void InsertAxisRate(oxygen::Predicate& predicate, oxygen::Joint::EAxisIndex idx); protected: /** cached reference to the monitor joint */ boost::shared_ptr<oxygen::UniversalJoint> mJoint; }; DECLARE_CLASS(UniversalJointPerceptor); #endif //UNIVERSALJOINTPERCEPTOR_H --- NEW FILE: universaljointeffector.h --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of rcssserver3D Thu Jan 4 2006 Copyright (C) 2006 RoboCup Soccer Server 3D Maintenance Group 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 UNIVERSALJOINTEFFECTOR_H #define UNIVERSALJOINTEFFECTOR_H #include <oxygen/agentaspect/effector.h> #include <oxygen/physicsserver/universaljoint.h> class UniversalJointEffector : public oxygen::Effector { public: UniversalJointEffector(); virtual ~UniversalJointEffector(); /** realizes the action described by the ActionObject */ virtual bool Realize(boost::shared_ptr<oxygen::ActionObject> action); /** returns the name of the predicate this effector implements. */ virtual std::string GetPredicate() { return GetName(); } /** constructs an Actionobject, describing a predicate */ virtual boost::shared_ptr<oxygen::ActionObject> GetActionObject(const oxygen::Predicate& predicate); protected: /** setup the reference to the HingeJoint parent node */ virtual void OnLink(); /** remove the reference to the HingeJoint parent node */ virtual void OnUnlink(); protected: /** cached reference to the monitor joint */ boost::shared_ptr<oxygen::UniversalJoint> mJoint; }; DECLARE_CLASS(UniversalJointEffector); #endif // UNIVERSALJOINTEFFECTOR_H Index: export.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/plugin/sparkagent/export.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** export.cpp 2 Jan 2006 20:38:32 -0000 1.3 --- export.cpp 6 Jan 2006 13:57:36 -0000 1.4 *************** *** 26,29 **** --- 26,31 ---- #include "hinge2effector.h" #include "timeperceptor.h" + #include "universaljointeffector.h" + #include "universaljointperceptor.h" ZEITGEIST_EXPORT_BEGIN() *************** *** 33,35 **** --- 35,39 ---- ZEITGEIST_EXPORT(HingeEffector); ZEITGEIST_EXPORT(HingePerceptor); + ZEITGEIST_EXPORT(UniversalJointEffector); + ZEITGEIST_EXPORT(UniversalJointPerceptor); ZEITGEIST_EXPORT_END() --- NEW FILE: universaljointeffector.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of rcssserver3D Thu Jan 4 2006 Copyright (C) 2006 RoboCup Soccer Server 3D Maintenance Group 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 "universaljointeffector.h" #include "universaljointaction.h" using namespace oxygen; using namespace zeitgeist; using namespace salt; using namespace boost; using namespace std; UniversalJointEffector::UniversalJointEffector() : Effector() { SetName("universaljoint"); } UniversalJointEffector::~UniversalJointEffector() { } bool UniversalJointEffector::Realize(boost::shared_ptr<ActionObject> action) { if (mJoint.get() == 0) { return false; } shared_ptr<UniversalJointAction> universalAction = shared_dynamic_cast<UniversalJointAction>(action); if (universalAction.get() == 0) { GetLog()->Error() << "ERROR: (UniversalJointtEffector) cannot realize an " << "unknown ActionObject\n"; return false; } mJoint->SetParameter(dParamVel, universalAction->GetMotorVelocity(Joint::AI_FIRST)); mJoint->SetParameter(dParamVel2, universalAction->GetMotorVelocity(Joint::AI_SECOND)); return true; } shared_ptr<ActionObject> UniversalJointEffector::GetActionObject(const Predicate& predicate) { for(;;) { if (mJoint.get() == 0) { break; } if (predicate.name != GetPredicate()) { GetLog()->Error() << "ERROR: (UniversalJointEffector) invalid predicate" << predicate.name << "\n"; break; } Predicate::Iterator iter = predicate.begin(); float velocity1; float velocity2; if (! predicate.AdvanceValue(iter, velocity1)) { GetLog()->Error() << "ERROR: (UniversalJointEffector) motor velocity1 expected\n"; break; } if (! predicate.AdvanceValue(iter, velocity2)) { GetLog()->Error() << "ERROR: (UniversalJointEffector) motor velocity2 expected\n"; break; } return shared_ptr<UniversalJointAction>(new UniversalJointAction(GetPredicate(),velocity1,velocity2)); } return shared_ptr<ActionObject>(); } void UniversalJointEffector::OnLink() { mJoint = make_shared(FindParentSupportingClass<UniversalJoint>()); if (mJoint.get() == 0) { GetLog()->Error() << "(UniversalJointEffector) ERROR: found no UniversalJoint parent\n"; } } void UniversalJointEffector::OnUnlink() { mJoint.reset(); } --- NEW FILE: universaljointperceptor.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of rcssserver3D Thu Jan 4 2006 Copyright (C) 2006 RoboCup Soccer Server 3D Maintenance Group 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 "universaljointperceptor.h" #include <zeitgeist/logserver/logserver.h> using namespace oxygen; using namespace zeitgeist; using namespace boost; using namespace std; UniversalJointPerceptor::UniversalJointPerceptor() : Perceptor() { } UniversalJointPerceptor::~UniversalJointPerceptor() { } void UniversalJointPerceptor::OnLink() { mJoint = make_shared(FindParentSupportingClass<UniversalJoint>()); if (mJoint.get() == 0) { GetLog()->Error() << "(UniversalJointPerceptor) ERROR: found no UniversalJoint parent\n"; } } void UniversalJointPerceptor::OnUnlink() { mJoint.reset(); } void UniversalJointPerceptor::InsertAxisAngle(Predicate& predicate, Joint::EAxisIndex idx) { ParameterList& axisElement = predicate.parameter.AddList(); axisElement.AddValue(string("axis")); axisElement.AddValue(mJoint->GetAngle(idx)); } void UniversalJointPerceptor::InsertAxisRate(Predicate& predicate, Joint::EAxisIndex idx) { ParameterList& axisElement = predicate.parameter.AddList(); axisElement.AddValue(string("rate")); axisElement.AddValue(mJoint->GetAngleRate(idx)); } bool UniversalJointPerceptor::Percept(boost::shared_ptr<oxygen::PredicateList> predList) { if (mJoint.get() == 0) { return false; } Predicate& predicate = predList->AddPredicate(); predicate.name = "UJ"; predicate.parameter.Clear(); ParameterList& nameElement = predicate.parameter.AddList(); nameElement.AddValue(string("name")); nameElement.AddValue(GetName()); InsertAxisAngle(predicate, Joint::AI_FIRST); InsertAxisRate(predicate, Joint::AI_FIRST); InsertAxisAngle(predicate, Joint::AI_SECOND); InsertAxisRate(predicate, Joint::AI_SECOND); return true; } Index: Makefile.am =================================================================== RCS file: /cvsroot/simspark/simspark/spark/plugin/sparkagent/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.am 2 Jan 2006 18:11:33 -0000 1.2 --- Makefile.am 6 Jan 2006 13:57:36 -0000 1.3 *************** *** 19,23 **** hingeperceptor.h \ hingeperceptor.cpp \ ! hingeperceptor_c.cpp sparkagent_la_LDFLAGS = -module -version-info 0:0:0 --- 19,30 ---- hingeperceptor.h \ hingeperceptor.cpp \ ! hingeperceptor_c.cpp \ ! universaljointaction.h \ ! universaljointeffector.h \ ! universaljointeffector.cpp \ ! universaljointeffector_c.cpp \ ! universaljointperceptor.h \ ! universaljointperceptor.cpp \ ! universaljointperceptor_c.cpp sparkagent_la_LDFLAGS = -module -version-info 0:0:0 Index: hingeeffector.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/plugin/sparkagent/hingeeffector.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** hingeeffector.cpp 2 Jan 2006 18:11:33 -0000 1.1 --- hingeeffector.cpp 6 Jan 2006 13:57:36 -0000 1.2 *************** *** 54,70 **** } - /* - Vector3f axis = mJoint->GetAxis(); - - GetLog()->Error() << "(HingeEffector) axis is (" - << axis[0] << "," << axis[1] << "," << axis[2] << ")\n"; - - GetLog()->Error() << "(HingeEffector) current vel = " - << mJoint->GetAngularMotorVelocity(Joint::AI_FIRST) << "\n"; - - GetLog()->Error() << "(HingeEffector) set vel to " - << hingeAction->GetMotorVelocity() << "\n"; - */ - mJoint->SetParameter(dParamVel, hingeAction->GetMotorVelocity()); --- 54,57 ---- --- NEW FILE: universaljointaction.h --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of rcssserver3D Thu Jan 4 2006 Copyright (C) 2006 RoboCup Soccer Server 3D Maintenance Group 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 UNIVERSALJOINTACTION_H #define UNIVERSALJOINTACTION_H #include <oxygen/gamecontrolserver/actionobject.h> class UniversalJointAction : public oxygen::ActionObject { public: UniversalJointAction(const std::string& predicate, float velocity1, float velocity2) : ActionObject(predicate), mVelocityAxis1(velocity1), mVelocityAxis2(velocity2) {}; virtual ~UniversalJointAction() {} float GetMotorVelocity(oxygen::Joint::EAxisIndex idx) { if (oxygen::Joint::AI_FIRST) return mVelocityAxis1; else return mVelocityAxis2; } protected: float mVelocityAxis1; float mVelocityAxis2; }; #endif // UNIVERSALJOINTACTION_H --- NEW FILE: universaljointeffector_c.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of rcssserver3D Fri Jan 6 2006 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2006 RoboCup Soccer Server 3D Maintenance Group 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 "universaljointeffector.h" void CLASS(UniversalJointEffector)::DefineClass() { DEFINE_BASECLASS(oxygen/Effector); } --- NEW FILE: universaljointperceptor_c.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of rcssserver3D Thu Jan 5 2006 Copyright (C) 2006 RoboCup Soccer Server 3D Maintenance Group 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 "universaljointperceptor.h" void CLASS(UniversalJointPerceptor)::DefineClass() { DEFINE_BASECLASS(oxygen/Perceptor); } |
From: Markus R. <rol...@us...> - 2006-01-06 13:53:46
|
Update of /cvsroot/simspark/simspark/spark/oxygen/physicsserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1518/physicsserver Modified Files: universaljoint.cpp universaljoint.h universaljoint_c.cpp Log Message: (sync with rcssserver3d cvs, thanks Joschka) - implemented ruby function calls for setAxis1 and setAxis2 - made SetParameter and GetParameter public in order to set joint velocities correctly (doesn't seem to work with the base class methods) - implemented SetAxis1 and SetAxis2 to separate setup of anchor and axis Index: universaljoint.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/physicsserver/universaljoint.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** universaljoint.cpp 5 Dec 2005 21:16:49 -0000 1.1 --- universaljoint.cpp 6 Jan 2006 13:53:38 -0000 1.2 *************** *** 36,43 **** { dWorldID world = GetWorldID(); if (world == 0) ! { ! return; ! } mODEJoint = dJointCreateUniversal(world, 0); --- 36,44 ---- { dWorldID world = GetWorldID(); + if (world == 0) ! { ! return; ! } mODEJoint = dJointCreateUniversal(world, 0); *************** *** 49,60 **** Vector3f gAnchor(GetWorldTransform() * anchor); dJointSetUniversalAnchor (mODEJoint, gAnchor[0], gAnchor[1], gAnchor[2]); - - // relative universal axis 1 points up - Vector3f up(GetWorldTransform().Rotate(Vector3f(0,0,1))); - dJointSetUniversalAxis1(mODEJoint,up[0],up[1],up[2]); - - // relative universal axis 2 points right - Vector3f right(GetWorldTransform().Rotate(Vector3f(1,0,0))); - dJointSetUniversalAxis2(mODEJoint,right[0],right[1],right[2]); } --- 50,53 ---- *************** *** 64,102 **** switch (idx) ! { ! case BI_FIRST: ! { ! dReal anchor[3]; ! dJointGetUniversalAnchor (mODEJoint, anchor); ! pos = Vector3f(anchor[0],anchor[1],anchor[2]); ! } ! case BI_SECOND: ! { ! dReal anchor[3]; ! dJointGetUniversalAnchor2(mODEJoint, anchor); ! pos = Vector3f(anchor[0],anchor[1],anchor[2]); ! } ! default: ! break; ! } return GetLocalPos(pos); } float UniversalJoint::GetAngle(EAxisIndex idx) { switch (idx) ! { ! case AI_FIRST: ! return gRadToDeg(dJointGetUniversalAngle1(mODEJoint)); ! case AI_SECOND: ! return gRadToDeg(dJointGetUniversalAngle2(mODEJoint)); ! default: ! return 0; ! } } --- 57,134 ---- switch (idx) ! { ! case BI_FIRST: ! { ! dReal anchor[3]; ! dJointGetUniversalAnchor (mODEJoint, anchor); ! pos = Vector3f(anchor[0],anchor[1],anchor[2]); ! } ! case BI_SECOND: ! { ! dReal anchor[3]; ! dJointGetUniversalAnchor2(mODEJoint, anchor); ! pos = Vector3f(anchor[0],anchor[1],anchor[2]); ! } ! default: ! break; ! } return GetLocalPos(pos); } + void UniversalJoint::SetAxis1(Vector3f & axis) + { + Vector3f first(GetWorldTransform().Rotate(axis)); + dJointSetUniversalAxis1(mODEJoint,first[0],first[1],first[2]); + } + + void UniversalJoint::SetAxis2(Vector3f & axis) + { + Vector3f second(GetWorldTransform().Rotate(axis)); + dJointSetUniversalAxis2(mODEJoint,second[0],second[1],second[2]); + } + + Vector3f UniversalJoint::GetAxis(EAxisIndex idx) + { + Vector3f vec(0,0,0); + + switch (idx) + { + case AI_FIRST: + { + dReal axis[3]; + dJointGetUniversalAxis1(mODEJoint, axis); + vec = Vector3f(axis[0],axis[1],axis[2]); + } + + case AI_SECOND: + { + dReal axis[3]; + dJointGetUniversalAxis2(mODEJoint, axis); + vec = Vector3f(axis[0],axis[1],axis[2]); + } + + default: + break; + } + + return GetLocalPos(vec); + } + float UniversalJoint::GetAngle(EAxisIndex idx) { switch (idx) ! { ! case AI_FIRST: ! return gRadToDeg(dJointGetUniversalAngle1(mODEJoint)); ! case AI_SECOND: ! return gRadToDeg(dJointGetUniversalAngle2(mODEJoint)); ! default: ! return 0; ! } } Index: universaljoint_c.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/physicsserver/universaljoint_c.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** universaljoint_c.cpp 5 Dec 2005 21:16:49 -0000 1.1 --- universaljoint_c.cpp 6 Jan 2006 13:53:38 -0000 1.2 *************** *** 43,46 **** --- 43,78 ---- } + FUNCTION(UniversalJoint,setAxis1) + { + Vector3f inAxis1; + + if ( + (in.GetSize() == 0) || + (! in.GetValue(in.begin(), inAxis1)) + ) + { + return false; + } + + obj->SetAxis1(inAxis1); + return true; + } + + FUNCTION(UniversalJoint,setAxis2) + { + Vector3f inAxis2; + + if ( + (in.GetSize() == 0) || + (! in.GetValue(in.begin(), inAxis2)) + ) + { + return false; + } + + obj->SetAxis1(inAxis2); + return true; + } + FUNCTION(UniversalJoint,getAngle) { *************** *** 79,82 **** --- 111,116 ---- DEFINE_BASECLASS(oxygen/Joint); DEFINE_FUNCTION(setAnchor); + DEFINE_FUNCTION(setAxis1); + DEFINE_FUNCTION(setAxis2); DEFINE_FUNCTION(getAngle); DEFINE_FUNCTION(getAngleRate); Index: universaljoint.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/physicsserver/universaljoint.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** universaljoint.h 5 Dec 2005 21:16:49 -0000 1.1 --- universaljoint.h 6 Jan 2006 13:53:38 -0000 1.2 *************** *** 45,49 **** salt::Vector3f GetAnchor (EBodyIndex idx); ! /** returns one of the hinge angles in degrees, measured between the two bodies, or between the body and the static environment. --- 45,65 ---- salt::Vector3f GetAnchor (EBodyIndex idx); ! /** This function sets up the first axis of the joint ! \param axis a vector describing the axis in relative coordinates ! */ ! void SetAxis1(salt::Vector3f & axis); ! ! /** This function sets up the second axis of the joint ! \param axis a vector describing the axis in local coordinates ! */ ! void SetAxis2(salt::Vector3f & axis); ! ! /** returns the vector describing one of the two axis ! (in local coordinates) ! \param idx index of the desired axis ! */ ! salt::Vector3f GetAxis(EAxisIndex idx); ! ! /** returns one of the axis angles in degrees, measured between the two bodies, or between the body and the static environment. *************** *** 54,61 **** float GetAngleRate(EAxisIndex idx); - protected: - /** creates a new universal joint */ - virtual void OnLink(); - /** sets a joint parameter value */ virtual void SetParameter(int parameter, float value); --- 70,73 ---- *************** *** 63,66 **** --- 75,82 ---- /** returns a joint parameter value */ virtual float GetParameter(int parameter); + + protected: + /** creates a new universal joint */ + virtual void OnLink(); }; |
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 ---- } + + |
From: Markus R. <rol...@us...> - 2006-01-04 19:11:25
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7389 Modified Files: main.cpp Log Message: - fixed a compiler error (thanks Joschka) Index: main.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/main.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.cpp 2 Jan 2006 20:28:49 -0000 1.2 --- main.cpp 4 Jan 2006 19:11:16 -0000 1.3 *************** *** 52,56 **** mSpark = shared_ptr<SimSpark>(new SimSpark("../../")); ! if (! mSpark->Init(argc, argv)) { return false; --- 52,56 ---- mSpark = shared_ptr<SimSpark>(new SimSpark("../../")); ! if (! mSpark->Init(argc, reinterpret_cast<char**>(argv))) { return false; *************** *** 58,62 **** MainFrame *frame = new MainFrame ! (NULL, "RSG-Edit", wxDefaultPosition,wxSize(400, 300)); wxMenu *winMenu = new wxMenu; --- 58,62 ---- MainFrame *frame = new MainFrame ! (NULL, wxString(_T("RSG-Edit")), wxDefaultPosition,wxSize(400, 300)); wxMenu *winMenu = new wxMenu; |
From: Markus R. <rol...@us...> - 2006-01-02 20:39:49
|
Update of /cvsroot/simspark/simspark/spark/kerosin/inputserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28754/spark/kerosin/inputserver Added Files: german.scan.rb us.scan.rb Log Message: - added some missing .rb files --- NEW FILE: german.scan.rb --- # # german.scan.rb # ScanCode translation for a german keyboard # theInputSystem = get('/sys/server/input'); if (theInputSystem == nil) print "(german.scan.rb) cannot find the InputServer)\n"; else theInputSystem.addCode(Input.IC_1, '1', '1'[0], '!'[0], 0); theInputSystem.addCode(Input.IC_2, '2', '2'[0], '@'[0], 0); theInputSystem.addCode(Input.IC_3, '3', '3'[0], '#'[0], 0); theInputSystem.addCode(Input.IC_4, '4', '4'[0], '$'[0], 0); theInputSystem.addCode(Input.IC_5, '5', '5'[0], '%'[0], 0); theInputSystem.addCode(Input.IC_6, '6', '6'[0], '^'[0], 0); theInputSystem.addCode(Input.IC_7, '7', '7'[0], '&'[0], '{'[0]); theInputSystem.addCode(Input.IC_8, '8', '8'[0], '*'[0], '['[0]); theInputSystem.addCode(Input.IC_9, '9', '9'[0], '('[0], ']'[0]); theInputSystem.addCode(Input.IC_0, '0', '0'[0], ')'[0], '}'[0]); # function keys theInputSystem.addCode(Input.IC_F1, 'f1', 0, 0, 0); theInputSystem.addCode(Input.IC_F2, 'f2', 0, 0, 0); theInputSystem.addCode(Input.IC_F3, 'f3', 0, 0, 0); theInputSystem.addCode(Input.IC_F4, 'f4', 0, 0, 0); theInputSystem.addCode(Input.IC_F5, 'f5', 0, 0, 0); theInputSystem.addCode(Input.IC_F6, 'f6', 0, 0, 0); theInputSystem.addCode(Input.IC_F7, 'f7', 0, 0, 0); theInputSystem.addCode(Input.IC_F8, 'f8', 0, 0, 0); theInputSystem.addCode(Input.IC_F9, 'f9', 0, 0, 0); theInputSystem.addCode(Input.IC_F10, 'f10', 0, 0, 0); theInputSystem.addCode(Input.IC_F11, 'f11', 0, 0, 0); theInputSystem.addCode(Input.IC_F12, 'f12', 0, 0, 0); # alphabet theInputSystem.addCode(Input.IC_A, 'a', 'a'[0], 'A'[0], 0); theInputSystem.addCode(Input.IC_B, 'b', 'b'[0], 'B'[0], 0); theInputSystem.addCode(Input.IC_C, 'c', 'c'[0], 'C'[0], 0); theInputSystem.addCode(Input.IC_D, 'd', 'd'[0], 'D'[0], 0); theInputSystem.addCode(Input.IC_E, 'e', 'e'[0], 'E'[0], 0); theInputSystem.addCode(Input.IC_F, 'f', 'f'[0], 'F'[0], 0); theInputSystem.addCode(Input.IC_G, 'g', 'g'[0], 'G'[0], 0); theInputSystem.addCode(Input.IC_H, 'h', 'h'[0], 'H'[0], 0); theInputSystem.addCode(Input.IC_I, 'i', 'i'[0], 'I'[0], 0); theInputSystem.addCode(Input.IC_J, 'j', 'j'[0], 'J'[0], 0); theInputSystem.addCode(Input.IC_K, 'k', 'k'[0], 'K'[0], 0); theInputSystem.addCode(Input.IC_L, 'l', 'l'[0], 'L'[0], 0); theInputSystem.addCode(Input.IC_M, 'm', 'm'[0], 'M'[0], 0); theInputSystem.addCode(Input.IC_N, 'n', 'n'[0], 'N'[0], 0); theInputSystem.addCode(Input.IC_O, 'o', 'o'[0], 'O'[0], 0); theInputSystem.addCode(Input.IC_P, 'p', 'p'[0], 'P'[0], 0); theInputSystem.addCode(Input.IC_Q, 'q', 'q'[0], 'Q'[0], 0); theInputSystem.addCode(Input.IC_R, 'r', 'r'[0], 'R'[0], 0); theInputSystem.addCode(Input.IC_S, 's', 's'[0], 'S'[0], 0); theInputSystem.addCode(Input.IC_T, 't', 't'[0], 'T'[0], 0); theInputSystem.addCode(Input.IC_U, 'u', 'u'[0], 'U'[0], 0); theInputSystem.addCode(Input.IC_V, 'v', 'v'[0], 'V'[0], 0); theInputSystem.addCode(Input.IC_W, 'w', 'w'[0], 'W'[0], 0); theInputSystem.addCode(Input.IC_X, 'x', 'x'[0], 'X'[0], 0); theInputSystem.addCode(Input.IC_Y, 'y', 'y'[0], 'Y'[0], 0); theInputSystem.addCode(Input.IC_Z, 'z', 'z'[0], 'Z'[0], 0); # keypad theInputSystem.addCode(Input.IC_KP0, 'kp0', '0'[0], '0'[0], 0); theInputSystem.addCode(Input.IC_KP1, 'kp1', '1'[0], '1'[0], 0); theInputSystem.addCode(Input.IC_KP2, 'kp2', '2'[0], '2'[0], 0); theInputSystem.addCode(Input.IC_KP3, 'kp3', '3'[0], '3'[0], 0); theInputSystem.addCode(Input.IC_KP4, 'kp4', '4'[0], '4'[0], 0); theInputSystem.addCode(Input.IC_KP5, 'kp5', '5'[0], '5'[0], 0); theInputSystem.addCode(Input.IC_KP6, 'kp6', '6'[0], '6'[0], 0); theInputSystem.addCode(Input.IC_KP7, 'kp7', '7'[0], '7'[0], 0); theInputSystem.addCode(Input.IC_KP8, 'kp8', '8'[0], '8'[0], 0); theInputSystem.addCode(Input.IC_KP9, 'kp9', '9'[0], '9'[0], 0); theInputSystem.addCode(Input.IC_KP_DECIMAL, 'kp_decimal', '.'[0], '.'[0], 0); theInputSystem.addCode(Input.IC_KP_DIVIDE, 'kp_divide' , '/'[0], '/'[0], 0); theInputSystem.addCode(Input.IC_KP_MULTIPLY,'kp_multiply', '*'[0], '*'[0], 0); theInputSystem.addCode(Input.IC_KP_MINUS, 'kp_minus', '-'[0], '-'[0], 0); theInputSystem.addCode(Input.IC_KP_PLUS, 'kp_plus', '+'[0], '+'[0], 0); theInputSystem.addCode(Input.IC_KP_ENTER, 'kp_enter', 0, 0, 0); # arrows + home/end pad theInputSystem.addCode(Input.IC_UP, 'up', 0, 0, 0); theInputSystem.addCode(Input.IC_DOWN, 'down', 0, 0, 0); theInputSystem.addCode(Input.IC_LEFT, 'left', 0, 0, 0); theInputSystem.addCode(Input.IC_RIGHT, 'right', 0, 0, 0); theInputSystem.addCode(Input.IC_INSERT, 'insert', 0, 0, 0); theInputSystem.addCode(Input.IC_DELETE, 'delete', 0, 0, 0); theInputSystem.addCode(Input.IC_HOME, 'home', 0, 0, 0); theInputSystem.addCode(Input.IC_END, 'end', 0, 0, 0); theInputSystem.addCode(Input.IC_PAGEUP, 'pageup', 0, 0, 0); theInputSystem.addCode(Input.IC_PAGEDOWN, 'pagedown', 0, 0, 0); # key state modifier keys theInputSystem.addCode(Input.IC_NUMLOCK, 'numlock', 0, 0, 0); theInputSystem.addCode(Input.IC_CAPSLOCK, 'capslock', 0, 0, 0); theInputSystem.addCode(Input.IC_SCROLLOCK, 'scrollock', 0, 0, 0); theInputSystem.addCode(Input.IC_LSHIFT, 'lshift', 0, 0, 0); theInputSystem.addCode(Input.IC_RSHIFT, 'rshift', 0, 0, 0); theInputSystem.addCode(Input.IC_LCTRL, 'lctrl', 0, 0, 0); theInputSystem.addCode(Input.IC_RCTRL, 'rctrl', 0, 0, 0); theInputSystem.addCode(Input.IC_LALT, 'lalt', 0, 0, 0); theInputSystem.addCode(Input.IC_RALT, 'ralt', 0, 0, 0); theInputSystem.addCode(Input.IC_LSUPER, 'lsuper', 0, 0, 0); theInputSystem.addCode(Input.IC_RSUPER, 'rsuper', 0, 0, 0); # other keys ('cursor control', punctuation) theInputSystem.addCode(Input.IC_ESCAPE, 'escape', 0, 0, 0); theInputSystem.addCode(Input.IC_PRINT, 'print', 0, 0, 0); theInputSystem.addCode(Input.IC_PAUSE, 'pause', 0, 0, 0); theInputSystem.addCode(Input.IC_GRAVE, '`', '`'[0], '~'[0], 0); theInputSystem.addCode(Input.IC_MINUS, '-', '-'[0], '_'[0], 0); theInputSystem.addCode(Input.IC_EQUALS, '=', '='[0], '+'[0], 0); theInputSystem.addCode(Input.IC_BACKSLASH, '\\', '\\'[0], '|'[0], 0); theInputSystem.addCode(Input.IC_BACKSPACE, 'backspace', 0, 0, 0); theInputSystem.addCode(Input.IC_TAB, 'tab', 0, 0, 0); theInputSystem.addCode(Input.IC_LBRACKET, '[', '['[0], '{'[0], 0); theInputSystem.addCode(Input.IC_RBRACKET, ']', ']'[0], '}'[0], 0); theInputSystem.addCode(Input.IC_RETURN, 'return', 0, 0, 0); theInputSystem.addCode(Input.IC_SEMICOLON, ';', ';'[0], ':'[0], 0); theInputSystem.addCode(Input.IC_APOSTROPHE, '\'', '\''[0], '"'[0], 0); theInputSystem.addCode(Input.IC_OEM_102, 'oem_102', 0, 0, 0); theInputSystem.addCode(Input.IC_COMMA, ',', ','[0], '<'[0], 0); theInputSystem.addCode(Input.IC_PERIOD, '.', '.'[0], '>'[0], 0); theInputSystem.addCode(Input.IC_SLASH, '/', '/'[0], '?'[0], 0); theInputSystem.addCode(Input.IC_SPACE, 'space', ' '[0], ' '[0], 0); # mouse buttons theInputSystem.addCode(Input.IC_MOUSE_LEFT, 'mouse_left', 0, 0, 0); theInputSystem.addCode(Input.IC_MOUSE_RIGHT, 'mouse_right', 0, 0, 0); theInputSystem.addCode(Input.IC_MOUSE_MIDDLE, 'mouse_middle', 0, 0, 0); #mouse axis theInputSystem.addCode(Input.IC_AXISX, 'axisx', 0, 0, 0); theInputSystem.addCode(Input.IC_AXISY, 'axisy', 0, 0, 0); theInputSystem.addCode(Input.IC_AXISZ, 'axisz', 0, 0, 0); # timer theInputSystem.addCode(Input.IC_AXIST, 'axist', 0, 0, 0); end --- NEW FILE: us.scan.rb --- # ScanCode translation for an US keyboard theInputSystem = get('/sys/server/input'); if (theInputSystem != nil) theInputSystem.addCode (Input.IC_1, '1', '1'[0], '!'[0], 0); theInputSystem.addCode (Input.IC_2, '2', '2'[0], '@'[0], 0); theInputSystem.addCode (Input.IC_3, '3', '3'[0], '#'[0], 0); theInputSystem.addCode (Input.IC_4, '4', '4'[0], '$'[0], 0); theInputSystem.addCode (Input.IC_5, '5', '5'[0], '%'[0], 0); theInputSystem.addCode (Input.IC_6, '6', '6'[0], '^'[0], 0); theInputSystem.addCode (Input.IC_7, '7', '7'[0], '&'[0], '{'[0]); theInputSystem.addCode (Input.IC_8, '8', '8'[0], '*'[0], '['[0]); theInputSystem.addCode (Input.IC_9, '9', '9'[0], '('[0], ']'[0]); theInputSystem.addCode (Input.IC_0, '0', '0'[0], ')'[0], '}'[0]); # function keys theInputSystem.addCode (Input.IC_F1, 'f1', 0, 0, 0); theInputSystem.addCode (Input.IC_F2, 'f2', 0, 0, 0); theInputSystem.addCode (Input.IC_F3, 'f3', 0, 0, 0); theInputSystem.addCode (Input.IC_F4, 'f4', 0, 0, 0); theInputSystem.addCode (Input.IC_F5, 'f5', 0, 0, 0); theInputSystem.addCode (Input.IC_F6, 'f6', 0, 0, 0); theInputSystem.addCode (Input.IC_F7, 'f7', 0, 0, 0); theInputSystem.addCode (Input.IC_F8, 'f8', 0, 0, 0); theInputSystem.addCode (Input.IC_F9, 'f9', 0, 0, 0); theInputSystem.addCode (Input.IC_F10, 'f10', 0, 0, 0); theInputSystem.addCode (Input.IC_F11, 'f11', 0, 0, 0); theInputSystem.addCode (Input.IC_F12, 'f12', 0, 0, 0); # alphabet theInputSystem.addCode (Input.IC_A, 'a', 'a'[0], 'A'[0], 0); theInputSystem.addCode (Input.IC_B, 'b', 'b'[0], 'B'[0], 0); theInputSystem.addCode (Input.IC_C, 'c', 'c'[0], 'C'[0], 0); theInputSystem.addCode (Input.IC_D, 'd', 'd'[0], 'D'[0], 0); theInputSystem.addCode (Input.IC_E, 'e', 'e'[0], 'E'[0], 0); theInputSystem.addCode (Input.IC_F, 'f', 'f'[0], 'F'[0], 0); theInputSystem.addCode (Input.IC_G, 'g', 'g'[0], 'G'[0], 0); theInputSystem.addCode (Input.IC_H, 'h', 'h'[0], 'H'[0], 0); theInputSystem.addCode (Input.IC_I, 'i', 'i'[0], 'I'[0], 0); theInputSystem.addCode (Input.IC_J, 'j', 'j'[0], 'J'[0], 0); theInputSystem.addCode (Input.IC_K, 'k', 'k'[0], 'K'[0], 0); theInputSystem.addCode (Input.IC_L, 'l', 'l'[0], 'L'[0], 0); theInputSystem.addCode (Input.IC_M, 'm', 'm'[0], 'M'[0], 0); theInputSystem.addCode (Input.IC_N, 'n', 'n'[0], 'N'[0], 0); theInputSystem.addCode (Input.IC_O, 'o', 'o'[0], 'O'[0], 0); theInputSystem.addCode (Input.IC_P, 'p', 'p'[0], 'P'[0], 0); theInputSystem.addCode (Input.IC_Q, 'q', 'q'[0], 'Q'[0], 0); theInputSystem.addCode (Input.IC_R, 'r', 'r'[0], 'R'[0], 0); theInputSystem.addCode (Input.IC_S, 's', 's'[0], 'S'[0], 0); theInputSystem.addCode (Input.IC_T, 't', 't'[0], 'T'[0], 0); theInputSystem.addCode (Input.IC_U, 'u', 'u'[0], 'U'[0], 0); theInputSystem.addCode (Input.IC_V, 'v', 'v'[0], 'V'[0], 0); theInputSystem.addCode (Input.IC_W, 'w', 'w'[0], 'W'[0], 0); theInputSystem.addCode (Input.IC_X, 'x', 'x'[0], 'X'[0], 0); theInputSystem.addCode (Input.IC_Y, 'y', 'y'[0], 'Y'[0], 0); theInputSystem.addCode (Input.IC_Z, 'z', 'z'[0], 'Z'[0], 0); # keypad theInputSystem.addCode (Input.IC_KP0, 'kp0', '0'[0], '0'[0], 0); theInputSystem.addCode (Input.IC_KP1, 'kp1', '1'[0], '1'[0], 0); theInputSystem.addCode (Input.IC_KP2, 'kp2', '2'[0], '2'[0], 0); theInputSystem.addCode (Input.IC_KP3, 'kp3', '3'[0], '3'[0], 0); theInputSystem.addCode (Input.IC_KP4, 'kp4', '4'[0], '4'[0], 0); theInputSystem.addCode (Input.IC_KP5, 'kp5', '5'[0], '5'[0], 0); theInputSystem.addCode (Input.IC_KP6, 'kp6', '6'[0], '6'[0], 0); theInputSystem.addCode (Input.IC_KP7, 'kp7', '7'[0], '7'[0], 0); theInputSystem.addCode (Input.IC_KP8, 'kp8', '8'[0], '8'[0], 0); theInputSystem.addCode (Input.IC_KP9, 'kp9', '9'[0], '9'[0], 0); theInputSystem.addCode (Input.IC_KP_DECIMAL, 'kp_decimal', '.'[0], '.'[0], 0); theInputSystem.addCode (Input.IC_KP_DIVIDE, 'kp_divide' '/'[0], '/'[0], 0); theInputSystem.addCode (Input.IC_KP_MULTIPLY,'kp_multiply', '*'[0], '*'[0], 0); theInputSystem.addCode (Input.IC_KP_MINUS, 'kp_minus', '-'[0], '-'[0], 0); theInputSystem.addCode (Input.IC_KP_PLUS, 'kp_plus', '+'[0], '+'[0], 0); theInputSystem.addCode (Input.IC_KP_ENTER, 'kp_enter', 0, 0, 0); # arrows + home/end pad theInputSystem.addCode (Input.IC_UP, 'up', 0, 0, 0); theInputSystem.addCode (Input.IC_DOWN, 'down', 0, 0, 0); theInputSystem.addCode (Input.IC_LEFT, 'left', 0, 0, 0); theInputSystem.addCode (Input.IC_RIGHT, 'right', 0, 0, 0); theInputSystem.addCode (Input.IC_INSERT, 'insert', 0, 0, 0); theInputSystem.addCode (Input.IC_DELETE, 'delete', 0, 0, 0); theInputSystem.addCode (Input.IC_HOME, 'home', 0, 0, 0); theInputSystem.addCode (Input.IC_END, 'end', 0, 0, 0); theInputSystem.addCode (Input.IC_PAGEUP, 'pageup', 0, 0, 0); theInputSystem.addCode (Input.IC_PAGEDOWN, 'pagedown', 0, 0, 0); # key state modifier keys theInputSystem.addCode (Input.IC_NUMLOCK, 'numlock', 0, 0, 0); theInputSystem.addCode (Input.IC_CAPSLOCK, 'capslock', 0, 0, 0); theInputSystem.addCode (Input.IC_SCROLLOCK, 'scrollock', 0, 0, 0); theInputSystem.addCode (Input.IC_LSHIFT, 'lshift', 0, 0, 0); theInputSystem.addCode (Input.IC_RSHIFT, 'rshift', 0, 0, 0); theInputSystem.addCode (Input.IC_LCTRL, 'lctrl', 0, 0, 0); theInputSystem.addCode (Input.IC_RCTRL, 'rctrl', 0, 0, 0); theInputSystem.addCode (Input.IC_LALT, 'lalt', 0, 0, 0); theInputSystem.addCode (Input.IC_RALT, 'ralt', 0, 0, 0); theInputSystem.addCode (Input.IC_LSUPER, 'lsuper', 0, 0, 0); theInputSystem.addCode (Input.IC_RSUPER, 'rsuper', 0, 0, 0); # other keys ('cursor control', punctuation) theInputSystem.addCode (Input.IC_ESCAPE, 'escape', 0, 0, 0); theInputSystem.addCode (Input.IC_PRINT, 'print', 0, 0, 0); theInputSystem.addCode (Input.IC_PAUSE, 'pause', 0, 0, 0); theInputSystem.addCode (Input.IC_GRAVE, '`', '`'[0], '~'[0], 0); theInputSystem.addCode (Input.IC_MINUS, '-', '-'[0], '_'[0], 0); theInputSystem.addCode (Input.IC_EQUALS, '=', '='[0], '+'[0], 0); theInputSystem.addCode (Input.IC_BACKSLASH, '\\', '\\'[0], '|'[0], 0); theInputSystem.addCode (Input.IC_BACKSPACE, 'backspace', 0, 0, 0); theInputSystem.addCode (Input.IC_TAB, 'tab', 0, 0, 0); theInputSystem.addCode (Input.IC_LBRACKET, '[', '['[0], '{'[0], 0); theInputSystem.addCode (Input.IC_RBRACKET, ']', ']'[0], '}'[0], 0); theInputSystem.addCode (Input.IC_RETURN, 'return', 0, 0, 0); theInputSystem.addCode (Input.IC_SEMICOLON, ';', ';'[0], ':'[0], 0); theInputSystem.addCode (Input.IC_APOSTROPHE, '\'', '\''[0], '"'[0], 0); theInputSystem.addCode (Input.IC_OEM_102, 'oem_102', 0, 0, 0); theInputSystem.addCode (Input.IC_COMMA, ',', ','[0], '<'[0], 0); theInputSystem.addCode (Input.IC_PERIOD, '.', '.'[0], '>'[0], 0); theInputSystem.addCode (Input.IC_SLASH, '/', '/'[0], '?'[0], 0); theInputSystem.addCode (Input.IC_SPACE, 'space', ' '[0], ' '[0], 0); # mouse buttons theInputSystem.addCode (Input.IC_MOUSE_LEFT, 'mouse_left', 0, 0, 0); theInputSystem.addCode (Input.IC_MOUSE_RIGHT, 'mouse_right', 0, 0, 0); theInputSystem.addCode (Input.IC_MOUSE_MIDDLE, 'mouse_middle', 0, 0, 0); #mouse axis theInputSystem.addCode (Input.IC_AXISX, 'axisx', 0, 0, 0); theInputSystem.addCode (Input.IC_AXISY, 'axisy', 0, 0, 0); theInputSystem.addCode (Input.IC_AXISZ, 'axisz', 0, 0, 0); # timer theInputSystem.addCode (Input.IC_AXIST, 'axist', 0, 0, 0); end |
From: Markus R. <rol...@us...> - 2006-01-02 20:39:49
|
Update of /cvsroot/simspark/simspark/spark/kerosin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28754/spark/kerosin Added Files: kerosin.rb Log Message: - added some missing .rb files --- NEW FILE: kerosin.rb --- # # this is the init script of the Kerosin library # # This script creates a BUNCH of variables. It basically sets up the # default settings for all engine namespaces/variables. It also serves # as the documentation for all the settings. #### # Application # # This section contains information about the application being executed. # createVariable('Application.Title', 'Kerosin'); #### # System # # This section contains information about the environment the engine is # executed in, such as font paths. # createVariable('System.FontPath', 'data/fonts'); #### # Viewport # # The Viewport namespace is used to describe all the variables related # to the application window. # createVariable('Viewport.XRes', 640); # width createVariable('Viewport.YRes', 480); # height createVariable('Viewport.FullScreen', false); # run in fullscreen? createVariable('Viewport.DoubleBuffer', true); # use double buffering? # Set up bits per pixel createVariable('Viewport.RedBits', 5); # red bits createVariable('Viewport.GreenBits', 6); # green bits createVariable('Viewport.BlueBits', 5); # blue bits createVariable('Viewport.AlphaBits', 8); # alpha bits # stencil and depth buffers createVariable('Viewport.DepthBits', 16); # depth bits createVariable('Viewport.StencilBits', 0); # stencil bits # dpi for font rendering createVariable('Viewport.DpiHRes', 120); # horizontal resolution (72, 96, 120, 300) createVariable('Viewport.DpiVRes', 120); # vertical resolution (72, 96, 120, 300) |
From: Markus R. <rol...@us...> - 2006-01-02 20:39:22
|
Update of /cvsroot/simspark/simspark/spark/spark In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28688 Modified Files: spark.cpp spark.h Log Message: - added method GetInputServer Index: spark.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/spark/spark.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** spark.cpp 19 Dec 2005 20:09:18 -0000 1.1 --- spark.cpp 2 Jan 2006 20:39:14 -0000 1.2 *************** *** 24,27 **** --- 24,28 ---- #include <oxygen/oxygen.h> #include <kerosin/renderserver/rendercontrol.h> + #include <kerosin/inputserver/inputserver.h> #include <kerosin/inputserver/inputcontrol.h> *************** *** 136,140 **** return shared_dynamic_cast<InputControl> ! (mSimulationServer->GetControlNode("kerosin/InputControl")); } --- 137,147 ---- return shared_dynamic_cast<InputControl> ! (mSimulationServer->GetControlNode("InputControl")); ! } ! ! shared_ptr<InputServer> Spark::GetInputServer() ! { ! return shared_dynamic_cast<kerosin::InputServer> ! (mZeitgeist->GetCore()->Get("/sys/server/input")); } *************** *** 147,154 **** return shared_dynamic_cast<RenderControl> ! (mSimulationServer->GetControlNode("kerosin/RenderControl")); } - shared_ptr<ScriptServer> Spark::GetScriptServer() { --- 154,160 ---- return shared_dynamic_cast<RenderControl> ! (mSimulationServer->GetControlNode("RenderControl")); } shared_ptr<ScriptServer> Spark::GetScriptServer() { Index: spark.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/spark/spark.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** spark.h 19 Dec 2005 20:09:18 -0000 1.1 --- spark.h 2 Jan 2006 20:39:14 -0000 1.2 *************** *** 45,48 **** --- 45,49 ---- class InputControl; class RenderControl; + class InputServer; } *************** *** 89,92 **** --- 90,96 ---- boost::shared_ptr<oxygen::SceneServer> GetSceneServer(); + /** returns the InputServer */ + boost::shared_ptr<kerosin::InputServer> GetInputServer(); + /** returns the current active Scene */ boost::shared_ptr<oxygen::Scene> GetActiveScene(); |
From: Markus R. <rol...@us...> - 2006-01-02 20:38:48
|
Update of /cvsroot/simspark/simspark/spark/plugin/sparkagent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28573 Modified Files: export.cpp Log Message: |
From: Markus R. <rol...@us...> - 2006-01-02 20:37:53
|
Update of /cvsroot/simspark/simspark/spark/oxygen/simulationserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28198 Modified Files: simulationserver.h simulationserver.cpp Log Message: - added method WantsToQuit() to query the quit flag - splitted the RunLoop into several methods that allow it to be driven from outside: Init, Cycle, Done Index: simulationserver.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/simulationserver/simulationserver.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** simulationserver.cpp 5 Dec 2005 21:21:18 -0000 1.1 --- simulationserver.cpp 2 Jan 2006 20:37:41 -0000 1.2 *************** *** 106,109 **** --- 106,114 ---- } + bool SimulationServer::WantsToQuit() + { + return mExit; + } + int SimulationServer::GetArgC() { *************** *** 153,160 **** bool SimulationServer::InitControlNode(const std::string& className, const std::string& name) { ! shared_ptr<SimControlNode> importer = shared_dynamic_cast<SimControlNode>(GetCore()->New(className)); ! if (importer.get() == 0) { GetLog()->Error() << "(SimulationServer) ERROR: " --- 158,165 ---- bool SimulationServer::InitControlNode(const std::string& className, const std::string& name) { ! shared_ptr<SimControlNode> control = shared_dynamic_cast<SimControlNode>(GetCore()->New(className)); ! if (control.get() == 0) { GetLog()->Error() << "(SimulationServer) ERROR: " *************** *** 163,168 **** } ! importer->SetName(name); ! AddChildReference(importer); GetLog()->Normal() --- 168,173 ---- } ! control->SetName(name); ! AddChildReference(control); GetLog()->Normal() *************** *** 191,194 **** --- 196,200 ---- void SimulationServer::AdvanceTime(float deltaTime) { + mSumDeltaTime += deltaTime; } *************** *** 275,281 **** } ! void SimulationServer::Run(int argc, char** argv) { ! GetLog()->Normal() << "(SimulationServer) entering runloop\n"; // cache argc and argv, to make it accessible for registerd --- 281,287 ---- } ! void SimulationServer::Init(int argc, char** argv) { ! GetLog()->Normal() << "(SimulationServer) init\n"; // cache argc and argv, to make it accessible for registerd *************** *** 285,306 **** ControlEvent(CE_Init); while (! mExit) { ! ++mCycle; ! ControlEvent(CE_StartCycle); ! ControlEvent(CE_SenseAgent); ! ControlEvent(CE_ActAgent); ! if (mAutoTime) ! { ! AdvanceTime(mSimStep); ! } ! Step(); ! ControlEvent(CE_EndCycle); } ControlEvent(CE_Done); --- 291,328 ---- ControlEvent(CE_Init); + } + + void SimulationServer::Run(int argc, char** argv) + { + Init(argc, argv); + GetLog()->Normal() << "(SimulationServer) entering runloop\n"; while (! mExit) { ! Cycle(); ! } ! Done(); ! } ! void SimulationServer::Cycle() ! { ! ++mCycle; ! ControlEvent(CE_StartCycle); ! ControlEvent(CE_SenseAgent); ! ControlEvent(CE_ActAgent); ! ! if (mAutoTime) ! { ! AdvanceTime(mSimStep); } + Step(); + + ControlEvent(CE_EndCycle); + } + void SimulationServer::Done() + { ControlEvent(CE_Done); Index: simulationserver.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/simulationserver/simulationserver.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** simulationserver.h 5 Dec 2005 21:21:18 -0000 1.1 --- simulationserver.h 2 Jan 2006 20:37:41 -0000 1.2 *************** *** 61,64 **** --- 61,67 ---- static void Quit(); + /** returns true if Quit() was called previously */ + static bool WantsToQuit(); + /** returns the current simulation time */ virtual float GetTime(); *************** *** 104,108 **** char** GetArgV(); ! /** the runloop of the simulation */ virtual void Run(int argc = 0, char** argv = 0); --- 107,122 ---- char** GetArgV(); ! /** init the runloop and all registered control nodes */ ! virtual void Init(int argc = 0, char** argv = 0); ! ! /** go through on cycle of the runloop, i.e. sense, act, step */ ! virtual void Cycle(); ! ! /** shutdown server and all registered control nodes */ ! virtual void Done(); ! ! /** the runloop of the simulation, i.e. init(), cycle() until ! exit, done() ! */ virtual void Run(int argc = 0, char** argv = 0); |