Hello List (again, on the same program, different bug or misunderstanding)
I don't understand well how to use Gutter-s and marks inside. Sorry, I am giving a lot of details. The questions are at the end of the email. ################# detailed context I'm using the following packages on GNU/Linux/Debian/AMD64/Sid libgtksourceviewmm-3.0-dev 3.2.0-1 libgtkmm-3.0-dev 3.2.0-1 Look into http://mail.gnome.org/archives/gtkmm-list/2012-March/msg00048.html to briefly understand my motivation and goals. (I'm working on GCC MELT, a plugin for GCC). I'm writing a simple probe program in GTkSourceViewMM to display a C source code file, with interesting locations where the MELT plugin could display interesting informations related to some source code location. That probe program has a GTK user interface and is interacting asynchronously with GCC thru two textual pipes. my GPLv3 source code inside the GCC MELT branch. See http://gcc-melt.org/ for more about MELT (MELT is a high-level domain specific language to extend GCC; it has a lispy syntax and is translated to C; the melt.so plugin is a meta-plugin to GCC, etc..) The source code is exactly in the file simplemelt-gtkmm-probe.cc of the contrib directory of that branch. You can fetch it with svn co svn://gcc.gnu.org/svn/gcc/branches/melt-branch/contrib I'm talking of the svn revision 185560 of it. To reproduce my bug you'll need the two files simplemelt-gtkmm-probe.cc and paranoia.cc Compile simplemelt-gtkmm-probe.cc as g++ -std=gnu++0x -Wall -O -g \ $(pkg-config --cflags --libs gtksourceviewmm-3.0 gtkmm-3.0 gtk+-3.0) \ -o simplemelt-gtkmm-probe simplemelt-gtkmm-probe.cc the file paranoia.cc is only needed as an input data. Run the program under gdb, e.g. simplemelt-gtkmm-probe -D -t -C 0 -R 1 --g-fatal-warnings Then type the following lines separated by two newlines each: showfile_pcd "paranoia.cc" 1 marklocation_pcd 1 1 15 3 I am getting an error; (I'll try to explain what I am understanding of it below) GdkPixbuf-CRITICAL **: gdk_pixbuf_scale_simple: assertion `dest_width > 0' failed Program received signal SIGTRAP, Trace/breakpoint trap. 0x00007ffff42a59fa in g_logv () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 (gdb) bt #0 0x00007ffff42a59fa in g_logv () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #1 0x00007ffff42a5bc2 in g_log () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #2 0x00007ffff4ef2ef4 in gdk_pixbuf_scale_simple () from /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 #3 0x00007ffff793b18a in gtk_source_pixbuf_helper_render () from /usr/lib/libgtksourceview-3.0.so.0 #4 0x00007ffff793937c in ?? () from /usr/lib/libgtksourceview-3.0.so.0 #5 0x00007ffff7bbd054 in Gsv::GutterRenderer_Class::draw_vfunc_callback (self=0x64a280, cr=0x7ffff4a8cd60, background_area=0x7fffffffd770, cell_area=0x7fffffffd780, start=0x7fffffffd5b0, end=0x7fffffffd600, state=GTK_SOURCE_GUTTER_RENDERER_STATE_NORMAL) at gutterrenderer.cc:418 #6 0x00007ffff793564c in ?? () from /usr/lib/libgtksourceview-3.0.so.0 #7 0x00007ffff5cbaed3 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #8 0x00007ffff5df2a80 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #9 0x00007ffff455c622 in g_closure_invoke () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 #10 0x00007ffff456e3a3 in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 #11 0x00007ffff4575f57 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 #12 0x00007ffff4576aa2 in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 #13 0x00007ffff5e0464a in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #14 0x00007ffff5e047f1 in gtk_widget_send_expose () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #15 0x00007ffff5cbaddc in gtk_main_do_event () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 ################################### what I understood or suspect Graphically, I would like to have marks for a source code view, like Gnu Emacs is displaying when you run the gdb debugger inside it with M-X gdb ; the marks should appear at the left of a given source code line. I want to display some marks at the left of a GtkSourceView and also some tiny buttons inside the GtkSourceView text. I want one mark per line containing these tiny buttons. As a general remark, I feel that the gutters are lacking documentation and examples... When the probe recieves the "marklocation_pcd 1 1 15 3" command, it should create a mark and afd a tinty button inside a GtkTextSourceView & Buffer... A mark has an XPM pixbuf for it. That XPM pixbuf is made once at application initialization time with line 839 _app_key_7x11_pixbuf = Gdk::Pixbuf::create_from_xpm_data (smelt_key_7x11_xpm); assert (_app_key_7x11_pixbuf && _app_key_7x11_pixbuf->gobj() != nullptr); The gutter is obtained in my ShownFile internal class, near line 266 (a member function of my ShownFile class) Glib::RefPtr<Gsv::Gutter> left_gutter() { return _sfilview.get_gutter(Gtk::TEXT_WINDOW_LEFT); } when I am creating a mark, I am near line 1155 Glib::RefPtr<Gsv::Gutter> gut = sfil->left_gutter(); auto gutrenderer = new Gsv::GutterRendererPixbuf(); gutrenderer->set_pixbuf(SmeltAppl::instance()->key_16x16_pixbuf()); gut->insert(gutrenderer,lineno-1); and when the gtksourceview is refreshed, I crash with as I am showing before gdk_pixbuf_scale_simple: assertion `dest_width > 0' failed ################################ Questions What do I do wrong? How to use gutter and add pixbuf inside? The Gsv::GutterRendererPixbuf class is barely documented, and I would like an example or some advice for it; do you have some?? Why does GtkSourceViewMM has to scale an XPM pixbuf? How could I validate the pixbuf at its creation time? Regards. PS: Sorry for such a long email, I wanted to give all the details that might be relevant. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mines, sont seulement les miennes} *** _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
