mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 16:40:54 +02:00
implemented diff dialog
git-svn-id: trunk@3055 -
This commit is contained in:
parent
9400a2b7fe
commit
9234059378
@ -49,7 +49,7 @@ uses
|
|||||||
Extctrls, Menus, FindInFilesDlg, LMessages, IDEProcs, IDEOptionDefs,
|
Extctrls, Menus, FindInFilesDlg, LMessages, IDEProcs, IDEOptionDefs,
|
||||||
InputHistory, LazarusIDEStrConsts, BaseDebugManager, Debugger, FileCtrl,
|
InputHistory, LazarusIDEStrConsts, BaseDebugManager, Debugger, FileCtrl,
|
||||||
LCLType, LCLLinux, TypInfo, LResources, LazConf, EnvironmentOpts,
|
LCLType, LCLLinux, TypInfo, LResources, LazConf, EnvironmentOpts,
|
||||||
SourceEditProcs, SortSelectionDlg, ClipBoardHistory;
|
SourceEditProcs, SortSelectionDlg, ClipBoardHistory, DiffDialog;
|
||||||
|
|
||||||
type
|
type
|
||||||
TSourceNoteBook = class;
|
TSourceNoteBook = class;
|
||||||
@ -228,6 +228,8 @@ type
|
|||||||
procedure RemoveBreakPoint(const ALine: Integer); overload;
|
procedure RemoveBreakPoint(const ALine: Integer); overload;
|
||||||
|
|
||||||
// selections
|
// selections
|
||||||
|
function SelectionAvailable: boolean;
|
||||||
|
function GetText(OnlySelection: boolean): string;
|
||||||
Procedure SelectText(LineNum,CharStart,LineNum2,CharEnd : Integer);
|
Procedure SelectText(LineNum,CharStart,LineNum2,CharEnd : Integer);
|
||||||
procedure ReplaceLines(StartLine, EndLine: integer; const NewText: string);
|
procedure ReplaceLines(StartLine, EndLine: integer; const NewText: string);
|
||||||
procedure UpperCaseSelection;
|
procedure UpperCaseSelection;
|
||||||
@ -250,15 +252,18 @@ type
|
|||||||
// editor commands
|
// editor commands
|
||||||
procedure DoEditorExecuteCommand(EditorCommand: integer);
|
procedure DoEditorExecuteCommand(EditorCommand: integer);
|
||||||
|
|
||||||
//used to get the word at the mouse cursor
|
// used to get the word at the mouse cursor
|
||||||
Function GetWordAtPosition(Position : TPoint) : String;
|
Function GetWordAtPosition(Position : TPoint) : String;
|
||||||
function GetWordFromCaret(const ACaretPos: TPoint) : String;
|
function GetWordFromCaret(const ACaretPos: TPoint) : String;
|
||||||
Function GetWordAtCurrentCaret: String;
|
Function GetWordAtCurrentCaret: String;
|
||||||
|
|
||||||
|
// cursor
|
||||||
Function GetCaretPosFromCursorPos(CursorPos : TPoint) : TPoint;
|
Function GetCaretPosFromCursorPos(CursorPos : TPoint) : TPoint;
|
||||||
procedure CenterCursor;
|
procedure CenterCursor;
|
||||||
|
|
||||||
|
// notebook
|
||||||
procedure Activate;
|
procedure Activate;
|
||||||
|
function PageIndex: integer;
|
||||||
public
|
public
|
||||||
// properties
|
// properties
|
||||||
property CodeBuffer: TCodeBuffer read FCodeBuffer write SetCodeBuffer;
|
property CodeBuffer: TCodeBuffer read FCodeBuffer write SetCodeBuffer;
|
||||||
@ -461,6 +466,9 @@ type
|
|||||||
procedure SetActiveSE(SrcEdit: TSourceEditor);
|
procedure SetActiveSE(SrcEdit: TSourceEditor);
|
||||||
procedure LockAllEditorsInSourceChangeCache;
|
procedure LockAllEditorsInSourceChangeCache;
|
||||||
procedure UnlockAllEditorsInSourceChangeCache;
|
procedure UnlockAllEditorsInSourceChangeCache;
|
||||||
|
function GetDiffFiles: TDiffFiles;
|
||||||
|
procedure GetText(PageIndex: integer; OnlySelection: boolean;
|
||||||
|
var Source: string);
|
||||||
|
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -488,13 +496,16 @@ type
|
|||||||
procedure FindInFilesClicked(Sender : TObject);
|
procedure FindInFilesClicked(Sender : TObject);
|
||||||
procedure ReplaceClicked(Sender : TObject);
|
procedure ReplaceClicked(Sender : TObject);
|
||||||
procedure IncrementalFindClicked(Sender : TObject);
|
procedure IncrementalFindClicked(Sender : TObject);
|
||||||
|
|
||||||
procedure GotoLineClicked(Sender: TObject);
|
procedure GotoLineClicked(Sender: TObject);
|
||||||
|
|
||||||
procedure HistoryJump(Sender: TObject; Action: TJumpHistoryAction);
|
procedure HistoryJump(Sender: TObject; Action: TJumpHistoryAction);
|
||||||
procedure JumpBackClicked(Sender: TObject);
|
procedure JumpBackClicked(Sender: TObject);
|
||||||
procedure JumpForwardClicked(Sender: TObject);
|
procedure JumpForwardClicked(Sender: TObject);
|
||||||
procedure AddJumpPointClicked(Sender: TObject);
|
procedure AddJumpPointClicked(Sender: TObject);
|
||||||
procedure DeleteLastJumpPointClicked(Sender: TObject);
|
procedure DeleteLastJumpPointClicked(Sender: TObject);
|
||||||
procedure ViewJumpHistoryClicked(Sender: TObject);
|
procedure ViewJumpHistoryClicked(Sender: TObject);
|
||||||
|
|
||||||
procedure ActivateHint(const ScreenPos: TPoint; const TheHint: string);
|
procedure ActivateHint(const ScreenPos: TPoint; const TheHint: string);
|
||||||
|
|
||||||
Procedure NewFile(const NewShortName: String; ASource : TCodeBuffer);
|
Procedure NewFile(const NewShortName: String; ASource : TCodeBuffer);
|
||||||
@ -1163,6 +1174,19 @@ begin
|
|||||||
RemoveBreakPoint(GetBreakPointMark(ALine));
|
RemoveBreakPoint(GetBreakPointMark(ALine));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSourceEditor.SelectionAvailable: boolean;
|
||||||
|
begin
|
||||||
|
Result:=CompareCaret(EditorComponent.BlockBegin,EditorComponent.BlockEnd)<>0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSourceEditor.GetText(OnlySelection: boolean): string;
|
||||||
|
begin
|
||||||
|
if OnlySelection then
|
||||||
|
Result:=EditorComponent.SelText
|
||||||
|
else
|
||||||
|
Result:=EditorComponent.Lines.Text;
|
||||||
|
end;
|
||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
{-------------------------------------------------------------------------------
|
||||||
method TSourceEditor.UpperCaseSelection
|
method TSourceEditor.UpperCaseSelection
|
||||||
|
|
||||||
@ -1861,6 +1885,11 @@ begin
|
|||||||
FSourceNoteBook.SetActiveSE(Self);
|
FSourceNoteBook.SetActiveSE(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSourceEditor.PageIndex: integer;
|
||||||
|
begin
|
||||||
|
Result:=FSourceNoteBook.FindPageWithEditor(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
Function TSourceEditor.GetWordAtCurrentCaret: String;
|
Function TSourceEditor.GetWordAtCurrentCaret: String;
|
||||||
var
|
var
|
||||||
CaretPos : TPoint;
|
CaretPos : TPoint;
|
||||||
@ -2959,6 +2988,31 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSourceNotebook.GetDiffFiles: TDiffFiles;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
SrcEdit: TSourceEditor;
|
||||||
|
begin
|
||||||
|
Result:=TDiffFiles.Create;
|
||||||
|
if Notebook=nil then exit;
|
||||||
|
for i:=0 to NoteBook.PageCount-1 do begin
|
||||||
|
SrcEdit:=FindSourceEditorWithPageIndex(i);
|
||||||
|
Result.Add(TDiffFile.Create(NoteBook.Pages[i],i,SrcEdit.SelectionAvailable));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSourceNotebook.GetText(PageIndex: integer; OnlySelection: boolean;
|
||||||
|
var Source: string);
|
||||||
|
var
|
||||||
|
SrcEdit: TSourceEditor;
|
||||||
|
begin
|
||||||
|
SrcEdit:=FindSourceEditorWithPageIndex(PageIndex);
|
||||||
|
if SrcEdit=nil then
|
||||||
|
Source:=''
|
||||||
|
else
|
||||||
|
Source:=SrcEdit.GetText(OnlySelection);
|
||||||
|
end;
|
||||||
|
|
||||||
Function TSourceNotebook.Empty : Boolean;
|
Function TSourceNotebook.Empty : Boolean;
|
||||||
Begin
|
Begin
|
||||||
Result := (not assigned(Notebook)) or (Notebook.PageCount = 0);
|
Result := (not assigned(Notebook)) or (Notebook.PageCount = 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user