showBanner.rc
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 11 Jun 2018 11:15:47 +0100
branchjv
changeset 1558 36927a04ace3
parent 609 f0f51d4a0066
permissions -rw-r--r--
Copyright updates
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
609
f0f51d4a0066 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
     1
"/ Encoding: iso8859-1
416
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
"/
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"/ $Header$
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
"/
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
"/ MIMEType: application/x-smalltalk-source
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
"/
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
"/ if you dont like the splash banner at startup,
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
"/ simply remove or rename this file.
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
"/
430
c2c69e841970 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
    10
"/ if you like another image to be shown (especially for applications),
609
f0f51d4a0066 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
    11
"/ copy this file to the apps startup directory,
430
c2c69e841970 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
    12
"/ and edit the bitmap-file names found below as required.
431
c8a095f71ab4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
    13
"/ (notice, that the code below uses an image which does not allocate
c8a095f71ab4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
    14
"/  to many colors for the particular display in use - it may be useful
c8a095f71ab4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
    15
"/  to do so for you own images as well, to avoid slowing down startup)
430
c2c69e841970 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
    16
"/
c2c69e841970 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
    17
"/ Notice:
c2c69e841970 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
    18
"/   the image used here was bought by ObjectShare from Robert Tinney
c2c69e841970 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
    19
"/   and placed into the Public Domain by ObjectShare.
c2c69e841970 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
    20
"/   We would like to thank both for that.
c2c69e841970 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
    21
"/   Feel free to use & spread it.
416
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
422
22b0834a760a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
    23
|d imgFileName img view|
416
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
420
0375b64c2a10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 419
diff changeset
    25
"/ for now: cannot do this under DOZE;
0375b64c2a10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 419
diff changeset
    26
"/ win does not support viewBackgrounds and
0375b64c2a10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 419
diff changeset
    27
"/ no event handling takes place at this time. sigh.
609
f0f51d4a0066 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
    28
"/ Display connections with round-trip-time >= 20 ms are
479
c34a15c6340c do not show banner on slow display connections
Stefan Vogel <sv@exept.de>
parents: 433
diff changeset
    29
"/ considered slow and no banner is shown
420
0375b64c2a10 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 419
diff changeset
    30
419
5e539a896aad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 416
diff changeset
    31
(OperatingSystem isUNIXlike
488
521e2d58f050 Changed workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 479
diff changeset
    32
 and:[(Smalltalk at:#XPMReader) notNil  "maybe minimal configuration"
609
f0f51d4a0066 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
    33
 and:[Display notNil
488
521e2d58f050 Changed workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 479
diff changeset
    34
 and:[Display roundTripTime < 20]]]) ifTrue:[
422
22b0834a760a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
    35
    "/ choose one of the banners
427
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
    36
    "/ (select the one which fits our screen depth best,
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
    37
    "/  avoiding allocation of too many colors)
419
5e539a896aad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 416
diff changeset
    38
    (d := Display depth) <= 8 ifTrue:[
5e539a896aad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 416
diff changeset
    39
	d <= 4 ifTrue:[
5e539a896aad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 416
diff changeset
    40
	    d <= 2 ifTrue:[
422
22b0834a760a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
    41
		imgFileName := 'banner1.xpm'     "/ bw image
419
5e539a896aad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 416
diff changeset
    42
	    ] ifFalse:[
422
22b0834a760a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
    43
		imgFileName := 'banner3.xpm'     "/ 8 colors
419
5e539a896aad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 416
diff changeset
    44
	    ]
416
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
	] ifFalse:[
422
22b0834a760a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
    46
	    imgFileName := 'banner5.xpm'         "/ 24 colors
419
5e539a896aad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 416
diff changeset
    47
	].
416
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    ] ifFalse:[
422
22b0834a760a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
    49
	imgFileName := 'banner8.xpm'             "/ 255 colors
416
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
    ].
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
422
22b0834a760a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
    52
    img := Image fromFile:imgFileName.
419
5e539a896aad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 416
diff changeset
    53
    img notNil ifTrue:[
433
19c1315698b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 431
diff changeset
    54
	"/ ('showBanner.rc [info]: launch splash screen banner.') infoPrintCR.
422
22b0834a760a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
    55
	"/ remember the bannerView - will be destroyed by
22b0834a760a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
    56
	"/ the hideBanner script.
488
521e2d58f050 Changed workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 479
diff changeset
    57
	view := PopUpBanner forImage:img.
419
5e539a896aad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 416
diff changeset
    58
	view showCentered.
421
5758ae881cc1 *** empty log message ***
ca
parents: 420
diff changeset
    59
	Display flush.
488
521e2d58f050 Changed workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 479
diff changeset
    60
	Smalltalk addStartBlock:[view destroy].
419
5e539a896aad *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 416
diff changeset
    61
    ].
416
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
].
b97097ff3702 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
!