Introduction

The LEADTOOLS Container and Automation API provide dynamic link library (DLL) functions to let you incorporate containers and automation into your Windows applications. The LEADTOOLS Container and Automation API provide a means of automating drawing, automating the collection and transformation of coordinates of objects within containers and coordinating low-level toolkit functions, LEAD container functions and LEAD toolbar functions. Including automation and containers in an application that requires drawing and coordinate transformation capabilities can decrease development time.

The toolkit comes in WIN32 editions so that it can support development of software applications for any of the following environments:

Windows WIN32s 3.x
Windows 3.x NT
Windows 4.x NT
Windows 95

Please note that if you have purchased an eval version of a LEADTOOLS toolkit, this help file contains the same information as the help file included in the standard release toolkit. Consequently, references to the .DLL and .LIB files contain an N designation. The .DLL and .LIB files included with the evaluation toolkit contain an E designation. Therefore, any references in the help file to xx14N.DLL or xx_N.LIB files refer to the corresponding xx14E.DLL or xx_E.LIB files. For example, if the help file refers to LTBAR14N.DLL, your corresponding file is LTBAR14E.DLL.


Example Programs

The following example programs are in separate EXAMPLES subdirectories (such as C:\LEAD14\EXAMPLES\DLL\COLOR). The executable files for these examples were compiled with Document/Medical capabilities. To get Document/Medical capabilities, you must buy a LEADTOOLS Document/Medical toolkit. Otherwise, if you recompile the examples, the resulting executable files will not have the Document/Medical capabilities.

Note:

You can run the example programs on your system by clicking the appropriate buttons in online help. If you try to run an example program that is not on your system, an error message will appear.

VECAUT | Vector Automation Demo is the main vector automation example program. It uses pull-down menus to demonstrate most of the LEADTOOLS Vector Automation and Container features in one application.
PNTAUT | Paint Automation Demo is the main paint automation example program. It uses pull-down menus to demonstrate most of the LEADTOOLS Paint Automation and Container features in one application.


Version History

Current version: | 14.5
Last update: | October 18, 2005

Changes from Version 14 to Version 14.5

Changes from Version 13 to Version 14

Changes from Version 12.1 to Version 13

Changes from Version 12 to Version 12.1

Version 12


Changes from Version 14 to Version 14.5

Version 14.5 of the LEADTOOLS Container and Automation API has not changed from Version 14.


Changes from Version 13 to Version 14

Version 14 of the LEADTOOLS Container and Automation API has changed from Version 13 as follows:

LEADTOOLS Container and Automation API now supports UNICODE.


Changes from Version 12.1 to Version 13

Version 13 of the LEADTOOLS Container and Automation API has not changed from Version 12.1.


Changes from Version 12 to Version 12.1

Version 12.1 of the LEADTOOLS Container and Automation API has changed from Version 12 by adding the Paint Automation functionality.

The rest of the topic lists the new functions:

Paint Automation Functions:

L_AutSetPaintProperty

L_AutGetPaintProperty

L_AutSetPaintBkColor

L_AutGetPaintBkColor


Version 12

Version 12 is the first version of the LEADTOOLS Container and Automation API.

The rest of the topic lists the new functions:

Container Functions:

L_ContainerCreate

L_ContainerEditObject

L_ContainerFree

L_ContainerGetCallback

L_ContainerGetMetrics

L_ContainerGetObjectCursor

L_ContainerGetObjectType

L_ContainerGetOffset

L_ContainerGetOwner

L_ContainerGetScalar

L_ContainerInit

L_ContainerIsEnabled

L_ContainerIsOwnerDraw

L_ContainerIsValid

L_ContainerReset

L_ContainerSetCallback

L_ContainerSetEnabled

L_ContainerSetMetrics

L_ContainerSetObjectCursor

L_ContainerSetObjectType

L_ContainerSetOffset

L_ContainerSetOwner

L_ContainerSetOwnerDraw

L_ContainerSetScalar

L_ContainerUpdate

General Automation Functions:

L_AutAddContainer

L_AutAddUndoNode

L_AutCanRedo

L_AutCanUndo

L_AutClipboardDataReady

L_AutCopy

L_AutCreate

L_AutCut

L_AutDelete

L_AutEnumContainers

L_AutFree

L_AutGetActiveContainer

L_AutGetCurrentTool

L_AutGetToolbar

L_AutGetUndoLevel

L_AutInit

L_AutPaste

L_AutPrint

L_AutRedo

L_AutRemoveContainer

L_AutSelect

L_AutSetActiveContainer

L_AutSetCurrentTool

L_AutSetToolbar

L_AutSetUndoEnabled

L_AutSetUndoLevel

L_AutUndo

Vector Automation Functions:

L_AutEditVectorObject

L_AutGetVectorProperty

L_AutSetVectorProperty


Copyright notice

Copyright Notices

©Copyright LEAD Technologies, Inc. 1991-2005. ALL RIGHTS RESERVED

Portions of the PCDLIB32.DLL, PCDLIB.DLL, LFFPX7.DLL, LFKODAK.DLL, EKFPIXJPEG140.DLL, PDC_SDK.DLL, PROFIRE.DLL, DC120V154_32.DLL, LFDCR14N.DLL, DCSPROBACK.DLL, DCSPRO3SLR.DLL, LFDCS14N.DLL, and LFKDC14N.DLL files contain material that is ©Copyright Eastman Kodak Company, 1996-2001. This software is based in part on the work of the Independent JPEG Group.

Portions of the LFCRW14N.DLL, LTCMP14.DLL, CDSDK.reg, CDSDK.dll, CDRAPCLS.dll, czs_ui.dll, deimg.dll, deImg010.dll, deImg110.dll, deImg153.dll, deimg301.dll, deimg401.dll, deImg404.dll, deimg602.dll, Deimg603.dll, DeImgd60.dll, pscAdimg.dll, pscCllct.dll, pscCStUI.dll, pscDcd.dll, pscDevUI.dll, pscDvlp.dll, Pscl2STI.dll, pscll.dll, pscParse.dll, pscSetup.dll, psdkdll.dll, psdkReg.dll, psParse.dll. file contain material that is © Canon, Inc. 2002

Portions of the LFFPX7.DLL and LFKODAK.DLL files contain material that is ©Copyright Hewlett Packard, 1996.

Portions of the OCR/ICR/OMR Features and the help file for the OCR/ICR/OMR Features are ©Copyright Scansoft, Inc. 1995-2003. ALL RIGHTS RESERVED

Portions of the Barcode Modules contain material that is ©Copyright Axtel Inc., 1999.

Portions of the LEADTOOLS PDF Plug in and the LEADTOOLS Vector Imaging Pro are ©Copyright 1996, 2000 Artifex Software Inc. All rights reserved.

File filters for decoding MrSID ® and DjVu ® formats are provided under a license from Lizardtech, Inc.

The "FlashPix" format uses Microsoft's OLE structured storage.

Portions of the DICOM help files in Medical Imaging product line are reprinted with permission from the National Electrical Manufacturers Association ©Copyright 1998 by the National Electrical Manufacturers Association. All rights including translation into other languages, reserved under the Universal Copyright Convention, the Berne Convention or the Protection of Literacy and Artistic Works, and the International and Pan American Copyright Conventions.

Portions of LEADTOOLS Data Security Add On contain software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/), including cryptographic software written by Eric Young (eay@cryptsoft.com) and by Tim Hudson (tjh@cryptsoft.com). Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) All rights reserved. Copyright Tim Hudson 1995-1998 (tjh@cryptsoft.com) All rights reserved.

Portions of LEADTOOLS Data Security Add On contain software based on the MD5 Message Digest Algorithm developed by RSA Data Security, Inc.. Copyright (c) 1991-92 RSA Data Security, Inc. All Rights Reserved.

Portions hereof licensed under US patent 5,327,254 and foreign counterparts.

Portions of the LEADTOOLS ICC Profiles material is © Copyright 2004, International Color Consortium.

Trademarks

LEAD® and LEADTOOLS® are registered trademarks of LEAD Technologies, Inc.
Microsoft, Windows, Windows NT, Visual Basic, Visual FoxPro, and Microsoft Access are either trademarks or registered trademarks of the Microsoft Corporation.
OS/2® is a registered trademark of International Business Machines Corporation.

TextBridge®OCR is a registered trademark of Scansoft, Inc.

ISIS® is a registered trademark of Pixel Translations, Inc.

ScanAhead™ is a trademark of Pixel Translations, Inc.

FlashPix™ is a trademark of Eastman Kodak Company.

All other brand or product names used in this online help are trademarks of their respective holders.

Address and Contact Information

LEAD Technologies, Inc.
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

(704) 332-5532
FAX: (704) 372-8161
E-mail: support@leadtools.com
Technical support: (704) 372-9681 or support@leadtools.com
Home page: http://www.leadtools.com


Programming with LEADTOOLS Containers and Automation

The following topics provide a systematic approach to understanding how to program with the LEADTOOLS Container and Automation API.

Containers

Introduction to the Container

Initializing and Freeing Containers

Creating a Container

Getting and Setting Container Properties

Container Offsets

Container Scaling Values

Using the Container Callback

Displaying Objects

Editing Container Objects

Using Container Objects

General Automation

Initializing, Creating and Freeing Automation Handles

Automation and the Container

Editing Automation Containers

Processing the WM_HSCROLL and WM_VSCROLL Messages

Working with Objects within an Automation Container

The Automation Toolbar

Undoing and Redoing Automation Operations

Automation Printing

Vector Automation

Introduction to Vector Automation

Paint Automation

Introduction to Paint Automation

Controlling Painting Properties


Introduction to the Container

The LEADTOOLS Container API provides a means of automating drawing, as well as automating the collection and transformation of coordinates of objects within the container. Including the container in an application that requires drawing and coordinate transformation capabilities can decrease development time. The LEADTOOLS Container currently supports the following objects:

Point Object.

Line Object.

Square Object.

Rectangle Object.

Circle Object.

Ellipse Object.

Polyline Object.

Bezier Object.

Arc Object.

Text Object.

A container can be attached to a window. The window to which a container is attached is said to "own" that container. After attaching the container to a window, the container becomes responsible for collecting and transforming the coordinates of any selected objects in the container. This coordinate information is sent to a user-defined callback for further processing. The container also has the ability to associate object types with user-defined mouse cursors. For example, when a rectangle is being drawn in the container, one cursor is displayed. When a circle is being drawn in the container, a different cursor may be displayed. In addition, the container also has the ability to edit objects using coordinates and handles.


Initializing and Freeing Containers

LEADTOOLS accesses containers through the CONTAINERHANDLE structure. This structure provides a working area for the LEADTOOLS container functions. The container handle must be initialized before calling any of the container functions. This is done using the L_ContainerInit function. When the CONTAINERHANDLE structure is no longer needed, it should be freed using the L_ContainerFree function. Example code showing these calls is given below:

pCONTAINERHANDLE pLeadContainer ;

/* Initiate the container handle*/
L_ContainerInit ( &pLeadContainer ) ;
.
.
.
if (SUCCESS == L_ContainerIsValid ( pContainer ) ) /* check the validity of container handle */
{
/* Free the container handle */
L_ContainerFree ( pContainer ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}

A container handle is valid only after L_ContainerInit and L_ContainerCreate have been called. The validity of a container handle should be checked before calling any other container functions. This is done using L_ContainerIsValid. For more information on creating containers, refer to Creating a Container.


Creating a Container

After initializing the container handle, the container must be created using the L_ContainerCreate function. The container will be attached to the window handle passed to L_ContainerCreate. In the sample given below the container pLeadContainer is created and attached to the window referenced by hWnd. The window referenced by hWnd becomes the owner of the container.

/* Create the container and attach it to its owner window */
L_ContainerCreate ( pLeadContainer, hWnd ) ;

In an MDI environment a single container can be initialized and created for every MDI child window.

The owner of a window can be changed. For more information, refer to Getting and Setting Container Properties.


Getting and Setting Container Properties

Container Metrics

The container possesses many properties that can be modified. These include pen characteristics, brush characteristics, owner window, offset values, scalar values, etc. The ability to modify these characteristics allows the user to fine-tune the container to better meet application specific requirements.

Many characteristics maintained in the CONTAINERMETRICS structure can be changed using the L_ContainerSetMetrics function. These include:

The color of the pen used to draw objects in the container.

The dimensions of the handle used to edit the objects in the container.

The color of the pen used to draw the object handles.

Status of the object handles (enabled or disabled).

The boundary of the container.

The font used in the text object.

The palette used to draw different objects in the container.

To determine the current settings for the characteristics described in the CONTAINERMETRICS structure, use the L_ContainerGetMetrics function.

The following example shows how to use the container metrics to change the container behavior and appearance:

/*Container metrics structure */
CONTAINERMETRICS Metrics;

/* Initiate the container metrics */
Metrics.nSize = sizeof ( CONTAINERMETRICS ) ;
Metrics.dwMask = CMF_BORDERCOLOR |
CMF_HANDLEWIDTH |
CMF_HANDLEHEIGHT |
CMF_LIMITS ;

/* Set the border and the handle to the desired values */
Metrics.crBorder = RGB (255,255,0) ;
Metrics.nHandleWidth = 10 ;
Metrics.nHandleHeight = 15 ;

/* Set the container limits to some value */
SetRect ( &Metrics.rcLimits, 0, 0, 500, 500 ) ;

/* Set the container metrics */
L_ContainerSetMetrics( g_pLeadContainer, &Metrics ) ;

Owner window

When a container is created using L_ContainerCreate, the container is attached to a window. This window becomes the owner of the container. This owner can be changed using the L_ContainerSetOwner function. To determine the current owner, use the L_ContainerGetOwner function.

Owner Draw Mode

One of the benefits to using the container is the automatic drawing capabilities it provides. However, this capability can be disabled using the L_ContainerSetOwnerDraw function. If the owner draw mode is set to FALSE (default), the container automatically handles drawing in the container. If the owner draw mode is set to TRUE, then the user is responsible for handling all aspects of object drawing within the container. To determine the current state of the owner draw mode for a container, call L_ContainerIsOwnerDraw.

Enabled

A container must be enabled in order to edit objects within that container. To determine whether a container is enabled, call L_ContainerIsEnabled. To change the current enable status, call L_ContainerSetEnabled.

For information on the scaling values, refer to Container Scaling Values.

For more information on the offsets, refer to Container Offsets.


Container Offsets

When the owner window of the container has been scrolled horizontally or vertically the container should be notified about the change so it can adjust the coordinates accordingly. To set the offset values for the container, call L_ContainerSetOffset. To determine the current offset values, call L_ContainerGetOffset. This can often be handled when processing the WM_HSCROLL, WM_SIZE, and WM_VSCROLL messages.

static L_VOID OnSize
(
HWND hWnd,
pCONTAINERHANDLE pContainer,
pBITMAPHANDLE pBitmap,
LPRECT prcView,
L_INT cx,
L_INT cy,
L_INT nZoom,
L_INT *pnHScroll, /*last horizontal scroll position*/
L_INT *pnVScroll /*last vertical scroll position*/
)
{
SCROLLINFO si ;
L_INT nXOffset, nYOffset ;

if ( NULL != pBitmap && pBitmap->Flags.Allocated )
{
si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_ALL ;

// vertical scroll.
GetScrollInfo ( hWnd, SB_VERT, &si ) ;
si.nMin = 0 ;
si.nMax = BITMAPHEIGHT ( pBitmap ) ;
si.nPage = MulDiv ( cy, 100, nZoom ) ;

SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;

GetScrollInfo ( hWnd, SB_VERT, &si ) ;

*pnVScroll = si.nPos ;

// horizontal scroll
GetScrollInfo ( hWnd, SB_HORZ, &si ) ;
si.nMin = 0 ;
si.nMax = BITMAPWIDTH ( pBitmap ) ;
si.nPage = MulDiv ( cx, 100, nZoom ) ;

SetScrollInfo ( hWnd, SB_HORZ, &si, TRUE ) ;

GetScrollInfo ( hWnd, SB_HORZ, &si ) ;

*pnHScroll = si.nPos ;
}
else
{
si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_RANGE ;
si.nMin = 0 ;
si.nMax = 0 ;

SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;
SetScrollInfo ( hWnd, SB_HORZ, &si, TRUE ) ;

*pnHScroll = 0 ;
*pnVScroll = 0 ;
}

// set the painting rectangel.
SetRect ( prcView, 0, 0, BITMAPWIDTH ( pBitmap ), BITMAPHEIGHT ( pBitmap ) ) ;

if ( nZoom < 100 )
{
nXOffset = MulDiv ( *pnHScroll, 100, nZoom ) ;
nYOffset = MulDiv ( *pnVScroll, 100, nZoom ) ;
}
else
{
nXOffset = *pnHScroll ;
nYOffset = *pnVScroll ;
}

OffsetRect ( prcView, - nXOffset, - nYOffset ) ;

prcView->left = MulDiv ( prcView->left, nZoom, 100 ) ;
prcView->top = MulDiv ( prcView->top, nZoom, 100 ) ;
prcView->right = MulDiv ( prcView->right, nZoom, 100 ) ;
prcView->bottom = MulDiv ( prcView->bottom, nZoom, 100 ) ;

L_ContainerSetOffset ( pContainer, - prcView->left, - prcView->top, 0 ) ;
}


Container Scaling Values

The coordinates for defining and positioning objects within containers are translated to device coordinates only when the objects are displayed. Each object is defined and positioned relative to its container. The container sets the frame of reference.

At the time of display, the coordinates are modified using scalar properties (scaling factors), and offset properties. Thus, the scaling factors translate the internal values to the coordinate system of the display space, and the offsets position the scaled object in the display space.

Each time the image is zoomed or scrolled, update the scaling factors and offsets of the container, and redraw the objects in the window that owns the container.

Note:

Scaling factors and offsets can be applied to objects other than the container, but that is not necessary for matching the objects to the displayed image. The scaling factors and offsets of a container apply to all objects within the container.

Scaling factors:

L_ContainerGetScalar

L_ContainerSetScalar

Offsets:

L_ContainerGetOffset

L_ContainerSetOffset

The following is an example of setting the scaling factor.

/* This example shows how to set the container's scaling factors */

L_INT SetScalarTest ( pCONTAINERHANDLE pContainer )
{
if (SUCCESS == L_ContainerIsValid( pContainer ) ) /* check the validity of container handle */
{
VECTORPOINT vptScalarNum, vptScalarDen ;

/* Set the horizontal scaling factor to 5:1 factor */
vptScalarNum.x = 5 ;
vptScalarDen.x = 1 ;

/* Set the vertical scaling factor to 5:1 factor */
vptScalarNum.y = 5 ;
vptScalarDen.y = 1 ;

/* Set the z scaling factor to 1:1 factor */
vptScalarNum.z = 1 ;
vptScalarDen.z = 1 ;

L_ContainerSetScalar( g_pLeadContainer, &vptScalarNum, &vptScalarDen ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}

After setting the scalar values to some value, the mouse movement will be snapped to the grid that represents the scaling factor.


Using the Container Callback

When an object is drawn in a container a series of states occur during the process of drawing that object. The state may be the beginning of the drawing process, a continuation of the drawing process, the ending of the drawing process, or the aborting of the drawing process. The following are the states currently supported for processing:

CONTAINER_STATE_BEGIN

CONTAINER_STATE_PROCESS

CONTAINER_STATE_END

CONTAINER_STATE_ABORT

These states are sent to a user-defined callback function for further user-defined processing. When the callback function is notified of the state of an object, information concerning the object being processed is also sent to the callback function. The callback function must adhere to the function prototype described in CONTAINERCALLBACK. The form of this callback function can also be seen below:

L_INT EXT_CALLBACK YourFunction (pCONTAINERHANDLE pContainer,
CONTAINEREVENTTYPE nEventType,
L_VOID L_FAR *pEventData,
L_VOID L_FAR *pUserData) ;

The callback function receives the following information:

The handle of the container that called the callback function.

The state of the object.

Extra information about the state of the object and the object itself.

Any user-defined information the user wishes to pass for processing.

Before a callback function can be used, it must be set for the container using the L_ContainerSetCallback function. To determine the callback function that is currently set for a container, call L_ContainerGetCallback.

The following example shows how to process the states of a line object:

L_INT EXT_CALLBACK LeadContainerProc
(
pCONTAINERHANDLE pContainer,
CONTAINEREVENTTYPE nEventType,
L_VOID L_FAR *pEventData,
L_VOID L_FAR *pUserData
)
{
pCONTAINEROBJECTDATA pObjectData = ( pCONTAINEROBJECTDATA ) pEventData ;

switch ( nEventType )
{
case CONTAINER_EVENT_TYPE_DRAW:
{
switch ( pObjectData->nObjectType )
{
/* Process the line object events */
case CONTAINER_OBJECT_TYPE_LINE:
{
switch ( pObjectData->fState )
{
case CONTAINER_STATE_BEGIN:
/* do something */
break ;

case CONTAINER_STATE_PROCESS:
/* do something */
break ;

case CONTAINER_STATE_END:
/* do something */
break ;

case CONTAINER_STATE_ABORT:
/* do something */
break ;
}
}

break ;

}
}

break ;
}

return SUCCESS ;
}


Displaying Objects

The display of objects within a container can be affected by a number of factors. Zooming, scrolling, updating and resetting all affect the display. For more information on handling zooming and scrolling, refer to Container Scaling Values and Container Offsets.

When updating the display of objects within a container, the entire client area of the window that owns the container can be updated, or just a small portion of the client area can be updated. L_ContainerUpdate updates all or part of the client area of the window that owns the container based on the parameters passed to it.

The display of objects within a container can also be reset. This removes all objects within the container from the drawing displayed on the screen. This function does not remove the objects from the container, it just removes them from the display.

Objects can also be displayed for editing using the L_ContainerEditObject function. For more information on this, refer to Editing Container Objects.


Editing Container Objects

The L_ContainerEditObject function displays an object and lets the user edit the dimensions of that object. This function displays an object based on initial properties set in a CONTAINEROBJECTDATA structure. As the user edits this object, all changes (state and object properties) are sent to the CONTAINERCALLBACK function for processing.

Below is an example that shows how to display and edit an object in a container. In this example the container is using two container specific data structures

CONTAINEROBJECTDATA

CONTAINERPOLYLINEDATA

The CONTAINEROBJECTDATA data structure contains the container's object data.

The CONTAINERPOLYLINEDATA structure is used to describe the polyline object to be edited.

/* This example shows how to edit a container object
this example assumes that the container limits are at least { 10, 10, 300, 200 } */

L_INT EditObjectTest ( pCONTAINERHANDLE pContainer )
{
if (SUCCESS == L_ContainerIsValid( pContainer ) ) /* check the validity of container handle */
{
CONTAINEROBJECTDATA Data ;
CONTAINERPOLYLINEDATA PolyData ;
VECTORPOINT pt [ 7 ] ;

/* Set the Polyline points to some random numbers */
pt[0].x = 10 ; pt[0].y = 10 ;
pt[1].x = 80 ; pt[1].y = 20 ;
pt[2].x = 100 ; pt[2].y = 60 ;
pt[3].x = 10 ; pt[3].y = 40 ;
pt[4].x = 100 ; pt[4].y = 200 ;
pt[5].x = 200 ; pt[5].y = 100 ;
pt[6].x = 300 ; pt[6].y = 200 ;

/*Fill the object data with valid values */
PolyData.pvptPoints = pt ;
PolyData.nPointCount = 7 ;

/* Set the container's object data */
Data.nSize = sizeof ( CONTAINEROBJECTDATA ) ;
Data.nObjectType = CONTAINER_OBJECT_TYPE_POLYLINE ;
Data.pObjectData = &PolyData;

/* Start editing an object */
/* Double click the left-mouse button to end editing */
/* Click right-mouse button to abort editing */
if ( SUCCESS != L_ContainerEditObject( pContainer, &Data ) )
{
return FAILURE ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


Using Container Objects

After initializing and creating the container, the type of object to draw in the container should be set. This is done using the L_ContainerSetObjectType function. For example, the sample below sets the container to draw circles:

L_ContainerSetObjectType (pLeadContainer, CONTAINER_OBJECT_TYPE_CIRCLE);

This function requires a valid container handle and a constant that specifies the type of object to set.

After setting the object type, the container will begin drawing that object whenever the user clicks and drags the mouse over the window that owns the container. To get the current container object type, call L_ContainerGetObjectType.

Each object type drawn by a container can have a different mouse cursor associated with it. For example, when a rectangle object is drawn in the container, one cursor is displayed. If a circle object is drawn in the container a different mouse cursor can be displayed. To set the cursor to use for a specific object type drawn by a container, use L_ContainerSetObjectCursor.

To determine the cursor set for a specific object type call L_ContainerGetObjectCursor.

L_ContainerEditObject displays an object described in a CONTAINEROBJECTDATA structure and makes it available to the user for editing.


Initializing, Creating and Freeing Automation Handles

LEADTOOLS accesses automation through the AUTOMATIONHANDLE structure. This structure provides a working area for the LEADTOOLS automation functions. This automation handle must be initialized before calling any of the automation functions. This is done using the L_AutInit function. The following example shows how to initialize the Automation handle:

/*Automation handle variable*/
pAUTOMATIONHANDLE pAutomation ;

/* initiate the Automation */
L_AutInit ( pAutomation ) ;

After initializing an Automation handle, the user must create the automation handle, based on the type of automation handle needed. To create a vector automation handle, call L_AutCreate with the nMode parameter set to AUTOMATION_MODE_VECTOR.

When the AUTOMATIONHANDLE structure is no longer needed, it should be freed using the L_AutFree function. The following is an example that shows how to free an automation handle:

if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the Automation handle */
{
/* free the Automation handle */
L_AutFree ( pAutomation ) ;

return SUCCESS ;
}

An automation handle is valid only after L_AutInit and L_AutCreate have been called. The validity of an automation handle should be checked before calling any other automation functions. This is done using L_AutIsValid.

See Also


Automation and the Container

The key element for notifying the user of automation events is the container. The primary purpose of the container is to automate drawing, as well as automate the collection and transformation of coordinates of objects within the container. Consequently, it is very important to understand the Container before using Automation.

Every window opened in an automation application should have a container associated with it. First, the container is initialized by calling L_ContainerInit. The container is then created and associated with a specified window using L_ContainerCreate. Once the container has been initialized, created and associated with a window, it can be added to the list of containers for a specific automation handle. The automation handle must be initialized and created by calling L_AutInit and L_AutCreate. Once the automation handle has been initialized and created, a container can be added to the automation list of containers using L_AutAddContainer. At this point, all automation functionality is associated with the container and the window that owns the container. All synchronization and data handling between the container and the automation handle will be done automatically.

The automation maintains a list of added containers. Therefore, the user must inform the automation of any changes made to a container that exists in the automation container list. Since an automation handle may have multiple containers associated with it, there must be a way to indicate which container is active. The active container is set by calling L_AutSetActiveContainer. While a container is active, all automation functions act on this container. To perform some automation function on another container, that container must be set as the active container. To determine which container is the active container, call L_AutGetActiveContainer.

With many containers associated with a single automation handle, it is occasionally necessary to enumerate the associated containers. L_AutEnumContainers enumerates all containers associated with the specified automation handle. For each container enumerated by L_AutEnumContainers, an AUTOMATIONENUMCONTAINERPROC callback function gets called. This allows for further processing of each enumerated container.

The user can issue any command to a container through the container handle. Therefore, it is important to remember that the same container handle is used internally by the automation.

When the window that owns a container is closed, the container should be removed from the list of automation containers using L_AutRemoveContainer. After the container is removed from the automation container list, the container handle should be freed using L_ContainerFree.

See Also

Initializing and Freeing Containers

Creating a Container


Editing Automation Containers

LEADTOOLS Automation provides several functions for editing automation containers. These functions act on the active automation container. For editing functions that involve the clipboard, use the following:

L_AutCut

L_AutCopy

L_AutPaste

To determine whether the clipboard contains valid automation data for pasting to the active automation container, cal L_AutClipboardDataReady.

L_AutDelete deletes objects from the active automation container.

The following example determines whether valid automation data exists on the clipboard and, if it does, pastes that data into the active automation container.

/* This example shows how to paste the current clipboard contains (if any) to the current active automation */

L_INT PasteTest (pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
L_BOOL fReady ;

/* check if there is a valid automation mode data on the clipboard */
L_AutClipboardDataReady ( pAutomation, &fReady ) ;

if ( fReady )
{
/* paste the data to the current active container */
L_AutPaste ( pAutomation, 0 ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


Processing the WM_HSCROLL and WM_VSCROLL messages:

When processing the scrolling message for a window that owns a container associated with an automation handle, the user must set the container offsets. This can be done using L_ContainerSetOffset.

The following example shows how to do this for the WM_SIZE message:

static L_VOID OnSize
(
HWND hWnd,
pCONTAINERHANDLE pContainer,
pBITMAPHANDLE pBitmap,
LPRECT prcView,
L_INT cx,
L_INT cy,
L_INT nZoom,
L_INT *pnHScroll, /*last horizontal scroll position*/
L_INT *pnVScroll /*last vertical scroll position*/
)
{
SCROLLINFO si ;
L_INT nXOffset, nYOffset ;

if ( NULL != pBitmap && pBitmap->Flags.Allocated )
{
si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_ALL ;

// vertical scroll.
GetScrollInfo ( hWnd, SB_VERT, &si ) ;
si.nMin = 0 ;
si.nMax = BITMAPHEIGHT ( pBitmap ) ;
si.nPage = MulDiv ( cy, 100, nZoom ) ;

SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;

GetScrollInfo ( hWnd, SB_VERT, &si ) ;

*pnVScroll = si.nPos ;

// horizontal scroll
GetScrollInfo ( hWnd, SB_HORZ, &si ) ;
si.nMin = 0 ;
si.nMax = BITMAPWIDTH ( pBitmap ) ;
si.nPage = MulDiv ( cx, 100, nZoom ) ;

SetScrollInfo ( hWnd, SB_HORZ, &si, TRUE ) ;

GetScrollInfo ( hWnd, SB_HORZ, &si ) ;

*pnHScroll = si.nPos ;
}
else
{
si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_RANGE ;
si.nMin = 0 ;
si.nMax = 0 ;

SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;
SetScrollInfo ( hWnd, SB_HORZ, &si, TRUE ) ;

*pnHScroll = 0 ;
*pnVScroll = 0 ;
}

// set the painting rectangle.
SetRect ( prcView, 0, 0, BITMAPWIDTH ( pBitmap ), BITMAPHEIGHT ( pBitmap ) ) ;

if ( nZoom < 100 )
{
nXOffset = MulDiv ( *pnHScroll, 100, nZoom ) ;
nYOffset = MulDiv ( *pnVScroll, 100, nZoom ) ;
}
else
{
nXOffset = *pnHScroll ;
nYOffset = *pnVScroll ;
}

OffsetRect ( prcView, - nXOffset, - nYOffset ) ;

prcView->left = MulDiv ( prcView->left, nZoom, 100 ) ;
prcView->top = MulDiv ( prcView->top, nZoom, 100 ) ;
prcView->right = MulDiv ( prcView->right, nZoom, 100 ) ;
prcView->bottom = MulDiv ( prcView->bottom, nZoom, 100 ) ;

L_ContainerSetOffset ( pContainer, - prcView->left, - prcView->top, 0 ) ;
}


Working with Objects within an Automation Container

General

All objects within the active automation container may be selected or unselected using L_AutSelect.

Vector Objects

Vector objects drawn within an automation container may be affected by pen properties, brush properties and font properties. These properties can be changed using L_AutSetVectorProperty. To determine the current vector properties, call L_AutGetVectorProperty.

To edit a vector object within an automation container, call L_AutEditVectorObject.

See Also

Editing Container Objects

Getting and Setting Container Properties

Using Container Objects


The Automation Toolbar:

To complete the Automation components the user should initialize, create and install the LEAD Toolbar into the automation.

To install the toolbar into Automation use the following steps:

Initialize the Toolbar handle.

Create the Toolbar (as a vector toolbar).

Set its position (optional).

Make it visible (optional).

Install it using L_AutSetToolbar.

After installing the toolbar, the toolkit will automatically set mouse cursors, handle any needed visual feedback from the drawing process, etc, according to the currently selected tool.

To get the current toolbar, use L_AutGetToolbar.

To simulate a toolbar without actually using the toolbar provided by LEAD Automation, use L_AutGetCurrentTool and L_AutSetCurrentTool to get and set the current tool.

See Also

Implementing Toolbars - Initializing, Creating and Freeing

Changing the Toolbar State

Changing the Toollbar Button State

Receiving Toolbar Events


Undoing and Redoing Automation Operations:

The LEADTOOLS Automation features include an Undo/Redo engine for undoing and redoing automation operations. The undo level determines the number of operations that can be undone. For each undo that is performed, a redo operation can be performed. The undo level set for an automation handle applies to every container associated with that automation handle. For example, if an automation handle has four associated containers in four different windows, each container can have a maximum of 16 operations undone sequentially.

LEADTOOLS provides a number of functions for handling the undo/redo capabilities.

To determine the current undo level of the automation handle, call L_AutGetUndoLevel. The default value is 16. To set a new undo level for the automation handle, call L_AutSetUndoLevel.

To determine whether the last automation operation performed can be undone or redone, use L_AutCanUndo and L_AutCanRedo respectively.

L_AutUndo undoes the last automation operation performed, while L_AutRedo redoes the last automation operation undone.

The following example determines whether the last operation performed in the active automation container can be undone. If it can be undone, then L_AutUndo is called.

/* This example shows how simple it is to undo the last automation operation */

L_INT AutomationUndoTest ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
L_BOOL fCanUndo ;

/* Query the ability of undoing */
L_AutCanUndo ( pAutomation, &fCanUndo ) ;

if ( fCanUndo )
{
/* undo the last automation operation */
L_AutUndo ( pAutomation, 0 ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}

Generally, operations are undone one operation at a time. If the last operation performed cut several objects from a container, undoing that operation would return the objects to the container. Occasionally, it may be best to group several operations together so that calling L_AutUndo undoes the whole group of operations and not just the last operation performed. This can be accomplished using the following steps:

1. | Call L_AutAddUndoNode to add an undo node to the automation handle.
2. | Disable the undo feature by calling L_AutSetUndoEnabled(pAutomation, FALSE).
3. | Perform the operations to be combined into one undo.
4. | Re-enable the undo feature by calling L_AutSetUndoEnabled (pAutomation, TRUE).

When L_AutUndo is called for this node, all of the combined operations will be undone.


Automation Printing

L_AutPrint provides a means of printing that data in the automation container that is currently displayed on the screen. The contents of a container displayed on the screen can be erased using L_ContainerReset.

The example below will print the automation data displayed on the screen.

/* This example shows how to print the automation data */

L_INT PrintTest ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
/* print the automtion active container data */
L_AutPrint ( pAutomation, 0 ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


Introduction to Vector Automation

Adding Automation to an application enables the user to add all the vector toolkit capabilities and the associated user interfaces, to that application. The vector automation toolkit coordinates the low-level Vector toolkit functions, the LEAD container functions and the LEAD toolbar functions. This facilitates the building of a vector application and removes the need to understand all the low level functionality.

The vector automation toolkit can do the following:

handle multiple windows simultaneously, with each window having its own transformations, selection, Undo/Redo information…etc.

set the Undo/Redo level to virtually any value, as well as Undo or Redo the operations in every window in an MDI environment.

select All or None of the objects in the current active window. In addition, the current selection can be cut, copied, pasted or deleted.

print the vector drawing in any of the application's opened windows.

The vector automation toolbar lets the user select the needed tool and draw, while the automation handles the visual feedback needed to communicate between the drawing process and the user. Mouse cursors and the basic drawing algorithms for selected objects (Line, Ellipse, Polygon…etc.) are handled by automation. The Vector objects currently available in the toolkit are:

Vertex.

Line.

Rectangle.

Polyline.

Polybezier.

Polygon.

Ellipse.

Circle.

Arc.

Text.

Pie.

Chord.

Polydraw.

Raster.

The user should have a good grasp of the following LEAD functionalities before effectively using the automated Vector functionality:

Low-level Vector functionality.

LEAD Toolbar.

LEAD Container.

Therefore, we strongly recommend that anyone wanting to use the Vector Automation functionality carefully read the documentation of the modules mentioned above.

The vector automation functionality gives the user the flexibility to create and add LEAD Containers and the LEAD Toolbar using automated functions. This offers the maximum possible creativity to the user. Please be advised that using the low-level functionality of the LEADTOOLS Container and LEADTOOLS Toolbar may occasionally create internal automation conflicts. Consequently, we recommend using the given automation interface functions with the LEADTOOLS Container and the LEADTOOLS Toolbar.


Introduction to Paint Automation

Adding automation to a paint application enables the user to add all the paint toolkit capabilities and the associated user interfaces, to that application. The paint automation coordinates the low-level Digital Paint toolkit functions, the LEAD container functions and the LEAD toolbar functions. This facilitates the building of a paint application and removes the need to understand all the low level functionality.

The paint automation toolkit can do the following:

handle multiple windows simultaneously, with each window having its own transformations, regions, Undo/Redo information…etc.

set the Undo/Redo level to virtually any value, as well as Undo or Redo the operations in every window in an MDI environment.

select All or None of the bitmap in the current active window. In addition, the current selection can be cut, copied, pasted or deleted.

print the bitmap in any of the application's opened windows.

The paint automation toolbar lets the user select the needed tool and draw, while the automation handles the visual feedback needed to communicate between the painting process and the user. Mouse cursors and the basic drawing algorithms for selected tools (Line, Ellipse, Polygon…etc.) are handled by automation. The Paint tools currently available in the toolkit are:

Paintbrush.

Line Shape.

Rectangle Shape.

Rounded Rectangle Shape.

Ellipse Shape.

Polygon Shape.

Curve Shape.

Rectangular Select.

Rounded Rectangular Select.

Elliptical Select.

Polygon Select.

Surface Select.

Border Select.

Color Select.

Fill using the surface fill method.

Fill using the border fill method.

Fill using the color replace method (Color Replace).

Text.

Color Picker.

Select (region) mover.

Zoom.

Most of the tools above have an accompanying dialog that can be used to set the tool properties.

The user should have a good grasp of the following LEAD functionalities before effectively using the automated digital paint functionality:

Low-level digital paint functionality.

LEAD Toolbar.

LEAD Container.

Therefore, we strongly recommend that anyone wanting to use the automated digital paint functionality carefully read the documentation of the modules mentioned above.

The automated digital paint functionality gives the user the flexibility to create and add LEAD Containers and the LEAD Toolbar using automated functions. This offers the maximum possible creativity to the user. Please be advised that using the low-level functionality of the LEADTOOLS Container and LEADTOOLS Toolbar may occasionally create internal automation conflicts. Consequently, we recommend using the given automation interface functions with the LEADTOOLS Container and the LEADTOOLS Toolbar


Controlling Painting Properties

When working with digital paint automation, specific properties, as well as the background color, can be set or retrieved using the following functions:

L_AutGetPaintBkColor

L_AutGetPaintProperty

L_AutSetPaintBkColor

L_AutSetPaintProperty

The LEADTOOLS Digital Paint tools let you manipulate the following:

Paintbrush characteristics

Shape characteristics

Region characteristics

Fill characteristics

Text characteristics

Each set of characteristics given above has several properties that can be set. This lets the user fine tune the output. These properties can be set using the L_AutSetPaintProperty function. To retrieve the current settings for the properties, use the L_AutGetPaintProperty function. Below is an example showing how to manipulate the Shape properties:

/* this example shows how to change the paint shape properties */
L_INT SetPaintShapePropsTest ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
PAINTSHAPE shape ;

/* set the paint shape group properties */
L_AutGetPaintProperty ( pAutomation, PAINT_GROUP_SHAPE, &shape ) ;

/* make some changes to the required properties */
if ( SHAPE_BORDER_STYLE_SOLID == shape.nBorderStyle )
{
/* set the desired shape properties using the field masks */
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERSTYLE |
PSF_BORDERWIDTH |
PSF_BORDERENDCAP;
shape.nBorderStyle = SHAPE_BORDER_STYLE_DOT ;
shape.nBorderWidth = 10 ;
shape.nBorderEndCap = SHAPE_BORDER_ENDCAP_ROUND ;

/*set the paint shape group properties */
L_AutSetPaintProperty ( pAutomation, PAINT_GROUP_SHAPE, &shape ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}

For more examples showing the use of digital paint automation, refer to Paint Automation Tutorials.

When the user cuts or deletes some region from a bitmap, an exposed area is left behind This area will be filled by the paint background color, set by the function L_AutSetPaintBkColor. To determine the current paint background color, call L_AutGetPaintBkColor. The example below shows how to retrieve and set the paint background color:

/* This example will make sure that the BK is not anything but black */
L_INT StickToBalck ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
COLORREF crBkColor ;

/* get the current paint automation color */
L_AutGetPaintBkColor ( pAutomation, &crBkColor ) ;

if ( crBkColor != RGB ( 0, 0, 0 ) ) /* check if its not black */
{
/* set the paint automation background color */
L_AutSetPaintBkColor ( pAutomation, RGB(0, 0, 0 ) ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


Files To Be Included With Your Application

The installation procedure creates a directory tree for the LEADTOOLS files, and adds the demonstration programs and online help to your desktop. You specify the root directory during installation. The following subdirectory is created:

REDIST\

Redistributable Automation and Container files.

Note: | You may not copy or redistribute any of the following files without obtaining the proper license. In some cases, the license is included with your initial purchase of LEADTOOLS. In other cases, you must obtain a license from a third party or enter into a royalty agreement with LEAD to obtain the proper license. For these special licensing situations, see the notes below accompanying the specific file.
Note: | You may not distribute the header files with your application, and you may not provide software development capabilities in your application.

The following table summarizes the files you must include on your distribution diskettes to support the LEADTOOLS functions. Most files in the table are optional. These files are referred to as "Redistributables" in the License Agreement.

Please note that LTKRN is required for ALL API applications. For more information on LTKRN and other files for the Main API, refer to Files To Be Included With Your Application .

Redistributable Name: | Explanation: | If you are using a standard release without Unicode, the files to use are: | If you are using a standard release with Unicode, the files to use are: | If you are using an evaluation release without Unicode, the files to use are: | If you are using an evaluation release with Unicode, the files to use are:
LTAUT | LEADTOOLS Automation. The header file is LTAUT.H. | DLL: LTAUT14N.DLL Library: LTAUT_N.LIB. | DLL: LTAUT14NU.DLL Library: LTAUT_NU.LIB. | DLL: LTAUT14E.DLL Library: LTAUT_E.LIB. | DLL: LTAUT14EU.DLL Library: LTAUT_EU.LIB..
LTCON | LEADTOOLS Container. The header file is LTCON.H. | DLL: LTCON14N.DLL Library: LTCON_N.LIB. | DLL: LTCON14NU.DLL Library: LTCON_NU.LIB. | DLL: LTCON14E.DLL Library: LTCON_E.LIB. | DLL: LTCON14EU.DLL Library: LTCON_EU.LIB..


Installation Directory

The installation procedure creates a directory tree for the LEADTOOLS files, and adds the demonstration programs and online help to your desktop. You specify the root directory during installation.

Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

The following is a list of the subdirectories in the root directory:

ACROBAT | LEADTOOLS manuals in the PDF format, which you can view and print using Adobe Acrobat. These files are optional and are available when installing from the CD-ROM.
BIN | Executable files for the demonstration programs.
HELP | Online help files.
IMAGES | Sample images and databases containing images.
EXAMPLES\DLL | One subdirectory for each example API program.
EXAMPLES\OCX | One subdirectory for each example ActiveX program.
EXAMPLES\COM | One subdirectory for each example COM program.
EXAMPLES\CLASSLIB | One subdirectory for each example Class Library program.
EXAMPLES\RES | Resource files for the example programs.
INCLUDE | Header files, BAS files, and the ActiveX's MFC interface files for versions of Visual C++ earlier than 4.0.
INCLUDE\CLASSLIB | Header files for the Class Library
LIB | Library files.
REDIST | Redistributable files. These are copies of the LEADTOOLS files and other files that you may need to distribute with your application. For exact information about required files, refer to Files To Be Included With Your Application.


Technical Support

As a registered user, free technical support is available. You must register your software to receive any technical support. Technical support is available 9 a.m. through 6 p.m. Eastern Standard Time. If you are calling by phone, please be at your computer. You can also contact us through the following methods:

Phone: | (704) 372-9681
E-mail: | support@leadtools.com
FAX: | (704) 372-8161
Home page: | http://www.leadtools.com
FTP: | ftp.leadtools.com

You can also contact LEAD by mail at:

LEAD Technologies, Inc.
Atten: Technical Support
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

Before calling technical support, please look in the online documentation and the example programs for an answer to your question.


Container and Automation API Function Groups

Containers

Container Functions: Offsets

Container Functions: Scalars

Container Functions: Creating a Container

Container Functions: Displaying Objects

Container Functions: Editing Objects

Container Functions: Container Properties

Container Functions: Initializing and Freeing Containers

Container Functions: Container Objects

Container Functions: Callbacks

General Automation

Automation Functions: Initializing, Creating and Freeing

Automation Functions: Automation Container

Automation Functions: Automation Toolbar

Automation Functions: Undoing/Redoing Operations

Automation Functions: Editing Automation Containers

Automation Functions: Automation Printing

Vector Automation

Automation Functions: Vector Objects in an Automation Container

Paint Automation

Automation Functions: Automation Paint Property


Container Functions: Initializing and Freeing Containers

L_ContainerFree

L_ContainerInit


Container Functions: Creating a Container

L_ContainerCreate

L_ContainerInit


Container Functions: Container Objects

L_ContainerGetObjectCursor

L_ContainerGetObjectType

L_ContainerSetObjectCursor

L_ContainerSetObjectType


Container Functions: Container Properties

L_ContainerGetMetrics

L_ContainerGetOwner

L_ContainerIsOwnerDraw

L_ContainerIsEnabled

L_ContainerSetEnabled

L_ContainerSetMetrics

L_ContainerSetOwner

L_ContainerSetOwnerDraw


Container Functions: Scalars

L_ContainerGetScalar

L_ContainerSetScalar


Container Functions: Offsets

L_ContainerGetOffset

L_ContainerSetOffset


Container Functions: Callbacks

CONTAINERCALLBACK

L_ContainerGetCallback

L_ContainerSetCallback


Container Functions: Editing Objects

L_ContainerEditObject

L_ContainerIsEnabled

L_ContainerSetEnabled


Container Functions: Displaying Objects

L_ContainerEditObject

L_ContainerReset

L_ContainerUpdate


Automation Functions: Initializing, Creating and Freeing

L_AutCreate

L_AutInit

L_AutIsValid


Automation Functions: Automation Container

L_ContainerInit

L_ContainerCreate

L_ContainerFree

L_AutInit

L_AutCreate

L_AutAddContainer

L_AutGetActiveContainer

L_AutSetActiveContainer

L_AutEnumContainers

L_AutRemoveContainer


Automation Functions: Automation Toolbar

L_AutGetCurrentTool

L_AutGetToolbar

L_AutSetCurrentTool

L_AutSetToolbar


Automation Functions: Undoing/Redoing Operations

Undoing Operations

L_AutAddUndoNode

L_AutCanUndo

L_AutGetUndoLevel

L_AutSetUndoEnabled

L_AutSetUndoLevel

L_AutUndo

Redoing Operations

L_AutCanRedo

L_AutRedo


Automation Functions: Editing Automation Containers

L_AutClipboardDataReady

L_AutCopy

L_AutCut

L_AutDelete

L_AutPaste


Automation Functions: Automation Printing

L_AutPrint


Automation Functions: Vector Objects in an Automation Container

L_AutEditVectorObject

L_AutGetVectorProperty

L_AutSetVectorProperty


Automation Functions: Automation Paint Property

L_AutSetPaintProperty

L_AutGetPaintProperty

L_AutSetPaintBkColor

L_AutGetPaintBkColor


Data Types

Basic Data Types and Keywords

LEADTOOLS Basic Data Types

Keywords Used in Declarations

General Automation Data Types

AUTOMATIONHANDLE

AUTOMATIONMODE

AUTOMATIONSELECT

Vector Automation Structures

AUTOMATIONVECTORPROPERTIES

Container Data Types

CONTAINERARCDATA

CONTAINERBEZIERDATA

CONTAINERCIRCLEDATA

CONTAINERELLIPSEDATA

CONTAINERHANDLE

CONTAINERLINEDATA

CONTAINERMETRICS

CONTAINEROBJECTDATA

CONTAINERPAINTDATA

CONTAINERPOINTDATA

CONTAINERPOLYLINEDATA

CONTAINERRECTDATA

CONTAINERSQUAREDATA

CONTAINERTEXTDATA

VECTORPOINT

CONTAINEROBJECTTYPE


LEADTOOLS Basic Data Types

LEADTOOLS has defined the following basic data types for portability:

Data Type | Definition and Usage
L_BITFIELD | Defined as L_UINT; used as a bit field.
L_BOOL | Defined as L_UINT; used as a boolean value.
L_CHAR | Defined as char; used as a signed 8-bit integer.
L_DOUBLE | Defined as double; used as a double precision floating point number.
L_FLOAT | Defined as float; used as a floating point number.
L_INT | Defined as int; used as a signed integer, 16-bits or larger.
L_INT16 | Defined as short; used as a signed 16-bit integer.
L_INT32 | Defined as long; used as a signed 32-bit integer.
L_UCHAR | Defined as unsigned char; used as an unsigned 8-bit integer.
L_UINT | Defined as unsigned; used as an unsigned integer, 16-bits or larger.
L_UINT16 | Defined as unsigned short; used as an unsigned 16-bit integer.
L_UINT32 | Defined as unsigned long; used as an unsigned 32-bit integer.
L_VOID | Defined as void; used as a void.
L_COMP | Defined as L_UINT; used as a handle to a computer
L_MEDIA | Defined as L_VOID L_FAR *; used as a void pointer
L_TCHAR | Defined as either char or TCHAR. If FOR_UNICODE is defined, then L_TCHAR will be defined as TCHAR.


Keywords Used in Declarations

LEADTOOLS uses the following keywords in declarations of functions, structures, and datatypes:

Keyword | Definition and Usage
L_FAR | Defined as nothing; used as a placeholder.
L_HUGE | Defined as nothing; used as a placeholder.
L_EXPORT | Defined as nothing; used as a placeholder.
L_PASCAL | Defined as nothing; used as a placeholder.
EXT_FUNCTION | Defined as WINAPI; used as an attribute for all toolkit functions.
pEXT_FUNCTION | Defined as EXT_FUNCTION L_FAR *; used as an attribute when defining pointers to toolkit functions.
EXT_CALLBACK | Defined as _cdecl L_FAR; used as an attribute for all toolkit callback functions.
pEXT_CALLBACK | Defined as EXT_CALLBACK L_FAR *; used as an attribute when defining pointers to toolkit callback functions.


CONTAINERARCDATA

typedef struct _CONTAINERARCDATA
{
L_INT nSize ;
VECTORPOINT vptCenter ;
L_UINT32 dwRadius ;
L_FLOAT fStartAngle ;
L_FLOAT fSweepAngle ;

} CONTAINERARCDATA, L_FAR *pCONTAINERARCDATA ;

The CONTAINERARCDATA structure holds the information on an arc object.

Member | Description
nSize | Size of this structure.
vptCenter | VECTORPOINT structure that contains the center coordinates of the arc.
dwRadius | Specifies the radius of the arc. This value must be positive.
fStartAngle | Specifies the start angle, in degrees, relative to the x-axis.
fSweepAngle | Specifies the sweep angle, in degrees, relative to the starting angle.

Comments

Constructing an imaginary circle around the specified center point with the specified radius draws the arc. The starting point of the arc is determined by measuring counterclockwise from the x-axis of the circle by the number of degrees in the start angle. The ending point is similarly located by measuring counterclockwise from the starting point by the number of degrees in the sweep angle. Below is a graphical representation.


CONTAINERBEZIERDATA

typedef struct _CONTAINERBEZIERDATA
{
L_INT nSize;
VECTORPOINT vptBezier [ 4 ] ;

} CONTAINERBEZIERDATA, L_FAR *pCONTAINERBEZIERDATA ;

The CONTAINERBEZIERDATA structure holds the coordinates of the endpoints and control points of a Bezier object.

Member | Description
nSize | Size of this structure.
vptBezier [ 4 ] | Array of VECTORPOINT structures that contain the endpoints and control points of the curve. The order of the points is as follows:
 | Value | Meaning
 | Point[0] | Start point.
 | Point[1] | First control point.
 | Point[2] | Second control point.
 | Point[3] | End point.


CONTAINERCIRCLEDATA

typedef struct _CONTAINERCIRCLEDATA
{
L_INT nSize ;
VECTORPOINT vptCircle [ 2 ] ;

} CONTAINERCIRCLEDATA, L_FAR *pCONTAINERCIRCLEDATA ;

The CONTAINERCIRCLEDATA structure holds the coordinates of the bounding square of a circle object.

Member | Description
nSize | Size of this structure.
vptCircle | An array of structures that contain the upper-left and lower-right points of the bounding square of the circle object. The contents of the array are as follows:
 | Value | Meaning
 | vptCircle [ 0 ].x | x-coordinate of the upper-left corner of the circle's bounding square.
 | vptCircle [ 0 ].y | y-coordinate of the upper-left corner of the circle's bounding square.
 | vptCircle [ 1 ].x | x-coordinate of the lower-right corner of the circle's bounding square.
 | vptCircle [ 1 ].y | y-coordinate of the lower-right corner of the circle's bounding square.


CONTAINERELLIPSEDATA

typedef struct _CONTAINERELLIPSEDATA
{
L_INT nSize ;
VECTORPOINT vptEllipse [ 2 ] ;

} CONTAINERELLIPSEDATA, L_FAR *pCONTAINERELLIPSEDATA ;

The CONTAINERELLIPSEDATA structure holds the coordinates of the bounding rectangle of an ellipse object.

Member | Description
nSize | Size of this structure.
vptEllipse | An array of structures that contain the upper-left and lower-right points of the bounding rectangle of the ellipse object. The contents of the array are as follows:
 | Value | Meaning
 | vptEllipse [ 0 ].x | x-coordinate of the upper-left corner of the ellipse's bounding rectangle.
 | vptEllipse [ 0 ].y | y-coordinate of the upper-left corner of the ellipse's bounding rectangle.
 | vptEllipse [ 1 ].x | x-coordinate of the lower-right corner of the ellipse's bounding rectangle.
 | vptEllipse [ 1 ].y | y-coordinate of the lower-right corner of the ellipse's bounding rectangle.


CONTAINERHANDLE

The CONTAINERHANDLE structure serves as a working area for the container functions. The user can initialize the container handle at the start of program and save it in a variable. The container handle can then be used with any LEAD container function. When the container handle is no longer needed, the user can free it. Therefore, the user doesn’t have to initialize the container handle and free it every time it is used.


CONTAINERLINEDATA

typedef struct _CONTAINERLINEDATA
{
L_INT nSize;
VECTORPOINT vptLine [ 2 ];
} CONTAINERLINEDATA, L_FAR *pCONTAINERLINEDATA ;

The CONTAINERLINEDATA holds the coordinates of a line object.

Member | Description
nSize | Size of this structure.
vptLine [ 2 ] | An array of structures that contain the beginning and ending points of the line. The contents of the array are as follows:
 | Value | Meaning
 | vptLine [ 0 ].x | The starting x position.
 | vptLine [ 0 ].y | The starting y position.
 | vptLine [ 1 ].x | The ending x position.
 | vptLine [ 1 ].y | The ending y position.


CONTAINERMETRICS

typedef struct _CONTAINERMETRICS
{
L_INT nSize;
L_UINT32 dwMask;
COLORREF crBorder;
L_INT nHandleWidth;
L_INT nHandleHeight;
COLORREF crHandle;
L_BOOL fEnableHandles;
RECT rcLimits ;
LOGFONT logTextFont ;
CONTAINERALIGNMENT nTextAlignment ;
HPALETTE hPalette ;
} CONTAINERMETRICS, L_FAR *pCONTAINERMETRICS ;

The CONTAINERMETRICS structure holds the information that controls the container's behavior.

Member | Description
nSize | Size of this structure.
dwMask | Flags that indicate which members of this structure contain valid information. This member must be filled prior to calling L_ContainerGetMetrics or L_ContainerSetMetrics. Possible values are given below. These values may be combined using the bitwise OR operator (|).
 | Value | Meaning
 | CMF_ALL | All the fields will be used.
 | CMF_BORDERCOLOR | Indicates that the crBorder field will be used.
 | CMF_HANDLEWIDTH | Indicates that the nHandleWidth field will be used
 | CMF_HANDLEHEIGHT | Indicates that the nHandleHeight field will be used
 | CMF_HANDLECOLOR | Indicates that the crHandle field will be used
 | CMF_ENABLEHANDLES | Indicates that the fEnableHandles field will be used
 | CMF_LIMITS | Indicates that the rcLimits field will be used
 | CMF_LOGTEXTFONT | Indicates that the logTextFont field will be used.
 | CMF_TEXTALIGNMENT | Indicates that the nTextAlignment will be used
 | CMF_PALETTE | Indicates that the hPalette field will be used
crBorder | Specifies the color of the pen used for drawing objects within the container. The default color is RGB ( 0, 0, 0 ).
nHandleWidth | Specifies the width, in logical units, of the handle used when editing an object. The default value is 4.
nHandleHeight | Specifies the height, in logical units, of the handle used when editing an object. The default value is 4.
crHandle | Specifies the color of the pen used when drawing the handle. The default color is RGB (0, 0, 0 ).

fEnableHandles | Flag that indicate whether the handle used when editing objects within the container is enabled or disabled. Possible values are:
 | Value | Meaning
 | TRUE | The handle is enabled. (Default)
 | FALSE | The handle is disabled.
rcLimits | RECT structure that contains the boundaries of the container. Any point outside the specified boundaries will not be processed. The container transformation values (scaling and offset) are taken into consideration when determining whether the point is inside the container. The default container boundaries are {0, 0, 0, 0 }. Therefore, the user should set the limits value before getting data from the container.

logTextFont | Pointer to a LOGFONT structure that contains the characteristics of the logical font used with the container text object(s). The default values for this field are:
 | Value | Meaning
 | logTextFont.lfHeight | 14
 | logTextFont.lfWidth | 0
 | logTextFont.lfEscapement | 0
 | logTextFont.lfOrientation | 0
 | logTextFont.lfWeight | FW_NORMAL
 | logTextFont.lfItalic | FALSE
 | logTextFont.lfUnderline | FALSE
 | logTextFont.lfStrikeOut | FALSE
 | logTextFont.lfCharSet | ANSI_CHARSET
 | logTextFont.lfOutPrecision | OUT_DEFAULT_PRECIS
 | logTextFont.lfClipPrecision | CLIP_DEFAULT_PRECIS
 | logTextFont.lfQuality | DEFAULT_QUALITY
 | logTextFont.lfPitchAndFamily | FF_DONTCARE
 | logTextFont.lfFaceName | Times New Roman
nTextAlignment | A constant that specifies the text alignment of the container's text object(s). Possible values are:
 | Value | Meaning
 | CONTAINER_ALIGNMENT_LEFT | Left-aligns text in the container text object.
 | CONTAINER_ALIGNMENT_HCENTER | Centers text in the container text object.
 | CONTAINER_ALIGNMENT_RIGHT | Right-aligns text in the container text object.
 | The default value for the field is CONTAINER_ALIGNMENT_LEFT.
hPalette | Handle of the palette used to draw the container objects. This should be the same palette used to paint the window that owns the container. The default value for this field is NULL.


CONTAINEROBJECTDATA

typedef struct _CONTAINEROBJECTDATA
{
L_INT nSize;
CONTAINEROBJECTTYPE nObjectType;
L_VOID L_FAR *pObjectData;
CONTAINERSTATE fState;
} CONTAINEROBJECTDATA, L_FAR *pCONTAINEROBJECTDATA ;

The CONTAINEROBJECTDATA holds the data that describes a container object.

Member | Description
nSize | Size of this structure.
nObjectType | Object type. Possible values are:
 | Value | Meaning
 | CONTAINER_OBJECT_TYPE_POINT | The object is a point, nothing is drawn to the screen.
 | CONTAINER_OBJECT_TYPE_LINE | The object is a line. The container will start drawing a line when the user presses the left mouse button, and will continue drawing the line as the user drags the mouse. The drawing will end when the user releases the left mouse button or presses the right mouse button.
 | CONTAINER_OBJECT_TYPE_SQUARE | The object is a square. The container will start drawing a square when the user presses the left mouse button, and will continue drawing the square as the user drags the mouse. The drawing will end when the user releases the left mouse button or presses the right mouse button.
 | CONTAINER_OBJECT_TYPE_RECT | The object is a rectangle. The container will start drawing a rectangle when the user presses the left mouse button, and will continue drawing the rectangle as the user drags the mouse. The drawing will end when the user releases the left mouse button or presses the right mouse button.
 | CONTAINER_OBJECT_TYPE_CIRCLE | The object is a circle. The container will start drawing a circle when the user presses the left mouse button, and will continue drawing the circle as the user drags the mouse. The drawing will end when the user releases the left mouse button or presses the right mouse button.
 | CONTAINER_OBJECT_TYPE_ELLIPSE | The object is an ellipse. The container will start drawing an ellipse when the user presses the left mouse button, and will continue drawing the ellipse as the user drags the mouse. The drawing will end when the user releases the left mouse button or presses the right mouse button.
 | CONTAINER_OBJECT_TYPE_POLYLINE | The object is a polygon. The container will start drawing a polygon when the user presses the left mouse button, and will continue drawing the polygon as the user drags the mouse. The drawing will end when the user double clicks the left mouse button. Drawing is aborted when the user presses the right mouse button.
 | CONTAINER_OBJECT_TYPE_BEZIER | The object is a Bezier curve. The container will start drawing a Bezier curve when the user presses the left mouse button, and will continue drawing the curve as the user drags the mouse. The drawing will end when the user double clicks the left mouse button. Drawing is aborted when the user presses the right mouse button. The user can manipulate the curve control points, after drawing the first curve, by using the left mouse button to move the first curve control point and the SHIFT+left mouse button to move the second control point.
 | CONTAINER_OBJECT_TYPE_ARC | The object is an arc. The arc is drawn by specifying its center, radius, start angle and sweep angle. The user presses the left mouse button at the point where the center of the arc (the vertex about which the arc sweeps) will be. Holding the left mouse button down, the user drags the mouse the length of the radius, along the desired start angle and releases the left mouse button. Press the left mouse button again and drag the mouse through the desired sweep angle. Release the mouse button. Releasing the mouse button will end the operation. Clicking the right-mouse button will abort the operation.
 | CONTAINER_OBJECT_TYPE_TEXT | The object is a text object. The user specifies the text box dimensions by pressing the left-mouse button and dragging the mouse. The desired text can then be entered in the text box. Double-clicking anywhere outside the text box will end the operation. Clicking the right-mouse button will abort the operation. The properties of the text will be specified through the container metrics.
pObjectData | Pointer to a structure that contains a description of the object. The structure type will depend on the nObjectType field. Therefore, this pointer must be cast to the appropriate type for the object. For more information on the object descriptions, refer to the structures specified below.
 | nObjectType | appropriate pointer type
 | CONTAINER_OBJECT_TYPE_POINT | (pCONTAINERPOINTDATA)
 | CONTAINER_OBJECT_TYPE_LINE | (pCONTAINERLINEDATA)
 | CONTAINER_OBJECT_TYPE_SQUARE | (pCONTAINERSQUAREDATA)
 | CONTAINER_OBJECT_TYPE_RECT | (pCONTAINERRECTDATA)
 | CONTAINER_OBJECT_TYPE_CIRCLE | (pCONTAINERCIRCLEDATA)
 | CONTAINER_OBJECT_TYPE_ELLIPSE | (pCONTAINERELLIPSEDATA)
 | CONTAINER_OBJECT_TYPE_POLYLINE | (pCONTAINERPOLYLINEDATA)
 | CONTAINER_OBJECT_TYPE_BEZIER | (pCONTAINERBEZIERDATA)
 | CONTAINER_OBJECT_TYPE_ARC | (pCONTAINERARCDATA)
 | CONTAINER_OBJECT_TYPE_TEXT | (pCONTAINERTEXTDATA)
fState | Flag that indicates the drawing state of the object. Possible values are:
 | Value | Meaning
 | CONTAINER_STATE_BEGIN | The container has just started drawing the object.
 | CONTAINER_STATE_PROCESS | The container is continuing to draw the object.
 | CONTAINER_STATE_END | The container has finished drawing the object.
 | CONTAINER_STATE_ABORT | The container aborted the drawing process.


CONTAINEROBJECTTYPE

typedef enum
{
/* predefined object types */
CONTAINER_OBJECT_TYPE_POINT /* Point object */
CONTAINER_OBJECT_TYPE_LINE /*Line object*/
CONTAINER_OBJECT_TYPE_SQUARE. /*Square object*/
CONTAINER_OBJECT_TYPE_RECT /* Rectangular object */
CONTAINER_OBJECT_TYPE_ELLIPSE /* Elliptical object */
CONTAINER_OBJECT_TYPE_CIRCLE /* Circular object */
CONTAINER_OBJECT_TYPE_POLYLINE /* Polyline object */
CONTAINER_OBJECT_TYPE_BEZIER /* Bezier curve object */
CONTAINER_OBJECT_TYPE_ARC /*Arc object */
CONTAINER_OBJECT_TYPE_TEXT /*Text object */

} CONTAINEROBJECTTYPE, *pCONTAINEROBJECTTYPE;

The CONTAINEROBJECTTYPE data type contains the predefined object types used by the LEADTOOLS Container functions.

Comments

This data type is used by the following functions and structures:

CONTAINEROBJECTDATA

L_ContainerSetObjectType

L_ContainerSetObjectCursor

L_ContainerGetObjectType

L_ContainerGetObjectCursor


CONTAINERPAINTDATA

typedef struct _CONTAINERPAINTDATA
{
pBITMAPHANDLE pBitmap ;
HPALETTE hRestrictionPalette ;
} CONTAINERPAINTDATA, L_FAR *pCONTAINERPAINTDATA ;

The CONTAINERPAINTDATA contains information used when adding a new container during automated digital painting.

Member | Description
pBitmap | Pointer to the bitmap handle that references the bitmap on which the drawing will occur. This parameter should be a valid LEAD bitmap handle; otherwise all the paint automation functions will return an error.
hRestrictionPalette | The restriction palette will be used by the automation to restrict the painting output to the nearest colors that could be found in this palette. If this field is NULL, no color restriction will be made by the toolkit.
 | The toolkit will copy the given handle; therefore the user can delete the handle after the function call ends.

Comments

This structure will be used only by the automated digital painting functions.


CONTAINERPOINTDATA

typedef struct _CONTAINERPOINTDATA
{
L_INT nSize;
VECTORPOINT vptPoint;
} CONTAINERPOINTDATA, L_FAR *pCONTAINERPOINTDATA ;

The CONTAINERPOINTDATA structure holds the coordinates of a point object.

Member | Description
nSize | Size of this structure.
vptPoint | Structure that contains the coordinates of the point.


CONTAINERPOLYLINEDATA

typedef struct _CONTAINERPOLYLINEDATA
{
L_INT nSize;
VECTORPOINT *pvptPoints;
L_INT nPointCount;

} CONTAINERPOLYLINEDATA, L_FAR *pCONTAINERPOLYLINEDATA ;

The CONTAINERPOLYLINEDATA structure holds the container polyline object coordinates.

Member | Description
nSize | Size of this structure.
pvptPoints | Pointer to an array of VECTORPOINT structures that contain the vertices of the polygon.
nPointCount | Specifies the number of vertices in the array. This value must be greater than or equal to 2.


CONTAINERRECTDATA

typedef struct _CONTAINERRECTDATA
{
L_INT nSize ;
VECTORPOINT vptRect [ 2 ] ;

} CONTAINERRECTDATA, L_FAR *pCONTAINERRECTDATA;

The CONTAINERRECTDATA structure holds the coordinates of a rectangle object.

Member | Description
nSize | Size of this structure.
vptRect [ 2 ] | An array of structures that contain the upper-left and lower-right points of the rectangle. The contents of the array are as follows:
 | Value | Meaning
 | vptRect [ 0 ].x | x-coordinate of the upper-left corner of the rectangle.
 | vptRect [ 0 ].y | y-coordinate of the upper-left corner of the rectangle.
 | vptRect [ 1 ].x | x-coordinate of the lower-right corner of the rectangle.
 | vptRect [ 1 ].y | y-coordinate of the lower-right corner of the rectangle.


CONTAINERSQUAREDATA

typedef struct _CONTAINERSQUAREDATA
{
L_INT nSize ;
VECTORPOINT vptSquare [ 2 ] ;

} CONTAINERSQUAREDATA, L_FAR *pCONTAINERSQUAREDATA ;

The CONTAINERSQUAREDATA holds the coordinates of a square object.

Member | Description
nSize | Size of the structure.
vptSquare [ 2 ] | An array of structures that contain the upper-left and lower-right points of the square. The contents of the array are as follows:
 | Value | Meaning
 | vptSquare [ 0 ].x | x-coordinate of the upper-left corner of the square.
 | vptSquare [ 0 ].y | y-coordinate of the upper-left corner of the square.
 | vptSquare [ 1 ].x | x-coordinate of the lower-right corner of the square.
 | vptSquare [ 1 ].y | y-coordinate of the lower-right corner of the square.


CONTAINERTEXTDATA

typedef struct _CONTAINERTEXTDATA
{
L_INT nSize;
L_TCHAR * pszText;
L_UINT32 cbLength;
RECT rcText;

} CONTAINERTEXTDATA, L_FAR *pCONTAINERTEXTDATA ;

The CONTAINERTEXTDATA structure holds information on a text object.

Member | Description
nSize | Size of this structure.
pszText | Null terminated text string.
cbLength | The length of the text string.
rcText | Structure that contains the coordinates of the rectangle that contains the text.

Comments

The text font and alignment are specified through the CONTAINERMETRICS structure of the container.


VECTORPOINT

typedef struct _VECTORPOINT
{
L_DOUBLE x;
L_DOUBLE y;
L_DOUBLE z;

} VECTORPOINT, L_FAR *pVECTORPOINT;

The VECTORPOINT structure holds information about a point.

Member | Description
x | X coordinate of the point.
y | Y coordinate of the point.
z | Z coordinate of the point.


AUTOMATIONHANDLE

The AUTOMATIONHANDLE structure serves as a working area for the automation functions. The user can initialize the automation handle at the start of program and save it in a variable. The automation handle can then be used with any LEAD automation function. When the automation handle is no longer needed, the user can free it. Therefore, the user doesn’t have to initialize the automation handle and free it every time it is used.


AUTOMATIONMODE

typedef enum _AUTOMATION_MODE
{
AUTOMATION_MODE_PAINT,
AUTOMATION_MODE_VECTOR,
AUTOMATION_MODE_ANNOTATION

} AUTOMATIONMODE, *pAUTOMATIONMODE ;

The AUTOMATIONMODE enumerated type contains options for the current automation mode.


AUTOMATIONSELECT

typedef enum
{
AUTOMATION_SELECT_NONE,
AUTOMATION_SELECT_ALL

} AUTOMATIONSELECT, *pAUTOMATIONSELECT ;

The AUTOMATIONSELECT enumerated type contains options for selecting objects.


AUTOMATIONVECTORPROPERTIES

typedef struct _AUTOMATIONVECTORPROPERTIES
{
L_INT nSize;
L_UINT32dwMask;
VECTORPEN
 Pen;
VECTORBRUSH
 Brush;
VECTORFONT
 Font;
}AUTOMATIONVECTORPROPERTIES, L_FAR *pAUTOMATIONVECTORPROPERTIES;

The AUTOMATIONVECTORPROPERTIES structure holds information about the Pen, Brush and Font to be used when a new vector object is created through the vector automation.

Member | Description
nSize | Size of this structure.
dwMask | Flag that indicates which members of this structure are valid. Possible values are given below. These values may be combined using a bitwise OR (|).
 | Value | Meaning
 | AUTOMATION_VECTOR_PEN | The Pen member of the structure is valid.
 | AUTOMATION_VECTOR_BRUSH | The Brush member of the structure is valid.
 | AUTOMATION_VECTOR_FONT | The Font member of the structure is valid.
Pen | VECTORPEN structure that contains information about the pen to use when drawing vector objects. dwFlags determines whether or not this parameter contains valid data.
Brush | VECTORBRUSH structure that contains information about the brush to use when drawing vector objects. dwFlags determines whether or not this parameter contains valid data.
Font | VECTORFONT structure that contains information about the font to use when drawing vector objects. dwFlags determines whether or not this parameter contains valid data.

Comments

Note:

The AUTOMATIONVECTORPROPERTIES structure is only used in the Vector toolkits.

L_AutSetVectorProperty and L_AutGetVectorProperty are the functions used to set and get the vector automation properties.


Return Codes

For a list of all possible return codes for LEADTOOLS Container and Automation API functions, refer to LEADTOOLS API Return Codes in the Main API help file.


Tutorials

Container Tutorials

Implementing Containers - Initializing, Creating and Freeing

Setting Container Metrics

Setting Container offsets

Setting Container Scaling Values

Using Container Objects

Collecting Container Events

Editing a Container Object

General Automation Tutorials

Implementing Automation - Implementing the Automated Edit Menu

Using Printing Capabilities

Vector Automation Tutorials

Implementing Automation – Initializing and Loading a Vector Image

Implementing Automation - Implementing Vector Automation

Paint Automation Tutorials

Implementing the Paint Automation Initializing, Creating and Freeing

The Automation and the Container

Working with the Paint Automation Toolbar

Using the Undoing/Redoing Capabilities

Using the Automation Editing Capabilities

Setting the Digital Painting Properties


Implementing Containers - Initializing, Creating and Freeing

Take the following steps to start a project and add some code that will create a new container handle:

1. | Start Visual C++, version 4.2.
2. | Select the File->New menu option, and in the dialog box, select Project Workspace.
3. | In the New Project Workspace dialog box, enter the location (c:\lead\examples\container). Make sure to select Application (Win32 Application) as the project type. Give the project the name "tutorial" and press Enter.
4. | Select the File->New menu option, and in the dialog box, select Resource Script and press Enter.
5. | Right click the script you just created. Select Insert and then Menu from the dialog box that appears, then click OK.
6. | Create this Menu structure:

IDR_MENU1

&File
&Open… with ID = IDM_FILE_OPEN
E&xit with ID = IDM_FILE_EXIT

7. | Select File->Save from the menu, enter Tutorial.rc in the Save As box and click Save.
8. | Select Insert->Files into Project, browse to the Tutorial.rc file we have just created and click Add.
9. | Select the File->New menu option, and in the dialog box, select Text File and press Enter.
10. | Copy and paste the following code into the text file you have just created. This code will do the basic job of loading and painting the bitmap.

#include <windows.h>
#include "c:\lead14\dll\include\l_bitmap.h"
#include "resource.h"

static L_VOID OnSize
(
HWND hWnd,
pBITMAPHANDLE pBitmap,
LPRECT prcView,
L_INT cx,
L_INT cy,
L_INT nZoom,
L_INT *pnHScroll,
L_INT *pnVScroll
)
{
SCROLLINFO si ;
L_INT nXOffset, nYOffset ;

if ( NULL != pBitmap && pBitmap->Flags.Allocated )
{
si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_ALL ;

// vertical scroll.
GetScrollInfo ( hWnd, SB_VERT, &si ) ;
si.nMin = 0 ;
si.nMax = BITMAPHEIGHT ( pBitmap ) ;
si.nPage = MulDiv ( cy, 100, nZoom ) ;

SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;

GetScrollInfo ( hWnd, SB_VERT, &si ) ;

*pnVScroll = si.nPos ;

// horizontal scroll
GetScrollInfo ( hWnd, SB_HORZ, &si ) ;
si.nMin = 0 ;
si.nMax = BITMAPWIDTH ( pBitmap ) ;
si.nPage = MulDiv ( cx, 100, nZoom ) ;

SetScrollInfo ( hWnd, SB_HORZ, &si, TRUE ) ;

GetScrollInfo ( hWnd, SB_HORZ, &si ) ;

*pnHScroll = si.nPos ;
}
else
{
si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_RANGE ;
si.nMin = 0 ;
si.nMax = 0 ;

SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;
SetScrollInfo ( hWnd, SB_HORZ, &si, TRUE ) ;

*pnHScroll = 0 ;
*pnVScroll = 0 ;
}

// set the painting rectangle.
SetRect ( prcView, 0, 0, BITMAPWIDTH ( pBitmap ), BITMAPHEIGHT ( pBitmap ) ) ;

if ( nZoom < 100 )
{
nXOffset = MulDiv ( *pnHScroll, 100, nZoom ) ;
nYOffset = MulDiv ( *pnVScroll, 100, nZoom ) ;
}
else
{
nXOffset = *pnHScroll ;
nYOffset = *pnVScroll ;
}

OffsetRect ( prcView, - nXOffset, - nYOffset ) ;

prcView->left = MulDiv ( prcView->left, nZoom, 100 ) ;
prcView->top = MulDiv ( prcView->top, nZoom, 100 ) ;
prcView->right = MulDiv ( prcView->right, nZoom, 100 ) ;
prcView->bottom = MulDiv ( prcView->bottom, nZoom, 100 ) ;
}

L_VOID OnHScroll
(
HWND hWnd,
L_UINT code,
L_INT nZoom,
LPRECT prcView,
L_INT *pnHScroll,
L_INT *pnVScroll
)
{
SCROLLINFO si ;

si.cbSize = sizeof (SCROLLINFO) ;
si.fMask = SIF_ALL ;
GetScrollInfo (hWnd, SB_HORZ, &si) ;

*pnHScroll = si.nPos ;

switch ( code )
{
case SB_LINELEFT:
si.nPos -= 1 ;
break ;

case SB_LINERIGHT:
si.nPos += 1 ;
break ;

case SB_PAGELEFT:
si.nPos -= si.nPage ;
break ;

case SB_PAGERIGHT:
si.nPos += si.nPage ;
break ;

case SB_THUMBTRACK:
si.nPos = si.nTrackPos ;
break ;

default:
break ;
}

si.fMask = SIF_POS ;
SetScrollInfo (hWnd, SB_HORZ, &si, TRUE) ;
GetScrollInfo (hWnd, SB_HORZ, &si) ;

if ( si.nPos != *pnHScroll )
{
L_INT dxUpdate ;

// update screen.
if ( nZoom >= 100 )
{
dxUpdate = MulDiv ( ( *pnHScroll - si.nPos ), nZoom, 100 ) ;
}
else
{
dxUpdate = *pnHScroll - si.nPos ;
}

// update screen.
OffsetRect ( prcView, dxUpdate, 0 ) ;

ScrollWindow ( hWnd, dxUpdate, 0, NULL, NULL ) ;

*pnHScroll = si.nPos ;

UpdateWindow ( hWnd ) ;
}
}

L_VOID OnVScroll
(
HWND hWnd,
L_UINT code,
L_INT nZoom,
LPRECT prcView,
L_INT *pnHScroll,
L_INT *pnVScroll
)
{
SCROLLINFO si ;

si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_ALL ;
GetScrollInfo (hWnd, SB_VERT, &si) ;

*pnVScroll = si.nPos ;

switch ( code )
{
case SB_LINEUP:
si.nPos -= 1 ;
break ;

case SB_LINEDOWN:
si.nPos += 1 ;
break ;

case SB_PAGEUP:
si.nPos -= si.nPage ;
break ;

case SB_PAGEDOWN:
si.nPos += si.nPage ;
break ;

case SB_THUMBTRACK:
si.nPos = si.nTrackPos ;
break ;

default:
break ;
}

si.fMask = SIF_POS ;
SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;
GetScrollInfo ( hWnd, SB_VERT, &si ) ;

if ( si.nPos != *pnVScroll )
{
L_INT dyUpdate ;

// update screen.
if ( nZoom >= 100 )
{
dyUpdate = MulDiv ( ( *pnVScroll - si.nPos ), nZoom, 100 ) ;
}
else
{
dyUpdate = *pnVScroll - si.nPos ;
}

// update screen.
OffsetRect ( prcView, 0, dyUpdate ) ;

ScrollWindow ( hWnd, 0, dyUpdate, NULL, NULL ) ;

*pnVScroll = si.nPos ;

UpdateWindow ( hWnd ) ;
}
}

L_VOID OnPaint
(
HWND hWnd,
pBITMAPHANDLE pBitmap,
LPRECT prcView,
HPALETTE hPalette
)
{
HDC hDC ;
PAINTSTRUCT ps ;
HPALETTE hOldPal ;

hDC = BeginPaint (hWnd, &ps) ;

if ( pBitmap->Flags.Allocated )
{
if ( hPalette )
{
hOldPal = SelectPalette ( hDC, hPalette, TRUE ) ;
RealizePalette ( hDC ) ;
}

L_PaintDC ( hDC, pBitmap, NULL, NULL, prcView, &ps.rcPaint, SRCCOPY ) ;

if ( NULL != hOldPal )
{
SelectPalette ( hDC, hOldPal, TRUE ) ;
}
}

EndPaint (hWnd, &ps) ;
}

static L_BOOL OnOpen ( HWND hWnd, pBITMAPHANDLE pBitmap )
{
static L_INT nOpenIndex = 0 ;
OPENFILENAME OpenFileName ;
L_TCHAR szFile [ MAX_PATH ] = TEXT("\0") ;
L_TCHAR szFileTitle [ MAX_PATH ] = TEXT("\0") ;
L_TCHAR szOpenFileFilter [ ] = {TEXT("ALL\0")TEXT("*.*\0")} ;
FILEOPENPARM FileOpenParams ;
FILEINFO FileInfo ;
L_UINT32 uFlags ;
BITMAPHANDLE hThumb ;

memset ( &FileOpenParams, 0, sizeof ( FILEOPENPARM ) ) ;

lstrcpy ( szFile, TEXT("") ) ;

L_InitBitmap ( pBitmap, 0, 0, 0 ) ;

L_InitBitmap ( &hThumb, 0, 0, 0 ) ;

OpenFileName.lStructSize = sizeof(OPENFILENAME);
OpenFileName.hwndOwner = hWnd;
OpenFileName.lpstrFilter = szOpenFileFilter;
OpenFileName.lpstrCustomFilter = NULL;
OpenFileName.nMaxCustFilter = 0;
OpenFileName.nFilterIndex = nOpenIndex;
OpenFileName.nMaxFile = sizeof(szFile);
OpenFileName.lpstrFile = szFile;
OpenFileName.nMaxFileTitle = sizeof(szFileTitle);
OpenFileName.lpstrFileTitle = szFileTitle;
OpenFileName.lpstrInitialDir = NULL;
OpenFileName.lpstrTitle = "Open a File";
OpenFileName.nFileOffset = 0;
OpenFileName.nFileExtension = 0;
OpenFileName.lpstrDefExt = NULL;
OpenFileName.lpfnHook = NULL;
OpenFileName.Flags = OFN_LONGNAMES ;

uFlags = DLG_FO_AUTOPROCESS |
DLG_FO_FILEINFO |
DLG_FO_SHOWPREVIEW |
DLG_FO_95STYLE ;

FileOpenParams.pBitmap = pBitmap ;
FileOpenParams.pThumbnail = &hThumb ;
FileOpenParams.bPreviewEnabled = TRUE ;
FileOpenParams.pFileInfo = &FileInfo ;

if ( L_DlgFileOpen ( hWnd, &OpenFileName, &FileOpenParams, uFlags, NULL, NULL ) == SUCCESS )
{
nOpenIndex = OpenFileName.nFilterIndex;

L_FreeBitmap ( &hThumb ) ;

L_ChangeBitmapViewPerspective ( NULL, pBitmap, TOP_LEFT );

return TRUE ;
}
else
{
return FALSE ;
}
}

static LRESULT WINAPI WndProc ( HWND hWnd, L_UINT uMessage, WPARAM wParam, LPARAM lParam )
{
static BITMAPHANDLE hBitmap ;
static RECT rcView ;
static HPALETTE hPalette = NULL ;
static L_INT nVScroll = 0 ;
static L_INT nHScroll = 0 ;
static L_INT nZoomFactor = 100 ;

switch( uMessage )
{
case WM_CREATE:
return 0L ;

case WM_DESTROY:
if ( hBitmap.Flags.Allocated )
{
L_FreeBitmap ( &hBitmap ) ;
}

if ( hPalette )
{
DeletePalette ( hPalette ) ;
}

PostQuitMessage ( 0 ) ;

return 0L ;

case WM_SIZE:
OnSize ( hWnd,
&hBitmap,
&rcView,
LOWORD ( lParam ),
HIWORD ( lParam ),
nZoomFactor,
&nHScroll,
&nVScroll ) ;
break ;

case WM_HSCROLL:
OnHScroll ( hWnd,
LOWORD ( wParam ),
nZoomFactor,
&rcView,
&nHScroll,
&nVScroll ) ;
break ;

case WM_VSCROLL:
OnVScroll ( hWnd,
LOWORD ( wParam ),
nZoomFactor,
&rcView,
&nHScroll,
&nVScroll ) ;

break ;

case WM_PAINT:
OnPaint ( hWnd, &hBitmap, &rcView, hPalette ) ;
break ;

case WM_COMMAND:
switch( LOWORD( wParam ) )
{
case IDM_FILE_OPEN:
{
BITMAPHANDLE hTempBitmap ;
HDC hDC ;

if ( OnOpen ( hWnd, &hTempBitmap ) )
{
if ( hBitmap.Flags.Allocated )
{
L_FreeBitmap ( &hBitmap ) ;
}

if ( hPalette )
{
DeletePalette ( hPalette ) ;
}

L_CopyBitmapHandle ( &hBitmap, &hTempBitmap ) ;

hDC = GetDC ( hWnd ) ;

hPalette = L_CreatePaintPalette ( hDC, &hBitmap ) ;

ReleaseDC ( hWnd, hDC ) ;

{//ADJUST WINDOW SIZE

RECT rcWindow ;
L_INT nWidth, nHeight ;

SystemParametersInfo ( SPI_GETWORKAREA, 0, &rcWindow, 0 ) ;

nWidth = min ( MulDiv ( BITMAPWIDTH ( &hBitmap ), nZoomFactor, 100 ),
( rcWindow.right - rcWindow.left ) ) ;

nHeight = min ( MulDiv ( BITMAPHEIGHT ( &hBitmap ), nZoomFactor, 100 ),
( rcWindow.bottom - rcWindow.top ) ) ;

MoveWindow ( hWnd,
0,
0,
nWidth,
nHeight,
TRUE ) ;

}//ADJUST WINDOW SIZE

InvalidateRect ( hWnd, NULL, TRUE ) ;
}
}

return 0L ;

case IDM_FILE_EXIT:
PostMessage ( hWnd, WM_CLOSE, 0, 0 ) ;
return 0L ;
}

break ;
}

return DefWindowProc ( hWnd, uMessage, wParam, lParam ) ;
}

L_INT WINAPI WinMain ( HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR pCmdLine, L_INT nCmdShow )
{
const L_TCHAR szClassName [ ] = TEXT("lead_container_tutorial") ;
WNDCLASSEX WndClass ;
HWND hWnd ;
MSG Msg ;

UNREFERENCED_PARAMETER ( hInstPrev ) ;
UNREFERENCED_PARAMETER ( pCmdLine ) ;

// unlock lead file formats support
UNLOCKSUPPORT ( ) ;

WndClass.cbSize = sizeof ( WNDCLASSEX ) ;
WndClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ;
WndClass.lpfnWndProc = WndProc ;
WndClass.cbClsExtra = 0 ;
WndClass.cbWndExtra = 0 ;
WndClass.hInstance = hInst ;
WndClass.hIcon = LoadIcon ( NULL, IDI_APPLICATION ) ;
WndClass.hCursor = LoadCursor ( NULL, IDC_ARROW ) ;
WndClass.hbrBackground = ( HBRUSH ) ( COLOR_WINDOW + 1 ) ;
WndClass.lpszMenuName = MAKEINTRESOURCE ( IDR_MENU1 ) ;
WndClass.lpszClassName = szClassName ;
WndClass.hIconSm = NULL ;

RegisterClassEx ( &WndClass ) ;

hWnd = CreateWindowEx ( 0L,
szClassName,
TEXT("Container Tutorial"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
NULL,
NULL,
hInst,
NULL ) ;

ShowWindow ( hWnd, nCmdShow ) ;
UpdateWindow ( hWnd ) ;

while ( GetMessage ( &Msg, NULL, 0, 0 ) != 0 )
{
TranslateMessage ( &Msg ) ;
DispatchMessage ( &Msg ) ;
}

UnregisterClass ( szClassName, hInst ) ;

return Msg.wParam ;
}

11. | Select File->Save from the menu and give the text file the name "contut.c".
12. | Select Insert->Files into Project from the menu. In the dialog box that appears, browse to the contut.c file just created, select it and click Add.
13. | Select Insert->Files into Project from the menu. In the dialog box that appears, browse to c:\lead\lib\ltkrn_n.lib, select it and click Add. Please note that "c:\lead" represents the directory where the LEADTOOLS 14 Toolkit was installed.
14. | Select Insert->Files into Project from the menu. In the dialog box that appears, browse to c:\lead\lib\ltdis_n.lib, select it and click Add.
15. | Select Insert->Files into Project from the menu. In the dialog box that appears, browse to c:\lead\lib\ltdlg_n.lib, select it and click Add.
16. | Add the following include statement:

#include "c:\lead14\dll\include\ltcon.h"

17.

Add the following declaration to the WndProc function:

static pCONTAINERHANDLE pContainer ;

18.

Replace the line "return 0L ;" after the statement "case WM_CREATE:" in the WndProc function with the following code:

if ( SUCCESS == L_ContainerInit ( &pContainer ) )
{
L_ContainerCreate ( pContainer, hWnd ) ;

return 0L ;
}
else
{
return -1L ;
}

19.

Add the following lines to the WndProc function, before the statement "PostQuitMessage" in the "case WM_DESTROY:"

if ( SUCCESS == L_ContainerIsValid ( pContainer ) )
{
L_ContainerFree ( pContainer ) ;
}

20.

Add the following code to the WndProc function, before the InvalidateRect function call in the "case IDM_FILE_OPEN:" statement:

L_ContainerReset ( pContainer ) ;

21. | Select Insert->Files into Project from the menu, in the dialog box that will appear, browse to c:\lead\lib\ltcon_n.lib, select it and click Add.
22. | Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Setting Container Offsets

Start with the project you created in Setting Container Metrics:

1.

Add the following argument to the OnSize function definition, after "HWND hWnd,":

pCONTAINERHANDLE pContainer,

2.

Add the following line just before the end of the OnSize function definition block (before it returns):

// update the container offset.
L_ContainerSetOffset ( pContainer, - prcView->left, - prcView->top, 0 )

3.

Add the following argument to the OnHScroll function definition, after "L_UINT code,":

pCONTAINERHANDLE pContainer,

4.

Add the following line before the UpdateWindow function in the OnHScroll function definition:

// update the container offset.
L_ContainerSetOffset ( pContainer, - prcView->left, - prcView->top, 0 ) ;

5.

Add the following argument to the OnVScroll function definition, after "L_UINT code,":

pCONTAINERHANDLE pContainer,

6.

Add the following line before the function UpdateWindow in the OnVScroll function definition:

// update the container offset.
L_ContainerSetOffset ( pContainer, - prcView->left, - prcView->top, 0 ) ;

7.

Add the following argument to the OnSize function call, in the WndProc function, after the argument "hWnd," :

pContainer,

8.

Add the following argument to the OnHScroll function call, in the WndProc function, after the argument "LOWORD ( wParam ),":

pContainer,

9.

Add the following argument to the OnVScroll function call, in the WndProc function, after the argument "LOWORD ( wParam ),":

pContainer,

10.

Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Setting Container Metrics

Start with the project you created in Implementing the Container - Initializing, Creating and Freeing.

1.

Add the following code to the WndProc function before the function InvalidateRect in the "case IDM_FILE_OPEN:" statement:

{ // CONTAINER METRICS

CONTAINERMETRICS Metrics ;

Metrics.nSize = sizeof ( CONTAINERMETRICS ) ;
Metrics.dwMask = CMF_LIMITS | CMF_PALETTE ;
Metrics.hPalette = hPalette ;
SetRect ( &Metrics.rcLimits, 0, 0, BITMAPWIDTH ( &hBitmap ), BITMAPHEIGHT ( &hBitmap ) ) ;

L_ContainerSetMetrics ( pContainer, &Metrics ) ;

} // CONTAINER METRICS

2.

Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Using Container Objects

Start with the project you created in Setting Container Scaling Values:

1.

Add the following popup menu structure to the main menu you created in Tutorial Implementing the Container - Initializing, Creating and Freeing:

&Draw Object
&Point with ID = IDM_DRAWOBJECT_POINT
&Line with ID = IDM_DRAWOBJECT_LINE
&Square with ID = IDM_DRAWOBJECT_SQUARE
&Rect with ID = IDM_DRAWOBJECT_RECT
&Circle with ID = IDM_DRAWOBJECT_CIRCLE
&Ellipse with ID = IDM_DRAWOBJECT_ELLIPSE
P&olyline with ID = IDM_DRAWOBJECT_POLYLINE
&Bezier with ID = IDM_DRAWOBJECT_BEZIER
&Arc with ID = IDM_DRAWOBJECT_ARC
&Text with ID = IDM_DRAWOBJECT_TEXT

2.

Add the following code to the WndProc function just before the "return 0L ;" of the WM_CREATE message:

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_DRAWOBJECT_POINT,
IDM_DRAWOBJECT_TEXT,
IDM_DRAWOBJECT_POINT,
MF_BYCOMMAND ) ;

EnableMenuItem ( GetMenu ( hWnd ), 1, MF_BYPOSITION | MF_GRAYED ) ;

3.

Add the following lines to the WndProc function, after the container metrics block, in the "case IDM_FILE_OPEN" of the WM_COMMAND message:

EnableMenuItem ( GetMenu ( hWnd ), 1, MF_BYPOSITION | MF_ENABLED ) ;
DrawMenuBar ( hWnd ) ;

4.

Add the following code to the WndProc function after the "return 0L;" statement of the "case IDM_FILE_EXIT:" statement:

case IDM_DRAWOBJECT_POINT:
L_ContainerSetObjectType ( pContainer, CONTAINER_OBJECT_TYPE_POINT ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_DRAWOBJECT_POINT,
IDM_DRAWOBJECT_TEXT,
IDM_DRAWOBJECT_POINT,
MF_BYCOMMAND ) ;

return 0L ;

case IDM_DRAWOBJECT_LINE:
L_ContainerSetObjectType ( pContainer, CONTAINER_OBJECT_TYPE_LINE ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_DRAWOBJECT_POINT,
IDM_DRAWOBJECT_TEXT,
IDM_DRAWOBJECT_LINE,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_DRAWOBJECT_SQUARE:
L_ContainerSetObjectType ( pContainer, CONTAINER_OBJECT_TYPE_SQUARE ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_DRAWOBJECT_POINT,
IDM_DRAWOBJECT_TEXT,
IDM_DRAWOBJECT_SQUARE,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_DRAWOBJECT_RECT:
L_ContainerSetObjectType ( pContainer, CONTAINER_OBJECT_TYPE_RECT ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_DRAWOBJECT_POINT,
IDM_DRAWOBJECT_TEXT,
IDM_DRAWOBJECT_RECT,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_DRAWOBJECT_CIRCLE:
L_ContainerSetObjectType ( pContainer, CONTAINER_OBJECT_TYPE_CIRCLE ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_DRAWOBJECT_POINT,
IDM_DRAWOBJECT_TEXT,
IDM_DRAWOBJECT_CIRCLE,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_DRAWOBJECT_ELLIPSE:
L_ContainerSetObjectType ( pContainer, CONTAINER_OBJECT_TYPE_ELLIPSE ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_DRAWOBJECT_POINT,
IDM_DRAWOBJECT_TEXT,
IDM_DRAWOBJECT_ELLIPSE,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_DRAWOBJECT_POLYLINE:
L_ContainerSetObjectType ( pContainer, CONTAINER_OBJECT_TYPE_POLYLINE ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_DRAWOBJECT_POINT,
IDM_DRAWOBJECT_TEXT,
IDM_DRAWOBJECT_POLYLINE,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_DRAWOBJECT_BEZIER:
L_ContainerSetObjectType ( pContainer, CONTAINER_OBJECT_TYPE_BEZIER ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_DRAWOBJECT_POINT,
IDM_DRAWOBJECT_TEXT,
IDM_DRAWOBJECT_BEZIER,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_DRAWOBJECT_ARC:
L_ContainerSetObjectType ( pContainer, CONTAINER_OBJECT_TYPE_ARC ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_DRAWOBJECT_POINT,
IDM_DRAWOBJECT_TEXT,
IDM_DRAWOBJECT_ARC,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_DRAWOBJECT_TEXT:
L_ContainerSetObjectType ( pContainer, CONTAINER_OBJECT_TYPE_TEXT ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_DRAWOBJECT_POINT,
IDM_DRAWOBJECT_TEXT,
IDM_DRAWOBJECT_TEXT,
MF_BYCOMMAND ) ;
return 0L ;

5. | Compile and run the project by selecting Build->Execute tutorial.exe from the menu.
6. | Select File->Open… and open any bitmap. Select any of the items in the Object popup menu and begin drawing objects in the container.


Setting Container Scaling Values

Start with the project you created in Setting Container offsets:

1.

Add the following code to the WndProc function, after the L_ContainerCreate ( pContainer, hWnd ) ; function call in the WM_CREATE message:

{ // SET THE SCALING FACTOR

VECTORPOINT vptScalarNum, vptScalarDen ;

vptScalarNum.x = nZoomFactor ;
vptScalarDen.x = 100 ;

vptScalarNum.y = nZoomFactor ;
vptScalarDen.y = 100 ;

vptScalarNum.z = 1 ;
vptScalarDen.z = 1 ;

L_ContainerSetScalar ( pContainer, &vptScalarNum, &vptScalarDen ) ;

} // SET THE SCALING FACTOR

2.

Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Collecting Container Events

Start with the project you created in Using Container objects

1.

Add the following callback function before the OnOpen function definition:

L_INT EXT_CALLBACK LeadContainerProc
(
pCONTAINERHANDLE pContainer,
CONTAINEREVENTTYPE nEventType,
L_VOID L_FAR *pEventData,
L_VOID L_FAR *pUserData
)
{
pCONTAINEROBJECTDATA pContainerObjectData = ( pCONTAINEROBJECTDATA ) pEventData ;
L_TCHAR pszState [ 80 ] ;
L_TCHAR buffer [ 500 ] ;
HWND hwndOwner ;

switch ( pContainerObjectData->fState )
{
case CONTAINER_STATE_BEGIN:
lstrcpy ( pszState, TEXT("Begin, ") ) ;
break ;

case CONTAINER_STATE_PROCESS:
lstrcpy ( pszState, TEXT("Process, ") ) ;
break ;

case CONTAINER_STATE_END:
lstrcpy ( pszState, TEXT("End, ") ) ;
break ;

case CONTAINER_STATE_ABORT:
lstrcpy ( pszState, TEXT("Abort, ") ) ;
break ;
}

switch ( nEventType )
{
case CONTAINER_EVENT_TYPE_DRAW:
{
switch ( pContainerObjectData->nObjectType )
{
// process the point object events
case CONTAINER_OBJECT_TYPE_POINT:
{
CONTAINERPOINTDATA PointData ;

PointData = * ( ( pCONTAINERPOINTDATA ) ( pContainerObjectData->pObjectData ) ) ;

wsprintf ( buffer,
TEXT("%s %s %lf %lf"),
TEXT("Point: "),
pszState,
PointData.vptPoint.x,
PointData.vptPoint.y ) ;
}

break ;

// process the line object events
case CONTAINER_OBJECT_TYPE_LINE:
{
CONTAINERLINEDATA LineData ;

LineData = * ( ( pCONTAINERLINEDATA ) ( pContainerObjectData->pObjectData ) ) ;

wsprintf ( buffer,
TEXT("%s %s %f %f %f %f"),
TEXT("Line: "),
pszState,
LineData.vptLine[0].x,
LineData.vptLine[0].y,
LineData.vptLine[1].x,
LineData.vptLine[1].y ) ;
}

break ;

// process the square object events
case CONTAINER_OBJECT_TYPE_SQUARE:
{
CONTAINERSQUAREDATA SquareData ;

SquareData = * ( ( pCONTAINERSQUAREDATA ) ( pContainerObjectData->pObjectData ) ) ;

wsprintf ( buffer,
TEXT("%s %s %f %f %f %f"),
TEXT("Square: "),
pszState,
SquareData.vptSquare [ 0 ].x,
SquareData.vptSquare [ 0 ].y,
SquareData.vptSquare [ 1 ].x,
SquareData.vptSquare [ 1 ].y ) ;
}

break ;

// process the rectangle object events
case CONTAINER_OBJECT_TYPE_RECT:
{
CONTAINERRECTDATA RectData ;

RectData = * ( ( pCONTAINERRECTDATA ) ( pContainerObjectData->pObjectData ) ) ;

wsprintf ( buffer,
TEXT("%s %s %f %f %f %f"),
TEXT("Rect: "),
pszState,
RectData.vptRect [ 0 ].x,
RectData.vptRect [ 0 ].y,
RectData.vptRect [ 1 ].x,
RectData.vptRect [ 1 ].y ) ;
}

break ;

// process the circle object events
case CONTAINER_OBJECT_TYPE_CIRCLE:
{
CONTAINERCIRCLEDATA CircleData ;

CircleData = * ( ( pCONTAINERCIRCLEDATA ) ( pContainerObjectData->pObjectData ) ) ;

wsprintf ( buffer,
TEXT("%s %s %f %f %f %f"),
TEXT("Circle: "),
pszState,
CircleData.vptCircle [ 0 ].x,
CircleData.vptCircle [ 0 ].y,
CircleData.vptCircle [ 1 ].x,
CircleData.vptCircle [ 1 ].y ) ;
}

break ;

// process the ellipse object events
case CONTAINER_OBJECT_TYPE_ELLIPSE:
{
CONTAINERELLIPSEDATA EllipseData ;

EllipseData = * ( ( pCONTAINERELLIPSEDATA ) ( pContainerObjectData->pObjectData ) ) ;

wsprintf ( buffer,
TEXT("%s %s %f %f %f %f"),
TEXT("Ellipse: "),
pszState,
EllipseData.vptEllipse [ 0 ].x,
EllipseData.vptEllipse [ 0 ].y,
EllipseData.vptEllipse [ 1 ].x,
EllipseData.vptEllipse [ 1 ].y ) ;
}

break ;

// process the polyline object events
case CONTAINER_OBJECT_TYPE_POLYLINE:
{
CONTAINERPOLYLINEDATA PolylineData ;

PolylineData = * ( ( pCONTAINERPOLYLINEDATA ) ( pContainerObjectData->pObjectData ) ) ;

wsprintf ( buffer,
TEXT("%s %s %d"),
TEXT("Polyline: "),
pszState,
PolylineData.nPointCount ) ;
}

break ;

// process the bezier object events
case CONTAINER_OBJECT_TYPE_BEZIER:
{
CONTAINERBEZIERDATA BezierData ;

BezierData = * ( ( pCONTAINERBEZIERDATA ) ( pContainerObjectData->pObjectData ) ) ;

wsprintf ( buffer,
TEXT("%s %s %f %f %f %f %f %f %f %f"),
TEXT("Bezier: "),
pszState,
BezierData.vptBezier[0].x,
BezierData.vptBezier[0].y,
BezierData.vptBezier[1].x,
BezierData.vptBezier[1].y,
BezierData.vptBezier[2].x,
BezierData.vptBezier[2].y,
BezierData.vptBezier[3].x,
BezierData.vptBezier[3].y ) ;
}

break ;

// process the arc object events
case CONTAINER_OBJECT_TYPE_ARC:
{
CONTAINERARCDATA ArcData ;

ArcData = * ( ( pCONTAINERARCDATA ) ( pContainerObjectData->pObjectData ) ) ;

wsprintf ( buffer,
TEXT("%s %s %lf %lf %lf %lf %lf"),
TEXT("Arc: "),
pszState,
ArcData.vptCenter.x,
ArcData.vptCenter.y,
ArcData.Radius,
ArcData.StartAngle,
ArcData.SweepAngle ) ;
}

break ;

// process the text object events
case CONTAINER_OBJECT_TYPE_TEXT:
{
CONTAINERTEXTDATA TextData ;

TextData = * ( ( pCONTAINERTEXTDATA ) ( pContainerObjectData->pObjectData ) ) ;

wsprintf ( buffer,
TEXT("%s %s %s %d %d %d %d"),
TEXT("Text: "),
pszState,
TextData.pszText,
TextData.rcText.left,
TextData.rcText.top,
TextData.rcText.right,
TextData.rcText.bottom ) ;
}

break ;
}

break ;
}
}

L_ContainerGetOwner ( pContainer, &hwndOwner ) ;

SetWindowText ( hwndOwner, buffer ) ;

return SUCCESS ;
}

2.

Add the following function call to the WndProc function, just before the CheckMenuRadioItem function call in the WM_CREATE message:

L_ContainerSetCallback ( pContainer, LeadContainerProc, NULL ) ;

3.

Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Editing a Container Object

Start with the project you created in Collecting container events:

1.

Add the following popup menu structure to the main menu you created in Implementing the Container - Initializing, Creating and Freeing:

Edit &Object

&Line with ID = IDM_EDITOBJECT_LINE
&Square with ID = IDM_EDITOBJECT_SQUARE
&Rect with ID = IDM_EDITOBJECT_RECT
&Circle with ID = IDM_EDITOBJECT_CIRCLE
&Ellipse with ID = IDM_EDITOBJECT_ELLIPSE
P&olyline with ID = IDM_EDITOBJECT_POLYLINE
&Bezier with ID = IDM_EDITOBJECT_BEZIER
&Arc with ID = IDM_EDITOBJECT_ARC
&Text with ID = IDM_EDITOBJECT_TEXT

2.

Add the following code to the WndProc function, just before the "return 0L ;" of the WM_CREATE message:

EnableMenuItem ( GetMenu ( hWnd ), 2, MF_BYPOSITION | MF_GRAYED ) ;

3.

Add the following lines to the WndProc function, after the EnableMenuItem function call in the "case IDM_FILE_OPEN" of the WM_COMMAND message:

EnableMenuItem ( GetMenu ( hWnd ), 2, MF_BYPOSITION | MF_ENABLED ) ;

4.

Add the following functions before the OnOpen function definition:

L_VOID OnEditObjectLine ( pCONTAINERHANDLE pContainer, pBITMAPHANDLE pBitmap )
{
CONTAINEROBJECTDATA Data ;
CONTAINERLINEDATA LineData ;

LineData.vptLine[0].x = ( BITMAPWIDTH ( pBitmap ) - 1 ) / 4 ;
LineData.vptLine[0].y = ( BITMAPHEIGHT ( pBitmap ) - 1 ) / 4 ;
LineData.vptLine[1].x = ( ( BITMAPWIDTH ( pBitmap ) - 1 ) * 3 ) / 4 ;
LineData.vptLine[1].y = ( ( BITMAPHEIGHT ( pBitmap ) - 1 ) * 3 ) / 4 ;

// set the container object data
Data.nSize = sizeof ( CONTAINEROBJECTDATA ) ;
Data.nObjectType = CONTAINER_OBJECT_TYPE_LINE ;
Data.pObjectData = &LineData ;

// start editing an object
// double click the left-mouse button to end editing
// click right-mouse button to abort editing
L_ContainerEditObject ( pContainer, &Data ) ;
}

L_VOID OnEditObjectSquare ( pCONTAINERHANDLE pContainer, pBITMAPHANDLE pBitmap )
{
CONTAINEROBJECTDATA Data ;
CONTAINERSQUAREDATA SquareData ;

SquareData.vptSquare[0].x = ( BITMAPWIDTH ( pBitmap ) - 1 ) / 4 ;
SquareData.vptSquare[0].y = ( BITMAPWIDTH ( pBitmap ) - 1 ) / 4 ;
SquareData.vptSquare[1].x = ( ( BITMAPWIDTH ( pBitmap ) - 1 ) * 3 ) / 4 ;
SquareData.vptSquare[1].y = ( ( BITMAPWIDTH ( pBitmap ) - 1 ) * 3 ) / 4 ;

// set the container object data
Data.nSize = sizeof ( CONTAINEROBJECTDATA ) ;
Data.nObjectType = CONTAINER_OBJECT_TYPE_SQUARE ;
Data.pObjectData = &SquareData ;

// start editing an object
// double click the left-mouse button to end editing
// click right-mouse button to abort editing
L_ContainerEditObject ( pContainer, &Data ) ;
}

L_VOID OnEditObjectRect ( pCONTAINERHANDLE pContainer, pBITMAPHANDLE pBitmap )
{
CONTAINEROBJECTDATA Data ;
CONTAINERRECTDATA RectData ;

RectData.vptRect[0].x = ( BITMAPWIDTH ( pBitmap ) - 1 ) / 4 ;
RectData.vptRect[0].y = ( BITMAPHEIGHT ( pBitmap ) - 1 ) / 4 ;
RectData.vptRect[1].x = ( ( BITMAPWIDTH ( pBitmap ) - 1 ) * 3 ) / 4 ;
RectData.vptRect[1].y = ( ( BITMAPHEIGHT ( pBitmap ) - 1 ) * 3 ) / 4 ;

// set the container object data
Data.nSize = sizeof ( CONTAINEROBJECTDATA ) ;
Data.nObjectType = CONTAINER_OBJECT_TYPE_RECT ;
Data.pObjectData = &RectData ;

// start editing an object
// double click the left-mouse button to end editing
// click right-mouse button to abort editing
L_ContainerEditObject ( pContainer, &Data ) ;
}

L_VOID OnEditObjectCircle ( pCONTAINERHANDLE pContainer, pBITMAPHANDLE pBitmap )
{
CONTAINEROBJECTDATA Data ;
CONTAINERCIRCLEDATA CircleData ;

CircleData.vptCircle[0].x = ( BITMAPWIDTH ( pBitmap ) - 1 ) / 4 ;
CircleData.vptCircle[0].y = ( BITMAPWIDTH ( pBitmap ) - 1 ) / 4 ;
CircleData.vptCircle[1].x = ( ( BITMAPWIDTH ( pBitmap ) - 1 ) * 3 ) / 4 ;
CircleData.vptCircle[1].y = ( ( BITMAPWIDTH ( pBitmap ) - 1 ) * 3 ) / 4 ;

// set the container object data
Data.nSize = sizeof ( CONTAINEROBJECTDATA ) ;
Data.nObjectType = CONTAINER_OBJECT_TYPE_CIRCLE ;
Data.pObjectData = &CircleData ;

// start editing an object
// double click the left-mouse button to end editing
// click right-mouse button to abort editing
L_ContainerEditObject ( pContainer, &Data ) ;
}

L_VOID OnEditObjectEllipse ( pCONTAINERHANDLE pContainer, pBITMAPHANDLE pBitmap )
{
CONTAINEROBJECTDATA Data ;
CONTAINERELLIPSEDATA EllipseData ;

EllipseData.vptEllipse[0].x = ( BITMAPWIDTH ( pBitmap ) - 1 ) / 4 ;
EllipseData.vptEllipse[0].y = ( BITMAPHEIGHT ( pBitmap ) - 1 ) / 4 ;
EllipseData.vptEllipse[1].x = ( ( BITMAPWIDTH ( pBitmap ) - 1 ) * 3 ) / 4 ;
EllipseData.vptEllipse[1].y = ( ( BITMAPHEIGHT ( pBitmap ) - 1 ) * 3 ) / 4 ;

// set the container object data
Data.nSize = sizeof ( CONTAINEROBJECTDATA ) ;
Data.nObjectType = CONTAINER_OBJECT_TYPE_ELLIPSE ;
Data.pObjectData = &EllipseData ;

// start editing an object
// double click the left-mouse button to end editing
// click right-mouse button to abort editing
L_ContainerEditObject ( pContainer, &Data ) ;
}

L_VOID OnEditObjectPolyline ( pCONTAINERHANDLE pContainer, pBITMAPHANDLE pBitmap )
{
CONTAINEROBJECTDATA Data ;
CONTAINERPOLYLINEDATA PolylineData ;
VECTORPOINT vptPolyline [ 4 ] ;

vptPolyline[0].x = ( BITMAPWIDTH ( pBitmap ) - 1 ) / 4 ;
vptPolyline[0].y = ( BITMAPHEIGHT ( pBitmap ) - 1 ) / 4 ;
vptPolyline[1].x = ( ( BITMAPWIDTH ( pBitmap ) - 1 ) * 3 ) / 4 ;
vptPolyline[1].y = ( BITMAPHEIGHT ( pBitmap ) - 1 ) / 4;
vptPolyline[2].x = ( ( BITMAPWIDTH ( pBitmap ) - 1 ) * 3 ) / 4 ;
vptPolyline[2].y = ( ( BITMAPHEIGHT ( pBitmap ) - 1 ) * 3 ) / 4 ;
vptPolyline[3].x = ( BITMAPWIDTH ( pBitmap ) - 1 ) / 4 ;
vptPolyline[3].y = ( ( BITMAPHEIGHT ( pBitmap ) - 1 ) * 3 ) / 4 ;

PolylineData.pvptPoints = vptPolyline ;
PolylineData.nPointCount = 4 ;

// set the container object data
Data.nSize = sizeof ( CONTAINEROBJECTDATA ) ;
Data.nObjectType = CONTAINER_OBJECT_TYPE_POLYLINE ;
Data.pObjectData = &PolylineData ;

// start editing an object
// double click the left-mouse button to end editing
// click right-mouse button to abort editing
L_ContainerEditObject ( pContainer, &Data ) ;
}

L_VOID OnEditObjectBezier ( pCONTAINERHANDLE pContainer, pBITMAPHANDLE pBitmap )
{
CONTAINEROBJECTDATA Data ;
CONTAINERBEZIERDATA BezierData ;

BezierData.vptBezier[0].x = ( BITMAPWIDTH ( pBitmap ) - 1 ) / 4 ;
BezierData.vptBezier[0].y = ( ( BITMAPHEIGHT ( pBitmap ) - 1 ) * 3 ) / 4;
BezierData.vptBezier[1].x = ( BITMAPWIDTH ( pBitmap ) - 1 ) / 2 ;
BezierData.vptBezier[1].y = ( BITMAPHEIGHT ( pBitmap ) - 1 ) / 4 ;
BezierData.vptBezier[2].x = ( BITMAPWIDTH ( pBitmap ) - 1 ) / 2 ;
BezierData.vptBezier[2].y = ( ( BITMAPHEIGHT ( pBitmap ) - 1 ) * 3 ) / 4;
BezierData.vptBezier[3].x = ( BITMAPWIDTH ( pBitmap ) - 1 ) / 4 ;
BezierData.vptBezier[3].y = ( BITMAPHEIGHT ( pBitmap ) - 1 ) / 4 ;

// set the container object data
Data.nSize = sizeof ( CONTAINEROBJECTDATA ) ;
Data.nObjectType = CONTAINER_OBJECT_TYPE_BEZIER ;
Data.pObjectData = &BezierData ;

// start editing an object
// double click the left-mouse button to end editing
// click right-mouse button to abort editing
L_ContainerEditObject ( pContainer, &Data ) ;
}

L_VOID OnEditObjectArc ( pCONTAINERHANDLE pContainer, pBITMAPHANDLE pBitmap )
{
CONTAINEROBJECTDATA Data ;
CONTAINERARCDATA ArcData ;

ArcData.vptCenter.x = ( BITMAPWIDTH ( pBitmap ) - 1 ) / 2 ;
ArcData.vptCenter.y = ( BITMAPHEIGHT ( pBitmap ) - 1 ) / 2 ;
ArcData.Radius = ( BITMAPWIDTH ( pBitmap ) - 1 ) / 4 ;
ArcData.StartAngle = 10 ;
ArcData.SweepAngle = 45 ;

// set the container object data
Data.nSize = sizeof ( CONTAINEROBJECTDATA ) ;
Data.nObjectType = CONTAINER_OBJECT_TYPE_ARC ;
Data.pObjectData = &ArcData ;

// start editing an object
// double click the left-mouse button to end editing
// click right-mouse button to abort editing
L_ContainerEditObject ( pContainer, &Data ) ;
}

L_VOID OnEditObjectText ( pCONTAINERHANDLE pContainer, pBITMAPHANDLE pBitmap )
{
CONTAINEROBJECTDATA Data ;
CONTAINERTEXTDATA TextData ;

TextData.pszText = TEXT("LEAD TECHNOLOGIES, INC.") ;
TextData.cbLength = lstrlen( TextData.pszText ) * sizeof (L_TCHAR);
SetRect ( &TextData.rcText,
( BITMAPWIDTH ( pBitmap ) - 1 ) / 4,
( BITMAPHEIGHT ( pBitmap ) - 1 ) / 4,
( ( BITMAPWIDTH ( pBitmap ) - 1 ) * 3 ) / 4,
( ( BITMAPHEIGHT ( pBitmap ) - 1 ) * 3 ) / 4 ) ;

// set the container object data
Data.nSize = sizeof ( CONTAINEROBJECTDATA ) ;
Data.nObjectType = CONTAINER_OBJECT_TYPE_TEXT ;
Data.pObjectData = &TextData ;

// start editing an object
// double click the left-mouse button to end editing
// click right-mouse button to abort editing
L_ContainerEditObject ( pContainer, &Data ) ;
}

5.

Add the following code to the WndProc function, after the statement "return 0L ;" of the case IDM_DRAWOBJECT_TEXT of the WM_COMMAND message:

case IDM_EDITOBJECT_LINE:
OnEditObjectLine ( pContainer, &hBitmap ) ;
return 0L ;

case IDM_EDITOBJECT_SQUARE:
OnEditObjectSquare ( pContainer, &hBitmap ) ;
return 0L ;

case IDM_EDITOBJECT_RECT:
OnEditObjectRect ( pContainer, &hBitmap ) ;
return 0L ;

case IDM_EDITOBJECT_CIRCLE:
OnEditObjectCircle ( pContainer, &hBitmap ) ;
return 0L ;

case IDM_EDITOBJECT_ELLIPSE:
OnEditObjectEllipse ( pContainer, &hBitmap ) ;
return 0L ;

case IDM_EDITOBJECT_POLYLINE:
OnEditObjectPolyline ( pContainer, &hBitmap ) ;
return 0L ;

case IDM_EDITOBJECT_BEZIER:
OnEditObjectBezier ( pContainer, &hBitmap ) ;
return 0L ;

case IDM_EDITOBJECT_ARC:
OnEditObjectArc ( pContainer, &hBitmap ) ;
return 0L ;

case IDM_EDITOBJECT_TEXT:
OnEditObjectText ( pContainer, &hBitmap ) ;
return 0L ;

6.

Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Implementing Automation - Implementing the Automated Edit Menu

Start with the project you created in implementing the vector automation

Take the following steps to implement an edit menu in the application:

1. | Select the File->New menu option. In the dialog box, select Resource Script and press Enter.
2. | Right click the script you just created. Select Insert and then Menu from the dialog box that appears and click OK.
3. | Create this Menu structure:

IDR_MENU1

&File
&Undo with ID = IDM_EDIT_UNDO
&Redo with ID = IDM_EDIT_REDO
Cu&t with ID = IDM_EDIT_CUT
&Copy with ID = IDM_EDIT_COPY
&Paste with ID = IDM_EDIT_PASTE
&Delete with ID = IDM_EDIT_DELETE
Select &All with ID = IDM_EDIT_SELECTALL
&Unselect All with ID = IDM_EDIT_UNSELECTALL
P&rint with ID = IDM_EDIT_PRINT
&Reset with ID = IDM_EDIT_RESET

4. | Select File->Save from the menu. Enter vecaut.rc in the Save As box and click Save.
5. | Select Insert->Files into Project, browse to the vecaut.rc file just created and click Add.
6. | Add the following line right under #include "c:\lead\include\ltaut.h".

#include "resource.h"

7.

Change the line

WndClass.lpszMenuName = NULL;

In the WinMain function to

WndClass.lpszMenuName = MAKEINTRESOURCE( IDR_MENU1 );

8.

Add the following lines of code right after the return 0L; statement of case WM_CREATE:

case WM_COMMAND:
switch( LOWORD( wParam ) )
{
case IDM_EDIT_UNDO:
L_AutUndo ( pAutomation, 0L );
InvalidateRect( hWnd, NULL, FALSE );
return 0L;

case IDM_EDIT_REDO:
L_AutUndo ( pAutomation, 0L );
InvalidateRect( hWnd, NULL, FALSE );
return 0L;

case IDM_EDIT_CUT:
L_AutCut ( pAutomation, 0L );
InvalidateRect( hWnd, NULL, FALSE );
return 0L;

case IDM_EDIT_COPY:
L_AutCopy ( pAutomation, 0L );
InvalidateRect( hWnd, NULL, FALSE );
return 0L;

case IDM_EDIT_PASTE:
L_AutPaste ( pAutomation, 0L );
InvalidateRect( hWnd, NULL, FALSE );
return 0L;

case IDM_EDIT_DELETE:
L_AutDelete ( pAutomation, 0L );
InvalidateRect( hWnd, NULL, FALSE );
return 0L;

case IDM_EDIT_SELECTALL:
L_AutSelect ( pAutomation, AUTOMATION_SELECT_ALL, 0L );
InvalidateRect( hWnd, NULL, FALSE );
return 0L;

case IDM_EDIT_UNSELECTALL:
L_AutSelect ( pAutomation, AUTOMATION_SELECT_NONE, 0L );
InvalidateRect( hWnd, NULL, FALSE );
return 0L;

case IDM_EDIT_PRINT:
L_AutPrint ( pAutomation, 0L );
return 0L;

case IDM_EDIT_RESET:
ResetView( hWnd, &Vector, pAutomation );
return 0L;

default:
break;
}
break;

8.

Compile and run the demo. You should be able to perform common operations found in most Windows programs on your vector image.


Using Printing Capabilities

Start with the project you created in Setting the Digital Painting Properties.

1.

Add the following item to he File popup menu you created in Implementing the Paint Automation Initializing, Creating and Freeing.

&Print with ID = IDM_FILE_PRINT

2.

Add the following code to the WndProc function before case IDM_FILE_EXIT and after the "return 0L ;" of the case IDM_FILE_OPEN in the WM_COMMAND message:

case IDM_FILE_PRINT:
L_AutPrint ( pAutomation, 0 ) ;
return 0L ;

3.

Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Implementing Automation - Implementing Vector Automation.

Start with the project you created in Initializing and loading a vector image

Take the following steps to create and initialize the automation objects:

1.

Add the following after #include "…\lvkrn.h". Note that you need to change the path to match what is on your system.

#include "f:\lead13\dist\include\ltpnt.h"
#include "f:\lead13\dist\include\lttlb.h"
#Include "f:\lead13\dist\include\ltcon.h"
#`include "f:\lead13\dist\include\ltaut.h"

2.

Change the ResetView function to the following:

static L_VOID ResetView( HWND hWnd, pVECTORHANDLE pVector, pAUTOMATIONHANDLE pAutomation )
{
VECTORPOINT Scale;
VECTORPOINT Rotation;
VECTORPOINT Translation;
POINT pt;

L_AutSetUndoEnabled ( pAutomation, FALSE );

Scale.x = Scale.y = Scale.z = 1.0;
L_VecSetScale ( pVector, &Scale, NULL, NULL, 0L );

Rotation.x = Rotation.y = Rotation.z = 0.0;
L_VecSetRotation ( pVector, &Rotation, NULL, NULL, 0L );

Translation.x = Translation.y = Translation.z = 0.0;
L_VecSetTranslation ( pVector, &Translation, NULL, 0L );

pt.x = 0;
pt.y = 0;

L_VecSetPan ( pVector, &pt );
L_VecSetParallelogram ( pVector, NULL, NULL );
L_VecSetOrigin ( pVector, NULL );
L_VecSetCamera ( pVector, NULL );

L_AutSetUndoEnabled ( pAutomation, TRUE );

InvalidateRect( hWnd, NULL, FALSE );
}

3.

Add this new local function before the WndProc function:

static L_INT EXT_CALLBACK ContainerCallback( pCONTAINERHANDLE pContainer, CONTAINEREVENTTYPE nEventType, L_VOID *pEventData, L_VOID *pUserData )
{
HWND hWnd;
pCONTAINEROBJECTDATA pObjectData;

switch( nEventType )
{
case CONTAINER_EVENT_TYPE_DRAW:
pObjectData = (pCONTAINEROBJECTDATA) pEventData;
if( pObjectData->fState == CONTAINER_STATE_END || pObjectData->fState == CONTAINER_STATE_ABORT )
{
L_ContainerGetOwner ( pContainer, &hWnd );
InvalidateRect( hWnd, NULL, FALSE );
}
break;
}

return SUCCESS;
}

4.

Add the following local variables to the WndProc function, right after the HDC hDC; statement:

static pAUTOMATIONHANDLE pAutomation;
static pCONTAINERHANDLE pContainer;
static pTOOLBARHANDLE pToolbar;
CONTAINERMETRICS ContainerMetrics;

5.

Add the following lines right after the L_VecAttachToWindow function call in WM_CREATE of WndProc:

// create the automation handle
L_AutInit( &pAutomation );
L_AutCreate ( pAutomation, AUTOMATION_MODE_VECTOR, 0L );

// create the toolbar
L_TBInit ( &pToolbar );
L_TBCreate ( pToolbar, hWnd, TEXT("Vector"), TOOLBAR_VECTOR );
L_TBSetVisible ( pToolbar, TRUE );

// add it to the automation object
L_AutSetToolbar ( pAutomation, pToolbar );

// create the container
L_ContainerInit ( &pContainer );
L_ContainerCreate ( pContainer, hWnd );

// set its callback
L_ContainerSetCallback ( pContainer, ContainerCallback, NULL );

// add it to the automation object
L_AutAddContainer ( pAutomation, pContainer, &Vector );

// set it as the active container
L_AutSetActiveContainer ( pAutomation, pContainer );

6.

Change the ResetView function call just before the return 0; statement in WM_CREATE to:

ResetView( hWnd, &Vector, pAutomation );

7.

Add the following lines right after the L_VecSetViewport function call in WM_SIZE:

// set container limits to all client area
ContainerMetrics.nSize = sizeof( CONTAINERMETRICS );
ContainerMetrics.dwMask = CMF_LIMITS;
CopyRect( &ContainerMetrics.rcLimits, &Rect );
L_ContainerSetMetrics ( pContainer, &ContainerMetrics );

8.

Add these lines to the WM_DESTROY message, before the call to L_VecFree :

// destroy container
L_AutRemoveContainer ( pAutomation, pContainer );
L_ContainerFree ( pContainer );

// destroy automation
L_AutFree ( pAutomation );

// destroy toolbar
L_TBFree ( pToolbar );

9. | Select Insert->Files into Project from the menu. In the dialog box that appears, browse to c:\lead\lib\lttlb_n.lib, select it and click Add. Please note that c:\lead\ represents the location of the LEADTOOLS toolkit on your system.
10. | Select Insert->Files into Project from the menu. In the dialog box that appears, browse to c:\lead\lib\ltcon_n.lib, select it and click Add.
11. | Select Insert->Files into Project from the menu. In the dialog box that appears, browse to c:\lead\lib\ltaut_n.lib, select it and click Add.
12. | Compile and run the demo. You should be able to draw new vector objects and rotate in 3D, using your mouse and the pan feature.


Implementing Automation - Initializing and Loading a Vector Image

Take the following steps to create a project and add code that will create a new container handle:

1. | Start Visual C++, version 4.2.
2. | Select the File->New menu option, and in the dialog box, select Project Workspace.
3. | In the New Project Workspace dialog box, enter the location (c:\lead\examples\vecaut) and make sure to select Application (Win32 Application) as the project type. Give the project the name "tutorial" and press Enter.
4. | Select the File->New menu option, and in the dialog box, select Text File and press Enter.
5. | Copy and paste the following code into the text file you have just created. This code will do the basic job of loading and painting the bitmap. Note that the include statements will have to be modified to match the location of the LEADTOOLS toolkit on your system.

#include <windows.h>
#include "c:\lead14\dll\include\l_bitmap.h"
#include "c:\lead14\dll\include\lvkrn.h"

static L_VOID ResetView( HWND hWnd, pVECTORHANDLE pVector )
{
VECTORPOINT Scale;
VECTORPOINT Rotation;
VECTORPOINT Translation;
POINT       pt;

Scale.x = Scale.y = Scale.z = 1.0;
L_VecSetScale ( pVector, &Scale, NULL, NULL, 0L );

Rotation.x = Rotation.y = Rotation.z = 0.0;
L_VecSetRotation
 ( pVector, &Rotation, NULL, NULL, 0L );

Translation.x = Translation.y = Translation.z = 0.0;
L_VecSetTranslation
 ( pVector, &Translation, NULL, 0L );

pt.x = 0;
pt.y = 0;

L_VecSetPan ( pVector, &pt );
L_VecSetParallelogram ( pVector, NULL, NULL );
L_VecSetOrigin ( pVector, NULL );
L_VecSetCamera ( pVector, NULL );

InvalidateRect( hWnd, NULL, FALSE );
}

static LRESULT WINAPI WndProc( HWND hWnd, L_UINT uMessage, WPARAM wParam, LPARAM lParam )
{
static VECTORHANDLE
 Vector;  // our vector handle
RECT Rect;
PAINTSTRUCT PaintStruct;
HDC hDC;

switch( uMessage )
{
case WM_CREATE:
// initiates the vector handle and load it
L_VecInit
 ( &Vector );
//note that LEAD represents the location of the LEADTOOLS
//toolkit on your system
L_VecLoadFile ( TEXT("c:\\LEAD\\test.dxf"), &Vector, NULL, NULL );

// set wireframe mode
L_VecSetPolygonMode
 ( &Vector, VECTOR_POLYGON_LINE );

// attach it to the main window
L_VecAttachToWindow ( hWnd, &Vector, VECTOR_ENGINE_GDI, VECTOR_ENGINE_DOUBLEBUFFER );

// set default view
ResetView( hWnd, &Vector );
return 0L;

case WM_SIZE:
// set the vector viewport to all client area
GetClientRect( hWnd, &Rect );
L_VecSetViewport ( &Vector, &Rect );
return 0L;

case WM_PAINT:
// draw the vector
hDC = BeginPaint( hWnd, &PaintStruct );
L_VecPaint ( hDC, &Vector, TRUE );
EndPaint( hWnd, &PaintStruct );
return 0L;

case WM_DESTROY:
// free the vector handle
L_VecFree ( &Vector );
PostQuitMessage( 0 );
return 0L;

default:
break;
}

return DefWindowProc( hWnd, uMessage, wParam, lParam );
}

L_INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR pCmdLine, L_INT nCmdShow )
{
const L_TCHAR szClassName[] = TEXT("lead_vector_tutorial");
WNDCLASSEX WndClass;
HWND hWnd;
MSG Msg;

UNREFERENCED_PARAMETER( hInstPrev );
UNREFERENCED_PARAMETER( pCmdLine );

// unlock vector support
L_UnlockSupport ( L_SUPPORT_VECTOR, L_KEY_VECTOR );

WndClass.cbSize = sizeof( WNDCLASSEX );
WndClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
WndClass.lpfnWndProc = WndProc;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hInstance = hInst;
WndClass.hIcon = LoadIcon( NULL, IDI_APPLICATION );
WndClass.hCursor = LoadCursor( NULL, IDC_ARROW );
WndClass.hbrBackground = NULL;
WndClass.lpszMenuName = NULL;
WndClass.lpszClassName = szClassName;
WndClass.hIconSm = NULL;

RegisterClassEx( &WndClass );

hWnd = CreateWindowEx( 0L, szClassName, TEXT("Vector Automation Tutorial"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
NULL, NULL, hInst, NULL );

ShowWindow( hWnd, nCmdShow );
UpdateWindow( hWnd );

while( GetMessage( &Msg, NULL, 0, 0 ) != 0 )
{
TranslateMessage( &Msg );
DispatchMessage( &Msg );
}

UnregisterClass( szClassName, hInst );

return Msg.wParam;
}

6. | Select File->Save from the menu and give the text file the name "vecaut.c".
7. | Select Insert->Files into Project from the menu. In the dialog box that appears, browse to vecaut.c you have just created, select it and click Add.
8. | Select Insert->Files into Project from the menu. In the dialog box that appears, browse to c:\lead\lib\ltkrn_n.lib, select it and click Add.
9. | Select Insert->Files into Project from the menu. In the dialog box that appears, browse to c:\lead\lib\ltfil_n.lib, select it and click Add.
10. | Select Insert->Files into Project from the menu. In the dialog box that appears, browse to c:\lead\lib\lvkrn_n.lib, select it and click Add.
11. | Compile and run the project by selecting Build->Execute vectut.exe from the menu.
12. | The program should display a vector image by the vector handle.


Implementing the Paint Automation - Initializing, Creating and Freeing

Take the following steps to implement paint automation:

1. | Start Visual C++, version 4.2.
2. | Select the File->New menu option, and in the dialog box, select Project Workspace.
3. | In the New Project Workspace dialog box, enter the location (c:\lead\examples\paintauto) (NOTE: Since the Implementing Containers – Initializing, Creating and Freeing uses this same project location, this needs to be a different location.), make sure to select Application (Win32 Application) as the project type,. Give the project the name "tutorial" and press Enter.
4. | Select File->New menu option, and in the dialog box, select Resource Script and press Enter.
5. | Right click the script you just created and select Insert and then Menu from the dialog box that will appear and click OK.
6. | Create this Menu structure:

IDR_MENU1
&File
&Open… with ID = IDM_FILE_OPEN
E&xit with ID = IDM_FILE_EXIT

7. | Select File->Save from the menu, enter Tutorial.rc in the Save As box and click Save.
8. | Select Insert->Files into Project, browse to the Tutorial.rc file we have just created and click Add.
9. | Select File->New menu option, and in the dialog box, select Text File and press Enter.
10. | Copy and paste the following code into the text file you have just created. This code will do the basic job of loading and painting the bitmap.

#include <windows.h>
#include "c:\lead13\dll\include\l_bitmap.h"
#include "resource.h"

static L_VOID OnSize
(
HWND hWnd,
pBITMAPHANDLE pBitmap,
LPRECT prcView,
L_INT cx,
L_INT cy,
L_INT nScalarNum,
L_INT nScalarDen,
L_INT *pnHScroll,
L_INT *pnVScroll
)
{
SCROLLINFO si ;
L_INT nXOffset, nYOffset ;

if ( NULL != pBitmap && pBitmap->Flags.Allocated )
{
si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_ALL ;

// vertical scroll.
GetScrollInfo ( hWnd, SB_VERT, &si ) ;
si.nMin = 0 ;
si.nMax = BITMAPHEIGHT ( pBitmap ) ;
si.nPage = MulDiv ( cy, nScalarDen, nScalarNum ) ;

SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;

GetScrollInfo ( hWnd, SB_VERT, &si ) ;

*pnVScroll = si.nPos ;

// horizontal scroll
GetScrollInfo ( hWnd, SB_HORZ, &si ) ;
si.nMin = 0 ;
si.nMax = BITMAPWIDTH ( pBitmap ) ;
si.nPage = MulDiv ( cx, nScalarDen, nScalarNum ) ;

SetScrollInfo ( hWnd, SB_HORZ, &si, TRUE ) ;

GetScrollInfo ( hWnd, SB_HORZ, &si ) ;

*pnHScroll = si.nPos ;
}
else
{
si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_RANGE ;
si.nMin = 0 ;
si.nMax = 0 ;

SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;
SetScrollInfo ( hWnd, SB_HORZ, &si, TRUE ) ;

*pnHScroll = 0 ;
*pnVScroll = 0 ;
}

// set the painting rectangle.
SetRect ( prcView, 0, 0, BITMAPWIDTH ( pBitmap ), BITMAPHEIGHT ( pBitmap ) ) ;

if ( nScalarDen > nScalarNum )
{
nXOffset = MulDiv ( *pnHScroll, nScalarDen, nScalarNum ) ;
nYOffset = MulDiv ( *pnVScroll, nScalarDen, nScalarNum ) ;
}
else
{
nXOffset = *pnHScroll ;
nYOffset = *pnVScroll ;
}

OffsetRect ( prcView, - nXOffset, - nYOffset ) ;

prcView->left = MulDiv ( prcView->left, nScalarNum, nScalarDen ) ;
prcView->top = MulDiv ( prcView->top, nScalarNum, nScalarDen ) ;
prcView->right = MulDiv ( prcView->right, nScalarNum, nScalarDen ) ;
prcView->bottom = MulDiv ( prcView->bottom, nScalarNum, nScalarDen ) ;
}

L_VOID OnHScroll
(
HWND hWnd,
L_UINT code,
L_INT nScalarNum,
L_INT nScalarDen,
LPRECT prcView,
L_INT *pnHScroll,
L_INT *pnVScroll
)
{
SCROLLINFO si ;

si.cbSize = sizeof (SCROLLINFO) ;
si.fMask = SIF_ALL ;
GetScrollInfo (hWnd, SB_HORZ, &si) ;

*pnHScroll = si.nPos ;

switch ( code )
{
case SB_LINELEFT:
si.nPos -= 1 ;
break ;

case SB_LINERIGHT:
si.nPos += 1 ;
break ;

case SB_PAGELEFT:
si.nPos -= si.nPage ;
break ;

case SB_PAGERIGHT:
si.nPos += si.nPage ;
break ;

case SB_THUMBTRACK:
si.nPos = si.nTrackPos ;
break ;

default:
break ;
}

si.fMask = SIF_POS ; 7
SetScrollInfo (hWnd, SB_HORZ, &si, TRUE) ;
GetScrollInfo (hWnd, SB_HORZ, &si) ;

if ( si.nPos != *pnHScroll )
{
L_INT dxUpdate ;

// update screen.
if ( nScalarDen < nScalarNum )
{
dxUpdate = MulDiv ( ( *pnHScroll - si.nPos ), nScalarNum, nScalarDen ) ;
}
else
{
dxUpdate = *pnHScroll - si.nPos ;
}

// update screen.
OffsetRect ( prcView, dxUpdate, 0 ) ;

ScrollWindow ( hWnd, dxUpdate, 0, NULL, NULL ) ;

*pnHScroll = si.nPos ;

UpdateWindow ( hWnd ) ;
}
}

L_VOID OnVScroll
(
HWND hWnd,
L_UINT code,
L_INT nScalarNum,
L_INT nScalarDen,
LPRECT prcView,
L_INT *pnHScroll,
L_INT *pnVScroll
)
{
SCROLLINFO si ;

si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_ALL ;
GetScrollInfo (hWnd, SB_VERT, &si) ;

*pnVScroll = si.nPos ;

switch ( code )
{
case SB_LINEUP:
si.nPos -= 1 ;
break ;

case SB_LINEDOWN:
si.nPos += 1 ;
break ;

case SB_PAGEUP:
si.nPos -= si.nPage ;
break ;

case SB_PAGEDOWN:
si.nPos += si.nPage ;
break ;

case SB_THUMBTRACK:
si.nPos = si.nTrackPos ;
break ;

default:
break ;
}

si.fMask = SIF_POS ;
SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;
GetScrollInfo ( hWnd, SB_VERT, &si ) ;

if ( si.nPos != *pnVScroll )
{
L_INT dyUpdate ;

// update screen.
if ( nScalarDen < nScalarNum )
{
dyUpdate = MulDiv ( ( *pnVScroll - si.nPos ), nScalarNum, nScalarDen ) ;
}
else
{
dyUpdate = *pnVScroll - si.nPos ;
}

// update screen.
OffsetRect ( prcView, 0, dyUpdate ) ;

ScrollWindow ( hWnd, 0, dyUpdate, NULL, NULL ) ;

*pnVScroll = si.nPos ;

UpdateWindow ( hWnd ) ;
}
}

L_VOID OnPaint
(
HWND hWnd,
pBITMAPHANDLE pBitmap,
LPRECT prcView,
HPALETTE hPalette
)
{
HDC hDC ;
PAINTSTRUCT ps ;
HPALETTE hOldPal ;

hDC = BeginPaint (hWnd, &ps) ;

if ( pBitmap->Flags.Allocated )
{
if ( hPalette )
{
hOldPal = SelectPalette ( hDC, hPalette, TRUE ) ;
RealizePalette ( hDC ) ;
}

L_PaintDC ( hDC, pBitmap, NULL, NULL, prcView, &ps.rcPaint, SRCCOPY ) ;

if ( NULL != hOldPal )
{
SelectPalette ( hDC, hOldPal, TRUE ) ;
}
}

EndPaint (hWnd, &ps) ;
}

static L_BOOL OnOpen ( HWND hWnd, pBITMAPHANDLE pBitmap )
{
static L_INT nOpenIndex = 0 ;
OPENFILENAME OpenFileName ;
L_TCHAR szFile [ MAX_PATH ] = TEXT("\0") ;
L_TCHAR szFileTitle [ MAX_PATH ] = TEXT("\0") ;
L_TCHAR szOpenFileFilter [ ] = {TEXT("ALL\0")TEXT("*.*\0")} ;
FILEOPENPARM FileOpenParams ;
FILEINFO FileInfo ;
L_UINT32 uFlags ;
BITMAPHANDLE hThumb ;

memset ( &FileOpenParams, 0, sizeof ( FILEOPENPARM ) ) ;

lstrcpy ( szFile, TEXT("") ) ;

L_InitBitmap ( pBitmap, 0, 0, 0 ) ;

L_InitBitmap ( &hThumb, 0, 0, 0 ) ;

OpenFileName.lStructSize = sizeof(OPENFILENAME);
OpenFileName.hwndOwner = hWnd;
OpenFileName.lpstrFilter = szOpenFileFilter;
OpenFileName.lpstrCustomFilter = NULL;
OpenFileName.nMaxCustFilter = 0;
OpenFileName.nFilterIndex = nOpenIndex;
OpenFileName.nMaxFile = sizeof(szFile);
OpenFileName.lpstrFile = szFile;
OpenFileName.nMaxFileTitle = sizeof(szFileTitle);
OpenFileName.lpstrFileTitle = szFileTitle;
OpenFileName.lpstrInitialDir = NULL;
OpenFileName.lpstrTitle = "Open a File";
OpenFileName.nFileOffset = 0;
OpenFileName.nFileExtension = 0;
OpenFileName.lpstrDefExt = NULL;
OpenFileName.lpfnHook = NULL;
OpenFileName.Flags = OFN_LONGNAMES ;

uFlags = DLG_FO_AUTOPROCESS |
DLG_FO_FILEINFO |
DLG_FO_SHOWPREVIEW |
DLG_FO_95STYLE ;

FileOpenParams.pBitmap = pBitmap ;
FileOpenParams.pThumbnail = &hThumb ;
FileOpenParams.bPreviewEnabled = TRUE ;
FileOpenParams.pFileInfo = &FileInfo ;

if ( L_DlgFileOpen ( hWnd, &OpenFileName, &FileOpenParams, uFlags, NULL, NULL ) == SUCCESS )
{
nOpenIndex = OpenFileName.nFilterIndex;

L_FreeBitmap ( &hThumb ) ;

L_ChangeBitmapViewPerspective ( NULL, pBitmap, TOP_LEFT );

return TRUE ;
}
else
{
return FALSE ;
}
}

static LRESULT WINAPI WndProc ( HWND hWnd, L_UINT uMessage, WPARAM wParam, LPARAM lParam )
{
static BITMAPHANDLE hBitmap ;
static RECT rcView ;
static HPALETTE hPalette = NULL ;
static L_INT nVScroll = 0 ;
static L_INT nHScroll = 0 ;
static L_INT nScalarNum = 1,
nScalarDen = 1 ;

switch( uMessage )
{
case WM_CREATE:
return 0L ;

case WM_DESTROY:
if ( hBitmap.Flags.Allocated )
{
L_FreeBitmap ( &hBitmap ) ;
}

if ( hPalette )
{
DeletePalette ( hPalette ) ;
}

PostQuitMessage ( 0 ) ;

return 0L ;

case WM_SIZE:
OnSize ( hWnd,
&hBitmap,
&rcView,
LOWORD ( lParam ),
HIWORD ( lParam ),
nScalarNum,
nScalarDen,
&nHScroll,
&nVScroll ) ;
break ;

case WM_HSCROLL:
OnHScroll ( hWnd,
LOWORD ( wParam ),
nScalarNum,
nScalarDen,
&rcView,
&nHScroll,
&nVScroll ) ;
break ;

case WM_VSCROLL:
OnVScroll ( hWnd,
LOWORD ( wParam ),
nScalarNum,
nScalarDen,
&rcView,
&nHScroll,
&nVScroll ) ;

break ;

case WM_PAINT:
OnPaint ( hWnd, &hBitmap, &rcView, hPalette ) ;
break ;

case WM_COMMAND:
switch( LOWORD( wParam ) )
{
case IDM_FILE_OPEN:
{
BITMAPHANDLE hTempBitmap ;
HDC hDC ;

if ( OnOpen ( hWnd, &hTempBitmap ) )
{
if ( hBitmap.Flags.Allocated )
{
L_FreeBitmap ( &hBitmap ) ;
}

if ( hPalette )
{
DeletePalette ( hPalette ) ;
}

nScalarNum = 1 ;
nScalarDen = 1 ;

L_CopyBitmapHandle ( &hBitmap, &hTempBitmap ) ;

hDC = GetDC ( hWnd ) ;

hPalette = L_CreatePaintPalette ( hDC, &hBitmap ) ;

ReleaseDC ( hWnd, hDC ) ;

{//ADJUST WINDOW SIZE

RECT rcWindow ;
L_INT nWidth, nHeight ;

SystemParametersInfo ( SPI_GETWORKAREA, 0, &rcWindow, 0 ) ;

nWidth = min ( MulDiv ( BITMAPWIDTH ( &hBitmap ), nScalarNum, nScalarDen ),
( rcWindow.right - rcWindow.left ) ) ;

nHeight = min ( MulDiv ( BITMAPHEIGHT ( &hBitmap ), nScalarNum, nScalarDen ),
( rcWindow.bottom - rcWindow.top ) ) ;

MoveWindow ( hWnd,
0,
0,
nWidth,
nHeight,
TRUE ) ;

}//ADJUST WINDOW SIZE

InvalidateRect ( hWnd, NULL, TRUE ) ;
}
}

return 0L ;

case IDM_FILE_EXIT:
PostMessage ( hWnd, WM_CLOSE, 0, 0 ) ;
return 0L ;
}

break ;
}

return DefWindowProc ( hWnd, uMessage, wParam, lParam ) ;
}

L_INT WINAPI WinMain ( HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR pCmdLine, L_INT nCmdShow )
{
const L_TCHAR szClassName [ ] = TEXT("lead_paint_automation_tutorial") ;
WNDCLASSEX WndClass ;
HWND hWnd ;
MSG Msg ;

UNREFERENCED_PARAMETER ( hInstPrev ) ;
UNREFERENCED_PARAMETER ( pCmdLine ) ;

// unlock lead file formats support
UNLOCKSUPPORT ( ) ;

WndClass.cbSize = sizeof ( WNDCLASSEX ) ;
WndClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ;
WndClass.lpfnWndProc = WndProc ;
WndClass.cbClsExtra = 0 ;
WndClass.cbWndExtra = 0 ;
WndClass.hInstance = hInst ;
WndClass.hIcon = LoadIcon ( NULL, IDI_APPLICATION ) ;
WndClass.hCursor = LoadCursor ( NULL, IDC_ARROW ) ;
WndClass.hbrBackground = ( HBRUSH ) ( COLOR_WINDOW + 1 ) ;
WndClass.lpszMenuName = MAKEINTRESOURCE ( IDR_MENU1 ) ;
WndClass.lpszClassName = szClassName ;
WndClass.hIconSm = NULL ;

RegisterClassEx ( &WndClass ) ;

hWnd = CreateWindowEx ( 0L,
szClassName,
TEXT("Paint Automation Tutorial"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
NULL,
NULL,
hInst,
NULL ) ;
ShowWindow ( hWnd, nCmdShow ) ;
UpdateWindow ( hWnd ) ;

while ( GetMessage ( &Msg, NULL, 0, 0 ) != 0 )
{
TranslateMessage ( &Msg ) ;
DispatchMessage ( &Msg ) ;
}

UnregisterClass ( szClassName, hInst ) ;

return Msg.wParam ;
}

11. | Select File->Save from the menu and give the text file the name "auttut.c"
12. | Select Insert->Files into Project from the menu. In the dialog box that will appear, browse to auttut.c you have just created, select it and click Add.
13. | Select Insert->Files into Project from the menu. In the dialog box that will appear, browse to c:\lead\lib\ltkrn_n.lib, select it and click Add.
14. | Select Insert->Files into Project from the menu. In the dialog box that will appear, browse to c:\lead\lib\ltdis_n.lib, select it and click Add.
15. | Select Insert->Files into Project from the menu. In the dialog box that will appear, browse to c:\lead\lib\ltdlg_n.lib, select it and click Add.
16. | Add the following include statements:

#include "c:\lead13\dll\include\ltcon.h"
#include "c:\lead13\dll\include\lttlb.h"
#include "c:\lead13\dll\include\ltpnt.h"
#include "c:\lead13\dll\include\ltaut.h"

17.

Add the following declaration to the WndProc function:

static pAUTOMATIONHANDLE pAutomation ;

18.

Replace the line "return 0L ;" after the statement "case WM_CREATE:" in the WndProc function with the following code:

if ( SUCCESS == L_AutInit ( &pAutomation ) )
{
// create the paint automation
if ( SUCCESS != L_AutCreate ( pAutomation, AUTOMATION_MODE_PAINT, 0 ) )
{
MessageBox ( hWnd, TEXT("Error creating Paint Automation"), TEXT("Error:"), MB_ICONSTOP );

L_AutFree (pAutomation ) ;

return -1 ;
}

return 0L ;
}
else
{
return -1L ;
}

19.

Add the following lines to the WndProc function before the statement "PostQuitMessage" in the "case WM_DESTROY:"

if ( SUCCESS == L_AutIsValid ( pAutomation ) )
{
L_AutFree ( pAutomation ) ;
}

20. | Select Insert->Files into Project from the menu. In the dialog box that will appear, browse to c:\lead\lib\ltaut_n.lib, select it and click Add.
21. | Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


The Automation and the Container

Start with the project you created in Implementing the Paint Automation Initializing, Creating and Freeing.

1.

Add the following declaration to the WndProc function:

static pCONTAINERHANDLE pContainer ;

2.

Add the following code to the WndProc function after the ReleaseDC statement in the IDM_FILE_OPEN of the WM_COMMAND message:

{//AUTOMATION CONTAINER STUFF
CONTAINERPAINTDATA PaintData ;

{//REMOVE THE OLD CONTAINER (IF ANY)

if ( SUCCESS == L_ContainerIsValid ( pContainer ) )
{
L_AutRemoveContainer ( pAutomation, pContainer ) ;

L_ContainerFree ( pContainer ) ;
}

}//REMOVE THE OLD CONTAINER (IF ANY)

PaintData.pBitmap = &hBitmap ;
PaintData.hRestrictionPalette = hPalette ;

L_ContainerInit ( &pContainer ) ;

L_ContainerCreate ( pContainer, hWnd ) ;

L_AutAddContainer ( pAutomation, pContainer, &PaintData ) ;

}//AUTOMATION CONTAINER STUFF

3.

Add the following code before the "L_AutFree" function call in the WndProc function in the WM_DESTROY message:

if ( SUCCESS == L_ContainerIsValid ( pContainer ) )
{
L_AutRemoveContainer ( pAutomation, pContainer ) ;

L_ContainerFree ( pContainer ) ;
}

4.

Add the following declaration to the WndProc function:

VECTORPOINT vptScalarNum, vptScalarDen ;

5.

Add the following lines before the OnSize function call in the "case WM_SIZE:" in the WndProc function:

if ( SUCCESS == L_ContainerIsValid ( pContainer ) )
{
L_ContainerGetScalar ( pContainer, &vptScalarNum, &vptScalarDen ) ;

nScalarNum = ( L_INT ) vptScalarNum.x ;
nScalarDen = ( L_INT ) vptScalarDen.x ;
}

6.

Add the following container function call after the OnSize function call in the "case WM_SIZE:" in the WndProc function:

L_ContainerSetOffset ( pContainer, - rcView.left, - rcView.top, 0 ) ;

7.

Add the following container function call after the OnHScroll function call in the "case WM_HSCROLL:" in the WndProc function:

L_ContainerSetOffset ( pContainer, - rcView.left, - rcView.top, 0 ) ;

8.

Add the following container function call after the OnVScroll function call in the "case WM_VSCROLL:" in the WndProc function:

L_ContainerSetOffset ( pContainer, - rcView.left, - rcView.top, 0 ) ;

9. | Select Insert->Files into Project from the menu. In the dialog box that will appear, browse to c:\lead\lib\ltcon_n.lib, select it and click Add.
10. | Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Working with the Paint Automation Toolbar

Start with the project you created in The Automation and the Container.

1.

Add the following declaration to the WndProc function:

static pTOOLBARHANDLE pToolbar ;

2.

Add the following code to the WndProc function before the "return 0L ;" statement in the WM_CREATE message:

{// INITIATE THE TOOLBAR
if ( SUCCESS == L_TBInit ( &pToolbar ) )
{
L_BOOL fTBVisible ;
POINT pt = { 0, 0 } ;
RECT rcClient ;

GetClientRect ( hWnd, &rcClient ) ;

pt.x = rcClient.left ;
pt.y = rcClient.top ;

ClientToScreen ( hWnd, &pt ) ;

L_TBCreate ( pToolbar,
hWnd,
TEXT("Paint Automation"),
TOOLBAR_PAINT ) ;

L_TBSetPosition ( pToolbar,
&pt,
TOOLBAR_POSITION_TOP | TOOLBAR_POSITION_LEFT ) ;

L_TBIsVisible ( pToolbar, &fTBVisible ) ;

if ( ! fTBVisible )
{
L_TBSetVisible ( pToolbar, TRUE ) ;
}
}
else
{
return FAILURE ;
}

L_AutSetToolbar ( pAutomation, pToolbar ) ;

}// INITIATE THE TOOLBAR

3.

Add the following code to the WndProc function after the "L_AutFree" function call in the WM_DESTROY message:

{//DELETE THE TOOLBAR

if (L_TBIsValid ( pToolbar ) )
{
L_TBFree ( pToolbar ) ;
}

}//DELETE THE TOOLBAR

4. | Select Insert->Files into Project from the menu. In the dialog box that will appear, browse to c:\lead\lib\lttlb_n.lib, select it and click Add.
5. | Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Using the Undoing/Redoing Capabilities

Start with the project you created in Dealing with the Paint Automation Toolbar.

1.

Add the following menu structure to the main menu you created in Implementing the Paint Automation Initializing, Creating and Freeing

&Edit
&Undo with ID = IDM_EDIT_UNDO
&Redo with ID = IDM_EDIT_REDO

2.

Add the following declaration to the WndProc function:

L_BOOL fState ;

3.

Add the following lines to the WndProc function after the "return 0L ;" of the case IDM_FILE_EXIT in WM_COMMAND message:

case IDM_EDIT_UNDO:

L_AutCanUndo ( pAutomation, &fState ) ;

if ( fState )
{
L_AutUndo ( pAutomation, 0 ) ;
}

return 0L ;

case IDM_EDIT_REDO:

L_AutCanRedo ( pAutomation, &fState ) ;

if ( fState )
{
L_AutRedo ( pAutomation, 0 ) ;
}

return 0L ;

4.

Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Using the Automation Editing Capabilities

Start with the project you created in Using the Undoing/Redoing capabilities.

1.

Add the following menu structure to the Edit popup menu you created in Using the Undoing/Redoing Capabilities after the &Redo item:

Cu&t with ID = IDM_EDIT_CUT
&Copy with ID = IDM_EDIT_COPY
&Paste with ID = IDM_EDIT_PASTE
&Delet with ID = IDM_EDIT_DELETE

2.

Add the following lines to the WndProc after the statement "return 0L ;" of the case IDM_EDIT_REDO in the WM_COMMAND message:

case IDM_EDIT_CUT:
// Cut the current selection to the clipboard
L_AutCut ( pAutomation, 0 ) ;

return 0L ;

case IDM_EDIT_COPY:
// Copy the current selection to the clipboard
L_AutCopy ( pAutomation, 0 ) ;

return 0L ;

case IDM_EDIT_PASTE:
//check if there is a valid automation mode data on the clipboard
L_AutClipboardDataReady ( pAutomation, &fState ) ;

if ( fState )
{
// paste the data to the current active container
L_AutPaste ( pAutomation, 0 ) ;
}

return 0L ;

case IDM_EDIT_DELETE:
// Delete the current selection
L_AutDelete ( pAutomation, 0 ) ;

return 0L ;

3.

Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Setting the Digital Painting Properties

Start with the project you created in Using the Automation Editing Capabilities.

1.

Add the following popup menu structure to the main menu you created in Implementing the Paint Automation Initializing, Creating and Freeing.

&Properties

&Shape with ID = IDM_PROPERTIES_SHAPE

2.

Add the following include statement before the #include "resource.h" statement:

#include "c:\lead13\dll\include\ltpdg.h"

3.

Add the following function definition before the OnOpen function definition:

static L_VOID OnShapeProperties(HWND hWnd, pAUTOMATIONHANDLE pAutomation )
{
PAINTSHAPE shape ;
PAINTDLGSHAPEINFO ShapeDlgInfo ;
L_INT nRet ;

L_AutGetPaintProperty ( pAutomation, PAINT_GROUP_SHAPE, &shape ) ;

ShapeDlgInfo.dwFlags = PAINT_DLG_SHAPE_SHOWALL ;
ShapeDlgInfo.pszTitle = TEXT("Shape Properties") ;
ShapeDlgInfo.nBackgroundStyle = shape.nBackgroundStyle ;
ShapeDlgInfo.crBackgroundColor = shape.crBackgroundColor ;
ShapeDlgInfo.ppszBackgroundTileBitmap = NULL ;
ShapeDlgInfo.uBackgroundTileBitmapCount = 0 ;
ShapeDlgInfo.nActiveBackgroundTileBitmapItem = -1 ;
ShapeDlgInfo.nBorderStyle = shape.nBorderStyle ;
ShapeDlgInfo.nBorderBrushStyle = shape.nBorderBrushStyle ;
ShapeDlgInfo.crBorderColor = shape.crBorderColor ;
ShapeDlgInfo.ppszBorderTileBitmap = NULL ;
ShapeDlgInfo.uBorderTileBitmapCount = 0 ;
ShapeDlgInfo.nActiveBorderTileBitmapItem = -1 ;
ShapeDlgInfo.nBorderWidth = shape.nBorderWidth ;
ShapeDlgInfo.nBorderEndCap = shape.nBorderEndCap ;
ShapeDlgInfo.nGradientStyle = shape.nGradientStyle ;
ShapeDlgInfo.crGradientStartColor = shape.crGradientStartColor ;
ShapeDlgInfo.crGradientEndColor = shape.crGradientEndColor ;
ShapeDlgInfo.uGradientSteps = shape.uGradientSteps ;
ShapeDlgInfo.nRoundRectEllipseWidth = shape.nRoundRectEllipseWidth ;
ShapeDlgInfo.nRoundRectEllipseHeight = shape.nRoundRectEllipseHeight ;
ShapeDlgInfo.nOpacity = shape.nOpacity ;
ShapeDlgInfo.ppszPaperTexture = NULL ;
ShapeDlgInfo.uPaperTextureCount = 0 ;
ShapeDlgInfo.nActivePaperTextureItem = -1 ;

nRet = L_PntDlgShape ( hWnd, &ShapeDlgInfo ) ;

if ( SUCCESS == nRet )
{
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_ALL ;
shape.nBackgroundStyle = ShapeDlgInfo.nBackgroundStyle ;
shape.crBackgroundColor = ShapeDlgInfo.crBackgroundColor ;
shape.pBackgroundTileBitmap = NULL ;
shape.nBorderStyle = ShapeDlgInfo.nBorderStyle ;
shape.nBorderBrushStyle = ShapeDlgInfo.nBorderBrushStyle ;
shape.crBorderColor = ShapeDlgInfo.crBorderColor ;
shape.hBorderTileBitmap = NULL ;
shape.nBorderWidth = ShapeDlgInfo.nBorderWidth ;
shape.nBorderEndCap = ShapeDlgInfo.nBorderEndCap ;
shape.nGradientStyle = ShapeDlgInfo.nGradientStyle ;
shape.crGradientStartColor = ShapeDlgInfo.crGradientStartColor ;
shape.crGradientEndColor = ShapeDlgInfo.crGradientEndColor ;
shape.uGradientSteps = ShapeDlgInfo.uGradientSteps ;
shape.nRoundRectEllipseWidth = ShapeDlgInfo.nRoundRectEllipseWidth ;
shape.nRoundRectEllipseHeight = ShapeDlgInfo.nRoundRectEllipseHeight ;
shape.nOpacity = ShapeDlgInfo.nOpacity ;
shape.pTexture = NULL ;

L_AutSetPaintProperty ( pAutomation, PAINT_GROUP_SHAPE, &shape ) ;
}
}

4.

Add the following line to the WndProc function after the statement "return 0L ;" of the case IDM_EDIT_DELETE in the WM_COMMAND message:

case IDM_PROPERTIES_SHAPE:
OnShapeProperties ( hWnd, pAutomation ) ;

return 0L ;

5. | Select Insert->Files into Project from the menu. In the dialog box that will appear, browse to c:\lead\lib\ltpdg_n.lib, select it and click Add.
6. | Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


L_AutAddContainer

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutAddContainer(pAutomation, pContainer , pModeData)

pAUTOMATIONHANDLE pAutomation ; | /* pointer to an automation handle */
pCONTAINERHANDLE pContainer ; | /* pointer to a container handle */
L_VOID L_FAR * pModeData ; | /* pointer to additional data */

Adds a new container to the automation list of containers.

Parameter | Description
pAutomation | Pointer to an automation handle.
pContainer | Pointer to a container handle.
pModeData | Pointer to a structure that contains information about the mode used to create the specified automation handle. If the automation handle was created using AUTOMATION_MODE_VECTOR, pModeData should point to a VECTORHANDLE structure. If the automation handle was created using AUTOMATION_MODE_PAINT, pModeData should point to a CONTAINERPAINTDATA structure.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

For an SDI application, usually a single container for the current SDI window will be added. For an MDI application, usually a new container will be added every time a new MDI child window is created.

The newly added container will become the active automation container.

Adding a new container will provide all automation functionality to the window that owns the newly added container.

To remove a container from the automation list of containers, call L_AutRemoveContainer.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutRemoveContainer, L_ContainerInit, L_ContainerCreate
Topics: | Automation and the Container

Example

/* this example shows how to create and add a new container when the current automation mode is AUTOMATION_MODE_VECTOR */

L_INT ContainerAddTest ( HWND hWndOwner, pAUTOMATIONHANDLE pAutomation, pVECTORHANDLE pVector )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) )
{
pCONTAINERHANDLE pContainer ;

/* initiate a new container handle */
if ( SUCCESS != L_ContainerInit ( &pContainer ) )
{
return FAILURE ;
}

/* create a new container */
if ( SUCCESS != L_ContainerCreate ( pContainer, hWndOwner ) )
{
return FAILURE ;
}

/* add the new container to the vector automation */
L_AutAddContainer ( pAutomation, pContainer, pVector) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}

}


L_AutAddUndoNode

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutAddUndoNode(pAutomation, dwFlags);

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
L_INT32 dwFlags; | /* reserved */

Manually adds an undo node to the automation object.

Parameter | Description
pAutomation | Pointer to an automation handle.
dwFlags | Reserved for future use. Use 0.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function adds an undo node to the automation object. When used with L_AutSetUndoEnabled, a lengthy operation, consisting of multiple steps, can be combined into one undo call to L_AutUndo. To accomplish this, use the following steps:

1. | Call L_AutAddUndoNode to add an undo node to the automation handle.
2. | Disable the undo feature by calling L_AutSetUndoEnabled (pAutomation, FALSE).
3. | Perform the operations to be combined into one undo, For example:

Vector Rotate

Vector Scale

Vector Translate

4.

Re-enable the undo feature by calling L_AutSetUndoEnabled (pAutomation, TRUE).

Now, all three operations can be undone with one call to L_AutUndo instead of three calls to L_AutUndo.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutSetUndoEnabled, L_AutSetUndoLevel, L_AutUndo, L_AutRedo
Topics: | Undoing and Redoing Automation Operations

Example

/* Add an undo node manually */
L_AutAddUndoNode( pAutomation, 0L );

/* Disable the undo feature */
L_AutSetUndoEnabled ( pAutomation, FALSE );

/* Do multiple operations on the automation object */

/* Re-enable the undo feature */
L_AutSetUndoEnabled ( pAutomation, TRUE );


L_AutCanRedo

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutCanRedo(pAutomation, pfCanRedo)

pAUTOMATIONHANDLE pAutomation ; | /* pointer to an automation handle */
L_BOOL pfCanRedo ; | /* pointer to an integer */

Determines whether or not the last automation operation in the active automation container can be redone.

Parameter | Description
pAutomation | Pointer to an automation handle.
pfCanRedo | A pointer to the variable to be updated with a value that indicates whether or not an automation operation can be redone. Possible values are:
 | Value | Meaning
 | TRUE | The last automation operation can be redone.
 | FALSE | The last automation operation cannot be redone.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

To redo an automation operation, call L_AutRedo.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutRedo, L_AutUndo, L_AutCanUndo, L_AutGetUndoLevel, L_AutSetUndoLevel
Topics: | Undoing and Redoing Automation Operations

Example

For an example, refer to L_AutRedo.


L_AutCanUndo

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutCanUndo(pAutomation, pfCanUndo)

pAUTOMATIONHANDLE pAutomation ; | /* pointer to an automation handle */
L_BOOL pfCanUndo ; | /* pointer to an integer */

Determines whether or not the last automation operation in the active automation container can be undone.

Parameter | Description
pAutomation | Pointer to an automation handle.
pfCanUndo | A pointer to a variable to be updated with a value that indicates whether or not an undo can be performed. Possible values are:
 | Value | Meaning
 | TRUE | The last automation operation can be undone.
 | FALSE | The last automation operation cannot be undone.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

To determine the current undo level call L_AutGetUndoLevel.

To change the undo level call L_AutSetUndoLevel.

To undo an automation operation, call L_AutUndo.

For information about grouping multiple operations into a single undo process, refer to L_AutAddUndoNode.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutUndo, L_AutGetUndoLevel, L_AutSetUndoLevel
Topics: | Undoing and Redoing Automation Operations

Example

For an example, refer to L_AutUndo.


L_AutClipboardDataReady

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutClipboardDataReady(pAutomation, pfReady)

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
L_BOOL pfReady; | /* pointer to an integer */

Determines whether the Windows clipboard contains valid automation data that can be pasted using the L_AutPaste function.

Parameter | Description
pAutomation | Pointer to an automation handle.
pfReady | A pointer to a variable to be updated with a value that indicates whether or not valid automation data exists on the clipboard. Possible values are:
 | Value | Meaning
 | TRUE | There is valid automation data on the clipboard.
 | FALSE | There is no valid automation data on the clipboard.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

If the automation handle was created using AUTOMATION_MODE_VECTOR, then the clipboard contents should be a vector image.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutCut, L_AutCopy, L_AutPaste
Topics: | Editing Automation Containers

Example

For an example, refer to L_AutPaste.


L_AutCopy

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutCopy(pAutomation, dwFlags )

pAUTOMATIONHANDLE pAutomation ; | /* pointer to an automation handle */
L_UINT32 dwFlags ; | /* reserved */

Copies the selected objects in the active automation container to the Windows clipboard.

Parameter | Description
pAutomation | Pointer to an automation handle.
dwFlags | Reserved for future use. Must be 0.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

To paste valid automation data from the clipboard to the active automation container, use L_AutPaste.

Automation data can be cut from the active automation container and placed on the clipboard using L_AutCut.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutPaste, L_AutCut, L_AutClipboardDataReady
Topics: | Editing Automation Containers

Example

/* this example shows how to do a copy operation to the current automation selection */

L_INT CopyTest ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
/* copy the current selection to the clipboard */
L_AutCopy ( pAutomation, 0 ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_AutCreate

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutCreate(pAutomation, nMode, dwFlags)

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
AUTOMATIONMODE nMode; | /* automation mode */
L_UINT32 dwFlags; | /* reserved */

Creates an automation handle.

Parameter | Description
pAutomation | Pointer to an automation handle.
nMode | An integer value that represents the automation mode to use when creating the automation handle. (What are the possible values?)
dwFlags | Reserved for future use. Use 0.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

L_AutInit must be called before calling this function.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutInit, L_AutFree
Topics: | Initializing, Creating and Freeing Automation Handles

Example

/* This example shows the minimum requirement to create a Vector Automation */

/* global automation handle */
pAUTOMATIONHANDLE g_pAutomation ;

/* global toolbar handle */
pTOOLBARHANDLE g_pToolbar ;

L_INT InitVectorAutomatino ( HWND hWnd )
{
if (SUCCESS == L_AutInit ( &g_pAutomation ) ) /* initiate the automation */
{
/* create the vector automation */
if ( SUCCESS != L_AutCreate ( g_pAutomation, AUTOMATION_MODE_VECTOR, 0 ) )
{
MessageBox ( hWnd, TEXT("Error creating Vector Automation"), TEXT("Error:"), MB_ICONSTOP ) ;

L_AutFree ( g_pAutomation ) ;

return FAILURE;
}
}
else
{
MessageBox ( hWnd, TEXT("Error Initializing Vector Automation"), TEXT("Error:"), MB_ICONSTOP ) ;

return FAILURE;
}

/* initiate the toolbar */
if ( SUCCESS == L_TBInit ( &g_pToolbar ) )
{
POINT pt = { 0, 0 } ;

ClientToScreen ( hWnd, &pt ) ;

/* create the vector toolbar */
L_TBCreate ( g_pToolbar, hWnd, TEXT("Vector "), TOOLBAR_VECTOR ) ;

/* set the toolbar position */
L_TBSetPosition ( g_pToolbar, &pt, TOOLBAR_POSITION_TOP | TOOLBAR_POSITION_LEFT ) ;

/* set the toolbar visible */
L_TBSetVisible ( g_pToolbar, TRUE ) ;
}
else
{
return FAILURE ;
}

/* set the automation toolbar */
L_AutSetToolbar ( g_pAutomation, g_pToolbar ) ;

return SUCCESS ;
}


L_AutCut

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutCut(pAutomation, dwFlags )

pAUTOMATIONHANDLE pAutomation ; | /* pointer to an automation handle */
L_UINT32 dwFlags ; | /* reserved */

Cuts the selected objects in the active automation container to the Windows clipboard.

Parameter | Description
pAutomation | Pointer to an automation handle.
dwFlags | Reserved for future use. Must be 0.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

To paste automation data on the clipboard to the active automation container, call L_AutPaste.

To copy automation data from the active automation container, to the Windows clipboard, use L_AutCopy.

To determine whether or not there is valid automation data present on the clipboard, call L_AutClipboardDataReady.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutPaste, L_AutSetPaintBkColor, L_AutCopy, L_AutClipboardDataReady
Topics: | Editing Automation Containers

Example

/* this example shows how to do a cut operation to the current automation selection */

L_INT CutTest ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
/* cut the current selection to the clipboard */
L_AutCut ( pAutomation, 0 ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_AutDelete

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutDelete(pAutomation, dwFlags)

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
L_UINT32 dwFlags; | /* reserved */

Deletes the selected objects from the active automation container.

Parameter | Description
pAutomation | Pointer to an automation handle.
dwFlags | Reserved for future use. Must be 0.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutCut, L_AutCopy, L_AutPaste
Topics: | Editing Automation Containers

Example

/* this example shows how to do a delete operation on the current automation selection */

L_INT DeleteTest ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
/* delete the current selection */
L_AutDelete ( pAutomation, 0 ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_AutEnumContainers

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutEnumContainers(pAutomation, pEnumProc, pUserData )

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
pAUTOMATIONENUMCONTAINERPROC pEnumProc ; | /* optional callback function */
L_VOID L_FAR *pUserData; | /* pointer to more parameters for the callback */

Enumerates all containers associated with the specified automation handle.

Parameter | Description
pAutomation | Pointer to an automation handle.
pEnumProc | Optional callback function for additional processing.
 | If you do not provide a callback function, use NULL as the value of this parameter. If you do provide a callback function, use the function pointer as the value of this parameter. The callback function must adhere to the function prototype described in the AUTOMATIONENUMCONTAINERPROC Function.
pUserData | Void pointer that you can use to pass one or more additional parameters that the enumeration callback function needs.
 | To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID L_FAR *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure. If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

For each container enumerated by this function, the AUTOMATIONENUMCONTAINERPROC callback function is called.

The enumeration process continues until the last container is enumerated or the callback function returns 0 or an error.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | AUTOMATIONENUMCONTAINERPROC
Topics: | Automation and the Container

Example

/* This example shows how to enumerate the automation containers */

/* User defined enumeration callback function */
L_INT EXT_CALLBACK EnumContainersCallback ( pCONTAINERHANDLE pContainer, L_VOID L_FAR *pUserData )
{
/* reset the passed container handle */
L_ContainerReset ( pContainer ) ;

/* return SUCCESS to continue the enumeration */
return SUCCESS ;
}

L_INT ResetAllContainers ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
/* start enumerating the current added automation containers */
L_AutEnumContainers ( pAutomation, EnumContainersCallback, NULL );

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_AutFree

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutFree(pAutomation)

pAUTOMATIONHANDLE pAutomation;

/* pointer to an automation handle */

Frees the automation handle.

Parameter | Description
pAutomation | Pointer to the automation handle to free.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function should be called when an automation handle is no longer needed by an application.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutInit, L_AutIsValid
Topics: | Initializing, Creating and Freeing Automation Handles

Example

/* this example frees the automation handle and its associated toolbar (if one exists) */

L_INT FreeAutomation ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
pTOOLBARHANDLE pToolbar ;

/* get the automation toolbar handle */
L_AutGetToolbar ( pAutomation, &pToolbar ) ;

if ( NULL != pToolbar ) /* check if there is any toolbar is currently installed */
{
/* free the toolbar handle */
L_TBFree ( pToolbar ) ;
}

/* free the automation handle */
L_AutFree ( pAutomation ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_AutGetActiveContainer

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutGetActiveContainer(pAutomation, ppContainer)

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
pCONTAINERHANDLE ppContainer; | /* pointer to a pointer to a container handle */

Gets the handle to the active automation container.

Parameter | Description
pAutomation | Pointer to an automation handle.
ppContainer | A pointer to be updated with a pointer to the handle of the active container.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

To change the active automation container use L_AutSetActiveContainer.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutSetActiveContainer, L_AutAddContainer
Topics: | Automation and the Container

Example

For an example, refer to L_AutSetActiveContainer.


L_AutGetCurrentTool

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutGetCurrentTool(pAutomation, pnTool)

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
L_INT *pnTool; | /* pointer to an integer */

Manually sets the current tool in an automation handle without using the toolbar.

Parameter | Description
pAutomation | Pointer to an automation handle.
pnTool | Pointer to a variable to be updated with the current tool id. For more information about tools, tool identifiers and toolbar buttons, refer to the Lttbdlln.chm help file.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function lets you simulate a toolbar, instead of using one provided by LEAD Automation.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutSetCurrentTool, L_AutSetToolbar, L_AutGetToolbar
Topics: | The Automation Toolbar

Example

/* This example will determine if the current tool in a vector automation handle is the line tool */

L_BOOL IsLineTool( pAUTOMATIONHANDLE pAutomation )
{
/* Assume pAutomation is a valid vector automation handle, and no toolbar has been set */
L_INT nTool;

L_AutGetCurrentTool( pAutomation, &nTool );
if( nTool == ID_TOOL_VECTOR_LINE )
return TRUE;
else
return FALSE;
}


L_AutGetToolbar

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutGetToolbar( pAutomation, ppToolbar )

pAUTOMATIONHANDLE pAutomation ; | /* pointer to an automation handle */
pTOOLBARHANDLE ppToolbar ; | /* pointer to LEAD toolbar handle */

Gets the current LEAD automation toolbar handle.

Parameter | Description
pAutomation | Pointer to an automation handle.
ppToolbar | Pointer to the variable to be updated with a pointer to the current LEAD automation toolbar handle.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

If L_AutSetToolbar was not used to set the toolbar handle, this function will return NULL in the ppToolbar parameter.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutSetToolbar.
Topics: | The Automation Toolbar

Example

For an example, refer to L_AutFree.


L_AutGetUndoLevel

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutGetUndoLevel(pAutomation, puLevel)

pAUTOMATIONHANDLE pAutomation ; | /* pointer to an automation handle */
L_UINT puLevel; | /* pointer to an integer */

Gets the undo level for the specified automation handle.

Parameter | Description
pAutomation | Pointer to the automation handle.
puLevel | A pointer to a variable to be updated with the undo level.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The undo level determines the number of automation operations that can be done within an automation container. If the undo level is set to 16, then each container associated with the automation handle has an undo level of 16.

To change the undo level call L_AutSetUndoLevel.

To undo an automation operation, call L_AutUndo.

To determine whether an automation operation can be undone, call L_AutCanUndo.

For information about grouping multiple operations into a single undo process, refer to L_AutAddUndoNode.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutSetUndoLevel, L_AutUndo, L_AutCanUndo
Topics: | Undoing and Redoing Automation Operations

Example

For an example, refer to L_AutSetUndoLevel.


L_AutInit

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutInit(ppAutomation)

ppAUTOMATIONHANDLE ppAutomation ;

/* pointer to a pointer to an automation handle */

Initializes the automation handle.

Parameter | Description
ppAutomation | Pointer to a pointer to an automation handle to be initialized.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function must be called before calling any other automation functions.

An automation handle is valid after calling L_AutInit and L_AutCreate.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutIsValid, L_AutFree, L_AutCreate
Topics: | Initializing, Creating and Freeing Automation Handles

Example

For an example, refer to L_AutCreate.


L_AutIsValid

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutIsValid(pAutomation)

pAUTOMATIONHANDLE pAutomation ;

/* pointer to an automation handle */

Determines the validity of the given automation handle.

Parameter | Description
pAutomation | Pointer to an automation handle.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The automation handle will be valid after calling L_AutInit and L_AutCreate.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutInit, L_AutCreate, L_AutFree
Topics: | Initializing, Creating and Freeing Automation Handles

Example

For an example, refer to L_AutFree.


L_AutPaste

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutPaste(pAutomation, dwFlags)

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
L_UINT32 dwFlags; | /* reserved */

Copies the valid automation data on the clipboard to the active automation container.

Parameter | Description
pAutomation | Pointer to an automation handle.
dwFlags | Reserved for future use. Must be 0.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Call L_AutClipboardDataReady to determine whether valid automation data exists on the clipboard.

To copy automation data from the active automation container to the clipboard use L_AutCopy. Automation data can be cut from the active automation container and placed on the clipboard using L_AutCut.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutClipboardDataReady , L_AutCut, L_AutCopy
Topics: | Editing Automation Containers

Example

/* this example shows how to paste the current clipboard contents (if any)
to the current active automation */

L_INT PasteTest ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
L_BOOL fReady ;

/* check if there is a valid automation mode data on the clipboard */
L_AutClipboardDataReady ( pAutomation, &fReady ) ;

if ( fReady )
{
/* paste the data to the current active container */
L_AutPaste ( pAutomation, 0 ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_AutPrint

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutPrint(pAutomation, dwFlags)

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
L_UINT32 dwFlags; | /* reserved */

Prints the objects in the active automation container that are currently displayed on the screen.

Parameter | Description
pAutomation | Pointer to an automation handle.
dwFlags | Reserved for future use. Must be 0.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

To erase the contents of a container from the screen, call L_ContainerReset.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Topics:

Automation Printing

Example

/* this example shows how to print the automation data */

L_INT PrintTest ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
/* print the active automation container data */
L_AutPrint ( pAutomation, 0 ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_AutRedo

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutRedo(pAutomation, dwFlags)

pAUTOMATIONHANDLE pAutomation ; | /* pointer to an automation handle */
L_UINT32 dwFlags ; | /* reserved */

Repeats that last automation operation performed in the active automation container.

Parameter | Description
pAutomation | Pointer to an automation handle.
dwFlags | Reserved for future use. Must be 0.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function can be called for each process "undone" in the active automation container by calling L_AutUndo. For example, if L_AutUndo has been called three times, to undo three processes, then calling L_AutRedo can redo those three processes. The first call to L_AutRedo will redo the first process; the second call will redo the second process and the third call will redo the third process.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutCanRedo, L_AutUndo, L_AutSetUndoLevel, L_AutGetUndoLevel
Topics: | Undoing and Redoing Automation Operations

Example

/* this example shows how to redo the last automation operation */

L_INT AutomationRedoTest ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
L_BOOL fCanRedo ;

/* query the ability of redoing */
L_AutCanRedo ( pAutomation, &fCanRedo ) ;

if ( fCanRedo )
{
/* redo the last automation operation */
L_AutRedo ( pAutomation, 0 ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_AutRemoveContainer

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutRemoveContainer(pAutomation, pContainer)

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
pCONTAINERHANDLE pContainer ; | /* pointer to a container handle */

Removes the specified container from the automation list of containers.

Parameter | Description
pAutomation | Pointer to an automation handle.
pContainer | Pointer to a container handle.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Removing the container from the automation list of containers will remove the automation functionality from that container and the window that owns it.

When working with vector automation, the user must free any vector handles associated with the automation container

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutAddContainer.
Topics: | Automation and the Container

Example

/* This example shows how to remove some container from the automation */

L_INT RemoveContainerTest ( pAUTOMATIONHANDLE pAutomation, pCONTAINERHANDLE pContainer )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
if ( SUCCESS == L_ContainerIsValid ( pContainer ) ) /* check the validity of the container handle */
{
/* Remove the container from the automation */
L_AutRemoveContainer ( pAutomation, pContainer ) ;

/* Free the container handle */
L_ContainerFree ( pContainer ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}
else
{
return FAILURE ;
}
}


L_AutSelect

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutSelect(pAutomation, nSelect, dwFlags)

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
AUTOMATIONSELECT nSelect; | /* selection option */
L_UINT32 dwFlags; | /* reserved */

Selects or unselects all objects within the active automation container.

Parameter | Description
pAutomation | Pointer to an automation handle.
nSelect | An integer value that indicates whether to select or unselect the items in the active automation container.
dwFlags | Reserved for future use. Must be 0.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutCopy, L_AutCut, L_AutPaste, L_AutDelete
Topics: | Working with Objects within an Automation Container

Example

/* this example shows how to use the automation select function */

L_INT SelectAllTest ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
/* select all of the current automation container data */
L_AutSelect ( pAutomation, AUTOMATION_SELECT_ALL, 0 ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_AutSetCurrentTool

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutSetCurrentTool(pAutomation, nTool)

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
L_INT nTool; | /* tool id */

Manually sets the current tool in an automation handle without using the toolbar.

Parameter | Description
pAutomation | Pointer to an automation handle.
nTool | An integer value that represents the tool to set. For more information about tools, tool identifiers and toolbar button; refer to the Lttbdlln.hlp help file.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function lets you simulate a toolbar, instead of using one provided by LEAD Automation.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutGetCurrentTool, L_AutSetToolbar, L_AutGetToolbar
Topics: | The Automation Toolbar

Example

/* This example will set the Line tool in a vector automation handle */

/* Assume pAutomation is a valid vector automation handle, and no toolbar has been set */
L_AutSetCurrentTool( pAutomation, ID_TOOL_VECTOR_LINE );


L_AutSetActiveContainer

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutSetActiveContainer(pAutomation, pContainer)

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
pCONTAINERHANDLE pContainer; | /* pointer to a container handle */

Sets the active automation container.

Parameter | Description
pAutomation | Pointer to an automation handle.
pContainer | Pointer to the container handle that references the container to be activated.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The container being set must exist in the automation container list. To add a container to the automation container list, call L_AutAddContainer.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutGetActiveContainer, L_AutAddContainer
Topics: | Automation and the Container

Example

/* This example shows how to set the automation active container */

L_INT SetActiveContainerTest ( pAUTOMATIONHANDLE pAutomation, pCONTAINERHANDLE pContainer )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
if ( SUCCESS == L_ContainerIsValid ( pContainer ) ) /* check the validity of the container handle */
{
pCONTAINERHANDLE pActiveContainer ;

/* get the current active container */
L_AutGetActiveContainer ( pAutomation, &pActiveContainer ) ;

if ( pContainer != pActiveContainer ) /* if the new container is not currently active */
{
/* set the new active container */
L_AutSetActiveContainer ( pAutomation, pContainer ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}
else
{
return FAILURE ;
}
}


L_AutSetToolbar

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutSetToolbar(pAutomation, pToolbar)

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
pTOOLBARHANDLE pToolbar; | /* pointer to a LEAD toolbar handle */

Sets the LEAD automation toolbar handle.

Parameter | Description
pAutomation | Pointer to an automation handle.
pToolbar | Pointer to the toolbar handle to be set.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The user should use the vector toolbar when the automation handle was created using AUTOMATION_MODE_VECTOR.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutGetToolbar.
Topics: | The Automation Toolbar

Example

For an example, refer to L_AutCreate.


L_AutSetUndoEnabled

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutSetUndoEnabled (pAutomation, fEnabled);

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
L_BOOL fEnabled; | /* flag */

Disables or re-enables the undo feature of the automation handle.

Parameter | Description
pAutomation | Pointer to an automation handle.
fEnabled | Flag that indicates whether to enable or disable the undo feature of the specified automation handle. By enabling or disabling the undo feature, the internal undo counter is incremented or decremented. Possible values are:
 | Value | Meaning
 | TRUE | Enable the undo feature and increment the internal undo counter by one.
 | FALSE | Disable the undo feature and decrement the internal undo counter by one.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function sets an internal automation counter that determines whether the undo feature should be displayed. The undo feature is on only if this counter is greater than or equal to 0. The initial value is 0.

Use this function along with L_AutAddUndoNode to combine multiple operations into a single undo call. For more information on this process, refer to L_AutAddUndoNode.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutSetUndoLevel, L_AutAddUndoNode, L_AutUndo, L_AutRedo
Topics: | Undoing and Redoing Automation Operations

Example

For an example, refer to L_AutAddUndoNode.


L_AutSetUndoLevel

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutSetUndoLevel(pAutomation, uLevel)

pAUTOMATIONHANDLE pAutomation ; | /* pointer to an automation handle */
L_UINT uLevel; | /* undo level */

Sets the automation undo level.

Parameter | Description
pAutomation | Pointer to an automation handle.
uLevel | An integer value that represents the maximum number of undo operations that can be performed in each container associated with the automation handle. The default undo level is 16.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The undo level determines the number of automation operations that can be done within an automation container. If the undo level is set to 16, then each container associated with the automation handle has an undo level of 16.

To determine the current undo level, call L_AutGetUndoLevel.

To undo an automation operation, call L_AutUndo.

To determine whether an automation operation can be undone, call L_AutCanUndo.

For information about grouping multiple operations into a single undo process, refer to L_AutAddUndoNode.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutGetUndoLevel, L_AutUndo, L_AutCanUndo
Topics: | Undoing and Redoing Automation Operations

Example

/* this example shows how to Get/Set the automation undo level */

L_INT ChangeUndoLevelTest ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
L_UINT uAutUndoLevel ;

/* get the current automation undo level */
L_AutGetUndoLevel( pAutomation, &uAutUndoLevel ) ;

if ( 32 != uAutUndoLevel )
{
/* set the automation undo level to 32 */
L_AutSetUndoLevel ( pAutomation, 32 ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_AutUndo

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutUndo(pAutomation, dwFlags)

pAUTOMATIONHANDLE pAutomation ; | /* pointer to an automation handle */
L_UINT32 dwFlags; | /* reserved */

Undoes the last automation operation performed in the active automation container.

Parameter | Description
pAutomation | Pointer to an automation handle.
dwFlags | Reserved for future use. Must be 0.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

L_AutUndo must be called at least once in order to perform a "redo" using L_AutRedo.

To determine the current undo level call L_AutGetUndoLevel.

To change the undo level call L_AutSetUndoLevel.

To determine whether an automation operation can be undone, call L_AutCanUndo.

For information about grouping multiple operations into a single undo process, refer to L_AutAddUndoNode.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutCanUndo, L_AutGetUndoLevel, L_AutSetUndoLevel
Topics: | Undoing and Redoing Automation Operations

Example

/* this example shows how to undo the last automation operation */

L_INT AutomationUndoTest ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
L_BOOL fCanUndo ;

/* Query the ability of undoing */
L_AutCanUndo ( pAutomation, &fCanUndo ) ;

if ( fCanUndo )
{
/* undo the last automation operation */
L_AutUndo ( pAutomation, 0 ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_AutGetPaintBkColor

#include “ltaut.h”

L_INT EXT_FUNCTION L_AutGetPaintBkColor (pAutomation, prcBKColor )

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
COLORREF prcBKColor; | /* pointer to a variable to be updated */

Gets the digital paint automation background color.

Parameter | Description
pAutomation | Pointer to an automation handle.
prcBKColor | Pointer to a COLORREF variable to be updated with the current digital paint automation background color.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Note:

This function is only available in the Digital Paint toolkits.

This function will only work if the automation handle was created using the AUTOMATION_MODE_PAINT automation mode. For information on creating an automation handle, refer to L_AutCreate.

The default color retrieved by this function is RGB (0, 0, 0).

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutSetPaintBkColor.
Topics: | Automation Functions: Automation Paint Property.

Example

For an example, refer to L_AutSetPaintBkColor


L_AutGetPaintProperty

#include “ltaut.h”

L_INT EXT_FUNCTION L_AutGetPaintProperty (pAutomation, nGroup, pProperty)

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
PAINTGROUP nGroup; | /* type of paint properties */
L_VOID L_FAR * pProperty; | /* pointer to a PAINTXXX structure */

Gets the current digital paint automation properties.

Parameter | Description
pAutomation | Pointer to an automation handle.
nGroup | Indicates the paint properties to get and the structure pointed to by pProperty. Possible values are:
 | Value | Meaning
 | PAINT_GROUP_BRUSH | Get the Paintbrush properties. pProperty points to a PAINTBRUSH structure.
 | PAINT_GROUP_SHAPE | Get the Paint shape properties. pProperty points to a PAINTSHAPE structure.
 | PAINT_GROUP_REGION | Get the Paint region properties. pProperty points to a PAINTREGION structure.
 | PAINT_GROUP_FILL | Get the Paint fill properties. pProperty points to a PAINTFILL structure.
 | PAINT_GROUP_TEXT | Get the Paint fill properties. pProperty points to a PAINTTEXT structure.
pProperty | Pointer to a PAINTXXX structure to be updated with the specified property values. The type of structure that this parameter points to is indicated by the nGroup parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Note:

This function is only available in the Digital Paint toolkits.

This function will only work if the automation handle was created using the AUTOMATION_MODE_PAINT automation mode. For information on creating an automation handle, refer to L_AutCreate.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutSetPaintProperty.
Topics: | Automation Functions: Automation Paint Property.

Example

For an example, refer to L_AutSetPaintProperty.


L_AutSetPaintBkColor

#include “ltaut.h”

L_INT EXT_FUNCTION L_AutSetPaintBkColor (pAutomation, rcBKColor)

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
COLORREF rcBKColor; | /* new background color */

Sets the paint automation background color.

Parameter | Description
pAutomation | Pointer to an automation handle.
rcBKColor | The COLORREF value that specifies the new background color.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Note:

This function is only available in the Digital Paint toolkits.

This function will only work if the automation handle was created using the AUTOMATION_MODE_PAINT automation mode. For information on creating an automation handle, refer to L_AutCreate.

This color will be used by the automation to fill the area left behind, when the user cuts or deletes some selected region from the bitmap.

The default color is RGB (0, 0, 0).

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutCut; L_AutDelete, L_AutGetPaintBkColor.
Topics: | Automation Functions: Automation Paint Property.

Example

/* This example will make sure that the BK is not anything but black */
L_INT StickToBalck ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
COLORREF crBkColor ;

/* get the current paint automation color */
L_AutGetPaintBkColor ( pAutomation, &crBkColor ) ;

if ( crBkColor != RGB ( 0, 0, 0 ) ) /* check if its not black */
{
/* set the paint automation background color */
L_AutSetPaintBkColor ( pAutomation, RGB(0, 0, 0 ) ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_AutSetPaintProperty

#include “ltaut.h”

L_INT EXT_FUNCTION L_AutSetPaintProperty(pAutomation, nGroup, pProperty)

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
PAINTGROUP nGroup; | /* type of paint properties */
const L_VOID L_FAR * pProperty; | /* pointer to a PAINTXXX structure */

Sets the digital paint automation properties.

Parameter | Description
pAutomation | Pointer to an automation handle.
nGroup | Indicates the paint properties to set and the structure pointed to by pProperty. Possible values are:
 | Value | Meaning
 | PAINT_GROUP_BRUSH | Set the Paintbrush properties. pProperty points to a PAINTBRUSH structure.
 | PAINT_GROUP_SHAPE | Set the Paint shape properties. pProperty points to a PAINTSHAPE structure.
 | PAINT_GROUP_REGION | Set the Paint region properties. pProperty points to a PAINTREGION structure.
 | PAINT_GROUP_FILL | Set the Paint fill properties. pProperty points to a PAINTFILL structure.
 | PAINT_GROUP_TEXT | Set the Paint fill properties. pProperty points to a PAINTTEXT structure.
pProperty | Pointer to a PAINTXXX structure to be updated with the specified property values. The type of structure that this parameter points to is indicated by the nGroup parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Note:

This function is only available in the Digital Paint toolkits.

This function will only work if the automation handle was created using the AUTOMATION_MODE_PAINT automation mode. For information on creating an automation handle, refer to L_AutCreate.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutGetPaintProperty.
Topics: | Automation Functions: Automation Paint Property.

Example

/* this example shows how to change the paint shape properties */
L_INT SetPaintShapePropsTest ( pAUTOMATIONHANDLE pAutomation )
{
if ( SUCCESS == L_AutIsValid ( pAutomation ) ) /* check the validity of the automation handle */
{
PAINTSHAPE shape ;

/* set the paint shape group properties */
L_AutGetPaintProperty ( pAutomation, PAINT_GROUP_SHAPE, &shape ) ;

/* do some check and change to the required properties */
if (PAINT_SHAPE_BORDER_STYLE_SOLID == shape.nBorderStyle )
{
/* set the desired shape properties using the field masks */
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERSTYLE |
PSF_BORDERWIDTH |
PSF_BORDERENDCAP ;
shape.nBorderStyle = PAINT_SHAPE_BORDER_STYLE_DOT ;
shape.nBorderWidth = 10 ;
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_ROUND ;

/*set the paint shape group properties */
L_AutSetPaintProperty ( pAutomation, PAINT_GROUP_SHAPE, &shape ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_AutEditVectorObject

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutEditVectorObject (pAutomation, pObject);

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
const pVECTOROBJECT pObject; | /* pointer to a structure */

Edits the specified vector object.

Parameter | Description
pAutomation | Pointer to an automation handle.
pObject | Pointer to a VECTOROBJECT structure that specifies the vector object to edit.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Note:

This function is only available in the vector toolkits.

Starts editing an existing vector object.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutSetVectorProperty, L_AutGetVectorProperty
Topics: | Working with Objects within an Automation Container

Example

/* This example will edit the vect7or object under a given point in screen */
L_VOID EditObject( pAUTOMATIONHANDLE pAutomation, pVECTORHANDLE pVector, POINT *pt )
{
L_INT nRet;
VECTOROBJECT Object;

/* Get the vector object under point */
nRet = L_VecHitTest ( pVector, &pt, &Object );
if( nRet == SUCCESS )
{
// Edit this object
L_AutEditVectorObject( pAutomation, &Object );
}
}


L_AutGetVectorProperty

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutGetVectorProperty(pAutomation, pProps);

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
pAUTOMATIONVECTORPROPERTIES pProps; | /* pointer to a structure */

Gets the current vector automation properties.

Parameter | Description
pAutomation | Pointer to an automation handle.
pProps | Pointer to a AUTOMATIONVECTORPROPERTIES structure to be updated with the current vector automation properties.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Note:

This function is only available in the vector toolkits.

The properties retrieved by this function include pen, brush and font properties used when drawing new vector objects in the automation container.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutSetVectorProperty
Topics: | Working with Objects within an Automation Container

Example

For an example, refer to L_AutSetVectorProperty.


L_AutSetVectorProperty

#include "ltaut.h"

L_INT EXT_FUNCTION L_AutSetVectorProperty(pAutomation, pProps);

pAUTOMATIONHANDLE pAutomation; | /* pointer to an automation handle */
const pAUTOMATIONVECTORPROPERTIES pProps; | /* pointer to a structure */

Sets the vector automation properties.

Parameter | Description
pAutomation | Pointer to an automation handle.
pProps | Pointer to an AUTOMATIONVECTORPROPERTIES structure that contains the new vector automation properties to set.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Note:

This function is only available in the vector toolkits.

The properties set by this function include pen, brush and font properties used when drawing new vector objects in the automation container.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_AutGetVectorProperty
Topics: | Working with Objects within an Automation Container

Example

/* This example will set a new pen color */
L_VOID SetMyPen( pAUTOMATIONHANDLE pAutomation, COLORREF Clr )
{
AUTOMATIONVECTORPROPERTIES Props; /* properties */

memset( &Props, 0, sizeof( Props ) );
Props.nSize = sizeof( Props );
Props.dwMask = AUTOMATION_VECTOR_PEN;
L_AutGetVectorProperty( pAutomation, &Props );

Props.Pen.bExtPen = FALSE;
Props.Pen.NewPen.LogPen.lopnColor = clr;
L_AutSetVectorProperty(pAutomation, &Props );
}


L_ContainerCreate

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerCreate (pContainer, hwndOwner)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
HWND hwndOwner; | /* window handle */

Creates a container and attaches it to a user defined window.

Parameter | Description
pContainer | Pointer to a container handle.
hwndOwner | Handle of the window that owns the container.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The container owner window should have CS_DBLCLKS in its class style. Otherwise some container functions will not work.

L_ContainerInit must be called before calling this function.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerIsValid, L_ContainerInit, L_ContainerSetMetrics, L_ContainerFree.
Topics: | Creating a Container

Example

/* This example shows the minimum requirements to start using some container */

/* Global container handle */
pCONTAINERHANDLE g_pLeadContainer ;

L_INT ContainerTest ( HWND hWnd )
{
CONTAINERMETRICS Metrics ;

/* Initialize the container handle */
L_ContainerInit( &g_pLeadContainer ) ;

/* Create the container and attach it to its owner window */
L_ContainerCreate( g_pLeadContainer, hWnd ) ;

if ( SUCCESS == L_ContainerIsValid( g_pLeadContainer ) ) /* the validity of the container handle */
{
/* Set the container object type to rectangle */
L_ContainerSetObjectType( g_pLeadContainer, CONTAINER_OBJECT_TYPE_RECT ) ;

/* Initiate the container metrics */
Metrics.nSize = sizeof ( CONTAINERMETRICS ) ;
Metrics.dwMask = CMF_LIMITS ;

/* Set the container limits to some value, all container inputs (after scaling) will be restricted to this range */
SetRect ( &Metrics.rcLimits, 0, 0, 500, 500 ) ;

/* Set the container metrics */
L_ContainerSetMetrics( g_pLeadContainer, &Metrics ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_ContainerEditObject

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerEditObject (pContainer, pObjectData)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
const pCONTAINEROBJECTDATA pObjectData; | /* pointer to a structure */

Displays the object specified by pObjectData and lets the user edit its properties.

Parameter | Description
pContainer | Pointer to a container handle.
pObjectData | Pointer to the structure that contains the object data to be edited.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerSetMetrics, L_ContainerGetMetrics, L_ContainerIsEnabled, L_ContainerSetEnabled
Topics | Editing Container Objects

Example

/* This example shows how to edit a container object
this example assumes that the container limits would be at least { 10, 10, 300, 200 } */

L_INT EditObjectTest ( pCONTAINERHANDLE pContainer )
{
if (SUCCESS == L_ContainerIsValid ( pContainer ) ) /* check the validity of container handle */
{
CONTAINEROBJECTDATA Data ;
CONTAINERPOLYLINEDATA PolyData ;
VECTORPOINT pt [ 7 ] ;

/* Set the Polyline points to some random numbers */
pt[0].x = 10 ; pt[0].y = 10 ;
pt[1].x = 80 ; pt[1].y = 20 ;
pt[2].x = 100 ; pt[2].y = 60 ;
pt[3].x = 10 ; pt[3].y = 40 ;
pt[4].x = 100 ; pt[4].y = 200 ;
pt[5].x = 200 ; pt[5].y = 100 ;
pt[6].x = 300 ; pt[6].y = 200 ;

/* Set the container object data */
Data.nSize = sizeof ( CONTAINEROBJECTDATA ) ;
Data.nObjectType = CONTAINER_OBJECT_TYPE_POLYLINE ;

PolyData.pvptPoints = pt ;
PolyData.nPointCount = 7 ;
Data.pObjectData = &PolyData;

/* Start editing an object */
/* Double click the left-mouse button to end editing */
/* Click right-mouse button to abort editing */
if ( SUCCESS != L_ContainerEditObject ( pContainer, &Data ) )
{
return FAILURE ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_ContainerFree

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerFree(pContainer)

pCONTAINERHANDLE pContainer;

/* pointer to a container handle */

Frees the container handle.

Parameter | Description
pContainer | Pointer to a container handle.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Freeing the container handle will detach it from its owner window.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerIsValid, L_ContainerInit.
Topics: | Initializing and Freeing a Container

Example

/* This example checks the validity of the container handle and then frees it */

L_INT FreeContainer ( pCONTAINERHANDLE pContainer )
{
if (SUCCESS == L_ContainerIsValid( pContainer ) ) /* check the validity of container handle */
{
/* Free the container handle */
L_ContainerFree ( pContainer ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_ContainerGetCallback

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerGetCallback(pContainer, ppCallback, ppUserData)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
pCONTAINERCALLBACK ppCallback; | /* pointer to get the user-defined container callback */
L_VOID L_FAR **ppUserData; | /* pointer to get the user-defined data */

Gets the current user installed callback function that is used to inform the user about the container events.

Parameter | Description
pContainer | Pointer to a container handle.
ppCallback | Pointer to the variable to be updated with the current user callback function address.
ppUserData | Pointer to the variable to be updated with a pointer to the current user data.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

If there is no user callback function current installed the function return NULL for the ppCallback and ppUserData.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerSetCallback
Topics: | Using the Container Callback

Example

/* This function will determine if the container is installed or not */
L_BOOL IsCallbackInstalled ( pCONTAINERHANDLE pContainer )
{
if ( L_ContainerIsValid ( pContainer ) ) /* check the validity of container handle */
{
pCONTAINERCALLBACK *ppConCallback ;

/* get the container callback functoin pointer */
L_ContainerGetCallback ( pContainer, ppConCallback, NULL ) ;

if ( NULL != *ppConCallback )
{
return TRUE ;
}
else
{
return FALSE ;
}
}
else
{
return FALSE ;
}
}


L_ContainerGetMetrics

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerGetMetrics(pContainer, pMetrics)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
pCONTAINERMETRICS pMetrics; | /* pointer to a structure */

Gets the current container metrics information.

Parameter | Description
pContainer | Pointer to a container handle.
pMetrics | Pointer to CONTAINERMETRICS structure to be updated with the current container metrics information.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerSetMetrics.
Topics: | Getting and Setting Container Properties

Example

L_INT SetContainerLimits ( pCONTAINERHANDLE pContainer )
{
CONTAINERMETRICS Metrics ;
HWND hwndOwner ;
RECT rcClient ;

/* Get the container owner */
L_ContainerGetOwner ( pContainer, &hwndOwner ) ;

/* Get the owner client area */
GetClientRect ( hwndOwner, &rcClient ) ;

/* Initiate the container metrics */
Metrics.nSize = sizeof ( CONTAINERMETRICS ) ;
Metrics.dwMask = CMF_LIMITS ;

/* Get the container metrics */
L_ContainerGetMetrics ( pContainer, &Metrics ) ;

if ( ! EqualRect ( &rcClient, &Metrics.rcLimits ) )
{

CopyRect ( &Metrics.rcLimits, &rcClient ) ;

/* Set the new metrics */
L_ContainerSetMetrics( pContainer, &Metrics ) ;
}

return SUCCESS ;
}


L_ContainerGetObjectCursor

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerGetObjectCursor(pContainer, nObjectType, phCursor )

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
CONTAINEROBJECTTYPE nObjectType; | /* container object type */
HCURSOR* phCursor; | /* pointer to windows cursor to get the object cursor */

Gets a copy of the specified container object cursor.

Parameter | Description
pContainer | Pointer to a container handle.
nObjectType | An integer value that represents the object for which to get the cursor.
phCursor | Pointer to the variable to be updated with the cursor.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The user is responsible for deleting the received cursor.

When phCursor is no longer needed, it should be deleted.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerSetObjectCursor
Topics: | Using Container Objects

Example

L_INT CopyContainerObjectCursor ( pCONTAINERHANDLE pContainer, HCURSOR* phCur )
{
if ( L_ContainerIsValid ( pContainer ) ) /* check the validity of container handle */
{
HCURSOR hCursor ;

/* get the container line object cursor */
L_ContainerGetObjectCursor ( pContainer, CONTAINER_OBJECT_TYPE_LINE, &hCursor ) ;

*phCur = CopyImage ( phCur, IMAGE_CURSOR, 0, 0, 0 ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_ContainerGetObjectType

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerGetObjectType(pContainer, pnObjectType )

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
pCONTAINEROBJECTTYPE pnObjectType; | /* pointer to an integer */

Gets the current container object type.

Parameter | Description
pContainer | Pointer to a container handle.
pnObjectType | Point to the variable to be updated with the current object type.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerSetObjectType
Topics: | Using Container Objects

Example

L_INT GetObjectTypeTest ( pCONTAINERHANDLE pContainer )
{
if ( L_ContainerIsValid ( pContainer ) ) /* check the validity of container handle */
{
L_INT nObjectType ;

/* get the current container object */
L_ContainerGetObjectType ( pContainer, &nObjectType ) ;

/* stick to line object */
if ( CONTAINER_OBJECT_TYPE_LINE != nObjectType )
{
/* set the container object */
L_ContainerSetObjectType ( pContainer, CONTAINER_OBJECT_TYPE_LINE ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_ContainerGetOffset

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerGetOffset(pContainer, pnXOffset, pnYOffset, pnZOffset)

pCONTAINERHANDLE pContainer ; | /* pointer to a container handle */
L_INT *pnXOffset ; | /* pointer to get the x-coordinates offset */
L_INT *pnYOffset ; | /* pointer to get the y-coordinates offset */
L_INT *pnZOffset ; | /* pointer to get the z-coordinates offset */

Gets the current container coordinates offset values.

Parameter | Description
pContainer | Pointer to a container handle.
pnXOffset | Pointer to the value that will receive the offset of the external representation in the x direction.
pnYOffset | Pointer to the value that will receive the offset of the external representation in the y direction.
pnZOffset | Pointer to the value that will receive the offset of the external representation in the z direction.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The offsets that this function will set will be without any transformations.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerSetOffset.
Topics: | Container Offsets

Example

L_INT GetOffsetTest (pCONTAINERHANDLE pContainer)
{
if ( L_ContainerIsValid ( pContainer ) ) /* check the validity of container handle */
{
L_INT x, y, z ;

/* get the current offset values for the container */
L_ContainerGetOffset ( pContainer, &x, &y, &z ) ;

x ++ ;
y ++ ;

/* set the current offset values for the container */
L_ContainerSetOffset ( pContainer, x, y, z ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_ContainerGetOwner

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerGetOwner(pContainer, phwndOwner)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
HWND *phwndOwner; | /* pointer to a window handle */

Gets the handle to the window that owns the container.

Parameter | Description
pContainer | Pointer to a container handle.
phwndOwner | Pointer to a window handle to be updated with the handle of the window that owns the container.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerCreate, L_ContainerSetOwner
Topics: | Getting and Setting Container Properties

Example

For an example, refer to L_ContainerUpdate.


L_ContainerGetScalar

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerGetScalar(pContainer, pvptScalarNum, pvptScalarDen )

pCONTAINERHANDLE pContainer ; | /* pointer to a container handle */
pVECTORPOINT pvptScalarNum ; | /* pointer to a structure */
pVECTORPOINT pvptScalarDen ; | /* pointer to a structure */

Gets the current container coordinates scaling values.

Parameter | Description
pContainer | Pointer to a container handle.
pvptScalarNum | Pointer to VECTORPOINT structure to be updated with the numerator of the scaling factors for the x, y and z directions.
pvptScalarDen | Pointer to VECTORPOINT structure to be updated with the denominator of the scaling factors for the x, y and z directions.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerSetScalar.
Topics: | Container Scaling Values

Example

For an example, refer to L_ContainerSetScalar.


L_ContainerInit

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerInit(ppContainer)

ppCONTAINERHANDLE ppContainer;

/* pointer to a container handle */

Initializes the container handle.

Parameter | Description
ppContainer | Pointer to the container handle to be initialized.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function must be called before calling any other container functions.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerIsValid, L_ContainerSetMetrics, L_ContainerFree.
Topics: | Initializing and Freeing a Container

Example

For an example, refer to L_ContainerCreate.


L_ContainerIsEnabled

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerIsEnabled(pContainer, pfEnabled)

pCONTAINERHANDLE pContainer ; | /* pointer to a container handle */
L_BOOL* pfEnabled; | /* pointer to a variable to be updated */

Determine if the container is currently enabled or not.

Parameter | Description
pContainer | Pointer to a container handle.
pfEnabled | Pointer to the variable to be updated with the state of the container. Possible values are:
 | Value | Meaning
 | TRUE | The container is enabled.
 | FALSE | The container is disabled.

Comments

The container must be enabled in order to edit objects.

To enable or disable a container, use L_ContainerSetEnable.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerSetEnabled
Topics: | Getting and Setting Container Properties

Example

For an example, refer to L_ContainerSetEnabled.


L_ContainerIsOwnerDraw

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerIsOwnerDraw(pContainer, pfOwnerDraw )

pCONTAINERHANDLE pContainer ; | /* pointer to a container handle */
L_BOOL* pfOwnerDraw; | /* pointer to a variable to be updated */

Determines if the container is in owner draw mode or not.

Parameter | Description
pContainer | Pointer to a container handle.
pfOwnerDraw | Pointer to the variable to be updated with the container's current owner draw mode. Possible values:
 | Value | Meaning
 | TRUE | The container is in owner draw mode.
 | FALSE | The container is not in owner draw mode.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

If owner draw mode is disabled, the drawing of objects in the container is handled automatically. If owner draw mode is enabled, the user must handle all aspects of drawing objects in the container.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerSetOwnerDraw
Topics: | Getting and Setting Container Properties

Example

For an example, refer to L_ContainerSetOwnerDraw.


L_ContainerIsValid

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerIsValid(pContainer)

pCONTAINERHANDLE pContainer;

/* pointer to a container handle */

Determines the validity of the given container handle.

Parameter | Description
pContainer | Pointer to a container handle.

Returns

SUCCESS | The handle is valid.
< 1 | The handle is not valid. Refer to Return Codes.

Comments

The container handle will be valid after calling L_ContainerInit and L_ContainerCreate.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerInit, L_ContainerCreate, L_ContainerFree
Topics: | Initializing and Freeing a Container

Example

For an example, refer to L_ContainerCreate.


L_ContainerReset

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerReset(pContainer)

pCONTAINERHANDLE pContainer;

/* pointer to a container handle */

Erases the contents of the container from the screen.

Parameter | Description
pContainer | Pointer to a container handle.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function erases the contents of the container from the screen drawing, but it does not reset the actual container data.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerUpdate
Topics: | Displaying Objects

Example

/* This example will reset the container drawing contents */

L_INT ResetContainer ( pCONTAINERHANDLE pContainer )
{
if (SUCCESS == L_ContainerIsValid ( pContainer ) ) /* check the validity of container handle */
{
/* Reset the container drawing on the screen (if any) */
L_ContainerReset ( pContainer ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_ContainerSetCallback

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerSetCallback(pContainer, pCallback, pUserData)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
const pCONTAINERCALLBACK pCallback; | /*optional callback function */
L_VOID L_FAR * pUserData; | /* pointer to more parameters for the callback */

Specifies a callback function for handling container events.

Parameter | Description
pContainer | Pointer to a container handle.
pCallback | Optional callback function for additional processing. If you do not provide a callback function, use NULL as the value of this parameter. If you do provide a callback function, use the function pointer as the value of this parameter. The callback function must adhere to the function prototype described in CONTAINERCALLBACK Function.
pUserData | Void pointer that you can use to pass one or more additional parameters that the callback function needs.
 | To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID L_FAR *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.
 | If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | CONTAINERCALLBACK, L_ContainerGetCallback
Topics: | Using the Container Callback

Example

L_INT EXT_CALLBACK LeadContainerProc
(
pCONTAINERHANDLE pContainer,
CONTAINEREVENTTYPE nEventType,
L_VOID L_FAR *pEventData,
L_VOID L_FAR *pUserData
)
{
pCONTAINEROBJECTDATA pObjectData = ( pCONTAINEROBJECTDATA ) pEventData ;

switch ( nEventType )
{
case CONTAINER_EVENT_TYPE_DRAW:
{
switch ( pObjectData->nObjectType )
{
/* Process the point object events */
case CONTAINER_OBJECT_TYPE_POINT:
{
switch ( pObjectData->fState )
{
case CONTAINER_STATE_BEGIN:
break ;

case CONTAINER_STATE_PROCESS:
break ;

case CONTAINER_STATE_END:
break ;

case CONTAINER_STATE_ABORT:
break ;
}
}

break ;

/* Process the line object events */
case CONTAINER_OBJECT_TYPE_LINE:
{
switch ( pObjectData->fState )
{
case CONTAINER_STATE_BEGIN:
break ;

case CONTAINER_STATE_PROCESS:
break ;

case CONTAINER_STATE_END:
break ;

case CONTAINER_STATE_ABORT:
break ;
}
}

break ;

/* Process the square object events */
case CONTAINER_OBJECT_TYPE_SQUARE:
{
switch ( pObjectData->fState )
{
case CONTAINER_STATE_BEGIN:
break ;

case CONTAINER_STATE_PROCESS:
break ;

case CONTAINER_STATE_END:
break ;

case CONTAINER_STATE_ABORT:
break ;
}
}
break ;

/* Process the rectangle object events */
case CONTAINER_OBJECT_TYPE_RECT:
{
switch ( pObjectData->fState )
{
case CONTAINER_STATE_BEGIN:
break ;

case CONTAINER_STATE_PROCESS:
break ;

case CONTAINER_STATE_END:
break ;

case CONTAINER_STATE_ABORT:
break ;
}
}

break ;

/* Process the circle object events */
case CONTAINER_OBJECT_TYPE_CIRCLE:
{
switch ( pObjectData->fState )
{
case CONTAINER_STATE_BEGIN:
break ;

case CONTAINER_STATE_PROCESS:
break ;

case CONTAINER_STATE_END:
break ;

case CONTAINER_STATE_ABORT:
break ;
}
}

break ;

/* Process the ellipse object events */
case CONTAINER_OBJECT_TYPE_ELLIPSE:
{
switch ( pObjectData->fState )
{
case CONTAINER_STATE_BEGIN:
break ;

case CONTAINER_STATE_PROCESS:
break ;

case CONTAINER_STATE_END:
break ;

case CONTAINER_STATE_ABORT:
break ;
}
}

break ;

/* Process the polyline object events */
case CONTAINER_OBJECT_TYPE_POLYLINE:
{
switch ( pObjectData->fState )
{
case CONTAINER_STATE_BEGIN:
break ;

case CONTAINER_STATE_PROCESS:
break ;

case CONTAINER_STATE_END:
break ;

case CONTAINER_STATE_ABORT:
break ;
}
}

break ;

/* Process the bezier object events */
case CONTAINER_OBJECT_TYPE_BEZIER:
{
switch ( pObjectData->fState )
{
case CONTAINER_STATE_BEGIN:
break ;

case CONTAINER_STATE_PROCESS:
break ;

case CONTAINER_STATE_END:
break ;

case CONTAINER_STATE_ABORT:
break ;
}
}

break ;
}
}

break ;
}

return SUCCESS ;
}

/* Global container handle */
pCONTAINERHANDLE g_pLeadContainer ;

L_INT ContainerTest ( HWND hWnd )
{
CONTAINERMETRICS Metrics ;

/* Initiate the container handle */
L_ContainerInit ( &g_pLeadContainer ) ;

/* Create the container and attach it to its owner window */
L_ContainerCreate ( g_pLeadContainer, hWnd ) ;

if (SUCCESS == L_ContainerIsValid ( g_pLeadContainer ) ) /* check the validity of the container handle */
{
/* Set the container object type to rectangle */
L_ContainerSetObjectType ( g_pLeadContainer, CONTAINER_OBJECT_TYPE_RECT ) ;

/* Initiate the container metrics */
Metrics.nSize = sizeof ( CONTAINERMETRICS ) ;
Metrics.dwMask = CMF_LIMITS ;

/* Set the container limits to some value */
SetRect ( &Metrics.rcLimits, 0, 0, 500, 500 ) ;

/* Set the container metrics */
L_ContainerSetMetrics ( g_pLeadContainer, &Metrics ) ;

L_ContainerSetCallback ( g_pLeadContainer, LeadContainerProc, NULL ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_ContainerSetEnabled

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerSetEnabled(pContainer, fEnable)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
L_BOOL fEnable; | /* enable/disable flag */

Enables or disables the container.

Parameter | Description
pContainer | Pointer to a container handle.
fEnable | Flag that indicates whether to enable or disable the container. Possible values are:
 | Value | Meaning
 | TRUE | enable the container.
 | FALSE | disable the container.

Comments

In order to edit objects in a container, the container must be enabled.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerIsEnabled.
Topics: | Getting and Setting Container Properties

Example

/* This example toggles the enabling state of the container */

L_INT ContainerToggleEnable ( pCONTAINERHANDLE pContainer )
{
L_BOOL fEnable ;

/* Get the enabling state of the container */
L_ContainerIsEnabled ( pContainer, &fEnable ) ;

/* Toggle the state and return */
return L_ContainerSetEnabled ( pContainer, ! fEnable ) ;
}


L_ContainerSetMetrics

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerSetMetrics(pContainer, pMetrics)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
pCONTAINERMETRICS pMetrics; | /* pointer to a structure */

Set the container necessary information.

Parameter | Description
pContainer | Pointer to a container handle.
pMetrics | Pointer to the CONTAINERMETRICS structure that contains the metrics values to set.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerInit, L_ContainerGetMetrics
Topics: | Getting and Setting Container Properties

Example

For an example, refer to L_ContainerCreate.


L_ContainerSetObjectCursor

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerSetObjectCursor (pContainer, nObjectType, hCursor)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
CONTAINEROBJECTTYPE nObjectType; | /* container object type */
HCURSOR hCursor; | /* handle to a windows cursor */

Sets the container object cursor.

Parameter | Description
pContainer | Pointer to a container handle.
nObjectType | An integer that represents the object type for which to set the cursor. Possible values are:
 | Value | Meaning
 | CONTAINER_OBJECT_TYPE_POINT | Point object
 | CONTAINER_OBJECT_TYPE_LINE | Line object
 | CONTAINER_OBJECT_TYPE_SQUARE. | Square object
 | CONTAINER_OBJECT_TYPE_RECT | Rectangular object
 | CONTAINER_OBJECT_TYPE_ELLIPSE | Elliptical object
 | CONTAINER_OBJECT_TYPE_CIRCLE | Circular object
 | CONTAINER_OBJECT_TYPE_POLYLINE | Polyline object
 | CONTAINER_OBJECT_TYPE_BEZIER | Bezier curve object
 | CONTAINER_OBJECT_TYPE_ARC | Arc object
 | CONTAINER_OBJECT_TYPE_TEXT | Text object
hCursor | The new object cursor.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The cursor set by this function will be shown every time that specific object type is drawn in the container. For example, if a rectangle is being drawn in the container, the cursor set for object type CONTAINER_OBJECT_TYPE_RECT will be displayed. The container makes a copy of the cursor. Therefore, the user can delete a specific cursor.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerGetObjectCursor.
Topics: | Using Container Objects

Example

/* This example shows how to set some container object cursor */

/* Global container handle */
pCONTAINERHANDLE g_pLeadContainer ;

L_INT SetCursorTest ( HWND hWnd )
{
CONTAINERMETRICS Metrics ;

/* Initiate the container handle */
L_ContainerInit ( &g_pLeadContainer ) ;

/* Create the container and attach it to its owner window */
L_ContainerCreate ( g_pLeadContainer, hWnd ) ;

if (SUCCESS == L_ContainerIsValid ( g_pLeadContainer ) ) /* check the validity of the container handle */
{
HCURSOR hRectCursor ;

/* Load some cursor */
hRectCursor = LoadCursor ( NULL, IDC_CROSS ) ;

/* Set the rectangle object cursor */
L_ContainerSetObjectCursor ( g_pLeadContainer, CONTAINER_OBJECT_TYPE_RECT, hRectCursor ) ;

/* Destroy the cursor, because its not needed any more */
DestroyCursor ( hRectCursor ) ;

/* Set the container object type to rectangle */
L_ContainerSetObjectType ( g_pLeadContainer, CONTAINER_OBJECT_TYPE_RECT ) ;

/* Initiate the container metrics */
Metrics.nSize = sizeof ( CONTAINERMETRICS ) ;
Metrics.dwMask = CMF_LIMITS ;

/* Set the container limits to some value */
SetRect ( &Metrics.rcLimits, 0, 0, 500, 500 ) ;

/* Set the container metrics */
L_ContainerSetMetrics ( g_pLeadContainer, &Metrics ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_ContainerSetObjectType

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerSetObjectType(pContainer, nObjectType)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
CONTAINEROBJECTTYPE nObjectType; | /* container object type */

Sets the container object drawing type.

Parameter | Description
pContainer | Pointer to a container handle.
nObjectType | An integer value that indicates the object type to set. Possible values are:
 | Value | Meaning
 | CONTAINER_OBJECT_TYPE_POINT | The object is a point, nothing is drawn to the screen.
 | CONTAINER_OBJECT_TYPE_LINE | The object is a line. The container will start drawing a line when the user presses the left mouse button, and will continue drawing the line as the user drags the mouse. The drawing will end when the user releases the left mouse button or presses the right mouse button.
 | CONTAINER_OBJECT_TYPE_SQUARE | The object is a square. The container will start drawing a square when the user presses the left mouse button, and will continue drawing the square as the user drags the mouse. The drawing will end when the user releases the left mouse button or presses the right mouse button.
 | CONTAINER_OBJECT_TYPE_RECT | The object is a rectangle. The container will start drawing a rectangle when the user presses the left mouse button, and will continue drawing the rectangle as the user drags the mouse. The drawing will end when the user releases the left mouse button or presses the right mouse button.
 | CONTAINER_OBJECT_TYPE_CIRCLE | The object is a circle. The container will start drawing a circle when the user presses the left mouse button, and will continue drawing the circle as the user drags the mouse. The drawing will end when the user releases the left mouse button or presses the right mouse button.
 | CONTAINER_OBJECT_TYPE_ELLIPSE | The object is an ellipse. The container will start drawing an ellipse when the user presses the left mouse button, and will continue drawing the ellipse as the user drags the mouse. The drawing will end when the user releases the left mouse button or presses the right mouse button.
 | CONTAINER_OBJECT_TYPE_POLYLINE | The object is a polygon. The container will start drawing a polygon when the user presses the left mouse button, and will continue drawing the polygon as the user drags the mouse. The drawing will end when the user double clicks the left mouse button. Drawing is aborted when the user presses the right mouse button.
 | CONTAINER_OBJECT_TYPE_BEZIER | The object is a Bezier curve. The container will start drawing a Bezier curve when the user presses the left mouse button, and will continue drawing the curve as the user drags the mouse. The drawing will end when the user double clicks the left mouse button. Drawing is aborted when the user presses the right mouse button. The user can manipulate the curve control points, after drawing the first curve, by using the left mouse button to move the first curve control point and the SHIFT+left mouse button to move the second control point.
 | CONTAINER_OBJECT_TYPE_ARC | The object is an arc. The arc is drawn by specifying its center, radius, start angle and sweep angle. The user presses the left mouse button at the point where the center of the arc (the vertex about which the arc sweeps) will be. Holding the left mouse button down, the user drags the mouse the length of the radius, along the desired start angle and releases the left mouse button. Press the left mouse button again and drag the mouse through the desired sweep angle. Release the mouse button. Releasing the mouse button will end the operation. Clicking the right-mouse button will abort the operation.
 | CONTAINER_OBJECT_TYPE_TEXT | The object is a text object. The user specifies the text box dimensions by pressing the left-mouse button and dragging the mouse. The desired text can then be entered in the text box. Double-clicking anywhere outside the text box will end the operation. Clicking the right-mouse button will abort the operation. The properties of the text will be specified through the container metrics.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerGetObjectType
Topics: | Using Container Objects

Example

For an example, refer to L_ContainerCreate.


L_ContainerSetOffset

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerSetOffset(pContainer, nXOffset, nYOffset, nZOffset)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
L_INT nXOffset; | /* x-coordinates offset */
L_INT nYOffset; | /* y-coordinates offset */
L_INT nZOffset; | /* z-coordinates offset */

Sets the container coordinates offset values.

Parameter | Description
pContainer | Pointer to a container handle.
nXOffset | The X offset of the external representation.
nYOffset | The Y offset of the external representation.
nZOffset | The Z offset of the external representation.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The user should set the offset every time the window that owns the container is scrolled. When assigning an external representation to the container, every point (Xa, Ya) in the external representation is transformed by the container to the point (Xc, Yc) by using the following steps:

1. Add offsets:

Xb = Xa + nXOffset

2. Multiply by scalars:

Xc = (Xb * nXScalarNum) / nXScalarDen

Yc = (Yb * nYScalarNum) / nYScalarDen

The default offset values are nXOffset=0, nYOffset=0, and nZOffset=0.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerSetScalar, L_ContainerGetOffset
Topics: | Container Offsets

Example

/* This will show to modify the container coordinates offset values to reflect the changes in the window offset */
static L_VOID OnSize
(
HWND hWnd,
pCONTAINERHANDLE pContainer,
pBITMAPHANDLE pBitmap,
LPRECT prcView,
L_INT cx,
L_INT cy,
L_INT nZoom,
L_INT *pnHScroll,
L_INT *pnVScroll
)
{
SCROLLINFO si ;
L_INT nXOffset, nYOffset ;

if ( NULL != pBitmap && pBitmap->Flags.Allocated )
{
si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_ALL ;

// vertical scroll.
GetScrollInfo ( hWnd, SB_VERT, &si ) ;
si.nMin = 0 ;
si.nMax = BITMAPHEIGHT ( pBitmap ) ;
si.nPage = MulDiv ( cy, 100, nZoom ) ;
SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;
GetScrollInfo ( hWnd, SB_VERT, &si ) ;
*pnVScroll = si.nPos ;
// horizontal scroll
GetScrollInfo ( hWnd, SB_HORZ, &si ) ;
si.nMin = 0 ;
si.nMax = BITMAPWIDTH ( pBitmap ) ;
si.nPage = MulDiv ( cx, 100, nZoom ) ;

SetScrollInfo ( hWnd, SB_HORZ, &si, TRUE ) ;
GetScrollInfo ( hWnd, SB_HORZ, &si ) ;
*pnHScroll = si.nPos ;
}
else
{
si.cbSize = sizeof ( SCROLLINFO ) ;
si.fMask = SIF_RANGE ;
si.nMin = 0 ;
si.nMax = 0 ;
SetScrollInfo ( hWnd, SB_VERT, &si, TRUE ) ;
SetScrollInfo ( hWnd, SB_HORZ, &si, TRUE ) ;
*pnHScroll = 0 ;
*pnVScroll = 0 ;
}
// set the painting rectangel.
SetRect ( prcView, 0, 0, BITMAPWIDTH ( pBitmap ), BITMAPHEIGHT ( pBitmap ) ) ;
if ( nZoom < 100 )
{
nXOffset = MulDiv ( *pnHScroll, 100, nZoom ) ;
nYOffset = MulDiv ( *pnVScroll, 100, nZoom ) ;
}
else
{
nXOffset = *pnHScroll ;
nYOffset = *pnVScroll ;
}
OffsetRect ( prcView, - nXOffset, - nYOffset ) ;
prcView->left = MulDiv ( prcView->left, nZoom, 100 ) ;
prcView->top = MulDiv ( prcView->top, nZoom, 100 ) ;
prcView->right = MulDiv ( prcView->right, nZoom, 100 ) ;
prcView->bottom = MulDiv ( prcView->bottom, nZoom, 100 ) ;
L_ContainerSetOffset ( pContainer, - prcView->left, - prcView->top, 0 ) ;
}


L_ContainerSetOwner

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerSetOwner(pContainer, hWndOwner)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
HWND hWndOwner; | /* window handle */

Sets the container owner window.

Parameter | Description
pContainer | Pointer to a container handle.
hWndOwner | Handle of the window to set as the owner of the container.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerCreate, L_ContainerGetOwner
Topics: | Getting and Setting Container Properties

Example

/* This example will set a new owner to the container */

L_INT SetOwnerTest ( pCONTAINERHANDLE pContainer, HWND hwndNewOwner )
{
if (SUCCESS == L_ContainerIsValid ( pContainer ) ) /* check the validity of container handle */
{
/* Set the window new owner window */
if ( SUCCESS != L_ContainerSetOwner ( pContainer, hwndNewOwner ) )
{
return FAILURE ;
}
else
{
return SUCCESS ;
}
}
else
{
return FAILURE ;
}
}


L_ContainerSetOwnerDraw

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerSetOwnerDraw(pContainer, fOwnerDraw, dwFlags)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
L_BOOL fOwnerDraw; | /* owner-draw enable/disable flag */
L_UINT32 dwFlags; | /* reserved */

Sets the container to owner draw mode.

Parameter | Description
pContainer | Pointer to a container handle.
fOwnerDraw | Flag that indicates whether to enable or disable the container owner draw mode. Possible values are:
 | Value | Meaning
 | TRUE | enable owner draw mode.
 | FALSE | disable owner draw mode.
dwFlags | Reserved for future use. Must be 0.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

When the owner draw mode is enabled the container will not draw the object path any more. The user will be responsible for all the drawing issues.

When the owner draw mode is disabled, the drawing of objects is handled automatically. If the owner draw mode is enabled, the user must handle all aspects of drawing objects.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerIsOwnerDraw
Topics: | Getting and Setting Container Properties

Example

/* This example toggles the owner draw mode of the container */

L_INT ContainerToggleOwnerDraw ( pCONTAINERHANDLE pContainer )
{
L_BOOL fOwnerDraw ;

/* Get the owner draw mode of the container */
L_ContainerIsOwnerDraw( pContainer, &fOwnerDraw ) ;

/* Toggle the state and return */
return L_ContainerSetOwnerDraw( pContainer,!fOwnerDraw, 0 ) ;
}


L_ContainerSetScalar

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerSetScalar(pContainer, pvptScalarNum, pvptScalarDen)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
pVECTORPOINT pvptScalarNum; | /* Numerator scaling values */
pVECTORPOINT pvptScalarDen; | /* Denominator scaling values */

Sets the container scaling values that will be used to adjust the coordinates values.

Parameter | Description
pContainer | Pointer to a container handle.
pvptScalarNum | Pointer to structure of type VECTORPOINT that contains the numerator to scale the coordinates in the X,Y and Z directions.
pvptScalarDen | Pointer to structure of type VECTORPOINT that contains the denominator to scale the coordinates in the X,Y and Z directions.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

When assigning an external representation to the container, every point (Xa, Ya) in the external representation is transformed by the container to the point (Xc, Yc) by using the following steps:

1. Add offsets:

Xb = Xa + nXOffset

2. Multiply by scalars:

Xc = (Xb * nXScalarNum) / nXScalarDen

Yc = (Yb * nYScalarNum) / nYScalarDen

The default offset values are nXOffset=0, nYOffset=0, and nZOffset=0.

The default scalar values are:

ScalarNum.x = 1

ScalarNum.y = 1

ScalarNum.z = 1

ScalarDen.x = 1

ScalarDen.y = 1

ScalarDen.z = 1

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerSetOffset, L_ContainerGetScalar
Topics: | Container Scaling Values

Example

/* This example shows how to set the container coordinates scaling factors */

L_INT SetScalarTest ( pCONTAINERHANDLE pContainer )
{
if (SUCCESS == L_ContainerIsValid ( pContainer ) ) /* check the validity of container handle */
{
VECTORPOINT vptScalarNum, vptScalarDen ;

/* get the current scaling values */
L_ContainerGetScalar (pContainer, &vptScalarNum, &vptScalarDen ) ;

/* Set the horizontal scaling factor */
vptScalarNum.x ++ ;
vptScalarDen.x = 1 ;

/* Set the vertical scaling factor */
vptScalarNum.y ++ ;
vptScalarDen.y = 1 ;

/* Set the z scaling factor to 1:1 factor */
vptScalarNum.z = 1 ;
vptScalarDen.z = 1 ;

L_ContainerSetScalar (pContainer, &vptScalarNum, &vptScalarDen ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_ContainerUpdate

#include "LtCon.h"

L_INT EXT_FUNCTION L_ContainerUpdate(pContainer, prcPaint)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
LPRECT prcPaint; | /* pointer to the RECT structure to be updated */

Updates the container client area.

Parameter | Description
pContainer | Pointer to a container handle.
prcPaint | Pointer to the RECT structure that contains the coordinates of the smallest rectangle that completely encloses the region of the container to update. These coordinates are with respect to the client area of the window that owns the container. The rectangle coordinates are logical coordinates .If this parameter is NULL, this function will update the entire container owner client area.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_ContainerReset
Topics: | Displaying Objects

Example

/* This example will update the container current drawing (if any) */

L_INT UpdateContainer ( pCONTAINERHANDLE pContainer )
{
if (SUCCESS == L_ContainerIsValid ( pContainer ) ) /* check the validity of container handle */
{
HWND hWndOwner ;
RECT rcOwnerClient ;

/* Get the container owner window */
L_ContainerGetOwner ( pContainer, &hWndOwner ) ;

/* Get the owner client rectangle */
GetClientRect ( hWndOwner, &rcOwnerClient ) ;

/* Update the container drawing to the screen */
L_ContainerUpdate ( pContainer, &rcOwnerClient ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


CONTAINERCALLBACK

#include "LtCon.h"

L_INT EXT_CALLBACK YourFunction(pContainer, nEventType, pEventData, pUserData)

pCONTAINERHANDLE pContainer; | /* pointer to a container handle */
CONTAINEREVENTTYPE nEventType; | /* container event type */
L_VOID L_FAR * pEventData; | /* pointer to event specific data */
L_VOID L_FAR * pUserData; | /* pointer to additional parameters */

Handles each event that occurs in the container.

Parameter | Description
pContainer | Pointer to a container handle.
nEventType | The type of the event sent by the container. Possible values are:
 | Value | Meaning
 | CONTAINER_EVENT_TYPE_DRAW | The container is now drawing.
pEventData | Pointer to a structure that contains data associated with the event specified in nEventType. When nEventType is CONTAINER_EVENT_TYPE_DRAW, then the pEventData must be type pCONTAINEROBJECTDATA.
 | Keep in mind that this is a void pointer, which must be cast to the appropriate data type for the event data.
pUserData | A void pointer that you can use to access a variable or structure containing data that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. (This is the same pointer that you pass in the pUserData parameter of the calling function.)
 | Keep in mind that this is a void pointer, which must be cast to the appropriate data type within your callback function.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTCON

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

L_ContainerSetCallback, L_ContainerGetCallback.

Example

For an example, refer to L_ContainerSetCallBack.


AUTOMATIONENUMCONTAINERPROC

#include "ltaut.h"

L_INT pEXT_CALLBACK YourFunction (pContainer, pUserData )

pCONTAINERHANDLE pContainer ; | /* pointer to a container handle */
L_VOID L_FAR * pUserData ; | /* pointer to additional parameters */

Processes each container enumerated by the L_AutEnumContainers function.

Parameter | Description
pContainer | Pointer to a container handle.
pUserData | Void pointer that you can use to access a variable or structure containing data that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. (This is the same pointer that you pass in the pUserData parameter of the L_AutEnumContainers function.)
 | Keep in mind that this is a void pointer, which must be cast to the appropriate data type within this callback function.

Returns

This function must return SUCCESS for the enumeration to continue. If anything else is returned, the enumeration will be stopped.

SUCCESS | The function was successful.
<> SUCCESS | Stop the enumeration. An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

L_AutEnumContainers

Example

For an example refer to L_AutEnumContainers.


Raster Pro/Document/Medical Features

Raster Pro:

LEADTOOLS Raster Imaging Pro provides some imaging capabilities that are not available in the LEADTOOLS Raster Imaging product. In order to access these features, you must unlock them by calling L_UnlockSupport(L_SUPPORT_LTPRO, L_KEY_LTPRO). L_KEY_LTPRO can be found in ltkey.h.

If you are a licensed user of LEADTOOLS Raster Imaging, and would like to access Raster Imaging Pro features, you must contact Tech Support for information on obtaining a license and the unlock key for calling L_UnlockSupport.

Document/Medical:

LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite are the most comprehensive imaging toolkits on the market. No other toolkit provides as many imaging features for color, gray-scale and black & white images in one development package, and for one price. These toolkits comprise LEAD's best code and are designed for the programmer who is looking for the fastest performance, and/or the most extensive color, document, and medical imaging capabilities available.

These toolkits contain powerful annotation capabilities and optimized document image processing filters, and high performance compression, decompression and viewing of JPEG, LEAD CMP, MRC and CCITT G3/G4. The annotation capabilities enable the programmer to add text, highlights, sticky notes, audio, ellipses, buttons, lines, arrows, rectangles, polygons, redaction (blackout), hotspots, freehand scribble, pointers, bitmap and text stamps, to black & white and color images. Programmers working with document imaging will also find special processing filters such as despeckle, deskew, favor black, and scale to gray to enhance their black and white 1 bit images. Additionally, you can achieve faster rotation in 90-degree increments by applying a rotated view perspective to the bitmap. These LEADTOOLS toolkits offer the fastest software-only JPEG decoder available.

LEADTOOLS Document Imaging

The LEADTOOLS Document Imaging toolkit contains all the features available in the LEADTOOLS Raster Imaging Pro. In addition, it contains the following capabilities:

Special functions for Document (bitonal) images. The LEADTOOLS functions for bitonal images are especially useful for working with images from black-and-white scanners or FAX machines. These functions let you do things such as automatically straighten (deskew) an image, remove spots (despeckle), or clarify a scaled display (using scale-to-gray and favor-black features).

Annotation. LEADTOOLS supports annotation of images by letting you overlay images with text, lines, shapes, arrows, buttons, highlights, hot spots, sticky notes, stamps, buttons, and sounds.

Fast rotation. LEADTOOLS achieves fast rotation in 90-degree increments by applying a rotated view perspective to the bitmap.

ISIS support. LEADTOOLS supports ISIS interfaces for driving scanning devices.

Faster compression and decompression. The Document/Medical editions work faster when loading and saving LEAD CMP, JPEG, and CCITT Group 3 and Group 4 images. The LEADTOOLS functions for loading and saving are the same in all products. The only difference is in performance.

1-bit Image Clean-up. The Document toolkits include support for removing dots, blobs, holes, inverted text, lines, borders, bumps and nicks from 1-bit images.

Region Clean-up. [Document/Medical] Remove all the holes from a region.

Embedded Messages. The Document toolkits include support for embedding messages in lossless image formats like bmp, tiff, lossless jpeg, etc. The message is embedded without any visible changes to the image, and does not appreciably increase the size of the image. The message is password-protected.

Image Conversion. The Document toolkits include support for transforming a bitmap into a binary image using specified thresholds or a threshold calculated automatically based on statistical features of the bitmap.

12 and 16 bit grayscale images. [Document/Medical] Load, process, display, window level and save 12 and 16 bit grayscale images (including support for 16-bit grayscale TIFF).

48 and 64 bit color images. [Document/Medical] Load, process, display, and save 48 and 64 bit color images.

MRC Support. [Document/Medical] LEADTOOLS supports the Mixed Raster Content format for color documents containing mixed image and text components. For more information, refer to the .

Halftoning. [Document/Medical] Convert 1-, 4-, 8-, 16-, 24-, or 32-bit bitmaps to a halftoned bitmap, with a specified pattern rotation. A halftoned bitmap is a 1-bit bitmap that has been dithered for black and white printing or display.

LEADTOOLS Document Imaging Suite

The LEADTOOLS Document Imaging Suite toolkit contains all the capabilities of LEADTOOLS Document Imaging, and includes the features listed below. Please note that the OCR features are included in this toolkit, however they can also be purchased as a plug-in for the LEADTOOLS Document Imaging toolkit. Also, JBIG support is provided in this toolkit, however a JBIG Module may be added on to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite.

OCR features. [Document/Medical] LEAD offers OCR features that use Scansoft Textbridge technology. Support for these features is included in the LEADTOOLS Document Imaging Suite, and can be added, via plug-in to the LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite toolkits. The OCR features allow you to perform optical character recognition and turn images into documents. Features include preset confidence and accuracy levels for controlling how sensitive the engine is to unrecognized text, artificial intelligence for improving recognition on documents of the same type, and built-in and user-defined lexicons for limiting the type of text to recognize within a particular zone. LEADTOOLS provides the ability to verify or correct text during, and (using LEAD's unique OCR editor) after recognition. LEAD's OCR editor ties the text being edited directly to the image, providing a visual reference to the original bitmap data. The OCR engine can perform Automatic area segmentation creating multi-layered zones, recognizing areas such as tables, rules, images and text. Or, you can manually designate up to 250 such zones. The OCR features support different fonts, sizes (5 to 72 point) and styles. Fax, dot matrix and halftones can be preprocessed to improve recognition results. The OCR Engine supports major European and Scandinavian languages (Danish, Dutch, Finnish, French, German, Italian, Norwegian, Portuguese, Russian, Spanish, and Swedish) as well as English. Support for dialects such as US. English, French Canadian, Latin American Spanish, Swiss German, and Brazilian Portuguese is also provided.

Recognized text can be exported to more than 40 different formats, including MS Word, MS Excel, Dbase andWordPerfect. The LEADTOOLS OCR features contain superior OCR processing speeds, for use in form recognition and processing applications.

LEAD's JBIG filter. [Document/Medical] LEAD includes support for this filter in the LEADTOOLS Document Imaging Suite toolkit. Support for this filter can be added to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite by purchasing the JBIG Module. JBIG defines a method for lossless compression encoding of a bi-level image (two-color image). This method can also be used for coding grayscale and color images. LEADTOOLS completely supports all three types of images, giving you the ability to make full use of this powerful compression technology. LEADTOOLS also supports the progressive capability of JBIG, allowing you to store and send multiple representations of images at different resolutions without any extra storage overhead.

LEADTOOLS Medical Imaging

LEADTOOLS Medical Imaging contains all the capabilities of LEADTOOLS Document Imaging. It also includes general medical imaging technologies (1-16,24,32 bit color, 1-16 bit grayscale and window leveling of 12 and 16-bit grayscale images) and support for the DICOM file format.

DICOM file support. [Medical] LEADTOOLS Medical Imaging provides COMPLETE support for the DICOM 3.0 specification, including all standard IOD classes and modalities (CR, CT, MR, NM, US, RF, SC, VL, etc.) and complete DICOM Basic Directory support.

Window leveling. [Document/Medical] Detect and set LowBit and HighBit for image data, display images with automatic LUT intensity expansion, or set LUT entries and ranges with specific values and gradients. Display images through the LUT without changing the data, or process the image data using the LUT. Linearize the number of pixels locally in a bitmap, based on the specified color space in order to bring out the detail in dark areas of an image, and smooth the edges between blocks.

Medical Imaging Processing. [Medical] LEADTOOLS Medical Imaging provides image processing functionality designed specifically to allow you to examine and improve the quality of medical images.

LEADTOOLS Medical Imaging Suite

LEADTOOLS Medical Imaging Suite contains all the capabilities of LEADTOOLS Medical Imaging. In addition, it supports the following:

DICOM Communication support. [Medical Suite] LEADTOOLS provides COMPLETE support for DICOM Communications, including all Service Classes (Verification, Storage, Query/Retrieve, Patient Management, etc), and contains high-level communications functions simplifying the creation of DICOM client/server applications.

(Document/Medical) is used in the documentation to designate the features that are available in LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite. Those features that are available only in the Medical toolkits are indicated in the documentation by (Medical). Features available only in the LEADTOOLS Medical Imaging Suite toolkit are indicated in the documentation by (Medical Suite).

(Internet only) is used in the documentation to designate the features that are available only in the LEADTOOLS Internet toolkit.

For more information, refer to Document/Medical Edition Support and Licensing Requirements .


LEADTOOLS Reference Manuals

LEADTOOLS provides reference manuals that contain the same information as the online help. You can print them from PDF files. Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

To print the PDF files, you must use the Adobe Acrobat Reader 3.0 or higher. You can download a copy of the Acrobat Reader from the Adobe web site (http://www.adobe.com). Note that different versions of the Acrobat Reader are available for different operating systems, but they all can read the same PDF files.


Topic Selection

LEAD Technologies, Inc.
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

Sales@Leadtools.com
www.leadtools.com

(704) 332-5532
FAX: (704) 372-8161
Tech Support: (704) 372-9681

LEADTOOLS is ideal for developers involved in still frame, multimedia, document, medical, and vector imaging projects, including Internet/Intranet applications. Independent of the specific application requirement – scanning, file format support/conversion, compression, image processing, annotation, database support, multimedia, etc. – LEADTOOLS provides the most comprehensive, robust, flexible, and powerful imaging solution available.

Click this button to start the Licensing help file to review the License Agreements governing your use of the software.

Click this button to start the Products help file to review the full line of LEADTOOLS Products.

Click this button to start the Imaging help file to review the full line of LEADTOOLS Image Categories.