Skip to content

Commit

Permalink
Morph -> Widget
Browse files Browse the repository at this point in the history
  • Loading branch information
davidedc committed Feb 8, 2018
1 parent bc851cf commit 1d0d4ff
Show file tree
Hide file tree
Showing 56 changed files with 230 additions and 218 deletions.
4 changes: 2 additions & 2 deletions src/AnalogClockWdgt.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# AnalogClockWdgt //////////////////////////////////////////////////////

# this comment below is needed to figure out dependencies between classes
# REQUIRES Morph
# REQUIRES Widget

class AnalogClockWdgt extends Morph
class AnalogClockWdgt extends Widget

hoursHandAngle: 0
minutesHandAngle: 0
Expand Down
4 changes: 2 additions & 2 deletions src/BackBufferMixin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# 1) as a cache
# 2) because the morph has inherently a "raster" nature
# such as the canvas where you can run a turtle to
# draw stuff, or a Morph where you want to have
# draw stuff, or a Widget where you want to have
# pixel-based filters.
#
# The cache use is useful for morphs that ideally
Expand Down Expand Up @@ -83,7 +83,7 @@ BackBufferMixin =
return data.a is 0
false

# Morph pixel access:
# Widget pixel access:
getPixelColor: (aPoint) ->
[@backBuffer, @backBufferContext] = @createRefreshOrGetBackBuffer()
point = aPoint.toLocalCoordinatesOf @
Expand Down
2 changes: 1 addition & 1 deletion src/BlinkerMorph.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# can be used for text caret

class BlinkerMorph extends Morph
class BlinkerMorph extends Widget

constructor: (@fps = 2) ->
world.addSteppingMorph @
Expand Down
2 changes: 1 addition & 1 deletion src/BouncerWdgt.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# bounces within the parent. Veeery similar to the good old
# AtomMorph from Squeak
class BouncerWdgt extends Morph
class BouncerWdgt extends Widget

velocity: nil

Expand Down
4 changes: 2 additions & 2 deletions src/BoxMorph.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# I can have an optionally rounded border

class BoxMorph extends Morph
class BoxMorph extends Widget

cornerRadius: nil

Expand Down Expand Up @@ -63,7 +63,7 @@ class BoxMorph extends Morph
choicesExcludingParent.push each

if choicesExcludingParent.length > 0
menu = new MenuMorph @, false, @, true, true, "choose Morph to put as inset:"
menu = new MenuMorph @, false, @, true, true, "choose Widget to put as inset:"
choicesExcludingParent.forEach (each) =>
menu.addMenuItem each.toString().slice(0, 50), true, each, "choiceOfMorphToBePicked"
else
Expand Down
2 changes: 1 addition & 1 deletion src/CircleBoxMorph.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# I can be used for sliders

class CircleBoxMorph extends Morph
class CircleBoxMorph extends Widget


constructor: ->
Expand Down
8 changes: 4 additions & 4 deletions src/Class.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Class


# adds code into the constructor, such that when a
# Morph is created, it registers itself as in instance
# Widget is created, it registers itself as in instance
# on the Class it belongs to AND TO ALL THE SUPERKLASSES
# The way it's added to all the superclasses is via
# the constructor always calling "super", so constructors
Expand All @@ -26,9 +26,9 @@ class Class
# or
# AnalogClockWdgt.instances
# to check whether AnalogClockWdgt was removed from the superclass'
# (i.e. Morph) list:
# (i.e. Widget) list:
# AnalogClockWdgt.__super__.instances.map((elem)=>elem.constructor.name).filter((name)=>name === "AnalogClockWdgt");
# Note that only Morphs have that kind
# Note that only Widgets have that kind
# of tracking and hence the existence check of
# the registerThisInstance function
_addInstancesTracker: (aString) ->
Expand Down Expand Up @@ -223,7 +223,7 @@ class Class
# first line here is equivalent to "super" the one
# passing all the arguments
window.#{@name}.__super__.constructor.apply this, arguments
# register instance (only Morphs have this method)
# register instance (only Widgets have this method)
@registerThisInstance?()
return
"""
Expand Down
10 changes: 5 additions & 5 deletions src/ClippingAtRectangularBoundsMixin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ ClippingAtRectangularBoundsMixin =

# used for example:
# - to determine which morphs you can attach a morph to
# - for a SliderMorph's "set target" so you can change properties of another Morph
# - for a SliderMorph's "set target" so you can change properties of another Widget
# - by the HandleMorph when you attach it to some other morph
# Note that this method has a slightly different
# version in Morph (because it doesn't clip)
# version in Widget (because it doesn't clip)
plausibleTargetAndDestinationMorphs: (theMorph) ->
# find if I intersect theMorph,
# then check my children recursively
# exclude me if I'm a child of theMorph
# (cause it's usually odd to attach a Morph
# (cause it's usually odd to attach a Widget
# to one of its submorphs or for it to
# control the properties of one of its submorphs)
result = []
Expand Down Expand Up @@ -158,7 +158,7 @@ ClippingAtRectangularBoundsMixin =
# that's a nightmare scenegraph
# to *completely* traverse for *any* broken rectangle
# anywhere on the screen.
# The traversal is complete because a) Morphic doesn't
# The traversal is complete because a) Widgetic doesn't
# assume that the rectangle clips its children and
# b) the bounding rectangle (which currently is not
# efficiently calculated anyways) is the whole screen.
Expand All @@ -170,7 +170,7 @@ ClippingAtRectangularBoundsMixin =

# Also note that in theory you could stop recursion on any
# PanelWdgt completely covered by a large opaque morph
# (or on any Morph which fullBounds are completely
# (or on any Widget which fullBounds are completely
# covered, for that matter). You could
# keep for example a list of the top n biggest opaque morphs
# (say, Panels and rectangles)
Expand Down
2 changes: 1 addition & 1 deletion src/CloseIconButtonMorph.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CloseIconButtonMorph extends EmptyButtonMorph
constructor: (@target) ->
# can't set the parent as the target directly because this morph
# might not have a parent yet.
super true, @, 'actOnClick', new Morph()
super true, @, 'actOnClick', new Widget()
@color_hover = new Color 255,0,0
@color_pressed = @color_hover
@appearance = new CloseIconAppearance @
Expand Down
2 changes: 1 addition & 1 deletion src/CollapseIconButtonMorph.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CollapseIconButtonMorph extends EmptyButtonMorph
constructor: (@target) ->
# can't set the parent as the target directly because this morph
# might not have a parent yet.
super true, @, 'actOnClick', new Morph()
super true, @, 'actOnClick', new Widget()
@color_hover = new Color 255,153,0
@color_pressed = @color_hover
@appearance = new CollapseIconAppearance @
Expand Down
4 changes: 2 additions & 2 deletions src/ColorPaletteMorph.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# REQUIRES ControllerMixin
# REQUIRES BackBufferMixin

class ColorPaletteMorph extends Morph
class ColorPaletteMorph extends Widget

@augmentWith ControllerMixin
@augmentWith BackBufferMixin
Expand Down Expand Up @@ -64,7 +64,7 @@ class ColorPaletteMorph extends Morph
@updateTarget()

updateTarget: ->
if @target instanceof Morph and @choice?
if @target instanceof Widget and @choice?
setterMethodString = "set" + @targetSetter.camelize()
if @target[setterMethodString] instanceof Function
@target[setterMethodString] @choice
Expand Down
2 changes: 1 addition & 1 deletion src/ColorPickerMorph.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ColorPickerMorph ///////////////////////////////////////////////////

class ColorPickerMorph extends Morph
class ColorPickerMorph extends Widget

# pattern: all the children should be declared here
# the reason is that when you duplicate a morph
Expand Down
2 changes: 1 addition & 1 deletion src/ControllerMixin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# or SliderMorph) can control a target
# and they have the same function to attach
# targets. Not worth having this in the
# whole Morph hierarchy, so... ideal use
# whole Widget hierarchy, so... ideal use
# of mixins here.

ControllerMixin =
Expand Down
11 changes: 7 additions & 4 deletions src/DeepCopierMixin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DeepCopierMixin =
# should also take care of inserting the copied
# morph in whatever other data structures where the
# original morph was.
# For example, if the Morph appeared in a data
# For example, if the Widget appeared in a data
# structure related to the broken rectangles mechanism,
# we should place the copied morph there.
deepCopy: (doSerialize, objOriginalsClonedAlready, objectClones, allMorphsInStructure)->
Expand All @@ -27,7 +27,7 @@ DeepCopierMixin =
return "$" + haveIBeenCopiedAlready
else
return objectClones[haveIBeenCopiedAlready]
if (@ instanceof Morph) and (@ not in allMorphsInStructure)
if (@ instanceof Widget) and (@ not in allMorphsInStructure)
if doSerialize
return "$EXTERNAL" + @uniqueIDString()
else
Expand Down Expand Up @@ -56,7 +56,10 @@ DeepCopierMixin =
if @[property].rebuildDerivedValue?
cloneOfMe[property] = nil
else
if !@[property].deepCopy? then debugger
if !@[property].deepCopy?
console.dir @
console.log property
debugger
cloneOfMe[property] = @[property].deepCopy doSerialize, objOriginalsClonedAlready, objectClones, allMorphsInStructure
else
if property != "instanceNumericID"
Expand Down Expand Up @@ -135,7 +138,7 @@ DeepCopierMixin =
# since they test positive as typeof "object"
theClone = Object.create(@constructor::)
# add to the instances tracking.
# note that only Morphs have that kind
# note that only Widgets have that kind
# of tracking
theClone.registerThisInstance?()
if addClassNameFieldIfObjectNotArray
Expand Down
4 changes: 2 additions & 2 deletions src/EmptyButtonMorph.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# REQUIRES HighlightableMixin

class EmptyButtonMorph extends Morph
class EmptyButtonMorph extends Widget

@augmentWith HighlightableMixin, @name

Expand All @@ -25,7 +25,7 @@ class EmptyButtonMorph extends Morph
closesUnpinnedMenus: true

# tells if the button represents a morph, in which
# case we are going to highlight the Morph on hover
# case we are going to highlight the Widget on hover
representsAMorph: false


Expand Down
2 changes: 1 addition & 1 deletion src/ErrorsLogViewerMorph.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class ErrorsLogViewerMorph extends DEPRECATEDWindowMorph
# here we are disabling all the broken
# rectangles. The reason is that all the
# submorphs of the inspector are within the
# bounds of the parent Morph. This means that
# bounds of the parent Widget. This means that
# if only the parent morph breaks its rectangle
# then everything is OK.
# Also note that if you attach something else to its
Expand Down
2 changes: 1 addition & 1 deletion src/FridgeMagnetsMorph.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class FridgeMagnetsMorph extends DEPRECATEDWindowMorph
# here we are disabling all the broken
# rectangles. The reason is that all the
# submorphs of the inspector are within the
# bounds of the parent Morph. This means that
# bounds of the parent Widget. This means that
# if only the parent morph breaks its rectangle
# then everything is OK.
# Also note that if you attach something else to its
Expand Down
4 changes: 2 additions & 2 deletions src/GenericObjectIconWdgt.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# REQUIRES ChildrenStainerMixin

class GenericObjectIconWdgt extends Morph
class GenericObjectIconWdgt extends Widget

@augmentWith ChildrenStainerMixin, @name

Expand Down Expand Up @@ -64,7 +64,7 @@ class GenericObjectIconWdgt extends Morph
# here we are disabling all the broken
# rectangles. The reason is that all the
# submorphs of the inspector are within the
# bounds of the parent Morph. This means that
# bounds of the parent Widget. This means that
# if only the parent morph breaks its rectangle
# then everything is OK.
# Also note that if you attach something else to its
Expand Down
4 changes: 2 additions & 2 deletions src/GenericShortcutIconWdgt.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# REQUIRES ChildrenStainerMixin

class GenericShortcutIconWdgt extends Morph
class GenericShortcutIconWdgt extends Widget

@augmentWith ChildrenStainerMixin, @name

Expand Down Expand Up @@ -64,7 +64,7 @@ class GenericShortcutIconWdgt extends Morph
# here we are disabling all the broken
# rectangles. The reason is that all the
# submorphs of the inspector are within the
# bounds of the parent Morph. This means that
# bounds of the parent Widget. This means that
# if only the parent morph breaks its rectangle
# then everything is OK.
# Also note that if you attach something else to its
Expand Down
16 changes: 8 additions & 8 deletions src/HandMorph.coffee
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# HandMorph ///////////////////////////////////////////////////////////

# The mouse cursor. Note that it's not a child of the WorldMorph, this Morph
# The mouse cursor. Note that it's not a child of the WorldMorph, this Widget
# is never added to any other morph. [TODO] Find out why and write explanation.
# Not to be confused with the HandleMorph

class HandMorph extends Morph
class HandMorph extends Widget

world: nil
mouseButton: nil
# used for example to check that
# mouseDown and mouseUp happen on the
# same Morph (otherwise clicks happen for
# same Widget (otherwise clicks happen for
# example when resizing a button via the
# handle)
mouseDownMorph: nil
Expand Down Expand Up @@ -169,7 +169,7 @@ class HandMorph extends Morph
# morph to make the shadow, so
# this is why we add the shadow after
# the morph has been added.
# Note that Morphs can specify the look
# Note that Widgets can specify the look
# (i.e. offset blur and color)
# of their shadow (e.g. Menus have a particular one
# so they all seem to float at a particular height)
Expand Down Expand Up @@ -694,9 +694,9 @@ class HandMorph extends Morph
# droppedSVG(image, name)
# droppedAudio(audio, name)
#
# events to interested Morphs at the mouse pointer
# events to interested Widgets at the mouse pointer
# if none of the above content types can be determined, the file contents
# is dispatched as an ArrayBuffer to interested Morphs:
# is dispatched as an ArrayBuffer to interested Widgets:
#
# ```droppedBinary(anArrayBuffer, name)```

Expand Down Expand Up @@ -803,7 +803,7 @@ class HandMorph extends Morph
destroyTemporaries: ->

# temporaries are just an array of morphs which will be deleted upon
# the next mouse click, or whenever another temporary Morph decides
# the next mouse click, or whenever another temporary Widget decides
# that it needs to remove them. The primary purpose of temporaries is
# to display tools tips of speech bubble help.

Expand Down Expand Up @@ -961,7 +961,7 @@ class HandMorph extends Morph
@nonFloatDraggedMorph.nonFloatDragging?(@nonFloatDragPositionWithinMorphAtStart, pos, deltaDragFromPreviousCall)

#
# original, more cautious code for grabbing Morphs,
# original, more cautious code for grabbing Widgets,
# retained in case of needing to fall back:
#
# if (morph === this.morphToGrab) {
Expand Down
4 changes: 2 additions & 2 deletions src/HandleMorph.coffee
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# HandleMorph ////////////////////////////////////////////////////////
# not to be confused with the HandMorph
# I am a resize / move handle that can be attached to any Morph
# I am a resize / move handle that can be attached to any Widget

# this comment below is needed to figure out dependencies between classes
# REQUIRES globalFunctions

class HandleMorph extends Morph
class HandleMorph extends Widget


target: nil
Expand Down
2 changes: 1 addition & 1 deletion src/IconMorph.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# or
# world.create(new IconMorph("color = 'rgba(226, 0, 75, 1)'\ncontext.beginPath()\ncontext.moveTo 23, 103\ncontext.lineTo 93, 178\ncontext.strokeStyle = color\ncontext.stroke()"))

class IconMorph extends Morph
class IconMorph extends Widget


constructor: (@color = new Color 0,0,0) ->
Expand Down
Loading

0 comments on commit 1d0d4ff

Please sign in to comment.