
{*******************************************************}
{                                                       }
{       RichViewActions                                 }
{       Property editors for RichViewActions            }
{                                                       }
{       Copyright (c) Sergey Tkachenko                  }
{       svt@trichview.com                               }
{       http://www.trichview.com                        }
{                                                       }
{*******************************************************}

unit RVADsgn;

interface

{$I RV_Defs.inc}

uses RVALocalize, Classes, RVSEdit, RVStyle,
  {$IFDEF RICHVIEWDEF6}
  DesignIntf, DesignEditors, ColnEdit, VCLEditors
  {$ELSE}
  DsgnIntf
  {$ENDIF};

type

  TRVALanguageProperty = class(TStringProperty)
  public
    function GetAttributes: TPropertyAttributes; override;
    procedure GetValues(Proc: TGetStrProc); override;
    procedure SetValue(const Value: string); override;
  end;

procedure Register;  

implementation
uses RichViewActions;

{=========================== TRVALanguageProperty =============================}
function TRVALanguageProperty.GetAttributes: TPropertyAttributes;
begin
  Result := (inherited GetAttributes) + [paValueList];
end;
{------------------------------------------------------------------------------}
procedure TRVALanguageProperty.GetValues(Proc: TGetStrProc);
begin
  RVA_EnumLanguages(Proc);
end;
{------------------------------------------------------------------------------}
procedure TRVALanguageProperty.SetValue(const Value: string);
begin
  inherited;
end;
{==============================================================================}
{$IFDEF RICHVIEWDEF5}
function RVAGetUnitName(Obj: TPersistent): String;
begin
  if (Obj is TrvActionIndent) or
     (Obj is TrvActionParaList) or
     (Obj is TrvActionCustomParaListSwitcher) or
     (Obj is TrvActionInsertPicture) or
     (Obj is TrvActionInsertHLine) or
     (Obj is TrvActionInsertTable)
  then
    if RVA_UnitsProgram=rvstuPixels then
      Result := 'px'
    else
      Result := 'tw'
  else
    Result := '';
end;
{$ENDIF}
{==============================================================================}
procedure Register;
begin
  RegisterPropertyEditor(TypeInfo(TRVALanguageName), nil,'',  TRVALanguageProperty);
  {$IFDEF RICHVIEWDEF5}
  RVGetUnitNameFunc := RVAGetUnitName;
  {$ENDIF}
end;

end.
