'===========================================================================
' Subject: MOUSEOVER GENERATOR                Date: 10-16-99 (19:56)       
'  Author: Brian D. Pugh                      Code: LB                     
'  Origin: Brian@hipperholme.demon.co.uk    Packet: LIBERTY.ABC
'===========================================================================
'rem Fake Bitmap Buttons and MouseOver Code Generator - Brian D. Pugh

    open "ctl3dv2.dll" for dll as #3d
    calldll #3d,"Ctl3dRegister",0 as short,result as short:calldll #3d,"Ctl3dAutoSubclass",0 as short,result as short

nomainwin
    UpperLeftX=int(DisplayWidth-482)/2:UpperLeftY=int(DisplayHeight-470)/2
    WindowWidth=482:WindowHeight=470

    fn1$="!font Arial 0 16":fn2$="font Arial 0 16"

    textbox #main.b1path, 14, 30, 147, 20
    button #main.b1set,"...",[b1set], UL, 175, 30, 28, 20
    textbox #main.tip1, 217, 30, 203, 20
    textbox #main.b2path, 14, 56, 147, 20
    button #main.b2set,"...",[b2set], UL, 175, 56, 28, 20
    textbox #main.tip2, 217, 56, 203, 20
    textbox #main.b3path, 14, 82, 147, 20
    button #main.b3set,"...",[b3set], UL, 175, 82, 28, 20
    textbox #main.tip3, 217, 82, 203, 20
    textbox #main.b4path, 14, 108, 147, 20
    button #main.b4set,"...",[b4set], UL, 175, 108, 28, 20
    textbox #main.tip4, 217, 108, 203, 20
    textbox #main.b5path, 14, 134, 147, 20
    button #main.b5set,"...",[b5set], UL, 175, 134, 28, 20
    textbox #main.tip5, 217, 134, 203, 20
    textbox #main.b6path, 14, 160, 147, 20
    button #main.b6set,"...",[b6set], UL, 175, 160, 28, 20
    textbox #main.tip6, 217, 160, 203, 20
    textbox #main.b7path, 14, 186, 147, 20
    button #main.b7set,"...",[b7set], UL, 175, 186, 28, 20
    textbox #main.tip7, 217, 186, 203, 20
    textbox #main.b8path, 14, 212, 147, 20
    button #main.b8set,"...",[b8set], UL, 175, 212, 28, 20
    textbox #main.tip8, 217, 212, 203, 20
    textbox #main.b9path, 14, 238, 147, 20
    button #main.b9set,"...",[b9set], UL, 175, 238, 28, 20
    textbox #main.tip9, 217, 238, 203, 20
    textbox #main.b10path, 14, 264, 147, 20
    button #main.b10set,"...",[b10set], UL, 175, 264, 28, 20
    textbox #main.tip10, 217, 264, 203, 20

    textbox #main.SetTitle, 14, 312, 406, 20

    graphicbox #main.horzbitmap, 14, 360, 406, 32
    graphicbox #main.vertbitmap, 434, 12, 32, 409

    button #main.GenCode,"Generate Code",[GenCode], UL, 14, 400, 190, 20
    button #main.StartOver,"Start Over",[StartOver], UL, 230, 400, 190, 20

    menu #main,"&File","&Exit",[Exit]
    menu #main,"&Info","&Help",[Help],|,"&About",[About]

    open "MouseOver Generator" for graphics_nsb_nf as #main

    print #main,"trapclose [Exit]"

    print #main.b1path,fn1$:print #main.b1set,fn1$:print #main.tip1,fn1$
    print #main.b2path,fn1$:print #main.b2set,fn1$:print #main.tip2,fn1$
    print #main.b3path,fn1$:print #main.b3set,fn1$:print #main.tip3,fn1$
    print #main.b4path,fn1$:print #main.b4set,fn1$:print #main.tip4,fn1$
    print #main.b5path,fn1$:print #main.b5set,fn1$:print #main.tip5,fn1$
    print #main.b6path,fn1$:print #main.b6set,fn1$:print #main.tip6,fn1$
    print #main.b7path,fn1$:print #main.b7set,fn1$:print #main.tip7,fn1$
    print #main.b8path,fn1$:print #main.b8set,fn1$:print #main.tip9,fn1$
    print #main.b9path,fn1$:print #main.b9set,fn1$:print #main.tip8,fn1$
    print #main.b10path,fn1$:print #main.b10set,fn1$:print #main.tip10,fn1$

    print #main.SetTitle,fn1$:print #main.GenCode,fn1$:print #main.StartOver,fn1$

    print #main,"fill darkcyan"
    print #main,"font Arial_Bold 0 16;place 14 20;color white;backcolor darkcyan;\Bitmap Paths"
    print #main,"font Arial_Bold 0 16;place 217 20;color white;backcolor darkcyan;\Tooltips Text"
    print #main,"font Arial_Bold 0 16;place 14 302;color white;backcolor darkcyan;\Compiled Program's Titlebar Text"
    print #main,"font Arial_Bold 0 16;place 14 350;color white;backcolor darkcyan;\Selected Bitmap(s)"
    print #main,"flush"

    print #main.horzbitmap,"fill darkred;flush":print #main.vertbitmap,"fill darkred;flush"

    print #main.tip1,"Tooltip 1 text":print #main.tip2,"Tooltip 2 text":print #main.tip3,"Tooltip 3 text"
    print #main.tip4,"Tooltip 4 text":print #main.tip5,"Tooltip 5 text":print #main.tip6,"Tooltip 6 text"
    print #main.tip7,"Tooltip 7 text":print #main.tip8,"Tooltip 8 text":print #main.tip9,"Tooltip 9 text"
    print #main.tip10,"Tooltip 10 text"

    print #main.SetTitle,"Fake Bitmap and MouseOver Test Window"

[MainLoop]
    input loop$:goto [MainLoop]

[Select]
    filedialog "Select Bitmap","*.bmp",bitmap$
    if bitmap$="" goto [MainLoop]
    open bitmap$ for input as #bmp
    pic$=input$(#bmp,29):close #bmp
    type$=left$(pic$,2)
    x=asc(mid$(pic$,19,1))+(256*asc(mid$(pic$,20,1)))
    y=asc(mid$(pic$,23,1))+(256*asc(mid$(pic$,24,1)))
    colours=asc(right$(pic$,1))
    if type$<>"BM" then notice "File Error"+chr$(13)+"The selected file is not in Bitmap Format":goto [MainLoop]
    if x=0 or y=0 then notice "Format Error"+chr$(13)+"Can not get dimensions for this file":goto [MainLoop]
    if colours>8 then notice "Colour Depth Error"+chr$(13)+"Liberty Basic can not load bitmaps with a"_
    +chr$(13)+"colour depth greater than 256":goto [MainLoop]
    if bitmap=1 then checkx=x:checky=y:hh=x:vv=y
    if bitmap=1 then h1=0:h2=0:v1=0:v2=0
    if bitmap=2 then h1=x:v2=y
    if bitmap>2 then h1=h1+x:v2=v2+y
    hwidth=h1+x:hheight=y
    return

[b1set]
    bitmap=1
    gosub [Select]
    loadbmp "bttn1",bitmap$
    print #main.horzbitmap,"drawbmp bttn1 ";h1;" ";h2
    print #main.vertbitmap,"drawbmp bttn1 ";v1;" ";v2
    print #main.b1path,lower$(bitmap$);
    print #main.tip1,"!setfocus"
    goto [MainLoop]
[b2set]
    bitmap=2
    gosub [Select]:gosub [CheckSize]
    loadbmp "bttn2",bitmap$
    print #main.horzbitmap,"drawbmp bttn2 ";h1;" ";h2
    print #main.vertbitmap,"drawbmp bttn2 ";v1;" ";v2
    print #main.b2path,lower$(bitmap$);
    print #main.tip2,"!setfocus"
    goto [MainLoop]
[b3set]
    bitmap=3
    gosub [Select]:gosub [CheckSize]
    loadbmp "bttn3",bitmap$
    print #main.horzbitmap,"drawbmp bttn3 ";h1;" ";h2
    print #main.vertbitmap,"drawbmp bttn3 ";v1;" ";v2
    print #main.b3path,lower$(bitmap$);
    print #main.tip3,"!setfocus"
    goto [MainLoop]
[b4set]
    bitmap=4
    gosub [Select]:gosub [CheckSize]
    loadbmp "bttn4",bitmap$
    print #main.horzbitmap,"drawbmp bttn4 ";h1;" ";h2
    print #main.vertbitmap,"drawbmp bttn4 ";v1;" ";v2
    print #main.b4path,lower$(bitmap$);
    print #main.tip4,"!setfocus"
    goto [MainLoop]
[b5set]
    bitmap=5
    gosub [Select]:gosub [CheckSize]
    loadbmp "bttn5",bitmap$
    print #main.horzbitmap,"drawbmp bttn5 ";h1;" ";h2
    print #main.vertbitmap,"drawbmp bttn5 ";v1;" ";v2
    print #main.b5path,lower$(bitmap$);
    print #main.tip5,"!setfocus"
    goto [MainLoop]
[b6set]
    bitmap=6
    gosub [Select]:gosub [CheckSize]
    loadbmp "bttn6",bitmap$
    print #main.horzbitmap,"drawbmp bttn6 ";h1;" ";h2
    print #main.vertbitmap,"drawbmp bttn6 ";v1;" ";v2
    print #main.b6path,lower$(bitmap$);
    print #main.tip6,"!setfocus"
    goto [MainLoop]
[b7set]
    bitmap=7
    gosub [Select]:gosub [CheckSize]
    loadbmp "bttn7",bitmap$
    print #main.horzbitmap,"drawbmp bttn7 ";h1;" ";h2
    print #main.vertbitmap,"drawbmp bttn7 ";v1;" ";v2
    print #main.b7path,lower$(bitmap$);
    print #main.tip7,"!setfocus"
    goto [MainLoop]
[b8set]
    bitmap=8
    gosub [Select]:gosub [CheckSize]
    loadbmp "bttn8",bitmap$
    print #main.horzbitmap,"drawbmp bttn8 ";h1;" ";h2
    print #main.vertbitmap,"drawbmp bttn8 ";v1;" ";v2
    print #main.horzbitmap,"flush":print #main.vertbitmap,"flush"
    print #main.b8path,lower$(bitmap$);
    print #main.tip8,"!setfocus"
    goto [MainLoop]
[b9set]
    bitmap=9
    gosub [Select]:gosub [CheckSize]
    loadbmp "bttn9",bitmap$
    print #main.horzbitmap,"drawbmp bttn9 ";h1;" ";h2
    print #main.vertbitmap,"drawbmp bttn9 ";v1;" ";v2
    print #main.b9path,lower$(bitmap$);
    print #main.tip9,"!setfocus"
    goto [MainLoop]
[b10set]
    bitmap=10
    gosub [Select]:gosub [CheckSize]
    loadbmp "bttn10",bitmap$
    print #main.horzbitmap,"drawbmp bttn10 ";h1;" ";h2
    print #main.vertbitmap,"drawbmp bttn10 ";v1;" ";v2
    print #main.b10path,lower$(bitmap$);
    print #main.tip10,"!setfocus"
    goto [MainLoop]

[CheckSize]
    if checkx<>x or checky<>y then notice "Bitmap Size Error"+chr$(13)+_
    "The file just selected is not the same size as the first button."+chr$(13)+_
    "For Tooltips to work correctly, each button must be the same"+chr$(13)+_
    "width and height. Press OK now to restart the whole process" else return

[StartOver]
    print #main.b1path,"":print #main.b2path,"":print #main.b3path,"":print #main.b4path,"":print #main.b5path,""
    print #main.b6path,"":print #main.b7path,"":print #main.b8path,"":print #main.b9path,"":print #main.b10path,""
    print #main.tip1,"Tooltip 1 text":print #main.tip2,"Tooltip 2 text":print #main.tip3,"Tooltip 3 text"
    print #main.tip4,"Tooltip 4 text":print #main.tip5,"Tooltip 5 text":print #main.tip6,"Tooltip 6 text"
    print #main.tip7,"Tooltip 7 text":print #main.tip8,"Tooltip 8 text":print #main.tip9,"Tooltip 9 text"
    print #main.tip10,"Tooltip 10 text"
    print #main.SetTitle,"Fake Bitmap and MouseOver Test Window"
    print #main.horzbitmap,"discard;redraw"
    print #main.vertbitmap,"discard;redraw"
    h1=0:v2=0:checkx=0:checky=0
    goto [MainLoop]

[GenCode]
    gosub [Options]
    q$=chr$(34):UpperLeftX=10:UpperLeftY=50:WindowWidth=600:WindowHeight=400

    open "Save this code as a .bas file" for text as #code
    print #code,"!trapclose [CloseCode]";
    print #code,"rem Fake Bitmap Buttons and MouseOver Code Generator - Brian D. Pugh"
    print #code,""
    print #code,"    open "+q$+"user"+q$+" for dll as #user:open "+q$+"gdi"+q$+" for dll as #gdi"
    print #code,""
    print #code,"nomainwin"
    print #code,"    UpperLeftX=int(DisplayWidth-640)/2:UpperLeftY=int(DisplayHeight-480)/2"
    print #code,"    WindowWidth=640:WindowHeight=480"
    print #code,""
    print #code,"    menu #main,"+q$+"&File"+q$+","+q$+"&Exit"+q$+",[Exit]"

' orient=1 if horizontal, orient=0 if vertical
    print #options.horzset,"value?":input #options.horzset,result$
    if result$="set" then orient=1 else orient=0

' style=1 if popup buttons, style=0 if MSIE4 type
    print #options.popupset,"value?":input #options.popupset,result$
    if result$="set" then style=1 else style=0

rem Make graphics area for buttons 1 pixel wider and higher to account for raised lines
    if orient=1 and style=0 then hheight=hheight+2:hwidth=hwidth+(bitmap*2)
    if orient=0 and style=0 then hheight=hheight+(bitmap*2):hwidth=hwidth+2

    print #code,"    graphicbox #main.tip, 0, 414, 632, 20"

    if orient=1 then
    print #code,"    graphicbox #main.btn, ";0;", ";0;", ";hwidth;", ";hheight
    else
    print #code,"    graphicbox #main.btn, ";0;", ";0;", ";hheight;", ";hwidth
    end if

    print #main.SetTitle,"!contents?":input #main.SetTitle,title$

    print #code,"    open "+q$+title$+q$+" for graphics_nsb as #main"
    print #code,"    print #main,"+q$+"trapclose [Exit]"+q$
    print #code,"    print #main,"+q$+"font Courier_New 0 16"+q$
    print #code,"    print #main,"+q$+"fill lightgray;flush"+q$
    print #code,"    print #main.tip,"+q$+"autoresize;fill yellow;flush"+q$
    print #code,"    print #main.btn,"+q$+"fill lightgray;flush"+q$
    print #code,""

    if style=0 then print #code,"    dim ln(";bitmap;",";bitmap;")"
    if bitmap=10 then print #code,"    dim tooltips$(11)"
    print #code,""

' Get the bitmap paths and tooltips for each button defined, and retrieve bitmap sizes
[1]
    print #main.b1path,"!contents?":input #main.b1path,bmp1$
    print #main.tip1,"!contents?":input #main.tip1,tip1$
    print #code,"    tooltips$(1)="+q$+tip1$+q$
    print #code,"    loadbmp "+q$+"bmp1"+q$+","+q$+bmp1$+q$
    buttonwidth=hh:buttonheight=vv:r=1
    xx=0:yy=0
    print #code,"    print #main.btn,"+q$+"drawbmp bmp1 ";xx;" ";yy;q$
[2]
    print #main.b2path,"!contents?":input #main.b2path,bmp2$
    if bmp2$="" goto [3]
    print #main.tip2,"!contents?":input #main.tip2,tip2$
    print #code,"    tooltips$(2)="+q$+tip2$+q$
    print #code,"    loadbmp "+q$+"bmp2"+q$+","+q$+bmp2$+q$
    r=r+1
    if orient=1 then xx=xx+hh else yy=yy+vv
    print #code,"    print #main.btn,"+q$+"drawbmp bmp2 ";xx;" ";yy;q$
[3]
    print #main.b3path,"!contents?":input #main.b3path,bmp3$
    if bmp3$="" goto [4]
    print #main.tip3,"!contents?":input #main.tip3,tip3$
    print #code,"    tooltips$(3)="+q$+tip3$+q$
    print #code,"    loadbmp "+q$+"bmp3"+q$+","+q$+bmp3$+q$
    r=r+1
    if orient=1 then xx=xx+hh else yy=yy+vv
    print #code,"    print #main.btn,"+q$+"drawbmp bmp3 ";xx;" ";yy;q$
[4]
    print #main.b4path,"!contents?":input #main.b4path,bmp4$
    if bmp4$="" goto [5]
    print #main.tip4,"!contents?":input #main.tip4,tip4$
    print #code,"    tooltips$(4)="+q$+tip4$+q$
    print #code,"    loadbmp "+q$+"bmp4"+q$+","+q$+bmp4$+q$
    r=r+1
    if orient=1 then xx=xx+hh else yy=yy+vv
    print #code,"    print #main.btn,"+q$+"drawbmp bmp4 ";xx;" ";yy;q$
[5]
    print #main.b5path,"!contents?":input #main.b5path,bmp5$
    if bmp5$="" goto [6]
    print #main.tip5,"!contents?":input #main.tip5,tip5$
    print #code,"    tooltips$(5)="+q$+tip5$+q$
    print #code,"    loadbmp "+q$+"bmp5"+q$+","+q$+bmp5$+q$
    r=r+1
    if orient=1 then xx=xx+hh else yy=yy+vv
    print #code,"    print #main.btn,"+q$+"drawbmp bmp5 ";xx;" ";yy;q$
[6]
    print #main.b6path,"!contents?":input #main.b6path,bmp6$
    if bmp6$="" goto [7]
    print #main.tip6,"!contents?":input #main.tip6,tip6$
    print #code,"    tooltips$(6)="+q$+tip6$+q$
    print #code,"    loadbmp "+q$+"bmp6"+q$+","+q$+bmp6$+q$
    r=r+1
    if orient=1 then xx=xx+hh else yy=yy+vv
    print #code,"    print #main.btn,"+q$+"drawbmp bmp6 ";xx;" ";yy;q$
[7]
    print #main.b7path,"!contents?":input #main.b7path,bmp7$
    if bmp7$="" goto [8]
    print #main.tip7,"!contents?":input #main.tip7,tip7$
    print #code,"    tooltips$(7)="+q$+tip7$+q$
    print #code,"    loadbmp "+q$+"bmp7"+q$+","+q$+bmp7$+q$
    r=r+1
    if orient=1 then xx=xx+hh else yy=yy+vv
    print #code,"    print #main.btn,"+q$+"drawbmp bmp7 ";xx;" ";yy;q$
[8]
    print #main.b8path,"!contents?":input #main.b8path,bmp8$
    if bmp8$="" goto [9]
    print #main.tip8,"!contents?":input #main.tip8,tip8$
    print #code,"    tooltips$(8)="+q$+tip8$+q$
    print #code,"    loadbmp "+q$+"bmp8"+q$+","+q$+bmp8$+q$
    r=r+1
    if orient=1 then xx=xx+hh else yy=yy+vv
    print #code,"    print #main.btn,"+q$+"drawbmp bmp8 ";xx;" ";yy;q$
[9]
    print #main.b9path,"!contents?":input #main.b9path,bmp9$
    if bmp9$="" goto [10]
    print #main.tip9,"!contents?":input #main.tip9,tip9$
    print #code,"    tooltips$(9)="+q$+tip9$+q$
    print #code,"    loadbmp "+q$+"bmp9"+q$+","+q$+bmp9$+q$
    r=r+1
    if orient=1 then xx=xx+hh else yy=yy+vv
    print #code,"    print #main.btn,"+q$+"drawbmp bmp9 ";xx;" ";yy;q$
[10]
    print #main.b10path,"!contents?":input #main.b10path,bmp10$
    if bmp10$="" goto [got_em]
    print #main.tip10,"!contents?":input #main.tip10,tip10$
    print #code,"    tooltips$(10)="+q$+tip10$+q$
    print #code,"    loadbmp "+q$+"bmp10"+q$+","+q$+bmp10$+q$
    r=r+1
    if orient=1 then xx=xx+hh else yy=yy+vv
    print #code,"    print #main.btn,"+q$+"drawbmp bmp10 ";xx;" ";yy;q$

[got_em]
    print #code,"    print #main.btn,"+q$+"flush"+q$
    print #code,""
    print #code,"    z=0"
    print #code,"    dim Region(11)"
    if orient=1 then
    buttonwidth=hh * r:buttonheight=vv
    print #code,"    buttonwidth=";hh
    print #code,"    buttonheight=";vv
    print #code,"    allbuttons=";buttonwidth
    else
    buttonwidth=hh:buttonheight=vv * r
    print #code,"    buttonwidth=";hh
    print #code,"    buttonheight=";vv
    print #code,"    allbuttons=";buttonheight
    end if

' Create Rect Region for bitmaps
    if style=1 then
    print #code,""
    print #code,"    hBtn=hWnd(#main.btn)"
    print #code,"    calldll #user,"+q$+"GetDC"+q$+",hBtn as word,hDC as short"
    print #code,""
    print #code,"    for xbtn=0 to allbuttons step buttonwidth"
    print #code,"    x2btn=xbtn+buttonwidth"
    print #code,"    calldll #gdi,"+q$+"CreateRectRgn"+q$+",_"
    print #code,"    xbtn as short,0 as short,x2btn as short,buttonheight as short,hRegn as short"
    print #code,"    z=z+1"
    print #code,"    reset=z"
    print #code,"    Region(z)=hRegn"
    print #code,"    next xbtn"
    end if
    print #code,""

    print #code,"    print #main.btn,"+q$+"setfocus;when mouseMove [tooltip]"+q$
    print #code,"    print #main.btn,"+q$+"when leftButtonDown [check.button.down]"+q$
    print #code,"    print #main.btn,"+q$+"when leftButtonUp [button.back.up]"+q$
    print #code,""

    print #code,"    print #main,"+q$+"setfocus;when mouseMove [tooltip]"+q$
    print #code,"    print #main,"+q$+"when leftButtonDown [check.button.down]"+q$
    print #code,"    print #main,"+q$+"when leftButtonUp [button.back.up]"+q$

    print #code,""
    print #code,"[MainLoop]"
    print #code,"    z=reset:input loop$:goto [MainLoop]"
    print #code,""
    print #code,"[tooltip]"
    print #code,"    MX=MouseX:MY=MouseY"
    if orient = 1 then
    print #code,"    if MX>allbuttons or MX<1 or MY<1 or MY>buttonheight then gosub [clear.tooltip]:goto [MainLoop]"
    else
    print #code,"    if MX>buttonwidth or MX<1 or MY<1 or MY>allbuttons then gosub [clear.tooltip]:goto [MainLoop]"
    end if
    print #code,"    gosub [check.tip]"
    print #code,"    if rpoint=lastz then goto [MainLoop]"
    print #code,"    if rpoint>0 then toolTip$=tooltips$(rpoint):print #main.tip,"+q$+"redraw;backcolor yellow;color black;place 2 14;\"+q$+";toolTip$:lastz=rpoint"
    print #code,"    goto [MainLoop]"
    print #code,""
    print #code,"[check.button.down]"
    print #code,"    MX=MouseX:MY=MouseY:gosub [check.tip]"
    print #code,"    if rpoint>0 then rdown=Region(rpoint):gosub [clear.tooltip]:gosub [invert.button]"
    print #code,"    goto [MainLoop]"
    print #code,""
    print #code,"[check.tip]"
    if orient=1 then
    print #code,"    rpoint=int(MX/buttonwidth)+1"
    else
    print #code,"    rpoint=int(MY/buttonheight)+1"
    end if
    print #code,"    if rpoint>=z+1 then rpoint=z"
    print #code,"    return"
    print #code,""
    print #code,"[clear.tooltip]"
    print #code,"    print #main.tip,"+q$+"fill yellow;flush"+q$+":return"
    print #code,""
    print #code,"[button.back.up]"
    print #code,"    gosub [clear.tooltip]"
    print #code,"    if rdown=0 then goto [MainLoop]"
    print #code,"    gosub [invert.button]:rdown=0"
    for a=1 to bitmap
    print #code,"    if rpoint=";a;" then goto [Button";a;"]"
    next a
    print #code,"    goto [MainLoop]"
    print #code,""
    print #code,"[invert.button]"
    print #code,"    calldll #gdi,"+q$+"InvertRgn"+q$+",hDC as short,rdown as word,z as ushort:return"
    print #code,""
    for a=1 to bitmap
    print #code,"[Button";a;"]"
    print #code,"    notice "+q$+"You pressed Button ";a;q$
    print #code,"    goto [MainLoop]"
    print #code,""
    next a
    print #code,"[Exit]"
    print #code,"    close #user:close #gdi:close #main:end"

[GenCodeLoop]
    input gencode$:goto [GenCodeLoop]

[CloseCode]
    close #code:goto [MainLoop]

[Options]
    print #main.b1path,"!contents?":input #main.b1path,b1$
    if b1$="" then notice "Error !"+chr$(13)+"There is no info in the first bitmap path":goto [MainLoop]

    struct winRect,orgX as uShort,orgY as uShort,extentX as uShort,extentY as uShort
    struct point,x as short,y as short
    open "user" for dll as #user
    calldll #user,"GetCursorPos",point as struct,result as void
    x=point.x.struct:y=point.y.struct
    dw=int((482-160)/2):dh=int((470-200)/2)

    radiobutton #options.horzset," Horizontal Tooltips",[horzset],[horzreset], 14, 14, 132, 20
    radiobutton #options.vertset," Vertical Tooltips",[vertset],[vertreset], 14, 34, 132, 20
    checkbox #options.popupset," Pop Up Buttons",[popupset],[popupreset], 14, 64, 132, 20
    checkbox #options.ie4set," MSIE-style Buttons",[ie4set],[ie4reset], 14, 84, 132, 20
    button #options.ok,"OK",[OptionsOK], UL, 56, 126, 40, 30

    calldll #user,"SetCursorPos",dw as ushort,dh as ushort,result as void
    WindowWidth=160:WindowHeight=200

    open "Options" for dialog_modal as #options
    calldll #user,"SetCursorPos",x as ushort,y as ushort,result as void:close #user

    print #options,"trapclose [CloseOptions]"
    print #options.horzset,fn2$:print #options.vertset,fn2$
    print #options.popupset,fn2$:print #options.ie4set,fn2$
    print #options.ok,fn1$
    print #options.horzset,"set":print #options.popupset,"set"

[OptionsLoop]
    input options$:goto [OptionsLoop]

[horzset]
    print #options.horzset,"set":print #options.vertset,"reset":goto [OptionsLoop]
[horzreset]
    print #options.horzset,"reset":goto [OptionsLoop]
[vertset]
    print #options.vertset,"set":print #options.horzset,"reset":goto [OptionsLoop]
[vertreset]
    print #options.vertset,"reset":goto [OptionsLoop]
[popupset]
    print #options.popupset,"set":print #options.ie4set,"reset":goto [OptionsLoop]
[popupreset]
    print #options.popupset,"reset":goto [OptionsLoop]
[ie4set]
    print #options.ie4set,"set":print #options.popupset,"reset":goto [OptionsLoop]
[ie4reset]
    print #options.ie4set,"reset":goto [OptionsLoop]

[OptionsOK]
    close #options:return

[CloseOptions]
    close #options:goto [MainLoop]

[Help]
    notice "MouseOver Generator Help"+chr$(13)+"1: Select your bitmaps in order using the file dialog buttons"_
    +chr$(13)+"    Make sure each bitmap is the same width and depth as each"+chr$(13)+_
    "    other, or the MouseOver technique will not work correctly"+chr$(13)+chr$(13)+_
    "2: Type in the Tooltips text you require for each bitmap you load"+chr$(13)+chr$(13)+_
    "3: Type in the Titlebar text for the main window program"+chr$(13)+chr$(13)+_
    "4: Bitmaps are displayed horizontally and vertically. If you make an"+chr$(13)+_
    "    error, press the Start Over button and enter your choices again"+chr$(13)+chr$(13)+_
    "5: When you are happy, press the Generate Code button, and decide"+chr$(13)+_
    "    whether you require horizontal or vertical tooltips, button-style or"+chr$(13)+_
    "    MSIE-type tooltips":goto [MainLoop]

[About]
    notice "MouseOver Generator"+chr$(13)+"1998 - Brian D. Pugh"+chr$(13)+"Brian@hipperholme.demon.co.uk"
    goto [MainLoop]

[Exit]
    calldll #3d,"Ctl3dUnregister",0 as short,result as short:close #3d:close #main:end
