Compare commits

...

249 Commits

Author SHA1 Message Date
Bryan Petty
6b943ffcaa This commit was manufactured by cvs2svn to create tag 'wxPy_2_3_2b5'.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/tags/wxPy_2_3_2b5@11841 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-10-04 20:46:47 +00:00
Robin Dunn
74b1c2658a fixed compilation errors
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11711 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-27 06:07:14 +00:00
Robin Dunn
ecc08ead91 Various updates, changes for wxTopLevelWindow, fixes for
wxPen.SetDashes, etc.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11710 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-27 02:11:47 +00:00
Robin Dunn
34a1d7328f Added MSW toplevel.cpp and regenerated makefiles and such.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11709 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-27 02:05:45 +00:00
Robin Dunn
c8bc33d5b5 If a shape has client data, it deletes it when the shape is deleted.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11708 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-27 02:04:19 +00:00
Robin Dunn
5bf2abe348 Fixed compilation error
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11707 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-27 02:02:44 +00:00
Robin Dunn
361128cbf7 Added missing WXDLLEXPORT
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11706 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-27 02:02:19 +00:00
Robin Dunn
edd971741e Fixed problem with wxPen::SetDashes. (An array of bytes was typcast
to an array of DWORDs.)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11705 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-27 00:35:24 +00:00
Robin Dunn
217cb2fab8 Add some Pen dashes tests
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11704 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-27 00:27:46 +00:00
Václav Slavík
12bba77343 removed wxBusyCursorSuspender use
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11703 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-26 22:21:42 +00:00
Václav Slavík
9b9cab370f temporary stubs for fullscreen functions
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11702 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-26 22:18:43 +00:00
Václav Slavík
134677bde9 Use wxGetInstallPrefix() instead of wxINSTALL_PREFIX (makes relocatable packages possible)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11701 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-26 22:17:05 +00:00
Václav Slavík
c8e8ae85c8 oops, forgot do add fullscreen stuff to wxTLWBase
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11700 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-26 22:10:42 +00:00
Vadim Zeitlin
bcbf288197 reverted last accidental commit, added comment about About item being special under Mac, use _T() around the literal strings
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11699 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-26 13:11:40 +00:00
Vadim Zeitlin
c50536396d compilation fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11698 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-26 12:56:38 +00:00
Vadim Zeitlin
2e9f62dafb compilation/build fixes for wxUniv
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11697 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-26 00:47:52 +00:00
Vadim Zeitlin
55fb2c6cc2 compilation fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11696 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-25 14:34:29 +00:00
Vadim Zeitlin
f427e0d634 compilation fix for other (than GTK/MSW) ports
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11695 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-25 14:33:50 +00:00
Vadim Zeitlin
8191741f68 pass correct key code in TREE_KEY_DOWN event
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11694 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-24 22:52:18 +00:00
David Webster
75ad8febf6 patch fix for a constant definition under OS/2 VA V4.0
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-24 19:17:16 +00:00
Vadim Zeitlin
23d8bb2c66 fixed wxUniv menus under wxGTK
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11692 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-24 18:46:54 +00:00
Vadim Zeitlin
b231914f6a added workaround for GTK+ focus_out bug (and removed Vaclav's mouse capture stack - sorry!)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11691 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-24 18:46:13 +00:00
Václav Slavík
cc1e14d625 implemented captured windows stack
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11690 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-24 18:02:11 +00:00
Václav Slavík
d08e6e59ed statusbar handling
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11689 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-24 18:01:13 +00:00
Mattia Barbon
37d0bdff98 Fixed wxToolbar95::FindToolForPosition
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-24 17:30:42 +00:00
Vadim Zeitlin
b09bda689c added wxTreeEvent::GetKeyEvent() to allow to retrieve the key event flags from EVT_TREE_KEY_DOWN event
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11687 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-24 16:39:49 +00:00
Vadim Zeitlin
82c9f85ce5 added wxTLW for MSW
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11685 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-24 00:34:14 +00:00
Vadim Zeitlin
c2fd78b10f ~wxToolBar() checks if the frame is being deleted in a better/more clear way
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11684 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-24 00:16:48 +00:00
Václav Slavík
24a23c3573 partial implementation of wxTLW's decorations
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11683 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-23 22:42:57 +00:00
Václav Slavík
038072e2f1 better learn the operators...
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11682 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-23 22:38:25 +00:00
Václav Slavík
e6adf05834 fixed serious bug in wxFont::operator== (ignored weight)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11681 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-23 22:37:42 +00:00
Václav Slavík
db0aec831d added wxBitmap::CopyFromIcon to wxGTK
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11680 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-23 22:36:17 +00:00
Vadim Zeitlin
fb1a41cd75 reverted change to the best checkbox size calculation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11679 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-23 22:04:05 +00:00
David Webster
9e9140114e Latest OS/2 build file updates to include the toplevel stuff.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11678 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-23 18:36:45 +00:00
David Webster
d50d561a05 FALSE, not false
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11677 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-23 18:34:35 +00:00
Mattia Barbon
a8945eeff6 * Fixed wxToolbar95 and wxToolbarGTK to emit TOOL_ENTER event with id==-1 when the mouse
leaves a tool.
* Fixed wxToolbar95::FindToolForPosition to take into account dummy spacers inserted
  together with a control for comctl32.dll versions < 4.71


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11676 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-23 15:38:01 +00:00
Mattia Barbon
a8bf5281df Forgot to update the template.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11675 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-23 15:28:07 +00:00
Vadim Zeitlin
79c3b7b216 fixed yet another bug in wxRegConfig::SetPath() - SetPath(../..) didn't work
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11673 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-22 23:23:04 +00:00
Václav Slavík
5b60dec5c1 oops, we definitely DON'T want to reset m_renderer here
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11672 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-22 22:39:29 +00:00
Václav Slavík
21f4383ae7 wxTOPLEVEL_EX_DIALOG is a better name than wxTLW_EX_DIALOG
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11671 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-22 22:39:03 +00:00
Václav Slavík
f819b4a3ab evaluate window style in Create, not later
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11670 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-22 22:38:02 +00:00
Václav Slavík
c981cbe951 configure now defines _WIN_IE if w32api is at least 1.1 (1.0 is not complete enough for wxWin)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11669 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-22 16:17:09 +00:00
Václav Slavík
38189fd599 mingw compilation fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11668 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-22 16:15:45 +00:00
Václav Slavík
5145e34f09 w32api 1.1 support
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11667 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-22 16:15:28 +00:00
Václav Slavík
67e49a98bb wxInputConsumer
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11666 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-22 12:04:47 +00:00
Václav Slavík
a9152a05f8 fixed client area handling for wxFrame/Univ
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11665 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-22 11:56:23 +00:00
Václav Slavík
23645bfa01 wxInputConsumer
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11664 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-22 11:56:04 +00:00
Václav Slavík
d6eaea2845 (blind) fix for wxMotif compilation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11663 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-22 11:52:48 +00:00
Václav Slavík
98ffddb1db added wxInputConsumer to wxUniv
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11662 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-22 00:21:41 +00:00
Mattia Barbon
4693b20c75 Unicode compilation fixes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11661 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-21 20:21:44 +00:00
Stefan Csomor
eb71219dd0 added wxSTD macro
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-21 05:43:21 +00:00
Mattia Barbon
e1b435afad wxTextDataObject now uses Unicode if compiled with wxUSE_UNICODE.
Fixed wxURLDataObject in MSW.
Added GetSizeFromBuffer, SetSizeInBuffer, GetBufferOffset to wxDataObject
 as per Vadim's suggestion.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-21 00:58:32 +00:00
Mattia Barbon
e355628241 Make easier to compile with MSVC5.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11658 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-20 22:10:00 +00:00
Mattia Barbon
b72a54d1a5 MinGW compilation fix.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11657 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-20 22:08:10 +00:00
Mattia Barbon
f63e248ec1 Unicode compilation fixes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-20 22:07:21 +00:00
Mattia Barbon
b2a9ee3025 Re-enabled long long for MinGW.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11655 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-20 22:05:28 +00:00
Vadim Zeitlin
dd4f7467b2 fix for shared library build under SGI with native compiler
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11654 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-20 19:28:20 +00:00
Robin Dunn
6ee2116be1 bug #463146
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11653 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-20 16:32:33 +00:00
Václav Slavík
b9f2926155 fixes to client area origin handling
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11652 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-19 22:45:14 +00:00
Václav Slavík
0cecad314c fixed problems with HTML printing w/o using wxHtmlWindow
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11651 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-19 22:44:17 +00:00
Vadim Zeitlin
297e4185cc better fix for MIPSpro warnings: removed unneeded calls to floor()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11649 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-19 16:47:23 +00:00
Vadim Zeitlin
11e82c1ba3 compilation fixes for MIPSpro SGI compiler
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11648 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-19 16:06:20 +00:00
Jouk Jansen
e752575a1f Committing in .
Modified Files:
 	wxWindows/src/common/descrip.mms wxWindows/src/gtk/descrip.mms

 Update of OpenVMS makefile.
----------------------------------------------------------------------


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11647 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-19 08:51:31 +00:00
Václav Slavík
c5257cab15 regenerated
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11646 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-18 22:50:22 +00:00
Václav Slavík
0f1bf77d3d partial implementation of wxTopLevelWindow for wXUniv
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11645 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-18 22:37:08 +00:00
Václav Slavík
a200c35efa moved AdjustToClientAreaOrigin to wxWindowBase, needed worldwide for wxUniv
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11644 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-18 22:36:18 +00:00
Václav Slavík
45eb404791 wxUniversal doesn't need wxDialog and wxFrame from base port anymore
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11643 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-18 22:34:23 +00:00
Václav Slavík
19008b7bb8 made wxLocalFSHandler public and added Chroot to it
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11642 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-18 22:34:10 +00:00
Václav Slavík
d9d4df0e42 minor changes to wxFrame/Univ
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11641 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-18 22:33:54 +00:00
Václav Slavík
b85a6d855b wxFrame for wxUniv
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11640 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-18 22:33:48 +00:00
Václav Slavík
0e0de6b8aa wxDialog for wxUniv
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11639 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-18 22:33:38 +00:00
Gilles Depeyrot
563c260640 corrections related to wxDialog inheritance changes (wxTopLevelWindow)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11638 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-18 21:00:05 +00:00
Vadim Zeitlin
1d8dd65e62 compilation warning fix for Intel C++
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11637 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-18 18:22:44 +00:00
Vadim Zeitlin
55e80573e2 changes to shared library options code and to allow building them with Intel compiler
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11636 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-18 18:17:11 +00:00
Robin Dunn
d28516c7c4 version number update
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11634 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-18 16:10:49 +00:00
Vadim Zeitlin
8db6ac55e6 test for long long directly instead of testing for gcc
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11633 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-18 15:03:00 +00:00
George Tasker
8a46f0a21d Fix for bug 462533, spelling typo in docs "wxAGJUST_MIN" should be "wxADJUST_MINSIZE"
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11632 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-18 13:28:34 +00:00
Vadim Zeitlin
993cfa8757 fix for event processing in wxScrollHelper
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11631 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-18 12:39:18 +00:00
Ron Lee
85d4fc42e9 use 'local' quoting for wx headers in lib source
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11630 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-17 23:30:57 +00:00
Ron Lee
ae332f7c0a fixed c++ style comments
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11629 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-17 23:12:47 +00:00
Robin Dunn
401d3cc731 minor fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11628 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-17 22:42:20 +00:00
Robin Dunn
ce32af5d96 Regenerated from filelist.txt
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11627 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-17 22:20:28 +00:00
Robin Dunn
cefd71d783 Fixed compile error.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11626 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-17 22:08:35 +00:00
Robin Dunn
059a841c96 Significantly changed how the Python interpreter lock and thread state
are managed, which should fix the problem of running on a
multi-processor machine.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11625 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-17 21:47:20 +00:00
Gilles Depeyrot
80823340ab added missing destructor for Darwin/Mac OS X (wxGtk, wxMotif, wxMac)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11624 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-17 20:37:33 +00:00
Stefan Csomor
bd2aeb7ab6 added carbonaccessors.o
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11623 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-17 19:53:32 +00:00
Stefan Csomor
6dbaf73491 added toplvlcmn
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11622 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-17 19:51:31 +00:00
Ron Lee
0cefee80e7 added tn0012.txt -- detailing library name conventions as discussed
on -dev


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11621 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-17 04:56:32 +00:00
Václav Slavík
97c70a028e added toplevel.cpp
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11619 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-16 22:10:21 +00:00
Václav Slavík
faac85bf09 updated generated file
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-16 22:09:49 +00:00
Robin Dunn
19a97bd6f9 Significantly changed how the Python interpreter lock and thread state
are managed, which should fix the problem of running on a
multi-processor machine.

Some fixes for some of the contributed library modules.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11614 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-16 01:51:13 +00:00
Václav Slavík
72fa862b04 wxMGL update
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11613 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-15 22:13:20 +00:00
Václav Slavík
7d9f12f3b9 wxTopLevelWindow (only for wxGTK for now)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11612 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-15 22:13:08 +00:00
Stefan Csomor
280df08533 changed FindControl to FindControlUnderMouse and use ControlRef != NULL instead of ControlPart = noPart , we had false ControlPart = 0 returned under Carbon in MacOS X
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11611 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-15 20:39:46 +00:00
Václav Slavík
244531bc96 compilation (hot)fixes for Mingw
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11607 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-15 10:39:22 +00:00
Václav Slavík
210e3a3a50 compilation fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11606 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-15 10:39:10 +00:00
Robin Dunn
ce68e8d061 Updates to contributed library stuff, a new version of PyCrust
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-14 16:15:46 +00:00
Robin Dunn
a3fbed81b2 A better way to handle the OOR wxPyListCtrl --> wxLIstCtrl thing
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11601 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-14 16:14:56 +00:00
Robin Dunn
b1cfebd9f4 some little demo tweaks
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11600 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-14 16:13:57 +00:00
Gilles Depeyrot
3f288b12cc added missing object files (sorted alphabetically for easier updating)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11595 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-12 19:38:04 +00:00
Gilles Depeyrot
ec8ecff48c added missing object files
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11594 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-12 19:15:04 +00:00
Gilles Depeyrot
87445c2f5c corrected aggregate initializer
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11593 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-12 18:56:23 +00:00
Gilles Depeyrot
1f603d3d9e removed inexistant object file
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11592 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-12 18:41:36 +00:00
Vadim Zeitlin
a4a6984d5e don't try to translate the standard encoding names
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11591 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-11 17:04:41 +00:00
Robin Dunn
9968ba85be Removed font point size adjustment since wxWindows already does it.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11590 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-10 21:57:26 +00:00
Gilles Depeyrot
d11ec3df93 added missing defines
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-10 20:44:10 +00:00
Vadim Zeitlin
3ad252c96a VC++ compilation fix (hopefully)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11588 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-10 10:43:50 +00:00
Gilles Depeyrot
610c6dedc1 added CodeWarrior 5 project
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11587 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-09 22:26:44 +00:00
Gilles Depeyrot
89ce51d52e updated helper for changing types/creators of files based on the file extension
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11586 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-09 22:23:35 +00:00
Gilles Depeyrot
f36e7ad877 added dependency handling
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11585 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-09 22:14:54 +00:00
Gilles Depeyrot
af2c734bc4 added dependency handling
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11584 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-09 18:06:52 +00:00
Gilles Depeyrot
b57b228b84 getpid is in unistd.h under Solaris, Linux, FreeBSD and Darwin
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11583 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-09 18:06:25 +00:00
Gilles Depeyrot
faed65f610 added dependency handling
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11582 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-09 17:58:35 +00:00
Gilles Depeyrot
0ad0dc5760 added virtual destructor (for Mac OS X)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11581 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-09 17:58:11 +00:00
Gilles Depeyrot
8252c9ca38 use wxBitmapType instead of int
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11580 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-09 17:57:31 +00:00
Gilles Depeyrot
52b5ab7edc use wxBitmapType instead of int
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11579 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-09 17:42:06 +00:00
Gilles Depeyrot
84553c516c corrected files.lst path which is in src dir and not in build dir
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11578 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-09 17:40:38 +00:00
Gilles Depeyrot
a0bb22c231 renamed CodeWarrior 5 projects (added new ones as well)
added CarbonAccessors.o to Classic targets
corrected link warnings/errors in Carbon targets


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11577 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-09 17:38:00 +00:00
Vadim Zeitlin
e72aa7f5ac wxUniv compilation fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11576 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-09 11:56:33 +00:00
Václav Slavík
88dcf47c56 oops, HTML entities were parsed twice
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11575 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-08 22:39:06 +00:00
Gilles Depeyrot
7335c5a588 corrected creation of wxWizard (wxWizardBase::Create class function is
hidden by wxWizard::Create object method)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11574 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-08 19:15:26 +00:00
Gilles Depeyrot
70c1945c6a renamed CodeWarrior 5 projects
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-08 11:50:21 +00:00
Kendall Bennett
505710ca37 Merged in latest wxApplet code from SciTech Perforce tree.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11572 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-07 20:08:05 +00:00
Robin Dunn
cdf14688f5 Fixed an OOR related bug that happened when a class has been renamed.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11571 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-07 16:28:24 +00:00
Robin Dunn
431f4c161d Added pySketch sample
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11570 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-06 21:19:48 +00:00
Vadim Zeitlin
651d7a1ff8 set mouse position for COL_CLICK event
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11569 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-06 20:07:32 +00:00
Julian Smart
a23c00470e Added simple UNIX implementation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11568 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-06 19:27:52 +00:00
Gilles Depeyrot
977bf6ff42 removed copystring function already defined in common wx utilities
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11567 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-06 19:14:46 +00:00
Gilles Depeyrot
58782f84f8 replaced CPPFLAGS with CXXFLAGS following corrections in auto-configuration
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11566 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-06 19:07:57 +00:00
Vadim Zeitlin
59078e629d applied patch from Xavier Nodet implementing better handling of subexpressions array in wxRegEx
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11565 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-06 17:21:00 +00:00
Julian Smart
567f21d2cd Doc edits to fix formatting problems in Word/PDF
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11564 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-06 15:04:23 +00:00
Julian Smart
8d07927991 Small changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11563 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-06 12:09:24 +00:00
Julian Smart
97f1fb1987 Cured a bug in wxSplashScreen whereby frame wasn't sized correctly,
because SetClientSize doesn't seem to work right unless you pass a reasonable
size to the frame constructor.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11561 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-05 10:33:43 +00:00
Robin Dunn
fea018f801 A couple little fixes for wxSTC
Updated to 0.6 of PyCrust


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11560 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-04 23:44:17 +00:00
Robin Dunn
8de28db94f A couple little fixes for wxSTC
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11559 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-04 23:42:13 +00:00
Jouk Jansen
33381c829b Committing in .
Modified Files:
 	wxWindows/setup.h_vms wxWindows/src/common/descrip.mms

 Update of VMS compile support

 ----------------------------------------------------------------------


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11558 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-04 09:38:11 +00:00
Robin Dunn
1edab6e3d8 more little tweaks
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11556 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-04 06:35:05 +00:00
Robin Dunn
3ae53c3153 little tweaks
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11555 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-04 06:00:45 +00:00
Robin Dunn
6d8b4f8d2b Added wxNativeFontInfo and wxFontMapper.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11554 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-04 05:00:15 +00:00
Robin Dunn
53fe40bac2 Added more contribs from Lorne White, and updated some of the existing ones.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11553 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-04 04:17:38 +00:00
Robin Dunn
ddcb3d8378 Added wxGenBitmapTextButton contrib from Lorne White.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11552 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-03 23:23:47 +00:00
Václav Slavík
93cd80d63c forgot to commit some XRC files
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11551 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-03 23:07:23 +00:00
Robin Dunn
4309759886 Updated wxColumnSorterMixin to also be able to place sort icons on the
column headers, and updated the wxListCtrl demo to show it off by
using wxColumnSorterMixin.

Other odds and ends...


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11550 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-03 22:47:34 +00:00
Robin Dunn
6d19860fe8 Updated wxColumnSorterMixin to also be able to place sort icons on the
column headers, and updated the wxListCtrl demo to show it off by
using wxColumnSorterMixin.

Other odds and ends...


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11549 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-03 22:41:18 +00:00
Vadim Zeitlin
0188c70233 added Set/ClearColumnImage() helpers to wxListView
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11548 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-03 16:57:16 +00:00
Vadim Zeitlin
0a816d9581 implemented column images for the generic version
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11547 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-03 15:09:56 +00:00
Vadim Zeitlin
6f806543a4 added support for column images under MSW
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11546 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-02 23:47:42 +00:00
Václav Slavík
5707316c9c applied utf-8 fix patch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11545 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-02 22:44:00 +00:00
Václav Slavík
f3d6a60294 added id handling to html cells
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11544 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-02 20:07:45 +00:00
Václav Slavík
50da928bbd added id handling to image cells
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11543 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-02 20:07:35 +00:00
Václav Slavík
8938133dbc added wxHtmlCell::Get/SetId
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11542 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-02 20:07:25 +00:00
Václav Slavík
d168485fcf comment clarification
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11541 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-02 20:07:13 +00:00
Robin Dunn
949853a49c Added AssignImageList to wxNotebook
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11540 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-02 00:55:17 +00:00
Václav Slavík
dafa49256d fix for wxStatusBar wrongly reporting field rects inside EVT_SIZE handler
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11539 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-01 21:47:49 +00:00
Václav Slavík
0b52d3cf4d mingw compilation fix, added some defines
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11538 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-01 21:47:29 +00:00
Václav Slavík
dcbd7ce2d7 compilation fix for mingw
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11537 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-01 21:47:13 +00:00
Václav Slavík
0beefa20dc fixed memory leaks when parsing
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11536 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-01 12:59:41 +00:00
Václav Slavík
06069dda0d helpbest.patch - makefiles regenerated
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11535 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-01 12:59:33 +00:00
Václav Slavík
3d285623a7 finally applied the helpbest patch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11534 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-01 12:59:08 +00:00
Robin Dunn
65ec6247df Upgraded to version 1.39 of Scintilla, and upated wxStyledTextCtrl
accordingly.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11533 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-01 03:06:33 +00:00
Robin Dunn
b8fbf1a035 Added classinfo macros for wxTreeEvent
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11532 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-01 03:00:17 +00:00
Robin Dunn
55c020cf64 Cleaned up some and started using path joins and normalization instead
of string concatenation.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11531 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-01 02:35:31 +00:00
Vadim Zeitlin
11358d3976 added a bunch of new wxListCtrl messages: column right click and
start/continue/end dragging column divider


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11530 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-09-01 01:01:51 +00:00
Robin Dunn
aa2a5b8696 Added XRCed to the wxPython Tools directory, contributed by Roman
Rolinsky.

Added wrappers for the default ctor and the Create methods for most
window classes.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11527 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-31 21:51:07 +00:00
Robin Dunn
09f3d4e679 Added XRCed to the wxPython Tools directory, contributed by Roman
Rolinsky.

Added wrappers for the default ctor and the Create methods for most
window classes.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11526 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-31 21:38:03 +00:00
Vadim Zeitlin
f6010d8fad implemented and documented wxHtmlWindow::OnCellMouseHover() and OnCellClick()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11525 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-31 21:19:23 +00:00
Vadim Zeitlin
e2f9212c00 applied a patch to remove spurious constrains unsatisifed warnings
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11524 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-31 19:07:59 +00:00
Julian Smart
7900c71c73 Remove _all_ borders if that's what we specify to ShowFullScreen.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11523 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-31 10:29:40 +00:00
Václav Slavík
2049d9b54b helpbest docs update
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11522 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-30 23:26:28 +00:00
Václav Slavík
8c5b1f0faf minor fix that was part of helpbest.patch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11521 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-30 23:25:56 +00:00
Julian Smart
619e52bf45 Fixed cache-related bug in DoBlit.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11520 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-30 10:57:36 +00:00
Václav Slavík
a9a8c02ff3 oops, forgot to check in a wxMGL define
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11519 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-29 21:14:01 +00:00
Gilles Depeyrot
4d5a0f67c6 commented help references to OnXXX functions that are not documented
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11518 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-29 19:39:14 +00:00
Gilles Depeyrot
619e0d43b1 conditional compilation corrections for Apple Developer Tools
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11517 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-29 18:49:19 +00:00
Gilles Depeyrot
49e95e1d80 added missing include for compilation with Apple Developer Tools
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11516 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-29 18:47:47 +00:00
Gilles Depeyrot
ae13baff25 added common and generic files implementing wxFindReplaceDialog
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11515 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-29 18:46:56 +00:00
Václav Slavík
2f0bac123b non-recursive destructors
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11514 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-29 18:31:51 +00:00
Václav Slavík
d7b1d73c92 fixed my favorite bug (delete foo; call foo->Something())
and non-recursive destructors as an add-on :)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11513 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-29 18:31:40 +00:00
Julian Smart
c556f19843 Isolated the 'error' case which I ignore
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11512 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-29 12:20:36 +00:00
Vadim Zeitlin
cf30ae1309 fixed refreshing listctrl on focus change when it only has one item
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11511 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-29 11:35:14 +00:00
Julian Smart
09d68ec1c3 Removed wxLogSysError call in wxHandleProcessTermination, and ensured
the cleanup always happens. I hope this is right... but if processes
are killed elsewhere, we don't want this function to generate an error
and not do the correct cleanup.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11510 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-29 11:24:50 +00:00
Stefan Csomor
e126b44d22 added error message in case older apple header files are used
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-29 07:26:43 +00:00
Stefan Csomor
fb606749b3 corrected shutdown proc
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11508 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-29 07:25:39 +00:00
Václav Slavík
135ace6d7b make it possible to open files from XRC in wxHtmlWindow
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11507 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-28 22:12:44 +00:00
Václav Slavík
150e58d8ae compilation fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11506 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-28 22:11:54 +00:00
Václav Slavík
abe4a4f120 fixed a bug in wxListCtrl: SetColumnWidth didn't set wxListHeaderWindow::m_dirty
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11505 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-28 22:11:11 +00:00
Gilles Depeyrot
c6d1e23287 replaced CPPFLAGS with CXXFLAGS following corrections in auto-configuration
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11504 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-28 19:48:55 +00:00
Gilles Depeyrot
e33ef6614e generalized fix for clipboard code compilation configuration check
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11503 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-28 19:45:52 +00:00
Robin Dunn
00b6c4e33b Added a new sample app that is a style editor for wxSTC.
Some other tweaks and fixes.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11502 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-28 19:21:45 +00:00
Gilles Depeyrot
555d502faf removed leftover testing code in patch for wxComboBox and wxListBox that
only compiles with configured with --enable-debug


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11501 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-28 18:50:12 +00:00
Vadim Zeitlin
f20f656963 another compilation fix for whitespace-averse compilers
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-28 15:43:06 +00:00
Vadim Zeitlin
277d672a9d compilation fix: ifdef instead of if
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11499 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-28 14:41:31 +00:00
Vadim Zeitlin
1357a7dd5c implemented wxDir::HasSubDirs() optimization for Unix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11498 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-28 13:48:53 +00:00
Robert Roebling
7e410431f3 Probably fixed wxBeginBusyCursor.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11497 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-27 19:35:05 +00:00
Vadim Zeitlin
b0d3640289 attempt to optimize wxDirData::Read() - made absolutely no difference
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11496 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-27 18:27:42 +00:00
Vadim Zeitlin
2a4dbd8197 fixed bug with directory expansion
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11495 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-27 17:41:39 +00:00
Vadim Zeitlin
82008c2601 fixed typo
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11494 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-27 15:29:02 +00:00
Vadim Zeitlin
5549e9f76f added support for polygons to wxRegion
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11493 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-27 14:56:55 +00:00
Vadim Zeitlin
673f4220ba fix for wxGTK clipboard code compilation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11492 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-27 14:29:34 +00:00
Vadim Zeitlin
0cb9cfb22f send right click events for the URLs too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11491 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-27 13:51:20 +00:00
Vadim Zeitlin
b3dc8a3e61 fixed y position of the drop point in HandleDropFiles() (patch 455658)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11490 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-27 12:20:04 +00:00
Václav Slavík
026d1fac66 tables code fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11489 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-26 14:50:20 +00:00
Václav Slavík
af035b26c4 fixed HTML parsing in regard to spaces between tags
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11488 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-26 14:49:09 +00:00
Václav Slavík
79d6c01818 beginnings of HTML4 tables layouter
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11487 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 23:14:21 +00:00
Vadim Zeitlin
bb0e27ee5a compilation fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11486 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 20:51:58 +00:00
Stefan Csomor
46cdeb741e added quantize
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11485 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 20:15:04 +00:00
Stefan Csomor
518af45bee added disk space
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11484 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 20:13:57 +00:00
Vadim Zeitlin
2b9bdf7146 don't try compile wxClipboard without OLE support
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11483 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 20:13:45 +00:00
Vadim Zeitlin
44d5b352ae warning fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11482 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 20:13:14 +00:00
Vadim Zeitlin
ebb0781f91 are there still versions of gcc around which require casting WndProc to long? I don't think so...
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11481 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 20:12:58 +00:00
Vadim Zeitlin
b94e73ae6a no changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11480 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 20:08:48 +00:00
Václav Slavík
a42aa5d7be fixed a canonical example of Stupid Bug(tm)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11479 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 19:51:55 +00:00
Vadim Zeitlin
519dc37faf fixed return value of HandleEndSession to return true only if the message was really processed
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11478 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 17:56:34 +00:00
Vadim Zeitlin
52e8b69060 statfs() detection for wxGetDiskSpace
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11477 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 16:55:06 +00:00
Vadim Zeitlin
eadd7bd2cb added wxGetDiskSpace for Win/Unix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11476 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 16:54:14 +00:00
Vadim Zeitlin
3a994742ab added wxLongLong::ToString()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11475 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 16:42:11 +00:00
Vadim Zeitlin
6dc34ebbd8 added test for HitTest(m_dragPoint) bug to the sample
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11474 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 15:41:46 +00:00
Vadim Zeitlin
8d1d22845a use raw (physical) coords in LIST_(R)DRAG events (patch 444912)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 15:41:17 +00:00
Stefan Csomor
0baac61e4f corrected OWNER_DRAWN Remove to RemoveAt in Delete
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11472 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 15:40:52 +00:00
Vadim Zeitlin
fc4f1d5f6b fixed crash in HitTest() with y position below the last line
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11471 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 15:37:17 +00:00
Vadim Zeitlin
1971d23c57 applied patch 432814: saving BMP in 1, 4 and 8 bpp
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11470 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 15:30:49 +00:00
Vadim Zeitlin
6e711d5c09 applied patch 446836: removed qt headers
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11469 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 14:52:26 +00:00
Vadim Zeitlin
27b92ca4e2 added \#if wxUSE_GRID around the whole file (patch 455225)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11468 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 14:43:43 +00:00
Vadim Zeitlin
0800a4ba40 typo fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11467 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 12:07:45 +00:00
Vadim Zeitlin
7009f411aa refresh the tree ctrl when its back/foreground colour changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11466 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-25 12:06:53 +00:00
Vadim Zeitlin
de7f086027 fix for calling GetWindowLong(NULL hwnd)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11465 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 22:16:42 +00:00
Stefan Csomor
c638c3cd12 added new calling conventions for mac
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11464 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 20:44:02 +00:00
Robert Roebling
6464f4cbe0 Patch (partially back) so that images work in wxHTML.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11463 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 20:12:18 +00:00
Stefan Csomor
62e83765c2 decremented timeout, we have to find a better algorithm for knowing when we don't have to wait further for data
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11462 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 19:55:57 +00:00
Robert Roebling
51a229c65f Fixed apparent typo.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11461 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 19:55:38 +00:00
Stefan Csomor
ad8b849872 added connect sequence for mac
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11460 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 19:42:13 +00:00
Stefan Csomor
79da309276 added late init and setup timeout
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11459 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 19:27:17 +00:00
Vadim Zeitlin
70426fba08 fix for the short locale name construction
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11458 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 18:19:54 +00:00
Vadim Zeitlin
a329180411 no changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 18:14:06 +00:00
Vadim Zeitlin
66dfed9b9d generate wxEVT_ACTIVATE_APP events for wxMSW too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 16:12:40 +00:00
Vadim Zeitlin
00b4a13e0c declared private wxString::operator=(int) to prevent code like "str = 17;" from compiling
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 14:37:30 +00:00
David Webster
bcd3d8d9e2 New module definition file for the ever chaning treectrl class interface.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11454 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 14:18:00 +00:00
Vadim Zeitlin
adac097759 removed extra wxSTD
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11453 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 12:21:50 +00:00
Vadim Zeitlin
2b004197c8 added missing wxSTDs
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11452 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 12:21:27 +00:00
Vadim Zeitlin
a90ec4ab31 added missing wxSTD
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11450 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 12:20:07 +00:00
Julian Smart
7a4f484f1d Small correction
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11449 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-24 08:58:11 +00:00
Vadim Zeitlin
ad4297f34e always pass WM_DESTROY to DefWindowProc() - this fixes memory/resource leak for wxListBox
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11447 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-23 23:27:06 +00:00
Vadim Zeitlin
4770df95a0 fixes for rotated text drawing
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11446 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-23 22:08:58 +00:00
Vadim Zeitlin
56c4a88b3b added possibility to filter out some messages - there are too many of them
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11445 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-23 21:55:43 +00:00
Václav Slavík
77b2f9b185 ProcessPlatformProperty should not be a member of wxXmlResource
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11444 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-23 18:57:19 +00:00
Václav Slavík
2978621101 wxHtmlEasyPrinting indentation changes + CreatePrintout,DoPrint and DoPreview virtual and protected
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11443 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-23 18:56:41 +00:00
Stefan Csomor
b838cfc915 added conversion to mac native filenames from local filesystem handler
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11442 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-23 13:38:05 +00:00
Václav Slavík
ba0b7b3238 fixed yet another bug in wxStream classes
(This time, the braindead wannabe coder who wrote the original code created
wxStreamBase instance and then casted it to wxInputStream and hapilly used the stream,
which could of course never work. Anybody knows a cheap hitman?)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11440 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-22 22:13:22 +00:00
Václav Slavík
a3e377a31f compilation fix for genericTreeCtrl-only stuff
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11439 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2001-08-22 22:13:06 +00:00
956 changed files with 76189 additions and 49814 deletions

1104
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -2182,96 +2182,103 @@ dnl the name of the static library
WX_LIBRARY_NAME_STATIC="lib${WX_LIBRARY}.a"
WX_LIBRARY_NAME_STATIC_GL="lib${WX_LIBRARY}_gl.a"
dnl the name of the shared library
case "${host}" in
*-*-mingw32* )
WX_LIBRARY_NAME_SHARED="wx${WX_MAJOR_VERSION_NUMBER}${WX_MINOR_VERSION_NUMBER}_${WX_RELEASE_NUMBER}.dll"
;;
* )
WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.so.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.so.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
;;
esac
dnl the name of the links to the shared library
WX_LIBRARY_LINK1="lib${WX_LIBRARY}-${WX_RELEASE}.so.${WX_CURRENT}"
WX_LIBRARY_LINK2="lib${WX_LIBRARY}-${WX_RELEASE}.so"
WX_LIBRARY_LINK3="lib${WX_LIBRARY}.so"
WX_LIBRARY_LINK1_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.so.${WX_CURRENT}"
WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.so"
WX_LIBRARY_LINK3_GL="lib${WX_LIBRARY}_gl.so"
dnl shared library settings
SHARED_LD=
PIC_FLAG=
WX_ALL=
WX_ALL_INSTALLED=
BURNT_LIBRARY_NAME=
WX_TARGET_LIBRARY_SONAME=
dnl --- the marker for quick search, leave it here: SHARED_LIB_SETUP ---
if test "$wxUSE_SHARED" = "yes"; then
dnl the name of the shared library
case "${host}" in
*-*-mingw32* )
WX_LIBRARY_NAME_SHARED="wx${WX_MAJOR_VERSION_NUMBER}${WX_MINOR_VERSION_NUMBER}_${WX_RELEASE_NUMBER}.dll"
;;
*-hp-hpux* )
SO_SUFFIX="sl"
;;
*-*-darwin* )
SO_SUFFIX="dylib"
;;
* )
SO_SUFFIX="so"
;;
esac
dnl set the name of the shared lib if not done above
if test "x$SO_SUFFIX" != "x"; then
WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.${SO_SUFFIX}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.${SO_SUFFIX}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
fi
dnl the name of the links to the shared library
WX_LIBRARY_LINK1="lib${WX_LIBRARY}-${WX_RELEASE}.${SO_SUFFIX}.${WX_CURRENT}"
WX_LIBRARY_LINK2="lib${WX_LIBRARY}-${WX_RELEASE}.${SO_SUFFIX}"
WX_LIBRARY_LINK3="lib${WX_LIBRARY}.${SO_SUFFIX}"
WX_LIBRARY_LINK1_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.${SO_SUFFIX}.${WX_CURRENT}"
WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.${SO_SUFFIX}"
WX_LIBRARY_LINK3_GL="lib${WX_LIBRARY}_gl.${SO_SUFFIX}"
dnl install targets
if test "$wxUSE_OPENGL" = "yes"; then
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS CREATE_INSTALLED_LINKS_GL"
WX_ALL="CREATE_LINKS CREATE_LINKS_GL"
else
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
WX_ALL="CREATE_LINKS"
fi
dnl the extra compiler flags needed for compilation of shared library
if test "$GCC" = "yes"; then
dnl the switch for gcc is the same under all platforms
PIC_FLAG="-fPIC"
fi
dnl the command to use for creating the shared library
SHARED_LD="${CXX} -shared -o"
case "${host}" in
*-hp-hpux* )
if test "$GCC" = yes ; then
SHARED_LD="${CXX} -shared -fPIC -o"
PIC_FLAG="-fPIC"
else
dnl default settings are good for gcc but not for the native HP-UX
if test "$GCC" != "yes"; then
dnl no idea why it wants it, but it does
LDFLAGS="-L/usr/lib"
SHARED_LD="${CXX} -b -o"
PIC_FLAG="+Z"
fi
WX_LIBRARY_NAME_SHARED="libwx_${TOOLKIT_NAME}.sl"
WX_LIBRARY_NAME_SHARED_GL="libwx_${TOOLKIT_NAME}_gl.sl"
if test "$wxUSE_OPENGL" = "yes"; then
WX_ALL_INSTALLED="preinstall_gl"
WX_ALL="${WX_LIBRARY_NAME_SHARED} ${WX_LIBRARY_NAME_SHARED_GL}"
else
WX_ALL="${WX_LIBRARY_NAME_SHARED}"
fi
;;
dnl in fact, these settings are for any platform using gcc
*-*-linux* )
SHARED_LD="${CXX} -shared -o"
PIC_FLAG="-fPIC"
if test "$GCC" != "yes"; then
AC_CACHE_CHECK([for Intel compiler], wx_cv_prog_icc,
[
AC_TRY_COMPILE([],
[
#ifndef __INTEL_COMPILER
#error Not icc
#endif
],
wx_cv_prog_icc=yes,
wx_cv_prog_icc=no
)
])
if test "$wx_cv_prog_icc" = "yes"; then
PIC_FLAG="-KPIC"
fi
fi
if test "$wxUSE_BURNT_NAME" = "yes" ; then
BURNT_LIBRARY_NAME="-Wl,-soname,${WX_LIBRARY_LINK1}"
BURNT_LIBRARY_NAME_GL="-Wl,-soname,${WX_LIBRARY_LINK1_GL}"
dnl substitute this in makelib.env for the contrib libs
WX_TARGET_LIBRARY_SONAME="-Wl,-soname,\$(TARGETLIB_LINK1)"
fi
if test "$wxUSE_OPENGL" = "yes"; then
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS CREATE_INSTALLED_LINKS_GL"
WX_ALL="CREATE_LINKS CREATE_LINKS_GL"
else
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
WX_ALL="CREATE_LINKS"
fi
;;
*-*-irix5* | *-*-irix6* )
if test "$GCC" = yes ; then
SHARED_LD="${CXX} -shared -o"
PIC_FLAG="-fPIC"
else
SHARED_LD="${CXX} -shared -o"
fi
if test "$wxUSE_OPENGL" = "yes"; then
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS CREATE_INSTALLED_LINKS_GL"
WX_ALL="CREATE_LINKS CREATE_LINKS_GL"
else
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
WX_ALL="CREATE_LINKS"
fi
;;
*-*-solaris2* )
if test "$GCC" = yes ; then
SHARED_LD="${CXX} -shared -o"
PIC_FLAG="-fPIC"
dnl newer versions of gcc need -isystem to compile X headers on
dnl Solaris (which use old style C syntax)
CPPFLAGS="$CPPFLAGS -isystem /usr/openwin/include"
@@ -2279,80 +2286,24 @@ if test "$wxUSE_SHARED" = "yes"; then
SHARED_LD="${CXX} -G -o"
PIC_FLAG="-KPIC"
fi
if test "$wxUSE_OPENGL" = "yes"; then
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS CREATE_INSTALLED_LINKS_GL"
WX_ALL="CREATE_LINKS CREATE_LINKS_GL"
else
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
WX_ALL="CREATE_LINKS"
fi
;;
*-*-sunos4* )
SHARED_LD="${CXX} -shared -o"
PIC_FLAG="-fPIC"
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
WX_ALL="CREATE_LINKS"
;;
*-*-freebsd* | *-*-openbsd* | *-*-netbsd* )
SHARED_LD="${CXX} -shared -o"
PIC_FLAG="-fPIC"
if test "$wxUSE_OPENGL" = "yes"; then
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS CREATE_INSTALLED_LINKS_GL"
WX_ALL="CREATE_LINKS CREATE_LINKS_GL"
else
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
WX_ALL="CREATE_LINKS"
fi
;;
*-*-darwin* )
TOOLKIT_DEF="${TOOLKIT_DEF} -D__UNIX__ -D__DARWIN__ -D__POWERPC__"
CPPFLAGS="${CPPFLAGS} -fno-common"
SHARED_LD="${CXX} -dynamiclib -o"
PIC_FLAG="-dynamic -fPIC"
if test "$wxUSE_OPENGL" = "yes"; then
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS CREATE_INSTALLED_LINKS_GL"
WX_ALL="CREATE_LINKS CREATE_LINKS_GL"
else
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
WX_ALL="CREATE_LINKS"
fi
dnl add the resources target for wxMac
if test "$wxUSE_MAC" = 1 ; then
WX_ALL="${WX_ALL} ./lib/lib${WX_LIBRARY}-${WX_RELEASE}.r"
fi
dnl the name of the shared library
WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
dnl the name of the links to the shared library
WX_LIBRARY_LINK1="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}"
WX_LIBRARY_LINK2="lib${WX_LIBRARY}-${WX_RELEASE}.dylib"
WX_LIBRARY_LINK3="lib${WX_LIBRARY}.dylib"
WX_LIBRARY_LINK1_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}"
WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib"
WX_LIBRARY_LINK3_GL="lib${WX_LIBRARY}_gl.dylib"
;;
*-*-osf* )
SHARED_LD="${CXX} -shared -o"
PIC_FLAG="-fPIC"
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
WX_ALL="CREATE_LINKS"
;;
*-*-dgux5* )
SHARED_LD="${CXX} -shared -o"
PIC_FLAG="-fPIC"
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
WX_ALL="CREATE_LINKS"
;;
*-*-sysv5* )
SHARED_LD="${CXX} -shared -o"
PIC_FLAG="-fPIC"
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
WX_ALL="CREATE_LINKS"
;;
*-*-aix* )
SHARED_LD="/usr/lpp/xlC/bin/makeC++SharedLib -p 0 -o"
WX_ALL=${WX_LIBRARY_NAME_SHARED}
;;
*-*-cygwin* )
dnl only static for now
WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
@@ -2364,6 +2315,7 @@ if test "$wxUSE_SHARED" = "yes"; then
WX_ALL="${WX_LIBRARY_NAME_STATIC}"
fi
;;
*-*-mingw32* )
WX_LIBRARY_NAME_STATIC="lib/libwx${WX_MAJOR_VERSION_NUMBER}${WX_MINOR_VERSION_NUMBER}_${WX_RELEASE_NUMBER}.a"
SHARED_LD="${CC} -shared -Wl,--out-implib,${WX_LIBRARY_NAME_STATIC} -o"
@@ -2378,19 +2330,28 @@ if test "$wxUSE_SHARED" = "yes"; then
WX_ALL="${WX_LIBRARY_NAME_SHARED}"
fi
;;
*-pc-os2_emx )
dnl only static for now
WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
WX_ALL="${WX_LIBRARY_NAME_STATIC}"
;;
*-*-beos* )
dnl can't use gcc under BeOS for shared library creation because it
dnl complains about missing 'main'
SHARED_LD="${LD} -shared -o"
PIC_FLAG="-fPIC"
WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
WX_ALL="CREATE_LINKS"
;;
*-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \
*-*-sunos4* | \
*-*-irix5* | *-*-irix6* | \
*-*-osf* | \
*-*-dgux5* | \
*-*-sysv5* )
dnl defaults are ok
;;
*)
AC_MSG_ERROR(unknown system type ${host}.)
esac
@@ -2400,6 +2361,7 @@ if test "$wxUSE_SHARED" = "yes"; then
WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_SHARED}"
WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_SHARED_GL}"
fi
dnl do not alter the LIBRARY_TYPE strings "so" and "a", they are magic
WX_TARGET_LIBRARY_TYPE="so"
else
@@ -2453,6 +2415,27 @@ fi
if test "$USE_WIN32" = 1; then
AC_CHECK_HEADERS(w32api.h)
dnl check if can use _WIN_IE macro
AC_CACHE_CHECK([if w32api has good enough MSIE support], wx_cv_w32api_win_ie,
[
AC_TRY_COMPILE([#include <w32api.h>],
[
#define wxCHECK_W32API_VERSION( major, minor ) \
( defined( __W32API_MAJOR_VERSION ) && defined( __W32API_MINOR_VERSION ) \
&& ( ( __W32API_MAJOR_VERSION > (major) ) \
|| ( __W32API_MAJOR_VERSION == (major) && __W32API_MINOR_VERSION >= (minor))))
#if !wxCHECK_W32API_VERSION(1,1)
#error You need w32api 1.1 or newer
#endif
], [
wx_cv_w32api_win_ie=yes
CPPFLAGS="$CPPFLAGS -D_WIN_IE=0x400"
], [
wx_cv_w32api_win_ie=no
])
])
fi
dnl ---------------------------------------------------------------------------
@@ -2822,6 +2805,35 @@ fi
dnl check for vfork() (even if it's the same as fork() in modern Unices)
AC_CHECK_FUNCS(vfork)
dnl get the library function to use for wxGetDiskSpace()
AC_CACHE_CHECK(for statfs, wx_cv_func_statfs,
AC_TRY_COMPILE(
[
#include <sys/vfs.h>
],
[
long l;
struct statfs fs;
statfs("/", &fs);
l = fs.f_bsize;
l += fs.f_blocks;
l += fs.f_bavail;
],
[
wx_cv_func_statfs=yes
],
[
wx_cv_func_statfs=no
]
)
)
if test "$wx_cv_func_statfs" = "yes"; then
AC_DEFINE(HAVE_STATFS)
else
AC_MSG_WARN([wxGetDiskSpace() function won't work without statfs()])
fi
dnl check for fcntl() or at least flock() needed by Unix implementation of
dnl wxSingleInstanceChecker
if test "$wxUSE_SNGLINST_CHECKER" = "yes"; then
@@ -3571,7 +3583,7 @@ if test "$wxUSE_STREAMS" = "yes" ; then
AC_DEFINE(wxUSE_STREAMS)
fi
dnl ------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl time/date functions
dnl ------------------------------------------------------------------------
@@ -3982,7 +3994,7 @@ if test "$wxUSE_HELP" = "yes"; then
AC_DEFINE(wxUSE_MS_HTML_HELP)
],
[
AC_MSG_WARN(MS HTML Help cannot be used without htmlhelp.h so it won't be compiled without it)
AC_MSG_WARN([MS HTML Help cannot be used without htmlhelp.h, disabled])
wxUSE_MS_HTML_HELP=no
])
fi
@@ -4024,6 +4036,40 @@ dnl ---------------------------------------------------------------------------
dnl IPC: IPC, Drag'n'Drop, Clipboard, ...
dnl ---------------------------------------------------------------------------
dnl check for ole headers and disable a few features requiring it if not
dnl present (earlier versions of mingw32 don't have ole2.h)
if test "$USE_WIN32" = 1; then
AC_CHECK_HEADERS(ole2.h)
if test "$ac_cv_header_ole2_h" = "yes" ; then
if test "$GCC" = yes ; then
ALL_OBJECTS="$ALL_OBJECTS \$(OLEOBJS)"
ALL_DEPFILES="$ALL_DEPFILES \$(OLEDEPS)"
CODE_GEN_FLAGS_CXX="$CODE_GEN_FLAGS_CXX -fvtable-thunks"
LIBS="$LIBS -lrpcrt4 -loleaut32 -lole32 -luuid"
AC_DEFINE(wxUSE_OLE)
fi
dnl for OLE clipboard and dnd
AC_DEFINE(wxUSE_DATAOBJ)
else
AC_MSG_WARN([Some features disabled because OLE headers not found])
wxUSE_CLIPBOARD=no
wxUSE_DRAG_AND_DROP=no
wxUSE_DATAOBJ=no
fi
dnl this is for MSW only, so we test for it inside "if USE_WIN32"
if test "$wxUSE_METAFILE" = "yes"; then
AC_DEFINE(wxUSE_METAFILE)
dnl this one should probably be made separately configurable
AC_DEFINE(wxUSE_ENH_METAFILE)
fi
fi
if test "$wxUSE_IPC" = "yes"; then
if test "$wxUSE_SOCKETS" != "yes"; then
AC_MSG_WARN(wxWindows IPC classes require sockets, disabled)
@@ -4034,6 +4080,8 @@ fi
if test "$wxUSE_CLIPBOARD" = "yes"; then
AC_DEFINE(wxUSE_CLIPBOARD)
dnl required by clipboard code in configuration check
AC_DEFINE(wxUSE_DATAOBJ)
fi
@@ -4055,34 +4103,6 @@ if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
wxUSE_DRAG_AND_DROP=no
fi
if test "$USE_WIN32" = 1; then
dnl check for ole headers and disable DnD if not present (earlier
dnl versions of mingw32 don't have them)
AC_CHECK_HEADERS(ole2.h)
if test "$ac_cv_header_ole2_h" = "yes" ; then
if test "$GCC" = yes ; then
ALL_OBJECTS="$ALL_OBJECTS \$(OLEOBJS)"
ALL_DEPFILES="$ALL_DEPFILES \$(OLEDEPS)"
CODE_GEN_FLAGS_CXX="$CODE_GEN_FLAGS_CXX -fvtable-thunks"
LIBS="$LIBS -lrpcrt4 -loleaut32 -lole32 -luuid"
AC_DEFINE(wxUSE_OLE)
dnl metafiles need the ole code, right?? if not this
dnl doesn't need to be in here.
if test "$wxUSE_METAFILE" = "yes"; then
AC_DEFINE(wxUSE_METAFILE)
dnl this one should probably be made separately configurable
AC_DEFINE(wxUSE_ENH_METAFILE)
fi
fi
else
AC_MSG_WARN(Drag and drop disabled because OLE headers not found)
wxUSE_DRAG_AND_DROP=no
fi
fi
if test "$wxUSE_DRAG_AND_DROP" = "yes"; then
AC_DEFINE(wxUSE_DRAG_AND_DROP)
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dnd"

View File

@@ -0,0 +1,57 @@
/****************************************************************************
*
* wxWindows HTML Applet Package
*
* Copyright (C) 1991-2001 SciTech Software, Inc.
* All rights reserved.
*
* ========================================================================
*
* The contents of this file are subject to the wxWindows License
* Version 3.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.wxwindows.org/licence3.txt
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* ========================================================================
*
* Language: ANSI C++
* Environment: Any
*
* Description: Header file for the wxQlet class
*
****************************************************************************/
#ifndef __WX_PLUGIN_H
#define __WX_PLUGIN_H
// Forward declaration
class wxHtmlAppletWindow;
/*--------------------------- Class Definitions ---------------------------*/
/****************************************************************************
REMARKS:
Defines the abstract base class for wxQlet objects.
****************************************************************************/
class wxPlugIn : public wxObject {
private:
DECLARE_ABSTRACT_CLASS(wxPlugIn);
wxHtmlAppletWindow *m_parent;
public:
// Constructor (called during dynamic creation)
wxPlugIn() { m_parent = NULL; };
// Psuedo virtual constructor
virtual bool Create(wxHtmlAppletWindow *parent);
// Virtual destructor
virtual ~wxPlugIn();
};
#endif // __WX_PLUGIN_H

View File

@@ -38,9 +38,11 @@
// Forward declare
class wxApplet;
class wxQlet;
class wxLoadPageEvent;
class wxPageLoadedEvent;
class wxIncludePrep;
class wxToolBarBase;
// Declare a linked list of wxApplet pointers
WX_DECLARE_LIST(wxApplet, wxAppletList);
@@ -119,6 +121,9 @@ public:
const wxHtmlTag &params,
const wxSize& size);
// Create an instance of an Qlet based on it's class name
bool CreatePlugIn(const wxString& classId );
// Find an instance of an applet based on it's class name
wxApplet *FindApplet(const wxString& className);
@@ -186,6 +191,24 @@ public:
};
/****************************************************************************
REMARKS:
Defines the class for wxHtmlAppletCell
***************************************************************************/
class wxHtmlAppletCell : public wxHtmlCell
{
public:
wxHtmlAppletCell(wxWindow *wnd, int w = 0);
~wxHtmlAppletCell() { m_Wnd->Destroy(); }
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
virtual void DrawInvisible(wxDC& dc, int x, int y);
virtual void Layout(int w);
protected:
wxWindow* m_Wnd;
// width float is used in adjustWidth (it is in percents)
};
#endif // __WX_APPLET_WINDOW_H

View File

@@ -1052,6 +1052,8 @@ public:
cbUpdatesManagerBase( wxFrameLayout* pPanel )
: mpLayout( pPanel ) {}
virtual ~cbUpdatesManagerBase() {}
void SetLayout( wxFrameLayout* pLayout ) { mpLayout = pLayout; }
// notificiactions received from frame-layout (in the order, in which

View File

@@ -116,17 +116,17 @@ public:
// overridables
virtual void AddTool( int toolIndex,
wxWindow* pToolWindow,
const wxSize& size = wxDefaultSize );
wxWindow* pToolWindow,
const wxSize& size = wxDefaultSize );
virtual void AddTool( int toolIndex,
const wxString& imageFileName,
int imageFileType = wxBITMAP_TYPE_BMP,
const wxString& labelText = "", bool alignTextRight = FALSE,
bool isFlat = TRUE );
virtual void AddTool( int toolIndex, wxBitmap labelBmp,
const wxString& labelText = "", bool alignTextRight = FALSE,
bool isFlat = TRUE );
virtual void AddTool( int toolIndex,
const wxString& imageFileName,
wxBitmapType imageFileType = wxBITMAP_TYPE_BMP,
const wxString& labelText = "", bool alignTextRight = FALSE,
bool isFlat = TRUE );
virtual void AddTool( int toolIndex, wxBitmap labelBmp,
const wxString& labelText = "", bool alignTextRight = FALSE,
bool isFlat = TRUE );
// method from wxToolBarBase (for compatibility), only
// first two arguments are valid

View File

@@ -50,7 +50,7 @@ protected:
wxString mLabelText;
wxString mImageFileName;
int mImageFileType;
wxBitmapType mImageFileType;
wxBitmap mDepressedBmp; // source image for rendering
// labels for particular state
@@ -114,17 +114,17 @@ public:
// use this constructor if buttons have to be persistant
wxNewBitmapButton( const wxString& bitmapFileName,
const int bitmapFileType = wxBITMAP_TYPE_BMP,
const wxString& labelText = "",
int alignText = NB_ALIGN_TEXT_BOTTOM,
bool isFlat = TRUE,
// this is the default type of fired events
int firedEventType = wxEVT_COMMAND_MENU_SELECTED,
int marginX = 2,
int marginY = 2,
int textToLabelGap = 2,
bool isSticky = FALSE
);
const wxBitmapType bitmapFileType = wxBITMAP_TYPE_BMP,
const wxString& labelText = "",
int alignText = NB_ALIGN_TEXT_BOTTOM,
bool isFlat = TRUE,
// this is the default type of fired events
int firedEventType = wxEVT_COMMAND_MENU_SELECTED,
int marginX = 2,
int marginY = 2,
int textToLabelGap = 2,
bool isSticky = FALSE
);
~wxNewBitmapButton();

View File

@@ -33,7 +33,8 @@ public:
// Send a message.
// Specify profile, or leave it to wxWindows to find the current user name
static bool Send(wxMailMessage& message, const wxString& profileName = wxEmptyString );
static bool Send(wxMailMessage& message, const wxString& profileName = wxEmptyString,
const wxString& sendMail = wxT("/usr/lib/sendmail -t"));
protected:
};

View File

@@ -27,12 +27,14 @@ public:
// A common usage
wxMailMessage(const wxString& subject, const wxString& to,
const wxString& body, const wxString& attachment = wxEmptyString,
const wxString& body, const wxString& from = wxEmptyString,
const wxString& attachment = wxEmptyString,
const wxString& attachmentTitle = wxEmptyString)
{
m_to.Add(to);
m_subject = subject;
m_body = body;
m_from = from;
if (!attachment.IsEmpty())
{
m_attachments.Add(attachment);
@@ -52,9 +54,11 @@ public:
void SetSubject(const wxString& subject) { m_subject = subject; }
void SetBody(const wxString& body) { m_body = body; }
void SetFrom(const wxString& from) { m_from = from; }
public:
wxArrayString m_to; //The To: Recipients
wxString m_from; //The From: email address (optional)
wxArrayString m_cc; //The CC: Recipients
wxArrayString m_bcc; //The BCC Recipients
wxString m_subject; //The Subject of the message

View File

@@ -57,6 +57,28 @@
#define wxSTC_MARK_ARROWDOWN 6
#define wxSTC_MARK_MINUS 7
#define wxSTC_MARK_PLUS 8
// Shapes used for outlining column
#define wxSTC_MARK_VLINE 9
#define wxSTC_MARK_LCORNER 10
#define wxSTC_MARK_TCORNER 11
#define wxSTC_MARK_BOXPLUS 12
#define wxSTC_MARK_BOXPLUSCONNECTED 13
#define wxSTC_MARK_BOXMINUS 14
#define wxSTC_MARK_BOXMINUSCONNECTED 15
#define wxSTC_MARK_LCORNERCURVE 16
#define wxSTC_MARK_TCORNERCURVE 17
#define wxSTC_MARK_CIRCLEPLUS 18
#define wxSTC_MARK_CIRCLEPLUSCONNECTED 19
#define wxSTC_MARK_CIRCLEMINUS 20
#define wxSTC_MARK_CIRCLEMINUSCONNECTED 21
// Markers used for outlining column
#define wxSTC_MARKNUM_FOLDEREND 25
#define wxSTC_MARKNUM_FOLDEROPENMID 26
#define wxSTC_MARKNUM_FOLDERMIDTAIL 27
#define wxSTC_MARKNUM_FOLDERTAIL 28
#define wxSTC_MARKNUM_FOLDERSUB 29
#define wxSTC_MARKNUM_FOLDER 30
#define wxSTC_MARKNUM_FOLDEROPEN 31
#define wxSTC_MARGIN_SYMBOL 0
@@ -90,6 +112,9 @@
#define wxSTC_CHARSET_ARABIC 178
#define wxSTC_CHARSET_VIETNAMESE 163
#define wxSTC_CHARSET_THAI 222
#define wxSTC_CASE_MIXED 0
#define wxSTC_CASE_UPPER 1
#define wxSTC_CASE_LOWER 2
#define wxSTC_INDIC_MAX 7
#define wxSTC_INDIC_PLAIN 0
#define wxSTC_INDIC_SQUIGGLE 1
@@ -109,12 +134,15 @@
// PrintColourMode - force black text on white background for printing.
#define wxSTC_PRINT_BLACKONWHITE 2
#define wxSTC_FIND_DOWN 1
// PrintColourMode - text stays coloured, but all background is forced to be white for printing.
#define wxSTC_PRINT_COLOURONWHITE 3
// PrintColourMode - only the default-background is forced to be white for printing.
#define wxSTC_PRINT_COLOURONWHITEDEFAULTBG 4
#define wxSTC_FIND_WHOLEWORD 2
#define wxSTC_FIND_MATCHCASE 4
#define wxSTC_FIND_WORDSTART 0x00100000
// SCFIND_REGEXP is not yet implemented.
#define wxSTC_FIND_REGEXP 0x00200000
#define wxSTC_CMD_UNDO 2176
#define wxSTC_CMD_CUT 2177
@@ -124,6 +152,7 @@
#define wxSTC_FOLDLEVELWHITEFLAG 0x1000
#define wxSTC_FOLDLEVELHEADERFLAG 0x2000
#define wxSTC_FOLDLEVELNUMBERMASK 0x0FFF
#define wxSTC_TIME_FOREVER 10000000
#define wxSTC_CMD_LINEDOWN 2300
#define wxSTC_CMD_LINEDOWNEXTEND 2301
#define wxSTC_CMD_LINEUP 2302
@@ -173,15 +202,31 @@
#define wxSTC_EDGE_BACKGROUND 2
// Show caret within N lines of edge when it's scrolled to view
// If CARET_SLOP not set then centre caret on screen when it's
// scrolled to view
#define wxSTC_CARET_SLOP 0x01
// Center caret on screen when it's scrolled to view
// Value not used
#define wxSTC_CARET_CENTER 0x02
// OR this with CARET_CENTER to reposition even when visible, or
// OR this with CARET_SLOP to reposition whenever outside slop border
// If CARET_SLOP also set then reposition whenever outside slop border
// If CARET_SLOP not set then recentre even when visible
#define wxSTC_CARET_STRICT 0x04
// If CARET_XEVEN set then both left and right margins are given equal weight
// rather than favouring left following behaviour.
#define wxSTC_CARET_XEVEN 0x08
// If CARET_XJUMPS set then when caret reaches the margin the display jumps
// enough to leave the caret solidly within the display.
#define wxSTC_CARET_XJUMPS 0x10
#define wxSTC_CURSORNORMAL -1
#define wxSTC_CURSORWAIT 3
// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy
#define wxSTC_VISIBLE_SLOP 0x01
#define wxSTC_VISIBLE_STRICT 0x04
// 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.
@@ -241,6 +286,19 @@
#define wxSTC_LEX_LATEX 14
#define wxSTC_LEX_LUA 15
#define wxSTC_LEX_DIFF 16
#define wxSTC_LEX_CONF 17
#define wxSTC_LEX_PASCAL 18
#define wxSTC_LEX_AVE 19
#define wxSTC_LEX_ADA 20
#define wxSTC_LEX_LISP 21
#define wxSTC_LEX_RUBY 22
#define wxSTC_LEX_EIFFEL 23
#define wxSTC_LEX_EIFFELKW 24
#define wxSTC_LEX_TCL 25
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
// value assigned in sequence from SCLEX_AUTOMATIC+1.
#define wxSTC_LEX_AUTOMATIC 1000
// Lexical states for SCLEX_PYTHON
#define wxSTC_P_DEFAULT 0
@@ -273,6 +331,9 @@
#define wxSTC_C_IDENTIFIER 11
#define wxSTC_C_STRINGEOL 12
#define wxSTC_C_VERBATIM 13
#define wxSTC_C_REGEX 14
#define wxSTC_C_COMMENTLINEDOC 15
#define wxSTC_C_WORD2 16
// Lexical states for SCLEX_HTML, SCLEX_XML
#define wxSTC_H_DEFAULT 0
@@ -300,6 +361,12 @@
// More HTML
#define wxSTC_H_VALUE 19
// X-Code
#define wxSTC_H_XCCOMMENT 20
// SGML
#define wxSTC_H_SGML 21
// Embedded Javascript
#define wxSTC_HJ_START 40
#define wxSTC_HJ_DEFAULT 41
@@ -313,6 +380,7 @@
#define wxSTC_HJ_SINGLESTRING 49
#define wxSTC_HJ_SYMBOLS 50
#define wxSTC_HJ_STRINGEOL 51
#define wxSTC_HJ_REGEX 52
// ASP Javascript
#define wxSTC_HJA_START 55
@@ -327,6 +395,7 @@
#define wxSTC_HJA_SINGLESTRING 64
#define wxSTC_HJA_SYMBOLS 65
#define wxSTC_HJA_STRINGEOL 66
#define wxSTC_HJA_REGEX 67
// Embedded VBScript
#define wxSTC_HB_START 70
@@ -387,11 +456,12 @@
#define wxSTC_HPHP_VARIABLE 123
#define wxSTC_HPHP_COMMENT 124
#define wxSTC_HPHP_COMMENTLINE 125
#define wxSTC_HPHP_STRINGEOL 126
#define wxSTC_HPHP_HSTRING_VARIABLE 126
#define wxSTC_HPHP_OPERATOR 127
// Lexical states for SCLEX_PERL
#define wxSTC_PL_DEFAULT 0
#define wxSTC_PL_HERE 1
#define wxSTC_PL_ERROR 1
#define wxSTC_PL_COMMENTLINE 2
#define wxSTC_PL_POD 3
#define wxSTC_PL_NUMBER 4
@@ -406,12 +476,20 @@
#define wxSTC_PL_ARRAY 13
#define wxSTC_PL_HASH 14
#define wxSTC_PL_SYMBOLTABLE 15
#define wxSTC_PL_REF 16
#define wxSTC_PL_REGEX 17
#define wxSTC_PL_REGSUBST 18
#define wxSTC_PL_LONGQUOTE 19
#define wxSTC_PL_BACKTICKS 20
#define wxSTC_PL_DATASECTION 21
#define wxSTC_PL_HERE_DELIM 22
#define wxSTC_PL_HERE_Q 23
#define wxSTC_PL_HERE_QQ 24
#define wxSTC_PL_HERE_QX 25
#define wxSTC_PL_STRING_Q 26
#define wxSTC_PL_STRING_QQ 27
#define wxSTC_PL_STRING_QX 28
#define wxSTC_PL_STRING_QR 29
#define wxSTC_PL_STRING_QW 30
// Lexical states for SCLEX_LATEX
#define wxSTC_L_DEFAULT 0
@@ -434,6 +512,8 @@
#define wxSTC_LUA_OPERATOR 10
#define wxSTC_LUA_IDENTIFIER 11
#define wxSTC_LUA_STRINGEOL 12
// Lexical states for SCLEX_ERRORLIST
#define wxSTC_ERR_DEFAULT 0
#define wxSTC_ERR_PYTHON 1
#define wxSTC_ERR_GCC 2
@@ -441,6 +521,88 @@
#define wxSTC_ERR_CMD 4
#define wxSTC_ERR_BORLAND 5
#define wxSTC_ERR_PERL 6
#define wxSTC_ERR_NET 7
#define wxSTC_ERR_LUA 8
#define wxSTC_ERR_DIFF_CHANGED 10
#define wxSTC_ERR_DIFF_ADDITION 11
#define wxSTC_ERR_DIFF_DELETION 12
#define wxSTC_ERR_DIFF_MESSAGE 13
// Lexical states for SCLEX_BATCH
#define wxSTC_BAT_DEFAULT 0
#define wxSTC_BAT_COMMENT 1
#define wxSTC_BAT_WORD 2
#define wxSTC_BAT_LABEL 3
#define wxSTC_BAT_HIDE 4
#define wxSTC_BAT_COMMAND 5
#define wxSTC_BAT_IDENTIFIER 6
#define wxSTC_BAT_OPERATOR 7
// Lexical states for SCLEX_MAKEFILE
#define wxSTC_MAKE_DEFAULT 0
#define wxSTC_MAKE_COMMENT 1
#define wxSTC_MAKE_PREPROCESSOR 2
#define wxSTC_MAKE_IDENTIFIER 3
#define wxSTC_MAKE_OPERATOR 4
#define wxSTC_MAKE_TARGET 5
#define wxSTC_MAKE_IDEOL 9
// Lexical states for the SCLEX_CONF (Apache Configuration Files Lexer)
#define wxSTC_CONF_DEFAULT 0
#define wxSTC_CONF_COMMENT 1
#define wxSTC_CONF_NUMBER 2
#define wxSTC_CONF_IDENTIFIER 3
#define wxSTC_CONF_EXTENSION 4
#define wxSTC_CONF_PARAMETER 5
#define wxSTC_CONF_STRING 6
#define wxSTC_CONF_OPERATOR 7
#define wxSTC_CONF_IP 8
#define wxSTC_CONF_DIRECTIVE 9
// Avenue
#define wxSTC_AVE_DEFAULT 0
#define wxSTC_AVE_COMMENT 1
#define wxSTC_AVE_NUMBER 2
#define wxSTC_AVE_WORD 3
#define wxSTC_AVE_KEYWORD 4
#define wxSTC_AVE_STATEMENT 5
#define wxSTC_AVE_STRING 6
#define wxSTC_AVE_ENUM 7
#define wxSTC_AVE_STRINGEOL 8
#define wxSTC_AVE_IDENTIFIER 9
#define wxSTC_AVE_OPERATOR 10
// Lexical states for SCLEX_ADA
#define wxSTC_ADA_DEFAULT 0
#define wxSTC_ADA_COMMENT 1
#define wxSTC_ADA_NUMBER 2
#define wxSTC_ADA_WORD 3
#define wxSTC_ADA_STRING 4
#define wxSTC_ADA_CHARACTER 5
#define wxSTC_ADA_OPERATOR 6
#define wxSTC_ADA_IDENTIFIER 7
#define wxSTC_ADA_STRINGEOL 8
// Lexical states for SCLEX_LISP
#define wxSTC_LISP_DEFAULT 0
#define wxSTC_LISP_COMMENT 1
#define wxSTC_LISP_NUMBER 2
#define wxSTC_LISP_KEYWORD 3
#define wxSTC_LISP_STRING 6
#define wxSTC_LISP_STRINGEOL 8
#define wxSTC_LISP_IDENTIFIER 9
#define wxSTC_LISP_OPERATOR 10
// Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW
#define wxSTC_EIFFEL_DEFAULT 0
#define wxSTC_EIFFEL_COMMENTLINE 1
#define wxSTC_EIFFEL_NUMBER 2
#define wxSTC_EIFFEL_WORD 3
#define wxSTC_EIFFEL_STRING 4
#define wxSTC_EIFFEL_CHARACTER 5
#define wxSTC_EIFFEL_OPERATOR 6
#define wxSTC_EIFFEL_IDENTIFIER 7
#define wxSTC_EIFFEL_STRINGEOL 8
// END of generated section
//----------------------------------------------------------------------
@@ -556,6 +718,10 @@ public:
// Find the position from a point within the window.
int PositionFromPoint(wxPoint pt);
// Find the position from a point within the window but return
// INVALID_POSITION if not close to text.
int PositionFromPointClose(int x, int y);
// Set caret to start of a line and ensure it is visible.
void GotoLine(int line);
@@ -568,13 +734,17 @@ public:
// Retrieve the text of the line containing the caret.
// Returns the index of the caret on the line.
wxString GetCurLine(int* OUTPUT=NULL);
#ifdef SWIG
wxString GetCurLine(int* OUTPUT);
#else
wxString GetCurLine(int* linePos=NULL);
#endif
// Retrieve the position of the last correctly styled character.
int GetEndStyled();
// Convert all line endings in the document to use the current mode.
void ConvertEOLs();
// Convert all line endings in the document to one mode.
void ConvertEOLs(int eolMode);
// Retrieve the current end of line mode - one of CRLF, CR, or LF.
int GetEOLMode();
@@ -693,6 +863,9 @@ public:
// Set a style to be underlined or not.
void StyleSetUnderline(int style, bool underline);
// Set a style to be mixed case, or to force upper or lower case.
void StyleSetCase(int style, int caseForce);
// Set the foreground colour of the selection and whether to use this setting.
void SetSelForeground(bool useSetting, const wxColour& fore);
@@ -763,6 +936,18 @@ public:
// Retrieve the last line number that has line state.
int GetMaxLineState();
// Is the background of the line containing the caret in a different colour?
bool GetCaretLineVisible();
// Display the background of the line containing the caret in a different colour.
void SetCaretLineVisible(bool show);
// Get the colour of the background of the line containing the caret.
wxColour GetCaretLineBack();
// Set the colour of the background of the line containing the caret.
void SetCaretLineBack(const wxColour& back);
// Display a auto-completion list.
// The lenEntered parameter indicates how many characters before
// the caret should be used to provide context.
@@ -816,6 +1001,15 @@ public:
// Retrieve state of ignore case flag.
bool AutoCompGetIgnoreCase();
// Display a list of strings and send notification when user chooses one.
void UserListShow(int listType, const wxString& itemList);
// Set whether or not autocompletion is hidden automatically when nothing matches
void AutoCompSetAutoHide(bool autoHide);
// Retrieve whether or not autocompletion is hidden automatically when nothing matches
bool AutoCompGetAutoHide();
// Set the number of spaces used for one level of indentation.
void SetIndent(int indentSize);
@@ -923,13 +1117,13 @@ public:
int GetLineCount();
// Sets the size in pixels of the left margin.
void SetMarginLeft(int width);
void SetMarginLeft(int pixelWidth);
// Returns the size in pixels of the left margin.
int GetMarginLeft();
// Sets the size in pixels of the right margin.
void SetMarginRight(int width);
void SetMarginRight(int pixelWidth);
// Returns the size in pixels of the right margin.
int GetMarginRight();
@@ -1006,6 +1200,48 @@ public:
// Returns true if overtype mode is active otherwise false is returned.
bool GetOvertype();
// Set the width of the insert mode caret
void SetCaretWidth(int pixelWidth);
// Returns the width of the insert mode caret
int GetCaretWidth();
// Sets the position that starts the target which is used for updating the
// document without affecting the scroll position.
void SetTargetStart(int pos);
// Get the position that starts the target.
int GetTargetStart();
// Sets the position that ends the target which is used for updating the
// document without affecting the scroll position.
void SetTargetEnd(int pos);
// Get the position that ends the target.
int GetTargetEnd();
// Replace the target text with the argument text.
// Returns the length of the replacement text.
int ReplaceTarget(const wxString& text);
// Replace the target text with the argument text after \d processing.
// Looks for \d where d is between 1 and 9 and replaces these with the strings
// matched in the last search operation which were surrounded by \( and \).
// Returns the length of the replacement text including any change
// caused by processing the \d patterns.
int ReplaceTargetRE(const wxString& text);
// Search for a counted string in the target and set the target to the found
// range.
// Returns length of range or -1 for failure in which case target is not moved.
int SearchInTarget(const wxString& text);
// Set the search flags used by SearchInTarget
void SetSearchFlags(int flags);
// Get the search flags used by SearchInTarget
int GetSearchFlags();
// Show a call tip containing a definition near position pos.
void CallTipShow(int pos, const wxString& definition);
@@ -1068,6 +1304,31 @@ public:
// Set some debugging options for folding
void SetFoldFlags(int flags);
// Ensure a particular line is visible by expanding any header line hiding it.
// Use the currently set visibility policy to determine which range to display.
void EnsureVisibleEnforcePolicy(int line);
// Sets whether a tab pressed when caret is within indentation indents
void SetTabIndents(bool tabIndents);
// Does a tab pressed when caret is within indentation indent?
bool GetTabIndents();
// Sets whether a backspace pressed when caret is within indentation unindents
void SetBackSpaceUnIndents(bool bsUnIndents);
// Does a backspace pressed when caret is within indentation unindent?
bool GetBackSpaceUnIndents();
// Sets the time the mouse must sit still to generate a mouse dwell event
void SetMouseDwellTime(int periodMilliseconds);
// Retrieve the time the mouse must sit still to generate a mouse dwell event
int GetMouseDwellTime();
// Move the caret inside current view if it's not there already
void MoveCaretInsideView();
// How many characters are on a line, not including end of line characters.
int LineLength(int line);
@@ -1119,9 +1380,11 @@ public:
void SearchAnchor();
// Find some text starting at the search anchor.
// Does not ensure the selection is visible.
int SearchNext(int flags, const wxString& text);
// Find some text starting at the search anchor and moving backwards.
// Does not ensure the selection is visible.
int SearchPrev(int flags, const wxString& text);
// Set the way the line the caret is on is kept visible.
@@ -1157,6 +1420,51 @@ public:
// Get which document modification events are sent to the container.
int GetModEventMask();
// Change internal focus flag
void SetSTCFocus(bool focus);
// Get internal focus flag
bool GetSTCFocus();
// Change error status - 0 = OK
void SetStatus(int statusCode);
// Get error status
int GetStatus();
// Set whether the mouse is captured when its button is pressed
void SetMouseDownCaptures(bool captures);
// Get whether mouse gets captured
bool GetMouseDownCaptures();
// Sets the cursor to one of the SC_CURSOR* values
void SetCursor(int cursorType);
// Get cursor type
int GetCursor();
// Move to the previous change in capitalistion
void WordPartLeft();
// Move to the previous change in capitalistion extending selection to new caret position.
void WordPartLeftExtend();
// Move to the change next in capitalistion
void WordPartRight();
// Move to the next change in capitalistion extending selection to new caret position.
void WordPartRightExtend();
// Set the way the display area is determined when a particular line is to be moved to.
void SetVisiblePolicy(int visiblePolicy, int visibleSlop);
// Delete back from the current position to the start of the line
void DelLineLeft();
// Delete forwards from the current position to the end of the line
void DelLineRight();
// Start notifying the container of all key presses and commands.
void StartRecord();
@@ -1178,6 +1486,9 @@ public:
// Set up the key words used by the lexer.
void SetKeyWords(int keywordSet, const wxString& keyWords);
// Set the lexing language of the document based on string name.
void SetLexerLanguage(const wxString& language);
// END of generated section
//----------------------------------------------------------------------
// Others...
@@ -1243,6 +1554,10 @@ public:
// Scroll enough to make the given column visible
void ScrollToColumn(int column);
// Send a message to Scintilla
long SendMsg(int msg, long wp=0, long lp=0);
//----------------------------------------------------------------------
@@ -1255,7 +1570,7 @@ private:
void OnMouseLeftDown(wxMouseEvent& evt);
void OnMouseMove(wxMouseEvent& evt);
void OnMouseLeftUp(wxMouseEvent& evt);
void OnMouseRightUp(wxMouseEvent& evt);
void OnContextMenu(wxContextMenuEvent& evt);
void OnMouseWheel(wxMouseEvent& evt);
void OnChar(wxKeyEvent& evt);
void OnKeyDown(wxKeyEvent& evt);
@@ -1271,8 +1586,6 @@ private:
void NotifyChange();
void NotifyParent(SCNotification* scn);
long SendMsg(int msg, long wp=0, long lp=0);
private:
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxStyledTextCtrl)
@@ -1280,6 +1593,7 @@ private:
ScintillaWX* m_swx;
wxStopWatch m_stopWatch;
bool m_lastKeyDownConsumed;
friend class ScintillaWX;
friend class Platform;
@@ -1307,6 +1621,9 @@ public:
void SetMessage(int val) { m_message = val; }
void SetWParam(int val) { m_wParam = val; }
void SetLParam(int val) { m_lParam = val; }
void SetListType(int val) { m_listType = val; }
void SetX(int val) { m_x = val; }
void SetY(int val) { m_y = val; }
int GetPosition() const { return m_position; }
int GetKey() const { return m_key; }
@@ -1322,6 +1639,9 @@ public:
int GetMessage() const { return m_message; }
int GetWParam() const { return m_wParam; }
int GetLParam() const { return m_lParam; }
int GetListType() const { return m_listType; }
int GetX() const { return m_x; }
int GetY() const { return m_y; }
bool GetShift() const;
bool GetControl() const;
@@ -1350,42 +1670,56 @@ private:
int m_message; // wxEVT_STC_MACRORECORD
int m_wParam;
int m_lParam;
int m_listType;
int m_x;
int m_y;
#endif
};
#ifndef SWIG
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE, 1650)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_STYLENEEDED, 1651)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHARADDED, 1652)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_UPDATEUI, 1653)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTREACHED, 1654)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTLEFT, 1655)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ROMODIFYATTEMPT, 1656)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DOUBLECLICK, 1657)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MODIFIED, 1658)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_KEY, 1659)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MACRORECORD, 1660)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MARGINCLICK, 1661)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_NEEDSHOWN, 1662)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_POSCHANGED, 1663)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE, 1650)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_STYLENEEDED, 1651)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHARADDED, 1652)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTREACHED, 1653)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTLEFT, 1654)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ROMODIFYATTEMPT, 1655)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_KEY, 1656)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DOUBLECLICK, 1657)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_UPDATEUI, 1658)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MODIFIED, 1659)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MACRORECORD, 1660)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MARGINCLICK, 1661)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_NEEDSHOWN, 1662)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_POSCHANGED, 1663)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_PAINTED, 1664)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_USERLISTSELECTION, 1665)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED, 1666)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART, 1667)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND, 1668)
END_DECLARE_EVENT_TYPES()
#else
enum {
wxEVT_STC_CHANGE,
wxEVT_STC_STYLENEEDED,
wxEVT_STC_CHARADDED,
wxEVT_STC_UPDATEUI,
wxEVT_STC_SAVEPOINTREACHED,
wxEVT_STC_SAVEPOINTLEFT,
wxEVT_STC_ROMODIFYATTEMPT,
wxEVT_STC_DOUBLECLICK,
wxEVT_STC_MODIFIED,
wxEVT_STC_KEY,
wxEVT_STC_DOUBLECLICK,
wxEVT_STC_UPDATEUI,
wxEVT_STC_MODIFIED,
wxEVT_STC_MACRORECORD,
wxEVT_STC_MARGINCLICK,
wxEVT_STC_NEEDSHOWN,
wxEVT_STC_POSCHANGED
wxEVT_STC_POSCHANGED,
wxEVT_STC_PAINTED,
wxEVT_STC_USERLISTSELECTION,
wxEVT_STC_URIDROPPED,
wxEVT_STC_DWELLSTART,
wxEVT_STC_DWELLEND,
};
#endif
@@ -1394,20 +1728,26 @@ END_DECLARE_EVENT_TYPES()
#ifndef SWIG
typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
#define EVT_STC_CHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_STYLENEEDED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_CHARADDED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_UPDATEUI(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_SAVEPOINTREACHED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_SAVEPOINTLEFT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_ROMODIFYATTEMPT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DOUBLECLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_MODIFIED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_KEY(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_MACRORECORD(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_MARGINCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_NEEDSHOWN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_POSCHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_POSCHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_CHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_STYLENEEDED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_CHARADDED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_SAVEPOINTREACHED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_SAVEPOINTLEFT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_ROMODIFYATTEMPT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_KEY(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DOUBLECLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_UPDATEUI(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_MODIFIED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_MACRORECORD(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_MARGINCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_NEEDSHOWN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_POSCHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_POSCHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_PAINTED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_USERLISTSELECTION(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_URIDROPPED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DWELLSTART(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DWELLEND(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#endif

View File

@@ -77,7 +77,6 @@ public:
wxXmlProperty(const wxString& name, const wxString& value,
wxXmlProperty *next)
: m_name(name), m_value(value), m_next(next) {}
~wxXmlProperty() { delete m_next; }
wxString GetName() const { return m_name; }
wxString GetValue() const { return m_value; }
@@ -116,7 +115,7 @@ public:
wxXmlNode(wxXmlNode *parent,wxXmlNodeType type,
const wxString& name, const wxString& content,
wxXmlProperty *props, wxXmlNode *next);
~wxXmlNode() { delete m_properties; delete m_next; delete m_children; }
~wxXmlNode();
// copy ctor & operator=. Note that this does NOT copy syblings
// and parent pointer, i.e. m_parent and m_next will be NULL

View File

@@ -176,10 +176,6 @@ protected:
// Creates resource from info in given node:
wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, wxObject *instance = NULL);
// Remove nodes with property "platform" that does not
// match current platform
void ProcessPlatformProperty(wxXmlNode *node);
bool GetUseLocale() { return m_useLocale; }
private:
@@ -347,7 +343,9 @@ protected:
{ return m_resource->CreateResFromNode(node, parent, instance); }
// helper
#if wxUSE_FILESYSTEM
wxFileSystem& GetCurFileSystem() { return m_resource->GetCurFileSystem(); }
#endif
};
#define ADD_STYLE(style) AddStyle(wxT(#style), style)

File diff suppressed because it is too large Load Diff

View File

@@ -49,7 +49,6 @@ public:
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnStyleNeeded(wxStyledTextEvent& event);
private:
wxStyledTextCtrl* ed;
@@ -70,7 +69,6 @@ enum
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU (ID_Quit, MyFrame::OnQuit)
EVT_MENU (ID_About, MyFrame::OnAbout)
EVT_STC_STYLENEEDED (ID_ED, MyFrame::OnStyleNeeded)
END_EVENT_TABLE()
IMPLEMENT_APP(MyApp)
@@ -128,7 +126,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
ed = new wxStyledTextCtrl(this, ID_ED);
// Default font
wxFont font(8, wxMODERN, wxNORMAL, wxNORMAL);
wxFont font(10, wxMODERN, wxNORMAL, wxNORMAL);
ed->StyleSetFont(wxSTC_STYLE_DEFAULT, font);
ed->StyleClearAll();
@@ -148,9 +146,9 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
ed->StyleSetBold(10, TRUE);
#ifdef __WXMSW__
ed->StyleSetSpec(2, "fore:#007f00,bold,face:Arial,size:7");
ed->StyleSetSpec(2, "fore:#007f00,bold,face:Arial,size:9");
#else
ed->StyleSetSpec(2, "fore:#007f00,bold,face:Helvetica,size:7");
ed->StyleSetSpec(2, "fore:#007f00,bold,face:Helvetica,size:9");
#endif
// give it some text to play with
@@ -181,14 +179,6 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
// event handlers
void MyFrame::OnStyleNeeded(wxStyledTextEvent& event) {
int currEndStyled = ed->GetEndStyled();
ed->Colourise(currEndStyled, event.GetPosition());
}
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
// TRUE is to force the frame to close

View File

@@ -1,6 +1,6 @@
# $Id$
CONTRIB_SUBDIRS=ogl mmedia stc xrc applet plot canvas animate fl
CONTRIB_SUBDIRS=ogl mmedia stc xrc plot canvas animate fl #applet
all:
@for d in $(CONTRIB_SUBDIRS); do (cd $$d && $(MAKE)); done

View File

@@ -16,8 +16,10 @@ HEADER_SUBDIR=plot
HEADERS=animate.h
OBJECTS=animate.o
DEPFILES=$(OBJECTS:.o=.d)
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makelib.env
-include $(DEPFILES)

View File

@@ -16,8 +16,10 @@ HEADER_SUBDIR=applet
HEADERS=applet.h appletwindow.h
OBJECTS=applet.o appletwindow.o
DEPFILES=$(OBJECTS:.o=.d)
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makelib.env
-include $(DEPFILES)

View File

@@ -37,10 +37,16 @@
#include "wx/spawnbrowser.h"
#include "wx/html/forcelnk.h"
// crt
#ifdef __WXMSW__
#include <process.h> // spawnl()
#endif
// Include private headers
#include "wx/applet/applet.h"
#include "wx/applet/window.h"
#include "wx/applet/loadpage.h"
#include "wx/applet/plugin.h"
// Preprocessor Stuff
#include "wx/applet/prepinclude.h"
@@ -101,6 +107,9 @@ wxHtmlAppletWindow::wxHtmlAppletWindow(
// Set up docroot
m_DocRoot = docroot;
// Set the key_type for applets
m_AppletList = wxAppletList(wxKEY_STRING);
// Add HTML preprocessors
// deleting preprocessors is done by the code within the window
@@ -157,10 +166,51 @@ wxApplet *wxHtmlAppletWindow::CreateApplet(
delete applet;
return NULL;
}
m_AppletList.Append(iName,applet);
else {
// do some fixups on the size if its screwed up
wxSize nsize = applet->GetBestSize();
if (nsize.x < size.x) nsize.x = size.x;
if (nsize.y < size.y) nsize.y = size.y;
applet->SetSize(nsize);
}
m_AppletList.Append(iName,(wxObject*)applet);
return applet;
}
/****************************************************************************
PARAMETERS:
classId - Name of the Plugin class to create an object for
RETURNS:
Pointer to the wxplugIn created, or NULL if unable to create the PlugIn.
REMARKS:
This function is used to create new wxPlugIn objects dynamically based on the
class name as a string. This allows instances of wxPlugIn classes to be
created dynamically based on string values embedded in the custom tags of an
HTML page.
****************************************************************************/
bool wxHtmlAppletWindow::CreatePlugIn(
const wxString& classId )
{
// Dynamically create the class instance at runtime
wxClassInfo *info = wxClassInfo::FindClass(classId.c_str());
if (!info)
return false;
wxObject *obj = info->CreateObject();
if (!obj)
return false;
wxPlugIn *plugIn = wxDynamicCast(obj,wxPlugIn);
if (!plugIn)
return false;
if (!plugIn->Create(this)) {
delete plugIn;
return false;
}
return true;
}
/****************************************************************************
PARAMETERS:
appletName - Name of the applet class to find
@@ -213,28 +263,41 @@ True if page loaded successfully, false if not
REMARKS:
Remove an applet from the manager. Called during applet destruction
****************************************************************************/
#include "scitech"
bool wxHtmlAppletWindow::LoadPage(
const wxString& link)
{
wxString href(link);
wxString href(link);
// Check for abs path. If it is not then tack on the path
// supplied at creation.
if (!wxIsAbsolutePath(href))
href = m_DocRoot + href;
// TODO: technically we allow no relative paths
// Check to see if it is a real url, if not it is a file
if (link.Mid(0, 5).CmpNoCase("http:") != 0) {
// Check for abs path. If it is not then tack on the path
// supplied at creation.
// TODO: Abs paths are only used in testing (remove this)
if (link.GetChar(1) != ':')
href = m_DocRoot + href;
}
// TODO: This needs to be made platform inde if possible.
if (link.GetChar(0) == '?'){
wxString cmd = link.BeforeFirst('=');
wxString cmdValue = link.AfterFirst('=');
// Launches the default Internet browser for the system.
if(!(cmd.CmpNoCase("?EXTERNAL"))){
return wxSpawnBrowser(this, cmdValue.c_str());
}
// Launches an external program on the system.
if (!(cmd.CmpNoCase("?EXECUTE"))){
wxProcess *child = new AppletProcess(this);
wxExecute(cmdValue, false, child);
return true;
int code = spawnl( P_NOWAIT, cmdValue , NULL );
return (!code);
}
// Looks for a href in a variable stored as a cookie. The href can be
// changed on the fly.
if (!(cmd.CmpNoCase("?VIRTUAL"))){
VirtualData& temp = *((VirtualData*)FindCookie(cmdValue));
if (&temp) {
@@ -247,6 +310,19 @@ bool wxHtmlAppletWindow::LoadPage(
return true;
}
}
// This launches a qlet - It is like an applet but is more generic in that it
// can be of any wxWin type so it then has the freedom to do more stuff.
if (!(cmd.CmpNoCase("?WXAPPLET"))){
if (!cmdValue.IsNull()){
if (!CreatePlugIn(cmdValue)){
#ifdef CHECKED
wxLogError(_T("Launch Applet ERROR: '%s' does not exist."), cmdValue.c_str());
#endif
}
}
return true;
}
}
// Inform all the applets that the new page is being loaded
@@ -528,8 +604,28 @@ TAG_HANDLER_PROC(tag)
wnd = m_WParser->GetWindow();
if ((appletWindow = wxDynamicCast(wnd,wxHtmlAppletWindow)) != NULL){
tag.ScanParam("WIDTH", "%i", &width);
tag.ScanParam("HEIGHT", "%i", &height);
wxSize size = wxDefaultSize;
int al;
if (tag.HasParam("WIDTH")) {
tag.GetParamAsInt("WIDTH", &width);
size.SetWidth(width);
}
if (tag.HasParam("HEIGHT")) {
tag.GetParamAsInt("HEIGHT", &height);
size.SetHeight(height);
}
al = wxHTML_ALIGN_BOTTOM;
if (tag.HasParam(wxT("ALIGN"))) {
wxString alstr = tag.GetParam(wxT("ALIGN"));
alstr.MakeUpper(); // for the case alignment was in ".."
if (alstr == wxT("TEXTTOP") || alstr == wxT("TOP"))
al = wxHTML_ALIGN_TOP;
else if ((alstr == wxT("CENTER")) || (alstr == wxT("ABSCENTER")))
al = wxHTML_ALIGN_CENTER;
}
if (tag.HasParam("CLASSID")){
classId = tag.GetParam("CLASSID");
if ( classId.IsNull() || classId.Len() == 0 ){
@@ -545,9 +641,9 @@ TAG_HANDLER_PROC(tag)
name = classId;
// We got all the params and can now create the applet
if ((applet = appletWindow->CreateApplet(classId, name, tag , wxSize(width, height))) != NULL){
if ((applet = appletWindow->CreateApplet(classId, name, tag , size)) != NULL){
applet->Show(true);
m_WParser->OpenContainer()->InsertCell(new wxHtmlWidgetCell(applet,0));
m_WParser->OpenContainer()->InsertCell(new wxHtmlAppletCell(applet,al));
}
else
wxMessageBox("wxApplet error: Could not create:" + classId + "," + name);
@@ -570,6 +666,81 @@ TAGS_MODULE_BEGIN(wxApplet)
TAGS_MODULE_ADD(wxApplet)
TAGS_MODULE_END(wxApplet)
/*********************************************************************************
wxHtmlAppletCell
*********************************************************************************/
wxHtmlAppletCell::wxHtmlAppletCell(wxWindow *wnd, int align) : wxHtmlCell()
{
int sx, sy;
m_Wnd = wnd;
m_Wnd->GetSize(&sx, &sy);
m_Width = sx, m_Height = sy;
switch (align) {
case wxHTML_ALIGN_TOP :
m_Descent = m_Height;
break;
case wxHTML_ALIGN_CENTER :
m_Descent = m_Height / 2;
break;
case wxHTML_ALIGN_BOTTOM :
default :
m_Descent = 0;
break;
}
SetCanLiveOnPagebreak(FALSE);
}
void wxHtmlAppletCell::Draw(wxDC& WXUNUSED(dc), int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(view_y1), int WXUNUSED(view_y2))
{
int absx = 0, absy = 0, stx, sty;
wxHtmlCell *c = this;
while (c)
{
absx += c->GetPosX();
absy += c->GetPosY();
c = c->GetParent();
}
((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
m_Wnd->Move(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty);
}
void wxHtmlAppletCell::DrawInvisible(wxDC& WXUNUSED(dc), int WXUNUSED(x), int WXUNUSED(y))
{
int absx = 0, absy = 0, stx, sty;
wxHtmlCell *c = this;
while (c)
{
absx += c->GetPosX();
absy += c->GetPosY();
c = c->GetParent();
}
((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
m_Wnd->Move(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty);
}
void wxHtmlAppletCell::Layout(int w)
{
int sx, sy;
m_Wnd->GetSize(&sx, &sy);
m_Width = sx, m_Height = sy;
wxHtmlCell::Layout(w);
}
// This is our little forcelink hack.
FORCE_LINK(loadpage)

View File

@@ -0,0 +1,60 @@
/****************************************************************************
*
* wxWindows HTML Applet Package
*
* Copyright (C) 1991-2001 SciTech Software, Inc.
* All rights reserved.
*
* ========================================================================
*
* The contents of this file are subject to the wxWindows License
* Version 3.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.wxwindows.org/licence3.txt
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* ========================================================================
*
* Language: ANSI C++
* Environment: Any
*
* Description: Main wxPlugIn class implementation
*
****************************************************************************/
// For compilers that support precompilation
#include "wx/wxprec.h"
// Include private headers
#include "wx/applet/plugin.h"
#include "wx/applet/window.h"
/*------------------------- Implementation --------------------------------*/
// Implement the abstract class functions
IMPLEMENT_ABSTRACT_CLASS(wxPlugIn, wxObject);
/****************************************************************************
REMARKS:
Psuedo virtual constructor for the wxPlugIn class.
****************************************************************************/
bool wxPlugIn::Create(
wxHtmlAppletWindow *parent)
{
m_parent = parent;
return true;
}
/****************************************************************************
REMARKS:
Destructor for the wxPlugIn class.
****************************************************************************/
wxPlugIn::~wxPlugIn()
{
}

View File

@@ -86,14 +86,19 @@ wxString wxIfElsePrep::Process(
{
int b;
char ft[] = "<!--#if ";
char ftnot[] = "<!--#if NOT ";
char ftnot2[] = "<!--#if !";
// make a copy so we can replace text as we go without affecting the original
wxString output = text;
while ((b = ReverseFind(output.Lower(), ft)) != -1) {
// Loop until every #echo directive is found
// Loop until every #if directive is found
// We search from the end of the string so that #if statements will properly recurse
// and we avoid the hassle of matching statements with the correct <!--#endif-->
int end, c, n;
bool notval = false;
int off = 0;
int end, c, n;
wxString usecode, code;
wxString cname;
wxString tag;
@@ -101,6 +106,15 @@ wxString wxIfElsePrep::Process(
code = wxString("");
if (output.Mid(b, strlen(ftnot) ).CmpNoCase(ftnot) == 0 ) {
notval = true;
off = 4;
}
else if (output.Mid(b, strlen(ftnot2) ).CmpNoCase(ftnot2) == 0 ) {
notval = true;
off = 1;
}
// grab the tag and get the name of the variable
end = (output.Mid(b)).Find("-->");
if (end == -1) {
@@ -118,10 +132,10 @@ wxString wxIfElsePrep::Process(
n = c;
// find the classname
c = (tag.Mid(8, n-8)).Find(" ");
if (c == -1) n -= 8;
c = (tag.Mid(8+off, n-(8+off))).Find(" ");
if (c == -1) n -= (8+off);
else n = c;
cname = tag.Mid(8, n);
cname = tag.Mid(8+off, n);
cname.Trim(false);
c = cname.Find("\"");
@@ -131,6 +145,7 @@ wxString wxIfElsePrep::Process(
// Grab the value from the variable class identified by cname
value = wxIfElseVariable::FindValue(cname);
if (notval) value = !value;
// Find the end of the tag (<!--#endif-->) and copy it all into the variable code
end = ((output.Mid(b)).Lower()).Find("<!--#endif-->");

View File

@@ -92,11 +92,11 @@ wxString wxIncludePrep::Process(
// remove the #include tag
output.Remove(i, n+21+3);
wxFSFile * file = fs->OpenFile(fname);
wxFSFile * file = fs->OpenFile(DOC_ROOT + fname);
if (!file) {
#ifdef CHECKED
wxMessageBox(wxString("wxHTML #include error: File not Found ") + fname + wxString("."),"Error",wxICON_ERROR);
wxMessageBox(wxString("wxHTML #include error: File not Found ") + DOC_ROOT + fname + wxString("."),"Error",wxICON_ERROR);
#endif
delete file;
continue;

View File

@@ -16,8 +16,10 @@ HEADER_SUBDIR=canvas
HEADERS=canvas.h bbox.h liner.h polygon.h
OBJECTS=canvas.o bbox.o liner.o polygon.o
DEPFILES=$(OBJECTS:.o=.d)
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makelib.env
-include $(DEPFILES)

View File

@@ -1,29 +1,62 @@
#
# File: Makefile
# Author: Hans Van Leemputten
# Created: 2001
# Updated:
# Copyright: (c) wxWorkshop team, 2001
#
# Makefile for wxWindows FrameLayout library (Linux/wxGTK).
# $Id$
top_srcdir = @top_srcdir@/..
top_builddir = ../../..
libsrc_dir = contrib/src/fl
TARGET_LIBNAME = libfl
OBJ_EXT = o
# Version Info.
LIBVERSION_CURRENT=1
LIBVERSION_REVISION=0
LIBVERSION_AGE=0
include ./files.lst
HEADER_PATH=$(top_srcdir)/contrib/include/wx
HEADER_SUBDIR=fl
OBJECTS = $(FL_OBJECTS)
HEADERS = \
bardragpl.h \
cbcustom.h \
dynbarhnd.h \
dyntbarhnd.h \
garbagec.h \
hintanimpl.h \
panedrawpl.h \
rowlayoutpl.h \
updatesmgr.h \
antiflickpl.h \
barhintspl.h \
controlbar.h \
dyntbar.h \
frmview.h \
gcupdatesmgr.h \
newbmpbtn.h \
rowdragpl.h \
toolwnd.h
OBJECTS = \
antiflickpl.o \
gcupdatesmgr.o \
rowlayoutpl.o \
bardragpl.o \
dyntbar.o \
hintanimpl.o \
toolwnd.o \
barhintspl.o \
dyntbarhnd.o \
newbmpbtn.o \
updatesmgr.o \
cbcustom.o \
frmview.o \
panedrawpl.o \
controlbar.o \
garbagec.o \
rowdragpl.o
DEPFILES= $(OBJECTS:.o=.d)
APPEXTRADEFS = -I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makelib.env
-include $(DEPFILES)

View File

@@ -125,10 +125,10 @@ void wxDynamicToolBar::AddTool( int toolIndex,
}
void wxDynamicToolBar::AddTool( int toolIndex,
const wxString& imageFileName,
int imageFileType,
const wxString& labelText, bool alignTextRight,
bool isFlat )
const wxString& imageFileName,
wxBitmapType imageFileType,
const wxString& labelText, bool alignTextRight,
bool isFlat )
{
wxNewBitmapButton* pBtn =

View File

@@ -228,7 +228,7 @@ wxNewBitmapButton::wxNewBitmapButton( const wxBitmap& labelBitmap,
mIsSticky( isSticky ),
mIsFlat( isFlat ),
mLabelText( labelText ),
mImageFileType( -1 ),
mImageFileType( wxBITMAP_TYPE_INVALID ),
mDepressedBmp( labelBitmap ),
mpDepressedImg( NULL ),
@@ -257,15 +257,15 @@ wxNewBitmapButton::wxNewBitmapButton( const wxBitmap& labelBitmap,
}
wxNewBitmapButton::wxNewBitmapButton( const wxString& bitmapFileName,
const int bitmapFileType,
const wxString& labelText,
int alignText,
bool isFlat,
int firedEventType,
int marginX,
int marginY,
int textToLabelGap,
bool isSticky)
const wxBitmapType bitmapFileType,
const wxString& labelText,
int alignText,
bool isFlat,
int firedEventType,
int marginX,
int marginY,
int textToLabelGap,
bool isSticky)
: mTextToLabelGap ( 2 ),
mMarginX( 2 ),

View File

@@ -16,8 +16,10 @@ HEADER_SUBDIR=gizmos
HEADERS=multicell.h splittree.h editlbox.h dynamicsash.h
OBJECTS=multicell.o splittree.o editlbox.o dynamicsash.o
DEPFILES=$(OBJECTS:.o=.d)
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makelib.env
-include $(DEPFILES)

View File

@@ -18,12 +18,14 @@ HEADERS=cdbase.h cdunix.h cdwin.h sndaiff.h sndbase.h sndcodec.h \
sndpcm.h sndulaw.h sndwav.h sndwin.h vidbase.h vidwin.h \
vidxanm.h
OBJECTS=cdbase.o cdwin.o g711.o g721.o g723_24.o \
OBJECTS=cdbase.o cdunix.o cdwin.o g711.o g721.o g723_24.o \
g723_40.o g72x.o sndaiff.o sndbase.o sndcodec.o \
sndcpcm.o sndfile.o sndg72x.o sndpcm.o sndulaw.o \
sndwav.o sndwin.o vidbase.o vidwin.o vidxanm.o sndoss.o sndesd.o
sndcpcm.o sndesd.o sndfile.o sndg72x.o sndmsad.o sndoss.o \
sndpcm.o sndulaw.o sndwav.o sndwin.o vidbase.o vidwin.o vidxanm.o
DEPFILES=$(OBJECTS:.o=.d)
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makelib.env
-include $(DEPFILES)

View File

@@ -16,8 +16,10 @@ HEADER_SUBDIR=plot
HEADERS=msg.h email.h web.h
OBJECTS=email.o web.o
DEPFILES=$(OBJECTS:.o=.d)
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makelib.env
-include $(DEPFILES)

View File

@@ -84,15 +84,23 @@ LIB32=link.exe -lib
# Name "NetVC - Win32 Debug"
# Begin Source File
SOURCE=.\smapi.cpp
# End Source File
# Begin Source File
SOURCE=.\email.cpp
# End Source File
# Begin Source File
SOURCE=.\web.cpp
SOURCE=..\..\include\wx\net\email.h
# End Source File
# Begin Source File
SOURCE=..\..\include\wx\net\msg.h
# End Source File
# Begin Source File
SOURCE=.\readme.txt
# End Source File
# Begin Source File
SOURCE=.\smapi.cpp
# End Source File
# Begin Source File
@@ -100,7 +108,11 @@ SOURCE=..\..\include\wx\net\smapi.h
# End Source File
# Begin Source File
SOURCE=.\readme.txt
SOURCE=.\web.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\wx\net\web.h
# End Source File
# End Target
# End Project

View File

@@ -31,11 +31,19 @@
#include "wx/net/smapi.h"
#endif
#ifdef __UNIX__
#include "wx/filefn.h"
#include "wx/timer.h"
#include "wx/wfstream.h"
#include "stdlib.h"
#include "unistd.h"
#endif
// Send a message.
// Specify profile, or leave it to wxWindows to find the current user name
#ifdef __WXMSW__
bool wxEmail::Send(wxMailMessage& message, const wxString& profileName)
bool wxEmail::Send(wxMailMessage& message, const wxString& profileName, const wxString& WXUNUSED(sendMail))
{
wxASSERT (message.m_to.GetCount() > 0) ;
@@ -52,6 +60,64 @@ bool wxEmail::Send(wxMailMessage& message, const wxString& profileName)
return session.Send(message);
}
#elif defined(__UNIX__)
bool wxEmail::Send(wxMailMessage& message, const wxString& profileName, const wxString& sendMail)
{
wxASSERT (message.m_to.GetCount() > 0) ;
// The 'from' field is optionally supplied by the app; it's not needed
// by MAPI, and on Unix, will be guessed if not supplied.
wxString from = message.m_from;
if (from.IsEmpty())
{
from = wxGetEmailAddress();
}
wxASSERT (!from.IsEmpty());
wxString msg;
msg << wxT("To: ");
size_t i;
for (i = 0; i < message.m_to.GetCount(); i++)
{
msg << message.m_to[i];
if (i < message.m_to.GetCount())
msg << wxT(", ");
}
msg << wxT("\nFrom: ") << from << wxT("\nSubject: ") << message.m_subject;
msg << wxT("\n\n") << message.m_body;
wxString filename;
filename.Printf(wxT("/tmp/msg-%ld-%ld-%ld.txt"), (long) getpid(), wxGetLocalTime(),
(long) rand());
{
wxFileOutputStream stream(filename);
if (stream.Ok())
{
stream.Write(msg, msg.Length());
}
else
{
return FALSE ;
}
}
// TODO search for a suitable sendmail if sendMail is empty
wxString sendmail(sendMail);
wxString cmd;
cmd << sendmail << wxT(" < ") << filename;
// TODO: check return code
wxSystem(cmd.c_str());
wxRemoveFile(filename);
return TRUE;
}
#else
#error Send not yet implemented for this platform.
#endif

View File

@@ -286,6 +286,17 @@ bool wxMapiSession::Send(wxMailMessage& message)
//Allocate the recipients array
mapiMessage.lpRecips = new MapiRecipDesc[mapiMessage.nRecipCount];
// If we have a 'From' field, use it
if (!message.m_from.IsEmpty())
{
mapiMessage.lpOriginator = new MapiRecipDesc;
ZeroMemory(mapiMessage.lpOriginator, sizeof(MapiRecipDesc));
mapiMessage.lpOriginator->ulRecipClass = MAPI_ORIG;
// TODO Do we have to call Resolve?
mapiMessage.lpOriginator->lpszName = (LPSTR) message.m_from.c_str();
}
//Setup the "To" recipients
int nRecipIndex = 0;
@@ -413,8 +424,9 @@ bool wxMapiSession::Send(wxMailMessage& message)
if (nAttachmentSize)
delete [] mapiMessage.lpFiles;
//Free up the Recipients memory
//Free up the Recipients and Originator memory
delete [] mapiMessage.lpRecips;
delete mapiMessage.lpOriginator;
return bSuccess;
}

View File

@@ -19,8 +19,10 @@ HEADERS=basic.h basicp.h bmpshape.h canvas.h composit.h constrnt.h \
OBJECTS=basic.o bmpshape.o composit.o divided.o lines.o misc.o \
basic2.o canvas.o constrnt.o drawn.o mfutils.o ogldiag.o
DEPFILES=$(OBJECTS:.o=.d)
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makelib.env
-include $(DEPFILES)

View File

@@ -338,6 +338,11 @@ wxShape::~wxShape()
if (m_canvas)
m_canvas->RemoveShape(this);
if (m_clientData) {
delete m_clientData;
m_clientData = NULL;
}
GetEventHandler()->OnDelete();
}

View File

@@ -16,8 +16,10 @@ HEADER_SUBDIR=plot
HEADERS=plot.h
OBJECTS=plot.o
DEPFILES=$(OBJECTS:.o=.d)
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makelib.env
-include $(DEPFILES)

View File

@@ -23,34 +23,44 @@ HEADER_SUBDIR=stc
HEADERS=stc.h
OBJECTS=PlatWX.o ScintillaWX.o stc.o \
DocumentAccessor.o \
LexCPP.o \
LexHTML.o \
LexLua.o \
LexOthers.o \
LexPerl.o \
LexPython.o \
LexSQL.o \
LexVB.o \
UniConversion.o \
WindowAccessor.o \
AutoComplete.o \
CallTip.o \
CellBuffer.o \
ContractionState.o \
Document.o \
DocumentAccessor.o \
Editor.o \
Indicator.o \
KeyMap.o \
KeyWords.o \
LexAVE.o \
LexAda.o \
LexCPP.o \
LexConf.o \
LexEiffel.o \
LexHTML.o \
LexLisp.o \
LexLua.o \
LexOthers.o \
LexPascal.o \
LexPerl.o \
LexPython.o \
LexRuby.o \
LexSQL.o \
LexVB.o \
LineMarker.o \
PropSet.o \
RESearch.o \
ScintillaBase.o \
Style.o \
UniConversion.o \
ViewStyle.o \
PosRegExp.o \
WindowAccessor.o \
DEPFILES=$(OBJECTS:.o=.d)
APPEXTRADEFS=-D__WX__ -DSCI_LEXER -I$(scintilla_dir)/src -I$(scintilla_dir)/include -I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makelib.env
-include $(DEPFILES)

View File

@@ -112,6 +112,8 @@ Font::~Font() {
}
void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic) {
// TODO: what to do about the characterSet?
Release();
id = new wxFont(size,
wxDEFAULT,
@@ -161,22 +163,21 @@ void Surface::Init() {
Release();
hdc = new wxMemoryDC();
hdcOwned = true;
// **** ::SetTextAlign(hdc, TA_BASELINE);
}
void Surface::Init(SurfaceID hdc_) {
Release();
hdc = hdc_;
// **** ::SetTextAlign(hdc, TA_BASELINE);
}
void Surface::InitPixMap(int width, int height, Surface *surface_) {
Release();
hdc = new wxMemoryDC(surface_->hdc);
hdcOwned = true;
if (width < 1) width = 1;
if (height < 1) height = 1;
bitmap = new wxBitmap(width, height);
((wxMemoryDC*)hdc)->SelectObject(*bitmap);
// **** ::SetTextAlign(hdc, TA_BASELINE);
}
void Surface::PenColour(Colour fore) {
@@ -199,7 +200,7 @@ int Surface::LogPixelsY() {
int Surface::DeviceHeightFont(int points) {
return points * LogPixelsY() / 72;
return points;
}
@@ -353,7 +354,7 @@ int Surface::AverageCharWidth(Font &font) {
}
int Surface::SetPalette(Palette *pal, bool inBackGround) {
return 0; // **** figure out what to do with palettes...
return 0;
}
void Surface::SetClip(PRectangle rc) {
@@ -697,6 +698,36 @@ void Platform::DebugPrintf(const char *format, ...) {
#endif
}
static bool assertionPopUps = true;
bool Platform::ShowAssertionPopUps(bool assertionPopUps_) {
bool ret = assertionPopUps;
assertionPopUps = assertionPopUps_;
return ret;
}
void Platform::Assert(const char *c, const char *file, int line) {
char buffer[2000];
sprintf(buffer, "Assertion [%s] failed at %s %d", c, file, line);
if (assertionPopUps) {
int idButton = wxMessageBox(buffer, "Assertion failure",
wxICON_HAND | wxOK);
// if (idButton == IDRETRY) {
// ::DebugBreak();
// } else if (idButton == IDIGNORE) {
// // all OK
// } else {
// abort();
// }
} else {
strcat(buffer, "\r\n");
Platform::DebugDisplay(buffer);
abort();
}
}
int Platform::Clamp(int val, int minVal, int maxVal) {
if (val > maxVal)
val = maxVal;

View File

@@ -93,7 +93,6 @@ END_EVENT_TABLE()
ScintillaWX::ScintillaWX(wxStyledTextCtrl* win) {
capturedMouse = false;
wMain = win;
wDraw = win;
stc = win;
wheelRotation = 0;
Initialise();
@@ -170,8 +169,8 @@ bool ScintillaWX::HaveMouseCapture() {
void ScintillaWX::ScrollText(int linesToMove) {
int dy = vs.lineHeight * (linesToMove);
// TODO: calculate the rectangle to refreshed...
wMain.GetID()->ScrollWindow(0, dy);
wMain.GetID()->Update();
}
void ScintillaWX::SetVerticalScrollPos() {
@@ -261,7 +260,7 @@ bool ScintillaWX::CanPaste() {
}
void ScintillaWX::CreateCallTipWindow(PRectangle) {
ct.wCallTip = new wxSTCCallTip(wDraw.GetID(), -1, &ct);
ct.wCallTip = new wxSTCCallTip(wMain.GetID(), -1, &ct);
ct.wDraw = ct.wCallTip;
}
@@ -365,17 +364,27 @@ void ScintillaWX::DoVScroll(int type, int pos) {
}
void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction) {
void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown) {
int topLineNew = topLine;
int lines;
wheelRotation += rotation;
lines = wheelRotation / delta;
wheelRotation -= lines * delta;
if (lines != 0) {
lines *= linesPerAction;
topLineNew -= lines;
ScrollTo(topLineNew);
if (ctrlDown) { // Zoom the fonts if Ctrl key down
if (rotation < 0) {
KeyCommand(SCI_ZOOMIN);
}
else {
KeyCommand(SCI_ZOOMOUT);
}
}
else { // otherwise just scroll the window
wheelRotation += rotation;
lines = wheelRotation / delta;
wheelRotation -= lines * delta;
if (lines != 0) {
lines *= linesPerAction;
topLineNew -= lines;
ScrollTo(topLineNew);
}
}
}
@@ -387,11 +396,11 @@ void ScintillaWX::DoSize(int width, int height) {
}
void ScintillaWX::DoLoseFocus(){
DropCaret();
SetFocusState(false);
}
void ScintillaWX::DoGainFocus(){
ShowCaretAtCurrentPosition();
SetFocusState(true);
}
void ScintillaWX::DoSysColourChange() {
@@ -418,31 +427,48 @@ void ScintillaWX::DoAddChar(char ch) {
// AutoCompleteChanged(ch);
}
int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt) {
int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed) {
#ifdef __WXGTK__
// Ctrl chars (A-Z) end up with the wrong keycode on wxGTK...
if (ctrl && key >= 1 && key <= 26)
key += 'A' - 1;
#endif
switch (key) {
case WXK_DOWN: key = SCK_DOWN; break;
case WXK_UP: key = SCK_UP; break;
case WXK_LEFT: key = SCK_LEFT; break;
case WXK_RIGHT: key = SCK_RIGHT; break;
case WXK_HOME: key = SCK_HOME; break;
case WXK_END: key = SCK_END; break;
case WXK_PRIOR: key = SCK_PRIOR; break;
case WXK_NEXT: key = SCK_NEXT; break;
case WXK_DELETE: key = SCK_DELETE; break;
case WXK_INSERT: key = SCK_INSERT; break;
case WXK_ESCAPE: key = SCK_ESCAPE; break;
case WXK_BACK: key = SCK_BACK; break;
case WXK_TAB: key = SCK_TAB; break;
case WXK_RETURN: key = SCK_RETURN; break;
case WXK_ADD: key = SCK_ADD; break;
case WXK_SUBTRACT: key = SCK_SUBTRACT; break;
case WXK_DIVIDE: key = SCK_DIVIDE; break;
case WXK_CONTROL: key = 0; break;
case WXK_ALT: key = 0; break;
case WXK_SHIFT: key = 0; break;
case WXK_DOWN: key = SCK_DOWN; break;
case WXK_UP: key = SCK_UP; break;
case WXK_LEFT: key = SCK_LEFT; break;
case WXK_RIGHT: key = SCK_RIGHT; break;
case WXK_HOME: key = SCK_HOME; break;
case WXK_END: key = SCK_END; break;
case WXK_PRIOR: key = SCK_PRIOR; break;
case WXK_NEXT: key = SCK_NEXT; break;
case WXK_DELETE: key = SCK_DELETE; break;
case WXK_INSERT: key = SCK_INSERT; break;
case WXK_ESCAPE: key = SCK_ESCAPE; break;
case WXK_BACK: key = SCK_BACK; break;
case WXK_TAB: key = SCK_TAB; break;
case WXK_RETURN: key = SCK_RETURN; break;
case WXK_ADD:
case WXK_NUMPAD_ADD:
key = SCK_ADD; break;
case WXK_SUBTRACT:
case WXK_NUMPAD_SUBTRACT:
key = SCK_SUBTRACT; break;
case WXK_DIVIDE:
case WXK_NUMPAD_DIVIDE:
key = SCK_DIVIDE; break;
case WXK_CONTROL: key = 0; break;
case WXK_ALT: key = 0; break;
case WXK_SHIFT: key = 0; break;
case WXK_MENU: key = 0; break;
}
return KeyDown(key, shift, ctrl, alt);
int rv = KeyDown(key, shift, ctrl, alt, consumed);
if (key)
return rv;
else
return 1;
}

View File

@@ -119,9 +119,9 @@ public:
void DoButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
void DoButtonUp(Point pt, unsigned int curTime, bool ctrl);
void DoButtonMove(Point pt);
void DoMouseWheel(int rotation, int delta, int linesPerAction);
void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown);
void DoAddChar(char ch);
int DoKeyDown(int key, bool shift, bool ctrl, bool alt);
int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed);
void DoTick() { Tick(); }
bool DoDropText(long x, long y, const wxString& data);

View File

@@ -12,15 +12,15 @@
#----------------------------------------------------------------------------
import sys, string, re
import sys, string, re, os
from fileinput import FileInput
IFACE = './scintilla/include/Scintilla.iface'
H_TEMPLATE = './stc.h.in'
CPP_TEMPLATE = './stc.cpp.in'
H_DEST = '../../include/wx/stc/stc.h'
CPP_DEST = './stc.cpp'
IFACE = os.path.abspath('./scintilla/include/Scintilla.iface')
H_TEMPLATE = os.path.abspath('./stc.h.in')
CPP_TEMPLATE = os.path.abspath('./stc.cpp.in')
H_DEST = os.path.abspath('../../include/wx/stc/stc.h')
CPP_DEST = os.path.abspath('./stc.cpp')
# Value prefixes to convert
@@ -108,15 +108,19 @@ methodOverrideMap = {
0),
'GetCurLine' : (0,
'wxString %s(int* OUTPUT=NULL);',
'#ifdef SWIG\n wxString %s(int* OUTPUT);\n#else\n wxString GetCurLine(int* linePos=NULL);\n#endif',
'''wxString %s(int* linePos) {
wxString text;
int len = LineLength(GetCurrentLine());
if (!len) return "";
char* buf = text.GetWriteBuf(len);
if (!len) {
if (linePos) *linePos = 0;
return "";
}
// Need an extra byte because SCI_GETCURLINE writes a null to the string
char* buf = text.GetWriteBuf(len+1);
int pos = SendMsg(%s, len, (long)buf);
int pos = SendMsg(%s, len+1, (long)buf);
text.UngetWriteBuf(len);
if (linePos) *linePos = pos;
@@ -215,6 +219,9 @@ methodOverrideMap = {
'AutoCGetChooseSingle' : ('AutoCompGetChooseSingle', 0, 0, 0),
'AutoCSetIgnoreCase' : ('AutoCompSetIgnoreCase', 0, 0, 0),
'AutoCGetIgnoreCase' : ('AutoCompGetIgnoreCase', 0, 0, 0),
'AutoCSetAutoHide' : ('AutoCompSetAutoHide', 0, 0, 0),
'AutoCGetAutoHide' : ('AutoCompGetAutoHide', 0, 0, 0),
'SetHScrollBar' : ('SetUseHorizontalScrollBar', 0, 0, 0),
'GetHScrollBar' : ('GetUseHorizontalScrollBar', 0, 0, 0),
@@ -343,11 +350,11 @@ methodOverrideMap = {
'''wxString %s() {
wxString text;
int len = GetTextLength()+1;
char* buff = text.GetWriteBuf(len);
int len = GetTextLength();
char* buff = text.GetWriteBuf(len+1); // leave room for the null...
SendMsg(%s, len, (long)buff);
text.UngetWriteBuf(len-1);
SendMsg(%s, len+1, (long)buff);
text.UngetWriteBuf(len);
return text;''',
('Retrieve all the text in the document.', )),
@@ -360,6 +367,38 @@ methodOverrideMap = {
'CallTipSetBack' : ('CallTipSetBackground', 0, 0, 0),
'ReplaceTarget' : (0,
'int %s(const wxString& text);',
'''
int %s(const wxString& text) {
return SendMsg(%s, text.Len(), (long)text.c_str());
''',
0),
'ReplaceTargetRE' : (0,
'int %s(const wxString& text);',
'''
int %s(const wxString& text) {
return SendMsg(%s, text.Len(), (long)text.c_str());
''',
0),
'SearchInTarget' : (0,
'int %s(const wxString& text);',
'''
int %s(const wxString& text) {
return SendMsg(%s, text.Len(), (long)text.c_str());
''',
0),
# Remove all methods that are key commands since they can be
# executed with CmdKeyExecute
'LineDown' : (None, 0, 0, 0),
@@ -417,7 +456,7 @@ methodOverrideMap = {
'SetDocPointer' : (0,
'void %s(void* docPointer);',
'''void %s(void* docPointer) {
SendMsg(%s, (long)docPointer);''',
SendMsg(%s, 0, (long)docPointer);''',
0),
'CreateDocument' : (0,
@@ -439,6 +478,9 @@ methodOverrideMap = {
0),
'GrabFocus' : (None, 0, 0, 0),
'SetFocus' : ('SetSTCFocus', 0, 0, 0),
'GetFocus' : ('GetSTCFocus', 0, 0, 0),
'' : ('', 0, 0, 0),
@@ -685,4 +727,3 @@ if __name__ == '__main__':
#----------------------------------------------------------------------------

View File

@@ -14,49 +14,48 @@
WXDIR = $(WXWIN)
SCINTILLA=.\scintilla
S=$(SCINTILLA)\src
STCEXTRACPPFLAGS=-D__WX__ -DSCI_LEXER -I$(SCINTILLA)/include -I$(S)
LIBTARGET=$(WXDIR)\lib\stc.lib
LIBTARGET=$(WXDIR)\contrib\lib\stc.lib
OBJECTS = \
AutoComplete.obj \
CallTip.obj \
CellBuffer.obj \
ContractionState.obj \
Document.obj \
DocumentAccessor.obj \
Editor.obj \
Indicator.obj \
KeyMap.obj \
KeyWords.obj \
LexCPP.obj \
LexHTML.obj \
LexLua.obj \
LexOthers.obj \
LexPerl.obj \
LexPython.obj \
LexSQL.obj \
LexVB.obj \
LineMarker.obj \
PropSet.obj \
PosRegExp.obj \
ScintillaBase.obj \
Style.obj \
UniConversion.obj \
ViewStyle.obj \
WindowAccessor.obj \
\
PlatWX.obj \
ScintillaWX.obj \
stc.obj \
AutoComplete.obj \
CallTip.obj \
CellBuffer.obj \
ContractionState.obj \
Document.obj \
DocumentAccessor.obj \
Editor.obj \
Indicator.obj \
KeyMap.obj \
KeyWords.obj \
LexCPP.obj \
LexHTML.obj \
LexLua.obj \
LexOthers.obj \
LexPerl.obj \
LexPython.obj \
LexSQL.obj \
LexVB.obj \
LineMarker.obj \
PosRegExp.obj \
PropSet.obj \
ScintillaBase.obj \
Style.obj \
UniConversion.obj \
ViewStyle.obj \
WindowAccessor.obj \
\
PlatWX.obj \
ScintillaWX.obj \
stc.obj \
!include $(WXDIR)\src\makelib.b32
all: stc.cfg $(LIBTARGET)
CFG = stc.cfg
CPPFLAGS=$(DLL_FLAGS) $(EXTRACPPFLAGS) @$(CFG)

View File

@@ -25,23 +25,31 @@ OBJECTS = \
$(D)\Indicator.obj \
$(D)\KeyMap.obj \
$(D)\KeyWords.obj \
$(D)\LexCPP.obj \
$(D)\LexHTML.obj \
$(D)\LexLua.obj \
$(D)\LexOthers.obj \
$(D)\LexPerl.obj \
$(D)\LexPython.obj \
$(D)\LexSQL.obj \
$(D)\LexVB.obj \
$(D)\LineMarker.obj \
$(D)\PosRegExp.obj \
$(D)\PropSet.obj \
$(D)\RESearch.obj \
$(D)\ScintillaBase.obj \
$(D)\Style.obj \
$(D)\UniConversion.obj \
$(D)\ViewStyle.obj \
$(D)\WindowAccessor.obj \
\
$(D)\LexAda.obj \
$(D)\LexAVE.obj \
$(D)\LexConf.obj \
$(D)\LexCPP.obj \
$(D)\LexEiffel.obj \
$(D)\LexHTML.obj \
$(D)\LexLisp.obj \
$(D)\LexLua.obj \
$(D)\LexOthers.obj \
$(D)\LexPascal.obj \
$(D)\LexPerl.obj \
$(D)\LexPython.obj \
$(D)\LexRuby.obj \
$(D)\LexSQL.obj \
$(D)\LexVB.obj \
\
$(D)\PlatWX.obj \
$(D)\ScintillaWX.obj \
$(D)\stc.obj \

View File

@@ -3,5 +3,5 @@ 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.32
The current version of the Scintilla code is 1.39

View File

@@ -1,6 +1,8 @@
// SciTE - Scintilla based Text Editor
// Accessor.h - rapid easy access to contents of a Scintilla
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// Scintilla source code edit control
/** @file Accessor.h
** Rapid easy access to contents of a Scintilla.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8};
@@ -9,12 +11,16 @@ class Accessor;
typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len);
// Interface to data in a Scintilla
/**
* Interface to data in a Scintilla.
*/
class Accessor {
protected:
enum {extremePosition=0x7FFFFFFF};
// bufferSize is a trade off between time taken to copy the characters and retrieval overhead
// slopSize positions the buffer before the desired position in case there is some backtracking
/** @a bufferSize is a trade off between time taken to copy the characters
* and retrieval overhead.
* @a slopSize positions the buffer before the desired position
* in case there is some backtracking. */
enum {bufferSize=4000, slopSize=bufferSize/8};
char buf[bufferSize+1];
int startPos;
@@ -23,6 +29,7 @@ protected:
virtual bool InternalIsLeadByte(char ch)=0;
virtual void Fill(int position)=0;
public:
Accessor() : startPos(extremePosition), endPos(0), codePage(0) {}
virtual ~Accessor() {}
@@ -32,8 +39,8 @@ public:
}
return buf[position - startPos];
}
/** Safe version of operator[], returning a defined value for invalid position. */
char SafeGetCharAt(int position, char chDefault=' ') {
// Safe version of operator[], returning a defined value for invalid position
if (position < startPos || position >= endPos) {
Fill(position);
if (position < startPos || position >= endPos) {
@@ -57,6 +64,7 @@ public:
virtual int GetLineState(int line)=0;
virtual int SetLineState(int line, int state)=0;
virtual int GetPropertyInt(const char *key, int defaultValue=0)=0;
virtual char *GetProperties()=0;
// Style setting
virtual void StartAt(unsigned int start, char chMask=31)=0;
@@ -67,4 +75,3 @@ public:
virtual void SetLevel(int line, int level)=0;
virtual int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0)=0;
};

View File

@@ -1,32 +1,59 @@
// SciTE - Scintilla based Text Editor
// KeyWords.h - colourise for particular languages
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// Scintilla source code edit control
/** @file KeyWords.h
** Colourise for particular languages.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
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
* module appropriate to a particular language.
*/
class LexerModule {
static LexerModule *base;
protected:
LexerModule *next;
int language;
LexerFunction fn;
const char *languageName;
LexerFunction fnLexer;
LexerFunction fnFolder;
static LexerModule *base;
static int nextLanguage;
public:
LexerModule(int language_, LexerFunction fn_);
static void Colourise(unsigned int startPos, int lengthDoc, int initStyle,
int language, WordList *keywordlists[], Accessor &styler);
LexerModule(int language_, LexerFunction fnLexer_,
const char *languageName_=0, LexerFunction fnFolder_=0);
int GetLanguage() { return language; }
virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler);
virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler);
static LexerModule *Find(int language);
static LexerModule *Find(const char *languageName);
};
/**
* Check if a character is a space.
* This is ASCII specific but is safe with chars >= 0x80.
*/
inline bool isspacechar(unsigned char ch) {
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
}
inline bool iswordchar(char ch) {
return isalnum(ch) || ch == '.' || ch == '_';
return isascii(ch) && (isalnum(ch) || ch == '.' || ch == '_');
}
inline bool iswordstart(char ch) {
return isalnum(ch) || ch == '_';
return isascii(ch) && (isalnum(ch) || ch == '_');
}
inline bool isoperator(char ch) {
if (isalnum(ch))
if (isascii(ch) && isalnum(ch))
return false;
// '.' left out as it is used to make up numbers
if (ch == '%' || ch == '^' || ch == '&' || ch == '*' ||
@@ -38,4 +65,3 @@ inline bool isoperator(char ch) {
return true;
return false;
}

View File

@@ -1,18 +1,21 @@
// Scintilla source code edit control
// Platform.h - interface to platform facilities
// Also includes some basic utilities
// Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWindows
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file Platform.h
** Interface to platform facilities. Also includes some basic utilities.
** Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWindows.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef PLATFORM_H
#define PLATFORM_H
// PLAT_GTK = GTK+ on Linux, PLAT_WIN = Win32 API on Win32 OS
// PLAT_GTK = GTK+ on Linux or Win32
// PLAT_GTK_WIN32 is defined additionally when running PLAT_GTK under Win32
// PLAT_WIN = Win32 API on Win32 OS
// PLAT_WX is wxWindows on any supported platform
// Could also have PLAT_GTKWIN = GTK+ on Win32 OS in future
#define PLAT_GTK 0
#define PLAT_GTK_WIN32 0
#define PLAT_WIN 0
#define PLAT_WX 0
@@ -24,6 +27,11 @@
#undef PLAT_GTK
#define PLAT_GTK 1
#ifdef _MSC_VER
#undef PLAT_GTK_WIN32
#define PLAT_GTK_WIN32 1
#endif
#else
#undef PLAT_WIN
#define PLAT_WIN 1
@@ -34,6 +42,9 @@
// Include the main header for each platform
#if PLAT_GTK
#ifdef _MSC_VER
#pragma warning(disable: 4505 4514 4710 4800)
#endif
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#endif
@@ -42,7 +53,7 @@
#define _WIN32_WINNT 0x0400 // Otherwise some required stuff gets ifdef'd out
// Vassili Bourdo: shut up annoying Visual C++ warnings:
#ifdef _MSC_VER
#pragma warning(disable: 4800 4244 4309)
#pragma warning(disable: 4244 4309 4710 4800)
#endif
#include <windows.h>
#include <commctrl.h>
@@ -80,23 +91,28 @@ typedef wxWindow* WindowID;
typedef wxMenu* MenuID;
#endif
// Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably
/**
* A geometric point class.
* Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably.
*/
class Point {
public:
int x;
int y;
Point(int x_=0, int y_=0) : x(x_), y(y_) {
}
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
static Point FromLong(long lpoint);
};
// PRectangle is exactly the same as the Win32 RECT so can be used interchangeably
// PRectangles contain their top and left sides, but not their right and bottom sides
/**
* A geometric rectangle class.
* PRectangle is exactly the same as the Win32 RECT so can be used interchangeably.
* PRectangles contain their top and left sides, but not their right and bottom sides.
*/
class PRectangle {
public:
int left;
@@ -110,6 +126,10 @@ public:
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
bool operator==(PRectangle &rc) {
return (rc.left == left) && (rc.right == right) &&
(rc.top == top) && (rc.bottom == bottom);
}
bool Contains(Point pt) {
return (pt.x >= left) && (pt.x <= right) &&
(pt.y >= top) && (pt.y <= bottom);
@@ -131,6 +151,9 @@ wxRect wxRectFromPRectangle(PRectangle prc);
PRectangle PRectangleFromwxRect(wxRect rc);
#endif
/**
* A colour class.
*/
class Colour {
ColourID co;
public:
@@ -141,15 +164,17 @@ public:
unsigned int GetRed();
unsigned int GetGreen();
unsigned int GetBlue();
friend class Surface;
friend class Palette;
};
// Colour pairs hold a desired colour and the colour that the graphics engine
// allocates to approximate the desired colour.
// To make palette management more automatic, ColourPairs could register at
// construction time with a palette management object.
/**
* Colour pairs hold a desired colour and the colour that the graphics engine
* allocates to approximate the desired colour.
* To make palette management more automatic, ColourPairs could register at
* construction time with a palette management object.
*/
struct ColourPair {
Colour desired;
Colour allocated;
@@ -162,6 +187,9 @@ struct ColourPair {
class Window; // Forward declaration for Palette
/**
* Colour palette management.
*/
class Palette {
int used;
enum {numEntries = 100};
@@ -176,22 +204,27 @@ class Palette {
#endif
public:
bool allowRealization;
Palette();
~Palette();
void Release();
// This method either adds a colour to the list of wanted colours (want==true)
// or retrieves the allocated colour back to the ColourPair.
// This is one method to make it easier to keep the code for wanting and retrieving in sync.
/**
* This method either adds a colour to the list of wanted colours (want==true)
* or retrieves the allocated colour back to the ColourPair.
* This is one method to make it easier to keep the code for wanting and retrieving in sync.
*/
void WantFind(ColourPair &cp, bool want);
void Allocate(Window &w);
friend class Surface;
};
/**
* Font management.
*/
class Font {
protected:
FontID id;
@@ -214,7 +247,9 @@ public:
friend class Surface;
};
// A surface abstracts a place to draw
/**
* A surface abstracts a place to draw.
*/
class Surface {
private:
bool unicodeMode;
@@ -256,7 +291,7 @@ private:
public:
Surface();
~Surface();
void Init();
void Init(SurfaceID hdc_);
void InitPixMap(int width, int height, Surface *surface_);
@@ -287,7 +322,7 @@ public:
int ExternalLeading(Font &font_);
int Height(Font &font_);
int AverageCharWidth(Font &font_);
int SetPalette(Palette *pal, bool inBackGround);
void SetClip(PRectangle rc);
void FlushCachedState();
@@ -297,8 +332,10 @@ public:
}
};
// Class to hide the details of window manipulation
// Does not own the window which will normally have a longer life than this object
/**
* Class to hide the details of window manipulation.
* Does not own the window which will normally have a longer life than this object.
*/
class Window {
friend class ListBox;
protected:
@@ -333,6 +370,9 @@ public:
#endif
};
/**
* Listbox management.
*/
class ListBox : public Window {
#if PLAT_GTK
WindowID list;
@@ -360,6 +400,9 @@ public:
void Sort();
};
/**
* Menu management.
*/
class Menu {
MenuID id;
public:
@@ -370,8 +413,10 @@ public:
void Show(Point pt, Window &w);
};
// Platform class used to retrieve system wide parameters such as double click speed
// and chrome colour. Not a creatable object, more of a module with several functions.
/**
* Platform class used to retrieve system wide parameters such as double click speed
* and chrome colour. Not a creatable object, more of a module with several functions.
*/
class Platform {
// Private so Platform objects can not be copied
Platform(const Platform &) {}
@@ -390,7 +435,7 @@ public:
static bool IsKeyDown(int key);
static long SendScintilla(
WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0);
// These are utility functions not really tied to a platform
static int Minimum(int a, int b);
static int Maximum(int a, int b);
@@ -405,7 +450,15 @@ public:
return static_cast<short>(x & 0xffff);
}
static void DebugPrintf(const char *format, ...);
static bool ShowAssertionPopUps(bool assertionPopUps_);
static void Assert(const char *c, const char *file, int line);
static int Clamp(int val, int minVal, int maxVal);
};
#ifdef NDEBUG
#define PLATFORM_ASSERT(c) ((void)0)
#else
#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Platform::Assert(#c, __FILE__, __LINE__))
#endif
#endif

View File

@@ -1,138 +0,0 @@
#ifndef POSREGEXP_H
#define POSREGEXP_H
#define MatchesNum 0x10
enum EOps
{
ReBlockOps = 0x1000,
ReMul, // *
RePlus, // +
ReQuest, // ?
ReNGMul, // *?
ReNGPlus, // +?
ReNGQuest, // ??
ReRangeN, // {n,}
ReRangeNM, // {n,m}
ReNGRangeN, // {n,}?
ReNGRangeNM, // {n,m}?
ReOr, // |
ReBehind = 0x1100, // ?#n
ReNBehind = 0x1200, // ?~n
ReAhead = 0x1300, // ?=
ReNAhead = 0x1400, // ?!
ReSymbolOps = 0x2000,
ReEmpty,
ReSymb, // a b \W \s ...
ReEnum, // []
ReNEnum, // [^]
ReBrackets, // (...)
ReBkTrace = 0x2100, // \yN
ReBkBrack = 0x2200 // \N
};
enum ESymbols
{
ReAnyChr = 0x4000, // .
ReSoL, // ^
ReEoL, // $
ReDigit, // \d
ReNDigit, // \D
ReWordSymb, // \w
ReNWordSymb, // \W
ReWSpace, // \s
ReNWSpace, // \S
ReUCase, // \u
ReNUCase , // \l
ReWBound, // \b
ReNWBound, // \B
RePreNW, // \c
ReStart, // \m
ReEnd, // \M
ReChr = 0x0 // Char in Lower Byte
};
enum ETempSymb
{
ReTemp = 0x7000,
ReLBrack, ReRBrack,
ReEnumS, ReEnumE, ReNEnumS,
ReRangeS, ReRangeE, ReNGRangeE, ReFrToEnum
};
#define BackSlash '\\'
typedef union SCharData
{
int IArr[8];
char CArr[32];
void SetBit(unsigned char Bit);
void ClearBit(unsigned char Bit);
bool GetBit(unsigned char Bit);
} *PCharData;
typedef struct SRegInfo
{
SRegInfo();
~SRegInfo();
EOps Op;
union{
SRegInfo *Param;
int Symb;
PCharData ChrClass;
}un;
int s,e;
SRegInfo *Parent;
SRegInfo *Next;
} *PRegInfo;
typedef struct SMatches
{
int s[MatchesNum];
int e[MatchesNum];
int CurMatch;
} *PMatches;
typedef class PosRegExp
{
PRegInfo Info;
PMatches BkTrace;
bool NoCase,Extend,NoMoves;
bool Error;
int *Exprn;
int posParse;
int posEnd,posStart;
int posBkStr;
int FirstChar;
bool SetExprLow(const char *Expr);
bool SetStructs(PRegInfo &Info,int st,int end);
void Optimize();
bool CheckSymb(int Symb,bool Inc);
bool LowParse(PRegInfo Re);
bool LowParseRe(PRegInfo &Next);
bool LowCheckNext(PRegInfo Re);
bool ParseRe(int posStr);
bool QuickCheck();
public:
PMatches Matches;
int Ok, CurMatch;
void *param;
char (*CharAt)(int pos, void *param);
PosRegExp();
~PosRegExp();
bool isok();
bool SetNoMoves(bool Moves);
bool SetBkTrace(int posStr,PMatches Trace);
bool SetExpr(const char *Expr);
bool Parse(int posStr, int posStop, PMatches Mtch);
bool Parse(int posStr,int posSol, int posEol, PMatches Mtch, int Moves = -1);
bool Evaluate(char *Expr, int posStr, PMatches Mtch, char **Res);
} *PPosRegExp;
#endif /* POSREGEXP_H */

View File

@@ -1,188 +1,17 @@
// SciTE - Scintilla based Text Editor
// PropSet.h - a java style properties file module
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// Scintilla source code edit control
/** @file PropSet.h
** A Java style properties file module.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef PROPSET_H
#define PROPSET_H
#include "SString.h"
bool EqualCaseInsensitive(const char *a, const char *b);
#if PLAT_WIN
#define strcasecmp stricmp
#define strncasecmp strnicmp
#endif
#ifdef __WXMSW__
#define strcasecmp stricmp
#define strncasecmp strnicmp
#endif
// Define another string class.
// While it would be 'better' to use std::string, that doubles the executable size.
inline char *StringDup(const char *s, int len=-1) {
if (!s)
return 0;
if (len == -1)
len = strlen(s);
char *sNew = new char[len + 1];
if (sNew) {
strncpy(sNew, s, len);
sNew[len] = '\0';
}
return sNew;
}
class SString {
char *s;
int ssize;
public:
typedef const char* const_iterator;
typedef int size_type;
static size_type npos;
const char* begin(void) const {
return s;
}
const char* end(void) const {
return &s[ssize];
}
size_type size(void) const {
if (s)
return ssize;
else
return 0;
}
SString &assign(const char* sother, int size_ = -1) {
char *t = s;
s = StringDup(sother,size_);
ssize = (s) ? strlen(s) : 0;
delete []t;
return *this;
}
SString &assign(const SString& sother, int size_ = -1) {
return assign(sother.s,size_);
}
SString &assign(const_iterator ibeg, const_iterator iend) {
return assign(ibeg,iend - ibeg);
}
SString() {
s = 0;
ssize = 0;
}
SString(const SString &source) {
s = StringDup(source.s);
ssize = (s) ? strlen(s) : 0;
}
SString(const char *s_) {
s = StringDup(s_);
ssize = (s) ? strlen(s) : 0;
}
SString(int i) {
char number[100];
sprintf(number, "%0d", i);
s = StringDup(number);
ssize = (s) ? strlen(s) : 0;
}
~SString() {
delete []s;
s = 0;
ssize = 0;
}
SString &operator=(const SString &source) {
if (this != &source) {
delete []s;
s = StringDup(source.s);
ssize = (s) ? strlen(s) : 0;
}
return *this;
}
bool operator==(const SString &other) const {
if ((s == 0) && (other.s == 0))
return true;
if ((s == 0) || (other.s == 0))
return false;
return strcmp(s, other.s) == 0;
}
bool operator!=(const SString &other) const {
return !operator==(other);
}
bool operator==(const char *sother) const {
if ((s == 0) && (sother == 0))
return true;
if ((s == 0) || (sother == 0))
return false;
return strcmp(s, sother) == 0;
}
bool operator!=(const char *sother) const {
return !operator==(sother);
}
const char *c_str() const {
if (s)
return s;
else
return "";
}
int length() const {
if (s)
return strlen(s);
else
return 0;
}
char operator[](int i) const {
if (s)
return s[i];
else
return '\0';
}
SString &operator +=(const char *sother) {
return append(sother,-1);
}
SString &operator +=(const SString &sother) {
return append(sother.s,sother.ssize);
}
SString &operator +=(char ch) {
return append(&ch,1);
}
SString &append(const char* sother, int lenOther) {
int len = length();
if(lenOther < 0)
lenOther = strlen(sother);
char *sNew = new char[len + lenOther + 1];
if (sNew) {
if (s)
memcpy(sNew, s, len);
strncpy(&sNew[len], sother, lenOther);
sNew[len + lenOther] = '\0';
delete []s;
s = sNew;
ssize = (s) ? strlen(s) : 0;
}
return *this;
}
int value() const {
if (s)
return atoi(s);
else
return 0;
}
void substitute(char find, char replace) {
char *t = s;
while (t) {
t = strchr(t, find);
if (t)
*t = replace;
}
}
// I don't think this really belongs here -- Neil
void correctPath() {
#ifdef unix
substitute('\\', '/');
#else
substitute('/', '\\');
#endif
}
};
bool isprefix(const char *target, const char *prefix);
struct Property {
unsigned int hash;
@@ -192,53 +21,66 @@ struct Property {
Property() : hash(0), key(0), val(0), next(0) {}
};
/**
*/
class PropSet {
private:
enum { hashRoots=31 };
Property *props[hashRoots];
Property *enumnext;
int enumhash;
public:
PropSet *superPS;
PropSet();
~PropSet();
void Set(const char *key, const char *val);
void Set(char *keyval);
void Set(const char *key, const char *val, int lenKey=-1, int lenVal=-1);
void Set(const char *keyVal);
void SetMultiple(const char *s);
SString Get(const char *key);
SString GetExpanded(const char *key);
SString Expand(const char *withvars);
SString Expand(const char *withVars);
int GetInt(const char *key, int defaultValue=0);
SString GetWild(const char *keybase, const char *filename);
SString GetNewExpand(const char *keybase, const char *filename);
void Clear();
void ReadFromMemory(const char *data, int len, const char *directoryForImports=0);
void Read(const char *filename, const char *directoryForImports);
char *ToString(); // Caller must delete[] the return value
bool GetFirst(char **key, char **val);
bool GetNext(char **key, char **val);
};
/**
*/
class WordList {
public:
// Each word contains at least one character - a empty word acts as sentinal at the end.
// Each word contains at least one character - a empty word acts as sentinel at the end.
char **words;
char **wordsNoCase;
char *list;
int len;
bool onlyLineEnds; // Delimited by any white space or only line ends
bool onlyLineEnds; ///< Delimited by any white space or only line ends
bool sorted;
int starts[256];
WordList(bool onlyLineEnds_ = false) :
WordList(bool onlyLineEnds_ = false) :
words(0), wordsNoCase(0), list(0), len(0), onlyLineEnds(onlyLineEnds_), sorted(false) {}
~WordList() { Clear(); }
operator bool() { return words ? true : false; }
const char *operator[](int ind) { return words[ind]; }
operator bool() { return len ? true : false; }
char *operator[](int ind) { return words[ind]; }
void Clear();
void Set(const char *s);
char *Allocate(int size);
void SetFromAllocated();
bool InList(const char *s);
const char *GetNearestWord(const char *wordStart, int searchLen = -1, bool ignoreCase = false);
char *GetNearestWords(const char *wordStart, int searchLen = -1, bool ignoreCase = false);
char *GetNearestWords(const char *wordStart, int searchLen=-1,
bool ignoreCase=false, char otherSeparator='\0');
};
inline bool nonFuncChar(char ch) {
return strchr("\t\n\r !\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~", ch) != NULL;
}
inline bool IsAlphabetic(unsigned int ch) {
return ((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z'));
}
#endif

View File

@@ -0,0 +1,255 @@
// SciTE - Scintilla based Text Editor
/** @file SString.h
** A simple string class.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef SSTRING_H
#define SSTRING_H
// These functions are implemented because each platform calls them something different
int CompareCaseInsensitive(const char *a, const char *b);
int CompareNCaseInsensitive(const char *a, const char *b, int len);
bool EqualCaseInsensitive(const char *a, const char *b);
// Define another string class.
// While it would be 'better' to use std::string, that doubles the executable size.
// An SString may contain embedded nul characters.
/**
* Duplicate a C string.
* Allocate memory of the given size, or big enough to fit the string if length isn't given;
* then copy the given string in the allocated memory.
* @return the pointer to the new string
*/
inline char *StringDup(
const char *s, ///< The string to duplicate
int len=-1) ///< The length of memory to allocate. Optional.
{
if (!s)
return 0;
if (len == -1)
len = strlen(s);
char *sNew = new char[len + 1];
if (sNew) {
strncpy(sNew, s, len);
sNew[len] = '\0';
}
return sNew;
}
/**
* @brief A simple string class.
* Hold the length of the string for quick operations,
* can have a buffer bigger than the string to avoid too many memory allocations and copies.
* May have embedded zeroes as a result of @a substitute, but rely too heavily on C string
* functions to allow reliable manipulations of these strings.
**/
class SString {
char *s; ///< The C string
int sSize; ///< The size of the buffer, less 1: ie. the maximum size of the string
int sLen; ///< The size of the string in s
int sizeGrowth; ///< Minimum growth size when appending strings
enum { sizeGrowthDefault = 64 };
public:
typedef int size_type;
SString() : s(0), sSize(0), sLen(0), sizeGrowth(sizeGrowthDefault) {
}
SString(const SString &source) : sizeGrowth(sizeGrowthDefault) {
s = StringDup(source.s);
sSize = sLen = (s) ? strlen(s) : 0;
}
SString(const char *s_) : sizeGrowth(sizeGrowthDefault) {
s = StringDup(s_);
sSize = sLen = (s) ? strlen(s) : 0;
}
SString(const char *s_, int first, int last) : sizeGrowth(sizeGrowthDefault) {
s = StringDup(s_ + first, last - first);
sSize = sLen = (s) ? strlen(s) : 0;
}
SString(int i) : sizeGrowth(sizeGrowthDefault) {
char number[32];
sprintf(number, "%0d", i);
s = StringDup(number);
sSize = sLen = (s) ? strlen(s) : 0;
}
~SString() {
delete []s;
s = 0;
sSize = 0;
sLen = 0;
}
void clear(void) {
if (s) {
*s = '\0';
}
sLen = 0;
}
/** Size of buffer. */
size_type size(void) const { ///<
if (s)
return sSize;
else
return 0;
}
/** Size of string in buffer. */
int length() const {
return sLen;
}
SString &assign(const char* sOther, int sSize_ = -1) {
if (!sOther) {
sSize_ = 0;
}
if (sSize_ < 0) {
sSize_ = strlen(sOther);
}
if (sSize > 0 && sSize_ <= sSize) { // Does not allocate new buffer if the current is big enough
if (s && sSize_) {
strncpy(s, sOther, sSize_);
}
s[sSize_] = '\0';
sLen = sSize_;
} else {
delete []s;
s = StringDup(sOther, sSize_);
if (s) {
sSize = sSize_; // Allow buffer bigger than real string, thus providing space to grow
sLen = strlen(s);
} else {
sSize = sLen = 0;
}
}
return *this;
}
SString &assign(const SString& sOther, int sSize_ = -1) {
return assign(sOther.s, sSize_);
}
SString &operator=(const char *source) {
return assign(source);
}
SString &operator=(const SString &source) {
if (this != &source) {
assign(source.c_str());
}
return *this;
}
bool operator==(const SString &sOther) const {
if ((s == 0) && (sOther.s == 0))
return true;
if ((s == 0) || (sOther.s == 0))
return false;
return strcmp(s, sOther.s) == 0;
}
bool operator!=(const SString &sOther) const {
return !operator==(sOther);
}
bool operator==(const char *sOther) const {
if ((s == 0) && (sOther == 0))
return true;
if ((s == 0) || (sOther == 0))
return false;
return strcmp(s, sOther) == 0;
}
bool operator!=(const char *sOther) const {
return !operator==(sOther);
}
bool contains(char ch) {
if (s && *s)
return strchr(s, ch) != 0;
else
return false;
}
void setsizegrowth(int sizeGrowth_) {
sizeGrowth = sizeGrowth_;
}
const char *c_str() const {
if (s)
return s;
else
return "";
}
/** Give ownership of buffer to caller which must use delete[] to free buffer. */
char *detach() {
char *sRet = s;
s = 0;
sSize = 0;
sLen = 0;
return sRet;
}
char operator[](int i) const {
if (s && i < sSize) // Or < sLen? Depends on the use, both are OK
return s[i];
else
return '\0';
}
SString &append(const char* sOther, int sLenOther=-1, char sep=0) {
if (sLenOther < 0)
sLenOther = strlen(sOther);
int lenSep = 0;
if (sLen && sep) // Only add a separator if not empty
lenSep = 1;
int lenNew = sLen + sLenOther + lenSep;
if (lenNew + 1 < sSize) {
// Conservative about growing the buffer: don't do it, unless really needed
if (lenSep) {
s[sLen] = sep;
sLen++;
}
strncpy(&s[sLen], sOther, sLenOther);
s[sLen + sLenOther] = '\0';
sLen += sLenOther;
} else {
// Grow the buffer bigger than really needed, to have room for other appends
char *sNew = new char[lenNew + sizeGrowth + 1];
if (sNew) {
if (s) {
memcpy(sNew, s, sLen);
delete []s;
}
s = sNew;
sSize = lenNew + sizeGrowth;
if (lenSep) {
s[sLen] = sep;
sLen++;
}
strncpy(&s[sLen], sOther, sLenOther);
sNew[sLen + sLenOther] = '\0';
sLen += sLenOther;
}
}
return *this;
}
SString &operator +=(const char *sOther) {
return append(sOther, -1);
}
SString &operator +=(const SString &sOther) {
return append(sOther.s, sOther.sSize);
}
SString &operator +=(char ch) {
return append(&ch, 1);
}
SString &appendwithseparator(const char* sOther, char sep) {
return append(sOther, strlen(sOther), sep);
}
int value() const {
if (s)
return atoi(s);
else
return 0;
}
void substitute(char find, char replace) {
char *t = s;
while (t) {
t = strchr(t, find);
if (t) {
*t = replace;
t++;
}
}
}
};
#endif

View File

@@ -1,6 +1,8 @@
// Scintilla source code edit control
// SciLexer - interface to the added lexer functions in the SciLexer version of the edit control
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file SciLexer.h
** Interface to the added lexer functions in the SciLexer version of the edit control.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
// Most of this file is automatically generated from the Scintilla.iface interface definition
@@ -29,6 +31,16 @@
#define SCLEX_LATEX 14
#define SCLEX_LUA 15
#define SCLEX_DIFF 16
#define SCLEX_CONF 17
#define SCLEX_PASCAL 18
#define SCLEX_AVE 19
#define SCLEX_ADA 20
#define SCLEX_LISP 21
#define SCLEX_RUBY 22
#define SCLEX_EIFFEL 23
#define SCLEX_EIFFELKW 24
#define SCLEX_TCL 25
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
#define SCE_P_NUMBER 2
@@ -57,6 +69,9 @@
#define SCE_C_IDENTIFIER 11
#define SCE_C_STRINGEOL 12
#define SCE_C_VERBATIM 13
#define SCE_C_REGEX 14
#define SCE_C_COMMENTLINEDOC 15
#define SCE_C_WORD2 16
#define SCE_H_DEFAULT 0
#define SCE_H_TAG 1
#define SCE_H_TAGUNKNOWN 2
@@ -77,6 +92,8 @@
#define SCE_H_CDATA 17
#define SCE_H_QUESTION 18
#define SCE_H_VALUE 19
#define SCE_H_XCCOMMENT 20
#define SCE_H_SGML 21
#define SCE_HJ_START 40
#define SCE_HJ_DEFAULT 41
#define SCE_HJ_COMMENT 42
@@ -89,6 +106,7 @@
#define SCE_HJ_SINGLESTRING 49
#define SCE_HJ_SYMBOLS 50
#define SCE_HJ_STRINGEOL 51
#define SCE_HJ_REGEX 52
#define SCE_HJA_START 55
#define SCE_HJA_DEFAULT 56
#define SCE_HJA_COMMENT 57
@@ -101,6 +119,7 @@
#define SCE_HJA_SINGLESTRING 64
#define SCE_HJA_SYMBOLS 65
#define SCE_HJA_STRINGEOL 66
#define SCE_HJA_REGEX 67
#define SCE_HB_START 70
#define SCE_HB_DEFAULT 71
#define SCE_HB_COMMENTLINE 72
@@ -151,9 +170,10 @@
#define SCE_HPHP_VARIABLE 123
#define SCE_HPHP_COMMENT 124
#define SCE_HPHP_COMMENTLINE 125
#define SCE_HPHP_STRINGEOL 126
#define SCE_HPHP_HSTRING_VARIABLE 126
#define SCE_HPHP_OPERATOR 127
#define SCE_PL_DEFAULT 0
#define SCE_PL_HERE 1
#define SCE_PL_ERROR 1
#define SCE_PL_COMMENTLINE 2
#define SCE_PL_POD 3
#define SCE_PL_NUMBER 4
@@ -168,12 +188,20 @@
#define SCE_PL_ARRAY 13
#define SCE_PL_HASH 14
#define SCE_PL_SYMBOLTABLE 15
#define SCE_PL_REF 16
#define SCE_PL_REGEX 17
#define SCE_PL_REGSUBST 18
#define SCE_PL_LONGQUOTE 19
#define SCE_PL_BACKTICKS 20
#define SCE_PL_DATASECTION 21
#define SCE_PL_HERE_DELIM 22
#define SCE_PL_HERE_Q 23
#define SCE_PL_HERE_QQ 24
#define SCE_PL_HERE_QX 25
#define SCE_PL_STRING_Q 26
#define SCE_PL_STRING_QQ 27
#define SCE_PL_STRING_QX 28
#define SCE_PL_STRING_QR 29
#define SCE_PL_STRING_QW 30
#define SCE_L_DEFAULT 0
#define SCE_L_COMMAND 1
#define SCE_L_TAG 2
@@ -199,6 +227,74 @@
#define SCE_ERR_CMD 4
#define SCE_ERR_BORLAND 5
#define SCE_ERR_PERL 6
#define SCE_ERR_NET 7
#define SCE_ERR_LUA 8
#define SCE_ERR_DIFF_CHANGED 10
#define SCE_ERR_DIFF_ADDITION 11
#define SCE_ERR_DIFF_DELETION 12
#define SCE_ERR_DIFF_MESSAGE 13
#define SCE_BAT_DEFAULT 0
#define SCE_BAT_COMMENT 1
#define SCE_BAT_WORD 2
#define SCE_BAT_LABEL 3
#define SCE_BAT_HIDE 4
#define SCE_BAT_COMMAND 5
#define SCE_BAT_IDENTIFIER 6
#define SCE_BAT_OPERATOR 7
#define SCE_MAKE_DEFAULT 0
#define SCE_MAKE_COMMENT 1
#define SCE_MAKE_PREPROCESSOR 2
#define SCE_MAKE_IDENTIFIER 3
#define SCE_MAKE_OPERATOR 4
#define SCE_MAKE_TARGET 5
#define SCE_MAKE_IDEOL 9
#define SCE_CONF_DEFAULT 0
#define SCE_CONF_COMMENT 1
#define SCE_CONF_NUMBER 2
#define SCE_CONF_IDENTIFIER 3
#define SCE_CONF_EXTENSION 4
#define SCE_CONF_PARAMETER 5
#define SCE_CONF_STRING 6
#define SCE_CONF_OPERATOR 7
#define SCE_CONF_IP 8
#define SCE_CONF_DIRECTIVE 9
#define SCE_AVE_DEFAULT 0
#define SCE_AVE_COMMENT 1
#define SCE_AVE_NUMBER 2
#define SCE_AVE_WORD 3
#define SCE_AVE_KEYWORD 4
#define SCE_AVE_STATEMENT 5
#define SCE_AVE_STRING 6
#define SCE_AVE_ENUM 7
#define SCE_AVE_STRINGEOL 8
#define SCE_AVE_IDENTIFIER 9
#define SCE_AVE_OPERATOR 10
#define SCE_ADA_DEFAULT 0
#define SCE_ADA_COMMENT 1
#define SCE_ADA_NUMBER 2
#define SCE_ADA_WORD 3
#define SCE_ADA_STRING 4
#define SCE_ADA_CHARACTER 5
#define SCE_ADA_OPERATOR 6
#define SCE_ADA_IDENTIFIER 7
#define SCE_ADA_STRINGEOL 8
#define SCE_LISP_DEFAULT 0
#define SCE_LISP_COMMENT 1
#define SCE_LISP_NUMBER 2
#define SCE_LISP_KEYWORD 3
#define SCE_LISP_STRING 6
#define SCE_LISP_STRINGEOL 8
#define SCE_LISP_IDENTIFIER 9
#define SCE_LISP_OPERATOR 10
#define SCE_EIFFEL_DEFAULT 0
#define SCE_EIFFEL_COMMENTLINE 1
#define SCE_EIFFEL_NUMBER 2
#define SCE_EIFFEL_WORD 3
#define SCE_EIFFEL_STRING 4
#define SCE_EIFFEL_CHARACTER 5
#define SCE_EIFFEL_OPERATOR 6
#define SCE_EIFFEL_IDENTIFIER 7
#define SCE_EIFFEL_STRINGEOL 8
//--Autogenerated -- end of section automatically generated from Scintilla.iface
#endif

View File

@@ -1,6 +1,8 @@
// Scintilla source code edit control
// Scintilla.h - interface to the edit control
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file Scintilla.h
** Interface to the edit control.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
// Most of this file is automatically generated from the Scintilla.iface interface definition
@@ -18,7 +20,13 @@ void Scintilla_RegisterClasses(HINSTANCE hInstance);
#endif
#endif
typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wParam, long lParam);
// Here should be placed typedefs for uptr_t, an unsigned integer type large enough to
// hold a pointer and sptr_t, a signed integer large enough to hold a pointer.
// May need to be changed for 64 bit platforms.
typedef unsigned long uptr_t;
typedef long sptr_t;
typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
//++Autogenerated -- start of section automatically generated from Scintilla.iface
#define INVALID_POSITION -1
@@ -50,15 +58,16 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
#define SCI_GETVIEWWS 2020
#define SCI_SETVIEWWS 2021
#define SCI_POSITIONFROMPOINT 2022
#define SCI_POSITIONFROMPOINTCLOSE 2023
#define SCI_GOTOLINE 2024
#define SCI_GOTOPOS 2025
#define SCI_SETANCHOR 2026
#define SCI_GETCURLINE 2027
#define SCI_GETENDSTYLED 2028
#define SCI_CONVERTEOLS 2029
#define SC_EOL_CRLF 0
#define SC_EOL_CR 1
#define SC_EOL_LF 2
#define SCI_CONVERTEOLS 2029
#define SCI_GETEOLMODE 2030
#define SCI_SETEOLMODE 2031
#define SCI_STARTSTYLING 2032
@@ -80,6 +89,24 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
#define SC_MARK_ARROWDOWN 6
#define SC_MARK_MINUS 7
#define SC_MARK_PLUS 8
#define SC_MARK_VLINE 9
#define SC_MARK_LCORNER 10
#define SC_MARK_TCORNER 11
#define SC_MARK_BOXPLUS 12
#define SC_MARK_BOXPLUSCONNECTED 13
#define SC_MARK_BOXMINUS 14
#define SC_MARK_BOXMINUSCONNECTED 15
#define SC_MARK_LCORNERCURVE 16
#define SC_MARK_TCORNERCURVE 17
#define SC_MARK_CIRCLEPLUS 18
#define SC_MARK_CIRCLEPLUSCONNECTED 19
#define SC_MARK_CIRCLEMINUS 20
#define SC_MARK_CIRCLEMINUSCONNECTED 21
#define SC_MARKNUM_FOLDEREND 25
#define SC_MARKNUM_FOLDEROPENMID 26
#define SC_MARKNUM_FOLDERMIDTAIL 27
#define SC_MARKNUM_FOLDERTAIL 28
#define SC_MARKNUM_FOLDERSUB 29
#define SC_MARKNUM_FOLDER 30
#define SC_MARKNUM_FOLDEROPEN 31
#define SCI_MARKERDEFINE 2040
@@ -137,6 +164,10 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
#define SCI_STYLESETEOLFILLED 2057
#define SCI_STYLERESETDEFAULT 2058
#define SCI_STYLESETUNDERLINE 2059
#define SC_CASE_MIXED 0
#define SC_CASE_UPPER 1
#define SC_CASE_LOWER 2
#define SCI_STYLESETCASE 2060
#define SCI_STYLESETCHARACTERSET 2066
#define SCI_SETSELFORE 2067
#define SCI_SETSELBACK 2068
@@ -170,6 +201,10 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
#define SCI_SETLINESTATE 2092
#define SCI_GETLINESTATE 2093
#define SCI_GETMAXLINESTATE 2094
#define SCI_GETCARETLINEVISIBLE 2095
#define SCI_SETCARETLINEVISIBLE 2096
#define SCI_GETCARETLINEBACK 2097
#define SCI_SETCARETLINEBACK 2098
#define SCI_AUTOCSHOW 2100
#define SCI_AUTOCCANCEL 2101
#define SCI_AUTOCACTIVE 2102
@@ -186,6 +221,9 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
#define SCI_AUTOCGETCHOOSESINGLE 2114
#define SCI_AUTOCSETIGNORECASE 2115
#define SCI_AUTOCGETIGNORECASE 2116
#define SCI_USERLISTSHOW 2117
#define SCI_AUTOCSETAUTOHIDE 2118
#define SCI_AUTOCGETAUTOHIDE 2119
#define SCI_SETINDENT 2122
#define SCI_GETINDENT 2123
#define SCI_SETUSETABS 2124
@@ -215,9 +253,10 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
#define SC_PRINT_NORMAL 0
#define SC_PRINT_INVERTLIGHT 1
#define SC_PRINT_BLACKONWHITE 2
#define SC_PRINT_COLOURONWHITE 3
#define SC_PRINT_COLOURONWHITEDEFAULTBG 4
#define SCI_SETPRINTCOLOURMODE 2148
#define SCI_GETPRINTCOLOURMODE 2149
#define SCFIND_DOWN 1
#define SCFIND_WHOLEWORD 2
#define SCFIND_MATCHCASE 4
#define SCFIND_WORDSTART 0x00100000
@@ -260,6 +299,17 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
#define SCI_GETDIRECTPOINTER 2185
#define SCI_SETOVERTYPE 2186
#define SCI_GETOVERTYPE 2187
#define SCI_SETCARETWIDTH 2188
#define SCI_GETCARETWIDTH 2189
#define SCI_SETTARGETSTART 2190
#define SCI_GETTARGETSTART 2191
#define SCI_SETTARGETEND 2192
#define SCI_GETTARGETEND 2193
#define SCI_REPLACETARGET 2194
#define SCI_REPLACETARGETRE 2195
#define SCI_SEARCHINTARGET 2197
#define SCI_SETSEARCHFLAGS 2198
#define SCI_GETSEARCHFLAGS 2199
#define SCI_CALLTIPSHOW 2200
#define SCI_CALLTIPCANCEL 2201
#define SCI_CALLTIPACTIVE 2202
@@ -284,6 +334,14 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
#define SCI_TOGGLEFOLD 2231
#define SCI_ENSUREVISIBLE 2232
#define SCI_SETFOLDFLAGS 2233
#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234
#define SCI_SETTABINDENTS 2260
#define SCI_GETTABINDENTS 2261
#define SCI_SETBACKSPACEUNINDENTS 2262
#define SCI_GETBACKSPACEUNINDENTS 2263
#define SC_TIME_FOREVER 10000000
#define SCI_SETMOUSEDWELLTIME 2264
#define SCI_GETMOUSEDWELLTIME 2265
#define SCI_LINEDOWN 2300
#define SCI_LINEDOWNEXTEND 2301
#define SCI_LINEUP 2302
@@ -328,6 +386,7 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
#define SCI_UPPERCASE 2341
#define SCI_LINESCROLLDOWN 2342
#define SCI_LINESCROLLUP 2343
#define SCI_MOVECARETINSIDEVIEW 2401
#define SCI_LINELENGTH 2350
#define SCI_BRACEHIGHLIGHT 2351
#define SCI_BRACEBADLIGHT 2352
@@ -352,6 +411,8 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
#define CARET_SLOP 0x01
#define CARET_CENTER 0x02
#define CARET_STRICT 0x04
#define CARET_XEVEN 0x08
#define CARET_XJUMPS 0x10
#define SCI_SETCARETPOLICY 2369
#define SCI_LINESONSCREEN 2370
#define SCI_USEPOPUP 2371
@@ -362,6 +423,25 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
#define SCI_ADDREFDOCUMENT 2376
#define SCI_RELEASEDOCUMENT 2377
#define SCI_GETMODEVENTMASK 2378
#define SCI_SETFOCUS 2380
#define SCI_GETFOCUS 2381
#define SCI_SETSTATUS 2382
#define SCI_GETSTATUS 2383
#define SCI_SETMOUSEDOWNCAPTURES 2384
#define SCI_GETMOUSEDOWNCAPTURES 2385
#define SC_CURSORNORMAL -1
#define SC_CURSORWAIT 3
#define SCI_SETCURSOR 2386
#define SCI_GETCURSOR 2387
#define SCI_WORDPARTLEFT 2390
#define SCI_WORDPARTLEFTEXTEND 2391
#define SCI_WORDPARTRIGHT 2392
#define SCI_WORDPARTRIGHTEXTEND 2393
#define VISIBLE_SLOP 0x01
#define VISIBLE_STRICT 0x04
#define SCI_SETVISIBLEPOLICY 2394
#define SCI_DELLINELEFT 2395
#define SCI_DELLINERIGHT 2396
#define SCI_GRABFOCUS 2400
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
@@ -370,6 +450,7 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
#define SCI_COLOURISE 4003
#define SCI_SETPROPERTY 4004
#define SCI_SETKEYWORDS 4005
#define SCI_SETLEXERLANGUAGE 4006
#define SC_MOD_INSERTTEXT 0x1
#define SC_MOD_DELETETEXT 0x2
#define SC_MOD_CHANGESTYLE 0x4
@@ -419,6 +500,11 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
#define SCN_MARGINCLICK 2010
#define SCN_NEEDSHOWN 2011
#define SCN_POSCHANGED 2012
#define SCN_PAINTED 2013
#define SCN_USERLISTSELECTION 2014
#define SCN_URIDROPPED 2015
#define SCN_DWELLSTART 2016
#define SCN_DWELLEND 2017
//--Autogenerated -- end of section automatically generated from Scintilla.iface
// Optional module for macro recording
@@ -437,14 +523,14 @@ struct CharacterRange {
};
struct TextRange {
CharacterRange chrg;
struct CharacterRange chrg;
char *lpstrText;
};
struct TextToFind {
CharacterRange chrg;
struct CharacterRange chrg;
char *lpstrText;
CharacterRange chrgText;
struct CharacterRange chrgText;
};
#ifdef PLATFORM_H
@@ -463,8 +549,8 @@ struct RangeToFormat {
#endif
struct NotifyHeader {
// hwndFrom is really an environment specifc window handle or pointer
// but most clients of Scintilla.h do not have this type visible.
// hwndFrom is really an environment specifc window handle or pointer
// but most clients of Scintilla.h do not have this type visible.
//WindowID hwndFrom;
void *hwndFrom;
unsigned int idFrom;
@@ -472,26 +558,35 @@ struct NotifyHeader {
};
struct SCNotification {
NotifyHeader nmhdr;
int position; // SCN_STYLENEEDED, SCN_MODIFIED
int ch; // SCN_CHARADDED, SCN_KEY
int modifiers; // SCN_KEY
int modificationType; // SCN_MODIFIED
const char *text; // SCN_MODIFIED
int length; // SCN_MODIFIED
int linesAdded; // SCN_MODIFIED
struct NotifyHeader nmhdr;
int position; // SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND
int ch; // SCN_CHARADDED, SCN_KEY
int modifiers; // SCN_KEY
int modificationType; // SCN_MODIFIED
const char *text; // SCN_MODIFIED
int length; // SCN_MODIFIED
int linesAdded; // SCN_MODIFIED
#ifdef MACRO_SUPPORT
int message; // SCN_MACRORECORD
int wParam; // SCN_MACRORECORD
int lParam; // SCN_MACRORECORD
uptr_t wParam; // SCN_MACRORECORD
sptr_t lParam; // SCN_MACRORECORD
#endif
int line; // SCN_MODIFIED
int line; // SCN_MODIFIED
int foldLevelNow; // SCN_MODIFIED
int foldLevelPrev; // SCN_MODIFIED
int margin; // SCN_MARGINCLICK
int margin; // SCN_MARGINCLICK
int listType; // SCN_USERLISTSELECTION
int x; // SCN_DWELLSTART, SCN_DWELLEND
int y; // SCN_DWELLSTART, SCN_DWELLEND
};
#define SC_MASK_FOLDERS ((1<<SC_MARKNUM_FOLDER) | (1<<SC_MARKNUM_FOLDEROPEN))
#define SC_MASK_FOLDERS ((1<<SC_MARKNUM_FOLDER) | \
(1<<SC_MARKNUM_FOLDEROPEN) | \
(1<<SC_MARKNUM_FOLDERSUB) | \
(1<<SC_MARKNUM_FOLDERTAIL) | \
(1<<SC_MARKNUM_FOLDERMIDTAIL) | \
(1<<SC_MARKNUM_FOLDEROPENMID) | \
(1<<SC_MARKNUM_FOLDEREND))
// Deprecation section listing all API features that are deprecated and will
// will be removed completely in a future version.
@@ -499,10 +594,6 @@ struct SCNotification {
#ifdef INCLUDE_DEPRECATED_FEATURES
// Deprecated in 1.27
#define SC_UNDOCOLLECT_NONE 0
#define SC_UNDOCOLLECT_AUTOSTART 1
#endif
#endif

View File

@@ -134,6 +134,10 @@ set void SetViewWS=2021(int viewWS,)
# Find the position from a point within the window.
fun int PositionFromPoint=2022(int x, int y)
# Find the position from a point within the window but return
# INVALID_POSITION if not close to text.
fun int PositionFromPointClose=2023(int x, int y)
# Set caret to start of a line and ensure it is visible.
fun void GotoLine=2024(int line,)
@@ -151,13 +155,13 @@ fun int GetCurLine=2027(int length, stringresult text)
# Retrieve the position of the last correctly styled character.
get position GetEndStyled=2028(,)
# Convert all line endings in the document to use the current mode.
fun void ConvertEOLs=2029(,)
val SC_EOL_CRLF=0
val SC_EOL_CR=1
val SC_EOL_LF=2
# Convert all line endings in the document to one mode.
fun void ConvertEOLs=2029(int eolMode,)
# Retrieve the current end of line mode - one of CRLF, CR, or LF.
get int GetEOLMode=2030(,)
@@ -210,6 +214,27 @@ val SC_MARK_ARROWDOWN=6
val SC_MARK_MINUS=7
val SC_MARK_PLUS=8
# Shapes used for outlining column
val SC_MARK_VLINE=9
val SC_MARK_LCORNER=10
val SC_MARK_TCORNER=11
val SC_MARK_BOXPLUS=12
val SC_MARK_BOXPLUSCONNECTED=13
val SC_MARK_BOXMINUS=14
val SC_MARK_BOXMINUSCONNECTED=15
val SC_MARK_LCORNERCURVE=16
val SC_MARK_TCORNERCURVE=17
val SC_MARK_CIRCLEPLUS=18
val SC_MARK_CIRCLEPLUSCONNECTED=19
val SC_MARK_CIRCLEMINUS=20
val SC_MARK_CIRCLEMINUSCONNECTED=21
# Markers used for outlining column
val SC_MARKNUM_FOLDEREND=25
val SC_MARKNUM_FOLDEROPENMID=26
val SC_MARKNUM_FOLDERMIDTAIL=27
val SC_MARKNUM_FOLDERTAIL=28
val SC_MARKNUM_FOLDERSUB=29
val SC_MARKNUM_FOLDER=30
val SC_MARKNUM_FOLDEROPEN=31
@@ -327,6 +352,12 @@ fun void StyleResetDefault=2058(,)
# Set a style to be underlined or not.
set void StyleSetUnderline=2059(int style, bool underline)
val SC_CASE_MIXED=0
val SC_CASE_UPPER=1
val SC_CASE_LOWER=2
# Set a style to be mixed case, or to force upper or lower case.
set void StyleSetCase=2060(int style, int caseForce)
# Set the character set of the font in a style.
set void StyleSetCharacterSet=2066(int style, int characterSet)
@@ -412,6 +443,18 @@ get int GetLineState=2093(int line,)
# Retrieve the last line number that has line state.
get int GetMaxLineState=2094(,)
# Is the background of the line containing the caret in a different colour?
get bool GetCaretLineVisible=2095(,)
# Display the background of the line containing the caret in a different colour.
set void SetCaretLineVisible=2096(bool show,)
# Get the colour of the background of the line containing the caret.
get colour GetCaretLineBack=2097(,)
# Set the colour of the background of the line containing the caret.
set void SetCaretLineBack=2098(colour back,)
# Display a auto-completion list.
# The lenEntered parameter indicates how many characters before
# the caret should be used to provide context.
@@ -465,6 +508,15 @@ set void AutoCSetIgnoreCase=2115(bool ignoreCase,)
# Retrieve state of ignore case flag.
get bool AutoCGetIgnoreCase=2116(,)
# Display a list of strings and send notification when user chooses one.
fun void UserListShow=2117(int listType, string itemList)
# Set whether or not autocompletion is hidden automatically when nothing matches
set void AutoCSetAutoHide=2118(bool autoHide,)
# Retrieve whether or not autocompletion is hidden automatically when nothing matches
get bool AutoCGetAutoHide=2119(,)
# Set the number of spaces used for one level of indentation.
set void SetIndent=2122(int indentSize,)
@@ -551,6 +603,10 @@ val SC_PRINT_NORMAL=0
val SC_PRINT_INVERTLIGHT=1
# PrintColourMode - force black text on white background for printing.
val SC_PRINT_BLACKONWHITE=2
# PrintColourMode - text stays coloured, but all background is forced to be white for printing.
val SC_PRINT_COLOURONWHITE=3
# PrintColourMode - only the default-background is forced to be white for printing.
val SC_PRINT_COLOURONWHITEDEFAULTBG=4
# Modify colours when printing for clearer printed text.
set void SetPrintColourMode=2148(int mode,)
@@ -558,11 +614,9 @@ set void SetPrintColourMode=2148(int mode,)
# Returns the print colour mode.
get int GetPrintColourMode=2149(,)
val SCFIND_DOWN=1
val SCFIND_WHOLEWORD=2
val SCFIND_MATCHCASE=4
val SCFIND_WORDSTART=0x00100000
# SCFIND_REGEXP is not yet implemented.
val SCFIND_REGEXP=0x00200000
# Find some text in the document.
@@ -582,13 +636,13 @@ fun int GetLine=2153(int line, stringresult text)
get int GetLineCount=2154(,)
# Sets the size in pixels of the left margin.
set void SetMarginLeft=2155(, int width)
set void SetMarginLeft=2155(, int pixelWidth)
# Returns the size in pixels of the left margin.
get int GetMarginLeft=2156(,)
# Sets the size in pixels of the right margin.
set void SetMarginRight=2157(, int width)
set void SetMarginRight=2157(, int pixelWidth)
# Returns the size in pixels of the right margin.
get int GetMarginRight=2158(,)
@@ -684,6 +738,48 @@ set void SetOvertype=2186(bool overtype,)
# Returns true if overtype mode is active otherwise false is returned.
get bool GetOvertype=2187(,)
# Set the width of the insert mode caret
set void SetCaretWidth=2188(int pixelWidth,)
# Returns the width of the insert mode caret
get int GetCaretWidth=2189(,)
# Sets the position that starts the target which is used for updating the
# document without affecting the scroll position.
set void SetTargetStart=2190(position pos,)
# Get the position that starts the target.
get position GetTargetStart=2191(,)
# Sets the position that ends the target which is used for updating the
# document without affecting the scroll position.
set void SetTargetEnd=2192(position pos,)
# Get the position that ends the target.
get position GetTargetEnd=2193(,)
# Replace the target text with the argument text.
# Returns the length of the replacement text.
fun int ReplaceTarget=2194(int length, string text)
# Replace the target text with the argument text after \d processing.
# Looks for \d where d is between 1 and 9 and replaces these with the strings
# matched in the last search operation which were surrounded by \( and \).
# Returns the length of the replacement text including any change
# caused by processing the \d patterns.
fun int ReplaceTargetRE=2195(int length, string text)
# Search for a counted string in the target and set the target to the found
# range.
# Returns length of range or -1 for failure in which case target is not moved.
fun int SearchInTarget=2197(int length, string text)
# Set the search flags used by SearchInTarget
set void SetSearchFlags=2198(int flags,)
# Get the search flags used by SearchInTarget
get int GetSearchFlags=2199(,)
# Show a call tip containing a definition near position pos.
fun void CallTipShow=2200(position pos, string definition)
@@ -751,6 +847,30 @@ fun void EnsureVisible=2232(int line,)
# Set some debugging options for folding
fun void SetFoldFlags=2233(int flags,)
# Ensure a particular line is visible by expanding any header line hiding it.
# Use the currently set visibility policy to determine which range to display.
fun void EnsureVisibleEnforcePolicy=2234(int line,)
# Sets whether a tab pressed when caret is within indentation indents
set void SetTabIndents=2260(bool tabIndents,)
# Does a tab pressed when caret is within indentation indent?
get bool GetTabIndents=2261(,)
# Sets whether a backspace pressed when caret is within indentation unindents
set void SetBackSpaceUnIndents=2262(bool bsUnIndents,)
# Does a backspace pressed when caret is within indentation unindent?
get bool GetBackSpaceUnIndents=2263(,)
val SC_TIME_FOREVER=10000000
# Sets the time the mouse must sit still to generate a mouse dwell event
set void SetMouseDwellTime=2264(int periodMilliseconds,)
# Retrieve the time the mouse must sit still to generate a mouse dwell event
get int GetMouseDwellTime=2265(,)
## Start of key messages
# Move caret down one line.
fun void LineDown=2300(,)
@@ -887,6 +1007,9 @@ fun void LineScrollDown=2342(,)
# Scroll the document up, keeping the caret visible.
fun void LineScrollUp=2343(,)
# Move the caret inside current view if it's not there already
fun void MoveCaretInsideView=2401(,)
# How many characters are on a line, not including end of line characters.
fun int LineLength=2350(int line,)
@@ -909,7 +1032,7 @@ set void SetViewEOL=2356(bool visible,)
get int GetDocPointer=2357(,)
# Change the document object used.
set void SetDocPointer=2358(int pointer,)
set void SetDocPointer=2358(,int pointer)
# Set which document modification events are sent to the container.
set void SetModEventMask=2359(int mask,)
@@ -942,18 +1065,28 @@ set void SetEdgeColour=2365(colour edgeColour,)
fun void SearchAnchor=2366(,)
# Find some text starting at the search anchor.
# Does not ensure the selection is visible.
fun int SearchNext=2367(int flags, string text)
# Find some text starting at the search anchor and moving backwards.
# Does not ensure the selection is visible.
fun int SearchPrev=2368(int flags, string text)
# Show caret within N lines of edge when it's scrolled to view
# If CARET_SLOP not set then centre caret on screen when it's
# scrolled to view
val CARET_SLOP=0x01
# Center caret on screen when it's scrolled to view
# Value not used
val CARET_CENTER=0x02
# OR this with CARET_CENTER to reposition even when visible, or
# OR this with CARET_SLOP to reposition whenever outside slop border
# If CARET_SLOP also set then reposition whenever outside slop border
# If CARET_SLOP not set then recentre even when visible
val CARET_STRICT=0x04
# If CARET_XEVEN set then both left and right margins are given equal weight
# rather than favouring left following behaviour.
val CARET_XEVEN=0x08
# If CARET_XJUMPS set then when caret reaches the margin the display jumps
# enough to leave the caret solidly within the display.
val CARET_XJUMPS=0x10
# Set the way the line the caret is on is kept visible.
fun void SetCaretPolicy=2369(int caretPolicy, int caretSlop)
@@ -984,6 +1117,49 @@ fun void ReleaseDocument=2377(, int doc)
# Get which document modification events are sent to the container.
get int GetModEventMask=2378(,)
# Change internal focus flag
set void SetFocus=2380(bool focus,)
# Get internal focus flag
get bool GetFocus=2381(,)
# Change error status - 0 = OK
set void SetStatus=2382(int statusCode,)
# Get error status
get int GetStatus=2383(,)
# Set whether the mouse is captured when its button is pressed
set void SetMouseDownCaptures=2384(bool captures,)
# Get whether mouse gets captured
get bool GetMouseDownCaptures=2385(,)
val SC_CURSORNORMAL=-1
val SC_CURSORWAIT=3
# Sets the cursor to one of the SC_CURSOR* values
set void SetCursor=2386(int cursorType,)
# Get cursor type
get int GetCursor=2387(,)
# Move to the previous change in capitalistion
fun void WordPartLeft=2390(,)
# Move to the previous change in capitalistion extending selection to new caret position.
fun void WordPartLeftExtend=2391(,)
# Move to the change next in capitalistion
fun void WordPartRight=2392(,)
# Move to the next change in capitalistion extending selection to new caret position.
fun void WordPartRightExtend=2393(,)
# Constants for use with SetVisiblePolicy, similar to SetCaretPolicy
val VISIBLE_SLOP=0x01
val VISIBLE_STRICT=0x04
# Set the way the display area is determined when a particular line is to be moved to.
fun void SetVisiblePolicy=2394(int visiblePolicy, int visibleSlop)
# Delete back from the current position to the start of the line
fun void DelLineLeft=2395(,)
# Delete forwards from the current position to the end of the line
fun void DelLineRight=2396(,)
# Set the focus to this Scintilla widget.
# GTK+ Specific
fun void GrabFocus=2400(,)
@@ -1009,6 +1185,9 @@ set void SetProperty=4004(string key, string value)
# Set up the key words used by the lexer.
set void SetKeyWords=4005(int keywordSet, string keyWords)
# Set the lexing language of the document based on string name.
set void SetLexerLanguage=4006(, string language)
# 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.
@@ -1077,6 +1256,18 @@ val SCLEX_XCODE=13
val SCLEX_LATEX=14
val SCLEX_LUA=15
val SCLEX_DIFF=16
val SCLEX_CONF=17
val SCLEX_PASCAL=18
val SCLEX_AVE=19
val SCLEX_ADA=20
val SCLEX_LISP=21
val SCLEX_RUBY=22
val SCLEX_EIFFEL=23
val SCLEX_EIFFELKW=24
val SCLEX_TCL=25
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
val SCLEX_AUTOMATIC=1000
# Lexical states for SCLEX_PYTHON
val SCE_P_DEFAULT=0
val SCE_P_COMMENTLINE=1
@@ -1107,6 +1298,9 @@ val SCE_C_OPERATOR=10
val SCE_C_IDENTIFIER=11
val SCE_C_STRINGEOL=12
val SCE_C_VERBATIM=13
val SCE_C_REGEX=14
val SCE_C_COMMENTLINEDOC=15
val SCE_C_WORD2=16
# Lexical states for SCLEX_HTML, SCLEX_XML
val SCE_H_DEFAULT=0
val SCE_H_TAG=1
@@ -1130,6 +1324,10 @@ val SCE_H_CDATA=17
val SCE_H_QUESTION=18
# More HTML
val SCE_H_VALUE=19
# X-Code
val SCE_H_XCCOMMENT=20
# SGML
val SCE_H_SGML=21
# Embedded Javascript
val SCE_HJ_START=40
val SCE_HJ_DEFAULT=41
@@ -1143,6 +1341,7 @@ val SCE_HJ_DOUBLESTRING=48
val SCE_HJ_SINGLESTRING=49
val SCE_HJ_SYMBOLS=50
val SCE_HJ_STRINGEOL=51
val SCE_HJ_REGEX=52
# ASP Javascript
val SCE_HJA_START=55
val SCE_HJA_DEFAULT=56
@@ -1156,6 +1355,7 @@ val SCE_HJA_DOUBLESTRING=63
val SCE_HJA_SINGLESTRING=64
val SCE_HJA_SYMBOLS=65
val SCE_HJA_STRINGEOL=66
val SCE_HJA_REGEX=67
# Embedded VBScript
val SCE_HB_START=70
val SCE_HB_DEFAULT=71
@@ -1211,10 +1411,11 @@ val SCE_HPHP_NUMBER=122
val SCE_HPHP_VARIABLE=123
val SCE_HPHP_COMMENT=124
val SCE_HPHP_COMMENTLINE=125
val SCE_HPHP_STRINGEOL=126
val SCE_HPHP_HSTRING_VARIABLE=126
val SCE_HPHP_OPERATOR=127
# Lexical states for SCLEX_PERL
val SCE_PL_DEFAULT=0
val SCE_PL_HERE=1
val SCE_PL_ERROR=1
val SCE_PL_COMMENTLINE=2
val SCE_PL_POD=3
val SCE_PL_NUMBER=4
@@ -1229,12 +1430,20 @@ val SCE_PL_SCALAR=12
val SCE_PL_ARRAY=13
val SCE_PL_HASH=14
val SCE_PL_SYMBOLTABLE=15
val SCE_PL_REF=16
val SCE_PL_REGEX=17
val SCE_PL_REGSUBST=18
val SCE_PL_LONGQUOTE=19
val SCE_PL_BACKTICKS=20
val SCE_PL_DATASECTION=21
val SCE_PL_HERE_DELIM=22
val SCE_PL_HERE_Q=23
val SCE_PL_HERE_QQ=24
val SCE_PL_HERE_QX=25
val SCE_PL_STRING_Q=26
val SCE_PL_STRING_QQ=27
val SCE_PL_STRING_QX=28
val SCE_PL_STRING_QR=29
val SCE_PL_STRING_QW=30
# Lexical states for SCLEX_LATEX
val SCE_L_DEFAULT=0
val SCE_L_COMMAND=1
@@ -1255,6 +1464,7 @@ val SCE_LUA_PREPROCESSOR=9
val SCE_LUA_OPERATOR=10
val SCE_LUA_IDENTIFIER=11
val SCE_LUA_STRINGEOL=12
# Lexical states for SCLEX_ERRORLIST
val SCE_ERR_DEFAULT=0
val SCE_ERR_PYTHON=1
val SCE_ERR_GCC=2
@@ -1262,6 +1472,81 @@ val SCE_ERR_MS=3
val SCE_ERR_CMD=4
val SCE_ERR_BORLAND=5
val SCE_ERR_PERL=6
val SCE_ERR_NET=7
val SCE_ERR_LUA=8
val SCE_ERR_DIFF_CHANGED=10
val SCE_ERR_DIFF_ADDITION=11
val SCE_ERR_DIFF_DELETION=12
val SCE_ERR_DIFF_MESSAGE=13
# Lexical states for SCLEX_BATCH
val SCE_BAT_DEFAULT=0
val SCE_BAT_COMMENT=1
val SCE_BAT_WORD=2
val SCE_BAT_LABEL=3
val SCE_BAT_HIDE=4
val SCE_BAT_COMMAND=5
val SCE_BAT_IDENTIFIER=6
val SCE_BAT_OPERATOR=7
# Lexical states for SCLEX_MAKEFILE
val SCE_MAKE_DEFAULT=0
val SCE_MAKE_COMMENT=1
val SCE_MAKE_PREPROCESSOR=2
val SCE_MAKE_IDENTIFIER=3
val SCE_MAKE_OPERATOR=4
val SCE_MAKE_TARGET=5
val SCE_MAKE_IDEOL=9
# Lexical states for the SCLEX_CONF (Apache Configuration Files Lexer)
val SCE_CONF_DEFAULT=0
val SCE_CONF_COMMENT=1
val SCE_CONF_NUMBER=2
val SCE_CONF_IDENTIFIER=3
val SCE_CONF_EXTENSION=4
val SCE_CONF_PARAMETER=5
val SCE_CONF_STRING=6
val SCE_CONF_OPERATOR=7
val SCE_CONF_IP=8
val SCE_CONF_DIRECTIVE=9
# Avenue
val SCE_AVE_DEFAULT=0
val SCE_AVE_COMMENT=1
val SCE_AVE_NUMBER=2
val SCE_AVE_WORD=3
val SCE_AVE_KEYWORD=4
val SCE_AVE_STATEMENT=5
val SCE_AVE_STRING=6
val SCE_AVE_ENUM=7
val SCE_AVE_STRINGEOL=8
val SCE_AVE_IDENTIFIER=9
val SCE_AVE_OPERATOR=10
# Lexical states for SCLEX_ADA
val SCE_ADA_DEFAULT=0
val SCE_ADA_COMMENT=1
val SCE_ADA_NUMBER=2
val SCE_ADA_WORD=3
val SCE_ADA_STRING=4
val SCE_ADA_CHARACTER=5
val SCE_ADA_OPERATOR=6
val SCE_ADA_IDENTIFIER=7
val SCE_ADA_STRINGEOL=8
# Lexical states for SCLEX_LISP
val SCE_LISP_DEFAULT=0
val SCE_LISP_COMMENT=1
val SCE_LISP_NUMBER=2
val SCE_LISP_KEYWORD=3
val SCE_LISP_STRING=6
val SCE_LISP_STRINGEOL=8
val SCE_LISP_IDENTIFIER=9
val SCE_LISP_OPERATOR=10
# Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW
val SCE_EIFFEL_DEFAULT=0
val SCE_EIFFEL_COMMENTLINE=1
val SCE_EIFFEL_NUMBER=2
val SCE_EIFFEL_WORD=3
val SCE_EIFFEL_STRING=4
val SCE_EIFFEL_CHARACTER=5
val SCE_EIFFEL_OPERATOR=6
val SCE_EIFFEL_IDENTIFIER=7
val SCE_EIFFEL_STRINGEOL=8
# Events
@@ -1282,9 +1567,16 @@ evt void MacroRecord=2009(int message, int wParam, int lParam)
evt void MarginClick=2010(int modifiers, int position, int margin)
evt void NeedShown=2011(int position, int length)
evt void PosChanged=2012(int position)
evt void Painted=2013(void)
evt void UserListSelection=2014(int listType, string text)
evt void URIDropped=2015(string text)
evt void DwellStart=2016(int position)
evt void DwellEnd=2017(int position)
cat Deprecated
val SCFIND_DOWN=1
################################################
# From WinDefs.h

View File

@@ -1,7 +1,9 @@
// Scintilla source code edit control
// ScintillaWidget.h - definition of Scintilla widget for GTK+
// Only needed by GTK+ code but is harmless on other platforms.
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file ScintillaWidget.h
** Definition of Scintilla widget for GTK+.
** Only needed by GTK+ code but is harmless on other platforms.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef SCINTILLAWIDGET_H
@@ -9,6 +11,17 @@
#if PLAT_GTK
#ifndef SCINTILLA_H
#ifdef _MSC_VER
#pragma message(__FILE__ "(1) : warning : Scintilla.h should be included before ScintillaWidget.h")
#pragma message("This will be required in the next version of Scintilla")
#else
#warning Scintilla.h should be included before ScintillaWidget.h
#warning This will be required in the next version of Scintilla
#endif
#include "Scintilla.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
@@ -21,7 +34,7 @@ typedef struct _ScintillaObject ScintillaObject;
typedef struct _ScintillaClass ScintillaClass;
struct _ScintillaObject {
GtkFixed vbox;
GtkContainer cont;
void *pscin;
};
@@ -35,7 +48,7 @@ struct _ScintillaClass {
guint scintilla_get_type (void);
GtkWidget* scintilla_new (void);
void scintilla_set_id (ScintillaObject *sci,int id);
long scintilla_send_message (ScintillaObject *sci,int iMessage,int wParam,int lParam);
sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
#ifdef __cplusplus
}

View File

@@ -1,11 +1,23 @@
// Scintilla source code edit control
// WinDefs.h - the subset of definitions from Windows needed by Scintilla for GTK+
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file WinDefs.h
** The subset of definitions from Windows needed by Scintilla for GTK+.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef WINDEFS_H
#define WINDEFS_H
/* Running GTK version on win32 */
#if PLAT_GTK_WIN32
#include "Windows.h"
#include "Richedit.h"
/* Name conflicts */
#undef DrawText
#undef FindText
#else
#define WORD short
#define WPARAM unsigned long
#define LPARAM long
@@ -180,4 +192,6 @@ struct FORMATRANGE {
//#define LOWORD(x) (x & 0xffff)
//#define HIWORD(x) (x >> 16)
#endif /* !_MSC_VER */
#endif

View File

@@ -1,7 +1,13 @@
// WindowAccessor.h - implementation of BufferAccess and StylingAccess on a Scintilla rapid easy access to contents of a Scintilla
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// Scintilla source code edit control
/** @file WindowAccessor.h
** Implementation of BufferAccess and StylingAccess on a Scintilla
** rapid easy access to contents of a Scintilla.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
/**
*/
class WindowAccessor : public Accessor {
// Private so WindowAccessor objects can not be copied
WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {}
@@ -36,6 +42,9 @@ public:
int GetPropertyInt(const char *key, int defaultValue=0) {
return props.GetInt(key, defaultValue);
}
char *GetProperties() {
return props.ToString();
}
void StartAt(unsigned int start, char chMask=31);
void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };

View File

@@ -1,13 +1,17 @@
// Scintilla source code edit control
// AutoComplete.cxx - defines the auto completion list box
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file AutoComplete.cxx
** Defines the auto completion list box.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "Platform.h"
#include "PropSet.h"
#include "AutoComplete.h"
AutoComplete::AutoComplete() :
@@ -17,7 +21,8 @@ AutoComplete::AutoComplete() :
chooseSingle(false),
posStart(0),
startLen(0),
cancelAtStartPos(true) {
cancelAtStartPos(true),
autoHide(true) {
stopChars[0] = '\0';
fillUpChars[0] = '\0';
}
@@ -85,7 +90,6 @@ void AutoComplete::SetList(const char *list) {
}
delete []words;
}
lb.Sort();
}
void AutoComplete::Show() {
@@ -113,9 +117,42 @@ void AutoComplete::Move(int delta) {
}
void AutoComplete::Select(const char *word) {
int pos = lb.Find(word);
//Platform::DebugPrintf("Autocompleting at <%s> %d\n", wordCurrent, pos);
if (pos != -1)
lb.Select(pos);
int lenWord = strlen(word);
int location = -1;
const int maxItemLen=1000;
char item[maxItemLen];
int start = 0; // lower bound of the api array block to search
int end = lb.Length() - 1; // upper bound of the api array block to search
while ((start <= end) && (location == -1)) { // Binary searching loop
int pivot = (start + end) / 2;
lb.GetValue(pivot, item, maxItemLen);
int cond;
if (ignoreCase)
cond = CompareNCaseInsensitive(word, item, lenWord);
else
cond = strncmp(word, item, lenWord);
if (!cond) {
// Find first match
while (pivot > start) {
lb.GetValue(pivot-1, item, maxItemLen);
if (ignoreCase)
cond = CompareNCaseInsensitive(word, item, lenWord);
else
cond = strncmp(word, item, lenWord);
if (0 != cond)
break;
--pivot;
}
location = pivot;
} else if (cond < 0) {
end = pivot - 1;
} else if (cond > 0) {
start = pivot + 1;
}
}
if (location == -1 && autoHide)
Cancel();
else
lb.Select(location);
}

View File

@@ -1,56 +1,62 @@
// Scintilla source code edit control
// AutoComplete.h - defines the auto completion list box
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file AutoComplete.h
** Defines the auto completion list box.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef AUTOCOMPLETE_H
#define AUTOCOMPLETE_H
/**
*/
class AutoComplete {
bool active;
char stopChars[256];
char fillUpChars[256];
char separator;
public:
bool ignoreCase;
bool chooseSingle;
ListBox lb;
int posStart;
int startLen;
// Should autocompletion be canceled if editor's currentPos <= startPos?
/// Should autocompletion be canceled if editor's currentPos <= startPos?
bool cancelAtStartPos;
bool autoHide;
AutoComplete();
~AutoComplete();
// Is the auto completion list displayed?
/// Is the auto completion list displayed?
bool Active();
// Display the auto completion list positioned to be near a character position
/// Display the auto completion list positioned to be near a character position
void Start(Window &parent, int ctrlID, int position, int startLen_);
// The stop chars are characters which, when typed, cause the auto completion list to disappear
/// The stop chars are characters which, when typed, cause the auto completion list to disappear
void SetStopChars(const char *stopChars_);
bool IsStopChar(char ch);
// The fillup chars are characters which, when typed, fill up the selected word
/// The fillup chars are characters which, when typed, fill up the selected word
void SetFillUpChars(const char *fillUpChars_);
bool IsFillUpChar(char ch);
// The separator character is used when interpreting the list in SetList
/// The separator character is used when interpreting the list in SetList
void SetSeparator(char separator_);
char GetSeparator();
// The list string contains a sequence of words separated by the separator character
/// The list string contains a sequence of words separated by the separator character
void SetList(const char *list);
void Show();
void Cancel();
// Move the current list element by delta, scrolling appropriately
/// Move the current list element by delta, scrolling appropriately
void Move(int delta);
// Select a list element that starts with word as the current element
/// Select a list element that starts with word as the current element
void Select(const char *word);
};

View File

@@ -1,10 +1,12 @@
// Scintilla source code edit control
// CallTip.cxx - code for displaying call tips
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file CallTip.cxx
** Code for displaying call tips.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include "Platform.h"
@@ -27,6 +29,7 @@ CallTip::CallTip() {
}
CallTip::~CallTip() {
font.Release();
wCallTip.Destroy();
delete []val;
val = 0;
@@ -42,7 +45,7 @@ void CallTip::RefreshColourPalette(Palette &pal, bool want) {
void CallTip::PaintCT(Surface *surfaceWindow) {
if (!val)
return;
return ;
PRectangle rcClientPos = wCallTip.GetClientPosition();
PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left,
rcClientPos.bottom - rcClientPos.top);
@@ -117,7 +120,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
const char *faceName, int size) {
Surface surfaceMeasure;
surfaceMeasure.Init();
int deviceHeight = (size * surfaceMeasure.LogPixelsY()) / 72;
int deviceHeight = surfaceMeasure.DeviceHeightFont(size);
font.Create(faceName, SC_CHARSET_DEFAULT, deviceHeight, false, false);
if (val)
delete []val;
@@ -146,10 +149,9 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
int lineHeight = surfaceMeasure.Height(font);
// Extra line for border and an empty line at top and bottom
int height = lineHeight * numLines - surfaceMeasure.InternalLeading(font) + 2 + 2;
return PRectangle(pt.x -5, pt.y + lineHeight + 1, pt.x + width - 5, pt.y + lineHeight + 1 + height);
return PRectangle(pt.x -5, pt.y + 1, pt.x + width - 5, pt.y + 1 + height);
}
void CallTip::CallTipCancel() {
inCallTipMode = false;
if (wCallTip.Created()) {

View File

@@ -1,11 +1,15 @@
// Scintilla source code edit control
// CallTip.h - interface to the call tip control
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file CallTip.h
** Interface to the call tip control.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef CALLTIP_H
#define CALLTIP_H
/**
*/
class CallTip {
int startHighlight;
int endHighlight;
@@ -14,6 +18,7 @@ class CallTip {
// Private so CallTip objects can not be copied
CallTip(const CallTip &) {}
CallTip &operator=(const CallTip &) { return *this; }
public:
Window wCallTip;
Window wDraw;
@@ -28,19 +33,19 @@ public:
CallTip();
~CallTip();
// Claim or accept palette entries for the colours required to paint a calltip
/// Claim or accept palette entries for the colours required to paint a calltip.
void RefreshColourPalette(Palette &pal, bool want);
void PaintCT(Surface *surfaceWindow);
// Setup the calltip and return a rectangle of the area required
/// Setup the calltip and return a rectangle of the area required.
PRectangle CallTipStart(int pos, Point pt, const char *defn,
const char *faceName, int size);
void CallTipCancel();
// Set a range of characters to be displayed in a highlight style.
// Commonly used to highlight the current parameter.
/// Set a range of characters to be displayed in a highlight style.
/// Commonly used to highlight the current parameter.
void SetHighlight(int start, int end);
};

View File

@@ -1,6 +1,8 @@
// Scintilla source code edit control
// CellBuffer.cxx - manages a buffer of cells
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file CellBuffer.cxx
** Manages a buffer of cells.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdio.h>
@@ -416,22 +418,19 @@ UndoHistory::~UndoHistory() {
}
void UndoHistory::EnsureUndoRoom() {
//Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, length, currentAction);
if (currentAction >= 2) {
// Have to test that there is room for 2 more actions in the array
// as two actions may be created by this function
if (currentAction >= (lenActions - 2)) {
// Run out of undo nodes so extend the array
int lenActionsNew = lenActions * 2;
Action *actionsNew = new Action[lenActionsNew];
if (!actionsNew)
return ;
for (int act = 0; act <= currentAction; act++)
actionsNew[act].Grab(&actions[act]);
delete []actions;
lenActions = lenActionsNew;
actions = actionsNew;
}
// Have to test that there is room for 2 more actions in the array
// as two actions may be created by the calling function
if (currentAction >= (lenActions - 2)) {
// Run out of undo nodes so extend the array
int lenActionsNew = lenActions * 2;
Action *actionsNew = new Action[lenActionsNew];
if (!actionsNew)
return ;
for (int act = 0; act <= currentAction; act++)
actionsNew[act].Grab(&actions[act]);
delete []actions;
lenActions = lenActionsNew;
actions = actionsNew;
}
}
@@ -450,14 +449,27 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
currentAction++;
} else if (currentAction == savePoint) {
currentAction++;
} else if ((at == removeAction) &&
((position + lengthData * 2) != actPrevious.position)) {
// Removals must be at same position to coalesce
currentAction++;
} else if ((at == insertAction) &&
(position != (actPrevious.position + actPrevious.lenData*2))) {
// Insertions must be immediately after to coalesce
currentAction++;
} else if (!actions[currentAction].mayCoalesce) {
// Not allowed to coalesce if this set
currentAction++;
} else if (at == removeAction) {
if ((lengthData == 1) || (lengthData == 2)){
if ((position + lengthData * 2) == actPrevious.position) {
; // Backspace -> OK
} else if (position == actPrevious.position) {
; // Delete -> OK
} else {
// Removals must be at same position to coalesce
currentAction++;
}
} else {
// Removals must be of one character to coalesce
currentAction++;
}
} else {
//Platform::DebugPrintf("action coalesced\n");
}
@@ -582,6 +594,7 @@ CellBuffer::CellBuffer(int initialLength) {
part2body = body + gaplen;
readOnly = false;
collectingUndo = true;
growSize = 4000;
}
CellBuffer::~CellBuffer() {
@@ -612,7 +625,9 @@ void CellBuffer::RoomFor(int insertionLength) {
if (gaplen <= insertionLength) {
//Platform::DebugPrintf("need room %d %d\n", gaplen, insertionLength);
GapTo(length);
int newSize = size + insertionLength + 4000;
if (growSize * 6 < size)
growSize *= 2;
int newSize = size + insertionLength + growSize;
//Platform::DebugPrintf("moved gap %d\n", newSize);
char *newBody = new char[newSize];
memcpy(newBody, body, size);
@@ -733,6 +748,8 @@ bool CellBuffer::SetStyleAt(int position, char style, char mask) {
bool CellBuffer::SetStyleFor(int position, int lengthStyle, char style, char mask) {
int bytePos = position * 2 + 1;
bool changed = false;
PLATFORM_ASSERT(lengthStyle == 0 ||
(lengthStyle > 0 && lengthStyle + position < length));
while (lengthStyle--) {
char curVal = ByteAt(bytePos);
if ((curVal & mask) != style) {
@@ -779,7 +796,7 @@ int CellBuffer::LineStart(int line) {
if (line < 0)
return 0;
else if (line > lv.lines)
return length;
return Length();
else
return lv.linesData[line].startPosition;
}
@@ -930,7 +947,6 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) {
ignoreNL = true; // First \n is not real deletion
}
char ch = chNext;
for (int i = 0; i < deleteLength; i += 2) {
chNext = ' ';
@@ -948,7 +964,6 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) {
ignoreNL = false; // Further \n are not real deletions
}
ch = chNext;
}
// May have to fix up end if last deletion causes cr to be next to lf

View File

@@ -1,28 +1,35 @@
// Scintilla source code edit control
// CellBuffer.h - manages the text of the document
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file CellBuffer.h
** Manages the text of the document.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef CELLBUFFER_H
#define CELLBUFFER_H
// This holds the marker identifier and the marker type to display.
// MarkerHandleNumbers are members of lists.
/**
* This holds the marker identifier and the marker type to display.
* MarkerHandleNumbers are members of lists.
*/
struct MarkerHandleNumber {
int handle;
int number;
MarkerHandleNumber *next;
};
// A marker handle set contains any number of MarkerHandleNumbers
/**
* A marker handle set contains any number of MarkerHandleNumbers.
*/
class MarkerHandleSet {
MarkerHandleNumber *root;
public:
MarkerHandleSet();
~MarkerHandleSet();
int Length();
int NumberFromHandle(int handle);
int MarkValue(); // Bit set of marker numbers
int MarkValue(); ///< Bit set of marker numbers.
bool Contains(int handle);
bool InsertHandle(int handle, int markerNum);
void RemoveHandle(int handle);
@@ -30,8 +37,10 @@ public:
void CombineWith(MarkerHandleSet *other);
};
// Each line stores the starting position of the first character of the line in the cell buffer
// and potentially a marker handle set. Often a line will not have any attached markers.
/**
* Each line stores the starting position of the first character of the line in the cell buffer
* and potentially a marker handle set. Often a line will not have any attached markers.
*/
struct LineData {
int startPosition;
MarkerHandleSet *handleSet;
@@ -39,7 +48,9 @@ struct LineData {
}
};
// The line vector contains information about each of the lines in a cell buffer.
/**
* The line vector contains information about each of the lines in a cell buffer.
*/
class LineVector {
public:
enum { growSize = 4000 };
@@ -48,22 +59,22 @@ public:
int size;
int *levels;
int sizeLevels;
// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
/// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
int handleCurrent;
LineVector();
~LineVector();
void Init();
void Expand(int sizeNew);
void ExpandLevels(int sizeNew=-1);
void ClearLevels();
void ClearLevels();
void InsertValue(int pos, int value);
void SetValue(int pos, int value);
void Remove(int pos);
int LineFromPosition(int pos);
int AddMark(int line, int marker);
void MergeMarkers(int pos);
void DeleteMark(int line, int markerNum);
@@ -71,9 +82,11 @@ public:
int LineFromHandle(int markerHandle);
};
// Actions are used to store all the information required to perform one undo/redo step.
enum actionType { insertAction, removeAction, startAction };
/**
* Actions are used to store all the information required to perform one undo/redo step.
*/
class Action {
public:
actionType at;
@@ -89,6 +102,9 @@ public:
void Grab(Action *source);
};
/**
*
*/
class UndoHistory {
Action *actions;
int lenActions;
@@ -98,25 +114,25 @@ class UndoHistory {
int savePoint;
void EnsureUndoRoom();
public:
UndoHistory();
~UndoHistory();
void AppendAction(actionType at, int position, char *data, int length);
void BeginUndoAction();
void EndUndoAction();
void DropUndoSequence();
void DeleteUndoHistory();
// The save point is a marker in the undo stack where the container has stated that
// the buffer was saved. Undo and redo can move over the save point.
/// The save point is a marker in the undo stack where the container has stated that
/// the buffer was saved. Undo and redo can move over the save point.
void SetSavePoint();
bool IsSavePoint() const;
// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
// called that many times. Similarly for redo.
/// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
/// called that many times. Similarly for redo.
bool CanUndo() const;
int StartUndo();
const Action &GetUndoStep() const;
@@ -127,9 +143,11 @@ public:
void CompletedRedoStep();
};
// Holder for an expandable array of characters that supports undo and line markers
// Based on article "Data Structures in a Bit-Mapped Text Editor"
// by Wilfred J. Hansen, Byte January 1987, page 183
/**
* Holder for an expandable array of characters that supports undo and line markers.
* Based on article "Data Structures in a Bit-Mapped Text Editor"
* by Wilfred J. Hansen, Byte January 1987, page 183.
*/
class CellBuffer {
private:
char *body;
@@ -139,6 +157,7 @@ private:
int gaplen;
char *part2body;
bool readOnly;
int growSize;
bool collectingUndo;
UndoHistory uh;
@@ -157,12 +176,12 @@ public:
CellBuffer(int initialLength = 4000);
~CellBuffer();
// Retrieving positions outside the range of the buffer works and returns 0
/// Retrieving positions outside the range of the buffer works and returns 0
char CharAt(int position);
void GetCharRange(char *buffer, int position, int lengthRetrieve);
char StyleAt(int position);
int ByteLength();
int Length();
int Lines();
@@ -170,23 +189,23 @@ public:
int LineFromPosition(int pos) { return lv.LineFromPosition(pos); }
const char *InsertString(int position, char *s, int insertLength);
void InsertCharStyle(int position, char ch, char style);
// Setting styles for positions outside the range of the buffer is safe and has no effect.
// True is returned if the style of a character changed.
/// Setting styles for positions outside the range of the buffer is safe and has no effect.
/// @return true if the style of a character is changed.
bool SetStyleAt(int position, char style, char mask='\377');
bool SetStyleFor(int position, int length, char style, char mask);
const char *DeleteChars(int position, int deleteLength);
bool IsReadOnly();
void SetReadOnly(bool set);
// The save point is a marker in the undo stack where the container has stated that
// the buffer was saved. Undo and redo can move over the save point.
/// The save point is a marker in the undo stack where the container has stated that
/// the buffer was saved. Undo and redo can move over the save point.
void SetSavePoint();
bool IsSavePoint();
// Line marker functions
/// Line marker functions
int AddMark(int line, int markerNum);
void DeleteMark(int line, int markerNum);
void DeleteMarkFromHandle(int markerHandle);
@@ -194,7 +213,7 @@ public:
void DeleteAllMarks(int markerNum);
int LineFromHandle(int markerHandle);
// Without undo
/// Actions without undo
void BasicInsertString(int position, char *s, int insertLength);
void BasicDeleteChars(int position, int deleteLength);
@@ -203,9 +222,9 @@ public:
void BeginUndoAction();
void EndUndoAction();
void DeleteUndoHistory();
// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
// called that many times. Similarly for redo.
/// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
/// called that many times. Similarly for redo.
bool CanUndo();
int StartUndo();
const Action &GetUndoStep() const;
@@ -214,14 +233,14 @@ public:
int StartRedo();
const Action &GetRedoStep() const;
void PerformRedoStep();
int SetLineState(int line, int state);
int GetLineState(int line);
int GetMaxLineState();
int SetLevel(int line, int level);
int GetLevel(int line);
void ClearLevels();
void ClearLevels();
};
#define CELL_SIZE 2

View File

@@ -1,6 +1,8 @@
// Scintilla source code edit control
// ContractionState.cxx - manages visibility of lines for folding
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file ContractionState.cxx
** Manages visibility of lines for folding.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include "Platform.h"

View File

@@ -1,15 +1,19 @@
// Scintilla source code edit control
// ContractionState.h - manages visibility of lines for folding
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file ContractionState.h
** Manages visibility of lines for folding.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef CONTRACTIONSTATE_H
#define CONTRACTIONSTATE_H
/**
*/
class OneLine {
public:
int displayLine; // position within set of visible lines
int docLine; // inverse of displayLine
int displayLine; ///< Position within set of visible lines
int docLine; ///< Inverse of @a displayLine
bool visible;
bool expanded;
@@ -17,6 +21,8 @@ public:
virtual ~OneLine() {}
};
/**
*/
class ContractionState {
void Grow(int sizeNew);
enum { growSize = 4000 };
@@ -26,6 +32,7 @@ class ContractionState {
int size;
mutable bool valid;
void MakeValid() const;
public:
ContractionState();
virtual ~ContractionState();

View File

@@ -1,6 +1,8 @@
// Scintilla source code edit control
// Document.cxx - text document that handles notifications, DBCS, styling, words and end of line
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file Document.cxx
** Text document that handles notifications, DBCS, styling, words and end of line.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
@@ -14,6 +16,12 @@
#include "SVector.h"
#include "CellBuffer.h"
#include "Document.h"
#include "RESearch.h"
// This is ASCII specific but is safe with chars >= 0x80
inline bool isspacechar(unsigned char ch) {
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
}
Document::Document() {
refCount = 0;
@@ -25,7 +33,6 @@ Document::Document() {
dbcsCodePage = 0;
stylingBits = 5;
stylingBitsMask = 0x1F;
stylingPos = 0;
stylingMask = 0;
for (int ch = 0; ch < 256; ch++) {
wordchars[ch] = isalnum(ch) || ch == '_';
@@ -36,8 +43,14 @@ Document::Document() {
tabInChars = 8;
indentInChars = 0;
useTabs = true;
tabIndents = true;
backspaceUnindents = false;
watchers = 0;
lenWatchers = 0;
matchesValid = false;
pre = 0;
substituted = 0;
}
Document::~Document() {
@@ -47,6 +60,10 @@ Document::~Document() {
delete []watchers;
watchers = 0;
lenWatchers = 0;
delete pre;
pre = 0;
delete []substituted;
substituted = 0;
}
// Increase reference count and return its previous value.
@@ -68,27 +85,27 @@ void Document::SetSavePoint() {
NotifySavePoint(true);
}
int Document::AddMark(int line, int markerNum) {
int prev = cb.AddMark(line, markerNum);
int Document::AddMark(int line, int markerNum) {
int prev = cb.AddMark(line, markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
NotifyModified(mh);
return prev;
}
void Document::DeleteMark(int line, int markerNum) {
cb.DeleteMark(line, markerNum);
void Document::DeleteMark(int line, int markerNum) {
cb.DeleteMark(line, markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
NotifyModified(mh);
}
void Document::DeleteMarkFromHandle(int markerHandle) {
cb.DeleteMarkFromHandle(markerHandle);
void Document::DeleteMarkFromHandle(int markerHandle) {
cb.DeleteMarkFromHandle(markerHandle);
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
NotifyModified(mh);
}
void Document::DeleteAllMarks(int markerNum) {
cb.DeleteAllMarks(markerNum);
void Document::DeleteAllMarks(int markerNum) {
cb.DeleteAllMarks(markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
NotifyModified(mh);
}
@@ -131,10 +148,11 @@ int Document::VCHomePosition(int position) {
return startText;
}
int Document::SetLevel(int line, int level) {
int prev = cb.SetLevel(line, level);
int Document::SetLevel(int line, int level) {
int prev = cb.SetLevel(line, level);
if (prev != level) {
DocModification mh(SC_MOD_CHANGEFOLD, LineStart(line), 0, 0, 0);
DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER,
LineStart(line), 0, 0, 0);
mh.line = line;
mh.foldLevelNow = level;
mh.foldLevelPrev = prev;
@@ -146,7 +164,7 @@ int Document::SetLevel(int line, int level) {
static bool IsSubordinate(int levelStart, int levelTry) {
if (levelTry & SC_FOLDLEVELWHITEFLAG)
return true;
else
else
return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK);
}
@@ -155,16 +173,16 @@ int Document::GetLastChild(int lineParent, int level) {
level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK;
int maxLine = LinesTotal();
int lineMaxSubord = lineParent;
while (lineMaxSubord < maxLine-1) {
EnsureStyledTo(LineStart(lineMaxSubord+2));
if (!IsSubordinate(level, GetLevel(lineMaxSubord+1)))
while (lineMaxSubord < maxLine - 1) {
EnsureStyledTo(LineStart(lineMaxSubord + 2));
if (!IsSubordinate(level, GetLevel(lineMaxSubord + 1)))
break;
lineMaxSubord++;
}
if (lineMaxSubord > lineParent) {
if (level > (GetLevel(lineMaxSubord+1) & SC_FOLDLEVELNUMBERMASK)) {
// Have chewed up some whitespace that belongs to a parent so seek back
if ((lineMaxSubord > lineParent) && (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG)) {
if (level > (GetLevel(lineMaxSubord + 1) & SC_FOLDLEVELNUMBERMASK)) {
// Have chewed up some whitespace that belongs to a parent so seek back
if (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG) {
lineMaxSubord--;
}
}
@@ -174,15 +192,15 @@ int Document::GetLastChild(int lineParent, int level) {
int Document::GetFoldParent(int line) {
int level = GetLevel(line);
int lineLook = line-1;
int lineLook = line - 1;
while ((lineLook > 0) && (
(!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) ||
((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level))
) {
(!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) ||
((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level))
) {
lineLook--;
}
if ((GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG) &&
((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) < level)) {
((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) < level)) {
return lineLook;
} else {
return -1;
@@ -241,12 +259,12 @@ int Document::LenChar(int pos) {
if (ch < 0x80)
return 1;
int len = 2;
if (ch >= (0x80+0x40+0x20))
if (ch >= (0x80 + 0x40 + 0x20))
len = 3;
int lengthDoc = Length();
if ((pos + len) > lengthDoc)
return lengthDoc-pos;
else
return lengthDoc -pos;
else
return len;
} else if (IsDBCS(pos)) {
return 2;
@@ -292,7 +310,7 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) {
// ch is a trail byte
if (moveDir > 0)
pos++;
else
else
pos--;
ch = static_cast<unsigned char>(cb.CharAt(pos));
}
@@ -314,6 +332,7 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) {
//Platform::DebugPrintf("DBCS %s\n", atlead ? "D" : "-");
}
if (atLeadByte) {
// Position is between a lead byte and a trail byte
if (moveDir > 0)
@@ -338,9 +357,9 @@ void Document::ModifiedAt(int pos) {
// Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number
void Document::DeleteChars(int pos, int len) {
if ((pos + len) > Length())
return;
if (cb.IsReadOnly() && enteredReadOnlyCount==0) {
if ((pos + len) > Length())
return ;
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
enteredReadOnlyCount++;
NotifyModifyAttempt();
enteredReadOnlyCount--;
@@ -349,28 +368,31 @@ void Document::DeleteChars(int pos, int len) {
enteredCount++;
if (!cb.IsReadOnly()) {
NotifyModified(
DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_USER,
pos, len,
0, 0));
DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_USER,
pos, len,
0, 0));
int prevLinesTotal = LinesTotal();
bool startSavePoint = cb.IsSavePoint();
const char *text = cb.DeleteChars(pos*2, len * 2);
const char *text = cb.DeleteChars(pos * 2, len * 2);
if (startSavePoint && cb.IsCollectingUndo())
NotifySavePoint(!startSavePoint);
ModifiedAt(pos);
if ((pos < Length()) || (pos == 0))
ModifiedAt(pos);
else
ModifiedAt(pos-1);
NotifyModified(
DocModification(
SC_MOD_DELETETEXT | SC_PERFORMED_USER,
pos, len,
LinesTotal() - prevLinesTotal, text));
DocModification(
SC_MOD_DELETETEXT | SC_PERFORMED_USER,
pos, len,
LinesTotal() - prevLinesTotal, text));
}
enteredCount--;
}
}
void Document::InsertStyledString(int position, char *s, int insertLength) {
if (cb.IsReadOnly() && enteredReadOnlyCount==0) {
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
enteredReadOnlyCount++;
NotifyModifyAttempt();
enteredReadOnlyCount--;
@@ -379,10 +401,10 @@ void Document::InsertStyledString(int position, char *s, int insertLength) {
enteredCount++;
if (!cb.IsReadOnly()) {
NotifyModified(
DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_USER,
position / 2, insertLength / 2,
0, 0));
DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_USER,
position / 2, insertLength / 2,
0, 0));
int prevLinesTotal = LinesTotal();
bool startSavePoint = cb.IsSavePoint();
const char *text = cb.InsertString(position, s, insertLength);
@@ -390,10 +412,10 @@ void Document::InsertStyledString(int position, char *s, int insertLength) {
NotifySavePoint(!startSavePoint);
ModifiedAt(position / 2);
NotifyModified(
DocModification(
SC_MOD_INSERTTEXT | SC_PERFORMED_USER,
position / 2, insertLength / 2,
LinesTotal() - prevLinesTotal, text));
DocModification(
SC_MOD_INSERTTEXT | SC_PERFORMED_USER,
position / 2, insertLength / 2,
LinesTotal() - prevLinesTotal, text));
}
enteredCount--;
}
@@ -406,21 +428,21 @@ int Document::Undo() {
bool startSavePoint = cb.IsSavePoint();
int steps = cb.StartUndo();
//Platform::DebugPrintf("Steps=%d\n", steps);
for (int step=0; step<steps; step++) {
for (int step = 0; step < steps; step++) {
int prevLinesTotal = LinesTotal();
const Action &action = cb.GetUndoStep();
if (action.at == removeAction) {
NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
} else {
NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
}
NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
} else {
NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
}
cb.PerformUndoStep();
int cellPosition = action.position / 2;
ModifiedAt(cellPosition);
newPos = cellPosition;
int modFlags = SC_PERFORMED_UNDO;
// With undo, an insertion action becomes a deletion notification
if (action.at == removeAction) {
@@ -429,12 +451,12 @@ int Document::Undo() {
} else {
modFlags |= SC_MOD_DELETETEXT;
}
if (step == steps-1)
if (step == steps - 1)
modFlags |= SC_LASTSTEPINUNDOREDO;
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
LinesTotal() - prevLinesTotal, action.data));
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
LinesTotal() - prevLinesTotal, action.data));
}
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
@@ -449,20 +471,20 @@ int Document::Redo() {
enteredCount++;
bool startSavePoint = cb.IsSavePoint();
int steps = cb.StartRedo();
for (int step=0; step<steps; step++) {
for (int step = 0; step < steps; step++) {
int prevLinesTotal = LinesTotal();
const Action &action = cb.GetRedoStep();
if (action.at == insertAction) {
NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action));
} else {
NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action));
}
NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action));
} else {
NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action));
}
cb.PerformRedoStep();
ModifiedAt(action.position / 2);
newPos = action.position / 2;
int modFlags = SC_PERFORMED_REDO;
if (action.at == insertAction) {
newPos += action.lenData;
@@ -470,13 +492,13 @@ int Document::Redo() {
} else {
modFlags |= SC_MOD_DELETETEXT;
}
if (step == steps-1)
if (step == steps - 1)
modFlags |= SC_LASTSTEPINUNDOREDO;
NotifyModified(
DocModification(modFlags, action.position / 2, action.lenData,
LinesTotal() - prevLinesTotal, action.data));
DocModification(modFlags, action.position / 2, action.lenData,
LinesTotal() - prevLinesTotal, action.data));
}
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
@@ -526,7 +548,7 @@ int Document::DelCharBack(int pos) {
DeleteChars(pos - 2, 2);
return pos - 2;
} else if (SC_CP_UTF8 == dbcsCodePage) {
int startChar = MovePositionOutsideChar(pos-1, -1, false);
int startChar = MovePositionOutsideChar(pos - 1, -1, false);
DeleteChars(startChar, pos - startChar);
return startChar;
} else if (IsDBCS(pos - 1)) {
@@ -568,13 +590,13 @@ int Document::GetLineIndentation(int line) {
if ((line >= 0) && (line < LinesTotal())) {
int lineStart = LineStart(line);
int length = Length();
for (int i=lineStart;i<length;i++) {
for (int i = lineStart;i < length;i++) {
char ch = cb.CharAt(i);
if (ch == ' ')
indent++;
else if (ch == '\t')
indent = NextTab(indent, tabInChars);
else
else
return indent;
}
}
@@ -596,8 +618,8 @@ void Document::SetLineIndentation(int line, int indent) {
}
int Document::GetLineIndentPosition(int line) {
if (line < 0)
return 0;
if (line < 0)
return 0;
int pos = LineStart(line);
int length = Length();
while ((pos < length) && isindentchar(cb.CharAt(pos))) {
@@ -610,7 +632,7 @@ int Document::GetColumn(int pos) {
int column = 0;
int line = LineFromPosition(pos);
if ((line >= 0) && (line < LinesTotal())) {
for (int i=LineStart(line);i<pos;i++) {
for (int i = LineStart(line);i < pos;i++) {
char ch = cb.CharAt(i);
if (ch == '\t')
column = NextTab(column, tabInChars);
@@ -640,7 +662,7 @@ void Document::ConvertLineEnds(int eolModeSet) {
BeginUndoAction();
for (int pos = 0; pos < Length(); pos++) {
if (cb.CharAt(pos) == '\r') {
if (cb.CharAt(pos+1) == '\n') {
if (cb.CharAt(pos + 1) == '\n') {
if (eolModeSet != SC_EOL_CRLF) {
DeleteChars(pos, 2);
if (eolModeSet == SC_EOL_CR)
@@ -677,7 +699,7 @@ void Document::ConvertLineEnds(int eolModeSet) {
}
bool Document::IsWordChar(unsigned char ch) {
if ((SC_CP_UTF8 == dbcsCodePage) && (ch >0x80))
if ((SC_CP_UTF8 == dbcsCodePage) && (ch > 0x80))
return true;
return wordchars[ch];
}
@@ -697,19 +719,19 @@ int Document::NextWordStart(int pos, int delta) {
if (delta < 0) {
while (pos > 0 && (cb.CharAt(pos - 1) == ' ' || cb.CharAt(pos - 1) == '\t'))
pos--;
if (isspace(cb.CharAt(pos - 1))) { // Back up to previous line
while (pos > 0 && isspace(cb.CharAt(pos - 1)))
if (isspacechar(cb.CharAt(pos - 1))) { // Back up to previous line
while (pos > 0 && isspacechar(cb.CharAt(pos - 1)))
pos--;
} else {
bool startAtWordChar = IsWordChar(cb.CharAt(pos - 1));
while (pos > 0 && !isspace(cb.CharAt(pos - 1)) && (startAtWordChar == IsWordChar(cb.CharAt(pos - 1))))
while (pos > 0 && !isspacechar(cb.CharAt(pos - 1)) && (startAtWordChar == IsWordChar(cb.CharAt(pos - 1))))
pos--;
}
} else {
bool startAtWordChar = IsWordChar(cb.CharAt(pos));
while (pos < (Length()) && isspace(cb.CharAt(pos)))
while (pos < (Length()) && isspacechar(cb.CharAt(pos)))
pos++;
while (pos < (Length()) && !isspace(cb.CharAt(pos)) && (startAtWordChar == IsWordChar(cb.CharAt(pos))))
while (pos < (Length()) && !isspacechar(cb.CharAt(pos)) && (startAtWordChar == IsWordChar(cb.CharAt(pos))))
pos++;
while (pos < (Length()) && (cb.CharAt(pos) == ' ' || cb.CharAt(pos) == '\t'))
pos++;
@@ -717,6 +739,10 @@ int Document::NextWordStart(int pos, int delta) {
return pos;
}
/**
* Check that the character before the given position
* is not a word character.
*/
bool Document::IsWordStartAt(int pos) {
if (pos > 0) {
return !IsWordChar(CharAt(pos - 1));
@@ -724,6 +750,10 @@ bool Document::IsWordStartAt(int pos) {
return true;
}
/**
* Check that the character after the given position
* is not a word character.
*/
bool Document::IsWordEndAt(int pos) {
if (pos < Length() - 1) {
return !IsWordChar(CharAt(pos));
@@ -731,74 +761,233 @@ bool Document::IsWordEndAt(int pos) {
return true;
}
/**
* Check that the given range is delimited by
* non word characters.
*/
bool Document::IsWordAt(int start, int end) {
return IsWordStartAt(start) && IsWordEndAt(end);
}
// Find text in document, supporting both forward and backward
// searches (just pass minPos > maxPos to do a backward search)
// Has not been tested with backwards DBCS searches yet.
long Document::FindText(int minPos, int maxPos, const char *s,
bool caseSensitive, bool word, bool wordStart) {
bool forward = minPos <= maxPos;
int increment = forward ? 1 : -1;
// The comparison and case changing functions here assume ASCII
// or extended ASCII such as the normal Windows code page.
// Range endpoints should not be inside DBCS characters, but just in case, move them.
int startPos = MovePositionOutsideChar(minPos, increment, false);
int endPos = MovePositionOutsideChar(maxPos, increment, false);
// Compute actual search ranges needed
int lengthFind = strlen(s);
int endSearch = endPos;
if (startPos <= endPos) {
endSearch = endPos - lengthFind + 1;
}
//Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind);
char firstChar = s[0];
if (!caseSensitive)
firstChar = static_cast<char>(toupper(firstChar));
int pos = startPos;
while (forward ? (pos < endSearch) : (pos >= endSearch)) {
char ch = CharAt(pos);
if (caseSensitive) {
if (ch == firstChar) {
bool found = true;
for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
ch = CharAt(pos + posMatch);
if (ch != s[posMatch])
found = false;
}
if (found) {
if ((!word && !wordStart) ||
word && IsWordAt(pos, pos + lengthFind) ||
wordStart && IsWordStartAt(pos))
return pos;
}
}
static inline char MakeUpperCase(char ch) {
if (ch < 'a' || ch > 'z')
return ch;
else
return static_cast<char>(ch - 'a' + 'A');
}
static inline char MakeLowerCase(char ch) {
if (ch < 'A' || ch > 'Z')
return ch;
else
return static_cast<char>(ch - 'A' + 'a');
}
// Define a way for the Regular Expression code to access the document
class DocumentIndexer : public CharacterIndexer {
Document *pdoc;
int end;
public:
DocumentIndexer(Document *pdoc_, int end_) :
pdoc(pdoc_), end(end_) {}
virtual char CharAt(int index) {
if (index < 0 || index >= end)
return 0;
else
return pdoc->CharAt(index);
}
};
/**
* Find text in document, supporting both forward and backward
* searches (just pass minPos > maxPos to do a backward search)
* Has not been tested with backwards DBCS searches yet.
*/
long Document::FindText(int minPos, int maxPos, const char *s,
bool caseSensitive, bool word, bool wordStart, bool regExp,
int *length) {
if (regExp) {
if (!pre)
pre = new RESearch();
if (!pre)
return -1;
int startPos;
int endPos;
if (minPos <= maxPos) {
startPos = minPos;
endPos = maxPos;
} else {
if (toupper(ch) == firstChar) {
bool found = true;
for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
ch = CharAt(pos + posMatch);
if (toupper(ch) != toupper(s[posMatch]))
found = false;
}
if (found) {
if (!(word && wordStart) ||
word && IsWordAt(pos, pos + lengthFind) ||
wordStart && IsWordStartAt(pos))
return pos;
}
startPos = maxPos;
endPos = minPos;
}
// Range endpoints should not be inside DBCS characters, but just in case, move them.
startPos = MovePositionOutsideChar(startPos, 1, false);
endPos = MovePositionOutsideChar(endPos, 1, false);
const char *errmsg = pre->Compile(s, *length, caseSensitive);
if (errmsg) {
return -1;
}
// Find a variable in a property file: \$(\([A-Za-z0-9_.]+\))
// Replace first '.' with '-' in each property file variable reference:
// Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\))
// Replace: $(\1-\2)
int lineRangeStart = LineFromPosition(startPos);
int lineRangeEnd = LineFromPosition(endPos);
if ((startPos >= LineEnd(lineRangeStart)) && (lineRangeStart < lineRangeEnd)) {
// the start position is at end of line or between line end characters.
lineRangeStart++;
startPos = LineStart(lineRangeStart);
}
int pos = -1;
int lenRet = 0;
char searchEnd = s[*length - 1];
if (*length == 1) {
// These produce empty selections so nudge them on if needed
if (s[0] == '^') {
if (startPos == LineStart(lineRangeStart))
startPos++;
} else if (s[0] == '$') {
if ((startPos == LineEnd(lineRangeStart)) && (lineRangeStart < lineRangeEnd))
startPos = LineStart(lineRangeStart + 1);
}
lineRangeStart = LineFromPosition(startPos);
lineRangeEnd = LineFromPosition(endPos);
}
for (int line = lineRangeStart; line <= lineRangeEnd; line++) {
int startOfLine = LineStart(line);
int endOfLine = LineEnd(line);
if (line == lineRangeStart) {
if ((startPos != startOfLine) && (s[0] == '^'))
continue; // Can't match start of line if start position after start of line
startOfLine = startPos;
}
if (line == lineRangeEnd) {
if ((endPos != endOfLine) && (searchEnd == '$'))
continue; // Can't match end of line if end position before end of line
endOfLine = endPos;
}
DocumentIndexer di(this, endOfLine);
int success = pre->Execute(di, startOfLine, endOfLine);
if (success) {
pos = pre->bopat[0];
lenRet = pre->eopat[0] - pre->bopat[0];
break;
}
}
pos += increment;
if (dbcsCodePage) {
// Ensure trying to match from start of character
pos = MovePositionOutsideChar(pos, increment, false);
*length = lenRet;
return pos;
} else {
bool forward = minPos <= maxPos;
int increment = forward ? 1 : -1;
// Range endpoints should not be inside DBCS characters, but just in case, move them.
int startPos = MovePositionOutsideChar(minPos, increment, false);
int endPos = MovePositionOutsideChar(maxPos, increment, false);
// Compute actual search ranges needed
int lengthFind = *length;
if (lengthFind == -1)
lengthFind = strlen(s);
int endSearch = endPos;
if (startPos <= endPos) {
endSearch = endPos - lengthFind + 1;
}
//Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind);
char firstChar = s[0];
if (!caseSensitive)
firstChar = static_cast<char>(MakeUpperCase(firstChar));
int pos = startPos;
while (forward ? (pos < endSearch) : (pos >= endSearch)) {
char ch = CharAt(pos);
if (caseSensitive) {
if (ch == firstChar) {
bool found = true;
for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
ch = CharAt(pos + posMatch);
if (ch != s[posMatch])
found = false;
}
if (found) {
if ((!word && !wordStart) ||
word && IsWordAt(pos, pos + lengthFind) ||
wordStart && IsWordStartAt(pos))
return pos;
}
}
} else {
if (MakeUpperCase(ch) == firstChar) {
bool found = true;
for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
ch = CharAt(pos + posMatch);
if (MakeUpperCase(ch) != MakeUpperCase(s[posMatch]))
found = false;
}
if (found) {
if ((!word && !wordStart) ||
word && IsWordAt(pos, pos + lengthFind) ||
wordStart && IsWordStartAt(pos))
return pos;
}
}
}
pos += increment;
if (dbcsCodePage) {
// Ensure trying to match from start of character
pos = MovePositionOutsideChar(pos, increment, false);
}
}
}
//Platform::DebugPrintf("Not found\n");
return - 1;
return -1;
}
const char *Document::SubstituteByPosition(const char *text, int *length) {
if (!pre)
return 0;
delete []substituted;
substituted = 0;
DocumentIndexer di(this, Length());
if (!pre->GrabMatches(di))
return 0;
unsigned int lenResult = 0;
for (int i = 0; i < *length; i++) {
if ((text[i] == '\\') && (text[i + 1] >= '1' && text[i + 1] <= '9')) {
unsigned int patNum = text[i + 1] - '0';
lenResult += pre->eopat[patNum] - pre->bopat[patNum];
i++;
} else {
lenResult++;
}
}
substituted = new char[lenResult + 1];
if (!substituted)
return 0;
char *o = substituted;
for (int j = 0; j < *length; j++) {
if ((text[j] == '\\') && (text[j + 1] >= '1' && text[j + 1] <= '9')) {
unsigned int patNum = text[j + 1] - '0';
unsigned int len = pre->eopat[patNum] - pre->bopat[patNum];
if (pre->pat[patNum]) // Will be null if try for a match that did not occur
memcpy(o, pre->pat[patNum], len);
o += len;
j++;
} else {
*o++ = text[j];
}
}
*o = '\0';
*length = lenResult;
return substituted;
}
int Document::LinesTotal() {
@@ -806,18 +995,18 @@ int Document::LinesTotal() {
}
void Document::ChangeCase(Range r, bool makeUpperCase) {
for (int pos=r.start; pos<r.end; pos++) {
for (int pos = r.start; pos < r.end; pos++) {
char ch = CharAt(pos);
if (dbcsCodePage && IsDBCS(pos)) {
pos += LenChar(pos);
} else {
if (makeUpperCase) {
if (islower(ch)) {
ChangeChar(pos, static_cast<char>(toupper(ch)));
ChangeChar(pos, static_cast<char>(MakeUpperCase(ch)));
}
} else {
if (isupper(ch)) {
ChangeChar(pos, static_cast<char>(tolower(ch)));
ChangeChar(pos, static_cast<char>(MakeLowerCase(ch)));
}
}
}
@@ -844,28 +1033,27 @@ void Document::SetWordChars(unsigned char *chars) {
void Document::SetStylingBits(int bits) {
stylingBits = bits;
stylingBitsMask = 0;
for (int bit=0; bit<stylingBits; bit++) {
for (int bit = 0; bit < stylingBits; bit++) {
stylingBitsMask <<= 1;
stylingBitsMask |= 1;
}
}
void Document::StartStyling(int position, char mask) {
stylingPos = position;
stylingMask = mask;
endStyled = position;
}
void Document::SetStyleFor(int length, char style) {
if (enteredCount == 0) {
enteredCount++;
int prevEndStyled = endStyled;
if (cb.SetStyleFor(stylingPos, length, style, stylingMask)) {
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
prevEndStyled, length);
if (cb.SetStyleFor(endStyled, length, style, stylingMask)) {
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
prevEndStyled, length);
NotifyModified(mh);
}
stylingPos += length;
endStyled = stylingPos;
endStyled += length;
enteredCount--;
}
}
@@ -875,15 +1063,14 @@ void Document::SetStyles(int length, char *styles) {
enteredCount++;
int prevEndStyled = endStyled;
bool didChange = false;
for (int iPos = 0; iPos < length; iPos++, stylingPos++) {
if (cb.SetStyleAt(stylingPos, styles[iPos], stylingMask)) {
for (int iPos = 0; iPos < length; iPos++, endStyled++) {
if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) {
didChange = true;
}
}
endStyled = stylingPos;
if (didChange) {
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
prevEndStyled, endStyled - prevEndStyled);
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
prevEndStyled, endStyled - prevEndStyled);
NotifyModified(mh);
}
enteredCount--;
@@ -958,3 +1145,85 @@ void Document::NotifyModified(DocModification mh) {
watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData);
}
}
bool Document::IsWordPartSeparator(char ch) {
return ispunct(ch) && IsWordChar(ch);
}
int Document::WordPartLeft(int pos) {
if (pos > 0) {
--pos;
char startChar = cb.CharAt(pos);
if (IsWordPartSeparator(startChar)) {
while (pos > 0 && IsWordPartSeparator(cb.CharAt(pos))) {
--pos;
}
}
if (pos > 0) {
startChar = cb.CharAt(pos);
--pos;
if (islower(startChar)) {
while (pos > 0 && islower(cb.CharAt(pos)))
--pos;
if (!isupper(cb.CharAt(pos)) && !islower(cb.CharAt(pos)))
++pos;
} else if (isupper(startChar)) {
while (pos > 0 && isupper(cb.CharAt(pos)))
--pos;
if (!isupper(cb.CharAt(pos)))
++pos;
} else if (isdigit(startChar)) {
while (pos > 0 && isdigit(cb.CharAt(pos)))
--pos;
if (!isdigit(cb.CharAt(pos)))
++pos;
} else if (ispunct(startChar)) {
while (pos > 0 && ispunct(cb.CharAt(pos)))
--pos;
if (!ispunct(cb.CharAt(pos)))
++pos;
} else if (isspacechar(startChar)) {
while (pos > 0 && isspacechar(cb.CharAt(pos)))
--pos;
if (!isspacechar(cb.CharAt(pos)))
++pos;
}
}
}
return pos;
}
int Document::WordPartRight(int pos) {
char startChar = cb.CharAt(pos);
int length = Length();
if (IsWordPartSeparator(startChar)) {
while (pos < length && IsWordPartSeparator(cb.CharAt(pos)))
++pos;
startChar = cb.CharAt(pos);
}
if (islower(startChar)) {
while (pos < length && islower(cb.CharAt(pos)))
++pos;
} else if (isupper(startChar)) {
if (islower(cb.CharAt(pos + 1))) {
++pos;
while (pos < length && islower(cb.CharAt(pos)))
++pos;
} else {
while (pos < length && isupper(cb.CharAt(pos)))
++pos;
}
if (islower(cb.CharAt(pos)) && isupper(cb.CharAt(pos - 1)))
--pos;
} else if (isdigit(startChar)) {
while (pos < length && isdigit(cb.CharAt(pos)))
++pos;
} else if (ispunct(startChar)) {
while (pos < length && ispunct(cb.CharAt(pos)))
++pos;
} else if (isspacechar(startChar)) {
while (pos < length && isspacechar(cb.CharAt(pos)))
++pos;
}
return pos;
}

View File

@@ -1,36 +1,42 @@
// Scintilla source code edit control
// Document.h - text document that handles notifications, DBCS, styling, words and end of line
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file Document.h
** Text document that handles notifications, DBCS, styling, words and end of line.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef DOCUMENT_H
#define DOCUMENT_H
// A Position is a position within a document between two characters or at the beginning or end.
// Sometimes used as a character index where it identifies the character after the position.
/**
* A Position is a position within a document between two characters or at the beginning or end.
* Sometimes used as a character index where it identifies the character after the position.
*/
typedef int Position;
const Position invalidPosition = -1;
// The range class represents a range of text in a document.
// The two values are not sorted as one end may be more significant than the other
// as is the case for the selection where the end position is the position of the caret.
// If either position is invalidPosition then the range is invalid and most operations will fail.
/**
* The range class represents a range of text in a document.
* The two values are not sorted as one end may be more significant than the other
* as is the case for the selection where the end position is the position of the caret.
* If either position is invalidPosition then the range is invalid and most operations will fail.
*/
class Range {
public:
Position start;
Position end;
Range(Position pos=0) :
start(pos), end(pos) {
};
Range(Position start_, Position end_) :
start(start_), end(end_) {
};
bool Valid() const {
return (start != invalidPosition) && (end != invalidPosition);
}
bool Contains(Position pos) const {
if (start < end) {
return (pos >= start && pos <= end);
@@ -38,11 +44,11 @@ public:
return (pos <= start && pos >= end);
}
}
bool Contains(Range other) const {
return Contains(other.start) && Contains(other.end);
}
bool Overlaps(Range other) const {
return
Contains(other.start) ||
@@ -54,11 +60,14 @@ public:
class DocWatcher;
class DocModification;
class RESearch;
/**
*/
class Document {
public:
// Used to pair watcher pointer with user data
/** Used to pair watcher pointer with user data. */
class WatcherWithUserData {
public:
DocWatcher *watcher;
@@ -68,37 +77,42 @@ public:
userData = 0;
}
};
private:
int refCount;
CellBuffer cb;
bool wordchars[256];
int stylingPos;
char stylingMask;
int endStyled;
int enteredCount;
int enteredReadOnlyCount;
WatcherWithUserData *watchers;
int lenWatchers;
bool matchesValid;
RESearch *pre;
char *substituted;
public:
int stylingBits;
int stylingBitsMask;
int eolMode;
// dbcsCodePage can also be SC_CP_UTF8 to enable UTF-8 mode
/// Can also be SC_CP_UTF8 to enable UTF-8 mode
int dbcsCodePage;
int tabInChars;
int indentInChars;
bool useTabs;
bool tabIndents;
bool backspaceUnindents;
Document();
virtual ~Document();
int AddRef();
int Release();
int LineFromPosition(int pos);
int ClampPositionIntoDocument(int pos);
bool IsCrLf(int pos);
@@ -165,12 +179,13 @@ public:
int NextWordStart(int pos, int delta);
int Length() { return cb.Length(); }
long FindText(int minPos, int maxPos, const char *s,
bool caseSensitive, bool word, bool wordStart);
bool caseSensitive, bool word, bool wordStart, bool regExp, int *length);
long FindText(int iMessage, unsigned long wParam, long lParam);
const char *SubstituteByPosition(const char *text, int *length);
int LinesTotal();
void ChangeCase(Range r, bool makeUpperCase);
void SetWordChars(unsigned char *chars);
void SetStylingBits(int bits);
void StartStyling(int position, char mask);
@@ -182,12 +197,16 @@ public:
int SetLineState(int line, int state) { return cb.SetLineState(line, state); }
int GetLineState(int line) { return cb.GetLineState(line); }
int GetMaxLineState() { return cb.GetMaxLineState(); }
bool AddWatcher(DocWatcher *watcher, void *userData);
bool RemoveWatcher(DocWatcher *watcher, void *userData);
const WatcherWithUserData *GetWatchers() const { return watchers; }
int GetLenWatchers() const { return lenWatchers; }
bool IsWordPartSeparator(char ch);
int WordPartLeft(int pos);
int WordPartRight(int pos);
private:
bool IsDBCS(int pos);
bool IsWordChar(unsigned char ch);
@@ -195,24 +214,26 @@ private:
bool IsWordEndAt(int pos);
bool IsWordAt(int start, int end);
void ModifiedAt(int pos);
void NotifyModifyAttempt();
void NotifySavePoint(bool atSavePoint);
void NotifyModified(DocModification mh);
int IndentSize() { return indentInChars ? indentInChars : tabInChars; }
};
// To optimise processing of document modifications by DocWatchers, a hint is passed indicating the
// scope of the change.
// If the DocWatcher is a document view then this can be used to optimise screen updating.
/**
* To optimise processing of document modifications by DocWatchers, a hint is passed indicating the
* scope of the change.
* If the DocWatcher is a document view then this can be used to optimise screen updating.
*/
class DocModification {
public:
int modificationType;
int position;
int length;
int linesAdded; // Negative if lines deleted
const char *text; // Only valid for changes to text, not for changes to style
int linesAdded; /**< Negative if lines deleted. */
const char *text; /**< Only valid for changes to text, not for changes to style. */
int line;
int foldLevelNow;
int foldLevelPrev;
@@ -239,12 +260,14 @@ public:
foldLevelPrev(0) {}
};
// A class that wants to receive notifications from a Document must be derived from DocWatcher
// and implement the notification methods. It can then be added to the watcher list with AddWatcher.
/**
* A class that wants to receive notifications from a Document must be derived from DocWatcher
* and implement the notification methods. It can then be added to the watcher list with AddWatcher.
*/
class DocWatcher {
public:
virtual ~DocWatcher() {}
virtual void NotifyModifyAttempt(Document *doc, void *userData) = 0;
virtual void NotifySavePoint(Document *doc, void *userData, bool atSavePoint) = 0;
virtual void NotifyModified(Document *doc, DocModification mh, void *userData) = 0;

View File

@@ -1,11 +1,13 @@
// SciTE - Scintilla based Text Editor
// Accessor.cxx - rapid easy access to contents of a Scintilla
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// Scintilla source code edit control
/** @file DocumentAccessor.cxx
** Rapid easy access to contents of a Scintilla.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <ctype.h>
#include <stdio.h>
#include "Platform.h"
@@ -21,12 +23,12 @@
DocumentAccessor::~DocumentAccessor() {
}
#if PLAT_WIN
#if PLAT_WIN
bool DocumentAccessor::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 IsDBCSLeadByteEx(codePage, ch);
}
@@ -36,7 +38,7 @@ bool DocumentAccessor::InternalIsLeadByte(char ch) {
bool DocumentAccessor::InternalIsLeadByte(char) {
return false;
}
#endif
#endif
void DocumentAccessor::Fill(int position) {
if (lenDoc == -1)
@@ -70,10 +72,10 @@ int DocumentAccessor::LevelAt(int line) {
return pdoc->GetLevel(line);
}
int DocumentAccessor::Length() {
if (lenDoc == -1)
int DocumentAccessor::Length() {
if (lenDoc == -1)
lenDoc = pdoc->Length();
return lenDoc;
return lenDoc;
}
int DocumentAccessor::GetLineState(int line) {
@@ -132,12 +134,12 @@ void DocumentAccessor::Flush() {
int DocumentAccessor::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;
@@ -164,11 +166,12 @@ int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnI
}
ch = (*this)[++pos];
}
*flags = spaceFlags;
indent += SC_FOLDLEVELBASE;
// if completely empty line or the start of a comment...
if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) )
if ((ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') ||
(pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) )
return indent | SC_FOLDLEVELWHITEFLAG;
else
return indent;

View File

@@ -1,16 +1,24 @@
// DocumentAccessor.h - implementation of BufferAccess and StylingAccess on a Scintilla rapid easy access to contents of a Scintilla
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// Scintilla source code edit control
/** @file DocumentAccessor.h
** Implementation of BufferAccess and StylingAccess on a Scintilla
** rapid easy access to contents of a Scintilla.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
class Document;
/**
*/
class DocumentAccessor : public Accessor {
// Private so DocumentAccessor objects can not be copied
DocumentAccessor(const DocumentAccessor &source) : Accessor(), props(source.props) {}
DocumentAccessor &operator=(const DocumentAccessor &) { return *this; }
protected:
Document *pdoc;
PropSet &props;
WindowID id;
int lenDoc;
char styleBuf[bufferSize];
@@ -21,9 +29,10 @@ protected:
bool InternalIsLeadByte(char ch);
void Fill(int position);
public:
DocumentAccessor(Document *pdoc_, PropSet &props_) :
Accessor(), pdoc(pdoc_), props(props_),
DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) :
Accessor(), pdoc(pdoc_), props(props_), id(id_),
lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
}
~DocumentAccessor();
@@ -38,6 +47,10 @@ public:
int GetPropertyInt(const char *key, int defaultValue=0) {
return props.GetInt(key, defaultValue);
}
char *GetProperties() {
return props.ToString();
}
WindowID GetWindow() { return id; }
void StartAt(unsigned int start, char chMask=31);
void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,15 @@
// Scintilla source code edit control
// Editor.h - defines the main editor class
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file Editor.h
** Defines the main editor class.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef EDITOR_H
#define EDITOR_H
/**
*/
class Caret {
public:
bool active;
@@ -15,8 +19,9 @@ public:
Caret();
};
/**
*/
class Timer {
public:
bool ticking;
int ticksToWait;
@@ -26,15 +31,18 @@ public:
Timer();
};
/**
*/
class LineLayout {
public:
// Drawing is only performed for maxLineLength characters on each line.
/// Drawing is only performed for @a maxLineLength characters on each line.
enum {maxLineLength = 4000};
int numCharsInLine;
int xHighlightGuide;
bool highlightColumn;
int selStart;
int selEnd;
bool containsCaret;
int edgeColumn;
char chars[maxLineLength+1];
char styles[maxLineLength+1];
@@ -42,35 +50,40 @@ public:
int positions[maxLineLength+1];
};
/**
*/
class Editor : public DocWatcher {
// Private so Editor objects can not be copied
Editor(const Editor &) : DocWatcher() {}
Editor &operator=(const Editor &) { return *this; }
protected: // ScintillaBase subclass needs access to much of Editor
// On GTK+, Scintilla is a container widget holding two scroll bars and a drawing area
// whereas on Windows there is just one window with both scroll bars turned on.
// Therefore, on GTK+ the following are separate windows but only one window on Windows.
Window wMain; // The Scintilla parent window
Window wDraw; // The text drawing area
/** On GTK+, Scintilla is a container widget holding two scroll bars
* whereas on Windows there is just one window with both scroll bars turned on. */
Window wMain; ///< The Scintilla parent window
// Style resources may be expensive to allocate so are cached between uses.
// When a style attribute is changed, this cache is flushed.
/** Style resources may be expensive to allocate so are cached between uses.
* When a style attribute is changed, this cache is flushed. */
bool stylesValid;
ViewStyle vs;
Palette palette;
int printMagnification;
int printColourMode;
int cursorMode;
bool hasFocus;
bool hideSelection;
bool inOverstrike;
// In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to
// the screen. This avoids flashing but is about 30% slower.
int errorStatus;
bool mouseDownCaptures;
/** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to
* the screen. This avoids flashing but is about 30% slower. */
bool bufferedDraw;
int xOffset; // Horizontal scrolled amount in pixels
int xCaretMargin; // Ensure this many pixels visible on both sides of caret
int xOffset; ///< Horizontal scrolled amount in pixels
int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret
bool horizontalScrollBarVisible;
Surface pixmapLine;
@@ -80,15 +93,20 @@ protected: // ScintillaBase subclass needs access to much of Editor
Surface pixmapIndentGuideHighlight;
// Intellimouse support - currently only implemented for Windows
unsigned int ucWheelScrollLines;
int cWheelDelta; //wheel delta from roll
int cWheelDelta; ///< Wheel delta from roll
KeyMap kmap;
Caret caret;
Timer timer;
Timer autoScrollTimer;
enum { autoScrollDelay = 200 };
Point lastClick;
unsigned int lastClickTime;
int dwellDelay;
int ticksToDwell;
bool dwelling;
enum { selChar, selWord, selLine } selectionType;
Point ptMouseLast;
bool firstExpose;
@@ -101,6 +119,9 @@ protected: // ScintillaBase subclass needs access to much of Editor
int originalAnchorPos;
int currentPos;
int anchor;
int targetStart;
int targetEnd;
int searchFlags;
int topLine;
int posTopLine;
@@ -128,6 +149,9 @@ protected: // ScintillaBase subclass needs access to much of Editor
int caretPolicy;
int caretSlop;
int visiblePolicy;
int visibleSlop;
int searchAnchor;
int displayPopupMenu;
@@ -152,15 +176,16 @@ protected: // ScintillaBase subclass needs access to much of Editor
void RefreshStyleData();
void DropGraphics();
PRectangle GetClientRectangle();
virtual PRectangle GetClientRectangle();
PRectangle GetTextRectangle();
int LinesOnScreen();
int LinesToScroll();
int MaxScrollPos();
Point LocationFromPosition(unsigned int pos);
int XFromPosition(unsigned int pos);
Point LocationFromPosition(int pos);
int XFromPosition(int pos);
int PositionFromLocation(Point pt);
int PositionFromLocationClose(Point pt);
int PositionFromLineX(int line, int x);
int LineFromLocation(Point pt);
void SetTopLine(int topLineNew);
@@ -187,11 +212,12 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void ScrollText(int linesToMove);
void HorizontalScrollTo(int xPos);
void MoveCaretInsideView();
void EnsureCaretVisible(bool useMargin=true);
void EnsureCaretVisible(bool useMargin=true, bool vert=true, bool horiz=true);
void ShowCaretAtCurrentPosition();
void DropCaret();
void InvalidateCaret();
int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault);
void PaintSelMargin(Surface *surface, PRectangle &rc);
void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout &ll);
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
@@ -214,6 +240,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void Cut();
void PasteRectangular(int pos, const char *ptr, int len);
virtual void Copy() = 0;
virtual bool CanPaste();
virtual void Paste() = 0;
void Clear();
void SelectAll();
@@ -227,14 +254,16 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void NotifyFocus(bool focus);
virtual void NotifyParent(SCNotification scn) = 0;
virtual void NotifyStyleToNeeded(int endStyleNeeded);
void NotifyChar(char ch);
void NotifyChar(int ch);
void NotifyMove(int position);
void NotifySavePoint(bool isSavePoint);
void NotifyModifyAttempt();
virtual void NotifyDoubleClick(Point pt, bool shift);
void NotifyUpdateUI();
void NotifyPainted();
bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt);
void NotifyNeedShown(int pos, int len);
void NotifyDwelling(Point pt, bool state);
void NotifyModifyAttempt(Document *document, void *userData);
void NotifySavePoint(Document *document, void *userData, bool atSavePoint);
@@ -253,7 +282,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void CancelModes();
virtual int KeyCommand(unsigned int iMessage);
virtual int KeyDefault(int /* key */, int /*modifiers*/);
int KeyDown(int key, bool shift, bool ctrl, bool alt);
int KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed=0);
int GetWhitespaceVisible();
void SetWhitespaceVisible(int view);
@@ -263,6 +292,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
long FindText(unsigned int iMessage, unsigned long wParam, long lParam);
void SearchAnchor();
long SearchText(unsigned int iMessage, unsigned long wParam, long lParam);
long SearchInTarget(const char *text, int length);
void GoToLine(int lineNo);
char *CopyRange(int start, int end);
@@ -270,13 +300,16 @@ protected: // ScintillaBase subclass needs access to much of Editor
char *CopySelectionRange();
void CopySelectionIntoDrag();
void SetDragPosition(int newPos);
void DisplayCursor(Window::Cursor c);
virtual void StartDrag();
void DropAt(int position, const char *value, bool moving, bool rectangular);
// PositionInSelection returns 0 if position in selection, -1 if position before selection, and 1 if after.
// Before means either before any line of selection or before selection on its line, with a similar meaning to after
/** PositionInSelection returns 0 if position in selection, -1 if position before selection, and 1 if after.
* Before means either before any line of selection or before selection on its line, with a similar meaning to after. */
int PositionInSelection(int pos);
bool PointInSelection(Point pt);
bool PointInSelMargin(Point pt);
void LineSelection(int lineCurrent_, int lineAnchor_);
void DwellEnd(bool mouseMoved);
virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
void ButtonMove(Point pt);
void ButtonUp(Point pt, unsigned int curTime, bool ctrl);
@@ -285,6 +318,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void SetTicking(bool on) = 0;
virtual void SetMouseCapture(bool on) = 0;
virtual bool HaveMouseCapture() = 0;
void SetFocusState(bool focusState);
void CheckForChangeOutsidePaint(Range r);
int BraceMatch(int position, int maxReStyle);
@@ -294,13 +328,14 @@ protected: // ScintillaBase subclass needs access to much of Editor
void Expand(int &line, bool doExpand);
void ToggleContraction(int line);
void EnsureLineVisible(int line);
void EnsureLineVisible(int lineDoc, bool enforcePolicy);
int ReplaceTarget(bool replacePatterns, const char *text, int length=-1);
virtual long DefWndProc(unsigned int iMessage, unsigned long wParam, long lParam) = 0;
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;
public:
// Public so scintilla_send_message can use it
virtual long WndProc(unsigned int iMessage, unsigned long wParam, long lParam);
virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
// Public so scintilla_set_id can use it
int ctrlID;
};

View File

@@ -1,6 +1,8 @@
// Scintilla source code edit control
// Indicator.cxx - defines the style of indicators which are text decorations such as underlining
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file Indicator.cxx
** Defines the style of indicators which are text decorations such as underlining.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include "Platform.h"

View File

@@ -1,11 +1,15 @@
// Scintilla source code edit control
// Indicator.h - defines the style of indicators which are text decorations such as underlining
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file Indicator.h
** Defines the style of indicators which are text decorations such as underlining.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef INDICATOR_H
#define INDICATOR_H
/**
*/
class Indicator {
public:
int style;

View File

@@ -1,6 +1,8 @@
// Scintilla source code edit control
// KeyMap.cxx - defines a mapping between keystrokes and commands
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file KeyMap.cxx
** Defines a mapping between keystrokes and commands.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include "Platform.h"
@@ -71,10 +73,14 @@ KeyToCommand KeyMap::MapDefault[] = {
{SCK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND},
{SCK_LEFT, SCI_CTRL, SCI_WORDLEFT},
{SCK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND},
{SCK_LEFT, SCI_ALT, SCI_WORDPARTLEFT},
{SCK_LEFT, SCI_ASHIFT, SCI_WORDPARTLEFTEXTEND},
{SCK_RIGHT, SCI_NORM, SCI_CHARRIGHT},
{SCK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND},
{SCK_RIGHT, SCI_CTRL, SCI_WORDRIGHT},
{SCK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND},
{SCK_RIGHT, SCI_ALT, SCI_WORDPARTRIGHT},
{SCK_RIGHT, SCI_ASHIFT, SCI_WORDPARTRIGHTEXTEND},
{SCK_HOME, SCI_NORM, SCI_VCHOME},
{SCK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND},
{SCK_HOME, SCI_CTRL, SCI_DOCUMENTSTART},
@@ -90,6 +96,7 @@ KeyToCommand KeyMap::MapDefault[] = {
{SCK_DELETE, SCI_NORM, SCI_CLEAR},
{SCK_DELETE, SCI_SHIFT, SCI_CUT},
{SCK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT},
{SCK_DELETE, SCI_CSHIFT, SCI_DELLINERIGHT},
{SCK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE},
{SCK_INSERT, SCI_SHIFT, SCI_PASTE},
{SCK_INSERT, SCI_CTRL, SCI_COPY},
@@ -98,6 +105,7 @@ KeyToCommand KeyMap::MapDefault[] = {
{SCK_BACK, SCI_SHIFT, SCI_DELETEBACK},
{SCK_BACK, SCI_CTRL, SCI_DELWORDLEFT},
{SCK_BACK, SCI_ALT, SCI_UNDO},
{SCK_BACK, SCI_CSHIFT, SCI_DELLINELEFT},
{'Z', SCI_CTRL, SCI_UNDO},
{'Y', SCI_CTRL, SCI_REDO},
{'X', SCI_CTRL, SCI_CUT},

View File

@@ -1,6 +1,8 @@
// Scintilla source code edit control
// KeyMap.h - defines a mapping between keystrokes and commands
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file KeyMap.h
** Defines a mapping between keystrokes and commands.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef KEYTOCOMMAND_H
@@ -13,6 +15,8 @@
#define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT)
#define SCI_ASHIFT (SCI_ALT | SCI_SHIFT)
/**
*/
class KeyToCommand {
public:
int key;
@@ -20,11 +24,14 @@ public:
unsigned int msg;
};
/**
*/
class KeyMap {
KeyToCommand *kmap;
int len;
int alloc;
static KeyToCommand MapDefault[];
public:
KeyMap();
~KeyMap();

View File

@@ -1,13 +1,15 @@
// SciTE - Scintilla based Text Editor
// KeyWords.cxx - colourise for particular languages
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// Scintilla source code edit control
/** @file KeyWords.cxx
** Colourise for particular languages.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
@@ -18,28 +20,137 @@
#include "SciLexer.h"
LexerModule *LexerModule::base = 0;
int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1;
LexerModule::LexerModule(int language_, LexerFunction fn_) :
language(language_), fn(fn_) {
LexerModule::LexerModule(int language_, LexerFunction fnLexer_,
const char *languageName_, LexerFunction fnFolder_) :
language(language_),
languageName(languageName_),
fnLexer(fnLexer_),
fnFolder(fnFolder_) {
next = base;
base = this;
if (language == SCLEX_AUTOMATIC) {
language = nextLanguage;
nextLanguage++;
}
}
void LexerModule::Colourise(unsigned int startPos, int lengthDoc, int initStyle,
int language, WordList *keywordlists[], Accessor &styler) {
LexerModule *LexerModule::Find(int language) {
LexerModule *lm = base;
while (lm) {
if (lm->language == language) {
lm->fn(startPos, lengthDoc, initStyle, keywordlists, styler);
return;
return lm;
}
lm = lm->next;
}
// Unknown language
// Null language means all style bytes are 0 so just mark the end - no need to fill in.
if (lengthDoc > 0) {
styler.StartAt(startPos + lengthDoc - 1);
styler.StartSegment(startPos + lengthDoc - 1);
styler.ColourTo(startPos + lengthDoc - 1, 0);
return 0;
}
LexerModule *LexerModule::Find(const char *languageName) {
if (languageName) {
LexerModule *lm = base;
while (lm) {
if (lm->languageName && 0 == strcmp(lm->languageName, languageName)) {
return lm;
}
lm = lm->next;
}
}
return 0;
}
void LexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler) {
if (fnLexer)
fnLexer(startPos, lengthDoc, initStyle, keywordlists, styler);
}
void LexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler) {
if (fnFolder) {
int lineCurrent = styler.GetLine(startPos);
// Move back one line in case deletion wrecked current line fold state
if (lineCurrent > 0) {
lineCurrent--;
int newStartPos = styler.LineStart(lineCurrent);
lengthDoc += startPos - newStartPos;
startPos = newStartPos;
initStyle = 0;
if (startPos > 0) {
initStyle = styler.StyleAt(startPos - 1);
}
}
fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler);
}
}
static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[],
Accessor &styler) {
// Null language means all style bytes are 0 so just mark the end - no need to fill in.
if (length > 0) {
styler.StartAt(startPos + length - 1);
styler.StartSegment(startPos + length - 1);
styler.ColourTo(startPos + length - 1, 0);
}
}
LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null");
#ifdef __vms
// The following code forces a reference to all of the Scintilla lexers.
// If we don't do something like this, then the linker tends to "optimize"
// them away. (eric@sourcegear.com)
// Taken from wxWindow's stc.cpp. Walter.
int wxForceScintillaLexers(void) {
extern LexerModule lmAda;
extern LexerModule lmAVE;
extern LexerModule lmConf;
extern LexerModule lmDiff;
extern LexerModule lmLatex;
extern LexerModule lmPascal;
extern LexerModule lmCPP;
extern LexerModule lmHTML;
extern LexerModule lmXML;
extern LexerModule lmProps;
extern LexerModule lmErrorList;
extern LexerModule lmMake;
extern LexerModule lmBatch;
extern LexerModule lmPerl;
extern LexerModule lmPython;
extern LexerModule lmSQL;
extern LexerModule lmVB;
extern LexerModule lmRuby;
if (
&lmAda
&& &lmAVE
&& &lmConf
&& &lmDiff
&& &lmLatex
&& &lmPascal
&& &lmCPP
&& &lmHTML
&& &lmXML
&& &lmProps
&& &lmErrorList
&& &lmMake
&& &lmBatch
&& &lmPerl
&& &lmPython
&& &lmSQL
&& &lmVB
&& &lmRuby
)
{
return 1;
}
else
{
return 0;
}
}
#endif

View File

@@ -0,0 +1,188 @@
// SciTE - Scintilla based Text Editor
/** @file LexAVE.cxx
** Lexer for Avenue.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static void ColouriseAveDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
bool fold = styler.GetPropertyInt("fold");
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
int state = initStyle;
if (state == SCE_AVE_STRINGEOL) // Does not leak onto next line
state = SCE_AVE_DEFAULT;
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
int visibleChars = 0;
styler.StartSegment(startPos);
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
// 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_AVE_STRINGEOL) {
styler.ColourTo(i, state);
state = SCE_AVE_DEFAULT;
}
if (fold) {
int lev = levelPrev;
if (visibleChars == 0)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
styler.SetLevel(lineCurrent, lev);
lineCurrent++;
levelPrev = levelCurrent;
}
visibleChars = 0;
}
if (!isspace(ch))
visibleChars++;
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
i += 1;
continue;
}
if (state == SCE_AVE_DEFAULT) {
if (iswordstart(ch) || (ch == '.') ) {
styler.ColourTo(i-1, state);
state = SCE_AVE_IDENTIFIER;
} else if (ch == '\'') {
styler.ColourTo(i-1, state);
state = SCE_AVE_COMMENT;
} else if (ch == '\"') {
styler.ColourTo(i-1, state);
state = SCE_AVE_STRING;
} else if (ch == '#') {
styler.ColourTo(i-1, state);
state = SCE_AVE_ENUM;
} else if (isoperator(ch) ) {
styler.ColourTo(i-1, state);
styler.ColourTo(i, SCE_AVE_OPERATOR);
}
}
else if (state == SCE_AVE_COMMENT) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i-1, state);
state = SCE_AVE_DEFAULT;
}
}
else if (state == SCE_AVE_ENUM) {
if (isoperator(ch) || ch == ' ' || ch == '\'' || ch == '\r' || ch == '\n') {
styler.ColourTo(i-1, state);
state = SCE_AVE_DEFAULT;
}
}
else if (state == SCE_AVE_STRING) {
if (ch == '\"') {
if (chNext == '\"') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
} else
{
styler.ColourTo(i, state);
state = SCE_AVE_DEFAULT;
}
} else if (chNext == '\r' || chNext == '\n') {
styler.ColourTo(i-1, SCE_AVE_STRINGEOL);
state = SCE_AVE_STRINGEOL;
}
}
if ((state == SCE_AVE_IDENTIFIER)) {
if (!iswordchar(ch) || ch == '.' ) {
char s[100];
unsigned int start = styler.GetStartSegment();
unsigned int end = i - 1;
for (unsigned int ii = 0; ii < end - start + 1 && ii < 30; ii++) {
s[ii] = static_cast<char>(tolower(styler[start + ii]));
s[ii + 1] = '\0';
}
char chAttr = SCE_AVE_IDENTIFIER;
if (isdigit(s[0]))
chAttr = SCE_AVE_NUMBER;
else {
if ((strcmp(s, "for") == 0) || (strcmp(s, "if") == 0) || (strcmp(s, "while") == 0))
{
levelCurrent +=1;
chAttr = SCE_AVE_STATEMENT;
}
if (strcmp(s, "end") == 0)
{
levelCurrent -=1;
chAttr = SCE_AVE_STATEMENT;
}
if ( (strcmp(s, "then") == 0) || (strcmp(s, "else") == 0) || (strcmp(s, "break") == 0) ||
(strcmp(s, "each") == 0) ||
(strcmp(s, "exit") == 0) || (strcmp(s, "continue") == 0) || (strcmp(s, "return") == 0) ||
(strcmp(s, "by") == 0) || (strcmp(s, "in") == 0) || (strcmp(s, "elseif") == 0))
{
chAttr = SCE_AVE_STATEMENT;
}
if ((strcmp(s, "av") == 0) || (strcmp(s, "self") == 0))
{
chAttr = SCE_AVE_KEYWORD;
}
if (keywords.InList(s))
{
chAttr = SCE_AVE_WORD;
}
}
styler.ColourTo(end, chAttr);
state = SCE_AVE_DEFAULT;
if (ch == '\'') {
state = SCE_AVE_COMMENT;
} else if (ch == '\"') {
state = SCE_AVE_STRING;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_AVE_OPERATOR);
}
}
}
}
styler.ColourTo(lengthDoc - 1, state);
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
if (fold) {
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
}
LexerModule lmAVE(SCLEX_AVE, ColouriseAveDoc, "ave");

View File

@@ -0,0 +1,198 @@
// SciTE - Scintilla based Text Editor
// LexAda.cxx - lexer for Ada95
// by Tahir Karaca <tahir@bigfoot.de>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
inline void classifyWordAda(unsigned int start, unsigned int end,
WordList &keywords, Accessor &styler) {
static const unsigned KEWORD_LEN_MAX = 30;
char wordLower[KEWORD_LEN_MAX + 1];
unsigned i;
for(i = 0; ( i < KEWORD_LEN_MAX ) && ( i < end - start + 1 ); i++) {
wordLower[i] = static_cast<char>(tolower(styler[start + i]));
}
wordLower[i] = '\0';
// int levelChange = 0;
char chAttr = SCE_ADA_IDENTIFIER;
if (keywords.InList(wordLower)) {
chAttr = SCE_ADA_WORD;
// Folding doesn't work this way since the semantics of some keywords depends
// on the current context.
// E.g. - "cond1 and THEN cond2" <-> "if ... THEN ..."
// - "procedure X IS ... end X;" <-> "procedure X IS new Y;"
// if (strcmp(wordLower, "is") == 0 || strcmp(wordLower, "then") == 0)
// levelChange=1;
// else if (strcmp(wordLower, "end") == 0)
// levelChange=-1;
}
styler.ColourTo(end, chAttr);
// return levelChange;
}
inline bool isAdaOperator(char ch) {
if (ch == '&' || ch == '\'' || ch == '(' || ch == ')' ||
ch == '*' || ch == '+' || ch == ',' || ch == '-' ||
ch == '.' || ch == '/' || ch == ':' || ch == ';' ||
ch == '<' || ch == '=' || ch == '>')
return true;
return false;
}
inline void styleTokenBegin(char beginChar, unsigned int pos, int &state,
Accessor &styler) {
if (isalpha(beginChar)) {
styler.ColourTo(pos-1, state);
state = SCE_ADA_IDENTIFIER;
} else if (isdigit(beginChar)) {
styler.ColourTo(pos-1, state);
state = SCE_ADA_NUMBER;
} else if (beginChar == '-' && styler.SafeGetCharAt(pos + 1) == '-') {
styler.ColourTo(pos-1, state);
state = SCE_ADA_COMMENT;
} else if (beginChar == '\"') {
styler.ColourTo(pos-1, state);
state = SCE_ADA_STRING;
} else if (beginChar == '\'' && styler.SafeGetCharAt(pos + 2) == '\'') {
styler.ColourTo(pos-1, state);
state = SCE_ADA_CHARACTER;
} else if (isAdaOperator(beginChar)) {
styler.ColourTo(pos-1, state);
styler.ColourTo(pos, SCE_ADA_OPERATOR);
}
}
static void ColouriseAdaDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
// bool fold = styler.GetPropertyInt("fold");
// int lineCurrent = styler.GetLine(startPos);
// int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
// int levelCurrent = levelPrev;
int state = initStyle;
if (state == SCE_ADA_STRINGEOL) // Does not leak onto next line
state = SCE_ADA_DEFAULT;
char chNext = styler[startPos];
const unsigned int lengthDoc = startPos + length;
//int visibleChars = 0;
styler.StartSegment(startPos);
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
// 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
if (state == SCE_ADA_STRINGEOL) {
styler.ColourTo(i, state);
state = SCE_ADA_DEFAULT;
}
// if (fold) {
// int lev = levelPrev;
// if (visibleChars == 0)
// lev |= SC_FOLDLEVELWHITEFLAG;
// if ((levelCurrent > levelPrev) && (visibleChars > 0))
// lev |= SC_FOLDLEVELHEADERFLAG;
// styler.SetLevel(lineCurrent, lev);
// lineCurrent++;
// levelPrev = levelCurrent;
// }
//visibleChars = 0;
}
//if (!isspacechar(ch))
// visibleChars++;
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
i += 1;
continue;
}
if (state == SCE_ADA_DEFAULT) {
styleTokenBegin(ch, i, state, styler);
} else if (state == SCE_ADA_IDENTIFIER) {
if (!iswordchar(ch)) {
classifyWordAda(styler.GetStartSegment(),
i - 1,
keywords,
styler);
state = SCE_ADA_DEFAULT;
styleTokenBegin(ch, i, state, styler);
}
} else if (state == SCE_ADA_COMMENT) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i-1, state);
state = SCE_ADA_DEFAULT;
}
} else if (state == SCE_ADA_STRING) {
if (ch == '"' ) {
if( chNext == '"' ) {
i++;
chNext = styler.SafeGetCharAt(i + 1);
} else {
styler.ColourTo(i, state);
state = SCE_ADA_DEFAULT;
}
} else if (chNext == '\r' || chNext == '\n') {
styler.ColourTo(i-1, SCE_ADA_STRINGEOL);
state = SCE_ADA_STRINGEOL;
}
} else if (state == SCE_ADA_CHARACTER) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i-1, SCE_ADA_STRINGEOL);
state = SCE_ADA_STRINGEOL;
} else if (ch == '\'' && styler.SafeGetCharAt(i - 2) == '\'') {
styler.ColourTo(i, state);
state = SCE_ADA_DEFAULT;
}
} else if (state == SCE_ADA_NUMBER) {
if ( !( isdigit(ch) || ch == '.' || ch == '_' || ch == '#'
|| ch == 'A' || ch == 'B' || ch == 'C' || ch == 'D'
|| ch == 'E' || ch == 'F'
|| ch == 'a' || ch == 'b' || ch == 'c' || ch == 'd'
|| ch == 'e' || ch == 'f' ) ) {
styler.ColourTo(i-1, SCE_ADA_NUMBER);
state = SCE_ADA_DEFAULT;
styleTokenBegin(ch, i, state, styler);
}
}
}
styler.ColourTo(lengthDoc - 1, state);
// // Fill in the real level of the next line, keeping the current flags as they will be filled in later
// if (fold) {
// int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
// styler.SetLevel(lineCurrent, levelPrev | flagsNext);
// }
}
LexerModule lmAda(SCLEX_ADA, ColouriseAdaDoc, "ada");

View File

@@ -1,13 +1,15 @@
// SciTE - Scintilla based Text Editor
// LexCPP.cxx - lexer for C++, C, Java, and Javascript
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// Scintilla source code edit control
/** @file LexCPP.cxx
** Lexer for C++, C, Java, and Javascript.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
@@ -17,246 +19,370 @@
#include "Scintilla.h"
#include "SciLexer.h"
static bool classifyWordCpp(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
char s[100];
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = styler[start + i];
s[i + 1] = '\0';
}
bool wordIsUUID = false;
char chAttr = SCE_C_IDENTIFIER;
if (isdigit(s[0]) || (s[0] == '.'))
chAttr = SCE_C_NUMBER;
else {
if (keywords.InList(s)) {
chAttr = SCE_C_WORD;
wordIsUUID = strcmp(s, "uuid") == 0;
}
}
styler.ColourTo(end, chAttr);
return wordIsUUID;
static bool IsOKBeforeRE(int ch) {
return (ch == '(') || (ch == '=') || (ch == ',');
}
static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
static void getRange(unsigned int start,
unsigned int end,
Accessor &styler,
char *s,
unsigned int len) {
unsigned int i = 0;
while ((i < end - start + 1) && (i < len-1)) {
s[i] = styler[start + i];
i++;
}
s[i] = '\0';
}
inline bool IsASpace(int ch) {
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
}
inline bool IsAWordChar(int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
}
inline bool IsAWordStart(int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
inline bool IsADigit(int ch) {
return (ch >= '0') && (ch <= '9');
}
// All languages handled so far can treat all characters >= 0x80 as one class
// which just continues the current token or starts an identifier if in default.
// DBCS treated specially as the second character can be < 0x80 and hence
// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80
class ColouriseContext {
Accessor &styler;
int lengthDoc;
int currentPos;
ColouriseContext& operator=(const ColouriseContext&) {
return *this;
}
public:
bool atEOL;
int state;
int chPrev;
int ch;
int chNext;
ColouriseContext(unsigned int startPos, int length,
int initStyle, Accessor &styler_) :
styler(styler_),
lengthDoc(startPos + length),
currentPos(startPos),
atEOL(false),
state(initStyle),
chPrev(0),
ch(0),
chNext(0) {
styler.StartAt(startPos);
styler.StartSegment(startPos);
int pos = currentPos;
ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
if (styler.IsLeadByte(static_cast<char>(ch))) {
pos++;
ch = ch << 8;
ch |= static_cast<unsigned char>(styler.SafeGetCharAt(pos));
}
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1));
if (styler.IsLeadByte(static_cast<char>(chNext))) {
chNext = chNext << 8;
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(pos+2));
}
atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
}
void Complete() {
styler.ColourTo(currentPos - 1, state);
}
bool More() {
return currentPos <= lengthDoc;
}
void Forward() {
// A lot of this is repeated from the constructor - TODO: merge code
chPrev = ch;
currentPos++;
if (ch >= 0x100)
currentPos++;
ch = chNext;
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+1));
if (styler.IsLeadByte(static_cast<char>(chNext))) {
chNext = chNext << 8;
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + 2));
}
// 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
atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
}
void ChangeState(int state_) {
state = state_;
}
void SetState(int state_) {
styler.ColourTo(currentPos - 1, state);
state = state_;
}
void ForwardSetState(int state_) {
Forward();
styler.ColourTo(currentPos - 1, state);
state = state_;
}
void GetCurrent(char *s, int len) {
getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
}
int LengthCurrent() {
return currentPos - styler.GetStartSegment();
}
bool Match(char ch0) {
return ch == ch0;
}
bool Match(char ch0, char ch1) {
return (ch == ch0) && (chNext == ch1);
}
bool Match(const char *s) {
if (ch != *s)
return false;
s++;
if (chNext != *s)
return false;
s++;
for (int n=2; *s; n++) {
if (*s != styler.SafeGetCharAt(currentPos+n))
return false;
s++;
}
return true;
}
};
static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
bool fold = styler.GetPropertyInt("fold");
WordList &keywords2 = *keywordlists[1];
bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor");
if (initStyle == SCE_C_STRINGEOL) // Does not leak onto next line
initStyle = SCE_C_DEFAULT;
int chPrevNonWhite = ' ';
int visibleChars = 0;
bool lastWordWasUUID = false;
ColouriseContext cc(startPos, length, initStyle, styler);
for (; cc.More(); cc.Forward()) {
if (cc.state == SCE_C_STRINGEOL) {
if (cc.atEOL) {
cc.SetState(SCE_C_DEFAULT);
}
} else if (cc.state == SCE_C_OPERATOR) {
cc.SetState(SCE_C_DEFAULT);
} else if (cc.state == SCE_C_NUMBER) {
if (!IsAWordChar(cc.ch)) {
cc.SetState(SCE_C_DEFAULT);
}
} else if (cc.state == SCE_C_IDENTIFIER) {
if (!IsAWordChar(cc.ch) || (cc.ch == '.')) {
char s[100];
cc.GetCurrent(s, sizeof(s));
if (keywords.InList(s)) {
lastWordWasUUID = strcmp(s, "uuid") == 0;
cc.ChangeState(SCE_C_WORD);
} else if (keywords2.InList(s)) {
cc.ChangeState(SCE_C_WORD2);
}
cc.SetState(SCE_C_DEFAULT);
}
} if (cc.state == SCE_C_PREPROCESSOR) {
if (stylingWithinPreprocessor) {
if (IsASpace(cc.ch)) {
cc.SetState(SCE_C_DEFAULT);
}
} else {
if (cc.atEOL && (cc.chPrev != '\\')) {
cc.SetState(SCE_C_DEFAULT);
}
}
} else if (cc.state == SCE_C_COMMENT) {
if (cc.Match('*', '/')) {
cc.Forward();
cc.ForwardSetState(SCE_C_DEFAULT);
}
} else if (cc.state == SCE_C_COMMENTDOC) {
if (cc.Match('*', '/')) {
cc.Forward();
cc.ForwardSetState(SCE_C_DEFAULT);
}
} else if (cc.state == SCE_C_COMMENTLINE || cc.state == SCE_C_COMMENTLINEDOC) {
if (cc.ch == '\r' || cc.ch == '\n') {
cc.SetState(SCE_C_DEFAULT);
}
} else if (cc.state == SCE_C_STRING) {
if (cc.ch == '\\') {
if (cc.chNext == '\"' || cc.chNext == '\'' || cc.chNext == '\\') {
cc.Forward();
}
} else if (cc.ch == '\"') {
cc.ForwardSetState(SCE_C_DEFAULT);
} else if ((cc.atEOL) && (cc.chPrev != '\\')) {
cc.ChangeState(SCE_C_STRINGEOL);
}
} else if (cc.state == SCE_C_CHARACTER) {
if ((cc.ch == '\r' || cc.ch == '\n') && (cc.chPrev != '\\')) {
cc.ChangeState(SCE_C_STRINGEOL);
} else if (cc.ch == '\\') {
if (cc.chNext == '\"' || cc.chNext == '\'' || cc.chNext == '\\') {
cc.Forward();
}
} else if (cc.ch == '\'') {
cc.ForwardSetState(SCE_C_DEFAULT);
}
} else if (cc.state == SCE_C_REGEX) {
if (cc.ch == '\r' || cc.ch == '\n' || cc.ch == '/') {
cc.ForwardSetState(SCE_C_DEFAULT);
} else if (cc.ch == '\\') {
// Gobble up the quoted character
if (cc.chNext == '\\' || cc.chNext == '/') {
cc.Forward();
}
}
} else if (cc.state == SCE_C_VERBATIM) {
if (cc.ch == '\"') {
if (cc.chNext == '\"') {
cc.Forward();
} else {
cc.ForwardSetState(SCE_C_DEFAULT);
}
}
} else if (cc.state == SCE_C_UUID) {
if (cc.ch == '\r' || cc.ch == '\n' || cc.ch == ')') {
cc.SetState(SCE_C_DEFAULT);
}
}
if (cc.state == SCE_C_DEFAULT) {
if (cc.Match('@', '\"')) {
cc.SetState(SCE_C_VERBATIM);
cc.Forward();
} else if (IsADigit(cc.ch) || (cc.ch == '.' && IsADigit(cc.chNext))) {
if (lastWordWasUUID) {
cc.SetState(SCE_C_UUID);
lastWordWasUUID = false;
} else {
cc.SetState(SCE_C_NUMBER);
}
} else if (IsAWordStart(cc.ch) || (cc.ch == '@')) {
if (lastWordWasUUID) {
cc.SetState(SCE_C_UUID);
lastWordWasUUID = false;
} else {
cc.SetState(SCE_C_IDENTIFIER);
}
} else if (cc.Match('/', '*')) {
if (cc.Match("/**") || cc.Match("/*!")) // Support of Qt/Doxygen doc. style
cc.SetState(SCE_C_COMMENTDOC);
else
cc.SetState(SCE_C_COMMENT);
cc.Forward(); // Eat the * so it isn't used for the end of the comment
} else if (cc.Match('/', '/')) {
if (cc.Match("///") || cc.Match("//!")) // Support of Qt/Doxygen doc. style
cc.SetState(SCE_C_COMMENTLINEDOC);
else
cc.SetState(SCE_C_COMMENTLINE);
} else if (cc.ch == '/' && IsOKBeforeRE(chPrevNonWhite)) {
cc.SetState(SCE_C_REGEX);
} else if (cc.ch == '\"') {
cc.SetState(SCE_C_STRING);
} else if (cc.ch == '\'') {
cc.SetState(SCE_C_CHARACTER);
} else if (cc.ch == '#' && visibleChars == 0) {
// Preprocessor commands are alone on their line
cc.SetState(SCE_C_PREPROCESSOR);
// Skip whitespace between # and preprocessor word
do {
cc.Forward();
} while (IsASpace(cc.ch) && cc.More());
} else if (isoperator(static_cast<char>(cc.ch))) {
cc.SetState(SCE_C_OPERATOR);
}
}
if (cc.atEOL) {
// Reset states to begining of colourise so no surprises
// if different sets of lines lexed.
chPrevNonWhite = ' ';
visibleChars = 0;
lastWordWasUUID = false;
}
if (!IsASpace(cc.ch)) {
chPrevNonWhite = cc.ch;
visibleChars++;
}
}
cc.Complete();
}
static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment");
bool foldCompact = styler.GetPropertyInt("fold.compact", 1);
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
int state = initStyle;
if (state == SCE_C_STRINGEOL) // Does not leak onto next line
state = SCE_C_DEFAULT;
char chPrev = ' ';
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
int visibleChars = 0;
styler.StartSegment(startPos);
bool lastWordWasUUID = false;
for (unsigned int i = startPos; i < lengthDoc; i++) {
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
// 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);
state = SCE_C_DEFAULT;
int stylePrev = style;
style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (foldComment &&
(style == SCE_C_COMMENT || style == SCE_C_COMMENTDOC)) {
if (style != stylePrev) {
levelCurrent++;
} else if ((style != styleNext) && !atEOL) {
// Comments don't end at end of line and the next character may be unstyled.
levelCurrent--;
}
if (fold) {
int lev = levelPrev;
if (visibleChars == 0)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
}
if (style == SCE_C_OPERATOR) {
if (ch == '{') {
levelCurrent++;
} else if (ch == '}') {
levelCurrent--;
}
}
if (atEOL) {
int lev = levelPrev;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
lineCurrent++;
levelPrev = levelCurrent;
}
lineCurrent++;
levelPrev = levelCurrent;
visibleChars = 0;
}
if (!isspace(ch))
if (!isspacechar(ch))
visibleChars++;
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
i += 1;
continue;
}
if (state == SCE_C_DEFAULT) {
if (ch == '@' && chNext == '\"') {
styler.ColourTo(i-1, state);
state = SCE_C_VERBATIM;
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
} else if (iswordstart(ch) || (ch == '@')) {
styler.ColourTo(i-1, state);
if (lastWordWasUUID) {
state = SCE_C_UUID;
lastWordWasUUID = false;
} else {
state = SCE_C_IDENTIFIER;
}
} else if (ch == '/' && chNext == '*') {
styler.ColourTo(i-1, state);
if (styler.SafeGetCharAt(i + 2) == '*')
state = SCE_C_COMMENTDOC;
else
state = SCE_C_COMMENT;
} else if (ch == '/' && chNext == '/') {
styler.ColourTo(i-1, state);
state = SCE_C_COMMENTLINE;
} else if (ch == '\"') {
styler.ColourTo(i-1, state);
state = SCE_C_STRING;
} else if (ch == '\'') {
styler.ColourTo(i-1, state);
state = SCE_C_CHARACTER;
} else if (ch == '#' && visibleChars == 1) {
// Preprocessor commands are alone on their line
styler.ColourTo(i-1, state);
state = SCE_C_PREPROCESSOR;
// Skip whitespace between # and preprocessor word
do {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
} while (isspace(ch) && (i < lengthDoc));
} else if (isoperator(ch)) {
styler.ColourTo(i-1, state);
styler.ColourTo(i, SCE_C_OPERATOR);
if ((ch == '{') || (ch == '}')) {
levelCurrent += (ch == '{') ? 1 : -1;
}
}
} else if (state == SCE_C_IDENTIFIER) {
if (!iswordchar(ch)) {
lastWordWasUUID = classifyWordCpp(styler.GetStartSegment(), i - 1, keywords, styler);
state = SCE_C_DEFAULT;
if (ch == '/' && chNext == '*') {
if (styler.SafeGetCharAt(i + 2) == '*')
state = SCE_C_COMMENTDOC;
else
state = SCE_C_COMMENT;
} else if (ch == '/' && chNext == '/') {
state = SCE_C_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_C_STRING;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_C_OPERATOR);
if ((ch == '{') || (ch == '}')) {
levelCurrent += (ch == '{') ? 1 : -1;
}
}
}
} else {
if (state == SCE_C_PREPROCESSOR) {
if (stylingWithinPreprocessor) {
if (isspace(ch)) {
styler.ColourTo(i-1, state);
state = SCE_C_DEFAULT;
}
} else {
if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
styler.ColourTo(i-1, state);
state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_COMMENT) {
if (ch == '/' && chPrev == '*') {
if (((i > styler.GetStartSegment() + 2) || (
(initStyle == SCE_C_COMMENT) &&
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_COMMENTDOC) {
if (ch == '/' && chPrev == '*') {
if (((i > styler.GetStartSegment() + 2) || (
(initStyle == SCE_C_COMMENTDOC) &&
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_COMMENTLINE) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i-1, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_STRING) {
if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\"') {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
} else if (chNext == '\r' || chNext == '\n') {
styler.ColourTo(i-1, SCE_C_STRINGEOL);
state = SCE_C_STRINGEOL;
}
} else if (state == SCE_C_CHARACTER) {
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
styler.ColourTo(i-1, SCE_C_STRINGEOL);
state = SCE_C_STRINGEOL;
} else if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\'') {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_VERBATIM) {
if (ch == '\"') {
if (chNext == '\"') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
} else {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_UUID) {
if (ch == '\r' || ch == '\n' || ch == ')') {
styler.ColourTo(i-1, state);
if (ch == ')')
styler.ColourTo(i, SCE_C_OPERATOR);
state = SCE_C_DEFAULT;
}
}
}
chPrev = ch;
}
styler.ColourTo(lengthDoc - 1, state);
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
if (fold) {
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
//styler.SetLevel(lineCurrent, levelCurrent | flagsNext);
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc);
LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc, "cpp", FoldCppDoc);
LexerModule lmTCL(SCLEX_TCL, ColouriseCppDoc, "tcl", FoldCppDoc);

View File

@@ -0,0 +1,177 @@
// Scintilla source code edit control
/** @file LexConf.cxx
** Lexer for Apache Configuration Files.
**
** First working version contributed by Ahmad Zawawi <zeus_go64@hotmail.com> on October 28, 2000.
** i created this lexer because i needed something pretty when dealing
** when Apache Configuration files...
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
{
int state = SCE_CONF_DEFAULT;
char chNext = styler[startPos];
int lengthDoc = startPos + length;
// create a buffer large enough to take the largest chunk...
char *buffer = new char[length];
int bufferCount = 0;
// this assumes that we have 2 keyword list in conf.properties
WordList &directives = *keywordLists[0];
WordList &params = *keywordLists[1];
// go through all provided text segment
// using the hand-written state machine shown below
styler.StartAt(startPos);
styler.StartSegment(startPos);
for (int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
i++;
continue;
}
switch(state) {
case SCE_CONF_DEFAULT:
if( ch == '\n' || ch == '\r' || ch == '\t' || ch == ' ') {
// whitespace is simply ignored here...
styler.ColourTo(i,SCE_CONF_DEFAULT);
break;
} else if( ch == '#' ) {
// signals the start of a comment...
state = SCE_CONF_COMMENT;
styler.ColourTo(i,SCE_CONF_COMMENT);
} else if( ch == '.' /*|| ch == '/'*/) {
// signals the start of a file...
state = SCE_CONF_EXTENSION;
styler.ColourTo(i,SCE_CONF_EXTENSION);
} else if( ch == '"') {
state = SCE_CONF_STRING;
styler.ColourTo(i,SCE_CONF_STRING);
} else if( ispunct(ch) ) {
// signals an operator...
// no state jump necessary for this
// simple case...
styler.ColourTo(i,SCE_CONF_OPERATOR);
} else if( isalpha(ch) ) {
// signals the start of an identifier
bufferCount = 0;
buffer[bufferCount++] = static_cast<char>(tolower(ch));
state = SCE_CONF_IDENTIFIER;
} else if( isdigit(ch) ) {
// signals the start of a number
bufferCount = 0;
buffer[bufferCount++] = ch;
//styler.ColourTo(i,SCE_CONF_NUMBER);
state = SCE_CONF_NUMBER;
} else {
// style it the default style..
styler.ColourTo(i,SCE_CONF_DEFAULT);
}
break;
case SCE_CONF_COMMENT:
// if we find a newline here,
// we simply go to default state
// else continue to work on it...
if( ch == '\n' || ch == '\r' ) {
state = SCE_CONF_DEFAULT;
} else {
styler.ColourTo(i,SCE_CONF_COMMENT);
}
break;
case SCE_CONF_EXTENSION:
// if we find a non-alphanumeric char,
// we simply go to default state
// else we're still dealing with an extension...
if( isalnum(ch) || (ch == '_') ||
(ch == '-') || (ch == '$') ||
(ch == '/') || (ch == '.') || (ch == '*') )
{
styler.ColourTo(i,SCE_CONF_EXTENSION);
} else {
state = SCE_CONF_DEFAULT;
chNext = styler[i--];
}
break;
case SCE_CONF_STRING:
// if we find the end of a string char, we simply go to default state
// else we're still dealing with an string...
if( (ch == '"' && styler.SafeGetCharAt(i-1)!='\\') || (ch == '\n') || (ch == '\r') ) {
state = SCE_CONF_DEFAULT;
}
styler.ColourTo(i,SCE_CONF_STRING);
break;
case SCE_CONF_IDENTIFIER:
// stay in CONF_IDENTIFIER state until we find a non-alphanumeric
if( isalnum(ch) || (ch == '_') || (ch == '-') || (ch == '/') || (ch == '$') || (ch == '.') || (ch == '*')) {
buffer[bufferCount++] = static_cast<char>(tolower(ch));
} else {
state = SCE_CONF_DEFAULT;
buffer[bufferCount] = '\0';
// check if the buffer contains a keyword, and highlight it if it is a keyword...
if(directives.InList(buffer)) {
styler.ColourTo(i-1,SCE_CONF_DIRECTIVE );
} else if(params.InList(buffer)) {
styler.ColourTo(i-1,SCE_CONF_PARAMETER );
} else if(strchr(buffer,'/') || strchr(buffer,'.')) {
styler.ColourTo(i-1,SCE_CONF_EXTENSION);
} else {
styler.ColourTo(i-1,SCE_CONF_DEFAULT);
}
// push back the faulty character
chNext = styler[i--];
}
break;
case SCE_CONF_NUMBER:
// stay in CONF_NUMBER state until we find a non-numeric
if( isdigit(ch) || ch == '.') {
buffer[bufferCount++] = ch;
} else {
state = SCE_CONF_DEFAULT;
buffer[bufferCount] = '\0';
// Colourize here...
if( strchr(buffer,'.') ) {
// it is an IP address...
styler.ColourTo(i-1,SCE_CONF_IP);
} else {
// normal number
styler.ColourTo(i-1,SCE_CONF_NUMBER);
}
// push back a character
chNext = styler[i--];
}
break;
}
}
}
LexerModule lmConf(SCLEX_CONF, ColouriseConfDoc, "conf");

View File

@@ -0,0 +1,321 @@
// Scintilla source code edit control
/** @file LexEiffel.cxx
** Lexer for Eiffel.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <fcntl.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
inline bool isEiffelOperator(unsigned int ch) {
// '.' left out as it is used to make up numbers
return ch == '*' || ch == '/' || ch == '\\' || ch == '-' || ch == '+' ||
ch == '(' || ch == ')' || ch == '=' ||
ch == '{' || ch == '}' || ch == '~' ||
ch == '[' || ch == ']' || ch == ';' ||
ch == '<' || ch == '>' || ch == ',' ||
ch == '.' || ch == '^' || ch == '%' || ch == ':' ||
ch == '!' || ch == '@' || ch == '?';
}
static void getRangeLowered(unsigned int start,
unsigned int end,
Accessor &styler,
char *s,
unsigned int len) {
unsigned int i = 0;
while ((i < end - start + 1) && (i < len-1)) {
s[i] = static_cast<char>(tolower(styler[start + i]));
i++;
}
s[i] = '\0';
}
inline bool IsASpace(unsigned int ch) {
return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
}
inline bool IsAWordChar(unsigned int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
}
inline bool IsAWordStart(unsigned int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
inline bool IsADigit(unsigned int ch) {
return (ch >= '0') && (ch <= '9');
}
// All languages handled so far can treat all characters >= 0x80 as one class
// which just continues the current token or starts an identifier if in default.
// DBCS treated specially as the second character can be < 0x80 and hence
// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80
class xColouriseContext {
Accessor &styler;
int lengthDoc;
int currentPos;
xColouriseContext& operator=(const xColouriseContext&) {
return *this;
}
public:
int state;
unsigned int chPrev;
unsigned int ch;
unsigned int chNext;
xColouriseContext(unsigned int startPos, int length,
int initStyle, Accessor &styler_) :
styler(styler_),
lengthDoc(startPos + length),
currentPos(startPos),
state(initStyle),
chPrev(0),
ch(0),
chNext(0) {
styler.StartAt(startPos);
styler.StartSegment(startPos);
int pos = currentPos;
ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
if (styler.IsLeadByte(static_cast<char>(ch))) {
pos++;
ch = ch << 8;
ch |= static_cast<unsigned char>(styler.SafeGetCharAt(pos));
}
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1));
if (styler.IsLeadByte(static_cast<char>(chNext))) {
chNext = chNext << 8;
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(pos+2));
}
}
void Complete() {
styler.ColourTo(currentPos - 1, state);
}
bool More() {
return currentPos <= lengthDoc;
}
void Forward() {
chPrev = ch;
currentPos++;
if (ch >= 0x100)
currentPos++;
ch = chNext;
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+1));
if (styler.IsLeadByte(static_cast<char>(chNext))) {
chNext = chNext << 8;
chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + 2));
}
}
void ChangeState(int state_) {
state = state_;
}
void SetState(int state_) {
styler.ColourTo(currentPos - 1, state);
state = state_;
}
void GetCurrentLowered(char *s, int len) {
getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
}
};
static void ColouriseEiffelDoc(unsigned int startPos,
int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
xColouriseContext lc(startPos, length, initStyle, styler);
for (; lc.More(); lc.Forward()) {
if (lc.state == SCE_EIFFEL_STRINGEOL) {
if (lc.ch != '\r' && lc.ch != '\n') {
lc.SetState(SCE_EIFFEL_DEFAULT);
}
} else if (lc.state == SCE_EIFFEL_OPERATOR) {
lc.SetState(SCE_EIFFEL_DEFAULT);
} else if (lc.state == SCE_EIFFEL_WORD) {
if (!IsAWordChar(lc.ch)) {
char s[100];
lc.GetCurrentLowered(s, sizeof(s));
if (!keywords.InList(s)) {
lc.ChangeState(SCE_EIFFEL_IDENTIFIER);
}
lc.SetState(SCE_EIFFEL_DEFAULT);
}
} else if (lc.state == SCE_EIFFEL_NUMBER) {
if (!IsAWordChar(lc.ch)) {
lc.SetState(SCE_EIFFEL_DEFAULT);
}
} else if (lc.state == SCE_EIFFEL_COMMENTLINE) {
if (lc.ch == '\r' || lc.ch == '\n') {
lc.SetState(SCE_EIFFEL_DEFAULT);
}
} else if (lc.state == SCE_EIFFEL_STRING) {
if (lc.ch == '%') {
lc.Forward();
} else if (lc.ch == '\"') {
lc.Forward();
lc.SetState(SCE_EIFFEL_DEFAULT);
}
} else if (lc.state == SCE_EIFFEL_CHARACTER) {
if (lc.ch == '\r' || lc.ch == '\n') {
lc.SetState(SCE_EIFFEL_STRINGEOL);
} else if (lc.ch == '%') {
lc.Forward();
} else if (lc.ch == '\'') {
lc.Forward();
lc.SetState(SCE_EIFFEL_DEFAULT);
}
}
if (lc.state == SCE_EIFFEL_DEFAULT) {
if (lc.ch == '-' && lc.chNext == '-') {
lc.SetState(SCE_EIFFEL_COMMENTLINE);
} else if (lc.ch == '\"') {
lc.SetState(SCE_EIFFEL_STRING);
} else if (lc.ch == '\'') {
lc.SetState(SCE_EIFFEL_CHARACTER);
} else if (IsADigit(lc.ch) || (lc.ch == '.')) {
lc.SetState(SCE_EIFFEL_NUMBER);
} else if (IsAWordStart(lc.ch)) {
lc.SetState(SCE_EIFFEL_WORD);
} else if (isEiffelOperator(lc.ch)) {
lc.SetState(SCE_EIFFEL_OPERATOR);
}
}
}
lc.Complete();
}
static bool IsEiffelComment(Accessor &styler, int pos, int len) {
return len>1 && styler[pos]=='-' && styler[pos+1]=='-';
}
static void FoldEiffelDocIndent(unsigned int startPos, int length, int,
WordList *[], Accessor &styler) {
int lengthDoc = startPos + length;
// Backtrack to previous line in case need to fix its fold status
int lineCurrent = styler.GetLine(startPos);
if (startPos > 0) {
if (lineCurrent > 0) {
lineCurrent--;
startPos = styler.LineStart(lineCurrent);
}
}
int spaceFlags = 0;
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsEiffelComment);
char chNext = styler[startPos];
for (int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
int lev = indentCurrent;
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsEiffelComment);
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
// Only non whitespace lines can be headers
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
lev |= SC_FOLDLEVELHEADERFLAG;
} else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
// Line after is blank so check the next - maybe should continue further?
int spaceFlags2 = 0;
int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsEiffelComment);
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
lev |= SC_FOLDLEVELHEADERFLAG;
}
}
}
indentCurrent = indentNext;
styler.SetLevel(lineCurrent, lev);
lineCurrent++;
}
}
}
static void FoldEiffelDocKeyWords(unsigned int startPos, int length, int /* initStyle */, WordList *[],
Accessor &styler) {
unsigned int lengthDoc = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int stylePrev = 0;
int styleNext = styler.StyleAt(startPos);
// lastDeferred should be determined by looking back to last keyword in case
// the "deferred" is on a line before "class"
bool lastDeferred = false;
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if ((stylePrev != SCE_EIFFEL_WORD) && (style == SCE_EIFFEL_WORD)) {
char s[20];
unsigned int j = 0;
while ((j < (sizeof(s) - 1)) && (iswordchar(styler[i + j]))) {
s[j] = styler[i + j];
j++;
}
s[j] = '\0';
if (
(strcmp(s, "check") == 0) ||
(strcmp(s, "debug") == 0) ||
(strcmp(s, "deferred") == 0) ||
(strcmp(s, "do") == 0) ||
(strcmp(s, "from") == 0) ||
(strcmp(s, "if") == 0) ||
(strcmp(s, "inspect") == 0) ||
(strcmp(s, "once") == 0)
)
levelCurrent++;
if (!lastDeferred && (strcmp(s, "class") == 0))
levelCurrent++;
if (strcmp(s, "end") == 0)
levelCurrent--;
lastDeferred = strcmp(s, "deferred") == 0;
}
if (atEOL) {
int lev = levelPrev;
if (visibleChars == 0)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelPrev = levelCurrent;
visibleChars = 0;
}
if (!isspacechar(ch))
visibleChars++;
stylePrev = style;
}
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
LexerModule lmEiffel(SCLEX_EIFFEL, ColouriseEiffelDoc, "eiffel", FoldEiffelDocIndent);
LexerModule lmEiffelkw(SCLEX_EIFFELKW, ColouriseEiffelDoc, "eiffelkw", FoldEiffelDocKeyWords);

View File

@@ -1,13 +1,15 @@
// SciTE - Scintilla based Text Editor
// LexHTML.cxx - lexer for HTML
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// Scintilla source code edit control
/** @file LexHTML.cxx
** Lexer for HTML.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
@@ -32,6 +34,8 @@ static int segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigne
s[i + 1] = '\0';
}
//Platform::DebugPrintf("Scripting indicator [%s]\n", s);
if (strstr(s, "src")) // External script
return eScriptNone;
if (strstr(s, "vbs"))
return eScriptVBS;
if (strstr(s, "pyth"))
@@ -63,7 +67,6 @@ static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, u
return iResult;
}
//static int ScriptOfState(int state,int defaultScript)
static int ScriptOfState(int state) {
int scriptLanguage;
@@ -71,7 +74,7 @@ static int ScriptOfState(int state) {
scriptLanguage = eScriptPython;
} else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) {
scriptLanguage = eScriptVBS;
} else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_STRINGEOL)) {
} else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) {
scriptLanguage = eScriptJS;
} else if ((state >= SCE_HPHP_DEFAULT) && (state <= SCE_HPHP_COMMENTLINE)) {
scriptLanguage = eScriptPHP;
@@ -90,7 +93,7 @@ static int statePrintForState(int state, int inScriptType) {
StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_PYTHON);
} else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) {
StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_VBS);
} else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_STRINGEOL)) {
} else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) {
StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_JS);
} else {
StateToPrint = state;
@@ -106,7 +109,7 @@ static int stateForPrintState(int StateToPrint) {
state = StateToPrint - SCE_HA_PYTHON;
} else if ((StateToPrint >= SCE_HBA_START) && (StateToPrint <= SCE_HBA_STRINGEOL)) {
state = StateToPrint - SCE_HA_VBS;
} else if ((StateToPrint >= SCE_HJA_START) && (StateToPrint <= SCE_HJA_STRINGEOL)) {
} else if ((StateToPrint >= SCE_HJA_START) && (StateToPrint <= SCE_HJA_REGEX)) {
state = StateToPrint - SCE_HA_JS;
} else {
state = StateToPrint;
@@ -117,7 +120,51 @@ static int stateForPrintState(int StateToPrint) {
static inline bool IsNumber(unsigned int start, Accessor &styler) {
return isdigit(styler[start]) || (styler[start] == '.') ||
(styler[start] == '-') || (styler[start] == '#');
(styler[start] == '-') || (styler[start] == '#');
}
static inline bool isStringState(int state) {
bool bResult;
switch (state) {
case SCE_HJ_DOUBLESTRING:
case SCE_HJ_SINGLESTRING:
case SCE_HJA_DOUBLESTRING:
case SCE_HJA_SINGLESTRING:
case SCE_HB_STRING:
case SCE_HBA_STRING:
case SCE_HP_STRING:
case SCE_HPA_STRING:
case SCE_HPHP_HSTRING:
case SCE_HPHP_SIMPLESTRING:
bResult = true;
break;
default :
bResult = false;
break;
}
return bResult;
}
// not really well done, since it's only comments that should lex the %> and <%
static inline bool isCommentASPState(int state) {
bool bResult;
switch (state) {
case SCE_HJ_COMMENT:
case SCE_HJ_COMMENTLINE:
case SCE_HJ_COMMENTDOC:
case SCE_HB_COMMENTLINE:
case SCE_HP_COMMENTLINE:
case SCE_HPHP_COMMENT:
case SCE_HPHP_COMMENTLINE:
bResult = true;
break;
default :
bResult = false;
break;
}
return bResult;
}
static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
@@ -152,27 +199,28 @@ static int classifyTagHTML(unsigned int start, unsigned int end,
s[i++] = static_cast<char>(tolower(ch));
}
s[i] = '\0';
bool isScript = false;
char chAttr = SCE_H_TAGUNKNOWN;
if (s[0] == '!' && s[1] == '-' && s[2] == '-') { //Comment
chAttr = SCE_H_COMMENT;
} else if (strcmp(s, "![cdata[") == 0) { // In lower case because already converted
chAttr = SCE_H_CDATA;
} else if (s[0] == '!') {
chAttr = SCE_H_SGML;
} else if (s[0] == '/') { // Closing tag
if (keywords.InList(s + 1))
chAttr = SCE_H_TAG;
} else {
if (keywords.InList(s)) {
chAttr = SCE_H_TAG;
}
if (0 == strcmp(s, "script")) {
chAttr = SCE_H_SCRIPT;
isScript = 0 == strcmp(s, "script");
}
}
if ((chAttr == SCE_H_TAGUNKNOWN) && !keywords)
// No keywords -> all are known
chAttr = SCE_H_TAG;
styler.ColourTo(end, chAttr);
return chAttr;
return isScript ? SCE_H_SCRIPT : chAttr;
}
static void classifyWordHTJS(unsigned int start, unsigned int end,
@@ -295,6 +343,17 @@ static bool isLineEnd(char ch) {
return ch == '\r' || ch == '\n';
}
static bool isOKBeforeRE(char ch) {
return (ch == '(') || (ch == '=') || (ch == ',');
}
static bool isPHPStringState(int state) {
return
(state == SCE_HPHP_HSTRING) ||
(state == SCE_HPHP_SIMPLESTRING) ||
(state == SCE_HPHP_HSTRING_VARIABLE);
}
static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
@@ -313,8 +372,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
// If inside a tag, it may be a script tag, so reread from the start to ensure any language tags are seen
if (InTagState(state)) {
while ((startPos > 1) && (InTagState(styler.StyleAt(startPos - 1)))) {
while ((startPos > 0) && (InTagState(styler.StyleAt(startPos - 1)))) {
startPos--;
length++;
}
state = SCE_H_DEFAULT;
}
@@ -324,25 +384,36 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
int lineCurrent = styler.GetLine(startPos);
if (lineCurrent > 0)
lineState = styler.GetLineState(lineCurrent);
int inScriptType = (lineState >> 0) & 0x03; // 2 bits
int defaultScript = (lineState >> 4) & 0x0F; // 4 bits
int beforePreProc = (lineState >> 8) & 0xFF; // 8 bits
int inScriptType = (lineState >> 0) & 0x03; // 2 bits of scripting type
bool tagOpened = (lineState >> 2) & 0x01; // 1 bit to know if we are in an opened tag
bool tagClosing = (lineState >> 3) & 0x01; // 1 bit to know if we are in a closing tag
int defaultScript = (lineState >> 4) & 0x0F; // 4 bits of script name
int beforePreProc = (lineState >> 8) & 0xFF; // 8 bits of state
// int scriptLanguage = ScriptOfState(state,defaultScript);
int scriptLanguage = ScriptOfState(state);
bool fold = styler.GetPropertyInt("fold");
bool foldHTML = styler.GetPropertyInt("fold.html",0);
bool foldCompact = styler.GetPropertyInt("fold.compact",1);
fold = foldHTML && fold;
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
int visibleChars = 0;
int visibleChars;
visibleChars = 0;
char chPrev = ' ';
char ch = ' ';
char chPrevNonWhite = ' ';
styler.StartSegment(startPos);
int lengthDoc = startPos + length;
for (int i = startPos; i < lengthDoc; i++) {
char chPrev2 = chPrev;
chPrev = ch;
if (ch != ' ' && ch != '\t')
chPrevNonWhite = ch;
ch = styler[i];
char chNext = styler.SafeGetCharAt(i + 1);
char chNext2 = styler.SafeGetCharAt(i + 2);
@@ -354,40 +425,44 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
continue;
}
if (fold && !isspace(ch))
if ((!isspacechar(ch) || !foldCompact) && fold)
visibleChars++;
// decide what is the current state to print (depending of the script tag)
StateToPrint = statePrintForState(state, inScriptType);
// handle script folding
if (fold) {
switch (scriptLanguage) {
case eScriptJS:
case eScriptPHP:
//not currently supported case eScriptVBS:
if ((state != SCE_HPHP_COMMENT) && (state != SCE_HPHP_COMMENTLINE) && (state != SCE_HJ_COMMENT) && (state != SCE_HJ_COMMENTLINE) && (state != SCE_HJ_COMMENTDOC)) {
if ((ch == '{') || (ch == '}')) {
levelCurrent += (ch == '{') ? 1 : -1;
if ((ch == '{') || (ch == '}')) {
levelCurrent += (ch == '{') ? 1 : -1;
}
}
break;
case eScriptPython:
if (state != SCE_HP_COMMENTLINE) {
if ((ch == ':') && ((chNext == '\n') || (chNext == '\r' && chNext2 == '\n'))) {
levelCurrent++;
} else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) {
// check if the number of tabs is lower than the level
int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8;
for (int j = 0;Findlevel > 0;j++) {
char chTmp = styler.SafeGetCharAt(i + j + 1);
if (chTmp == '\t') {
Findlevel -= 8;
} else if (chTmp == ' ') {
Findlevel--;
} else break;
}
if ((ch == ':') && ((chNext == '\n') || (chNext == '\r' && chNext2 == '\n'))) {
levelCurrent++;
} else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) {
// check if the number of tabs is lower than the level
int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8;
for (int j = 0;Findlevel > 0;j++) {
char chTmp = styler.SafeGetCharAt(i + j + 1);
if (chTmp == '\t') {
Findlevel -= 8;
} else if (chTmp == ' ') {
Findlevel--;
} else break;
}
if (Findlevel > 0) {
levelCurrent -= Findlevel / 8;
if (Findlevel % 8) levelCurrent--;
if (Findlevel > 0) {
levelCurrent -= Findlevel / 8;
if (Findlevel % 8) levelCurrent--;
}
}
}
@@ -395,9 +470,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
}
// decide what is the current state to print (depending of the script tag)
StateToPrint = statePrintForState(state, inScriptType);
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
// 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
@@ -408,13 +480,16 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
styler.SetLevel(lineCurrent, lev);
visibleChars = 0;
levelPrev = levelCurrent;
}
lineCurrent++;
styler.SetLineState(lineCurrent,
((inScriptType & 0x03) << 0) |
((inScriptType & 0x03) << 0) |
((tagOpened & 0x01) << 2) |
((tagClosing & 0x01) << 3) |
((defaultScript & 0x0F) << 4) |
((beforePreProc & 0xFF) << 8));
}
@@ -428,7 +503,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
case SCE_H_SINGLESTRING:
case SCE_HJ_COMMENT:
case SCE_HJ_COMMENTDOC:
case SCE_HJ_COMMENTLINE:
// SCE_HJ_COMMENTLINE removed as this is a common thing done to hide
// the end of script marker from some JS interpreters.
//case SCE_HJ_COMMENTLINE:
case SCE_HJ_DOUBLESTRING:
case SCE_HJ_SINGLESTRING:
case SCE_HB_STRING:
@@ -438,19 +515,24 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
break;
default :
// maybe we should check here if it's a tag and if it's SCRIPT
styler.ColourTo(i - 1, StateToPrint);
state = SCE_H_TAGUNKNOWN;
inScriptType = eHtml;
scriptLanguage = eScriptNone;
i += 2;
// unfold closing script
levelCurrent--;
continue;
}
}
/////////////////////////////////////
// handle the start of PHP pre-processor = Non-HTML
else if ((ch == '<') && (chNext == '?')) {
else if ((state != SCE_H_ASPAT) &&
!isPHPStringState(state) &&
(state != SCE_HPHP_COMMENT) &&
(ch == '<') &&
(chNext == '?')) {
styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state;
scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP);
@@ -465,11 +547,17 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
inScriptType = eNonHtmlScriptPreProc;
else
inScriptType = eNonHtmlPreProc;
// fold whole script
levelCurrent++;
if (scriptLanguage == eScriptXML)
levelCurrent--; // no folding of the XML first tag (all XML-like tags in this case)
// should be better
ch = styler.SafeGetCharAt(i);
continue;
}
// handle the start of ASP pre-processor = Non-HTML
else if ((ch == '<') && (chNext == '%')) {
else if (!isCommentASPState(state) && (ch == '<') && (chNext == '%')) {
styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state;
if (inScriptType == eNonHtmlScript)
@@ -480,25 +568,40 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if (chNext2 == '@') {
i += 2; // place as if it was the second next char treated
state = SCE_H_ASPAT;
} else if ((chNext2 == '-') && (styler.SafeGetCharAt(i + 3) == '-')) {
styler.ColourTo(i + 3, SCE_H_ASP);
state = SCE_H_XCCOMMENT;
scriptLanguage = eScriptVBS;
continue;
} else {
if (chNext2 == '=') {
i += 2; // place as if it was the second next char treated
}
else {
} else {
i++; // place as if it was the next char treated
}
state = StateForScript(defaultScript);
}
scriptLanguage = eScriptVBS;
styler.ColourTo(i, SCE_H_ASP);
// fold whole script
levelCurrent++;
// should be better
ch = styler.SafeGetCharAt(i);
continue;
}
// handle the end of a pre-processor = Non-HTML
else if (((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) && ((ch == '?') || (ch == '%')) && (chNext == '>')) {
else if (
((inScriptType == eNonHtmlPreProc)
|| (inScriptType == eNonHtmlScriptPreProc)) && (
((scriptLanguage == eScriptPHP) && (ch == '?') && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT)) ||
((scriptLanguage != eScriptNone) && !isStringState(state) &&
(ch == '%'))
) && (chNext == '>')) {
if (state == SCE_H_ASPAT) {
defaultScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, defaultScript);
defaultScript = segIsScriptingIndicator(styler,
styler.GetStartSegment(), i - 1, defaultScript);
}
// Bounce out of any ASP mode
switch (state) {
@@ -514,6 +617,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
case SCE_HPHP_WORD:
classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler);
break;
case SCE_H_XCCOMMENT:
styler.ColourTo(i - 1, state);
break;
default :
styler.ColourTo(i - 1, StateToPrint);
break;
@@ -531,6 +637,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
else
inScriptType = eHtml;
scriptLanguage = eScriptNone;
// unfold all scripting languages
levelCurrent--;
continue;
}
/////////////////////////////////////
@@ -538,10 +646,21 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
switch (state) {
case SCE_H_DEFAULT:
if (ch == '<') {
// in HTML, fold on tag open and unfold on tag close
tagOpened = true;
if (chNext == '/') {
tagClosing = true;
} else {
tagClosing = false;
}
styler.ColourTo(i - 1, StateToPrint);
if (chNext == '!' && chNext2 == '-' && styler.SafeGetCharAt(i + 3) == '-')
if (chNext == '!' && chNext2 == '-' && styler.SafeGetCharAt(i + 3) == '-') {
// should be better
i += 3;
levelCurrent++;
state = SCE_H_COMMENT;
else
} else
state = SCE_H_TAGUNKNOWN;
} else if (ch == '&') {
styler.ColourTo(i - 1, SCE_H_DEFAULT);
@@ -550,14 +669,26 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
break;
case SCE_H_COMMENT:
if ((ch == '>') && (chPrev == '-') && (chPrev2 == '-')) {
// unfold HTML comment
levelCurrent--;
styler.ColourTo(i, StateToPrint);
state = SCE_H_DEFAULT;
tagOpened = false;
}
break;
case SCE_H_CDATA:
if ((ch == '>') && (chPrev == ']') && (chPrev2 == ']')) {
styler.ColourTo(i, StateToPrint);
state = SCE_H_DEFAULT;
tagOpened = false;
}
break;
case SCE_H_SGML:
if (ch == '>') {
levelCurrent--;
styler.ColourTo(i, StateToPrint);
state = SCE_H_DEFAULT;
tagOpened = false;
}
break;
case SCE_H_ENTITY:
@@ -571,7 +702,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
break;
case SCE_H_TAGUNKNOWN:
if (!ishtmlwordchar(ch) && ch != '/' && ch != '-' && ch != '[') {
if (!ishtmlwordchar(ch) && !((ch == '/') && (chPrev == '<')) && ch != '[') {
int eClass = classifyTagHTML(styler.GetStartSegment(), i - 1, keywords, styler);
if (eClass == SCE_H_SCRIPT) {
inScriptType = eNonHtmlScript;
@@ -579,17 +710,38 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
eClass = SCE_H_TAG;
}
if (ch == '>') {
styler.ColourTo(i, SCE_H_TAG);
styler.ColourTo(i, eClass);
if (inScriptType == eNonHtmlScript) {
state = StateForScript(scriptLanguage);
} else {
state = SCE_H_DEFAULT;
}
} else {
if (eClass == SCE_H_CDATA) {
state = SCE_H_CDATA;
tagOpened = false;
if (tagClosing)
levelCurrent--;
else
levelCurrent++;
tagClosing = false;
} else if (ch == '/' && chNext == '>') {
if (eClass == SCE_H_TAGUNKNOWN) {
styler.ColourTo(i + 1, SCE_H_TAGUNKNOWN);
} else {
state = SCE_H_OTHER;
styler.ColourTo(i - 1, StateToPrint);
styler.ColourTo(i + 1, SCE_H_TAGEND);
}
i++;
ch = chNext;
state = SCE_H_DEFAULT;
tagOpened = false;
} else {
if (eClass != SCE_H_TAGUNKNOWN) {
if (eClass == SCE_H_CDATA) {
state = SCE_H_CDATA;
} else if (eClass == SCE_H_SGML) {
state = SCE_H_SGML;
} else {
state = SCE_H_OTHER;
}
}
}
}
@@ -597,7 +749,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
case SCE_H_ATTRIBUTE:
if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') {
if (inScriptType == eNonHtmlScript) {
int scriptLanguagePrev = scriptLanguage;
scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, scriptLanguage);
if ((scriptLanguagePrev != scriptLanguage) && (scriptLanguage == eScriptNone))
inScriptType = eHtml;
}
classifyAttribHTML(styler.GetStartSegment(), i - 1, keywords, styler);
if (ch == '>') {
@@ -607,6 +762,12 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
} else {
state = SCE_H_DEFAULT;
}
tagOpened = false;
if (tagClosing)
levelCurrent--;
else
levelCurrent++;
tagClosing = false;
} else if (ch == '=') {
styler.ColourTo(i, SCE_H_OTHER);
state = SCE_H_VALUE;
@@ -624,6 +785,12 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
} else {
state = SCE_H_DEFAULT;
}
tagOpened = false;
if (tagClosing)
levelCurrent--;
else
levelCurrent++;
tagClosing = false;
} else if (ch == '\"') {
styler.ColourTo(i - 1, StateToPrint);
state = SCE_H_DOUBLESTRING;
@@ -639,6 +806,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
i++;
ch = chNext;
state = SCE_H_DEFAULT;
tagOpened = false;
} else if (ch == '?' && chNext == '>') {
styler.ColourTo(i - 1, StateToPrint);
styler.ColourTo(i + 1, SCE_H_XMLEND);
@@ -688,6 +856,12 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
} else {
state = SCE_H_DEFAULT;
}
tagOpened = false;
if (tagClosing)
levelCurrent--;
else
levelCurrent++;
tagClosing = false;
} else {
state = SCE_H_OTHER;
}
@@ -709,6 +883,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
} else if (ch == '/' && chNext == '/') {
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HJ_COMMENTLINE;
} else if (ch == '/' && isOKBeforeRE(chPrevNonWhite)) {
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HJ_REGEX;
} else if (ch == '\"') {
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HJ_DOUBLESTRING;
@@ -781,8 +958,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
} else if (ch == '\"') {
styler.ColourTo(i, statePrintForState(SCE_HJ_DOUBLESTRING, inScriptType));
state = SCE_HJ_DEFAULT;
i++;
ch = chNext;
} else if ((inScriptType == eNonHtmlScript) && (ch == '-') && (chNext == '-') && (chNext2 == '>')) {
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HJ_COMMENTLINE;
@@ -800,8 +975,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
} else if (ch == '\'') {
styler.ColourTo(i, statePrintForState(SCE_HJ_SINGLESTRING, inScriptType));
state = SCE_HJ_DEFAULT;
i++;
ch = chNext;
} else if ((inScriptType == eNonHtmlScript) && (ch == '-') && (chNext == '-') && (chNext2 == '>')) {
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HJ_COMMENTLINE;
@@ -820,6 +993,19 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HJ_DEFAULT;
}
break;
case SCE_HJ_REGEX:
if (ch == '\r' || ch == '\n' || ch == '/') {
styler.ColourTo(i, StateToPrint);
state = SCE_HJ_DEFAULT;
} else if (ch == '\\') {
// Gobble up the quoted character
if (chNext == '\\' || chNext == '/') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
}
break;
case SCE_HB_DEFAULT:
case SCE_HB_START:
if (iswordstart(ch)) {
@@ -837,7 +1023,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HB_COMMENTLINE;
} else if (isoperator(ch)) {
styler.ColourTo(i - 1, StateToPrint);
styler.ColourTo(i, SCE_HB_DEFAULT);
styler.ColourTo(i, statePrintForState(SCE_HB_DEFAULT, inScriptType));
state = SCE_HB_DEFAULT;
} else if ((ch == ' ') || (ch == '\t')) {
if (state == SCE_HB_START) {
@@ -865,8 +1051,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if (ch == '\"') {
styler.ColourTo(i, StateToPrint);
state = SCE_HB_DEFAULT;
i++;
ch = chNext;
} else if (ch == '\r' || ch == '\n') {
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HB_STRINGEOL;
@@ -1023,6 +1207,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HPHP_SIMPLESTRING;
} else if (ch == '$') {
state = SCE_HPHP_VARIABLE;
} else if (isoperator(ch)) {
state = SCE_HPHP_OPERATOR;
} else {
state = SCE_HPHP_DEFAULT;
}
@@ -1031,13 +1217,19 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
case SCE_HPHP_NUMBER:
if (!isdigit(ch)) {
styler.ColourTo(i - 1, SCE_HPHP_NUMBER);
state = SCE_HPHP_DEFAULT;
if (isoperator(ch))
state =SCE_HPHP_OPERATOR;
else
state = SCE_HPHP_DEFAULT;
}
break;
case SCE_HPHP_VARIABLE:
if (!iswordstart(ch)) {
styler.ColourTo(i - 1, SCE_HPHP_VARIABLE);
state = SCE_HPHP_DEFAULT;
if (isoperator(ch))
state =SCE_HPHP_OPERATOR;
else
state = SCE_HPHP_DEFAULT;
}
break;
case SCE_HPHP_COMMENT:
@@ -1054,20 +1246,34 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
break;
case SCE_HPHP_HSTRING:
if (ch == '\\') {
// skip the next char
i++;
// skip the next char
i++;
} else if (ch == '$') {
styler.ColourTo(i-1, StateToPrint);
state = SCE_HPHP_HSTRING_VARIABLE;
} else if (ch == '\"') {
styler.ColourTo(i, StateToPrint);
state = SCE_HPHP_DEFAULT;
}
break;
case SCE_HPHP_SIMPLESTRING:
if (ch == '\'') {
if (ch == '\\') {
// skip the next char
i++;
} else if (ch == '\'') {
styler.ColourTo(i, StateToPrint);
state = SCE_HPHP_DEFAULT;
}
break;
case SCE_HPHP_DEFAULT:
case SCE_HPHP_HSTRING_VARIABLE:
if (!iswordstart(ch)) {
styler.ColourTo(i-1, StateToPrint);
i--; // strange but it works
state = SCE_HPHP_HSTRING;
}
break;
case SCE_HPHP_OPERATOR:
case SCE_HPHP_DEFAULT:
styler.ColourTo(i - 1, StateToPrint);
if (isdigit(ch)) {
state = SCE_HPHP_NUMBER;
@@ -1087,15 +1293,20 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HPHP_SIMPLESTRING;
} else if (ch == '$') {
state = SCE_HPHP_VARIABLE;
} else if (isoperator(ch)) {
state = SCE_HPHP_OPERATOR;
} else if ((state == SCE_HPHP_OPERATOR) && (isspacechar(ch))) {
state = SCE_HPHP_DEFAULT;
}
break;
///////////// end - PHP state handling
}
// Some of the above terminated their lexeme but since the same character starts
// the same class again, only reenter if non empty segment.
bool nonEmptySegment = i >= static_cast<int>(styler.GetStartSegment());
if (state == SCE_HB_DEFAULT) { // One of the above succeeded
if (ch == '\"') {
if ((ch == '\"') && (nonEmptySegment)) {
state = SCE_HB_STRING;
} else if (ch == '\'') {
state = SCE_HB_COMMENTLINE;
@@ -1105,7 +1316,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.ColourTo(i, SCE_HB_DEFAULT);
}
} else if (state == SCE_HBA_DEFAULT) { // One of the above succeeded
if (ch == '\"') {
if ((ch == '\"') && (nonEmptySegment)) {
state = SCE_HBA_STRING;
} else if (ch == '\'') {
state = SCE_HBA_COMMENTLINE;
@@ -1122,14 +1333,14 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HJ_COMMENT;
} else if (ch == '/' && chNext == '/') {
state = SCE_HJ_COMMENTLINE;
} else if (ch == '\"') {
} else if ((ch == '\"') && (nonEmptySegment)) {
state = SCE_HJ_DOUBLESTRING;
} else if (ch == '\'') {
} else if ((ch == '\'') && (nonEmptySegment)) {
state = SCE_HJ_SINGLESTRING;
} else if (iswordstart(ch)) {
state = SCE_HJ_WORD;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_HJ_SYMBOLS);
styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType));
}
}
}
@@ -1140,12 +1351,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
if (fold) {
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
//styler.SetLevel(lineCurrent, levelCurrent | flagsNext);
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
}
LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc);
LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc);
LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext");
LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml");

View File

@@ -0,0 +1,195 @@
// Scintilla source code edit control
/** @file LexLisp.cxx
** Lexer for Lisp.
** Written by Alexey Yutkin.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
inline bool isLispoperator(char ch) {
if (isascii(ch) && isalnum(ch))
return false;
if (ch == '\'' || ch == '(' || ch == ')' )
return true;
return false;
}
inline bool isLispwordstart(char ch) {
return isascii(ch) && ch != ';' && !isspacechar(ch) && !isLispoperator(ch) &&
ch != '\n' && ch != '\r' && ch != '\"';
}
static void classifyWordLisp(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
PLATFORM_ASSERT(end >= start);
char s[100];
unsigned int i;
bool digit_flag = true;
for (i = 0; (i < end - start + 1) && (i < 99); i++) {
s[i] = styler[start + i];
s[i + 1] = '\0';
if (!isdigit(s[i]) && (s[i] != '.')) digit_flag = false;
}
char chAttr = SCE_LISP_IDENTIFIER;
if(digit_flag) chAttr = SCE_LISP_NUMBER;
else {
if (keywords.InList(s)) {
chAttr = SCE_LISP_KEYWORD;
}
}
styler.ColourTo(end, chAttr);
return;
}
static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
int state = initStyle;
if (state == SCE_LISP_STRINGEOL) // Does not leak onto next line
state = SCE_LISP_DEFAULT;
char chPrev = ' ';
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
styler.StartSegment(startPos);
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (atEOL) {
// 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_LISP_STRINGEOL) {
styler.ColourTo(i, state);
state = SCE_LISP_DEFAULT;
}
}
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
i += 1;
continue;
}
if (state == SCE_LISP_DEFAULT) {
if (isLispwordstart(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_LISP_IDENTIFIER;
}
else if (ch == ';') {
styler.ColourTo(i - 1, state);
state = SCE_LISP_COMMENT;
}
else if (isLispoperator(ch) || ch=='\'') {
styler.ColourTo(i - 1, state);
styler.ColourTo(i, SCE_LISP_OPERATOR);
}
else if (ch == '\"') {
state = SCE_LISP_STRING;
}
} else if (state == SCE_LISP_IDENTIFIER) {
if (!isLispwordstart(ch)) {
classifyWordLisp(styler.GetStartSegment(), i - 1, keywords, styler);
state = SCE_LISP_DEFAULT;
} /*else*/
if (isLispoperator(ch) || ch=='\'') {
styler.ColourTo(i - 1, state);
styler.ColourTo(i, SCE_LISP_OPERATOR);
}
} else {
if (state == SCE_LISP_COMMENT) {
if (atEOL) {
styler.ColourTo(i - 1, state);
state = SCE_LISP_DEFAULT;
}
} else if (state == SCE_LISP_STRING) {
if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\"') {
styler.ColourTo(i, state);
state = SCE_LISP_DEFAULT;
} else if ((chNext == '\r' || chNext == '\n') && (chPrev != '\\')) {
styler.ColourTo(i - 1, SCE_LISP_STRINGEOL);
state = SCE_LISP_STRINGEOL;
}
}
}
chPrev = ch;
}
styler.ColourTo(lengthDoc - 1, state);
}
static void FoldLispDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
Accessor &styler) {
unsigned int lengthDoc = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_LISP_OPERATOR) {
if (ch == '(') {
levelCurrent++;
} else if (ch == ')') {
levelCurrent--;
}
}
if (atEOL) {
int lev = levelPrev;
if (visibleChars == 0)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelPrev = levelCurrent;
visibleChars = 0;
}
if (!isspacechar(ch))
visibleChars++;
}
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
LexerModule lmLISP(SCLEX_LISP, ColouriseLispDoc, "lisp", FoldLispDoc);

View File

@@ -1,5 +1,10 @@
// LexLua.cxx - lexer for Lua language
// Written by Paul Winwood
// Scintilla source code edit control
/** @file LexLua.cxx
** Lexer for Lua language.
**
** Written by Paul Winwood.
** Folder by Alexey Yutkin.
**/
#include <stdlib.h>
#include <string.h>
@@ -16,283 +21,261 @@
#include "Scintilla.h"
#include "SciLexer.h"
static void classifyWordLua(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler)
{
char s[100];
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++)
{
s[i] = styler[start + i];
s[i + 1] = '\0';
}
char chAttr = SCE_LUA_IDENTIFIER;
if (wordIsNumber)
chAttr = SCE_LUA_NUMBER;
else
{
if (keywords.InList(s))
{
chAttr = SCE_LUA_WORD;
}
}
styler.ColourTo(end, chAttr);
inline bool isLuaOperator(char ch) {
if (isalnum(ch))
return false;
// '.' left out as it is used to make up numbers
if (ch == '*' || ch == '/' || ch == '-' || ch == '+' ||
ch == '(' || ch == ')' || ch == '=' ||
ch == '{' || ch == '}' || ch == '~' ||
ch == '[' || ch == ']' || ch == ';' ||
ch == '<' || ch == '>' || ch == ',' ||
ch == '.' || ch == '^' || ch == '%' || ch == ':')
return true;
return false;
}
static void ColouriseLuaDoc(unsigned int startPos,
int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler)
{
static void classifyWordLua(unsigned int start,
unsigned int end,
WordList &keywords,
Accessor &styler) {
char s[100];
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
WordList &keywords = *keywordlists[0];
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = styler[start + i];
s[i + 1] = '\0';
}
styler.StartAt(startPos);
styler.GetLine(startPos);
char chAttr = SCE_LUA_IDENTIFIER;
int state = initStyle;
char chPrev = ' ';
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
bool firstChar = true;
int literalString = 0;
styler.StartSegment(startPos);
for (unsigned int i = startPos; i <= lengthDoc; i++)
{
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if (styler.IsLeadByte(ch))
{
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
i += 1;
continue;
}
if (state == SCE_LUA_STRINGEOL)
{
if (ch != '\r' && ch != '\n')
{
styler.ColourTo(i-1, state);
state = SCE_LUA_DEFAULT;
}
}
if (state == SCE_LUA_LITERALSTRING && ch == '[' && chNext == '[')
{
literalString++;
}
else
if (state == SCE_LUA_DEFAULT)
{
if (ch == '-' && chNext == '-')
{
styler.ColourTo(i-1, state);
state = SCE_LUA_COMMENTLINE;
}
else
if (ch == '[' && chNext == '[')
{
state = SCE_LUA_LITERALSTRING;
literalString = 1;
}
else
if (iswordstart(ch))
{
styler.ColourTo(i-1, state);
state = SCE_LUA_WORD;
}
else
if (ch == '\"')
{
styler.ColourTo(i-1, state);
state = SCE_LUA_STRING;
}
else
if (ch == '\'')
{
styler.ColourTo(i-1, state);
state = SCE_LUA_CHARACTER;
}
else
if (ch == '$' && firstChar)
{
styler.ColourTo(i-1, state);
state = SCE_LUA_PREPROCESSOR;
}
else
if (isoperator(ch))
{
styler.ColourTo(i-1, state);
styler.ColourTo(i, SCE_LUA_OPERATOR);
}
}
else
if (state == SCE_LUA_WORD)
{
if (!iswordchar(ch))
{
classifyWordLua(styler.GetStartSegment(), i - 1, keywords, styler);
state = SCE_LUA_DEFAULT;
if (ch == '[' && chNext == '[')
{
literalString = 1;
state = SCE_LUA_LITERALSTRING;
}
else
if (ch == '-' && chNext == '-')
{
state = SCE_LUA_COMMENTLINE;
}
else
if (ch == '\"')
{
state = SCE_LUA_STRING;
}
else
if (ch == '\'')
{
state = SCE_LUA_CHARACTER;
}
else
if (ch == '$' && firstChar)
{
state = SCE_LUA_PREPROCESSOR;
}
else
if (isoperator(ch))
{
styler.ColourTo(i, SCE_LUA_OPERATOR);
}
}
}
else
{
if (state == SCE_LUA_LITERALSTRING)
{
if (ch == ']' && (chPrev == ']') && (--literalString == 0))
{
styler.ColourTo(i, state);
state = SCE_LUA_DEFAULT;
}
}
else
if (state == SCE_LUA_PREPROCESSOR)
{
if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
{
styler.ColourTo(i-1, state);
state = SCE_LUA_DEFAULT;
}
}
else
if (state == SCE_LUA_COMMENTLINE)
{
if (ch == '\r' || ch == '\n')
{
styler.ColourTo(i-1, state);
state = SCE_LUA_DEFAULT;
}
}
else
if (state == SCE_LUA_STRING)
{
if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
{
styler.ColourTo(i-1, state);
state = SCE_LUA_STRINGEOL;
}
else
if (ch == '\\')
{
if (chNext == '\"' || chNext == '\\')
{
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
}
else
if (ch == '\"')
{
styler.ColourTo(i, state);
state = SCE_LUA_DEFAULT;
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
}
else
if (state == SCE_LUA_CHARACTER)
{
if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
{
styler.ColourTo(i-1, state);
state = SCE_LUA_STRINGEOL;
}
else
if (ch == '\\')
{
if (chNext == '\'' || chNext == '\\')
{
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
}
else
if (ch == '\'')
{
styler.ColourTo(i, state);
state = SCE_LUA_DEFAULT;
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
}
if (state == SCE_LUA_DEFAULT)
{
if (ch == '-' && chNext == '-')
{
state = SCE_LUA_COMMENTLINE;
}
else
if (ch == '\"')
{
state = SCE_LUA_STRING;
}
else
if (ch == '\'')
{
state = SCE_LUA_CHARACTER;
}
else
if (ch == '$' && firstChar)
{
state = SCE_LUA_PREPROCESSOR;
}
else
if (iswordstart(ch))
{
state = SCE_LUA_WORD;
}
else
if (isoperator(ch))
{
styler.ColourTo(i, SCE_LUA_OPERATOR);
}
}
}
chPrev = ch;
firstChar = (ch == '\r' || ch == '\n');
}
styler.ColourTo(lengthDoc - 1, state);
if (wordIsNumber)
chAttr = SCE_LUA_NUMBER;
else {
if (keywords.InList(s)) {
chAttr = SCE_LUA_WORD;
}
}
styler.ColourTo(end, chAttr);
}
LexerModule lmLua(SCLEX_LUA, ColouriseLuaDoc);
static void ColouriseLuaDoc(unsigned int startPos,
int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
styler.GetLine(startPos);
int state = initStyle;
char chPrev = ' ';
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
bool firstChar = true;
/* Must initialize the literalString level, if we are inside such a string.
* Note: this isn't enough, because literal strings can be nested,
* we should go back to see at what level we are...
*/
int literalString = (initStyle == SCE_LUA_LITERALSTRING) ? 1 : 0;
styler.StartSegment(startPos);
for (unsigned int i = startPos; i <= lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
i += 1;
continue;
}
if (state == SCE_LUA_STRINGEOL) {
if (ch != '\r' && ch != '\n') {
styler.ColourTo(i - 1, state);
state = SCE_LUA_DEFAULT;
}
}
if (state == SCE_LUA_LITERALSTRING && ch == '[' && chNext == '[') {
literalString++;
} else if (state == SCE_LUA_DEFAULT) {
if (ch == '-' && chNext == '-') {
styler.ColourTo(i - 1, state);
state = SCE_LUA_COMMENTLINE;
} else if (ch == '[' && chNext == '[') {
state = SCE_LUA_LITERALSTRING;
literalString = 1;
} else if (ch == '\"') {
styler.ColourTo(i - 1, state);
state = SCE_LUA_STRING;
} else if (ch == '\'') {
styler.ColourTo(i - 1, state);
state = SCE_LUA_CHARACTER;
} else if (ch == '$' && firstChar) {
styler.ColourTo(i - 1, state);
state = SCE_LUA_PREPROCESSOR;
} else if (ch == '#' && firstChar) // Should be only on the first line of the file! Cannot be tested here
{
styler.ColourTo(i - 1, state);
state = SCE_LUA_COMMENTLINE;
} else if (isLuaOperator(ch)) {
styler.ColourTo(i - 1, state);
styler.ColourTo(i, SCE_LUA_OPERATOR);
} else if (iswordstart(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_LUA_WORD;
}
} else if (state == SCE_LUA_WORD) {
if (!iswordchar(ch)) {
classifyWordLua(styler.GetStartSegment(), i - 1, keywords, styler);
state = SCE_LUA_DEFAULT;
if (ch == '[' && chNext == '[') {
literalString = 1;
state = SCE_LUA_LITERALSTRING;
} else if (ch == '-' && chNext == '-') {
state = SCE_LUA_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_LUA_STRING;
} else if (ch == '\'') {
state = SCE_LUA_CHARACTER;
} else if (ch == '$' && firstChar) {
state = SCE_LUA_PREPROCESSOR;
} else if (isLuaOperator(ch)) {
styler.ColourTo(i, SCE_LUA_OPERATOR);
}
} else if (ch == '.' && chNext == '.') {
classifyWordLua(styler.GetStartSegment(), i - 1, keywords, styler);
styler.ColourTo(i, SCE_LUA_OPERATOR);
state = SCE_LUA_DEFAULT;
}
} else {
if (state == SCE_LUA_LITERALSTRING) {
if (ch == ']' && (chPrev == ']') && (--literalString == 0)) {
styler.ColourTo(i, state);
state = SCE_LUA_DEFAULT;
}
} else if (state == SCE_LUA_PREPROCESSOR) {
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
styler.ColourTo(i - 1, state);
state = SCE_LUA_DEFAULT;
}
} else if (state == SCE_LUA_COMMENTLINE) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i - 1, state);
state = SCE_LUA_DEFAULT;
}
} else if (state == SCE_LUA_STRING) {
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
styler.ColourTo(i - 1, state);
state = SCE_LUA_STRINGEOL;
} else if (ch == '\\') {
if (chNext == '\"' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\"') {
styler.ColourTo(i, state);
state = SCE_LUA_DEFAULT;
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (state == SCE_LUA_CHARACTER) {
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
styler.ColourTo(i - 1, state);
state = SCE_LUA_STRINGEOL;
} else if (ch == '\\') {
if (chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\'') {
styler.ColourTo(i, state);
state = SCE_LUA_DEFAULT;
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
}
if (state == SCE_LUA_DEFAULT) {
if (ch == '-' && chNext == '-') {
state = SCE_LUA_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_LUA_STRING;
} else if (ch == '\'') {
state = SCE_LUA_CHARACTER;
} else if (ch == '$' && firstChar) {
state = SCE_LUA_PREPROCESSOR;
} else if (iswordstart(ch)) {
state = SCE_LUA_WORD;
} else if (isLuaOperator(ch)) {
styler.ColourTo(i, SCE_LUA_OPERATOR);
}
}
}
chPrev = ch;
firstChar = (ch == '\r' || ch == '\n');
}
styler.ColourTo(lengthDoc - 1, state);
}
static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
Accessor &styler) {
unsigned int lengthDoc = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
char s[10];
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_LUA_WORD)
if ( ch == 'e' || ch == 't' || ch == 'd' || ch == 'f') {
for (unsigned int j = 0; j < 8; j++) {
if (!iswordchar(styler[i + j])) break;
s[j] = styler[i + j];
s[j + 1] = '\0';
}
if ((strcmp(s, "then") == 0) || (strcmp(s, "do") == 0)
|| (strcmp(s, "function") == 0))
levelCurrent++;
if (strcmp(s, "end") == 0) levelCurrent--;
}
if (atEOL) {
int lev = levelPrev;
if (visibleChars == 0)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelPrev = levelCurrent;
visibleChars = 0;
}
if (!isspacechar(ch))
visibleChars++;
}
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
LexerModule lmLua(SCLEX_LUA, ColouriseLuaDoc, "lua", FoldLuaDoc);

View File

@@ -1,13 +1,16 @@
// SciTE - Scintilla based Text Editor
// LexOthers.cxx - lexers for properties files, batch files, make files and error lists
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// Scintilla source code edit control
/** @file LexOthers.cxx
** Lexers for batch files, diff results, properties files, make files and error lists.
** Also lexer for LaTeX documents.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
@@ -17,36 +20,135 @@
#include "Scintilla.h"
#include "SciLexer.h"
static void ColouriseBatchLine(char *lineBuffer, int endLine, Accessor &styler) {
if (0 == strncmp(lineBuffer, "REM", 3)) {
styler.ColourTo(endLine, 1);
} else if (0 == strncmp(lineBuffer, "rem", 3)) {
styler.ColourTo(endLine, 1);
} else if (0 == strncmp(lineBuffer, "SET", 3)) {
styler.ColourTo(endLine, 2);
} else if (0 == strncmp(lineBuffer, "set", 3)) {
styler.ColourTo(endLine, 2);
} else if (lineBuffer[0] == ':') {
styler.ColourTo(endLine, 3);
} else {
styler.ColourTo(endLine, 0);
}
}
static void ColouriseBatchLine(
char *lineBuffer,
unsigned int lengthLine,
unsigned int startLine,
unsigned int endPos,
WordList &keywords,
Accessor &styler) {
static void ColouriseBatchDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
char lineBuffer[1024];
styler.StartAt(startPos);
styler.StartSegment(startPos);
unsigned int linePos = 0;
for (unsigned int i = startPos; i < startPos + length; i++) {
lineBuffer[linePos++] = styler[i];
if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) {
ColouriseBatchLine(lineBuffer, i, styler);
linePos = 0;
unsigned int i = 0;
unsigned int state = SCE_BAT_DEFAULT;
while (isspacechar(lineBuffer[i]) && (i < lengthLine)) { // Skip initial spaces
i++;
}
if (lineBuffer[i] == '@') { // Hide command (ECHO OFF)
styler.ColourTo(startLine + i, SCE_BAT_HIDE);
i++;
while (isspacechar(lineBuffer[i]) && (i < lengthLine)) { // Skip next spaces
i++;
}
}
if (linePos > 0)
ColouriseBatchLine(lineBuffer, startPos + length, styler);
if (lineBuffer[i] == ':') {
// Label
if (lineBuffer[i + 1] == ':') {
// :: is a fake label, similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm
styler.ColourTo(endPos, SCE_BAT_COMMENT);
} else { // Real label
styler.ColourTo(endPos, SCE_BAT_LABEL);
}
} else {
// Check if initial word is a keyword
char wordBuffer[21];
unsigned int wbl = 0, offset = i;
// Copy word in buffer
for (; offset < lengthLine && wbl < 20 &&
!isspacechar(lineBuffer[offset]); wbl++, offset++) {
wordBuffer[wbl] = static_cast<char>(tolower(lineBuffer[offset]));
}
wordBuffer[wbl] = '\0';
// Check if it is a comment
if (CompareCaseInsensitive(wordBuffer, "rem") == 0) {
styler.ColourTo(endPos, SCE_BAT_COMMENT);
return ;
}
// Check if it is in the list
if (keywords.InList(wordBuffer)) {
styler.ColourTo(startLine + offset - 1, SCE_BAT_WORD); // Regular keyword
} else {
// Search end of word (can be a long path)
while (offset < lengthLine &&
!isspacechar(lineBuffer[offset])) {
offset++;
}
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); // External command / program
}
// Remainder of the line: colourise the variables.
while (offset < lengthLine) {
if (state == SCE_BAT_DEFAULT && lineBuffer[offset] == '%') {
styler.ColourTo(startLine + offset - 1, state);
if (isdigit(lineBuffer[offset + 1])) {
styler.ColourTo(startLine + offset + 1, SCE_BAT_IDENTIFIER);
offset += 2;
} else if (lineBuffer[offset + 1] == '%' &&
!isspacechar(lineBuffer[offset + 2])) {
// Should be safe, as there is CRLF at the end of the line...
styler.ColourTo(startLine + offset + 2, SCE_BAT_IDENTIFIER);
offset += 3;
} else {
state = SCE_BAT_IDENTIFIER;
}
} else if (state == SCE_BAT_IDENTIFIER && lineBuffer[offset] == '%') {
styler.ColourTo(startLine + offset, state);
state = SCE_BAT_DEFAULT;
} else if (state == SCE_BAT_DEFAULT &&
(lineBuffer[offset] == '*' ||
lineBuffer[offset] == '?' ||
lineBuffer[offset] == '=' ||
lineBuffer[offset] == '<' ||
lineBuffer[offset] == '>' ||
lineBuffer[offset] == '|')) {
styler.ColourTo(startLine + offset - 1, state);
styler.ColourTo(startLine + offset, SCE_BAT_OPERATOR);
}
offset++;
}
// if (endPos > startLine + offset - 1) {
styler.ColourTo(endPos, SCE_BAT_DEFAULT); // Remainder of line, currently not lexed
// }
}
}
// ToDo: (not necessarily at beginning of line) GOTO, [IF] NOT, ERRORLEVEL
// IF [NO] (test) (command) -- test is EXIST (filename) | (string1)==(string2) | ERRORLEVEL (number)
// FOR %%(variable) IN (set) DO (command) -- variable is [a-zA-Z] -- eg for %%X in (*.txt) do type %%X
// ToDo: %n (parameters), %EnvironmentVariable% colourising
// ToDo: Colourise = > >> < | "
static void ColouriseBatchDoc(
unsigned int startPos,
int length,
int /*initStyle*/,
WordList *keywordlists[],
Accessor &styler) {
char lineBuffer[1024];
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
styler.StartSegment(startPos);
unsigned int linePos = 0, startLine = startPos;
for (unsigned int i = startPos; i <= startPos + length; i++) {
lineBuffer[linePos++] = styler[i];
if (styler[i] == '\r' || styler[i] == '\n' || (linePos >=
sizeof(lineBuffer) - 1)) {
// End of line (or of line buffer) met, colourise it
if (styler[i + 1] == '\n') {
lineBuffer[linePos++] = styler[++i];
}
lineBuffer[linePos] = '\0';
ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywords, styler);
linePos = 0;
startLine = i + 1;
}
}
if (linePos > 0) {
ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length,
keywords, styler);
}
}
static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) {
@@ -89,25 +191,32 @@ static void ColouriseDiffDoc(unsigned int startPos, int length, int, WordList *[
ColouriseDiffLine(lineBuffer, startPos + length, styler);
}
static void ColourisePropsLine(char *lineBuffer, int lengthLine, int startLine, int endPos, Accessor &styler) {
int i = 0;
while (isspace(lineBuffer[i]) && (i < lengthLine)) // Skip initial spaces
static void ColourisePropsLine(
char *lineBuffer,
unsigned int lengthLine,
unsigned int startLine,
unsigned int endPos,
Accessor &styler) {
unsigned int i = 0;
while (isspacechar(lineBuffer[i]) && (i < lengthLine)) // Skip initial spaces
i++;
if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {
styler.ColourTo(endPos, 1);
} else if (lineBuffer[i] == '[') {
styler.ColourTo(endPos, 2);
} else if (lineBuffer[i] == '@') {
styler.ColourTo(startLine+i, 4);
styler.ColourTo(startLine + i, 4);
if (lineBuffer[++i] == '=')
styler.ColourTo(startLine+i, 3);
styler.ColourTo(startLine + i, 3);
styler.ColourTo(endPos, 0);
} else {
while (lineBuffer[i] != '=' && (i < lengthLine)) // Search the '=' character
// Search for the '=' character
while (lineBuffer[i] != '=' && (i < lengthLine - 1))
i++;
if (lineBuffer[i] == '=') {
styler.ColourTo(startLine+i-1, 0);
styler.ColourTo(startLine+i, 3);
styler.ColourTo(startLine + i - 1, 0);
styler.ColourTo(startLine + i, 3);
styler.ColourTo(endPos, 0);
} else {
styler.ColourTo(endPos, 0);
@@ -119,31 +228,77 @@ static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *
char lineBuffer[1024];
styler.StartAt(startPos);
styler.StartSegment(startPos);
unsigned int linePos = 0;
int startLine = startPos;
unsigned int linePos = 0, startLine = startPos;
for (unsigned int i = startPos; i <= startPos + length; i++) {
lineBuffer[linePos++] = styler[i];
if ((styler[i] == '\r' && styler.SafeGetCharAt(i+1) != '\n') ||
styler[i] == '\n' ||
(linePos >= sizeof(lineBuffer) - 1)) {
if ((styler[i] == '\r' && styler.SafeGetCharAt(i + 1) != '\n') ||
styler[i] == '\n' ||
(linePos >= sizeof(lineBuffer) - 1)) {
lineBuffer[linePos] = '\0';
ColourisePropsLine(lineBuffer, linePos, startLine, i, styler);
linePos = 0;
startLine = i+1;
startLine = i + 1;
}
}
if (linePos > 0)
ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length, styler);
}
static void ColouriseMakeLine(char *lineBuffer, int lengthLine, int endPos, Accessor &styler) {
int i = 0;
while (isspace(lineBuffer[i]) && (i < lengthLine))
static void ColouriseMakeLine(
char *lineBuffer,
unsigned int lengthLine,
unsigned int startLine,
unsigned int endPos,
Accessor &styler) {
unsigned int i = 0;
unsigned int lastNonSpace = 0;
unsigned int state = SCE_MAKE_DEFAULT;
bool bSpecial = false;
// Skip initial spaces
while (isspacechar(lineBuffer[i]) && (i < lengthLine)) {
i++;
if (lineBuffer[i] == '#' || lineBuffer[i] == '!') {
styler.ColourTo(endPos, 1);
}
if (lineBuffer[i] == '#') { // Comment
styler.ColourTo(endPos, SCE_MAKE_COMMENT);
return;
}
if (lineBuffer[i] == '!') { // Special directive
styler.ColourTo(endPos, SCE_MAKE_PREPROCESSOR);
return;
}
while (i < lengthLine) {
if (lineBuffer[i] == '$' && lineBuffer[i + 1] == '(') {
styler.ColourTo(startLine + i - 1, state);
state = SCE_MAKE_IDENTIFIER;
} else if (state == SCE_MAKE_IDENTIFIER && lineBuffer[i] == ')') {
styler.ColourTo(startLine + i, state);
state = SCE_MAKE_DEFAULT;
}
if (!bSpecial) {
if (lineBuffer[i] == ':') {
styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_TARGET);
styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
bSpecial = true; // Only react to the first ':' of the line
state = SCE_MAKE_DEFAULT;
} else if (lineBuffer[i] == '=') {
styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER);
styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
bSpecial = true; // Only react to the first '=' of the line
state = SCE_MAKE_DEFAULT;
}
}
if (!isspacechar(lineBuffer[i])) {
lastNonSpace = i;
}
i++;
}
if (state == SCE_MAKE_IDENTIFIER) {
styler.ColourTo(endPos, SCE_MAKE_IDEOL); // Error, variable reference not ended
} else {
styler.ColourTo(endPos, 0);
styler.ColourTo(endPos, SCE_MAKE_DEFAULT);
}
}
@@ -151,22 +306,38 @@ static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[
char lineBuffer[1024];
styler.StartAt(startPos);
styler.StartSegment(startPos);
unsigned int linePos = 0;
unsigned int linePos = 0, startLine = startPos;
for (unsigned int i = startPos; i <= startPos + length; i++) {
lineBuffer[linePos++] = styler[i];
if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) {
ColouriseMakeLine(lineBuffer, linePos, i, styler);
lineBuffer[linePos] = '\0';
ColouriseMakeLine(lineBuffer, linePos, startLine, i, styler);
linePos = 0;
startLine = i + 1;
}
}
if (linePos > 0)
ColouriseMakeLine(lineBuffer, linePos, startPos + length, styler);
if (linePos > 0) {
ColouriseMakeLine(lineBuffer, linePos, startLine, startPos + length, styler);
}
}
static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos, Accessor &styler) {
static void ColouriseErrorListLine(
char *lineBuffer,
unsigned int lengthLine,
// unsigned int startLine,
unsigned int endPos,
Accessor &styler) {
if (lineBuffer[0] == '>') {
// Command or return status
styler.ColourTo(endPos, SCE_ERR_CMD);
} else if (lineBuffer[0] == '!') {
styler.ColourTo(endPos, SCE_ERR_DIFF_CHANGED);
} else if (lineBuffer[0] == '+') {
styler.ColourTo(endPos, SCE_ERR_DIFF_ADDITION);
} else if (lineBuffer[0] == '-' && lineBuffer[1] == '-' && lineBuffer[2] == '-') {
styler.ColourTo(endPos, SCE_ERR_DIFF_MESSAGE);
} else if (lineBuffer[0] == '-') {
styler.ColourTo(endPos, SCE_ERR_DIFF_DELETION);
} else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) {
styler.ColourTo(endPos, SCE_ERR_PYTHON);
} else if (0 == strncmp(lineBuffer, "Error ", strlen("Error "))) {
@@ -175,18 +346,28 @@ static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos,
} else if (0 == strncmp(lineBuffer, "Warning ", strlen("Warning "))) {
// Borland warning message
styler.ColourTo(endPos, SCE_ERR_BORLAND);
} else if (strstr(lineBuffer, " at " ) &&
strstr(lineBuffer, " at " ) < lineBuffer+lengthLine &&
strstr(lineBuffer, " line ") &&
strstr(lineBuffer, " line ") < lineBuffer+lengthLine) {
} else if (strstr(lineBuffer, "at line " ) &&
strstr(lineBuffer, "at line " ) < lineBuffer + lengthLine &&
strstr(lineBuffer, "file ") &&
strstr(lineBuffer, "file ") < lineBuffer + lengthLine) {
// Lua error message
styler.ColourTo(endPos, SCE_ERR_LUA);
} else if (strstr(lineBuffer, " at " ) &&
strstr(lineBuffer, " at " ) < lineBuffer + lengthLine &&
strstr(lineBuffer, " line ") &&
strstr(lineBuffer, " line ") < lineBuffer + lengthLine) {
// perl error message
styler.ColourTo(endPos, SCE_ERR_PERL);
} else if ((memcmp(lineBuffer, " at ", 6) == 0) &&
strstr(lineBuffer, ":line ")) {
// A .NET traceback
styler.ColourTo(endPos, SCE_ERR_NET);
} else {
// Look for <filename>:<line>:message
// Look for <filename>(line)message
// Look for <filename>(line,pos)message
int state = 0;
for (int i = 0; i < lengthLine; i++) {
for (unsigned int i = 0; i < lengthLine; i++) {
if (state == 0 && lineBuffer[i] == ':' && isdigit(lineBuffer[i + 1])) {
state = 1;
} else if (state == 0 && lineBuffer[i] == '(') {
@@ -240,15 +421,13 @@ static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordLi
}
static int isSpecial(char s) {
return (s == '\\') || (s == ',') || (s == ';') || (s == '\'') || (s == ' ') ||
(s == '\"') || (s == '`') || (s == '^') || (s == '~');
}
static int isTag(int start, Accessor &styler) {
char s[6];
unsigned int i = 0, e=1;
unsigned int i = 0, e = 1;
while (i < 5 && e) {
s[i] = styler[start + i];
i++;
@@ -259,7 +438,7 @@ static int isTag(int start, Accessor &styler) {
}
static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) {
WordList *[], Accessor &styler) {
styler.StartAt(startPos);
@@ -277,75 +456,74 @@ static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,
i++;
continue;
}
switch(state) {
case SCE_L_DEFAULT :
switch(ch) {
case '\\' :
styler.ColourTo(i - 1, state);
if (isSpecial(styler[i + 1])) {
styler.ColourTo(i + 1, SCE_L_COMMAND);
i++;
chNext = styler.SafeGetCharAt(i + 1);
}
else {
if (isTag(i+1, styler))
state = SCE_L_TAG;
else
state = SCE_L_COMMAND;
}
break;
case '$' :
styler.ColourTo(i - 1, state);
state = SCE_L_MATH;
if (chNext == '$') {
i++;
chNext = styler.SafeGetCharAt(i + 1);
}
break;
case '%' :
styler.ColourTo(i - 1, state);
state = SCE_L_COMMENT;
break;
switch (state) {
case SCE_L_DEFAULT :
switch (ch) {
case '\\' :
styler.ColourTo(i - 1, state);
if (isSpecial(styler[i + 1])) {
styler.ColourTo(i + 1, SCE_L_COMMAND);
i++;
chNext = styler.SafeGetCharAt(i + 1);
} else {
if (isTag(i + 1, styler))
state = SCE_L_TAG;
else
state = SCE_L_COMMAND;
}
break;
case SCE_L_COMMAND :
if (chNext == '[' || chNext == '{' || chNext == '}' ||
chNext == ' ' || chNext == '\r' || chNext == '\n') {
styler.ColourTo(i, state);
state = SCE_L_DEFAULT;
break;
case '$' :
styler.ColourTo(i - 1, state);
state = SCE_L_MATH;
if (chNext == '$') {
i++;
chNext = styler.SafeGetCharAt(i + 1);
}
break;
case SCE_L_TAG :
if (ch == '}') {
styler.ColourTo(i, state);
state = SCE_L_DEFAULT;
}
break;
case SCE_L_MATH :
if (ch == '$') {
if (chNext == '$') {
i++;
chNext = styler.SafeGetCharAt(i + 1);
}
styler.ColourTo(i, state);
state = SCE_L_DEFAULT;
}
case '%' :
styler.ColourTo(i - 1, state);
state = SCE_L_COMMENT;
break;
case SCE_L_COMMENT :
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i - 1, state);
state = SCE_L_DEFAULT;
}
break;
case SCE_L_COMMAND :
if (chNext == '[' || chNext == '{' || chNext == '}' ||
chNext == ' ' || chNext == '\r' || chNext == '\n') {
styler.ColourTo(i, state);
state = SCE_L_DEFAULT;
i++;
chNext = styler.SafeGetCharAt(i + 1);
}
break;
case SCE_L_TAG :
if (ch == '}') {
styler.ColourTo(i, state);
state = SCE_L_DEFAULT;
}
break;
case SCE_L_MATH :
if (ch == '$') {
if (chNext == '$') {
i++;
chNext = styler.SafeGetCharAt(i + 1);
}
}
styler.ColourTo(i, state);
state = SCE_L_DEFAULT;
}
break;
case SCE_L_COMMENT :
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i - 1, state);
state = SCE_L_DEFAULT;
}
}
}
styler.ColourTo(lengthDoc, state);
}
LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc);
LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc);
LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc);
LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc);
LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc);
LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc);
LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch");
LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff");
LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props");
LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile");
LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist");
LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc, "latex");

View File

@@ -0,0 +1,222 @@
// Scintilla source code edit control
/** @file LexPascal.cxx
** Lexer for Pascal.
** Written by Laurent le Tynevez
**/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static int classifyWordPascal(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
char s[100];
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = static_cast<char>(tolower(styler[start + i]));
s[i + 1] = '\0';
}
int lev= 0;
char chAttr = SCE_C_IDENTIFIER;
if (isdigit(s[0]) || (s[0] == '.')){
chAttr = SCE_C_NUMBER;
}
else {
if (keywords.InList(s)) {
chAttr = SCE_C_WORD;
if (strcmp(s, "begin") == 0 || strcmp(s, "object") == 0)
lev=1;
else if (strcmp(s, "end") == 0)
lev=-1;
}
}
styler.ColourTo(end, chAttr);
return lev;
}
static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
bool fold = styler.GetPropertyInt("fold");
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
int state = initStyle;
if (state == SCE_C_STRINGEOL) // Does not leak onto next line
state = SCE_C_DEFAULT;
char chPrev = ' ';
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
int visibleChars = 0;
styler.StartSegment(startPos);
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
// 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);
state = SCE_C_DEFAULT;
}
if (fold) {
int lev = levelPrev;
if (visibleChars == 0)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
styler.SetLevel(lineCurrent, lev);
lineCurrent++;
levelPrev = levelCurrent;
}
visibleChars = 0;
}
if (!isspacechar(ch))
visibleChars++;
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
i += 1;
continue;
}
if (state == SCE_C_DEFAULT) {
if (iswordstart(ch) || (ch == '@')) {
styler.ColourTo(i-1, state);
state = SCE_C_IDENTIFIER;
} else if (ch == '{' && chNext != '$' && chNext != '&') {
styler.ColourTo(i-1, state);
state = SCE_C_COMMENT;
} else if (ch == '(' && chNext == '*'
&& styler.SafeGetCharAt(i + 2) != '$'
&& styler.SafeGetCharAt(i + 2) != '&') {
styler.ColourTo(i-1, state);
state = SCE_C_COMMENTDOC;
} else if (ch == '/' && chNext == '/') {
styler.ColourTo(i-1, state);
state = SCE_C_COMMENTLINE;
} else if (ch == '\"') {
styler.ColourTo(i-1, state);
state = SCE_C_STRING;
} else if (ch == '\'') {
styler.ColourTo(i-1, state);
state = SCE_C_CHARACTER;
} else if (ch == '{' && (chNext == '$' || chNext=='&') && visibleChars == 1) {
styler.ColourTo(i-1, state);
state = SCE_C_PREPROCESSOR;
} else if (isoperator(ch)) {
styler.ColourTo(i-1, state);
styler.ColourTo(i, SCE_C_OPERATOR);
}
} else if (state == SCE_C_IDENTIFIER) {
if (!iswordchar(ch)) {
int levelChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywords, styler);
state = SCE_C_DEFAULT;
chNext = styler.SafeGetCharAt(i + 1);
if (ch == '{' && chNext != '$' && chNext != '&') {
state = SCE_C_COMMENT;
} else if (ch == '(' && chNext == '*'
&& styler.SafeGetCharAt(i + 2) != '$'
&& styler.SafeGetCharAt(i + 2) != '&') {
styler.ColourTo(i-1, state);
state = SCE_C_COMMENTDOC;
} else if (ch == '/' && chNext == '/') {
state = SCE_C_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_C_STRING;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_C_OPERATOR);
}
levelCurrent+=levelChange;
}
} else {
if (state == SCE_C_PREPROCESSOR) {
if (ch=='}'){
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
} else {
if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
styler.ColourTo(i-1, state);
state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_COMMENT) {
if (ch == '}' ) {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_COMMENTDOC) {
if (ch == ')' && chPrev == '*') {
if (((i > styler.GetStartSegment() + 2) || (
(initStyle == SCE_C_COMMENTDOC) &&
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_COMMENTLINE) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i-1, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_STRING) {
if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\"') {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
} else if (chNext == '\r' || chNext == '\n') {
styler.ColourTo(i-1, SCE_C_STRINGEOL);
state = SCE_C_STRINGEOL;
}
} else if (state == SCE_C_CHARACTER) {
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
styler.ColourTo(i-1, SCE_C_STRINGEOL);
state = SCE_C_STRINGEOL;
} else if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\'') {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
}
}
}
chPrev = ch;
}
styler.ColourTo(lengthDoc - 1, state);
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
if (fold) {
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
}
LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal");

View File

@@ -1,13 +1,15 @@
// SciTE - Scintilla based Text Editor
// LexPerl.cxx - lexer for subset of Perl
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// Scintilla source code edit control
/** @file LexPerl.cxx
** Lexer for subset of Perl.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
@@ -17,7 +19,18 @@
#include "Scintilla.h"
#include "SciLexer.h"
inline bool isPerlOperator(char ch) {
static inline bool isEOLChar(char ch) {
return (ch == '\r') || (ch == '\n');
}
static bool isSingleCharOp(char ch) {
char strCharSet[2];
strCharSet[0] = ch;
strCharSet[1] = '\0';
return (NULL != strstr("rwxoRWXOezsfdlpSbctugkTBMAC", strCharSet));
}
static inline bool isPerlOperator(char ch) {
if (isalnum(ch))
return false;
// '.' left out as it is used to make up numbers
@@ -49,7 +62,7 @@ static int classifyWordPerl(unsigned int start, unsigned int end, WordList &keyw
return chAttr;
}
static bool isEndVar(char ch) {
static inline bool isEndVar(char ch) {
return !isalnum(ch) && ch != '#' && ch != '$' &&
ch != '_' && ch != '\'';
}
@@ -85,32 +98,86 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
// Lexer for perl often has to backtrack to start of current style to determine
// which characters are being used as quotes, how deeply nested is the
// start position and what the termination string is for here documents
WordList &keywords = *keywordlists[0];
class HereDocCls {
public:
int State; // 0: '<<' encountered
// 1: collect the delimiter
// 2: here doc text (lines after the delimiter)
char Quote; // the char after '<<'
bool Quoted; // true if Quote in ('\'','"','`')
int DelimiterLength; // strlen(Delimiter)
char Delimiter[256]; // the Delimiter, 256: sizeof PL_tokenbuf
HereDocCls() {
State = 0;
DelimiterLength = 0;
Delimiter[0] = '\0';
}
};
HereDocCls HereDoc; // TODO: FIFO for stacked here-docs
class QuoteCls {
public:
int Rep;
int Count;
char Up;
char Down;
QuoteCls() {
this->New(1);
}
void New(int r) {
Rep = r;
Count = 0;
Up = '\0';
Down = '\0';
}
void Open(char u) {
Count++;
Up = u;
Down = opposite(Up);
}
};
QuoteCls Quote;
char sooked[100];
int quotes = 0;
char quoteDown = 'd';
char quoteUp = 'd';
int quoteRep = 1;
int sookedpos = 0;
bool preferRE = true;
sooked[sookedpos] = '\0';
int state = initStyle;
int lengthDoc = startPos + length;
unsigned int lengthDoc = startPos + length;
// If in a long distance lexical state, seek to the beginning to find quote characters
if (state == SCE_PL_HERE || state == SCE_PL_REGEX ||
state == SCE_PL_REGSUBST || state == SCE_PL_LONGQUOTE) {
if (state == SCE_PL_HERE_Q || state == SCE_PL_HERE_QQ || state == SCE_PL_HERE_QX) {
while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_PL_HERE_DELIM)) {
startPos--;
}
startPos = styler.LineStart(styler.GetLine(startPos));
state = styler.StyleAt(startPos - 1);
}
if ( state == SCE_PL_STRING_Q
|| state == SCE_PL_STRING_QQ
|| state == SCE_PL_STRING_QX
|| state == SCE_PL_STRING_QR
|| state == SCE_PL_STRING_QW
|| state == SCE_PL_REGEX
|| state == SCE_PL_REGSUBST
) {
while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) {
startPos--;
}
state = SCE_PL_DEFAULT;
}
styler.StartAt(startPos);
char chPrev = styler.SafeGetCharAt(startPos - 1);
if (startPos == 0)
chPrev = '\n';
char chNext = styler[startPos];
styler.StartSegment(startPos);
for (int i = startPos; i < lengthDoc; i++) {
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
char chNext2 = styler.SafeGetCharAt(i + 2);
@@ -121,41 +188,81 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
i += 1;
continue;
}
if ((chPrev == '\r' && ch == '\n')) { // skip on DOS/Windows
chPrev = ch;
continue;
}
if (HereDoc.State == 1 && isEOLChar(ch)) {
// Begin of here-doc (the line after the here-doc delimiter):
HereDoc.State = 2;
styler.ColourTo(i - 1, state);
if (HereDoc.Quoted) {
if (state == SCE_PL_HERE_DELIM) {
// Missing quote at end of string! We are stricter than perl.
state = SCE_PL_ERROR;
} else {
switch (HereDoc.Quote) {
case '\'':
state = SCE_PL_HERE_Q ;
break;
case '"':
state = SCE_PL_HERE_QQ;
break;
case '`':
state = SCE_PL_HERE_QX;
break;
}
}
} else {
switch (HereDoc.Quote) {
case '\\':
state = SCE_PL_HERE_Q ;
break;
default :
state = SCE_PL_HERE_QQ;
}
}
}
if (state == SCE_PL_DEFAULT) {
if (iswordstart(ch)) {
styler.ColourTo(i - 1, state);
if (ch == 's' && !isalnum(chNext)) {
state = SCE_PL_REGSUBST;
quotes = 0;
quoteUp = '\0';
quoteDown = '\0';
quoteRep = 2;
Quote.New(2);
} else if (ch == 'm' && !isalnum(chNext)) {
state = SCE_PL_REGEX;
quotes = 0;
quoteUp = '\0';
quoteDown = '\0';
quoteRep = 1;
Quote.New(1);
} else if (ch == 'q' && !isalnum(chNext)) {
state = SCE_PL_STRING_Q;
Quote.New(1);
} else if (ch == 'y' && !isalnum(chNext)) {
state = SCE_PL_REGSUBST;
Quote.New(2);
} else if (ch == 't' && chNext == 'r' && !isalnum(chNext2)) {
state = SCE_PL_REGSUBST;
quotes = 0;
quoteUp = '\0';
quoteDown = '\0';
quoteRep = 2;
Quote.New(2);
i++;
chNext = chNext2;
} else if (ch == 'q' && (chNext == 'q' || chNext == 'r' || chNext == 'w' || chNext == 'x') && !isalnum(chNext2)) {
state = SCE_PL_LONGQUOTE;
if (chNext == 'q') state = SCE_PL_STRING_QQ;
else if (chNext == 'x') state = SCE_PL_STRING_QX;
else if (chNext == 'r') state = SCE_PL_STRING_QR;
else if (chNext == 'w') state = SCE_PL_STRING_QW;
i++;
chNext = chNext2;
quotes = 0;
quoteUp = '\0';
quoteDown = '\0';
quoteRep = 1;
Quote.New(1);
} else {
state = SCE_PL_WORD;
preferRE = false;
if ((!iswordchar(chNext) && chNext != '\'')
|| (chNext == '.' && chNext2 == '.')) {
// We need that if length of word == 1!
// This test is copied from the SCE_PL_WORD handler.
classifyWordPerl(styler.GetStartSegment(), i, keywords, styler);
state = SCE_PL_DEFAULT;
}
}
} else if (ch == '#') {
styler.ColourTo(i - 1, state);
@@ -163,6 +270,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
} else if (ch == '\"') {
styler.ColourTo(i - 1, state);
state = SCE_PL_STRING;
Quote.New(1);
Quote.Open(ch);
} else if (ch == '\'') {
if (chPrev == '&') {
// Archaic call
@@ -170,22 +279,24 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
} else {
styler.ColourTo(i - 1, state);
state = SCE_PL_CHARACTER;
Quote.New(1);
Quote.Open(ch);
}
} else if (ch == '`') {
styler.ColourTo(i - 1, state);
state = SCE_PL_BACKTICKS;
Quote.New(1);
Quote.Open(ch);
} else if (ch == '$') {
preferRE = false;
styler.ColourTo(i - 1, state);
if (isalnum(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
state = SCE_PL_SCALAR;
} else if (chNext != '{' && chNext != '[') {
if ((chNext == '{') || isspacechar(chNext)) {
styler.ColourTo(i, SCE_PL_SCALAR);
i++;
ch = ' ';
chNext = ' ';
} else {
styler.ColourTo(i, SCE_PL_SCALAR);
state = SCE_PL_SCALAR;
i++;
ch = chNext;
chNext = chNext2;
}
} else if (ch == '@') {
preferRE = false;
@@ -204,12 +315,10 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
styler.ColourTo(i - 1, state);
if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
state = SCE_PL_HASH;
} else if (chNext != '{' && chNext != '[') {
} else if (chNext == '{') {
styler.ColourTo(i, SCE_PL_HASH);
i++;
ch = ' ';
} else {
styler.ColourTo(i, SCE_PL_HASH);
styler.ColourTo(i, SCE_PL_OPERATOR);
}
} else if (ch == '*') {
styler.ColourTo(i - 1, state);
@@ -217,25 +326,29 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
} else if (ch == '/' && preferRE) {
styler.ColourTo(i - 1, state);
state = SCE_PL_REGEX;
quoteUp = '/';
quoteDown = '/';
quotes = 1;
quoteRep = 1;
Quote.New(1);
Quote.Open(ch);
} else if (ch == '<' && chNext == '<') {
styler.ColourTo(i - 1, state);
state = SCE_PL_HERE;
i++;
ch = chNext;
chNext = chNext2;
quotes = 0;
sookedpos = 0;
sooked[sookedpos] = '\0';
} else if (ch == '=' && (chPrev == '\r' || chPrev == '\n') && isalpha(chNext)) {
state = SCE_PL_HERE_DELIM;
HereDoc.State = 0;
} else if (ch == '='
&& isalpha(chNext)
&& (isEOLChar(chPrev))) {
styler.ColourTo(i - 1, state);
state = SCE_PL_POD;
quotes = 0;
sookedpos = 0;
sooked[sookedpos] = '\0';
} else if (ch == '-'
&& isSingleCharOp(chNext)
&& !isalnum((chNext2 = styler.SafeGetCharAt(i+2)))) {
styler.ColourTo(i - 1, state);
styler.ColourTo(i + 1, SCE_PL_WORD);
state = SCE_PL_DEFAULT;
preferRE = false;
i += 2;
ch = chNext2;
chNext = chNext2 = styler.SafeGetCharAt(i + 1);
} else if (isPerlOperator(ch)) {
if (ch == ')' || ch == ']')
preferRE = false;
@@ -245,7 +358,10 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
styler.ColourTo(i, SCE_PL_OPERATOR);
}
} else if (state == SCE_PL_WORD) {
if (!iswordchar(ch) && ch != '\'') { // Archaic Perl has quotes inside names
if ((!iswordchar(chNext) && chNext != '\'')
|| (chNext == '.' && chNext2 == '.')) {
// ".." is always an operator if preceded by a SCE_PL_WORD.
// Archaic Perl has quotes inside names
if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__DATA__")) {
styler.ColourTo(i, SCE_PL_DATASECTION);
state = SCE_PL_DATASECTION;
@@ -253,95 +369,106 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
styler.ColourTo(i, SCE_PL_DATASECTION);
state = SCE_PL_DATASECTION;
} else {
if (classifyWordPerl(styler.GetStartSegment(), i - 1, keywords, styler) == SCE_PL_WORD)
if (classifyWordPerl(styler.GetStartSegment(), i, keywords, styler) == SCE_PL_WORD)
preferRE = true;
state = SCE_PL_DEFAULT;
if (ch == '#') {
state = SCE_PL_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_PL_STRING;
} else if (ch == '\'') {
state = SCE_PL_CHARACTER;
} else if (ch == '<' && chNext == '<') {
state = SCE_PL_HERE;
quotes = 0;
sookedpos = 0;
sooked[sookedpos] = '\0';
} else if (isPerlOperator(ch)) {
if (ch == ')' || ch == ']')
preferRE = false;
else
preferRE = true;
styler.ColourTo(i, SCE_PL_OPERATOR);
state = SCE_PL_DEFAULT;
}
ch = ' ';
}
}
} else {
if (state == SCE_PL_COMMENTLINE) {
if (ch == '\r' || ch == '\n') {
if (isEOLChar(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_PL_DEFAULT;
}
} else if (state == SCE_PL_HERE) {
if ((isalnum(ch) || ch == '_') && quotes < 2) {
sooked[sookedpos++] = ch;
sooked[sookedpos] = '\0';
if (quotes == 0)
quotes = 1;
} else {
quotes++;
} else if (state == SCE_PL_HERE_DELIM) {
//
// From perldata.pod:
// ------------------
// A line-oriented form of quoting is based on the shell ``here-doc''
// syntax.
// Following a << you specify a string to terminate the quoted material,
// and all lines following the current line down to the terminating
// string are the value of the item.
// The terminating string may be either an identifier (a word),
// or some quoted text.
// If quoted, the type of quotes you use determines the treatment of
// the text, just as in regular quoting.
// An unquoted identifier works like double quotes.
// There must be no space between the << and the identifier.
// (If you put a space it will be treated as a null identifier,
// which is valid, and matches the first empty line.)
// The terminating string must appear by itself (unquoted and with no
// surrounding whitespace) on the terminating line.
//
if (HereDoc.State == 0) { // '<<' encountered
HereDoc.State = 1;
HereDoc.Quote = chNext;
HereDoc.Quoted = false;
HereDoc.DelimiterLength = 0;
HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
if (chNext == '\'' || chNext == '"' || chNext == '`') { // a quoted here-doc delimiter
i++;
ch = chNext;
chNext = chNext2;
HereDoc.Quoted = true;
} else if (chNext == '\\') { // ref?
i++;
ch = chNext;
chNext = chNext2;
} else if (isalnum(chNext) || chNext == '_') { // an unquoted here-doc delimiter
}
else if (isspacechar(chNext)) { // deprecated here-doc delimiter || TODO: left shift operator
}
else { // TODO: ???
}
} else if (HereDoc.State == 1) { // collect the delimiter
if (HereDoc.Quoted) { // a quoted here-doc delimiter
if (ch == HereDoc.Quote) { // closing quote => end of delimiter
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
i++;
ch = chNext;
chNext = chNext2;
} else {
if (ch == '\\' && chNext == HereDoc.Quote) { // escaped quote
i++;
ch = chNext;
chNext = chNext2;
}
HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch;
HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
}
} else { // an unquoted here-doc delimiter
if (isalnum(ch) || ch == '_') {
HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch;
HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
} else {
styler.ColourTo(i - 1, state);
state = SCE_PL_DEFAULT;
}
}
if (HereDoc.DelimiterLength >= static_cast<int>(sizeof(HereDoc.Delimiter)) - 1) {
styler.ColourTo(i - 1, state);
state = SCE_PL_ERROR;
}
}
if ((quotes > 1) &&
(chPrev == '\n' || chPrev == '\r') &&
isMatch(styler, lengthDoc, i, sooked)) {
i += sookedpos;
} else if (HereDoc.State == 2) {
// state == SCE_PL_HERE_Q || state == SCE_PL_HERE_QQ || state == SCE_PL_HERE_QX
if (isEOLChar(chPrev) && isMatch(styler, lengthDoc, i, HereDoc.Delimiter)) {
i += HereDoc.DelimiterLength;
chNext = styler.SafeGetCharAt(i);
if (chNext == '\n' || chNext == '\r') {
styler.ColourTo(i - 1, SCE_PL_HERE);
if (isEOLChar(chNext)) {
styler.ColourTo(i - 1, state);
state = SCE_PL_DEFAULT;
HereDoc.State = 0;
}
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (state == SCE_PL_STRING) {
if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\"') {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (state == SCE_PL_CHARACTER) {
if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\'') {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (state == SCE_PL_BACKTICKS) {
if (ch == '`') {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (state == SCE_PL_POD) {
if (ch == '=' && (chPrev == '\r' || chPrev == '\n')) {
if (ch == '=' && isEOLChar(chPrev)) {
if (isMatch(styler, lengthDoc, i, "=cut")) {
styler.ColourTo(i - 1 + 4, state);
i += 4;
@@ -352,7 +479,12 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
}
} else if (state == SCE_PL_SCALAR) {
if (isEndVar(ch)) {
styler.ColourTo(i - 1, state);
if (i == (styler.GetStartSegment() + 1)) {
// Special variable: $(, $_ etc.
styler.ColourTo(i, state);
} else {
styler.ColourTo(i - 1, state);
}
state = SCE_PL_DEFAULT;
}
} else if (state == SCE_PL_ARRAY) {
@@ -370,36 +502,36 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
styler.ColourTo(i - 1, state);
state = SCE_PL_DEFAULT;
}
} else if (state == SCE_PL_REF) {
if (isEndVar(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_PL_DEFAULT;
}
} else if (state == SCE_PL_REGEX) {
if (!quoteUp && !isspace(ch)) {
quoteUp = ch;
quoteDown = opposite(ch);
quotes++;
} else if (state == SCE_PL_REGEX
|| state == SCE_PL_STRING_QR
) {
if (!Quote.Up && !isspacechar(ch)) {
Quote.Open(ch);
} else if (ch == '\\' && Quote.Up != '\\') {
// SG: Is it save to skip *every* escaped char?
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
} else {
if (ch == quoteDown && chPrev != '\\') {
quotes--;
if (quotes == 0) {
quoteRep--;
if (quoteUp == quoteDown) {
quotes++;
if (ch == Quote.Down /*&& chPrev != '\\'*/) {
Quote.Count--;
if (Quote.Count == 0) {
Quote.Rep--;
if (Quote.Up == Quote.Down) {
Quote.Count++;
}
}
if (!isalpha(chNext)) {
if (quoteRep <= 0) {
if (Quote.Rep <= 0) {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
ch = ' ';
}
}
} else if (ch == quoteUp && chPrev != '\\') {
quotes++;
} else if (ch == Quote.Up /*&& chPrev != '\\'*/) {
Quote.Count++;
} else if (!isalpha(chNext)) {
if (quoteRep <= 0) {
if (Quote.Rep <= 0) {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
ch = ' ';
@@ -407,12 +539,15 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
}
}
} else if (state == SCE_PL_REGSUBST) {
if (!quoteUp && !isspace(ch)) {
quoteUp = ch;
quoteDown = opposite(ch);
quotes++;
if (!Quote.Up && !isspacechar(ch)) {
Quote.Open(ch);
} else if (ch == '\\' && Quote.Up != '\\') {
// SG: Is it save to skip *every* escaped char?
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
} else {
if (quotes == 0 && quoteRep == 1) {
if (Quote.Count == 0 && Quote.Rep == 1) {
/* We matched something like s(...) or tr{...}
* and are looking for the next matcher characters,
* which could be either bracketed ({...}) or non-bracketed
@@ -420,68 +555,76 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
*
* Number-signs are problematic. If they occur after
* the close of the first part, treat them like
* a quoteUp char, even if they actually start comments.
* a Quote.Up char, even if they actually start comments.
*
* If we find an alnum, we end the regsubst, and punt.
*
* Eric Promislow ericp@activestate.com Aug 9,2000
*/
if (isspace(ch)) {
if (isspacechar(ch)) {
// Keep going
} else if (isalnum(ch)) {
}
else if (isalnum(ch)) {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
ch = ' ';
} else {
quoteUp = ch;
quoteDown = opposite(ch);
quotes++;
Quote.Open(ch);
}
} else if (ch == quoteDown && chPrev != '\\') {
quotes--;
if (quotes == 0) {
quoteRep--;
} else if (ch == Quote.Down /*&& chPrev != '\\'*/) {
Quote.Count--;
if (Quote.Count == 0) {
Quote.Rep--;
}
if (!isalpha(chNext)) {
if (quoteRep <= 0) {
if (Quote.Rep <= 0) {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
ch = ' ';
}
}
if (quoteUp == quoteDown) {
quotes++;
if (Quote.Up == Quote.Down) {
Quote.Count++;
}
} else if (ch == quoteUp && chPrev != '\\') {
quotes++;
} else if (ch == Quote.Up /*&& chPrev != '\\'*/) {
Quote.Count++;
} else if (!isalpha(chNext)) {
if (quoteRep <= 0) {
if (Quote.Rep <= 0) {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
ch = ' ';
}
}
}
} else if (state == SCE_PL_LONGQUOTE) {
if (!quoteDown && !isspace(ch)) {
quoteUp = ch;
quoteDown = opposite(quoteUp);
quotes++;
} else if (ch == quoteDown) {
quotes--;
if (quotes == 0) {
quoteRep--;
if (quoteRep <= 0) {
} else if (state == SCE_PL_STRING_Q
|| state == SCE_PL_STRING_QQ
|| state == SCE_PL_STRING_QX
|| state == SCE_PL_STRING_QW
|| state == SCE_PL_STRING
|| state == SCE_PL_CHARACTER
|| state == SCE_PL_BACKTICKS
) {
if (!Quote.Down && !isspacechar(ch)) {
Quote.Open(ch);
} else if (ch == '\\' && Quote.Up != '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
} else if (ch == Quote.Down) {
Quote.Count--;
if (Quote.Count == 0) {
Quote.Rep--;
if (Quote.Rep <= 0) {
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
ch = ' ';
}
if (quoteUp == quoteDown) {
quotes++;
if (Quote.Up == Quote.Down) {
Quote.Count++;
}
}
} else if (ch == quoteUp) {
quotes++;
} else if (ch == Quote.Up) {
Quote.Count++;
}
}
@@ -490,19 +633,30 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
state = SCE_PL_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_PL_STRING;
Quote.New(1);
Quote.Open(ch);
} else if (ch == '\'') {
state = SCE_PL_CHARACTER;
Quote.New(1);
Quote.Open(ch);
} else if (iswordstart(ch)) {
state = SCE_PL_WORD;
preferRE = false;
} else if (isoperator(ch)) {
} else if (isPerlOperator(ch)) {
if (ch == ')' || ch == ']')
preferRE = false;
else
preferRE = true;
styler.ColourTo(i, SCE_PL_OPERATOR);
}
}
}
if (state == SCE_PL_ERROR) {
break;
}
chPrev = ch;
}
styler.ColourTo(lengthDoc, state);
}
LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc);
LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl");

View File

@@ -1,13 +1,15 @@
// SciTE - Scintilla based Text Editor
// LexPython.cxx - lexer for Python
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// Scintilla source code edit control
/** @file LexPython.cxx
** Lexer for Python.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
@@ -17,6 +19,32 @@
#include "Scintilla.h"
#include "SciLexer.h"
/* Returns true if the "as" word that begins at start follows an import statement */
static bool IsImportAs(unsigned int start, Accessor &styler) {
unsigned int i;
unsigned int j;
char s[10];
/* Find any import before start but after any statement terminator or quote */
i = start;
while (i > 0) {
char ch = styler[i - 1];
if (ch == '\n' || ch == '\r' || ch == ';' || ch == '\'' || ch == '"' || ch == '`')
break;
if (ch == 't' && i > 5) {
for (j = 0; j < 6; j++)
s[j] = styler[(i - 6) + j];
s[j] = '\0';
if (strcmp(s, "import") == 0)
return true;
}
i--;
}
return false;
}
static void ClassifyWordPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) {
char s[100];
bool wordIsNumber = isdigit(styler[start]);
@@ -33,6 +61,8 @@ static void ClassifyWordPy(unsigned int start, unsigned int end, WordList &keywo
chAttr = SCE_P_NUMBER;
else if (keywords.InList(s))
chAttr = SCE_P_WORD;
else if (strcmp(s, "as") == 0 && IsImportAs(start, styler))
chAttr = SCE_P_WORD;
// make sure that dot-qualifiers inside the word are lexed correct
else for (unsigned int i = 0; i < end - start + 1; i++) {
if (styler[start + i] == '.') {
@@ -48,50 +78,107 @@ static bool IsPyComment(Accessor &styler, int pos, int len) {
return len>0 && styler[pos]=='#';
}
static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
static bool IsPyStringStart(char ch, char chNext, char chNext2) {
if (ch == '\'' || ch == '"')
return true;
if (ch == 'u' || ch == 'U') {
if (chNext == '"' || chNext == '\'')
return true;
if ((chNext == 'r' || chNext == 'R') && (chNext2 == '"' || chNext2 == '\''))
return true;
}
if ((ch == 'r' || ch == 'R') && (chNext == '"' || chNext == '\''))
return true;
return false;
}
static bool IsPyWordStart(char ch, char chNext, char chNext2) {
return (iswordchar(ch) && !IsPyStringStart(ch, chNext, chNext2));
}
/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
static int GetPyStringState(Accessor &styler, int i, int *nextIndex) {
char ch = styler.SafeGetCharAt(i);
char chNext = styler.SafeGetCharAt(i + 1);
// Advance beyond r, u, or ur prefix, but bail if there are any unexpected chars
if (ch == 'r' || ch == 'R') {
i++;
ch = styler.SafeGetCharAt(i);
chNext = styler.SafeGetCharAt(i + 1);
}
else if (ch == 'u' || ch == 'U') {
if (chNext == 'r' || chNext == 'R')
i += 2;
else
i += 1;
ch = styler.SafeGetCharAt(i);
chNext = styler.SafeGetCharAt(i + 1);
}
if (ch != '"' && ch != '\'') {
*nextIndex = i + 1;
return SCE_P_DEFAULT;
}
if (ch == chNext && ch == styler.SafeGetCharAt(i + 2)) {
*nextIndex = i + 3;
if (ch == '"')
return SCE_P_TRIPLEDOUBLE;
else
return SCE_P_TRIPLE;
} else {
*nextIndex = i + 1;
if (ch == '"')
return SCE_P_STRING;
else
return SCE_P_CHARACTER;
}
}
static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
int lengthDoc = startPos + length;
// Backtrack to previous line in case need to fix its fold status or tab whinging
// Backtrack to previous line in case need to fix its tab whinging
int lineCurrent = styler.GetLine(startPos);
if (startPos > 0) {
if (lineCurrent > 0) {
lineCurrent--;
startPos = styler.LineStart(lineCurrent);
startPos = styler.LineStart(lineCurrent-1);
if (startPos == 0)
initStyle = SCE_P_DEFAULT;
else
else
initStyle = styler.StyleAt(startPos-1);
}
}
// Python uses a different mask because bad indentation is marked by oring with 32
styler.StartAt(startPos, 127);
WordList &keywords = *keywordlists[0];
bool fold = styler.GetPropertyInt("fold");
int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
char prevWord[200];
prevWord[0] = '\0';
if (length == 0)
return ;
int spaceFlags = 0;
int state = initStyle & 31;
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
indentCurrent |= SC_FOLDLEVELWHITEFLAG;
int nextIndex = 0;
char chPrev = ' ';
char chPrev2 = ' ';
char chNext = styler[startPos];
styler.StartSegment(startPos);
bool atStartLine = true;
int spaceFlags = 0;
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
for (int i = startPos; i < lengthDoc; i++) {
if (atStartLine) {
char chBad = static_cast<char>(64);
char chGood = static_cast<char>(0);
@@ -108,40 +195,19 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
styler.SetFlags(chFlags, static_cast<char>(state));
atStartLine = false;
}
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
char chNext2 = styler.SafeGetCharAt(i + 2);
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) {
// Perform colourisation of white space and triple quoted strings at end of each line to allow
// tab marking to work inside white space and triple quoted strings
styler.ColourTo(i, state);
}
int lev = indentCurrent;
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsPyComment);
if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
indentNext |= SC_FOLDLEVELWHITEFLAG;
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
// Only non whitespace lines can be headers
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
lev |= SC_FOLDLEVELHEADERFLAG;
} else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
// Line after is blank so check the next - maybe should continue further?
int spaceFlags2 = 0;
int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsPyComment);
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
lev |= SC_FOLDLEVELHEADERFLAG;
}
}
}
indentCurrent = indentNext;
if (fold) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
atStartLine = true;
}
@@ -160,33 +226,20 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
}
}
if (state == SCE_P_DEFAULT) {
if (iswordstart(ch)) {
if (IsPyWordStart(ch, chNext, chNext2)) {
styler.ColourTo(i - 1, state);
state = SCE_P_WORD;
} else if (ch == '#') {
styler.ColourTo(i - 1, state);
state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
} else if (ch == '\"') {
} else if (IsPyStringStart(ch, chNext, chNext2)) {
styler.ColourTo(i - 1, state);
if (chNext == '\"' && chNext2 == '\"') {
i += 2;
state = SCE_P_TRIPLEDOUBLE;
state = GetPyStringState(styler, i, &nextIndex);
if (nextIndex != i + 1) {
i = nextIndex - 1;
ch = ' ';
chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
} else {
state = SCE_P_STRING;
}
} else if (ch == '\'') {
styler.ColourTo(i - 1, state);
if (chNext == '\'' && chNext2 == '\'') {
i += 2;
state = SCE_P_TRIPLE;
ch = ' ';
chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
} else {
state = SCE_P_CHARACTER;
}
} else if (isoperator(ch)) {
styler.ColourTo(i - 1, state);
@@ -198,25 +251,14 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
state = SCE_P_DEFAULT;
if (ch == '#') {
state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
} else if (ch == '\"') {
if (chNext == '\"' && chNext2 == '\"') {
i += 2;
state = SCE_P_TRIPLEDOUBLE;
} else if (IsPyStringStart(ch, chNext, chNext2)) {
styler.ColourTo(i - 1, state);
state = GetPyStringState(styler, i, &nextIndex);
if (nextIndex != i + 1) {
i = nextIndex - 1;
ch = ' ';
chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
} else {
state = SCE_P_STRING;
}
} else if (ch == '\'') {
if (chNext == '\'' && chNext2 == '\'') {
i += 2;
state = SCE_P_TRIPLE;
ch = ' ';
chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
} else {
state = SCE_P_CHARACTER;
}
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_P_OPERATOR);
@@ -278,4 +320,131 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
}
}
LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc);
static bool IsCommentLine(int line, Accessor &styler) {
int pos = styler.LineStart(line);
int eol_pos = styler.LineStart(line+1) - 1;
for (int i = pos; i < eol_pos; i++) {
char ch = styler[i];
if (ch == '#')
return true;
else if (ch != ' ' && ch != '\t')
return false;
}
return false;
}
static bool IsQuoteLine(int line, Accessor &styler) {
int style = styler.StyleAt(styler.LineStart(line)) & 31;
return ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE));
}
static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unused*/,
WordList *[], Accessor &styler) {
int maxPos = startPos + length;
int maxLines = styler.GetLine(maxPos-1);
bool foldComment = styler.GetPropertyInt("fold.comment.python");
bool foldQuotes = styler.GetPropertyInt("fold.quotes.python");
// Backtrack to previous non-blank line so we can determine indent level
// for any white space lines (needed esp. within triple quoted strings)
// and so we can fix any preceding fold level (which is why we go back
// at least one line in all cases)
int spaceFlags = 0;
int lineCurrent = styler.GetLine(startPos);
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
while (lineCurrent > 0) {
lineCurrent--;
indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG) &&
(!IsCommentLine(lineCurrent, styler)) &&
(!IsQuoteLine(lineCurrent, styler)))
break;
}
int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
startPos = styler.LineStart(lineCurrent);
// Set up initial state
int prev_state = SCE_P_DEFAULT & 31;
if (lineCurrent >= 1)
prev_state = styler.StyleAt(startPos-1) & 31;
int prevQuote = foldQuotes && ((prev_state == SCE_P_TRIPLE) || (prev_state == SCE_P_TRIPLEDOUBLE));
int prevComment = 0;
if (lineCurrent >= 1)
prevComment = foldComment && IsCommentLine(lineCurrent - 1, styler);
// Process all characters to end of requested range or end of any triple quote
// or comment that hangs over the end of the range
while ((lineCurrent <= maxLines) || prevQuote || prevComment) {
// Gather info
int lev = indentCurrent;
int lineNext = lineCurrent + 1;
int style = styler.StyleAt(styler.LineStart(lineNext)) & 31;
int indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
int quote = foldQuotes && ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE));
int quote_start = (quote && !prevQuote);
int quote_continue = (quote && prevQuote);
int comment = foldComment && IsCommentLine(lineCurrent, styler);
int comment_start = (comment && !prevComment &&
IsCommentLine(lineNext, styler) && (lev > SC_FOLDLEVELBASE));
int comment_continue = (comment && prevComment);
if ((!quote || !prevQuote) && !comment)
indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
if (quote)
indentNext = indentCurrentLevel;
if (indentNext & SC_FOLDLEVELWHITEFLAG)
indentNext = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel;
if (quote_start) {
// Place fold point at start of triple quoted string
lev |= SC_FOLDLEVELHEADERFLAG;
} else if (quote_continue || prevQuote) {
// Add level to rest of lines in the string
lev = lev + 1;
} else if (comment_start) {
// Place fold point at start of a block of comments
lev |= SC_FOLDLEVELHEADERFLAG;
} else if (comment_continue) {
// Add level to rest of lines in the block
lev = lev + 1;
}
// Skip past any blank lines for next indent level info; we skip also comments
// starting in column 0 which effectively folds them into surrounding code
// rather than screwing up folding. Then set indent level on the lines
// we skipped to be same as maximum of current and next indent. This approach
// does a reasonable job of collapsing white space into surrounding code
// without getting confused by white space at the start of an indented level.
while (!quote &&
((indentNext & SC_FOLDLEVELWHITEFLAG) || styler[styler.LineStart(lineNext)] == '#') &&
(lineNext < maxLines)) {
int level = Platform::Maximum(indentCurrent, indentNext);
if (indentNext & SC_FOLDLEVELWHITEFLAG)
level = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel;
styler.SetLevel(lineNext, level);
lineNext++;
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
}
// Set fold header on non-quote/non-comment line
if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) {
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
lev |= SC_FOLDLEVELHEADERFLAG;
}
// Keep track of triple quote and block comment state of previous line
prevQuote = quote;
prevComment = comment_start || comment_continue;
// Set fold level for this line and move to next line
styler.SetLevel(lineCurrent, lev);
indentCurrent = indentNext;
lineCurrent = lineNext;
}
// Make sure last line indent level is set too
styler.SetLevel(lineCurrent, indentCurrent);
}
LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc);

View File

@@ -0,0 +1,355 @@
// Scintilla source code edit control
/** @file LexRuby.cxx
** Lexer for Ruby.
**/
// Copyright 2001- by Clemens Wyss <wys@helbling.ch>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static void ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) {
char s[100];
bool wordIsNumber = isdigit(styler[start]);
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = styler[start + i];
s[i + 1] = '\0';
}
char chAttr = SCE_P_IDENTIFIER;
if (0 == strcmp(prevWord, "class"))
chAttr = SCE_P_CLASSNAME;
else if (0 == strcmp(prevWord, "module"))
chAttr = SCE_P_CLASSNAME;
else if (0 == strcmp(prevWord, "def"))
chAttr = SCE_P_DEFNAME;
else if (wordIsNumber)
chAttr = SCE_P_NUMBER;
else if (keywords.InList(s))
chAttr = SCE_P_WORD;
// make sure that dot-qualifiers inside the word are lexed correct
else for (unsigned int i = 0; i < end - start + 1; i++) {
if (styler[start + i] == '.') {
styler.ColourTo(start + i - 1, chAttr);
styler.ColourTo(start + i, SCE_P_OPERATOR);
}
}
styler.ColourTo(end, chAttr);
strcpy(prevWord, s);
}
static bool IsRbComment(Accessor &styler, int pos, int len) {
return len>0 && styler[pos]=='#';
}
static bool IsRbStringStart(char ch, char chNext, char chNext2) {
if (ch == '\'' || ch == '"')
return true;
if (ch == 'u' || ch == 'U') {
if (chNext == '"' || chNext == '\'')
return true;
if ((chNext == 'r' || chNext == 'R') && (chNext2 == '"' || chNext2 == '\''))
return true;
}
if ((ch == 'r' || ch == 'R') && (chNext == '"' || chNext == '\''))
return true;
return false;
}
static bool IsRbWordStart(char ch, char chNext, char chNext2) {
return (iswordchar(ch) && !IsRbStringStart(ch, chNext, chNext2));
}
/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
static int GetRbStringState(Accessor &styler, int i, int *nextIndex) {
char ch = styler.SafeGetCharAt(i);
char chNext = styler.SafeGetCharAt(i + 1);
// Advance beyond r, u, or ur prefix, but bail if there are any unexpected chars
if (ch == 'r' || ch == 'R') {
i++;
ch = styler.SafeGetCharAt(i);
chNext = styler.SafeGetCharAt(i + 1);
}
else if (ch == 'u' || ch == 'U') {
if (chNext == 'r' || chNext == 'R')
i += 2;
else
i += 1;
ch = styler.SafeGetCharAt(i);
chNext = styler.SafeGetCharAt(i + 1);
}
if (ch != '"' && ch != '\'') {
*nextIndex = i + 1;
return SCE_P_DEFAULT;
}
if (ch == chNext && ch == styler.SafeGetCharAt(i + 2)) {
*nextIndex = i + 3;
if (ch == '"')
return SCE_P_TRIPLEDOUBLE;
else
return SCE_P_TRIPLE;
} else {
*nextIndex = i + 1;
if (ch == '"')
return SCE_P_STRING;
else
return SCE_P_CHARACTER;
}
}
static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
int lengthDoc = startPos + length;
// Backtrack to previous line in case need to fix its tab whinging
if (startPos > 0) {
int lineCurrent = styler.GetLine(startPos);
if (lineCurrent > 0) {
startPos = styler.LineStart(lineCurrent-1);
if (startPos == 0)
initStyle = SCE_P_DEFAULT;
else
initStyle = styler.StyleAt(startPos-1);
}
}
// Ruby uses a different mask because bad indentation is marked by oring with 32
styler.StartAt(startPos, 127);
WordList &keywords = *keywordlists[0];
int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
char prevWord[200];
prevWord[0] = '\0';
if (length == 0)
return ;
int state = initStyle & 31;
int nextIndex = 0;
char chPrev = ' ';
char chPrev2 = ' ';
char chNext = styler[startPos];
styler.StartSegment(startPos);
bool atStartLine = true;
int spaceFlags = 0;
for (int i = startPos; i < lengthDoc; i++) {
if (atStartLine) {
char chBad = static_cast<char>(64);
char chGood = static_cast<char>(0);
char chFlags = chGood;
if (whingeLevel == 1) {
chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
} else if (whingeLevel == 2) {
chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood;
} else if (whingeLevel == 3) {
chFlags = (spaceFlags & wsSpace) ? chBad : chGood;
} else if (whingeLevel == 4) {
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
}
styler.SetFlags(chFlags, static_cast<char>(state));
atStartLine = false;
}
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
char chNext2 = styler.SafeGetCharAt(i + 2);
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) {
// Perform colourisation of white space and triple quoted strings at end of each line to allow
// tab marking to work inside white space and triple quoted strings
styler.ColourTo(i, state);
}
atStartLine = true;
}
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
chPrev2 = ' ';
i += 1;
continue;
}
if (state == SCE_P_STRINGEOL) {
if (ch != '\r' && ch != '\n') {
styler.ColourTo(i - 1, state);
state = SCE_P_DEFAULT;
}
}
if (state == SCE_P_DEFAULT) {
if (IsRbWordStart(ch, chNext, chNext2)) {
styler.ColourTo(i - 1, state);
state = SCE_P_WORD;
} else if (ch == '#') {
styler.ColourTo(i - 1, state);
state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
} else if (ch == '=' && chNext == 'b') {
// =begin indicates the start of a comment (doc) block
if(styler.SafeGetCharAt(i + 2) == 'e' && styler.SafeGetCharAt(i + 3) == 'g' && styler.SafeGetCharAt(i + 4) == 'i' && styler.SafeGetCharAt(i + 5) == 'n') {
styler.ColourTo(i - 1, state);
state = SCE_P_TRIPLEDOUBLE; //SCE_C_COMMENT;
}
} else if (IsRbStringStart(ch, chNext, chNext2)) {
styler.ColourTo(i - 1, state);
state = GetRbStringState(styler, i, &nextIndex);
if (nextIndex != i + 1) {
i = nextIndex - 1;
ch = ' ';
chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (isoperator(ch)) {
styler.ColourTo(i - 1, state);
styler.ColourTo(i, SCE_P_OPERATOR);
}
} else if (state == SCE_P_WORD) {
if (!iswordchar(ch)) {
ClassifyWordRb(styler.GetStartSegment(), i - 1, keywords, styler, prevWord);
state = SCE_P_DEFAULT;
if (ch == '#') {
state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
} else if (IsRbStringStart(ch, chNext, chNext2)) {
styler.ColourTo(i - 1, state);
state = GetRbStringState(styler, i, &nextIndex);
if (nextIndex != i + 1) {
i = nextIndex - 1;
ch = ' ';
chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_P_OPERATOR);
}
}
} else {
if (state == SCE_P_COMMENTLINE || state == SCE_P_COMMENTBLOCK) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i - 1, state);
state = SCE_P_DEFAULT;
}
} else if (state == SCE_P_STRING) {
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
styler.ColourTo(i - 1, state);
state = SCE_P_STRINGEOL;
} else if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\"') {
styler.ColourTo(i, state);
state = SCE_P_DEFAULT;
}
} else if (state == SCE_P_CHARACTER) {
if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
styler.ColourTo(i - 1, state);
state = SCE_P_STRINGEOL;
} else if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '\'') {
styler.ColourTo(i, state);
state = SCE_P_DEFAULT;
}
} else if (state == SCE_P_TRIPLE) {
if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') {
styler.ColourTo(i, state);
state = SCE_P_DEFAULT;
}
} else if (state == SCE_P_TRIPLEDOUBLE) {
// =end terminates the comment block
if (ch == 'd' && chPrev == 'n' && chPrev2 == 'e') {
if (styler.SafeGetCharAt(i - 3) == '=') {
styler.ColourTo(i, state);
state = SCE_P_DEFAULT;
}
}
}
}
chPrev2 = chPrev;
chPrev = ch;
}
if (state == SCE_P_WORD) {
ClassifyWordRb(styler.GetStartSegment(), lengthDoc, keywords, styler, prevWord);
} else {
styler.ColourTo(lengthDoc, state);
}
}
static void FoldRbDoc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) {
int lengthDoc = startPos + length;
// Backtrack to previous line in case need to fix its fold status
int lineCurrent = styler.GetLine(startPos);
if (startPos > 0) {
if (lineCurrent > 0) {
lineCurrent--;
startPos = styler.LineStart(lineCurrent);
if (startPos == 0)
initStyle = SCE_P_DEFAULT;
else
initStyle = styler.StyleAt(startPos-1);
}
}
int state = initStyle & 31;
int spaceFlags = 0;
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsRbComment);
if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
indentCurrent |= SC_FOLDLEVELWHITEFLAG;
char chNext = styler[startPos];
for (int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styler.StyleAt(i) & 31;
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
int lev = indentCurrent;
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsRbComment);
if ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE))
indentNext |= SC_FOLDLEVELWHITEFLAG;
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
// Only non whitespace lines can be headers
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
lev |= SC_FOLDLEVELHEADERFLAG;
} else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
// Line after is blank so check the next - maybe should continue further?
int spaceFlags2 = 0;
int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsRbComment);
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
lev |= SC_FOLDLEVELHEADERFLAG;
}
}
}
indentCurrent = indentNext;
styler.SetLevel(lineCurrent, lev);
lineCurrent++;
}
}
}
LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc);

View File

@@ -1,13 +1,15 @@
// SciTE - Scintilla based Text Editor
// LexSQL.cxx - lexer for SQL
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// Scintilla source code edit control
/** @file LexSQL.cxx
** Lexer for SQL.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
@@ -38,7 +40,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
int initStyle, WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
bool fold = styler.GetPropertyInt("fold");
@@ -153,4 +155,4 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
styler.ColourTo(lengthDoc - 1, state);
}
LexerModule lmSQL(SCLEX_SQL, ColouriseSQLDoc);
LexerModule lmSQL(SCLEX_SQL, ColouriseSQLDoc, "sql");

View File

@@ -1,13 +1,15 @@
// SciTE - Scintilla based Text Editor
// LexVB.cxx - lexer for Visual Basic and VBScript
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// Scintilla source code edit control
/** @file LexVB.cxx
** Lexer for Visual Basic and VBScript.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
@@ -43,11 +45,15 @@ static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywor
return SCE_C_DEFAULT;
}
static bool IsVBComment(Accessor &styler, int pos, int len) {
return len>0 && styler[pos]=='\'';
}
static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
int visibleChars = 0;
@@ -73,7 +79,7 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
}
visibleChars = 0;
}
if (!isspace(ch))
if (!isspacechar(ch))
visibleChars++;
if (state == SCE_C_DEFAULT) {
@@ -136,4 +142,56 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
styler.ColourTo(lengthDoc, state);
}
LexerModule lmVB(SCLEX_VB, ColouriseVBDoc);
static void FoldVBDoc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) {
int lengthDoc = startPos + length;
// Backtrack to previous line in case need to fix its fold status
int lineCurrent = styler.GetLine(startPos);
if (startPos > 0) {
if (lineCurrent > 0) {
lineCurrent--;
startPos = styler.LineStart(lineCurrent);
if (startPos == 0)
initStyle = SCE_P_DEFAULT;
else
initStyle = styler.StyleAt(startPos-1);
}
}
int state = initStyle & 31;
int spaceFlags = 0;
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsVBComment);
if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
indentCurrent |= SC_FOLDLEVELWHITEFLAG;
char chNext = styler[startPos];
for (int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styler.StyleAt(i) & 31;
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
int lev = indentCurrent;
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsVBComment);
if ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE))
indentNext |= SC_FOLDLEVELWHITEFLAG;
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
// Only non whitespace lines can be headers
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
lev |= SC_FOLDLEVELHEADERFLAG;
} else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
// Line after is blank so check the next - maybe should continue further?
int spaceFlags2 = 0;
int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsVBComment);
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
lev |= SC_FOLDLEVELHEADERFLAG;
}
}
}
indentCurrent = indentNext;
styler.SetLevel(lineCurrent, lev);
lineCurrent++;
}
}
}
LexerModule lmVB(SCLEX_VB, ColouriseVBDoc, "vb", FoldVBDoc);

View File

@@ -1,6 +1,8 @@
// Scintilla source code edit control
// LineMarker.cxx - defines the look of a line marker in the margin
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file LineMarker.cxx
** Defines the look of a line marker in the margin .
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include "Platform.h"
@@ -8,13 +10,49 @@
#include "Scintilla.h"
#include "LineMarker.h"
void LineMarker::Draw(Surface *surface, PRectangle &rc) {
static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, Colour fore, Colour back) {
PRectangle rc;
rc.left = centreX - armSize;
rc.top = centreY - armSize;
rc.right = centreX + armSize + 1;
rc.bottom = centreY + armSize + 1;
surface->RectangleDraw(rc, back, fore);
}
static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, Colour fore, Colour back) {
PRectangle rcCircle;
rcCircle.left = centreX - armSize;
rcCircle.top = centreY - armSize;
rcCircle.right = centreX + armSize + 1;
rcCircle.bottom = centreY + armSize + 1;
surface->Ellipse(rcCircle, back, fore);
}
static void DrawPlus(Surface *surface, int centreX, int centreY, int armSize, Colour fore) {
PRectangle rcV(centreX, centreY - armSize + 2, centreX + 1, centreY + armSize - 2 + 1);
surface->FillRectangle(rcV, fore);
PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1);
surface->FillRectangle(rcH, fore);
}
static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, Colour fore) {
PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1);
surface->FillRectangle(rcH, fore);
}
void LineMarker::Draw(Surface *surface, PRectangle &rcWhole) {
// Restrict most shapes a bit
PRectangle rc = rcWhole;
rc.top++;
rc.bottom--;
int minDim = Platform::Minimum(rc.Width(), rc.Height());
minDim--; // Ensure does not go beyond edge
int centreX = (rc.right + rc.left) / 2;
int centreY = (rc.bottom + rc.top) / 2;
int dimOn2 = minDim / 2;
int dimOn4 = minDim / 4;
int blobSize = dimOn2-1;
int armSize = dimOn2-2;
if (rc.Width() > (rc.Height() * 2)) {
// Wide column is line number so move to left to try to avoid overlapping number
centreX = rc.left + dimOn2 + 1;
@@ -50,7 +88,6 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) {
fore.allocated, back.allocated);
} else if (markType == SC_MARK_PLUS) {
int armSize = dimOn2-2;
Point pts[] = {
Point(centreX - armSize, centreY - 1),
Point(centreX - 1, centreY - 1),
@@ -69,7 +106,6 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) {
fore.allocated, back.allocated);
} else if (markType == SC_MARK_MINUS) {
int armSize = dimOn2-2;
Point pts[] = {
Point(centreX - armSize, centreY - 1),
Point(centreX + armSize, centreY -1),
@@ -86,8 +122,114 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) {
rcSmall.right = rc.right - 1;
rcSmall.bottom = rc.bottom - 2;
surface->RectangleDraw(rcSmall, fore.allocated, back.allocated);
} else if (markType == SC_MARK_EMPTY) {
// An invisible marker so don't draw anything
} else if (markType == SC_MARK_VLINE) {
surface->PenColour(back.allocated);
surface->MoveTo(centreX, rcWhole.top);
surface->LineTo(centreX, rcWhole.bottom);
} else if (markType == SC_MARK_LCORNER) {
surface->PenColour(back.allocated);
surface->MoveTo(centreX, rcWhole.top);
surface->LineTo(centreX, rc.top + dimOn2);
surface->LineTo(rc.right - 2, rc.top + dimOn2);
} else if (markType == SC_MARK_TCORNER) {
surface->PenColour(back.allocated);
surface->MoveTo(centreX, rcWhole.top);
surface->LineTo(centreX, rcWhole.bottom);
surface->MoveTo(centreX, rc.top + dimOn2);
surface->LineTo(rc.right - 2, rc.top + dimOn2);
} else if (markType == SC_MARK_LCORNERCURVE) {
surface->PenColour(back.allocated);
surface->MoveTo(centreX, rcWhole.top);
surface->LineTo(centreX, rc.top + dimOn2-3);
surface->LineTo(centreX+3, rc.top + dimOn2);
surface->LineTo(rc.right - 1, rc.top + dimOn2);
} else if (markType == SC_MARK_TCORNERCURVE) {
surface->PenColour(back.allocated);
surface->MoveTo(centreX, rcWhole.top);
surface->LineTo(centreX, rcWhole.bottom);
surface->MoveTo(centreX, rc.top + dimOn2-3);
surface->LineTo(centreX+3, rc.top + dimOn2);
surface->LineTo(rc.right - 1, rc.top + dimOn2);
} else if (markType == SC_MARK_BOXPLUS) {
surface->PenColour(back.allocated);
DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
DrawPlus(surface, centreX, centreY, blobSize, back.allocated);
} else if (markType == SC_MARK_BOXPLUSCONNECTED) {
surface->PenColour(back.allocated);
DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
DrawPlus(surface, centreX, centreY, blobSize, back.allocated);
surface->MoveTo(centreX, centreY + blobSize);
surface->LineTo(centreX, rcWhole.bottom);
surface->MoveTo(centreX, rcWhole.top);
surface->LineTo(centreX, centreY - blobSize);
} else if (markType == SC_MARK_BOXMINUS) {
surface->PenColour(back.allocated);
DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
DrawMinus(surface, centreX, centreY, blobSize, back.allocated);
surface->MoveTo(centreX, centreY + blobSize);
surface->LineTo(centreX, rcWhole.bottom);
} else if (markType == SC_MARK_BOXMINUSCONNECTED) {
surface->PenColour(back.allocated);
DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
DrawMinus(surface, centreX, centreY, blobSize, back.allocated);
surface->MoveTo(centreX, centreY + blobSize);
surface->LineTo(centreX, rcWhole.bottom);
surface->MoveTo(centreX, rcWhole.top);
surface->LineTo(centreX, centreY - blobSize);
} else if (markType == SC_MARK_CIRCLEPLUS) {
DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
surface->PenColour(back.allocated);
DrawPlus(surface, centreX, centreY, blobSize, back.allocated);
} else if (markType == SC_MARK_CIRCLEPLUSCONNECTED) {
DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
surface->PenColour(back.allocated);
DrawPlus(surface, centreX, centreY, blobSize, back.allocated);
surface->MoveTo(centreX, centreY + blobSize);
surface->LineTo(centreX, rcWhole.bottom);
surface->MoveTo(centreX, rcWhole.top);
surface->LineTo(centreX, centreY - blobSize);
} else if (markType == SC_MARK_CIRCLEMINUS) {
DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
surface->PenColour(back.allocated);
DrawMinus(surface, centreX, centreY, blobSize, back.allocated);
surface->MoveTo(centreX, centreY + blobSize);
surface->LineTo(centreX, rcWhole.bottom);
} else if (markType == SC_MARK_CIRCLEMINUSCONNECTED) {
DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
surface->PenColour(back.allocated);
DrawMinus(surface, centreX, centreY, blobSize, back.allocated);
surface->MoveTo(centreX, centreY + blobSize);
surface->LineTo(centreX, rcWhole.bottom);
surface->MoveTo(centreX, rcWhole.top);
surface->LineTo(centreX, centreY - blobSize);
} else { // SC_MARK_SHORTARROW
Point pts[] = {
Point(centreX, centreY + dimOn2),

View File

@@ -1,11 +1,15 @@
// Scintilla source code edit control
// LineMarker.h - defines the look of a line marker in the margin
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file LineMarker.h
** Defines the look of a line marker in the margin .
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef LINEMARKER_H
#define LINEMARKER_H
/**
*/
class LineMarker {
public:
int markType;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,865 @@
// Scintilla source code edit control
/** @file RESearch.cxx
** Regular expression search library.
**/
/*
* regex - Regular expression pattern matching and replacement
*
* By: Ozan S. Yigit (oz)
* Dept. of Computer Science
* York University
*
* 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
* used from multiple threads etc.
*
* These routines are the PUBLIC DOMAIN equivalents of regex
* routines as found in 4.nBSD UN*X, with minor extensions.
*
* These routines are derived from various implementations found
* in software tools books, and Conroy's grep. They are NOT derived
* from licensed/restricted software.
* For more interesting/academic/complicated implementations,
* see Henry Spencer's regexp routines, or GNU Emacs pattern
* matching module.
*
* Modification history:
*
* $Log$
* Revision 1.1 2001/09/01 03:05:24 RD
* Upgraded to version 1.39 of Scintilla, and upated wxStyledTextCtrl
* accordingly.
*
* Revision 1.6 2001/04/29 13:32:10 nyamatongwe
* Addition of new target methods - versions of ReplaceTarget that take counted
* strings to allow for nulls, SearchInTarget and Get/SetSearchFlags to use a
* series of calls rather than a structure.
* Handling of \000 in search and replace.
* Handling of /escapes within character ranges of regular expressions.
* Some handling of bare ^ and $ regular expressions.
*
* Revision 1.5 2001/04/20 07:36:09 nyamatongwe
* Removed DEBUG code that failed to compile on GTK+.
*
* Revision 1.4 2001/04/13 03:52:13 nyamatongwe
* Added URL to find original code to comments.
*
* Revision 1.3 2001/04/06 12:24:21 nyamatongwe
* Made regular expression searching work on a line by line basis, made ^ and
* $ work, made [set] work, and added a case insensitive option.
*
* Revision 1.2 2001/04/05 01:58:04 nyamatongwe
* Replace target functionality to make find and replace operations faster
* by diminishing screen updates and allow for \d patterns in the replacement
* text.
*
* Revision 1.1 2001/04/04 12:52:44 nyamatongwe
* Moved to public domain regular expresion implementation.
*
* Revision 1.4 1991/10/17 03:56:42 oz
* miscellaneous changes, small cleanups etc.
*
* Revision 1.3 1989/04/01 14:18:09 oz
* Change all references to a dfa: this is actually an nfa.
*
* 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
* 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.
*
* char *RESearch::Compile(s)
* char *s;
*
* RESearch::Execute: execute the NFA to match a pattern.
*
* int RESearch::Execute(s)
* char *s;
*
* RESearch::ModifyWord change RESearch::Execute's understanding of what a "word"
* looks like (for \< and \>) by adding into the
* hidden word-syntax table.
*
* void RESearch::ModifyWord(s)
* char *s;
*
* RESearch::Substitute: substitute the matched portions in a new string.
*
* int RESearch::Substitute(src, dst)
* char *src;
* char *dst;
*
* re_fail: failure routine for RESearch::Execute.
*
* void re_fail(msg, op)
* char *msg;
* char op;
*
* Regular Expressions:
*
* [1] char matches itself, unless it is a special
* character (metachar): . \ [ ] * + ^ $
*
* [2] . matches any character.
*
* [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.
* (see [7], [8] and [9])
* 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
* as the first chars in the set.
* examples: match:
*
* [a-z] any lowercase alpha
*
* [^]-] any char except ] and -
*
* [^A-Z] any char except uppercase
* alpha
*
* [a-zA-Z] any alpha
*
* [5] * any regular expression form [1] to [4], followed by
* closure char (*) matches zero or more matches of
* that form.
*
* [6] + same as [5], except it matches one or more.
*
* [7] a regular expression in the form [1] to [10], enclosed
* as \(form\) matches what form matches. The enclosure
* creates a set of tags, used for [8] and for
* pattern substution. The tagged forms are numbered
* starting from 1.
*
* [8] a \ followed by a digit 1 to 9 matches whatever a
* previously tagged regular expression ([7]) matched.
*
* [9] \< a regular expression starting with a \< construct
* \> and/or ending with a \> construct, restricts the
* pattern matching to the beginning of a word, and/or
* the end of a word. A word is defined to be a character
* string beginning and/or ending with the characters
* A-Z a-z 0-9 and _. It must also be preceded and/or
* followed by any character outside those mentioned.
*
* [10] a composite regular expression xy where x and y
* are in the form [1] to [10] matches the longest
* match of x followed by a match for y.
*
* [11] ^ a regular expression starting with a ^ character
* $ and/or ending with a $ character, restricts the
* pattern matching to the beginning of the line,
* or the end of line. [anchors] Elsewhere in the
* pattern, ^ and $ are treated as ordinary characters.
*
*
* Acknowledgements:
*
* HCR's Hugh Redelmeier has been most helpful in various
* stages of development. He convinced me to include BOW
* and EOW constructs, originally invented by Rob Pike at
* the University of Toronto.
*
* References:
* Software tools Kernighan & Plauger
* Software tools in Pascal Kernighan & Plauger
* Grep [rsx-11 C dist] David Conroy
* ed - text editor Un*x Programmer's Manual
* Advanced editing on Un*x B. W. Kernighan
* RegExp routines Henry Spencer
*
* 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
* constant 16 bytes in the internal nfa, and RESearch::Execute does a single
* bit comparison to locate the character in the set.
*
* Examples:
*
* pattern: foo*.*
* 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]
* compile: CHR f CHR o CCL bitset CHR a CCL bitset END
* matches: fobar fooar fobaz fooaz
*
* pattern: foo\\+
* compile: CHR f CHR o CHR o CHR \ CLO CHR \ END END
* matches: foo\ foo\\ foo\\\ ...
*
* pattern: \(foo\)[1-3]\1 (same as foo[1-3]foo)
* compile: BOT 1 CHR f CHR o CHR o EOT 1 CCL bitset REF 1 END
* matches: foo1foo foo2foo foo3foo
*
* pattern: \(fo.*\)-\1
* compile: BOT 1 CHR f CHR o CLO ANY END EOT 1 CHR - REF 1 END
* matches: foo-foo fo-fo fob-fob foobar-foobar ...
*/
#include "RESearch.h"
#define OKP 1
#define NOP 0
#define CHR 1
#define ANY 2
#define CCL 3
#define BOL 4
#define EOL 5
#define BOT 6
#define EOT 7
#define BOW 8
#define EOW 9
#define REF 10
#define CLO 11
#define END 0
/*
* The following defines are not meant to be changeable.
* They are for readability only.
*/
#define BLKIND 0170
#define BITIND 07
#define ASCIIB 0177
const char bitarr[] = {1,2,4,8,16,32,64,'\200'};
#define badpat(x) (*nfa = END, x)
RESearch::RESearch() {
Init();
}
RESearch::~RESearch() {
Clear();
}
void RESearch::Init() {
sta = NOP; /* status of lastpat */
bol = 0;
for (int i=0; i<MAXTAG; i++)
pat[i] = 0;
for (int j=0; j<BITBLK; j++)
bittab[j] = 0;
}
void RESearch::Clear() {
for (int i=0; i<MAXTAG; i++) {
delete []pat[i];
pat[i] = 0;
bopat[i] = NOTFOUND;
eopat[i] = NOTFOUND;
}
}
bool RESearch::GrabMatches(CharacterIndexer &ci) {
bool success = true;
for (unsigned int i=0; i<MAXTAG; i++) {
if ((bopat[i] != NOTFOUND) && (eopat[i] != NOTFOUND)) {
unsigned int len = eopat[i] - bopat[i];
pat[i] = new char[len + 1];
if (pat[i]) {
for (unsigned int j=0; j<len; j++)
pat[i][j] = ci.CharAt(bopat[i] + j);
pat[i][len] = '\0';
} else {
success = false;
}
}
}
return success;
}
void RESearch::ChSet(char c) {
bittab[((c) & BLKIND) >> 3] |= bitarr[(c) & BITIND];
}
void RESearch::ChSetWithCase(char c, bool caseSensitive) {
if (caseSensitive) {
ChSet(c);
} else {
if ((c >= 'a') && (c <= 'z')) {
ChSet(c);
ChSet(static_cast<char>(c - 'a' + 'A'));
} else if ((c >= 'A') && (c <= 'Z')) {
ChSet(c);
ChSet(static_cast<char>(c - 'A' + 'a'));
} else {
ChSet(c);
}
}
}
const char escapeValue(char ch) {
switch (ch) {
case 'a': return '\a';
case 'b': return '\b';
case 'f': return '\f';
case 'n': return '\n';
case 'r': return '\r';
case 't': return '\t';
case 'v': return '\v';
}
return 0;
}
const char *RESearch::Compile(const char *pat, int length, bool caseSensitive) {
char *mp=nfa; /* nfa pointer */
char *lp; /* saved pointer.. */
char *sp=nfa; /* another one.. */
int tagi = 0; /* tag stack index */
int tagc = 1; /* actual tag count */
int n;
char mask; /* xor mask -CCL/NCL */
int c1, c2;
if (!pat || !length)
if (sta)
return 0;
else
return badpat("No previous regular expression");
sta = NOP;
const char *p=pat; /* pattern pointer */
for (int i=0; i<length; i++, p++) {
lp = mp;
switch(*p) {
case '.': /* match any char.. */
*mp++ = ANY;
break;
case '^': /* match beginning.. */
if (p == pat)
*mp++ = BOL;
else {
*mp++ = CHR;
*mp++ = *p;
}
break;
case '$': /* match endofline.. */
if (!*(p+1))
*mp++ = EOL;
else {
*mp++ = CHR;
*mp++ = *p;
}
break;
case '[': /* match char class..*/
*mp++ = CCL;
i++;
if (*++p == '^') {
mask = '\377';
i++;
p++;
} else
mask = 0;
if (*p == '-') { /* real dash */
i++;
ChSet(*p++);
}
if (*p == ']') { /* real brace */
i++;
ChSet(*p++);
}
while (*p && *p != ']') {
if (*p == '-' && *(p+1) && *(p+1) != ']') {
i++;
p++;
c1 = *(p-2) + 1;
i++;
c2 = *p++;
while (c1 <= c2) {
ChSetWithCase(static_cast<char>(c1++), caseSensitive);
}
} else if (*p == '\\' && *(p+1)) {
i++;
p++;
char escape = escapeValue(*p);
if (escape)
ChSetWithCase(escape, caseSensitive);
else
ChSetWithCase(*p, caseSensitive);
i++;
p++;
} else {
i++;
ChSetWithCase(*p++, caseSensitive);
}
}
if (!*p)
return badpat("Missing ]");
for (n = 0; n < BITBLK; bittab[n++] = (char) 0)
*mp++ = static_cast<char>(mask ^ bittab[n]);
break;
case '*': /* match 0 or more.. */
case '+': /* match 1 or more.. */
if (p == pat)
return badpat("Empty closure");
lp = sp; /* previous opcode */
if (*lp == CLO) /* equivalence.. */
break;
switch(*lp) {
case BOL:
case BOT:
case EOT:
case BOW:
case EOW:
case REF:
return badpat("Illegal closure");
default:
break;
}
if (*p == '+')
for (sp = mp; lp < sp; lp++)
*mp++ = *lp;
*mp++ = END;
*mp++ = END;
sp = mp;
while (--mp > lp)
*mp = mp[-1];
*mp = CLO;
mp = sp;
break;
case '\\': /* tags, backrefs .. */
i++;
switch(*++p) {
case '(':
if (tagc < MAXTAG) {
tagstk[++tagi] = tagc;
*mp++ = BOT;
*mp++ = static_cast<char>(tagc++);
}
else
return badpat("Too many \\(\\) pairs");
break;
case ')':
if (*sp == BOT)
return badpat("Null pattern inside \\(\\)");
if (tagi > 0) {
*mp++ = static_cast<char>(EOT);
*mp++ = static_cast<char>(tagstk[tagi--]);
}
else
return badpat("Unmatched \\)");
break;
case '<':
*mp++ = BOW;
break;
case '>':
if (*sp == BOW)
return badpat("Null pattern inside \\<\\>");
*mp++ = EOW;
break;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
n = *p-'0';
if (tagi > 0 && tagstk[tagi] == n)
return badpat("Cyclical reference");
if (tagc > n) {
*mp++ = static_cast<char>(REF);
*mp++ = static_cast<char>(n);
}
else
return badpat("Undetermined reference");
break;
case 'a':
case 'b':
case 'n':
case 'f':
case 'r':
case 't':
case 'v':
*mp++ = CHR;
*mp++ = escapeValue(*p);
break;
default:
*mp++ = CHR;
*mp++ = *p;
}
break;
default : /* an ordinary char */
if (caseSensitive) {
*mp++ = CHR;
*mp++ = *p;
} else {
*mp++ = CCL;
mask = 0;
ChSetWithCase(*p, false);
for (n = 0; n < BITBLK; bittab[n++] = (char) 0)
*mp++ = static_cast<char>(mask ^ bittab[n]);
}
break;
}
sp = lp;
}
if (tagi > 0)
return badpat("Unmatched \\(");
*mp = END;
sta = OKP;
return 0;
}
/*
* RESearch::Execute:
* execute nfa to find a match.
*
* special cases: (nfa[0])
* BOL
* Match only once, starting from the
* beginning.
* CHR
* First locate the character without
* calling PMatch, and if found, call
* PMatch for the remaining string.
* END
* RESearch::Compile failed, poor luser did not
* check for it. Fail fast.
*
* If a match is found, bopat[0] and eopat[0] are set
* to the beginning and the end of the matched fragment,
* respectively.
*
*/
int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
char c;
int ep = NOTFOUND;
char *ap = nfa;
bol = lp;
failure = 0;
Clear();
switch(*ap) {
case BOL: /* anchored: match from BOL only */
ep = PMatch(ci, lp, endp, ap);
break;
case EOL: /* just searching for end of line normal path doesn't work */
if (*(ap+1) == END) {
lp = endp;
ep = lp;
break;
} else {
return 0;
}
case CHR: /* ordinary char: locate it fast */
c = *(ap+1);
while ((lp < endp) && (ci.CharAt(lp) != c))
lp++;
if (lp >= endp) /* if EOS, fail, else fall thru. */
return 0;
default: /* regular matching all the way. */
while (lp < endp) {
ep = PMatch(ci, lp, endp, ap);
if (ep != NOTFOUND)
break;
lp++;
}
break;
case END: /* munged automaton. fail always */
return 0;
}
if (ep == NOTFOUND)
return 0;
bopat[0] = lp;
eopat[0] = ep;
return 1;
}
/*
* PMatch: internal routine for the hard part
*
* This code is partly snarfed from an early grep written by
* David Conroy. The backref and tag stuff, and various other
* innovations are by oz.
*
* special case optimizations: (nfa[n], nfa[n+1])
* CLO ANY
* We KNOW .* will match everything upto the
* end of line. Thus, directly go to the end of
* line, without recursive PMatch calls. As in
* the other closure cases, the remaining pattern
* must be matched by moving backwards on the
* string recursively, to find a match for xy
* (x is ".*" and y is the remaining pattern)
* where the match satisfies the LONGEST match for
* x followed by a match for y.
* CLO CHR
* We can again scan the string forward for the
* single char and at the point of failure, we
* execute the remaining nfa recursively, same as
* above.
*
* 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).
*
*/
extern void re_fail(char *,char);
/*
* character classification table for word boundary operators BOW
* 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.
*
* 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,
1, 1, 1, 0, 0, 0, 0, 0
};
#define inascii(x) (0177&(x))
#define iswordc(x) chrtyp[inascii(x)]
#define isinset(x,y) ((x)[((y)&BLKIND)>>3] & bitarr[(y)&BITIND])
/*
* skip values for CLO XXX to skip past the closure
*/
#define ANYSKIP 2 /* [CLO] ANY END ... */
#define CHRSKIP 3 /* [CLO] CHR chr END ... */
#define CCLSKIP 18 /* [CLO] CCL 16bytes END ... */
int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
int op, c, n;
int e; /* extra pointer for CLO */
int bp; /* beginning of subpat.. */
int ep; /* ending of subpat.. */
int are; /* to save the line ptr. */
while ((op = *ap++) != END)
switch(op) {
case CHR:
if (ci.CharAt(lp++) != *ap++)
return NOTFOUND;
break;
case ANY:
if (lp++ >= endp)
return NOTFOUND;
break;
case CCL:
c = ci.CharAt(lp++);
if (!isinset(ap,c))
return NOTFOUND;
ap += BITBLK;
break;
case BOL:
if (lp != bol)
return NOTFOUND;
break;
case EOL:
if (lp < endp)
return NOTFOUND;
break;
case BOT:
bopat[*ap++] = lp;
break;
case EOT:
eopat[*ap++] = lp;
break;
case BOW:
if (lp!=bol && iswordc(ci.CharAt(lp-1)) || !iswordc(ci.CharAt(lp)))
return NOTFOUND;
break;
case EOW:
if (lp==bol || !iswordc(ci.CharAt(lp-1)) || iswordc(ci.CharAt(lp)))
return NOTFOUND;
break;
case REF:
n = *ap++;
bp = bopat[n];
ep = eopat[n];
while (bp < ep)
if (ci.CharAt(bp++) != ci.CharAt(lp++))
return NOTFOUND;
break;
case CLO:
are = lp;
switch(*ap) {
case ANY:
while (lp < endp)
lp++;
n = ANYSKIP;
break;
case CHR:
c = *(ap+1);
while ((lp < endp) && (c == ci.CharAt(lp)))
lp++;
n = CHRSKIP;
break;
case CCL:
while ((lp < endp) && isinset(ap+1,ci.CharAt(lp)))
lp++;
n = CCLSKIP;
break;
default:
failure = true;
//re_fail("closure: bad nfa.", *ap);
return NOTFOUND;
}
ap += n;
while (lp >= are) {
if ((e = PMatch(ci, lp, endp, ap)) != NOTFOUND)
return e;
--lp;
}
return NOTFOUND;
default:
//re_fail("RESearch::Execute: bad nfa.", static_cast<char>(op));
return NOTFOUND;
}
return lp;
}
/*
* RESearch::ModifyWord:
* add new characters into the word table to change RESearch::Execute's
* understanding of what a word should look like. Note that we
* only accept additions into the word definition.
*
* If the string parameter is 0 or null string, the table is
* reset back to the default containing A-Z a-z 0-9 _. [We use
* 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
};
void RESearch::ModifyWord(char *s) {
int i;
if (!s || !*s) {
for (i = 0; i < MAXCHR; i++)
if (!isinset(deftab,i))
iswordc(i) = 0;
}
else
while(*s)
iswordc(*s++) = 1;
}
/*
* RESearch::Substitute:
* substitute the matched portions of the src in dst.
*
* & substitute the entire matched pattern.
*
* \digit substitute a subpattern, with the given tag number.
* Tags are numbered from 1 to 9. If the particular
* tagged subpattern does not exist, null is substituted.
*/
int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst) {
char c;
int pin;
int bp;
int ep;
if (!*src || !bopat[0])
return 0;
while ((c = *src++) != 0) {
switch(c) {
case '&':
pin = 0;
break;
case '\\':
c = *src++;
if (c >= '0' && c <= '9') {
pin = c - '0';
break;
}
default:
*dst++ = c;
continue;
}
if ((bp = bopat[pin]) != 0 && (ep = eopat[pin]) != 0) {
while (ci.CharAt(bp) && bp < ep)
*dst++ = ci.CharAt(bp++);
if (bp < ep)
return 0;
}
}
*dst = (char) 0;
return 1;
}

View File

@@ -0,0 +1,60 @@
// Scintilla source code edit control
/** @file RESearch.h
** Interface to the regular expression search library.
**/
// Written by Neil Hodgson <neilh@scintilla.org>
// Based on the work of Ozan S. Yigit.
// This file is in the public domain.
#ifndef RESEARCH_H
#define RESEARCH_H
/*
* The following defines are not meant to be changeable.
* They are for readability only.
*/
#define MAXCHR 128
#define CHRBIT 8
#define BITBLK MAXCHR/CHRBIT
class CharacterIndexer {
public:
virtual char CharAt(int index)=0;
};
class RESearch {
public:
RESearch();
~RESearch();
void Init();
void Clear();
bool GrabMatches(CharacterIndexer &ci);
void ChSet(char c);
void ChSetWithCase(char c, bool caseSensitive);
const char *Compile(const char *pat, int length, bool caseSensitive);
int Execute(CharacterIndexer &ci, int lp, int endp);
void ModifyWord(char *s);
int Substitute(CharacterIndexer &ci, char *src, char *dst);
enum {MAXTAG=10};
enum {MAXNFA=2048};
enum {NOTFOUND=-1};
int bopat[MAXTAG];
int eopat[MAXTAG];
char *pat[MAXTAG];
private:
int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
int bol;
int tagstk[MAXTAG]; /* subpat tag stack..*/
char nfa[MAXNFA]; /* automaton.. */
int sta;
char bittab[BITBLK]; /* bit table for CCL */
/* pre-set bits... */
int failure;
};
#endif

View File

@@ -1,26 +1,31 @@
// Scintilla source code edit control
// SVector.h - a simple expandable vector
// Copyright 1998-1999 by Neil Hodgson <neilh@hare.net.au>
/** @file SVector.h
** A simple expandable vector.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@hare.net.au>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef SVECTOR_H
#define SVECTOR_H
// A simple expandable integer vector.
// Storage not allocated for elements until an element is used.
// This makes it very lightweight unless used so is a good match for optional features.
/**
* A simple expandable integer vector.
* Storage not allocated for elements until an element is used.
* This makes it very lightweight unless used so is a good match for optional features.
*/
class SVector {
int *v;
unsigned int size; // Number of elements allocated
unsigned int len; // Number of elements in vector
bool allocFailure; // A memory allocation call has failed
enum { allocSize = 4000 };
// Internally allocate more elements than the user wants to avoid
// thrashng the memory allocator
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 < 4000)
newSize += 4000;
if (newSize < allocSize)
newSize += allocSize;
else
newSize = (newSize * 3) / 2;
int* newv = new int[newSize];
@@ -50,6 +55,7 @@ public:
~SVector() {
Free();
}
/// Constructor from another vector.
SVector(const SVector &other) {
allocFailure = false;
v = 0;
@@ -64,6 +70,7 @@ public:
}
}
}
/// Copy constructor.
SVector &operator=(const SVector &other) {
if (this != &other) {
delete []v;
@@ -82,6 +89,9 @@ public:
}
return *this;
}
/** @brief Accessor.
* Allows to access values from the list, and grows it if accessing
* outside the current bounds. The returned value in this case is 0. */
int &operator[](unsigned int i) {
if (i >= len) {
if (i >= size) {
@@ -91,12 +101,15 @@ public:
}
return v[i];
}
/// Reset vector.
void Free() {
delete []v;
v = 0;
size = 0;
len = 0;
}
/** @brief Grow vector size.
* Doesn't allow a vector to be shrinked. */
void SetLength(unsigned int newLength) {
if (newLength > len) {
if (newLength >= size) {
@@ -105,6 +118,7 @@ public:
}
len = newLength;
}
/// Get the current length (number of used elements) of the vector.
int Length() const {
return len;
}

View File

@@ -1,6 +1,8 @@
// Scintilla source code edit control
// ScintillaBase.cxx - an enhanced subclass of Editor with calltips, autocomplete and context menu
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file ScintillaBase.cxx
** An enhanced subclass of Editor with calltips, autocomplete and context menu.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
@@ -15,7 +17,6 @@
#ifdef SCI_LEXER
#include "SciLexer.h"
#include "Accessor.h"
#include "WindowAccessor.h"
#include "DocumentAccessor.h"
#include "KeyWords.h"
#endif
@@ -34,22 +35,25 @@
#include "ScintillaBase.h"
ScintillaBase::ScintillaBase() {
#ifdef SCI_LEXER
listType = 0;
#ifdef SCI_LEXER
lexLanguage = SCLEX_CONTAINER;
for (int wl=0;wl<numWordLists;wl++)
lexCurrent = 0;
for (int wl = 0;wl < numWordLists;wl++)
keyWordLists[wl] = new WordList;
keyWordLists[numWordLists] = 0;
#endif
}
ScintillaBase::~ScintillaBase() {
#ifdef SCI_LEXER
for (int wl=0;wl<numWordLists;wl++)
#ifdef SCI_LEXER
for (int wl = 0;wl < numWordLists;wl++)
delete keyWordLists[wl];
#endif
}
void ScintillaBase::Finalise() {
Editor::Finalise();
Editor::Finalise();
popup.Destroy();
}
@@ -70,10 +74,12 @@ void ScintillaBase::Command(int cmdId) {
switch (cmdId) {
case idAutoComplete: // Nothing to do
case idAutoComplete: // Nothing to do
break;
case idCallTip: // Nothing to do
case idCallTip: // Nothing to do
break;
case idcmdUndo:
@@ -170,7 +176,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
//Platform::DebugPrintf("AutoComplete %s\n", list);
ct.CallTipCancel();
if (ac.chooseSingle) {
if (ac.chooseSingle && (listType == 0)) {
if (list && !strchr(list, ac.GetSeparator())) {
if (ac.ignoreCase) {
SetEmptySelection(currentPos - lenEntered);
@@ -183,13 +189,13 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
pdoc->InsertString(currentPos, list + lenEntered);
SetEmptySelection(currentPos + strlen(list + lenEntered));
}
return;
return ;
}
}
ac.Start(wDraw, idAutoComplete, currentPos, lenEntered);
ac.Start(wMain, idAutoComplete, currentPos, lenEntered);
PRectangle rcClient = GetClientRectangle();
Point pt = LocationFromPosition(currentPos-lenEntered);
Point pt = LocationFromPosition(currentPos - lenEntered);
int heightLB = 100;
int widthLB = 100;
@@ -200,8 +206,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
}
PRectangle rcac;
rcac.left = pt.x - 5;
if (pt.y >= rcClient.bottom - heightLB && // Wont fit below.
pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.
if (pt.y >= rcClient.bottom - heightLB && // Wont fit below.
pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.
rcac.top = pt.y - heightLB;
if (rcac.top < 0) {
heightLB += rcac.top;
@@ -225,8 +231,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
// Make an allowance for large strings in list
rcList.left = pt.x - 5;
rcList.right = rcList.left + widthLB;
if (pt.y >= rcClient.bottom - heightLB && // Wont fit below.
pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.
if (pt.y >= rcClient.bottom - heightLB && // Wont fit below.
pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.
rcList.top = pt.y - heightAlloced;
} else {
rcList.top = pt.y + vs.lineHeight;
@@ -236,7 +242,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
ac.Show();
if (lenEntered != 0) {
AutoCompleteMoveToCurrentWord();
}
}
}
void ScintillaBase::AutoCompleteCancel() {
@@ -278,44 +284,45 @@ void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) {
ac.lb.GetValue(item, selected, sizeof(selected));
}
ac.Cancel();
if (ac.ignoreCase) {
if (currentPos != ac.posStart) {
pdoc->DeleteChars(ac.posStart, currentPos - ac.posStart);
}
SetEmptySelection(ac.posStart - ac.startLen);
pdoc->DeleteChars(ac.posStart - ac.startLen, ac.startLen);
if (item != -1) {
SString piece = selected;
if (fillUp)
piece += fillUp;
pdoc->InsertString(currentPos, piece.c_str());
SetEmptySelection(currentPos + piece.length());
}
} else {
if (currentPos != ac.posStart) {
pdoc->DeleteChars(ac.posStart, currentPos - ac.posStart);
}
SetEmptySelection(ac.posStart);
if (item != -1) {
SString piece = selected + ac.startLen;
if (fillUp)
piece += fillUp;
pdoc->InsertString(currentPos, piece.c_str());
SetEmptySelection(currentPos + piece.length());
}
if (listType > 0) {
userListSelected = selected;
SCNotification scn;
scn.nmhdr.code = SCN_USERLISTSELECTION;
scn.message = 0;
scn.wParam = listType;
scn.lParam = 0;
scn.text = userListSelected.c_str();
NotifyParent(scn);
return ;
}
Position firstPos = ac.posStart - ac.startLen;
if (currentPos < firstPos)
return ;
if (currentPos != firstPos) {
pdoc->DeleteChars(firstPos, currentPos - firstPos);
}
SetEmptySelection(ac.posStart);
if (item != -1) {
SString piece = selected;
if (fillUp)
piece += fillUp;
pdoc->InsertString(firstPos, piece.c_str());
SetEmptySelection(firstPos + piece.length());
}
}
void ScintillaBase::ContextMenu(Point pt) {
bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
popup.CreatePopUp();
AddToPopUp("Undo", idcmdUndo, pdoc->CanUndo());
AddToPopUp("Redo", idcmdRedo, pdoc->CanRedo());
AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo());
AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo());
AddToPopUp("");
AddToPopUp("Cut", idcmdCut, currentPos != anchor);
AddToPopUp("Cut", idcmdCut, writable && currentPos != anchor);
AddToPopUp("Copy", idcmdCopy, currentPos != anchor);
AddToPopUp("Paste", idcmdPaste, WndProc(SCI_CANPASTE, 0, 0));
AddToPopUp("Delete", idcmdDelete, currentPos != anchor);
AddToPopUp("Paste", idcmdPaste, writable && WndProc(SCI_CANPASTE, 0, 0));
AddToPopUp("Delete", idcmdDelete, writable && currentPos != anchor);
AddToPopUp("");
AddToPopUp("Select All", idcmdSelectAll);
popup.Show(pt, wMain);
@@ -333,41 +340,67 @@ void ScintillaBase::ButtonDown(Point pt, unsigned int curTime, bool shift, bool
}
#ifdef SCI_LEXER
void ScintillaBase::SetLexer(uptr_t wParam) {
lexLanguage = wParam;
lexCurrent = LexerModule::Find(lexLanguage);
if (!lexCurrent)
lexCurrent = LexerModule::Find(SCLEX_NULL);
}
void ScintillaBase::SetLexerLanguage(const char *languageName) {
lexLanguage = SCLEX_CONTAINER;
lexCurrent = LexerModule::Find(languageName);
if (!lexCurrent)
lexCurrent = LexerModule::Find(SCLEX_NULL);
if (lexCurrent)
lexLanguage = lexCurrent->GetLanguage();
}
void ScintillaBase::Colourise(int start, int end) {
int lengthDoc = Platform::SendScintilla(wMain.GetID(), SCI_GETLENGTH, 0, 0);
int lengthDoc = pdoc->Length();
if (end == -1)
end = lengthDoc;
int len = end - start;
PLATFORM_ASSERT(len >= 0);
PLATFORM_ASSERT(start + len <= lengthDoc);
//WindowAccessor styler(wMain.GetID(), props);
DocumentAccessor styler(pdoc, props);
DocumentAccessor styler(pdoc, props, wMain.GetID());
int styleStart = 0;
if (start > 0)
styleStart = styler.StyleAt(start - 1);
styler.SetCodePage(pdoc->dbcsCodePage);
LexerModule::Colourise(start, len, styleStart, lexLanguage, keyWordLists, styler);
styler.Flush();
if (lexCurrent) { // Should always succeed as null lexer should always be available
lexCurrent->Lex(start, len, styleStart, keyWordLists, styler);
styler.Flush();
if (styler.GetPropertyInt("fold")) {
lexCurrent->Fold(start, len, styleStart, keyWordLists, styler);
styler.Flush();
}
}
}
#endif
void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) {
#ifdef SCI_LEXER
if (lexLanguage != SCLEX_CONTAINER) {
int endStyled = Platform::SendScintilla(wMain.GetID(), SCI_GETENDSTYLED, 0, 0);
int lineEndStyled = Platform::SendScintilla(wMain.GetID(), SCI_LINEFROMPOSITION, endStyled, 0);
endStyled = Platform::SendScintilla(wMain.GetID(), SCI_POSITIONFROMLINE, lineEndStyled, 0);
int endStyled = WndProc(SCI_GETENDSTYLED, 0, 0);
int lineEndStyled = WndProc(SCI_LINEFROMPOSITION, endStyled, 0);
endStyled = WndProc(SCI_POSITIONFROMLINE, lineEndStyled, 0);
Colourise(endStyled, endStyleNeeded);
return;
return ;
}
#endif
Editor::NotifyStyleToNeeded(endStyleNeeded);
}
long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
switch (iMessage) {
case SCI_AUTOCSHOW:
listType = 0;
AutoCompleteStart(wParam, reinterpret_cast<const char *>(lParam));
break;
@@ -395,15 +428,15 @@ long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lP
case SCI_AUTOCSTOPS:
ac.SetStopChars(reinterpret_cast<char *>(lParam));
break;
case SCI_AUTOCSELECT:
ac.Select(reinterpret_cast<char *>(lParam));
break;
case SCI_AUTOCSETCANCELATSTART:
ac.cancelAtStartPos = wParam;
break;
case SCI_AUTOCGETCANCELATSTART:
return ac.cancelAtStartPos;
@@ -417,20 +450,35 @@ long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lP
case SCI_AUTOCGETCHOOSESINGLE:
return ac.chooseSingle;
case SCI_AUTOCSETIGNORECASE:
ac.ignoreCase = wParam;
break;
case SCI_AUTOCGETIGNORECASE:
return ac.ignoreCase;
case SCI_USERLISTSHOW:
listType = wParam;
AutoCompleteStart(0, reinterpret_cast<const char *>(lParam));
break;
case SCI_AUTOCSETAUTOHIDE:
ac.autoHide = wParam;
break;
case SCI_AUTOCGETAUTOHIDE:
return ac.autoHide;
case SCI_CALLTIPSHOW: {
AutoCompleteCancel();
if (!ct.wCallTip.Created()) {
PRectangle rc = ct.CallTipStart(currentPos, LocationFromPosition(wParam),
Point pt = LocationFromPosition(wParam);
pt.y += vs.lineHeight;
PRectangle rc = ct.CallTipStart(currentPos, pt,
reinterpret_cast<char *>(lParam),
vs.styles[STYLE_DEFAULT].fontName, vs.styles[STYLE_DEFAULT].size);
vs.styles[STYLE_DEFAULT].fontName,
vs.styles[STYLE_DEFAULT].sizeZoomed);
// If the call-tip window would be out of the client
// space, adjust so it displays above the text.
PRectangle rcClient = GetClientRectangle();
@@ -441,7 +489,7 @@ long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lP
}
// Now display the window.
CreateCallTipWindow(rc);
ct.wCallTip.SetPositionRelative(rc, wDraw);
ct.wCallTip.SetPositionRelative(rc, wMain);
ct.wCallTip.Show();
}
}
@@ -465,31 +513,37 @@ long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lP
ct.colourBG = Colour(wParam);
InvalidateStyleRedraw();
break;
#ifdef SCI_LEXER
case SCI_SETLEXER:
SetLexer(wParam);
lexLanguage = wParam;
break;
case SCI_GETLEXER:
return lexLanguage;
case SCI_COLOURISE:
Colourise(wParam, lParam);
Redraw();
break;
case SCI_SETPROPERTY:
props.Set(reinterpret_cast<const char *>(wParam),
reinterpret_cast<const char *>(lParam));
props.Set(reinterpret_cast<const char *>(wParam),
reinterpret_cast<const char *>(lParam));
break;
case SCI_SETKEYWORDS:
if (wParam < numWordLists) {
keyWordLists[wParam]->Clear();
keyWordLists[wParam]->Set(reinterpret_cast<const char *>(lParam));
}
break;
case SCI_SETLEXERLANGUAGE:
SetLexerLanguage(reinterpret_cast<const char *>(lParam));
break;
#endif
default:

View File

@@ -1,17 +1,22 @@
// Scintilla source code edit control
// ScintillaBase.h - defines an enhanced subclass of Editor with calltips, autocomplete and context menu
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file ScintillaBase.h
** Defines an enhanced subclass of Editor with calltips, autocomplete and context menu.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef SCINTILLABASE_H
#define SCINTILLABASE_H
/**
*/
class ScintillaBase : public Editor {
// Private so ScintillaBase objects can not be copied
ScintillaBase(const ScintillaBase &) : Editor() {}
ScintillaBase &operator=(const ScintillaBase &) { return *this; }
protected:
// Enumeration of commands and child windows
/** Enumeration of commands and child windows. */
enum {
idCallTip=1,
idAutoComplete=2,
@@ -30,11 +35,17 @@ protected:
CallTip ct;
int listType; ///< 0 is an autocomplete list
SString userListSelected; ///< Receives listbox selected string
#ifdef SCI_LEXER
int lexLanguage;
LexerModule *lexCurrent;
PropSet props;
enum {numWordLists=5};
WordList *keyWordLists[numWordLists];
WordList *keyWordLists[numWordLists+1];
void SetLexer(uptr_t wParam);
void SetLexerLanguage(const char *languageName);
void Colourise(int start, int end);
#endif
@@ -67,7 +78,7 @@ protected:
virtual void NotifyStyleToNeeded(int endStyleNeeded);
public:
// Public so scintilla_send_message can use it
virtual long WndProc(unsigned int iMessage, unsigned long wParam, long lParam);
virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
};
#endif

View File

@@ -1,6 +1,8 @@
// Scintilla source code edit control
// Style.cxx - defines the font and colour style for a class of text
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file Style.cxx
** Defines the font and colour style for a class of text.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <string.h>
@@ -12,15 +14,15 @@
Style::Style() {
aliasOfDefaultFont = true;
Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT,
false, false, false, false, true);
Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff),
Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT,
false, false, false, false, caseMixed, true);
}
Style::Style(const Style &source) {
Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
0, 0, 0,
false, false, false, false, true);
Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff),
0, 0, 0,
false, false, false, false, caseMixed, true);
fore.desired = source.fore.desired;
back.desired = source.back.desired;
characterSet = source.characterSet;
@@ -29,7 +31,8 @@ Style::Style(const Style &source) {
size = source.size;
eolFilled = source.eolFilled;
underline = source.underline;
visible = source.visible;
caseForce = source.caseForce;
visible = source.visible;
}
Style::~Style() {
@@ -42,10 +45,10 @@ Style::~Style() {
Style &Style::operator=(const Style &source) {
if (this == &source)
return *this;
Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
0, 0, SC_CHARSET_DEFAULT,
false, false, false, false, true);
return * this;
Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff),
0, 0, SC_CHARSET_DEFAULT,
false, false, false, false, caseMixed, true);
fore.desired = source.fore.desired;
back.desired = source.back.desired;
characterSet = source.characterSet;
@@ -54,13 +57,15 @@ Style &Style::operator=(const Style &source) {
size = source.size;
eolFilled = source.eolFilled;
underline = source.underline;
visible = source.visible;
caseForce = source.caseForce;
visible = source.visible;
return *this;
}
void Style::Clear(Colour fore_, Colour back_, int size_,
const char *fontName_, int characterSet_,
bool bold_, bool italic_, bool eolFilled_, bool underline_, bool visible_) {
void Style::Clear(Colour fore_, Colour back_, int size_,
const char *fontName_, int characterSet_,
bool bold_, bool italic_, bool eolFilled_,
bool underline_, ecaseForced caseForce_, bool visible_) {
fore.desired = fore_;
back.desired = back_;
characterSet = characterSet_;
@@ -70,19 +75,35 @@ void Style::Clear(Colour fore_, Colour back_, int size_,
fontName = fontName_;
eolFilled = eolFilled_;
underline = underline_;
visible = visible_;
caseForce = caseForce_;
visible = visible_;
if (aliasOfDefaultFont)
font.SetID(0);
else
else
font.Release();
aliasOfDefaultFont = false;
}
void Style::ClearTo(const Style &source) {
Clear(
source.fore.desired,
source.back.desired,
source.size,
source.fontName,
source.characterSet,
source.bold,
source.italic,
source.eolFilled,
source.underline,
source.caseForce,
source.visible);
}
bool Style::EquivalentFontTo(const Style *other) const {
if (bold != other->bold ||
italic != other->italic ||
size != other->size ||
characterSet != other->characterSet)
italic != other->italic ||
size != other->size ||
characterSet != other->characterSet)
return false;
if (fontName == other->fontName)
return true;
@@ -94,17 +115,17 @@ bool Style::EquivalentFontTo(const Style *other) const {
}
void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
int sizeZoomed = size + zoomLevel;
sizeZoomed = size + zoomLevel;
if (sizeZoomed <= 2) // Hangs if sizeZoomed <= 1
sizeZoomed = 2;
if (aliasOfDefaultFont)
font.SetID(0);
else
else
font.Release();
int deviceHeight = surface.DeviceHeightFont(sizeZoomed);
aliasOfDefaultFont = defaultStyle &&
(EquivalentFontTo(defaultStyle) || !fontName);
aliasOfDefaultFont = defaultStyle &&
(EquivalentFontTo(defaultStyle) || !fontName);
if (aliasOfDefaultFont) {
font.SetID(defaultStyle->font.GetID());
} else if (fontName) {

View File

@@ -1,11 +1,15 @@
// Scintilla source code edit control
// Style.h - defines the font and colour style for a class of text
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
/** @file Style.h
** Defines the font and colour style for a class of text.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef STYLE_H
#define STYLE_H
/**
*/
class Style {
public:
ColourPair fore;
@@ -18,9 +22,12 @@ public:
int characterSet;
bool eolFilled;
bool underline;
enum ecaseForced {caseMixed, caseUpper, caseLower};
ecaseForced caseForce;
bool visible;
Font font;
int sizeZoomed;
unsigned int lineHeight;
unsigned int ascent;
unsigned int descent;
@@ -33,11 +40,13 @@ public:
~Style();
Style &operator=(const Style &source);
void Clear(Colour fore_, Colour back_,
int size_,
const char *fontName_, int characterSet_,
bool bold_, bool italic_, bool eolFilled_, bool underline_, bool visible_);
int size_,
const char *fontName_, int characterSet_,
bool bold_, bool italic_, bool eolFilled_,
bool underline_, ecaseForced caseForce_, bool visible_);
void ClearTo(const Style &source);
bool EquivalentFontTo(const Style *other) const;
void Realise(Surface &surface, int zoomLevel, Style *defaultStyle=0);
void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0);
};
#endif

View File

@@ -1,5 +1,8 @@
// UniConversion.h - functions to handle UFT-8 and UCS-2 strings
// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
// Scintilla source code edit control
/** @file UniConversion.cxx
** Functions to handle UFT-8 and UCS-2 strings.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>

Some files were not shown because too many files have changed in this diff Show More