Major refactoring of GenericPopUp
Allow more transient dialogs in GenericPopUp
Remove grab from promotion popup
Fix other generic popup over transient popup
To use the generic dialog generator for 'asynchronous' popups (Ask Qustion
or Error popup caused by engine), the currentOptions setting has to be
restored for the combo and checkbox callbacks of the transient to still
work after the asynchronous dialog returns. Note that only transient dialogs
can have check and combo controls.
Make generic calcel button suppressible
Also #define some more symbols for Option.min flags,
and move them to dialogs.h.
Change TypeInProc to general OK handler
The move type-in now has its own option list, to distinguish it from
the ICS input box, and give it its own OK handler. Rather than having
the translation for <Enter> on the text widget call TypeInEvent directly,
we let it call GenericCallback, which calls GenericReadout, which calls
the OK proc, which does the job.
To be able to call GenericCallback from the TypeInProc, the recognition
of OK and cancel buttons had to be changed. This because it was too difficult
to arrange the calling widget had label OK or cancell. So these buttons are
no longer recognized by name, but by the option number passed as client data.
(This solves the problem that a user could not make buttons named 'cancel'
or 'OK'.)
Make Cancel button optional
Fix closing multiple popups of same kind
The GenericCallback figures out its own shell, so all buttons of
multiple dialogs keep working. External calls to PopDown only work
on the lastcreated instance of that kind, though (including those from
the Delete Window button, which can do 'cross-closing'). shellUp is now
a counter, and PopDowns are only prevented when it reaches 0 or the
current shell does not exist. (To know this, PopDown now resets shells[n]
to NULL when is shell is destroyed.
Beware of double PopDowns (through OK procs); they wreck the system.
Fix Delete Window button of multipe ErrorPopUps
The action routine for handling the Delete Window now pays attention
to the shell widget that the system passes to it, and temporarily
replaces shells[n] by it to let PopDown act on the proper instance.
Add ListBox dialog type to GenericPopUp
Fix vert sizing of ListBox
Put listbox widgets in viewport
Put listbox in viewport
Improved xoptions.c support for focussing and listboxes
Fix OK-row button positioning
Let GenericPopUp take parent and modality as arguments
This makes the code a bit more explicit and less kludgy. It also becomes
possible to call the same dialog (e.g. Load Options) from the main menu
and from another dialog (e.g. the Game List).
Support scroll function for generic popup listboxes
Fix scrolling
Move HighlightWithScroll to xoptions.c
Change scroll algorithm
Add mouse-wheel scroll to generic list boxes
Implement tabbing between text edits
Implement same-row text labels in generic dialog
Allow labels to specify their chaining in generic popup
The opt.min variable is used to specify the chaining: 0xF0 are the bits
for (left, right) chaining of the left side (0xC0) and right side (0x30).
The 0xC bits determine top or bottom chaining of the entire label.
Without anything spcified (0), the chaining is XtRubber.
TextBox options can also specify top-chaining of their top. All this was
needed to allow decent implementation of the Engine Output window with
the generic popup. (Although tags and comment popup ca benefit from the
latter feature.)
Let GenericPopUp support a Graph option
The Graph option results in an area where one can draw something. It is
positioned / chained similar to Label options. A handler for expose events
can be specified in the textValue field of the option.
Implement box widgets and menu buttons in GenericPopup
To enhance the capabilities of GenericPopUp such that it could create the
main window, it needs to be able tha packaging of controls into a box widget
(for mennu and button bar). Menu buttons are also required elements
(although they do look a lot like comboboxes?) Option types BoxBegin and
BoxEnd can now be used to bracket a group of controls that will be put
in a box widget. (Cannot be used recursively!) The positioning of the box
is similar to that of a Label, and is specified in the BogBegin option.
The code to shrink the menu buttons to fit is also incorporated, to act
on any box widget: if the BoxBegin option specifies a width, the elements
in it are shrunk to meet the requirement. Otherwise the box just gets the
size of the sum of its children (plus spacings).
Label options can now specify a font, casted into their textValue field.
(This is needed to get the proper size for the clock widgets.)
Implement callback in BoxEnd options
BoxEnd is a pseudo-option, to trigger packing the preceeding ones in
an earlier-opened box widget. In the process it calculates the size of
the box widget (and trims it if a size was specified for it in the
corresponding BoxBegin). The Option.target field of BoxEnd is now
interpreted as a callback, which can be use to take decisions based
on the determined size for the remaining options in the list, before
these are processed b GenericPopUp.
Refactor xoptions.c
Make a subroutine to set args shared by almost all widgets. Swap meaning
of '1'-bit in option.min flag of Break option, to be consistent with
SAME_ROW interpretation in other option types.
Make option tables consistent with refactored GenericPopUp
The flag for stacking in the Break option needed to be inverted, and
the BoardPopUp needed to pass the font in another field. Better use was
made of the improved chaining options too.
Improve Graph-option event handling
The user-supplied callback now gets 3 arguments passed: the event type
(0 = pointer motion, 1...5 button press, -1...-5 release, 10 = expose),
and two coordinates. For ouse events these are the pointer (x,y), while
for expose events they are the window size (w,h). The callback is now
specified in the option.target field of the Graph option.
Store engine options in malloc'ed memory
The Option.name field has been re-declared as (char*), from (char[MSG_SIZ]).
There are still MSG_SIZ chars allocated irrespective of actual size, because
the field is also supposed to store the textValue, which can be changed by
the user. But at least it means that unused options of the generous list
now don't waste much space. (And the prparated Option tables in dialogs.c
will shrink by a large factor as well.)
Improve GenericPopUp ComboBox handling.
The dialog type is now passed to the combobox callback as well, and this is
used to really figure out what option it is called for.
Allow numeric comboboxes
When no list of strings is given in Option.choice, the target is assumed
to be (int), and the number of the slected entry is stored there. Also
adapts the Label options that act as fillers to the new method for making
dummies (namely NULL in the Option.name field).
Put comboCallback in Option struct
Rather than having a general comboCallback variable for the entire current
dialog, each ComboBox option can now specify its own callback in the
target field of the option: the COMBO_CALLBACK bit of Option.min indicates
whether the target is a variable to be set or a callback. The callback can
still fetch the choice from the values array.
Allow generic CreateComboPopup also to do main menus
An extra parameter to CreateComboPopup determines if the menu texts
should be taken from a list of strings (the old method with engine-
supplied choices), or from a menu table of MenuItems. It can now also
recognize "----" as a menu break, and keeps margins (for the marking).
Make subroutine for determining curren combo selection
Various fixes to GenericPopUp
Delete one border-width setting
Fix max nr of args in GenerocPopUp
Fix button release events of Graph options
Fix generic Graph callback pointer motion coordinates
Make all format referencing in Option tables symbolic
Let Option.choice define menu texts, rather than Option.textValue
This is more logical than ussing textValue for it, because choice already
has the correct (char**) type, while textValue was (char*), and needed
casting everywhere. Note that for engine options, the fields were the
same anyway, so no back-end change was required. The textValue now
contains the (casted) list of actual string values, where these are
needed. (But for numeric and function menus they aren't.)
Add PopUp Option type
An new pseudo-Option is defined, to add a popup menu to a previous Graph
option. The actual popping up is done by the expose handler.
The function XUngrabPointer is the key to success here. A PopUp option
specifies a callback for handling the selection from the menu, which will
be called with the option number, exacty as with ComboBox options.
Update option explanation in dialogs.h
Make Spin and CheckBox callbacks pass dialog number
No longer rely on 'currentOptions' for getting the option belonging to
the callback, but get it out of the dialogOptions array indexed by dialog
type. This way things cannot be messed up by an asynchrounous error popup.
It also means that it is now save for non-modal dialogs to use these options.
Use button widget for text behind checkbox
Let listboxes use general formatting hints
Let GenericPopUp option always finish last pane after Break
Allow LisBox to specify select callback in Option.textValue
Use double-click to trigger ListBox callback
Make ListBox callback re-entrant
Fix multi-line Label options
Separate CreateMenuItem out from CreateComboPopup
Chain checkbox texts entirely left
Allow a user-specified callback to Label options
This is needed to implement the clocks. Let the CheckBox callback handle
it. For now ther is no distinction between different mouse buttons.