STMAP16REG

Top  Previous  Next

 

{ StellaMAP komponensek regisztációja }

 

unit StMAPReg;

 

interface

 

uses DsgnIntf, Classes, Dialogs;

 

type

TDirProperty = class(TStringProperty)

public

   function GetAttributes: TPropertyAttributes; override;

   function GetValue: string; override;

   procedure SetValue(const Value: string); override;

   procedure Edit; override;

end;

 

type

TFileProperty = class(TStringProperty)

private

   FileType : string[3];

public

   FOpenDialog : TOpenDialog;

   function GetAttributes: TPropertyAttributes; override;

   function GetValue: string; override;

   procedure SetValue(const Value: string); override;

   procedure Edit; override;

end;

 

procedure Register;

 

implementation

 

uses SysUtils, Graphics, Menus, Forms, Controls, FileCtrl, Stmap16w,

    STMAP16, STMAP161, StComm, StForg, StCPal, StJkW, StJkView, StOrker,

    StReteg, StRtgLat, StPKep, StPrPar, Spekt, StScroll, StLista, Clipb,

    Statszam, StInfPan, StlGomb, StEszk, StSzog, Digit, StNav, StDGrid;

 

{ --------------- Property Editorok -----------------}

 

function TDirProperty.GetAttributes: TPropertyAttributes;

begin

       Result := [paDialog,paAutoUpdate];

end;

 

procedure TDirProperty.SetValue(const Value: string);

begin

    SetStrValue(Value);

end;

 

 

function TDirProperty.GetValue: string;

begin

Result := GetStrValue;

end;

 

procedure TDirProperty.Edit;

var glDir: string;

begin

   glDir:=GetValue;

   If SelectDirectory(glDir, [sdAllowCreate, sdPerformCreate, sdPrompt],0)

   then SetValue(glDir);

end;

 

function TFileProperty.GetAttributes: TPropertyAttributes;

begin

       Result := [paDialog,paAutoUpdate];

end;

 

procedure TFileProperty.SetValue(const Value: string);

begin

    SetStrValue(Value);

end;

 

function TFileProperty.GetValue: string;

begin

Result := GetStrValue;

end;

 

procedure TFileProperty.Edit;

var fn: string;

   ftype: string;

begin

   FOpenDialog := TOpenDialog.Create(Application);

   try

           FOpenDialog.InitialDir:=ExtractFilePath(GetValue);

           With FOpenDialog do begin

            FileName  :=GetValue;

            ftype := UpperCase(GetName);

            If ftype='MAPFILE' then begin

               FileName:='*.TRK;*.PT;*.DXF';

               Filter := 'MAP file (*.TRK)|*.TRK|ITR file (*.PT)|*.PT'+

                   '|Data Exchange (*.DXF)|*.DXF';

            end;

            If ftype='RETEGFILE' then begin

               FileName:='*.RTG';

               Filter := 'Rétegfile (*.RTG)|*.RTG';

            end;

            If ftype='JELKULCSFILE' then begin

               FileName:='*.JLK';

               Filter := 'Jelkulcsfile (*.JLK)|*.JLK';

            end;

            If Pos(ftype,'ALAPKEPFILE PICTUREFILE IMAGEFILE')>0 then begin

               FileName:='*.GIF;*.BMP;*.WMF;*.ICO';

               Filter := 'GIF image file (*.GIF)|*.GIF|'+

                         'Bitmap file (*.BMP)|*.BMP|'+

                         'W. metafile (*.WMF)|*.WMF|'+

                         'Icon file (*.ICO)|*.ICO';

            end;

            Title:=GetName+' megnyitása';

            If execute then SetStrValue(Filename);

       end;

   finally

       FOpenDialog.Free;

   end;

end;

 

procedure Register;

begin

RegisterComponents('StellaMAP',[TStMapW,TStellaMap,TSTMCommander,TSTDataGrid,

      TStColorPal,TStScrollBar,TStNavigator,TStLButtons,TStInfoPanel,TStEszTar,

      TStActivAngle,TStMapForg,

      TStRetegDef,TStRetegView,TSpectrum,TStOrkereszt,TJelkulcsView,TStJelkulcsView,

      TStPrintView,TStPrintParamDlg,TStListaGen,TStClipboardView,

      TStTrans,TDigitizer]);

RegisterPropertyEditor(TypeInfo(string), TStMapW, 'LocalDir', TDirProperty);

RegisterPropertyEditor(TypeInfo(string), TStMapW, 'GlobalDir', TDirProperty);

RegisterPropertyEditor(TypeInfo(string), TStMapW, 'MapFile', TFileProperty);

RegisterPropertyEditor(TypeInfo(string), TStMapW, 'RetegFile', TFileProperty);

RegisterPropertyEditor(TypeInfo(string), TStMapW, 'JelkulcsFile', TFileProperty);

RegisterPropertyEditor(TypeInfo(string), TStellaMAP, 'LocalDir', TDirProperty);

RegisterPropertyEditor(TypeInfo(string), TStellaMAP, 'GlobalDir', TDirProperty);

RegisterPropertyEditor(TypeInfo(string), TStellaMAP, 'MapFile', TFileProperty);

RegisterPropertyEditor(TypeInfo(string), TStellaMAP, 'RetegFile', TFileProperty);

RegisterPropertyEditor(TypeInfo(string), TStellaMAP, 'JelkulcsFile', TFileProperty);

RegisterPropertyEditor(TypeInfo(string), TDigitizer, 'AlapkepFile', TFileProperty);

end;

 

end.