mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-03 17:39:44 +01:00
IDE: fixed renaming components, simplified designer undo
git-svn-id: trunk@44173 -
This commit is contained in:
parent
1217b68eb7
commit
41460c7d4f
@ -25,7 +25,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, Forms, Controls, Dialogs,
|
||||
ActnList, ExtCtrls, ComCtrls, Buttons, StdCtrls, ObjInspStrConsts,
|
||||
ActnList, ExtCtrls, Buttons, StdCtrls, ObjInspStrConsts,
|
||||
ComponentEditors, PropEdits, PropEditUtils, DBActns, StdActns, LCLIntf,
|
||||
LCLType, Graphics, Menus, contnrs;
|
||||
|
||||
@ -118,17 +118,17 @@ type
|
||||
procedure ActionListEditorClose(Sender: TObject;
|
||||
var CloseAction: TCloseAction);
|
||||
procedure ActionListEditorKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
{%H-}Shift: TShiftState);
|
||||
procedure ActionListEditorKeyPress(Sender: TObject; var Key: char);
|
||||
procedure lstActionNameDrawItem(Control: TWinControl; Index: Integer;
|
||||
ARect: TRect; State: TOwnerDrawState);
|
||||
procedure SBShowMenuNewActionsClick(Sender: TObject);
|
||||
procedure SplitterCanResize(Sender: TObject; var NewSize: Integer;
|
||||
var Accept: Boolean);
|
||||
procedure SplitterCanResize(Sender: TObject; var {%H-}NewSize: Integer;
|
||||
var {%H-}Accept: Boolean);
|
||||
procedure lstActionNameKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure lstActionNameMouseDown(Sender: TOBject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
{%H-}Shift: TShiftState; {%H-}X, Y: Integer);
|
||||
procedure lstCategoryClick(Sender: TObject);
|
||||
procedure lstActionNameClick(Sender: TObject);
|
||||
procedure lstActionNameDblClick(Sender: TObject);
|
||||
@ -167,8 +167,8 @@ type
|
||||
procedure Edit; override;
|
||||
property ActionList: TActionList read FActionList write FActionList;
|
||||
function GetVerbCount: Integer; override;
|
||||
function GetVerb(Index: Integer): string; override;
|
||||
procedure ExecuteVerb(Index: Integer); override;
|
||||
function GetVerb({%H-}Index: Integer): string; override;
|
||||
procedure ExecuteVerb({%H-}Index: Integer); override;
|
||||
end;
|
||||
|
||||
{ Action Registration }
|
||||
@ -239,7 +239,7 @@ var
|
||||
procedure RegisterActions(const ACategory: string;
|
||||
const AClasses: array of TBasicActionClass;
|
||||
AResource: TComponentClass);
|
||||
procedure UnRegisterActions(const Classes: array of TBasicActionClass);
|
||||
procedure UnRegisterActions(const {%H-}Classes: array of TBasicActionClass);
|
||||
procedure EnumActions(Proc: TEnumActionProc; Info: Pointer);
|
||||
function CreateAction(TheOwner: TComponent;
|
||||
ActionClass: TBasicActionClass): TBasicAction;
|
||||
|
||||
@ -26,7 +26,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
ComCtrls, Buttons, ActnList, StdActns, DBActns, LCLType, Contnrs,
|
||||
ComCtrls, Buttons, ActnList, StdActns, DBActns, LCLType,
|
||||
LCLProc, ActionsEditor, ObjInspStrConsts, ExtCtrls, ButtonPanel;
|
||||
|
||||
type
|
||||
|
||||
@ -20,7 +20,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, TypInfo, Maps, LCLProc, Forms, Controls, Menus,
|
||||
ExtCtrls, CustomTimer, StdCtrls, Graphics, Grids, CheckLst, Buttons, ComCtrls, Dialogs,
|
||||
ExtCtrls, CustomTimer, Graphics, Grids, CheckLst, Buttons, ComCtrls, Dialogs,
|
||||
LazStringGridEdit, CheckListboxEditorDlg, CheckGroupEditorDlg, GraphType,
|
||||
PropEdits, PropEditUtils,
|
||||
ObjInspStrConsts;
|
||||
@ -81,8 +81,8 @@ type
|
||||
function CanRedo: Boolean; virtual; abstract;
|
||||
function Undo: Boolean; virtual; abstract;
|
||||
function Redo: Boolean; virtual; abstract;
|
||||
function AddUndoAction(const AComp: TComponent; AOpType: TUndoOpType;
|
||||
IsSetNewId: boolean; AFieldName: string; const AOldVal, ANewVal: variant): boolean; virtual; abstract;
|
||||
function AddUndoAction(const aPersistent: TPersistent; aOpType: TUndoOpType;
|
||||
IsSetNewId: boolean; aFieldName: string; const aOldVal, aNewVal: variant): boolean; virtual; abstract;
|
||||
function IsUndoLocked: boolean; virtual; abstract;
|
||||
|
||||
procedure DrawDesignerItems(OnlyIfNeeded: boolean); virtual; abstract;
|
||||
@ -180,8 +180,8 @@ type
|
||||
TBaseComponentEditor = class
|
||||
protected
|
||||
public
|
||||
constructor Create(AComponent: TComponent;
|
||||
ADesigner: TComponentEditorDesigner); virtual;
|
||||
constructor Create({%H-}AComponent: TComponent;
|
||||
{%H-}ADesigner: TComponentEditorDesigner); virtual;
|
||||
procedure Copy; virtual; abstract;
|
||||
procedure Edit; virtual; abstract;
|
||||
procedure ExecuteVerb(Index: Integer); virtual; abstract;
|
||||
@ -221,7 +221,7 @@ type
|
||||
function GetVerbCount: Integer; override;
|
||||
function IsInInlined: Boolean; override;
|
||||
procedure Copy; override;
|
||||
procedure PrepareItem(Index: Integer; const AnItem: TMenuItem); override;
|
||||
procedure PrepareItem({%H-}Index: Integer; const {%H-}AnItem: TMenuItem); override;
|
||||
property Component: TComponent read FComponent;
|
||||
property Designer: TComponentEditorDesigner read GetDesigner;
|
||||
function GetHook(out Hook: TPropertyEditorHook): boolean; override;
|
||||
@ -246,7 +246,7 @@ type
|
||||
procedure CheckEdit(Prop: TPropertyEditor);
|
||||
protected
|
||||
procedure EditProperty(const Prop: TPropertyEditor;
|
||||
var Continue: Boolean); virtual;
|
||||
var {%H-}Continue: Boolean); virtual;
|
||||
procedure ClearPropEditorCandidates;
|
||||
public
|
||||
constructor Create(AComponent: TComponent;
|
||||
@ -254,8 +254,8 @@ type
|
||||
destructor Destroy; override;
|
||||
procedure Edit; override;
|
||||
function GetVerbCount: Integer; override;
|
||||
function GetVerb(Index: Integer): string; override;
|
||||
procedure ExecuteVerb(Index: Integer); override;
|
||||
function GetVerb({%H-}Index: Integer): string; override;
|
||||
procedure ExecuteVerb({%H-}Index: Integer); override;
|
||||
property BestEditEvent: string read FBestEditEvent write FBestEditEvent;
|
||||
end;
|
||||
|
||||
@ -356,8 +356,8 @@ type
|
||||
protected
|
||||
procedure DoShowEditor;
|
||||
public
|
||||
procedure ExecuteVerb(Index: Integer); override;
|
||||
function GetVerb(Index: Integer): string; override;
|
||||
procedure ExecuteVerb({%H-}Index: Integer); override;
|
||||
function GetVerb({%H-}Index: Integer): string; override;
|
||||
function GetVerbCount: Integer; override;
|
||||
end;
|
||||
|
||||
@ -369,8 +369,8 @@ type
|
||||
protected
|
||||
procedure DoShowEditor;
|
||||
public
|
||||
procedure ExecuteVerb(Index: Integer); override;
|
||||
function GetVerb(Index: Integer): string; override;
|
||||
procedure ExecuteVerb({%H-}Index: Integer); override;
|
||||
function GetVerb({%H-}Index: Integer): string; override;
|
||||
function GetVerbCount: Integer; override;
|
||||
end;
|
||||
|
||||
|
||||
@ -46,8 +46,8 @@ type
|
||||
TDBGridComponentEditor = class(TComponentEditor)
|
||||
public
|
||||
function GetVerbCount: Integer; override;
|
||||
function GetVerb(Index: Integer): string; override;
|
||||
procedure ExecuteVerb(Index: Integer); override;
|
||||
function GetVerb({%H-}Index: Integer): string; override;
|
||||
procedure ExecuteVerb({%H-}Index: Integer); override;
|
||||
end;
|
||||
|
||||
function GetFieldDefsLookupRoot(APersistent: TPersistent): TPersistent;
|
||||
|
||||
@ -19,7 +19,7 @@ uses
|
||||
Classes, SysUtils, TypInfo, LCLProc, Forms, Controls, Menus, Graphics,
|
||||
Dialogs, ComCtrls, db, ActnList, StdCtrls, ObjInspStrConsts, ComponentEditors,
|
||||
PropEdits, PropEditUtils, LCLType, ExtCtrls, NewField, FieldsList,
|
||||
ComponentReg, types;
|
||||
types;
|
||||
|
||||
type
|
||||
|
||||
@ -57,14 +57,14 @@ type
|
||||
MenuItem4: TMenuItem;
|
||||
MenuItem5: TMenuItem;
|
||||
PopupMenu1: TPopupMenu;
|
||||
procedure ActionList1Update(AAction: TBasicAction; var Handled: Boolean);
|
||||
procedure ActionList1Update({%H-}AAction: TBasicAction; var {%H-}Handled: Boolean);
|
||||
procedure AddFieldsActnExecute(Sender: TObject);
|
||||
procedure DeleteFieldsActnExecute(Sender: TObject);
|
||||
procedure FieldsEditorFrmClose(Sender: TObject;
|
||||
var CloseAction: TCloseAction);
|
||||
procedure FieldsEditorFrmDestroy(Sender: TObject);
|
||||
procedure FieldsListBoxDrawItem(Control: TWinControl; Index: Integer;
|
||||
ARect: TRect; State: TOwnerDrawState);
|
||||
procedure FieldsListBoxDrawItem({%H-}Control: TWinControl; Index: Integer;
|
||||
ARect: TRect; {%H-}State: TOwnerDrawState);
|
||||
procedure FieldsListBoxKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure NewActnExecute(Sender: TObject);
|
||||
|
||||
@ -32,7 +32,7 @@ unit fieldslist;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls,
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
|
||||
Buttons, DB, StdCtrls, ObjInspStrConsts, ComponentEditors, PropEdits;
|
||||
|
||||
type
|
||||
|
||||
@ -52,7 +52,7 @@ type
|
||||
public
|
||||
class function FormClass: TComponentClass; virtual; abstract;
|
||||
class function CreateMediator(TheOwner, aForm: TComponent): TDesignerMediator; virtual;
|
||||
class procedure InitFormInstance(aForm: TComponent); virtual; // called after NewInstance, before constructor
|
||||
class procedure InitFormInstance({%H-}aForm: TComponent); virtual; // called after NewInstance, before constructor
|
||||
public
|
||||
procedure SetBounds(AComponent: TComponent; NewBounds: TRect); virtual;
|
||||
procedure GetBounds(AComponent: TComponent; out CurBounds: TRect); virtual;
|
||||
@ -61,23 +61,23 @@ type
|
||||
procedure GetClientArea(AComponent: TComponent; out CurClientArea: TRect;
|
||||
out ScrollOffset: TPoint); virtual;
|
||||
function GetComponentOriginOnForm(AComponent: TComponent): TPoint; virtual;
|
||||
function ComponentIsIcon(AComponent: TComponent): boolean; virtual;
|
||||
function ParentAcceptsChild(Parent: TComponent; Child: TComponentClass): boolean; virtual;
|
||||
function ComponentIsVisible(AComponent: TComponent): Boolean; virtual;
|
||||
function ComponentIsSelectable(AComponent: TComponent): Boolean; virtual;
|
||||
function ComponentIsIcon({%H-}AComponent: TComponent): boolean; virtual;
|
||||
function ParentAcceptsChild({%H-}Parent: TComponent; {%H-}Child: TComponentClass): boolean; virtual;
|
||||
function ComponentIsVisible({%H-}AComponent: TComponent): Boolean; virtual;
|
||||
function ComponentIsSelectable({%H-}AComponent: TComponent): Boolean; virtual;
|
||||
function ComponentAtPos(p: TPoint; MinClass: TComponentClass;
|
||||
Flags: TDMCompAtPosFlags): TComponent; virtual;
|
||||
procedure GetChildComponents(Parent: TComponent; ChildComponents: TFPList); virtual;
|
||||
function UseRTTIForMethods(aComponent: TComponent): boolean; virtual; // false = use sources
|
||||
function UseRTTIForMethods({%H-}aComponent: TComponent): boolean; virtual; // false = use sources
|
||||
|
||||
// events
|
||||
procedure InitComponent(AComponent, NewParent: TComponent; NewBounds: TRect); virtual;
|
||||
procedure Paint; virtual;
|
||||
procedure KeyDown(Sender: TControl; var Key: word; Shift: TShiftState); virtual;
|
||||
procedure KeyUp(Sender: TControl; var Key: word; Shift: TShiftState); virtual;
|
||||
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; p: TPoint; var Handled: boolean); virtual;
|
||||
procedure MouseMove(Shift: TShiftState; p: TPoint; var Handled: boolean); virtual;
|
||||
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; p: TPoint; var Handled: boolean); virtual;
|
||||
procedure KeyDown(Sender: TControl; var {%H-}Key: word; {%H-}Shift: TShiftState); virtual;
|
||||
procedure KeyUp(Sender: TControl; var {%H-}Key: word; {%H-}Shift: TShiftState); virtual;
|
||||
procedure MouseDown({%H-}Button: TMouseButton; {%H-}Shift: TShiftState; {%H-}p: TPoint; var {%H-}Handled: boolean); virtual;
|
||||
procedure MouseMove({%H-}Shift: TShiftState; {%H-}p: TPoint; var {%H-}Handled: boolean); virtual;
|
||||
procedure MouseUp({%H-}Button: TMouseButton; {%H-}Shift: TShiftState; {%H-}p: TPoint; var {%H-}Handled: boolean); virtual;
|
||||
|
||||
property LCLForm: TForm read FLCLForm write SetLCLForm;
|
||||
property Designer: TComponentEditorDesigner read FDesigner write SetDesigner;
|
||||
|
||||
@ -11,8 +11,6 @@
|
||||
</SearchPaths>
|
||||
<Other>
|
||||
<Verbosity>
|
||||
<ShowNotes Value="False"/>
|
||||
<ShowHints Value="False"/>
|
||||
<ShowGenInfo Value="False"/>
|
||||
</Verbosity>
|
||||
<CustomOptions Value="$(IDEBuildOptions)"/>
|
||||
@ -314,7 +312,7 @@
|
||||
</Item72>
|
||||
<Item73>
|
||||
<Filename Value="ideutils.pas"/>
|
||||
<UnitName Value="ideutils"/>
|
||||
<UnitName Value="IDEUtils"/>
|
||||
</Item73>
|
||||
</Files>
|
||||
<LazDoc Paths="docs"/>
|
||||
|
||||
@ -96,8 +96,8 @@ type
|
||||
protected
|
||||
procedure DoShowEditor;
|
||||
public
|
||||
procedure ExecuteVerb(Index: Integer); override;
|
||||
function GetVerb(Index: Integer): String; override;
|
||||
procedure ExecuteVerb({%H-}Index: Integer); override;
|
||||
function GetVerb({%H-}Index: Integer): String; override;
|
||||
function GetVerbCount: Integer; override;
|
||||
end;
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, MaskUtils, Forms, Controls, Graphics, Dialogs,
|
||||
StrUtils, StdCtrls, Buttons, ExtCtrls, FileUtil, MaskEdit, LazIDEIntf,
|
||||
StdCtrls, Buttons, ExtCtrls, FileUtil, MaskEdit, LazIDEIntf,
|
||||
PropEdits, ComponentEditors, ObjInspStrConsts, ButtonPanel;
|
||||
|
||||
type
|
||||
@ -42,7 +42,7 @@ type
|
||||
TestInputPanel: TPanel;
|
||||
procedure LoadSampleMasksButtonClick(Sender: TObject);
|
||||
procedure SampleMasksListBoxDrawItem(Control: TWinControl; Index: Integer;
|
||||
ARect: TRect; State: TOwnerDrawState);
|
||||
ARect: TRect; {%H-}State: TOwnerDrawState);
|
||||
procedure SaveLiteralCheckBoxClick(Sender: TObject);
|
||||
procedure InputMaskEditChange(Sender: TObject);
|
||||
procedure CharactersForBlankEditChange(Sender: TObject);
|
||||
|
||||
@ -17,7 +17,7 @@ unit newfield;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, Math, SysUtils, DBConst, LCLIntf, Graphics, Controls, Forms, Dialogs,
|
||||
Classes, Math, SysUtils, LCLIntf, Graphics, Controls, Forms, Dialogs,
|
||||
ExtCtrls, StdCtrls, Buttons, DB, ObjInspStrConsts,
|
||||
ComponentEditors, PropEdits, PropEditUtils, TypInfo;
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
}
|
||||
unit ObjectInspector;
|
||||
|
||||
{$MODE OBJFPC}{$H+}
|
||||
{$Mode objfpc}{$H+}
|
||||
|
||||
{off $DEFINE DoNotCatchOIExceptions}
|
||||
|
||||
@ -30,7 +30,7 @@ uses
|
||||
// IMPORTANT: the object inspector is a tool and can be used in other programs
|
||||
// too. Don't put Lazarus IDE specific things here.
|
||||
// FCL
|
||||
SysUtils, Types, Classes, TypInfo, contnrs, FPCanvas,
|
||||
SysUtils, Types, Classes, TypInfo, FPCanvas,
|
||||
// LCL
|
||||
InterfaceBase, Forms, Buttons, Graphics, GraphType, LCLProc, StdCtrls,
|
||||
LCLType, LCLIntf, Controls, ComCtrls, ExtCtrls, LMessages, LResources,
|
||||
@ -308,7 +308,7 @@ type
|
||||
procedure HintTimer(Sender: TObject);
|
||||
procedure ResetHintTimer;
|
||||
procedure HideHint;
|
||||
procedure OnUserInput(Sender: TObject; Msg: Cardinal);
|
||||
procedure OnUserInput(Sender: TObject; {%H-}Msg: Cardinal);
|
||||
procedure HintMouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
|
||||
@ -364,16 +364,16 @@ type
|
||||
procedure RefreshValueEdit;
|
||||
procedure ToggleRow;
|
||||
procedure ValueEditDblClick(Sender : TObject);
|
||||
procedure ValueControlMouseDown(Sender: TObject; Button:TMouseButton;
|
||||
Shift: TShiftState; X,Y:integer);
|
||||
procedure ValueControlMouseMove(Sender: TObject; Shift: TShiftState;
|
||||
X,Y:integer);
|
||||
procedure ValueControlMouseDown(Sender: TObject; {%H-}Button:TMouseButton;
|
||||
{%H-}Shift: TShiftState; {%H-}X,{%H-}Y:integer);
|
||||
procedure ValueControlMouseMove(Sender: TObject; {%H-}Shift: TShiftState;
|
||||
{%H-}X,{%H-}Y:integer);
|
||||
procedure ValueEditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure ValueEditKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure ValueEditExit(Sender: TObject);
|
||||
procedure ValueEditChange(Sender: TObject);
|
||||
procedure ValueEditMouseUp(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
Shift: TShiftState; {%H-}X, {%H-}Y: Integer);
|
||||
procedure ValueCheckBoxKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure ValueCheckBoxKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure ValueCheckBoxExit(Sender: TObject);
|
||||
@ -382,15 +382,15 @@ type
|
||||
procedure ValueComboBoxKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure ValueComboBoxKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure ValueComboBoxMouseUp(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
Shift: TShiftState; {%H-}X, {%H-}Y: Integer);
|
||||
procedure ValueComboBoxCloseUp(Sender: TObject);
|
||||
procedure ValueComboBoxGetItems(Sender: TObject);
|
||||
procedure ValueButtonClick(Sender: TObject);
|
||||
procedure ValueComboBoxMeasureItem(Control: TWinControl; Index: Integer;
|
||||
procedure ValueComboBoxMeasureItem({%H-}Control: TWinControl; Index: Integer;
|
||||
var AHeight: Integer);
|
||||
procedure ValueComboBoxDrawItem(Control: TWinControl; Index: Integer;
|
||||
procedure ValueComboBoxDrawItem({%H-}Control: TWinControl; Index: Integer;
|
||||
ARect: TRect; State: TOwnerDrawState);
|
||||
procedure OnIdle(Sender: TObject; var Done: Boolean);
|
||||
procedure OnIdle(Sender: TObject; var {%H-}Done: Boolean);
|
||||
procedure SetIdleEvent(Enable: boolean);
|
||||
|
||||
procedure WMVScroll(var Msg: TLMScroll); message LM_VSCROLL;
|
||||
@ -428,7 +428,7 @@ type
|
||||
function CanEditRowValue(CheckFocus: boolean): boolean;
|
||||
procedure SaveChanges;
|
||||
function ConsistencyCheck: integer;
|
||||
procedure EraseBackground(DC: HDC); override;
|
||||
procedure EraseBackground({%H-}DC: HDC); override;
|
||||
function GetActiveRow: TOIPropertyGridRow;
|
||||
function GetHintTypeAt(RowIndex: integer; X: integer): TPropEditHint;
|
||||
|
||||
@ -1290,20 +1290,49 @@ begin
|
||||
end;
|
||||
|
||||
procedure TOICustomPropertyGrid.SetRowValue(CheckFocus: boolean);
|
||||
|
||||
function GetPropValue(Editor: TPropertyEditor; Index: integer): string;
|
||||
var
|
||||
PropKind: TTypeKind;
|
||||
PropInfo: PPropInfo;
|
||||
begin
|
||||
Result:='';
|
||||
PropInfo := Editor.GetPropInfo;
|
||||
PropKind := PropInfo^.PropType^.Kind;
|
||||
case PropKind of
|
||||
tkInteger, tkInt64:
|
||||
Result := IntToStr(Editor.GetInt64ValueAt(Index));
|
||||
tkChar, tkWChar, tkUChar:
|
||||
Result := Char(Editor.GetOrdValueAt(Index));
|
||||
tkEnumeration:
|
||||
Result := GetEnumName(PropInfo^.PropType, Editor.GetOrdValueAt(Index));
|
||||
tkFloat:
|
||||
Result := FloatToStr(Editor.GetFloatValueAt(Index));
|
||||
tkBool:
|
||||
Result := BoolToStr(Boolean(Editor.GetOrdValueAt(Index)), 'True', 'False');
|
||||
tkString, tkLString, tkAString, tkUString, tkWString:
|
||||
Result := Editor.GetStrValueAt(Index);
|
||||
tkSet:
|
||||
Result := Editor.GetSetValueAt(Index,true);
|
||||
tkVariant:
|
||||
Result := Editor.GetVarValueAt(Index);
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
CurRow: TOIPropertyGridRow;
|
||||
NewValue: string;
|
||||
OldExpanded: boolean;
|
||||
OldChangeStep: integer;
|
||||
RootDesigner: TIDesigner;
|
||||
CurrComp: TComponent;
|
||||
i, j, saveIndex, tmpInt: integer;
|
||||
newVal, tmpStr, newValAsInt: string;
|
||||
APersistent: TPersistent;
|
||||
i: integer;
|
||||
NewVal: string;
|
||||
oldVal: array of string;
|
||||
isExcept, isIntValInStr: boolean;
|
||||
parRow, tmpRow: TOIPropertyGridRow;
|
||||
isExcept: boolean;
|
||||
CompEditDsg: TComponentEditorDesigner;
|
||||
prpInfo: PPropInfo;
|
||||
Editor: TPropertyEditor;
|
||||
begin
|
||||
//debugln(['TOICustomPropertyGrid.SetRowValue A ',dbgs(FStates*[pgsChangingItemIndex,pgsApplyingValue]<>[]),' FItemIndex=',dbgs(FItemIndex),' CanEditRowValue=',CanEditRowValue]);
|
||||
if not CanEditRowValue(CheckFocus) or Rows[FItemIndex].IsReadOnly then exit;
|
||||
@ -1322,42 +1351,15 @@ begin
|
||||
CompEditDsg := TComponentEditorDesigner(RootDesigner);
|
||||
if CompEditDsg.IsUndoLocked then Exit;
|
||||
|
||||
// store old values for undo
|
||||
isExcept := false;
|
||||
saveIndex := FItemIndex;
|
||||
SetLength(oldVal, Selection.Count);
|
||||
for i := 0 to Selection.Count - 1 do
|
||||
begin
|
||||
CurrComp := CompEditDsg.Form.FindComponent(Selection.Items[i].GetNamePath);
|
||||
|
||||
while CurRow.Parent <> nil do
|
||||
CurRow := CurRow.Parent;
|
||||
|
||||
prpInfo := GetPropInfo(TObject(CurrComp), CurRow.Name);
|
||||
if not Assigned(prpInfo) then
|
||||
ShowMessage('error: propInfo = nil')
|
||||
else
|
||||
case prpInfo^.PropType^.Kind of
|
||||
tkInteger, tkInt64:
|
||||
oldVal[i] := IntToStr(GetOrdProp(TObject(CurrComp), prpInfo));
|
||||
tkChar, tkWChar, tkUChar:
|
||||
oldVal[i] := Char(GetOrdProp(TObject(CurrComp), prpInfo));
|
||||
tkEnumeration:
|
||||
oldVal[i] := GetEnumName(prpInfo^.PropType, GetOrdProp(TObject(CurrComp), CurRow.Name));
|
||||
tkFloat:
|
||||
oldVal[i] := FloatToStr(GetFloatProp(TObject(CurrComp), prpInfo));
|
||||
tkBool:
|
||||
oldVal[i] := BoolToStr(Boolean(GetOrdProp(TObject(CurrComp), prpInfo)), 'True', 'False');
|
||||
tkString, tkLString, tkAString, tkUString, tkWString:
|
||||
oldVal[i] := GetStrProp(TObject(CurrComp), prpInfo);
|
||||
tkSet:
|
||||
oldVal[i] := GetSetProp(TObject(CurrComp), CurRow.Name);
|
||||
tkVariant:
|
||||
oldVal[i] := GetVariantProp(TObject(CurrComp), prpInfo);
|
||||
end;
|
||||
Editor:=CurRow.Editor;
|
||||
SetLength(oldVal, Editor.PropCount);
|
||||
prpInfo := Editor.GetPropInfo;
|
||||
if prpInfo<>nil then begin
|
||||
for i := 0 to Editor.PropCount - 1 do
|
||||
oldVal[i] := GetPropValue(Editor,i);
|
||||
end;
|
||||
FItemIndex := saveIndex;
|
||||
CurRow := Rows[FItemIndex];
|
||||
|
||||
|
||||
OldChangeStep:=fChangeStep;
|
||||
Include(FStates,pgsApplyingValue);
|
||||
@ -1381,30 +1383,16 @@ begin
|
||||
exit;
|
||||
end;
|
||||
|
||||
// add Undo action
|
||||
if not isExcept then
|
||||
begin
|
||||
if Assigned(prpInfo) and (prpInfo^.PropType^.Kind = tkSet) then
|
||||
newVal := GetSetProp(TObject(CurrComp), CurRow.Parent.Name)
|
||||
else if Assigned(prpInfo) and (prpInfo^.PropType^.Kind = tkInteger) and not TryStrToInt(NewValue, i) then
|
||||
newVal := IntToStr(CurRow.Editor.GetOrdValue)
|
||||
else
|
||||
newVal := NewValue;
|
||||
|
||||
for i := 0 to Selection.Count - 1 do
|
||||
for i := 0 to Editor.PropCount - 1 do
|
||||
begin
|
||||
CurRow := Rows[saveIndex];
|
||||
if CompEditDsg.Form.Name = Selection.Items[i].GetNamePath then
|
||||
CurrComp := CompEditDsg.Form
|
||||
else
|
||||
CurrComp := CompEditDsg.Form.FindComponent(Selection.Items[i].GetNamePath);
|
||||
if CurrComp <> nil then
|
||||
begin
|
||||
while CurRow.Parent <> nil do
|
||||
CurRow := CurRow.Parent;
|
||||
|
||||
CompEditDsg.AddUndoAction(CurrComp, uopChange, i = 0,
|
||||
curRow.Name, oldVal[i], newVal);
|
||||
end;
|
||||
APersistent := Editor.GetComponent(i);
|
||||
if APersistent=nil then continue;
|
||||
NewVal := GetPropValue(Editor,i);
|
||||
CompEditDsg.AddUndoAction(APersistent, uopChange, i = 0,
|
||||
Editor.GetName, oldVal[i], NewVal);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -4883,7 +4871,7 @@ var
|
||||
begin
|
||||
if (RestrictedProps = nil) or (Selection = nil) then exit;
|
||||
|
||||
FillChar(WidgetSetRestrictions, SizeOf(WidgetSetRestrictions), 0);
|
||||
FillChar(WidgetSetRestrictions{%H-}, SizeOf(WidgetSetRestrictions), 0);
|
||||
for I := 0 to RestrictedProps.Count - 1 do
|
||||
begin
|
||||
if RestrictedProps.Items[I] is TOIRestrictedProperty then
|
||||
@ -5210,7 +5198,7 @@ var
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure AddCollectionEditorMenuItems(ACollection: TCollection);
|
||||
procedure AddCollectionEditorMenuItems({%H-}ACollection: TCollection);
|
||||
var
|
||||
Item: TMenuItem;
|
||||
begin
|
||||
|
||||
@ -281,7 +281,7 @@ type
|
||||
|
||||
{ TPropertyEditor }
|
||||
|
||||
TPropertyEditor=class
|
||||
TPropertyEditor = class
|
||||
private
|
||||
FOnSubPropertiesChanged: TNotifyEvent;
|
||||
FPropertyHook: TPropertyEditorHook;
|
||||
@ -324,6 +324,8 @@ type
|
||||
function GetObjectValueAt(Index: Integer): TObject;
|
||||
function GetObjectValueAt(Index: Integer; MinClass: TClass): TObject;
|
||||
function GetDefaultOrdValue: Longint;
|
||||
function GetSetValue(Brackets: boolean): AnsiString;
|
||||
function GetSetValueAt(Index: Integer; Brackets: boolean): AnsiString;
|
||||
function GetStrValue: AnsiString;
|
||||
function GetStrValueAt(Index: Integer): AnsiString;
|
||||
function GetVarValue: Variant;
|
||||
@ -2496,12 +2498,22 @@ var
|
||||
APropInfo: PPropInfo;
|
||||
begin
|
||||
APropInfo:=FPropList^[0].PropInfo;
|
||||
{if HasAncestor then
|
||||
Result:=GetOrdValue(Ancestor,APropInfo)
|
||||
else}
|
||||
Result:=APropInfo^.Default;
|
||||
end;
|
||||
|
||||
function TPropertyEditor.GetSetValue(Brackets: boolean): AnsiString;
|
||||
begin
|
||||
with FPropList^[0] do
|
||||
Result:=GetSetProp(Instance,PropInfo,Brackets);
|
||||
end;
|
||||
|
||||
function TPropertyEditor.GetSetValueAt(Index: Integer; Brackets: boolean
|
||||
): AnsiString;
|
||||
begin
|
||||
with FPropList^[Index] do
|
||||
Result:=GetSetProp(Instance,PropInfo,Brackets);
|
||||
end;
|
||||
|
||||
function TPropertyEditor.GetPrivateDirectory:ansistring;
|
||||
begin
|
||||
Result:='';
|
||||
|
||||
@ -302,8 +302,8 @@ type
|
||||
function CanRedo: Boolean; override;
|
||||
function Undo: Boolean; override;
|
||||
function Redo: Boolean; override;
|
||||
function AddUndoAction(const AComp: TComponent; AOpType: TUndoOpType;
|
||||
IsSetNewId: boolean; AFieldName: string; const AOldVal, ANewVal: variant): boolean; override;
|
||||
function AddUndoAction(const aPersistent: TPersistent; aOpType: TUndoOpType;
|
||||
IsSetNewId: boolean; aFieldName: string; const aOldVal, aNewVal: variant): boolean; override;
|
||||
function IsUndoLocked: boolean; override;
|
||||
procedure ClearUndoItem(AIndex: Integer);
|
||||
|
||||
@ -1629,8 +1629,9 @@ begin
|
||||
Result := DoRedo;
|
||||
end;
|
||||
|
||||
function TDesigner.AddUndoAction(const AComp: TComponent; AOpType: TUndoOpType;
|
||||
IsSetNewId: boolean; AFieldName: string; const AOldVal, ANewVal: variant): boolean;
|
||||
function TDesigner.AddUndoAction(const aPersistent: TPersistent;
|
||||
aOpType: TUndoOpType; IsSetNewId: boolean; aFieldName: string; const aOldVal,
|
||||
aNewVal: variant): boolean;
|
||||
|
||||
procedure ShiftUndoList;
|
||||
var
|
||||
@ -1647,7 +1648,7 @@ var
|
||||
AStream: TStringStream;
|
||||
begin
|
||||
Result := (FUndoLock = 0);
|
||||
if not (Result) then Exit;
|
||||
if not Result then Exit;
|
||||
Inc(FUndoLock);
|
||||
try
|
||||
if FUndoCurr > High(FUndoList) then
|
||||
@ -1663,7 +1664,7 @@ begin
|
||||
if IsSetNewId then
|
||||
SetNextUndoActId;
|
||||
|
||||
if (AOpType in [uopAdd, uopDelete]) and (FForm.Name <> AComp.Name) then
|
||||
if (aOpType in [uopAdd, uopDelete]) and (FForm <> aPersistent) then
|
||||
begin
|
||||
SaveControlSelection := TControlSelection.Create;
|
||||
try
|
||||
@ -1671,7 +1672,7 @@ begin
|
||||
AStream := TStringStream.Create('');
|
||||
try
|
||||
ControlSelection.Clear;
|
||||
ControlSelection.Add(AComp);
|
||||
ControlSelection.Add(aPersistent);
|
||||
CopySelectionToStream(AStream);
|
||||
FUndoList[FUndoCurr].obj := AStream.DataString;
|
||||
finally
|
||||
@ -1683,20 +1684,23 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
// add to FUndoList
|
||||
with FUndoList[FUndoCurr] do
|
||||
begin
|
||||
oldVal := AOldVal;
|
||||
newVal := ANewVal;
|
||||
fieldName := AFieldName;
|
||||
compName := AComp.Name;
|
||||
if not(AComp.Equals(Form)) and AComp.HasParent then
|
||||
parentName := AComp.GetParentComponent.Name
|
||||
else
|
||||
parentName := '';
|
||||
opType := AOpType;
|
||||
oldVal := aOldVal;
|
||||
newVal := aNewVal;
|
||||
fieldName := aFieldName;
|
||||
compName := '';
|
||||
parentName := '';
|
||||
if aPersistent is TComponent then begin
|
||||
compName := TComponent(aPersistent).Name;
|
||||
if TComponent(aPersistent).HasParent then
|
||||
parentName := TComponent(aPersistent).GetParentComponent.Name;
|
||||
end;
|
||||
opType := aOpType;
|
||||
isValid := true;
|
||||
id := FUndoActId;
|
||||
propInfo := GetPropInfo(TObject(AComp), AFieldName)^;
|
||||
propInfo := GetPropInfo(aPersistent, aFieldName)^;
|
||||
end;
|
||||
Inc(FUndoCurr);
|
||||
finally
|
||||
|
||||
@ -413,7 +413,7 @@ object CompilerCompilationOptionsFrame: TCompilerCompilationOptionsFrame
|
||||
Caption = 'ExecuteBeforeScanLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object ExecuteBeforeCommandEdit: TComboBox
|
||||
object ExecuteBeforeCommandComboBox: TComboBox
|
||||
AnchorSideLeft.Control = ExecuteBeforeCommandLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = chkExecBeforeCompile
|
||||
@ -429,7 +429,7 @@ object CompilerCompilationOptionsFrame: TCompilerCompilationOptionsFrame
|
||||
BorderSpacing.Around = 6
|
||||
ItemHeight = 0
|
||||
TabOrder = 6
|
||||
Text = 'ExecuteBeforeCommandEdit'
|
||||
Text = 'ExecuteBeforeCommandComboBox'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -34,7 +34,7 @@ type
|
||||
ExecuteAfterScanLabel: TLabel;
|
||||
ExecuteAfterScanMakeCheckBox: TCheckBox;
|
||||
ExecuteAfterShowAllCheckBox: TCheckBox;
|
||||
ExecuteBeforeCommandEdit: TComboBox;
|
||||
ExecuteBeforeCommandComboBox: TComboBox;
|
||||
ExecuteBeforeCommandLabel: TLabel;
|
||||
ExecuteBeforeGroupBox: TGroupBox;
|
||||
ExecuteBeforeScanFPCCheckBox: TCheckBox;
|
||||
@ -121,7 +121,7 @@ begin
|
||||
chkExecBeforeBuild.Caption := lisBuildStage;
|
||||
chkExecBeforeCompile.Caption := lisCompileStage;
|
||||
chkExecBeforeRun.Caption := lisRunStage;
|
||||
ExecuteBeforeCommandEdit.Text := '';
|
||||
ExecuteBeforeCommandComboBox.Text := '';
|
||||
ExecuteBeforeCommandLabel.Caption := lisCOCommand;
|
||||
ExecuteBeforeScanLabel.Caption := lisCOScanForMessages;
|
||||
ExecuteBeforeScanFPCCheckBox.Caption := 'FPC'; // do not translate name
|
||||
@ -160,7 +160,7 @@ var
|
||||
begin
|
||||
chkCreateMakefile.Checked := Options.CreateMakefileOnBuild;
|
||||
|
||||
ExecuteBeforeCommandEdit.Text := Options.ExecuteBefore.Command;
|
||||
ExecuteBeforeCommandComboBox.Text := Options.ExecuteBefore.Command;
|
||||
ExecuteBeforeScanFPCCheckBox.Checked := Options.ExecuteBefore.ScanForFPCMessages;
|
||||
ExecuteBeforeScanMakeCheckBox.Checked :=
|
||||
Options.ExecuteBefore.ScanForMakeMessages;
|
||||
@ -268,7 +268,7 @@ var
|
||||
begin
|
||||
Options.CreateMakefileOnBuild := chkCreateMakefile.Checked;
|
||||
|
||||
Options.ExecuteBefore.Command := ExecuteBeforeCommandEdit.Text;
|
||||
Options.ExecuteBefore.Command := ExecuteBeforeCommandComboBox.Text;
|
||||
Options.ExecuteBefore.ScanForFPCMessages := ExecuteBeforeScanFPCCheckBox.Checked;
|
||||
Options.ExecuteBefore.ScanForMakeMessages :=ExecuteBeforeScanMakeCheckBox.Checked;
|
||||
Options.ExecuteBefore.ShowAllMessages := ExecuteBeforeShowAllCheckBox.Checked;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user