|
CuteStudio's WRAITH
WRAITH is a graphics layer than fits between an application and a user.

WRAITH features
- MDF Menu Definition File - a simple text file, defining menus, styles, boxes and behaviour
-
Efficient 'minimum contact' connection API
-
Automatic value snooping
-
Lean Cuisine hierarchical choice structure
-
Palette control, styles.
Application
In general a windowed application is controlled by the window system. Events arrive and are dealt with, and that's that. The thing with applications is that you need menus to pop up and handle stuff the user wants to do. What WRAITH allows you to do it actually run your application for you. A WRAITH application is running WRAITH, and only asks application code to do stuff when absolutely required.
This strict layering modularity allows the program to divest all user-interface responsibility to WRAITH and therefore the application program becomes very simple, aiding development times and consistency.
Connectors
static int enabled=FALSE;
wr_connect("p_test", "Enable", CON_BOOL, &enables);
wr_connect("p_file", "Open", CON_FUNC, test_explore);
WRAITH connects to program strings, booleans and functions via wr_connect statements. This is the only linkage between the application and the WRAITH GUI, as can be seen this makes applications extremely simple and allows WRAITH to fully manage the program properties with the user.
- Integer - boolean value (0 and non-zero)
-
String - to display
-
String - to display and edit
-
Function - menu board opening
-
Function - menu board closing
-
Function - button pressed
Menu Definition Files
The menu definition file determines which menus go where. There are the following types of menu:
- MENU - the main top level menu bar (high priority window)
-
PULLDOWN - a pulldown menu, auto box locations, auto menu location
-
PULLUP - a pop-up context menu, auto box locations, auto menu location
-
BOARD - a regular menu
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
BOARD "batch" {
POS (5,5); SIZE (70,20); GRID(70,20);
TITLE "Batch mode - operate on many files";
WINDOWNAME "Batch mode file selector";
TYPE { FLOATING; }
BOX "in_dir" { POS( 1, 1); SIZE(62, 3); TEXT ""; TYPE STEXT; }
BOX "in_choose" { POS(63, 1); SIZE( 6, 3); TEXT "Choose"; TYPE FUNC; }
BOX "cmp_enable" { POS( 1, 5); SIZE(25, 3); TEXT "Create (equal level) comparism files"; TYPE BOOLEAN; TYPE FUNC2 "u"; }
BOX "cmp_rmsavg" { POS(43, 5); SIZE(20, 3); TEXT "Use 50ms RMS averaging"; TYPE BOOLEAN; }
BOX "cmp_pre" { POS( 3, 8); SIZE(20, 3); TEXT "Follow level reduction"; TYPE BOOLEAN; PANEL_CLASS "radio"; }
BOX "cmp_post" { POS(23, 8); SIZE(20, 3); TEXT "Match final declipped level"; TYPE BOOLEAN; PANEL_CLASS "radio"; }
BOX "out_dir" { POS( 1,12); SIZE(62, 3); TEXT ""; TYPE STEXT; }
BOX "out_choose" { POS(63,12); SIZE( 6, 3); TEXT "Choose"; TYPE FUNC; }
BOX "Cancel" { POS( 1,16); SIZE( 8, 3); TYPE FUNC; TYPE EXIT; }
BOX "Ok" { POS(61,16); SIZE( 8, 3); TEXT "Start"; TYPE FUNC; }
ACTION {
choose [ in_choose | out_choose ];
type [cmp_pre | cmp_post];
ex1 (choose, type, in_dir, cmp_enable, out_dir, cmp_rmsavg, Cancel, Ok);
MAIN [ex1];
}
DEF_SCAN { type; }
DEFAULT { cmp_pre; }
}
Panels
The look and feel of what the user sees is completely tailored by panel definitions using Flex positions and sizes. A flex position or size is one that follows two coordinate grids:
- Scaled coordinate system (area divided into parts)
-
Relative pixel positions
In this manner an area (i.e. a menu or section of panel) can be divided into a grid, and a pixel based correction is added afterwards. For example:
GRID(10,10);
BLOCK (1,1,2,2)(2,2-2,-2);
this method was actualy first used in the 1980s and has huge benefits in layout control, especially in situations where pixel shapes are not always square and screen resolutions change. All WRAITH menus and panels are positioned using this method. This allows items to seamlessly scale by maintain local relationships.
Menu boxes
Each menu box has a particular task. If visible they also have a position and a size.
A box has the following master attributes:
- Hidden
-
Flex position
-
Flex size
-
Disabled
A box can also have the following types
- FUNC - a function is called when pressed
-
TEXT - program text is displayed
-
BOOLEAN - the box snoops and toggles a boolean program value
-
SUB - A sub-menu is opened (choice set by FUNC return value if used)
-
FUNC2 - a function is called later
-
LIST - the box becomes a list
Menu action statements
Each menu has an ACTION statement that simply determines how one box relates to another. The first ACTION statement starts with MAIN that has an exclusive list. Each exclusive list points to inclusive lists, items of which point again to exclusive lists.
For instance if two choices are exclusive then they appear in a an exclusive list, else they appear in an inclusive list. This simple method allows the rules of the menu to be encoded into the MDF files very efficiently - no IF statements.
This simplifies both application and menu control.
| |