PageRenderTime 35ms CodeModel.GetById 16ms app.highlight 16ms RepoModel.GetById 1ms app.codeStats 0ms

/components/synedit/synedittypes.pp

http://github.com/graemeg/lazarus
Pascal | 166 lines | 125 code | 4 blank | 37 comment | 0 complexity | be1bd728aa2d0321b47a68599530423e MD5 | raw file
  1{-------------------------------------------------------------------------------
  2The contents of this file are subject to the Mozilla Public License
  3Version 1.1 (the "License"); you may not use this file except in compliance
  4with the License. You may obtain a copy of the License at
  5http://www.mozilla.org/MPL/
  6
  7Software distributed under the License is distributed on an "AS IS" basis,
  8WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
  9the specific language governing rights and limitations under the License.
 10
 11The Original Code is: SynEditTypes.pas, released 2000-04-07.
 12The Original Code is based on parts of mwCustomEdit.pas by Martin Waldenburg,
 13part of the mwEdit component suite.
 14Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg.
 15All Rights Reserved.
 16
 17Contributors to the SynEdit and mwEdit projects are listed in the
 18Contributors.txt file.
 19
 20Alternatively, the contents of this file may be used under the terms of the
 21GNU General Public License Version 2 or later (the "GPL"), in which case
 22the provisions of the GPL are applicable instead of those above.
 23If you wish to allow use of your version of this file only under the terms
 24of the GPL and not to allow others to use your version of this file
 25under the MPL, indicate your decision by deleting the provisions above and
 26replace them with the notice and other provisions required by the GPL.
 27If you do not delete the provisions above, a recipient may use your version
 28of this file under either the MPL or the GPL.
 29
 30$Id$
 31
 32You may retrieve the latest version of this file at the SynEdit home page,
 33located at http://SynEdit.SourceForge.net
 34
 35Known Issues:
 36-------------------------------------------------------------------------------}
 37
 38unit SynEditTypes;
 39
 40{$I synedit.inc}
 41
 42interface
 43uses
 44  SysUtils, types;
 45
 46const
 47  TSynSpecialChars = [#128..#255]; // MG: special chars. Meaning depends on system encoding/codepage.
 48  TSynValidStringChars = ['_', '0'..'9', 'A'..'Z', 'a'..'z'] + TSynSpecialChars;
 49  TSynWhiteChars = [' ', #9];
 50  TSynWordBreakChars = ['.', ',', ';', ':', '"', '''', '`', '!', '?', '[', ']',
 51     '(', ')', '{', '}', '@', '^', '-', '=', '+', '*', '/', '\', '|','<','>',
 52     '%', '&', '~'];
 53
 54type
 55  ESynEditError = class(Exception);
 56
 57  TSynIdentChars = set of char;
 58
 59  TLinePos = type integer; // 1..high(Integer);
 60  TLineIdx = type integer; // 0..high(Integer);
 61
 62  TLogCaretPoint = record
 63    X, Y, Offs: Integer;
 64  end;
 65
 66
 67  TSynCoordinateMappingFlag = (
 68    scmLimitToLines,
 69    scmIncludePartVisible,
 70    scmForceLeftSidePos   // do return the caret pos to the (logical) left of the char, even if the pixel is over the right half.
 71                          // TODO: RTL
 72  );
 73  TSynCoordinateMappingFlags = set of TSynCoordinateMappingFlag;
 74
 75  PSynSelectionMode = ^TSynSelectionMode;
 76  // to be binary (clipboard) compatible with other (Delphi compiled) synedits
 77  // use {$PACKENUM 1}
 78{$PACKENUM 1}
 79  TSynSelectionMode = (smNormal, smLine, smColumn, smCurrent);
 80{$PACKENUM 4}
 81
 82  TSynSearchOption =
 83    ( ssoMatchCase, ssoWholeWord,
 84      ssoBackwards,
 85      ssoEntireScope, ssoSelectedOnly,
 86      ssoReplace, ssoReplaceAll,
 87      ssoPrompt,
 88      ssoSearchInReplacement,    // continue search-replace in replacement (with ssoReplaceAll) // replace recursive
 89      ssoRegExpr, ssoRegExprMultiLine,
 90      ssoFindContinue      // Assume the current selection is the last match, and start search behind selection
 91                           // (before if ssoBackward) // Default is to start at caret (Only SearchReplace / SearchReplaceEx has start/end param)
 92    );
 93  TSynSearchOptions = set of TSynSearchOption;
 94
 95  TSynEditRange = pointer;
 96
 97  TSynStatusChange = (scCaretX, scCaretY,
 98    scLeftChar, scTopLine, scLinesInWindow, scCharsInWindow,
 99    scInsertMode, scModified, scSelection, scReadOnly,
100    scFocus,     // received or lost focus
101    scOptions    // some Options were changed (only triggered by some optinos)
102   );
103  TSynStatusChanges = set of TSynStatusChange;
104  TStatusChangeEvent = procedure(Sender: TObject; Changes: TSynStatusChanges)
105    of object;
106
107  TSynPaintEvent = (peBeforePaint, peAfterPaint);
108  TSynPaintEvents = set of TSynPaintEvent;
109  TSynPaintEventProc = procedure(Sender: TObject; EventType: TSynPaintEvent;
110    const rcClip: TRect
111  ) of object;
112
113  TSynScrollEvent = (peBeforeScroll, peAfterScroll, peAfterScrollFailed);
114  TSynScrollEvents = set of TSynScrollEvent;
115  TSynScrollEventProc = procedure(Sender: TObject; EventType: TSynScrollEvent;
116    dx, dy: Integer; const rcScroll, rcClip: TRect
117  ) of object;
118
119  TSynVisibleSpecialChar = (vscSpace, vscTabAtFirst, vscTabAtLast);
120  TSynVisibleSpecialChars = set of TSynVisibleSpecialChar;
121
122  TSynLineStyle = (
123    slsSolid,  // PS_SOLID pen
124    slsDashed, // PS_DASH pen
125    slsDotted, // PS_DOT
126    slsWaved   // solid wave
127  );
128
129  TSynFrameEdges = (
130    sfeNone,
131    sfeAround,      // frame around
132    sfeBottom,      // bottom part of the frame
133    sfeLeft         // left part of the frame
134  );
135
136  TLazSynBorderSide = (
137    bsLeft,
138    bsTop,
139    bsRight,
140    bsBottom
141  );
142  TLazSynBorderSides = set of TLazSynBorderSide;
143
144const
145  SynFrameEdgeToSides: array [TSynFrameEdges] of TLazSynBorderSides =
146  ( [],                                       // sfeNone
147    [bsLeft, bsTop, bsRight, bsBottom],   // sfeAround
148    [bsBottom],                              // sfeBottom
149    [bsLeft]                                 // sfeLeft
150  );
151
152  SynFrameEdgePriorities: array [TSynFrameEdges] of integer =
153  ( 0,    // sfeNone
154    1,   // sfeAround
155    2,   // sfeBottom
156    2    // sfeLeft
157  );
158
159  scTextCleared = [scCaretX, scCaretY, scLeftChar, scTopLine, scModified, scSelection];
160
161
162implementation
163
164end.
165
166