text
stringlengths
0
15.7k
source
stringlengths
6
112
set {theField, theTop} to create field enteredText placeholder text placeholder left inset fieldLeft bottom theBottom field width (theWidth - fieldLeft) extra height 0 accepts linebreak and tab acceptsTabs
lns3.scpt
return {theField, theLabel, theTop, fieldLeft}
lns3.scpt
end create side labeled field
lns3.scpt
on create popup entryList left inset theLeft : 0 bottom theBottom popup width theWidth initial choice defaultValue : 1
lns3.scpt
if class of defaultValue is integer then set defaultValue to item defaultValue of entryList
lns3.scpt
my createPopupMainThread:{entryList, theLeft, theBottom, theWidth, defaultValue}
lns3.scpt
my performSelectorOnMainThread:"createPopupMainThread:" withObject:{entryList, theLeft, theBottom, theWidth, defaultValue} waitUntilDone:true
lns3.scpt
end create popup
lns3.scpt
on create labeled popup entryList left inset theLeft : 0 bottom theBottom popup width popupWidth max width theWidth label text theLabel popup left popupLeft initial choice defaultValue : 1
lns3.scpt
if popupLeft ≤ theLeft then
lns3.scpt
set {theLabel, theTop, newWidth} to create label theLabel left inset theLeft bottom (theBottom + 6) max width theWidth aligns left aligned without multiline
lns3.scpt
set popupLeft to (newWidth + 6)
lns3.scpt
set {thePopup, theTop} to create popup entryList left inset popupLeft bottom theBottom popup width popupWidth initial choice defaultValue
lns3.scpt
set {theLabel, theTop, newWidth} to create label theLabel left inset theLeft bottom (theBottom + 6) max width (popupLeft - theLeft - 6) aligns right aligned without multiline
lns3.scpt
return {thePopup, theLabel, theTop, popupLeft}
lns3.scpt
end create labeled popup
lns3.scpt
on create checkbox checkTitle left inset theLeft : 0 bottom theBottom max width theWidth initial state initialState : false
lns3.scpt
my createCheckboxMainThread:{checkTitle, theLeft, theBottom, theWidth, initialState}
lns3.scpt
my performSelectorOnMainThread:"createCheckboxMainThread:" withObject:{checkTitle, theLeft, theBottom, theWidth, initialState} waitUntilDone:true
lns3.scpt
end create checkbox
lns3.scpt
on create labeled checkbox checkTitle left inset theLeft : 0 bottom theBottom max width theWidth label text theLabel checkbox left checkboxLeft initial state checkState : false
lns3.scpt
if checkboxLeft ≤ theLeft then
lns3.scpt
set {theLabel, theTop, newWidth} to create label theLabel left inset theLeft bottom (theBottom + 2) max width theWidth aligns left aligned without multiline
lns3.scpt
set checkboxLeft to (newWidth + 6)
lns3.scpt
set {theCheckbox, theTop, theWidth} to create checkbox checkTitle left inset checkboxLeft bottom theBottom max width (theWidth - newWidth - 6) initial state checkState
lns3.scpt
set {theLabel, theTop, newWidth} to create label theLabel left inset theLeft bottom (theBottom + 2) max width (checkboxLeft - theLeft - 6) aligns right aligned without multiline
lns3.scpt
set {theCheckbox, theTop, theWidth} to create checkbox checkTitle left inset checkboxLeft bottom theBottom max width (theWidth - checkboxLeft) initial state checkState
lns3.scpt
return {theCheckbox, theLabel, theTop, checkboxLeft}
lns3.scpt
end create labeled checkbox
lns3.scpt
on create path control thePath left inset theLeft : 0 bottom theBottom control width theWidth pops up popsUpBool : true
lns3.scpt
my createPathControlMainThread:{thePath, theLeft, theBottom, theWidth, popsUpBool}
lns3.scpt
my performSelectorOnMainThread:"createPathControlMainThread:" withObject:{thePath, theLeft, theBottom, theWidth, popsUpBool} waitUntilDone:true
lns3.scpt
end create path control
lns3.scpt
on create labeled path control thePath left inset theLeft : 0 bottom theBottom control width theWidth pops up popsUpBool : true label text theLabel
lns3.scpt
set {thePathControl, theTop} to create path control thePath left inset theLeft bottom theBottom control width theWidth pops up popsUpBool
lns3.scpt
set {theLabel, theTop, newWidth} to create label theLabel left inset theLeft bottom (theTop + 4) max width theWidth aligns left aligned without multiline
lns3.scpt
return {thePathControl, theLabel, theTop}
lns3.scpt
end create labeled path control
lns3.scpt
on create matrix listOfNames left inset theLeft : 0 bottom theBottom max width theWidth arranged vertically isVertical : true initial choice defaultValue : 1
lns3.scpt
my createMatrixMainThread:{listOfNames, theLeft, theBottom, theWidth, isVertical, defaultValue}
lns3.scpt
my performSelectorOnMainThread:"createMatrixMainThread:" withObject:{listOfNames, theLeft, theBottom, theWidth, isVertical, defaultValue} waitUntilDone:true
lns3.scpt
end create matrix
lns3.scpt
on create labeled matrix listOfNames left inset theLeft : 0 bottom theBottom max width theWidth arranged vertically isVertical : true matrix left matrixLeft label text theLabel initial choice defaultValue : 1
lns3.scpt
if matrixLeft ≤ theLeft then
lns3.scpt
set matrixLeft to (newWidth + 6 + theLeft)
lns3.scpt
set {theMatrix, theTop, theWidth} to create matrix listOfNames left inset matrixLeft bottom theBottom max width (theWidth - newWidth - 6) arranged vertically isVertical initial choice defaultValue
lns3.scpt
set {theLabel, theTop, newWidth} to create label theLabel left inset theLeft bottom (theBottom + 2) max width (matrixLeft - theLeft - 6) aligns right aligned without multiline
lns3.scpt
set {theMatrix, theTop, theWidth} to create matrix listOfNames left inset (matrixLeft) bottom theBottom max width (theWidth - matrixLeft) arranged vertically isVertical initial choice defaultValue
lns3.scpt
theLabel's setFrame:(current application's NSOffsetRect(theLabel's frame(), 0, theTop - theBottom - 19))
lns3.scpt
return {theMatrix, theLabel, theTop, matrixLeft}
lns3.scpt
end create labeled matrix
lns3.scpt
on create rule theBottom left inset theLeft : 0 rule width theWidth
lns3.scpt
my createRuleMainThread:{theBottom, theLeft, theWidth}
lns3.scpt
my performSelectorOnMainThread:"createRuleMainThread:" withObject:{theBottom, theLeft, theWidth} waitUntilDone:true
lns3.scpt
end create rule
lns3.scpt
on create image view posixPath left inset theLeft : 0 bottom theBottom view width viewWidth view height viewHeight scale image imageScale : scale down proportionally align image imageAlignment : center aligned
lns3.scpt
my createImageViewMainThread:{posixPath, theLeft, theBottom, viewWidth, viewHeight, imageScale, imageAlignment}
lns3.scpt
my performSelectorOnMainThread:"createImageViewMainThread:" withObject:{posixPath, theLeft, theBottom, viewWidth, viewHeight, imageScale, imageAlignment} waitUntilDone:true
lns3.scpt
end create image view
lns3.scpt
on fontOfControlSize:controlSize boldType:boldType
lns3.scpt
if controlSize is regular size then
lns3.scpt
set theFontSize to NSFont's systemFontSizeForControlSize:NSRegularControlSize
lns3.scpt
else if controlSize = mini size then
lns3.scpt
set theFontSize to NSFont's systemFontSizeForControlSize:NSMiniControlSize
lns3.scpt
else if controlSize = small size then
lns3.scpt
set theFontSize to NSFont's systemFontSizeForControlSize:NSSmallControlSize
lns3.scpt
else if controlSize = large size then
lns3.scpt
set theFontSize to 16
lns3.scpt
if boldType then
lns3.scpt
return NSFont's boldSystemFontOfSize:theFontSize
lns3.scpt
return NSFont's systemFontOfSize:theFontSize
lns3.scpt
end fontOfControlSize:boldType:
lns3.scpt
on displayEnhancedAlertMainThread:theArg
lns3.scpt
set {mainText, theExplanation, styleNum, buttonsList, showSuppression, giveUp, theWidth, theHeight, controlsList} to theArg as list
lns3.scpt
set theAccessoryView to NSView's alloc()'s initWithFrame:{{0, 0}, {theWidth, theHeight}}
lns3.scpt
theAccessoryView's setSubviews:controlsList
lns3.scpt
set buttonsList to reverse of buttonsList
lns3.scpt
set theAlert to NSAlert's alloc()'s init()
lns3.scpt
tell theAlert
lns3.scpt
its setAlertStyle:styleNum
lns3.scpt
its setMessageText:mainText
lns3.scpt
its setInformativeText:theExplanation
lns3.scpt
repeat with anEntry in buttonsList
lns3.scpt
(its addButtonWithTitle:anEntry)
lns3.scpt
its setShowsSuppressionButton:showSuppression
lns3.scpt
its setAccessoryView:theAccessoryView
lns3.scpt
its (|window|()'s setAutorecalculatesKeyViewLoop:true)
lns3.scpt
if giveUp > 0 then NSApp's performSelector:"abortModal" withObject:(missing value) afterDelay:giveUp inModes:{NSModalPanelRunLoopMode}
lns3.scpt
set my returnCode to theAlert's runModal()
lns3.scpt
set my handlerResult to theAlert
lns3.scpt
end displayEnhancedAlertMainThread:
lns3.scpt
on prepareEnhancedWindowMainThread:theArg
lns3.scpt
set {windowTitle, theWidth, theHeight, controlsList, giveUp, defaultField, initPosition, cancelLeftFlag, allButtons} to theArg as list
lns3.scpt
set windowWidth to theWidth + accViewSideInset * 2
lns3.scpt
set buttonLeft to windowWidth - buttonSideInset
lns3.scpt
repeat with aButton in (reverse of allButtons)
lns3.scpt
set theFrame to aButton's frame()
lns3.scpt
set buttonWidth to width of |size| of theFrame
lns3.scpt
set buttonWidth to item 1 of item 2 of theFrame
lns3.scpt
set buttonLeft to buttonLeft - buttonWidth
lns3.scpt