/components/synedit/synedittypes.pp

http://github.com/graemeg/lazarus · Puppet · 166 lines · 155 code · 11 blank · 0 comment · 0 complexity · be1bd728aa2d0321b47a68599530423e MD5 · raw file

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