Murga-Projects Forums

Full Version: [WIP] MurgaLua Reference Tool
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Latest update: 1 April 2008


In the Days Before MurgaLua [last year =o)], I had built a gui tool for Lua-FLTK reference. It was designed to display various types of FLTK widgets along with the script used to create those widgets, so a user (and me) could quickly refer to it whenever the need arose to be reminded of the syntax of a particular type of widget. I found it much more convenient than referring only to the FLTK manual or other completed scripts, since the manual focuses on C++ rather than Lua and full scripts are often too complex to easily find what I was looking for. The act of writing the tool was a learning experience in itself as well.

To the point....I started working on a similar tool for MurgaLua today. It is a murgaLua script itself, so all code will be open.

I was thinking of including a few bits that have been posted by others in this forum, but would like to know if I have the permission to do so. If it's okay, please let me know. Specifically, I think that would be John, Bill, and Marielle (and Robert S., if you happen to read this).

Also, if anyone would like to contribute code, particularly for widgets I find confusing (Fl_Scroll, Fl_Wizard, Fl_Menu_Item come to mind), or other bits of code that could be seen as "handy tricks" or simply are not found in every murgaLua script in existence (i think standard button usage has been covered well enough), they would also be greatly appreciated.

Ideally code would be of the "keep it simple" variety, and well commented, as this is to be used not only as a reference for current programmers but also as a learning tool for beginners. While it currently focuses on FLTK, it might be expanded to non-FLTK parts of murgaLua in the future.

Proper credit will of course be displayed prominently.

Thank you for your time.

murgaLua_demos-beta4.tar.gz
You can definately use anything I post. My work is not 'well commented' because
I don't know what I'm doing well enough to explain it someone else.

I have noticed that everyone posts what appears to be hand scripted GUI's.
I use Fluid for my stuff and rip it through the converter because the widget
syntax is still fairly alien to me. That of course has a drawback in things
that the converter doesn't handle like menus/submenus.

Do you have an outline of what you'll be covering?

Quote:
You can definately use anything I post.

Thank you =o)

Quote:
My work is not 'well commented' because I don't know what I'm doing well enough to explain it someone else.

Notice I said "ideally" =o)

Quote:
Do you have an outline of what you'll be covering?

I hope to at least include one example of each murgaLua-supported item listed in the "Class Reference" and "Function Reference" sections of the FLTK docs. The examples will range in complexity from simply displaying a widget (Fl_Clock) to very basic applications (use a file selector to load/save text). Whether or not they will get much more complex than that is currently undecided. For now the only plan is to show every supported widget.

Quote:
I have noticed that everyone posts what appears to be hand scripted GUI's.

Personally I have very little interest in Fluid. I don't trust WYSIWYG tools to create clean, simple code. I've seen it with HTML editors, such as Dreamweaver and Frontpage, where manual editing the file afterward is a huge pain in the butt, and have heard the same applies with other tools. I also do not care to be made to do things the way a tool tells me it should be done.
The main thing about hand-coding, for me, is that I feel more comfortable in knowing how to write scripts. Maybe it's a bit elitist, but I think a programmer/scripter should know and understand his language as well as he can, not only for the sake of greater general knowledge but for an increased ability to solve problems and fine-tune the program's behavior.

This document might come in handy.
fltk graphics instructions

I processed it to match the murga-style FLTK commands rather than the C++
nastiness that the original docs are in. Makes for easier copy and paste.

Links in the doc don't work though, guess I'll have to remember exactly
what  I did to make it conform and process the whole of FLTK docs
into a suitable mass of information.
Wow, that's really cool. I had no idea there were so many drawing functions available.

As far as the links go, I just ran it through sed to remove all instances of the leading directory path, saved it to the same directory as the rest of the FLTK docs and now it works fine.
Hi Mikshaw,

Feel free to use part(s) of the murgaLua scripts that I have created for Damn Small Linux. As I am sure you are aware, DSL, has used Lua and Lua-Fltk for quite some time. In fact, DSL has over 50 such programs, covering file processing, sockets, and many GUIs. When murgaLua came on the scene, I converted, at that time, 54 Lua and Lua/Fltk scripts to murgaLua.

I wish I had more time to do more to help you with this, but at the moment I am very busy with the DSL distribution.

I am always looking forward to incorporating your scripts or any other member here into DSL. There are still many Lua GUI's to build.

Lua is the main language used in DSL.

-- Robert
Thank you. There is much in DSL that has greatly impressed me.

The Lua-FLTK reference package was quite a bit different than this one, particularly in the sense that this one will be read-only rather than having the ability to edit code samples and save as a new file. That feature may have been handy for some, but I found that I never used it and it seemed to just add unnecessary complexity. At this time, the code samples load into a browser, but I think it would probably be better to use Fl_Multiline_Output() so you could select specific parts.

I got kind of sidetracked yesterday digging into new little bits of code that i kept running into, and almost got _very_ sidetracked into studying the drawing functions (but that will take some time to absorb, and I don't think i'm ready yet), and didn't do much work adding to the widget collection.

I'm trying to keep the main script as simple as possible, although over time my scripts tend to get more complex than I would like. Right now I'm still debating whether to keep the current method of using dofile() on all included widget files when the script first runs, or go back to trying my original (so far unsuccessful) plan of loading each widget only when needed. The original plan would definitely be better, but for some reason replacing widgets/groups dynamically seems to be somewhat limited (possibly to particular classes?). But this particular issue can be addressed at any time, I suppose, as long as I don't add much extra code that depends on the method of loading widget files.

Anyway....I guess most of this post is just a ramble session. For now the main script works fairly well, so I guess I'll concentate on quantity for a little while.

Edit: I forgot to mention that the tool will provide a way to display a text file for each sample for any information that may not comfortably fit in as script comments, so if you have any special notes about a submitted or otherwise acquired script, feel free to donate some comments. I'll probably start posting test releases to this thread within the next couple of weeks, so if you see anything of yours included please feel free to add your comments, motivation for the script, tips on using your code, or anything else you have to say about it, and I'll put it in the text files.
I was thinking, perhaps you want to have a means of exporting the samples and comments to a indexed HTML page(s) for posting to the web. Just a thought.
That's not a bad idea. I'm not sure what the term "indexed HTML" means, but it could at least export text files with little trouble. Any formatting to other types of text could be added at any time in the future.
Last night I had changed the Fl_Browser to Fl_Multiline_Output (for displaying code and notes) in order to allow selecting arbitrary bits of text. However, the output widget has an annoying tendancy to beep at me if I accidently press a hotkey without holding Alt while the text field has focus (which is every time a file gets loaded into it). So I thought it might be better just to make it an Input instead. This would also require Alt+hotkey rather than just hotkey in order to prevent accidentally inserting text into the sample, but there will be no annoying beep, and would allow a feature to save a modified version of the script sample to a new file with only a fraction of the added code that I had estimated. Maybe I need to study Fl_Text_Editor...it could be a better alternative to Fl_Multiline_Input.[attachment=10]
Looking good.

By indexed HTML I meant where a list of relevant links are on one side of the page and the content that it links to pops up on the other side of the page.

I suppose people use that CSS stuff for that now, I never fell in love with mark up languages so I'm still stuck in 1997 when it comes to web page stuffs.
Pages: 1 2 3 4 5 6 7 8 9 10 11
Reference URL's