- How to quickly reach an implementation method from the events list of an item ? Should I do a text search every time or is there a quick way (knowing double-click or right-click doesn't seems to do anything ; from my test) ? Maybe a plugin ?Double-click on the item in the wxSmith UI editor
- Is there a way to have wxWidgets autocompletion ?Yes, works well in recent nightlies and fine here.
- Is there a way to have a quick view of any wxWidgets class, method or property pointed by mouse in current code ?Yes, works well in recent nightlies and fine here.
Double-click on the item in the wxSmith UI editorHmm, OK when it's about control with default event. But how when it's about a menu item or not-default event, for example ?
EDIT : OK, installed nightly build svn 7932 and I've now nice autocompletion and quick tip on mouse hover. So, It just remains to find a smart way to reach every no-default event handlers from resource browser and UI editor ::)Use the CC toolbar - it offers quick access to all methods in/of that file.
EDIT : OK, installed nightly build svn 7932 and I've now nice autocompletion and quick tip on mouse hover. So, It just remains to find a smart way to reach every no-default event handlers from resource browser and UI editor ::)Use the CC toolbar - it offers quick access to all methods in/of that file.
void wxsEventsEditor::PGChanged(wxsItem* Item,wxsPropertyGridManager* Grid,wxPGId Id)
{
// Just small check to avoid some invalid updates
if ( Item != m_Item )
{
return;
}
int Index;
for ( Index=0; Index<(int)m_Ids.Count(); Index++ )
{
if ( m_Ids[Index] == Id ) break;
}
if ( Index>=(int)m_Ids.Count() )
{
return;
}
wxString Selection = Grid->GetPropertyValueAsString(Id);
if ( Selection == NoneStr )
{
m_Events->SetHandler(Index,_T(""));
}
else if ( Selection == AddNewStr )
{
m_Events->SetHandler(Index,GetNewFunction(m_Events->GetDesc(Index)));
BuildEvents(m_Item,Grid);
}
else
{
m_Events->SetHandler(Index,Selection);
GotoHandler(Index);
}
m_Data->NotifyChange(m_Item);
}
bool wxsEventsEditor::GotoHandler(int Index)
{
cbEditor* Editor = Manager::Get()->GetEditorManager()->Open(m_Source);
if ( !Editor )
{
return false;
}
wxString FunctionName = m_Events->GetHandler(Index);
if ( FunctionName.IsEmpty() )
{
return false;
}
cbStyledTextCtrl* Ctrl = Editor->GetControl();
wxString FullText = Ctrl->GetText();
int Begin = 0;
int End = Ctrl->GetLength();
while ( Begin < End )
{
int Pos = Ctrl->FindText(Begin,End,FunctionName,wxSCI_FIND_MATCHCASE);
if ( Pos < 0 ) break;
// Checking if there's <ClassName> :: sequence before function
int Before = Pos;
while ( --Before >= 0 )
{
wxChar Ch = Ctrl->GetCharAt(Before);
if ( Ch!=' ' && Ch!='\t' && Ch!='\r' && Ch!='\n' ) break;
}
if ( Before >= 1 )
{
if ( Ctrl->GetCharAt(Before) == ':' && Ctrl->GetCharAt(Before-1) == ':' )
{
Before--;
while ( --Before >= 0 )
{
wxChar Ch = Ctrl->GetCharAt(Before);
if ( Ch!=' ' && Ch!='\t' && Ch!='\r' && Ch!='\n' ) break;
}
if ( Before > 0 )
{
wxString ClassName;
while ( Before>=0 )
{
wxChar Ch = Ctrl->GetCharAt(Before--);
if ( (Ch<'a' || Ch>'z') && (Ch<'A' || Ch>'Z') && (Ch<'0' || Ch>'9') && (Ch!='_') ) break;
ClassName = Ch + ClassName;
}
if ( ClassName == m_Class )
{
// Test if there's ( after function name
int After = Pos + FunctionName.Length();
while ( After < End )
{
wxChar Ch = Ctrl->GetCharAt(After);
if ( Ch!=' ' && Ch!='\t' && Ch!='\r' && Ch!='\n' ) break;
After++;
}
if ( After < End )
{
if ( Ctrl->GetCharAt(After) == '(' )
{
Editor->GotoLine(Ctrl->LineFromPosition(Pos));
return true;
}
}
}
}
}
}
Begin = Pos + FunctionName.Length();
}
return false;
}
namespace
{
const wxString NoneStr = _("-- None --");
const wxString AddNewStr = _("-- Add new handler --");
}
GotoHandler(Index);
Index: wxspropertygridmanager.cpp
===================================================================
--- wxspropertygridmanager.cpp (revision 8067)
+++ wxspropertygridmanager.cpp (working copy)
@@ -101,6 +101,41 @@
MainContainer->OnExtraPropertyChanged(this,ID);
}
+void wxsPropertyGridManager::OnDoubleClick(wxPropertyGridEvent& event)
+{
+ wxPGId ID = event.GetProperty();
+ for ( size_t i = PGIDs.Count(); i-- > 0; )
+ {
+ if ( PGIDs[i] == ID )
+ {
+ wxsPropertyContainer* Container = PGContainers[i];
+ if ( !PGEnteries[i]->PGRead(Container,this,ID,PGIndexes[i]) )
+ {
+ wxString ErrorMsg;
+ ErrorMsg << _T("wxSmith: Couldn't read value from wxsPropertyGridManager")
+ << _T(", propgrid name=") << PGEnteries[i]->GetPGName()
+ << _T(", date name=") << PGEnteries[i]->GetDataName()
+ << _T(", type name=") << PGEnteries[i]->GetTypeName();
+ Manager::Get()->GetLogManager()->DebugLogError(ErrorMsg);
+ }
+
+ // Notifying about property change
+ Container->NotifyPropertyChangeFromPropertyGrid();
+
+ // Notifying about sub property change
+ if ( Container!=MainContainer && MainContainer!=0 )
+ {
+ MainContainer->OnSubPropertyChanged(Container);
+ }
+ Update(0);
+ return;
+ }
+ }
+
+ // Did not found changed id, it's time to say to container
+ MainContainer->OnExtraPropertyChanged(this,ID);
+}
+
void wxsPropertyGridManager::Update(wxsPropertyContainer* PC)
{
if ( PC && PGContainersSet.find(PC) == PGContainersSet.end() )
@@ -306,4 +341,5 @@
BEGIN_EVENT_TABLE(wxsPropertyGridManager,wxPropertyGridManager)
EVT_PG_CHANGED(-1,wxsPropertyGridManager::OnChange)
+ EVT_PG_DOUBLE_CLICK(-1,wxsPropertyGridManager::OnDoubleClick)
END_EVENT_TABLE()
Index: wxspropertygridmanager.h
===================================================================
--- wxspropertygridmanager.h (revision 8067)
+++ wxspropertygridmanager.h (working copy)
@@ -95,7 +95,7 @@
/** \brief Function unbinding given container
*
- * This function destroys all property enteries using given container.
+ * This function destroys all property entries using given container.
* It's automatically called in container's destructor but it may
* be used in other places too.
*
@@ -130,9 +130,12 @@
/** \brief Changing main property container */
void SetNewMainContainer(wxsPropertyContainer* NewMain);
- /** \brief Handler for roporting change event */
+ /** \brief Handler for reporting change event */
void OnChange(wxPropertyGridEvent& event);
+ /** \brief Handler for jumping to event handler */
+ void OnDoubleClick(wxPropertyGridEvent& event);
+
/** \brief Data of selected property */
struct SelectionData
{
@@ -150,7 +153,7 @@
/** \brief Restoring selected property
*
* \param Data structure containing selection data, if NULL,
- * selection will be resotred from internal variable
+ * selection will be restored from internal variable
*/
void RestoreSelected(const SelectionData* Data=0);
@@ -171,7 +174,7 @@
WX_DECLARE_HASH_SET(wxsPropertyContainer*,wxPointerHash,wxPointerEqual,wxSetCont);
wxArrayPGId PGIDs; ///< \brief Array of property identifiers
- wxArrayProps PGEnteries; ///< \brief Array mapping enteries in grid to properties
+ wxArrayProps PGEnteries; ///< \brief Array mapping entries in grid to properties
wxArrayLong PGIndexes; ///< \brief Array of internal property indexes used inside wxsProperty
wxArrayCont PGContainers; ///< \brief Array of container objects associated with properties
wxSetCont PGContainersSet; ///< \brief Set of used containers, will be used to quickly determine if given container is used in manager
@@ -190,7 +193,7 @@
friend class wxsPropertyContainer;
};
-/** \brief Macro for easy acces to property grid manager */
+/** \brief Macro for easy access to property grid manager */
#define wxsPGRID() wxsPropertyGridManager::Get()
#endif
But I'm not a wxsmith guru, so you may find some time to implement this nice feature.
But I'm not a wxsmith guru, so you may find some time to implement this nice feature.
I was on other fields since june and this is the reason why of the delay between your post and my reaction, Ollydbg. I fully agree : it would be nice to have this kind of feature (a way to reach declaration or implementation of an event-handler from the events list).
Maybe there's an offcial place to submit feature ?!
Index: properties/wxspropertygridmanager.cpp
===================================================================
--- properties/wxspropertygridmanager.cpp (revision 8249)
+++ properties/wxspropertygridmanager.cpp (working copy)
@@ -306,4 +306,5 @@
BEGIN_EVENT_TABLE(wxsPropertyGridManager,wxPropertyGridManager)
EVT_PG_CHANGED(-1,wxsPropertyGridManager::OnChange)
+ EVT_PG_DOUBLE_CLICK(-1,wxsPropertyGridManager::OnChange)
END_EVENT_TABLE()
Index: wxwidgets/wxseventseditor.cpp
===================================================================
--- wxwidgets/wxseventseditor.cpp (revision 8249)
+++ wxwidgets/wxseventseditor.cpp (working copy)
@@ -151,6 +151,15 @@
}
wxString Selection = Grid->GetPropertyValueAsString(Id);
+ wxString oldHandlerName = m_Events->GetHandler(Index);
+ if ( (!oldHandlerName.IsEmpty()) && oldHandlerName.IsSameAs(Selection) )
+ {
+ // which means this event is emulated from the double click on the event ID name,
+ // user want to jump to the implementation of this event handler function body,
+ // no need to rebuild the event and notify other part
+ GotoHandler(Index);
+ return;
+ }
if ( Selection == NoneStr )
{
Is it present in the current nightly build,NO.
Olly, or should we add-it by ourself in the source for testing ?To test it: Check out the codeblocks' source code, apply the patch, and build the source yourself.
OK, I'll try to test-it tomorrow.Thanks for the test.
--
EDIT : oops ! tommorow being today since it's already 1:42 AM... So after my personal human nightly sleep, I mean :)
EDIT #2 : It works for me ! Nice feature, Ollydbg. Tested under Win7 with patch added in source code of C::B SVN rev 8328 (against wx 2.8.12 ; this precision because I've seen a wx 2.9 workspace beside, but don't know if it's fully ready for buidling).
[...]
I've seen a wx 2.9 workspace beside, but don't know if it's fully ready for buidling
[...]