MG: added consistency checks and fixed selection drawing on wrong forms

git-svn-id: trunk@3466 -
This commit is contained in:
lazarus 2002-10-05 09:31:12 +00:00
parent 22bf0ac14e
commit c6990367e3
3 changed files with 45 additions and 15 deletions

View File

@ -123,6 +123,8 @@ type
csaSide2SpaceEqually); csaSide2SpaceEqually);
TComponentSizing = (cssNone, cssShrinkToSmallest, cssGrowToLargest, cssFixed); TComponentSizing = (cssNone, cssShrinkToSmallest, cssGrowToLargest, cssFixed);
TSelectionSortCompare = function(Index1, Index2: integer): integer of object; TSelectionSortCompare = function(Index1, Index2: integer): integer of object;
TOnSelectionFormChanged = procedure(Sender: TObject;
OldForm, NewForm: TCustomForm) of object;
TControlSelState = (cssOnlyNonVisualNeedsUpdate, TControlSelState = (cssOnlyNonVisualNeedsUpdate,
cssOnlyVisualNeedsUpdate, cssOnlyVisualNeedsUpdate,
@ -144,6 +146,7 @@ type
// These are the values set by the user // These are the values set by the user
// But due to snapping and lcl aligning the components can have other bounds // But due to snapping and lcl aligning the components can have other bounds
FLeft: Integer; FLeft: Integer;
FOnSelectionFormChanged: TOnSelectionFormChanged;
FSavedHeight: integer; FSavedHeight: integer;
FSavedLeft: integer; FSavedLeft: integer;
FSavedTop: integer; FSavedTop: integer;
@ -306,6 +309,10 @@ type
property Visible:boolean read FVisible write SetVisible; property Visible:boolean read FVisible write SetVisible;
function OnlyNonVisualComponentsSelected: boolean; function OnlyNonVisualComponentsSelected: boolean;
function OnlyVisualComponentsSelected: boolean; function OnlyVisualComponentsSelected: boolean;
property SelectionForm: TCustomForm read FCustomForm;
property OnSelectionFormChanged: TOnSelectionFormChanged
read FOnSelectionFormChanged write FOnSelectionFormChanged;
end; end;
@ -523,14 +530,18 @@ begin
end; end;
procedure TControlSelection.SetCustomForm; procedure TControlSelection.SetCustomForm;
var NewCustomForm:TCustomForm; var
OldCustomForm, NewCustomForm: TCustomForm;
begin begin
if Count>0 then if Count>0 then
NewCustomForm:=Items[0].ParentForm NewCustomForm:=Items[0].ParentForm
else else
NewCustomForm:=nil; NewCustomForm:=nil;
if NewCustomForm=FCustomForm then exit; if NewCustomForm=FCustomForm then exit;
OldCustomForm:=FCustomForm;
FCustomForm:=NewCustomForm; FCustomForm:=NewCustomForm;
if Assigned(FOnSelectionFormChanged) then
FOnSelectionFormChanged(Self,OldCustomForm,NewCustomForm);
end; end;
function TControlSelection.GetGrabbers(AGrabIndex:TGrabIndex): TGrabber; function TControlSelection.GetGrabbers(AGrabIndex:TGrabIndex): TGrabber;
@ -1260,15 +1271,15 @@ begin
if gpLeft in GrabberPos then begin if gpLeft in GrabberPos then begin
FLeft:=FLeft+dx; FLeft:=FLeft+dx;
FWidth:=FWidth-dx; FWidth:=FWidth-dx;
end; end
if gpRight in GrabberPos then begin else if gpRight in GrabberPos then begin
FWidth:=FWidth+dx; FWidth:=FWidth+dx;
end; end;
if gpTop in GrabberPos then begin if gpTop in GrabberPos then begin
FTop:=FTop+dy; FTop:=FTop+dy;
FHeight:=FHeight-dy; FHeight:=FHeight-dy;
end; end
if gpBottom in GrabberPos then begin else if gpBottom in GrabberPos then begin
FHeight:=FHeight+dy; FHeight:=FHeight+dy;
end; end;
EndResizing(true); EndResizing(true);

View File

@ -422,6 +422,8 @@ begin
if IndexOf(JITForm)<0 then if IndexOf(JITForm)<0 then
raise Exception.Create('TJITForms.RemoveMethod JITForm.ClassName='+ raise Exception.Create('TJITForms.RemoveMethod JITForm.ClassName='+
JITForm.ClassName); JITForm.ClassName);
if (AName='') or (not IsValidIdent(AName)) then
raise Exception.Create('TJITForms.RemoveMethod invalid name: "'+AName+'"');
OldCode:=nil; OldCode:=nil;
DoRemoveMethod(JITForm.ClassType,AName,OldCode); DoRemoveMethod(JITForm.ClassType,AName,OldCode);
FreeMem(OldCode); FreeMem(OldCode);
@ -434,6 +436,8 @@ begin
if IndexOf(JITForm)<0 then if IndexOf(JITForm)<0 then
raise Exception.Create('TJITForms.RenameMethod JITForm.ClassName='+ raise Exception.Create('TJITForms.RenameMethod JITForm.ClassName='+
JITForm.ClassName); JITForm.ClassName);
if (NewName='') or (not IsValidIdent(NewName)) then
raise Exception.Create('TJITForms.RenameMethod invalid name: "'+NewName+'"');
DoRenameMethod(JITForm.ClassType,OldName,NewName); DoRenameMethod(JITForm.ClassType,OldName,NewName);
end; end;
@ -444,6 +448,8 @@ begin
if IndexOf(JITForm)<0 then if IndexOf(JITForm)<0 then
raise Exception.Create('TJITForms.RenameFormClass JITForm.ClassName='+ raise Exception.Create('TJITForms.RenameFormClass JITForm.ClassName='+
JITForm.ClassName); JITForm.ClassName);
if (NewName='') or (not IsValidIdent(NewName)) then
raise Exception.Create('TJITForms.RenameFormClass invalid name: "'+NewName+'"');
DoRenameClass(JITForm.ClassType,NewName); DoRenameClass(JITForm.ClassType,NewName);
end; end;
@ -457,6 +463,8 @@ begin
if IndexOf(JITForm)<0 then if IndexOf(JITForm)<0 then
raise Exception.Create('TJITForms.CreateNewMethod JITForm.ClassName='+ raise Exception.Create('TJITForms.CreateNewMethod JITForm.ClassName='+
JITForm.ClassName); JITForm.ClassName);
if (AName='') or (not IsValidIdent(AName)) then
raise Exception.Create('TJITForms.CreateNewMethod invalid name: "'+AName+'"');
OldCode:=JITForm.MethodAddress(AName); OldCode:=JITForm.MethodAddress(AName);
if OldCode<>nil then begin if OldCode<>nil then begin
Result.Data:=JITForm; Result.Data:=JITForm;

View File

@ -237,6 +237,8 @@ type
procedure BuildPropertyList; procedure BuildPropertyList;
procedure RefreshPropertyValues; procedure RefreshPropertyValues;
procedure PropEditLookupRootChange;
property RowCount:integer read GetRowCount; property RowCount:integer read GetRowCount;
property Rows[Index:integer]:TOIPropertyGridRow read GetRow; property Rows[Index:integer]:TOIPropertyGridRow read GetRow;
@ -1292,6 +1294,13 @@ begin
DoPaint(true); DoPaint(true);
end; end;
procedure TOIPropertyGrid.PropEditLookupRootChange;
begin
// When the LookupRoot changes, no changes can be made
// -> undo the value editor changes
RefreshValueEdit;
end;
function TOIPropertyGrid.RowRect(ARow:integer):TRect; function TOIPropertyGrid.RowRect(ARow:integer):TRect;
begin begin
Result.Left:=BorderWidth; Result.Left:=BorderWidth;
@ -1971,6 +1980,8 @@ end;
procedure TObjectInspector.PropEditLookupRootChange; procedure TObjectInspector.PropEditLookupRootChange;
begin begin
PropertyGrid.PropEditLookupRootChange;
EventGrid.PropEditLookupRootChange;
FillComponentComboBox; FillComponentComboBox;
end; end;