Views Studio Panel Description File

The $ILVHOME/studio/data/studio.pnl file provides you with the default descriptions of the panels supplied. You can alter these descriptions and add your own panel descriptions by using an additional panel description file (.pnl). To make Views Studio read your .pnl file, declare it in a studio option file. For more information, see The Option File .

Panel Properties

A Views Studio panel is configured by the following set of properties:

  • title "<title>" specifies the panel title. By default, the panel name is used.

  • visible <true/false> indicates whether the panel is displayed when the editor is launched.

  • menu "<menuBarItem>" [,"<menuItem1> ...] { <menuItemList> } lets you set a menu to the panel. This option can be repeated. It only works if the panel contains a menu bar (its getMenuBar function returns a menu bar or its container contains a menu bar named MenuBar). The menu location is specified by a menu bar item, and, if it is a submenu, it is followed by the list of the menu items leading to the new menu position. A menu item is identified by its label or its command name. Each item of <menuItemList> can be a command name, a label for a submenu, or the '-' character for adding a separator. For example, the File > New menu of the Main window is defined by the following specification:

panel "MainPanel" {

menu "&mfile", "&new" {

NewGadgetBuffer,

NewGraphicBuffer

NewGrapherBuffer,

-, // a separator.

NewApplication,

MakeDefaultApplication

}

}

  • menuItem <itemSpec> : "<menuBarItem>" [,"<menuItem1> ...] [-before <refItem>] is used to insert an item in the specified menu. This option can be repeated. The new item specified by <itemSpec> can be a command name, a label or the '-' character (for a separator). The menu location is specified by a menu bar item, and, if it is a submenu, it is followed by the list of the menu items leading to the target menu position. You can insert the new item before a <refItem> by using the -before keyword; otherwise, the item is added to the end of the menu.

  • removeMenuItem <commandName> : "<menuBarItem>" [,"<menuItem1> ...] lets you remove a menu item previously specified by a configuration file. The <commandName> parameter is the name of the command attached to the menu item to be removed. The menu location is specified by a menu bar item, and, if it is a submenu, it is followed by the list of the menu items leading to the target menu position.

  • toolbar <location> { <toolBarItemList> } lets you add a tool bar to the panel. This option can be repeated. The <location> parameter can be either left, top, right, or bottom. There can be several tool bars at each location. <toolBarItemList> is a list of command names or tool bar names (defined in a .opt file) separated by a comma (,).

For example:

panel "MainPanel" {

toolbar right {

SelectLabelMode,

SelectLabelListMode,

SelectReliefLineMode

}

}

  • x, y, width, and height let you specify the position and the size of the panel.

  • command "<objectName>" <commandName> lets you attach a command to a named gadget contained in your panel. For example, if your panel contains a button named "Open":

panel "MyPanel" {

command "Open" OpenDocument;

}

  • filename "<filename>" lets you specify a data file (.ilv) for your panel. The specified file must be found in ILVPATH. It will be loaded by your panel. For example, the Alignment panel is created entirely without coding. It uses the alignmt.ilv data file and attaches commands to its buttons:

panel "Alignment" {

commandName ShowAlignPanel;// the command that shows the panel

filename "alignmt.ilv"; // load that data file

x 500;

y 100;

command "left" AlignLeft;

command "right" AlignRight;

command "vertical" AlignVertical;

command "samew" SameWidth;

command "hspace" HorizontalSpaces;

command "top" AlignTop;

command "bottom" AlignBottom;

command "horizontal" AlignHorizontal;

command "sameh" SameHeight;

command "vspace" VerticalSpaces;

}

  • commandName <commandName> lets you specify the name of the command that shows or hides your panel. This is necessary to maintain the command state according to the panel visibility, unless the command name corresponding to your panel is named Show<PanelName>.

  • topView <true/false> is used by certain particular panels that are created by default as panes in the Main window, like the Classes palette:

panel "Classes" {

topView true;

}

Example

The following panel file, /users/smith/mystudio.pnl, displays the Commands palette instead of the Palettes panel when the Views Studio is launched.

panel "Commands" {

visible true;

}

 

panel "PalettePanel" {

visible false;

}

The /users/smith/mystudio.opt file declares the above panel file:

studio {

panelFile "/users/smith/mystudio.pnl";

}

The following panel creates a panel containing editing modes without coding:

panel "MyEditingModes" {

title "Modes"; // Set the panel title

visible true; // visible when the editor is launched

x 300; // the panel horizontal position

y 300; // the panel vertical position

width 150; // the panel width

height 150; // the panel height

toolbar top { // first tool bar

SelectSelectionMode,

SelectPolylineMode,

SelectLabelMode,

SelectLabelListMode

}

toolbar top { // second tool bar

SelectFocusMode,

SelectAttachmentsMode,

SelectMenuMode,

SelectMatrixMode

}

toolbar top { // third tool bar

SelectLineMode,

SelectReliefLineMode,

SelectArrowLineMode,

SelectPolylineMode

}

}