* atk-bridge/bridge.c:
[platform/core/uifw/at-spi2-atk.git] / util / mag_control.c
index f223944..e473409 100644 (file)
@@ -1,3 +1,25 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2001 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -20,12 +42,32 @@ 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 'q':
+         printf ("exiting magnifier.\n");
+         magnifier_exit ();
+         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 +123,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();
@@ -93,3 +178,10 @@ magnifier_set_magnification (int zoom_region, float mag_factor_x, float mag_fact
                                             &ev);
 }
 
+void
+magnifier_exit (void)
+{
+  Accessibility_Magnifier magnifier = get_magnifier();
+  if (magnifier)
+    Accessibility_Magnifier_exit (magnifier, &ev);
+}