mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 18:20:00 +02:00
IDE: update edit menu for designer. Issue #31519
git-svn-id: trunk@54382 -
This commit is contained in:
parent
bc9ea113b6
commit
8ea54156de
@ -320,6 +320,7 @@ type
|
||||
FLookupRoot: TComponent;// component owning the selected components
|
||||
FStates: TControlSelStates;
|
||||
FUpdateLock: integer;
|
||||
FChangeStamp: int64;
|
||||
|
||||
function CompareBottom(Index1, Index2: integer): integer;
|
||||
function CompareHorCenter(Index1, Index2: integer): integer;
|
||||
@ -523,6 +524,7 @@ type
|
||||
property OnSelectionFormChanged: TOnSelectionFormChanged
|
||||
read FOnSelectionFormChanged write FOnSelectionFormChanged;
|
||||
property LookupRoot: TComponent read FLookupRoot;
|
||||
property ChangeStamp: int64 read FChangeStamp;
|
||||
end;
|
||||
|
||||
|
||||
@ -2083,6 +2085,9 @@ begin
|
||||
else
|
||||
begin
|
||||
Exclude(FStates, cssChangedDuringLock);
|
||||
{$push}{$R-} // range check off
|
||||
Inc(FChangeStamp);
|
||||
{$pop}
|
||||
if Assigned(FOnChange) then
|
||||
FOnChange(Self, ForceUpdate);
|
||||
end;
|
||||
|
@ -3661,7 +3661,8 @@ var
|
||||
CurWordAtCursor: string;
|
||||
begin
|
||||
GetCurrentUnit(ASrcEdit, AnUnitInfo);
|
||||
if not UpdateEditorCommandsStamp.Changed(ASrcEdit, DisplayState) then
|
||||
ActiveDesigner := GetActiveDesignerSkipMainBar;
|
||||
if not UpdateEditorCommandsStamp.Changed(ASrcEdit, ActiveDesigner as TDesigner, DisplayState) then
|
||||
Exit;
|
||||
|
||||
Editable := Assigned(ASrcEdit) and not ASrcEdit.ReadOnly;
|
||||
@ -3669,7 +3670,6 @@ begin
|
||||
SelEditable := Editable and SelAvail;
|
||||
SrcEditorActive := DisplayState = dsSource;
|
||||
DsgEditorActive := DisplayState = dsForm;
|
||||
ActiveDesigner := GetActiveDesignerSkipMainBar;
|
||||
|
||||
if ASrcEdit<>nil then
|
||||
begin
|
||||
|
@ -53,7 +53,7 @@ uses
|
||||
ControlSelection, FormEditor, EmptyMethodsDlg, BaseDebugManager, TransferMacros,
|
||||
BuildManager, EditorMacroListViewer, FindRenameIdentifier, GenericCheckList,
|
||||
ViewUnit_Dlg, DiskDiffsDialog, InputHistory, CheckLFMDlg, PublishModule, etMessagesWnd,
|
||||
ConvCodeTool, BasePkgManager, PackageDefs, PackageSystem;
|
||||
ConvCodeTool, BasePkgManager, PackageDefs, PackageSystem, Designer;
|
||||
|
||||
type
|
||||
|
||||
@ -105,8 +105,13 @@ type
|
||||
FDisplayState: TDisplayState;
|
||||
FEditorComponentStamp: int64;
|
||||
FEditorCaretStamp: int64;
|
||||
|
||||
FDesigner: TDesigner;
|
||||
FDesignerSelectionStamp: int64;
|
||||
FDesignerStamp: int64;
|
||||
public
|
||||
function Changed(ASrcEdit: TSourceEditor; ADisplayState: TDisplayState): Boolean;
|
||||
function Changed(ASrcEdit: TSourceEditor; ADesigner: TDesigner;
|
||||
ADisplayState: TDisplayState): Boolean;
|
||||
end;
|
||||
|
||||
{ TFileOpener }
|
||||
@ -546,25 +551,35 @@ end;
|
||||
{ TSourceEditorCommandsStamp }
|
||||
|
||||
function TSourceEditorCommandsStamp.Changed(ASrcEdit: TSourceEditor;
|
||||
ADisplayState: TDisplayState): Boolean;
|
||||
ADesigner: TDesigner; ADisplayState: TDisplayState): Boolean;
|
||||
begin
|
||||
Result := not(
|
||||
(FSrcEdit = ASrcEdit)
|
||||
and (FDesigner = ADesigner)
|
||||
and (FDisplayState = ADisplayState)
|
||||
and ((ASrcEdit = nil) or (
|
||||
(FDisplayState = ADisplayState)
|
||||
and (FEditorComponentStamp = ASrcEdit.EditorComponent.ChangeStamp)
|
||||
(FEditorComponentStamp = ASrcEdit.EditorComponent.ChangeStamp)
|
||||
and (FEditorCaretStamp = ASrcEdit.EditorComponent.CaretStamp)))
|
||||
and ((ADesigner = nil) or (
|
||||
(FDesignerSelectionStamp = ADesigner.Selection.ChangeStamp)
|
||||
and (FDesignerStamp = ADesigner.ChangeStamp)))
|
||||
);
|
||||
|
||||
if not Result then Exit;
|
||||
|
||||
FSrcEdit := ASrcEdit;
|
||||
FDesigner := ADesigner;
|
||||
FDisplayState := ADisplayState;
|
||||
if ASrcEdit<>nil then
|
||||
begin
|
||||
FEditorComponentStamp := ASrcEdit.EditorComponent.ChangeStamp;
|
||||
FEditorCaretStamp := ASrcEdit.EditorComponent.CaretStamp;
|
||||
end;
|
||||
if ADesigner<>nil then
|
||||
begin
|
||||
FDesignerSelectionStamp := ADesigner.Selection.ChangeStamp;
|
||||
FDesignerStamp := ADesigner.ChangeStamp;
|
||||
end;
|
||||
end;
|
||||
|
||||
//==============================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user