REM welcome window, first boot of Puppy.
REM (c) Copyright Barry Kauler 2011, bkhome.org
REM License GPL v3 (/usr/share/doc/legal)
REM 110412 first release.
REM 110414 tweak dimensions for non-English (thanks L18L and rodin.s).
REM 120630 1st bootup in PUPMODE=2, removed section about saving session.
REM 130204 include hug.bac, avoid needs recompiling when hug.so updated. (but much bigger!)
REM 130209 go back to hug.so.
REM 130710 Puppy default dpi has changed from 78 to 96.

OPTION INTERNATIONAL TRUE
REM .po/.mo files have 'charset=UTF-8', so either set UTF-8 on in LANG variable, or do this...
SETENVIRON "OUTPUT_CHARSET", "UTF-8"

REM Final exe size: incl hug.bac: 178K, func list: 134K, shared hug.so: 47K...
REM INCLUDE "/usr/share/BaCon/hug.bac",ATTACH,BUTTON,CALLBACK,DISPLAY,FONT,HIDE,HUGOPTIONS,IMAGE,INIT,MARK,MSGDIALOG,PROPERTY,QUIT,SHOW,WINDOW
INCLUDE "/usr/share/BaCon/hug_imports.bac"
REM http://developer.gnome.org/gtk/stable/GtkWidget.html#gtk-widget-set-tooltip-text
IMPORT "gtk_widget_set_tooltip_text(long,char*)" FROM "libgtk-x11-2.0.so" TYPE void

INIT

REM fix window font layout regardless of dpi...
REM 78 is the Xft.dpi in /root/.Xresources when I designed the layout... now 96...
HUGOPTIONS("BASEXFTDPI 96")
REM User may have GTK theme font size too big/small. set to required size...
HUGOPTIONS("FONT DejaVu Sans 10")

REM hack for russian, ru...
mycountry$=LEFT$(GETENVIRON$("LANG"),2)

REM space required for the session-save section, if not PUPMODE=2...
vert_space_save=0
IF FILETYPE("/initrd") EQ 2 THEN vert_space_save=112

SUB ic_func()
 SYSTEM "/usr/sbin/connectwizard & "
END SUB

SUB setup_func()
 SYSTEM "/usr/sbin/wizardwizard & "
END SUB

SUB close_dlg(NUMBER widget)
 HIDE(widget)
END SUB
save_dlg=MSGDIALOG(INTL$("A 'partition' is known by a drive letter in dos/windows, such as C:, D:, but Linux uses a more rigorous naming scheme, such as sda1, sda2. If you are unfamiliar with these different types of partitions (and the Linux naming), don't worry, as Puppy will automatically detect and offer you a choice of suitable partitions in which to save the session. Puppy will only create a single file in the partition and this will not affect your current installation of Windows (but of course we have to make a full disclaimer of any responsibility if something does go wrong!) and next time you boot Puppy from CD the save-file will get automatically read -- so, there is really no need to install Puppy onto the hard drive, and you can just keep booting Puppy from CD indefinitely."),500,300,0,1)
CALLBACK(save_dlg,close_dlg)
SUB save_info_func()
 SHOW(save_dlg)
END SUB

REM to disable decorations, need to hide window first...
HUGOPTIONS("WIDGET_SHOW 0")
REM reduced height by 112 pixels...
mainwin = WINDOW(INTL$("Welcome"),656,402+vert_space_save)
PROPERTY(mainwin,"decorated",FALSE)
HUGOPTIONS("WIDGET_SHOW 1")

image_logo=IMAGE("/usr/share/doc/puppylogo96.png",96,96)
ATTACH(mainwin,image_logo,68,5)

label_welcome=MARK(INTL$("Welcome, woof, woof"),350,24)
REM left-align for single-line label...
PROPERTY(label_welcome,"xalign",0.0)
FONT(label_welcome,"DejaVu Sans Bold 20")
ATTACH(mainwin,label_welcome,188,20)

label_subhdr=MARK(INTL$("This is the first time you are running Puppy!"),462,24)
PROPERTY(label_subhdr,"xalign",0.0)
FONT(label_subhdr,"DejaVu Sans 14")
ATTACH(mainwin,label_subhdr,188,50)

button_x=BUTTON("",26,24)
image_x=IMAGE("/usr/local/lib/X11/mini-icons/mini-cross.xpm",16,16)
PROPERTY(button_x,"image",image_x)
gtk_widget_set_tooltip_text(button_x,INTL$("Close window"))
ATTACH(mainwin,button_x,622,6)
CALLBACK(button_x,QUIT)

label_ic=MARK(INTL$("Internet connection"),250,24)
PROPERTY(label_ic,"xalign",0.0)
FONT(label_ic,"DejaVu Sans Bold 14")
ATTACH(mainwin,label_ic,60,108)
label_ic_body=MARK(INTL$("Click on the 'connect' button on the right, or icon at left of the screen (one click only -- do not double-click!). You will then see some buttons for choosing how you wish to connect to the Internet -- click the most appropriate. It is easy..."),500,70)
PROPERTY(label_ic_body,"xalign",0.0)
PROPERTY(label_ic_body,"yalign",0.0)
PROPERTY(label_ic_body,"wrap",TRUE)
ATTACH(mainwin,label_ic_body,60,130)

button_ic=BUTTON("",58,56)
image_ic=IMAGE("/usr/local/lib/X11/pixmaps/connect48.png",48,48)
PROPERTY(button_ic,"image",image_ic)
gtk_widget_set_tooltip_text(button_ic,INTL$("Connect to Internet"))
ATTACH(mainwin,button_ic,584,116)
CALLBACK(button_ic,ic_func)
label_c=MARK(INTL$("connect"),82,16)
FONT(label_c,"DejaVu Sans Bold 10")
PROPERTY(label_c,"xalign",0.5)
ATTACH(mainwin,label_c,571,172)

REM bad hack for russian translation...
IF mycountry$ = "ru" THEN
 vert1=186
 vert2=208
ELSE
 vert1=202
 vert2=224
END IF

label_help=MARK(INTL$("I need help!"),280,24)
PROPERTY(label_help,"xalign",0.0)
FONT(label_help,"DejaVu Sans Bold 14")
ATTACH(mainwin,label_help,20,vert1)
label_help_body=MARK(INTL$("Explore the 'Menu' -- see bottom-left of screen. Lots of local help is available -- select 'Help' in the menu. The local Help page also has the Release Notes for this version of Puppy -- well worth checking out! When you get online, the web browser home page has many more links."),628,70)
PROPERTY(label_help_body,"xalign",0.0)
PROPERTY(label_help_body,"yalign",0.0)
PROPERTY(label_help_body,"wrap",TRUE)
ATTACH(mainwin,label_help_body,20,vert2)

image_tray=IMAGE("/usr/share/doc/tray.png",178,28)
ATTACH(mainwin,image_tray,40,282)
label_tray=MARK(INTL$("...mouse-over and click the tray applets, very helpful!"),431,16)
PROPERTY(label_tray,"xalign",0.0)
ATTACH(mainwin,label_tray,222,286)

REM stuff for saving first session...
IF vert_space_save NE 0 THEN
 image_tray=IMAGE(INTL$("/usr/share/doc/menu2.png"),150,90)
 ATTACH(mainwin,image_tray,10,327)
 label_save=MARK(INTL$("Saving a session"),280,24)
 PROPERTY(label_save,"xalign",0.0)
 FONT(label_save,"DejaVu Sans Bold 14")
 ATTACH(mainwin,label_save,172,320)
 label_save_body=MARK(INTL$("At first shutdown, you are asked where you want to save your personal files/data/settings to, and this can be any FAT (as used for MSDOS or Windows 9x) partition, NTFS (as used by Windows XP) partition or Linux partition in the hard drive, or any plugin drive (USB Flash pen drive for example)."),450,90)
 PROPERTY(label_save_body,"xalign",0.0)
 PROPERTY(label_save_body,"yalign",0.0)
 PROPERTY(label_save_body,"wrap",TRUE)
 ATTACH(mainwin,label_save_body,172,342)

 button_s=BUTTON("",26,24)
 image_s=IMAGE("/usr/local/lib/X11/mini-icons/mini-question.xpm",16,16)
 PROPERTY(button_s,"image",image_s)
 gtk_widget_set_tooltip_text(button_s,INTL$("Help"))
 ATTACH(mainwin,button_s,618,322)
 CALLBACK(button_s,save_info_func)
ENDIF

label_setup=MARK(INTL$("Setup your pup"),280,24)
PROPERTY(label_setup,"xalign",0.0)
FONT(label_setup,"DejaVu Sans Bold 14")
ATTACH(mainwin,label_setup,70,320+vert_space_save)
label_setup_body=MARK(INTL$("Want to install an upgraded video driver? Country localization? Printing? Sound? Mouse? Keyboard? Click here (or 'setup' icon at top of screen):"),500,70)
PROPERTY(label_setup_body,"xalign",0.0)
PROPERTY(label_setup_body,"yalign",0.0)
PROPERTY(label_setup_body,"wrap",TRUE)
ATTACH(mainwin,label_setup_body,70,342+vert_space_save)

button_setup=BUTTON("",58,56)
image_setup=IMAGE("/usr/local/lib/X11/pixmaps/configuration48.png",48,48)
PROPERTY(button_setup,"image",image_setup)
gtk_widget_set_tooltip_text(button_setup,INTL$("Setup Puppy"))
ATTACH(mainwin,button_setup,584,323+vert_space_save)
CALLBACK(button_setup,setup_func)
label_set=MARK(INTL$("setup"),87,16)
FONT(label_set,"DejaVu Sans Bold 10")
PROPERTY(label_set,"xalign",0.5)
ATTACH(mainwin,label_set,568,379+vert_space_save)


SHOW(mainwin)
DISPLAY
REM the end
