mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-11-04 10:19:52 +01:00 
			
		
		
		
	IDE/SourceEditor/Packages: Using SourceEditorManager / Removed all references to single instance "var SourceNotebook" (for multi-window handling)
git-svn-id: trunk@24113 -
This commit is contained in:
		
							parent
							
								
									2105de444c
								
							
						
					
					
						commit
						9040201c83
					
				@ -43,10 +43,11 @@ const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
type
 | 
					type
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  { TEditorToolbar }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TEditorToolbar = class(TObject)
 | 
					  TEditorToolbar = class(TObject)
 | 
				
			||||||
  private
 | 
					  private
 | 
				
			||||||
    FJumpHandler: TJumpHandler;
 | 
					    FJumpHandler: TJumpHandler;
 | 
				
			||||||
    W: TForm;
 | 
					 | 
				
			||||||
    TB: TToolbar;
 | 
					    TB: TToolbar;
 | 
				
			||||||
    PM: TPopupMenu;
 | 
					    PM: TPopupMenu;
 | 
				
			||||||
    CfgButton: TToolButton;
 | 
					    CfgButton: TToolButton;
 | 
				
			||||||
@ -56,6 +57,7 @@ type
 | 
				
			|||||||
  protected
 | 
					  protected
 | 
				
			||||||
    procedure   AddButton(AMenuItem: TIDEMenuItem);
 | 
					    procedure   AddButton(AMenuItem: TIDEMenuItem);
 | 
				
			||||||
    procedure   PositionAtEnd(AToolbar: TToolbar; AButton: TToolButton);
 | 
					    procedure   PositionAtEnd(AToolbar: TToolbar; AButton: TToolButton);
 | 
				
			||||||
 | 
					    procedure   SourceWindowCreated(Sender: TObject);
 | 
				
			||||||
  public
 | 
					  public
 | 
				
			||||||
    constructor Create;
 | 
					    constructor Create;
 | 
				
			||||||
    destructor  Destroy; override;
 | 
					    destructor  Destroy; override;
 | 
				
			||||||
@ -137,27 +139,28 @@ begin
 | 
				
			|||||||
  inherited Destroy;
 | 
					  inherited Destroy;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
procedure TEditorToolbar.InitEditorToolBar;
 | 
					procedure TEditorToolbar.SourceWindowCreated(Sender: TObject);
 | 
				
			||||||
var
 | 
					var
 | 
				
			||||||
  T: TJumpType;
 | 
					  T: TJumpType;
 | 
				
			||||||
begin
 | 
					begin
 | 
				
			||||||
  if not Assigned(W) and Assigned(SourceEditorManagerIntf.ActiveSourceWindow) then
 | 
					  if assigned(TB) then exit; // TODO: handle multiply Windows
 | 
				
			||||||
  begin
 | 
					  CreateEditorToolBar(TSourceEditorWindowInterface(Sender), TB);
 | 
				
			||||||
    {$note Todo, hook SourceEditorManager to detect open/close forms}
 | 
					 | 
				
			||||||
    W := SourceEditorManagerIntf.ActiveSourceWindow; // TODO: each window
 | 
					 | 
				
			||||||
    TB := nil;
 | 
					 | 
				
			||||||
    CfgButton := nil;
 | 
					 | 
				
			||||||
    CreateEditorToolBar(W, TB);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    PM := TPopupMenu.Create(W);
 | 
					  PM := TPopupMenu.Create(TSourceEditorWindowInterface(Sender));
 | 
				
			||||||
    for T := Low(TJumpType) to High(TJumpType) do
 | 
					  for T := Low(TJumpType) to High(TJumpType) do
 | 
				
			||||||
      PM.Items.Add(CreateJumpItem(T,W));
 | 
					    PM.Items.Add(CreateJumpItem(T, TSourceEditorWindowInterface(Sender)));
 | 
				
			||||||
  end;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  AddStaticItems;
 | 
					  AddStaticItems;
 | 
				
			||||||
  AddCustomItems;
 | 
					  AddCustomItems;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					procedure TEditorToolbar.InitEditorToolBar;
 | 
				
			||||||
 | 
					begin
 | 
				
			||||||
 | 
					  TB := nil;
 | 
				
			||||||
 | 
					  CfgButton := nil;
 | 
				
			||||||
 | 
					  SourceEditorManagerIntf.RegisterChangeEvent(semWindowCreate, @SourceWindowCreated);
 | 
				
			||||||
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
procedure TEditorToolbar.AddButton(AMenuItem: TIDEMenuItem);
 | 
					procedure TEditorToolbar.AddButton(AMenuItem: TIDEMenuItem);
 | 
				
			||||||
var
 | 
					var
 | 
				
			||||||
  B: TToolButton;
 | 
					  B: TToolButton;
 | 
				
			||||||
 | 
				
			|||||||
@ -84,7 +84,7 @@ begin
 | 
				
			|||||||
  Result := Tool.CleanPosToCaretAndTopLine(Node.StartPos, NewCodePos,NewTopLine);
 | 
					  Result := Tool.CleanPosToCaretAndTopLine(Node.StartPos, NewCodePos,NewTopLine);
 | 
				
			||||||
  if Result then
 | 
					  if Result then
 | 
				
			||||||
    Result := LazarusIDE.DoOpenFileAndJumpToPos(NewCodePos.Code.Filename
 | 
					    Result := LazarusIDE.DoOpenFileAndJumpToPos(NewCodePos.Code.Filename
 | 
				
			||||||
        ,Point(NewCodePos.X,NewCodePos.Y), NewTopLine, -1
 | 
					        ,Point(NewCodePos.X,NewCodePos.Y), NewTopLine, -1,-1
 | 
				
			||||||
        ,[ofRegularFile,ofUseCache]) = mrOk;
 | 
					        ,[ofRegularFile,ofUseCache]) = mrOk;
 | 
				
			||||||
  if Result then
 | 
					  if Result then
 | 
				
			||||||
  begin
 | 
					  begin
 | 
				
			||||||
 | 
				
			|||||||
@ -111,7 +111,7 @@ var
 | 
				
			|||||||
begin
 | 
					begin
 | 
				
			||||||
  // Set up as desired. Maybe create config settings;
 | 
					  // Set up as desired. Maybe create config settings;
 | 
				
			||||||
  Flags := [ofOnlyIfExists, ofAddToRecent, ofUseCache];
 | 
					  Flags := [ofOnlyIfExists, ofAddToRecent, ofUseCache];
 | 
				
			||||||
  LazarusIDE.DoOpenEditorFile(AFileName, 0, Flags);
 | 
					  LazarusIDE.DoOpenEditorFile(AFileName, 0, 0, Flags);
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
procedure TFileBrowserController.DoLoadLayout(Sender: TObject);
 | 
					procedure TFileBrowserController.DoLoadLayout(Sender: TObject);
 | 
				
			||||||
 | 
				
			|||||||
@ -1117,7 +1117,7 @@ begin
 | 
				
			|||||||
    DebugLn(['TH2PasDialog.Convert LazarusIDE.DoSaveProject failed']);
 | 
					    DebugLn(['TH2PasDialog.Convert LazarusIDE.DoSaveProject failed']);
 | 
				
			||||||
    exit;
 | 
					    exit;
 | 
				
			||||||
  end;
 | 
					  end;
 | 
				
			||||||
  LazarusIDE.SaveSourceEditorChangesToCodeCache(-1,-1);
 | 
					  LazarusIDE.SaveSourceEditorChangesToCodeCache(nil);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Result:=Converter.Execute;
 | 
					  Result:=Converter.Execute;
 | 
				
			||||||
  if Result<>mrOk then begin
 | 
					  if Result<>mrOk then begin
 | 
				
			||||||
 | 
				
			|||||||
@ -346,7 +346,7 @@ begin
 | 
				
			|||||||
    if nm = '' then nm := SourceFile;
 | 
					    if nm = '' then nm := SourceFile;
 | 
				
			||||||
  end else
 | 
					  end else
 | 
				
			||||||
    nm := SourceFile;
 | 
					    nm := SourceFile;
 | 
				
			||||||
  LazarusIDE.DoOpenFileAndJumpToPos(nm, Point(1, Line), -1, -1, [ofOnlyIfExists, ofRegularFile]);
 | 
					  LazarusIDE.DoOpenFileAndJumpToPos(nm, Point(1, Line), -1, -1, -1, [ofOnlyIfExists, ofRegularFile]);
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
procedure IDEMenuClicked(Sender: TObject);
 | 
					procedure IDEMenuClicked(Sender: TObject);
 | 
				
			||||||
 | 
				
			|||||||
@ -154,7 +154,7 @@ begin
 | 
				
			|||||||
    if HasDirective then exit;
 | 
					    if HasDirective then exit;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    // open the file in the source editor
 | 
					    // open the file in the source editor
 | 
				
			||||||
    if LazarusIDE.DoOpenFileAndJumpToPos(Filename,Point(1,Line),-1,-1,
 | 
					    if LazarusIDE.DoOpenFileAndJumpToPos(Filename,Point(1,Line),-1,-1,-1,
 | 
				
			||||||
      [ofOnlyIfExists,ofRegularFile,ofUseCache,ofDoNotLoadResource])<>mrOk then
 | 
					      [ofOnlyIfExists,ofRegularFile,ofUseCache,ofDoNotLoadResource])<>mrOk then
 | 
				
			||||||
    begin
 | 
					    begin
 | 
				
			||||||
      DebugLn(['THideFPCHintWorker.Execute open failed: ',Filename]);
 | 
					      DebugLn(['THideFPCHintWorker.Execute open failed: ',Filename]);
 | 
				
			||||||
 | 
				
			|||||||
@ -73,7 +73,7 @@ begin
 | 
				
			|||||||
          then begin
 | 
					          then begin
 | 
				
			||||||
            // jump
 | 
					            // jump
 | 
				
			||||||
            if LazarusIDE.DoOpenFileAndJumpToPos(NewCodePos.Code.Filename,
 | 
					            if LazarusIDE.DoOpenFileAndJumpToPos(NewCodePos.Code.Filename,
 | 
				
			||||||
                      Point(NewCodePos.X,NewCodePos.Y),NewTopLine,-1,
 | 
					                      Point(NewCodePos.X,NewCodePos.Y),NewTopLine,-1,-1,
 | 
				
			||||||
                      [ofRegularFile,ofUseCache])=mrOk
 | 
					                      [ofRegularFile,ofUseCache])=mrOk
 | 
				
			||||||
            then
 | 
					            then
 | 
				
			||||||
              Ok:=true;
 | 
					              Ok:=true;
 | 
				
			||||||
 | 
				
			|||||||
@ -168,7 +168,7 @@ function ParseCode(CodeBuf: TCodeBuffer; out ACodeTool: TCodeTool): boolean;
 | 
				
			|||||||
// commits any editor changes to the codetools, parses the unit
 | 
					// commits any editor changes to the codetools, parses the unit
 | 
				
			||||||
// and if there is a syntax error, tells the IDE jump to it
 | 
					// and if there is a syntax error, tells the IDE jump to it
 | 
				
			||||||
begin
 | 
					begin
 | 
				
			||||||
  LazarusIDE.SaveSourceEditorChangesToCodeCache(-1);
 | 
					  LazarusIDE.SaveSourceEditorChangesToCodeCache(nil);
 | 
				
			||||||
  if not CodeToolBoss.Explore(CodeBuf,ACodeTool,false) then begin
 | 
					  if not CodeToolBoss.Explore(CodeBuf,ACodeTool,false) then begin
 | 
				
			||||||
    LazarusIDE.DoJumpToCodeToolBossError;
 | 
					    LazarusIDE.DoJumpToCodeToolBossError;
 | 
				
			||||||
    Result:=false;
 | 
					    Result:=false;
 | 
				
			||||||
 | 
				
			|||||||
@ -279,7 +279,7 @@ begin
 | 
				
			|||||||
    end;
 | 
					    end;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    LazarusIDE.DoOpenFileAndJumpToPos(NewCode.Filename,Point(NewX,NewY),
 | 
					    LazarusIDE.DoOpenFileAndJumpToPos(NewCode.Filename,Point(NewX,NewY),
 | 
				
			||||||
                                      NewTopLine,-1,[]);
 | 
					                                      NewTopLine,-1,-1,[]);
 | 
				
			||||||
  finally
 | 
					  finally
 | 
				
			||||||
    CodeToolBoss.FreeListOfPCodeXYPosition(NewList);
 | 
					    CodeToolBoss.FreeListOfPCodeXYPosition(NewList);
 | 
				
			||||||
  end;
 | 
					  end;
 | 
				
			||||||
 | 
				
			|||||||
@ -1001,7 +1001,7 @@ begin
 | 
				
			|||||||
    end;
 | 
					    end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // get nice unit name
 | 
					    // get nice unit name
 | 
				
			||||||
    if not LazarusIDE.SaveSourceEditorChangesToCodeCache(-1, -1) then begin
 | 
					    if not LazarusIDE.SaveSourceEditorChangesToCodeCache(nil) then begin
 | 
				
			||||||
      DebugLn(['TCodeBrowserView.UseUnitInSrcEditor LazarusIDE.'
 | 
					      DebugLn(['TCodeBrowserView.UseUnitInSrcEditor LazarusIDE.'
 | 
				
			||||||
        +'SaveSourceEditorChangesToCodeCache failed']);
 | 
					        +'SaveSourceEditorChangesToCodeCache failed']);
 | 
				
			||||||
      exit;
 | 
					      exit;
 | 
				
			||||||
@ -2645,7 +2645,7 @@ begin
 | 
				
			|||||||
    and (Node.CodePos.Code.Filename<>'') then begin
 | 
					    and (Node.CodePos.Code.Filename<>'') then begin
 | 
				
			||||||
      Node.CodePos.Code.AbsoluteToLineCol(Node.CodePos.P,Line,Column);
 | 
					      Node.CodePos.Code.AbsoluteToLineCol(Node.CodePos.P,Line,Column);
 | 
				
			||||||
      LazarusIDE.DoOpenFileAndJumpToPos(Node.CodePos.Code.Filename,
 | 
					      LazarusIDE.DoOpenFileAndJumpToPos(Node.CodePos.Code.Filename,
 | 
				
			||||||
        Point(Column,Line),-1,-1,[ofOnlyIfExists]);
 | 
					        Point(Column,Line),-1,-1,-1,[ofOnlyIfExists]);
 | 
				
			||||||
    end;
 | 
					    end;
 | 
				
			||||||
  end;
 | 
					  end;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
@ -3160,7 +3160,7 @@ begin
 | 
				
			|||||||
      exit;
 | 
					      exit;
 | 
				
			||||||
    end;
 | 
					    end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if LazarusIDE.DoOpenFileAndJumpToPos(Filename,Caret,-1,-1,OpnFlagsPlainFile
 | 
					    if LazarusIDE.DoOpenFileAndJumpToPos(Filename,Caret,-1,-1,-1,OpnFlagsPlainFile
 | 
				
			||||||
      )<>mrOk
 | 
					      )<>mrOk
 | 
				
			||||||
    then exit;
 | 
					    then exit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -415,7 +415,7 @@ begin
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    Parser.EnableMacros := Attributes.IndexOfName(CodeTemplateEnableMacros)>=0;
 | 
					    Parser.EnableMacros := Attributes.IndexOfName(CodeTemplateEnableMacros)>=0;
 | 
				
			||||||
    Parser.Indent := StringOfChar(' ', IndentLen);
 | 
					    Parser.Indent := StringOfChar(' ', IndentLen);
 | 
				
			||||||
    LazarusIDE.SaveSourceEditorChangesToCodeCache(-1, -1);
 | 
					    LazarusIDE.SaveSourceEditorChangesToCodeCache(nil);
 | 
				
			||||||
    if not Parser.SubstituteCodeMacros(SrcEdit) then exit;
 | 
					    if not Parser.SubstituteCodeMacros(SrcEdit) then exit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    s:=AEditor.Lines[p.y-1];
 | 
					    s:=AEditor.Lines[p.y-1];
 | 
				
			||||||
 | 
				
			|||||||
@ -42,21 +42,19 @@ interface
 | 
				
			|||||||
uses
 | 
					uses
 | 
				
			||||||
  Classes, SysUtils, Math, Forms, Controls, Buttons, StdCtrls, FileUtil,
 | 
					  Classes, SysUtils, Math, Forms, Controls, Buttons, StdCtrls, FileUtil,
 | 
				
			||||||
  LazarusIDEStrConsts, EditorOptions, IDEWindowIntf, LCLType,
 | 
					  LazarusIDEStrConsts, EditorOptions, IDEWindowIntf, LCLType,
 | 
				
			||||||
  InputHistory, DiffPatch, ExtCtrls, Dialogs, SynEdit, IDEContextHelpEdit;
 | 
					  InputHistory, DiffPatch, ExtCtrls, Dialogs, SynEdit, IDEContextHelpEdit,
 | 
				
			||||||
 | 
					  SourceEditor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type
 | 
					type
 | 
				
			||||||
  TOnGetDiffFile = procedure(TextID: integer; OnlySelection: boolean;
 | 
					 | 
				
			||||||
                             var Source: string) of object;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  { TDiffFile }
 | 
					  { TDiffFile }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TDiffFile = class
 | 
					  TDiffFile = class
 | 
				
			||||||
  public
 | 
					  public
 | 
				
			||||||
    Name: string;
 | 
					    Name: string;
 | 
				
			||||||
    ID: integer;
 | 
					    Editor: TSourceEditor;
 | 
				
			||||||
    SelectionAvailable: boolean;
 | 
					    SelectionAvailable: boolean;
 | 
				
			||||||
    constructor Create(const NewName: string; NewID: integer;
 | 
					    constructor Create(const NewName: string; NewEditor: TSourceEditor;
 | 
				
			||||||
      NewSelectionAvailable: boolean);
 | 
					      NewSelectionAvailable: boolean);
 | 
				
			||||||
  end;
 | 
					  end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -110,7 +108,6 @@ type
 | 
				
			|||||||
    procedure Text1ComboboxChange(Sender: TObject);
 | 
					    procedure Text1ComboboxChange(Sender: TObject);
 | 
				
			||||||
    procedure Text2ComboboxChange(Sender: TObject);
 | 
					    procedure Text2ComboboxChange(Sender: TObject);
 | 
				
			||||||
  private
 | 
					  private
 | 
				
			||||||
    FOnGetDiffFile: TOnGetDiffFile;
 | 
					 | 
				
			||||||
    fDiffNeedsUpdate: boolean;
 | 
					    fDiffNeedsUpdate: boolean;
 | 
				
			||||||
    FLockCount: integer;
 | 
					    FLockCount: integer;
 | 
				
			||||||
    procedure SetupComponents;
 | 
					    procedure SetupComponents;
 | 
				
			||||||
@ -130,13 +127,9 @@ type
 | 
				
			|||||||
    function GetDiffOptions: TTextDiffFlags;
 | 
					    function GetDiffOptions: TTextDiffFlags;
 | 
				
			||||||
    procedure BeginUpdate;
 | 
					    procedure BeginUpdate;
 | 
				
			||||||
    procedure EndUpdate;
 | 
					    procedure EndUpdate;
 | 
				
			||||||
  public
 | 
					 | 
				
			||||||
    property OnGetDiffFile: TOnGetDiffFile
 | 
					 | 
				
			||||||
                                       read FOnGetDiffFile write FOnGetDiffFile;
 | 
					 | 
				
			||||||
  end;
 | 
					  end;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
function ShowDiffDialog(Files: TDiffFiles; Text1Index: integer;
 | 
					function ShowDiffDialog(Text1Index: integer;
 | 
				
			||||||
  OnGetDiffFile: TOnGetDiffFile;
 | 
					 | 
				
			||||||
  var OpenDiffInEditor: boolean; var Diff: string): TModalResult;
 | 
					  var OpenDiffInEditor: boolean; var Diff: string): TModalResult;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const
 | 
					const
 | 
				
			||||||
@ -152,16 +145,23 @@ implementation
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
{$R *.lfm}
 | 
					{$R *.lfm}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function ShowDiffDialog(Files: TDiffFiles; Text1Index: integer;
 | 
					function ShowDiffDialog(Text1Index: integer;
 | 
				
			||||||
  OnGetDiffFile: TOnGetDiffFile;
 | 
					 | 
				
			||||||
  var OpenDiffInEditor: boolean; var Diff: string): TModalResult;
 | 
					  var OpenDiffInEditor: boolean; var Diff: string): TModalResult;
 | 
				
			||||||
var
 | 
					var
 | 
				
			||||||
  DiffDlg: TDiffDlg;
 | 
					  DiffDlg: TDiffDlg;
 | 
				
			||||||
 | 
					  Files: TDiffFiles;
 | 
				
			||||||
 | 
					  i: Integer;
 | 
				
			||||||
 | 
					  SrcEdit: TSourceEditor;
 | 
				
			||||||
begin
 | 
					begin
 | 
				
			||||||
 | 
					  Files := TDiffFiles.Create;
 | 
				
			||||||
 | 
					  for i:=0 to SourceEditorManager.SourceEditorCount - 1 do begin
 | 
				
			||||||
 | 
					    SrcEdit := SourceEditorManager.SourceEditors[i]; // FindSourceEditorWithPageIndex(i);
 | 
				
			||||||
 | 
					    Files.Add(TDiffFile.Create(SrcEdit.PageName, SrcEdit, SrcEdit.SelectionAvailable));
 | 
				
			||||||
 | 
					  end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  OpenDiffInEditor:=false;
 | 
					  OpenDiffInEditor:=false;
 | 
				
			||||||
  DiffDlg:=TDiffDlg.Create(nil);
 | 
					  DiffDlg:=TDiffDlg.Create(nil);
 | 
				
			||||||
  DiffDlg.BeginUpdate;
 | 
					  DiffDlg.BeginUpdate;
 | 
				
			||||||
  DiffDlg.OnGetDiffFile:=OnGetDiffFile;
 | 
					 | 
				
			||||||
  DiffDlg.Files:=Files;
 | 
					  DiffDlg.Files:=Files;
 | 
				
			||||||
  DiffDlg.SetText1Index(Text1Index);
 | 
					  DiffDlg.SetText1Index(Text1Index);
 | 
				
			||||||
  DiffDlg.Init;
 | 
					  DiffDlg.Init;
 | 
				
			||||||
@ -175,6 +175,7 @@ begin
 | 
				
			|||||||
    Result:=mrOk;
 | 
					    Result:=mrOk;
 | 
				
			||||||
  end;
 | 
					  end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Files.Free;
 | 
				
			||||||
  DiffDlg.Free;
 | 
					  DiffDlg.Free;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -192,7 +193,7 @@ begin
 | 
				
			|||||||
    //only add new files
 | 
					    //only add new files
 | 
				
			||||||
    if Text1ComboBox.Items.IndexOf(dlgOpen.FileName) = -1 then
 | 
					    if Text1ComboBox.Items.IndexOf(dlgOpen.FileName) = -1 then
 | 
				
			||||||
    begin
 | 
					    begin
 | 
				
			||||||
      Files.Add(TDiffFile.Create(dlgOpen.FileName,-1,False));
 | 
					      Files.Add(TDiffFile.Create(dlgOpen.FileName,nil,False));
 | 
				
			||||||
      Text1ComboBox.Items.Add(dlgOpen.FileName);
 | 
					      Text1ComboBox.Items.Add(dlgOpen.FileName);
 | 
				
			||||||
      Text2ComboBox.Items.Add(dlgOpen.FileName);
 | 
					      Text2ComboBox.Items.Add(dlgOpen.FileName);
 | 
				
			||||||
    end;
 | 
					    end;
 | 
				
			||||||
@ -302,29 +303,33 @@ begin
 | 
				
			|||||||
  if (Text1=nil) or (Text2=nil) then begin
 | 
					  if (Text1=nil) or (Text2=nil) then begin
 | 
				
			||||||
    DiffSynEdit.Lines.Text:='';
 | 
					    DiffSynEdit.Lines.Text:='';
 | 
				
			||||||
  end else begin
 | 
					  end else begin
 | 
				
			||||||
    if Text1.ID = -1 then
 | 
					    if Text1.Editor = nil then
 | 
				
			||||||
      begin
 | 
					      begin
 | 
				
			||||||
        dat := TStringList.Create;
 | 
					        dat := TStringList.Create;
 | 
				
			||||||
        dat.LoadFromFile(UTF8ToSys(Text1.Name));
 | 
					        dat.LoadFromFile(UTF8ToSys(Text1.Name));
 | 
				
			||||||
        Text1Src := dat.Text;
 | 
					        Text1Src := dat.Text;
 | 
				
			||||||
        dat.Free;
 | 
					        dat.Free;
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    else
 | 
					    else begin
 | 
				
			||||||
      OnGetDiffFile(Text1.ID,
 | 
					      if (Text1.SelectionAvailable and Text1OnlySelectionCheckBox.Checked) then
 | 
				
			||||||
        Text1.SelectionAvailable and Text1OnlySelectionCheckBox.Checked,
 | 
					        Text1Src := Text1.Editor.EditorComponent.SelText
 | 
				
			||||||
        Text1Src);
 | 
					      else
 | 
				
			||||||
 | 
					        Text1Src := Text1.Editor.EditorComponent.Lines.Text;
 | 
				
			||||||
 | 
					    end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if Text2.ID = -1 then
 | 
					    if Text2.Editor = nil then
 | 
				
			||||||
      begin
 | 
					      begin
 | 
				
			||||||
        dat := TStringList.Create;
 | 
					        dat := TStringList.Create;
 | 
				
			||||||
        dat.LoadFromFile(UTF8ToSys(Text2.Name));
 | 
					        dat.LoadFromFile(UTF8ToSys(Text2.Name));
 | 
				
			||||||
        Text2Src := dat.Text;
 | 
					        Text2Src := dat.Text;
 | 
				
			||||||
        dat.Free;
 | 
					        dat.Free;
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    else
 | 
					    else begin
 | 
				
			||||||
      OnGetDiffFile(Text2.ID,
 | 
					      if (Text2.SelectionAvailable and Text2OnlySelectionCheckBox.Checked) then
 | 
				
			||||||
        Text2.SelectionAvailable and Text2OnlySelectionCheckBox.Checked,
 | 
					        Text2Src := Text2.Editor.EditorComponent.SelText
 | 
				
			||||||
        Text2Src);
 | 
					      else
 | 
				
			||||||
 | 
					        Text2Src := Text2.Editor.EditorComponent.Lines.Text;
 | 
				
			||||||
 | 
					    end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DiffTxt:=CreateTextDiff(Text1Src,Text2Src,GetDiffOptions,tdoContext);
 | 
					    DiffTxt:=CreateTextDiff(Text1Src,Text2Src,GetDiffOptions,tdoContext);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@ -477,11 +482,11 @@ end;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
{ TDiffFile }
 | 
					{ TDiffFile }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
constructor TDiffFile.Create(const NewName: string; NewID: integer;
 | 
					constructor TDiffFile.Create(const NewName: string; NewEditor: TSourceEditor;
 | 
				
			||||||
  NewSelectionAvailable: boolean);
 | 
					  NewSelectionAvailable: boolean);
 | 
				
			||||||
begin
 | 
					begin
 | 
				
			||||||
  Name:=NewName;
 | 
					  Name:=NewName;
 | 
				
			||||||
  ID:=NewID;
 | 
					  Editor:=NewEditor;
 | 
				
			||||||
  SelectionAvailable:=NewSelectionAvailable;
 | 
					  SelectionAvailable:=NewSelectionAvailable;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1028,7 +1028,7 @@ begin
 | 
				
			|||||||
  NewSrcFilename:=CleanAndExpandFilename(SrcFilename);
 | 
					  NewSrcFilename:=CleanAndExpandFilename(SrcFilename);
 | 
				
			||||||
  if (NewSrcFilename=SourceFilename) and (CompareCaret(Caret,CaretXY)=0)
 | 
					  if (NewSrcFilename=SourceFilename) and (CompareCaret(Caret,CaretXY)=0)
 | 
				
			||||||
  and (fChain<>nil) and fChain.IsValid
 | 
					  and (fChain<>nil) and fChain.IsValid
 | 
				
			||||||
  and (not LazarusIDE.NeedSaveSourceEditorChangesToCodeCache(-1, -1)) then
 | 
					  and (not LazarusIDE.NeedSaveSourceEditorChangesToCodeCache(nil)) then
 | 
				
			||||||
    exit;
 | 
					    exit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  FCaretXY:=Caret;
 | 
					  FCaretXY:=Caret;
 | 
				
			||||||
@ -1236,7 +1236,7 @@ begin
 | 
				
			|||||||
    exit;
 | 
					    exit;
 | 
				
			||||||
  end;
 | 
					  end;
 | 
				
			||||||
  Exclude(FFlags,fpdefCodeCacheNeedsUpdate);
 | 
					  Exclude(FFlags,fpdefCodeCacheNeedsUpdate);
 | 
				
			||||||
  LazarusIDE.SaveSourceEditorChangesToCodeCache(-1, -1);
 | 
					  LazarusIDE.SaveSourceEditorChangesToCodeCache(nil);
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
procedure TFPDocEditor.ErrorsMemoChange(Sender: TObject);
 | 
					procedure TFPDocEditor.ErrorsMemoChange(Sender: TObject);
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										399
									
								
								ide/main.pp
									
									
									
									
									
								
							
							
						
						
									
										399
									
								
								ide/main.pp
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -145,6 +145,7 @@ type
 | 
				
			|||||||
                             out ActiveUnitInfo: TUnitInfo); virtual; abstract;
 | 
					                             out ActiveUnitInfo: TUnitInfo); virtual; abstract;
 | 
				
			||||||
    procedure GetUnitWithPageIndex(PageIndex, WindowIndex: integer;
 | 
					    procedure GetUnitWithPageIndex(PageIndex, WindowIndex: integer;
 | 
				
			||||||
          var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo); virtual; abstract;
 | 
					          var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo); virtual; abstract;
 | 
				
			||||||
 | 
					          deprecated; // deprecated in 0.9.29 March 2010
 | 
				
			||||||
    procedure GetDesignerUnit(ADesigner: TDesigner;
 | 
					    procedure GetDesignerUnit(ADesigner: TDesigner;
 | 
				
			||||||
          var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo); virtual; abstract;
 | 
					          var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo); virtual; abstract;
 | 
				
			||||||
    procedure GetObjectInspectorUnit(
 | 
					    procedure GetObjectInspectorUnit(
 | 
				
			||||||
 | 
				
			|||||||
@ -114,7 +114,7 @@ begin
 | 
				
			|||||||
  OldChange:=LazarusIDE.OpenEditorsOnCodeToolChange;
 | 
					  OldChange:=LazarusIDE.OpenEditorsOnCodeToolChange;
 | 
				
			||||||
  LazarusIDE.OpenEditorsOnCodeToolChange:=true;
 | 
					  LazarusIDE.OpenEditorsOnCodeToolChange:=true;
 | 
				
			||||||
  try
 | 
					  try
 | 
				
			||||||
    LazarusIDE.SaveSourceEditorChangesToCodeCache(-1, -1);
 | 
					    LazarusIDE.SaveSourceEditorChangesToCodeCache(nil);
 | 
				
			||||||
    if not CodeToolBoss.RemoveUnitFromAllUsesSections(CodeBuf,UnneededUnitname)
 | 
					    if not CodeToolBoss.RemoveUnitFromAllUsesSections(CodeBuf,UnneededUnitname)
 | 
				
			||||||
    then begin
 | 
					    then begin
 | 
				
			||||||
      LazarusIDE.DoJumpToCodeToolBossError;
 | 
					      LazarusIDE.DoJumpToCodeToolBossError;
 | 
				
			||||||
@ -229,7 +229,7 @@ begin
 | 
				
			|||||||
      end;
 | 
					      end;
 | 
				
			||||||
    end;
 | 
					    end;
 | 
				
			||||||
  end;
 | 
					  end;
 | 
				
			||||||
  LazarusIDE.SaveSourceEditorChangesToCodeCache(-1, -1);
 | 
					  LazarusIDE.SaveSourceEditorChangesToCodeCache(nil);
 | 
				
			||||||
  if not CodeToolBoss.FindUnitInAllUsesSections(CodeBuf,MissingUnitname,
 | 
					  if not CodeToolBoss.FindUnitInAllUsesSections(CodeBuf,MissingUnitname,
 | 
				
			||||||
    NamePos,InPos)
 | 
					    NamePos,InPos)
 | 
				
			||||||
  then begin
 | 
					  then begin
 | 
				
			||||||
@ -366,7 +366,7 @@ procedure TQuickFixLinkerUndefinedReference.Execute(const Msg: TIDEMessageLine;
 | 
				
			|||||||
      exit;
 | 
					      exit;
 | 
				
			||||||
    end;
 | 
					    end;
 | 
				
			||||||
    LazarusIDE.DoOpenFileAndJumpToPos(NewCode.Filename,Point(NewX,NewY),
 | 
					    LazarusIDE.DoOpenFileAndJumpToPos(NewCode.Filename,Point(NewX,NewY),
 | 
				
			||||||
                                      NewTopLine,-1,[]);
 | 
					                                      NewTopLine,-1,-1,[]);
 | 
				
			||||||
  end;
 | 
					  end;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
begin
 | 
					begin
 | 
				
			||||||
@ -458,7 +458,7 @@ begin
 | 
				
			|||||||
    DebugLn(['TQuickFixClassWithAbstractMethods.Execute Declaration at ',NewCode.Filename,' ',NewX,',',NewY]);
 | 
					    DebugLn(['TQuickFixClassWithAbstractMethods.Execute Declaration at ',NewCode.Filename,' ',NewX,',',NewY]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if LazarusIDE.DoOpenFileAndJumpToPos(NewCode.Filename,
 | 
					    if LazarusIDE.DoOpenFileAndJumpToPos(NewCode.Filename,
 | 
				
			||||||
      Point(NewX,NewY),NewTopLine,-1,[])<>mrOk
 | 
					      Point(NewX,NewY),NewTopLine,-1,-1,[])<>mrOk
 | 
				
			||||||
    then begin
 | 
					    then begin
 | 
				
			||||||
      DebugLn(['TQuickFixClassWithAbstractMethods.Execute failed opening ',NewCode.Filename]);
 | 
					      DebugLn(['TQuickFixClassWithAbstractMethods.Execute failed opening ',NewCode.Filename]);
 | 
				
			||||||
      exit;
 | 
					      exit;
 | 
				
			||||||
 | 
				
			|||||||
@ -138,7 +138,7 @@ begin
 | 
				
			|||||||
    if frm.ModalResult = mrOK then  // we need to jump
 | 
					    if frm.ModalResult = mrOK then  // we need to jump
 | 
				
			||||||
    begin
 | 
					    begin
 | 
				
			||||||
      LazarusIDE.DoOpenFileAndJumpToPos(frm.Caret.Code.Filename,
 | 
					      LazarusIDE.DoOpenFileAndJumpToPos(frm.Caret.Code.Filename,
 | 
				
			||||||
          Point(frm.Caret.X, frm.Caret.Y), frm.NewTopLine, -1,
 | 
					          Point(frm.Caret.X, frm.Caret.Y), frm.NewTopLine, -1,-1,
 | 
				
			||||||
          [ofRegularFile,ofUseCache]);
 | 
					          [ofRegularFile,ofUseCache]);
 | 
				
			||||||
    end;
 | 
					    end;
 | 
				
			||||||
  finally
 | 
					  finally
 | 
				
			||||||
 | 
				
			|||||||
@ -362,7 +362,7 @@ var
 | 
				
			|||||||
      
 | 
					      
 | 
				
			||||||
      GetSrcEditPos;
 | 
					      GetSrcEditPos;
 | 
				
			||||||
      if LazarusIDE.DoOpenFileAndJumpToPos(TheFileName,SrcEditStartPos,
 | 
					      if LazarusIDE.DoOpenFileAndJumpToPos(TheFileName,SrcEditStartPos,
 | 
				
			||||||
             -1,-1,[ofUseCache,ofDoNotLoadResource,ofVirtualFile,ofRegularFile])
 | 
					             -1,-1,-1,[ofUseCache,ofDoNotLoadResource,ofVirtualFile,ofRegularFile])
 | 
				
			||||||
      <>mrOk then
 | 
					      <>mrOk then
 | 
				
			||||||
      begin
 | 
					      begin
 | 
				
			||||||
        DoAbort;
 | 
					        DoAbort;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1032
									
								
								ide/sourceeditor.pp
									
									
									
									
									
								
							
							
						
						
									
										1032
									
								
								ide/sourceeditor.pp
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -559,7 +559,7 @@ begin
 | 
				
			|||||||
    if Assigned(OnOpenFile) then
 | 
					    if Assigned(OnOpenFile) then
 | 
				
			||||||
      OnOpenFile(Self,CurFilename,TheLine)
 | 
					      OnOpenFile(Self,CurFilename,TheLine)
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      LazarusIDE.DoOpenFileAndJumpToPos(CurFilename,Point(1,TheLine),-1,-1,
 | 
					      LazarusIDE.DoOpenFileAndJumpToPos(CurFilename,Point(1,TheLine),-1,-1,-1,
 | 
				
			||||||
        [ofOnlyIfExists,ofRegularFile,ofVirtualFile,ofDoNotLoadResource]);
 | 
					        [ofOnlyIfExists,ofRegularFile,ofVirtualFile,ofDoNotLoadResource]);
 | 
				
			||||||
  end;
 | 
					  end;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
@ -619,7 +619,7 @@ begin
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  //DebugLn(['TfrmTodo.acRefreshExecute MainSourceFilename=',MainSourceFilename]);
 | 
					  //DebugLn(['TfrmTodo.acRefreshExecute MainSourceFilename=',MainSourceFilename]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  LazarusIDE.SaveSourceEditorChangesToCodeCache(-1,-1);
 | 
					  LazarusIDE.SaveSourceEditorChangesToCodeCache(nil);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Screen.Cursor:=crHourGlass;
 | 
					  Screen.Cursor:=crHourGlass;
 | 
				
			||||||
  Owners:=nil;
 | 
					  Owners:=nil;
 | 
				
			||||||
 | 
				
			|||||||
@ -180,27 +180,37 @@ type
 | 
				
			|||||||
        NewFilename: string; const NewSource: string;
 | 
					        NewFilename: string; const NewSource: string;
 | 
				
			||||||
        NewFlags: TNewFlags): TModalResult;
 | 
					        NewFlags: TNewFlags): TModalResult;
 | 
				
			||||||
    function DoNewFile(NewFileDescriptor: TProjectFileDescriptor;
 | 
					    function DoNewFile(NewFileDescriptor: TProjectFileDescriptor;
 | 
				
			||||||
        var NewFilename: string; const NewSource: string;
 | 
					                       var NewFilename: string; const NewSource: string;
 | 
				
			||||||
        NewFlags: TNewFlags; NewOwner: TObject): TModalResult; virtual; abstract;
 | 
					                       NewFlags: TNewFlags; NewOwner: TObject): TModalResult; virtual; abstract;
 | 
				
			||||||
    function DoSaveEditorFile(PageIndex:integer;
 | 
					    function DoSaveEditorFile(PageIndex:integer;
 | 
				
			||||||
                              Flags: TSaveFlags): TModalResult; virtual; abstract; deprecated;
 | 
					                              Flags: TSaveFlags): TModalResult; virtual; abstract;
 | 
				
			||||||
 | 
					                              deprecated {$IFDEF VER2_5}'use method with EditorObject'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
    function DoSaveEditorFile(AEditor: TSourceEditorInterface;
 | 
					    function DoSaveEditorFile(AEditor: TSourceEditorInterface;
 | 
				
			||||||
        Flags: TSaveFlags): TModalResult; virtual; abstract;
 | 
					                              Flags: TSaveFlags): TModalResult; virtual; abstract;
 | 
				
			||||||
    function DoCloseEditorFile(PageIndex:integer;
 | 
					    function DoCloseEditorFile(PageIndex:integer;
 | 
				
			||||||
                               Flags: TCloseFlags):TModalResult; virtual; abstract; deprecated;
 | 
					                               Flags: TCloseFlags):TModalResult; virtual; abstract;
 | 
				
			||||||
 | 
					                               deprecated {$IFDEF VER2_5}'use method with EditorObject'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
    function DoCloseEditorFile(AEditor: TSourceEditorInterface;
 | 
					    function DoCloseEditorFile(AEditor: TSourceEditorInterface;
 | 
				
			||||||
        Flags: TCloseFlags):TModalResult; virtual; abstract;
 | 
					                               Flags: TCloseFlags):TModalResult; virtual; abstract;
 | 
				
			||||||
    function DoCloseEditorFile(const Filename: string;
 | 
					    function DoCloseEditorFile(const Filename: string;
 | 
				
			||||||
        Flags: TCloseFlags): TModalResult; virtual; abstract;
 | 
					                               Flags: TCloseFlags): TModalResult; virtual; abstract;
 | 
				
			||||||
    function DoOpenEditorFile(AFileName:string; PageIndex: integer;
 | 
					    function DoOpenEditorFile(AFileName:string; PageIndex: integer;
 | 
				
			||||||
                              Flags: TOpenFlags): TModalResult; virtual; abstract; deprecated;
 | 
					                              Flags: TOpenFlags): TModalResult; virtual; abstract;
 | 
				
			||||||
 | 
					                              deprecated {$IFDEF VER2_5}'use method with WindowIndex'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
    function DoOpenEditorFile(AFileName:string; PageIndex, WindowIndex: integer;
 | 
					    function DoOpenEditorFile(AFileName:string; PageIndex, WindowIndex: integer;
 | 
				
			||||||
                              Flags: TOpenFlags): TModalResult; virtual; abstract;
 | 
					                              Flags: TOpenFlags): TModalResult; virtual; abstract;
 | 
				
			||||||
    function DoOpenFileAndJumpToIdentifier(const AFilename, AnIdentifier: string;
 | 
					    function DoOpenFileAndJumpToIdentifier(const AFilename, AnIdentifier: string;
 | 
				
			||||||
                       PageIndex: integer; Flags: TOpenFlags): TModalResult; virtual; abstract;
 | 
					                       PageIndex: integer; Flags: TOpenFlags): TModalResult; virtual; abstract;
 | 
				
			||||||
 | 
					                       deprecated {$IFDEF VER2_5}'use method with WindowIndex'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
 | 
					    function DoOpenFileAndJumpToIdentifier(const AFilename, AnIdentifier: string;
 | 
				
			||||||
 | 
					                       PageIndex, WindowIndex: integer; Flags: TOpenFlags): TModalResult; virtual; abstract;
 | 
				
			||||||
    function DoOpenFileAndJumpToPos(const AFilename: string;
 | 
					    function DoOpenFileAndJumpToPos(const AFilename: string;
 | 
				
			||||||
        const CursorPosition: TPoint; TopLine: integer;
 | 
					                       const CursorPosition: TPoint; TopLine: integer;
 | 
				
			||||||
                       PageIndex: integer; Flags: TOpenFlags): TModalResult; virtual; abstract;
 | 
					                       PageIndex: integer; Flags: TOpenFlags): TModalResult; virtual; abstract;
 | 
				
			||||||
 | 
					                       deprecated {$IFDEF VER2_5}'use method with WindowIndex'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
 | 
					    function DoOpenFileAndJumpToPos(const AFilename: string;
 | 
				
			||||||
 | 
					                       const CursorPosition: TPoint; TopLine: integer;
 | 
				
			||||||
 | 
					                       PageIndex, WindowIndex: integer; Flags: TOpenFlags): TModalResult; virtual; abstract;
 | 
				
			||||||
    function DoRevertEditorFile(const Filename: string): TModalResult; virtual; abstract;
 | 
					    function DoRevertEditorFile(const Filename: string): TModalResult; virtual; abstract;
 | 
				
			||||||
    function DoOpenComponent(const UnitFilename: string; OpenFlags: TOpenFlags;
 | 
					    function DoOpenComponent(const UnitFilename: string; OpenFlags: TOpenFlags;
 | 
				
			||||||
                       CloseFlags: TCloseFlags;
 | 
					                       CloseFlags: TCloseFlags;
 | 
				
			||||||
@ -236,10 +246,12 @@ type
 | 
				
			|||||||
    function BeginCodeTools: boolean; virtual; abstract;
 | 
					    function BeginCodeTools: boolean; virtual; abstract;
 | 
				
			||||||
    procedure DoJumpToCodeToolBossError; virtual; abstract;
 | 
					    procedure DoJumpToCodeToolBossError; virtual; abstract;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function NeedSaveSourceEditorChangesToCodeCache(PageIndex: integer): boolean; virtual; abstract; deprecated;
 | 
					    function NeedSaveSourceEditorChangesToCodeCache(PageIndex: integer): boolean; virtual; abstract;
 | 
				
			||||||
    function NeedSaveSourceEditorChangesToCodeCache(PageIndex, WindowIndex: integer): boolean; virtual; abstract;
 | 
					        deprecated {$IFDEF VER2_5}'use method with EditorObject'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
    function SaveSourceEditorChangesToCodeCache(PageIndex: integer): boolean; virtual; abstract; deprecated; // true if something was saved
 | 
					    function NeedSaveSourceEditorChangesToCodeCache(AEditor: TSourceEditorInterface): boolean; virtual; abstract;
 | 
				
			||||||
    function SaveSourceEditorChangesToCodeCache(PageIndex, WindowIndex: integer): boolean; virtual; abstract; // true if something was saved
 | 
					    function SaveSourceEditorChangesToCodeCache(PageIndex: integer): boolean; virtual; abstract;  // true if something was saved
 | 
				
			||||||
 | 
					        deprecated {$IFDEF VER2_5}'use method with EditorObject'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
 | 
					    function SaveSourceEditorChangesToCodeCache(AEditor: TSourceEditorInterface): boolean; virtual; abstract; // true if something was saved
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    property OpenEditorsOnCodeToolChange: boolean read FOpenEditorsOnCodeToolChange
 | 
					    property OpenEditorsOnCodeToolChange: boolean read FOpenEditorsOnCodeToolChange
 | 
				
			||||||
                                             write FOpenEditorsOnCodeToolChange;
 | 
					                                             write FOpenEditorsOnCodeToolChange;
 | 
				
			||||||
 | 
				
			|||||||
@ -176,27 +176,37 @@ type
 | 
				
			|||||||
    function GetItems(Index: integer): TSourceEditorInterface; virtual; abstract;
 | 
					    function GetItems(Index: integer): TSourceEditorInterface; virtual; abstract;
 | 
				
			||||||
    procedure SetActiveEditor(const AValue: TSourceEditorInterface); virtual; abstract;
 | 
					    procedure SetActiveEditor(const AValue: TSourceEditorInterface); virtual; abstract;
 | 
				
			||||||
  public
 | 
					  public
 | 
				
			||||||
    function SourceEditorIntfWithFilename(const Filename: string): TSourceEditorInterface; deprecated;
 | 
					    function SourceEditorIntfWithFilename(const Filename: string): TSourceEditorInterface;
 | 
				
			||||||
 | 
					             deprecated {$IFDEF VER2_5}'use SourceEditorManagerIntf'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
    property ActiveEditor: TSourceEditorInterface
 | 
					    property ActiveEditor: TSourceEditorInterface
 | 
				
			||||||
             read GetActiveEditor write SetActiveEditor;
 | 
					             read GetActiveEditor write SetActiveEditor;
 | 
				
			||||||
    function Count: integer; virtual; abstract;
 | 
					    function Count: integer; virtual; abstract;
 | 
				
			||||||
    property Items[Index: integer]: TSourceEditorInterface read GetItems; default;
 | 
					    property Items[Index: integer]: TSourceEditorInterface read GetItems; default;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    function GetEditorControlSettings(EditControl: TControl): boolean; virtual; abstract; deprecated;
 | 
					    function GetEditorControlSettings(EditControl: TControl): boolean; virtual; abstract;
 | 
				
			||||||
    function GetHighlighterSettings(Highlighter: TObject): boolean; virtual; abstract; deprecated;
 | 
					             deprecated {$IFDEF VER2_5}'use SourceEditorManagerIntf'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
    procedure ClearErrorLines; virtual; abstract; deprecated;
 | 
					    function GetHighlighterSettings(Highlighter: TObject): boolean; virtual; abstract;
 | 
				
			||||||
 | 
					             deprecated {$IFDEF VER2_5}'use SourceEditorManagerIntf'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
 | 
					    procedure ClearErrorLines; virtual; abstract;
 | 
				
			||||||
 | 
					             deprecated {$IFDEF VER2_5}'use SourceEditorManagerIntf'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    property CompletionBoxPosition: integer read GetCompletionBoxPosition;
 | 
					    property CompletionBoxPosition: integer read GetCompletionBoxPosition;
 | 
				
			||||||
    procedure DeactivateCompletionForm; virtual; abstract;
 | 
					    procedure DeactivateCompletionForm; virtual; abstract;
 | 
				
			||||||
    property ActiveCompletionPlugin: TSourceEditorCompletionPlugin read GetActiveCompletionPlugin;
 | 
					    property ActiveCompletionPlugin: TSourceEditorCompletionPlugin read GetActiveCompletionPlugin;
 | 
				
			||||||
    // CompletionPlugin list moves to Manager
 | 
					    // CompletionPlugin list moves to Manager
 | 
				
			||||||
    function CompletionPluginCount: integer; virtual; abstract; deprecated;
 | 
					    function CompletionPluginCount: integer; virtual; abstract;
 | 
				
			||||||
 | 
					             deprecated {$IFDEF VER2_5}'use SourceEditorManagerIntf'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
    property CompletionPlugins[Index: integer]: TSourceEditorCompletionPlugin
 | 
					    property CompletionPlugins[Index: integer]: TSourceEditorCompletionPlugin
 | 
				
			||||||
             read GetCompletionPlugins; deprecated;
 | 
					             read GetCompletionPlugins;
 | 
				
			||||||
    procedure RegisterCompletionPlugin(Plugin: TSourceEditorCompletionPlugin); virtual; abstract; deprecated;
 | 
					             deprecated {$IFDEF VER2_5}'use SourceEditorManagerIntf'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
    procedure UnregisterCompletionPlugin(Plugin: TSourceEditorCompletionPlugin); virtual; abstract; deprecated;
 | 
					    procedure RegisterCompletionPlugin(Plugin: TSourceEditorCompletionPlugin); virtual; abstract;
 | 
				
			||||||
 | 
					             deprecated {$IFDEF VER2_5}'use SourceEditorManagerIntf'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
 | 
					    procedure UnregisterCompletionPlugin(Plugin: TSourceEditorCompletionPlugin); virtual; abstract;
 | 
				
			||||||
 | 
					             deprecated {$IFDEF VER2_5}'use SourceEditorManagerIntf'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
  end;
 | 
					  end;
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
 | 
					  TsemChangeReason = (semWindowCreate, semWindowDestroy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TSourceEditorManagerInterface = class(TComponent)
 | 
					  TSourceEditorManagerInterface = class(TComponent)
 | 
				
			||||||
  protected
 | 
					  protected
 | 
				
			||||||
    function GetActiveSourceWindow: TSourceEditorWindowInterface; virtual; abstract;
 | 
					    function GetActiveSourceWindow: TSourceEditorWindowInterface; virtual; abstract;
 | 
				
			||||||
@ -246,10 +256,14 @@ type
 | 
				
			|||||||
    property CompletionBoxPosition: integer read GetCompletionBoxPosition;
 | 
					    property CompletionBoxPosition: integer read GetCompletionBoxPosition;
 | 
				
			||||||
    procedure RegisterCompletionPlugin(Plugin: TSourceEditorCompletionPlugin); virtual; abstract;
 | 
					    procedure RegisterCompletionPlugin(Plugin: TSourceEditorCompletionPlugin); virtual; abstract;
 | 
				
			||||||
    procedure UnregisterCompletionPlugin(Plugin: TSourceEditorCompletionPlugin); virtual; abstract;
 | 
					    procedure UnregisterCompletionPlugin(Plugin: TSourceEditorCompletionPlugin); virtual; abstract;
 | 
				
			||||||
 | 
					  public
 | 
				
			||||||
 | 
					    procedure RegisterChangeEvent(AReason: TsemChangeReason; AHandler: TNotifyEvent); virtual; abstract;
 | 
				
			||||||
 | 
					    procedure UnRegisterChangeEvent(AReason: TsemChangeReason; AHandler: TNotifyEvent); virtual; abstract;
 | 
				
			||||||
  end;
 | 
					  end;
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
function SourceEditorWindow: TSourceEditorWindowInterface;           // Returns the active window
 | 
					function SourceEditorWindow: TSourceEditorWindowInterface;                      // Returns the active window
 | 
				
			||||||
 | 
					             deprecated {$IFDEF VER2_5}'use SourceEditorManagerIntf'{$ENDIF};   // deprecated in 0.9.29 March 2010
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var
 | 
					var
 | 
				
			||||||
  SourceEditorManagerIntf: TSourceEditorManagerInterface= nil;                      // set by the IDE
 | 
					  SourceEditorManagerIntf: TSourceEditorManagerInterface= nil;                      // set by the IDE
 | 
				
			||||||
 | 
				
			|||||||
@ -567,7 +567,7 @@ begin
 | 
				
			|||||||
      Filename:=PkgFile.Filename;
 | 
					      Filename:=PkgFile.Filename;
 | 
				
			||||||
    MainIDE.DoOpenFileAndJumpToIdentifier(
 | 
					    MainIDE.DoOpenFileAndJumpToIdentifier(
 | 
				
			||||||
      Filename,PkgComponent.ComponentClass.ClassName,
 | 
					      Filename,PkgComponent.ComponentClass.ClassName,
 | 
				
			||||||
      -1, // open page somewhere
 | 
					      -1, -1, // open page somewhere
 | 
				
			||||||
      [ofOnlyIfExists,ofAddToRecent,ofRegularFile,ofConvertMacros]);
 | 
					      [ofOnlyIfExists,ofAddToRecent,ofRegularFile,ofConvertMacros]);
 | 
				
			||||||
  end;
 | 
					  end;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
@ -1060,7 +1060,7 @@ var
 | 
				
			|||||||
      OldUnitName:=OldPkgName;
 | 
					      OldUnitName:=OldPkgName;
 | 
				
			||||||
      NewUnitName:=APackage.Name;
 | 
					      NewUnitName:=APackage.Name;
 | 
				
			||||||
      if (OldUnitName<>NewUnitName) then begin
 | 
					      if (OldUnitName<>NewUnitName) then begin
 | 
				
			||||||
        MainIDEInterface.SaveSourceEditorChangesToCodeCache(-1, -1);
 | 
					        MainIDEInterface.SaveSourceEditorChangesToCodeCache(nil);
 | 
				
			||||||
        if CodeToolBoss.RenameUsedUnit(
 | 
					        if CodeToolBoss.RenameUsedUnit(
 | 
				
			||||||
          AProject.MainUnitInfo.Source,OldUnitName,NewUnitName,'')
 | 
					          AProject.MainUnitInfo.Source,OldUnitName,NewUnitName,'')
 | 
				
			||||||
        then
 | 
					        then
 | 
				
			||||||
@ -1598,7 +1598,7 @@ begin
 | 
				
			|||||||
  // create default values
 | 
					  // create default values
 | 
				
			||||||
  TheUnitName:='';
 | 
					  TheUnitName:='';
 | 
				
			||||||
  HasRegisterProc:=false;
 | 
					  HasRegisterProc:=false;
 | 
				
			||||||
  MainIDE.SaveSourceEditorChangesToCodeCache(-1, -1);
 | 
					  MainIDE.SaveSourceEditorChangesToCodeCache(nil);
 | 
				
			||||||
  CodeBuffer:=CodeToolBoss.LoadFile(ExpFilename,true,false);
 | 
					  CodeBuffer:=CodeToolBoss.LoadFile(ExpFilename,true,false);
 | 
				
			||||||
  if CodeBuffer<>nil then begin
 | 
					  if CodeBuffer<>nil then begin
 | 
				
			||||||
    TheUnitName:=CodeToolBoss.GetSourceName(CodeBuffer,false);
 | 
					    TheUnitName:=CodeToolBoss.GetSourceName(CodeBuffer,false);
 | 
				
			||||||
@ -1723,7 +1723,7 @@ begin
 | 
				
			|||||||
  and (AProject.MainUnitInfo<>nil) then begin
 | 
					  and (AProject.MainUnitInfo<>nil) then begin
 | 
				
			||||||
    //debugln('TPkgManager.AddUnitToProjectMainUsesSection B ',AnUnitName);
 | 
					    //debugln('TPkgManager.AddUnitToProjectMainUsesSection B ',AnUnitName);
 | 
				
			||||||
    if (AnUnitName<>'') then begin
 | 
					    if (AnUnitName<>'') then begin
 | 
				
			||||||
      MainIDEInterface.SaveSourceEditorChangesToCodeCache(-1, -1);
 | 
					      MainIDEInterface.SaveSourceEditorChangesToCodeCache(nil);
 | 
				
			||||||
      if CodeToolBoss.AddUnitToMainUsesSection(
 | 
					      if CodeToolBoss.AddUnitToMainUsesSection(
 | 
				
			||||||
        AProject.MainUnitInfo.Source,AnUnitName,AnUnitInFilename)
 | 
					        AProject.MainUnitInfo.Source,AnUnitName,AnUnitInFilename)
 | 
				
			||||||
      then
 | 
					      then
 | 
				
			||||||
@ -2521,7 +2521,7 @@ begin
 | 
				
			|||||||
  if Result<>mrOk then exit;
 | 
					  if Result<>mrOk then exit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // save editor files to codetools
 | 
					  // save editor files to codetools
 | 
				
			||||||
  MainIDE.SaveSourceEditorChangesToCodeCache(-1, -1);
 | 
					  MainIDE.SaveSourceEditorChangesToCodeCache(nil);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // save package
 | 
					  // save package
 | 
				
			||||||
  if (psfSaveAs in Flags) then begin
 | 
					  if (psfSaveAs in Flags) then begin
 | 
				
			||||||
@ -4210,7 +4210,7 @@ begin
 | 
				
			|||||||
  if (Project1.MainUnitID>=0)
 | 
					  if (Project1.MainUnitID>=0)
 | 
				
			||||||
  and (pfMainUnitHasUsesSectionForAllUnits in Project1.Flags)
 | 
					  and (pfMainUnitHasUsesSectionForAllUnits in Project1.Flags)
 | 
				
			||||||
  then begin
 | 
					  then begin
 | 
				
			||||||
    MainIDEInterface.SaveSourceEditorChangesToCodeCache(-1, -1);
 | 
					    MainIDEInterface.SaveSourceEditorChangesToCodeCache(nil);
 | 
				
			||||||
    ShortUnitName:=ADependency.PackageName;
 | 
					    ShortUnitName:=ADependency.PackageName;
 | 
				
			||||||
    //debugln('TPkgManager.OnProjectInspectorRemoveDependency B ShortUnitName="',ShortUnitName,'"');
 | 
					    //debugln('TPkgManager.OnProjectInspectorRemoveDependency B ShortUnitName="',ShortUnitName,'"');
 | 
				
			||||||
    if (ShortUnitName<>'') then begin
 | 
					    if (ShortUnitName<>'') then begin
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user