diff options
Diffstat (limited to 'objectio')
-rw-r--r-- | objectio/Makefile | 1 | ||||
-rw-r--r-- | objectio/calculator.icl | 6 | ||||
-rw-r--r-- | objectio/drawingframe.icl | 50 | ||||
-rw-r--r-- | objectio/hello.icl | 17 | ||||
-rw-r--r-- | objectio/support_button.icl | 7 | ||||
-rw-r--r-- | objectio/support_check.icl | 7 | ||||
-rw-r--r-- | objectio/support_edit.icl | 7 | ||||
-rw-r--r-- | objectio/support_popup.icl | 7 | ||||
-rw-r--r-- | objectio/support_radio.icl | 7 | ||||
-rw-r--r-- | objectio/support_slider.icl | 7 | ||||
-rw-r--r-- | objectio/support_text.icl | 7 |
11 files changed, 94 insertions, 29 deletions
diff --git a/objectio/Makefile b/objectio/Makefile index bf46794..3b0f432 100644 --- a/objectio/Makefile +++ b/objectio/Makefile @@ -26,6 +26,7 @@ run: $(filter $(EXE), $(MAKECMDGOALS)) rebuild: clean all clean: + rm -f $(EXE) rm -rf "Clean System Files" $(EXE) copy: diff --git a/objectio/calculator.icl b/objectio/calculator.icl index 58a384c..f8b05de 100644 --- a/objectio/calculator.icl +++ b/objectio/calculator.icl @@ -1,5 +1,11 @@ module calculator +// ******************************************************************************** +// Clean example program. +// +// This program creates a dialog with a simple calculator +// ******************************************************************************** + import StdEnv, StdIO :: Calculator :== History diff --git a/objectio/drawingframe.icl b/objectio/drawingframe.icl index eaae9ac..00e2862 100644 --- a/objectio/drawingframe.icl +++ b/objectio/drawingframe.icl @@ -5,6 +5,11 @@ module drawingframe // // This program defines a framework in which one can test drawing functions. // The program relies on a function, example, of type *Picture -> *Picture. +// +// Below, multiple functions `example` are given. Most of them are based on +// examples from chapter 5, Drawing, of the ObjectIO tutorial at +// http://clean.cs.ru.nl/download/supported/ObjectIO.1.2/doc/tutorial.pdf. You can +// comment out the function you want to test. // ******************************************************************************** import StdEnv, StdIO @@ -12,7 +17,7 @@ import StdEnv, StdIO Start :: *World -> *World Start world = startIO SDI Void (snd o openWindow Void testwindow) [ProcessClose closeProcess] world -testwindow = Window "Test Drawing" NilLS [ +testwindow = Window "Test Drawing (chapter 5)" NilLS [ WindowViewSize size, WindowClose (noLS closeProcess), WindowLook True (\_ _ . example o (setPenColour Red) o (setPenBack Green)), @@ -24,15 +29,15 @@ where maxdomain = {x=origin.x+size.w,y=origin.y+size.h} // Rainbow -example pict = foldr id pict [fill {corner1={x=x1 * w,y=0},corner2={x=x1 * w + w,y=h}} o (setPenColour (rainbow (toReal x1 / 5.0))) \\ x1 <- [0..160]] -where - w = 5 - h = 100 - rainbow :: a -> Colour | toReal a - rainbow i = let i` = toReal i - f = 0.3 in RGB { r = toInt (sin (f * i` + 0.0) * 127.0) + 128, // http://krazydad.com/tutorials/makecolors.php - g = toInt (sin (f * i` + PI / 1.5) * 127.0) + 128, - b = toInt (sin (f * i` + PI / 0.75) * 127.0) + 128 } +//example pict = foldr id pict [fill {corner1={x=x1 * w,y=0},corner2={x=x1 * w + w,y=h}} o (setPenColour (rainbow (toReal x1 / 5.0))) \\ x1 <- [0..160]] +//where +// w = 5 +// h = 100 +// rainbow :: a -> Colour | toReal a +// rainbow i = let i` = toReal i +// f = 0.3 in RGB { r = toInt (sin (f * i` + 0.0) * 127.0) + 128, // http://krazydad.com/tutorials/makecolors.php +// g = toInt (sin (f * i` + PI / 1.5) * 127.0) + 128, +// b = toInt (sin (f * i` + PI / 0.75) * 127.0) + 128 } // Points //example = drawPointAt zero o (setPenSize 1) @@ -44,9 +49,24 @@ where //example = drawLine zero {x=50,y=50} o (setPenSize 2) //example = drawLine zero {x=50,y=50} o (setPenSize 3) +// Crossbox (chap. 6) +//example = seq (map draw (lines {zero & corner2 = {x=810,y=60}})) +//where +// lines {corner1=a,corner2=b} = [{line_end1=p1,line_end2=p2} \\ (p1,p2) <- [(a,c),(a,d),(a,b),(b,c),(b,d),(c,d)]] +// where +// c = {b & y=a.y} +// d = {a & y=b.y} + // Text //example = draw "p" o (draw "o") o (drawAt zero "P") //@todo Pen is not moved -//example = drawAt {x=50,y=50} "Pop" +//example = drawAt zero "zero" o (drawAt {zero & y=5} "five") o (drawAt {zero & y=10} "ten") +//example = drawAt zero "zero" o (drawAt {zero & y=10} "ten") +//example = drawAt zero "zero" +//example picture +// # ((ok,font),picture) = openFont {fName="FreeMono",fStyles=[],fSize=20} picture +// | not ok = abort "Couldn't open font" +// # picture = setPenFont font picture +// = drawAt zero "zero" picture // Ovals //example = drawAt zero {oval_rx=5, oval_ry=3} @@ -95,6 +115,12 @@ curve = { curve_oval = { oval_rx=5, oval_ry=3 }, // Bitmaps //@todo -// ... +// XOR mode +//@todo + +// Hilite mode +//example = hilite {corner1={x=0,y=2},corner2={x=24,y=(-10)}} o (drawAt zero "Pop") + +// Clipping mode //@todo diff --git a/objectio/hello.icl b/objectio/hello.icl deleted file mode 100644 index 1988c6a..0000000 --- a/objectio/hello.icl +++ /dev/null @@ -1,17 +0,0 @@ -module hello - -import StdEnv, StdIO - -Start :: *World -> *World -Start world = startIO NDI Void initialise [] world -where - initialise pst - # (error,pst) = openDialog Void hello pst - | error <> NoError = closeProcess pst - | otherwise = pst - - hello = Dialog "ObjectIO" controls [WindowClose (noLS closeProcess)] - controls = TextControl "Hello World!" [] :+: - TextControl "Text 2" [] :+: - ButtonControl "Button" [] - diff --git a/objectio/support_button.icl b/objectio/support_button.icl index 04a71ce..64e601b 100644 --- a/objectio/support_button.icl +++ b/objectio/support_button.icl @@ -1,5 +1,12 @@ module support_button +// ******************************************************************************** +// Clean tutorial example program. +// +// This program can be used to test the different ControlAttributes for a +// ButtonControl in a Dialog. +// ******************************************************************************** + import StdEnv, StdIO Start :: *World -> *World diff --git a/objectio/support_check.icl b/objectio/support_check.icl index 89e9fcc..17e4199 100644 --- a/objectio/support_check.icl +++ b/objectio/support_check.icl @@ -1,5 +1,12 @@ module support_check +// ******************************************************************************** +// Clean tutorial example program. +// +// This program can be used to test the different ControlAttributes for a +// CheckControl in a Dialog. +// ******************************************************************************** + import StdEnv, StdIO Start :: *World -> *World diff --git a/objectio/support_edit.icl b/objectio/support_edit.icl index 144e81b..a8ff5d9 100644 --- a/objectio/support_edit.icl +++ b/objectio/support_edit.icl @@ -1,5 +1,12 @@ module support_edit +// ******************************************************************************** +// Clean tutorial example program. +// +// This program can be used to test the different ControlAttributes for a +// EditControl in a Dialog. +// ******************************************************************************** + import StdEnv, StdIO Start :: *World -> *World diff --git a/objectio/support_popup.icl b/objectio/support_popup.icl index d6c1ca6..1a4d596 100644 --- a/objectio/support_popup.icl +++ b/objectio/support_popup.icl @@ -1,5 +1,12 @@ module support_popup +// ******************************************************************************** +// Clean tutorial example program. +// +// This program can be used to test the different ControlAttributes for a +// PopUpControl in a Dialog. +// ******************************************************************************** + import StdEnv, StdIO Start :: *World -> *World diff --git a/objectio/support_radio.icl b/objectio/support_radio.icl index cbc4e8b..dd60858 100644 --- a/objectio/support_radio.icl +++ b/objectio/support_radio.icl @@ -1,5 +1,12 @@ module support_radio +// ******************************************************************************** +// Clean tutorial example program. +// +// This program can be used to test the different ControlAttributes for a +// RadioControl in a Dialog. +// ******************************************************************************** + import StdEnv, StdIO Start :: *World -> *World diff --git a/objectio/support_slider.icl b/objectio/support_slider.icl index fcbed67..f7288f8 100644 --- a/objectio/support_slider.icl +++ b/objectio/support_slider.icl @@ -1,5 +1,12 @@ module support_slider +// ******************************************************************************** +// Clean tutorial example program. +// +// This program can be used to test the different ControlAttributes for a +// SliderControl in a Dialog. +// ******************************************************************************** + import StdEnv, StdIO Start :: *World -> *World diff --git a/objectio/support_text.icl b/objectio/support_text.icl index d5e3d01..21cfc05 100644 --- a/objectio/support_text.icl +++ b/objectio/support_text.icl @@ -1,5 +1,12 @@ module support_text +// ******************************************************************************** +// Clean tutorial example program. +// +// This program can be used to test the different ControlAttributes for a +// TextControl in a Dialog. +// ******************************************************************************** + import StdEnv, StdIO Start :: *World -> *World |