A user interface requires a set of three functions, which are incased in a dynamic library (DLL), for the import of vector formats into pictures. D2000 GrEditor calls these functions when occurring a request to import vector image into the opened graphic picture.
The types of functions:

  1. Identification function - provides a description of import file format and type of suffix
  2. Initialization function - initiates the call-back functions that ensure the callbacks of D2000 GrEditor functions
  3. Execution function - ensures the import of file to the defined picture size

Identification function


The identification function GetFileType (in Stdcall calling convention _GetFileType@8) provides a description of import file format and a type of suffix in the form of two addresses. These addresses point to the first character of text string which last character is zero. These text strings are used in the selection of import file. E.g. the texts "Autocad DXF" and "DXF" will be formed into the text  "Autocad DXF (*.DXF)". It refers to the request for the files with "DXF" suffix.

The function structure in compilers of "ADA" and "C":

procedure GetFileType(description,extension: out address);
void _stdcall GetFileType(char far * description,char far * extension)

Parameter Meaning
description Output parameter - a pointer to the text that describes the import format. Maximal number of characters: 80.
extension Output parameter - a pointer to the text containing a type of suffix of import file. Maximal number of characters: 12.

Initialization function


The initialization function ImportConnect (in Stdcall calling convention _ImportConnect@8) transfers the addresses of call-back procedures of import DLL. These procedures enables to create the graphic objects of picture, set their parameters and show the information about the import status.

The function structure in compilers of "ADA" and "C":

procedure ImportConnect(procType:integer; procAddr :address);
void _stdcall ImportConnect(int procType,int procAddr )

Parameter Meaning
procType Input parameter - a type of call-back procedure.
procAddr  Input parameter - an address of call-back procedure.

The implementation of this procedure requires to remember the links which the driver will be used for calling of the executive function. The description of input parameter procType and the functions is described in the chapter Call-back procedures.

Executive function


The execution function ImportFile (in Stdcall calling convention _ImportFile@16) ensures the import of file to the defined size of picture. The function decodes the content of import file and creates the graphic object by means of call-back procedures in an active picture. The objects are included automatically into the group of objects. You can see a result of the import in parameter resStr, which occurs in a dialog window.

The function structure in compilers of "ADA" and "C":

procedure ImportFile(FileName:address;x,y:INTEGER;resStr:address);
void _stdcall ImportFile(char far * FileName,int x,int y,char far * resStr)

Parameter Meaning
FileName Input parameter - name of the import file.
x Input parameter - a target area on x-coordinate.
y Input parameter - a target area on y-coordinate.
resStr  Input parameter - a pointer to the text, which the last character is zero. The import writes the result into it. Maximal number of characters: 10000.
Napíšte komentár