implemented streaming of anchorsides

git-svn-id: trunk@6651 -
This commit is contained in:
mattias 2005-01-21 10:34:56 +00:00
parent ff55a92ced
commit 623d8f33d0
7 changed files with 93 additions and 17 deletions

View File

@ -280,7 +280,7 @@ begin
exit;
NewValue:=TCheckBox(Sender).Checked;
CurSide:=Values.Sides[Kind];
debugln('TAnchorDesigner.AnchorEnabledCheckBoxChange CurSide.AmbigiousEnabled=',dbgs(CurSide.AmbigiousEnabled),' CurSide.Enabled=',dbgs(CurSide.Enabled),' NewValue=',dbgs(NewValue));
//debugln('TAnchorDesigner.AnchorEnabledCheckBoxChange CurSide.AmbigiousEnabled=',dbgs(CurSide.AmbigiousEnabled),' CurSide.Enabled=',dbgs(CurSide.Enabled),' NewValue=',dbgs(NewValue));
if CurSide.AmbigiousEnabled or (CurSide.Enabled<>NewValue) then begin
debugln('TAnchorDesigner.AnchorEnabledCheckBoxChange ',DbgSName(Sender),' NewValue=',dbgs(NewValue));
// user changed an anchor
@ -293,6 +293,7 @@ begin
else
CurControl.Anchors:=CurControl.Anchors-[Kind];
end;
GlobalDesignHook.Modified(Self);
GlobalDesignHook.RefreshPropertyValues;
end;
end;
@ -341,7 +342,7 @@ begin
else
CurControl.BorderSpacing.Space[Kind]:=NewValue;
end;
//GlobalDesignHook.Modified(Self);
GlobalDesignHook.Modified(Self);
GlobalDesignHook.RefreshPropertyValues;
end;
end;
@ -386,6 +387,7 @@ begin
CurControl:=TControl(SelectedControls[i]);
CurControl.AnchorSide[Kind].Control:=NewSibling;
end;
GlobalDesignHook.Modified(Self);
GlobalDesignHook.RefreshPropertyValues;
end;
end;
@ -461,6 +463,7 @@ begin
CurControl:=TControl(SelectedControls[i]);
CurControl.AnchorSide[Kind].Side:=Side;
end;
GlobalDesignHook.Modified(Self);
GlobalDesignHook.RefreshPropertyValues;
end;
end;
@ -562,14 +565,11 @@ begin
TopBorderSpaceSpinEdit.ValueEmpty:=CurSide.AmbigiousBorderSpace;
Sibling:=CurSide.Sibling;
TopSiblingComboBox.Text:=Sibling;
debugln('TAnchorDesigner.Refresh A TopSiblingComboBox.Text=',TopSiblingComboBox.Text,' Sibling=',Sibling);
//debugln('TAnchorDesigner.Refresh A TopSiblingComboBox.Text=',TopSiblingComboBox.Text,' Sibling=',Sibling);
FillComboBoxWithSiblings(TopSiblingComboBox);
debugln('TAnchorDesigner.Refresh B TopSiblingComboBox.Text=',TopSiblingComboBox.Text,' Sibling=',Sibling);
TopRefBottomSpeedButton.Enabled:=Sibling<>'';
//debugln('TAnchorDesigner.Refresh B TopSiblingComboBox.Text=',TopSiblingComboBox.Text,' Sibling=',Sibling);
TopRefBottomSpeedButton.Down:=(CurSide.Side=asrBottom);
TopRefCenterSpeedButton.Enabled:=Sibling<>'';
TopRefCenterSpeedButton.Down:=(CurSide.Side=asrCenter);
TopRefTopSpeedButton.Enabled:=Sibling<>'';
TopRefTopSpeedButton.Down:=(CurSide.Side=asrTop);
// Bottom
@ -588,11 +588,8 @@ begin
Sibling:=CurSide.Sibling;
BottomSiblingComboBox.Text:=Sibling;
FillComboBoxWithSiblings(BottomSiblingComboBox);
BottomRefBottomSpeedButton.Enabled:=Sibling<>'';
BottomRefBottomSpeedButton.Down:=(CurSide.Side=asrBottom);
BottomRefCenterSpeedButton.Enabled:=Sibling<>'';
BottomRefCenterSpeedButton.Down:=(CurSide.Side=asrCenter);
BottomRefTopSpeedButton.Enabled:=Sibling<>'';
BottomRefTopSpeedButton.Down:=(CurSide.Side=asrTop);
// Left
@ -611,11 +608,8 @@ begin
Sibling:=CurSide.Sibling;
LeftSiblingComboBox.Text:=Sibling;
FillComboBoxWithSiblings(LeftSiblingComboBox);
LeftRefRightSpeedButton.Enabled:=Sibling<>'';
LeftRefRightSpeedButton.Down:=(CurSide.Side=asrBottom);
LeftRefCenterSpeedButton.Enabled:=Sibling<>'';
LeftRefCenterSpeedButton.Down:=(CurSide.Side=asrCenter);
LeftRefLeftSpeedButton.Enabled:=Sibling<>'';
LeftRefLeftSpeedButton.Down:=(CurSide.Side=asrTop);
// Right
@ -634,11 +628,8 @@ begin
Sibling:=CurSide.Sibling;
RightSiblingComboBox.Text:=Sibling;
FillComboBoxWithSiblings(RightSiblingComboBox);
RightRefRightSpeedButton.Enabled:=Sibling<>'';
RightRefRightSpeedButton.Down:=(CurSide.Side=asrBottom);
RightRefCenterSpeedButton.Enabled:=Sibling<>'';
RightRefCenterSpeedButton.Down:=(CurSide.Side=asrCenter);
RightRefLeftSpeedButton.Enabled:=Sibling<>'';
RightRefLeftSpeedButton.Down:=(CurSide.Side=asrTop);
end;
finally

View File

@ -977,8 +977,10 @@ begin
// set vmtTypeInfo
TypeDataSize:=SizeOf(TTypeData)+2; // TTypeData + one word for new prop count
TypeInfoSize:=SizeOf(TTypeKind)+1+length(NewClassName)+TypeDataSize;
{$warnings off}
if SizeOf(TTypeKind)<>1 then
raise Exception.Create('CreateNewClass SizeOf(TTypeInfo^.Kind)<>1');
{$warnings on}
GetMem(NewTypeInfo,TypeInfoSize);
FillChar(NewTypeInfo^,TypeInfoSize,0);
Pointer(Pointer(NewVMT+vmtTypeInfo)^):=NewTypeInfo;

View File

@ -725,10 +725,12 @@ var
i: Integer;
begin
Result:=Filename;
{$warnings off}
if PathDelim<>'/' then
for i:=1 to length(Result) do
if Result[i]=PathDelim then
Result[i]:='/';
{$warnings on}
if Result<>'' then
Result:='file://'+Result;
end;
@ -773,10 +775,12 @@ end;
function URLFilenameIsAbsolute(const Filename: string): boolean;
begin
{$warnings off}
if PathDelim='/' then
Result:=FilenameIsAbsolute(Filename)
else
Result:=FilenameIsAbsolute(SetDirSeparators(Filename));
{$warnings on}
end;
function FindURLPathStart(const URL: string): integer;

View File

@ -1391,8 +1391,12 @@ procedure CreateComponentEvent(AComponent: TComponent; const EventName: string);
// XXX
// This class is a workaround for the broken typeinfo function
type
{ TDummyClassForPropTypes }
TDummyClassForPropTypes = class(TPersistent)
private
FAnchorSide: TAnchorSide;
FDateTime: TDateTime;
FList:PPropList;
FCount:integer;
@ -1421,6 +1425,7 @@ type
property ModalResult:TModalResult read FModalResult;
property ShortCut: TShortCut read FShortCut;
property DateTime: TDateTime read FDateTime;
property AnchorSide: TAnchorSide read FAnchorSide;
end;
@ -6185,6 +6190,14 @@ begin
TFileDialog, 'Filter', TFileDlgFilterProperty);
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('AnsiString'),
TFileNameEdit, 'Filter', TFileDlgFilterProperty);
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TAnchorSide'),
nil, 'AnchorSideLeft', THiddenPropertyEditor);
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TAnchorSide'),
nil, 'AnchorSideTop', THiddenPropertyEditor);
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TAnchorSide'),
nil, 'AnchorSideRight', THiddenPropertyEditor);
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TAnchorSide'),
nil, 'AnchorSideBottom', THiddenPropertyEditor);
{$IFDEF EnableSessionProps}
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('AnsiString'),
TCustomPropertyStorage, 'Filename', TFileNamePropertyEditor);

View File

@ -40,7 +40,7 @@ interface
{$ENDIF}
uses
Classes, SysUtils, DynHashArray, LCLStrConsts, LCLType, LCLProc,
Classes, SysUtils, TypInfo, DynHashArray, LCLStrConsts, LCLType, LCLProc,
GraphType, Graphics, LMessages, LCLIntf, InterfaceBase, ImgList, UTrace,
PropertyStorage, Menus, ActnList, LCLClasses;
@ -713,6 +713,7 @@ type
constructor Create(TheOwner: TControl; TheKind: TAnchorKind);
procedure GetSidePosition(var ReferenceControl: TControl;
var ReferenceSide: TAnchorSideReference; var Position: Integer);
procedure Assign(Source: TPersistent); override;
public
property Owner: TControl read FOwner;
property Kind: TAnchorKind read FKind;
@ -870,6 +871,7 @@ type
FWindowProc: TWndMethod;
procedure DoActionChange(Sender: TObject);
function GetAnchorSide(Kind: TAnchorKind): TAnchorSide;
function GetAnchorSideIndex(Index: integer): TAnchorSide;
function GetBoundsRect: TRect;
function GetClientHeight: Integer;
function GetClientWidth: Integer;
@ -896,6 +898,7 @@ type
procedure DoMouseDown(var Message: TLMMouse; Button: TMouseButton;
Shift:TShiftState);
procedure DoMouseUp(var Message: TLMMouse; Button: TMouseButton);
procedure SetAnchorSideIndex(Index: integer; const AValue: TAnchorSide);
procedure SetBorderSpacing(const AValue: TControlBorderSpacing);
procedure SetBoundsRect(const ARect: TRect);
procedure SetBoundsRectForNewParent(const AValue: TRect);
@ -1216,6 +1219,10 @@ type
property UndockHeight: Integer read GetUndockHeight write FUndockHeight;
property UndockWidth: Integer read GetUndockWidth write FUndockWidth;
published
property AnchorSideLeft: TAnchorSide index 0 read GetAnchorSideIndex write SetAnchorSideIndex;
property AnchorSideTop: TAnchorSide index 1 read GetAnchorSideIndex write SetAnchorSideIndex;
property AnchorSideRight: TAnchorSide index 2 read GetAnchorSideIndex write SetAnchorSideIndex;
property AnchorSideBottom: TAnchorSide index 3 read GetAnchorSideIndex write SetAnchorSideIndex;
property Cursor: TCursor read FCursor write SetCursor default crDefault;
property Left: Integer read FLeft write SetLeft;
property Height: Integer read FHeight write SetHeight;
@ -1394,6 +1401,8 @@ type
);
TWinControlFlags = set of TWinControlFlag;
{ TWinControl }
TWinControl = class(TControl)
private
FAlignLevel: Word;
@ -1666,6 +1675,7 @@ type
Function CanFocus: Boolean;
function GetControlIndex(AControl: TControl): integer;
procedure SetControlIndex(AControl: TControl; NewIndex: integer);
function ControlByName(const ControlName: string): TControl;
Function Focused: Boolean; override;
procedure SelectNext(CurControl: TWinControl;
GoForward, CheckTabStop: Boolean);
@ -2772,6 +2782,18 @@ begin
end;
end;
procedure TAnchorSide.Assign(Source: TPersistent);
var
Src: TAnchorSide;
begin
if Source is TAnchorSide then begin
Src:=TAnchorSide(Source);
Side:=Src.Side;
Control:=Src.Control;
end else
inherited Assign(Source);
end;
{$IFNDEF VER1_0}
{ TControlPropertyStorage }
@ -2834,6 +2856,9 @@ end.
{ =============================================================================
$Log$
Revision 1.271 2005/01/21 10:34:56 mattias
implemented streaming of anchorsides
Revision 1.270 2005/01/20 20:51:06 mattias
implementing anchor editor, setting sibling and reference sides

View File

@ -1345,6 +1345,18 @@ begin
Result:=FAnchorSides[Kind];
end;
function TControl.GetAnchorSideIndex(Index: integer): TAnchorSide;
begin
case Index of
0: Result:=FAnchorSides[akLeft];
1: Result:=FAnchorSides[akTop];
2: Result:=FAnchorSides[akRight];
3: Result:=FAnchorSides[akBottom];
else
Result:=nil;
end;
end;
{------------------------------------------------------------------------------
TControl GetClientRect
------------------------------------------------------------------------------}
@ -1552,6 +1564,12 @@ begin
MouseUp(Button, KeysToShiftState(Keys), XPos, YPos);
end;
procedure TControl.SetAnchorSideIndex(Index: integer; const AValue: TAnchorSide
);
begin
GetAnchorSideIndex(Index).Assign(AValue);
end;
procedure TControl.SetBorderSpacing(const AValue: TControlBorderSpacing);
begin
if FBorderSpacing=AValue then exit;
@ -3476,6 +3494,9 @@ end;
{ =============================================================================
$Log$
Revision 1.238 2005/01/21 10:34:56 mattias
implemented streaming of anchorsides
Revision 1.237 2005/01/17 17:49:27 mattias
fixed constraints for forms under gtk

View File

@ -1984,6 +1984,23 @@ begin
AControl.SetZOrderPosition(NewIndex);
end;
function TWinControl.ControlByName(const ControlName: string): TControl;
var
i: Integer;
begin
if FControls<>nil then
for i:=0 to FControls.Count-1 do begin
Result:=TControl(FControls[i]);
if CompareText(Result.Name,ControlName)=0 then exit;
end;
if FWinControls<>nil then
for i:=0 to FWinControls.Count-1 do begin
Result:=TControl(FWinControls[i]);
if CompareText(Result.Name,ControlName)=0 then exit;
end;
Result:=nil;
end;
{------------------------------------------------------------------------------}
{ TWinControl DestroyHandle }
{------------------------------------------------------------------------------}
@ -4313,6 +4330,9 @@ end;
{ =============================================================================
$Log$
Revision 1.302 2005/01/21 10:34:56 mattias
implemented streaming of anchorsides
Revision 1.301 2005/01/18 18:46:59 mattias
improved invert assignment tool by multilines from Andrew Haines