📄 tsdesign.pas
字号:
PropertyElement.SetPropertyValue(CurComponent, PropertyValue)
end;
end;
end;
finally
ActualValueList.Free;
end;
end;
function TtsComponentEditor.GetPropertySet: TtsPropertySet;
begin
if FPropertySet = nil then
begin
FPropertySet := TtsPropertySet.Create;
SetPropertyList;
end;
result := FPropertySet;
end;
function TtsComponentEditor.GetDisplayModes: TtsGroupSet;
begin
if FDisplayModes = nil then
FDisplayModes := TtsGroupSet.Create;
result := FDisplayModes;
end;
function TtsComponentEditor.AddDisplayMode(DisplayModeName: string): TtsGroupElement;
begin
result := TtsGroupElement.Create;
result.Name := DisplayModeName;
DisplayModes.Add(result);
end;
procedure TtsComponentEditor.SetActualValue(ComponentId: string; PropertyElement: TtsPropertyElement; strValue: string);
var
Element: TtsActualValueElement;
begin
if LowerCase(PropertyElement.DesignstrValue) = LowerCase(strValue) then
ActualValueSet.Remove([ComponentId, PropertyElement.Name])
else
begin
Element := ActualValueSet.GetItem([ComponentId, PropertyElement.Name]);
if Element = nil then
begin
Element := TtsActualValueElement.Create;
Element.FComponentId := ComponentId;
Element.FProperty := PropertyElement;
ActualValueSet.Add(Element);
end;
Element.FActualstrValue := strValue;
end;
end;
procedure TtsComponentEditor.AddProperty(DisplayMode: TtsGroupElement; GroupName: string; Name: string);
var
CurGroup: TtsGroupElement;
Element: TtsPropertyPointerElement;
PropertyPointer: TtsPropertyElement;
Msg: string;
begin
CurGroup := DisplayMode.FindSubGroup(GroupName);
if CurGroup <> nil then
begin
PropertyPointer := PropertySet.GetItem([Name]);
if PropertyPointer = nil then
begin
Msg := Format(StsPropertyNotFound, [Name]);
end
else
begin
Element := TtsPropertyPointerElement.Create;
Element.FElement := PropertyPointer;
CurGroup.FPropertySet.Add(Element);
end;
end;
end;
procedure TtsComponentEditor.SetDesignProperty(PropertyName: string; ShowPropertyValue: tsShowPropertyValueType; DesignstrValue: string);
var
PropertyRemainder: string;
PropertyItem: string;
PropertyPointer: TtsPropertyElement;
CurPropertySet: TtsPropertySet;
Msg: string;
begin
PropertyRemainder := PropertyName;
CurPropertySet := PropertySet;
repeat
SeparateFirstPart(PropertyRemainder, PropertyItem, '.');
PropertyPointer := CurPropertySet.GetItem([PropertyItem]);
if (PropertyPointer <> nil) then
CurPropertySet := PropertyPointer.SubProperties;
until (PropertyPointer = nil) or (PropertyRemainder = '');
if PropertyPointer = nil then
begin
Msg := Format(StsPropertyNotFound, [PropertyName]);
end
else
begin
PropertyPointer.ShowPropertyValue := ShowPropertyValue;
PropertyPointer.DesignstrValue := DesignstrValue;
end;
end;
procedure TtsComponentEditor.DoGetComponentInfo(DisplayMode: TtsGroupElement);
begin
if Assigned(FOnGetComponentInfo) then FOnGetComponentInfo(Self, DisplayMode);
end;
procedure TtsComponentEditor.DoGetFirstSelectedComponent(var Component: TPersistent);
begin
if Assigned(FOnGetFirstSelectedComponent)
then FOnGetFirstSelectedComponent(Self, Component)
else Component := FComponent;
end;
procedure TtsComponentEditor.DoGetNextSelectedComponent(var Component: TPersistent);
begin
if Assigned(FOnGetNextSelectedComponent)
then FOnGetNextSelectedComponent(Self, Component)
else Component := nil;
end;
procedure TtsComponentEditor.DoGetComponentWithId(ComponentId: string; var Component: TPersistent);
begin
if Assigned(FOnGetComponentWithId)
then FOnGetComponentWithId(Self, ComponentId, Component)
else Component := nil;
end;
procedure TtsComponentEditor.DoGetComponentId(Component: TPersistent; var ComponentId: string);
begin
if Assigned(FOnGetComponentId)
then FOnGetComponentId(Self, Component, ComponentId)
else ComponentId := '';
end;
procedure TtsComponentEditor.DoGetComponentSelection(var ComponentSelection: Pointer; var ComponentCount: integer);
begin
if Assigned(FOnGetComponentSelection) then
FOnGetComponentSelection(Self, ComponentSelection, ComponentCount)
else
begin
ComponentSelection := nil;
ComponentCount := 0;
end;
end;
procedure TtsComponentEditor.DoGetComponentSelectionChanged(CurSelection: Pointer; var Changed: Boolean);
begin
if Assigned(FOnGetComponentSelectionChanged)
then OnGetComponentSelectionChanged(Self, CurSelection, Changed)
else Changed := True;
end;
procedure TtsComponentEditor.DoDestroyComponentSelection(var ComponentSelection: Pointer; var ComponentCount: Integer);
begin
if Assigned(FOnDestroyComponentSelection) then
FOnDestroyComponentSelection(Self, ComponentSelection);
ComponentSelection := nil;
ComponentCount := 0;
end;
procedure TtsComponentEditor.DoScanObjects(State: tsScanObjectsState; Writing: Boolean; Count: Longint; var Cancel: Boolean);
begin
if Assigned(FOnScanObjects)
then FOnScanObjects(Self, State, Writing, Count, Cancel);
end;
procedure TtsComponentEditor.DoSetValues(State: tsScanObjectsState; Component: Tpersistent; PropertyElement: TtsPropertyElement; strValue: string; Value: Variant; ValueSource: tsValueSource; ValueSet: Boolean; var Cancel: Boolean);
begin
if Assigned(FOnSetValues)
then FOnSetValues(Self, State, Component, PropertyElement, strValue, Value, ValueSource, ValueSet, Cancel);
end;
procedure TtsComponentEditor.DoNumberofToggleValuesChanged;
begin
if Assigned(FOnNumberofToggleValuesChanged)
then FOnNumberofToggleValuesChanged(Self);
end;
procedure TtsComponentEditor.DoNumberofInvisibleValuesChanged;
begin
if Assigned(FOnNumberofInvisibleValuesChanged)
then FOnNumberofInvisibleValuesChanged(Self);
end;
function TtsComponentEditor.GetActualValueSet: TtsActualValueSet;
begin
if FActualValueSet = nil then
begin
FActualValueSet := TtsActualValueSet.Create;
FActualValueSet.FComponentEditor := Self;
end;
result := FActualValueSet;
end;
{End TtsComponentEditor}
{TDummyDesigner}
{$IFDEF TSVER_V4}
constructor TDummyDesigner.Create;
begin
inherited;
FCustomForm := nil;
FIsControl := True;
end;
{$ENDIF}
function TDummyDesigner.CreateMethod(const Name: string; TypeData: PTypeData): TMethod;
begin
result.Code := nil;
result.Data := nil;
end;
function TDummyDesigner.GetMethodName(const Method: TMethod): string;
begin
result := '';
end;
procedure TDummyDesigner.GetMethods(TypeData: PTypeData; Proc: TGetStrProc);
begin
end;
function TDummyDesigner.GetPrivateDirectory: string;
begin
result := '';
end;
{$IFNDEF TSVER_V4}
procedure TDummyDesigner.GetSelections(List: TComponentList);
begin
end;
{$ELSE} {Function definition changed in Delphi 4}
procedure TDummyDesigner.GetSelections(const List: IDesignerSelections);
begin
end;
{$ENDIF}
function TDummyDesigner.MethodExists(const Name: string): Boolean;
begin
result := False;
end;
procedure TDummyDesigner.RenameMethod(const CurName, NewName: string);
begin
end;
{$IFDEF TSVER_V3}
procedure TDummyDesigner.SelectComponent(Instance: TPersistent);
begin
end;
{$ELSE}
procedure TDummyDesigner.SelectComponent(Instance: TComponent);
begin
end;
{$ENDIF}
{$IFNDEF TSVER_V4}
procedure TDummyDesigner.SetSelections(List: TComponentList);
begin
end;
{$ELSE} {Function definition changed in Delphi 4}
procedure TDummyDesigner.SetSelections(const List: IDesignerSelections);
begin
end;
{$ENDIF}
procedure TDummyDesigner.ShowMethod(const Name: string);
begin
end;
function TDummyDesigner.UniqueName(const BaseName: string): string;
begin
result := BaseName;
end;
procedure TDummyDesigner.GetComponentNames(TypeData: PTypeData; Proc: TGetStrProc);
var
I: Integer;
begin
for I := 0 to Form.ComponentCount - 1 do
begin
if TypeData.ClassType = Form.Components[I].ClassType then
Proc(Form.Components[I].Name);
end;
end;
function TDummyDesigner.GetComponent(const Name: string): TComponent;
var
I: Integer;
begin
result := nil;
for I := 0 to Form.ComponentCount - 1 do
begin
if LowerCase(Name) = LowerCase(Form.Components[I].Name) then
begin
result := Form.Components[I];
exit;
end;
end;
end;
function TDummyDesigner.GetComponentName(Component: TComponent): string;
begin
if Component = nil then
result := ''
else
result := Component.Name;
end;
{$IFDEF TSVER_V3}
function TDummyDesigner.GetObject(const Name: string): TPersistent;
begin
result := nil;
end;
function TDummyDesigner.GetObjectName(Instance: TPersistent): string;
begin
result := '';
end;
procedure TDummyDesigner.GetObjectNames(TypeData: PTypeData; Proc: TGetStrProc);
begin
end;
{$ENDIF}
function TDummyDesigner.MethodFromAncestor(const Method: TMethod): Boolean;
begin
result := False;
end;
function TDummyDesigner.CreateComponent(ComponentClass: TComponentClass; Parent: TComponent;
Left, Top, Width, Height: Integer): TComponent;
begin
result := nil;
end;
function TDummyDesigner.IsComponentLinkable(Component: TComponent): Boolean;
begin
result := False;
end;
procedure TDummyDesigner.MakeComponentLinkable(Component: TComponent);
begin
end;
function TDummyDesigner.GetRoot: TComponent;
begin
result := nil;
end;
procedure TDummyDesigner.Revert(Instance: TPersistent; PropInfo: PPropInfo);
begin
end;
{$IFDEF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -