mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 03:09:32 +02:00
designer, component palette: turn "multy" mode on when shift is pressed during component selection (issue #0008052)
git-svn-id: trunk@21537 -
This commit is contained in:
parent
e9eb6109a6
commit
c680ad8794
@ -102,7 +102,7 @@ type
|
|||||||
FOnSaveAsXML: TNotifyEvent;
|
FOnSaveAsXML: TNotifyEvent;
|
||||||
FOnSetDesigning: TOnSetDesigning;
|
FOnSetDesigning: TOnSetDesigning;
|
||||||
FOnShowOptions: TNotifyEvent;
|
FOnShowOptions: TNotifyEvent;
|
||||||
FOnUnselectComponentClass: TNotifyEvent;
|
FOnComponentAdded: TNotifyEvent;
|
||||||
FOnViewLFM: TNotifyEvent;
|
FOnViewLFM: TNotifyEvent;
|
||||||
FShiftState: TShiftState;
|
FShiftState: TShiftState;
|
||||||
FTheFormEditor: TCustomFormEditor;
|
FTheFormEditor: TCustomFormEditor;
|
||||||
@ -303,9 +303,9 @@ type
|
|||||||
read FOnRenameComponent write FOnRenameComponent;
|
read FOnRenameComponent write FOnRenameComponent;
|
||||||
property OnSetDesigning: TOnSetDesigning
|
property OnSetDesigning: TOnSetDesigning
|
||||||
read FOnSetDesigning write FOnSetDesigning;
|
read FOnSetDesigning write FOnSetDesigning;
|
||||||
property OnUnselectComponentClass: TNotifyEvent
|
property OnComponentAdded: TNotifyEvent
|
||||||
read FOnUnselectComponentClass
|
read FOnComponentAdded
|
||||||
write FOnUnselectComponentClass;
|
write FOnComponentAdded;
|
||||||
property OnShowOptions: TNotifyEvent
|
property OnShowOptions: TNotifyEvent
|
||||||
read FOnShowOptions write FOnShowOptions;
|
read FOnShowOptions write FOnShowOptions;
|
||||||
property OnViewLFM: TNotifyEvent read FOnViewLFM write FOnViewLFM;
|
property OnViewLFM: TNotifyEvent read FOnViewLFM write FOnViewLFM;
|
||||||
@ -1582,10 +1582,8 @@ var
|
|||||||
// creation completed
|
// creation completed
|
||||||
// -> select new component
|
// -> select new component
|
||||||
SelectOnlyThisComponent(NewComponent);
|
SelectOnlyThisComponent(NewComponent);
|
||||||
if not (ssShift in Shift) then
|
if Assigned(FOnComponentAdded) then // this resets the component palette to the selection tool
|
||||||
if Assigned(FOnUnselectComponentClass) then
|
FOnComponentAdded(Self);
|
||||||
// this resets the component palette to the selection tool
|
|
||||||
FOnUnselectComponentClass(Self);
|
|
||||||
|
|
||||||
{$IFDEF VerboseDesigner}
|
{$IFDEF VerboseDesigner}
|
||||||
DebugLn('NEW COMPONENT ADDED: Form.ComponentCount=',DbgS(Form.ComponentCount),
|
DebugLn('NEW COMPONENT ADDED: Form.ComponentCount=',DbgS(Form.ComponentCount),
|
||||||
|
@ -48,6 +48,11 @@ uses
|
|||||||
FindPaletteComp;
|
FindPaletteComp;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
TComponentSelectionMode = (
|
||||||
|
csmSingle, // reset selection on component add
|
||||||
|
csmMulty // don't reset selection on component add
|
||||||
|
);
|
||||||
|
|
||||||
{ TComponentPalette }
|
{ TComponentPalette }
|
||||||
|
|
||||||
TComponentPalette = class(TBaseComponentPalette)
|
TComponentPalette = class(TBaseComponentPalette)
|
||||||
@ -68,6 +73,7 @@ type
|
|||||||
FOnOpenPackage: TNotifyEvent;
|
FOnOpenPackage: TNotifyEvent;
|
||||||
FOnOpenUnit: TNotifyEvent;
|
FOnOpenUnit: TNotifyEvent;
|
||||||
FSelected: TRegisteredComponent;
|
FSelected: TRegisteredComponent;
|
||||||
|
FSelectionMode: TComponentSelectionMode;
|
||||||
fUnregisteredIcon: TCustomBitmap;
|
fUnregisteredIcon: TCustomBitmap;
|
||||||
fSelectButtonIcon: TCustomBitmap;
|
fSelectButtonIcon: TCustomBitmap;
|
||||||
fUpdatingNotebook: boolean;
|
fUpdatingNotebook: boolean;
|
||||||
@ -88,6 +94,7 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
procedure DoAfterComponentAdded;
|
||||||
function GetUnregisteredIcon: TCustomBitmap;
|
function GetUnregisteredIcon: TCustomBitmap;
|
||||||
function GetSelectButtonIcon: TCustomBitmap;
|
function GetSelectButtonIcon: TCustomBitmap;
|
||||||
procedure ClearButtons; override;
|
procedure ClearButtons; override;
|
||||||
@ -103,6 +110,7 @@ type
|
|||||||
public
|
public
|
||||||
property NoteBook: TNotebook read FNoteBook write SetNoteBook;
|
property NoteBook: TNotebook read FNoteBook write SetNoteBook;
|
||||||
property Selected: TRegisteredComponent read FSelected write SetSelected;
|
property Selected: TRegisteredComponent read FSelected write SetSelected;
|
||||||
|
property SelectionMode: TComponentSelectionMode read FSelectionMode write FSelectionMode;
|
||||||
property OnOpenPackage: TNotifyEvent read FOnOpenPackage write FOnOpenPackage;
|
property OnOpenPackage: TNotifyEvent read FOnOpenPackage write FOnOpenPackage;
|
||||||
property OnOpenUnit: TNotifyEvent read FOnOpenUnit write FOnOpenUnit;
|
property OnOpenUnit: TNotifyEvent read FOnOpenUnit write FOnOpenUnit;
|
||||||
end;
|
end;
|
||||||
@ -228,6 +236,10 @@ end;
|
|||||||
|
|
||||||
procedure TComponentPalette.ComponentBtnClick(Sender: TObject);
|
procedure TComponentPalette.ComponentBtnClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
if ssShift in GetKeyShiftState then
|
||||||
|
SelectionMode := csmMulty
|
||||||
|
else
|
||||||
|
SelectionMode := csmSingle;
|
||||||
SelectButton(TComponent(Sender));
|
SelectButton(TComponent(Sender));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -369,6 +381,7 @@ end;
|
|||||||
constructor TComponentPalette.Create;
|
constructor TComponentPalette.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
FSelectionMode := csmSingle;
|
||||||
fComponents:=TAVLTree.Create(@CompareRegisteredComponents);
|
fComponents:=TAVLTree.Create(@CompareRegisteredComponents);
|
||||||
OnComponentIsInvisible:=@CheckComponentDesignerVisible;
|
OnComponentIsInvisible:=@CheckComponentDesignerVisible;
|
||||||
end;
|
end;
|
||||||
@ -385,6 +398,12 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TComponentPalette.DoAfterComponentAdded;
|
||||||
|
begin
|
||||||
|
if not (ssShift in GetKeyShiftState) and (SelectionMode = csmSingle) then
|
||||||
|
Selected := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
function TComponentPalette.GetUnregisteredIcon: TCustomBitMap;
|
function TComponentPalette.GetUnregisteredIcon: TCustomBitMap;
|
||||||
begin
|
begin
|
||||||
if fUnregisteredIcon = nil then
|
if fUnregisteredIcon = nil then
|
||||||
@ -422,9 +441,9 @@ function TComponentPalette.SelectButton(Button: TComponent): boolean;
|
|||||||
var
|
var
|
||||||
NewComponent: TRegisteredComponent;
|
NewComponent: TRegisteredComponent;
|
||||||
begin
|
begin
|
||||||
NewComponent:=FindButton(Button);
|
NewComponent := FindButton(Button);
|
||||||
Selected:=NewComponent;
|
Selected := NewComponent;
|
||||||
Result:=(Selected=NewComponent);
|
Result := (Selected = NewComponent);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TComponentPalette.ReAlignButtons(Page: TPage);
|
procedure TComponentPalette.ReAlignButtons(Page: TPage);
|
||||||
|
@ -437,7 +437,7 @@ type
|
|||||||
// designer events
|
// designer events
|
||||||
procedure OnDesignerGetSelectedComponentClass(Sender: TObject;
|
procedure OnDesignerGetSelectedComponentClass(Sender: TObject;
|
||||||
var RegisteredComponent: TRegisteredComponent);
|
var RegisteredComponent: TRegisteredComponent);
|
||||||
procedure OnDesignerUnselectComponentClass(Sender: TObject);
|
procedure OnDesignerComponentAdded(Sender: TObject);
|
||||||
procedure OnDesignerSetDesigning(Sender: TObject; Component: TComponent;
|
procedure OnDesignerSetDesigning(Sender: TObject; Component: TComponent;
|
||||||
Value: boolean);
|
Value: boolean);
|
||||||
procedure OnDesignerShowOptions(Sender: TObject);
|
procedure OnDesignerShowOptions(Sender: TObject);
|
||||||
@ -3152,7 +3152,7 @@ begin
|
|||||||
OnRenameComponent:=@OnDesignerRenameComponent;
|
OnRenameComponent:=@OnDesignerRenameComponent;
|
||||||
OnSetDesigning:=@OnDesignerSetDesigning;
|
OnSetDesigning:=@OnDesignerSetDesigning;
|
||||||
OnShowOptions:=@OnDesignerShowOptions;
|
OnShowOptions:=@OnDesignerShowOptions;
|
||||||
OnUnselectComponentClass:=@OnDesignerUnselectComponentClass;
|
OnComponentAdded:=@OnDesignerComponentAdded;
|
||||||
OnViewLFM:=@OnDesignerViewLFM;
|
OnViewLFM:=@OnDesignerViewLFM;
|
||||||
OnSaveAsXML:=@OnDesignerSaveAsXML;
|
OnSaveAsXML:=@OnDesignerSaveAsXML;
|
||||||
ShowEditorHints:=EnvironmentOptions.ShowEditorHints;
|
ShowEditorHints:=EnvironmentOptions.ShowEditorHints;
|
||||||
@ -11812,9 +11812,9 @@ begin
|
|||||||
RegisteredComponent:=TComponentPalette(IDEComponentPalette).Selected;
|
RegisteredComponent:=TComponentPalette(IDEComponentPalette).Selected;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.OnDesignerUnselectComponentClass(Sender: TObject);
|
procedure TMainIDE.OnDesignerComponentAdded(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
TComponentPalette(IDEComponentPalette).Selected:=nil;
|
TComponentPalette(IDEComponentPalette).DoAfterComponentAdded;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.OnDesignerSetDesigning(Sender: TObject;
|
procedure TMainIDE.OnDesignerSetDesigning(Sender: TObject;
|
||||||
|
Loading…
Reference in New Issue
Block a user