text
stringlengths
0
15.7k
source
stringlengths
6
112
set theWidth to width of |size| of theFrame
lns3.scpt
set theWidth to item 1 of item 2 of theFrame
lns3.scpt
set my handlerResult to {theCheckbox, theBottom + 18, theWidth}
lns3.scpt
end createCheckboxMainThread:
lns3.scpt
on createPathControlMainThread:theArg
lns3.scpt
set {thePath, theLeft, theBottom, theWidth, popsUpBool} to theArg as list
lns3.scpt
set anNSURL to |NSURL|'s fileURLWithPath:thePath
lns3.scpt
if popsUpBool then
lns3.scpt
set thePathControl to NSPathControl's alloc()'s initWithFrame:{{theLeft, theBottom}, {theWidth, 26}}
lns3.scpt
thePathControl's setPathStyle:NSPathStylePopUp
lns3.scpt
set theTop to theBottom + 26
lns3.scpt
set thePathControl to NSPathControl's alloc()'s initWithFrame:{{theLeft, theBottom}, {theWidth, 22}}
lns3.scpt
thePathControl's setPathStyle:NSPathStyleStandard
lns3.scpt
thePathControl's setURL:anNSURL
lns3.scpt
set my handlerResult to {thePathControl, theTop}
lns3.scpt
end createPathControlMainThread:
lns3.scpt
on createMatrixMainThread:theArg
lns3.scpt
set {listOfNames, theLeft, theBottom, theWidth, isVertical, defaultValue} to theArg as list
lns3.scpt
if class of defaultValue is integer then set defaultValue to item defaultValue of listOfNames
lns3.scpt
set theCount to count of listOfNames
lns3.scpt
if isVertical then
lns3.scpt
set rowCount to theCount
lns3.scpt
set colCount to 1
lns3.scpt
set colCount to theCount
lns3.scpt
set rowCount to 1
lns3.scpt
set theDepth to rowCount * 18 + (rowCount - 1) * 2 -- 18 pts per button + 2 pts between
lns3.scpt
set theMatrix to NSMatrix's alloc()'s initWithFrame:{{theLeft, theBottom}, {theWidth, theDepth}} mode:NSRadioModeMatrix cellClass:(NSButtonCell) numberOfRows:rowCount numberOfColumns:colCount
lns3.scpt
theMatrix's deselectAllCells()
lns3.scpt
set theCells to theMatrix's cells() as list
lns3.scpt
repeat with i from 1 to count of theCells
lns3.scpt
((item i of theCells)'s setButtonType:NSRadioButton)
lns3.scpt
((item i of theCells)'s setTitle:(item i of listOfNames))
lns3.scpt
if item i of listOfNames = defaultValue then
lns3.scpt
(theMatrix's selectCellAtRow:(i - 1) column:0)
lns3.scpt
(theMatrix's selectCellAtRow:0 column:(i - 1))
lns3.scpt
((item i of theCells)'s setFont:theFont)
lns3.scpt
theMatrix's setIntercellSpacing:{8, 2}
lns3.scpt
theMatrix's setAutorecalculatesCellSize:true
lns3.scpt
theMatrix's setAutosizesCells:true
lns3.scpt
theMatrix's sizeToCells()
lns3.scpt
set theFrame to theMatrix's frame()
lns3.scpt
set newWidth to width of |size| of theFrame
lns3.scpt
set newWidth to item 1 of item 2 of theFrame
lns3.scpt
theMatrix's setFrameSize:{newWidth, theDepth}
lns3.scpt
set my handlerResult to {theMatrix, theBottom + theDepth, newWidth}
lns3.scpt
end createMatrixMainThread:
lns3.scpt
on createRuleMainThread:theArg
lns3.scpt
set {theBottom, theLeft, theWidth} to theArg as list
lns3.scpt
set theRule to NSBox's alloc()'s initWithFrame:{{theLeft, theBottom}, {theWidth, 1}}
lns3.scpt
tell theRule
lns3.scpt
its setBoxType:NSBoxSeparator
lns3.scpt
its setTitlePosition:NSNoTitle
lns3.scpt
its setBorderType:NSLineBorder
lns3.scpt
set my handlerResult to {theRule, theBottom + 1}
lns3.scpt
end createRuleMainThread:
lns3.scpt
on createImageViewMainThread:theArg
lns3.scpt
set {posixPath, theLeft, theBottom, viewWidth, viewHeight, imageScale, imageAlignment} to theArg as list
lns3.scpt
set theImage to NSImage's alloc()'s initWithContentsOfFile:posixPath
lns3.scpt
if theImage is missing value then error "No valid image found at " & posixPath
lns3.scpt
set imageView to NSImageView's alloc()'s initWithFrame:{{theLeft, theBottom}, {viewWidth, viewHeight}}
lns3.scpt
imageView's setImage:theImage
lns3.scpt
set theAlignments to {center aligned, top aligned, top left aligned, top right aligned, left aligned, bottom left aligned, bottom right aligned, right aligned, bottom aligned}
lns3.scpt
repeat with i from 1 to count of theAlignments
lns3.scpt
if item i of theAlignments = imageAlignment then
lns3.scpt
(imageView's setImageAlignment:(i - 1))
lns3.scpt
set theScales to {scale down proportionally, scale to fit, scale none, scale proportionally}
lns3.scpt
repeat with i from 1 to count of theScales
lns3.scpt
if item i of theScales = imageScale then
lns3.scpt
(imageView's setImageScaling:(i - 1))
lns3.scpt
set my handlerResult to {imageView, theBottom + viewHeight}
lns3.scpt
end createImageViewMainThread:
lns3.scpt
on createButtonsViewMainThread:theArg
lns3.scpt
set {buttonList, buttonKeysList, equalWidths, cancelIndex, okIndex} to theArg as list
lns3.scpt
copy minimumButtonWidth to minButtonWidth
lns3.scpt
set buttonCount to count of buttonList
lns3.scpt
set buttonKeysCount to count of buttonKeysList
lns3.scpt
set allButtons to {} -- to hold list
lns3.scpt
set minAccViewWidth to 0
lns3.scpt
repeat with i from buttonCount to 1 by -1
lns3.scpt
set thisButton to (NSButton's alloc()'s initWithFrame:{{0, buttonYValue}, {minButtonWidth, 32}})
lns3.scpt
(thisButton's setButtonType:NSMomentaryPushInButton)
lns3.scpt
(thisButton's setBezelStyle:NSRoundedBezelStyle)
lns3.scpt
(thisButton's setImagePosition:NSNoImage)
lns3.scpt
(thisButton's setTag:i)
lns3.scpt
(thisButton's setTitle:(item i of buttonList))
lns3.scpt
(thisButton's setTarget:me)
lns3.scpt
(thisButton's setAction:"closeTheWindow:")
lns3.scpt
set asButtonNumber to buttonCount - i + 1
lns3.scpt
if i = cancelIndex or item i of buttonList = cancelIndex then -- make esc the shortcut
lns3.scpt
(thisButton's setKeyEquivalent:(character id 27))
lns3.scpt
(thisButton's setTag:NSModalResponseCancel)
lns3.scpt
else if i = okIndex or item i of buttonList = okIndex then -- make return/enter the shortcut
lns3.scpt
(thisButton's setKeyEquivalent:return)
lns3.scpt
else if i ≤ buttonKeysCount and length of item i of buttonKeysList > 0 then -- add shortcut
lns3.scpt
set theKey to character 1 of item i of buttonKeysList
lns3.scpt
(thisButton's setKeyEquivalent:theKey)
lns3.scpt
(thisButton's setKeyEquivalentModifierMask:NSCommandKeyMask)
lns3.scpt
(thisButton's setFrameSize:(thisButton's fittingSize()))
lns3.scpt
set beginning of allButtons to thisButton
lns3.scpt
set theFrame to thisButton's frame()
lns3.scpt