void structTextEditor :: v_goAway () { if (v_fileBased () && dirty) { if (! dirtyCloseDialog) { int buttonWidth = 120, buttonSpacing = 20; dirtyCloseDialog = GuiDialog_create (d_windowForm, 150, 70, Gui_LEFT_DIALOG_SPACING + 3 * buttonWidth + 2 * buttonSpacing + Gui_RIGHT_DIALOG_SPACING, Gui_TOP_DIALOG_SPACING + Gui_TEXTFIELD_HEIGHT + Gui_VERTICAL_DIALOG_SPACING_SAME + 2 * Gui_BOTTOM_DIALOG_SPACING + Gui_PUSHBUTTON_HEIGHT, U"Text changed", nullptr, nullptr, GuiDialog_MODAL); GuiLabel_createShown (dirtyCloseDialog, Gui_LEFT_DIALOG_SPACING, - Gui_RIGHT_DIALOG_SPACING, Gui_TOP_DIALOG_SPACING, Gui_TOP_DIALOG_SPACING + Gui_LABEL_HEIGHT, U"The text has changed! Save changes?", 0); int x = Gui_LEFT_DIALOG_SPACING, y = - Gui_BOTTOM_DIALOG_SPACING; GuiButton_createShown (dirtyCloseDialog, x, x + buttonWidth, y - Gui_PUSHBUTTON_HEIGHT, y, U"Discard & Close", gui_button_cb_discardAndClose, this, 0); x += buttonWidth + buttonSpacing; GuiButton_createShown (dirtyCloseDialog, x, x + buttonWidth, y - Gui_PUSHBUTTON_HEIGHT, y, U"Cancel", gui_button_cb_cancelClose, this, 0); x += buttonWidth + buttonSpacing; GuiButton_createShown (dirtyCloseDialog, x, x + buttonWidth, y - Gui_PUSHBUTTON_HEIGHT, y, U"Save & Close", gui_button_cb_saveAndClose, this, 0); } GuiThing_show (dirtyCloseDialog); } else { closeDocument (this); } }
void praat_showLogo (bool autoPopDown) { #if gtk static const gchar *authors [3] = { "Paul Boersma", "David Weenink", nullptr }; GuiObject dialog = gtk_about_dialog_new (); #define xstr(s) str(s) #define str(s) #s gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (dialog), xstr (PRAAT_VERSION_STR)); gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG (dialog), "Copyright © 1992–" xstr(PRAAT_YEAR) " by Paul Boersma and David Weenink"); gtk_about_dialog_set_license (GTK_ABOUT_DIALOG (dialog), "GPL"); gtk_about_dialog_set_website (GTK_ABOUT_DIALOG (dialog), "http://www.praat.org"); //gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (dialog), authors); g_signal_connect (GTK_DIALOG (dialog), "response", G_CALLBACK (gtk_widget_destroy), nullptr); gtk_dialog_run (GTK_DIALOG (dialog)); #else if (theCurrentPraatApplication -> batch || ! theLogo.draw) return; if (! theLogo.dia) { int width = theLogo.width_mm / 25.4 * Gui_getResolution (nullptr); int height = theLogo.height_mm / 25.4 * Gui_getResolution (nullptr); theLogo.dia = GuiDialog_create (theCurrentPraatApplication -> topShell, 100, 100, width, height, U"About", gui_cb_goAway, nullptr, 0); theLogo.form = theLogo.dia; theLogo.drawingArea = GuiDrawingArea_createShown (theLogo.form, 0, width, 0, height, gui_drawingarea_cb_expose, gui_drawingarea_cb_click, nullptr, nullptr, nullptr, 0); } GuiThing_show (theLogo.form); GuiThing_show (theLogo.dia); #if motif if (autoPopDown) GuiAddTimeOut (2000, logo_timeOut, (XtPointer) nullptr); #endif #endif }
static void menu_cb_new (TextEditor me, EDITOR_ARGS_CMD) { if (my v_fileBased () && my dirty) { if (! my dirtyNewDialog) { int buttonWidth = 120, buttonSpacing = 20; my dirtyNewDialog = GuiDialog_create (my d_windowForm, 150, 70, Gui_LEFT_DIALOG_SPACING + 3 * buttonWidth + 2 * buttonSpacing + Gui_RIGHT_DIALOG_SPACING, Gui_TOP_DIALOG_SPACING + Gui_TEXTFIELD_HEIGHT + Gui_VERTICAL_DIALOG_SPACING_SAME + 2 * Gui_BOTTOM_DIALOG_SPACING + Gui_PUSHBUTTON_HEIGHT, U"Text changed", nullptr, nullptr, GuiDialog_MODAL); GuiLabel_createShown (my dirtyNewDialog, Gui_LEFT_DIALOG_SPACING, - Gui_RIGHT_DIALOG_SPACING, Gui_TOP_DIALOG_SPACING, Gui_TOP_DIALOG_SPACING + Gui_LABEL_HEIGHT, U"The text has changed! Save changes?", 0); int x = Gui_LEFT_DIALOG_SPACING, y = - Gui_BOTTOM_DIALOG_SPACING; GuiButton_createShown (my dirtyNewDialog, x, x + buttonWidth, y - Gui_PUSHBUTTON_HEIGHT, y, U"Discard & New", gui_button_cb_discardAndNew, cmd, 0); x += buttonWidth + buttonSpacing; GuiButton_createShown (my dirtyNewDialog, x, x + buttonWidth, y - Gui_PUSHBUTTON_HEIGHT, y, U"Cancel", gui_button_cb_cancelNew, cmd, 0); x += buttonWidth + buttonSpacing; GuiButton_createShown (my dirtyNewDialog, x, x + buttonWidth, y - Gui_PUSHBUTTON_HEIGHT, y, U"Save & New", gui_button_cb_saveAndNew, cmd, 0); } GuiThing_show (my dirtyNewDialog); } else { newDocument (me); } }