Showing posts from February, 2011


For some reason the formating of the doxygen generated pages was a little wierd. In the past it generated a nicely numbers list, but something went wrong. So, I've just reworked the pages with lists on them. Should be ok now.


I noticed that the filechooser dialog still had no means of providing file filtering. Put a module together to handle that. Seems like a lot of code for a simple output! The basics are there but still a little more needs doing. For instance, its possible to assign more than one fileFilter to a widget. And, of course, there a special option just display known image formats.

gnocl::tree and gnocl::windo enhancements

This weekend has been really busy. I've ben working on the gnocl::tree module which is pretty daunting but got there in the end. I wanted to implement text wrapping on text cells. Following this I wanted to implement a means of dynamically re-wrapping text as the text columns are resized -done. This needed a response to an event which emits not signals so I had then to explore the g_object_notify code. Once learned, I decided to add the functionality as a utility to the gnocl::winfo (widget-info) command. Here's the summary from the NEWS file. The updated dated code is now available from SF.

        o new subcommand

        o new column option

gnocl::textview - full undo/redo

Just added the GtkSourceView undo/redo modules to the gnocl source core. Newly created gnocl::text objects will have unlimited undo/redo enabled by default. 

gnocl::text contextualized popups

The GtkText and GtkEntry widgets have their own popup menus which are activated by the press of B3 (right mouse button). It is possible to create and display popup menus for other widgets but existing methods didn't allow for the direct augmentation of these widget specific menus. Today I completed the support for this functionality which I know is something that I'll use a lot. The code works but still might undergo some revision. At the moment menu items are only appended to the bottom of the list, but these could be prepended too. I'll look at this some other time. Here's the code snippets from my test application.

$trans(sl) [gnocl:text]
$trans(sl) configure -onPopulatePopup { popups %w }

# -onPopulatePopup callback proceedure
proc popups {w} {
   # add some items to the text widget popup menu
   # 1) create some menu items
  set m1 [gnocl::menuItem -icon "%#Open" -text "%_Use _Bird" -onClicked {puts "use bird&qu…

gnocl::draw composite

Added the rudiments of this subcommand that will composite a target image over the specified surface. I still have to sort out the matrix transformation ordering, but the basic bones are there.

gnocl::draw composite $pb2 \
    -image [pwd]/gnocl.png \
    -translate {100 1} \
    -scale {2 2} \
    -rotate 45

gnocl::draw roundedRectangle

Added another command to proiduce boxes with rounded corners. Its all working now, but I think that I might look at making this an option for the rectangle sub-command. Its not that much of a hassle, I can wrap the current gnocl::CairoDrawRoundedRectangle library functions into branch from gnocl::CairoDrawRectangle.

polyline -extra comands

After working around some compile data mangling problems I've finally got the polyline function to work with two new options -fill and -close. A bit of a fiddly process, but I got there in the end. So far, so good!

gnocl::draw polyline ...

Added a polyline function this evening.

gnocl::draw polyline $pb2 -points [list 0 0 100 50 100 100 50 150 200 100]

The syntax is simple enough.

I'll add a polygon next time.


Resurrected the cairo module today. I almost deleted it a while ago but decided to return to it after I needed some its functionality in my ScanDocs application. Ok, some of these drawing functions can be achieved using a canvas, but I wanted optimal speed. When I returned to the code I found that I broke away after coming to a standstill on implementing the line and fill attributes. I'd got 90% of the way there.... Today got through that one in about 15mins. I've got the most of the Cairo primitives sorted now but have come to a similar 'sticky wicket' with regard to setting patterns. Its a little late now and so this is something for later on this week.

Here's the test script:

# test-cairo.tcl
#! ./bin/sh
exec tclsh "$0" "$@"

package require Gnocl

# how to pass these values to a cairo context?
# keep them in a global context, when drawing occurs, these are read!


set pb…

gnocl::pixbuf -two new object commands

Offering new extra functionality "scale" and "resize" allow copies copies made of existing pixbufs at new sizes. Typically a pixbuf will be an image loaded from disk that would be suitable manipulated prior to display in a gnocl::image item which has its own buffer resizing functionality. However, the pixbuf code is pretty fast for scaling operations in general and so would be useful for simple image manipulation. Here's how these commands work:

# Create a pixbuf by loading and image from disk.
set pb1 [gnocl::pixBuf load -file ./georgie.png]

# Create copy by simple scale factor, conserves aspect ratio
set pb2 [$pb1 scale 0.25 ]

# Create copy by specifying width scale factors, no conservation of aspect ratio
set pb2 [$pb1 scale -width 0.25 -height 0.25 ]

# Create copy by specific size, does not conserves aspect ratio
set pb3 [$pb1 resize -width 100 -height 150 ]

# Copy with specific width, the height will be calculated based upon image aspect ratio
set pb4 …