Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 85fd720

Browse files
committed
[[ Tools ]] Fix issue with displaying widget with png icon
1 parent 88da6f8 commit 85fd720

1 file changed

Lines changed: 14 additions & 20 deletions

File tree

Toolset/palettes/tools/revtools.livecodescript

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -292,29 +292,22 @@ on generatePalette
292292
set the id of it to revIDENewIconID()
293293
end if
294294

295-
local tImageID
295+
local tImageID, tFilename
296296
if sViewsData[tView][tControlTypeID]["icon"] is not empty then
297-
set the name of the templateimage to tControlTypeID & ".icon.png"
298-
set the visible of the templateimage to false
299-
set the filename of the templateimage to sViewsData[tView][tControlTypeID]["icon"]
300-
create image in group "images" of group "contents"
301-
set the id of it to revIDENewIconID()
302-
put the long id of image (tControlTypeID & ".icon.png") of group "images" of group "contents" into tImageID
303-
revIDEResizeImageInBounds tImageID, BLOCK_SIZE * 2,BLOCK_SIZE
304-
set the icon of the templatebutton to the ID of tImageID
297+
put sViewsData[tView][tControlTypeID]["icon"] into tFilename
305298
else if there is a file (tThemePath & slash & tControlTypeID & ".icon.png") then
306-
# If we can find an icon file in the theme, create it
307-
set the name of the templateimage to tControlTypeID & ".icon.png"
308-
set the visible of the templateimage to false
309-
set the filename of the templateimage to tThemePath & slash & tControlTypeID & ".icon.png"
310-
create image in group "images" of group "contents"
311-
set the id of it to revIDENewIconID()
312-
put the long id of image (tControlTypeID & ".icon.png") of group "images" of group "contents" into tImageID
313-
revIDEResizeImageInBounds tImageID, BLOCK_SIZE * 2,BLOCK_SIZE
314-
set the icon of the templatebutton to the ID of tImageID
315-
else
316-
set the icon of the templatebutton to empty
299+
put tThemePath & slash & tControlTypeID & ".icon.png" into tFilename
300+
else
301+
put revIDEDefaultExtensionIcon("widget") into tFilename
317302
end if
303+
set the name of the templateimage to tControlTypeID & ".icon.png"
304+
set the visible of the templateimage to false
305+
set the filename of the templateimage to tFilename
306+
create image in group "images" of group "contents"
307+
set the id of it to revIDENewIconID()
308+
put the long id of image (tControlTypeID & ".icon.png") of group "images" of group "contents" into tImageID
309+
revIDEResizeImageInBounds tImageID, BLOCK_SIZE * 2,BLOCK_SIZE
310+
set the icon of the templatebutton to the ID of tImageID
318311

319312
# If the object is a tool, set the key custom properties to make it behave like a tool
320313
local tToolType
@@ -356,6 +349,7 @@ on generatePalette
356349

357350
if sViewsData[tView][tControlTypeID]["svgicon"] is empty then
358351
create button tControlTypeID in group tView of group "contents"
352+
set the cType of button tControlTypeID to tView
359353
else
360354
create widget tControlTypeID as "com.livecode.widget.svgpath" in group tView of group "contents"
361355
set the width of widget tControlTypeID to BLOCK_SIZE * 2

0 commit comments

Comments
 (0)