LicenceBox.st
author Claus Gittinger <cg@exept.de>
Fri, 03 Dec 1999 19:10:29 +0100
changeset 1627 7bfaaad36045
parent 1626 614d6e8db98d
child 2054 bf9933e70737
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
245
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
     1
"
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
     2
 COPYRIGHT (c) 1996 by eXept Software AG
250
645390ad8e95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
     3
	      All Rights Reserved
245
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
     4
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
     5
 This software is furnished under a license and may be used
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
     6
 only in accordance with the terms of that license and with the
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
     8
 be provided or otherwise made available to, or used by, any
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
     9
 other person.  No title to or ownership of the software is
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
    10
 hereby transferred.
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
    11
"
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
    12
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    13
DialogBox subclass:#LicenceBox
1365
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
    14
	instanceVariableNames:'accepted destroySemaphore fileName textView'
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    15
	classVariableNames:'LicenceRejectSignal'
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    16
	poolDictionaries:''
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    17
	category:'Views-DialogBoxes'
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    18
!
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    19
875
48d482f90483 care for DEMO-licence text
Claus Gittinger <cg@exept.de>
parents: 527
diff changeset
    20
!LicenceBox class methodsFor:'documentation'!
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    21
244
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    22
copyright
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    23
"
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    24
 COPYRIGHT (c) 1996 by eXept Software AG
250
645390ad8e95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    25
	      All Rights Reserved
244
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    26
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    27
 This software is furnished under a license and may be used
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    28
 only in accordance with the terms of that license and with the
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    30
 be provided or otherwise made available to, or used by, any
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    31
 other person.  No title to or ownership of the software is
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    32
 hereby transferred.
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    33
"
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    34
!
243
82637ad60d26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
    35
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    36
documentation
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    37
"
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    38
    LicenceBox shows a licence text when opened, an returns true,
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    39
    if the licence has been accepted, false otherwise.
244
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    40
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    41
    [author:]
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    42
	Stefan Vogel
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    43
1364
61457de0e18b compute the height from the displays height
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
    44
    [start with:]
61457de0e18b compute the height from the displays height
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
    45
	LicenceBox open
61457de0e18b compute the height from the displays height
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
    46
244
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    47
    [see also:]
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    48
	AboutBox
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    49
"
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    50
!
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    51
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    52
examples
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    53
"
244
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    54
						[exBegin]
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    55
    LicenceRejectSignal handle:[:ex|
244
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    56
	Transcript showCR:'Licence rejected'.
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    57
    ] do:[
244
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    58
	LicenceBox open.
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    59
	Transcript showCR:'Licence accepted'.
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    60
    ] 
244
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    61
						[exEnd]
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    62
"
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    63
! !
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    64
875
48d482f90483 care for DEMO-licence text
Claus Gittinger <cg@exept.de>
parents: 527
diff changeset
    65
!LicenceBox class methodsFor:'initialization'!
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    66
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    67
initialize
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    68
    LicenceRejectSignal isNil ifTrue:[
244
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    69
	LicenceRejectSignal := ErrorSignal newSignalMayProceed:true.
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    70
	LicenceRejectSignal nameClass:self message:#licenceRejectSignal.
646c3da97dd0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    71
	LicenceRejectSignal notifierString:'licence rejected by user'.
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    72
    ].
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    73
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    74
    "
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    75
     self initialize
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    76
    "
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    77
! !
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    78
875
48d482f90483 care for DEMO-licence text
Claus Gittinger <cg@exept.de>
parents: 527
diff changeset
    79
!LicenceBox class methodsFor:'instance creation'!
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    80
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    81
open
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    82
    "open myself modal and return true if accepted, false otherwise"
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    83
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    84
    ^ super open accepted.
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    85
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    86
    "
250
645390ad8e95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    87
     LicenceBox open
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    88
    "
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    89
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    90
    "Modified: 9.9.1996 / 17:52:48 / stefan"
1365
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
    91
!
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
    92
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
    93
openOnFile:aFileName
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
    94
    "like open, but show the HTML-text found in aFileName.
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
    95
     Can be used for end-user applications which want to display
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
    96
     there own licence text."
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
    97
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
    98
    |box f fn text dir|
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
    99
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   100
    box := self new.
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   101
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   102
    (f := aFileName asFilename) exists ifTrue:[
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   103
	text := f contents.
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   104
	dir := f directoryName.
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   105
    ] ifFalse:[
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   106
	fn := Smalltalk getSystemFileName:aFileName.
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   107
	fn notNil ifTrue:[
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   108
	    f := fn asFilename.
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   109
	    text := f contents.
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   110
	    dir := f directoryName.
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   111
	]
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   112
    ].
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   113
    text notNil ifTrue:[
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   114
	box licenceText:text.
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   115
	box topDirectory:dir.
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   116
    ].
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   117
    box open
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   118
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   119
    "
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   120
     LicenceBox openOnFile:'doc/online/english/TOP.html'
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   121
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   122
     (LicenceBox licenceRejectSignal catch:[
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   123
	LicenceBox openOnFile:'doc/online/english/TOP.html'
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   124
     ]) ifTrue:[
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   125
	self information:'rejected'
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   126
      ]
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   127
    "
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   128
! !
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   129
875
48d482f90483 care for DEMO-licence text
Claus Gittinger <cg@exept.de>
parents: 527
diff changeset
   130
!LicenceBox class methodsFor:'Signal constants'!
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   131
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   132
licenceRejectSignal
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   133
    "licence has been rejected by user"
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   134
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   135
    ^ LicenceRejectSignal
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   136
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   137
! !
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   138
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   139
!LicenceBox methodsFor:'accessing'!
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   140
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   141
accepted
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   142
    "return accepted"
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   143
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   144
    ^ accepted
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   145
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   146
    "Created: 6.9.1996 / 13:24:44 / stefan"
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   147
!
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   148
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   149
accepted:something
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   150
    "set accepted"
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   151
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   152
    accepted := something.
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   153
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   154
    "Created: 6.9.1996 / 13:24:44 / stefan"
1365
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   155
!
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   156
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   157
licenceText:someHTMLText
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   158
    "set the text which is shown in the box"
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   159
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   160
    textView setText:someHTMLText.
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   161
!
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   162
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   163
topDirectory:aDirectoryName
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   164
    "set the topDirectory, which is required for hyperlinks
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   165
     to work (in the html text)"
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   166
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   167
    textView setTopDirectoryName:aDirectoryName.
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   168
! !
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   169
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   170
!LicenceBox methodsFor:'destroying'!
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   171
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   172
terminate
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   173
    "this is the close from a windowmanager
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   174
     (only if UseTransientViews == true).
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   175
     Redefined, since ModalBox keeps the View alive (only hidden)"
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   176
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   177
    self destroy.
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   178
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   179
    "Created: 9.9.1996 / 15:15:31 / stefan"
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   180
! !
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   181
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   182
!LicenceBox methodsFor:'initialization'!
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   183
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   184
initialize    
1365
138d2a797a62 allow for another file to be shown (for end-user apps)
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   185
    |nLines displayHeight|
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   186
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   187
    super initialize.
1239
ae99d201a28d smaller lic-box on small screens
Claus Gittinger <cg@exept.de>
parents: 875
diff changeset
   188
1364
61457de0e18b compute the height from the displays height
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
   189
    displayHeight := Display usableExtent y.
61457de0e18b compute the height from the displays height
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
   190
    nLines := displayHeight // 25.
61457de0e18b compute the height from the displays height
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
   191
61457de0e18b compute the height from the displays height
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
   192
"/    (displayHeight < 800) ifTrue:[
61457de0e18b compute the height from the displays height
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
   193
"/        (displayHeight < 500) ifTrue:[
61457de0e18b compute the height from the displays height
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
   194
"/            nLines := 20
61457de0e18b compute the height from the displays height
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
   195
"/        ] ifFalse:[
61457de0e18b compute the height from the displays height
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
   196
"/            nLines := 30
61457de0e18b compute the height from the displays height
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
   197
"/        ]
61457de0e18b compute the height from the displays height
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
   198
"/    ] ifFalse:[
61457de0e18b compute the height from the displays height
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
   199
"/        nLines := 40
61457de0e18b compute the height from the displays height
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
   200
"/    ].
1239
ae99d201a28d smaller lic-box on small screens
Claus Gittinger <cg@exept.de>
parents: 875
diff changeset
   201
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   202
    accepted := false.
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   203
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   204
    (self addTextLabel:(resources string:'Please read the licence terms:')) adjust:#left.
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   205
    textView := self addTextBoxOn:nil 
250
645390ad8e95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   206
			class:HTMLDocumentView
1239
ae99d201a28d smaller lic-box on small screens
Claus Gittinger <cg@exept.de>
parents: 875
diff changeset
   207
			withNumberOfLines:nLines
250
645390ad8e95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   208
			hScrollable:true 
645390ad8e95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   209
			vScrollable:true.
645390ad8e95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   210
1239
ae99d201a28d smaller lic-box on small screens
Claus Gittinger <cg@exept.de>
parents: 875
diff changeset
   211
    self width:(textView preferredExtentForLines:nLines cols:70) x.
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   212
    textView setText:(self licenceText).
249
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   213
    textView setTopDirectoryName:(self topDirectory).
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   214
    self addAbortButtonLabelled:(resources string:'reject licence terms').
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   215
    self addOkButtonLabelled:(resources string:'accept licence terms').
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   216
    self abortAction:[self destroy. accepted := false. LicenceRejectSignal raise].
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   217
    self okAction:[self destroy. accepted := true].
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   218
    self stickAtBottomWithVariableHeight:textView.
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   219
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   220
    "Modified: 9.9.1996 / 17:52:13 / stefan"
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   221
! !
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   222
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   223
!LicenceBox methodsFor:'private'!
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   224
249
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   225
licenceFile
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   226
    "get filename of licence file"
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   227
1626
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   228
    |relName|
249
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   229
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   230
    fileName isNil ifTrue:[
1626
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   231
        fileName := relName := resources at:'LICENCEFILE' default:nil.
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   232
        fileName isNil ifTrue:[
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   233
            Smalltalk releaseIdentification = 'ST/X_free_demo_vsn' ifTrue:[
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   234
                relName := 'doc/online/english/LICENCE_DEMO_STX.html'.
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   235
            ] ifFalse:[
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   236
                relName := 'doc/online/english/LICENCE_STX.html'.
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   237
            ].
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   238
            fileName := relName.
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   239
        ].
875
48d482f90483 care for DEMO-licence text
Claus Gittinger <cg@exept.de>
parents: 527
diff changeset
   240
1626
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   241
        fileName asFilename exists ifFalse:[
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   242
            fileName := Smalltalk getSystemFileName:relName.
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   243
            fileName isNil ifTrue:[
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   244
                fileName := Smalltalk getSystemFileName:('../' , relName).
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   245
                fileName isNil ifTrue:[
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   246
                    fileName := Smalltalk getSystemFileName:('../../' , relName).
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   247
                    fileName isNil ifTrue:[
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   248
                        fileName := Smalltalk getSystemFileName:'doc/online/german/LICENCE_STX.html'.
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   249
                        fileName isNil ifTrue:[
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   250
                            fileName := '../../doc/online/german/LICENCE_STX.html'.
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   251
                        ]
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   252
                    ]
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   253
                ].
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   254
            ].
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   255
        ].
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   256
        fileName asFilename exists ifFalse:[
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   257
            fileName := nil
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   258
        ].
249
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   259
    ].
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   260
    ^ fileName 
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   261
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   262
    "
1626
614d6e8db98d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   263
     LicenceBox new licenceFile 
249
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   264
    "
875
48d482f90483 care for DEMO-licence text
Claus Gittinger <cg@exept.de>
parents: 527
diff changeset
   265
48d482f90483 care for DEMO-licence text
Claus Gittinger <cg@exept.de>
parents: 527
diff changeset
   266
    "Modified: / 23.4.1998 / 11:40:25 / cg"
249
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   267
!
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   268
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   269
licenceText
245
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
   270
    "get licence text"
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   271
249
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   272
    |file|
241
687df61a0e84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   273
249
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   274
    file := self licenceFile.
245
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
   275
    file isNil ifTrue:[
1627
7bfaaad36045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
   276
        ^ 'oops - you are not supposed to remove the LICENSE file !!
7bfaaad36045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
   277
7bfaaad36045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
   278
- or the documentation files have not been installed correctly;
7bfaaad36045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
   279
- or your systemPath settings are not correct.'
245
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
   280
    ].
249
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   281
    ^ file asFilename contents.
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   282
245
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
   283
    "
249
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   284
     LicenceBox new licenceText
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   285
    "
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   286
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   287
!
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   288
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   289
topDirectory
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   290
    "get name of top directory"
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   291
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   292
    |file|
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   293
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   294
    file := self licenceFile.
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   295
    file isNil ifTrue:[
250
645390ad8e95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   296
	^ ''
249
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   297
    ].
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   298
    ^ file asFilename directoryName.
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   299
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   300
    "
6698113011ea Set top directory for relative HREFs.
Stefan Vogel <sv@exept.de>
parents: 245
diff changeset
   301
     LicenceBox new topDirectory
245
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
   302
    "
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
   303
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   304
! !
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   305
875
48d482f90483 care for DEMO-licence text
Claus Gittinger <cg@exept.de>
parents: 527
diff changeset
   306
!LicenceBox class methodsFor:'documentation'!
245
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
   307
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
   308
version
1627
7bfaaad36045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
   309
    ^ '$Header: /cvs/stx/stx/libwidg2/LicenceBox.st,v 1.18 1999-12-03 18:10:29 cg Exp $'
245
7b986d50e79d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
   310
! !
240
f24a0853e754 New class LicenceBox.
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   311
LicenceBox initialize!