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

View File

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

View File

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

View File

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

View File

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

View File

@ -1345,6 +1345,18 @@ begin
Result:=FAnchorSides[Kind]; Result:=FAnchorSides[Kind];
end; 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 TControl GetClientRect
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
@ -1552,6 +1564,12 @@ begin
MouseUp(Button, KeysToShiftState(Keys), XPos, YPos); MouseUp(Button, KeysToShiftState(Keys), XPos, YPos);
end; end;
procedure TControl.SetAnchorSideIndex(Index: integer; const AValue: TAnchorSide
);
begin
GetAnchorSideIndex(Index).Assign(AValue);
end;
procedure TControl.SetBorderSpacing(const AValue: TControlBorderSpacing); procedure TControl.SetBorderSpacing(const AValue: TControlBorderSpacing);
begin begin
if FBorderSpacing=AValue then exit; if FBorderSpacing=AValue then exit;
@ -3476,6 +3494,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $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 Revision 1.237 2005/01/17 17:49:27 mattias
fixed constraints for forms under gtk fixed constraints for forms under gtk

View File

@ -1984,6 +1984,23 @@ begin
AControl.SetZOrderPosition(NewIndex); AControl.SetZOrderPosition(NewIndex);
end; 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 } { TWinControl DestroyHandle }
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
@ -4313,6 +4330,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $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 Revision 1.301 2005/01/18 18:46:59 mattias
improved invert assignment tool by multilines from Andrew Haines improved invert assignment tool by multilines from Andrew Haines