~drgeo-developers/drgeo/trunk

« back to all changes in this revision

Viewing changes to src/DrGeoTablet.pck.st

  • Committer: Hilaire Fernandes
  • Date: 2022-08-16 20:20:24 UTC
  • Revision ID: hilaire.fernandes@gmail.com-20220816202024-9trlk02ioq73bo3z
WIP bundle

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'From Cuis 6.0 [latest update: #5448] on 16 August 2022 at 12:00:54 pm'!
 
2
'Description '!
 
3
!provides: 'DrGeoTablet' 1 1!
 
4
!requires: 'DrGeo' 1 430 nil!
 
5
SystemOrganization addCategory: 'DrGeoTablet'!
 
6
 
 
7
 
 
8
!classDefinition: #DrGTablet category: 'DrGeoTablet'!
 
9
DrGPlatform subclass: #DrGTablet
 
10
        instanceVariableNames: 'wheelHeight'
 
11
        classVariableNames: ''
 
12
        poolDictionaries: ''
 
13
        category: 'DrGeoTablet'!
 
14
!classDefinition: 'DrGTablet class' category: 'DrGeoTablet'!
 
15
DrGTablet class
 
16
        instanceVariableNames: ''!
 
17
 
 
18
!classDefinition: #DrGAndroid category: 'DrGeoTablet'!
 
19
DrGTablet subclass: #DrGAndroid
 
20
        instanceVariableNames: ''
 
21
        classVariableNames: ''
 
22
        poolDictionaries: ''
 
23
        category: 'DrGeoTablet'!
 
24
!classDefinition: 'DrGAndroid class' category: 'DrGeoTablet'!
 
25
DrGAndroid class
 
26
        instanceVariableNames: ''!
 
27
 
 
28
!classDefinition: #DrGiPad category: 'DrGeoTablet'!
 
29
DrGTablet subclass: #DrGiPad
 
30
        instanceVariableNames: ''
 
31
        classVariableNames: ''
 
32
        poolDictionaries: ''
 
33
        category: 'DrGeoTablet'!
 
34
!classDefinition: 'DrGiPad class' category: 'DrGeoTablet'!
 
35
DrGiPad class
 
36
        instanceVariableNames: ''!
 
37
 
 
38
 
 
39
!DrGTablet commentStamp: '' prior: 0!
 
40
Preferences common to tablets!
 
41
 
 
42
!DrGAndroid commentStamp: '' prior: 0!
 
43
Preferences for Android tablet!
 
44
 
 
45
!DrGiPad commentStamp: '' prior: 0!
 
46
Preferences for iPad tablet!
 
47
 
 
48
!DrGTablet methodsFor: 'initialize-release'!
 
49
reset
 
50
        super reset.
 
51
        wheelHeight _ nil! !
 
52
 
 
53
!DrGTablet methodsFor: 'initialize-release' stamp: 'hlsf 4/10/2022 15:04:23'!
 
54
startUp
 
55
        super startUp.
 
56
        self splash.
 
57
        (WorldMorph submorphs anySatisfy: [:morph | morph class == DrGeoView]) ifFalse:
 
58
                [DrGeo newFullscreen]! !
 
59
 
 
60
!DrGTablet methodsFor: 'user interface'!
 
61
wheelHeight
 
62
        ^ wheelHeight ifNil: [ |maxWheelHeight|
 
63
                maxWheelHeight _ (Display height - (3.4 * self toolbarIconSize) - 32 - self wheelWidth) // 2.
 
64
                wheelHeight _ 180 min: maxWheelHeight]! !
 
65
 
 
66
!DrGTablet methodsFor: 'user interface'!
 
67
wheelWidth
 
68
        ^ 55! !
 
69
 
 
70
!DrGTablet methodsFor: 'font'!
 
71
canvasFontSize
 
72
        ^ 12! !
 
73
 
 
74
!DrGTablet methodsFor: 'font'!
 
75
setFontPreferences
 
76
        StandardFonts codeFont: (LogicalFont familyName: DrGeoSystem fontName  pointSize: 12).
 
77
        StandardFonts listFont: (LogicalFont familyName: DrGeoSystem fontName  pointSize: 14).
 
78
        StandardFonts menuFont: (LogicalFont familyName: DrGeoSystem fontName pointSize: 14).
 
79
        StandardFonts windowTitleFont: (LogicalFont familyName: DrGeoSystem fontName pointSize: 14).
 
80
        StandardFonts balloonFont: (LogicalFont familyName: DrGeoSystem fontName  pointSize: 12).
 
81
        StandardFonts haloFont: (LogicalFont familyName: DrGeoSystem fontName  pointSize: 12).
 
82
        StandardFonts buttonFont: (LogicalFont familyName: DrGeoSystem fontName  pointSize: 16).
 
83
        StandardFonts defaultFont: (LogicalFont familyName: DrGeoSystem fontName  pointSize: 14).
 
84
! !
 
85
 
 
86
!DrGAndroid methodsFor: 'initialize-release' stamp: 'hlsf 4/21/2020 21:32:20'!
 
87
initialize
 
88
        canWeDisplaySpinner _ true.
 
89
        WorldState desktopMenuTitle: 'Dr. Geo'.
 
90
        WorldState desktopMenuPragmaKeyword:  'drgeoMenu'.
 
91
        PolymorphSystemSettings uiThemeClass:  DrGeoTheme.
 
92
        UITheme currentSettings fastDragging: true.
 
93
        UITheme currentSettings fadedBackgroundWindows: false.
 
94
        SystemWindow fullscreenMargin: 0.
 
95
        UITheme currentSettings preferRoundCorner: false.
 
96
 
 
97
        TaskbarMorph showTaskbar: false.
 
98
        World color: Color white.! !
 
99
 
 
100
!DrGAndroid methodsFor: 'initialize-release'!
 
101
startUp 
 
102
        super startUp.
 
103
        (Smalltalk at: #Android) setVMTimerInterval: 100! !
 
104
 
 
105
!DrGAndroid methodsFor: 'user interface'!
 
106
showVirtualKeyboard: boolean
 
107
        (Smalltalk at: #Android) onScreenKbd: (boolean ifTrue: [1] ifFalse: [0])! !
 
108
 
 
109
!DrGAndroid methodsFor: 'user interface'!
 
110
toolbarIconSize
 
111
        toolbarIconSize
 
112
                ifNil: [ toolbarIconSize _ (Display height - 110) / 12 truncateTo: 4.
 
113
                        toolbarIconSize _ toolbarIconSize min: 48 max: 12].
 
114
        ^ toolbarIconSize! !
 
115
 
 
116
!DrGAndroid methodsFor: 'path'!
 
117
mySketchesPath
 
118
        ^ ((Smalltalk at: #Android) getSDCardRoot), '/MySketches'.! !
 
119
 
 
120
!DrGAndroid methodsFor: 'path' stamp: 'hlsf 6/8/2021 19:43:02'!
 
121
rootPath
 
122
        ^  DirectoryEntry smalltalkImageDirectory! !
 
123
 
 
124
!DrGAndroid methodsFor: 'testing'!
 
125
isAndroid
 
126
        ^ true! !
 
127
 
 
128
!DrGiPad methodsFor: 'initialize-release' stamp: 'hlsf 4/21/2020 21:32:20'!
 
129
initialize
 
130
        canWeDisplaySpinner _ true.
 
131
        WorldState desktopMenuTitle: 'Dr. Geo'.
 
132
        WorldState desktopMenuPragmaKeyword:  'drgeoMenu'.
 
133
 
 
134
        PolymorphSystemSettings uiThemeClass:  DrGeoTheme.
 
135
        UITheme currentSettings fastDragging: true.
 
136
        UITheme currentSettings fadedBackgroundWindows: false.
 
137
        SystemWindow fullscreenMargin: 0.
 
138
        UITheme currentSettings preferRoundCorner: false.
 
139
 
 
140
        TaskbarMorph showTaskbar: false.
 
141
        World color: Color white.
 
142
"       HostWindowProxy basicNew primitiveWindowSize: 1 x: 1024 y: 768. " "does not work when building from Linux"
 
143
"       World doOneCycleNow.
 
144
        DrGeo new view extent: 1024@768; position: 0@0."! !
 
145
 
 
146
!DrGiPad methodsFor: 'initialize-release'!
 
147
startUp
 
148
        GetTextTranslator userDefaultLocaleDirs add: self localePath.
 
149
        NaturalLanguageTranslator privateStartUp.
 
150
        super startUp.
 
151
! !
 
152
 
 
153
!DrGiPad methodsFor: 'as yet unclassified'!
 
154
openURI: aString
 
155
        | sharedApp nsUrl |
 
156
        sharedApp _ ((Smalltalk at: #ObjectiveCBridge) classObjectForName: #UIApplication) sharedApplication.
 
157
        nsUrl _ (Smalltalk at: #ObjectiveCBridge) classObjectForName: #NSURL.
 
158
        sharedApp openURL: (nsUrl URLWithString: aString asNSStringUTF8).
 
159
        
 
160
        "(ObjectiveCBridge  classObjectForName: #UIApplication) sharedApplication 
 
161
                openURL: ((ObjectiveCBridge classObjectForName: #NSURL) URLWithString: 'http://www.drgeo.eu' asNSStringUTF8)"! !
 
162
 
 
163
!DrGiPad methodsFor: 'testing'!
 
164
isiPad
 
165
        ^ true! !
 
166
 
 
167
!DrGiPad methodsFor: 'path'!
 
168
localePath
 
169
        ^ self rootPath / 'locale'! !
 
170
 
 
171
!DrGiPad methodsFor: 'path'!
 
172
mySketchesPath
 
173
        | path |
 
174
        path _ self sandboxPath asFileReference / 'MySketches'.
 
175
        ^path fullName
 
176
! !
 
177
 
 
178
!DrGiPad methodsFor: 'path' stamp: 'hlsf 6/8/2021 19:43:33'!
 
179
rootPath
 
180
        ^ DirectoryEntry smalltalkImageDirectory! !
 
181
 
 
182
!DrGiPad methodsFor: 'path'!
 
183
sandboxPath
 
184
        | path |
 
185
        path _ self rootPath  parent / 'Documents'.
 
186
        path ensureDirectory.
 
187
        ^path fullName! !
 
188
 
 
189
!DrGiPad methodsFor: 'user interface'!
 
190
showVirtualKeyboard: boolean
 
191
        (Smalltalk at: #IPhonePlatform) showKeyboard: boolean! !
 
192
 
 
193
!DrGiPad methodsFor: 'user interface'!
 
194
toolbarIconSize
 
195
        ^ 40! !
 
196
 
 
197
!DrGeoSystem class methodsFor: '*DrGeoTablet'!
 
198
beAndroid
 
199
        "self beAndroid"
 
200
        platform _ DrGAndroid new.
 
201
        self addStartUp! !
 
202
 
 
203
!DrGeoSystem class methodsFor: '*DrGeoTablet'!
 
204
beiPad
 
205
        "self beiPad"
 
206
        platform _ DrGiPad new.
 
207
        self addStartUp! !