Hi Paul,

On Tue, Apr 05, 2011 at 08:49:30AM +0800, Paul Wise wrote:
> Please keep the Debian bug in CC.

Sorry, didn't realize that.
 
> On Tue, 2011-04-05 at 02:25 +0200, Jens Thoms Toerring wrote:
> > Perhaps I also will have to ask a few more questions - I downloaded
> > mancala and had a short look at it but didn't figure out yet what it's
> > supposed to do;-)
> 
> It is a board game where you take stones out of one pit and travel
> around the board placing one stone into each pit until you have no more
> stones left, then the other player gets a turn. The winner can be the
> first to have no stones or the one with the most stones in their end
> pit.
> 
> The way that the game is broken is that clicking on a pit doesn't move
> the stones around with libforms2. You can see how it should work with
> the terminal-based version named mancala or by compiling xmancala
> against the old libforms1.

The program was playing tricks that were too dirty;-) So I rewrote
a smal part of it (including the form designer file) to avoid doing
that and it seems to work again (and should also work with older
XForms library versions).

Instead of trying to push back a ClientMessage event into XForms
event loop (which one should do only for windows controlled by
the program independently of XForms and for which then a handler
must be installed) and sending an (except for the type) unini-
tialized XEvent (which is playing a bit of Russion roulette;-)
I added a hidden button that gets triggered to get the program
out of the event loop (which obviously was the intent of the
dirty trick used before).

I changed two files, xmain.c and xform.fd. Indirectly the latter
change also results in changes of xform.c and xform.h (they need
to be recreated using the command 'fdesign -convert xform.fd'). I
simply append all four files, if you need them in some other form
please tell me.
                           Best regards, Jens
-- 
  \   Jens Thoms Toerring  ________      j...@toerring.de
   \_______________________________      http://toerring.de
/* $Id: xmain.c,v 1.5 2007-06-13 18:29:52 sverrehu Exp $ */
/**************************************************************************
 *
 *  FILE            xmain.c
 *  MODULE OF       The board game Mancala
 *
 *  DESCRIPTION     Main function / frontend for using an X/XForms-based
 *                  display.
 *
 *                  This code is _really_ (I mean: REALLY) dirty...
 *                  The main purpose of this is to make someone play the
 *                  game. For those interested in the gaming (as I am),
 *                  please take a look at the other sourcefiles instead.
 *                  I'm not at all proud of this file, it's my first
 *                  attempt on using the XForms library, and it was done
 *                  in a hurry.
 *
 *                  I don't like event driven programming...
 *
 *  WRITTEN BY      Sverre H. Huseby
 *
 **************************************************************************/

#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <forms.h>

#include "minimax.h"
#include "mancala.h"
#include "xform.h"

#define flushForms fl_check_only_forms

extern char *textRules;

/**************************************************************************
 *                                                                        *
 *                       P R I V A T E    D A T A                         *
 *                                                                        *
 **************************************************************************/

static FD_mancala *frm;
static FD_rules   *frmRules;
static FL_OBJECT  *frmMancala[2];
static FL_OBJECT  *frmHole[2][MAX_HOLES];
static FL_OBJECT  *frmLight[2][MAX_HOLES];
static const char *playerName[2] = { "the human player", "the computer" };
static int        maxPly[2] = { 0, 4 };
static int        rulesDisplayed = 0;
static int        stones_pr_hole = STONES_PR_HOLE;

/*
 *  Player side and hole chosen by human player.
 */
static Player movePlayer;
static int    moveHole = -1;

static Player player;
static int    status;


/**************************************************************************
 *                                                                        *
 *                   P R I V A T E    F U N C T I O N S                   *
 *                                                                        *
 **************************************************************************/

/*-------------------------------------------------------------------------
 *
 *  NAME          showBoard
 *
 *  FUNCTION      Display the current board on screen.
 *
 *  DESCRIPTION   Very simple thing.
 */
static void showBoard(void)
{
    Player p;
    int    q;
    char   s[10];

    fl_freeze_form(frm->mancala);
    for (p = 0; p < 2; p++) {
	sprintf(s, "%d", getMancala(p));
	fl_set_object_label(frmMancala[p], s);
	for (q = 0; q < MAX_HOLES; q++) {
	    sprintf(s, "%d", getHole(p, q));
	    fl_set_object_label(frmHole[p][q], s);
	}
    }
    fl_unfreeze_form(frm->mancala);
    flushForms();
}

/*-------------------------------------------------------------------------
 *
 *  NAME          setMessage
 *
 *  FUNCTION      Set the message of the status line.
 *
 *  INPUT         format, ...
 *                        Arguments used as with printf().
 */
static void setMessage(const char *format, ...)
{
    va_list ap;
    char    s[120];

    va_start(ap, format);
    vsprintf(s, format, ap);
    va_end(ap);
    fl_set_object_label(frm->textStatus, s);
    flushForms();
}

/* set hole to -1 to turn all off */
static void setLastMove(Player player, int hole)
{
    static Player   lastPlayer;
    static int      lastHole = -1;
#ifdef WORKS_ON_SGI_NOW
    static int      colorSet = 0;
#endif
    static FL_COLOR origCol1 = FL_COL1, origCol2 = FL_BOTTOM_BCOL;

    /*
     *  For some reason, SGI fucks up with segmenation fault during
     *  the next few lines. Harcoding it instead...
     */
#ifdef WORKS_ON_SGI_NOW
    if (!colorSet) {
	origCol1 = frmLight[player][hole]->col1;
	origCol2 = frmLight[player][hole]->col2;
	colorSet = 1;
    }
#endif
    if (lastHole >= 0)
	fl_set_object_color(frmLight[lastPlayer][lastHole],
			    origCol1, origCol2);
    if (hole >= 0)
	fl_set_object_color(frmLight[player][hole],
			    FL_RED, FL_BOTTOM_BCOL);
    lastPlayer = player;
    lastHole = hole;
    flushForms();
}

static void flashMove(Player player, int hole)
{
    int q;

    setLastMove(0, -1);
    for (q = 5; q > 0; q--) {
	setLastMove(player, hole);
	fl_msleep(100);
	setLastMove(0, -1);
	fl_msleep(100);
    }
}

static Player computerPlayer(void)
{
    if (maxPly[0])
	return 0;
    if (maxPly[1])
	return 1;
    return -1;
}

static void formInit(void)
{
    char s[20];
    
    frm = create_form_mancala();
    sprintf(s, "version %s", VERSION);
    fl_set_object_label(frm->textVer, s);
    frmMancala[0] = frm->mancalaB;
    frmHole[0][0] = frm->holeB0;
    frmHole[0][1] = frm->holeB1;
    frmHole[0][2] = frm->holeB2;
    frmHole[0][3] = frm->holeB3;
    frmHole[0][4] = frm->holeB4;
    frmHole[0][5] = frm->holeB5;
    frmMancala[1] = frm->mancalaT;
    frmHole[1][0] = frm->holeT0;
    frmHole[1][1] = frm->holeT1;
    frmHole[1][2] = frm->holeT2;
    frmHole[1][3] = frm->holeT3;
    frmHole[1][4] = frm->holeT4;
    frmHole[1][5] = frm->holeT5;
    frmLight[0][0] = frm->lightB0;
    frmLight[0][1] = frm->lightB1;
    frmLight[0][2] = frm->lightB2;
    frmLight[0][3] = frm->lightB3;
    frmLight[0][4] = frm->lightB4;
    frmLight[0][5] = frm->lightB5;
    frmLight[1][0] = frm->lightT0;
    frmLight[1][1] = frm->lightT1;
    frmLight[1][2] = frm->lightT2;
    frmLight[1][3] = frm->lightT3;
    frmLight[1][4] = frm->lightT4;
    frmLight[1][5] = frm->lightT5;
    fl_set_slider_bounds(frm->slidLevel, 1.0, 9.0);
    fl_set_slider_step(frm->slidLevel, 1.0);
    fl_set_slider_precision(frm->slidLevel, 0);
    /* HERE: change if not always human vs. computer */
    fl_set_slider_value(frm->slidLevel, maxPly[computerPlayer()]);

    frmRules = create_form_rules();
    fl_set_browser_fontsize(frmRules->textRules, FL_NORMAL_SIZE);
    fl_set_browser_fontstyle(frmRules->textRules, FL_NORMAL_STYLE);
    fl_add_browser_line(frmRules->textRules, textRules);
    
    fl_show_form(frm->mancala, FL_PLACE_SIZE, FL_FULLBORDER, "Mancala");
}

static void formFinish(void)
{
    fl_hide_form(frm->mancala);
    if (rulesDisplayed)
	fl_hide_form(frmRules->rules);
}

static void ourInitGame(Player starter)
{
    initGame(stones_pr_hole);
    player = starter;
    status = 0;
    fl_set_object_label(frm->playerB, playerName[0]);
    fl_set_object_label(frm->playerT, playerName[1]);
    fl_set_object_label(frm->startB, starter == 0 ? "Starter" : "");
    fl_set_object_label(frm->startT, starter == 1 ? "Starter" : "");
    fl_set_object_label(frm->winB, "");
    fl_set_object_label(frm->winT, "");
}

static void formHandler(void)
{
    PMove  move;
    Move   move2;
    Player winner;

    ourInitGame(0);
    for (;;) {
	showBoard();
	if (!status) {
	    if ((status = checkAndFixWin(&winner)) != 0) {
		if (status == 1) {
		    setMessage("Game over; %s wins", playerName[winner]);
		    fl_set_object_label(winner == 0 ? frm->winB : frm->winT,
					"Winner");
		} else
		    setMessage("Game over; we have a draw");
	    } else {
		if (!maxPly[player]) {
		    setMessage("It's %s to move", playerName[player]);
		    fl_do_forms();
		    move = &move2;
		    if (moveHole >= 0) {
			if (movePlayer == player) {
			    move->hole = moveHole;
			    if (legalMove(player, move)) {
				flashMove(player, move->hole);
				player = doMove(player, move);
			    } else {
				setMessage("Not a legal move. Try again!");
				fl_msleep(1500);
			    }
			} else {
			    setMessage("Stick to your side, you moron!");
			    fl_msleep(1500);
			}
			moveHole = -1;
		    }
		} else {
		    setMessage("%s is thinking...", playerName[player]);
		    move = getBestMove(player, maxPly[player]);
		    setMessage("");
		    flashMove(player, move->hole);
		    player = doMove(player, move);
		}
	    }
	} else
	    fl_do_forms();
    }
}

/**************************************************************************
 *                                                                        *
 *                    P U B L I C    F U N C T I O N S                    *
 *                                                                        *
 **************************************************************************/

/*------------------------------------------------------------------------*
 |                Callbacks for the objects in the form                   |
 *------------------------------------------------------------------------*/

void doRules(FL_OBJECT *ob, long arg)
{
    if (rulesDisplayed)
	return;
    fl_show_form(frmRules->rules, FL_PLACE_FREE, FL_FULLBORDER,
		 "Mancala Rules");
    fl_deactivate_object(frm->buttRules);
    rulesDisplayed = 1;
}

void doRulesDone(FL_OBJECT *ob, long arg)
{
    if (!rulesDisplayed)
	return;
    fl_hide_form(frmRules->rules);
    fl_activate_object(frm->buttRules);
    rulesDisplayed = 0;
}

void doHole(FL_OBJECT *ob, long arg)
{
    Player player;
    int    hole;

    if (moveHole >= 0) {
	setMessage("Hold your horses! "
		   "I haven't done your previous move yet!");
	fl_msleep(1000);
    } else {
	player = arg / 100;
	hole = arg % 100;
	movePlayer = player;
	moveHole = hole;
    }
    fl_trigger_object(frm->dummyButton);
}

void doLevel(FL_OBJECT *ob, long arg)
{
    double v;
    Player comp;

    if ((comp = computerPlayer()) < 0)
	return;
    v = fl_get_slider_value(ob);
    maxPly[comp] = (int) v;
}

void doNewGame(FL_OBJECT *ob, long arg)
{
    ourInitGame(arg);
    fl_trigger_object(frm->dummyButton);
}

void doQuit(FL_OBJECT *ob, long arg)
{
    formFinish();
    exit(0);
}

/**************************************************************************/
#define stringify(a) #a
#define stringize(a) stringify(a)

int main(int argc, char *argv[])
{
    static FL_CMD_OPT cmdopt [] = {
        { "-stones", "*.stones", XrmoptionSepArg, 0 }};
    static FL_resource res [] = {
        { "stones", "XMancala", FL_INT, &stones_pr_hole,
          stringize(STONES_PR_HOLE), 0 }};
    fl_initialize(&argc, argv, "XMancala",
                  cmdopt, sizeof(cmdopt) / sizeof(FL_CMD_OPT));
    fl_get_app_resources(res, sizeof(res ) / sizeof(FL_resource));
    if (stones_pr_hole < 1) {
        fprintf(stderr,
                "xmancala: the number of stones per hole must be "
                "greater than zero\n");
        return 1;
    }
    formInit();
    formHandler();
    formFinish();
    return 0;
}
Magic: 13000

Internal Form Definition File
    (do not change)

Number of forms: 2
Unit of measure: FL_COORD_PIXEL
Border Width: 1

=============== FORM ===============
Name: mancala
Width: 530
Height: 220
Number of Objects: 45

--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 530 220
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: 
callback: 
argument: 

--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 370 75 150 15
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Glenn Terje Lines
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: 
callback: 
argument: 

--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
box: 10 25 350 150
boxtype: FL_NO_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: 
callback: 
argument: 

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 65 60 40 40
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE
size: FL_HUGE_SIZE
lcol: FL_SLATEBLUE
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: holeT0
callback: doHole
argument: 100

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 105 60 40 40
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE
size: FL_HUGE_SIZE
lcol: FL_SLATEBLUE
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: holeT1
callback: doHole
argument: 101

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 145 60 40 40
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE
size: FL_HUGE_SIZE
lcol: FL_SLATEBLUE
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: holeT2
callback: doHole
argument: 102

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 185 60 40 40
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE
size: FL_HUGE_SIZE
lcol: FL_SLATEBLUE
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: holeT3
callback: doHole
argument: 103

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 225 60 40 40
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE
size: FL_HUGE_SIZE
lcol: FL_SLATEBLUE
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: holeT4
callback: doHole
argument: 104

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 265 60 40 40
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE
size: FL_HUGE_SIZE
lcol: FL_SLATEBLUE
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: holeT5
callback: doHole
argument: 105

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 65 100 40 40
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE
size: FL_HUGE_SIZE
lcol: FL_SLATEBLUE
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: holeB5
callback: doHole
argument: 5

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 105 100 40 40
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE
size: FL_HUGE_SIZE
lcol: FL_SLATEBLUE
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: holeB4
callback: doHole
argument: 4

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 145 100 40 40
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE
size: FL_HUGE_SIZE
lcol: FL_SLATEBLUE
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: holeB3
callback: doHole
argument: 3

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 185 100 40 40
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE
size: FL_HUGE_SIZE
lcol: FL_SLATEBLUE
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: holeB2
callback: doHole
argument: 2

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 225 100 40 40
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE
size: FL_HUGE_SIZE
lcol: FL_SLATEBLUE
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: holeB1
callback: doHole
argument: 1

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 265 100 40 40
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE
size: FL_HUGE_SIZE
lcol: FL_SLATEBLUE
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: holeB0
callback: doHole
argument: 0

--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 105 150 160 20
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
style: FL_BOLD_STYLE+FL_ENGRAVED_STYLE
size: FL_MEDIUM_SIZE
lcol: FL_PALEGREEN
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: playerB
callback: 
argument: 

--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 10 190 350 20
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLUE
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: textStatus
callback: 
argument: 

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 370 190 70 20
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Rules
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: buttRules
callback: doRules
argument: 0

--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 370 10 150 35
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
style: FL_BOLDITALIC_STYLE+FL_EMBOSSED_STYLE
size: FL_HUGE_SIZE
lcol: FL_DARKGOLD
label: Mancala
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: 
callback: 
argument: 

--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 370 40 150 15
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: textVer
callback: 
argument: 

--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 15 60 45 80
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE
size: FL_HUGE_SIZE
lcol: FL_SLATEBLUE
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: mancalaT
callback: 
argument: 

--------------------
class: FL_BOX
type: FLAT_BOX
box: 70 50 30 5
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: lightT0
callback: 
argument: 

--------------------
class: FL_BOX
type: FLAT_BOX
box: 110 50 30 5
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: lightT1
callback: 
argument: 

--------------------
class: FL_BOX
type: FLAT_BOX
box: 150 50 30 5
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: lightT2
callback: 
argument: 

--------------------
class: FL_BOX
type: FLAT_BOX
box: 190 50 30 5
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: lightT3
callback: 
argument: 

--------------------
class: FL_BOX
type: FLAT_BOX
box: 230 50 30 5
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: lightT4
callback: 
argument: 

--------------------
class: FL_BOX
type: FLAT_BOX
box: 270 50 30 5
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: lightT5
callback: 
argument: 

--------------------
class: FL_BOX
type: FLAT_BOX
box: 270 145 30 5
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: lightB0
callback: 
argument: 

--------------------
class: FL_BOX
type: FLAT_BOX
box: 230 145 30 5
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: lightB1
callback: 
argument: 

--------------------
class: FL_BOX
type: FLAT_BOX
box: 190 145 30 5
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: lightB2
callback: 
argument: 

--------------------
class: FL_BOX
type: FLAT_BOX
box: 150 145 30 5
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: lightB3
callback: 
argument: 

--------------------
class: FL_BOX
type: FLAT_BOX
box: 110 145 30 5
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: lightB4
callback: 
argument: 

--------------------
class: FL_BOX
type: FLAT_BOX
box: 70 145 30 5
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: lightB5
callback: 
argument: 

--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 105 30 160 20
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
style: FL_BOLD_STYLE+FL_ENGRAVED_STYLE
size: FL_MEDIUM_SIZE
lcol: FL_PALEGREEN
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: playerT
callback: 
argument: 

--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 310 60 45 80
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
style: FL_BOLD_STYLE+FL_EMBOSSED_STYLE
size: FL_HUGE_SIZE
lcol: FL_SLATEBLUE
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: mancalaB
callback: 
argument: 

--------------------
class: FL_VALSLIDER
type: HOR_SLIDER
box: 370 150 150 15
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_BLACK
label: Difficulty Level
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: slidLevel
callback: doLevel
argument: 0

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 370 100 150 20
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: New Game, Human 1st
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: buttNewGameB
callback: doNewGame
argument: 0

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 370 125 150 20
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: New Game, Computer 1st
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: buttNewGameT
callback: doNewGame
argument: 1

--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 15 30 90 10
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: startT
callback: 
argument: 

--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 265 160 90 10
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_RIGHT|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: startB
callback: 
argument: 

--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 275 150 80 10
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_RIGHT|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: winB
callback: 
argument: 

--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 15 40 90 10
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_TINY_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: winT
callback: 
argument: 

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 450 190 70 20
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Quit
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: buttQuit
callback: doQuit
argument: 0

--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 370 60 150 15
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Sverre H. Huseby
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: 
callback: 
argument: 

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 0 0 0 0
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
name: dummyButton
callback: 
argument: 

=============== FORM ===============
Name: rules
Width: 505
Height: 300
Number of Objects: 3

--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 505 300
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: 
callback: 
argument: 

--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 10 270 485 20
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Ok, I know the rules
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: buttRulesDone
callback: doRulesDone
argument: 0

--------------------
class: FL_BROWSER
type: NORMAL_BROWSER
box: 10 10 485 255
boxtype: FL_DOWN_BOX
colors: FL_WHITE FL_YELLOW
alignment: FL_ALIGN_BOTTOM
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: 
shortcut: 
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: textRules
callback: doRules
argument: 0

==============================
create_the_forms
/* Form definition file generated by fdesign */

#include <stdlib.h>
#include "xform.h"


/***************************************
 ***************************************/

FD_mancala *
create_form_mancala( void )
{
    FL_OBJECT *obj;
    FD_mancala *fdui = ( FD_mancala * ) fl_malloc( sizeof *fdui );

    fdui->vdata = fdui->cdata = NULL;
    fdui->ldata = 0;

    fdui->mancala = fl_bgn_form( FL_NO_BOX, 530, 220 );

    obj = fl_add_box( FL_UP_BOX, 0, 0, 530, 220, "" );

    obj = fl_add_text( FL_NORMAL_TEXT, 370, 75, 150, 15, "Glenn Terje Lines" );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER | FL_ALIGN_INSIDE );

    obj = fl_add_frame( FL_ENGRAVED_FRAME, 10, 25, 350, 150, "" );
    fl_set_object_color( obj, FL_COL1, FL_COL1 );

    fdui->holeT0 = obj = fl_add_button( FL_NORMAL_BUTTON, 65, 60, 40, 40, "" );
    fl_set_object_boxtype( obj, FL_DOWN_BOX );
    fl_set_object_lcolor( obj, FL_SLATEBLUE );
    fl_set_object_lsize( obj, FL_HUGE_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_EMBOSSED_STYLE );
    fl_set_object_callback( obj, doHole, 100 );

    fdui->holeT1 = obj = fl_add_button( FL_NORMAL_BUTTON, 105, 60, 40, 40, "" );
    fl_set_object_boxtype( obj, FL_DOWN_BOX );
    fl_set_object_lcolor( obj, FL_SLATEBLUE );
    fl_set_object_lsize( obj, FL_HUGE_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_EMBOSSED_STYLE );
    fl_set_object_callback( obj, doHole, 101 );

    fdui->holeT2 = obj = fl_add_button( FL_NORMAL_BUTTON, 145, 60, 40, 40, "" );
    fl_set_object_boxtype( obj, FL_DOWN_BOX );
    fl_set_object_lcolor( obj, FL_SLATEBLUE );
    fl_set_object_lsize( obj, FL_HUGE_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_EMBOSSED_STYLE );
    fl_set_object_callback( obj, doHole, 102 );

    fdui->holeT3 = obj = fl_add_button( FL_NORMAL_BUTTON, 185, 60, 40, 40, "" );
    fl_set_object_boxtype( obj, FL_DOWN_BOX );
    fl_set_object_lcolor( obj, FL_SLATEBLUE );
    fl_set_object_lsize( obj, FL_HUGE_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_EMBOSSED_STYLE );
    fl_set_object_callback( obj, doHole, 103 );

    fdui->holeT4 = obj = fl_add_button( FL_NORMAL_BUTTON, 225, 60, 40, 40, "" );
    fl_set_object_boxtype( obj, FL_DOWN_BOX );
    fl_set_object_lcolor( obj, FL_SLATEBLUE );
    fl_set_object_lsize( obj, FL_HUGE_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_EMBOSSED_STYLE );
    fl_set_object_callback( obj, doHole, 104 );

    fdui->holeT5 = obj = fl_add_button( FL_NORMAL_BUTTON, 265, 60, 40, 40, "" );
    fl_set_object_boxtype( obj, FL_DOWN_BOX );
    fl_set_object_lcolor( obj, FL_SLATEBLUE );
    fl_set_object_lsize( obj, FL_HUGE_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_EMBOSSED_STYLE );
    fl_set_object_callback( obj, doHole, 105 );

    fdui->holeB5 = obj = fl_add_button( FL_NORMAL_BUTTON, 65, 100, 40, 40, "" );
    fl_set_object_boxtype( obj, FL_DOWN_BOX );
    fl_set_object_lcolor( obj, FL_SLATEBLUE );
    fl_set_object_lsize( obj, FL_HUGE_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_EMBOSSED_STYLE );
    fl_set_object_callback( obj, doHole, 5 );

    fdui->holeB4 = obj = fl_add_button( FL_NORMAL_BUTTON, 105, 100, 40, 40, "" );
    fl_set_object_boxtype( obj, FL_DOWN_BOX );
    fl_set_object_lcolor( obj, FL_SLATEBLUE );
    fl_set_object_lsize( obj, FL_HUGE_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_EMBOSSED_STYLE );
    fl_set_object_callback( obj, doHole, 4 );

    fdui->holeB3 = obj = fl_add_button( FL_NORMAL_BUTTON, 145, 100, 40, 40, "" );
    fl_set_object_boxtype( obj, FL_DOWN_BOX );
    fl_set_object_lcolor( obj, FL_SLATEBLUE );
    fl_set_object_lsize( obj, FL_HUGE_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_EMBOSSED_STYLE );
    fl_set_object_callback( obj, doHole, 3 );

    fdui->holeB2 = obj = fl_add_button( FL_NORMAL_BUTTON, 185, 100, 40, 40, "" );
    fl_set_object_boxtype( obj, FL_DOWN_BOX );
    fl_set_object_lcolor( obj, FL_SLATEBLUE );
    fl_set_object_lsize( obj, FL_HUGE_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_EMBOSSED_STYLE );
    fl_set_object_callback( obj, doHole, 2 );

    fdui->holeB1 = obj = fl_add_button( FL_NORMAL_BUTTON, 225, 100, 40, 40, "" );
    fl_set_object_boxtype( obj, FL_DOWN_BOX );
    fl_set_object_lcolor( obj, FL_SLATEBLUE );
    fl_set_object_lsize( obj, FL_HUGE_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_EMBOSSED_STYLE );
    fl_set_object_callback( obj, doHole, 1 );

    fdui->holeB0 = obj = fl_add_button( FL_NORMAL_BUTTON, 265, 100, 40, 40, "" );
    fl_set_object_boxtype( obj, FL_DOWN_BOX );
    fl_set_object_lcolor( obj, FL_SLATEBLUE );
    fl_set_object_lsize( obj, FL_HUGE_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_EMBOSSED_STYLE );
    fl_set_object_callback( obj, doHole, 0 );

    fdui->playerB = obj = fl_add_text( FL_NORMAL_TEXT, 105, 150, 160, 20, "" );
    fl_set_object_lcolor( obj, FL_PALEGREEN );
    fl_set_object_lsize( obj, FL_MEDIUM_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER | FL_ALIGN_INSIDE );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_ENGRAVED_STYLE );

    fdui->textStatus = obj = fl_add_text( FL_NORMAL_TEXT, 10, 190, 350, 20, "" );
    fl_set_object_boxtype( obj, FL_DOWN_BOX );
    fl_set_object_lcolor( obj, FL_BLUE );
    fl_set_object_lsize( obj, FL_NORMAL_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER | FL_ALIGN_INSIDE );

    fdui->buttRules = obj = fl_add_button( FL_NORMAL_BUTTON, 370, 190, 70, 20, "Rules" );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_callback( obj, doRules, 0 );

    obj = fl_add_text( FL_NORMAL_TEXT, 370, 10, 150, 35, "Mancala" );
    fl_set_object_lcolor( obj, FL_DARKGOLD );
    fl_set_object_lsize( obj, FL_HUGE_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER | FL_ALIGN_INSIDE );
    fl_set_object_lstyle( obj, FL_BOLDITALIC_STYLE + FL_EMBOSSED_STYLE );

    fdui->textVer = obj = fl_add_text( FL_NORMAL_TEXT, 370, 40, 150, 15, "" );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER | FL_ALIGN_INSIDE );

    fdui->mancalaT = obj = fl_add_text( FL_NORMAL_TEXT, 15, 60, 45, 80, "" );
    fl_set_object_boxtype( obj, FL_DOWN_BOX );
    fl_set_object_lcolor( obj, FL_SLATEBLUE );
    fl_set_object_lsize( obj, FL_HUGE_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER | FL_ALIGN_INSIDE );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_EMBOSSED_STYLE );

    fdui->lightT0 = obj = fl_add_box( FL_FLAT_BOX, 70, 50, 30, 5, "" );

    fdui->lightT1 = obj = fl_add_box( FL_FLAT_BOX, 110, 50, 30, 5, "" );

    fdui->lightT2 = obj = fl_add_box( FL_FLAT_BOX, 150, 50, 30, 5, "" );

    fdui->lightT3 = obj = fl_add_box( FL_FLAT_BOX, 190, 50, 30, 5, "" );

    fdui->lightT4 = obj = fl_add_box( FL_FLAT_BOX, 230, 50, 30, 5, "" );

    fdui->lightT5 = obj = fl_add_box( FL_FLAT_BOX, 270, 50, 30, 5, "" );

    fdui->lightB0 = obj = fl_add_box( FL_FLAT_BOX, 270, 145, 30, 5, "" );

    fdui->lightB1 = obj = fl_add_box( FL_FLAT_BOX, 230, 145, 30, 5, "" );

    fdui->lightB2 = obj = fl_add_box( FL_FLAT_BOX, 190, 145, 30, 5, "" );

    fdui->lightB3 = obj = fl_add_box( FL_FLAT_BOX, 150, 145, 30, 5, "" );

    fdui->lightB4 = obj = fl_add_box( FL_FLAT_BOX, 110, 145, 30, 5, "" );

    fdui->lightB5 = obj = fl_add_box( FL_FLAT_BOX, 70, 145, 30, 5, "" );

    fdui->playerT = obj = fl_add_text( FL_NORMAL_TEXT, 105, 30, 160, 20, "" );
    fl_set_object_lcolor( obj, FL_PALEGREEN );
    fl_set_object_lsize( obj, FL_MEDIUM_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER | FL_ALIGN_INSIDE );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_ENGRAVED_STYLE );

    fdui->mancalaB = obj = fl_add_text( FL_NORMAL_TEXT, 310, 60, 45, 80, "" );
    fl_set_object_boxtype( obj, FL_DOWN_BOX );
    fl_set_object_lcolor( obj, FL_SLATEBLUE );
    fl_set_object_lsize( obj, FL_HUGE_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER | FL_ALIGN_INSIDE );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE + FL_EMBOSSED_STYLE );

    fdui->slidLevel = obj = fl_add_valslider( FL_HOR_SLIDER, 370, 150, 150, 15, "Difficulty Level" );
    fl_set_object_callback( obj, doLevel, 0 );
    fl_set_object_return( obj, FL_RETURN_CHANGED );

    fdui->buttNewGameB = obj = fl_add_button( FL_NORMAL_BUTTON, 370, 100, 150, 20, "New Game, Human 1st" );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_callback( obj, doNewGame, 0 );

    fdui->buttNewGameT = obj = fl_add_button( FL_NORMAL_BUTTON, 370, 125, 150, 20, "New Game, Computer 1st" );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_callback( obj, doNewGame, 1 );

    fdui->startT = obj = fl_add_text( FL_NORMAL_TEXT, 15, 30, 90, 10, "" );
    fl_set_object_lsize( obj, FL_TINY_SIZE );

    fdui->startB = obj = fl_add_text( FL_NORMAL_TEXT, 265, 160, 90, 10, "" );
    fl_set_object_lsize( obj, FL_TINY_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_RIGHT | FL_ALIGN_INSIDE );

    fdui->winB = obj = fl_add_text( FL_NORMAL_TEXT, 275, 150, 80, 10, "" );
    fl_set_object_lsize( obj, FL_TINY_SIZE );
    fl_set_object_lalign( obj, FL_ALIGN_RIGHT | FL_ALIGN_INSIDE );

    fdui->winT = obj = fl_add_text( FL_NORMAL_TEXT, 15, 40, 90, 10, "" );
    fl_set_object_lsize( obj, FL_TINY_SIZE );

    fdui->buttQuit = obj = fl_add_button( FL_NORMAL_BUTTON, 450, 190, 70, 20, "Quit" );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_callback( obj, doQuit, 0 );

    obj = fl_add_text( FL_NORMAL_TEXT, 370, 60, 150, 15, "Sverre H. Huseby" );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER | FL_ALIGN_INSIDE );

    fdui->dummyButton = obj = fl_add_button( FL_NORMAL_BUTTON, 0, 0, 0, 0, "" );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_resize( obj, FL_RESIZE_NONE );

    fl_end_form( );

    fdui->mancala->fdui = fdui;

    return fdui;
}


/***************************************
 ***************************************/

FD_rules *
create_form_rules( void )
{
    FL_OBJECT *obj;
    FD_rules *fdui = ( FD_rules * ) fl_malloc( sizeof *fdui );

    fdui->vdata = fdui->cdata = NULL;
    fdui->ldata = 0;

    fdui->rules = fl_bgn_form( FL_NO_BOX, 505, 300 );

    obj = fl_add_box( FL_UP_BOX, 0, 0, 505, 300, "" );

    fdui->buttRulesDone = obj = fl_add_button( FL_NORMAL_BUTTON, 10, 270, 485, 20, "Ok, I know the rules" );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_callback( obj, doRulesDone, 0 );

    fdui->textRules = obj = fl_add_browser( FL_NORMAL_BROWSER, 10, 10, 485, 255, "" );
    fl_set_object_callback( obj, doRules, 0 );

    fl_end_form( );

    fdui->rules->fdui = fdui;

    return fdui;
}
/* Header file generated by fdesign on Tue Apr  5 13:44:24 2011 */

#ifndef FD_mancala_h_
#define FD_mancala_h_

#include <forms.h>

/* Callbacks, globals and object handlers */

extern void doHole( FL_OBJECT *, long );
extern void doRules( FL_OBJECT *, long );
extern void doLevel( FL_OBJECT *, long );
extern void doNewGame( FL_OBJECT *, long );
extern void doQuit( FL_OBJECT *, long );

extern void doRulesDone( FL_OBJECT *, long );
extern void doRules( FL_OBJECT *, long );


/* Forms and Objects */

typedef struct {
    FL_FORM   * mancala;
    void      * vdata;
    char      * cdata;
    long        ldata;
    FL_OBJECT * holeT0;
    FL_OBJECT * holeT1;
    FL_OBJECT * holeT2;
    FL_OBJECT * holeT3;
    FL_OBJECT * holeT4;
    FL_OBJECT * holeT5;
    FL_OBJECT * holeB5;
    FL_OBJECT * holeB4;
    FL_OBJECT * holeB3;
    FL_OBJECT * holeB2;
    FL_OBJECT * holeB1;
    FL_OBJECT * holeB0;
    FL_OBJECT * playerB;
    FL_OBJECT * textStatus;
    FL_OBJECT * buttRules;
    FL_OBJECT * textVer;
    FL_OBJECT * mancalaT;
    FL_OBJECT * lightT0;
    FL_OBJECT * lightT1;
    FL_OBJECT * lightT2;
    FL_OBJECT * lightT3;
    FL_OBJECT * lightT4;
    FL_OBJECT * lightT5;
    FL_OBJECT * lightB0;
    FL_OBJECT * lightB1;
    FL_OBJECT * lightB2;
    FL_OBJECT * lightB3;
    FL_OBJECT * lightB4;
    FL_OBJECT * lightB5;
    FL_OBJECT * playerT;
    FL_OBJECT * mancalaB;
    FL_OBJECT * slidLevel;
    FL_OBJECT * buttNewGameB;
    FL_OBJECT * buttNewGameT;
    FL_OBJECT * startT;
    FL_OBJECT * startB;
    FL_OBJECT * winB;
    FL_OBJECT * winT;
    FL_OBJECT * buttQuit;
    FL_OBJECT * dummyButton;
} FD_mancala;

extern FD_mancala * create_form_mancala( void );
typedef struct {
    FL_FORM   * rules;
    void      * vdata;
    char      * cdata;
    long        ldata;
    FL_OBJECT * buttRulesDone;
    FL_OBJECT * textRules;
} FD_rules;

extern FD_rules * create_form_rules( void );

#endif /* FD_mancala_h_ */

Reply via email to