LOGO-L> Re: Selecting Graphics 
Author Message
 LOGO-L> Re: Selecting Graphics

Try adding the routine below to your library.

You can do anything with a pen and mouse.

It does not save and restore the state you started in.
It does not "auto scroll".

Quote:

> Hi,

> Just a thought: Win95 enables to MARK a rectangle area on the screen
> with the mouse, when using BLLogo, and cut & paste it in any other
> software. I use this option a lot, for converting a selected image to
> .gif format.

> The same selection system with the mouse is also in PaintBrush and
> several other graphic packages.

> Can this be accomplished in MSWLogo (instead using guess-work and
> bits-operations)?

> [[Yehuda]]

Those with Win95 or NT must call it MOUSECOPY
Those with Win 3.x must call it MOUSECOP

But to call it all platforms use MOUSECOPY

***************** Start of MOUSECOPY ********************************

to mousecopy.down
; Init P1 and P2 and SelectionBox
make "mousecopy.p1 mousepos
make "mousecopy.p2 mousepos
buryname "mousecopy.p1
buryname "mousecopy.p2
mousecopy.selection
; Activate Mouse Move
mouseon [mousecopy.down] [mousecopy.up] [] [] [mousecopy.move]
end

to mousecopy.move
; Erase Box, Reset P2 and draw Again
mousecopy.selection
make "mousecopy.p2 mousepos
mousecopy.selection
setpos mousepos
end

to mousecopy.selection
; Draw a bounding PX Box
localmake "x1 first :mousecopy.p1
localmake "y1 last  :mousecopy.p1
localmake "x2 first :mousecopy.p2
localmake "y2 last  :mousecopy.p2
pu
setxy :x1 :y1
px
setxy :x2 :y1
setxy :x2 :y2
setxy :x1 :y2
setxy :x1 :y1
pu
end

to mousecopy.up
; Erase Box
mousecopy.selection
; Get Final P2
make "mousecopy.p2 mousepos
localmake "x1 first :mousecopy.p1
localmake "y1 last  :mousecopy.p1
localmake "x2 first :mousecopy.p2
localmake "y2 last  :mousecopy.p2
; Calculate Width, Height and Lower Left Corner
localmake "width abs :x1 - :x2
localmake "height abs :y1 - :y2
localmake "x ifelse :x1 < :x2 [:x1] [:x2]
localmake "y ifelse :y1 < :y2 [:y1] [:y2]
pu
; Copy selection to clipboard
setxy :x :y
setbitindex 0
bitcopy :width :height
; Done
mouseoff
end

to mousecopy
; Will not work while Perspective is on
wrap
mouseon [mousecopy.down] [mousecopy.up] [] [] []
Print [Use mouse to select area to copy to Clipboard]
end

bury "mousecopy
bury "mousecopy.down
bury "mousecopy.move
bury "mousecopy.selection
bury "mousecopy.up

***************** End of MOUSECOPY ********************************

--
===============================================================
George Mills

http://www.*-*-*.com/
The www page contains some very powerful educational software.
Our single most important investment is our kids.
---------------------------------------------------------------





Sat, 04 Mar 2000 03:00:00 GMT  
 LOGO-L> Re: Selecting Graphics

Quote:

> Try adding the routine below to your library.
> You can do anything with a pen and mouse.
> It does not save and restore the state you started in.
> It does not "auto scroll".

...

Quote:
> ***************** Start of MOUSECOPY ********************************

> to mousecopy.down
> ; Init P1 and P2 and SelectionBox
> make "mousecopy.p1 mousepos
> make "mousecopy.p2 mousepos
> buryname "mousecopy.p1
> buryname "mousecopy.p2
> mousecopy.selection
> ; Activate Mouse Move
> mouseon [mousecopy.down] [mousecopy.up] [] [] [mousecopy.move]
> end

> to mousecopy.move
> ; Erase Box, Reset P2 and draw Again
> mousecopy.selection
> make "mousecopy.p2 mousepos
> mousecopy.selection
> setpos mousepos
> end

> to mousecopy.selection
> ; Draw a bounding PX Box
> localmake "x1 first :mousecopy.p1
> localmake "y1 last  :mousecopy.p1
> localmake "x2 first :mousecopy.p2
> localmake "y2 last  :mousecopy.p2
> pu
> setxy :x1 :y1
> px
> setxy :x2 :y1
> setxy :x2 :y2
> setxy :x1 :y2
> setxy :x1 :y1
> pu
> end

> to mousecopy.up
> ; Erase Box
> mousecopy.selection
> ; Get Final P2
> make "mousecopy.p2 mousepos
> localmake "x1 first :mousecopy.p1
> localmake "y1 last  :mousecopy.p1
> localmake "x2 first :mousecopy.p2
> localmake "y2 last  :mousecopy.p2
> ; Calculate Width, Height and Lower Left Corner
> localmake "width abs :x1 - :x2
> localmake "height abs :y1 - :y2
> localmake "x ifelse :x1 < :x2 [:x1] [:x2]
> localmake "y ifelse :y1 < :y2 [:y1] [:y2]
> pu
> ; Copy selection to clipboard
> setxy :x :y
> setbitindex 0
> bitcopy :width :height
> ; Done
> mouseoff
> end

> to mousecopy
> ; Will not work while Perspective is on
> wrap
> mouseon [mousecopy.down] [mousecopy.up] [] [] []
> Print [Use mouse to select area to copy to Clipboard]
> end

> bury [mousecopy mousecopy.down mousecopy.move mousecopy.selection bury "mousecopy.up]

George,

G-R-E-A-T !, it works like a marvel.

[[Yehuda]]

---------------------------------------------------------------





Sun, 05 Mar 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. LOGO-L> Logo - drawing some selected shapes

2. LOGO-L> Logo: Drawing some selected shapes

3. Graphics>>Rectangle>>intersects: erroneous code

4. LOGO-L> Graphics display corrupted using MSWLOGO

5. LOGO-L> Re: resetting graphics in MicroWorlds

6. LOGO-L> MSWLogo - text in graphics area

7. LOGO-L> Re: Graphics rounding

8. LOGO-L> recursive graphics and animation

9. LOGO-L> Re: recursive graphic design

10. LOGO-L> Re: Recursive Graphics

11. LOGO-L> Recursive Graphics

12. LOGO-L> reset graphics

 

 
Powered by phpBB® Forum Software