autoPicture Picture_create (GuiDrawingArea drawingArea, bool sensitive) { try { autoPicture me = Thing_new (Picture); my drawingArea = drawingArea; /* * The initial viewport is a rectangle 6 inches wide and 4 inches high. */ my selx1 = 0.0; my selx2 = 6.0; my sely1 = 8.0; my sely2 = 12.0; my sensitive = sensitive && drawingArea; if (drawingArea) { /* The drawing area must have been realized; see manual at XtWindow. */ my graphics = Graphics_create_xmdrawingarea (my drawingArea); GuiDrawingArea_setExposeCallback (my drawingArea, gui_drawingarea_cb_expose, me.get()); } else { /* * Create a dummy Graphics. */ my graphics = Graphics_create (600); } Graphics_setWsWindow (my graphics.get(), 0.0, 12.0, 0.0, 12.0); Graphics_setViewport (my graphics.get(), my selx1, my selx2, my sely1, my sely2); if (my sensitive) { my selectionGraphics = Graphics_create_xmdrawingarea (my drawingArea); Graphics_setWindow (my selectionGraphics.get(), 0, 12, 0, 12); GuiDrawingArea_setClickCallback (my drawingArea, gui_drawingarea_cb_click, me.get()); } Graphics_startRecording (my graphics.get()); return me; } catch (MelderError) { Melder_throw (U"Picture not created."); } }
autoTableEditor TableEditor_create (const char32 *title, Table table) { try { autoTableEditor me = Thing_new (TableEditor); Editor_init (me.get(), 0, 0, 700, 500, title, table); #if motif Melder_assert (XtWindow (my drawingArea -> d_widget)); #endif my topRow = 1; my leftColumn = 1; my selectedColumn = 1; my selectedRow = 1; my graphics = Graphics_create_xmdrawingarea (my drawingArea); double size_pixels = SIZE_INCHES * Graphics_getResolution (my graphics.get()); Graphics_setWsViewport (my graphics.get(), 0.0, size_pixels, 0.0, size_pixels); Graphics_setWsWindow (my graphics.get(), 0.0, size_pixels, 0.0, size_pixels); Graphics_setViewport (my graphics.get(), 0.0, size_pixels, 0.0, size_pixels); Graphics_setFont (my graphics.get(), kGraphics_font_COURIER); Graphics_setFontSize (my graphics.get(), 12); Graphics_setUnderscoreIsSubscript (my graphics.get(), false); Graphics_setAtSignIsLink (my graphics.get(), true); return me; } catch (MelderError) { Melder_throw (U"TableEditor not created."); } }
static void gui_drawingarea_cb_expose (I, GuiDrawingAreaExposeEvent event) { if (theLogo.graphics == NULL) theLogo.graphics = Graphics_create_xmdrawingarea (theLogo.drawingArea); #if gtk Graphics_x_setCR (theLogo.graphics, gdk_cairo_create (GDK_DRAWABLE (GTK_WIDGET (event -> widget -> d_widget) -> window))); cairo_rectangle ((cairo_t *) Graphics_x_getCR (theLogo.graphics), (double) event->x, (double) event->y, (double) event->width, (double) event->height); cairo_clip ((cairo_t *) Graphics_x_getCR (theLogo.graphics)); theLogo.draw (theLogo.graphics); cairo_destroy ((cairo_t *) Graphics_x_getCR (theLogo.graphics)); #elif motif (void) void_me; (void) event; if (theLogo.graphics == NULL) theLogo.graphics = Graphics_create_xmdrawingarea (theLogo.drawingArea); theLogo.draw (theLogo.graphics); #endif }
static void gui_drawingarea_cb_expose (Thing /* me */, GuiDrawingArea_ExposeEvent event) { if (! theLogo.graphics) theLogo.graphics = Graphics_create_xmdrawingarea (theLogo.drawingArea); #if gtk #if ALLOW_GDK_DRAWING Graphics_x_setCR (theLogo.graphics, gdk_cairo_create (GDK_DRAWABLE (GTK_WIDGET (event -> widget -> d_widget) -> window))); #else Graphics_x_setCR (theLogo.graphics, gdk_cairo_create (gtk_widget_get_window (GTK_WIDGET (event -> widget -> d_widget)))); #endif cairo_rectangle ((cairo_t *) Graphics_x_getCR (theLogo.graphics), (double) event->x, (double) event->y, (double) event->width, (double) event->height); cairo_clip ((cairo_t *) Graphics_x_getCR (theLogo.graphics)); theLogo.draw (theLogo.graphics); cairo_destroy ((cairo_t *) Graphics_x_getCR (theLogo.graphics)); #elif motif || cocoa (void) event; if (! theLogo.graphics) theLogo.graphics = Graphics_create_xmdrawingarea (theLogo.drawingArea); theLogo.draw (theLogo.graphics); #endif }
autoArtwordEditor ArtwordEditor_create (const char32 *title, Artword data) { try { autoArtwordEditor me = Thing_new (ArtwordEditor); Editor_init (me.peek(), 20, 40, 650, 600, title, data); //XtUnmanageChild (my menuBar); my graphics = Graphics_create_xmdrawingarea (my drawingArea); updateList (me.peek()); return me; } catch (MelderError) { Melder_throw (U"Artword window not created."); } }
RunnerMFC RunnerMFC_create (const wchar_t *title, Ordered experiments) { try { autoRunnerMFC me = Thing_new (RunnerMFC); Editor_init (me.peek(), 0, 0, 2000, 2000, title, NULL); my experiments = experiments; my graphics = Graphics_create_xmdrawingarea (my d_drawingArea); struct structGuiDrawingAreaResizeEvent event = { my d_drawingArea, 0 }; event. width = my d_drawingArea -> f_getWidth (); event. height = my d_drawingArea -> f_getHeight (); gui_drawingarea_cb_resize (me.peek(), & event); my iexperiment = 1; RunnerMFC_startExperiment (me.peek()); return me.transfer(); } catch (MelderError) { Melder_throw ("Experiment window not created."); } }
void HyperPage_init (HyperPage me, const wchar_t *title, Data data) { resolution = Gui_getResolution (NULL); Editor_init (me, 0, 0, 6 * resolution + 30, 800, title, data); #if motif Melder_assert (XtWindow (my drawingArea -> d_widget)); #endif my g = Graphics_create_xmdrawingarea (my drawingArea); Graphics_setAtSignIsLink (my g, TRUE); Graphics_setDollarSignIsCode (my g, TRUE); Graphics_setFont (my g, kGraphics_font_TIMES); if (prefs_font != kGraphics_font_TIMES && prefs_font != kGraphics_font_HELVETICA) prefs_font = kGraphics_font_TIMES; // ensure Unicode compatibility my font = prefs_font; setFontSize (me, prefs_fontSize); struct structGuiDrawingAreaResizeEvent event = { my drawingArea, 0 }; event. width = my drawingArea -> f_getWidth (); event. height = my drawingArea -> f_getHeight (); gui_drawingarea_cb_resize (me, & event); updateVerticalScrollBar (me); // scroll to the top (my top == 0) }