Update of /cvsroot/simspark/simspark/contrib/rsgedit
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21445
Modified Files:
Tag: RSGEDIT_FILEREF
mainframe.cpp mainframe.h
Log Message:
- show a context menu when the user right clicks on a node in the scene tree control
Index: mainframe.h
===================================================================
RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.h,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -C2 -d -r1.12 -r1.12.2.1
*** mainframe.h 15 Apr 2007 11:16:11 -0000 1.12
--- mainframe.h 29 Apr 2007 15:33:59 -0000 1.12.2.1
***************
*** 101,104 ****
--- 101,106 ----
void OnHelpAbout(wxCommandEvent& event);
+ void OnContextProperties(wxCommandEvent& event);
+
void OnExit(wxCommandEvent& event);
void OnClose( wxCloseEvent& event );
Index: mainframe.cpp
===================================================================
RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -C2 -d -r1.16 -r1.16.2.1
*** mainframe.cpp 15 Apr 2007 11:49:06 -0000 1.16
--- mainframe.cpp 29 Apr 2007 15:33:59 -0000 1.16.2.1
***************
*** 78,81 ****
--- 78,83 ----
EVT_MENU(ID_HELP_ABOUT, mainframe::OnHelpAbout)
+ EVT_MENU(ID_CONTEXT_PROPERTIES, mainframe::OnContextProperties)
+
EVT_TIMER(TI_LOG, mainframe::OnLogTimer)
EVT_TIMER(TI_FPS, mainframe::OnFPSTimer)
***************
*** 602,616 ****
{
shared_ptr<Leaf> leaf = mSparkTree.GetLeaf(event.GetItem()).lock();
! if (leaf.get() == 0)
{
return;
}
!
! wxString location(leaf->GetFullPath().c_str(), wxConvUTF8);
!
! propertyframe* frame(new propertyframe(this, wxID_ANY, location));
! frame->SetLeaf(leaf);
! frame->SetTitle(location);
! frame->Show();
}
--- 604,615 ----
{
shared_ptr<Leaf> leaf = mSparkTree.GetLeaf(event.GetItem()).lock();
! wxMenu* context = SparkContext::GetInstance().GetContextMenu(leaf);
!
! if (context == 0)
{
return;
}
!
! PopupMenu(context);
}
***************
*** 626,629 ****
--- 625,646 ----
}
+
+ void mainframe::OnContextProperties(wxCommandEvent& event)
+ {
+ weak_ptr<Leaf> leaf = SparkContext::GetInstance().GetContextNode();
+ if (leaf.expired())
+ {
+ assert(false);
+ return;
+ }
+
+ wxString location(leaf.lock()->GetFullPath().c_str(), wxConvUTF8);
+
+ propertyframe* frame(new propertyframe(this, wxID_ANY, location));
+ frame->SetLeaf(leaf);
+ frame->SetTitle(location);
+ frame->Show();
+ }
+
void mainframe::RefreshProperties()
{
|