mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-05 23:38:21 +02:00
IDE: IDECommand update events refactored: delete timer, use checks for command updates, add TIDESpecialCommand.OnRequestCaptionHint
git-svn-id: trunk@50152 -
This commit is contained in:
parent
dbc7d81566
commit
5ec7988f47
@ -548,6 +548,9 @@ type
|
|||||||
function GetUserCount: Integer;
|
function GetUserCount: Integer;
|
||||||
procedure SetOnExecute(const aOnExecute: TNotifyEvent);
|
procedure SetOnExecute(const aOnExecute: TNotifyEvent);
|
||||||
procedure SetOnExecuteProc(const aOnExecuteProc: TNotifyProcedure);
|
procedure SetOnExecuteProc(const aOnExecuteProc: TNotifyProcedure);
|
||||||
|
procedure SetEnabled(const AEnabled: Boolean);
|
||||||
|
procedure SetVisible(const AVisible: Boolean);
|
||||||
|
procedure SetCaption(const ACaption: string);
|
||||||
protected
|
protected
|
||||||
function GetLocalizedName: string; virtual;
|
function GetLocalizedName: string; virtual;
|
||||||
procedure SetLocalizedName(const AValue: string); virtual;
|
procedure SetLocalizedName(const AValue: string); virtual;
|
||||||
@ -579,6 +582,10 @@ type
|
|||||||
procedure UserRemoved(const aUser: TIDESpecialCommand);
|
procedure UserRemoved(const aUser: TIDESpecialCommand);
|
||||||
procedure DoOnUpdate; overload;
|
procedure DoOnUpdate; overload;
|
||||||
procedure DoOnUpdate(Sender: TObject); overload;
|
procedure DoOnUpdate(Sender: TObject); overload;
|
||||||
|
public
|
||||||
|
property Enabled: Boolean write SetEnabled;
|
||||||
|
property Visible: Boolean write SetVisible;
|
||||||
|
property Caption: string write SetCaption;
|
||||||
public
|
public
|
||||||
property Name: String read FName;
|
property Name: String read FName;
|
||||||
property Command: word read FCommand;// see the ecXXX constants above
|
property Command: word read FCommand;// see the ecXXX constants above
|
||||||
@ -601,9 +608,9 @@ type
|
|||||||
TIDECommands = class
|
TIDECommands = class
|
||||||
private
|
private
|
||||||
FCustomUpdateEvents: TMethodList;
|
FCustomUpdateEvents: TMethodList;
|
||||||
FUpdateTimer: TTimer;
|
FDontExecuteUpdateEventsUntil: Integer;
|
||||||
|
|
||||||
procedure UpdateTimerTimer(Sender: TObject);
|
procedure ApplicationOnIdle({%H-}Sender: TObject; var {%H-}Done: Boolean);
|
||||||
protected
|
protected
|
||||||
function GetCategory(Index: integer): TIDECommandCategory; virtual; abstract;
|
function GetCategory(Index: integer): TIDECommandCategory; virtual; abstract;
|
||||||
public
|
public
|
||||||
@ -626,10 +633,11 @@ type
|
|||||||
IDEWindowClass: TCustomFormClass = nil): TFPList; virtual; abstract; // list of TIDECommand
|
IDEWindowClass: TCustomFormClass = nil): TFPList; virtual; abstract; // list of TIDECommand
|
||||||
function CategoryCount: integer; virtual; abstract;
|
function CategoryCount: integer; virtual; abstract;
|
||||||
public
|
public
|
||||||
procedure StartUpdateTimer;
|
procedure StartUpdateEvents;
|
||||||
procedure StopUpdateTimer;
|
procedure StopUpdateEvents;
|
||||||
|
|
||||||
procedure ExecuteUpdateEvents;
|
procedure ExecuteUpdateEvents;
|
||||||
|
procedure CancelPostponeUpdateEvents;
|
||||||
procedure PostponeUpdateEvents;
|
procedure PostponeUpdateEvents;
|
||||||
|
|
||||||
procedure AddCustomUpdateEvent(const aEvent: TNotifyEvent);
|
procedure AddCustomUpdateEvent(const aEvent: TNotifyEvent);
|
||||||
@ -640,6 +648,8 @@ type
|
|||||||
|
|
||||||
// MenuItem and ButtonCommand inherit from SpecialCommand.
|
// MenuItem and ButtonCommand inherit from SpecialCommand.
|
||||||
|
|
||||||
|
TGetHintCaptionEvent = procedure(Sender: TObject; var ACaption, AHint: string) of object;
|
||||||
|
|
||||||
TIDESpecialCommand = class(TPersistent)
|
TIDESpecialCommand = class(TPersistent)
|
||||||
private
|
private
|
||||||
FCommand: TIDECommand;
|
FCommand: TIDECommand;
|
||||||
@ -651,6 +661,7 @@ type
|
|||||||
FImageIndex: Integer;
|
FImageIndex: Integer;
|
||||||
FOnClickMethod: TNotifyEvent;
|
FOnClickMethod: TNotifyEvent;
|
||||||
FOnClickProc: TNotifyProcedure;
|
FOnClickProc: TNotifyProcedure;
|
||||||
|
FOnRequestCaption: TGetHintCaptionEvent;
|
||||||
FVisible: Boolean;
|
FVisible: Boolean;
|
||||||
protected
|
protected
|
||||||
function GetCaption: string; virtual;
|
function GetCaption: string; virtual;
|
||||||
@ -664,6 +675,8 @@ type
|
|||||||
procedure SetVisible(const aVisible: Boolean); virtual;
|
procedure SetVisible(const aVisible: Boolean); virtual;
|
||||||
procedure SetOnClickMethod(const aOnClick: TNotifyEvent); virtual;
|
procedure SetOnClickMethod(const aOnClick: TNotifyEvent); virtual;
|
||||||
procedure SetOnClickProc(const aOnClickProc: TNotifyProcedure); virtual;
|
procedure SetOnClickProc(const aOnClickProc: TNotifyProcedure); virtual;
|
||||||
|
procedure SetOnRequestCaption(
|
||||||
|
const aOnRequestCaptionHint: TGetHintCaptionEvent); virtual;
|
||||||
procedure SetResourceName(const aResourceName: string); virtual;
|
procedure SetResourceName(const aResourceName: string); virtual;
|
||||||
procedure ShortCutsUpdated(const {%H-}aShortCut, {%H-}aShortCutKey2: TShortCut); virtual;
|
procedure ShortCutsUpdated(const {%H-}aShortCut, {%H-}aShortCutKey2: TShortCut); virtual;
|
||||||
public
|
public
|
||||||
@ -672,6 +685,7 @@ type
|
|||||||
public
|
public
|
||||||
procedure DoOnClick; overload;
|
procedure DoOnClick; overload;
|
||||||
procedure DoOnClick(Sender: TObject); virtual; overload;
|
procedure DoOnClick(Sender: TObject); virtual; overload;
|
||||||
|
function DoOnRequestCaption(Sender: TObject): Boolean; virtual;
|
||||||
public
|
public
|
||||||
function GetCaptionWithShortCut: String; virtual;
|
function GetCaptionWithShortCut: String; virtual;
|
||||||
function GetHintOrCaptionWithShortCut: String; virtual;
|
function GetHintOrCaptionWithShortCut: String; virtual;
|
||||||
@ -689,6 +703,7 @@ type
|
|||||||
|
|
||||||
property OnClick: TNotifyEvent read FOnClickMethod write SetOnClickMethod;
|
property OnClick: TNotifyEvent read FOnClickMethod write SetOnClickMethod;
|
||||||
property OnClickProc: TNotifyProcedure read FOnClickProc write SetOnClickProc;
|
property OnClickProc: TNotifyProcedure read FOnClickProc write SetOnClickProc;
|
||||||
|
property OnRequestCaptionHint: TGetHintCaptionEvent read FOnRequestCaption write SetOnRequestCaption;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TIDESpecialCommandEnumerator = class
|
TIDESpecialCommandEnumerator = class
|
||||||
@ -1208,6 +1223,14 @@ begin
|
|||||||
Change;
|
Change;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TIDECommand.SetVisible(const AVisible: Boolean);
|
||||||
|
var
|
||||||
|
xUser: TIDESpecialCommand;
|
||||||
|
begin
|
||||||
|
for xUser in FUsers do
|
||||||
|
xUser.Visible := AVisible;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TIDECommand.UserAdded(const aUser: TIDESpecialCommand);
|
procedure TIDECommand.UserAdded(const aUser: TIDESpecialCommand);
|
||||||
begin
|
begin
|
||||||
FUsers.Add(aUser);
|
FUsers.Add(aUser);
|
||||||
@ -1294,6 +1317,14 @@ begin
|
|||||||
Change;
|
Change;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TIDECommand.SetEnabled(const AEnabled: Boolean);
|
||||||
|
var
|
||||||
|
xUser: TIDESpecialCommand;
|
||||||
|
begin
|
||||||
|
for xUser in FUsers do
|
||||||
|
xUser.Enabled := AEnabled;
|
||||||
|
end;
|
||||||
|
|
||||||
function TIDECommand.AsShortCut: TShortCut;
|
function TIDECommand.AsShortCut: TShortCut;
|
||||||
var
|
var
|
||||||
CurKey: TIDEShortCut;
|
CurKey: TIDEShortCut;
|
||||||
@ -1381,6 +1412,14 @@ begin
|
|||||||
and (CompareIDEShortCuts(@FShortcutB,@ACommand.FShortcutB)=0);
|
and (CompareIDEShortCuts(@FShortcutB,@ACommand.FShortcutB)=0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TIDECommand.SetCaption(const ACaption: string);
|
||||||
|
var
|
||||||
|
xUser: TIDESpecialCommand;
|
||||||
|
begin
|
||||||
|
for xUser in FUsers do
|
||||||
|
xUser.Caption := ACaption;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TIDECommand.ClearShortcutA;
|
procedure TIDECommand.ClearShortcutA;
|
||||||
begin
|
begin
|
||||||
ShortcutA:=CleanIDEShortCut;
|
ShortcutA:=CleanIDEShortCut;
|
||||||
@ -1418,23 +1457,24 @@ begin
|
|||||||
FCustomUpdateEvents.Add(TMethod(aEvent));
|
FCustomUpdateEvents.Add(TMethod(aEvent));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TIDECommands.ApplicationOnIdle(Sender: TObject; var Done: Boolean);
|
||||||
|
begin
|
||||||
|
if (FDontExecuteUpdateEventsUntil > 0) and (GetTickCount64 < FDontExecuteUpdateEventsUntil) then
|
||||||
|
Exit;
|
||||||
|
|
||||||
|
ExecuteUpdateEvents;
|
||||||
|
FDontExecuteUpdateEventsUntil := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TIDECommands.Create;
|
constructor TIDECommands.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
|
||||||
FCustomUpdateEvents := TMethodList.Create;
|
FCustomUpdateEvents := TMethodList.Create;
|
||||||
|
|
||||||
//Updating the commands needs time and CPU power (codetools are called for some commands)
|
|
||||||
// -> use TTimer with a reasonable interval and not Application.OnIdle
|
|
||||||
FUpdateTimer := TTimer.Create(nil);
|
|
||||||
FUpdateTimer.Interval := 500;
|
|
||||||
FUpdateTimer.OnTimer := @UpdateTimerTimer;
|
|
||||||
FUpdateTimer.Enabled := False;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TIDECommands.Destroy;
|
destructor TIDECommands.Destroy;
|
||||||
begin
|
begin
|
||||||
FUpdateTimer.Free;
|
|
||||||
FCustomUpdateEvents.Free;
|
FCustomUpdateEvents.Free;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -1455,18 +1495,14 @@ begin
|
|||||||
Categories[i].DoOnUpdate;
|
Categories[i].DoOnUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDECommands.UpdateTimerTimer(Sender: TObject);
|
procedure TIDECommands.CancelPostponeUpdateEvents;
|
||||||
begin
|
begin
|
||||||
ExecuteUpdateEvents;
|
FDontExecuteUpdateEventsUntil := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDECommands.PostponeUpdateEvents;
|
procedure TIDECommands.PostponeUpdateEvents;
|
||||||
begin
|
begin
|
||||||
if FUpdateTimer.Enabled then
|
FDontExecuteUpdateEventsUntil := GetTickCount64 + 500;
|
||||||
begin
|
|
||||||
FUpdateTimer.Enabled := False;
|
|
||||||
FUpdateTimer.Enabled := True;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDECommands.RemoveCustomUpdateEvent(const aEvent: TNotifyEvent);
|
procedure TIDECommands.RemoveCustomUpdateEvent(const aEvent: TNotifyEvent);
|
||||||
@ -1474,14 +1510,14 @@ begin
|
|||||||
FCustomUpdateEvents.Remove(TMethod(aEvent));
|
FCustomUpdateEvents.Remove(TMethod(aEvent));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDECommands.StartUpdateTimer;
|
procedure TIDECommands.StartUpdateEvents;
|
||||||
begin
|
begin
|
||||||
FUpdateTimer.Enabled := True;
|
Application.AddOnIdleHandler(@ApplicationOnIdle, False);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDECommands.StopUpdateTimer;
|
procedure TIDECommands.StopUpdateEvents;
|
||||||
begin
|
begin
|
||||||
FUpdateTimer.Enabled := False;
|
Application.RemoveOnIdleHandler(@ApplicationOnIdle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TIDESpecialCommand }
|
{ TIDESpecialCommand }
|
||||||
@ -1506,10 +1542,10 @@ end;
|
|||||||
procedure TIDESpecialCommand.DoOnClick(Sender: TObject);
|
procedure TIDESpecialCommand.DoOnClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if Assigned(FOnClickProc) then
|
if Assigned(FOnClickProc) then
|
||||||
FOnClickProc(Self)
|
FOnClickProc(Sender)
|
||||||
else
|
else
|
||||||
if Assigned(FOnClickMethod) then
|
if Assigned(FOnClickMethod) then
|
||||||
FOnClickMethod(Self);
|
FOnClickMethod(Sender);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDESpecialCommand.DoOnClick;
|
procedure TIDESpecialCommand.DoOnClick;
|
||||||
@ -1517,6 +1553,21 @@ begin
|
|||||||
DoOnClick(Self);
|
DoOnClick(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TIDESpecialCommand.DoOnRequestCaption(Sender: TObject): Boolean;
|
||||||
|
var
|
||||||
|
xCaption, xHint: string;
|
||||||
|
begin
|
||||||
|
Result := Assigned(FOnRequestCaption);
|
||||||
|
if Result then
|
||||||
|
begin
|
||||||
|
xCaption := Caption;
|
||||||
|
xHint := Hint;
|
||||||
|
FOnRequestCaption(Sender, xCaption, xHint);
|
||||||
|
Caption := xCaption;
|
||||||
|
Hint := xHint;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TIDESpecialCommand.GetCaption: string;
|
function TIDESpecialCommand.GetCaption: string;
|
||||||
begin
|
begin
|
||||||
if FCaption<>'' then
|
if FCaption<>'' then
|
||||||
@ -1657,6 +1708,19 @@ begin
|
|||||||
FCommand.OnExecuteProc:=aOnClickProc;
|
FCommand.OnExecuteProc:=aOnClickProc;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TIDESpecialCommand.SetOnRequestCaption(
|
||||||
|
const aOnRequestCaptionHint: TGetHintCaptionEvent);
|
||||||
|
var
|
||||||
|
xUser: TIDESpecialCommand;
|
||||||
|
begin
|
||||||
|
if FOnRequestCaption = aOnRequestCaptionHint then Exit;
|
||||||
|
FOnRequestCaption := aOnRequestCaptionHint;
|
||||||
|
if FCommand<> nil then
|
||||||
|
for xUser in FCommand.FUsers do
|
||||||
|
if xUser <> Self then
|
||||||
|
xUser.OnRequestCaptionHint:=aOnRequestCaptionHint;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TIDESpecialCommand.SetResourceName(const aResourceName: string);
|
procedure TIDESpecialCommand.SetResourceName(const aResourceName: string);
|
||||||
begin
|
begin
|
||||||
if aResourceName <> '' then
|
if aResourceName <> '' then
|
||||||
|
@ -1218,6 +1218,7 @@ begin
|
|||||||
i:=0;
|
i:=0;
|
||||||
while i<Count do begin
|
while i<Count do begin
|
||||||
Child:=Items[i];
|
Child:=Items[i];
|
||||||
|
Child.DoOnRequestCaption(Child);
|
||||||
if Child is TIDEMenuSection then
|
if Child is TIDEMenuSection then
|
||||||
TIDEMenuSection(Child).NotifySubSectionOnShow(Sender,false);
|
TIDEMenuSection(Child).NotifySubSectionOnShow(Sender,false);
|
||||||
inc(i);
|
inc(i);
|
||||||
|
@ -16,7 +16,7 @@ unit ToolBarIntf;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, ComCtrls, IDECommands, MenuIntf;
|
Classes, SysUtils, Controls, ComCtrls, IDECommands, MenuIntf;
|
||||||
|
|
||||||
type
|
type
|
||||||
TIDEToolButton = class;
|
TIDEToolButton = class;
|
||||||
@ -51,6 +51,8 @@ type
|
|||||||
TIDEToolButton = class(TToolButton)
|
TIDEToolButton = class(TToolButton)
|
||||||
private
|
private
|
||||||
FItem: TIDEButtonCommand;
|
FItem: TIDEButtonCommand;
|
||||||
|
protected
|
||||||
|
procedure DoOnShowHint(HintInfo: PHintInfo); override;
|
||||||
public
|
public
|
||||||
procedure DoOnAdded; virtual;
|
procedure DoOnAdded; virtual;
|
||||||
|
|
||||||
@ -475,5 +477,12 @@ begin
|
|||||||
//override in descendants
|
//override in descendants
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TIDEToolButton.DoOnShowHint(HintInfo: PHintInfo);
|
||||||
|
begin
|
||||||
|
inherited DoOnShowHint(HintInfo);
|
||||||
|
if Assigned(FItem) and FItem.DoOnRequestCaption(Self) then
|
||||||
|
HintInfo^.HintStr := FItem.GetHintOrCaptionWithShortCut;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
504
ide/main.pp
504
ide/main.pp
@ -48,7 +48,9 @@
|
|||||||
}
|
}
|
||||||
unit Main;
|
unit Main;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}
|
||||||
|
{$H+}
|
||||||
|
{$MODESWITCH ADVANCEDRECORDS}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
@ -165,6 +167,56 @@ type
|
|||||||
ctdUpdating
|
ctdUpdating
|
||||||
);
|
);
|
||||||
|
|
||||||
|
TFileCommandsStamp = record
|
||||||
|
private
|
||||||
|
SrcEdit: TSourceEditor;
|
||||||
|
public
|
||||||
|
function Changed(ASrcEdit: TSourceEditor): Boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TProjectCommandsStamp = record
|
||||||
|
private
|
||||||
|
UnitInfo: TUnitInfo;
|
||||||
|
ProjectChangeStamp: Int64;
|
||||||
|
public
|
||||||
|
function Changed(AUnitInfo: TUnitInfo): Boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TPackageCommandsStamp = record
|
||||||
|
private
|
||||||
|
UnitInfo: TUnitInfo;
|
||||||
|
PackagesChangeStamp: Int64;
|
||||||
|
public
|
||||||
|
function Changed(AUnitInfo: TUnitInfo): Boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TSourceEditorTabCommandsStamp = record
|
||||||
|
private
|
||||||
|
SrcEdit: TSourceEditor;
|
||||||
|
SrcEditLocked: Boolean;
|
||||||
|
SourceNotebook: TSourceNotebook;
|
||||||
|
PageIndex, PageCount: Integer;
|
||||||
|
public
|
||||||
|
function Changed(ASrcEdit: TSourceEditor): Boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TSourceEditorCommandsStamp = record
|
||||||
|
private
|
||||||
|
SrcEdit: TSourceEditor;
|
||||||
|
DisplayState: TDisplayState;
|
||||||
|
EditorComponentStamp: int64;
|
||||||
|
EditorCaretStamp: int64;
|
||||||
|
public
|
||||||
|
function Changed(ASrcEdit: TSourceEditor; ADisplayState: TDisplayState): Boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TBookmarkCommandsStamp = record
|
||||||
|
private
|
||||||
|
BookmarkChanged: Boolean;
|
||||||
|
public
|
||||||
|
function Changed: Boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TMainIDE }
|
{ TMainIDE }
|
||||||
|
|
||||||
TMainIDE = class(TMainIDEBase)
|
TMainIDE = class(TMainIDEBase)
|
||||||
@ -376,13 +428,21 @@ type
|
|||||||
// see helpmanager.pas
|
// see helpmanager.pas
|
||||||
|
|
||||||
// Handlers to update commands. Can disable sub-items etc.
|
// Handlers to update commands. Can disable sub-items etc.
|
||||||
|
private
|
||||||
|
UpdateFileCommandsStamp: TFileCommandsStamp;
|
||||||
|
UpdateProjectCommandsStamp: TProjectCommandsStamp;
|
||||||
|
UpdateEditorCommandsStamp: TSourceEditorCommandsStamp;
|
||||||
|
UpdateEditorTabCommandsStamp: TSourceEditorTabCommandsStamp;
|
||||||
|
UpdatePackageCommandsStamp: TPackageCommandsStamp;
|
||||||
|
UpdateBookmarkCommandsStamp: TBookmarkCommandsStamp;
|
||||||
|
public
|
||||||
procedure UpdateMainIDECommands(Sender: TObject);
|
procedure UpdateMainIDECommands(Sender: TObject);
|
||||||
procedure UpdateFileMenu(Sender: TObject); // file menu
|
procedure UpdateFileCommands(Sender: TObject);
|
||||||
procedure UpdateEditMenu(Sender: TObject); // edit menu
|
procedure UpdateEditorCommands(Sender: TObject);
|
||||||
procedure UpdateSourceMenu(Sender: TObject); // source menu
|
procedure UpdateBookmarkCommands(Sender: TObject);
|
||||||
procedure UpdateProjectMenu(Sender: TObject); // project menu
|
procedure UpdateEditorTabCommands(Sender: TObject);
|
||||||
procedure UpdateRunMenu(Sender: TObject); // run menu
|
procedure UpdateProjectCommands(Sender: TObject);
|
||||||
procedure UpdatePackageMenu(Sender: TObject); // package menu
|
procedure UpdatePackageCommands(Sender: TObject);
|
||||||
// see pkgmanager.pas
|
// see pkgmanager.pas
|
||||||
|
|
||||||
procedure mnuChgBuildModeClicked(Sender: TObject);
|
procedure mnuChgBuildModeClicked(Sender: TObject);
|
||||||
@ -974,6 +1034,106 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TBookmarkCommandsStamp }
|
||||||
|
|
||||||
|
function TBookmarkCommandsStamp.Changed: Boolean;
|
||||||
|
begin
|
||||||
|
Result := BookmarkChanged;
|
||||||
|
|
||||||
|
if not Result then
|
||||||
|
Exit;
|
||||||
|
|
||||||
|
BookmarkChanged := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TPackageCommandsStamp }
|
||||||
|
|
||||||
|
function TPackageCommandsStamp.Changed(AUnitInfo: TUnitInfo): Boolean;
|
||||||
|
var
|
||||||
|
xPackagesChangeStamp: Int64;
|
||||||
|
begin
|
||||||
|
xPackagesChangeStamp := PackageGraph.PackagesChangeStamp;
|
||||||
|
Result := not(
|
||||||
|
(UnitInfo = AUnitInfo)
|
||||||
|
and (PackagesChangeStamp = xPackagesChangeStamp)
|
||||||
|
);
|
||||||
|
|
||||||
|
if not Result then Exit;
|
||||||
|
|
||||||
|
UnitInfo := AUnitInfo;
|
||||||
|
PackagesChangeStamp := xPackagesChangeStamp;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TProjectCommandsStamp }
|
||||||
|
|
||||||
|
function TProjectCommandsStamp.Changed(AUnitInfo: TUnitInfo): Boolean;
|
||||||
|
begin
|
||||||
|
Result := not(
|
||||||
|
(UnitInfo = AUnitInfo)
|
||||||
|
and (ProjectChangeStamp = Project1.ChangeStamp)
|
||||||
|
);
|
||||||
|
|
||||||
|
if not Result then Exit;
|
||||||
|
|
||||||
|
UnitInfo := AUnitInfo;
|
||||||
|
ProjectChangeStamp := Project1.ChangeStamp;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TSourceEditorTabCommandsStamp }
|
||||||
|
|
||||||
|
function TSourceEditorTabCommandsStamp.Changed(ASrcEdit: TSourceEditor
|
||||||
|
): Boolean;
|
||||||
|
begin
|
||||||
|
Result := not(
|
||||||
|
(SrcEdit = ASrcEdit)
|
||||||
|
and (SrcEditLocked = ASrcEdit.IsLocked)
|
||||||
|
and (SourceNotebook = ASrcEdit.SourceNotebook)
|
||||||
|
and (PageIndex = ASrcEdit.SourceNotebook.PageIndex)
|
||||||
|
and (PageCount = ASrcEdit.SourceNotebook.PageCount)
|
||||||
|
);
|
||||||
|
|
||||||
|
if not Result then Exit;
|
||||||
|
|
||||||
|
SrcEdit := ASrcEdit;
|
||||||
|
SrcEditLocked := ASrcEdit.IsLocked;
|
||||||
|
SourceNotebook := ASrcEdit.SourceNotebook;
|
||||||
|
PageIndex := ASrcEdit.SourceNotebook.PageIndex;
|
||||||
|
PageCount := ASrcEdit.SourceNotebook.PageCount;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TFileCommandsStamp }
|
||||||
|
|
||||||
|
function TFileCommandsStamp.Changed(ASrcEdit: TSourceEditor): Boolean;
|
||||||
|
begin
|
||||||
|
Result := not(
|
||||||
|
(SrcEdit = ASrcEdit)
|
||||||
|
);
|
||||||
|
|
||||||
|
if not Result then Exit;
|
||||||
|
|
||||||
|
SrcEdit := ASrcEdit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TSourceEditorCommandsStamp }
|
||||||
|
|
||||||
|
function TSourceEditorCommandsStamp.Changed(ASrcEdit: TSourceEditor;
|
||||||
|
ADisplayState: TDisplayState): Boolean;
|
||||||
|
begin
|
||||||
|
Result := not(
|
||||||
|
(SrcEdit = ASrcEdit)
|
||||||
|
and (DisplayState = ADisplayState)
|
||||||
|
and (EditorComponentStamp = ASrcEdit.EditorComponent.ChangeStamp)
|
||||||
|
and (EditorCaretStamp = ASrcEdit.EditorComponent.CaretStamp)
|
||||||
|
);
|
||||||
|
|
||||||
|
if not Result then Exit;
|
||||||
|
|
||||||
|
SrcEdit := ASrcEdit;
|
||||||
|
DisplayState := ADisplayState;
|
||||||
|
EditorComponentStamp := ASrcEdit.EditorComponent.ChangeStamp;
|
||||||
|
EditorCaretStamp := ASrcEdit.EditorComponent.CaretStamp;
|
||||||
|
end;
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
|
||||||
@ -1570,7 +1730,7 @@ begin
|
|||||||
MainIDEBar.ApplicationIsActivate:=true;
|
MainIDEBar.ApplicationIsActivate:=true;
|
||||||
IDECommandList.AddCustomUpdateEvent(@UpdateMainIDECommands);
|
IDECommandList.AddCustomUpdateEvent(@UpdateMainIDECommands);
|
||||||
LazIDEInstances.StartListening(@LazInstancesStartNewInstance);
|
LazIDEInstances.StartListening(@LazInstancesStartNewInstance);
|
||||||
IDECommandList.StartUpdateTimer;
|
IDECommandList.StartUpdateEvents;
|
||||||
FIDEStarted:=true;
|
FIDEStarted:=true;
|
||||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.StartIDE END');{$ENDIF}
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.StartIDE END');{$ENDIF}
|
||||||
end;
|
end;
|
||||||
@ -1966,7 +2126,7 @@ procedure TMainIDE.MainIDEFormClose(Sender: TObject;
|
|||||||
var CloseAction: TCloseAction);
|
var CloseAction: TCloseAction);
|
||||||
begin
|
begin
|
||||||
LazIDEInstances.StopServer;
|
LazIDEInstances.StopServer;
|
||||||
IDECommandList.StopUpdateTimer;
|
IDECommandList.StopUpdateEvents;
|
||||||
DoCallNotifyHandler(lihtIDEClose);
|
DoCallNotifyHandler(lihtIDEClose);
|
||||||
SaveEnvironment(true);
|
SaveEnvironment(true);
|
||||||
if IDEDockMaster<>nil then
|
if IDEDockMaster<>nil then
|
||||||
@ -2490,7 +2650,6 @@ end;
|
|||||||
procedure TMainIDE.SetupFileMenu;
|
procedure TMainIDE.SetupFileMenu;
|
||||||
begin
|
begin
|
||||||
inherited SetupFileMenu;
|
inherited SetupFileMenu;
|
||||||
mnuFile.OnClick:=@UpdateFileMenu;
|
|
||||||
with MainIDEBar do begin
|
with MainIDEBar do begin
|
||||||
itmFileNewUnit.OnClick := @mnuNewUnitClicked;
|
itmFileNewUnit.OnClick := @mnuNewUnitClicked;
|
||||||
itmFileNewForm.OnClick := @mnuNewFormClicked;
|
itmFileNewForm.OnClick := @mnuNewFormClicked;
|
||||||
@ -2515,7 +2674,6 @@ end;
|
|||||||
procedure TMainIDE.SetupEditMenu;
|
procedure TMainIDE.SetupEditMenu;
|
||||||
begin
|
begin
|
||||||
inherited SetupEditMenu;
|
inherited SetupEditMenu;
|
||||||
mnuEdit.OnClick:=@UpdateEditMenu;
|
|
||||||
with MainIDEBar do begin
|
with MainIDEBar do begin
|
||||||
itmEditUndo.OnClick:=@mnuEditUndoClicked;
|
itmEditUndo.OnClick:=@mnuEditUndoClicked;
|
||||||
itmEditRedo.OnClick:=@mnuEditRedoClicked;
|
itmEditRedo.OnClick:=@mnuEditRedoClicked;
|
||||||
@ -2579,7 +2737,6 @@ end;
|
|||||||
procedure TMainIDE.SetupSourceMenu;
|
procedure TMainIDE.SetupSourceMenu;
|
||||||
begin
|
begin
|
||||||
inherited SetupSourceMenu;
|
inherited SetupSourceMenu;
|
||||||
mnuSource.OnClick:=@UpdateSourceMenu;
|
|
||||||
with MainIDEBar do begin
|
with MainIDEBar do begin
|
||||||
itmSourceCommentBlock.OnClick:=@mnuSourceCommentBlockClicked;
|
itmSourceCommentBlock.OnClick:=@mnuSourceCommentBlockClicked;
|
||||||
itmSourceUncommentBlock.OnClick:=@mnuSourceUncommentBlockClicked;
|
itmSourceUncommentBlock.OnClick:=@mnuSourceUncommentBlockClicked;
|
||||||
@ -2637,7 +2794,6 @@ end;
|
|||||||
procedure TMainIDE.SetupProjectMenu;
|
procedure TMainIDE.SetupProjectMenu;
|
||||||
begin
|
begin
|
||||||
inherited SetupProjectMenu;
|
inherited SetupProjectMenu;
|
||||||
mnuProject.OnClick:=@UpdateProjectMenu;
|
|
||||||
with MainIDEBar do begin
|
with MainIDEBar do begin
|
||||||
itmProjectNew.OnClick := @mnuNewProjectClicked;
|
itmProjectNew.OnClick := @mnuNewProjectClicked;
|
||||||
itmProjectNewFromFile.OnClick := @mnuNewProjectFromFileClicked;
|
itmProjectNewFromFile.OnClick := @mnuNewProjectFromFileClicked;
|
||||||
@ -2661,7 +2817,6 @@ end;
|
|||||||
procedure TMainIDE.SetupRunMenu;
|
procedure TMainIDE.SetupRunMenu;
|
||||||
begin
|
begin
|
||||||
inherited SetupRunMenu;
|
inherited SetupRunMenu;
|
||||||
mnuRun.OnClick:=@UpdateRunMenu;
|
|
||||||
with MainIDEBar do begin
|
with MainIDEBar do begin
|
||||||
itmRunMenuCompile.OnClick := @mnuCompileProjectClicked;
|
itmRunMenuCompile.OnClick := @mnuCompileProjectClicked;
|
||||||
itmRunMenuBuild.OnClick := @mnuBuildProjectClicked;
|
itmRunMenuBuild.OnClick := @mnuBuildProjectClicked;
|
||||||
@ -2689,7 +2844,6 @@ end;
|
|||||||
procedure TMainIDE.SetupPackageMenu;
|
procedure TMainIDE.SetupPackageMenu;
|
||||||
begin
|
begin
|
||||||
inherited SetupPackageMenu;
|
inherited SetupPackageMenu;
|
||||||
mnuPackage.OnClick:=@UpdatePackageMenu;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.SetupToolsMenu;
|
procedure TMainIDE.SetupToolsMenu;
|
||||||
@ -3543,95 +3697,58 @@ end;
|
|||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
|
|
||||||
procedure TMainIDE.UpdateFileMenu(Sender: TObject);
|
procedure TMainIDE.UpdateFileCommands(Sender: TObject);
|
||||||
var
|
var
|
||||||
ASrcEdit: TSourceEditor;
|
ASrcEdit: TSourceEditor;
|
||||||
AnUnitInfo: TUnitInfo;
|
AnUnitInfo: TUnitInfo;
|
||||||
begin
|
begin
|
||||||
GetCurrentUnit(ASrcEdit,AnUnitInfo);
|
GetCurrentUnit(ASrcEdit,AnUnitInfo);
|
||||||
with MainIDEBar do begin
|
if not UpdateFileCommandsStamp.Changed(ASrcEdit) then
|
||||||
itmFileClose.Enabled := ASrcEdit<>nil;
|
Exit;
|
||||||
itmFileCloseAll.Enabled := ASrcEdit<>nil;
|
|
||||||
end;
|
IDECommandList.FindIDECommand(ecClose).Enabled := ASrcEdit<>nil;
|
||||||
|
IDECommandList.FindIDECommand(ecCloseAll).Enabled := ASrcEdit<>nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.UpdateMainIDECommands(Sender: TObject);
|
procedure TMainIDE.UpdateMainIDECommands(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
UpdateFileMenu(Sender);
|
UpdateFileCommands(Sender);
|
||||||
UpdateEditMenu(Sender);
|
UpdateEditorCommands(Sender);
|
||||||
UpdateSourceMenu(Sender);
|
UpdateBookmarkCommands(Sender);
|
||||||
UpdateProjectMenu(Sender);
|
UpdateEditorTabCommands(Sender);
|
||||||
UpdateRunMenu(Sender);
|
UpdateProjectCommands(Sender);
|
||||||
UpdatePackageMenu(Sender);
|
UpdatePackageCommands(Sender);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.UpdateEditMenu(Sender: TObject);
|
procedure TMainIDE.UpdateEditorCommands(Sender: TObject);
|
||||||
var
|
var
|
||||||
ASrcEdit: TSourceEditor;
|
ASrcEdit: TSourceEditor;
|
||||||
AnUnitInfo: TUnitInfo;
|
AnUnitInfo: TUnitInfo;
|
||||||
Editable: Boolean;
|
Editable: Boolean;
|
||||||
SelAvail: Boolean;
|
SelAvail: Boolean;
|
||||||
SelEditable: Boolean;
|
SelEditable: Boolean;
|
||||||
SrcEditorActive, DsgEditorActive: Boolean;
|
SrcEditorActive, DsgEditorActive, StringFound, IdentFound: Boolean;
|
||||||
ActiveDesigner: TComponentEditorDesigner;
|
ActiveDesigner: TComponentEditorDesigner;
|
||||||
|
xAttr: TSynHighlighterAttributes;
|
||||||
|
xToken, CurWordAtCursor: string;
|
||||||
begin
|
begin
|
||||||
GetCurrentUnit(ASrcEdit, AnUnitInfo);
|
GetCurrentUnit(ASrcEdit, AnUnitInfo);
|
||||||
|
if not UpdateEditorCommandsStamp.Changed(ASrcEdit, DisplayState) then
|
||||||
|
Exit;
|
||||||
|
|
||||||
Editable := Assigned(ASrcEdit) and not ASrcEdit.ReadOnly;
|
Editable := Assigned(ASrcEdit) and not ASrcEdit.ReadOnly;
|
||||||
SelAvail := Assigned(ASrcEdit) and ASrcEdit.SelectionAvailable;
|
SelAvail := Assigned(ASrcEdit) and ASrcEdit.SelectionAvailable;
|
||||||
SelEditable := Editable and SelAvail;
|
SelEditable := Editable and SelAvail;
|
||||||
SrcEditorActive := DisplayState = dsSource;
|
SrcEditorActive := DisplayState = dsSource;
|
||||||
DsgEditorActive := DisplayState = dsForm;
|
DsgEditorActive := DisplayState = dsForm;
|
||||||
ActiveDesigner := GetActiveDesignerSkipMainBar;
|
ActiveDesigner := GetActiveDesignerSkipMainBar;
|
||||||
with MainIDEBar do
|
|
||||||
begin
|
|
||||||
if Assigned(ActiveDesigner) then
|
|
||||||
begin
|
|
||||||
// activate them when Designer start to support Undo/Redo
|
|
||||||
itmEditUndo.Enabled := DsgEditorActive and ActiveDesigner.CanUndo; {and not ActiveDesigner.ReadOnly}
|
|
||||||
itmEditRedo.Enabled := DsgEditorActive and ActiveDesigner.CanRedo; {and not ActiveDesigner.ReadOnly}
|
|
||||||
itmEditCut.Enabled := ActiveDesigner.CanCopy;
|
|
||||||
itmEditCopy.Enabled := itmEditCut.Enabled;
|
|
||||||
itmEditPaste.Enabled := ActiveDesigner.CanPaste;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
itmEditUndo.Enabled := Editable and SrcEditorActive and ASrcEdit.EditorComponent.CanUndo;
|
|
||||||
itmEditRedo.Enabled := Editable and SrcEditorActive and ASrcEdit.EditorComponent.CanRedo;
|
|
||||||
itmEditCut.Enabled := SelEditable;
|
|
||||||
itmEditCopy.Enabled := SelAvail;
|
|
||||||
itmEditPaste.Enabled := Editable;
|
|
||||||
end;
|
|
||||||
//itmEditSelect: TIDEMenuSection; [...]
|
|
||||||
//itmEditBlockActions: TIDEMenuSection;
|
|
||||||
itmEditIndentBlock.Enabled := Editable;
|
|
||||||
itmEditUnindentBlock.Enabled := Editable;
|
|
||||||
itmEditUpperCaseBlock.Enabled := SelEditable;
|
|
||||||
itmEditLowerCaseBlock.Enabled := SelEditable;
|
|
||||||
itmEditSwapCaseBlock.Enabled := SelEditable;
|
|
||||||
itmEditSortBlock.Enabled := SelEditable;
|
|
||||||
itmEditTabsToSpacesBlock.Enabled := SelEditable;
|
|
||||||
itmEditSelectionBreakLines.Enabled := SelEditable;
|
|
||||||
itmEditInsertCharacter.Enabled := Editable;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TMainIDE.UpdateSourceMenu(Sender: TObject);
|
|
||||||
var
|
|
||||||
ASrcEdit: TSourceEditor;
|
|
||||||
AnUnitInfo: TUnitInfo;
|
|
||||||
Editable, SelEditable, SelAvail, IdentFound, StringFound: Boolean;
|
|
||||||
xToken: string;
|
|
||||||
xAttr: TSynHighlighterAttributes;
|
|
||||||
begin
|
|
||||||
Editable:=False;
|
|
||||||
SelAvail:=False;
|
|
||||||
StringFound := False;
|
StringFound := False;
|
||||||
IdentFound := False;
|
IdentFound := False;
|
||||||
GetCurrentUnit(ASrcEdit,AnUnitInfo);
|
CurWordAtCursor := '';
|
||||||
if ASrcEdit<>nil then
|
if ASrcEdit<>nil then
|
||||||
begin
|
begin
|
||||||
Editable:=not ASrcEdit.ReadOnly;
|
CurWordAtCursor := ASrcEdit.GetWordAtCurrentCaret;
|
||||||
SelAvail:=ASrcEdit.SelectionAvailable;
|
|
||||||
//it is faster to get information from SynEdit than from CodeTools
|
//it is faster to get information from SynEdit than from CodeTools
|
||||||
if ASrcEdit.EditorComponent.GetHighlighterAttriAtRowCol(ASrcEdit.EditorComponent.CaretXY, xToken, xAttr) then
|
if ASrcEdit.EditorComponent.GetHighlighterAttriAtRowCol(ASrcEdit.EditorComponent.CaretXY, xToken, xAttr) then
|
||||||
begin
|
begin
|
||||||
@ -3639,70 +3756,153 @@ begin
|
|||||||
IdentFound := xAttr = ASrcEdit.EditorComponent.Highlighter.IdentifierAttribute;
|
IdentFound := xAttr = ASrcEdit.EditorComponent.Highlighter.IdentifierAttribute;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
SelEditable:=Editable and SelAvail;
|
|
||||||
with MainIDEBar do begin
|
if Assigned(ActiveDesigner) then
|
||||||
//itmSourceBlockActions
|
begin
|
||||||
itmSourceCommentBlock.Enabled:=SelEditable;
|
IDECommandList.FindIDECommand(ecUndo).Enabled := DsgEditorActive and ActiveDesigner.CanUndo; {and not ActiveDesigner.ReadOnly}
|
||||||
itmSourceUncommentBlock.Enabled:=SelEditable;
|
IDECommandList.FindIDECommand(ecRedo).Enabled := DsgEditorActive and ActiveDesigner.CanRedo; {and not ActiveDesigner.ReadOnly}
|
||||||
itmSourceEncloseBlock.Enabled:=SelEditable;
|
IDECommandList.FindIDECommand(ecCut).Enabled := ActiveDesigner.CanCopy;
|
||||||
itmSourceEncloseInIFDEF.Enabled:=SelEditable;
|
IDECommandList.FindIDECommand(ecCopy).Enabled := ActiveDesigner.CanCopy;
|
||||||
itmSourceCompleteCode.Enabled:=Editable;
|
IDECommandList.FindIDECommand(ecPaste).Enabled := ActiveDesigner.CanPaste;
|
||||||
itmSourceUseUnit.Enabled:=Editable;
|
IDECommandList.FindIDECommand(ecSelectAll).Enabled := Assigned(ActiveDesigner.Form) and (ActiveDesigner.Form.ComponentCount>0);
|
||||||
//itmSourceInsertions
|
end
|
||||||
//itmSourceInsertCVSKeyWord
|
else
|
||||||
itmSourceInsertCVSAuthor.Enabled:=Editable;
|
begin
|
||||||
itmSourceInsertCVSDate.Enabled:=Editable;
|
IDECommandList.FindIDECommand(ecUndo).Enabled := Editable and SrcEditorActive and Assigned(ASrcEdit) and ASrcEdit.EditorComponent.CanUndo;
|
||||||
itmSourceInsertCVSHeader.Enabled:=Editable;
|
IDECommandList.FindIDECommand(ecRedo).Enabled := Editable and SrcEditorActive and Assigned(ASrcEdit) and ASrcEdit.EditorComponent.CanRedo;
|
||||||
itmSourceInsertCVSID.Enabled:=Editable;
|
IDECommandList.FindIDECommand(ecCut).Enabled := SelEditable;
|
||||||
itmSourceInsertCVSLog.Enabled:=Editable;
|
IDECommandList.FindIDECommand(ecCopy).Enabled := SelAvail;
|
||||||
itmSourceInsertCVSName.Enabled:=Editable;
|
IDECommandList.FindIDECommand(ecPaste).Enabled := Editable;
|
||||||
itmSourceInsertCVSRevision.Enabled:=Editable;
|
IDECommandList.FindIDECommand(ecSelectAll).Enabled := Assigned(ASrcEdit) and (ASrcEdit.SourceText<>'');
|
||||||
itmSourceInsertCVSSource.Enabled:=Editable;
|
|
||||||
//itmSourceInsertGeneral
|
|
||||||
itmSourceInsertGPLNotice.Enabled:=Editable;
|
|
||||||
itmSourceInsertGPLNoticeTranslated.Visible:=
|
|
||||||
Editable and (EnglishGPLNotice<>lisGPLNotice);
|
|
||||||
itmSourceInsertLGPLNotice.Enabled:=Editable;
|
|
||||||
itmSourceInsertLGPLNoticeTranslated.Visible:=
|
|
||||||
Editable and (EnglishLGPLNotice<>lisLGPLNotice);
|
|
||||||
itmSourceInsertModifiedLGPLNotice.Enabled:=Editable;
|
|
||||||
itmSourceInsertModifiedLGPLNoticeTranslated.Visible:=
|
|
||||||
Editable and (EnglishModifiedLGPLNotice<>lisModifiedLGPLNotice);
|
|
||||||
itmSourceInsertMITNotice.Enabled:=Editable;
|
|
||||||
itmSourceInsertMITNoticeTranslated.Visible:=
|
|
||||||
Editable and (EnglishMITNotice<>lisMITNotice);
|
|
||||||
itmSourceInsertUsername.Enabled:=Editable;
|
|
||||||
itmSourceInsertDateTime.Enabled:=Editable;
|
|
||||||
itmSourceInsertChangeLogEntry.Enabled:=Editable;
|
|
||||||
//itmSourceRefactor
|
|
||||||
//itmRefactorCodeTools
|
|
||||||
itmRefactorRenameIdentifier.Enabled:=Editable and IdentFound;
|
|
||||||
itmRefactorExtractProc.Enabled:=Editable and SelAvail;
|
|
||||||
itmRefactorInvertAssignment.Enabled:=Editable and SelAvail;
|
|
||||||
//itmRefactorAdvanced
|
|
||||||
itmRefactorMakeResourceString.Enabled:=Editable and StringFound;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.UpdateProjectMenu(Sender: TObject);
|
IDECommandList.FindIDECommand(ecBlockIndent).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecBlockUnindent).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecSelectionUpperCase).Enabled := SelEditable;
|
||||||
|
IDECommandList.FindIDECommand(ecSelectionLowerCase).Enabled := SelEditable;
|
||||||
|
IDECommandList.FindIDECommand(ecSelectionSwapCase).Enabled := SelEditable;
|
||||||
|
IDECommandList.FindIDECommand(ecSelectionSort).Enabled := SelEditable;
|
||||||
|
IDECommandList.FindIDECommand(ecSelectionTabs2Spaces).Enabled := SelEditable;
|
||||||
|
IDECommandList.FindIDECommand(ecSelectionBreakLines).Enabled := SelEditable;
|
||||||
|
IDECommandList.FindIDECommand(ecSelectionComment).Enabled := SelEditable;
|
||||||
|
IDECommandList.FindIDECommand(ecSelectionUnComment).Enabled := SelEditable;
|
||||||
|
IDECommandList.FindIDECommand(ecSelectionEnclose).Enabled := SelEditable;
|
||||||
|
IDECommandList.FindIDECommand(ecSelectionEncloseIFDEF).Enabled := SelEditable;
|
||||||
|
|
||||||
|
IDECommandList.FindIDECommand(ecInsertCharacter).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecCompleteCode).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecUseUnit).Enabled := Editable;
|
||||||
|
|
||||||
|
IDECommandList.FindIDECommand(ecInsertCVSAuthor).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecInsertCVSDate).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecInsertCVSHeader).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecInsertCVSID).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecInsertCVSLog).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecInsertCVSName).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecInsertCVSRevision).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecInsertCVSSource).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecInsertGPLNotice).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecInsertGPLNoticeTranslated).Visible := Editable and (EnglishGPLNotice<>lisGPLNotice);
|
||||||
|
IDECommandList.FindIDECommand(ecInsertLGPLNotice).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecInsertLGPLNoticeTranslated).Visible := Editable and (EnglishLGPLNotice<>lisLGPLNotice);
|
||||||
|
IDECommandList.FindIDECommand(ecInsertModifiedLGPLNotice).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecInsertModifiedLGPLNoticeTranslated).Visible := Editable and (EnglishModifiedLGPLNotice<>lisModifiedLGPLNotice);
|
||||||
|
IDECommandList.FindIDECommand(ecInsertMITNotice).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecInsertMITNoticeTranslated).Visible := Editable and (EnglishMITNotice<>lisMITNotice);
|
||||||
|
IDECommandList.FindIDECommand(ecInsertUserName).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecInsertDateTime).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecInsertChangeLogEntry).Enabled := Editable;
|
||||||
|
|
||||||
|
IDECommandList.FindIDECommand(ecRenameIdentifier).Enabled := Editable and IdentFound;
|
||||||
|
IDECommandList.FindIDECommand(ecExtractProc).Enabled := SelEditable;
|
||||||
|
IDECommandList.FindIDECommand(ecInvertAssignment).Enabled := SelEditable;
|
||||||
|
IDECommandList.FindIDECommand(ecMakeResourceString).Enabled := Editable and StringFound;
|
||||||
|
IDECommandList.FindIDECommand(ecFindIdentifierRefs).Enabled := IdentFound;
|
||||||
|
IDECommandList.FindIDECommand(ecFindUsedUnitRefs).Enabled := IdentFound;
|
||||||
|
IDECommandList.FindIDECommand(ecFindOverloads).Enabled := IdentFound;
|
||||||
|
IDECommandList.FindIDECommand(ecShowAbstractMethods).Enabled := Editable;
|
||||||
|
IDECommandList.FindIDECommand(ecRemoveEmptyMethods).Enabled := Editable;
|
||||||
|
|
||||||
|
IDECommandList.FindIDECommand(ecFindDeclaration).Enabled := CurWordAtCursor<>'';
|
||||||
|
if CurWordAtCursor<>'' then
|
||||||
|
IDECommandList.FindIDECommand(ecFindDeclaration).Caption :=
|
||||||
|
Format(lisFindDeclarationOf, [CurWordAtCursor])
|
||||||
|
else
|
||||||
|
IDECommandList.FindIDECommand(ecFindDeclaration).Caption :=
|
||||||
|
uemFindDeclaration;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.UpdateEditorTabCommands(Sender: TObject);
|
||||||
|
var
|
||||||
|
ASrcEdit: TSourceEditor;
|
||||||
|
AnUnitInfo: TUnitInfo;
|
||||||
|
|
||||||
|
{$IFnDEF SingleSrcWindow}
|
||||||
|
function ToWindow(WinForFind: Boolean = False): Boolean;
|
||||||
|
var
|
||||||
|
i, ThisWin, SharedEditor: Integer;
|
||||||
|
nb: TSourceNotebook;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
ThisWin := SourceEditorManager.IndexOfSourceWindow(ASrcEdit.SourceNotebook);
|
||||||
|
for i := 0 to SourceEditorManager.SourceWindowCount - 1 do begin
|
||||||
|
nb:=SourceEditorManager.SourceWindows[i];
|
||||||
|
SharedEditor:=nb.IndexOfEditorInShareWith(ASrcEdit);
|
||||||
|
if (i <> ThisWin) and ((SharedEditor < 0) <> WinForFind) then begin
|
||||||
|
Result := True;
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
var
|
||||||
|
NBAvail: Boolean;
|
||||||
|
PageIndex, PageCount: Integer;
|
||||||
|
begin
|
||||||
|
GetCurrentUnit(ASrcEdit, AnUnitInfo);
|
||||||
|
if not UpdateEditorTabCommandsStamp.Changed(ASrcEdit) then
|
||||||
|
Exit;
|
||||||
|
|
||||||
|
PageIndex := ASrcEdit.SourceNotebook.PageIndex;
|
||||||
|
PageCount := ASrcEdit.SourceNotebook.PageCount;
|
||||||
|
|
||||||
|
{$IFnDEF SingleSrcWindow}
|
||||||
|
SrcEditMenuEditorLock.Checked := ASrcEdit.IsLocked; // Editor locks
|
||||||
|
// Multi win
|
||||||
|
NBAvail := ToWindow();
|
||||||
|
SrcEditMenuMoveToNewWindow.Visible := not NBAvail;
|
||||||
|
SrcEditMenuMoveToNewWindow.Enabled := PageCount > 1;
|
||||||
|
SrcEditMenuMoveToOtherWindow.Visible := NBAvail;
|
||||||
|
SrcEditMenuMoveToOtherWindowNew.Enabled := PageCount > 1;
|
||||||
|
|
||||||
|
SrcEditMenuCopyToNewWindow.Visible := not NBAvail;
|
||||||
|
SrcEditMenuCopyToOtherWindow.Visible := NBAvail;
|
||||||
|
|
||||||
|
SrcEditMenuFindInOtherWindow.Enabled := NBAvail;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// editor layout
|
||||||
|
SrcEditMenuMoveEditorLeft.Enabled:= (PageCount>1);
|
||||||
|
SrcEditMenuMoveEditorRight.Enabled:= (PageCount>1);
|
||||||
|
SrcEditMenuMoveEditorFirst.Enabled:= (PageCount>1) and (PageIndex>0);
|
||||||
|
SrcEditMenuMoveEditorLast.Enabled:= (PageCount>1) and (PageIndex<(PageCount-1));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.UpdateProjectCommands(Sender: TObject);
|
||||||
var
|
var
|
||||||
ASrcEdit: TSourceEditor;
|
ASrcEdit: TSourceEditor;
|
||||||
AUnitInfo: TUnitInfo;
|
AUnitInfo: TUnitInfo;
|
||||||
NotPartOfProj: Boolean;
|
|
||||||
begin
|
begin
|
||||||
GetCurrentUnit(ASrcEdit,AUnitInfo);
|
GetCurrentUnit(ASrcEdit,AUnitInfo);
|
||||||
NotPartOfProj:=Assigned(AUnitInfo) and not AUnitInfo.IsPartOfProject;
|
if not UpdateProjectCommandsStamp.Changed(AUnitInfo) then
|
||||||
MainIDEBar.itmProjectAddTo.Enabled:=NotPartOfProj;
|
Exit;
|
||||||
|
|
||||||
|
IDECommandList.FindIDECommand(ecAddCurUnitToProj).Enabled:=Assigned(AUnitInfo) and not AUnitInfo.IsPartOfProject;
|
||||||
|
IDECommandList.FindIDECommand(ecBuildManyModes).Enabled:=Project1.BuildModes.Count>1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.UpdateRunMenu(Sender: TObject);
|
procedure TMainIDE.UpdatePackageCommands(Sender: TObject);
|
||||||
begin
|
|
||||||
with MainIDEBar do begin
|
|
||||||
itmRunMenuBuildManyModes.Enabled:=Project1.BuildModes.Count>1;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TMainIDE.UpdatePackageMenu(Sender: TObject);
|
|
||||||
var
|
var
|
||||||
ASrcEdit: TSourceEditor;
|
ASrcEdit: TSourceEditor;
|
||||||
AUnitInfo: TUnitInfo;
|
AUnitInfo: TUnitInfo;
|
||||||
@ -3710,6 +3910,13 @@ var
|
|||||||
CanOpenPkgOfFile, CanAddCurFile: Boolean;
|
CanOpenPkgOfFile, CanAddCurFile: Boolean;
|
||||||
begin
|
begin
|
||||||
GetCurrentUnit(ASrcEdit,AUnitInfo);
|
GetCurrentUnit(ASrcEdit,AUnitInfo);
|
||||||
|
if Assigned(AUnitInfo) then
|
||||||
|
else
|
||||||
|
PkgFile := nil;
|
||||||
|
|
||||||
|
if not UpdatePackageCommandsStamp.Changed(AUnitInfo) then
|
||||||
|
Exit;
|
||||||
|
|
||||||
if Assigned(AUnitInfo) then
|
if Assigned(AUnitInfo) then
|
||||||
begin
|
begin
|
||||||
PkgFile:=PackageGraph.FindFileInAllPackages(AUnitInfo.Filename,true,
|
PkgFile:=PackageGraph.FindFileInAllPackages(AUnitInfo.Filename,true,
|
||||||
@ -7895,6 +8102,42 @@ begin
|
|||||||
Application.BringToFront;
|
Application.BringToFront;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.UpdateBookmarkCommands(Sender: TObject);
|
||||||
|
var
|
||||||
|
se: TSourceEditor;
|
||||||
|
MarkDesc: string;
|
||||||
|
MarkComand: TIDECommand;
|
||||||
|
BookMarkID, i, BookMarkX, BookMarkY: Integer;
|
||||||
|
BookmarkAvail: Boolean;
|
||||||
|
begin
|
||||||
|
if not UpdateBookmarkCommandsStamp.Changed then
|
||||||
|
Exit;
|
||||||
|
|
||||||
|
for BookMarkID:=0 to 9 do begin
|
||||||
|
MarkDesc:=' '+IntToStr(BookMarkID);
|
||||||
|
BookmarkAvail:=False;
|
||||||
|
i := 0;
|
||||||
|
while i < SourceEditorManager.SourceEditorCount do begin
|
||||||
|
se:=SourceEditorManager.SourceEditors[i];
|
||||||
|
BookMarkX:=0; BookMarkY:=0;
|
||||||
|
if se.EditorComponent.GetBookMark(BookMarkID,BookMarkX,BookMarkY) then
|
||||||
|
begin
|
||||||
|
MarkDesc:=MarkDesc+': '+se.PageName+' ('+IntToStr(BookMarkY)+','+IntToStr(BookMarkX)+')';
|
||||||
|
BookmarkAvail:=True;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
// goto book mark item
|
||||||
|
MarkComand:=IDECommandList.FindIDECommand(ecGotoMarker0+BookMarkID);
|
||||||
|
MarkComand.Caption:=uemBookmarkN+MarkDesc;
|
||||||
|
MarkComand.Enabled:=BookmarkAvail;
|
||||||
|
// set book mark item
|
||||||
|
MarkComand:=IDECommandList.FindIDECommand(ecToggleMarker0+BookMarkID);
|
||||||
|
MarkComand.Caption:=uemToggleBookmark+MarkDesc;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.SaveIncludeLinks;
|
procedure TMainIDE.SaveIncludeLinks;
|
||||||
var
|
var
|
||||||
AFilename: string;
|
AFilename: string;
|
||||||
@ -10167,7 +10410,6 @@ end;
|
|||||||
procedure TMainIDE.OnSrcNotebookEditorDoSetBookmark(Sender: TObject; ID: Integer; Toggle: Boolean);
|
procedure TMainIDE.OnSrcNotebookEditorDoSetBookmark(Sender: TObject; ID: Integer; Toggle: Boolean);
|
||||||
var
|
var
|
||||||
ActEdit, OldEdit: TSourceEditor;
|
ActEdit, OldEdit: TSourceEditor;
|
||||||
Cmd: TIDEMenuCommand;
|
|
||||||
OldX, OldY: integer;
|
OldX, OldY: integer;
|
||||||
NewXY: TPoint;
|
NewXY: TPoint;
|
||||||
SetMark: Boolean;
|
SetMark: Boolean;
|
||||||
@ -10197,8 +10439,8 @@ Begin
|
|||||||
end;
|
end;
|
||||||
if SetMark then
|
if SetMark then
|
||||||
ActEdit.EditorComponent.SetBookMark(ID,NewXY.X,NewXY.Y);
|
ActEdit.EditorComponent.SetBookMark(ID,NewXY.X,NewXY.Y);
|
||||||
Cmd:=SrcEditSubMenuToggleBookmarks[ID] as TIDEMenuCommand;
|
|
||||||
Cmd.Checked := SetMark;
|
UpdateBookmarkCommandsStamp.BookmarkChanged := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.OnSrcNotebookEditorDoGotoBookmark(Sender: TObject; ID: Integer; Backward: Boolean);
|
procedure TMainIDE.OnSrcNotebookEditorDoGotoBookmark(Sender: TObject; ID: Integer; Backward: Boolean);
|
||||||
|
@ -252,8 +252,6 @@ type
|
|||||||
procedure EditorMouseMoved(Sender: TObject; Shift: TShiftState; X,Y:Integer);
|
procedure EditorMouseMoved(Sender: TObject; Shift: TShiftState; X,Y:Integer);
|
||||||
procedure EditorMouseDown(Sender: TObject; Button: TMouseButton;
|
procedure EditorMouseDown(Sender: TObject; Button: TMouseButton;
|
||||||
Shift: TShiftState; X,Y: Integer);
|
Shift: TShiftState; X,Y: Integer);
|
||||||
procedure EditorMouseUp(Sender: TObject; {%H-}Button: TMouseButton;
|
|
||||||
{%H-}Shift: TShiftState; {%H-}X,{%H-}Y: Integer);
|
|
||||||
procedure EditorMouseWheel(Sender: TObject; Shift: TShiftState;
|
procedure EditorMouseWheel(Sender: TObject; Shift: TShiftState;
|
||||||
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
||||||
procedure EditorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure EditorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
@ -581,14 +579,6 @@ type
|
|||||||
|
|
||||||
TBrowseEditorTabHistoryDialog = class;
|
TBrowseEditorTabHistoryDialog = class;
|
||||||
|
|
||||||
TSrcPopupMenuItemsStamp = record
|
|
||||||
SrcEdit: TSourceEditor;
|
|
||||||
EditorComponentStamp: int64;
|
|
||||||
FileStateStamp: int64;
|
|
||||||
SourceCacheStamp: int64;
|
|
||||||
DefinesStep: integer;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TSourceNotebook }
|
{ TSourceNotebook }
|
||||||
|
|
||||||
TSourceNotebook = class(TSourceEditorWindowInterface)
|
TSourceNotebook = class(TSourceEditorWindowInterface)
|
||||||
@ -622,19 +612,16 @@ type
|
|||||||
procedure SrcEditMenuFindInWindowClicked(Sender: TObject);
|
procedure SrcEditMenuFindInWindowClicked(Sender: TObject);
|
||||||
procedure SrcEditMenuMoveToExistingWindowClicked(Sender: TObject);
|
procedure SrcEditMenuMoveToExistingWindowClicked(Sender: TObject);
|
||||||
procedure SrcPopUpMenuPopup(Sender: TObject);
|
procedure SrcPopUpMenuPopup(Sender: TObject);
|
||||||
procedure UpdateSrcPopUpMenu(SrcEdit: TSourceEditor);
|
|
||||||
procedure StatusBarClick(Sender: TObject);
|
procedure StatusBarClick(Sender: TObject);
|
||||||
procedure StatusBarDblClick(Sender: TObject);
|
procedure StatusBarDblClick(Sender: TObject);
|
||||||
procedure StatusBarDrawPanel({%H-}AStatusBar: TStatusBar; APanel: TStatusPanel;
|
procedure StatusBarDrawPanel({%H-}AStatusBar: TStatusBar; APanel: TStatusPanel;
|
||||||
const ARect: TRect);
|
const ARect: TRect);
|
||||||
procedure UpdateTabPopUpMenu(ASrcEdit: TSourceEditor);
|
|
||||||
procedure TabPopUpMenuPopup(Sender: TObject);
|
procedure TabPopUpMenuPopup(Sender: TObject);
|
||||||
private
|
private
|
||||||
FNotebook: TExtendedNotebook;
|
FNotebook: TExtendedNotebook;
|
||||||
FBaseCaption: String;
|
FBaseCaption: String;
|
||||||
FIsClosing: Boolean;
|
FIsClosing: Boolean;
|
||||||
FSrcEditsSortedForFilenames: TAvgLvlTree; // TSourceEditorInterface sorted for Filename
|
FSrcEditsSortedForFilenames: TAvgLvlTree; // TSourceEditorInterface sorted for Filename
|
||||||
FSrcPopupMenuItemsStamp: TSrcPopupMenuItemsStamp;
|
|
||||||
TabPopUpMenu, SrcPopUpMenu, DbgPopUpMenu: TPopupMenu;
|
TabPopUpMenu, SrcPopUpMenu, DbgPopUpMenu: TPopupMenu;
|
||||||
procedure ApplyPageIndex;
|
procedure ApplyPageIndex;
|
||||||
procedure ExecuteEditorItemClick(Sender: TObject);
|
procedure ExecuteEditorItemClick(Sender: TObject);
|
||||||
@ -1032,8 +1019,8 @@ type
|
|||||||
procedure SetActiveSourceNotebook(const AValue: TSourceNotebook);
|
procedure SetActiveSourceNotebook(const AValue: TSourceNotebook);
|
||||||
function GetSourceNotebook(Index: integer): TSourceNotebook;
|
function GetSourceNotebook(Index: integer): TSourceNotebook;
|
||||||
procedure SetActiveSrcEditor(const AValue: TSourceEditor);
|
procedure SetActiveSrcEditor(const AValue: TSourceEditor);
|
||||||
|
procedure SrcEditMenuProcedureJumpGetCaption(Sender: TObject; var ACaption,
|
||||||
procedure UpdatePopUpMenus(Sender: TObject);
|
{%H-}AHint: string);
|
||||||
public
|
public
|
||||||
// Windows
|
// Windows
|
||||||
function SourceWindowWithEditor(const AEditor: TSourceEditorInterface): TSourceNotebook;
|
function SourceWindowWithEditor(const AEditor: TSourceEditorInterface): TSourceNotebook;
|
||||||
@ -4052,6 +4039,8 @@ Begin
|
|||||||
If Assigned(OnEditorChange) then
|
If Assigned(OnEditorChange) then
|
||||||
OnEditorChange(Sender);
|
OnEditorChange(Sender);
|
||||||
UpdatePageName;
|
UpdatePageName;
|
||||||
|
if Changes * [scCaretX, scCaretY, scSelection] <> [] then
|
||||||
|
IDECommandList.PostponeUpdateEvents;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSourceEditor.SelectionAvailable: boolean;
|
function TSourceEditor.SelectionAvailable: boolean;
|
||||||
@ -4985,7 +4974,6 @@ Begin
|
|||||||
OnMouseMove := @EditorMouseMoved;
|
OnMouseMove := @EditorMouseMoved;
|
||||||
OnMouseWheel := @EditorMouseWheel;
|
OnMouseWheel := @EditorMouseWheel;
|
||||||
OnMouseDown := @EditorMouseDown;
|
OnMouseDown := @EditorMouseDown;
|
||||||
OnMouseUp := @EditorMouseUp;
|
|
||||||
OnClickLink := Manager.OnClickLink;
|
OnClickLink := Manager.OnClickLink;
|
||||||
OnMouseLink := Manager.OnMouseLink;
|
OnMouseLink := Manager.OnMouseLink;
|
||||||
OnKeyDown := @EditorKeyDown;
|
OnKeyDown := @EditorKeyDown;
|
||||||
@ -5430,8 +5418,6 @@ begin
|
|||||||
// Navigating with mousebuttons between editors (eg jump history on btn 4/5)
|
// Navigating with mousebuttons between editors (eg jump history on btn 4/5)
|
||||||
// can trigger the old editor to be refocused (while not visible)
|
// can trigger the old editor to be refocused (while not visible)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
IDECommandList.ExecuteUpdateEvents;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditor.EditorActivateSyncro(Sender: TObject);
|
procedure TSourceEditor.EditorActivateSyncro(Sender: TObject);
|
||||||
@ -5518,15 +5504,6 @@ begin
|
|||||||
// debugln('MouseMove in Editor',X,',',Y);
|
// debugln('MouseMove in Editor',X,',',Y);
|
||||||
if Assigned(OnMouseMove) then
|
if Assigned(OnMouseMove) then
|
||||||
OnMouseMove(Self,Shift,X,Y);
|
OnMouseMove(Self,Shift,X,Y);
|
||||||
if Shift*[ssLeft,ssRight]<>[] then
|
|
||||||
IDECommandList.PostponeUpdateEvents;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSourceEditor.EditorMouseUp(Sender: TObject; Button: TMouseButton;
|
|
||||||
Shift: TShiftState; X, Y: Integer);
|
|
||||||
begin
|
|
||||||
if Button=mbLeft then
|
|
||||||
IDECommandList.ExecuteUpdateEvents;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditor.EditorMouseWheel(Sender: TObject; Shift: TShiftState;
|
procedure TSourceEditor.EditorMouseWheel(Sender: TObject; Shift: TShiftState;
|
||||||
@ -6516,8 +6493,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
ASrcEdit:=Editors[PageIndex];
|
ASrcEdit:=Editors[PageIndex];
|
||||||
|
|
||||||
UpdateTabPopUpMenu(ASrcEdit);
|
|
||||||
|
|
||||||
{$IFnDEF SingleSrcWindow}
|
{$IFnDEF SingleSrcWindow}
|
||||||
// Multi win
|
// Multi win
|
||||||
ToWindow(SrcEditMenuMoveToOtherWindowList, 'MoveToWindow',
|
ToWindow(SrcEditMenuMoveToOtherWindowList, 'MoveToWindow',
|
||||||
@ -6651,7 +6626,13 @@ begin
|
|||||||
Assert((ASrcEdit=GetActiveSE), 'TSourceNotebook.SrcPopUpMenuPopup: ASrcEdit<>GetActiveSE');
|
Assert((ASrcEdit=GetActiveSE), 'TSourceNotebook.SrcPopUpMenuPopup: ASrcEdit<>GetActiveSE');
|
||||||
EditorComp:=ASrcEdit.EditorComponent;
|
EditorComp:=ASrcEdit.EditorComponent;
|
||||||
|
|
||||||
UpdateSrcPopUpMenu(ASrcEdit);
|
SrcEditMenuReadOnly.Checked:=ASrcEdit.ReadOnly;
|
||||||
|
SrcEditMenuShowLineNumbers.Checked := ASrcEdit.EditorComponent.Gutter.LineNumberPart.Visible;
|
||||||
|
SrcEditMenuDisableI18NForLFM.Visible:=false;
|
||||||
|
|
||||||
|
UpdateHighlightMenuItems(ASrcEdit);
|
||||||
|
UpdateEncodingMenuItems(ASrcEdit);
|
||||||
|
UpdateLineEndingMenuItems(ASrcEdit);
|
||||||
|
|
||||||
// ask Codetools
|
// ask Codetools
|
||||||
CurFilename:=ASrcEdit.FileName;
|
CurFilename:=ASrcEdit.FileName;
|
||||||
@ -6928,144 +6909,6 @@ begin
|
|||||||
Editors[i].UpdateProjectFile;
|
Editors[i].UpdateProjectFile;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceNotebook.UpdateSrcPopUpMenu(SrcEdit: TSourceEditor);
|
|
||||||
var
|
|
||||||
se: TSourceEditor;
|
|
||||||
BookMarkID, BookMarkX, BookMarkY: integer;
|
|
||||||
MarkDesc, ShortFileName, CurFilename: String;
|
|
||||||
MarkMenuItem: TIDEMenuItem;
|
|
||||||
MainCodeBuf: TCodeBuffer;
|
|
||||||
i: integer;
|
|
||||||
SelAvail, SelAvailAndWritable, StringFound, IdentFound: Boolean;
|
|
||||||
CurWordAtCursor: String;
|
|
||||||
CodeTool: TCodeTool;
|
|
||||||
CaretXY: TCodeXYPosition;
|
|
||||||
CleanPos: integer;
|
|
||||||
CodeNode: TCodeTreeNode;
|
|
||||||
ProcNode: TCodeTreeNode;
|
|
||||||
ProcName, xToken: String;
|
|
||||||
xAttr: TSynHighlighterAttributes;
|
|
||||||
begin
|
|
||||||
if (FSrcPopupMenuItemsStamp.SrcEdit = SrcEdit)
|
|
||||||
and (FSrcPopupMenuItemsStamp.EditorComponentStamp = SrcEdit.EditorComponent.ChangeStamp)
|
|
||||||
and (FSrcPopupMenuItemsStamp.FileStateStamp = FileStateCache.TimeStamp)
|
|
||||||
and (FSrcPopupMenuItemsStamp.SourceCacheStamp = CodeToolBoss.SourceCache.ChangeStamp)
|
|
||||||
and (FSrcPopupMenuItemsStamp.DefinesStep = CodeToolBoss.DefineTree.ChangeStep)
|
|
||||||
then exit;
|
|
||||||
FSrcPopupMenuItemsStamp.SrcEdit := SrcEdit;
|
|
||||||
FSrcPopupMenuItemsStamp.EditorComponentStamp := SrcEdit.EditorComponent.ChangeStamp;
|
|
||||||
FSrcPopupMenuItemsStamp.FileStateStamp := FileStateCache.TimeStamp;
|
|
||||||
FSrcPopupMenuItemsStamp.SourceCacheStamp := CodeToolBoss.SourceCache.ChangeStamp;
|
|
||||||
FSrcPopupMenuItemsStamp.DefinesStep := CodeToolBoss.DefineTree.ChangeStep;
|
|
||||||
|
|
||||||
// Clipboard section:
|
|
||||||
SrcEditMenuCut.Enabled := SrcEdit.SelectionAvailable and not SrcEdit.ReadOnly;
|
|
||||||
SrcEditMenuCopy.Enabled := SrcEdit.SelectionAvailable;
|
|
||||||
SrcEditMenuPaste.Enabled := not SrcEdit.ReadOnly;
|
|
||||||
SrcEditMenuSelectAll.Enabled:= SrcEdit.SourceText<>'';
|
|
||||||
|
|
||||||
// Files section: Readonly, ShowLineNumbers
|
|
||||||
SrcEditMenuReadOnly.Checked:=SrcEdit.ReadOnly;
|
|
||||||
SrcEditMenuShowLineNumbers.Checked := SrcEdit.EditorComponent.Gutter.LineNumberPart.Visible;
|
|
||||||
SrcEditMenuDisableI18NForLFM.Visible:=false;
|
|
||||||
|
|
||||||
UpdateHighlightMenuItems(SrcEdit);
|
|
||||||
UpdateEncodingMenuItems(SrcEdit);
|
|
||||||
UpdateLineEndingMenuItems(SrcEdit);
|
|
||||||
|
|
||||||
// add context specific menu items
|
|
||||||
CurFilename:=SrcEdit.FileName;
|
|
||||||
ShortFileName:=ExtractFileName(CurFilename);
|
|
||||||
SelAvail:=SrcEdit.EditorComponent.SelAvail;
|
|
||||||
SelAvailAndWritable:=SelAvail and (not SrcEdit.ReadOnly);
|
|
||||||
CurWordAtCursor:=SrcEdit.GetWordAtCurrentCaret;
|
|
||||||
|
|
||||||
// ask Codetools
|
|
||||||
MainCodeBuf:=nil;
|
|
||||||
if FilenameIsPascalUnit(ShortFileName)
|
|
||||||
or (CompareFileExt(ShortFileName,'.inc',true)=0) then
|
|
||||||
MainCodeBuf:=CodeToolBoss.GetMainCode(SrcEdit.CodeBuffer)
|
|
||||||
else if FilenameIsPascalSource(ShortFileName) then
|
|
||||||
MainCodeBuf:=SrcEdit.CodeBuffer;
|
|
||||||
CodeTool:=nil;
|
|
||||||
CaretXY:=CleanCodeXYPosition;
|
|
||||||
CaretXY.Code:=SrcEdit.CodeBuffer;
|
|
||||||
CaretXY.X:=SrcEdit.CursorTextXY.X;
|
|
||||||
CaretXY.Y:=SrcEdit.CursorTextXY.Y;
|
|
||||||
CodeNode:=nil;
|
|
||||||
if MainCodeBuf<>nil then begin
|
|
||||||
CodeToolBoss.Explore(MainCodeBuf,CodeTool,true);
|
|
||||||
if CodeTool<>nil then begin
|
|
||||||
CodeTool.CaretToCleanPos(CaretXY,CleanPos);
|
|
||||||
CodeNode:=CodeTool.FindDeepestNodeAtPos(CleanPos,false);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
StringFound:=False;
|
|
||||||
IdentFound:=False;
|
|
||||||
//it is faster to get information from SynEdit than from CodeTools
|
|
||||||
if SrcEdit.EditorComponent.GetHighlighterAttriAtRowCol(SrcEdit.EditorComponent.CaretXY, xToken, xAttr) then
|
|
||||||
begin
|
|
||||||
StringFound := xAttr = SrcEdit.EditorComponent.Highlighter.StringAttribute;
|
|
||||||
IdentFound := xAttr = SrcEdit.EditorComponent.Highlighter.IdentifierAttribute;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// bookmarks
|
|
||||||
for BookMarkID:=0 to 9 do begin
|
|
||||||
MarkDesc:=' '+IntToStr(BookMarkID);
|
|
||||||
SelAvail:=False;
|
|
||||||
i := 0;
|
|
||||||
while i < Manager.SourceEditorCount do begin
|
|
||||||
se:=Manager.SourceEditors[i];
|
|
||||||
BookMarkX:=0; BookMarkY:=0;
|
|
||||||
if se.EditorComponent.GetBookMark(BookMarkID,BookMarkX,BookMarkY) then
|
|
||||||
begin
|
|
||||||
MarkDesc:=MarkDesc+': '+se.PageName+' ('+IntToStr(BookMarkY)+','+IntToStr(BookMarkX)+')';
|
|
||||||
SelAvail:=True;
|
|
||||||
break;
|
|
||||||
end;
|
|
||||||
inc(i);
|
|
||||||
end;
|
|
||||||
// goto book mark item
|
|
||||||
MarkMenuItem:=SrcEditSubMenuGotoBookmarks[BookMarkID];
|
|
||||||
MarkMenuItem.Caption:=uemBookmarkN+MarkDesc;
|
|
||||||
MarkMenuItem.Enabled:=SelAvail;
|
|
||||||
// set book mark item
|
|
||||||
MarkMenuItem:=SrcEditSubMenuToggleBookmarks[BookMarkID];
|
|
||||||
MarkMenuItem.Caption:=uemToggleBookmark+MarkDesc;
|
|
||||||
end;
|
|
||||||
|
|
||||||
SrcEditMenuFindDeclaration.Enabled:=CurWordAtCursor<>'';
|
|
||||||
if CurWordAtCursor<>'' then
|
|
||||||
SrcEditMenuFindDeclaration.Caption:=Format(lisFindDeclarationOf, [
|
|
||||||
CurWordAtCursor])
|
|
||||||
else
|
|
||||||
SrcEditMenuFindDeclaration.Caption:=uemFindDeclaration;
|
|
||||||
SrcEditMenuFindIdentifierReferences.Enabled:=IdentFound;
|
|
||||||
SrcEditMenuFindUsedUnitReferences.Enabled:=IdentFound;
|
|
||||||
SrcEditMenuFindOverloads.Enabled:=IdentFound;
|
|
||||||
ProcName:='';
|
|
||||||
if CodeNode<>nil then begin
|
|
||||||
ProcNode:=CodeNode.GetNodeOfType(ctnProcedure);
|
|
||||||
if ProcNode<>nil then
|
|
||||||
ProcName:=CodeTool.ExtractProcName(ProcNode,[]);
|
|
||||||
end;
|
|
||||||
SrcEditMenuProcedureJump.Enabled:=(ProcName<>'');
|
|
||||||
if ProcName<>'' then
|
|
||||||
SrcEditMenuProcedureJump.Caption:=Format(lisJumpToProcedure, [ProcName])
|
|
||||||
else
|
|
||||||
SrcEditMenuProcedureJump.Caption:=uemProcedureJump;
|
|
||||||
// enable refactoring menu items
|
|
||||||
SrcEditMenuEncloseSelection.Enabled := SelAvailAndWritable;
|
|
||||||
SrcEditMenuEncloseInIFDEF.Enabled := SelAvailAndWritable;
|
|
||||||
SrcEditMenuExtractProc.Enabled := SelAvailAndWritable;
|
|
||||||
SrcEditMenuInvertAssignment.Enabled := SelAvailAndWritable;
|
|
||||||
SrcEditMenuRenameIdentifier.Enabled:=IdentFound and (not SrcEdit.ReadOnly);
|
|
||||||
SrcEditMenuShowAbstractMethods.Enabled:=not SrcEdit.ReadOnly;
|
|
||||||
SrcEditMenuShowEmptyMethods.Enabled:=not SrcEdit.ReadOnly;
|
|
||||||
SrcEditMenuMakeResourceString.Enabled:=not SrcEdit.ReadOnly and StringFound;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSourceNotebook.UpdateEncodingMenuItems(SrcEdit: TSourceEditor);
|
procedure TSourceNotebook.UpdateEncodingMenuItems(SrcEdit: TSourceEditor);
|
||||||
var
|
var
|
||||||
List: TStringList;
|
List: TStringList;
|
||||||
@ -8403,51 +8246,6 @@ begin
|
|||||||
CheckCurrentCodeBufferChanged;
|
CheckCurrentCodeBufferChanged;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
procedure TSourceNotebook.UpdateTabPopUpMenu(ASrcEdit: TSourceEditor);
|
|
||||||
{$IFnDEF SingleSrcWindow}
|
|
||||||
function ToWindow(WinForFind: Boolean = False): Boolean;
|
|
||||||
var
|
|
||||||
i, ThisWin, SharedEditor: Integer;
|
|
||||||
nb: TSourceNotebook;
|
|
||||||
begin
|
|
||||||
Result := False;
|
|
||||||
ThisWin := Manager.IndexOfSourceWindow(self);
|
|
||||||
for i := 0 to Manager.SourceWindowCount - 1 do begin
|
|
||||||
nb:=Manager.SourceWindows[i];
|
|
||||||
SharedEditor:=nb.IndexOfEditorInShareWith(ASrcEdit);
|
|
||||||
if (i <> ThisWin) and ((SharedEditor < 0) <> WinForFind) then begin
|
|
||||||
Result := True;
|
|
||||||
Break;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
var
|
|
||||||
NBAvail: Boolean;
|
|
||||||
begin
|
|
||||||
{$IFnDEF SingleSrcWindow}
|
|
||||||
SrcEditMenuEditorLock.Checked := ASrcEdit.IsLocked; // Editor locks
|
|
||||||
// Multi win
|
|
||||||
NBAvail := ToWindow();
|
|
||||||
SrcEditMenuMoveToNewWindow.Visible := not NBAvail;
|
|
||||||
SrcEditMenuMoveToNewWindow.Enabled := PageCount > 1;
|
|
||||||
SrcEditMenuMoveToOtherWindow.Visible := NBAvail;
|
|
||||||
SrcEditMenuMoveToOtherWindowNew.Enabled := PageCount > 1;
|
|
||||||
|
|
||||||
SrcEditMenuCopyToNewWindow.Visible := not NBAvail;
|
|
||||||
SrcEditMenuCopyToOtherWindow.Visible := NBAvail;
|
|
||||||
|
|
||||||
SrcEditMenuFindInOtherWindow.Enabled := NBAvail;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
// editor layout
|
|
||||||
SrcEditMenuMoveEditorLeft.Enabled:= (PageCount>1);
|
|
||||||
SrcEditMenuMoveEditorRight.Enabled:= (PageCount>1);
|
|
||||||
SrcEditMenuMoveEditorFirst.Enabled:= (PageCount>1) and (PageIndex>0);
|
|
||||||
SrcEditMenuMoveEditorLast.Enabled:= (PageCount>1) and (PageIndex<(PageCount-1));
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSourceNotebook.FindPageWithEditor(
|
function TSourceNotebook.FindPageWithEditor(
|
||||||
ASourceEditor: TSourceEditor):integer;
|
ASourceEditor: TSourceEditor):integer;
|
||||||
var
|
var
|
||||||
@ -9915,6 +9713,56 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSourceEditorManager.SrcEditMenuProcedureJumpGetCaption(
|
||||||
|
Sender: TObject; var ACaption, AHint: string);
|
||||||
|
var
|
||||||
|
ShortFileName, CurFilename: String;
|
||||||
|
MainCodeBuf: TCodeBuffer;
|
||||||
|
CodeTool: TCodeTool;
|
||||||
|
CaretXY: TCodeXYPosition;
|
||||||
|
CleanPos: integer;
|
||||||
|
CodeNode: TCodeTreeNode;
|
||||||
|
ProcNode: TCodeTreeNode;
|
||||||
|
ProcName: String;
|
||||||
|
SrcEdit: TSourceEditor;
|
||||||
|
begin
|
||||||
|
// ask Codetools
|
||||||
|
SrcEdit:=GetActiveSE;
|
||||||
|
if not Assigned(SrcEdit) then Exit;
|
||||||
|
CurFilename:=SrcEdit.FileName;
|
||||||
|
ShortFileName:=ExtractFileName(CurFilename);
|
||||||
|
MainCodeBuf:=nil;
|
||||||
|
if FilenameIsPascalUnit(ShortFileName)
|
||||||
|
or (CompareFileExt(ShortFileName,'.inc',true)=0) then
|
||||||
|
MainCodeBuf:=CodeToolBoss.GetMainCode(SrcEdit.CodeBuffer)
|
||||||
|
else if FilenameIsPascalSource(ShortFileName) then
|
||||||
|
MainCodeBuf:=SrcEdit.CodeBuffer;
|
||||||
|
CodeTool:=nil;
|
||||||
|
CaretXY:=CleanCodeXYPosition;
|
||||||
|
CaretXY.Code:=SrcEdit.CodeBuffer;
|
||||||
|
CaretXY.X:=SrcEdit.CursorTextXY.X;
|
||||||
|
CaretXY.Y:=SrcEdit.CursorTextXY.Y;
|
||||||
|
CodeNode:=nil;
|
||||||
|
if MainCodeBuf<>nil then begin
|
||||||
|
CodeToolBoss.Explore(MainCodeBuf,CodeTool,true);
|
||||||
|
if CodeTool<>nil then begin
|
||||||
|
CodeTool.CaretToCleanPos(CaretXY,CleanPos);
|
||||||
|
CodeNode:=CodeTool.FindDeepestNodeAtPos(CleanPos,false);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
ProcName:='';
|
||||||
|
if CodeNode<>nil then begin
|
||||||
|
ProcNode:=CodeNode.GetNodeOfType(ctnProcedure);
|
||||||
|
if ProcNode<>nil then
|
||||||
|
ProcName:=CodeTool.ExtractProcName(ProcNode,[]);
|
||||||
|
end;
|
||||||
|
if ProcName<>'' then
|
||||||
|
ACaption:=Format(lisJumpToProcedure, [ProcName])
|
||||||
|
else
|
||||||
|
ACaption:=uemProcedureJump;
|
||||||
|
end;
|
||||||
|
|
||||||
function TSourceEditorManager.IndexOfSourceWindowWithID(const AnID: Integer): Integer;
|
function TSourceEditorManager.IndexOfSourceWindowWithID(const AnID: Integer): Integer;
|
||||||
begin
|
begin
|
||||||
Result := SourceWindowCount - 1;
|
Result := SourceWindowCount - 1;
|
||||||
@ -10450,6 +10298,7 @@ begin
|
|||||||
SrcEditMenuFindDeclaration.Command := GetCommand(ecFindDeclaration);
|
SrcEditMenuFindDeclaration.Command := GetCommand(ecFindDeclaration);
|
||||||
{%region *** Submenu: Find Section *** }
|
{%region *** Submenu: Find Section *** }
|
||||||
SrcEditMenuProcedureJump.Command := GetCommand(ecFindProcedureDefinition);
|
SrcEditMenuProcedureJump.Command := GetCommand(ecFindProcedureDefinition);
|
||||||
|
SrcEditMenuProcedureJump.OnRequestCaptionHint := @SrcEditMenuProcedureJumpGetCaption;
|
||||||
SrcEditMenuFindNextWordOccurrence.Command := GetCommand(ecFindNextWordOccurrence);
|
SrcEditMenuFindNextWordOccurrence.Command := GetCommand(ecFindNextWordOccurrence);
|
||||||
SrcEditMenuFindPrevWordOccurrence.Command := GetCommand(ecFindPrevWordOccurrence);
|
SrcEditMenuFindPrevWordOccurrence.Command := GetCommand(ecFindPrevWordOccurrence);
|
||||||
SrcEditMenuFindInFiles.Command := GetCommand(ecFindInFiles);
|
SrcEditMenuFindInFiles.Command := GetCommand(ecFindInFiles);
|
||||||
@ -10680,34 +10529,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditorManager.UpdatePopUpMenus(Sender: TObject);
|
|
||||||
var
|
|
||||||
ASrcNB: TSourceNotebook;
|
|
||||||
I: Integer;
|
|
||||||
begin
|
|
||||||
if Screen.ActiveCustomForm is TSourceNotebook then
|
|
||||||
begin
|
|
||||||
ASrcNB:=TSourceNotebook(Screen.ActiveCustomForm);
|
|
||||||
end else
|
|
||||||
begin
|
|
||||||
ASrcNB:=nil;
|
|
||||||
for I := 0 to Screen.CustomFormZOrderCount-1 do
|
|
||||||
if Screen.CustomFormsZOrdered[I] is TSourceNotebook then
|
|
||||||
begin
|
|
||||||
ASrcNB:=TSourceNotebook(Screen.CustomFormsZOrdered[I]);
|
|
||||||
Break;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
if (ASrcNB=nil) and (SourceWindowCount > 0) then
|
|
||||||
ASrcNB:=SourceWindows[0];
|
|
||||||
|
|
||||||
if (ASrcNB<>nil) and (ASrcNB.GetActiveSE<>nil) then
|
|
||||||
begin
|
|
||||||
ASrcNB.UpdateSrcPopUpMenu(ASrcNB.GetActiveSE);
|
|
||||||
ASrcNB.UpdateTabPopUpMenu(ASrcNB.GetActiveSE);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSourceEditorManager.BeginGlobalUpdate;
|
procedure TSourceEditorManager.BeginGlobalUpdate;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
@ -11046,13 +10867,10 @@ begin
|
|||||||
|
|
||||||
Application.AddOnIdleHandler(@OnIdle);
|
Application.AddOnIdleHandler(@OnIdle);
|
||||||
Application.AddOnUserInputHandler(@OnUserInput);
|
Application.AddOnUserInputHandler(@OnUserInput);
|
||||||
|
|
||||||
IDECommandList.AddCustomUpdateEvent(@UpdatePopUpMenus);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TSourceEditorManager.Destroy;
|
destructor TSourceEditorManager.Destroy;
|
||||||
begin
|
begin
|
||||||
IDECommandList.RemoveCustomUpdateEvent(@UpdatePopUpMenus);
|
|
||||||
FreeAndNil(FHints);
|
FreeAndNil(FHints);
|
||||||
SourceEditorMarks.OnAction := nil;
|
SourceEditorMarks.OnAction := nil;
|
||||||
Application.RemoveAllHandlersOfObject(Self);
|
Application.RemoveAllHandlersOfObject(Self);
|
||||||
|
@ -213,6 +213,7 @@ type
|
|||||||
|
|
||||||
TIDESynEditor = class(TSynEdit)
|
TIDESynEditor = class(TSynEdit)
|
||||||
private
|
private
|
||||||
|
FCaretStamp: Int64;
|
||||||
FShowTopInfo: boolean;
|
FShowTopInfo: boolean;
|
||||||
FSyncroEdit: TSynPluginSyncroEdit;
|
FSyncroEdit: TSynPluginSyncroEdit;
|
||||||
FTemplateEdit: TSynPluginTemplateEdit;
|
FTemplateEdit: TSynPluginTemplateEdit;
|
||||||
@ -278,6 +279,7 @@ type
|
|||||||
property IsInMultiCaretMainExecution: Boolean read GetIsInMultiCaretMainExecution;
|
property IsInMultiCaretMainExecution: Boolean read GetIsInMultiCaretMainExecution;
|
||||||
property IsInMultiCaretRepeatExecution: Boolean read GetIsInMultiCaretRepeatExecution;
|
property IsInMultiCaretRepeatExecution: Boolean read GetIsInMultiCaretRepeatExecution;
|
||||||
property OnMultiCaretBeforeCommand: TSynMultiCaretBeforeCommand read GetOnMultiCaretBeforeCommand write SetOnMultiCaretBeforeCommand;
|
property OnMultiCaretBeforeCommand: TSynMultiCaretBeforeCommand read GetOnMultiCaretBeforeCommand write SetOnMultiCaretBeforeCommand;
|
||||||
|
property CaretStamp: Int64 read FCaretStamp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TIDESynHighlighterPasRangeList = class(TSynHighlighterPasRangeList)
|
TIDESynHighlighterPasRangeList = class(TSynHighlighterPasRangeList)
|
||||||
@ -1484,6 +1486,10 @@ begin
|
|||||||
inherited DoOnStatusChange(Changes);
|
inherited DoOnStatusChange(Changes);
|
||||||
if Changes * [scTopLine, scLinesInWindow] <> []then
|
if Changes * [scTopLine, scLinesInWindow] <> []then
|
||||||
SrcSynCaretChanged(nil);
|
SrcSynCaretChanged(nil);
|
||||||
|
{$push}{$R-} // range check off
|
||||||
|
if Changes * [scCaretX, scCaretY, scSelection] <> []then
|
||||||
|
Inc(FCaretStamp);
|
||||||
|
{$pop}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDESynEditor.GetTopInfoMarkupForLine(Sender: TObject; Line: integer;
|
procedure TIDESynEditor.GetTopInfoMarkupForLine(Sender: TObject; Line: integer;
|
||||||
|
@ -214,6 +214,7 @@ type
|
|||||||
function GetCount: Integer;
|
function GetCount: Integer;
|
||||||
function GetPackages(Index: integer): TLazPackage;
|
function GetPackages(Index: integer): TLazPackage;
|
||||||
procedure DoDependencyChanged(Dependency: TPkgDependency);
|
procedure DoDependencyChanged(Dependency: TPkgDependency);
|
||||||
|
function GetPackagesChangeStamp: Int64;
|
||||||
procedure SetRegistrationPackage(const AValue: TLazPackage);
|
procedure SetRegistrationPackage(const AValue: TLazPackage);
|
||||||
procedure UpdateBrokenDependenciesToPackage(APackage: TLazPackage);
|
procedure UpdateBrokenDependenciesToPackage(APackage: TLazPackage);
|
||||||
function OpenDependencyWithPackageLink(Dependency: TPkgDependency;
|
function OpenDependencyWithPackageLink(Dependency: TPkgDependency;
|
||||||
@ -442,6 +443,7 @@ type
|
|||||||
property Packages[Index: integer]: TLazPackage read GetPackages; default; // see Count for the number
|
property Packages[Index: integer]: TLazPackage read GetPackages; default; // see Count for the number
|
||||||
property UpdateLock: integer read FUpdateLock;
|
property UpdateLock: integer read FUpdateLock;
|
||||||
property Verbosity: TPkgVerbosityFlags read FVerbosity write FVerbosity;
|
property Verbosity: TPkgVerbosityFlags read FVerbosity write FVerbosity;
|
||||||
|
property PackagesChangeStamp: Int64 read GetPackagesChangeStamp;
|
||||||
|
|
||||||
// base packages
|
// base packages
|
||||||
property FCLPackage: TLazPackage read FFCLPackage;
|
property FCLPackage: TLazPackage read FFCLPackage;
|
||||||
@ -5157,6 +5159,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TLazPackageGraph.GetPackagesChangeStamp: Int64;
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
|
xPck: TLazPackage;
|
||||||
|
begin
|
||||||
|
{$push}{$R-} // range check off
|
||||||
|
Result := 0;
|
||||||
|
for I := 0 to Count-1 do
|
||||||
|
begin
|
||||||
|
xPck := Packages[I];
|
||||||
|
Inc(Result, xPck.ChangeStamp);
|
||||||
|
end;
|
||||||
|
{$pop}
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLazPackageGraph.SortDependencyListTopologicallyOld(
|
procedure TLazPackageGraph.SortDependencyListTopologicallyOld(
|
||||||
var FirstDependency: TPkgDependency; TopLevelFirst: boolean);
|
var FirstDependency: TPkgDependency; TopLevelFirst: boolean);
|
||||||
// Sort dependency list topologically.
|
// Sort dependency list topologically.
|
||||||
|
Loading…
Reference in New Issue
Block a user