Example of Creating a Registration Package
The following steps create a registration package for an existing, non-desktop smart application named BestTextEditor.
Information You Need to Know About ``BestTextEditor''
The example assumes the following facts about the BestTextEditor application:
It was installed into the directory /usr/BTE.
The user's session language is the default value, C.
The command line to start BestTextEditor is:
BTEd {filename]
where filename is the name of the data file to open in the new window. BestTextEditor creates its own window--that is, it does not run inside a terminal emulator window.
BestTextEditor creates and uses two types of data files:
Documentation files. They use the naming convention *.bte. BestTextEditor provides a command line for printing its .bte data files. The syntax of this command is:
BTEPrint [-d destination] [-s] filename
where:
-d destination--specifies destination printer.
-s--specifies silent printing. The application's print dialog box is not displayed.
filename--specifies the file to be printed.
Template files. They use the naming convention *.tpl. Template files cannot be printed.
The existing, non-desktop app-defaults files for BestTextEditor contain resources for interface fonts and foreground and background colors.
An online help volume for BestTextEditor was created using the desktop Help Developer's Kit. When the online help volume was built, it used the following source files:
.../BTEHelp.htg .../graphics/BTE1.xwd .../graphics/BTE2.xwd
and generated the file .../BTEHelp.sdl.
Steps to Registering ``BestTextEditor''
The following step-wise procedure registers BestTextEditor.
Modify font and color resources.
In BestTextEditor's app-defaults file, remove resources that set:
Fonts for text
Colors for foreground and background
Create the application root.
Create the directory:
/desktop_approots/BTE
If you are integrating an existing application, you should create the application root directory elsewhere than in the installation location for the application; otherwise, the configuration files you create may be removed when you update the application.
Create the registration package directories.
Create these directories:
/desktop_approots/BTE/dt/appconfig/types/C /desktop_approots/BTE/dt/appconfig/help/C /desktop_approots/BTE/dt/appconfig/icons/C /desktop_approots/BTE/dt/appconfig/appmanager/C/BestTextEditor
Create the actions and data types for the application.
Create the configuration file for the action and data type definitions:
/desktop_approots/BTE/dt/appconfig/types/C/BTE.dt
Create the action definition for running BestTextEditor:
ACTION BTEditor { WINDOW_TYPE NO_STDIO ICON BTERun DESCRIPTION Double-click this icon or drop \ a BTE data file on it to run \ BestTextEditor. EXEC_STRING /usr/BTE/BTEd %Arg_1% }
Create the data type for *.bte files:
DATA_ATTRIBUTES BTEDataFile { DESCRIPTION BestTextEditor data file. ICON BTEData ACTIONS Open,Print } DATA_CRITERIA BTEDataFileCriteria1 { DATA_ATTRIBUTES_NAME BTEDataFile NAME_PATTERN *.bte MODE f }
Create the data type for *.tpl files:
DATA_ATTRIBUTES BTETemplateFile { DESCRIPTION BestTextEditor template file. ICON BTETempl ACTIONS Open } DATA_CRITERIAL BTETemplateFileCriteria1 { DATA_ATTRIBUTES_NAME BTETemplateFile NAME_PATTERN *.tpl MODE f }
Create the Open action for *.bte files.
ACTION Open { ARG_TYPE BTEDataFile TYPE MAP MAP_ACTION BTEditor }
Create the Print action for *.bte files.
Here are simple Print actions that will print the data files. These actions require a value for the LPDEST environment variable and ignore the -s print option. (If LPDEST isn't set, the action may fail.)
ACTION Print { ARG_TYPE BTEDataFile TYPE MAP MAP_ACTION BTEPrintData }
ACTION BTEPrintData { WINDOW_TYPE NO_STDIO EXEC_STRING BTEPrint -d $LPDEST %Arg_1% }
Here is another version of the BTEPrintData action and an accompanying script. Together, they handle situations where LPDEST is not set or if silent printing is requested.
ACTION BTEPrintData { WINDOW_TYPE NO_STDIO EXEC_STRING /usr/BTE/bin/BTEenvprint \ %(File)Arg_1% }
The contents of the /usr/BTE/bin/BTEenvprint script are:
# BTEenvprint #!/bin/sh DEST="" SILENT="" if [ $LPDEST ] ; then DEST="-d $LPDEST" fi BTEPrint $DEST SILENT $1
Create the Open action for *.tpl files:
ACTION Open { ARG_TYPE BTETemplateFile TYPE MAP MAP_ACTION BTEditor }
Create the Print action for *.tpl files:
ACTION Print { ARG_TYPES BTETemplateFile TYPE MAP MAP_ACTION NoPrint }
NoPrint is a built-in action that displays a dialog box telling the user the file cannot be printed.
Put the help files into the registration package.
Place the help files in the following locations:
/desktop_approots/BTE/dt/appconfig/help/C/BTEHelp.sdl /desktop_approots/BTE/dt/appconfig/help/C/graphics/BTE1.xwd /desktop_approots/BTE/dt/appconfig/help/C/graphics/BTE2.xwd
Create the file:
/desktop_approots/BTE/dt/appconfig/types/C/BTEhelp.dt.
Put the following action definition in the file:
ACTION BTEHelp { WINDOW_TYPE NO_STDIO EXEC_STRING /usr/dt/bin/dthelpview -helpVolume \ BTEHelp.sdl DESCRIPTION Opens the BestTextEditor help volume. }
Create icons for the application.
Use Icon Editor to create the icons. Table 5-3 shows the size guidelines to use.
Table 5-3 Icon Size Guidelines
Name
Size
basename.t.pm
16 by 16
basename.m.pm
32 by 32
basename.l.pm
48 by 48
Create these icon files in the directory /desktop_approots/BTE/dt/appconfig/icons/C:
Icons to represent the action that runs the application: BTERun.t.pm, BTERun.m.pm, BTERun.l.pm
Icons to represent *.bte files: BTEData.t.pm, BTEData.m.pm,
Icons to represent *.tpl files: BTETempl.t.pm, BTETempl.m.pm
Icons to represent the application group (used in step 7): BTEApp.t.pm, BTEApp.m.pm
If you haven't already done so, create the directory.
/desktop_approots/BTE/dt/appconfig/appmanager/C/BestTextEditor
This step is optional. It provides a unique icon for the application group icon by creating a data type and associated actions for the application group. If you omit this step, the application group will use the default icon.
Add the following data type and action definitions to the file /desktop_approots/BTE/dt/appconfig/types/C/BTE.dt. The data type specifies the icon to be used by the BestTextEditor application group. The actions provide the same Open and Print behavior as the built-in application groups.
DATA_ATTRIBUTES BestTextEditorAppGroup { ACTIONS OpenInPlace,OpenNewView ICON BTEApp {
DATA_CRITERIA BestTextEditorAppGroupCriterial { DATA_ATTRIBUTES_NAME BestTextEditorAppGroup MODE d PATH_PATTERN */appmanager/*/BestTextEditor }
ACTION Open { ARG_TYPE BestTextEditorAppGroup TYPE MAP MAP_ACTION OpenAppGroup }
ACTION Print { ARG_TYPE BestTextEditorAppGroup TYPE MAP MAP_ACTION PrintAppGroup }
Create an icon in the application group that will start the application. To do this, create the file:
/desktop_approots/BTE/dt/appconfig/appmanager/C \ /BestTextEditor/BTEditor
and make the file executable.
Create the action file in the application group that will open the help volume. To do this, create the file:
/desktop_approots/BTE/dt/appconfig/appmanager/C \ /BestTextEditor/BTEHelp
and make the file executable.
Put other files into the application group; for example, "read me" files, sample data and template files.
Register the application.
In a terminal emulator window: