SourceEditor: Formatting, more compact case..of blocks.

git-svn-id: trunk@54467 -
This commit is contained in:
juha 2017-03-22 17:17:28 +00:00
parent 01671e3da7
commit 175567bccd

View File

@ -1408,7 +1408,8 @@ begin
end; end;
function dbgs(AFlags: TSourceNotebookUpdateFlags): string; overload; function dbgs(AFlags: TSourceNotebookUpdateFlags): string; overload;
var i: TSourceNotebookUpdateFlag; var
i: TSourceNotebookUpdateFlag;
begin begin
Result := ''; Result := '';
for i := low(TSourceNotebookUpdateFlags) to high(TSourceNotebookUpdateFlags) do for i := low(TSourceNotebookUpdateFlags) to high(TSourceNotebookUpdateFlags) do
@ -1465,59 +1466,55 @@ begin
{$IFnDEF SingleSrcWindow} {$IFnDEF SingleSrcWindow}
// Lock Editor // Lock Editor
SrcEditMenuEditorLock := RegisterIDEMenuCommand SrcEditMenuEditorLock := RegisterIDEMenuCommand(AParent,
(AParent, 'LockEditor', uemLockPage, nil, @ExecuteIdeMenuClick); 'LockEditor', uemLockPage, nil, @ExecuteIdeMenuClick);
SrcEditMenuEditorLock.ShowAlwaysCheckable := True; SrcEditMenuEditorLock.ShowAlwaysCheckable := True;
// Move to other Window // Move to other Window
SrcEditMenuMoveToNewWindow := RegisterIDEMenuCommand SrcEditMenuMoveToNewWindow := RegisterIDEMenuCommand(AParent,
(AParent, 'MoveToNewWindow', uemMoveToNewWindow, nil, @ExecuteIdeMenuClick); 'MoveToNewWindow', uemMoveToNewWindow, nil, @ExecuteIdeMenuClick);
{%region * Move To Other *} {%region * Move To Other *}
SrcEditMenuMoveToOtherWindow := RegisterIDESubMenu SrcEditMenuMoveToOtherWindow := RegisterIDESubMenu(AParent,
(AParent, 'MoveToOtherWindow', uemMoveToOtherWindow); 'MoveToOtherWindow', uemMoveToOtherWindow);
SrcEditMenuMoveToOtherWindowNew := RegisterIDEMenuCommand(SrcEditMenuMoveToOtherWindow,
SrcEditMenuMoveToOtherWindowNew := RegisterIDEMenuCommand 'MoveToOtherWindowNew', uemMoveToOtherWindowNew, nil, @ExecuteIdeMenuClick);
(SrcEditMenuMoveToOtherWindow, 'MoveToOtherWindowNew', uemMoveToOtherWindowNew,
nil, @ExecuteIdeMenuClick);
// Section for dynamically created targets // Section for dynamically created targets
SrcEditMenuMoveToOtherWindowList := RegisterIDEMenuSection SrcEditMenuMoveToOtherWindowList := RegisterIDEMenuSection(SrcEditMenuMoveToOtherWindow,
(SrcEditMenuMoveToOtherWindow, 'MoveToOtherWindowList Section'); 'MoveToOtherWindowList Section');
{%endregion} {%endregion}
SrcEditMenuCopyToNewWindow := RegisterIDEMenuCommand SrcEditMenuCopyToNewWindow := RegisterIDEMenuCommand(AParent,
(AParent, 'CopyToNewWindow', uemCopyToNewWindow, nil, @ExecuteIdeMenuClick); 'CopyToNewWindow', uemCopyToNewWindow, nil, @ExecuteIdeMenuClick);
{%region * Copy To Other *} {%region * Copy To Other *}
SrcEditMenuCopyToOtherWindow := RegisterIDESubMenu SrcEditMenuCopyToOtherWindow := RegisterIDESubMenu(AParent,
(AParent, 'CopyToOtherWindow', uemCopyToOtherWindow); 'CopyToOtherWindow', uemCopyToOtherWindow);
SrcEditMenuCopyToOtherWindowNew := RegisterIDEMenuCommand(SrcEditMenuCopyToOtherWindow,
SrcEditMenuCopyToOtherWindowNew := RegisterIDEMenuCommand 'CopyToOtherWindowNew', uemCopyToOtherWindowNew, nil, @ExecuteIdeMenuClick);
(SrcEditMenuCopyToOtherWindow, 'CopyToOtherWindowNew', uemCopyToOtherWindowNew,
nil, @ExecuteIdeMenuClick);
// Section for dynamically created targets // Section for dynamically created targets
SrcEditMenuCopyToOtherWindowList := RegisterIDEMenuSection SrcEditMenuCopyToOtherWindowList := RegisterIDEMenuSection(SrcEditMenuCopyToOtherWindow,
(SrcEditMenuCopyToOtherWindow, 'CopyToOtherWindowList Section'); 'CopyToOtherWindowList Section');
{%endregion} {%endregion}
SrcEditMenuFindInOtherWindow := RegisterIDESubMenu SrcEditMenuFindInOtherWindow := RegisterIDESubMenu(AParent,
(AParent, 'FindInOtherWindow', uemFindInOtherWindow); 'FindInOtherWindow', uemFindInOtherWindow);
// Section for dynamically created targets // Section for dynamically created targets
SrcEditMenuFindInOtherWindowList := RegisterIDEMenuSection SrcEditMenuFindInOtherWindowList := RegisterIDEMenuSection(SrcEditMenuFindInOtherWindow,
(SrcEditMenuFindInOtherWindow, 'FindInOtherWindowList Section'); 'FindInOtherWindowList Section');
{$ENDIF} {$ENDIF}
{%region * Move Page (left/right) *} {%region * Move Page (left/right) *}
SrcEditSubMenuMovePage:=RegisterIDESubMenu(AParent, 'Move Page', lisMovePage); SrcEditSubMenuMovePage:=RegisterIDESubMenu(AParent, 'Move Page', lisMovePage);
AParent:=SrcEditSubMenuMovePage; AParent:=SrcEditSubMenuMovePage;
SrcEditMenuMoveEditorLeft := RegisterIDEMenuCommand SrcEditMenuMoveEditorLeft := RegisterIDEMenuCommand(AParent,
(AParent,'MoveEditorLeft', uemMovePageLeft, nil, @ExecuteIdeMenuClick); 'MoveEditorLeft', uemMovePageLeft, nil, @ExecuteIdeMenuClick);
SrcEditMenuMoveEditorRight := RegisterIDEMenuCommand SrcEditMenuMoveEditorRight := RegisterIDEMenuCommand(AParent,
(AParent,'MoveEditorRight', uemMovePageRight, nil, @ExecuteIdeMenuClick); 'MoveEditorRight', uemMovePageRight, nil, @ExecuteIdeMenuClick);
SrcEditMenuMoveEditorFirst := RegisterIDEMenuCommand SrcEditMenuMoveEditorFirst := RegisterIDEMenuCommand(AParent,
(AParent,'MoveEditorLeftmost', uemMovePageLeftmost, nil, @ExecuteIdeMenuClick); 'MoveEditorLeftmost', uemMovePageLeftmost, nil, @ExecuteIdeMenuClick);
SrcEditMenuMoveEditorLast := RegisterIDEMenuCommand SrcEditMenuMoveEditorLast := RegisterIDEMenuCommand(AParent,
(AParent,'MoveEditorRightmost', uemMovePageRightmost, nil, @ExecuteIdeMenuClick); 'MoveEditorRightmost', uemMovePageRightmost, nil, @ExecuteIdeMenuClick);
{%endregion} {%endregion}
{%endregion} {%endregion}
@ -1549,23 +1546,24 @@ begin
SrcEditSubMenuFind := RegisterIDESubMenu(AParent, 'Find section', lisMenuFind); SrcEditSubMenuFind := RegisterIDESubMenu(AParent, 'Find section', lisMenuFind);
AParent:=SrcEditSubMenuFind; AParent:=SrcEditSubMenuFind;
SrcEditMenuProcedureJump := RegisterIDEMenuCommand SrcEditMenuProcedureJump := RegisterIDEMenuCommand(AParent,
(AParent,'Procedure Jump', uemProcedureJump, nil, @ExecuteIdeMenuClick); 'Procedure Jump', uemProcedureJump, nil,
SrcEditMenuFindNextWordOccurrence := RegisterIDEMenuCommand @ExecuteIdeMenuClick);
(AParent, 'Find next word occurrence', srkmecFindNextWordOccurrence, SrcEditMenuFindNextWordOccurrence := RegisterIDEMenuCommand(AParent,
nil, @ExecuteIdeMenuClick, nil, 'menu_search_find_next'); 'Find next word occurrence', srkmecFindNextWordOccurrence, nil,
SrcEditMenuFindPrevWordOccurrence := RegisterIDEMenuCommand @ExecuteIdeMenuClick, nil, 'menu_search_find_next');
(AParent, 'Find previous word occurrence', srkmecFindPrevWordOccurrence, SrcEditMenuFindPrevWordOccurrence := RegisterIDEMenuCommand(AParent,
nil, @ExecuteIdeMenuClick, nil, 'menu_search_find_previous'); 'Find previous word occurrence', srkmecFindPrevWordOccurrence, nil,
SrcEditMenuFindInFiles := RegisterIDEMenuCommand @ExecuteIdeMenuClick, nil, 'menu_search_find_previous');
(AParent, 'Find in files', srkmecFindInFiles + ' ...', nil, SrcEditMenuFindInFiles := RegisterIDEMenuCommand(AParent,
@ExecuteIdeMenuClick, nil, 'menu_search_files'); 'Find in files', srkmecFindInFiles + ' ...', nil,
SrcEditMenuFindIdentifierReferences := RegisterIDEMenuCommand @ExecuteIdeMenuClick, nil, 'menu_search_files');
(AParent, 'FindIdentifierReferences',lisMenuFindIdentifierRefs, nil, SrcEditMenuFindIdentifierReferences := RegisterIDEMenuCommand(AParent,
'FindIdentifierReferences',lisMenuFindIdentifierRefs, nil,
@ExecuteIdeMenuClick);
SrcEditMenuFindUsedUnitReferences := RegisterIDEMenuCommand(AParent,
'FindUsedUnitReferences', lisMenuFindReferencesOfUsedUnit, nil,
@ExecuteIdeMenuClick); @ExecuteIdeMenuClick);
SrcEditMenuFindUsedUnitReferences := RegisterIDEMenuCommand
(AParent, 'FindUsedUnitReferences', lisMenuFindReferencesOfUsedUnit,
nil, @ExecuteIdeMenuClick);
{%endregion} {%endregion}
{%endregion} {%endregion}
@ -1618,27 +1616,27 @@ begin
for I := 0 to 9 do for I := 0 to 9 do
RegisterIDEMenuCommand(AParent,'GotoBookmark'+IntToStr(I), RegisterIDEMenuCommand(AParent,'GotoBookmark'+IntToStr(I),
uemBookmarkN+IntToStr(I), nil, @ExecuteIdeMenuClick, nil, 'bookmark'+IntToStr(I)); uemBookmarkN+IntToStr(I), nil, @ExecuteIdeMenuClick, nil, 'bookmark'+IntToStr(I));
SrcEditMenuNextBookmark:=RegisterIDEMenuCommand SrcEditMenuNextBookmark:=RegisterIDEMenuCommand(AParent,
(AParent, 'Goto next Bookmark',uemNextBookmark, nil, 'Goto next Bookmark',uemNextBookmark, nil,
@ExecuteIdeMenuClick, nil, 'menu_search_next_bookmark'); @ExecuteIdeMenuClick, nil, 'menu_search_next_bookmark');
SrcEditMenuPrevBookmark:=RegisterIDEMenuCommand SrcEditMenuPrevBookmark:=RegisterIDEMenuCommand(AParent,
(AParent, 'Goto previous Bookmark',uemPrevBookmark, nil, 'Goto previous Bookmark',uemPrevBookmark, nil,
@ExecuteIdeMenuClick, nil, 'menu_search_previous_bookmark'); @ExecuteIdeMenuClick, nil, 'menu_search_previous_bookmark');
{%endregion} {%endregion}
{%region *** Toggle Bookmarks Submenu ***} {%region *** Toggle Bookmarks Submenu ***}
SrcEditSubMenuToggleBookmarks:=RegisterIDESubMenu SrcEditSubMenuToggleBookmarks:=RegisterIDESubMenu(SrcEditMenuSectionMarks,
(SrcEditMenuSectionMarks, 'Toggle bookmarks',uemToggleBookmark); 'Toggle bookmarks',uemToggleBookmark);
AParent:=SrcEditSubMenuToggleBookmarks; AParent:=SrcEditSubMenuToggleBookmarks;
for I := 0 to 9 do for I := 0 to 9 do
RegisterIDEMenuCommand(AParent, 'ToggleBookmark'+IntToStr(I), RegisterIDEMenuCommand(AParent, 'ToggleBookmark'+IntToStr(I),
uemBookmarkN+IntToStr(I), nil, @ExecuteIdeMenuClick, nil, 'bookmark'+IntToStr(I)); uemBookmarkN+IntToStr(I), nil, @ExecuteIdeMenuClick, nil, 'bookmark'+IntToStr(I));
SrcEditMenuSetFreeBookmark:=RegisterIDEMenuCommand SrcEditMenuSetFreeBookmark:=RegisterIDEMenuCommand(AParent,
(AParent, 'Set a free Bookmark',uemSetFreeBookmark, nil, @ExecuteIdeMenuClick); 'Set a free Bookmark',uemSetFreeBookmark, nil, @ExecuteIdeMenuClick);
SrcEditMenuClearFileBookmark:=RegisterIDEMenuCommand SrcEditMenuClearFileBookmark:=RegisterIDEMenuCommand(AParent,
(AParent, 'Clear Bookmark for current file',srkmecClearBookmarkForFile, nil, @ExecuteIdeMenuClick); 'Clear Bookmark for current file',srkmecClearBookmarkForFile, nil, @ExecuteIdeMenuClick);
SrcEditMenuClearAllBookmark:=RegisterIDEMenuCommand SrcEditMenuClearAllBookmark:=RegisterIDEMenuCommand(AParent,
(AParent, 'Clear all Bookmark',srkmecClearAllBookmark, nil, @ExecuteIdeMenuClick); 'Clear all Bookmark',srkmecClearAllBookmark, nil, @ExecuteIdeMenuClick);
{%endregion} {%endregion}
{%region *** Debug Section ***} {%region *** Debug Section ***}
@ -1650,63 +1648,63 @@ begin
AParent:=SrcEditSubMenuDebug; AParent:=SrcEditSubMenuDebug;
// register the Debug submenu items // register the Debug submenu items
SrcEditMenuToggleBreakpoint:=RegisterIDEMenuCommand SrcEditMenuToggleBreakpoint:=RegisterIDEMenuCommand(AParent,
(AParent,'Toggle Breakpoint', uemToggleBreakpoint, nil, @ExecuteIdeMenuClick); 'Toggle Breakpoint', uemToggleBreakpoint, nil, @ExecuteIdeMenuClick);
SrcEditMenuEvaluateModify:=RegisterIDEMenuCommand SrcEditMenuEvaluateModify:=RegisterIDEMenuCommand(AParent,
(AParent,'Evaluate/Modify...', uemEvaluateModify, nil, nil, nil,'debugger_modify'); 'Evaluate/Modify...', uemEvaluateModify, nil, nil, nil, 'debugger_modify');
SrcEditMenuEvaluateModify.Enabled:=False; SrcEditMenuEvaluateModify.Enabled:=False;
SrcEditMenuAddWatchAtCursor:=RegisterIDEMenuCommand SrcEditMenuAddWatchAtCursor:=RegisterIDEMenuCommand(AParent,
(AParent, 'Add Watch at Cursor',uemAddWatchAtCursor); 'Add Watch at Cursor', uemAddWatchAtCursor);
SrcEditMenuAddWatchPointAtCursor:=RegisterIDEMenuCommand SrcEditMenuAddWatchPointAtCursor:=RegisterIDEMenuCommand(AParent,
(AParent, 'Add Watch at Cursor',uemAddWatchPointAtCursor); 'Add Watch at Cursor', uemAddWatchPointAtCursor);
SrcEditMenuInspect:=RegisterIDEMenuCommand SrcEditMenuInspect:=RegisterIDEMenuCommand(AParent,
(AParent, 'Inspect...', uemInspect, nil, nil, nil, 'debugger_inspect'); 'Inspect...', uemInspect, nil, nil, nil, 'debugger_inspect');
SrcEditMenuInspect.Enabled:=False; SrcEditMenuInspect.Enabled:=False;
SrcEditMenuRunToCursor:=RegisterIDEMenuCommand SrcEditMenuRunToCursor:=RegisterIDEMenuCommand(AParent,
(AParent, 'Run to cursor', uemRunToCursor, nil, nil, nil, 'menu_run_cursor'); 'Run to cursor', uemRunToCursor, nil, nil, nil, 'menu_run_cursor');
SrcEditMenuViewCallStack:=RegisterIDEMenuCommand SrcEditMenuViewCallStack:=RegisterIDEMenuCommand(AParent,
(AParent, 'View Call Stack', uemViewCallStack, nil, @ExecuteIdeMenuClick, nil, 'debugger_call_stack'); 'View Call Stack', uemViewCallStack, nil, @ExecuteIdeMenuClick, nil, 'debugger_call_stack');
{%endregion} {%endregion}
{%region *** Source Section ***} {%region *** Source Section ***}
SrcEditSubMenuSource:=RegisterIDESubMenu(SourceEditorMenuRoot, SrcEditSubMenuSource:=RegisterIDESubMenu(SourceEditorMenuRoot,
'Source',uemSource); 'Source',uemSource);
AParent:=SrcEditSubMenuSource; AParent:=SrcEditSubMenuSource;
SrcEditMenuEncloseSelection := RegisterIDEMenuCommand SrcEditMenuEncloseSelection := RegisterIDEMenuCommand(AParent,
(AParent, 'EncloseSelection',lisMenuEncloseSelection); 'EncloseSelection', lisMenuEncloseSelection);
SrcEditMenuEncloseInIFDEF := RegisterIDEMenuCommand SrcEditMenuEncloseInIFDEF := RegisterIDEMenuCommand(AParent,
(AParent,'itmSourceEncloseInIFDEF',lisMenuEncloseInIFDEF); 'itmSourceEncloseInIFDEF', lisMenuEncloseInIFDEF);
SrcEditMenuCompleteCode := RegisterIDEMenuCommand SrcEditMenuCompleteCode := RegisterIDEMenuCommand(AParent,
(AParent,'CompleteCode', lisMenuCompleteCode, nil, @ExecuteIdeMenuClick); 'CompleteCode', lisMenuCompleteCode, nil, @ExecuteIdeMenuClick);
SrcEditMenuInvertAssignment := RegisterIDEMenuCommand SrcEditMenuInvertAssignment := RegisterIDEMenuCommand(AParent,
(AParent, 'InvertAssignment',uemInvertAssignment, nil, @ExecuteIdeMenuClick); 'InvertAssignment', uemInvertAssignment, nil, @ExecuteIdeMenuClick);
SrcEditMenuUseUnit := RegisterIDEMenuCommand SrcEditMenuUseUnit := RegisterIDEMenuCommand(AParent,
(AParent,'UseUnit', lisMenuUseUnit, nil, @ExecuteIdeMenuClick); 'UseUnit', lisMenuUseUnit, nil, @ExecuteIdeMenuClick);
SrcEditMenuShowUnitInfo := RegisterIDEMenuCommand SrcEditMenuShowUnitInfo := RegisterIDEMenuCommand(AParent,
(AParent,'ShowUnitInfo', lisMenuViewUnitInfo); 'ShowUnitInfo', lisMenuViewUnitInfo);
{%endregion} {%endregion}
{%region *** Refactoring Section ***} {%region *** Refactoring Section ***}
SrcEditSubMenuRefactor:=RegisterIDESubMenu(SourceEditorMenuRoot, SrcEditSubMenuRefactor:=RegisterIDESubMenu(SourceEditorMenuRoot,
'Refactoring',uemRefactor); 'Refactoring',uemRefactor);
AParent:=SrcEditSubMenuRefactor; AParent:=SrcEditSubMenuRefactor;
SrcEditMenuRenameIdentifier := RegisterIDEMenuCommand SrcEditMenuRenameIdentifier := RegisterIDEMenuCommand(AParent,
(AParent, 'RenameIdentifier',lisMenuRenameIdentifier, nil, @ExecuteIdeMenuClick); 'RenameIdentifier', lisMenuRenameIdentifier, nil, @ExecuteIdeMenuClick);
SrcEditMenuExtractProc := RegisterIDEMenuCommand SrcEditMenuExtractProc := RegisterIDEMenuCommand(AParent,
(AParent, 'ExtractProc',lisMenuExtractProc, nil, @ExecuteIdeMenuClick); 'ExtractProc', lisMenuExtractProc, nil, @ExecuteIdeMenuClick);
SrcEditMenuShowAbstractMethods := RegisterIDEMenuCommand SrcEditMenuShowAbstractMethods := RegisterIDEMenuCommand(AParent,
(AParent, 'ShowAbstractMethods',srkmecAbstractMethods, nil, @ExecuteIdeMenuClick); 'ShowAbstractMethods', srkmecAbstractMethods, nil, @ExecuteIdeMenuClick);
SrcEditMenuShowEmptyMethods := RegisterIDEMenuCommand SrcEditMenuShowEmptyMethods := RegisterIDEMenuCommand(AParent,
(AParent, 'ShowEmptyMethods', srkmecEmptyMethods, nil, @ExecuteIdeMenuClick); 'ShowEmptyMethods', srkmecEmptyMethods, nil, @ExecuteIdeMenuClick);
SrcEditMenuShowUnusedUnits := RegisterIDEMenuCommand SrcEditMenuShowUnusedUnits := RegisterIDEMenuCommand(AParent,
(AParent, 'ShowUnusedUnits', srkmecUnusedUnits, nil, @ExecuteIdeMenuClick); 'ShowUnusedUnits', srkmecUnusedUnits, nil, @ExecuteIdeMenuClick);
SrcEditMenuFindOverloads := RegisterIDEMenuCommand SrcEditMenuFindOverloads := RegisterIDEMenuCommand(AParent,
(AParent, 'FindOverloads', srkmecFindOverloadsCapt, nil, @ExecuteIdeMenuClick); 'FindOverloads', srkmecFindOverloadsCapt, nil, @ExecuteIdeMenuClick);
{$IFnDEF EnableFindOverloads} {$IFnDEF EnableFindOverloads}
SrcEditMenuFindOverloads.Visible:=false; SrcEditMenuFindOverloads.Visible:=false;
{$ENDIF} {$ENDIF}
SrcEditMenuMakeResourceString := RegisterIDEMenuCommand SrcEditMenuMakeResourceString := RegisterIDEMenuCommand(AParent,
(AParent, 'MakeResourceString', lisMenuMakeResourceString, nil, @ExecuteIdeMenuClick); 'MakeResourceString', lisMenuMakeResourceString, nil, @ExecuteIdeMenuClick);
{%endregion} {%endregion}
SrcEditMenuEditorProperties:=RegisterIDEMenuCommand(SourceEditorMenuRoot, SrcEditMenuEditorProperties:=RegisterIDEMenuCommand(SourceEditorMenuRoot,
@ -1814,8 +1812,7 @@ begin
end; end;
end; end;
procedure TBrowseEditorTabHistoryDialog.KeyUp(var Key: Word; Shift: TShiftState procedure TBrowseEditorTabHistoryDialog.KeyUp(var Key: Word; Shift: TShiftState);
);
begin begin
if Key = VK_CONTROL then if Key = VK_CONTROL then
begin begin
@ -1935,8 +1932,7 @@ begin
FAutoHideHintTimer.Enabled := AAutoShown; FAutoHideHintTimer.Enabled := AAutoShown;
end; end;
constructor TSourceEditorHintWindowManager.Create(AManager: TSourceEditorManager constructor TSourceEditorHintWindowManager.Create(AManager: TSourceEditorManager);
);
begin begin
inherited Create; inherited Create;
@ -2344,8 +2340,7 @@ Begin
end; end;
function TSourceEditCompletion.OnSynCompletionPaintItem(const AKey: string; function TSourceEditCompletion.OnSynCompletionPaintItem(const AKey: string;
ACanvas: TCanvas; X, Y: integer; ItemSelected: boolean; Index: integer ACanvas: TCanvas; X, Y: integer; ItemSelected: boolean; Index: integer): boolean;
): boolean;
var var
MaxX: Integer; MaxX: Integer;
t: TCompletionType; t: TCompletionType;
@ -2691,8 +2686,7 @@ end;
{ TSourceEditorSharedValues } { TSourceEditorSharedValues }
function TSourceEditorSharedValues.GetSharedEditors(Index: Integer function TSourceEditorSharedValues.GetSharedEditors(Index: Integer): TSourceEditor;
): TSourceEditor;
begin begin
Result := TSourceEditor(FSharedEditorList[Index]); Result := TSourceEditor(FSharedEditorList[Index]);
end; end;
@ -3101,8 +3095,7 @@ begin
FMainLinkScanner:=nil; FMainLinkScanner:=nil;
end; end;
function TSourceEditorSharedValues.GetMainLinkScanner(Scan: boolean function TSourceEditorSharedValues.GetMainLinkScanner(Scan: boolean): TLinkScanner;
): TLinkScanner;
// Note: if this is an include file, the main scanner may change // Note: if this is an include file, the main scanner may change
var var
SrcEdit: TIDESynEditor; SrcEdit: TIDESynEditor;
@ -3836,168 +3829,63 @@ Begin
//debugln('TSourceEditor.ProcessUserCommand A ',dbgs(Command)); //debugln('TSourceEditor.ProcessUserCommand A ',dbgs(Command));
FSharedValues.SetActiveSharedEditor(Self); FSharedValues.SetActiveSharedEditor(Self);
Handled:=true; Handled:=true;
CheckActiveWindow; CheckActiveWindow;
case Command of case Command of
ecMultiPaste: ecMultiPaste: MultiPasteText;
MultiPasteText; ecContextHelp: FindHelpForSourceAtCursor;
ecSmartHint: ShowSmartHintForSourceAtCursor;
ecContextHelp: ecIdentCompletion: StartIdentCompletionBox(CodeToolsOpts.IdentComplJumpToError);
FindHelpForSourceAtCursor; ecShowCodeContext: SourceNotebook.StartShowCodeContext(CodeToolsOpts.IdentComplJumpToError);
ecWordCompletion: StartWordCompletionBox;
ecSmartHint: ecFind: StartFindAndReplace(false);
ShowSmartHintForSourceAtCursor; ecFindNext: FindNextUTF8;
ecFindPrevious: FindPrevious;
ecIdentCompletion : ecIncrementalFind: if FSourceNoteBook<>nil then FSourceNoteBook.BeginIncrementalFind;
StartIdentCompletionBox(CodeToolsOpts.IdentComplJumpToError); ecReplace: StartFindAndReplace(true);
ecGotoLineNumber: ShowGotoLineDialog;
ecShowCodeContext : ecFindNextWordOccurrence: FindNextWordOccurrence(true);
SourceNotebook.StartShowCodeContext(CodeToolsOpts.IdentComplJumpToError); ecFindPrevWordOccurrence: FindNextWordOccurrence(false);
ecSelectionEnclose: EncloseSelection;
ecWordCompletion : ecSelectionUpperCase: UpperCaseSelection;
StartWordCompletionBox; ecSelectionLowerCase: LowerCaseSelection;
ecSelectionSwapCase: SwapCaseSelection;
ecFind: ecSelectionTabs2Spaces: TabsToSpacesInSelection;
StartFindAndReplace(false); ecSelectionComment: CommentSelection;
ecSelectionUnComment: UncommentSelection;
ecFindNext: ecToggleComment: ToggleCommentSelection;
FindNextUTF8; ecSelectionEncloseIFDEF: ConditionalSelection;
ecSelectionSort: SortSelection;
ecFindPrevious: ecSelectionBreakLines: BreakLinesInSelection;
FindPrevious; ecInvertAssignment: InvertAssignment;
ecSelectToBrace: SelectToBrace;
ecIncrementalFind: ecSelectCodeBlock: SelectCodeBlock;
if FSourceNoteBook<>nil then FSourceNoteBook.BeginIncrementalFind; ecSelectLine: SelectLine;
ecSelectWord: SelectWord;
ecReplace: ecSelectParagraph: SelectParagraph;
StartFindAndReplace(true); ecInsertCharacter: InsertCharacterFromMap;
ecInsertGPLNotice: InsertGPLNotice(comtDefault,false);
ecGotoLineNumber : ecInsertGPLNoticeTranslated: InsertGPLNotice(comtDefault,true);
ShowGotoLineDialog; ecInsertLGPLNotice: InsertLGPLNotice(comtDefault,false);
ecInsertLGPLNoticeTranslated:InsertLGPLNotice(comtDefault,true);
ecFindNextWordOccurrence: ecInsertModifiedLGPLNotice: InsertModifiedLGPLNotice(comtDefault,false);
FindNextWordOccurrence(true); ecInsertModifiedLGPLNoticeTranslated: InsertModifiedLGPLNotice(comtDefault,true);
ecInsertMITNotice: InsertMITNotice(comtDefault,false);
ecFindPrevWordOccurrence: ecInsertMITNoticeTranslated: InsertMITNotice(comtDefault,true);
FindNextWordOccurrence(false); ecInsertUserName: InsertUsername;
ecInsertDateTime: InsertDateTime;
ecSelectionEnclose: ecInsertChangeLogEntry: InsertChangeLogEntry;
EncloseSelection; ecInsertCVSAuthor: InsertCVSKeyword('Author');
ecInsertCVSDate: InsertCVSKeyword('Date');
ecSelectionUpperCase: ecInsertCVSHeader: InsertCVSKeyword('Header');
UpperCaseSelection; ecInsertCVSID: InsertCVSKeyword('ID');
ecInsertCVSLog: InsertCVSKeyword('Log');
ecSelectionLowerCase: ecInsertCVSName: InsertCVSKeyword('Name');
LowerCaseSelection; ecInsertCVSRevision: InsertCVSKeyword('Revision');
ecInsertCVSSource: InsertCVSKeyword('Source');
ecSelectionSwapCase: ecInsertGUID: InsertGUID;
SwapCaseSelection; ecInsertFilename: InsertFilename;
ecLockEditor: IsLocked := not IsLocked;
ecSelectionTabs2Spaces:
TabsToSpacesInSelection;
ecSelectionComment:
CommentSelection;
ecSelectionUnComment:
UncommentSelection;
ecToggleComment:
ToggleCommentSelection;
ecSelectionEncloseIFDEF:
ConditionalSelection;
ecSelectionSort:
SortSelection;
ecSelectionBreakLines:
BreakLinesInSelection;
ecInvertAssignment:
InvertAssignment;
ecSelectToBrace:
SelectToBrace;
ecSelectCodeBlock:
SelectCodeBlock;
ecSelectLine:
SelectLine;
ecSelectWord:
SelectWord;
ecSelectParagraph:
SelectParagraph;
ecInsertCharacter:
InsertCharacterFromMap;
ecInsertGPLNotice:
InsertGPLNotice(comtDefault,false);
ecInsertGPLNoticeTranslated:
InsertGPLNotice(comtDefault,true);
ecInsertLGPLNotice:
InsertLGPLNotice(comtDefault,false);
ecInsertLGPLNoticeTranslated:
InsertLGPLNotice(comtDefault,true);
ecInsertModifiedLGPLNotice:
InsertModifiedLGPLNotice(comtDefault,false);
ecInsertModifiedLGPLNoticeTranslated:
InsertModifiedLGPLNotice(comtDefault,true);
ecInsertMITNotice:
InsertMITNotice(comtDefault,false);
ecInsertMITNoticeTranslated:
InsertMITNotice(comtDefault,true);
ecInsertUserName:
InsertUsername;
ecInsertDateTime:
InsertDateTime;
ecInsertChangeLogEntry:
InsertChangeLogEntry;
ecInsertCVSAuthor:
InsertCVSKeyword('Author');
ecInsertCVSDate:
InsertCVSKeyword('Date');
ecInsertCVSHeader:
InsertCVSKeyword('Header');
ecInsertCVSID:
InsertCVSKeyword('ID');
ecInsertCVSLog:
InsertCVSKeyword('Log');
ecInsertCVSName:
InsertCVSKeyword('Name');
ecInsertCVSRevision:
InsertCVSKeyword('Revision');
ecInsertCVSSource:
InsertCVSKeyword('Source');
ecInsertGUID:
InsertGUID;
ecInsertFilename:
InsertFilename;
ecLockEditor:
IsLocked := not IsLocked;
ecSynMacroPlay: begin ecSynMacroPlay: begin
If ActiveEditorMacro = EditorMacroForRecording then begin If ActiveEditorMacro = EditorMacroForRecording then begin
if EditorMacroForRecording.State = emRecording if EditorMacroForRecording.State = emRecording
@ -4010,7 +3898,6 @@ Begin
then then
SelectedEditorMacro.PlaybackMacro(FEditor); SelectedEditorMacro.PlaybackMacro(FEditor);
end; end;
ecSynMacroRecord: begin ecSynMacroRecord: begin
If ActiveEditorMacro = nil then If ActiveEditorMacro = nil then
EditorMacroForRecording.RecordMacro(FEditor) EditorMacroForRecording.RecordMacro(FEditor)
@ -4018,7 +3905,6 @@ Begin
If ActiveEditorMacro = EditorMacroForRecording then If ActiveEditorMacro = EditorMacroForRecording then
EditorMacroForRecording.Stop; EditorMacroForRecording.Stop;
end; end;
ecClearBookmarkForFile: begin ecClearBookmarkForFile: begin
if Assigned(Manager) and Assigned(Manager.OnClearBookmarkId) then if Assigned(Manager) and Assigned(Manager.OnClearBookmarkId) then
for i := 0 to 9 do for i := 0 to 9 do
@ -8383,8 +8269,7 @@ begin
CheckCurrentCodeBufferChanged; CheckCurrentCodeBufferChanged;
End; End;
function TSourceNotebook.FindPageWithEditor( function TSourceNotebook.FindPageWithEditor(ASourceEditor: TSourceEditor): integer;
ASourceEditor: TSourceEditor):integer;
var var
LParent: TWinControl; LParent: TWinControl;
LTabSheet: TWinControl; LTabSheet: TWinControl;
@ -8626,86 +8511,50 @@ begin
Handled:=true; Handled:=true;
case Command of case Command of
ecNextEditor: NextEditor;
ecNextEditor: ecPrevEditor: PrevEditor;
NextEditor; ecPrevEditorInHistory: FHistoryDlg.Show(True);
ecNextEditorInHistory: FHistoryDlg.Show(False);
ecPrevEditor : ecMoveEditorLeft: MoveActivePageLeft;
PrevEditor; ecMoveEditorRight: MoveActivePageRight;
ecMoveEditorLeftmost: MoveActivePageFirst;
ecPrevEditorInHistory : ecMoveEditorRightmost: MoveActivePageLast;
FHistoryDlg.Show(True); ecNextSharedEditor: GotoNextSharedEditor(False);
ecPrevSharedEditor: GotoNextSharedEditor(True);
ecNextEditorInHistory: ecNextWindow: GotoNextWindow(False);
FHistoryDlg.Show(False); ecPrevWindow: GotoNextWindow(True);
ecMoveEditorNextWindow: MoveEditorNextWindow(False, False);
ecMoveEditorLeft: ecMoveEditorPrevWindow: MoveEditorNextWindow(True, False);
MoveActivePageLeft;
ecMoveEditorRight:
MoveActivePageRight;
ecMoveEditorLeftmost:
MoveActivePageFirst;
ecMoveEditorRightmost:
MoveActivePageLast;
ecNextSharedEditor:
GotoNextSharedEditor(False);
ecPrevSharedEditor:
GotoNextSharedEditor(True);
ecNextWindow:
GotoNextWindow(False);
ecPrevWindow:
GotoNextWindow(True);
ecMoveEditorNextWindow:
MoveEditorNextWindow(False, False);
ecMoveEditorPrevWindow:
MoveEditorNextWindow(True, False);
ecMoveEditorNewWindow: ecMoveEditorNewWindow:
if EditorCount > 1 then if EditorCount > 1 then
MoveEditor(FindPageWithEditor(GetActiveSE), Manager.IndexOfSourceWindow(Manager.CreateNewWindow(True)), -1); MoveEditor(FindPageWithEditor(GetActiveSE),
ecCopyEditorNextWindow: Manager.IndexOfSourceWindow(Manager.CreateNewWindow(True)), -1);
MoveEditorNextWindow(False, True);
ecCopyEditorPrevWindow: ecCopyEditorNextWindow: MoveEditorNextWindow(False, True);
MoveEditorNextWindow(True, True); ecCopyEditorPrevWindow: MoveEditorNextWindow(True, True);
ecCopyEditorNewWindow: ecCopyEditorNewWindow:
CopyEditor(FindPageWithEditor(GetActiveSE), Manager.IndexOfSourceWindow(Manager.CreateNewWindow(True)), -1, True); CopyEditor(FindPageWithEditor(GetActiveSE),
Manager.IndexOfSourceWindow(Manager.CreateNewWindow(True)), -1, True);
ecOpenFileAtCursor:
OpenAtCursorClicked(self);
ecOpenFileAtCursor: OpenAtCursorClicked(self);
ecGotoEditor1..ecGotoEditor9,ecGotoEditor0: ecGotoEditor1..ecGotoEditor9,ecGotoEditor0:
if PageCount>Command-ecGotoEditor1 then if PageCount>Command-ecGotoEditor1 then
PageIndex := Command-ecGotoEditor1; PageIndex := Command-ecGotoEditor1;
ecToggleFormUnit: ecToggleFormUnit: ToggleFormUnitClicked(Self);
ToggleFormUnitClicked(Self); ecToggleObjectInsp: ToggleObjectInspClicked(Self);
ecToggleObjectInsp:
ToggleObjectInspClicked(Self);
ecSetFreeBookmark: ecSetFreeBookmark:
if Assigned(Manager.OnSetBookmark) then if Assigned(Manager.OnSetBookmark) then
Manager.OnSetBookmark(GetActiveSE, -1, False); Manager.OnSetBookmark(GetActiveSE, -1, False);
ecClearAllBookmark: ecClearAllBookmark:
if Assigned(Manager) and Assigned(Manager.OnClearBookmarkId) then if Assigned(Manager.OnClearBookmarkId) then
Manager.OnClearBookmarkId(Self, -1); Manager.OnClearBookmarkId(Self, -1);
ecJumpBack: ecJumpBack: Manager.HistoryJump(Self,jhaBack);
Manager.HistoryJump(Self,jhaBack); ecJumpForward: Manager.HistoryJump(Self,jhaForward);
ecAddJumpPoint: Manager.AddJumpPointClicked(Self);
ecJumpForward: ecViewJumpHistory: Manager.ViewJumpHistoryClicked(Self);
Manager.HistoryJump(Self,jhaForward);
ecAddJumpPoint:
Manager.AddJumpPointClicked(Self);
ecViewJumpHistory:
Manager.ViewJumpHistoryClicked(Self);
else else
Handled:=ExecuteIDECommand(Self,Command); Handled:=ExecuteIDECommand(Self,Command);
@ -8719,7 +8568,8 @@ procedure TSourceNotebook.ParentCommandProcessed(Sender: TObject;
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer; var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer;
var Handled: boolean); var Handled: boolean);
begin begin
if assigned(Manager) and Assigned(Manager.OnUserCommandProcessed) then begin Assert(Assigned(Manager), 'TSourceNotebook.ParentCommandProcessed: Manager=Nil.');
if Assigned(Manager.OnUserCommandProcessed) then begin
Handled:=false; Handled:=false;
Manager.OnUserCommandProcessed(Self,Command,Handled); Manager.OnUserCommandProcessed(Self,Command,Handled);
if Handled then exit; if Handled then exit;
@ -9050,7 +8900,8 @@ end;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
procedure InternalInit; procedure InternalInit;
var h: TLazSyntaxHighlighter; var
h: TLazSyntaxHighlighter;
begin begin
// fetch the resourcestrings before they are translated // fetch the resourcestrings before they are translated
EnglishGPLNotice:=lisGPLNotice; EnglishGPLNotice:=lisGPLNotice;
@ -9072,7 +8923,8 @@ begin
end; end;
procedure InternalFinal; procedure InternalFinal;
var h: TLazSyntaxHighlighter; var
h: TLazSyntaxHighlighter;
begin begin
for h:=Low(TLazSyntaxHighlighter) to High(TLazSyntaxHighlighter) do for h:=Low(TLazSyntaxHighlighter) to High(TLazSyntaxHighlighter) do
FreeThenNil(Highlighters[h]); FreeThenNil(Highlighters[h]);
@ -9223,8 +9075,7 @@ begin
Result := nil; Result := nil;
end; end;
function TSourceEditorManagerBase.GetUniqueSourceEditors(Index: integer function TSourceEditorManagerBase.GetUniqueSourceEditors(Index: integer): TSourceEditorInterface;
): TSourceEditorInterface;
var var
i: Integer; i: Integer;
begin begin
@ -9654,8 +9505,7 @@ procedure TSourceEditorManagerBase.InvalidateMarklingsOfAllFiles(
aProducer: TSourceMarklingProducer); aProducer: TSourceMarklingProducer);
var var
SrcWnd: TSourceEditorWindowInterface; SrcWnd: TSourceEditorWindowInterface;
i: Integer; i, j: Integer;
j: Integer;
SrcEdit: TSourceEditor; SrcEdit: TSourceEditor;
begin begin
if aProducer=nil then exit; if aProducer=nil then exit;
@ -9875,8 +9725,7 @@ begin
end; end;
end; end;
function TSourceEditorManager.SourceWindowWithPage(const APage: TTabSheet function TSourceEditorManager.SourceWindowWithPage(const APage: TTabSheet): TSourceNotebook;
): TSourceNotebook;
var var
i: Integer; i: Integer;
begin begin
@ -9968,7 +9817,6 @@ begin
Result := Result + SourceWindows[i].Count; Result := Result + SourceWindows[i].Count;
end; end;
function TSourceEditorManager.GetActiveSE: TSourceEditor; function TSourceEditorManager.GetActiveSE: TSourceEditor;
begin begin
Result := TSourceEditor(ActiveEditor); Result := TSourceEditor(ActiveEditor);
@ -10207,8 +10055,7 @@ begin
ActiveEditor.EditorControl.SetFocus; ActiveEditor.EditorControl.SetFocus;
end; end;
procedure TSourceEditorManager.JumpToProcedure( procedure TSourceEditorManager.JumpToProcedure(const JumpType: TJumpToProcedureType);
const JumpType: TJumpToProcedureType);
const const
cJumpNames: array[TJumpToProcedureType] of string = ( cJumpNames: array[TJumpToProcedureType] of string = (
'procedure header', 'procedure begin'); 'procedure header', 'procedure begin');
@ -10470,6 +10317,7 @@ procedure TSourceEditorManager.SetupShortCuts;
var var
i: Integer; i: Integer;
IDEmi: TIDEMenuItem;
begin begin
{%region *** first static section *** } {%region *** first static section *** }
SrcEditMenuFindDeclaration.Command := GetCommand(ecFindDeclaration); SrcEditMenuFindDeclaration.Command := GetCommand(ecFindDeclaration);
@ -10511,10 +10359,10 @@ begin
SrcEditMenuOpenFileAtCursor.Command := GetCommand(ecOpenFileAtCursor); SrcEditMenuOpenFileAtCursor.Command := GetCommand(ecOpenFileAtCursor);
{%region * sub menu Flags section *} {%region * sub menu Flags section *}
SrcEditMenuReadOnly.OnClick :=@ReadOnlyClicked; SrcEditMenuReadOnly.OnClick := @ReadOnlyClicked;
SrcEditMenuShowLineNumbers.OnClick :=@ToggleLineNumbersClicked; SrcEditMenuShowLineNumbers.OnClick := @ToggleLineNumbersClicked;
SrcEditMenuDisableI18NForLFM.OnClick :=@ToggleI18NForLFMClicked; SrcEditMenuDisableI18NForLFM.OnClick := @ToggleI18NForLFMClicked;
SrcEditMenuShowUnitInfo.OnClick :=@ShowUnitInfo; SrcEditMenuShowUnitInfo.OnClick := @ShowUnitInfo;
{%endregion} {%endregion}
{%region *** Clipboard section ***} {%region *** Clipboard section ***}
@ -10533,10 +10381,10 @@ begin
SrcEditMenuClearAllBookmark.Command:=GetCommand(ecClearAllBookmark); SrcEditMenuClearAllBookmark.Command:=GetCommand(ecClearAllBookmark);
for i:=0 to 9 do begin for i:=0 to 9 do begin
TIDEMenuCommand(SrcEditSubMenuGotoBookmarks.FindByName('GotoBookmark'+IntToStr(i))) IDEmi:=SrcEditSubMenuGotoBookmarks.FindByName('GotoBookmark'+IntToStr(i));
.Command := GetCommand(ecGotoMarker0 + i); IDEmi.Command := GetCommand(ecGotoMarker0 + i);
TIDEMenuCommand(SrcEditSubMenuToggleBookmarks.FindByName('ToggleBookmark'+IntToStr(i))) IDEmi:=SrcEditSubMenuToggleBookmarks.FindByName('ToggleBookmark'+IntToStr(i));
.Command := GetCommand(ecToggleMarker0 + i); IDEmi.Command := GetCommand(ecToggleMarker0 + i);
end; end;
{%region *** Source Section ***} {%region *** Source Section ***}
@ -10624,11 +10472,10 @@ end;
procedure TSourceEditorManager.OnIdle(Sender: TObject; var Done: Boolean); procedure TSourceEditorManager.OnIdle(Sender: TObject; var Done: Boolean);
var var
SrcEdit: TSourceEditor; SrcEdit: TSourceEditor;
i: Integer; i, j: Integer;
aFilename: String; aFilename: String;
FreeList, FreeMarklings: boolean; FreeList, FreeMarklings: boolean;
Marklings: TFPList; Marklings: TFPList;
j: Integer;
Markling: TSourceMarkling; Markling: TSourceMarkling;
begin begin
SrcEdit:=ActiveEditor; SrcEdit:=ActiveEditor;
@ -10839,7 +10686,8 @@ end;
procedure TSourceEditorManager.OnWordCompletionGetSource(var Source: TStrings; procedure TSourceEditorManager.OnWordCompletionGetSource(var Source: TStrings;
SourceIndex: integer); SourceIndex: integer);
var TempEditor: TSourceEditor; var
TempEditor: TSourceEditor;
i:integer; i:integer;
begin begin
TempEditor:=GetActiveSE; TempEditor:=GetActiveSE;