After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 120417 - book: DrawingArea chapter ported to gtkmm2
book: DrawingArea chapter ported to gtkmm2
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: reference documentation
2.2
Other All
: Normal trivial
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2003-08-21 19:50 UTC by Marble
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fixes to sample code in tutorial (2.18 KB, patch)
2003-08-21 19:52 UTC, Marble
none Details | Review
Updates the drawing area section (could be better explained, but at least it is now correct) (20.20 KB, patch)
2003-08-22 20:57 UTC, Marble
none Details | Review
New sample code for the drawingarea section of the docs (1.46 KB, application/octet-stream)
2003-08-22 20:58 UTC, Marble
  Details
Replacement drawingareas.tar.bz2 with updated example code (1.81 KB, application/octet-stream)
2003-08-25 11:22 UTC, Marble
  Details
tutorial xml file patch, with paths changed to reflect renamed drawingarea{1,2} to drawingarea_{lines,text} (20.21 KB, patch)
2003-08-25 11:25 UTC, Marble
none Details | Review

Description Marble 2003-08-21 19:50:08 UTC
The DrawingArea section of the tutorial contains some example code with
errors that prevent it compiling. 1) It calls size() which doesn't exist, 2)
It uses . rather than ->.
Comment 1 Marble 2003-08-21 19:52:35 UTC
Created attachment 19426 [details] [review]
Fixes to sample code in tutorial
Comment 2 Murray Cumming 2003-08-21 20:07:58 UTC
Is this in a code snippet or a full example? Full examples should be
pulled in from examples/book/something/, like the other examples.
 
I notice that there is some old gtk 1.2 code in there - this chapter
really needs to be deal with or removed.
Comment 3 Marble 2003-08-21 20:15:54 UTC
Looks like it is a complete program, but there is no corresponding code
in the examples/book that I can see. (Did you mean that I had patched
the wrong file, or that I should split it out into a new file?)

I must admit I've not looked at the rest of that chapter, it only came
to my attention that this code needed fixing when someone asked about
it on the mailing list today.
Comment 4 Murray Cumming 2003-08-22 07:29:51 UTC
It should be a separate set of source files, like the existing
examples in examples/book. It should have a similar style and
structure to the existing samples. You would still need to path
gtkmm-tut.xml to pull in the source code.
Comment 5 Marble 2003-08-22 20:57:39 UTC
Created attachment 19457 [details] [review]
Updates the drawing area section (could be better explained, but at least it is now correct)
Comment 6 Marble 2003-08-22 20:58:47 UTC
Created attachment 19458 [details]
New sample code for the drawingarea section of the docs
Comment 7 Marble 2003-08-22 21:03:03 UTC
The documentation update patch (id=19457) supercedes the first, simpler patch 
(id=19426). It also includes updates to some Makefile.am files that assume 
examples/book/drawingarea has been moved to examples/drawingarea. 
Attachment (id=19458) contains a tar.bz2 of the new sample code that should be 
extracted in examples/book (cvs diff -u misses new files, as I don't think I can 
cvs add them). 
 
I may later work on the wording some more as I believe that there is still much 
room for improvement, but I think it would be useful to at least get to the point 
where what is said is correct for the current version. 
Comment 8 Murray Cumming 2003-08-23 11:30:57 UTC
This is great, and people will be very grateful for this, but we need
to make a few changes:

1. The directories should have more meaningful names than drawingarea1
and drawingarea2. Maybe drawingarea_line and drawingarea_text?

2. They should have the same structure as the other examples:
  - We usually have separate window .h and .cc files and a main.cc
file. We have one class per file, so you might need to put the derived
DrawingArea in separate files.
  - Use the Main::run(window) technique and show_all_children()
instead of show_all().
  - Use capitals for class names, instead of lower case and _.
  - Put protected members at the end of class declarations.
  - I think we use one simple gtkmm.h include.

3. In the
 get_window()->draw_line(get_style()->get_black_gc(), 5, 2, 5, 20);
line, can we please use variables for the window and gc, to make it
look more concise?

4. *_event() signal handlers are confusing, so we need a comment
saying what the return value does.
 
Comment 9 Marble 2003-08-25 11:22:44 UTC
Created attachment 19483 [details]
Replacement drawingareas.tar.bz2 with updated example code
Comment 10 Marble 2003-08-25 11:25:02 UTC
Created attachment 19484 [details] [review]
tutorial xml file patch, with paths changed to reflect renamed drawingarea{1,2} to drawingarea_{lines,text}
Comment 11 Marble 2003-08-25 11:26:38 UTC
Thanks for the comments - I'd originally tried to make as few changes as possible 
from the original to make it work with current gtkmm. I've just attached updated 
patches that incorporate the changes requested. 
Comment 12 Murray Cumming 2003-08-27 07:44:03 UTC
This is checked in, with a few minor source code changes:
- Use of m_ prefix with member variables.
- Use of 2 spaces instead of tabs.
- I removed the member variables from one of the examples because they
are not used. I don't think they are used in the other example, but
it's bigger, and people can probably imagine how they might be useful.
- I have removed the old drawingarea example.

Well done. It's great to finally have this done.
Comment 13 Murray Cumming 2003-08-27 07:45:57 UTC
Oops, something isn't working:
http://www.gtkmm.org/gtkmm2/docs/tutorial/html/ch14s03.html

The examples should be at the end of the chapter, by the way, with a
screenshot, like the others. Reopening.
Comment 14 Murray Cumming 2003-08-27 15:03:05 UTC
I am fixing this.
Comment 15 Murray Cumming 2003-08-28 07:25:09 UTC
Fixed:
http://www.gtkmm.org/gtkmm2/docs/tutorial/html/ch14.html

Thanks again.