From 5206d4b3a6014336c1e89632100fce6b300fd694 Mon Sep 17 00:00:00 2001 From: billh Date: Tue, 12 Feb 2002 14:11:46 +0000 Subject: [PATCH] Magnification utility enhancements. git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@236 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- ChangeLog | 30 ++++- docs/reference/cspi/tmpl/spi_accessible.sgml | 3 +- docs/reference/cspi/tmpl/spi_action.sgml | 12 +- docs/reference/cspi/tmpl/spi_component.sgml | 9 +- docs/reference/cspi/tmpl/spi_editabletext.sgml | 18 +-- docs/reference/cspi/tmpl/spi_hyperlink.sgml | 7 +- docs/reference/cspi/tmpl/spi_hypertext.sgml | 6 +- docs/reference/cspi/tmpl/spi_image.sgml | 3 - docs/reference/cspi/tmpl/spi_registry.sgml | 6 +- docs/reference/cspi/tmpl/spi_selection.sgml | 12 +- docs/reference/cspi/tmpl/spi_table.sgml | 45 +++----- docs/reference/cspi/tmpl/spi_text.sgml | 32 ++---- test/demo.csh | 4 +- util/mag_client.h | 5 +- util/mag_control.c | 71 +++++++++++- util/mag_image.c | 3 +- util/mag_image.h | 11 ++ util/magnifier.c | 151 ++++++++++++++++++------- 18 files changed, 271 insertions(+), 157 deletions(-) diff --git a/ChangeLog b/ChangeLog index 49a39f6..d44a24f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,36 @@ +2002-02-12 Bill Haneman + + Magnification Utility Enhancements: + + * util/magnifier.c: + Added implementation of createZoomRegion, clearAllZoomRegions, + resizeZoomRegion. Added new commandline argument + "--no-initial-region". Note that clearAllZoomRegions doesn't + unmap the old '0' region as it should (yet), and the other + methods only work when creating/resizing a single region, + which is "region 0". + (Code for multiple region support will be added later.) + + * util/mag_image.c: + Now we raise the magnifier window each time it's refreshed; + this will help keep it on top. + + * util/mag_client.h: + Added simple wrappers for above, used by mag_control. + For general use, it's recommended to use the bonobo magnifier + control API directly instead of using these wrappers. + + * util/mag_image.h: + Moved ZoomRegionData from magnifier.c to this file. + + * util/mag_control.c: + Added some code to exercise new IDL implementations. + 2002-02-06 Marc Mulcahy * libspi/text.c: Provide implementation for getAttributes. - 2002-02-04 Bill Haneman +2002-02-04 Bill Haneman * configure.in: Incremented revision. diff --git a/docs/reference/cspi/tmpl/spi_accessible.sgml b/docs/reference/cspi/tmpl/spi_accessible.sgml index 449ffe5..f177805 100644 --- a/docs/reference/cspi/tmpl/spi_accessible.sgml +++ b/docs/reference/cspi/tmpl/spi_accessible.sgml @@ -76,9 +76,8 @@ Accessible Objects @obj: -@Returns: - @childIndex: +@Returns: diff --git a/docs/reference/cspi/tmpl/spi_action.sgml b/docs/reference/cspi/tmpl/spi_action.sgml index e9b2142..4674885 100644 --- a/docs/reference/cspi/tmpl/spi_action.sgml +++ b/docs/reference/cspi/tmpl/spi_action.sgml @@ -49,9 +49,8 @@ AccessibleAction Interface @obj: -@Returns: - @i: +@Returns: @@ -60,9 +59,8 @@ AccessibleAction Interface @obj: -@Returns: - @i: +@Returns: @@ -71,9 +69,8 @@ AccessibleAction Interface @obj: -@Returns: - @i: +@Returns: @@ -82,8 +79,7 @@ AccessibleAction Interface @obj: -@Returns: - @i: +@Returns: diff --git a/docs/reference/cspi/tmpl/spi_component.sgml b/docs/reference/cspi/tmpl/spi_component.sgml index bba2e1d..b6a1372 100644 --- a/docs/reference/cspi/tmpl/spi_component.sgml +++ b/docs/reference/cspi/tmpl/spi_component.sgml @@ -62,11 +62,10 @@ AccessibleComponent Interface @obj: -@Returns: - @x: @y: @ctype: +@Returns: @@ -75,11 +74,10 @@ AccessibleComponent Interface @obj: -@Returns: - @x: @y: @ctype: +@Returns: @@ -88,7 +86,6 @@ AccessibleComponent Interface @obj: - @x: @y: @width: @@ -102,7 +99,6 @@ AccessibleComponent Interface @obj: - @x: @y: @ctype: @@ -114,7 +110,6 @@ AccessibleComponent Interface @obj: - @width: @height: diff --git a/docs/reference/cspi/tmpl/spi_editabletext.sgml b/docs/reference/cspi/tmpl/spi_editabletext.sgml index 8fa6fdd..730d515 100644 --- a/docs/reference/cspi/tmpl/spi_editabletext.sgml +++ b/docs/reference/cspi/tmpl/spi_editabletext.sgml @@ -40,10 +40,9 @@ AccessibleEditableText Interface @obj: -@Returns: - @startPos: @endPos: +@Returns: @@ -52,10 +51,9 @@ AccessibleEditableText Interface @obj: -@Returns: - @startPos: @endPos: +@Returns: @@ -64,11 +62,10 @@ AccessibleEditableText Interface @obj: -@Returns: - @position: @text: @length: +@Returns: @@ -77,10 +74,9 @@ AccessibleEditableText Interface @obj: -@Returns: - @startPos: @endPos: +@Returns: @@ -89,9 +85,8 @@ AccessibleEditableText Interface @obj: -@Returns: - @position: +@Returns: @@ -111,9 +106,8 @@ AccessibleEditableText Interface @obj: @attributes: -@Returns: - @startOffset: @endOffset: +@Returns: diff --git a/docs/reference/cspi/tmpl/spi_hyperlink.sgml b/docs/reference/cspi/tmpl/spi_hyperlink.sgml index 2f923b0..8d03b55 100644 --- a/docs/reference/cspi/tmpl/spi_hyperlink.sgml +++ b/docs/reference/cspi/tmpl/spi_hyperlink.sgml @@ -45,7 +45,6 @@ AccessibleHyperlink Interface @obj: - @startIndex: @endIndex: @@ -56,9 +55,8 @@ AccessibleHyperlink Interface @obj: -@Returns: - @i: +@Returns: @@ -67,9 +65,8 @@ AccessibleHyperlink Interface @obj: -@Returns: - @i: +@Returns: diff --git a/docs/reference/cspi/tmpl/spi_hypertext.sgml b/docs/reference/cspi/tmpl/spi_hypertext.sgml index 30d313a..5a7f2c0 100644 --- a/docs/reference/cspi/tmpl/spi_hypertext.sgml +++ b/docs/reference/cspi/tmpl/spi_hypertext.sgml @@ -49,9 +49,8 @@ AccessibleHypertext Interface @obj: -@Returns: - @linkIndex: +@Returns: @@ -60,8 +59,7 @@ AccessibleHypertext Interface @obj: -@Returns: - @characterOffset: +@Returns: diff --git a/docs/reference/cspi/tmpl/spi_image.sgml b/docs/reference/cspi/tmpl/spi_image.sgml index f666d78..32f036e 100644 --- a/docs/reference/cspi/tmpl/spi_image.sgml +++ b/docs/reference/cspi/tmpl/spi_image.sgml @@ -49,7 +49,6 @@ AccessibleImage Interface @obj: - @width: @height: @@ -60,7 +59,6 @@ AccessibleImage Interface @obj: - @x: @y: @ctype: @@ -72,7 +70,6 @@ AccessibleImage Interface @obj: - @x: @y: @width: diff --git a/docs/reference/cspi/tmpl/spi_registry.sgml b/docs/reference/cspi/tmpl/spi_registry.sgml index fb55349..09ab7cd 100644 --- a/docs/reference/cspi/tmpl/spi_registry.sgml +++ b/docs/reference/cspi/tmpl/spi_registry.sgml @@ -195,11 +195,10 @@ Registry queries -@Returns: - @keyval: @keystring: @synth_type: +@Returns: @@ -207,10 +206,9 @@ Registry queries -@Returns: - @x: @y: @name: +@Returns: diff --git a/docs/reference/cspi/tmpl/spi_selection.sgml b/docs/reference/cspi/tmpl/spi_selection.sgml index 2668a50..d46f4ae 100644 --- a/docs/reference/cspi/tmpl/spi_selection.sgml +++ b/docs/reference/cspi/tmpl/spi_selection.sgml @@ -49,9 +49,8 @@ AccessibleSelection Interface @obj: -@Returns: - @selectedChildIndex: +@Returns: @@ -60,9 +59,8 @@ AccessibleSelection Interface @obj: -@Returns: - @childIndex: +@Returns: @@ -71,9 +69,8 @@ AccessibleSelection Interface @obj: -@Returns: - @childIndex: +@Returns: @@ -82,9 +79,8 @@ AccessibleSelection Interface @obj: -@Returns: - @selectedChildIndex: +@Returns: diff --git a/docs/reference/cspi/tmpl/spi_table.sgml b/docs/reference/cspi/tmpl/spi_table.sgml index 38d142a..331c16a 100644 --- a/docs/reference/cspi/tmpl/spi_table.sgml +++ b/docs/reference/cspi/tmpl/spi_table.sgml @@ -40,10 +40,9 @@ AccessibleTable Interface @obj: -@Returns: - @row: @column: +@Returns: @@ -61,9 +60,8 @@ AccessibleTable Interface @obj: -@Returns: - @index: +@Returns: @@ -72,9 +70,8 @@ AccessibleTable Interface @obj: -@Returns: - @column: +@Returns: @@ -83,10 +80,9 @@ AccessibleTable Interface @obj: -@Returns: - @row: @column: +@Returns: @@ -95,9 +91,8 @@ AccessibleTable Interface @obj: -@Returns: - @column: +@Returns: @@ -106,10 +101,9 @@ AccessibleTable Interface @obj: -@Returns: - @row: @column: +@Returns: @@ -154,9 +148,8 @@ AccessibleTable Interface @obj: -@Returns: - @index: +@Returns: @@ -165,9 +158,8 @@ AccessibleTable Interface @obj: -@Returns: - @row: +@Returns: @@ -176,10 +168,9 @@ AccessibleTable Interface @obj: -@Returns: - @row: @column: +@Returns: @@ -188,9 +179,8 @@ AccessibleTable Interface @obj: -@Returns: - @row: +@Returns: @@ -199,9 +189,8 @@ AccessibleTable Interface @obj: -@Returns: - @selectedRows: +@Returns: @@ -210,9 +199,8 @@ AccessibleTable Interface @obj: -@Returns: - @selectedColumns: +@Returns: @@ -230,9 +218,8 @@ AccessibleTable Interface @obj: -@Returns: - @column: +@Returns: @@ -241,9 +228,8 @@ AccessibleTable Interface @obj: -@Returns: - @row: +@Returns: @@ -252,9 +238,8 @@ AccessibleTable Interface @obj: -@Returns: - @row: @column: +@Returns: diff --git a/docs/reference/cspi/tmpl/spi_text.sgml b/docs/reference/cspi/tmpl/spi_text.sgml index b3bc9dd..c4e6c77 100644 --- a/docs/reference/cspi/tmpl/spi_text.sgml +++ b/docs/reference/cspi/tmpl/spi_text.sgml @@ -55,10 +55,9 @@ AccessibleText Interface @obj: -@Returns: - @startOffset: @endOffset: +@Returns: @@ -67,11 +66,10 @@ AccessibleText Interface @obj: -@Returns: - @offset: @startOffset: @endOffset: +@Returns: @@ -98,7 +96,6 @@ AccessibleText Interface @obj: - @offset: @x: @y: @@ -122,11 +119,10 @@ AccessibleText Interface @obj: -@Returns: - @x: @y: @type: +@Returns: @@ -135,7 +131,6 @@ AccessibleText Interface @obj: - @selectionNum: @startOffset: @endOffset: @@ -147,10 +142,9 @@ AccessibleText Interface @obj: -@Returns: - @startOffset: @endOffset: +@Returns: @@ -159,12 +153,11 @@ AccessibleText Interface @obj: -@Returns: - @offset: @type: @startOffset: @endOffset: +@Returns: @@ -173,12 +166,11 @@ AccessibleText Interface @obj: -@Returns: - @offset: @type: @startOffset: @endOffset: +@Returns: @@ -187,12 +179,11 @@ AccessibleText Interface @obj: -@Returns: - @offset: @type: @startOffset: @endOffset: +@Returns: @@ -201,9 +192,8 @@ AccessibleText Interface @obj: -@Returns: - @selectionNum: +@Returns: @@ -212,9 +202,8 @@ AccessibleText Interface @obj: -@Returns: - @newOffset: +@Returns: @@ -223,10 +212,9 @@ AccessibleText Interface @obj: -@Returns: - @selectionNum: @startOffset: @endOffset: +@Returns: diff --git a/test/demo.csh b/test/demo.csh index 7bdc2ee..bc14b3c 100755 --- a/test/demo.csh +++ b/test/demo.csh @@ -15,16 +15,18 @@ pkill festival pkill sleep pkill magnifier pkill simple-at +pkill keysynth-demo unsetenv GTK_MODULES setenv MAGNIFIER 1 setenv FESTIVAL 1 +setenv GTK_RC_FILES /opt/gnome-2.0/share/themes/Default/gtk-2.0/gtkrc # start the text-to-speech service festival_server & # start the simple AT client, which uses the # MAGNIFIER and FESTIVAL environment variables simple-at & - +sleep 2; keysynth-demo & # now set GTK_MODULES for use by GTK+ applications # this will cause the gail accessibility support, # the ferret test tool, and the atk-bridge to be diff --git a/util/mag_client.h b/util/mag_client.h index b4c8008..9b89878 100644 --- a/util/mag_client.h +++ b/util/mag_client.h @@ -26,9 +26,12 @@ extern "C" { #endif /* __cplusplus */ -Accessibility_Magnifier get_magnifier(void); +Accessibility_Magnifier get_magnifier (void); void magnifier_set_roi (int zoom_region, int x1, int y1, int x2, int y2); void magnifier_set_magnification (int zoom_region, float mag_factor_x, float mag_factor_y); +void magnifier_resize_region (int zoom_region, int x1, int y1, int x2, int y2); +int magnifier_create_region (float zx, float zy, int x1, int y1, int x2, int y2); +void magnifier_clear_all_regions (void); #ifdef __cplusplus } diff --git a/util/mag_control.c b/util/mag_control.c index f223944..a2883f0 100644 --- a/util/mag_control.c +++ b/util/mag_control.c @@ -20,12 +20,28 @@ int main(int argc, char ** argv){ get_magnifier (); } - else { - printf ("setting mag factor to %f\n", (float) atof (argv[1])); - magnifier_set_magnification (0, (float) atof (argv[1]), - (float) atof (argv[1])); - } - sleep (4); + else + { + switch (*argv[1]) + { + case 'z': + printf ("setting mag factor to %f\n", (float) atof (argv[1]+1)); + magnifier_set_magnification (0, (float) atof (argv[1]+1), + (float) atof (argv[1]+1)); + break; + case 's': + printf ("resizing region 0 to 100x100 at (600, 0)\n"); + magnifier_resize_region (0, 600, 0, 700, 100); + break; + case 'd': + printf ("destroying/clearing all regions.\n"); + magnifier_clear_all_regions (); + break; + case 'c': + printf ("creating 3x region at 100,100; 300x200\n"); + magnifier_create_region (3.0, 3.0, 100, 100, 400, 300); + } + } return 0; } @@ -81,6 +97,49 @@ magnifier_set_roi(int zoom_region, int x, int y, int w, int h) } void +magnifier_resize_region (int zoom_region, int x1, int y1, int x2, int y2) +{ + Accessibility_Magnifier magnifier = get_magnifier(); + + if (magnifier) + Accessibility_Magnifier_resizeZoomRegion (magnifier, + (const CORBA_short) zoom_region, + (const CORBA_long) x1, + (const CORBA_long) y1, + (const CORBA_long) x2, + (const CORBA_long) y2, + &ev); +} + +void +magnifier_clear_all_regions () +{ + Accessibility_Magnifier magnifier = get_magnifier(); + + if (magnifier) + Accessibility_Magnifier_clearAllZoomRegions (magnifier, + &ev); +} + +int +magnifier_create_region (float zx, float zy, int x1, int y1, int x2, int y2) +{ + Accessibility_Magnifier magnifier = get_magnifier(); + int retval = -1; + + if (magnifier) + retval = Accessibility_Magnifier_createZoomRegion (magnifier, + (const CORBA_float) zx, + (const CORBA_float) zy, + (const CORBA_long) x1, + (const CORBA_long) y1, + (const CORBA_long) x2, + (const CORBA_long) y2, + &ev); + return retval; +} + +void magnifier_set_magnification (int zoom_region, float mag_factor_x, float mag_factor_y) { Accessibility_Magnifier magnifier = get_magnifier(); diff --git a/util/mag_image.c b/util/mag_image.c index cc7aa7a..aa2c3a7 100644 --- a/util/mag_image.c +++ b/util/mag_image.c @@ -121,7 +121,8 @@ int display_image(gpointer data) 0,0,0,0,DisplayWidth (mag_data->target_display,screen_num), DisplayHeight(mag_data->target_display,screen_num), GDK_RGB_DITHER_NORMAL,0,0); - /* TODO: raise this window to top on refresh */ + + gdk_window_raise (drawing_area->window); return TRUE; } diff --git a/util/mag_image.h b/util/mag_image.h index 6ca08b7..109001c 100644 --- a/util/mag_image.h +++ b/util/mag_image.h @@ -29,6 +29,16 @@ struct xlib_colormap_struct { Colormap colormap; }; +typedef struct { + GdkRectangle extents; + GdkRectangle roi; + float zoom_x; + float zoom_y; + int contrast; + gboolean is_managed; + gboolean is_dirty; +} ZoomRegionData; + point center_position; point curpos; /* Position of the magnified cursor */ GdkPixbuf* image; @@ -54,6 +64,7 @@ typedef struct _MagnifierData { GtkWidget *output_window; void *source_display; void *target_display; + GList *zoom_regions; } MagnifierData; #define FACTOR 1 diff --git a/util/magnifier.c b/util/magnifier.c index cb12459..bb04cc3 100644 --- a/util/magnifier.c +++ b/util/magnifier.c @@ -14,16 +14,6 @@ struct sockaddr_un mag_server = { AF_UNIX , "/tmp/magnifier_socket" }; typedef struct { - GdkRectangle extents; - GdkRectangle roi; - float zoom_x; - float zoom_y; - int contrast; - gboolean is_managed; - gboolean is_dirty; -} ZoomRegionData; - -typedef struct { gchar *target_display; gchar *source_display; int vertical_split; @@ -36,7 +26,7 @@ typedef struct { int min_refresh_time; int no_bonobo; int fast_cmap_convert; - GList *zoom_regions; + int no_initial_region; } MagnifierOptions; static MagnifierOptions global_options = { ":0.0", @@ -50,6 +40,7 @@ static MagnifierOptions global_options = { ":0.0", 2.0, 200, 0, + 0, 0 }; @@ -65,6 +56,7 @@ struct poptOption magnifier_options [] = { /* {"invert image", 'i', POPT_ARG_NONE, &global_options.invert_image, 'i', "invert the image colormap", NULL}, */ {"fast-colormap-conversion", 'c', POPT_ARG_NONE, &global_options.fast_cmap_convert, 'c', "use faster colormap conversion algorithm (fails for 6 bit color)", NULL}, {"no-bonobo", '\0', POPT_ARG_NONE, &global_options.no_bonobo, '\0', "don't use bonobo for controls, use sockets", NULL}, + {"no-initial-region", '\0', POPT_ARG_NONE, &global_options.no_initial_region, '\0', "don't create an initial zoom region", NULL}, {NULL, 0, 0, NULL, 0, 0} }; @@ -119,6 +111,24 @@ static gboolean get_commands(GIOChannel* client, } +static void +magnifier_pack_regions (Magnifier *magnifier) +{ + /* + * this call prevents resizing, which is a bother, but required to + * work around dtwm incompatibilities. Perhaps a better workaround will + * be found, or we can make this a runtime option. + */ + gtk_widget_set_size_request (magnifier->mag_data->output_window, + magnifier->mag_data->mag_width, + magnifier->mag_data->mag_height); + + gdk_window_move(magnifier->mag_data->output_window->window, + magnifier->mag_data->mag_x, + magnifier->mag_data->mag_y); + +} + int main (int argc, char** argv){ GIOChannel *mag_channel; char *dpyname; @@ -146,12 +156,20 @@ int main (int argc, char** argv){ global_options.mouse_follow; magnifier->mag_data->color_inverted = global_options.invert_image; - magnifier->mag_data->factor_x = - (int) global_options.zoom_factor; - magnifier->mag_data->factor_y = - (int) global_options.zoom_factor; - - /* TODO: enable fractional magnifications ? */ + if (!global_options.no_initial_region) + { + magnifier->mag_data->zoom_regions = + g_list_prepend (magnifier->mag_data->zoom_regions, + g_new0 (ZoomRegionData, 1)); + magnifier->mag_data->factor_x = (int) global_options.zoom_factor; + magnifier->mag_data->factor_y = (int) global_options.zoom_factor; + } + else { + g_print ("starting magnifier with no initial zoom region\n"); + magnifier->mag_data->mag_width = 0; + magnifier->mag_data->mag_height = 0; + } + /* TODO: enable fractional magnifications option? */ if (global_options.target_display) { snprintf (env_string, (size_t) (ENV_STRING_MAX_SIZE-1), "DISPLAY=%s", global_options.target_display); putenv (env_string); @@ -234,30 +252,41 @@ int main (int argc, char** argv){ DisplayWidth (magnifier->mag_data->target_display,screen_num), DisplayHeight(magnifier->mag_data->target_display,screen_num)); if (global_options.vertical_split) - magnifier->mag_data->mag_width = DisplayWidth (magnifier->mag_data->target_display,screen_num)/2; - else - magnifier->mag_data->mag_width = DisplayWidth (magnifier->mag_data->target_display, screen_num); - if (global_options.horizontal_split) - magnifier->mag_data->mag_height = DisplayHeight (magnifier->mag_data->target_display,screen_num)/2; - else magnifier->mag_data->mag_height = DisplayHeight (magnifier->mag_data->target_display, screen_num); + { + magnifier->mag_data->mag_width = + DisplayWidth (magnifier->mag_data->target_display,screen_num)/2; + magnifier->mag_data->mag_height = + DisplayHeight (magnifier->mag_data->target_display, screen_num); + } + else if (global_options.horizontal_split) + { + magnifier->mag_data->mag_width = + DisplayWidth (magnifier->mag_data->target_display, screen_num); + magnifier->mag_data->mag_height = + DisplayHeight (magnifier->mag_data->target_display,screen_num)/2; + } + else if (global_options.fullscreen) + { + magnifier->mag_data->mag_width = + DisplayWidth (magnifier->mag_data->target_display, screen_num); + magnifier->mag_data->mag_height = + DisplayHeight (magnifier->mag_data->target_display,screen_num); + } + magnifier->mag_data->mag_x = + DisplayWidth (magnifier->mag_data->target_display, screen_num) + - magnifier->mag_data->mag_width; + magnifier->mag_data->mag_y = + DisplayHeight (magnifier->mag_data->target_display, screen_num) + - magnifier->mag_data->mag_height; + + magnifier->mag_data->output_window = window; gtk_window_set_decorated (GTK_WINDOW (window), FALSE); - - /* - * this call prevents resizing, which is a bother, but required to - * work around dtwm incompatibilities. Perhaps a better workaround will - * be found, or we can make this a runtime option. - */ - gtk_widget_set_size_request (window, - magnifier->mag_data->mag_width, - magnifier->mag_data->mag_height); gtk_widget_show_all (window); - - gdk_window_move(window->window, - gdk_screen_width() - magnifier->mag_data->mag_width, - gdk_screen_height() - magnifier->mag_data->mag_height); - magnifier->mag_data->output_window = window; - if (global_options.fullscreen) gdk_window_stick (window->window); + magnifier_pack_regions (magnifier); + + /* if (global_options.fullscreen) */ + gdk_window_stick (window->window); gdk_window_set_functions(window->window, 0); gdk_window_raise(window->window); @@ -387,6 +416,10 @@ impl_magnifier_set_mag_factor (PortableServer_Servant servant, static void impl_magnifier_mark_dirty (PortableServer_Servant servant, const CORBA_short zoom_region, + const CORBA_long x1, + const CORBA_long y1, + const CORBA_long x2, + const CORBA_long y2, CORBA_Environment *ev) { Magnifier *magnifier = MAGNIFIER (bonobo_object_from_servant (servant)); @@ -413,7 +446,23 @@ impl_magnifier_create_zoom_region (PortableServer_Servant servant, CORBA_Environment *ev) { Magnifier *magnifier = MAGNIFIER (bonobo_object_from_servant (servant)); - return -1; + if (magnifier->mag_data->zoom_regions == NULL) + { + magnifier->mag_data->zoom_regions = + g_list_prepend (magnifier->mag_data->zoom_regions, + g_new0 (ZoomRegionData, 1)); + magnifier->mag_data->factor_x = (int) zx; + magnifier->mag_data->factor_y = (int) zy; + magnifier->mag_data->mag_x = x1; + magnifier->mag_data->mag_y = y1; + magnifier->mag_data->mag_width = (x2 - x1); + magnifier->mag_data->mag_height = (y2 - y1); + magnifier_pack_regions (magnifier); + } + else + { + return -1; + } } static CORBA_boolean @@ -440,25 +489,42 @@ impl_magnifier_get_zoom_region_params (PortableServer_Servant servant, } static void -impl_magnifier_resize_zoom_region (PortableServer_Servant _servant, +impl_magnifier_resize_zoom_region (PortableServer_Servant servant, const CORBA_short zoom_region, const CORBA_long x1, const CORBA_long y1, const CORBA_long x2, const CORBA_long y2, CORBA_Environment * ev) { + Magnifier *magnifier = MAGNIFIER (bonobo_object_from_servant (servant)); + if (zoom_region == 0) + { + magnifier->mag_data->mag_x = x1; + magnifier->mag_data->mag_y = y1; + magnifier->mag_data->mag_width = (x2 - x1); + magnifier->mag_data->mag_height = (y2 - y1); + magnifier_pack_regions (magnifier); + } } static void -impl_magnifier_destroy_zoom_region (PortableServer_Servant _servant, +impl_magnifier_destroy_zoom_region (PortableServer_Servant servant, const CORBA_short zoom_region, CORBA_Environment * ev) { + Magnifier *magnifier = MAGNIFIER (bonobo_object_from_servant (servant)); + if (zoom_region == 0) + { + g_list_free (magnifier->mag_data->zoom_regions); + } } static void -impl_magnifier_clear_all_zoom_regions (PortableServer_Servant _servant, +impl_magnifier_clear_all_zoom_regions (PortableServer_Servant servant, CORBA_Environment * ev) { + Magnifier *magnifier = MAGNIFIER (bonobo_object_from_servant (servant)); + g_list_free (magnifier->mag_data->zoom_regions); + magnifier->mag_data->zoom_regions = NULL; } static void @@ -500,6 +566,7 @@ magnifier_init (Magnifier *magnifier) magnifier->mag_data->fast_rgb_convert = FALSE; magnifier->mag_data->center.x = 0; magnifier->mag_data->center.y = 0; + magnifier->mag_data->zoom_regions = NULL; } GType -- 2.7.4