Updated QScintilla version to 2.10.8

Summary from NEWS file:

  - Control-wheel scroll will now zoom in and out of the document.
  - Added accessibility support.
  - Added setScrollWidth() , scrollWidth, setScrollWidthTracking() and
    scrollWidthTracking() to QsciScintilla. (one of our patches)
  - Bug fixes.
This commit is contained in:
mgrojo
2018-11-18 17:35:46 +01:00
parent 52332c98ef
commit 209120c01e
66 changed files with 6077 additions and 3946 deletions
+391
View File
@@ -1,5 +1,396 @@
2018-10-01 Phil Thompson <phil@riverbankcomputing.com>
* NEWS:
Released as v2.10.8.
[57c8b6076899] [2.10.8] <2.10-maint>
2018-09-30 Phil Thompson <phil@riverbankcomputing.com>
* NEWS:
Updated the NEWS file.
[345f597a4a90] <2.10-maint>
2018-08-02 Phil Thompson <phil@riverbankcomputing.com>
* qt/SciAccessibility.cpp:
More accessibility fixes.
[2cc2d6865762] <2.10-maint>
* qt/SciAccessibility.cpp, qt/SciAccessibility.h, qt/qscintilla.pro:
Refactored the accessibility support to use less of the Qt stuff
which doesn't handle CR-LF end-of-lines.
[8b2d6e3e73d8] <2.10-maint>
2018-07-15 Phil Thompson <phil@riverbankcomputing.com>
* NEWS:
Updated the NEWS file.
[fc1deaccc716] <2.10-maint>
2018-06-29 Phil Thompson <phil@riverbankcomputing.com>
* .hgtags:
Added tag 2.10.7 for changeset 60598a703fd4
[8828f9ad7dc6] <2.10-maint>
* NEWS:
Released as v2.10.7.
[60598a703fd4] [2.10.7] <2.10-maint>
* NEWS:
Updated the NEWS file.
[92edf18019ec] <2.10-maint>
2018-06-25 Phil Thompson <phil@riverbankcomputing.com>
* NEWS, Python/sip/qsciscintillabase.sip:
Tweaked the signature of the QscoScintillaBase::SCN_MACRORECORD()
signal so that it matches what Qt uses so that the signal test
passes.
[bfcd9319329a] <2.10-maint>
2018-06-23 Phil Thompson <phil@riverbankcomputing.com>
* .hgtags:
Added tag 2.10.6 for changeset dc0993c72a05
[9c774d0a9694] <2.10-maint>
* NEWS:
Released as v2.10.6.
[dc0993c72a05] [2.10.6] <2.10-maint>
2018-06-22 Phil Thompson <phil@riverbankcomputing.com>
* .hgtags:
Added tag 2.10.5 for changeset f35b3a43a241
[8cf5694ca328] <2.10-maint>
* NEWS:
Released as v2.10.5.
[f35b3a43a241] [2.10.5] <2.10-maint>
2018-06-21 Phil Thompson <phil@riverbankcomputing.com>
* NEWS:
Updated the NEWS file.
[12cb1a2f5ec6] <2.10-maint>
2018-06-19 Phil Thompson <phil@riverbankcomputing.com>
* NEWS, Python/sip/qscistyle.sip, qt/qscistyle.cpp, qt/qscistyle.h:
Added setStyle() to QsciStyle.
[cf5281041224] <2.10-maint>
2018-06-16 Phil Thompson <phil@riverbankcomputing.com>
* qt/qscintilla_es.qm, qt/qscintilla_es.ts:
Updated Spanish translations from Jaime Seuma.
[a479b9f5436f] <2.10-maint>
2018-06-09 Phil Thompson <phil@riverbankcomputing.com>
* qt/qscintilla_cs.qm, qt/qscintilla_de.qm, qt/qscintilla_de.ts,
qt/qscintilla_es.qm, qt/qscintilla_fr.qm, qt/qscintilla_pt_br.qm:
Updated German translations from Detlev.
[f69379899fb3] <2.10-maint>
2018-06-04 Phil Thompson <phil@riverbankcomputing.com>
* NEWS, Python/configure.py:
Implemented support for the .dist-info directory.
[387aa9bf6ad8] <2.10-maint>
2018-06-03 Phil Thompson <phil@riverbankcomputing.com>
* NEWS, Python/sip/qsciscintillabase.sip, qt/PlatQt.cpp,
qt/ScintillaQt.cpp, qt/qsciscintillabase.cpp,
qt/qsciscintillabase.h:
Fixes for font changes caused by dragging to a different display.
[27b1f435e27a] <2.10-maint>
2018-05-29 Phil Thompson <phil@riverbankcomputing.com>
* qt/PlatQt.cpp:
Disable to macOS use of integer font metrics for Qt5 as it is
(probably) specific to Qt4.
[c32fe0c4e55d] <2.10-maint>
* qt/PlatQt.cpp:
Fixed cursor positioning when using a secondary display with
different scaling to the primary.
[20420b7c4a4d] <2.10-maint>
2018-05-22 Phil Thompson <phil@riverbankcomputing.com>
* qt/qscilexerverilog.cpp:
Fix the handling of the 'fold.verilog.flags' property in the Verilog
lexer.
[9b698ba38c2b] <2.10-maint>
2018-05-16 Phil Thompson <phil@riverbankcomputing.com>
* qt/qscilexerverilog.cpp, qt/qscintilla_cs.ts, qt/qscintilla_de.ts,
qt/qscintilla_es.ts, qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts:
Added the missing descriptions of inactive styles in the Verilog
lexer.
[4be691232e03] <2.10-maint>
2018-05-15 Phil Thompson <phil@riverbankcomputing.com>
* qt/qscilexer.h:
Updated the QsciLexer::keywords() documentation to point out that
sets are numbered from 1.
[5954b91e7ec1] <2.10-maint>
2018-04-26 Phil Thompson <phil@riverbankcomputing.com>
* Python/sip/qscilexeredifact.sip, qt/qscilexeredifact.cpp,
qt/qscilexeredifact.h:
Added some default colours to the EDIFACT lexer.
[175598286833] <2.10-maint>
2018-04-20 Phil Thompson <phil@riverbankcomputing.com>
* NEWS, Python/sip/qscilexeredifact.sip, qt/qscilexeredifact.cpp,
qt/qscilexeredifact.h, qt/qscintilla.pro, qt/qscintilla_cs.ts,
qt/qscintilla_de.ts, qt/qscintilla_es.ts, qt/qscintilla_fr.ts,
qt/qscintilla_pt_br.ts:
Added the QsciLexerEDIFACT class.
[c1e31857f3e7] <2.10-maint>
* qt/qsciscintilla.cpp, qt/qsciscintillabase.cpp,
qt/qsciscintillabase.h:
If the context menu is invoked when the cursor is outside the
selection then the selection is cleared and the cursor moved to
where the mouse was clicked.
[7d230dad9379] <2.10-maint>
2018-04-19 Phil Thompson <phil@riverbankcomputing.com>
* Python/sip/qsciscintilla.sip, qt/qscintilla.pro,
qt/qsciscintilla.cpp, qt/qsciscintilla.h:
Control-wheel up/down will now zoom in and out.
[ba0049fe03b6] <2.10-maint>
2018-04-11 Phil Thompson <phil@riverbankcomputing.com>
* qt/PlatQt.cpp, qt/qsciabstractapis.cpp, qt/qscilexerpython.cpp,
qt/qscilexerxml.cpp, qt/qsciscintilla.cpp:
Removed warning messages about unused variables.
[c2008ef93ee0] <2.10-maint>
* qt/qscicommandset.cpp:
Fixed the saving of alternative keys in the settings.
[687470e937c1] <2.10-maint>
* qt/ScintillaQt.cpp, qt/qsciapis.cpp, qt/qsciscintilla.cpp:
Various stylistic changes to eliminate some warning messages.
[dc753169870e] <2.10-maint>
2018-04-10 Phil Thompson <phil@riverbankcomputing.com>
* .hgtags:
Added tag 2.10.4 for changeset 24cb0edc89a9
[05ada666e2cf] <2.10-maint>
* NEWS:
Released as v2.10.4.
[24cb0edc89a9] [2.10.4] <2.10-maint>
* qt/SciAccessibility.cpp:
Fixed the retrieval of accessibility attributes.
[e430a7dd7818] <2.10-maint>
2018-04-07 Phil Thompson <phil@riverbankcomputing.com>
* qt/qscilexer.cpp:
Use STYLE_MAX to define the maximum number of styles.
[23ca0cad0227] <2.10-maint>
2018-03-11 Phil Thompson <phil@riverbankcomputing.com>
* qt/qscintilla.pro:
Force QT_NO_ACCESSIBILITY when building against Qt4.
[b65f48ec1852] <2.10-maint>
2018-02-27 Phil Thompson <phil@riverbankcomputing.com>
* .hgtags:
Added tag 2.10.3 for changeset bc769d6fcf53
[279625f1d8c9] <2.10-maint>
* NEWS:
Released as v2.10.3.
[bc769d6fcf53] [2.10.3] <2.10-maint>
* rb-product:
Updated the PyQt5 wheel dependency.
[7cef6e297ddf] <2.10-maint>
* NEWS:
Updated the NEWS file.
[1e073e29eca4] <2.10-maint>
2018-02-10 Phil Thompson <phil@riverbankcomputing.com>
* qsci/api/python/Python-3.7.api:
Added the API file for Python v3.70b1.
[6d0032674462] <2.10-maint>
2018-02-07 Phil Thompson <phil@riverbankcomputing.com>
* qt/qsciscintilla.cpp:
Fix the hotspot active background colour.
[45cfd8c68394] <2.10-maint>
* qt/SciAccessibility.cpp, qt/SciAccessibility.h:
Completed the accessibility support.
[2af3a5b045fa] <2.10-maint>
2018-02-06 Phil Thompson <phil@riverbankcomputing.com>
* qt/SciAccessibility.cpp, qt/SciAccessibility.h:
Implemented all of the accessible interface except for attributes().
[434539a243dc] <2.10-maint>
* qt/SciAccessibility.cpp:
Implemented more of the accessible interface.
[e8f3df5442cc] <2.10-maint>
* qt/SciAccessibility.cpp, qt/SciAccessibility.h, qt/ScintillaQt.cpp:
Implemented more of the accessible interface.
[fb26d9fdba27] <2.10-maint>
2018-02-05 Phil Thompson <phil@riverbankcomputing.com>
* qt/SciAccessibility.cpp, qt/SciAccessibility.h, qt/ScintillaQt.cpp,
qt/qsciscintillabase.cpp:
More accessibility progress.
[ea2432348b49] <2.10-maint>
* qt/SciAccessibility.cpp, qt/SciAccessibility.h, qt/ScintillaQt.cpp:
Some progress on accessibility.
[055345b62d7b] <2.10-maint>
* qt/qscintilla.pro:
Updated the version of the shared library.
[fb50133f8770] <2.10-maint>
2018-02-04 Phil Thompson <phil@riverbankcomputing.com>
* qt/SciAccessibility.cpp, qt/SciAccessibility.h, qt/qscintilla.pro,
qt/qsciscintillabase.cpp:
Added the stubs for accessibility support.
[61e00a4f944f] <2.10-maint>
2017-11-23 Phil Thompson <phil@riverbankcomputing.com>
* .hgtags:
Added tag 2.10.2 for changeset bdfb9584af36
[d127fc44d4c4] <2.10-maint>
* NEWS:
Released as v2.10.2.
[bdfb9584af36] [2.10.2] <2.10-maint>
* qt/qscintilla.pro:
Bumed the .so minor version.
[4bb28057d3c2] <2.10-maint>
2017-11-13 Phil Thompson <phil@riverbankcomputing.com>
* NEWS, Python/sip/qsciscintilla.sip, qt/qsciscintilla.cpp,
qt/qsciscintilla.h:
Added setScrollWidth() , scrollWidth, setScrollWidthTracking() and
scrollWidthTracking() to QsciScintilla.
[c6e64e99cb12] <2.10-maint>
2017-11-01 Phil Thompson <phil@riverbankcomputing.com>
* qt/qsciscintilla.cpp:
Fixed the handling of UTF8 call tips.
[7aa9b863f330] <2.10-maint>
2017-07-04 Phil Thompson <phil@riverbankcomputing.com>
* qt/qscintilla.pro:
Fixed case sensitivity of a couple of file names.
[e9d9b80fd61b] <2.10-maint>
* .hgignore:
Ignore the new-style build directory.
[6c20c6b41705] <2.10-maint>
2017-07-03 Phil Thompson <phil@riverbankcomputing.com>
* .hgtags:
Added tag 2.10.1 for changeset 20e0e2d419ba
[d6eba6c9e5ce] <2.10-maint>
* NEWS:
Released as v2.10.1.
[20e0e2d419ba] [2.10.1] <2.10-maint>
* rb-product:
Updated the PyQt5 dependency to v5.9.
[83200ee6b295] <2.10-maint>
2017-05-24 Phil Thompson <phil@riverbankcomputing.com>
* lib/README.doc:
Updated the docs regarding use of build options supported by
Scintilla.
[fe6e73057d9e] <2.10-maint>
2017-05-15 Phil Thompson <phil@riverbankcomputing.com>
* Python/sip/qscilexer.sip, Python/sip/qscilexeravs.sip,
Python/sip/qscilexerbash.sip, Python/sip/qscilexerbatch.sip,
Python/sip/qscilexercoffeescript.sip, Python/sip/qscilexercpp.sip,
Python/sip/qscilexercss.sip, Python/sip/qscilexerd.sip,
Python/sip/qscilexerfortran77.sip, Python/sip/qscilexerhtml.sip,
Python/sip/qscilexerlua.sip, Python/sip/qscilexerpascal.sip,
Python/sip/qscilexerperl.sip, Python/sip/qscilexerpostscript.sip,
Python/sip/qscilexerpov.sip, Python/sip/qscilexerpython.sip,
Python/sip/qscilexerruby.sip, Python/sip/qscilexerspice.sip,
Python/sip/qscilexersql.sip, Python/sip/qscilexertcl.sip,
Python/sip/qscilexerverilog.sip, Python/sip/qscilexervhdl.sip:
Added the lexer-specific re-implementations of previously internal
methods to the Python bindings.
[e8402392cedc] <2.10-maint>
2017-03-22 Phil Thompson <phil@riverbankcomputing.com>
* qt/qscintilla.pro:
Enabled explicit C++11 support for Linux for old versions of GCC.
[e0e0b344ccf1] <2.10-maint>
2017-03-16 Phil Thompson <phil@riverbankcomputing.com>
* qt/qscilexer.cpp:
Changed the default macOS font to Menlo 12pt as it has bold etc.
[39d69e37d352] <2.10-maint>
* qt/qscilexer.cpp:
Changed the default font on macOS to Monaco 12pt.
[9030535e2457] <2.10-maint>
* Python/configure.py:
Fixed the rpath change of the Python bindings on macOS.
[dd45e695812a] <2.10-maint>
2017-02-22 Phil Thompson <phil@riverbankcomputing.com>
* qt/qscintilla.pro:
Fixed the .pro file so that debug builds match the features file.
[1aedd0c6eeda] <2.10-maint>
2017-02-20 Phil Thompson <phil@riverbankcomputing.com>
* .hgtags:
Added tag 2.10 for changeset 6c07847b2835
[2442f8d2df34]
* NEWS:
Released as v2.10.
[6c07847b2835] [2.10]
+36
View File
@@ -1,3 +1,39 @@
v2.10.8 1st October 2018
- Bug fixes.
v2.10.7 2nd July 2018
- Bug fixes.
v2.10.6 24th June 2018
- A pseudo-release to create a version number for updated Python wheels.
v2.10.5 23rd June 2018
- Added the QsciLexerEDIFACT class.
- Added setStyle() to QsciStyle.
- Control-wheel scroll will now zoom in and out of the document.
- Buffered drawing is now disabled by default.
- The Python bindings create a PEP 376 .dist-info directory on installation
that provides version information for dependent packages and allows pip to
uninstall.
- Added the --no-dist-info option to the Python bindings' configure.py.
- Bug fixes.
v2.10.4 10th April 2018
- Bug fixes.
v2.10.3 26th February 2018
- Added accessibility support.
- Added the API file for Python v3.7.
v2.10.2 23rd November 2017
- Added setScrollWidth() , scrollWidth, setScrollWidthTracking() and
scrollWidthTracking() to QsciScintilla.
- Bug fixes.
v2.10.1 3rd July 2017
- Changed the default font on macOS to Menlo 12pt.
- Added previously internal lexer methods to the Python bindings.
v2.10 20th February 2017
- Based on Scintilla v3.7.2.
- Added the QsciLexerJSON class.
+2
View File
@@ -39,6 +39,7 @@ set(QSCINTILLA_SRC
ListBoxQt.cpp
PlatQt.cpp
ScintillaQt.cpp
SciAccessibility.cpp
../lexers/LexSQL.cpp
../lexers/LexJSON.cpp
../lexers/LexHTML.cpp
@@ -161,6 +162,7 @@ set(QSCINTILLA_MOC_HDR
./Qsci/qscimacro.h
SciClasses.h
ScintillaQt.h
SciAccessibility.h
)
include_directories(. ../include ../lexlib ../src)
+1 -1
View File
@@ -1,7 +1,7 @@
// This module implements the specialisation of QListBox that handles the
// Scintilla double-click callback.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,7 +1,7 @@
// This defines the specialisation of QListBox that handles the Scintilla
// double-click callback.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -2,7 +2,7 @@
// OS/X. It is a separate file to avoid clashes between OS/X and Scintilla
// data types.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+13 -10
View File
@@ -1,6 +1,6 @@
// This module implements the portability layer for the Qt port of Scintilla.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -105,7 +105,7 @@ void Font::Create(const FontParameters &fp)
strategy = QFont::PreferDefault;
}
#if defined(Q_OS_MAC)
#if defined(Q_OS_MAC) && QT_VERSION < 0x050000
#if QT_VERSION >= 0x040700
strategy = static_cast<QFont::StyleStrategy>(strategy | QFont::ForceIntegerMetrics);
#else
@@ -171,7 +171,7 @@ public:
void Init(WindowID wid);
void Init(SurfaceID sid, WindowID);
void Init(QPainter *p);
void InitPixMap(int width, int height, Surface *, WindowID wid);
void InitPixMap(int width, int height, Surface *sid, WindowID wid);
void Release();
bool Initialised() {return painter;}
@@ -207,7 +207,7 @@ public:
XYPOSITION WidthChar(Font &font_, char ch);
XYPOSITION Ascent(Font &font_);
XYPOSITION Descent(Font &font_);
XYPOSITION InternalLeading(Font &font_) {return 0;}
XYPOSITION InternalLeading(Font &font_) {Q_UNUSED(font_); return 0;}
XYPOSITION ExternalLeading(Font &font_);
XYPOSITION Height(Font &font_);
XYPOSITION AverageCharWidth(Font &font_);
@@ -216,7 +216,7 @@ public:
void FlushCachedState();
void SetUnicodeMode(bool unicodeMode_) {unicodeMode = unicodeMode_;}
void SetDBCSMode(int codePage) {}
void SetDBCSMode(int codePage) {Q_UNUSED(codePage);}
void DrawXPM(PRectangle rc, const XPM *xpm);
@@ -281,7 +281,7 @@ void SurfaceImpl::Init(QPainter *p)
painter = p;
}
void SurfaceImpl::InitPixMap(int width, int height, Surface *, WindowID wid)
void SurfaceImpl::InitPixMap(int width, int height, Surface *sid, WindowID wid)
{
Release();
@@ -298,6 +298,8 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface *, WindowID wid)
painter = new QPainter(pd);
my_resources = true;
SetUnicodeMode(static_cast<SurfaceImpl *>(sid)->unicodeMode);
}
void SurfaceImpl::Release()
@@ -539,6 +541,8 @@ void SurfaceImpl::DrawXPM(PRectangle rc, const XPM *xpm)
void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height,
const unsigned char *pixelsImage)
{
Q_UNUSED(width);
Q_UNUSED(height);
Q_ASSERT(painter);
const QImage *qim = reinterpret_cast<const QImage *>(pixelsImage);
@@ -1004,15 +1008,14 @@ bool Platform::IsKeyDown(int)
return false;
}
long Platform::SendScintilla(WindowID w, unsigned int msg,
unsigned long wParam, long lParam)
long Platform::SendScintilla(WindowID, unsigned int, unsigned long, long)
{
// This is never called.
return 0;
}
long Platform::SendScintillaPointer(WindowID w, unsigned int msg,
unsigned long wParam, void *lParam)
long Platform::SendScintillaPointer(WindowID, unsigned int, unsigned long,
void *)
{
// This is never called.
return 0;
@@ -1,6 +1,6 @@
// This module defines interface to the QsciAbstractAPIs class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,6 +1,6 @@
// This module defines interface to the QsciAPIs class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,6 +1,6 @@
// This defines the interface to the QsciCommand class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,6 +1,6 @@
// This defines the interface to the QsciCommandSet class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,6 +1,6 @@
// This defines the interface to the QsciDocument class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+3 -3
View File
@@ -1,6 +1,6 @@
// This module defines various things common to all of the Scintilla Qt port.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -24,8 +24,8 @@
#include <qglobal.h>
#define QSCINTILLA_VERSION 0x020a00
#define QSCINTILLA_VERSION_STR "2.10"
#define QSCINTILLA_VERSION 0x020a08
#define QSCINTILLA_VERSION_STR "2.10.8"
// Define QSCINTILLA_MAKE_DLL to create a QScintilla shared library, or
+3 -3
View File
@@ -1,6 +1,6 @@
// This defines the interface to the QsciLexer class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -153,8 +153,8 @@ public:
virtual int indentationGuideView() const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string. 0 is returned if there
//! is no such set.
//! by the lexer as a space separated string. Keyword sets are numbered
//! from 1. 0 is returned if there is no such set.
virtual const char *keywords(int set) const;
//! Returns the number of the style used for whitespace. The default
+1 -1
View File
@@ -1,6 +1,6 @@
// This defines the interface to the QsciLexerCPP class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -1,6 +1,6 @@
// This defines the interface to the QsciLexerCustom class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,6 +1,6 @@
// This defines the interface to the QsciLexerHTML class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -1,6 +1,6 @@
// This defines the interface to the QsciLexerJavaScript class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,6 +1,6 @@
// This defines the interface to the QsciLexerJSON class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -1,6 +1,6 @@
// This defines the interface to the QsciLexerPython class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,6 +1,6 @@
// This defines the interface to the QsciLexerSQL class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,6 +1,6 @@
// This defines the interface to the QsciLexerXML class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,6 +1,6 @@
// This defines the interface to the QsciMacro class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,6 +1,6 @@
// This module defines interface to the QsciPrinter class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+31 -29
View File
@@ -1,7 +1,7 @@
// This module defines the "official" high-level API of the Qt port of
// Scintilla.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -1155,6 +1155,16 @@ public:
//! \sa setHotspotForegroundColor(), resetHotspotBackgroundColor()
void resetHotspotForegroundColor();
//! Gets the assumed document width in pixels.
//!
//! \sa setScrollWidth(), setScrollWidthTracking()
int scrollWidth() const;
//! Returns true if scroll width tracking is enabled.
//!
//! \sa scrollWidth(), setScrollWidthTracking()
bool scrollWidthTracking() const;
//! The fold margin may be drawn as a one pixel sized checkerboard pattern
//! of two colours, \a fore and \a back.
//!
@@ -1370,6 +1380,23 @@ public:
//! \sa setMatchedBraceIndicator()
void resetMatchedBraceIndicator();
//! For performance, QScintilla does not measure the display width of the
//! document to determine the properties of the horizontal scroll bar.
//! Instead, an assumed width is used. This sets the document width in
//! pixels assumed by QScintilla to \a pixelWidth. The default value is
//! 2000.
//!
//! \sa scrollWidth(), setScrollWidthTracking()
void setScrollWidth(int pixelWidth);
//! If scroll width tracking is enabled then the scroll width is adjusted
//! to ensure that all of the lines currently displayed can be completely
//! scrolled. This mode never adjusts the scroll width to be narrower.
//! This sets the scroll width tracking to \a enabled.
//!
//! \sa setScrollWidth(), scrollWidthTracking()
void setScrollWidthTracking(bool enabled);
//! Sets the mode used to draw tab characters when whitespace is visible to
//! \a mode. The default is to use an arrow.
//!
@@ -2009,34 +2036,6 @@ public slots:
//! \sa zoomIn(), zoomOut()
virtual void zoomTo(int size);
//! For performance, Scintilla does not measure the display width
//! of the document to determine the properties of the horizontal
//! scroll bar. Instead, an assumed width is used. This sets the
//! document width in pixels assumed by Scintilla to \a
//! pixelWidth. The default value is 2000.
//!
//! \sa getScrollWidth(), setScrollWidthTracking()
virtual void setScrollWidth(int pixelWidth);
//! Gets the document width in pixels assumed by Scintilla.
//!
//! \sa setScrollWidth(), setScrollWidthTracking()
virtual int getScrollWidth() const;
//! If scroll width tracking is enabled then the scroll width is
//! adjusted to ensure that all of the lines currently displayed
//! can be completely scrolled. This mode never adjusts the scroll
//! width to be narrower.
//! Sets the scroll width tracking to \a enabled.
//!
//! \sa setScrollWidth(), getScrollWidthTracking()
virtual void setScrollWidthTracking(bool enabled);
//! Gets the current scroll width tracking mode.
//!
//! \sa getScrollWidth(), setScrollWidthTracking()
virtual bool getScrollWidthTracking() const;
signals:
//! This signal is emitted whenever the cursor position changes. \a line
//! contains the line number and \a index contains the character index
@@ -2128,6 +2127,9 @@ protected:
//! \reimp
virtual void contextMenuEvent(QContextMenuEvent *e);
//! \reimp
virtual void wheelEvent(QWheelEvent *e);
private slots:
void handleCallTipClick(int dir);
void handleCharAdded(int charadded);
@@ -1,6 +1,6 @@
// This class defines the "official" low-level API.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -3662,6 +3662,9 @@ protected:
//! \sa canInsertFromMimeData(), fromMimeData()
virtual QMimeData *toMimeData(const QByteArray &text, bool rectangular) const;
//! \reimp
virtual void changeEvent(QEvent *e);
//! Re-implemented to handle the context menu.
virtual void contextMenuEvent(QContextMenuEvent *e);
@@ -3728,6 +3731,9 @@ protected:
//! \internal Convert encoded bytes to a QString.
QString bytesAsText(const char *bytes) const;
//! \internal A helper for QsciScintilla::contextMenuEvent().
bool contextMenuNeeded(int x, int y) const;
private slots:
void handleVSb(int value);
void handleHSb(int value);
+22 -7
View File
@@ -1,6 +1,6 @@
// This module defines interface to the QsciStyle class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -55,21 +55,36 @@ public:
};
//! Constructs a QsciStyle instance for style number \a style. If \a style
//! is negative then a new style number is automatically allocated.
//! is negative then a new style number is automatically allocated if
//! possible. If it is not possible then style() will return a negative
//! value.
//!
//! \sa style()
QsciStyle(int style = -1);
//! Constructs a QsciStyle instance for style number \a style. If \a style
//! is negative then a new style number is automatically allocated. The
//! styles description, color, paper color, font and end-of-line fill are
//! set to \a description, \a color, \a paper, \a font and \a eolFill
//! respectively.
//! is negative then a new style number is automatically allocated if
//! possible. If it is not possible then style() will return a negative
//! value. The styles description, color, paper color, font and
//! end-of-line fill are set to \a description, \a color, \a paper, \a font
//! and \a eolFill respectively.
//!
//! \sa style()
QsciStyle(int style, const QString &description, const QColor &color,
const QColor &paper, const QFont &font, bool eolFill = false);
//! \internal Apply the style to a particular editor.
void apply(QsciScintillaBase *sci) const;
//! Returns the number of the style.
//! The style's number is set to \a style.
//!
//! \sa style()
void setStyle(int style) {style_nr = style;}
//! Returns the number of the style. This will be negative if the style is
//! invalid.
//!
//! \sa setStyle()
int style() const {return style_nr;}
//! The style's description is set to \a description.
+1 -1
View File
@@ -1,6 +1,6 @@
// This module defines interface to the QsciStyledText class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+760
View File
@@ -0,0 +1,760 @@
// The implementation of the class that implements accessibility support.
//
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include <qglobal.h>
#if !defined(QT_NO_ACCESSIBILITY)
#include "SciAccessibility.h"
#include <QAccessible>
#include <QFont>
#include <QFontMetrics>
#include <QRect>
#include <QWidget>
#include "Qsci/qsciscintillabase.h"
// Set if the accessibility support needs initialising.
bool QsciAccessibleScintillaBase::needs_initialising = true;
// The list of all accessibles.
QList<QsciAccessibleScintillaBase *> QsciAccessibleScintillaBase::all_accessibles;
// Forward declarations.
static QAccessibleInterface *factory(const QString &classname, QObject *object);
// The ctor.
QsciAccessibleScintillaBase::QsciAccessibleScintillaBase(QWidget *widget) :
QAccessibleWidget(widget, QAccessible::EditableText),
current_cursor_offset(-1), is_selection(false)
{
all_accessibles.append(this);
}
// The dtor.
QsciAccessibleScintillaBase::~QsciAccessibleScintillaBase()
{
all_accessibles.removeOne(this);
}
// Initialise the accessibility support.
void QsciAccessibleScintillaBase::initialise()
{
if (needs_initialising)
{
QAccessible::installFactory(factory);
needs_initialising = false;
}
}
// Find the accessible for a widget.
QsciAccessibleScintillaBase *QsciAccessibleScintillaBase::findAccessible(
QsciScintillaBase *sb)
{
for (int i = 0; i < all_accessibles.size(); ++i)
{
QsciAccessibleScintillaBase *acc_sb = all_accessibles.at(i);
if (acc_sb->sciWidget() == sb)
return acc_sb;
}
return 0;
}
// Return the QsciScintillaBase instance.
QsciScintillaBase *QsciAccessibleScintillaBase::sciWidget() const
{
return static_cast<QsciScintillaBase *>(widget());
}
// Update the accessible when the selection has changed.
void QsciAccessibleScintillaBase::selectionChanged(QsciScintillaBase *sb,
bool selection)
{
QsciAccessibleScintillaBase *acc_sb = findAccessible(sb);
if (!acc_sb)
return;
acc_sb->is_selection = selection;
}
// Update the accessibility when text has been inserted.
void QsciAccessibleScintillaBase::textInserted(QsciScintillaBase *sb,
int position, const char *text, int length)
{
Q_ASSERT(text);
QString new_text = bytesAsText(sb, text, length);
int offset = positionAsOffset(sb, position);
QAccessibleTextInsertEvent ev(sb, offset, new_text);
QAccessible::updateAccessibility(&ev);
}
// Return the fragment of text before an offset.
QString QsciAccessibleScintillaBase::textBeforeOffset(int offset,
QAccessible::TextBoundaryType boundaryType, int *startOffset,
int *endOffset) const
{
QsciScintillaBase *sb = sciWidget();
// Initialise in case of errors.
*startOffset = *endOffset = -1;
int position = validPosition(offset);
if (position < 0)
return QString();
int start_position, end_position;
if (!boundaries(sb, position, boundaryType, &start_position, &end_position))
return QString();
if (start_position == 0)
return QString();
if (!boundaries(sb, start_position - 1, boundaryType, &start_position, &end_position))
return QString();
positionRangeAsOffsetRange(sb, start_position, end_position, startOffset,
endOffset);
return textRange(sb, start_position, end_position);
}
// Return the fragment of text after an offset.
QString QsciAccessibleScintillaBase::textAfterOffset(int offset,
QAccessible::TextBoundaryType boundaryType, int *startOffset,
int *endOffset) const
{
QsciScintillaBase *sb = sciWidget();
// Initialise in case of errors.
*startOffset = *endOffset = -1;
int position = validPosition(offset);
if (position < 0)
return QString();
int start_position, end_position;
if (!boundaries(sb, position, boundaryType, &start_position, &end_position))
return QString();
if (end_position >= sb->SendScintilla(QsciScintillaBase::SCI_GETTEXTLENGTH))
return QString();
if (!boundaries(sb, end_position, boundaryType, &start_position, &end_position))
return QString();
positionRangeAsOffsetRange(sb, start_position, end_position, startOffset,
endOffset);
return textRange(sb, start_position, end_position);
}
// Return the fragment of text at an offset.
QString QsciAccessibleScintillaBase::textAtOffset(int offset,
QAccessible::TextBoundaryType boundaryType, int *startOffset,
int *endOffset) const
{
QsciScintillaBase *sb = sciWidget();
// Initialise in case of errors.
*startOffset = *endOffset = -1;
int position = validPosition(offset);
if (position < 0)
return QString();
int start_position, end_position;
if (!boundaries(sb, position, boundaryType, &start_position, &end_position))
return QString();
positionRangeAsOffsetRange(sb, start_position, end_position, startOffset,
endOffset);
return textRange(sb, start_position, end_position);
}
// Update the accessibility when text has been deleted.
void QsciAccessibleScintillaBase::textDeleted(QsciScintillaBase *sb,
int position, const char *text, int length)
{
Q_ASSERT(text);
QString old_text = bytesAsText(sb, text, length);
int offset = positionAsOffset(sb, position);
QAccessibleTextRemoveEvent ev(sb, offset, old_text);
QAccessible::updateAccessibility(&ev);
}
// Update the accessibility when the UI has been updated.
void QsciAccessibleScintillaBase::updated(QsciScintillaBase *sb)
{
QsciAccessibleScintillaBase *acc_sb = findAccessible(sb);
if (!acc_sb)
return;
int cursor_offset = positionAsOffset(sb,
sb->SendScintilla(QsciScintillaBase::SCI_GETCURRENTPOS));
if (acc_sb->current_cursor_offset != cursor_offset)
{
acc_sb->current_cursor_offset = cursor_offset;
QAccessibleTextCursorEvent ev(sb, cursor_offset);
QAccessible::updateAccessibility(&ev);
}
}
// Return a valid position from an offset or -1 if it was invalid.
int QsciAccessibleScintillaBase::validPosition(int offset) const
{
// An offset of -1 is interpreted as the length of the text.
int nr_chars = characterCount();
if (offset == -1)
offset = nr_chars;
// Check there is some text and the offset is within range.
if (nr_chars == 0 || offset < 0 || offset > nr_chars)
return -1;
return offsetAsPosition(sciWidget(), offset);
}
// Get the start and end boundary positions for a type of boundary. true is
// returned if the boundary positions are valid.
bool QsciAccessibleScintillaBase::boundaries(QsciScintillaBase *sb,
int position, QAccessible::TextBoundaryType boundaryType,
int *start_position, int *end_position)
{
// This implementation is based on what Qt does although that may itself be
// wrong. The cursor is in a word if it is before or after any character
// in the word. If the cursor is not in a word (eg. is has a space each
// side) then the previous word is current.
switch (boundaryType)
{
case QAccessible::CharBoundary:
*start_position = position;
*end_position = sb->SendScintilla(
QsciScintillaBase::SCI_POSITIONAFTER, position);
break;
case QAccessible::WordBoundary:
*start_position = sb->SendScintilla(
QsciScintillaBase::SCI_WORDSTARTPOSITION, position, 1);
*end_position = sb->SendScintilla(
QsciScintillaBase::SCI_WORDENDPOSITION, position, 1);
// If the start and end positions are the same then we are not in a
// word.
if (*start_position == *end_position)
{
// We need the immediately preceding word. Note that Qt behaves
// differently as it will not move before the current line.
// Find the end of the preceding word.
*end_position = sb->SendScintilla(
QsciScintillaBase::SCI_WORDSTARTPOSITION, position, 0L);
// If the end is 0 then there isn't a preceding word.
if (*end_position == 0)
return false;
// Now find the start.
*start_position = sb->SendScintilla(
QsciScintillaBase::SCI_WORDSTARTPOSITION, *end_position,
1);
}
break;
case QAccessible::SentenceBoundary:
return false;
case QAccessible::ParagraphBoundary:
// Paragraph boundaries are supposed to be supported but it isn't clear
// what this means in a code editor.
return false;
case QAccessible::LineBoundary:
{
int line = sb->SendScintilla(
QsciScintillaBase::SCI_LINEFROMPOSITION, position);
*start_position = sb->SendScintilla(
QsciScintillaBase::SCI_POSITIONFROMLINE, line);
*end_position = sb->SendScintilla(
QsciScintillaBase::SCI_POSITIONFROMLINE, line + 1);
// See if we are after the last end-of-line character.
if (*start_position == *end_position)
return false;
}
break;
case QAccessible::NoBoundary:
*start_position = 0;
*end_position = sb->SendScintilla(
QsciScintillaBase::SCI_GETTEXTLENGTH);
break;
}
return true;
}
// Return the text between two positions.
QString QsciAccessibleScintillaBase::textRange(QsciScintillaBase *sb,
int start_position, int end_position)
{
QByteArray bytes(end_position - start_position + 1, '\0');
sb->SendScintilla(QsciScintillaBase::SCI_GETTEXTRANGE, start_position,
end_position, bytes.data());
return bytesAsText(sb, bytes.constData(), bytes.size() - 1);
}
// Convert bytes to text.
QString QsciAccessibleScintillaBase::bytesAsText(QsciScintillaBase *sb,
const char *bytes, int length)
{
if (sb->SendScintilla(QsciScintillaBase::SCI_GETCODEPAGE) == QsciScintillaBase::SC_CP_UTF8)
return QString::fromUtf8(bytes, length);
return QString::fromLatin1(bytes, length);
}
// Convert text to bytes.
QByteArray QsciAccessibleScintillaBase::textAsBytes(QsciScintillaBase *sb,
const QString &text)
{
if (sb->SendScintilla(QsciScintillaBase::SCI_GETCODEPAGE) == QsciScintillaBase::SC_CP_UTF8)
return text.toUtf8();
return text.toLatin1();
}
// Convert a byte position to a character offset.
int QsciAccessibleScintillaBase::positionAsOffset(QsciScintillaBase *sb,
int position)
{
return sb->SendScintilla(QsciScintillaBase::SCI_COUNTCHARACTERS, 0,
position);
}
// Convert a range of byte poisitions to character offsets.
void QsciAccessibleScintillaBase::positionRangeAsOffsetRange(
QsciScintillaBase *sb, int start_position, int end_position,
int *startOffset, int *endOffset)
{
*startOffset = positionAsOffset(sb, start_position);
*endOffset = positionAsOffset(sb, end_position);
}
// Convert character offset position to a byte position.
int QsciAccessibleScintillaBase::offsetAsPosition(QsciScintillaBase *sb,
int offset)
{
return sb->SendScintilla(QsciScintillaBase::SCI_POSITIONRELATIVE, 0,
offset);
}
// Get the current selection if any.
void QsciAccessibleScintillaBase::selection(int selectionIndex,
int *startOffset, int *endOffset) const
{
int start, end;
if (selectionIndex == 0 && is_selection)
{
QsciScintillaBase *sb = sciWidget();
int start_position = sb->SendScintilla(
QsciScintillaBase::SCI_GETSELECTIONSTART);
int end_position = sb->SendScintilla(
QsciScintillaBase::SCI_GETSELECTIONEND);
start = positionAsOffset(sb, start_position);
end = positionAsOffset(sb, end_position);
}
else
{
start = end = 0;
}
*startOffset = start;
*endOffset = end;
}
// Return the number of selections.
int QsciAccessibleScintillaBase::selectionCount() const
{
return (is_selection ? 1 : 0);
}
// Add a selection.
void QsciAccessibleScintillaBase::addSelection(int startOffset, int endOffset)
{
setSelection(0, startOffset, endOffset);
}
// Remove a selection.
void QsciAccessibleScintillaBase::removeSelection(int selectionIndex)
{
if (selectionIndex == 0)
sciWidget()->SendScintilla(QsciScintillaBase::SCI_CLEARSELECTIONS);
}
// Set the selection.
void QsciAccessibleScintillaBase::setSelection(int selectionIndex,
int startOffset, int endOffset)
{
if (selectionIndex == 0)
{
QsciScintillaBase *sb = sciWidget();
sb->SendScintilla(QsciScintillaBase::SCI_SETSELECTIONSTART,
offsetAsPosition(sb, startOffset));
sb->SendScintilla(QsciScintillaBase::SCI_SETSELECTIONEND,
offsetAsPosition(sb, endOffset));
}
}
// Return the current cursor offset.
int QsciAccessibleScintillaBase::cursorPosition() const
{
return current_cursor_offset;
}
// Set the cursor offset.
void QsciAccessibleScintillaBase::setCursorPosition(int position)
{
QsciScintillaBase *sb = sciWidget();
sb->SendScintilla(QsciScintillaBase::SCI_GOTOPOS,
offsetAsPosition(sb, position));
}
// Return the text between two offsets.
QString QsciAccessibleScintillaBase::text(int startOffset, int endOffset) const
{
QsciScintillaBase *sb = sciWidget();
return textRange(sb, offsetAsPosition(sb, startOffset),
offsetAsPosition(sb, endOffset));
}
// Return the number of characters in the text.
int QsciAccessibleScintillaBase::characterCount() const
{
QsciScintillaBase *sb = sciWidget();
return sb->SendScintilla(QsciScintillaBase::SCI_COUNTCHARACTERS, 0,
sb->SendScintilla(QsciScintillaBase::SCI_GETTEXTLENGTH));
}
QRect QsciAccessibleScintillaBase::characterRect(int offset) const
{
QsciScintillaBase *sb = sciWidget();
int position = offsetAsPosition(sb, offset);
int x_vport = sb->SendScintilla(QsciScintillaBase::SCI_POINTXFROMPOSITION,
position);
int y_vport = sb->SendScintilla(QsciScintillaBase::SCI_POINTYFROMPOSITION,
position);
const QString ch = text(offset, offset + 1);
// Get the character's font metrics.
int style = sb->SendScintilla(QsciScintillaBase::SCI_GETSTYLEAT, position);
QFontMetrics metrics(fontForStyle(style));
QRect rect(x_vport, y_vport, metrics.width(ch), metrics.height());
rect.moveTo(sb->viewport()->mapToGlobal(rect.topLeft()));
return rect;
}
// Return the offset of the character at the given screen coordinates.
int QsciAccessibleScintillaBase::offsetAtPoint(const QPoint &point) const
{
QsciScintillaBase *sb = sciWidget();
QPoint p = sb->viewport()->mapFromGlobal(point);
int position = sb->SendScintilla(QsciScintillaBase::SCI_POSITIONFROMPOINT,
p.x(), p.y());
return (position >= 0) ? positionAsOffset(sb, position) : -1;
}
// Scroll to make sure an area of text is visible.
void QsciAccessibleScintillaBase::scrollToSubstring(int startIndex,
int endIndex)
{
QsciScintillaBase *sb = sciWidget();
int start = offsetAsPosition(sb, startIndex);
int end = offsetAsPosition(sb, endIndex);
sb->SendScintilla(QsciScintillaBase::SCI_SCROLLRANGE, end, start);
}
// Return the attributes of a character and surrounding text.
QString QsciAccessibleScintillaBase::attributes(int offset, int *startOffset,
int *endOffset) const
{
QsciScintillaBase *sb = sciWidget();
int position = offsetAsPosition(sb, offset);
int style = sb->SendScintilla(QsciScintillaBase::SCI_GETSTYLEAT, position);
// Find the start of the text with this style.
int start_position = position;
int start_text_position = offset;
while (start_position > 0)
{
int before = sb->SendScintilla(QsciScintillaBase::SCI_POSITIONBEFORE,
start_position);
int s = sb->SendScintilla(QsciScintillaBase::SCI_GETSTYLEAT, before);
if (s != style)
break;
start_position = before;
--start_text_position;
}
*startOffset = start_text_position;
// Find the end of the text with this style.
int end_position = sb->SendScintilla(QsciScintillaBase::SCI_POSITIONAFTER,
position);
int end_text_position = offset + 1;
int last_position = sb->SendScintilla(
QsciScintillaBase::SCI_GETTEXTLENGTH);
while (end_position < last_position)
{
int s = sb->SendScintilla(QsciScintillaBase::SCI_GETSTYLEAT,
end_position);
if (s != style)
break;
end_position = sb->SendScintilla(QsciScintillaBase::SCI_POSITIONAFTER,
end_position);
++end_text_position;
}
*endOffset = end_text_position;
// Convert the style to attributes.
QString attrs;
int back = sb->SendScintilla(QsciScintillaBase::SCI_STYLEGETBACK, style);
addAttribute(attrs, "background-color", colourAsRGB(back));
int fore = sb->SendScintilla(QsciScintillaBase::SCI_STYLEGETFORE, style);
addAttribute(attrs, "color", colourAsRGB(fore));
QFont font = fontForStyle(style);
QString family = font.family();
family = family.replace('\\', QLatin1String("\\\\"));
family = family.replace(':', QLatin1String("\\:"));
family = family.replace(',', QLatin1String("\\,"));
family = family.replace('=', QLatin1String("\\="));
family = family.replace(';', QLatin1String("\\;"));
family = family.replace('\"', QLatin1String("\\\""));
addAttribute(attrs, "font-familly",
QLatin1Char('"') + family + QLatin1Char('"'));
int font_size = int(font.pointSize());
addAttribute(attrs, "font-size",
QString::fromLatin1("%1pt").arg(font_size));
QFont::Style font_style = font.style();
addAttribute(attrs, "font-style",
QString::fromLatin1((font_style == QFont::StyleItalic) ? "italic" : ((font_style == QFont::StyleOblique) ? "oblique": "normal")));
int font_weight = font.weight();
addAttribute(attrs, "font-weight",
QString::fromLatin1(
(font_weight > QFont::Normal) ? "bold" : "normal"));
int underline = sb->SendScintilla(QsciScintillaBase::SCI_STYLEGETUNDERLINE,
style);
if (underline)
addAttribute(attrs, "text-underline-type",
QString::fromLatin1("single"));
return attrs;
}
// Add an attribute name/value pair.
void QsciAccessibleScintillaBase::addAttribute(QString &attrs,
const char *name, const QString &value)
{
attrs.append(QLatin1String(name));
attrs.append(QChar(':'));
attrs.append(value);
attrs.append(QChar(';'));
}
// Convert a integer colour to an RGB string.
QString QsciAccessibleScintillaBase::colourAsRGB(int colour)
{
return QString::fromLatin1("rgb(%1,%2,%3)").arg(colour & 0xff).arg((colour >> 8) & 0xff).arg((colour >> 16) & 0xff);
}
// Convert a integer colour to an RGB string.
QFont QsciAccessibleScintillaBase::fontForStyle(int style) const
{
QsciScintillaBase *sb = sciWidget();
char fontName[64];
int len = sb->SendScintilla(QsciScintillaBase::SCI_STYLEGETFONT, style,
fontName);
int size = sb->SendScintilla(QsciScintillaBase::SCI_STYLEGETSIZE, style);
bool italic = sb->SendScintilla(QsciScintillaBase::SCI_STYLEGETITALIC,
style);
int weight = sb->SendScintilla(QsciScintillaBase::SCI_STYLEGETWEIGHT,
style);
return QFont(QString::fromUtf8(fontName, len), size, weight, italic);
}
// Delete some text.
void QsciAccessibleScintillaBase::deleteText(int startOffset, int endOffset)
{
addSelection(startOffset, endOffset);
sciWidget()->SendScintilla(QsciScintillaBase::SCI_REPLACESEL, "");
}
// Insert some text.
void QsciAccessibleScintillaBase::insertText(int offset, const QString &text)
{
QsciScintillaBase *sb = sciWidget();
sb->SendScintilla(QsciScintillaBase::SCI_INSERTTEXT,
offsetAsPosition(sb, offset), textAsBytes(sb, text).constData());
}
// Replace some text.
void QsciAccessibleScintillaBase::replaceText(int startOffset, int endOffset,
const QString &text)
{
QsciScintillaBase *sb = sciWidget();
addSelection(startOffset, endOffset);
sb->SendScintilla(QsciScintillaBase::SCI_REPLACESEL,
textAsBytes(sb, text).constData());
}
// Return the state.
QAccessible::State QsciAccessibleScintillaBase::state() const
{
QAccessible::State st = QAccessibleWidget::state();
st.selectableText = true;
st.multiLine = true;
if (sciWidget()->SendScintilla(QsciScintillaBase::SCI_GETREADONLY))
st.readOnly = true;
else
st.editable = true;
return st;
}
// Provide access to the indivual interfaces.
void *QsciAccessibleScintillaBase::interface_cast(QAccessible::InterfaceType t)
{
if (t == QAccessible::TextInterface)
return static_cast<QAccessibleTextInterface *>(this);
if (t == QAccessible::EditableTextInterface)
return static_cast<QAccessibleEditableTextInterface *>(this);
return QAccessibleWidget::interface_cast(t);
}
// The accessibility interface factory.
static QAccessibleInterface *factory(const QString &classname, QObject *object)
{
if (classname == QLatin1String("QsciScintillaBase") && object && object->isWidgetType())
return new QsciAccessibleScintillaBase(static_cast<QWidget *>(object));
return 0;
}
#endif
+122
View File
@@ -0,0 +1,122 @@
// The definition of the class that implements accessibility support.
//
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef _SCIACCESSIBILITY_H
#define _SCIACCESSIBILITY_H
#include <qglobal.h>
#if !defined(QT_NO_ACCESSIBILITY)
#include <QAccessible>
#include <QAccessibleEditableTextInterface>
#include <QAccessibleTextInterface>
#include <QAccessibleWidget>
#include <QByteArray>
#include <QFont>
#include <QList>
#include <QString>
class QsciScintillaBase;
// The implementation of accessibility support.
class QsciAccessibleScintillaBase : public QAccessibleWidget,
public QAccessibleTextInterface,
public QAccessibleEditableTextInterface
{
public:
explicit QsciAccessibleScintillaBase(QWidget *widget);
~QsciAccessibleScintillaBase();
static void initialise();
static void selectionChanged(QsciScintillaBase *sb, bool selection);
static void textInserted(QsciScintillaBase *sb, int position,
const char *text, int length);
static void textDeleted(QsciScintillaBase *sb, int position,
const char *text, int length);
static void updated(QsciScintillaBase *sb);
void selection(int selectionIndex, int *startOffset, int *endOffset) const;
int selectionCount() const;
void addSelection(int startOffset, int endOffset);
void removeSelection(int selectionIndex);
void setSelection(int selectionIndex, int startOffset, int endOffset);
int cursorPosition() const;
void setCursorPosition(int position);
QString text(int startOffset, int endOffset) const;
QString textBeforeOffset(int offset,
QAccessible::TextBoundaryType boundaryType, int *startOffset,
int *endOffset) const;
QString textAfterOffset(int offset,
QAccessible::TextBoundaryType boundaryType, int *startOffset,
int *endOffset) const;
QString textAtOffset(int offset,
QAccessible::TextBoundaryType boundaryType, int *startOffset,
int *endOffset) const;
int characterCount() const;
QRect characterRect(int offset) const;
int offsetAtPoint(const QPoint &point) const;
void scrollToSubstring(int startIndex, int endIndex);
QString attributes(int offset, int *startOffset, int *endOffset) const;
void deleteText(int startOffset, int endOffset);
void insertText(int offset, const QString &text);
void replaceText(int startOffset, int endOffset, const QString &text);
QAccessible::State state() const;
void *interface_cast(QAccessible::InterfaceType t);
private:
static bool needs_initialising;
static QList<QsciAccessibleScintillaBase *> all_accessibles;
int current_cursor_offset;
bool is_selection;
static QsciAccessibleScintillaBase *findAccessible(QsciScintillaBase *sb);
QsciScintillaBase *sciWidget() const;
int validPosition(int offset) const;
static bool boundaries(QsciScintillaBase *sb, int position,
QAccessible::TextBoundaryType boundaryType, int *start_position,
int *end_position);
static QString textRange(QsciScintillaBase *sb, int start_position,
int end_position);
static QString bytesAsText(QsciScintillaBase *sb, const char *bytes,
int length);
static QByteArray textAsBytes(QsciScintillaBase *sb, const QString &text);
static int positionAsOffset(QsciScintillaBase *sb, int position);
static void positionRangeAsOffsetRange(QsciScintillaBase *sb,
int start_position, int end_position, int *startOffset,
int *endOffset);
static int offsetAsPosition(QsciScintillaBase *sb, int offset);
static QString colourAsRGB(int colour);
static void addAttribute(QString &attrs, const char *name,
const QString &value);
QFont fontForStyle(int style) const;
};
#endif
#endif
+1 -1
View File
@@ -1,7 +1,7 @@
// The implementation of various Qt version independent classes used by the
// rest of the port.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,7 +1,7 @@
// The definition of various Qt version independent classes used by the rest of
// the port.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,7 +1,7 @@
// Support for building the Scintilla code in the Scintilla namespace using the
// -DSCI_NAMESPACE compiler flag.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+28 -2
View File
@@ -1,6 +1,6 @@
// The implementation of the Qt specific subclass of ScintillaBase.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -31,6 +31,9 @@
#include "Qsci/qsciscintillabase.h"
#include "ScintillaQt.h"
#if !defined(QT_NO_ACCESSIBILITY)
#include "SciAccessibility.h"
#endif
#include "SciClasses.h"
@@ -110,6 +113,11 @@ QsciScintillaQt::QsciScintillaQt(QsciScintillaBase *qsb_)
// This is ignored.
imeInteraction = imeInline;
// Using pixmaps screws things up when moving to a different display
// (although this could be because we haven't got the pixmap code right).
// However Qt shouldn't need buffered drawing anyway.
WndProc(SCI_SETBUFFEREDDRAW, 0, 0);
for (int i = 0; i <= static_cast<int>(tickPlatform); ++i)
timers[i] = 0;
@@ -192,10 +200,12 @@ sptr_t QsciScintillaQt::DefWndProc(unsigned int, uptr_t, sptr_t)
void QsciScintillaQt::SetMouseCapture(bool on)
{
if (mouseDownCaptures)
{
if (on)
qsb->viewport()->grabMouse();
else
qsb->viewport()->releaseMouse();
}
capturedMouse = on;
}
@@ -383,8 +393,17 @@ void QsciScintillaQt::NotifyParent(SCNotification scn)
{
char *text;
#if !defined(QT_NO_ACCESSIBILITY)
if ((scn.modificationType & SC_MOD_INSERTTEXT) != 0)
QsciAccessibleScintillaBase::textInserted(qsb, scn.position,
scn.text, scn.length);
else if ((scn.modificationType & SC_MOD_DELETETEXT) != 0)
QsciAccessibleScintillaBase::textDeleted(qsb, scn.position,
scn.text, scn.length);
#endif
// Give some protection to the Python bindings.
if (scn.text && (scn.modificationType & (SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT) != 0))
if (scn.text && (scn.modificationType & (SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT)) != 0)
{
text = new char[scn.length + 1];
memcpy(text, scn.text, scn.length);
@@ -430,6 +449,9 @@ void QsciScintillaQt::NotifyParent(SCNotification scn)
break;
case SCN_UPDATEUI:
#if !defined(QT_NO_ACCESSIBILITY)
QsciAccessibleScintillaBase::updated(qsb);
#endif
emit qsb->SCN_UPDATEUI(scn.updated);
break;
@@ -567,6 +589,10 @@ void QsciScintillaQt::ClaimSelection()
else
primarySelection = false;
#if !defined(QT_NO_ACCESSIBILITY)
QsciAccessibleScintillaBase::selectionChanged(qsb, isSel);
#endif
emit qsb->QSCN_SELCHANGED(isSel);
}
+1 -1
View File
@@ -1,6 +1,6 @@
// The definition of the Qt specific subclass of ScintillaBase.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+2 -1
View File
@@ -1,6 +1,6 @@
// This module implements the QsciAbstractAPIs class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -47,4 +47,5 @@ QsciLexer *QsciAbstractAPIs::lexer() const
// Called when the user has made a selection from the auto-completion list.
void QsciAbstractAPIs::autoCompletionSelected(const QString &selection)
{
Q_UNUSED(selection);
}
+5 -2
View File
@@ -1,6 +1,6 @@
// This module implements the QsciAPIs class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -128,7 +128,7 @@ private:
// The worker thread ctor.
QsciAPIsWorker::QsciAPIsWorker(QsciAPIs *apis)
: proxy(apis), prepared(0), abort(false)
: prepared(0), proxy(apis), abort(false)
{
}
@@ -250,6 +250,9 @@ bool QsciAPIs::event(QEvent *e)
emit apiPreparationFinished();
return true;
default:
break;
}
return QObject::event(e);
+1 -1
View File
@@ -1,6 +1,6 @@
// This module implements the QsciCommand class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+2 -2
View File
@@ -1,6 +1,6 @@
// This module implements the QsciCommandSet class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -937,7 +937,7 @@ bool QsciCommandSet::writeSettings(QSettings &qs, const char *prefix)
qs.setValue(skey + "key", cmd->key());
// Write the alternate key.
qs.setValue(skey + "alt", cmd->key());
qs.setValue(skey + "alt", cmd->alternateKey());
}
return rc;
+1 -1
View File
@@ -1,6 +1,6 @@
// This module implements the QsciDocument class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+11 -11
View File
@@ -1,6 +1,6 @@
// This module implements the QsciLexer class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -36,11 +36,11 @@ QsciLexer::QsciLexer(QObject *parent)
autoIndStyle(-1), apiSet(0), attached_editor(0)
{
#if defined(Q_OS_WIN)
defFont = QFont("Verdana",10);
defFont = QFont("Verdana", 10);
#elif defined(Q_OS_MAC)
defFont = QFont("Verdana", 12);
defFont = QFont("Menlo", 12);
#else
defFont = QFont("Bitstream Vera Sans",9);
defFont = QFont("Bitstream Vera Sans", 9);
#endif
// Set the default fore and background colours.
@@ -103,7 +103,7 @@ void QsciLexer::setStyleDefaults() const
{
if (!style_map->style_data_set)
{
for (int i = 0; i < 128; ++i)
for (int i = 0; i <= QsciScintillaBase::STYLE_MAX; ++i)
if (!description(i).isEmpty())
styleData(i);
@@ -370,7 +370,7 @@ bool QsciLexer::readSettings(QSettings &qs,const char *prefix)
setStyleDefaults();
// Read the styles.
for (int i = 0; i < 128; ++i)
for (int i = 0; i <= QsciScintillaBase::STYLE_MAX; ++i)
{
// Ignore invalid styles.
if (description(i).isEmpty())
@@ -570,7 +570,7 @@ bool QsciLexer::writeSettings(QSettings &qs,const char *prefix) const
setStyleDefaults();
// Write the styles.
for (int i = 0; i < 128; ++i)
for (int i = 0; i <= QsciScintillaBase::STYLE_MAX; ++i)
{
// Ignore invalid styles.
if (description(i).isEmpty())
@@ -685,7 +685,7 @@ void QsciLexer::setColor(const QColor &c, int style)
emit colorChanged(c, style);
}
else
for (int i = 0; i < 128; ++i)
for (int i = 0; i <= QsciScintillaBase::STYLE_MAX; ++i)
if (!description(i).isEmpty())
setColor(c, i);
}
@@ -700,7 +700,7 @@ void QsciLexer::setEolFill(bool eolfill, int style)
emit eolFillChanged(eolfill, style);
}
else
for (int i = 0; i < 128; ++i)
for (int i = 0; i <= QsciScintillaBase::STYLE_MAX; ++i)
if (!description(i).isEmpty())
setEolFill(eolfill, i);
}
@@ -715,7 +715,7 @@ void QsciLexer::setFont(const QFont &f, int style)
emit fontChanged(f, style);
}
else
for (int i = 0; i < 128; ++i)
for (int i = 0; i <= QsciScintillaBase::STYLE_MAX; ++i)
if (!description(i).isEmpty())
setFont(f, i);
}
@@ -731,7 +731,7 @@ void QsciLexer::setPaper(const QColor &c, int style)
}
else
{
for (int i = 0; i < 128; ++i)
for (int i = 0; i <= QsciScintillaBase::STYLE_MAX; ++i)
if (!description(i).isEmpty())
setPaper(c, i);
+1 -1
View File
@@ -1,6 +1,6 @@
// This module implements the QsciLexerCPP class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,6 +1,6 @@
// This module implements the QsciLexerCustom class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,6 +1,6 @@
// This module implements the QsciLexerHTML class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -1,6 +1,6 @@
// This module implements the QsciLexerJavaScript class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+1 -1
View File
@@ -1,6 +1,6 @@
// This module implements the QsciLexerJSON class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+2 -2
View File
@@ -1,6 +1,6 @@
// This module implements the QsciLexerPython class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -309,7 +309,7 @@ void QsciLexerPython::refreshProperties()
// Read properties from the settings.
bool QsciLexerPython::readProperties(QSettings &qs,const QString &prefix)
{
int rc = true, num;
int rc = true;
fold_comments = qs.value(prefix + "foldcomments", false).toBool();
fold_compact = qs.value(prefix + "foldcompact", true).toBool();
+1 -1
View File
@@ -1,6 +1,6 @@
// This module implements the QsciLexerSQL class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+2 -2
View File
@@ -1,6 +1,6 @@
// This module implements the QsciLexerXML class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -210,7 +210,7 @@ void QsciLexerXML::refreshProperties()
// Read properties from the settings.
bool QsciLexerXML::readProperties(QSettings &qs, const QString &prefix)
{
int rc = QsciLexerHTML::readProperties(qs, prefix), num;
int rc = QsciLexerHTML::readProperties(qs, prefix);
scripts = qs.value(prefix + "scriptsstyled", true).toBool();
+1 -1
View File
@@ -1,6 +1,6 @@
// This module implements the QsciMacro class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+214 -26
View File
@@ -1,6 +1,6 @@
# The project file for the QScintilla library.
#
# Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
# Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
#
# This file is part of QScintilla.
#
@@ -20,14 +20,26 @@
# This must be kept in sync with Python/configure.py, Python/configure-old.py,
# example-Qt4Qt5/application.pro and designer-Qt4Qt5/designer.pro.
!win32:VERSION = 13.0.0
!win32:VERSION = 13.2.1
TEMPLATE = lib
TARGET = qscintilla2
CONFIG += qt warn_off thread exceptions hide_symbols staticlib debug_and_release
INCLUDEPATH += . ../include ../lexlib ../src
CONFIG += qt warn_off thread exceptions hide_symbols
QMAKE_CXXFLAGS += -std=c++11
CONFIG(debug, debug|release) {
mac: {
TARGET = qscintilla2_qt$${QT_MAJOR_VERSION}_debug
} else {
win32: {
TARGET = qscintilla2_qt$${QT_MAJOR_VERSION}d
} else {
TARGET = qscintilla2_qt$${QT_MAJOR_VERSION}
}
}
} else {
TARGET = qscintilla2_qt$${QT_MAJOR_VERSION}
}
INCLUDEPATH += . ../include ../lexlib ../src
!CONFIG(staticlib) {
DEFINES += QSCINTILLA_MAKE_DLL
@@ -43,6 +55,13 @@ greaterThan(QT_MAJOR_VERSION, 4) {
# Work around QTBUG-39300.
CONFIG -= android_install
} else {
DEFINES += QT_NO_ACCESSIBILITY
}
# For old versions of GCC.
unix:!macx {
CONFIG += c++11
}
# Comment this in if you want the internal Scintilla classes to be placed in a
@@ -86,22 +105,56 @@ HEADERS = \
./Qsci/qscicommandset.h \
./Qsci/qscidocument.h \
./Qsci/qscilexer.h \
./Qsci/qscilexercustom.h \
./Qsci/qscilexersql.h \
./Qsci/qscilexerjson.h \
./Qsci/qscilexerhtml.h \
./Qsci/qscilexerxml.h \
./Qsci/qscilexerjavascript.h \
./Qsci/qscilexeravs.h \
./Qsci/qscilexerbash.h \
./Qsci/qscilexerbatch.h \
./Qsci/qscilexercmake.h \
./Qsci/qscilexercoffeescript.h \
./Qsci/qscilexercpp.h \
./Qsci/qscilexercsharp.h \
./Qsci/qscilexercss.h \
./Qsci/qscilexercustom.h \
./Qsci/qscilexerd.h \
./Qsci/qscilexerdiff.h \
./Qsci/qscilexeredifact.h \
./Qsci/qscilexerfortran.h \
./Qsci/qscilexerfortran77.h \
./Qsci/qscilexerhtml.h \
./Qsci/qscilexeridl.h \
./Qsci/qscilexerjava.h \
./Qsci/qscilexerjavascript.h \
./Qsci/qscilexerjson.h \
./Qsci/qscilexerlua.h \
./Qsci/qscilexermakefile.h \
./Qsci/qscilexermarkdown.h \
./Qsci/qscilexermatlab.h \
./Qsci/qscilexeroctave.h \
./Qsci/qscilexerpascal.h \
./Qsci/qscilexerperl.h \
./Qsci/qscilexerpostscript.h \
./Qsci/qscilexerpo.h \
./Qsci/qscilexerpov.h \
./Qsci/qscilexerproperties.h \
./Qsci/qscilexerpython.h \
./Qsci/qscilexerruby.h \
./Qsci/qscilexerspice.h \
./Qsci/qscilexersql.h \
./Qsci/qscilexertcl.h \
./Qsci/qscilexertex.h \
./Qsci/qscilexerverilog.h \
./Qsci/qscilexervhdl.h \
./Qsci/qscilexerxml.h \
./Qsci/qscilexeryaml.h \
./Qsci/qscimacro.h \
./Qsci/qsciprinter.h \
./Qsci/qscistyle.h \
./Qsci/qscistyledtext.h \
ListBoxQt.h \
SciAccessibility.h \
SciClasses.h \
SciNamespace.h \
ScintillaQt.h \
SciAccessibility.h \
../include/ILexer.h \
../include/Platform.h \
../include/Sci_Position.h \
@@ -164,27 +217,162 @@ SOURCES = \
qscicommandset.cpp \
qscidocument.cpp \
qscilexer.cpp \
qscilexercustom.cpp \
qscilexersql.cpp \
qscilexerjson.cpp \
qscilexerhtml.cpp \
qscilexerxml.cpp \
qscilexerjavascript.cpp \
qscilexeravs.cpp \
qscilexerbash.cpp \
qscilexerbatch.cpp \
qscilexercmake.cpp \
qscilexercoffeescript.cpp \
qscilexercpp.cpp \
qscilexercsharp.cpp \
qscilexercss.cpp \
qscilexercustom.cpp \
qscilexerd.cpp \
qscilexerdiff.cpp \
qscilexeredifact.cpp \
qscilexerfortran.cpp \
qscilexerfortran77.cpp \
qscilexerhtml.cpp \
qscilexeridl.cpp \
qscilexerjava.cpp \
qscilexerjavascript.cpp \
qscilexerjson.cpp \
qscilexerlua.cpp \
qscilexermakefile.cpp \
qscilexermarkdown.cpp \
qscilexermatlab.cpp \
qscilexeroctave.cpp \
qscilexerpascal.cpp \
qscilexerperl.cpp \
qscilexerpostscript.cpp \
qscilexerpo.cpp \
qscilexerpov.cpp \
qscilexerproperties.cpp \
qscilexerpython.cpp \
qscilexerruby.cpp \
qscilexerspice.cpp \
qscilexersql.cpp \
qscilexertcl.cpp \
qscilexertex.cpp \
qscilexerverilog.cpp \
qscilexervhdl.cpp \
qscilexerxml.cpp \
qscilexeryaml.cpp \
qscimacro.cpp \
qsciprinter.cpp \
qscistyle.cpp \
qscistyledtext.cpp \
MacPasteboardMime.cpp \
InputMethod.cpp \
MacPasteboardMime.cpp \
InputMethod.cpp \
SciAccessibility.cpp \
SciClasses.cpp \
ListBoxQt.cpp \
PlatQt.cpp \
ScintillaQt.cpp \
../lexers/LexSQL.cpp \
../lexers/LexJSON.cpp \
SciAccessibility.cpp \
../lexers/LexA68k.cpp \
../lexers/LexAbaqus.cpp \
../lexers/LexAda.cpp \
../lexers/LexAPDL.cpp \
../lexers/LexAsm.cpp \
../lexers/LexAsn1.cpp \
../lexers/LexASY.cpp \
../lexers/LexAU3.cpp \
../lexers/LexAVE.cpp \
../lexers/LexAVS.cpp \
../lexers/LexBaan.cpp \
../lexers/LexBash.cpp \
../lexers/LexBasic.cpp \
../lexers/LexBatch.cpp \
../lexers/LexBibTeX.cpp \
../lexers/LexBullant.cpp \
../lexers/LexCaml.cpp \
../lexers/LexCLW.cpp \
../lexers/LexCmake.cpp \
../lexers/LexCOBOL.cpp \
../lexers/LexCoffeeScript.cpp \
../lexers/LexConf.cpp \
../lexers/LexCPP.cpp \
../lexers/LexCrontab.cpp \
../lexers/LexCsound.cpp \
../lexers/LexCSS.cpp \
../lexers/LexD.cpp \
../lexers/LexDiff.cpp \
../lexers/LexDMAP.cpp \
../lexers/LexDMIS.cpp \
../lexers/LexECL.cpp \
../lexers/LexEDIFACT.cpp \
../lexers/LexEiffel.cpp \
../lexers/LexErlang.cpp \
../lexers/LexErrorList.cpp \
../lexers/LexEScript.cpp \
../lexers/LexFlagship.cpp \
../lexers/LexForth.cpp \
../lexers/LexFortran.cpp \
../lexers/LexGAP.cpp \
../lexers/LexGui4Cli.cpp \
../lexers/LexHaskell.cpp \
../lexers/LexHex.cpp \
../lexers/LexHTML.cpp \
../lexers/LexInno.cpp \
../lexers/LexJSON.cpp \
../lexers/LexKix.cpp \
../lexers/LexKVIrc.cpp \
../lexers/LexLaTeX.cpp \
../lexers/LexLisp.cpp \
../lexers/LexLout.cpp \
../lexers/LexLua.cpp \
../lexers/LexMagik.cpp \
../lexers/LexMake.cpp \
../lexers/LexMarkdown.cpp \
../lexers/LexMatlab.cpp \
../lexers/LexMetapost.cpp \
../lexers/LexMMIXAL.cpp \
../lexers/LexModula.cpp \
../lexers/LexMPT.cpp \
../lexers/LexMSSQL.cpp \
../lexers/LexMySQL.cpp \
../lexers/LexNimrod.cpp \
../lexers/LexNsis.cpp \
../lexers/LexNull.cpp \
../lexers/LexOpal.cpp \
../lexers/LexOScript.cpp \
../lexers/LexPascal.cpp \
../lexers/LexPB.cpp \
../lexers/LexPerl.cpp \
../lexers/LexPLM.cpp \
../lexers/LexPO.cpp \
../lexers/LexPOV.cpp \
../lexers/LexPowerPro.cpp \
../lexers/LexPowerShell.cpp \
../lexers/LexProgress.cpp \
../lexers/LexProps.cpp \
../lexers/LexPS.cpp \
../lexers/LexPython.cpp \
../lexers/LexR.cpp \
../lexers/LexRebol.cpp \
../lexers/LexRegistry.cpp \
../lexers/LexRuby.cpp \
../lexers/LexRust.cpp \
../lexers/LexScriptol.cpp \
../lexers/LexSmalltalk.cpp \
../lexers/LexSML.cpp \
../lexers/LexSorcus.cpp \
../lexers/LexSpecman.cpp \
../lexers/LexSpice.cpp \
../lexers/LexSQL.cpp \
../lexers/LexSTTXT.cpp \
../lexers/LexTACL.cpp \
../lexers/LexTADS3.cpp \
../lexers/LexTAL.cpp \
../lexers/LexTCL.cpp \
../lexers/LexTCMD.cpp \
../lexers/LexTeX.cpp \
../lexers/LexTxt2tags.cpp \
../lexers/LexVB.cpp \
../lexers/LexVerilog.cpp \
../lexers/LexVHDL.cpp \
../lexers/LexVisualProlog.cpp \
../lexers/LexYAML.cpp \
../lexlib/Accessor.cpp \
../lexlib/CharacterCategory.cpp \
../lexlib/CharacterSet.cpp \
@@ -210,15 +398,15 @@ SOURCES = \
../src/EditView.cpp \
../src/ExternalLexer.cpp \
../src/Indicator.cpp \
../src/KeyMap.cpp \
../src/KeyMap.cpp \
../src/LineMarker.cpp \
../src/MarginView.cpp \
../src/PerLine.cpp \
../src/PositionCache.cpp \
../src/RESearch.cpp \
../src/RESearch.cpp \
../src/RunStyles.cpp \
../src/ScintillaBase.cpp \
../src/Selection.cpp \
../src/ScintillaBase.cpp \
../src/Selection.cpp \
../src/Style.cpp \
../src/UniConversion.cpp \
../src/ViewStyle.cpp \
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
// This module implements the QsciPrinter class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
+68 -17
View File
@@ -2,7 +2,7 @@
// Scintilla. It is modelled on QTextEdit - a method of the same name should
// behave in the same way.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -264,17 +264,21 @@ void QsciScintilla::handleCharAdded(int ch)
// Handle auto-indentation.
if (autoInd)
{
if (lex.isNull() || (lex->autoIndentStyle() & AiMaintain))
maintainIndentation(ch, pos);
else
autoIndentation(ch, pos);
}
// See if we might want to start auto-completion.
if (!isCallTipActive() && acSource != AcsNone)
{
if (isStartChar(ch))
startAutoCompletion(acSource, false, use_single == AcusAlways);
else if (acThresh >= 1 && isWordCharacter(ch))
startAutoCompletion(acSource, true, use_single == AcusAlways);
}
}
@@ -386,13 +390,8 @@ void QsciScintilla::callTip()
ct = ct_entries.join("\n");
}
QByteArray ct_ba;
if (isUtf8())
ct_ba = ct.toUtf8();
else
ct_ba = ct.toLatin1();
const char *cts = ct_ba.data();
ScintillaBytes ct_bytes = textAsBytes(ct);
const char *cts = ScintillaBytesConstData(ct_bytes);
SendScintilla(SCI_CALLTIPSHOW, adjustedCallTipPosition(shift), cts);
@@ -856,12 +855,16 @@ void QsciScintilla::autoIndentLine(long pos, int line, int indent)
long new_pos = -1;
if (pos_after > pos_before)
{
new_pos = pos + (pos_after - pos_before);
}
else if (pos_after < pos_before && pos >= pos_after)
{
if (pos >= pos_before)
new_pos = pos + (pos_after - pos_before);
else
new_pos = pos_after;
}
if (new_pos >= 0)
SendScintilla(SCI_SETSEL, new_pos, new_pos);
@@ -1276,6 +1279,9 @@ void QsciScintilla::setWrapVisualFlags(WrapVisualFlag endFlag,
switch (endFlag)
{
case WrapFlagNone:
break;
case WrapFlagByText:
flags |= SC_WRAPVISUALFLAG_END;
loc |= SC_WRAPVISUALFLAGLOC_END_BY_TEXT;
@@ -1292,6 +1298,9 @@ void QsciScintilla::setWrapVisualFlags(WrapVisualFlag endFlag,
switch (startFlag)
{
case WrapFlagNone:
break;
case WrapFlagByText:
flags |= SC_WRAPVISUALFLAG_START;
loc |= SC_WRAPVISUALFLAGLOC_START_BY_TEXT;
@@ -1336,6 +1345,9 @@ void QsciScintilla::setFolding(FoldStyle folding, int margin)
// Set the marker symbols to use.
switch (folding)
{
case NoFoldStyle:
break;
case PlainFoldStyle:
setFoldMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS);
setFoldMarker(SC_MARKNUM_FOLDER, SC_MARK_PLUS);
@@ -1636,6 +1648,12 @@ void QsciScintilla::handleModified(int pos, int mtype, const char *text,
int len, int added, int line, int foldNow, int foldPrev, int token,
int annotationLinesAdded)
{
Q_UNUSED(pos);
Q_UNUSED(text);
Q_UNUSED(len);
Q_UNUSED(token);
Q_UNUSED(annotationLinesAdded);
if (mtype & SC_MOD_CHANGEFOLD)
{
if (fold)
@@ -2086,7 +2104,7 @@ void QsciScintilla::setCaretLineVisible(bool enable)
// Set the background colour of a hotspot area.
void QsciScintilla::setHotspotBackgroundColor(const QColor &col)
{
SendScintilla(SCI_SETSELBACK, 1, col);
SendScintilla(SCI_SETHOTSPOTACTIVEBACK, 1, col);
}
@@ -2100,7 +2118,7 @@ void QsciScintilla::setHotspotForegroundColor(const QColor &col)
// Reset the background colour of a hotspot area to the default.
void QsciScintilla::resetHotspotBackgroundColor()
{
SendScintilla(SCI_SETSELBACK, 0UL);
SendScintilla(SCI_SETHOTSPOTACTIVEBACK, 0UL);
}
@@ -4334,6 +4352,29 @@ bool QsciScintilla::event(QEvent *e)
}
// Re-implemented to zoom when the Control modifier is pressed.
void QsciScintilla::wheelEvent(QWheelEvent *e)
{
#if defined(Q_OS_MAC)
const Qt::KeyboardModifier zoom_modifier = Qt::MetaModifier;
#else
const Qt::KeyboardModifier zoom_modifier = Qt::ControlModifier;
#endif
if ((e->modifiers() & zoom_modifier) != 0)
{
if (e->delta() > 0)
zoomIn();
else
zoomOut();
}
else
{
QsciScintillaBase::wheelEvent(e);
}
}
// Re-implemented to handle chenges to the enabled state.
void QsciScintilla::changeEvent(QEvent *e)
{
@@ -4396,12 +4437,15 @@ void QsciScintilla::setEnabledColors(int style, QColor &fore, QColor &back)
// Re-implemented to implement a more Qt-like context menu.
void QsciScintilla::contextMenuEvent(QContextMenuEvent *e)
{
QMenu *menu = createStandardContextMenu();
if (menu)
if (contextMenuNeeded(e->x(), e->y()))
{
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->popup(e->globalPos());
QMenu *menu = createStandardContextMenu();
if (menu)
{
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->popup(e->globalPos());
}
}
}
@@ -4482,22 +4526,29 @@ static QColor asQColor(long sci_colour)
((int)(sci_colour >> 16)) & 0x00ff);
}
// Set the scroll width.
void QsciScintilla::setScrollWidth(int pixelWidth)
{
SendScintilla(SCI_SETSCROLLWIDTH, pixelWidth);
}
int QsciScintilla::getScrollWidth() const
// Get the scroll width.
int QsciScintilla::scrollWidth() const
{
return SendScintilla(SCI_GETSCROLLWIDTH);
}
// Set scroll width tracking.
void QsciScintilla::setScrollWidthTracking(bool enabled)
{
SendScintilla(SCI_SETSCROLLWIDTHTRACKING, enabled);
}
bool QsciScintilla::getScrollWidthTracking() const
// Get scroll width tracking.
bool QsciScintilla::scrollWidthTracking() const
{
return SendScintilla(SCI_GETSCROLLWIDTHTRACKING);
}
+32 -1
View File
@@ -1,6 +1,6 @@
// This module implements the "official" low-level API.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -38,6 +38,7 @@
#include <QStyle>
#include <QTextCodec>
#include "SciAccessibility.h"
#include "ScintillaQt.h"
@@ -89,6 +90,10 @@ QsciScintillaBase::QsciScintillaBase(QWidget *parent)
, clickCausedFocus(false)
#endif
{
#if !defined(QT_NO_ACCESSIBILITY)
QsciAccessibleScintillaBase::initialise();
#endif
connectVerticalScrollBar();
connectHorizontalScrollBar();
@@ -298,6 +303,16 @@ void *QsciScintillaBase::SendScintillaPtrResult(unsigned int msg) const
}
// Re-implemented to handle font changes
void QsciScintillaBase::changeEvent(QEvent *e)
{
if (e->type() == QEvent::FontChange || e->type() == QEvent::ApplicationFontChange)
sci->InvalidateStyleRedraw();
QAbstractScrollArea::changeEvent(e);
}
// Re-implemented to handle the context menu.
void QsciScintillaBase::contextMenuEvent(QContextMenuEvent *e)
{
@@ -827,3 +842,19 @@ void QsciScintillaBase::replaceHorizontalScrollBar(QScrollBar *scrollBar)
setHorizontalScrollBar(scrollBar);
connectHorizontalScrollBar();
}
// Return true if a context menu should be displayed. This is provided as a
// helper to QsciScintilla::contextMenuEvent(). A proper design would break
// backwards compatibility.
bool QsciScintillaBase::contextMenuNeeded(int x, int y) const
{
QSCI_SCI_NAMESPACE(Point) pt(x, y);
// Clear any selection if the mouse is outside.
if (!sci->PointInSelection(pt))
sci->SetEmptySelection(sci->PositionFromLocation(pt));
// Respect SC_POPUP_*.
return sci->ShouldDisplayPopup(pt);
}
+5 -1
View File
@@ -1,6 +1,6 @@
// This module implements the QsciStyle class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
@@ -87,6 +87,10 @@ void QsciStyle::init(int style)
// Apply the style to a particular editor.
void QsciStyle::apply(QsciScintillaBase *sci) const
{
// Don't do anything if the style is invalid.
if (style_nr < 0)
return;
sci->SendScintilla(QsciScintillaBase::SCI_STYLESETFORE, style_nr,
style_color);
sci->SendScintilla(QsciScintillaBase::SCI_STYLESETBACK, style_nr,
+1 -1
View File
@@ -1,6 +1,6 @@
// This module implements the QsciStyledText class.
//
// Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//