Skip to content

Commit

Permalink
Merge pull request #75 from hpi-swa-teaching/master
Browse files Browse the repository at this point in the history
PowerSqueak Version 0.5
  • Loading branch information
LeonBein authored Jul 4, 2018
2 parents 39c576c + 1ca182f commit a286213
Show file tree
Hide file tree
Showing 116 changed files with 597 additions and 157 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
forSlide: aPSSlide

^ self new setSlide: aPSSlide
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
defaultSize

^ 80 @ 60
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
handlesMouseDown: evt

^ true
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
highlight

self borderColor: self highlightBorderColor.
self updateImage
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
highlightBorderColor

^ Color r: 247/255 g: 159/255 b: 0


Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
highlightBorderWidth

^ 5


Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
as yet unclassified
initialize

super initialize.
self borderWidth: self highlightBorderWidth.
self borderColor: Color transparent
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
isHighlighted

^ self borderColor = self highlightBorderColor
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
model: aModel

model := aModel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
model

^ model
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
mouseDown: evt

self model selectSlide: self slide
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
setSlide: aPSSlide

self slide: aPSSlide.
self updateImage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
slide: aPSSlide

slide := aPSSlide
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
slide

^ slide
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
unHighlight

self borderColor: Color transparent.
self updateImage
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
updateImage

self newForm: (self slide imageForm scaledToSize: self defaultSize).
self borderWidth: self borderWidth
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"class" : {
"forSlide:" : "LB 6/29/2018 17:11" },
"instance" : {
"defaultSize" : "WoC 6/29/2018 15:29",
"handlesMouseDown:" : "WoC 6/29/2018 15:33",
"highlight" : "LB 7/3/2018 16:57",
"highlightBorderColor" : "LB 6/29/2018 17:48",
"highlightBorderWidth" : "LB 6/29/2018 17:16",
"initialize" : "LB 7/3/2018 16:57",
"isHighlighted" : "LB 6/29/2018 19:05",
"model" : "LB 6/29/2018 15:52",
"model:" : "LB 6/29/2018 15:52",
"mouseDown:" : "LB 7/3/2018 17:00",
"setSlide:" : "WoC 6/29/2018 15:26",
"slide" : "WoC 6/29/2018 15:19",
"slide:" : "LB 6/29/2018 17:00",
"unHighlight" : "LB 7/3/2018 16:56",
"updateImage" : "LB 7/3/2018 17:04" } }
15 changes: 15 additions & 0 deletions packages/Presenter-Core.package/PSMiniature.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"category" : "Presenter-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"slide",
"model" ],
"name" : "PSMiniature",
"pools" : [
],
"super" : "ImageMorph",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
toolbuilder
buildWith: builder

| windowSpec slideViewportSpec buttonBarTopSpec menuBarSpec window |
| windowSpec miniatureViewSpec slideViewportSpec buttonBarTopSpec menuBarSpec window |
windowSpec := self createWindowSpec: builder.


miniatureViewSpec := self createMiniatureViewSpec: builder.
windowSpec children add: miniatureViewSpec.

slideViewportSpec := self createSlideViewportSpec: builder.
windowSpec children add: slideViewportSpec.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
as yet unclassified
checkSlideDirectory: aDirectoryName
presentation loading
checkSlideDirectory: aDirectory

^ aDirectoryName matchesRegex: 'slide[0-9]+'
^ (self checkSlideDirectoryName: aDirectory localName)
and: [aDirectory fileNames allSatisfy: [:each |
each matchesRegex: '[0-9]+.morph']]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
presentation loading
checkSlideDirectoryName: aDirectoryName

^ aDirectoryName matchesRegex: 'slide[0-9]+'
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
toolbuilder
createMiniatureViewSpec: aBuilder
| panelSpec |
panelSpec := aBuilder pluggableScrollPaneSpec new.
panelSpec
model: self;
frame: self miniatureViewLayoutFrame;
name: #MiniatureView;
vScrollBarPolicy: #always;
horizontalResizing: #spaceFill;
layout: #vertical;
wantsResizeHandles: false;
children: #slideMiniatures.
^ panelSpec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ createSlide
newSlide := PSSlide new.
newSlide setModel: self.
self slides add: newSlide afterIndex: self currentSlideNumber.
self selectSlide: self currentSlideNumber + 1.
self selectSlideNumber: self currentSlideNumber + 1.
self updateSlideMiniatures.
self updateCurrentMiniature.
"self updateSlideNumbers."
^ newSlide

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
slide miniatures
currentMiniature

^ self miniatureOf: self currentSlide
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
accessing
currentSlide

(self currentSlideNumber <= self slides size and: [self currentSlideNumber > 0])
(self currentSlideNumber between: 1 and: self slides size)
ifFalse: [ self error: 'No slide available'].
^ self slides at: self currentSlideNumber
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
slide management
deleteAllSlides

[self slideCount > self minimumSlideCount]
whileTrue: [self deleteSlide].
self deleteSlide
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
slide management
deleteSlide: anIndex

| deletedSlide |
self slideCount = self minimumSlideCount
ifTrue: [ self createSlide ]. "There should never be zero slides"

(self slideAt: anIndex) abandon.
self slides removeAt: anIndex.
deletedSlide := self slides removeAt: anIndex.
deletedSlide abandon.
self currentSlideNumber >= anIndex ifTrue:
[self selectSlide: (self currentSlideNumber - 1 max: self minimumSlideCount)].
[self selectSlideNumber: (self currentSlideNumber - 1 max: self minimumSlideCount)].

self miniatures removeKey: deletedSlide ifAbsent: [].
self updateSlideMiniatures
"self updateSlideNumbers "

Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
do not touch
exportAsPNGs: name

(FileDirectory default / 'PSSlidePNGs' / name) assureExistence.
| directory |
directory := FileDirectory default / 'PSSlidePNGs' / name.
directory assureExistence.
self enablePresentationMode.
self slideContainer enableNonInteractiveMode.
self slides withIndexDo: [:each :index |
self selectSlide: index.
self selectSlideNumber: index.
World doOneCycle.
each exportAsPNGNamed: 'PSSlidePNGs\', name, '\slide',index,'.png'].
each exportAsPNGNamed: (directory / ('slide', index, '.png')) fullName].
self disablePresentationMode
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
slide miniatures
highlightCurrentMiniature

self miniatures do: [:each | each unHighlight].
self currentMiniature highlight
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ initialize

self
slides: OrderedCollection new;
miniatures: Dictionary new;
currentSlideNumber: 0;
presentationMode: false
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ isValidPresentationDirectory: aDirectory
^ slidesDirectory exists
and: [slidesDirectory directoryNames isEmpty not]
and: [slidesDirectory directoryNames allSatisfy: [:each |
self checkSlideDirectory: each]]
self checkSlideDirectory: slidesDirectory / each]]
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ loadPresentationUnchecked: aDirectory

| slidesDirectory errorReport sortedDirectories |
errorReport := Dictionary new.
self slides removeAll.
self deleteAllSlides. "will remove all slides up to the minim slide count"
slidesDirectory := aDirectory / self slidesDirectoryName.
sortedDirectories := self sortedSlideSubdirectories: slidesDirectory.
sortedDirectories do: [:each |
errorReport at: each put: (self loadSlideFromDirectory: slidesDirectory / each)].
self selectSlide: 1.
| slide |
slide := self loadSlideFromDirectory: slidesDirectory / each.
slide fullBounds.
self updateCurrentMiniature.
errorReport at: each
put: (slidesDirectory / each) fileNames size - slide submorphs size].
self minimumSlideCount timesRepeat: [self deleteSlide: 1].
self selectSlideNumber: 1.
^ errorReport
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
presentation loading
loadSlideFromDirectory: aDirectory

| slide corruptedMorphs |
corruptedMorphs := 0.
slide := PSSlide new.
slide setModel: self.
aDirectory fileNames do: [:each |
| morph |
morph := self loadMorphFromFile: aDirectory / each.
morph
ifNil: [corruptedMorphs := corruptedMorphs + 1]
ifNotNil: [slide addMorph: morph]].
self slides addLast: slide.
^ corruptedMorphs
| slide sortedMorphFiles |
slide := self createSlide.
sortedMorphFiles := self sortedMorphFiles: aDirectory fileNames.
sortedMorphFiles do: [:each |
(self loadMorphFromFile: aDirectory / each)
ifNotNil: [:morph | slide addMorphBack: morph]].
^ slide
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
slide miniatures
miniatureOf: aPSSlide

^ self miniatures at: aPSSlide ifAbsentPut: [(PSMiniature forSlide: aPSSlide)
model: self;
yourself]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
toolbuilder
miniatureViewLayoutFrame

^ LayoutFrame new
leftFraction: 0 offset: 0;
topFraction: 0 offset: 2 * self buttonHeight;
rightFraction: self miniatureViewWidth offset: 0;
bottomFraction: 1 offset: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
toolbuilder
miniatureViewWidth

^ 0.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
miniatures: aDictionary

miniatures := aDictionary
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
miniatures

^ miniatures
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ morph: aMorph survivesOneCycleIn: aWorld
| debuggersBefore newDebuggers |
debuggersBefore := Debugger allInstances.
aMorph openInWorld: aWorld.
World doOneCycle.
[World doOneCycle]
on: Error
do: [^false].
newDebuggers := Debugger allInstances reject: [:each |
debuggersBefore includes: each].
newDebuggers do: [:each | each abandon].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ moveCurrentSlideTo: aNumber
add: (self slides removeAt: self currentSlideNumber)
afterIndex: position - 1. "position needs to be 0 indexed for add:afterIndex"
"self updateSlideNumbers."
self selectSlide: position
self selectSlideNumber: position.
self updateSlideMiniatures
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
slide management
nextSlide

self selectSlide: self currentSlideNumber + 1
self selectSlideNumber: self currentSlideNumber + 1
Loading

0 comments on commit a286213

Please sign in to comment.