void create_datasetprop_popup(Widget but, void *data) { set_wait_cursor(); if (tui.top == NULL) { Widget menubar, menupane, fr; int i, j; char *rowlabels[MAX_SET_COLS]; char *collabels[DATA_STAT_COLS] = {"Min", "at", "Max", "at", "Mean", "Stdev"}; int column_widths[DATA_STAT_COLS] = {12, 6, 12, 6, 12, 12}; GraceApp *gapp = (GraceApp *) data; tui.top = CreateDialogForm(app_shell, "Data set statistics"); menubar = CreateMenuBar(tui.top); ManageChild(menubar); AddDialogFormChild(tui.top, menubar); tui.sel = CreateGraphSetSelector(tui.top, "Data sets:", LIST_TYPE_SINGLE); AddDialogFormChild(tui.top, tui.sel->frame); AddStorageChoiceCB(tui.sel->set_sel, changetypeCB, tui.sel); menupane = CreateMenu(menubar, "File", 'F', FALSE); CreateMenuCloseButton(menupane, tui.top); menupane = CreateMenu(menubar, "Help", 'H', TRUE); CreateMenuHelpButton(menupane, "On data sets", 's', tui.top, "doc/UsersGuide.html#data-sets"); for (i = 0; i < MAX_SET_COLS; i++) { rowlabels[i] = copy_string(NULL, dataset_col_name(gapp->grace, i)); for (j = 0; j < DATA_STAT_COLS; j++) { tui.rows[i][j] = NULL; } } fr = CreateFrame(tui.top, "Statistics"); tui.mw = CreateTable("mw", fr, MAX_SET_COLS, DATA_STAT_COLS, MAX_SET_COLS, 4); TableDataSetPropInit(tui.mw); TableSetColLabels(tui.mw, collabels); TableSetColWidths(tui.mw, column_widths); TableSetDefaultColAlignment(tui.mw, ALIGN_END); TableSetDefaultColLabelAlignment(tui.mw, ALIGN_CENTER); TableSetRowLabels(tui.mw, rowlabels); TableSetDefaultRowLabelWidth(tui.mw, 3); TableSetDefaultRowLabelAlignment(tui.mw, ALIGN_CENTER); TableUpdateVisibleRowsCols(tui.mw); AddTableEnterCellCB(tui.mw, enterCB, NULL); AddDialogFormChild(tui.top, fr); ManageChild(tui.top); } RaiseWindow(GetParent(tui.top)); unset_wait_cursor(); }
void create_fonttool(TextStructure *cstext_parent) { static fonttool_ui *ui = NULL; if (ui == NULL) { ui = xmalloc(sizeof(fonttool_ui)); memset(ui, 0, sizeof(fonttool_ui)); ui->fonttool_panel = CreateDialog(app_shell, "Font tool"); ui->font_select = CreateFontChoice(ui->fonttool_panel, "Font:"); FormAddVChild(ui->fonttool_panel, ui->font_select->menu); ui->font_table = CreateTable("fontTable", ui->fonttool_panel, FONT_TOOL_ROWS, FONT_TOOL_COLS, 8, 16); TableFontInit(ui->font_table); TableSetDefaultColWidth(ui->font_table, 2); TableSetDefaultColAlignment(ui->font_table, ALIGN_BEGINNING); TableUpdateVisibleRowsCols(ui->font_table); AddTableDrawCellCB(ui->font_table, DrawCB, ui); AddTableEnterCellCB(ui->font_table, EnterCB, ui); AddOptionChoiceCB(ui->font_select, update_fonttool_cb, ui); FormAddVChild(ui->fonttool_panel, ui->font_table); ui->cstext = CreateCSText(ui->fonttool_panel, "CString:"); AddTextValidateCB(ui->cstext, EditStringCB, ui); ui->aac_buts = CreateAACDialog(ui->fonttool_panel, ui->cstext->form, fonttool_aac_cb, ui); FormFixateVChild(ui->cstext->form); update_fonttool_cb(NULL, 0, ui); } if (cstext_parent == ui->cstext) { /* avoid recursion */ return; } ui->cstext_parent = cstext_parent; if (ui->cstext_parent == NULL) { TextSetString(ui->cstext, ""); WidgetSetSensitive(ui->aac_buts[0], FALSE); WidgetSetSensitive(ui->aac_buts[1], FALSE); } else { char *s = TextGetString(ui->cstext_parent); int pos = TextGetCursorPos(ui->cstext_parent); TextSetString(ui->cstext, s); TextSetCursorPos(ui->cstext, pos); xfree(s); WidgetSetSensitive(ui->aac_buts[0], TRUE); WidgetSetSensitive(ui->aac_buts[1], TRUE); } DialogRaise(ui->fonttool_panel); }