EditorOptions/Mouse: Added more Fold Actions templates

git-svn-id: trunk@20413 -
This commit is contained in:
martin 2009-06-04 23:59:16 +00:00
parent cf12e50a5a
commit 0f7c792281
5 changed files with 41 additions and 4 deletions

View File

@ -284,7 +284,9 @@ type
ColCount : Integer = 0; Skip: Boolean = False);
procedure UnFoldAtTextIndexCollapsed(AStartIndex: Integer); (* UnFolds only if Index is in the fold, ignores cfcollapsed line, if unfolded / 1-based *)
function IsFoldedAtTextIndex(AStartIndex, ColIndex: Integer): Boolean; (* Checks xth Fold at nth TextIndex (all lines in buffer) / 1-based *)
function IsFoldedAtTextIndex(AStartIndex, ColIndex: Integer): Boolean; (* Checks xth Fold at nth TextIndex (all lines in buffer) / 1-based *)
function LogicalPosToNodeIndex(AStartIndex: Integer; LogX: Integer; (* Returns the index of the node, at the logical char pos *)
Previous: Boolean = False): Integer;
procedure UnfoldAll;
@ -1829,6 +1831,39 @@ begin
Result := hl.FoldLineLength(ALine, AFoldIndex);
end;
function TSynEditFoldedView.LogicalPosToNodeIndex(AStartIndex: Integer; LogX: Integer;
Previous: Boolean): Integer;
var
hl: TSynCustomFoldHighlighter;
c, i: Integer;
nd: TSynFoldNodeInfo;
begin
if not(assigned(FHighLighter) and (FHighLighter is TSynCustomFoldHighlighter))
then exit;
hl := TSynCustomFoldHighlighter(FHighLighter);
// AStartIndex is 0-based
// FoldTree is 1-based AND first line remains visble
c := hl.FoldNodeInfoCount[AStartIndex];
if c = 0 then
exit(-1);
i := 0;
while i < c do begin
nd := hl.FoldNodeInfo[aStartIndex, i];
if sfaOpen in nd.FoldAction then begin
if (nd.LogXStart >= LogX) then begin
dec(i);
if not Previous then
i := -1;
break;
end;
if (nd.LogXEnd >= LogX) then
break;
end;
inc(i);
end;
Result := i;
end;
procedure TSynEditFoldedView.FoldAtTextIndex(AStartIndex : Integer;
ColIndex : Integer = -1; ColCount : Integer = 1; Skip: Boolean = False);
var

View File

@ -74,6 +74,8 @@ const
emcoCodeFoldCollapsOne = 0;
emcoCodeFoldCollapsAll = 1;
emcoCodeFoldCollapsAtCaret = 2;
emcoCodeFoldCollapsPreCaret = 3;
emcoCodeFoldExpandOne = 0;
emcoCodeFoldExpandAll = 1;

View File

@ -290,7 +290,7 @@ const
SYNS_emcContextMenu = 'Popup Menu';
SYNS_emcBreakPointToggle = 'Toggle Breakpoint';
SYNS_emcCodeFoldCollaps = 'Fold Code';
SYNS_emcCodeFoldCollaps_opt = 'Nodes,One,All';
SYNS_emcCodeFoldCollaps_opt = 'Nodes,One,All,"At Caret","Current Node"';
SYNS_emcCodeFoldExpand = 'Unfold Code';
SYNS_emcCodeFoldExpand_opt = 'Nodes,One,All';
SYNS_emcCodeFoldContextMenu = 'Fold Menu';

View File

@ -1,5 +1,3 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TMouseaActionDialog','FORMDATA',[
'TPF0'#19'TMouseaActionDialog'#18'MouseaActionDialog'#4'Left'#3#27#1#6'Height'
+#3#213#0#3'Top'#3#237#0#5'Width'#3'j'#1#8'AutoSize'#9#11'BorderIcons'#11#12

View File

@ -109,6 +109,7 @@ end;
procedure TMouseaActionDialog.ActionBoxChange(Sender: TObject);
begin
OptBox.Items.Clear;
OptBox.Items.CommaText := MouseCommandConfigName
(TSynEditorMouseCommand(PtrUInt(Pointer(ActionBox.items.Objects[ActionBox.ItemIndex]))));
if OptBox.Items.Count > 0 then begin
@ -149,6 +150,7 @@ begin
CtrlCheck.Checked := (ssCtrl in MAct.ShiftMask) and (ssCtrl in MAct.Shift);
if not(ssCtrl in MAct.ShiftMask) then CtrlCheck.State := cbGrayed;
OptBox.Items.Clear;
OptBox.Items.CommaText := MouseCommandConfigName(MAct.Command);
if OptBox.Items.Count > 0 then begin
OptLabel.Caption := OptBox.Items[0];