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