Introduction

The LEADTOOLS Container and Automation Class Library provide classes to let you incorporate containers and automation into your Windows applications. The LEADTOOLS Container and Automation Class Library 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 4.x NT
Windows 95
Windows 2000

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\CLASSLIB\ subdirectories (such as C:\LEAD14\EXAMPLES\CLASSLIB\DEMO). The executable files for these examples were compiled with Document/Medical capabilities of the toolkit. To get Document/Medical capabilities, you must buy the 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.

VECTOR DEMO | VECTOR DEMO is the main vector example program. It uses pull-down menus to demonstrate most of the LEADTOOLS Vector features in one application. This program was compiled using a Microsoft compiler.
CLRST DEMO | CLRST DEMO uses pull-down menus to demonstrate most of the LEADTOOLS DigitalPaint features in one application. This program was compiled using a Microsoft compiler.


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 Class Library has not changed from Version 14.


Changes from Version 13 to Version 14

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

LEADTOOLS Container and Automation Class Library now supports UNICODE.


Changes from Version 12.1 to Version 13

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


Changes from Version 12 to Version 12.1

Version 12.1 of the LEADTOOLS Container and Automation Class Library has changed from Version 12 as follows:

LEADTOOLS now supports automation and container functionality for the LEADTOOLS DigitalPaint toolkit.

The rest of the topic lists the new functions:

DigitalPaint Automation Functions:

LAutomation::SetPaintProperty

LAutomation::GetPaintProperty

LAutomation::SetPaintBkColor

LAutomation::GetPaintBkColor


Version 12

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

The rest of the topic lists the new functions:

General Automation Functions:

LAutomation::AddContainer

LAutomation::AddUndoNode

LAutomation::CanRedo

LAutomation::CanUndo

LAutomation::ClipboardDataReady

LAutomation::Copy

LAutomation::Create

LAutomation::Cut

LAutomation::Delete

LAutomation::EnumContainers

LAutomation::EnumContainersCallBack

LAutomation::Free

LAutomation::GetActiveContainer

LAutomation::GetToolbar

LAutomation::GetUndoLevel

LAutomation::Initialize

LAutomation::Paste

LAutomation::Print

LAutomation::Redo

LAutomation::RemoveContainer

LAutomation::Select

LAutomation::SetActiveContainer

LAutomation::SetToolbar

LAutomation::SetUndoEnabled

LAutomation::SetUndoLevel

LAutomation::Undo

Vector Automation Functions:

LAutomation::EditVectorObject

LAutomation::GetVectorProperty

LAutomation::SetVectorProperty

Container Functions:

LContainer::ContainerCallback

LContainer::Create

LContainer::EditObject

LContainer::EnableContainerCallback

LContainer::Free

LContainer::GetMetrics

LContainer::GetObjectCursor

LContainer::GetObjectType

LContainer::GetOffset

LContainer::GetOwner

LContainer::GetScalar

LContainer::Initialize

LContainer::IsEnabled

LContainer::IsOwnerDraw

LContainer::IsValid

LContainer::Reset

LContainer::SetEnabled

LContainer::SetMetrics

LContainer::SetObjectCursor

LContainer::SetObjectType

LContainer::SetOffset

LContainer::SetOwner

LContainer::SetOwnerDraw

LContainer::SetScalar

LContainer::Update


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

Programming with LEADTOOLS Containers and Automation

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

Containers

Introduction to the Container

Initializing and Freeing Containers

Creating a Container

Container Offsets

Container Scaling Values

Displaying Objects

Editing Container Objects

Getting and Setting Container Properties

Using Container Objects

Using the Container Callback

General Automation

Initializing, Creating and Freeing Automation Handles

Automation and the Container

Automation Printing

Editing Automation Containers

The Automation Toolbar

Undoing and Redoing Automation Operations

Working with Objects within an Automation Container

Vector Automation

Introduction to Vector Automation

DigitalPaint Automation

Introduction to DigitalPaint Automation

Controlling Painting Properties


Initializing, Creating and Freeing Automation Handles

LEADTOOLS accesses automation through the AUTOMATIONHANDLE structure in an LAutomation class object. 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 LAutomation::Initialize function.

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 LAutomation::Create with the nMode parameter set to AUTOMATION_MODE_VECTOR.

When the automation handle is no longer needed, it should be freed using the LAutomation::Free function.

An automation handle is valid only after LAutomation::Initialize and LAutomation::Create have been called. The validity of an automation handle should be checked before calling any other automation functions. This is done using LAutomation::IsValid.

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 LContainer::Initialize. The container is then created and associated with a specified window using LContainer::Create. 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 LAutomation::Initialize and LAutomation::Create. Once the automation handle has been initialized and created, a container can be added to the automation list of containers using LAutomation::AddContainer. 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 LAutomation::SetActiveContainer. 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 LAutomation::GetActiveContainer.

With many containers associated with a single automation handle, it is occasionally necessary to enumerate the associated containers. LAutomation::EnumContainers enumerates all containers associated with the specified automation handle. For each container enumerated by LAutomation::EnumContainers, an LAutomation::EnumContainersCallBackfunction 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 LAutomation::RemoveContainer. After the container is removed from the automation container list, the container handle should be freed using LContainer::Free.

See Also


Automation Printing

LAutomation::Print 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 LContainer::Reset.

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

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

L_INT PrintTest (LAutomation &lauto)
{
if ( SUCCESS == lauto.IsValid () ) /* check the validity of the automation handle */
{
/* print the automation active container data */
lauto.Print () ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


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 LAutomation::SetToolbar.

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 LAutomation::GetToolbar.

To simulate a toolbar without actually using the toolbar provided by LEAD Automation, use LAutomation::GetCurrentTool and LAutomation::SetCurrentTool to get and set the current tool.


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:

LAutomation::Cut

LAutomation::Copy

LAutomation::Paste

To determine whether the clipboard contains valid automation data for pasting to the active automation container, call LAutomation::ClipboardDataReady.

LAutomation::Delete deletes objects from the active automation container.


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 LAutomation::GetUndoLevel. The default value is 16. To set a new undo level for the automation handle, call LAutomation::SetUndoLevel.

To determine whether the last automation operation performed can be undone or redone, use LAutomation::CanUndo and LAutomation::CanRedo respectively.

LAutomation::Undo undoes the last automation operation performed, while LAutomation::Redo 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 LAutomation::Undo is called.

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

L_INT AutomationUndoTest (LAutomation &lauto)
{
if ( SUCCESS == lauto.IsValid () ) /* check the validity of the automation handle */
{
L_BOOL fCanUndo ;

/* Query the ability of undoing */
fCanUndo = lauto.CanUndo () ;

if ( fCanUndo )
{
/* undo the last automation operation */
lauto.Undo () ;
}

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 LAutomation::Undo undoes the whole group of operations and not just the last operation performed. This can be accomplished using the following steps:

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

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


Working with Objects within an Automation Container

General

All objects within the active automation container may be selected or unselected using LAutomation::Select.

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 LAutomation::SetVectorProperty. To determine the current vector properties, call LAutomation::GetVectorProperty.

To edit a vector object within an automation container, call LAutomation::EditVectorObject.

See Also

Editing Container Objects

Getting and Setting Container Properties

Using Container Objects


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 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 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 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 toolkits before effectively using the automated Vector Toolkit:

Low-level Vector toolkit.

LEAD Toolbar.

LEAD Container.

Therefore, we strongly recommend that the user of the Automation Toolkit carefully read the documentation of the modules mentioned above.

The automation toolkit 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 DigitalPaint Automation

Adding automation to a paint application enables the user to add all the DigitalPaint toolkit capabilities and the associated user interfaces, to that application. The DigitalPaint automation coordinates the low-level DigitalPaint 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 DigitalPaint 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 DigitalPaint 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 DigitalPaint 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 DigitalPaint functionality:

Low-level DigitalPaint functionality.

LEAD Toolbar.

LEAD Container.

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

The automated DigitalPaint 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 DigitalPaint automation, specific properties, as well as the background color, can be set or retrieved using the following functions:

LAutomation::GetPaintBkColor

LAutomation::GetPaintProperty

LAutomation::SetPaintBkColor

LAutomation::SetPaintProperty

The LEADTOOLS DigitalPaint 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 LAutomation::SetPaintProperty function. To retrieve the current settings for the properties, use the LAutomation::GetPaintProperty 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 ( LAutomation * pAutomation )
{
if ( SUCCESS == pAutomation->IsValid() ) /* check the validity of the automation handle */
{
PAINTSHAPE shape ;

/* set the paint shape group properties */
pAutomation->GetPaintProperty ( PAINT_GROUP_SHAPE, &shape ) ;

/* make some changes 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 */
pAutomation->SetPaintProperty ( PAINT_GROUP_SHAPE, &shape ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}

For more examples showing the use of DigitalPaint automation, refer to DigitalPaint 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 LAutomation::SetPaintBkColor. To determine the current paint background color, call LAutomation::GetPaintBkColor. 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 StickToBlack (LAutomation * pAutomation)
{
if ( SUCCESS == pAutomation->IsValid ( ) ) /* check the validity of the automation handle */
{
COLORREF crBkColor ;

/* get the current paint automation color */
crBkColor = pAutomation->GetPaintBkColor () ;

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

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


Introduction to the Container

The LEADTOOLS Container Class Library 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 LContainer::Initialize function. When the CONTAINERHANDLE structure is no longer needed, it should be freed using the LContainer::Free function.

A container handle is valid only after LContainer::Initialize and LContainer::Create have been called. The validity of a container handle should be checked before calling any other container functions. This is done using LContainer::IsValid. 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 LContainer::Create function. The container will be attached to the window handle passed to LContainer::Create. In the sample given below the container 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 */
lcont.Create (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.


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 LContainer::SetOffset. To determine the current offset values, call LContainer::GetOffset. This can often be handled when processing the WM_HSCROLL and WM_VSCROLL messages.


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:

LContainer::GetScalar

LContainer::SetScalar

Offsets:

LContainer::GetOffset

LContainer::SetOffset

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


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. LContainer::Update 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. The LContainer::Reset function 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 LContainer::EditObject function. For more information on this, refer to Editing Container Objects.


Editing Container Objects

The LContainer::EditObject 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 LContainer::ContainerCallback function for processing.


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 LContainer::SetMetrics 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 LContainer::GetMetrics function.

Owner window

When a container is created using LContainer::Create, the container is attached to a window. This window becomes the owner of the container. This owner can be changed using the LContainer::SetOwner function. To determine the current owner, use the LContainer::GetOwner function.

Owner Draw Mode

One of the benefits to using the container is the automatic drawing capability it provides. However, this capability can be disabled using the LContainer::SetOwnerDraw 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 LContainer::IsOwnerDraw.

Enabled

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

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

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


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 LContainer::SetObjectType function. For example, the sample below sets the container to draw circles:

lcont.SetObjectType (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 LContainer::GetObjectType.

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 LContainer::SetObjectCursor.

To determine the cursor set for a specific object type call LContainer::GetObjectCursor.

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


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

Drawing an object within a container generates calls to the LContainer::ContainerCallback function. When the callback function receives a CONTAINER_EVENT_TYPE_DRAW event, information concerning the object being processed is also sent to the callback function in the pEventData parameter. This information includes the current state of the drawing.

Before LContainer::ContainerCallback can be used, it must be enabled using the LContainer::EnableContainerCallback function.


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 and LTWVC are required for ALL Class Library applications. For more information on LTKRN, LTWVC and other files for the Main Class Library, refer to Files To Be Included With Your Application .

Redistributables: | 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.


Classes

The following classes are provided by the LEADTOOLS Container and Automation Class Library:

LAutomation

LContainer


LAutomation

Description

The LAutomation class is derived from the LBase class. It is used in conjunction with the Container class LContainer. The LAutomation class contains the functionality for coordinating low-level toolkit functions, LEAD Container functions and LEAD Toolbar functions.

Required Libraries

You must load all required libraries using LBase::LoadLibraries before using the classes.

Ltaut14n.dll

See Also

Class Members, Class Hierarchy Chart , Parent Class


LAutomation::Class Members

Constructors / Destructors

Initializing, Creating and Freeing

Automation Container

Automation Toolbar

Undoing/Redoing Operations

Editing Automation Containers

Automation Printing

Vector Objects in an Automation Container

DigitalPaint Automation Properties

Return to LAutomation

Constructors / Destructors

LAutomation::LAutomation()

LAutomation::~LAutomation()

Initializing, Creating and Freeing

LAutomation::Create

LAutomation::Initialize

LAutomation::Free

LAutomation::IsValid

Automation Container

LContainer::Initialize

LContainer::Create

LContainer::Free

LAutomation::Initialize

LAutomation::Create

LAutomation::Select

LAutomation::AddContainer

LAutomation::GetActiveContainer

LAutomation::SetActiveContainer

LAutomation::EnumContainers

LAutomation::RemoveContainer

Automation Toolbar

LAutomation::GetToolbar

LAutomation::SetToolbar

Undoing/Redoing Operations

LAutomation::AddUndoNode

LAutomation::CanUndo

LAutomation::GetUndoLevel

LAutomation::SetUndoEnabled

LAutomation::SetUndoLevel

LAutomation::Undo

LAutomation::CanRedo

LAutomation::Redo

Editing Automation Containers

LAutomation::ClipboardDataReady

LAutomation::Copy

LAutomation::Cut

LAutomation::Delete

LAutomation::Paste

Automation Printing

LAutomation::Print

Vector Objects in an Automation Container

LAutomation::EditVectorObject

LAutomation::GetVectorProperty

LAutomation::SetVectorProperty

DigitalPaint Automation Properties

LAutomation::SetPaintProperty

LAutomation::GetPaintProperty

LAutomation::SetPaintBkColor

LAutomation::GetPaintBkColor


LContainer

Description

The LContainer class is derived from the LBase class. It is used in conjunction with the Automation class LAutomation. The LContainer class contains the functionality for creating and manipulating containers. It provides a means of automating drawing, as well as automating the collection and transformation of coordinates of objects within the container

Required Libraries

You must load all required libraries using LBase::LoadLibraries before using the classes.

ltcon14n.dll

See Also

Class Members, Class Hierarchy Chart , Parent Class


LContainer::Class Members

Constructors / Destructors

Offsets

Scalars

Creating a Container

Displaying Objects

Editing Objects

Container Properties

Initializing and Freeing Containers

Container Objects

Callbacks

Return to LContainer

Constructors / Destructors

LContainer::LContainer()

LContainer::~LContainer()

Offsets

LContainer::GetOffset

LContainer::SetOffset

Scalars

LContainer::GetScalar

LContainer::SetScalar

Creating Container

LContainer::Create

LContainer::Initialize

Displaying Objects

LContainer::EditObject

LContainer::Reset

LContainer::Update

Editing Objects

LContainer::EditObject

LContainer::IsEnabled

LContainer::SetEnabled

Container Properties

LContainer::GetMetrics

LContainer::GetOwner

LContainer::IsOwnerDraw

LContainer::IsEnabled

LContainer::SetEnabled

LContainer::SetMetrics

LContainer::SetOwner

LContainer::SetOwnerDraw

Initializing and Freeing Containers

LContainer::Free

LContainer::Initialize

Container Objects

LContainer::GetObjectCursor

LContainer::GetObjectType

LContainer::SetObjectCursor

LContainer::SetObjectType

Callbacks

LContainer::ContainerCallback

LContainer::EnableContainerCallback


Class Library Function Groups

Container Functions

LContainer::Class Members

Automation Functions

LAutomation::Class Members


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.
Attn: 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.


Data Types

LEADTOOLS Data Types

Basic Data Types and Keywords

LEADTOOLS Basic Data Types

Keywords Used in Declarations

General Automation Structures

AUTOMATIONHANDLE

Vector Automation Structures

AUTOMATIONVECTORPROPERTIES

Container Structures

CONTAINERARCDATA

CONTAINERBEZIERDATA

CONTAINERCIRCLEDATA

CONTAINERELLIPSEDATA

CONTAINEREVENTTYPE

CONTAINERHANDLE

CONTAINERLINEDATA

CONTAINERMETRICS

CONTAINEROBJECTDATA

CONTAINEROBJECTTYPE

CONTAINERPAINTDATA

CONTAINERPOINTDATA

CONTAINERPOLYLINEDATA

CONTAINERRECTDATA

CONTAINERSQUAREDATA

CONTAINERTEXTDATA

VECTORPOINT


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.


CONTAINEREVENTTYPE

typedef enum
{
CONTAINER_EVENT_TYPE_DRAW,
CONTAINER_EVENT_TYPE_MSG,
CONTAINER_EVENT_TYPE_ERROR
} CONTAINEREVENTTYPE, * pCONTAINEREVENTTYPE ;

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


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 LContainer::GetMetrics or LContainer::SetMetrics. 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 indicates 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:
 | 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
 | ONTAINER_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

LContainer::SetObjectType

LContainer::SetObjectCursor

LContainer::GetObjectType

LContainer::GetObjectCursor


CONTAINERPAINTDATA

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

The CONTAINERPAINTDATA contains information that will be used when adding a new container during 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 could delete the handle after this 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.


AUTOMATIONVECTORPROPERTIES

typedef struct _AUTOMATIONVECTORPROPERTIES
{
L_INT nSize;
L_UINT32 dwMask;
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

LAutomation::SetVectorProperty and LAutomation::GetVectorProperty are the functions used to set and get the vector automation properties.


Return Codes

For a list of all possible error codes for LEADTOOLS Container and Automation Class Library, refer to LEADTOOLS Class Library Error Codes in the Main Class Library help file.


Automation/Container Tutorials

Implementing Vector Automation

Vector Load and Save

The Automation Container

Setting Vector Automation Properties

The Undo/Redo and Cut/Copy/Paste Capabilities


Implementing Vector Automation

Note: | This example is for a 32-bit (NT or Windows 9x) environment.
Note: | Please note that if you installed LEADTOOLS using the default directory settings, you should give the full path when including the Ltwrappr.h file, like this:

#include "C:\LEAD Technologies, Inc\LEADTOOLS 14.0 Win32\include\Classlib\ltwrappr.h"

1. | Start Visual C++, version 5.
2. | Select the File->New menu option, click the "projects" tab.
3. | Select "MFC AppWizard".
4. | In the Project Name dialog box, enter "VecAut".
5. | In the Location dialog box, use the examples\classlib\msvc5 directory of your LEAD installation. For example, if you installed LEADTOOLS in c:\ltwin14x, enter c:\ltwin14x\examples\classlib\msvc5\
6. | Click OK.
7. | Choose Single Document and click "Finish", and then OK.
8. | Choose Project->Settings.
9. | In the "Settings For" drop down box, choose "All Configurations".
10. | Click on the C/C++ tab.
11. | In the "Category" drop down box, choose "Preprocessor".
12. | In the "Additional include directories" dialog box, enter the include\classlib directory of your LEAD installation. For example, if you installed LEADTOOSL in c:\ltwin14x, enter c:\ltiwn14x\include\classlib.
13. | Open VecAut.h.
14. | Add the following line immediately before the class CVecAutApp declaration:

#include "ltwrappr.h"

15. | Click on the "Class View" tab.
16. | Click to open the" VecAut Classes" branch.
17. | Click "CVecAutApp", and then double click the CVecAutApp() constructor.
18. | Add the following lines after //TODO: add construction code here:

   LBase::LoadLibraries
  (LT_KRN|LT_FIL|LV_KRN|LT_TLB|LT_AUT|LT_CON);
LSettings::UnlockSupport (L_SUPPORT_VECTOR, L_KEY_VECTOR);
LSettings::UnlockSupport (L_SUPPORT_VECTOR_ALL, L_KEY_VECTOR_ALL);

19. | Select Project->Add To Project->Files... and browse to <your LEAD installation directory>\dist\lib\ltwvc_n.lib.
20. | Click on the "Class View" tab.
21. | Right click "CVecAutDoc" and select "Add Member Variable..."
22. | For Variable Type enter LVectorWindow, and for Variable Declaration put m_VectorWindow. Leave Access as "Public" and click OK.
23. | Right click "CVecAutDoc" and select "Add Member Variable..."
24. | For Variable Type enter LContainer, and for Variable Declaration put m_Container. Leave Access as "Public" and click OK.
25. | Right click "CVecAutApp" and select "Add Member Variable..."
26. | For Variable Type enter LAutomation, and for Variable Declaration put m_Automation. Leave Access as "Public" and click OK.
27. | Right click "CVecAutApp" and select "Add Member Variable..."
28. | For Variable Type enter LToolbar, and for Variable Declaration put m_Toolbar. Leave Access as "Public" and click OK.
29. | Click to open the CMainFrame branch. Double click the CMainFrame() constructor and add code so that the constructor looks like the following:

CMainFrame::CMainFrame()
{
theApp.m_Automation.Initialize();
theApp.m_Automation.Create(AUTOMATION_MODE_VECTOR);
theApp.m_Toolbar. Initialize ();
}

30.

Double click the CMainFrame::OnCreate() member function, and add the following code immediately after the first opening bracket {:

theApp.m_Toolbar. Create (m_hWnd, TEXT("Vector"), TOOLBAR_VECTOR);
theApp.m_Toolbar. SetRows (8);

POINT pt;
RECT rcClient;

GetClientRect(&rcClient);
ClientToScreen(&rcClient);

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

theApp.m_Toolbar. SetPosition (
&pt,
TOOLBAR_POSITION_TOP | TOOLBAR_POSITION_LEFT
);
theApp.m_Automation.SetToolbar(&theApp.m_Toolbar);

31. | Right click the CMainFrame branch, and choose "Add Windows Message Handler..."
32. | Choose WM_DESTROY and click the "Add and Edit" button.
33. | Add the following code after the opening bracket {:

CVecAutDoc* pDoc = (CVecAutDoc*)GetActiveDocument( );
theApp.m_Automation.RemoveContainer(&pDoc->m_Container);
pDoc->m_Container.Free();

if (theApp.m_Automation.IsValid())
{

theApp.m_Toolbar. Free ();
theApp.m_Automation.Free();
}

34. | Right click the CVecAutView class.
35. | Select "Add Windows Message Handler..."
36. | Choose WM_CREATE and click the "Add and Edit" button.
37. | Add the following code to replace the //TODO: ...

GetDocument()->m_VectorWindow.SetWndHandle(m_hWnd);
GetDocument()->m_VectorWindow.AttachToWindow(m_hWnd);
GetDocument()->m_Container.Initialize();
GetDocument()->m_Container.Create(m_hWnd);
theApp.m_Automation.AddContainer(
&GetDocument()->m_Container,
GetDocument()->m_VectorWindow.GetHandle()
);
theApp.m_Automation.SetActiveContainer(&GetDocument()->m_Container);

38. | Right click CVecAutView, select "Add Windows Message Handler...", select WM_SIZE, and click the "Add and Edit" button.
39. | Add the following code to replace the // TODO: ...

CONTAINERMETRICS ContainerMetrics;
RECT Rect;
SetRect( &Rect, 0, 0, cx, cy );

ContainerMetrics.nSize = sizeof( CONTAINERMETRICS );
ContainerMetrics.dwMask = CMF_LIMITS;
CopyRect( &ContainerMetrics.rcLimits, &Rect );
GetDocument()->m_Container.SetMetrics (&ContainerMetrics);

40.

Click on CVecAutDoc tree view branch, and double click the CVecAutDoc() constructor. Add the line:

m_VectorWindow. SetBackgroundColor (RGB(255,255,255));

41.

Double click the CVecAutDoc branch to open VecAutDoc.h. Add the following include immediately before the class declaration:

#include "ltwrappr.h"

42.

Open MainFrm.cpp and add the following lines after #include "MainFrm.h":

#include "VecAut.h"
#include "VecAutDoc.h"
extern CVecAutApp theApp;

43.

Open VecAutView.cpp and add the following lines after #include "VecAutView.h":

#include "VecAut.h"
extern CVecAutApp theApp;

44. | Click on the "Resource View" tab of the project workspace and click to open the "VecAut resources" branch, and then click to open the "Menu" branch.
45. | Double-click IDR_MAINFRAME.
46. | Click "View" and add a menu item called "Vector Toolbar".
47. | Select View->Class Wizard...
48. | From the "Class name" drop down box elect "CVecAutApp".
49. | From the "Object IDs" list box select "ID_VIEW_VECTORTOOLBAR".
50. | From the "Messages" list box select "COMMAND" and click "Add Function..."
51. | From the "Messages" list box select "UPDATE_COMMAND_UI" and click "Add Function".
52. | Click "Edit Code", and Add code to the two newly created member functions as follows:

void CVecAutApp::OnViewVectortoolbar()
{
L_BOOL bVisible;
bVisible = m_Toolbar. IsVisible ();
m_Toolbar. SetVisible (!bVisible);
}

void CVecAutApp::OnUpdateViewVectortoolbar(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(m_Toolbar.IsVisible());
}

53.

Modify CVecAutDoc::OnNewDocument() to create a new vector with an empty vector layer. The function should look like this.

BOOL CVecAutDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;

//Empty the vector of all objects and layers
m_VectorWindow.Empty();

//Create an empty vector layer
VECTORLAYERDESC VectorLayerDesc;

VectorLayerDesc.nSize = sizeof(VECTORLAYERDESC);
lstrcpy(VectorLayerDesc.szName, TEXT("First Layer"));
VectorLayerDesc.bVisible= TRUE;
VectorLayerDesc.bLocked = FALSE;
VectorLayerDesc.dwTag = 0;

LVectorLayer MyLayer(&VectorLayerDesc);
m_VectorWindow. AddLayer (&MyLayer);
m_VectorWindow. SetActiveLayer (&MyLayer);

m_VectorWindow. EnableAutoScroll (TRUE);
m_VectorWindow. SetEngine ();

VECTORPOINT min, max;
min.x = min.y = min.z = max.z = 0.0;
max.x = max.y = 100.0;
m_VectorWindow. SetParallelogram (&min,&max);
m_VectorWindow. Reset ();

return TRUE;
}

54.

Compile and run the project by selecting Build->Execute VecAut.exe from the menu. Choose "View->Vector Toolbar" from the menu and begin drawing with the vector tools.


Vector Load and Save.

Start with the project you created in Tutorial 1: Implementing Vector Automation

Take the following steps to add vector load and save functionality:

1. | Select View->ClassWizard.
2. | In the Class Name drop down box, select CVecAutDoc.
3. | In the Object IDs drop down box, select CVecAutDoc.
4. | In the Messages drop down box, select OnOpenDocument.
5. | Click the Add Function button, and then click the Edit Code button.
6. | Add the following code to CVecAudDoc::OnOpenDocument():

BOOL CVecAutDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
L_TCHAR szTemp[_MAX_PATH];
L_BOOL bRet;
L_INT nRet;

if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;

lstrcpy(szTemp, lpszPathName);
nRet = m_VectorWindow. Load (szTemp);

if (nRet == SUCCESS)
{
m_VectorWindow. EnableAutoScroll (TRUE);
m_VectorWindow. SetEngine ();
m_VectorWindow. Reset ();

}
else
{
CString strTmp;

strTmp.Format(TEXT("Error Loading File[%d]"), nRet);
AfxMessageBox(strTmp);
bRet = FALSE;
}
return bRet;
}

7. | Select View->ClassWizard.
8. | In the Class Name drop down box, select CVecAutDoc.
9. | In the Object IDs drop down box, select CVecAutDoc.
10. | In the Messages drop down box, select OnSaveDocument.
11. | Click the Add Function button, and then click the Edit Code button.
12. | Add the following code to CTutorialDoc::OnSaveDocument():

BOOL CVecAutDoc::OnSaveDocument(LPCTSTR lpszPathName)
{
L_TCHAR szFileName[_MAX_PATH];
L_INT nRet = 0;

lstrcpy(szFileName, lpszPathName);

//Apply any transformation before the save
m_VectorWindow. ApplyTransformation ();
nRet = m_VectorWindow. Save ( szFileName, m_iFileSaveType);
if (nRet != SUCCESS)
{
CString strTmp;

strTmp.Format(TEXT("Error Saving File[%d]"), nRet);
AfxMessageBox(strTmp);
}

if (nRet == SUCCESS)
SetModifiedFlag(FALSE);
return (nRet == SUCCESS);
}

13. | Click on the "Class View" tab, right-click CVecAutDoc, and choose "Add Member Variable..."
14. | For "Variable Type" enter:

L_INT

15.

For "Variable Name" enter:

m_iFileSaveType

16. | Leave "Access" as public and click "Ok".
17. | Select View->ClassWizard.
18. | In the Class Name drop down box, select CVecAutView.
19. | In the Object IDs drop down box, select ID_FILE_SAVE.
20. | In the Messages drop down box, select COMMAND.
21. | Click the Add Function button, and then click the Edit Code button.
22. | Add the following code to CVecAutView::OnFileSave ()

void CVecAutView::OnFileSave()
{
static const L_TCHAR szSaveFileFilter[] = TEXT("DXF(*.dxf)|*.dxf|WMF(*.wmf)|*.wmf|EMF(*.emf)|*.emf|DRW(*.drw)|*.drw|CGM(*.cgm)|*.cgm|PLT(*.plt)|*.plt|PCT(*.pct)|*.pct|Intergraph Vector(*.vec)|*.vec|TIF DXF(*.tif)|*.tif||");
L_UINT uNotUsed;
L_TCHAR szFileName[_MAX_PATH], *pszFileName;
L_INT nRet;

nRet = GetDocument()->m_VectorWindow. GetFileName (szFileName, &uNotUsed);
pszFileName = (nRet == SUCCESS) ? szFileName : NULL;

CFileDialog SaveDialog(
FALSE,
TEXT("dxf"),
pszFileName,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
szSaveFileFilter,
this
);

nRet = SaveDialog.DoModal();
if (IDOK == nRet)
{
CString strFilename;
strFilename = SaveDialog.GetPathName();
L_INT nIndex = SaveDialog.m_ofn.nFilterIndex;
switch (nIndex)
{
case 1:
GetDocument()->m_iFileSaveType = FILE_DXF;
break;

case 2:
GetDocument()->m_iFileSaveType = FILE_WMF;
break;

case 3:
GetDocument()->m_iFileSaveType = FILE_EMF;
break;

case 4:
GetDocument()->m_iFileSaveType = FILE_DRW;
break;

case 5 :
GetDocument()->m_iFileSaveType = FILE_CGM;
break;

case 6:
GetDocument()->m_iFileSaveType = FILE_PLT;
break;

case 7:
GetDocument()->m_iFileSaveType = FILE_PCT;
break;

case 8:
GetDocument()->m_iFileSaveType = FILE_INTERGRAPH_VECTOR;
break;

case 9:
GetDocument()->m_iFileSaveType = FILE_TIF_DXF;
break;

}
GetDocument()->OnSaveDocument(strFilename);
}
}

23. | Select View->ClassWizard.
24. | In the Class Name drop down box, select CVecAutView.
25. | In the Object IDs drop down box, select ID_FILE_SAVE_AS.
26. | In the Messages drop down box, select COMMAND.
27. | Click the Add Function button, and then click the Edit Code button.
28. | Add the following code to CVecAutView::OnFileSaveAs ():

void CVecAutView::OnFileSaveAs()
{
OnFileSave();
}

29.

Compile and run the project. You will be able to view, load and save vector files as you browse your local hard disk. You can also use the numeric keypad to zoom in (+ key) and zoom out (- key).


The Automation Container

Start with the project you created in Tutorial 2: Vector Load and Save.

Take the following steps to add the ability to edit objects using automation.

1. | In the project workspace, click on the Class View tab and then click to open the "VecAut classes" branch.
2. | Right click the "CVecAutApp" class and select "Add Member Variable..."
3. | For "Variable Type" enter L_BOOL.
4. | For "Variable Declaration" enter m_bToolbarDrawing. This variable is will be set to TRUE when drawing with the automation, and set to FALSE when the pointer (NONE) is selected.
5. | Click to open the "CVecAutApp" class branch.
6. | Double-click the "CVecAutApp" constructor.
7. | Add the following line after the last call to LSettings::UnlockSupport ():

m_bToolbarDrawing = FALSE;

8. | It is necessary to derive a class from LContainer and override the "ContainerCallBack" function. This is used to set the m_bToolBarDrawing variable.
9. | Right click the "VecAut classes" branch and choose "New Class..."
10. | For "Class type" choose "Generic Class".
11. | For "Name" enter "MyContainer".
12. | For "Derived From" enter "LContainer".
13. | Click "OK".
14. | You will get a dialog box stating that "The New Class Wizard could not find the appropriate header file(s)...". Click "OK'.
15. | Right click the newly added "MyContainer" branch and choose "Add Member Function".
16. | For "Function Type" enter L_INT.
17. | For "Function Declaration" enter:

ContainerCallBack(CONTAINEREVENTTYPE nEventType, L_VOID L_FAR * pEventData)

18. | For "Access" leave the "Public" radio button selected.
19. | Click "OK".
20. | Double click the "ContainerCallBack" branch and add the following code:

L_INT MyContainer::ContainerCallBack(CONTAINEREVENTTYPE nEventType, L_VOID L_FAR * pEventData)
{
if (nEventType == CONTAINER_EVENT_TYPE_DRAW)
{
pCONTAINEROBJECTDATA pContainerObjectData;

pContainerObjectData = (pCONTAINEROBJECTDATA)pEventData;
switch (pContainerObjectData->fState)
{
case CONTAINER_STATE_BEGIN: //start
theApp.m_bToolbarDrawing = TRUE;
break;

case CONTAINER_STATE_PROCESS: //drawing
//Do nothing
break;

case CONTAINER_STATE_END://finished
theApp.m_bToolbarDrawing = FALSE;
break;
}
}
return LContainer::ContainerCallBack (nEventType, pEventData);
}

21.

Go to the top of MyContainer.cpp, and add the following lines after the last #include:

#include "VecAut.h"
extern CVecAutApp theApp;

22. | Now it is necessary to derive a class from LVectorWindow and override the MsgProcCallBack() member function to process mouse messages.
23. | Right click the "VecAut classes" branch and choose "New Class..."
24. | For "Class type" choose "Generic Class".
25. | For "Name" enter "MyVectorWindow".
26. | For "Derived From" enter "LVectorWindow".
27. | Click "OK".
28. | You will get a dialog box stating that "The New Class Wizard could not find the appropriate header file(s)...". Click "OK".
29. | Right click the newly added "MyVectorWindow" branch and choose "Add Member Function".
30. | For "Function Type" enter LRESULT.
31. | For "Function Declaration" enter:

MsgProcCallBack(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

32. | For "Access" leave the "Public" radio button selected.
33. | Click "OK".
34. | Double click the "MsgProcCallBack" branch and add the following code:

LRESULT MyVectorWindow::MsgProcCallBack(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_RBUTTONDOWN:
{
if (theApp.m_bToolbarDrawing == FALSE)
{
LVectorObject MyObject;
POINT point;

point.x = LOWORD(lParam);
point.y = HIWORD(lParam);
HitTest(&point, &MyObject);
theApp.m_Automation.EditVectorObject(&MyObject);
}
}
}
return LVectorWindow::MsgProcCallBack ( hWnd, uMsg, wParam, lParam);
}

35. | In the project workspace, click to open the "VecAut classes" branch.
36. | Click to open the "CVecAutDoc" branch.
37. | Double-click the m_VectorWindow member variable.
38. | Change the declaration from :

LVectorWIndow m_VectorWindow

to:

MyVectorWindow m_VectorWindow;

39.

Go to the top of MyVectorWindow.cpp, and add the following lines after the last #include:

#include "VecAut.h"
extern CVecAutApp theApp;

40.

Open VecAutDoc.h and after #include "ltwrappr.h" add the following line:

#include "MyVectorWindow.h"

41. | Now add code to set the container properties. These affect the look of a selected vector object.
42. | Click to open the "CVecAutView" branch in the Project Workspace.
43. | Double click the "OnCreate" member function, and add the following local variable:

CONTAINERMETRICS ContainerMetrics;

44.

Add the following code before the "return 0"

//Set the container metrics
ContainerMetrics.dwMask =
CMF_BORDERCOLOR |
CMF_HANDLECOLOR |
CMF_HANDLEHEIGHT |
CMF_HANDLEWIDTH |
CMF_ENABLEHANDLES;
ContainerMetrics.crBorder = RGB(255,0,0);
ContainerMetrics.crHandle = RGB(0,255,0);
ContainerMetrics.nHandleHeight = 8;
ContainerMetrics.nHandleWidth = 8;
ContainerMetrics.fEnableHandles = TRUE;
GetDocument()->m_Container.SetMetrics(&ContainerMetrics);

45.

Compile and run the program. Choose File->New from the menubar. Choose View->Vector Toolbar. Select the line tool and draw several lines. Now select the "None" tool (with the arrow icon). Right-click on one of the vector lines. Handles appear. Drag one of the handles to rotate the line. Drag in the center of the line to move the entire line. Double click to end the "edit mode".


Setting Vector Automation Properties

Start with the project you created in Tutorial3: The Automation Container.

Take the following steps to add the capability to change to color of the vector objects created with automation:

1. | Click on the "Resource Tab" of the project workspace.
2. | Click to open the "VecAut resources" branch.
3. | Click to open the "Menu" branch.
4. | Double click "IDR_MAINFRAME".
5. | Add a menu item "Preferences" and check the "Pop-up" check box.
6. | Drag the menu item to appear after "Edit" and before "View".
7. | Add another menu item under "Preferences" called "Color...".
8. | Choose "View->Class Wizard... to bring up the class wizard.
9. | For "Class name" select "CVecAutApp".
10. | For "Object IDs" select "ID_PREFERENCES_COLOR".
11. | For "Messages" select "COMMAND".
12. | Click the "Add Function..." button.
13. | Click the "Edit Code" button.
14. | Add the following code:

void CVecAutApp::OnPreferencesColor()
{
AUTOMATIONVECTORPROPERTIES AutVecProps;

//Get current automation PEN properties
AutVecProps.nSize = sizeof(AUTOMATIONVECTORPROPERTIES);
AutVecProps.dwMask = AUTOMATION_VECTOR_PEN;
m_Automation.GetVectorProperty(&AutVecProps);

//Display color picker dialog to select new color
CColorDialog dlg;
dlg.m_cc.Flags |= CC_FULLOPEN | CC_RGBINIT;
dlg.m_cc.rgbResult = AutVecProps.Pen.NewPen.LogPen.lopnColor;

if (IDOK == dlg.DoModal())
{

AutVecProps.Pen.bExtPen = FALSE;
AutVecProps.Pen.NewPen.LogPen.lopnColor = dlg.GetColor();
}

m_Automation.SetVectorProperty(&AutVecProps);
}

15. | Compile and run the demo.
16. | Choose View->Vector Toolbar.
17. | Choose Preferences->Color and select a color from the color picker dialog.
18. | Select the Line tool from the Vector Toolbar and draw a line. It will be in the color that you selected.


The Undo/Redo and Cut/Copy/Paste Capabilities

Start with the project you created in Tutorial 4: Setting Vector Automation Properties.

Take the following steps to add Undo/Redo capabilites to your project.:

1.

Open VecAutDoc.cpp and add the following lines after #include "VecAutDoc.h":

#include "VecAut.h"
extern CVecAutApp theApp;

2. | Choose "View->Class Wizard...".
3. | For the "Class Name" drop down box, select "CVecAutDoc".
4. | For the "Object IDs" choose ID_EDIT_COPY.
5. | For "Messages" select "COMMAND".
6. | Click the "Add Function" button.
7. | For "Messages" select "UPDATE_COMMAND_UI".
8. | Click the "Add Function" button.
9. | Repeat the previous five steps for ID_EDIT_CUT, ID_EDIT_PASTE, ID_EDIT_UNDO
10. | Add the code to the following eight functions:

void CVecAutDoc::OnEditCopy()
{
theApp.m_Automation.Copy();
}

void CVecAutDoc::OnUpdateEditCopy(CCmdUI* pCmdUI)
{
L_BOOL bSelected = FALSE;
m_VectorWindow. IsObjectSelected (&bSelected);
pCmdUI->Enable(bSelected);
}

void CVecAutDoc::OnEditCut()
{
theApp.m_Automation.Cut();
}

void CVecAutDoc::OnUpdateEditCut(CCmdUI* pCmdUI)
{
L_BOOL bSelected = FALSE;
m_VectorWindow.IsObjectSelected(&bSelected);
pCmdUI->Enable(bSelected);
}

void CVecAutDoc::OnEditPaste()
{
theApp.m_Automation.Paste();
}

void CVecAutDoc::OnUpdateEditPaste(CCmdUI* pCmdUI)
{
pCmdUI->Enable(theApp.m_Automation.ClipboardDataReady() == TRUE);
}

void CVecAutDoc::OnEditUndo()
{
theApp.m_Automation.Undo();
}

void CVecAutDoc::OnUpdateEditUndo(CCmdUI* pCmdUI)
{
pCmdUI->Enable((theApp.m_Automation.CanUndo() == TRUE));
}

11.

The OnNewDocument() and OnOpenDocument() functions make calls to vector functions that get added to the "Undo" stack. For this tutorial, opening and document and creating a new document will not be "undoable". To accomplish this, any code that should not be added to the "undo" stack needs to be wrapped in the following calls:

theApp.m_Automation.SetUndoEnabled(FALSE);
//...code not added to undo stack
theApp.m_Automation.SetUndoEnabled(FALSE);

12. | In the Class View branch, click to open the CVecAutDoc branch.
13. | Double click to edit the OnNewDocument() member function. Add the SetUndoEnabled(FALSE) and SetUndoEnabled(TRUE) calls as follows:

BOOL CVecAutDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;

theApp.m_Automation.SetUndoEnabled(FALSE);
//Empty the vector of all objects and layers
m_VectorWindow.Empty();

//Create an empty vector layer layer
VECTORLAYERDESC VectorLayerDesc;

VectorLayerDesc.nSize = sizeof(VECTORLAYERDESC);
lstrcpy(VectorLayerDesc.szName, TEXT("First Layer"));
VectorLayerDesc.bVisible= TRUE;
VectorLayerDesc.bLocked = FALSE;
VectorLayerDesc.dwTag = 0;

LVectorLayer MyLayer(&VectorLayerDesc);
m_VectorWindow. AddLayer (&MyLayer);
m_VectorWindow. SetActiveLayer (&MyLayer);

m_VectorWindow. EnableAutoScroll (TRUE);
m_VectorWindow. SetEngine ();

VECTORPOINT min, max;
min.x = min.y = min.z = max.z = 0.0;
max.x = max.y = 100.0;
m_VectorWindow. SetParallelogram (&min,&max);
m_VectorWindow. Reset ();
theApp.m_Automation.SetUndoEnabled(TRUE);

return TRUE;
}

14.

Do the same for OnOpenDocument(). The function should look like this:

BOOL CVecAutDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
L_TCHAR szTemp[_MAX_PATH];
L_BOOL bRet;
L_INT nRet;

if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;

theApp.m_Automation.SetUndoEnabled(FALSE);
lstrcpy(szTemp, lpszPathName);
nRet = m_VectorWindow.Load(szTemp);

if (nRet == SUCCESS)
{
m_VectorWindow.EnableAutoScroll(TRUE);
m_VectorWindow.SetEngine ();
m_VectorWindow.Reset();

}
else
{
CString strTmp;

strTmp.Format(TEXT("Error Loading File[%d]"), nRet);
AfxMessageBox(strTmp);
bRet = FALSE;
}
theApp.m_Automation.SetUndoEnabled(TRUE);
return bRet;
}

15. | Compile and run the demo.
16. | From the program menu, choose View->Vector Toolbar.
17. | Select the line tool and draw three lines.
18. | Choose the select tool, and select one of the lines.
19. | Choose Edit->Cut to remove the line.
20. | Choose Edit-Paste to paste the line.
21. | Using the select tool, select all of the lines.
22. | Hit the "Del" key to delete the lines.
23. | Choose Edit->Undo to bring back the lines.


LAutomation::LAutomation

#include "ltwrappr.h"

L_VOID LAutomation::LAutomation(void)

Constructs and initializes the member variables of the LAutomation object.

Returns

None

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:

LAutomation::~LAutomation, Class Members

Example

For an example, refer to LAutomation::Create.


LAutomation::~LAutomation

#include "ltwrappr.h"

virtual L_VOID LAutomation::~LAutomation(void)

Destroys the object and frees any resources associated with it.

Returns

None

Comments

This is the destructor for the LAutomation class.

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:

LAutomation::LAutomation, Class Members

Example

For an example, refer to LAutomation::Free.


LAutomation::AddContainer

#include "ltwrappr.h"

L_INT LAutomation::AddContainer(pLContainer , pModeData)

LContainer * pLContainer; | /* pointer to a container object */
L_VOID L_FAR pModeData; | /* pointer to additional data */

Adds a new container to the automation list of containers.

Parameter | Description
pLContainer | Pointer to a container object.
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 LAutomation::RemoveContainer.

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: | LAutomation::RemoveContainer, LContainer::Initialize, LContainer::Create
Topics: | Automation and the Container

Example

//This example
// * Creates a container
// * Associates it with a LVectorWindow object
// * Adds the container to an automation object
// * Sets some container properties
L_VOID AutomationTest(HWND hWnd, LVectorWindow &VectorWindow, LAutomation &Automation, LContainer &Container)
{
CONTAINERMETRICS ContainerMetrics;

VectorWindow. SetWndHandle (hWnd);
VectorWindow. AttachToWindow (hWnd);
Container.Initialize();
Container.Create(hWnd);

Automation.AddContainer(&Container, VectorWindow.GetHandle
 () );
Automation.SetActiveContainer(&Container);

ContainerMetrics.dwMask =
CMF_BORDERCOLOR |
CMF_HANDLECOLOR |
CMF_HANDLEHEIGHT |
CMF_HANDLEWIDTH |
CMF_ENABLEHANDLES;

ContainerMetrics.crBorder = RGB(255,0,0);
ContainerMetrics.crHandle = RGB(0,255,0);
ContainerMetrics.nHandleHeight = 8;
ContainerMetrics.nHandleWidth = 8;
ContainerMetrics.fEnableHandles = TRUE;
Container.SetMetrics(&ContainerMetrics);
}


LAutomation::AddUndoNode

#include "ltwrappr.h"

L_INT LAutomation::AddUndoNode(dwFlags);

L_INT32 dwFlags;

/* reserved */

Manually adds an undo node to the automation object.

Parameter | Description
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 LAutomation::SetUndoEnabled, a lengthy operation, consisting of multiple steps, can be combined into one undo call to LAutomation::Undo. To accomplish this, use the following steps:

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

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: | LAutomation::SetUndoEnabled, LAutomation::SetUndoLevel, LAutomation::Undo, LAutomation::Redo
Topics: | Undoing and Redoing Automation Operations

Example

// This example shows how to group several vector operations into a single undo node
L_VOID UndoNodeTest(LAutomation &Automation)
{
// Add an undo node manually
Automation.AddUndoNode(0);

// Disable the undo feature */
Automation.SetUndoEnabled (FALSE);

// Do multiple operations on the automation object

// Re-enable the undo feature
Automation.SetUndoEnabled(TRUE);
}


LAutomation::CanRedo

#include "ltwrappr.h"

L_BOOL LAutomation::CanRedo(void)

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

Returns

TRUE | A redo can be performed.
FALSE | A redo cannot be performed.

Comments

To redo an automation operation, call LAutomation::Redo.

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: | LAutomation::Redo, LAutomation::Undo, LAutomation::CanUndo, LAutomation::GetUndoLevel, LAutomation::SetUndoLevel
Topics: | Undoing and Redoing Automation Operations

Example

For an example, refer to LAutomation::Redo.


LAutomation::CanUndo

#include "ltwrappr.h"

L_BOOL LAutomation::CanUndo(void)

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

Returns

TRUE | An undo can be performed.
FALSE | An undo cannot be performed.

Comments

To determine the current undo level call LAutomation::GetUndoLevel.

To change the undo level call LAutomation::SetUndoLevel.

To undo an automation operation, call LAutomation::Undo.

For information about grouping multiple operations into a single undo process, refer to LAutomation::AddUndoNode.

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: | LAutomation::Undo, LAutomation::GetUndoLevel, LAutomation::SetUndoLevel
Topics: | Undoing and Redoing Automation Operations

Example

For an example, refer to LAutomation::Undo.


LAutomation::ClipboardDataReady

#include "ltwrappr.h"

L_BOOL LAutomation::ClipboardDataReady (void)

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

Returns

TRUE | There is valid automation data on the clipboard.
FALSE | There is not valid automation data on the clipboard.

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: | LAutomation::Cut, LAutomation::Copy, LAutomation::Paste
Topics: | Editing Automation Containers

Example

For an example, refer to LAutomation::Paste.


LAutomation::Copy

#include "ltwrappr.h"

L_INT LAutomation::Copy (dwFlags = 0)

L_UINT32 dwFlags;

/* reserved */

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

Parameter | Description
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 LAutomation::Paste.

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

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: | LAutomation::Paste, LAutomation::Cut, LAutomation::ClipboardDataReady
Topics: | Editing Automation Containers

Example

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

L_INT CopyTest (LAutomation &lauto)
{
if ( SUCCESS == lauto.IsValid() ) /* check the validity of the automation handle */
{
/* copy the current selection to the clipboard */
lauto.Copy() ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LAutomation::Create

#include "ltwrappr.h"

L_INT LAutomation::Create(nMode, dwFlags=0);

AUTOMATIONMODE nMode; | /* automation mode */
L_UINT32 dwFlags; | /* reserved */

Creates an automation handle.

Parameter | Description
nMode | An integer value that represents the automation mode to use when creating the automation handle. Possible values are:
 | Value | Meaning
 | AUTOMATION_MODE_VECTOR | Creates an automation handle for Vectors.
dwFlags | Reserved for future use. Use 0.

Returns

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

Comments

LAutomation::Initialize must be called before calling this function.

If vector viewing support is unlocked using L_SUPPORT_VECTOR_VIEW, this function will return ERROR_VECTOR_LOCKED, if nMode is set to 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: | LAutomation::Initialize, LAutomation::Free
Topics: | Initializing, Creating and Freeing Automation Handles

Example

/* This example shows the minimum requirements for creating a Vector Automation */

LAutomation lauto;

/* global toolbar handle */
pTOOLBARHANDLE g_pToolbar ;

LToolbar tlb;

L_INT InitVecAutomation ( HWND hWnd )
{
if (SUCCESS == lauto.Initialize () ) /* initiate the automation */
{
/* create the vector automation */
if ( SUCCESS != lauto.Create (AUTOMATION_MODE_VECTOR, 0 ) )
{
::MessageBox ( hWnd, TEXT("Error creating Vector Automation"), TEXT("Error:"), MB_ICONSTOP ) ;

lauto.Free() ;

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

return FAILURE;
}

/* initiate the toolbar */
if ( SUCCESS == tlb. Initialize () )
{
POINT pt = { 0, 0 } ;

::ClientToScreen ( hWnd, &pt ) ;

/* create the vector toolbar */
tlb. Create (hWnd, TEXT("Vector Automation"), TOOLBAR_VECTOR ) ;

/* set the toolbar position */
tlb. SetPosition (&pt, TOOLBAR_POSITION_TOP | TOOLBAR_POSITION_LEFT ) ;

/* set the toolbar visible */
tlb. SetVisible (TRUE ) ;
}
else
{
return FAILURE ;
}

/* set the automation toolbar */
lauto.SetToolbar (&tlb ) ;

return SUCCESS ;
}


LAutomation::Cut

#include "ltwrappr.h"

L_INT LAutomation::Cut (dwFlags = 0)

L_UINT32 dwFlags;

/* reserved */

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

Parameter | Description
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 LAutomation::Paste.

To copy automation data from the active automation container, to the Windows clipboard, use LAutomation::Copy.

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

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: | LAutomation::Paste, LAutomation::Copy, LAutomation::ClipboardDataReady
Topics: | Editing Automation Containers

Example

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

L_INT CutTest (LAutomation &lauto)
{
if ( SUCCESS == lauto.IsValid () ) /* check the validity of the automation handle */
{
/* cut the current selection to the clipboard */
lauto.Cut() ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LAutomation::Delete

#include "ltwrappr.h"

L_INT LAutomation::Delete (dwFlags=0)

L_UINT32 dwFlags;

/* reserved */

Deletes the selected objects from the active automation container.

Parameter | Description
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: | LAutomation::Cut, LAutomation::Copy, LAutomation::Paste
Topics: | Editing Automation Containers

Example

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

L_INT DeleteTest (LAutomation &lauto)
{
if ( SUCCESS == lauto.IsValid () ) /* check the validity of the automation handle */
{
/* delete the current selection */
lauto.Delete () ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LAutomation::EditVectorObject

#include "ltwrappr.h"

L_INT LAutomation::EditVectorObject (pVectorObject);

L_INT LAutomation::EditVectorObject (pEditObject);

const pVECTOROBJECT pVectorObject; | /* pointer to a structure */
LVectorObject L_FAR * pEditObject; | /* pointer to an LVectorObject object */

Edits the specified vector object.

Parameter | Description
pVectorObject | Pointer to a VECTOROBJECT structure that specifies the vector object to edit.
pEditObject | Pointer to an LVectorObject class object that contains 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: | LAutomation::SetVectorProperty, LAutomation::GetVectorProperty
Topics: | Working with Objects within an Automation Container

Example

// LAutomation::EditVectorObject()
// This example uses automation to edit a vector object under a given 2D point.
L_VOID EditVectorObjectTest(LVectorBase &Vector, LAutomation &Automation, LPPOINT pPoint)
{
LVectorObject MyObject;

// Get object under that point
L_INT nRet = Vector. HitTest (pPoint, &MyObject);
Automation.EditVectorObject(&MyObject);
}


LAutomation::EnumContainers

#include "ltwrappr.h"

L_INT LAutomation::EnumContainers (void )

Enumerates all containers associated with the automation object.

Returns

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

Comments

For each container enumerated by this function, the LAutomation::EnumContainersCallBack function is called.

The enumeration process continues until the last container is enumerated or an error occurs.

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: | LAutomation::EnumContainersCallBack
Topics: | Automation and the Container

Example

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

class LUserAutomation :public LAutomation
{
protected :

virtual L_INT EnumContainersCallback (LContainer* pLContainer);

};
//LAutomation::EnumContainers (void)

/* User defined enum callback function */
L_INT LUserAutomation::EnumContainersCallback (LContainer* pLContainer)
{
/* reset the passed container handle */
pLContainer ->Reset () ;

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

L_INT ResetAllContainers ( LAutomation &Automation )
{
if ( SUCCESS == Automation.IsValid () ) /* check the validity of the automation handle */
{
/* start enum the current added automation containers */
Automation.EnumContainers ();

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LAutomation::EnumContainersCallBack

#include "ltwrappr.h"

L_VOID LAutomation::EnumContainersCallBack(pLContainer)

LContainer * pLContainer;

/* pointer to an LContainer object */

Processes each container enumerated by the LAutomation::EnumContainers function.

Parameter | Description
pLContainer | Pointer to an LContainer object that references the handle of the container being enumerated.

Returns

Nothing.

Comments

This function is called for each container enumerated by LAutomation::EnumContainers.

The enumeration process continues until the last container is enumerated or an error occurs.

To use this function, derive a class from LAutomation and override 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: | LAutomation::EnumContainers, LAutomation::IsValid, LAutomation::Free
Topics: | Automation and the Container

Example

For an example refer to LAutomation::EnumContainers.


LAutomation::Free

#include "ltwrappr.h"

L_INT LAutomation::Free(void);

Frees the automation handle.

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: | LAutomation::Initialize, LAutomation::IsValid
Topics: | Initializing, Creating and Freeing Automation Handles

Example

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

L_INT FreeAutomation (LAutomation &lauto)
{
if ( SUCCESS == lauto.IsValid() ) /* check the validity of the automation handle */
{
LToolbar *pToolbar;

/* get the automation toolbar handle */
pToolbar = lauto.GetToolbar () ;

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

/* free the automation handle */
lauto.Free () ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LAutomation::GetActiveContainer

#include "ltwrappr.h"

LContainer* LAutomation::GetActiveContainer (void )

Gets the handle to the active automation container.

Returns

!NULL | Pointer to an LContainer class object that contains the handle to the active automation container.
NULL | An error occurred.

Comments

To change the active automation container use LAutomation::SetActiveContainer.

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: | LAutomation::SetActiveContainer, LAutomation::AddContainer
Topics: | Automation and the Container

Example

For an example, refer to LAutomation::SetActiveContainer.


LAutomation::GetCurrentTool

#include "ltwrappr.h"

L_INT LAutomation::GetCurrentTool(pnTool)

L_INT *pnTool;

/* pointer to an integer */

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

Parameter | Description
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.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: | LAutomation::SetCurrentTool, LAutomation::SetToolbar, LAutomation::GetToolbar
Topics: | The Automation Toolbar

Example

For an example, refer to LAutomation::SetCurrentTool.


LAutomation::GetPaintBkColor

#include "ltwrappr.h"

COLORREF LAutomation::GetPaintBkColor(void)

Gets the DigitalPaint automation background color. This function is only available in the Digital Paint toolkits.

Returns

The current automation background color.

Comments

This function will only work when the automation mode is AUTOMATION_MODE_PAINT.

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:

LAutomation::SetPaintBkColor.

Example

For an example, refer to LAutomation::SetPaintBkColor


LAutomation::GetPaintProperty

#include "ltwrappr.h"

L_INT LAutomation::GetPaintProperty(nGroup, pProperty)

PAINTGROUP nGroup; | /* type of paint properties */
L_VOID L_FAR *pProperty; | /* pointer to a PAINTXXX structure */

Gets the DigitalPaint automation properties. This function is only available in the Digital Paint toolkits.

Parameter | Description
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

This function will only work when the automation mode is AUTOMATION_MODE_PAINT.

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:

LAutomation::SetPaintProperty

Example

For an example refer to LAutomation::SetPaintProperty.


LAutomation::GetToolbar

#include "ltwrappr.h"

LToolbar * LAutomation::GetToolbar (void)

Gets the current LEAD automation toolbar handle.

Returns

!NULL | Pointer to an LToolbar object that references the handle of the current automation toolbar.
NULL | An error occurred.

Comments

If LAutomation::SetToolbar was not used to set the toolbar handle, this function will return NULL.

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: | LAutomation::SetToolbar.
Topics: | The Automation Toolbar

Example

For an example, refer to LAutomation::Free.


LAutomation::GetUndoLevel

#include "ltwrappr.h"

L_UINT LAutomation::GetUndoLevel(void);

Gets the current automation undo level.

Returns

The current automation undo level.

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 LAutomation::SetUndoLevel.

To undo an automation operation, call LAutomation::Undo.

To determine whether an automation operation can be undone, call LAutomation::CanUndo.

For information about grouping multiple operations into a single undo process, refer to LAutomation::AddUndoNode.

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: | LAutomation::SetUndoLevel, LAutomation::Undo, LAutomation::CanUndo
Topics: | Undoing and Redoing Automation Operations

Example

For an example, refer to LAutomation::SetUndoLevel.


LAutomation::GetVectorProperty

#include "ltwrappr.h"

L_INT LAutomation::GetVectorProperty(pAutomationVectorProperties);

p AUTOMATIONVECTORPROPERTIES pAutomationVectorProperties;

/* pointer to a structure */

Gets the current vector automation properties. This function is only available in the Vector toolkits.

Parameter | Description
pAutomationVectorProperties | 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

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: | LAutomation::SetVectorProperty
Topics: | Working with Objects within an Automation Container

Example

For an example, refer to LAutomation::SetVectorProperty.


LAutomation::Initialize

#include "ltwrappr.h"

L_INT LAutomation::Initialize(void);

Initializes the automation handle.

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 LAutomation::Initialize and LAutomation::Create.

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: | LAutomation::IsValid, LAutomation::Free, LAutomation::Create
Topics: | Initializing, Creating and Freeing Automation Handles

Example

For an example, refer to LAutomation::Create.


LAutomation::IsValid

#include "ltwrappr.h"

L_BOOL LAutomation::IsValid(void)

Determines the validity of the class object's automation handle.

Returns

TRUE | The function was successful.
FALSE | An error occurred. Refer to Return Codes.

Comments

The automation handle will be valid after calling LAutomation::Initialize and LAutomation::Create.

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: | LAutomation::Initialize, LAutomation::Create, LAutomation::Free
Topics: | Initializing, Creating and Freeing Automation Handles

Example

For an example, refer to LAutomation::Free.


LAutomation::Paste

#include "ltwrappr.h"

L_INT LAutomation::Paste(dwFlags = 0)

L_UINT32 dwFlags;

/* reserved */

Copies the valid automation data on the clipboard to the active automation container.

Parameter | Description
dwFlags | Reserved for future use. Must be 0.

Returns

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

Comments

Call LAutomation::ClipboardDataReady to determine whether valid automation data exists on the clipboard.

To copy automation data from the active automation container to the clipboard use LAutomation::Copy. Automation data can be cut from the active automation container and placed on the clipboard using LAutomation::Cut.

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: | LAutomation::ClipboardDataReady , LAutomation::Cut, LAutomation::Copy
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 (LAutomation &lauto)
{
if ( SUCCESS == lauto.IsValid() ) /* check the validity of the automation handle */
{
L_BOOL fReady ;

/* check if there is a valid automation mode data on the clipboard */
fReady = lauto.ClipboardDataReady () ;

if ( fReady )
{
/* paste the data to the current active container */
lauto.Paste () ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LAutomation::Print

#include "ltwrappr.h"

L_INT LAutomation::Print (dwFlags=0)

L_UINT32 dwFlags;

/* reserved */

Prints the objects in the active automation container that are currently displayed on the screen.

Parameter | Description
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 LContainer::Reset

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: | LContainer::Reset
Topics: | Automation Printing

Example

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

L_INT PrintTest (LAutomation &lauto)
{
if ( SUCCESS == lauto.IsValid () ) /* check the validity of the automation handle */
{
/* print the automtion active container data */
lauto.Print () ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LAutomation::Redo

#include "ltwrappr.h"

L_INT LAutomation::Redo (dwFlags=0);

L_UINT32 dwFlags;

/* reserved */

Repeats that last automation operation performed in the active automation container.

Parameter | Description
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 LAutomation::Undo. For example, if LAutomation::Undo has been called three times, to undo three processes, then calling LAutomation::Redo can redo those three processes. The first call to LAutomation::Redo 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: | LAutomation::CanRedo, LAutomation::Undo, LAutomation::SetUndoLevel, LAutomation::GetUndoLevel
Topics: | Undoing and Redoing Automation Operations

Example

/* this example shows how to redo the last automation operation */

L_INT AutomationRedoTest (LAutomation &lauto)
{
if ( SUCCESS == lauto.IsValid () ) /* check the validity of the automation handle */
{
L_BOOL fCanRedo ;

/* query the ability of redoing */
fCanRedo = lauto.CanRedo () ;

if ( fCanRedo )
{
/* redo the last automation operation */
lauto.Redo () ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LAutomation::RemoveContainer

#include "ltwrappr.h"

L_INT LAutomation::RemoveContainer (pLContainer);

LContainer * pLContainer;

/* pointer to an LContainer object */

Removes the specified container from the automation list of containers.

Parameter | Description
pLContainer | Pointer to an LContainer object that references the container to remove.

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: | LAutomation::AddContainer.
Topics: | Automation and the Container

Example

/* This example shows how to remove some container from the automation */

L_INT RemoveContainerTest (LAutomation &Automation, LContainer &Container)
{
if ( SUCCESS == Automation.IsValid () ) /* check the validity of the automation handle */
{
if ( SUCCESS == Container.IsValid () ) /* check the validity of the container handle */
{
/* Remove the container from the automation */
Automation.RemoveContainer (&Container ) ;

/* Free the container handle */
Container.Free () ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}
else
{
return FAILURE ;
}
}


LAutomation::Select

#include "ltwrappr.h"

L_INT LAutomation::Select(nSelect, dwFlags=0)

AUTOMATIONSELECT nSelect; | /* selection option */
L_UINT32 dwFlags; | /* reserved */

Selects or unselects all objects within the active automation container.

Parameter | Description
nSelect | An integer value that indicates whether to select or unselect the items in the active automation container. Possible values are:
 | Value | Meaning
 | AUTOMATION_SELECT_NONE | Unselect the entire container.
 | AUTOMATION_SELECT_ALL | Select the entire 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

Topics:

Working with Objects within an Automation Container

Example

/* this example shows how to use the automation select function */

L_INT SelectAllTest (LAutomation &lauto)
{
if ( SUCCESS == lauto.IsValid () ) /* check the validity of the automation handle */
{
/* select all of the current automation container data */
lauto.Select (AUTOMATION_SELECT_ALL, 0 ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LAutomation::SetActiveContainer

#include "ltwrappr.h"

L_INT LAutomation::SetActiveContainer(pLContainer )

LContainer * pLContainer;

/* pointer to an LContainer object */

Sets the active automation container.

Parameter | Description
pLContainer | Pointer to the LContainer object 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 LAutomation::AddContainer.

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: | LAutomation::GetActiveContainer, LAutomation::AddContainer
Topics: | Automation and the Container

Example

/* This example shows how to set the automation active container */

L_INT SetActiveContainerTest (LContainer &lcon,LAutomation &lauto)
{
if ( SUCCESS == lauto.IsValid () ) /* check the validity of the automation handle */
{
if ( SUCCESS == lcon.IsValid () ) /* check the validity of the container handle */
{
LContainer *pActiveContainer ;

/* get the current active container */
pActiveContainer = lauto.GetActiveContainer() ;

if ( &lcon != pActiveContainer ) /* if the new container is not currently active */
{
/* set the new active container */
lauto.SetActiveContainer (&lcon) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}
else
{
return FAILURE ;
}
}


LAutomation::SetCurrentTool

#include "ltwrappr.h"

L_INT LAutomation::SetCurrentTool(nTool)

L_INT nTool;

/* tool id */

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

Parameter | Description
nTool | An integer value that represents the tool to set. For more information about tools, tool identifiers and toolbar buttons, 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: | LAutomation::GetCurrentTool, LAutomation::SetToolbar, LAutomation::GetToolbar
Topics: | The Automation Toolbar

Example

// This example displays the current tool in the automation, and then changes it to nNewTool.
L_VOID GetToolName(L_INT nTool, L_TCHAR *pszTool)
{
lstrcpy(pszTool, TEXT("Unknown"));
switch (nTool)
{
case ID_TOOL_VECTOR_NONE :
lstrcpy(pszTool, TEXT("No Tool");
break;

case ID_TOOL_VECTOR_SELECT :
lstrcpy(pszTool, TEXT("Vector Select"));
break;

case ID_TOOL_VECTOR_VERTEX :
lstrcpy(pszTool, TEXT("Vector Vertex"));
break;

case ID_TOOL_VECTOR_LINE :
lstrcpy(pszTool, TEXT("Vector Line"));
break;

case ID_TOOL_VECTOR_RECTANGLE :
lstrcpy(pszTool, TEXT("Vector Rectangle"));
break;

case ID_TOOL_VECTOR_POLYLINE :
lstrcpy(pszTool, TEXT("Vector Polyline"));
break;

case ID_TOOL_VECTOR_POLYBEZIER:
lstrcpy(pszTool, TEXT("Vector PolyBezier"));
break;

case ID_TOOL_VECTOR_POLYGON :
lstrcpy(pszTool, TEXT("Vector Polygon"));
break;

case ID_TOOL_VECTOR_ELLIPSE :
lstrcpy(pszTool, TEXT("Vector Ellipse"));
break;

case ID_TOOL_VECTOR_CIRCLE :
lstrcpy(pszTool, TEXT("Vector Circle"));
break;

case ID_TOOL_VECTOR_ARC :
lstrcpy(pszTool, TEXT("Vector Arc"));
break;

case ID_TOOL_VECTOR_TEXT :
lstrcpy(pszTool, TEXT("Vector Text"));
break;

case ID_TOOL_VECTOR_PIE :
lstrcpy(pszTool, TEXT("Vector Pie"));
break;

case ID_TOOL_VECTOR_CHORD :
lstrcpy(pszTool, TEXT("Vector Chord"));
break;

case ID_TOOL_VECTOR_RASTER :
lstrcpy(pszTool, TEXT("Vector Raster"));
break;

case ID_TOOL_VECTOR_ROTATE :
lstrcpy(pszTool, TEXT("Vector Rotate"));
break;

case ID_TOOL_VECTOR_PAN :
lstrcpy(pszTool, TEXT("Vector Pan"));
break;
}
}
L_VOID SetCurrentToolTest(LAutomation &Automation, L_INT nNewTool)
{
L_INT nOldTool;
L_INT nRet;
L_TCHAR szTool[100];

nRet = Automation.GetCurrentTool(&nOldTool);
GetToolName(nOldTool, szTool);
MessageBox(NULL, szTool, TEXT("Old Tool"), MB_OK);
nRet = Automation.SetCurrentTool(nNewTool);
if (nRet == SUCCESS)
{
GetToolName(nNewTool, szTool);
MessageBox(NULL, szTool, TEXT("New Tool"), MB_OK);
}
}


LAutomation::SetPaintBkColor

#include "ltwrappr.h"

L_INT LAutomation::SetPaintBkColor(rcBKColor)

COLORREF rcBKColor;

/* new background color */

Sets the DigitalPaint automation background color. This function is only available in the Digital Paint toolkits.

Parameter | Description
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

This function will only work when the automation mode is AUTOMATION_MODE_PAINT.

This color will be used by the automation to fill the area lift 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:

LAutomation::Cut, LAutomation::Delete, LAutomation::GetPaintBkColor.

Example

/* This example will make sure that the BK is not anything but black */

L_INT StickToBalck ( LAutomation &Automation )
{
if ( SUCCESS == Automation.IsValid () ) /* check the validity of the automation handle */
{
COLORREF crBkColor ;

/* get the current paint automation color */
crBkColor=Automation.GetPaintBkColor () ;

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

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LAutomation::SetPaintProperty

#include "Ltwrappr.h"

L_INT LAutomation::SetPaintProperty(nGroup, pProperty)

PAINTGROUP nGroup; | /* type of paint properties */
L_VOID L_FAR *pProperty; | /* pointer to a PAINTXXX structure */

Sets the DigitalPaint automation properties. This function is only available in the Digital Paint toolkits.

Parameter | Description
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

This function will only work when the automation mode is AUTOMATION_MODE_PAINT.

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:

LAutomation::GetPaintProperty

Example

/* this example shows how to change the paint shape properties */

L_INT SetPaintShapePropsTest ( LAutomation &Automation )
{
if ( SUCCESS == Automation.IsValid () ) /* check the validity of the automation handle */
{
PAINTSHAPE shape ;

/* set the paint shape group properties */
Automation.GetPaintProperty (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 */
Automation.SetPaintProperty (PAINT_GROUP_SHAPE, &shape ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LAutomation::SetToolbar

#include "ltwrappr.h"

L_INT LAutomation::SetToolbar (pLToolbar)

LToolbar * pLToolbar;

/* pointer to an LToolbar object */

Sets the LEAD automation toolbar handle.

Parameter | Description
pLToolbar | Pointer to the LToolbar object the references the handle of the toolbar to 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: | LAutomation::GetToolbar.
Topics: | The Automation Toolbar

Example

For an example, refer to LAutomation::Create.


LAutomation::SetUndoEnabled

#include "ltaut.h"

L_INT LAutomation::SetUndoEnabled (bEnabled=TRUE);

L_BOOL bEnabled;

/* flag */

Disables or re-enables the undo feature of the automation handle.

Parameter | Description
bEnabled | Flag that indicates whether to enable or disable the undo feature of the 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 LAutomation::AddUndoNode to combine multiple operations into a single undo call. For more information on this process, refer to LAutomation::AddUndoNode.

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: | LAutomation::SetUndoLevel, LAutomation::AddUndoNode, LAutomation::Undo, LAutomation::Redo
Topics: | Undoing and Redoing Automation Operations

Example

// This example shows how enable/disable the undo stack
L_VOID DisableUndoTest(LAutomation &Automation)
{
//check the validity of the automation handle
if ( SUCCESS == Automation .IsValid () )
{
// Disable recording of undo operations
Automation.SetUndoEnabled(FALSE);

// Do any vector operations that will not be added to the undo stack
// ...

// Enable recording of undo operations
Automation.SetUndoEnabled();
}
}


LAutomation::SetUndoLevel

#include "ltwrappr.h"

L_INT LAutomation::SetUndoLevel (uLevel);

L_UINT uLevel;

/* undo level */

Sets the automation undo level.

Parameter | Description
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 LAutomation::GetUndoLevel.

To undo an automation operation, call LAutomation::Undo.

To determine whether an automation operation can be undone, call LAutomation::CanUndo.

For information about grouping multiple operations into a single undo process, refer to LAutomation::AddUndoNode.

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: | LAutomation::GetUndoLevel, LAutomation::Undo, LAutomation::CanUndo
Topics: | Undoing and Redoing Automation Operations

Example

/* this example shows how to Get/Set the automation undo level */

L_INT ChangeUndoLevelTest (LAutomation &lauto)
{
if ( SUCCESS == lauto. IsValid () ) /* check the validity of the automation handle */
{
L_UINT uAutUndoLevel ;

/* get the current automation undo level */
uAutUndoLevel = lauto.GetUndoLevel () ;

if ( 32 != uAutUndoLevel )
{
/* set the automation undo level to 32 */
lauto.SetUndoLevel (32 ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LAutomation::SetVectorProperty

#include "ltwrappr.h"

L_INT LAutomation::SetVectorProperty(pAutomationVectorProperties);

const pAUTOMATIONVECTORPROPERTIES pAutomationVectorProperties;

/* pointer to a structure */

Sets the vector automation properties. This function is only available in the Vector toolkits.

Parameter | Description
pAutomationVectorProperties | 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

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: | LAutomation::GetVectorProperty
Topics: | Working with Objects within an Automation Container

Example

// This example allows the user to set the default color (RED) when using automation
// to create vector objects.
void OnPreferencesColor(LAutomation &Automation)
{
AUTOMATIONVECTORPROPERTIES AutVecProps;

//Get current automation PEN properties
AutVecProps.nSize = sizeof(AUTOMATIONVECTORPROPERTIES);
AutVecProps.dwMask = AUTOMATION_VECTOR_PEN;
Automation.GetVectorProperty(&AutVecProps);

AutVecProps.Pen.bExtPen = FALSE;
AutVecProps.Pen.NewPen.LogPen.lopnColor = RGB(255,0,0);
Automation.SetVectorProperty(&AutVecProps);
}


LAutomation::Undo

#include "ltwrappr.h"

L_INT LAutomation::Undo (dwFlags=0);

L_UINT32 dwFlags;

/* reserved */

Undoes the last automation operation performed in the active automation container.

Parameter | Description
dwFlags | Reserved for future use. Must be 0.

Returns

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

Comments

LAutomation::Undo must be called at least once in order to perform a "redo" using LAutomation::Redo.

To determine the current undo level call LAutomation::GetUndoLevel.

To change the undo level call LAutomation::SetUndoLevel.

To determine whether an automation operation can be undone, call LAutomation::CanUndo.

For information about grouping multiple operations into a single undo process, refer to LAutomation::AddUndoNode.

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: | LAutomation::CanUndo, LAutomation::GetUndoLevel, LAutomation::SetUndoLevel
Topics: | Undoing and Redoing Automation Operations

Example

/* this example shows how to undo the last automation operation */

L_INT AutomationUndoTest (LAutomation &lauto)
{
if ( SUCCESS == lauto.IsValid () ) /* check the validity of the automation handle */
{
L_BOOL fCanUndo ;

/* Query the ability of undoing */
fCanUndo = lauto.CanUndo () ;

if ( fCanUndo )
{
/* undo the last automation operation */
lauto.Undo () ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LContainer::LContainer

#include "ltwrappr.h"

L_VOID LContainer::LContainer(void)

Constructs and initializes the member variables of the LContainer object.

Returns

None

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:

LContainer::~LContainer, Class Members

Example

For an example, refer to Lcontainer::Free.


LContainer::~LContainer

#include "ltwrappr.h"

virtual L_VOID LContainer::~LContainer(void)

Destroys the object and frees any resources associated with it.

Returns

None

Comments

This is the destructor for the LContainer class.

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:

LContainer::LContainer, Class Members

Example

For an example, refer to Lcontainer::Free.


LContainer::ContainerCallback

#include "Ltwrappr.h"

virtual L_INT LContainer::ContainerCallback (nEventType, pEventData)

CONTAINEREVENTTYPE nEventType; | /* container event type */
L_VOID L_FAR *pEventData; | /* pointer to event specific data */

Handles each event that occurs in the container.

Parameter | Description
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.

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:

LContainer::EnableContainerCallback

Example

class LuserCon :public LContainer
{
protected:
virtual L_INT ContainerCallBack(CONTAINEREVENTTYPE nEvenType,L_VOID L_FAR *pEventData);
};

L_INT EnableCallbackTest ( LContainer &lCont )
{
if ( lCont.IsValid ( ) ) /* check the validity of container handle */
{
/* Enables the container Callback */
lCont.EnableContainerCallBack ( TRUE ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}

L_INT LuserCon::ContainerCallBack(CONTAINEREVENTTYPE nEvenType,L_VOID L_FAR *pEventData )
{
//user write his code here.
return SUCCESS;
}


LContainer::Create

#include "Ltwrappr.h"

L_INT LContainer::Create (hwndOwner)

HWND hwndOwner;

/* window handle */

Creates a container and attaches it to a user defined window.

Parameter | Description
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.

LContainer::Initialize 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: | LContainer::IsValid , LContainer::Initialize, LContainer::SetMetrics , LContainer::Free.
Topics: | Creating a Container

Example

/* This example shows the minimum requirements to start using some container */

/* Global container handle */
LContainer lcont;

L_INT ContainerTest ( HWND hWnd )
{
CONTAINERMETRICS Metrics ;

/* Initiate the container handle */
lcont.Initialize () ;

/* Create the container and attach it to its owner window */
lcont.Create ( hWnd ) ;

if ( lcont.IsValid () ) /* the validity of the container handle */
{
/* Set the container object type to rectangle */
lcont.SetObjectType (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 */
lcont.SetMetrics ( &Metrics ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LContainer::EditObject

#include "Ltwrappr.h"

L_INT LContainer::EditObject (pObjectData)

const pCONTAINEROBJECTDATA pObjectData;

/* pointer to a structure */

Displays the object specified by pObjectData and lets the user edit its properties.

Parameter | Description
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: | LContainer::SetMetrics, LContainer::GetMetrics, LContainer::IsEnabled, LContainer::SetEnabled
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 (LContainer* pLContainer)
{
if (pLContainer ->IsValid ( ) ) /* 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 != pLContainer ->EditObject ( &Data ) )
{
return FAILURE ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LContainer::EnableContainerCallback

#include "Ltwrappr.h"

L_INT LContainer::EnableContainerCallback (bEnable)

L_BOOL bEnable;

/* enable flag */

Enables or disables the container callback function.

Parameter | Description
bEnable | Flag that indicates whether to enable or disable the container callback function. Possible values are:
 | Value | Meaning
 | TRUE | Enable the container callback function.
 | FALSE | Disable the container callback function.

Returns

TRUE | The callback function was enabled.
FALSE | The callback function was disabled.

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: | LContainer::ContainerCallback
Topics: | Using the Container Callback

Example

For an example, refer to LContainer::ContainerCallBack.


LContainer::Free

#include "Ltwrappr.h"

L_INT LContainer::Free (void)

Frees the 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: | LContainer::IsValid, LContainer::Initialize.
Topics: | Initializing and Freeing Containers

Example

LContainer lcon;

L_INT FreeContainer ()
{
if (lcon.IsValid () ) /* check the validity of container handle */
{
/* Free the container handle */
lcon.Free () ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LContainer::GetMetrics

#include "Ltwrappr.h"

L_INT LContainer::GetMetrics (pMetrics)

pCONTAINERMETRICS pMetrics;

/* pointer to a structure */

Gets the current container metrics information.

Parameter | Description
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: | LContainer::SetMetrics.
Topics: | Getting and Setting Container Properties

Example

LContainer lcont;

L_INT SetContainerLimits ()
{
CONTAINERMETRICS Metrics ;
HWND hwndOwner ;
RECT rcClient ;

/* Get the container owner */
lcont.GetOwner (&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 */
lcont.GetMetrics (&Metrics ) ;

if ( ! EqualRect ( &rcClient, &Metrics.rcLimits ) )
{

CopyRect ( &Metrics.rcLimits, &rcClient ) ;

/* Set the new metrics */
lcont.SetMetrics (&Metrics ) ;
}

return SUCCESS ;
}


LContainer::GetObjectCursor

#include "Ltwrappr.h"

L_INT LContainer::GetObjectCursor (nObjectType, phCursor)

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
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: | LContainer::SetObjectCursor
Topics: | Using Container Objects

Example

L_INT CopyContainerObjectCursor ( LContainer &lCont, HCURSOR* phCur )
{
if ( lCont.IsValid ( ) ) /* check the validity of container handle */
{
HCURSOR hCursor ;

/* get the container line object cursor */
lCont.GetObjectCursor ( CONTAINER_OBJECT_TYPE_LINE, &hCursor ) ;

*phCur = ( HCURSOR ) CopyImage ( phCur, IMAGE_CURSOR, 0, 0, 0 ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LContainer::GetObjectType

#include "Ltwrappr.h"

L_INT LContainer::GetObjectType (pnObjectType)

pCONTAINEROBJECTTYPE pnObjectType;

/* pointer to an integer */

Gets the current container object type.

Parameter | Description
pnObjectType | Pointer 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: | LContainer::SetObjectType
Topics: | Using Container Objects

Example

L_INT GetObjectTypeTest ( LContainer &lCont )
{
if ( lCont.IsValid ( ) ) /* check the validity of container handle */
{
CONTAINEROBJECTTYPE nObjectType;

/* get the current container object */
lCont.GetObjectType ( &nObjectType ) ;

/* stick to line object */
if ( CONTAINER_OBJECT_TYPE_LINE != nObjectType )
{
/* set the container object */
lCont.SetObjectType ( CONTAINER_OBJECT_TYPE_LINE ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LContainer::GetOffset

#include "Ltwrappr.h"

L_INT LContainer::GetOffset (pnXOffset, pnYOffset, pnZOffset)

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
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: | LContainer::SetOffset.
Topics: | Container Offsets

Example

L_INT GetOffsetTest ( LContainer &lCont )
{
if ( lCont.IsValid ( ) ) /* check the validity of container handle */
{
L_INT x, y, z ;

/* get the current offset values for the container */
lCont.GetOffset ( &x, &y, &z ) ;

x ++ ;
y ++ ;

/* set the current offset values for the container */
lCont.SetOffset ( x, y, z ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LContainer::GetOwner

#include "Ltwrappr.h"

L_INT LContainer::GetOwner (phwndOwner)

HWND* phwndOwner;

/* pointer to a window handle */

Gets the handle to the window that owns the container.

Parameter | Description
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: | LContainer::Create, LContainer::SetOwner
Topics: | Getting and Setting Container Properties

Example

For an example, refer to LContainer::Update.


LContainer::GetScalar

#include "Ltwrappr.h"

L_INT LContainer::GetScalar (pvptScalarNum, pvptScalarDen)

pVECTORPOINT pvptScalarNum; | /* pointer to a structure */
pVECTORPOINT pvptScalarDen; | /* pointer to a structure */

Gets the current container coordinates scaling values.

Parameter | Description
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: | LContainer::SetScalar.
Topics: | Container Scaling Values

Example

L_INT GetScalarTest ( LContainer &lCont )
{
if (SUCCESS == lCont.IsValid ( ) ) /* check the validity of container handle */
{
VECTORPOINT vptScalarNum, vptScalarDen ;

/* get the current scaling values */
lCont.GetScalar ( &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 ;

lCont.SetScalar ( &vptScalarNum, &vptScalarDen ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LContainer::Initialize

#include "Ltwrappr.h"

L_INT LContainer::Initialize (void)

Initializes the container handle.

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: | LContainer::IsValid, LContainer::SetMetrics , LContainer::Free.
Topics: | Initializing and Freeing Containers

Example

For an example, refer to LContainer::Create.


LContainer::IsEnabled

#include "Ltwrappr.h"

L_BOOL LContainer::IsEnabled (void)

Determines if the container is currently enabled or not.

Comments

The container must be enabled in order to edit objects.

To enable or disable a container, use LContainer::SetEnabled.

Returns

TRUE | The container is enabled.
FALSE | The container is disabled.

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: | LContainer::SetEnabled
Topics: | Getting and Setting Container Properties

Example

For an example, refer to LContainer::SetEnabled.


LContainer::IsOwnerDraw

#include "Ltwrappr.h"

L_BOOL LContainer::IsOwnerDraw (void )

Determines if the container is in owner draw mode or not.

Returns

TRUE | The container is in owner draw mode.
FALSE | The container is not in owner draw mode.

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: | LContainer::SetOwnerDraw
Topics: | Getting and Setting Container Properties

Example

For an example, refer to LContainer::SetOwnerDraw.


LContainer::IsValid

#include "Ltwrappr.h"

L_BOOL LContainer::IsValid (void)

Determines the validity of the given container handle.

Returns

TRUE | The handle is valid.
FALSE | The handle is not valid.

Comments

The container handle will be valid after calling LContainer::Initialize and LContainer::Create.

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: | LContainer::Initialize, LContainer::Create, LContainer::Free
Topics: | Initializing and Freeing Containers

Example

For an example, refer to LContainer::Create.


LContainer::Reset

#include "Ltwrappr.h"

L_INT LContainer::Reset (void)

Erases the contents of the container from the screen.

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: | LContainer::Update
Topics: | Displaying Objects

Example

/* This example will reset the container drawing contents */

LContainer lcont;

L_INT ResetContainer ()
{
if ( lcont.IsValid () ) /* check the validity of container handle */
{
/* Reset the container drawing on the screen (if any) */
lcont.Reset () ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LContainer::SetEnabled

#include "Ltwrappr.h"

L_INT LContainer::SetEnabled (bEnable)

L_BOOL bEnable;

/* enable/disable flag */

Enables or disables the container.

Parameter | Description
bEnable | 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: | LContainer::IsEnabled.
Topics: | Getting and Setting Container Properties

Example

/* This example toggles the enabling state of the container */

LContainer lcont;

L_INT ContainerToggleEnable ()
{
L_BOOL fEnable ;

/* Get the enabling state of the container */
fEnable = lcont.IsEnabled () ;

/* Toggle the state and return */
return lcont.SetEnabled (! fEnable ) ;
}


LContainer::SetObjectCursor

#include "Ltwrappr.h"

L_INT LContainer::SetObjectCursor (nObjectType, hCursor)

CONTAINEROBJECTTYPE nObjectType; | /* container object type */
HCURSOR hCursor; | /* handle to a windows cursor */

Sets the container object cursor.

Parameter | Description
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: | LContainer::GetObjectCursor.
Topics: | Using Container Objects

Example

/* This example shows how to set some container object cursor */

/* Global container handle */

LContainer lcont;

L_INT SetCursorTest ( HWND hWnd )
{
CONTAINERMETRICS Metrics ;

/* Initiate the container handle */
lcont.Initialize () ;

/* Create the container and attach it to its owner window */
lcont.Create (hWnd ) ;

if ( lcont.IsValid ( ) ) /* check the validity of the container handle */
{
HCURSOR hRectCursor ;

/* Load some cursor */
hRectCursor = LoadCursor ( NULL, IDC_CROSS ) ;

/* Set the rectangle object cursor */
lcont.SetObjectCursor (CONTAINER_OBJECT_TYPE_RECT, hRectCursor ) ;

/* Destroy the cursor, because its not needed any more */
DestroyCursor ( hRectCursor ) ;

/* Set the container object type to rectangle */
lcont.SetObjectType (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 */
lcont.SetMetrics (&Metrics ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LContainer::SetObjectType

#include "Ltwrappr.h"

L_INT LContainer::SetObjectType (nObjectType)

CONTAINEROBJECTTYPE nObjectType;

/* container object type */

Sets the container object drawing type.

Parameter | Description
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: | LContainer::GetObjectType
Topics: | Using Container Objects

Example

For an example, refer to LContainer::Create.


LContainer::SetOffset

#include "Ltwrappr.h"

L_INT LContainer::SetOffset (nXOffset, nYOffset, nZOffset = 0)

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
nXOffset | The offset in the X direction of the external representation.
nYOffset | The offset in the Y direction of the external representation.
nZOffset | The offset in the Z direction of the external representation. Default value is 0.

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 an 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

Yb = Ya + nYOffset

The default offsets 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: | LContainer::SetScalar, LContainer::GetOffset
Topics: | Container Offsets

Example

/* This will show to modify the container coordinates offset values to reflect the changes in the window offset */
/* The example assumes that there is an already initialized toolbar handle */
LContainer lCont ;

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 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 ) ;
lCont.SetOffset ( - prcView->top, 0 ) ;
}


LContainer::SetOwner

#include "Ltwrappr.h"

L_INT LContainer::SetOwner (hWndOwner)

HWND hWndOwner;

/* window handle */

Sets the container owner window.

Parameter | Description
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: | LContainer::Create, LContainer::GetOwner
Topics: | Getting and Setting Container Properties

Example

/* This example will set a new owner to the container */

LContainer lcont;

L_INT SetOwnerTest (HWND hwndNewOwner )
{
if ( lcont.IsValid () ) /* check the validity of container handle */
{
/* Set the window new owner window */
if ( SUCCESS != lcont.SetOwner (hwndNewOwner ) )
{
return FAILURE ;
}
else
{
return SUCCESS ;
}
}
else
{
return FAILURE ;
}
}


LContainer::SetOwnerDraw

#include "Ltwrappr.h"

L_INT LContainer::SetOwnerDraw (bOwnerDraw, dwFlags)

L_BOOL bOwnerDraw; | /* owner-draw enable/disable flag */
L_UINT32 dwFlags; | /* reserved */

Sets the container to owner draw mode.

Parameter | Description
bOwnerDraw | 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 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: | LContainer::IsOwnerDraw
Topics: | Getting and Setting Container Properties

Example

/* This example toggles the owner draw mode of the container */

LContainer lcont;

L_INT ContainerToggleOwnerDraw ()
{
L_BOOL fOwnerDraw ;

/* Get the owner draw mode of the container */
fOwnerDraw =lcont.IsOwnerDraw () ;

/* Toggle the state and return */
return lcont.SetOwnerDraw (!fOwnerDraw, 0 ) ;
}


LContainer::SetMetrics

#include "Ltwrappr.h"

L_INT LContainer::SetMetrics (pMetrics)

pCONTAINERMETRICS pMetrics;

/* pointer to a structure */

Set the container necessary information.

Parameter | Description
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: | LContainer::Initialize, LContainer::GetMetrics
Topics: | Getting and Setting Container Properties

Example

For an example, refer to LContainer::Create.


LContainer::SetScalar

#include "Ltwrappr.h"

L_INT LContainer::SetScalar (pvptScalarNum, pvptScalarDen)

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
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 an external representation is transformed by the container to the point (Xc, Yc) by using the following steps:

1.

Add offsets:

Xb = Xa + nXOffset

Yb = Ya + nYOffset

2.

Multiply by scalars:

Xc = (Xb * nXScalarNum) / nXScalarDen

Yc = (Yb * nYScalarNum) / nYScalarDen

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: | LContainer::SetOffset, LContainer::GetScalar
Topics: | Container Scaling Values

Example

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

LContainer lcont;
L_INT SetScalarTest ()
{
if ( lcont.IsValid () ) /* 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 ;

lcont.SetScalar (&vptScalarNum, &vptScalarDen ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


LContainer::Update

#include "Ltwrappr.h"

L_INT LContainer::Update (prcPaint)

LPRECT prcPaint;

/* pointer to the RECT structure to be updated */

Updates the container client area.

Parameter | Description
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: | LContainer::Reset
Topics: | Displaying Objects

Example

/* This example will update the container current drawing (if any) */

LContainer lcont;

L_INT UpdateContainer ( void )
{
if ( lcont.IsValid ( ) ) /* check the validity of container handle */
{
HWND hWndOwner ;
RECT rcOwnerClient ;

/* Get the container owner window */
lcont.GetOwner (&hWndOwner ) ;

/* Get the owner client rectangle */
::GetClientRect ( hWndOwner, &rcOwnerClient ) ;

/* Update the container drawing to the screen */
lcont.Update (&rcOwnerClient ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


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 LSettings::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 LSettings::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.