Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
External use of cbEditor
dje:
Hi !!
Tested my cbEditor evolution from :
--- Code: ---void cbStyledTextCtrl::OnContextMenu(wxContextMenuEvent& event)
{
if (m_pParent)
{
/* or use noeditor to handle "contect menu" key?
*/
const bool is_right_click = event.GetPosition()!=wxDefaultPosition;
const wxPoint mp(is_right_click ? event.GetPosition() : wxDefaultPosition);
reinterpret_cast<cbEditor*>(m_pParent)->DisplayContextMenu(mp,mtEditorManager); //pecan 2006/03/22
}
}
--- End code ---
To :
--- Code: ---void cbStyledTextCtrl::OnContextMenu(wxContextMenuEvent& event)
{
if ( m_pParent != NULL )
{
cbEditor* pParent = dynamic_cast<cbEditor*>(m_pParent);
if ( pParent != NULL )
{
const bool is_right_click = event.GetPosition()!=wxDefaultPosition;
const wxPoint mp(is_right_click ? event.GetPosition() : wxDefaultPosition);
pParent->DisplayContextMenu(mp,mtEditorManager);
}
else
{
event.Skip();
}
}
}
--- End code ---
I don't see any side effects or undesired behaviour.
Unless any remaks, I'll SVN this change.
Dje
Pecan:
--- Quote ---Pekan, I found one of your modification in cbEditor.cpp :
Code:
reinterpret_cast<cbEditor*>(m_pParent)->DisplayContextMenu(mp,mtEditorManager); //pecan 2006/03/22
What do you think about replacing it by :
Code:
cbEditor* pParent = dynamic_cast<cbEditor*>(m_pParent);
if ( pParent != NULL )
{
pParent->DisplayContextMenu(mp,mtEditorManager);
}
else
{
event.Skip();
}
Did you intentionnaly ommit the event.Skip ?
I think wxScintilla will be able to manage ctx menu with this evol.
--- End quote ---
Not intentional. Forgetting Skip()s is a common error.
I see you are going to submit a patch.
The core devs will have to approve and apply it.
dje:
Patch submitted, Id : 001704
BTW, are patches a mean to filter code modifs (instead of commit file directly) ?
Dje
Pecan:
--- Quote from: dje on December 08, 2006, 01:52:55 pm ---Patch submitted, Id : 001704
BTW, are patches a mean to filter code modifs (instead of commit file directly) ?
Dje
--- End quote ---
Google: No definition found for modif.
If that means modifications? then yes. Only a few of the developers are allowed to modify the code directly.
dje:
--- Quote ---If that means modifications?
--- End quote ---
Yes, probably to hungry :)
Dje
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version