1. Windows Ini files Editor (WINE)

Many programmers suppose that ini files are old mechanism and recommend to work only with Registry.
Inspite of that I know enough brilliant programmers that continue to work with ini file.
In very truth:  Old friends and old wine are best.
I wrote Windows Ini files Editor (WINE) based on this proverb  and now I can say:
Old friends and new WINE are best.

WINE may be used from any Window9X/NT/2K
application for its tuning and other goals by convenient resizeable dialog.

This tool may be useful for programmers, that got used to
comment their .ini-configuration files, to make its contents
clearer for them and for others.

Wine contains the following comprehensive set of abilities for editing .ini  files:

    - It may set  WINE editor's configuration  parameters.
    - Allows to view, create and edit .INI files, containing section and key commentaries.
    - Updated rows are marked for visual control.
    - Section or key name already existing in .INI file is checked.
    - It may set a type of key to update its value by appropriate dialog.
          This version supports 9 following types:
            CHARACTER, BOOLEAN, INTEGER,
            FILENAME, DIRECTORY,  LIST,  COLOR,  FONT, LINK.
    - The following key attributes are added : Show/Hide, ReadOnly/ReadWrite.
    - Template support;
            it  may create any section, like a choosen section from a template library.
    - Multi pattern  editing support;
            it may create any number of files (not only .ini) from a special .ini file
            and from a set of pattern files.
    - It is possible to work simultaneously with several copies of programs by menu or control bar.

New features version 2.02:
    - Choice between small and large icons  for toolbar.
    - New Key type LINK to point on any section.
    - Change in Search design.

New features version 2.03:
    - The following key attributes are added : Show/Hide, ReadOnly/ReadWrite.
      They give possibility to show or hide any key in any section, permit or forbid updating of any key.
    - Help support is improved.
    - Additional check data for INTEGER type.

Delivered file Wine0203.zip contains the following:
 
 
Wine.exe, TB.exe, HelpHTML.exe programs
RunDemo.bat batch file to run Demo
Wine.ini  .ini file with configuration parameters for wine.exe
TemplateLib.ini  template library
test.ini, wincmd.ini,  samples
InpMpEdit.ini  a sample for Multi pattern Editing
Directories Patterns,Output directories for Multi pattern Editing
Patterns\Month.html a sample Pattern for Multi pattern Editing
Directory HTML directory with help files
Readme.txt

2. Commentary rules
As usually commentary is a string with ";" at the first column.
Commentaries must precede a section or key that they belong to.

Examples:

Commentary for Sections

;----- This section is used in all modules ---------
[General System Parameters]
..................
;------ Max Slot Number = 21 ---------
[Slot15]

Commentary for Keys may contain possible values:

;------- Debug = INTERNAL | EXTERNAL | NONE -------
Debug=INTERNAL
;------- ACTIVITY = TRUE | FALSE
ACTIVITY = TRUE

or explanatory text. Commentary may locate on several lines:

;------ Coordinates in meters ---------
; Format = x,y,z
Coordinates = 30,70,100

During editing process WINE replaces symbols at the end of line
(0xD and 0xA) for "\n", like in a format field of "printf"-function.

When User writes contents of Commentary-field, symbols "\n" must be used
also as a sign end of line.

3. Command line call

It allows User to call the program Wine.exe from the command prompt.

Syntax:
    Wine [<filename.ini>]

4. User Interface


 
 

Column "Type" in Key Area can be closed if KeyType=0 (see p.7 ).
2 buttons "Back" and "Forward" - for navigation if KeyType = LINK.
Choose Key with type LINK by left Mouse button. After that press button "Forward" to move to
Section specified in Value column.
Press button "Back" for return in previous position.
 

5. Menus
 

Item "New Instance" creates a new instance of Wine.exe
Items "New", "Open", "Save", "Save as" - is a standard set of services that does not need explanations.
E.g. when User wants to create a new file he carries out the following:
    - choose item File-New in  menu or run WINE without parameters,
    - click right mouse botton to create in Section Area one or several entries,
    - click right mouse botton to create for each entries from Section Area,
       one or several Keys,
    - choose item File-Save or File-Save As to save a created ini file.

KeyType Section is an additional section where types of keys from all sections are saved.

If [General Parameters]->KeyType=1 in Wine.ini and KeyType does not exist
(when user opens ini file without KeyType Section at first time )
KeyType Section is created automatically and keys from all sections are saved there.

By default types of all keys are CHARACTER, and User may to change it later.

"Create KeyType Section" and "Add to KeyType Section" are  items for work with KeyType Section.
Item "Create KeyType Section" re-creates KeyType Section and fills it with name of keys from
all sections. User may use this item when he wants to add KeyType Section to normal ini files.
KeyType Section may create also by popup Menu for Section Area.
Item "Add to KeyType Section" adds to KeyType Section names of keys that are absent in KeyType Section.

If  User creates a new key and parameter KeyType = 1 from Section General Parameters in Wine.ini file, type of a new key adds to KeyType Section automatically.

Item "Multi Pattern Editing" (see p.10)  - to open input file for multi pattern editing.
 

Items "Section" and "Key" are identical to popup menu in p.6 (see below).
Item "Ini Source" shows .ini file in Notepad.exe.
 
 

By item Size User opens dialog with current width and height of WINE-window.
About other items see p.7  below.

6. Mouse buttons

User may use left and right buttons within Section and Key areas:

- Left button - to select section or key.
- Right button - for popup menu:
 

to set key Attributes in KeyType Section
 

to choose "Search,New, Delete, Update" for Section or Key.

When User creates a new Section he must fill the following Dialog:

User can use sections from template library. For new sections  not use template library
choose None.
 

If  User want to search a Key he can do it by the following Dialog:

For check this item open file wincmd.ini (a sample) that has a long list of sections.
 
 
 

7. Configuration

File wine.ini contains keys for setting width,  height and other parameters of resizeable dialog
and parameters for Section and Key areas:

;-----------------------
[General Parameters]
;default = 554
Width=550
;default = 492
Height=550
HelpDirectory=d:\work\WiniEdit\V201\HTML
TemplateFile=d:\work\WiniEdit\V201\Debug\TemplateLib.ini
DefaultIndexTemplateFile=2   number of section from TemplateLib.ini
                                      = 0 for none template
KeyType=1              to work withKeyType Section
ShowKeyType=1        to show/hideKeyType Section in Section area
Font={-18 0 0 0 400 0 0 0 0 3 2 1 34 "Arial"} 0x0           font for Section and Key ListControls
ToolbarIcons=Small
;-----------------------
[Section Control]
BkColor=0xE1FFFF     COLORREF = RGB(R,G,B)
TextColor=0x0        COLORREF = RGB(R,G,B)
;ColumnSize = %
SectionColumnSize=25
;-----------------------
[Key/Value Control]
BkColor=0xE1FFFF     COLORREF = RGB(R,G,B)
TextColor=0x0        COLORREF = RGB(R,G,B)
;KeyColumnSize = %
KeyColumnSize=25
;ValueColumnSize = %
ValueColumnSize=25

Choose item Configuration-Settings in  menu.
After parameters are updated it is needed to:
    - choose item File-Save,
    - choose item Configuration-Refresh.
 

8. Types of keys and attributes
 

This version supports 8 following types of keys:

CHARACTER, BOOLEAN, INTEGER,  FILENAME,
DIRECTORY,  LIST,  COLOR,  FONT

Information about types of keys is kept in KeyType Section.
If  [General Parameters]-KeyType = 1,  types of keys is shown in Section area
and User may use KeyType Section.
If  [General Parameters]-ShowKeyType = 1 KeyType Section is shown in Section area.

Format name of keys in KeyType Section is following:
<Key name>: =  <Section Name>{Key Name}

E.g. for key Size from section Parameters Key name:
        Parameters{Size}

2 types (Integer and List) have a special format:

INTEGER, <Min Value>, <Max Value>, <Base>
    <Base>:= 10 | 16

LIST,<Value1>,<Value2>,<Value3>,...<ValueN>

Type of all keys from KeyType Section is the following List format:
    List,CHARACTER, BOOLEAN, INTEGER,  FILENAME, DIRECTORY,  LIST,  COLOR,  FONT
 

When a User wants to add a new Key he  chooses item "New" from popup Menu (see p.6)
and the following dialog appears:

After that in accordance with choosen type one of  the following dialogs appears.
 

        CHARACTER                                                     BOOLEAN


 

A choosen value for type COLOR  is COLORREF (hexadecimal).

        COLOR                                                            FILENAME and DIRECTORY


 

        FONT

Value-field for type FONT is LOGFONT structure.
format Value-field for type FONT:

{
   lfHeight  lfWidth  lfEscapement  lfOrientation  lfWeight  lfItalic
   lfUnderline  lfStrikeOut  lfCharSet  lfOutPrecision  lfClipPrecision
   lfQuality  lfPitchAndFamily lfFaceName
} Color
 

C-code to fill LOGFONT structure from above-mentioned Value-field:

LOGFONT* GetLogFontStructure( char* bufferLF, COLORREF* Color )
{
      int    i;
      char*  p;
      int    length;
      char*  pBegin  = 0;
      char*  pEnd    = 0;
      char*  pColor  = 0;
      LOGFONT   lf;
      LOGFONT*   plf = &lf;

  sscanf(  bufferLF,
  "{%d %d %d %d %d %d %d %d %d %d %d %d %d ",

    &lf.lfHeight,
    &lf.lfWidth,
    &lf.lfEscapement,
    &lf.lfOrientation,
    &lf.lfWeight,
    &lf.lfItalic,
    &lf.lfUnderline,
    &lf.lfStrikeOut,
    &lf.lfCharSet,
    &lf.lfOutPrecision,
    &lf.lfClipPrecision,
    &lf.lfQuality,
    &lf.lfPitchAndFamily);
 

    for (i = 0;i < (int)strlen(bufferLF);i++)
    {
       p = &bufferLF[i];
       if (*p == '"')
       {
          if (!pBegin)
         {
            pBegin= &bufferLF[i] + 1;
            continue;
         }
         if(pBegin)
         {
            pEnd = &bufferLF[i];
            continue;;
         }
       }
       if (*p == '}')
       {
          pColor = p + 1;
          break;
       }
    }
    length = pEnd - pBegin;
    memcpy(lf.lfFaceName,pBegin,length);
    lf.lfFaceName[length] = 0;
    sscanf(pColor," 0x%X",&Color);
    return plf;
}

                LINK

Value is a list of all sections besides KeyType section.
 

Before to fill values for Integer and List types 2 the following Dialogs appear:


 

            INTEGER                                LIST


 

The following key attributes are: Show/Hide, ReadOnly/ReadWrite.
They give possibility to show or hide any key in any section, permit or forbid updating of any key.
User sets attributes for any key in KeyType Section and must save ini file after this action.
Default attributes are: Show and ReadWrite.
Wine Editor saves attributes  in Value-field for key of KeyType Section:
    - S        - Show,
    - H       - Hide,
    - RW    - ReadWrite,
    - RO     - ReadOnly.
 

9. Templates

Key General Parameters-TemplateFile in Wine.ini sets Template library.
Template library is a simple .ini file and may be opened by item Configuration-Template.
How to create a new Section with type from Template library see p.6.
Sections from Template library must be filled with keys and each key may have a type.

User chooses Name of Section from a list with Section names from Template library
or none if  he does not want to use Template library.
After that a new section is created  in user .ini file with keys and their types from chosen
Template library section. Additionally a key Template is added  with value equal to the chosen
section name.

Choose item Configuration-Template in  menu.
After template ini file is updated it is needed to:
    - choose item File-Save,
    - choose item Configuration-Refresh.
 

10. Multi pattern editing

Input file for multi pattern editing is a simple .Ini file.
Additionally it is possible to set  a Section Settings in it
with a global parameters that may be used later in other sections.
These sections are based on section Pattern from  Template library:

[Pattern]
$Pattern=
$Output=

Here:
    - $Pattern - a full path name of pattern file;
    - $Output - a full path name of output  file.
 

A sample of Section Settings     (see a sample InpMpEdit.ini)
    [Settings]
    $PatternDir=.\Patterns
    $OutputDir=.\Output

A sample of any section    (see a sample InpMpEdit.ini)
    [Pattern1]
    $Pattern=$PatternDir\Month.html
    $Output=$OutputDir\4.html

After that it is neccessary to add keys to each created section. These keys are kept
in $Pattern file and will be changed into their values in $Output file.
$Pattern files may be any files, not only .ini files.
E.g. the sample InpMpEdit.ini uses  html file as a pattern.

Input file may contain any number of sections and each section may contain
any numbers of keys for editing.
 

11. License

Please carefully read the following before using this software.
If you don't agree with any issues of the license agreement, you are not allowed to
use this program. In this case you MUST delete it immediately.

Shareware-version

You have a right to test this program during one month. You are allowed to copy this Shareware-version
(and ONLY the Shareware version) and give it to any other person, until it is not modified in any way.

The distribution of this Shareware-version by any companies for any goals is permitted.

Any modifications of the program, reverse-engineering, disassembling and external
intervention by messages sending without the author's written permission are forbidden.

You are NOT allowed to provide Shareware-version of this program as a component of your application.
Use of this software after the trial period of one month is in violation of international Copyright law!

Registration

This program is neither freeware nor public domain. Use after the 30 day trial period requires registration.
The registration fee is only $30  for a personal license. See How to register for details on Ordering.

Registered version (personal license)

The registered version may be installed on as many computers as desired,
as long as it is ONLY running on one at any one time (I.e. one installation at home and
one at the office used by the same person). The usage by multiple people at the same time
(on multiple computers) requires additional licenses.
User software product may include a Registered version with personal license for each copy.
If  a User  supplies several copies of his software product it is required additional licenses.

Additional licenses (multi-user licenses)

Additional licenses allow any organization to install the program on multiple computers.
It must be guaranteed that the program does not run on more machines at the same time
than there are licenses purchased.

12. Ordering

Quantity (N)              Price per copy
 
 
N < 10  $30
9 < N < 100 $25
99 < N < 500  $20
N > 499  contact with author <ok@aquanet.co.il>

All licenses are issued to the same (company) name, which appears in the program's title bar.
Each additional license also allows a single user to use the program in any place.

Please send this form together with your payment to the following address:
 

Oscar Kogosov

P.O. Box 3670     Ashdod
Israel

Name ___________________________________________
Company ________________________________________
Address _________________________________________

ZIP Code _________City  ___________________________

State/Country ______________________________________
Phone/FAX ________________  / _____________________
E-mail-address ____________________________________

Quantity of copies_________________________________
Price(see above-mentioned table )____________________
 

Date ________  Signature ____________________________
 
 

Author

All mentioned Trademarks and Copyrights©  belong to Oscar Kogosov.
2000

URL:  http://www.aquanet.co.il/vip/ok/ShareWareWine.html
 

  ok@aquanet.co.il

Use e-mail only for getting help!