Patch #3340 2012-09-29 00:40
alpha0010
SpellChecker: more dictionary based tools- Download
- 3340-SpellChecker_m.patch (28.8 KB)
Index: src/plugins/contrib/SpellChecker/SpellCheckSettingsPanel.h
===================================================================
--- src/plugins/contrib/SpellChecker/SpellCheckSettingsPanel.h (revision 8417)
+++ src/plugins/contrib/SpellChecker/SpellCheckSettingsPanel.h (working copy)
@@ -60,12 +60,14 @@
wxTextCtrl* m_TextThPath;
wxChoice* m_choiceDictionary;
wxStaticText* StaticText2;
+ wxCheckBox* m_checkThesaurusTooltips;
wxTextCtrl* m_TextDictPath;
wxButton* Button1;
wxStaticText* StaticText1;
wxStaticText* StaticText3;
wxHyperlinkCtrl* HyperlinkCtrl1;
wxButton* Button2;
+ wxCheckBox* m_checkSpellTooltips;
wxButton* Button3;
wxTextCtrl* m_TextBitmapPath;
wxStaticText* StaticText4;
Index: src/plugins/contrib/SpellChecker/SpellCheckerPlugin.cpp
===================================================================
--- src/plugins/contrib/SpellChecker/SpellCheckerPlugin.cpp (revision 8417)
+++ src/plugins/contrib/SpellChecker/SpellCheckerPlugin.cpp (working copy)
@@ -51,6 +51,7 @@
const int idSpellCheck = wxNewId();
const int idThesaurus = wxNewId();
+ const int idCamelCase = wxNewId();
const unsigned int MaxSuggestEntries = 5;
const int idSuggest[MaxSuggestEntries] =
@@ -114,7 +115,7 @@
ConfigureHunspellSpellCheckEngine();
m_pSpellChecker->InitializeSpellCheckEngine();
- // initialze Helper and online checker
+ // initialize Helper and online checker
m_pSpellHelper = new SpellCheckHelper();
m_pOnlineChecker = new OnlineSpellChecker(m_pSpellChecker, m_pSpellHelper);
m_FunctorId = EditorHooks::RegisterHook( m_pOnlineChecker );
@@ -135,8 +136,10 @@
Connect(idAddToDictionary, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SpellCheckerPlugin::OnAddToPersonalDictionary), NULL, this);
Connect(idThesaurus, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SpellCheckerPlugin::OnThesaurus));
Connect(idThesaurus, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(SpellCheckerPlugin::OnUpdateThesaurus));
+ Connect(idCamelCase, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SpellCheckerPlugin::OnCamelCase));
Manager::Get()->RegisterEventSink(cbEVT_EDITOR_SAVE, new cbEventFunctor<SpellCheckerPlugin, CodeBlocksEvent>(this, &SpellCheckerPlugin::OnEditorSaved));
+ Manager::Get()->RegisterEventSink(cbEVT_EDITOR_TOOLTIP, new cbEventFunctor<SpellCheckerPlugin, CodeBlocksEvent>(this, &SpellCheckerPlugin::OnEditorTooltip));
}
#ifdef wxUSE_STATUSBAR
void SpellCheckerPlugin::CreateStatusField(cbStatusBar *bar)
@@ -216,7 +219,7 @@
Disconnect(idAddToDictionary, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SpellCheckerPlugin::OnAddToPersonalDictionary), NULL, this);
Disconnect(idThesaurus, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SpellCheckerPlugin::OnThesaurus));
Disconnect(idThesaurus, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(SpellCheckerPlugin::OnUpdateThesaurus));
-
+ Disconnect(idCamelCase, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SpellCheckerPlugin::OnCamelCase));
}
void SpellCheckerPlugin::SavePersonalDictionary()
{
@@ -242,7 +245,7 @@
// if not attached, exit
if (!IsAttached()) return;
- // insert entry in the View menu
+ // insert entry in the Edit menu
int EditPos = menuBar->FindMenu(_("&Edit"));
if (EditPos != wxNOT_FOUND)
{
@@ -251,6 +254,22 @@
EditMenu->AppendSeparator();
EditMenu->Append(idSpellCheck, _("Spelling..."), _("Spell check the selected text"));
EditMenu->Append(idThesaurus, _("Thesaurus..."), _T(""));
+
+ // find menu - Edit/Special commands/Case
+ int id = EditMenu->FindItem(_("Special commands"));
+ if (id == wxNOT_FOUND) return;
+ wxMenuItem* subMenuItem = EditMenu->FindItem(id, 0);
+ if (!subMenuItem) return;
+ wxMenu* subMenu = subMenuItem->GetSubMenu();
+ if (!subMenu) return;
+ id = EditMenu->FindItem(_("Case"));
+ if (id == wxNOT_FOUND) return;
+ subMenuItem = EditMenu->FindItem(id, 0);
+ if (!subMenuItem) return;
+ subMenu = subMenuItem->GetSubMenu();
+ if (!subMenu) return;
+ // and append
+ subMenu->Append(idCamelCase, _("CamelCase"), _("Make selection CamelCase"));
}
}
void SpellCheckerPlugin::BuildModuleMenu(const ModuleType type, wxMenu* menu, const FileTreeData* data)
@@ -266,6 +285,35 @@
cbStyledTextCtrl *stc = ed->GetControl();
if ( !stc ) return;
+ const int id = menu->FindItem(_("Edit"));
+ if (id != wxNOT_FOUND)
+ {
+ wxMenuItem* subMenuItem = menu->FindItem(id, 0);
+ wxMenu* subMenu;
+ if (subMenuItem)
+ subMenu = subMenuItem->GetSubMenu();
+ if (subMenu)
+ {
+
download for full patch...
History
alpha0010 2012-09-29 00:44
Provide spelling and thesaurus based tooltips (both can be turned off from the settings).
Change case -> CamelCase (determined by correctly spelled word parts).