Monday, January 31, 2011

IconView -getting close to completion

Got most of the functionality for the iconview in place and now its time to cut back some of the unecessary controls to provide a dedicated widget. The framework does allow for much, much more that a simple listing of icons. But, anyone who need such extra controls should use the list widget itself. I'll take another look at it tomorrow, and it should be complete by then.

Sunday, January 30, 2011

gnocl::iconView

Uploaded some user docs to the website. The package is now beginning to take shape but I'm still not fully certain about what's going on and where. On selection, for instance, I want to return some form of ID for the item selected but I've not yet been successful. As far as I can see, the IconView object is derived from the same classes as the TreeView and List object and so perhaps I'll find some answers there.


Friday, January 28, 2011

gnocl::iconView - more work

The past few days has seen little posted to the blog but that doesn't mean that the Gnocl wheel has not been turning! Earlier this week I posted an article to tutorials page at gnocl.org to show how easy it is to set up and C-coded packages for Tcl. There are some useful materials in the Tcler's wiki but I wanted something much more. Most of the inconvenience is continuously creating the basic skeleton and makefiles etc. I created some boiler plates for new packages and all of the naming, versioning and so on are managed through the Makefile.

Today I turned my attention back to the gnocl::iconView widget. This object will now happily accept new images and add them to the display.

Here's the test script.

#---------------
# Author:   William J Giddings
# Date:     28/01/11
#---------------
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
#---------------

package require Gnocl

#-icons [list wjg.png gnocl.png wjg.png gnocl.png wjg.png gnocl.png] \

if { 0 } {
set iv [gnocl::iconView \
    -columnSpacing 20 \
    -margin 5 \
    -spacing 15 \
    -columns 4 \
    -rowSpacing 20 \
    -pixbufColumn 0 \
    -textColumn 1 \
]
}

set iv [gnocl::iconView]

$iv add "%/./georgie.png" -label Georgie
$iv add "%/./wjg.png" -label WiGi
$iv add "%/./gnocl.png" -label NEW
$iv add "%/./wjg.png" -label WiGi

gnocl::window \
    -child $iv \
    -title gnocl::iconView \
    -widthRequest 200 \
    -heightRequest 200

gnocl::mainLoop
 

Can't really say that I've found these two tasks fulfilling. It meant going over some old code the errors within which I had long  since forgotten and had to resolve these before being able to move forward.

Thursday, January 13, 2011

window jitter command -done

Added a jitter subcommand for gnocl::windows.

Here's the docs entry:

id jitter integer  
'Jitter' or horizontally shake the window for number of times specified by integer (default = 20).
I settled on simply using a number of repetitions as its not very practical trying to set a timer for this event. I found that the time taken to complete a 'jitter' cycle tended to vary. In order to maintain some form of legibility, the jitter is very small (+/- 2 pixels) and just enough to act as a visual attractant.



Wednesday, January 12, 2011

Toplevel window jittering...

The Tcler's wiki has a brief but interesting post on toplevel jittering, (http://wiki.tcl.tk/14457). Anyone who enters a wrong name or password whilst logging onto their Linux box will know exactly what this means. Should be an interesting little addition -used by no-one most likely but interesting.

gnocl::print more options added

Now completed the options for the following parameters:

-useColor, -collate, -duplex, -quality, -copies, -numberUp, -resolution and -xyRes

With a bit of luck, might get this section completed before the end of the evening.

Ah.... second hack....

-printerLpi, -scale, -pageRanges, -defaultSource, -media, -dither, -finishings, -outputBin

Some the values to be passed to these options baffle me at the moment as they should be meaningful values and there's no clear guidelines in the docs. Not to worry, the details will come in the fullness of time and then I can then add some error checking.



gnocl::print more options added

Now completed the options for the following parameters:

-useColor, -collate, -duplex, -quality, -copies, -numberUp, -resolution and -xyRes

With a bit of luck, might get this section completed before the end of the evening.


Tuesday, January 11, 2011

gnocl::print settings

Done some work with working on the print settings module today. Now, up to a little under 1100 lines of code and rising! I think that this will end up being one of the largest single modules once all the options are taken into account. Properly implemented the framework for setting print settings from basic options. I've got the basics ready for a 'settings get' subcommand too. Since Gtk+2.10 there has also been the option to save/load settings as a keyfile. This is also something that I'll take a look at. The current work on the print.c module means that the printoperation.c module is no longer needed and will be removed.


Friday, January 07, 2011

create-custom-transitioning-backgrounds

Most of the default desktop backgrounds on my OpenSuse workstation are slide shows. Here's the link to a simple 'How-To' tutorial on creating custom slide-show desktops.

http://www.linuxjournal.com/content/create-custom-transitioning-background-your-gnome-228-desktop

A little ingenuity might lead to the possibility of creating desktop embedded display applications. Graphics could be regularly written to using the cairo and/or the imagemagick bindings. The possibilities aren't execatly endless but they could be interesting.

Changing the GNOME Desktop background with gnocl::gconf

Apart from the appletbar and status box, the desktop background could be used to display some interesting things. The management of the this lowest graphic plane comes under the control of the Xlibs but its a relatively simple task to change graphics using the gnocl::gconf command. This simple test script explains all:

#---------------
# test-gconf-background.tcl
#---------------
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
#---------------

package require Gnocl
package require GnoclGconf

set tb [gnocl::toolBar -orientation vertical]
$tb add item \
    -text TCL \
    -onClicked {
        gnocl::gconf set /desktop/gnome/background/picture_options centered -type string
        gnocl::gconf set /desktop/gnome/background/picture_filename [pwd]/Tcl.svg -type string
        }

$tb add item \
    -text GTK \
    -onClicked {
        gnocl::gconf set /desktop/gnome/background/picture_options wallpaper -type string
        gnocl::gconf set /desktop/gnome/background/picture_filename [pwd]/gtk.svg -type string
        }

gnocl::window -child $tb -widthRequest 125
gnocl::mainLoop


gnocl::print

Did a little more to this module this lunchtime. Basically implemented the three options shown below.

proc doPrintFile {} {
    puts [upvar level #0]
    gnocl::print file test-print.tcl \
        -baseFont {Gentium 10.0} \
        -linePadding 2 \
        -header "How now brown cow"\
}

I'm now pondering over how to handle pagesize etc...


Thursday, January 06, 2011

gnocl::print and printing as a text widget command

Had enough of gnocl::wand for the meantime and so I've spent this evening working through the code stubs for printing. The basics were there but nothing really useful. Today I made some useful headway into fully implementing print functionality for disk based text files and for direct printing from a text widget. At the moment only plain text is supported and I'm not yet certain how to handle rich-text formatting.
The way in which Gtk+ prints is by first rendering up to a Cairo canvas and then printing out the graphic content. If the Gnocl side needs to handle the formatting then this could be a lengthy implementation job. Here's the test-script to show how things are progressing.

#---------------
# test-print.tcl
#---------------
# Author:   William J Giddings
# Date:     06/01/11
#----
-----------
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
#---------------

package require Gnocl


proc doPrintFile {} {
    puts [upvar level #0]
    gnocl::print file test-print.tcl
}

proc doPrintWidget {} {
    global txt
    puts [upvar level #0]
    gnocl::print widget $txt start end
}

proc doWidgetPrint {} {
    global txt
    puts [upvar level #0]
    $txt print start end
}


set tb [gnocl::toolBar]

$tb add item -text "PRINT FILE" -onClicked {doPrintFile}
$tb add item -text "PRINT WIDGET" -onClicked {doPrintWidget}
$tb add item -text "WIDGET PRINT" -onClicked {doWidgetPrint}

set txt [gnocl::text -baseFont {Gentium 12} ]

set box [gnocl::box -orientation vertical]

$box add $tb
$box add $txt -fill {1 1} -expand 1

gnocl::window -child $box -widthRequest 300




Monday, January 03, 2011

gnocl::wand

Made some progress on this module to today. Its a strange way of doing things. ImageMagick is something of a mixture of the gtk Pixbuf and Cairo operations in that pixel drawing and vector drawing operations are available. Ok, there are differences, ImageMagic has a whole pile of image manipulation tools to begin with and is aimed primarily on the processing of disk-based imagery. Cairo, on the other hand, is fast enough handle real-time drawing for rendering widgets. Yesterday I got block 'drawing' working using the vector drawing ops and today created a custom command for a pixel block draw. Both are a somewhat slower than I expected. I need something to set a whole chunk of pixel array in the fastest possible time. Maybe the MagicCore has something more efficient to offer.

Ended my programming day looking at how its possible to port gdk_pixbuf data to a MagicWand image and vice-versa. Got the rudiments together but coming up against a couple of bugs accessing the pixbuf.

Seeing as its the new year I took a look at the development review that I posted a few months back. Sure enough, most of those features tagged for some TLC are still waiting!


Saturday, January 01, 2011

gnocl::wand

HAPPY NEW YEAR!

Spent a little while this morning sorting out a couple of issues in the gnocl::gnome module makefile. Thanks to John and Chris for the feedback. The remainder of the day saw me working on the gnocl::wand bindings to the ImageMagick libraries. Added a little more functionality but, as usually, add something - loose something. Added control over pen colours and a few other items but now the rendering is slowed down! I'm missing something here...