Giter Site home page Giter Site logo

bloc's Introduction

Bloc

License Tests

Bloc is a low-level UI infrastructure & framework for Pharo.

⚠️ This repository contains the code for Bloc that will included in the future in Pharo. It retrofits a part of the development made at https://github.com/feenkcom/bloc. This version will focus on core features and stability. We are currently identifying the core we want for Pharo.

You can join the mailing-list [email protected] from http://sympa.inria.fr.

Installation

Use the following script to install stable Bloc in stable Pharo:

[ Metacello new
	baseline: 'Bloc';
	repository: 'github://pharo-graphics/Bloc:master/src';
	onConflictUseIncoming;
	ignoreImage;
	load ]
		on: MCMergeOrLoadWarning
		do: [ :warning | warning load ]

You can replace master by:

  • dev to work on the development branch
  • v2.0.0-alpha to load a released version

Getting Started

Open a new window (a Bloc space)

aSpace := BlSpace new.
aSpace show.

"Edit the space's properties, like title and size"
aSpace title: 'Bloc basics'.
aSpace extent: 800 @ 600.

Draw an element (a BlElement)

"Create a red rectangle"
rectangle := BlElement new 
	background: Color red; 
	size: 150 @ 150;
	yourself.
	
"Add it to the space"
aSpace root addChild: rectangle.

"Update its properties"
rectangle 
	background: Color lightBlue;
	position: 100 @ 100;
	border: (BlBorder paint: Color blue width: 10).

Nesting elements

"Create a circle using a geometry (a BlElementGeometry subclass)"
circle := BlElement new
	background: Color blue;
	geometry: BlCircleGeometry new;
	size: 80 @ 80;
	yourself.
rectangle addChild: circle.

"Use a transformation to resize and show child element's overflow"
circle transformDo: [ :builder | builder scaleBy: 1.2 ].
rectangle clipChildren: false

Animating

"Animate opacity"
rectangle addAnimation: (BlOpacityAnimation new opacity: 0.5).

"Animate transformations"
fallAnimation := (BlTransformAnimation translate: 0 @ 200) absolute.
rectangle addAnimation: fallAnimation.
climbAnimation := (BlTransformAnimation translate: 0 @ 0) absolute.
rectangle addAnimation: climbAnimation.

"Create sequence of animations"
animationSequence := (BlSequentialAnimation withAll: {fallAnimation . climbAnimation})
	beInfinite;
	yourself.
rectangle addAnimation: animationSequence

Handling Events

"Change color on click"
rectangle addEventHandlerOn: BlClickEvent do: [ :event | event target background: Color lightGray ].

"Animate on hover/blur"
rectangle 
	addEventHandlerOn: BlMouseEnterEvent
	do: [ :event | event target addAnimation: (BlOpacityAnimation new opacity: 0.2)];
	addEventHandlerOn: BlMouseLeaveEvent 
	do: [ :event | event target addAnimation: (BlOpacityAnimation new opacity: 0.8)] 

License and Contributing

This code is licensed under the MIT license.

If you want to contribute to the project, please read our contributing guide.

bloc's People

Contributors

akgrant avatar akgrant43 avatar chapatt avatar chisandrei avatar ducasse avatar enzo-demeulenaere avatar estebanlm avatar fniephaus avatar georgeganea avatar girba avatar glenncavarle avatar hellerve avatar j-brant avatar jecisc avatar juliangrigera avatar jurajkubelka avatar labordep avatar mabdi avatar maenu avatar nyan11 avatar plantec avatar reugalabf avatar rinzwind avatar rvillemeur avatar seandenigris avatar stephaneggermont avatar syrel avatar tesonep avatar theomugnier avatar tinchodias avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bloc's Issues

Rename Bloc-Geometry

The Bloc-Geometry package should be renamed because it is easily confusable with the BlGeometry class. A candidate name is Bloc-GeometricElements.

GPU accelerated canvas black screen

Get black screen with enabled canvas acceleration (Skia OpenGL) and powersafe (OSX).

  • Skia renderer requires smarter check: have to verify not only availability of OpenGL but also actual functionality which may be disabled by power mode and if necessary fall back to software canvas.

(not forget to do so for GTK host too)

Installation — MozTransformationBuilder error

Hi.

After downloading a fresh 6.0VM/Image, the Metacello installation in the README no longer works. I receive the following error during the installation:

This package depends on the following classes:
  MozTransformationBuilder
You must resolve these dependencies before you will be able to load these definitions: 
  MozTransformationBuilder>>#drawSurface:transformed:
  MozTransformationBuilder>>#primDrawSurface:matrix:


Select Proceed to continue, or close this window to cancel the operation.

Error installing stable: 'Name not found: stub'

I've used this snippet from the README to install stable on both Windows 10 and macOS:

Metacello new
   baseline: 'Bloc';
   repository: 'github://pharo-graphics/Bloc:pharo6.1/src';
   load: #core

In both cases I got the same error: Error: Name not found: stub:
error-loading-bloc

I'm using Windows 10 Home version 1803 and macOS High Sierra Version 10.13.6. On both I'm using Pharo 6.1 32bit and 64bit versions respectively.

I'm not sure if this helps. I tried to track down where stub came from. It looks like it is in the required instance variable (a Set) on a MetacelloMCVersionSpecLoader right where it receives the load message. About a 3rd of the way from the top, down the screen shot above. I couldn't track its origin any further from there.

I'm happy to help more if you need it.

[Question] Parent Element in Layout upsets absolutely positioned children?

Hey guys,

I'm experiencing an issue and I don't know if it is an actual problem with the system or instead with my wielding of the tools.

Here's the rub: I started work on trying to draw Copland/OS8 style windows using Bloc. I was able to come up with something that looks right, but uses crappy code and in which everything is absolutely positioned (no layouts).

If you pull down the latest from the repo and run:

space := BlSpace new extent: 254@261; show.

win := CopWindowInner new.
space root addChild: win.

You should see something like:
screen shot 2017-03-21 at 7 26 13 pm

Which is getting pretty close already.

But now I've begun trying to actually get these titlebar elements into a true Bloc layout -- and here's where I'm running into some trouble.

CopWindowButton is a BlElement with several absolutely positioned children. These are very subtle (I copied them directly from an old OS8 screenshot) and precisely placed. They look great in the above example, but if I try to render a CopWindowButton instead in a parent who has a linear layout, the absolute positioned elements inside of the button are not updating themselves appropriately.

To make this clear, here are some examples:

Absolute Positioning (works)

This example:

space := BlSpace new extent:300@300; show.

button := CopWindowButton new.
button
	position: 2@2.

barColor := (Color r: 204 g: 204 b: 204 range: 255).

bar := BlElement new.
bar
	size: 100@18;
	background: barColor;
	position: 100@150.
bar addChild: button.
space root addChild: bar.

Gives you something like:
screen shot 2017-03-21 at 7 33 00 pm

Which is clear and looks right. Zoom in on the image to see that the inner Blocs are lined up correctly.

Layout Positioning (not working right)

This example:

space := BlSpace new extent:300@300; show.

button := CopWindowButton new.
button
	constraintsDo: [ :c | c linear vertical alignCenter ];
	margin: (BlInsets left: 2).

barColor := (Color r: 204 g: 204 b: 204 range: 255).

bar := BlElement new.
bar
	size: 100@18;
	position: 100@100;
	background: barColor;
	layout: (BlLinearLayout horizontal).
bar addChild: button.
space root addChild: bar.

Results in a hazier image:
screen shot 2017-03-21 at 7 37 30 pm

If you zoom in you'll see why: the inner Blocs in the button are not positioned absolutely within the CopWindowButton.

Here is a direct comparison, the first on top and the second on bottom, zoomed:
comparison

Any ideas?

Also, as an aside, is it OK for me to post my questions here on Github as I go, or is that annoying?

Repositioning rotated elements leaves artefacts

If I create a BlElement with a coloured background that I rotate by 4 degrees and add an event handler allowing the dragging of that element over its space, it leaves artefacts, i.e. the area to redraw is not calculated correctly.

[Layouts] BlTextElement text vanishes on parent bloc resize

Again, not sure if I'm screwing something up or if it's a bug, but when I have a BlTextElement that is a child of either a Grid or Frame layout, the text will vanish upon resizing.

To see an example of what I mean, go ahead and clone my tests repository and run CopWindow exampleBasic. Double-click the titlebar to get the halo and then try resizing.

Here are screenshots for reference:
screen shot 2017-04-01 at 3 00 39 pm
screen shot 2017-04-01 at 3 00 52 pm
screen shot 2017-04-01 at 3 01 03 pm

Related question: Is there a way to open up an expansive BlSpace in an OSWindow or something, so that I can experiment as if Bloc is the true graphics system?

Thanks as always.

Let space know its Universe

We can access the BlSpace a visual element is attached to (element space) but we can not get reference to universe from space and have to access it using BlUniverse default which hardcodes reference to a BlUniverse class.

Better would be to use dependency injection or service locator to eliminate direct references all over the code.

`BlInfiniteExample` Gallery Broken

For a while now I've considered BlInfiniteExample exampleGallery to be a wonderful example that demonstrates multiple interesting Bloc capabilities to users who are curious to find out.

In the latest version of Bloc, however, sending the #exampleGallery message throws a bunch of deprecation warnings concerning BlTaskAction I tried to resolve these myself, but then several DNUs popped up as a consequence and the cause is a bit out of my league at the moment.

None of the examples work on OSX, affects both user and developer version

First, let me say that piping commands received from the Internet straight to bash
is horrendous and I'm not sure why this "method" is so prevalent in Pharo-land.
You really need to come up with a better way, there are no excuses for this.

This is my install log:

❯❯ wget -O- --no-check-certificate https://goo.gl/YYHH5a | bash
--2017-03-09 18:28:23-- https://goo.gl/YYHH5a
Loaded CA certificate '/opt/local/share/curl/curl-ca-bundle.crt'
Resolving goo.gl (goo.gl)... 216.58.192.174, 2607:f8b0:400a:809::200e
Connecting to goo.gl (goo.gl)|216.58.192.174|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://raw.githubusercontent.com/pharo-graphics/Bloc/master/scripts/get [following]
--2017-03-09 18:28:24-- https://raw.githubusercontent.com/pharo-graphics/Bloc/master/scripts/get
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.36.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.36.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 160 [text/plain]
Saving to: ‘STDOUT’

  •                                           100%[=======================================================================================================>]     160  --.-KB/s    in 0s      
    

2017-03-09 18:28:25 (153 MB/s) - written to stdout [160/160]

--2017-03-09 18:28:25-- http://get.pharo.org/60+vm
Resolving get.pharo.org (get.pharo.org)... 128.93.162.72
Connecting to get.pharo.org (get.pharo.org)|128.93.162.72|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2901 (2.8K) [text/html]
Saving to: ‘STDOUT’

  •                                           100%[=======================================================================================================>]   2.83K  --.-KB/s    in 0s      
    

2017-03-09 18:28:26 (231 MB/s) - written to stdout [2901/2901]

Downloading the latest 60 Image:
http://files.pharo.org/get-files/60/pharo.zip
Pharo.image
Downloading the latest pharoVM:
http://files.pharo.org/get-files/60/pharo-mac-stable.zip
pharo-vm/Pharo.app/Contents/MacOS/Pharo
Downloading PharoV60.sources:
http://files.pharo.org/get-files/60/sources.zip
Creating starter scripts pharo and pharo-ui

Fetched -> BaselineOfBloc-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- github://pharo-graphics/Bloc:master/src
Loaded -> BaselineOfBloc-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- github://pharo-graphics/Bloc:master/src
Loading baseline of BaselineOfBloc...
Fetched -> ConfigurationOfOSWindow-RonieSalgado.37 --- http://smalltalkhub.com/mc/Pharo/OSWindow/main/ --- http://smalltalkhub.com/mc/Pharo/OSWindow/main/
Loaded -> ConfigurationOfOSWindow-RonieSalgado.37 --- http://smalltalkhub.com/mc/Pharo/OSWindow/main/ --- http://smalltalkhub.com/mc/Pharo/OSWindow/main/
Fetched -> BaselineOfSparta-cypress.1 --- github://syrel/sparta:master/src [b0c1e43:master] --- github://syrel/sparta:master/src
Loaded -> BaselineOfSparta-cypress.1 --- github://syrel/sparta:master/src [b0c1e43:master] --- github://syrel/sparta:master/src
Project: Sparta baseline
Project: UnifiedFFI 0.25.1
Project: OSWindow 1.2.16
Project: Athens 3.9.3
Fetched -> Bloc-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- github://pharo-graphics/Bloc:master/src
Fetched -> Bloc-Layout-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- github://pharo-graphics/Bloc:master/src
Fetched -> Bloc-Infinite-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- github://pharo-graphics/Bloc:master/src
Fetched -> Bloc-Infinite-Layouts-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- github://pharo-graphics/Bloc:master/src
Fetched -> Bloc-Infinite-Examples-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- github://pharo-graphics/Bloc:master/src
Fetched -> Bloc-Animation-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- github://pharo-graphics/Bloc:master/src
Fetched -> Bloc-Text-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- github://pharo-graphics/Bloc:master/src
Fetched -> Bloc-Sparta-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- github://pharo-graphics/Bloc:master/src
Fetched -> Bloc-Extension-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- github://pharo-graphics/Bloc:master/src
Fetched -> Bloc-DevTool-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- github://pharo-graphics/Bloc:master/src
Fetched -> Bloc-Examples-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- github://pharo-graphics/Bloc:master/src
Fetched -> BlocHost-SDL-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- github://pharo-graphics/Bloc:master/src
Fetched -> BlocHost-Morphic-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- github://pharo-graphics/Bloc:master/src
Evaluated -> baseline [BaselineOfBloc] >> preLoadActions:
Fetched -> BaselineOfSparta-cypress.1 --- github://syrel/sparta:master/src [b0c1e43:master] --- github://syrel/sparta:master/src
Loaded -> BaselineOfSparta-cypress.1 --- github://syrel/sparta:master/src [b0c1e43:master] --- github://syrel/sparta:master/src
Loading baseline of BaselineOfSparta...
Fetched -> Sparta-Core-cypress.1 --- github://syrel/sparta:master/src [b0c1e43:master] --- github://syrel/sparta:master/src
Fetched -> Sparta-Moz2D-cypress.1 --- github://syrel/sparta:master/src [b0c1e43:master] --- github://syrel/sparta:master/src
Fetched -> Sparta-Cairo-cypress.1 --- github://syrel/sparta:master/src [b0c1e43:master] --- github://syrel/sparta:master/src
Evaluated -> baseline [BaselineOfSparta] >> preLoadActions:
SpTextSegment>>initialize (origin is Undeclared)

Loaded -> Sparta-Core-cypress.1 --- github://syrel/sparta:master/src [b0c1e43:master] --- cache
MozTextMetricsProvider>>longestSubstring (longestSubstring is Undeclared)

MozTextMetricsProvider>>longestSubstring (start is Undeclared)

Loaded -> Sparta-Moz2D-cypress.1 --- github://syrel/sparta:master/src [b0c1e43:master] --- cache
Loaded -> Sparta-Cairo-cypress.1 --- github://syrel/sparta:master/src [b0c1e43:master] --- cache
Downloading https://dl.bintray.com/syrel/Moz2D/osx/development/i386/libMoz2D.dylib to File @ /Users/johnny/bloc/MozPlugin_tmp ...

Installing library to File @ /Users/johnny/bloc/pharo-vm/Pharo.app/Contents/MacOS/Plugins/libMoz2D.dylib
Launching Moz2D services...
Sparta-Moz2D succesfully installed!

Evaluated -> baseline [BaselineOfSparta] >> postLoadSparta:
...finished baseline
Evaluated -> Sparta >> postLoadSparta:
BlAnimatedCursor>>createAnimation (BlAnimation is Undeclared)

Loaded -> Bloc-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- cache
Loaded -> Bloc-Layout-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- cache
BlInfiniteScrollFlinger>>defaultInterpolator (BlQuinticInterpolator is Undeclared)

BlInfiniteLinearSmoothScroller>>defaultDecelerateInterpolator (BlDecelerateInterpolator is Undeclared)

BlInfiniteLinearSmoothScroller>>defaultLinearInterpolator (BlLinearInterpolator is Undeclared)

BlOverScroller>>defaultInterpolator (BlViscousFluidInterpolator is Undeclared)

Loaded -> Bloc-Infinite-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- cache
Loaded -> Bloc-Infinite-Layouts-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- cache
BlInfiniteExampleClassElementHolder>>initialize (BlTextElement is Undeclared)

BlInfiniteExampleTextElementHolder>>text: (BlTextElement is Undeclared)

BlInfiniteExampleGalleryImageElement>>initialize (BlTextElement is Undeclared)

BlInfiniteLinearLayoutExamples class>>exampleClasses (BlBenchmarkConsole is Undeclared)

BlInfiniteLinearLayoutExamples class>>exampleGallery (BlTextElement is Undeclared)

BlInfiniteLinearLayoutExamples class>>exampleText (BlElementSelection is Undeclared)

BlInfiniteLinearLayoutExamples class>>exampleText (BlBenchmarkConsole is Undeclared)

Loaded -> Bloc-Infinite-Examples-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- cache
Loaded -> Bloc-Animation-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- cache
BlTextElement class>>example (BlElementSelection is Undeclared)

BlTextElement class>>exampleText (BrRopedText is Undeclared)

BlTextElement class>>exampleText (BrCollectionRope is Undeclared)

BlTextElement class>>exampleText (BlElementSelection is Undeclared)

BlTextElement>>defaultText (BrRopedText is Undeclared)

BlTextElement>>defaultText (BrCollectionRope is Undeclared)

BrMultilineTextParagraph>>initializeSpan:on:with: (rope is Undeclared)

BrMultilineTextParagraph>>measureOn: (rope is Undeclared)

BrMultilineTextParagraph>>measureOn: (rope is Undeclared)

BrMultilineTextParagraph>>measureOn: (rope is Undeclared)

Loaded -> Bloc-Text-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- cache
Loaded -> Bloc-Sparta-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- cache
Loaded -> Bloc-Extension-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- cache
BlIconImporter class>>importIn:fromDir: (XMLDOMParser is Undeclared)

Loaded -> Bloc-DevTool-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- cache
Loaded -> Bloc-Examples-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- cache
BlSDLSpartaRenderer>>createSDLSurfaceWithExtent: (ExternalForm is Undeclared)

BlSDLSpartaRenderer>>updateRectangle: (ExternalForm is Undeclared)

BlSDLSpartaRenderer>>updateRectangles: (ExternalForm is Undeclared)

Loaded -> BlocHost-SDL-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- cache
*** Warning: Warning: This package depends on the following classes:
ExternalForm
You must resolve these dependencies before you will be able to load these definitions:
BlMorphicExternalForm
BlMorphicExternalForm>>#autoRelease
BlMorphicExternalForm>>#finalize
BlMorphicExternalForm>>#initialize

BlMorphicSpartaRenderer>>resetResources (BlMorphicExternalForm is Undeclared)

Loaded -> BlocHost-Morphic-cypress.1 --- github://pharo-graphics/Bloc:master/src [c3fd607:master] --- cache
Evaluated -> baseline [BaselineOfBloc] >> postLoadBloc:
...finished baselinelinear load :
explicit load : baseline [BaselineOfBloc]
load : ConfigurationOfOSWindow-RonieSalgado.37
explicit load : baseline [BaselineOfBloc]
load : BaselineOfSparta-cypress.1
preload : baseline [BaselineOfBloc] >> preLoadActions:
linear load : baseline [BaselineOfBloc]
postload : Sparta >> postLoadSparta:
linear load : 1.2.16 [ConfigurationOfOSWindow]
load : Bloc-cypress.1
load : Bloc-Layout-cypress.1
load : Bloc-Infinite-cypress.1
load : Bloc-Infinite-Layouts-cypress.1
load : Bloc-Infinite-Examples-cypress.1
load : Bloc-Animation-cypress.1
load : Bloc-Text-cypress.1
load : Bloc-Sparta-cypress.1
load : Bloc-Extension-cypress.1
load : Bloc-DevTool-cypress.1
load : Bloc-Examples-cypress.1
load : BlocHost-SDL-cypress.1
load : BlocHost-Morphic-cypress.1
postload : baseline [BaselineOfBloc] >> postLoadBloc:

After install, I am running Pharo:

Balthazar{☿}johnny: ~/bloc
❯❯ ./pharo-ui Pharo.image

Here, I am trying one of the Bloc examples:

#extent:depth: was sent to nil
UndefinedObject(Object)>>doesNotUnderstand: #extent:depth:
BlMorphicSpartaRenderer>>resetResources
BlMorphicSpartaRenderer class>>for:
BlMorphicSpace>>withSpartaRenderer
BlMorphicHost>>createHostSpaceFor:
BlUniverse>>showSpaceWindow:
BlSpace(BlAbstractSpace)>>show
BlBasicExamples class>>exampleGeometry
NautilusUI class(AbstractNautilusUI class)>>runExampleMethod:
[ target perform: actionSelector withArguments: arguments ] in IconicButton(SimpleButtonMorph)>>doButtonAction in Block: [ target perform: actionSelector withArguments: ar...etc...
BlockClosure>>ensure:
CursorWithMask(Cursor)>>showWhile:
IconicButton(SimpleButtonMorph)>>doButtonAction
IconicButton(SimpleButtonMorph)>>mouseUp:
IconicButton(Morph)>>handleMouseUp:
MouseButtonEvent>>sentTo:
IconicButton(Morph)>>handleEvent:
IconicButton(Morph)>>handleFocusEvent:
[ ActiveHand := self.
ActiveEvent := anEvent.
result := focusHolder
handleFocusEvent: (anEvent transformedBy: (focusHolder transformedFrom: self)) ] in HandMorph>>sendFocusEvent:to:clear: in Block: [ ActiveHand := self....
BlockClosure>>on:do:
WorldMorph(PasteUpMorph)>>becomeActiveDuring:
HandMorph>>sendFocusEvent:to:clear:
HandMorph>>sendEvent:focus:clear:
HandMorph>>sendMouseEvent:
HandMorph>>handleEvent:
HandMorph>>processEventsFromQueue:
HandMorph>>processEvents
[ :h |
self activeHand: h.
h processEvents.
self activeHand: nil ] in WorldState>>doOneCycleNowFor: in Block: [ :h | ...
Array(SequenceableCollection)>>do:
WorldState>>handsDo:
#extent:depth: was sent to nil
UndefinedObject(Object)>>doesNotUnderstand: #extent:depth:
Message>>sentTo:
UndefinedObject(Object)>>doesNotUnderstand: #extent:depth:
BlMorphicSpartaRenderer>>resetResources
BlMorphicSpartaRenderer class>>for:
BlMorphicSpace>>withSpartaRenderer
BlMorphicHost>>createHostSpaceFor:
BlUniverse>>showSpaceWindow:
BlSpace(BlAbstractSpace)>>show
BlBasicExamples class>>exampleGeometry
NautilusUI class(AbstractNautilusUI class)>>runExampleMethod:
[ target perform: actionSelector withArguments: arguments ] in IconicButton(SimpleButtonMorph)>>doButtonAction in Block: [ target perform: actionSelector withArguments: ar...etc...
BlockClosure>>ensure:
CursorWithMask(Cursor)>>showWhile:
IconicButton(SimpleButtonMorph)>>doButtonAction
IconicButton(SimpleButtonMorph)>>mouseUp:
IconicButton(Morph)>>handleMouseUp:
MouseButtonEvent>>sentTo:
IconicButton(Morph)>>handleEvent:
IconicButton(Morph)>>handleFocusEvent:
[ ActiveHand := self.
ActiveEvent := anEvent.
result := focusHolder
handleFocusEvent: (anEvent transformedBy: (focusHolder transformedFrom: self)) ] in HandMorph>>sendFocusEvent:to:clear: in Block: [ ActiveHand := self....
BlockClosure>>on:do:
WorldMorph(PasteUpMorph)>>becomeActiveDuring:
HandMorph>>sendFocusEvent:to:clear:
HandMorph>>sendEvent:focus:clear:
HandMorph>>sendMouseEvent:
HandMorph>>handleEvent:
HandMorph>>processEventsFromQueue:
HandMorph>>processEvents
[ :h |
self activeHand: h.
h processEvents.
self activeHand: nil ] in WorldState>>doOneCycleNowFor: in Block: [ :h | ...
AssertionFailure: Universe must not be running!
BlUniverse(Object)>>assert:description:
BlUniverse>>preferableHost:
BlSettings class>>preferableHostClass:
PickOneSettingDeclaration(SettingDeclaration)>>realValue:
PickOneSettingDeclaration>>index:
DropListMorph>>listSelectionIndex:
PluggableListMorph>>changeModelSelection:
DropListMorph>>listMouseDown:
MorphEventSubscription>>notify:from:
[ :s | result := result | ((s notify: anEvent from: sourceMorph) == true) ] in MorphicEventHandler>>notifyMorphsOfEvent:ofType:from: in Block: [ :s | result := result | ((s notify: anEvent from...etc...
Set>>do:
MorphicEventHandler>>notifyMorphsOfEvent:ofType:from:
MorphicEventHandler>>mouseDown:fromMorph:
PluggableListMorph(ScrollPane)>>mouseDown:
PluggableListMorph>>mouseDown:
PluggableListMorph(Morph)>>handleMouseDown:
MouseButtonEvent>>sentTo:
PluggableListMorph(Morph)>>handleEvent:
MorphicEventDispatcher>>dispatchMouseDown:with:
MorphicEventDispatcher>>handleMouseDown:
MouseButtonEvent>>sentTo:
[ ^ anEvent sentTo: self ] in MorphicEventDispatcher>>dispatchEvent:with: in Block: [ ^ anEvent sentTo: self ]
BlockClosure>>ensure:
MorphicEventDispatcher>>dispatchEvent:with:
PluggableListMorph(Morph)>>processEvent:using:
PluggableListMorph(Morph)>>processEvent:
PluggableListMorph>>handleFocusEvent:
[ ActiveHand := self.
ActiveEvent := anEvent.
result := focusHolder
handleFocusEvent: (anEvent transformedBy: (focusHolder transformedFrom: self)) ] in HandMorph>>sendFocusEvent:to:clear: in Block: [ ActiveHand := self....
BlockClosure>>on:do:
WorldMorph(PasteUpMorph)>>becomeActiveDuring:

I notice there is a Bloc OSWindow setting, so I set it to SDL2 save&quit.
Re-executing Pharo and running same Bloc example:

Balthazar{☿}johnny: ~/bloc
❯❯ ./pharo-ui Pharo.image
#extent:depth:bits: was sent to nil
UndefinedObject(Object)>>doesNotUnderstand: #extent:depth:bits:
BlSDLSpartaRenderer>>createSDLSurfaceWithExtent:
BlSDLSpartaRenderer>>resetResources
BlSDLSpartaRenderer class>>for:
BlSDLSpace>>withSpartaRendereer
BlSDLHost>>createHostSpaceFor:
BlUniverse>>showSpaceWindow:
BlSpace(BlAbstractSpace)>>show
BlBasicExamples class>>exampleGeometry
NautilusUI class(AbstractNautilusUI class)>>runExampleMethod:
[ target perform: actionSelector withArguments: arguments ] in IconicButton(SimpleButtonMorph)>>doButtonAction in Block: [ target perform: actionSelector withArguments: ar...etc...
BlockClosure>>ensure:
CursorWithMask(Cursor)>>showWhile:
IconicButton(SimpleButtonMorph)>>doButtonAction
IconicButton(SimpleButtonMorph)>>mouseUp:
IconicButton(Morph)>>handleMouseUp:
MouseButtonEvent>>sentTo:
IconicButton(Morph)>>handleEvent:
IconicButton(Morph)>>handleFocusEvent:
[ ActiveHand := self.
ActiveEvent := anEvent.
result := focusHolder
handleFocusEvent: (anEvent transformedBy: (focusHolder transformedFrom: self)) ] in HandMorph>>sendFocusEvent:to:clear: in Block: [ ActiveHand := self....
BlockClosure>>on:do:
WorldMorph(PasteUpMorph)>>becomeActiveDuring:
HandMorph>>sendFocusEvent:to:clear:
HandMorph>>sendEvent:focus:clear:
HandMorph>>sendMouseEvent:
HandMorph>>handleEvent:
HandMorph>>processEventsFromQueue:
HandMorph>>processEvents
[ :h |
self activeHand: h.
h processEvents.
self activeHand: nil ] in WorldState>>doOneCycleNowFor: in Block: [ :h | ...
Array(SequenceableCollection)>>do:

Layout - Cassowary?

I've been doing a lot of iOS development for awhile and Apple's "AutoLayout" turns out to be a port of the Cassowary constraints based layout model. There is a version for Morphic that can be found at:

http://map.squeak.org/package/b2433b1a-2c28-432e-a091-1203eb92183c

For iOS development I've been using the library PureLayout and find it both intuitive and effective. I don't yet understand Bloc's layout model, but I have become comfortable with Cassowary constraints based layout via "AutoLayout" and enjoy using it.

I would be interested in your thoughts on this topic.

[email protected]

Error on Pharo 60483

I tried bloc on Morphic in an 60483. But trying the animation examples run into some troubles.
screenshot 2017-05-09 08 55 15

Looks like that startTime is nil.

BlSequentialAnimation>>pulse

	"Time did not come for me to run because of delta, just request next step and quit"
	Time millisecondClockValue < (startTime + delay)
		ifTrue: [ ^ self requestNextStep ].
        "..."

Here is trace:
Author: AlexandreBergel

UndefinedObject(Object)>>doesNotUnderstand: #+
BlSequentialAnimation(BlBaseAnimation)>>pulse
[ :anAnimation | anAnimation pulse ] in BlAnimationManager>>pulse
Array(SequenceableCollection)>>do:
BlAnimationManager>>pulse
[ self pulseRequested
ifTrue: [ nextPulseRequested := false.
announcer
announce: (aPulseEvent timestamp: Time millisecondClockValue).
self animationManager pulse.
self spaceManager pulse ].
self tryToRunDeferredActions ] in BlUniverse>>firePulse:
BlockClosure>>on:do:
BlUniverse>>firePulse:
BlPulseLoop>>firePulse
[ self firePulse ] in [ [ self firePulse ] repeat ] in BlPulseLoop>>createLoopTask
BlockClosure>>repeat
[ [ self firePulse ] repeat ] in BlPulseLoop>>createLoopTask
[ self value.
Processor terminateActive ] in BlockClosure>>newProcess

BlSpace windows remove other dragged windows on "drop/release"

If I have an open BlSpace window and I drag another window (like a Playground) on top of it to make space, the Playground window will vanish. This happens with any Morphic display objects.

Note that the pointer must be over both the held window and the space window when released in order for this to happen.

Use BasicLayout by default

The dependency from BlElement to BlFrameLayout creates an unwanted package dependency. To address it, the default layout should be BlBasicLayout.

BlElement copying semantics

I would expect #copy to be overridden to not copy the parent.

parent := BlElement new.
one := BlElement new
	background: Color random;
	size: 40@40;
	yourself.
parent addChild:one.
two := one copy.
parent addChild: two

BlElement >> opaque: comment

should mention something about event (does an fully not opaque element handle elements? and what is the relationship with visbility.

Scaling gradients

If I define a BlRadialGradientPaint it has a center and a radius. It does not adapt itself to the constraints of its BlElement. That is sometimes useful. My slide theme uses one scaled so that the corners are slightly darker. The slides BlElement scales, but the gradient doesn't

Linear Gradient Backgrounds from RGB Colors Broken

There is currently a bug with BlLinearGradientPaint whereby any stop color generated from Color fromRgbTriplet: will break the whole gradient.

Here is a working example you can test in a playground:

| space el startColor endColor gradient|
space := BlSpace new.
space
	extent: 100@100;
	show.

"Set up the Gradient"
startColor := Color white.
endColor := (Color fromRgbTriplet: #(1 1 1)).
gradient := BlLinearGradientPaint new.
gradient
	start: 0@0;
	end: 50@50;
	stops: { 0.0 -> startColor. 1.0 -> endColor }.


"Create the inner element (with gradient background)"
el := BlElement new.
el
	size: 50@50;
	position: 25@25;
	background: gradient;
	border: (BlBorder paint: (Color black) width: 1).
	
"Add to space"
space root addChild: el.

If you see what I see, the example above will simply have a plain white background and no gradient at all.

Note that if you switch endColor to be Color black it will work just fine, as it will with any declared color from the Color class, like Color gray lighter lighter etc.

continueOn: is not a method name that indicates that it should return a boolean

It should be renamed
shouldContinue:
since it is used as follows:

continue
	"Let scrolling decide whether animation should continue even though we reached our
	destination or animation duration is over. #continue allows scroller to support
	spring back or fling animations and nicely handle overshot. If false is returned,
	animation is treated as finished.
	Returns true if animation should continue, false otherwise"
	<return: #Boolean>
	| shouldContinue |
	
	shouldContinue := self mode continueOn: self.
	shouldContinue
		"perform an update if we continue, because it is skipped during #run step"
		ifTrue: [ self update ].

	^ shouldContinue

continue should also be renamed shouldContinue

[Question] Use of `BlSpace`

Preface: I would like to help out with commenting, documentation, and experimentation when it comes to Bloc and -- if possible -- Brick.

For now I'm trying to get a sense of how everything fits together.

This brings me to a question about BlSpace. Is it correct that all BlElements must be inside of a BlSpace in order to be displayed? Currently BlSpace will open a new SystemWindow in order to accomplish this -- is this because BlSpace is designed to eventually replace the Morphic World and therefore we temporarily need something to display BlElements inside of?

Shorter version: Is it possible to display a BlElement outside of a window at this time?

BlTextElement broken (test too)

Currently BlTextElement doesn't work at all, and neither does the example class message (though, curiously, the exampleText class message works fine).

I currently cannot get text to display at all in any BlElement or BlSpace.

The error is consistent (here is a report from the stack trace after running BlTextElement example).

The top of the stack trace always has:

SpText(Object)>>doesNotUnderstand: #lockDuring:

Forbid adding an element to another parent without explicit removal

Trying to add an element to the parent that is already added to another or the same element indicates that there is a logic bug in a program. We should signal this as soon as possible to developer. In long run it will reduce amount of bugs.

addChild: anElement
   anElement parent ifNotNil: [ :p | p removeChild: anElement ].   "remove"
   self
      assert: [ anElement parent isNil ]
      description: [ 'Can only add element without parent' ]. "add"

Dragging from one BlSpace to another

When doing drag-and-drop between bloc widgets, I might want to do that in a Morphic world. That means I need to create a drag and drop space and start dragging that. I would be interested in how to do that elegantly. There doesn't seem to be an example for that yet

Fails to install on Pharo 8.0, Linux 64-bit

During installation it first warns of a missing Key package, and later BaselineOfBloc fails on a missing TKTProfile.

I created my 64-bit Pharo 8.0 image with PharoLauncher.

I get the same issue with Pharo 9.0.

With Pharo 7.0 I get failures with SkiaCanvas not supporting the methods on every example I tried.

crash on exampleGeometry

Hi I tried to execute the exampleGeometry example, on both the all-in-one developer
wget -O- --no-check-certificate https://goo.gl/HQAPI5 | bash
and the vm/image artefact from jenkins. It crashes as son as I execute teh exampl
crash.txt

e
on:
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=18
DISTRIB_CODENAME=sarah
DISTRIB_DESCRIPTION="Linux Mint 18 Sarah"
Linux phobos 4.4.0-36-generic #55-Ubuntu SMP Thu Aug 11 18:00:59 UTC 2016 i686 athlon i686 GNU/Linux

Focus management improvement

We need to

  • rename focused => isFocused (will preserve current behaviour)
  • add hasFocus to return true if element or one if its children is focused
  • add focusedChild property to know which direct child is focused to allow hierarchy navigation

It is not possible to give focus to an element before adding it to the space so that once added it will be focused. Right now order matters which is not good.

requestFocus
	"Space is nil"
	self space requestFocusFor: self

Problem when combining rotate and scale animations

Here is how to reproduce the problem.

space := BlSpace new extent: 600@600.
rectangle := (BlRectangle new extent: 300@300) asElement.
rectangle background: Color blue.
rectangle border: BlBorder empty.
rectangle relocate: 150@150.
rectangle transform
       origin: BlAffineTransformationCenterOrigin new;
       scaleBy: [email protected];
       rotateBy: -70;
       apply.
animation := BlTransformAnimation new.
animation target: rectangle.
animation transformDo: [ :aBuilder | aBuilder
       origin: BlAffineTransformationCenterOrigin new;
       scaleBy: 1@1;
       rotateBy: 0].
animation duration: 3 seconds.
animation absolute.
point := (BlEllipse diameter: 20) asElement.
point background: Color red.
point border: BlBorder empty.
point relocate: 290@290.
space root addChildren: { rectangle. point }.
space show.
rectangle addAnimation: animation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.