2007-08-13 Damon Chaplin * src/goocanvastext.c: added "wrap" property (patch from James Dietrich). * src/goocanvastable.c: use static goo_canvas_table_parent_iface and goo_canvas_table_model_parent_iface variables which are set in the class_init functions. That makes it much easier to call the GooCanvasGroup methods when needed. * src/goocanvasitemsimple.c (goo_canvas_item_simple_set_parent): call goo_canvas_item_set_canvas() so items can do whatever is needed (e.g. groups can pass the canvas on to children). * src/goocanvasitem.c (goo_canvas_item_request_update): don't use return here as it is a void function. * src/goocanvastable.c (goo_canvas_table_remove_child): * src/goocanvasgroup.c (goo_canvas_group_remove_child): check the child_num arg is valid. 2007-06-20 Damon Chaplin * src/goocanvas.c: added "automatic-bounds", "bounds-from-origin" and "bounds-padding" properties, used to calculate the canvas bounds automatically. * demo/demo.c (change_bounds_clicked): * demo/mv-demo.c (change_bounds_clicked): test the above. 2007-06-19 Damon Chaplin * src/goocanvas.c: added "integer-layout" boolean property, to specify that all layout in the canvas (i.e. in GooCanvasTable) is done to the nearest integer. * src/goocanvastable.c: implement integer layout. * demo/table-demo.c: * demo/mv-table-demo.c: tests for integer layout. 2007-05-15 Damon Chaplin * src/goocanvas.c: added "scale-x" and "scale-y" properties to set the horizontal and vertical scale independently. Note that if items use the visibility threshold setting it will compare it to the minimum of scale_x and scale_y. * demo/demo.c: added "Scale X" and "Scale Y" spinbuttons. 2007-05-15 Damon Chaplin * src/goocanvas.c (goo_canvas_style_set, goo_canvas_realize): reset the window backgrounds to nothing, to avoid flicker when scrolling. (This happened due to the delay between X clearing the window and GooCanvas repainting it.) (goo_canvas_expose_event): clear the background ourselves here. 2007-05-14 Damon Chaplin * src/goocanvas.c (goo_canvas_set_property) (goo_canvas_set_bounds): queue a redraw of the widget. (goo_canvas_expose_event): clip to the canvas bounds if necessary. * demo/mv-demo.c (change_bounds_clicked): * demo/demo.c (change_bounds_clicked): test changing the bounds dynamically. 2007-05-13 Damon Chaplin * src/goocanvaspath.c: use a common GooCanvasPathData like the other standard items. This fixes a crash where the model's path_commands GArray was updated but the view still pointed to the old GArray which had been freed. * demo/mv-demo-paths.c: * demo/demo-paths.c: added a button to test changing the path data dynamically. 2007-05-11 Damon Chaplin * demo/demo-large-rect.c: * demo/demo-large-line.c: * demo/demo-large-items.c: new demo and items to show how to create a very large canvas and very large items. * src/goocanvasitemsimple.c (goo_canvas_item_simple_get_line_width): added utility function to get an item's line width. Also changed default line width property value to 2.0, and returned canvas line width setting if item's line width isn't set. * src/goocanvasrect.c (goo_canvas_rect_update): * src/goocanvaspolyline.c (goo_canvas_polyline_reconfigure_arrows): use the above function to get the line width. 2007-04-30 Damon Chaplin * src/goocanvas.c (goo_canvas_create_cairo_context): if the GooCanvas isn't realized, use a temporary image surface to create the cairo_t. Hopefully that will result in exactly the same bounds of items. (goo_canvas_get_item): initialize item to NULL. 2007-04-27 Damon Chaplin * src/goocanvasitem.h: * src/goocanvasutils.c (goo_canvas_bounds_get_type): added type stuff for language bindings (patch from Murray Cumming). 2007-04-25 Damon Chaplin * src/goocanvasitemmodel.c (_goo_canvas_item_model_emit_child_added) (_goo_canvas_item_model_emit_changed): new simple functions to emit signals faster (avoids signal name lookups). * src/goocanvasitemsimple.c (goo_canvas_item_model_simple_set_property) (goo_canvas_item_model_simple_set_transform) (goo_canvas_item_model_simple_set_style): * src/goocanvasgroup.c (goo_canvas_group_model_add_child): use the above functions for a little speedup. 2007-04-25 Damon Chaplin * demo/mv-scalability-demo.c: * demo/scalability-demo.c: instead of connecting signals to all items we just use a handler on the root item. Also added a switch to turn off the text items, to see the difference in performance (a lot). Without text items we can startup with 100,000 items in 1 second for a simple canvas, or 4 seconds for model-view (compared to 4 seconds and 7 seconds with text items). * src/goocanvasitemsimple.c (goo_canvas_item_simple_set_model): only setup the accessibility stuff if accessibility is enabled (as it is quite slow if you have lots of items). 2007-04-25 Damon Chaplin * src/goocanvasrect.c (goo_canvas_rect_update): added optimized function to calculate the bounds without using cairo. 2007-04-16 Damon Chaplin * src/goocanvasitem.c (goo_canvas_item_animate_cb): check keep_source before updating the item so we don't use the freed animation data. 2007-04-16 Damon Chaplin * src/goocanvasitemsimple.c (goo_canvas_item_simple_get_path_bounds): handle empty bounds for an item's fill or stroke. cairo 1.4.x returns 0.0 for x1/y1/x2/y2 in that case, though older versions of cairo returned odd values. So I've added a workaround for that as well. 2007-04-05 Damon Chaplin * src/goocanvas.c (goo_canvas_key_press, goo_canvas_key_release): only emit "key-press" and "key-release" signals on items if the canvas has the focus. (We were incorrectly emitting signals if an embedded widget had the focus, as the events were propagating up to the canvas.) 2007-04-03 Damon Chaplin * Released GooCanvas 0.8 2007-04-03 Damon Chaplin * demo/mv-demo.c (create_canvas_primitives): * demo/demo.c (create_canvas_primitives): set the maximum scale to 50, since if we go above that we hit the cairo 16-bit limit and the large rectangle isn't painted correctly. * src/goocanvasitemsimple.c (goo_canvas_item_simple_install_common_properties): improved docs for fill/stroke properties. * src/goocanvaswidget.c (goo_canvas_widget_new) (goo_canvas_widget_set_widget): keep our own reference to the widget, rather than just relying on the canvas widget's reference. Otherwise once the widget is removed from the canvas we have an invalid pointer. 2007-03-30 Damon Chaplin * src/goocanvasutils.c (goo_canvas_boolean_handled_accumulator): new function, copied from _gtk_boolean_handled_accumulator(). * src/goocanvasitem.c (goo_canvas_item_base_init): use the above accumulator for the event signals, so returning TRUE from a handler stops the signal. * src/goocanvasitemsimple.h (struct _GooCanvasItemSimpleData): * src/goocanvasitem.h (struct _GooCanvasItemIface): added a few bits that will be needed to support tooltips with GTK+ 2.12. I have a patch to support tooltips but I don't want to depend on GTK+ 2.12 yet. 2007-03-28 Damon Chaplin * src/goocanvasstyle.c (goo_canvas_style_set_fill_options): check if the fill pattern is set to NULL, which is used to reset any fill pattern or color. If it is, don't set the cairo source and return FALSE. * demo/demo.c (move_ellipse_clicked): set the fill pattern to NULL occasionally to test the above. 2007-03-27 Damon Chaplin * src/goocanvas.c: added "background-color" and "background-color-rgb" properties to set the background color of the canvas, based on a patch from Gian Mario Tagliaretti. * demo/demo.c (create_canvas_primitives): * demo/mv-demo.c (create_canvas_primitives): use above properties. 2007-03-16 Murray Cumming * src/goocanvasitemsimple.h: Change the struct field name from private to priv, to avoid problems when using this from C++. 2007-03-08 Damon Chaplin * src/goocanvasitemsimple.h (struct _GooCanvasItemSimpleData): use guints for the bitflags rather than the enum types, since that is what GTK+ does. Maybe enums cause a problem because of being signed ints. Also added cache_setting which we may use in future. (struct _GooCanvasItemSimple): added private pointer to allow a bit of expansion in future (e.g. maybe a cache). 2007-03-08 Damon Chaplin * src/goocanvaswidget.c (goo_canvas_widget_set_canvas): unparent the widget if the canvas is set to NULL (i.e. when the item is removed from the canvas). 2007-03-08 Damon Chaplin * src/goocanvasitemmodel.c (goo_canvas_item_model_remove): * src/goocanvasitem.c (goo_canvas_item_remove): new convenience functions to easily remove items & models from the canvas. * demo/mv-demo-features.c (on_button_press): * demo/demo-features.c (on_button_press): * demo/demo.c (on_button_press): * demo/mv-demo.c (on_button_press): * demo/widgets-demo.c (remove_widget_clicked): use new remove() functions to test them. * docs/goocanvas-sections.txt: rearranged GooCanvasItem/Model to put commonly-used functions first, and added remove() functions. 2007-03-08 Damon Chaplin * src/goocanvastext.[hc]: added ellipsize property, and used bit flags to cut down on memory use a bit. * demo/demo.c (setup_texts): added test for ellipsized text. * demo/mv-demo.c: * demo/mv-demo-table.c: * demo/mv-demo-clipping.c: updated model-view demos, adding new stuff from simple demo. 2007-03-07 Damon Chaplin * src/*.c: added notes to all functions that are only meant to be used when implementing new canvas items. * docs/goocanvas-sections.txt: placed all the functions only used when implementing new canvas items together at the bottom. 2007-03-06 Damon Chaplin * src/goocanvasitem.c (goo_canvas_item_get_items_at): if the item doesn't support this method just return found_items. * src/goocanvas.c (goo_canvas_create_cairo_context): made this public. 2007-03-06 Damon Chaplin * */*: added 'const' to a number of arguments taking a cairo_matrix_t* or a GooCanvasBounds*. 2007-03-06 Damon Chaplin * src/goocanvasitem.[hc]: added get_requested_height() method. * src/goocanvastable.c: Reworked a lot of code to support width-for-height layout. This gets the requested area of all children, calculates the column widths, then checks if any children want to change their requested height given their allocated width. Text items change their requested height based on their width, so this results in a better layout. * src/goocanvastext.h (struct _GooCanvasText): added layout_width to store the width used for the PangoLayout. This initially comes from the text's width property, but can be modified when the text item is layed out in a container like GooCanvasTable. * src/goocanvastext.c (goo_canvas_text_get_requested_height): calculates the requested height for the given width, or just returns -1 if the text item is rotated or has a clip path, in which case the original height is used. (goo_canvas_text_init, goo_canvas_text_create_layout) (goo_canvas_text_update): use layout_width. * demo/demo-table.c (create_width_for_height_table): added tests for width-for-height layout. * demo/demo-clipping.c (setup_canvas): added text item to check clipping works OK with them. 2007-02-27 Damon Chaplin * Released GooCanvas 0.7 2007-02-27 Damon Chaplin * src/goocanvas.c (goo_canvas_get_items_in_area): new function to get items inside or outside a given area. * demo/demo.c: added little test for goo_canvas_get_items_at() and goo_canvas_get_items_in_area(). 2007-02-27 Damon Chaplin * src/goocanvasitemmodel.[hc]: * src/goocanvasitem.[hc]: used name "transform" for all arguments to get/set_transform functions. 2007-02-27 Damon Chaplin * src/goocanvasitemmodel.[hc]: * src/goocanvasitem.[hc]: changed get_transform() method to take a cairo_matrix_t* to fill in, and return a boolean if a transform is set. This is better for bindings. * src/goocanvasitemsimple.c: updated get_transform() methods. 2007-02-27 Damon Chaplin * src/goocanvasitem.[hc]: changed get_item_at method to get_items_at which returns a list of found items rather than a single found item. * src/goocanvasitemsimple.[hc]: changed get_item_at() method to is_item_at() which just returns a boolean, and updated to new API. * src/goocanvas.c (goo_canvas_get_item_at): updated to use new API. (goo_canvas_get_items_at): new function to return list of found items. * src/goocanvastable.c (goo_canvas_table_get_items_at): * src/goocanvasgroup.c (goo_canvas_group_get_items_at): * src/goocanvasimage.c (goo_canvas_image_is_item_at): * src/goocanvaspolyline.c (goo_canvas_polyline_is_item_at): * src/goocanvastext.c (goo_canvas_text_is_item_at): * src/goocanvaswidget.c (goo_canvas_widget_is_item_at): * docs/creating-items.xml: * demo/demo-item.c (goo_demo_item_is_item_at): updated for new API. 2007-02-25 Damon Chaplin * src/goocanvasitemsimple.c: added "hint-metrics" property so people can use hinted metrics for prettier text if they aren't scaling the canvas at all. * src/goocanvasstyle.c: added goo_canvas_style_hint_metrics_id quark. * src/goocanvasutils.c (goo_cairo_hint_metrics_get_type): added enum stuff for cairo_hint_metrics_t. * src/goocanvastext.c (goo_canvas_text_create_layout): use hint metrics property. 2007-02-25 Damon Chaplin * src/goocanvas.c (goo_canvas_create_cairo): use CAIRO_ANTIALIAS_GRAY as the default antialiasing mode, as that is what is recommended when using unhinted text. (subpixel antialiasing looks really bad.) 2007-02-25 Damon Chaplin * src/*.c: checked over all finalize methods and moved code to dispose methods where appropriate. (Dispose methods should be used to unref any other objects.) This was done to help the Ruby bindings. It was a bit fiddly so it might cause a few bugs. * src/goocanvasutils.c (goo_cairo_matrix_copy) (goo_cairo_matrix_free): allocate and free with g_slice_new/free() as that is what was being used in GooCanvasItemSimple. * demo/scalability-demo.c: added a test for a very wide canvas, almost up to the 31-bit GDK window size limit. (It is slow to start though.) 2007-02-24 Damon Chaplin * demo/widgets-demo.c (on_delete_event): * demo/units-demo.c (on_delete_event): * demo/mv-scalability-demo.c (on_delete_event): * demo/scalability-demo.c (on_delete_event): * demo/mv-demo.c (on_delete_event): * demo/demo.c (on_delete_event): use gtk_main_quit() rather than exit() here, so GTK+ destroys the window and the finalization code gets tested. * src/goocanvas.c (goo_canvas_remove): implement this so embedded widgets are removed properly. 2007-02-20 Damon Chaplin * demo/demo-table.c: * demo/mv-demo-table.c: moved table-demo.c into main demo app, and made a model-view version. 2007-02-20 Damon Chaplin * src/goocanvastable.c (goo_canvas_table_get_item_at) (goo_canvas_table_paint): if the table was shrunk below its requested size, clip the children if appropriate. * src/goocanvastable.c (goo_canvas_table_get_item_at) (goo_canvas_table_paint): * src/goocanvasgroup.c (goo_canvas_group_get_item_at) (goo_canvas_group_paint): check the bounds and handle the clip path. * demo/table-demo.c (create_demo_table): added parameters and created a second table of shapes, this time with the items shrunk and clipped. 2007-02-20 Damon Chaplin * src/goocanvastext.c (goo_canvas_text_create_layout): (goo_canvas_text_get_item_at): use the ink rect as well as the logical rect when calculating the bounds or doing hit-testing. * src/goocanvastable.c (goo_canvas_table_size_allocate_pass1): shrink homogeneous tables if appropriate. * src/goocanvaswidget.c (goo_canvas_widget_get_item_at): return the widget item if the point is within its bounds. * src/goocanvas.c (goo_canvas_render): if bounds are passed in set the clip path to the bounds. * demo/demo.c (write_pdf_clicked): added code to test clipped painting. 2007-02-19 Damon Chaplin * demo/scalability-demo.c (setup_canvas): set the font on the root group so we don't need to set it on all the text items. Also output the time to the first expose. * demo/mv-scalability-demo.c: new demo based on scalability-demo.c. 2007-02-19 Damon Chaplin * demo/demo.c: * demo/mv-demo.c: * demo/demo-animation.c: * demo/mv-demo-animation.c: made the file-global variables static so they don't clash, and updated the demos a bit. 2007-02-19 Damon Chaplin * configure.in: * src/Makefile.am: rewrote the stuff that handles the autogeneration of goocanvasmarshal.[hc] and goocanvasenumtypes.[hc], copying what GTK+ does. It now has a --disable-rebuilds option to disable the autogeneration and it doesn't try autogeneration if Perl isn't available. 2007-02-17 Damon Chaplin * Released GooCanvas 0.6 2007-02-17 Damon Chaplin * src/goocanvasitemsimple.h (struct _GooCanvasItemSimpleClass): renamed create_path, update, paint and get_item_at class methods to simple_create_path, simple_update, simple_paint and simple_get_item_at. This avoids confusion with the GooCanvasItem interface methods with the same name (and may avoid problems with language bindings etc.) * src/goocanvasellipse.c (goo_canvas_ellipse_class_init): * src/goocanvasimage.c (goo_canvas_image_class_init): * src/goocanvaspath.c (goo_canvas_path_class_init): * src/goocanvaspolyline.c (goo_canvas_polyline_class_init): * src/goocanvasrect.c (goo_canvas_rect_class_init): * src/goocanvastext.c (goo_canvas_text_class_init): * src/goocanvaswidget.c (goo_canvas_widget_class_init): * demo/demo-item.c (goo_demo_item_class_init): * src/goocanvasitemsimple.c: updated use of above class methods. * src/goocanvasgroup.c (goo_canvas_group_update): handle children with empty bounds (i.e. ignore their bounds when computing the group's bounds). * src/goocanvastable.c (goo_canvas_table_paint) (goo_canvas_table_get_item_at): * src/goocanvasgroup.c (goo_canvas_group_get_item_at) (goo_canvas_group_paint): don't check the child bounds here. Leave it up to the children to do that. * src/goocanvasitemsimple.c (goo_canvas_item_simple_get_item_at) (goo_canvas_item_simple_paint): check the item's bounds here. 2007-02-15 Damon Chaplin * src/goocanvasutils.c: * src/goocanvaspath.c: moved data structures and code for parsing and creating SVG paths from goocanvaspath.[hc] to goocanvasutils.[hc]. Added goo_canvas_parse_path_data() and goo_canvas_create_path() public functions. * src/goocanvasitemsimple.c: added "clip-path" and "clip-fill-rule" properties to specify the clip path and fill rule, and used these to calculate bounds, paint, and do hit testing. * src/goocanvasitemsimple.h (struct _GooCanvasItemSimpleData): added clip_path_commands and clip_fill_rule. * src/goocanvastext.c (goo_canvas_text_set_model): * src/goocanvasrect.c (goo_canvas_rect_set_model): * src/goocanvaspolyline.c (goo_canvas_polyline_set_model): * src/goocanvaspath.c (goo_canvas_path_set_model): * src/goocanvasimage.c (goo_canvas_image_set_model): * src/goocanvasgroup.c (goo_canvas_group_set_model): * src/goocanvasellipse.c (goo_canvas_ellipse_set_model): use goo_canvas_item_simple_set_model() rather than getting parent iface. (For GooCanvasTable this actually caused a crash as when it called the GooCanvasGroup function that got the parent iface which pointed to itself so it got into an infinite loop.) * demo/mv-demo-clipping.c: * demo/demo-clipping.c: new files for clipping demo pages. * demo/Makefile.am: * demo/mv-demo.c: * demo/demo.c: added clipping pages. 2007-02-13 Damon Chaplin * src/goocanvas.c (goo_canvas_size_allocate): only allocate the child widgets if we are realized, otherwise it crashes. 2007-02-13 Damon Chaplin * src/goocanvasitemmodel.c (goo_canvas_item_model_animate): * src/goocanvasitem.c (goo_canvas_item_animate): added "absolute" parameter, and rewrote the animation code, using the same code for GooCanvasItem and GooCanvasItemModel. * demo/demo-animation.c: * demo/mv-demo-animation.c: new files for animation demo pages. * demo/mv-demo.c: * demo/demo.c: added new animation pages and updated animation calls. 2007-02-12 Damon Chaplin * src/goocanvasitemmodel.c (goo_canvas_item_model_set_simple_transform): * src/goocanvasitem.c (goo_canvas_item_set_simple_transform): convert rotation to radians. 2007-02-09 Damon Chaplin * demo/demo-item.c (goo_demo_item_update): don't convert bounds to device space. * src/*.h: added padding to all *Class structs, to allow a bit of expansion without breaking backwards compatibility. * docs/*.xml: added example code to the introductory sections. Needs more explanation at some point. * configure.in: * src/Makefile.am: added libtool version numbers. 2007-02-08 Damon Chaplin * src/goocanvasitemmodel.c (goo_canvas_item_model_set_simple_transform): * src/goocanvasitem.c (goo_canvas_item_set_simple_transform): new convenience functions to set the position, scale and rotation easily. * demo/demo.c (move_ellipse_clicked): added tests for goo_canvas_item_set_simple_transform(). * */*: more documentation updates. I've started adding a few introductory sections, tidied up a few bits, and tried to update all the docs that referred to the old model/view terminology. 2007-02-08 Damon Chaplin * */*: more documentation updates. It is 100% complete now, though it still needs docs on the optional model/view split and creating new items. 2007-02-07 Damon Chaplin * src/goocanvasutils.c (goo_canvas_query_child_properties): check if type is classed before calling g_type_interface_peek(). 2007-02-06 Damon Chaplin * src/goocanvas.[hc]: updated docs. 2007-02-04 Damon Chaplin * src/goocanvasstyle.[hc]: extern the GQuarks in the header and define them in the .c file. 2007-02-04 Damon Chaplin * src/goocanvasitemmodel.c (goo_canvas_item_model_base_init): fix type of "parent" property, from Gian Mario Tagliaretti. 2007-02-04 Damon Chaplin * src/goocanvasitemsimple.c (goo_canvas_item_simple_check_style): fixed bug where if item was using its parent's style it wouldn't get updated. * */*: documented most of the other symbols. I just need to document the 2 main interfaces - GooCanvasItemIface and GooCanvasItemModelIface, check it all over for out-of-date docs, and document the optional model/view split a bit more. (And maybe a section on writing new items) 2007-02-02 Damon Chaplin * */*: updated docs for all canvas items & models. 2007-02-01 Damon Chaplin * src/goocanvastable.c: finished table item. I think the only API breakage this introduces is that GooCanvasItemSimple subclasses that override the update() class method must now return the bounds in user space rather than device space. (This is needed to do the table layout.) * demo/table-demo.c: added more test tables with various transforms and settings. * src/goocanvasitem.c (goo_canvas_item_get_requested_area) (goo_canvas_item_allocate_area) (goo_canvas_item_get_transform_for_child) : new functions and interface methods to support GooCanvasTable and other layout containers. * src/goocanvasitemsimple.c: added support for GOO_CANVAS_ITEM_HIDDEN, initialized the model's visibility setting to GOO_CANVAS_ITEM_VISIBLE. (goo_canvas_item_simple_update): split part of it out into goo_canvas_item_simple_update_internal and updated slightly. (goo_canvas_item_simple_get_requested_area) (goo_canvas_item_simple_allocate_area): new functions to support GooCanvasTable and other layout containers. (goo_canvas_item_simple_get_path_bounds): don't convert to device space as some code needs the bounds in user space. * src/goocanvas.c (goo_canvas_convert_to_item_space) (goo_canvas_convert_from_item_space): used the new goo_canvas_item_get_transform_for_child() function to get the transform for each item. * src/goocanvasutils.h: added GOO_CANVAS_ITEM_HIDDEN visibility setting which is used for items which are invisible and not allocated any space in containter items like GooCanvasTable. * src/goocanvasgroup.c (goo_canvas_group_get_item_at) (goo_canvas_group_paint): support GOO_CANVAS_ITEM_HIDDEN. * src/goocanvaspolyline.c (goo_canvas_polyline_compute_bounds): * src/goocanvasimage.c (goo_canvas_image_update): leave bounds in user space. * src/goocanvaswidget.c: updated to override the GooCanvasItemSimple update, paint & get_item_at methods instead of the interface methods, added support for GOO_CANVAS_ITEM_HIDDEN, and added goo_canvas_widget_allocate_area() implementation. * src/goocanvastext.c (goo_canvas_text_get_item_at): fixed bug that meant it didn't work for text items with no fill color/pattern set. 2006-12-09 Damon Chaplin * docs/goocanvas-sections.txt: * docs/goocanvas-docs.sgml: use separate sections for model objects, as gtk-doc doesn't support multiple objects per section. * docs/Makefile.am (SCANGOBJ_OPTIONS): added --query-child-properties argument to document child properties (needs cvs gtk-doc). * src/goocanvasutils.c (goo_canvas_query_child_properties): new function to allow documentation of child properties with gtk-doc. * src/goocanvasitemmodel.c: * src/goocanvasitem.c: added support for child properties of item models. * src/goocanvastable.c: beginnings of a new table item to layout child items. Doesn't do much yet. * demo/table-demo.c: beginnings of demo for GooCanvasTable. * src/goocanvasitem.c (goo_canvas_item_animate): clarified docs. * src/goocanvasgroup.c: use goo_canvas_item_add/move/remove_child() rather than goo_canvas_group_add/move_remove_child() so subclasses can reuse group's code. Also fix some docs & variable names. 2006-11-30 Damon Chaplin * src/goocanvasitemsimple.h (struct _GooCanvasItemSimpleClass): added new update/paint/get_item_at methods that subclasses can override. If items use these methods GooCanvasItemSimple will perform all the standard stuff before passing control to them. This makes it much easier to create simple canvas items. * demo/demo-item.c: * src/goocanvaspolyline.c: * src/goocanvastext.c: * src/goocanvasimage.c: use the above methods, so we can get rid of all the boilerplate code. 2006-11-29 Damon Chaplin * demo/demo-item.[hc]: new demo item to show how to create new items. There's more boilerplate code than I'd like, but I don't know the best way to deal with it. 2006-11-29 Damon Chaplin * */*: major rewrite to make the model optional, so people can choose to have either a simple canvas or a model/view canvas. (Many people found the model/view split awkward.) The standard items can be used in either scenario. Also added support for cascading styles, with arbitrary properties, and embedded widget items. I'm in the middle of adding support for layout items as well (e.g. something like a GtkTable for items). 2006-10-12 Damon Chaplin * src/goocanvastextview.c (goo_canvas_text_view_create_layout) (goo_canvas_text_view_get_item_view_at) (goo_canvas_text_view_paint): patch from Martin Soto to fix a text positioning bug. The position was wrong when the text width was set and the alignment wasn't PANGO_ALIGN_LEFT. (Pango uses the set width to calculate the text origin, but we were using the logical width.) 2006-10-12 Damon Chaplin * src/goocanvasutils.h: * src/goocanvasprivate.h: make get_type() declarations public as they are useful for bindings. 2006-10-12 Damon Chaplin Applied patch from Paul Davis to use glib_mkenums, slightly modified: * configure.in: use pkg-config to get the glib_genmarshal and glib_mkenums binaries. * src/Makefile.am: use glib_mkenums to generate goocanvasenums.[hc]. * src/goocanvasutils.c: removed goo_canvas_pointer_events_get_type() and goo_canvas_item_visibility_get_type() as they're generated now. * src/goocanvasutils.h: removed get_type() declarations that are now in goocanvasenums.h, and modifed GooCanvasPointerEvents so glib_mkenums could parse it. * src/goocanvas.h: * src/goocanvasitem.c: include goocanvasenums.h. 2006-10-12 Damon Chaplin * src/goocanvaspolyline.h (struct _GooCanvasPoints): use a separate typedef declaration for the struct, to help C++ bindings. From Paul Davis. * src/goocanvaspath.c (goo_canvas_path_new): use 'const' for the path_data argument. From Paul Davis. * src/goocanvaspathview.c (goo_canvas_path_view_create_path): init last_control_point_x/y to avoid compiler warning. 2006-09-11 Damon Chaplin * src/goocanvaspolylineview.c: be more careful about using points and arrow data. * demo/demo.c (setup_lines): add checks for polylines with 0 and 1 points. * configure.in: require GTK+ 2.10.0, for GtkUnit (Gian Mario Tagliaretti). 2006-08-31 Damon Chaplin * src/goocanvasview.c: added "units", "resolution-x" & "resolution-y" properties so we can support points, inches and millimeters being used for item units as well as just pixels. Thus you can create a complete WYSIWYG printable document. But note that you must use absolute units for font sizes, i.e. use "px" after the size in any font description strings, e.g. "Sans 10px". That stops us scaling fonts twice. (goo_canvas_view_set_default_line_width): set a reasonable default line width according to the current units. * demo/units-demo.c: new demo showing different units in use. 2006-08-30 Damon Chaplin * src/goocanvasitemviewsimple.c (goo_canvas_item_view_simple_update) * src/goocanvaspolylineview.c (goo_canvas_polyline_view_update): added a workaround for cairo limits. Cairo uses fixed point integer maths and is currently limited to 16-bits for the integer component. So we remove any current translation before calculating the bounds of the item, then add it back to the results. This means the 16-bit limit only applies to items' user space rather than the entire canvas. * src/goocanvasitemviewsimple.c (goo_canvas_item_view_simple_get_item_view_at): * src/goocanvaspolylineview.c (goo_canvas_polyline_view_get_item_view_at): as above, remove any current translation before checking if the point is in the item. * demo/scalability-demo.c: updated to create ~100,000 items, either rectangles or images. For images it now reuses a single cairo pattern rather than passing the pixbuf to the GooCanvasImage (which created a new pattern for each one and ran out of memory). It takes about 10 seconds to setup the canvas which is slower than I'd like, but once created it seems to work fast enough. 2006-08-27 Damon Chaplin * src/goocanvasview.c (goo_canvas_view_class_init): * src/goocanvasitemviewsimple.c (goo_canvas_item_view_simple_class_init) * src/goocanvasgroupview.c (goo_canvas_group_view_class_init): only register the accessible factories if accessibility is enabled (i.e. GtkWidget has registered a factory). * src/goocanvasitemviewsimple.c (goo_canvas_item_view_simple_setup_accessibility): * src/goocanvasgroupview.c (goo_canvas_group_view_set_group): only set the accessible title & description and connect the signal handlers if accessibility is enabled. (It would be better to not call atk_gobject_accessible_for_object() at all, as it isn't useful.) * demo/scalability-demo.c: start of new demo/test for scalability. We are currently hitting the cairo 16-bit limit (transformed coords can't be larger than 16-bit ints). A workaround would be nice. I also want to profile it and see if there are any major bottlenecks. (Creating canvases with thousands of items is very slow, though scrolling etc. is OK as long as the canvas is split into groups.) 2006-08-24 Damon Chaplin * Released GooCanvas 0.4 2006-08-24 Damon Chaplin * src/*.c: updated docs to point to goo_canvas_view_get_item_view() as a simple alternative for setting up signal handlers. * src/goocanvasview.c (goo_canvas_view_pointer_ungrab): only call gdk_display_pointer_ungrab() if we have an active pointer grab. So maybe we can now use goo_canvas_view_pointer_ungrab() to ungrab passive grabs on canvas item views (need to test this though). 2006-08-23 Damon Chaplin * src/goocanvasview.c: keep an item_to_view hash table so apps can get the view for particular items (e.g. as an easy alternative for setting up signal handlers). (goo_canvas_view_get_item_view): new function to get the item view for a given item. (goo_canvas_view_unregister_item_view): new function that implementors of GooCanvasItemView should call in their finalize method to unregister the view (so the GooCanvasView removes it from the hash table.) (goo_canvas_view_create_item_view): add the new item view to the item_to_view hash table. * src/goocanvasitemviewsimple.c (goo_canvas_item_view_simple_finalize): * src/goocanvasgroupview.c (goo_canvas_group_view_finalize): unregister the item view. (goo_canvas_group_view_set_parent_view): don't change the canvas view here any more, since we don't support that. * demo/simple-demo.c: updated to use simple signal handler setup. 2006-08-22 Damon Chaplin * src/goocanvasview.c (goo_canvas_view_class_init): 2 minor fixes for the docs (from Gian Mario Tagliaretti). 2006-08-15 Damon Chaplin * src/goocanvasutils.h: moved GOO_TYPE_CAIRO_PATTERN stuff here, so bindings can use it. Also renamed goo_cairo_line_dash stuff to goo_canvas_line_dash for consistency. * src/goocanvasutils.c (goo_canvas_line_dash_newv): new non-varargs variant of function of goo_canvas_line_dash_new() for bindings. (from Gustavo J. A. M. Carneiro.) 2006-08-14 Damon Chaplin * Makefile.am: require automake 1.7, since it is needed for glib-genmarshal (from Gian Mario Tagliaretti). 2006-08-08 Damon Chaplin * src/goocanvastextview.c (goo_canvas_text_view_update): * src/goocanvaspolylineview.c (goo_canvas_polyline_view_update): * src/goocanvasitemviewsimple.c (goo_canvas_item_view_simple_update): * src/goocanvasimageview.c (goo_canvas_image_view_update): * src/goocanvasgroupview.c (goo_canvas_group_view_update): rewrote the update methods to make sure the bounds is always set and returned correctly. 2006-07-26 Damon Chaplin * src/goocanvasgroup.[hc]: added goo_canvas_group_set_model() function, to set the model of the root group. * src/goocanvasmodelsimple.c (goo_canvas_model_simple_init): use the above function. * src/goocanvas*view.c: support an optional transformation matrix for each view, which is combined with the underlying item's transform. (I'm not sure if this will overcomplicate things.) * src/goocanvasgroupview.c: support generic GooCanvasItems as the underlying group rather than just GooCanvasGroups. This allows us to use subclasses of GooCanvasGroupView easily. (goo_canvas_group_view_set_group): new function to set the underlying group item, creating child views and setting up signal handlers etc. 2006-07-21 Damon Chaplin * src/goocanvas*view.c: renamed get_item_at() methods to get_item_view_at(). * src/goocanvasview.c (goo_canvas_view_get_root_view): new function to return the root view. (goo_canvas_view_get_item_view_at): new function to return the item view at a given point. 2006-07-19 Damon Chaplin * src/goocanvasatk.c: * src/goocanvasgroupview.c: * src/goocanvasimageview.c: * src/goocanvasitemview.c: * src/goocanvasitemview.h: * src/goocanvasitemviewsimple.c: * src/goocanvaspolylineview.c: * src/goocanvastextview.c: * src/goocanvasview.c: changed item view update() and get_bounds() methods to take a GooCanvasBounds* to fill in, rather than returning a pointer to a static GooCanvasBounds. This makes it easier for language bindings. 2006-07-19 Damon Chaplin * src/goocanvasview.c (goo_canvas_view_scroll): handle scroll events ourselves, in case we aren't placed directly in a scrolled window. * src/goocanvasitem.c (goo_canvas_item_get_transform): if the item doesn't support this method just return NULL. * demo/demo-fifteen.c: use generic goo_canvas_item_view_get_item() method to get the item rather than private struct members. * configure.in: depend on glib 2.10.0 (from Gian Mario Tagliaretti). * src/goocanvasutils.c (goo_canvas_pointer_events_get_type): use a flags type rather than an enum type (from Gustavo J. A. M. Carneiro). * src/goocanvasitem.c (goo_canvas_item_base_init): * src/goocanvasitemsimple.c: * src/goocanvasgroup.c: updated to use the flags type for "pointer-events" instead of enum. * src/goocanvasprivate.h: * src/goocanvasutils.h: The type GOO_TYPE_CAIRO_MATRIX is used in a public interface (a property in the GooCanvasItem interface), therefore it has to be public (from Gustavo J. A. M. Carneiro). 2006-06-08 Damon Chaplin * src/goocanvasitemsimple.c (goo_canvas_item_simple_set_property): only create the item's style when needed. (goo_canvas_style_get_type): register boxed type (from Gustavo J. A. M. Carneiro). 2006-06-01 Damon Chaplin * demo/demo.c: only add the "Output PDF" option if cairo has PDF support compiled in. 2006-05-27 Damon Chaplin * src/*.c: removed ';' after all G_DEFINE_TYPE* macros. 2006-05-27 Damon Chaplin * autogen.sh: check for AC_CONFIG_HEADER as well as old AM_*. 2006-05-16 Damon Chaplin * goocanvas.pc.in: * Makefile.am: * configure.in: added .pc file (patch from Gian Mario Tagliaretti). 2006-05-12 Damon Chaplin * src/goocanvastextview.c (goo_canvas_text_view_create_layout): if there is no text return an empty layout rather than NULL. (goo_canvas_text_view_get_item_at): check if there is no text first. * src/goocanvasitemsimple.[hc]: rename operator to op since operator is a C++ keyword (reported by Yevgen Muntyan). 2006-04-24 Damon Chaplin * Released GooCanvas 0.3 2006-04-24 Damon Chaplin * src/goocanvasview.c: added "model", "scale", "anchor", "x1", "y1", "x2", "y2" properties, and goo_canvas_view_get_bounds() and goo_canvas_view_get_scale() accessors. Removed goo_canvas_view_set_anchor() as the property should be enough. (I think we should only have accessor functions for major properties.) * src/goocanvasitemview.c (goo_canvas_item_view_is_visible) (goo_canvas_item_view_get_item_at): removed scale argument. We get it from the canvas view now, to make the API a little simpler. * src/goocanvasitemviewsimple.h (struct _GooCanvasItemViewSimple): added pointer to the canvas view. * src/*view.[hc]: added canvas view argument to all view creation functions. 2006-04-23 Damon Chaplin * src/goocanvasview.c (goo_canvas_view_focus): scroll to show the new focused item if necessary. (goo_canvas_view_set_model): set need_update to TRUE. (goo_canvas_view_focus_check_is_best): try to avoid wild jumps when moving around with the cursor keys. 2006-04-22 Damon Chaplin * src/goocanvasview.c: added support for keyboard focus navigation. (I still need to make it scroll to show the focused item if needed.) * demo/demo-focus.c: new demo page to test keyboard focus navigation. * src/goocanvasitemview.c: added "focus-in-event" & "focus-out-event" signals. * src/goocanvasitemsimple.c (goo_canvas_item_simple_get_path_bounds): make sure we do min/max over all points of bounds. * src/goocanvasview.c (goo_canvas_view_focus_out): emit "focus_out_event", not "focus_in_event". 2006-04-19 Damon Chaplin * src/goocanvasitem.c (goo_canvas_item_base_init): added "title" and "description" properties for accessibility. Note that we only support per-item settings for the standard canvas items, though more complex items may want to support per-view settings. * src/goocanvasitemsimple.c: * src/goocanvasgroup.c: implemented "title" and "description" properties. * src/goocanvas*view.c: set the accessible name & description based on the item's settings, and update them if changed. * src/goocanvasatk.c (goo_canvas_item_view_accessible_ref_child): return the accessible rather than the item view. 2006-04-18 Damon Chaplin * src/goocanvasview.c (goo_canvas_view_get_model): new function. (goo_canvas_view_adjustment_value_changed): emit "visible_data_changed" on accessible object. (goo_canvas_view_init): initialize default bounds, and create default adjustments. * src/goocanvasitemview.[hc]: added new is_visible() method, and "can-focus" property, and convenience find_child() function. * src/goocanvasitemviewsimple.c: implemented "can-focus" property and "is_visible" method. * src/goocanvasgroupview.c: implemented "can-focus" property and "is_visible" method, and used same flags field as GooCanvasItemViewSimple. * src/goocanvasatk.[c]: new files to support accessibility. Most of the code has been copied from foocanvas & libgnomecanvas, with slight changes to handle our model/view split. * src/goocanvasitemviewsimple.c (goo_canvas_item_view_simple_finalize): chain up to parent's finalize method. 2006-04-16 Damon Chaplin * src/goocanvasview.c (propagate_event, emit_pointer_event): ref views and check they are still valid. * src/*view.[hc]: made views hold reference on items, to ensure we never use invalid pointers. 2006-04-16 Damon Chaplin * demo/simple-demo.c: new very simple demo, also used in docs. * src/goocanvasitemviewsimple.[hc]: new base class for item views, so we can share a lot of the common code. * src/*view.[hc]: updated item views to be a subclass of above. * src/*.c: removed lots of unused debugging code. * src/goocanvasitem.c: * src/goocanvasitemsimple.c: * src/goocanvasgroup.c: moved "pointer-events" and "transform" properties, and the "changed" signal to the GooCanvasItem interface. * src/*.[hc]: updated use of above. 2006-04-14 Damon Chaplin * src/goocanvasview.c: documented GooCanvasView, though it needs an overview and demo code. * src/*.[hc]: documented most of the core objects. * src/goocanvasutils.h: renamed goo_cairo_dash* to goo_canvas_dash* for consistency. * src/goocanvasprivate.h: new header to contain private declarations that we don't install. * src/*.[hc]: documented enums & structs on the types page. 2006-04-13 Damon Chaplin * src/*.[hc]: documented views for standard items. * src/*.[hc]: documented standard items. 2006-04-12 Damon Chaplin * configure.in: updated to use newer forms of macros. * COPYING: added LGPL license. * src/Makefile.am (libgoocanvasincludedir): install headers into $(includedir)/goocanvas-1.0 rather than $(includedir)/libgoocanvas-1.0. * demo/*: moved all the demo code here. * src/goocanvas.h: new main header to include all the public headers. * autogen.sh: * configure.in: * Makefile.am: setup to use gtk-doc. * src/Makefile.am: build libgoocanvas as a library now, so we can document it with gtk-doc. The demo will be moved to a separate directory. * src/goocanvastext.h: * src/goocanvasitem.h: rename a few parameters to match the sources, since gtk-doc complains if they are different. 2006-04-11 Damon Chaplin * src/demo-paths.c (create_paths): added more arc tests. * src/goocanvaspathview.c: finished the elliptical arc and split up the create_path() function a bit. 2006-04-10 Damon Chaplin * src/goocanvaspathview.[hc]: * src/goocanvaspath.[hc]: new path item and view, that uses the same path spec strings as SVG. I think everything works, except the elliptical arc, which I haven't finished yet. * src/demo-paths.c: new demo page to test paths. 2006-04-08 Damon Chaplin * src/goocanvasitemsimple.[hc]: * src/goocanvasgroup.[hc]: added "pointer-events" property, like SVG. * src/goocanvasitemsimple.c (goo_canvas_item_simple_get_path_bounds): changed to include both the stroke and fill extents, even if they will not be painted. This is needed to handle the "pointer-events" property. * src/goocanvasitemsimple.c (goo_canvas_item_simple_check_in_path): added "pointer_events" argument, to specify which parts of the path to check. * src/goocanvasitemview.[hc]: change get_item_at() to take "is_pointer_event", "parent_visible", and "scale" properties, so we can handle the "pointer-events" property. * src/goocanvasgroupview.c (goo_canvas_group_view_get_item_at): * src/goocanvasellipseview.c (goo_canvas_ellipse_view_get_item_at): * src/goocanvasimageview.c (goo_canvas_image_view_get_item_at): * src/goocanvaspolylineview.c (goo_canvas_polyline_view_get_item_at): * src/goocanvasrectview.c (goo_canvas_rect_view_get_item_at): * src/goocanvastextview.c (goo_canvas_text_view_get_item_at): updated to support "pointer-events". * src/goocanvasutils.[hc]: added GooCanvasPointerEvents enum, and goo_cairo_line_dash_new(). * src/demo-events.c: new demo page to test "pointer-events" property. * src/goocanvastextview.c (goo_canvas_text_view_paint): if the fill pattern has been explicitly set to NULL, don't paint the text. 2006-04-03 Damon Chaplin * src/goocanvasview.c (goo_canvas_view_style_set) (goo_canvas_view_realize): use the base color for the background. * src/demo.c (create_canvas_primitives): use gtk_widget_modify_base() to test setting the background color. 2006-03-24 Damon Chaplin * src/goocanvasitemview.c (goo_canvas_item_view_ensure_updated): new convenience function to do an immediate update. * src/goocanvasview.c (goo_canvas_view_update): turned this into a public function for use by the above. * src/goocanvastextview.c (goo_canvas_text_view_get_bounds) (goo_canvas_text_view_get_item_at): * src/goocanvasrectview.c (goo_canvas_rect_view_get_bounds) (goo_canvas_rect_view_get_item_at): * src/goocanvaspolylineview.c (goo_canvas_polyline_view_get_bounds) (goo_canvas_polyline_view_get_item_at): * src/goocanvasgroupview.c (goo_canvas_group_view_get_bounds) (goo_canvas_group_view_get_item_at): * src/goocanvasimageview.c (goo_canvas_image_view_get_bounds) (goo_canvas_image_view_get_item_at): * src/goocanvasellipseview.c (goo_canvas_ellipse_view_get_bounds) (goo_canvas_ellipse_view_get_item_at): make sure the canvas is updated first, if needed. 2006-03-24 Damon Chaplin * src/goocanvasview.c (goo_canvas_view_render): new function to render all or part of the canvas to a given cairo context. * src/demo.c: added "Write PDF" test, that creates a pdf file containing the main canvas. * src/goocanvasview.[hc]: used a GooCanvasBounds rather than left, right, top, bottom for the bounds. Also renamed "pixels_per_unit" to "scale". * src/goocanvasitemview.[hc]: * src/goocanvastextview.c (goo_canvas_text_view_paint): * src/goocanvasgroupview.c (goo_canvas_group_view_paint): * src/goocanvasellipseview.c (goo_canvas_ellipse_view_paint): * src/goocanvasimageview.c (goo_canvas_image_view_paint): * src/goocanvaspolylineview.c (goo_canvas_polyline_view_paint): we now just pass the effective scale to the paint function rather than the GooCanvasView*, since when rendering to an arbitrary cairo_t we may not want to use a different effective scale (to determine which items are shown). (Also fixed some of the visibility checks.) 2006-03-23 Damon Chaplin * src/goocanvasitem.c: added new "visibility" and "visibility-threshold" properties to specify when an item should be visible (always, never, or above a certain scale threshold). * src/goocanvasutils.[hc]: added GooCanvasItemVisibility enum stuff. * src/goocanvasitemsimple.[hc]: * src/goocanvasgroup.[hc]: implemented new properties. * src/goocanvasgroupview.c (goo_canvas_group_view_paint): * src/goocanvastextview.c (goo_canvas_text_view_paint): * src/goocanvasrectview.c (goo_canvas_rect_view_paint): * src/goocanvasimageview.c (goo_canvas_image_view_paint): * src/goocanvasellipseview.c (goo_canvas_ellipse_view_paint): check the visibility settings to see if the items should be painted. * src/demo.c (setup_invisible_texts): added test for visibility settings. * src/goocanvasitem.[hc] (goo_canvas_item_create_view): removed this as it is mainly an internal function and the interface can be used directly instead where needed. 2006-03-23 Damon Chaplin * src/goocanvasview.c (goo_canvas_view_scroll_to): freeze the canvas while setting the adjustments so we don't redraw twice. 2006-03-22 Damon Chaplin * src/goocanvasview.[hc]: convert to a subclass of GtkContainer rather than GtkLayout, since the layout code didn't help much and just added to the confusion. (Getting scrolling/zooming to work smoothly is pretty difficult.) Added a goo_canvas_view_scroll_to() function to scroll to a desired position. Added an anchor setting to specify where to place the contents of the canvas if it is smaller than the allocated widget area. (Like the "center_scroll_region" setting in GnomeCanvas but a bit more general.) Mapped a temporary window above the canvas when zooming in/out to stop X from scrolling the canvas contents before it is redrawn. (Idea pinched from FooCanvas.) Though this could possibly cause problems with keyboard input in future, in which case I think we should drop the fancy window scrolling stuff and just scroll ourselves. Added an internal freeze_count like GtkLayout used to have. This is used while reconfiguring the scrollbars etc. so we don't scroll more than once (e.g. horizontally then vertically). Added coordinate conversion functions to convert between device units and canvas item units or pixels. * src/goocanvastextview.[hc]: create a cairo_font_options_t object in the class init function and use it for all created PangoLayouts. This ensures that text is layed out the same at any scale, which also avoids the problems with items not being redrawn properly (since the bounds were slightly wrong). Note that I was using cairo_set_font_options(cr) before, but that isn't picked up by Pango so didn't work. (Font options seem to be associated with surfaces and also with the graphics state which is confusing.)