MG: implemented BlockIndent for synedit

git-svn-id: trunk@3320 -
This commit is contained in:
lazarus 2002-09-10 19:59:14 +00:00
parent 297f2f94ee
commit 931003e766

View File

@ -146,7 +146,7 @@ type
fUseSyntaxHighlight:boolean; fUseSyntaxHighlight:boolean;
fBlockIndent:integer; fBlockIndent:integer;
fUndoLimit:integer; fUndoLimit:integer;
fTabWidths:integer; fTabWidth:integer;
// Display options // Display options
fVisibleRightMargin:boolean; fVisibleRightMargin:boolean;
@ -216,7 +216,7 @@ type
read fUseSyntaxHighlight write fUseSyntaxHighlight default true; read fUseSyntaxHighlight write fUseSyntaxHighlight default true;
property BlockIndent:integer read fBlockIndent write fBlockIndent default 2; property BlockIndent:integer read fBlockIndent write fBlockIndent default 2;
property UndoLimit:integer read fUndoLimit write fUndoLimit default 32767; property UndoLimit:integer read fUndoLimit write fUndoLimit default 32767;
property TabWidths:integer read fTabWidths write fTabWidths default 8; property TabWidth:integer read fTabWidth write fTabWidth default 8;
// Display options // Display options
property VisibleRightMargin:boolean property VisibleRightMargin:boolean
@ -978,7 +978,7 @@ begin
fShowTabCloseButtons:=true; fShowTabCloseButtons:=true;
fBlockIndent:=2; fBlockIndent:=2;
fUndoLimit:=32767; fUndoLimit:=32767;
fTabWidths:=8; fTabWidth:=8;
// Display options // Display options
fEditorFont:='courier'; fEditorFont:='courier';
@ -1070,8 +1070,8 @@ begin
XMLConfig.GetValue('EditorOptions/General/Editor/BlockIndent',fBlockIndent); XMLConfig.GetValue('EditorOptions/General/Editor/BlockIndent',fBlockIndent);
fUndoLimit:= fUndoLimit:=
XMLConfig.GetValue('EditorOptions/General/Editor/UndoLimit',fUndoLimit); XMLConfig.GetValue('EditorOptions/General/Editor/UndoLimit',fUndoLimit);
fTabWidths:= fTabWidth:=
XMLConfig.GetValue('EditorOptions/General/Editor/TabWidths',fTabWidths); XMLConfig.GetValue('EditorOptions/General/Editor/TabWidth',fTabWidth);
// Display options // Display options
fVisibleRightMargin:= fVisibleRightMargin:=
@ -1185,8 +1185,8 @@ begin
,fBlockIndent); ,fBlockIndent);
XMLConfig.SetValue('EditorOptions/General/Editor/UndoLimit' XMLConfig.SetValue('EditorOptions/General/Editor/UndoLimit'
,fUndoLimit); ,fUndoLimit);
XMLConfig.SetValue('EditorOptions/General/Editor/TabWidths' XMLConfig.SetValue('EditorOptions/General/Editor/TabWidth'
,fTabWidths); ,fTabWidth);
// Display options // Display options
XMLConfig.SetValue('EditorOptions/Display/VisibleRightMargin' XMLConfig.SetValue('EditorOptions/Display/VisibleRightMargin'
@ -1662,7 +1662,8 @@ procedure TEditorOptions.GetSynEditSettings(ASynEdit:TSynEdit);
begin begin
// general options // general options
ASynEdit.Options:=fSynEditOptions; ASynEdit.Options:=fSynEditOptions;
ASynEdit.TabWidth:=fBlockIndent; ASynEdit.BlockIndent:=fBlockIndent;
ASynEdit.TabWidth:=fTabWidth;
// Display options // Display options
ASynEdit.Gutter.Visible:=fVisibleGutter; ASynEdit.Gutter.Visible:=fVisibleGutter;
@ -1685,7 +1686,8 @@ procedure TEditorOptions.SetSynEditSettings(ASynEdit:TSynEdit);
begin begin
// general options // general options
fSynEditOptions:=ASynEdit.Options; fSynEditOptions:=ASynEdit.Options;
fTabWidths:=ASynEdit.TabWidth; fBlockIndent:=ASynEdit.BlockIndent;
fTabWidth:=ASynEdit.TabWidth;
// Display options // Display options
fVisibleGutter:=ASynEdit.Gutter.Visible; fVisibleGutter:=ASynEdit.Gutter.Visible;
@ -1742,7 +1744,8 @@ begin
// general options // general options
ASynEdit.Options:=fSynEditOptions-[eoDragDropEditing, eoDropFiles, ASynEdit.Options:=fSynEditOptions-[eoDragDropEditing, eoDropFiles,
eoScrollPastEof]+[eoNoCaret, eoNoSelection]; eoScrollPastEof]+[eoNoCaret, eoNoSelection];
ASynEdit.TabWidth:=fBlockIndent; ASynEdit.BlockIndent:=fBlockIndent;
ASynEdit.TabWidth:=fTabWidth;
// Display options // Display options
ASynEdit.Gutter.Visible:=false; ASynEdit.Gutter.Visible:=false;
@ -2313,8 +2316,16 @@ begin
// general // general
if Sender=BlockIndentComboBox then begin if Sender=BlockIndentComboBox then begin
NewVal:=StrToIntDef(BlockIndentComboBox.Text NewVal:=StrToIntDef(BlockIndentComboBox.Text
,PreviewEdits[1].TabWidth); ,PreviewEdits[1].BlockIndent);
SetComboBoxText(BlockIndentComboBox,IntToStr(NewVal)); SetComboBoxText(BlockIndentComboBox,IntToStr(NewVal));
for a:=Low(PreviewEdits) to High(PreviewEdits) do
if PreviewEdits[a]<>nil then
PreviewEdits[a].BlockIndent:=NewVal;
end
else if Sender=TabWidthsComboBox then begin
NewVal:=StrToIntDef(TabWidthsComboBox.Text
,PreviewEdits[1].TabWidth);
SetComboBoxText(TabWidthsComboBox,IntToStr(NewVal));
for a:=Low(PreviewEdits) to High(PreviewEdits) do for a:=Low(PreviewEdits) to High(PreviewEdits) do
if PreviewEdits[a]<>nil then if PreviewEdits[a]<>nil then
PreviewEdits[a].TabWidth:=NewVal; PreviewEdits[a].TabWidth:=NewVal;
@ -3436,8 +3447,7 @@ begin
Items.Add('4'); Items.Add('4');
Items.Add('8'); Items.Add('8');
Items.EndUpdate; Items.EndUpdate;
SetComboBoxText(TabWidthsComboBox,IntToStr(EditorOpts.TabWidths)); SetComboBoxText(TabWidthsComboBox,IntToStr(EditorOpts.TabWidth));
Enabled:=false;
OnChange:=@ComboBoxOnChange; OnChange:=@ComboBoxOnChange;
OnKeyDown:=@ComboBoxOnKeyDown; OnKeyDown:=@ComboBoxOnKeyDown;
OnExit:=@ComboBoxOnExit; OnExit:=@ComboBoxOnExit;
@ -5107,7 +5117,7 @@ begin
i:=StrToIntDef(TabWidthsComboBox.Text,2); i:=StrToIntDef(TabWidthsComboBox.Text,2);
if i<1 then i:=1; if i<1 then i:=1;
if i>20 then i:=20; if i>20 then i:=20;
EditorOpts.TabWidths:=i; EditorOpts.TabWidth:=i;
i:=StrToIntDef(BlockIndentComboBox.Text,2); i:=StrToIntDef(BlockIndentComboBox.Text,2);
if i<1 then i:=1; if i<1 then i:=1;
if i>20 then i:=20; if i>20 then i:=20;