diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-30 11:36:13 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-30 11:36:13 -0600 |
commit | 664e37abfe5c796c1279b8295fb030f126b0a7d8 (patch) | |
tree | 85f4e661e5c615f01ee1cdf51ca1250b96efe315 /qt | |
download | tqscintilla-664e37abfe5c796c1279b8295fb030f126b0a7d8.tar.gz tqscintilla-664e37abfe5c796c1279b8295fb030f126b0a7d8.zip |
Initial import of qscintilla from 2007
Diffstat (limited to 'qt')
71 files changed, 28939 insertions, 0 deletions
diff --git a/qt/PlatQt.cpp b/qt/PlatQt.cpp new file mode 100644 index 0000000..160ef70 --- /dev/null +++ b/qt/PlatQt.cpp @@ -0,0 +1,933 @@ +// This module implements the portability layer for the Qt port of Scintilla. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <stdio.h> +#include <stdarg.h> +#include <string.h> + +#include <qapplication.h> +#include <qwidget.h> +#include <qfont.h> +#include <qpixmap.h> +#include <qimage.h> +#include <qstring.h> +#include <qlistbox.h> +#include <qpopupmenu.h> +#include <qdatetime.h> +#include <qpainter.h> +#include <qcursor.h> +#include <qlibrary.h> + +#include "Platform.h" +#include "XPM.h" + +#include "qextscintillabase.h" + + +// Type convertors. +static QFont *PFont(FontID id) +{ + return reinterpret_cast<QFont *>(id); +} + +static QPainter *PSurface(SurfaceID id) +{ + return reinterpret_cast<QPainter *>(id); +} + +static QWidget *PWindow(WindowID id) +{ + return reinterpret_cast<QWidget *>(id); +} + +static QPopupMenu *PMenu(MenuID id) +{ + return reinterpret_cast<QPopupMenu *>(id); +} + + +// Create a Point instance from a long value. +Point Point::FromLong(long lpoint) +{ + return Point(Platform::LowShortFromLong(lpoint), + Platform::HighShortFromLong(lpoint)); +} + + +// Colour palette management. The Qt interface to colours means this class +// doesn't have to do anything. +Palette::Palette() +{ + used = 0; + allowRealization = false; +} + +Palette::~Palette() +{ + Release(); +} + +void Palette::Release() +{ + used = 0; +} + +void Palette::WantFind(ColourPair &cp,bool want) +{ + if (!want) + cp.allocated.Set(cp.desired.AsLong()); +} + +void Palette::Allocate(Window &) +{ +} + + +// Font management. +Font::Font() : id(0) +{ +} + +Font::~Font() +{ +} + +void Font::Create(const char *faceName,int,int size,bool bold,bool italic,bool) +{ + Release(); + + QFont *f = new QFont(); + + // If name of the font begins with a '-', assume, that it is an XLFD. + if (faceName[0] == '-') + f -> setRawName(faceName); + else + { + f -> setFamily(faceName); + f -> setPointSize(size); + f -> setBold(bold); + f -> setItalic(italic); + } + + id = f; +} + +void Font::Release() +{ + if (id) + { + delete PFont(id); + id = 0; + } +} + + +// A surface abstracts a place to draw. +class SurfaceImpl : public Surface +{ +public: + SurfaceImpl(); + virtual ~SurfaceImpl(); + + void Init(WindowID); + void Init(SurfaceID sid,WindowID); + void InitPixMap(int width,int height,Surface *surface_,WindowID); + + void Release(); + bool Initialised() {return painter;} + void PenColour(ColourAllocated fore); + int LogPixelsY() {return 72;} + int DeviceHeightFont(int points) {return points;} + void MoveTo(int x_,int y_) {painter -> moveTo(x_,y_);} + void LineTo(int x_,int y_) {painter -> lineTo(x_,y_);} + void Polygon(Point *pts,int npts,ColourAllocated fore, + ColourAllocated back); + void RectangleDraw(PRectangle rc,ColourAllocated fore, + ColourAllocated back); + void FillRectangle(PRectangle rc,ColourAllocated back); + void FillRectangle(PRectangle rc,Surface &surfacePattern); + void RoundedRectangle(PRectangle rc,ColourAllocated fore, + ColourAllocated back); + void AlphaRectangle(PRectangle rc, int cornerSize, + ColourAllocated fill, int alphaFill, + ColourAllocated outline, int alphaOutline, int flags); + void Ellipse(PRectangle rc,ColourAllocated fore,ColourAllocated back); + void Copy(PRectangle rc,Point from,Surface &surfaceSource); + + void DrawTextNoClip(PRectangle rc,Font &font_,int ybase,const char *s, + int len,ColourAllocated fore,ColourAllocated back); + void DrawTextClipped(PRectangle rc,Font &font_,int ybase,const char *s, + int len,ColourAllocated fore, + ColourAllocated back); + void DrawTextTransparent(PRectangle rc,Font &font_,int ybase, + const char *s,int len,ColourAllocated fore); + void MeasureWidths(Font &font_,const char *s,int len,int *positions); + int WidthText(Font &font_,const char *s,int len); + int WidthChar(Font &font_,char ch); + int Ascent(Font &font_); + int Descent(Font &font_); + int InternalLeading(Font &font_) {return 0;} + int ExternalLeading(Font &font_); + int Height(Font &font_); + int AverageCharWidth(Font &font_) {return WidthChar(font_,'n');} + + int SetPalette(Palette *,bool) {return 0;} + void SetClip(PRectangle rc); + void FlushCachedState() {painter -> flush();} + + void SetUnicodeMode(bool unicodeMode_) {unicodeMode = unicodeMode_;} + void SetDBCSMode(int codePage) {} + + void DrawXPM(PRectangle rc,const XPM *xpm); + +private: + void commonInit(QPainter *painter_,bool mypainter_); + bool setFont(Font &font_); + QString convertText(const char *s,int len); + static QRgb convertQRgb(const ColourAllocated &col, unsigned alpha); + static QColor convertQColor(const ColourAllocated &col, + unsigned alpha = 0xff); + + bool unicodeMode; + bool mypainter; + QPainter *painter; +}; + +Surface *Surface::Allocate() +{ + return new SurfaceImpl; +} + +SurfaceImpl::SurfaceImpl() : unicodeMode(false), mypainter(false), painter(0) +{ +} + +SurfaceImpl::~SurfaceImpl() +{ + Release(); +} + +void SurfaceImpl::commonInit(QPainter *painter_,bool mypainter_) +{ + Release(); + + painter = painter_; + mypainter = mypainter_; +} + +void SurfaceImpl::Init(WindowID) +{ + commonInit(new QPainter(new QWidget()),true); +} + +void SurfaceImpl::Init(SurfaceID sid,WindowID) +{ + commonInit(PSurface(sid),false); +} + +void SurfaceImpl::InitPixMap(int width,int height,Surface *,WindowID) +{ + commonInit(new QPainter(new QPixmap(width,height)),true); +} + +void SurfaceImpl::Release() +{ + if (painter && mypainter) + { + QPaintDevice *pd = painter -> device(); + + delete painter; + + delete pd; + } + + painter = 0; +} + +void SurfaceImpl::PenColour(ColourAllocated fore) +{ + painter -> setPen(convertQColor(fore)); +} + +void SurfaceImpl::Polygon(Point *pts,int npts,ColourAllocated fore, + ColourAllocated back) +{ + QPointArray qpts(npts); + + for (int i = 0; i < npts; ++i) + qpts.setPoint(i,pts[i].x,pts[i].y); + + painter -> setPen(convertQColor(fore)); + painter -> setBrush(convertQColor(back)); + painter -> drawPolygon(qpts); +} + +void SurfaceImpl::RectangleDraw(PRectangle rc,ColourAllocated fore, + ColourAllocated back) +{ + painter -> setPen(convertQColor(fore)); + painter -> setBrush(convertQColor(back)); + painter -> drawRect(rc.left,rc.top, + rc.right - rc.left,rc.bottom - rc.top); +} + +void SurfaceImpl::FillRectangle(PRectangle rc,ColourAllocated back) +{ + painter -> setPen(Qt::NoPen); + painter -> setBrush(convertQColor(back)); + painter -> drawRect(rc.left,rc.top, + rc.right - rc.left,rc.bottom - rc.top); +} + +void SurfaceImpl::FillRectangle(PRectangle rc,Surface &surfacePattern) +{ + SurfaceImpl &si = static_cast<SurfaceImpl &>(surfacePattern); + QPixmap *pm = static_cast<QPixmap *>(si.painter -> device()); + + if (pm) + { + QBrush brsh(Qt::black,*pm); + + painter -> setPen(Qt::NoPen); + painter -> setBrush(brsh); + painter -> drawRect(rc.left,rc.top, + rc.right - rc.left,rc.bottom - rc.top); + } + else + FillRectangle(rc,ColourAllocated(0)); +} + +void SurfaceImpl::RoundedRectangle(PRectangle rc,ColourAllocated fore, + ColourAllocated back) +{ + painter -> setPen(convertQColor(fore)); + painter -> setBrush(convertQColor(back)); + painter -> drawRoundRect(rc.left,rc.top, + rc.right - rc.left,rc.bottom - rc.top); +} + +void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, + ColourAllocated fill, int alphaFill, ColourAllocated outline, + int alphaOutline, int) +{ + int w = rc.right - rc.left; + int h = rc.bottom - rc.top; + + QImage img(w, h, 32); + + img.fill(convertQRgb(fill, alphaFill)); + img.setAlphaBuffer(TRUE); + + // Assume that "cornerSize" means outline width. + if (cornerSize > 0) + { + QRgb oline = convertQRgb(outline, alphaOutline); + + int linew = cornerSize; + + if (linew > w) + linew = w; + + for (int y = 0; y < h; ++y) + { + int x; + + if (y < cornerSize || y >= (h - cornerSize)) + for (x = 0; x < w; ++x) + img.setPixel(x, y, oline); + else + { + for (x = 0; x < linew; ++x) + img.setPixel(x, y, oline); + + for (x = w - 1; x >= w - linew; --x) + img.setPixel(x, y, oline); + } + } + } + + painter->drawImage(rc.left, rc.top, img); +} + +void SurfaceImpl::Ellipse(PRectangle rc,ColourAllocated fore, + ColourAllocated back) +{ + painter -> setPen(convertQColor(fore)); + painter -> setBrush(convertQColor(back)); + painter -> drawEllipse(rc.left,rc.top, + rc.right - rc.left,rc.bottom - rc.top); +} + +void SurfaceImpl::Copy(PRectangle rc,Point from,Surface &surfaceSource) +{ + SurfaceImpl &si = static_cast<SurfaceImpl &>(surfaceSource); + QPaintDevice *spd = si.painter -> device(); + QPaintDevice *dpd = painter -> device(); + + if (spd && dpd) + { + si.painter -> end(); + painter -> end(); + + bitBlt(dpd,rc.left,rc.top,spd,from.x,from.y, + rc.right - rc.left,rc.bottom - rc.top); + + si.painter -> begin(spd); + painter -> begin(dpd); + } +} + +void SurfaceImpl::DrawTextNoClip(PRectangle rc,Font &font_,int ybase, + const char *s,int len,ColourAllocated fore, + ColourAllocated back) +{ + FillRectangle(rc,back); + DrawTextTransparent(rc,font_,ybase,s,len,fore); +} + +void SurfaceImpl::DrawTextClipped(PRectangle rc,Font &font_,int ybase, + const char *s,int len,ColourAllocated fore, + ColourAllocated back) +{ + SetClip(rc); + DrawTextNoClip(rc,font_,ybase,s,len,fore,back); + painter -> setClipping(FALSE); +} + +void SurfaceImpl::DrawTextTransparent(PRectangle rc,Font &font_,int ybase, + const char *s,int len, + ColourAllocated fore) +{ + QString qs = convertText(s,len); + + setFont(font_); + painter -> setPen(convertQColor(fore)); + painter -> drawText(rc.left,ybase,qs); +} + +void SurfaceImpl::DrawXPM(PRectangle rc,const XPM *xpm) +{ + int x, y; + const QPixmap &qpm = xpm -> Pixmap(); + + x = rc.left + (rc.Width() - qpm.width()) / 2; + y = rc.top + (rc.Height() - qpm.height()) / 2; + + painter -> drawPixmap(x,y,qpm); +} + +void SurfaceImpl::MeasureWidths(Font &font_,const char *s,int len, + int *positions) +{ + if (setFont(font_)) + { + int totalWidth = 0, ui = 0; + QString qs = convertText(s,len); + QFontMetrics fm = painter -> fontMetrics(); + + for (int i = 0; i < qs.length(); ++i) + { + totalWidth += fm.width(qs[i]); + + int l = (unicodeMode ? QString(qs[i]).utf8().length() : 1); + + while (l--) + positions[ui++] = totalWidth; + } + } + else + for (int i = 0; i < len; ++i) + positions[i] = i + 1; +} + +int SurfaceImpl::WidthText(Font &font_,const char *s,int len) +{ + if (setFont(font_)) + { + QString qs = convertText(s,len); + + return painter -> fontMetrics().width(qs,qs.length()); + } + + return 1; +} + +int SurfaceImpl::WidthChar(Font &font_,char ch) +{ + if (setFont(font_)) + return painter -> fontMetrics().width(ch); + + return 1; +} + +int SurfaceImpl::Ascent(Font &font_) +{ + if (setFont(font_)) + return painter -> fontMetrics().ascent(); + + return 1; +} + +int SurfaceImpl::Descent(Font &font_) +{ + // Qt doesn't include the baseline in the descent, so add it. + + if (setFont(font_)) + return painter -> fontMetrics().descent() + 1; + + return 1; +} + +int SurfaceImpl::ExternalLeading(Font &font_) +{ + if (setFont(font_)) + return painter -> fontMetrics().leading(); + + return 0; +} + +int SurfaceImpl::Height(Font &font_) +{ + if (setFont(font_)) + return painter -> fontMetrics().height(); + + return 1; +} + +void SurfaceImpl::SetClip(PRectangle rc) +{ + painter -> setClipRect(rc.left,rc.top, + rc.right - rc.left,rc.bottom - rc.top); +} + +// Set the painter font if there is one. Return true if it was set. +bool SurfaceImpl::setFont(Font &font_) +{ + QFont *f = PFont(font_.GetID()); + + if (f) + painter -> setFont(*f); + + return f; +} + +// Convert a Scintilla string to a Qt Unicode string. +QString SurfaceImpl::convertText(const char *s,int len) +{ + if (unicodeMode) + return QString::fromUtf8(s,len); + + QString qs; + + qs.setLatin1(s,len); + + return qs; +} + +// Convert a Scintilla colour and alpha component to a Qt QRgb. +QRgb SurfaceImpl::convertQRgb(const ColourAllocated &col, unsigned alpha) +{ + long c = col.AsLong(); + + unsigned r = c & 0xff; + unsigned g = (c >> 8) & 0xff; + unsigned b = (c >> 16) & 0xff; + + QRgb rgba = (alpha << 24) | (r << 16) | (g << 8) | b; + + return rgba; +} + +// Convert a Scintilla colour, and optional alpha component, to a Qt QColor. +QColor SurfaceImpl::convertQColor(const ColourAllocated &col, unsigned alpha) +{ + return QColor(convertQRgb(col, alpha)); +} + + +// Window (widget) management. +Window::~Window() +{ +} + +void Window::Destroy() +{ + QWidget *w = PWindow(id); + + if (w) + { + delete w; + id = 0; + } +} + +bool Window::HasFocus() +{ + return PWindow(id) -> hasFocus(); +} + +PRectangle Window::GetPosition() +{ + QWidget *w = PWindow(id); + + // Before any size allocated pretend its big enough not to be scrolled. + PRectangle rc(0,0,5000,5000); + + if (w) + { + const QRect &r = w -> geometry(); + + rc.left = r.left(); + rc.top = r.top(); + rc.right = r.right() + 1; + rc.bottom = r.bottom() + 1; + } + + return rc; +} + +void Window::SetPosition(PRectangle rc) +{ + PWindow(id) -> setGeometry(rc.left,rc.top, + rc.right - rc.left,rc.bottom - rc.top); +} + +void Window::SetPositionRelative(PRectangle rc,Window relativeTo) +{ + QWidget *rel = PWindow(relativeTo.id); + QPoint pos = rel -> mapToGlobal(rel -> pos()); + + int x = pos.x() + rc.left; + int y = pos.y() + rc.top; + + PWindow(id) -> setGeometry(x,y,rc.right - rc.left,rc.bottom - rc.top); +} + +PRectangle Window::GetClientPosition() +{ + return GetPosition(); +} + +void Window::Show(bool show) +{ + QWidget *w = PWindow(id); + + if (show) + w -> show(); + else + w -> hide(); +} + +void Window::InvalidateAll() +{ + QWidget *w = PWindow(id); + + if (w) + w -> update(); +} + +void Window::InvalidateRectangle(PRectangle rc) +{ + QWidget *w = PWindow(id); + + if (w) + w -> update(rc.left,rc.top, + rc.right - rc.left,rc.bottom - rc.top); +} + +void Window::SetFont(Font &font) +{ + PWindow(id) -> setFont(*PFont(font.GetID())); +} + +void Window::SetCursor(Cursor curs) +{ + Qt::CursorShape qc; + + switch (curs) + { + case cursorText: + qc = Qt::IbeamCursor; + break; + + case cursorUp: + qc = Qt::UpArrowCursor; + break; + + case cursorWait: + qc = Qt::WaitCursor; + break; + + case cursorHoriz: + qc = Qt::SizeHorCursor; + break; + + case cursorVert: + qc = Qt::SizeVerCursor; + break; + + case cursorHand: + qc = Qt::PointingHandCursor; + break; + + default: + qc = Qt::ArrowCursor; + } + + PWindow(id) -> setCursor(qc); +} + +void Window::SetTitle(const char *s) +{ + PWindow(id) -> setCaption(s); +} + + +// Menu management. +Menu::Menu() : id(0) +{ +} + +void Menu::CreatePopUp() +{ + Destroy(); + id = new QPopupMenu(); +} + +void Menu::Destroy() +{ + QPopupMenu *m = PMenu(id); + + if (m) + { + delete m; + id = 0; + } +} + +void Menu::Show(Point pt,Window &) +{ + PMenu(id) -> popup(QPoint(pt.x,pt.y)); +} + + +class DynamicLibraryImpl : public DynamicLibrary +{ +public: + DynamicLibraryImpl(const char *modulePath) + { + m = new QLibrary(modulePath); + m -> load(); + } + + virtual ~DynamicLibraryImpl() + { + if (m) + delete m; + } + + virtual Function FindFunction(const char *name) + { + if (m) + return m -> resolve(name); + + return 0; + } + + virtual bool IsValid() + { + return m && m -> isLoaded(); + } + +private: + QLibrary* m; +}; + +DynamicLibrary *DynamicLibrary::Load(const char *modulePath) +{ + return new DynamicLibraryImpl(modulePath); +} + + +// Elapsed time. This implementation assumes that the maximum elapsed time is +// less than 48 hours. +ElapsedTime::ElapsedTime() +{ + QTime now = QTime::currentTime(); + + bigBit = now.hour() * 60 * 60 + now.minute() * 60 + now.second(); + littleBit = now.msec(); +} + +double ElapsedTime::Duration(bool reset) +{ + long endBigBit, endLittleBit; + QTime now = QTime::currentTime(); + + endBigBit = now.hour() * 60 * 60 + now.minute() * 60 + now.second(); + endLittleBit = now.msec(); + + double duration = endBigBit - bigBit; + + if (duration < 0 || (duration == 0 && endLittleBit < littleBit)) + duration += 24 * 60 * 60; + + duration += (endLittleBit - littleBit) / 1000.0; + + if (reset) + { + bigBit = endBigBit; + littleBit = endLittleBit; + } + + return duration; +} + + +// Manage system wide parameters. +ColourDesired Platform::Chrome() +{ + return ColourDesired(0xe0,0xe0,0xe0); +} + +ColourDesired Platform::ChromeHighlight() +{ + return ColourDesired(0xff,0xff,0xff); +} + +const char *Platform::DefaultFont() +{ + return QApplication::font().family(); +} + +int Platform::DefaultFontSize() +{ + return QApplication::font().pointSize(); +} + +unsigned int Platform::DoubleClickTime() +{ + return QApplication::doubleClickInterval(); +} + +bool Platform::MouseButtonBounce() +{ + return true; +} + +void Platform::DebugDisplay(const char *s) +{ + qDebug("%s",s); +} + +bool Platform::IsKeyDown(int) +{ + return false; +} + +long Platform::SendScintilla(WindowID w,unsigned int msg,unsigned long wParam, + long lParam) +{ + return static_cast<QextScintillaBase *>(PWindow(w) -> parentWidget()) -> SendScintilla(msg,wParam,lParam); +} + +long Platform::SendScintillaPointer(WindowID w,unsigned int msg, + unsigned long wParam,void *lParam) +{ + return static_cast<QextScintillaBase *>(PWindow(w) -> parentWidget()) -> SendScintilla(msg,wParam,reinterpret_cast<long>(lParam)); +} + +bool Platform::IsDBCSLeadByte(int codepage,char ch) +{ + // We don't support DBCS. + return false; +} + +int Platform::DBCSCharLength(int codePage,const char *s) +{ + // We don't support DBCS. + return 1; +} + +int Platform::DBCSCharMaxLength() +{ + // We don't support DBCS. + return 2; +} + +int Platform::Minimum(int a,int b) +{ + return (a < b) ? a : b; +} + +int Platform::Maximum(int a,int b) +{ + return (a > b) ? a : b; +} + +int Platform::Clamp(int val,int minVal,int maxVal) +{ + if (val > maxVal) + val = maxVal; + + if (val < minVal) + val = minVal; + + return val; +} + + +//#define TRACE + +#ifdef TRACE +void Platform::DebugPrintf(const char *format, ...) +{ + char buffer[2000]; + va_list pArguments; + + va_start(pArguments,format); + vsprintf(buffer,format,pArguments); + va_end(pArguments); + + DebugDisplay(buffer); +} +#else +void Platform::DebugPrintf(const char *, ...) +{ +} +#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) +{ + qFatal("Assertion [%s] failed at %s %d\n",c,file,line); +} diff --git a/qt/SciListBox.cpp b/qt/SciListBox.cpp new file mode 100644 index 0000000..4808ffa --- /dev/null +++ b/qt/SciListBox.cpp @@ -0,0 +1,328 @@ +// This module implements the specialisation of QListBox that handles the +// Scintilla double-click callback. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <stdlib.h> +#include <string.h> + +#include <qapplication.h> +#include <qmap.h> +#include <qpixmap.h> + +#include "SciListBox.h" + + +// The platform specific specialisation of the ListBox abstract class. + +class ListBoxX : public ListBox +{ +public: + ListBoxX(); + virtual ~ListBoxX(); + + CallBackAction cb_action; + void *cb_data; + + virtual void SetFont(Font &font); + virtual void Create(Window &parent,int,Point,int,bool); + virtual void SetAverageCharWidth(int); + virtual void SetVisibleRows(int); + virtual int GetVisibleRows() const; + virtual PRectangle GetDesiredRect(); + virtual int CaretFromEdge(); + virtual void Clear(); + virtual void Append(char *s,int type = -1); + virtual int Length(); + virtual void Select(int n); + virtual int GetSelection(); + virtual int Find(const char *prefix); + virtual void GetValue(int n,char *value,int len); + virtual void Sort(); + virtual void RegisterImage(int type,const char *xpm_data); + virtual void ClearRegisteredImages(); + virtual void SetDoubleClickAction(CallBackAction action,void *data); + virtual void SetList(const char *list,char separator,char typesep); + +private: + SciListBox *slb; + + typedef QMap<int,QPixmap> xpmMap; + xpmMap xset; +}; + + +ListBoxX::ListBoxX() : cb_action(0), cb_data(0), slb(0) +{ +} + + +ListBoxX::~ListBoxX() +{ +} + + +void ListBoxX::SetFont(Font &font) +{ + QFont *f = reinterpret_cast<QFont *>(font.GetID()); + + if (f) + slb -> setFont(*f); +} + + +void ListBoxX::Create(Window &parent,int,Point,int,bool) +{ + // The parent we want is the QextScintillaBase, not the text area. + id = slb = new SciListBox(reinterpret_cast<QWidget *>(parent.GetID()) -> parentWidget(),this); +} + + +void ListBoxX::SetAverageCharWidth(int) +{ + // We rely on QListBox::sizeHint() for the size of the list box rather + // than make calculations based on the average character width and the + // number of visible rows. +} + + +void ListBoxX::SetVisibleRows(int) +{ +} + + +int ListBoxX::GetVisibleRows() const +{ + return slb -> numItemsVisible(); +} + + +PRectangle ListBoxX::GetDesiredRect() +{ + PRectangle rc(0,0,100,100); + + if (slb) + { + QSize sh = slb -> sizeHint(); + + rc.right = sh.width(); + rc.bottom = sh.height(); + } + + return rc; +} + + +int ListBoxX::CaretFromEdge() +{ + int dist = 0; + + // Find the width of the biggest image. + for (xpmMap::Iterator it = xset.begin(); it != xset.end(); ++it) + { + int w = it.data().width(); + + if (dist < w) + dist = w; + } + + if (slb) + dist += slb -> frameWidth(); + + // Fudge factor - adjust if required. + dist += 3; + + return dist; +} + + +void ListBoxX::Clear() +{ + slb -> clear(); +} + + +void ListBoxX::Append(char *s,int type) +{ + xpmMap::ConstIterator it; + + if (type < 0 || (it = xset.find(type)) == xset.end()) + slb -> insertItem(s); + else + slb -> insertItem(it.data(),s); +} + + +int ListBoxX::Length() +{ + return (slb ? slb -> numRows() : 0); +} + + +void ListBoxX::Select(int n) +{ + slb -> setSelected(n,TRUE); +} + + +int ListBoxX::GetSelection() +{ + return slb -> currentItem(); +} + + +int ListBoxX::Find(const char *prefix) +{ + return slb -> index(slb -> findItem(prefix,Qt::CaseSensitive|Qt::BeginsWith)); +} + + +void ListBoxX::GetValue(int n,char *value,int len) +{ + QString s = slb -> text(n); + + if (s.isNull() || len <= 0) + value[0] = '\0'; + else + { + strncpy(value,s.latin1(),len - 1); + value[len - 1] = '\0'; + } +} + + +void ListBoxX::Sort() +{ + slb -> sort(); +} + + +void ListBoxX::RegisterImage(int type,const char *xpm_data) +{ + xset.insert(type,*reinterpret_cast<const QPixmap *>(xpm_data)); +} + + +void ListBoxX::ClearRegisteredImages() +{ + xset.clear(); +} + + +void ListBoxX::SetDoubleClickAction(CallBackAction action,void *data) +{ + cb_action = action; + cb_data = data; +} + + +void ListBoxX::SetList(const char *list,char separator,char typesep) +{ + char *words; + + Clear(); + + if ((words = strdup(list)) != NULL) + { + char *startword = words; + char *numword = NULL; + + for (int i = 0; words[i] != '\0'; i++) + { + if (words[i] == separator) + { + words[i] = '\0'; + + if (numword) + *numword = '\0'; + + Append(startword,numword ? atoi(numword + 1) : -1); + + startword = words + i + 1; + numword = NULL; + } + else if (words[i] == typesep) + { + numword = words + i; + } + } + + if (startword) + { + if (numword) + *numword = '\0'; + + Append(startword,numword ? atoi(numword + 1) : -1); + } + + free(words); + } +} + + +// The ListBox methods that need to be implemented explicitly. + +ListBox::ListBox() +{ +} + + +ListBox::~ListBox() +{ +} + + +ListBox *ListBox::Allocate() +{ + return new ListBoxX(); +} + + +SciListBox::SciListBox(QWidget *parent,ListBoxX *lbx_) + : QListBox(parent,0,WType_Popup|WStyle_Customize|WStyle_NoBorder|WStaticContents), lbx(lbx_) +{ + setFocusProxy(parent); + + setFrameShape(StyledPanel); + setFrameShadow(Plain); + setHScrollBarMode(AlwaysOff); + + connect(this,SIGNAL(doubleClicked(QListBoxItem *)), + SLOT(handleDoubleClick(QListBoxItem *))); + + connect(this,SIGNAL(highlighted(QListBoxItem *)), + SLOT(ensureCurrentVisible())); +} + + +SciListBox::~SciListBox() +{ + // Ensure that the main widget doesn't get a focus out event when this + // is destroyed. + setFocusProxy(0); +} + + +void SciListBox::handleDoubleClick(QListBoxItem *) +{ + if (lbx && lbx -> cb_action) + lbx -> cb_action(lbx -> cb_data); +} diff --git a/qt/SciListBox.h b/qt/SciListBox.h new file mode 100644 index 0000000..2bbcf7d --- /dev/null +++ b/qt/SciListBox.h @@ -0,0 +1,51 @@ +// This sub-class of QListBox is needed to provide slots from which we can call +// ListBox's double-click callback. (And you thought this was a C++ program.) +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef SCILISTBOX_H +#define SCILISTBOX_H + + +#include <qlistbox.h> + +#include "Platform.h" + + +class ListBoxX; + + +class SciListBox : public QListBox +{ + Q_OBJECT + +public: + SciListBox(QWidget *parent,ListBoxX *lbx_); + ~SciListBox(); + +private slots: + void handleDoubleClick(QListBoxItem *); + +private: + ListBoxX *lbx; +}; + +#endif diff --git a/qt/ScintillaQt.cpp b/qt/ScintillaQt.cpp new file mode 100644 index 0000000..4753785 --- /dev/null +++ b/qt/ScintillaQt.cpp @@ -0,0 +1,692 @@ +// The implementation of the Qt specific subclass of ScintillaBase. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qapplication.h> +#include <qscrollbar.h> +#include <qpopupmenu.h> +#include <qstring.h> +#include <qtimer.h> +#include <qclipboard.h> +#include <qdragobject.h> +#include <qpainter.h> + +#include "qextscintillabase.h" +#include "ScintillaQt.h" + + +// We want to use the Scintilla notification names as Qt signal names. +#undef SCEN_CHANGE +#undef SCN_AUTOCSELECTION +#undef SCN_CALLTIPCLICK +#undef SCN_CHARADDED +#undef SCN_DOUBLECLICK +#undef SCN_DWELLEND +#undef SCN_DWELLSTART +#undef SCN_HOTSPOTCLICK +#undef SCN_HOTSPOTDOUBLECLICK +#undef SCN_MACRORECORD +#undef SCN_MARGINCLICK +#undef SCN_MODIFIED +#undef SCN_MODIFYATTEMPTRO +#undef SCN_NEEDSHOWN +#undef SCN_PAINTED +#undef SCN_SAVEPOINTLEFT +#undef SCN_SAVEPOINTREACHED +#undef SCN_STYLENEEDED +#undef SCN_UPDATEUI +#undef SCN_USERLISTSELECTION +#undef SCN_ZOOM + +enum +{ + SCEN_CHANGE = 768, + SCN_AUTOCSELECTION = 2022, + SCN_CALLTIPCLICK = 2021, + SCN_CHARADDED = 2001, + SCN_DOUBLECLICK = 2006, + SCN_DWELLEND = 2017, + SCN_DWELLSTART = 2016, + SCN_HOTSPOTCLICK = 2019, + SCN_HOTSPOTDOUBLECLICK = 2020, + SCN_MACRORECORD = 2009, + SCN_MARGINCLICK = 2010, + SCN_MODIFIED = 2008, + SCN_MODIFYATTEMPTRO = 2004, + SCN_NEEDSHOWN = 2011, + SCN_PAINTED = 2013, + SCN_SAVEPOINTLEFT = 2003, + SCN_SAVEPOINTREACHED = 2002, + SCN_STYLENEEDED = 2000, + SCN_UPDATEUI = 2007, + SCN_USERLISTSELECTION = 2014, + SCN_ZOOM = 2018 +}; + + +// The ctor. +ScintillaQt::ScintillaQt(QextScintillaBase *qsb_) : + capturedMouse(false), qsb(qsb_) +{ + wMain = qsb -> txtarea; + + // We aren't a QObject so we use the API class to do QObject related + // things for us. + qsb -> connect(&qtimer,SIGNAL(timeout()),SLOT(handleTimer())); + + Initialise(); +} + + +// The dtor. +ScintillaQt::~ScintillaQt() +{ + Finalise(); +} + + +// Initialise the instance. +void ScintillaQt::Initialise() +{ + SetTicking(true); +} + + +// Tidy up the instance. +void ScintillaQt::Finalise() +{ + SetTicking(false); + ScintillaBase::Finalise(); +} + + +// Start a drag. +void ScintillaQt::StartDrag() +{ + // Allow applications to re-implement the drag start. + qsb -> startDrag(); +} + + +// Do the real drag start. +void ScintillaQt::StartDragImpl() +{ + QDragObject *dobj = new QTextDrag(textRange(&drag),qsb -> txtarea); + + // Remove the dragged text if it was a move to another widget or + // application. + if (dobj -> drag() && dobj -> target() != qsb -> txtarea) + ClearSelection(); + + inDragDrop = false; + SetDragPosition(invalidPosition); +} + + +// Handle a drag enter event. +void ScintillaQt::dragEnterEvent(QDragEnterEvent *dee) +{ + dragMoveEvent(dee); +} + + +// Handle a drag move event. +void ScintillaQt::dragMoveEvent(QDragMoveEvent *dme) +{ + dme -> acceptAction(QTextDrag::canDecode(dme)); + SetDragPosition(PositionFromLocation(Point(dme -> pos().x(),dme -> pos().y()))); +} + + +// Handle a drag leave event. +void ScintillaQt::dragLeaveEvent(QDragLeaveEvent *dle) +{ + SetDragPosition(invalidPosition); +} + + +// Handle a drop event. +void ScintillaQt::dropEvent(QDropEvent *de) +{ + QString text; + + if (QTextDrag::decode(de,text)) + { + bool moving = (de -> source() == qsb -> txtarea && de -> action() == QDropEvent::Move); + + de -> acceptAction(); + + const char *s; + QCString us; + + if (IsUnicodeMode()) + { + us = text.utf8(); + s = us.data(); + } + else + s = text.latin1(); + + DropAt(posDrop,s,moving,false); + SetDragPosition(invalidPosition); + Redraw(); + } +} + + +// Re-implement to trap certain messages. +sptr_t ScintillaQt::WndProc(unsigned int iMessage,uptr_t wParam,sptr_t lParam) +{ + switch (iMessage) + { + case SCI_GRABFOCUS: + PWindow(wMain) -> setFocus(); + return 0; + + case SCI_GETDIRECTFUNCTION: + return reinterpret_cast<sptr_t>(DirectFunction); + + case SCI_GETDIRECTPOINTER: + return reinterpret_cast<sptr_t>(this); + } + + return ScintillaBase::WndProc(iMessage,wParam,lParam); +} + + +// Windows nonsense. +sptr_t ScintillaQt::DefWndProc(unsigned int,uptr_t,sptr_t) +{ + return 0; +} + + +// Manage the timer. +void ScintillaQt::SetTicking(bool on) +{ + if (timer.ticking != on) + { + timer.ticking = on; + + if (timer.ticking) + qtimer.start(timer.tickSize); + else + qtimer.stop(); + } + + timer.ticksToWait = caret.period; +} + + +// Grab or release the mouse (and keyboard). +void ScintillaQt::SetMouseCapture(bool on) +{ + if (mouseDownCaptures) + if (on) + PWindow(wMain) -> grabMouse(); + else + PWindow(wMain) -> releaseMouse(); + + capturedMouse = on; +} + + +// Return true if the mouse/keyboard are currently grabbed. +bool ScintillaQt::HaveMouseCapture() +{ + return capturedMouse; +} + + +// Set the position of the vertical scrollbar. +void ScintillaQt::SetVerticalScrollPos() +{ + qsb -> vsb -> setValue(topLine); +} + + +// Set the position of the horizontal scrollbar. +void ScintillaQt::SetHorizontalScrollPos() +{ + qsb -> hsb -> setValue(xOffset); +} + + +// Set the extent of the vertical and horizontal scrollbars and return true if +// the view needs re-drawing. +bool ScintillaQt::ModifyScrollBars(int nMax,int nPage) +{ + qsb -> vsb -> setMinValue(0); + qsb -> vsb -> setMaxValue(nMax - nPage + 1); + qsb -> vsb -> setLineStep(1); + qsb -> vsb -> setPageStep(nPage); + + qsb -> hsb -> setMinValue(0); + qsb -> hsb -> setMaxValue(scrollWidth); + qsb -> hsb -> setPageStep(scrollWidth / 10); + + return true; +} + + +// Called after SCI_SETWRAPMODE and SCI_SETHSCROLLBAR. +void ScintillaQt::ReconfigureScrollBars() +{ + // Hide or show the scrollbars if needed. + if (horizontalScrollBarVisible && wrapState == eWrapNone) + qsb->hsb->show(); + else + qsb->hsb->hide(); + + if (verticalScrollBarVisible) + qsb->vsb->show(); + else + qsb->vsb->hide(); +} + + +// Notify interested parties of any change in the document. +void ScintillaQt::NotifyChange() +{ + emit qsb -> SCEN_CHANGE(); +} + + +// Notify interested parties of various events. This is the main mapping +// between Scintilla notifications and Qt signals. +void ScintillaQt::NotifyParent(SCNotification scn) +{ + switch (scn.nmhdr.code) + { + case SCN_CALLTIPCLICK: + emit qsb -> SCN_CALLTIPCLICK(scn.position); + break; + + case SCN_AUTOCSELECTION: + emit qsb -> SCN_AUTOCSELECTION(scn.text,scn.lParam); + break; + + case SCN_CHARADDED: + emit qsb -> SCN_CHARADDED(scn.ch); + break; + + case SCN_DOUBLECLICK: + emit qsb -> SCN_DOUBLECLICK(); + break; + + case SCN_DWELLEND: + emit qsb -> SCN_DWELLEND(scn.position,scn.x,scn.y); + break; + + case SCN_DWELLSTART: + emit qsb -> SCN_DWELLSTART(scn.position,scn.x,scn.y); + break; + + case SCN_HOTSPOTCLICK: + emit qsb -> SCN_HOTSPOTCLICK(scn.position,scn.modifiers); + break; + + case SCN_HOTSPOTDOUBLECLICK: + emit qsb -> SCN_HOTSPOTDOUBLECLICK(scn.position,scn.modifiers); + break; + + case SCN_MACRORECORD: + emit qsb -> SCN_MACRORECORD(scn.message,scn.wParam,scn.lParam); + break; + + case SCN_MARGINCLICK: + emit qsb -> SCN_MARGINCLICK(scn.position,scn.modifiers, + scn.margin); + break; + + case SCN_MODIFIED: + emit qsb -> SCN_MODIFIED(scn.position,scn.modificationType, + scn.text,scn.length,scn.linesAdded, + scn.line,scn.foldLevelNow, + scn.foldLevelPrev); + break; + + case SCN_MODIFYATTEMPTRO: + emit qsb -> SCN_MODIFYATTEMPTRO(); + break; + + case SCN_NEEDSHOWN: + emit qsb -> SCN_NEEDSHOWN(scn.position,scn.length); + break; + + case SCN_PAINTED: + emit qsb -> SCN_PAINTED(); + break; + + case SCN_SAVEPOINTLEFT: + emit qsb -> SCN_SAVEPOINTLEFT(); + break; + + case SCN_SAVEPOINTREACHED: + emit qsb -> SCN_SAVEPOINTREACHED(); + break; + + case SCN_STYLENEEDED: + emit qsb -> SCN_STYLENEEDED(scn.position); + break; + + case SCN_UPDATEUI: + emit qsb -> SCN_UPDATEUI(); + break; + + case SCN_USERLISTSELECTION: + emit qsb -> SCN_USERLISTSELECTION(scn.text,scn.wParam); + break; + + case SCN_ZOOM: + emit qsb -> SCN_ZOOM(); + break; + + default: + qWarning("Unknown notification: %u",scn.nmhdr.code); + } +} + + +// Handle a key that hasn't been filtered out as a command key. Return 0 if we +// haven't handled it. +int ScintillaQt::KeyDefault(int key,int modifiers) +{ + // On Windows Alt Gr is returned as Ctrl-Alt (on X11 it seems to be the + // Meta key). We therefore ignore that combination. +#if defined(Q_OS_WIN) + modifiers &= (SCI_CTRL | SCI_ALT); + + if (modifiers == SCI_CTRL || modifiers == SCI_ALT) + return 0; +#else + if (modifiers & (SCI_CTRL | SCI_ALT)) + return 0; +#endif + + AddChar(key); + + return 1; +} + + +// Convert a text range to a QString. +QString ScintillaQt::textRange(const SelectionText *text) +{ + QString qs; + + if (text -> s) + if (IsUnicodeMode()) + qs = QString::fromUtf8(text -> s); + else + qs.setLatin1(text -> s); + + return qs; +} + + +// Copy the selected text to the clipboard. +void ScintillaQt::CopyToClipboard(const SelectionText &selectedText) +{ + QApplication::clipboard() -> setText(textRange(&selectedText)); +} + + +// Implement copy. +void ScintillaQt::Copy() +{ + if (currentPos != anchor) + { + SelectionText text; + + CopySelectionRange(&text); + CopyToClipboard(text); + } +} + + +// Implement paste. +void ScintillaQt::Paste() +{ + QString str = QApplication::clipboard() -> text(); + + if (str.isEmpty()) + return; + + pdoc -> BeginUndoAction(); + + ClearSelection(); + + int len; + + if (IsUnicodeMode()) + { + QCString s = str.utf8(); + + len = s.length(); + + if (len) + pdoc -> InsertString(currentPos,s.data(),len); + } + else + { + const char *s = str.latin1(); + + len = (s ? strlen(s) : 0); + + if (len) + pdoc -> InsertString(currentPos,s,len); + } + + SetEmptySelection(currentPos + len); + + pdoc -> EndUndoAction(); + + NotifyChange(); + Redraw(); +} + + +// A simple QWidget sub-class to implement a call tip. No need to bother with +// all the moc stuff. +class QtCallTip : public QWidget +{ +public: + QtCallTip(QWidget *parent,ScintillaQt *sci_); + ~QtCallTip(); + +protected: + void paintEvent(QPaintEvent *); + void mousePressEvent(QMouseEvent *me); + +private: + ScintillaQt *sci; +}; + + +// Create a call tip. +QtCallTip::QtCallTip(QWidget *parent,ScintillaQt *sci_) : + QWidget(parent,0,WType_Popup|WStyle_Customize|WStyle_NoBorder), sci(sci_) +{ + // Ensure that the main window keeps the focus (and the caret flashing) + // when this is displayed. + setFocusProxy(parent); +} + + +// Destroy a call tip. +QtCallTip::~QtCallTip() +{ + // Ensure that the main window doesn't receive a focus out event when + // this is destroyed. + setFocusProxy(0); +} + + +// Paint a call tip. +void QtCallTip::paintEvent(QPaintEvent *) +{ + Surface *surfaceWindow = Surface::Allocate(); + + if (surfaceWindow) + { + QPainter p(this); + + surfaceWindow -> Init(&p,0); + sci -> ct.PaintCT(surfaceWindow); + surfaceWindow -> Release(); + + delete surfaceWindow; + } +} + + +// Handle a mouse press in a call tip. +void QtCallTip::mousePressEvent(QMouseEvent *me) +{ + Point pt; + + pt.x = me -> x(); + pt.y = me -> y(); + + sci -> ct.MouseClick(pt); + sci -> CallTipClick(); +} + + +// Create a call tip window. +void ScintillaQt::CreateCallTipWindow(PRectangle rc) +{ + if (!ct.wCallTip.Created()) + ct.wCallTip = ct.wDraw = new QtCallTip(qsb,this); + + PWindow(ct.wCallTip) -> resize(rc.right - rc.left,rc.bottom - rc.top); + ct.wCallTip.Show(); +} + + +// Add an item to the right button menu. +void ScintillaQt::AddToPopUp(const char *label,int cmd,bool enabled) +{ + QPopupMenu *pm = static_cast<QPopupMenu *>(popup.GetID()); + + if (label[0] != '\0') + { + QString tr_label = qApp -> translate("ContextMenu",label); + + pm -> insertItem(tr_label,qsb,SLOT(handlePopUp(int)),0,cmd); + pm -> setItemEnabled(cmd,enabled); + } + else + pm -> insertSeparator(); +} + + +// Claim the selection. +void ScintillaQt::ClaimSelection() +{ + bool isSel = (currentPos != anchor); + + if (isSel) + { + QClipboard *cb = QApplication::clipboard(); + + // If we support X11 style selection then make it available + // now. + if (cb -> supportsSelection()) + { + SelectionText text; + + CopySelectionRange(&text); + + if (text.s) + { + cb -> setSelectionMode(TRUE); + cb -> setText(text.s); + cb -> setSelectionMode(FALSE); + } + } + + primarySelection = true; + } + else + primarySelection = false; + + emit qsb -> QSCN_SELCHANGED(isSel); +} + + +// Unclaim the selection. +void ScintillaQt::UnclaimSelection() +{ + if (primarySelection) + { + primarySelection = false; + qsb -> txtarea -> update(); + } +} + + +// Implemented to provide compatibility with the Windows version. +sptr_t ScintillaQt::DirectFunction(ScintillaQt *sciThis,unsigned int iMessage, + uptr_t wParam,sptr_t lParam) +{ + return sciThis -> WndProc(iMessage,wParam,lParam); +} + + +// Draw the contents of the widget. +void ScintillaQt::paintEvent(QPaintEvent *pe) +{ + bool isUnicodeMode = (pdoc && pdoc -> dbcsCodePage == SC_CP_UTF8); + + paintState = painting; + + const QRect &qr = pe -> rect(); + + rcPaint.left = qr.left(); + rcPaint.top = qr.top(); + rcPaint.right = qr.right() + 1; + rcPaint.bottom = qr.bottom() + 1; + + PRectangle rcText = GetTextRectangle(); + paintingAllText = rcPaint.Contains(rcText); + + Surface *sw = Surface::Allocate(); + + if (sw) + { + QPainter painter(PWindow(wMain)); + + sw -> Init(&painter,0); + sw -> SetUnicodeMode(isUnicodeMode); + Paint(sw,rcPaint); + sw -> Release(); + delete sw; + + // If the painting area was insufficient to cover the new style + // or brace highlight positions then repaint the whole thing. + if (paintState == paintAbandoned) + PWindow(wMain) -> update(); + } + + paintState = notPainting; +} diff --git a/qt/ScintillaQt.h b/qt/ScintillaQt.h new file mode 100644 index 0000000..3190b71 --- /dev/null +++ b/qt/ScintillaQt.h @@ -0,0 +1,117 @@ +// The definition of the Qt specific subclass of ScintillaBase. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef SCINTILLAQT_H +#define SCINTILLAQT_H + + +#include <qtimer.h> + +// These are needed because scintilla class header files don't seem to manage +// their own dependencies properly. +#include <ctype.h> +#include <stdlib.h> +#include "Platform.h" +#include "Scintilla.h" +#include "SVector.h" +#include "CellBuffer.h" +#include "CharClassify.h" +#include "Document.h" +#include "Style.h" +#include "XPM.h" +#include "LineMarker.h" +#include "Indicator.h" +#include "ViewStyle.h" +#include "KeyMap.h" +#include "ContractionState.h" +#include "Editor.h" +#include "AutoComplete.h" +#include "CallTip.h" +#include "SString.h" +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" + +#include "ScintillaBase.h" + + +class QPaintEvent; +class QextScintillaBase; +class QtCallTip; + + +class ScintillaQt : public ScintillaBase +{ + friend class QextScintillaBase; + friend class QtCallTip; + +public: + ScintillaQt(QextScintillaBase *qsb_); + virtual ~ScintillaQt(); + + virtual sptr_t WndProc(unsigned int iMessage,uptr_t wParam, + sptr_t lParam); + +private: + QWidget *PWindow(Window &w) + { + return reinterpret_cast<QWidget *>(w.GetID()); + } + + void Initialise(); + void Finalise(); + void StartDrag(); + void StartDragImpl(); + sptr_t DefWndProc(unsigned int,uptr_t,sptr_t); + void SetTicking(bool); + void SetMouseCapture(bool on); + bool HaveMouseCapture(); + void SetVerticalScrollPos(); + void SetHorizontalScrollPos(); + bool ModifyScrollBars(int nMax,int nPage); + void ReconfigureScrollBars(); + void NotifyChange(); + void NotifyParent(SCNotification scn); + int KeyDefault(int key,int modifiers); + void CopyToClipboard(const SelectionText &selectedText); + void Copy(); + void Paste(); + void CreateCallTipWindow(PRectangle rc); + void AddToPopUp(const char *label,int cmd = 0,bool enabled = true); + void ClaimSelection(); + void UnclaimSelection(); + static sptr_t DirectFunction(ScintillaQt *sci,unsigned int iMessage, + uptr_t wParam,sptr_t lParam); + + QString textRange(const SelectionText *text); + void paintEvent(QPaintEvent *pe); + void dragEnterEvent(QDragEnterEvent *dee); + void dragMoveEvent(QDragMoveEvent *dme); + void dragLeaveEvent(QDragLeaveEvent *dle); + void dropEvent(QDropEvent *de); + + bool capturedMouse; + QextScintillaBase *qsb; + QTimer qtimer; +}; + +#endif diff --git a/qt/qextscintilla.cpp b/qt/qextscintilla.cpp new file mode 100644 index 0000000..7d3290c --- /dev/null +++ b/qt/qextscintilla.cpp @@ -0,0 +1,3031 @@ +// This module implements the "official" high-level API of the Qt port of +// Scintilla. It is modelled on QTextEdit - a method of the same name should +// behave in the same way. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <string.h> +#include <qapplication.h> +#include <qcolor.h> + +#include "qextscintilla.h" +#include "qextscintillalexer.h" +#include "qextscintillaapis.h" +#include "qextscintillacommandset.h" + + +// Make sure these match the values in Scintilla.h. We don't #include that +// file because it just causes more clashes. +#define KEYWORDSET_MAX 8 +#define MARKER_MAX 31 + + +// The default fold margin width. +static const int defaultFoldMarginWidth = 14; + +// The default set of characters that make up a word. +static const char *defaultWordChars = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + + +// The ctor. +QextScintilla::QextScintilla(QWidget *parent,const char *name,WFlags f) + : QextScintillaBase(parent,name,f), allocatedMarkers(0), oldPos(-1), + selText(FALSE), fold(NoFoldStyle), autoInd(FALSE), + braceMode(NoBraceMatch), acSource(AcsDocument), acThresh(-1), + acStart(""), acAPIs(0), ctAPIs(0), maxCallTips(-1), + showSingle(FALSE), modified(FALSE), explicit_fillups(FALSE), + fillups_enabled(FALSE), saved_fillups("") +{ + connect(this,SIGNAL(SCN_MODIFYATTEMPTRO()), + SIGNAL(modificationAttempted())); + + connect(this,SIGNAL(SCN_MODIFIED(int,int,const char *,int,int,int,int,int)), + SLOT(handleModified(int,int,const char *,int,int,int,int,int))); + connect(this,SIGNAL(SCN_CALLTIPCLICK(int)), + SLOT(handleCallTipClick(int))); + connect(this,SIGNAL(SCN_CHARADDED(int)), + SLOT(handleCharAdded(int))); + connect(this,SIGNAL(SCN_MARGINCLICK(int,int,int)), + SLOT(handleMarginClick(int,int,int))); + connect(this,SIGNAL(SCN_SAVEPOINTREACHED()), + SLOT(handleSavePointReached())); + connect(this,SIGNAL(SCN_SAVEPOINTLEFT()), + SLOT(handleSavePointLeft())); + connect(this,SIGNAL(SCN_UPDATEUI()), + SLOT(handleUpdateUI())); + connect(this,SIGNAL(QSCN_SELCHANGED(bool)), + SLOT(handleSelectionChanged(bool))); + connect(this,SIGNAL(SCN_USERLISTSELECTION(const char *,int)), + SLOT(handleUserListSelection(const char *,int))); + + // Set the default font. + setFont(QApplication::font()); + + // Set the default fore and background colours. + QColorGroup cg = QApplication::palette().active(); + setColor(cg.text()); + setPaper(cg.base()); + +#if defined(Q_OS_WIN) + setEolMode(EolWindows); +#elif defined(Q_OS_MAC) + setEolMode(EolMac); +#else + setEolMode(EolUnix); +#endif + + // Capturing the mouse seems to cause problems on multi-head systems. + // Qt should do the right thing anyway. + SendScintilla(SCI_SETMOUSEDOWNCAPTURES,0UL); + + SendScintilla(SCI_SETPROPERTY,"fold","1"); + + setMatchedBraceForegroundColor(blue); + setUnmatchedBraceForegroundColor(red); + + setLexer(); + + // Set the visible policy. These are the same as SciTE's defaults + // which, presumably, are sensible. + SendScintilla(SCI_SETVISIBLEPOLICY,VISIBLE_STRICT|VISIBLE_SLOP,4); + + // Create the standard command set. + stdCmds = new QextScintillaCommandSet(this); + + doc.display(this,0); +} + + +// The dtor. +QextScintilla::~QextScintilla() +{ + doc.undisplay(this); + delete stdCmds; +} + + +// Return the current text colour. +QColor QextScintilla::color() const +{ + return nl_text_colour; +} + + +// Set the text colour. +void QextScintilla::setColor(const QColor &c) +{ + if (lex.isNull()) + { + // Assume style 0 applies to everything so that we don't need to use + // SCI_STYLECLEARALL which clears everything. + SendScintilla(SCI_STYLESETFORE, 0, c); + nl_text_colour = c; + } +} + + +// Return the current paper colour. +QColor QextScintilla::paper() const +{ + return nl_paper_colour; +} + + +// Set the paper colour. +void QextScintilla::setPaper(const QColor &c) +{ + if (lex.isNull()) + { + // Assume style 0 applies to everything so that we don't need to use + // SCI_STYLECLEARALL which clears everything. We still have to set the + // default style as well for the background without any text. + SendScintilla(SCI_STYLESETBACK, 0, c); + SendScintilla(SCI_STYLESETBACK, STYLE_DEFAULT, c); + nl_paper_colour = c; + } +} + + +// Set the default font. +void QextScintilla::setFont(const QFont &f) +{ + if (lex.isNull()) + { + // Assume style 0 applies to everything so that we don't need to use + // SCI_STYLECLEARALL which clears everything. + setStylesFont(f, 0); + nl_font = f; + } +} + + +// Enable/disable auto-indent. +void QextScintilla::setAutoIndent(bool autoindent) +{ + autoInd = autoindent; +} + + +// Set the brace matching mode. +void QextScintilla::setBraceMatching(BraceMatch bm) +{ + braceMode = bm; +} + + +// Handle the addition of a character. +void QextScintilla::handleCharAdded(int ch) +{ + // Ignore if there is a selection. + long pos = SendScintilla(SCI_GETSELECTIONSTART); + + if (pos != SendScintilla(SCI_GETSELECTIONEND) || pos == 0) + return; + + // If auto-completion is already active then see if this character is a + // start character. If it is then create a new list which will be a + // subset of the current one. The case where it isn't a start + // character seem to be handled correctly elsewhere. + if (isListActive()) + { + if (isAutoCStartChar(ch)) + { + cancelList(); + startAutoCompletion(acSource, FALSE, FALSE); + } + + return; + } + + // Handle call tips. + if (strchr("(),", ch) != NULL) + callTip(); + + // 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()) + if (isAutoCStartChar(ch)) + startAutoCompletion(acSource, FALSE, FALSE); + else if (acThresh >= 1 && isWordChar(ch)) + startAutoCompletion(acSource, TRUE, FALSE); +} + + +// See if a call tip is active. +bool QextScintilla::isCallTipActive() +{ + return SendScintilla(SCI_CALLTIPACTIVE); +} + + +// Handle a possible change to any current call tip. +void QextScintilla::callTip() +{ + if (!ctAPIs) + return; + + long pos = SendScintilla(SCI_GETCURRENTPOS); + long linenr = SendScintilla(SCI_LINEFROMPOSITION,pos); + long linelen = SendScintilla(SCI_LINELENGTH,linenr); + + char *lbuf = new char[linelen + 1]; + + int loff = SendScintilla(SCI_GETCURLINE,linelen + 1,lbuf); + + int commas = 0, start = -1; + + // Move backwards through the line looking for the start of the current + // call tip and working out which argument it is. + while (loff > 0) + { + char ch = lbuf[--loff]; + + if (ch == ',') + ++commas; + else if (ch == ')') + { + int depth = 1; + + // Ignore everything back to the start of the + // corresponding parenthesis. + while (loff > 0) + { + ch = lbuf[--loff]; + + if (ch == ')') + ++depth; + else if (ch == '(' && --depth == 0) + break; + } + } + else if (ch == '(' && loff > 0) + { + if (isWordChar(lbuf[loff - 1])) + { + // The parenthesis is preceded by a word so + // find the start of that word. + lbuf[loff--] = '\0'; + + while (loff >= 0) + { + if (!isWordChar(lbuf[loff]) && !isAutoCStartChar(lbuf[loff])) + break; + + --loff; + } + + start = loff + 1; + break; + } + + // We are between parentheses that do not correspond to + // a call tip, so reset the argument count. + commas = 0; + } + } + + // Cancel any existing call tip. + SendScintilla(SCI_CALLTIPCANCEL); + + // Done if there is no new call tip to set. + if (start < 0) + { + delete []lbuf; + return; + } + + QString ct = ctAPIs -> callTips(&lbuf[start],maxCallTips,commas); + + delete []lbuf; + + if (ct.isEmpty()) + return; + + ctpos = SendScintilla(SCI_POSITIONFROMLINE,linenr) + start; + + SendScintilla(SCI_CALLTIPSHOW,ctpos,ct.latin1()); + + // Done if there is more than one line in the call tip or there isn't a + // down arrow at the start. + if (ct[0] == '\002' || ct.find('\n') >= 0) + return; + + // Highlight the current argument. + int astart; + + if (commas == 0) + astart = ct.find('('); + else + { + astart = -1; + + do + astart = ct.find(',',astart + 1); + while (astart >= 0 && --commas > 0); + } + + int len = ct.length(); + + if (astart < 0 || ++astart == len) + return; + + // The end is at the next comma or unmatched closing parenthesis. + int aend, depth = 0; + + for (aend = astart; aend < len; ++aend) + { + QChar ch = ct.at(aend); + + if (ch == ',' && depth == 0) + break; + else if (ch == '(') + ++depth; + else if (ch == ')') + { + if (depth == 0) + break; + + --depth; + } + } + + if (astart != aend) + SendScintilla(SCI_CALLTIPSETHLT,astart,aend); +} + + +// Handle a call tip click. +void QextScintilla::handleCallTipClick(int dir) +{ + if (!ctAPIs) + return; + + QString ct = ctAPIs -> callTipsNextPrev(dir); + + if (ct.isNull()) + return; + + SendScintilla(SCI_CALLTIPSHOW,ctpos,ct.latin1()); +} + + +// Possibly start auto-completion. +void QextScintilla::startAutoCompletion(AutoCompletionSource acs, + bool checkThresh, bool single) +{ + // Get the current line. + long len = SendScintilla(SCI_GETCURLINE) + 1; + + char *line = new char[len]; + + int wend = SendScintilla(SCI_GETCURLINE, len, line); + + // Find the start of the auto-completion text. + int wstart = wend; + bool numeric = true; + + while (wstart > 0) + { + char ch = line[wstart - 1]; + + // Don't auto-complete numbers. + if (ch < '0' || ch > '9') + numeric = false; + + if (!isWordChar(ch) && !isAutoCStartChar(ch)) + break; + + --wstart; + } + + int wlen = wend - wstart; + + if (numeric || wlen == 0 || (checkThresh && wlen < acThresh)) + return; + + // Isolate the auto-completion text. + char *word = &line[wstart]; + line[wend] = '\0'; + + // Generate the string representing the valid words to select from. + QStringList wlist; + bool cs = !SendScintilla(SCI_AUTOCGETIGNORECASE); + + if (acs == AcsAll || acs == AcsDocument) + { + SendScintilla(SCI_SETSEARCHFLAGS,SCFIND_WORDSTART | (cs ? SCFIND_MATCHCASE : 0)); + + long pos = 0; + long dlen = SendScintilla(SCI_GETLENGTH); + long caret = SendScintilla(SCI_GETCURRENTPOS); + QString root(word); + + for (;;) + { + long fstart; + + SendScintilla(SCI_SETTARGETSTART,pos); + SendScintilla(SCI_SETTARGETEND,dlen); + + if ((fstart = SendScintilla(SCI_SEARCHINTARGET,wlen,word)) < 0) + break; + + // Move past the root part. + pos = fstart + wlen; + + // Skip if this is the word we are auto-completing. + if (pos == caret) + continue; + + // Get the rest of this word. + QString w(root); + + while (pos < dlen) + { + char ch = SendScintilla(SCI_GETCHARAT,pos); + + if (!isWordChar(ch)) + break; + + w += ch; + + ++pos; + } + + // Add the word if it isn't already there. + if (wlist.findIndex(w) < 0) + wlist.append(w); + } + } + + if ((acs == AcsAll || acs == AcsAPIs) && acAPIs) + acAPIs->autoCompletionList(word, cs, wlist); + + delete []line; + + if (wlist.isEmpty()) + return; + + wlist.sort(); + + const char sep = '\x03'; + + SendScintilla(SCI_AUTOCSETCHOOSESINGLE,single); + SendScintilla(SCI_AUTOCSETSEPARATOR, sep); + SendScintilla(SCI_AUTOCSHOW, wlen, wlist.join(QChar(sep)).latin1()); +} + + +// Check if a character is an auto-completion start character. +bool QextScintilla::isAutoCStartChar(char ch) const +{ + const char *start_chars = 0; + + if (!lex.isNull()) + start_chars = lex->autoCompletionStartCharacters(); + + if (!start_chars) + start_chars = acStart; + + return (strchr(start_chars, ch) != NULL); +} + + +// Maintain the indentation of the previous line. +void QextScintilla::maintainIndentation(char ch,long pos) +{ + if (ch != '\r' && ch != '\n') + return; + + int curr_line = SendScintilla(SCI_LINEFROMPOSITION,pos); + + // Get the indentation of the preceding non-zero length line. + int ind = 0; + + for (int line = curr_line - 1; line >= 0; --line) + { + if (SendScintilla(SCI_GETLINEENDPOSITION,line) > + SendScintilla(SCI_POSITIONFROMLINE,line)) + { + ind = indentation(line); + break; + } + } + + if (ind > 0) + autoIndentLine(pos,curr_line,ind); +} + + +// Implement auto-indentation. +void QextScintilla::autoIndentation(char ch,long pos) +{ + int curr_line = SendScintilla(SCI_LINEFROMPOSITION,pos); + int ind_width = indentationWidth(); + long curr_line_start = SendScintilla(SCI_POSITIONFROMLINE,curr_line); + + const char *block_start = lex -> blockStart(); + bool start_single = (block_start && strlen(block_start) == 1); + + const char *block_end = lex -> blockEnd(); + bool end_single = (block_end && strlen(block_end) == 1); + + if (end_single && block_end[0] == ch) + { + if ((lex -> autoIndentStyle() & AiClosing) && rangeIsWhitespace(curr_line_start,pos - 1)) + autoIndentLine(pos,curr_line,blockIndent(curr_line - 1) - indentationWidth()); + } + else if (start_single && block_start[0] == ch) + { + // De-indent if we have already indented because the previous + // line was a start of block keyword. + if ((lex->autoIndentStyle() & AiOpening) && curr_line > 0 && getIndentState(curr_line - 1) == isKeywordStart && rangeIsWhitespace(curr_line_start, pos - 1)) + autoIndentLine(pos,curr_line,blockIndent(curr_line - 1) - indentationWidth()); + } + else if (ch == '\r' || ch == '\n') + autoIndentLine(pos,curr_line,blockIndent(curr_line - 1)); +} + + +// Set the indentation for a line. +void QextScintilla::autoIndentLine(long pos,int line,int indent) +{ + if (indent < 0) + return; + + long pos_before = SendScintilla(SCI_GETLINEINDENTPOSITION,line); + SendScintilla(SCI_SETLINEINDENTATION,line,indent); + long pos_after = SendScintilla(SCI_GETLINEINDENTPOSITION,line); + 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); +} + + +// Return the indentation of the block defined by the given line (or something +// significant before). +int QextScintilla::blockIndent(int line) +{ + if (line < 0) + return 0; + + // Handle the trvial case. + if (!lex -> blockStartKeyword() && !lex -> blockStart() && !lex -> blockEnd()) + return indentation(line); + + int line_limit = line - lex -> blockLookback(); + + if (line_limit < 0) + line_limit = 0; + + for (int l = line; l >= line_limit; --l) + { + IndentState istate = getIndentState(l); + + if (istate != isNone) + { + int ind_width = indentationWidth(); + int ind = indentation(l); + + if (istate == isBlockStart) + { + if (lex -> autoIndentStyle() & AiOpening) + ind += ind_width; + } + else if (istate == isBlockEnd) + { + if (!(lex -> autoIndentStyle() & AiClosing)) + ind -= ind_width; + + if (ind < 0) + ind = 0; + } + else if (line == l) + ind += ind_width; + + return ind; + } + } + + return indentation(line); +} + + +// Return TRUE if all characters starting at spos up to, but not including +// epos, are spaces or tabs. +bool QextScintilla::rangeIsWhitespace(long spos,long epos) +{ + while (spos < epos) + { + char ch = SendScintilla(SCI_GETCHARAT,spos); + + if (ch != ' ' && ch != '\t') + return FALSE; + + ++spos; + } + + return TRUE; +} + + +// Returns the indentation state of a line. +QextScintilla::IndentState QextScintilla::getIndentState(int line) +{ + IndentState istate; + + // Get the styled text. + long spos = SendScintilla(SCI_POSITIONFROMLINE,line); + long epos = SendScintilla(SCI_POSITIONFROMLINE,line + 1); + + char *text = new char[(epos - spos + 1) * 2]; + + SendScintilla(SCI_GETSTYLEDTEXT,spos,epos,text); + + int style, bstart_off, bend_off; + + // Block start/end takes precedence over keywords. + const char *bstart_words = lex->blockStart(&style); + bstart_off = findStyledWord(text, style, bstart_words); + + const char *bend_words = lex->blockEnd(&style); + bend_off = findStyledWord(text, style, bend_words); + + // If there is a block start but no block end characters then ignore it + // unless the block start is the last significant thing on the line, + // ie. assume Python-like blocking. + if (bstart_off >= 0 && !bend_words) + for (int i = bstart_off * 2; text[i] != '\0'; i += 2) + if (!QChar(text[i]).isSpace()) + return isNone; + + if (bstart_off > bend_off) + istate = isBlockStart; + else if (bend_off > bstart_off) + istate = isBlockEnd; + else + { + const char *words = lex->blockStartKeyword(&style); + + istate = (findStyledWord(text,style,words) >= 0) ? isKeywordStart : isNone; + } + + delete[] text; + + return istate; +} + + +// text is a pointer to some styled text (ie. a character byte followed by a +// style byte). style is a style number. words is a space separated list of +// words. Returns the position in the text immediately after the last one of +// the words with the style. The reason we are after the last, and not the +// first, occurance is that we are looking for words that start and end a block +// where the latest one is the most significant. +int QextScintilla::findStyledWord(const char *text,int style,const char *words) +{ + if (!words) + return -1; + + // Find the range of text with the style we are looking for. + const char *stext; + + for (stext = text; stext[1] != style; stext += 2) + if (stext[0] == '\0') + return -1; + + // Move to the last character. + const char *etext = stext; + + while (etext[2] != '\0') + etext += 2; + + // Backtrack until we find the style. There will be one. + while (etext[1] != style) + etext -= 2; + + // Look for each word in turn. + while (words[0] != '\0') + { + // Find the end of the word. + const char *eword = words; + + while (eword[1] != ' ' && eword[1] != '\0') + ++eword; + + // Now search the text backwards. + const char *wp = eword; + + for (const char *tp = etext; tp >= stext; tp -= 2) + { + if (tp[0] != wp[0] || tp[1] != style) + { + // Reset the search. + wp = eword; + continue; + } + + // See if all the word has matched. + if (wp-- == words) + return ((tp - text) / 2) + (eword - words) + 1; + } + + // Move to the start of the next word if there is one. + words = eword + 1; + + if (words[0] == ' ') + ++words; + } + + return -1; +} + + +// Return TRUE if the code page is UTF8. +bool QextScintilla::isUtf8() +{ + return (SendScintilla(SCI_GETCODEPAGE) == SC_CP_UTF8); +} + + +// Set the code page. +void QextScintilla::setUtf8(bool cp) +{ + SendScintilla(SCI_SETCODEPAGE,(cp ? SC_CP_UTF8 : 0)); +} + + +// Return the end-of-line mode. +QextScintilla::EolMode QextScintilla::eolMode() +{ + return (EolMode)SendScintilla(SCI_GETEOLMODE); +} + + +// Set the end-of-line mode. +void QextScintilla::setEolMode(EolMode mode) +{ + SendScintilla(SCI_SETEOLMODE,mode); +} + + +// Convert the end-of-lines to a particular mode. +void QextScintilla::convertEols(EolMode mode) +{ + SendScintilla(SCI_CONVERTEOLS,mode); +} + + +// Return the edge colour. +QColor QextScintilla::edgeColor() +{ + long res = SendScintilla(SCI_GETEDGECOLOUR); + + return QColor((int)res, ((int)(res >> 8)) & 0x00ff, ((int)(res >> 16)) & 0x00ff); +} + + +// Set the edge colour. +void QextScintilla::setEdgeColor(const QColor &col) +{ + SendScintilla(SCI_SETEDGECOLOUR,col); +} + + +// Return the edge column. +int QextScintilla::edgeColumn() +{ + return SendScintilla(SCI_GETEDGECOLUMN); +} + + +// Set the edge column. +void QextScintilla::setEdgeColumn(int colnr) +{ + SendScintilla(SCI_SETEDGECOLUMN,colnr); +} + + +// Return the edge mode. +QextScintilla::EdgeMode QextScintilla::edgeMode() +{ + return (EdgeMode)SendScintilla(SCI_GETEDGEMODE); +} + + +// Set the edge mode. +void QextScintilla::setEdgeMode(EdgeMode mode) +{ + SendScintilla(SCI_SETEDGEMODE,mode); +} + + +// Return the end-of-line visibility. +bool QextScintilla::eolVisibility() +{ + return SendScintilla(SCI_GETVIEWEOL); +} + + +// Set the end-of-line visibility. +void QextScintilla::setEolVisibility(bool visible) +{ + SendScintilla(SCI_SETVIEWEOL,visible); +} + + +// Return the whitespace visibility. +QextScintilla::WhitespaceVisibility QextScintilla::whitespaceVisibility() +{ + return (WhitespaceVisibility)SendScintilla(SCI_GETVIEWWS); +} + + +// Set the whitespace visibility. +void QextScintilla::setWhitespaceVisibility(WhitespaceVisibility mode) +{ + SendScintilla(SCI_SETVIEWWS,mode); +} + + +// Return the line wrap mode. +QextScintilla::WrapMode QextScintilla::wrapMode() +{ + return (WrapMode)SendScintilla(SCI_GETWRAPMODE); +} + + +// Set the line wrap mode. +void QextScintilla::setWrapMode(WrapMode mode) +{ + SendScintilla(SCI_SETLAYOUTCACHE, (mode == WrapNone ? SC_CACHE_CARET : SC_CACHE_DOCUMENT)); + SendScintilla(SCI_SETWRAPMODE, mode); +} + + +// Set the line wrap visual flags. +void QextScintilla::setWrapVisualFlags(WrapVisualFlag eflag, + WrapVisualFlag sflag, int sindent) +{ + int flags = SC_WRAPVISUALFLAG_NONE; + int loc = SC_WRAPVISUALFLAGLOC_DEFAULT; + + if (eflag == WrapFlagByText) + { + flags |= SC_WRAPVISUALFLAG_END; + loc |= SC_WRAPVISUALFLAGLOC_END_BY_TEXT; + } + else if (eflag == WrapFlagByBorder) + flags |= SC_WRAPVISUALFLAG_END; + + if (sflag == WrapFlagByText) + { + flags |= SC_WRAPVISUALFLAG_START; + loc |= SC_WRAPVISUALFLAGLOC_START_BY_TEXT; + } + else if (sflag == WrapFlagByBorder) + flags |= SC_WRAPVISUALFLAG_START; + + SendScintilla(SCI_SETWRAPVISUALFLAGS, flags); + SendScintilla(SCI_SETWRAPVISUALFLAGSLOCATION, loc); + SendScintilla(SCI_SETWRAPSTARTINDENT, sindent); +} + + +// Set the folding style. +void QextScintilla::setFolding(FoldStyle folding) +{ + fold = folding; + + if (folding == NoFoldStyle) + { + SendScintilla(SCI_SETMARGINWIDTHN,2,0L); + return; + } + + int mask = SendScintilla(SCI_GETMODEVENTMASK); + SendScintilla(SCI_SETMODEVENTMASK,mask | SC_MOD_CHANGEFOLD); + + SendScintilla(SCI_SETFOLDFLAGS,SC_FOLDFLAG_LINEAFTER_CONTRACTED); + + SendScintilla(SCI_SETMARGINTYPEN,2,(long)SC_MARGIN_SYMBOL); + SendScintilla(SCI_SETMARGINMASKN,2,SC_MASK_FOLDERS); + SendScintilla(SCI_SETMARGINSENSITIVEN,2,1); + + // Set the marker symbols to use. + switch (folding) + { + case PlainFoldStyle: + setFoldMarker(SC_MARKNUM_FOLDEROPEN,SC_MARK_MINUS); + setFoldMarker(SC_MARKNUM_FOLDER,SC_MARK_PLUS); + setFoldMarker(SC_MARKNUM_FOLDERSUB); + setFoldMarker(SC_MARKNUM_FOLDERTAIL); + setFoldMarker(SC_MARKNUM_FOLDEREND); + setFoldMarker(SC_MARKNUM_FOLDEROPENMID); + setFoldMarker(SC_MARKNUM_FOLDERMIDTAIL); + + break; + + case CircledFoldStyle: + setFoldMarker(SC_MARKNUM_FOLDEROPEN,SC_MARK_CIRCLEMINUS); + setFoldMarker(SC_MARKNUM_FOLDER,SC_MARK_CIRCLEPLUS); + setFoldMarker(SC_MARKNUM_FOLDERSUB); + setFoldMarker(SC_MARKNUM_FOLDERTAIL); + setFoldMarker(SC_MARKNUM_FOLDEREND); + setFoldMarker(SC_MARKNUM_FOLDEROPENMID); + setFoldMarker(SC_MARKNUM_FOLDERMIDTAIL); + + break; + + case BoxedFoldStyle: + setFoldMarker(SC_MARKNUM_FOLDEROPEN,SC_MARK_BOXMINUS); + setFoldMarker(SC_MARKNUM_FOLDER,SC_MARK_BOXPLUS); + setFoldMarker(SC_MARKNUM_FOLDERSUB); + setFoldMarker(SC_MARKNUM_FOLDERTAIL); + setFoldMarker(SC_MARKNUM_FOLDEREND); + setFoldMarker(SC_MARKNUM_FOLDEROPENMID); + setFoldMarker(SC_MARKNUM_FOLDERMIDTAIL); + + break; + + case CircledTreeFoldStyle: + setFoldMarker(SC_MARKNUM_FOLDEROPEN,SC_MARK_CIRCLEMINUS); + setFoldMarker(SC_MARKNUM_FOLDER,SC_MARK_CIRCLEPLUS); + setFoldMarker(SC_MARKNUM_FOLDERSUB,SC_MARK_VLINE); + setFoldMarker(SC_MARKNUM_FOLDERTAIL,SC_MARK_LCORNERCURVE); + setFoldMarker(SC_MARKNUM_FOLDEREND,SC_MARK_CIRCLEPLUSCONNECTED); + setFoldMarker(SC_MARKNUM_FOLDEROPENMID,SC_MARK_CIRCLEMINUSCONNECTED); + setFoldMarker(SC_MARKNUM_FOLDERMIDTAIL,SC_MARK_TCORNERCURVE); + + break; + + case BoxedTreeFoldStyle: + setFoldMarker(SC_MARKNUM_FOLDEROPEN,SC_MARK_BOXMINUS); + setFoldMarker(SC_MARKNUM_FOLDER,SC_MARK_BOXPLUS); + setFoldMarker(SC_MARKNUM_FOLDERSUB,SC_MARK_VLINE); + setFoldMarker(SC_MARKNUM_FOLDERTAIL,SC_MARK_LCORNER); + setFoldMarker(SC_MARKNUM_FOLDEREND,SC_MARK_BOXPLUSCONNECTED); + setFoldMarker(SC_MARKNUM_FOLDEROPENMID,SC_MARK_BOXMINUSCONNECTED); + setFoldMarker(SC_MARKNUM_FOLDERMIDTAIL,SC_MARK_TCORNER); + + break; + } + + SendScintilla(SCI_SETMARGINWIDTHN,2,defaultFoldMarginWidth); +} + + +// Set up a folder marker. +void QextScintilla::setFoldMarker(int marknr,int mark) +{ + SendScintilla(SCI_MARKERDEFINE,marknr,mark); + + if (mark != SC_MARK_EMPTY) + { + SendScintilla(SCI_MARKERSETFORE,marknr,white); + SendScintilla(SCI_MARKERSETBACK,marknr,black); + } +} + + +// Handle a click in the fold margin. This is mostly taken from SciTE. +void QextScintilla::foldClick(int lineClick,int bstate) +{ + if ((bstate & ShiftButton) && (bstate & ControlButton)) + { + foldAll(); + return; + } + + int levelClick = SendScintilla(SCI_GETFOLDLEVEL,lineClick); + + if (levelClick & SC_FOLDLEVELHEADERFLAG) + { + if (bstate & ShiftButton) + { + // Ensure all children are visible. + SendScintilla(SCI_SETFOLDEXPANDED,lineClick,1); + foldExpand(lineClick,TRUE,TRUE,100,levelClick); + } + else if (bstate & ControlButton) + { + if (SendScintilla(SCI_GETFOLDEXPANDED,lineClick)) + { + // Contract this line and all its children. + SendScintilla(SCI_SETFOLDEXPANDED,lineClick,0L); + foldExpand(lineClick,FALSE,TRUE,0,levelClick); + } + else + { + // Expand this line and all its children. + SendScintilla(SCI_SETFOLDEXPANDED,lineClick,1); + foldExpand(lineClick,TRUE,TRUE,100,levelClick); + } + } + else + { + // Toggle this line. + SendScintilla(SCI_TOGGLEFOLD,lineClick); + } + } +} + + +// Do the hard work of hiding and showing lines. This is mostly taken from +// SciTE. +void QextScintilla::foldExpand(int &line,bool doExpand,bool force, + int visLevels,int level) +{ + int lineMaxSubord = SendScintilla(SCI_GETLASTCHILD,line,level & SC_FOLDLEVELNUMBERMASK); + + line++; + + while (line <= lineMaxSubord) + { + if (force) + { + if (visLevels > 0) + SendScintilla(SCI_SHOWLINES,line,line); + else + SendScintilla(SCI_HIDELINES,line,line); + } + else if (doExpand) + SendScintilla(SCI_SHOWLINES,line,line); + + int levelLine = level; + + if (levelLine == -1) + levelLine = SendScintilla(SCI_GETFOLDLEVEL,line); + + if (levelLine & SC_FOLDLEVELHEADERFLAG) + { + if (force) + { + if (visLevels > 1) + SendScintilla(SCI_SETFOLDEXPANDED,line,1); + else + SendScintilla(SCI_SETFOLDEXPANDED,line,0L); + + foldExpand(line,doExpand,force,visLevels - 1); + } + else if (doExpand) + { + if (!SendScintilla(SCI_GETFOLDEXPANDED,line)) + SendScintilla(SCI_SETFOLDEXPANDED,line,1); + + foldExpand(line,TRUE,force,visLevels - 1); + } + else + foldExpand(line,FALSE,force,visLevels - 1); + } + else + line++; + } +} + + +// Fully expand (if there is any line currently folded) all text. Otherwise, +// fold all text. This is mostly taken from SciTE. +void QextScintilla::foldAll(bool children) +{ + recolor(); + + int maxLine = SendScintilla(SCI_GETLINECOUNT); + bool expanding = TRUE; + + for (int lineSeek = 0; lineSeek < maxLine; lineSeek++) + { + if (SendScintilla(SCI_GETFOLDLEVEL,lineSeek) & SC_FOLDLEVELHEADERFLAG) + { + expanding = !SendScintilla(SCI_GETFOLDEXPANDED,lineSeek); + break; + } + } + + for (int line = 0; line < maxLine; line++) + { + int level = SendScintilla(SCI_GETFOLDLEVEL,line); + + if (!(level & SC_FOLDLEVELHEADERFLAG)) + continue; + + if (children || + (SC_FOLDLEVELBASE == (level & SC_FOLDLEVELNUMBERMASK))) + { + if (expanding) + { + SendScintilla(SCI_SETFOLDEXPANDED,line,1); + foldExpand(line,TRUE,FALSE,0,level); + line--; + } + else + { + int lineMaxSubord = SendScintilla(SCI_GETLASTCHILD,line,-1); + + SendScintilla(SCI_SETFOLDEXPANDED,line,0L); + + if (lineMaxSubord > line) + SendScintilla(SCI_HIDELINES,line + 1,lineMaxSubord); + } + } + } +} + + +// Handle a fold change. This is mostly taken from SciTE. +void QextScintilla::foldChanged(int line,int levelNow,int levelPrev) +{ + if (levelNow & SC_FOLDLEVELHEADERFLAG) + { + if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) + SendScintilla(SCI_SETFOLDEXPANDED,line,1); + } + else if (levelPrev & SC_FOLDLEVELHEADERFLAG) + { + if (!SendScintilla(SCI_GETFOLDEXPANDED,line)) + { + // Removing the fold from one that has been contracted + // so should expand. Otherwise lines are left + // invisible with no way to make them visible. + foldExpand(line,TRUE,FALSE,0,levelPrev); + } + } +} + + +// Toggle the fold for a line if it contains a fold marker. +void QextScintilla::foldLine(int line) +{ + SendScintilla(SCI_TOGGLEFOLD,line); +} + + +// Handle the SCN_MODIFIED notification. +void QextScintilla::handleModified(int pos,int mtype,const char *text,int len, + int added,int line,int foldNow,int foldPrev) +{ + if (mtype & SC_MOD_CHANGEFOLD) + { + if (fold) + foldChanged(line,foldNow,foldPrev); + } + else if (mtype & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) + emit textChanged(); +} + + +// Zoom in a number of points. +void QextScintilla::zoomIn(int range) +{ + zoomTo(SendScintilla(SCI_GETZOOM) + range); +} + + +// Zoom in a single point. +void QextScintilla::zoomIn() +{ + SendScintilla(SCI_ZOOMIN); +} + + +// Zoom out a number of points. +void QextScintilla::zoomOut(int range) +{ + zoomTo(SendScintilla(SCI_GETZOOM) - range); +} + + +// Zoom out a single point. +void QextScintilla::zoomOut() +{ + SendScintilla(SCI_ZOOMOUT); +} + + +// Set the zoom to a number of points. +void QextScintilla::zoomTo(int size) +{ + if (size < -10) + size = -10; + else if (size > 20) + size = 20; + + SendScintilla(SCI_SETZOOM,size); +} + + +// Find the first occurrence of a string. +bool QextScintilla::findFirst(const QString &expr,bool re,bool cs,bool wo, + bool wrap,bool forward,int line,int index, + bool show) +{ + findState.inProgress = FALSE; + + if (expr.isEmpty()) + return FALSE; + + findState.expr = expr; + findState.wrap = wrap; + findState.forward = forward; + + findState.flags = (cs ? SCFIND_MATCHCASE : 0) | + (wo ? SCFIND_WHOLEWORD : 0) | + (re ? SCFIND_REGEXP : 0); + + if (line < 0 || index < 0) + findState.startpos = SendScintilla(SCI_GETCURRENTPOS); + else + findState.startpos = posFromLineIndex(line,index); + + if (forward) + findState.endpos = SendScintilla(SCI_GETLENGTH); + else + findState.endpos = 0; + + findState.show = show; + + return doFind(); +} + + +// Find the next occurrence of a string. +bool QextScintilla::findNext() +{ + if (!findState.inProgress) + return FALSE; + + return doFind(); +} + + +// Do the hard work of findFirst() and findNext(). +bool QextScintilla::doFind() +{ + SendScintilla(SCI_SETSEARCHFLAGS,findState.flags); + + long pos = simpleFind(); + + // See if it was found. If not and wraparound is wanted, try again. + if (pos == -1 && findState.wrap) + { + if (findState.forward) + { + findState.startpos = 0; + findState.endpos = SendScintilla(SCI_GETLENGTH); + } + else + { + findState.startpos = SendScintilla(SCI_GETLENGTH); + findState.endpos = 0; + } + + pos = simpleFind(); + } + + if (pos == -1) + { + findState.inProgress = FALSE; + return FALSE; + } + + // It was found. + long targstart = SendScintilla(SCI_GETTARGETSTART); + long targend = SendScintilla(SCI_GETTARGETEND); + + // Ensure the text found is visible if required. + if (findState.show) + { + int startLine = SendScintilla(SCI_LINEFROMPOSITION,targstart); + int endLine = SendScintilla(SCI_LINEFROMPOSITION,targend); + + for (int i = startLine; i <= endLine; ++i) + SendScintilla(SCI_ENSUREVISIBLEENFORCEPOLICY,i); + } + + // Now set the selection. + SendScintilla(SCI_SETSEL,targstart,targend); + + // Finally adjust the start position so that we don't find the same one + // again. + if (findState.forward) + findState.startpos = targend; + else if ((findState.startpos = targstart - 1) < 0) + findState.startpos = 0; + + findState.inProgress = TRUE; + return TRUE; +} + + +// Do a simple find between the start and end positions. +long QextScintilla::simpleFind() +{ + if (findState.startpos == findState.endpos) + return -1; + + SendScintilla(SCI_SETTARGETSTART,findState.startpos); + SendScintilla(SCI_SETTARGETEND,findState.endpos); + + long pos; + + if (isUtf8()) + { + QCString s = findState.expr.utf8(); + + pos = SendScintilla(SCI_SEARCHINTARGET,s.length(),s.data()); + } + else + { + const char *s = findState.expr.latin1(); + + pos = SendScintilla(SCI_SEARCHINTARGET,strlen(s),s); + } + + return pos; +} + + +// Replace the text found with the previous findFirst() or findNext(). +void QextScintilla::replace(const QString &replaceStr) +{ + if (!findState.inProgress) + return; + + long start = SendScintilla(SCI_GETSELECTIONSTART); + + SendScintilla(SCI_TARGETFROMSELECTION); + + long len; + int cmd = (findState.flags & SCFIND_REGEXP) ? SCI_REPLACETARGETRE : SCI_REPLACETARGET; + + if (isUtf8()) + len = SendScintilla(cmd,-1,replaceStr.utf8().data()); + else + len = SendScintilla(cmd,-1,replaceStr.latin1()); + + // Reset the selection. + SendScintilla(SCI_SETSELECTIONSTART,start); + SendScintilla(SCI_SETSELECTIONEND,start + len); + + if (findState.forward) + findState.startpos = start + len; +} + + +// Query the modified state. +bool QextScintilla::isModified() +{ + // We don't use SCI_GETMODIFY as it seems to be buggy in Scintilla + // v1.61. + return modified; +} + + +// Set the modified state. +void QextScintilla::setModified(bool m) +{ + if (!m) + SendScintilla(SCI_SETSAVEPOINT); +} + + +// Handle the SCN_MARGINCLICK notification. +void QextScintilla::handleMarginClick(int pos,int modifiers,int margin) +{ + int state = 0; + + if (modifiers & SCMOD_SHIFT) + state |= ShiftButton; + + if (modifiers & SCMOD_CTRL) + state |= ControlButton; + + if (modifiers & SCMOD_ALT) + state |= AltButton; + + int line = SendScintilla(SCI_LINEFROMPOSITION,pos); + + if (fold && margin == 2) + foldClick(line,state); + else + emit marginClicked(margin,line,(ButtonState)state); +} + + +// Handle the SCN_SAVEPOINTREACHED notification. +void QextScintilla::handleSavePointReached() +{ + if (modified) + { + modified = FALSE; + emit modificationChanged(FALSE); + } +} + + +// Handle the SCN_SAVEPOINTLEFT notification. +void QextScintilla::handleSavePointLeft() +{ + if (!modified) + { + modified = TRUE; + emit modificationChanged(TRUE); + } +} + + +// Handle the QSCN_SELCHANGED signal. +void QextScintilla::handleSelectionChanged(bool yes) +{ + selText = yes; + + emit copyAvailable(yes); + emit selectionChanged(); +} + + +// Get the current selection. +void QextScintilla::getSelection(int *lineFrom,int *indexFrom, + int *lineTo,int *indexTo) +{ + if (selText) + { + lineIndexFromPos(SendScintilla(SCI_GETSELECTIONSTART), + lineFrom,indexFrom); + lineIndexFromPos(SendScintilla(SCI_GETSELECTIONEND), + lineTo,indexTo); + } + else + *lineFrom = *indexFrom = *lineTo = *indexTo = -1; +} + + +// Sets the current selection. +void QextScintilla::setSelection(int lineFrom,int indexFrom, + int lineTo,int indexTo) +{ + SendScintilla(SCI_SETSELECTIONSTART,posFromLineIndex(lineFrom,indexFrom)); + SendScintilla(SCI_SETSELECTIONEND,posFromLineIndex(lineTo,indexTo)); +} + + +// Set the background colour of selected text. +void QextScintilla::setSelectionBackgroundColor(const QColor &col) +{ + SendScintilla(SCI_SETSELBACK,1,col); + + int alpha = qAlpha(col.rgb()); + + if (alpha < 255) + SendScintilla(SCI_SETSELALPHA, alpha); +} + + +// Set the foreground colour of selected text. +void QextScintilla::setSelectionForegroundColor(const QColor &col) +{ + SendScintilla(SCI_SETSELFORE,1,col); +} + + +// Reset the background colour of selected text to the default. +void QextScintilla::resetSelectionBackgroundColor() +{ + SendScintilla(SCI_SETSELALPHA, SC_ALPHA_NOALPHA); + SendScintilla(SCI_SETSELBACK,0UL); +} + + +// Reset the foreground colour of selected text to the default. +void QextScintilla::resetSelectionForegroundColor() +{ + SendScintilla(SCI_SETSELFORE,0UL); +} + + +// Set the width of the caret. +void QextScintilla::setCaretWidth(int width) +{ + SendScintilla(SCI_SETCARETWIDTH,width); +} + + +// Set the foreground colour of the caret. +void QextScintilla::setCaretForegroundColor(const QColor &col) +{ + SendScintilla(SCI_SETCARETFORE,col); +} + + +// Set the background colour of the line containing the caret. +void QextScintilla::setCaretLineBackgroundColor(const QColor &col) +{ + SendScintilla(SCI_SETCARETLINEBACK,col); + + int alpha = qAlpha(col.rgb()); + + if (alpha < 255) + SendScintilla(SCI_SETCARETLINEBACKALPHA, alpha); +} + + +// Set the state of the background colour of the line containing the caret. +void QextScintilla::setCaretLineVisible(bool enable) +{ + SendScintilla(SCI_SETCARETLINEVISIBLE,enable); +} + + +// Query the read-only state. +bool QextScintilla::isReadOnly() +{ + return SendScintilla(SCI_GETREADONLY); +} + + +// Set the read-only state. +void QextScintilla::setReadOnly(bool ro) +{ + SendScintilla(SCI_SETREADONLY,ro); +} + + +// Append the given text. +void QextScintilla::append(const QString &text) +{ + bool ro = ensureRW(); + + if (isUtf8()) + { + QCString s = text.utf8(); + + SendScintilla(SCI_APPENDTEXT,s.length(),s.data()); + } + else + { + const char *s = text.latin1(); + + SendScintilla(SCI_APPENDTEXT,strlen(s),s); + } + + SendScintilla(SCI_EMPTYUNDOBUFFER); + + setReadOnly(ro); +} + + +// Insert the given text at the current position. +void QextScintilla::insert(const QString &text) +{ + bool ro = ensureRW(); + + SendScintilla(SCI_BEGINUNDOACTION); + + if (isUtf8()) + SendScintilla(SCI_INSERTTEXT,-1,text.utf8().data()); + else + SendScintilla(SCI_INSERTTEXT,-1,text.latin1()); + + SendScintilla(SCI_ENDUNDOACTION); + + setReadOnly(ro); +} + + +// Insert the given text at the given position. +void QextScintilla::insertAt(const QString &text,int line,int index) +{ + bool ro = ensureRW(); + long position = posFromLineIndex(line,index); + + SendScintilla(SCI_BEGINUNDOACTION); + + if (isUtf8()) + SendScintilla(SCI_INSERTTEXT,position,text.utf8().data()); + else + SendScintilla(SCI_INSERTTEXT,position,text.latin1()); + + SendScintilla(SCI_ENDUNDOACTION); + + setReadOnly(ro); +} + + +// Begin a sequence of undoable actions. +void QextScintilla::beginUndoAction() +{ + SendScintilla(SCI_BEGINUNDOACTION); +} + + +// End a sequence of undoable actions. +void QextScintilla::endUndoAction() +{ + SendScintilla(SCI_ENDUNDOACTION); +} + + +// Redo a sequence of actions. +void QextScintilla::redo() +{ + SendScintilla(SCI_REDO); +} + + +// Undo a sequence of actions. +void QextScintilla::undo() +{ + SendScintilla(SCI_UNDO); +} + + +// See if there is something to redo. +bool QextScintilla::isRedoAvailable() +{ + return SendScintilla(SCI_CANREDO); +} + + +// See if there is something to undo. +bool QextScintilla::isUndoAvailable() +{ + return SendScintilla(SCI_CANUNDO); +} + + +// Return the number of lines. +int QextScintilla::lines() +{ + return SendScintilla(SCI_GETLINECOUNT); +} + + +// Return the line at a position. +int QextScintilla::lineAt(const QPoint &pos) +{ + long chpos = SendScintilla(SCI_POSITIONFROMPOINTCLOSE,pos.x(),pos.y()); + + if (chpos < 0) + return -1; + + return SendScintilla(SCI_LINEFROMPOSITION,chpos); +} + + +// Return the length of a line. +int QextScintilla::lineLength(int line) +{ + if (line < 0 || line >= SendScintilla(SCI_GETLINECOUNT)) + return -1; + + return SendScintilla(SCI_LINELENGTH,line); +} + + +// Return the length of the current text. +int QextScintilla::length() +{ + return SendScintilla(SCI_GETTEXTLENGTH); +} + + +// Remove any selected text. +void QextScintilla::removeSelectedText() +{ + SendScintilla(SCI_REPLACESEL,""); +} + + +// Return the current selected text. +QString QextScintilla::selectedText() +{ + if (!selText) + return QString(); + + // Scintilla doesn't tell us the length of the selected text so we use + // the length of the whole document. + char *buf = new char[length() + 1]; + + SendScintilla(SCI_GETSELTEXT,buf); + + QString qs = convertText(buf); + delete[] buf; + + return qs; +} + + +// Return the current text. +QString QextScintilla::text() +{ + int buflen = length() + 1; + char *buf = new char[buflen]; + + SendScintilla(SCI_GETTEXT,buflen,buf); + + QString qs = convertText(buf); + delete[] buf; + + return qs; +} + + +// Return the text of a line. +QString QextScintilla::text(int line) +{ + int line_len = lineLength(line); + + if (line_len < 1) + return QString(); + + char *buf = new char[line_len + 1]; + + SendScintilla(SCI_GETLINE,line,buf); + buf[line_len] = '\0'; + + QString qs = convertText(buf); + delete[] buf; + + return qs; +} + + +// Set the given text. +void QextScintilla::setText(const QString &text) +{ + bool ro = ensureRW(); + + if (isUtf8()) + SendScintilla(SCI_SETTEXT,text.utf8().data()); + else + SendScintilla(SCI_SETTEXT,text.latin1()); + + SendScintilla(SCI_EMPTYUNDOBUFFER); + + setReadOnly(ro); +} + + +// Get the cursor position +void QextScintilla::getCursorPosition(int *line,int *index) +{ + long pos = SendScintilla(SCI_GETCURRENTPOS); + long lin = SendScintilla(SCI_LINEFROMPOSITION,pos); + long linpos = SendScintilla(SCI_POSITIONFROMLINE,lin); + + *line = lin; + *index = pos - linpos; +} + + +// Set the cursor position +void QextScintilla::setCursorPosition(int line,int index) +{ + SendScintilla(SCI_GOTOPOS,posFromLineIndex(line,index)); +} + + +// Ensure the cursor is visible. +void QextScintilla::ensureCursorVisible() +{ + SendScintilla(SCI_SCROLLCARET); +} + + +// Ensure a line is visible. +void QextScintilla::ensureLineVisible(int line) +{ + SendScintilla(SCI_ENSUREVISIBLEENFORCEPOLICY,line); +} + + +// Copy text to the clipboard. +void QextScintilla::copy() +{ + SendScintilla(SCI_COPY); +} + + +// Cut text to the clipboard. +void QextScintilla::cut() +{ + SendScintilla(SCI_CUT); +} + + +// Paste text from the clipboard. +void QextScintilla::paste() +{ + SendScintilla(SCI_PASTE); +} + + +// Select all text, or deselect any selected text. +void QextScintilla::selectAll(bool select) +{ + if (selText) + SendScintilla(SCI_SETANCHOR,SendScintilla(SCI_GETCURRENTPOS)); + else + SendScintilla(SCI_SELECTALL); +} + + +// Delete all text. +void QextScintilla::clear() +{ + bool ro = ensureRW(); + + SendScintilla(SCI_BEGINUNDOACTION); + SendScintilla(SCI_CLEARALL); + SendScintilla(SCI_ENDUNDOACTION); + + setReadOnly(ro); +} + + +// Return the indentation of a line. +int QextScintilla::indentation(int line) +{ + return SendScintilla(SCI_GETLINEINDENTATION,line); +} + + +// Set the indentation of a line. +void QextScintilla::setIndentation(int line,int indentation) +{ + SendScintilla(SCI_BEGINUNDOACTION); + SendScintilla(SCI_SETLINEINDENTATION,line,indentation); + SendScintilla(SCI_ENDUNDOACTION); +} + + +// Indent a line. +void QextScintilla::indent(int line) +{ + setIndentation(line,indentation(line) + indentWidth()); +} + + +// Unindent a line. +void QextScintilla::unindent(int line) +{ + int newIndent = indentation(line) - indentWidth(); + + if (newIndent < 0) + newIndent = 0; + + setIndentation(line,newIndent); +} + + +// Return the indentation of the current line. +int QextScintilla::currentIndent() +{ + return indentation(SendScintilla(SCI_LINEFROMPOSITION,SendScintilla(SCI_GETCURRENTPOS))); +} + + +// Return the current indentation width. +int QextScintilla::indentWidth() +{ + int w = indentationWidth(); + + if (w == 0) + w = tabWidth(); + + return w; +} + + +// Return the state of indentation guides. +bool QextScintilla::indentationGuides() +{ + return SendScintilla(SCI_GETINDENTATIONGUIDES); +} + + +// Enable and disable indentation guides. +void QextScintilla::setIndentationGuides(bool enable) +{ + SendScintilla(SCI_SETINDENTATIONGUIDES,enable); +} + + +// Set the background colour of indentation guides. +void QextScintilla::setIndentationGuidesBackgroundColor(const QColor &col) +{ + SendScintilla(SCI_STYLESETBACK,STYLE_INDENTGUIDE,col); +} + + +// Set the foreground colour of indentation guides. +void QextScintilla::setIndentationGuidesForegroundColor(const QColor &col) +{ + SendScintilla(SCI_STYLESETFORE,STYLE_INDENTGUIDE,col); +} + + +// Return the indentation width. +int QextScintilla::indentationWidth() +{ + return SendScintilla(SCI_GETINDENT); +} + + +// Set the indentation width. +void QextScintilla::setIndentationWidth(int width) +{ + SendScintilla(SCI_SETINDENT,width); +} + + +// Return the tab width. +int QextScintilla::tabWidth() +{ + return SendScintilla(SCI_GETTABWIDTH); +} + + +// Set the tab width. +void QextScintilla::setTabWidth(int width) +{ + SendScintilla(SCI_SETTABWIDTH,width); +} + + +// Return the effect of the backspace key. +bool QextScintilla::backspaceUnindents() +{ + return SendScintilla(SCI_GETBACKSPACEUNINDENTS); +} + + +// Set the effect of the backspace key. +void QextScintilla::setBackspaceUnindents(bool unindents) +{ + SendScintilla(SCI_SETBACKSPACEUNINDENTS,unindents); +} + + +// Return the effect of the tab key. +bool QextScintilla::tabIndents() +{ + return SendScintilla(SCI_GETTABINDENTS); +} + + +// Set the effect of the tab key. +void QextScintilla::setTabIndents(bool indents) +{ + SendScintilla(SCI_SETTABINDENTS,indents); +} + + +// Return the indentation use of tabs. +bool QextScintilla::indentationsUseTabs() +{ + return SendScintilla(SCI_GETUSETABS); +} + + +// Set the indentation use of tabs. +void QextScintilla::setIndentationsUseTabs(bool tabs) +{ + SendScintilla(SCI_SETUSETABS,tabs); +} + + +// Return the state of line numbers in a margin. +bool QextScintilla::marginLineNumbers(int margin) +{ + return SendScintilla(SCI_GETMARGINTYPEN,margin); +} + + +// Enable and disable line numbers in a margin. +void QextScintilla::setMarginLineNumbers(int margin,bool lnrs) +{ + SendScintilla(SCI_SETMARGINTYPEN,margin,lnrs ? SC_MARGIN_NUMBER : 0); +} + + +// Return the marker mask of a margin. +int QextScintilla::marginMarkerMask(int margin) +{ + return SendScintilla(SCI_GETMARGINMASKN,margin); +} + + +// Set the marker mask of a margin. +void QextScintilla::setMarginMarkerMask(int margin,int mask) +{ + SendScintilla(SCI_SETMARGINMASKN,margin,mask); +} + + +// Return the state of a margin's sensitivity. +bool QextScintilla::marginSensitivity(int margin) +{ + return SendScintilla(SCI_GETMARGINSENSITIVEN,margin); +} + + +// Enable and disable a margin's sensitivity. +void QextScintilla::setMarginSensitivity(int margin,bool sens) +{ + SendScintilla(SCI_SETMARGINSENSITIVEN,margin,sens); +} + + +// Return the width of a margin. +int QextScintilla::marginWidth(int margin) +{ + return SendScintilla(SCI_GETMARGINWIDTHN,margin); +} + + +// Set the width of a margin. +void QextScintilla::setMarginWidth(int margin,int width) +{ + SendScintilla(SCI_SETMARGINWIDTHN,margin,width); +} + + +// Set the width of a margin to the width of some text. +void QextScintilla::setMarginWidth(int margin,const QString &s) +{ + int width; + + if (isUtf8()) + width = SendScintilla(SCI_TEXTWIDTH,STYLE_LINENUMBER,s.utf8().data()); + else + width = SendScintilla(SCI_TEXTWIDTH,STYLE_LINENUMBER,s.latin1()); + + setMarginWidth(margin,width); +} + + +// Set the background colour of all margins. +void QextScintilla::setMarginsBackgroundColor(const QColor &col) +{ + handleStylePaperChange(col,STYLE_LINENUMBER); +} + + +// Set the foreground colour of all margins. +void QextScintilla::setMarginsForegroundColor(const QColor &col) +{ + handleStyleColorChange(col,STYLE_LINENUMBER); +} + + +// Set the font of all margins. +void QextScintilla::setMarginsFont(const QFont &f) +{ + setStylesFont(f,STYLE_LINENUMBER); +} + + +// Define a marker based on a symbol. +int QextScintilla::markerDefine(MarkerSymbol sym,int mnr) +{ + checkMarker(mnr); + + if (mnr >= 0) + SendScintilla(SCI_MARKERDEFINE,mnr,static_cast<long>(sym)); + + return mnr; +} + + +// Define a marker based on a character. +int QextScintilla::markerDefine(char ch,int mnr) +{ + checkMarker(mnr); + + if (mnr >= 0) + SendScintilla(SCI_MARKERDEFINE,mnr,static_cast<long>(SC_MARK_CHARACTER) + ch); + + return mnr; +} + + +// Define a marker based on a QPixmap. +int QextScintilla::markerDefine(const QPixmap *pm,int mnr) +{ + checkMarker(mnr); + + if (mnr >= 0) + SendScintilla(SCI_MARKERDEFINEPIXMAP,mnr,pm); + + return mnr; +} + + +// Add a marker to a line. +int QextScintilla::markerAdd(int linenr,int mnr) +{ + if (mnr < 0 || mnr > MARKER_MAX || (allocatedMarkers & (1 << mnr)) == 0) + return -1; + + return SendScintilla(SCI_MARKERADD,linenr,mnr); +} + + +// Get the marker mask for a line. +unsigned QextScintilla::markersAtLine(int linenr) +{ + return SendScintilla(SCI_MARKERGET,linenr); +} + + +// Delete a marker from a line. +void QextScintilla::markerDelete(int linenr,int mnr) +{ + if (mnr <= MARKER_MAX) + { + if (mnr < 0) + { + unsigned am = allocatedMarkers; + + for (int m = 0; m <= MARKER_MAX; ++m) + { + if (am & 1) + SendScintilla(SCI_MARKERDELETE,linenr,m); + + am >>= 1; + } + } + else if (allocatedMarkers & (1 << mnr)) + SendScintilla(SCI_MARKERDELETE,linenr,mnr); + } +} + + +// Delete a marker from the text. +void QextScintilla::markerDeleteAll(int mnr) +{ + if (mnr <= MARKER_MAX) + { + if (mnr < 0) + SendScintilla(SCI_MARKERDELETEALL,-1); + else if (allocatedMarkers & (1 << mnr)) + SendScintilla(SCI_MARKERDELETEALL,mnr); + } +} + + +// Delete a marker handle from the text. +void QextScintilla::markerDeleteHandle(int mhandle) +{ + SendScintilla(SCI_MARKERDELETEHANDLE,mhandle); +} + + +// Return the line containing a marker instance. +int QextScintilla::markerLine(int mhandle) +{ + return SendScintilla(SCI_MARKERLINEFROMHANDLE,mhandle); +} + + +// Search forwards for a marker. +int QextScintilla::markerFindNext(int linenr,unsigned mask) +{ + return SendScintilla(SCI_MARKERNEXT,linenr,mask); +} + + +// Search backwards for a marker. +int QextScintilla::markerFindPrevious(int linenr,unsigned mask) +{ + return SendScintilla(SCI_MARKERPREVIOUS,linenr,mask); +} + + +// Set the marker background colour. +void QextScintilla::setMarkerBackgroundColor(const QColor &col,int mnr) +{ + if (mnr <= MARKER_MAX) + { + int alpha = qAlpha(col.rgb()); + + if (mnr < 0) + { + unsigned am = allocatedMarkers; + + for (int m = 0; m <= MARKER_MAX; ++m) + { + if (am & 1) + { + SendScintilla(SCI_MARKERSETBACK,m,col); + + if (alpha < 255) + SendScintilla(SCI_MARKERSETALPHA, m, alpha); + } + + am >>= 1; + } + } + else if (allocatedMarkers & (1 << mnr)) + { + SendScintilla(SCI_MARKERSETBACK,mnr,col); + + if (alpha < 255) + SendScintilla(SCI_MARKERSETALPHA, mnr, alpha); + } + } +} + + +// Set the marker foreground colour. +void QextScintilla::setMarkerForegroundColor(const QColor &col,int mnr) +{ + if (mnr <= MARKER_MAX) + { + if (mnr < 0) + { + unsigned am = allocatedMarkers; + + for (int m = 0; m <= MARKER_MAX; ++m) + { + if (am & 1) + SendScintilla(SCI_MARKERSETFORE,m,col); + + am >>= 1; + } + } + else if (allocatedMarkers & (1 << mnr)) + SendScintilla(SCI_MARKERSETFORE,mnr,col); + } +} + + +// Check a marker, allocating a marker number if necessary. +void QextScintilla::checkMarker(int &mnr) +{ + if (mnr >= 0) + { + // Check the explicit marker number isn't already allocated. + if (mnr > MARKER_MAX || allocatedMarkers & (1 << mnr)) + mnr = -1; + } + else + { + unsigned am = allocatedMarkers; + + // Find the smallest unallocated marker number. + for (mnr = 0; mnr <= MARKER_MAX; ++mnr) + { + if ((am & 1) == 0) + break; + + am >>= 1; + } + } + + // Define the marker if it is valid. + if (mnr >= 0) + allocatedMarkers |= (1 << mnr); +} + + +// Reset the fold margin colours. +void QextScintilla::resetFoldMarginColors() +{ + SendScintilla(SCI_SETFOLDMARGINHICOLOUR,0,0L); + SendScintilla(SCI_SETFOLDMARGINCOLOUR,0,0L); +} + + +// Set the fold margin colours. +void QextScintilla::setFoldMarginColors(const QColor &fore,const QColor &back) +{ + SendScintilla(SCI_SETFOLDMARGINHICOLOUR,1,fore); + SendScintilla(SCI_SETFOLDMARGINCOLOUR,1,back); +} + + +// Set the call tips background colour. +void QextScintilla::setCallTipsBackgroundColor(const QColor &col) +{ + SendScintilla(SCI_CALLTIPSETBACK,col); +} + + +// Set the call tips foreground colour. +void QextScintilla::setCallTipsForegroundColor(const QColor &col) +{ + SendScintilla(SCI_CALLTIPSETFORE,col); +} + + +// Set the call tips highlight colour. +void QextScintilla::setCallTipsHighlightColor(const QColor &col) +{ + SendScintilla(SCI_CALLTIPSETFOREHLT,col); +} + + +// Set the matched brace background colour. +void QextScintilla::setMatchedBraceBackgroundColor(const QColor &col) +{ + SendScintilla(SCI_STYLESETBACK,STYLE_BRACELIGHT,col); +} + + +// Set the matched brace foreground colour. +void QextScintilla::setMatchedBraceForegroundColor(const QColor &col) +{ + SendScintilla(SCI_STYLESETFORE,STYLE_BRACELIGHT,col); +} + + +// Set the unmatched brace background colour. +void QextScintilla::setUnmatchedBraceBackgroundColor(const QColor &col) +{ + SendScintilla(SCI_STYLESETBACK,STYLE_BRACEBAD,col); +} + + +// Set the unmatched brace foreground colour. +void QextScintilla::setUnmatchedBraceForegroundColor(const QColor &col) +{ + SendScintilla(SCI_STYLESETFORE,STYLE_BRACEBAD,col); +} + + +// Set the lexer. +void QextScintilla::setLexer(QextScintillaLexer *lexer) +{ + // Disconnect any previous lexer. + if (!lex.isNull()) + { + lex -> disconnect(this); + + SendScintilla(SCI_STYLERESETDEFAULT); + } + + // Connect up the new lexer. + lex = lexer; + + if (lex) + { + int bits = SendScintilla(SCI_GETSTYLEBITSNEEDED); + int nrStyles = 1 << bits; + + SendScintilla(SCI_SETSTYLEBITS,bits); + + connect(lex,SIGNAL(colorChanged(const QColor &,int)), + SLOT(handleStyleColorChange(const QColor &,int))); + connect(lex,SIGNAL(eolFillChanged(bool,int)), + SLOT(handleStyleEolFillChange(bool,int))); + connect(lex,SIGNAL(fontChanged(const QFont &,int)), + SLOT(handleStyleFontChange(const QFont &,int))); + connect(lex,SIGNAL(paperChanged(const QColor &,int)), + SLOT(handleStylePaperChange(const QColor &,int))); + connect(lex,SIGNAL(propertyChanged(const char *,const char *)), + SLOT(handlePropertyChange(const char *,const char *))); + + SendScintilla(SCI_SETLEXERLANGUAGE,lex -> lexer()); + + // Set the keywords. Scintilla allows for sets numbered 0 to + // KEYWORDSET_MAX (although the lexers only seem to exploit 0 + // to KEYWORDSET_MAX - 1). We number from 1 in line with + // SciTE's property files. + for (int k = 0; k <= KEYWORDSET_MAX; ++k) + { + const char *kw = lex -> keywords(k + 1); + + if (kw) + SendScintilla(SCI_SETKEYWORDS,k,kw); + } + + // Initialise each style. + for (int s = 0; s < nrStyles; ++s) + { + if (lex -> description(s).isNull()) + continue; + + handleStyleColorChange(lex -> color(s),s); + handleStyleEolFillChange(lex -> eolFill(s),s); + handleStyleFontChange(lex -> font(s),s); + handleStylePaperChange(lex -> paper(s),s); + } + + // Initialise the properties. + lex -> refreshProperties(); + + // Set the auto-completion fillups if they haven't been + // explcitly set. + if (fillups_enabled && !explicit_fillups) + SendScintilla(SCI_AUTOCSETFILLUPS, lex->autoCompletionFillups()); + } + else + { + SendScintilla(SCI_SETLEXER,SCLEX_NULL); + + setColor(nl_text_colour); + setPaper(nl_paper_colour); + setFont(nl_font); + } +} + + +// Get the current lexer. +QextScintillaLexer *QextScintilla::lexer() const +{ + return lex; +} + + +// Handle a change in lexer style foreground colour. +void QextScintilla::handleStyleColorChange(const QColor &c,int style) +{ + SendScintilla(SCI_STYLESETFORE,style,c); +} + + +// Handle a change in lexer style end-of-line fill. +void QextScintilla::handleStyleEolFillChange(bool eolfill,int style) +{ + SendScintilla(SCI_STYLESETEOLFILLED,style,eolfill); +} + + +// Handle a change in lexer style font. +void QextScintilla::handleStyleFontChange(const QFont &f,int style) +{ + setStylesFont(f,style); + + if (style == lex->defaultStyle()) + setStylesFont(f, STYLE_DEFAULT); + + if (style == lex -> braceStyle()) + { + setStylesFont(f,STYLE_BRACELIGHT); + setStylesFont(f,STYLE_BRACEBAD); + } +} + + +// Set the font for a style. +void QextScintilla::setStylesFont(const QFont &f,int style) +{ + SendScintilla(SCI_STYLESETFONT,style,f.family().latin1()); + SendScintilla(SCI_STYLESETSIZE,style,f.pointSize()); + SendScintilla(SCI_STYLESETBOLD,style,f.bold()); + SendScintilla(SCI_STYLESETITALIC,style,f.italic()); + SendScintilla(SCI_STYLESETUNDERLINE,style,f.underline()); +} + + +// Handle a change in lexer style background colour. +void QextScintilla::handleStylePaperChange(const QColor &c,int style) +{ + SendScintilla(SCI_STYLESETBACK,style,c); +} + + +// Handle a change in lexer property. +void QextScintilla::handlePropertyChange(const char *prop,const char *val) +{ + SendScintilla(SCI_SETPROPERTY,prop,val); +} + + +// Handle a change to the user visible user interface. +void QextScintilla::handleUpdateUI() +{ + long newPos = SendScintilla(SCI_GETCURRENTPOS); + + if (newPos != oldPos) + { + oldPos = newPos; + + int line = SendScintilla(SCI_LINEFROMPOSITION,newPos); + int col = SendScintilla(SCI_GETCOLUMN,newPos); + + emit cursorPositionChanged(line,col); + } + + if (braceMode != NoBraceMatch) + braceMatch(); +} + + +// Handle brace matching. +void QextScintilla::braceMatch() +{ + long braceAtCaret, braceOpposite; + + findMatchingBrace(braceAtCaret,braceOpposite,braceMode); + + if (braceAtCaret >= 0 && braceOpposite < 0) + { + SendScintilla(SCI_BRACEBADLIGHT,braceAtCaret); + SendScintilla(SCI_SETHIGHLIGHTGUIDE,0UL); + } + else + { + char chBrace = SendScintilla(SCI_GETCHARAT,braceAtCaret); + + SendScintilla(SCI_BRACEHIGHLIGHT,braceAtCaret,braceOpposite); + + long columnAtCaret = SendScintilla(SCI_GETCOLUMN,braceAtCaret); + long columnOpposite = SendScintilla(SCI_GETCOLUMN,braceOpposite); + + if (chBrace == ':') + { + long lineStart = SendScintilla(SCI_LINEFROMPOSITION,braceAtCaret); + long indentPos = SendScintilla(SCI_GETLINEINDENTPOSITION,lineStart); + long indentPosNext = SendScintilla(SCI_GETLINEINDENTPOSITION,lineStart + 1); + + columnAtCaret = SendScintilla(SCI_GETCOLUMN,indentPos); + + long columnAtCaretNext = SendScintilla(SCI_GETCOLUMN,indentPosNext); + long indentSize = SendScintilla(SCI_GETINDENT); + + if (columnAtCaretNext - indentSize > 1) + columnAtCaret = columnAtCaretNext - indentSize; + + if (columnOpposite == 0) + columnOpposite = columnAtCaret; + } + + long column = columnAtCaret; + + if (column > columnOpposite) + column = columnOpposite; + + SendScintilla(SCI_SETHIGHLIGHTGUIDE,column); + } +} + + +// Check if the character at a position is a brace. +long QextScintilla::checkBrace(long pos,int brace_style,bool &colonMode) +{ + long brace_pos = -1; + char ch = SendScintilla(SCI_GETCHARAT,pos); + + if (ch == ':') + { + // A bit of a hack. + if (!lex.isNull() && strcmp(lex -> lexer(),"python") == 0) + { + brace_pos = pos; + colonMode = TRUE; + } + } + else if (ch && strchr("[](){}<>",ch)) + { + if (brace_style < 0) + brace_pos = pos; + else + { + int style = SendScintilla(SCI_GETSTYLEAT,pos) & 0x1f; + + if (style == brace_style) + brace_pos = pos; + } + } + + return brace_pos; +} + + +// Find a brace and it's match. Return TRUE if the current position is inside +// a pair of braces. +bool QextScintilla::findMatchingBrace(long &brace,long &other,BraceMatch mode) +{ + bool colonMode = FALSE; + int brace_style = (lex.isNull() ? -1 : lex -> braceStyle()); + + brace = -1; + other = -1; + + long caretPos = SendScintilla(SCI_GETCURRENTPOS); + + if (caretPos > 0) + brace = checkBrace(caretPos - 1,brace_style,colonMode); + + bool isInside = FALSE; + + if (brace < 0 && mode == SloppyBraceMatch) + { + brace = checkBrace(caretPos,brace_style,colonMode); + + if (brace >= 0 && !colonMode) + isInside = TRUE; + } + + if (brace >= 0) + { + if (colonMode) + { + // Find the end of the Python indented block. + long lineStart = SendScintilla(SCI_LINEFROMPOSITION,brace); + long lineMaxSubord = SendScintilla(SCI_GETLASTCHILD,lineStart,-1); + + other = SendScintilla(SCI_GETLINEENDPOSITION,lineMaxSubord); + } + else + other = SendScintilla(SCI_BRACEMATCH,brace); + + if (other > brace) + isInside = !isInside; + } + + return isInside; +} + + +// Move to the matching brace. +void QextScintilla::moveToMatchingBrace() +{ + gotoMatchingBrace(FALSE); +} + + +// Select to the matching brace. +void QextScintilla::selectToMatchingBrace() +{ + gotoMatchingBrace(TRUE); +} + + +// Move to the matching brace and optionally select the text. +void QextScintilla::gotoMatchingBrace(bool select) +{ + long braceAtCaret; + long braceOpposite; + + bool isInside = findMatchingBrace(braceAtCaret,braceOpposite,SloppyBraceMatch); + + if (braceOpposite >= 0) + { + // Convert the character positions into caret positions based + // on whether the caret position was inside or outside the + // braces. + if (isInside) + { + if (braceOpposite > braceAtCaret) + braceAtCaret++; + else + braceOpposite++; + } + else + { + if (braceOpposite > braceAtCaret) + braceOpposite++; + else + braceAtCaret++; + } + + ensureLineVisible(SendScintilla(SCI_LINEFROMPOSITION,braceOpposite)); + + if (select) + SendScintilla(SCI_SETSEL,braceAtCaret,braceOpposite); + else + SendScintilla(SCI_SETSEL,braceOpposite,braceOpposite); + } +} + + +// Return a position from a line number and an index within the line. +long QextScintilla::posFromLineIndex(int line,int index) +{ + long pos = SendScintilla(SCI_POSITIONFROMLINE,line); + + // Allow for multi-byte characters. + for(int i = 0; i < index; i++) + pos = SendScintilla(SCI_POSITIONAFTER,pos); + + return pos; +} + + +// Return a line number and an index within the line from a position. +void QextScintilla::lineIndexFromPos(long pos,int *line,int *index) +{ + long lin = SendScintilla(SCI_LINEFROMPOSITION,pos); + long linpos = SendScintilla(SCI_POSITIONFROMLINE,lin); + + *line = lin; + *index = pos - linpos; +} + + +// Convert a Scintilla string to a Qt Unicode string. +QString QextScintilla::convertText(const char *s) +{ + if (isUtf8()) + return QString::fromUtf8(s); + + QString qs; + + qs.setLatin1(s); + + return qs; +} + + +// Set the source of the auto-completion list. +void QextScintilla::setAutoCompletionSource(AutoCompletionSource source) +{ + acSource = source; +} + + +// Set the threshold for automatic auto-completion. +void QextScintilla::setAutoCompletionThreshold(int thresh) +{ + acThresh = thresh; +} + + +// Set the auto-completion start characters. +void QextScintilla::setAutoCompletionStartCharacters(const char *start) +{ + acStart = start; +} + + +// Set the APIs for auto-completion. +void QextScintilla::setAutoCompletionAPIs(QextScintillaAPIs *apis) +{ + acAPIs = apis; +} + + +// Explicitly auto-complete from all sources. +void QextScintilla::autoCompleteFromAll() +{ + startAutoCompletion(AcsAll, FALSE, showSingle); +} + + +// Explicitly auto-complete from the APIs. +void QextScintilla::autoCompleteFromAPIs() +{ + startAutoCompletion(AcsAPIs, FALSE, showSingle); +} + + +// Explicitly auto-complete from the document. +void QextScintilla::autoCompleteFromDocument() +{ + // If we are not in a word then ignore. + if (currentCharInWord()) + startAutoCompletion(AcsDocument, FALSE, showSingle); +} + + +// Return TRUE if the current character (ie. the one before the carat) is part +// of a word. +bool QextScintilla::currentCharInWord() +{ + long pos = SendScintilla(SCI_GETCURRENTPOS); + + if (pos <= 0) + return FALSE; + + return isWordChar(SendScintilla(SCI_GETCHARAT,pos - 1)); +} + + +// Check if a character can be in a word. +bool QextScintilla::isWordChar(char ch) const +{ + const char *word_chars = 0; + + if (!lex.isNull()) + word_chars = lex->wordCharacters(); + + if (!word_chars) + word_chars = defaultWordChars; + + return (strchr(word_chars, ch) != NULL); +} + + +// Recolour the document. +void QextScintilla::recolor(int start,int end) +{ + SendScintilla(SCI_COLOURISE,start,end); +} + + +// Registered an image. +void QextScintilla::registerImage(int id,const QPixmap *pm) +{ + SendScintilla(SCI_REGISTERIMAGE,id,pm); +} + + +// Clear all registered images. +void QextScintilla::clearRegisteredImages() +{ + SendScintilla(SCI_CLEARREGISTEREDIMAGES); +} + + +// Set the fill-up characters for auto-completion. +void QextScintilla::setAutoCompletionFillups(const char *fillups) +{ + if (!fillups) + fillups = ""; + + SendScintilla(SCI_AUTOCSETFILLUPS, fillups); + fillups_enabled = explicit_fillups = TRUE; + + // Save them in case we need to reenable them at some point. + saved_fillups = fillups; +} + + +// Enable/disable fill-ups for auto-completion. +void QextScintilla::setAutoCompletionFillupsEnabled(bool enabled) +{ + const char *fillups; + + if (!enabled) + fillups = ""; + else if (!explicit_fillups && !lex.isNull()) + fillups = lex->autoCompletionFillups(); + else + fillups = saved_fillups.data(); + + SendScintilla(SCI_AUTOCSETFILLUPS, fillups); + fillups_enabled = enabled; +} + + +// Return the state of fill-ups for auto-completion. +bool QextScintilla::autoCompletionFillupsEnabled() +{ + return fillups_enabled; +} + + +// Set the case sensitivity for auto-completion. +void QextScintilla::setAutoCompletionCaseSensitivity(bool cs) +{ + SendScintilla(SCI_AUTOCSETIGNORECASE,!cs); +} + + +// Return the case sensitivity for auto-completion. +bool QextScintilla::autoCompletionCaseSensitivity() +{ + return !SendScintilla(SCI_AUTOCGETIGNORECASE); +} + + +// Set the replace word mode for auto-completion. +void QextScintilla::setAutoCompletionReplaceWord(bool replace) +{ + SendScintilla(SCI_AUTOCSETDROPRESTOFWORD,replace); +} + + +// Return the replace word mode for auto-completion. +bool QextScintilla::autoCompletionReplaceWord() +{ + return SendScintilla(SCI_AUTOCGETDROPRESTOFWORD); +} + + +// Set the single item mode for auto-completion. +void QextScintilla::setAutoCompletionShowSingle(bool single) +{ + showSingle = single; +} + + +// Return the single item mode for auto-completion. +bool QextScintilla::autoCompletionShowSingle() +{ + return showSingle; +} + + +// Set the APIs for call tips. +void QextScintilla::setCallTipsAPIs(QextScintillaAPIs *apis) +{ + ctAPIs = apis; +} + + +// Set maximum number of call tips displayed. +void QextScintilla::setCallTipsVisible(int nr) +{ + maxCallTips = nr; +} + + +// Set the document to display. +void QextScintilla::setDocument(const QextScintillaDocument &document) +{ + if (doc.pdoc != document.pdoc) + { + doc.undisplay(this); + doc.attach(document); + doc.display(this,&document); + } +} + + +// Ensure the document is read-write and return True if was was read-only. +bool QextScintilla::ensureRW() +{ + bool ro = isReadOnly(); + + if (ro) + setReadOnly(FALSE); + + return ro; +} + + +// Return the number of the first visible line. +int QextScintilla::firstVisibleLine() +{ + return SendScintilla(SCI_GETFIRSTVISIBLELINE); +} + + +// Return the height in pixels of the text in a particular line. +int QextScintilla::textHeight(int linenr) +{ + return SendScintilla(SCI_TEXTHEIGHT, linenr); +} + + +// See if auto-completion or user list is active. +bool QextScintilla::isListActive() +{ + return SendScintilla(SCI_AUTOCACTIVE); +} + + +// Cancel any current auto-completion or user list. +void QextScintilla::cancelList() +{ + SendScintilla(SCI_AUTOCCANCEL); +} + + +// Display a user list. +void QextScintilla::showUserList(int id, const QStringList &list) +{ + // Sanity check to make sure auto-completion doesn't get confused. + if (id <= 0) + return; + + const char sep = '\x03'; + + SendScintilla(SCI_AUTOCSETSEPARATOR, sep); + SendScintilla(SCI_USERLISTSHOW, id, list.join(QChar(sep)).latin1()); +} + + +// Translate the SCN_USERLISTSELECTION notification into something more useful. +void QextScintilla::handleUserListSelection(const char *text, int id) +{ + emit userListActivated(id, QString(text)); +} diff --git a/qt/qextscintilla.h b/qt/qextscintilla.h new file mode 100644 index 0000000..ec64f4f --- /dev/null +++ b/qt/qextscintilla.h @@ -0,0 +1,1457 @@ +// This module defines the "official" high-level API of the Qt port of +// Scintilla. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLA_H +#define QEXTSCINTILLA_H + + +#include <qobject.h> +#include <qguardedptr.h> + +#include <qextscintillaglobal.h> +#include <qextscintillabase.h> +#include <qextscintilladocument.h> + + +class QextScintillaLexer; +class QextScintillaAPIs; +class QextScintillaCommandSet; + + +//! \brief The QextScintilla class implements a higher level, more Qt-like, +//! API to the Scintilla editor widget. +//! +//! QextScintilla implements methods, signals and slots similar to those found +//! in other Qt editor classes. It also provides a higher level interface to +//! features specific to Scintilla such as syntax styling, call tips, +//! auto-indenting and auto-completion than that provided by QextScintillaBase. +//! +//! The API is modelled on QTextEdit - a method of the same name should behave +//! in the same way. +class QEXTSCINTILLA_EXPORT QextScintilla : public QextScintillaBase +{ + Q_OBJECT + +public: + //! This enum defines the different auto-indentation styles. + enum { + //! A line is automatically indented to match the previous + //! line. + AiMaintain = 0x01, + + //! If the language supported by the current lexer has a + //! specific start of block character (e.g. { in C++), then a + //! line that begins with that character is indented as well as + //! the lines that make up the block. It may be logically ored + //! with AiClosing. + AiOpening = 0x02, + + //! If the language supported by the current lexer has a + //! specific end of block character (e.g. } in C++), then a + //! line that begins with that character is indented as well as + //! the lines that make up the block. It may be logically ored + //! with AiOpening. + AiClosing = 0x04 + }; + + //! This enum defines the different sources for auto-completion lists. + enum AutoCompletionSource { + //! The source is the current document. + AcsDocument, + + //! The source is any installed APIs. + AcsAPIs, + + //! The source is all available sources. + AcsAll + }; + + //! This enum defines the different brace matching modes. The + //! character pairs {}, [] and () are treated as braces. The Python + //! lexer will also match a : with the end of the corresponding + //! indented block. + enum BraceMatch { + //! Brace matching is disabled. + NoBraceMatch, + + //! Brace matching is enabled for a brace immediately before + //! the current position. + StrictBraceMatch, + + //! Brace matching is enabled for a brace immediately before or + //! after the current position. + SloppyBraceMatch + }; + + //! This enum defines the different edge modes for long lines. + enum EdgeMode { + //! Long lines are not marked. + EdgeNone = EDGE_NONE, + + //! A vertical line is drawn at the column set by + //! setEdgeColumn(). This is recommended for monospace fonts. + EdgeLine = EDGE_LINE, + + //! The background color of characters after the column limit + //! is changed to the color set by setEdgeColor(). This is + //! recommended for proportional fonts. + EdgeBackground = EDGE_BACKGROUND + }; + + //! This enum defines the different end-of-line modes. + enum EolMode { + //! A carriage return/line feed as used on Windows systems. + EolWindows = SC_EOL_CRLF, + + //! A line feed as used on Unix systems. + EolUnix = SC_EOL_LF, + + //! A carriage return as used on Mac systems. + EolMac = SC_EOL_CR + }; + + //! This enum defines the different styles for the folding margin. + enum FoldStyle { + //! Folding is disabled. + NoFoldStyle, + + //! Plain folding style using plus and minus symbols. + PlainFoldStyle, + + //! Circled folding style using circled plus and minus symbols. + CircledFoldStyle, + + //! Boxed folding style using boxed plus and minus symbols. + BoxedFoldStyle, + + //! Circled tree style using a flattened tree with circled plus + //! and minus symbols and rounded corners. + CircledTreeFoldStyle, + + //! Boxed tree style using a flattened tree with boxed plus and + //! minus symbols and right-angled corners. + BoxedTreeFoldStyle + }; + + //! This enum defines the different pre-defined marker symbols. + enum MarkerSymbol { + //! A circle. + Circle = SC_MARK_CIRCLE, + + //! A rectangle. + Rectangle = SC_MARK_ROUNDRECT, + + //! A triangle pointing to the right. + RightTriangle = SC_MARK_ARROW, + + //! A smaller rectangle. + SmallRectangle = SC_MARK_SMALLRECT, + + //! An arrow pointing to the right. + RightArrow = SC_MARK_SHORTARROW, + + //! An invisible marker that allows code to track the movement + //! of lines. + Invisible = SC_MARK_EMPTY, + + //! A triangle pointing down. + DownTriangle = SC_MARK_ARROWDOWN, + + //! A drawn minus sign. + Minus = SC_MARK_MINUS, + + //! A drawn plus sign. + Plus = SC_MARK_PLUS, + + //! A vertical line drawn in the background colour. + VerticalLine = SC_MARK_VLINE, + + //! A bottom left corner drawn in the background colour. + BottomLeftCorner = SC_MARK_LCORNER, + + //! A vertical line with a centre right horizontal line drawn + //! in the background colour. + LeftSideSplitter = SC_MARK_TCORNER, + + //! A drawn plus sign in a box. + BoxedPlus = SC_MARK_BOXPLUS, + + //! A drawn plus sign in a connected box. + BoxedPlusConnected = SC_MARK_BOXPLUSCONNECTED, + + //! A drawn minus sign in a box. + BoxedMinus = SC_MARK_BOXMINUS, + + //! A drawn minus sign in a connected box. + BoxedMinusConnected = SC_MARK_BOXMINUSCONNECTED, + + //! A rounded bottom left corner drawn in the background + //! colour. + RoundedBottomLeftCorner = SC_MARK_LCORNERCURVE, + + //! A vertical line with a centre right curved line drawn in + //! the background colour. + LeftSideRoundedSplitter = SC_MARK_TCORNERCURVE, + + //! A drawn plus sign in a circle. + CircledPlus = SC_MARK_CIRCLEPLUS, + + //! A drawn plus sign in a connected box. + CircledPlusConnected = SC_MARK_CIRCLEPLUSCONNECTED, + + //! A drawn minus sign in a circle. + CircledMinus = SC_MARK_CIRCLEMINUS, + + //! A drawn minus sign in a connected circle. + CircledMinusConnected = SC_MARK_CIRCLEMINUSCONNECTED, + + //! No symbol is drawn but the line of text is drawn with the + //! same background colour. + Background = SC_MARK_BACKGROUND, + + //! Three drawn dots. + ThreeDots = SC_MARK_DOTDOTDOT, + + //! Three drawn arrows pointing right. + ThreeRightArrows = SC_MARK_ARROWS + }; + + //! This enum defines the different whitespace visibility modes. When + //! whitespace is visible spaces are displayed as small centred dots + //! and tabs are displayed as light arrows pointing to the right. + enum WhitespaceVisibility { + //! Whitespace is invisible. + WsInvisible = SCWS_INVISIBLE, + + //! Whitespace is always visible. + WsVisible = SCWS_VISIBLEALWAYS, + + //! Whitespace is visible after the whitespace used for + //! indentation. + WsVisibleAfterIndent = SCWS_VISIBLEAFTERINDENT + }; + + //! This enum defines the different line wrap modes. + enum WrapMode { + //! Lines are not wrapped. + WrapNone = SC_WRAP_NONE, + + //! Lines are wrapped at word boundaries. + WrapWord = SC_WRAP_WORD, + + //! Lines are wrapped at character boundaries. + WrapCharacter = SC_WRAP_CHAR + }; + + //! This enum defines the different line wrap visual flags. + enum WrapVisualFlag { + //! No wrap flag is displayed. + WrapFlagNone, + + //! A wrap flag is displayed by the text. + WrapFlagByText, + + //! A wrap flag is displayed by the border. + WrapFlagByBorder + }; + + //! Construct an empty QextScintilla with parent \a parent, name \a + //! name, and widget flags \a f. + QextScintilla(QWidget *parent = 0,const char *name = 0,WFlags f = 0); + + //! Destroys the QextScintilla instance. + virtual ~QextScintilla(); + + //! Returns TRUE if auto-completion lists are case sensitive. + //! + //! \sa setAutoCompletionCaseSensitivity() + bool autoCompletionCaseSensitivity(); + + //! Returns true if auto-completion fill-up characters are enabled. + //! + //! \sa setAutoCompletionFillups(), setAutoCompletionFillupsEnabled() + bool autoCompletionFillupsEnabled(); + + //! Returns TRUE if the rest of the word to the right of the current + //! cursor is removed when an item from an auto-completion list is + //! selected. + //! + //! \sa setAutoCompletionReplaceWord() + bool autoCompletionReplaceWord(); + + //! Returns TRUE if the only item in an auto-completion list with a + //! single entry is automatically used and the list not displayed. + //! + //! \sa setAutoCompletionShowSingle() + bool autoCompletionShowSingle(); + + //! Returns the current source for the auto-completion list when it is + //! being displayed automatically as the user types. + //! + //! \sa setAutoCompletionSource() + AutoCompletionSource autoCompletionSource() const {return acSource;} + + //! Returns the current threshold for the automatic display of the + //! auto-completion list as the user types. + //! + //! \sa setAutoCompletionThreshold() + int autoCompletionThreshold() const {return acThresh;} + + //! Returns TRUE if auto-indentation is enabled. + //! + //! \sa setAutoIndent() + bool autoIndent() const {return autoInd;} + + //! Returns TRUE if the backspace key unindents a line instead of + //! deleting a character. The default is FALSE. + //! + //! \sa setBackspaceUnindents(), tabIndents(), setTabIndents() + bool backspaceUnindents(); + + //! Mark the beginning of a sequence of actions that can be undone by + //! a single call to undo(). + //! + //! \sa endUndoAction(), undo() + void beginUndoAction(); + + //! Returns the brace matching mode. + //! + //! \sa setBraceMatching() + BraceMatch braceMatching() const {return braceMode;} + + //! Returns the maximum number of call tips that are displayed. + //! + //! \sa setCallTipsVisible() + int callTipsVisible() const {return maxCallTips;} + + //! Cancel any current auto-completion or user defined list. + void cancelList(); + + //! Clear all registered images. + //! + //! \sa registerImage() + void clearRegisteredImages(); + + //! All the lines of the text have their end-of-lines converted to mode + //! \a mode. + //! + //! \sa eolMode(), setEolMode() + void convertEols(EolMode mode); + + //! Returns the widget's text (ie. foreground) colour. + //! + //! \sa setColor() + QColor color() const; + + //! Returns the attached document. + //! + //! \sa setDocument() + QextScintillaDocument document() {return doc;} + + //! Mark the end of a sequence of actions that can be undone by a + //! single call to undo(). + //! + //! \sa beginUndoAction(), undo() + void endUndoAction(); + + //! Returns the color of the marker used to show that a line has + //! exceeded the length set by setEdgeColumn(). + //! + //! \sa setEdgeColor(), \sa setEdgeColumn + QColor edgeColor(); + + //! Returns the number of the column after which lines are considered + //! to be long. + //! + //! \sa setEdgeColumn() + int edgeColumn(); + + //! Returns the edge mode which determines how long lines are marked. + //! + //! \sa setEdgeMode() + EdgeMode edgeMode(); + + //! Returns the end-of-line mode. + //! + //! \sa setEolMode() + EolMode eolMode(); + + //! Returns the visibility of end-of-lines. + //! + //! \sa setEolVisibility() + bool eolVisibility(); + + //! Find the next occurrence of the string \a expr and return TRUE if + //! \a expr was found, otherwise returns FALSE. If \a expr is found it + //! becomes the current selection. + //! + //! If \a re is TRUE then \a expr is interpreted as a regular + //! expression rather than a simple string. + //! + //! If \a cs is TRUE then the search is case sensitive. + //! + //! If \a wo is TRUE then the search looks for whole word matches only, + //! otherwise it searches for any matching text. + //! + //! If \a wrap is TRUE then the search wraps around the end of the + //! text. + //! + //! If \a forward is TRUE (the default) then the search is forward from + //! the starting position to the end of the text, otherwise it is + //! backwards to the beginning of the text. + //! + //! If either \a line or \a index are negative (the default) then the + //! search begins from the current cursor position. Otherwise the + //! search begins at position \a index of line \a line. + //! + //! If \a show is TRUE (the default) then any text found is made + //! visible (ie. it is unfolded). + //! + //! \sa findNext(), replace() + virtual bool findFirst(const QString &expr,bool re,bool cs,bool wo, + bool wrap,bool forward = TRUE,int line = -1, + int index = -1,bool show = TRUE); + + //! Find the next occurence of the string found using findFirst(). + //! + //! \sa findFirst(), replace() + virtual bool findNext(); + + //! Returns the number of the first visible line. + int firstVisibleLine(); + + //! Returns the current folding style. + //! + //! \sa setFolding() + FoldStyle folding() const {return fold;} + + //! Sets \a *line and \a *index to the line and index of the cursor. + //! + //! \sa setCursorPosition() + void getCursorPosition(int *line,int *index); + + //! If there is a selection, \a *lineFrom is set to the line number in + //! which the selection begins and \a *lineTo is set to the line number + //! in which the selection ends. (They could be the same.) + //! \a *indexFrom is set to the index at which the selection begins + //! within \a *lineFrom, and \a *indexTo is set to the index at which + //! the selection ends within \a *lineTo. If there is no selection, + //! \a *lineFrom, \a *indexFrom, \a *lineTo and \a *indexTo are all set + //! to -1. + //! + //! \sa setSelection() + void getSelection(int *lineFrom,int *indexFrom, + int *lineTo,int *indexTo); + + //! Returns TRUE if some text is selected. + //! + //! \sa selectedText() + bool hasSelectedText() const {return selText;} + + //! Returns the number of characters that line \a line is indented by. + //! + //! \sa setIndentation() + int indentation(int line); + + //! Returns TRUE if the display of indentation guides is enabled. + //! + //! \sa setIndentationGuides() + bool indentationGuides(); + + //! Returns TRUE if indentations are created using tabs and spaces, + //! rather than just spaces. The default is TRUE. + //! + //! \sa setIndentationsUseTabs() + bool indentationsUseTabs(); + + //! Returns the indentation width in characters. The default is 0 + //! which means that the value returned by tabWidth() is actually used. + //! + //! \sa setIndentationWidth(), tabWidth() + int indentationWidth(); + + //! Returns TRUE if a call tip is currently active. + bool isCallTipActive(); + + //! Returns TRUE if an auto-completion or user defined list is + //! currently active. + bool isListActive(); + + //! Returns TRUE if the text has been modified. + //! + //! \sa setModified(), modificationChanged() + bool isModified(); + + //! Returns TRUE if the text edit is read-only. + //! + //! \sa setReadOnly() + bool isReadOnly(); + + //! Returns TRUE if there is something that can be redone. + //! + //! \sa redo() + bool isRedoAvailable(); + + //! Returns TRUE if there is something that can be undone. + //! + //! \sa undo() + bool isUndoAvailable(); + + //! Returns TRUE if text is interpreted as being UTF8 encoded. The + //! default is to interpret the text as Latin1 encoded. + //! + //! \sa setUtf8() + bool isUtf8(); + + //! Returns the line which is at position \a pos or -1 if there is no + //! line at that position. + int lineAt(const QPoint &pos); + + //! Returns the length of line \a line or -1 if there is no such line. + int lineLength(int line); + + //! Returns the number of lines of text. + int lines(); + + //! Returns the length of the text edit's text. + int length(); + + //! Returns the current language lexer used to style text. If it is 0 then + //! syntax styling is disabled. + //! + //! \sa setLexer() + QextScintillaLexer *lexer() const; + + //! Returns TRUE if line numbers are enabled for margin \a margin. + //! + //! \sa setMarginLineNumbers(), QextScintillaBase::SCI_GETMARGINTYPEN + bool marginLineNumbers(int margin); + + //! Returns the marker mask of margin \a margin. + //! + //! \sa setMarginMask(), QextScintillaMarker, + //! QextScintillaBase::SCI_GETMARGINMASKN + int marginMarkerMask(int margin); + + //! Returns TRUE if margin \a margin is sensitive to mouse clicks. + //! + //! \sa setMarginSensitivity(), marginClicked(), + //! QextScintillaBase::SCI_GETMARGINTYPEN + bool marginSensitivity(int margin); + + //! Returns the width in pixels of margin \a margin. + //! + //! \sa setMarginWidth(), QextScintillaBase::SCI_GETMARGINWIDTHN + int marginWidth(int margin); + + //! Define a marker using the symbol \a sym with the marker number + //! \a mnr. If \a mnr is -1 then the marker number is automatically + //! allocated. The marker number is returned or -1 if the marker + //! number was already allocated or too many markers have been defined. + //! + //! Markers are small geometric symbols and character used, for + //! example, to indicate the current line or, in debuggers, to indicate + //! breakpoints. If a margin has a width of 0 then its markers are not + //! drawn, but their background colours affect the background colour of + //! the corresponding line of text. + //! + //! There may be up to 32 markers defined and each line of text has a + //! set of these markers associated with it. Markers are drawn + //! according to their numerical identifier. Markers try to move with + //! their text by tracking where the start of their line moves to. For + //! example, when a line is deleted its markers are added to previous + //! line's markers. + //! + //! Each marker is identified by a marker number. Each instance of a + //! marker is identified by a marker handle. + int markerDefine(MarkerSymbol sym,int mnr = -1); + + //! Define a marker using the character \a ch with the marker number + //! \a mnr. If \a mnr is -1 then the marker number is automatically + //! allocated. The marker number is returned or -1 if the marker + //! number was already allocated or too many markers have been defined. + int markerDefine(char ch,int mnr = -1); + + //! Define a marker using a copy of the pixmap \a pm with the marker + //! number \a mnr. If \a mnr is -1 then the marker number is + //! automatically allocated. The marker number is returned or -1 if + //! the marker number was already allocated or too many markers have + //! been defined. + int markerDefine(const QPixmap *pm,int mnr = -1); + + //! Add a marker number \a mnr to line number \a linenr. A handle for + //! the marker is returned which can be used to track the marker's + //! position, or -1 if the \a mnr was invalid. + //! + //! \sa markerDelete(), markerDeleteAll(), markerDeleteHandle() + int markerAdd(int linenr,int mnr); + + //! Returns the 32 bit mask of marker numbers at line number \a linenr. + //! + //! \sa markerAdd() + unsigned markersAtLine(int linenr); + + //! Delete all markers with the marker number \a mnr in the line + //! \a linenr. If \a mnr is -1 then delete all markers from line + //! \a linenr. + //! + //! \sa markerAdd(), markerDeleteAll(), markerDeleteHandle() + void markerDelete(int linenr,int mnr = -1); + + //! Delete the all markers with the marker number \a mnr. If \a mnr is + //! -1 then delete all markers. + //! + //! \sa markerAdd(), markerDelete(), markerDeleteHandle() + void markerDeleteAll(int mnr = -1); + + //! Delete the the marker instance with the marker handle \a mhandle. + //! + //! \sa markerAdd(), markerDelete(), markerDeleteAll() + void markerDeleteHandle(int mhandle); + + //! Return the line number that contains the marker instance with the + //! marker handle \a mhandle. + int markerLine(int mhandle); + + //! Return the number of the next line to contain at least one marker + //! from a 32 bit mask of markers. \a linenr is the line number to + //! start the search from. \a mask is the mask of markers to search + //! for. + //! + //! \sa markerFindPrevious() + int markerFindNext(int linenr,unsigned mask); + + //! Return the number of the previous line to contain at least one + //! marker from a 32 bit mask of markers. \a linenr is the line number + //! to start the search from. \a mask is the mask of markers to search + //! for. + //! + //! \sa markerFindNext() + int markerFindPrevious(int linenr,unsigned mask); + + //! Returns the widget's paper (ie. background) colour. + //! + //! \sa setPaper() + QColor paper() const; + + //! Recolours the document between the \a start and \a end positions. + //! \a start defaults to the start of the document and \a end defaults + //! to the end of the document. + virtual void recolor(int start = 0,int end = -1); + + //! Register an image \a pm with ID \a id. Registered images can be + //! displayed in auto-completion lists. + //! + //! \sa clearRegisteredImages(), QextScintillaAPIs + void registerImage(int id,const QPixmap *pm); + + //! Replace the current selection, set by a previous call to + //! findFirst() or findNext(), with \a replaceStr. + //! + //! \sa findFirst(), findNext() + virtual void replace(const QString &replaceStr); + + //! Reset the fold margin colours to their defaults. + //! + //! \sa setFoldMarginColors() + void resetFoldMarginColors(); + + //! The fold margin may be drawn as a one pixel sized checkerboard + //! pattern of two colours, \a fore and \a back. + //! + //! \sa resetFoldMarginColors() + void setFoldMarginColors(const QColor &fore,const QColor &back); + + //! Sets the APIs used for auto-completion to \a apis. If \a apis is 0 + //! then any existing APIs are removed. + //! + //! \sa autoCompleteFromAPIs(), setCallTipsAPIs() + void setAutoCompletionAPIs(QextScintillaAPIs *apis = 0); + + //! A fill-up character is one that, when entered while an + //! auto-completion list is being displayed, causes the currently + //! selected item from the list to be added to the text followed by the + //! fill-up character. \a fillups is the set of fill-up characters. + //! The default is that no fill-up characters are set, although a lexer may + //! set its own. Explicitly setting the fill-up characters using this + //! method automatically enables their use. + //! + //! \sa autoCompletionFillupsEnabled(), setAutoCompletionFillupsEnabled() + void setAutoCompletionFillups(const char *fillups); + + //! Enable the use of fill-up characters, either those explicitly set or + //! those set by a lexer. By default, fill-up characters are disabled. + //! + //! \sa autoCompletionFillupsEnabled(), setAutoCompletionFillups() + void setAutoCompletionFillupsEnabled(bool enabled); + + //! A start character is one that, when entered, causes the + //! auto-completion list to be displayed. If a language lexer has been + //! set then this is ignored and the lexer defines the start + //! characters. The default is that no start characters are set. + //! + //! \sa setAutoCompletionThreshold() + void setAutoCompletionStartCharacters(const char *start); + + //! Sets the APIs used for call tips to \a apis. If \a apis is 0 then + //! then call tips are disabled. + //! + //! \sa setAutoCompletionAPIs() + void setCallTipsAPIs(QextScintillaAPIs *apis = 0); + + //! Set the background colour of call tips to \a col. The default is + //! white. + void setCallTipsBackgroundColor(const QColor &col); + + //! Set the foreground colour of call tips to \a col. The default is + //! mid-gray. + void setCallTipsForegroundColor(const QColor &col); + + //! Set the highlighted colour of call tip text to \a col. The default + //! is dark blue. + void setCallTipsHighlightColor(const QColor &col); + + //! Set the maximum number of call tips that are displayed to \a nr. + //! If the maximum number is 0 then all applicable call tips are + //! displayed. If the maximum number is -1 then one call tip will be + //! displayed with up and down arrows that allow the use to scroll + //! through the full list. The default is -1. + //! + //! \sa callTipsVisible() + void setCallTipsVisible(int nr); + + //! Attach the document \a document, replacing the currently attached + //! document. + //! + //! \sa document() + void setDocument(const QextScintillaDocument &document); + + //! Set the color of the marker used to show that a line has exceeded + //! the length set by setEdgeColumn(). + //! + //! \sa edgeColor(), \sa setEdgeColumn + void setEdgeColor(const QColor &col); + + //! Set the number of the column after which lines are considered to be + //! long. + //! + //! \sa edgeColumn() + void setEdgeColumn(int colnr); + + //! Set the edge mode which determines how long lines are marked. + //! + //! \sa edgeMode() + void setEdgeMode(EdgeMode mode); + + //! Set the default font. This has no effect if a language lexer has been + //! set. + virtual void setFont(const QFont &f); + + //! Set the background colour, including the alpha component, of marker + //! \a mnr to \a col. If \a mnr is -1 then the colour of all markers + //! is set. The default is white. + //! + //! \sa setMarkerForegroundColor() + void setMarkerBackgroundColor(const QColor &col,int mnr = -1); + + //! Set the foreground colour of marker \a mnr to \a col. If \a mnr is + //! -1 then the colour of all markers is set. The default is black. + //! + //! \sa setMarkerBackgroundColor() + void setMarkerForegroundColor(const QColor &col,int mnr = -1); + + //! Set the background colour used to display matched braces to \a col. + //! The default is white. + //! + //! \sa setMatchedBraceForegroundColor() + void setMatchedBraceBackgroundColor(const QColor &col); + + //! Set the foreground colour used to display matched braces to \a col. + //! The default is red. + //! + //! \sa setMatchedBraceBackgroundColor() + void setMatchedBraceForegroundColor(const QColor &col); + + //! Set the background colour used to display unmatched braces to + //! \a col. The default is white. + //! + //! \sa setUnmatchedBraceForegroundColor() + void setUnmatchedBraceBackgroundColor(const QColor &col); + + //! Set the foreground colour used to display unmatched braces to + //! \a col. The default is blue. + //! + //! \sa setUnmatchedBraceBackgroundColor() + void setUnmatchedBraceForegroundColor(const QColor &col); + + //! Set the visual flags displayed when a line is wrapped. \a eflag + //! determines if and where the flag at the end of a line is displayed. + //! \a sflag determines if and where the flag at the start of a line is + //! displayed. \a sindent is the number of characters a wrapped line + //! is indented by. By default no visual flags are displayed. + void setWrapVisualFlags(WrapVisualFlag eflag, + WrapVisualFlag sflag = WrapFlagNone, int sindent = 0); + + //! Returns the selected text or an empty string if there is no + //! currently selected text. + //! + //! \sa hasSelectedText() + QString selectedText(); + + //! Displays a user defined list which can be interacted with like an + //! auto-completion list. \a id is an identifier for the list which + //! is passed as an argument to the userListActivated() signal and must + //! be at least 1. \a list is the text with which the list is + //! populated. + //! + //! \sa cancelList(), isListActive(), userListActivated() + void showUserList(int id, const QStringList &list); + + //! The standard command set is returned. + QextScintillaCommandSet *standardCommands() const {return stdCmds;} + + //! Returns TRUE if the tab key indents a line instead of inserting a + //! tab character. The default is TRUE. + //! + //! \sa setTabIndents(), backspaceUnindents(), setBackspaceUnindents() + bool tabIndents(); + + //! Returns the tab width in characters. The default is 8. + //! + //! \sa setTabWidth() + int tabWidth(); + + //! Returns the text edit's text. + //! + //! \sa setText() + QString text(); + + //! \overload + //! + //! Returns the text of line \a line. + //! + //! \sa setText() + QString text(int line); + + //! Returns the height in pixels of the text in line number \a linenr. + int textHeight(int linenr); + + //! Returns the visibility of whitespace. + //! + //! \sa setWhitespaceVisibility() + WhitespaceVisibility whitespaceVisibility(); + + //! Returns the line wrap mode. + //! + //! \sa setWrapMode() + WrapMode wrapMode(); + +public slots: + //! Appends the text \a text to the end of the text edit. Note that + //! the undo/redo history is cleared by this function. + virtual void append(const QString &text); + + //! Display an auto-completion list based on any installed APIs, the + //! current contents of the document and the characters immediately to + //! the left of the cursor. + //! + //! \sa autoCompleteFromAPIs(), autoCompleteFromDocument() + virtual void autoCompleteFromAll(); + + //! Display an auto-completion list based on any installed APIs and the + //! characters immediately to the left of the cursor. + //! + //! \sa autoCompleteFromAll(), autoCompleteFromDocument(), + //! setAutoCompletionAPIs() + virtual void autoCompleteFromAPIs(); + + //! Display an auto-completion list based on the current contents of + //! the document and the characters immediately to the left of the + //! cursor. + //! + //! \sa autoCompleteFromAll(), autoCompleteFromAPIs() + virtual void autoCompleteFromDocument(); + + //! Display a call tip based on the the characters immediately to the + //! left of the cursor. + virtual void callTip(); + + //! Deletes all the text in the text edit. + virtual void clear(); + + //! Copies any selected text to the clipboard. + //! + //! \sa copyAvailable(), cut(), paste() + virtual void copy(); + + //! Copies any selected text to the clipboard and then deletes the + //! text. + //! + //! \sa copy(), paste() + virtual void cut(); + + //! Ensures that the cursor is visible. + virtual void ensureCursorVisible(); + + //! Ensures that the line number \a line is visible. + virtual void ensureLineVisible(int line); + + //! If any lines are currently folded then they are all unfolded. + //! Otherwise all lines are folded. This has the same effect as + //! clicking in the fold margin with the shift and control keys + //! pressed. If \a children is not set (the default) then only the top + //! level fold points are affected, otherwise the state of all fold + //! points are changed. + virtual void foldAll(bool children = FALSE); + + //! If the line \a line is folded then it is unfolded. Otherwise it is + //! folded. This has the same effect as clicking in the fold margin. + virtual void foldLine(int line); + + //! Increases the indentation of line \a line by an indentation width. + //! + //! \sa unindent() + virtual void indent(int line); + + //! Insert the text \a text at the current position. + virtual void insert(const QString &text); + + //! Insert the text \a text in the line \a line at the position + //! \a index. + virtual void insertAt(const QString &text,int line,int index); + + //! If the cursor is either side of a brace character then move it to + //! the position of the corresponding brace. + virtual void moveToMatchingBrace(); + + //! Pastes any text from the clipboard into the text edit at the + //! current cursor position. + //! + //! \sa copy(), cut() + virtual void paste(); + + //! Redo the last change or sequence of changes. + //! + //! \sa isRedoAvailable() + virtual void redo(); + + //! Removes any selected text. + virtual void removeSelectedText(); + + //! Resets the background colour of selected text to the default. + //! + //! \sa setSelectionBackgroundColor(), resetSelectionForegroundColor() + virtual void resetSelectionBackgroundColor(); + + //! Resets the foreground colour of selected text to the default. + //! + //! \sa setSelectionForegroundColor(), resetSelectionBackgroundColor() + virtual void resetSelectionForegroundColor(); + + //! If \a select is TRUE (the default) then all the text is selected. + //! If \a select is FALSE then any currently selected text is + //! deselected. + virtual void selectAll(bool select = TRUE); + + //! If the cursor is either side of a brace character then move it to + //! the position of the corresponding brace and select the text between + //! the braces. + virtual void selectToMatchingBrace(); + + //! If \a cs is TRUE then auto-completion lists are case sensitive. + //! The default is TRUE. + //! + //! \sa autoCompletionCaseSensitivity() + virtual void setAutoCompletionCaseSensitivity(bool cs); + + //! If \a replace is TRUE then when an item from an auto-completion + //! list is selected, the rest of the word to the right of the current + //! cursor is removed. The default is FALSE. + //! + //! \sa autoCompletionReplaceWord() + virtual void setAutoCompletionReplaceWord(bool replace); + + //! If \a single is TRUE then when there is only a single entry in an + //! auto-completion list it is automatically used and the list is not + //! displayed. This only has an effect when auto-completion is + //! explicitly requested (using autoCompleteFromAPIs() and + //! autoCompleteFromDocument()) and has no effect when auto-completion + //! is triggered as the user types. The default is FALSE. + //! + //! \sa autoCompletionShowSingle() + virtual void setAutoCompletionShowSingle(bool single); + + //! Sets the source for the auto-completion list when it is being + //! displayed automatically as the user types to \a source. The + //! default is AcsDocument. + //! + //! \sa autoCompletionSource() + virtual void setAutoCompletionSource(AutoCompletionSource source); + + //! Sets the threshold for the automatic display of the auto-completion + //! list as the user types to \a thresh. The threshold is the number + //! of characters that the user must type before the list is displayed. + //! If the threshold is less than or equal to 0 then the list is + //! disabled. The default is -1. + //! + //! \sa autoCompletionThreshold(), setAutoCompletionStartCharacters() + virtual void setAutoCompletionThreshold(int thresh); + + //! If \a autoindent is TRUE then auto-indentation is enabled. The + //! default is FALSE. + //! + //! \sa autoIndent() + virtual void setAutoIndent(bool autoindent); + + //! Sets the brace matching mode to \a bm. The default is + //! NoBraceMatching. + //! + //! \sa braceMatching() + virtual void setBraceMatching(BraceMatch bm); + + //! If \a deindent is TRUE then the backspace key will unindent a line + //! rather then delete a character. + //! + //! \sa backspaceUnindents(), tabIndents(), setTabIndents() + virtual void setBackspaceUnindents(bool unindent); + + //! Sets the foreground colour of the caret to \a col. + virtual void setCaretForegroundColor(const QColor &col); + + //! Sets the background colour, including the alpha component, of the + //! line containing the caret to \a col. + //! + //! \sa setCaretLineVisible() + virtual void setCaretLineBackgroundColor(const QColor &col); + + //! Enables or disables, according to \a enable, the background color + //! of the line containing the caret. + //! + //! \sa setCaretLineBackgroundColor() + virtual void setCaretLineVisible(bool enable); + + //! Sets the width of the caret to \a width pixels. A \a width of 0 + //! makes the caret invisible. + virtual void setCaretWidth(int width); + + //! The widget's text (ie. foreground) colour is set to \a c. This has no + //! effect if a language lexer has been set. + //! + //! \sa color() + virtual void setColor(const QColor &c); + + //! Sets the cursor to the line \a line at the position \a index. + //! + //! \sa getCursorPosition() + virtual void setCursorPosition(int line,int index); + + //! Sets the end-of-line mode to \a mode. The default is the + //! platform's natural mode. + //! + //! \sa eolMode() + virtual void setEolMode(EolMode mode); + + //! If \a visible is TRUE then end-of-lines are made visible. The + //! default is that they are invisible. + //! + //! \sa eolVisibility() + virtual void setEolVisibility(bool visible); + + //! Sets the folding style for margin 2 to \a fold. The default is + //! NoFoldStyle (ie. folding is disabled). + //! + //! \sa folding() + virtual void setFolding(FoldStyle fold); + + //! Sets the indentation of line \a to \a indentation characters. + //! + //! \sa indentation() + virtual void setIndentation(int line,int indentation); + + //! Enables or disables, according to \a enable, this display of + //! indentation guides. + //! + //! \sa indentationGuides() + virtual void setIndentationGuides(bool enable); + + //! Set the background colour of indentation guides to \a col. + //! + //! \sa setIndentationGuidesForegroundColor() + virtual void setIndentationGuidesBackgroundColor(const QColor &col); + + //! Set the foreground colour of indentation guides to \a col. + //! + //! \sa setIndentationGuidesBackgroundColor() + virtual void setIndentationGuidesForegroundColor(const QColor &col); + + //! If \a tabs is TRUE then indentations are created using tabs and + //! spaces, rather than just spaces. + //! + //! \sa indentationsUseTabs() + virtual void setIndentationsUseTabs(bool tabs); + + //! Sets the indentation width to \a width characters. If \a width is + //! 0 then the value returned by tabWidth() is used. + //! + //! \sa indentationWidth(), tabWidth() + virtual void setIndentationWidth(int width); + + //! Sets the specific language lexer used to style text to \a lexer. If + //! \a lexer is 0 then syntax styling is disabled. + //! + //! \sa lexer() + virtual void setLexer(QextScintillaLexer *lexer = 0); + + //! Set the background colour of all margins to \a col. The default is + //! a gray. + //! + //! \sa setMarginsForegroundColor() + virtual void setMarginsBackgroundColor(const QColor &col); + + //! Set the font used in all margins to \a f. + virtual void setMarginsFont(const QFont &f); + + //! Set the foreground colour of all margins to \a col. The default is + //! black. + //! + //! \sa setMarginsBackgroundColor() + virtual void setMarginsForegroundColor(const QColor &col); + + //! Enables or disables, according to \a lnrs, the display of line + //! numbers in margin \a margin. + //! + //! \sa marginLineNumbers(), QextScintillaBase::SCI_SETMARGINTYPEN + virtual void setMarginLineNumbers(int margin,bool lnrs); + + //! Sets the marker mask of margin \a margin to \a mask. Only those + //! markers whose bit is set in the mask are displayed in the margin. + //! + //! \sa marginMarkerMask(), QextScintillaMarker, + //! QextScintillaBase::SCI_SETMARGINMASKN + virtual void setMarginMarkerMask(int margin,int mask); + + //! Enables or disables, according to \a sens, the sensitivity of + //! margin \a margin to mouse clicks. If the user clicks in a + //! sensitive margin the marginClicked() signal is emitted. + //! + //! \sa marginSensitivity(), marginClicked(), + //! QextScintillaBase::SCI_SETMARGINSENSITIVEN + virtual void setMarginSensitivity(int margin,bool sens); + + //! Sets the width of margin \a margin to \a width pixels. If the + //! width of a margin is 0 then it is not displayed. + //! + //! \sa marginWidth(), QextScintillaBase::SCI_SETMARGINWIDTHN + virtual void setMarginWidth(int margin,int width); + + //! Sets the width of margin \a margin so that it is wide enough to + //! display \a s in the current margin font. + //! + //! \sa marginWidth(), QextScintillaBase::SCI_SETMARGINWIDTHN + virtual void setMarginWidth(int margin,const QString &s); + + //! Sets the modified state of the text edit to \a m. Note that it is + //! only possible to clear the modified state (where \a m is FALSE). + //! Attempts to set the modified state (where \a m is TRUE) are + //! ignored. + //! + //! \sa isModified(), modificationChanged() + virtual void setModified(bool m); + + //! The widget's paper (ie. background) colour is set to \a c. This has no + //! effect if a language lexer has been set. + //! + //! \sa paper() + virtual void setPaper(const QColor &c); + + //! Sets the read-only state of the text edit to \a ro. + //! + //! \sa isReadOnly() + virtual void setReadOnly(bool ro); + + //! Sets the selection which starts at position \a indexFrom in line + //! \a lineFrom and ends at position \a indexTo in line \a lineTo. The + //! cursor is moved to the end of the selection. + //! + //! \sa getSelection() + virtual void setSelection(int lineFrom,int indexFrom, + int lineTo,int indexTo); + + //! Sets the background colour, including the alpha component, of + //! selected text to \a col. + //! + //! \sa resetSelectionBackgroundColor(), setSelectionForegroundColor() + virtual void setSelectionBackgroundColor(const QColor &col); + + //! Sets the foreground colour of selected text to \a col. + //! + //! \sa resetSelectionForegroundColor(), setSelectionBackgroundColor() + virtual void setSelectionForegroundColor(const QColor &col); + + //! If \a indent is TRUE then the tab key will indent a line rather + //! then insert a tab character. + //! + //! \sa tabIndents(), backspaceUnindents(), setBackspaceUnindents() + virtual void setTabIndents(bool indent); + + //! Sets the tab width to \a width characters. + //! + //! \sa tabWidth() + virtual void setTabWidth(int width); + + //! Replaces all of the current text with \a text. Note that the + //! undo/redo history is cleared by this function. + //! + //! \sa text() + virtual void setText(const QString &text); + + //! Sets the current text encoding. If \a cp is TRUE then UTF8 is + //! used, otherwise Latin1 is used. + //! + //! \sa isUtf8() + virtual void setUtf8(bool cp); + + //! Sets the visibility of whitespace to mode \a mode. The default is + //! that whitespace is invisible. + //! + //! \sa whitespaceVisibility() + virtual void setWhitespaceVisibility(WhitespaceVisibility mode); + + //! Sets the line wrap mode to mode \a mode. The default is that lines + //! are not wrapped. + //! + //! \sa wrapMode() + virtual void setWrapMode(WrapMode mode); + + //! Undo the last change or sequence of changes. + //! + //! Scintilla has multiple level undo and redo. It will continue to + //! record undoable actions until memory runs out. Sequences of + //! typing or deleting are compressed into single actions to make it + //! easier to undo and redo at a sensible level of detail. Sequences + //! of actions can be combined into actions that are undone as a unit. + //! These sequences occur between calls to beginUndoAction() and + //! endUndoAction(). These sequences can be nested and only the top + //! level sequences are undone as units. + //! + //! \sa beginUndoAction(), endUndoAction(), isUndoAvailable() + virtual void undo(); + + //! Decreases the indentation of line \a line by an indentation width. + //! + //! \sa indent() + virtual void unindent(int line); + + //! Zooms in on the text by by making the base font size \a range + //! points larger and recalculating all font sizes. + //! + //! \sa zoomOut(), zoomTo() + virtual void zoomIn(int range); + + //! \overload + //! + //! Zooms in on the text by by making the base font size one point + //! larger and recalculating all font sizes. + virtual void zoomIn(); + + //! Zooms out on the text by by making the base font size \a range + //! points smaller and recalculating all font sizes. + //! + //! \sa zoomIn(), zoomTo() + virtual void zoomOut(int range); + + //! \overload + //! + //! Zooms out on the text by by making the base font size one point + //! larger and recalculating all font sizes. + virtual void zoomOut(); + + //! Zooms the text by making the base font size \a size points and + //! recalculating all font sizes. + //! + //! \sa zoomIn(), zoomOut() + virtual void zoomTo(int size); + +signals: + //! This signal is emitted whenever the cursor position changes. + //! \a line contains the line number and \a pos contains the + //! character position within the line. + void cursorPositionChanged(int line,int pos); + + //! This signal is emitted whenever text is selected or de-selected. + //! \a yes is TRUE if text has been selected and FALSE if text has been + //! deselected. If \a yes is TRUE then copy() can be used to copy the + //! selection to the clipboard. If \a yes is FALSE then copy() does + //! nothing. + //! + //! \sa copy(), selectionChanged() + void copyAvailable(bool yes); + + //! This signal is emitted whenever the user clicks on a sensitive + //! margin. \a margin is the margin. \a line is the number of the + //! line where the user clicked. \a state is the state of the modifier + //! keys (ShiftButton, ControlButton and AltButton) when the user + //! clicked. + //! + //! \sa marginSensitivity(), setMarginSensitivity() + void marginClicked(int margin,int line,Qt::ButtonState state); + + //! This signal is emitted whenever the user attempts to modify + //! read-only text. + //! + //! \sa isReadOnly(), setReadOnly() + void modificationAttempted(); + + //! This signal is emitted whenever the modification state of the text + //! changes. \a m is TRUE if the text has been modified. + //! + //! \sa isModified(), setModified() + void modificationChanged(bool m); + + //! This signal is emitted whenever the selection changes. + //! + //! \sa copyAvailable() + void selectionChanged(); + + //! This signal is emitted whenever the text in the text edit changes. + void textChanged(); + + //! This signal is emitted when an item in a user defined list is + //! activated (selected). \a id is the list identifier. \a string is + //! the text of the item. + //! + //! \sa showUserList() + void userListActivated(int id, const QString &string); + +private slots: + void handleCallTipClick(int dir); + void handleCharAdded(int charadded); + void handleMarginClick(int pos,int margin,int modifiers); + void handleModified(int pos,int mtype,const char *text,int len, + int added,int line,int foldNow,int foldPrev); + void handlePropertyChange(const char *prop,const char *val); + void handleSavePointReached(); + void handleSavePointLeft(); + void handleSelectionChanged(bool yes); + void handleUserListSelection(const char *text, int id); + + void handleStyleColorChange(const QColor &c,int style); + void handleStyleEolFillChange(bool eolfill,int style); + void handleStyleFontChange(const QFont &f,int style); + void handleStylePaperChange(const QColor &c,int style); + + void handleUpdateUI(); + +private: + enum IndentState { + isNone, + isKeywordStart, + isBlockStart, + isBlockEnd + }; + + void maintainIndentation(char ch,long pos); + void autoIndentation(char ch,long pos); + void autoIndentLine(long pos,int line,int indent); + int blockIndent(int line); + IndentState getIndentState(int line); + bool rangeIsWhitespace(long spos,long epos); + int findStyledWord(const char *text,int style,const char *words); + + void checkMarker(int &mnr); + long posFromLineIndex(int line,int index); + void lineIndexFromPos(long pos,int *line,int *index); + int currentIndent(); + int indentWidth(); + bool doFind(); + long simpleFind(); + void foldClick(int lineClick,int bstate); + void foldChanged(int line,int levelNow,int levelPrev); + void foldExpand(int &line,bool doExpand,bool force = FALSE, + int visLevels = 0,int level = -1); + void setFoldMarker(int marknr,int mark = SC_MARK_EMPTY); + QString convertText(const char *s); + void setStylesFont(const QFont &f,int style); + + void braceMatch(); + bool findMatchingBrace(long &brace,long &other,BraceMatch mode); + long checkBrace(long pos,int brace_style,bool &colonMode); + void gotoMatchingBrace(bool select); + + void startAutoCompletion(AutoCompletionSource acs, bool checkThresh, + bool single); + bool isAutoCStartChar(char ch) const; + + bool currentCharInWord(); + bool isWordChar(char ch) const; + + bool ensureRW(); + + struct FindState + { + FindState() : inProgress(0) {} + + bool inProgress; + QString expr; + bool wrap; + bool forward; + int flags; + long startpos; + long endpos; + bool show; + }; + + FindState findState; + + unsigned allocatedMarkers; + long oldPos; + bool selText; + FoldStyle fold; + bool autoInd; + BraceMatch braceMode; + AutoCompletionSource acSource; + int acThresh; + const char *acStart; + QextScintillaAPIs *acAPIs; + QextScintillaAPIs *ctAPIs; + int maxCallTips; + bool showSingle; + long ctpos; + QGuardedPtr<QextScintillaLexer> lex; + QextScintillaCommandSet *stdCmds; + QextScintillaDocument doc; + bool modified; + QColor nl_text_colour; + QColor nl_paper_colour; + QFont nl_font; + bool explicit_fillups; + bool fillups_enabled; + QCString saved_fillups; + +#if defined(Q_DISABLE_COPY) + QextScintilla(const QextScintilla &); + QextScintilla &operator=(const QextScintilla &); +#endif +}; + +#endif diff --git a/qt/qextscintillaapis.cpp b/qt/qextscintillaapis.cpp new file mode 100644 index 0000000..2ab7397 --- /dev/null +++ b/qt/qextscintillaapis.cpp @@ -0,0 +1,210 @@ +// This module implements the QextScintillaAPIs class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qfile.h> +#include <qregexp.h> + +#include "qextscintillaapis.h" + + +// The ctor. +QextScintillaAPIs::QextScintillaAPIs() : sorted(TRUE), ctcursor(0) +{ +} + + +// The dtor. +QextScintillaAPIs::~QextScintillaAPIs() +{ +} + + +// Clear out all API information. +bool QextScintillaAPIs::load(const QString &fname) +{ + QFile f(fname); + + if (!f.open(IO_ReadOnly)) + return FALSE; + + QTextStream ts(&f); + + for (;;) + { + QString line = ts.readLine(); + + if (line.isNull()) + break; + + apis.append(line); + } + + sorted = FALSE; + + return TRUE; +} + + +// Add a single API entry. +void QextScintillaAPIs::add(const QString &entry) +{ + apis.append(entry); + sorted = FALSE; +} + + +// Clear out all API information. +void QextScintillaAPIs::clear() +{ + apis.clear(); + sorted = TRUE; +} + + +// Add auto-completion words to an existing list. +void QextScintillaAPIs::autoCompletionList(const QString &starts, bool cs, + QStringList &wlist) +{ + ensureSorted(); + + QStringList::ConstIterator it = apis.begin(); + + // Find the first match in the sorted list. + while (it != apis.end()) + { + if ((*it).find(starts, 0, cs) == 0) + break; + + ++it; + } + + QString prev; + + while (it != apis.end()) + { + if ((*it).find(starts, 0, cs) != 0) + break; + + QString w = (*it).section('(', 0, 0); + + if (w != prev) + { + if (wlist.findIndex(w) < 0) + wlist.append(w); + + prev = w; + } + + ++it; + } +} + + +// Return the call tip for a function. +QString QextScintillaAPIs::callTips(const QString &function,int maxnr, + int commas) +{ + ensureSorted(); + + QStringList::ConstIterator it; + + // Find the first match in the sorted list. + for (it = apis.begin(); it != apis.end(); ++it) + if ((*it).startsWith(function)) + break; + + QStringList cts; + QString prev; + + while (it != apis.end() && (*it).startsWith(function)) + { + if (maxnr > 0 && maxnr == cts.count()) + break; + + QString w = *it; + + // Remove any image ID used by auto-completion. + w.replace(QRegExp("\\?[^(]*"),""); + + if (w.find('(') == function.length() && w.contains(',') >= commas && w != prev) + { + cts.append(w); + prev = w; + } + + ++it; + } + + // See if we want to add a down arrow. + if (maxnr < 0 && cts.count() > 1) + { + // Remember the state so we can scroll through it later. + ctlist = cts; + ctcursor = 0; + + QString ct = cts[0]; + + ct.prepend('\002'); + + return ct; + } + + ctlist.clear(); + + return cts.join("\n"); +} + + +// Return the next or previous call tip. +QString QextScintillaAPIs::callTipsNextPrev(int dir) +{ + QString ct; + + // Get the call tip. + if (dir == 1 && ctcursor > 0) + ct = ctlist[--ctcursor]; + else if (dir == 2 && ctcursor < ctlist.count() - 1) + ct = ctlist[++ctcursor]; + + // Add the arrows. + if (!ct.isNull()) + { + if (ctcursor < ctlist.count() - 1) + ct.prepend('\002'); + + if (ctcursor > 0) + ct.prepend('\001'); + } + + return ct; +} + + +// Ensure the list is sorted. +void QextScintillaAPIs::ensureSorted() +{ + if (!sorted) + { + apis.sort(); + sorted = TRUE; + } +} diff --git a/qt/qextscintillaapis.h b/qt/qextscintillaapis.h new file mode 100644 index 0000000..e112e41 --- /dev/null +++ b/qt/qextscintillaapis.h @@ -0,0 +1,84 @@ +// This module defines interface to the QextScintillaAPIs class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLAAPIS_H +#define QEXTSCINTILLAAPIS_H + + +#include <qstringlist.h> + +#include <qextscintillaglobal.h> + + +//! \brief The QextScintillaAPIs class represents the textual API information +//! used in call tips and for auto-completion. +//! +//! API information is read from one or more files. Each API function is +//! described by a single line of text comprising the function's name, followed +//! by the function's optional comma separated parameters enclosed in +//! parenthesis, and finally followed by optional explanatory text. +//! +//! A function name may be followed by a `?' and a number. The number is used +//! by auto-completion to display a registered QPixmap with the function name. +//! +//! All function names are used by auto-completion, but only those that include +//! function parameters are used in call tips. +class QEXTSCINTILLA_EXPORT QextScintillaAPIs +{ +public: + //! Constructs a QextScintillaAPIs instance. + QextScintillaAPIs(); + + //! Destroys the QextScintillaAPIs instance. + ~QextScintillaAPIs(); + + //! Add the single API entry \a entry to the current set. + void add(const QString &entry); + + //! Load the API information from the file named \a fname, adding it to + //! the current set. Returns TRUE if successful, otherwise FALSE. + bool load(const QString &fname); + + //! Deletes all API information. + void clear(); + +private: + friend class QextScintilla; + + void autoCompletionList(const QString &starts, bool cs, + QStringList &wlist); + QString callTips(const QString &function,int maxnr,int commas); + QString callTipsNextPrev(int dir); + void ensureSorted(); + + bool sorted; + int ctcursor; + QStringList apis; + QStringList ctlist; + +#if defined(Q_DISABLE_COPY) + QextScintillaAPIs(const QextScintillaAPIs &); + QextScintillaAPIs &operator=(const QextScintillaAPIs &); +#endif +}; + +#endif diff --git a/qt/qextscintillabase.cpp b/qt/qextscintillabase.cpp new file mode 100644 index 0000000..63330d4 --- /dev/null +++ b/qt/qextscintillabase.cpp @@ -0,0 +1,582 @@ +// This module implements the "official" low-level API. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qapplication.h> +#include <qclipboard.h> +#include <qscrollbar.h> +#include <qlayout.h> +#include <qcolor.h> +#include <qevent.h> +#include <qdragobject.h> +#include <qpainter.h> +#include <qptrlist.h> + +#include "qextscintillabase.h" +#include "ScintillaQt.h" + + +// The #defines in Scintilla.h and the enums in qextscintillabase.h conflict +// (because we want to use the same names) so we have to undefine those we use +// in this file. +#undef SCI_SETCARETPERIOD +#undef SCK_DOWN +#undef SCK_UP +#undef SCK_LEFT +#undef SCK_RIGHT +#undef SCK_HOME +#undef SCK_END +#undef SCK_PRIOR +#undef SCK_NEXT +#undef SCK_DELETE +#undef SCK_INSERT +#undef SCK_ESCAPE +#undef SCK_BACK +#undef SCK_TAB +#undef SCK_RETURN +#undef SCK_ADD +#undef SCK_SUBTRACT +#undef SCK_DIVIDE + + +// Remember if we have linked the lexers. +static bool lexersLinked = FALSE; + +// The list of instances. +static QPtrList<QextScintillaBase> poolList; + + +// The ctor. +QextScintillaBase::QextScintillaBase(QWidget *parent,const char *name,WFlags f) + : QWidget(parent,name,f) +{ + sci = 0; + + QGridLayout *layout = new QGridLayout(this,2,2); + + txtarea = new QWidget(this,0,WRepaintNoErase|WResizeNoErase); + txtarea -> setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); + txtarea -> setMouseTracking(TRUE); + txtarea -> setAcceptDrops(TRUE); + txtarea -> setFocusPolicy(WheelFocus); + txtarea -> setFocusProxy(this); + layout -> addWidget(txtarea,0,0); + + vsb = new QScrollBar(Vertical,this); + layout -> addWidget(vsb,0,1); + connect(vsb,SIGNAL(valueChanged(int)),SLOT(handleVSb(int))); + + hsb = new QScrollBar(Horizontal,this); + layout -> addWidget(hsb,1,0); + connect(hsb,SIGNAL(valueChanged(int)),SLOT(handleHSb(int))); + + txtarea -> installEventFilter(this); + + setFocusPolicy(WheelFocus); + + sci = new ScintillaQt(this); + + SendScintilla(SCI_SETCARETPERIOD,QApplication::cursorFlashTime() / 2); + + // Make sure the lexers are linked in. + if (!lexersLinked) + { + Scintilla_LinkLexers(); + + lexersLinked = TRUE; + } + + QClipboard *cb = QApplication::clipboard(); + + if (cb -> supportsSelection()) + connect(cb,SIGNAL(selectionChanged()),SLOT(handleSelection())); + + // Add it to the pool. + poolList.append(this); +} + + +// The dtor. +QextScintillaBase::~QextScintillaBase() +{ + // Remove it from the pool. + poolList.remove(this); + + delete sci; +} + + +// Return the viewport widget. +QWidget *QextScintillaBase::viewport() const +{ + return txtarea; +} + + +// Return an instance from the pool. +QextScintillaBase *QextScintillaBase::pool() +{ + return poolList.first(); +} + + +// Send a message to the real Scintilla widget using the low level Scintilla +// API. +long QextScintillaBase::SendScintilla(unsigned int msg,unsigned long wParam, + long lParam) +{ + return sci -> WndProc(msg,wParam,lParam); +} + + +// Send a message to the real Scintilla widget that needs a TextRange +// structure. +long QextScintillaBase::SendScintilla(unsigned int msg,long cpMin,long cpMax, + char *lpstrText) +{ + TextRange tr; + + tr.chrg.cpMin = cpMin; + tr.chrg.cpMax = cpMax; + tr.lpstrText = lpstrText; + + return sci -> WndProc(msg,0,reinterpret_cast<long>(&tr)); +} + + +// Send a message to the real Scintilla widget that needs a RangeToFormat +// structure. +long QextScintillaBase::SendScintilla(unsigned int msg,unsigned long wParam, + QPainter *hdc,const QRect &rc, + long cpMin,long cpMax) +{ + RangeToFormat rf; + + rf.hdc = rf.hdcTarget = reinterpret_cast<SurfaceID>(hdc); + + rf.rc.left = rc.left(); + rf.rc.top = rc.top(); + rf.rc.right = rc.right() + 1; + rf.rc.bottom = rc.bottom() + 1; + + rf.chrg.cpMin = cpMin; + rf.chrg.cpMax = cpMax; + + return sci -> WndProc(msg,wParam,reinterpret_cast<long>(&rf)); +} + + +// Send a message to the real Scintilla widget that needs a colour. +long QextScintillaBase::SendScintilla(unsigned int msg,unsigned long wParam, + const QColor &col) +{ + long lParam = (col.blue() << 16) | (col.green() << 8) | col.red(); + + return sci -> WndProc(msg,wParam,lParam); +} + + +// Send a message to the real Scintilla widget that needs a colour. +long QextScintillaBase::SendScintilla(unsigned int msg,const QColor &col) +{ + unsigned long wParam = (col.blue() << 16) | (col.green() << 8) | col.red(); + + return sci -> WndProc(msg,wParam,0); +} + + +// Handle events on behalf of the text area. +bool QextScintillaBase::eventFilter(QObject *o,QEvent *e) +{ + if (o != txtarea) + return QWidget::eventFilter(o,e); + + bool used = TRUE; + + switch (e -> type()) + { + case QEvent::Paint: + sci -> paintEvent(static_cast<QPaintEvent *>(e)); + break; + + case QEvent::Resize: + sci -> ChangeSize(); + break; + + case QEvent::MouseButtonPress: + mousePress(static_cast<QMouseEvent *>(e)); + break; + + case QEvent::MouseButtonRelease: + mouseRelease(static_cast<QMouseEvent *>(e)); + break; + + case QEvent::MouseButtonDblClick: + mouseDoubleClick(static_cast<QMouseEvent *>(e)); + break; + + case QEvent::MouseMove: + mouseMove(static_cast<QMouseEvent *>(e)); + break; + + case QEvent::Wheel: + mouseWheel(static_cast<QWheelEvent *>(e)); + break; + + case QEvent::ContextMenu: + contextMenu(static_cast<QContextMenuEvent *>(e)); + break; + + case QEvent::DragEnter: + sci -> dragEnterEvent(static_cast<QDragEnterEvent *>(e)); + break; + + case QEvent::DragMove: + sci -> dragMoveEvent(static_cast<QDragMoveEvent *>(e)); + break; + + case QEvent::DragLeave: + sci -> dragLeaveEvent(static_cast<QDragLeaveEvent *>(e)); + break; + + case QEvent::Drop: + sci -> dropEvent(static_cast<QDropEvent *>(e)); + break; + + default: + used = FALSE; + } + + return used; +} + + +// Handle the timer on behalf of the ScintillaQt instance. +void QextScintillaBase::handleTimer() +{ + sci -> Tick(); +} + + +// Handle the context menu on behalf of the ScintillaQt instance. +void QextScintillaBase::handlePopUp(int cmd) +{ + sci -> Command(cmd); +} + + +// Re-implemented to tell the widget it has the focus. +void QextScintillaBase::focusInEvent(QFocusEvent *) +{ + sci -> SetFocusState(true); +} + + +// Re-implemented to tell the widget it has lost the focus. +void QextScintillaBase::focusOutEvent(QFocusEvent *) +{ + sci -> SetFocusState(false); +} + + +// Handle a mouse button press. +void QextScintillaBase::mousePress(QMouseEvent *me) +{ + setFocus(); + + Point pt(me -> x(),me -> y()); + + switch (me -> button()) + { + case LeftButton: + { + unsigned clickTime; + + // It is a triple click if the timer is running and the + // mouse hasn't moved too much. + if (triple_click.isActive() && (me -> globalPos() - triple_click_at).manhattanLength() < QApplication::startDragDistance()) + clickTime = sci -> lastClickTime + Platform::DoubleClickTime() - 1; + else + clickTime = sci -> lastClickTime + Platform::DoubleClickTime() + 1; + + triple_click.stop(); + + bool shift = me -> state() & ShiftButton; + bool ctrl = me -> state() & ControlButton; + bool alt = me -> state() & AltButton; + + sci -> ButtonDown(pt,clickTime,shift,ctrl,alt); + break; + } + + case MidButton: + { + QClipboard *cb = QApplication::clipboard(); + + if (cb -> supportsSelection()) + { + cb -> setSelectionMode(TRUE); + + int pos = sci -> PositionFromLocation(pt); + + sci -> SetSelection(pos,pos); + sci -> Paste(); + + cb -> setSelectionMode(FALSE); + } + + break; + } + + default: + break; + } +} + + +// Handle a context menu event. +void QextScintillaBase::contextMenu(QContextMenuEvent *cme) +{ + QApplication::sendEvent(this,cme); + + if (!cme -> isConsumed()) + sci -> ContextMenu(Point(cme -> globalX(),cme -> globalY())); +} + + +// Handle a mouse button releases. +void QextScintillaBase::mouseRelease(QMouseEvent *me) +{ + if (sci -> HaveMouseCapture() && me -> button() == LeftButton) + { + bool ctrl = me -> state() & ControlButton; + + sci -> ButtonUp(Point(me -> x(),me -> y()),0,ctrl); + } +} + + +// Handle a mouse move. +void QextScintillaBase::mouseMove(QMouseEvent *me) +{ + sci -> ButtonMove(Point(me -> x(),me -> y())); +} + + +// Handle a mouse wheel event. +void QextScintillaBase::mouseWheel(QWheelEvent *we) +{ + setFocus(); + + if (we -> orientation() == Horizontal || we -> state() & ShiftButton) + QApplication::sendEvent(hsb,we); + else if (we -> orientation() == Vertical) + QApplication::sendEvent(vsb,we); +} + + +// Handle a mouse button double click. +void QextScintillaBase::mouseDoubleClick(QMouseEvent *me) +{ + setFocus(); + + if (me -> button() == LeftButton) + { + // Make sure Scintilla will interpret this as a double-click. + unsigned clickTime = sci -> lastClickTime + Platform::DoubleClickTime() - 1; + + bool shift = me -> state() & ShiftButton; + bool ctrl = me -> state() & ControlButton; + bool alt = me -> state() & AltButton; + + sci -> ButtonDown(Point(me -> x(),me -> y()),clickTime,shift,ctrl,alt); + + // Remember the current position and time in case it turns into a + // triple click. + triple_click_at = me -> globalPos(); + triple_click.start(QApplication::doubleClickInterval()); + } +} + + +// Re-implemented to handle key press events. +void QextScintillaBase::keyPressEvent(QKeyEvent *ke) +{ + unsigned key; + + switch (ke -> key()) + { + case Key_Down: + key = SCK_DOWN; + break; + + case Key_Up: + key = SCK_UP; + break; + + case Key_Left: + key = SCK_LEFT; + break; + + case Key_Right: + key = SCK_RIGHT; + break; + + case Key_Home: + key = SCK_HOME; + break; + + case Key_End: + key = SCK_END; + break; + + case Key_Prior: + key = SCK_PRIOR; + break; + + case Key_Next: + key = SCK_NEXT; + break; + + case Key_Delete: + key = SCK_DELETE; + break; + + case Key_Insert: + key = SCK_INSERT; + break; + + case Key_Escape: + key = SCK_ESCAPE; + break; + + case Key_Backspace: + key = SCK_BACK; + break; + + case Key_Tab: + key = SCK_TAB; + break; + + case Key_Return: + case Key_Enter: + key = SCK_RETURN; + break; + + default: + if (sci -> IsUnicodeMode()) + { + // Work out if the original input was a single ASCII + // key. + if (ke -> text().length() == 1) + { + if ((key = ke -> text()[0].unicode()) >= 0x80) + key = 0; + } + else + key = 0; + } + else + { + key = ke -> ascii(); + + if (key >= 0x01 && key <= 0x1f) + key += 0x40; + } + } + + bool consumed = FALSE; + + if (key) + { + bool shift = ke -> state() & ShiftButton; + bool ctrl = ke -> state() & ControlButton; + bool alt = ke -> state() & AltButton; + + // If the character is eventually added by KeyDefault() then + // the return value of KeyDown() will be true, but consumed + // will incorrectly be false. + if (sci -> KeyDown(key,shift,ctrl,alt,&consumed) && !consumed) + consumed = TRUE; + } + else if (sci -> IsUnicodeMode()) + { + if (ke -> text().length() > 0 && !ke -> text()[0].isNull()) + { + QCString s = ke -> text().utf8(); + + sci -> AddCharUTF(s.data(),s.length()); + + consumed = TRUE; + } + } + + if (!consumed) + ke -> ignore(); +} + + +// Re-implemented to make sure tabs are passed to the editor. +bool QextScintillaBase::focusNextPrevChild(bool) +{ + return false; +} + + +// Start a drag and allow this to be re-implemented by an application. +void QextScintillaBase::startDrag() +{ + sci -> StartDragImpl(); +} + + +// Handle the vertical scrollbar. +void QextScintillaBase::handleVSb(int val) +{ + sci -> ScrollTo(val); +} + + +// Handle the horizontal scrollbar. +void QextScintillaBase::handleHSb(int val) +{ + sci -> HorizontalScrollTo(val); +} + + +// Return the current prefered size. +QSize QextScintillaBase::sizeHint() const +{ + int height = sci -> vs.lineHeight * sci -> pdoc -> LinesTotal(); + + if (sci -> horizontalScrollBarVisible) + height += hsb -> sizeHint().height(); + + return QSize(sci -> scrollWidth,height); +} + + +// Handle the selection changing. +void QextScintillaBase::handleSelection() +{ + if (!QApplication::clipboard() -> ownsSelection()) + sci -> UnclaimSelection(); +} diff --git a/qt/qextscintillabase.h b/qt/qextscintillabase.h new file mode 100644 index 0000000..80222e5 --- /dev/null +++ b/qt/qextscintillabase.h @@ -0,0 +1,2413 @@ +// This class defines the "official" low-level API. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLABASE_H +#define QEXTSCINTILLABASE_H + + +#include <qobject.h> +#include <qpoint.h> +#include <qtimer.h> +#include <qwidget.h> + +#include <qextscintillaglobal.h> + + +class ScintillaQt; +class QScrollBar; +class QColor; +class QPainter; +class QPixmap; + + +//! \brief The QextScintillaBase class implements the Scintilla editor widget +//! and its low-level API. +//! +//! Scintilla (http://www.scintilla.org) is a powerful C++ editor class that +//! supports many features including syntax styling, error indicators, code +//! completion and call tips. It is particularly useful as a programmer's +//! editor. +//! +//! QextScintillaBase is a port to Qt of Scintilla. It implements the standard +//! Scintilla API which consists of a number of messages each taking up to +//! two arguments. +//! +//! See QextScintilla for the implementation of a higher level API that is more +//! consistent with the rest of the Qt toolkit. +class QEXTSCINTILLA_EXPORT QextScintillaBase : public QWidget +{ + Q_OBJECT + +public: + //! The low-level Scintilla API is implemented as a set of messages + //! each of which takes up to two parameters (\a wParam and \a lParam) + //! and optionally return a value. This enum defines all the possible + //! messages. + //! + //! \sa SendScintilla() + enum + { + //! + SCI_START = 2000, + + //! + SCI_OPTIONAL_START = 3000, + + //! + SCI_LEXER_START = 4000, + + //! This message appends some text to the end of the document. + //! \a wParam is the length of the text. + //! \a lParam is the text to be appended. + SCI_ADDTEXT = 2001, + + //! + SCI_ADDSTYLEDTEXT = 2002, + + //! + SCI_INSERTTEXT = 2003, + + //! + SCI_CLEARALL = 2004, + + //! + SCI_CLEARDOCUMENTSTYLE = 2005, + + //! + SCI_GETLENGTH = 2006, + + //! + SCI_GETCHARAT = 2007, + + //! This message returns the current position. + //! + //! \sa SCI_SETCURRENTPOS + SCI_GETCURRENTPOS = 2008, + + //! This message returns the anchor. + //! + //! \sa SCI_SETANCHOR + SCI_GETANCHOR = 2009, + + //! + SCI_GETSTYLEAT = 2010, + + //! + SCI_REDO = 2011, + + //! + SCI_SETUNDOCOLLECTION = 2012, + + //! + SCI_SELECTALL = 2013, + + //! This message marks the current state of the text as the + //! the save point. This is usually done when the text is saved + //! or loaded. + //! + //! \sa SCN_SAVEPOINTREACHED(), SCN_SAVEPOINTLEFT() + SCI_SETSAVEPOINT = 2014, + + //! + SCI_GETSTYLEDTEXT = 2015, + + //! + SCI_CANREDO = 2016, + + //! This message returns the line that contains a particular + //! instance of a marker. + //! \a wParam is the handle of the marker. + //! + //! \sa SCI_MARKERADD + SCI_MARKERLINEFROMHANDLE = 2017, + + //! This message removes a particular instance of a marker. + //! \a wParam is the handle of the marker. + //! + //! \sa SCI_MARKERADD + SCI_MARKERDELETEHANDLE = 2018, + + //! + SCI_GETUNDOCOLLECTION = 2019, + + //! + SCI_GETVIEWWS = 2020, + + //! + SCI_SETVIEWWS = 2021, + + //! + SCI_POSITIONFROMPOINT = 2022, + + //! + SCI_POSITIONFROMPOINTCLOSE = 2023, + + //! + SCI_GOTOLINE = 2024, + + //! This message clears the current selection and sets the + //! current position. + //! \a wParam is the new current position. + //! + //! \sa SCI_SETCURRENTPOS + SCI_GOTOPOS = 2025, + + //! This message sets the anchor. + //! \a wParam is the new anchor. + //! + //! \sa SCI_GETANCHOR + SCI_SETANCHOR = 2026, + + //! + SCI_GETCURLINE = 2027, + + //! This message returns the character position of the start of + //! the text that needs to be syntax styled. + //! + //! \sa SCN_STYLENEEDED() + SCI_GETENDSTYLED = 2028, + + //! + SCI_CONVERTEOLS = 2029, + + //! + SCI_GETEOLMODE = 2030, + + //! + SCI_SETEOLMODE = 2031, + + //! + SCI_STARTSTYLING = 2032, + + //! + SCI_SETSTYLING = 2033, + + //! + SCI_GETBUFFEREDDRAW = 2034, + + //! + SCI_SETBUFFEREDDRAW = 2035, + + //! + SCI_SETTABWIDTH = 2036, + + //! + SCI_GETTABWIDTH = 2121, + + //! + SCI_SETCODEPAGE = 2037, + + //! + SCI_SETUSEPALETTE = 2039, + + //! This message sets the symbol used to draw one of 32 + //! markers. Some markers have pre-defined uses, see the + //! SC_MARKNUM_* values. + //! \a wParam is the number of the marker. + //! \a lParam is the marker symbol and is one of the SC_MARK_* + //! values. + //! + //! \sa SCI_MARKERADD, SCI_MARKERDEFINEPIXMAP + SCI_MARKERDEFINE = 2040, + + //! This message sets the foreground colour used to draw a + //! marker. A colour is represented as a 24 bit value. The 8 + //! least significant bits correspond to red, the middle 8 bits + //! correspond to green, and the 8 most significant bits + //! correspond to blue. The default value is 0x000000. + //! \a wParam is the number of the marker. + //! \a lParam is the colour. + //! + //! \sa SCI_MARKERSETBACK + SCI_MARKERSETFORE = 2041, + + //! This message sets the background colour used to draw a + //! marker. A colour is represented as a 24 bit value. The 8 + //! least significant bits correspond to red, the middle 8 bits + //! correspond to green, and the 8 most significant bits + //! correspond to blue. The default value is 0xffffff. + //! \a wParam is the number of the marker. + //! \a lParam is the colour. + //! + //! \sa SCI_MARKERSETFORE + SCI_MARKERSETBACK = 2042, + + //! This message adds a marker to a line. A handle for the + //! marker is returned which can be used to track the marker's + //! position. + //! \a wParam is the line number. + //! \a lParam is the number of the marker. + //! + //! \sa SCI_MARKERDELETE, SCI_MARKERDELETEALL, + //! SCI_MARKERDELETEHANDLE + SCI_MARKERADD = 2043, + + //! This message deletes a marker from a line. + //! \a wParam is the line number. + //! \a lParam is the number of the marker. + //! + //! \sa SCI_MARKERADD, SCI_MARKERDELETEALL + SCI_MARKERDELETE = 2044, + + //! This message deletes all occurences of a marker. + //! \a wParam is the number of the marker. If \a wParam is -1 + //! then all markers are removed. + //! + //! \sa SCI_MARKERADD, SCI_MARKERDELETE + SCI_MARKERDELETEALL = 2045, + + //! This message returns the 32 bit mask of markers at a line. + //! \a wParam is the line number. + SCI_MARKERGET = 2046, + + //! This message looks for the next line to contain at least + //! one marker contained in a 32 bit mask of markers and + //! returns the line number. + //! \a wParam is the line number to start the search from. + //! \a lParam is the mask of markers to search for. + //! + //! \sa SCI_MARKERPREVIOUS + SCI_MARKERNEXT = 2047, + + //! This message looks for the previous line to contain at + //! least one marker contained in a 32 bit mask of markers and + //! returns the line number. + //! \a wParam is the line number to start the search from. + //! \a lParam is the mask of markers to search for. + //! + //! \sa SCI_MARKERNEXT + SCI_MARKERPREVIOUS = 2048, + + //! This message sets the symbol used to draw one of the 32 + //! markers to a pixmap. Pixmaps use the SC_MARK_PIXMAP marker + //! symbol. + //! \a wParam is the number of the marker. + //! \a lParam is a pointer to a QPixmap instance. Note that in + //! other ports of Scintilla this is a pointer to either raw or + //! textual XPM image data. + //! + //! \sa SCI_MARKERDEFINE + SCI_MARKERDEFINEPIXMAP = 2049, + + //! This message sets what can be displayed in a margin. + //! \a wParam is the number of the margin: 0, 1 or 2. + //! \a lParam is the logical or of the SC_MARGIN_* values. + //! + //! \sa SCI_GETMARGINTYPEN + SCI_SETMARGINTYPEN = 2240, + + //! This message returns what can be displayed in a margin. + //! \a wParam is the number of the margin: 0, 1 or 2. + //! + //! \sa SCI_SETMARGINTYPEN + SCI_GETMARGINTYPEN = 2241, + + //! This message sets the width of a margin in pixels. + //! \a wParam is the number of the margin: 0, 1 or 2. + //! \a lParam is the new margin width. + //! + //! \sa SCI_GETMARGINWIDTHN + SCI_SETMARGINWIDTHN = 2242, + + //! This message returns the width of a margin in pixels. + //! \a wParam is the number of the margin: 0, 1 or 2. + //! + //! \sa SCI_SETMARGINWIDTHN + SCI_GETMARGINWIDTHN = 2243, + + //! This message sets the mask of a margin. The mask is a 32 + //! value with one bit for each possible marker. If a bit is + //! set then the corresponding marker is displayed. By + //! default, all markers are displayed. + //! \a wParam is the number of the margin: 0, 1 or 2. + //! \a lParam is the new margin mask. + //! + //! \sa SCI_GETMARGINMASKN, SCI_MARKERDEFINE + SCI_SETMARGINMASKN = 2244, + + //! This message returns the mask of a margin. + //! \a wParam is the number of the margin: 0, 1 or 2. + //! + //! \sa SCI_SETMARGINMASKN + SCI_GETMARGINMASKN = 2245, + + //! This message sets the sensitivity of a margin to mouse + //! clicks. + //! \a wParam is the number of the margin: 0, 1 or 2. + //! \a lParam is non-zero to make the margin sensitive to mouse + //! clicks. When the mouse is clicked the SCN_MARGINCLICK() + //! signal is emitted. + //! + //! \sa SCI_GETMARGINSENSITIVEN, SCN_MARGINCLICK() + SCI_SETMARGINSENSITIVEN = 2246, + + //! This message returns the sensitivity of a margin to mouse + //! clicks. + //! \a wParam is the number of the margin: 0, 1 or 2. + //! + //! \sa SCI_SETMARGINSENSITIVEN, SCN_MARGINCLICK() + SCI_GETMARGINSENSITIVEN = 2247, + + //! + SCI_STYLECLEARALL = 2050, + + //! + SCI_STYLESETFORE = 2051, + + //! + SCI_STYLESETBACK = 2052, + + //! + SCI_STYLESETBOLD = 2053, + + //! + SCI_STYLESETITALIC = 2054, + + //! + SCI_STYLESETSIZE = 2055, + + //! + SCI_STYLESETFONT = 2056, + + //! + SCI_STYLESETEOLFILLED = 2057, + + //! + SCI_STYLERESETDEFAULT = 2058, + + //! + SCI_STYLESETUNDERLINE = 2059, + + //! + SCI_STYLESETCASE = 2060, + + //! + SCI_STYLESETCHARACTERSET = 2066, + + //! + SCI_SETSELFORE = 2067, + + //! + SCI_SETSELBACK = 2068, + + //! + SCI_SETCARETFORE = 2069, + + //! + SCI_ASSIGNCMDKEY = 2070, + + //! + SCI_CLEARCMDKEY = 2071, + + //! + SCI_CLEARALLCMDKEYS = 2072, + + //! + SCI_SETSTYLINGEX = 2073, + + //! + SCI_STYLESETVISIBLE = 2074, + + //! + SCI_GETCARETPERIOD = 2075, + + //! + SCI_SETCARETPERIOD = 2076, + + //! + SCI_SETWORDCHARS = 2077, + + //! + SCI_BEGINUNDOACTION = 2078, + + //! + SCI_ENDUNDOACTION = 2079, + + //! + SCI_INDICSETSTYLE = 2080, + + //! + SCI_INDICGETSTYLE = 2081, + + //! + SCI_INDICSETFORE = 2082, + + //! + SCI_INDICGETFORE = 2083, + + //! + SCI_SETWHITESPACEFORE = 2084, + + //! + SCI_SETWHITESPACEBACK = 2085, + + //! + SCI_SETSTYLEBITS = 2090, + + //! + SCI_GETSTYLEBITS = 2091, + + //! + SCI_SETLINESTATE = 2092, + + //! + SCI_GETLINESTATE = 2093, + + //! + SCI_GETMAXLINESTATE = 2094, + + //! + SCI_GETCARETLINEVISIBLE = 2095, + + //! + SCI_SETCARETLINEVISIBLE = 2096, + + //! + SCI_GETCARETLINEBACK = 2097, + + //! + SCI_SETCARETLINEBACK = 2098, + + //! + SCI_STYLESETCHANGEABLE = 2099, + + //! + SCI_AUTOCSHOW = 2100, + + //! + SCI_AUTOCCANCEL = 2101, + + //! + SCI_AUTOCACTIVE = 2102, + + //! + SCI_AUTOCPOSSTART = 2103, + + //! + SCI_AUTOCCOMPLETE = 2104, + + //! + SCI_AUTOCSTOPS = 2105, + + //! + SCI_AUTOCSETSEPARATOR = 2106, + + //! + SCI_AUTOCGETSEPARATOR = 2107, + + //! + SCI_AUTOCSELECT = 2108, + + //! + SCI_AUTOCSETCANCELATSTART = 2110, + + //! + SCI_AUTOCGETCANCELATSTART = 2111, + + //! + SCI_AUTOCSETFILLUPS = 2112, + + //! + SCI_AUTOCSETCHOOSESINGLE = 2113, + + //! + SCI_AUTOCGETCHOOSESINGLE = 2114, + + //! + SCI_AUTOCSETIGNORECASE = 2115, + + //! + SCI_AUTOCGETIGNORECASE = 2116, + + //! + SCI_USERLISTSHOW = 2117, + + //! + SCI_AUTOCSETAUTOHIDE = 2118, + + //! + SCI_AUTOCGETAUTOHIDE = 2119, + + //! + SCI_AUTOCSETDROPRESTOFWORD = 2270, + + //! + SCI_AUTOCGETDROPRESTOFWORD = 2271, + + //! + SCI_SETINDENT = 2122, + + //! + SCI_GETINDENT = 2123, + + //! + SCI_SETUSETABS = 2124, + + //! + SCI_GETUSETABS = 2125, + + //! + SCI_SETLINEINDENTATION = 2126, + + //! + SCI_GETLINEINDENTATION = 2127, + + //! + SCI_GETLINEINDENTPOSITION = 2128, + + //! + SCI_GETCOLUMN = 2129, + + //! + SCI_SETHSCROLLBAR = 2130, + + //! + SCI_GETHSCROLLBAR = 2131, + + //! + SCI_SETINDENTATIONGUIDES = 2132, + + //! + SCI_GETINDENTATIONGUIDES = 2133, + + //! + SCI_SETHIGHLIGHTGUIDE = 2134, + + //! + SCI_GETHIGHLIGHTGUIDE = 2135, + + //! + SCI_GETLINEENDPOSITION = 2136, + + //! + SCI_GETCODEPAGE = 2137, + + //! + SCI_GETCARETFORE = 2138, + + //! + SCI_GETUSEPALETTE = 2139, + + //! This message returns a non-zero value if the document is + //! read-only. + //! + //! \sa SCI_SETREADONLY + SCI_GETREADONLY = 2140, + + //! This message sets the current position. + //! \a wParam is the new current position. + //! + //! \sa SCI_GETCURRENTPOS + SCI_SETCURRENTPOS = 2141, + + //! + SCI_SETSELECTIONSTART = 2142, + + //! + SCI_GETSELECTIONSTART = 2143, + + //! + SCI_SETSELECTIONEND = 2144, + + //! + SCI_GETSELECTIONEND = 2145, + + //! + SCI_SETPRINTMAGNIFICATION = 2146, + + //! + SCI_GETPRINTMAGNIFICATION = 2147, + + //! + SCI_SETPRINTCOLOURMODE = 2148, + + //! + SCI_GETPRINTCOLOURMODE = 2149, + + //! + SCI_FINDTEXT = 2150, + + //! + SCI_FORMATRANGE = 2151, + + //! + SCI_GETFIRSTVISIBLELINE = 2152, + + //! + SCI_GETLINE = 2153, + + //! + SCI_GETLINECOUNT = 2154, + + //! + SCI_SETMARGINLEFT = 2155, + + //! + SCI_GETMARGINLEFT = 2156, + + //! + SCI_SETMARGINRIGHT = 2157, + + //! + SCI_GETMARGINRIGHT = 2158, + + //! This message returns a non-zero value if the document has + //! been modified. + SCI_GETMODIFY = 2159, + + //! + SCI_SETSEL = 2160, + + //! + SCI_GETSELTEXT = 2161, + + //! + SCI_GETTEXTRANGE = 2162, + + //! + SCI_HIDESELECTION = 2163, + + //! + SCI_POINTXFROMPOSITION = 2164, + + //! + SCI_POINTYFROMPOSITION = 2165, + + //! + SCI_LINEFROMPOSITION = 2166, + + //! + SCI_POSITIONFROMLINE = 2167, + + //! + SCI_LINESCROLL = 2168, + + //! + SCI_SCROLLCARET = 2169, + + //! + SCI_REPLACESEL = 2170, + + //! This message sets the read-only state of the document. + //! \a wParam is the new read-only state of the document. + //! + //! \sa SCI_GETREADONLY + SCI_SETREADONLY = 2171, + + //! + SCI_NULL = 2172, + + //! + SCI_CANPASTE = 2173, + + //! + SCI_CANUNDO = 2174, + + //! This message empties the undo buffer. + SCI_EMPTYUNDOBUFFER = 2175, + + //! + SCI_UNDO = 2176, + + //! + SCI_CUT = 2177, + + //! + SCI_COPY = 2178, + + //! + SCI_PASTE = 2179, + + //! + SCI_CLEAR = 2180, + + //! This message sets the text of the document. + //! \a wParam is unused. + //! \a lParam is the new text of the document. + //! + //! \sa SCI_GETTEXT + SCI_SETTEXT = 2181, + + //! This message gets the text of the document. + //! \a wParam is size of the buffer that the text is copied to. + //! \a lParam is the address of the buffer that the text is + //! copied to. + //! + //! \sa SCI_SETTEXT + SCI_GETTEXT = 2182, + + //! This message returns the length of the document. + SCI_GETTEXTLENGTH = 2183, + + //! + SCI_GETDIRECTFUNCTION = 2184, + + //! + SCI_GETDIRECTPOINTER = 2185, + + //! + SCI_SETOVERTYPE = 2186, + + //! + SCI_GETOVERTYPE = 2187, + + //! + SCI_SETCARETWIDTH = 2188, + + //! + SCI_GETCARETWIDTH = 2189, + + //! + SCI_SETTARGETSTART = 2190, + + //! + SCI_GETTARGETSTART = 2191, + + //! + SCI_SETTARGETEND = 2192, + + //! + SCI_GETTARGETEND = 2193, + + //! + SCI_REPLACETARGET = 2194, + + //! + SCI_REPLACETARGETRE = 2195, + + //! + SCI_SEARCHINTARGET = 2197, + + //! + SCI_SETSEARCHFLAGS = 2198, + + //! + SCI_GETSEARCHFLAGS = 2199, + + //! + SCI_CALLTIPSHOW = 2200, + + //! + SCI_CALLTIPCANCEL = 2201, + + //! + SCI_CALLTIPACTIVE = 2202, + + //! + SCI_CALLTIPPOSSTART = 2203, + + //! + SCI_CALLTIPSETHLT = 2204, + + //! + SCI_CALLTIPSETBACK = 2205, + + //! + SCI_CALLTIPSETFORE = 2206, + + //! + SCI_CALLTIPSETFOREHLT = 2207, + + //! + SCI_AUTOCSETMAXWIDTH = 2208, + + //! + SCI_AUTOCGETMAXWIDTH = 2209, + + //! + SCI_AUTOCSETMAXHEIGHT = 2210, + + //! + SCI_AUTOCGETMAXHEIGHT = 2211, + + //! + SCI_CALLTIPUSESTYLE = 2212, + + //! + SCI_VISIBLEFROMDOCLINE = 2220, + + //! + SCI_DOCLINEFROMVISIBLE = 2221, + + //! + SCI_SETFOLDLEVEL = 2222, + + //! + SCI_GETFOLDLEVEL = 2223, + + //! + SCI_GETLASTCHILD = 2224, + + //! + SCI_GETFOLDPARENT = 2225, + + //! + SCI_SHOWLINES = 2226, + + //! + SCI_HIDELINES = 2227, + + //! + SCI_GETLINEVISIBLE = 2228, + + //! + SCI_SETFOLDEXPANDED = 2229, + + //! + SCI_GETFOLDEXPANDED = 2230, + + //! + SCI_TOGGLEFOLD = 2231, + + //! + SCI_ENSUREVISIBLE = 2232, + + //! + SCI_SETFOLDFLAGS = 2233, + + //! + SCI_ENSUREVISIBLEENFORCEPOLICY = 2234, + + //! + SCI_WRAPCOUNT = 2235, + + //! + SCI_SETTABINDENTS = 2260, + + //! + SCI_GETTABINDENTS = 2261, + + //! + SCI_SETBACKSPACEUNINDENTS = 2262, + + //! + SCI_GETBACKSPACEUNINDENTS = 2263, + + //! + SCI_SETMOUSEDWELLTIME = 2264, + + //! + SCI_GETMOUSEDWELLTIME = 2265, + + //! + SCI_WORDSTARTPOSITION = 2266, + + //! + SCI_WORDENDPOSITION = 2267, + + //! + SCI_SETWRAPMODE = 2268, + + //! + SCI_GETWRAPMODE = 2269, + + //! + SCI_SETLAYOUTCACHE = 2272, + + //! + SCI_GETLAYOUTCACHE = 2273, + + //! + SCI_SETSCROLLWIDTH = 2274, + + //! + SCI_GETSCROLLWIDTH = 2275, + + //! This message returns the width of some text when rendered + //! in a particular style. + //! \a wParam is the style number and is one of the STYLE_* + //! values or one of the styles defined by a lexer. + //! \a lParam is a pointer to the text. + SCI_TEXTWIDTH = 2276, + + //! + SCI_SETENDATLASTLINE = 2277, + + //! + SCI_GETENDATLASTLINE = 2278, + + //! + SCI_TEXTHEIGHT = 2279, + + //! + SCI_SETVSCROLLBAR = 2280, + + //! + SCI_GETVSCROLLBAR = 2281, + + //! + SCI_APPENDTEXT = 2282, + + //! + SCI_GETTWOPHASEDRAW = 2283, + + //! + SCI_SETTWOPHASEDRAW = 2284, + + //! + SCI_AUTOCGETTYPESEPARATOR = 2285, + + //! + SCI_AUTOCSETTYPESEPARATOR = 2286, + + //! + SCI_TARGETFROMSELECTION = 2287, + + //! + SCI_LINESJOIN = 2288, + + //! + SCI_LINESSPLIT = 2289, + + //! + SCI_SETFOLDMARGINCOLOUR = 2290, + + //! + SCI_SETFOLDMARGINHICOLOUR = 2291, + + //! + SCI_LINEDOWN = 2300, + + //! + SCI_LINEDOWNEXTEND = 2301, + + //! + SCI_LINEUP = 2302, + + //! + SCI_LINEUPEXTEND = 2303, + + //! + SCI_CHARLEFT = 2304, + + //! + SCI_CHARLEFTEXTEND = 2305, + + //! + SCI_CHARRIGHT = 2306, + + //! + SCI_CHARRIGHTEXTEND = 2307, + + //! + SCI_WORDLEFT = 2308, + + //! + SCI_WORDLEFTEXTEND = 2309, + + //! + SCI_WORDRIGHT = 2310, + + //! + SCI_WORDRIGHTEXTEND = 2311, + + //! + SCI_HOME = 2312, + + //! + SCI_HOMEEXTEND = 2313, + + //! + SCI_LINEEND = 2314, + + //! + SCI_LINEENDEXTEND = 2315, + + //! + SCI_DOCUMENTSTART = 2316, + + //! + SCI_DOCUMENTSTARTEXTEND = 2317, + + //! + SCI_DOCUMENTEND = 2318, + + //! + SCI_DOCUMENTENDEXTEND = 2319, + + //! + SCI_PAGEUP = 2320, + + //! + SCI_PAGEUPEXTEND = 2321, + + //! + SCI_PAGEDOWN = 2322, + + //! + SCI_PAGEDOWNEXTEND = 2323, + + //! + SCI_EDITTOGGLEOVERTYPE = 2324, + + //! + SCI_CANCEL = 2325, + + //! + SCI_DELETEBACK = 2326, + + //! + SCI_TAB = 2327, + + //! + SCI_BACKTAB = 2328, + + //! + SCI_NEWLINE = 2329, + + //! + SCI_FORMFEED = 2330, + + //! + SCI_VCHOME = 2331, + + //! + SCI_VCHOMEEXTEND = 2332, + + //! + SCI_ZOOMIN = 2333, + + //! + SCI_ZOOMOUT = 2334, + + //! + SCI_DELWORDLEFT = 2335, + + //! + SCI_DELWORDRIGHT = 2336, + + //! + SCI_LINECUT = 2337, + + //! + SCI_LINEDELETE = 2338, + + //! + SCI_LINETRANSPOSE = 2339, + + //! + SCI_LOWERCASE = 2340, + + //! + SCI_UPPERCASE = 2341, + + //! + SCI_LINESCROLLDOWN = 2342, + + //! + SCI_LINESCROLLUP = 2343, + + //! + SCI_DELETEBACKNOTLINE = 2344, + + //! + SCI_HOMEDISPLAY = 2345, + + //! + SCI_HOMEDISPLAYEXTEND = 2346, + + //! + SCI_LINEENDDISPLAY = 2347, + + //! + SCI_LINEENDDISPLAYEXTEND = 2348, + + //! + SCI_MOVECARETINSIDEVIEW = 2401, + + //! + SCI_LINELENGTH = 2350, + + //! + SCI_BRACEHIGHLIGHT = 2351, + + //! + SCI_BRACEBADLIGHT = 2352, + + //! + SCI_BRACEMATCH = 2353, + + //! + SCI_GETVIEWEOL = 2355, + + //! + SCI_SETVIEWEOL = 2356, + + //! + SCI_GETDOCPOINTER = 2357, + + //! + SCI_SETDOCPOINTER = 2358, + + //! + SCI_SETMODEVENTMASK = 2359, + + //! + SCI_GETEDGECOLUMN = 2360, + + //! + SCI_SETEDGECOLUMN = 2361, + + //! + SCI_GETEDGEMODE = 2362, + + //! + SCI_SETEDGEMODE = 2363, + + //! + SCI_GETEDGECOLOUR = 2364, + + //! + SCI_SETEDGECOLOUR = 2365, + + //! + SCI_SEARCHANCHOR = 2366, + + //! + SCI_SEARCHNEXT = 2367, + + //! + SCI_SEARCHPREV = 2368, + + //! + SCI_LINESONSCREEN = 2370, + + //! + SCI_USEPOPUP = 2371, + + //! + SCI_SELECTIONISRECTANGLE = 2372, + + //! + SCI_SETZOOM = 2373, + + //! + SCI_GETZOOM = 2374, + + //! + SCI_CREATEDOCUMENT = 2375, + + //! + SCI_ADDREFDOCUMENT = 2376, + + //! + SCI_RELEASEDOCUMENT = 2377, + + //! + SCI_GETMODEVENTMASK = 2378, + + //! + SCI_SETFOCUS = 2380, + + //! + SCI_GETFOCUS = 2381, + + //! + SCI_SETSTATUS = 2382, + + //! + SCI_GETSTATUS = 2383, + + //! + SCI_SETMOUSEDOWNCAPTURES = 2384, + + //! + SCI_GETMOUSEDOWNCAPTURES = 2385, + + //! + SCI_SETCURSOR = 2386, + + //! + SCI_GETCURSOR = 2387, + + //! + SCI_SETCONTROLCHARSYMBOL = 2388, + + //! + SCI_GETCONTROLCHARSYMBOL = 2389, + + //! + SCI_WORDPARTLEFT = 2390, + + //! + SCI_WORDPARTLEFTEXTEND = 2391, + + //! + SCI_WORDPARTRIGHT = 2392, + + //! + SCI_WORDPARTRIGHTEXTEND = 2393, + + //! + SCI_SETVISIBLEPOLICY = 2394, + + //! + SCI_DELLINELEFT = 2395, + + //! + SCI_DELLINERIGHT = 2396, + + //! + SCI_SETXOFFSET = 2397, + + //! + SCI_GETXOFFSET = 2398, + + //! + SCI_CHOOSECARETX = 2399, + + //! + SCI_GRABFOCUS = 2400, + + //! + SCI_SETXCARETPOLICY = 2402, + + //! + SCI_SETYCARETPOLICY = 2403, + + //! + SCI_LINEDUPLICATE = 2404, + + //! This message takes a copy of an image and registers it so + //! that it can be refered to by a unique integer identifier. + //! \a wParam is the image's identifier. + //! \a lParam is a pointer to a QPixmap instance. Note that in + //! other ports of Scintilla this is a pointer to either raw or + //! textual XPM image data. + //! + //! \sa SCI_CLEARREGISTEREDIMAGES + SCI_REGISTERIMAGE = 2405, + + //! + SCI_SETPRINTWRAPMODE = 2406, + + //! + SCI_GETPRINTWRAPMODE = 2407, + + //! This message de-registers all currently registered images. + //! + //! \sa SCI_REGISTERIMAGE + SCI_CLEARREGISTEREDIMAGES = 2408, + + //! + SCI_STYLESETHOTSPOT = 2409, + + //! + SCI_SETHOTSPOTACTIVEFORE = 2410, + + //! + SCI_SETHOTSPOTACTIVEBACK = 2411, + + //! + SCI_SETHOTSPOTACTIVEUNDERLINE = 2412, + + //! + SCI_PARADOWN = 2413, + + //! + SCI_PARADOWNEXTEND = 2414, + + //! + SCI_PARAUP = 2415, + + //! + SCI_PARAUPEXTEND = 2416, + + //! + SCI_POSITIONBEFORE = 2417, + + //! + SCI_POSITIONAFTER = 2418, + + //! + SCI_COPYRANGE = 2419, + + //! + SCI_COPYTEXT = 2420, + + //! + SCI_SETSELECTIONMODE = 2422, + + //! + SCI_GETSELECTIONMODE = 2423, + + //! + SCI_GETLINESELSTARTPOSITION = 2424, + + //! + SCI_GETLINESELENDPOSITION = 2425, + + //! + SCI_LINEDOWNRECTEXTEND = 2426, + + //! + SCI_LINEUPRECTEXTEND = 2427, + + //! + SCI_CHARLEFTRECTEXTEND = 2428, + + //! + SCI_CHARRIGHTRECTEXTEND = 2429, + + //! + SCI_HOMERECTEXTEND = 2430, + + //! + SCI_VCHOMERECTEXTEND = 2431, + + //! + SCI_LINEENDRECTEXTEND = 2432, + + //! + SCI_PAGEUPRECTEXTEND = 2433, + + //! + SCI_PAGEDOWNRECTEXTEND = 2434, + + //! + SCI_STUTTEREDPAGEUP = 2435, + + //! + SCI_STUTTEREDPAGEUPEXTEND = 2436, + + //! + SCI_STUTTEREDPAGEDOWN = 2437, + + //! + SCI_STUTTEREDPAGEDOWNEXTEND = 2438, + + //! + SCI_WORDLEFTEND = 2439, + + //! + SCI_WORDLEFTENDEXTEND = 2440, + + //! + SCI_WORDRIGHTEND = 2441, + + //! + SCI_WORDRIGHTENDEXTEND = 2442, + + //! + SCI_SETWHITESPACECHARS = 2443, + + //! + SCI_SETCHARSDEFAULT = 2444, + + //! + SCI_AUTOCGETCURRENT = 2445, + + //! + SCI_ALLOCATE = 2446, + + //! + SCI_HOMEWRAP = 2349, + + //! + SCI_HOMEWRAPEXTEND = 2450, + + //! + SCI_LINEENDWRAP = 2451, + + //! + SCI_LINEENDWRAPEXTEND = 2452, + + //! + SCI_VCHOMEWRAP = 2453, + + //! + SCI_VCHOMEWRAPEXTEND = 2454, + + //! + SCI_LINECOPY = 2455, + + //! + SCI_FINDCOLUMN = 2456, + + //! + SCI_GETCARETSTICKY = 2457, + + //! + SCI_SETCARETSTICKY = 2458, + + //! + SCI_TOGGLECARETSTICKY = 2459, + + //! + SCI_SETWRAPVISUALFLAGS = 2460, + + //! + SCI_GETWRAPVISUALFLAGS = 2461, + + //! + SCI_SETWRAPVISUALFLAGSLOCATION = 2462, + + //! + SCI_GETWRAPVISUALFLAGSLOCATION = 2463, + + //! + SCI_SETWRAPSTARTINDENT = 2464, + + //! + SCI_GETWRAPSTARTINDENT = 2465, + + //! + SCI_MARKERADDSET = 2466, + + //! + SCI_SETPASTECONVERTENDINGS = 2467, + + //! + SCI_GETPASTECONVERTENDINGS = 2468, + + //! + SCI_SELECTIONDUPLICATE = 2469, + + //! + SCI_SETCARETLINEBACKALPHA = 2470, + + //! + SCI_GETCARETLINEBACKALPHA = 2471, + + //! + SCI_MARKERSETALPHA = 2476, + + //! + SCI_GETSELALPHA = 2477, + + //! + SCI_SETSELALPHA = 2478, + + //! + SCI_STARTRECORD = 3001, + + //! + SCI_STOPRECORD = 3002, + + //! This message sets the number of the lexer to use for syntax + //! styling. + //! \a wParam is the number of the lexer and is one of the + //! SCLEX_* values. + SCI_SETLEXER = 4001, + + //! This message returns the number of the lexer being used for + //! syntax styling. + SCI_GETLEXER = 4002, + + //! + SCI_COLOURISE = 4003, + + //! + SCI_SETPROPERTY = 4004, + + //! + SCI_SETKEYWORDS = 4005, + + //! This message sets the name of the lexer to use for syntax + //! styling. + //! \a wParam is unused. + //! \a lParam is the name of the lexer. + SCI_SETLEXERLANGUAGE = 4006, + + //! + SCI_LOADLEXERLIBRARY = 4007, + + //! + SCI_GETPROPERTY = 4008, + + //! + SCI_GETPROPERTYEXPANDED = 4009, + + //! + SCI_GETPROPERTYINT = 4010, + + //! + SCI_GETSTYLEBITSNEEDED = 4011 + }; + + enum + { + SC_ALPHA_TRANSPARENT = 0, + SC_ALPHA_OPAQUE = 255, + SC_ALPHA_NOALPHA = 256 + }; + + enum + { + SC_WRAPVISUALFLAG_NONE = 0x0000, + SC_WRAPVISUALFLAG_END = 0x0001, + SC_WRAPVISUALFLAG_START = 0x0002 + }; + + enum + { + SC_WRAPVISUALFLAGLOC_DEFAULT = 0x0000, + SC_WRAPVISUALFLAGLOC_END_BY_TEXT = 0x0001, + SC_WRAPVISUALFLAGLOC_START_BY_TEXT = 0x0002 + }; + + //! This enum defines the different selection modes. + //! + //! \sa SCI_GETSELECTIONMODE, SCI_SETSELECTIONMODE + enum + { + SC_SEL_STREAM = 0, + SC_SEL_RECTANGLE = 1, + SC_SEL_LINES = 2 + }; + + enum + { + SCWS_INVISIBLE = 0, + SCWS_VISIBLEALWAYS = 1, + SCWS_VISIBLEAFTERINDENT = 2 + }; + + enum + { + SC_EOL_CRLF = 0, + SC_EOL_CR = 1, + SC_EOL_LF = 2 + }; + + enum + { + SC_CP_DBCS = 1, + SC_CP_UTF8 = 65001 + }; + + //! This enum defines the different marker symbols. + //! + //! \sa SCI_MARKERDEFINE + enum + { + //! A circle. + SC_MARK_CIRCLE = 0, + + //! A rectangle. + SC_MARK_ROUNDRECT = 1, + + //! A triangle pointing to the right. + SC_MARK_ARROW = 2, + + //! A smaller rectangle. + SC_MARK_SMALLRECT = 3, + + //! An arrow pointing to the right. + SC_MARK_SHORTARROW = 4, + + //! An invisible marker that allows code to track the movement + //! of lines. + SC_MARK_EMPTY = 5, + + //! A triangle pointing down. + SC_MARK_ARROWDOWN = 6, + + //! A drawn minus sign. + SC_MARK_MINUS = 7, + + //! A drawn plus sign. + SC_MARK_PLUS = 8, + + //! A vertical line drawn in the background colour. + SC_MARK_VLINE = 9, + + //! A bottom left corner drawn in the background colour. + SC_MARK_LCORNER = 10, + + //! A vertical line with a centre right horizontal line drawn + //! in the background colour. + SC_MARK_TCORNER = 11, + + //! A drawn plus sign in a box. + SC_MARK_BOXPLUS = 12, + + //! A drawn plus sign in a connected box. + SC_MARK_BOXPLUSCONNECTED = 13, + + //! A drawn minus sign in a box. + SC_MARK_BOXMINUS = 14, + + //! A drawn minus sign in a connected box. + SC_MARK_BOXMINUSCONNECTED = 15, + + //! A rounded bottom left corner drawn in the background + //! colour. + SC_MARK_LCORNERCURVE = 16, + + //! A vertical line with a centre right curved line drawn in + //! the background colour. + SC_MARK_TCORNERCURVE = 17, + + //! A drawn plus sign in a circle. + SC_MARK_CIRCLEPLUS = 18, + + //! A drawn plus sign in a connected box. + SC_MARK_CIRCLEPLUSCONNECTED = 19, + + //! A drawn minus sign in a circle. + SC_MARK_CIRCLEMINUS = 20, + + //! A drawn minus sign in a connected circle. + SC_MARK_CIRCLEMINUSCONNECTED = 21, + + //! No symbol is drawn but the line of text is drawn with the + //! same background colour. + SC_MARK_BACKGROUND = 22, + + //! Three drawn dots. + SC_MARK_DOTDOTDOT = 23, + + //! Three drawn arrows pointing right. + SC_MARK_ARROWS = 24, + + //! An XPM format pixmap. + SC_MARK_PIXMAP = 25, + + //! A full rectangle. + SC_MARK_FULLRECT = 26, + + //! Characters can be used as symbols by adding this to the + //! ASCII value of the character. + SC_MARK_CHARACTER = 10000 + }; + + enum + { + SC_MARKNUM_FOLDEREND = 25, + SC_MARKNUM_FOLDEROPENMID = 26, + SC_MARKNUM_FOLDERMIDTAIL = 27, + SC_MARKNUM_FOLDERTAIL = 28, + SC_MARKNUM_FOLDERSUB = 29, + SC_MARKNUM_FOLDER = 30, + SC_MARKNUM_FOLDEROPEN = 31, + SC_MASK_FOLDERS = 0xfe000000 + }; + + //! This enum defines what can be displayed in a margin. + //! + //! \sa SCI_GETMARGINTYPEN, SCI_SETMARGINTYPEN + enum + { + //! The margin can display symbols. Note that all margins can + //! display symbols. + SC_MARGIN_SYMBOL = 0, + + //! The margin will display line numbers. + SC_MARGIN_NUMBER = 1, + + //! The margin's background color will be set to the default + //! background color. + SC_MARGIN_BACK = 2, + + //! The margin's background color will be set to the default + //! foreground color. + SC_MARGIN_FORE = 3 + }; + + enum + { + STYLE_DEFAULT = 32, + STYLE_LINENUMBER = 33, + STYLE_BRACELIGHT = 34, + STYLE_BRACEBAD = 35, + STYLE_CONTROLCHAR = 36, + STYLE_INDENTGUIDE = 37, + STYLE_CALLTIP = 38, + STYLE_LASTPREDEFINED = 39, + STYLE_MAX = 127 + }; + + enum + { + SC_CHARSET_ANSI = 0, + SC_CHARSET_DEFAULT = 1, + SC_CHARSET_BALTIC = 186, + SC_CHARSET_CHINESEBIG5 = 136, + SC_CHARSET_EASTEUROPE = 238, + SC_CHARSET_GB2312 = 134, + SC_CHARSET_GREEK = 161, + SC_CHARSET_HANGUL = 129, + SC_CHARSET_MAC = 77, + SC_CHARSET_OEM = 255, + SC_CHARSET_RUSSIAN = 204, + SC_CHARSET_SHIFTJIS = 128, + SC_CHARSET_SYMBOL = 2, + SC_CHARSET_TURKISH = 162, + SC_CHARSET_JOHAB = 130, + SC_CHARSET_HEBREW = 177, + SC_CHARSET_ARABIC = 178, + SC_CHARSET_VIETNAMESE = 163, + SC_CHARSET_THAI = 222, + SC_CHARSET_8859_15 = 1000 + }; + + enum + { + SC_CASE_MIXED = 0, + SC_CASE_UPPER = 1, + SC_CASE_LOWER = 2 + }; + + enum + { + INDIC_MAX = 7, + INDIC_PLAIN = 0, + INDIC_SQUIGGLE = 1, + INDIC_TT = 2, + INDIC_DIAGONAL = 3, + INDIC_STRIKE = 4, + INDIC_HIDDEN = 5, + INDIC_BOX = 6, + INDIC_ROUNDBOX = 7, + INDIC0_MASK = 0x20, + INDIC1_MASK = 0x40, + INDIC2_MASK = 0x80, + INDICS_MASK = 0xe0 + }; + + enum + { + SC_PRINT_NORMAL = 0, + SC_PRINT_INVERTLIGHT = 1, + SC_PRINT_BLACKONWHITE = 2, + SC_PRINT_COLOURONWHITE = 3, + SC_PRINT_COLOURONWHITEDEFAULTBG = 4 + }; + + enum + { + SCFIND_WHOLEWORD = 2, + SCFIND_MATCHCASE = 4, + SCFIND_WORDSTART = 0x00100000, + SCFIND_REGEXP = 0x00200000, + SCFIND_POSIX = 0x00400000 + }; + + enum + { + SC_FOLDLEVELBASE = 0x00400, + SC_FOLDLEVELWHITEFLAG = 0x01000, + SC_FOLDLEVELHEADERFLAG = 0x02000, + SC_FOLDLEVELBOXHEADERFLAG = 0x04000, + SC_FOLDLEVELBOXFOOTERFLAG = 0x08000, + SC_FOLDLEVELCONTRACTED = 0x10000, + SC_FOLDLEVELUNINDENT = 0x20000, + SC_FOLDLEVELNUMBERMASK = 0x00fff + }; + + enum + { + SC_FOLDFLAG_BOX = 0x0001, + SC_FOLDFLAG_LINEBEFORE_EXPANDED = 0x0002, + SC_FOLDFLAG_LINEBEFORE_CONTRACTED = 0x0004, + SC_FOLDFLAG_LINEAFTER_EXPANDED = 0x0008, + SC_FOLDFLAG_LINEAFTER_CONTRACTED = 0x0010, + SC_FOLDFLAG_LEVELNUMBERS = 0x0040 + }; + + enum + { + SC_TIME_FOREVER = 10000000 + }; + + enum + { + SC_WRAP_NONE = 0, + SC_WRAP_WORD = 1, + SC_WRAP_CHAR = 2 + }; + + enum + { + SC_CACHE_NONE = 0, + SC_CACHE_CARET = 1, + SC_CACHE_PAGE = 2, + SC_CACHE_DOCUMENT = 3 + }; + + enum + { + EDGE_NONE = 0, + EDGE_LINE = 1, + EDGE_BACKGROUND = 2 + }; + + enum + { + SC_CURSORNORMAL = -1, + SC_CURSORWAIT = 4 + }; + + enum + { + VISIBLE_SLOP = 0x01, + VISIBLE_STRICT = 0x04 + }; + + enum + { + CARET_SLOP = 0x01, + CARET_STRICT = 0x04, + CARET_JUMPS = 0x10, + CARET_EVEN = 0x08 + }; + + enum + { + SC_MOD_INSERTTEXT = 0x1, + SC_MOD_DELETETEXT = 0x2, + SC_MOD_CHANGESTYLE = 0x4, + SC_MOD_CHANGEFOLD = 0x8, + SC_PERFORMED_USER = 0x10, + SC_PERFORMED_UNDO = 0x20, + SC_PERFORMED_REDO = 0x40, + SC_MULTISTEPUNDOREDO = 0x80, + SC_LASTSTEPINUNDOREDO = 0x100, + SC_MOD_CHANGEMARKER = 0x200, + SC_MOD_BEFOREINSERT = 0x400, + SC_MOD_BEFOREDELETE = 0x800, + SC_MULTILINEUNDOREDO = 0x1000, + SC_MODEVENTMASKALL = 0x1fff + }; + + enum + { + SCK_DOWN = 300, + SCK_UP = 301, + SCK_LEFT = 302, + SCK_RIGHT = 303, + SCK_HOME = 304, + SCK_END = 305, + SCK_PRIOR = 306, + SCK_NEXT = 307, + SCK_DELETE = 308, + SCK_INSERT = 309, + SCK_ESCAPE = 7, + SCK_BACK = 8, + SCK_TAB = 9, + SCK_RETURN = 13, + SCK_ADD = 310, + SCK_SUBTRACT = 311, + SCK_DIVIDE = 312 + }; + + //! This enum defines the different modifier keys. + enum + { + //! No modifier key. + SCMOD_NORM = 0, + + //! Shift key. + SCMOD_SHIFT = 1, + + //! Control key. + SCMOD_CTRL = 2, + + //! Alt key. + SCMOD_ALT = 4 + }; + + //! This enum defines the different language lexers. + //! + //! \sa SCI_GETLEXER, SCI_SETLEXER + enum + { + //! No lexer is selected and the SCN_STYLENEEDED signal is + //! emitted so that the application can style the text as + //! needed. This is the default. + SCLEX_CONTAINER = 0, + + //! Select the null lexer that does no syntax styling. + SCLEX_NULL = 1, + + //! Select the Python lexer. + SCLEX_PYTHON = 2, + + //! Select the C++ lexer. + SCLEX_CPP = 3, + + //! Select the HTML lexer. + SCLEX_HTML = 4, + + //! Select the XML lexer. + SCLEX_XML = 5, + + //! Select the Perl lexer. + SCLEX_PERL = 6, + + //! Select the SQL lexer. + SCLEX_SQL = 7, + + //! Select the Visual Basic lexer. + SCLEX_VB = 8, + + //! Select the lexer for properties style files. + SCLEX_PROPERTIES = 9, + + //! Select the lexer for error list style files. + SCLEX_ERRORLIST = 10, + + //! Select the Makefile lexer. + SCLEX_MAKEFILE = 11, + + //! Select the Windows batch file lexer. + SCLEX_BATCH = 12, + + //! Select the LaTex lexer. + SCLEX_LATEX = 14, + + //! Select the Lua lexer. + SCLEX_LUA = 15, + + //! Select the lexer for diff output. + SCLEX_DIFF = 16, + + //! Select the lexer for Apache configuration files. + SCLEX_CONF = 17, + + //! Select the Pascal lexer. + SCLEX_PASCAL = 18, + + //! Select the Avenue lexer. + SCLEX_AVE = 19, + + //! Select the Ada lexer. + SCLEX_ADA = 20, + + //! Select the Lisp lexer. + SCLEX_LISP = 21, + + //! Select the Ruby lexer. + SCLEX_RUBY = 22, + + //! Select the Eiffel lexer. + SCLEX_EIFFEL = 23, + + //! Select the Eiffel lexer folding at keywords. + SCLEX_EIFFELKW = 24, + + //! Select the Tcl lexer. + SCLEX_TCL = 25, + + //! Select the lexer for nnCron files. + SCLEX_NNCRONTAB = 26, + + //! Select the Bullant lexer. + SCLEX_BULLANT = 27, + + //! Select the VBScript lexer. + SCLEX_VBSCRIPT = 28, + + //! Select the ASP lexer. + SCLEX_ASP = SCLEX_HTML, + + //! Select the PHP lexer. + SCLEX_PHP = SCLEX_HTML, + + //! Select the Baan lexer. + SCLEX_BAAN = 31, + + //! Select the Matlab lexer. + SCLEX_MATLAB = 32, + + //! Select the Scriptol lexer. + SCLEX_SCRIPTOL = 33, + + //! Select the assembler lexer. + SCLEX_ASM = 34, + + //! Select the C++ lexer with case insensitive keywords. + SCLEX_CPPNOCASE = 35, + + //! Select the FORTRAN lexer. + SCLEX_FORTRAN = 36, + + //! Select the FORTRAN77 lexer. + SCLEX_F77 = 37, + + //! Select the CSS lexer. + SCLEX_CSS = 38, + + //! Select the POV lexer. + SCLEX_POV = 39, + + //! Select the Basser Lout typesetting language lexer. + SCLEX_LOUT = 40, + + //! Select the EScript lexer. + SCLEX_ESCRIPT = 41, + + //! Select the PostScript lexer. + SCLEX_PS = 42, + + //! Select the NSIS lexer. + SCLEX_NSIS = 43, + + //! Select the MMIX assembly language lexer. + SCLEX_MMIXAL = 44, + + //! Select the Clarion lexer. + SCLEX_CLW = 45, + + //! Select the Clarion lexer with case insensitive keywords. + SCLEX_CLWNOCASE = 46, + + //! Select the MPT text log file lexer. + SCLEX_LOT = 47, + + //! Select the YAML lexer. + SCLEX_YAML = 48, + + //! Select the TeX lexer. + SCLEX_TEX = 49, + + //! Select the Metapost lexer. + SCLEX_METAPOST = 50, + + //! Select the PowerBASIC lexer. + SCLEX_POWERBASIC = 51, + + //! Select the Forth lexer. + SCLEX_FORTH = 52, + + //! Select the Erlang lexer. + SCLEX_ERLANG = 53, + + //! Select the Octave lexer. + SCLEX_OCTAVE = 54, + + //! Select the MS SQL lexer. + SCLEX_MSSQL = 55, + + //! Select the Verilog lexer. + SCLEX_VERILOG = 56, + + //! Select the KIX-Scripts lexer. + SCLEX_KIX = 57, + + //! Select the Gui4Cli lexer. + SCLEX_GUI4CLI = 58, + + //! Select the Specman E lexer. + SCLEX_SPECMAN = 59, + + //! Select the AutoIt3 lexer. + SCLEX_AU3 = 60, + + //! Select the APDL lexer. + SCLEX_APDL = 61, + + //! Select the Bash lexer. + SCLEX_BASH = 62, + + //! Select the ASN.1 lexer. + SCLEX_ASN1 = 63, + + //! Select the VHDL lexer. + SCLEX_VHDL = 64, + + //! Select the Caml lexer. + SCLEX_CAML = 65, + + //! Select the BlitzBasic lexer. + SCLEX_BLITZBASIC = 66, + + //! Select the PureBasic lexer. + SCLEX_PUREBASIC = 67, + + //! Select the Haskell lexer. + SCLEX_HASKELL = 68, + + //! Select the PHPScript lexer. + SCLEX_PHPSCRIPT = 69, + + //! Select the TADS3 lexer. + SCLEX_TADS3 = 70, + + //! Select the REBOL lexer. + SCLEX_REBOL = 71, + + //! Select the Smalltalk lexer. + SCLEX_SMALLTALK = 72, + + //! Select the FlagShip lexer. + SCLEX_FLAGSHIP = 73, + + //! Select the Csound lexer. + SCLEX_CSOUND = 74, + + //! Select the FreeBasic lexer. + SCLEX_FREEBASIC = 75, + + //! Select the InnoSetup lexer. + SCLEX_INNOSETUP = 76, + + //! Select the Opal lexer. + SCLEX_OPAL = 77, + + //! Select the Spice lexer. + SCLEX_SPICE = 78 + }; + + //! Construct an empty QextScintillaBase with parent \a parent, name + //! \a name, and widget flags \a f. + QextScintillaBase(QWidget *parent = 0,const char *name = 0, + WFlags f = 0); + + //! Destroys the QextScintillaBase instance. + virtual ~QextScintillaBase(); + + //! Returns a pointer to a QextScintillaBase instance, or 0 if there + //! isn't one. This can be used by the higher level API to send + //! messages that aren't associated with a particular instance. + static QextScintillaBase *pool(); + + //! Send the Scintilla message \a msg with the optional parameters \a + //! wParam and \a lParam. + long SendScintilla(unsigned int msg,unsigned long wParam = 0, + long lParam = 0); + + //! \overload + long SendScintilla(unsigned int msg,unsigned long wParam, + const char *lParam) + { + return SendScintilla(msg,wParam,reinterpret_cast<long>(lParam)); + } + + //! \overload + long SendScintilla(unsigned int msg,const char *lParam) + { + return SendScintilla(msg,0UL,reinterpret_cast<long>(lParam)); + } + + //! \overload + long SendScintilla(unsigned int msg,const char *wParam, + const char *lParam) + { + return SendScintilla(msg,reinterpret_cast<unsigned long>(wParam),reinterpret_cast<long>(lParam)); + } + + //! \overload + long SendScintilla(unsigned int msg, long wParam) + { + return SendScintilla(msg, static_cast<unsigned long>(wParam), 0L); + } + + //! \overload + long SendScintilla(unsigned int msg, int wParam) + { + return SendScintilla(msg, static_cast<unsigned long>(wParam), 0L); + } + + //! \overload + long SendScintilla(unsigned int msg,long cpMin,long cpMax, + char *lpstrText); + + //! \overload + long SendScintilla(unsigned int msg,unsigned long wParam, + const QColor &col); + + //! \overload + long SendScintilla(unsigned int msg,const QColor &col); + + //! \overload + long SendScintilla(unsigned int msg,unsigned long wParam,QPainter *hdc, + const QRect &rc,long cpMin,long cpMax); + + //! \overload + long SendScintilla(unsigned int msg,unsigned long wParam, + const QPixmap *lParam) + { + return SendScintilla(msg,wParam,reinterpret_cast<long>(lParam)); + } + + //! Returns the recommended size of the widget. + virtual QSize sizeHint() const; + + //! Returns the viewport widget. This is the widget that actually + //! contains the text. + QWidget *viewport() const; + +signals: + //! This signal is emitted when text is selected or de-selected. + //! \a yes is TRUE if text has been selected and FALSE if text has been + //! deselected. + void QSCN_SELCHANGED(bool yes); + + //! This signal is emitted when the user selects an item in an + //! auto-completion list. It is emitted before the selection is + //! inserted. The insertion can be cancelled by sending an + //! SCI_AUTOCANCEL message from a connected slot. + //! \a position is the start position of the word being completed. + //! \a selection is the text of the selection. + void SCN_AUTOCSELECTION(const char *selection,int position); + + //! This signal is emitted when the document has changed for any + //! reason. + void SCEN_CHANGE(); + + //! This signal ir emitted when the user clicks on a calltip. + //! \a position is 1 if the user clicked on the up arrow, 2 if the user + //! clicked on the down arrow, and 0 if the user clicked elsewhere. + void SCN_CALLTIPCLICK(int direction); + + //! This signal is emitted whenever the user enters an ordinary + //! character into the text. \a charadded is the character. It can be + //! used to decide to display a call tip or an auto-completion list. + void SCN_CHARADDED(int charadded); + + //! + void SCN_DOUBLECLICK(); + + //! + void SCN_DWELLEND(int,int,int); + + //! + void SCN_DWELLSTART(int,int,int); + + //! This signal is emitted when the user clicks on text in a style + //! with the hotspot attribute set. + //! \a position is the position in the text where the click occured. + //! \a modifiers is the logical or of the modifier keys that were + //! pressed when the user clicked. + void SCN_HOTSPOTCLICK(int position,int modifiers); + + //! This signal is emitted when the user double clicks on text in a + //! style with the hotspot attribute set. + //! \a position is the position in the text where the double click + //! occured. + //! \a modifiers is the logical or of the modifier keys that were + //! pressed when the user double clicked. + void SCN_HOTSPOTDOUBLECLICK(int position,int modifiers); + + //! This signal is emitted when a recordable editor command has been + //! executed. + void SCN_MACRORECORD(unsigned int,unsigned long,long); + + //! This signal is emitted when the user clicks on a sensitive margin. + //! \a position is the position of the start of the line against which + //! the user clicked. + //! \a modifiers is the logical or of the modifier keys that were + //! pressed when the user clicked. + //! \a margin is the number of the margin the user clicked in: 0, 1 or + //! 2. + //! + //! \sa SCI_GETMARGINSENSITIVEN, SCI_SETMARGINSENSITIVEN + void SCN_MARGINCLICK(int position,int modifiers,int margin); + + //! + void SCN_MODIFIED(int,int,const char *,int,int,int,int,int); + + //! This signal is emitted when the user attempts to modify read-only + //! text. + void SCN_MODIFYATTEMPTRO(); + + //! + void SCN_NEEDSHOWN(int,int); + + //! This signal is emitted when painting has been completed. It is + //! useful to trigger some other change but to have the paint be done + //! first to appear more reponsive to the user. + void SCN_PAINTED(); + + //! This signal is emitted when the current state of the text no longer + //! corresponds to the state of the text at the save point. + //! + //! \sa SCI_SETSAVEPOINT, SCN_SAVEPOINTREACHED() + void SCN_SAVEPOINTLEFT(); + + //! This signal is emitted when the current state of the text + //! corresponds to the state of the text at the save point. This allows + //! feedback to be given to the user as to whether the text has been + //! modified since it was last saved. + //! + //! \sa SCI_SETSAVEPOINT, SCN_SAVEPOINTLEFT() + void SCN_SAVEPOINTREACHED(); + + //! This signal is emitted when a range of text needs to be syntax + //! styled. The range is from the value returned by the + //! SCI_GETENDSTYLED message and \a position. It is only emitted if + //! the currently selected lexer is SCNLEX_CONTAINER. + //! + //! \sa SCI_COLOURISE, SCI_GETENDSTYLED + void SCN_STYLENEEDED(int position); + + //! + void SCN_UPDATEUI(); + + //! + void SCN_USERLISTSELECTION(const char *,int); + + //! + void SCN_ZOOM(); + +protected: + //! Re-implemented to filter certain events. + bool eventFilter(QObject *o,QEvent *e); + + //! Re-implemented to handle the key presses for the widget. + virtual void keyPressEvent(QKeyEvent *ke); + + //! Re-implemented to tell Scintilla it has the focus. + virtual void focusInEvent(QFocusEvent *); + + //! Re-implemented to tell Scintilla it has lost the focus. + virtual void focusOutEvent(QFocusEvent *); + + //! Re-implemented to allow tabs to be entered as text. + virtual bool focusNextPrevChild(bool); + + //! Start a drag operation. + virtual void startDrag(); + +private slots: + void handleTimer(); + void handleVSb(int value); + void handleHSb(int value); + void handlePopUp(int cmd); + void handleSelection(); + +private: + friend class ScintillaQt; + + void mousePress(QMouseEvent *me); + void mouseRelease(QMouseEvent *me); + void mouseDoubleClick(QMouseEvent *me); + void mouseMove(QMouseEvent *me); + void mouseWheel(QWheelEvent *we); + void contextMenu(QContextMenuEvent *cme); + + ScintillaQt *sci; + QPoint triple_click_at; + QTimer triple_click; + QScrollBar *vsb; + QScrollBar *hsb; + QWidget *txtarea; + +#if defined(Q_DISABLE_COPY) + QextScintillaBase(const QextScintillaBase &); + QextScintillaBase &operator=(const QextScintillaBase &); +#endif +}; + +#endif diff --git a/qt/qextscintillacommand.cpp b/qt/qextscintillacommand.cpp new file mode 100644 index 0000000..57f9ee1 --- /dev/null +++ b/qt/qextscintillacommand.cpp @@ -0,0 +1,199 @@ +// This module implements the QextScintillaCommand class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qnamespace.h> +#include <qapplication.h> + +#include "qextscintillacommand.h" +#include "qextscintilla.h" +#include "qextscintillabase.h" + + +static int convert(int key); + + +// The ctor. +QextScintillaCommand::QextScintillaCommand(QextScintilla *qs,int msg,int key, + int altkey, const char *desc) : + qsCmd(qs), msgCmd(msg), + qkey(key), qaltkey(altkey), + descCmd(desc) +{ + scikey = convert(qkey); + + if (scikey) + qsCmd -> SendScintilla(QextScintillaBase::SCI_ASSIGNCMDKEY,scikey,msgCmd); + + scialtkey = convert(qaltkey); + + if (scialtkey) + qsCmd -> SendScintilla(QextScintillaBase::SCI_ASSIGNCMDKEY,scialtkey,msgCmd); +} + + +// Bind a key to a command. +void QextScintillaCommand::setKey(int key) +{ + bindKey(key,qkey,scikey); +} + + +// Bind an alternate key to a command. +void QextScintillaCommand::setAlternateKey(int altkey) +{ + bindKey(altkey,qaltkey,scialtkey); +} + + +// Do the hard work of binding a key. +void QextScintillaCommand::bindKey(int key,int &qk,int &scik) +{ + int new_scikey; + + // Ignore if it is invalid, allowing for the fact that we might be + // unbinding it. + if (key) + { + new_scikey = convert(key); + + if (!new_scikey) + return; + } + else + new_scikey = 0; + + if (scik) + qsCmd -> SendScintilla(QextScintillaBase::SCI_CLEARCMDKEY,scik); + + qk = key; + scik = new_scikey; + + if (scik) + qsCmd -> SendScintilla(QextScintillaBase::SCI_ASSIGNCMDKEY,scik,msgCmd); +} + + +// See if a key is valid. +bool QextScintillaCommand::validKey(int key) +{ + return convert(key); +} + + +// Convert a Qt character to the Scintilla equivalent. Return zero if it is +// invalid. +static int convert(int key) +{ + // Convert the modifiers. + int sci_mod = 0; + + if (key & Qt::SHIFT) + sci_mod |= QextScintillaBase::SCMOD_SHIFT; + + if (key & Qt::CTRL) + sci_mod |= QextScintillaBase::SCMOD_CTRL; + + if (key & Qt::ALT) + sci_mod |= QextScintillaBase::SCMOD_ALT; + + key &= ~Qt::MODIFIER_MASK; + + // Convert the key. + int sci_key; + + if (key > 0x7f) + switch (key) + { + case Qt::Key_Down: + sci_key = QextScintillaBase::SCK_DOWN; + break; + + case Qt::Key_Up: + sci_key = QextScintillaBase::SCK_UP; + break; + + case Qt::Key_Left: + sci_key = QextScintillaBase::SCK_LEFT; + break; + + case Qt::Key_Right: + sci_key = QextScintillaBase::SCK_RIGHT; + break; + + case Qt::Key_Home: + sci_key = QextScintillaBase::SCK_HOME; + break; + + case Qt::Key_End: + sci_key = QextScintillaBase::SCK_END; + break; + + case Qt::Key_Prior: + sci_key = QextScintillaBase::SCK_PRIOR; + break; + + case Qt::Key_Next: + sci_key = QextScintillaBase::SCK_NEXT; + break; + + case Qt::Key_Delete: + sci_key = QextScintillaBase::SCK_DELETE; + break; + + case Qt::Key_Insert: + sci_key = QextScintillaBase::SCK_INSERT; + break; + + case Qt::Key_Escape: + sci_key = QextScintillaBase::SCK_ESCAPE; + break; + + case Qt::Key_Backspace: + sci_key = QextScintillaBase::SCK_BACK; + break; + + case Qt::Key_Tab: + sci_key = QextScintillaBase::SCK_TAB; + break; + + case Qt::Key_Return: + sci_key = QextScintillaBase::SCK_RETURN; + break; + + default: + sci_key = 0; + } + else + sci_key = key; + + if (sci_key) + sci_key |= (sci_mod << 16); + + return sci_key; +} + + +// Return the translated user friendly description. +QString QextScintillaCommand::description() const +{ + return qApp -> translate("QextScintillaCommand",descCmd); +} diff --git a/qt/qextscintillacommand.h b/qt/qextscintillacommand.h new file mode 100644 index 0000000..0e4557c --- /dev/null +++ b/qt/qextscintillacommand.h @@ -0,0 +1,99 @@ +// This defines the interface to the QextScintillaCommand class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLACOMMAND_H +#define QEXTSCINTILLACOMMAND_H + + +#include <qstring.h> + +#include <qextscintillaglobal.h> + + +class QextScintilla; + + +//! \brief The QextScintillaCommand class represents an internal editor command +//! that may have one or two keys bound to it. +//! +//! Methods are provided to change the keys bound to the command and to remove +//! a key binding. Each command has a user friendly description of the command +//! for use in key mapping dialogs. +class QEXTSCINTILLA_EXPORT QextScintillaCommand +{ +public: + //! Binds the key \a key to the command. If \a key is 0 then the key + //! binding is removed. If \a key is invalid then the key binding is + //! unchanged. Valid keys are any visible or control character or any + //! of \c Key_Down, \c Key_Up, \c Key_Left, \c Key_Right, \c Key_Home, + //! \c Key_End, \c Key_Prior, \c Key_Next, \c Key_Delete, + //! \c Key_Insert, \c Key_Escape, \c Key_Backspace, \c Key_Tab and + //! \c Key_Return. Keys may be modified with any combination of + //! \c SHIFT, \c CTRL and \c ALT. + //! + //! \sa key(), setAlternateKey(), validKey() + void setKey(int key); + + //! Binds the alternate key \a altkey to the command. If \a key is 0 + //! then the alternate key binding is removed. + //! + //! \sa alternateKey(), setKey(), validKey() + void setAlternateKey(int altkey); + + //! The key that is currently bound to the command is returned. + //! + //! \sa setKey(), alternateKey() + int key() const {return qkey;} + + //! The alternate key that is currently bound to the command is + //! returned. + //! + //! \sa setAlternateKey(), key() + int alternateKey() const {return qaltkey;} + + //! If the key \a key is valid then TRUE is returned. + static bool validKey(int key); + + //! The user friendly description of the command is returned. + QString description() const; + +private: + friend class QextScintillaCommandSet; + + QextScintillaCommand(QextScintilla *qs,int msg,int key,int altkey, + const char *desc); + + int msgId() const {return msgCmd;} + void bindKey(int key,int &qk,int &scik); + + QextScintilla *qsCmd; + int msgCmd; + int qkey, scikey, qaltkey, scialtkey; + const char *descCmd; + +#if defined(Q_DISABLE_COPY) + QextScintillaCommand(const QextScintillaCommand &); + QextScintillaCommand &operator=(const QextScintillaCommand &); +#endif +}; + +#endif diff --git a/qt/qextscintillacommandset.cpp b/qt/qextscintillacommandset.cpp new file mode 100644 index 0000000..9c7fa59 --- /dev/null +++ b/qt/qextscintillacommandset.cpp @@ -0,0 +1,653 @@ +// This module implements the QextScintillaCommandSet class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qsettings.h> + +#include "qextscintillacommandset.h" +#include "qextscintillacommand.h" +#include "qextscintilla.h" + + +// The ctor. +QextScintillaCommandSet::QextScintillaCommandSet(QextScintilla *qs) : qsci(qs) +{ + struct sci_cmd { + int msg; + int key; + int altkey; + const char *desc; + }; + + // This is based on the default table in src/KeyMap.cxx. + static struct sci_cmd cmd_table[] = { + { + QextScintillaBase::SCI_LINEDOWN, + Qt::Key_Down, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move down one line") + }, + { + QextScintillaBase::SCI_LINEDOWNEXTEND, + Qt::Key_Down | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection down one line") + }, + { + QextScintillaBase::SCI_LINESCROLLDOWN, + Qt::Key_Down | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Scroll view down one line") + }, + { + QextScintillaBase::SCI_LINEDOWNRECTEXTEND, + Qt::Key_Down | Qt::ALT | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend rectangular selection down one line") + }, + { + QextScintillaBase::SCI_LINEUP, + Qt::Key_Up, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move up one line") + }, + { + QextScintillaBase::SCI_LINEUPEXTEND, + Qt::Key_Up | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection up one line") + }, + { + QextScintillaBase::SCI_LINESCROLLUP, + Qt::Key_Up | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Scroll view up one line") + }, + { + QextScintillaBase::SCI_LINEUPRECTEXTEND, + Qt::Key_Up | Qt::ALT | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend rectangular selection up one line") + }, + { + QextScintillaBase::SCI_PARAUP, + Qt::Key_BracketLeft | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move up one paragraph") + }, + { + QextScintillaBase::SCI_PARAUPEXTEND, + Qt::Key_BracketLeft | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection up one paragraph") + }, + { + QextScintillaBase::SCI_PARADOWN, + Qt::Key_BracketRight | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move down one paragraph") + }, + { + QextScintillaBase::SCI_PARADOWNEXTEND, + Qt::Key_BracketRight | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection down one paragraph") + }, + { + QextScintillaBase::SCI_CHARLEFT, + Qt::Key_Left, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move left one character") + }, + { + QextScintillaBase::SCI_CHARLEFTEXTEND, + Qt::Key_Left | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection left one character") + }, + { + QextScintillaBase::SCI_WORDLEFT, + Qt::Key_Left | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move left one word") + }, + { + QextScintillaBase::SCI_WORDLEFTEXTEND, + Qt::Key_Left | Qt::SHIFT | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection left one word") + }, + { + QextScintillaBase::SCI_CHARLEFTRECTEXTEND, + Qt::Key_Left | Qt::ALT | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend rectangular selection left one character") + }, + { + QextScintillaBase::SCI_CHARRIGHT, + Qt::Key_Right, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move right one character") + }, + { + QextScintillaBase::SCI_CHARRIGHTEXTEND, + Qt::Key_Right | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection right one character") + }, + { + QextScintillaBase::SCI_WORDRIGHT, + Qt::Key_Right | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move right one word") + }, + { + QextScintillaBase::SCI_WORDRIGHTEXTEND, + Qt::Key_Right | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection right one word") + }, + { + QextScintillaBase::SCI_CHARRIGHTRECTEXTEND, + Qt::Key_Right | Qt::ALT | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend rectangular selection right one character") + }, + { + QextScintillaBase::SCI_WORDPARTLEFT, + Qt::Key_Slash | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move left one word part") + }, + { + QextScintillaBase::SCI_WORDPARTLEFTEXTEND, + Qt::Key_Slash | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection left one word part") + }, + { + QextScintillaBase::SCI_WORDPARTRIGHT, + Qt::Key_Backslash | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move right one word part") + }, + { + QextScintillaBase::SCI_WORDPARTRIGHTEXTEND, + Qt::Key_Backslash | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection right one word part") + }, + { + QextScintillaBase::SCI_VCHOME, + Qt::Key_Home, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move to first visible character in line") + }, + { + QextScintillaBase::SCI_VCHOMEEXTEND, + Qt::Key_Home | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection to first visible character in line") + }, + { + QextScintillaBase::SCI_DOCUMENTSTART, + Qt::Key_Home | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move to start of text") + }, + { + QextScintillaBase::SCI_DOCUMENTSTARTEXTEND, + Qt::Key_Home | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection to start of text") + }, + { + QextScintillaBase::SCI_HOMEDISPLAY, + Qt::Key_Home | Qt::ALT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move to start of displayed line") + }, + { + QextScintillaBase::SCI_HOMEDISPLAYEXTEND, + 0, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection to start of line") + }, + { + QextScintillaBase::SCI_VCHOMERECTEXTEND, + Qt::Key_Home | Qt::ALT | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend rectangular selection to first visible character in line") + }, + { + QextScintillaBase::SCI_LINEEND, + Qt::Key_End, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move to end of line") + }, + { + QextScintillaBase::SCI_LINEENDEXTEND, + Qt::Key_End | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection to end of line") + }, + { + QextScintillaBase::SCI_DOCUMENTEND, + Qt::Key_End | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move to end of text") + }, + { + QextScintillaBase::SCI_DOCUMENTENDEXTEND, + Qt::Key_End | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection to end of text") + }, + { + QextScintillaBase::SCI_LINEENDDISPLAY, + Qt::Key_End | Qt::ALT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move to end of displayed line") + }, + { + QextScintillaBase::SCI_LINEENDDISPLAYEXTEND, + 0, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection to end of displayed line") + }, + { + QextScintillaBase::SCI_LINEENDRECTEXTEND, + Qt::Key_End | Qt::ALT | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend rectangular selection to end of line") + }, + { + QextScintillaBase::SCI_PAGEUP, + Qt::Key_Prior, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move up one page") + }, + { + QextScintillaBase::SCI_PAGEUPEXTEND, + Qt::Key_Prior | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection up one page") + }, + { + QextScintillaBase::SCI_PAGEUPRECTEXTEND, + Qt::Key_Prior | Qt::ALT | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend rectangular selection up one page") + }, + { + QextScintillaBase::SCI_PAGEDOWN, + Qt::Key_Next, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move down one page") + }, + { + QextScintillaBase::SCI_PAGEDOWNEXTEND, + Qt::Key_Next | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend selection down one page") + }, + { + QextScintillaBase::SCI_PAGEDOWNRECTEXTEND, + Qt::Key_Next | Qt::ALT | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Extend rectangular selection down one page") + }, + { + QextScintillaBase::SCI_CLEAR, + Qt::Key_Delete, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Delete current character") + }, + { + QextScintillaBase::SCI_CUT, + Qt::Key_X | Qt::CTRL, + Qt::Key_Delete | Qt::SHIFT, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Cut selection") + }, + { + QextScintillaBase::SCI_DELWORDRIGHT, + Qt::Key_Delete | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Delete word to right") + }, + { + QextScintillaBase::SCI_DELLINERIGHT, + Qt::Key_Delete | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Delete line to right") + }, + { + QextScintillaBase::SCI_EDITTOGGLEOVERTYPE, + Qt::Key_Insert, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Toggle insert/overtype") + }, + { + QextScintillaBase::SCI_PASTE, + Qt::Key_V | Qt::CTRL, + Qt::Key_Insert | Qt::SHIFT, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Paste") + }, + { + QextScintillaBase::SCI_COPY, + Qt::Key_C | Qt::CTRL, + Qt::Key_Insert | Qt::CTRL, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Copy selection") + }, + { + QextScintillaBase::SCI_CANCEL, + Qt::Key_Escape, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Cancel") + }, + { + QextScintillaBase::SCI_DELETEBACK, + Qt::Key_Backspace, + Qt::Key_Backspace | Qt::SHIFT, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Delete previous character") + }, + { + QextScintillaBase::SCI_DELWORDLEFT, + Qt::Key_Backspace | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Delete word to left") + }, + { + QextScintillaBase::SCI_UNDO, + Qt::Key_Z | Qt::CTRL, + Qt::Key_Backspace | Qt::ALT, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Undo the last command") + }, + { + QextScintillaBase::SCI_DELLINELEFT, + Qt::Key_Backspace | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Delete line to left") + }, + { + QextScintillaBase::SCI_REDO, + Qt::Key_Y | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Redo last command") + }, + { + QextScintillaBase::SCI_SELECTALL, + Qt::Key_A | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Select all text") + }, + { + QextScintillaBase::SCI_TAB, + Qt::Key_Tab, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Indent one level") + }, + { + QextScintillaBase::SCI_BACKTAB, + Qt::Key_Tab | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Move back one indentation level") + }, + { + QextScintillaBase::SCI_NEWLINE, + Qt::Key_Return, + Qt::Key_Return | Qt::SHIFT, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Insert new line") + }, + { + QextScintillaBase::SCI_ZOOMIN, + Qt::Key_Plus | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Zoom in") + }, + { + QextScintillaBase::SCI_ZOOMOUT, + Qt::Key_Minus | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Zoom out") + }, + { + QextScintillaBase::SCI_SETZOOM, + 0, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Set zoom") + }, + { + QextScintillaBase::SCI_FORMFEED, + 0, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Formfeed") + }, + { + QextScintillaBase::SCI_LINECUT, + Qt::Key_L | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Cut current line") + }, + { + QextScintillaBase::SCI_LINEDELETE, + Qt::Key_L | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Delete current line") + }, + { + QextScintillaBase::SCI_LINECOPY, + Qt::Key_T | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Copy current line") + }, + { + QextScintillaBase::SCI_LINETRANSPOSE, + Qt::Key_T | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Swap current and previous lines") + }, + { + QextScintillaBase::SCI_SELECTIONDUPLICATE, + Qt::Key_D | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Duplicate selection") + }, + { + QextScintillaBase::SCI_LOWERCASE, + Qt::Key_U | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Convert selection to lower case") + }, + { + QextScintillaBase::SCI_UPPERCASE, + Qt::Key_U | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Convert selection to upper case") + }, + { + QextScintillaBase::SCI_DELETEBACKNOTLINE, + 0, + 0, + QT_TRANSLATE_NOOP("QextScintillaCommand", + "Delete previous character if not at line start") + }, + }; + + cmds.setAutoDelete(TRUE); + + // Clear the default map. + qsci -> SendScintilla(QextScintillaBase::SCI_CLEARALLCMDKEYS); + + for (int i = 0; i < sizeof (cmd_table) / sizeof (cmd_table[0]); ++i) + cmds.append(new QextScintillaCommand(qsci,cmd_table[i].msg,cmd_table[i].key,cmd_table[i].altkey,cmd_table[i].desc)); +} + + +// Read the command set from settings. +bool QextScintillaCommandSet::readSettings(QSettings &qs,const char *prefix) +{ + bool rc = TRUE; + QString skey; + + for (QextScintillaCommand *cmd = cmds.first(); cmd; cmd = cmds.next()) + { + skey.sprintf("%s/keymap/c%d/",prefix,cmd -> msgId()); + + int key; + bool ok; + + // Read the key. + key = qs.readNumEntry(skey + "key",0,&ok); + + if (ok) + cmd -> setKey(key); + else + rc = FALSE; + + // Read the alternate key. + key = qs.readNumEntry(skey + "alt",0,&ok); + + if (ok) + cmd -> setAlternateKey(key); + else + rc = FALSE; + } + + return rc; +} + + +// Write the command set to settings. +bool QextScintillaCommandSet::writeSettings(QSettings &qs,const char *prefix) +{ + bool rc = TRUE; + QString skey; + + for (const QextScintillaCommand *cmd = cmds.first(); cmd; cmd = cmds.next()) + { + skey.sprintf("%s/keymap/c%d/",prefix,cmd -> msgId()); + + // Write the key. + if (!qs.writeEntry(skey + "key",cmd -> key())) + rc = FALSE; + + // Write the alternate key. + if (!qs.writeEntry(skey + "alt",cmd -> alternateKey())) + rc = FALSE; + } + + return rc; +} + + +// Clear the key bindings. +void QextScintillaCommandSet::clearKeys() +{ + QPtrList<QextScintillaCommand> &set = commands(); + + for (QextScintillaCommand *cmd = set.first(); cmd; cmd = set.next()) + cmd -> setKey(0); +} + + +// Clear the alternate key bindings. +void QextScintillaCommandSet::clearAlternateKeys() +{ + QPtrList<QextScintillaCommand> &set = commands(); + + for (QextScintillaCommand *cmd = set.first(); cmd; cmd = set.next()) + cmd -> setAlternateKey(0); +} diff --git a/qt/qextscintillacommandset.h b/qt/qextscintillacommandset.h new file mode 100644 index 0000000..d242bfa --- /dev/null +++ b/qt/qextscintillacommandset.h @@ -0,0 +1,82 @@ +// This defines the interface to the QextScintillaCommandSet class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLACOMMANDSET_H +#define QEXTSCINTILLACOMMANDSET_H + + +#include <qptrlist.h> + +#include <qextscintillaglobal.h> +#include <qextscintillacommand.h> + + +class QSettings; +class QextScintilla; + + +//! \brief The QextScintillaCommandSet class represents the set of all internal +//! editor commands that may have keys bound. +//! +//! Methods are provided to access the individual commands and to read and +//! write the current bindings from and to settings files. +class QEXTSCINTILLA_EXPORT QextScintillaCommandSet +{ +public: + //! The key bindings for each command in the set are read from the + //! settings \a qs. \a prefix is prepended to the key of each entry. + //! TRUE is returned if there was no error. + //! + //! \sa writeSettings() + bool readSettings(QSettings &qs,const char *prefix = "/Scintilla"); + + //! The key bindings for each command in the set are written to the + //! settings \a qs. \a prefix is prepended to the key of each entry. + //! TRUE is returned if there was no error. + //! + //! \sa readSettings() + bool writeSettings(QSettings &qs,const char *prefix = "/Scintilla"); + + //! The commands in the set are returned as a list. + QPtrList<QextScintillaCommand> &commands() {return cmds;} + + //! The primary keys bindings for all commands are removed. + void clearKeys(); + + //! The alternate keys bindings for all commands are removed. + void clearAlternateKeys(); + +private: + friend class QextScintilla; + + QextScintillaCommandSet(QextScintilla *qs); + + QextScintilla *qsci; + QPtrList<QextScintillaCommand> cmds; + +#if defined(Q_DISABLE_COPY) + QextScintillaCommandSet(const QextScintillaCommandSet &); + QextScintillaCommandSet &operator=(const QextScintillaCommandSet &); +#endif +}; + +#endif diff --git a/qt/qextscintilladocument.cpp b/qt/qextscintilladocument.cpp new file mode 100644 index 0000000..9fc6887 --- /dev/null +++ b/qt/qextscintilladocument.cpp @@ -0,0 +1,139 @@ +// This module implements the QextScintillaDocument class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include "qextscintilladocument.h" +#include "qextscintillabase.h" + + +// This internal class encapsulates the underlying document and is shared by +// QextScintillaDocument instances. +class QextScintillaDocumentP +{ +public: + QextScintillaDocumentP() : doc(0), nr_displays(0), nr_attaches(1) {} + + long doc; // The Scintilla document. + int nr_displays; // The number of displays. + int nr_attaches; // The number of attaches. +}; + + +// The ctor. +QextScintillaDocument::QextScintillaDocument() +{ + pdoc = new QextScintillaDocumentP(); +} + + +// The dtor. +QextScintillaDocument::~QextScintillaDocument() +{ + detach(); +} + + +// The copy ctor. +QextScintillaDocument::QextScintillaDocument(const QextScintillaDocument &that) +{ + attach(that); +} + + +// The assignment operator. +QextScintillaDocument &QextScintillaDocument::operator=(const QextScintillaDocument &that) +{ + if (pdoc != that.pdoc) + { + detach(); + attach(that); + } + + return *this; +} + + +// Attach an existing document to this one. +void QextScintillaDocument::attach(const QextScintillaDocument &that) +{ + ++that.pdoc -> nr_attaches; + pdoc = that.pdoc; +} + + +// Detach the underlying document. +void QextScintillaDocument::detach() +{ + if (!pdoc) + return; + + if (--pdoc -> nr_attaches == 0) + { + if (pdoc -> doc && pdoc -> nr_displays == 0) + { + QextScintillaBase *qsb = QextScintillaBase::pool(); + + // Release the explicit reference to the document. If + // the pool is empty then we just accept the memory + // leak. + if (qsb) + qsb -> SendScintilla(QextScintillaBase::SCI_RELEASEDOCUMENT,0,pdoc -> doc); + } + + delete pdoc; + } + + pdoc = 0; +} + + +// Undisplay and detach the underlying document. +void QextScintillaDocument::undisplay(QextScintillaBase *qsb) +{ + if (--pdoc -> nr_attaches == 0) + delete pdoc; + else if (--pdoc -> nr_displays == 0) + { + // Create an explicit reference to the document to keep it + // alive. + qsb -> SendScintilla(QextScintillaBase::SCI_ADDREFDOCUMENT,0,pdoc -> doc); + } + + pdoc = 0; +} + + +// Display the underlying document. +void QextScintillaDocument::display(QextScintillaBase *qsb,const QextScintillaDocument *from) +{ + long ndoc; + + if (from) + { + ndoc = from -> pdoc -> doc; + qsb -> SendScintilla(QextScintillaBase::SCI_SETDOCPOINTER,0,ndoc); + } + else + ndoc = qsb -> SendScintilla(QextScintillaBase::SCI_GETDOCPOINTER); + + pdoc -> doc = ndoc; + ++pdoc -> nr_displays; +} diff --git a/qt/qextscintilladocument.h b/qt/qextscintilladocument.h new file mode 100644 index 0000000..4dd846c --- /dev/null +++ b/qt/qextscintilladocument.h @@ -0,0 +1,61 @@ +// This defines the interface to the QextScintillaDocument class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLADOCUMENT_H +#define QEXTSCINTILLADOCUMENT_H + + +#include <qextscintillaglobal.h> + + +class QextScintillaBase; +class QextScintillaDocumentP; + + +//! \brief The QextScintillaDocument class represents a document to be editted. +//! +//! It is an opaque class that can be attached to multiple instances of +//! QextScintilla to create different simultaneous views of the same document. +//! QextScintillaDocument uses implicit sharing so that copying class instances +//! is a cheap operation. +class QEXTSCINTILLA_EXPORT QextScintillaDocument +{ +public: + //! Create a new unattached document. + QextScintillaDocument(); + virtual ~QextScintillaDocument(); + + QextScintillaDocument(const QextScintillaDocument &); + QextScintillaDocument &operator=(const QextScintillaDocument &); + +private: + friend class QextScintilla; + + void attach(const QextScintillaDocument &that); + void detach(); + void display(QextScintillaBase *qsb,const QextScintillaDocument *from); + void undisplay(QextScintillaBase *qsb); + + QextScintillaDocumentP *pdoc; +}; + +#endif diff --git a/qt/qextscintillaglobal.h b/qt/qextscintillaglobal.h new file mode 100644 index 0000000..f16286a --- /dev/null +++ b/qt/qextscintillaglobal.h @@ -0,0 +1,54 @@ +// This module defines various things common to all of the Qt port to +// Scintilla. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLAGLOBAL_H +#define QEXTSCINTILLAGLOBAL_H + + +#include <qglobal.h> + + +#define QSCINTILLA_VERSION 0x010701 +#define QSCINTILLA_VERSION_STR "1.7.1" +#define QSCINTILLA_BUILD "@RM_BUILD@" + + +// Under Windows, define QEXTSCINTILLA_MAKE_DLL to create a Scintilla DLL, or +// define QEXTSCINTILLA_DLL to link against a Scintilla DLL, or define neither +// to either build or link against a static Scintilla library. +#if defined(Q_WS_WIN) + +#if defined(QEXTSCINTILLA_DLL) +#define QEXTSCINTILLA_EXPORT __declspec(dllimport) +#elif defined(QEXTSCINTILLA_MAKE_DLL) +#define QEXTSCINTILLA_EXPORT __declspec(dllexport) +#endif + +#endif + +#if !defined(QEXTSCINTILLA_EXPORT) +#define QEXTSCINTILLA_EXPORT +#endif + + +#endif diff --git a/qt/qextscintillalexer.cpp b/qt/qextscintillalexer.cpp new file mode 100644 index 0000000..9302180 --- /dev/null +++ b/qt/qextscintillalexer.cpp @@ -0,0 +1,444 @@ +// This module implements the QextScintillaLexer class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qapplication.h> +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexer.h" +#include "qextscintilla.h" +#include "qextscintillabase.h" + + +// The ctor. +QextScintillaLexer::QextScintillaLexer(QObject *parent,const char *name) + : QObject(parent,name), autoIndStyle(-1) +{ +#if defined(Q_OS_WIN) + defFont = QFont("Verdana",10); +#else + defFont = QFont("Bitstream Vera Sans",9); +#endif + + // Set the default fore and background colours. + QColorGroup cg = QApplication::palette().active(); + defColor = cg.text(); + defPaper = cg.base(); +} + + +// The dtor. +QextScintillaLexer::~QextScintillaLexer() +{ +} + + +// Default implementation to return the set of fill up characters that can end +// auto-completion. +const char *QextScintillaLexer::autoCompletionFillups() const +{ + return "("; +} + + +// Default implementation to return the set of characters that can start +// auto-completion. +const char *QextScintillaLexer::autoCompletionStartCharacters() const +{ + return 0; +} + + +// Default implementation to return the list of keywords that can start a +// block. +const char *QextScintillaLexer::blockStartKeyword(int *) const +{ + return 0; +} + + +// Default implementation to return the list of characters that can start a +// block. +const char *QextScintillaLexer::blockStart(int *) const +{ + return 0; +} + + +// Default implementation to return the list of characters that can end a +// block. +const char *QextScintillaLexer::blockEnd(int *) const +{ + return 0; +} + + +// Default implementation to return the style used for braces. +int QextScintillaLexer::braceStyle() const +{ + return -1; +} + + +// Default implementation to return the number of lines to look back when +// auto-indenting. +int QextScintillaLexer::blockLookback() const +{ + return 20; +} + + +// Default implementation to return the characters that make up a word. +const char *QextScintillaLexer::wordCharacters() const +{ + return 0; +} + + +// Default implementation to return the style used for whitespace. +int QextScintillaLexer::defaultStyle() const +{ + return 0; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexer::color(int) const +{ + return defaultColor(); +} + + +// Returns the end-of-line fill for a style. +bool QextScintillaLexer::eolFill(int) const +{ + return FALSE; +} + + +// Returns the font for a style. +QFont QextScintillaLexer::font(int) const +{ + return defaultFont(); +} + + +// Returns the set of keywords. +const char *QextScintillaLexer::keywords(int) const +{ + return 0; +} + + +// Returns the background colour of the text for a style. +QColor QextScintillaLexer::paper(int) const +{ + return defaultPaper(); +} + + +// Returns the default font for all styles. +QFont QextScintillaLexer::defaultFont() const +{ + return defFont; +} + + +// Sets the default font for all styles. +void QextScintillaLexer::setDefaultFont(const QFont &f) +{ + defFont = f; +} + + +// Returns the default text colour for all styles. +QColor QextScintillaLexer::defaultColor() const +{ + return defColor; +} + + +// Sets the default text colour for all styles. +void QextScintillaLexer::setDefaultColor(const QColor &c) +{ + defColor = c; +} + + +// Returns the default paper colour for all styles. +QColor QextScintillaLexer::defaultPaper() const +{ + return defPaper; +} + + +// Sets the default paper colour for all styles. +void QextScintillaLexer::setDefaultPaper(const QColor &c) +{ + defPaper = c; +} + + +// Read properties from the settings. +bool QextScintillaLexer::readProperties(QSettings &,const QString &) +{ + return TRUE; +} + + +// Refresh all properties. +void QextScintillaLexer::refreshProperties() +{ +} + + +// Write properties to the settings. +bool QextScintillaLexer::writeProperties(QSettings &,const QString &) const +{ + return TRUE; +} + + +// Restore the user settings. +bool QextScintillaLexer::readSettings(QSettings &qs,const char *prefix) +{ + bool ok, flag, rc = TRUE; + int num; + QString key; + + // Read the styles. + for (int i = 0; i < 128; ++i) + { + // Ignore invalid styles. + if (description(i).isNull()) + continue; + + key.sprintf("%s/%s/style%d/",prefix,language(),i); + + // Read the foreground colour. + num = qs.readNumEntry(key + "color",0,&ok); + + if (ok) + emit colorChanged(QColor((num >> 16) & 0xff,(num >> 8) & 0xff,num & 0xff),i); + else + rc = FALSE; + + // Read the end-of-line fill. + flag = qs.readBoolEntry(key + "eolfill",0,&ok); + + if (ok) + emit eolFillChanged(flag,i); + else + rc = FALSE; + + // Read the font + QStringList fdesc; + + fdesc = qs.readListEntry(key + "font",',',&ok); + + if (ok && fdesc.count() == 5) + { + QFont f; + + f.setFamily(fdesc[0]); + f.setPointSize(fdesc[1].toInt()); + f.setBold(fdesc[2].toInt()); + f.setItalic(fdesc[3].toInt()); + f.setUnderline(fdesc[4].toInt()); + + emit fontChanged(f,i); + } + else + rc = FALSE; + + // Read the background colour. + num = qs.readNumEntry(key + "paper",0,&ok); + + if (ok) + emit paperChanged(QColor((num >> 16) & 0xff,(num >> 8) & 0xff,num & 0xff),i); + else + rc = FALSE; + } + + // Read the properties. + key.sprintf("%s/%s/properties/",prefix,language()); + + if (!readProperties(qs,key)) + rc = FALSE; + + refreshProperties(); + + // Read the rest. + key.sprintf("%s/%s/",prefix,language()); + + num = qs.readNumEntry(key + "autoindentstyle",0,&ok); + + if (ok) + autoIndStyle = num; + else + rc = FALSE; + + return rc; +} + + +// Save the user settings. +bool QextScintillaLexer::writeSettings(QSettings &qs,const char *prefix) const +{ + bool rc = TRUE; + QString key; + + // Write the styles. + for (int i = 0; i < 128; ++i) + { + // Ignore invalid styles. + if (description(i).isNull()) + continue; + + int num; + QColor c; + + key.sprintf("%s/%s/style%d/",prefix,language(),i); + + // Write the foreground colour. + c = color(i); + num = (c.red() << 16) | (c.green() << 8) | c.blue(); + + if (!qs.writeEntry(key + "color",num)) + rc = FALSE; + + // Write the end-of-line fill. + if (!qs.writeEntry(key + "eolfill",eolFill(i))) + rc = FALSE; + + // Write the font + QStringList fdesc; + QString fmt("%1"); + QFont f; + + f = font(i); + + fdesc += f.family(); + fdesc += fmt.arg(f.pointSize()); + + // The casts are for Borland. + fdesc += fmt.arg((int)f.bold()); + fdesc += fmt.arg((int)f.italic()); + fdesc += fmt.arg((int)f.underline()); + + if (!qs.writeEntry(key + "font",fdesc,',')) + rc = FALSE; + + // Write the background colour. + c = paper(i); + num = (c.red() << 16) | (c.green() << 8) | c.blue(); + + if (!qs.writeEntry(key + "paper",num)) + rc = FALSE; + } + + // Write the properties. + key.sprintf("%s/%s/properties/",prefix,language()); + + if (!writeProperties(qs,key)) + rc = FALSE; + + // Write the rest. + key.sprintf("%s/%s/",prefix,language()); + + if (!qs.writeEntry(key + "autoindentstyle",autoIndStyle)) + rc = FALSE; + + return rc; +} + + +// Return the auto-indentation style. +int QextScintillaLexer::autoIndentStyle() +{ + // We can't do this in the ctor because we want the virtuals to work. + if (autoIndStyle < 0) + autoIndStyle = (blockStartKeyword() || blockStart() || blockEnd()) ? + 0 : QextScintilla::AiMaintain; + + return autoIndStyle; +} + + +// Set the auto-indentation style. +void QextScintillaLexer::setAutoIndentStyle(int autoindentstyle) +{ + autoIndStyle = autoindentstyle; +} + + +// Set the foreground colour for a style. +void QextScintillaLexer::setColor(const QColor &c,int style) +{ + if (style >= 0) + emit colorChanged(c,style); + else + for (int i = 0; i < 128; ++i) + if (!description(i).isNull()) + emit colorChanged(c,i); +} + + +// Set the end-of-line fill for a style. +void QextScintillaLexer::setEolFill(bool eolfill,int style) +{ + if (style >= 0) + emit eolFillChanged(eolfill,style); + else + for (int i = 0; i < 128; ++i) + if (!description(i).isNull()) + emit eolFillChanged(eolfill,i); +} + + +// Set the font for a style. +void QextScintillaLexer::setFont(const QFont &f,int style) +{ + if (style >= 0) + emit fontChanged(f,style); + else + for (int i = 0; i < 128; ++i) + if (!description(i).isNull()) + emit fontChanged(f,i); +} + + +// Set the background colour for a style. +void QextScintillaLexer::setPaper(const QColor &c,int style) +{ + if (style >= 0) + emit paperChanged(c,style); + else + { + for (int i = 0; i < 128; ++i) + if (!description(i).isNull()) + emit paperChanged(c,i); + + emit paperChanged(c,QextScintillaBase::STYLE_DEFAULT); + } +} diff --git a/qt/qextscintillalexer.h b/qt/qextscintillalexer.h new file mode 100644 index 0000000..2c4aad6 --- /dev/null +++ b/qt/qextscintillalexer.h @@ -0,0 +1,274 @@ +// This defines the interface to the QextScintillaLexer class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXER_H +#define QEXTSCINTILLALEXER_H + + +#include <qobject.h> +#include <qstring.h> +#include <qcolor.h> +#include <qfont.h> + +#include <qextscintillaglobal.h> + + +class QSettings; + + +//! \brief The QextScintillaLexer class is an abstract class used as a base for +//! specific language lexers. +//! +//! A Scintilla lexer scans the text breaking it up into separate language +//! objects, e.g. keywords, strings, operators. The lexer then uses a +//! different style to draw each object. A style is identified by a style +//! number and has a number of attributes, including colour and font. A +//! specific language lexer will implement appropriate default styles which can +//! be overriden by an application by further sub-classing the specific +//! language lexer. +//! +//! A specific language lexer may provide one or more sets of words to be +//! recognised as keywords. Most lexers only provide one set, but some may +//! support languages embedded in other languages and provide several sets. +//! +//! QextScintillaLexer provides convenience methods for saving and restoring +//! user preferences for fonts and colours. +class QEXTSCINTILLA_EXPORT QextScintillaLexer : public QObject +{ + Q_OBJECT + +public: + //! Construct a QextScintillaLexer with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexer(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexer instance. + virtual ~QextScintillaLexer(); + + //! Returns the name of the language. It must be re-implemented by a + //! sub-class. + virtual const char *language() const = 0; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. It must be re-implemented by a sub-class. + virtual const char *lexer() const = 0; + + //! \internal Returns the characters that can fill up auto-completion. + //! These are ignored if QextScintilla::setAutoCompletionFillups() has + //! been explicitly called. + virtual const char *autoCompletionFillups() const; + + //! \internal Returns the characters that can start auto-completion. + virtual const char *autoCompletionStartCharacters() const; + + //! Returns the auto-indentation style. The default is 0 if the + //! language is block structured, or QextScintilla::AiMaintain if not. + //! + //! \sa setAutoIndentStyle(), QextScintilla::AiMaintain, + //! QextScintilla::AiOpening, QextScintilla::AiClosing + int autoIndentStyle(); + + //! \internal Returns a space separated list of words or characters in + //! a particular style that define the end of a block for + //! auto-indentation. The style is returned via \a style. + virtual const char *blockEnd(int *style = 0) const; + + //! \internal Returns the number of lines prior to the current one when + //! determining the scope of a block when auto-indenting. + virtual int blockLookback() const; + + //! \internal Returns a space separated list of words or characters in + //! a particular style that define the start of a block for + //! auto-indentation. The style is returned via \a style. + virtual const char *blockStart(int *style = 0) const; + + //! \internal Returns a space separated list of keywords in a + //! particular style that define the start of a block for + //! auto-indentation. The style is returned via \a style. + virtual const char *blockStartKeyword(int *style = 0) const; + + //! \internal Returns the style used for braces for brace matching. + virtual int braceStyle() const; + + //! \internal Returns the string of characters that comprise a word. + //! The default is 0 which implies the upper and lower case alphabetic + //! characters and underscore. + virtual const char *wordCharacters() const; + + //! Returns the foreground colour of the text for style number + //! \a style. The default colour is black. + //! + //! \sa paper() + virtual QColor color(int style) const; + + //! Returns the end-of-line for style number \a style. The default is + //! FALSE. + virtual bool eolFill(int style) const; + + //! Returns the font for style number \a style. The default font is + //! that returned by defaultFont(). + //! + //! \sa defaultFont() + virtual QFont font(int style) 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. + virtual const char *keywords(int set) const; + + //! \internal Returns the number of the style used for whitespace. The + //! default implementation returns 0 which is the convention adopted by + //! most lexers. + virtual int defaultStyle() const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + virtual QString description(int style) const = 0; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa defaultPaper(), color() + virtual QColor paper(int style) const; + + //! Returns the default font for all styles. + //! + //! \sa setDefaultFont() + virtual QFont defaultFont() const; + + //! Returns the default text colour for all styles. + //! + //! \sa setDefaultColor() + virtual QColor defaultColor() const; + + //! Returns the default paper colour for all styles. + //! + //! \sa setDefaultPaper() + virtual QColor defaultPaper() const; + + //! Causes all properties to be refreshed by emitting the + //! propertyChanged() signal as required. + virtual void refreshProperties(); + + //! The colour, paper, font and end-of-line for each style number, and + //! all lexer specific properties are read from the settings \a qs. + //! \a prefix is prepended to the key of each entry. TRUE is returned + //! if there was no error. + //! + //! \sa writeSettings(), QextScintilla::setLexer() + bool readSettings(QSettings &qs,const char *prefix = "/Scintilla"); + + //! The colour, paper, font and end-of-line for each style number, and + //! all lexer specific properties are written to the settings \a qs. + //! \a prefix is prepended to the key of each entry. TRUE is returned + //! if there was no error. + //! + //! \sa readSettings() + bool writeSettings(QSettings &qs, + const char *prefix = "/Scintilla") const; + +public slots: + //! The auto-indentation style is set to \a autoindentstyle. + //! + //! \sa autoIndentStyle(), QextScintilla::AiMaintain, + //! QextScintilla::AiOpening, QextScintilla::AiClosing + virtual void setAutoIndentStyle(int autoindentstyle); + + //! The foreground colour for style number \a style is set to \a c. If + //! \a style is -1 then the colour is set for all styles. + virtual void setColor(const QColor &c,int style = -1); + + //! The default font for all styles is set to \a f. + //! + //! \sa defaultFont() + virtual void setDefaultFont(const QFont &f); + + //! The default text colour for all styles is set to \a c. + //! + //! \sa defaultColor(), color() + virtual void setDefaultColor(const QColor &c); + + //! The default paper colour for all styles is set to \a c. + //! + //! \sa defaultPaper(), paper() + virtual void setDefaultPaper(const QColor &c); + + //! The end-of-line fill for style number \a style is set to + //! \a eoffill. If \a style is -1 then the fill is set for all styles. + virtual void setEolFill(bool eoffill,int style = -1); + + //! The font for style number \a style is set to \a f. If \a style is + //! -1 then the font is set for all styles. + virtual void setFont(const QFont &f,int style = -1); + + //! The background colour for style number \a style is set to \a c. If + //! \a style is -1 then the colour is set for all styles. + virtual void setPaper(const QColor &c,int style = -1); + +signals: + //! This signal is emitted when the foreground colour of style number + //! \a style has changed. The new colour is \a c. + void colorChanged(const QColor &c,int style); + + //! This signal is emitted when the end-of-file fill of style number + //! \a style has changed. The new fill is \a eoffilled. + void eolFillChanged(bool eoffilled,int style); + + //! This signal is emitted when the font of style number \a style has + //! changed. The new font is \a f. + void fontChanged(const QFont &f,int style); + + //! This signal is emitted when the background colour of style number + //! \a style has changed. The new colour is \a c. + void paperChanged(const QColor &c,int style); + + //! This signal is emitted when the value of the lexer property \a prop + //! needs to be changed. The new value is \a val. + void propertyChanged(const char *prop,const char *val); + +protected: + //! The lexer's properties are read from the settings \a qs. \a prefix + //! (which has a trailing '/') should be used as a prefix to the key of + //! each setting. TRUE is returned if there is no error. + //! + virtual bool readProperties(QSettings &qs,const QString &prefix); + + //! The lexer's properties are written to the settings \a qs. + //! \a prefix (which has a trailing '/') should be used as a prefix to + //! the key of each setting. TRUE is returned if there is no error. + //! + virtual bool writeProperties(QSettings &qs,const QString &prefix) const; + +private: + int autoIndStyle; + QFont defFont; + QColor defColor; + QColor defPaper; + +#if defined(Q_DISABLE_COPY) + QextScintillaLexer(const QextScintillaLexer &); + QextScintillaLexer &operator=(const QextScintillaLexer &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexerbash.cpp b/qt/qextscintillalexerbash.cpp new file mode 100644 index 0000000..b5d172b --- /dev/null +++ b/qt/qextscintillalexerbash.cpp @@ -0,0 +1,369 @@ +// This module implements the QextScintillaLexerBash class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexerbash.h" + + +// The ctor. +QextScintillaLexerBash::QextScintillaLexerBash(QObject *parent, + const char *name) + : QextScintillaLexer(parent,name), fold_comments(FALSE), + fold_compact(TRUE) +{ +} + + +// The dtor. +QextScintillaLexerBash::~QextScintillaLexerBash() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerBash::language() const +{ + return "Bash"; +} + + +// Returns the lexer name. +const char *QextScintillaLexerBash::lexer() const +{ + return "bash"; +} + + +// Return the style used for braces. +int QextScintillaLexerBash::braceStyle() const +{ + return Operator; +} + + +// Return the string of characters that comprise a word. +const char *QextScintillaLexerBash::wordCharacters() const +{ + return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$@%&"; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerBash::color(int style) const +{ + switch (style) + { + case Default: + return QColor(0x80,0x80,0x80); + + case Error: + case Backticks: + return QColor(0xff,0xff,0x00); + + case Comment: + return QColor(0x00,0x7f,0x00); + + case Number: + return QColor(0x00,0x7f,0x7f); + + case Keyword: + return QColor(0x00,0x00,0x7f); + + case DoubleQuotedString: + case SingleQuotedString: + case SingleQuotedHereDocument: + return QColor(0x7f,0x00,0x7f); + + case Operator: + case Identifier: + case Scalar: + case ParameterExpansion: + case HereDocumentDelimiter: + return QColor(0x00,0x00,0x00); + } + + return QextScintillaLexer::color(style); +} + + +// Returns the end-of-line fill for a style. +bool QextScintillaLexerBash::eolFill(int style) const +{ + switch (style) + { + case SingleQuotedHereDocument: + return TRUE; + } + + return FALSE; +} + + +// Returns the font of the text for a style. +QFont QextScintillaLexerBash::font(int style) const +{ + QFont f; + + switch (style) + { + case Comment: +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + break; + + case Keyword: + case Operator: + f = QextScintillaLexer::font(style); + f.setBold(TRUE); + break; + + case DoubleQuotedString: + case SingleQuotedString: +#if defined(Q_OS_WIN) + f = QFont("Courier New",10); +#else + f = QFont("Bitstream Vera Sans Mono",9); +#endif + break; + + default: + f = QextScintillaLexer::font(style); + } + + return f; +} + + +// Returns the set of keywords. +const char *QextScintillaLexerBash::keywords(int set) const +{ + if (set == 1) + return + "alias ar asa awk banner basename bash bc bdiff break " + "bunzip2 bzip2 cal calendar case cat cc cd chmod " + "cksum clear cmp col comm compress continue cp cpio " + "crypt csplit ctags cut date dc dd declare deroff dev " + "df diff diff3 dircmp dirname do done du echo ed " + "egrep elif else env esac eval ex exec exit expand " + "export expr false fc fgrep fi file find fmt fold for " + "function functions getconf getopt getopts grep gres " + "hash head help history iconv id if in integer jobs " + "join kill local lc let line ln logname look ls m4 " + "mail mailx make man mkdir more mt mv newgrp nl nm " + "nohup ntps od pack paste patch pathchk pax pcat perl " + "pg pr print printf ps pwd read readonly red return " + "rev rm rmdir sed select set sh shift size sleep sort " + "spell split start stop strings strip stty sum " + "suspend sync tail tar tee test then time times touch " + "tr trap true tsort tty type typeset ulimit umask " + "unalias uname uncompress unexpand uniq unpack unset " + "until uudecode uuencode vi vim vpax wait wc whence " + "which while who wpaste wstart xargs zcat " + + "chgrp chown chroot dir dircolors factor groups " + "hostid install link md5sum mkfifo mknod nice pinky " + "printenv ptx readlink seq sha1sum shred stat su tac " + "unlink users vdir whoami yes"; + + return 0; +} + + +// Returns the user name of a style. +QString QextScintillaLexerBash::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Error: + return tr("Error"); + + case Comment: + return tr("Comment"); + + case Number: + return tr("Number"); + + case Keyword: + return tr("Keyword"); + + case DoubleQuotedString: + return tr("Double-quoted string"); + + case SingleQuotedString: + return tr("Single-quoted string"); + + case Operator: + return tr("Operator"); + + case Identifier: + return tr("Identifier"); + + case Scalar: + return tr("Scalar"); + + case ParameterExpansion: + return tr("Parameter expansion"); + + case Backticks: + return tr("Backticks"); + + case HereDocumentDelimiter: + return tr("Here document delimiter"); + + case SingleQuotedHereDocument: + return tr("Single-quoted here document"); + } + + return QString::null; +} + + +// Returns the background colour of the text for a style. +QColor QextScintillaLexerBash::paper(int style) const +{ + switch (style) + { + case Error: + return QColor(0xff,0x00,0x00); + + case Scalar: + return QColor(0xff,0xe0,0xe0); + + case ParameterExpansion: + return QColor(0xff,0xff,0xe0); + + case Backticks: + return QColor(0xa0,0x80,0x80); + + case HereDocumentDelimiter: + case SingleQuotedHereDocument: + return QColor(0xdd,0xd0,0xdd); + } + + return QextScintillaLexer::paper(style); +} + + +// Refresh all properties. +void QextScintillaLexerBash::refreshProperties() +{ + setCommentProp(); + setCompactProp(); +} + + +// Read properties from the settings. +bool QextScintillaLexerBash::readProperties(QSettings &qs,const QString &prefix) +{ + int rc = TRUE; + bool ok, flag; + + // Read the fold comments flag. + flag = qs.readBoolEntry(prefix + "foldcomments",FALSE,&ok); + + if (ok) + fold_comments = flag; + else + rc = FALSE; + + // Read the fold compact flag. + flag = qs.readBoolEntry(prefix + "foldcompact",TRUE,&ok); + + if (ok) + fold_compact = flag; + else + rc = FALSE; + + return rc; +} + + +// Write properties to the settings. +bool QextScintillaLexerBash::writeProperties(QSettings &qs,const QString &prefix) const +{ + int rc = TRUE; + + // Write the fold comments flag. + if (!qs.writeEntry(prefix + "foldcomments",fold_comments)) + rc = FALSE; + + // Write the fold compact flag. + if (!qs.writeEntry(prefix + "foldcompact",fold_compact)) + rc = FALSE; + + return rc; +} + + +// Return TRUE if comments can be folded. +bool QextScintillaLexerBash::foldComments() const +{ + return fold_comments; +} + + +// Set if comments can be folded. +void QextScintillaLexerBash::setFoldComments(bool fold) +{ + fold_comments = fold; + + setCommentProp(); +} + + +// Set the "fold.comment" property. +void QextScintillaLexerBash::setCommentProp() +{ + emit propertyChanged("fold.comment",(fold_comments ? "1" : "0")); +} + + +// Return TRUE if folds are compact. +bool QextScintillaLexerBash::foldCompact() const +{ + return fold_compact; +} + + +// Set if folds are compact +void QextScintillaLexerBash::setFoldCompact(bool fold) +{ + fold_compact = fold; + + setCompactProp(); +} + + +// Set the "fold.compact" property. +void QextScintillaLexerBash::setCompactProp() +{ + emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); +} diff --git a/qt/qextscintillalexerbash.h b/qt/qextscintillalexerbash.h new file mode 100644 index 0000000..344aac7 --- /dev/null +++ b/qt/qextscintillalexerbash.h @@ -0,0 +1,189 @@ +// This defines the interface to the QextScintillaLexerBash class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERBASH_H +#define QEXTSCINTILLALEXERBASH_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerBash class encapsulates the Scintilla Bash +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerBash : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! Bash lexer. + enum { + //! The default. + Default = 0, + + //! \deprecated White space. + WhiteSpace = Default, + + //! An error. + Error = 1, + + //! A comment. + Comment = 2, + + //! A number. + Number = 3, + + //! A keyword. + Keyword = 4, + + //! A double-quoted string. + DoubleQuotedString = 5, + + //! A single-quoted string. + SingleQuotedString = 6, + + //! An operator. + Operator = 7, + + //! An identifier + Identifier = 8, + + //! A scalar. + Scalar = 9, + + //! Parameter expansion. + ParameterExpansion = 10, + + //! Backticks. + Backticks = 11, + + //! A here document delimiter. + HereDocumentDelimiter = 12, + + //! A single quoted here document. + SingleQuotedHereDocument = 13 + }; + + //! Construct a QextScintillaLexerBash with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerBash(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerBash instance. + virtual ~QextScintillaLexerBash(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns the style used for braces for brace matching. + int braceStyle() const; + + //! \internal Returns the string of characters that comprise a word. + const char *wordCharacters() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool eolFill(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa color() + QColor paper(int style) const; + + //! Causes all properties to be refreshed by emitting the + //! propertyChanged() signal as required. + void refreshProperties(); + + //! Returns TRUE if multi-line comment blocks can be folded. + //! + //! \sa setFoldComments() + bool foldComments() const; + + //! Returns TRUE if trailing blank lines are included in a fold block. + //! + //! \sa setFoldCompact() + bool foldCompact() const; + +public slots: + //! If \a fold is TRUE then multi-line comment blocks can be folded. + //! The default is FALSE. + //! + //! \sa foldComments() + virtual void setFoldComments(bool fold); + + //! If \a fold is TRUE then trailing blank lines are included in a fold + //! block. The default is TRUE. + //! + //! \sa foldCompact() + virtual void setFoldCompact(bool fold); + +protected: + //! The lexer's properties are read from the settings \a qs. \a prefix + //! (which has a trailing '/') should be used as a prefix to the key of + //! each setting. TRUE is returned if there is no error. + //! + bool readProperties(QSettings &qs,const QString &prefix); + + //! The lexer's properties are written to the settings \a qs. + //! \a prefix (which has a trailing '/') should be used as a prefix to + //! the key of each setting. TRUE is returned if there is no error. + //! + bool writeProperties(QSettings &qs,const QString &prefix) const; + +private: + void setCommentProp(); + void setCompactProp(); + + bool fold_comments; + bool fold_compact; + +#if defined(Q_DISABLE_COPY) + QextScintillaLexerBash(const QextScintillaLexerBash &); + QextScintillaLexerBash &operator=(const QextScintillaLexerBash &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexerbatch.cpp b/qt/qextscintillalexerbatch.cpp new file mode 100644 index 0000000..57a9418 --- /dev/null +++ b/qt/qextscintillalexerbatch.cpp @@ -0,0 +1,198 @@ +// This module implements the QextScintillaLexerBatch class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexerbatch.h" + + +// The ctor. +QextScintillaLexerBatch::QextScintillaLexerBatch(QObject *parent, + const char *name) + : QextScintillaLexer(parent,name) +{ +} + + +// The dtor. +QextScintillaLexerBatch::~QextScintillaLexerBatch() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerBatch::language() const +{ + return "Batch"; +} + + +// Returns the lexer name. +const char *QextScintillaLexerBatch::lexer() const +{ + return "batch"; +} + + +// Return the string of characters that comprise a word. +const char *QextScintillaLexerBatch::wordCharacters() const +{ + return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerBatch::color(int style) const +{ + switch (style) + { + case Default: + case Operator: + return QColor(0x00,0x00,0x00); + + case Comment: + return QColor(0x00,0x7f,0x00); + + case Keyword: + case ExternalCommand: + return QColor(0x00,0x00,0x7f); + + case Label: + return QColor(0x7f,0x00,0x7f); + + case HideCommandChar: + return QColor(0x7f,0x7f,0x00); + + case Variable: + return QColor(0x80,0x00,0x80); + } + + return QextScintillaLexer::color(style); +} + + +// Returns the end-of-line fill for a style. +bool QextScintillaLexerBatch::eolFill(int style) const +{ + return (style == Label); +} + + +// Returns the font of the text for a style. +QFont QextScintillaLexerBatch::font(int style) const +{ + QFont f; + + switch (style) + { + case Comment: +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + break; + + case Keyword: + f = QextScintillaLexer::font(style); + f.setBold(TRUE); + break; + + case ExternalCommand: +#if defined(Q_OS_WIN) + f = QFont("Courier New",10); +#else + f = QFont("Bitstream Vera Sans Mono",9); +#endif + f.setBold(TRUE); + break; + + default: + f = QextScintillaLexer::font(style); + } + + return f; +} + + +// Returns the set of keywords. +const char *QextScintillaLexerBatch::keywords(int set) const +{ + if (set == 1) + return + "rem set if exist errorlevel for in do break call " + "chcp cd chdir choice cls country ctty date del " + "erase dir echo exit goto loadfix loadhigh mkdir md " + "move path pause prompt rename ren rmdir rd shift " + "time type ver verify vol com con lpt nul"; + + return 0; +} + + +// Returns the user name of a style. +QString QextScintillaLexerBatch::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Comment: + return tr("Comment"); + + case Keyword: + return tr("Keyword"); + + case Label: + return tr("Label"); + + case HideCommandChar: + return tr("Hide command character"); + + case ExternalCommand: + return tr("External command"); + + case Variable: + return tr("Variable"); + + case Operator: + return tr("Operator"); + } + + return QString::null; +} + + +// Returns the background colour of the text for a style. +QColor QextScintillaLexerBatch::paper(int style) const +{ + switch (style) + { + case Label: + return QColor(0x60,0x60,0x60); + } + + return QextScintillaLexer::paper(style); +} diff --git a/qt/qextscintillalexerbatch.h b/qt/qextscintillalexerbatch.h new file mode 100644 index 0000000..517edfb --- /dev/null +++ b/qt/qextscintillalexerbatch.h @@ -0,0 +1,119 @@ +// This defines the interface to the QextScintillaLexerBatch class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERBATCH_H +#define QEXTSCINTILLALEXERBATCH_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerBatch class encapsulates the Scintilla batch +//! file lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerBatch : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! batch file lexer. + enum { + //! The default. + Default = 0, + + //! A comment. + Comment = 1, + + //! A keyword. + Keyword = 2, + + //! A label. + Label = 3, + + //! An hide command character. + HideCommandChar = 4, + + //! An external command . + ExternalCommand = 5, + + //! A variable. + Variable = 6, + + //! An operator + Operator = 7 + }; + + //! Construct a QextScintillaLexerBatch with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerBatch(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerBatch instance. + virtual ~QextScintillaLexerBatch(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns the string of characters that comprise a word. + const char *wordCharacters() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool eolFill(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa color() + QColor paper(int style) const; + +private: +#if defined(Q_DISABLE_COPY) + QextScintillaLexerBatch(const QextScintillaLexerBatch &); + QextScintillaLexerBatch &operator=(const QextScintillaLexerBatch &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexercpp.cpp b/qt/qextscintillalexercpp.cpp new file mode 100644 index 0000000..706d86b --- /dev/null +++ b/qt/qextscintillalexercpp.cpp @@ -0,0 +1,515 @@ +// This module implements the QextScintillaLexerCPP class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexercpp.h" + + +// The ctor. +QextScintillaLexerCPP::QextScintillaLexerCPP(QObject *parent,const char *name, + bool caseInsensitiveKeywords) + : QextScintillaLexer(parent,name), fold_atelse(FALSE), + fold_comments(FALSE), fold_compact(TRUE), fold_preproc(TRUE), + style_preproc(FALSE), nocase(caseInsensitiveKeywords) +{ +} + + +// The dtor. +QextScintillaLexerCPP::~QextScintillaLexerCPP() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerCPP::language() const +{ + return "C++"; +} + + +// Returns the lexer name. +const char *QextScintillaLexerCPP::lexer() const +{ + return (nocase ? "cppnocase" : "cpp"); +} + + +// Return the list of keywords that can start a block. +const char *QextScintillaLexerCPP::blockStartKeyword(int *style) const +{ + if (style) + *style = Keyword; + + return "case catch class default do else finally for if private " + "protected public struct try union while"; +} + + +// Return the list of characters that can start a block. +const char *QextScintillaLexerCPP::blockStart(int *style) const +{ + if (style) + *style = Operator; + + return "{"; +} + + +// Return the list of characters that can end a block. +const char *QextScintillaLexerCPP::blockEnd(int *style) const +{ + if (style) + *style = Operator; + + return "}"; +} + + +// Return the style used for braces. +int QextScintillaLexerCPP::braceStyle() const +{ + return Operator; +} + + +// Return the string of characters that comprise a word. +const char *QextScintillaLexerCPP::wordCharacters() const +{ + return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_#"; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerCPP::color(int style) const +{ + switch (style) + { + case Default: + return QColor(0x80,0x80,0x80); + + case Comment: + case CommentLine: + return QColor(0x00,0x7f,0x00); + + case CommentDoc: + case CommentLineDoc: + return QColor(0x3f,0x70,0x3f); + + case Number: + return QColor(0x00,0x7f,0x7f); + + case Keyword: + return QColor(0x00,0x00,0x7f); + + case DoubleQuotedString: + case SingleQuotedString: + return QColor(0x7f,0x00,0x7f); + + case PreProcessor: + return QColor(0x7f,0x7f,0x00); + + case Operator: + case UnclosedString: + return QColor(0x00,0x00,0x00); + + case Identifier: + break; + + case Regex: + return QColor(0x3f,0x7f,0x3f); + + case CommentDocKeyword: + return QColor(0x30,0x60,0xa0); + + case CommentDocKeywordError: + return QColor(0x80,0x40,0x20); + } + + return QextScintillaLexer::color(style); +} + + +// Returns the end-of-line fill for a style. +bool QextScintillaLexerCPP::eolFill(int style) const +{ + return (style == UnclosedString); +} + + +// Returns the font of the text for a style. +QFont QextScintillaLexerCPP::font(int style) const +{ + QFont f; + + switch (style) + { + case Comment: + case CommentLine: + case CommentDoc: + case CommentLineDoc: + case CommentDocKeyword: + case CommentDocKeywordError: +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + break; + + case Keyword: + case Operator: + f = QextScintillaLexer::font(style); + f.setBold(TRUE); + break; + + case DoubleQuotedString: + case SingleQuotedString: + case UnclosedString: +#if defined(Q_OS_WIN) + f = QFont("Courier New",10); +#else + f = QFont("Bitstream Vera Sans Mono",9); +#endif + break; + + default: + f = QextScintillaLexer::font(style); + } + + return f; +} + + +// Returns the set of keywords. +const char *QextScintillaLexerCPP::keywords(int set) const +{ + if (set == 1) + return + "and and_eq asm auto bitand bitor bool break case " + "catch char class compl const const_cast continue " + "default delete do double dynamic_cast else enum " + "explicit export extern false float for friend goto if " + "inline int long mutable namespace new not not_eq " + "operator or or_eq private protected public register " + "reinterpret_cast return short signed sizeof static " + "static_cast struct switch template this throw true " + "try typedef typeid typename union unsigned using " + "virtual void volatile wchar_t while xor xor_eq"; + + if (set == 3) + return + "a addindex addtogroup anchor arg attention author b " + "brief bug c class code date def defgroup deprecated " + "dontinclude e em endcode endhtmlonly endif " + "endlatexonly endlink endverbatim enum example " + "exception f$ f[ f] file fn hideinitializer " + "htmlinclude htmlonly if image include ingroup " + "internal invariant interface latexonly li line link " + "mainpage name namespace nosubgrouping note overload " + "p page par param post pre ref relates remarks return " + "retval sa section see showinitializer since skip " + "skipline struct subsection test throw todo typedef " + "union until var verbatim verbinclude version warning " + "weakgroup $ @ \\ & < > # { }"; + + return 0; +} + + +// Returns the user name of a style. +QString QextScintillaLexerCPP::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Comment: + return tr("C comment"); + + case CommentLine: + return tr("C++ comment"); + + case CommentDoc: + return tr("JavaDoc style C comment"); + + case Number: + return tr("Number"); + + case Keyword: + return tr("Keyword"); + + case DoubleQuotedString: + return tr("Double-quoted string"); + + case SingleQuotedString: + return tr("Single-quoted string"); + + case PreProcessor: + return tr("Pre-processor block"); + + case Operator: + return tr("Operator"); + + case Identifier: + return tr("Identifier"); + + case UnclosedString: + return tr("Unclosed string"); + + case CommentLineDoc: + return tr("JavaDoc style C++ comment"); + + case KeywordSet2: + return tr("Secondary keywords and identifiers"); + + case CommentDocKeyword: + return tr("JavaDoc keyword"); + + case CommentDocKeywordError: + return tr("JavaDoc keyword error"); + + case GlobalClass: + return tr("Global classes and typedefs"); + } + + return QString::null; +} + + +// Returns the background colour of the text for a style. +QColor QextScintillaLexerCPP::paper(int style) const +{ + if (style == UnclosedString) + return QColor(0xe0,0xc0,0xe0); + + return QextScintillaLexer::paper(style); +} + + +// Refresh all properties. +void QextScintillaLexerCPP::refreshProperties() +{ + setAtElseProp(); + setCommentProp(); + setCompactProp(); + setPreprocProp(); + setStylePreprocProp(); +} + + +// Read properties from the settings. +bool QextScintillaLexerCPP::readProperties(QSettings &qs,const QString &prefix) +{ + int rc = TRUE; + bool ok, flag; + + // Read the fold at else flag. + flag = qs.readBoolEntry(prefix + "foldatelse",FALSE,&ok); + + if (ok) + fold_atelse = flag; + else + rc = FALSE; + + // Read the fold comments flag. + flag = qs.readBoolEntry(prefix + "foldcomments",FALSE,&ok); + + if (ok) + fold_comments = flag; + else + rc = FALSE; + + // Read the fold compact flag. + flag = qs.readBoolEntry(prefix + "foldcompact",TRUE,&ok); + + if (ok) + fold_compact = flag; + else + rc = FALSE; + + // Read the fold preprocessor flag. + flag = qs.readBoolEntry(prefix + "foldpreprocessor",TRUE,&ok); + + if (ok) + fold_preproc = flag; + else + rc = FALSE; + + // Read the style preprocessor flag. + flag = qs.readBoolEntry(prefix + "stylepreprocessor",FALSE,&ok); + + if (ok) + style_preproc = flag; + else + rc = FALSE; + + return rc; +} + + +// Write properties to the settings. +bool QextScintillaLexerCPP::writeProperties(QSettings &qs,const QString &prefix) const +{ + int rc = TRUE; + + // Write the fold at else flag. + if (!qs.writeEntry(prefix + "foldatelse",fold_atelse)) + rc = FALSE; + + // Write the fold comments flag. + if (!qs.writeEntry(prefix + "foldcomments",fold_comments)) + rc = FALSE; + + // Write the fold compact flag. + if (!qs.writeEntry(prefix + "foldcompact",fold_compact)) + rc = FALSE; + + // Write the fold preprocessor flag. + if (!qs.writeEntry(prefix + "foldpreprocessor",fold_preproc)) + rc = FALSE; + + // Write the style preprocessor flag. + if (!qs.writeEntry(prefix + "stylepreprocessor",style_preproc)) + rc = FALSE; + + return rc; +} + + +// Return TRUE if else can be folded. +bool QextScintillaLexerCPP::foldAtElse() const +{ + return fold_atelse; +} + + +// Set if else can be folded. +void QextScintillaLexerCPP::setFoldAtElse(bool fold) +{ + fold_atelse = fold; + + setAtElseProp(); +} + + +// Set the "fold.at.else" property. +void QextScintillaLexerCPP::setAtElseProp() +{ + emit propertyChanged("fold.at.else",(fold_atelse ? "1" : "0")); +} + + +// Return TRUE if comments can be folded. +bool QextScintillaLexerCPP::foldComments() const +{ + return fold_comments; +} + + +// Set if comments can be folded. +void QextScintillaLexerCPP::setFoldComments(bool fold) +{ + fold_comments = fold; + + setCommentProp(); +} + + +// Set the "fold.comment" property. +void QextScintillaLexerCPP::setCommentProp() +{ + emit propertyChanged("fold.comment",(fold_comments ? "1" : "0")); +} + + +// Return TRUE if folds are compact. +bool QextScintillaLexerCPP::foldCompact() const +{ + return fold_compact; +} + + +// Set if folds are compact +void QextScintillaLexerCPP::setFoldCompact(bool fold) +{ + fold_compact = fold; + + setCompactProp(); +} + + +// Set the "fold.compact" property. +void QextScintillaLexerCPP::setCompactProp() +{ + emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); +} + + +// Return TRUE if preprocessor blocks can be folded. +bool QextScintillaLexerCPP::foldPreprocessor() const +{ + return fold_preproc; +} + + +// Set if preprocessor blocks can be folded. +void QextScintillaLexerCPP::setFoldPreprocessor(bool fold) +{ + fold_preproc = fold; + + setPreprocProp(); +} + + +// Set the "fold.preprocessor" property. +void QextScintillaLexerCPP::setPreprocProp() +{ + emit propertyChanged("fold.preprocessor",(fold_preproc ? "1" : "0")); +} + + +// Return TRUE if preprocessor lines are styled. +bool QextScintillaLexerCPP::stylePreprocessor() const +{ + return style_preproc; +} + + +// Set if preprocessor lines are styled. +void QextScintillaLexerCPP::setStylePreprocessor(bool style) +{ + style_preproc = style; + + setStylePreprocProp(); +} + + +// Set the "style.within.preprocessor" property. +void QextScintillaLexerCPP::setStylePreprocProp() +{ + emit propertyChanged("style.within.preprocessor",(style_preproc ? "1" : "0")); +} diff --git a/qt/qextscintillalexercpp.h b/qt/qextscintillalexercpp.h new file mode 100644 index 0000000..01c7157 --- /dev/null +++ b/qt/qextscintillalexercpp.h @@ -0,0 +1,273 @@ +// This defines the interface to the QextScintillaLexerCPP class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERCPP_H +#define QEXTSCINTILLALEXERCPP_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerCPP class encapsulates the Scintilla C++ +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerCPP : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! C++ lexer. + enum { + //! The default. + Default = 0, + + //! \deprecated White space. + WhiteSpace = Default, + + //! A C comment. + Comment = 1, + + //! A C++ comment line. + CommentLine = 2, + + //! A JavaDoc/Doxygen style C comment. + CommentDoc = 3, + + //! A number. + Number = 4, + + //! A keyword. + Keyword = 5, + + //! A double-quoted string. + DoubleQuotedString = 6, + + //! A single-quoted string. + SingleQuotedString = 7, + + //! An IDL UUID. + UUID = 8, + + //! A pre-processor block. + PreProcessor = 9, + + //! An operator. + Operator = 10, + + //! An identifier + Identifier = 11, + + //! The end of a line where a string is not closed. + UnclosedString = 12, + + //! A C# verbatim string. + VerbatimString = 13, + + //! A JavaScript regular expression. + Regex = 14, + + //! A JavaDoc/Doxygen style C++ comment line. + CommentLineDoc = 15, + + //! A keyword defined in keyword set number 2. The class must + //! be sub-classed and re-implement keywords() to make use of + //! this style. + KeywordSet2 = 16, + + //! A JavaDoc/Doxygen keyword. + CommentDocKeyword = 17, + + //! A JavaDoc/Doxygen keyword error. + CommentDocKeywordError = 18, + + //! A global class or typedef defined in keyword set number 4. + //! The class must be sub-classed and re-implement keywords() + //! to make use of this style. + GlobalClass = 19 + }; + + //! Construct a QextScintillaLexerCPP with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + //! \a caseInsensitiveKeywords is TRUE if the lexer ignores the case of + //! keywords. + QextScintillaLexerCPP(QObject *parent = 0,const char *name = 0, + bool caseInsensitiveKeywords = FALSE); + + //! Destroys the QextScintillaLexerCPP instance. + virtual ~QextScintillaLexerCPP(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns a space separated list of words or characters in + //! a particular style that define the end of a block for + //! auto-indentation. The styles is returned via \a style. + const char *blockEnd(int *style = 0) const; + + //! \internal Returns a space separated list of words or characters in + //! a particular style that define the start of a block for + //! auto-indentation. The styles is returned via \a style. + const char *blockStart(int *style = 0) const; + + //! \internal Returns a space separated list of keywords in a + //! particular style that define the start of a block for + //! auto-indentation. The styles is returned via \a style. + const char *blockStartKeyword(int *style = 0) const; + + //! \internal Returns the style used for braces for brace matching. + int braceStyle() const; + + //! \internal Returns the string of characters that comprise a word. + const char *wordCharacters() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool eolFill(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa color() + QColor paper(int style) const; + + //! Causes all properties to be refreshed by emitting the + //! propertyChanged() signal as required. + void refreshProperties(); + + //! Returns TRUE if "} else {" lines can be folded. + //! + //! \sa setFoldAtElse() + bool foldAtElse() const; + + //! Returns TRUE if multi-line comment blocks can be folded. + //! + //! \sa setFoldComments() + bool foldComments() const; + + //! Returns TRUE if trailing blank lines are included in a fold block. + //! + //! \sa setFoldCompact() + bool foldCompact() const; + + //! Returns TRUE if preprocessor blocks can be folded. + //! + //! \sa setFoldPreprocessor() + bool foldPreprocessor() const; + + //! Returns TRUE if preprocessor lines (after the preprocessor + //! directive) are styled. + //! + //! \sa setStylePreprocessor() + bool stylePreprocessor() const; + +public slots: + //! If \a fold is TRUE then "} else {" lines can be folded. The + //! default is FALSE. + //! + //! \sa foldAtElse() + virtual void setFoldAtElse(bool fold); + + //! If \a fold is TRUE then multi-line comment blocks can be folded. + //! The default is FALSE. + //! + //! \sa foldComments() + virtual void setFoldComments(bool fold); + + //! If \a fold is TRUE then trailing blank lines are included in a fold + //! block. The default is TRUE. + //! + //! \sa foldCompact() + virtual void setFoldCompact(bool fold); + + //! If \a fold is TRUE then preprocessor blocks can be folded. The + //! default is TRUE. + //! + //! \sa foldPreprocessor() + virtual void setFoldPreprocessor(bool fold); + + //! If \a style is TRUE then preprocessor lines (after the preprocessor + //! directive) are styled. The default is FALSE. + //! + //! \sa stylePreprocessor() + virtual void setStylePreprocessor(bool style); + +protected: + //! The lexer's properties are read from the settings \a qs. \a prefix + //! (which has a trailing '/') should be used as a prefix to the key of + //! each setting. TRUE is returned if there is no error. + //! + //! \sa writeProperties() + bool readProperties(QSettings &qs,const QString &prefix); + + //! The lexer's properties are written to the settings \a qs. + //! \a prefix (which has a trailing '/') should be used as a prefix to + //! the key of each setting. TRUE is returned if there is no error. + //! + //! \sa readProperties() + bool writeProperties(QSettings &qs,const QString &prefix) const; + +private: + void setAtElseProp(); + void setCommentProp(); + void setCompactProp(); + void setPreprocProp(); + void setStylePreprocProp(); + + bool fold_atelse; + bool fold_comments; + bool fold_compact; + bool fold_preproc; + bool style_preproc; + + bool nocase; + +#if defined(Q_DISABLE_COPY) + QextScintillaLexerCPP(const QextScintillaLexerCPP &); + QextScintillaLexerCPP &operator=(const QextScintillaLexerCPP &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexercsharp.cpp b/qt/qextscintillalexercsharp.cpp new file mode 100644 index 0000000..7a8a21c --- /dev/null +++ b/qt/qextscintillalexercsharp.cpp @@ -0,0 +1,118 @@ +// This module implements the QextScintillaLexerCSharp class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> + +#include "qextscintillalexercsharp.h" + + +// The ctor. +QextScintillaLexerCSharp::QextScintillaLexerCSharp(QObject *parent,const char *name) + : QextScintillaLexerCPP(parent,name) +{ +} + + +// The dtor. +QextScintillaLexerCSharp::~QextScintillaLexerCSharp() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerCSharp::language() const +{ + return "C#"; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerCSharp::color(int style) const +{ + if (style == VerbatimString) + return QColor(0x00,0x7f,0x00); + + return QextScintillaLexerCPP::color(style); +} + + +// Returns the end-of-line fill for a style. +bool QextScintillaLexerCSharp::eolFill(int style) const +{ + if (style == VerbatimString) + return TRUE; + + return QextScintillaLexerCPP::eolFill(style); +} + + +// Returns the font of the text for a style. +QFont QextScintillaLexerCSharp::font(int style) const +{ + if (style == VerbatimString) +#if defined(Q_OS_WIN) + return QFont("Courier New",10); +#else + return QFont("Bitstream Vera Sans Mono",9); +#endif + + return QextScintillaLexerCPP::font(style); +} + + +// Returns the set of keywords. +const char *QextScintillaLexerCSharp::keywords(int set) const +{ + if (set != 1) + return 0; + + return "abstract as base bool break byte case catch char checked " + "class const continue decimal default delegate do double else " + "enum event explicit extern false finally fixed float for " + "foreach goto if implicit in int interface internal is lock " + "long namespace new null object operator out override params " + "private protected public readonly ref return sbyte sealed " + "short sizeof stackalloc static string struct switch this " + "throw true try typeof uint ulong unchecked unsafe ushort " + "using virtual void while"; +} + + +// Returns the user name of a style. +QString QextScintillaLexerCSharp::description(int style) const +{ + if (style == VerbatimString) + return tr("Verbatim string"); + + return QextScintillaLexerCPP::description(style); +} + + +// Returns the background colour of the text for a style. +QColor QextScintillaLexerCSharp::paper(int style) const +{ + if (style == VerbatimString) + return QColor(0xe0,0xff,0xe0); + + return QextScintillaLexer::paper(style); +} diff --git a/qt/qextscintillalexercsharp.h b/qt/qextscintillalexercsharp.h new file mode 100644 index 0000000..97224e1 --- /dev/null +++ b/qt/qextscintillalexercsharp.h @@ -0,0 +1,84 @@ +// This defines the interface to the QextScintillaLexerCSharp class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERCSHARP_H +#define QEXTSCINTILLALEXERCSHARP_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexercpp.h> + + +//! \brief The QextScintillaLexerCSharp class encapsulates the Scintilla C# +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerCSharp : public QextScintillaLexerCPP +{ + Q_OBJECT + +public: + //! Construct a QextScintillaLexerCSharp with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerCSharp(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerCSharp instance. + virtual ~QextScintillaLexerCSharp(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool eolFill(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa color() + QColor paper(int style) const; + +private: +#if defined(Q_DISABLE_COPY) + QextScintillaLexerCSharp(const QextScintillaLexerCSharp &); + QextScintillaLexerCSharp &operator=(const QextScintillaLexerCSharp &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexercss.cpp b/qt/qextscintillalexercss.cpp new file mode 100644 index 0000000..f2e57d9 --- /dev/null +++ b/qt/qextscintillalexercss.cpp @@ -0,0 +1,376 @@ +// This module implements the QextScintillaLexerCSS class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexercss.h" + + +// The ctor. +QextScintillaLexerCSS::QextScintillaLexerCSS(QObject *parent,const char *name) + : QextScintillaLexer(parent,name), fold_comments(FALSE), + fold_compact(TRUE) +{ +} + + +// The dtor. +QextScintillaLexerCSS::~QextScintillaLexerCSS() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerCSS::language() const +{ + return "CSS"; +} + + +// Returns the lexer name. +const char *QextScintillaLexerCSS::lexer() const +{ + return "css"; +} + + +// Return the list of characters that can start a block. +const char *QextScintillaLexerCSS::blockStart(int *style) const +{ + if (style) + *style = Operator; + + return "{"; +} + + +// Return the list of characters that can end a block. +const char *QextScintillaLexerCSS::blockEnd(int *style) const +{ + if (style) + *style = Operator; + + return "}"; +} + + +// Return the string of characters that comprise a word. +const char *QextScintillaLexerCSS::wordCharacters() const +{ + return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-"; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerCSS::color(int style) const +{ + switch (style) + { + case Default: + return QColor(0xff,0x00,0x80); + + case Tag: + return QColor(0x00,0x00,0x7f); + + case PseudoClass: + case Attribute: + return QColor(0x80,0x00,0x00); + + case UnknownPseudoClass: + case UnknownProperty: + return QColor(0xff,0x00,0x00); + + case Operator: + return QColor(0x00,0x00,0x00); + + case CSS1Property: + return QColor(0x00,0x40,0xe0); + + case Value: + case DoubleQuotedString: + case SingleQuotedString: + return QColor(0x7f,0x00,0x7f); + + case Comment: + return QColor(0x00,0x7f,0x00); + + case IDSelector: + return QColor(0x00,0x7f,0x7f); + + case Important: + return QColor(0xff,0x80,0x00); + + case AtRule: + return QColor(0x7f,0x7f,0x00); + + case CSS2Property: + return QColor(0x00,0xa0,0xe0); + } + + return QextScintillaLexer::color(style); +} + + +// Returns the font of the text for a style. +QFont QextScintillaLexerCSS::font(int style) const +{ + QFont f; + + if (style == Comment) +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + else + { + f = QextScintillaLexer::font(style); + + switch (style) + { + case Tag: + case Important: + case AtRule: + f.setBold(TRUE); + break; + + case IDSelector: + f.setItalic(TRUE); + break; + } + } + + return f; +} + + +// Returns the set of keywords. +const char *QextScintillaLexerCSS::keywords(int set) const +{ + if (set == 1) + return + "color background-color background-image " + "background-repeat background-attachment " + "background-position background font-family " + "font-style font-variant font-weight font-size font " + "word-spacing letter-spacing text-decoration " + "vertical-align text-transform text-align " + "text-indent line-height margin-top margin-right " + "margin-bottom margin-left margin padding-top " + "padding-right padding-bottom padding-left padding " + "border-top-width border-right-width " + "border-bottom-width border-left-width border-width " + "border-top border-right border-bottom border-left " + "border border-color border-style width height float " + "clear display white-space list-style-type " + "list-style-image list-style-position list-style"; + + if (set == 2) + return + "first-letter first-line link active visited " + "first-child focus hover lang before after left " + "right first"; + + if (set == 3) + return + "border-top-color border-right-color " + "border-bottom-color border-left-color border-color " + "border-top-style border-right-style " + "border-bottom-style border-left-style border-style " + "top right bottom left position z-index direction " + "unicode-bidi min-width max-width min-height " + "max-height overflow clip visibility content quotes " + "counter-reset counter-increment marker-offset size " + "marks page-break-before page-break-after " + "page-break-inside page orphans widows font-stretch " + "font-size-adjust unicode-range units-per-em src " + "panose-1 stemv stemh slope cap-height x-height " + "ascent descent widths bbox definition-src baseline " + "centerline mathline topline text-shadow " + "caption-side table-layout border-collapse " + "border-spacing empty-cells speak-header cursor " + "outline outline-width outline-style outline-color " + "volume speak pause-before pause-after pause " + "cue-before cue-after cue play-during azimuth " + "elevation speech-rate voice-family pitch " + "pitch-range stress richness speak-punctuation " + "speak-numeral"; + + return 0; +} + + +// Returns the user name of a style. +QString QextScintillaLexerCSS::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Tag: + return tr("Tag"); + + case ClassSelector: + return tr("Class selector"); + + case PseudoClass: + return tr("Pseudo-class"); + + case UnknownPseudoClass: + return tr("Unknown pseudo-class"); + + case Operator: + return tr("Operator"); + + case CSS1Property: + return tr("CSS1 property"); + + case UnknownProperty: + return tr("Unknown property"); + + case Value: + return tr("Value"); + + case IDSelector: + return tr("ID selector"); + + case Important: + return tr("Important"); + + case AtRule: + return tr("@-rule"); + + case DoubleQuotedString: + return tr("Double-quoted string"); + + case SingleQuotedString: + return tr("Single-quoted string"); + + case CSS2Property: + return tr("CSS2 property"); + + case Attribute: + return tr("Attribute"); + } + + return QString::null; +} + + +// Refresh all properties. +void QextScintillaLexerCSS::refreshProperties() +{ + setCommentProp(); + setCompactProp(); +} + + +// Read properties from the settings. +bool QextScintillaLexerCSS::readProperties(QSettings &qs,const QString &prefix) +{ + int rc = TRUE; + bool ok, flag; + + // Read the fold comments flag. + flag = qs.readBoolEntry(prefix + "foldcomments",FALSE,&ok); + + if (ok) + fold_comments = flag; + else + rc = FALSE; + + // Read the fold compact flag. + flag = qs.readBoolEntry(prefix + "foldcompact",TRUE,&ok); + + if (ok) + fold_compact = flag; + else + rc = FALSE; + + return rc; +} + + +// Write properties to the settings. +bool QextScintillaLexerCSS::writeProperties(QSettings &qs,const QString &prefix) const +{ + int rc = TRUE; + + // Write the fold comments flag. + if (!qs.writeEntry(prefix + "foldcomments",fold_comments)) + rc = FALSE; + + // Write the fold compact flag. + if (!qs.writeEntry(prefix + "foldcompact",fold_compact)) + rc = FALSE; + + return rc; +} + + +// Return TRUE if comments can be folded. +bool QextScintillaLexerCSS::foldComments() const +{ + return fold_comments; +} + + +// Set if comments can be folded. +void QextScintillaLexerCSS::setFoldComments(bool fold) +{ + fold_comments = fold; + + setCommentProp(); +} + + +// Set the "fold.comment" property. +void QextScintillaLexerCSS::setCommentProp() +{ + emit propertyChanged("fold.comment",(fold_comments ? "1" : "0")); +} + + +// Return TRUE if folds are compact. +bool QextScintillaLexerCSS::foldCompact() const +{ + return fold_compact; +} + + +// Set if folds are compact +void QextScintillaLexerCSS::setFoldCompact(bool fold) +{ + fold_compact = fold; + + setCompactProp(); +} + + +// Set the "fold.compact" property. +void QextScintillaLexerCSS::setCompactProp() +{ + emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); +} diff --git a/qt/qextscintillalexercss.h b/qt/qextscintillalexercss.h new file mode 100644 index 0000000..ff91cce --- /dev/null +++ b/qt/qextscintillalexercss.h @@ -0,0 +1,193 @@ +// This defines the interface to the QextScintillaLexerCSS class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERCSS_H +#define QEXTSCINTILLALEXERCSS_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerCSS class encapsulates the Scintilla CSS +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerCSS : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! CSS lexer. + enum { + //! The default. + Default = 0, + + //! A tag. + Tag = 1, + + //! A class selector. + ClassSelector = 2, + + //! A pseudo-class. + PseudoClass = 3, + + //! An pseudo-class. + UnknownPseudoClass = 4, + + //! An operator. + Operator = 5, + + //! A CSS1 property. + CSS1Property = 6, + + //! An unknown property. + UnknownProperty = 7, + + //! A value. + Value = 8, + + //! A comment. + Comment = 9, + + //! An ID selector. + IDSelector = 10, + + //! An important value. + Important = 11, + + //! An @-rule. + AtRule = 12, + + //! A double-quoted string. + DoubleQuotedString = 13, + + //! A single-quoted string. + SingleQuotedString = 14, + + //! A CSS2 property. + CSS2Property = 15, + + //! An attribute. + Attribute = 16 + }; + + //! Construct a QextScintillaLexerCSS with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerCSS(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerCSS instance. + virtual ~QextScintillaLexerCSS(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns a space separated list of words or characters in + //! a particular style that define the end of a block for + //! auto-indentation. The styles is returned via \a style. + const char *blockEnd(int *style = 0) const; + + //! \internal Returns a space separated list of words or characters in + //! a particular style that define the start of a block for + //! auto-indentation. The styles is returned via \a style. + const char *blockStart(int *style = 0) const; + + //! \internal Returns the string of characters that comprise a word. + const char *wordCharacters() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Causes all properties to be refreshed by emitting the + //! propertyChanged() signal as required. + void refreshProperties(); + + //! Returns TRUE if multi-line comment blocks can be folded. + //! + //! \sa setFoldComments() + bool foldComments() const; + + //! Returns TRUE if trailing blank lines are included in a fold block. + //! + //! \sa setFoldCompact() + bool foldCompact() const; + +public slots: + //! If \a fold is TRUE then multi-line comment blocks can be folded. + //! The default is FALSE. + //! + //! \sa foldComments() + virtual void setFoldComments(bool fold); + + //! If \a fold is TRUE then trailing blank lines are included in a fold + //! block. The default is TRUE. + //! + //! \sa foldCompact() + virtual void setFoldCompact(bool fold); + +protected: + //! The lexer's properties are read from the settings \a qs. \a prefix + //! (which has a trailing '/') should be used as a prefix to the key of + //! each setting. TRUE is returned if there is no error. + //! + bool readProperties(QSettings &qs,const QString &prefix); + + //! The lexer's properties are written to the settings \a qs. + //! \a prefix (which has a trailing '/') should be used as a prefix to + //! the key of each setting. TRUE is returned if there is no error. + //! + bool writeProperties(QSettings &qs,const QString &prefix) const; + +private: + void setCommentProp(); + void setCompactProp(); + + bool fold_comments; + bool fold_compact; + +#if defined(Q_DISABLE_COPY) + QextScintillaLexerCSS(const QextScintillaLexerCSS &); + QextScintillaLexerCSS &operator=(const QextScintillaLexerCSS &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexerdiff.cpp b/qt/qextscintillalexerdiff.cpp new file mode 100644 index 0000000..ea0e457 --- /dev/null +++ b/qt/qextscintillalexerdiff.cpp @@ -0,0 +1,123 @@ +// This module implements the QextScintillaLexerDiff class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexerdiff.h" + + +// The ctor. +QextScintillaLexerDiff::QextScintillaLexerDiff(QObject *parent,const char *name) + : QextScintillaLexer(parent,name) +{ +} + + +// The dtor. +QextScintillaLexerDiff::~QextScintillaLexerDiff() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerDiff::language() const +{ + return "Diff"; +} + + +// Returns the lexer name. +const char *QextScintillaLexerDiff::lexer() const +{ + return "diff"; +} + + +// Return the string of characters that comprise a word. +const char *QextScintillaLexerDiff::wordCharacters() const +{ + return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerDiff::color(int style) const +{ + switch (style) + { + case Default: + return QColor(0x00,0x00,0x00); + + case Comment: + return QColor(0x00,0x7f,0x00); + + case Command: + return QColor(0x7f,0x7f,0x00); + + case Header: + return QColor(0x7f,0x00,0x00); + + case Position: + return QColor(0x7f,0x00,0x7f); + + case LineRemoved: + return QColor(0x00,0x7f,0x7f); + + case LineAdded: + return QColor(0x00,0x00,0x7f); + } + + return QextScintillaLexer::color(style); +} + + +// Returns the user name of a style. +QString QextScintillaLexerDiff::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Comment: + return tr("Comment"); + + case Command: + return tr("Command"); + + case Header: + return tr("Header"); + + case Position: + return tr("Position"); + + case LineRemoved: + return tr("Removed line"); + + case LineAdded: + return tr("Added line"); + } + + return QString::null; +} diff --git a/qt/qextscintillalexerdiff.h b/qt/qextscintillalexerdiff.h new file mode 100644 index 0000000..9287a04 --- /dev/null +++ b/qt/qextscintillalexerdiff.h @@ -0,0 +1,100 @@ +// This defines the interface to the QextScintillaLexerDiff class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERDIFF_H +#define QEXTSCINTILLALEXERDIFF_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerDiff class encapsulates the Scintilla Diff +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerDiff : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! Diff lexer. + enum { + //! The default. + Default = 0, + + //! A comment. + Comment = 1, + + //! A command. + Command = 2, + + //! A header. + Header = 3, + + //! A position. + Position = 4, + + //! A removed line. + LineRemoved = 5, + + //! An added line. + LineAdded = 6 + }; + + //! Construct a QextScintillaLexerDiff with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerDiff(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerDiff instance. + virtual ~QextScintillaLexerDiff(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns the string of characters that comprise a word. + const char *wordCharacters() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + +private: +#if defined(Q_DISABLE_COPY) + QextScintillaLexerDiff(const QextScintillaLexerDiff &); + QextScintillaLexerDiff &operator=(const QextScintillaLexerDiff &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexerhtml.cpp b/qt/qextscintillalexerhtml.cpp new file mode 100644 index 0000000..100d47c --- /dev/null +++ b/qt/qextscintillalexerhtml.cpp @@ -0,0 +1,1132 @@ +// This module implements the QextScintillaLexerHTML class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexerhtml.h" +#include "qextscintillalexerjavascript.h" +#include "qextscintillalexerpython.h" + + +// The ctor. +QextScintillaLexerHTML::QextScintillaLexerHTML(QObject *parent, + const char *name) + : QextScintillaLexer(parent,name), fold_compact(TRUE), + fold_preproc(TRUE), case_sens_tags(FALSE) +{ +} + + +// The dtor. +QextScintillaLexerHTML::~QextScintillaLexerHTML() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerHTML::language() const +{ + return "HTML"; +} + + +// Returns the lexer name. +const char *QextScintillaLexerHTML::lexer() const +{ + return "hypertext"; +} + + +// Return the string of characters that comprise a word. +const char *QextScintillaLexerHTML::wordCharacters() const +{ + return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerHTML::color(int style) const +{ + switch (style) + { + case Default: + case JavaScriptDefault: + case JavaScriptWord: + case JavaScriptSymbol: + case ASPJavaScriptDefault: + case ASPJavaScriptWord: + case ASPJavaScriptSymbol: + case VBScriptDefault: + case ASPVBScriptDefault: + case PHPOperator: + return QColor(0x00,0x00,0x00); + + case Tag: + case XMLTagEnd: + case Script: + case SGMLDefault: + case SGMLCommand: + case VBScriptKeyword: + case VBScriptIdentifier: + case VBScriptUnclosedString: + case ASPVBScriptKeyword: + case ASPVBScriptIdentifier: + case ASPVBScriptUnclosedString: + return QColor(0x00,0x00,0x80); + + case UnknownTag: + case UnknownAttribute: + return QColor(0xff,0x00,0x00); + + case Attribute: + case VBScriptNumber: + case ASPVBScriptNumber: + return QColor(0x00,0x80,0x80); + + case HTMLNumber: + case JavaScriptNumber: + case ASPJavaScriptNumber: + case PythonNumber: + case PythonFunctionMethodName: + case ASPPythonNumber: + case ASPPythonFunctionMethodName: + return QColor(0x00,0x7f,0x7f); + + case HTMLDoubleQuotedString: + case HTMLSingleQuotedString: + case JavaScriptDoubleQuotedString: + case JavaScriptSingleQuotedString: + case ASPJavaScriptDoubleQuotedString: + case ASPJavaScriptSingleQuotedString: + case PythonDoubleQuotedString: + case PythonSingleQuotedString: + case ASPPythonDoubleQuotedString: + case ASPPythonSingleQuotedString: + case PHPKeyword: + return QColor(0x7f,0x00,0x7f); + + case OtherInTag: + case Entity: + case VBScriptString: + case ASPVBScriptString: + return QColor(0x80,0x00,0x80); + + case HTMLComment: + case SGMLComment: + return QColor(0x80,0x80,0x00); + + case XMLStart: + case XMLEnd: + case PHPStart: + case PythonClassName: + case ASPPythonClassName: + return QColor(0x00,0x00,0xff); + + case HTMLValue: + return QColor(0xff,0x00,0xff); + + case SGMLParameter: + return QColor(0x00,0x66,0x00); + + case SGMLDoubleQuotedString: + case SGMLError: + return QColor(0x80,0x00,0x00); + + case SGMLSingleQuotedString: + return QColor(0x99,0x33,0x00); + + case SGMLSpecial: + return QColor(0x33,0x66,0xff); + + case SGMLEntity: + return QColor(0x33,0x33,0x33); + + case SGMLBlockDefault: + return QColor(0x00,0x00,0x66); + + case JavaScriptStart: + case ASPJavaScriptStart: + return QColor(0x7f,0x7f,0x00); + + case JavaScriptComment: + case JavaScriptCommentLine: + case ASPJavaScriptComment: + case ASPJavaScriptCommentLine: + case PythonComment: + case ASPPythonComment: + case PHPDoubleQuotedString: + return QColor(0x00,0x7f,0x00); + + case JavaScriptCommentDoc: + return QColor(0x3f,0x70,0x3f); + + case JavaScriptKeyword: + case ASPJavaScriptKeyword: + case PythonKeyword: + case ASPPythonKeyword: + case PHPVariable: + case PHPDoubleQuotedVariable: + return QColor(0x00,0x00,0x7f); + + case ASPJavaScriptCommentDoc: + return QColor(0x7f,0x7f,0x7f); + + case VBScriptComment: + case ASPVBScriptComment: + return QColor(0x00,0x80,0x00); + + case PythonStart: + case PythonDefault: + case ASPPythonStart: + case ASPPythonDefault: + return QColor(0x80,0x80,0x80); + + case PythonTripleSingleQuotedString: + case PythonTripleDoubleQuotedString: + case ASPPythonTripleSingleQuotedString: + case ASPPythonTripleDoubleQuotedString: + return QColor(0x7f,0x00,0x00); + + case PHPDefault: + return QColor(0x00,0x00,0x33); + + case PHPSingleQuotedString: + return QColor(0x00,0x9f,0x00); + + case PHPNumber: + return QColor(0xcc,0x99,0x00); + + case PHPComment: + return QColor(0x99,0x99,0x99); + + case PHPCommentLine: + return QColor(0x66,0x66,0x66); + } + + return QextScintillaLexer::color(style); +} + + +// Returns the end-of-line fill for a style. +bool QextScintillaLexerHTML::eolFill(int style) const +{ + switch (style) + { + case JavaScriptDefault: + case JavaScriptComment: + case JavaScriptCommentDoc: + case JavaScriptUnclosedString: + case ASPJavaScriptDefault: + case ASPJavaScriptComment: + case ASPJavaScriptCommentDoc: + case ASPJavaScriptUnclosedString: + case VBScriptDefault: + case VBScriptComment: + case VBScriptNumber: + case VBScriptKeyword: + case VBScriptString: + case VBScriptIdentifier: + case VBScriptUnclosedString: + case ASPVBScriptDefault: + case ASPVBScriptComment: + case ASPVBScriptNumber: + case ASPVBScriptKeyword: + case ASPVBScriptString: + case ASPVBScriptIdentifier: + case ASPVBScriptUnclosedString: + case PythonDefault: + case PythonComment: + case PythonNumber: + case PythonDoubleQuotedString: + case PythonSingleQuotedString: + case PythonKeyword: + case PythonTripleSingleQuotedString: + case PythonTripleDoubleQuotedString: + case PythonClassName: + case PythonFunctionMethodName: + case PythonOperator: + case PythonIdentifier: + case ASPPythonDefault: + case ASPPythonComment: + case ASPPythonNumber: + case ASPPythonDoubleQuotedString: + case ASPPythonSingleQuotedString: + case ASPPythonKeyword: + case ASPPythonTripleSingleQuotedString: + case ASPPythonTripleDoubleQuotedString: + case ASPPythonClassName: + case ASPPythonFunctionMethodName: + case ASPPythonOperator: + case ASPPythonIdentifier: + case PHPDefault: + return TRUE; + } + + return QextScintillaLexer::eolFill(style); +} + + +// Returns the font of the text for a style. +QFont QextScintillaLexerHTML::font(int style) const +{ + QFont f; + + switch (style) + { + case Default: + case Entity: +#if defined(Q_OS_WIN) + f = QFont("Times New Roman",11); +#else + f = QFont("Bitstream Charter",10); +#endif + break; + + case HTMLComment: +#if defined(Q_OS_WIN) + f = QFont("Verdana",9); +#else + f = QFont("Bitstream Vera Sans",8); +#endif + break; + + case SGMLCommand: + case PythonKeyword: + case PythonClassName: + case PythonFunctionMethodName: + case PythonOperator: + case ASPPythonKeyword: + case ASPPythonClassName: + case ASPPythonFunctionMethodName: + case ASPPythonOperator: + f = QextScintillaLexer::font(style); + f.setBold(TRUE); + break; + + case JavaScriptDefault: + case JavaScriptCommentDoc: + case JavaScriptKeyword: + case JavaScriptSymbol: + case ASPJavaScriptDefault: + case ASPJavaScriptCommentDoc: + case ASPJavaScriptKeyword: + case ASPJavaScriptSymbol: +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + f.setBold(TRUE); + break; + + case JavaScriptComment: + case JavaScriptCommentLine: + case JavaScriptNumber: + case JavaScriptWord: + case JavaScriptDoubleQuotedString: + case JavaScriptSingleQuotedString: + case ASPJavaScriptComment: + case ASPJavaScriptCommentLine: + case ASPJavaScriptNumber: + case ASPJavaScriptWord: + case ASPJavaScriptDoubleQuotedString: + case ASPJavaScriptSingleQuotedString: + case VBScriptComment: + case ASPVBScriptComment: + case PythonComment: + case ASPPythonComment: + case PHPComment: +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + break; + + case VBScriptDefault: + case VBScriptNumber: + case VBScriptString: + case VBScriptIdentifier: + case VBScriptUnclosedString: + case ASPVBScriptDefault: + case ASPVBScriptNumber: + case ASPVBScriptString: + case ASPVBScriptIdentifier: + case ASPVBScriptUnclosedString: +#if defined(Q_OS_WIN) + f = QFont("Lucida Sans Unicode",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + break; + + case VBScriptKeyword: + case ASPVBScriptKeyword: +#if defined(Q_OS_WIN) + f = QFont("Lucida Sans Unicode",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + f.setBold(TRUE); + break; + + case PythonDoubleQuotedString: + case PythonSingleQuotedString: + case ASPPythonDoubleQuotedString: + case ASPPythonSingleQuotedString: +#if defined(Q_OS_WIN) + f = QFont("Courier New",10); +#else + f = QFont("Bitstream Vera Sans Mono",9); +#endif + break; + + case PHPKeyword: + case PHPVariable: + case PHPDoubleQuotedVariable: + f = QextScintillaLexer::font(style); + f.setItalic(TRUE); + break; + + case PHPCommentLine: +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + f.setItalic(TRUE); + break; + + default: + f = QextScintillaLexer::font(style); + } + + return f; +} + + +// Returns the set of keywords. +const char *QextScintillaLexerHTML::keywords(int set) const +{ + if (set == 1) + return + "a abbr acronym address applet area " + "b base basefont bdo big blockquote body br button " + "caption center cite code col colgroup " + "dd del dfn dir div dl dt " + "em " + "fieldset font form frame frameset " + "h1 h2 h3 h4 h5 h6 head hr html " + "i iframe img input ins isindex " + "kbd " + "label legend li link " + "map menu meta " + "noframes noscript " + "object ol optgroup option " + "p param pre " + "q " + "s samp script select small span strike strong style " + "sub sup " + "table tbody td textarea tfoot th thead title tr tt " + "u ul " + "var " + "xml xmlns " + "abbr accept-charset accept accesskey action align " + "alink alt archive axis " + "background bgcolor border " + "cellpadding cellspacing char charoff charset checked " + "cite class classid clear codebase codetype color " + "cols colspan compact content coords " + "data datafld dataformatas datapagesize datasrc " + "datetime declare defer dir disabled " + "enctype event " + "face for frame frameborder " + "headers height href hreflang hspace http-equiv " + "id ismap label lang language leftmargin link " + "longdesc " + "marginwidth marginheight maxlength media method " + "multiple " + "name nohref noresize noshade nowrap " + "object onblur onchange onclick ondblclick onfocus " + "onkeydown onkeypress onkeyup onload onmousedown " + "onmousemove onmouseover onmouseout onmouseup onreset " + "onselect onsubmit onunload " + "profile prompt " + "readonly rel rev rows rowspan rules " + "scheme scope selected shape size span src standby " + "start style summary " + "tabindex target text title topmargin type " + "usemap " + "valign value valuetype version vlink vspace " + "width " + "text password checkbox radio submit reset file " + "hidden image " + "public !doctype"; + + if (set == 2) + return QextScintillaLexerJavaScript::keywordClass; + + if (set == 3) + return + // Move these to QextScintillaLexerVisualBasic when we + // get round to implementing it. + "and begin case call continue do each else elseif end " + "erase error event exit false for function get gosub " + "goto if implement in load loop lset me mid new next " + "not nothing on or property raiseevent rem resume " + "return rset select set stop sub then to true unload " + "until wend while with withevents attribute alias as " + "boolean byref byte byval const compare currency date " + "declare dim double enum explicit friend global " + "integer let lib long module object option optional " + "preserve private property public redim single static " + "string type variant"; + + if (set == 4) + return QextScintillaLexerPython::keywordClass; + + if (set == 5) + return + "and argv as argc break case cfunction class continue " + "declare default do die " + "echo else elseif empty enddeclare endfor endforeach " + "endif endswitch endwhile e_all e_parse e_error " + "e_warning eval exit extends " + "false for foreach function global " + "http_cookie_vars http_get_vars http_post_vars " + "http_post_files http_env_vars http_server_vars " + "if include include_once list new not null " + "old_function or " + "parent php_os php_self php_version print " + "require require_once return " + "static switch stdclass this true var xor virtual " + "while " + "__file__ __line__ __sleep __wakeup"; + + if (set == 6) + return "ELEMENT DOCTYPE ATTLIST ENTITY NOTATION"; + + return 0; +} + + +// Returns the user name of a style. +QString QextScintillaLexerHTML::description(int style) const +{ + switch (style) + { + case Default: + return tr("HTML default"); + + case Tag: + return tr("Tag"); + + case UnknownTag: + return tr("Unknown tag"); + + case Attribute: + return tr("Attribute"); + + case UnknownAttribute: + return tr("Unknown attribute"); + + case HTMLNumber: + return tr("HTML number"); + + case HTMLDoubleQuotedString: + return tr("HTML double-quoted string"); + + case HTMLSingleQuotedString: + return tr("HTML single-quoted string"); + + case OtherInTag: + return tr("Other text in a tag"); + + case HTMLComment: + return tr("HTML comment"); + + case Entity: + return tr("Entity"); + + case XMLTagEnd: + return tr("End of a tag"); + + case XMLStart: + return tr("Start of an XML fragment"); + + case XMLEnd: + return tr("End of an XML fragment"); + + case Script: + return tr("Script tag"); + + case ASPAtStart: + return tr("Start of an ASP fragment with @"); + + case ASPStart: + return tr("Start of an ASP fragment"); + + case CDATA: + return tr("CDATA"); + + case PHPStart: + return tr("Start of a PHP fragment"); + + case HTMLValue: + return tr("Unquoted HTML value"); + + case ASPXCComment: + return tr("ASP X-Code comment"); + + case SGMLDefault: + return tr("SGML default"); + + case SGMLCommand: + return tr("SGML command"); + + case SGMLParameter: + return tr("First parameter of an SGML command"); + + case SGMLDoubleQuotedString: + return tr("SGML double-quoted string"); + + case SGMLSingleQuotedString: + return tr("SGML single-quoted string"); + + case SGMLError: + return tr("SGML error"); + + case SGMLSpecial: + return tr("SGML special entity"); + + case SGMLComment: + return tr("SGML comment"); + + case SGMLParameterComment: + return tr("First parameter comment of an SGML command"); + + case SGMLBlockDefault: + return tr("SGML block default"); + + case JavaScriptStart: + return tr("Start of a JavaScript fragment"); + + case JavaScriptDefault: + return tr("JavaScript default"); + + case JavaScriptComment: + return tr("JavaScript comment"); + + case JavaScriptCommentLine: + return tr("JavaScript line comment"); + + case JavaScriptCommentDoc: + return tr("JavaDoc style JavaScript comment"); + + case JavaScriptNumber: + return tr("JavaScript number"); + + case JavaScriptWord: + return tr("JavaScript word"); + + case JavaScriptKeyword: + return tr("JavaScript keyword"); + + case JavaScriptDoubleQuotedString: + return tr("JavaScript double-quoted string"); + + case JavaScriptSingleQuotedString: + return tr("JavaScript single-quoted string"); + + case JavaScriptSymbol: + return tr("JavaScript symbol"); + + case JavaScriptUnclosedString: + return tr("JavaScript unclosed string"); + + case JavaScriptRegex: + return tr("JavaScript regular expression"); + + case ASPJavaScriptStart: + return tr("Start of an ASP JavaScript fragment"); + + case ASPJavaScriptDefault: + return tr("ASP JavaScript default"); + + case ASPJavaScriptComment: + return tr("ASP JavaScript comment"); + + case ASPJavaScriptCommentLine: + return tr("ASP JavaScript line comment"); + + case ASPJavaScriptCommentDoc: + return tr("JavaDoc style ASP JavaScript comment"); + + case ASPJavaScriptNumber: + return tr("ASP JavaScript number"); + + case ASPJavaScriptWord: + return tr("ASP JavaScript word"); + + case ASPJavaScriptKeyword: + return tr("ASP JavaScript keyword"); + + case ASPJavaScriptDoubleQuotedString: + return tr("ASP JavaScript double-quoted string"); + + case ASPJavaScriptSingleQuotedString: + return tr("ASP JavaScript single-quoted string"); + + case ASPJavaScriptSymbol: + return tr("ASP JavaScript symbol"); + + case ASPJavaScriptUnclosedString: + return tr("ASP JavaScript unclosed string"); + + case ASPJavaScriptRegex: + return tr("ASP JavaScript regular expression"); + + case VBScriptStart: + return tr("Start of a VBScript fragment"); + + case VBScriptDefault: + return tr("VBScript default"); + + case VBScriptComment: + return tr("VBScript comment"); + + case VBScriptNumber: + return tr("VBScript number"); + + case VBScriptKeyword: + return tr("VBScript keyword"); + + case VBScriptString: + return tr("VBScript string"); + + case VBScriptIdentifier: + return tr("VBScript identifier"); + + case VBScriptUnclosedString: + return tr("VBScript unclosed string"); + + case ASPVBScriptStart: + return tr("Start of an ASP VBScript fragment"); + + case ASPVBScriptDefault: + return tr("ASP VBScript default"); + + case ASPVBScriptComment: + return tr("ASP VBScript comment"); + + case ASPVBScriptNumber: + return tr("ASP VBScript number"); + + case ASPVBScriptKeyword: + return tr("ASP VBScript keyword"); + + case ASPVBScriptString: + return tr("ASP VBScript string"); + + case ASPVBScriptIdentifier: + return tr("ASP VBScript identifier"); + + case ASPVBScriptUnclosedString: + return tr("ASP VBScript unclosed string"); + + case PythonStart: + return tr("Start of a Python fragment"); + + case PythonDefault: + return tr("Python default"); + + case PythonComment: + return tr("Python comment"); + + case PythonNumber: + return tr("Python number"); + + case PythonDoubleQuotedString: + return tr("Python double-quoted string"); + + case PythonSingleQuotedString: + return tr("Python single-quoted string"); + + case PythonKeyword: + return tr("Python keyword"); + + case PythonTripleDoubleQuotedString: + return tr("Python triple double-quoted string"); + + case PythonTripleSingleQuotedString: + return tr("Python triple single-quoted string"); + + case PythonClassName: + return tr("Python class name"); + + case PythonFunctionMethodName: + return tr("Python function or method name"); + + case PythonOperator: + return tr("Python operator"); + + case PythonIdentifier: + return tr("Python identifier"); + + case ASPPythonStart: + return tr("Start of an ASP Python fragment"); + + case ASPPythonDefault: + return tr("ASP Python default"); + + case ASPPythonComment: + return tr("ASP Python comment"); + + case ASPPythonNumber: + return tr("ASP Python number"); + + case ASPPythonDoubleQuotedString: + return tr("ASP Python double-quoted string"); + + case ASPPythonSingleQuotedString: + return tr("ASP Python single-quoted string"); + + case ASPPythonKeyword: + return tr("ASP Python keyword"); + + case ASPPythonTripleDoubleQuotedString: + return tr("ASP Python triple double-quoted string"); + + case ASPPythonTripleSingleQuotedString: + return tr("ASP Python triple single-quoted string"); + + case ASPPythonClassName: + return tr("ASP Python class name"); + + case ASPPythonFunctionMethodName: + return tr("ASP Python function or method name"); + + case ASPPythonOperator: + return tr("ASP Python operator"); + + case ASPPythonIdentifier: + return tr("ASP Python identifier"); + + case PHPDefault: + return tr("PHP default"); + + case PHPDoubleQuotedString: + return tr("PHP double-quoted string"); + + case PHPSingleQuotedString: + return tr("PHP single-quoted string"); + + case PHPKeyword: + return tr("PHP keyword"); + + case PHPNumber: + return tr("PHP number"); + + case PHPVariable: + return tr("PHP variable"); + + case PHPComment: + return tr("PHP comment"); + + case PHPCommentLine: + return tr("PHP line comment"); + + case PHPDoubleQuotedVariable: + return tr("PHP double-quoted variable"); + + case PHPOperator: + return tr("PHP operator"); + } + + return QString::null; +} + + +// Returns the background colour of the text for a style. +QColor QextScintillaLexerHTML::paper(int style) const +{ + switch (style) + { + case ASPAtStart: + return QColor(0xff,0xff,0x00); + + case ASPStart: + case CDATA: + return QColor(0xff,0xdf,0x00); + + case PHPStart: + return QColor(0xff,0xef,0xbf); + + case HTMLValue: + return QColor(0xff,0xef,0xff); + + case SGMLDefault: + case SGMLCommand: + case SGMLParameter: + case SGMLDoubleQuotedString: + case SGMLSingleQuotedString: + case SGMLSpecial: + case SGMLEntity: + case SGMLComment: + return QColor(0xef,0xef,0xff); + + case SGMLError: + return QColor(0xff,0x66,0x66); + + case SGMLBlockDefault: + return QColor(0xcc,0xcc,0xe0); + + case JavaScriptDefault: + case JavaScriptComment: + case JavaScriptCommentLine: + case JavaScriptCommentDoc: + case JavaScriptNumber: + case JavaScriptWord: + case JavaScriptKeyword: + case JavaScriptDoubleQuotedString: + case JavaScriptSingleQuotedString: + case JavaScriptSymbol: + return QColor(0xf0,0xf0,0xff); + + case JavaScriptUnclosedString: + case ASPJavaScriptUnclosedString: + return QColor(0xbf,0xbb,0xb0); + + case JavaScriptRegex: + case ASPJavaScriptRegex: + return QColor(0xff,0xbb,0xb0); + + case ASPJavaScriptDefault: + case ASPJavaScriptComment: + case ASPJavaScriptCommentLine: + case ASPJavaScriptCommentDoc: + case ASPJavaScriptNumber: + case ASPJavaScriptWord: + case ASPJavaScriptKeyword: + case ASPJavaScriptDoubleQuotedString: + case ASPJavaScriptSingleQuotedString: + case ASPJavaScriptSymbol: + return QColor(0xdf,0xdf,0x7f); + + case VBScriptDefault: + case VBScriptComment: + case VBScriptNumber: + case VBScriptKeyword: + case VBScriptString: + case VBScriptIdentifier: + return QColor(0xef,0xef,0xff); + + case VBScriptUnclosedString: + case ASPVBScriptUnclosedString: + return QColor(0x7f,0x7f,0xff); + + case ASPVBScriptDefault: + case ASPVBScriptComment: + case ASPVBScriptNumber: + case ASPVBScriptKeyword: + case ASPVBScriptString: + case ASPVBScriptIdentifier: + return QColor(0xcf,0xcf,0xef); + + case PythonDefault: + case PythonComment: + case PythonNumber: + case PythonDoubleQuotedString: + case PythonSingleQuotedString: + case PythonKeyword: + case PythonTripleSingleQuotedString: + case PythonTripleDoubleQuotedString: + case PythonClassName: + case PythonFunctionMethodName: + case PythonOperator: + case PythonIdentifier: + return QColor(0xef,0xff,0xef); + + case ASPPythonDefault: + case ASPPythonComment: + case ASPPythonNumber: + case ASPPythonDoubleQuotedString: + case ASPPythonSingleQuotedString: + case ASPPythonKeyword: + case ASPPythonTripleSingleQuotedString: + case ASPPythonTripleDoubleQuotedString: + case ASPPythonClassName: + case ASPPythonFunctionMethodName: + case ASPPythonOperator: + case ASPPythonIdentifier: + return QColor(0xcf,0xef,0xcf); + + case PHPDefault: + case PHPDoubleQuotedString: + case PHPSingleQuotedString: + case PHPKeyword: + case PHPNumber: + case PHPVariable: + case PHPComment: + case PHPCommentLine: + case PHPDoubleQuotedVariable: + case PHPOperator: + return QColor(0xff,0xf8,0xf8); + } + + return QextScintillaLexer::paper(style); +} + + +// Refresh all properties. +void QextScintillaLexerHTML::refreshProperties() +{ + setCompactProp(); + setPreprocProp(); + setCaseSensTagsProp(); +} + + +// Read properties from the settings. +bool QextScintillaLexerHTML::readProperties(QSettings &qs,const QString &prefix) +{ + int rc = TRUE; + bool ok, flag; + + // Read the fold compact flag. + flag = qs.readBoolEntry(prefix + "foldcompact",TRUE,&ok); + + if (ok) + fold_compact = flag; + else + rc = FALSE; + + // Read the fold preprocessor flag. + flag = qs.readBoolEntry(prefix + "foldpreprocessor",FALSE,&ok); + + if (ok) + fold_preproc = flag; + else + rc = FALSE; + + // Read the case sensitive tags flag. + flag = qs.readBoolEntry(prefix + "casesensitivetags",FALSE,&ok); + + if (ok) + case_sens_tags = flag; + else + rc = FALSE; + + return rc; +} + + +// Write properties to the settings. +bool QextScintillaLexerHTML::writeProperties(QSettings &qs,const QString &prefix) const +{ + int rc = TRUE; + + // Write the fold compact flag. + if (!qs.writeEntry(prefix + "foldcompact",fold_compact)) + rc = FALSE; + + // Write the fold preprocessor flag. + if (!qs.writeEntry(prefix + "foldpreprocessor",fold_preproc)) + rc = FALSE; + + // Write the case sensitive tags flag. + if (!qs.writeEntry(prefix + "casesensitivetags",case_sens_tags)) + rc = FALSE; + + return rc; +} + + +// Return TRUE if tags are case sensitive. +bool QextScintillaLexerHTML::caseSensitiveTags() const +{ + return case_sens_tags; +} + + +// Set if tags are case sensitive. +void QextScintillaLexerHTML::setCaseSensitiveTags(bool sens) +{ + case_sens_tags = sens; + + setCaseSensTagsProp(); +} + + +// Set the "html.tags.case.sensitive" property. +void QextScintillaLexerHTML::setCaseSensTagsProp() +{ + emit propertyChanged("html.tags.case.sensitive",(case_sens_tags ? "1" : "0")); +} + + +// Return TRUE if folds are compact. +bool QextScintillaLexerHTML::foldCompact() const +{ + return fold_compact; +} + + +// Set if folds are compact +void QextScintillaLexerHTML::setFoldCompact(bool fold) +{ + fold_compact = fold; + + setCompactProp(); +} + + +// Set the "fold.compact" property. +void QextScintillaLexerHTML::setCompactProp() +{ + emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); +} + + +// Return TRUE if preprocessor blocks can be folded. +bool QextScintillaLexerHTML::foldPreprocessor() const +{ + return fold_preproc; +} + + +// Set if preprocessor blocks can be folded. +void QextScintillaLexerHTML::setFoldPreprocessor(bool fold) +{ + fold_preproc = fold; + + setPreprocProp(); +} + + +// Set the "fold.preprocessor" property. +void QextScintillaLexerHTML::setPreprocProp() +{ + emit propertyChanged("fold.html.preprocessor",(fold_preproc ? "1" : "0")); +} diff --git a/qt/qextscintillalexerhtml.h b/qt/qextscintillalexerhtml.h new file mode 100644 index 0000000..1a71fe9 --- /dev/null +++ b/qt/qextscintillalexerhtml.h @@ -0,0 +1,486 @@ +// This defines the interface to the QextScintillaLexerHTML class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERHTML_H +#define QEXTSCINTILLALEXERHTML_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerHTML class encapsulates the Scintilla HTML +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerHTML : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! HTML lexer. + enum { + //! The default. + Default = 0, + + //! A tag. + Tag = 1, + + //! An unknown tag. + UnknownTag = 2, + + //! An attribute. + Attribute = 3, + + //! An unknown attribute. + UnknownAttribute = 4, + + //! An HTML number. + HTMLNumber = 5, + + //! An HTML double-quoted string. + HTMLDoubleQuotedString = 6, + + //! An HTML single-quoted string. + HTMLSingleQuotedString = 7, + + //! Other text within a tag. + OtherInTag = 8, + + //! An HTML comment. + HTMLComment = 9, + + //! An entity. + Entity = 10, + + //! The end of an XML style tag. + XMLTagEnd = 11, + + //! The start of an XML fragment. + XMLStart = 12, + + //! The end of an XML fragment. + XMLEnd = 13, + + //! A script tag. + Script = 14, + + //! The start of an ASP fragment with @. + ASPAtStart = 15, + + //! The start of an ASP fragment. + ASPStart = 16, + + //! CDATA. + CDATA = 17, + + //! The start of a PHP fragment. + PHPStart = 18, + + //! An unquoted HTML value. + HTMLValue = 19, + + //! An ASP X-Code comment. + ASPXCComment = 20, + + //! The default for SGML. + SGMLDefault = 21, + + //! An SGML command. + SGMLCommand = 22, + + //! The first parameter of an SGML command. + SGMLParameter = 23, + + //! An SGML double-quoted string. + SGMLDoubleQuotedString = 24, + + //! An SGML single-quoted string. + SGMLSingleQuotedString = 25, + + //! An SGML error. + SGMLError = 26, + + //! An SGML special entity. + SGMLSpecial = 27, + + //! An SGML entity. + SGMLEntity = 28, + + //! An SGML comment. + SGMLComment = 29, + + //! A comment with the first parameter of an SGML command. + SGMLParameterComment = 30, + + //! The default for an SGML block. + SGMLBlockDefault = 31, + + //! The start of a JavaScript fragment. + JavaScriptStart = 40, + + //! The default for JavaScript. + JavaScriptDefault = 41, + + //! A JavaScript comment. + JavaScriptComment = 42, + + //! A JavaScript line comment. + JavaScriptCommentLine = 43, + + //! A JavaDoc style JavaScript comment. + JavaScriptCommentDoc = 44, + + //! A JavaScript number. + JavaScriptNumber = 45, + + //! A JavaScript word. + JavaScriptWord = 46, + + //! A JavaScript keyword. + JavaScriptKeyword = 47, + + //! A JavaScript double-quoted string. + JavaScriptDoubleQuotedString = 48, + + //! A JavaScript single-quoted string. + JavaScriptSingleQuotedString = 49, + + //! A JavaScript symbol. + JavaScriptSymbol = 50, + + //! The end of a JavaScript line where a string is not closed. + JavaScriptUnclosedString = 51, + + //! A JavaScript regular expression. + JavaScriptRegex = 52, + + //! The start of an ASP JavaScript fragment. + ASPJavaScriptStart = 55, + + //! The default for ASP JavaScript. + ASPJavaScriptDefault = 56, + + //! An ASP JavaScript comment. + ASPJavaScriptComment = 57, + + //! An ASP JavaScript line comment. + ASPJavaScriptCommentLine = 58, + + //! An ASP JavaDoc style JavaScript comment. + ASPJavaScriptCommentDoc = 59, + + //! An ASP JavaScript number. + ASPJavaScriptNumber = 60, + + //! An ASP JavaScript word. + ASPJavaScriptWord = 61, + + //! An ASP JavaScript keyword. + ASPJavaScriptKeyword = 62, + + //! An ASP JavaScript double-quoted string. + ASPJavaScriptDoubleQuotedString = 63, + + //! An ASP JavaScript single-quoted string. + ASPJavaScriptSingleQuotedString = 64, + + //! An ASP JavaScript symbol. + ASPJavaScriptSymbol = 65, + + //! The end of an ASP JavaScript line where a string is not + //! closed. + ASPJavaScriptUnclosedString = 66, + + //! An ASP JavaScript regular expression. + ASPJavaScriptRegex = 67, + + //! The start of a VBScript fragment. + VBScriptStart = 70, + + //! The default for VBScript. + VBScriptDefault = 71, + + //! A VBScript comment. + VBScriptComment = 72, + + //! A VBScript number. + VBScriptNumber = 73, + + //! A VBScript keyword. + VBScriptKeyword = 74, + + //! A VBScript string. + VBScriptString = 75, + + //! A VBScript identifier. + VBScriptIdentifier = 76, + + //! The end of a VBScript line where a string is not closed. + VBScriptUnclosedString = 77, + + //! The start of an ASP VBScript fragment. + ASPVBScriptStart = 80, + + //! The default for ASP VBScript. + ASPVBScriptDefault = 81, + + //! An ASP VBScript comment. + ASPVBScriptComment = 82, + + //! An ASP VBScript number. + ASPVBScriptNumber = 83, + + //! An ASP VBScript keyword. + ASPVBScriptKeyword = 84, + + //! An ASP VBScript string. + ASPVBScriptString = 85, + + //! An ASP VBScript identifier. + ASPVBScriptIdentifier = 86, + + //! The end of an ASP VBScript line where a string is not + //! closed. + ASPVBScriptUnclosedString = 87, + + //! The start of a Python fragment. + PythonStart = 90, + + //! The default for Python. + PythonDefault = 91, + + //! A Python comment. + PythonComment = 92, + + //! A Python number. + PythonNumber = 93, + + //! A Python double-quoted string. + PythonDoubleQuotedString = 94, + + //! A Python single-quoted string. + PythonSingleQuotedString = 95, + + //! A Python keyword. + PythonKeyword = 96, + + //! A Python triple single-quoted string. + PythonTripleSingleQuotedString = 97, + + //! A Python triple double-quoted string. + PythonTripleDoubleQuotedString = 98, + + //! The name of a Python class. + PythonClassName = 99, + + //! The name of a Python function or method. + PythonFunctionMethodName = 100, + + //! A Python operator. + PythonOperator = 101, + + //! A Python identifier. + PythonIdentifier = 102, + + //! The start of an ASP Python fragment. + ASPPythonStart = 105, + + //! The default for ASP Python. + ASPPythonDefault = 106, + + //! An ASP Python comment. + ASPPythonComment = 107, + + //! An ASP Python number. + ASPPythonNumber = 108, + + //! An ASP Python double-quoted string. + ASPPythonDoubleQuotedString = 109, + + //! An ASP Python single-quoted string. + ASPPythonSingleQuotedString = 110, + + //! An ASP Python keyword. + ASPPythonKeyword = 111, + + //! An ASP Python triple single-quoted string. + ASPPythonTripleSingleQuotedString = 112, + + //! An ASP Python triple double-quoted string. + ASPPythonTripleDoubleQuotedString = 113, + + //! The name of an ASP Python class. + ASPPythonClassName = 114, + + //! The name of an ASP Python function or method. + ASPPythonFunctionMethodName = 115, + + //! An ASP Python operator. + ASPPythonOperator = 116, + + //! An ASP Python identifier + ASPPythonIdentifier = 117, + + //! The default for PHP. + PHPDefault = 118, + + //! A PHP double-quoted string. + PHPDoubleQuotedString = 119, + + //! A PHP single-quoted string. + PHPSingleQuotedString = 120, + + //! A PHP keyword. + PHPKeyword = 121, + + //! A PHP number. + PHPNumber = 122, + + //! A PHP variable. + PHPVariable = 123, + + //! A PHP comment. + PHPComment = 124, + + //! A PHP line comment. + PHPCommentLine = 125, + + //! A PHP double-quoted variable. + PHPDoubleQuotedVariable = 126, + + //! A PHP operator. + PHPOperator = 127 + }; + + //! Construct a QextScintillaLexerHTML with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerHTML(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerHTML instance. + virtual ~QextScintillaLexerHTML(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns the string of characters that comprise a word. + const char *wordCharacters() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool eolFill(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa color() + QColor paper(int style) const; + + //! Causes all properties to be refreshed by emitting the + //! propertyChanged() signal as required. + void refreshProperties(); + + //! Returns TRUE if trailing blank lines are included in a fold block. + //! + //! \sa setFoldCompact() + bool foldCompact() const; + + //! Returns TRUE if preprocessor blocks can be folded. + //! + //! \sa setFoldPreprocessor() + bool foldPreprocessor() const; + + //! Returns TRUE if tags are case sensitive. + //! + //! \sa setCaseSensitiveTags() + bool caseSensitiveTags() const; + +public slots: + //! If \a fold is TRUE then trailing blank lines are included in a fold + //! block. The default is TRUE. + //! + //! \sa foldCompact() + virtual void setFoldCompact(bool fold); + + //! If \a fold is TRUE then preprocessor blocks can be folded. The + //! default is FALSE. + //! + //! \sa foldPreprocessor() + virtual void setFoldPreprocessor(bool fold); + + //! If \a sens is TRUE then tags are case sensitive. The default is + //! FALSE. + //! + //! \sa caseSensitiveTags() + virtual void setCaseSensitiveTags(bool sens); + +protected: + //! The lexer's properties are read from the settings \a qs. \a prefix + //! (which has a trailing '/') should be used as a prefix to the key of + //! each setting. TRUE is returned if there is no error. + //! + bool readProperties(QSettings &qs,const QString &prefix); + + //! The lexer's properties are written to the settings \a qs. + //! \a prefix (which has a trailing '/') should be used as a prefix to + //! the key of each setting. TRUE is returned if there is no error. + //! + bool writeProperties(QSettings &qs,const QString &prefix) const; + +private: + void setCompactProp(); + void setPreprocProp(); + void setCaseSensTagsProp(); + + bool fold_compact; + bool fold_preproc; + bool case_sens_tags; + +#if defined(Q_DISABLE_COPY) + QextScintillaLexerHTML(const QextScintillaLexerHTML &); + QextScintillaLexerHTML &operator=(const QextScintillaLexerHTML &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexeridl.cpp b/qt/qextscintillalexeridl.cpp new file mode 100644 index 0000000..96ea5eb --- /dev/null +++ b/qt/qextscintillalexeridl.cpp @@ -0,0 +1,102 @@ +// This module implements the QextScintillaLexerIDL class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> + +#include "qextscintillalexeridl.h" + + +// The ctor. +QextScintillaLexerIDL::QextScintillaLexerIDL(QObject *parent,const char *name) + : QextScintillaLexerCPP(parent,name) +{ +} + + +// The dtor. +QextScintillaLexerIDL::~QextScintillaLexerIDL() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerIDL::language() const +{ + return "IDL"; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerIDL::color(int style) const +{ + if (style == UUID) + return QColor(0x80,0x40,0x80); + + return QextScintillaLexerCPP::color(style); +} + + +// Returns the set of keywords. +const char *QextScintillaLexerIDL::keywords(int set) const +{ + if (set != 1) + return 0; + + return "aggregatable allocate appobject arrays async async_uuid " + "auto_handle bindable boolean broadcast byte byte_count " + "call_as callback char coclass code comm_status const " + "context_handle context_handle_noserialize " + "context_handle_serialize control cpp_quote custom decode " + "default defaultbind defaultcollelem defaultvalue " + "defaultvtable dispinterface displaybind dllname double dual " + "enable_allocate encode endpoint entry enum error_status_t " + "explicit_handle fault_status first_is float handle_t heap " + "helpcontext helpfile helpstring helpstringcontext " + "helpstringdll hidden hyper id idempotent ignore iid_as iid_is " + "immediatebind implicit_handle import importlib in include " + "in_line int __int64 __int3264 interface last_is lcid " + "length_is library licensed local long max_is maybe message " + "methods midl_pragma midl_user_allocate midl_user_free min_is " + "module ms_union ncacn_at_dsp ncacn_dnet_nsp ncacn_http " + "ncacn_ip_tcp ncacn_nb_ipx ncacn_nb_nb ncacn_nb_tcp ncacn_np " + "ncacn_spx ncacn_vns_spp ncadg_ip_udp ncadg_ipx ncadg_mq " + "ncalrpc nocode nonbrowsable noncreatable nonextensible notify " + "object odl oleautomation optimize optional out out_of_line " + "pipe pointer_default pragma properties propget propput " + "propputref ptr public range readonly ref represent_as " + "requestedit restricted retval shape short signed size_is " + "small source strict_context_handle string struct switch " + "switch_is switch_type transmit_as typedef uidefault union " + "unique unsigned user_marshal usesgetlasterror uuid v1_enum " + "vararg version void wchar_t wire_marshal"; +} + + +// Returns the user name of a style. +QString QextScintillaLexerIDL::description(int style) const +{ + if (style == UUID) + return tr("UUID"); + + return QextScintillaLexerCPP::description(style); +} diff --git a/qt/qextscintillalexeridl.h b/qt/qextscintillalexeridl.h new file mode 100644 index 0000000..1a5c2ee --- /dev/null +++ b/qt/qextscintillalexeridl.h @@ -0,0 +1,72 @@ +// This defines the interface to the QextScintillaLexerIDL class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERIDL_H +#define QEXTSCINTILLALEXERIDL_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexercpp.h> + + +//! \brief The QextScintillaLexerIDL class encapsulates the Scintilla IDL +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerIDL : public QextScintillaLexerCPP +{ + Q_OBJECT + +public: + //! Construct a QextScintillaLexerIDL with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerIDL(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerIDL instance. + virtual ~QextScintillaLexerIDL(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + +private: +#if defined(Q_DISABLE_COPY) + QextScintillaLexerIDL(const QextScintillaLexerIDL &); + QextScintillaLexerIDL &operator=(const QextScintillaLexerIDL &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexerjava.cpp b/qt/qextscintillalexerjava.cpp new file mode 100644 index 0000000..71e2cd3 --- /dev/null +++ b/qt/qextscintillalexerjava.cpp @@ -0,0 +1,59 @@ +// This module implements the QextScintillaLexerJava class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include "qextscintillalexerjava.h" + + +// The ctor. +QextScintillaLexerJava::QextScintillaLexerJava(QObject *parent,const char *name) + : QextScintillaLexerCPP(parent,name) +{ +} + + +// The dtor. +QextScintillaLexerJava::~QextScintillaLexerJava() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerJava::language() const +{ + return "Java"; +} + + +// Returns the set of keywords. +const char *QextScintillaLexerJava::keywords(int set) const +{ + if (set != 1) + return 0; + + return "abstract assert boolean break byte case catch char class " + "const continue default do double else extends final finally " + "float for future generic goto if implements import inner " + "instanceof int interface long native new null operator outer " + "package private protected public rest return short static " + "super switch synchronized this throw throws transient try var " + "void volatile while"; +} diff --git a/qt/qextscintillalexerjava.h b/qt/qextscintillalexerjava.h new file mode 100644 index 0000000..1aa59d3 --- /dev/null +++ b/qt/qextscintillalexerjava.h @@ -0,0 +1,61 @@ +// This defines the interface to the QextScintillaLexerJava class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERJAVA_H +#define QEXTSCINTILLALEXERJAVA_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexercpp.h> + + +//! \brief The QextScintillaLexerJava class encapsulates the Scintilla Java +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerJava : public QextScintillaLexerCPP +{ + Q_OBJECT + +public: + //! Construct a QextScintillaLexerJava with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerJava(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerJava instance. + virtual ~QextScintillaLexerJava(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + +private: +#if defined(Q_DISABLE_COPY) + QextScintillaLexerJava(const QextScintillaLexerJava &); + QextScintillaLexerJava &operator=(const QextScintillaLexerJava &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexerjavascript.cpp b/qt/qextscintillalexerjavascript.cpp new file mode 100644 index 0000000..ee46092 --- /dev/null +++ b/qt/qextscintillalexerjavascript.cpp @@ -0,0 +1,120 @@ +// This module implements the QextScintillaLexerJavaScript class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> + +#include "qextscintillalexerjavascript.h" + + +// The list of JavaScript keywords that can be used by other friendly lexers. +const char *QextScintillaLexerJavaScript::keywordClass = + "abstract boolean break byte case catch char class const continue " + "debugger default delete do double else enum export extends final " + "finally float for function goto if implements import in instanceof " + "int interface long native new package private protected public " + "return short static super switch synchronized this throw throws " + "transient try typeof var void volatile while with"; + + +// The ctor. +QextScintillaLexerJavaScript::QextScintillaLexerJavaScript(QObject *parent,const char *name) + : QextScintillaLexerCPP(parent,name) +{ +} + + +// The dtor. +QextScintillaLexerJavaScript::~QextScintillaLexerJavaScript() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerJavaScript::language() const +{ + return "JavaScript"; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerJavaScript::color(int style) const +{ + if (style == Regex) + return QColor(0x3f,0x7f,0x3f); + + return QextScintillaLexerCPP::color(style); +} + + +// Returns the end-of-line fill for a style. +bool QextScintillaLexerJavaScript::eolFill(int style) const +{ + if (style == Regex) + return TRUE; + + return QextScintillaLexerCPP::eolFill(style); +} + + +// Returns the font of the text for a style. +QFont QextScintillaLexerJavaScript::font(int style) const +{ + if (style == Regex) +#if defined(Q_OS_WIN) + return QFont("Courier New",10); +#else + return QFont("Bitstream Vera Sans Mono",9); +#endif + + return QextScintillaLexerCPP::font(style); +} + + +// Returns the set of keywords. +const char *QextScintillaLexerJavaScript::keywords(int set) const +{ + if (set != 1) + return 0; + + return keywordClass; +} + + +// Returns the user name of a style. +QString QextScintillaLexerJavaScript::description(int style) const +{ + if (style == Regex) + return tr("Regular expression"); + + return QextScintillaLexerCPP::description(style); +} + + +// Returns the background colour of the text for a style. +QColor QextScintillaLexerJavaScript::paper(int style) const +{ + if (style == Regex) + return QColor(0xe0,0xf0,0xff); + + return QextScintillaLexer::paper(style); +} diff --git a/qt/qextscintillalexerjavascript.h b/qt/qextscintillalexerjavascript.h new file mode 100644 index 0000000..b166524 --- /dev/null +++ b/qt/qextscintillalexerjavascript.h @@ -0,0 +1,88 @@ +// This defines the interface to the QextScintillaLexerJavaScript class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERJSCRIPT_H +#define QEXTSCINTILLALEXERJSCRIPT_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexercpp.h> + + +//! \brief The QextScintillaLexerJavaScript class encapsulates the Scintilla +//! JavaScript lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerJavaScript : public QextScintillaLexerCPP +{ + Q_OBJECT + +public: + //! Construct a QextScintillaLexerJavaScript with parent \a parent and + //! name \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerJavaScript(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerJavaScript instance. + virtual ~QextScintillaLexerJavaScript(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool eolFill(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa color() + QColor paper(int style) const; + +private: + friend class QextScintillaLexerHTML; + + static const char *keywordClass; + +#if defined(Q_DISABLE_COPY) + QextScintillaLexerJavaScript(const QextScintillaLexerJavaScript &); + QextScintillaLexerJavaScript &operator=(const QextScintillaLexerJavaScript &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexerlua.cpp b/qt/qextscintillalexerlua.cpp new file mode 100644 index 0000000..05090bf --- /dev/null +++ b/qt/qextscintillalexerlua.cpp @@ -0,0 +1,346 @@ +// This module implements the QextScintillaLexerLua class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexerlua.h" + + +// The ctor. +QextScintillaLexerLua::QextScintillaLexerLua(QObject *parent, const char *name) + : QextScintillaLexer(parent,name), fold_compact(TRUE) +{ +} + + +// The dtor. +QextScintillaLexerLua::~QextScintillaLexerLua() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerLua::language() const +{ + return "Lua"; +} + + +// Returns the lexer name. +const char *QextScintillaLexerLua::lexer() const +{ + return "lua"; +} + + +// Return the list of characters that can start a block. +const char *QextScintillaLexerLua::blockStart(int *style) const +{ + if (style) + *style = Operator; + + return ""; +} + + +// Return the style used for braces. +int QextScintillaLexerLua::braceStyle() const +{ + return Operator; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerLua::color(int style) const +{ + switch (style) + { + case Default: + return QColor(0x00,0x00,0x00); + + case Comment: + case LineComment: + return QColor(0x00,0x7f,0x00); + + case Number: + return QColor(0x00,0x7f,0x7f); + + case Keyword: + case BasicFunctions: + case StringTableMathsFunctions: + case CoroutinesIOSystemFacilities: + return QColor(0x00,0x00,0x7f); + + case String: + case Character: + case LiteralString: + return QColor(0x7f,0x00,0x7f); + + case Preprocessor: + return QColor(0x7f,0x7f,0x00); + + case Operator: + case Identifier: + break; + } + + return QextScintillaLexer::color(style); +} + + +// Returns the end-of-line fill for a style. +bool QextScintillaLexerLua::eolFill(int style) const +{ + return (style == Comment || style == UnclosedString); +} + + +// Returns the font of the text for a style. +QFont QextScintillaLexerLua::font(int style) const +{ + QFont f; + + switch (style) + { + case Comment: + case LineComment: + case LiteralString: +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + break; + + default: + f = QextScintillaLexer::font(style); + } + + return f; +} + + +// Returns the set of keywords. +const char *QextScintillaLexerLua::keywords(int set) const +{ + if (set == 1) + // Keywords. + return + "and break do else elseif end false for function if " + "in local nil not or repeat return then true until " + "while"; + + if (set == 2) + // Basic functions. + return + "_ALERT _ERRORMESSAGE _INPUT _PROMPT _OUTPUT _STDERR " + "_STDIN _STDOUT call dostring foreach foreachi getn " + "globals newtype rawget rawset require sort tinsert " + "tremove " + + "G getfenv getmetatable ipairs loadlib next pairs " + "pcall rawegal rawget rawset require setfenv " + "setmetatable xpcall string table math coroutine io " + "os debug"; + + if (set == 3) + // String, table and maths functions. + return + "abs acos asin atan atan2 ceil cos deg exp floor " + "format frexp gsub ldexp log log10 max min mod rad " + "random randomseed sin sqrt strbyte strchar strfind " + "strlen strlower strrep strsub strupper tan " + + "string.byte string.char string.dump string.find " + "string.len string.lower string.rep string.sub " + "string.upper string.format string.gfind string.gsub " + "table.concat table.foreach table.foreachi table.getn " + "table.sort table.insert table.remove table.setn " + "math.abs math.acos math.asin math.atan math.atan2 " + "math.ceil math.cos math.deg math.exp math.floor " + "math.frexp math.ldexp math.log math.log10 math.max " + "math.min math.mod math.pi math.rad math.random " + "math.randomseed math.sin math.sqrt math.tan"; + + if (set == 4) + // Coroutine, I/O and system facilities. + return + "openfile closefile readfrom writeto appendto remove " + "rename flush seek tmpfile tmpname read write clock " + "date difftime execute exit getenv setlocale time " + + "coroutine.create coroutine.resume coroutine.status " + "coroutine.wrap coroutine.yield io.close io.flush " + "io.input io.lines io.open io.output io.read " + "io.tmpfile io.type io.write io.stdin io.stdout " + "io.stderr os.clock os.date os.difftime os.execute " + "os.exit os.getenv os.remove os.rename os.setlocale " + "os.time os.tmpname"; + + return 0; +} + + +// Returns the user name of a style. +QString QextScintillaLexerLua::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Comment: + return tr("Comment"); + + case LineComment: + return tr("Line comment"); + + case Number: + return tr("Number"); + + case Keyword: + return tr("Keyword"); + + case String: + return tr("String"); + + case Character: + return tr("Character"); + + case LiteralString: + return tr("Literal string"); + + case Preprocessor: + return tr("Preprocessor"); + + case Operator: + return tr("Operator"); + + case Identifier: + return tr("Identifier"); + + case UnclosedString: + return tr("Unclosed string"); + + case BasicFunctions: + return tr("Basic functions"); + + case StringTableMathsFunctions: + return tr("String, table and maths functions"); + + case CoroutinesIOSystemFacilities: + return tr("Coroutines, i/o and system facilities"); + } + + return QString::null; +} + + +// Returns the background colour of the text for a style. +QColor QextScintillaLexerLua::paper(int style) const +{ + switch (style) + { + case Comment: + return QColor(0xd0,0xf0,0xf0); + + case LiteralString: + return QColor(0xe0,0xff,0xff); + + case UnclosedString: + return QColor(0xe0,0xc0,0xe0); + + case BasicFunctions: + return QColor(0xd0,0xff,0xd0); + + case StringTableMathsFunctions: + return QColor(0xd0,0xd0,0xff); + + case CoroutinesIOSystemFacilities: + return QColor(0xff,0xd0,0xd0); + } + + return QextScintillaLexer::paper(style); +} + + +// Refresh all properties. +void QextScintillaLexerLua::refreshProperties() +{ + setCompactProp(); +} + + +// Read properties from the settings. +bool QextScintillaLexerLua::readProperties(QSettings &qs,const QString &prefix) +{ + int rc = TRUE; + bool ok, flag; + + // Read the fold compact flag. + flag = qs.readBoolEntry(prefix + "foldcompact",TRUE,&ok); + + if (ok) + fold_compact = flag; + else + rc = FALSE; + + return rc; +} + + +// Write properties to the settings. +bool QextScintillaLexerLua::writeProperties(QSettings &qs,const QString &prefix) const +{ + int rc = TRUE; + + // Write the fold compact flag. + if (!qs.writeEntry(prefix + "foldcompact",fold_compact)) + rc = FALSE; + + return rc; +} + + +// Return TRUE if folds are compact. +bool QextScintillaLexerLua::foldCompact() const +{ + return fold_compact; +} + + +// Set if folds are compact. +void QextScintillaLexerLua::setFoldCompact(bool fold) +{ + fold_compact = fold; + + setCompactProp(); +} + + +// Set the "fold.compact" property. +void QextScintillaLexerLua::setCompactProp() +{ + emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); +} diff --git a/qt/qextscintillalexerlua.h b/qt/qextscintillalexerlua.h new file mode 100644 index 0000000..73016e6 --- /dev/null +++ b/qt/qextscintillalexerlua.h @@ -0,0 +1,178 @@ +// This defines the interface to the QextScintillaLexerLua class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERLUA_H +#define QEXTSCINTILLALEXERLUA_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerLua class encapsulates the Scintilla Lua +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerLua : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! Lua lexer. + enum { + //! The default. + Default = 0, + + //! A block comment. + Comment = 1, + + //! A line comment. + LineComment = 2, + + //! A number. + Number = 4, + + //! A keyword. + Keyword = 5, + + //! A string. + String = 6, + + //! A character. + Character = 7, + + //! A literal string. + LiteralString = 8, + + //! Preprocessor + Preprocessor = 9, + + //! An operator. + Operator = 10, + + //! An identifier + Identifier = 11, + + //! The end of a line where a string is not closed. + UnclosedString = 12, + + //! Basic functions. + BasicFunctions = 13, + + //! String, table and maths functions. + StringTableMathsFunctions = 14, + + //! Coroutines, I/O and system facilities. + CoroutinesIOSystemFacilities = 15 + }; + + //! Construct a QextScintillaLexerLua with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerLua(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerLua instance. + virtual ~QextScintillaLexerLua(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns a space separated list of words or characters in + //! a particular style that define the start of a block for + //! auto-indentation. The styles is returned via \a style. + const char *blockStart(int *style = 0) const; + + //! \internal Returns the style used for braces for brace matching. + int braceStyle() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool eolFill(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa color() + QColor paper(int style) const; + + //! Causes all properties to be refreshed by emitting the + //! propertyChanged() signal as required. + void refreshProperties(); + + //! Returns TRUE if trailing blank lines are included in a fold block. + //! + //! \sa setFoldCompact() + bool foldCompact() const; + +public slots: + //! If \a fold is TRUE then trailing blank lines are included in a fold + //! block. The default is TRUE. + //! + //! \sa foldCompact() + virtual void setFoldCompact(bool fold); + +protected: + //! The lexer's properties are read from the settings \a qs. \a prefix + //! (which has a trailing '/') should be used as a prefix to the key of + //! each setting. TRUE is returned if there is no error. + //! + bool readProperties(QSettings &qs,const QString &prefix); + + //! The lexer's properties are written to the settings \a qs. + //! \a prefix (which has a trailing '/') should be used as a prefix to + //! the key of each setting. TRUE is returned if there is no error. + //! + bool writeProperties(QSettings &qs,const QString &prefix) const; + +private: + void setCompactProp(); + + bool fold_compact; + +#if defined(Q_DISABLE_COPY) + QextScintillaLexerLua(const QextScintillaLexerLua &); + QextScintillaLexerLua &operator=(const QextScintillaLexerLua &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexermakefile.cpp b/qt/qextscintillalexermakefile.cpp new file mode 100644 index 0000000..10e219b --- /dev/null +++ b/qt/qextscintillalexermakefile.cpp @@ -0,0 +1,156 @@ +// This module implements the QextScintillaLexerMakefile class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexermakefile.h" + + +// The ctor. +QextScintillaLexerMakefile::QextScintillaLexerMakefile(QObject *parent,const char *name) + : QextScintillaLexer(parent,name) +{ +} + + +// The dtor. +QextScintillaLexerMakefile::~QextScintillaLexerMakefile() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerMakefile::language() const +{ + return "Makefile"; +} + + +// Returns the lexer name. +const char *QextScintillaLexerMakefile::lexer() const +{ + return "makefile"; +} + + +// Return the string of characters that comprise a word. +const char *QextScintillaLexerMakefile::wordCharacters() const +{ + return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerMakefile::color(int style) const +{ + switch (style) + { + case Default: + case Operator: + return QColor(0x00,0x00,0x00); + + case Comment: + return QColor(0x00,0x7f,0x00); + + case Preprocessor: + return QColor(0x7f,0x7f,0x00); + + case Variable: + return QColor(0x00,0x00,0x80); + + case Target: + return QColor(0xa0,0x00,0x00); + + case Error: + return QColor(0xff,0xff,0x00); + } + + return QextScintillaLexer::color(style); +} + + +// Returns the end-of-line fill for a style. +bool QextScintillaLexerMakefile::eolFill(int style) const +{ + return (style == Error); +} + + +// Returns the font of the text for a style. +QFont QextScintillaLexerMakefile::font(int style) const +{ + QFont f; + + if (style == Comment) +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + else + f = QextScintillaLexer::font(style); + + return f; +} + + +// Returns the user name of a style. +QString QextScintillaLexerMakefile::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Comment: + return tr("Comment"); + + case Preprocessor: + return tr("Preprocessor"); + + case Variable: + return tr("Variable"); + + case Operator: + return tr("Operator"); + + case Target: + return tr("Target"); + + case Error: + return tr("Error"); + } + + return QString::null; +} + + +// Returns the background colour of the text for a style. +QColor QextScintillaLexerMakefile::paper(int style) const +{ + if (style == Error) + return QColor(0xff,0x00,0x00); + + return QextScintillaLexer::paper(style); +} diff --git a/qt/qextscintillalexermakefile.h b/qt/qextscintillalexermakefile.h new file mode 100644 index 0000000..34b2e6a --- /dev/null +++ b/qt/qextscintillalexermakefile.h @@ -0,0 +1,112 @@ +// This defines the interface to the QextScintillaLexerMakefile class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERMAKEFILE_H +#define QEXTSCINTILLALEXERMAKEFILE_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerMakefile class encapsulates the Scintilla +//! Makefile lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerMakefile : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! Makefile lexer. + enum { + //! The default. + Default = 0, + + //! A comment. + Comment = 1, + + //! A pre-processor directive. + Preprocessor = 2, + + //! A variable. + Variable = 3, + + //! An operator. + Operator = 4, + + //! A target. + Target = 5, + + //! An error. + Error = 9 + }; + + //! Construct a QextScintillaLexerMakefile with parent \a parent and + //! name \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerMakefile(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerMakefile instance. + virtual ~QextScintillaLexerMakefile(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns the string of characters that comprise a word. + const char *wordCharacters() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool eolFill(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa color() + QColor paper(int style) const; + +private: +#if defined(Q_DISABLE_COPY) + QextScintillaLexerMakefile(const QextScintillaLexerMakefile &); + QextScintillaLexerMakefile &operator=(const QextScintillaLexerMakefile &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexerperl.cpp b/qt/qextscintillalexerperl.cpp new file mode 100644 index 0000000..1d5c15b --- /dev/null +++ b/qt/qextscintillalexerperl.cpp @@ -0,0 +1,482 @@ +// This module implements the QextScintillaLexerPerl class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexerperl.h" + + +// The ctor. +QextScintillaLexerPerl::QextScintillaLexerPerl(QObject *parent, + const char *name) + : QextScintillaLexer(parent,name), fold_comments(FALSE), + fold_compact(TRUE) +{ +} + + +// The dtor. +QextScintillaLexerPerl::~QextScintillaLexerPerl() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerPerl::language() const +{ + return "Perl"; +} + + +// Returns the lexer name. +const char *QextScintillaLexerPerl::lexer() const +{ + return "perl"; +} + + +// Return the style used for braces. +int QextScintillaLexerPerl::braceStyle() const +{ + return Operator; +} + + +// Return the string of characters that comprise a word. +const char *QextScintillaLexerPerl::wordCharacters() const +{ + return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$@%&"; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerPerl::color(int style) const +{ + switch (style) + { + case Default: + return QColor(0x80,0x80,0x80); + + case Error: + case Backticks: + case QuotedStringQX: + return QColor(0xff,0xff,0x00); + + case Comment: + return QColor(0x00,0x7f,0x00); + + case POD: + case PODVerbatim: + return QColor(0x00,0x40,0x00); + + case Number: + return QColor(0x00,0x7f,0x7f); + + case Keyword: + return QColor(0x00,0x00,0x7f); + + case DoubleQuotedString: + case SingleQuotedString: + case SingleQuotedHereDocument: + case DoubleQuotedHereDocument: + case BacktickHereDocument: + case QuotedStringQ: + case QuotedStringQQ: + return QColor(0x7f,0x00,0x7f); + + case Operator: + case Identifier: + case Scalar: + case Array: + case Hash: + case SymbolTable: + case Regex: + case Substitution: + case HereDocumentDelimiter: + case QuotedStringQR: + case QuotedStringQW: + return QColor(0x00,0x00,0x00); + + case DataSection: + return QColor(0x60,0x00,0x00); + } + + return QextScintillaLexer::color(style); +} + + +// Returns the end-of-line fill for a style. +bool QextScintillaLexerPerl::eolFill(int style) const +{ + switch (style) + { + case POD: + case DataSection: + case SingleQuotedHereDocument: + case DoubleQuotedHereDocument: + case BacktickHereDocument: + case PODVerbatim: + return TRUE; + } + + return FALSE; +} + + +// Returns the font of the text for a style. +QFont QextScintillaLexerPerl::font(int style) const +{ + QFont f; + + switch (style) + { + case Comment: +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + break; + + case POD: +#if defined(Q_OS_WIN) + f = QFont("Times New Roman",11); +#else + f = QFont("Bitstream Charter",10); +#endif + break; + + case Keyword: + case Operator: + case DoubleQuotedHereDocument: + f = QextScintillaLexer::font(style); + f.setBold(TRUE); + break; + + case DoubleQuotedString: + case SingleQuotedString: + case QuotedStringQQ: + case PODVerbatim: +#if defined(Q_OS_WIN) + f = QFont("Courier New",10); +#else + f = QFont("Bitstream Vera Sans Mono",9); +#endif + break; + + case BacktickHereDocument: + f = QextScintillaLexer::font(style); + f.setItalic(TRUE); + break; + + default: + f = QextScintillaLexer::font(style); + } + + return f; +} + + +// Returns the set of keywords. +const char *QextScintillaLexerPerl::keywords(int set) const +{ + if (set == 1) + return + "NULL __FILE__ __LINE__ __PACKAGE__ __DATA__ __END__ " + "AUTOLOAD BEGIN CORE DESTROY END EQ GE GT INIT LE LT " + "NE CHECK abs accept alarm and atan2 bind binmode " + "bless caller chdir chmod chomp chop chown chr chroot " + "close closedir cmp connect continue cos crypt " + "dbmclose dbmopen defined delete die do dump each " + "else elsif endgrent endhostent endnetent endprotoent " + "endpwent endservent eof eq eval exec exists exit exp " + "fcntl fileno flock for foreach fork format formline " + "ge getc getgrent getgrgid getgrnam gethostbyaddr " + "gethostbyname gethostent getlogin getnetbyaddr " + "getnetbyname getnetent getpeername getpgrp getppid " + "getpriority getprotobyname getprotobynumber " + "getprotoent getpwent getpwnam getpwuid getservbyname " + "getservbyport getservent getsockname getsockopt glob " + "gmtime goto grep gt hex if index int ioctl join keys " + "kill last lc lcfirst le length link listen local " + "localtime lock log lstat lt m map mkdir msgctl " + "msgget msgrcv msgsnd my ne next no not oct open " + "opendir or ord our pack package pipe pop pos print " + "printf prototype push q qq qr quotemeta qu qw qx " + "rand read readdir readline readlink readpipe recv " + "redo ref rename require reset return reverse " + "rewinddir rindex rmdir s scalar seek seekdir select " + "semctl semget semop send setgrent sethostent " + "setnetent setpgrp setpriority setprotoent setpwent " + "setservent setsockopt shift shmctl shmget shmread " + "shmwrite shutdown sin sleep socket socketpair sort " + "splice split sprintf sqrt srand stat study sub " + "substr symlink syscall sysopen sysread sysseek " + "system syswrite tell telldir tie tied time times tr " + "truncate uc ucfirst umask undef unless unlink unpack " + "unshift untie until use utime values vec wait " + "waitpid wantarray warn while write x xor y"; + + return 0; +} + + +// Returns the user name of a style. +QString QextScintillaLexerPerl::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Error: + return tr("Error"); + + case Comment: + return tr("Comment"); + + case POD: + return tr("POD"); + + case Number: + return tr("Number"); + + case Keyword: + return tr("Keyword"); + + case DoubleQuotedString: + return tr("Double-quoted string"); + + case SingleQuotedString: + return tr("Single-quoted string"); + + case Operator: + return tr("Operator"); + + case Identifier: + return tr("Identifier"); + + case Scalar: + return tr("Scalar"); + + case Array: + return tr("Array"); + + case Hash: + return tr("Hash"); + + case SymbolTable: + return tr("Symbol table"); + + case Regex: + return tr("Regular expression"); + + case Substitution: + return tr("Substitution"); + + case Backticks: + return tr("Backticks"); + + case DataSection: + return tr("Data section"); + + case HereDocumentDelimiter: + return tr("Here document delimiter"); + + case SingleQuotedHereDocument: + return tr("Single-quoted here document"); + + case DoubleQuotedHereDocument: + return tr("Double-quoted here document"); + + case BacktickHereDocument: + return tr("Backtick here document"); + + case QuotedStringQ: + return tr("Quoted string (q)"); + + case QuotedStringQQ: + return tr("Quoted string (qq)"); + + case QuotedStringQX: + return tr("Quoted string (qx)"); + + case QuotedStringQR: + return tr("Quoted string (qr)"); + + case QuotedStringQW: + return tr("Quoted string (qw)"); + + case PODVerbatim: + return tr("POD verbatim"); + } + + return QString::null; +} + + +// Returns the background colour of the text for a style. +QColor QextScintillaLexerPerl::paper(int style) const +{ + switch (style) + { + case Error: + return QColor(0xff,0x00,0x00); + + case POD: + return QColor(0xe0,0xff,0xe0); + + case Scalar: + return QColor(0xff,0xe0,0xe0); + + case Array: + return QColor(0xff,0xff,0xe0); + + case Hash: + return QColor(0xff,0xe0,0xff); + + case SymbolTable: + return QColor(0xe0,0xe0,0xe0); + + case Regex: + return QColor(0xa0,0xff,0xa0); + + case Substitution: + return QColor(0xf0,0xe0,0x80); + + case Backticks: + return QColor(0xa0,0x80,0x80); + + case DataSection: + return QColor(0xff,0xf0,0xd8); + + case HereDocumentDelimiter: + case SingleQuotedHereDocument: + case DoubleQuotedHereDocument: + case BacktickHereDocument: + return QColor(0xdd,0xd0,0xdd); + + case PODVerbatim: + return QColor(0xc0,0xff,0xc0); + } + + return QextScintillaLexer::paper(style); +} + + +// Refresh all properties. +void QextScintillaLexerPerl::refreshProperties() +{ + setCommentProp(); + setCompactProp(); +} + + +// Read properties from the settings. +bool QextScintillaLexerPerl::readProperties(QSettings &qs,const QString &prefix) +{ + int rc = TRUE; + bool ok, flag; + + // Read the fold comments flag. + flag = qs.readBoolEntry(prefix + "foldcomments",FALSE,&ok); + + if (ok) + fold_comments = flag; + else + rc = FALSE; + + // Read the fold compact flag. + flag = qs.readBoolEntry(prefix + "foldcompact",TRUE,&ok); + + if (ok) + fold_compact = flag; + else + rc = FALSE; + + return rc; +} + + +// Write properties to the settings. +bool QextScintillaLexerPerl::writeProperties(QSettings &qs,const QString &prefix) const +{ + int rc = TRUE; + + // Write the fold comments flag. + if (!qs.writeEntry(prefix + "foldcomments",fold_comments)) + rc = FALSE; + + // Write the fold compact flag. + if (!qs.writeEntry(prefix + "foldcompact",fold_compact)) + rc = FALSE; + + return rc; +} + + +// Return TRUE if comments can be folded. +bool QextScintillaLexerPerl::foldComments() const +{ + return fold_comments; +} + + +// Set if comments can be folded. +void QextScintillaLexerPerl::setFoldComments(bool fold) +{ + fold_comments = fold; + + setCommentProp(); +} + + +// Set the "fold.comment" property. +void QextScintillaLexerPerl::setCommentProp() +{ + emit propertyChanged("fold.comment",(fold_comments ? "1" : "0")); +} + + +// Return TRUE if folds are compact. +bool QextScintillaLexerPerl::foldCompact() const +{ + return fold_compact; +} + + +// Set if folds are compact +void QextScintillaLexerPerl::setFoldCompact(bool fold) +{ + fold_compact = fold; + + setCompactProp(); +} + + +// Set the "fold.compact" property. +void QextScintillaLexerPerl::setCompactProp() +{ + emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); +} diff --git a/qt/qextscintillalexerperl.h b/qt/qextscintillalexerperl.h new file mode 100644 index 0000000..0beb75a --- /dev/null +++ b/qt/qextscintillalexerperl.h @@ -0,0 +1,231 @@ +// This defines the interface to the QextScintillaLexerPerl class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERPERL_H +#define QEXTSCINTILLALEXERPERL_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerPerl class encapsulates the Scintilla Perl +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerPerl : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! Perl lexer. + enum { + //! The default. + Default = 0, + + //! \deprecated White space. + WhiteSpace = Default, + + //! An error. + Error = 1, + + //! A comment. + Comment = 2, + + //! A POD. + POD = 3, + + //! A number. + Number = 4, + + //! A keyword. + Keyword = 5, + + //! A double-quoted string. + DoubleQuotedString = 6, + + //! A single-quoted string. + SingleQuotedString = 7, + + //! An operator. + Operator = 10, + + //! An identifier + Identifier = 11, + + //! A scalar. + Scalar = 12, + + //! An array. + Array = 13, + + //! A hash. + Hash = 14, + + //! A symbol table. + SymbolTable = 15, + + //! A regular expression. + Regex = 17, + + //! A substitution. + Substitution = 18, + + //! Backticks. + Backticks = 20, + + //! A data section. + DataSection = 21, + + //! A here document delimiter. + HereDocumentDelimiter = 22, + + //! A single quoted here document. + SingleQuotedHereDocument = 23, + + //! A double quoted here document. + DoubleQuotedHereDocument = 24, + + //! A backtick here document. + BacktickHereDocument = 25, + + //! A quoted string (q). + QuotedStringQ = 26, + + //! A quoted string (qq). + QuotedStringQQ = 27, + + //! A quoted string (qx). + QuotedStringQX = 28, + + //! A quoted string (qr). + QuotedStringQR = 29, + + //! A quoted string (qw). + QuotedStringQW = 30, + + //! A verbatim POD. + PODVerbatim = 31 + }; + + //! Construct a QextScintillaLexerPerl with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerPerl(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerPerl instance. + virtual ~QextScintillaLexerPerl(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns the style used for braces for brace matching. + int braceStyle() const; + + //! \internal Returns the string of characters that comprise a word. + const char *wordCharacters() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool eolFill(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa color() + QColor paper(int style) const; + + //! Causes all properties to be refreshed by emitting the + //! propertyChanged() signal as required. + void refreshProperties(); + + //! Returns TRUE if multi-line comment blocks can be folded. + //! + //! \sa setFoldComments() + bool foldComments() const; + + //! Returns TRUE if trailing blank lines are included in a fold block. + //! + //! \sa setFoldCompact() + bool foldCompact() const; + +public slots: + //! If \a fold is TRUE then multi-line comment blocks can be folded. + //! The default is FALSE. + //! + //! \sa foldComments() + virtual void setFoldComments(bool fold); + + //! If \a fold is TRUE then trailing blank lines are included in a fold + //! block. The default is TRUE. + //! + //! \sa foldCompact() + virtual void setFoldCompact(bool fold); + +protected: + //! The lexer's properties are read from the settings \a qs. \a prefix + //! (which has a trailing '/') should be used as a prefix to the key of + //! each setting. TRUE is returned if there is no error. + //! + bool readProperties(QSettings &qs,const QString &prefix); + + //! The lexer's properties are written to the settings \a qs. + //! \a prefix (which has a trailing '/') should be used as a prefix to + //! the key of each setting. TRUE is returned if there is no error. + //! + bool writeProperties(QSettings &qs,const QString &prefix) const; + +private: + void setCommentProp(); + void setCompactProp(); + + bool fold_comments; + bool fold_compact; + +#if defined(Q_DISABLE_COPY) + QextScintillaLexerPerl(const QextScintillaLexerPerl &); + QextScintillaLexerPerl &operator=(const QextScintillaLexerPerl &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexerpov.cpp b/qt/qextscintillalexerpov.cpp new file mode 100644 index 0000000..1fabd0f --- /dev/null +++ b/qt/qextscintillalexerpov.cpp @@ -0,0 +1,488 @@ +// This module implements the QextScintillaLexerPOV class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexerpov.h" + + +// The ctor. +QextScintillaLexerPOV::QextScintillaLexerPOV(QObject *parent,const char *name) + : QextScintillaLexer(parent,name), fold_comments(FALSE), + fold_compact(TRUE), fold_directives(FALSE) +{ +} + + +// The dtor. +QextScintillaLexerPOV::~QextScintillaLexerPOV() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerPOV::language() const +{ + return "POV"; +} + + +// Returns the lexer name. +const char *QextScintillaLexerPOV::lexer() const +{ + return "pov"; +} + + +// Return the style used for braces. +int QextScintillaLexerPOV::braceStyle() const +{ + return Operator; +} + + +// Return the string of characters that comprise a word. +const char *QextScintillaLexerPOV::wordCharacters() const +{ + return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_#"; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerPOV::color(int style) const +{ + switch (style) + { + case Default: + return QColor(0xff,0x00,0x80); + + case Comment: + case CommentLine: + return QColor(0x00,0x7f,0x00); + + case Number: + return QColor(0x00,0x7f,0x7f); + + case Operator: + return QColor(0x00,0x00,0x00); + + case String: + return QColor(0x7f,0x00,0x7f); + + case Directive: + return QColor(0x7f,0x7f,0x00); + + case BadDirective: + return QColor(0x80,0x40,0x20); + + case ObjectsCSGAppearance: + case TypesModifiersItems: + case PredefinedIdentifiers: + case PredefinedFunctions: + case KeywordSet6: + case KeywordSet7: + case KeywordSet8: + return QColor(0x00,0x00,0x7f); + } + + return QextScintillaLexer::color(style); +} + + +// Returns the end-of-line fill for a style. +bool QextScintillaLexerPOV::eolFill(int style) const +{ + return (style == UnclosedString); +} + + +// Returns the font of the text for a style. +QFont QextScintillaLexerPOV::font(int style) const +{ + QFont f; + + switch (style) + { + case Comment: + case CommentLine: +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + break; + + case UnclosedString: + case PredefinedIdentifiers: + f = QextScintillaLexer::font(style); + f.setBold(TRUE); + break; + + case BadDirective: +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + f.setItalic(TRUE); + break; + + default: + f = QextScintillaLexer::font(style); + } + + return f; +} + + +// Returns the set of keywords. +const char *QextScintillaLexerPOV::keywords(int set) const +{ + if (set == 1) + return + "declare local include undef fopen fclose read write " + "default version case range break debug error " + "warning if ifdef ifndef switch while macro else end"; + + if (set == 2) + return + "camera light_source light_group object blob sphere " + "cylinder box cone height_field julia_fractal lathe " + "prism sphere_sweep superellipsoid sor text torus " + "bicubic_patch disc mesh mesh2 polygon triangle " + "smooth_triangle plane poly cubic quartic quadric " + "isosurface parametric union intersection difference " + "merge function array spline vertex_vectors " + "normal_vectors uv_vectors face_indices " + "normal_indices uv_indices texture texture_list " + "interior_texture texture_map material_map image_map " + "color_map colour_map pigment_map normal_map " + "slope_map bump_map density_map pigment normal " + "material interior finish reflection irid slope " + "pigment_pattern image_pattern warp media scattering " + "density background fog sky_sphere rainbow " + "global_settings radiosity photons pattern transform " + "looks_like projected_through contained_by " + "clipped_by bounded_by"; + + if (set == 3) + return + "linear_spline quadratic_spline cubic_spline " + "natural_spline bezier_spline b_spline read write " + "append inverse open perspective orthographic " + "fisheye ultra_wide_angle omnimax panoramic " + "spherical spotlight jitter circular orient " + "media_attenuation media_interaction shadowless " + "parallel refraction collect pass_through " + "global_lights hierarchy sturm smooth gif tga iff " + "pot png pgm ppm jpeg tiff sys ttf quaternion " + "hypercomplex linear_sweep conic_sweep type " + "all_intersections split_union cutaway_textures " + "no_shadow no_image no_reflection double_illuminate " + "hollow uv_mapping all use_index use_color " + "use_colour no_bump_scale conserve_energy fresnel " + "average agate boxed bozo bumps cells crackle " + "cylindrical density_file dents facets granite " + "leopard marble onion planar quilted radial ripples " + "spotted waves wood wrinkles solid use_alpha " + "interpolate magnet noise_generator toroidal " + "ramp_wave triangle_wave sine_wave scallop_wave " + "cubic_wave poly_wave once map_type method fog_type " + "hf_gray_16 charset ascii utf8 rotate scale " + "translate matrix location right up direction sky " + "angle look_at aperture blur_samples focal_point " + "confidence variance radius falloff tightness " + "point_at area_light adaptive fade_distance " + "fade_power threshold strength water_level tolerance " + "max_iteration precision slice u_steps v_steps " + "flatness inside_vector accuracy max_gradient " + "evaluate max_trace precompute target ior dispersion " + "dispersion_samples caustics color colour rgb rgbf " + "rgbt rgbft red green blue filter transmit gray hf " + "fade_color fade_colour quick_color quick_colour " + "brick checker hexagon brick_size mortar bump_size " + "ambient diffuse brilliance crand phong phong_size " + "metallic specular roughness reflection_exponent " + "exponent thickness gradient spiral1 spiral2 " + "agate_turb form metric offset df3 coords size " + "mandel exterior julia control0 control1 altitude " + "turbulence octaves omega lambda repeat flip " + "black-hole orientation dist_exp major_radius " + "frequency phase intervals samples ratio absorption " + "emission aa_threshold aa_level eccentricity " + "extinction distance turb_depth fog_offset fog_alt " + "width arc_angle falloff_angle adc_bailout " + "ambient_light assumed_gamma irid_wavelength " + "number_of_waves always_sample brigthness count " + "error_bound gray_threshold load_file " + "low_error_factor max_sample minimum_reuse " + "nearest_count pretrace_end pretrace_start " + "recursion_limit save_file spacing gather " + "max_trace_level autostop expand_thresholds"; + + if (set == 4) + return + "x y z t u v yes no true false on off clock " + "clock_delta clock_on final_clock final_frame " + "frame_number image_height image_width initial_clock " + "initial_frame pi version"; + + if (set == 5) + return + "abs acos acosh asc asin asinh atan atanh atan2 ceil " + "cos cosh defined degrees dimensions dimension_size " + "div exp file_exists floor inside int ln log max min " + "mod pow prod radians rand seed select sin sinh sqrt " + "strcmp strlen sum tan tanh val vdot vlength " + "min_extent max_extent trace vaxis_rotate vcross " + "vrotate vnormalize vturbulence chr concat str " + "strlwr strupr substr vstr sqr cube reciprocal pwr"; + + return 0; +} + + +// Returns the user name of a style. +QString QextScintillaLexerPOV::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Comment: + return tr("Comment"); + + case CommentLine: + return tr("Comment line"); + + case Number: + return tr("Number"); + + case Operator: + return tr("Operator"); + + case Identifier: + return tr("Identifier"); + + case String: + return tr("String"); + + case UnclosedString: + return tr("Unclosed string"); + + case Directive: + return tr("Directive"); + + case BadDirective: + return tr("Bad directive"); + + case ObjectsCSGAppearance: + return tr("Objects, CSG and appearance"); + + case TypesModifiersItems: + return tr("Types, modifiers and items"); + + case PredefinedIdentifiers: + return tr("Predefined identifiers"); + + case PredefinedFunctions: + return tr("Predefined functions"); + + case KeywordSet6: + return tr("User defined 1"); + + case KeywordSet7: + return tr("User defined 2"); + + case KeywordSet8: + return tr("User defined 3"); + } + + return QString::null; +} + + +// Returns the background colour of the text for a style. +QColor QextScintillaLexerPOV::paper(int style) const +{ + switch (style) + { + case UnclosedString: + return QColor(0xe0,0xc0,0xe0); + + case ObjectsCSGAppearance: + return QColor(0xff,0xd0,0xd0); + + case TypesModifiersItems: + return QColor(0xff,0xff,0xd0); + + case PredefinedFunctions: + return QColor(0xd0,0xd0,0xff); + + case KeywordSet6: + return QColor(0xd0,0xff,0xd0); + + case KeywordSet7: + return QColor(0xd0,0xd0,0xd0); + + case KeywordSet8: + return QColor(0xe0,0xe0,0xe0); + } + + return QextScintillaLexer::paper(style); +} + + +// Refresh all properties. +void QextScintillaLexerPOV::refreshProperties() +{ + setCommentProp(); + setCompactProp(); + setDirectiveProp(); +} + + +// Read properties from the settings. +bool QextScintillaLexerPOV::readProperties(QSettings &qs,const QString &prefix) +{ + int rc = TRUE; + bool ok, flag; + + // Read the fold comments flag. + flag = qs.readBoolEntry(prefix + "foldcomments",FALSE,&ok); + + if (ok) + fold_comments = flag; + else + rc = FALSE; + + // Read the fold compact flag. + flag = qs.readBoolEntry(prefix + "foldcompact",TRUE,&ok); + + if (ok) + fold_compact = flag; + else + rc = FALSE; + + // Read the fold directives flag. + flag = qs.readBoolEntry(prefix + "folddirectives",FALSE,&ok); + + if (ok) + fold_directives = flag; + else + rc = FALSE; + + return rc; +} + + +// Write properties to the settings. +bool QextScintillaLexerPOV::writeProperties(QSettings &qs,const QString &prefix) const +{ + int rc = TRUE; + + // Write the fold comments flag. + if (!qs.writeEntry(prefix + "foldcomments",fold_comments)) + rc = FALSE; + + // Write the fold compact flag. + if (!qs.writeEntry(prefix + "foldcompact",fold_compact)) + rc = FALSE; + + // Write the fold directives flag. + if (!qs.writeEntry(prefix + "folddirectives",fold_directives)) + rc = FALSE; + + return rc; +} + + +// Return TRUE if comments can be folded. +bool QextScintillaLexerPOV::foldComments() const +{ + return fold_comments; +} + + +// Set if comments can be folded. +void QextScintillaLexerPOV::setFoldComments(bool fold) +{ + fold_comments = fold; + + setCommentProp(); +} + + +// Set the "fold.comment" property. +void QextScintillaLexerPOV::setCommentProp() +{ + emit propertyChanged("fold.comment",(fold_comments ? "1" : "0")); +} + + +// Return TRUE if folds are compact. +bool QextScintillaLexerPOV::foldCompact() const +{ + return fold_compact; +} + + +// Set if folds are compact +void QextScintillaLexerPOV::setFoldCompact(bool fold) +{ + fold_compact = fold; + + setCompactProp(); +} + + +// Set the "fold.compact" property. +void QextScintillaLexerPOV::setCompactProp() +{ + emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); +} + + +// Return TRUE if directives can be folded. +bool QextScintillaLexerPOV::foldDirectives() const +{ + return fold_directives; +} + + +// Set if directives can be folded. +void QextScintillaLexerPOV::setFoldDirectives(bool fold) +{ + fold_directives = fold; + + setDirectiveProp(); +} + + +// Set the "fold.directive" property. +void QextScintillaLexerPOV::setDirectiveProp() +{ + emit propertyChanged("fold.directive",(fold_directives ? "1" : "0")); +} diff --git a/qt/qextscintillalexerpov.h b/qt/qextscintillalexerpov.h new file mode 100644 index 0000000..6314fe0 --- /dev/null +++ b/qt/qextscintillalexerpov.h @@ -0,0 +1,214 @@ +// This defines the interface to the QextScintillaLexerPOV class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERPOV_H +#define QEXTSCINTILLALEXERPOV_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerPOV class encapsulates the Scintilla POV +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerPOV : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! POV lexer. + enum { + //! The default. + Default = 0, + + //! A comment. + Comment = 1, + + //! A comment line. + CommentLine = 2, + + //! A number. + Number = 3, + + //! An operator. + Operator = 4, + + //! An identifier + Identifier = 5, + + //! A string. + String = 6, + + //! The end of a line where a string is not closed. + UnclosedString = 7, + + //! A directive. + Directive = 8, + + //! A bad directive. + BadDirective = 9, + + //! Objects, CSG and appearance. + ObjectsCSGAppearance = 10, + + //! Types, modifiers and items. + TypesModifiersItems = 11, + + //! Predefined identifiers. + PredefinedIdentifiers = 12, + + //! Predefined identifiers. + PredefinedFunctions = 13, + + //! A keyword defined in keyword set number 6. The class must + //! be sub-classed and re-implement keywords() to make use of + //! this style. + KeywordSet6 = 14, + + //! A keyword defined in keyword set number 7. The class must + //! be sub-classed and re-implement keywords() to make use of + //! this style. + KeywordSet7 = 15, + + //! A keyword defined in keyword set number 8. The class must + //! be sub-classed and re-implement keywords() to make use of + //! this style. + KeywordSet8 = 16 + }; + + //! Construct a QextScintillaLexerPOV with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerPOV(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerPOV instance. + virtual ~QextScintillaLexerPOV(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns the style used for braces for brace matching. + int braceStyle() const; + + //! \internal Returns the string of characters that comprise a word. + const char *wordCharacters() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool eolFill(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa color() + QColor paper(int style) const; + + //! Causes all properties to be refreshed by emitting the + //! propertyChanged() signal as required. + void refreshProperties(); + + //! Returns TRUE if multi-line comment blocks can be folded. + //! + //! \sa setFoldComments() + bool foldComments() const; + + //! Returns TRUE if trailing blank lines are included in a fold block. + //! + //! \sa setFoldCompact() + bool foldCompact() const; + + //! Returns TRUE if directives can be folded. + //! + //! \sa setFoldDirectives() + bool foldDirectives() const; + +public slots: + //! If \a fold is TRUE then multi-line comment blocks can be folded. + //! The default is FALSE. + //! + //! \sa foldComments() + virtual void setFoldComments(bool fold); + + //! If \a fold is TRUE then trailing blank lines are included in a fold + //! block. The default is TRUE. + //! + //! \sa foldCompact() + virtual void setFoldCompact(bool fold); + + //! If \a fold is TRUE then directives can be folded. The default is + //! FALSE. + //! + //! \sa foldDirectives() + virtual void setFoldDirectives(bool fold); + +protected: + //! The lexer's properties are read from the settings \a qs. \a prefix + //! (which has a trailing '/') should be used as a prefix to the key of + //! each setting. TRUE is returned if there is no error. + //! + bool readProperties(QSettings &qs,const QString &prefix); + + //! The lexer's properties are written to the settings \a qs. + //! \a prefix (which has a trailing '/') should be used as a prefix to + //! the key of each setting. TRUE is returned if there is no error. + //! + bool writeProperties(QSettings &qs,const QString &prefix) const; + +private: + void setCommentProp(); + void setCompactProp(); + void setDirectiveProp(); + + bool fold_comments; + bool fold_compact; + bool fold_directives; + +#if defined(Q_DISABLE_COPY) + QextScintillaLexerPOV(const QextScintillaLexerPOV &); + QextScintillaLexerPOV &operator=(const QextScintillaLexerPOV &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexerproperties.cpp b/qt/qextscintillalexerproperties.cpp new file mode 100644 index 0000000..fb35123 --- /dev/null +++ b/qt/qextscintillalexerproperties.cpp @@ -0,0 +1,204 @@ +// This module implements the QextScintillaLexerProperties class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexerproperties.h" + + +// The ctor. +QextScintillaLexerProperties::QextScintillaLexerProperties(QObject *parent,const char *name) + : QextScintillaLexer(parent,name), fold_compact(TRUE) +{ +} + + +// The dtor. +QextScintillaLexerProperties::~QextScintillaLexerProperties() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerProperties::language() const +{ + return "Properties"; +} + + +// Returns the lexer name. +const char *QextScintillaLexerProperties::lexer() const +{ + return "props"; +} + + +// Return the string of characters that comprise a word. +const char *QextScintillaLexerProperties::wordCharacters() const +{ + return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerProperties::color(int style) const +{ + switch (style) + { + case Comment: + return QColor(0x00,0x7f,0x7f); + + case Section: + return QColor(0x7f,0x00,0x7f); + + case Assignment: + return QColor(0xb0,0x60,0x00); + + case DefaultValue: + return QColor(0x7f,0x7f,0x00); + } + + return QextScintillaLexer::color(style); +} + + +// Returns the end-of-line fill for a style. +bool QextScintillaLexerProperties::eolFill(int style) const +{ + return (style == Section); +} + + +// Returns the font of the text for a style. +QFont QextScintillaLexerProperties::font(int style) const +{ + QFont f; + + if (style == Comment) +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + else + f = QextScintillaLexer::font(style); + + return f; +} + + +// Returns the user name of a style. +QString QextScintillaLexerProperties::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Comment: + return tr("Comment"); + + case Section: + return tr("Section"); + + case Assignment: + return tr("Assignment"); + + case DefaultValue: + return tr("Default value"); + } + + return QString::null; +} + + +// Returns the background colour of the text for a style. +QColor QextScintillaLexerProperties::paper(int style) const +{ + if (style == Section) + return QColor(0xe0,0xf0,0xf0); + + return QextScintillaLexer::paper(style); +} + + +// Refresh all properties. +void QextScintillaLexerProperties::refreshProperties() +{ + setCompactProp(); +} + + +// Read properties from the settings. +bool QextScintillaLexerProperties::readProperties(QSettings &qs,const QString &prefix) +{ + int rc = TRUE; + bool ok, flag; + + // Read the fold compact flag. + flag = qs.readBoolEntry(prefix + "foldcompact",TRUE,&ok); + + if (ok) + fold_compact = flag; + else + rc = FALSE; + + return rc; +} + + +// Write properties to the settings. +bool QextScintillaLexerProperties::writeProperties(QSettings &qs,const QString &prefix) const +{ + int rc = TRUE; + + // Write the fold compact flag. + if (!qs.writeEntry(prefix + "foldcompact",fold_compact)) + rc = FALSE; + + return rc; +} + + +// Return TRUE if folds are compact. +bool QextScintillaLexerProperties::foldCompact() const +{ + return fold_compact; +} + + +// Set if folds are compact +void QextScintillaLexerProperties::setFoldCompact(bool fold) +{ + fold_compact = fold; + + setCompactProp(); +} + + +// Set the "fold.compact" property. +void QextScintillaLexerProperties::setCompactProp() +{ + emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); +} diff --git a/qt/qextscintillalexerproperties.h b/qt/qextscintillalexerproperties.h new file mode 100644 index 0000000..466fe57 --- /dev/null +++ b/qt/qextscintillalexerproperties.h @@ -0,0 +1,141 @@ +// This defines the interface to the QextScintillaLexerProperties class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERPROPERTIES_H +#define QEXTSCINTILLALEXERPROPERTIES_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerProperties class encapsulates the Scintilla +//! Properties lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerProperties : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! Properties lexer. + enum { + //! The default. + Default = 0, + + //! A comment. + Comment = 1, + + //! A section. + Section = 2, + + //! An assignment operator. + Assignment = 3, + + //! A default value. + DefaultValue = 4 + }; + + //! Construct a QextScintillaLexerProperties with parent \a parent and + //! name \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerProperties(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerProperties instance. + virtual ~QextScintillaLexerProperties(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns the string of characters that comprise a word. + const char *wordCharacters() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool eolFill(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa color() + QColor paper(int style) const; + + //! Causes all properties to be refreshed by emitting the + //! propertyChanged() signal as required. + void refreshProperties(); + + //! Returns TRUE if trailing blank lines are included in a fold block. + //! + //! \sa setFoldCompact() + bool foldCompact() const; + +public slots: + //! If \a fold is TRUE then trailing blank lines are included in a fold + //! block. The default is TRUE. + //! + //! \sa foldCompact() + virtual void setFoldCompact(bool fold); + +protected: + //! The lexer's properties are read from the settings \a qs. \a prefix + //! (which has a trailing '/') should be used as a prefix to the key of + //! each setting. TRUE is returned if there is no error. + //! + //! \sa writeProperties() + bool readProperties(QSettings &qs,const QString &prefix); + + //! The lexer's properties are written to the settings \a qs. + //! \a prefix (which has a trailing '/') should be used as a prefix to + //! the key of each setting. TRUE is returned if there is no error. + //! + //! \sa readProperties() + bool writeProperties(QSettings &qs,const QString &prefix) const; + +private: + void setCompactProp(); + + bool fold_compact; + +#if defined(Q_DISABLE_COPY) + QextScintillaLexerProperties(const QextScintillaLexerProperties &); + QextScintillaLexerProperties &operator=(const QextScintillaLexerProperties &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexerpython.cpp b/qt/qextscintillalexerpython.cpp new file mode 100644 index 0000000..b6252ae --- /dev/null +++ b/qt/qextscintillalexerpython.cpp @@ -0,0 +1,407 @@ +// This module implements the QextScintillaLexerPython class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexerpython.h" + + +// The list of Python keywords that can be used by other friendly lexers. +const char *QextScintillaLexerPython::keywordClass = + "and assert break class continue def del elif else except exec " + "finally for from global if import in is lambda None not or pass " + "print raise return try while yield"; + + +// The ctor. +QextScintillaLexerPython::QextScintillaLexerPython(QObject *parent, + const char *name) + : QextScintillaLexer(parent,name), fold_comments(FALSE), + fold_quotes(FALSE), indent_warn(NoWarning) +{ +} + + +// The dtor. +QextScintillaLexerPython::~QextScintillaLexerPython() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerPython::language() const +{ + return "Python"; +} + + +// Returns the lexer name. +const char *QextScintillaLexerPython::lexer() const +{ + return "python"; +} + + +// Return the set of characters that can start autocompletion. +const char *QextScintillaLexerPython::autoCompletionStartCharacters() const +{ + return "."; +} + + +// Return the list of characters that can start a block. +const char *QextScintillaLexerPython::blockStart(int *style) const +{ + if (style) + *style = Operator; + + return ":"; +} + + +// Return the number of lines to look back when auto-indenting. +int QextScintillaLexerPython::blockLookback() const +{ + // This must be 0 otherwise de-indenting a Python block gets very + // difficult. + return 0; +} + + +// Return the style used for braces. +int QextScintillaLexerPython::braceStyle() const +{ + return Operator; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerPython::color(int style) const +{ + switch (style) + { + case Default: + return QColor(0x80,0x80,0x80); + + case Comment: + return QColor(0x00,0x7f,0x00); + + case Number: + return QColor(0x00,0x7f,0x7f); + + case DoubleQuotedString: + case SingleQuotedString: + return QColor(0x7f,0x00,0x7f); + + case Keyword: + return QColor(0x00,0x00,0x7f); + + case TripleSingleQuotedString: + case TripleDoubleQuotedString: + return QColor(0x7f,0x00,0x00); + + case ClassName: + return QColor(0x00,0x00,0xff); + + case FunctionMethodName: + return QColor(0x00,0x7f,0x7f); + + case Operator: + case Identifier: + break; + + case CommentBlock: + return QColor(0x7f,0x7f,0x7f); + + case UnclosedString: + return QColor(0x00,0x00,0x00); + + case HighlightedIdentifier: + return QColor(0x40,0x70,0x90); + + case Decorator: + return QColor(0x80,0x50,0x00); + } + + return QextScintillaLexer::color(style); +} + + +// Returns the end-of-line fill for a style. +bool QextScintillaLexerPython::eolFill(int style) const +{ + return (style == UnclosedString); +} + + +// Returns the font of the text for a style. +QFont QextScintillaLexerPython::font(int style) const +{ + QFont f; + + switch (style) + { + case Comment: +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + break; + + case DoubleQuotedString: + case SingleQuotedString: + case UnclosedString: +#if defined(Q_OS_WIN) + f = QFont("Courier New",10); +#else + f = QFont("Bitstream Vera Sans Mono",9); +#endif + break; + + case Keyword: + case ClassName: + case FunctionMethodName: + case Operator: + f = QextScintillaLexer::font(style); + f.setBold(TRUE); + break; + + default: + f = QextScintillaLexer::font(style); + } + + return f; +} + + +// Returns the set of keywords. +const char *QextScintillaLexerPython::keywords(int set) const +{ + if (set != 1) + return 0; + + return keywordClass; +} + + +// Returns the user name of a style. +QString QextScintillaLexerPython::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Comment: + return tr("Comment"); + + case Number: + return tr("Number"); + + case DoubleQuotedString: + return tr("Double-quoted string"); + + case SingleQuotedString: + return tr("Single-quoted string"); + + case Keyword: + return tr("Keyword"); + + case TripleSingleQuotedString: + return tr("Triple single-quoted string"); + + case TripleDoubleQuotedString: + return tr("Triple double-quoted string"); + + case ClassName: + return tr("Class name"); + + case FunctionMethodName: + return tr("Function or method name"); + + case Operator: + return tr("Operator"); + + case Identifier: + return tr("Identifier"); + + case CommentBlock: + return tr("Comment block"); + + case UnclosedString: + return tr("Unclosed string"); + + case HighlightedIdentifier: + return tr("Highlighted identifier"); + + case Decorator: + return tr("Decorator"); + } + + return QString::null; +} + + +// Returns the background colour of the text for a style. +QColor QextScintillaLexerPython::paper(int style) const +{ + if (style == UnclosedString) + return QColor(0xe0,0xc0,0xe0); + + return QextScintillaLexer::paper(style); +} + + +// Refresh all properties. +void QextScintillaLexerPython::refreshProperties() +{ + setCommentProp(); + setQuotesProp(); + setTabWhingeProp(); +} + + +// Read properties from the settings. +bool QextScintillaLexerPython::readProperties(QSettings &qs,const QString &prefix) +{ + int rc = TRUE, num; + bool ok, flag; + + // Read the fold comments flag. + flag = qs.readBoolEntry(prefix + "foldcomments",FALSE,&ok); + + if (ok) + fold_comments = flag; + else + rc = FALSE; + + // Read the fold quotes flag. + flag = qs.readBoolEntry(prefix + "foldquotes",FALSE,&ok); + + if (ok) + fold_quotes = flag; + else + rc = FALSE; + + // Read the indentation warning. + num = qs.readNumEntry(prefix + "indentwarning",(int)NoWarning,&ok); + + if (ok) + indent_warn = (IndentationWarning)num; + else + rc = FALSE; + + return rc; +} + + +// Write properties to the settings. +bool QextScintillaLexerPython::writeProperties(QSettings &qs,const QString &prefix) const +{ + int rc = TRUE; + + // Write the fold comments flag. + if (!qs.writeEntry(prefix + "foldcomments",fold_comments)) + rc = FALSE; + + // Write the fold quotes flag. + if (!qs.writeEntry(prefix + "foldquotes",fold_quotes)) + rc = FALSE; + + // Write the indentation warning. + if (!qs.writeEntry(prefix + "indentwarning",(int)indent_warn)) + rc = FALSE; + + return rc; +} + + +// Return TRUE if comments can be folded. +bool QextScintillaLexerPython::foldComments() const +{ + return fold_comments; +} + + +// Set if comments can be folded. +void QextScintillaLexerPython::setFoldComments(bool fold) +{ + fold_comments = fold; + + setCommentProp(); +} + + +// Set the "fold.comment.python" property. +void QextScintillaLexerPython::setCommentProp() +{ + emit propertyChanged("fold.comment.python",(fold_comments ? "1" : "0")); +} + + +// Return TRUE if quotes can be folded. +bool QextScintillaLexerPython::foldQuotes() const +{ + return fold_quotes; +} + + +// Set if quotes can be folded. +void QextScintillaLexerPython::setFoldQuotes(bool fold) +{ + fold_quotes = fold; + + setQuotesProp(); +} + + +// Set the "fold.quotes.python" property. +void QextScintillaLexerPython::setQuotesProp() +{ + emit propertyChanged("fold.quotes.python",(fold_quotes ? "1" : "0")); +} + + +// Return the indentation warning. +QextScintillaLexerPython::IndentationWarning QextScintillaLexerPython::indentationWarning() const +{ + return indent_warn; +} + + +// Set the indentation warning. +void QextScintillaLexerPython::setIndentationWarning(IndentationWarning warn) +{ + indent_warn = warn; + + setTabWhingeProp(); +} + + +// Set the "tab.timmy.whinge.level" property. +void QextScintillaLexerPython::setTabWhingeProp() +{ + emit propertyChanged("tab.timmy.whinge.level",QString::number(indent_warn)); +} diff --git a/qt/qextscintillalexerpython.h b/qt/qextscintillalexerpython.h new file mode 100644 index 0000000..b5edb3e --- /dev/null +++ b/qt/qextscintillalexerpython.h @@ -0,0 +1,244 @@ +// This defines the interface to the QextScintillaLexerPython class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERPYTHON_H +#define QEXTSCINTILLALEXERPYTHON_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerPython class encapsulates the Scintilla Python +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerPython : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! Python lexer. + enum { + //! The default. + Default = 0, + + //! \deprecated White space. + WhiteSpace = Default, + + //! A comment. + Comment = 1, + + //! A number. + Number = 2, + + //! A double-quoted string. + DoubleQuotedString = 3, + + //! A single-quoted string. + SingleQuotedString = 4, + + //! A keyword. + Keyword = 5, + + //! A triple single-quoted string. + TripleSingleQuotedString = 6, + + //! A triple double-quoted string. + TripleDoubleQuotedString = 7, + + //! The name of a class. + ClassName = 8, + + //! The name of a function or method. + FunctionMethodName = 9, + + //! An operator. + Operator = 10, + + //! An identifier + Identifier = 11, + + //! A comment block. + CommentBlock = 12, + + //! The end of a line where a string is not closed. + UnclosedString = 13, + + //! A highlighted identifier. These are defined by keyword set + //! 2. Reimplement keywords() to define keyword set 2. + HighlightedIdentifier = 14, + + //! A decorator. + Decorator = 15 + }; + + //! This enum defines the different conditions that can cause + //! indentations to be displayed as being bad. + enum IndentationWarning { + //! Bad indentation is not displayed differently. + NoWarning = 0, + + //! The indentation is inconsistent when compared to the + //! previous line, ie. it is made up of a different combination + //! of tabs and/or spaces. + Inconsistent = 1, + + //! The indentation is made up of spaces followed by tabs. + TabsAfterSpaces = 2, + + //! The indentation contains spaces. + Spaces = 3, + + //! The indentation contains tabs. + Tabs = 4 + }; + + //! Construct a QextScintillaLexerPython with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerPython(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerPython instance. + virtual ~QextScintillaLexerPython(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns the characters that can start auto-completion. + const char *autoCompletionStartCharacters() const; + + //! \internal Returns the number of lines prior to the current one when + //! determining the scope of a block when auto-indenting. + int blockLookback() const; + + //! \internal Returns a space separated list of words or characters in + //! a particular style that define the start of a block for + //! auto-indentation. The styles is returned via \a style. + const char *blockStart(int *style = 0) const; + + //! \internal Returns the style used for braces for brace matching. + int braceStyle() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool eolFill(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa color() + QColor paper(int style) const; + + //! Causes all properties to be refreshed by emitting the + //! propertyChanged() signal as required. + void refreshProperties(); + + //! Returns TRUE if indented comment blocks can be folded. + //! + //! \sa setFoldComments() + bool foldComments() const; + + //! Returns TRUE if triple quoted strings can be folded. + //! + //! \sa setFoldQuotes() + bool foldQuotes() const; + + //! Returns the condition that will cause bad indentations to be + //! displayed. + //! + //! \sa setIndentationWarning() + IndentationWarning indentationWarning() const; + +public slots: + //! If \a fold is TRUE then indented comment blocks can be folded. The + //! default is FALSE. + //! + //! \sa foldComments() + virtual void setFoldComments(bool fold); + + //! If \a fold is TRUE then triple quoted strings can be folded. The + //! default is FALSE. + //! + //! \sa foldQuotes() + virtual void setFoldQuotes(bool fold); + + //! Sets the condition that will cause bad indentations to be + //! displayed. + //! + //! \sa indentationWarning() + virtual void setIndentationWarning(IndentationWarning warn); + +protected: + //! The lexer's properties are read from the settings \a qs. \a prefix + //! (which has a trailing '/') should be used as a prefix to the key of + //! each setting. TRUE is returned if there is no error. + //! + bool readProperties(QSettings &qs,const QString &prefix); + + //! The lexer's properties are written to the settings \a qs. + //! \a prefix (which has a trailing '/') should be used as a prefix to + //! the key of each setting. TRUE is returned if there is no error. + //! + bool writeProperties(QSettings &qs,const QString &prefix) const; + +private: + void setCommentProp(); + void setQuotesProp(); + void setTabWhingeProp(); + + bool fold_comments; + bool fold_quotes; + IndentationWarning indent_warn; + + friend class QextScintillaLexerHTML; + + static const char *keywordClass; + +#if defined(Q_DISABLE_COPY) + QextScintillaLexerPython(const QextScintillaLexerPython &); + QextScintillaLexerPython &operator=(const QextScintillaLexerPython &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexerruby.cpp b/qt/qextscintillalexerruby.cpp new file mode 100644 index 0000000..6ecce01 --- /dev/null +++ b/qt/qextscintillalexerruby.cpp @@ -0,0 +1,380 @@ +// This module implements the QextScintillaLexerRuby class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexerruby.h" + + +// The ctor. +QextScintillaLexerRuby::QextScintillaLexerRuby(QObject *parent, + const char *name) + : QextScintillaLexer(parent, name) +{ +} + + +// The dtor. +QextScintillaLexerRuby::~QextScintillaLexerRuby() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerRuby::language() const +{ + return "Ruby"; +} + + +// Returns the lexer name. +const char *QextScintillaLexerRuby::lexer() const +{ + return "ruby"; +} + + +// Return the list of words that can start a block. +const char *QextScintillaLexerRuby::blockStart(int *style) const +{ + if (style) + *style = Keyword; + + return "do"; +} + + +// Return the list of words that can start end a block. +const char *QextScintillaLexerRuby::blockEnd(int *style) const +{ + if (style) + *style = Keyword; + + return "end"; +} + + +// Return the list of words that can start end a block. +const char *QextScintillaLexerRuby::blockStartKeyword(int *style) const +{ + if (style) + *style = Keyword; + + return "def class if do elsif else case while for"; +} + + +// Return the style used for braces. +int QextScintillaLexerRuby::braceStyle() const +{ + return Operator; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerRuby::color(int style) const +{ + switch (style) + { + case Default: + return QColor(0x80,0x80,0x80); + + case Comment: + return QColor(0x00,0x7f,0x00); + + case POD: + return QColor(0x00,0x40,0x00); + + case Number: + case FunctionMethodName: + return QColor(0x00,0x7f,0x7f); + + case Keyword: + case DemotedKeyword: + return QColor(0x00,0x00,0x7f); + + case DoubleQuotedString: + case SingleQuotedString: + case HereDocument: + case PercentStringq: + case PercentStringQ: + return QColor(0x7f,0x00,0x7f); + + case ClassName: + return QColor(0x00,0x00,0xff); + + case Regex: + case HereDocumentDelimiter: + case PercentStringr: + case PercentStringw: + return QColor(0x00,0x00,0x00); + + case Global: + return QColor(0x80,0x00,0x80); + + case Symbol: + return QColor(0xc0,0xa0,0x30); + + case ModuleName: + return QColor(0xa0,0x00,0xa0); + + case InstanceVariable: + return QColor(0xb0,0x00,0x80); + + case ClassVariable: + return QColor(0x80,0x00,0xb0); + + case Backticks: + case PercentStringx: + return QColor(0xff,0xff,0x00); + + case DataSection: + return QColor(0x60,0x00,0x00); + } + + return QextScintillaLexer::color(style); +} + + +// Returns the end-of-line fill for a style. +bool QextScintillaLexerRuby::eolFill(int style) const +{ + bool fill; + + switch (style) + { + case POD: + case DataSection: + case HereDocument: + fill = true; + break; + + default: + fill = false; + } + + return fill; +} + + +// Returns the font of the text for a style. +QFont QextScintillaLexerRuby::font(int style) const +{ + QFont f; + + switch (style) + { + case Comment: +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + break; + + case POD: + case DoubleQuotedString: + case SingleQuotedString: + case PercentStringq: + case PercentStringQ: +#if defined(Q_OS_WIN) + f = QFont("Courier New",10); +#else + f = QFont("Bitstream Vera Sans Mono",9); +#endif + break; + + case Keyword: + case ClassName: + case FunctionMethodName: + case Operator: + case ModuleName: + case DemotedKeyword: + f = QextScintillaLexer::font(style); + f.setBold(TRUE); + break; + + default: + f = QextScintillaLexer::font(style); + } + + return f; +} + + +// Returns the set of keywords. +const char *QextScintillaLexerRuby::keywords(int set) const +{ + if (set == 1) + return + "__FILE__ and def end in or self unless __LINE__ " + "begin defined? ensure module redo super until BEGIN " + "break do false next rescue then when END case else " + "for nil require retry true while alias class elsif " + "if not return undef yield"; + + return 0; +} + + +// Returns the user name of a style. +QString QextScintillaLexerRuby::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Error: + return tr("Error"); + + case Comment: + return tr("Comment"); + + case POD: + return tr("POD"); + + case Number: + return tr("Number"); + + case Keyword: + return tr("Keyword"); + + case DoubleQuotedString: + return tr("Double-quoted string"); + + case SingleQuotedString: + return tr("Single-quoted string"); + + case ClassName: + return tr("Class name"); + + case FunctionMethodName: + return tr("Function or method name"); + + case Operator: + return tr("Operator"); + + case Identifier: + return tr("Identifier"); + + case Regex: + return tr("Regular expression"); + + case Global: + return tr("Global"); + + case Symbol: + return tr("Symbol"); + + case ModuleName: + return tr("Module name"); + + case InstanceVariable: + return tr("Instance variable"); + + case ClassVariable: + return tr("Class variable"); + + case Backticks: + return tr("Backticks"); + + case DataSection: + return tr("Data section"); + + case HereDocumentDelimiter: + return tr("Here document delimiter"); + + case HereDocument: + return tr("Here document"); + + case PercentStringq: + return tr("%q string"); + + case PercentStringQ: + return tr("%Q string"); + + case PercentStringx: + return tr("%x string"); + + case PercentStringr: + return tr("%r string"); + + case PercentStringw: + return tr("%w string"); + + case DemotedKeyword: + return tr("Demoted keyword"); + + case Stdin: + return tr("stdin"); + + case Stdout: + return tr("stdout"); + + case Stderr: + return tr("stderr"); + } + + return QString::null; +} + + +// Returns the background colour of the text for a style. +QColor QextScintillaLexerRuby::paper(int style) const +{ + switch (style) + { + case Error: + return QColor(0xff,0x00,0x00); + + case POD: + return QColor(0xc0,0xff,0xc0); + + case Regex: + case PercentStringr: + return QColor(0xa0,0xff,0xa0); + + case Backticks: + case PercentStringx: + return QColor(0xa0,0x80,0x80); + + case DataSection: + return QColor(0xff,0xf0,0xd8); + + case HereDocumentDelimiter: + case HereDocument: + return QColor(0xdd,0xd0,0xdd); + + case PercentStringw: + return QColor(0xff,0xff,0xe0); + + case Stdin: + case Stdout: + case Stderr: + return QColor(0xff,0x80,0x80); + } + + return QextScintillaLexer::paper(style); +} diff --git a/qt/qextscintillalexerruby.h b/qt/qextscintillalexerruby.h new file mode 100644 index 0000000..96918eb --- /dev/null +++ b/qt/qextscintillalexerruby.h @@ -0,0 +1,203 @@ +// This defines the interface to the QextScintillaLexerRuby class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERRUBY_H +#define QEXTSCINTILLALEXERRUBY_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerRuby class encapsulates the Scintilla Ruby +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerRuby : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! Ruby lexer. + enum { + //! The default. + Default = 0, + + //! An error. + Error = 1, + + //! A comment. + Comment = 2, + + //! A POD. + POD = 3, + + //! A number. + Number = 4, + + //! A keyword. + Keyword = 5, + + //! A double-quoted string. + DoubleQuotedString = 6, + + //! A single-quoted string. + SingleQuotedString = 7, + + //! The name of a class. + ClassName = 8, + + //! The name of a function or method. + FunctionMethodName = 9, + + //! An operator. + Operator = 10, + + //! An identifier + Identifier = 11, + + //! A regular expression. + Regex = 12, + + //! A global. + Global = 13, + + //! A symbol. + Symbol = 14, + + //! The name of a module. + ModuleName = 15, + + //! An instance variable. + InstanceVariable = 16, + + //! A class variable. + ClassVariable = 17, + + //! Backticks. + Backticks = 18, + + //! A data section. + DataSection = 19, + + //! A here document delimiter. + HereDocumentDelimiter = 20, + + //! A here document. + HereDocument = 21, + + //! A %q string. + PercentStringq = 24, + + //! A %Q string. + PercentStringQ = 25, + + //! A %x string. + PercentStringx = 26, + + //! A %r string. + PercentStringr = 27, + + //! A %w string. + PercentStringw = 28, + + //! A demoted keyword. + DemotedKeyword = 29, + + //! stdin. + Stdin = 30, + + //! stdout. + Stdout = 31, + + //! stderr. + Stderr = 40 + }; + + //! Construct a QextScintillaLexerRuby with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerRuby(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerRuby instance. + virtual ~QextScintillaLexerRuby(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns a space separated list of words or characters in + //! a particular style that define the end of a block for + //! auto-indentation. The style is returned via \a style. + const char *blockEnd(int *style = 0) const; + + //! \internal Returns a space separated list of words or characters in + //! a particular style that define the start of a block for + //! auto-indentation. The styles is returned via \a style. + const char *blockStart(int *style = 0) const; + + //! \internal Returns a space separated list of keywords in a + //! particular style that define the start of a block for + //! auto-indentation. The style is returned via \a style. + const char *blockStartKeyword(int *style = 0) const; + + //! \internal Returns the style used for braces for brace matching. + int braceStyle() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool eolFill(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa color() + QColor paper(int style) const; + +private: +#if defined(Q_DISABLE_COPY) + QextScintillaLexerRuby(const QextScintillaLexerRuby &); + QextScintillaLexerRuby &operator=(const QextScintillaLexerRuby &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexersql.cpp b/qt/qextscintillalexersql.cpp new file mode 100644 index 0000000..8b7092e --- /dev/null +++ b/qt/qextscintillalexersql.cpp @@ -0,0 +1,452 @@ +// This module implements the QextScintillaLexerSQL class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexersql.h" + + +// The ctor. +QextScintillaLexerSQL::QextScintillaLexerSQL(QObject *parent,const char *name) + : QextScintillaLexer(parent,name), fold_comments(FALSE), + fold_compact(TRUE), backslash_escapes(FALSE) +{ +} + + +// The dtor. +QextScintillaLexerSQL::~QextScintillaLexerSQL() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerSQL::language() const +{ + return "SQL"; +} + + +// Returns the lexer name. +const char *QextScintillaLexerSQL::lexer() const +{ + return "sql"; +} + + +// Return the style used for braces. +int QextScintillaLexerSQL::braceStyle() const +{ + return Operator; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerSQL::color(int style) const +{ + switch (style) + { + case Default: + return QColor(0x80,0x80,0x80); + + case Comment: + case CommentLine: + case PlusPrompt: + case PlusComment: + case CommentLineHash: + return QColor(0x00,0x7f,0x00); + + case CommentDoc: + return QColor(0x7f,0x7f,0x7f); + + case Number: + return QColor(0x00,0x7f,0x7f); + + case Keyword: + return QColor(0x00,0x00,0x7f); + + case DoubleQuotedString: + case SingleQuotedString: + return QColor(0x7f,0x00,0x7f); + + case PlusKeyword: + return QColor(0x7f,0x7f,0x00); + + case Operator: + case Identifier: + break; + + case CommentDocKeyword: + return QColor(0x30,0x60,0xa0); + + case CommentDocKeywordError: + return QColor(0x80,0x40,0x20); + + case KeywordSet5: + return QColor(0x4b,0x00,0x82); + + case KeywordSet6: + return QColor(0xb0,0x00,0x40); + + case KeywordSet7: + return QColor(0x8b,0x00,0x00); + + case KeywordSet8: + return QColor(0x80,0x00,0x80); + } + + return QextScintillaLexer::color(style); +} + + +// Returns the end-of-line fill for a style. +bool QextScintillaLexerSQL::eolFill(int style) const +{ + return (style == PlusPrompt); +} + + +// Returns the font of the text for a style. +QFont QextScintillaLexerSQL::font(int style) const +{ + QFont f; + + switch (style) + { + case Comment: + case CommentLine: + case PlusComment: + case CommentLineHash: + case CommentDocKeyword: + case CommentDocKeywordError: +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + break; + + case Keyword: + case Operator: + f = QextScintillaLexer::font(style); + f.setBold(TRUE); + break; + + case DoubleQuotedString: + case SingleQuotedString: + case PlusPrompt: +#if defined(Q_OS_WIN) + f = QFont("Courier New",10); +#else + f = QFont("Bitstream Vera Sans Mono",9); +#endif + break; + + default: + f = QextScintillaLexer::font(style); + } + + return f; +} + + +// Returns the set of keywords. +const char *QextScintillaLexerSQL::keywords(int set) const +{ + if (set == 1) + return + "absolute action add admin after aggregate alias all " + "allocate alter and any are array as asc assertion " + "at authorization before begin binary bit blob " + "boolean both breadth by call cascade cascaded case " + "cast catalog char character check class clob close " + "collate collation column commit completion connect " + "connection constraint constraints constructor " + "continue corresponding create cross cube current " + "current_date current_path current_role current_time " + "current_timestamp current_user cursor cycle data " + "date day deallocate dec decimal declare default " + "deferrable deferred delete depth deref desc " + "describe descriptor destroy destructor " + "deterministic dictionary diagnostics disconnect " + "distinct domain double drop dynamic each else end " + "end-exec equals escape every except exception exec " + "execute external false fetch first float for " + "foreign found from free full function general get " + "global go goto grant group grouping having host " + "hour identity if ignore immediate in indicator " + "initialize initially inner inout input insert int " + "integer intersect interval into is isolation " + "iterate join key language large last lateral " + "leading left less level like limit local localtime " + "localtimestamp locator map match minute modifies " + "modify module month names national natural nchar " + "nclob new next no none not null numeric object of " + "off old on only open operation option or order " + "ordinality out outer output pad parameter " + "parameters partial path postfix precision prefix " + "preorder prepare preserve primary prior privileges " + "procedure public read reads real recursive ref " + "references referencing relative restrict result " + "return returns revoke right role rollback rollup " + "routine row rows savepoint schema scroll scope " + "search second section select sequence session " + "session_user set sets size smallint some| space " + "specific specifictype sql sqlexception sqlstate " + "sqlwarning start state statement static structure " + "system_user table temporary terminate than then " + "time timestamp timezone_hour timezone_minute to " + "trailing transaction translation treat trigger " + "true under union unique unknown unnest update usage " + "user using value values varchar variable varying " + "view when whenever where with without work write " + "year zone"; + + if (set == 4) + return + "acc~ept a~ppend archive log attribute bre~ak " + "bti~tle c~hange cl~ear col~umn comp~ute conn~ect " + "copy def~ine del desc~ribe disc~onnect e~dit " + "exec~ute exit get help ho~st i~nput l~ist passw~ord " + "pau~se pri~nt pro~mpt quit recover rem~ark " + "repf~ooter reph~eader r~un sav~e set sho~w shutdown " + "spo~ol sta~rt startup store timi~ng tti~tle " + "undef~ine var~iable whenever oserror whenever " + "sqlerror"; + + return 0; +} + + +// Returns the user name of a style. +QString QextScintillaLexerSQL::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Comment: + return tr("Comment"); + + case CommentLine: + return tr("Comment line"); + + case CommentDoc: + return tr("JavaDoc style comment"); + + case Number: + return tr("Number"); + + case Keyword: + return tr("Keyword"); + + case DoubleQuotedString: + return tr("Double-quoted string"); + + case SingleQuotedString: + return tr("Single-quoted string"); + + case PlusKeyword: + return tr("SQL*Plus keyword"); + + case PlusPrompt: + return tr("SQL*Plus prompt"); + + case Operator: + return tr("Operator"); + + case Identifier: + return tr("Identifier"); + + case PlusComment: + return tr("SQL*Plus comment"); + + case CommentLineHash: + return tr("# comment line"); + + case CommentDocKeyword: + return tr("JavaDoc keyword"); + + case CommentDocKeywordError: + return tr("JavaDoc keyword error"); + + case KeywordSet5: + return tr("User defined 1"); + + case KeywordSet6: + return tr("User defined 2"); + + case KeywordSet7: + return tr("User defined 3"); + + case KeywordSet8: + return tr("User defined 4"); + } + + return QString::null; +} + + +// Returns the background colour of the text for a style. +QColor QextScintillaLexerSQL::paper(int style) const +{ + if (style == PlusPrompt) + return QColor(0xe0,0xff,0xe0); + + return QextScintillaLexer::paper(style); +} + + +// Refresh all properties. +void QextScintillaLexerSQL::refreshProperties() +{ + setCommentProp(); + setCompactProp(); + setBackslashEscapesProp(); +} + + +// Read properties from the settings. +bool QextScintillaLexerSQL::readProperties(QSettings &qs,const QString &prefix) +{ + int rc = TRUE; + bool ok, flag; + + // Read the fold comments flag. + flag = qs.readBoolEntry(prefix + "foldcomments",FALSE,&ok); + + if (ok) + fold_comments = flag; + else + rc = FALSE; + + // Read the fold compact flag. + flag = qs.readBoolEntry(prefix + "foldcompact",TRUE,&ok); + + if (ok) + fold_compact = flag; + else + rc = FALSE; + + // Read the backslash escapes flag. + flag = qs.readBoolEntry(prefix + "backslashescapes",FALSE,&ok); + + if (ok) + backslash_escapes = flag; + else + rc = FALSE; + + return rc; +} + + +// Write properties to the settings. +bool QextScintillaLexerSQL::writeProperties(QSettings &qs,const QString &prefix) const +{ + int rc = TRUE; + + // Write the fold comments flag. + if (!qs.writeEntry(prefix + "foldcomments",fold_comments)) + rc = FALSE; + + // Write the fold compact flag. + if (!qs.writeEntry(prefix + "foldcompact",fold_compact)) + rc = FALSE; + + // Write the backslash escapes flag. + if (!qs.writeEntry(prefix + "backslashescapes",backslash_escapes)) + rc = FALSE; + + return rc; +} + + +// Return TRUE if comments can be folded. +bool QextScintillaLexerSQL::foldComments() const +{ + return fold_comments; +} + + +// Set if comments can be folded. +void QextScintillaLexerSQL::setFoldComments(bool fold) +{ + fold_comments = fold; + + setCommentProp(); +} + + +// Set the "fold.comment" property. +void QextScintillaLexerSQL::setCommentProp() +{ + emit propertyChanged("fold.comment",(fold_comments ? "1" : "0")); +} + + +// Return TRUE if folds are compact. +bool QextScintillaLexerSQL::foldCompact() const +{ + return fold_compact; +} + + +// Set if folds are compact +void QextScintillaLexerSQL::setFoldCompact(bool fold) +{ + fold_compact = fold; + + setCompactProp(); +} + + +// Set the "fold.compact" property. +void QextScintillaLexerSQL::setCompactProp() +{ + emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); +} + + +// Return TRUE if backslash escapes are enabled. +bool QextScintillaLexerSQL::backslashEscapes() const +{ + return backslash_escapes; +} + + +// Enable/disable backslash escapes. +void QextScintillaLexerSQL::setBackslashEscapes(bool enable) +{ + backslash_escapes = enable; + + setBackslashEscapesProp(); +} + + +// Set the "sql.backslash.escapes" property. +void QextScintillaLexerSQL::setBackslashEscapesProp() +{ + emit propertyChanged("sql.backslash.escapes",(backslash_escapes ? "1" : "0")); +} diff --git a/qt/qextscintillalexersql.h b/qt/qextscintillalexersql.h new file mode 100644 index 0000000..ca94825 --- /dev/null +++ b/qt/qextscintillalexersql.h @@ -0,0 +1,226 @@ +// This defines the interface to the QextScintillaLexerSQL class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERSQL_H +#define QEXTSCINTILLALEXERSQL_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerSQL class encapsulates the Scintilla SQL +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerSQL : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! SQL lexer. + enum { + //! The default. + Default = 0, + + //! A comment. + Comment = 1, + + //! A line comment. + CommentLine = 2, + + //! \deprecated A line comment. + LineComment = CommentLine, + + //! A JavaDoc/Doxygen style comment. + CommentDoc = 3, + + //! A number. + Number = 4, + + //! A keyword. + Keyword = 5, + + //! A double-quoted string. + DoubleQuotedString = 6, + + //! A single-quoted string. + SingleQuotedString = 7, + + //! An SQL*Plus keyword. + PlusKeyword = 8, + + //! An SQL*Plus prompt. + PlusPrompt = 9, + + //! An operator. + Operator = 10, + + //! An identifier + Identifier = 11, + + //! An SQL*Plus comment. + PlusComment = 13, + + //! A '#' line comment. + CommentLineHash = 15, + + //! A JavaDoc/Doxygen keyword. + CommentDocKeyword = 17, + + //! A JavaDoc/Doxygen keyword error. + CommentDocKeywordError = 18, + + //! A keyword defined in keyword set number 5. The class must + //! be sub-classed and re-implement keywords() to make use of + //! this style. + KeywordSet5 = 19, + + //! A keyword defined in keyword set number 6. The class must + //! be sub-classed and re-implement keywords() to make use of + //! this style. + KeywordSet6 = 20, + + //! A keyword defined in keyword set number 7. The class must + //! be sub-classed and re-implement keywords() to make use of + //! this style. + KeywordSet7 = 21, + + //! A keyword defined in keyword set number 8. The class must + //! be sub-classed and re-implement keywords() to make use of + //! this style. + KeywordSet8 = 22 + }; + + //! Construct a QextScintillaLexerSQL with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerSQL(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerSQL instance. + virtual ~QextScintillaLexerSQL(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns the style used for braces for brace matching. + int braceStyle() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool eolFill(int style) const; + + //! Returns the font for style number \a style. + QFont font(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa color() + QColor paper(int style) const; + + //! Causes all properties to be refreshed by emitting the + //! propertyChanged() signal as required. + void refreshProperties(); + + //! Returns TRUE if multi-line comment blocks can be folded. + //! + //! \sa setFoldComments() + bool foldComments() const; + + //! Returns TRUE if trailing blank lines are included in a fold block. + //! + //! \sa setFoldCompact() + bool foldCompact() const; + + //! Returns TRUE if backslash escapes are enabled. + //! + //! \sa setBackslashEscapes() + bool backslashEscapes() const; + +public slots: + //! If \a fold is TRUE then multi-line comment blocks can be folded. + //! The default is FALSE. + //! + //! \sa foldComments() + virtual void setFoldComments(bool fold); + + //! If \a fold is TRUE then trailing blank lines are included in a fold + //! block. The default is TRUE. + //! + //! \sa foldCompact() + virtual void setFoldCompact(bool fold); + + //! If \a enable is TRUE then backslash escapes are enabled. The + //! default is FALSE. + //! + //! \sa backslashEscapes() + virtual void setBackslashEscapes(bool enable); + +protected: + //! The lexer's properties are read from the settings \a qs. \a prefix + //! (which has a trailing '/') should be used as a prefix to the key of + //! each setting. TRUE is returned if there is no error. + //! + bool readProperties(QSettings &qs,const QString &prefix); + + //! The lexer's properties are written to the settings \a qs. + //! \a prefix (which has a trailing '/') should be used as a prefix to + //! the key of each setting. TRUE is returned if there is no error. + //! + bool writeProperties(QSettings &qs,const QString &prefix) const; + +private: + void setCommentProp(); + void setCompactProp(); + void setBackslashEscapesProp(); + + bool fold_comments; + bool fold_compact; + bool backslash_escapes; + + +#if defined(Q_DISABLE_COPY) + QextScintillaLexerSQL(const QextScintillaLexerSQL &); + QextScintillaLexerSQL &operator=(const QextScintillaLexerSQL &); +#endif +}; + +#endif diff --git a/qt/qextscintillalexertex.cpp b/qt/qextscintillalexertex.cpp new file mode 100644 index 0000000..4cf2848 --- /dev/null +++ b/qt/qextscintillalexertex.cpp @@ -0,0 +1,206 @@ +// This module implements the QextScintillaLexerTeX class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qcolor.h> +#include <qfont.h> +#include <qsettings.h> + +#include "qextscintillalexertex.h" + + +// The ctor. +QextScintillaLexerTeX::QextScintillaLexerTeX(QObject *parent,const char *name) + : QextScintillaLexer(parent,name) +{ +} + + +// The dtor. +QextScintillaLexerTeX::~QextScintillaLexerTeX() +{ +} + + +// Returns the language name. +const char *QextScintillaLexerTeX::language() const +{ + return "TeX"; +} + + +// Returns the lexer name. +const char *QextScintillaLexerTeX::lexer() const +{ + return "tex"; +} + + +// Return the string of characters that comprise a word. +const char *QextScintillaLexerTeX::wordCharacters() const +{ + return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\\@"; +} + + +// Returns the foreground colour of the text for a style. +QColor QextScintillaLexerTeX::color(int style) const +{ + switch (style) + { + case Default: + return QColor(0x3f,0x3f,0x3f); + + case Special: + return QColor(0x00,0x7f,0x7f); + + case Group: + return QColor(0x7f,0x00,0x00); + + case Symbol: + return QColor(0x7f,0x7f,0x00); + + case Command: + return QColor(0x00,0x7f,0x00); + } + + return QextScintillaLexer::color(style); +} + + +// Returns the set of keywords. +const char *QextScintillaLexerTeX::keywords(int set) const +{ + if (set == 1) + return + "above abovedisplayshortskip abovedisplayskip " + "abovewithdelims accent adjdemerits advance " + "afterassignment aftergroup atop atopwithdelims " + "badness baselineskip batchmode begingroup " + "belowdisplayshortskip belowdisplayskip binoppenalty " + "botmark box boxmaxdepth brokenpenalty catcode char " + "chardef cleaders closein closeout clubpenalty copy " + "count countdef cr crcr csname day deadcycles def " + "defaulthyphenchar defaultskewchar delcode delimiter " + "delimiterfactor delimeters delimitershortfall " + "delimeters dimen dimendef discretionary " + "displayindent displaylimits displaystyle " + "displaywidowpenalty displaywidth divide " + "doublehyphendemerits dp dump edef else " + "emergencystretch end endcsname endgroup endinput " + "endlinechar eqno errhelp errmessage " + "errorcontextlines errorstopmode escapechar everycr " + "everydisplay everyhbox everyjob everymath everypar " + "everyvbox exhyphenpenalty expandafter fam fi " + "finalhyphendemerits firstmark floatingpenalty font " + "fontdimen fontname futurelet gdef global group " + "globaldefs halign hangafter hangindent hbadness " + "hbox hfil horizontal hfill horizontal hfilneg hfuzz " + "hoffset holdinginserts hrule hsize hskip hss " + "horizontal ht hyphenation hyphenchar hyphenpenalty " + "hyphen if ifcase ifcat ifdim ifeof iffalse ifhbox " + "ifhmode ifinner ifmmode ifnum ifodd iftrue ifvbox " + "ifvmode ifvoid ifx ignorespaces immediate indent " + "input inputlineno input insert insertpenalties " + "interlinepenalty jobname kern language lastbox " + "lastkern lastpenalty lastskip lccode leaders left " + "lefthyphenmin leftskip leqno let limits linepenalty " + "line lineskip lineskiplimit long looseness lower " + "lowercase mag mark mathaccent mathbin mathchar " + "mathchardef mathchoice mathclose mathcode mathinner " + "mathop mathopen mathord mathpunct mathrel " + "mathsurround maxdeadcycles maxdepth meaning " + "medmuskip message mkern month moveleft moveright " + "mskip multiply muskip muskipdef newlinechar noalign " + "noboundary noexpand noindent nolimits nonscript " + "scriptscript nonstopmode nulldelimiterspace " + "nullfont number omit openin openout or outer output " + "outputpenalty over overfullrule overline " + "overwithdelims pagedepth pagefilllstretch " + "pagefillstretch pagefilstretch pagegoal pageshrink " + "pagestretch pagetotal par parfillskip parindent " + "parshape parskip patterns pausing penalty " + "postdisplaypenalty predisplaypenalty predisplaysize " + "pretolerance prevdepth prevgraf radical raise read " + "relax relpenalty right righthyphenmin rightskip " + "romannumeral scriptfont scriptscriptfont " + "scriptscriptstyle scriptspace scriptstyle " + "scrollmode setbox setlanguage sfcode shipout show " + "showbox showboxbreadth showboxdepth showlists " + "showthe skewchar skip skipdef spacefactor spaceskip " + "span special splitbotmark splitfirstmark " + "splitmaxdepth splittopskip string tabskip textfont " + "textstyle the thickmuskip thinmuskip time toks " + "toksdef tolerance topmark topskip tracingcommands " + "tracinglostchars tracingmacros tracingonline " + "tracingoutput tracingpages tracingparagraphs " + "tracingrestores tracingstats uccode uchyph " + "underline unhbox unhcopy unkern unpenalty unskip " + "unvbox unvcopy uppercase vadjust valign vbadness " + "vbox vcenter vfil vfill vfilneg vfuzz voffset vrule " + "vsize vskip vsplit vss vtop wd widowpenalty write " + "xdef xleaders xspaceskip year " + "TeX bgroup egroup endgraf space empty null newcount " + "newdimen newskip newmuskip newbox newtoks newhelp " + "newread newwrite newfam newlanguage newinsert newif " + "maxdimen magstephalf magstep frenchspacing " + "nonfrenchspacing normalbaselines obeylines " + "obeyspaces raggedr ight ttraggedright thinspace " + "negthinspace enspace enskip quad qquad smallskip " + "medskip bigskip removelastskip topglue vglue hglue " + "break nobreak allowbreak filbreak goodbreak " + "smallbreak medbreak bigbreak line leftline " + "rightline centerline rlap llap underbar strutbox " + "strut cases matrix pmatrix bordermatrix eqalign " + "displaylines eqalignno leqalignno pageno folio " + "tracingall showhyphens fmtname fmtversion hphantom " + "vphantom phantom smash"; + + return 0; +} + + +// Returns the user name of a style. +QString QextScintillaLexerTeX::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Special: + return tr("Special"); + + case Group: + return tr("Group"); + + case Symbol: + return tr("Symbol"); + + case Command: + return tr("Command"); + + case Text: + return tr("Text"); + } + + return QString::null; +} diff --git a/qt/qextscintillalexertex.h b/qt/qextscintillalexertex.h new file mode 100644 index 0000000..f46960c --- /dev/null +++ b/qt/qextscintillalexertex.h @@ -0,0 +1,101 @@ +// This defines the interface to the QextScintillaLexerTeX class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLALEXERTEX_H +#define QEXTSCINTILLALEXERTEX_H + + +#include <qobject.h> + +#include <qextscintillaglobal.h> +#include <qextscintillalexer.h> + + +//! \brief The QextScintillaLexerTeX class encapsulates the Scintilla TeX +//! lexer. +class QEXTSCINTILLA_EXPORT QextScintillaLexerTeX : public QextScintillaLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! TeX lexer. + enum { + //! The default. + Default = 0, + + //! A special. + Special = 1, + + //! A group. + Group = 2, + + //! A symbol. + Symbol = 3, + + //! A command. + Command = 4, + + //! Text. + Text = 5 + }; + + //! Construct a QextScintillaLexerTeX with parent \a parent and name + //! \a name. \a parent is typically the QextScintilla instance. + QextScintillaLexerTeX(QObject *parent = 0,const char *name = 0); + + //! Destroys the QextScintillaLexerTeX instance. + virtual ~QextScintillaLexerTeX(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns the string of characters that comprise a word. + const char *wordCharacters() const; + + //! Returns the foreground colour of the text for style number + //! \a style. + //! + //! \sa paper() + QColor color(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the + //! style is invalid for this language then QString::null is returned. + //! This is intended to be used in user preference dialogs. + QString description(int style) const; + +private: +#if defined(Q_DISABLE_COPY) + QextScintillaLexerTeX(const QextScintillaLexerTeX &); + QextScintillaLexerTeX &operator=(const QextScintillaLexerTeX &); +#endif +}; + +#endif diff --git a/qt/qextscintillamacro.cpp b/qt/qextscintillamacro.cpp new file mode 100644 index 0000000..7d2d358 --- /dev/null +++ b/qt/qextscintillamacro.cpp @@ -0,0 +1,329 @@ +// This module implements the QextScintillaMacro class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <string.h> + +#include <qstring.h> + +#include "qextscintillamacro.h" +#include "qextscintilla.h" + + +static QCString extract(const QCString &asc,int &start); +static int fromHex(unsigned char ch); + + +// The ctor. +QextScintillaMacro::QextScintillaMacro(QextScintilla *parent,const char *name) + : QObject(parent,name), qsci(parent) +{ +} + + +// The ctor that initialises the macro. +QextScintillaMacro::QextScintillaMacro(const QCString &asc, + QextScintilla *parent,const char *name) + : QObject(parent,name), qsci(parent) +{ + load(asc); +} + + +// The dtor. +QextScintillaMacro::~QextScintillaMacro() +{ +} + + +// Clear the contents of the macro. +void QextScintillaMacro::clear() +{ + macro.clear(); +} + + +// Read a macro from a string. +bool QextScintillaMacro::load(const QCString &asc) +{ + bool rc = TRUE; + + macro.clear(); + + int pos = 0; + + while (pos < asc.length()) + { + QCString fld; + Macro cmd; + unsigned len; + + // Extract the 3 fixed fields. + fld = extract(asc,pos); + cmd.msg = fld.toUInt(&rc); + + if (!rc) + break; + + fld = extract(asc,pos); + cmd.wParam = fld.toULong(&rc); + + if (!rc) + break; + + fld = extract(asc,pos); + len = fld.toUInt(&rc); + + if (!rc) + break; + + // Extract any text. + if (len) + { + cmd.text.resize(len); + fld = extract(asc,pos); + + char *dp = cmd.text.data(); + const char *sp = fld; + + if (!sp) + { + rc = FALSE; + break; + } + + while (len--) + { + unsigned char ch; + + ch = *sp++; + + if (ch == '"' || ch <= ' ' || ch >= 0x7f) + { + rc = FALSE; + break; + } + + if (ch == '\\') + { + int b1, b2; + + if ((b1 = fromHex(*sp++)) < 0 || + (b2 = fromHex(*sp++)) < 0) + { + rc = FALSE; + break; + } + + ch = (b1 << 4) + b2; + } + + *dp++ = ch; + } + + if (!rc) + break; + } + + macro.append(cmd); + } + + if (!rc) + macro.clear(); + + return rc; +} + + +// Write a macro to a string. +QCString QextScintillaMacro::save() const +{ + QCString ms; + + for (QValueList<Macro>::const_iterator it = macro.begin(); it != macro.end(); ++it) + { + if (!ms.isEmpty()) + ms += ' '; + + unsigned len = (*it).text.size(); + QCString m; + + m.sprintf("%u %lu %u",(*it).msg,(*it).wParam,len); + + if (len) + { + m += ' '; + + const char *cp = (*it).text.data(); + + while (len--) + { + unsigned char ch = *cp++; + + if (ch == '\\' || ch == '"' || ch <= ' ' || ch >= 0x7f) + { + char buf[4]; + + sprintf(buf,"\\%02x",ch); + m += buf; + } + else + m += ch; + } + } + + ms += m; + } + + return ms; +} + + +// Play the macro. +void QextScintillaMacro::play() +{ + if (!qsci) + return; + + for (QValueList<Macro>::const_iterator it = macro.begin(); it != macro.end(); ++it) + qsci -> SendScintilla((*it).msg,(*it).wParam,(*it).text.data()); +} + + +// Start recording. +void QextScintillaMacro::startRecording() +{ + if (!qsci) + return; + + macro.clear(); + + connect(qsci, + SIGNAL(SCN_MACRORECORD(unsigned int,unsigned long,long)), + SLOT(record(unsigned int,unsigned long,long))); + + qsci -> SendScintilla(QextScintillaBase::SCI_STARTRECORD); +} + + +// End recording. +void QextScintillaMacro::endRecording() +{ + if (!qsci) + return; + + qsci -> SendScintilla(QextScintillaBase::SCI_STOPRECORD); + qsci -> disconnect(this); +} + + +// Record a command. +void QextScintillaMacro::record(unsigned int msg,unsigned long wParam, + long lParam) +{ + Macro m; + + m.msg = msg; + m.wParam = wParam; + + // Determine commands which need special handling of the parameters. + switch (msg) + { + case QextScintillaBase::SCI_ADDTEXT: + m.text.duplicate(reinterpret_cast<const char *>(lParam),wParam); + break; + + case QextScintillaBase::SCI_REPLACESEL: + if (!macro.isEmpty() && macro.last().msg == QextScintillaBase::SCI_REPLACESEL) + { + const char *text = reinterpret_cast<const char *>(lParam); + + // This is the command used for ordinary user input so + // it's a signifacant space reduction to append it to + // the previous command. + + QByteArray &ba = macro.last().text; + + unsigned pos = ba.size() - 1; + + // Make room for the new text. + ba.resize(ba.size() + strlen(text)); + + // Copy it in. + strcpy(ba.data() + pos,text); + + return; + } + + /* Drop through. */ + + case QextScintillaBase::SCI_INSERTTEXT: + case QextScintillaBase::SCI_APPENDTEXT: + case QextScintillaBase::SCI_SEARCHNEXT: + case QextScintillaBase::SCI_SEARCHPREV: + { + const char *text = reinterpret_cast<const char *>(lParam); + + m.text.duplicate(text,strlen(text) + 1); + break; + } + } + + macro.append(m); +} + + +// Extract a macro field starting at the given position. +static QCString extract(const QCString &asc,int &fstart) +{ + QCString f; + + if (fstart < asc.length()) + { + int fend = asc.find(' ',fstart); + + if (fend < 0) + { + f = asc.mid(fstart); + fstart = asc.length(); + } + else + { + f = asc.mid(fstart,fend - fstart); + fstart = fend + 1; + } + } + + return f; +} + + +// Return the given hex character as a binary. +static int fromHex(unsigned char ch) +{ + if (ch >= '0' && ch <= '9') + return ch - '0'; + + if (ch >= 'a' && ch <= 'f') + return ch - 'a' + 10; + + return -1; +} diff --git a/qt/qextscintillamacro.h b/qt/qextscintillamacro.h new file mode 100644 index 0000000..0c33968 --- /dev/null +++ b/qt/qextscintillamacro.h @@ -0,0 +1,106 @@ +// This defines the interface to the QextScintillaMacro class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLAMACRO_H +#define QEXTSCINTILLAMACRO_H + + +#include <qobject.h> +#include <qcstring.h> +#include <qvaluelist.h> + +#include <qextscintillaglobal.h> + + +class QString; +class QextScintilla; + + +//! \brief The QextScintillaMacro class represents a sequence of recordable +//! editor commands. +//! +//! Methods are provided to convert convert a macro to and from a textual +//! representation so that they can be easily written to and read from +//! permanent storage. +class QEXTSCINTILLA_EXPORT QextScintillaMacro : public QObject +{ + Q_OBJECT + +public: + //! Construct a QextScintillaMacro with parent \a parent and name + //! \a name. + QextScintillaMacro(QextScintilla *parent,const char *name = 0); + + //! Construct a QextScintillaMacro from the printable ASCII + //! representation \a asc, with parent \a parent and name \a name. + QextScintillaMacro(const QCString &asc,QextScintilla *parent, + const char *name = 0); + + //! Destroy the QextScintillaMacro instance. + virtual ~QextScintillaMacro(); + + //! Clear the contents of the macro. + void clear(); + + //! Load the macro from the printable ASCII representation \a asc. + //! Returns TRUE if there was no error. + //! + //! \sa save() + bool load(const QCString &asc); + + //! Return a printable ASCII representation of the macro. It is + //! guaranteed that only printable ASCII characters are used and that + //! double quote characters will not be used. + //! + //! \sa load() + QCString save() const; + +public slots: + //! Play the macro. + virtual void play(); + + //! Start recording user commands and add them to the macro. + virtual void startRecording(); + + //! Stop recording user commands. + virtual void endRecording(); + +private slots: + void record(unsigned int msg,unsigned long wParam,long lParam); + +private: + struct Macro { + unsigned int msg; + unsigned long wParam; + QByteArray text; + }; + + QextScintilla *qsci; + QValueList<Macro> macro; + +#if defined(Q_DISABLE_COPY) + QextScintillaMacro(const QextScintillaMacro &); + QextScintillaMacro &operator=(const QextScintillaMacro &); +#endif +}; + +#endif diff --git a/qt/qextscintillaprinter.cpp b/qt/qextscintillaprinter.cpp new file mode 100644 index 0000000..1aadb2d --- /dev/null +++ b/qt/qextscintillaprinter.cpp @@ -0,0 +1,186 @@ +// This module implements the QextScintillaPrinter class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include <qprinter.h> +#include <qpainter.h> +#include <qpaintdevicemetrics.h> +#include <qvaluestack.h> + +#include "qextscintillaprinter.h" +#include "qextscintillabase.h" + + +// The ctor. +QextScintillaPrinter::QextScintillaPrinter(QPrinter::PrinterMode mode) : + QPrinter(mode), mag(0), + wrap(QextScintilla::WrapWord) +{ +} + + +// The dtor. +QextScintillaPrinter::~QextScintillaPrinter() +{ +} + + +// Format the page before the document text is drawn. +void QextScintillaPrinter::formatPage(QPainter &,bool,QRect &,int) +{ +} + + +// Print a range of lines to a printer. +int QextScintillaPrinter::printRange(QextScintillaBase *qsb,int from,int to) +{ + // Sanity check. + if (!qsb) + return FALSE; + + // Setup the printing area. + QPaintDeviceMetrics metrics(this); + QRect def_area; + + def_area.setX(0); + def_area.setY(0); + def_area.setWidth(metrics.width()); + def_area.setHeight(metrics.height()); + + // Get the page range. + int pgFrom, pgTo; + + pgFrom = fromPage(); + pgTo = toPage(); + + // Find the position range. + long startPos, endPos; + + endPos = qsb -> SendScintilla(QextScintillaBase::SCI_GETLENGTH); + + startPos = (from > 0 ? qsb -> SendScintilla(QextScintillaBase::SCI_POSITIONFROMLINE,from) : 0); + + if (to >= 0) + { + long toPos = qsb -> SendScintilla(QextScintillaBase::SCI_POSITIONFROMLINE,to + 1); + + if (endPos > toPos) + endPos = toPos; + } + + if (startPos >= endPos) + return FALSE; + + QPainter painter(this); + bool reverse = (pageOrder() == LastPageFirst); + bool needNewPage = FALSE; + + qsb -> SendScintilla(QextScintillaBase::SCI_SETPRINTMAGNIFICATION,mag); + qsb -> SendScintilla(QextScintillaBase::SCI_SETPRINTWRAPMODE,wrap); + + for (int i = 1; i <= numCopies(); ++i) + { + // If we are printing in reverse page order then remember the + // start position of each page. + QValueStack<long> pageStarts; + + int currPage = 1; + long pos = startPos; + + while (pos < endPos) + { + // See if we have finished the requested page range. + if (pgTo > 0 && pgTo < currPage) + break; + + // See if we are going to render this page, or just see + // how much would fit onto it. + bool render = FALSE; + + if (pgFrom == 0 || pgFrom <= currPage) + { + if (reverse) + pageStarts.push(pos); + else + { + render = TRUE; + + if (needNewPage) + { + if (!newPage()) + return FALSE; + } + else + needNewPage = TRUE; + } + } + + QRect area = def_area; + + formatPage(painter,render,area,currPage); + pos = qsb -> SendScintilla(QextScintillaBase::SCI_FORMATRANGE,render,&painter,area,pos,endPos); + + ++currPage; + } + + // All done if we are printing in normal page order. + if (!reverse) + continue; + + // Now go through each page on the stack and really print it. + while (!pageStarts.isEmpty()) + { + --currPage; + + long ePos = pos; + pos = pageStarts.pop(); + + if (needNewPage) + { + if (!newPage()) + return FALSE; + } + else + needNewPage = TRUE; + + QRect area = def_area; + + formatPage(painter,TRUE,area,currPage); + qsb -> SendScintilla(QextScintillaBase::SCI_FORMATRANGE,TRUE,&painter,area,pos,ePos); + } + } + + return TRUE; +} + + +// Set the print magnification in points. +void QextScintillaPrinter::setMagnification(int magnification) +{ + mag = magnification; +} + + +// Set the line wrap mode. +void QextScintillaPrinter::setWrapMode(QextScintilla::WrapMode wmode) +{ + wrap = wmode; +} diff --git a/qt/qextscintillaprinter.h b/qt/qextscintillaprinter.h new file mode 100644 index 0000000..3eae387 --- /dev/null +++ b/qt/qextscintillaprinter.h @@ -0,0 +1,107 @@ +// This module defines interface to the QextScintillaPrinter class. +// +// Copyright (c) 2006 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of QScintilla. +// +// This copy of QScintilla is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) any +// later version. +// +// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// QScintilla; see the file LICENSE. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef QEXTSCINTILLAPRINTER_H +#define QEXTSCINTILLAPRINTER_H + + +#include <qprinter.h> + +#include <qextscintillaglobal.h> +#include <qextscintilla.h> + + +class QRect; +class QPainter; +class QextScintillaBase; + + +//! \brief The QextScintillaPrinter class is a sub-class of the Qt QPrinter +//! class that is able to print the text of a Scintilla document. +//! +//! The class can be further sub-classed to alter to layout of the text, adding +//! headers and footers for example. +class QEXTSCINTILLA_EXPORT QextScintillaPrinter : public QPrinter +{ +public: + //! Constructs a printer paint device with mode \a mode. + QextScintillaPrinter(PrinterMode mode = ScreenResolution); + + //! Destroys the QextScintillaPrinter instance. + ~QextScintillaPrinter(); + + //! Format a page, by adding headers and footers for example, before + //! the document text is drawn on it. \a painter is the painter to be + //! used to add customised text and graphics. \a drawing is TRUE if + //! the page is actually being drawn rather than being sized. + //! \a painter drawing methods must only be called when \a drawing is + //! TRUE. \a area is the area of the page that will be used to draw + //! the text. This should be modified if it is necessary to reserve + //! space for any customised text or graphics. By default the area is + //! relative to the printable area of the page. Use + //! QPrinter::setFullPage() because calling printRange() if you want to + //! try and print over the whole page. \a pagenr is the number of the + //! page. The first page is numbered 1. + virtual void formatPage(QPainter &painter,bool drawing,QRect &area, + int pagenr); + + //! Return the number of points to add to each font when printing. + //! + //! \sa setMagnification() + int magnification() const {return mag;} + + //! Sets the number of points to add to each font when printing to + //! \a magnification. + //! + //! \sa magnification() + virtual void setMagnification(int magnification); + + //! Print a range of lines from the Scintilla instance \a qsb. \a from + //! is the first line to print and a negative value signifies the first + //! line of text. \a to is the last line to print and a negative value + //! signifies the last line of text. TRUE is returned if there was no + //! error. + virtual int printRange(QextScintillaBase *qsb,int from = -1, + int to = -1); + + //! Return the line wrap mode used when printing. The default is + //! QextScintilla::WrapWord. + //! + //! \sa setWrapMode() + QextScintilla::WrapMode wrapMode() const {return wrap;} + + //! Sets the line wrap mode used when printing to \a wmode. + //! + //! \sa wrapMode() + virtual void setWrapMode(QextScintilla::WrapMode wmode); + +private: + int mag; + QextScintilla::WrapMode wrap; + +#if defined(Q_DISABLE_COPY) + QextScintillaPrinter(const QextScintillaPrinter &); + QextScintillaPrinter &operator=(const QextScintillaPrinter &); +#endif +}; + +#endif diff --git a/qt/qscintilla.pro b/qt/qscintilla.pro new file mode 100644 index 0000000..3180bab --- /dev/null +++ b/qt/qscintilla.pro @@ -0,0 +1,220 @@ +# The project file for the qscintilla library. +# +# Copyright (c) 2006 +# Riverbank Computing Limited <info@riverbankcomputing.co.uk> +# +# This file is part of QScintilla. +# +# This copy of QScintilla is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) any +# later version. +# +# QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# QScintilla; see the file LICENSE. If not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +unix:VERSION = 7.0.1 + + +TEMPLATE = lib +TARGET = qscintilla +# DESTDIR = $(QTDIR)/lib +CONFIG += qt warn_off release dll thread +INCLUDEPATH = . ../include ../src +DEFINES = QEXTSCINTILLA_MAKE_DLL QT SCI_LEXER + +HEADERS = \ + qextscintillaglobal.h \ + qextscintilla.h \ + qextscintillaapis.h \ + qextscintillabase.h \ + qextscintillacommand.h \ + qextscintillacommandset.h \ + qextscintilladocument.h \ + qextscintillalexer.h \ + qextscintillalexerbash.h \ + qextscintillalexerbatch.h \ + qextscintillalexercpp.h \ + qextscintillalexercsharp.h \ + qextscintillalexercss.h \ + qextscintillalexerdiff.h \ + qextscintillalexerhtml.h \ + qextscintillalexeridl.h \ + qextscintillalexerjava.h \ + qextscintillalexerjavascript.h \ + qextscintillalexerlua.h \ + qextscintillalexermakefile.h \ + qextscintillalexerperl.h \ + qextscintillalexerpov.h \ + qextscintillalexerproperties.h \ + qextscintillalexerpython.h \ + qextscintillalexerruby.h \ + qextscintillalexersql.h \ + qextscintillalexertex.h \ + qextscintillamacro.h \ + qextscintillaprinter.h \ + SciListBox.h \ + ScintillaQt.h \ + ../include/Accessor.h \ + ../include/KeyWords.h \ + ../include/Platform.h \ + ../include/PropSet.h \ + ../include/SString.h \ + ../include/SciLexer.h \ + ../include/Scintilla.h \ + ../include/ScintillaWidget.h \ + ../include/WindowAccessor.h \ + ../src/AutoComplete.h \ + ../src/CallTip.h \ + ../src/CellBuffer.h \ + ../src/ContractionState.h \ + ../src/CharClassify.h \ + ../src/Document.h \ + ../src/DocumentAccessor.h \ + ../src/Editor.h \ + ../src/ExternalLexer.h \ + ../src/Indicator.h \ + ../src/KeyMap.h \ + ../src/LineMarker.h \ + ../src/RESearch.h \ + ../src/SVector.h \ + ../src/ScintillaBase.h \ + ../src/Style.h \ + ../src/StyleContext.h \ + ../src/ViewStyle.h \ + ../src/XPM.h + +SOURCES = \ + qextscintilla.cpp \ + qextscintillaapis.cpp \ + qextscintillabase.cpp \ + qextscintillacommand.cpp \ + qextscintillacommandset.cpp \ + qextscintilladocument.cpp \ + qextscintillalexer.cpp \ + qextscintillalexerbash.cpp \ + qextscintillalexerbatch.cpp \ + qextscintillalexercpp.cpp \ + qextscintillalexercsharp.cpp \ + qextscintillalexercss.cpp \ + qextscintillalexerdiff.cpp \ + qextscintillalexerhtml.cpp \ + qextscintillalexeridl.cpp \ + qextscintillalexerjava.cpp \ + qextscintillalexerjavascript.cpp \ + qextscintillalexerlua.cpp \ + qextscintillalexermakefile.cpp \ + qextscintillalexerperl.cpp \ + qextscintillalexerpov.cpp \ + qextscintillalexerproperties.cpp \ + qextscintillalexerpython.cpp \ + qextscintillalexerruby.cpp \ + qextscintillalexersql.cpp \ + qextscintillalexertex.cpp \ + qextscintillamacro.cpp \ + qextscintillaprinter.cpp \ + SciListBox.cpp \ + PlatQt.cpp \ + ScintillaQt.cpp \ + ../src/AutoComplete.cpp \ + ../src/CallTip.cpp \ + ../src/CellBuffer.cpp \ + ../src/ContractionState.cpp \ + ../src/CharClassify.cpp \ + ../src/Document.cpp \ + ../src/DocumentAccessor.cpp \ + ../src/Editor.cpp \ + ../src/ExternalLexer.cpp \ + ../src/Indicator.cpp \ + ../src/KeyMap.cpp \ + ../src/KeyWords.cpp \ + ../src/LexAPDL.cpp \ + ../src/LexAU3.cpp \ + ../src/LexAVE.cpp \ + ../src/LexAda.cpp \ + ../src/LexAsm.cpp \ + ../src/LexAsn1.cpp \ + ../src/LexBaan.cpp \ + ../src/LexBash.cpp \ + ../src/LexBasic.cpp \ + ../src/LexBullant.cpp \ + ../src/LexCLW.cpp \ + ../src/LexCPP.cpp \ + ../src/LexCSS.cpp \ + ../src/LexCaml.cpp \ + ../src/LexConf.cpp \ + ../src/LexCrontab.cpp \ + ../src/LexCsound.cpp \ + ../src/LexEScript.cpp \ + ../src/LexEiffel.cpp \ + ../src/LexErlang.cpp \ + ../src/LexFlagship.cpp \ + ../src/LexForth.cpp \ + ../src/LexFortran.cpp \ + ../src/LexGui4Cli.cpp \ + ../src/LexHTML.cpp \ + ../src/LexHaskell.cpp \ + ../src/LexInno.cpp \ + ../src/LexKix.cpp \ + ../src/LexLisp.cpp \ + ../src/LexLout.cpp \ + ../src/LexLua.cpp \ + ../src/LexMMIXAL.cpp \ + ../src/LexMPT.cpp \ + ../src/LexMSSQL.cpp \ + ../src/LexMatlab.cpp \ + ../src/LexMetapost.cpp \ + ../src/LexNsis.cpp \ + ../src/LexOpal.cpp \ + ../src/LexOthers.cpp \ + ../src/LexPB.cpp \ + ../src/LexPOV.cpp \ + ../src/LexPS.cpp \ + ../src/LexPascal.cpp \ + ../src/LexPerl.cpp \ + ../src/LexPython.cpp \ + ../src/LexRebol.cpp \ + ../src/LexRuby.cpp \ + ../src/LexSQL.cpp \ + ../src/LexScriptol.cpp \ + ../src/LexSmalltalk.cpp \ + ../src/LexSpecman.cpp \ + ../src/LexSpice.cpp \ + ../src/LexTADS3.cpp \ + ../src/LexTCL.cpp \ + ../src/LexTeX.cpp \ + ../src/LexVB.cpp \ + ../src/LexVHDL.cpp \ + ../src/LexVerilog.cpp \ + ../src/LexYAML.cpp \ + ../src/LineMarker.cpp \ + ../src/PropSet.cpp \ + ../src/RESearch.cpp \ + ../src/ScintillaBase.cpp \ + ../src/Style.cpp \ + ../src/StyleContext.cpp \ + ../src/ViewStyle.cpp \ + ../src/WindowAccessor.cpp \ + ../src/XPM.cpp + +TRANSLATIONS = \ + qscintilla_de.ts \ + qscintilla_fr.ts \ + qscintilla_pt_br.ts \ + qscintilla_ru.ts + + +header.path = $(QTDIR)/include +header.files = qextscintilla*.h + +trans.path = $(QTDIR)/translations +trans.files = qscintilla_*.qm + +INSTALLS += header trans diff --git a/qt/qscintilla_de.qm b/qt/qscintilla_de.qm Binary files differnew file mode 100644 index 0000000..d6b1d0c --- /dev/null +++ b/qt/qscintilla_de.qm diff --git a/qt/qscintilla_de.ts b/qt/qscintilla_de.ts new file mode 100644 index 0000000..ab47c2b --- /dev/null +++ b/qt/qscintilla_de.ts @@ -0,0 +1,1635 @@ +<!DOCTYPE TS><TS> +<context> + <name>QextScintillaCommand</name> + <message> + <source>Move left one character</source> + <translation>Ein Zeichen nach links</translation> + </message> + <message> + <source>Move right one character</source> + <translation>Ein Zeichen nach rechts</translation> + </message> + <message> + <source>Move up one line</source> + <translation>Eine Zeile nach oben</translation> + </message> + <message> + <source>Move down one line</source> + <translation>Eine Zeile nach unten</translation> + </message> + <message> + <source>Move left one word part</source> + <translation>Ein Wortteil nach links</translation> + </message> + <message> + <source>Move right one word part</source> + <translation>Ein Wortteil nach rechts</translation> + </message> + <message> + <source>Move left one word</source> + <translation>Ein Wort nach links</translation> + </message> + <message> + <source>Move right one word</source> + <translation>Ein Wort nach rechts</translation> + </message> + <message> + <source>Move to first visible character in line</source> + <translation>Zum ersten sichtbaren Zeichen</translation> + </message> + <message> + <source>Move to end of line</source> + <translation>Zum Ende der Zeile</translation> + </message> + <message> + <source>Scroll view down one line</source> + <translation>Eine Zeile nach unten rollen</translation> + </message> + <message> + <source>Scroll view up one line</source> + <translation>Eine Zeile nach oben rollen</translation> + </message> + <message> + <source>Move up one page</source> + <translation>Eine Seite hoch</translation> + </message> + <message> + <source>Move down one page</source> + <translation>Eine Seite nach unten</translation> + </message> + <message> + <source>Move to start of text</source> + <translation>Zum Textanfang</translation> + </message> + <message> + <source>Move to end of text</source> + <translation>Zum Textende</translation> + </message> + <message> + <source>Indent one level</source> + <translation>Eine Ebene einrücken</translation> + </message> + <message> + <source>Move back one indentation level</source> + <translation>Eine Ebene ausrücken</translation> + </message> + <message> + <source>Select all text</source> + <translation>Gesamten Text auswählen</translation> + </message> + <message> + <source>Extend selection left one character</source> + <translation>Auswahl um ein Zeichen nach links erweitern</translation> + </message> + <message> + <source>Extend selection right one character</source> + <translation>Auswahl um ein Zeichen nach rechts erweitern</translation> + </message> + <message> + <source>Extend selection up one line</source> + <translation>Auswahl um eine Zeile nach oben erweitern</translation> + </message> + <message> + <source>Extend selection down one line</source> + <translation>Auswahl um eine Zeile nach unten erweitern</translation> + </message> + <message> + <source>Extend selection left one word part</source> + <translation>Auswahl um einen Wortteil nach links erweitern</translation> + </message> + <message> + <source>Extend selection right one word part</source> + <translation>Auswahl um einen Wortteil nach rechts erweitern</translation> + </message> + <message> + <source>Extend selection left one word</source> + <translation>Auswahl um ein Wort nach links erweitern</translation> + </message> + <message> + <source>Extend selection right one word</source> + <translation>Auswahl um ein Wort nach rechts erweitern</translation> + </message> + <message> + <source>Extend selection to first visible character in line</source> + <translation>Auswahl bis zum ersten sichtbaren Zeichen erweitern</translation> + </message> + <message> + <source>Extend selection to start of line</source> + <translation>Auswahl bis zum Zeilenanfang erweitern</translation> + </message> + <message> + <source>Extend selection to end of line</source> + <translation>Auswahl bis zum Zeilenende erweitern</translation> + </message> + <message> + <source>Extend selection up one page</source> + <translation>Auswahl um eine Seite nach oben erweitern</translation> + </message> + <message> + <source>Extend selection down one page</source> + <translation>Auswahl um eine Seite nach unten erweitern</translation> + </message> + <message> + <source>Extend selection to start of text</source> + <translation>Auswahl bis zum Textanfang erweitern</translation> + </message> + <message> + <source>Extend selection to end of text</source> + <translation>Auswahl bis zum Textende erweitern</translation> + </message> + <message> + <source>Delete previous character</source> + <translation>Zeichen links löschen</translation> + </message> + <message> + <source>Delete previous character if not at line start</source> + <translation>Zeichen links löschen, wenn nicht am Zeilenanfang</translation> + </message> + <message> + <source>Delete current character</source> + <translation>Aktuelles Zeichen löschen</translation> + </message> + <message> + <source>Delete word to left</source> + <translation>Wort links löschen</translation> + </message> + <message> + <source>Delete word to right</source> + <translation>Wort rechts löschen</translation> + </message> + <message> + <source>Delete line to left</source> + <translation>Zeile links löschen</translation> + </message> + <message> + <source>Delete line to right</source> + <translation>Zeile rechts löschen</translation> + </message> + <message> + <source>Insert new line</source> + <translation>Neue Zeile einfügen</translation> + </message> + <message> + <source>Delete current line</source> + <translation>Aktuelle Zeile löschen</translation> + </message> + <message> + <source>Swap current and previous lines</source> + <translation>Aktuelle Zeile mit vorhergehender tauschen</translation> + </message> + <message> + <source>Cut current line</source> + <translation>Aktuelle Zeile ausschneiden</translation> + </message> + <message> + <source>Cut selection</source> + <translation>Auswahl ausschneiden</translation> + </message> + <message> + <source>Copy selection</source> + <translation>Auswahl kopieren</translation> + </message> + <message> + <source>Paste</source> + <translation>Einfügen</translation> + </message> + <message> + <source>Redo last command</source> + <translation>Letzten Befehl wiederholen</translation> + </message> + <message> + <source>Undo the last command</source> + <translation>Letzten Befehl rückgängig</translation> + </message> + <message> + <source>Cancel</source> + <translation>Abbrechen</translation> + </message> + <message> + <source>Toggle insert/overtype</source> + <translation>Einfügen/Überschreiben umschalten</translation> + </message> + <message> + <source>Convert selection to lower case</source> + <translation>Auswahl in Kleinbuchstaben umwandeln</translation> + </message> + <message> + <source>Convert selection to upper case</source> + <translation>Auswahl in Großbuchstaben umwandeln</translation> + </message> + <message> + <source>Zoom in</source> + <translation>Vergrößern</translation> + </message> + <message> + <source>Zoom out</source> + <translation>Verkleinern</translation> + </message> + <message> + <source>Move up one paragraph</source> + <translation>Einen Absatz nach oben</translation> + </message> + <message> + <source>Move down one paragraph</source> + <translation>Einen Absatz nach unten</translation> + </message> + <message> + <source>Extend selection up one paragraph</source> + <translation>Auswahl um einen Absatz nach oben erweitern</translation> + </message> + <message> + <source>Extend selection down one paragraph</source> + <translation>Auswahl um einen Absatz nach unten erweitern</translation> + </message> + <message> + <source>Copy current line</source> + <translation>Aktuelle Zeile kopieren</translation> + </message> + <message> + <source>Extend rectangular selection down one line</source> + <translation>Rechteckige Auswahl um eine Zeile nach unten erweitern</translation> + </message> + <message> + <source>Extend rectangular selection up one line</source> + <translation>Rechteckige Auswahl um eine Zeile nach oben erweitern</translation> + </message> + <message> + <source>Extend rectangular selection left one character</source> + <translation>Rechteckige Auswahl um ein Zeichen nach links erweitern</translation> + </message> + <message> + <source>Extend rectangular selection right one character</source> + <translation>Rechteckige Auswahl um ein Zeichen nach rechts erweitern</translation> + </message> + <message> + <source>Move to start of displayed line</source> + <translation>Zum Beginn der angezeigten Zeile</translation> + </message> + <message> + <source>Extend rectangular selection to first visible character in line</source> + <translation>Rechteckige Auswahl bis zum ersten sichtbaren Zeichen erweitern</translation> + </message> + <message> + <source>Move to end of displayed line</source> + <translation>Zum Ende der angezeigten Zeile</translation> + </message> + <message> + <source>Extend selection to end of displayed line</source> + <translation>Auswahl bis zum Ende der angezeigten Zeile erweitern</translation> + </message> + <message> + <source>Extend rectangular selection to end of line</source> + <translation>Rechteckige Auswahl bis zum Zeilenende erweitern</translation> + </message> + <message> + <source>Extend rectangular selection up one page</source> + <translation>Rechteckige Auswahl um eine Seite nach oben erweitern</translation> + </message> + <message> + <source>Extend rectangular selection down one page</source> + <translation>Rechteckige Auswahl um eine Seite nach unten erweitern</translation> + </message> + <message> + <source>Set zoom</source> + <translation>Zoom einstellen</translation> + </message> + <message> + <source>Formfeed</source> + <translation>Seitenumbruch</translation> + </message> + <message> + <source>Duplicate selection</source> + <translation>Auswahl duplizieren</translation> + </message> +</context> +<context> + <name>QextScintillaLexerBash</name> + <message> + <source>Default</source> + <translation>Standard</translation> + </message> + <message> + <source>Error</source> + <translation>Fehler</translation> + </message> + <message> + <source>Comment</source> + <translation>Kommentar</translation> + </message> + <message> + <source>Number</source> + <translation>Zahl</translation> + </message> + <message> + <source>Keyword</source> + <translation>Schlüsselwort</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Zeichenkette in Anführungszeichen</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Zeichenkette in Hochkommata</translation> + </message> + <message> + <source>Operator</source> + <translation>Operator</translation> + </message> + <message> + <source>Identifier</source> + <translation>Bezeichner</translation> + </message> + <message> + <source>Scalar</source> + <translation>Skalar</translation> + </message> + <message> + <source>Parameter expansion</source> + <translation>Parametererweiterung</translation> + </message> + <message> + <source>Backticks</source> + <translation>Backticks</translation> + </message> + <message> + <source>Here document delimiter</source> + <translation>Here Dokument-Begrenzer</translation> + </message> + <message> + <source>Single-quoted here document</source> + <translation>Here Dokument in Hochkommata</translation> + </message> +</context> +<context> + <name>QextScintillaLexerBatch</name> + <message> + <source>Default</source> + <translation>Standard</translation> + </message> + <message> + <source>Comment</source> + <translation>Kommentar</translation> + </message> + <message> + <source>Keyword</source> + <translation>Schlüsselwort</translation> + </message> + <message> + <source>Label</source> + <translation>Marke</translation> + </message> + <message> + <source>Variable</source> + <translation>Variable</translation> + </message> + <message> + <source>Operator</source> + <translation>Operator</translation> + </message> + <message> + <source>Hide command character</source> + <translation>"Befehl verbergen" Zeichen</translation> + </message> + <message> + <source>External command</source> + <translation>Externer Befehl</translation> + </message> +</context> +<context> + <name>QextScintillaLexerCPP</name> + <message> + <source>Number</source> + <translation>Zahl</translation> + </message> + <message> + <source>Keyword</source> + <translation>Schlüsselwort</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Zeichenkette in Anführungszeichen</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Zeichenkette in Hochkommata</translation> + </message> + <message> + <source>Pre-processor block</source> + <translation>Preprozessorblock</translation> + </message> + <message> + <source>Operator</source> + <translation>Operator</translation> + </message> + <message> + <source>Identifier</source> + <translation>Bezeichner</translation> + </message> + <message> + <source>Unclosed string</source> + <translation>Unbeendete Zeichenkette</translation> + </message> + <message> + <source>Default</source> + <translation>Standard</translation> + </message> + <message> + <source>C comment</source> + <translation>C Kommentar</translation> + </message> + <message> + <source>C++ comment</source> + <translation>C++ Kommentar</translation> + </message> + <message> + <source>JavaDoc style C comment</source> + <translation>JavaDoc C Kommentar</translation> + </message> + <message> + <source>JavaDoc style C++ comment</source> + <translation>JavaDoc C++ Kommentar</translation> + </message> + <message> + <source>JavaDoc keyword</source> + <translation>JavaDoc Schlüsselwort</translation> + </message> + <message> + <source>JavaDoc keyword error</source> + <translation>JavaDoc Schlüsselwortfehler</translation> + </message> + <message> + <source>Secondary keywords and identifiers</source> + <translation>Sekundäre Schlusselwörter und Bezeichner</translation> + </message> + <message> + <source>Global classes and typedefs</source> + <translation>Globale Klassen und typdefinitionen</translation> + </message> +</context> +<context> + <name>QextScintillaLexerCSS</name> + <message> + <source>Default</source> + <translation>Standard</translation> + </message> + <message> + <source>Tag</source> + <translation>Tag</translation> + </message> + <message> + <source>Class selector</source> + <translation>Klassenselektor</translation> + </message> + <message> + <source>Pseudo-class</source> + <translation>Pseudoklasse</translation> + </message> + <message> + <source>Unknown pseudo-class</source> + <translation>Unbekannte Pseudoklasse</translation> + </message> + <message> + <source>Operator</source> + <translation>Operator</translation> + </message> + <message> + <source>CSS1 property</source> + <translation>CSS1 Eigenschaft</translation> + </message> + <message> + <source>Unknown property</source> + <translation>Unbekannte Eigenschaft</translation> + </message> + <message> + <source>Value</source> + <translation>Wert</translation> + </message> + <message> + <source>ID selector</source> + <translation>ID-Selektor</translation> + </message> + <message> + <source>Important</source> + <translation>Wichtig</translation> + </message> + <message> + <source>@-rule</source> + <translation>@-Regel</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Zeichenkette in Anführungszeichen</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Zeichenkette in Hochkommata</translation> + </message> + <message> + <source>CSS2 property</source> + <translation>CSS2 Eigenschaft</translation> + </message> + <message> + <source>Attribute</source> + <translation>Attribut</translation> + </message> +</context> +<context> + <name>QextScintillaLexerCSharp</name> + <message> + <source>Verbatim string</source> + <translation>Uninterpretierte Zeichenkette</translation> + </message> +</context> +<context> + <name>QextScintillaLexerDiff</name> + <message> + <source>Default</source> + <translation>Standard</translation> + </message> + <message> + <source>Comment</source> + <translation>Kommentar</translation> + </message> + <message> + <source>Command</source> + <translation>Befehl</translation> + </message> + <message> + <source>Header</source> + <translation>Kopfzeilen</translation> + </message> + <message> + <source>Position</source> + <translation>Position</translation> + </message> + <message> + <source>Removed line</source> + <translation>Entfernte Zeile</translation> + </message> + <message> + <source>Added line</source> + <translation>Hinzugefügte Zeile</translation> + </message> +</context> +<context> + <name>QextScintillaLexerHTML</name> + <message> + <source>HTML default</source> + <translation>HTML Standard</translation> + </message> + <message> + <source>Tag</source> + <translation>Tag</translation> + </message> + <message> + <source>Unknown tag</source> + <translation>Unbekanntes Tag</translation> + </message> + <message> + <source>Attribute</source> + <translation>Attribut</translation> + </message> + <message> + <source>Unknown attribute</source> + <translation>Unbekanntes Attribut</translation> + </message> + <message> + <source>HTML number</source> + <translation>HTML Zahl</translation> + </message> + <message> + <source>HTML double-quoted string</source> + <translation>HTML Zeichenkette in Anführungszeichen</translation> + </message> + <message> + <source>HTML single-quoted string</source> + <translation>HTML Zeichenkette in Hochkommata</translation> + </message> + <message> + <source>Other text in a tag</source> + <translation>Anderer Text in einem Tag</translation> + </message> + <message> + <source>HTML comment</source> + <translation>HTML Kommentar</translation> + </message> + <message> + <source>Entity</source> + <translation>Entität</translation> + </message> + <message> + <source>End of a tag</source> + <translation>Tagende</translation> + </message> + <message> + <source>Start of an XML fragment</source> + <translation>Beginn eines XML Fragmentes</translation> + </message> + <message> + <source>End of an XML fragment</source> + <translation>Ende eines XML Fragmentes</translation> + </message> + <message> + <source>Script tag</source> + <translation>Skript Tag</translation> + </message> + <message> + <source>Start of an ASP fragment with @</source> + <translation>Beginn eines ASP Fragmentes mit @</translation> + </message> + <message> + <source>Start of an ASP fragment</source> + <translation>Beginn eines ASP Fragmentes</translation> + </message> + <message> + <source>CDATA</source> + <translation>CDATA</translation> + </message> + <message> + <source>Start of a PHP fragment</source> + <translation>Beginn eines PHP Fragmentes</translation> + </message> + <message> + <source>Unquoted HTML value</source> + <translation>HTML Wert ohne Anführungszeichen</translation> + </message> + <message> + <source>ASP X-Code comment</source> + <translation>ASP X-Code Kommentar</translation> + </message> + <message> + <source>SGML default</source> + <translation>SGML Standard</translation> + </message> + <message> + <source>SGML command</source> + <translation>SGML Befehl</translation> + </message> + <message> + <source>First parameter of an SGML command</source> + <translation>Erster Parameter eines SGML Befehls</translation> + </message> + <message> + <source>SGML double-quoted string</source> + <translation>SGML Zeichenkette in Anführungszeichen</translation> + </message> + <message> + <source>SGML single-quoted string</source> + <translation>SGML Zeichenkette in Hochkommata</translation> + </message> + <message> + <source>SGML error</source> + <translation>SGML Fehler</translation> + </message> + <message> + <source>SGML special entity</source> + <translation>SGML Spezielle Entität</translation> + </message> + <message> + <source>SGML comment</source> + <translation>SGML Kommentar</translation> + </message> + <message> + <source>First parameter comment of an SGML command</source> + <translation>Kommentar des ersten Parameters eines SGML Befehls</translation> + </message> + <message> + <source>SGML block default</source> + <translation>SGML Standardblock</translation> + </message> + <message> + <source>Start of a JavaScript fragment</source> + <translation>Beginn eines JavaScript Fragmentes</translation> + </message> + <message> + <source>JavaScript default</source> + <translation>JavaScript Standard</translation> + </message> + <message> + <source>JavaScript comment</source> + <translation>JavaScript Kommentar</translation> + </message> + <message> + <source>JavaScript line comment</source> + <translation>JavaScript Zeilenkommentar</translation> + </message> + <message> + <source>JavaDoc style JavaScript comment</source> + <translation>JavaDoc JavaScript Kommentar</translation> + </message> + <message> + <source>JavaScript number</source> + <translation>JavaScript Zahl</translation> + </message> + <message> + <source>JavaScript word</source> + <translation>JavaScript Wort</translation> + </message> + <message> + <source>JavaScript keyword</source> + <translation>JavaScript Schlüsselwort</translation> + </message> + <message> + <source>JavaScript double-quoted string</source> + <translation>JavaScript Zeichenkette in Anführungszeichen</translation> + </message> + <message> + <source>JavaScript single-quoted string</source> + <translation>JavaScript Zeichenkette in Hochkommata</translation> + </message> + <message> + <source>JavaScript symbol</source> + <translation>JavaScript Symbol</translation> + </message> + <message> + <source>JavaScript unclosed string</source> + <translation>JavaScript Unbeendete Zeichenkette</translation> + </message> + <message> + <source>JavaScript regular expression</source> + <translation>JavaScript Regulärer Ausdruck</translation> + </message> + <message> + <source>Start of an ASP JavaScript fragment</source> + <translation>Beginn eines ASP JavaScript Fragmentes</translation> + </message> + <message> + <source>ASP JavaScript default</source> + <translation>ASP JavaScript Standard</translation> + </message> + <message> + <source>ASP JavaScript comment</source> + <translation>ASP JavaScript Kommentar</translation> + </message> + <message> + <source>ASP JavaScript line comment</source> + <translation>ASP JavaScript Zeilenkommentar</translation> + </message> + <message> + <source>JavaDoc style ASP JavaScript comment</source> + <translation>JavaDoc ASP JavaScript Kommentar</translation> + </message> + <message> + <source>ASP JavaScript number</source> + <translation>ASP JavaScript Zahl</translation> + </message> + <message> + <source>ASP JavaScript word</source> + <translation>ASP JavaScript Wort</translation> + </message> + <message> + <source>ASP JavaScript keyword</source> + <translation>ASP JavaScript Schlüsselwort</translation> + </message> + <message> + <source>ASP JavaScript double-quoted string</source> + <translation>ASP JavaScript Zeichenkette in Anführungszeichen</translation> + </message> + <message> + <source>ASP JavaScript single-quoted string</source> + <translation>ASP JavaScript Zeichenkette in Hochkommata</translation> + </message> + <message> + <source>ASP JavaScript symbol</source> + <translation>ASP JavaScript Symbol</translation> + </message> + <message> + <source>ASP JavaScript unclosed string</source> + <translation>ASP JavaScript Unbeendete Zeichenkette</translation> + </message> + <message> + <source>ASP JavaScript regular expression</source> + <translation>ASP JavaScript Regulärer Ausdruck</translation> + </message> + <message> + <source>Start of a VBScript fragment</source> + <translation>Beginn eines VBScript Fragmentes</translation> + </message> + <message> + <source>VBScript default</source> + <translation>VBScript Standard</translation> + </message> + <message> + <source>VBScript comment</source> + <translation>VBScript Kommentar</translation> + </message> + <message> + <source>VBScript number</source> + <translation>VBScript Zahl</translation> + </message> + <message> + <source>VBScript keyword</source> + <translation>VBScript Schlüsselwort</translation> + </message> + <message> + <source>VBScript string</source> + <translation>VBScript Zeichenkette</translation> + </message> + <message> + <source>VBScript identifier</source> + <translation>VBScript Bezeichner</translation> + </message> + <message> + <source>VBScript unclosed string</source> + <translation>VBScript Unbeendete Zeichenkette</translation> + </message> + <message> + <source>Start of an ASP VBScript fragment</source> + <translation>Beginn eines ASP VBScript Fragmentes</translation> + </message> + <message> + <source>ASP VBScript default</source> + <translation>ASP VBScript Standard</translation> + </message> + <message> + <source>ASP VBScript comment</source> + <translation>ASP VBScript Kommentar</translation> + </message> + <message> + <source>ASP VBScript number</source> + <translation>ASP VBScript Zahl</translation> + </message> + <message> + <source>ASP VBScript keyword</source> + <translation>ASP VBScript Schlüsselwort</translation> + </message> + <message> + <source>ASP VBScript string</source> + <translation>ASP VBScript Zeichenkette</translation> + </message> + <message> + <source>ASP VBScript identifier</source> + <translation>ASP VBScript Bezeichner</translation> + </message> + <message> + <source>ASP VBScript unclosed string</source> + <translation>ASP VBScript Unbeendete Zeichenkette</translation> + </message> + <message> + <source>Start of a Python fragment</source> + <translation>Beginn eines Python Fragmentes</translation> + </message> + <message> + <source>Python default</source> + <translation>Python Standard</translation> + </message> + <message> + <source>Python comment</source> + <translation>Python Kommentar</translation> + </message> + <message> + <source>Python number</source> + <translation>Python Zahl</translation> + </message> + <message> + <source>Python double-quoted string</source> + <translation>Python Zeichenkette in Anführungszeichen</translation> + </message> + <message> + <source>Python single-quoted string</source> + <translation>Python Zeichenkette in Hochkommata</translation> + </message> + <message> + <source>Python keyword</source> + <translation>Python Schlüsselwort</translation> + </message> + <message> + <source>Python triple double-quoted string</source> + <translation>Python Zeichenkette in dreifachen Anführungszeichen</translation> + </message> + <message> + <source>Python triple single-quoted string</source> + <translation>Python Zeichenkette in dreifachen Hochkommata</translation> + </message> + <message> + <source>Python class name</source> + <translation>Python Klassenname</translation> + </message> + <message> + <source>Python function or method name</source> + <translation>Python Funktions- oder Methodenname</translation> + </message> + <message> + <source>Python operator</source> + <translation>Python Operator</translation> + </message> + <message> + <source>Python identifier</source> + <translation>Python Bezeichner</translation> + </message> + <message> + <source>Start of an ASP Python fragment</source> + <translation>Beginn eines ASP Python Fragmentes</translation> + </message> + <message> + <source>ASP Python default</source> + <translation>ASP Python Standard</translation> + </message> + <message> + <source>ASP Python comment</source> + <translation>ASP Python Kommentar</translation> + </message> + <message> + <source>ASP Python number</source> + <translation>ASP Python Zahl</translation> + </message> + <message> + <source>ASP Python double-quoted string</source> + <translation>ASP Python Zeichenkette in Anführungszeichen</translation> + </message> + <message> + <source>ASP Python single-quoted string</source> + <translation>ASP Python Zeichenkette in Hochkommata</translation> + </message> + <message> + <source>ASP Python keyword</source> + <translation>ASP Python Schlüsselwort</translation> + </message> + <message> + <source>ASP Python triple double-quoted string</source> + <translation>ASP Python Zeichenkette in dreifachen Anführungszeichen</translation> + </message> + <message> + <source>ASP Python triple single-quoted string</source> + <translation>ASP Python Zeichenkette in dreifachen Hochkommata</translation> + </message> + <message> + <source>ASP Python class name</source> + <translation>ASP Python Klassenname</translation> + </message> + <message> + <source>ASP Python function or method name</source> + <translation>ASP Python Funktions- oder Methodenname</translation> + </message> + <message> + <source>ASP Python operator</source> + <translation>ASP Python Operator</translation> + </message> + <message> + <source>ASP Python identifier</source> + <translation>ASP Python Bezeichner</translation> + </message> + <message> + <source>PHP default</source> + <translation>PHP Standard</translation> + </message> + <message> + <source>PHP double-quoted string</source> + <translation>PHP Zeichenkette in Anführungszeichen</translation> + </message> + <message> + <source>PHP single-quoted string</source> + <translation>PHP Zeichenkette in Hochkommata</translation> + </message> + <message> + <source>PHP keyword</source> + <translation>PHP Schlüsselwort</translation> + </message> + <message> + <source>PHP number</source> + <translation>PHP Zahl</translation> + </message> + <message> + <source>PHP comment</source> + <translation>PHP Kommentar</translation> + </message> + <message> + <source>PHP line comment</source> + <translation>PHP Zeilenkommentar</translation> + </message> + <message> + <source>PHP double-quoted variable</source> + <translation>PHP Variable in Anführungszeichen</translation> + </message> + <message> + <source>PHP operator</source> + <translation>PHP Operator</translation> + </message> + <message> + <source>PHP variable</source> + <translation>PHP Variable</translation> + </message> +</context> +<context> + <name>QextScintillaLexerIDL</name> + <message> + <source>UUID</source> + <translation>UUID</translation> + </message> +</context> +<context> + <name>QextScintillaLexerJavaScript</name> + <message> + <source>Regular expression</source> + <translation>Regulärer Ausdruck</translation> + </message> +</context> +<context> + <name>QextScintillaLexerLua</name> + <message> + <source>Default</source> + <translation>Standard</translation> + </message> + <message> + <source>Comment</source> + <translation>Kommentar</translation> + </message> + <message> + <source>Line comment</source> + <translation>Zeilenkommentar</translation> + </message> + <message> + <source>Number</source> + <translation>Zahl</translation> + </message> + <message> + <source>Keyword</source> + <translation>Schlüsselwort</translation> + </message> + <message> + <source>String</source> + <translation>Zeichenkette</translation> + </message> + <message> + <source>Character</source> + <translation>Zeichen</translation> + </message> + <message> + <source>Literal string</source> + <translation>Uninterpretierte Zeichenkette</translation> + </message> + <message> + <source>Preprocessor</source> + <translation>Preprozessor</translation> + </message> + <message> + <source>Operator</source> + <translation>Operator</translation> + </message> + <message> + <source>Identifier</source> + <translation>Bezeichner</translation> + </message> + <message> + <source>Unclosed string</source> + <translation>Unbeendete Zeichenkette</translation> + </message> + <message> + <source>Basic functions</source> + <translation>Basisfunktionen</translation> + </message> + <message> + <source>String, table and maths functions</source> + <translation>Zeichenketten-, Tabelle- und mathematische Funktionen</translation> + </message> + <message> + <source>Coroutines, i/o and system facilities</source> + <translation>Koroutinen, I/O- und Systemfunktionen</translation> + </message> +</context> +<context> + <name>QextScintillaLexerMakefile</name> + <message> + <source>Default</source> + <translation>Standard</translation> + </message> + <message> + <source>Comment</source> + <translation>Kommentar</translation> + </message> + <message> + <source>Preprocessor</source> + <translation>Preprozessor</translation> + </message> + <message> + <source>Variable</source> + <translation>Variable</translation> + </message> + <message> + <source>Operator</source> + <translation>Operator</translation> + </message> + <message> + <source>Target</source> + <translation>Ziel</translation> + </message> + <message> + <source>Error</source> + <translation>Fehler</translation> + </message> +</context> +<context> + <name>QextScintillaLexerPOV</name> + <message> + <source>Default</source> + <translation>Standard</translation> + </message> + <message> + <source>Comment</source> + <translation>Kommentar</translation> + </message> + <message> + <source>Comment line</source> + <translation>Kommentarzeile</translation> + </message> + <message> + <source>Number</source> + <translation>Zahl</translation> + </message> + <message> + <source>Operator</source> + <translation>Operator</translation> + </message> + <message> + <source>Identifier</source> + <translation>Bezeichner</translation> + </message> + <message> + <source>String</source> + <translation>Zeichenkette</translation> + </message> + <message> + <source>Unclosed string</source> + <translation>Unbeendete Zeichenkette</translation> + </message> + <message> + <source>Directive</source> + <translation>Direktive</translation> + </message> + <message> + <source>Bad directive</source> + <translation>Ungültige Direktive</translation> + </message> + <message> + <source>Objects, CSG and appearance</source> + <translation>Objekte, CSG und Erscheinung</translation> + </message> + <message> + <source>Types, modifiers and items</source> + <translation>Typen, Modifizierer und Items</translation> + </message> + <message> + <source>Predefined identifiers</source> + <translation>Vordefinierter Bezeichner</translation> + </message> + <message> + <source>Predefined functions</source> + <translation>Vordefinierte Funktion</translation> + </message> + <message> + <source>User defined 1</source> + <translation>Nutzerdefiniert 1</translation> + </message> + <message> + <source>User defined 2</source> + <translation>Nutzerdefiniert 2</translation> + </message> + <message> + <source>User defined 3</source> + <translation>Nutzerdefiniert 3</translation> + </message> +</context> +<context> + <name>QextScintillaLexerPerl</name> + <message> + <source>Default</source> + <translation>Standard</translation> + </message> + <message> + <source>Error</source> + <translation>Fehler</translation> + </message> + <message> + <source>Comment</source> + <translation>Kommentar</translation> + </message> + <message> + <source>POD</source> + <translation>POD</translation> + </message> + <message> + <source>Number</source> + <translation>Zahl</translation> + </message> + <message> + <source>Keyword</source> + <translation>Schlüsselwort</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Zeichenkette in Anführungszeichen</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Zeichenkette in Hochkommata</translation> + </message> + <message> + <source>Operator</source> + <translation>Operator</translation> + </message> + <message> + <source>Identifier</source> + <translation>Bezeichner</translation> + </message> + <message> + <source>Scalar</source> + <translation>Skalar</translation> + </message> + <message> + <source>Array</source> + <translation>Feld</translation> + </message> + <message> + <source>Hash</source> + <translation>Hash</translation> + </message> + <message> + <source>Symbol table</source> + <translation>Symboltabelle</translation> + </message> + <message> + <source>Regular expression</source> + <translation>Regulärer Ausdruck</translation> + </message> + <message> + <source>Substitution</source> + <translation>Ersetzung</translation> + </message> + <message> + <source>Backticks</source> + <translation>Backticks</translation> + </message> + <message> + <source>Data section</source> + <translation>Datensektion</translation> + </message> + <message> + <source>Here document delimiter</source> + <translation>Here Dokument-Begrenzer</translation> + </message> + <message> + <source>Single-quoted here document</source> + <translation>Here Dokument in Hochkommata</translation> + </message> + <message> + <source>Double-quoted here document</source> + <translation>Here Dokument in Anführungszeichen</translation> + </message> + <message> + <source>Backtick here document</source> + <translation>Here Dokument in Backticks</translation> + </message> + <message> + <source>Quoted string (q)</source> + <translation>Zeichenkette (q)</translation> + </message> + <message> + <source>Quoted string (qq)</source> + <translation>Zeichenkette (qq)</translation> + </message> + <message> + <source>Quoted string (qx)</source> + <translation>Zeichenkette (qx)</translation> + </message> + <message> + <source>Quoted string (qr)</source> + <translation>Zeichenkette (qr)</translation> + </message> + <message> + <source>Quoted string (qw)</source> + <translation>Zeichenkette (qw)</translation> + </message> + <message> + <source>POD verbatim</source> + <translation>POD wörtlich</translation> + </message> +</context> +<context> + <name>QextScintillaLexerProperties</name> + <message> + <source>Default</source> + <translation>Standard</translation> + </message> + <message> + <source>Comment</source> + <translation>Kommentar</translation> + </message> + <message> + <source>Section</source> + <translation>Abschnitt</translation> + </message> + <message> + <source>Assignment</source> + <translation>Zuweisung</translation> + </message> + <message> + <source>Default value</source> + <translation>Standardwert</translation> + </message> +</context> +<context> + <name>QextScintillaLexerPython</name> + <message> + <source>Comment</source> + <translation>Kommentar</translation> + </message> + <message> + <source>Number</source> + <translation>Zahl</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Zeichenkette in Anführungszeichen</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Zeichenkette in Hochkommata</translation> + </message> + <message> + <source>Keyword</source> + <translation>Schlüsselwort</translation> + </message> + <message> + <source>Triple single-quoted string</source> + <translation>Zeichenkette in dreifachen Hochkommata</translation> + </message> + <message> + <source>Triple double-quoted string</source> + <translation>Zeichenkette in dreifachen Anführungszeichen</translation> + </message> + <message> + <source>Class name</source> + <translation>Klassenname</translation> + </message> + <message> + <source>Function or method name</source> + <translation>Funktions- oder Methodenname</translation> + </message> + <message> + <source>Operator</source> + <translation>Operator</translation> + </message> + <message> + <source>Identifier</source> + <translation>Bezeichner</translation> + </message> + <message> + <source>Comment block</source> + <translation>Kommentarblock</translation> + </message> + <message> + <source>Unclosed string</source> + <translation>Unbeendete Zeichenkette</translation> + </message> + <message> + <source>Default</source> + <translation>Standard</translation> + </message> + <message> + <source>Highlighted identifier</source> + <translation>Hervorgehobener Bezeichner</translation> + </message> + <message> + <source>Decorator</source> + <translation>Dekorator</translation> + </message> +</context> +<context> + <name>QextScintillaLexerRuby</name> + <message> + <source>Default</source> + <translation>Standard</translation> + </message> + <message> + <source>Comment</source> + <translation>Kommentar</translation> + </message> + <message> + <source>Number</source> + <translation>Zahl</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Zeichenkette in Anführungszeichen</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Zeichenkette in Hochkommata</translation> + </message> + <message> + <source>Keyword</source> + <translation>Schlüsselwort</translation> + </message> + <message> + <source>Class name</source> + <translation>Klassenname</translation> + </message> + <message> + <source>Function or method name</source> + <translation>Funktions- oder Methodenname</translation> + </message> + <message> + <source>Operator</source> + <translation>Operator</translation> + </message> + <message> + <source>Identifier</source> + <translation>Bezeichner</translation> + </message> + <message> + <source>Error</source> + <translation>Fehler</translation> + </message> + <message> + <source>POD</source> + <translation>POD</translation> + </message> + <message> + <source>Regular expression</source> + <translation>Regulärer Ausdruck</translation> + </message> + <message> + <source>Global</source> + <translation>Global</translation> + </message> + <message> + <source>Symbol</source> + <translation>Symbol</translation> + </message> + <message> + <source>Module name</source> + <translation>Modulname</translation> + </message> + <message> + <source>Instance variable</source> + <translation>Instanzvariable</translation> + </message> + <message> + <source>Class variable</source> + <translation>Klassenvariable</translation> + </message> + <message> + <source>Backticks</source> + <translation>Backticks</translation> + </message> + <message> + <source>Data section</source> + <translation>Datensektion</translation> + </message> + <message> + <source>Here document delimiter</source> + <translation>Here Dokument-Begrenzer</translation> + </message> + <message> + <source>Here document</source> + <translation>Here Dokument</translation> + </message> + <message> + <source>%q string</source> + <translation>%q Zeichenkette</translation> + </message> + <message> + <source>%Q string</source> + <translation>%Q Zeichenkette</translation> + </message> + <message> + <source>%x string</source> + <translation>%x Zeichenkette</translation> + </message> + <message> + <source>%r string</source> + <translation>%r Zeichenkette</translation> + </message> + <message> + <source>%w string</source> + <translation>%w Zeichenkette</translation> + </message> + <message> + <source>Demoted keyword</source> + <translation>zurückgestuftes Schlüsselwort</translation> + </message> + <message> + <source>stdin</source> + <translation>Stdin</translation> + </message> + <message> + <source>stdout</source> + <translation>Stdout</translation> + </message> + <message> + <source>stderr</source> + <translation>Stderr</translation> + </message> +</context> +<context> + <name>QextScintillaLexerSQL</name> + <message> + <source>Default</source> + <translation>Standard</translation> + </message> + <message> + <source>Comment</source> + <translation>Kommentar</translation> + </message> + <message> + <source>Number</source> + <translation>Zahl</translation> + </message> + <message> + <source>Keyword</source> + <translation>Schlüsselwort</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Zeichenkette in Hochkommata</translation> + </message> + <message> + <source>Operator</source> + <translation>Operator</translation> + </message> + <message> + <source>Identifier</source> + <translation>Bezeichner</translation> + </message> + <message> + <source>Comment line</source> + <translation>Kommentarzeile</translation> + </message> + <message> + <source>JavaDoc style comment</source> + <translation>JavaDoc Kommentar</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Zeichenkette in Anführungszeichen</translation> + </message> + <message> + <source>SQL*Plus keyword</source> + <translation>SQL*Plus Schlüsselwort</translation> + </message> + <message> + <source>SQL*Plus prompt</source> + <translation>SQL*Plus Eingabe</translation> + </message> + <message> + <source>SQL*Plus comment</source> + <translation>SQL*Plus Kommentar</translation> + </message> + <message> + <source># comment line</source> + <translation># Kommentarzeile</translation> + </message> + <message> + <source>JavaDoc keyword</source> + <translation>JavaDoc Schlüsselwort</translation> + </message> + <message> + <source>JavaDoc keyword error</source> + <translation>JavaDoc Schlüsselwortfehler</translation> + </message> + <message> + <source>User defined 1</source> + <translation>Nutzerdefiniert 1</translation> + </message> + <message> + <source>User defined 2</source> + <translation>Nutzerdefiniert 2</translation> + </message> + <message> + <source>User defined 3</source> + <translation>Nutzerdefiniert 3</translation> + </message> + <message> + <source>User defined 4</source> + <translation>Nutzerdefiniert 4</translation> + </message> +</context> +<context> + <name>QextScintillaLexerTeX</name> + <message> + <source>Default</source> + <translation>Standard</translation> + </message> + <message> + <source>Special</source> + <translation>Spezial</translation> + </message> + <message> + <source>Group</source> + <translation>Gruppe</translation> + </message> + <message> + <source>Symbol</source> + <translation>Symbol</translation> + </message> + <message> + <source>Command</source> + <translation>Befehl</translation> + </message> + <message> + <source>Text</source> + <translation>Text</translation> + </message> +</context> +</TS> diff --git a/qt/qscintilla_fr.qm b/qt/qscintilla_fr.qm Binary files differnew file mode 100644 index 0000000..4fbed09 --- /dev/null +++ b/qt/qscintilla_fr.qm diff --git a/qt/qscintilla_fr.ts b/qt/qscintilla_fr.ts new file mode 100644 index 0000000..481b603 --- /dev/null +++ b/qt/qscintilla_fr.ts @@ -0,0 +1,1635 @@ +<!DOCTYPE TS><TS> +<context> + <name>QextScintillaCommand</name> + <message> + <source>Move down one line</source> + <translation>Déplacement d'une ligne vers le bas</translation> + </message> + <message> + <source>Extend selection down one line</source> + <translation>Extension de la sélection d'une ligne vers le bas</translation> + </message> + <message> + <source>Scroll view down one line</source> + <translation>Decendre la vue d'une ligne</translation> + </message> + <message> + <source>Extend rectangular selection down one line</source> + <translation>Extension de la sélection rectangulaire d'une ligne vers le bas</translation> + </message> + <message> + <source>Move up one line</source> + <translation>Déplacement d'une ligne vers le haut</translation> + </message> + <message> + <source>Extend selection up one line</source> + <translation>Extension de la sélection d'une ligne vers le haut</translation> + </message> + <message> + <source>Scroll view up one line</source> + <translation>Remonter la vue d'une ligne</translation> + </message> + <message> + <source>Extend rectangular selection up one line</source> + <translation>Extension de la sélection rectangulaire d'une ligne vers le haut</translation> + </message> + <message> + <source>Move up one paragraph</source> + <translation>Déplacement d'un paragraphe vers le haut</translation> + </message> + <message> + <source>Extend selection up one paragraph</source> + <translation>Extension de la sélection d'un paragraphe vers le haut</translation> + </message> + <message> + <source>Move down one paragraph</source> + <translation>Déplacement d'un paragraphe vers le bas</translation> + </message> + <message> + <source>Extend selection down one paragraph</source> + <translation>Extension de la sélection d'un paragraphe vers le bas</translation> + </message> + <message> + <source>Move left one character</source> + <translation>Déplacement d'un caractère vers la gauche</translation> + </message> + <message> + <source>Extend selection left one character</source> + <translation>Extension de la sélection d'un caractère vers la gauche</translation> + </message> + <message> + <source>Move left one word</source> + <translation>Déplacement d'un mot vers la gauche</translation> + </message> + <message> + <source>Extend selection left one word</source> + <translation>Extension de la sélection d'un mot vers la gauche</translation> + </message> + <message> + <source>Extend rectangular selection left one character</source> + <translation>Extension de la sélection rectangulaire d'un caractère vers la gauche</translation> + </message> + <message> + <source>Move right one character</source> + <translation>Déplacement d'un caractère vers la droite</translation> + </message> + <message> + <source>Extend selection right one character</source> + <translation>Extension de la sélection d'un caractère vers la droite</translation> + </message> + <message> + <source>Move right one word</source> + <translation>Déplacement d'un mot vers la droite</translation> + </message> + <message> + <source>Extend selection right one word</source> + <translation>Extension de la sélection d'un mot vers la droite</translation> + </message> + <message> + <source>Extend rectangular selection right one character</source> + <translation>Extension de la sélection rectangulaire d'un caractère vers la droite</translation> + </message> + <message> + <source>Move left one word part</source> + <translation>Déplacement d'une part de mot vers la gauche</translation> + </message> + <message> + <source>Extend selection left one word part</source> + <translation>Extension de la sélection d'une part de mot vers la gauche</translation> + </message> + <message> + <source>Move right one word part</source> + <translation>Déplacement d'une part de mot vers la droite</translation> + </message> + <message> + <source>Extend selection right one word part</source> + <translation>Extension de la sélection d'une part de mot vers la droite</translation> + </message> + <message> + <source>Move to first visible character in line</source> + <translation>Déplacement vers le premier caractère visible de la ligne</translation> + </message> + <message> + <source>Extend selection to first visible character in line</source> + <translation>Extension de la sélection jusqu'au premier caractère visible de la ligne</translation> + </message> + <message> + <source>Move to start of text</source> + <translation>Déplacement au début du texte</translation> + </message> + <message> + <source>Extend selection to start of text</source> + <translation>Extension de la sélection jusqu'au début du texte</translation> + </message> + <message> + <source>Move to start of displayed line</source> + <translation>Déplacement au le début de la ligne affichée</translation> + </message> + <message> + <source>Extend selection to start of line</source> + <translation>Extension de la sélection jusqu'au début de la ligne</translation> + </message> + <message> + <source>Extend rectangular selection to first visible character in line</source> + <translation>Extension de la sélection rectangulaire jusqu'au premier caractère visible de la ligne</translation> + </message> + <message> + <source>Move to end of line</source> + <translation>Déplacement à la fin de la ligne</translation> + </message> + <message> + <source>Extend selection to end of line</source> + <translation>Extension de la sélection jusqu'à la fin de la ligne</translation> + </message> + <message> + <source>Move to end of text</source> + <translation>Déplacement à la fin du du texte</translation> + </message> + <message> + <source>Extend selection to end of text</source> + <translation>Extension de la sélection jusqu'à la fin du texte</translation> + </message> + <message> + <source>Move to end of displayed line</source> + <translation>Déplacement à la fin de la ligne affichée</translation> + </message> + <message> + <source>Extend selection to end of displayed line</source> + <translation>Extension de la sélection à la fin de la ligne affichée</translation> + </message> + <message> + <source>Extend rectangular selection to end of line</source> + <translation>Extension de la sélection rectangulaire à la fin de la ligne</translation> + </message> + <message> + <source>Move up one page</source> + <translation>Déplacement d'une page vers le haut</translation> + </message> + <message> + <source>Extend selection up one page</source> + <translation>Extension de la sélection d'une page vers le haut</translation> + </message> + <message> + <source>Extend rectangular selection up one page</source> + <translation>Extension de la sélection rectangulaire d'une page vers le haut</translation> + </message> + <message> + <source>Move down one page</source> + <translation>Déplacement d'une page vers le bas</translation> + </message> + <message> + <source>Extend selection down one page</source> + <translation>Extension de la sélection d'une page vers le bas</translation> + </message> + <message> + <source>Extend rectangular selection down one page</source> + <translation>Extension de la sélection rectangulaire d'une page vers le bas</translation> + </message> + <message> + <source>Delete current character</source> + <translation>Effacement du caractère courant</translation> + </message> + <message> + <source>Cut selection</source> + <translation>Couper la sélection</translation> + </message> + <message> + <source>Delete word to right</source> + <translation>Suppression du mot de droite</translation> + </message> + <message> + <source>Delete line to right</source> + <translation>Suppression de la partie droite de la ligne</translation> + </message> + <message> + <source>Toggle insert/overtype</source> + <translation>Basculement Insertion /Ecrasement</translation> + </message> + <message> + <source>Paste</source> + <translation>Coller</translation> + </message> + <message> + <source>Copy selection</source> + <translation>Copier la sélection</translation> + </message> + <message> + <source>Cancel</source> + <translation>Annuler</translation> + </message> + <message> + <source>Delete previous character</source> + <translation>Suppression du dernier caractère</translation> + </message> + <message> + <source>Delete word to left</source> + <translation>Suppression du mot de gauche</translation> + </message> + <message> + <source>Undo the last command</source> + <translation>Annuler la dernière commande</translation> + </message> + <message> + <source>Delete line to left</source> + <translation>Effacer la partie gauche de la ligne</translation> + </message> + <message> + <source>Redo last command</source> + <translation>Refaire la dernière commande</translation> + </message> + <message> + <source>Select all text</source> + <translation>Sélectionner tout le texte</translation> + </message> + <message> + <source>Indent one level</source> + <translation>Indentation d'un niveau</translation> + </message> + <message> + <source>Move back one indentation level</source> + <translation>Désindentation d'un niveau</translation> + </message> + <message> + <source>Insert new line</source> + <translation>Insertion d'une nouvelle ligne</translation> + </message> + <message> + <source>Zoom in</source> + <translation>Zoom avant</translation> + </message> + <message> + <source>Zoom out</source> + <translation>Zoom arrière</translation> + </message> + <message> + <source>Set zoom</source> + <translation>Définition du zoom</translation> + </message> + <message> + <source>Formfeed</source> + <translation>Chargement de la page</translation> + </message> + <message> + <source>Cut current line</source> + <translation>Couper la ligne courante</translation> + </message> + <message> + <source>Delete current line</source> + <translation>Suppression de la ligne courante</translation> + </message> + <message> + <source>Copy current line</source> + <translation>Copier la ligne courante</translation> + </message> + <message> + <source>Swap current and previous lines</source> + <translation>Permuter la ligne précédente avec la ligne courante</translation> + </message> + <message> + <source>Convert selection to lower case</source> + <translation>Conversion de la ligne courante en minuscules</translation> + </message> + <message> + <source>Convert selection to upper case</source> + <translation>Conversion de la ligne courante en majuscules</translation> + </message> + <message> + <source>Delete previous character if not at line start</source> + <translation>Suppression du caractère précédent sauf en début de ligne</translation> + </message> + <message> + <source>Duplicate selection</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerBash</name> + <message> + <source>Default</source> + <translation>Par défaut</translation> + </message> + <message> + <source>Error</source> + <translation>Erreur</translation> + </message> + <message> + <source>Comment</source> + <translation>Commentaire</translation> + </message> + <message> + <source>Number</source> + <translation>Nombre</translation> + </message> + <message> + <source>Keyword</source> + <translation>Mot-clé</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Chaine de caractères (guillemets doubles)</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Chaine de caractères (guillemets simples)</translation> + </message> + <message> + <source>Operator</source> + <translation>Opérateur</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificateur</translation> + </message> + <message> + <source>Scalar</source> + <translation>Scalaire</translation> + </message> + <message> + <source>Parameter expansion</source> + <translation>Extension de paramètre</translation> + </message> + <message> + <source>Backticks</source> + <translation>Quotes inverses</translation> + </message> + <message> + <source>Here document delimiter</source> + <translation>Délimiteur de texte intégré (cat <<EOF....EOF)</translation> + </message> + <message> + <source>Single-quoted here document</source> + <translation>Document intégré guillemets simples</translation> + </message> +</context> +<context> + <name>QextScintillaLexerBatch</name> + <message> + <source>Default</source> + <translation>Par défaut</translation> + </message> + <message> + <source>Comment</source> + <translation>Commentaire</translation> + </message> + <message> + <source>Keyword</source> + <translation>Mot-clé</translation> + </message> + <message> + <source>Label</source> + <translation>Titre</translation> + </message> + <message> + <source>Hide command character</source> + <translation>Cacher le caratère de commande</translation> + </message> + <message> + <source>External command</source> + <translation>Commande externe</translation> + </message> + <message> + <source>Variable</source> + <translation>Variable</translation> + </message> + <message> + <source>Operator</source> + <translation>Opérateur</translation> + </message> +</context> +<context> + <name>QextScintillaLexerCPP</name> + <message> + <source>Default</source> + <translation>Par défaut</translation> + </message> + <message> + <source>C comment</source> + <translation>Commentaire C</translation> + </message> + <message> + <source>C++ comment</source> + <translation>Commentaire C++</translation> + </message> + <message> + <source>JavaDoc style C comment</source> + <translation>Commentaire C de style JavaDoc</translation> + </message> + <message> + <source>Number</source> + <translation>Nombre</translation> + </message> + <message> + <source>Keyword</source> + <translation>Mot-clé</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Chaine de caractères (guillemets doubles)</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Chaine de caractères (guillemets simples)</translation> + </message> + <message> + <source>Pre-processor block</source> + <translation>Instructions de pré-processing</translation> + </message> + <message> + <source>Operator</source> + <translation>Opérateur</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificateur</translation> + </message> + <message> + <source>Unclosed string</source> + <translation>Chaine de caractères non refermée</translation> + </message> + <message> + <source>JavaDoc style C++ comment</source> + <translation>Commentaire C++ de style JavaDoc</translation> + </message> + <message> + <source>Secondary keywords and identifiers</source> + <translation>Seconds mots-clés et identificateurs</translation> + </message> + <message> + <source>JavaDoc keyword</source> + <translation>Mot-clé JavaDoc</translation> + </message> + <message> + <source>JavaDoc keyword error</source> + <translation>Erreur de mot-clé JavaDoc</translation> + </message> + <message> + <source>Global classes and typedefs</source> + <translation>Classes globales et définitions de types</translation> + </message> +</context> +<context> + <name>QextScintillaLexerCSS</name> + <message> + <source>Default</source> + <translation>Par défaut</translation> + </message> + <message> + <source>Tag</source> + <translation>Balise</translation> + </message> + <message> + <source>Class selector</source> + <translation>Classe</translation> + </message> + <message> + <source>Pseudo-class</source> + <translation>Pseudo-classe</translation> + </message> + <message> + <source>Unknown pseudo-class</source> + <translation>Peudo-classe inconnue</translation> + </message> + <message> + <source>Operator</source> + <translation>Opérateur</translation> + </message> + <message> + <source>CSS1 property</source> + <translation>Propriété CSS1</translation> + </message> + <message> + <source>Unknown property</source> + <translation>Propriété inconnue</translation> + </message> + <message> + <source>Value</source> + <translation>Valeur</translation> + </message> + <message> + <source>ID selector</source> + <translation>ID</translation> + </message> + <message> + <source>Important</source> + <translation>Important</translation> + </message> + <message> + <source>@-rule</source> + <translation>règle-@</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Chaine de caractères (guillemets doubles)</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Chaine de caractères (guillemets simples)</translation> + </message> + <message> + <source>CSS2 property</source> + <translation>Propriété CSS2</translation> + </message> + <message> + <source>Attribute</source> + <translation>Attribut</translation> + </message> +</context> +<context> + <name>QextScintillaLexerCSharp</name> + <message> + <source>Verbatim string</source> + <translation>Chaine verbatim</translation> + </message> +</context> +<context> + <name>QextScintillaLexerDiff</name> + <message> + <source>Default</source> + <translation>Par défaut</translation> + </message> + <message> + <source>Comment</source> + <translation>Commentaire</translation> + </message> + <message> + <source>Command</source> + <translation>Commande</translation> + </message> + <message> + <source>Header</source> + <translation>En-tête</translation> + </message> + <message> + <source>Position</source> + <translation>Position</translation> + </message> + <message> + <source>Removed line</source> + <translation>Ligne supprimée</translation> + </message> + <message> + <source>Added line</source> + <translation>Ligne ajoutée</translation> + </message> +</context> +<context> + <name>QextScintillaLexerHTML</name> + <message> + <source>HTML default</source> + <translation>HTML par défaut</translation> + </message> + <message> + <source>Tag</source> + <translation>Balise</translation> + </message> + <message> + <source>Unknown tag</source> + <translation>Balise inconnue</translation> + </message> + <message> + <source>Attribute</source> + <translation>Attribut</translation> + </message> + <message> + <source>Unknown attribute</source> + <translation>Attribut inconnu</translation> + </message> + <message> + <source>HTML number</source> + <translation>Nombre HTML</translation> + </message> + <message> + <source>HTML double-quoted string</source> + <translation>Chaine de caractères HTML (guillemets doubles)</translation> + </message> + <message> + <source>HTML single-quoted string</source> + <translation>Chaine de caractères HTML (guillemets simples)</translation> + </message> + <message> + <source>Other text in a tag</source> + <translation>Autre texte dans les balises</translation> + </message> + <message> + <source>HTML comment</source> + <translation>Commentaire HTML</translation> + </message> + <message> + <source>Entity</source> + <translation>Entité</translation> + </message> + <message> + <source>End of a tag</source> + <translation>Balise fermante</translation> + </message> + <message> + <source>Start of an XML fragment</source> + <translation>Début de block XML</translation> + </message> + <message> + <source>End of an XML fragment</source> + <translation>Fin de block XML</translation> + </message> + <message> + <source>Script tag</source> + <translation>Balise de script</translation> + </message> + <message> + <source>Start of an ASP fragment with @</source> + <translation>Début de block ASP avec @</translation> + </message> + <message> + <source>Start of an ASP fragment</source> + <translation>Début de block ASP</translation> + </message> + <message> + <source>CDATA</source> + <translation>CDATA</translation> + </message> + <message> + <source>Start of a PHP fragment</source> + <translation>Début de block PHP</translation> + </message> + <message> + <source>Unquoted HTML value</source> + <translation>Valeur HTML sans guillemets</translation> + </message> + <message> + <source>ASP X-Code comment</source> + <translation>Commentaire X-Code ASP</translation> + </message> + <message> + <source>SGML default</source> + <translation>SGML par défaut</translation> + </message> + <message> + <source>SGML command</source> + <translation>Commande SGML</translation> + </message> + <message> + <source>First parameter of an SGML command</source> + <translation>Premier paramètre de commande SGML</translation> + </message> + <message> + <source>SGML double-quoted string</source> + <translation>Chaine de caractères SGML (guillemets doubles)</translation> + </message> + <message> + <source>SGML single-quoted string</source> + <translation>Chaine de caractères SGML (guillemets simples)</translation> + </message> + <message> + <source>SGML error</source> + <translation>Erreur SGML</translation> + </message> + <message> + <source>SGML special entity</source> + <translation>Entité SGML spéciale</translation> + </message> + <message> + <source>SGML comment</source> + <translation>Commentaire SGML</translation> + </message> + <message> + <source>First parameter comment of an SGML command</source> + <translation>Premier paramètre de commentaire de commande SGML</translation> + </message> + <message> + <source>SGML block default</source> + <translation>Block SGML par défaut</translation> + </message> + <message> + <source>Start of a JavaScript fragment</source> + <translation>Début de block JavaScript</translation> + </message> + <message> + <source>JavaScript default</source> + <translation>JavaScript par défaut</translation> + </message> + <message> + <source>JavaScript comment</source> + <translation>Commentaire JavaScript</translation> + </message> + <message> + <source>JavaScript line comment</source> + <translation>Commentaire de ligne JavaScript</translation> + </message> + <message> + <source>JavaDoc style JavaScript comment</source> + <translation>Commentaire JavaScript de style JavaDoc</translation> + </message> + <message> + <source>JavaScript number</source> + <translation>Nombre JavaScript</translation> + </message> + <message> + <source>JavaScript word</source> + <translation>Mot JavaScript</translation> + </message> + <message> + <source>JavaScript keyword</source> + <translation>Mot-clé JavaScript</translation> + </message> + <message> + <source>JavaScript double-quoted string</source> + <translation>Chaine de caractères JavaScript (guillemets doubles)</translation> + </message> + <message> + <source>JavaScript single-quoted string</source> + <translation>Chaine de caractères JavaScript (guillemets simples)</translation> + </message> + <message> + <source>JavaScript symbol</source> + <translation>Symbole JavaScript</translation> + </message> + <message> + <source>JavaScript unclosed string</source> + <translation>Chaine de caractères JavaScript non refermée</translation> + </message> + <message> + <source>JavaScript regular expression</source> + <translation>Expression régulière JavaScript</translation> + </message> + <message> + <source>Start of an ASP JavaScript fragment</source> + <translation>Début de block JavaScript ASP</translation> + </message> + <message> + <source>ASP JavaScript default</source> + <translation>JavaScript ASP par défaut</translation> + </message> + <message> + <source>ASP JavaScript comment</source> + <translation>Commentaire JavaScript ASP</translation> + </message> + <message> + <source>ASP JavaScript line comment</source> + <translation>Commentaire de ligne JavaScript ASP</translation> + </message> + <message> + <source>JavaDoc style ASP JavaScript comment</source> + <translation>Commentaire JavaScript ASP de style JavaDoc</translation> + </message> + <message> + <source>ASP JavaScript number</source> + <translation>Nombre JavaScript ASP</translation> + </message> + <message> + <source>ASP JavaScript word</source> + <translation>Mot JavaScript ASP</translation> + </message> + <message> + <source>ASP JavaScript keyword</source> + <translation>Mot-clé JavaScript ASP </translation> + </message> + <message> + <source>ASP JavaScript double-quoted string</source> + <translation>Chaine de caractères JavaScript ASP (guillemets doubles)</translation> + </message> + <message> + <source>ASP JavaScript single-quoted string</source> + <translation>Chaine de caractères JavaScript ASP (guillemets simples)</translation> + </message> + <message> + <source>ASP JavaScript symbol</source> + <translation>Symbole JavaScript ASP</translation> + </message> + <message> + <source>ASP JavaScript unclosed string</source> + <translation>Chaine de caractères JavaScript ASP non refermée</translation> + </message> + <message> + <source>ASP JavaScript regular expression</source> + <translation>Expression régulière JavaScript ASP</translation> + </message> + <message> + <source>Start of a VBScript fragment</source> + <translation>Début de block VBScript</translation> + </message> + <message> + <source>VBScript default</source> + <translation>VBScript par défaut</translation> + </message> + <message> + <source>VBScript comment</source> + <translation>Commentaire VBScript</translation> + </message> + <message> + <source>VBScript number</source> + <translation>Nombre VBScript</translation> + </message> + <message> + <source>VBScript keyword</source> + <translation>Mot-clé VBScript</translation> + </message> + <message> + <source>VBScript string</source> + <translation>Chaine de caractères VBScript</translation> + </message> + <message> + <source>VBScript identifier</source> + <translation>Identificateur VBScript</translation> + </message> + <message> + <source>VBScript unclosed string</source> + <translation>Chaine de caractères VBScript non refermée</translation> + </message> + <message> + <source>Start of an ASP VBScript fragment</source> + <translation>Début de block VBScript ASP</translation> + </message> + <message> + <source>ASP VBScript default</source> + <translation>VBScript ASP par défaut</translation> + </message> + <message> + <source>ASP VBScript comment</source> + <translation>Commentaire VBScript ASP</translation> + </message> + <message> + <source>ASP VBScript number</source> + <translation>Nombre VBScript ASP</translation> + </message> + <message> + <source>ASP VBScript keyword</source> + <translation>Mot-clé VBScript ASP </translation> + </message> + <message> + <source>ASP VBScript string</source> + <translation>Chaine de caractères VBScript ASP</translation> + </message> + <message> + <source>ASP VBScript identifier</source> + <translation>Identificateur VBScript ASP</translation> + </message> + <message> + <source>ASP VBScript unclosed string</source> + <translation>Chaine de caractères VBScript ASP non refermée</translation> + </message> + <message> + <source>Start of a Python fragment</source> + <translation>Début de block Python</translation> + </message> + <message> + <source>Python default</source> + <translation>Python par défaut</translation> + </message> + <message> + <source>Python comment</source> + <translation>Commentaire Python</translation> + </message> + <message> + <source>Python number</source> + <translation>Nombre Python</translation> + </message> + <message> + <source>Python double-quoted string</source> + <translation>Chaine de caractères Python (guillemets doubles)</translation> + </message> + <message> + <source>Python single-quoted string</source> + <translation>Chaine de caractères Python (guillemets simples)</translation> + </message> + <message> + <source>Python keyword</source> + <translation>Mot-clé Python</translation> + </message> + <message> + <source>Python triple double-quoted string</source> + <translation>Chaine de caractères Python (triples guillemets doubles)</translation> + </message> + <message> + <source>Python triple single-quoted string</source> + <translation>Chaine de caractères Python (triples guillemets simples)</translation> + </message> + <message> + <source>Python class name</source> + <translation>Nom de classe Python</translation> + </message> + <message> + <source>Python function or method name</source> + <translation>Méthode ou fonction Python</translation> + </message> + <message> + <source>Python operator</source> + <translation>Opérateur Python</translation> + </message> + <message> + <source>Python identifier</source> + <translation>Identificateur Python</translation> + </message> + <message> + <source>Start of an ASP Python fragment</source> + <translation>Début de block Python ASP</translation> + </message> + <message> + <source>ASP Python default</source> + <translation>Python ASP par défaut</translation> + </message> + <message> + <source>ASP Python comment</source> + <translation>Commentaire Python ASP</translation> + </message> + <message> + <source>ASP Python number</source> + <translation>Nombre Python ASP</translation> + </message> + <message> + <source>ASP Python double-quoted string</source> + <translation>Chaine de caractères Python ASP (guillemets doubles)</translation> + </message> + <message> + <source>ASP Python single-quoted string</source> + <translation>Chaine de caractères Python ASP (guillemets simples)</translation> + </message> + <message> + <source>ASP Python keyword</source> + <translation>Mot-clé Python ASP</translation> + </message> + <message> + <source>ASP Python triple double-quoted string</source> + <translation>Chaine de caractères Python ASP (triples guillemets doubles)</translation> + </message> + <message> + <source>ASP Python triple single-quoted string</source> + <translation>Chaine de caractères Python ASP (triples guillemets simples)</translation> + </message> + <message> + <source>ASP Python class name</source> + <translation>Nom de classe Python ASP</translation> + </message> + <message> + <source>ASP Python function or method name</source> + <translation>Méthode ou fonction Python ASP</translation> + </message> + <message> + <source>ASP Python operator</source> + <translation>Opérateur Python ASP</translation> + </message> + <message> + <source>ASP Python identifier</source> + <translation>Identificateur Python ASP</translation> + </message> + <message> + <source>PHP default</source> + <translation>PHP par défaut</translation> + </message> + <message> + <source>PHP double-quoted string</source> + <translation>Chaine de caractères PHP (guillemets doubles)</translation> + </message> + <message> + <source>PHP single-quoted string</source> + <translation>Chaine de caractères PHP (guillemets simples)</translation> + </message> + <message> + <source>PHP keyword</source> + <translation>Mot-clé PHP</translation> + </message> + <message> + <source>PHP number</source> + <translation>Nombre PHP</translation> + </message> + <message> + <source>PHP variable</source> + <translation>Variable PHP</translation> + </message> + <message> + <source>PHP comment</source> + <translation>Commentaire PHP</translation> + </message> + <message> + <source>PHP line comment</source> + <translation>Commentaire de ligne PHP</translation> + </message> + <message> + <source>PHP double-quoted variable</source> + <translation>Variable PHP (guillemets doubles)</translation> + </message> + <message> + <source>PHP operator</source> + <translation>Opérateur PHP</translation> + </message> +</context> +<context> + <name>QextScintillaLexerIDL</name> + <message> + <source>UUID</source> + <translation>UUID</translation> + </message> +</context> +<context> + <name>QextScintillaLexerJavaScript</name> + <message> + <source>Regular expression</source> + <translation>Expression régulière</translation> + </message> +</context> +<context> + <name>QextScintillaLexerLua</name> + <message> + <source>Default</source> + <translation>Par défaut</translation> + </message> + <message> + <source>Comment</source> + <translation>Commentaire</translation> + </message> + <message> + <source>Line comment</source> + <translation>Commentaire de ligne</translation> + </message> + <message> + <source>Number</source> + <translation>Nombre</translation> + </message> + <message> + <source>Keyword</source> + <translation>Mot-clé</translation> + </message> + <message> + <source>String</source> + <translation>Chaîne de caractères</translation> + </message> + <message> + <source>Character</source> + <translation>Caractère</translation> + </message> + <message> + <source>Literal string</source> + <translation>Chaîne littérale</translation> + </message> + <message> + <source>Preprocessor</source> + <translation>Préprocessing</translation> + </message> + <message> + <source>Operator</source> + <translation>Opérateur</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificateur</translation> + </message> + <message> + <source>Unclosed string</source> + <translation>Chaine de caractères non refermée</translation> + </message> + <message> + <source>Basic functions</source> + <translation>Fonctions de base</translation> + </message> + <message> + <source>String, table and maths functions</source> + <translation>Fonctions sur les chaines, tables et fonctions math</translation> + </message> + <message> + <source>Coroutines, i/o and system facilities</source> + <translation>Coroutines, i/o et fonctions système</translation> + </message> +</context> +<context> + <name>QextScintillaLexerMakefile</name> + <message> + <source>Default</source> + <translation>Par défaut</translation> + </message> + <message> + <source>Comment</source> + <translation>Commentaire</translation> + </message> + <message> + <source>Preprocessor</source> + <translation>Préprocessing</translation> + </message> + <message> + <source>Variable</source> + <translation>Variable</translation> + </message> + <message> + <source>Operator</source> + <translation>Opérateur</translation> + </message> + <message> + <source>Target</source> + <translation>Cible</translation> + </message> + <message> + <source>Error</source> + <translation>Erreur</translation> + </message> +</context> +<context> + <name>QextScintillaLexerPOV</name> + <message> + <source>Default</source> + <translation>Par défaut</translation> + </message> + <message> + <source>Comment</source> + <translation>Commentaire</translation> + </message> + <message> + <source>Comment line</source> + <translation>Ligne commentée</translation> + </message> + <message> + <source>Number</source> + <translation>Nombre</translation> + </message> + <message> + <source>Operator</source> + <translation>Opérateur</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificateur</translation> + </message> + <message> + <source>String</source> + <translation>Chaîne de caractères</translation> + </message> + <message> + <source>Unclosed string</source> + <translation>Chaine de caractères non refermée</translation> + </message> + <message> + <source>Directive</source> + <translation>Directive</translation> + </message> + <message> + <source>Bad directive</source> + <translation>Mauvaise directive</translation> + </message> + <message> + <source>Objects, CSG and appearance</source> + <translation>Objets, CSG et apparence</translation> + </message> + <message> + <source>Types, modifiers and items</source> + <translation>Types, modifieurs et éléments</translation> + </message> + <message> + <source>Predefined identifiers</source> + <translation>Identifiants prédéfinis</translation> + </message> + <message> + <source>Predefined functions</source> + <translation>Fonctions prédéfinies</translation> + </message> + <message> + <source>User defined 1</source> + <translation>Définition utilisateur 1</translation> + </message> + <message> + <source>User defined 2</source> + <translation>Définition utilisateur 2</translation> + </message> + <message> + <source>User defined 3</source> + <translation>Définition utilisateur 3</translation> + </message> +</context> +<context> + <name>QextScintillaLexerPerl</name> + <message> + <source>Default</source> + <translation>Par défaut</translation> + </message> + <message> + <source>Error</source> + <translation>Erreur</translation> + </message> + <message> + <source>Comment</source> + <translation>Commentaire</translation> + </message> + <message> + <source>POD</source> + <translation>POD</translation> + </message> + <message> + <source>Number</source> + <translation>Nombre</translation> + </message> + <message> + <source>Keyword</source> + <translation>Mot-clé</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Chaine de caractères (guillemets doubles)</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Chaine de caractères (guillemets simples)</translation> + </message> + <message> + <source>Operator</source> + <translation>Opérateur</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificateur</translation> + </message> + <message> + <source>Scalar</source> + <translation>Scalaire</translation> + </message> + <message> + <source>Array</source> + <translation>Tableau</translation> + </message> + <message> + <source>Hash</source> + <translation>Hashage</translation> + </message> + <message> + <source>Symbol table</source> + <translation>Table de symboles</translation> + </message> + <message> + <source>Regular expression</source> + <translation>Expression régulière</translation> + </message> + <message> + <source>Substitution</source> + <translation>Substitution</translation> + </message> + <message> + <source>Backticks</source> + <translation>Quotes inverses</translation> + </message> + <message> + <source>Data section</source> + <translation>Section de données</translation> + </message> + <message> + <source>Here document delimiter</source> + <translation>Délimiteur de texte intégré (cat <<EOF....EOF)</translation> + </message> + <message> + <source>Single-quoted here document</source> + <translation>Document intégré guillemets simples</translation> + </message> + <message> + <source>Double-quoted here document</source> + <translation>Document intégré guillemets doubles</translation> + </message> + <message> + <source>Backtick here document</source> + <translation>Document intégré quotes inverses</translation> + </message> + <message> + <source>Quoted string (q)</source> + <translation>Chaine quotée (q)</translation> + </message> + <message> + <source>Quoted string (qq)</source> + <translation>Chaine quotée (qq)</translation> + </message> + <message> + <source>Quoted string (qx)</source> + <translation>Chaine quotée (qx)</translation> + </message> + <message> + <source>Quoted string (qr)</source> + <translation>Chaine quotée (qr)</translation> + </message> + <message> + <source>Quoted string (qw)</source> + <translation>Chaine quotée (qw)</translation> + </message> + <message> + <source>POD verbatim</source> + <translation>POD verbatim</translation> + </message> +</context> +<context> + <name>QextScintillaLexerProperties</name> + <message> + <source>Default</source> + <translation>Par défaut</translation> + </message> + <message> + <source>Comment</source> + <translation>Commentaire</translation> + </message> + <message> + <source>Section</source> + <translation>Section</translation> + </message> + <message> + <source>Assignment</source> + <translation>Affectation</translation> + </message> + <message> + <source>Default value</source> + <translation>Valeur par défaut</translation> + </message> +</context> +<context> + <name>QextScintillaLexerPython</name> + <message> + <source>Default</source> + <translation>Par défaut</translation> + </message> + <message> + <source>Comment</source> + <translation>Commentaire</translation> + </message> + <message> + <source>Number</source> + <translation>Nombre</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Chaine de caractères (guillemets doubles)</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Chaine de caractères (guillemets simples)</translation> + </message> + <message> + <source>Keyword</source> + <translation>Mot-clé</translation> + </message> + <message> + <source>Triple single-quoted string</source> + <translation>Chaine de caractères HTML (guillemets simples)</translation> + </message> + <message> + <source>Triple double-quoted string</source> + <translation>Chaine de caractères HTML (guillemets simples)</translation> + </message> + <message> + <source>Class name</source> + <translation>Nom de classe</translation> + </message> + <message> + <source>Function or method name</source> + <translation>Nom de méthode ou de fonction</translation> + </message> + <message> + <source>Operator</source> + <translation>Opérateur</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificateur</translation> + </message> + <message> + <source>Comment block</source> + <translation>Block de commentaires</translation> + </message> + <message> + <source>Unclosed string</source> + <translation>Chaine de caractères non refermée</translation> + </message> + <message> + <source>Highlighted identifier</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Decorator</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerRuby</name> + <message> + <source>Default</source> + <translation>Par défaut</translation> + </message> + <message> + <source>Comment</source> + <translation>Commentaire</translation> + </message> + <message> + <source>Number</source> + <translation>Nombre</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Chaine de caractères (guillemets doubles)</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Chaine de caractères (guillemets simples)</translation> + </message> + <message> + <source>Keyword</source> + <translation>Mot-clé</translation> + </message> + <message> + <source>Class name</source> + <translation>Nom de classe</translation> + </message> + <message> + <source>Function or method name</source> + <translation>Nom de méthode ou de fonction</translation> + </message> + <message> + <source>Operator</source> + <translation>Opérateur</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificateur</translation> + </message> + <message> + <source>Error</source> + <translation type="unfinished">Erreur</translation> + </message> + <message> + <source>POD</source> + <translation type="unfinished">POD</translation> + </message> + <message> + <source>Regular expression</source> + <translation type="unfinished">Expression régulière</translation> + </message> + <message> + <source>Global</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Symbol</source> + <translation type="unfinished">Symbole</translation> + </message> + <message> + <source>Module name</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Instance variable</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Class variable</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Backticks</source> + <translation type="unfinished">Quotes inverses</translation> + </message> + <message> + <source>Data section</source> + <translation type="unfinished">Section de données</translation> + </message> + <message> + <source>Here document delimiter</source> + <translation type="unfinished">Délimiteur de texte intégré (cat <<EOF....EOF)</translation> + </message> + <message> + <source>Here document</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%q string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%Q string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%x string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%r string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%w string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Demoted keyword</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>stdin</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>stdout</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>stderr</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerSQL</name> + <message> + <source>Default</source> + <translation>Par défaut</translation> + </message> + <message> + <source>Comment</source> + <translation>Commentaire</translation> + </message> + <message> + <source>Number</source> + <translation>Nombre</translation> + </message> + <message> + <source>Keyword</source> + <translation>Mot-clé</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Chaine de caractères (guillemets simples)</translation> + </message> + <message> + <source>Operator</source> + <translation>Opérateur</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificateur</translation> + </message> + <message> + <source>Comment line</source> + <translation>Ligne commentée</translation> + </message> + <message> + <source>JavaDoc style comment</source> + <translation>Commentaire style JavaDoc</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Chaine de caractères (guillemets doubles)</translation> + </message> + <message> + <source>SQL*Plus keyword</source> + <translation>Mot-clé SQL*Plus</translation> + </message> + <message> + <source>SQL*Plus prompt</source> + <translation>Prompt SQL*Plus</translation> + </message> + <message> + <source>SQL*Plus comment</source> + <translation>Commentaire SQL*Plus</translation> + </message> + <message> + <source># comment line</source> + <translation># Ligne commentée</translation> + </message> + <message> + <source>JavaDoc keyword</source> + <translation>Mot-clé JavaDoc</translation> + </message> + <message> + <source>JavaDoc keyword error</source> + <translation>Erreur de mot-clé JavaDoc</translation> + </message> + <message> + <source>User defined 1</source> + <translation>Définition utilisateur 1</translation> + </message> + <message> + <source>User defined 2</source> + <translation>Définition utilisateur 2</translation> + </message> + <message> + <source>User defined 3</source> + <translation>Définition utilisateur 3</translation> + </message> + <message> + <source>User defined 4</source> + <translation>Définition utilisateur 4</translation> + </message> +</context> +<context> + <name>QextScintillaLexerTeX</name> + <message> + <source>Default</source> + <translation>Par défaut</translation> + </message> + <message> + <source>Special</source> + <translation>Spécial</translation> + </message> + <message> + <source>Group</source> + <translation>Groupe</translation> + </message> + <message> + <source>Symbol</source> + <translation>Symbole</translation> + </message> + <message> + <source>Command</source> + <translation>Commande</translation> + </message> + <message> + <source>Text</source> + <translation>Texte</translation> + </message> +</context> +</TS> diff --git a/qt/qscintilla_pt_br.qm b/qt/qscintilla_pt_br.qm Binary files differnew file mode 100644 index 0000000..1b181f3 --- /dev/null +++ b/qt/qscintilla_pt_br.qm diff --git a/qt/qscintilla_pt_br.ts b/qt/qscintilla_pt_br.ts new file mode 100644 index 0000000..207472f --- /dev/null +++ b/qt/qscintilla_pt_br.ts @@ -0,0 +1,1635 @@ +<!DOCTYPE TS><TS> +<context> + <name>QextScintillaCommand</name> + <message> + <source>Move down one line</source> + <translation>Mover uma linha para baixo</translation> + </message> + <message> + <source>Extend selection down one line</source> + <translation>Extender a seleção uma linha para baixo</translation> + </message> + <message> + <source>Scroll view down one line</source> + <translation>Descer a visão uma linha para baixo</translation> + </message> + <message> + <source>Extend rectangular selection down one line</source> + <translation>Extender a seleção retangular uma linha para baixo</translation> + </message> + <message> + <source>Move up one line</source> + <translation>Mover uma linha para cima</translation> + </message> + <message> + <source>Extend selection up one line</source> + <translation>Extender a seleção uma linha para cima</translation> + </message> + <message> + <source>Scroll view up one line</source> + <translation>Subir a visão uma linha para cima</translation> + </message> + <message> + <source>Extend rectangular selection up one line</source> + <translation>Extender a seleção retangular uma linha para cima</translation> + </message> + <message> + <source>Move up one paragraph</source> + <translation>Mover um paragrafo para cima</translation> + </message> + <message> + <source>Extend selection up one paragraph</source> + <translation>Extender a seleção um paragrafo para cima</translation> + </message> + <message> + <source>Move down one paragraph</source> + <translation>Mover um paragrafo para baixo</translation> + </message> + <message> + <source>Extend selection down one paragraph</source> + <translation>Extender a seleção um paragrafo para baixo</translation> + </message> + <message> + <source>Move left one character</source> + <translation>Mover um caractere para a esquerda</translation> + </message> + <message> + <source>Extend selection left one character</source> + <translation>Extender a seleção um caractere para esquerda</translation> + </message> + <message> + <source>Move left one word</source> + <translation>Mover uma palavra para esquerda</translation> + </message> + <message> + <source>Extend selection left one word</source> + <translation>Extender a seleção uma palavra para esquerda</translation> + </message> + <message> + <source>Extend rectangular selection left one character</source> + <translation>Extender a seleção retangular um caractere para esquerda</translation> + </message> + <message> + <source>Move right one character</source> + <translation>Mover um caractere para direita</translation> + </message> + <message> + <source>Extend selection right one character</source> + <translation>Extender a seleção um caractere para direita</translation> + </message> + <message> + <source>Move right one word</source> + <translation>Mover uma palavra para direita</translation> + </message> + <message> + <source>Extend selection right one word</source> + <translation>Extender a seleção uma palavra para direita</translation> + </message> + <message> + <source>Extend rectangular selection right one character</source> + <translation>Extender a seleção retangular um caractere para direita</translation> + </message> + <message> + <source>Move left one word part</source> + <translation>Mover uma parte da palavra para esquerda</translation> + </message> + <message> + <source>Extend selection left one word part</source> + <translation>Extender a seleção uma parte de palavra para esquerda</translation> + </message> + <message> + <source>Move right one word part</source> + <translation>Mover uma parte da palavra para direita</translation> + </message> + <message> + <source>Extend selection right one word part</source> + <translation>Extender a seleção uma parte de palavra para direita</translation> + </message> + <message> + <source>Move to first visible character in line</source> + <translation>Mover para o primeiro caractere visível na linha</translation> + </message> + <message> + <source>Extend selection to first visible character in line</source> + <translation>Extender a seleção para o primeiro caractere na linha</translation> + </message> + <message> + <source>Move to start of text</source> + <translation>Mover para o ínicio do texto</translation> + </message> + <message> + <source>Extend selection to start of text</source> + <translation>Extender a seleção para o ínicio do texto</translation> + </message> + <message> + <source>Move to start of displayed line</source> + <translation>Mover para o ínicio da linha exibida</translation> + </message> + <message> + <source>Extend selection to start of line</source> + <translation>Extender a seleção para o ínicio da linha</translation> + </message> + <message> + <source>Extend rectangular selection to first visible character in line</source> + <translation>Extender a seleção para o primeiro caractere visível na linha</translation> + </message> + <message> + <source>Move to end of line</source> + <translation>Mover para o final da linha</translation> + </message> + <message> + <source>Extend selection to end of line</source> + <translation>Extender a seleção para o final da linha</translation> + </message> + <message> + <source>Move to end of text</source> + <translation>Mover para o final do texto</translation> + </message> + <message> + <source>Extend selection to end of text</source> + <translation>Extender a seleção para o final do texto</translation> + </message> + <message> + <source>Move to end of displayed line</source> + <translation>Mover para o final da linha exibida</translation> + </message> + <message> + <source>Extend selection to end of displayed line</source> + <translation>Extender a seleção retangular para o final da linha exibida</translation> + </message> + <message> + <source>Extend rectangular selection to end of line</source> + <translation>Extender a seleção retangular para o final da linha</translation> + </message> + <message> + <source>Move up one page</source> + <translation>Mover uma página para cima</translation> + </message> + <message> + <source>Extend selection up one page</source> + <translation>Extender a seleção uma página para cima</translation> + </message> + <message> + <source>Extend rectangular selection up one page</source> + <translation>Extender a seleção retangular uma página para cima</translation> + </message> + <message> + <source>Move down one page</source> + <translation>Mover uma página para baixo</translation> + </message> + <message> + <source>Extend selection down one page</source> + <translation>Extender a seleção uma página para baixo</translation> + </message> + <message> + <source>Extend rectangular selection down one page</source> + <translation>Extender a seleção retangular uma página para baixo</translation> + </message> + <message> + <source>Delete current character</source> + <translation>Excluir caractere atual</translation> + </message> + <message> + <source>Cut selection</source> + <translation>Recortar seleção</translation> + </message> + <message> + <source>Delete word to right</source> + <translation>Excluir palavra para direita</translation> + </message> + <message> + <source>Delete line to right</source> + <translation>Excluir linha para direita</translation> + </message> + <message> + <source>Toggle insert/overtype</source> + <translation>Alternar entre modo de inserir/sobreescrever</translation> + </message> + <message> + <source>Paste</source> + <translation>Copiar</translation> + </message> + <message> + <source>Copy selection</source> + <translation>Copiar seleção</translation> + </message> + <message> + <source>Cancel</source> + <translation>Cancelar</translation> + </message> + <message> + <source>Delete previous character</source> + <translation>Excluir caractere anterior</translation> + </message> + <message> + <source>Delete word to left</source> + <translation>Excluir palavra a esquerda</translation> + </message> + <message> + <source>Undo the last command</source> + <translation>Desfazer último comando</translation> + </message> + <message> + <source>Delete line to left</source> + <translation>Excluir linha a esquerda</translation> + </message> + <message> + <source>Redo last command</source> + <translation>Refazer último comando</translation> + </message> + <message> + <source>Select all text</source> + <translation>Selecionar todo o texto</translation> + </message> + <message> + <source>Indent one level</source> + <translation>Indentar um nível</translation> + </message> + <message> + <source>Move back one indentation level</source> + <translation>Desindentar um nível</translation> + </message> + <message> + <source>Insert new line</source> + <translation>Inserir nova linha</translation> + </message> + <message> + <source>Zoom in</source> + <translation>Aumentar zoom</translation> + </message> + <message> + <source>Zoom out</source> + <translation>Diminuir zoom</translation> + </message> + <message> + <source>Set zoom</source> + <translation>Configurar zoom</translation> + </message> + <message> + <source>Formfeed</source> + <translation>Alimentação da Página</translation> + </message> + <message> + <source>Cut current line</source> + <translation>Configurar linha atual</translation> + </message> + <message> + <source>Delete current line</source> + <translation>Excluir linha atual</translation> + </message> + <message> + <source>Copy current line</source> + <translation>Copiar linha atual</translation> + </message> + <message> + <source>Swap current and previous lines</source> + <translation>Trocar linha atual com as linhas anteriores</translation> + </message> + <message> + <source>Convert selection to lower case</source> + <translation>Converter a seleção para minúscula</translation> + </message> + <message> + <source>Convert selection to upper case</source> + <translation>Converter a seleção para maiúscula</translation> + </message> + <message> + <source>Delete previous character if not at line start</source> + <translation>Excluir o caractere anterior se o mesmo não estiver no ínicio da linha</translation> + </message> + <message> + <source>Duplicate selection</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerBash</name> + <message> + <source>Default</source> + <translation>Padrão</translation> + </message> + <message> + <source>Error</source> + <translation>Número</translation> + </message> + <message> + <source>Comment</source> + <translation>Comentário</translation> + </message> + <message> + <source>Number</source> + <translation>Número</translation> + </message> + <message> + <source>Keyword</source> + <translation>Palavra Chave</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Cadeia de caracteres envolvida por aspas duplas</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Cadeia de caracteres envolvida por aspas simples</translation> + </message> + <message> + <source>Operator</source> + <translation>Operador</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificador</translation> + </message> + <message> + <source>Scalar</source> + <translation>Escalar</translation> + </message> + <message> + <source>Parameter expansion</source> + <translation>Parâmetro de Expansão</translation> + </message> + <message> + <source>Backticks</source> + <translation>Aspas Invertidas</translation> + </message> + <message> + <source>Here document delimiter</source> + <translation>Delimitador de "here documents"</translation> + </message> + <message> + <source>Single-quoted here document</source> + <translation>"here document" envolvido por aspas simples</translation> + </message> +</context> +<context> + <name>QextScintillaLexerBatch</name> + <message> + <source>Default</source> + <translation>Padrão</translation> + </message> + <message> + <source>Comment</source> + <translation>Comentário</translation> + </message> + <message> + <source>Keyword</source> + <translation>Palavra Chave</translation> + </message> + <message> + <source>Label</source> + <translation>Rótulo</translation> + </message> + <message> + <source>Hide command character</source> + <translation>Esconder caractere de comando</translation> + </message> + <message> + <source>External command</source> + <translation>Comando externo</translation> + </message> + <message> + <source>Variable</source> + <translation>Variável</translation> + </message> + <message> + <source>Operator</source> + <translation>Operador</translation> + </message> +</context> +<context> + <name>QextScintillaLexerCPP</name> + <message> + <source>Default</source> + <translation>Padrão</translation> + </message> + <message> + <source>C comment</source> + <translation>Comentário C</translation> + </message> + <message> + <source>C++ comment</source> + <translation>Comentário C++</translation> + </message> + <message> + <source>JavaDoc style C comment</source> + <translation>Comentário JavaDoc estilo C</translation> + </message> + <message> + <source>Number</source> + <translation>Número</translation> + </message> + <message> + <source>Keyword</source> + <translation>Palavra Chave</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Cadeia de caracteres envolvida por aspas duplas</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Cadeia de caracteres envolvida por aspas simples</translation> + </message> + <message> + <source>Pre-processor block</source> + <translation>Instruções de pré-processamento</translation> + </message> + <message> + <source>Operator</source> + <translation>Operador</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificador</translation> + </message> + <message> + <source>Unclosed string</source> + <translation>Cadeia de caracteres não fechada</translation> + </message> + <message> + <source>JavaDoc style C++ comment</source> + <translation>Comentário JavaDoc estilo C++</translation> + </message> + <message> + <source>Secondary keywords and identifiers</source> + <translation>Identificadores e palavras chave secundárias</translation> + </message> + <message> + <source>JavaDoc keyword</source> + <translation>Palavra chave JavaDoc</translation> + </message> + <message> + <source>JavaDoc keyword error</source> + <translation>Erro de palavra chave do JavaDoc</translation> + </message> + <message> + <source>Global classes and typedefs</source> + <translation>Classes e definições de tipo globais</translation> + </message> +</context> +<context> + <name>QextScintillaLexerCSS</name> + <message> + <source>Default</source> + <translation>Padrão</translation> + </message> + <message> + <source>Tag</source> + <translation>Marcador</translation> + </message> + <message> + <source>Class selector</source> + <translation>Seletor de classe</translation> + </message> + <message> + <source>Pseudo-class</source> + <translation>Pseudo-classe</translation> + </message> + <message> + <source>Unknown pseudo-class</source> + <translation>Pseudo-classe desconhecida</translation> + </message> + <message> + <source>Operator</source> + <translation>Operador</translation> + </message> + <message> + <source>CSS1 property</source> + <translation>Propriedade CSS1</translation> + </message> + <message> + <source>Unknown property</source> + <translation>Propriedade desconhecida</translation> + </message> + <message> + <source>Value</source> + <translation>Valor</translation> + </message> + <message> + <source>ID selector</source> + <translation>Seletor de ID</translation> + </message> + <message> + <source>Important</source> + <translation>Importante</translation> + </message> + <message> + <source>@-rule</source> + <translation>regra-@</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Cadeia de caracteres envolvida por aspas duplas</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Cadeia de caracteres envolvida por aspas simples</translation> + </message> + <message> + <source>CSS2 property</source> + <translation>Propriedade CSS2</translation> + </message> + <message> + <source>Attribute</source> + <translation>Atributo</translation> + </message> +</context> +<context> + <name>QextScintillaLexerCSharp</name> + <message> + <source>Verbatim string</source> + <translation>Cadeia de caracteres no formato verbatim</translation> + </message> +</context> +<context> + <name>QextScintillaLexerDiff</name> + <message> + <source>Default</source> + <translation>Padrão</translation> + </message> + <message> + <source>Comment</source> + <translation>Comentário</translation> + </message> + <message> + <source>Command</source> + <translation>Comando</translation> + </message> + <message> + <source>Header</source> + <translation>Cabeçalho</translation> + </message> + <message> + <source>Position</source> + <translation>Posição</translation> + </message> + <message> + <source>Removed line</source> + <translation>Linha Removida</translation> + </message> + <message> + <source>Added line</source> + <translation>Linha Adicionada</translation> + </message> +</context> +<context> + <name>QextScintillaLexerHTML</name> + <message> + <source>HTML default</source> + <translation>HTML por padrão</translation> + </message> + <message> + <source>Tag</source> + <translation>Marcador</translation> + </message> + <message> + <source>Unknown tag</source> + <translation>Marcador desconhecido</translation> + </message> + <message> + <source>Attribute</source> + <translation>Atributo</translation> + </message> + <message> + <source>Unknown attribute</source> + <translation>Atributo desconhecido</translation> + </message> + <message> + <source>HTML number</source> + <translation>Número HTML</translation> + </message> + <message> + <source>HTML double-quoted string</source> + <translation>Cadeia de caracteres HTML envolvida por aspas duplas</translation> + </message> + <message> + <source>HTML single-quoted string</source> + <translation>Cadeia de caracteres HTML envolvida por aspas simples</translation> + </message> + <message> + <source>Other text in a tag</source> + <translation>Outro texto em um marcador</translation> + </message> + <message> + <source>HTML comment</source> + <translation>Comentário HTML</translation> + </message> + <message> + <source>Entity</source> + <translation>Entidade</translation> + </message> + <message> + <source>End of a tag</source> + <translation>Final de um marcador</translation> + </message> + <message> + <source>Start of an XML fragment</source> + <translation>Início de um bloco XML</translation> + </message> + <message> + <source>End of an XML fragment</source> + <translation>Final de um bloco XML</translation> + </message> + <message> + <source>Script tag</source> + <translation>Marcador de script</translation> + </message> + <message> + <source>Start of an ASP fragment with @</source> + <translation>Início de um bloco ASP com @</translation> + </message> + <message> + <source>Start of an ASP fragment</source> + <translation>Início de um bloco ASP</translation> + </message> + <message> + <source>CDATA</source> + <translation>CDATA</translation> + </message> + <message> + <source>Start of a PHP fragment</source> + <translation>Início de um bloco PHP</translation> + </message> + <message> + <source>Unquoted HTML value</source> + <translation>Valor HTML não envolvido por aspas</translation> + </message> + <message> + <source>ASP X-Code comment</source> + <translation>Comentário ASP X-Code</translation> + </message> + <message> + <source>SGML default</source> + <translation>SGML por padrão</translation> + </message> + <message> + <source>SGML command</source> + <translation>Comando SGML</translation> + </message> + <message> + <source>First parameter of an SGML command</source> + <translation>Primeiro parâmetro em um comando SGML</translation> + </message> + <message> + <source>SGML double-quoted string</source> + <translation>Cadeia de caracteres SGML envolvida por aspas duplas</translation> + </message> + <message> + <source>SGML single-quoted string</source> + <translation>Cadeia de caracteres SGML envolvida por aspas simples</translation> + </message> + <message> + <source>SGML error</source> + <translation>Erro SGML</translation> + </message> + <message> + <source>SGML special entity</source> + <translation>Entidade especial SGML</translation> + </message> + <message> + <source>SGML comment</source> + <translation>Comando SGML</translation> + </message> + <message> + <source>First parameter comment of an SGML command</source> + <translation>Primeiro comentário de parâmetro de uma comando SGML</translation> + </message> + <message> + <source>SGML block default</source> + <translation>Bloco SGML por padrão</translation> + </message> + <message> + <source>Start of a JavaScript fragment</source> + <translation>Início de um bloco Javascript</translation> + </message> + <message> + <source>JavaScript default</source> + <translation>JavaScript por padrão</translation> + </message> + <message> + <source>JavaScript comment</source> + <translation>Comentário JavaScript</translation> + </message> + <message> + <source>JavaScript line comment</source> + <translation>Comentário de linha JavaScript</translation> + </message> + <message> + <source>JavaDoc style JavaScript comment</source> + <translation>Comentário JavaScript no estilo JavaDoc</translation> + </message> + <message> + <source>JavaScript number</source> + <translation>Número JavaScript</translation> + </message> + <message> + <source>JavaScript word</source> + <translation>Palavra JavaScript</translation> + </message> + <message> + <source>JavaScript keyword</source> + <translation>Palavra chave JavaScript</translation> + </message> + <message> + <source>JavaScript double-quoted string</source> + <translation>Cadeia de caracteres JavaScript envolvida por aspas duplas</translation> + </message> + <message> + <source>JavaScript single-quoted string</source> + <translation>Cadeia de caracteres JavaScript envolvida por aspas simples</translation> + </message> + <message> + <source>JavaScript symbol</source> + <translation>Símbolo JavaScript</translation> + </message> + <message> + <source>JavaScript unclosed string</source> + <translation>Cadeia de caracteres JavaScript não fechada</translation> + </message> + <message> + <source>JavaScript regular expression</source> + <translation>Expressão regular JavaScript</translation> + </message> + <message> + <source>Start of an ASP JavaScript fragment</source> + <translation>Início de um bloco Javascript ASP</translation> + </message> + <message> + <source>ASP JavaScript default</source> + <translation>JavaScript ASP por padrão</translation> + </message> + <message> + <source>ASP JavaScript comment</source> + <translation>Comentário JavaScript ASP</translation> + </message> + <message> + <source>ASP JavaScript line comment</source> + <translation>Comentário de linha JavaScript ASP</translation> + </message> + <message> + <source>JavaDoc style ASP JavaScript comment</source> + <translation>Comentário JavaScript ASP no estilo JavaDoc</translation> + </message> + <message> + <source>ASP JavaScript number</source> + <translation>Número JavaScript ASP</translation> + </message> + <message> + <source>ASP JavaScript word</source> + <translation>Palavra chave JavaScript ASP</translation> + </message> + <message> + <source>ASP JavaScript keyword</source> + <translation>Palavra chave JavaScript ASP</translation> + </message> + <message> + <source>ASP JavaScript double-quoted string</source> + <translation>Cadeia de caracteres JavaScript ASP envolvida por aspas duplas</translation> + </message> + <message> + <source>ASP JavaScript single-quoted string</source> + <translation>Cadeia de caracteres JavaScript ASP envolvida por aspas simples</translation> + </message> + <message> + <source>ASP JavaScript symbol</source> + <translation>Símbolo JavaScript ASP</translation> + </message> + <message> + <source>ASP JavaScript unclosed string</source> + <translation>Cadeia de caracteres JavaScript ASP não fechada</translation> + </message> + <message> + <source>ASP JavaScript regular expression</source> + <translation>Expressão regular JavaScript ASP</translation> + </message> + <message> + <source>Start of a VBScript fragment</source> + <translation>Início de um bloco VBScript</translation> + </message> + <message> + <source>VBScript default</source> + <translation>VBScript por padrão</translation> + </message> + <message> + <source>VBScript comment</source> + <translation>Comentário VBScript</translation> + </message> + <message> + <source>VBScript number</source> + <translation>Número VBScript</translation> + </message> + <message> + <source>VBScript keyword</source> + <translation>Palavra chave VBScript</translation> + </message> + <message> + <source>VBScript string</source> + <translation>Cadeia de caracteres VBScript</translation> + </message> + <message> + <source>VBScript identifier</source> + <translation>Identificador VBScript</translation> + </message> + <message> + <source>VBScript unclosed string</source> + <translation>Cadeia de caracteres VBScript não fechada</translation> + </message> + <message> + <source>Start of an ASP VBScript fragment</source> + <translation>Início de um bloco VBScript ASP</translation> + </message> + <message> + <source>ASP VBScript default</source> + <translation>VBScript ASP por padrão</translation> + </message> + <message> + <source>ASP VBScript comment</source> + <translation>Comentário VBScript ASP</translation> + </message> + <message> + <source>ASP VBScript number</source> + <translation>Número VBScript ASP</translation> + </message> + <message> + <source>ASP VBScript keyword</source> + <translation>Palavra chave VBScript ASP</translation> + </message> + <message> + <source>ASP VBScript string</source> + <translation>Cadeia de caracteres VBScript ASP</translation> + </message> + <message> + <source>ASP VBScript identifier</source> + <translation>Identificador VBScript ASP</translation> + </message> + <message> + <source>ASP VBScript unclosed string</source> + <translation>Cadeia de caracteres VBScript ASP não fechada</translation> + </message> + <message> + <source>Start of a Python fragment</source> + <translation>Início de um bloco Python</translation> + </message> + <message> + <source>Python default</source> + <translation>Python por padrão</translation> + </message> + <message> + <source>Python comment</source> + <translation>Comentário Python</translation> + </message> + <message> + <source>Python number</source> + <translation>Número Python</translation> + </message> + <message> + <source>Python double-quoted string</source> + <translation>Cadeia de caracteres Python envolvida por aspas duplas</translation> + </message> + <message> + <source>Python single-quoted string</source> + <translation>Cadeia de caracteres Python envolvida por aspas simples</translation> + </message> + <message> + <source>Python keyword</source> + <translation>Palavra chave Python</translation> + </message> + <message> + <source>Python triple double-quoted string</source> + <translation>Cadeia de caracteres Python envolvida por aspas triplas duplas</translation> + </message> + <message> + <source>Python triple single-quoted string</source> + <translation>Cadeia de caracteres Python envolvida por aspas triplas simples</translation> + </message> + <message> + <source>Python class name</source> + <translation>Nome de classe Python</translation> + </message> + <message> + <source>Python function or method name</source> + <translation>Nome de método ou função Python</translation> + </message> + <message> + <source>Python operator</source> + <translation>Operador Python</translation> + </message> + <message> + <source>Python identifier</source> + <translation>Identificador Python</translation> + </message> + <message> + <source>Start of an ASP Python fragment</source> + <translation>Início de um bloco Python ASP</translation> + </message> + <message> + <source>ASP Python default</source> + <translation>Python ASP por padrão</translation> + </message> + <message> + <source>ASP Python comment</source> + <translation>Comentário Python ASP</translation> + </message> + <message> + <source>ASP Python number</source> + <translation>Número Python ASP</translation> + </message> + <message> + <source>ASP Python double-quoted string</source> + <translation>Cadeia de caracteres Python ASP envolvida por aspas duplas</translation> + </message> + <message> + <source>ASP Python single-quoted string</source> + <translation>Cadeia de caracteres Python ASP envolvida por aspas simples</translation> + </message> + <message> + <source>ASP Python keyword</source> + <translation>Palavra chave Python ASP</translation> + </message> + <message> + <source>ASP Python triple double-quoted string</source> + <translation>Cadeia de caracteres Python ASP envolvida por aspas triplas duplas</translation> + </message> + <message> + <source>ASP Python triple single-quoted string</source> + <translation>Cadeia de caracteres Python ASP envolvida por aspas triplas simples</translation> + </message> + <message> + <source>ASP Python class name</source> + <translation>Nome de classe Python ASP</translation> + </message> + <message> + <source>ASP Python function or method name</source> + <translation>Nome de método ou função Python ASP</translation> + </message> + <message> + <source>ASP Python operator</source> + <translation>Operador Python ASP</translation> + </message> + <message> + <source>ASP Python identifier</source> + <translation>Identificador Python ASP</translation> + </message> + <message> + <source>PHP default</source> + <translation>PHP por padrão</translation> + </message> + <message> + <source>PHP double-quoted string</source> + <translation>Cadeia de caracteres PHP envolvida por aspas duplas</translation> + </message> + <message> + <source>PHP single-quoted string</source> + <translation>Cadeia de caracteres PHP envolvida por aspas simples</translation> + </message> + <message> + <source>PHP keyword</source> + <translation>Palavra chave PHP</translation> + </message> + <message> + <source>PHP number</source> + <translation>Número PHP</translation> + </message> + <message> + <source>PHP variable</source> + <translation>Variável PHP</translation> + </message> + <message> + <source>PHP comment</source> + <translation>Comentário PHP</translation> + </message> + <message> + <source>PHP line comment</source> + <translation>Comentário de linha PHP</translation> + </message> + <message> + <source>PHP double-quoted variable</source> + <translation>Variável PHP envolvida por aspas duplas</translation> + </message> + <message> + <source>PHP operator</source> + <translation>Operador PHP</translation> + </message> +</context> +<context> + <name>QextScintillaLexerIDL</name> + <message> + <source>UUID</source> + <translation>UUID</translation> + </message> +</context> +<context> + <name>QextScintillaLexerJavaScript</name> + <message> + <source>Regular expression</source> + <translation>Expressão Regular</translation> + </message> +</context> +<context> + <name>QextScintillaLexerLua</name> + <message> + <source>Default</source> + <translation>Padrão</translation> + </message> + <message> + <source>Comment</source> + <translation>Comentário</translation> + </message> + <message> + <source>Line comment</source> + <translation>Comentar Linha</translation> + </message> + <message> + <source>Number</source> + <translation>Número</translation> + </message> + <message> + <source>Keyword</source> + <translation>Palavra Chave</translation> + </message> + <message> + <source>String</source> + <translation>Cadeia de Caracteres</translation> + </message> + <message> + <source>Character</source> + <translation>Caractere</translation> + </message> + <message> + <source>Literal string</source> + <translation>Cadeia de caracteres literal</translation> + </message> + <message> + <source>Preprocessor</source> + <translation>Preprocessador</translation> + </message> + <message> + <source>Operator</source> + <translation>Operador</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificador</translation> + </message> + <message> + <source>Unclosed string</source> + <translation>Cadeia de caracteres não fechada</translation> + </message> + <message> + <source>Basic functions</source> + <translation>Funções básicas</translation> + </message> + <message> + <source>String, table and maths functions</source> + <translation>Funções de cadeia de caracteres e de tabelas matemáticas</translation> + </message> + <message> + <source>Coroutines, i/o and system facilities</source> + <translation>Funções auxiiares, e/s e funções de sistema</translation> + </message> +</context> +<context> + <name>QextScintillaLexerMakefile</name> + <message> + <source>Default</source> + <translation>Padrão</translation> + </message> + <message> + <source>Comment</source> + <translation>Comentário</translation> + </message> + <message> + <source>Preprocessor</source> + <translation>Preprocessador</translation> + </message> + <message> + <source>Variable</source> + <translation>Variável</translation> + </message> + <message> + <source>Operator</source> + <translation>Operador</translation> + </message> + <message> + <source>Target</source> + <translation>Destino</translation> + </message> + <message> + <source>Error</source> + <translation>Erro</translation> + </message> +</context> +<context> + <name>QextScintillaLexerPOV</name> + <message> + <source>Default</source> + <translation>Padrão</translation> + </message> + <message> + <source>Comment</source> + <translation>Comentário</translation> + </message> + <message> + <source>Comment line</source> + <translation>Comentar Linha</translation> + </message> + <message> + <source>Number</source> + <translation>Número</translation> + </message> + <message> + <source>Operator</source> + <translation>Operador</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificador</translation> + </message> + <message> + <source>String</source> + <translation>Cadeia de Caracteres</translation> + </message> + <message> + <source>Unclosed string</source> + <translation>Cadeia de caracteres não fechada</translation> + </message> + <message> + <source>Directive</source> + <translation>Diretiva</translation> + </message> + <message> + <source>Bad directive</source> + <translation>Diretiva ruim</translation> + </message> + <message> + <source>Objects, CSG and appearance</source> + <translation>Objetos, CSG e aparência</translation> + </message> + <message> + <source>Types, modifiers and items</source> + <translation>Tipos, modificadores e itens</translation> + </message> + <message> + <source>Predefined identifiers</source> + <translation>Identificadores predefinidos</translation> + </message> + <message> + <source>Predefined functions</source> + <translation>Funções predefinidas</translation> + </message> + <message> + <source>User defined 1</source> + <translation>Definição de usuário 1</translation> + </message> + <message> + <source>User defined 2</source> + <translation>Definição de usuário 2</translation> + </message> + <message> + <source>User defined 3</source> + <translation>Definição de usuário 3</translation> + </message> +</context> +<context> + <name>QextScintillaLexerPerl</name> + <message> + <source>Default</source> + <translation>Padrão</translation> + </message> + <message> + <source>Error</source> + <translation>Erro</translation> + </message> + <message> + <source>Comment</source> + <translation>Comentário</translation> + </message> + <message> + <source>POD</source> + <translation>POD</translation> + </message> + <message> + <source>Number</source> + <translation>Número</translation> + </message> + <message> + <source>Keyword</source> + <translation>Palavra Chave</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Cadeia de caracteres envolvida por aspas duplas</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Cadeia de caracteres envolvida por aspas simples</translation> + </message> + <message> + <source>Operator</source> + <translation>Operador</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificador</translation> + </message> + <message> + <source>Scalar</source> + <translation>Escalar</translation> + </message> + <message> + <source>Array</source> + <translation>Vetor</translation> + </message> + <message> + <source>Hash</source> + <translation>Hash</translation> + </message> + <message> + <source>Symbol table</source> + <translation>Tabela de Símbolos</translation> + </message> + <message> + <source>Regular expression</source> + <translation>Expressão Regular</translation> + </message> + <message> + <source>Substitution</source> + <translation>Substituição</translation> + </message> + <message> + <source>Backticks</source> + <translation>Aspas Invertidas</translation> + </message> + <message> + <source>Data section</source> + <translation>Seção de dados</translation> + </message> + <message> + <source>Here document delimiter</source> + <translation>Delimitador de documentos criados através de redicionadores (>> e >)</translation> + </message> + <message> + <source>Single-quoted here document</source> + <translation>"here document" envolvido por aspas simples</translation> + </message> + <message> + <source>Double-quoted here document</source> + <translation>"here document" envolvido por aspas duplas</translation> + </message> + <message> + <source>Backtick here document</source> + <translation>"here document" envolvido por aspas invertidas</translation> + </message> + <message> + <source>Quoted string (q)</source> + <translation>Cadeia de caracteres envolvida por aspas (q)</translation> + </message> + <message> + <source>Quoted string (qq)</source> + <translation>Cadeia de caracteres envolvida por aspas (qq)</translation> + </message> + <message> + <source>Quoted string (qx)</source> + <translation>Cadeia de caracteres envolvida por aspas (qx)</translation> + </message> + <message> + <source>Quoted string (qr)</source> + <translation>Cadeia de caracteres envolvida por aspas (qr)</translation> + </message> + <message> + <source>Quoted string (qw)</source> + <translation>Cadeia de caracteres envolvida por aspas (qw)</translation> + </message> + <message> + <source>POD verbatim</source> + <translation>POD em formato verbatim</translation> + </message> +</context> +<context> + <name>QextScintillaLexerProperties</name> + <message> + <source>Default</source> + <translation>Padrão</translation> + </message> + <message> + <source>Comment</source> + <translation>Comentário</translation> + </message> + <message> + <source>Section</source> + <translation>Seção</translation> + </message> + <message> + <source>Assignment</source> + <translation>Atribuição</translation> + </message> + <message> + <source>Default value</source> + <translation>Valor Padrão</translation> + </message> +</context> +<context> + <name>QextScintillaLexerPython</name> + <message> + <source>Default</source> + <translation>Padrão</translation> + </message> + <message> + <source>Comment</source> + <translation>Comentário</translation> + </message> + <message> + <source>Number</source> + <translation>Número</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Cadeia de caracteres envolvida por aspas duplas</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Cadeia de caracteres envolvida por aspas simples</translation> + </message> + <message> + <source>Keyword</source> + <translation>Palavra Chave</translation> + </message> + <message> + <source>Triple single-quoted string</source> + <translation>Cadeia de caracteres envolvida por três aspas simples</translation> + </message> + <message> + <source>Triple double-quoted string</source> + <translation>Cadeia de caracteres envolvida por três aspas duplas</translation> + </message> + <message> + <source>Class name</source> + <translation>Nome da classe</translation> + </message> + <message> + <source>Function or method name</source> + <translation>Nome da função ou método</translation> + </message> + <message> + <source>Operator</source> + <translation>Operador</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificador</translation> + </message> + <message> + <source>Comment block</source> + <translation>Bloco de comentários</translation> + </message> + <message> + <source>Unclosed string</source> + <translation>Cadeia de caracteres não fechada</translation> + </message> + <message> + <source>Highlighted identifier</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Decorator</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerRuby</name> + <message> + <source>Default</source> + <translation>Padrão</translation> + </message> + <message> + <source>Comment</source> + <translation>Comentário</translation> + </message> + <message> + <source>Number</source> + <translation>Número</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Cadeia de caracteres envolvida por aspas duplas</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Cadeia de caracteres envolvida por aspas simples</translation> + </message> + <message> + <source>Keyword</source> + <translation>Palavra Chave</translation> + </message> + <message> + <source>Class name</source> + <translation>Nome da classe</translation> + </message> + <message> + <source>Function or method name</source> + <translation>Nome da função ou método</translation> + </message> + <message> + <source>Operator</source> + <translation>Operador</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificador</translation> + </message> + <message> + <source>Error</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>POD</source> + <translation type="unfinished">POD</translation> + </message> + <message> + <source>Regular expression</source> + <translation type="unfinished">Expressão Regular</translation> + </message> + <message> + <source>Global</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Symbol</source> + <translation type="unfinished">Símbolo</translation> + </message> + <message> + <source>Module name</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Instance variable</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Class variable</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Backticks</source> + <translation type="unfinished">Aspas Invertidas</translation> + </message> + <message> + <source>Data section</source> + <translation type="unfinished">Seção de dados</translation> + </message> + <message> + <source>Here document delimiter</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Here document</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%q string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%Q string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%x string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%r string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%w string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Demoted keyword</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>stdin</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>stdout</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>stderr</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerSQL</name> + <message> + <source>Default</source> + <translation>Padrão</translation> + </message> + <message> + <source>Comment</source> + <translation>Comentário</translation> + </message> + <message> + <source>Number</source> + <translation>Número</translation> + </message> + <message> + <source>Keyword</source> + <translation>Palavra Chave</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation>Cadeia de caracteres envolvida por aspas simples</translation> + </message> + <message> + <source>Operator</source> + <translation>Operador</translation> + </message> + <message> + <source>Identifier</source> + <translation>Identificador</translation> + </message> + <message> + <source>Comment line</source> + <translation>Comentário de Linha</translation> + </message> + <message> + <source>JavaDoc style comment</source> + <translation>Comentário estilo JavaDoc</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation>Cadeia de caracteres envolvida por aspas duplas</translation> + </message> + <message> + <source>SQL*Plus keyword</source> + <translation>Palavra chave do SQL*Plus</translation> + </message> + <message> + <source>SQL*Plus prompt</source> + <translation>Prompt do SQL*Plus</translation> + </message> + <message> + <source>SQL*Plus comment</source> + <translation>Comentário do SQL*Plus</translation> + </message> + <message> + <source># comment line</source> + <translation>Comentário de linha usando #</translation> + </message> + <message> + <source>JavaDoc keyword</source> + <translation>Palavra chave JavaDoc</translation> + </message> + <message> + <source>JavaDoc keyword error</source> + <translation>Erro de palavra chave do JavaDoc</translation> + </message> + <message> + <source>User defined 1</source> + <translation>Definição de usuário 1</translation> + </message> + <message> + <source>User defined 2</source> + <translation>Definição de usuário 2</translation> + </message> + <message> + <source>User defined 3</source> + <translation>Definição de usuário 3</translation> + </message> + <message> + <source>User defined 4</source> + <translation>Definição de usuário 4</translation> + </message> +</context> +<context> + <name>QextScintillaLexerTeX</name> + <message> + <source>Default</source> + <translation>Padrão</translation> + </message> + <message> + <source>Special</source> + <translation>Especial</translation> + </message> + <message> + <source>Group</source> + <translation>Grupo</translation> + </message> + <message> + <source>Symbol</source> + <translation>Símbolo</translation> + </message> + <message> + <source>Command</source> + <translation>Comando</translation> + </message> + <message> + <source>Text</source> + <translation>Texto</translation> + </message> +</context> +</TS> diff --git a/qt/qscintilla_ru.qm b/qt/qscintilla_ru.qm Binary files differnew file mode 100644 index 0000000..7d85cf8 --- /dev/null +++ b/qt/qscintilla_ru.qm diff --git a/qt/qscintilla_ru.ts b/qt/qscintilla_ru.ts new file mode 100644 index 0000000..00ac826 --- /dev/null +++ b/qt/qscintilla_ru.ts @@ -0,0 +1,1635 @@ +<!DOCTYPE TS><TS> +<context> + <name>QextScintillaCommand</name> + <message> + <source>Move left one character</source> + <translation type="unfinished">Сдвинуться влево на один символ</translation> + </message> + <message> + <source>Move right one character</source> + <translation type="unfinished">Сдвинуться вправо на один символ</translation> + </message> + <message> + <source>Move up one line</source> + <translation type="unfinished">Сдвинуться вверх на одну строчку</translation> + </message> + <message> + <source>Move down one line</source> + <translation type="unfinished">Сдвинуться вправо на одну строчку</translation> + </message> + <message> + <source>Move left one word part</source> + <translation type="unfinished">Сдвинуться влево на одну часть слова</translation> + </message> + <message> + <source>Move right one word part</source> + <translation type="unfinished">Сдвинуться вправо на одну часть слова</translation> + </message> + <message> + <source>Move left one word</source> + <translation type="unfinished">Сдвинуться влево на одно слово</translation> + </message> + <message> + <source>Move right one word</source> + <translation type="unfinished">Сдвинуться вправо на одно слово</translation> + </message> + <message> + <source>Move to first visible character in line</source> + <translation type="unfinished">Переместиться на первый видимый символ на строке</translation> + </message> + <message> + <source>Move to end of line</source> + <translation type="unfinished">Сдвинуться в конец строки</translation> + </message> + <message> + <source>Scroll view down one line</source> + <translation type="unfinished">Прокрутить вид на одну строку вниз</translation> + </message> + <message> + <source>Scroll view up one line</source> + <translation type="unfinished">Прокрутить вид на одну строку вверх</translation> + </message> + <message> + <source>Move up one paragraph</source> + <translation type="unfinished">Сдвинуться вверх на один параграф</translation> + </message> + <message> + <source>Move down one paragraph</source> + <translation type="unfinished">Сдвинуться вниз на один параграф</translation> + </message> + <message> + <source>Move up one page</source> + <translation type="unfinished">Сдвинуться вверх на одну страницу</translation> + </message> + <message> + <source>Move down one page</source> + <translation type="unfinished">Сдвинуться вправо на одну страницу</translation> + </message> + <message> + <source>Move to start of text</source> + <translation type="unfinished">Переместиться в начало текста</translation> + </message> + <message> + <source>Move to end of text</source> + <translation type="unfinished">Переместиться в конец текста</translation> + </message> + <message> + <source>Indent one level</source> + <translation type="unfinished">Увеличить отступ на один уровень</translation> + </message> + <message> + <source>Move back one indentation level</source> + <translation type="unfinished">Уменьшить отступ на один уровень</translation> + </message> + <message> + <source>Select all text</source> + <translation type="unfinished">Выбрать весь текст</translation> + </message> + <message> + <source>Extend selection left one character</source> + <translation type="unfinished">Расширить выделение на один символ влево</translation> + </message> + <message> + <source>Extend selection right one character</source> + <translation type="unfinished">Расширить выделение на один символ вправо</translation> + </message> + <message> + <source>Extend selection up one line</source> + <translation type="unfinished">Расширить выделение на одну строку вверх</translation> + </message> + <message> + <source>Extend selection down one line</source> + <translation type="unfinished">Расширить выделение на одну строку вниз</translation> + </message> + <message> + <source>Extend selection left one word part</source> + <translation type="unfinished">Расширить выделение влево на одну часть слова</translation> + </message> + <message> + <source>Extend selection right one word part</source> + <translation type="unfinished">Расширить выделение вправо на одну часть слова</translation> + </message> + <message> + <source>Extend selection left one word</source> + <translation type="unfinished">Расширить выделение влево на одно слово</translation> + </message> + <message> + <source>Extend selection right one word</source> + <translation type="unfinished">Расширить выделение вправо на одно слово</translation> + </message> + <message> + <source>Extend selection to first visible character in line</source> + <translation type="unfinished">Расширить выделение до первого видимого символа на строке</translation> + </message> + <message> + <source>Extend selection to start of line</source> + <translation type="unfinished">Расширить выделение до начала строки</translation> + </message> + <message> + <source>Extend selection to end of line</source> + <translation type="unfinished">Расширить выделение до конца строки</translation> + </message> + <message> + <source>Extend selection up one paragraph</source> + <translation type="unfinished">Расширить выделение вверх на один параграф</translation> + </message> + <message> + <source>Extend selection down one paragraph</source> + <translation type="unfinished">Расширить выделение вниз на один параграф</translation> + </message> + <message> + <source>Extend selection up one page</source> + <translation type="unfinished">Расширить выделение на одну страницу вверх</translation> + </message> + <message> + <source>Extend selection down one page</source> + <translation type="unfinished">Расширить выделение на одну страницу вниз</translation> + </message> + <message> + <source>Extend selection to start of text</source> + <translation type="unfinished">Расширить выделение до начала текста</translation> + </message> + <message> + <source>Extend selection to end of text</source> + <translation type="unfinished">Расширить выделение до конца текста</translation> + </message> + <message> + <source>Delete previous character</source> + <translation type="unfinished">Удалить предыдущий символ</translation> + </message> + <message> + <source>Delete previous character if not at line start</source> + <translation type="unfinished">Удалить предыдущий символ, если он не в начале строки</translation> + </message> + <message> + <source>Delete current character</source> + <translation type="unfinished">Удалить текущий символ</translation> + </message> + <message> + <source>Delete word to left</source> + <translation type="unfinished">Удалить слово слева</translation> + </message> + <message> + <source>Delete word to right</source> + <translation type="unfinished">Удалить слово справа</translation> + </message> + <message> + <source>Delete line to left</source> + <translation type="unfinished">Удалить строку слева</translation> + </message> + <message> + <source>Delete line to right</source> + <translation type="unfinished">Удалить строку справа</translation> + </message> + <message> + <source>Insert new line</source> + <translation type="unfinished">Вставить новую строку</translation> + </message> + <message> + <source>Delete current line</source> + <translation type="unfinished">Удалить текущую строку</translation> + </message> + <message> + <source>Swap current and previous lines</source> + <translation type="unfinished">Поменять местами текущую и предыдущую строки</translation> + </message> + <message> + <source>Cut current line</source> + <translation type="unfinished">Вырезать текущую строку</translation> + </message> + <message> + <source>Cut selection</source> + <translation type="unfinished">Вырезать выделение</translation> + </message> + <message> + <source>Copy current line</source> + <translation type="unfinished">Копировать текущую строку</translation> + </message> + <message> + <source>Copy selection</source> + <translation type="unfinished">Копировать выделение</translation> + </message> + <message> + <source>Paste</source> + <translation type="unfinished">Вставить</translation> + </message> + <message> + <source>Redo last command</source> + <translation type="unfinished">Повторить последнюю команду</translation> + </message> + <message> + <source>Undo the last command</source> + <translation type="unfinished">Отменить последнюю команду</translation> + </message> + <message> + <source>Cancel</source> + <translation type="unfinished">Отменить</translation> + </message> + <message> + <source>Toggle insert/overtype</source> + <translation type="unfinished">Переключиться на вставку/замещение</translation> + </message> + <message> + <source>Convert selection to lower case</source> + <translation type="unfinished">Преобразовать выделение в нижний регистр</translation> + </message> + <message> + <source>Convert selection to upper case</source> + <translation type="unfinished">Преобразовать выделение в верхний регистр</translation> + </message> + <message> + <source>Zoom in</source> + <translation type="unfinished">Увеличить</translation> + </message> + <message> + <source>Zoom out</source> + <translation type="unfinished">Уменьшить</translation> + </message> + <message> + <source>Extend rectangular selection down one line</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Extend rectangular selection up one line</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Extend rectangular selection left one character</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Extend rectangular selection right one character</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Move to start of displayed line</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Extend rectangular selection to first visible character in line</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Move to end of displayed line</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Extend selection to end of displayed line</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Extend rectangular selection to end of line</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Extend rectangular selection up one page</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Extend rectangular selection down one page</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Set zoom</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Formfeed</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Duplicate selection</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerBash</name> + <message> + <source>Default</source> + <translation type="unfinished">По умолчанию</translation> + </message> + <message> + <source>Comment</source> + <translation type="unfinished">Комментарий</translation> + </message> + <message> + <source>Number</source> + <translation type="unfinished">Число</translation> + </message> + <message> + <source>Keyword</source> + <translation type="unfinished">Ключевое слово</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation type="unfinished">Строка в двойных кавычках</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation type="unfinished">Строка в одинарных кавычках</translation> + </message> + <message> + <source>Operator</source> + <translation type="unfinished">Оператор</translation> + </message> + <message> + <source>Identifier</source> + <translation type="unfinished">Идентификатор</translation> + </message> + <message> + <source>Error</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Scalar</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Parameter expansion</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Backticks</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Here document delimiter</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Single-quoted here document</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerBatch</name> + <message> + <source>Default</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Comment</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Keyword</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Label</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Hide command character</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>External command</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Variable</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Operator</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerCPP</name> + <message> + <source>Default</source> + <translation type="unfinished">По умолчанию</translation> + </message> + <message> + <source>C comment</source> + <translation type="unfinished">Комментарий C</translation> + </message> + <message> + <source>C++ comment</source> + <translation type="unfinished">Комментарий C++</translation> + </message> + <message> + <source>JavaDoc style C comment</source> + <translation type="unfinished">Комментарий C в стиле JavaDoc</translation> + </message> + <message> + <source>Number</source> + <translation type="unfinished">Число</translation> + </message> + <message> + <source>Keyword</source> + <translation type="unfinished">Ключевое слово</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation type="unfinished">Строка в двойных кавычках</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation type="unfinished">Строка в одинарных кавычках</translation> + </message> + <message> + <source>Pre-processor block</source> + <translation type="unfinished">Блок препроцессора</translation> + </message> + <message> + <source>Operator</source> + <translation type="unfinished">Оператор</translation> + </message> + <message> + <source>Identifier</source> + <translation type="unfinished">Идентификатор</translation> + </message> + <message> + <source>Unclosed string</source> + <translation type="unfinished">Незакрытая строка</translation> + </message> + <message> + <source>JavaDoc style C++ comment</source> + <translation type="unfinished">Комментарий C++ в стиле JavaDoc</translation> + </message> + <message> + <source>Secondary keywords and identifiers</source> + <translation type="unfinished">Вторичные ключевые слова и идентификаторы</translation> + </message> + <message> + <source>JavaDoc keyword</source> + <translation type="unfinished">Ключевое слово JavaDoc</translation> + </message> + <message> + <source>JavaDoc keyword error</source> + <translation type="unfinished">Ошибка в ключевом слове JavaDoc</translation> + </message> + <message> + <source>Global classes and typedefs</source> + <translation type="unfinished">По умолчанию</translation> + </message> +</context> +<context> + <name>QextScintillaLexerCSS</name> + <message> + <source>Default</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Tag</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Class selector</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Pseudo-class</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Unknown pseudo-class</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Operator</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>CSS1 property</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Unknown property</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Value</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>ID selector</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Important</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>@-rule</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Double-quoted string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Single-quoted string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>CSS2 property</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Attribute</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerCSharp</name> + <message> + <source>Verbatim string</source> + <translation type="unfinished">Строка без замен</translation> + </message> +</context> +<context> + <name>QextScintillaLexerDiff</name> + <message> + <source>Default</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Comment</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Command</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Header</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Position</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Removed line</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Added line</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerHTML</name> + <message> + <source>HTML default</source> + <translation type="unfinished">HTML по умолчанию</translation> + </message> + <message> + <source>Tag</source> + <translation type="unfinished">Тег</translation> + </message> + <message> + <source>Unknown tag</source> + <translation type="unfinished">Неизвестный тег</translation> + </message> + <message> + <source>Attribute</source> + <translation type="unfinished">Атрибут</translation> + </message> + <message> + <source>Unknown attribute</source> + <translation type="unfinished">Неизвестный атрибут</translation> + </message> + <message> + <source>HTML number</source> + <translation type="unfinished">Число в HTML</translation> + </message> + <message> + <source>HTML double-quoted string</source> + <translation type="unfinished">Строка в двойных кавычках HTML</translation> + </message> + <message> + <source>HTML single-quoted string</source> + <translation type="unfinished">Строка в одинарных кавычках HTML</translation> + </message> + <message> + <source>Other text in a tag</source> + <translation type="unfinished">Другой текст в теге</translation> + </message> + <message> + <source>HTML comment</source> + <translation type="unfinished">Комментарий HTML</translation> + </message> + <message> + <source>Entity</source> + <translation type="unfinished">Сущность</translation> + </message> + <message> + <source>End of a tag</source> + <translation type="unfinished">Окончание тега</translation> + </message> + <message> + <source>Start of an XML fragment</source> + <translation type="unfinished">Начало фрагмента XML</translation> + </message> + <message> + <source>End of an XML fragment</source> + <translation type="unfinished">Окончание фрагмента XML</translation> + </message> + <message> + <source>Script tag</source> + <translation type="unfinished">Тег сценария</translation> + </message> + <message> + <source>Start of an ASP fragment with @</source> + <translation type="unfinished">Начало @-фрагмента ASP</translation> + </message> + <message> + <source>Start of an ASP fragment</source> + <translation type="unfinished">Начало фрагмента ASP</translation> + </message> + <message> + <source>CDATA</source> + <translation type="unfinished">CDATA</translation> + </message> + <message> + <source>Start of a PHP fragment</source> + <translation type="unfinished">Начало фрагмента PHP</translation> + </message> + <message> + <source>Unquoted HTML value</source> + <translation type="unfinished">Значение атрибута HTML не в кавычках</translation> + </message> + <message> + <source>ASP X-Code comment</source> + <translation type="unfinished">Комментарий ASP X-Code</translation> + </message> + <message> + <source>SGML default</source> + <translation type="unfinished">SGML по умолчанию</translation> + </message> + <message> + <source>SGML command</source> + <translation type="unfinished">Команда SGML</translation> + </message> + <message> + <source>First parameter of an SGML command</source> + <translation type="unfinished">Первый параметр команды SGML</translation> + </message> + <message> + <source>SGML double-quoted string</source> + <translation type="unfinished">Строка в двойных кавычках SGML</translation> + </message> + <message> + <source>SGML single-quoted string</source> + <translation type="unfinished">Строка в одинарных кавычках SGML</translation> + </message> + <message> + <source>SGML error</source> + <translation type="unfinished">Ошибка SGML</translation> + </message> + <message> + <source>SGML special entity</source> + <translation type="unfinished">Специальная сущность SGML</translation> + </message> + <message> + <source>SGML comment</source> + <translation type="unfinished">Комментарий SGML</translation> + </message> + <message> + <source>First parameter comment of an SGML command</source> + <translation type="unfinished">Комментарий к первому параметру команды SGML</translation> + </message> + <message> + <source>SGML block default</source> + <translation type="unfinished">SGML-блок по умолчанию</translation> + </message> + <message> + <source>Start of a JavaScript fragment</source> + <translation type="unfinished">Начало фрагмента JavaScript</translation> + </message> + <message> + <source>JavaScript default</source> + <translation type="unfinished">JavaScript по умолчанию</translation> + </message> + <message> + <source>JavaScript comment</source> + <translation type="unfinished">Комментарий JavaScript</translation> + </message> + <message> + <source>JavaScript line comment</source> + <translation type="unfinished">Однострочный комментарий JavaScript</translation> + </message> + <message> + <source>JavaDoc style JavaScript comment</source> + <translation type="unfinished">Комментарий JavaScript в стиле JavaDoc</translation> + </message> + <message> + <source>JavaScript number</source> + <translation type="unfinished">Число JavaScript</translation> + </message> + <message> + <source>JavaScript word</source> + <translation type="unfinished">Слово JavaScript</translation> + </message> + <message> + <source>JavaScript keyword</source> + <translation type="unfinished">Ключевое слово JavaScript</translation> + </message> + <message> + <source>JavaScript double-quoted string</source> + <translation type="unfinished">Строка JavaScript в двойных кавычках </translation> + </message> + <message> + <source>JavaScript single-quoted string</source> + <translation type="unfinished">Строка JavaScript в одинарных кавычках </translation> + </message> + <message> + <source>JavaScript symbol</source> + <translation type="unfinished">Символ JavaScript</translation> + </message> + <message> + <source>JavaScript unclosed string</source> + <translation type="unfinished">Незакрытая строка JavaScript</translation> + </message> + <message> + <source>JavaScript regular expression</source> + <translation type="unfinished">Регулярное выражение JavaScript</translation> + </message> + <message> + <source>Start of an ASP JavaScript fragment</source> + <translation type="unfinished">Начало JavaScript-фрагмента в ASP</translation> + </message> + <message> + <source>ASP JavaScript default</source> + <translation type="unfinished">ASP JavaScript по умолчанию</translation> + </message> + <message> + <source>ASP JavaScript comment</source> + <translation type="unfinished">Комментарий ASP JavaScript </translation> + </message> + <message> + <source>ASP JavaScript line comment</source> + <translation type="unfinished">Однострочный комментарий ASP JavaScript</translation> + </message> + <message> + <source>JavaDoc style ASP JavaScript comment</source> + <translation type="unfinished">Комментарий ASP JavaScript в стиле JavaDoc</translation> + </message> + <message> + <source>ASP JavaScript number</source> + <translation type="unfinished">Число ASP JavaScript</translation> + </message> + <message> + <source>ASP JavaScript word</source> + <translation type="unfinished">Слово ASP JavaScript</translation> + </message> + <message> + <source>ASP JavaScript keyword</source> + <translation type="unfinished">Ключевое слово ASP JavaScript</translation> + </message> + <message> + <source>ASP JavaScript double-quoted string</source> + <translation type="unfinished">Строка ASP JavaScript в двойных кавычках </translation> + </message> + <message> + <source>ASP JavaScript single-quoted string</source> + <translation type="unfinished">Строка ASP JavaScript в одинарных кавычках </translation> + </message> + <message> + <source>ASP JavaScript symbol</source> + <translation type="unfinished">Символ ASP JavaScript</translation> + </message> + <message> + <source>ASP JavaScript unclosed string</source> + <translation type="unfinished">Незакрытая строка ASP JavaScript</translation> + </message> + <message> + <source>ASP JavaScript regular expression</source> + <translation type="unfinished">Регулярное выражение ASP JavaScript</translation> + </message> + <message> + <source>Start of a VBScript fragment</source> + <translation type="unfinished">Начало фрагмента VBScript</translation> + </message> + <message> + <source>VBScript default</source> + <translation type="unfinished">VBScript по умолчанию</translation> + </message> + <message> + <source>VBScript comment</source> + <translation type="unfinished">Комментарий VBScript</translation> + </message> + <message> + <source>VBScript number</source> + <translation type="unfinished">Число VBScript</translation> + </message> + <message> + <source>VBScript keyword</source> + <translation type="unfinished">Ключевое слово VBScript</translation> + </message> + <message> + <source>VBScript string</source> + <translation type="unfinished">Строка VBScript </translation> + </message> + <message> + <source>VBScript identifier</source> + <translation type="unfinished">Идентификатор VBScript</translation> + </message> + <message> + <source>VBScript unclosed string</source> + <translation type="unfinished">Незакрытая строка VBScript</translation> + </message> + <message> + <source>Start of an ASP VBScript fragment</source> + <translation type="unfinished">Начало VBScript-фрагмента в ASP</translation> + </message> + <message> + <source>ASP VBScript default</source> + <translation type="unfinished">ASP VBScript по умолчанию</translation> + </message> + <message> + <source>ASP VBScript comment</source> + <translation type="unfinished">Комментарий ASP VBScript </translation> + </message> + <message> + <source>ASP VBScript number</source> + <translation type="unfinished">Число ASP VBScript</translation> + </message> + <message> + <source>ASP VBScript keyword</source> + <translation type="unfinished">Ключевое слово ASP VBScript</translation> + </message> + <message> + <source>ASP VBScript string</source> + <translation type="unfinished">Строка ASP VBScript </translation> + </message> + <message> + <source>ASP VBScript identifier</source> + <translation type="unfinished">Идентификатор ASP VBScript</translation> + </message> + <message> + <source>ASP VBScript unclosed string</source> + <translation type="unfinished">Незакрытая строка ASP VBScript</translation> + </message> + <message> + <source>Start of a Python fragment</source> + <translation type="unfinished">Начало фрагмента Python</translation> + </message> + <message> + <source>Python default</source> + <translation type="unfinished">Python по умолчанию</translation> + </message> + <message> + <source>Python comment</source> + <translation type="unfinished">Комментарий Python</translation> + </message> + <message> + <source>Python number</source> + <translation type="unfinished">Число в Python</translation> + </message> + <message> + <source>Python double-quoted string</source> + <translation type="unfinished">Строка в двойных кавычках Python</translation> + </message> + <message> + <source>Python single-quoted string</source> + <translation type="unfinished">Строка в одинарных кавычках Python</translation> + </message> + <message> + <source>Python keyword</source> + <translation type="unfinished">Ключевое слово в Python</translation> + </message> + <message> + <source>Python triple double-quoted string</source> + <translation type="unfinished">Многострочная строка в двойных кавычках в Python</translation> + </message> + <message> + <source>Python triple single-quoted string</source> + <translation type="unfinished">Многострочная строка в одинарных кавычках в Python</translation> + </message> + <message> + <source>Python class name</source> + <translation type="unfinished">Имя класса в Python</translation> + </message> + <message> + <source>Python function or method name</source> + <translation type="unfinished">Имя функции/метода в Python</translation> + </message> + <message> + <source>Python operator</source> + <translation type="unfinished">Оператор Python</translation> + </message> + <message> + <source>Python identifier</source> + <translation type="unfinished">Идентификатор Python</translation> + </message> + <message> + <source>Start of an ASP Python fragment</source> + <translation type="unfinished">Начало Python-фрагмента в ASP</translation> + </message> + <message> + <source>ASP Python default</source> + <translation type="unfinished">ASP Python по умолчанию</translation> + </message> + <message> + <source>ASP Python comment</source> + <translation type="unfinished">Комментарий ASP Python</translation> + </message> + <message> + <source>ASP Python number</source> + <translation type="unfinished">Число в ASP Python</translation> + </message> + <message> + <source>ASP Python double-quoted string</source> + <translation type="unfinished">Строка в двойных кавычках ASP Python</translation> + </message> + <message> + <source>ASP Python single-quoted string</source> + <translation type="unfinished">Строка в одинарных кавычках ASP Python</translation> + </message> + <message> + <source>ASP Python keyword</source> + <translation type="unfinished">Ключевое слово в ASP Python</translation> + </message> + <message> + <source>ASP Python triple double-quoted string</source> + <translation type="unfinished">Многострочная строка в двойных кавычках в ASP Python</translation> + </message> + <message> + <source>ASP Python triple single-quoted string</source> + <translation type="unfinished">Многострочная строка в одинарных кавычках в ASP Python</translation> + </message> + <message> + <source>ASP Python class name</source> + <translation type="unfinished">Имя класса в ASP Python</translation> + </message> + <message> + <source>ASP Python function or method name</source> + <translation type="unfinished">Имя функции/метода в ASP Python</translation> + </message> + <message> + <source>ASP Python operator</source> + <translation type="unfinished">Оператор ASP Python</translation> + </message> + <message> + <source>ASP Python identifier</source> + <translation type="unfinished">Идентификатор ASP Python</translation> + </message> + <message> + <source>PHP default</source> + <translation type="unfinished">PHP по умолчанию</translation> + </message> + <message> + <source>PHP double-quoted string</source> + <translation type="unfinished">Строка в двойных кавычках PHP</translation> + </message> + <message> + <source>PHP single-quoted string</source> + <translation type="unfinished">Строка в одинарных кавычках PHP</translation> + </message> + <message> + <source>PHP keyword</source> + <translation type="unfinished">Ключевое слово PHP</translation> + </message> + <message> + <source>PHP number</source> + <translation type="unfinished">Число PHP</translation> + </message> + <message> + <source>PHP variable</source> + <translation type="unfinished">Переменная PHP</translation> + </message> + <message> + <source>PHP comment</source> + <translation type="unfinished">Комментарий PHP</translation> + </message> + <message> + <source>PHP line comment</source> + <translation type="unfinished">Однострочный комментарий PHP</translation> + </message> + <message> + <source>PHP double-quoted variable</source> + <translation type="unfinished">Переменная в двойных кавычках PHP</translation> + </message> + <message> + <source>PHP operator</source> + <translation type="unfinished">Оператор PHP</translation> + </message> +</context> +<context> + <name>QextScintillaLexerIDL</name> + <message> + <source>UUID</source> + <translation type="unfinished">UUID</translation> + </message> +</context> +<context> + <name>QextScintillaLexerJavaScript</name> + <message> + <source>Regular expression</source> + <translation type="unfinished">Регулярное выражение</translation> + </message> +</context> +<context> + <name>QextScintillaLexerLua</name> + <message> + <source>Default</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Comment</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Line comment</source> + <translation type="unfinished">Однострочный комментарий</translation> + </message> + <message> + <source>Number</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Keyword</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>String</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Character</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Literal string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Preprocessor</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Operator</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Identifier</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Unclosed string</source> + <translation type="unfinished">Незакрытая строка</translation> + </message> + <message> + <source>Basic functions</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>String, table and maths functions</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Coroutines, i/o and system facilities</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerMakefile</name> + <message> + <source>Default</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Comment</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Preprocessor</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Variable</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Operator</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Target</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Error</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerPOV</name> + <message> + <source>Default</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Comment</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Comment line</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Number</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Operator</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Identifier</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>String</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Unclosed string</source> + <translation type="unfinished">Незакрытая строка</translation> + </message> + <message> + <source>Directive</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Bad directive</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Objects, CSG and appearance</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Types, modifiers and items</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Predefined identifiers</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Predefined functions</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>User defined 1</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>User defined 2</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>User defined 3</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerPerl</name> + <message> + <source>Default</source> + <translation type="unfinished">По умолчанию</translation> + </message> + <message> + <source>Comment</source> + <translation type="unfinished">Комментарий</translation> + </message> + <message> + <source>Number</source> + <translation type="unfinished">Число</translation> + </message> + <message> + <source>Keyword</source> + <translation type="unfinished">Ключевое слово</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation type="unfinished">Строка в двойных кавычках</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation type="unfinished">Строка в одинарных кавычках</translation> + </message> + <message> + <source>Operator</source> + <translation type="unfinished">Оператор</translation> + </message> + <message> + <source>Identifier</source> + <translation type="unfinished">Идентификатор</translation> + </message> + <message> + <source>Regular expression</source> + <translation type="unfinished">Регулярное выражение</translation> + </message> + <message> + <source>Error</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>POD</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Scalar</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Array</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Hash</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Symbol table</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Substitution</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Backticks</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Data section</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Here document delimiter</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Single-quoted here document</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Double-quoted here document</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Backtick here document</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Quoted string (q)</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Quoted string (qq)</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Quoted string (qx)</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Quoted string (qr)</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Quoted string (qw)</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>POD verbatim</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerProperties</name> + <message> + <source>Default</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Comment</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Section</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Assignment</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Default value</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerPython</name> + <message> + <source>Default</source> + <translation type="unfinished">По умолчанию</translation> + </message> + <message> + <source>Comment</source> + <translation type="unfinished">Комментарий</translation> + </message> + <message> + <source>Number</source> + <translation type="unfinished">Число</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation type="unfinished">Строка в двойных кавычках</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation type="unfinished">Строка в одинарных кавычках</translation> + </message> + <message> + <source>Keyword</source> + <translation type="unfinished">Ключевое слово</translation> + </message> + <message> + <source>Triple single-quoted string</source> + <translation type="unfinished">Многострочная строка в одинарных кавычках (<code>'''...'''</code>)</translation> + </message> + <message> + <source>Triple double-quoted string</source> + <translation type="unfinished">Многострочная строка в двойных кавычках (<code>"""..."""</code>)</translation> + </message> + <message> + <source>Class name</source> + <translation type="unfinished">Имя класса</translation> + </message> + <message> + <source>Function or method name</source> + <translation type="unfinished">Имя функции/метода</translation> + </message> + <message> + <source>Operator</source> + <translation type="unfinished">Оператор</translation> + </message> + <message> + <source>Identifier</source> + <translation type="unfinished">Идентификатор</translation> + </message> + <message> + <source>Comment block</source> + <translation type="unfinished">Блочный комментарий</translation> + </message> + <message> + <source>Unclosed string</source> + <translation type="unfinished">Незакрытая строка</translation> + </message> + <message> + <source>Highlighted identifier</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Decorator</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerRuby</name> + <message> + <source>Default</source> + <translation type="unfinished">По умолчанию</translation> + </message> + <message> + <source>Comment</source> + <translation type="unfinished">Комментарий</translation> + </message> + <message> + <source>Number</source> + <translation type="unfinished">Число</translation> + </message> + <message> + <source>Double-quoted string</source> + <translation type="unfinished">Строка в двойных кавычках</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation type="unfinished">Строка в одинарных кавычках</translation> + </message> + <message> + <source>Keyword</source> + <translation type="unfinished">Ключевое слово</translation> + </message> + <message> + <source>Class name</source> + <translation type="unfinished">Имя класса</translation> + </message> + <message> + <source>Function or method name</source> + <translation type="unfinished">Имя функции/метода</translation> + </message> + <message> + <source>Operator</source> + <translation type="unfinished">Оператор</translation> + </message> + <message> + <source>Identifier</source> + <translation type="unfinished">Идентификатор</translation> + </message> + <message> + <source>Error</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>POD</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Regular expression</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Global</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Symbol</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Module name</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Instance variable</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Class variable</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Backticks</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Data section</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Here document delimiter</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Here document</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%q string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%Q string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%x string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%r string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>%w string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Demoted keyword</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>stdin</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>stdout</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>stderr</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerSQL</name> + <message> + <source>Default</source> + <translation type="unfinished">По умолчанию</translation> + </message> + <message> + <source>Comment</source> + <translation type="unfinished">Комментарий</translation> + </message> + <message> + <source>Number</source> + <translation type="unfinished">Число</translation> + </message> + <message> + <source>Keyword</source> + <translation type="unfinished">Ключевое слово</translation> + </message> + <message> + <source>Single-quoted string</source> + <translation type="unfinished">Строка в одинарных кавычках</translation> + </message> + <message> + <source>Operator</source> + <translation type="unfinished">Оператор</translation> + </message> + <message> + <source>Identifier</source> + <translation type="unfinished">Идентификатор</translation> + </message> + <message> + <source>Comment line</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>JavaDoc style comment</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Double-quoted string</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>SQL*Plus keyword</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>SQL*Plus prompt</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>SQL*Plus comment</source> + <translation type="unfinished"></translation> + </message> + <message> + <source># comment line</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>JavaDoc keyword</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>JavaDoc keyword error</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>User defined 1</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>User defined 2</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>User defined 3</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>User defined 4</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>QextScintillaLexerTeX</name> + <message> + <source>Default</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Special</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Group</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Symbol</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Command</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Text</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> |