Replaced wxScintilla with the more sane (and standard) wxStyledTextCtrl.

Originally committed to SVN as r1104.
This commit is contained in:
Rodrigo Braz Monteiro 2007-04-21 23:16:38 +00:00
parent feff4e63f3
commit b91f1a0511
8 changed files with 39 additions and 68 deletions

View File

@ -61,7 +61,7 @@ Please visit http://aegisub.net to download latest version
- Fonts collector can now collect fonts directly to a zipped archive; also, fixed behavior of the Escape key in it. (AMZ)
- Added support for DirectShowSource2 if avss.dll is on Aegisub's folder. (AMZ)
- Added DirectSound audio output, to avoid using PortAudio under Win32. (AMZ)
- Replaced wxTextCtrl with wxScintilla, to solve many issues related to the Rich Text edit control. (AMZ)
- Replaced wxTextCtrl with wxStyledTextCtrl, to solve many issues related to the Rich Text edit control. (AMZ)
- Improved Syntax Highlighter to include more features of ASS. (AMZ)
- Added an inline Hunspell-based Spell Checker. (AMZ)
- Added an inline MyThes-based Thesaurus. (AMZ)

View File

@ -60,7 +60,7 @@ AboutScreen::AboutScreen(wxWindow *parent)
// Generate library string
wxString libString = _("This build of Aegisub uses the following C/C++ libraries:\n");
libString += _T("wxWidgets - Copyright (c) 1998-2006 Julian Smart, Robert Roebling et al;\n");
libString += _T("wxScintilla - Copyright (c) 2004 wxCode;\n");
libString += _T("wxStyledTextCtrl - Copyright (c) 2004 wxCode;\n");
libString += _T("Lua - Copyright (c) 1994-2006 Lua.org, PUC-Rio;\n");
#if USE_HUNSPELL == 1
libString += _T("Hunspell - Copyright (c) Kevin Hendricks;\n");

View File

@ -64,6 +64,7 @@
#pragma comment(lib, "wxmsw28ud_core.lib")
#pragma comment(lib, "wxmsw28ud_adv.lib")
#pragma comment(lib, "wxmsw28ud_gl.lib")
#pragma comment(lib, "wxmsw28ud_stc.lib")
#else
#pragma comment(lib, "wxregexu.lib")
#pragma comment(lib, "wxbase28u.lib")
@ -72,40 +73,12 @@
#pragma comment(lib, "wxmsw28u_core.lib")
#pragma comment(lib, "wxmsw28u_adv.lib")
#pragma comment(lib, "wxmsw28u_gl.lib")
#pragma comment(lib, "wxmsw28u_stc.lib")
#endif
#else
#if wxCHECK_VERSION(2, 7, 0)
#ifdef __WXDEBUG__
#pragma comment(lib, "wxregexud.lib")
#pragma comment(lib, "wxbase27ud.lib")
#pragma comment(lib, "wxmsw27ud_media.lib")
#pragma comment(lib, "wxmsw27ud_core.lib")
#pragma comment(lib, "wxmsw27ud_adv.lib")
#else
#pragma comment(lib, "wxregexu.lib")
#pragma comment(lib, "wxbase27u.lib")
#pragma comment(lib, "wxmsw27u_media.lib")
#pragma comment(lib, "wxmsw27u_core.lib")
#pragma comment(lib, "wxmsw27u_adv.lib")
#endif
#else if wxCHECK_VERSION(2, 6, 0)
#ifdef __WXDEBUG__
#pragma comment(lib, "wxregexud.lib")
#pragma comment(lib, "wxbase26ud.lib")
#pragma comment(lib, "wxmsw26ud_media.lib")
#pragma comment(lib, "wxmsw26ud_core.lib")
#pragma comment(lib, "wxmsw26ud_adv.lib")
#else
#pragma comment(lib, "wxregexu.lib")
#pragma comment(lib, "wxbase26u.lib")
#pragma comment(lib, "wxmsw26u_media.lib")
#pragma comment(lib, "wxmsw26u_core.lib")
#pragma comment(lib, "wxmsw26u_adv.lib")
#endif
#endif
#error "Aegisub requires wxWidgets 2.8.0 or superior"
#endif // wxWidgets
@ -113,9 +86,7 @@
/////////////
// Scintilla
#ifdef __WXDEBUG__
#pragma comment(lib, "wxscintillaud.lib")
#else
#pragma comment(lib, "wxscintillau.lib")
#endif

View File

@ -77,7 +77,7 @@
#include <wx/wfstream.h>
#include <wx/tipdlg.h>
#include <wx/event.h>
#include <wx/wxscintilla.h>
#include <wx/stc/stc.h>
#include <wx/string.h>
//#include <GL/glew.h>
#include <GL/gl.h>

View File

@ -346,11 +346,11 @@ void SubsEditBox::SetToLine(int n,bool weak) {
///////////////
// Event table
BEGIN_EVENT_TABLE(SubsEditBox, wxPanel)
EVT_SCI_MODIFIED(EDIT_BOX,SubsEditBox::OnEditText)
EVT_SCI_STYLENEEDED(EDIT_BOX,SubsEditBox::OnNeedStyle)
EVT_SCI_KEY(EDIT_BOX,SubsEditBox::OnKeyDown)
EVT_SCI_CHARADDED(EDIT_BOX,SubsEditBox::OnCharAdded)
EVT_SCI_UPDATEUI(EDIT_BOX,SubsEditBox::OnUpdateUI)
EVT_STC_MODIFIED(EDIT_BOX,SubsEditBox::OnEditText)
EVT_STC_STYLENEEDED(EDIT_BOX,SubsEditBox::OnNeedStyle)
EVT_STC_KEY(EDIT_BOX,SubsEditBox::OnKeyDown)
EVT_STC_CHARADDED(EDIT_BOX,SubsEditBox::OnCharAdded)
EVT_STC_UPDATEUI(EDIT_BOX,SubsEditBox::OnUpdateUI)
EVT_CHECKBOX(SYNTAX_BOX, SubsEditBox::OnSyntaxBox)
EVT_RADIOBUTTON(RADIO_TIME_BY_FRAME, SubsEditBox::OnFrameRadio)
@ -392,9 +392,9 @@ void SubsEditBox::OnSize(wxSizeEvent &event) {
/////////////////////
// Text edited event
void SubsEditBox::OnEditText(wxScintillaEvent &event) {
void SubsEditBox::OnEditText(wxStyledTextEvent &event) {
int modType = event.GetModificationType();
if (modType == (wxSCI_MOD_INSERTTEXT | wxSCI_PERFORMED_USER) || modType == (wxSCI_MOD_DELETETEXT | wxSCI_PERFORMED_USER)) {
if (modType == (wxSTC_MOD_INSERTTEXT | wxSTC_PERFORMED_USER) || modType == (wxSTC_MOD_DELETETEXT | wxSTC_PERFORMED_USER)) {
//TextEdit->UpdateCallTip();
}
}
@ -402,14 +402,14 @@ void SubsEditBox::OnEditText(wxScintillaEvent &event) {
//////////////////////////
// User Interface updated
void SubsEditBox::OnUpdateUI(wxScintillaEvent &event) {
void SubsEditBox::OnUpdateUI(wxStyledTextEvent &event) {
TextEdit->UpdateCallTip();
}
//////////////
// Need style
void SubsEditBox::OnNeedStyle(wxScintillaEvent &event) {
void SubsEditBox::OnNeedStyle(wxStyledTextEvent &event) {
// Check if it needs to fix text
wxString text = TextEdit->GetText();
if (text.Contains(_T("\n")) || text.Contains(_T("\r"))) {
@ -423,14 +423,14 @@ void SubsEditBox::OnNeedStyle(wxScintillaEvent &event) {
///////////////////
// Character added
void SubsEditBox::OnCharAdded(wxScintillaEvent &event) {
void SubsEditBox::OnCharAdded(wxStyledTextEvent &event) {
//int character = event.GetKey();
}
////////////
// Key down
void SubsEditBox::OnKeyDown(wxScintillaEvent &event) {
void SubsEditBox::OnKeyDown(wxStyledTextEvent &event) {
}

View File

@ -50,7 +50,7 @@ class TimeEdit;
class SubsEditBox;
class AudioDisplay;
class HiliModTextCtrl;
class wxScintilla;
class wxStyledTextCtrl;
//////////////////
@ -107,10 +107,10 @@ private:
int BlockAtPos(int pos);
void OnEditText(wxScintillaEvent &event);
void OnNeedStyle(wxScintillaEvent &event);
void OnCharAdded(wxScintillaEvent &event);
void OnUpdateUI(wxScintillaEvent &event);
void OnEditText(wxStyledTextEvent &event);
void OnNeedStyle(wxStyledTextEvent &event);
void OnCharAdded(wxStyledTextEvent &event);
void OnUpdateUI(wxStyledTextEvent &event);
void OnButtonColor1(wxCommandEvent &event);
void OnButtonColor2(wxCommandEvent &event);
@ -125,7 +125,7 @@ private:
void OnSyntaxBox(wxCommandEvent &event);
void OnFrameRadio(wxCommandEvent &event);
void OnTimeRadio(wxCommandEvent &event);
void OnKeyDown(wxScintillaEvent &event);
void OnKeyDown(wxStyledTextEvent &event);
void OnStyleChange(wxCommandEvent &event);
void OnActorChange(wxCommandEvent &event);
void OnLayerChange(wxCommandEvent &event);

View File

@ -48,25 +48,25 @@
////////////////////////
// Edit box constructor
SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& wsize, long style, const wxValidator& validator, const wxString& name)
: wxScintilla(parent, id, pos, wsize, 0, value)
: wxStyledTextCtrl(parent, id, pos, wsize, 0, value)
{
// Set properties
SetWrapMode(wxSCI_WRAP_WORD);
SetWrapMode(wxSTC_WRAP_WORD);
SetMarginWidth(1,0);
UsePopUp(false);
SetStyles();
// Set hotkeys
CmdKeyClear(wxSCI_KEY_RETURN,wxSCI_SCMOD_CTRL);
CmdKeyClear(wxSCI_KEY_RETURN,wxSCI_SCMOD_NULL);
CmdKeyClear(wxSCI_KEY_TAB,wxSCI_SCMOD_NULL);
CmdKeyClear(wxSCI_KEY_TAB,wxSCI_SCMOD_SHIFT);
CmdKeyClear('D',wxSCI_SCMOD_CTRL);
CmdKeyClear('L',wxSCI_SCMOD_CTRL);
CmdKeyClear('L',wxSCI_SCMOD_CTRL | wxSCI_SCMOD_SHIFT);
CmdKeyClear('T',wxSCI_SCMOD_CTRL);
CmdKeyClear('T',wxSCI_SCMOD_CTRL | wxSCI_SCMOD_SHIFT);
CmdKeyClear('U',wxSCI_SCMOD_CTRL);
CmdKeyClear(wxSTC_KEY_RETURN,wxSTC_SCMOD_CTRL);
CmdKeyClear(wxSTC_KEY_RETURN,wxSTC_SCMOD_NORM);
CmdKeyClear(wxSTC_KEY_TAB,wxSTC_SCMOD_NORM);
CmdKeyClear(wxSTC_KEY_TAB,wxSTC_SCMOD_SHIFT);
CmdKeyClear('D',wxSTC_SCMOD_CTRL);
CmdKeyClear('L',wxSTC_SCMOD_CTRL);
CmdKeyClear('L',wxSTC_SCMOD_CTRL | wxSTC_SCMOD_SHIFT);
CmdKeyClear('T',wxSTC_SCMOD_CTRL);
CmdKeyClear('T',wxSTC_SCMOD_CTRL | wxSTC_SCMOD_SHIFT);
CmdKeyClear('U',wxSTC_SCMOD_CTRL);
// Set spellchecker
spellchecker = SpellChecker::GetSpellChecker();
@ -140,7 +140,7 @@ SubsTextEditCtrl::~SubsTextEditCtrl() {
///////////////////////
// Control event table
BEGIN_EVENT_TABLE(SubsTextEditCtrl,wxScintilla)
BEGIN_EVENT_TABLE(SubsTextEditCtrl,wxStyledTextCtrl)
EVT_MOUSE_EVENTS(SubsTextEditCtrl::OnMouseEvent)
EVT_KILL_FOCUS(SubsTextEditCtrl::OnLoseFocus)
@ -215,7 +215,7 @@ void SubsTextEditCtrl::SetStyles() {
StyleSetForeground(6,Options.AsColour(_T("Syntax Highlight Line Break")));
// Misspelling indicator
IndicatorSetStyle(0,wxSCI_INDIC_SQUIGGLE);
IndicatorSetStyle(0,wxSTC_INDIC_SQUIGGLE);
IndicatorSetForeground(0,wxColour(255,0,0));
}

View File

@ -40,7 +40,7 @@
////////////
// Includes
#include <wx/wxprec.h>
#include <wx/wxscintilla.h>
#include <wx/stc/stc.h>
#include "spellchecker.h"
#include "thesaurus.h"
@ -52,7 +52,7 @@ class SubsEditBox;
////////////////////
// SubsTextEditCtrl
class SubsTextEditCtrl : public wxScintilla {
class SubsTextEditCtrl : public wxStyledTextCtrl {
private:
SpellChecker *spellchecker;
Thesaurus *thesaurus;