diff --git a/contrib/include/wx/stc/stc.h b/contrib/include/wx/stc/stc.h index a2060dbf88..ca1c3a4a23 100644 --- a/contrib/include/wx/stc/stc.h +++ b/contrib/include/wx/stc/stc.h @@ -166,6 +166,7 @@ #define wxSTC_INDIC_TT 2 #define wxSTC_INDIC_DIAGONAL 3 #define wxSTC_INDIC_STRIKE 4 +#define wxSTC_INDIC_HIDDEN 5 #define wxSTC_INDIC0_MASK 0x20 #define wxSTC_INDIC1_MASK 0x40 #define wxSTC_INDIC2_MASK 0x80 @@ -247,6 +248,9 @@ // where most code reside, and the lines after the caret, eg. the body of a function. #define wxSTC_CARET_EVEN 0x08 +// Maximum value of keywordSet parameter of SetKeyWords. +#define wxSTC_KEYWORDSET_MAX 8 + // Notifications // Type of modification and the action which caused the modification. // These are defined as a bit mask to make it easy to specify which notifications are wanted. @@ -331,6 +335,9 @@ #define wxSTC_LEX_POV 39 #define wxSTC_LEX_LOUT 40 #define wxSTC_LEX_ESCRIPT 41 +#define wxSTC_LEX_PS 42 +#define wxSTC_LEX_NSIS 43 +#define wxSTC_LEX_MMIXAL 44 // When a lexer specifies its language as SCLEX_AUTOMATIC it receives a // value assigned in sequence from SCLEX_AUTOMATIC+1. @@ -584,6 +591,8 @@ #define wxSTC_LUA_WORD4 15 #define wxSTC_LUA_WORD5 16 #define wxSTC_LUA_WORD6 17 +#define wxSTC_LUA_WORD7 18 +#define wxSTC_LUA_WORD8 19 // Lexical states for SCLEX_ERRORLIST #define wxSTC_ERR_DEFAULT 0 @@ -805,14 +814,20 @@ #define wxSTC_POV_DEFAULT 0 #define wxSTC_POV_COMMENT 1 #define wxSTC_POV_COMMENTLINE 2 -#define wxSTC_POV_COMMENTDOC 3 -#define wxSTC_POV_NUMBER 4 -#define wxSTC_POV_WORD 5 +#define wxSTC_POV_NUMBER 3 +#define wxSTC_POV_OPERATOR 4 +#define wxSTC_POV_IDENTIFIER 5 #define wxSTC_POV_STRING 6 -#define wxSTC_POV_OPERATOR 7 -#define wxSTC_POV_IDENTIFIER 8 -#define wxSTC_POV_BRACE 9 +#define wxSTC_POV_STRINGEOL 7 +#define wxSTC_POV_DIRECTIVE 8 +#define wxSTC_POV_BADDIRECTIVE 9 #define wxSTC_POV_WORD2 10 +#define wxSTC_POV_WORD3 11 +#define wxSTC_POV_WORD4 12 +#define wxSTC_POV_WORD5 13 +#define wxSTC_POV_WORD6 14 +#define wxSTC_POV_WORD7 15 +#define wxSTC_POV_WORD8 16 // Lexical states for SCLEX_LOUT #define wxSTC_LOUT_DEFAULT 0 @@ -841,10 +856,65 @@ #define wxSTC_ESCRIPT_WORD2 10 #define wxSTC_ESCRIPT_WORD3 11 +// Lexical states for SCLEX_PS +#define wxSTC_PS_DEFAULT 0 +#define wxSTC_PS_COMMENT 1 +#define wxSTC_PS_DSC_COMMENT 2 +#define wxSTC_PS_DSC_VALUE 3 +#define wxSTC_PS_NUMBER 4 +#define wxSTC_PS_NAME 5 +#define wxSTC_PS_KEYWORD 6 +#define wxSTC_PS_LITERAL 7 +#define wxSTC_PS_IMMEVAL 8 +#define wxSTC_PS_PAREN_ARRAY 9 +#define wxSTC_PS_PAREN_DICT 10 +#define wxSTC_PS_PAREN_PROC 11 +#define wxSTC_PS_TEXT 12 +#define wxSTC_PS_HEXSTRING 13 +#define wxSTC_PS_BASE85STRING 14 +#define wxSTC_PS_BADSTRINGCHAR 15 + +// Lexical states for SCLEX_NSIS +#define wxSTC_NSIS_DEFAULT 0 +#define wxSTC_NSIS_COMMENT 1 +#define wxSTC_NSIS_STRINGDQ 2 +#define wxSTC_NSIS_STRINGLQ 3 +#define wxSTC_NSIS_STRINGRQ 4 +#define wxSTC_NSIS_FUNCTION 5 +#define wxSTC_NSIS_VARIABLE 6 +#define wxSTC_NSIS_LABEL 7 +#define wxSTC_NSIS_USERDEFINED 8 +#define wxSTC_NSIS_SECTIONDEF 9 +#define wxSTC_NSIS_SUBSECTIONDEF 10 +#define wxSTC_NSIS_IFDEFINEDEF 11 +#define wxSTC_NSIS_MACRODEF 12 +#define wxSTC_NSIS_STRINGVAR 13 + +// Lexical states for SCLEX_MMIXAL +#define wxSTC_MMIXAL_LEADWS 0 +#define wxSTC_MMIXAL_COMMENT 1 +#define wxSTC_MMIXAL_LABEL 2 +#define wxSTC_MMIXAL_OPCODE 3 +#define wxSTC_MMIXAL_OPCODE_PRE 4 +#define wxSTC_MMIXAL_OPCODE_VALID 5 +#define wxSTC_MMIXAL_OPCODE_UNKNOWN 6 +#define wxSTC_MMIXAL_OPCODE_POST 7 +#define wxSTC_MMIXAL_OPERANDS 8 +#define wxSTC_MMIXAL_NUMBER 9 +#define wxSTC_MMIXAL_REF 10 +#define wxSTC_MMIXAL_CHAR 11 +#define wxSTC_MMIXAL_STRING 12 +#define wxSTC_MMIXAL_REGISTER 13 +#define wxSTC_MMIXAL_HEX 14 +#define wxSTC_MMIXAL_OPERATOR 15 +#define wxSTC_MMIXAL_SYMBOL 16 +#define wxSTC_MMIXAL_INCLUDE 17 + //----------------------------------------- // Commands that can be bound to keystrokes + // Redoes the next action on the undo history. #define wxSTC_CMD_REDO 2011 @@ -2023,10 +2093,10 @@ public: bool GetMouseDownCaptures(); // Sets the cursor to one of the SC_CURSOR* values. - void SetCursor(int cursorType); + void SetSTCCursor(int cursorType); // Get cursor type. - int GetCursor(); + int GetSTCCursor(); // Change the way control characters are displayed: // If symbol is < 32, keep the drawn way, else, use the given character. diff --git a/contrib/samples/stc/Makefile.in b/contrib/samples/stc/Makefile.in index 0de249989a..b026b30963 100644 --- a/contrib/samples/stc/Makefile.in +++ b/contrib/samples/stc/Makefile.in @@ -11,7 +11,7 @@ program_dir = contrib/samples/stc PROGRAM=stctest -OBJECTS=$(PROGRAM).o +OBJECTS=$(PROGRAM).o edit.o prefs.o APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_stc-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include diff --git a/contrib/samples/stc/Makefile.sc b/contrib/samples/stc/Makefile.sc index 348c34e07a..66685e085a 100644 --- a/contrib/samples/stc/Makefile.sc +++ b/contrib/samples/stc/Makefile.sc @@ -1,6 +1,6 @@ #Makefile from wxHatch for Symantec/Digital Mars compiler WXDIR=..\..\.. TARGET=stctest -OBJECTS = $(TARGET).obj +OBJECTS = $(TARGET).obj edit.obj prefs.obj EXTRALIBS=$(WXDIR)\lib\stc_sc.lib include $(WXDIR)\src\makeprog.sc diff --git a/contrib/samples/stc/StcTestVC.dsp b/contrib/samples/stc/StcTestVC.dsp index b1600f1145..3f660bd692 100644 --- a/contrib/samples/stc/StcTestVC.dsp +++ b/contrib/samples/stc/StcTestVC.dsp @@ -167,6 +167,14 @@ SOURCE=.\stctest.cpp # End Source File # Begin Source File +SOURCE=.\edit.cpp +# End Source File +# Begin Source File + +SOURCE=.\prefs.cpp +# End Source File +# Begin Source File + SOURCE=.\stctest.rc # ADD BASE RSC /l 0x809 # ADD RSC /l 0x809 /i "../../../include" /i "../../../contrib/include" diff --git a/contrib/samples/stc/makefile.b32 b/contrib/samples/stc/makefile.b32 index 46a0651cef..b4c8c55fae 100644 --- a/contrib/samples/stc/makefile.b32 +++ b/contrib/samples/stc/makefile.b32 @@ -12,7 +12,7 @@ WXDIR = $(WXWIN) TARGET=stctest EXTRALIBS=$(WXDIR)\lib\stc.lib -OBJECTS = $(TARGET).obj +OBJECTS = $(TARGET).obj edit.obj prefs.obj !include $(WXDIR)\src\makeprog.b32 diff --git a/contrib/samples/stc/makefile.g95 b/contrib/samples/stc/makefile.g95 index 9c8a7efe29..59cb05835a 100644 --- a/contrib/samples/stc/makefile.g95 +++ b/contrib/samples/stc/makefile.g95 @@ -6,7 +6,7 @@ WXDIR = ../../.. TARGET = stctest -OBJECTS = $(TARGET).o +OBJECTS = $(TARGET).o edit.o prefs.o EXTRAINC = -I$(WXDIR)/contrib/include EXTRALIBS = -lstc diff --git a/contrib/samples/stc/makefile.vc b/contrib/samples/stc/makefile.vc index 4ab23679ef..e388d237c3 100644 --- a/contrib/samples/stc/makefile.vc +++ b/contrib/samples/stc/makefile.vc @@ -6,7 +6,7 @@ WXDIR = $(WXWIN) PROGRAM = stctest -OBJECTS = $(PROGRAM).obj +OBJECTS = $(PROGRAM).obj edit.obj prefs.obj EXTRALIBS = $(WXDIR)\lib\stc$(LIBEXT).lib EXTRAINC = -I$(WXDIR)\contrib\include diff --git a/contrib/samples/stc/makefile.wat b/contrib/samples/stc/makefile.wat index 6f4c80c81a..08fd7c55a2 100644 --- a/contrib/samples/stc/makefile.wat +++ b/contrib/samples/stc/makefile.wat @@ -6,7 +6,7 @@ WXDIR = $(%WXWIN) EXTRACPPFLAGS = -I$(WXDIR)\contrib\include PROGRAM = stctest EXTRALIBS = $(WXDIR)\lib\stc_w.lib -OBJECTS = $(OUTPUTDIR)\$(PROGRAM).obj +OBJECTS = $(OUTPUTDIR)\$(PROGRAM).obj $(OUTPUTDIR)\edit.obj $(OUTPUTDIR)\prefs.obj !include $(WXDIR)\src\makeprog.wat diff --git a/contrib/samples/stc/stctest.cpp b/contrib/samples/stc/stctest.cpp index 96cdf117e6..5331ae5114 100644 --- a/contrib/samples/stc/stctest.cpp +++ b/contrib/samples/stc/stctest.cpp @@ -1,252 +1,660 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: stctest.cpp -// Purpose: sample of using wxStyledTextCtrl -// Author: Robin Dunn -// Modified by: -// Created: 3-Feb-2000 +////////////////////////////////////////////////////////////////////////////// +// File: app.cpp +// Purpose: STC test application +// Maintainer: Otto Wyss +// Created: 2003-09-01 // RCS-ID: $Id$ -// Copyright: (c) 2000 by Total Control Software +// Copyright: (c) wxGuide // Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(__APPLE__) - #pragma implementation "stctest.cpp" - #pragma interface "stctest.cpp" -#endif +//---------------------------------------------------------------------------- +// headers +//---------------------------------------------------------------------------- -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" +// For compilers that support precompilation, includes . +#include #ifdef __BORLANDC__ #pragma hdrstop #endif // for all others, include the necessary headers (this file is usually all you -// need because it includes almost all "standard" wxWindows headers +// need because it includes almost all 'standard' wxWindows headers) #ifndef WX_PRECOMP - #include "wx/wx.h" + #include #endif -#include +//! wxWindows headers +#include // configuration support +#include // file dialog support +#include // filename support +#include // notebook support +#include // system settings +#include // strings support +#include // images support -#include +//! application headers +#include "defsext.h" // Additional definitions +#include "edit.h" // Edit module +#include "prefs.h" // Prefs -//---------------------------------------------------------------------- -class MyApp : public wxApp -{ +//---------------------------------------------------------------------------- +// resources +//---------------------------------------------------------------------------- + +// the application icon (under Windows and OS/2 it is in resources) +#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__) + #include "mondrian.xpm" +#endif + +//============================================================================ +// declarations +//============================================================================ + +#define APP_NAME _T("STC-Test") +#define APP_DESCR _("See http://wxguide.sourceforge.net/indexedit.html") + +#define APP_MAINT _T("Otto Wyss") +#define APP_VENDOR _T("wxWindows") +#define APP_COPYRIGTH _T("(C) 2003 Otto Wyss") +#define APP_LICENCE _T("wxWindows") + +#define APP_VERSION _T("0.1.alpha") +#define APP_BUILD __DATE__ + +#define APP_WEBSITE _T("http://www.wxWindows.org") +#define APP_MAIL _T("mailto://???") + +#define NONAME _("") + +class AppBook; + + +//---------------------------------------------------------------------------- +//! global application name +wxString *g_appname = NULL; + +//! global print data, to remember settings during the session +wxPrintData *g_printData = (wxPrintData*) NULL; +wxPageSetupData *g_pageSetupData = (wxPageSetupData*) NULL; + + +//---------------------------------------------------------------------------- +//! application APP_VENDOR-APP_NAME. +class App: public wxApp { + friend class AppFrame; + public: - virtual bool OnInit(); -}; + //! the main function called durning application start + virtual bool OnInit (); -//---------------------------------------------------------------------- -// Make an editor class - -class MySTC : public wxStyledTextCtrl -{ -public: - MySTC(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0); - - void OnKeyPressed(wxKeyEvent& evt); + //! application exit function + virtual int OnExit (); private: + //! frame window + AppFrame* m_frame; + +}; + +// created dynamically by wxWindows +DECLARE_APP (App); + +//---------------------------------------------------------------------------- +//! frame of the application APP_VENDOR-APP_NAME. +class AppFrame: public wxFrame { + friend class App; + friend class AppBook; + friend class AppAbout; + +public: + //! constructor + AppFrame (const wxString &title); + + //! destructor + ~AppFrame (); + + //! event handlers + //! common + void OnClose (wxCloseEvent &event); + void OnAbout (wxCommandEvent &event); + void OnExit (wxCommandEvent &event); + void OnTimerEvent (wxTimerEvent &event); + //! file + void OnFileNew (wxCommandEvent &event); + void OnFileNewFrame (wxCommandEvent &event); + void OnFileOpen (wxCommandEvent &event); + void OnFileOpenFrame (wxCommandEvent &event); + void OnFileSave (wxCommandEvent &event); + void OnFileSaveAs (wxCommandEvent &event); + void OnFileClose (wxCommandEvent &event); + //! properties + void OnProperties (wxCommandEvent &event); + //! print + void OnPrintSetup (wxCommandEvent &event); + void OnPrintPreview (wxCommandEvent &event); + void OnPrint (wxCommandEvent &event); + //! edit events + void OnEdit (wxCommandEvent &event); + +private: + // edit object + Edit *m_edit; + void FileOpen (wxString fname); + + //! creates the application menu bar + wxMenuBar *m_menuBar; + void CreateMenu (); + + // print preview position and size + wxRect DeterminePrintSize (); + DECLARE_EVENT_TABLE() }; -BEGIN_EVENT_TABLE(MySTC, wxStyledTextCtrl) - EVT_KEY_DOWN(MySTC::OnKeyPressed) -END_EVENT_TABLE() +//---------------------------------------------------------------------------- +//! about box of the application APP_VENDOR-APP_NAME +class AppAbout: public wxDialog { -//---------------------------------------------------------------------- -// Define a new frame type: this is going to be our main frame -class MyFrame : public wxFrame -{ public: - MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size); + //! constructor + AppAbout (wxWindow *parent, + int milliseconds = 0, + long style = 0); - void OnQuit(wxCommandEvent& event); - void OnAbout(wxCommandEvent& event); + //! destructor + ~AppAbout (); + + // event handlers + void OnTimerEvent (wxTimerEvent &event); private: - MySTC* ed; + // timer + wxTimer *m_timer; DECLARE_EVENT_TABLE() }; -// IDs for the controls and the menu commands -enum -{ - // menu items - ID_Quit = 1, - ID_About, - ID_ED -}; +//============================================================================ +// implementation +//============================================================================ -BEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_MENU (ID_Quit, MyFrame::OnQuit) - EVT_MENU (ID_About, MyFrame::OnAbout) -END_EVENT_TABLE() +IMPLEMENT_APP (App) -IMPLEMENT_APP(MyApp) +//---------------------------------------------------------------------------- +// App +//---------------------------------------------------------------------------- -//---------------------------------------------------------------------- -// `Main program' equivalent: the program execution "starts" here +bool App::OnInit () { -bool MyApp::OnInit() -{ - MyFrame *frame = new MyFrame(_T("Testing wxStyledTextCtrl"), - wxPoint(5, 5), wxSize(600, 600)); + wxInitAllImageHandlers(); + + // set application and vendor name + SetAppName (APP_NAME); + SetVendorName (APP_VENDOR); + g_appname = new wxString (); + g_appname->Append (APP_VENDOR); + g_appname->Append (_T("-")); + g_appname->Append (APP_NAME); - frame->Show(TRUE); - return TRUE; + // initialize print data and setup + g_printData = new wxPrintData; + g_pageSetupData = new wxPageSetupDialogData; + + // create application frame + m_frame = new AppFrame (*g_appname); + + // open application frame + m_frame->Layout (); + m_frame->Show (true); + SetTopWindow (m_frame); + + return true; } -//---------------------------------------------------------------------- +int App::OnExit () { -// frame constructor -MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, -1, title, pos, size) -{ -#ifdef __WXMAC__ - // we need this in order to allow the about menu relocation, since ABOUT is - // not the default id of the about menu - wxApp::s_macAboutMenuItemId = ID_About; -#endif + // delete global appname + delete g_appname; + // delete global print data and setup + if (g_printData) delete g_printData; + if (g_pageSetupData) delete g_pageSetupData; - // create a menu bar - wxMenu *menuFile = new wxMenu(wxEmptyString, wxMENU_TEAROFF); - - // the "About" item should be in the help menu - wxMenu *helpMenu = new wxMenu; - helpMenu->Append(ID_About, _T("&About...\tCtrl-A"), _T("Show about dialog")); - - menuFile->Append(ID_Quit, _T("E&xit\tAlt-X"), _T("Quit this program")); - - // now append the freshly created menu to the menu bar... - wxMenuBar *menuBar = new wxMenuBar(); - menuBar->Append(menuFile, _T("&File")); - menuBar->Append(helpMenu, _T("&Help")); - - // ... and attach this menu bar to the frame - SetMenuBar(menuBar); - -#if wxUSE_STATUSBAR - CreateStatusBar(2); - SetStatusText(_T("Testing wxStyledTextCtrl")); -#endif // wxUSE_STATUSBAR - - - //---------------------------------------- - // Setup the editor - ed = new MySTC(this, ID_ED); + return 0; } +//---------------------------------------------------------------------------- +// AppFrame +//---------------------------------------------------------------------------- -// event handlers +BEGIN_EVENT_TABLE (AppFrame, wxFrame) + // common + EVT_CLOSE ( AppFrame::OnClose) + // file + EVT_MENU (wxID_OPEN, AppFrame::OnFileOpen) + EVT_MENU (wxID_SAVE, AppFrame::OnFileSave) + EVT_MENU (wxID_SAVEAS, AppFrame::OnFileSaveAs) + EVT_MENU (wxID_CLOSE, AppFrame::OnFileClose) + // properties + EVT_MENU (myID_PROPERTIES, AppFrame::OnProperties) + // print and exit + EVT_MENU (wxID_PRINT_SETUP, AppFrame::OnPrintSetup) + EVT_MENU (wxID_PREVIEW, AppFrame::OnPrintPreview) + EVT_MENU (wxID_PRINT, AppFrame::OnPrint) + EVT_MENU (wxID_EXIT, AppFrame::OnExit) + // edit + EVT_MENU (wxID_CLEAR, AppFrame::OnEdit) + EVT_MENU (wxID_CUT, AppFrame::OnEdit) + EVT_MENU (wxID_COPY, AppFrame::OnEdit) + EVT_MENU (wxID_PASTE, AppFrame::OnEdit) + EVT_MENU (myID_INDENTINC, AppFrame::OnEdit) + EVT_MENU (myID_INDENTRED, AppFrame::OnEdit) + EVT_MENU (wxID_SELECTALL, AppFrame::OnEdit) + EVT_MENU (myID_SELECTLINE, AppFrame::OnEdit) + EVT_MENU (wxID_REDO, AppFrame::OnEdit) + EVT_MENU (wxID_UNDO, AppFrame::OnEdit) + // find + EVT_MENU (wxID_FIND, AppFrame::OnEdit) + EVT_MENU (myID_FINDNEXT, AppFrame::OnEdit) + EVT_MENU (myID_REPLACE, AppFrame::OnEdit) + EVT_MENU (myID_REPLACENEXT, AppFrame::OnEdit) + EVT_MENU (myID_BRACEMATCH, AppFrame::OnEdit) + EVT_MENU (myID_GOTO, AppFrame::OnEdit) + // view + EVT_MENU_RANGE (myID_HILIGHTFIRST, myID_HILIGHTLAST, + AppFrame::OnEdit) + EVT_MENU (myID_DISPLAYEOL, AppFrame::OnEdit) + EVT_MENU (myID_INDENTGUIDE, AppFrame::OnEdit) + EVT_MENU (myID_LINENUMBER, AppFrame::OnEdit) + EVT_MENU (myID_LONGLINEON, AppFrame::OnEdit) + EVT_MENU (myID_WHITESPACE, AppFrame::OnEdit) + EVT_MENU (myID_FOLDTOGGLE, AppFrame::OnEdit) + EVT_MENU (myID_OVERTYPE, AppFrame::OnEdit) + EVT_MENU (myID_READONLY, AppFrame::OnEdit) + EVT_MENU (myID_WRAPMODEON, AppFrame::OnEdit) + // extra + EVT_MENU (myID_CHANGELOWER, AppFrame::OnEdit) + EVT_MENU (myID_CHANGEUPPER, AppFrame::OnEdit) + EVT_MENU (myID_CONVERTCR, AppFrame::OnEdit) + EVT_MENU (myID_CONVERTCRLF, AppFrame::OnEdit) + EVT_MENU (myID_CONVERTLF, AppFrame::OnEdit) + EVT_MENU (myID_CHARSETANSI, AppFrame::OnEdit) + EVT_MENU (myID_CHARSETMAC, AppFrame::OnEdit) + // help + EVT_MENU (wxID_ABOUT, AppFrame::OnAbout) +END_EVENT_TABLE () + +AppFrame::AppFrame (const wxString &title) + : wxFrame ((wxFrame *)NULL, -1, title, wxDefaultPosition, wxSize(600,400), + wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) { + + // intitialize important variables + m_edit = NULL; + + // set icon and background + SetTitle (*g_appname); + SetIcon (wxICON (mondrian)); + SetBackgroundColour (_T("WHITE")); + + // about box shown for 1 seconds + AppAbout (this, 1000); + + // create menu + m_menuBar = new wxMenuBar; + CreateMenu (); + + // open first page + m_edit = new Edit (this, -1); + m_edit->SetFocus(); -void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) -{ - // TRUE is to force the frame to close - Close(TRUE); } -void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) -{ - wxString msg; - msg.Printf( _T("Testing wxStyledTextCtrl...\n")); - - wxMessageBox(msg, _T("About This Test"), wxOK | wxICON_INFORMATION, this); +AppFrame::~AppFrame () { } - -//---------------------------------------------------------------------- - -wxChar* keywords = -_T("asm auto bool break case catch char class const \ -const_cast continue default delete do double \ -dynamic_cast else enum explicit export extern \ -false float for friend goto if inline int long \ -mutable namespace new operator private protected \ -public register reinterpret_cast return short signed \ -sizeof static static_cast struct switch template this \ -throw true try typedef typeid typename union unsigned \ -using virtual void volatile wchar_t while"); - - - -MySTC::MySTC(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style) - : wxStyledTextCtrl(parent, id, pos, size, style) -{ - // Default font - wxFont font(10, wxMODERN, wxNORMAL, wxNORMAL); - StyleSetFont(wxSTC_STYLE_DEFAULT, font); - StyleClearAll(); - - StyleSetForeground(0, wxColour(0x80, 0x80, 0x80)); - StyleSetForeground(1, wxColour(0x00, 0x7f, 0x00)); - //StyleSetForeground(2, wxColour(0x00, 0x7f, 0x00)); - StyleSetForeground(3, wxColour(0x7f, 0x7f, 0x7f)); - StyleSetForeground(4, wxColour(0x00, 0x7f, 0x7f)); - StyleSetForeground(5, wxColour(0x00, 0x00, 0x7f)); - StyleSetForeground(6, wxColour(0x7f, 0x00, 0x7f)); - StyleSetForeground(7, wxColour(0x7f, 0x00, 0x7f)); - StyleSetForeground(8, wxColour(0x00, 0x7f, 0x7f)); - StyleSetForeground(9, wxColour(0x7f, 0x7f, 0x7f)); - StyleSetForeground(10, wxColour(0x00, 0x00, 0x00)); - StyleSetForeground(11, wxColour(0x00, 0x00, 0x00)); - StyleSetBold(5, TRUE); - StyleSetBold(10, TRUE); - -#ifdef __WXMSW__ - StyleSetSpec(2, _T("fore:#007f00,bold,face:Arial,size:9")); -#else - StyleSetSpec(2, _T("fore:#007f00,bold,face:Helvetica,size:9")); -#endif - - // give it some text to play with - wxString st; - wxFileInputStream stream(wxT("stctest.cpp")); - size_t sz = stream.GetSize(); - char* buf = new char[sz + 1]; - stream.Read((void*) buf, stream.GetSize()); - buf[sz] = 0; - st = wxString::FromAscii(buf); - delete[] buf; - - InsertText(0, st); - EmptyUndoBuffer(); - - SetLexer(wxSTC_LEX_CPP); - SetKeyWords(0, keywords); +// common event handlers +void AppFrame::OnClose (wxCloseEvent &event) { + wxCommandEvent evt; + OnFileClose (evt); + if (m_edit && m_edit->Modified()) { + if (event.CanVeto()) event.Veto (true); + return; + } + Destroy(); } -void MySTC::OnKeyPressed(wxKeyEvent& evt) -{ - if (CallTipActive()) - CallTipCancel(); +void AppFrame::OnAbout (wxCommandEvent &WXUNUSED(event)) { + AppAbout (this); +} - int key = evt.GetKeyCode(); - if ( key == WXK_SPACE && evt.ControlDown()) { - int pos = GetCurrentPos(); +void AppFrame::OnExit (wxCommandEvent &WXUNUSED(event)) { + Close (true); +} - if (evt.ShiftDown()) { - // show how to do CallTips - CallTipSetBackground(wxColour(_T("YELLOW"))); - CallTipShow(pos, _T("lots of of text: blah, blah, blah\n\nshow some suff, maybe parameters..\n\nfubar(param1, param2)")); - } - else { - // show how to do AutoComplete - AutoCompSetIgnoreCase(false); - AutoCompShow(0, keywords); // reuse the keyword list here - // normally you would build a string of completion texts... +// file event handlers +void AppFrame::OnFileOpen (wxCommandEvent &WXUNUSED(event)) { + if (!m_edit) return; + wxString fname; + wxFileDialog dlg (this, _T("Open file"), _T(""), _T(""), _T("Any file (*)|*"), + wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR); + if (dlg.ShowModal() != wxID_OK) return; + fname = dlg.GetPath (); + FileOpen (fname); +} + +void AppFrame::OnFileSave (wxCommandEvent &WXUNUSED(event)) { + if (!m_edit) return; + if (!m_edit->Modified()) { + wxMessageBox (_("There is nothing to save!"), _("Save file"), + wxOK | wxICON_EXCLAMATION); + return; + } + m_edit->SaveFile (); +} + +void AppFrame::OnFileSaveAs (wxCommandEvent &WXUNUSED(event)) { + if (!m_edit) return; + wxString filename = wxEmptyString; + wxFileDialog dlg (this, _T("Save file"), _T(""), _T(""), _T("Any file (*)|*"), wxSAVE|wxOVERWRITE_PROMPT); + if (dlg.ShowModal() != wxID_OK) return; + filename = dlg.GetPath(); + m_edit->SaveFile (filename); +} + +void AppFrame::OnFileClose (wxCommandEvent &WXUNUSED(event)) { + if (!m_edit) return; + if (m_edit->Modified()) { + if (wxMessageBox (_("Text is not saved, save before closing?"), _("Close"), + wxYES_NO | wxICON_QUESTION) == wxYES) { + m_edit->SaveFile(); + if (m_edit->Modified()) { + wxMessageBox (_("Text could not be saved!"), _("Close abort"), + wxOK | wxICON_EXCLAMATION); + return; + } } } - else - evt.Skip(); } + +// properties event handlers +void AppFrame::OnProperties (wxCommandEvent &WXUNUSED(event)) { + if (!m_edit) return; + EditProperties (m_edit, 0); +} + +// print event handlers +void AppFrame::OnPrintSetup (wxCommandEvent &WXUNUSED(event)) { + (*g_pageSetupData) = * g_printData; + wxPageSetupDialog pageSetupDialog(this, g_pageSetupData); + pageSetupDialog.ShowModal(); + (*g_printData) = pageSetupDialog.GetPageSetupData().GetPrintData(); + (*g_pageSetupData) = pageSetupDialog.GetPageSetupData(); +} + +void AppFrame::OnPrintPreview (wxCommandEvent &WXUNUSED(event)) { + wxPrintDialogData printDialogData( *g_printData); + wxPrintPreview *preview = + new wxPrintPreview (new EditPrint (m_edit), + new EditPrint (m_edit), + &printDialogData); + if (!preview->Ok()) { + delete preview; + wxMessageBox (_("There was a problem with previewing.\n\ + Perhaps your current printer is not correctly?"), + _("Previewing"), wxOK); + return; + } + wxRect rect = DeterminePrintSize(); + wxPreviewFrame *frame = new wxPreviewFrame (preview, this, _("Print Preview")); + frame->SetSize (rect); + frame->Centre(wxBOTH); + frame->Initialize(); + frame->Show(true); +} + +void AppFrame::OnPrint (wxCommandEvent &WXUNUSED(event)) { + wxPrintDialogData printDialogData( *g_printData); + wxPrinter printer (&printDialogData); + EditPrint printout (m_edit); + if (!printer.Print (this, &printout, true)) { + if (wxPrinter::GetLastError() == wxPRINTER_ERROR) { + wxMessageBox (_("There was a problem with printing.\n\ + Perhaps your current printer is not correctly?"), + _("Previewing"), wxOK); + return; + } + } + (*g_printData) = printer.GetPrintDialogData().GetPrintData(); +} + +// edit events +void AppFrame::OnEdit (wxCommandEvent &event) { + if (m_edit) m_edit->ProcessEvent (event); +} + +// private functions +void AppFrame::CreateMenu () { + + // File menu + wxMenu *menuFile = new wxMenu; + menuFile->Append (wxID_OPEN, _("&Open ..\tCtrl+O")); + menuFile->Append (wxID_SAVE, _("&Save\tCtrl+S")); + menuFile->Append (wxID_SAVEAS, _("Save &as ..\tCtrl+Shift+S")); + menuFile->Append (wxID_CLOSE, _("&Close\tCtrl+W")); + menuFile->AppendSeparator(); + menuFile->Append (myID_PROPERTIES, _("Proper&ties ..\tCtrl+I")); + menuFile->AppendSeparator(); + menuFile->Append (wxID_PRINT_SETUP, _("Print Set&up ..")); + menuFile->Append (wxID_PREVIEW, _("Print Pre&view\tCtrl+Shift+P")); + menuFile->Append (wxID_PRINT, _("&Print ..\tCtrl+P")); + menuFile->AppendSeparator(); + menuFile->Append (wxID_EXIT, _("&Quit\tCtrl+Q")); + + // Edit menu + wxMenu *menuEdit = new wxMenu; + menuEdit->Append (wxID_UNDO, _("&Undo\tCtrl+Z")); + menuEdit->Append (wxID_REDO, _("&Redo\tCtrl+Shift+Z")); + menuEdit->AppendSeparator(); + menuEdit->Append (wxID_CUT, _("Cu&t\tCtrl+X")); + menuEdit->Append (wxID_COPY, _("&Copy\tCtrl+C")); + menuEdit->Append (wxID_PASTE, _("&Paste\tCtrl+V")); + menuEdit->Append (wxID_CLEAR, _("&Delete\tDel")); + menuEdit->AppendSeparator(); + menuEdit->Append (wxID_FIND, _("&Find\tCtrl+F")); + menuEdit->Enable (wxID_FIND, false); + menuEdit->Append (myID_FINDNEXT, _("Find &next\tF3")); + menuEdit->Enable (myID_FINDNEXT, false); + menuEdit->Append (myID_REPLACE, _("&Replace\tCtrl+H")); + menuEdit->Enable (myID_REPLACE, false); + menuEdit->Append (myID_REPLACENEXT, _("Replace &again\tShift+F4")); + menuEdit->Enable (myID_REPLACENEXT, false); + menuEdit->AppendSeparator(); + menuEdit->Append (myID_BRACEMATCH, _("&Match brace\tCtrl+M")); + menuEdit->Append (myID_GOTO, _("&Goto\tCtrl+G")); + menuEdit->Enable (myID_GOTO, false); + menuEdit->AppendSeparator(); + menuEdit->Append (myID_INDENTINC, _("&Indent increase\tTab")); + menuEdit->Append (myID_INDENTRED, _("I&ndent reduce\tBksp")); + menuEdit->AppendSeparator(); + menuEdit->Append (wxID_SELECTALL, _("&Select all\tCtrl+A")); + menuEdit->Append (myID_SELECTLINE, _("Select &line\tCtrl+L")); + + // hilight submenu + wxMenu *menuHilight = new wxMenu; + int Nr; + for (Nr = 0; Nr < g_LanguagePrefsSize; Nr++) { + menuHilight->Append (myID_HILIGHTFIRST + Nr, + g_LanguagePrefs [Nr].name); + } + + // charset submenu + wxMenu *menuCharset = new wxMenu; + menuCharset->Append (myID_CHARSETANSI, _("&ANSI (Windows)")); + menuCharset->Append (myID_CHARSETMAC, _("&MAC (Macintosh)")); + + // View menu + wxMenu *menuView = new wxMenu; + menuView->Append (myID_HILIGHTLANG, _("&Hilight language .."), menuHilight); + menuView->AppendSeparator(); + menuView->AppendCheckItem (myID_FOLDTOGGLE, _("&Toggle current fold\tCtrl+T")); + menuView->AppendCheckItem (myID_OVERTYPE, _("&Overwrite mode\tIns")); + menuView->AppendCheckItem (myID_WRAPMODEON, _("&Wrap mode\tCtrl+U")); + menuView->AppendSeparator(); + menuView->AppendCheckItem (myID_DISPLAYEOL, _("Show line &endings")); + menuView->AppendCheckItem (myID_INDENTGUIDE, _("Show &indent guides")); + menuView->AppendCheckItem (myID_LINENUMBER, _("Show line &numbers")); + menuView->AppendCheckItem (myID_LONGLINEON, _("Show &long line marker")); + menuView->AppendCheckItem (myID_WHITESPACE, _("Show white&space")); + menuView->AppendSeparator(); + menuView->Append (myID_USECHARSET, _("Use &code page of .."), menuCharset); + + // change case submenu + wxMenu *menuChangeCase = new wxMenu; + menuChangeCase->Append (myID_CHANGEUPPER, _("&Upper case")); + menuChangeCase->Append (myID_CHANGELOWER, _("&Lower case")); + + // convert EOL submenu + wxMenu *menuConvertEOL = new wxMenu; + menuConvertEOL->Append (myID_CONVERTCR, _("CR (&Linux)")); + menuConvertEOL->Append (myID_CONVERTCRLF, _("CR+LF (&Windows)")); + menuConvertEOL->Append (myID_CONVERTLF, _("LF (&Macintosh)")); + + // Extra menu + wxMenu *menuExtra = new wxMenu; + menuExtra->AppendCheckItem (myID_READONLY, _("&Readonly mode")); + menuExtra->AppendSeparator(); + menuExtra->Append (myID_CHANGECASE, _("Change &case to .."), menuChangeCase); + menuExtra->AppendSeparator(); + menuExtra->Append (myID_CONVERTEOL, _("Convert line &endings to .."), menuConvertEOL); + + // Window menu + wxMenu *menuWindow = new wxMenu; + menuWindow->Append (myID_PAGEPREV, _("&Previous\tCtrl+Shift+Tab")); + menuWindow->Append (myID_PAGENEXT, _("&Next\tCtrl+Tab")); + + // Help menu + wxMenu *menuHelp = new wxMenu; + menuHelp->Append (wxID_ABOUT, _("&About ..\tShift+F1")); + + // construct menu + m_menuBar->Append (menuFile, _("&File")); + m_menuBar->Append (menuEdit, _("&Edit")); + m_menuBar->Append (menuView, _("&View")); + m_menuBar->Append (menuExtra, _("E&xtra")); + m_menuBar->Append (menuWindow, _("&Window")); + m_menuBar->Append (menuHelp, _("&Help")); + SetMenuBar (m_menuBar); + +} + +void AppFrame::FileOpen (wxString fname) { + wxFileName w(fname); w.Normalize(); fname = w.GetFullPath(); + m_edit->LoadFile (fname); +} + +wxRect AppFrame::DeterminePrintSize () { + + wxSize scr = wxGetDisplaySize(); + + // determine position and size (shifting 16 left and down) + wxRect rect = GetRect(); + rect.x += 16; + rect.y += 16; + rect.width = wxMin (rect.width, (scr.x - rect.x)); + rect.height = wxMin (rect.height, (scr.x - rect.y)); + + return rect; +} + + +//---------------------------------------------------------------------------- +// AppAbout +//---------------------------------------------------------------------------- + +BEGIN_EVENT_TABLE (AppAbout, wxDialog) + EVT_TIMER (myID_ABOUTTIMER, AppAbout::OnTimerEvent) +END_EVENT_TABLE () + +AppAbout::AppAbout (wxWindow *parent, + int milliseconds, + long style) + : wxDialog (parent, -1, wxEmptyString, + wxDefaultPosition, wxDefaultSize, + style | wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { + + // set timer if any + m_timer = NULL; + if (milliseconds > 0) { + m_timer = new wxTimer (this, myID_ABOUTTIMER); + m_timer->Start (milliseconds, wxTIMER_ONE_SHOT); + } + + // sets the application title + SetTitle (_("About ..")); + + // about info + wxGridSizer *aboutinfo = new wxGridSizer (2, 0, 2); + aboutinfo->Add (new wxStaticText(this, -1, _("Written by: ")), + 0, wxALIGN_LEFT); + aboutinfo->Add (new wxStaticText(this, -1, APP_MAINT), + 1, wxEXPAND | wxALIGN_LEFT); + aboutinfo->Add (new wxStaticText(this, -1, _("Version: ")), + 0, wxALIGN_LEFT); + aboutinfo->Add (new wxStaticText(this, -1, APP_VERSION), + 1, wxEXPAND | wxALIGN_LEFT); + aboutinfo->Add (new wxStaticText(this, -1, _("Licence type: ")), + 0, wxALIGN_LEFT); + aboutinfo->Add (new wxStaticText(this, -1, APP_LICENCE), + 1, wxEXPAND | wxALIGN_LEFT); + aboutinfo->Add (new wxStaticText(this, -1, _("Copyright: ")), + 0, wxALIGN_LEFT); + aboutinfo->Add (new wxStaticText(this, -1, APP_COPYRIGTH), + 1, wxEXPAND | wxALIGN_LEFT); + + // about icontitle//info + wxBoxSizer *aboutpane = new wxBoxSizer (wxHORIZONTAL); + wxBitmap bitmap = wxBitmap(wxICON (mondrian)); + aboutpane->Add (new wxStaticBitmap (this, -1, bitmap), + 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 20); + aboutpane->Add (aboutinfo, 1, wxEXPAND); + aboutpane->Add (60, 0); + + // about complete + wxBoxSizer *totalpane = new wxBoxSizer (wxVERTICAL); + totalpane->Add (0, 20); + wxStaticText *appname = new wxStaticText(this, -1, *g_appname); + appname->SetFont (wxFont (24, wxDEFAULT, wxNORMAL, wxBOLD)); + totalpane->Add (appname, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, 40); + totalpane->Add (0, 10); + totalpane->Add (aboutpane, 0, wxEXPAND | wxALL, 4); + totalpane->Add (new wxStaticText(this, -1, APP_DESCR), + 0, wxALIGN_CENTER | wxALL, 10); + wxButton *okButton = new wxButton (this, wxID_OK, _("OK")); + okButton->SetDefault(); + totalpane->Add (okButton, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT | wxBOTTOM, 10); + + SetSizerAndFit (totalpane); + + CenterOnScreen(); + ShowModal(); +} + +AppAbout::~AppAbout () { + if (m_timer) { + delete m_timer; + m_timer = NULL; + } +} + +//---------------------------------------------------------------------------- +// event handlers +void AppAbout::OnTimerEvent (wxTimerEvent &WXUNUSED(event)) { + if (m_timer) delete m_timer; + m_timer = NULL; + EndModal (wxID_OK); +} + diff --git a/contrib/samples/stc/stctest.rc b/contrib/samples/stc/stctest.rc index b86c4e2265..2eeca79368 100644 --- a/contrib/samples/stc/stctest.rc +++ b/contrib/samples/stc/stctest.rc @@ -1 +1,5 @@ +mondrian ICON "mondrian.ico" #include "wx/msw/wx.rc" + +print BITMAP "bitmaps/print.bmp" + diff --git a/contrib/src/stc/Makefile.in b/contrib/src/stc/Makefile.in index a04ccde08f..4b7698698d 100644 --- a/contrib/src/stc/Makefile.in +++ b/contrib/src/stc/Makefile.in @@ -59,6 +59,10 @@ OBJECTS=PlatWX.o ScintillaWX.o stc.o \ LexRuby.o \ LexSQL.o \ LexVB.o \ + LexMMIXAL.o \ + LexNsis.o \ + LexPS.o \ + LexScriptol.o \ LineMarker.o \ PropSet.o \ RESearch.o \ diff --git a/contrib/src/stc/PlatWX.cpp b/contrib/src/stc/PlatWX.cpp index f669168164..859d11ce9a 100644 --- a/contrib/src/stc/PlatWX.cpp +++ b/contrib/src/stc/PlatWX.cpp @@ -288,7 +288,7 @@ void SurfaceImpl::Init(SurfaceID hdc_, WindowID) { hdc = (wxDC*)hdc_; } -void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID) { +void SurfaceImpl::InitPixMap(int width, int height, Surface *WXUNUSED(surface_), WindowID) { Release(); hdc = new wxMemoryDC(); hdcOwned = true; @@ -542,7 +542,7 @@ int SurfaceImpl::Descent(Font &font) { return d; } -int SurfaceImpl::InternalLeading(Font &font) { +int SurfaceImpl::InternalLeading(Font &WXUNUSED(font)) { return 0; } @@ -563,7 +563,7 @@ int SurfaceImpl::AverageCharWidth(Font &font) { return hdc->GetCharWidth(); } -int SurfaceImpl::SetPalette(Palette *pal, bool inBackGround) { +int SurfaceImpl::SetPalette(Palette *WXUNUSED(pal), bool WXUNUSED(inBackGround)) { return 0; } @@ -578,7 +578,7 @@ void SurfaceImpl::SetUnicodeMode(bool unicodeMode_) { unicodeMode=unicodeMode_; } -void SurfaceImpl::SetDBCSMode(int codePage) { +void SurfaceImpl::SetDBCSMode(int WXUNUSED(codePage)) { // dbcsMode = codePage == SC_CP_DBCS; } @@ -969,7 +969,7 @@ int ListBoxImpl::GetSelection() { } -int ListBoxImpl::Find(const char *prefix) { +int ListBoxImpl::Find(const char *WXUNUSED(prefix)) { // No longer used return -1; } @@ -1003,7 +1003,7 @@ void ListBoxImpl::RegisterImage(int type, const char *xpm_data) { // do we need to extend the mapping array? wxArrayInt& itm = *imgTypeMap; - if ( itm.GetCount() < type+1) + if ( itm.GetCount() < (size_t)type+1) itm.Add(-1, type - itm.GetCount() + 1); // Add an item that maps type to the image index @@ -1063,7 +1063,7 @@ void Menu::Show(Point pt, Window &w) { //---------------------------------------------------------------------- -DynamicLibrary *DynamicLibrary::Load(const char *modulePath) { +DynamicLibrary *DynamicLibrary::Load(const char *WXUNUSED(modulePath)) { wxFAIL_MSG(wxT("Dynamic lexer loading not implemented yet")); return NULL; } @@ -1103,7 +1103,7 @@ void Platform::DebugDisplay(const char *s) { wxLogDebug(stc2wx(s)); } -bool Platform::IsKeyDown(int key) { +bool Platform::IsKeyDown(int WXUNUSED(key)) { return false; // I don't think we'll need this. } @@ -1196,11 +1196,11 @@ int Platform::Clamp(int val, int minVal, int maxVal) { } -bool Platform::IsDBCSLeadByte(int codePage, char ch) { +bool Platform::IsDBCSLeadByte(int WXUNUSED(codePage), char WXUNUSED(ch)) { return false; } -int Platform::DBCSCharLength(int codePage, const char *s) { +int Platform::DBCSCharLength(int WXUNUSED(codePage), const char *WXUNUSED(s)) { return 1; } diff --git a/contrib/src/stc/ScintillaWX.cpp b/contrib/src/stc/ScintillaWX.cpp index 3e5ebf0aa6..163a89afb4 100644 --- a/contrib/src/stc/ScintillaWX.cpp +++ b/contrib/src/stc/ScintillaWX.cpp @@ -383,7 +383,8 @@ bool ScintillaWX::CanPaste() { bool didOpen; if (Editor::CanPaste()) { - if ( (didOpen = !wxTheClipboard->IsOpened()) ) + didOpen = !wxTheClipboard->IsOpened(); + if ( didOpen ) wxTheClipboard->Open(); if (wxTheClipboard->IsOpened()) { @@ -597,7 +598,7 @@ void ScintillaWX::DoMouseWheel(int rotation, int delta, } -void ScintillaWX::DoSize(int width, int height) { +void ScintillaWX::DoSize(int WXUNUSED(width), int WXUNUSED(height)) { // PRectangle rcClient(0,0,width,height); // SetScrollBarsTo(rcClient); // DropGraphics(); @@ -628,8 +629,8 @@ void ScintillaWX::DoLeftButtonMove(Point pt) { ButtonMove(pt); } -void ScintillaWX::DoMiddleButtonUp(Point pt) { #ifdef __WXGTK__ +void ScintillaWX::DoMiddleButtonUp(Point pt) { // Set the current position to the mouse click point and // then paste in the PRIMARY selection, if any. wxGTK only. int newPos = PositionFromLocation(pt); @@ -656,8 +657,11 @@ void ScintillaWX::DoMiddleButtonUp(Point pt) { ShowCaretAtCurrentPosition(); EnsureCaretVisible(); -#endif } +#else +void ScintillaWX::DoMiddleButtonUp(Point WXUNUSED(pt)) { +} +#endif void ScintillaWX::DoAddChar(int key) { @@ -673,9 +677,14 @@ void ScintillaWX::DoAddChar(int key) { } -int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed) { +#ifdef __WXMAC__ +int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool meta, bool* consumed) { +#else +int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool WXUNUSED(meta), bool* consumed) { +#endif #if defined(__WXGTK__) || defined(__WXMAC__) - // Ctrl chars (A-Z) end up with the wrong keycode on wxGTK... + // Ctrl chars (A-Z) end up with the wrong keycode on wxGTK + // TODO: Check this, it shouldn't be true any longer. if (ctrl && key >= 1 && key <= 26) key += 'A' - 1; #endif @@ -709,6 +718,21 @@ int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* cons case WXK_MENU: key = 0; break; } +#ifdef __WXMAC__ + if ( meta ) { + // check for a few common Mac Meta-key combos and remap them to Ctrl + // for Scintilla + switch ( key ) { + case 'Z': // Undo + case 'X': // Cut + case 'C': // Copy + case 'V': // Paste + case 'A': // Select All + ctrl = true; + break; + } +#endif + int rv = KeyDown(key, shift, ctrl, alt, consumed); if (key) @@ -760,7 +784,7 @@ bool ScintillaWX::DoDropText(long x, long y, const wxString& data) { } -wxDragResult ScintillaWX::DoDragEnter(wxCoord x, wxCoord y, wxDragResult def) { +wxDragResult ScintillaWX::DoDragEnter(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxDragResult def) { dragResult = def; return dragResult; } @@ -817,8 +841,8 @@ void ScintillaWX::DoScrollToColumn(int column) { HorizontalScrollTo(column * vs.spaceWidth); } -void ScintillaWX::ClipChildren(wxDC& dc, PRectangle rect) { #ifdef __WXGTK__ +void ScintillaWX::ClipChildren(wxDC& dc, PRectangle rect) { wxRegion rgn(wxRectFromPRectangle(rect)); if (ac.Active()) { wxRect childRect = ((wxWindow*)ac.lb->GetID())->GetRect(); @@ -830,9 +854,11 @@ void ScintillaWX::ClipChildren(wxDC& dc, PRectangle rect) { } dc.SetClippingRegion(rgn); -#endif } - +#else +void ScintillaWX::ClipChildren(wxDC& WXUNUSED(dc), PRectangle WXUNUSED(rect)) { +} +#endif //---------------------------------------------------------------------- //---------------------------------------------------------------------- diff --git a/contrib/src/stc/ScintillaWX.h b/contrib/src/stc/ScintillaWX.h index 506fa252d5..2a6c5b5dbd 100644 --- a/contrib/src/stc/ScintillaWX.h +++ b/contrib/src/stc/ScintillaWX.h @@ -55,7 +55,15 @@ //---------------------------------------------------------------------- -class wxStyledTextCtrl; // forward +#ifdef WXMAKINGDLL_STC + #define WXDLLIMPEXP_STC WXEXPORT +#elif defined(WXUSINGDLL) + #define WXDLLIMPEXP_STC WXIMPORT +#else // not making nor using DLL + #define WXDLLIMPEXP_STC +#endif + +class WXDLLIMPEXP_STC wxStyledTextCtrl; // forward class ScintillaWX; @@ -131,7 +139,7 @@ public: void DoMiddleButtonUp(Point pt); void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown, bool isPageScroll); void DoAddChar(int key); - int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed); + int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool meta, bool* consumed); void DoTick() { Tick(); } #if wxUSE_DRAG_AND_DROP diff --git a/contrib/src/stc/StcVC.dsp b/contrib/src/stc/StcVC.dsp index 1587293631..7748801450 100644 --- a/contrib/src/stc/StcVC.dsp +++ b/contrib/src/stc/StcVC.dsp @@ -370,6 +370,22 @@ SOURCE=.\scintilla\src\LexVB.cxx # End Source File # Begin Source File +SOURCE=.\scintilla\src\LexMMIXAL.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexNsis.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexPS.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexScriptol.cxx +# End Source File +# Begin Source File + SOURCE=.\scintilla\src\LineMarker.cxx # End Source File # Begin Source File diff --git a/contrib/src/stc/gen_iface.py b/contrib/src/stc/gen_iface.py index d88aae231b..aa9432d377 100644 --- a/contrib/src/stc/gen_iface.py +++ b/contrib/src/stc/gen_iface.py @@ -547,9 +547,12 @@ methodOverrideMap = { 'GrabFocus' : (None, 0, 0, 0), + + # Rename some that woudl otherwise hid the wxWindow methods 'SetFocus' : ('SetSTCFocus', 0, 0, 0), 'GetFocus' : ('GetSTCFocus', 0, 0, 0), - + 'SetCursor' : ('SetSTCCursor', 0, 0, 0), + 'GetCursor' : ('GetSTCCursor', 0, 0, 0), 'LoadLexerLibrary' : (None, 0,0,0), diff --git a/contrib/src/stc/makefile.b32 b/contrib/src/stc/makefile.b32 index 6ce6044a8b..e3f505d7b7 100644 --- a/contrib/src/stc/makefile.b32 +++ b/contrib/src/stc/makefile.b32 @@ -58,6 +58,10 @@ OBJECTS = \ LexRuby.obj \ LexSQL.obj \ LexVB.obj \ + LexMMIXAL.obj \ + LexNsis.obj \ + LexPS.obj \ + LexScriptol.obj \ LineMarker.obj \ PropSet.obj \ RESearch.obj \ @@ -68,7 +72,6 @@ OBJECTS = \ ViewStyle.obj \ WindowAccessor.obj \ XPM.obj \ - \ PlatWX.obj \ ScintillaWX.obj \ stc.obj \ diff --git a/contrib/src/stc/makefile.g95 b/contrib/src/stc/makefile.g95 index 6f23b518da..94c3275ac2 100644 --- a/contrib/src/stc/makefile.g95 +++ b/contrib/src/stc/makefile.g95 @@ -46,6 +46,10 @@ OBJECTS = \ $(S)/LexRuby.$(OBJSUFF) \ $(S)/LexSQL.$(OBJSUFF) \ $(S)/LexVB.$(OBJSUFF) \ + $(S)/LexMMIXAL.$(OBJSUFF) \ + $(S)/LexNsis.$(OBJSUFF) \ + $(S)/LexPS.$(OBJSUFF) \ + $(S)/LexScriptol.$(OBJSUFF) \ $(S)/LineMarker.$(OBJSUFF) \ $(S)/PropSet.$(OBJSUFF) \ $(S)/RESearch.$(OBJSUFF) \ diff --git a/contrib/src/stc/makefile.sc b/contrib/src/stc/makefile.sc index ea9ffcc9c6..10461dc1f0 100644 --- a/contrib/src/stc/makefile.sc +++ b/contrib/src/stc/makefile.sc @@ -5,7 +5,7 @@ S=$(SCINTILLA)\src EXTRASTCCPPFLAGS = -D__WX__ -DSCI_LEXER -DLINK_LEXERS -I$(SCINTILLA)/include -I$(S) EXTRACPPFLAGS=$(EXTRACPPFLAGS) $(EXTRASTCCPPFLAGS) -STCCPPFLAGS=$(DLL_FLAGS) $(EXTRACPPFLAGS) +STCCPPFLAGS=$(DLL_FLAGS) $(EXTRACPPFLAGS) include $(WXDIR)\src\makesc.env LIBTARGET=$(WXDIR)\lib\stc$(SC_SUFFIX).lib @@ -52,6 +52,10 @@ OBJECTS = \ $(S)\LexRuby.obj \ $(S)\LexSQL.obj \ $(S)\LexVB.obj \ + $(S)\LexMMIXAL.obj \ + $(S)\LexNsis.obj \ + $(S)\LexPS.obj \ + $(S)\LexScriptol.obj \ $(S)\LineMarker.obj \ $(S)\PropSet.obj \ $(S)\RESearch.obj \ diff --git a/contrib/src/stc/makefile.vc b/contrib/src/stc/makefile.vc index 22d7e750d1..b61df3fb00 100644 --- a/contrib/src/stc/makefile.vc +++ b/contrib/src/stc/makefile.vc @@ -51,6 +51,10 @@ OBJECTS = \ $(D)\LexRuby.obj \ $(D)\LexSQL.obj \ $(D)\LexVB.obj \ + $(D)\LexMMIXAL.obj \ + $(D)\LexNsis.obj \ + $(D)\LexPS.obj \ + $(D)\LexScriptol.obj \ $(D)\LineMarker.obj \ $(D)\PropSet.obj \ $(D)\RESearch.obj \ diff --git a/contrib/src/stc/makefile.wat b/contrib/src/stc/makefile.wat index eb568c1575..5f4122dce6 100644 --- a/contrib/src/stc/makefile.wat +++ b/contrib/src/stc/makefile.wat @@ -55,6 +55,10 @@ OBJECTS = & LexRuby.obj & LexSQL.obj & LexVB.obj & + LexMMIXAL.obj & + LexNsis.obj & + LexPS.obj & + LexScriptol.obj & LineMarker.obj & PropSet.obj & RESearch.obj & diff --git a/contrib/src/stc/scintilla/README.txt b/contrib/src/stc/scintilla/README.txt index bba521448e..1960be5d3d 100644 --- a/contrib/src/stc/scintilla/README.txt +++ b/contrib/src/stc/scintilla/README.txt @@ -3,4 +3,4 @@ scintilla/include directories from the Scintilla/SCiTE source distribution. All other code needed to implement Scintilla on top of wxWindows is located in the directory above this one. -The current version of the Scintilla code is 1.53 +The current version of the Scintilla code is 1.54 diff --git a/contrib/src/stc/scintilla/include/Accessor.h b/contrib/src/stc/scintilla/include/Accessor.h index 3f59c07939..0b2c4baee2 100644 --- a/contrib/src/stc/scintilla/include/Accessor.h +++ b/contrib/src/stc/scintilla/include/Accessor.h @@ -25,7 +25,7 @@ protected: char buf[bufferSize+1]; int startPos; int endPos; - int codePage; + int codePage; virtual bool InternalIsLeadByte(char ch)=0; virtual void Fill(int position)=0; @@ -44,7 +44,7 @@ public: if (position < startPos || position >= endPos) { Fill(position); if (position < startPos || position >= endPos) { - // Position is outside range of document + // Position is outside range of document return chDefault; } } diff --git a/contrib/src/stc/scintilla/include/KeyWords.h b/contrib/src/stc/scintilla/include/KeyWords.h index c51c88ef59..df4e870c58 100644 --- a/contrib/src/stc/scintilla/include/KeyWords.h +++ b/contrib/src/stc/scintilla/include/KeyWords.h @@ -7,7 +7,7 @@ typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler); - + /** * A LexerModule is responsible for lexing and folding a particular language. * The class maintains a list of LexerModules which can be searched to find a @@ -26,7 +26,7 @@ protected: public: const char *languageName; - LexerModule(int language_, LexerFunction fnLexer_, + LexerModule(int language_, LexerFunction fnLexer_, const char *languageName_=0, LexerFunction fnFolder_=0, const char * const wordListDescriptions_[] = NULL); int GetLanguage() const { return language; } diff --git a/contrib/src/stc/scintilla/include/PropSet.h b/contrib/src/stc/scintilla/include/PropSet.h index 1a7e2f1665..20ac5f774a 100644 --- a/contrib/src/stc/scintilla/include/PropSet.h +++ b/contrib/src/stc/scintilla/include/PropSet.h @@ -24,11 +24,21 @@ struct Property { /** */ class PropSet { -private: +protected: enum { hashRoots=31 }; Property *props[hashRoots]; Property *enumnext; int enumhash; + static unsigned int HashString(const char *s, size_t len) { + unsigned int ret = 0; + while (len--) { + ret <<= 4; + ret ^= *s; + s++; + } + return ret; + } + static bool IncludesVar(const char *value, const char *key); public: PropSet *superPS; PropSet(); diff --git a/contrib/src/stc/scintilla/include/SciLexer.h b/contrib/src/stc/scintilla/include/SciLexer.h index edf4bd0d24..34867542f9 100644 --- a/contrib/src/stc/scintilla/include/SciLexer.h +++ b/contrib/src/stc/scintilla/include/SciLexer.h @@ -56,6 +56,9 @@ #define SCLEX_POV 39 #define SCLEX_LOUT 40 #define SCLEX_ESCRIPT 41 +#define SCLEX_PS 42 +#define SCLEX_NSIS 43 +#define SCLEX_MMIXAL 44 #define SCLEX_AUTOMATIC 1000 #define SCE_P_DEFAULT 0 #define SCE_P_COMMENTLINE 1 @@ -268,6 +271,8 @@ #define SCE_LUA_WORD4 15 #define SCE_LUA_WORD5 16 #define SCE_LUA_WORD6 17 +#define SCE_LUA_WORD7 18 +#define SCE_LUA_WORD8 19 #define SCE_ERR_DEFAULT 0 #define SCE_ERR_PYTHON 1 #define SCE_ERR_GCC 2 @@ -455,14 +460,20 @@ #define SCE_POV_DEFAULT 0 #define SCE_POV_COMMENT 1 #define SCE_POV_COMMENTLINE 2 -#define SCE_POV_COMMENTDOC 3 -#define SCE_POV_NUMBER 4 -#define SCE_POV_WORD 5 +#define SCE_POV_NUMBER 3 +#define SCE_POV_OPERATOR 4 +#define SCE_POV_IDENTIFIER 5 #define SCE_POV_STRING 6 -#define SCE_POV_OPERATOR 7 -#define SCE_POV_IDENTIFIER 8 -#define SCE_POV_BRACE 9 +#define SCE_POV_STRINGEOL 7 +#define SCE_POV_DIRECTIVE 8 +#define SCE_POV_BADDIRECTIVE 9 #define SCE_POV_WORD2 10 +#define SCE_POV_WORD3 11 +#define SCE_POV_WORD4 12 +#define SCE_POV_WORD5 13 +#define SCE_POV_WORD6 14 +#define SCE_POV_WORD7 15 +#define SCE_POV_WORD8 16 #define SCE_LOUT_DEFAULT 0 #define SCE_LOUT_COMMENT 1 #define SCE_LOUT_NUMBER 2 @@ -486,6 +497,54 @@ #define SCE_ESCRIPT_BRACE 9 #define SCE_ESCRIPT_WORD2 10 #define SCE_ESCRIPT_WORD3 11 +#define SCE_PS_DEFAULT 0 +#define SCE_PS_COMMENT 1 +#define SCE_PS_DSC_COMMENT 2 +#define SCE_PS_DSC_VALUE 3 +#define SCE_PS_NUMBER 4 +#define SCE_PS_NAME 5 +#define SCE_PS_KEYWORD 6 +#define SCE_PS_LITERAL 7 +#define SCE_PS_IMMEVAL 8 +#define SCE_PS_PAREN_ARRAY 9 +#define SCE_PS_PAREN_DICT 10 +#define SCE_PS_PAREN_PROC 11 +#define SCE_PS_TEXT 12 +#define SCE_PS_HEXSTRING 13 +#define SCE_PS_BASE85STRING 14 +#define SCE_PS_BADSTRINGCHAR 15 +#define SCE_NSIS_DEFAULT 0 +#define SCE_NSIS_COMMENT 1 +#define SCE_NSIS_STRINGDQ 2 +#define SCE_NSIS_STRINGLQ 3 +#define SCE_NSIS_STRINGRQ 4 +#define SCE_NSIS_FUNCTION 5 +#define SCE_NSIS_VARIABLE 6 +#define SCE_NSIS_LABEL 7 +#define SCE_NSIS_USERDEFINED 8 +#define SCE_NSIS_SECTIONDEF 9 +#define SCE_NSIS_SUBSECTIONDEF 10 +#define SCE_NSIS_IFDEFINEDEF 11 +#define SCE_NSIS_MACRODEF 12 +#define SCE_NSIS_STRINGVAR 13 +#define SCE_MMIXAL_LEADWS 0 +#define SCE_MMIXAL_COMMENT 1 +#define SCE_MMIXAL_LABEL 2 +#define SCE_MMIXAL_OPCODE 3 +#define SCE_MMIXAL_OPCODE_PRE 4 +#define SCE_MMIXAL_OPCODE_VALID 5 +#define SCE_MMIXAL_OPCODE_UNKNOWN 6 +#define SCE_MMIXAL_OPCODE_POST 7 +#define SCE_MMIXAL_OPERANDS 8 +#define SCE_MMIXAL_NUMBER 9 +#define SCE_MMIXAL_REF 10 +#define SCE_MMIXAL_CHAR 11 +#define SCE_MMIXAL_STRING 12 +#define SCE_MMIXAL_REGISTER 13 +#define SCE_MMIXAL_HEX 14 +#define SCE_MMIXAL_OPERATOR 15 +#define SCE_MMIXAL_SYMBOL 16 +#define SCE_MMIXAL_INCLUDE 17 //--Autogenerated -- end of section automatically generated from Scintilla.iface #endif diff --git a/contrib/src/stc/scintilla/include/Scintilla.h b/contrib/src/stc/scintilla/include/Scintilla.h index 250f793142..34893c8938 100644 --- a/contrib/src/stc/scintilla/include/Scintilla.h +++ b/contrib/src/stc/scintilla/include/Scintilla.h @@ -204,6 +204,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define INDIC_TT 2 #define INDIC_DIAGONAL 3 #define INDIC_STRIKE 4 +#define INDIC_HIDDEN 5 #define INDIC0_MASK 0x20 #define INDIC1_MASK 0x40 #define INDIC2_MASK 0x80 @@ -546,6 +547,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETLEXER 4002 #define SCI_COLOURISE 4003 #define SCI_SETPROPERTY 4004 +#define KEYWORDSET_MAX 8 #define SCI_SETKEYWORDS 4005 #define SCI_SETLEXERLANGUAGE 4006 #define SCI_LOADLEXERLIBRARY 4007 diff --git a/contrib/src/stc/scintilla/include/Scintilla.iface b/contrib/src/stc/scintilla/include/Scintilla.iface index 2ac0b66f50..9ca4ad539a 100644 --- a/contrib/src/stc/scintilla/include/Scintilla.iface +++ b/contrib/src/stc/scintilla/include/Scintilla.iface @@ -462,6 +462,7 @@ val INDIC_SQUIGGLE=1 val INDIC_TT=2 val INDIC_DIAGONAL=3 val INDIC_STRIKE=4 +val INDIC_HIDDEN=5 val INDIC0_MASK=0x20 val INDIC1_MASK=0x40 val INDIC2_MASK=0x80 @@ -1476,6 +1477,9 @@ fun void Colourise=4003(position start, position end) # Set up a value that may be used by a lexer for some optional feature. set void SetProperty=4004(string key, string value) +# Maximum value of keywordSet parameter of SetKeyWords. +val KEYWORDSET_MAX=8 + # Set up the key words used by the lexer. set void SetKeyWords=4005(int keywordSet, string keyWords) @@ -1584,6 +1588,9 @@ val SCLEX_CSS=38 val SCLEX_POV=39 val SCLEX_LOUT=40 val SCLEX_ESCRIPT=41 +val SCLEX_PS=42 +val SCLEX_NSIS=43 +val SCLEX_MMIXAL=44 # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # value assigned in sequence from SCLEX_AUTOMATIC+1. @@ -1835,6 +1842,8 @@ val SCE_LUA_WORD3=14 val SCE_LUA_WORD4=15 val SCE_LUA_WORD5=16 val SCE_LUA_WORD6=17 +val SCE_LUA_WORD7=18 +val SCE_LUA_WORD8=19 # Lexical states for SCLEX_ERRORLIST lex ErrorList=SCLEX_ERRORLIST SCE_ERR_ val SCE_ERR_DEFAULT=0 @@ -2058,14 +2067,20 @@ lex POV=SCLEX_POV SCE_POV_ val SCE_POV_DEFAULT=0 val SCE_POV_COMMENT=1 val SCE_POV_COMMENTLINE=2 -val SCE_POV_COMMENTDOC=3 -val SCE_POV_NUMBER=4 -val SCE_POV_WORD=5 +val SCE_POV_NUMBER=3 +val SCE_POV_OPERATOR=4 +val SCE_POV_IDENTIFIER=5 val SCE_POV_STRING=6 -val SCE_POV_OPERATOR=7 -val SCE_POV_IDENTIFIER=8 -val SCE_POV_BRACE=9 +val SCE_POV_STRINGEOL=7 +val SCE_POV_DIRECTIVE=8 +val SCE_POV_BADDIRECTIVE=9 val SCE_POV_WORD2=10 +val SCE_POV_WORD3=11 +val SCE_POV_WORD4=12 +val SCE_POV_WORD5=13 +val SCE_POV_WORD6=14 +val SCE_POV_WORD7=15 +val SCE_POV_WORD8=16 # Lexical states for SCLEX_LOUT lex LOUT=SCLEX_LOUT SCE_LOUT_ val SCE_LOUT_DEFAULT=0 @@ -2093,6 +2108,60 @@ val SCE_ESCRIPT_IDENTIFIER=8 val SCE_ESCRIPT_BRACE=9 val SCE_ESCRIPT_WORD2=10 val SCE_ESCRIPT_WORD3=11 +# Lexical states for SCLEX_PS +lex PS=SCLEX_PS SCE_PS_ +val SCE_PS_DEFAULT=0 +val SCE_PS_COMMENT=1 +val SCE_PS_DSC_COMMENT=2 +val SCE_PS_DSC_VALUE=3 +val SCE_PS_NUMBER=4 +val SCE_PS_NAME=5 +val SCE_PS_KEYWORD=6 +val SCE_PS_LITERAL=7 +val SCE_PS_IMMEVAL=8 +val SCE_PS_PAREN_ARRAY=9 +val SCE_PS_PAREN_DICT=10 +val SCE_PS_PAREN_PROC=11 +val SCE_PS_TEXT=12 +val SCE_PS_HEXSTRING=13 +val SCE_PS_BASE85STRING=14 +val SCE_PS_BADSTRINGCHAR=15 +# Lexical states for SCLEX_NSIS +lex NSIS=SCLEX_NSIS SCE_NSIS_ +val SCE_NSIS_DEFAULT=0 +val SCE_NSIS_COMMENT=1 +val SCE_NSIS_STRINGDQ=2 +val SCE_NSIS_STRINGLQ=3 +val SCE_NSIS_STRINGRQ=4 +val SCE_NSIS_FUNCTION=5 +val SCE_NSIS_VARIABLE=6 +val SCE_NSIS_LABEL=7 +val SCE_NSIS_USERDEFINED=8 +val SCE_NSIS_SECTIONDEF=9 +val SCE_NSIS_SUBSECTIONDEF=10 +val SCE_NSIS_IFDEFINEDEF=11 +val SCE_NSIS_MACRODEF=12 +val SCE_NSIS_STRINGVAR=13 +# Lexical states for SCLEX_MMIXAL +lex MMIXAL=SCLEX_MMIXAL SCE_MMIXAL_ +val SCE_MMIXAL_LEADWS=0 +val SCE_MMIXAL_COMMENT=1 +val SCE_MMIXAL_LABEL=2 +val SCE_MMIXAL_OPCODE=3 +val SCE_MMIXAL_OPCODE_PRE=4 +val SCE_MMIXAL_OPCODE_VALID=5 +val SCE_MMIXAL_OPCODE_UNKNOWN=6 +val SCE_MMIXAL_OPCODE_POST=7 +val SCE_MMIXAL_OPERANDS=8 +val SCE_MMIXAL_NUMBER=9 +val SCE_MMIXAL_REF=10 +val SCE_MMIXAL_CHAR=11 +val SCE_MMIXAL_STRING=12 +val SCE_MMIXAL_REGISTER=13 +val SCE_MMIXAL_HEX=14 +val SCE_MMIXAL_OPERATOR=15 +val SCE_MMIXAL_SYMBOL=16 +val SCE_MMIXAL_INCLUDE=17 # Events diff --git a/contrib/src/stc/scintilla/include/WindowAccessor.h b/contrib/src/stc/scintilla/include/WindowAccessor.h index 4324605017..6c16b150f2 100644 --- a/contrib/src/stc/scintilla/include/WindowAccessor.h +++ b/contrib/src/stc/scintilla/include/WindowAccessor.h @@ -26,8 +26,8 @@ protected: bool InternalIsLeadByte(char ch); void Fill(int position); public: - WindowAccessor(WindowID id_, PropSet &props_) : - Accessor(), id(id_), props(props_), + WindowAccessor(WindowID id_, PropSet &props_) : + Accessor(), id(id_), props(props_), lenDoc(-1), validLen(0), chFlags(0), chWhile(0) { } ~WindowAccessor(); @@ -40,8 +40,8 @@ public: void Flush(); int GetLineState(int line); int SetLineState(int line, int state); - int GetPropertyInt(const char *key, int defaultValue=0) { - return props.GetInt(key, defaultValue); + int GetPropertyInt(const char *key, int defaultValue=0) { + return props.GetInt(key, defaultValue); } char *GetProperties() { return props.ToString(); diff --git a/contrib/src/stc/scintilla/src/CellBuffer.cxx b/contrib/src/stc/scintilla/src/CellBuffer.cxx index 8f292869d7..6dae675075 100644 --- a/contrib/src/stc/scintilla/src/CellBuffer.cxx +++ b/contrib/src/stc/scintilla/src/CellBuffer.cxx @@ -103,9 +103,9 @@ void MarkerHandleSet::RemoveNumber(int markerNum) { if (mhn->number == markerNum) { *pmhn = mhn->next; delete mhn; - return ; + } else { + pmhn = &((*pmhn)->next); } - pmhn = &((*pmhn)->next); } } diff --git a/contrib/src/stc/scintilla/src/CellBuffer.h b/contrib/src/stc/scintilla/src/CellBuffer.h index 2866d548cb..5cfcbfe1f0 100644 --- a/contrib/src/stc/scintilla/src/CellBuffer.h +++ b/contrib/src/stc/scintilla/src/CellBuffer.h @@ -212,7 +212,7 @@ public: int GetMark(int line); void DeleteAllMarks(int markerNum); int LineFromHandle(int markerHandle); - + /// Actions without undo void BasicInsertString(int position, char *s, int insertLength); void BasicDeleteChars(int position, int deleteLength); diff --git a/contrib/src/stc/scintilla/src/Document.cxx b/contrib/src/stc/scintilla/src/Document.cxx index 98fc6b330c..487262f8ad 100644 --- a/contrib/src/stc/scintilla/src/Document.cxx +++ b/contrib/src/stc/scintilla/src/Document.cxx @@ -394,7 +394,7 @@ bool Document::InsertStyledString(int position, char *s, int insertLength) { DocModification( SC_MOD_BEFOREINSERT | SC_PERFORMED_USER, position / 2, insertLength / 2, - 0, 0)); + 0, s)); int prevLinesTotal = LinesTotal(); bool startSavePoint = cb.IsSavePoint(); const char *text = cb.InsertString(position, s, insertLength); @@ -926,7 +926,7 @@ long Document::FindText(int minPos, int maxPos, const char *s, if (line == lineRangeStart) { if ((startPos != endOfLine) && (searchEnd == '$')) continue; // Can't match end of line if start position before end of line - endOfLine = startPos; + endOfLine = startPos+1; } } @@ -938,10 +938,10 @@ long Document::FindText(int minPos, int maxPos, const char *s, if (increment == -1) { // Check for the last match on this line. int repetitions = 1000; // Break out of infinite loop - while (success && (pre->eopat[0] < endOfLine) && (repetitions--)) { - success = pre->Execute(di, pre->eopat[0], endOfLine); + while (success && (pre->eopat[0] <= (endOfLine+1)) && (repetitions--)) { + success = pre->Execute(di, pos+1, endOfLine+1); if (success) { - if (pre->eopat[0] <= minPos) { + if (pre->eopat[0] <= (minPos+1)) { pos = pre->bopat[0]; lenRet = pre->eopat[0] - pre->bopat[0]; } else { diff --git a/contrib/src/stc/scintilla/src/DocumentAccessor.cxx b/contrib/src/stc/scintilla/src/DocumentAccessor.cxx index b7902df35a..738eca7a07 100644 --- a/contrib/src/stc/scintilla/src/DocumentAccessor.cxx +++ b/contrib/src/stc/scintilla/src/DocumentAccessor.cxx @@ -130,8 +130,8 @@ void DocumentAccessor::Flush() { lenDoc = -1; if (validLen > 0) { pdoc->SetStyles(validLen, styleBuf); - validLen = 0; startPosStyling += validLen; + validLen = 0; } } diff --git a/contrib/src/stc/scintilla/src/DocumentAccessor.h b/contrib/src/stc/scintilla/src/DocumentAccessor.h index f6523c94f9..dc591d13ec 100644 --- a/contrib/src/stc/scintilla/src/DocumentAccessor.h +++ b/contrib/src/stc/scintilla/src/DocumentAccessor.h @@ -32,9 +32,9 @@ protected: void Fill(int position); public: - DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) : + DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) : Accessor(), pdoc(pdoc_), props(props_), id(id_), - lenDoc(-1), validLen(0), chFlags(0), chWhile(0), + lenDoc(-1), validLen(0), chFlags(0), chWhile(0), startSeg(0), startPosStyling(0) { } ~DocumentAccessor(); @@ -47,8 +47,8 @@ public: void Flush(); int GetLineState(int line); int SetLineState(int line, int state); - int GetPropertyInt(const char *key, int defaultValue=0) { - return props.GetInt(key, defaultValue); + int GetPropertyInt(const char *key, int defaultValue=0) { + return props.GetInt(key, defaultValue); } char *GetProperties() { return props.ToString(); diff --git a/contrib/src/stc/scintilla/src/Editor.cxx b/contrib/src/stc/scintilla/src/Editor.cxx index cc53f5aac8..df260ed512 100644 --- a/contrib/src/stc/scintilla/src/Editor.cxx +++ b/contrib/src/stc/scintilla/src/Editor.cxx @@ -1414,7 +1414,7 @@ void Editor::LinesSplit(int pixelWidth) { for (int subLine = 1; subLine < ll->lines; subLine++) { pdoc->InsertString(posLineStart + (subLine - 1) * strlen(eol) + ll->LineStart(subLine), eol); - targetEnd += strlen(eol); + targetEnd += static_cast(strlen(eol)); } } } @@ -1428,6 +1428,12 @@ int Editor::SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) { return markerCheck; } +// Avoid 64 bit compiler warnings. +// Scintilla does not support text buffers larger than 2**31 +static int istrlen(const char *s) { + return static_cast(strlen(s)); +} + void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { if (vs.fixedColumnWidth == 0) return; @@ -1589,11 +1595,11 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { } PRectangle rcNumber = rcMarker; // Right justify - int width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, strlen(number)); + int width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, istrlen(number)); int xpos = rcNumber.right - width - 3; rcNumber.left = xpos; surface->DrawTextNoClip(rcNumber, vs.styles[STYLE_LINENUMBER].font, - rcNumber.top + vs.maxAscent, number, strlen(number), + rcNumber.top + vs.maxAscent, number, istrlen(number), vs.styles[STYLE_LINENUMBER].fore.allocated, vs.styles[STYLE_LINENUMBER].back.allocated); } @@ -1770,7 +1776,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou } else if (controlCharSymbol < 32) { const char *ctrlChar = ControlCharacterString(ll->chars[charInLine]); // +3 For a blank on front and rounded edge each side: - ll->positions[charInLine + 1] = surface->WidthText(ctrlCharsFont, ctrlChar, strlen(ctrlChar)) + 3; + ll->positions[charInLine + 1] = surface->WidthText(ctrlCharsFont, ctrlChar, istrlen(ctrlChar)) + 3; } else { char cc[2] = { static_cast(controlCharSymbol), '\0' }; surface->MeasureWidths(ctrlCharsFont, cc, 1, @@ -2135,7 +2141,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis rcChar.left++; rcChar.right--; surface->DrawTextClipped(rcChar, ctrlCharsFont, - rcSegment.top + vsDraw.maxAscent, ctrlChar, strlen(ctrlChar), + rcSegment.top + vsDraw.maxAscent, ctrlChar, istrlen(ctrlChar), textBack, textFore); } else { char cc[2] = { static_cast(controlCharSymbol), '\0' }; @@ -2360,7 +2366,9 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { if (AbandonPaint()) { return; } + RefreshPixMaps(surfaceWindow); // In case pixmaps invalidated by scrollbar change } + PLATFORM_ASSERT(pixmapSelPattern->Initialised()); PRectangle rcRightMargin = rcClient; rcRightMargin.left = rcRightMargin.right - vs.rightMarginWidth; @@ -2389,6 +2397,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { Surface *surface = surfaceWindow; if (bufferedDraw) { surface = pixmapLine; + PLATFORM_ASSERT(pixmapLine->Initialised()); } surface->SetUnicodeMode(IsUnicodeMode()); surface->SetDBCSMode(CodePage()); @@ -2680,7 +2689,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { int lineNumberWidth = 0; if (lineNumberIndex >= 0) { lineNumberWidth = surfaceMeasure->WidthText(vsPrint.styles[STYLE_LINENUMBER].font, - "99999" lineNumberPrintSpace, 5 + strlen(lineNumberPrintSpace)); + "99999" lineNumberPrintSpace, 5 + istrlen(lineNumberPrintSpace)); vsPrint.ms[lineNumberIndex].width = lineNumberWidth; } @@ -2760,10 +2769,10 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { rcNumber.right = rcNumber.left + lineNumberWidth; // Right justify rcNumber.left -= surfaceMeasure->WidthText( - vsPrint.styles[STYLE_LINENUMBER].font, number, strlen(number)); + vsPrint.styles[STYLE_LINENUMBER].font, number, istrlen(number)); surface->FlushCachedState(); surface->DrawTextNoClip(rcNumber, vsPrint.styles[STYLE_LINENUMBER].font, - ypos + vsPrint.maxAscent, number, strlen(number), + ypos + vsPrint.maxAscent, number, istrlen(number), vsPrint.styles[STYLE_LINENUMBER].fore.allocated, vsPrint.styles[STYLE_LINENUMBER].back.allocated); } @@ -2799,7 +2808,7 @@ int Editor::TextWidth(int style, const char *text) { RefreshStyleData(); AutoSurface surface(this); if (surface) { - return surface->WidthText(vs.styles[style].font, text, strlen(text)); + return surface->WidthText(vs.styles[style].font, text, istrlen(text)); } else { return 1; } @@ -3553,7 +3562,7 @@ void Editor::LineDuplicate() { char *thisLine = CopyRange(start, end); const char *eol = StringFromEOLMode(pdoc->eolMode); pdoc->InsertString(end, eol); - pdoc->InsertString(end + strlen(eol), thisLine, end - start); + pdoc->InsertString(end + istrlen(eol), thisLine, end - start); delete []thisLine; } @@ -3568,7 +3577,7 @@ void Editor::NewLine() { eol = "\r"; } // else SC_EOL_LF -> "\n" already set if (pdoc->InsertString(currentPos, eol)) { - SetEmptySelection(currentPos + strlen(eol)); + SetEmptySelection(currentPos + istrlen(eol)); while (*eol) { NotifyChar(*eol); eol++; @@ -4069,7 +4078,7 @@ long Editor::FindText( sptr_t lParam) { ///< @c TextToFind structure: The text to search for in the given range. TextToFind *ft = reinterpret_cast(lParam); - int lengthFound = strlen(ft->lpstrText); + int lengthFound = istrlen(ft->lpstrText); int pos = pdoc->FindText(ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText, (wParam & SCFIND_MATCHCASE) != 0, (wParam & SCFIND_WHOLEWORD) != 0, @@ -4112,7 +4121,7 @@ long Editor::SearchText( const char *txt = reinterpret_cast(lParam); int pos; - int lengthFound = strlen(txt); + int lengthFound = istrlen(txt); if (iMessage == SCI_SEARCHNEXT) { pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt, (wParam & SCFIND_MATCHCASE) != 0, @@ -4315,14 +4324,14 @@ void Editor::DropAt(int position, const char *value, bool moving, bool rectangul position = positionAfterDeletion; if (rectangular) { - PasteRectangular(position, value, strlen(value)); + PasteRectangular(position, value, istrlen(value)); pdoc->EndUndoAction(); // Should try to select new rectangle but it may not be a rectangle now so just select the drop position SetSelection(position, position); } else { position = MovePositionOutsideChar(position, currentPos - position); if (pdoc->InsertString(position, value)) { - SetSelection(position + strlen(value), position); + SetSelection(position + istrlen(value), position); } pdoc->EndUndoAction(); } @@ -4990,7 +4999,7 @@ void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) { int Editor::ReplaceTarget(bool replacePatterns, const char *text, int length) { pdoc->BeginUndoAction(); if (length == -1) - length = strlen(text); + length = istrlen(text); if (replacePatterns) { text = pdoc->SubstituteByPosition(text, &length); if (!text) @@ -5186,7 +5195,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { char *replacement = CharPtrFromSPtr(lParam); pdoc->InsertString(currentPos, replacement); pdoc->EndUndoAction(); - SetEmptySelection(currentPos + strlen(replacement)); + SetEmptySelection(currentPos + istrlen(replacement)); EnsureCaretVisible(); } break; @@ -5357,7 +5366,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { char *sz = CharPtrFromSPtr(lParam); pdoc->InsertString(insertPos, sz); if (newCurrent > insertPos) - newCurrent += strlen(sz); + newCurrent += istrlen(sz); SetEmptySelection(newCurrent); return 0; } diff --git a/contrib/src/stc/scintilla/src/ExternalLexer.h b/contrib/src/stc/scintilla/src/ExternalLexer.h index 01d9ac7141..6308fc28be 100644 --- a/contrib/src/stc/scintilla/src/ExternalLexer.h +++ b/contrib/src/stc/scintilla/src/ExternalLexer.h @@ -10,16 +10,8 @@ #if PLAT_WIN #define EXT_LEXER_DECL __stdcall -#elif PLAT_GTK -#define EXT_LEXER_DECL -#endif - -#if PLAT_WX -#ifdef __WXMSW__ -#define EXT_LEXER_DECL __stdcall #else -#define EXT_LEXER_DECL -#endif +#define EXT_LEXER_DECL #endif // External Lexer function definitions... @@ -41,7 +33,7 @@ protected: int externalLanguage; char name[100]; public: - ExternalLexerModule(int language_, LexerFunction fnLexer_, + ExternalLexerModule(int language_, LexerFunction fnLexer_, const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){ strncpy(name, languageName_, sizeof(name)); languageName = name; @@ -70,7 +62,7 @@ public: LexerLibrary(const char* ModuleName); ~LexerLibrary(); void Release(); - + LexerLibrary *next; SString m_sModuleName; }; @@ -79,10 +71,10 @@ public: class LexerManager { public: ~LexerManager(); - + static LexerManager *GetInstance(); static void DeleteInstance(); - + void Load(const char* path); void Clear(); diff --git a/contrib/src/stc/scintilla/src/Indicator.cxx b/contrib/src/stc/scintilla/src/Indicator.cxx index 580e9f86da..1e386b68e3 100644 --- a/contrib/src/stc/scintilla/src/Indicator.cxx +++ b/contrib/src/stc/scintilla/src/Indicator.cxx @@ -55,6 +55,8 @@ void Indicator::Draw(Surface *surface, PRectangle &rc) { } else if (style == INDIC_STRIKE) { surface->MoveTo(rc.left, rc.top - 4); surface->LineTo(rc.right, rc.top - 4); + } else if (style == INDIC_HIDDEN) { + // Draw nothing } else { // Either INDIC_PLAIN or unknown surface->MoveTo(rc.left, ymid); surface->LineTo(rc.right, ymid); diff --git a/contrib/src/stc/scintilla/src/KeyWords.cxx b/contrib/src/stc/scintilla/src/KeyWords.cxx index 8fb51bdb76..ae22baf2f2 100644 --- a/contrib/src/stc/scintilla/src/KeyWords.cxx +++ b/contrib/src/stc/scintilla/src/KeyWords.cxx @@ -153,6 +153,8 @@ int Scintilla_LinkLexers() { LINK_LEXER(lmLout); LINK_LEXER(lmLua); LINK_LEXER(lmMatlab); + LINK_LEXER(lmMMIXAL); + LINK_LEXER(lmNsis); LINK_LEXER(lmBatch); LINK_LEXER(lmDiff); LINK_LEXER(lmProps); @@ -163,8 +165,10 @@ int Scintilla_LinkLexers() { LINK_LEXER(lmPascal); LINK_LEXER(lmPerl); LINK_LEXER(lmPOV); + LINK_LEXER(lmPS); LINK_LEXER(lmPython); LINK_LEXER(lmRuby); + LINK_LEXER(lmScriptol); LINK_LEXER(lmSQL); LINK_LEXER(lmVB); LINK_LEXER(lmVBScript); diff --git a/contrib/src/stc/scintilla/src/LexAda.cxx b/contrib/src/stc/scintilla/src/LexAda.cxx index 263f7da456..2e5f891b4b 100644 --- a/contrib/src/stc/scintilla/src/LexAda.cxx +++ b/contrib/src/stc/scintilla/src/LexAda.cxx @@ -321,7 +321,7 @@ static bool IsValidIdentifier(const SString& identifier) { // First character can't be '_', so initialize the flag to true bool lastWasUnderscore = true; - int length = identifier.length(); + size_t length = identifier.length(); // Zero-length identifiers are not valid (these can occur inside labels) if (length == 0) { @@ -334,7 +334,7 @@ static bool IsValidIdentifier(const SString& identifier) { } // Check for only valid characters and no double underscores - for (int i = 0; i < length; i++) { + for (size_t i = 0; i < length; i++) { if (!IsWordCharacter(identifier[i]) || (identifier[i] == '_' && lastWasUnderscore)) { return false; @@ -355,8 +355,8 @@ static bool IsValidNumber(const SString& number) { int hashPos = number.search("#"); bool seenDot = false; - int i = 0; - int length = number.length(); + size_t i = 0; + size_t length = number.length(); if (length == 0) return false; // Just in case diff --git a/contrib/src/stc/scintilla/src/LexCSS.cxx b/contrib/src/stc/scintilla/src/LexCSS.cxx index b89f7ea8bb..11daa14238 100644 --- a/contrib/src/stc/scintilla/src/LexCSS.cxx +++ b/contrib/src/stc/scintilla/src/LexCSS.cxx @@ -108,7 +108,8 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo sc.SetState(SCE_CSS_DEFAULT); break; case ':': - if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID) + if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT || + lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) sc.SetState(SCE_CSS_PSEUDOCLASS); else if (lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_UNKNOWN_IDENTIFIER) sc.SetState(SCE_CSS_VALUE); diff --git a/contrib/src/stc/scintilla/src/LexEScript.cxx b/contrib/src/stc/scintilla/src/LexEScript.cxx index 28e3b3b0de..49411588aa 100644 --- a/contrib/src/stc/scintilla/src/LexEScript.cxx +++ b/contrib/src/stc/scintilla/src/LexEScript.cxx @@ -195,7 +195,7 @@ static void FoldESCRIPTDoc(unsigned int startPos, int length, int initStyle, Wor styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - + if (foldComment && IsStreamCommentStyle(style)) { if (!IsStreamCommentStyle(stylePrev)) { levelCurrent++; diff --git a/contrib/src/stc/scintilla/src/LexHTML.cxx b/contrib/src/stc/scintilla/src/LexHTML.cxx index 345b15edcb..e442054b36 100644 --- a/contrib/src/stc/scintilla/src/LexHTML.cxx +++ b/contrib/src/stc/scintilla/src/LexHTML.cxx @@ -127,7 +127,7 @@ static int stateForPrintState(int StateToPrint) { } static inline bool IsNumber(unsigned int start, Accessor &styler) { - return isdigit(styler[start]) || (styler[start] == '.') || + return IsADigit(styler[start]) || (styler[start] == '.') || (styler[start] == '-') || (styler[start] == '#'); } @@ -246,7 +246,7 @@ static int classifyTagHTML(unsigned int start, unsigned int end, static void classifyWordHTJS(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, script_mode inScriptType) { char chAttr = SCE_HJ_WORD; - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.'); if (wordIsNumber) chAttr = SCE_HJ_NUMBER; else { @@ -264,7 +264,7 @@ static void classifyWordHTJS(unsigned int start, unsigned int end, static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, script_mode inScriptType) { char chAttr = SCE_HB_IDENTIFIER; - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); + bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.'); if (wordIsNumber) chAttr = SCE_HB_NUMBER; else { @@ -288,7 +288,7 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw } static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType) { - bool wordIsNumber = isdigit(styler[start]) != 0; + bool wordIsNumber = IsADigit(styler[start]); char s[30 + 1]; unsigned int i = 0; for (; i < end - start + 1 && i < 30; i++) { @@ -312,7 +312,7 @@ static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &key // Called when in a PHP word static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { char chAttr = SCE_HPHP_DEFAULT; - bool wordIsNumber = isdigit(styler[start]) != 0; + bool wordIsNumber = IsADigit(styler[start]); if (wordIsNumber) chAttr = SCE_HPHP_NUMBER; else { @@ -375,19 +375,21 @@ static int StateForScript(script_type scriptLanguage) { } static inline bool ishtmlwordchar(char ch) { - return isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#'; + return !isascii(ch) || + (isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#'); } static inline bool issgmlwordchar(char ch) { - return isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '['; + return !isascii(ch) || + (isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '['); } static inline bool IsPhpWordStart(const unsigned char ch) { - return isalpha(ch) || (ch == '_') || (ch >= 0x7f); + return (isascii(ch) && (isalpha(ch) || (ch == '_'))) || (ch >= 0x7f); } static inline bool IsPhpWordChar(char ch) { - return isdigit(ch) || IsPhpWordStart(ch); + return IsADigit(ch) || IsPhpWordStart(ch); } static bool InTagState(int state) { @@ -787,7 +789,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty } else if ((ch == '-') && (chPrev == '-')) { styler.ColourTo(i - 2, StateToPrint); state = SCE_H_SGML_COMMENT; - } else if (isalpha(ch) && (chPrev == '%')) { + } else if (isascii(ch) && isalpha(ch) && (chPrev == '%')) { styler.ColourTo(i - 2, StateToPrint); state = SCE_H_SGML_ENTITY; } else if (ch == '#') { @@ -905,7 +907,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty } break; case SCE_H_SGML_SPECIAL: - if (!isupper(ch)) { + if (!(isascii(ch) && isupper(ch))) { styler.ColourTo(i - 1, StateToPrint); if (isalnum(ch)) { state = SCE_H_SGML_ERROR; @@ -918,7 +920,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty if (ch == ';') { styler.ColourTo(i, StateToPrint); state = SCE_H_SGML_DEFAULT; - } else if (!isalnum(ch) && ch != '-' && ch != '.') { + } else if (!(isascii(ch) && isalnum(ch)) && ch != '-' && ch != '.') { styler.ColourTo(i, SCE_H_SGML_ERROR); state = SCE_H_SGML_DEFAULT; } @@ -928,7 +930,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty styler.ColourTo(i, StateToPrint); state = SCE_H_DEFAULT; } - if (ch != '#' && !isalnum(ch)) { // Should check that '#' follows '&', but it is unlikely anyway... + if (ch != '#' && !(isascii(ch) && isalnum(ch))) { // Should check that '#' follows '&', but it is unlikely anyway... styler.ColourTo(i, SCE_H_TAGUNKNOWN); state = SCE_H_DEFAULT; } @@ -1464,7 +1466,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty } break; case SCE_HPHP_NUMBER: - if (!isdigit(ch)) { + if (!IsADigit(ch)) { styler.ColourTo(i - 1, SCE_HPHP_NUMBER); if (isoperator(ch)) state = SCE_HPHP_OPERATOR; @@ -1524,7 +1526,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty case SCE_HPHP_OPERATOR: case SCE_HPHP_DEFAULT: styler.ColourTo(i - 1, StateToPrint); - if (isdigit(ch)) { + if (IsADigit(ch)) { state = SCE_HPHP_NUMBER; } else if (iswordstart(ch)) { state = SCE_HPHP_WORD; diff --git a/contrib/src/stc/scintilla/src/LexLua.cxx b/contrib/src/stc/scintilla/src/LexLua.cxx index 159bc1585d..18612c9ee3 100644 --- a/contrib/src/stc/scintilla/src/LexLua.cxx +++ b/contrib/src/stc/scintilla/src/LexLua.cxx @@ -24,7 +24,7 @@ #include "SciLexer.h" static inline bool IsAWordChar(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); + return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.'); } inline bool IsAWordStart(const int ch) { @@ -58,6 +58,8 @@ static void ColouriseLuaDoc( WordList &keywords4 = *keywordlists[3]; WordList &keywords5 = *keywordlists[4]; WordList &keywords6 = *keywordlists[5]; + WordList &keywords7 = *keywordlists[6]; + WordList &keywords8 = *keywordlists[7]; int currentLine = styler.GetLine(startPos); // Initialize the literal string [[ ... ]] nesting level, if we are inside such a string. @@ -121,11 +123,15 @@ static void ColouriseLuaDoc( if (sc.state == SCE_LUA_OPERATOR) { sc.SetState(SCE_LUA_DEFAULT); } else if (sc.state == SCE_LUA_NUMBER) { - if (!IsAWordChar(sc.ch)) { - sc.SetState(SCE_LUA_DEFAULT); + // We stop the number definition on non-numerical non-dot non-eE non-sign char + if (!(isdigit(sc.ch) || sc.ch == '.' || + toupper(sc.ch) == 'E' || sc.ch == '-' || sc.ch == '+')) { + // Not exactly following number definition (several dots are seen as OK, etc.) + // but probably enough in most cases. + sc.SetState(SCE_LUA_DEFAULT); } } else if (sc.state == SCE_LUA_IDENTIFIER) { - if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { + if (!IsAWordChar(sc.ch)) { char s[100]; sc.GetCurrent(s, sizeof(s)); if (keywords.InList(s)) { @@ -140,6 +146,12 @@ static void ColouriseLuaDoc( sc.ChangeState(SCE_LUA_WORD5); } else if (keywords6.InList(s)) { sc.ChangeState(SCE_LUA_WORD6); + } else if (keywords6.InList(s)) { + sc.ChangeState(SCE_LUA_WORD6); + } else if (keywords7.InList(s)) { + sc.ChangeState(SCE_LUA_WORD7); + } else if (keywords8.InList(s)) { + sc.ChangeState(SCE_LUA_WORD8); } sc.SetState(SCE_LUA_DEFAULT); } @@ -300,8 +312,8 @@ static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, W static const char * const luaWordListDesc[] = { "Keywords", "Basic functions", - "String & math functions", - "I/O & system facilities", + "String, (table) & math functions", + "(coroutines), I/O & system facilities", "XXX", "XXX", 0 diff --git a/contrib/src/stc/scintilla/src/LexOthers.cxx b/contrib/src/stc/scintilla/src/LexOthers.cxx index 45e2d51544..31ac415ad4 100644 --- a/contrib/src/stc/scintilla/src/LexOthers.cxx +++ b/contrib/src/stc/scintilla/src/LexOthers.cxx @@ -268,6 +268,59 @@ static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList * } } +// adaption by ksc, using the "} else {" trick of 1.53 +// 030721 +static void FoldPropsDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + + unsigned int endPos = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + + char chNext = styler[startPos]; + int styleNext = styler.StyleAt(startPos); + bool headerPoint = false; + + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler[i+1]; + + int style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + + if (style==2) { + headerPoint = true; + } + + if (atEOL) { + int lev = SC_FOLDLEVELBASE+1; + if (headerPoint) + lev = SC_FOLDLEVELBASE; + + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + + if (headerPoint) + lev |= SC_FOLDLEVELHEADERFLAG; + + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + + lineCurrent++; + visibleChars = 0; + headerPoint=false; + } + if (!isspacechar(ch)) + visibleChars++; + } + + int lev = headerPoint ? SC_FOLDLEVELBASE : SC_FOLDLEVELBASE+1; + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, lev | flagsNext); +} + static void ColouriseMakeLine( char *lineBuffer, unsigned int lengthLine, @@ -638,7 +691,7 @@ static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[ LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc); LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", 0, emptyWordListDesc); -LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", 0, emptyWordListDesc); +LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", FoldPropsDoc, emptyWordListDesc); LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", 0, emptyWordListDesc); LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", 0, emptyWordListDesc); LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc, "latex", 0, emptyWordListDesc); diff --git a/contrib/src/stc/scintilla/src/LexPOV.cxx b/contrib/src/stc/scintilla/src/LexPOV.cxx index 1e44450bbc..33ba6a490f 100644 --- a/contrib/src/stc/scintilla/src/LexPOV.cxx +++ b/contrib/src/stc/scintilla/src/LexPOV.cxx @@ -1,10 +1,19 @@ // Scintilla source code edit control /** @file LexPOV.cxx - ** Lexer for POV-Ray, based on lexer for C++. + ** Lexer for POV-Ray SDL (Persistance of Vision Raytracer, Scene Description Language). + ** Written by Philippe Lhoste but this is mostly a derivative of LexCPP... **/ -// Copyright 2003 by Steven te Brinke +// Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. +// Some points that distinguish from a simple C lexer: +// Identifiers start only by a character. +// No line continuation character. +// Strings are limited to 256 characters. +// Directives are similar to preprocessor commands, +// but we match directive keywords and colorize incorrect ones. +// Block comments can be nested (code stolen from my code in LexLua). + #include #include #include @@ -20,101 +29,152 @@ #include "Scintilla.h" #include "SciLexer.h" -#define KEYWORD_BOXHEADER 1 -#define KEYWORD_FOLDCONTRACTED 2 - static inline bool IsAWordChar(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); + return ch < 0x80 && (isalnum(ch) || ch == '_'); } -static inline bool IsAWordStart(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '_'); +inline bool IsAWordStart(const int ch) { + return ch < 0x80 && isalpha(ch); } -static inline bool IsStateComment(const int state) { - return ((state == SCE_POV_COMMENT) || - (state == SCE_POV_COMMENTLINE) || - (state == SCE_POV_COMMENTDOC)); -} +static void ColourisePovDoc( + unsigned int startPos, + int length, + int initStyle, + WordList *keywordlists[], + Accessor &styler) { -static inline bool IsStateString(const int state) { - return ((state == SCE_POV_STRING)); -} - -static void ColourisePOVDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - - WordList &keywords = *keywordlists[0]; + WordList &keywords1 = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; + WordList &keywords3 = *keywordlists[2]; + WordList &keywords4 = *keywordlists[3]; + WordList &keywords5 = *keywordlists[4]; + WordList &keywords6 = *keywordlists[5]; + WordList &keywords7 = *keywordlists[6]; + WordList &keywords8 = *keywordlists[7]; + + int currentLine = styler.GetLine(startPos); + // Initialize the block comment /* */ nesting level, if we are inside such a comment. + int blockCommentLevel = 0; + if (initStyle == SCE_POV_COMMENT) { + blockCommentLevel = styler.GetLineState(currentLine - 1); + } // Do not leak onto next line - /*if (initStyle == SCE_POV_STRINGEOL) - initStyle = SCE_POV_DEFAULT;*/ + if (initStyle == SCE_POV_STRINGEOL) { + initStyle = SCE_POV_DEFAULT; + } StyleContext sc(startPos, length, initStyle, styler); - - bool caseSensitive = styler.GetPropertyInt("pov.case.sensitive", 1) != 0; + short stringLen = 0; for (; sc.More(); sc.Forward()) { - - /*if (sc.atLineStart && (sc.state == SCE_POV_STRING)) { - // Prevent SCE_POV_STRINGEOL from leaking back to previous line - sc.SetState(SCE_POV_STRING); - }*/ - - // Handle line continuation generically. - if (sc.ch == '\\') { - if (sc.chNext == '\n' || sc.chNext == '\r') { - sc.Forward(); - if (sc.ch == '\r' && sc.chNext == '\n') { - sc.Forward(); - } - continue; + if (sc.atLineEnd) { + // Update the line state, so it can be seen by next line + currentLine = styler.GetLine(sc.currentPos); + if (sc.state == SCE_POV_COMMENT) { + // Inside a block comment, we set the line state + styler.SetLineState(currentLine, blockCommentLevel); + } else { + // Reset the line state + styler.SetLineState(currentLine, 0); } } + if (sc.atLineStart && (sc.state == SCE_POV_STRING)) { + // Prevent SCE_POV_STRINGEOL from leaking back to previous line + sc.SetState(SCE_POV_STRING); + } + // Determine if the current state should terminate. - if (sc.state == SCE_POV_OPERATOR || sc.state == SCE_POV_BRACE) { + if (sc.state == SCE_POV_OPERATOR) { sc.SetState(SCE_POV_DEFAULT); } else if (sc.state == SCE_POV_NUMBER) { - if (!IsADigit(sc.ch) || sc.ch != '.') { - sc.SetState(SCE_POV_DEFAULT); + // We stop the number definition on non-numerical non-dot non-eE non-sign char + if (!(isdigit(sc.ch) || sc.ch == '.' || + toupper(sc.ch) == 'E' || sc.ch == '-' || sc.ch == '+')) { + // Not exactly following number definition (several dots are seen as OK, etc.) + // but probably enough in most cases. + sc.SetState(SCE_POV_DEFAULT); } } else if (sc.state == SCE_POV_IDENTIFIER) { - if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { + if (!IsAWordChar(sc.ch)) { char s[100]; - if (caseSensitive) { - sc.GetCurrent(s, sizeof(s)); - } else { - sc.GetCurrentLowered(s, sizeof(s)); - } - if (keywords.InList(s)) { - sc.ChangeState(SCE_POV_WORD); - } else if (keywords2.InList(s)) { + sc.GetCurrent(s, sizeof(s)); + if (keywords2.InList(s)) { sc.ChangeState(SCE_POV_WORD2); + } else if (keywords3.InList(s)) { + sc.ChangeState(SCE_POV_WORD3); + } else if (keywords4.InList(s)) { + sc.ChangeState(SCE_POV_WORD4); + } else if (keywords5.InList(s)) { + sc.ChangeState(SCE_POV_WORD5); + } else if (keywords6.InList(s)) { + sc.ChangeState(SCE_POV_WORD6); + } else if (keywords7.InList(s)) { + sc.ChangeState(SCE_POV_WORD7); + } else if (keywords8.InList(s)) { + sc.ChangeState(SCE_POV_WORD8); + } + sc.SetState(SCE_POV_DEFAULT); + } + } else if (sc.state == SCE_POV_DIRECTIVE) { + if (!IsAWordChar(sc.ch)) { + char s[100], *p; + sc.GetCurrent(s, sizeof(s)); + p = s; + // Skip # and whitespace between # and directive word + do { + p++; + } while ((*p == ' ' || *p == '\t') && *p != '\0'); + if (!keywords1.InList(p)) { + sc.ChangeState(SCE_POV_BADDIRECTIVE); } sc.SetState(SCE_POV_DEFAULT); } } else if (sc.state == SCE_POV_COMMENT) { - if (sc.Match('*', '/')) { + if (sc.Match('/', '*')) { + blockCommentLevel++; sc.Forward(); - sc.ForwardSetState(SCE_POV_DEFAULT); - } - } else if (sc.state == SCE_POV_COMMENTDOC) { - if (sc.Match('*', '/')) { + } else if (sc.Match('*', '/') && blockCommentLevel > 0) { + blockCommentLevel--; sc.Forward(); - sc.ForwardSetState(SCE_POV_DEFAULT); + if (blockCommentLevel == 0) { + sc.ForwardSetState(SCE_POV_DEFAULT); + } } } else if (sc.state == SCE_POV_COMMENTLINE) { if (sc.atLineEnd) { sc.SetState(SCE_POV_DEFAULT); } } else if (sc.state == SCE_POV_STRING) { + if (sc.ch == '\\') { + stringLen++; + if (strchr("abfnrtuv0'\"", sc.chNext)) { + // Compound characters are counted as one. + // Note: for Unicode chars \u, we shouldn't count the next 4 digits... + sc.Forward(); + } + } else if (sc.ch == '\"') { + sc.ForwardSetState(SCE_POV_DEFAULT); + } else if (sc.atLineEnd) { + sc.ChangeState(SCE_POV_STRINGEOL); + sc.ForwardSetState(SCE_POV_DEFAULT); + } else { + stringLen++; + } + if (stringLen > 256) { + // Strings are limited to 256 chars + sc.SetState(SCE_POV_STRINGEOL); + } + } else if (sc.state == SCE_POV_STRINGEOL) { if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\"') { + sc.ForwardSetState(SCE_C_DEFAULT); + } else if (sc.atLineEnd) { sc.ForwardSetState(SCE_POV_DEFAULT); } } @@ -123,35 +183,43 @@ static void ColourisePOVDoc(unsigned int startPos, int length, int initStyle, Wo if (sc.state == SCE_POV_DEFAULT) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_POV_NUMBER); - } else if (IsAWordStart(sc.ch) || (sc.ch == '#')) { + } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_POV_IDENTIFIER); } else if (sc.Match('/', '*')) { + blockCommentLevel = 1; sc.SetState(SCE_POV_COMMENT); sc.Forward(); // Eat the * so it isn't used for the end of the comment } else if (sc.Match('/', '/')) { sc.SetState(SCE_POV_COMMENTLINE); } else if (sc.ch == '\"') { sc.SetState(SCE_POV_STRING); - //} else if (isoperator(static_cast(sc.ch))) { - } else if (sc.ch == '+' || sc.ch == '-' || sc.ch == '*' || sc.ch == '/' || sc.ch == '=' || sc.ch == '<' || sc.ch == '>' || sc.ch == '&' || sc.ch == '|' || sc.ch == '!' || sc.ch == '?' || sc.ch == ':') { + stringLen = 0; + } else if (sc.ch == '#') { + sc.SetState(SCE_POV_DIRECTIVE); + // Skip whitespace between # and directive word + do { + sc.Forward(); + } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); + if (sc.atLineEnd) { + sc.SetState(SCE_POV_DEFAULT); + } + } else if (isoperator(static_cast(sc.ch))) { sc.SetState(SCE_POV_OPERATOR); - } else if (sc.ch == '{' || sc.ch == '}') { - sc.SetState(SCE_POV_BRACE); } } - } sc.Complete(); } -static bool IsStreamCommentStyle(int style) { - return style == SCE_POV_COMMENT || - style == SCE_POV_COMMENTDOC; -} +static void FoldPovDoc( + unsigned int startPos, + int length, + int initStyle, + WordList *[], + Accessor &styler) { -static void FoldNoBoxPOVDoc(unsigned int startPos, int length, int initStyle, - Accessor &styler) { - bool foldComment = styler.GetPropertyInt("fold.comment", 1) != 0; + bool foldComment = styler.GetPropertyInt("fold.comment") != 0; + bool foldDirective = styler.GetPropertyInt("fold.directive") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; unsigned int endPos = startPos + length; int visibleChars = 0; @@ -168,15 +236,33 @@ static void FoldNoBoxPOVDoc(unsigned int startPos, int length, int initStyle, style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - if (foldComment && IsStreamCommentStyle(style)) { - if (!IsStreamCommentStyle(stylePrev)) { + if (foldComment && (style == SCE_POV_COMMENT)) { + if (stylePrev != SCE_POV_COMMENT) { levelCurrent++; - } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { + } else if ((styleNext != SCE_POV_COMMENT) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelCurrent--; } } - if (style == SCE_POV_BRACE) { + if (foldComment && (style == SCE_POV_COMMENTLINE)) { + if ((ch == '/') && (chNext == '/')) { + char chNext2 = styler.SafeGetCharAt(i + 2); + if (chNext2 == '{') { + levelCurrent++; + } else if (chNext2 == '}') { + levelCurrent--; + } + } + } + if (foldDirective && (style == SCE_POV_DIRECTIVE)) { + if (ch == '#') { + unsigned int j=i+1; + while ((j September 2002 + ** Updated by Mathias Rauen May 2003 (Delphi adjustments) **/ #include @@ -40,12 +41,15 @@ static bool IsStreamCommentStyle(int style) { style == SCE_C_COMMENTDOCKEYWORDERROR; } -static inline bool IsAWordChar(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); +static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool bInAsm) { + if ((bInAsm) && (attr == SCE_C_OPERATOR || attr == SCE_C_NUMBER || attr == SCE_C_DEFAULT || attr == SCE_C_WORD || attr == SCE_C_IDENTIFIER)) { + styler.ColourTo(end, SCE_C_REGEX); + } else + styler.ColourTo(end, attr); } -// returns 1 if the item starts a class definition, and -1 if the word is "end". -static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInClass) { +// returns 1 if the item starts a class definition, and -1 if the word is "end", and 2 if the word is "asm" +static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInClass, bool bInAsm) { int ret = 0; WordList& keywords = *keywordlists[0]; @@ -55,24 +59,34 @@ static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList & getRange(start, end, styler, s, sizeof(s)); char chAttr = SCE_C_IDENTIFIER; - if (isdigit(s[0]) || (s[0] == '.')) { + if (isdigit(s[0]) || (s[0] == '.') ||(s[0] == '$')) { chAttr = SCE_C_NUMBER; } else { - if (keywords.InList(s)) { - chAttr = SCE_C_WORD; - - if(strcmp(s, "class") == 0) - ret = 1; - else if(strcmp(s, "end") == 0) - ret = -1; - } else if (bInClass) { - if (classwords.InList(s)) { + if (s[0] == '#') { + chAttr = SCE_C_CHARACTER; + } + else { + if (keywords.InList(s)) { chAttr = SCE_C_WORD; + + if(strcmp(s, "class") == 0) { + ret = 1; + } + else if (strcmp(s, "asm") == 0) { + ret = 2; + } + else if (strcmp(s, "end") == 0) { + ret = -1; + } + } else if (bInClass) { + if (classwords.InList(s)) { + chAttr = SCE_C_WORD; + } } } } - styler.ColourTo(end, chAttr); + ColourTo(styler, end, chAttr, (bInAsm && ret != -1)); return ret; } @@ -99,14 +113,14 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, styler.StartAt(startPos); int state = initStyle; - if (state == SCE_C_STRINGEOL) // Does not leak onto next line + if (state == SCE_C_CHARACTER) // Does not leak onto next line state = SCE_C_DEFAULT; char chPrev = ' '; char chNext = styler[startPos]; unsigned int lengthDoc = startPos + length; - int visibleChars = 0; bool bInClassDefinition; + int currentLine = styler.GetLine(startPos); if (currentLine > 0) { styler.SetLineState(currentLine, styler.GetLineState(currentLine-1)); @@ -116,6 +130,10 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, bInClassDefinition = false; } + bool bInAsm = (state == SCE_C_REGEX); + if (bInAsm) + state = SCE_C_DEFAULT; + styler.StartSegment(startPos); for (unsigned int i = startPos; i < lengthDoc; i++) { char ch = chNext; @@ -126,16 +144,13 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix) // Avoid triggering two times on Dos/Win // End of line - if (state == SCE_C_STRINGEOL) { - styler.ColourTo(i, state); + if (state == SCE_C_CHARACTER) { + ColourTo(styler, i, state, bInAsm); state = SCE_C_DEFAULT; } - visibleChars = 0; currentLine++; styler.SetLineState(currentLine, (bInClassDefinition ? 1 : 0)); } - if (!isspacechar(ch)) - visibleChars++; if (styler.IsLeadByte(ch)) { chNext = styler.SafeGetCharAt(i + 2); @@ -145,41 +160,50 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, } if (state == SCE_C_DEFAULT) { - if (iswordstart(ch) || (ch == '@')) { - styler.ColourTo(i-1, state); + if (iswordstart(ch) || ch == '#' || ch == '$' || (ch == '@' && bInAsm)) { + ColourTo(styler, i-1, state, bInAsm); state = SCE_C_IDENTIFIER; } else if (ch == '{' && chNext != '$' && chNext != '&') { - styler.ColourTo(i-1, state); + ColourTo(styler, i-1, state, bInAsm); state = SCE_C_COMMENT; } else if (ch == '(' && chNext == '*' && styler.SafeGetCharAt(i + 2) != '$' && styler.SafeGetCharAt(i + 2) != '&') { - styler.ColourTo(i-1, state); + ColourTo(styler, i-1, state, bInAsm); state = SCE_C_COMMENTDOC; } else if (ch == '/' && chNext == '/') { - styler.ColourTo(i-1, state); + ColourTo(styler, i-1, state, bInAsm); state = SCE_C_COMMENTLINE; } else if (ch == '\'') { - styler.ColourTo(i-1, state); + ColourTo(styler, i-1, state, bInAsm); state = SCE_C_CHARACTER; - } else if (ch == '{' && (chNext == '$' || chNext=='&') && visibleChars == 1) { - styler.ColourTo(i-1, state); + } else if (ch == '{' && (chNext == '$' || chNext=='&')) { + ColourTo(styler, i-1, state, bInAsm); state = SCE_C_PREPROCESSOR; } else if (isoperator(ch)) { - styler.ColourTo(i-1, state); - styler.ColourTo(i, SCE_C_OPERATOR); + ColourTo(styler, i-1, state, bInAsm); + ColourTo(styler, i, SCE_C_OPERATOR, bInAsm); } } else if (state == SCE_C_IDENTIFIER) { - if (!iswordchar(ch)) { - int lStateChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywordlists, styler, bInClassDefinition); + bool bDoublePoint = ((ch == '.') && (chPrev == '.')); + if ((!iswordchar(ch) && ch != '$' && ch != '#' && (ch != '@' || !bInAsm)) || bDoublePoint) { + if (bDoublePoint) i--; + int lStateChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywordlists, styler, bInClassDefinition, bInAsm); if(lStateChange == 1) { styler.SetLineState(currentLine, 1); bInClassDefinition = true; + } else if(lStateChange == 2) { + bInAsm = true; } else if(lStateChange == -1) { styler.SetLineState(currentLine, 0); bInClassDefinition = false; + bInAsm = false; + } + if (bDoublePoint) { + i++; + ColourTo(styler, i-1, SCE_C_DEFAULT, bInAsm); } state = SCE_C_DEFAULT; @@ -189,30 +213,30 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, } else if (ch == '(' && chNext == '*' && styler.SafeGetCharAt(i + 2) != '$' && styler.SafeGetCharAt(i + 2) != '&') { - styler.ColourTo(i-1, state); + ColourTo(styler, i-1, state, bInAsm); state = SCE_C_COMMENTDOC; } else if (ch == '/' && chNext == '/') { state = SCE_C_COMMENTLINE; } else if (ch == '\'') { state = SCE_C_CHARACTER; } else if (isoperator(ch)) { - styler.ColourTo(i, SCE_C_OPERATOR); + ColourTo(styler, i, SCE_C_OPERATOR, bInAsm); } } } else { if (state == SCE_C_PREPROCESSOR) { if (ch=='}'){ - styler.ColourTo(i, state); + ColourTo(styler, i, state, bInAsm); state = SCE_C_DEFAULT; } else { if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) { - styler.ColourTo(i-1, state); + ColourTo(styler, i-1, state, bInAsm); state = SCE_C_DEFAULT; } } } else if (state == SCE_C_COMMENT) { if (ch == '}' ) { - styler.ColourTo(i, state); + ColourTo(styler, i, state, bInAsm); state = SCE_C_DEFAULT; } } else if (state == SCE_C_COMMENTDOC) { @@ -220,28 +244,25 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, if (((i > styler.GetStartSegment() + 2) || ( (initStyle == SCE_C_COMMENTDOC) && (styler.GetStartSegment() == static_cast(startPos))))) { - styler.ColourTo(i, state); + ColourTo(styler, i, state, bInAsm); state = SCE_C_DEFAULT; } } } else if (state == SCE_C_COMMENTLINE) { if (ch == '\r' || ch == '\n') { - styler.ColourTo(i-1, state); + ColourTo(styler, i-1, state, bInAsm); state = SCE_C_DEFAULT; } } else if (state == SCE_C_CHARACTER) { - if ((ch == '\r' || ch == '\n')) { - styler.ColourTo(i-1, SCE_C_STRINGEOL); - state = SCE_C_STRINGEOL; - } else if (ch == '\'') { - styler.ColourTo(i, state); + if (ch == '\'') { + ColourTo(styler, i, state, bInAsm); state = SCE_C_DEFAULT; } } } chPrev = ch; } - styler.ColourTo(lengthDoc - 1, state); + ColourTo(styler, lengthDoc - 1, state, bInAsm); } static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, WordList *[], diff --git a/contrib/src/stc/scintilla/src/LexSQL.cxx b/contrib/src/stc/scintilla/src/LexSQL.cxx index 0520c00ed6..3f65b12097 100644 --- a/contrib/src/stc/scintilla/src/LexSQL.cxx +++ b/contrib/src/stc/scintilla/src/LexSQL.cxx @@ -23,7 +23,7 @@ static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keyw char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = static_cast(toupper(styler[start + i])); + s[i] = static_cast(tolower(styler[start + i])); s[i + 1] = '\0'; } char chAttr = SCE_C_IDENTIFIER; @@ -88,7 +88,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, } else if (ch == '-' && chNext == '-') { styler.ColourTo(i - 1, state); state = SCE_C_COMMENTLINE; - } else if (ch == '\'') { + } else if ((ch == '\'') || (ch == '"')) { styler.ColourTo(i - 1, state); state = SCE_C_STRING; } else if (isoperator(ch)) { @@ -103,7 +103,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, state = SCE_C_COMMENT; } else if (ch == '-' && chNext == '-') { state = SCE_C_COMMENTLINE; - } else if (ch == '\'') { + } else if ((ch == '\'') || (ch == '"')) { state = SCE_C_STRING; } else if (isoperator(ch)) { styler.ColourTo(i, SCE_C_OPERATOR); @@ -134,6 +134,16 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, } ch = chNext; chNext = styler.SafeGetCharAt(i + 1); + } else if (ch == '"') { + if (chNext == '"') { + i++; + } else { + styler.ColourTo(i, state); + state = SCE_C_DEFAULT; + i++; + } + ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); } } if (state == SCE_C_DEFAULT) { // One of the above succeeded @@ -141,7 +151,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, state = SCE_C_COMMENT; } else if (ch == '-' && chNext == '-') { state = SCE_C_COMMENTLINE; - } else if (ch == '\'') { + } else if ((ch == '\'') || (ch == '"')) { state = SCE_C_STRING; } else if (iswordstart(ch)) { state = SCE_C_WORD; diff --git a/contrib/src/stc/scintilla/src/PropSet.cxx b/contrib/src/stc/scintilla/src/PropSet.cxx index 8455d854d2..021a657273 100644 --- a/contrib/src/stc/scintilla/src/PropSet.cxx +++ b/contrib/src/stc/scintilla/src/PropSet.cxx @@ -71,16 +71,6 @@ bool EqualCaseInsensitive(const char *a, const char *b) { return 0 == CompareCaseInsensitive(a, b); } -inline unsigned int HashString(const char *s, size_t len) { - unsigned int ret = 0; - while (len--) { - ret <<= 4; - ret ^= *s; - s++; - } - return ret; -} - PropSet::PropSet() { superPS = 0; for (int root = 0; root < hashRoots; root++) @@ -160,7 +150,7 @@ SString PropSet::Get(const char *key) { } } -static bool IncludesVar(const char *value, const char *key) { +bool PropSet::IncludesVar(const char *value, const char *key) { const char *var = strstr(value, "$("); while (var) { if (isprefix(var + 2, key) && (var[2 + strlen(key)] == ')')) { diff --git a/contrib/src/stc/scintilla/src/RESearch.cxx b/contrib/src/stc/scintilla/src/RESearch.cxx index c579312f44..98c8717941 100644 --- a/contrib/src/stc/scintilla/src/RESearch.cxx +++ b/contrib/src/stc/scintilla/src/RESearch.cxx @@ -10,11 +10,11 @@ * Dept. of Computer Science * York University * - * Original code available from http://www.cs.yorku.ca/~oz/ + * Original code available from http://www.cs.yorku.ca/~oz/ * Translation to C++ by Neil Hodgson neilh@scintilla.org * Removed all use of register. * Converted to modern function prototypes. - * Put all global/static variables into an object so this code can be + * Put all global/static variables into an object so this code can be * used from multiple threads etc. * * These routines are the PUBLIC DOMAIN equivalents of regex @@ -30,8 +30,14 @@ * Modification history: * * $Log$ - * Revision 1.5.2.3 2003/07/18 06:35:14 RD - * Update to Scintilla 1.53 + * Revision 1.5.2.4 2003/09/18 18:14:11 RD + * Updated wxSTC in 2.4 branch to Scintilla 1.54. + * Also includes patches from ABX and new sample from Otto Wyss + * + * Revision 1.8 2003/09/18 05:05:38 RD + * Updated to Scintilla 1.54 + * Applied most of patch #806092 + * Added new wxSTC sample from Otto Wyss * * Revision 1.9 2003/03/21 10:36:08 nyamatongwe * Detect patterns too long in regular expression search. @@ -82,17 +88,17 @@ * * Revision 1.2 88/08/28 15:36:04 oz * Use a complement bitmap to represent NCL. - * This removes the need to have seperate - * code in the PMatch case block - it is + * This removes the need to have seperate + * code in the PMatch case block - it is * just CCL code now. - * + * * Use the actual CCL code in the CLO * section of PMatch. No need for a recursive * PMatch call. - * + * * Use a bitmap table to set char bits in an * 8-bit chunk. - * + * * Interfaces: * RESearch::Compile: compile a regular expression into a NFA. * @@ -122,7 +128,7 @@ * void re_fail(msg, op) * char *msg; * char op; - * + * * Regular Expressions: * * [1] char matches itself, unless it is a special @@ -132,20 +138,20 @@ * * [3] \ matches the character following it, except * when followed by a left or right round bracket, - * a digit 1 to 9 or a left or right angle bracket. + * a digit 1 to 9 or a left or right angle bracket. * (see [7], [8] and [9]) - * It is used as an escape character for all + * It is used as an escape character for all * other meta-characters, and itself. When used * in a set ([4]), it is treated as an ordinary * character. * * [4] [set] matches one of the characters in the set. * If the first character in the set is "^", - * it matches a character NOT in the set, i.e. - * complements the set. A shorthand S-E is - * used to specify a set of characters S upto - * E, inclusive. The special characters "]" and - * "-" have no special meaning if they appear + * it matches a character NOT in the set, i.e. + * complements the set. A shorthand S-E is + * used to specify a set of characters S upto + * E, inclusive. The special characters "]" and + * "-" have no special meaning if they appear * as the first chars in the set. * examples: match: * @@ -210,8 +216,8 @@ * Notes: * * This implementation uses a bit-set representation for character - * classes for speed and compactness. Each character is represented - * by one bit in a 128-bit block. Thus, CCL always takes a + * classes for speed and compactness. Each character is represented + * by one bit in a 128-bit block. Thus, CCL always takes a * constant 16 bytes in the internal nfa, and RESearch::Execute does a single * bit comparison to locate the character in the set. * @@ -221,7 +227,7 @@ * compile: CHR f CHR o CLO CHR o END CLO ANY END END * matches: fo foo fooo foobar fobar foxx ... * - * pattern: fo[ob]a[rz] + * pattern: fo[ob]a[rz] * compile: CHR f CHR o CCL bitset CHR a CCL bitset END * matches: fobar fooar fobaz fooaz * @@ -269,7 +275,7 @@ const char bitarr[] = {1,2,4,8,16,32,64,'\200'}; #define badpat(x) (*nfa = END, x) - + RESearch::RESearch() { Init(); } @@ -359,7 +365,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b int n; char mask; /* xor mask -CCL/NCL */ int c1, c2; - + if (!pat || !length) if (sta) return 0; @@ -401,7 +407,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b i++; if (*++p == '^') { - mask = '\377'; + mask = '\377'; i++; p++; } else @@ -445,7 +451,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b for (n = 0; n < BITBLK; bittab[n++] = (char) 0) *mp++ = static_cast(mask ^ bittab[n]); - + break; case '*': /* match 0 or more.. */ @@ -590,7 +596,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b * RESearch::Execute: * execute nfa to find a match. * - * special cases: (nfa[0]) + * special cases: (nfa[0]) * BOL * Match only once, starting from the * beginning. @@ -615,7 +621,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) { bol = lp; failure = 0; - + Clear(); switch(*ap) { @@ -656,7 +662,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) { return 1; } -/* +/* * PMatch: internal routine for the hard part * * This code is partly snarfed from an early grep written by @@ -682,7 +688,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) { * * At the end of a successful match, bopat[n] and eopat[n] * are set to the beginning and end of subpatterns matched - * by tagged expressions (n = 1 to 9). + * by tagged expressions (n = 1 to 9). * */ @@ -693,23 +699,23 @@ extern void re_fail(char *,char); * and EOW. the reason for not using ctype macros is that we can * let the user add into our own table. see RESearch::ModifyWord. This table * is not in the bitset form, since we may wish to extend it in the - * future for other character classifications. + * future for other character classifications. * * TRUE for 0-9 A-Z a-z _ */ static char chrtyp[MAXCHR] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, + 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; @@ -831,10 +837,10 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) { * the compact bitset representation for the default table] */ -static char deftab[16] = { - 0, 0, 0, 0, 0, 0, '\377', 003, '\376', '\377', '\377', '\207', - '\376', '\377', '\377', 007 -}; +static char deftab[16] = { + 0, 0, 0, 0, 0, 0, '\377', 003, '\376', '\377', '\377', '\207', + '\376', '\377', '\377', 007 +}; void RESearch::ModifyWord(char *s) { int i; @@ -881,7 +887,7 @@ int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst) { pin = c - '0'; break; } - + default: *dst++ = c; continue; diff --git a/contrib/src/stc/scintilla/src/RESearch.h b/contrib/src/stc/scintilla/src/RESearch.h index d676e0f318..8ca9cd0b82 100644 --- a/contrib/src/stc/scintilla/src/RESearch.h +++ b/contrib/src/stc/scintilla/src/RESearch.h @@ -18,7 +18,7 @@ #define BITBLK MAXCHR/CHRBIT class CharacterIndexer { -public: +public: virtual char CharAt(int index)=0; }; diff --git a/contrib/src/stc/scintilla/src/SVector.h b/contrib/src/stc/scintilla/src/SVector.h index 9c3235d580..c8edb513bc 100644 --- a/contrib/src/stc/scintilla/src/SVector.h +++ b/contrib/src/stc/scintilla/src/SVector.h @@ -15,18 +15,18 @@ */ class SVector { enum { allocSize = 4000 }; - + int *v; ///< The vector unsigned int size; ///< Number of elements allocated unsigned int len; ///< Number of elements used in vector bool allocFailure; ///< A memory allocation call has failed - + /** Internally allocate more elements than the user wants * to avoid thrashing the memory allocator. */ void SizeTo(int newSize) { if (newSize < allocSize) newSize += allocSize; - else + else newSize = (newSize * 3) / 2; int* newv = new int[newSize]; if (!newv) { @@ -44,7 +44,7 @@ class SVector { delete []v; v = newv; } - + public: SVector() { allocFailure = false; diff --git a/contrib/src/stc/scintilla/src/ScintillaBase.cxx b/contrib/src/stc/scintilla/src/ScintillaBase.cxx index ea2e2d1d6d..039539ad3c 100644 --- a/contrib/src/stc/scintilla/src/ScintillaBase.cxx +++ b/contrib/src/stc/scintilla/src/ScintillaBase.cxx @@ -203,11 +203,11 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { pdoc->DeleteChars(currentPos, lenEntered); SetEmptySelection(currentPos); pdoc->InsertString(currentPos, list); - SetEmptySelection(currentPos + strlen(list)); + SetEmptySelection(currentPos + static_cast(strlen(list))); } else { SetEmptySelection(currentPos); pdoc->InsertString(currentPos, list + lenEntered); - SetEmptySelection(currentPos + strlen(list + lenEntered)); + SetEmptySelection(currentPos + static_cast(strlen(list + lenEntered))); } return; } @@ -340,7 +340,7 @@ void ScintillaBase::AutoCompleteCompleted() { if (item != -1) { SString piece = selected; pdoc->InsertString(firstPos, piece.c_str()); - SetEmptySelection(firstPos + piece.length()); + SetEmptySelection(firstPos + static_cast(piece.length())); } pdoc->EndUndoAction(); } @@ -557,7 +557,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara return ac.GetTypesep(); case SCI_CALLTIPSHOW: - CallTipShow(LocationFromPosition(wParam), + CallTipShow(LocationFromPosition(wParam), reinterpret_cast(lParam)); break; diff --git a/contrib/src/stc/scintilla/src/ScintillaBase.h b/contrib/src/stc/scintilla/src/ScintillaBase.h index bf0b92d57d..bb09e3f5b3 100644 --- a/contrib/src/stc/scintilla/src/ScintillaBase.h +++ b/contrib/src/stc/scintilla/src/ScintillaBase.h @@ -43,7 +43,7 @@ protected: int lexLanguage; const LexerModule *lexCurrent; PropSet props; - enum {numWordLists=9}; + enum {numWordLists=KEYWORDSET_MAX+1}; WordList *keyWordLists[numWordLists+1]; void SetLexer(uptr_t wParam); void SetLexerLanguage(const char *languageName); diff --git a/contrib/src/stc/scintilla/src/Style.cxx b/contrib/src/stc/scintilla/src/Style.cxx index 40a8dba6a4..c37bcac900 100644 --- a/contrib/src/stc/scintilla/src/Style.cxx +++ b/contrib/src/stc/scintilla/src/Style.cxx @@ -67,8 +67,8 @@ Style &Style::operator=(const Style &source) { void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_, const char *fontName_, int characterSet_, - bool bold_, bool italic_, bool eolFilled_, - bool underline_, ecaseForced caseForce_, + bool bold_, bool italic_, bool eolFilled_, + bool underline_, ecaseForced caseForce_, bool visible_, bool changeable_, bool hotspot_) { fore.desired = fore_; back.desired = back_; @@ -102,7 +102,7 @@ void Style::ClearTo(const Style &source) { source.eolFilled, source.underline, source.caseForce, - source.visible, + source.visible, source.changeable, source.hotspot); } diff --git a/contrib/src/stc/scintilla/src/Style.h b/contrib/src/stc/scintilla/src/Style.h index 2f1e575860..6ee930b6bb 100644 --- a/contrib/src/stc/scintilla/src/Style.h +++ b/contrib/src/stc/scintilla/src/Style.h @@ -44,8 +44,8 @@ public: void Clear(ColourDesired fore_, ColourDesired back_, int size_, const char *fontName_, int characterSet_, - bool bold_, bool italic_, bool eolFilled_, - bool underline_, ecaseForced caseForce_, + bool bold_, bool italic_, bool eolFilled_, + bool underline_, ecaseForced caseForce_, bool visible_, bool changeable_, bool hotspot_); void ClearTo(const Style &source); bool EquivalentFontTo(const Style *other) const; diff --git a/contrib/src/stc/scintilla/src/WindowAccessor.cxx b/contrib/src/stc/scintilla/src/WindowAccessor.cxx index d70ddf5c34..ce42534e7b 100644 --- a/contrib/src/stc/scintilla/src/WindowAccessor.cxx +++ b/contrib/src/stc/scintilla/src/WindowAccessor.cxx @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include "Platform.h" @@ -24,7 +24,7 @@ bool WindowAccessor::InternalIsLeadByte(char ch) { if (SC_CP_UTF8 == codePage) // For lexing, all characters >= 0x80 are treated the // same so none is considered a lead byte. - return false; + return false; else return Platform::IsDBCSLeadByte(codePage, ch); } @@ -71,10 +71,10 @@ int WindowAccessor::LevelAt(int line) { return Platform::SendScintilla(id, SCI_GETFOLDLEVEL, line, 0); } -int WindowAccessor::Length() { - if (lenDoc == -1) +int WindowAccessor::Length() { + if (lenDoc == -1) lenDoc = Platform::SendScintilla(id, SCI_GETTEXTLENGTH, 0, 0); - return lenDoc; + return lenDoc; } int WindowAccessor::GetLineState(int line) { @@ -125,7 +125,7 @@ void WindowAccessor::Flush() { startPos = extremePosition; lenDoc = -1; if (validLen > 0) { - Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen, + Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen, styleBuf); validLen = 0; } @@ -134,12 +134,12 @@ void WindowAccessor::Flush() { int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { int end = Length(); int spaceFlags = 0; - - // Determines the indentation level of the current line and also checks for consistent + + // Determines the indentation level of the current line and also checks for consistent // indentation compared to the previous line. - // Indentation is judged consistent when the indentation whitespace of each line lines + // Indentation is judged consistent when the indentation whitespace of each line lines // the same or the indentation of one line is a prefix of the other. - + int pos = LineStart(line); char ch = (*this)[pos]; int indent = 0; @@ -166,7 +166,7 @@ int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsC } ch = (*this)[++pos]; } - + *flags = spaceFlags; indent += SC_FOLDLEVELBASE; // if completely empty line or the start of a comment... diff --git a/contrib/src/stc/scintilla/src/XPM.cxx b/contrib/src/stc/scintilla/src/XPM.cxx index c4e4f888ef..c3f66c2e40 100644 --- a/contrib/src/stc/scintilla/src/XPM.cxx +++ b/contrib/src/stc/scintilla/src/XPM.cxx @@ -49,7 +49,7 @@ void XPM::FillRun(Surface *surface, int code, int startX, int y, int x) { } } -XPM::XPM(const char *textForm) : +XPM::XPM(const char *textForm) : data(0), codes(0), colours(0), lines(0) { Init(textForm); } @@ -102,7 +102,7 @@ void XPM::Init(const char * const *linesForm) { int strings = 1+height+nColours; lines = new char *[strings]; - int allocation = 0; + size_t allocation = 0; for (int i=0; iDoPaint(&dc, GetUpdateRegion().GetBox()); } @@ -2179,7 +2179,7 @@ void wxStyledTextCtrl::OnScroll(wxScrollEvent& evt) { } } -void wxStyledTextCtrl::OnSize(wxSizeEvent& evt) { +void wxStyledTextCtrl::OnSize(wxSizeEvent& WXUNUSED(evt)) { wxSize sz = GetClientSize(); m_swx->DoSize(sz.x, sz.y); } @@ -2257,9 +2257,10 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) { int key = evt.GetKeyCode(); bool shift = evt.ShiftDown(), ctrl = evt.ControlDown(), - alt = evt.AltDown(); + alt = evt.AltDown(), + meta = evt.MetaDown(); - int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, &m_lastKeyDownConsumed); + int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, meta, &m_lastKeyDownConsumed); // printf("KeyDn key:%d shift:%d ctrl:%d alt:%d processed:%d consumed:%d\n", // key, shift, ctrl, alt, processed, m_lastKeyDownConsumed); @@ -2269,22 +2270,22 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) { } -void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) { +void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& WXUNUSED(evt)) { m_swx->DoLoseFocus(); } -void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) { +void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& WXUNUSED(evt)) { m_swx->DoGainFocus(); } -void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& evt) { +void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(evt)) { m_swx->DoSysColourChange(); } -void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& evt) { +void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) { // do nothing to help avoid flashing } @@ -2295,7 +2296,7 @@ void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) { } -void wxStyledTextCtrl::OnListBox(wxCommandEvent& evt) { +void wxStyledTextCtrl::OnListBox(wxCommandEvent& WXUNUSED(evt)) { m_swx->DoOnListBox(); } diff --git a/contrib/src/stc/stc.cpp.in b/contrib/src/stc/stc.cpp.in index c339d40d8f..be24cc98f7 100644 --- a/contrib/src/stc/stc.cpp.in +++ b/contrib/src/stc/stc.cpp.in @@ -362,7 +362,7 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename) //---------------------------------------------------------------------- // Event handlers -void wxStyledTextCtrl::OnPaint(wxPaintEvent& evt) { +void wxStyledTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) { wxPaintDC dc(this); m_swx->DoPaint(&dc, GetUpdateRegion().GetBox()); } @@ -384,7 +384,7 @@ void wxStyledTextCtrl::OnScroll(wxScrollEvent& evt) { } } -void wxStyledTextCtrl::OnSize(wxSizeEvent& evt) { +void wxStyledTextCtrl::OnSize(wxSizeEvent& WXUNUSED(evt)) { wxSize sz = GetClientSize(); m_swx->DoSize(sz.x, sz.y); } @@ -462,9 +462,10 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) { int key = evt.GetKeyCode(); bool shift = evt.ShiftDown(), ctrl = evt.ControlDown(), - alt = evt.AltDown(); + alt = evt.AltDown(), + meta = evt.MetaDown(); - int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, &m_lastKeyDownConsumed); + int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, meta, &m_lastKeyDownConsumed); // printf("KeyDn key:%%d shift:%%d ctrl:%%d alt:%%d processed:%%d consumed:%%d\n", // key, shift, ctrl, alt, processed, m_lastKeyDownConsumed); @@ -474,22 +475,22 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) { } -void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) { +void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& WXUNUSED(evt)) { m_swx->DoLoseFocus(); } -void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) { +void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& WXUNUSED(evt)) { m_swx->DoGainFocus(); } -void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& evt) { +void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(evt)) { m_swx->DoSysColourChange(); } -void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& evt) { +void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) { // do nothing to help avoid flashing } @@ -500,7 +501,7 @@ void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) { } -void wxStyledTextCtrl::OnListBox(wxCommandEvent& evt) { +void wxStyledTextCtrl::OnListBox(wxCommandEvent& WXUNUSED(evt)) { m_swx->DoOnListBox(); } diff --git a/contrib/src/stc/stc.h.in b/contrib/src/stc/stc.h.in index e1c17422a1..c120c728d4 100644 --- a/contrib/src/stc/stc.h.in +++ b/contrib/src/stc/stc.h.in @@ -65,6 +65,7 @@ //----------------------------------------- // Commands that can be bound to keystrokes + %(CMDS)s diff --git a/samples/stc/Makefile.sc b/samples/stc/Makefile.sc index 348c34e07a..66685e085a 100644 --- a/samples/stc/Makefile.sc +++ b/samples/stc/Makefile.sc @@ -1,6 +1,6 @@ #Makefile from wxHatch for Symantec/Digital Mars compiler WXDIR=..\..\.. TARGET=stctest -OBJECTS = $(TARGET).obj +OBJECTS = $(TARGET).obj edit.obj prefs.obj EXTRALIBS=$(WXDIR)\lib\stc_sc.lib include $(WXDIR)\src\makeprog.sc diff --git a/samples/stc/StcTestVC.dsp b/samples/stc/StcTestVC.dsp index b1600f1145..3f660bd692 100644 --- a/samples/stc/StcTestVC.dsp +++ b/samples/stc/StcTestVC.dsp @@ -167,6 +167,14 @@ SOURCE=.\stctest.cpp # End Source File # Begin Source File +SOURCE=.\edit.cpp +# End Source File +# Begin Source File + +SOURCE=.\prefs.cpp +# End Source File +# Begin Source File + SOURCE=.\stctest.rc # ADD BASE RSC /l 0x809 # ADD RSC /l 0x809 /i "../../../include" /i "../../../contrib/include" diff --git a/samples/stc/makefile.b32 b/samples/stc/makefile.b32 index 46a0651cef..b4c8c55fae 100644 --- a/samples/stc/makefile.b32 +++ b/samples/stc/makefile.b32 @@ -12,7 +12,7 @@ WXDIR = $(WXWIN) TARGET=stctest EXTRALIBS=$(WXDIR)\lib\stc.lib -OBJECTS = $(TARGET).obj +OBJECTS = $(TARGET).obj edit.obj prefs.obj !include $(WXDIR)\src\makeprog.b32 diff --git a/samples/stc/makefile.g95 b/samples/stc/makefile.g95 index 9c8a7efe29..59cb05835a 100644 --- a/samples/stc/makefile.g95 +++ b/samples/stc/makefile.g95 @@ -6,7 +6,7 @@ WXDIR = ../../.. TARGET = stctest -OBJECTS = $(TARGET).o +OBJECTS = $(TARGET).o edit.o prefs.o EXTRAINC = -I$(WXDIR)/contrib/include EXTRALIBS = -lstc diff --git a/src/stc/StcVC.dsp b/src/stc/StcVC.dsp index 1587293631..7748801450 100644 --- a/src/stc/StcVC.dsp +++ b/src/stc/StcVC.dsp @@ -370,6 +370,22 @@ SOURCE=.\scintilla\src\LexVB.cxx # End Source File # Begin Source File +SOURCE=.\scintilla\src\LexMMIXAL.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexNsis.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexPS.cxx +# End Source File +# Begin Source File + +SOURCE=.\scintilla\src\LexScriptol.cxx +# End Source File +# Begin Source File + SOURCE=.\scintilla\src\LineMarker.cxx # End Source File # Begin Source File diff --git a/src/stc/makefile.b32 b/src/stc/makefile.b32 index 6ce6044a8b..e3f505d7b7 100644 --- a/src/stc/makefile.b32 +++ b/src/stc/makefile.b32 @@ -58,6 +58,10 @@ OBJECTS = \ LexRuby.obj \ LexSQL.obj \ LexVB.obj \ + LexMMIXAL.obj \ + LexNsis.obj \ + LexPS.obj \ + LexScriptol.obj \ LineMarker.obj \ PropSet.obj \ RESearch.obj \ @@ -68,7 +72,6 @@ OBJECTS = \ ViewStyle.obj \ WindowAccessor.obj \ XPM.obj \ - \ PlatWX.obj \ ScintillaWX.obj \ stc.obj \ diff --git a/src/stc/makefile.g95 b/src/stc/makefile.g95 index 6f23b518da..94c3275ac2 100644 --- a/src/stc/makefile.g95 +++ b/src/stc/makefile.g95 @@ -46,6 +46,10 @@ OBJECTS = \ $(S)/LexRuby.$(OBJSUFF) \ $(S)/LexSQL.$(OBJSUFF) \ $(S)/LexVB.$(OBJSUFF) \ + $(S)/LexMMIXAL.$(OBJSUFF) \ + $(S)/LexNsis.$(OBJSUFF) \ + $(S)/LexPS.$(OBJSUFF) \ + $(S)/LexScriptol.$(OBJSUFF) \ $(S)/LineMarker.$(OBJSUFF) \ $(S)/PropSet.$(OBJSUFF) \ $(S)/RESearch.$(OBJSUFF) \ diff --git a/src/stc/makefile.sc b/src/stc/makefile.sc index ea9ffcc9c6..10461dc1f0 100644 --- a/src/stc/makefile.sc +++ b/src/stc/makefile.sc @@ -5,7 +5,7 @@ S=$(SCINTILLA)\src EXTRASTCCPPFLAGS = -D__WX__ -DSCI_LEXER -DLINK_LEXERS -I$(SCINTILLA)/include -I$(S) EXTRACPPFLAGS=$(EXTRACPPFLAGS) $(EXTRASTCCPPFLAGS) -STCCPPFLAGS=$(DLL_FLAGS) $(EXTRACPPFLAGS) +STCCPPFLAGS=$(DLL_FLAGS) $(EXTRACPPFLAGS) include $(WXDIR)\src\makesc.env LIBTARGET=$(WXDIR)\lib\stc$(SC_SUFFIX).lib @@ -52,6 +52,10 @@ OBJECTS = \ $(S)\LexRuby.obj \ $(S)\LexSQL.obj \ $(S)\LexVB.obj \ + $(S)\LexMMIXAL.obj \ + $(S)\LexNsis.obj \ + $(S)\LexPS.obj \ + $(S)\LexScriptol.obj \ $(S)\LineMarker.obj \ $(S)\PropSet.obj \ $(S)\RESearch.obj \ diff --git a/src/stc/makefile.vc b/src/stc/makefile.vc index 22d7e750d1..b61df3fb00 100644 --- a/src/stc/makefile.vc +++ b/src/stc/makefile.vc @@ -51,6 +51,10 @@ OBJECTS = \ $(D)\LexRuby.obj \ $(D)\LexSQL.obj \ $(D)\LexVB.obj \ + $(D)\LexMMIXAL.obj \ + $(D)\LexNsis.obj \ + $(D)\LexPS.obj \ + $(D)\LexScriptol.obj \ $(D)\LineMarker.obj \ $(D)\PropSet.obj \ $(D)\RESearch.obj \ diff --git a/src/stc/makefile.wat b/src/stc/makefile.wat index eb568c1575..5f4122dce6 100644 --- a/src/stc/makefile.wat +++ b/src/stc/makefile.wat @@ -55,6 +55,10 @@ OBJECTS = & LexRuby.obj & LexSQL.obj & LexVB.obj & + LexMMIXAL.obj & + LexNsis.obj & + LexPS.obj & + LexScriptol.obj & LineMarker.obj & PropSet.obj & RESearch.obj &