Script Library: 1238 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Archive version of: rebolide.r ... version: 11 ... crazyaxe 14-Jan-2011

Rebol [ 
Title: "Rebolide" 
File: %rebolide.r 
Author: "Massimiliano Vessi" 
Date: 2010-12-31 
Version: 1.1.9
email: maxint@tiscali.it
Purpose: {A Rebol IDE for beginners that helps learning Rebol} 
Library: [ level: 'intermediate
platform: 'all 
type: [tool demo ide] 
domain: [all] 
tested-under: [view 2.7.7.3.1 Windos Linux ] 
support: maxint@tiscali.it 
license: 'gpl
see-also: none ] 
]

;thanks to Graham, Nick Antonaccio, Semseddin Moldibi, Zoltan Eros
yv1:  to-block { label "Words" return label "Blocks" return label "Functions" return label "Objects"}
; function to find object, function, etc. in source
findall: func [ a_findall /local temp temp2] [
	funzioni: copy []
	oggetti: copy []
	blocchi: copy []
	parole: copy []
	b_findall: parse/all a_findall ":"
	temp2: none
	foreach item b_findall [   
		temp: first (parse item none) ;valore
		if temp2 [
			if temp = "func" [ append funzioni temp2   ]
			if temp = "make" [  append oggetti temp2   ]
			if temp = "[" [  append blocchi temp2   ] 
			if not ( any [ temp = "func"  temp = "make" temp = "[" ]) [ append parole temp2  ]
			]
		temp2: last (parse item none) ;variabile	
		]
	sort funzioni
	sort oggetti
	sort blocchi
	sort parole 
	return (reduce [ "functions"  funzioni "objects" oggetti "blocks" blocchi "words" parole])	
	]





;functio to insert text in the source area
inni: func [testo2 ] [
	set-text/caret a testo2
	]


filep: none ;file path and name

;save as file function
saveas: func [] [
	filen: request-value  "File name?" 
	filed: to-file request-dir
	filep:  to-file rejoin [ filed  filen]
	salva
	]
	
;save file function
salva: func [] [
	if filep = none [ saveas ]
	write filep a/text
	set-text testo reform ["Saved as " filep ]
	]



;to launch soirce or examples
lancia: func [ temp /local corpo ] [	
	corpo: copy temp
	insert corpo "Rebol [] "
	write %temp.r  corpo	
	launch (clean-path %temp.r) ;clean-path is necessary on Linux
	]

;che


if not (exists? %rebgui.r) [ 
	Alert "Rebgui not found, I'll try to download it"
	read-thru/expand/update/to  http://www.dobeash.com/RebGUI/rebgui.r %rebgui.r
	]



do %rebgui.r



display "Rebolide" [


 
menu data [ 
	"File" [
		"Open"  [filep:  to-file request-file
			temp: read filep
			set-text a  temp
			set-text testo reform ["Opened " filep ]
			] 
		"Save (CTRL+D)"  [ 
			salva ;it save the source text
			]  
		"Save as... (CTRL+SHIFT+D)" [ 
			saveas
			write filep a/text
			]  
		]
	"Modify" [ 
		"Try" [lancia a/text  ]
		"Modify colors" [ request-ui]
		]  
	"Help" [ 
		"About" [display "about" aboutpage] 
		"Shortcuts" [display "Shortcuts" shortcuts]
		"Core" [  alert "I'll try to launch your browser, if it doesn't work, please email me: maxint@tiscali.it"
			browse http://www.rebol.com/docs/core23/rebolcore.html 
			if system/version/3 = 4 [ ;it's Linux! 
				browsers: [ "firefox" "mozilla" "konqueror" "opera" "epiphany" "galeon" "seamonkey" "dillo" "midori" "netsurf" "lynx"]
				foreach bro in browsers [
					call (reform [ bro  http://www.rebol.com/docs/core23/rebolcore.html ] )
					]
				temp3: question  "Is your browser showing the docs?"
				if not temp3 [
					display "Sorry" [
						text  "If your browser didn't show the page" 
						return link "http://www.rebol.com/docs/core23/rebolcore.html"
						return text "please write the executable name in the field below"
						return text italic "(It must be in your $PATH)"
						return sorry: field 
						return button -1 "OK" [   
							temp4: read %rebolide.r
							replace temp4 {"firefox"} (reform [{"firefox" "} sorry/text { "} ])
							write %rebolide.r temp4 
							unview
							]
						]
					]	
				]
			]
		"VID" [ 
			if not exists? %nyc.jpg [
				attempt [
					temp: read/binary http://www.rebol.com/view/nyc.jpg
					write/binary %nyc.jpg temp
					]
				]	
			display "VID Guide" guida_vid 
			]
		"VID events" [ display "Vid events guide" guida_handler]	
		"DRAW" [ display "DRAW dialect guide" guida_DRAW]
		"SHAPE" [ display "SHAPE dialect guide"  guida_shape  ] 
		
		]
	] 
button -1 "Try it!" [ lancia a/text]


return

a: area 90x113 on-key [
	if event/key = #"^D" [ salva]   
	if (event/key = #"^D") and event/shift  [ saveas]   
	true]  
tab-panel  data [
	"Core" [
		scroll-panel 80x100 data [
			button -1 "Example" [ inni {Rebol []
print "Hello word!"
wait 10} ] tip "Example"
			return
			group-box "Comparison" data [
				button -1 "<" [ inni "< " ] tip "Returns TRUE if the first value is less than the second value"
				button -1 "<=" [ inni "<= " ] tip "Returns TRUE if the first value is less than or equal to the second value"
				button -1 "<>" [ inni "<> " ] tip "Returns TRUE if the values are not equal"
				button -1 "=" [ inni "= " ] tip "Returns TRUE if the values are equal"
				button -1 "==" [ inni "== " ]  tip "Returns TRUE if the values are equal and of the same datatype"
				return
				button -1 "=?" [ inni "=? " ]  tip "Returns TRUE if the values are identical.(same memory)"
				button -1 ">" [ inni "> " ]  tip "Returns TRUE if the first value is greater than the second value"
				button -1 ">=" [ inni ">= " ]  tip "Returns TRUE if the first value is greater than or equal to the second value"
				]
			return
			group-box "Context" data [
				button -1 "alias" [ inni "alias " ]  tip "Creates an alternate alias for a word"
				button -1 "bind" [ inni "bind /copy " ]  tip "Binds words to a specified context"
				button -1 "context" [ inni "context " ]  tip "Defines a unique (underived) object"
				button -1 "get" [ inni "get /any " ]  tip "Gets the value of a word"
				button -1 "in" [ inni "in " ]  tip "Returns the word in the object's context"
				return
				button -1 "set" [ inni "set /any /pad " ]  tip "Sets a word or block of words to specified value(s)"
				button -1 "unset" [ inni "unset " ]  tip "Unsets the value of a word"
				button -1 "use" [ inni "use " ]  tip "Defines words local to a block"
				button -1 "value?" [ inni "value? " ]