mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 15:10:16 +02:00
started custom highlighters
git-svn-id: trunk@8843 -
This commit is contained in:
parent
73d8121123
commit
615b02380e
@ -3399,9 +3399,9 @@ begin
|
|||||||
ctsNestedCommentsOn,ExternalMacroStart+'NestedComments','',da_DefineRecurse);
|
ctsNestedCommentsOn,ExternalMacroStart+'NestedComments','',da_DefineRecurse);
|
||||||
MainDir.AddChild(DefTempl);
|
MainDir.AddChild(DefTempl);
|
||||||
// enable FPDocSystem to find compiler functions like writeln and readln
|
// enable FPDocSystem to find compiler functions like writeln and readln
|
||||||
DefTempl:=TDefineTemplate.Create('FPDocSystem',
|
{DefTempl:=TDefineTemplate.Create('FPDocSystem',
|
||||||
ctsFPDocSystemOn,'FPDocSystem','',da_DefineRecurse);
|
ctsFPDocSystemOn,'FPDocSystem','',da_DefineRecurse);
|
||||||
MainDir.AddChild(DefTempl);
|
MainDir.AddChild(DefTempl);}
|
||||||
|
|
||||||
// compiler
|
// compiler
|
||||||
CompilerDir:=TDefineTemplate.Create('Compiler',ctsCompiler,'','compiler',
|
CompilerDir:=TDefineTemplate.Create('Compiler',ctsCompiler,'','compiler',
|
||||||
|
@ -841,7 +841,7 @@ begin
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
ctnProcedure);
|
ctnProcedure);
|
||||||
NewItem.ParamList:='various';
|
NewItem.ParamList:='Args : Arguments';
|
||||||
CurrentIdentifierList.Add(NewItem);
|
CurrentIdentifierList.Add(NewItem);
|
||||||
|
|
||||||
// begin..end -> add 'writeln'
|
// begin..end -> add 'writeln'
|
||||||
@ -854,7 +854,31 @@ begin
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
ctnProcedure);
|
ctnProcedure);
|
||||||
NewItem.ParamList:='various';
|
NewItem.ParamList:='Args : Arguments';
|
||||||
|
CurrentIdentifierList.Add(NewItem);
|
||||||
|
|
||||||
|
// begin..end -> add 'read'
|
||||||
|
NewItem:=TIdentifierListItem.Create(
|
||||||
|
icompUnknown,
|
||||||
|
false,
|
||||||
|
3,
|
||||||
|
'Read',
|
||||||
|
StatementLevel,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
|
ctnProcedure);
|
||||||
|
CurrentIdentifierList.Add(NewItem);
|
||||||
|
|
||||||
|
// begin..end -> add 'readln'
|
||||||
|
NewItem:=TIdentifierListItem.Create(
|
||||||
|
icompUnknown,
|
||||||
|
false,
|
||||||
|
3,
|
||||||
|
'ReadLn',
|
||||||
|
StatementLevel,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
|
ctnProcedure);
|
||||||
CurrentIdentifierList.Add(NewItem);
|
CurrentIdentifierList.Add(NewItem);
|
||||||
|
|
||||||
if Context.Tool.NodeIsInAMethod(Context.Node)
|
if Context.Tool.NodeIsInAMethod(Context.Node)
|
||||||
|
13
ide/main.pp
13
ide/main.pp
@ -3653,7 +3653,7 @@ begin
|
|||||||
SaveAsFileExt:=PascalExtension[EnvironmentOptions.PascalFileExtension]
|
SaveAsFileExt:=PascalExtension[EnvironmentOptions.PascalFileExtension]
|
||||||
else
|
else
|
||||||
SaveAsFileExt:=EditorOpts.HighlighterList.GetDefaultFilextension(
|
SaveAsFileExt:=EditorOpts.HighlighterList.GetDefaultFilextension(
|
||||||
SrcEdit.SyntaxHighlighterType);
|
SrcEdit.SyntaxHighlighterType);
|
||||||
end;
|
end;
|
||||||
AnUnitInfo.ReadUnitNameFromSource(true);
|
AnUnitInfo.ReadUnitNameFromSource(true);
|
||||||
SaveAsFilename:=AnUnitInfo.UnitName;
|
SaveAsFilename:=AnUnitInfo.UnitName;
|
||||||
@ -4267,14 +4267,11 @@ begin
|
|||||||
|
|
||||||
// change syntax highlighter
|
// change syntax highlighter
|
||||||
if not AnUnitInfo.CustomHighlighter then begin
|
if not AnUnitInfo.CustomHighlighter then begin
|
||||||
NewHighlighter:=
|
AnUnitInfo.SyntaxHighlighter:=
|
||||||
ExtensionToLazSyntaxHighlighter(ExtractFileExt(NewFilename));
|
ExtensionToLazSyntaxHighlighter(ExtractFileExt(NewFilename));
|
||||||
if NewHighlighter<>AnUnitInfo.SyntaxHighlighter then begin
|
|
||||||
AnUnitInfo.SyntaxHighlighter:=NewHighlighter;
|
|
||||||
if SrcEdit<>nil then
|
|
||||||
SrcEdit.SyntaxHighlighterType:=AnUnitInfo.SyntaxHighlighter;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
if (SrcEdit<>nil) then
|
||||||
|
SrcEdit.SyntaxHighlighterType:=AnUnitInfo.SyntaxHighlighter;
|
||||||
|
|
||||||
// save file
|
// save file
|
||||||
Result:=DoSaveCodeBufferToFile(NewSource,NewSource.Filename,
|
Result:=DoSaveCodeBufferToFile(NewSource,NewSource.Filename,
|
||||||
|
@ -182,7 +182,7 @@ type
|
|||||||
var Special: boolean; var FG, BG: TColor);
|
var Special: boolean; var FG, BG: TColor);
|
||||||
Function RefreshEditorSettings: Boolean;
|
Function RefreshEditorSettings: Boolean;
|
||||||
procedure SetSyntaxHighlighterType(
|
procedure SetSyntaxHighlighterType(
|
||||||
ASyntaxHighlighterType: TLazSyntaxHighlighter);
|
ASyntaxHighlighterType: TLazSyntaxHighlighter);
|
||||||
procedure SetErrorLine(NewLine: integer);
|
procedure SetErrorLine(NewLine: integer);
|
||||||
procedure SetExecutionLine(NewLine: integer);
|
procedure SetExecutionLine(NewLine: integer);
|
||||||
procedure OnCodeBufferChanged(Sender: TSourceLog;
|
procedure OnCodeBufferChanged(Sender: TSourceLog;
|
||||||
@ -469,6 +469,7 @@ type
|
|||||||
|
|
||||||
// PopupMenu
|
// PopupMenu
|
||||||
procedure BuildPopupMenu;
|
procedure BuildPopupMenu;
|
||||||
|
procedure UpdateHighlightMenuItems;
|
||||||
procedure RemoveUserDefinedMenuItems;
|
procedure RemoveUserDefinedMenuItems;
|
||||||
function AddUserDefinedPopupMenuItem(const NewCaption: string;
|
function AddUserDefinedPopupMenuItem(const NewCaption: string;
|
||||||
const NewEnabled: boolean;
|
const NewEnabled: boolean;
|
||||||
@ -886,6 +887,7 @@ begin
|
|||||||
uemShowUnitInfo);
|
uemShowUnitInfo);
|
||||||
SrcEditMenuEditorProperties:=RegisterIDEMenuCommand(SubPath,
|
SrcEditMenuEditorProperties:=RegisterIDEMenuCommand(SubPath,
|
||||||
'EditorProperties',uemEditorProperties);
|
'EditorProperties',uemEditorProperties);
|
||||||
|
SrcEditMenuSectionHighlighter:=RegisterIDEMenuSection(SubPath,'Highlighter');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TSourceEditor }
|
{ TSourceEditor }
|
||||||
@ -1836,7 +1838,6 @@ end;
|
|||||||
|
|
||||||
procedure TSourceEditor.SetErrorLine(NewLine: integer);
|
procedure TSourceEditor.SetErrorLine(NewLine: integer);
|
||||||
begin
|
begin
|
||||||
//writeln('[TSourceEditor.SetErrorLine] ',NewLine,',',fErrorLine);
|
|
||||||
if fErrorLine=NewLine then exit;
|
if fErrorLine=NewLine then exit;
|
||||||
fErrorLine:=NewLine;
|
fErrorLine:=NewLine;
|
||||||
fErrorColumn:=EditorComponent.CaretX;
|
fErrorColumn:=EditorComponent.CaretX;
|
||||||
@ -3436,9 +3437,10 @@ begin
|
|||||||
if ASrcEdit=nil then exit;
|
if ASrcEdit=nil then exit;
|
||||||
EditorComp:=ASrcEdit.EditorComponent;
|
EditorComp:=ASrcEdit.EditorComponent;
|
||||||
|
|
||||||
// readonly
|
// Readonly, ShowLineNumbers
|
||||||
SrcEditMenuReadOnly.MenuItem.Checked:=ASrcEdit.ReadOnly;
|
SrcEditMenuReadOnly.MenuItem.Checked:=ASrcEdit.ReadOnly;
|
||||||
SrcEditMenuShowLineNumbers.MenuItem.Checked:=EditorComp.Gutter.ShowLineNumbers;
|
SrcEditMenuShowLineNumbers.MenuItem.Checked:=EditorComp.Gutter.ShowLineNumbers;
|
||||||
|
UpdateHighlightMenuItems;
|
||||||
|
|
||||||
// bookmarks
|
// bookmarks
|
||||||
for BookMarkID:=0 to 9 do begin
|
for BookMarkID:=0 to 9 do begin
|
||||||
@ -3615,6 +3617,18 @@ begin
|
|||||||
SrcEditMenuEditorProperties.OnClick:=@EditorPropertiesClicked;
|
SrcEditMenuEditorProperties.OnClick:=@EditorPropertiesClicked;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSourceNotebook.UpdateHighlightMenuItems;
|
||||||
|
var
|
||||||
|
h: TLazSyntaxHighlighter;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
i:=0;
|
||||||
|
for h:=Low(TLazSyntaxHighlighter) to High(TLazSyntaxHighlighter) do begin
|
||||||
|
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSourceNotebook.RemoveUserDefinedMenuItems;
|
procedure TSourceNotebook.RemoveUserDefinedMenuItems;
|
||||||
begin
|
begin
|
||||||
SrcEditMenuSectionFirstDynamic.Clear;
|
SrcEditMenuSectionFirstDynamic.Clear;
|
||||||
|
@ -364,8 +364,10 @@ var
|
|||||||
SrcEditSubMenuGotoBookmarks: TIDEMenuSection;
|
SrcEditSubMenuGotoBookmarks: TIDEMenuSection;
|
||||||
// Source Editor: Set Bookmarks Submenu
|
// Source Editor: Set Bookmarks Submenu
|
||||||
SrcEditSubMenuSetBookmarks: TIDEMenuSection;
|
SrcEditSubMenuSetBookmarks: TIDEMenuSection;
|
||||||
// Source Editor: Flags section
|
// Source Editor: Flags and options section
|
||||||
SrcEditMenuSectionFlags: TIDEMenuSection;
|
SrcEditMenuSectionFlags: TIDEMenuSection;
|
||||||
|
// Source Editor: Highlighter section
|
||||||
|
SrcEditMenuSectionHighlighter: TIDEMenuSection;
|
||||||
// Source Editor: Debug submenu
|
// Source Editor: Debug submenu
|
||||||
SrcEditSubMenuDebug: TIDEMenuSection;
|
SrcEditSubMenuDebug: TIDEMenuSection;
|
||||||
// Source Editor: Move Page section
|
// Source Editor: Move Page section
|
||||||
|
Loading…
Reference in New Issue
Block a user