~ubuntu-branches/ubuntu/saucy/lazarus/saucy

« back to all changes in this revision

Viewing changes to components/synedit/synhighlighterlfm.pas

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Bart Martens, Paul Gevers
  • Date: 2013-06-08 14:12:17 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20130608141217-7k0cy9id8ifcnutc
Tags: 1.0.8+dfsg-1
[ Abou Al Montacir ]
* New upstream major release and multiple maintenace release offering many
  fixes and new features marking a new milestone for the Lazarus development
  and its stability level.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_fixes_branch
* LCL changes:
  - LCL is now a normal package.
      + Platform independent parts of the LCL are now in the package LCLBase
      + LCL is automatically recompiled when switching the target platform,
        unless pre-compiled binaries for this target are already installed.
      + No impact on existing projects.
      + Linker options needed by LCL are no more added to projects that do
        not use the LCL package.
  - Minor changes in LCL basic classes behaviour
      + TCustomForm.Create raises an exception if a form resource is not
        found.
      + TNotebook and TPage: a new implementation of these classes was added.
      + TDBNavigator: It is now possible to have focusable buttons by setting
        Options = [navFocusableButtons] and TabStop = True, useful for
        accessibility and for devices with neither mouse nor touch screen.
      + Names of TControlBorderSpacing.GetSideSpace and GetSpace were swapped
        and are now consistent. GetSideSpace = Around + GetSpace.
      + TForm.WindowState=wsFullscreen was added
      + TCanvas.TextFitInfo was added to calculate how many characters will
        fit into a specified Width. Useful for word-wrapping calculations.
      + TControl.GetColorResolvingParent and
        TControl.GetRGBColorResolvingParent were added, simplifying the work
        to obtain the final color of the control while resolving clDefault
        and the ParentColor.
      + LCLIntf.GetTextExtentExPoint now has a good default implementation
        which works in any platform not providing a specific implementation.
        However, Widgetset specific implementation is better, when available.
      + TTabControl was reorganized. Now it has the correct class hierarchy
        and inherits from TCustomTabControl as it should.
  - New unit in the LCL:
      + lazdialogs.pas: adds non-native versions of various native dialogs,
        for example TLazOpenDialog, TLazSaveDialog, TLazSelectDirectoryDialog.
        It is used by widgetsets which either do not have a native dialog, or
        do not wish to use it because it is limited. These dialogs can also be
        used by user applications directly.
      + lazdeviceapis.pas: offers an interface to more hardware devices such
        as the accelerometer, GPS, etc. See LazDeviceAPIs
      + lazcanvas.pas: provides a TFPImageCanvas descendent implementing
        drawing in a LCL-compatible way, but 100% in Pascal.
      + lazregions.pas. LazRegions is a wholly Pascal implementation of
        regions for canvas clipping, event clipping, finding in which control
        of a region tree one an event should reach, for drawing polygons, etc.
      + customdrawncontrols.pas, customdrawndrawers.pas,
        customdrawn_common.pas, customdrawn_android.pas and
        customdrawn_winxp.pas: are the Lazarus Custom Drawn Controls -controls
        which imitate the standard LCL ones, but with the difference that they
        are non-native and support skinning.
  - New APIs added to the LCL to improve support of accessibility software
    such as screen readers.
* IDE changes:
  - Many improvments.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/New_IDE_features_since#v1.0_.282012-08-29.29
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes#IDE_Changes
* Debugger / Editor changes:
  - Added pascal sources and breakpoints to the disassembler
  - Added threads dialog.
* Components changes:
  - TAChart: many fixes and new features
  - CodeTool: support Delphi style generics and new syntax extensions.
  - AggPas: removed to honor free licencing. (Closes: Bug#708695)
[Bart Martens]
* New debian/watch file fixing issues with upstream RC release.
[Abou Al Montacir]
* Avoid changing files in .pc hidden directory, these are used by quilt for
  internal purpose and could lead to surprises during build.
[Paul Gevers]
* Updated get-orig-source target and it compinion script orig-tar.sh so that they
  repack the source file, allowing bug 708695 to be fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
If you do not delete the provisions above, a recipient may use your version
28
28
of this file under either the MPL or the GPL.
29
29
 
30
 
$Id: synhighlighterlfm.pas 24685 2010-04-17 19:44:03Z martin $
 
30
$Id: synhighlighterlfm.pas 35115 2012-02-03 16:50:04Z martin $
31
31
 
32
32
You may retrieve the latest version of this file at the SynEdit home page,
33
33
located at http://SynEdit.SourceForge.net
50
50
 
51
51
uses
52
52
  SysUtils, Classes, FileUtil, Graphics,
53
 
  SynEditTextBuffer, SynEditTypes, SynEditHighlighter, SynEditHighlighterFoldBase;
 
53
  SynEditTypes, SynEditHighlighter, SynEditHighlighterFoldBase;
54
54
 
55
55
type
56
56
  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
65
65
    // internal type / no config
66
66
    cfbtLfmNone
67
67
    );
 
68
  TLfmCodeFoldBlockTypes = set of TLfmCodeFoldBlockType;
68
69
 
69
70
  TProcTableProc = procedure of object;
70
71
 
126
127
    function GetFoldConfigCount: Integer; override;
127
128
    function GetFoldConfigInternalCount: Integer; override;
128
129
  public
129
 
    {$IFNDEF SYN_CPPB_1} class {$ENDIF}                                         //mh 2000-07-14
130
 
    function GetLanguageName: string; override;
 
130
    class function GetLanguageName: string; override;
131
131
  public
132
132
    constructor Create(AOwner: TComponent); override;
133
133
    destructor Destroy; override;
149
149
    procedure SetRange(Value: Pointer); override;
150
150
    procedure ResetRange; override;
151
151
    property IdentChars;
152
 
  public
153
 
    // folding
154
 
    function FoldOpenCount(ALineIndex: Integer; AType: Integer = 0): integer; override;
155
 
    function FoldCloseCount(ALineIndex: Integer; AType: Integer = 0): integer; override;
156
 
    function FoldNestCount(ALineIndex: Integer; AType: Integer = 0): integer; override;
157
 
    // TODO: make private
158
 
    function MinimumFoldLevel(ALineIndex: Integer): integer; override;
159
 
    function EndFoldLevel(ALineIndex: Integer): integer; override;
160
152
  published
161
153
    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
162
154
      write fCommentAttri;
613
605
  fRange := rsUnknown;
614
606
end;
615
607
 
616
 
function TSynLFMSyn.FoldOpenCount(ALineIndex: Integer; AType: Integer): integer;
617
 
begin
618
 
  If AType <> 0 then exit(0);
619
 
  Result := EndFoldLevel(ALineIndex) - MinimumFoldLevel(ALineIndex);
620
 
end;
621
 
 
622
 
function TSynLFMSyn.FoldCloseCount(ALineIndex: Integer; AType: Integer): integer;
623
 
begin
624
 
  If AType <> 0 then exit(0);
625
 
  Result := EndFoldLevel(ALineIndex - 1) - MinimumFoldLevel(ALineIndex);
626
 
end;
627
 
 
628
 
function TSynLFMSyn.FoldNestCount(ALineIndex: Integer; AType: Integer): integer;
629
 
begin
630
 
  If AType <> 0 then exit(0);
631
 
  Result := EndFoldLevel(ALineIndex);
632
 
end;
633
 
 
634
 
function TSynLFMSyn.MinimumFoldLevel(ALineIndex: Integer): integer;
635
 
var
636
 
  r: TSynCustomHighlighterRange;
637
 
begin
638
 
  if (ALineIndex < 0) or (ALineIndex >= CurrentLines.Count) then
639
 
    exit(0);
640
 
  r := TSynCustomHighlighterRange(CurrentRanges[ALineIndex]);
641
 
  if (r <> nil) and (Pointer(r) <> NullRange) then
642
 
    Result := r.MinimumCodeFoldBlockLevel
643
 
  else
644
 
    Result := 0;
645
 
end;
646
 
 
647
 
function TSynLFMSyn.EndFoldLevel(ALineIndex: Integer): integer;
648
 
var
649
 
  r: TSynCustomHighlighterRange;
650
 
begin
651
 
  if (ALineIndex < 0) or (ALineIndex >= CurrentLines.Count) then
652
 
    exit(0);
653
 
  r := TSynCustomHighlighterRange(CurrentRanges[ALineIndex]);
654
 
  if (r <> nil) and (Pointer(r) <> NullRange) then
655
 
    Result := r.CodeFoldStackSize
656
 
  else
657
 
    Result := 0;
658
 
end;
659
 
 
660
608
procedure TSynLFMSyn.SetRange(Value: Pointer);
661
609
begin
662
610
  inherited;
668
616
  Result := TSynValidStringChars;
669
617
end;
670
618
 
671
 
{$IFNDEF SYN_CPPB_1} class {$ENDIF}                                             //mh 2000-07-14
672
 
function TSynLFMSyn.GetLanguageName: string;
 
619
class function TSynLFMSyn.GetLanguageName: string;
673
620
begin
674
621
  Result := SYNS_LangLFM;
675
622
end;
732
679
  Result := ord(high(TLfmCodeFoldBlockType)) - ord(low(TLfmCodeFoldBlockType)) + 1;
733
680
end;
734
681
 
735
 
{$IFNDEF SYN_CPPB_1}                                                            //mh 2000-07-14
736
682
initialization
737
683
  RegisterPlaceableHighlighter(TSynLFMSyn);
738
 
{$ENDIF}
 
684
 
739
685
end.