Skip to content

Commit ea03381

Browse files
committed
Merge pull request livecode#2610 from livecodeali/bugfix-widget_update
[[ Extensions ]] Fix warnings in lc-authored extensions
2 parents 408a4cd + 5ad431e commit ea03381

16 files changed

Lines changed: 168 additions & 168 deletions

File tree

extensions/libraries/canvas/canvas.lcb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Description:
5656
Creates a canvas of the given size for the other handlers to use.
5757
*/
5858

59-
public handler canvasCreate(in pWidth as Integer, in pHeight as Integer) as undefined
59+
public handler canvasCreate(in pWidth as Integer, in pHeight as Integer) returns nothing
6060
-- Create a new canvas, this will release any previous canvas.
6161
put a new canvas with size [ pWidth, pHeight ] into sCanvas
6262
-- Set the paint to opaque black and fill the whole area.
@@ -68,11 +68,11 @@ end handler
6868
Summary: Destroys the canvas
6969

7070
Description:
71-
Destroys the canvas by simply assigning undefined to the canvas variable.
71+
Destroys the canvas by simply assigning nothing to the canvas variable.
7272
*/
7373

74-
public handler canvasDestroy() as undefined
75-
put undefined into sCanvas
74+
public handler canvasDestroy() returns nothing
75+
put nothing into sCanvas
7676
end handler
7777

7878
/*
@@ -85,7 +85,7 @@ pAlpha: The alpha value of the color to set.
8585
Description:
8686
Sets the current color of the canvas to the given RGBA value.
8787
*/
88-
public handler canvasSetColor(in pRed as Real, in pGreen as Real, in pBlue as Real, in pAlpha as Real) as undefined
88+
public handler canvasSetColor(in pRed as Real, in pGreen as Real, in pBlue as Real, in pAlpha as Real) returns nothing
8989
set the paint of sCanvas to solid paint with color [pRed, pGreen, pBlue, pRed]
9090
end handler
9191

@@ -97,7 +97,7 @@ pRadius: The radius of the circle.
9797
Description:
9898
Fills a circle of the given radius at the given position in the canvas.
9999
*/
100-
public handler canvasFillCircle(in pX as Real, in pY as Real, in pRadius as Real) as undefined
100+
public handler canvasFillCircle(in pX as Real, in pY as Real, in pRadius as Real) returns nothing
101101
fill circle path centered at point [pX, pY] with radius pRadius on sCanvas
102102
end handler
103103

@@ -108,7 +108,7 @@ pObjectId: A string which is an object chunk referring to an image.
108108
Description:
109109
This handler copies the current contents of the canvas to the specified image object.
110110
*/
111-
public handler canvasApplyToImage(in pObjectId as String) as undefined
111+
public handler canvasApplyToImage(in pObjectId as String) returns nothing
112112
variable tObject as ScriptObject
113113

114114
-- Resolving the script object gets a weak reference to the specified

extensions/libraries/iconsvg/iconsvg.lcb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ private variable sNamesList as List
3232
private variable sInitialised as optional Boolean
3333

3434
private handler ensureInitialised()
35-
if sInitialised is not defined then
36-
initialise()
35+
if sInitialised is nothing then
36+
initialiseIcons()
3737
put true into sInitialised
3838
end if
3939
end handler
4040

41-
private handler initialise()
41+
private handler initialiseIcons()
4242
put the empty array into sFontArray
4343
put the empty array into sFontArray["adjust"]
4444
put "M768 1440L768 352Q620 352 495 425 370 498 297 623 224 748 224 896 224 1044 297 1169 370 1294 495 1367 620 1440 768 1440ZM1536 896Q1536 1105 1433 1281.5 1330 1458 1153.5 1561 977 1664 768 1664 559 1664 382.5 1561 206 1458 103 1281.5 0 1105 0 896 0 687 103 510.5 206 334 382.5 231 559 128 768 128 977 128 1153.5 231 1330 334 1433 510.5 1536 687 1536 896Z" into sFontArray["adjust"]["svg"]
@@ -1264,7 +1264,9 @@ public handler iconListMatching(in pSearch as String) returns List
12641264
return tMatches
12651265
end handler
12661266

1267-
public handler iconData() as Array
1267+
public handler iconData() returns Array
1268+
ensureInitialised()
1269+
12681270
return sFontArray
12691271
end handler
12701272

extensions/widgets/button/button.lcb

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ metadata title is "Cross Platform Button"
3636
metadata svgicon is "M49.2,0h-34C6.8,0,0,6.8,0,15.2c0,8.4,6.8,15.2,15.2,15.2h34c8.4,0,15.2-6.8,15.2-15.2C64.3,6.8,57.5,0,49.2,0z M18.5,19.6c-0.2,0.3-0.4,0.6-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-1v-1.4h1v-2.1H36v2.1h1.2V15.1z M44.7,20.2c-0.6,0.8-1.6,1.2-2.9,1.2s-2.2-0.4-2.9-1.2c-0.6-0.7-0.9-1.6-0.9-2.6h2c0,0.7,0.2,1.2,0.5,1.6c0.3,0.4,0.7,0.6,1.3,0.6s1-0.2,1.3-0.6c0.3-0.4,0.5-1,0.5-1.7c0-0.7-0.2-1.3-0.5-1.7c-0.3-0.4-0.7-0.6-1.3-0.6s-1,0.2-1.3,0.6c-0.3,0.4-0.4,0.9-0.5,1.6h-2c0-1,0.3-1.9,0.9-2.6c0.6-0.8,1.6-1.2,2.9-1.2s2.2,0.4,2.9,1.2s0.9,1.7,0.9,2.8C45.7,18.5,45.3,19.4,44.7,20.2z M53.8,21.1h-2v-4.5c0-0.4-0.1-0.7-0.2-0.9c-0.2-0.4-0.6-0.6-1.1-0.6c-0.7,0-1.1,0.3-1.3,0.8C49.1,16.2,49,16.6,49,17v4h-1.9v-7.4h1.9v1.1c0.2-0.4,0.5-0.7,0.7-0.8c0.4-0.3,0.9-0.5,1.5-0.5c0.8,0,1.4,0.2,1.9,0.6c0.5,0.4,0.7,1.1,0.7,2V21.1z M47.2,5.5h-30c-6,0-13.1,3.2-14.6,7.8C3.6,7.5,9.7,3,17.2,3h30c8.1,0,14.7,5.3,14.7,11.9C61.9,9.5,53.8,5.5,47.2,5.5z"
3737

3838
-- property declarations
39-
property theme get mTheme set setTheme
40-
property buttonstyle get mStyle set setStyle
41-
property label get mLabel set setLabel
39+
property buttonTheme get mTheme set setTheme
40+
property buttonStyle get mStyle set setStyle
41+
property buttonLabel get mLabel set setLabel
4242
--
4343

4444
-- private instance variables
45-
private variable mTheme as optional string
46-
private variable mStyle as optional string
47-
private variable mLabel as optional string
48-
private variable mState as optional string
45+
private variable mTheme as optional String
46+
private variable mStyle as optional String
47+
private variable mLabel as optional String
48+
private variable mState as optional String
4949
--
5050

5151
-- constants
@@ -71,14 +71,14 @@ public handler OnLoad(in pProperties as Array)
7171
put pProperties["label"] into mLabel
7272
end handler
7373

74-
public handler OnCreate() as undefined
74+
public handler OnCreate() returns nothing
7575
put "ios-8" into mTheme
7676
put "Button" into mLabel
7777
put "default" into mStyle
7878
put "none" into mState
7979
end handler
8080

81-
public handler OnPaint() as undefined
81+
public handler OnPaint() returns nothing
8282

8383
// Draw the shadow
8484
// To implement. Waiting for the ability to draw outside the bounds of a control
@@ -100,37 +100,37 @@ public handler OnPaint() as undefined
100100
fill text mLabel at center of my bounds on this canvas
101101
end handler
102102

103-
public handler OnMouseDown() as undefined
103+
public handler OnMouseDown() returns nothing
104104
put "pressed" into mState
105105
redraw all
106106

107107
post "mouseDown"
108108
end handler
109109
--
110-
public handler OnMouseUp() as undefined
110+
public handler OnMouseUp() returns nothing
111111
put "none" into mState
112112
redraw all
113113

114114
post "mouseUp"
115115
end handler
116116
--
117-
public handler OnMouseEnter() as undefined
117+
public handler OnMouseEnter() returns nothing
118118
put "over" into mState
119119
redraw all
120120
end handler
121121
--
122-
public handler OnMouseLeave() as undefined
122+
public handler OnMouseLeave() returns nothing
123123
if mState is not "pressed" then
124124
put "none" into mState
125125
redraw all
126126
end if
127127
end handler
128128

129-
private handler getStrokeWidth() as Integer
129+
private handler getStrokeWidth() returns Integer
130130
return 1
131131
end handler
132132

133-
private handler getCornerRadius() as Integer
133+
private handler getCornerRadius() returns Integer
134134
if mTheme is "ios-8" then
135135
return 9
136136
else if mTheme is "macos-10.10" then
@@ -140,15 +140,15 @@ private handler getCornerRadius() as Integer
140140
return 10
141141
end handler
142142

143-
private handler getFontName() as String
143+
private handler getFontName() returns String
144144
if mTheme is "ios-8" then
145145
return "Helvetica Neue"
146146
end if
147147

148148
return the name of the font of this canvas
149149
end handler
150150

151-
private handler getFontSize() as Integer
151+
private handler getFontSize() returns Integer
152152
if mTheme is "ios-8" then
153153
if my height >= kMaxHeight then
154154
return 42
@@ -162,7 +162,7 @@ private handler getFontSize() as Integer
162162
return 11
163163
end handler
164164

165-
private handler getPaint_BackgroundFill() as Paint
165+
private handler getPaint_BackgroundFill() returns Paint
166166
if mTheme is "ios-8" then
167167
if mState is "pressed" then
168168
return solid paint with color [246/255, 246/255, 247/255]
@@ -195,7 +195,7 @@ private handler getPaint_BackgroundFill() as Paint
195195
return solid paint with color kWhite
196196
end handler
197197

198-
private handler getPaint_BackgroundStrokeFill() as Paint
198+
private handler getPaint_BackgroundStrokeFill() returns Paint
199199
if mTheme is "ios-8" then
200200
return solid paint with color kWhite
201201
else if mTheme is "macos-10.10" then
@@ -223,7 +223,7 @@ private handler getPaint_BackgroundStrokeFill() as Paint
223223
return solid paint with color kWhite
224224
end handler
225225

226-
private handler getPaint_TextFill() as Paint
226+
private handler getPaint_TextFill() returns Paint
227227
if mTheme is "ios-8" then
228228
return solid paint with color [51/255,153/255,1]
229229

@@ -240,17 +240,17 @@ private handler getPaint_TextFill() as Paint
240240
return solid paint with color kBlack
241241
end handler
242242

243-
public handler setTheme(in pThemeName as String) as undefined
243+
public handler setTheme(in pThemeName as String) returns nothing
244244
put pThemeName into mTheme
245245
redraw all
246246
end handler
247247

248-
private handler setLabel(in pLabel as String) as undefined
248+
private handler setLabel(in pLabel as String) returns nothing
249249
put pLabel into mLabel
250250
redraw all
251251
end handler
252252

253-
private handler setStyle(in pStyle as String) as undefined
253+
private handler setStyle(in pStyle as String) returns nothing
254254
if pStyle is in ["standard","default"] then
255255
put pStyle into mStyle
256256
redraw all

extensions/widgets/checkbox/checkbox.lcb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ metadata title is "Check Box"
3535
metadata svgicon is "M34.5,0l-3.1,1.6c-0.4,0.2-0.9,0.6-1.5,1c-0.7-0.5-1.6-0.8-2.5-0.8H4.3C1.9,1.9,0,3.8,0,6.2v23.1c0,2.4,1.9,4.3,4.3,4.3h23.1c2.4,0,4.3-1.9,4.3-4.3V6.2c0-0.8-0.3-1.6-0.7-2.3L34.5,0z M5,29.1V6.4h20.9c-1.6,1.5-3.3,3.3-4.9,5.1l-7.4,8.1l-0.9-2.9l-0.9-2.9H9.8c-1,0-2.2,0.4-2.7,0.8l-0.8,0.8l3.1,5.8c1.7,3.2,3.5,5.8,3.9,5.8c0.4,0,2.6-2.9,4.8-6.4c1.9-3,5.5-7.9,8.7-11.6v20.3H5z"
3636

3737
-- property declarations
38-
property theme get mTheme set setTheme
39-
property label get mLabel set setLabel
40-
property checked get mIsChecked set setChecked
38+
property checkboxTheme get mTheme set setTheme
39+
property checkboxLabel get mLabel set setLabel
40+
property isChecked get mIsChecked set setChecked
4141
--
4242

4343
-- private instance variables
@@ -133,7 +133,7 @@ public handler OnMouseUp()
133133
post "mouseUp" with [mLabel]
134134
end handler
135135

136-
private handler getPath(in pString as String) as Path
136+
private handler getPath(in pString as String) returns Path
137137
if pString is "checkbox" then
138138
if mTheme contains "macos" then
139139
return rounded rectangle path of rectangle [kPadding, my height/2 - kWidth/2, kPadding+kWidth, my height/2 + kWidth/2] with radius 2
@@ -143,7 +143,7 @@ private handler getPath(in pString as String) as Path
143143
end if
144144
end handler
145145

146-
private handler getRect(in pObject as String) as Rectangle
146+
private handler getRect(in pObject as String) returns Rectangle
147147
if pObject is "checkbox" then
148148
return rectangle [kPadding, my height/2 - kWidth/2, kPadding+kWidth, my height/2 + kWidth/2]
149149

@@ -152,7 +152,7 @@ private handler getRect(in pObject as String) as Rectangle
152152
end if
153153
end handler
154154

155-
private handler getPaint(in pObject as String) as Paint
155+
private handler getPaint(in pObject as String) returns Paint
156156

157157
if pObject is "border" then
158158
if mTheme is "macos-yosemite" and mIsChecked is true then
@@ -239,7 +239,7 @@ private handler getPaint(in pObject as String) as Paint
239239
return solid paint with color [0, 0, 0]
240240
end handler
241241

242-
private handler getFont(in pObject as String) as Font
242+
private handler getFont(in pObject as String) returns Font
243243
if pObject is "icon" then
244244
return font "fontawesome" at size kIconSize
245245

@@ -256,17 +256,17 @@ private handler getFont(in pObject as String) as Font
256256
return font (the name of the font of this canvas)
257257
end handler
258258

259-
public handler setTheme(in pTheme as String) as undefined
259+
public handler setTheme(in pTheme as String) returns nothing
260260
put pTheme into mTheme
261261
redraw all
262262
end handler
263263

264-
public handler setLabel(in pLabel as String) as undefined
264+
public handler setLabel(in pLabel as String) returns nothing
265265
put pLabel into mLabel
266266
redraw all
267267
end handler
268268

269-
public handler setChecked(in pIsChecked as Boolean) as undefined
269+
public handler setChecked(in pIsChecked as Boolean) returns nothing
270270
put pIsChecked into mIsChecked
271271
redraw all
272272
end handler

extensions/widgets/clock/clock.lcb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ metadata timeZone.default is "0"
6666
--
6767

6868
-- property declarations
69-
property day get mIsDay
70-
metadata day.user_visible is "false"
69+
property isDay get mIsDay
70+
metadata isDay.user_visible is "false"
7171
property timeZone get mTimeZone set setTimeZone
7272
metadata timeZone.editor is "com.livecode.pi.timezone"
7373
metadata timeZone.label is "Timezone"
@@ -197,7 +197,7 @@ public handler OnPaint()
197197

198198
end handler
199199

200-
handler getTimeComponents() as List
200+
handler getTimeComponents() returns List
201201
-- Fetch the local date.
202202
-- This a list in the form [day, month, year, hours,minutes,seconds]
203203
variable tDate as List
@@ -223,7 +223,7 @@ handler getTimeComponents() as List
223223
return tDate
224224
end handler
225225

226-
handler computeNextTimer() as Number
226+
handler computeNextTimer() returns Number
227227
get the universal time
228228
return 1 - (the result - the floor of the result)
229229
end handler
@@ -235,7 +235,7 @@ public handler OnTimer()
235235
schedule timer in computeNextTimer() seconds
236236
end handler
237237

238-
private handler getPaint(in pObject as String) as Paint
238+
private handler getPaint(in pObject as String) returns Paint
239239

240240
if pObject is "clock face" then
241241
if mIsDay is true then
@@ -257,7 +257,7 @@ private handler getPaint(in pObject as String) as Paint
257257
end if
258258
end handler
259259

260-
private handler getPath(in pString as String) as Path
260+
private handler getPath(in pString as String) returns Path
261261

262262
if pString is "clock face" then
263263
put (my width)/10 into mFontSize
@@ -278,7 +278,7 @@ private handler getPath(in pString as String) as Path
278278
end if
279279
end handler
280280

281-
private handler getPoint(in pString as String) as Point
281+
private handler getPoint(in pString as String) returns Point
282282
if pString is "1" then
283283
return point [(my width)/2+0.35*(my width)/2, (my height)/2-0.65*(my width)/2]
284284
else if pString is "2" then
@@ -306,7 +306,7 @@ private handler getPoint(in pString as String) as Point
306306
end if
307307
end handler
308308

309-
private handler getStrokeWidth(in pHand as String) as Real
309+
private handler getStrokeWidth(in pHand as String) returns Real
310310
if pHand is "minute hand" or pHand is "hour hand" then
311311
return (my width/2)*0.03
312312

@@ -316,7 +316,7 @@ private handler getStrokeWidth(in pHand as String) as Real
316316
end if
317317
end handler
318318

319-
public handler setTimeZone(in pTimeZone as Number) as undefined
319+
public handler setTimeZone(in pTimeZone as Number) returns nothing
320320
put pTimeZone into mTimeZone
321321
put getTimeComponents() into mCurrentTime
322322
redraw all

0 commit comments

Comments
 (0)