Re: GTK+ 2.0/3.0 Windows runtimes

2018-10-23 Thread Dov Grobgeld via gtk-app-devel-list
John,

I am maintaining several gtk2 applications for windows that I'm cross
compiling from Linux. I'm using Fedora for the cross compilation and the
way I'm working is as follows:

   - Install the necessary mingw64 packages through dnf
   - Install mingw32-nsis for the generation of a windows Installer for
   your application on Linux.

Compile with the cross compilation environment of your choice. E.g. you can
use automake through the script mingw64-configure . Personally I'm using
scons where I manually set up all the compilation and linkage environments,
etc.

For an example see my image viewer giv at
https://github.com/dov/giv/blob/master/SConstruct .

Regarding gtk3 and gtk2, nobody is removing gtk2 for the foreseeable
future, and you can continue using it as long as you see fit. One of the
"big" cross platform gtk applications, inkscape, is still using gtk2. On
the other hand if you want the new functionality of gtk3, go ahead and
port, and you can cross compile for Windows in the same method.

Regards,

On Tue, Oct 23, 2018 at 10:26 AM John Mills  wrote:

> Hello list
>
> If this question should be raised on another list, please let me know.
>
> I have been developing a C-language GTK+ 2.0 application for MS Windows 10
> using mingw
> cross-compilation on Linux, and deploying it by installing the Windows
> GTK+ 2.0 runtime
> bundle on the Windows machine.
> http://ftp.gnome.org/pub/gnome/binaries/win32/
>
> The procedure was: on Linux development machine, unzip the gtk Windows
> bundle in a directory
> with the C source, set up a Makefile with the appropriate CFLAGS and
> LDFLAGS, 'make mingw'
> and deploy the EXE. This procedure suited my development style.
>
> Do I now need to port to GTK+ 3?
> Is MSYS2 now the best/only way to deploy the dependencies to Windows?
> Using the binaries available through MSYS2/pacman, can I still develop on
> Linux and deploy
> mingw executables to Windows?
> Can anyone point me to a guide for doing that?
>
> Thank you
> John Mills
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Combined search and combobox?

2018-07-28 Thread Dov Grobgeld via gtk-devel-list
Indeed, you were right regarding gtk_comb_box_set_entry_text_column().

For the record, below find a translation into C of your python program.
Here are some enhancements that I thought of, though I highly doubt that
they will be adapted because they are too specialized.

   - Turn it into a widget, that takes a receives of strings in its
   constructor.
   - Add keybindings for the following functionality:
  - Restore the last string input into the entry widget before
  selecting a match i the combo-box. E.g. [Meta-Up], [Ctrl-/]
  - Select next entry matching the last string input. [Ctrl-Up]
  - Select previous entry matching the last string input. [Ctrl-Down]
  - Toggle mathing method between Regular expressions, and partial
  string matches. [Ctrl-=]
   - The special keybindings should also be shown when doing rightclick in
   the enty widget, that should allow the above functionality.

Based on the code below, I have now also created a pull request for
gucharmap: https://github.com/GNOME/gucharmap/pull/2 .

Thanks again!

#include 

#include 


enum {

  COL_FONT = 0

};


void populate_store(GtkListStore *store)

{

int i;


for (i=0; i<100; i++) {

char buf[100];

GtkTreeIter iter;

sprintf(buf, "Font %d", i);

gtk_list_store_insert_with_values(store,

  ,

  -1,

  COL_FONT, buf,

  -1);

}

}


static gboolean

match_function (GtkEntryCompletion *completion,

const gchar *key,

GtkTreeIter *iter,

gpointer user_data)

{

GtkTreeModel *model = GTK_TREE_MODEL(user_data);

char *family, *family_fold;

gchar **sub_match, **p;

gboolean all_matches = TRUE;


gtk_tree_model_get (model,

iter,

COL_FONT, ,

-1);

family_fold = g_utf8_casefold (family, -1);


/* Match by all space separated substrings are part of family string */

sub_match = g_strsplit(key, " ", -1);

p = sub_match;

while (*p) {

gchar *match_fold = g_utf8_casefold (*p++, -1);

if (!g_strstr_len (family_fold, -1, match_fold)) {

all_matches = FALSE;

break;

}

}


g_free (family);

g_free (family_fold);

g_strfreev (sub_match);


return all_matches;

}



static gboolean

completion_match_selected(GtkEntryCompletion *widget,

  GtkTreeModel   *model,

  GtkTreeIter*iter,

  gpointer   *user_data)

{

char *font;


gtk_tree_model_get (model,

iter,

COL_FONT, ,

-1);

printf("selected %s\n", font);

g_free (font);


return FALSE;

}


static void

combo_changed (GtkComboBox *combo,

   gpointer user_data)

{

GtkTreeModel *model = GTK_TREE_MODEL (user_data);

GtkTreeIter iter;

char *font;


if (!gtk_combo_box_get_active_iter (combo, ))

return;


gtk_tree_model_get (model,

,

COL_FONT, ,

-1);

if (!font)

return;


printf("Choosen %s\n", font);

g_free (font);

}



int main(int argc, char **argv)

{

gtk_init(, );

GtkWidget *w_mw = gtk_window_new(GTK_WINDOW_TOPLEVEL);

g_signal_connect(w_mw,"destroy",gtk_main_quit, NULL);


GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING);

populate_store(store);

GtkWidget *w_combo = gtk_combo_box_new_with_model_and_entry
(GTK_TREE_MODEL (store));

gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX(w_combo), COL_FONT);

g_signal_connect (w_combo, "changed",

  G_CALLBACK (combo_changed), store);

  GtkEntryCompletion *completion = gtk_entry_completion_new();

gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (store));

gtk_entry_completion_set_text_column (completion, COL_FONT);

gtk_entry_completion_set_match_func(completion, match_function,
GTK_TREE_MODEL(store), NULL);

g_signal_connect (G_OBJECT (completion), "match-selected",

  G_CALLBACK (completion_match_selected), NULL);


gtk_entry_set_completion (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (w_combo))),

  completion);


gtk_container_add(GTK_CONTAINER(w_mw), w_combo);

gtk_widget_show_all(w_mw);

gtk_main();


exit(0);

}



On Sat, Jul 28, 2018 at 2:34 PM Reuben Rissler  wrote:

>
>
> (gucharmap:30880): Gtk-CRITICAL **: 17:41:07.804: gtk_entry_set_text:
> assertion 'text != NULL' failed
>
> This happens e.g. when I'm using the up down arrows within the text entry.
> Btw, this happens also if I only replace (without setting 

Re: Combined search and combobox?

2018-07-27 Thread Dov Grobgeld via gtk-devel-list
I agree that setting this up is a bit too complex, and it would be nice if
there was a standalone widget that this everything for you.

Meanwhile I tried converting your widget into C (with the intention of
replacing the font selection widget in gucharmap), and something is not
working. I get lots of warnings about:

(gucharmap:30880): Gtk-CRITICAL **: 17:41:07.804: gtk_entry_set_text:
assertion 'text != NULL' failed

This happens e.g. when I'm using the up down arrows within the text entry.
Btw, this happens also if I only replace (without setting up all the
connections), gtk_combo_box_new() with gtk_combo_box_new_with_entry(). I'm
still trying to figure out what went wrong.

Regards,
Dov


On Fri, Jul 27, 2018 at 2:25 PM Reuben Rissler  wrote:

> On 07/27/2018 12:15 AM, Dov Grobgeld wrote:
>
> Thanks. This is exactly what I was looking for! I didn't realize that a
> combobox can be attached to a model, and that a model can be filtered.
>
> Gtk models are powerful, but with great power comes great complexity ;)
>
>
> Imo multiple partial string match should be default behavior, which it is
> unfortunately not. E.g. inkscape only matches in the beginning of the
> string.
>
> Agreed.
>
>
> Is there a GNOME guide line about this?
>
> Not that I have seen in my travels using Gtk.
>
> I came up with this tool out of necessity for my accounting/small business
> system. I never gave it a thought somebody else would find it useful until
> your post to this mailing list. When you posted, I thought you might find
> this interesting. So would this be useful to a wider audience? I don't know
> if the Gtk devs would consider making a special combo with this feature, as
> it seems so easy to setup. After you know how :)
>
> Glad to be of help,
> Reuben
> ___
> gtk-devel-list mailing list
> gtk-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-devel-list
>
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Combined search and combobox?

2018-07-26 Thread Dov Grobgeld via gtk-devel-list
Thanks. This is exactly what I was looking for! I didn't realize that a
combobox can be attached to a model, and that a model can be filtered.

Imo multiple partial string match should be default behavior, which it is
unfortunately not. E.g. inkscape only matches in the beginning of the
string.

Is there a GNOME guide line about this?

Regards,
Dov

On Thu, Jul 26, 2018 at 8:38 PM Reuben Rissler  wrote:

> On 07/26/2018 07:36 AM, Dov Grobgeld via gtk-devel-list wrote:
>
> Is there a widget that combines a searchbox with a combobox?
>
> A use case would be to search for a fontname in a very long font list.
>
> I would like to be able to type a search string, and have the opened
> combobox display only entries that match the typed string. A plus would be
> if it is possible to change how matches take place, e.g. between multiple
> word (like helm-mode in emacs), a regular expression, or an absolute match.
>
> Has someone written anything like that?
>
>
> You didn't specify a language, so here's an example in Python. It uses
> space separated keywords, like in Google search or so. It may not be
> exactly as you requested, but will give you something to start with.
>
> #! /usr/bin/env python3
>
> import gi
> gi.require_version('Gtk', '3.0')
> from gi.repository import Gtk
> import os, sys
>
>
> class GUI (Gtk.Window):
> def __init__(self):
>
> Gtk.Window.__init__(self, title="Combo with search")
> self.model = Gtk.ListStore(str)
> self.populate_model()
> #combobox
> combo = Gtk.ComboBox.new_with_model_and_entry(model = self.model)
> combo.set_entry_text_column(0)
> combo.connect('changed', self.changed)
> #completion
> completion = Gtk.EntryCompletion ()
> completion.set_model(self.model)
> completion.set_text_column(0)
> completion.set_match_func(self.match_func)
> completion.connect ('match-selected', self.match_selected)
> #combobox entry
> entry = combo.get_child()
> entry.set_completion (completion)
> #main window
> self.add (combo)
> self.show_all()
>
> def changed (self, combo):
> _iter = combo.get_active_iter()
> if _iter != None:
> font = self.model[_iter][0]
> print ('You selected combo:', font)
>
> def match_selected (self, completion, model, _iter):
> print ('You selected completion:', model[_iter][0])
>
> def match_func (self, completion, string, _iter):
> for word in string.split():
> if word not in self.model[_iter][0].lower(): #search is always
> lower case
> return False
> return True
>
> def on_window_destroy(self, window):
> Gtk.main_quit()
>
> def populate_model (self):
> for i in range (100):
> self.model.append(["Font %d" % i])
>
> def main():
> app = GUI()
> Gtk.main()
>
> if __name__ == "__main__":
> sys.exit(main())
>
>
> Reuben
>
>
> ___
> gtk-devel-list mailing list
> gtk-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-devel-list
>
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Combined search and combobox?

2018-07-26 Thread Dov Grobgeld via gtk-devel-list
Is there a widget that combines a searchbox with a combobox?

A use case would be to search for a fontname in a very long font list.

I would like to be able to type a search string, and have the opened
combobox display only entries that match the typed string. A plus would be
if it is possible to change how matches take place, e.g. between multiple
word (like helm-mode in emacs), a regular expression, or an absolute match.

Has someone written anything like that?

Regards,
Dov
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: IDE to develop app with GTK3 on windows using MSYS2

2018-05-07 Thread Dov Grobgeld
Why don't you cross compile from Linux to Windows?

I have for years maintained several gtk based applications, including the
building of installers for windows through make-nsis, and done everything
from Linux.

Regards,
Dov

On Mon, May 7, 2018 at 10:30 AM, arkkimede  wrote:

> Hi!
> I need an advice:
> I written apps on Linux with GTK3 using essentially vi and Makefile to
> build the project splitten in multiple C files with the corresponding H
> file.
>
> Now I would migrate on WIndows 10 by means of MSYS2.
>
> There is an IDE (better if open source) that I can use instean to follow to
> use vi?
> I tried Code Blocks but the wizard to build project with GTK support only
> GTK2.
> I asked support and I received suggestions but at the moment I'm not able
> to using C::B to build an app with GTK3 on WIndows 10.
> Thank you for any advice and suggestion.
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: double_buffered and scrolled_window

2018-04-16 Thread Dov Grobgeld
Hi Emmanuele and thanks for the detailed reply. Boy, do I feel like I
flunked the widget writing class. :-)

I'll take all your recommendations into consideration as time allows.

I realize that gob is dead. I should be going to pure C instead. I can't
even use the straight gob output, but have to patch it before compiling

You are correct that I copied the window creation code from the
GdkDrawingArea widget. I'll correct it based on the CustomWidget tutorial.

Regarding GdkPixbuf, Indeed I'm composing the whole image before shipping
it to the screen. I currently do this for two reasons. One is that I want
to be able to do nearest neighbor scaling, instead of bilinear scaling,
when zooming up images. But perhaps this is possible with cairo as well?
The second reason is that I'm still using agg for drawing vector graphics
instead of cairo. A few years back when I compared the speed, of the two I
found agg to be much faster than cairo, but perhaps that has changed now?

Regarding, the gestures, is there a tutorial of how to use them? The
CustomWidgets tutorial mentions them, but then goes on to describe the
button and motion notify events.

Thanks again!
Dov


On Mon, Apr 16, 2018 at 12:41 PM, Emmanuele Bassi <eba...@gmail.com> wrote:

> On 16 April 2018 at 10:19, Dov Grobgeld <dov.grobg...@gmail.com> wrote:
>
>> Hi all,
>>
>> After lots of years I finally got around to porting my widget
>> GtkImageViewer to gtk3. After doing lots of reading of man pages, did I
>> realize that i can turn off double buffering.
>>
>
> I wonder what kind of man pages did you read, considering that the API
> reference of gtk_widget_set_double_buffered() clearly states that it's
> deprecated and doesn't do anything remotely useful:
>
> https://developer.gnome.org/gtk3/stable/GtkWidget.html#
> gtk-widget-set-double-buffered
>
> You should *never* disable double buffering — and you should never need
> it. Double buffering is an intrinsic characteristic of the windowing
> system; if you disable it, it means you're literally owning the rendering
> pipeline — which is why it's still used by applications that render their
> own UI inside a GTK top level, like Firefox or LibreOffice. Given their
> user base, we try to avoid breaking their use cases, but we do not really
> recommend other people try doing that.
>
> GTK widgets should always use the rendering pipeline provided by GTK, not
> work around it; we do not make any guarantees if you decide to eschew that.
>
> I honestly couldn't read your code because it's using Gob — something that
> has long since been deprecated and it's not even remotely up to date with
> the GObject and GTK best practices. From what I could glean:
>
>  - it seems you started from the GtkDrawingArea code, which has some
> backward-compatibility functionality, like a custom window and the need to
> send configure events; those are not needed in newly written code
>  - you're not using the GTK 3.22 API; for instance, you should be calling
> gtk_widget_register_window() when creating a new GdkWindow inside the
> realize() function
>  - you're still using GdkPixbuf to do scaling and compositing, instead of
> using Cairo
>  - you're using a client input/output GdkWindow for rendering, instead of
> rendering directly on the parent's surface
>  - you're using a background color and compositing it, instead of using
> the style system to render the background and border
>  - you should be using the Gesture API, instead of connecting to each
> event in order to do zoom and scroll
>
> There is a wiki page on how to write widgets:
> https://wiki.gnome.org/HowDoI/CustomWidgets
>
> Ciao,
>  Emmanuele.
>
> --
> https://www.bassi.io
> [@] ebassi [@gmail.com]
>
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Fwd: double_buffered and scrolled_window

2018-04-16 Thread Dov Grobgeld
Hi all,

After lots of years I finally got around to porting my widget
GtkImageViewer to gtk3. After doing lots of reading of man pages, did I
realize that i can turn off double buffering. I did it, and everything
worked fine, except for one artefact. Once I turned it off, the scrolled
bars of the parent widget GtkScrolledWindow, would no longer be shown.

Is this a bug? Or am I missing something.

The widget can be found in http://github.com/dov/gtkimageviewer , branch
gtk. The application giv, built around gtkimageviewer may be found in
http://github.com/dov/giv , branch gtk3.

Regards,
Dov
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Re-drawing GtkDrawingArea surface on motion-notify-event

2017-03-20 Thread Dov Grobgeld
The key is to not draw directly, but to invalidate one or more rectangles
needed to for changing the image from the old to the new one.

I worked on this problem some years ago and I think my solution is very
relevant to your question.

See the gtk3 branch at: https://github.com/dov/dovtk-lasso .

Regards,
Dov

On Mon, Mar 20, 2017 at 9:25 PM, Marcin Kolny 
wrote:

> Hi everyone,
> I'd like to write very simple application for drawing lines.
>  1) User press button - app saves x and y coordinates
>  2) User moves the mouse - app dynamically draws potential line on each
> mouse move event
>  3) User releases button - app "saves" the line on the canvas.
>
> I've tried to modify slightly the GTK example drawing application [1].
>  1) On button press event I paint the current state to the "base_surface"
> surface.
>  2) On each mouse move I paint to the "tmp_surface" surface "base_surface"
> and after that the actual line, so I avoid multiple lines on mouse move.
>  3) On mouse release event I paint "tmp_surface" surface to "base_surface".
>
> This works, and full code can be found on my gist [2]. However, I don't
> think it's the right approach, since I have to re-paint a whole image for
> each mouse-move, and latter on, on "draw" event application is doing almost
> the same, so I'm doing the re-paint twice per each mouse move. I'm afraid
> that for huge surfaces it might be very inefficient.
>
> Do you know what would be the right approach to solve this sort of
> problems?
>
> Thank you for help,
> Marcin
>
> [1] https://developer.gnome.org/gtk3/stable/ch01s05.html
> [2] https://gist.github.com/loganek/156b6b9ce2333fd7d389f74c093a92b4
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Re[4]: Compiling for Windows [Was: argv revisited]

2016-05-05 Thread Dov Grobgeld
Note that if you are using fedora (and possibly other Linux distributions)
it comes with lots of win32 packages precompiled. E.g. all you need to do
to get gtk2 and its dependencies is to do:

   dnf install mingw32-gtk2

You can then compile your gtk programs for windows through cross
compilation and generate a windows install file for your application
through nsis. All your grandma then needs to do on windows is to run the
installer.

I have been doing this for several applications for several years, and the
process is so smooth and reliable that I only do the testing on Linux
before compiling and distributing for Windows.

Regards,
Dov

On Thu, May 5, 2016 at 8:30 PM, Andrew Robinson  wrote:

> On 5/5/2016 at 10:23 AM, Lucas Levrel  wrote:
> >Le 5 mai 2016, Andrew Robinson a écrit :
> >
> >> So if I don't want to make my on copy of the GTK+ libraries,
> >
> >Why wouldn't you want to build your static libs for future inclusion in
> >your software? Where "build" is for "let the Makefile of MXE do all the
> >work needed to build".
>
> 1) Because there are between 40 to 120Mb worth of libraries or their
> dependencies I would have to post on my website.
>
> 2) You could get under 40Mb, if you are only going to use one function from
> one or two libraries, and you don't want the user to have any features like
> skinning.
>
> (I am going to reference Allegro here, only just for comparison sake)
>
> 3) If I do compile GTK myself, I will have to maintain all that huge
> amount of
> source code on my website, per the licensing agreement. If I use Allegro,
> I do
> nothing else unless I customize the source code, only then will I have to
> post
> source code.
>
> 4) Furthermore, I would have to answer questions on why users couldn't
> compile
> the source code for making GTK+ for Win32 on Windows7 (or 8 or 10 or XP),
> something the GTK community has been unwilling to do itself. With Allegro,
> I
> literally simply download DevC++ for Windows7, select DevPak to download
> Allegro, compile, and you are done! Compare that to GTK: Downgrade your
> Visual
> Studio to version 2013, install GIT if you don't already have it, clone the
> GTK repository, install a minimalistic Linux environment like MSYS2,
> install
> MinGW, spend a few days trying to get to know these things, try compiling a
> Win32 version of GTK+ using half-arse written instructions, if that doesn't
> work try installing and using MXE, if that doesn't work follow the terse
> instructions posted on an almost hidden website at Nachos blog, if you are
> still having problems, go to the GTK developer forum where they won't give
> you
> any help, ... etc
>
> The setting up the development environment for GTK relies on lots and lots
> of
> esoteric command line parameters, and it seems like no two computers use
> the
> same exact parameters. Developing on Windows for Windows is super easy and
> user friendly, whereas developing on Windows for GTK is not. Windows forums
> are not really friendly either, but they are much more friendly than the
> Linux
> forums are, and anyways I can avoid the forums because there is so much
> code
> and advice posted on the Internet for Windows, that it is hard not to find
> what you are looking for, no matter how esoteric your needs are.
>
> >> I must tell grandma and grandpa to get their own copy of MSYS2 and MXE,
> >(not Msys2, MXE will do all the needed download)
> >> and provide make their own copy of GTK+ for Win32. Wouldn't that be easy
> >> and fun?
> >
> >All the more as they would have to install Linux beforehand!
>
> That attitude is one of the reasons I chose to abandon Windows ... you
> sound
> just like Satya Nadella trying to pawn Windows 10 off to the world. If
> Linux
> was so great, people would already be using it in droves, instead of barely
> mustering 3% of the entire market.
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Compiling for Windows [Was: argv revisited]

2016-05-03 Thread Dov Grobgeld
Another equivalent scons-based way of compiling for windows with gcc is
shown in my program giv.

See: https://github.com/dov/giv/blob/master/SConstruct

SCons uses the Sconstruct files to do the cross-compilation and also calls
out to nsis to create a windows installer.

The complete gtk run time is only about 20MB in size (at least for gtk2)
which with todays hard disk sizes really is negligable, so I agree that
there is no reason to try to create a common gtk runtime.

I still remember the frustration back in the days when there was a common
run environment and installing glade would make inkscape or gimp fail, or
vice verse. Individual run time environments is really the way to go!

For a peak into the bad old days, see e.g. the following thread:
http://comments.gmane.org/gmane.comp.gnome.gtk%2B.general/16828


Regards,
Dov

On Tue, May 3, 2016 at 7:44 PM, Allin Cottrell  wrote:

> On Tue, 3 May 2016, Dave Howorth wrote:
>
> On 2016-05-03 16:57, Florian Pelz wrote:
>>
>>> I'd like to have one standard GTK+ installer for the GTK+ DLLs etc. that
>>> can be downloaded and installed from other installers, so there is just
>>> one GTK+ installed on Windows instead of one copy of perhaps different
>>> versions of GTK+ for each application.
>>>
>>
>> That's been a longstanding desire of many people. The other side of the
>> argument of course is that all the applications have to be compatible with
>> that particular version of the libraries, which has sometimes proven to be
>> problematic even when the libraries ship with Windows. Expecting every
>> application to be updated every time there is a library update is not
>> realistic. It's not like a linux distro where the distro can update and
>> recompile all the dependencies itself.
>>
>
> Yep, Florian's desire is a "natural" one from the point of view of anyone
> used to Linux but unfortunately it's totally impractical on MS Windows.
> It's a real No-No for any third-party package to install DLLs into system
> directories on Windows; this would likely break all sorts of things.
>
> It may seem like a terrible waste of disk space to install multiple
> per-application copies of GTK, but you just have to get over it. Basically
> the same on Mac OS X.
>
> (I might note: even on Linux, GTK updates are not necessarily harmless.
> For example, updating from GTK 3.18 to 3.20 breaks emacs and gnumeric; they
> still run, but they're damaged.)
>
> Allin Cottrell
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Directional Images

2013-10-16 Thread Dov Grobgeld
No, I don't think it is universally reasonable. Because in general an icon
may have a style that is broken when the image is flipped. Imagine e.g. if
the buttons in some style contains arrows that were drawn with an
elliptical pen slanted at 45 degrees to the right. In such a case the left
and the right arrow are not a mirror image of one another. Another example
is if the style contains a drawing with dropshadow to the right.
Horizontally flipping the image would put the drop shadow to the left,
which would be inconsistent with the rest of the theme. You may claim that
if this was done throughout the application then it wouldn't make any
difference, but if e.g. have an embedded label with Latin name:  and an
LTR widget then it would be inconsistant within the application. Even
between applications that have either LTR or RTL directionality on the
desktop would look inconsistent.

Thus, imo there is no automatic solution, but you need to create dedicated
RTL images to make things look good in a RTL environment.

Regards,
Dov


On Wed, Oct 16, 2013 at 11:58 PM, fr33domlover fr33domlo...@mailoo.orgwrote:

 Hello Gtk+ developers,

 My native language is an RTL language. I've been examining several RTL
 problems in GNOME software recently, and I noticed some recurring
 patterns.

 Some of them are related to text alignment and fonts, which I won't talk
 about this time because I haven't found a universal solutio. But I think
 I did find a solution for images.

 It is very common for images where the direction matters, such as
 prev/next arrows, to be in the wrong direction when apps run in RTL
 locales. So far, a volunteer has been fixing these problems by hand by
 sending patches to all GNOME software containing the problem. For
 example, the prev/next arrows in Epiphany and in Evolution's
 notification-bar bubble.

 Here are some related bugs:

 https://git.gnome.org/browse/rhythmbox/commit/?id=eb4641a127828a0fa567eb19c26c66ff7f3b2f52

 https://git.gnome.org/browse/totem/commit/?h=gnome-3-10id=9055f411d2332c43c725ccbb88f5f7c240885e91
 https://git.gnome.org/browse/totem/commit/?h=gnome-3-10id=3ff23cf41e0192860ee2ad5c70c99c3c4d024196


 Instead of doing it by hand, or trying to teach developers how to make
 their apps direction-aware, I found a universal solution which requires
 a bit of work once, and will work after that without any developer
 intervention.

 The idea is: Directional Images.

 Example: An arrow is a directional image. The direction of the arrow
 matters. When an arrow icon is rendered in RTL locales, it should be
 rendered horizontally flipped, so right becomes left and left becomes
 right.

 A folder image is a non-directional image. Changing its direction
 doesn't make any sense or different in any direction or locale. The same
 is true for people's faces, an image of the Earth, a map of a city, etc.

 The solution I suggest is to add a directional boolean property to
 GTK's image class used for icons. The property will be stored as image
 metadata, and set by the designer of the image. After that, the code
 which renders the menu/toolbar icons will just need to check if the
 image is directional and the locale is RTL. If both are true, draw the
 image horizontally flipped. Otherwise, draw as usual.

 I believe it shouldn't take extra resources, because the drawing loop
 will simply need to fill pixels from the other side. No extra processing
 is required (unless computing size - x in each loop iteration is too
 much slower than just x, which I doubt).

 Is it possible? Does it sound a reasonable approach?



 fr33domlover

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

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


Re: Output Widgets

2013-10-07 Thread Dov Grobgeld
Please define what you mean with an output widget. All widgets are output
widgets in a sense, but e.g. GtkLabel is an output label for text messages
(and images).


On Mon, Oct 7, 2013 at 12:44 PM, Mahesh Chaudhari 
mahesh.chaudh...@ymail.com wrote:

 Are there any output widgets available with GTK+-2.0
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


Re: Mouse events on a Cairo Context

2013-07-01 Thread Dov Grobgeld
There is another solution that I have used extensively, which is to draw
the cairo commands twice. Once for the actual drawing, and once again in an
offline image (called label image), with the following differences:

   1. Use solid colors corresponding to labels of the different graphical
   components.
   2. Turn off anti-aliasing.

When the user clicks on the image, the x,y of the event is referenced in
the label image. The label is then used as a lookup to the component which
can be modified.

You can see an example of how to do this at
https://github.com/dov/dovtk-lasso . Note that there is a special gtk3
branch.

Regards,

Dov


On Mon, Jul 1, 2013 at 7:54 PM, Stefan Salewski m...@ssalewski.de wrote:

 On Mon, 2013-07-01 at 17:42 +0200, Borja Mon Serrano wrote:

 
  The problem with (4) is dragdrop. I think it could be very difficult to
  deal with it, so I'm going to try the third solution, with goocanvasmm.
 Do
  you know any example of use of goocanvasmm?
 

 Yes, dragdrop may be not very easy.
 And zooming and panning/scrolling for a plain (cairo) drawing area may
 be not really trivial, when you need to grab objects with the mouse.
 I did try it two years ago from Ruby -- not really difficult, but it
 takes some time to get the math right. Have not found time to clean it
 up yet. ( http://www.ssalewski.de/PetEd.html.en)

 Of course, if you do C++ and have not much experience in GTK already you
 may try

 https://qt-project.org/doc/qt-4.8/graphicsview.html

 I have never find time and motivation to test that.

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

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


Re: Fulscreen mode

2013-06-16 Thread Dov Grobgeld
You just need to use gtk_widget_hide() on the widget and it and its child
widgets will not be shown.


On Sun, Jun 16, 2013 at 4:28 AM, John Coppens j...@jcoppens.com wrote:

 Hi...

 I created a program with three elements in an HBox (gtk2): two
 treeviews and a GtkGlExt drawing area. I'd like to toggle the drawing
 area fullscreen/normal. Ie., not show the treeviews (or any other
 element - such as menus) while in fullscreen mode. Is that possible
 somehow?

 Thanks for any suggestion...

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

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


Copy full path when hovering over a file?

2012-07-02 Thread Dov Grobgeld
Is there any keybinding that allows copying into the clip-board the full
path of a filename that you hover over in the file chooser dialog? E.g.
when looking at the Recent file menu, there is a tooltip popup of the
full path of a file. Is it possible to copy the contents of this tooltip so
that you can later paste it as text?

Thanks!
Dov
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: pango or any other way to format text

2012-05-14 Thread Dov Grobgeld
See http://developer.gnome.org/pango/stable/PangoMarkupFormat.html for the
syntax for subscripts and superscripts.

Regards,
Dov

On Mon, May 14, 2012 at 3:38 PM, David Nečas y...@physics.muni.cz wrote:

 On Mon, May 14, 2012 at 08:20:26PM +0800, Rudra Banerjee wrote:
  Can anybody please take some time to show me simple way of
  implementing pango formatting to get greek letters, subscripts and
  superscripts in gtk2+?

 What do you mean by ‘implementing Pango formatting'?  I suppose you are
 not writing a Pango backend, i.e. you are not *implementing* any text
 rendering yourself.

 If you just want to use Pango to render Greek text, subscripts,
 superscripts, Cyrillic, math symbols or whatever, use UTF-8:

 GtkWidget *label = gtk_label_new(ἀπὸ τοῦ ἡλίου μετάστηθι);

 or

 GtkWidget *label = gtk_label_new(a² + b² = c²);

 That's it.

 Function gtk_label_set_markup() with Pango markup

http://developer.gnome.org/pango/stable/PangoMarkupFormat.html

 can be used for more complex indexes and exponents and other stuff in
 labels.

 Yeti

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

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

Re: GtkButton bg color

2012-04-30 Thread Dov Grobgeld
The following, though a bit old and referring to perl, might still help:

http://gtk2-perl.sourceforge.net/doc/yapc-2004-perl-gtk2/slides.html

Regards,
Dov

On Sun, Apr 29, 2012 at 20:41, Steve iteratio...@gmail.com wrote:

 I'm using linux. I've tried dozens of different methods and a few
 examples which seem to suggest that they will change the background but
 noting works.

 I scrapped all that code and started over from scratch. I can change
 the fg color with no problems but i can't seem to get anything to work
 with the bg color


 Any chance you can provide an example of a button with a background
 color?


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


Re: GtkTextView and bidi text

2012-04-24 Thread Dov Grobgeld
Sorry for not being clear. I actually meant that it should be controllable
by the programmer.

Looking at the documentation for GtkTextTag I realized that there is a
property direction, that by default has the value GTK_TEXT_DIR_NONE .
What happens if you change it to GTK_TEXT_DIR_LTR? Will it not override the
automatic calculation of the base direction? If not, it is a bug that can
easily be fixed. I can think of no other use for this property that makes
sense.

And you are never helpless as long as you have the source. Of course you
have a complexity barrier and learning curve. But it is much better than
the being blindfolded. ;-)

Regards,
Dov

On Tue, Apr 24, 2012 at 23:36, Ferdinand Ramirez 
ramirez.ferdin...@yahoo.com wrote:

 --- On Mon, 4/23/12, Dov Grobgeld dov.grobg...@gmail.com wrote:

  Lots of years ago we spoke about having a direction override as a
 paragraph
  attribute, but we never got around to implementing it.

 I think it is a good idea to give control to the programmer rather than
 make it automatic.

 Making everything automatic and making the programmer feel helpless is the
 Microsoft way. There, now that I've insulted you, I am sure you will
 consider adding this feature. :-)

 Seriously, this should not even be at the paragraph level, but in the
 complete control of the programmer. The programmer should be able to set
 the direction and this should hold until it is set again. Even if the
 automatic direction detection exists, there should be the ability to
 override it.

 -Ferdinand

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


Re: GtkTextView and bidi text

2012-04-23 Thread Dov Grobgeld
Indeed there is no higher level override determine the text direction. You
have to change the buffer contents to get what you want. The easiest way of
doing this is by inserting the character zero-width character LRM (U+200E)
before your first RTL character.

Lots of years ago we spoke about having a direction override as a paragraph
attribute, but we never got around to implementing it.

Regards,
Dov

On Tue, Apr 24, 2012 at 01:33, Ferdinand Ramirez 
ramirez.ferdin...@yahoo.com wrote:

 How can I force GtkTextView object to use left to right rendering when I
 type in a character which has the default behavior of being from a RTL
 language? I need this behavior when I mix some RTL characters with LTR
 characters and the first character on a line is of RTL type.

 The following lines seem to have no impact.

 GtkTextView *view;
 ...

 gtk_widget_set_direction(view, GTK_TEXT_DIR_LTR);
 gtk_widget_set_default_direction(GTK_TEXT_DIR_LTR);

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

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


Re: porting Xlib/Motif apps to GTK+

2012-02-29 Thread Dov Grobgeld
On Wed, Feb 29, 2012 at 01:17, Roger Davis r...@soest.hawaii.edu wrote:

  [stuff deleted]

Does Cairo have a way
 of mimicking an X11 XOR-op GC for doing low-overhead ephemeral drawing ops
 of rubberband-lines, etc.?

 I have over the years been intrigued of how to do flicker free rubberband
selection with gtk/cairo. My current solution may be seen here:

https://github.com/dov/dovtk-lasso

Feel free to poke me if you need more explanations and more documentation
of how it works.

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


Re: Announce: glib-jsonrpc

2012-01-04 Thread Dov Grobgeld
Thanks for your comments. Though I am agreeing with most of them, I am
unlikely to implement them on my own, as I am mostly interested in
remote controlling my own applications in situations where I am in
control of both the server and the client.

(I have just implemented such control in my image viewer giv
(https://github.com/dov/giv), which also gives an example of an
asynchronous call, pick_coordinate, that waits for the user to click
somewhere in the image and returns the chosen coordinate.)

On the other hand I have fixed some thread bugs in the asynchronous
callbacks, and now it seems to work, both under posix and Windows.

So feel to pick apart, clone, or ignore any of my code.

Regards,
Dov

On Wed, Jan 4, 2012 at 19:42, Christian Hergert ch...@dronelabs.com wrote:

 On Wed, 2012-01-04 at 11:40 +0100, Joakim Sindholt wrote:
  No flames, just reminding you that there is a specification and we
  should adhere to it 100%, or in some cases maybe even be liberal (see
  my
  json_rpc_bridge_{request,notify}_verbatim, which I put in both for
  performance and non-conforming 3rd party reasons)

 My mistake, I didn't realize there was a spec for this. In that case, it
 is not what I'm looking for.

 -- Christian


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


Announce: glib-jsonrpc

2011-12-26 Thread Dov Grobgeld
I created jsonrpc client/server (http://json-rpc.org/) library through
glib/gio for remote controlling my application. It is available at:

https://github.com/dov/glib-jsonrpc

Comments and contributions are welcome.

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


Re: Announce: glib-jsonrpc

2011-12-26 Thread Dov Grobgeld
It would be nice to compare and perhaps merge the two projects. Any
chance of you putting it up on a git repo?

Regarding async commands, my glib server does support it through the
glib_jsonrcp_register_async_command(). There is an example in
test-glib-jsonrcp-server as follows:

 glib_jsonrpc_server_register_async_command(server,
 async_ping,
 cmd_async_ping,
 NULL);

and then in cmd_async_ping:


  int cmd_async_ping(GLibJsonRpcServer *server,
 const char *method,
 JsonNode *params,
 gpointer user_data)
  {
g_timeout_add_seconds(2, async_pong, server);

return 0;
  }

  gboolean async_pong(gpointer data)
  {
GLibJsonRpcServer *server = (GLibJsonRpcServer*)data;
JsonNode *response = json_node_new(JSON_NODE_VALUE);
json_node_set_string(response, async_pong);

glib_jsonrpc_server_send_async_response(server,
response);
return 0;
  }

The catch is that the async command has to return immediately, but it
can launch a long command through the g_timeout_add() or g_idle_add().
This is also necessary if you want to update the gui, which runs in
different thread.

Regards,
Dov

On Tue, Dec 27, 2011 at 09:20, Joakim Sindholt opensou...@zhasha.com wrote:
 I've been writing a JSON-RPC library but it went on hold due to school.
 It's not up on a public git repo right now but it's a tad more feature
 complete than yours. I was working on supporting all encodings when I
 last left off.

 On Tue, 2011-12-27 at 06:52 +0200, Dov Grobgeld wrote:
 I created jsonrpc client/server (http://json-rpc.org/) library through
 glib/gio for remote controlling my application. It is available at:

 https://github.com/dov/glib-jsonrpc

 Comments and contributions are welcome.

 Regards,
 Dov

 One thing that's indispensible for JSON-RPC is async calls. Regardless
 of whether you want to collaborate on this, you really need async
 methods.


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


Re: Announce: glib-jsonrpc

2011-12-26 Thread Dov Grobgeld
ׂThanks! I'll have a look when I find some free time.

Dov

On Tue, Dec 27, 2011 at 09:40, Joakim Sindholt opensou...@zhasha.com wrote:
 Made a github repo. It's very much a WIP and I can't remember offhand
 exactly what's connected and what's not.

 https://github.com/zhasha/json-rpc-glib

 On Tue, 2011-12-27 at 09:30 +0200, Dov Grobgeld wrote:
 It would be nice to compare and perhaps merge the two projects. Any
 chance of you putting it up on a git repo?

 Regarding async commands, my glib server does support it through the
 glib_jsonrcp_register_async_command(). There is an example in
 test-glib-jsonrcp-server as follows:

      glib_jsonrpc_server_register_async_command(server,
                                              async_ping,
                                              cmd_async_ping,
                                              NULL);

 and then in cmd_async_ping:


   int cmd_async_ping(GLibJsonRpcServer *server,
                      const char *method,
                      JsonNode *params,
                      gpointer user_data)
   {
     g_timeout_add_seconds(2, async_pong, server);

     return 0;
   }

   gboolean async_pong(gpointer data)
   {
     GLibJsonRpcServer *server = (GLibJsonRpcServer*)data;
     JsonNode *response = json_node_new(JSON_NODE_VALUE);
     json_node_set_string(response, async_pong);

     glib_jsonrpc_server_send_async_response(server,
                                             response);
     return 0;
   }

 The catch is that the async command has to return immediately, but it
 can launch a long command through the g_timeout_add() or g_idle_add().
 This is also necessary if you want to update the gui, which runs in
 different thread.

 Regards,
 Dov

 On Tue, Dec 27, 2011 at 09:20, Joakim Sindholt opensou...@zhasha.com wrote:
  I've been writing a JSON-RPC library but it went on hold due to school.
  It's not up on a public git repo right now but it's a tad more feature
  complete than yours. I was working on supporting all encodings when I
  last left off.
 
  On Tue, 2011-12-27 at 06:52 +0200, Dov Grobgeld wrote:
  I created jsonrpc client/server (http://json-rpc.org/) library through
  glib/gio for remote controlling my application. It is available at:
 
  https://github.com/dov/glib-jsonrpc
 
  Comments and contributions are welcome.
 
  Regards,
  Dov
 
  One thing that's indispensible for JSON-RPC is async calls. Regardless
  of whether you want to collaborate on this, you really need async
  methods.
 
 


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


Re: Simple Html-View widget

2011-09-11 Thread Dov Grobgeld
Just use gtk_label_set_markup().

Regards,
Dov

On Sat, Sep 10, 2011 at 20:35, Craig craigbakal...@verizon.net wrote:

 Hi,

 I am not expert on this issue, but isn't Pango the way to go.  I think
 you should look up the Pango functions or how gtk deals with the Pango
 thing.

 Craig Bakalian

  Hello,
 
  in my application I store some Text data in xml files.
  Some nodes are displayed via a gtk-label or an gtk-entry, others are
 displayed via a gtk text-view.
 
  Now I want to extend the text-view (and storage) with the capability to
 handle some formated text.
  I just need things like bold text, linefeed, maybe headers and colors.
  Since I don't want to create a own text storage format and I am using
 already xml for text storing
  html would be nearby.
 
  Is there some Gtk-Widget like the textview/buffer which can render simple
 HTML Tags?
  If not, what is your recommendation for my problem.
 
  regards
 Arne


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

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


Re: Please don't drop support for Curve

2011-05-04 Thread Dov Grobgeld
I suggest that you learn how to create your own widget. A widget like
GtkCurve is very easy to develop by subclassing one of the canvas widgets,
e.g. GooCanvas. Or do it directly through Cairo on a GtkDrawingArea. This is
described here:

http://live.gnome.org/Vala/CustomWidgetSamples

Regards,
Dov

On Wed, May 4, 2011 at 13:22, Charlie De charlieco...@yahoo.com wrote:

 Hello all,


 I've joined up with this list for one single reason: to ask the developers
 to
 re-consider and reverse their decision to deprecate and eventually remove
 the
 Curve widget from GTK+.

 Recently, I learnt to create Python scripts, and with the help of Glade,
 created
 a GUI to ImageMagick routines, for my own proprietary photo editor. The
 Curve
 widget was absolutely central to this endeavour. The only downside is that
 it is
 basic and not very well developed.

 To me, the reasons given for this widget being deprecated, that it isn't
 very
 useful and only appeals to a minority of users, sounds disingenuous and
 hurtful
 to the easy usefulness of GTK+. What do you expect users to do in its
 absence?
 Do you really expect users to go breaking their knuckles to try and create
 a
 curve dialog with a drawing area? How could you see such progress as
 anything
 but a step backwards?

 So please, hear a busy user who has taken the trouble of registering here
 to
 offer feedback: do not drop this essensial component of GTK+, and instead
 of
 deprecating it, continue its development. You can drop Gamma Curve if you
 like,
 which is too idiosyncratic to be of much use. What is needed instead is the
 Curve offering point data - the points on the curve that the user creates -
 being able to be read and manipulated by other widgets, such as the
 numerical
 scroll boxes. (Rather like the Curves dialog in Photoshop.) And I'm sure
 there
 are other improvements that could be made.

 If on the other hand you insist on dropping the Curve, then when the time
 comes
 I guess I'll have to switch to another widget toolset, whichever will still
 be
 offering a Curve interface element. I can't even begin to image how long it
 would take me to create the widget manually - it frankly strikes me as an
 insane
 and pointless effort.

 Thank you for your attention and best wishes with your continuing good
 work.
 What you have created in GTK+ (and pyGTK) is greatly appreciated and
 wonderfully
 useful.

 All the best,

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

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


Re: GTK+INSTALLATION IN WINDOWS

2011-05-01 Thread Dov Grobgeld
One way of doing this is as follows:

   - Cross compile for windows from Linux. E.g. on Fedora, this may be done
   by installing the mingw32* packages.
   - Install the cross compiled makensis package to create an installer for
   Windows under Linux.
   - Run the installer under Windows installing your application and all the
   gtk packages.

You can refer to the SConstruct file and the nsis file of my program giv at:

http://git.gnome.org/browse/giv

Too see how I do it.

Regards,
Dov

On Tue, Apr 26, 2011 at 00:39, AKSHAT MALTARE akshat.malt...@gmail.comwrote:

 RESPECTED SIR,MADAM,
  I am using gtk+ in my c,c++
 code to develop a cross platform application and have created my gui
 using gtk+ in linux and now i just want to test those codes for
 windows.I had been trying to install gtk on windows from last two days
 but due to lack of details abt installation process i am unable to
 install it as I do not have much experience of using commands of
 windows
  so it would be very helpfull
 if you could tell us the step by step procedure of installing packages
 or reffer us some website where we could find it.

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

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


Re: Program Files folder

2011-04-21 Thread Dov Grobgeld
There is no such thing as default folder under Linux/Unix. The user might
want to install an application in her home directory, or in /opt, or in
/usr/bin depending on permissions or the visibility of the application.
Perhaps you meant to ask if it is possible to know where the application was
run from? In that case just check argv[0].

Regards,
Dov

On Thu, Apr 21, 2011 at 11:00, John Emmas john...@tiscali.co.uk wrote:

 I know that glib offers a function called g_get_home_dir() which returns
 the user's home folder on the relevant platform.  Is there any similar
 function that will give me the default folder for installing applications?
  For example, on Windows this would return C:\Program Files.  On Linux it
 might be /bin or /usr/bin or /usr/local/bin etc.  And on OS-X it would
 be /Applications.

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

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


Re: Loading postscript file

2010-12-26 Thread Dov Grobgeld
As far as I know (but perhaps someone else knows better) the only freely
available postscript interpreter is ghostscript (which is used by gv).
Ghostscript is distributed under the GPL license which prevents Gtk, which
is distributed under the LGPL, to depend on it. The easiest way round this
is simply to run system() ghostscript as a subprocess and have it output a
raster file, e.g. in the pnm format, and then load this file into your gtk
program.

Here is the command line I've been using for this in the past:

gs -q -dNOPAUSE -g100x200 -r75x75 -sDEVICE=ppmraw -sOutputFile=foo.pgm
trans.ps myfile.ps quit.ps

where trans.ps encodes of the shift and rotation of the file myfile.ps

Hope this helps.

Regards,
Dov

On Mon, Dec 27, 2010 at 05:10, tengfei tfco...@gmail.com wrote:

 Hello all.

 I want to render a postscript file (as gv does) in a Gtk+ program. I
 tried the image widget by the function gtk_image_new_from_file, but it
 didn't work. Can anyone help regarding this?

 Regards,

 Colin


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

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


Re: GTK Error handling..

2010-11-24 Thread Dov Grobgeld
If all you want is a popup, then you might as well create a new process
instead of a new thread. There is no advantage of using a thread as it does
not seem like you want to pass any info between the window and the
monitoring loop. Further, the way you described it, if more than one event
occurs, then you will be spawning two threads that does calls into GUI. This
is a big no-no as gtk is not multi-threaded, and only a single thread may do
graphics related calls.

Regards,
Dov

On Wed, Nov 24, 2010 at 15:01, Jaroslav Šmíd jardas...@gmail.com wrote:

 GTK is not smart toolkit and is unable to work without X display and is not
 even able to reconnect to different display (or to the same later) when the
 connection get lost. This is with all X based toolkits I know of - it just
 seems easier for developers to just call exit() then to install like timer
 to event loop which would try to reconnect. This way it works on Windows -
 GUI applications are able to work without GUI subsystem being active (e.g.
 when it crashes because of driver failure). When the GUI subsystem is
 restarted (either with the same driver or geeric vesa driver), GUI
 applications still works, because WindowsAPI takes care of this. GTK on
 X-based systems does not, even if that is not too much work (just catch X
 server error, discard all X id's for every top level windows, pixmaps, ...,
 and then when it gets reconnected, create them again and in the meanwhile
 use stubs).


 On 11/24/2010 03:41 AM, Champ Clark III [Softwink] wrote:


Hello all!

I have a multi-threaded application written in C that I'm a
 bit stumped on.  It's not the 'multithreaded' portion of the code I'm
 having issues with.  That seems to be functional.  It's the GTK error
 and warning handling.

The application is constantly processing data (syslog).  When a
 rule is 'satisfied',  a thread is spawned which builds a simple GTK
 window (popup) with the information about the 'event.'   So far,  so
 good.  However,  I'm not sure how to handle certain error events.  For
 example,   let's say I'm sending 'popups' to a workstation across a
 network.   The remote workstation goes off line (the user leaves,
 powers it down, whatever).  My application,  of course,  won't be able
 to send the GTK 'popup'.  I'll likely get the error:

 Gtk-WARNING **: cannot open display: 10.10.10.10:0.0

Here's my problem.   This error/warning causes termination of
 the over all application.  Even though the 'error/warning' gets generated
 from within my 'GTK thread',  it terminates the whole application.  That's
 not good.   Is there any way I could intercept or use a callback with
 the warnings/errors?  That is,  I'd like to log the warnings/errors,  but
 I don't want termination of my software due to a GTK/X11 problem.
 Basically,  some method to let me deal with the GTK/X11 errors the way I
 see fit.

I hope this makes sense.  Let me know if you have any questions.




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

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

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

Re: large performance difference between gtktextview and gtksourceview

2010-11-05 Thread Dov Grobgeld
Last time I checked (which was a long time ago) gtksourceview did not
support BiDi and possibly other i18n issues. But this per se is no
explanation for it being slower. And yes, performance can always be
improved.

Regards,
Dov

On Thu, Nov 4, 2010 at 18:12, Olivier Sessink oliviersess...@gmail.comwrote:

 Hi all,

 loading 1Mb of UTF-8 encoded text into a gtk text view seems to take
 much more time than loading the same buffer into gtksourceview. Since
 gtksourceview has all of the functionality of gtktextview and more,
 where is this difference coming from? And does this mean that we can
 improve the performance of gtktextview?

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

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


Re: gtk 2 or 3

2010-11-04 Thread Dov Grobgeld
For an example of how to do it without having a secondary thread do any gtk
commands, see my example program in:

http://www.mail-archive.com/gtk-app-devel-list@gnome.org/msg14213.html

Basically the work thread, that is taking a long time doing its thing,
requests the gui thread to update the GUI by sending it requests through
g_idle_add(). The GUI thread will then, when idle, attend to the routine and
update the gui. Syncronization is handled by mutexes, etc. In my example I
wanted a reply from the GUI thread (should I abort?) therefore the worker
threads blocks until released by the main thread.

Regards,
Dov

On Thu, Nov 4, 2010 at 12:18, Michael T. mys...@seznam.cz wrote:


So GIMP is a single threaded software?
 
  No, but...
 
   There's never GTK+ multithreaded activity?
 
  Indeed.
 

 If I may ask, what is the main technical problem (deeper explanation) with
 using GTK+ from multiple threads?

 It is probably very application specific. For instance, in my measurement
 application  an extra thread is started that takes care of data acquisition.
 I need to update a GTK progress bar while measuring, but since data are
 acquired extremely fast I do it from the measuring thread. The main thread,
 where GTK is running is of course blocked until the measurement is finished.
 This is obviously using GTK from multiple threads, but so far works
 perfectly. (Although, sometimes I get an occasional warning during
 execution) But this is probably due to the fact, that the main thread is
 blocked so the only thing that can be done is the progress bar update that
 is being taken care of from the measurement thread.

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

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


Re: Creating own stock image library

2010-10-10 Thread Dov Grobgeld
I use gdk-pixbuf-csource in my build system to generate c-files from my
icons that I then insert into the source list of programs.

Let me know if you need more examples.

Regards,
Dov

On Sun, Oct 10, 2010 at 17:46, Arne Pagel a...@pagelnet.de wrote:

 Hello,

 I created some special icons for my application.

 Now I want to reduce the files needed by the application,
 and therefore I want to compile the needed images in the binary output.

 What would be the best way to do that?
 How is this done with the gtk-stock-images?

 regards
  Arne




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

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


Re: Linking the buttons to gtk app

2010-08-29 Thread Dov Grobgeld
I might be missing something but it seems like this is a Linux kernel
question and doesn't have much to do with Gtk. Unless I'm missing something
you need to write a device driver for your kernel than makes your hardware
buttons appear as keyboard key-presses, e.g. F1-F10, and then use standard
Gtk keypressevent to catch these.

Regards,
Dov

On Mon, Aug 30, 2010 at 07:59, Guruprasad Bhat guruprasad...@gmail.comwrote:

 Yes it has got linux kernnel, on the user space application will run.
 Inorder to operate user will press buttons GTK has got button click/press
 event handler.
 Pressing should reach GTK from hardware. How it can be linked.
 *Regards,*
 *  Guruprasad Bhat.*



 On Fri, Aug 27, 2010 at 3:59 PM, dhk dhk...@optonline.net wrote:

  On 08/27/2010 01:27 AM, Guruprasad Bhat wrote:
   Hello, I have developed a GUI application for ARM based product. It has
  10
   buttons, so I want to link button press to GTK. How can I start to do
  this?
   In which level/layer I have work to get it done?
  
   *Regards,*
   *  Guruprasad Bhat.*
   ___
   gtk-app-devel-list mailing list
   gtk-app-devel-list@gnome.org
   http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
  
 
  This is a little off the subject, but how do you get you application on
  the ARM device especially when it's got an OS like Windows CE or
  something like that?
 
  dhk
  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


Re: porting gdk - cairo

2010-08-20 Thread Dov Grobgeld
I took the bait and coded my solution that I (in lack of anything better
called) dovtk-lasso . I'm including it below including a test program.

I think this solution is even simpler than your old xor solution. All you
need to do is to create the draw_callback fuction that uses whatever cairo
painting you want to draw your overlay. Note that this function is called
twice, once to extract where you are drawing, and once to do the drawing.
During the first time the do_mask variable is on. In this case you should
choose a thicker pen and draw in black, to make sure that everything is
included.

Note that there is one constraint that I have not been able to solve. The
expose-event callback that is doing the actual drawing of your graphics have
to return FALSE. I would be happy to receive a solution for it.

I promise to put this code into git-hub as soon as possible.

//==

//  test-gtk-lasso.c - This example is in the public domain

//

//  Dov Grobgeld dov.grobg...@gmail.com

//  Mon Aug 16 09:09:56 2010

//--

 #include stdlib.h

#include gtk/gtk.h

#include math.h

#include dovtk-lasso.h

 DovtkLasso *lasso = NULL;

int start_x, start_y, end_x, end_y;

 int cb_expose(GtkWidget  *widget,

  GdkEventExpose *event,

  gpointeruser_data)

{

cairo_t *cr;

cr = gdk_cairo_create(widget-window);

cairo_rectangle(cr, event-area.x, event-area.y,

event-area.width, event-area.height);

cairo_clip(cr);

 // Just draw anything in the widget

double x, y;

x = widget-allocation.x + widget-allocation.width / 2;

y = widget-allocation.y + widget-allocation.height / 2;

double radius;

radius = MIN (widget-allocation.width / 2,

  widget-allocation.height / 2) - 5;

 cairo_set_source_rgb(cr, 0,0,0);

cairo_arc (cr, x, y, radius, 0, 2 * M_PI);

cairo_stroke(cr);

cairo_destroy(cr);

 return FALSE;

}

 /**

 * Draw  whatever overlay you want on the image. If the do_mask

 * is on, then you should paint in black and with a pen that

 * is thicker than the drawing.

 */

void my_lasso_draw(cairo_t *cr,

   gboolean do_mask,

   // output

   DovtkLassoRectangleList **rect_list)

{

int min_x = MIN(start_x, end_x);

int min_y = MIN(start_y, end_y);

 if (!do_mask) {

cairo_set_source_rgb(cr, 1,0,0);

cairo_set_line_width(cr,1);

}

else

cairo_set_line_width(cr, 5);

 cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);

 // Draw a rectangle

cairo_rectangle(cr, min_x, min_y, abs(end_x-start_x), abs(end_y-start_y));

 cairo_stroke(cr);

}

 int cb_button_press(GtkWidget  *widget,

GdkEventButton *event,

gpointeruser_data)

{

lasso = dovtk_lasso_create(widget,

   my_lasso_draw,

   TRUE);

start_x = event-x;

start_y = event-y;

 return FALSE;

}

 int cb_button_release(GtkWidget  *widget,

  GdkEventButton *event,

  gpointeruser_data)

{

dovtk_lasso_destroy(lasso);

lasso = NULL;

return FALSE;

}

 int cb_motion_notify(GtkWidget  *widget,

 GdkEventMotion *event,

 gpointeruser_data)

{

//printf(button motion\n);

end_x = event-x;

end_y = event-y;

 dovtk_lasso_update(lasso);

 return FALSE;

}

 int main(int argc, char *argv[])

{

gtk_init(argc, argv);

GtkWidget *w_top = gtk_window_new(GTK_WINDOW_TOPLEVEL);

g_signal_connect(G_OBJECT(w_top), delete-event,

 G_CALLBACK(gtk_main_quit), NULL);

 GtkWidget *w_draw = gtk_drawing_area_new();

gtk_container_add(GTK_CONTAINER(w_top),

  w_draw);

gtk_widget_set_size_request(w_draw, 500,500);

g_signal_connect(G_OBJECT(w_draw), expose-event,

 G_CALLBACK(cb_expose), NULL);

 // TBD - set up events for lasso

gtk_widget_add_events(w_draw,

  GDK_BUTTON_MOTION_MASK

  | GDK_BUTTON_PRESS_MASK

  | GDK_BUTTON_RELEASE_MASK);

g_signal_connect(G_OBJECT(w_draw), button-press-event,

 G_CALLBACK(cb_button_press), NULL);

g_signal_connect(G_OBJECT(w_draw), button-release-event,

 G_CALLBACK(cb_button_release), NULL);

g_signal_connect(G_OBJECT(w_draw), motion-notify-event,

 G_CALLBACK(cb_motion_notify), NULL);

 gtk_widget_show_all(w_top);

gtk_main();

 return 0;

}



/**

 * dovtk-lasso.h

 *

 * A solution for drawing overlays on a gtk widget.

 *

 * This code is relased under the LGPL

Re: cairo drawing commands to gdk_invalidate_region

2010-08-18 Thread Dov Grobgeld
The problem of deciding what areas to expose are imho opinion too hard for
the motion handler to deal with. E.g. if the rubberband is e.g. of an
ellipse outline then you need quite a bit of mathematics to figure out what
areas to expose. You can of course expose the entire bounding box, but that
is very expensive for a large areas if it needs to be done several times a
second. The idea of painting a low res mask takes care of it.

Regarding the draw() routine, as you can see in the actual code, I do pass a
boolean flag that indicates whether it is the low res mask that should be
drawn or the actual drawing. This can be used to avoid drawing gradients and
other expensive drawing operations during mask creation.

In any case, thanks for your input.

Dov

On Wed, Aug 18, 2010 at 14:47, Paul Davis p...@linuxaudiosystems.comwrote:

 On Tue, Aug 17, 2010 at 4:22 PM, Dov Grobgeld dov.grobg...@gmail.com
 wrote:

  The solution won't work if the default expose-event handler returns TRUE.
  I would still like to resolve the issues that Paul has with my
 description
  of the code. Paul, why don't you like the fact that I call draw() twice?

 that's overstating it a little bit. what i was taking issue with is
 that *unless* draw() has some way to be able to tell that it is being
 called from an expose event handler (and that would presumably have to
 be some global variable, since nothing is passed to it as an
 argument), it is by definition doing the wrong thing *if* it is
 responsible for all the rendering that occurs in the expose handler.
 why? because that would imply that it actually renders in both the
 pre-expose call and the expose-event call, but you should only be
 rendering (to the window at list) in the expose event call.

 you asked:  How is update() supposed to know what region to invalidate?

 in your original description, you showed the flow as:

# motion event calls update()
 # update() calls draw() in order to get regions to expose.
 # update() calls gdk_invalidate_region() based on output from draw
 # exposure-event callback calls draw() to carry out the drawing
 for each region

 so you have logic that knows what regions are affected by the motion
 event (the above description makes it sound as if that logic is inside
 draw()). update should have that logic so that it can call
 gdk_invalidate_region(), and then the expose-event call to draw()
 should use the event region list to redraw.

 if your code works, that's fine. i'm just trying to describe to you
 what i *think* is the right way to do this so that its portable to all
 backends of GTK and is following the overall drawing model embedded in
 GTK.

 --p

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


Re: porting gdk - cairo

2010-08-17 Thread Dov Grobgeld
I don't know if you noticed it in another thread, but I created a working
example of the approach that I described in my earlier email. See:

http://github.com/dov/dovtk-lasso

See the program test-dovtk-lasso.c for an example of  how to use it.

Please let me know if you need more explanations. The source code isn't very
well documented yet.

Regards,
Dov
On Wed, Aug 11, 2010 at 20:12, Allin Cottrell cottr...@wfu.edu wrote:

 On Wed, 11 Aug 2010 jcup...@gmail.com wrote:

 
  On 11 August 2010 02:14, Allin Cottrell cottr...@wfu.edu wrote:
   rid of GdkGC.  I'd imagine that the effect I'm after is something
   that many GTP apps have need of, and it's trivial to achieve with
   the GDK API.
 
  I've found that XOR rubber banding is quite hard to do reliably in
  gdk.  The problem I think is that you are using the screen pixels to
  store part of the state, and that gets hard to coordinate between the
  various things that can affect the display.
 
  I had mouse movements triggering rect moves, mouse moves with a button
  held down causing background scrolling of the canvas, and mouse moves
  over other screen objects triggering highlight effects. With all these
  things going on at once it became very difficult to get XOR rubber
  bands to not leave annoying trails as they moved.
 
  I switched to an update-model / invalidate-widget / redraw-on-idle
  scheme as Dov suggests and I got prettier updates with less
  complication. Since input and output are decoupled, it'll scale more
  gracefully between slower and faster machines as well, which is nice.

 My drawing case may be simpler than yours -- there's nothing
 scrollable in the vicinity -- but I've found that rubber-banding
 using GDK_INVERT to undraw the last box works flawlessly at
 low programming cost.

 But can you suggest a good example to look at for the alternative
 approach? Thanks.

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

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


Re: Signal handling questions

2010-08-17 Thread Dov Grobgeld
Great! I just had to block myself when calling the other  expose handler as
follows:

:
g_signal_handler_block(widget, selfp-expose_handler_id);
int retval;
g_signal_emit_by_name (widget, expose-event, event, retval);
g_signal_handler_unblock(widget, selfp-expose_handler_id);
:
// cairo drawing follows

This way there is no need to deal with a generic event handler.

Thanks!
Dov

On Tue, Aug 17, 2010 at 09:08, Tristan Van Berkom t...@gnome.org wrote:

 A nice way to do it would be to subclass your widget and chain up to
 the parent expose
 method where needed.

 if you need to draw generically on widgets, it wont work for all
 widgets (some widgets
 can have floating subwindows)... but you can be bold and connect to
 the event signal
 and do something like:

 if (event_type == GDK_EXPOSE)
  {
g_signal_emit_by_name (widget, expose-event, event, retval);
do_my_overlay_drawing (widget);

return TRUE;
  }
 else
  return FALSE;

 On Tue, Aug 17, 2010 at 1:51 AM, Dov Grobgeld dov.grobg...@gmail.com
 wrote:
  While playing around with a general system for doing polygon overlays
 (e.g.
  for rectangle or line selection) I got stuck on the following problem.
 
  Assume that I have a widget A that has an expose handler exp_A().
 
  Now assume that I would temporarily like to draw an overlay on A from
 the
  code in expose handler exp_B(). I.e. after exp_A() has finished its work,
  exp_B() should be called.
 
  I am in control of exp_B() but cannot touch exp_A().
 
  I trigger the calling of expose events by calling
  gdk_window_invalidate_rect() from update_B().
 
  The problem is as follows:
 
  If I do g_signal_connect_after(widget, expose-event, exp_B, me) then I
 set
  up the correct order of exposure through A and B, but if exp_A() does
  return TRUE, then exp_B() will not be called.
  If I do g_signal_connect(widget, expose-event, exp_B, me) then exp_B()
  will always be called, but in the wrong order.
 
  So how is can this be solved?
 
  If I do g_signal_connect(), can exp_B() e.g. block itself as a signal
  handler and rethrow() the signal to the other handlers and then return?
 How
  is this done?
 
  Thanks!
  Dov
 
 
 
 
  ___
  gtk-devel-list mailing list
  gtk-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-devel-list
 
 

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


cairo drawing commands to gdk_invalidate_region

2010-08-17 Thread Dov Grobgeld
Assume I have a routine:

int draw(cairo_t *cr)

used to draw an overlay in a GdkWindow.

In order to minimize redrawing, I would like to get the minimal (up to some
accuracy to be determined) set of GdkRegion's that encompasses all the
drawing of draw().

I thought of doing this by creating a low resolution cairo image surface
that I pass to draw() and check if pixels are dirty in which case it
indicates that the corresponding rectangle in the source GdkWindow needs to
redrawn.

Is there a better method?

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


Re: cairo drawing commands to gdk_invalidate_region

2010-08-17 Thread Dov Grobgeld
Thanks, but this is not what I am looking for.

Here is a description of my flow, which might e.g. be used to draw a rubber
band box:

   1. motion event calls update()
   2. update() calls draw() in order to get regions to expose.
   3. update() calls gdk_invalidate_region() based on output from draw
   4. exposure-event callback calls draw() to carry out the drawing for each
   region

I.e. draw() is called twice with different purposes. (That's part of the
beauty of the generic cairo_t structure). The first call in 2 should be used
to determine where we are drawing. The second call in 4 is used to do the
drawing.

update() holds a list of rectangle corresponding to the old draw() and the
new draw() and expose both of these. (The exposure of the old commands are
needed to restore the background).

Your example indeed shows how to carry out the drawing as response of a
exposure-event (point 4 above), but doesn't answer my question of what
regions to invalidate (point 2-3).

Meanwhile I already have working code in which the user chooses what regions
to expose, but I would like to make it automatic to make this unnecessary.
Note that I assume that exposing the entire widget for each motion event is
too slow.

Dov

On Tue, Aug 17, 2010 at 11:14, Claudio Saavedra csaave...@gnome.org wrote:

 On Tue, 2010-08-17 at 10:35 +0300, Dov Grobgeld wrote:
  Assume I have a routine:
 
  int draw(cairo_t *cr)
 
  used to draw an overlay in a GdkWindow.
 
  In order to minimize redrawing, I would like to get the minimal (up to
  some accuracy to be determined) set of GdkRegion's that encompasses
  all the drawing of draw().
 
  I thought of doing this by creating a low resolution cairo image
  surface that I pass to draw() and check if pixels are dirty in which
  case it indicates that the corresponding rectangle in the source
  GdkWindow needs to redrawn.
 
  Is there a better method?

 Just call

  gdk_cairo_region (cr, event-region);
  cairo_clip (cr);

 right after creating the context, and after that, draw as if you didn't
 need to care about the dirty regions at all. The clipping will take care
 of the rest. This assumes that you only draw as a response to your
 expose-event handler, of course.

 Claudio


 --
 Claudio Saavedra csaave...@gnome.org

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

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


Re: Signal handling questions

2010-08-17 Thread Dov Grobgeld
For the record, I was mistaken. It does not work to use expose-event
handler for the temporary handle. If the permanent expose-event handle
returns TRUE, the temporary expose-event handler is never called. This
surprised me as I thought that a later call to g_signal_connect() takes
precedence over an earlier call. I will try using a generic handler and
will see if it works better.

On Tue, Aug 17, 2010 at 10:04, Dov Grobgeld dov.grobg...@gmail.com wrote:

 Great! I just had to block myself when calling the other  expose handler as
 follows:

 :
 g_signal_handler_block(widget, selfp-expose_handler_id);
 int retval;

 g_signal_emit_by_name (widget, expose-event, event, retval);
 g_signal_handler_unblock(widget, selfp-expose_handler_id);
 :
 // cairo drawing follows

 This way there is no need to deal with a generic event handler.

 Thanks!
 Dov


 On Tue, Aug 17, 2010 at 09:08, Tristan Van Berkom t...@gnome.org wrote:

 A nice way to do it would be to subclass your widget and chain up to
 the parent expose
 method where needed.

 if you need to draw generically on widgets, it wont work for all
 widgets (some widgets
 can have floating subwindows)... but you can be bold and connect to
 the event signal
 and do something like:

 if (event_type == GDK_EXPOSE)
  {
g_signal_emit_by_name (widget, expose-event, event, retval);
do_my_overlay_drawing (widget);

return TRUE;
  }
 else
  return FALSE;

 On Tue, Aug 17, 2010 at 1:51 AM, Dov Grobgeld dov.grobg...@gmail.com
 wrote:
  While playing around with a general system for doing polygon overlays
 (e.g.
  for rectangle or line selection) I got stuck on the following problem.
 
  Assume that I have a widget A that has an expose handler exp_A().
 
  Now assume that I would temporarily like to draw an overlay on A from
 the
  code in expose handler exp_B(). I.e. after exp_A() has finished its
 work,
  exp_B() should be called.
 
  I am in control of exp_B() but cannot touch exp_A().
 
  I trigger the calling of expose events by calling
  gdk_window_invalidate_rect() from update_B().
 
  The problem is as follows:
 
  If I do g_signal_connect_after(widget, expose-event, exp_B, me) then I
 set
  up the correct order of exposure through A and B, but if exp_A() does
  return TRUE, then exp_B() will not be called.
  If I do g_signal_connect(widget, expose-event, exp_B, me) then exp_B()
  will always be called, but in the wrong order.
 
  So how is can this be solved?
 
  If I do g_signal_connect(), can exp_B() e.g. block itself as a signal
  handler and rethrow() the signal to the other handlers and then return?
 How
  is this done?
 
  Thanks!
  Dov
 
 
 
 
  ___
  gtk-devel-list mailing list
  gtk-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-devel-list
 
 



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


Re: cairo drawing commands to gdk_invalidate_region

2010-08-17 Thread Dov Grobgeld
How is update() supposed to know what region to invalidate? By a list of
GdkRegions as a parameters? The dual functionality of draw is just a way of
automizing this.

Dov

On Tue, Aug 17, 2010 at 18:50, Paul Davis p...@linuxaudiosystems.comwrote:

 On Tue, Aug 17, 2010 at 9:11 AM, Dov Grobgeld dov.grobg...@gmail.com
 wrote:
  Sorry, I still don't get it. In my scenario there is initially is no
  external request of a region that should be drawn. The only source of
 what
  should be drawn, including what areas should be exposed, are in the
 draw()
  routine. The challenge is to translate a set of drawing routines to a set
 of
  invalidation areas.

 This is how you described it:

 Here is a description of my flow, which might e.g. be used to draw a
 rubber band box:
 
1. motion event calls update()
2. update() calls draw() in order to get regions to expose.
3. update() calls gdk_invalidate_region() based on output from draw
4. exposure-event callback calls draw() to carry out the drawing for
 each region

 this is wrong. update() should just call gdk_invalidate_region(). this
 will cause expose to be invoked with the region passed in.
 the way you've described it above, your draw() method does two
 entirely separate tasks.

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


Re: cairo drawing commands to gdk_invalidate_region

2010-08-17 Thread Dov Grobgeld
I uploaded my solution that I gave the working name dovtk-lasso to github
at:

http://github.com/dov/dovtk-lasso

On the one hand it works beautifully as it allows drawing dynamic overlays
with cairo with very little overhead. On the other hand it still has some
problems:

   - The solution won't work if the default expose-event handler returns
   TRUE.
   - I would still like to resolve the issues that Paul has with my
   description of the code. Paul, why don't you like the fact that I call
   draw() twice?

Have a look at the png file at github to see an example of a caliper like
measuring tool that I made with dovtk-lasso. Again, the graphics is
arbitrary, and could just as well be a rectangle, a cross hair, or whatever
the user feels like.

Looking forward to comments.

Regards,
Dov

On Tue, Aug 17, 2010 at 22:03, Federico Mena Quintero
feder...@ximian.comwrote:

 On Tue, 2010-08-17 at 10:35 +0300, Dov Grobgeld wrote:
  Assume I have a routine:
 
  int draw(cairo_t *cr)
 
  used to draw an overlay in a GdkWindow.
 
  In order to minimize redrawing, I would like to get the minimal (up to
  some accuracy to be determined) set of GdkRegion's that encompasses
  all the drawing of draw().

 You may have a different case, but let me tell you about a cute trick I
 had to do for iogrind [1].

 One of iogrind's displays is essentially a point-cloud on which you move
 a crosshair with the mouse:

  +-+
  |   .   . | . .. . . .|
  | .   . . |.. . . .  .|
  |-+---|
  |..  .. . |...  . . . |
  |   .   . |. . .. ..  |
  +-+

 The crosshair spans the whole width and height of the widget.  Drawing
 the points is expensive, as there may be thousands of them.  With each
 mouse motion event, you must repaint the crosshair.

 My solution went like this:

 1. The widget keeps a GdkPixmap where it draws the point-cloud at
 startup.  The points don't move (thankfully), so that pixmap is
 basically read-only after initialization.

 2. My motion-notify handler does this:

invalidate_vertical_line (w-cursor_x);
invalidate_horizontal_line (w-cursor_y);
w-cursor_x = event-x;
w-cursor_y = event-y;
invalidate_vertical_line (w-cursor_x);
invalidate_horizontal_line (w-cursor_y);

 3. My expose handler does this:

   bitblt (w-pixmap_with_points, widget-window);
   paint_vertical_line (w-cursor_x);
   paint_horizontal_line (w-cursor_y);

 So, repaints are very fast as I can avoid regenerating the points; I
 basically just paint the crosshair and that's it.

 If your drawing can be done with mostly-static contents and an
 occasional rubberband rectangle, this is a good way to do it.

 [1] http://live.gnome.org/iogrind

  Federico



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


Re: disabling GTK+ features to shrink GTK+

2010-08-16 Thread Dov Grobgeld
Even if you link statically, there are dynamic modules in gtk that are
pulled in at run time.

Also, remember that linking statically has license implications, as you in
such a case are forced to release your source code under the LGPL.

Regards,
Dov

On Tue, Jun 15, 2010 at 10:19, Steve Frécinaux nudr...@gmail.com wrote:


 Wouldn't it be possible to link gtk+ statically and rely on the linker to
 drop all the unused symbols?


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


Signal handling questions

2010-08-16 Thread Dov Grobgeld
While playing around with a general system for doing polygon overlays (e.g.
for rectangle or line selection) I got stuck on the following problem.

Assume that I have a widget A that has an expose handler exp_A().

Now assume that I would temporarily like to draw an overlay on A from the
code in expose handler exp_B(). I.e. after exp_A() has finished its work,
exp_B() should be called.

I am in control of exp_B() but cannot touch exp_A().

I trigger the calling of expose events by calling
gdk_window_invalidate_rect() from update_B().

The problem is as follows:

   - If I do g_signal_connect_*after*(widget, expose-event, exp_B, me)
   then I set up the correct order of exposure through A and B, but if exp_A()
   does return TRUE, then exp_B() will not be called.
   - If I do g_signal_connect(widget, expose-event, exp_B, me) then
   exp_B() will always be called, but in the wrong order.

So how is can this be solved?

If I do g_signal_connect(), can exp_B() e.g. block itself as a signal
handler and rethrow() the signal to the other handlers and then return? How
is this done?

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


Re: porting gdk - cairo

2010-08-10 Thread Dov Grobgeld
The following solution does the job though it causes flickering.

   - If there is a previous backing store (see below) then restore it to the
   underlying image.
   - Define the rectangle to draw by the button-press and the
   motion-notify-events.
   - Copy the four edges of below the rectangle to four GdkPixmaps, that I
   call backing store.
   - Draw the rectangle.

The following more complex solution should take care of flickering:

Preparation:

   - Create an expose handle that is called after the default expose handle
   which uses cairo to draw a rectangle in coordinates determined by structure
   R (see below). Note that this expose handle will be called up to eight times
   every time a motion notify event occurs.
   - Create a fifo buffer containing up to eight CairoRectangles to be
   exposed.

During motion:

   - Define the new rectangle to draw by button-press and motion-notify
   events and store it in the structure R available by the expose handle.
   - Push four areas corresponding to the four edges of the rectangles to
   the fifo buffer.
   - Expose the eight areas in the fifo buffer.
   - Pop off the first four areas of the fifo buffer.

This solution relies on the underlying expose handle. If that expose handle
is slow (e.g. complex vector graphics), the solution may be made faster by
initiating the process (e.g. at button-press) by copying the entire widget
window to an off screen pixmap, and then block the underlying expose handle.

I'd be interested if there is a more compact solution.

Regards,
Dov

On Tue, Aug 10, 2010 at 17:16, Allin Cottrell cottr...@wfu.edu wrote:

 I gather from recent discussion on the gtk-devel list that a good
 deal of the old GDK drawing API may be removed for GTK 3 in favor
 of use of cairo: in particular GdkGC seems likely to disappear.
 There appear to be good arguments for this, but it means some
 extra work for people trying to get their apps GTK3-ready.

 Benjamin Otte has some notes on porting at
 http://blogs.gnome.org/otte/2010/07/27/rendering-cleanup/ but
 there's one piece of GDK code I've been using for which I can't
 figure out the cairo equivalent and I wonder if anyone can help.

 The context is zooming to a selected portion of a graphic
 displayed in a GTK window. If the user selects a Zoom menu item
 she can then drag out a rectangular outline on the current image,
 and when the mouse button is released the view snaps to the chosen
 rectangle.

 The tricky part is avoiding a horrible mess as the user drags the
 rectangle. This is achieved via a cycle of draw-display-erase as
 the mouse pointer moves. In GDK, the erase part is done by
 redrawing the last-shown rectangle using an inverted GdkGC:

 gdk_gc_set_function(gc, GDK_INVERT);

 How would you do this in cairo? Thanks.

 --
 Allin Cottrell
 Department of Economics
 Wake Forest University

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

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


Re: text on a curved baseline?

2010-07-15 Thread Dov Grobgeld
What do you mean with drawing text? Through the text property of the label
widget? Then the answer is indeed no.

But you can always create a drawing area and draw whatever you want with
cairo in the expose event. You will then have no problem drawing in a circle
as you can loop over each character and draw it separately. I believe that
Behdad wrote an example for this in the pango example directory.

Regards,
Dov

On Thu, Jul 15, 2010 at 12:55, N James Bridge ja...@xmas.demon.co.ukwrote:

 Hi

 this is a beginner's question... can you make text follow a curved
 baseline? Looks like no.

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

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


Re: Grid Based Canvas

2010-05-25 Thread Dov Grobgeld
Why don't you just draw a grid with lines on the canvas, and then whenever
you select a square you create a canvas rectangle item and put it in the
grid between the grid lines? When you unselect, you just destroy the canvas
item. You will still need 2 items, which might still be too much...

Another approach which uses a lot less memory but requires more work on your
part is to use my GtkImageViewer widget which is a hybrid between an image
viewer and a canvas. (In spite of its name it does not necessarily display
images). The widget handles zooming, but you have to redraw the contents
yourself on exposure events. See:

http://giv.sourceforge.net/gtk-image-viewer/

Regards,
Dov

On Tue, May 25, 2010 at 22:02, Asad Jibran Ahmed surfer...@gmail.comwrote:

 On Mon, 2010-05-24 at 23:21 -0400, Liam R E Quin wrote:
  On Tue, 2010-05-25 at 05:04 +0500, Asad Jibran Ahmed wrote:
   [...]
 
   The canvas will have grids, much like a graph paper. Whenever
   the user clicks on one of the grid squares, that square will become
   selected and the selection will be shown by highlighting the square.
 
  It sounds like you really have a grid of squares, even if the user
  doesn't think of it that way.
 
  I think all of the canvas APIs support scrolling and zooming.
 
  Or take a peek at e.g. the minesweeper game?
 
  Liam
 

 Liam,
  Thanks for the info. I checked out the crcanvas widget and I think that
 it may just be what I need. I do however have one issue with the square
 approach that you have suggested.

 The grid I am trying to make needs to be quite large (1x1), and
 the memory requirements of keeping track of this large a number of
 rectangles is very problematic.

 Any advice on how to proceed from here? Again, thanks for your earlier
 reply.
 Thanks

 --
 JB :: http://www.asadjb.com

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

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


Re: GtkPlot

2010-04-05 Thread Dov Grobgeld
Attached below is a simple example. Something that you should keep in mind
is that gtkplot expects you to keep the data around as long as the plot is
displayed, i.e. it accepts a pointer to the data, but it does not copy it.
Presumably for perfomance reasons.

Regards,
Dov

#include gtk/gtk.h

#include gtkextra/gtkextra.h

#include math.h

 GtkWidget *w_top;

GtkPlotData *dataset;

 void

build_example1(GtkWidget *plot)

{

GdkColor color;

 static gdouble px1[]={0., 0.2, 0.4, 0.6, 0.8, 1.0};

static gdouble py1[]={.2, .4, .5, .35, .10, .40};

 dataset = GTK_PLOT_DATA(gtk_plot_data_new());

gtk_plot_data_set_points(dataset, px1, py1, NULL, NULL, 6);

 gdk_color_parse(red, color);

 gtk_plot_data_set_symbol(dataset,

 GTK_PLOT_SYMBOL_DIAMOND,

 GTK_PLOT_SYMBOL_EMPTY,

 10, 2, color, color);

gtk_plot_data_set_line_attributes(dataset,

  GTK_PLOT_LINE_SOLID,

  (GdkCapStyle)0,

  (GdkJoinStyle)0,

  2, color);

 gtk_plot_data_set_connector(dataset, GTK_PLOT_CONNECT_STRAIGHT);

 gtk_plot_data_hide_legend(dataset);

gtk_plot_add_data(GTK_PLOT(plot), dataset);

gtk_widget_show(GTK_WIDGET(dataset));

}

 // This signal handler resizes the graph if its allocation was changed

int plot_expose_event(GtkWidget *canvas,

  GdkEventConfigure *event,

  gpointer user_data)

{

int width = canvas-allocation.width;

int height = canvas-allocation.height;

 if (width != GTK_PLOT_CANVAS(canvas)-width

|| height != GTK_PLOT_CANVAS(canvas)-height) {

gtk_plot_canvas_set_size(GTK_PLOT_CANVAS(canvas),

 width, height);

gtk_plot_canvas_paint(GTK_PLOT_CANVAS(canvas));

}

 return 0;

}

 GtkWidget *create_plot()

{

GtkWidget *w_plot_canvas, *w_plot;

GtkPlotCanvasChild *child;

GtkPlotAxis *x_axis, *y_axis;

 w_plot_canvas = gtk_plot_canvas_new(500,300,1.0);

 // Do this in order to have auto resize of plot with window.

GTK_PLOT_CANVAS_UNSET_FLAGS (GTK_PLOT_CANVAS (w_plot_canvas),

 GTK_PLOT_CANVAS_DND_FLAGS);

GTK_PLOT_CANVAS_SET_FLAGS (GTK_PLOT_CANVAS (w_plot_canvas),

   GTK_PLOT_CANVAS_CAN_RESIZE);

 w_plot = gtk_plot_new(NULL);

 gtk_plot_set_range(GTK_PLOT(w_plot), 0, 1., -1., 1.4);

gtk_plot_axis_set_ticks(gtk_plot_get_axis(GTK_PLOT(w_plot),

  GTK_PLOT_AXIS_LEFT),

0.5,5);

child = gtk_plot_canvas_plot_new(GTK_PLOT(w_plot));

gtk_plot_canvas_put_child(GTK_PLOT_CANVAS(w_plot_canvas), child,

  .10, .1, .9, .85);

 // Setup the axis

gtk_plot_set_legends_border(GTK_PLOT(w_plot), (GtkPlotBorderStyle)0, 0);

gtk_plot_axis_set_visible(gtk_plot_get_axis(GTK_PLOT(w_plot),
GTK_PLOT_AXIS_TOP), FALSE);

gtk_plot_axis_set_visible(gtk_plot_get_axis(GTK_PLOT(w_plot),
GTK_PLOT_AXIS_RIGHT), FALSE);

x_axis = gtk_plot_get_axis(GTK_PLOT(w_plot), GTK_PLOT_AXIS_BOTTOM);

y_axis = gtk_plot_get_axis(GTK_PLOT(w_plot), GTK_PLOT_AXIS_LEFT);

 gtk_plot_axis_set_title(x_axis, Time [t]);

gtk_plot_axis_hide_title(y_axis);

gtk_plot_x0_set_visible(GTK_PLOT(w_plot), TRUE);

gtk_plot_y0_set_visible(GTK_PLOT(w_plot), TRUE);

gtk_plot_canvas_put_child(GTK_PLOT_CANVAS(w_plot_canvas),

  gtk_plot_canvas_text_new(Helvetica,

   12, 0,

   NULL, NULL,

   FALSE,

   GTK_JUSTIFY_CENTER,

   Intensity

   ),

  .10, .1, .20, .20);

 // Build data and put it in plot

build_example1(w_plot);

gtk_widget_show(GTK_WIDGET(w_plot));

 g_signal_connect(G_OBJECT(w_plot_canvas), expose-event,

 G_CALLBACK(plot_expose_event), NULL);

 return w_plot_canvas;

}

 // This is an example of how to update the data displayed in the

// widget. For more examples, see testrealtime.c.

void cb_change_dataset(GtkWidget *button,

   gpointer user_data

   )

{

GtkWidget *canvas = GTK_WIDGET(user_data);

static gdouble px1[]={0., 0.2, 0.4, 0.6, 0.8, 1.0};

static gdouble py1[]={.35, .30, .40, .2, .4, .5 };

 gtk_plot_data_set_points(dataset, px1, py1, NULL, NULL, 6);

gtk_plot_canvas_paint(GTK_PLOT_CANVAS(canvas));

gtk_widget_queue_draw(canvas);

}

 void create_widgets()

{


Re: Widget for drawing plot

2010-03-18 Thread Dov Grobgeld
I've been using GtkPlot for real time plots for a number of years. It
basically does the job, though its feature set is quite limited.

In case you will be using PyGtk then there is no doubt that you should be
using MatPlotLib which has vastly more options. I have often wished that
there was a C port of it. There is of course also the option of embedding a
python interpreter and matplotlib and then grab its output and display it as
an image. But that is a bit more complex.

Regards,
Dov

On Wed, Mar 17, 2010 at 18:25, Salvatore De Paolis iw...@claws-mail.orgwrote:

 Hi,
 I was searching a good way to draw plots in Gtk+.
 Surfing a little bit a found Gtkdatabox and GtkPlot.

 Which is worth to use or there's anything else?

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

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


Re: Image manipulation and Scaling

2010-02-02 Thread Dov Grobgeld
The following code does it:

// your original data assumed to be in a continous structure of gray.
// Preferably in a structure.
float *src_buf;
int img_width = 256;
int img_height = 256;

// You destination
GdkPixbuf *dst = gdk_pixbuf_new(...);
guint8 *dst_buf = gdk_pixbuf_get_data();
guint src_stride = gdk_pixbuf_get_row_stride(dst);

// Find min and max unless you have user min and user max
float min = HUGE;
float max = -HUGE;
for (int i=0; iimg_width*img_height; i++) {
float gl = src_buf[i];
if (gl  min)
min = gl;
else if (gl  max)
max = gl;
}

// Rescale
for (int row_idx=0; row_idximg_height; row_idx++) {
guint *dst_row = src_buf + row_stride;
for (int col_idx=0; col_idximg_height; col_idx++) {
float src_gl = src_buf[row_idx*img_width + col_idx];
float dst_gl = (src_gl - min) / (max-min) * 255;
// clip
if (dst_gl  0)
dst_gl = 0;
else if (dst_gl  255)
dst_gl = 255;
// Assign to rgb
for (int i=0; i3; i++) {
dst_row[col_idx*3+i] = dst_gl;
}
}

Changing to support user min and max and source RGB image is left as an
exercise to the reader.

And regarding whether you can support zoom without GtkImageView or
GtkImageViewer, obviously yes since these are written based on lower level
gtk structures. The trivial (and memory wasteful way) is to rescale the
image based on zoom level and show it in a view port.

Regards,
Dov

Wed, Feb 3, 2010 at 08:41, Gorav gora...@mst-india.com wrote:
On Wed, Feb 3, 2010 at 08:41, Gorav gora...@mst-india.com wrote:

Thanks for reply.


 Can you please elaborate more on Converting More than 8bit image to 8 bit
 image.

 And, apart from GtkImageView, is there no other way of image scaling?


 Thanks
 Gorav


 On 02/03/2010 12:02 PM, Dov Grobgeld wrote:

 Even if your image has more than eight bits you can always convert it to
 8-bit according to a user setting defining the grey level max and min to
 be
 used for the convertion (known as window and level in the medical image
 community). That's exactly how I do it in my image viewer giv. The image
 is
 held in a GivImage that is overloaded for various bit integer or floating
 widths and is then converted according to the user level setting before
 being displayed.

 Btw, if you would like to have interactive zooming of the image being
 displayed you may want to consider using my GtkImageViewer instead of
 GtkImage. (There is also the GtkImageView by Björn Lindquist with similar
 and different functionality.)

 See: http://giv.sourceforge.net/gtk-image-viewer/

 Regards,
 Dov

 On Wed, Feb 3, 2010 at 04:19, Lars Wirzeniusl...@liw.fi  wrote:



 On Tue, 2010-02-02 at 17:25 +0530, Gorav wrote:


 Hi


 I need to do some image manipulation using GTK, and I want to view some
 proprietary image formats. So, I can prepare RGB data. But, which widget
 and API to be use to draw pixels on screen.


 I used GtkImage using Pixbuf, but it supports only 8 bits per sample.


 Have you looked at GdkPixbuf for holding the image data? You may need to
 write converter plugins to load and store images from files for your
 proprietary formats, but after that, all the in-memory stuff should work
 fine.


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



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




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


Re: about main event loop

2010-01-12 Thread Dov Grobgeld
No, you don't create threads to handle events. Instead you connect to
callbacks through g_signal_connect().

But in order to get an intelligent reply from this list, you should provide
a complete compilable program that exhibit the problem that you experience.

Regards,
Dov

On Tue, Jan 12, 2010 at 11:02, Zhang Wei zwi...@gmail.com wrote:

 hello,
 I don't know how to deal with the signal
 when I clicked the icon on taskbar with
 right button of the mouse

 the program runs ok,
 but it gives the warnings in the console:
 GLib-WARNING **: g_main_context_prepare() called recursively from within a
 source's check() or prepare() member.
 GLib-WARNING **: g_main_context_check() called recursively from within a
 source's check() or prepare() member.

 should i use a callback function to deal
 with the signal button_press_eventor
 create a thread to run in the idle time?
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


Re: how to set language for non-unicode text

2009-12-28 Thread Dov Grobgeld
No, don't use gtk-i18n-list and don't cross post. gtk-app-devel-list is just
fine.

Gtk works only with unicode in utf8 encoding internally, so if you want a
different format on the disk you will have to convert your text on input and
output.

Regards,
Dov

On Mon, Dec 28, 2009 at 19:59, Han keepsim...@gmail.com wrote:

 Hi,

 I wrote my first linux GUI app using GTK+, which seems to be a very
 nice tool.  One question I had is: how can I set the language for
 non-unicode text in my application?  I tried to use iconv(), but did
 not work out. The iconv_open call returned error ENOENT (2).  Not sure
 if i am in the correct direction.

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

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


Re: Howto make a gtkbutton send a changed signal?

2009-12-01 Thread Dov Grobgeld
I don't really understand what you mean with emiting a changed event. You
mean that someone is doing something like:

 gtk_label_set_text(GTK_LABEL(gtk_container_get_child(GTK_CONTAINER(my_button)),
   new text)

or something simar (e.g. changing the image shown on the image)?

One way of doing it would be to do  the following:

   - Derive a new widget inheriting from GtkButton.
   - Add a new signal changed to it.
   - Add a new accessor function to the widget that changes the contents and
   emits the new signal.
   - Change the calls for changing button contents so that it uses the new
   function.
   - Connect to the new signal.

Regards,
Dov

You can get the effect that you want by deriving a new widget
On Tue, Dec 1, 2009 at 10:59, Till Harbaum li...@harbaum.org wrote:

 Hi,

 i am changing the UI of an existing app for mobile usage in a way that i
 replace
 some gtkentry's with some gtkbuttons which the use some alternate input
 method.

 I want to keep as much of the application as it is and one of the things
 the app expects
 is that this particular widget emits a changed event whenever its
 contents changes.

 So i'd like to enable my gtkbutton to emit a changed event, but i don't
 find any examples
 on how to achieve that. How do i attach a new signal to an existing
 widget type?

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

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


Re: Capture console app output into texview?

2009-11-20 Thread Dov Grobgeld
Here's my solution to the problem. It runs the external command in an
external thread. This is probably an overkill for the problem at hand, on
the other hand it is a good demo for how to create a worker thread and
capture its output in the GUI. This currently does not work with windows at
it is using popen() and g_io_channel_unix_new() but it should be trivial to
fix and is left as an exercise for the reader.

Compile with:

gcc -o stdout-to-textview `pkg-config --cflags --libs gtk+-2.0 gthread-2.0`
stdout-to-textview.c

//==
//  stdout-to-textview.c
//
//  An example how to place stdout from a an external process
//  into a text view buffer by running the process in a separate
//  thread.
//
//  This program is released under the LGPL v3.0.
//
//  Dov Grobgeld dov.grobg...@gmail.com
//  Fri Nov 20 09:22:39 2009
//--

#include stdio.h
#include stdlib.h
#include gtk/gtk.h

// This structure contains all the thread info for the job.
typedef struct {
GMutex *update_mutex;
GCond *update_cond;
GMutex *mutex_to_run;

gchar *cmd;
gchar *info;
}  JobData;

// Sorry, out of laziness I made the widgets global.
GtkWidget *w_text_view = NULL;
GtkWidget *w_entry_cmd = NULL;
GMutex *mutex_one_job_at_a_time = NULL;

// Create the data for a job
JobData *job_data_new(const char *cmd,
  GMutex *mutex_to_run)
{
JobData *job_data = g_new0(JobData, 1);

job_data-cmd = g_strdup(cmd);
job_data-update_mutex = g_mutex_new();
job_data-update_cond = g_cond_new();
job_data-mutex_to_run = mutex_to_run;

return job_data;
}

// free the data from a job
void job_data_free(JobData *job_data)
{
g_free(job_data-cmd);
g_mutex_free(job_data-update_mutex);
g_cond_free(job_data-update_cond);
g_free(job_data);
}


// This function receives a requst from a worker thread asking to
// update the gui with the required info.
gboolean cb_update_job(JobData *job_data)
{
if (job_data-info) {
GtkTextBuffer *text_buffer =
gtk_text_view_get_buffer(GTK_TEXT_VIEW(w_text_view));
GtkTextIter end_iter;
gtk_text_buffer_get_end_iter(text_buffer,
 end_iter);
gtk_text_buffer_insert(text_buffer,
   end_iter,
   job_data-info,
   -1);
gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW(w_text_view),
  end_iter, 0.0, TRUE, 0.0, 0.5);
g_free(job_data-info);
job_data-info = NULL;
}

// Indicate that the update is done
g_mutex_lock(job_data-update_mutex);
g_cond_signal(job_data-update_cond);
g_mutex_unlock(job_data-update_mutex);

return FALSE;
}

// A helper function run in the job thread receiving the string that
// should be displayed in the textview.
void job_add_to_text_viewer(JobData *job_data,
const char *info)
{
job_data-info = g_strdup(info);

// Lock mutex to make sure that we will receive the condition signal
g_mutex_lock(job_data-update_mutex);
g_idle_add((GSourceFunc)cb_update_job, job_data);

// Wait for cb_update_job to tell me that the update is done
g_cond_wait(job_data-update_cond,
job_data-update_mutex);
g_mutex_unlock(job_data-update_mutex);
}

// The thread entry point. It will do the job, send the data to the
// GUI and self destruct when it is done.
static gpointer thread_worker(JobData *job_data)
{
FILE *fh = popen(job_data-cmd,r);
printf(thread_worker running %s\n, job_data-cmd);
GIOChannel *gh = g_io_channel_unix_new(fileno(fh));
GIOStatus status;
GError *error = NULL;
gsize length;
gsize terminator_pos;
gchar *str_return;

while( (status = g_io_channel_read_line(gh,
str_return,
length,
terminator_pos,
error)) == G_IO_STATUS_NORMAL)
{
job_add_to_text_viewer(job_data,
   str_return);
g_free(str_return);
}

g_io_channel_unref(gh);
pclose(fh);
job_add_to_text_viewer(job_data,
   Job done!);

g_mutex_unlock(job_data-mutex_to_run);
g_thread_exit(NULL);
if (job_data)
job_data_free(job_data);

return NULL;
}

// Callback for the run button
void cb_clicked_run(GtkWidget *widget,
gpointer  user_data)
{
const gchar *cmd = gtk_entry_get_text(GTK_ENTRY(w_entry_cmd));
GError *error = NULL;
printf(Run %s\n, cmd);

// create a thread that will run the external command
// tbd...
JobData *job_data = job_data_new(cmd, mutex_one_job_at_a_time);
g_thread_create((GThreadFunc)thread_worker

Re: GDK + GLib main loop

2009-07-22 Thread Dov Grobgeld
You don't manually loop for events, but instead set up your drawing in the
expose handle of the drawing widget. You then connect to this handle
through:

g_signal_connect(drawing_area, expose-event,
 G_CALLBACK(my_expose_handler),
 user_data);

See the simple.c example in the gtkglarea source archive.

Regards,
Dov

2009/7/23 Mihai Draghicioiu mihai.draghici...@gmail.com

 Hi all! I'm making an OpenGL application based on GDK + GtkGLArea. My code
 so far works, but it has two issues:

 1. It does not handle events in a blocking fashion.
 2. Somehow the window does not receive an Expose event.

 I was told that for blocking until an event arrives, I'd have to use GLib
 main loop. I have looked at the GLib main loop reference page, but I have
 no
 idea how to make the this work. So I need some hints here.

 And for the GDK_EXPOSE event thing, I even set the all events mask, and
 there was still no expose event. I went around this by drawing outside the
 event switch, after each event is processed. This is not so important, but
 I'm curious why it happens. With Xlib programs, an Expose event is received
 when the window pops up, and every time it is 'made dirty' by other windows
 or dragging on-screen from off-screen or whatever.

 Here is my code:

 // g++ *gdkgl.cpp* `pkg-config gdk-2.0 gtkglext-1.0 --libs --cflags`
 -ogdkgl

 #include stdlib.h
 #include gdk/gdk.h
 #include gdk/gdkgl.h
 #include GL/gl.h

 int main(int argc, char **argv) {
gdk_init(argc, argv);
gdk_gl_init(argc, argv);

int config_attributes[] = {
GDK_GL_DOUBLEBUFFER,
GDK_GL_RGBA,
GDK_GL_RED_SIZE,1,
GDK_GL_GREEN_SIZE,  1,
GDK_GL_BLUE_SIZE,   1,
GDK_GL_DEPTH_SIZE,  12,
GDK_GL_ATTRIB_LIST_NONE
};
GdkGLConfig *glc = gdk_gl_config_new(config_attributes);

GdkWindowAttr attr;
attr.title = argv[0];
attr.event_mask = GDK_KEY_PRESS_MASK | GDK_STRUCTURE_MASK |
 GDK_EXPOSURE_MASK;
attr.window_type = GDK_WINDOW_TOPLEVEL;
attr.wclass = GDK_INPUT_OUTPUT;
attr.width = 800;
attr.height = 600;
GdkWindow *win = gdk_window_new(NULL, attr, 0);

gdk_window_show(win);

GdkGLWindow *glwin = NULL;
GdkGLContext *glcontext = NULL;
glwin = gdk_window_set_gl_capability(win, glc, NULL);
glcontext = gdk_gl_context_new(GDK_GL_DRAWABLE(glwin), NULL, true,
 GDK_GL_RGBA_TYPE);

bool done = false;
while(!done) {
GdkEvent *ev = gdk_event_get();
if(ev) {
switch(ev-type) {
case GDK_MAP:
break;
case GDK_DELETE:
done = true;
break;
case GDK_KEY_PRESS:
printf(key pressed\n);
break;
case GDK_EXPOSE:
printf(got expose\n);
break;
case GDK_CONFIGURE:

 if(gdk_gl_drawable_gl_begin(gdk_window_get_gl_drawable(win), glcontext)) {
glViewport(0, 0,
 ev-configure.width, ev-configure.height);

 if(gdk_gl_drawable_is_double_buffered(gdk_window_get_gl_drawable(win))) {

 gdk_gl_drawable_swap_buffers(gdk_window_get_gl_drawable(win));
} else
glFlush();

 gdk_gl_drawable_gl_end(gdk_window_get_gl_drawable(win));
}
break;
}

 if(gdk_gl_drawable_gl_begin(gdk_window_get_gl_drawable(win), glcontext)) {
glClearColor(1.0, .5, .2,
 1.0);

 glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, 800, 600, 0, -1,
 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glBegin(GL_QUADS);
glVertex2i(100, 100);
glVertex2i(400, 100);
glVertex2i(400, 500);
glVertex2i(100, 500);
glEnd();


 

Re: flow control question

2009-07-20 Thread Dov Grobgeld
Here are two programs that implement through the text viewer widget what you
are asking for:

   - The Python console in gimp
   - GemTcl - a tcl interpreter

The way I set up the interaction is to listen to both the key-press-event
and the insert-text events of the text-viewer. The key-press-event signals
to the insert-event handler that it is supposed to enter eval mode:

if (!(event-state  GDK_SHIFT_MASK)) {
switch(event-keyval) {
case GDK_Return:
do_eval = true;
break;
 }
}

and the insert-event catches this before the newline is inserted into the
buffer, runs the eval and inserts the result into the buffer:

if (do_eval) {
 // Extract the text between the prompt and the end of the line
 output = eval(command);
 gtk_text_buffer_insert(text_buffer, output);
 }

Have a look in GemTcl:gemtcl.cc cb_insert_text() and cb_key_press_command()
for details.

Hope this helps,

Regards,
Dov

2009/7/21 Allin Cottrell cottr...@wfu.edu

 In the context of my gtk app I have an optional console -- not
 a real shell, but a means of sending commands to the app besides
 point-and-click.  It's working OK, but for various reasons I'd
 like to reformulate it so that I have a loop like this:

 while (command != quit) {
  get_a_command();
  do_stuff();
 }

 I'm having trouble with get_a_command().  The criterion for a
 command being entered is that Return is pressed in a certain
 GtkTextView, to which I have a pointer.  But how does the
 get_a_command() function know that this has happened?

 I've implemented this via a static int, command_entered (a
 file-scope global), which is set to 1 by Return and is monitored
 by the function in question:

 void get_a_command () {
while (!command_entered) {
if (gtk_events_pending()) {
gtk_main_iteration();
}
}
command_entered = 0;
 }

 This works, but not surprisingly it uses a lot of CPU running
 around its tight loop waiting for Return. I then tried adding
 g_usleep(1) into the loop on while (!command_entered).
 That brought CPU usage down to a sane level, but of course it made
 the whole GUI quite gummy.

 It seems there must be a smarter way of doing this, probably using
 some of the g_main* apparatus or g_threads, which I'm not really
 familiar with, and at my current level of ignorance looking at the
 API docs leaves me guessing. Any pointers to get me started would
 be very helpful.

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

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


Re: GTK on Windows

2009-07-19 Thread Dov Grobgeld
There is a standard way, and that is to have each gtk application install
its own copy of gtk under Windows. I.e. there is no gtk at all in
system/software, and thus there can be no conflicts. The gtk runtime is very
small, around 10-15MB and with todays hard drives and download speeds that
overhead is negligable. If there are any programs that depend on a global
gtk installation, then that may be considered a bug that should be fixed.

I believe there have been lengthy discussions about this issue on this list
in the past, and the duplication of gtk runtime was the least evil solution
that was agreed upon.

Regards,
Dov


2009/7/19 Gabriel Rauter sirblackhe...@lagoc.org

 I don't know if this the right place to talk about this,
 but I don't know where else i should do so.

 I'm a gnome user and like the gtk applications there.
 But on the other side i am a gamer to, and most games only work well on
 windows.
 Because spending a lot of time on windows, i miss my gnome/linux apps,
 but I'm lucky, and most of my apps have been ported to windows.

 I'm happy with this apps, but ...
 at the moment under system-software there are three GTK+ Libraries
 installed,
 and I don't know which program installed which library.
 I don't know if any of these has overwritten pieces of one installed
 before.
 And what about the GTK+ apps bundled with their own gtk in their own
 folders.
 And wich gtk library does a certain application use when i start it now.

 From the view of a user this is realy confusing.

 It would be realy nice to have a standardized gtk installer.
 And if an application bundles it's gtk library with it's installer, the
 installer should be able to check if there is already
 a library installed and which version. Pidgin already does this, I think.

 The other problem with gtk on Windows is, that a lot of people tell me,
 that it still looks alien on the window platform.
 It doesn't seem that way for me, but probably, that's just because I spend
 a lot of time on gnome.
 ___
 gtk-devel-list mailing list
 gtk-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-devel-list

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


Re: Best practice for bundling GTK with an windows application?

2009-07-12 Thread Dov Grobgeld
Oops. Make that:

http://ftp.gnome.org/pub/gnome/binaries/win32/

Regards,
Dov

2009/7/11 Dov Grobgeld dov.grobg...@gmail.com

 I've been doing cross platform development and windows installer during the
 last few years of lots of C/C++ programs. Here is an outline of my
 practices:

- Build done through scons.
- Special scons rules for doing cross compilation for Windows from
Linux.
- Use NSIS for Windows installer deployment. (cross compiled mingw32
version of nsis used).
- The Windows installer is self contained, i.e. it is not dependent on
the installation of a separate gtk installation.
- The windows binaries are the standard compiled binaries from
ftp.gtk.org
- Testing done through a WinXP installation under VirtualBox.

 See the SConstruct and NSIS files of my two programs giv and gemtcl for
 examples of how to do the above.

 Regards,
 Dov

 2009/7/11 Hartmut Goebel h.goe...@goebel-consult.de

 Hi,

 I'm currently working to make setting up a Python application
 (www.tryton.org) easier for Windows users. Meanwhile I'm totally
 confused about which package of bundle to use and what to put into the
 installer package.

 Now GTK for Windows comes in quite a lot of flavours. Since Tryton uses
 pygtk  Co., we only need the runtime environment, no developer files.
 But there are still some options left:
 - zipped runtime bundle including 3rd-party dependencies.
 - zipped archives for individual packages (glib, gtk+, pango, ...)
 - installer from glade-win32 somewhat outdated, but including librsvg
  http://sourceforge.net/projects/gladewin32/files/
 - installer from http://gtk-win.sourceforge.net/: much more up to date
  but missing librsvg and libbz2

 Which one should I use? Is there some agreed best practice?

 I'm currently tending to this solution:
 * use the installer from gtk-win for the development environment
 * put additional .dlls (e.g. librsvg) into the development directory
 * include the whole gtk-win installer into the Tryton installer.

 Any comments or suggestions anyone?

 --
 Schönen Gruß - Regards
 Hartmut Goebel
 Dipl.-Informatiker (univ.), CISSP, CSSLP

 Goebel Consult
 Spezialist für IT-Sicherheit in komplexen Umgebungen
 http://www.goebel-consult.de


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



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


Re: Best practice for bundling GTK with an windows application?

2009-07-11 Thread Dov Grobgeld
I've been doing cross platform development and windows installer during the
last few years of lots of C/C++ programs. Here is an outline of my
practices:

   - Build done through scons.
   - Special scons rules for doing cross compilation for Windows from Linux.
   - Use NSIS for Windows installer deployment. (cross compiled mingw32
   version of nsis used).
   - The Windows installer is self contained, i.e. it is not dependent on
   the installation of a separate gtk installation.
   - The windows binaries are the standard compiled binaries from
   ftp.gtk.org
   - Testing done through a WinXP installation under VirtualBox.

See the SConstruct and NSIS files of my two programs giv and gemtcl for
examples of how to do the above.

Regards,
Dov

2009/7/11 Hartmut Goebel h.goe...@goebel-consult.de

 Hi,

 I'm currently working to make setting up a Python application
 (www.tryton.org) easier for Windows users. Meanwhile I'm totally
 confused about which package of bundle to use and what to put into the
 installer package.

 Now GTK for Windows comes in quite a lot of flavours. Since Tryton uses
 pygtk  Co., we only need the runtime environment, no developer files.
 But there are still some options left:
 - zipped runtime bundle including 3rd-party dependencies.
 - zipped archives for individual packages (glib, gtk+, pango, ...)
 - installer from glade-win32 somewhat outdated, but including librsvg
  http://sourceforge.net/projects/gladewin32/files/
 - installer from http://gtk-win.sourceforge.net/: much more up to date
  but missing librsvg and libbz2

 Which one should I use? Is there some agreed best practice?

 I'm currently tending to this solution:
 * use the installer from gtk-win for the development environment
 * put additional .dlls (e.g. librsvg) into the development directory
 * include the whole gtk-win installer into the Tryton installer.

 Any comments or suggestions anyone?

 --
 Schönen Gruß - Regards
 Hartmut Goebel
 Dipl.-Informatiker (univ.), CISSP, CSSLP

 Goebel Consult
 Spezialist für IT-Sicherheit in komplexen Umgebungen
 http://www.goebel-consult.de


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

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


Re: Pass more widgets as gpointer.

2009-04-22 Thread Dov Grobgeld
As I've said in he past, I believe the best thing is to sub-class GtkWindow
and then make all the pointers you want to pass around members of your new
class. Conceptually this looks like:

class MyWindow : GtkWindow {
GtkWidget *w_label;
GtkWidget *w_button;
GtkWidget *w_tooltip;
}

:
MyWindow *w_window = my_window_new();
g_signal_connect(w_button, clicked, G_CALLBACK(cb_button), w_window);
:
int cb_button(GtkWidget *widget,
  GtkButtonEvent *event,
  gpointer userdata)
   {
MyWindow *self = (MyWindow*)self;

   gtk_tool_tip...(self-w_tooltip, ...);
   gtk_label_set_text(self-w_label, foo);
   }


I hope you get the idea. The problem with this approach though is that it is
a bit of an effort quite to subclass Gtk in C, (in contrast to gtkmm, perl,
python, javascript in which it has been nicely mapped to the native objects,
not to talk about vala where a GObject is native). That's why I'm using gob2
whenever I'm writing C. It makes this technique as natural as in any other
language that I mentioned.

Regards,
Dov

2009/4/22 Vlad Volodin vest...@gmail.com

 Hi, Jens

 Yes, your way is good (thank you for a small code, maybe I will use it
 in my projects). But, are you sure your way is safe?
 You don't know the size of array (at the first),
 where do you free the array of pointers itself (try g_malloc and
 g_free, because it is GLIB :) ) (at the second).
 And I think, your way isn't type-safe (at the third), because you
 won't be sure that your element's type is needed.
 Well, of course I have many questions and now answers :) I think, in
 small projects your way is good (but you can also easily forget the
 order of the elements). Maybe HashTables, or STL sets will be more
 applicable.

 What do you think about all of this?

 Good luck in GTK programming :),
 Vlad Volodin

 2009/4/22 Jens Hansen jensh...@gmail.com:
  Hi All.
 
  Thanks for all ideas, to this problem. I figured out how to pass more
  widgets in an array, which is IMHO the best way to do it. Just for
  reference, the following snippet.
 
  Packing the widgets pointers in the array
   GtkWidget * *data;
   data = malloc(sizeof(GtkWidget *)*3);
   data[0]=spinbutton;
   data[1]=combobox;
   data[2]=check_hidden
  And unpacking them
  GtkWidget * *array=(GtkWidget **)data;
  Then you just need to type cast the elements of the array:
  for instance
   gtk_combo_box_get_active((GtkComboBox *)array[1])
  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


Re: method to erase a drawing area

2009-04-17 Thread Dov Grobgeld
Hello Frederico,

What you are doing is basically hit detection. What I wonder is why you are
doing it the hard way. Why don't you use one of the canvas widgets, e.g.
goocanvas? It allows you to tie events to specific geometric objects.

If you want to do it on your own I first of all suggest that you use cairo,
using gdk_draw_* is considered obsolete. Second you can use the idea of
keeping a second non-visible image as a label image. I've described this
multiple times on the net:

   - http://www.mail-archive.com/gtk-perl-l...@gnome.org/msg01428.html
   - http://www.mail-archive.com/gtk-l...@gnome.org/msg27934.html

Regarding your approach you can still salvage it by instead of checking for

 if((GPOINTER_TO_INT(desenho-parray-pdata[x1]) == x) 
(GPOINTER_TO_INT(desenho-parray-pdata[x1+1]) == y))

you check for

  int xp = GPOINTER_TO_INT(desenho-parray-pdata[x1]);
  int yp = GPOINTER_TO_INT(desenho-parray-pdata[x1+1]);
  int posH = GPOINTER_TO_INT(desenho-parray-pdata[x1+2]);
  int posV = GPOINTER_TO_INT(desenho-parray-pdata[x1+3]);

if (abs(xp-x)posH  abs(yp-y)posV) ...

Regards,
Dov


2009/4/17 frederico schardong frede@gmail.com

 Hi,

 I have a drawing area, and a window with 2 gtk_range, and them
 variable form 1 to 10, and this values go to posH and posV. I'm doing
 this to can draw a rectangular with my specification.. max width: 10,
 min: 1, max henght:10, min: 1.

 This event is called when drawing area is clicked:

 static gboolean button_pressed (GtkWidget *a, GdkEventButton *event)
 {
gint x = event-x, y = event-y, x1, y1;

for(x1 = (0-posH); x1  posH; x1++)
{
for(y1 = (0-posV); y1  posV; y1++)
{
gdk_draw_point(desenho-drawingArea-window,
 desenho-drawingArea-style-fg_gc[GTK_WIDGET_STATE(desenho-drawingArea)],
 x+x1, y+y1);
}
}

g_print(\ndrawing x: %d y: %d tamH: %d tamV: %d, x, y, posH,
 posV);

g_ptr_array_add(desenho-parray, GINT_TO_POINTER(x));
g_ptr_array_add(desenho-parray, GINT_TO_POINTER(y));
g_ptr_array_add(desenho-parray, GINT_TO_POINTER(posH));
g_ptr_array_add(desenho-parray, GINT_TO_POINTER(posV));
 }

 But now I must do a eraser function... I do a simple for:
 gint x1, x = event-x, y = event-y;

 for (x1 = 0; x1  desenho-parray-len; x1 = x1 + 4)
{
if((GPOINTER_TO_INT(desenho-parray-pdata[x1]) == x) 
 (GPOINTER_TO_INT(desenho-parray-pdata[x1+1]) == y))
{   g_print(\nta no lugar certo mano!);
g_ptr_array_remove_index(desenho-parray, x1);
g_ptr_array_remove_index(desenho-parray, x1);
g_ptr_array_remove_index(desenho-parray, x1);
g_ptr_array_remove_index(desenho-parray, x1);
}


  it's work, but not fine... it's only work when i click exactly where
 I clicked before to draw this point... but I need to delete from
 GPtrArray when I click on somewhere of this rectangle area... not only
 center... Can help me list?
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


Re: Rendering lines

2009-04-13 Thread Dov Grobgeld
gdk_draw_line() is deprecated. Use cairo instead.

Regards,
Dov


2009/4/13 Paolo pra...@gmail.com

 Hi!
 I'm drawing lines into GtkDrawingArea through gdk_draw_line function. The
 results is good, but not enough. How can I increase the rendering?
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


Re: Rendering lines

2009-04-13 Thread Dov Grobgeld
Slow or fast is obviously application dependent. The original poster didn't
complain about speed... The most important thing is never to send to the
rendering pipeline data that will not be shown. E.g. in a GIS system if you
are zoomed out you don't want to draw small features. And you don't want to
send features to be rendered that you know will be clipped. So you may want
to use some kind of quadtree to save the relevant features at each zoom
level.

That said, I also found cairo too slow for my liking in my image and vector
viewer giv, and found that agg was faster.See my tutorial at:

http://giv.sourceforge.net/gtk-image-viewer/gtkimageviewer_tutorial.html

for an example of how to use agg with gtk.

Regards,
Dov

2009/4/13 Jose Hevia jose.francisco.he...@gmail.com

 2009/4/13 Dov Grobgeld dov.grobg...@gmail.com:
  gdk_draw_line() is deprecated. Use cairo instead.

 And the problem with cairo is that is going to be far slower than gdk,
 although it provides better output, and could be hardware accelerated.

 http://cairographics.org/FAQ/
 Read Clipping should only make things faster, right?

 That's my main problem with cairo. I use my own raster because cairo
 is slw, and only want to update the region I change.

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


Re: Drawingarea in a scrolled window

2009-04-12 Thread Dov Grobgeld
I know this is not answering your question, but you can get the same effect
of the drawing area by using my GtkImageViewer widget, without an image. See
the tutorial at:

http://giv.sourceforge.net/gtk-image-viewer/gtkimageviewer_tutorial.html

for an example.

Regards,
Dov

2009/4/12 Paolo pra...@gmail.com

 hi! I've put a drawing area into the scrolled window. My drawing are is
 bigger than the scrolled window and there're problems about the refresh.
 How
 can I fix that?
 Please help me!!
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


Re: slowness in getting events

2009-04-06 Thread Dov Grobgeld
Since hex characters only has an alphabet of 16 characters, you can draw
these once into separate pixbufs, and then use gdk_pixbuf_copy_area() to
draw the prerendered characters to the screen. If you have the memory you
can e.g. create 256 two-nibble precomposed glyphs. I'm not sure how much
more efficient this is compared to the gtk/pango/freetype caching of text,
but it is worth a try.

An additional option is to only update your screen at some reasonable
interval, e.g. 5-10 times a second. Higher than that is hardly going to be
seen by the user anyhow. And if you are looking for exceptional behaviour
you may want to use other approaches like coloring the cells to indicate
that.

Regards,
Dov

2009/4/6 Efraim Yawitz efraim.yaw...@gmail.com

 On Mon, Apr 6, 2009 at 2:00 PM, Michael Torrie wrote:


You might want to implement this hex dump display as a GtkTreeView
widget, which does lend itself better to displaying tabular data.  The
MVC mechanism by which the TreeView works means that the view
automatically updates itself as the model (your hex data) changes and
emits signals.  You an even have multiple views of the same data if you
need it.

There are also a number of custom widgets that implement
spreadsheet-style grids you can search for.

 Some more testing has made it clear to me that the problem I am having is
 not that I am not getting the events, but that gdk_draw_layout(), which I
 am
 calling many times per update, is too slow.  I found some posts from a few
 years ago that this was hundreds of times slower than XDrawString(), and I
 have verified that it is much slower.  Of course, XDrawString is much
 harder
 to use.  Does anyone have any ways of dealing with this?
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


Re: goocanvas vs crcanvas,which better?

2009-03-26 Thread Dov Grobgeld
Hi Chen,

For the application that you described, using a canvas doesn't give you much
and you can just as well create a cairo context and draw on the image
directly. But there are a few things that you should be aware of:

   - Drawing overlays on av full realtime speed is going to take a lot of
   CPU no matter how fast you do it.
   - You should make sure to prepare all the data offline before you ship it
   off to the screen. Thus don't put the data from the frame grabber on the
   screen until after you have annotated it.
   - If the annotation is static, it certainly faster to prepare a
   transparent pixbuf and draw the annotation on the pixbuf and then simply
   merge the data from the frame grabber with the overlay mostly transparent
   pixbuf, and then ship the result of to display.
   - If you want the user to be able to interactively zoom the resulting
   pixbuf, you may want to have a look at my GtkImageViewer that creates such a
   zoomable interface for you. See the tutorial at:
   http://giv.sourceforge.net/gtk-image-viewer/

Regards,
Dov

2009/3/26 chen zhixin thexin1...@gmail.com

 Program need to draw realtime lines on per frame,first time i use
 cairo_surface_create_similar  and draw surface on the frame.
 (frame draw on GtkDrawingArea),this make fast on my pc and the
 Machine(use slitaz system),but when i use ubuntu on the machine,the
 Xorg process take 100% cpu,this make me craze,i still don't kown why.

 I want to use canvas to change this,there are some cairo
 canvas,goocanvas can be found in lib.gnome.org,it will be a part of
 gnome?
 goocanvas vs crcanvas ,which should i use? or somebody have a good
 method to do these.

 software do these:
 1. capture frame from TV card by V4L2,and then change fmt from yuyv to
 gray.
 2. draw gray frame to GtkDrawingarea by gdk_draw_gray to a GdkPixmap.
 3. do some other things on the GdkPixmap,such as draw pixbuf and
 text,and then gdk_draw_drawable.
 4. measure on the drawingarea.such as
 line,circle,ellipse,polygon,arrow,draw results on the frame.
 5. do other things ,such as zoom,save as image,video.

 there are some problems:
 1. can create cairo surface on GRAY picture,then i can draw something on it
 ?
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


Re: goocanvas vs crcanvas,which better?

2009-03-26 Thread Dov Grobgeld
The following does it:

  int img_width = gdk_pixbuf_get_width(pixbuf);
  int img_height = gdk_pixbuf_get_height(pixbuf);
  cairo_surface_t *surface
= cairo_image_surface_create_for_data(gdk_pixbuf_get_pixels(pixbuf),
  CAIRO_FORMAT_ARGB32,
  img_width,
  img_height,
  gdk_pixbuf_get_rowstride(pixbuf));


You will have to swap R and B in calls to:

  cairo_set_source_rgba (cr, 0,0,1.0,0.5);


when drawing though, as cairo and gdk_pixbuf have different ideas about
their order.

(These examples are copied from the GtkImageViewer tutorial.)

Regards,
Dov

2009/3/26 Alexander b3n...@yandex.ru

 Hi, Dov.

 On Thursday 26 March 2009, Dov Grobgeld wrote:

 - If the annotation is static, it certainly faster to prepare a
 transparent pixbuf and draw the annotation on the pixbuf and then
 simply
 merge the data from the frame grabber with the overlay mostly
 transparent
 pixbuf, and then ship the result of to display.

 Is there standard facility for creating cairo context for pixbuf? Like
 gdk_cairo_create() for drawables.
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


Re: How to get GtkImage resize of widget container?

2009-03-15 Thread Dov Grobgeld
No, doing it for the GtkImage is enough. Manually resizing or maximizing is
one and the same.

Regards,
Dov

2009/3/15 Luis Gonzalez ghempr...@hotmail.com


 Hi,

 I have do this in size-request event of the GtkViewport?, Does it works if
 the user maximize the window?

 Thanks.

 
  No, GtkImage doesn't resize the pixbuf automatically for you. You will
 have to do it manually whenever you get a resize event. Thus you will need
 to store your original image in an off screen GdkPixbuf, and on an resize
 event create a resized copy through gdk_pixbuf_scale_simple() that you then
 provide to the GtkImage. Don't forget to unref the rescaled pixbuf after you
 pass it to GtkImage so you won't get a memory leak.
 
 
  Hope this helps.
 
  Regards,
  Dov
 
 
 
 
 
  Hi,
 
 
 
  I have a GtkImage inside GtkViewport.
 
 
 
  I want that GTKImage resize with the width/height of the widget
 container.
 
  I try to use gtk_widget_size_request method of the widget but it hasn't
 the
 
  actually width.
 
 
 
  Anyway to get GtkImage automatically fit width/heigth to adjust to widget
 container?
 
 



 _
 Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

 http://www.microsoft.com/windows/windowslive/products/photos.aspx
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to get GtkImage resize of widget container?

2009-03-14 Thread Dov Grobgeld
No, GtkImage doesn't resize the pixbuf automatically for you. You will have
to do it manually whenever you get a resize event. Thus you will need to
store your original image in an off screen GdkPixbuf, and on an resize event
create a resized copy through gdk_pixbuf_scale_simple() that you then
provide to the GtkImage. Don't forget to unref the rescaled pixbuf after you
pass it to GtkImage so you won't get a memory leak.

Hope this helps.

Regards,
Dov


2009/3/14 Luis Gonzalez ghempr...@hotmail.com


 Hi,

 I have a GtkImage inside GtkViewport.

 I want that GTKImage resize with the width/height of the widget container.
 I try to use gtk_widget_size_request method of the widget but it hasn't the
 actually width.

 Anyway to get GtkImage automatically fit width/heigth to adjust to widget
 container?



 _
 More than messages–check out the rest of the Windows Live™.
 http://www.microsoft.com/windows/windowslive/
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


Re: newbie question

2009-03-11 Thread Dov Grobgeld
Hi Frederico,

(Copied from my own post from Mar 23, 2006 12:31:00 pm)

Here are four additional possibilities:

1. Use global variables for your widgets.

2. Create a struct containing pointers to all your widgets and use the
userdata field to pass this struct around in all callbacks.

3. Use the g_object_set_data() method to attach miscellaneous pointers to
your widgets. I.e. in the widget construction do:

GtkWidget *w_tree_view, *w_button; w_tree_view = gtk_tree_view_new(...); :
w_button = gtk_button_new(); g_object_set_data(G_OBJECT(w_button),
tree_view, w_tree_view); g_signal_connect(G_OBJECT(w_button), clicked,
G_CALLBACK(cb_button_clicked), NULL);

and in the callback cb_button_clicked() do:

GtkWidget *w_tree_view = GTK_WIDGET(g_object_get_data(G_OBJECT(widget),
tree_view));

This method is similar to what glade is doing.

4. Create your own container widget, e.g. by gob2 or vala and put all your
widgets in it. This is a fancy way of doing the struct callback I mentioned
above.

Hope this helps.

Regards,

Dov


2009/3/11 Tadej Borovšak tadeb...@gmail.com

 2009/3/11 frederico schardong frede@gmail.com:
 void my_callback_function (GtkButton *widget, gpointer user_ptr);
 
 ...
 
 g_signal_connect( G_OBJECT( widget), clicked,
G_CALLBACK( my_callback_function), user_ptr );
 
 
 void my_callback_function (GtkButton *widget, gpointer user_ptr) {
 
...
 }
 
 
 http://library.gnome.org/devel/gtk/unstable/GtkButton.html
 
  but how I can pass to my_callback_function the gtk_drawing_area? I
  know about the g_signal_connect.. but I not know how pass another
  widget, without the widget being passed the first parameter of
  function..
  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 

 Hello.

 Just pass your drawing area as a last parameter to g_signal_connect
 function.

 Simple code would look like:

 -- CODE ---
 int
 main( int argc, char **argv )
 {
GtkWidget *button = gtk_button_new();
GtkWidget *draw = gtk_drawing_area_new();

g_signal_connect( G_OBJECT( button ), clicked,
  G_CALLBACK( cb_clicked ), draw );

/* More code here */
 }


 /* Callback function */
 static void
 cb_clicked( GtkButton *button,
GtkWidget *draw )
 {
/* Code here to save your work */
 }

 --- /CODE --

 --
 Tadej Borovšak
 tadeb...@gmail.com
 tadej.borov...@gmail.com
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


Re: 2. Re: General tips about GTK+ programming

2009-03-05 Thread Dov Grobgeld
First of all, since C++ is basically a superset of C, you can add as much or
little C++ as you want to your C-program. In another word, you can program
in C++, but use the C-api for widget creation, etc. That is what I have been
doing e.g. in my projects GemTCL and giv. In contrast to what was said in
this thread, I am subclassing GtkWindow and adding private members to it,
and am doing it in C. But, as I also find the C-syntax very tough and
verbose for object inheritance, I have been using gob2 for this. gob2 is a
preprocessor written for extending and dealing with GObjects.

It may be claimed that gob2 has become deprecated with the emergance of
Vala, which is a new language that compiles to C/H-code for GObjects. But
then you are no longer writing in C or C++ at all, for good and for bad.
It's pluses is that its syntax is much nicer for GObjects. Its minuses is
that you need to create extra glue interfaces in order to refer to other C
and C++ classes.

Hope this helps.

Regards,
Dov


2009/3/5 dhk dhk...@optonline.net

 Ali Abdallah wrote:
 
 
 
  --
 
  Message: 1
  Date: Tue, 3 Mar 2009 09:39:51 -0300
  From: Tomaz Canabrava tum...@gmail.com
  Subject: Re: General tips about GTK+ programming
  To: Vlad Volodin vest...@gmail.com
  Cc: gtk-app-devel-list@gnome.org
  Message-ID:
  7ebbb4b50903030439k5e4bc73asff21305eefd84...@mail.gmail.com
  Content-Type: text/plain; charset=ISO-8859-1
 
  from what I'v been into, it's better to write object oriented software
  using object oriented programming languages. I know some in this list
  dislikes c++ , but it's more sane than use pointers and simulations of
  classes.
  you will not learn how to program better by converting your gtkmm code
  to gtk, your code will be larger and will do the same thing.
 
  I think what he was saying about learning more when converting his
  program to GTK is valid,
  since in C you deal with lower level programming than C++ , also you
  know Gtk+ is written in C,
  so when he gets used of C/Gtk/GObject programming he could easily
  understand the way Gtk+ is done.
 
  My 2 cents.
  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 

 Is there a way to start adding C++ code to an existing C GTK program?
 How would you start to convert a GTK program written in C to a GTK
 program in C++?

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

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


Re: RE : RE : drawing and erasing text

2009-02-24 Thread Dov Grobgeld
Hi Dominique,

Do yourself a favour and take the time to get rid of the use of XOR for
drawing and erasing. You'll have to keep a backing store of your data and
restore it when erasing. I've done the same thing for creating a rubber band
distance measuring tool in my image viewer giv. (Look at giv-backstore.cc
and giv-backstore.h(*)). Even better use of existing canvas frameworks, e.g.
goocanvas, that does all the job for you. The only reason I can think of for
not using the canvas is if you have huge data sets and you can't afford the
time and space overhead of the canvas frameworks.

Regarding XOR, besides being ugly, you'll suffer because you can't use cairo
and pango for a modern anti-aliasing, as well as easy exporting and
printing.

(*) The backstore class is still suffering from flickering because it erases
the old rubber band line by restoring the background, and only after the
background has been restored, does it paint the new rubberband line. I've
been planning to take care of this, but never got around to it.

Regards,
Dov

2009/2/24 POULAIN DOMINIQUE (AREVA TA) dominique.poula...@areva.com

 Hello Tor,

 I know that the gdk_font family functions and gdk_draw_string are
 deprecated, I use them because it was  easier for me when I translate my
 XWindows plotting part on my sotfware to Gdk (in order to port the entire
 software from Linux to Windows). Using Pango layout and gtk_draw_layout
 leads to same problem : the text is not drawn in Xor mode (we can see also
 that the colour is not the same for the lines and text).

 The Xor mode is a smart and easy way to erase some drawing (more than
 saving and restoring the original plot under each text notes, each axe's
 tics... we must calculate the involved region, and what to do when a note to
 erase is near a another one we want to keep). I will be sorry if I dont find
 a solution !

 The CbExpose callback was called repeated over and over by the use in the
 sample program of gtk_widget_modify_bg. I replace it by
  gdk_window_set_background that doesn't change the background ! and at last
 I use gtk_draw_rectangle to paint the entire drawing area in the background
 colour I want.

 In the XWindows, I use a XChangeWindowAttributes to set the backing store
 which prevents to have to redraw the plot when another window comes over a
 part of the drawing. With the backing store, no expose event is send in
 these cases. Is there a way to obtain the same beahivior with Gdk ?  If not,
 I will use a pixmap to save and restore quickly the plot rather than
 redrawing billion of points on each expose event.

 The use of setlocale is for trying to have the buttons from stock in
 French. In fact, the problem is when I distribute my software on Windows,
 Gtk seems to not find the .../share/locale/fr/LC_MESSAGES/gtk20.mo and the
 button are in English. Is there a path to set ?

 The last problem is about the tree view with multiple selection. On
 Windows, when I use Ctrl or Shift keys and left click to select multiple
 items, it works fine until I select three or four items : suddenly the tree
 is collapsed. It seems to be the same with demo program of GTK.

 Thank you for your answer.


 -Message d'origine-
 De : tlillqv...@gmail.com [mailto:tlillqv...@gmail.com] De la part de Tor
 Lillqvist
 Envoyé : lundi 23 février 2009 15:59
 À : POULAIN DOMINIQUE (AREVA TA)
 Cc : gtk-app-devel-list@gnome.org
 Objet : Re: RE : drawing and erasing text

 Hmm, do you know that the gdk_font_* and gdk_draw_string() APIs are
 deprecated and de facto unmaintained? Whether some aspect of it works
 fully or not on Windows is hardly interesting at this point.

 When I run your program both in Linux and Windows, the CbExpose
 callback is called repeatedly over and over. Does that happen for you,
 too? I wonder why that happens.

 By the way, the XLFD you pass to gdk_font_load_for_display,
 -adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1 is way
 too specific and probably works only on the distro and combination of
 package versions you happen to be using. No matching font was found on
 openSUSE 11.1, for instance. (Instead, I just used
 -*-fixed-medium-r-normal--*-100-*-*-c-*-iso8859-1)  (But as I said,
 using the XLFD-based font API is deprecated anyway.)

 You call  setlocale(LC_ALL, fr). Note that the setlocale() function
 in the Microsoft C library used on Windows in general does not accept
 locale names in the form commonly used on Unixes, using ISO639
 language codes and ISO3166 country codes. But just out of luck, for
 fr it happens to work apparently, but not in general for locale
 codes like fr_CA, sv or de for instance.

 --tml

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

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org

Re: GTK warning

2009-02-21 Thread Dov Grobgeld
The message means exactly what it sais, that you try to reduce the ref count
of an object that doesn't exist. If it is a C-program the way to trace this
is to rerun the program with the flag g-fatal-warnings in which case the
program will exit such that if you run the program in a debugger, the error
will be caught and you can examine the stack and the reason for the error.

But since the example you give is in Python this probably means that there
is an error in the python binding. You should try to create a minimum
example that triggers the problem and try to create a bug report.

Regards,
Dov

2009/2/21 Jeffrey Barish jeff_bar...@earthlink.net

 I hate the warning messages that GTK provides because they rarely help me
 find the problem.  What does this one mean?

 /myprogram.py:118: Warning: g_object_unref: assertion `object-ref_count 
 0' failed
  self['myimage'].set_from_pixbuf(mypb)

 What object is producing the warning?  I suppose it must be myimage.  What
 am I supposed to do?  If I exit the program and run it again, 9 times out
 of 10 I don't get the warning.
 --
 Jeffrey Barish

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

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


Re: GUI quickly?

2009-02-10 Thread Dov Grobgeld
Here are a couple of options:

   - Parse your variable list through regular expressions and dynamically
   build your interface.
   - Offline generate a glade (or GtkBuilder file) based on the same
   parsing. The syntax of glade and GtkBuilder is very straight forward.

Regarding the callback, the question is if you really want to get a callback
for each of the four characters 3,.,1 and 4. After all you are not
likely to use them until you press some [Go] button, or at least leave the
widget. In any case it will help you in this case to use the
g_object_set_data() function to attach the name of the data to the entry or
ComboBox widgets.

If you instead use the [Go] button approach, then you can save all your
widgets in a list and in the [Go] clicked signal handle, query them all for
their current values. This latter approach is how I do it now, after having
used the callback on each keypress in the beginning of my Gtk days. (Which
is closer to how Perl/Tk works).

Regards,
Dov

2009/2/10 Juhana Sadeharju kou...@nic.funet.fi


 This is related to open source free project, please help.

 I have described variables this way:
 NPC / Weight, float
 NPC / AI Data / Mood, list of choices here

 What are possibilities for creating GUI with minimal work?
 I may group variables to groups, one per window.
 I may group variables to subgroups, one per tab.
 I may add widget type IDs if that is not clear.
 But, using Glade to built the windows is too time-consuming.

 Of course, when a value has been edited in GUI, I should
 receive message: NPC / Weight changed to 3.14, etc.

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

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


Re: GtkImage

2009-01-29 Thread Dov Grobgeld
In glade, try erasing the size. There is almost never any need to set the
size of a widget in glade. Instead the size of a widget should be the size
of its contained widgets.

Regards,
Dov


2009/1/29 frederico schardong frede@gmail.com

 2009/1/29 Dov Grobgeld dov.grobg...@gmail.com:
  The GtkImage will change its size automatically according to the size of
 the
  image that you load. If you want to change the image size, then you
 should
  load it into a GdkPixbuf, resize it, and then set it with
  gtk_image_set_from_pixbuf().
 
  Btw, please keep CC:ing the mailing list, as there might be others with
  similar questions.
 
  Regards,
  Dov
 
  2009/1/29 frederico schardong frede@gmail.com
 
  Hi,
 
  But I must resize the image to the size of space of GtkImagem on
 .glade..
 
  how I do it?
 
 

 But GtkImage don't change its size.. On glade I defined the size of
 GtkImage,
 that is not preventing it to resize?

 Thanks

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


Re: GtkImage

2009-01-27 Thread Dov Grobgeld
If you use glade, then after loading the interface, the widget has already
been created for you. There is therefore no need to generate another image
widget through a call to gtk_image_new_from_file() and you should use
gtk_image_set_from_file instead:

GtkWidget *image = ...*get widget pointer from libglade* ...();
gtk_image_set_from_file(image, image.bmp)

How to get the widget pointer from libglade is left as an exercise for the
reader. (A bad excuse for saying that I am too lazy to look it up. :-)

Regards,
Dov

2009/1/27 frederico schardong frede@gmail.com

 Hello,

 I was created a space for image on glade-3, and I'm trying to link
 some imagem to this space.

 GtkWidget space;

 space = gtk_image_new_from_file(image.bmp);

 only this?

 the image will rezise itself to the space dimensions?
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


Re: Using GdkPixbuf buffers with GraphicsMagick

2009-01-06 Thread Dov Grobgeld
The data of a GdkPixbuf is layed out as a continous allocated chunk of
memory in one of the following format RGBRGBRGB for 24-bit images, or
RGBARGBARGBA, for 32-bit images, where R,G,B,A stands for the red, green,
blue, and alpha components respectively. Lines may be also padded to
row_stride bytes. Since you don't describe what GraphicsMagic() expects and
how you extracts the relevent info from the pixbuf, it is impossible to say
what went wrong.

In any case you can use any library, e.g. cairo, agg, OpenCV, or access the
pixels straight in the GdkPixbuf.

Regards,
Dov

2009/1/6 Luka Napotnik luka.napot...@gmail.com

 Hello.

 I'm trying to use GraphicsMagic (the successor of ImageMagick) to
 manipulate a GdkPixbuf image buffer. The problem is that the program
 segfaults, probably due to the raw nature of the buffer which the Magick
 API doesn't handle very good.
 I'm opening the image buffer with MagickReadImageBlob() and then apply
 some filters.

 Does anyone have experiences using GdkPixbuf together with
 GraphicsMagick or can anyone suggest alternatives to GraphicsMagick
 which works well with GdkPixbuf?

 Greets,
 Luka

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

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


Re: Accessing PixBuf pixels

2008-12-18 Thread Dov Grobgeld
It is almost correct except the fact that the rows of a pixbuf may be
padded. You are therefore supposed to use gdk_pixbuf_get_rowstride(pixbuf)
to get the distance between the rows.

Here is e.g. an example of vertically flip an image:

   guint8 *buf = gdk_pixbuf_get_pixels(img);
   gint w = gdk_pixbuf_get_width(img);
   gint h = gdk_pixbuf_get_height(img);
   gint rs = gdk_pixbuf_get_rowstride(img);
   gint row_idx, col_idx;

   for (row_idx=0; row_idxh/2; row_idx++)
 {
   guint8 *ptr1 = buf+rs * row_idx;
   guint8 *ptr2 = buf+rs * (h-row_idx-1);

   for (col_idx=0; col_idxw; col_idx++)
 {
   guint8 tmp_r = *ptr1;
   guint8 tmp_g = *(ptr1+1);
   guint8 tmp_b = *(ptr1+2);
   guint8 tmp_alpha = *(ptr1+3);
   *ptr1++ = *ptr2;
   *ptr1++ = *(ptr2+1);
   *ptr1++ = *(ptr2+2);
   *ptr1++ = *(ptr2+3);
   *ptr2++ = tmp_r;
   *ptr2++ = tmp_g;
   *ptr2++ = tmp_b;
   *ptr2++ = tmp_alpha;
 }
 }

Hope this helps.

Regads,

2008/12/18 Luka Napotnik luka.napot...@gmail.com

 Hello. I have some difficulties with manipulation of pixels in the
 GdkPixbuf data buffer. I use the following loop to iterate thought
 each pixel:

 ---
 n_channels = gdk_pixbuf_get_n_channels(pixbuf);
 guchar *pixel;
 guchar *data = gdk_pixbuf_get_pixels(pixbuf);

 for (i = 0; i  width*height; i++) {
pixel = buffer + i * n_channels;

pixel[0] = 100; /* Red channel */
pixel[1] = 100; /* Green channel */
pixel[2] = 100; /* Blue channel */
pixel[3] = 100; /* Alpha channel */
 }
 ---

 Is this the right way to handle a RGBA buffer?

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

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


Re: gdk-pixbuf

2008-12-18 Thread Dov Grobgeld
Just loop over the pixels and calculate a gray level through a linear
combination of R, G, and B. For example ppmtopgm uses:

grey = .299 r + .587 g + .114 b

Then assign the resulting gray to the red, green, and blue components, and
voila! You've got yourself a gray scale image.

See my previous post for an example of how to loop over a GdkPixbuf.

Regards,
Dov

2008/12/18 frederico schardong frede@gmail.com

  I need some API, which has the power to transform any RGB image to
 grayscale (8-bit) and I can map the image, creating a vast array[height in
 pixels][width in pixels] in which each cell has a value from 0 to 255,
 corresponding to the values of the pixels.

 With gdk-pixbuf can I do that?
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


Re: Problems when (cross)compiling a gtk app on linux for windows

2008-10-26 Thread Dov Grobgeld
I just tested your compilation line and except from the fact that I needed
to add:

-I$MINGW/lib/gtk-2.0/include

to the include flags, I had no problem compiling with it. So either the
download at gtk is broken or you made some mistake when downloading it.

Btw, you might be interested in checking out the cross compilation
environment that I have set up in the SConstruct file of the project giv at
http://giv.sf.net/giv . I do all my development including the construction
of a install package from from Linux.

Regards,
Dov

2008/10/26 [EMAIL PROTECTED]

 Hi everyone,

 I am trying to compile my application for windows on a Linux system using
 i486-mingw-gcc without having to run Windows itself. I obtained the cross
 compiler, including the winapi headers etc., through the packaging system of
 the distribution I use which is Archlinux. I already succeeded in compiling
 some other applications of mine, including SDL applications, so the
 crosscompiler itself, including the winapi references etc., works
 fine/should be properly configured.
 Before I started compiling my gtk app, I downloaded all the devel and bin
 packages from http://www.gtk.org/download-windows.html which that site
 told me I need and extracted them all into the sub folder ./gtk/ (relative
 to my source code files). Then I did pkg-config --cflags --libs gtk+-2.0 to
 obtain the package names and linker flags I need, and changed all the paths
 from it so it points all to ./gtk/ which resulted in the following command:

 i486-mingw32-gcc -o LPHirc.exe ./lphirc_main.c -mwindows -lws2_32
 -I./gtk/include/gtk-2.0 -I./gtk/include/gtk-2.0/gtk
 -I./gtk/include/gtk-2.0/gdk -I./gtk/include/atk-1.0 -I./gtk/include/cairo
 -I./gtk/include/pango-1.0 -I./gtk/include/glib-2.0
 -I./gtk/lib/glib-2.0/include -I./gtk/include/freetype2
 -I./gtk/include/libpng12 -I./gtk/include/pixman-1 -L./gtk/bin -latk-1.0
 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0
 -lgmodule-2.0 -lglib-2.0

 When attempting to compile, I get the following errors:

 In file included from ./gtk/include/gtk-2.0/gtk/gtkwindow.h:35,
 from ./gtk/include/gtk-2.0/gtk/gtkdialog.h:36,
 from ./gtk/include/gtk-2.0/gtk/gtkaboutdialog.h:32,
 from ./gtk/include/gtk-2.0/gtk/gtk.h:33,
 from lphirc_gtk.h:17,
 from lphirc.h:78,
 from lphirc_main.c:17:
 ./gtk/include/gtk-2.0/gtk/gtkaccelgroup.h:77: warning: parameter names
 (without types) in function declaration
 ./gtk/include/gtk-2.0/gtk/gtkaccelgroup.h:77: error: field 'GSEAL' declared
 as a function
 ./gtk/include/gtk-2.0/gtk/gtkaccelgroup.h:78: warning: parameter names
 (without types) in function declaration
 ./gtk/include/gtk-2.0/gtk/gtkaccelgroup.h:78: error: field 'GSEAL' declared
 as a function

 I have no idea what's going wrong, maybe some includes or linker flags
 missing?

 Thanks,

 Jonas
 
 Schon gehört? Bei WEB.DE gibt' s viele kostenlose Spiele:
 http://games.entertainment.web.de/de/entertainment/games/free/index.html

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

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


Re: How to center vbox inside full screen window

2008-09-01 Thread Dov Grobgeld
Both GtkImage and GtkLabel are subclasses of GtkMisc, which means that you
can set their alignments through the GtkMisc methods. Thus after after
packing them together, set the yalignment of the image to 1.0 and the
yalignment of the label to 0.0 (default for both are 0.5) and you should be
ok.

Search for GtkMisc in the GtkLabel and GtkImage documentations.

Another option is to create another non-filled GtkVBox into which you place
the image and the label, and then place this vbox in your outer filled vbox.

Hope this helps,
Dov

2008/8/30 Christian Smith [EMAIL PROTECTED]

 Hi All,

 I have a very simple GTK program (in C) that creates a full screen window.
  Inside the full screen window I am placing a vbox with two elements inside:
 and image and a label.

 For the life of me I cannot figure out how to get the contents of the vbox
 to be packed together.  I.e. I want the image + label touching each other
 and centered on the screen.  Currently the height of the vbox seems to fill
 the height of the screen with the image and label distributed inside (and
 not touching).

 Any help is appreciated!

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

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


Re: How to set the font's size of the GtkLabel?

2008-08-28 Thread Dov Grobgeld
Hi Lazy (great name),

The way to do it is to set the name of the label through:

gtk_widget_set_name(label, foo);

and then define a style for the name foo, that includes a font
specification:

gtk_rc_parse_string(style \foo\ {\n
  font = \Serif 32\\n
  }\n
  );

Hope this helps,
Dov

2008/8/28 Lazy Fox [EMAIL PROTECTED]

 I wrote the following statememts to set a GtkLabel's font size.
 But it seems don't work?
 I'm not good at Pango, can anybody help me?

 +---
 | PangoAttrList *pg_attr_list = pango_attr_list_new();
 | PangoAttribute *pg_attr = pango_attr_size_new(10);
 |
 | label = gtk_label_new(This is a label);
 | pango_attr_list_change(pg_attr_list, pg_attr);
 | gtk_label_set_attributes(GTK_LABEL(label), pg_attr_list);

 +--

 ___
 gtk-list mailing list
 [EMAIL PROTECTED]
 http://mail.gnome.org/mailman/listinfo/gtk-list


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


Re: How to set the font's size of the GtkLabel?

2008-08-28 Thread Dov Grobgeld
Hi Tomas,

You are certainly right The style method is more suited when you want to
change additional properties like background color, etc. I stand corrected.

Regards,
Dov

2008/8/28 Tomas Carnecky [EMAIL PROTECTED]

 Dov Grobgeld wrote:
  Hi Lazy (great name),
 
  The way to do it is to set the name of the label through:
 
  gtk_widget_set_name(label, foo);
 
  and then define a style for the name foo, that includes a font
  specification:
 
  gtk_rc_parse_string(style \foo\ {\n
font = \Serif 32\\n
}\n
);
 

 Ugh, that's complicated. An easier way is:

 GtkLabel *label = gtk_label_new();
 gtk_label_set_markup(label, span font_desc=\10.0\This is a
 label/span);

 See http://library.gnome.org/devel/pango/stable/PangoMarkupFormat.html
 how to use the pango markup language.

 
  2008/8/28 Lazy Fox [EMAIL PROTECTED]
 
  I wrote the following statememts to set a GtkLabel's font size.
  But it seems don't work?
  I'm not good at Pango, can anybody help me?
 
 
 +---
  | PangoAttrList *pg_attr_list = pango_attr_list_new();
  | PangoAttribute *pg_attr = pango_attr_size_new(10);
  |
  | label = gtk_label_new(This is a label);
  | pango_attr_list_change(pg_attr_list, pg_attr);
  | gtk_label_set_attributes(GTK_LABEL(label), pg_attr_list);
 
 
 +--
 
  ___
  gtk-list mailing list
  [EMAIL PROTECTED]
  http://mail.gnome.org/mailman/listinfo/gtk-list
 
 
  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 


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


g_io_win32_dispatch yields condition=0

2007-07-17 Thread Dov Grobgeld

I'm investigating a problem under windows that appears to be a missed event.


My test viewer application is built as follows:

1. A top level widget with a GtkImage widget that shows an image.
2. The program also listens to http requests through the gnet library and
allows to remote control the gui to change the image being displayed.

I can now connect to this viewer by a client and request it to change the
image being displayed. Everything is working nicely except if the
application is busy (see below) when the image change request arrives. To
make the viewer busy I take hold on corner of the top level widget and start
resizing the widget back and forth. If, when doing the resizing, a http
request arrives it is not passed on to my callback routine.

The problem is the call to the GIOFunc from the g_io_win32_dispatch
function. Normally I get GIOCondition=4 when data is ready to read on my gtk
condition, and GIOCondition=5 when data can be written. But if I do the
resizing trick when the data arrives, I instead get a call with
GIOCondition=0, even though I should have got GIOCondition=4 since there is
data to read on the socket. This in turn fails the following the following
test in the gnet callback function:

 if (condition  G_IO_IN)

I never get any additional callback and my client is timeout since it never
gets any reply.

Does anyone have any idea of what is wrong, or what additional tests I can
do to help debugging this issue?

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


Re: When packing widgets, what is the difference between box and table

2006-07-04 Thread Dov Grobgeld
Box is one dimensional, either horizontal (hbox) or vertical (vbox)
and the widgets are packed in the beginning or the end of them.

Table is two dimensional and widgets are packed by specifying the
coordinates of the four sides to which the widget is to be attached.

You can also get two dimensions by recursively packing several boxes
inside one another, but it is not the same as a table, as the
constraints of a table is that all cells belonging to a column have
the same width AND all the cells belonging to  a row have the same
height.

Regards,
Dov

On 7/4/06, chao yeaj [EMAIL PROTECTED] wrote:
 Hello, everyone
First ,i am sorry for my terrible  English.

When packing widgets ,we can use the box widget or the table
 widget,but what is the difference ?
when many widgets packed to the box or table,how to  modify the
 tab order of those packed widgets ?

 Any hint would be much appreciated ,thank you in advance
 ___
 gtk-list mailing list
 gtk-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-list

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


Re: gtk themes

2005-05-11 Thread Dov Grobgeld
Just do:

gtk_rc_parse_string(include \/usr/share/themes/Bumblebee\\n)

and you will use the Bumblebee theme.

Regards,
Dov

On Wed, May 11, 2005 at 07:41:52AM +0100, abhi rocks wrote:
 hi
 
 Well i couldnt change my gtk theme using the .gtkrc
 file in my home directory. Is there anyway i can
 change the theme using code. I know my gtk themes are
 in /usr/share/themes. Is there any function which
 could implement a theme on runtime.
 
 Thank You
 Abhishek Samuel
 
 
   
   
   
 ___ 
 Yahoo! Messenger - want a free and easy way to contact your friends online? 
 http://uk.messenger.yahoo.com
 ___
 gtk-list mailing list
 gtk-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Proposal for 2.8: Glog

2005-05-03 Thread Dov Grobgeld
Does this library only support logging of text messages, or is
it also possible to log other type of data? Here is an example
what I would like to have:

 start of log 
12:00:00  Starting algo loop# -- A rich text message
12:10:01  image/png: Video snapshot   # - mime/type and message

  ++
  ||
  ||
  |  Image |
  ||
  ++

12:10:00 Saturation: No # -- A table with textmessage
 Max GL: 230
12:10:01 graph/svg: Projection on x-axis   # -- Another mimetype

  ^
  |
  | /\
  | /\ /  \
  |/  \___/\
  +---

:
 end of log 
  
Of course you would employ some filter in order to view
such a log under different technologies. E.g. in a console you 
cannot see the images and the graphs. In a browser window you
would see all graphic contents and links to non-graphics contents,
like e.g. audio.
  
I tend to debug various iterative algorithms, and having a facility
like what is described here, would help me a lot.

Regards,
Dov

On Tue, May 03, 2005 at 09:03:05PM +0200, Maciej Katafiasz wrote:
 Hi hackers,
 
 here's a proposal for addition to Glib 2.8, named Glog.
 Bunch of details:
 
 What is it?
 ---
 
 Glog is debugging and logging library. It provides simple, but flexible
 logging facilities, with support for multiple logging levels, and allows
 to precisely specify the output to be shown. Its output can be coloured,
 and logging messages can be sorted by different categories for use by
 separate pieces of code.
 
 Glog depends only on Glib, and has no other dependencies (besides usual
 GNU toolchain). Optionally it can make use of glibc's printf()
 extensions.
 
 How mature is it?
 -
 
 Very. The library itself is 2 months old, but the entirety of code was
 taken from GStreamer, where it has been used *extensively* for years. It
 is the very basic tool used by gstreamer team for debugging purposes,
 and works great in this role.
 It is very small and self-contained, has very little impact on existing
 code (none in fact, if you don't use it explicitly), adds only minimal
 API and integrates with Glib out of the box. Glog compiles everywhere
 where GStreamer does, which is (AFAIK) everywhere where Glib compiles,
 including win32, osx, and weirdarse unices you'd rather forget about. It
 also builds natively under MSVC on win32.
 We feel that logging support provided by Glog is mature and of immense
 usefulness for much broader class of applications than just GStreamer,
 hence this proposal.
 
 Whole libification was done by Benjamin Otte of GStreamer fame, to whom
 the credit goes.
 
 Who would want to use it?
 -
 
 Anyone who is interestend in precise tracking and logging of code
 execution. Glog doesn't directly replace Glib's debugging facilities,
 which are mostly intended for detecting programming errors, but rather
 complements it by providing extensive tools for observing runtime
 behaviour, especially when time domain is of importance, as is the case
 for media processing.
 
 In short, if you'd use Log4j, you'd also use Glog.
 
 How performant is it?
 -
 
 Enough. Our experience shows that impact is barely noticable, and
 doesn't exceed 5% when logging is turned off. All GStreamer builds sport
 logging support by default, and we're media framework using Glog all
 over the place, so you can get the idea :). When not used the runtime
 penalty is exactly 0% (you need to opt in to use Glog).
 
 If maximum performance is of concern, Glog can be compiled out with a
 single line, reducing all calls to NOPs.
 
 Where can I get it?
 ---
 
 cvs -d:pserver:[EMAIL PROTECTED]:/cvs/gstreamer co
 gst-sandbox/glog
 
 To see it in action, just run (provided you have GStreamer installed)
 
 $ gst-inspect-0.8 --gst-debug=*:5
 
 and watch in awe. To get feel of category support, try
 
 $ gst-launch-0.8 --gst-debug=GST_STATES:3,GST_PLUGIN_LOADING:5 fakesrc !
 fakesink
 
 Conclusion
 --
 
 That's about it. GStreamer team will still be maintaining Glog once it's
 incorporated in Glib proper. Total amount of time estimated necessary
 for integration: 2 hours (if it goes bad, all it really takes is copying
 the source and slightly adjusting autofoo).
 
 Cheers,
 Maciej
 
 -- 
 Maciej Katafiasz [EMAIL PROTECTED]
 
 ___
 gtk-devel-list mailing list
 gtk-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-devel-list
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list