Post by mmiscool on Oct 22, 2010 18:26:05 GMT -5
Hello,
I have built a little online code editor for rb.
It will allow you to edit your projects in a nice editor.
I have not implemented code for creating a new project as I have to look at what needs to be in the xml file in the project folder but for editing existing projects this will work great.
To use you must place the "edit_area" folder in the public directory for the nifty javascript color syntaxing.
The "edit_area" folder is attached as a zip file to this post
Ohh. And a shot out to JosephE for the help with the javascript thing.
I have built a little online code editor for rb.
It will allow you to edit your projects in a nice editor.
I have not implemented code for creating a new project as I have to look at what needs to be in the xml file in the project folder but for editing existing projects this will work great.
To use you must place the "edit_area" folder in the public directory for the nifty javascript color syntaxing.
The "edit_area" folder is attached as a zip file to this post
Ohh. And a shot out to JosephE for the help with the javascript thing.
print "please enter a password"
input password.test$
if password.test$ <> "mmiscool" then wait
[show.code.editor]
gosub [rb.code.editor.menue]
q$=Chr$(34)
EditAreaLink$ = "<script src=";q$;"../../../../../edit_area/edit_area_loader.js";q$;" type=";q$;"text/javascript";q$;"></script>"
head EditAreaLink$ ' Link in the edit area javascript
textarea #code, muoccw.code.for.textaria$ , 210, 50
#code setid("codeEditor")
EditArea$ = "<script language=";q$;"javascript";q$;" type=";q$;"text/javascript";q$;">"
EditArea$ = EditArea$; "editAreaLoader.init({id:";q$;"codeEditor";q$;", syntax:";q$;"libertybasic";q$;", start_highlight: true, toolbar: ";q$;"search, |, fullscreen, |, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help";q$;", language: 'en'}); </script>"
html EditArea$ ' The code that makes the textarea #code turn into a syntax highlighting code-eating machine. ;)
print
wait
[rb.code.editor.menue]
cls
'Button #win, "New ", [new.prod]
Button #win, "Open", [open.prod]
if file.open = 1 then Button #win, "Save", [save.prod]
Button #win, "Save & Run", [run.prod]
html "<hr>"
return
[save.prod]
html "<script>editAreaLoader.delete_instance('codeEditor')</script>"
muoccw.code.for.textaria$ = #code contents$()
open "projects\";prod.name$;"_project\";prod.name$;".bas" for output as #jjjj
print #jjjj, muoccw.code.for.textaria$
close #jjjj
goto [show.code.editor]
[open.prod]
gosub [rb.code.editor.menue]
file.open = 0
dim prod.list$(1000)
x = 0
files #dir, "projects\*"
#dir dateformat("mmm dd, yyyy")
while #dir hasAnswer()
#dir nextFile$()
x = x + 1
if #dir isdir() = 1 then prod.list$(x) = #dir name$()
wend
listbox #lb,prod.list$(),10
print " "
link #sel, "[Accept]",[select.project]
wait
[select.project]
prod.name$ = left$( #lb selection$(), len( #lb selection$()) - 8)
if prod.name$ = "" then print "you must select a project":wait
open "projects\";prod.name$;"_project\";prod.name$;".bas" for input as #jjjj
muoccw.code.for.textaria$ = Input$(#jjjj, LOF(#jjjj))
close #jjjj
file.open = 1
goto [show.code.editor]
[run.prod]
html "<script>editAreaLoader.delete_instance('codeEditor')</script>"
muoccw.code.for.textaria$ = #code contents$()
open "projects\";prod.name$;"_project\";prod.name$;".bas" for output as #jjjj
print #jjjj, muoccw.code.for.textaria$
close #jjjj
gosub [rb.code.editor.menue]
run prod.name$, #top2
render #top2
wait