Re: How to set background color for a pango layout being printed ?

2007-10-17 Thread Miroslav Rajcic
Unfortunately, this does not work. All I get is a page that is completely
empty (white).

My requirements are not to paint entire background of a page in one color,
but to paint the background of the single text layout in that color.
Each page has more than one text layout being drawn with the different 
properties
(color, bgcolor, font, bold, italic, ...).

Yesterday I've found some code (see below) that should work but it doesn't 
work all the time.

On Ubuntu 7.04 (PDF backend), background color works fine, text underlining
woks, but the text is underlined with gray color!, strikethrough does not 
work at all!

On Windows (GTK+ 2.10.11 from http://gladewin32.sourceforge.net/),
when using print preview operation (.emf image format) everything seems to 
work,
but I get strange drawing artefacts in the picture.
Individual text layouts are drawn with gray lines either on the left and 
right layout bounds or on the
top and bottom bounds!! Some layouts are even completely squared in gray.
You can see the sample for Windows print preview at: 
http://notecase.sourceforge.net/temp/printing.jpg

Even more strange, when I print the same test page on the actual printer 
(Windows),
there are no gray lines and everything works except the strikethrough (there 
is no strike line).


My new code is this:

//create layout
 layout = gtk_print_context_create_pango_layout (context);
 pango_layout_set_text (layout, text, -1);

//set required layout attributes
PangoAttrList *layout_attr = pango_attr_list_new ();

PangoAttribute *attr1 = pango_attr_background_new(bkgcolor.red,
bkgcolor.green, bkgcolor.blue);
pango_attr_list_insert (layout_attr, attr1);

if(bStrike){
PangoAttribute *attr2 = pango_attr_strikethrough_new (TRUE);
pango_attr_list_insert (layout_attr, attr2);
}

if(bUnderline){
PangoAttribute *attr3 =
pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
pango_attr_list_insert (layout_attr, attr3);
}
pango_layout_set_attributes(layout, layout_attr);
pango_layout_context_changed(layout);

//set fg color
cairo_set_source_rgb (cr, color.red, color.green, color.blue);

 cairo_move_to (cr, nPosX,  nPosY);
pango_cairo_show_layout (cr, layout);


Does anyone knows what is the problem with this ? Is this a GTK bug ?
Is it the code problem ?

Regards,
  Miroslav


- Original Message - 
From: Behdad Esfahbod [EMAIL PROTECTED]
To: Miroslav Rajcic [EMAIL PROTECTED]
Cc: gtk-app-devel-list@gnome.org
Sent: Tuesday, October 16, 2007 5:58 PM
Subject: Re: How to set background color for a pango layout being printed ?


 On Tue, 2007-10-16 at 12:13 +0200, Miroslav Rajcic wrote:

 layout = gtk_print_context_create_pango_layout (context);
 pango_layout_set_text (layout, text, -1);

 cairo_set_source_rgb (cr, bgcolor.red, bgcolor.green, bgcolor.blue);
 cairo_paint (cr);

 //set fg color
 cairo_set_source_rgb (cr, color.red, color.green, color.blue);

 //HOW to set bkg color for the layout?

 cairo_move_to (cr, nPosX,  nPosY);
 pango_cairo_show_layout (cr, layout);
 -- 
 behdad
 http://behdad.org/

 Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety.
-- Benjamin Franklin, 1759

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


window and widget resize

2007-10-17 Thread AlannY
Hi again ;-)

I have that interface:

+---+
| +---+ |
| |   | |
| |   Widget 1| |
| |   | |
| +---+ |
| +---+ |
| |   | |
| |   Widget 2| |
| |   | |
| +---+ |
+---+

After I'm resizing window, my program looks like:

+---+
| +---+ |
| |   | |
| |   Widget 1| |
| |   | |
| +---+ |
| +---+ |
| |   | |
| |   Widget 2| |
| |   | |
| +---+ |
|   |
|Blank Space|
|   |
+---+

How to auto resize widget, that they fit window?
I think, that it's not only my problem, so I think, that you know solution.
First of all, I tried to use size-allocate signal on main window. but,
it's not so beautiful, like I want. So is there any *beautiful* solution?

Thank You.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkFileChooserDialog too slow

2007-10-17 Thread Emmanuele Bassi
On Tue, 2007-10-16 at 19:27 -0400, Andrew Smith wrote:
 Hi
 
 Try to navigate to /usr/bin using a no-frills GtkFileChooserDialog. My 
 computer is a bit old, but it's far from being obsolete and it sometimes 
 takes minutes (!!) to display that directory.

because it needs to sniff every file for its MIME type, as files
in /usr/bin have no extension to use the dumb
use-the-extension-as-hint-of-MIME-type algorithm to display an icon.

hence the slowness.

 Will you please fix it? I need to navigate to /usr/bin once in a while 
 to select what app to open files with from Firefox

solutions:

  * ask firefox developers to write something using gnome-vfs to get the
applications that can open a given MIME type;
  * ask firefox developers to write something that doesn't require the
user to manually select the binary of an application;
  * use epiphany, which is a sane and integrated web browser and
it doesn't expose this kind of crappy UI.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkFileChooserDialog too slow

2007-10-17 Thread Emmanuele Bassi
On Tue, 2007-10-16 at 21:20 -0400, Andrew Smith wrote:

 And oh, I meant to post this to gtk-devel not gtk-app-devel. Should I 
 send a copy there also?

no need to: you should have opened a bug on bugzilla instead of using
the mailing list.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GTK+ 2.12.1 released

2007-10-17 Thread Matthias Clasen
GTK+ 2.12.1 is now available for download at:

 ftp://ftp.gtk.org/pub/gtk/2.12/
 http://ftp.gnome.org/pub/GNOME/sources/gtk+/2.12/

gtk+-2.12.1.tar.bz2   md5sum: c46f34addc2fe3ea6756055d59fb8856
gtk+-2.12.1.tar.gzmd5sum: b0cd0b8067d3a83b05764480f73f9306 

This is a bugfix release in the 2.12 series.


What is GTK+


GTK+ is a multi-platform toolkit for creating graphical user
interfaces. Offering a complete set of widgets, GTK+ is suitable for
projects ranging from small one-off tools to complete application
suites.

GTK+ has been designed from the ground up to support a range of
languages, not only C/C++. Using GTK+ from languages such as Perl and
Python (especially in combination with the Glade GUI builder) provides
an effective method of rapid application development.

GTK+ is free software and part of the GNU Project. However, the
licensing terms for GTK+, the GNU LGPL, allow it to be used by all
developers, including those developing proprietary software, without
any license fees or royalties. 


Where to get more information about GTK+


Information about GTK+ including links to documentation can be
found at:
 
http://www.gtk.org/

An installation guide for GTK+ 2.8 is found at:

 http://developer.gnome.org/doc/API/2.0/gtk/gtk-building.html

Common questions:
 
http://developer.gnome.org/doc/API/2.0/gtk/gtk-question-index.html
http://www.gtk.org/faq/


Overview of Changes from GTK+ 2.12.0 to 2.12.1
==

 * Bugs fixed: 
 472965 a small improvement for scrolling behavior with PgUp/PgDown
 460194 Gtk tooltips + swt crash
 478803 Segfault in gtk_print_operation_run when no range specified
 480123 Crash from GTK's new search feature
 483223 im-xim.so leaves callbacks connected to display closed ...
 476342 Icon cache validation causes severe page-in
 484008 configure fails during CUPS version tests on some platforms
 327243 GtkFileChooserButton emits two selection-changed signal...
 465380 gtkfilechooser cannot show the modified date on none UTF-...
 467269 Inkscape Flickers horribly
 476686 gtkrecentchooser select-multiple property
 478173 GTK's Tracker search engine does not work anymore
 478371 totem volume slider appears on all workspaces
 482089 GtkPrintOperation check for null default signal handler b...
 482504 Missing locale to UTF-8 conversion for modification time ...
 482841 critical warnings on gdk_display_close after _gtk_tooltip...
 483563 remains of gtk_widget_ref() in gtkdnd.c
 483730 Keyboard navigation of mutiple-selecting gtk.TreeViews im...
 484650 Typo in docs for GdkGrabBroken
 484730 In MS-Windows theme, GtkBorder freed with g_free() instea...
 486360 Failed to convert Empathy Glade files
 389358 print dialog: unit selection dialog can't be closed
 448343 File chooser should maintain sort state during folder swi...
 477447 GtkPaned documentation doesn't mention behaviour with onl...
 482034 GtkMenuPositionFunc push_in parameter description
 482837 duplicate declaration of gtk_notebook_create_window()
 478637 Notebook tab labels not correctly centered in ms-windows ...
 484132 gtk_recent_info_get_icon docs
 486636 Cannot open display message doesn't include display whe...
 455284 Ctrl+L should work depending if it has focus or not
 478377 10x speed up for window motion/scroll (gdk-quartz)
 485301 Filename is garbled in print dialog on none UTF-8
 485437 Fix testxinerama.c to not query current monitor by default
 486155 Docs for gtk_text_iter_forward_line()
 339877 pixbuf loader incorrectly returns wbmp
 456137 Pidgin will crash in fail-safe session due to a NULL poin...
 456676 Critical warning in gtk_drag_drop_finished()
 352643 crash in gtk_entry_completion_default_completion_func
 477280 volume button docs fix
 477704 Add docs for GtkTreeModelForeachFunc
 476920 Move GtkFileSelection to the deprecated section

 * Updated translations:
 - Arabic (ar)
 - Assamese (as)
 - Belarusian Latin ([EMAIL PROTECTED])
 - Catalan (ca)
 - Estonian (et)
 - Basque (eu)
 - Hebrew (he)
 - Ido (io)
 - Italian (it)
 - Japanese (ja)
 - Georgian (ka)
 - Kannada (kn)
 - Korean (ko)
 - Lithuanian (lt)
 - Dutch (nl)
 - Polish (pl)
 - Romanian (ro)
 - Slovenian (sl)

A list of all bugs fixed in this release can be found at
http://bugzilla.gnome.org/buglist.cgi?bug_id=476342,476686,478173,478637,478803,389358,460194,480123,448343,455284,482837,482504,478371,483563,482089,483223,484008,482841,327243,484650,484730,478377,467269,483730,472965,465380,484132,486360,486636,482034,477447,485301,485437,486155,456137,456676,352643,477280,339877,477704,476920

Thanks to all contributors:
Bill Nottingham
Carlos Garnacho
Chris Lord
Christian Persch
Cody Russell
Daniel Atallah
Emil Nowak
Emmanuele Bassi
Federico Mena Quintero
Geoff Bache
Hans Breuer
Hiroyuki Ikezoe
Jaap A. Haitsma
Jean Brefort
Johan Dahlin
Jonathan Dempsey
Jonh Wendell
Juri Pakaste
Karl Tomlinson
Kristian Rietveld
Loïc Minier
Manish Singh
Matthijs De Smedt

let g_warn_if_fail replace g_assert

2007-10-17 Thread Tim Janik
hey All.

proposing to turn g_asert into a warning:
   http://mail.gnome.org/archives/gtk-devel-list/2007-October/msg00053.html
was obviously not perceived too well.

as i read it, most people are not against my basic
reasoning, but are clearly in favour of adding
g_warn_if_fail or a similar variant thereof.

so i'd like to change course and suggest we do this:

- add g_warn_if_fail (condition); which produces a critical
   warning about failing assertions but contrary to g_assert
   returns.

- extend the g_assert() docs to note that:
   1) programmers are more likely to want to use g_warn_if_fail instead
  (particularly for libraries, allthough the destabilizing effects
  of g_assert are also worth avoiding in applicaiton code);
   2) for code portions that positively have to rely on program
  termination, only g_error() will deterministically achive that.

- proceed analogously for g_warn_if_reached() and g_assert_not_reached().

comments apprechiated, particularly on the new function names.

---
ciaoTJ
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


GTK+ 2.12.1 released

2007-10-17 Thread Matthias Clasen
GTK+ 2.12.1 is now available for download at:

 ftp://ftp.gtk.org/pub/gtk/2.12/
 http://ftp.gnome.org/pub/GNOME/sources/gtk+/2.12/

gtk+-2.12.1.tar.bz2   md5sum: c46f34addc2fe3ea6756055d59fb8856
gtk+-2.12.1.tar.gzmd5sum: b0cd0b8067d3a83b05764480f73f9306 

This is a bugfix release in the 2.12 series.


What is GTK+


GTK+ is a multi-platform toolkit for creating graphical user
interfaces. Offering a complete set of widgets, GTK+ is suitable for
projects ranging from small one-off tools to complete application
suites.

GTK+ has been designed from the ground up to support a range of
languages, not only C/C++. Using GTK+ from languages such as Perl and
Python (especially in combination with the Glade GUI builder) provides
an effective method of rapid application development.

GTK+ is free software and part of the GNU Project. However, the
licensing terms for GTK+, the GNU LGPL, allow it to be used by all
developers, including those developing proprietary software, without
any license fees or royalties. 


Where to get more information about GTK+


Information about GTK+ including links to documentation can be
found at:
 
http://www.gtk.org/

An installation guide for GTK+ 2.8 is found at:

 http://developer.gnome.org/doc/API/2.0/gtk/gtk-building.html

Common questions:
 
http://developer.gnome.org/doc/API/2.0/gtk/gtk-question-index.html
http://www.gtk.org/faq/


Overview of Changes from GTK+ 2.12.0 to 2.12.1
==

 * Bugs fixed: 
 472965 a small improvement for scrolling behavior with PgUp/PgDown
 460194 Gtk tooltips + swt crash
 478803 Segfault in gtk_print_operation_run when no range specified
 480123 Crash from GTK's new search feature
 483223 im-xim.so leaves callbacks connected to display closed ...
 476342 Icon cache validation causes severe page-in
 484008 configure fails during CUPS version tests on some platforms
 327243 GtkFileChooserButton emits two selection-changed signal...
 465380 gtkfilechooser cannot show the modified date on none UTF-...
 467269 Inkscape Flickers horribly
 476686 gtkrecentchooser select-multiple property
 478173 GTK's Tracker search engine does not work anymore
 478371 totem volume slider appears on all workspaces
 482089 GtkPrintOperation check for null default signal handler b...
 482504 Missing locale to UTF-8 conversion for modification time ...
 482841 critical warnings on gdk_display_close after _gtk_tooltip...
 483563 remains of gtk_widget_ref() in gtkdnd.c
 483730 Keyboard navigation of mutiple-selecting gtk.TreeViews im...
 484650 Typo in docs for GdkGrabBroken
 484730 In MS-Windows theme, GtkBorder freed with g_free() instea...
 486360 Failed to convert Empathy Glade files
 389358 print dialog: unit selection dialog can't be closed
 448343 File chooser should maintain sort state during folder swi...
 477447 GtkPaned documentation doesn't mention behaviour with onl...
 482034 GtkMenuPositionFunc push_in parameter description
 482837 duplicate declaration of gtk_notebook_create_window()
 478637 Notebook tab labels not correctly centered in ms-windows ...
 484132 gtk_recent_info_get_icon docs
 486636 Cannot open display message doesn't include display whe...
 455284 Ctrl+L should work depending if it has focus or not
 478377 10x speed up for window motion/scroll (gdk-quartz)
 485301 Filename is garbled in print dialog on none UTF-8
 485437 Fix testxinerama.c to not query current monitor by default
 486155 Docs for gtk_text_iter_forward_line()
 339877 pixbuf loader incorrectly returns wbmp
 456137 Pidgin will crash in fail-safe session due to a NULL poin...
 456676 Critical warning in gtk_drag_drop_finished()
 352643 crash in gtk_entry_completion_default_completion_func
 477280 volume button docs fix
 477704 Add docs for GtkTreeModelForeachFunc
 476920 Move GtkFileSelection to the deprecated section

 * Updated translations:
 - Arabic (ar)
 - Assamese (as)
 - Belarusian Latin ([EMAIL PROTECTED])
 - Catalan (ca)
 - Estonian (et)
 - Basque (eu)
 - Hebrew (he)
 - Ido (io)
 - Italian (it)
 - Japanese (ja)
 - Georgian (ka)
 - Kannada (kn)
 - Korean (ko)
 - Lithuanian (lt)
 - Dutch (nl)
 - Polish (pl)
 - Romanian (ro)
 - Slovenian (sl)

A list of all bugs fixed in this release can be found at
http://bugzilla.gnome.org/buglist.cgi?bug_id=476342,476686,478173,478637,478803,389358,460194,480123,448343,455284,482837,482504,478371,483563,482089,483223,484008,482841,327243,484650,484730,478377,467269,483730,472965,465380,484132,486360,486636,482034,477447,485301,485437,486155,456137,456676,352643,477280,339877,477704,476920

Thanks to all contributors:
Bill Nottingham
Carlos Garnacho
Chris Lord
Christian Persch
Cody Russell
Daniel Atallah
Emil Nowak
Emmanuele Bassi
Federico Mena Quintero
Geoff Bache
Hans Breuer
Hiroyuki Ikezoe
Jaap A. Haitsma
Jean Brefort
Johan Dahlin
Jonathan Dempsey
Jonh Wendell
Juri Pakaste
Karl Tomlinson
Kristian Rietveld
Loïc Minier
Manish Singh
Matthijs De Smedt

Re: let g_warn_if_fail replace g_assert

2007-10-17 Thread Marco Barisione
Il giorno mer, 17/10/2007 alle 11.56 +0200, Tim Janik ha scritto:
 - add g_warn_if_fail (condition); which produces a critical
warning about failing assertions but contrary to g_assert
returns.

If it's called g_warn_if_fail() I would expect a g_warning() not a
g_critical().

-- 
Marco Barisione
http://www.barisione.org/

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: let g_warn_if_fail replace g_assert

2007-10-17 Thread Brian J. Tarricone
Marco Barisione wrote:
 Il giorno mer, 17/10/2007 alle 11.56 +0200, Tim Janik ha scritto:
 - add g_warn_if_fail (condition); which produces a critical
warning about failing assertions but contrary to g_assert
returns.
 
 If it's called g_warn_if_fail() I would expect a g_warning() not a
 g_critical().

Agreed -- and of course g_return_if_fail() does a g_warning(), so doing 
a g_warning() on g_warn_if_fail() is kinda redundant.  How about 
g_critical_if_fail()?

It's a shame tho that we can't encode the it returns if it fails 
behavior in the name as well -- g_return_if_fail() is very clear what it 
does (IMO, the fact that it also does a g_warning() is a 
debugging-related bonus, not its primary purpose).  g_critical_if_fail() 
sorta sounds like all it does is do a g_critical() if the condition 
fails, and then continues on from that point.  I suppose 
g_critical_return_if_fail() is a bit verbose (esp. when you consider 
g_critical_return_val_if_fail() is even longer).  But I guess good API 
docs will suffice ^_^.

-brian
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list