Why GTK visual designer uses "pack" system to arrange widget? - gtk

I'm a "classical" programmer, with "classical" RAD system. I would like to "migrate" to monodevelop to deploy some application, but the first big "mountains" is to learn the "packing" system for design object.
Why gtk (or mono) uses this system ?
Thanks

This gives you a brief overview. The main point is to not use fixed cordinates, but help you be independant of screen sizes.

Flexibility : packing widgets allows the automatic resizing and other nifty things. There are a number of options as to how your widgets should be packed.
Portability : with a packing scheme you're less dependant on the rendering engine (X11, win32...) .(I've not said "totally independant")
See the GTK tutorial to learn about packing and table packing in particular, it gives you exemples where packing is interesting :
http://library.gnome.org/devel/gtk-tutorial/stable/x363.html

Related

Need Help With Gtk+ Text Editor

I am creating a GTK+ text editor called Quick-Ed Pro. It was originally designed to be a cross-platform version of Quick-Ed , a text editor I wrote in raw Win Api. But after finding the awesome capabilities of GTK+ , Quick-Ed Pro emerged as an entirely different program with advanced GUI capabilities way better than Quick-Ed. But now Im stuck with a few problems.
Problems:
1- I want to make my editor multi-tabular like notepad++ or gedit. I dont know how to do this. What widget should I use?
2- GtkTextView does not seem to have any undo / redo functions. How can I make my own? (examples appreciated)
3- Gtk+ has a long startup time, usually 2-4 seconds unlike win api which started up in less than a second, so how can I create a small popup loading bar like the one in GIMP or Code::Blocks?
4-URL of my project: http://code.google.com/p/quick-ed/
URL of the WinApi Quick-Ed : http://code.google.com/p/burningprodigy ... e&can=2&q=
Any help will be appreciated. I need contributors. Please lend me a hand.
1) Tabs: You will need to write your own widget for this. No toolkit i know has one that is flexible enough to handle what is required in a good editor. But you can start with GtkNotebook for a quick prototype.
2) Yes this is a FAQ and imho bad that it is not solved directly in GTK. If you use gtkmm you can use http://view.sourceforge.net/classes.php otherwise look into the library to see how it is implemented and port it into C. There are other implementations for example for python available on the net.
3) You have to write a small dialog using the WinAPI and show this before you call the first GTK function. Usually i wouldn't recommend to do it - after the windows file cache has the files (or you have a SSD) loading speed is okay.
You should look into http://projects.gnome.org/gtksourceview/ to get a good editor. The GtkTextView is definitely not able to work as a source code editor. I'm maintaining a commerical IDE and Editor and by the way the most code is outside the editor widget anyway.

Visual software tool for creating complex branching logic

Is there a visual software tool (no batch coding/programming language) which can enable an end user to create complex branching logic like this tool : http://www.visuallogic.org/VLTutorial.html . Any eclipse plgun-in similar to this. I want that complex logic expressed by the end user to be represented in XML form
A set of plug-ins called vIDE might help you - it's a tool based on GMF I am currently developing. You can check out the project here.
It's still far from stable or finished, but you can draw flowcharts in it which get dynamically converted to Ecore models (which in term can be exported to XML).
My current effort is to support generation of executable Python code from the drawn flowchart.
Take a look at UniMod
In term of pure flowchart diagrams (and not UML diagrams), I didn't find anything recent.
flowchartstudio is not supported on recent Eclipse version
flowchart4j (not free) is interesting (for Java programs, so no XML representation)
DRAKON Editor
http://drakon-editor.sourceforge.net/
It it supports visual programming in several programming languages, including Java, Processing.org, D, C#, C/C++ (with Qt support), Python, Tcl, Javascript, Lua and Erlang.
Why to use DRAKON than other diagramming systems?
No line intersections. You will never find in DRAKON diagram two or
more lines intersecting each other! Not seen in other diagramming
systems!
Silhouette structure. It allows to break one diagram in to several
logical parts. Not seen in other diagramming systems!
No slanting or curved lines. Only straight lines with right angles.
Icons are placed only on vertical lines.
Branching is done in a simple, visible and consistent way.
Each diagram has one entry and one exit.
More about DRAKON here:
http://en.wikipedia.org/wiki/DRAKON
Take a lool at TUM.CMS.VplControl

What is a good visualization library for creating state diagrams and animations?

I'd like to post-process log files and extract node data and transitions, and then graph them in a gui of some kind. So, I'd like to programmaticly draw bubble diagrams, maybe with animations showing packets going from node to node.
Ideally, perl or java would be the language of choice, but anything that runs on a linux platform would be fine.
What is the best library for this kind of thing?
Java Solutions
Two possibilities in Java include Prefuse and Visual Library. They both have the ability to display graphs with some animation ability. Prefuse has better graph layouts. Visual Library is more Swing-like if you are used to Swing development.
Adobe Flash
If you are willing to work with Adobe Flash, Flare is probably a little more suited to your task as it has better animation capabilities and has good graph layouts.
Animation Libraries
If your diagrams are fairly simple, you could create your own diagrams and use the Timing Framework or Trident for animation.
Other
Some other possibilities include Processing and JavaFX. Javascript libraries include ProcessingJS and Protovis.
Graphviz will draw you static diagrams. It can't do animations as far as I know.
If you can convert the output into graphviz dot format (graphviz) than you can use idot incremental viewer (iDot_incremental_viewer) which uses prefuse behind the scenes and it's completely free. The only thing you need to do here is to convert the output in simple dot file. Rest will be taken care of incremental viewer.

In Gtk, when is it better to use Glade/GtkBuilder than native code?

Glade helped me get started on a project quickly, but I've found it harder to maintain in the long run, and I'm thinking about switching it all to native code. In what circumstances would you choose glade, and when would you use native code?
I would personally only use native code for performance reasons. I find it much easier to work with gtkbuilder. Have you used glade or gtkbuilder? With Glade 3, gtkbuilder format is easy to use and easy to layout and design. Also, gtkbuilder is easier to load widgets from than glade was.
if by native code you mean "direct GTK calls to build ui", then i'd switch to it for several reasons:
if widgets are built dynamically depending on user preferences, etc
if i use a lot of custom widgets, esp. contained within each other (for example GDL docking panels)
to maintain backwards compatibility with older version of GTK
upd: also i'm still using glade2.x which has code generation (patched it to compile against latest gtk2). it really helps to get quickstart on "gui build from code", and works with both ancient and newer GTK versions. though i'm afraid i will have some troubles porting to gtk3 :)
and i never choose gtkbuilder over other alternatives, 'cause it is not available in (still widespread) older GTK versions.. dunno if i'll ever switch to it.. maybe when gtk3 comes out.

How can I enhance the look of the Perl/TK GUI under Perl 5.004?

I have an application that is built to work on Windows, Linux, and Solaris that uses the Perl/TK GUI. Due to constraints, we are limited to Perl/TK only. Moreover, we are limited to an old Perl/Tk version, 5.00404.
I'd like to work within these limitations to make the GUI look as nice and modern as possible.
Are there any web-resources that have TK design schemes (for buttons, frames, colors, etc) that could assist me in this endeavor?
I am also looking for modernization advices like the one that I found here:
If you're finding that your Tk apps look a little ugly on X-based systems, try adding the following lines to the top of your script:
$mw->optionAdd("*font", "-*-arial-normal-r-*-*-*-120-*-*-*-*-*-*");
$mw->optionAdd("*borderWidth", 1);
Try using images instead of button elements, then you can have whatever style you like and the fonts can be baked in. This will work for pretty much any element where the contents are not dynamic - including backgrounds on panes and such. Granted it's more work but it does solve your problem, especially if you have a competent artist in your project group.
You could use the Tk theme engine to give your app better looks.
Using optionAdd to tweak defaults through the option database
is a reasonable start. A thread about this can be found at:
http://tcl.projectforum.com/tk/221
Download griffin.kit from there, use the sdx tool to unwrap it and locate
griffin.tcl to get a good set of option settings.
http://wiki.tcl.tk/3411 for the sdx tool.
Since in Linux the background of Tk::Entry and Tk::Text is grey i would also use the following two lines.
$mw->optionAdd( '*Entry.background', 'snow1' );
$mw->optionAdd( '*Text.background', 'snow1' );
Replace 'snow1' with a color of your choice. You can also use the hex representation(RGB) of the colors like '#ff9696'.
The Tile themeable engine for Tk makes it look much prettier. However, Perl/Tk has lagged far behind Tk's development, and can't take advantage of Tile and other advancements.
You should investigate whether Tkx is an option for you. It's not completely compatible with Perl/Tk, but the API is pretty close. It's a bridge between Perl and Tcl/Tk, so it can use all of the modern Tcl/Tk features (like Tile) while still having application logic coded in Perl. Quite a few of ActiveState's own graphical utilities use Tkx, with fairly good-looking results.
(source: activestate.com)
Perl 5.00404 is incredibly ancient, though. The Tkx dist claims to depend on Perl≥5.008... I don't have an old enough Perl to see how accurate that is.