+<2001-09-04 Bill Haneman <bill.haneman@sun.com>
+ * cspi/spi_accessible.c:
+ Added method Accessible_Role_getName(),
+ and requisite string array (role_names).
+ Added conversion string_from_corba_strin() call
+ to Accessible_getName and _getDescription.
+ * libspi/accessible.c:
+ Added implementation for Accessible_getRole()
+ * test/simple-at.c:
+ Added festival support, used if environment variable
+ FESTIVAL is set.
+
<2001-09-12 Marc Mulcahy <marc.mulcahy@sun.com>
* cspi/Makefile.am:
Added spi-util.c.
includes so they are included in libcspi.
* cspi/spi.h:
- Changed prototype of AccessibleAction_doAction to return a boolean.
+ Changed prototype of AccessibleAction_doAction to return a
+ boolean.
Changed prototype of AccessibleTable_getCaption to
return an Accessible.
Changed prototype of AccessibleTable_getSelectedRows
and AccessibleTable_getSelectedColumns to
- return a long (returns the number of selected rows or columns
- respectively).
+ return a long (returns the number of selected rows
+ or columns respectively).
Changed name of AccessibleText_refRunAttributes to
AccessibleText_getAttributes.
- Changed prototype of AccessibleText_getCharacterExtents to return a void rather than a
- boolean. Addded support for a AccessibleCoordType parameter specifying what type of coordinates are desired.
+ Changed prototype of AccessibleText_getCharacterExtents to
+ return a void rather than a boolean.
+ Added support for a AccessibleCoordType parameter
+ specifying what type of coordinates are desired.
Added an AccessibleCordType parameter to
AccessibleText_getPointAtOffset.
Change for nAnchors attributte name change.
- <2001-09-05 Marc Mulcahy <marc.mulcahy@sun.com>
- implementations-- made server implementations own AtkObject pointers
+<2001-09-05 Marc Mulcahy <marc.mulcahy@sun.com>
+
+ implementations-- made server implementations own AtkObject pointers
rather than their respective AtkInterrface pointers to fix
refcounting. AtkHyperlink is still broken.
+#define MAX_ROLES 100
+
+static char *role_names [MAX_ROLES] =
+{
+ " ",
+ "accelerator label",
+ "alert",
+ "animation",
+ "arrow",
+ "calendar",
+ "canvas",
+ "check box",
+ "menu item",
+ "color chooser",
+ "column header",
+ "combo box",
+ "date editor",
+ "desktop icon",
+ "desktop frame",
+ "dial",
+ "dialog",
+ "directory pane",
+ "drawing area",
+ "file chooser",
+ "filler",
+ "font chooser",
+ "frame",
+ "glass pane",
+ "HTML container",
+ "icon",
+ "image",
+ "internal frame",
+ "label",
+ "layered pane",
+ "list",
+ "list item",
+ "menu",
+ "menubar",
+ "menu item",
+ "option pane",
+ "page tab",
+ "page tab list",
+ "panel",
+ "password text",
+ "popup menu",
+ "progress bar",
+ "pushbutton",
+ "radiobutton",
+ "radio menu item",
+ "root pane",
+ "row header",
+ "scrollbar",
+ "scrollpane",
+ "separator",
+ "slider",
+ "split pane",
+ "spin button",
+ "status bar",
+ "table",
+ "table cell",
+ "table column header",
+ "table row header",
+ "tearoff menu item",
+ "text",
+ "toggle button",
+ "toolbar",
+ "tooltip",
+ "tree",
+ " ",
+ "viewport",
+ "window",
+};
/*
- *
- * Accessible function prototypes
- *
+ * Returns a localizable string name for an AtkRole enumerated type.
*/
+char*
+Accessible_Role_getName (Accessibility_Role role)
+{
+ if (role < MAX_ROLES) return role_names [(int) role];
+ else return "";
+}
+
+
/**
* Accessible_ref:
char *
Accessible_getName (Accessible *obj)
{
- return Accessibility_Accessible__get_name (*obj, &ev);
+ return string_from_corba_string (
+ Accessibility_Accessible__get_name (*obj, &ev));
}
/**
char *
Accessible_getDescription (Accessible *obj)
{
- return Accessibility_Accessible__get_description (*obj, &ev);
+ return string_from_corba_string (
+ Accessibility_Accessible__get_description (*obj, &ev));
}
/**
char *
Accessible_getRole (Accessible *obj)
{
- return "";
+ return Accessible_Role_getName (
+ Accessibility_Accessible_getRole (*obj, &ev));
}
/**
return retval;
}
+/*
+ * CORBA Accessibility::Accessible::getRole method implementation
+ */
+static Accessibility_Role
+impl_accessibility_accessible_get_role (PortableServer_Servant servant,
+ const CORBA_long index,
+ CORBA_Environment *ev)
+{
+ Accessibility_Role retval;
+ Accessible *accessible = ACCESSIBLE (bonobo_object_from_servant (servant));
+ AtkRole role = atk_object_get_role (accessible->atko);
+ retval = role;
+ printf ("Accessible get_role.\n");
+ return (Accessibility_Role) retval;
+}
+
static void
accessible_class_init (AccessibleClass *klass)
{
/* epv->getRelationSet = impl_accessibility_accessible_get_relation_set; */
/* epv->getState = impl_accessibility_accessible_get_state; */
- /* epv->getRole = impl_accessibility_accessible_get_role; */
+ epv->getRole = impl_accessibility_accessible_get_role;
}
static void
void report_button_press (void *fp);
+static int _festival_init ();
+static void _festival_say (const char *text, const char *voice, boolean shutup);
+static void _festival_write (const char *buff, int fd);
+
+static boolean use_festival = TRUE;
+static boolean festival_terse = TRUE;
+
int
main(int argc, char **argv)
{
fprintf (stderr, "app %d name: %s\n", j, Accessible_getName (application));
}
}
+
+ if (getenv ("FESTIVAL"))
+ {
+ use_festival = TRUE;
+ }
+
SPI_event_main(FALSE);
}
AccessibleEvent *ev = (AccessibleEvent *) p;
fprintf (stderr, "%s event from %s\n", ev->type,
Accessible_getName (&ev->source));
+
+ if (use_festival)
+ {
+ if (!festival_terse)
+ {
+ _festival_say (Accessible_getRole (&ev->source), "voice_don_diphone", TRUE);
+ }
+ _festival_say (Accessible_getName (&ev->source), "voice_kal_diphone", FALSE);
+ }
+
if (Accessible_isComponent (&ev->source))
{
long x, y, width, height;
fprintf (stderr, "%s event from %s\n", ev->type,
Accessible_getName (&ev->source));
}
+
+static int _festival_init ()
+{
+ int fd;
+ struct sockaddr_in name;
+ int tries = 2;
+
+ name.sin_family = AF_INET;
+ name.sin_port = htons (1314);
+ name.sin_addr.s_addr = htonl(INADDR_ANY);
+ fd = socket (PF_INET, SOCK_STREAM, 0);
+
+ while (connect(fd, (struct sockaddr *) &name, sizeof (name)) < 0) {
+ if (!tries--) {
+ perror ("connect");
+ return -1;
+ }
+ }
+
+ _festival_write ("(audio_mode'async)", fd);
+ _festival_write ("(Parameter.set 'Duration_Stretch 0.5)", fd);
+ _festival_write ("(Parameter.set 'Duration_Model 'Tree_ZScore)", fd);
+ return fd;
+}
+
+static void _festival_say (const char *text, const char *voice, boolean shutup)
+{
+ static int fd = 0;
+ gchar *quoted;
+ gchar *p;
+ gchar prefix[50];
+ gchar voice_spec[32];
+
+ if (!fd)
+ {
+ fd = _festival_init ();
+ }
+
+ fprintf (stderr, "saying text: %s\n", text);
+
+ quoted = g_malloc(64+strlen(text)*2);
+
+ sprintf (prefix, "(SayText \"");
+
+ strncpy(quoted, prefix, 10);
+ p = quoted+strlen(prefix);
+ while (*text) {
+ if ( *text == '\\' || *text == '"' )
+ *p = '\\';
+ *p++ = *text++;
+ }
+ *p++ = '"';
+ *p++ = ')';
+ *p++ = '\n';
+ *p = 0;
+
+ if(shutup) _festival_write ("(audio_mode'shutup)\n", fd);
+ if (voice)
+ {
+ sprintf (voice_spec, "(%s)\n", voice);
+ _festival_write (voice_spec, fd);
+ }
+ if (!festival_terse)
+ {
+ _festival_write ("(Parameter.set 'Duration_Model 'Tree_ZScore)\n", fd);
+ _festival_write ("(Parameter.set 'Duration_Stretch 0.5)\n", fd);
+ }
+ _festival_write (quoted, fd);
+
+ g_free(quoted);
+}
+
+static void _festival_write (const gchar *command_string, int fd)
+{
+ fprintf(stderr, command_string);
+ if (fd < 0) {
+ perror("socket");
+ return;
+ }
+ write(fd, command_string, strlen(command_string));
+}