SCI_SETWRAPMODE(int wrapMode)
SCI_GETWRAPMODE
Set wrapMode to SC_WRAP_WORD (1) to enable wrapping on word boundaries, SC_WRAP_CHAR (2) to enable wrapping between any characters, and to SC_WRAP_NONE (0) to disable line wrapping. SC_WRAP_CHAR is preferred to SC_WRAP_WORD for Asian languages where there is no white space between words.
From a65d48522278281a0106ce22b74d7c5c3a89dfb1 Mon Sep 17 00:00:00 2001
From: asmwarrior <asmwarrior@gmail.com>
Date: Thu, 19 Sep 2013 18:11:27 +0800
Subject: [PATCH] * EditorTweaks: introduce wrap char mode
---
src/plugins/contrib/EditorTweaks/EditorTweaks.cpp | 31 +++++++++++++++++++----
src/plugins/contrib/EditorTweaks/EditorTweaks.h | 1 +
2 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/src/plugins/contrib/EditorTweaks/EditorTweaks.cpp b/src/plugins/contrib/EditorTweaks/EditorTweaks.cpp
index cfa8062..88939af 100644
--- a/src/plugins/contrib/EditorTweaks/EditorTweaks.cpp
+++ b/src/plugins/contrib/EditorTweaks/EditorTweaks.cpp
@@ -42,6 +42,7 @@ namespace
int id_et = wxNewId();
int id_et_WordWrap = wxNewId();
+int id_et_CharWrap = wxNewId();
int id_et_ShowLineNumbers = wxNewId();
int id_et_TabChar = wxNewId();
int id_et_TabIndent = wxNewId();
@@ -75,6 +76,7 @@ int id_et_ScrollTimer = wxNewId();
// events handling
BEGIN_EVENT_TABLE(EditorTweaks, cbPlugin)
EVT_UPDATE_UI(id_et_WordWrap, EditorTweaks::OnUpdateUI)
+ EVT_UPDATE_UI(id_et_CharWrap, EditorTweaks::OnUpdateUI)
EVT_UPDATE_UI(id_et_ShowLineNumbers, EditorTweaks::OnUpdateUI)
EVT_UPDATE_UI(id_et_TabChar, EditorTweaks::OnUpdateUI)
EVT_UPDATE_UI(id_et_TabIndent, EditorTweaks::OnUpdateUI)
@@ -91,6 +93,7 @@ BEGIN_EVENT_TABLE(EditorTweaks, cbPlugin)
EVT_MENU(id_et_WordWrap, EditorTweaks::OnWordWrap)
+ EVT_MENU(id_et_CharWrap, EditorTweaks::OnCharWrap)
EVT_MENU(id_et_ShowLineNumbers, EditorTweaks::OnShowLineNumbers)
EVT_MENU(id_et_TabChar, EditorTweaks::OnTabChar)
EVT_MENU(id_et_TabIndent, EditorTweaks::OnTabIndent)
@@ -276,7 +279,8 @@ void EditorTweaks::BuildMenu(wxMenuBar* menuBar)
wxMenu *submenu=m_tweakmenu; //_("Editor Tweaks")
- submenu->AppendCheckItem( id_et_WordWrap, _( "Word wrap" ), _( "Wrap text" ) );
+ submenu->AppendCheckItem( id_et_WordWrap, _( "Word wrap" ), _( "Wrap word" ) );
+ submenu->AppendCheckItem( id_et_CharWrap, _( "Char wrap" ), _( "Wrap char" ) );
submenu->AppendCheckItem( id_et_ShowLineNumbers, _( "Show Line Numbers" ), _( "Show Line Numbers" ) );
submenu->AppendSeparator();
submenu->AppendCheckItem( id_et_TabChar, _( "Use Tab Character" ), _( "Use Tab Character" ) );
@@ -359,7 +363,8 @@ void EditorTweaks::UpdateUI()
wxMenu *submenu = m_tweakmenu; //_("Editor Tweaks") TODO: Retrieve actual menu
m_isUpdatingUI = true; // ignore events the following can trigger
- submenu->Check(id_et_WordWrap,ed->GetControl()->GetWrapMode()>0);
+ submenu->Check(id_et_WordWrap,ed->GetControl()->GetWrapMode()==wxSCI_WRAP_WORD);
+ submenu->Check(id_et_CharWrap,ed->GetControl()->GetWrapMode()==wxSCI_WRAP_CHAR);
submenu->Check(id_et_ShowLineNumbers,ed->GetControl()->GetMarginWidth(0)>0);
submenu->Check(id_et_TabChar,ed->GetControl()->GetUseTabs());
submenu->Check(id_et_TabIndent,ed->GetControl()->GetTabIndents());
@@ -639,10 +644,14 @@ void EditorTweaks::BuildModuleMenu(const ModuleType type, wxMenu* menu, const Fi
menu->Append(id_et,_("Editor Tweaks"),submenu);
- submenu->AppendCheckItem( id_et_WordWrap, _( "Word wrap" ), _( "Wrap text" ) );
- if (ed->GetControl()->GetWrapMode()>0)
+ submenu->AppendCheckItem( id_et_WordWrap, _( "Word wrap" ), _( "Wrap word" ) );
+ if (ed->GetControl()->GetWrapMode()==wxSCI_WRAP_WORD)
submenu->Check(id_et_WordWrap,true);
+ submenu->AppendCheckItem( id_et_CharWrap, _( "Char wrap" ), _( "Wrap char" ) );
+ if (ed->GetControl()->GetWrapMode()==wxSCI_WRAP_CHAR)
+ submenu->Check(id_et_CharWrap,true);
+
submenu->AppendCheckItem( id_et_ShowLineNumbers, _( "Show Line Numbers" ), _( "Show Line Numbers" ) );
if (ed->GetControl()->GetMarginWidth(0)>0)
submenu->Check(id_et_ShowLineNumbers,true);
@@ -704,14 +713,26 @@ void EditorTweaks::OnWordWrap(wxCommandEvent &/*event*/)
if (!ed || !ed->GetControl() || m_isUpdatingUI)
return;
- bool enabled=ed->GetControl()->GetWrapMode()>0;
+ bool enabled=ed->GetControl()->GetWrapMode()==wxSCI_WRAP_WORD;
if (enabled)
ed->GetControl()->SetWrapMode(wxSCI_WRAP_NONE);
else
ed->GetControl()->SetWrapMode(wxSCI_WRAP_WORD);
+}
+
+void EditorTweaks::OnCharWrap(wxCommandEvent &/*event*/)
+{
+ cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
+ if (!ed || !ed->GetControl() || m_isUpdatingUI)
+ return;
+ bool enabled=ed->GetControl()->GetWrapMode()==wxSCI_WRAP_CHAR;
+ if (enabled)
+ ed->GetControl()->SetWrapMode(wxSCI_WRAP_NONE);
+ else
+ ed->GetControl()->SetWrapMode(wxSCI_WRAP_CHAR);
}
void EditorTweaks::OnShowLineNumbers(wxCommandEvent &/*event*/)
diff --git a/src/plugins/contrib/EditorTweaks/EditorTweaks.h b/src/plugins/contrib/EditorTweaks/EditorTweaks.h
index aa15f9a..86c3074 100644
--- a/src/plugins/contrib/EditorTweaks/EditorTweaks.h
+++ b/src/plugins/contrib/EditorTweaks/EditorTweaks.h
@@ -106,6 +106,7 @@ class EditorTweaks : public cbPlugin
void OnKeyPress(wxKeyEvent& event);
void OnChar(wxKeyEvent& event);
void OnWordWrap(wxCommandEvent &event);
+ void OnCharWrap(wxCommandEvent &event);
void OnShowLineNumbers(wxCommandEvent &event);
void OnTabChar(wxCommandEvent &event);
void OnTabIndent(wxCommandEvent &event);
--
1.8.4.msysgit.0
Calling ed->GetControl() at every line is plain ugly. Please save it in a variable and use it instead.No, I did not do that. Wrap mode is set once for the whole editor, no need for each lines.
void EditorTweaks::OnCharWrap(wxCommandEvent &/*event*/)
+{
+ cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
+ if (!ed || !ed->GetControl() || m_isUpdatingUI)
+ return;
+ bool enabled=ed->GetControl()->GetWrapMode()==wxSCI_WRAP_CHAR;
+ if (enabled)
+ ed->GetControl()->SetWrapMode(wxSCI_WRAP_NONE);
+ else
+ ed->GetControl()->SetWrapMode(wxSCI_WRAP_CHAR);
}
OK, the function name cause confusion. :)Codevoid EditorTweaks::OnCharWrap(wxCommandEvent &/*event*/)
+{
+ cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
+ if (!ed || !ed->GetControl() || m_isUpdatingUI)
+ return;
+ bool enabled=ed->GetControl()->GetWrapMode()==wxSCI_WRAP_CHAR;
+ if (enabled)
+ ed->GetControl()->SetWrapMode(wxSCI_WRAP_NONE);
+ else
+ ed->GetControl()->SetWrapMode(wxSCI_WRAP_CHAR);
}
Count the number of occurrences of ed->GetControl() and then count the number of lines of the function:)
Hm, it seems that I'm not clear enough.
In the snippet I've posted you have 4 calls to ed->GetControl(), instead of just doing "Control *control=ed->GetControl();" and then just use control.
Hm, it seems that I'm not clear enough.What about this:
In the snippet I've posted you have 4 calls to ed->GetControl(), instead of just doing "Control *control=ed->GetControl();" and then just use control.
src/plugins/contrib/EditorTweaks/EditorTweaks.cpp | 43 ++++++++++++++++++-----
src/plugins/contrib/EditorTweaks/EditorTweaks.h | 1 +
2 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/src/plugins/contrib/EditorTweaks/EditorTweaks.cpp b/src/plugins/contrib/EditorTweaks/EditorTweaks.cpp
index cfa8062..fa1c2ad 100644
--- a/src/plugins/contrib/EditorTweaks/EditorTweaks.cpp
+++ b/src/plugins/contrib/EditorTweaks/EditorTweaks.cpp
@@ -42,6 +42,7 @@ namespace
int id_et = wxNewId();
int id_et_WordWrap = wxNewId();
+int id_et_CharWrap = wxNewId();
int id_et_ShowLineNumbers = wxNewId();
int id_et_TabChar = wxNewId();
int id_et_TabIndent = wxNewId();
@@ -75,6 +76,7 @@ int id_et_ScrollTimer = wxNewId();
// events handling
BEGIN_EVENT_TABLE(EditorTweaks, cbPlugin)
EVT_UPDATE_UI(id_et_WordWrap, EditorTweaks::OnUpdateUI)
+ EVT_UPDATE_UI(id_et_CharWrap, EditorTweaks::OnUpdateUI)
EVT_UPDATE_UI(id_et_ShowLineNumbers, EditorTweaks::OnUpdateUI)
EVT_UPDATE_UI(id_et_TabChar, EditorTweaks::OnUpdateUI)
EVT_UPDATE_UI(id_et_TabIndent, EditorTweaks::OnUpdateUI)
@@ -91,6 +93,7 @@ BEGIN_EVENT_TABLE(EditorTweaks, cbPlugin)
EVT_MENU(id_et_WordWrap, EditorTweaks::OnWordWrap)
+ EVT_MENU(id_et_CharWrap, EditorTweaks::OnCharWrap)
EVT_MENU(id_et_ShowLineNumbers, EditorTweaks::OnShowLineNumbers)
EVT_MENU(id_et_TabChar, EditorTweaks::OnTabChar)
EVT_MENU(id_et_TabIndent, EditorTweaks::OnTabIndent)
@@ -276,7 +279,8 @@ void EditorTweaks::BuildMenu(wxMenuBar* menuBar)
wxMenu *submenu=m_tweakmenu; //_("Editor Tweaks")
- submenu->AppendCheckItem( id_et_WordWrap, _( "Word wrap" ), _( "Wrap text" ) );
+ submenu->AppendCheckItem( id_et_WordWrap, _( "Word wrap" ), _( "Wrap word" ) );
+ submenu->AppendCheckItem( id_et_CharWrap, _( "Char wrap" ), _( "Wrap char" ) );
submenu->AppendCheckItem( id_et_ShowLineNumbers, _( "Show Line Numbers" ), _( "Show Line Numbers" ) );
submenu->AppendSeparator();
submenu->AppendCheckItem( id_et_TabChar, _( "Use Tab Character" ), _( "Use Tab Character" ) );
@@ -359,7 +363,8 @@ void EditorTweaks::UpdateUI()
wxMenu *submenu = m_tweakmenu; //_("Editor Tweaks") TODO: Retrieve actual menu
m_isUpdatingUI = true; // ignore events the following can trigger
- submenu->Check(id_et_WordWrap,ed->GetControl()->GetWrapMode()>0);
+ submenu->Check(id_et_WordWrap,ed->GetControl()->GetWrapMode()==wxSCI_WRAP_WORD);
+ submenu->Check(id_et_CharWrap,ed->GetControl()->GetWrapMode()==wxSCI_WRAP_CHAR);
submenu->Check(id_et_ShowLineNumbers,ed->GetControl()->GetMarginWidth(0)>0);
submenu->Check(id_et_TabChar,ed->GetControl()->GetUseTabs());
submenu->Check(id_et_TabIndent,ed->GetControl()->GetTabIndents());
@@ -639,10 +644,14 @@ void EditorTweaks::BuildModuleMenu(const ModuleType type, wxMenu* menu, const Fi
menu->Append(id_et,_("Editor Tweaks"),submenu);
- submenu->AppendCheckItem( id_et_WordWrap, _( "Word wrap" ), _( "Wrap text" ) );
- if (ed->GetControl()->GetWrapMode()>0)
+ submenu->AppendCheckItem( id_et_WordWrap, _( "Word wrap" ), _( "Wrap word" ) );
+ if (ed->GetControl()->GetWrapMode()==wxSCI_WRAP_WORD)
submenu->Check(id_et_WordWrap,true);
+ submenu->AppendCheckItem( id_et_CharWrap, _( "Char wrap" ), _( "Wrap char" ) );
+ if (ed->GetControl()->GetWrapMode()==wxSCI_WRAP_CHAR)
+ submenu->Check(id_et_CharWrap,true);
+
submenu->AppendCheckItem( id_et_ShowLineNumbers, _( "Show Line Numbers" ), _( "Show Line Numbers" ) );
if (ed->GetControl()->GetMarginWidth(0)>0)
submenu->Check(id_et_ShowLineNumbers,true);
@@ -701,17 +710,35 @@ void EditorTweaks::BuildModuleMenu(const ModuleType type, wxMenu* menu, const Fi
void EditorTweaks::OnWordWrap(wxCommandEvent &/*event*/)
{
cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
- if (!ed || !ed->GetControl() || m_isUpdatingUI)
+ if (!ed || m_isUpdatingUI)
+ return;
+ cbStyledTextCtrl* control = ed->GetControl();
+ if (!control)
return;
- bool enabled=ed->GetControl()->GetWrapMode()>0;
+ bool enabled = control->GetWrapMode() == wxSCI_WRAP_WORD;
if (enabled)
- ed->GetControl()->SetWrapMode(wxSCI_WRAP_NONE);
+ control->SetWrapMode(wxSCI_WRAP_NONE);
else
- ed->GetControl()->SetWrapMode(wxSCI_WRAP_WORD);
+ control->SetWrapMode(wxSCI_WRAP_WORD);
+}
+void EditorTweaks::OnCharWrap(wxCommandEvent &/*event*/)
+{
+ cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
+ if (!ed || m_isUpdatingUI)
+ return;
+ cbStyledTextCtrl* control = ed->GetControl();
+ if (!control)
+ return;
+ bool enabled = control->GetWrapMode() == wxSCI_WRAP_CHAR;
+
+ if (enabled)
+ control->SetWrapMode(wxSCI_WRAP_NONE);
+ else
+ control->SetWrapMode(wxSCI_WRAP_CHAR);
}
void EditorTweaks::OnShowLineNumbers(wxCommandEvent &/*event*/)
diff --git a/src/plugins/contrib/EditorTweaks/EditorTweaks.h b/src/plugins/contrib/EditorTweaks/EditorTweaks.h
index aa15f9a..86c3074 100644
--- a/src/plugins/contrib/EditorTweaks/EditorTweaks.h
+++ b/src/plugins/contrib/EditorTweaks/EditorTweaks.h
@@ -106,6 +106,7 @@ class EditorTweaks : public cbPlugin
void OnKeyPress(wxKeyEvent& event);
void OnChar(wxKeyEvent& event);
void OnWordWrap(wxCommandEvent &event);
+ void OnCharWrap(wxCommandEvent &event);
void OnShowLineNumbers(wxCommandEvent &event);
void OnTabChar(wxCommandEvent &event);
void OnTabIndent(wxCommandEvent &event);
void EditorTweaks::OnXXXXXXX(wxCommandEvent &/*event*/)
{
cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
if (!ed || !ed->GetControl() || m_isUpdatingUI)
return;
ed->GetControl()->XXXXXX();
....
ed->GetControl()->YYYYYY();
}
cbStyledTextCtrl* EditorTweaks::GetSafeControl()
{
cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
if (!ed || m_isUpdatingUI)
return nullptr;
return ed->GetControl();
}
void EditorTweaks::OnXXXXXXX(wxCommandEvent &/*event*/)
{
cbStyledTextCtrl* control = GetSafeControl();
if (!control || m_isUpdatingUI)
return;
control->XXXXXX();
....
control->YYYYYY();
}
You can go the EditorTweaks::GetSafeControl() path if you know that you'll use the function a lot.I'm on the way, thanks.
void EditorTweaks::UpdateUI()
{
if (!m_tweakmenu)
return;
cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
if (!ed || !ed->GetControl())
{
m_tweakmenuitem->Enable(false);
return;
}
m_tweakmenuitem->Enable(true);
wxMenu *submenu = m_tweakmenu; //_("Editor Tweaks") TODO: Retrieve actual menu
m_isUpdatingUI = true; // ignore events the following can trigger
submenu->Check(id_et_WordWrap,ed->GetControl()->GetWrapMode()==wxSCI_WRAP_WORD); // FIXME (ollydbg#1#09/26/13): Dose this Check function cause an menu event handler call?
submenu->Check(id_et_CharWrap,ed->GetControl()->GetWrapMode()==wxSCI_WRAP_CHAR);
submenu->Check(id_et_ShowLineNumbers,ed->GetControl()->GetMarginWidth(0)>0);
submenu->Check(id_et_TabChar,ed->GetControl()->GetUseTabs());
submenu->Check(id_et_TabIndent,ed->GetControl()->GetTabIndents());
submenu->Check(id_et_TabSize2,ed->GetControl()->GetTabWidth()==2);
submenu->Check(id_et_TabSize4,ed->GetControl()->GetTabWidth()==4);
submenu->Check(id_et_TabSize6,ed->GetControl()->GetTabWidth()==6);
submenu->Check(id_et_TabSize8,ed->GetControl()->GetTabWidth()==8);
submenu->Check(id_et_EOLCRLF,ed->GetControl()->GetEOLMode()==wxSCI_EOL_CRLF);
submenu->Check(id_et_EOLCR,ed->GetControl()->GetEOLMode()==wxSCI_EOL_CR);
submenu->Check(id_et_EOLLF,ed->GetControl()->GetEOLMode()==wxSCI_EOL_LF);
submenu->Check(id_et_ShowEOL,ed->GetControl()->GetViewEOL());
submenu->Check(id_et_SuppressInsertKey, m_suppress_insert);
submenu->Check(id_et_ConvertBraces, m_convert_braces);
m_isUpdatingUI = false; // done
}
void EditorTweaks::OnCharWrap(wxCommandEvent &/*event*/)
{
cbStyledTextCtrl* control = GetSafeControl();
if (!control)
return;
bool enabled = control->GetWrapMode() == wxSCI_WRAP_CHAR;
if (enabled)
control->SetWrapMode(wxSCI_WRAP_NONE);
else
control->SetWrapMode(wxSCI_WRAP_CHAR);
}
....
cbStyledTextCtrl* EditorTweaks::GetSafeControl()
{
cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
if (!ed || m_isUpdatingUI)
return nullptr;
return ed->GetControl();
}
submenu->Check(id_et_TabChar,ed->GetControl()->GetUseTabs());
void EditorTweaks::OnCharWrap(wxCommandEvent &/*event*/)
Does this means you have some chance thatCodewill internally callsubmenu->Check(id_et_TabChar,ed->GetControl()->GetUseTabs());
Code?void EditorTweaks::OnCharWrap(wxCommandEvent &/*event*/)
In case this does change the status of id_et_TabChar (from check to unchecked or inverse), does this cause some error?
Thanks.
From my research of wx's source, I think that manually runing the functionsDoes this means you have some chance thatCodewill internally callsubmenu->Check(id_et_TabChar,ed->GetControl()->GetUseTabs());
Code?void EditorTweaks::OnCharWrap(wxCommandEvent &/*event*/)
In case this does change the status of id_et_TabChar (from check to unchecked or inverse), does this cause some error?
Thanks.
I think that was my reasoning for including that check. Presumably there are nicer ways of handling this.
void wxMenuBase::Check( int id, bool enable )
This is often a problem with GTK so I assumed it would also be a problem with wxGTK. If you are sure it isn't then go ahead and remove it.Ok, I asked this question on wx forums, and some one give me the reply, Re: wxMenu Check() cause event handler to be called? (http://forums.wxwidgets.org/viewtopic.php?f=1&t=38070&p=155154#p155153), now I need some one help to give me the result on Linux. BTW: I do have have a Linux system.
Ping, any one can test this on Linux, thanks.This is often a problem with GTK so I assumed it would also be a problem with wxGTK. If you are sure it isn't then go ahead and remove it.Ok, I asked this question on wx forums, and some one give me the reply, Re: wxMenu Check() cause event handler to be called? (http://forums.wxwidgets.org/viewtopic.php?f=1&t=38070&p=155154#p155153), now I need some one help to give me the result on Linux. BTW: I do have have a Linux system.
@dmoorePing, any one can test this on Linux, thanks.This is often a problem with GTK so I assumed it would also be a problem with wxGTK. If you are sure it isn't then go ahead and remove it.Ok, I asked this question on wx forums, and some one give me the reply, Re: wxMenu Check() cause event handler to be called? (http://forums.wxwidgets.org/viewtopic.php?f=1&t=38070&p=155154#p155153), now I need some one help to give me the result on Linux. BTW: I do have have a Linux system.
Ok, seems to work fine without the m_isUpdatingUI check. Go ahead and commit your change.Thank you for testing.
@admins: Please move these posts there.Done.
C::B starts, but is not able to load a project: it hangs and I have to kill C::B.Even worse for me: C::B crashes immediately on startup not leaving any debug log if I leave the editortweaks plugin enabled. It works fine when disabling (removing) this plugin.
If I disable Editor Tweaks, my project can be loaded.
Should be fixed in trunk.Thank you for fixing this.
@devs: Please add -Werror=return-type in your global compiler settings, it makes life a lot easier :)
Should be fixed in trunk.I'm afraid not - its still crashing for me. ???
I'm afraid not - its still crashing for me. ???OK - now it should be REALLY fixed.
cbStyledTextCtrl* EditorTweaks::GetSafeControl()
{
cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
if (!ed || m_isUpdatingUI)
return nullptr;
return ed->GetControl();
}
cbStyledTextCtrl* EditorTweaks::GetSafeControl()
{
cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
if (!ed)
return ed->GetControl();
}
It is generally not safe to call SDK methods if the plugin is not attached (that's what the method IsAttached() is for). So the change in the two places should be fine.I'm curious that this bug should be already in trunk before rev 9382, since I don't change the control sequence in the rev 9382. Do you have a crash call stack? I'm curious which function cause this crash issue. :)
Do you have a crash call stack? I'm curious which function cause this crash issue. :)Yes I had one but deleted it already. It was from PluginManager -> RegisterPlugin calling the plugins initialisation routine which caused an updateui event. this caused the illegal method call I had mentioned. Just trust me. :-)