static gboolean _GuiWindow_resizeCallback (GuiObject widget, GtkAllocation *allocation, gpointer void_me) { (void) widget; iam (GuiWindow); trace ("fixed received size allocation: (%ld, %ld), %ld x %ld.", (long) allocation -> x, (long) allocation -> y, (long) allocation -> width, (long) allocation -> height); if (allocation -> width != my d_width || allocation -> height != my d_height) { trace ("user changed the size of the window?"); /* * Apparently, GTK sends the size allocation message both to the shell and to its fixed-container child. * we could capture the message either from the shell or from the fixed; we choose to do it from the fixed. */ Melder_assert (GTK_IS_FIXED (widget)); /* * We move and resize all the children of the fixed. */ GList *children = GTK_FIXED (widget) -> children; for (GList *l = g_list_first (children); l != NULL; l = g_list_next (l)) { GtkFixedChild *listElement = (GtkFixedChild *) l -> data; GtkWidget *childWidget = listElement -> widget; Melder_assert (childWidget); Thing_cast (GuiThing, child, _GuiObject_getUserData (childWidget)); if (child) { GuiControl control = NULL; if (Thing_member (child, classGuiControl)) { control = static_cast <GuiControl> (child); } else if (Thing_member (child, classGuiMenu)) { Thing_cast (GuiMenu, menu, child); control = menu -> d_cascadeButton; } if (control) { /* * Move and resize. */ trace ("moving child of class %ls", Thing_className (control)); int left = control -> d_left, right = control -> d_right, top = control -> d_top, bottom = control -> d_bottom; if (left < 0) left += allocation -> width; // this replicates structGuiControl :: v_positionInForm () if (right <= 0) right += allocation -> width; if (top < 0) top += allocation -> height; if (bottom <= 0) bottom += allocation -> height; trace ("moving child to (%d,%d)", left, top); gtk_fixed_move (GTK_FIXED (widget), GTK_WIDGET (childWidget), left, top); gtk_widget_set_size_request (GTK_WIDGET (childWidget), right - left, bottom - top); trace ("moved child of class %ls", Thing_className (control)); } } } my d_width = allocation -> width; my d_height = allocation -> height; gtk_widget_set_size_request (GTK_WIDGET (widget), allocation -> width, allocation -> height); } trace ("end"); return FALSE; }
void FormantGridEditor_init (FormantGridEditor me, const wchar_t *title, FormantGrid data) { Melder_assert (data != NULL); Melder_assert (Thing_member (data, classFormantGrid)); FunctionEditor_init (me, title, data); my ycursor = 0.382 * my p_formantFloor + 0.618 * my p_formantCeiling; my selectedFormant = 1; }
void FormantGridEditor_init (FormantGridEditor me, GuiObject parent, const wchar *title, FormantGrid data) { Melder_assert (data != NULL); Melder_assert (Thing_member (data, classFormantGrid)); FunctionEditor_init (me, parent, title, data); my formantFloor = preferences.formantFloor; my formantCeiling = preferences.formantCeiling; my bandwidthFloor = preferences.bandwidthFloor; my bandwidthCeiling = preferences.bandwidthCeiling; my play = preferences.play; my source = preferences.source; my ycursor = 0.382 * my formantFloor + 0.618 * my formantCeiling; my selectedFormant = 1; }
void CommandHistory_insertItem (I, Any data) { iam (CommandHistory); Melder_assert (data && (Thing_member ( (Thing) data, my itemClass) || my itemClass == NULL)); if (my current < my size) { for (long i = my current + 1; i <= my size; i++) { forget ( ( (Command *) my item) [i]); } my size = my current; } if (my size >= my _capacity) { Collection_removeItem (me, 1); } my item[++my size] = data; my current = my size; }
END static void cb_ERPWindow_publication (Editor editor, void *closure, Data publication) { (void) editor; (void) closure; /* * Keep the gate for error handling. */ try { praat_new (publication, NULL); praat_updateSelection (); if (Thing_member (publication, classSpectrum) && wcsequ (Thing_getName (publication), L"slice")) { int IOBJECT; LOOP { iam (Spectrum); autoSpectrumEditor editor2 = SpectrumEditor_create (ID_AND_FULL_NAME, me); praat_installEditor (editor2.transfer(), IOBJECT); } } } catch (MelderError) { Melder_flushError (NULL); } }