Re: Stop alt-spacebar window menu

2009-05-28 Thread Michael L Torrie
Actually I believe it is here:
http://library.gnome.org/devel/gdk/stable/gdk-General.html#gdk-keyboard-grab
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Stop alt-spacebar window menu

2009-05-28 Thread Michael L Torrie
Brian J. Tarricone wrote:
> Well, you have a couple choices:

Actually there is a third option.  You can grab the focus like VMWare or
DosEMU does and prevent any keystrokes from going to the WM.  Of course
you'll have to provide a way to release the grab.

I believe the API is in GdkDisplay area[1].  Look for calls involving
keyboard_grab.

[1] http://library.gnome.org/devel/gdk/stable/GdkDisplay.html

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


Re: App blueprint, advice please!

2007-12-19 Thread Michael L Torrie
Patrick wrote:
> Lets say a customer had a detector and a pump to pump a sample through 
> it. We could write a Bash script that works something like this:
> 
> -icon launches Bash script
> -sends variable " 2" to pump command to pump 2 ml per minute
> -pump command sends signal to serial port or GPIB bus, etc
> -bash sends variable "230" to set the detector to wavelength 230 nm
> -bash autozeros detector
> -launches plot command
> -after that launches data process command
> -then launches database storage command
> - emails whoever, turns your coffee maker on or whateveretc..etc

Seems to me that the lingua franca of this kind of scientific instrument
control and data collection is LabView.  Most institutions already have
site license for this software.

LabView is ideal for several reasons:
- Works with most GPIB cards, indeed most interface cards come with
labview drivers
- Easy graphical environment.  Lets you chain things together (in a
similar manner to bash, actually), but it's all within the program,
rather than kludging together non-integrated programs.  Plus it's all
in-process.  No external spawning things needed, which is expensive.
- Royalty free code.  You can sell you "vi" programs or give them away,
or whatever.  They aren't compiled, but can be obfuscated, or not.  So
you could sell labview code that people could modify.

On the other hand, there's no reason why you couldn't use GTK and, say,
Python to do similar things provided that you have drivers for the GPIB
boards, and have a well-defined interface that you can use to easily
build modules that you can string together.  Certainly I don't believe C
is the appropriate language to do any gluing.  I would recommend python.
 Data collection modules that need to be close to the hardware can be
done in C, but the rest could easily be done in python.  If you defined
a protocol for modules to communicate with each other, then you can very
easily string modules together, hooking data out buses on one module
(object) with the data in on another module.  The GTK signals and slots
mechanism would make this quite easy to do, all in-process.

Michael


> 
> It's a terrible over simplification but hopefully illustrates the idea.
> 
> I only have a few hundred dollars to put towards this now but hopefully 
> by the later half of 2008 it will be a few thousand. Please feedback 
> with any thoughts you might have on this whole process. Thanks-Patrick
> 
>  
> 
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

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


Re: C vs C++ for GTK

2007-12-13 Thread Michael L Torrie
Dan H wrote:
> On Wed, 12 Dec 2007 09:26:25 -0700
> Michael L Torrie <[EMAIL PROTECTED]> wrote:
> 
>> GTKmm is based on some very nice C++ abstractions around pointers,
>> providing many of the same benefits as any managed language with
>> pure C++.  They are called smart pointers and for GUI development,
>> they work very very well.
> 
> Isn't "smart pointers" just a reference counting scheme?

Yup.  Poor-man's garbage collection.  Turns out to be just the ticket,
though, for GUI programming.  Because of that, I'd put productivity with
GTKmm to be right up there with PyGTK or GTK#.

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


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

___
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 implement a UI like Microsoft Word table by GTK??

2007-12-12 Thread Michael L Torrie
li_top wrote:
> Hi all
> I have a problem to implement a UI like Microsoft Word table .
> That is , The UI have tables . User can combine 2or3 or more tables to one 
> table. How to 
> 
> do this UI? Please help me .

Your question is too vague to really be answered usefully.  But it
sounds to me like you probably want to implement this kind of UI feature
using some HTML rendering widget.  Or mess about with Pango markup
inside of a rich text editing field.

> Thanks & Regardse
> Tom
> The UI like following:
> 
>  __
> |_|___|___||
> | |   |   ||
> | |   |   ||
> |_|___|___||
> | |   |   ||
> |_|___|___||
>  
>  
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

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


Re: C vs C++ for GTK

2007-12-12 Thread Michael L Torrie
Jon Harrop wrote:
> On Saturday 24 November 2007 22:11, Patrick wrote:
>> I thought that C++ must be the way to go as it can do everything that C
>> can "plus plus" but some heavy hitters don't seem enthused with it,
>> Linus Torvalds in particular has been quoted as calling it a "horrible
>> language".
> 
> IIRC, Linus said that specifically in the context of systems programming.
> 
> My recommendation is to choose a garbage collected language for GUI work as 
> it 
> makes everything so much easier. Lots of GCd languages have GTK bindings 
> these days.

Just because a language or library implements garbage collection doesn't
mean you don't need to manage resources.  Especially when you're working
with a GUI.  It's totally possible to leak memory in Python, C# or any
other managed language if you don't know what you are doing.  It's a bit
harder, but still a problem.  Recently the Darpa autonomous vehicle
challenge was lost by one group because their C# control system was
leaking very badly, requiring a restart every 30 minutes or so.

GTKmm is based on some very nice C++ abstractions around pointers,
providing many of the same benefits as any managed language with pure
C++.  They are called smart pointers and for GUI development, they work
very very well.  I find GTK in C++ to be almost as productive as python
or C#

> 
> Incidentally, has anyone tried GTK# from C# on Mono?

Yup.  It works awesomely well.  It's very clean.  Of course I can't
think of many reasons to do it anymore.  I use python most of the time now.

> 


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

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


Re: Developer COBOL + GTK

2007-12-09 Thread Michael L Torrie
Ronaldo Ottoni wrote:
> Hi, I am a developer of the COBOL language and would like to know if there
> is possibility of using the API GTK with the COBOL language, if there is a
> possibility, I would like to receive assistance from members.

There is a COBOL .NET compiler (would run on mono in linux fine) that
can use the GTK# bindings:

http://www.sorn.net/blog/2007/05/Wildcat-COBOL-Compiler-0.1.9-Released


> Thanks
> 
> Ronaldo OTtoni
> ___
> 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: memory leak in gtk

2007-11-30 Thread Michael L Torrie
c f wrote:
>

> I have checked the GTK documentation and it states that gtk_exit free
> all resources allocated for GTK+. gtk_exit is depricated and using
> exit is recommended. I have tested both but non of them improved the
> situation (still more than 5000 leaks).

This is normal.  GTK is not going to clean up, nor can it, every single
allocation it makes.  However this is not a problem.  GTK will not leak
more and more memory over time.  Only sunk resources are leaked, such as
global data structures.

Most people who try to find leaks in their GTK programs will use a tool
like valgrind with a large gtk-specific suppression file.  A memory leak
is a memory leak, but it's only those leaks that accumulate that are a
problem.  Sometimes I'll use a memory profiler and make sure my
program's memory use doesn't increase beyond bounds.  One trick is to
rename main() and then write a temporary main() that calls the real main
thousands of times.  Over time the memory use should never exceed a
certain ceiling.  Of course with GTK being used for interactive things,
this is a bit difficult.

Anyway, google around for valgrind suppression files for GTK apps and
then give your app a shot.  You should readily be able to find your own
leaks, that really do matter.

> 
> Please could you help if I missed some cleanup in my application or
> what is happening?
> 
> Thanks,
> Csaba
> ___
> 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: C vs C++ for GTK

2007-11-26 Thread Michael L Torrie
JAMES SCOTT wrote:
> To list members following this subject: I have a question - not a
> flame, as I try to understand the diversity of responses to this
> topic.
> 
> How many of you who have suggested "Patrick" learn something other
> than C, know C already for yourself.  Over the course of my
> experience I have found that learning assembler and C for a given
> platform has helped me better understand and use that platform.
> Also, knowing C make picking up or reading other languages like -
> python, php, perl, and many others easier.

I agree to a point. C isn't going to teach you much about list
processing (a la LISP), domain-specific languages, lambda closures,
proper variable binding, functional programming, etc.

On the other hand, C helps one learn to manage resources explicitly
(even garbage collection can bite you if you don't understand how
resource management works), pointers, etc.

The ideal computer science program would make sure one first knows (IE
is taught) C, then some assembly, then Scheme, then Python.

> 
> I'm assuming that, those of you who are pointing another way -
> already know C!  Why not let Patrick follow your well worn path
> through C/GLIB/GTK2, maybe he will come out afterwards to C++,
> Python, or some other door.

Too late for that!  Patrick's already well into Python.  Python is a
great language to learn on, in my opinion.  It's as instructive as
learning LISP or Scheme, but as useful as C or C++, or even Java.  I get
the impression that Patrick already has some C proficiency.

> 
> Yes, my preference is C/GLib/Gtk+.  But I use lots of other when needed.

I'm coming to the opinion that a good rule of thumb is just to always
use python unless specific needs dictate otherwise.  Writing GUI code in
a low-level, compiled language just doesn't seem to be the wisest thing
to do these days.

That's not to say that you're advice to learn assembly and C isn't good.
 In fact it's important for all computer programmers to know, in my opinion.

When I have to write in C, Glib is a godsend.  And of course GTK+ for
the GUI.  Using Glib, I wrote a very complicated data parsing program
using dynamic strings, hash tables, and tree structures all with Glib
and only had one very small memory leak in 10,000 lines of code and
building and destroying many trees.


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

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


Re: C vs C++ for GTK

2007-11-26 Thread Michael L Torrie
Patrick wrote:
> Hi Everyone.
> 
> Sorry for the flame war bait, I know how passionate language debates 
> get  but I need some guidance. I am using PyGTK right now and I am happy 
> with it, but a day is coming soon were the speed limitations and 
> less-then-straight-forward threading will be an issue.

I don't see any reason at all why a GUI done with PyGTK should be any
slower than a GUI done with straight C.  Thus I don't see any compelling
reason to abandon Python for C or C++.

That said, however, Python sometimes isn't the right language to use for
computationally-intensive tasks.

Personally I think you are going about this the wrong way.  You could be
wanting to do premature optimization.  Rather than trying to replace
python, you should consider either extending python with C or C++, to
replace the slowest and most-used computational paths, and stick with
python for everything else. It's very easy to write python modules in C
(10 hours to learn), or C++ (Boost makes it easy to wrap C++ classes and
functions).  Alternatively you can code in C or C++ and embed Python to
drive your GUI.

> 
> I figure my next move should be to learn C or C++. I would like to stay 
> up-to-date with things and I would like to be able to reuse GTK code 
> from other Apps.

When it comes to the basic API, translating a code-generated GUI between
python and C++ (with GTKmm) should be very simple.  Even translating it
to C won't be that hard either, except that you don't have an easy way
to bind callbacks to a particular instance of data without some work,
like setting data values and using the void *data argument on the callbacks.

> 
> I thought that C++ must be the way to go as it can do everything that C 
> can "plus plus" but some heavy hitters don't seem enthused with it, 
> Linus Torvalds in particular has been quoted as calling it a "horrible 
> language".

>From my experience it is those that don't understand C++ and how to
wield it that describe it that way.  Torvalds is biased anyway, since
he's focused on kernel programming.

> 
> I can only spend 8-12 hours a week programming, I am not a professional 
> programmer, is C++ to complicated? Is C going out of date? Am I limited 
> with C?

C++ is complicated, but not overly so.  I feel that coming from Python,
C++ is probably going to be easier for you to move to than C.

Again, though, I think

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


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

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


Re: C vs C++ for GTK

2007-11-26 Thread Michael L Torrie
Benoît Dejean wrote:
>> In fact the GObject library (on which GTK is based) is an example of
>>  how full object-orientation can be achieved in C. Of course other C++
>>  features like templates, operator overloading (ugh!) and namespaces
>>  are unique.
> 
> This is totally a blocker for beginners. I've been doing some GNOME for
> years and i've never wrote any gobject thing because it didn't worth to
> waste time on it.
> 
Another interesting idea is to use Vala[1] for developing Gobject code.
 This compiles to straight C and you can use the new object's api like
any other gobject-based api.  Vala's intriguing because it's a language
very much like C#, but compiles down to straight C, which can be a
really good thing.

[1] http://live.gnome.org/Vala/GTKSample

-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771

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

Re: Building and packaging for Windows - theme?

2007-11-05 Thread Michael L Torrie
Daniel Atallah wrote:
> On 11/1/07, Andrew Smith <[EMAIL PROTECTED]> wrote:
>> Thanks everybody. I managed to build ISO Master on mingw and run it on a
>> stock Windows box (just copied some dlls from the mingw bin directory),
>> looks like the GTK parts work fine. Still, I'll be sure to look at all
>> the examples that you pointed out.
> 
> You copied some mingw dlls? That doesn't sound right.

mingwm10.dll is usually required for thread support.


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


Re: 16 bits grayscale images

2007-09-30 Thread Michael L Torrie
alex wrote:
> Actually I am porting a Windows .NET software to GTK.
> So some procedure I use (as false color convertion) is written. I will
> use it as is because it's not depending on GTK or else...

Are you porting it to GTK# and C# then?

> 
> Anyway...
> First I create a color structure wich define 256 different color from
> cold to hot.
> Then I convert my 16 bits image to a 8 bit and for each pixels value I
> replace with the corresponding color.
> It's help a lot for understanding a picture. I also add a conversion
> scale (for example to convert only values between from 100 to 256)
> 
> I can post the code used, but _for the moment_ it still use .NET and
> FreeImage library, but algorythm remains the same
> 
> 
> ___
> 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 terminal applications to GTK

2007-09-28 Thread Michael L Torrie
Unix OS wrote:
> Hello,
> 
> I'm an undergraduate student at James Madison University.  I've
> decided to convert one of my CS classes to an Honors class, which
> involves doing some sort of extra project typically.  Anyway, I've
> been working with my professor, and he wants to try porting his text
> editor to a windowed application that can run on Windows.  I figured
> GTK would be a great place to start.
> 
> Enough back story.
> 
> What's involved in converting  a terminal application like a text
> editor into a windowed application?  Will I need to simply need to
> write a custom widget to wrap the terminal application's output? Then
> redirect keyboard and mouse events to the original code?  Or is it
> more involved than that?
> 
> I know Vim can be compiled to run as a GTK app.  I figure the original
> terminal-only code must have been reused.

You could use libvte (I think that's it) which is a terminal widget, and
then run the editor, unmodified, in another process, outputting and
receiving input from the terminal widget.

As the other poster mentioned, unless the app being ported is written in
a modular way with a separation of data, control, and presentation,
porting it to a GUI is difficult.  This is because typically older
console apps are procedural, whereas GUI apps are typically
event-driven.  Don't forget other gotchas too, such as OS-specific
calls, directory path separators (/ vs \), etc.

> 
> 
> Thanks,
> Kris Kalish
> ___
> 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: A humble request

2007-05-30 Thread Michael L Torrie
On Wed, 2007-05-30 at 22:45 +0530, Sundararaman wrote:
> 1) I *cannot* log in successfully with my account. This means that I am
> currently not a member of this mailing list. I do not know why I am still
> getting all these emails.

Not his doesn't mean that at all.  In fact most list subscribers have
never set their password at all on Mailman.  What you might try is to
have mailman e-mail you your current password (which may be random), and
then use that to log into the Mailman interface and see what's going on.
First I would disable mail delivery, then see about doing the
unsubscribe thing again.

> 
> 2) I *got* a confirmation mail that I have been unsubscribed from this
> mailing list.
> 
>  
> 
> 
> 
> I beseech to you, for the love of god, please show me a way out. I shall be
> much grateful to anybody who can lead me the way out.
> 
>  
> 
> Thanks,
> 
> Sundar
> 
>  
> 
> 
> 
> --
> Free pop3 email with a spam filter.
> http://www.bluebottle.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: How to create a self contained GTK+ Application for Linux

2007-05-23 Thread Michael L Torrie
On Wed, 2007-05-23 at 15:12 -0700, Daniel Yek wrote:
> (Sorry for being busy-body here...; and keep in mind that I might have not 
> read up the thread messages in details.)

No more than the rest of us. :)

> 
> If it is to the executable path, it is easier -- by reading the symbolic 
> link target of:
>/proc//exe
> if the symbolic link exists.
> 
> For DSOs, is it an option to get the module load address and parse:
>/proc//maps
> to find out the module load address, in the name of making bundled modules 
> work more reliably?

That is not portable at all.  AIX 4 has no /proc, and older unixes may
have /proc, but not the maps stuff.  Unless Posix has an API for doing
this (I don't believe it does), it's not a viable solution.

Really, the only issue here is having a way for GTK to find the loadable
modules and plugins and things.  The linker can find the libraries based
on LD_LIBRARY_PATH, and GTK, Pango, and others can (hopefully) be set to
check environment variables to find their modules and data files.
That's the most portable way to do this, the cleanest, and least
dependent on OS-specific behavior.


> 
> 

___
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 create a self contained GTK+ Application for Linux

2007-05-23 Thread Michael L Torrie
On Wed, 2007-05-23 at 23:44 +0200, David Nečas (Yeti) wrote:
> The current [working] directory is what getwd() returns.
> At least that's what everyone else seems to mean by the
> current directory.

Well obviously getpwd is not good enough, then.  What would be needed is
the directory the .so file was loaded from, not the working directory.
That's what everyone is meaning here when they say "./blah" in the
context of the linker.  Of course they don't mean the current executable
working directory.

> 
> > And yes it is a good idea.
> 
> And it is ridiculous.

You're being difficult for the sake of being difficult.  I know you
understand what I am meaning about relative paths to the current
directory, meaning the directory from which the library was loaded,
symlink or no.

> 
> > It works very, very well for the win32 GTK libraries.
> 
> Finding self is normally based on GetModuleHandleW()
> + GetModuleFileNameW() on Win32.  I asked how you do this on
> other systems.

That's my question too, and others'.  In fact, by talking about the "./"
stuff that you're so caught on, that's exactly what we are asking. My
point was merely, Windows is ahead of us in this area, how can we
accomplish the same thing in a clean way?

> 
> Moreover, Win32 has some habit of looking for libraries in
> the executable's directory, and that's both weird and the
> only reason why it works.

It's different, but not weird.  In fact, in the context of the rest of
Windows, it's very logical.

And I (and others) am saying, there has to be a better way on Linux and
Posix systems.  Hard-coded paths are clunky.  If GTK's .so files can
dynamically find their plugin components based on an environment
variable, that is ideal.  In fact, if someone could help the original
poster in this, that would be the solution to his problem (well, other
than ancient libc abi problems).  I think that various thread posters
have pretty much stated that this is the current, best way to go.  Are
there any docs on what env strings to set?


___
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 create a self contained GTK+ Application for Linux

2007-05-23 Thread Michael L Torrie
On Wed, 2007-05-23 at 23:07 +0200, David Nečas (Yeti) wrote:
> The current directory can be anything.  Particularly
> anything unrelated to the location to the components of the
> application.  Do you really think it's a good idea to make
> programs work or break depending on something so arbitrary
> as the current directory?

Typical unix pedantic response.  The current directory as defined by the
directory the gtk dlls are in, yes.  And yes it is a good idea.  (well,
except for the idea of env variables and LD_LIBRARY_PATH, which is a
better idea).

It works very, very well for the win32 GTK libraries.

> 
> Yeti
> 
> --
> http://gwyddion.net/
> ___
> 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: [SPAM] Re: How to create a self contained GTK+ Application for Linux

2007-05-23 Thread Michael L Torrie
On Wed, 2007-05-23 at 19:31 +0200, David Nečas (Yeti) wrote:
> And the dot is exactly what?  The current directory?

Yes

> Does the library know the directory it was loaded from?

It should, yes.  If it really does, I have no idea.

> Should libraries break when symlinked?

No.  Why would and should they?


One of the few advantages that GTK on windows has over linux is that the
entire GTK installation can be self-contained and moved around.
Everything is found relative to the dlls automagically.  Is this even
possible to do in Linux?


> 
> Yeti
> 
> --
> http://gwyddion.net/
> ___
> 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+ and multithreating

2007-05-16 Thread Michael L Torrie
On Wed, 2007-05-16 at 23:22 +0100, Chris Vine wrote:
> 
> And you would need to put the "Hello" argument on the heap, and free it
> in the wrapper function, because otherwise it will go out of scope
> before the idle handler is called. (Sigh).  Use g_strdup() to create the
> string on the heap.  Simple examples are never that simple.

On this case, "Hello" is a statically allocated string.  It's always
available and never is destroyed (it is always on the heap, as it were).
Not something that's typically useful, though.  In general, yes, data
must be allocated on the heap, not the stack, in order to be passed to a
callback handler like this.  Unless it's a global static object (such as
a string literal).

> 
> Chris
> 
> 
> ___
> 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: serial ports

2007-05-14 Thread Michael L Torrie
On Mon, 2007-05-14 at 18:49 +, Pavel A. da Mek wrote:
> When I want to use serial ports, shall I write separate code for Windows and 
> for Linux, or is there some library function which would allow to do it in 
> the platform  independent way? 

There's definitely no GTK library calls to support this type of thing,
so you can either maintain separate code for win32 and linux (ifdefs or
something) or find a reliable, third-party library that fits your
technical and licensing requirements.

I have heard that doing any kind of serial port programming on Windows
is very very painful.  On Linux it's easy.


> 
> ___
> 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: Can I implement such a function with gtk?

2007-04-05 Thread Michael L Torrie
On Fri, 2007-04-06 at 01:01 +0800, Kun Niu wrote:
> Dear all,
> 
> I found that there's a function called gtk_window_iconify.
> I tried to add it to my delete_event function.
> It worked well for me.
> But I have a request that after delete_event is triggered. The minimized
> window should disppear from my system toolbar(for example, at the bottom of
> the screen on Windows and at the top of the screen on Gnome at present
> release) and appear as a status icon.
> 
> Can I find such an example?

http://marcin.af.gliwice.pl/if-then-else-20070121143245 -- this gives
examples in python, but it uses standard gtk api (introduced in GTK
2.10).  If you want to support older versions of GTK, take a look at the
tray stuff in libegg

Michael



> 
> Thanks in advance and look forward to your reply.
> 
> Sincerely,
> Kun
> ___
> 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: Desesperated: I need that my server draws

2007-04-05 Thread Michael L Torrie
On Thu, 2007-04-05 at 08:43 -0700, nahuel9728 wrote:
> First of all: Hello everyone. I'm developing a tool for cluster.
> I have a server that receive a lot of datas.
> Everytime that the server receive a data, I need that draws in a pixmap. I
> have all the estructure and I know how to draw in a pixmap. But I dont know
> how to make the server draws the interface. Any idea?? Anyone did something
> similar...??
> I'm a little bit desesperated...?? :-(

You basically need to use g_io_channels to have the GTK (Glib) main loop
watch the socket for data and then process it in a callback.
Alternatively, look at the gnet library (dr. google can find it for
you).

> 
> Eyy!! Really good forum.

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


Re: Any automated interface / GUI Testing tool for GTK ?

2007-04-03 Thread Michael L Torrie
On Tue, 2007-04-03 at 16:14 -0600, Michael L Torrie wrote:
> On Wed, 2007-04-04 at 02:36 +0530, rush ta wrote:
> > Thnx for the reply Michael...
> > I am looking for GUI testing ...
> > programmatically pressing button in a GUI on the screen !

Actually, here is something that may get you started:

http://search.cpan.org/~ctrondlp/X11-GUITest-0.21/GUITest.pm

> 
> Please keep your posts on the list.  Mainly because others can see it
> and give their input.  I myself know of no such tool offhand.  I believe
> you can accomplish some of this using the XTEST X server extension, but
> it sounds like  complicated stuff.
> 
> Personally I don't see how automated testing of a GUI does anything
> useful, other than proving the GUI toolkit works, which is not quite
> what you're looking for.  I would think that code coverage tests and
> unit tests would be of far greater value.  Also such testing promotes
> good design.  Business logic should never be mixed in with GUI display
> code.  Of course it's always possible to forget to connect a GUI signal
> and thus have a button that's not working.
> 
> Anyway, perhaps someone else who has knowledge in this area can comment.


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


Re: Any automated interface / GUI Testing tool for GTK ?

2007-04-03 Thread Michael L Torrie
On Wed, 2007-04-04 at 02:36 +0530, rush ta wrote:
> Thnx for the reply Michael...
> I am looking for GUI testing ...
> programmatically pressing button in a GUI on the screen !

Please keep your posts on the list.  Mainly because others can see it
and give their input.  I myself know of no such tool offhand.  I believe
you can accomplish some of this using the XTEST X server extension, but
it sounds like  complicated stuff.

Personally I don't see how automated testing of a GUI does anything
useful, other than proving the GUI toolkit works, which is not quite
what you're looking for.  I would think that code coverage tests and
unit tests would be of far greater value.  Also such testing promotes
good design.  Business logic should never be mixed in with GUI display
code.  Of course it's always possible to forget to connect a GUI signal
and thus have a button that's not working.

Anyway, perhaps someone else who has knowledge in this area can comment.

> 
> On 4/3/07, Michael L Torrie <[EMAIL PROTECTED]> wrote:
> On Tue, 2007-04-03 at 16:29 +0530, rush ta wrote: 
> > Hello,
> >
> > I was wondering if there is any tool for automated
> interface/GUI testing
> > tool for GTK ?
> 
> Are you speaking of unit-testing, or a way of driving the gui
> (programmatically pressing buttons in a gui on the screen from
> another 
> program) or what?
> 
> >
> > Thanking in advance
> >
> > Regards
> > Rush
> > ___
> > 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: Any automated interface / GUI Testing tool for GTK ?

2007-04-03 Thread Michael L Torrie
On Tue, 2007-04-03 at 16:29 +0530, rush ta wrote:
> Hello,
> 
> I was wondering if there is any tool for automated interface/GUI testing
> tool for GTK ?

Are you speaking of unit-testing, or a way of driving the gui
(programmatically pressing buttons in a gui on the screen from another
program) or what?

> 
> Thanking in advance
> 
> Regards
> Rush
> ___
> 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: QWidgetList QApplication::topLevelWidgets () ?

2007-03-20 Thread Michael L Torrie
On Tue, 2007-03-20 at 10:10 -0300, Carlos Savoretti wrote:
> Hi all!
> 
> A simple question... Is there any function
> equivalent to topLevelWidgets in gtk ?
> 
> Or some way to emulate it ?
> 
> I need it in order to iterate thru all the
> instances of a certain class created by an
> app.

If you have a pointer to a widget, you can iterate up the containers to
the parent.  I used to do this with glade-generated code all the time.
Glade would also add arbitrary data to a widget (a string) that you
could then search for, once you had found the parent.  You can iterate
up the widget hierarchy by calling gtk_widget_get_parent until you get a
NULL.

Michael




> 
> Thanks.
> 
> ___
> 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 do I get the GTK+ exec. file to Install?

2007-03-15 Thread Michael L Torrie
On Thu, 2007-03-15 at 19:15 +, Kayode Arowolo wrote:
> Dear Michael,
> Dear Michael,
>  
> Thanks for your response and concern. I need to develop the GUI for my
> project written in C. I want to install gtk on my laptop which runs on
> windows platform. Any suggestions will be appreciated.

Let's keep these e-mails on the list, please.

If you are using a tool like Dev-C++[1], there are pre-build packages
for that IDE that are quite nice.  See
http://www.bloodshed.net/dev/packages/gtk.html .

For use with Visual Studio, you just need to unpack the binary tarballs
somewhere (say to a folder called c:\GTK) and then in your project you
have to add all the libraries and add the include folder to your
includes path.  You can get these canonical binary tarballs from  
http://www.gimp.org/~tml/gimp/win32/downloads.html . There are also some
basic instructions on using them.  You will need to download all of the
dependencies on this page.  GTK depends on a lot of utility libraries
that don't ship with Visual Studio or windows.

When it comes time to deploy your application, you will need to make
sure that either your end users have the GTK runtime installed (there
are a number of installers out there to ease this for users; see
http://gaim.sf.net/win32) or you can bundle the GTK dlls in the
appropriate folder structure in the folder where you app installs.  GTK
cannot and should not be statically linked.

Michael




> Thanks.
>  
> Kayode
> 
> Michael L Torrie <[EMAIL PROTECTED]> wrote:
> On Thu, 2007-03-15 at 05:09 +, Kayode Arowolo wrote:
> > Dear gtk-app-devel-list,
> > 
> > I have been trying to download the GTK+ exec files from
> www.gtk.org (ftp) so that I can install on my system but all
> to no avail. Please help out with suggestions on what to do.
> 
> I do not understand. What are you trying to do? Are you trying
> to
> install pre-compiled GTK libraries on your operating system?
> If so,
> what operating system are you using? Are you trying to compile
> GTK from
> source? You will need to provide more information and ask a
> specific
> question.
> 
> > 
> > Thanks.
> > Kayode Arowolo
> > Computer Science Dept.
> > University of the Witwatersrand
> > Johannesburg. 
> > 
> > 
> > 
> > -
> > New Yahoo! Mail is the ultimate force in competitive
> emailing. Find out more at the Yahoo! Mail Championships.
> Plus: play games and win prizes.
> > ___
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list@gnome.org
> > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> > 
> 
> 
> 
> 
> 
> __
> New Yahoo! Mail is the ultimate force in competitive emailing. Find
> out more at the Yahoo! Mail Championships. Plus: play games and win
> prizes.

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


Re: How do I get the GTK+ exec. file to Install?

2007-03-15 Thread Michael L Torrie
On Thu, 2007-03-15 at 05:09 +, Kayode Arowolo wrote:
> Dear gtk-app-devel-list,
> 
> I have been trying to download the GTK+ exec files from www.gtk.org (ftp) so 
> that I can install on my system but all to no avail. Please help out with 
> suggestions on what to do.

I do not understand.  What are you trying to do?  Are you trying to
install pre-compiled GTK libraries on your operating system?  If so,
what operating system are you using?  Are you trying to compile GTK from
source?  You will need to provide more information and ask a specific
question.

> 
> Thanks.
> Kayode Arowolo
>   Computer Science Dept.
> University of the Witwatersrand
> Johannesburg. 
> 
> 
>   
> -
>  New Yahoo! Mail is the ultimate force in competitive emailing. Find out more 
> at the Yahoo! Mail Championships. Plus: play games and win prizes.
> ___
> 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: HTML Rendering Widget

2007-03-06 Thread Michael L Torrie
On Tue, 2007-03-06 at 23:28 +0200, Alan Lake wrote:
> I'm new to the use of GTK+, Glade & libGlade.  I need a widget that will 
> render book texts formatted with HTML.  Is there a source that lists 
> non-standard widgets that might be downloaded and incorporated into Glade?

I think there once was a widget called gtkhtml, and is/was used for the
GTK help viewer application.  I believe it is still current.  Google
around for 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: win32 fonts

2007-02-28 Thread Michael L Torrie
On Wed, 2007-02-28 at 18:55 +0100, Marcelo Armengot wrote:
> Hello
> 
> I patched my last problem making TWO programs. A little one is 
> successfully calling the other one.
> 
> Well, I have anoter question:
> 
> I need release my application but if it's possible, i want to users dont 
> need to install GTK libraries.
> 
> My program works if I uninstall Gtk and copy the dll inside the folder. 
> But fonts dont work.

You need all the other gtk folders in the same place as your binary and
dlls.  Such as etc, share, lib.  They are looked for relative to the gtk
dll.  

> 
> 
> thanks
> i think this is too easy for all of you
> ___
> 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: libglade frustration redux

2007-02-15 Thread Michael L Torrie
I have made a major mistake here.  Apparently google is indexing the old
libglade-1.0 stuff rather than the new stuff.  The 2.0 docs are here:

http://developer.gnome.org/doc/API/2.0/libglade/index.html

Note that for any gnome-related library, you can find the api and
reference docs at:

http://developer.gnome.org/doc/API/

Michael



On Thu, 2007-02-15 at 12:27 -0700, Michael L Torrie wrote:
> On Thu, 2007-02-15 at 13:46 -0500, Gerald I. Evenden wrote:
> > A the originator of this thread I will rephrase my problems and make a 
> > larger 
> > scale complaint.
> > 
> > 1. My original complaint was compile/linking glade output.  Thanks to M. 
> > Torrie this problem was nicely solved and I can compile/link several 
> > examples 
> > from various sources.
> 
> In the future, please be specific as to what compiler options you have
> tried and what error messages were given to you.
> 
> > 
> > 2. A side thread suggested that in order to understand the usage of a 
> > system 
> > like libglade one should study the source.  Hmmm.  To use the C (or any 
> > compiler) I should study the source code for the compiler???  To use the 
> > math 
> > library I should study the library's source??  I did mess with the mathlib 
> > source many years ago when the function 'hypot' was poorly implemented but 
> > I 
> > have not done such a thing since.  And read the C compiler code for 
> > understanding of how to use C---you have to be kidding.
> > 
> > 3. Getting back to libglade.  I have searched through many pages of google 
> > to 
> > find either a decent reference and/or tutorial for libglade.  A couple of 
> > tutorials make halfway attempts but ultimately fail because they have no 
> > reference manual to rely on---among other failings.  Finding a libglade 
> > reference manual is a total failure.  There are a couple of sites which 
> > claim 
> > to be a reference manual but I find them totally inadequate.  There is NO 
> > reference manual for libglade that can compared to what is available for 
> > GTK.  
> > Even the GTK reference is questionable as I find reference to GTK functions 
> > that are not in the GTK index nor locatable in sections dealing with the 
> > widget involved.
> 
> In fairness, the API reference for libglade is complete and fine.  It's
> only three calls.  Easy to use.  There are a plethora of complete
> examples of libglade usage out on the web.  I found several good ones
> using google.  They include complete glade files, the .c file, and
> compilation instructions.  
> 
> I really don't know why you are saying there are no decent tutorials or
> references.  Have you looked at the libglade docs on the web?  
> http://developer.gnome.org/doc/API/libglade/libglade.html
> 
> In fact, a complete example, complete with compilation instructions is
> at:
> http://developer.gnome.org/doc/API/libglade/libglade-notes.html#LIBGLADE-BASICS
> 
> During the 5 minutes I spent doing some research to answer your original
> post, I encountered a problem with their example code where the auto
> signal connect routine would complain that it couldn't find symbols.  I
> punched the error message into google and learned very quickly that I
> had to add a compiler flag to allow the symbols to be found (can't
> remember offhand now what it was).
> 
> So I don't think we can say the docs are bad or hard to find.  They
> really aren't.
> 
> 
> > 
> > I would love to be proved wrong about libglade documentation so please 
> > flame 
> > me if I am and point out my sins.  Even though I am now able to 
> > compile/link 
> > libglade code I find that I am now stymied by lack of documentation on its 
> > usage. 
> 
> After seeing the documentation, what parts of you stymied by?
> 
> Michael
> 
> 
> ___
> 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: libglade frustration redux

2007-02-15 Thread Michael L Torrie
On Thu, 2007-02-15 at 13:46 -0500, Gerald I. Evenden wrote:
> A the originator of this thread I will rephrase my problems and make a larger 
> scale complaint.
> 
> 1. My original complaint was compile/linking glade output.  Thanks to M. 
> Torrie this problem was nicely solved and I can compile/link several examples 
> from various sources.

In the future, please be specific as to what compiler options you have
tried and what error messages were given to you.

> 
> 2. A side thread suggested that in order to understand the usage of a system 
> like libglade one should study the source.  Hmmm.  To use the C (or any 
> compiler) I should study the source code for the compiler???  To use the math 
> library I should study the library's source??  I did mess with the mathlib 
> source many years ago when the function 'hypot' was poorly implemented but I 
> have not done such a thing since.  And read the C compiler code for 
> understanding of how to use C---you have to be kidding.
> 
> 3. Getting back to libglade.  I have searched through many pages of google to 
> find either a decent reference and/or tutorial for libglade.  A couple of 
> tutorials make halfway attempts but ultimately fail because they have no 
> reference manual to rely on---among other failings.  Finding a libglade 
> reference manual is a total failure.  There are a couple of sites which claim 
> to be a reference manual but I find them totally inadequate.  There is NO 
> reference manual for libglade that can compared to what is available for GTK. 
>  
> Even the GTK reference is questionable as I find reference to GTK functions 
> that are not in the GTK index nor locatable in sections dealing with the 
> widget involved.

In fairness, the API reference for libglade is complete and fine.  It's
only three calls.  Easy to use.  There are a plethora of complete
examples of libglade usage out on the web.  I found several good ones
using google.  They include complete glade files, the .c file, and
compilation instructions.  

I really don't know why you are saying there are no decent tutorials or
references.  Have you looked at the libglade docs on the web?  
http://developer.gnome.org/doc/API/libglade/libglade.html

In fact, a complete example, complete with compilation instructions is
at:
http://developer.gnome.org/doc/API/libglade/libglade-notes.html#LIBGLADE-BASICS

During the 5 minutes I spent doing some research to answer your original
post, I encountered a problem with their example code where the auto
signal connect routine would complain that it couldn't find symbols.  I
punched the error message into google and learned very quickly that I
had to add a compiler flag to allow the symbols to be found (can't
remember offhand now what it was).

So I don't think we can say the docs are bad or hard to find.  They
really aren't.


> 
> I would love to be proved wrong about libglade documentation so please flame 
> me if I am and point out my sins.  Even though I am now able to compile/link 
> libglade code I find that I am now stymied by lack of documentation on its 
> usage. 

After seeing the documentation, what parts of you stymied by?

Michael


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


Re: drawing moving shapes

2007-02-02 Thread Michael L Torrie
On Fri, 2007-02-02 at 16:02 -0700, Rob Barnes wrote:
> I am using gtk_widget_queue_draw() already. The doc says,"Once the main loop
> becomes idle (after the current batch of events has been processed,
> roughly), the window will receive expose events for the union of all regions
> that have been invalidated.", but this does not seem to be happening.
> Placing a printf in my expose event revealed that expose is not being called
> unless I move the mouse or something like that.  My program is
> multithreaded, could that be causing problems?

I was going to ask if your program was multithreaded as this is classic
behavior when you try to use threads.  

Did you read the documentation on how to properly use threads in GTK?
Are you initializing thread support in gdk?  Do you properly lock gdk
when making any gtk or gdk call from a thread?

In general (on all platforms and all widget toolkits), making gui calls
from the thread is a bad idea.  Instead, notify the main loop when you
want it to do something by doing g_idle_add and a callback.  This
ensures that the callback, which could update the drawing area, for
example, runs in the main thread at the next opportunity.  Note that you
have to synchronize any data that you want to share between threads
using locking primitives.

Michael


> Some code snippets:
> 
> GtkWidget *drawing_area;
> 
> //Inside main:
> drawing_area = gtk_drawing_area_new ();
> g_signal_connect (G_OBJECT (drawing_area), "expose_event", G_CALLBACK
> (expose_event), NULL);
> gtk_widget_set_events(drawing_area,GDK_ALL_EVENTS_MASK);
> 
> 
> gboolean expose_event( GtkWidget  *widget,
>   GdkEventExpose *event )
> {
> printf("expose\n");
> //draw_player(players[0]);
>   gdk_draw_drawable (widget->window,
>  widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
>  pixmap,
>  event->area.x, event->area.y,
>  event->area.x, event->area.y,
>  event->area.width, event->area.height);
> 
>   return FALSE;
> }
> 
> //Inside a asynchronous function
> //marker is an ADT
> gdk_draw_polygon (pixmap,marker.kontext,TRUE,marker->poly,4);
> 
> gdk_widget_queue_draw(drawing_area);
> 
> 
> Thanks.
> -RobB
> 
> 
> On 2/2/07, Michael Ekstrand <[EMAIL PROTECTED]> wrote:
> >
> > On Fri, 2007-02-02 at 12:20 -0700, Rob Barnes wrote:
> > > I'm trying to write a simple program that draws a moving polygon on the
> > > screen. I started with the scribble-simple example and modified to draw
> > the
> > > moving shape by redrawing the shape in the background color in the
> > previous
> > > position first then drawing it in the foreground color in the current
> > > position. It works fine, except it only refreshes when something happens
> >
> > > such as mouse movement, click, expose, window adjustment. So to keep
> > things
> > > moving I have to keep moving the mouse around, but it stops if the mouse
> > > stops, even though the polygon is being redrawn contently.
> >
> > Make sure you request a redraw every time the underlying state changes -
> > check out gtk_widget_queue_draw.
> >
> > --
> > Michael Ekstrand
> > Research Assistant, Scalable Computing Laboratory
> > Goanna, compute cluster and InfiniBand network monitor tool:
> > http://www.scl.ameslab.gov/Projects/Monitor/
> >
> >
> ___
> 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: Cross compilation error

2006-12-06 Thread Michael L Torrie
On Mon, 2006-12-04 at 11:37 +0530, Shyjumon N. wrote:
> Hi group,
>This is a very basic question, if any body can help me i will be glad.
> I am using gtk for my ARM board, i am using eldk development suit and 
> crosstools.
> Can any body tell me how can i cross compile gtk applications for arm target.
> Do i need to configure the gtk package and dependancies for arm ?

Yes.

> Please help me with some clues or links.

You'll likely want to take this up with the mailing lists at
handhelds.org.  They specialize in building software for embedded
devices.

Michael


> Thanks for all supports.
> 
> With regds,
> 
>  
> 
> Shyjumon N
> Mobile: +91-9945006965
> 
> The information contained in this e-mail message and in any annexure is 
> confidential to the  recipient and may contain privileged information. If you 
> are not the intended recipient, please notify the sender and delete the 
> message along with any annexure. You should not disclose, copy or otherwise 
> use the information contained
> in the message or any annexure. Any views expressed in this e-mail are those 
> of the individual sender except where the sender specifically states them to 
> be the views of SoCrates Software India Pvt Ltd., Bangalore.
> ___
> 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: Tweaking GUI, losing code (GTK+ and Ruby)

2006-10-23 Thread Michael L Torrie
On Mon, 2006-10-23 at 09:17 -0400, Flak Magnet wrote:
> I'm teaching myself to program using glade, libglade, the 
> "ruby-glade-create-template" script and ruby.
> 
> I've found that I'll often have to go in and edit the GUI I designed to 
> fix something that I forgot or wanted to tweak.  When I do this
> 
> Is there a way that I can modify the glade-created GUI without losing 
> the edits to the code that I've made?  Is there an easier way to do GTK 
> with Ruby?  Or perhaps even something different from GTK for ruby that 
> should work "better" for GUI efforts with Ruby?

Are you using libglade?  Code generation by glade itself is not
supported anymore and we are advised to use the glade xml files in our
programs directly.  Using libglade we can easily make changes to the GUI
without affecting any code in our programs.  I use python right now and
it's very simple to import the xml file, attach my callbacks and display
the gui.  Any changes to the glade file just require a restart of my
python program.  It's pretty slick.

Michael


> 
> TIA,
> 
> --Flak
> ___
> 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: Use of fgets, puts, rewind in Gtk+

2006-10-13 Thread Michael L Torrie
On Fri, 2006-10-13 at 10:16 +0530, Sucheta Ghosh wrote:
> Let me clarify the situation one by one:
> 
> > I can see some problems here, but that's not really GTK-related;
> 
> Then my question is: how the same code works fine as a simple c file, when 
> I am not using this inside Gtk+?

Probably because you are just lucky.  Often times code that's not quite
correct can work fine in a small, standalone test case but fails when
run in another context.

By the way you never did post the runtime error message you got.
Unfortunately without knowing what that error was we cannot help you.

> 
> > 1) no error checking for fopen(), fgets() - You don't to anything
> >   if they fail (and that's most probable)
> 
> What I have written is only a small piece of code, where I had written the 
> extract only to explain the problem in short. I have done the error 
> checking, the result is fopen() is not getting the null value, but fgets() 
> is getting the null value.
> 
> And I have declared all the variables unless it would not compile, as I 
> said earlier this is a runtime problem.
> 
> > 2) can't see any fclose() - multiple "fopen()"s without closing
> >   the file is BAD :)
> 
> I have done it in my Gtk+ coding only did not shown it here.
> 
> And all the other things I have done due to the demand of my application.
> 
> Thanks & regards,
> Sucheta Ghosh
> 
> On Thu, 12 Oct 2006, Progss wrote:
> 
> > Sucheta Ghosh napisa?(a):
> >> I wished to read a file and get some lines from there like this:
> >>-
> >>fp=fopen("filename", "r");
> >>for(k=0; k<8; k++){
> >>n=a[k];
> >>for (i=1; i<=n; i++) //Here 'n' is the line number
> >>fgets(s, 100, fp);
> >>puts(s);
> >>rewind(fp);
> >>}
> >>-
> >>-
> >> This is the code snippet, which is working so well after compiling with 
> >> 'gcc' compiler, but when I added this code inside Gtk+ callback.c, a 
> >> runtime error is occuring before execution of 'fgets'. I have already 
> >> included 'stdio.h', but even then it is not executing.
> >> 
> >> Do you have any idea that how to overcome this problem?
> >
> > I can see some problems here, but that's not really GTK-related;
> > well - there's also a change that included snippet was simply
> > too short
> >
> > 1) no error checking for fopen(), fgets() - You don't to anything
> >   if they fail (and that's most probable)
> >
> > 2) can't see any fclose() - multiple "fopen()"s without closing
> >   the file is BAD :)
> >
> > 3) You're reading the same file 8 times - and that's *at least*
> > non-optimal - of course that depends on what exactly you're going
> > to achieve, however I'm quite convinced
> >
> > 4) I'd be really careful about placing some external file operations
> > nside of a callback function. but this depends on your overall
> > application purpose and design.
> >
> > Best regards
> > Waldek
> >
> > --
> > Czas pozegnac finansowe problemy.
> > Kredyt Citibank - prosty kredyt na wszystkie potrzeby.
> > Sprawdz: http://link.interia.pl/f19a5
> >
> >
> ___
> 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: removing borders from button

2006-10-09 Thread Michael L Torrie
On Mon, 2006-10-09 at 18:03 +0530, [EMAIL PROTECTED] wrote:
> Hi,
> 
> I have a GtkImage on a GtkButton.
> I want to remove the spacing/border between the GtkButton border and the
> GtkImage.
> Also I want to remove the GtkButton outline.
> I'm using GTK2.0.
> 
> Please let me know if there is any way it can be done.

http://developer.gnome.org/doc/API/2.0/gtk/GtkButton.html#gtk-button-
set-relief

> 
> Thanks,
> Krithika
> 
> ___
> 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 Evaluation tool kit

2006-10-06 Thread Michael L Torrie
On Thu, 2006-10-05 at 14:38 +0530, Shyjumon N. wrote:
>  
> Hi
> 
> Please tell me is there any standard tool kit for the
> performance evaluation of GTK.

Evaluate in what sense?  And what are you trying to evaluate the
performance of?  There are many profiling tools that could be used.

In my opinion, the total throughput of the gui (profiling, raw speed) is
pretty useless in comparison to the performance of your code that
actually gets real work done.  I think in almost all cases (except maybe
video stuff), GTK's speed is all but irrelevant to the overall
performance of an application.  The real question is, how fast does your
application get the things done it was designed to do.  GUIs are just an
interface to the business end of your app.


> 
>  
> 
> With regds,
> 
>  
> 
> Shyjumon N 
> 
> TTEC
> 
> Tel: +91-80-4180-3500 Extn. 3273 
> 
> Mobile: +91-9945006965
> 
>  
> 
> The information contained in this e-mail message and in any annexure is 
> confidential to the  recipient and may contain privileged information. If you 
> are not the intended recipient, please notify the sender and delete the 
> message along with any annexure. You should not disclose, copy or otherwise 
> use the information contained
> in the message or any annexure. Any views expressed in this e-mail are those 
> of the individual sender except where the sender specifically states them to 
> be the views of SoCrates Software India Pvt Ltd., Bangalore.
> ___
> 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: why???

2006-09-08 Thread Michael L Torrie
On Thu, 2006-09-07 at 19:35 -0700, dagang001 wrote:
> #include 
> 
> typedef struct {
> gchar * name;
> gint shoe_size;
> gint age;
> } Person;
> 
> 
> int main(int argc, char** argv) {
> Person *fred = g_new(Person, 1);
> GList *list = NULL;
> 
> gint num,i;
> gchar *ming[]={"aaa","bbb","ccc","ddd"};
> 
> 
> for ( i=0 ;i<4 ;i++)
> {
> fred->name = ming[i];
> fred->shoe_size = i+10;
> fred->age=60+i;
> list = g_list_append(list, fred);
> }
> 
> 
> num=g_list_length (list);
> 
> for (i=0 ;i {
> g_print("%d '%s' %d  %d \n", i,
> ((Person *)g_list_nth (list,i)->data)->name,
> ((Person *)g_list_nth (list,i)->data)->shoe_size,
> ((Person *)g_list_nth (list,i)->data)->age);
> }
> 
> 
> 
> g_print("long%d \n\n", num);
> g_list_free (list);

 ^^
This is a memory leak.  You still have person (one instance only) fred
allocated.  If you did this exercise right, and allocated a new Person
object for ever g_list_append, then you'd have 4 leaked person objects
at this point.  

Supposing you did allocate a new Person object for each list item, you'd
need to do this before the g_list_free call (I think):

g_list_foreach(list,g_free,NULL);

While C does require very manual tracking of memory allocation and
deallocation, the glib routines make it very easy to clean up after
yourself.  In fact many of the data structures, including the trees,
hashes, and so forth, allow you to assign "destructor" functions that
are called on each item in the structure when the structure is freed.
Using these wonderful routines, I create and destroy thousands of very
large and dynamic tree structures without a single memory leak.
Amazing.  I love glib!  I think it should be part of the standard C
library.

Michael


> g_free(fred);
> 
> return 0;
> }
> 
> 
> result:
> 
> 0  'ddd' 13 63
> 1  'ddd' 13 63
> 2  'ddd' 13 63
> 3  'ddd' 13 63
> long4
> 
> help me !!
> 
> 

___
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 copy data between widgets?

2006-08-08 Thread Michael L Torrie
On Tue, 2006-08-08 at 11:48 -0300, Román Gorojovsky wrote:
> As I said before, It's a problem with my C, not my gtk.  A quite
> embarrassing mistake, sorry for wasting your time.

Another way to do it is to assign each widget a string name using
g_object_set_data.  Once this is set, then in your callback you can use
the emitting-object's GtkWidget pointer to lookup the parent widget and
then search down the widget hiearchy for the named label widget.  

Glade-generated code (which is of course deprecated but demonstrates
this solution) does this:

#define GLADE_HOOKUP_OBJECT(component,widget,name) \
  g_object_set_data_full (G_OBJECT (component), name, \
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)

#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
  g_object_set_data (G_OBJECT (component), name, widget)



GtkWidget*
lookup_widget  (GtkWidget   *widget,
const gchar *widget_name)
{
  GtkWidget *parent, *found_widget;

  for (;;)
{
  if (GTK_IS_MENU (widget))
parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
  else
parent = widget->parent;
  if (!parent)
parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
"GladeParentKey");
  if (parent == NULL)
break;
  widget = parent;
}

  found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
 widget_name);
  if (!found_widget)
g_warning ("Widget not found: %s", widget_name);
  return found_widget;
}

GtkWidget*
create_window1 (void)
{
  GtkWidget *window1;
  GtkWidget *vbox1;
  GtkWidget *label;
  GtkWidget *entry;
  GtkWidget *button;

  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window1), _("window1"));

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (window1), vbox1);

  label = gtk_label_new (_("label1"));
  gtk_widget_show (label);
  gtk_box_pack_start (GTK_BOX (vbox1), label, FALSE, FALSE, 0);

  entry = gtk_entry_new ();
  gtk_widget_show (entry);
  gtk_box_pack_start (GTK_BOX (vbox1), entry, FALSE, FALSE, 0);

  button = gtk_button_new_with_mnemonic (_("button1"));
  gtk_widget_show (button);
  gtk_box_pack_start (GTK_BOX (vbox1), button, FALSE, FALSE, 0);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (window1, window1, "window1");
  GLADE_HOOKUP_OBJECT (window1, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (window1, label, "label");
  GLADE_HOOKUP_OBJECT (window1, entry, "entry");
  GLADE_HOOKUP_OBJECT (window1, button, "button");

  return window1;
}


This is somewhat arbitrary, and you could use your own method for doing
the names and searching.  I've found this type of thing to work very
well.

Michael


> 
> Thanks a lot again.
> 
> > Cheers,
> > -Tristan
> >
> 
> 

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


Re: Gtk+ Modality Problem

2006-06-21 Thread Michael L Torrie
On Wed, 2006-06-21 at 18:11 +0200, Atanas Atanasov wrote:
> > Don't forget to set the transient window:
> >
> > gtk_window_set_transient_for(GTK_WINDOW(window),GTK_WINDOW(parent_window));
> 
> I saw this option, but I would like to make the messagebox work
> independently of the window from which it is called. Is this possible?
> What I need is exatcly the behaviour of a modal MessageBox under
> Windows.

This may not be possible.  Under X11, there is not yet a widely used
idea of windows belonging in a group together (grouped by application).
Windows and dialogs are more independent on X11.  So unless you use the
set_transiet_for, the window manager likely won't have any idea which
windows the dialog should be set modal for.

Also remember that many window policies are set by the window manager,
not your app, so behavior will often be different on different desktops.
All you can and should do is give hints to the WM (using
set_transient_for, etc) and leave it at that.

Michael

> 
> Atanas
> ___
> 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: graphics!!

2006-05-08 Thread Michael L Torrie
On Mon, 2006-05-08 at 22:27 +0300, Juhana Sadeharju wrote:
> >I think you may need to use a canvas. For example:
> >http://developer.gnome.org/doc/API/2.0/libgnomecanvas/index.html
> >http://www.dachaplin.dsl.pipex.com/goocanvas/
> 
> Do they have a graph widget? Or are they more primitive?

No. GTK only provides primitives.  There have been several graph widgets
implemented using GTK.  

> 
> I need such a widget in audio apps:
> (1) Envelopes drawn over the audio waveform widget.
> (2) Frequency response curves of multiple parametric filters
> drawn in one canvas.
> (3) Control envelopes.

All of these things would need to be implemented using primitives.  GTK
is just a GUI toolkit, not a domain-specific toolbox.  Audacity (which
uses wxWidgets not GTK) implemented their own widgets for dealing with
waveform graphs and selections and things.

> 
> Much of the stuff what can be seen in VST plugins, in Absynth
> (specially envelopes), Waves' plugins, etc. They look nice too
> unlike what I most see here.
> 
> Does GTK canvases provide transparency? What programs uses the
> canvases? I might want see how they look like.

There is no GTK canvas officially yet.  There are several
implementations of canvases for GTK including gnome-canvas, foo-canvas,
etc.  They vary in purpose and function.

> 
> With gtkglext/opengl all seems to be eventually simpler.
> Multiple "widgets" can be combined by using suitable transparency
> and depth coordinates. Decorations are done easily, e.g., by
> modeling objects in 3D. But then I cannot use the GTK widgets
> indistinctly. Interaction with the opengl objects comes a problem
> as well, making it tempting to use, e.g., OSG (openscenegraph.org).
> But that is a large software and written with C++, which could be
> a problem if I want code in C.
> 
> How would GTK's Cairo integration help? If at all.

Using Cairo do do you drawing of wave forms, envelopes, etc is a good
idea if Cairo is fast enough to do what you need to.  Certainly it seems
to me that a waveform graph, envelopes, etc would be well-suited to a
vector-drawing API.

> 
> Juhana

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


Re: GTK with GCC 4.1 on Fedora Core 5

2006-05-04 Thread Michael L Torrie
On Thu, 2006-05-04 at 18:59 +0200, David Nečas (Yeti) wrote:
> > configure was generated on a system lacking gtk+-devel,
>   ^^
>   This
> is the name of the development package.
> 
> Anyway, you can find out by
> 
>   pkg-config --modversion gtk+
> 
> If you have Gtk+ 1.2 development stuff, it prints its
> version.

As David says, if you install the package gtk+-devel using the yum
command I mentioned, it will properly install the file needed by
configure and then the configure errors will go away.  I have just
verified this.

Michael


> 
> Yeti
> 
> 
> --
> Anonyms eat their boogers.
> ___
> 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 with GCC 4.1 on Fedora Core 5

2006-05-04 Thread Michael L Torrie
On Thu, 2006-05-04 at 09:48 -0600, Karihaloo, Ujjval wrote:
> Hi,
> 
>  I am not sure if the GTK+ 1.2.10 version that I have is a developer
> version. How can I find out?

What he means is that you need the "-devel" package which includes the
necessary header files and link libraries.  To install them on FC5,
probably you need to run as root:

yum install gtk+-devel

After you do this, you can compile any GTK 1 program with something
like:
gcc -o gtkprog gtkprog.c `gtk-config --cflags --libs`

Most of the apps you'll download and compile will find the gtk-config
program and get the cflags and library flags automatically.

Michael


> 
> -Original Message-
> From: David Necas (Yeti) [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, May 04, 2006 2:45 AM
> To: Karihaloo, Ujjval
> Cc: gtk-app-devel-list@gnome.org
> Subject: Re: GTK with GCC 4.1 on Fedora Core 5
> 
> On Wed, May 03, 2006 at 09:17:59PM -0600, Karihaloo, Ujjval wrote:
> > ./configure: line 5028: syntax error near unexpected token `1.2.0,'
> > ./configure: line 5028: `AM_PATH_GTK(1.2.0, ,'
> 
> configure was generated on a system lacking gtk+-devel,
> AM_PATH_GTK() was undefined then and thus left unexpanded.
> If you re-generate configure now, it should be OK.
> 
> Yeti
> 
> 
> --
> Anonyms eat their boogers.
> ___
> 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: Cross-platform apps

2006-04-26 Thread Michael L Torrie
On Wed, 2006-04-26 at 16:12 +0200, Cesc wrote:
> I agree on all the advice you are given here ...
> My experience is that it is not piece of cake, but it can be done.
> Test often and plan compatibility since the very beginning.
> Then, i would recommend you take a look at other projects which are
> cross-platform and you borrow from there ... for example, i am
> involved with MiniSIP (www.minisip.org), which is builds on linux,
> win32 and wince. The approach is to isolate OS dependent calls in
> compatibility layers (in minisips case, libmutil and libmnetutil), so
> you have a stable API which compiles the appropriate code depending on
> the platform.

Definitely doing your own this abstractions is very important.  This
doesn't always mean making lots of #ifdefs and #defines, or wrapper
functions either.  In many cases this means you've completely separated
your backend code from your frontend (the UI).  If you completely
modularized the backend to the point that OS-specific things can be
compartmentalized into their own modules which can be selected at
compile time, you will be much more successful.  I believe this is a
better approach than trying to limit yourself to the most common
denominator c library calls.  For example I have written one program
that uses asynchronous socket i/o.  Because of the design of the backend
code, I can move my state machine engine to threaded-i/o without a lot
of problem for platforms where that may be better (just an example
that's not necessarily relevant).

One thing I find that helps make the backend more portable is heavy use
of glib (the underlying utility library from gtk).  This can allow you
to do file i/o on a variety of OSes and file systems and not worry about
things like path separators.  For areas where glib doesn't cover
directly, like socket i/o, having an OS-specific module would be needed.

On the frontend, GTK does provide some portability and abstraction that
works well on Windows and Linux, but not so much on OS X yet.  For this
reason I have been using Qt a lot lately, since Qt 4.1 is now very
native on Windows and OS X.  But if your target is X11 and Win32, gtk
works very well.  However it is not always a good idea to tie your UI
(gtk) so closely to the backend that it would not be possible to change
out the GUI down the road and use something else (something native for
example, like, heaven forbid, win32).  Abiword chose this route.  The
backend code is shared between platforms but the UI is, to my knowledge,
specific to the OS.

I have written several programs recently in Qtk (and Qt) with the
intention to run them on several platforms and, having planned for this
from the beginning, have been quite successful.  For just a little bit
of effort up front (which turns out to be good practice anyway), you'll
find the transition from platform to platform to be relatively simple.
Makes me wonder why any application developer would ever intentionally
tie himself to one platform regardless of that platform's market share.


Michael

> 
> Good luck!
> 
> Cesc


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


RE: newbie trap

2006-04-12 Thread Michael L Torrie
On Wed, 2006-04-12 at 16:12 +0100, Ross Clement wrote:
> Thanks Tristian and Jan for the answers.
> 
> I'm not calling 
> 
>  while ( gtk_events_pending ())
>  gtk_main_iteration ();
> 
> from event handlers, they are being called from the main thread. I have
> several threads running in my program. Two are the threads created by
> PortAudio which read audio data into or out of ring buffers. The output
> ring buffer is only written to by the main thread, the input ring buffer
> is only written to by the the PortAudio thread. Audio processing is then
> done by my main thread.

I wrote a simple little program just last night that implements a simple
audio-level meter using a progress bar.  I gave up on PortAudio and
moved to RtAudio, but the principles are the same.  In my RtAudio
callback, I set a variable (this is C++, so it's a class variable) to
the peak value for the current buffer.  This callback is running in the
RtAudio thread, so I don't mess with the gui at all here.  Rather I just
have an idle event that fires in the main gui thread that just looks at
that variable and sets the progress bar.  This works very well.  In
fact, 90% of the time, this kind of timeout or idle event updating of
the gui is the best.  I don't need to do any synchronization because the
gui only reads the variable.

> 
> My gtk event handlers typically change the values of variables. The main
> thread then notices that the values have changed and performs the
> necessary actions. My program is (I believe) simple enough so that this
> mechanism for communicating GUI events to the main thread should be
> sufficient. I hope.

This sounds okay, but below you mention the gtk main loop is in the main
thread.  If that is the case, what is your event handler doing running
in a secondary thread?

> 
> Very early on I noticed that if I called gtk_main_iteration() from a
> secondary thread while the main thread was running gtk_main() that gtk
> complained. That's when I deleted gtk_main(), and made the secondary
> thread the primary one. Everything seems to be working since then, but I
> was concerned about traps for young players.

Bad.  Don't call gtk_main_iteration() from a secondary thread if the
main gtk loop is in the main thread.  I'm surprised it even works for
you.

> 
> I think I have avoided problems of reentrant code. E.g. I have a
> "record" button. If the button is pressed again during recording or
> processing of audio, the main thread will go back and start recording
> again from scratch. This seems to me, without going into great detail
> about my program, a reasonable user interface. Although while writing
> this paragraph I went over and fixed a tiny bug by making sure that the
> text of my progress bar was reset to "recording" if this happens :-)

Without seeing any of your code to get an exact picture of what you're
doing, I can't say for sure.  But what you've described doesn't feel
quite right.

I am familiar with how PortAudio (and RtAudio) works.  Here's how I'd do
it.  Leave all gui functions in the main thread.  Start the gtk main
loop and don't look back.  Nothing more will be done in the main loop.
When the user clicks the record button, check state variables and if
things are right, start up a thread that does the actual portaudio
stuff.  In the portaudio callback, don't touch the gui at all.  Just
process the buffer and use variables to communicate with the gui thread.
IE, set the peak value, the position, time elapsed, etc in simple
variables.  Then in the main thread, use an idle timeout to monitor
these variables and update the gui accordingly.  This timeout event
handling can be started in the button press callback.  If you need the
gui to communicate to the portaudio thread to start or stop it, use a
flag variable or something.  In this case, IPC is pretty simple (on-way)
and needn't use mutexes or semaphores.  

Michael


> 
> Cheers,
> 
> Ross-c
> 
> 
> On Wed, 2006-04-12 at 15:01 +0100, Andersen, Jan wrote:
> > Ross Clement wrote:
> > > Hi. I find myself writing a program that processes the gtk gui events
> > > itself. E.g. code vaguely similar to the pseudo-code:
> > > 
> > > while( large_compute_bound_job_not_finished )
> > > {
> > >   process_next_block_of_data();
> > >   gtk_progress_bar_set_fraction( progressBar, fraction );
> > >   
> > >   while ( gtk_events_pending ())
> > >   gtk_main_iteration ();
> > > }
> > > 
> > > Is this something that it is frequently sensible to do, or have I fallen
> > > into a big newbie trap?
> > >
> > I'm not sure I understand you correctly, but one thing to think about is 
> > reentrance; are the screen update functions reeantrant? I remember from my 
> > Windows days (now happily in the remote past) that anything to do with the 
> > desktop was not reentrant. What that means is that you can not update the 
> > screen from anything other than the main thread; I have got used to simply 
> > avoiding that, so I don't know if X can handle it.
> > 

Re: Refreshing the progressbar

2006-04-12 Thread Michael L Torrie
On Wed, 2006-04-12 at 05:16 +0100, Sandy K wrote:
> Hello all,
> I am using the probress bar to show the progress
> of some event. Initially i have some text in the
> progress bar. After the event is complete, i change
> the text on the progress bar.. But it is not getting
> changed...
> 
> But once i minimise the window and then maximise it,
> the text on the progress bar is changed...
> 
> Is there any way i can change the text on the
> progressbar automatically?

Are you using threads by chance?

> 
> Thanking You
> Sandy
> 
> 
>   
> __ 
> Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.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: Choosing a parent class

2006-04-11 Thread Michael L Torrie
On Tue, 2006-04-11 at 19:35 +0200, Andreas Kotowicz wrote:
> I created a composite widget which consists of two frames, one of which
> holds a calendar and a second one which has some buttons. I now ask
> myself what is the right parent class to choose from. Is it GtkFrame?
> Why can't I just choose GtkWidget? are there any rules which classes to
> choose from for composite widgets? (I know, the tutorial says you should
> use the class which is most similar but that's now very precise).

I don't know a lot about gtk inheritance, and I have been spoiled by
python's extensive use of multiple inheritance, but I think the answer
to your question may lie in asking whether your new widget is something
or contains something.  IE is your widget a frame?  Or is it a widget
that contains frames.

If I were you I'd inherit from GtkVBox.  Then have two frames as members
and place them in the vbox (which is already a container).

Michael


> 
> cheers,
> Andreas
> 
> ___
> 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 trap mouse motion, mouse up, and wheel events?

2006-03-31 Thread Michael L Torrie
On Fri, 2006-03-31 at 16:38 -0500, Dov Kruger wrote:
> I do not see examples of how to use g_signal_connect and would
> appreciate some help, perhaps an example?

Use it the same way you used the gtk_signal_connect calls.  Just replace
one with the other.  

> 
> Right now, the code does not trap mouse motion, mouse up, or wheel
> events, but it does trap key clicks and mouse presses.

You need to enable the other events with a call to
gtk_widget_set_events. 

See http://www.gtk.org/~otaylor/gtk/tutorial/drawing_tut-1.html

> 
> Can someone please tell me what is wrong? Is it that the code is
> deprecated? Is there something I am doing wrong?

Just enable the extra events for the widgets you want to trap motion on.
using gtk_widget_set_events(widget,GDK_POINTER_MOTION_MASK)

Michael


> 
> thanks!
> 
> ___
> 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: Theme not affecting titlebar on windows xp... help needed

2006-03-17 Thread Michael L Torrie
On Sat, 2006-03-18 at 00:38 +0100, Gus Koppel wrote:
> However, then you would have to manage all tasks the window manager
> takes care of by yourself, i.e. minimizing and maximizing the window on
> request and providing correct drag behaviour. For resizability of your
> windows you would still have to rely on the real window manager, since
> the resizing borders don't (and can't) belong to the interior of a
> window.

To do resize, you can just detect a mouse drag that starts in, say the
lower right-hand corner, and then give the real window manager hints to
resize the window.  This would work on linux and windows.  This is how
xmms does it (gtk1 app, though).  So you could simulate all aspects of
the real window manager from within a decoration-less window as you have
mentioned, but it would be a lot of work and the usability  would be
questionable.

Michael


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


Re: Theme not affecting titlebar on windows xp... help needed

2006-03-17 Thread Michael L Torrie
On Fri, 2006-03-17 at 23:48 +0100, David Necas (Yeti) wrote:
> Boring is not the word I would use, what about familiar,
> consistent, predictable, or integrated?

Agreed.  The problem with GTK on windows always used to be it looked
like a horrible, out-of-place motif app.  Now with the WIMP theme things
look a lot better.  GTK apps actually now fit on windows.  The WIMP look
is what users expect.  

Applications that totally theme themselves differently from other,
standard, windows apps suffer from usability issues.  Programs like
Symantec Antivirus are some of the worst offenders.  Horrid user
interface.  What's wrong with the standard UI look?  Microsoft itself is
a bad offender. Every Office version has its own theme that usually
doesn't look like all the rest of the windows apps.

> 
> Anyway, I do not know how or if decorations of individual
> windows can be themed on Microsoft Windows, but Gtk+ has
> nothing to do with it, you have to talk to the windowing
> system.

GTK indeed cannot influence this directly.  The only way you could
simulate what you are looking for is to request that the window be drawn
without any decorations at all.  Then use gtk drawing routines to draw
in a title bar at the top of the window.  Of course you'd have to take
care of everything (resizing the window, moving the window, etc)
yourself.  An example of this is the old xmms app on linux.  So it can
be done if you really really want.

> 
> Yeti
> 
> 
> --
> That's enough.
> ___
> 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: Theme not affecting titlebar on windows xp... help needed

2006-03-17 Thread Michael L Torrie
On Fri, 2006-03-17 at 15:05 -0800, Wallace Owen wrote:
> Maybe he remembers the cool looking themes that Enlightenment did, or
> the various themes that Gnome's manager provides, confusing window
> decoration themability that's the domain of window managers with the
> button/label/etc. gui element themability of gtk.

Well that has nothing to do with GTK.  If you want fancy themed windows
in XP you need to use the xp themeui.dll stuff.  I think litestep uses
this now, as does windowblinds.

Michaek


> 
> 
>   // Wally
> 

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


Re: Theme not affecting titlebar on windows xp... help needed

2006-03-17 Thread Michael L Torrie
On Fri, 2006-03-17 at 14:26 -0700, Plummer, Jeff-P56711 wrote:
> I am using the C# port of GTK+ on Windows XP, and I'm trying to write an
> app that is skinnable.  Below is my simple test code that attempts to
> set the theme of the window. It sets the theme for all the widgets
> inside the main window, but it doesn't set the theme of the main window
> (titlebar).  Does anyone have any ideas on how to setup the application
> such that the entire application is in a given theme, including the
> titlebar?

I think we've been here before.  

Window decorations are, on X11, a function of the window manager.  On
windows, they are a function of, well, windows.  GTK has nothing
directly to do with window decorations, other than to request a
particular type of window.

Why do you want your titlebar to be themed by GTK?

> 
> 
\

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


Re: GTK and threaded applications

2006-02-01 Thread Michael L Torrie
On Wed, 2006-02-01 at 10:44 +0100, kornelix wrote:
> Thanks for your generous help. I will try Michael's suggestion and see 
> how it works.
> 
> I would like to implement all GTK calls in the main program as Tristan 
> suggested, but this seems to be very complex (must implement asynch. 
> queues of data going back and forth between threads and main(), where 
> screen updates and user inputs take place.
> 
> Question: it seems to me that GTK puts the burden of locking (and the 
> responsibility to understand GTK internals) in the wrong place: the user 
> of GTK. Would it not be better if GTK took care of its own locking and 
> blocking in those places where it is necessary? Is this in the roadmap 
> for GTK, or should it be?

I believe if such locking were made automatic in the GTK  libraries
themselves, we'd be open to possible deadlock situations.  Better to
leave the locking in control of the programmer who can then resolve any
deadlocks in his code.

> 
> I have written multi-threaded applications in Win32, and I never worried 
> about locks and thread blocking (except for my own application's business).

It has been nearly 8 years since I did any Win32 GUI programming, but at
the time I recall that because the Win32 GUI calls had to be
synchronized too, I ended up have a thread just for the gui and had a
message queue that I used to send it messages to change things in the
GUI.  So unless you were using a toolkit that hid the synchronization
details from you (not MFC!) then perhaps you were lucky you didn't have
any problems.

> 
> I have not looked at KDE. Any better?

Qt is now supposed to be thread-safe as of somewhere in version 2 (we're
now up to 3.3 and 4.1).  I don't know how they implement the
synchronization stuff.

Michael



> 
> thanks again,
> Mike


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


Re: GTK and threaded applications

2006-01-31 Thread Michael L Torrie
On Tue, 2006-01-31 at 18:28 +0100, kornelix wrote:
> Following the guidelines in the FAQ, I constructed my application 
> threads as follows:
> 
>gdk_threads_enter();//  enter thread
> (do some work, including GTK calls)
>gdk_flush();//  exit thread
>gdk_threads_leave(); 
>return 0;
> 
> Now my multi-threaded application executes its threads one after the 
> other, instead of in parallel. Apparently the above method introduces a 
> lock or mutex which allows only one thread at a time to execute.
> 
> Is this a hopeless situation, or is there some other way?
> (other than putting all GTK calls in the main program)

Just put the gdk_* threads and flush calls around the actual GTK calls.
that way only gui updates themselves are put in mutexes (locked).  The
way you are currently doing it, your actual business logic ends up in
the mutex, and so if it is lengthy, it will block all the other threads.

Michael


> 
> thanks,
> Mike
> 
> ___
> 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+-1.2.10 (linux) vs gtk+-1.3.0 (windows) looks

2005-05-12 Thread Michael L Torrie
On Thu, 2005-05-12 at 17:10 +, Chisheng Huang wrote:
> Hi,
> 
> Does anybody know how to make radio buttons, check buttons, and spinners
> in GTK+-1.3.0 for MS Windows look as nice as those in GTK+-1.2.10 for 
> Linux?  Here is a URL with images illustrating the differences:

You are strongly recommended to move to the current version of GTK 2.
The default theme on windows is native-looking.  it is very nice
especially on XP.

The differences you are seeing in your illustration are all in the
themes.  The bottom (win32) version is the default gtk1 theme and the
top picture was the special "redmond" theme.  If you put the redmond
theme on the win32 box, it would look the same.   However, on XP your
app would look very old and out of place.  With gtk2, your app will have
the same stylings and color scheme as the rest of windows which is very
nice.

At this point there are no bug or security fixes coming out for gtk1, so
use it at your own risk, and don't expect a lot of tips as very few
people are using it these days.

Michael


>   
>   http://chi-square-works.com/linux-vs-windows.html
> 
> Thanks a lot for any input.
> 
> Best,
> 
> -cph
> 
> ___
> 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