text
stringlengths
0
15.7k
source
stringlengths
6
112
(aButton's setFrameOrigin:{buttonLeft, buttonYValue})
lns3.scpt
if cancelLeftFlag and (item 1 of allButtons)'s tag() is NSModalResponseCancel then (item 1 of allButtons)'s setFrameOrigin:{buttonSideInset, buttonYValue}
lns3.scpt
set theWindow to NSWindow's alloc()'s initWithContentRect:{{0, 0}, {windowWidth, theHeight + accViewYValue + accViewTopGap}} styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:true
lns3.scpt
theWindow's setLevel:NSModalPanelWindowLevel
lns3.scpt
set thisContentView to theWindow's contentView()
lns3.scpt
thisContentView's setSubviews:allButtons
lns3.scpt
set theAccessoryView to NSView's alloc()'s initWithFrame:{{accViewSideInset, accViewYValue}, {theWidth, theHeight}}
lns3.scpt
thisContentView's addSubview:theAccessoryView
lns3.scpt
theWindow's setAutorecalculatesKeyViewLoop:true
lns3.scpt
set my handlerResult to theWindow
lns3.scpt
end prepareEnhancedWindowMainThread:
lns3.scpt
on showTheWindowAndWaitMainThread:theArg
lns3.scpt
set {theWindow, defaultField, giveUp, initPosition, windowTitle} to theArg as list
lns3.scpt
if defaultField is not missing value then theWindow's makeFirstResponder:defaultField
lns3.scpt
set initPosition to initPosition as list
lns3.scpt
if initPosition = {} then
lns3.scpt
theWindow's |center|()
lns3.scpt
set screenFrame to NSScreen's mainScreen()'s frame()
lns3.scpt
if class of screenFrame is record then
lns3.scpt
set {width:screenWidth, height:screenHeight} to |size| of screenFrame
lns3.scpt
set {screenWidth, screenHeight} to item 2 of screenFrame
lns3.scpt
set theY to screenHeight - (item 2 of initPosition)
lns3.scpt
set windowFrame to theWindow's frame()
lns3.scpt
if class of windowFrame is record then
lns3.scpt
set origin of windowFrame to {item 1 of initPosition, theY - (height of |size| of windowFrame)}
lns3.scpt
set item 1 of windowFrame to {item 1 of initPosition, theY - (item 2 of item 2 of windowFrame)}
lns3.scpt
theWindow's setFrame:windowFrame display:true
lns3.scpt
theWindow's orderFront:me -- must be visible or it will be centered
lns3.scpt
theWindow's setTitle:windowTitle
lns3.scpt
if giveUp as integer > 0 then
lns3.scpt
NSApp's performSelector:"abortModal" withObject:(missing value) afterDelay:giveUp inModes:{NSModalPanelRunLoopMode}
lns3.scpt
set my returnCode to NSApp's runModalForWindow:theWindow
lns3.scpt
if giveUp as integer > 0 and returnCode is not NSModalResponseAbort then
lns3.scpt
NSObject's cancelPreviousPerformRequestsWithTarget:(NSApp) selector:"abortModal" object:(missing value)
lns3.scpt
theWindow's orderOut:me
lns3.scpt
end showTheWindowAndWaitMainThread:
lns3.scpt
on createLabelMainThread:theArg
lns3.scpt
set {labelString, theLeft, theBottom, maxWidth, alignment, wrapsBool, controlSize, boldType} to theArg as list
lns3.scpt
set theLabel to (NSTextField's alloc()'s initWithFrame:{{theLeft, theBottom}, {maxWidth, 17}})
lns3.scpt
if alignment = right aligned or alignment begins with "r" then
lns3.scpt
theLabel's setAlignment:NSRightTextAlignment
lns3.scpt
else if alignment = center aligned or alignment begins with "c" then
lns3.scpt
theLabel's setAlignment:NSCenterTextAlignment
lns3.scpt
theLabel's setAlignment:NSLeftTextAlignment
lns3.scpt
tell theLabel
lns3.scpt
its setFont:theFont
lns3.scpt
its setPreferredMaxLayoutWidth:maxWidth
lns3.scpt
(its setStringValue:labelString)
lns3.scpt
(its setEditable:false)
lns3.scpt
(its setSelectable:true)
lns3.scpt
(its setBordered:false)
lns3.scpt
(its setDrawsBackground:false)
lns3.scpt
its (cell()'s setWraps:wrapsBool)
lns3.scpt
theLabel's setFrameSize:(theLabel's fittingSize())
lns3.scpt
set theFrame to theLabel's frame()
lns3.scpt
set {width:newWidth, height:theHeight} to theFrame's |size|
lns3.scpt
set {newWidth, theHeight} to item 2 of theFrame
lns3.scpt
set theOrigin to {theLeft + maxWidth - newWidth, theBottom}
lns3.scpt
set theOrigin to {(theLeft + (maxWidth - newWidth) / 2), theBottom}
lns3.scpt
set theOrigin to {theLeft, theBottom}
lns3.scpt
theLabel's setFrameOrigin:theOrigin
lns3.scpt
set my handlerResult to {theLabel, theBottom + theHeight, newWidth}
lns3.scpt
end createLabelMainThread:
lns3.scpt
on createFieldMainThread:theArg
lns3.scpt
set {enteredText, placeholder, theLeft, theBottom, theWidth, extraHeight, acceptsTabs} to theArg as list
lns3.scpt
set theTop to theBottom + 22 + extraHeight
lns3.scpt
set theField to (NSTextField's alloc()'s initWithFrame:{{theLeft, theBottom}, {theWidth, theTop - theBottom}})
lns3.scpt
tell theField
lns3.scpt
(its setEditable:true)
lns3.scpt
(its setBezeled:true)
lns3.scpt
its (cell()'s setPlaceholderString:placeholder)
lns3.scpt
if extraHeight > 0 then its (cell()'s setWraps:true)
lns3.scpt
its setStringValue:enteredText
lns3.scpt
if acceptsTabs then its setDelegate:me
lns3.scpt
set my handlerResult to {theField, theTop}
lns3.scpt
end createFieldMainThread:
lns3.scpt
on createSecureFieldMainThread:theArg
lns3.scpt
set {enteredText, placeholder, theLeft, theBottom, theWidth} to theArg as list
lns3.scpt
set theTop to theBottom + 22
lns3.scpt
set theField to (NSSecureTextField's alloc()'s initWithFrame:{{theLeft, theBottom}, {theWidth, theTop - theBottom}})
lns3.scpt
its (cell()'s setWraps:false)
lns3.scpt
its setPlaceholderString:placeholder
lns3.scpt
end createSecureFieldMainThread:
lns3.scpt
on createPopupMainThread:theArg
lns3.scpt
set {entryList, theLeft, theBottom, theWidth, defaultValue} to theArg as list
lns3.scpt
set thePopup to NSPopUpButton's alloc()'s initWithFrame:{{theLeft, theBottom}, {theWidth, 26}} pullsDown:false
lns3.scpt
thePopup's addItemsWithTitles:entryList
lns3.scpt
thePopup's selectItemWithTitle:defaultValue
lns3.scpt
set my handlerResult to {thePopup, theBottom + 26}
lns3.scpt
end createPopupMainThread:
lns3.scpt
on createCheckboxMainThread:theArg
lns3.scpt
set {checkTitle, theLeft, theBottom, theWidth, initialState} to theArg as list
lns3.scpt
set theCheckbox to NSButton's alloc()'s initWithFrame:{{theLeft, theBottom}, {theWidth, 18}}
lns3.scpt
set theFont to my fontOfControlSize:regular size boldType:false
lns3.scpt
its setButtonType:NSSwitchButton
lns3.scpt
its setTitle:checkTitle
lns3.scpt
its setState:initialState
lns3.scpt
set isMain to NSThread's isMainThread() as boolean
lns3.scpt
theCheckbox's setFrameSize:(theCheckbox's fittingSize())
lns3.scpt
set theFrame to theCheckbox's frame()
lns3.scpt