How to create schemes for eSchemes?
From http://en.ecomstation.ru/showarticle.php?id=146

2006-08-23 12:53:21 -- eCo Software (Yuri Prokushev)

Introduction

eSchemes is a system component aimed to form one common control center of system look & feel configuration. At the present time eSchemes allow control only existing system settings. It allows control:

    * system colors;
    * windows controls (close, hide, maximize, etc buttons);
    * titlebar enhancements (eStyler/2 Lite extensions);
    * control elements (radio-buttons, check-boxes, push buttons);
    * mouse pointers;
    * system sounds (including eWorkplace extensions);
    * WPS objects settings (via SETUP-string).

It is planned implement in the future:

    * fonts management support (including Innotek FT2LIB);
    * classes controls;
    * non-rectangular frames and controls;
    * system-wide skinning.

In general, eSchemes consists of:

   1. editor WPS/OSCL classes;
   2. storage Scheme class.

Editor uses storage Scheme class to store and retrieve scheme data. Because Scheme class is usual SOM class you a free to use any SOM-ready language to work with it.

So, as you can see, there are three methods to edit scheme:

    * using editor;
    * using Scheme class;
    * manual editing of scheme file (not recommended).






SOM Ready
eSchemes is based on SOM (System Object Model). As result you can extend eSchemes using this model. As mentioned above eSchemes consists of

    * Storage class Scheme
    * WPS class WPScheme
    * OSCL class Editor

Two first classes are public, the third class is not published because under is it under development. SOM developers know about class interfaces described via IDL. Download IDL files for Scheme class and WPScheme class.
	
2. Creating scheme using Object REXX

Starting from version 1.25 eSchemes is shipped with Scheme SOM class which controls saving and restoring scheme to/from file. The Scheme class allows to have scheme format independed way of scheme creation. Here is an example of scheme generation using ObjectREXX. You can easy use C/C++ or any other SOM-ready language to create schemes.
3. Manual editing of scheme file

This approach is not recommended because scheme file format can be changed in time. Anyway, at the present time this is the most powerful method to control scheme file. Keep in mind: in the future your tools can have problems with this scheme creation approach.

Schemes are stored in files with ®.SCH¯ extension. Actually, scheme file is usual ZIP file archive with INDEX.SCH file (contains describtion of the scheme) and various data files. You can create scheme components (like mouse pointers, icons, backgrounds, etc) and move them to scheme archive and describe in index.sch file.
INDEX.SCH file

INDEX.SCH file (located in scheme archive) consists of

   1. Comments
   2. Keywords
   3. Values

Comment is any text started from ®;¯ char at the start of line (first position). Keyword is a word before ®=¯ char. Value is a word after ®=¯ char corresponds to keyword. Example:

; This is comment
Keyword=Value

!REMEMBER! Last line must end with CR/LF. Otherwise it will be ignored.

The example and total list of INDEX.SCH keywords is listed below (most keywords are very clear, so don't require comments):

; Name of scheme
Name=This line contains name of scheme
Author=List of authors in any format

; Window titlebar buttons bitmaps
SystemMenuButton=SystemMenu.bmp
MinimizeButton=Minimize.bmp
MaximizeButton=Maximize.bmp
RestoreButton=Restore.bmp
HideButton=Hide.bmp
CloseButton=Close.bmp
PressedSystemMenuButton=PressedSystemMenu.bmp
PressedMinimizeButton=PressedMinimize.bmp
PressedMaximizeButton=PressedMaximize.bmp
PressedRestoreButton=PressedRestore.bmp
PressedHideButton=PressedHide.bmp
PressedCloseButton=PressedClose.bmp

; Window controls
CheckBoxButton=CheckBox.bmp
CheckedCheckBoxButton=CheckedCheckBox.bmp
RadioButton=Radio.bmp
CheckedRadioButton=CheckedRadio.bmp
PressedCheckBoxButton=PressedCheckBox.bmp
PressedCheckedCheckBoxButton=PressedCheckedCheckBox.bmp
PressedRadioButton=PressedRadio.bmp
PressedCheckedRadioButton=PressedCheckedRadio.bmp

; System sounds in format file.wav#volume. 
; Volume in range 0 to 100. Volume can be omitted.
CloseWindowSound=CloseWindow.wav#100
OpenWindowSound=OpenWindow.wav#100
LockSound=Lock.wav#100
ShutdownSound=Shutdown.wav#100
StartupSound=Startup.wav#100
BellSound=Bell.wav#100
InformationSound=Information.wav#100
DragStartSound=DragStart.wav#100
DragEndSound=DragEnd.wav#100
ErrorSound=Error.wav#100
PrinterErrorSound=Error.wav#100
WarningSound=Warning.wav#100
ShredderSound=Shredder.wav#100
RestartWPSSound=RestartWPS.wav#100
ContextMenuSound=ContextMenu.wav#100
MenuItemSound=MenuItem.wav#100
FolderDblClickSound=FolderDblClick.wav#100
GlobalHotkeySound=GlobalHotkey.wav#100

; Mouse pointers files
ArrowPointer=arrow.ptr
IllegalPointer=Illegal.ptr
MovePointer=Move.ptr
SizeNESWPointer=SizeNESW.ptr
SizeNSPointer=SizeNS.ptr
SizeNWSEPointer=SizeNWSE.ptr
SizeWEPointer=SizeWE.ptr
WaitPointer=Wait.ptr
TextPointer=Text.ptr

; WPS Objects settings. Format is same as setup string.
; First entry is object id. After ; goes setup string.
; See WPS reference for more info for setup strings.
; Here is example of some WPS objects settings.

; The desktop folder
Object=<WP_DESKTOP>;ICONFILE=PMWP56.ico;ICONNFILE=1,OpenPMWP56.ico;
   BACKGROUND=ecs_desk.bmp,S,1,I,255 255 255

; Objects on the desktop
Object=<WP_PROGRAMSFOLDER>;ICONFILE=PMWP92.ico;ICONNFILE=1,OpenECSWP101.ico
; Information
Object=<WP_OS2FS>;ICONFILE=PMWP4.ico
Object=<WP_OS2WIN>;ICONFILE=PMWP2.ico
; Network
Object=<WP_CONNECTIONSFOLDER>;ICONFILE=PMWP33.ico;ICONNFILE=1,OpenPMWP9.ico
; Internet
Object=<WP_INTERNET>;ICONFILE=ECSWP119.ico;ICONNFILE=1,OpenECSWP103.ico
;Templates
Object=<WP_TEMPS>;ICONFILE=PMWP48.ico;ICONNFILE=1,OpenPMWP10.ico

Object=<WP_DATAFOLDER>;ICONFILE=ECSWP110.ico;ICONNFILE=1,OpenECSWP111.ico
Object=<WP_OS2SYS>;ICONFILE=PMWP61.ico;ICONNFILE=1,OpenPMWP35.ico
Object=<WP_CONFIG>;ICONFILE=PMWP59.ico;ICONNFILE=1,OpenPMWP15.ico
Object=<WP_PROMPTS>;ICONFILE=PMWP37.ico;ICONNFILE=1,OpenPMWP38.ico
Object=<WP_VIEWER>;ICONFILE=PMWP58.ico;ICONNFILE=1,OpenECSWP102.ico
Object=<WP_START>;ICONFILE=PMWP29.ico;ICONNFILE=1,OpenPMWP8.ico
Object=<WP_DRIVES>;ICONFILE=PMWP27.ico;ICONNFILE=1,OpenECSWP112.ico
Object=<WP_PRINTERSFOLDER>;ICONFILE=PMWP93.ico;ICONNFILE=1,OpenPMWP94.ico
Object=<WP_SHRED>;ICONFILE=PMWP28.ico
Object=<WP_ASSISTANCE>;ICONFILE=PMWP82.ico;ICONNFILE=1,OpenPMWP83.ico
Object=<WP_INSTREMFOLDER>;ICONFILE=PMWP90.ico;ICONNFILE=1,OpenPMWP91.ico
Object=<WP_INFO>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<WP_TROUBLEINFO>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<WP_INFOOVERFOLDER>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<WP_REFCMDFOLDER>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<WP_READMEFOLDER>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<WP_UIINFO>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<WP_NETINFO>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<WP_NETINFO_LAN>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<WP_NETINFO_TCP>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<WP_TASKSINFO>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<WP_REXXINFO>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<WP_WISEINFO>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<WP_DEVINFO>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<WP_PDPINFO>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<WP_CONFIG_LOOK>;ICONFILE=ECSWP125.ico;ICONNFILE=1,OpenECSWP126.ico
Object=<WP_CONFIG_NET>;ICONFILE=ECSWP130.ico;ICONNFILE=1,OpenECSWP131.ico
Object=<WP_NETCFG_INTERFACES>;ICONFILE=ECSWP132.ico;ICONNFILE=1,OpenECSWP133.ico
Object=<WP_NETCFG_SERVICES>;ICONFILE=ECSWP135.ico;ICONNFILE=1,OpenECSWP136.ico
Object=<TCP/IP>;ICONFILE=ECSWP113.ico;ICONNFILE=1,OpenECSWP114.ico
Object=<TCP/IP_INFO>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<TCP_DHCP>;ICONFILE=ECSWP113.ico;ICONNFILE=1,OpenECSWP114.ico
Object=<TCP_DDNS>;ICONFILE=ECSWP113.ico;ICONNFILE=1,OpenECSWP114.ico
Object=<WP_TCPIPREMCONFIGTOOLS>;ICONFILE=ECSWP113.ico;ICONNFILE=1,OpenECSWP114.ico
Object=<ZAMPAFOLDER>;ICONFILE=ECSWP137.ico;ICONNFILE=1,OpenECSWP138.ico
Object=<WP_WINCFG>;ICONFILE=PMWP52.ico
Object=<LVMGUI>;ICONFILE=ECSWP127.ico
Object=<LVMREFRESH>;ICONFILE=ECSWP128.ico
Object=<XWP_FONTFOLDER>;ICONFILE=ECSWP140.ico;ICONNFILE=1,OpenECSWP141.ico
Object=<WP_DOSFS>;ICONFILE=PMWP1.ico
Object=<WP_DOSWIN>;ICONFILE=PMWP46.ico
Object=<WP_WINFS>;ICONFILE=PMWP52.ico
Object=<WP_WIN2WIN>;ICONFILE=PMWP72.ico
Object=<WP_DOS_DRV_A>;ICONFILE=PMWP47.ico
Object=<WP_CONNECTIONSHELP>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<WP_NETWORK>;ICONFILE=PMWP33.ico;ICONNFILE=1,OpenPMWP9.ico
Object=<WP_INETDOWNLOAD>;ICONFILE=ECSWP109.ico;ICONNFILE=1,OpenECSWP108.ico
Object=<WP_INETUPLOAD>;ICONFILE=ECSWP105.ico;ICONNFILE=1,OpenECSWP104.ico
Object=<WP_DIALUPTOOLS>;ICONFILE=ECSWP117.ico;ICONNFILE=1,OpenECSWP118.ico
Object=<WP_COOLURLSFOLDER>;ICONFILE=WPINET30.ico;ICONNFILE=1,OpenWPINET31.ico
Object=<URLF_AIR>;ICONFILE=WPINET30.ico;ICONNFILE=1,OpenWPINET31.ico
Object=<URLF_BUS>;ICONFILE=WPINET30.ico;ICONNFILE=1,OpenWPINET31.ico
Object=<URLF_COMP>;ICONFILE=WPINET30.ico;ICONNFILE=1,OpenWPINET31.ico
Object=<URLF_ENT>;ICONFILE=WPINET30.ico;ICONNFILE=1,OpenWPINET31.ico
Object=<URLF_REF>;ICONFILE=WPINET30.ico;ICONNFILE=1,OpenWPINET31.ico
Object=<URLF_SEARCH>;ICONFILE=WPINET30.ico;ICONNFILE=1,OpenWPINET31.ico
Object=<URLF_SEARCH>;ICONFILE=WPINET30.ico;ICONNFILE=1,OpenWPINET31.ico
Object=<URLF_OS2>;ICONFILE=WPINET30.ico;ICONNFILE=1,OpenWPINET31.ico
Object=<URLF_EDU>;ICONFILE=WPINET30.ico;ICONNFILE=1,OpenWPINET31.ico
Object=<URLF_NEWS>;ICONFILE=WPINET30.ico;ICONNFILE=1,OpenWPINET31.ico
Object=<WP_INETTOOLS>;ICONFILE=ECSWP116.ico;ICONNFILE=1,OpenECSWP115.ico
Object=<IAK_TEMPLATES>;ICONFILE=PMWP48.ico;ICONNFILE=1,OpenPMWP10.ico
Object=<WP_GAMES>;ICONFILE=PMWP88.ico;ICONNFILE=1,OpenPMWP89.ico
Object=<MMPM2_FOLDER>;ICONFILE=ECSWP200.ico;ICONNFILE=1,OpenECSWP201.ico
Object=<MMPM2_MOVIES_FOLDER>;ICONFILE=ECSWP204.ico;ICONNFILE=1,OpenECSWP205.ico
Object=<MMPM2_SOUNDS_FOLDER>;ICONFILE=ECSWP202.ico;ICONNFILE=1,OpenECSWP203.ico
Object=<MMPM2_SOUNDS_DESKTOP>;ICONFILE=ECSWP202.ico;ICONNFILE=1,OpenECSWP203.ico
Object=<MMPM2_SOUNDS_GARDEN>;ICONFILE=ECSWP202.ico;ICONNFILE=1,OpenECSWP203.ico
Object=<MMPM2_SOUNDS_OCEAN>;ICONFILE=ECSWP202.ico;ICONNFILE=1,OpenECSWP203.ico
Object=<MMPM2_SOUNDS_SPACE>;ICONFILE=ECSWP202.ico;ICONNFILE=1,OpenECSWP203.ico
Object=<JAVA_11>;ICONFILE=ECSWP107.ico;ICONNFILE=1,OpenECSWP106.ico
Object=<JAVA_13>;ICONFILE=ECSWP107.ico;ICONNFILE=1,OpenECSWP106.ico
Object=<JAVA_131>;ICONFILE=ECSWP107.ico;ICONNFILE=1,OpenECSWP106.ico
Object=<TOOLKIT_INFO>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<CT_TOOLINFO>;ICONFILE=PMWP60.ico;ICONNFILE=1,OpenECSWP100.ico
Object=<TOOLKIT_VOICETYPE>;ICONFILE=ECSWP206.ico;ICONNFILE=1,OpenECSWP207.ico
Object=<WP_FFST2>;ICONFILE=PMWP26.ico;ICONNFILE=1,OpenPMWP6.ico
Object=<WP_SPEECH>;ICONFILE=ECSWP206.ico;ICONNFILE=1,OpenECSWP207.ico
Object=<MMPM2_MMTEMPLATEFOLDER>;ICONFILE=PMWP48.ico;ICONNFILE=1,OpenPMWP10.ico
Object=<WPINET_TEMPLATES>;ICONFILE=PMWP48.ico;ICONNFILE=1,OpenPMWP10.ico
Object=<WP97TemplFolder>;ICONFILE=PMWP48.ico;ICONNFILE=1,OpenPMWP10.ico
Object=<PDP_TEMPLATESFOLDER>;ICONFILE=PMWP48.ico;ICONNFILE=1,OpenPMWP10.ico
Object=<XWP_LOCKUPSTR>;ICONFILE=PMWP78.ico
Object=<XWP_FINDSTR>;ICONFILE=PMWP79.ico
Object=<XWP_SHUTDOWNSTR>;ICONFILE=PMWP80.ico

; System colors (RRR GGG BBB). Here all system colors.
SYSCLR_ActiveBorder          =  204 204 204
SYSCLR_ActiveTitle           =  50 50 150
SYSCLR_ActiveTitleText       =  255 255 255
SYSCLR_ActiveTitleTextBgnd   =  50 50 150
SYSCLR_AppWorkspace          =  204 204 204
SYSCLR_Background            =  112 140 190
SYSCLR_ButtonDark            =  128 128 128
SYSCLR_ButtonDefault         =  0 0 0
SYSCLR_ButtonLight           =  255 255 255
SYSCLR_ButtonMiddle          =  204 204 204
SYSCLR_DialogBackground      =  204 204 204
SYSCLR_EntryField            =  255 255 255
SYSCLR_FieldBackground       =  204 204 204
SYSCLR_HelpBackground        =  255 255 255
SYSCLR_HelpHilite            =  64 64 255
SYSCLR_HelpText              =  0 0 0
SYSCLR_HiliteBackground      =  128 128 128
SYSCLR_HiliteForeground      =  255 255 255
SYSCLR_IconText              =  0 0 0
SYSCLR_InactiveBorder        =  204 204 204
SYSCLR_InactiveTitle         =  128 128 128
SYSCLR_InactiveTitleText     =  204 204 204
SYSCLR_InactiveTitleTextBgnd =  128 128 128
SYSCLR_Menu                  =  204 204 204
SYSCLR_MenuDisabledText      =  160 160 160
SYSCLR_MenuHilite            =  255 255 255
SYSCLR_MenuHiliteBgnd        =  50 50 150
SYSCLR_MenuText              =  0 0 0
SYSCLR_OutputText            =  0 0 0
SYSCLR_PageBackground        =  255 255 255
SYSCLR_Scrollbar             =  192 192 192
SYSCLR_Shadow                =  128 128 128
SYSCLR_ShadowHiliteBgnd      =  128 128 128
SYSCLR_ShadowHiliteFgnd      =  0 255 255
SYSCLR_ShadowText            =  85 110 170
SYSCLR_TitleBottom           =  128 128 128
SYSCLR_TitleText             =  255 255 255
SYSCLR_Window                =  255 255 255
SYSCLR_WindowFrame           =  128 128 128
SYSCLR_WindowStaticText      =  0 0 128
SYSCLR_WindowText            =  0 0 0

; Fonts. Controls corresponding fonts for parts of interface.
TitlebarTextFont=9.WarpSans
MenuTextFont=9.WarpSans
WindowTextFont=9.WarpSans
DefaultTextFont=9.WarpSans
DialogTextFont=9.WarpSans

; Titlebar settings.

; Solid (default), Gradient, Bitmap
ActiveTitleBarType=Gradient
; Left (default), Center, Right
ActiveTitleBarTextAlignment=Left
; Yes (default), No. If 3D Text used then text background is same as
; titlebar color and 3D shadow color is text backgound color.
ActiveTitleBar3DText=Yes
; Yes, No (default)
ActiveTitlebar3DBorder=No
; filename of titlebar bitmap
;ActiveTitleBarBitmap=titlebar.bmp
; Scaled (default), Tiled
ActiveTitlebarbitmaptype=Scaled
; Double (default), Single. Gradient one color is titlebar color,
; second color is border color.
ActiveTitlebarGradientType=Double
; Titlebar settings (Can not be applied, only previewed)
; Solid (default), Gradient, Bitmap
InActiveTitleBarType=Gradient
; Left (default), Center, Right
InActiveTitleBarTextAlignment=Left
; Yes, No (default). If 3D Text used then text background is same as
; titlebar color and 3D shadow color is text backgound color.
InActiveTitleBar3DText=Yes
; Yes, No (default)
InActiveTitlebar3DBorder=No
; filename of titlebar bitmap
;InActiveTitleBarBitmap=titlebar.bmp
; Scaled (default), Tiled
InActiveTitlebarbitmaptype=Scaled
; Double (default), Single
InActiveTitlebarGradientType=Double

; Push buttons settings.

ButtonType=Bitmap
ButtonBitmap=oblique.bmp
;
DefaultButtonType=Bitmap
DefaultButtonBitmap=oblique.bmp
;
DisabledButtonType=Bitmap
DisabledButtonBitmap=oblique.bmp
Icons (Resolution and color depth)

Icons are used in settings of WPS classes and objects. Usually, icons are listed in setup string of object. Each icon, included to scheme should carry pictures (frames) in formats: (Width/Height/Colors) at least:

    * 40ž40 ž 256
    * 32ž32 ž 256
    * 20ž20 ž 256
    * 16ž16 ž 256
    * 40ž40 ž 16
    * 32ž32 ž 16
    * 20ž20 ž 16
    * 16ž16 ž 16
    * 32ž32 ž 2
    * 16ž16 ž 2

Titlebar buttons bitmaps

Titlebar buttons bitmaps are used for titlebar buttons creation. Each bitmap file is a bitmap array with two resolutions:

    * 16ž16
    * 13ž13

Radio buttons and checkbox bitmaps

Radio buttons and checkbox buttons are drawn using bitmaps. Each bitmap file is a bitmap array with two resolutions:

    * 16ž16
    * 13ž13

Push button and titlebar bitmaps

Bitmaps for push buttons are 40ž40 bitmap. This bitmap is stretched to button size. Titlebar bitmap is XXXx22 bitmap. XXX here is any size depending on image texture. Titlebar bitmap not sized, but mosaic by X coordinate.
System Colors

System colors are controlled by SYSCLR_* keywords. Color values must be defined in RGB format:

SYSCLR_BACKGROUND=127 127 0
Sounds

At the present time the only supported sound format is WAV format.
Pointers

Can be used standard pointers 32ž32 ž 2 or color pointers 32ž32 ž 16 in PTR format.
WPS Objects

WPS Objects are controlled by setup strings. To store in index.sch file use Object keyword. Format is following:

Object=<ObjectID>;<setup-string>

For setup string refer to corresponding object documentation.
How applications must select colors

Any control element (in original PM logic) must get color in following order:

   1. PresParam; if none then
   2. Local Contol Colors table (via WinQueryControlColors); if none then
   3. Global Control Colors table (via WinQueryControlColors); if none then
   4. SysColor; if none then
   5. hardcoded color.

Actually, to allow user to have control on colors step 5 must never be performed. This is as everything should work. If such logic is right, then the standard Scheme editor would allow users to change any color via system colors. If no such logic then the user would need to edit EVERY controls' color. LOTS of colors.

But things doesn't work, because WinSetControlColors can't change some color values. Ideally, WinSetContolColors should allow to set ANY value to a SYSCLR_* constant. Actually, some colors can be set to SYSCLR_* values, some can only be set to RGB_* values, and some can't be changed at all (hardcoded). As a result we can't control ALL colors, only a subset. eSchemes has workaround this problem and tries to fix broken logic by sincronization of Control Colors Table with System Colors.

Applications also must process windows messages which notify about Control Colors Table changes and System Colors changes to allow color update on the fly.



Please visit <http://en.ecomstation.ru/showarticle.php?id=146> for a more complete tutorial and information.
