From 1e1841fc86e6404332f7829bd01db06442bcb7f1 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sun, 24 Dec 2006 22:46:20 +0000 Subject: [PATCH] Early spellchecker implemented Originally committed to SVN as r604. --- core/subs_edit_ctrl.cpp | 103 ++++++++++++++++++++++++++++++++++++++-- core/subs_edit_ctrl.h | 1 + 2 files changed, 101 insertions(+), 3 deletions(-) diff --git a/core/subs_edit_ctrl.cpp b/core/subs_edit_ctrl.cpp index e9ff8c324..6c0776ec1 100644 --- a/core/subs_edit_ctrl.cpp +++ b/core/subs_edit_ctrl.cpp @@ -97,6 +97,10 @@ SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxWindowID id, const wxStri StyleSetSize(5,size); StyleSetForeground(5,Options.AsColour(_T("Syntax Highlight Numbers"))); + // Misspelling indicator + IndicatorSetStyle(0,wxSCI_INDIC_SQUIGGLE); + IndicatorSetForeground(0,wxColour(200,0,0)); + // Set spellchecker spellchecker = SpellChecker::GetSpellChecker(); } @@ -118,8 +122,8 @@ void SubsTextEditCtrl::UpdateStyle(int start, int _length) { // Set variables wxString text = GetText(); - int len = _length; - if (len < 0) len = text.Length(); + int end = start + _length; + if (_length < 0) end = text.Length(); // Begin styling StartStyling(0,31); @@ -130,7 +134,7 @@ void SubsTextEditCtrl::UpdateStyle(int start, int _length) { wxChar prevChar = 0; // Loop through - for (int i=start;iCheckWord(curWord)) { + StartStyling(startPos[i],32); + SetStyling(endPos[i]-startPos[i],32); + } + } } diff --git a/core/subs_edit_ctrl.h b/core/subs_edit_ctrl.h index 0d483dfde..c172301a0 100644 --- a/core/subs_edit_ctrl.h +++ b/core/subs_edit_ctrl.h @@ -64,6 +64,7 @@ public: void SetTextTo(const wxString text); void UpdateStyle(int start=0,int length=-1); + void StyleSpellCheck(int start=0,int length=-1); DECLARE_EVENT_TABLE() };