void Screen_Base::CreateMenuItems(int numitems, MenuItemDefinition* menuitems) { for( int i=0; i<numitems; i++ ) { switch( menuitems[i].type ) { case MIT_Sprite: { MenuSprite* pMenuSprite = CreateMenuSprite( i ); pMenuSprite->SetName( menuitems[i].name ); MySprite* pSprite = g_pGame->m_pResources->m_pSprites[menuitems[i].spriteindex]; pMenuSprite->SetSprites( pSprite, pSprite ); pMenuSprite->m_BGColor = menuitems[i].BGColor; } break; case MIT_Text: { MenuText* pText = CreateMenuText( i, menuitems[i].maxletters ); pText->SetName( menuitems[i].name ); pText->m_pFont = menuitems[i].font; if( menuitems[i].string1 ) pText->SetString( menuitems[i].string1 ); } break; case MIT_Button: { MenuButton* pButton = CreateMenuButton( i, menuitems[i].maxletters ); pButton->SetName( menuitems[i].name ); MySprite* pSprite = g_pGame->m_pResources->m_pSprites[menuitems[i].spriteindex]; pButton->SetSprites( pSprite, pSprite, pSprite, 0, pSprite ); pButton->m_BGColor = menuitems[i].BGColor; pButton->m_pFont = menuitems[i].font; if( menuitems[i].string1 || menuitems[i].string2 || menuitems[i].string3 ) pButton->SetString( menuitems[i].string1, menuitems[i].string2, menuitems[i].string3 ); pButton->m_ButtonAction = menuitems[i].buttonaction; } break; case MIT_Base: case MIT_InputBox: case MIT_ScrollingText: case MIT_ScrollBox: case MIT_CheckBox: case MIT_NumMenuItemTypes: break; } } }
static Widget CreatePulldown(char* name, char mnemonic, Widget parent, menu_info *info, WidgetList array, Cardinal size) { int i; Widget cascade_button, pulldown; Arg args[10]; char buffer[128]; sprintf(buffer,"%s_pulldown", name); pulldown = XmCreatePulldownMenu(parent, buffer, NULL, 0); i = 0; if (mnemonic != 0) { XtSetArg(args[i], XmNmnemonic, mnemonic); i++; } XtSetArg(args[i], XmNsubMenuId, pulldown); i++; cascade_button = XmCreateCascadeButtonGadget(parent, name, args, i); XtManageChild(cascade_button); if (strcmp(name, "Help") == 0) XtVaSetValues(parent, XmNmenuHelpWidget, cascade_button, NULL, NULL); /* Create menu items, special exception for the first item in the View menu, which is a cascadebutton*/ for(i = 0; i < size; i++) { if (info[i].is_separator) array[i] = XmCreateSeparatorGadget(pulldown, info[i].label, NULL, 0); else array[i] = CreateMenuButton(pulldown, info[i].label, info[i].mnemonic, info[i].accelerator, info[i].acc_text, (info != view_pulldown && i != 0) ? xmPushButtonGadgetClass : xmCascadeButtonGadgetClass ); if (info[i].managed) XtManageChild(array[i]); } return(pulldown); }
void create_datasetop_popup(Widget but, void *data) { Widget dialog, menubar, menupane, rc; set_wait_cursor(); if (datasetopui.top == NULL) { datasetopui.top = CreateDialogForm(app_shell, "Data set operations"); SetDialogFormResizable(datasetopui.top, TRUE); menubar = CreateMenuBar(datasetopui.top); ManageChild(menubar); AddDialogFormChild(datasetopui.top, menubar); dialog = CreateVContainer(datasetopui.top); #ifdef MOTIF_GUI XtVaSetValues(dialog, XmNrecomputeSize, True, NULL); #endif datasetopui.sel = CreateSSDChoice(dialog, "Data sets:", LIST_TYPE_MULTIPLE); menupane = CreateMenu(menubar, "File", 'F', FALSE); CreateMenuButton(menupane, "Close", 'C', destroy_dialog_cb, GetParent(datasetopui.top)); menupane = CreateMenu(menubar, "Help", 'H', TRUE); CreateMenuHelpButton(menupane, "On dataset operations", 's', datasetopui.top, "doc/UsersGuide.html#data-set-operations"); datasetopui.optype_item = CreateOptionChoiceVA(dialog, "Operation type:", "Reverse", DATASETOP_REVERSE, "Transpose", DATASETOP_TRANSPOSE, "Coalesce", DATASETOP_COALESCE, #if 0 "Sort", DATASETOP_SORT, "Split", DATASETOP_SPLIT, #endif "Drop rows", DATASETOP_DROP, NULL); AddOptionChoiceCB(datasetopui.optype_item, datasetoptypeCB, NULL); rc = CreateHContainer(dialog); #ifdef MOTIF_GUI XtVaSetValues(rc, XmNrecomputeSize, True, NULL); #endif /* Sort */ datasetopui.up_down_item = CreateOptionChoiceVA(rc, "Order:", "Ascending", FALSE, "Descending", TRUE, NULL); datasettype_controls[0] = rc; /* Reverse */ rc = CreateVContainer(dialog); CreateSeparator(rc); datasettype_controls[1] = rc; /* Transpose */ rc = CreateVContainer(dialog); CreateSeparator(rc); datasettype_controls[2] = rc; /* Coalesce */ rc = CreateVContainer(dialog); CreateSeparator(rc); datasettype_controls[3] = rc; /* Split */ rc = CreateVContainer(dialog); datasetopui.length_item = CreateTextItem(rc, 6, "Length:"); datasettype_controls[4] = rc; /* Drop rows */ rc = CreateHContainer(dialog); datasetopui.start_item = CreateTextItem(rc, 6, "Start at:"); datasetopui.stop_item = CreateTextItem(rc, 6, "Stop at:"); datasettype_controls[5] = rc; UnmanageChild(datasettype_controls[0]); ManageChild(datasettype_controls[1]); UnmanageChild(datasettype_controls[2]); UnmanageChild(datasettype_controls[3]); UnmanageChild(datasettype_controls[4]); UnmanageChild(datasettype_controls[5]); CreateAACDialog(datasetopui.top, dialog, datasetop_aac_cb, &datasetopui); } RaiseWindow(GetParent(datasetopui.top)); unset_wait_cursor(); }
SSDataUI *create_ssd_ui(ExplorerUI *eui) { SSDataUI *ui; Widget tab, fr, rc, rc1, wbut; ui = xmalloc(sizeof(SSDataUI)); if (!ui) { return NULL; } memset(ui, 0, sizeof(SSDataUI)); /* ------------ Tabs -------------- */ tab = CreateTab(eui->scrolled_window); AddHelpCB(tab, "doc/UsersGuide.html#ssd-properties"); ui->top = tab; /* ------------ Main tab -------------- */ ui->main_tp = CreateTabPage(tab, "Data"); ui->mw = CreateTable("SSD", ui->main_tp, EXTRA_SS_ROWS, EXTRA_SS_COLS, VISIBLE_SS_ROWS, VISIBLE_SS_COLS); TableSSDInit(ui->mw); TableSetDefaultColWidth(ui->mw, CELL_WIDTH); TableSetDefaultColLabelAlignment(ui->mw, ALIGN_CENTER); AddTableDrawCellCB(ui->mw, drawcellCB, ui); AddTableLeaveCellCB(ui->mw, leaveCB, ui); AddTableEnterCellCB(ui->mw, enterCB, ui); AddTableLabelActivateCB(ui->mw, labelCB, ui); ui->popup = CreatePopupMenu(ui->mw); ui->delete_btn = CreateMenuButton(ui->popup, "Delete column", '\0', col_delete_cb, ui); ui->index_btn = CreateMenuButton(ui->popup, "Set as index", '\0', index_cb, ui); ui->unindex_btn = CreateMenuButton(ui->popup, "Unset index", '\0', unindex_cb, ui); /* ------------ Column props -------------- */ ui->column_tp = CreateTabPage(tab, "Columns"); ui->col_sel = CreateColChoice(ui->column_tp, "Column:", LIST_TYPE_SINGLE); AddListChoiceCB(ui->col_sel, col_cb, ui); ui->col_label = CreateCSText(ui->column_tp, "Label:"); SetSensitive(ui->col_label->text, FALSE); AddTextInputCB(ui->col_label, text_explorer_cb, eui); /* ------------ Hotlink tab -------------- */ ui->hotlink_tp = CreateTabPage(tab, "Hotlink"); fr = CreateFrame(ui->hotlink_tp, "Hotlink"); rc = CreateVContainer(fr); rc1 = CreateHContainer(rc); ui->hotlink = CreateToggleButton(rc1, "Enabled"); ui->hotsrc = CreateOptionChoiceVA(rc1, "Source type:", "Disk", SOURCE_DISK, "Pipe", SOURCE_PIPE, NULL); rc1 = CreateHContainer(rc); ui->hotfile = CreateTextItem(rc1, 20, "File name:"); wbut = CreateButton(rc1, "Browse..."); AddButtonCB(wbut, create_hotfiles_popup, ui); return ui; }
void raise_explorer(GUI *gui, Quark *q) { GraceApp *gapp = gui->P; set_wait_cursor(); if (!gui->eui) { ExplorerUI *eui; Widget menubar, menupane, panel, form, fr; eui = xmalloc(sizeof(ExplorerUI)); gui->eui = eui; eui->a_icon = XpmToPixmap(active_xpm); eui->h_icon = XpmToPixmap(hidden_xpm); eui->top = CreateDialog(app_shell, "Explorer"); menubar = CreateMenuBar(eui->top); WidgetManage(menubar); FormAddVChild(eui->top, menubar); menupane = CreateMenu(menubar, "File", 'F', FALSE); CreateMenuButtonA(menupane, "Close", 'C', "<Key>Escape", "Esc", destroy_dialog_cb, eui->top); menupane = CreateMenu(menubar, "Edit", 'E', FALSE); eui->edit_undo_bt = CreateMenuButtonA(menupane, "Undo", 'U', "Ctrl<Key>z", "Ctrl+Z", undo_cb, gapp); eui->edit_redo_bt = CreateMenuButtonA(menupane, "Redo", 'R', "Ctrl Shift<Key>z", "Ctrl+Shift+Z", redo_cb, gapp); menupane = CreateMenu(menubar, "Insert", 'I', FALSE); eui->insert_frame_bt = CreateMenuButton(menupane, "Frame", '\0', add_frame_cb, eui); WidgetSetSensitive(eui->insert_frame_bt, FALSE); eui->insert_graph_bt = CreateMenuButton(menupane, "Graph", '\0', add_graph_cb, eui); WidgetSetSensitive(eui->insert_graph_bt, FALSE); eui->insert_ssd_bt = CreateMenuButton(menupane, "SSData", '\0', add_ssd_cb, eui); WidgetSetSensitive(eui->insert_ssd_bt, FALSE); eui->insert_set_bt = CreateMenuButton(menupane, "Set", '\0', add_set_cb, eui); WidgetSetSensitive(eui->insert_set_bt, FALSE); eui->insert_axisgrid_bt = CreateMenuButton(menupane, "Axis grid", '\0', add_axisgrid_cb, eui); WidgetSetSensitive(eui->insert_axisgrid_bt, FALSE); eui->insert_axis_bt = CreateMenuButton(menupane, "Axis", '\0', add_axis_cb, eui); WidgetSetSensitive(eui->insert_axis_bt, FALSE); eui->insert_object_pane = CreateMenu(menupane, "Annotating objects", 'o', FALSE); WidgetSetSensitive(eui->insert_object_pane, FALSE); eui->insert_text_bt = CreateMenuButton(eui->insert_object_pane, "Text", '\0', add_object_cb, eui); eui->insert_line_bt = CreateMenuButton(eui->insert_object_pane, "Line", '\0', add_object_cb, eui); eui->insert_box_bt = CreateMenuButton(eui->insert_object_pane, "Box", '\0', add_object_cb, eui); eui->insert_arc_bt = CreateMenuButton(eui->insert_object_pane, "Arc", '\0', add_object_cb, eui); menupane = CreateMenu(menubar, "Options", 'O', FALSE); eui->instantupdate = CreateMenuToggle(menupane, "Instantaneous update", 'u', NULL, NULL); ToggleButtonSetState(eui->instantupdate, gui->instant_update); menupane = CreateMenu(menubar, "Help", 'H', TRUE); CreateMenuHelpButton(menupane, "On explorer", 'e', eui->top, "doc/UsersGuide.html#explorer"); panel = CreatePanedWindow(eui->top); form = CreateForm(panel); PlaceGridChild(panel, form, 0, 0); /* in case if CreatePanedWindow creates a grid */ eui->tree = CreateTree(form); AddTreeHighlightItemsCB(eui->tree, highlight_cb, eui); AddTreeContextMenuCB(eui->tree, menu_cb, eui); AddTreeDropItemsCB(eui->tree, drop_cb, eui); FormAddVChild(form, eui->tree); fr = CreateFrame(form, NULL); eui->idstr = CreateText(fr, "ID string:"); AddTextActivateCB(eui->idstr, text_explorer_cb, eui); FormAddVChild(form, fr); FormFixateVChild(fr); eui->scrolled_window = CreateScrolledWindow(panel); PlaceGridChild(panel, eui->scrolled_window, 1, 0); /* in case if CreatePanedWindow creates a grid */ PanedWindowSetMinWidth(form, 150); WidgetSetWidth(form, 250); WidgetManage(form); #ifdef HAVE_LESSTIF # if !defined(SF_BUG_993209_FIXED) && !defined(SF_BUG_993209_NOT_FIXED) # error "You should check whether SF bug #993209 is fixed in your version of LessTif." # error "Then define either SF_BUG_993209_FIXED or SF_BUG_993209_NOT_FIXED, accordingly." # error "See http://sourceforge.net/tracker/index.php?func=detail&aid=993209&group_id=8596&atid=108596." # endif # ifdef SF_BUG_993209_NOT_FIXED /* A dirty workaround */ eui->scrolled_window = CreateVContainer(eui->scrolled_window); # endif #endif eui->project_ui = create_project_ui(eui); WidgetUnmanage(eui->project_ui->top); eui->ssd_ui = create_ssd_ui(eui); WidgetUnmanage(eui->ssd_ui->top); eui->frame_ui = create_frame_ui(eui); WidgetUnmanage(eui->frame_ui->top); eui->graph_ui = create_graph_ui(eui); WidgetUnmanage(eui->graph_ui->top); eui->set_ui = create_set_ui(eui); WidgetUnmanage(eui->set_ui->top); eui->axisgrid_ui = create_axisgrid_ui(eui); WidgetUnmanage(eui->axisgrid_ui->top); eui->axis_ui = create_axis_ui(eui); WidgetUnmanage(eui->axis_ui->top); eui->object_ui = create_object_ui(eui); WidgetUnmanage(eui->object_ui->top); eui->atext_ui = create_atext_ui(eui); WidgetUnmanage(eui->atext_ui->top); eui->region_ui = create_region_ui(eui); WidgetUnmanage(eui->region_ui->top); eui->aacbuts = CreateAACDialog(eui->top, panel, explorer_aac, eui); WidgetManage(eui->tree); /* Menu popup */ eui->popup = CreatePopupMenu(eui->tree); eui->popup_hide_bt = CreateMenuButton(eui->popup, "Hide", '\0', hide_cb, eui); eui->popup_show_bt = CreateMenuButton(eui->popup, "Show", '\0', show_cb, eui); CreateMenuSeparator(eui->popup); eui->popup_delete_bt = CreateMenuButton(eui->popup, "Delete", '\0', delete_cb, eui); eui->popup_duplicate_bt = CreateMenuButton(eui->popup, "Duplicate", '\0', duplicate_cb, eui); /* Project menu popup */ eui->project_popup = CreatePopupMenu(eui->tree); eui->project_popup_show_bt = CreateMenuButton(eui->project_popup, "Show", '\0', project_show_cb, eui); CreateMenuSeparator(eui->project_popup); eui->project_popup_save_bt = CreateMenuButton(eui->project_popup, "Save", '\0', project_save_cb, eui); eui->project_popup_save_as_bt = CreateMenuButton(eui->project_popup, "Save as...", '\0', project_save_as_cb, eui); eui->project_popup_revert_to_saved_bt = CreateMenuButton(eui->project_popup, "Revert to saved", '\0', project_revert_to_saved_cb, eui); CreateMenuSeparator(eui->project_popup); eui->project_popup_close_bt = CreateMenuButton(eui->project_popup, "Close", '\0', project_close_cb, eui); init_quark_tree(eui); if (!q && gapp->gp) { select_quark_explorer(gproject_get_top(gapp->gp)); } } #ifdef QT_GUI /* TODO: use resources */ WidgetSetSize(gui->eui->top, 650, 600); #endif DialogRaise(gui->eui->top); if (q) { select_quark_explorer(q); } update_undo_buttons(gapp->gp); unset_wait_cursor(); }
/********************************************************************************** * FUNCTIONS **********************************************************************************/ int video_open(PLOT *plot) { struct videodata *plotdata; Display *dpy; Screen *scr; Widget w, mw, m0, m1, m2, m3; int status = SUCCESS; Dimension width, height; int depth; XGCValues values; unsigned long foreground, background; XmString xmstr, xmstr1; Arg args[10]; int n; plot->plotdata = (void *)calloc(1, sizeof(struct videodata)); plotdata = (struct videodata *)plot->plotdata; plotdata->image = (XImage *)calloc(sizeof(XImage), 1); plotdata->framedata = NULL; plotdata->width = 0; plotdata->height = 0; plotdata->ncomps = 0; plotdata->microsecs_per_frame = 0; plotdata->colormap = defaults.colormap; plotdata->framenum = 0; plotdata->loadedframenum = -1; plot->plot_widget = XtVaCreateManagedWidget("video", xmDrawingAreaWidgetClass, plot->panel->panel_container, XmNheight, defaults.video_height, XmNwidth, defaults.width, XmNmarginHeight, 0, XmNmarginWidth, 0, NULL); XtAddCallback(plot->plot_widget, XmNexposeCallback, video_expose_callback, (XtPointer)plot); XtAddCallback(plot->plot_widget, XmNresizeCallback, video_resize_callback, (XtPointer)plot); w = (Widget)plot->plot_widget; dpy = XtDisplay(w); scr = XtScreen(w); XtVaGetValues(w, XmNheight, &height, XmNwidth, &width, XmNdepth, &depth, XmNforeground, &foreground, XmNbackground, &background, NULL); /* ** Get the font; also, calculate the margins for the axes (this depends on the font size!). ** Store these margins for use later (we might start off without axes, and turn them on later. */ plot->ticklblfont = XmFontListCopy(_XmGetDefaultFontList(w, XmLABEL_FONTLIST)); plot->minoffx = 6 + XmStringWidth(plot->ticklblfont, xmstr = XmStringCreateSimple("-32768")); XmStringFree(xmstr); plot->minoffx2 = 0; plot->minoffy = 0; plot->minoffy2 = 6 + XmStringHeight(plot->ticklblfont, xmstr = XmStringCreateSimple("1")); XmStringFree(xmstr); plot->offx = 0; plot->offy = 0; plot->offx2 = 0; plot->offy2 = 0; plot->width = width; plot->height = height; plot->depth = depth; /* ** Allocate our colors. We use the XCC code that is: ** Copyright 1994,1995 John L. Cwikla ** This allows us to work on any visual, etc. The danger is that ** we may not get the exact colors we ask for... meaning that things ** may not really be as we see them. This is unfortunate, but the ** alternative is to not run at all (the old code crashed). So... */ plotdata->ncolors = MIN(SONO_DEFAULT_MAX_COLORS, MIN(XDisplayCells(dpy, XDefaultScreen(dpy)), MAXCOLORS - RESERVED_COLORS)); plotdata->xcc = XCCCreate(dpy, DefaultVisual(dpy, DefaultScreen(dpy)), TRUE, TRUE, XA_RGB_GRAY_MAP, &(plotdata->cmap)); if (XCCGetNumColors(plotdata->xcc) < plotdata->ncolors) { plotdata->ncolors = XCCGetNumColors(plotdata->xcc); printf("Warning. Using only %d colors.\n", plotdata->ncolors); } (*((colormap[plotdata->colormap]).cmap))(dpy, plotdata->ncolors, plotdata->colors, NULL); /* ** Create the Graphics contexts. ** drawing_GC is for the picture itself. inverse_GC is for erasing. mark_GC is for the subregion marks. */ values.font = getFontStruct(plot->ticklblfont)->fid; values.function = GXcopy; values.plane_mask = AllPlanes; values.foreground = foreground; values.background = background; plotdata->drawing_GC = XtGetGC(w, GCFunction | GCPlaneMask | GCForeground | GCBackground | GCFont, &values); values.foreground = background; values.background = background; plotdata->inverse_GC = XtGetGC(w, GCForeground | GCBackground, &values); values.function = GXxor; values.plane_mask = foreground ^ background; values.foreground = 0xffffffff; values.background = 0x0; values.line_style = LineSolid; plotdata->mark_GC = XtGetGC(w, GCFunction | GCPlaneMask | GCForeground | GCBackground | GCLineStyle, &values); plotdata->pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), width, height, depth); plotdata->pixmapalloced = TRUE; XFillRectangle(dpy, plotdata->pixmap, plotdata->inverse_GC, 0, 0, width, height); /* ** Create the popup menu ** */ n = 0; XtSetArg(args[n], XmNmenuPost, "<Btn3Down>"); n++; mw = plot->plot_popupmenu_widget = XmCreatePopupMenu(w, "popupmenu", args, n); m0 = XtVaCreateManagedWidget("m0", xmLabelGadgetClass, mw, XmNlabelString, xmstr1 = XmStringCreateSimple("Options"), NULL); XmStringFree(xmstr1); m1 = XtVaCreateManagedWidget("m1", xmSeparatorGadgetClass, mw, NULL); CreateMenuButton(m2, mw, "save", "Save", "Save"); CreateMenuButton(m3, mw, "print", "Print EPS", "Print EPS"); /* ** Register an event handler */ XtAddEventHandler(w, KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask, FALSE, (XtEventHandler) video_event_handler, (XtPointer)plot); plot->plot_display = video_display; plot->plot_set = video_set; plot->plot_close = video_close; plot->plot_print = video_print; plot->plot_playmarker = NULL; plot->plot_showvideoframe = video_showvideoframe; plot->plot_clearmarks = NULL; plot->plot_drawstartmark = NULL; plot->plot_drawstopmark = NULL; plot->plot_conv_pixel_to_time = NULL; plot->plot_save = video_save; plot->plot_event_handler = video_event_handler; plot->plot_play = video_play; plotdata->butgrabbed = FALSE; plot->playmark = -1; plot->markx1 = -1; plot->markx2 = -1; plot->group->needpcm = 1; return status; }
void Screen_Pause::Init() { Screen_Base::Init(); for( int i=0; i<m_MenuItemsNeeded; i++ ) CreateMenuButton( i ); float fontheight = 30; for( int i=0; i<m_MenuItemsNeeded; i++ ) { MenuButton* pButton = GetMenuButton( i ); MySprite* pWhiteSquare = g_pGame->m_pResources->m_pSprites[SL_WhiteSquare]; MaterialDefinition* pMatGray = g_pMaterialManager->LoadMaterial( "Data/Materials/Gray.mymaterial" ); MaterialDefinition* pMatDarkGray = g_pMaterialManager->LoadMaterial( "Data/Materials/DarkGray.mymaterial" ); MaterialDefinition* pMatShadow = g_pMaterialManager->LoadMaterial( "Data/Materials/Shadow.mymaterial" ); pButton->SetMaterial( MenuButton::Material_BG, pMatGray ); pButton->SetMaterial( MenuButton::Material_BGDisabled, pMatGray ); pButton->SetMaterial( MenuButton::Material_BGOverlay, pMatGray ); pButton->SetMaterial( MenuButton::Material_BGPressed, pMatDarkGray ); pButton->SetMaterial( MenuButton::Material_Shadow, pMatShadow ); pMatGray->Release(); pMatDarkGray->Release(); pMatShadow->Release(); float yspace = fontheight * 2 * 2; //pButton->m_pFont = g_pGame->m_pResources->m_pGBResources->m_pFontArial48; //pButton->m_Style = MBTS_SingleLine; pButton->m_FontHeight = fontheight; pButton->SetTextShadow( 3.0f, -3.0f ); pButton->SetPositionAndSize( 320.0f, 576.0f - i*yspace, g_pGame->m_GameWidth, 77 ); pButton->m_InputWidth = g_pGame->m_GameWidth; pButton->m_InputHeight = yspace; pButton->SetBGShadow( 0.0f, 6.0f ); pButton->m_TextColor = GameMenuButtonColors[MBCT_SelectableText]; pButton->m_BGColor = GameMenuButtonColors[MBCT_SelectableBG]; pButton->m_DisabledBGColor = GameMenuButtonColors[MBCT_DisabledBG]; pButton->m_DisabledTextColor = GameMenuButtonColors[MBCT_DisabledBG]; } int i = 0; if( 0 ) //g_pGame->m_GBGameType != GBType_Options ) { GetMenuButton( i )->SetString( "Resume" ); GetMenuButton( i )->m_ButtonAction[0] = (int)PMA_Resume; i++; } GetMenuButton( i )->SetString( "Achievements" ); GetMenuButton( i )->m_ButtonAction[0] = (int)PMA_Achievements; i++; GetMenuButton( i )->SetString( "Stats" ); GetMenuButton( i )->m_ButtonAction[0] = (int)PMA_Stats; i++; if( 0 ) //g_pGame->m_GBGameType == GBType_WordPuzzle && g_pGame->m_OnlineMode == false ) { GetMenuButton( i )->SetString( "Level select" ); GetMenuButton( i )->m_ButtonAction[0] = (int)PMA_LevelSelect; i++; } GetMenuButton( i )->SetString( "How to Play" ); GetMenuButton( i )->m_ButtonAction[0] = (int)PMA_HowToPlay; i++; GetMenuButton( i )->SetString( "Back to main menu" ); GetMenuButton( i )->m_ButtonAction[0] = (int)PMA_MainMenu; i++; }
/* ARGSUSED */ void create_nonl_frame(Widget w, XtPointer client_data, XtPointer call_data) { int i; Widget sw, fr, title_fr, fr1, fr3, rc, rc1, rc2, rc3, lab, fitbut[4], but1[2]; Widget menubar, menupane, submenupane, cascade; set_wait_cursor(); if (nonl_frame == NULL) { char *fitlabel[4]; char *blabel[2]; fitlabel[0] = "Load as is"; fitlabel[1] = "Run 5 steps"; fitlabel[2] = "Run 20 steps"; fitlabel[3] = "Run 100 steps"; blabel[0] = "Accept"; blabel[1] = "Cancel"; nonl_frame = XmCreateDialogShell(app_shell, "Non-linear curve fitting", NULL, 0); handle_close(nonl_frame); nonl_panel = XmCreateForm(nonl_frame, "nonl_frame_rc", NULL, 0); menubar = CreateMenuBar(nonl_panel, "nonlMenuBar", NULL); menupane = CreateMenu(menubar, "nonlFileMenu", "File", 'F', NULL, NULL); CreateMenuButton(menupane, "open", "Open...", 'O', (XtCallbackProc) create_openfit_popup, (XtPointer) NULL, NULL); CreateMenuButton(menupane, "save", "Save...", 'S', (XtCallbackProc) create_savefit_popup, (XtPointer) NULL, NULL); CreateMenuSeparator(menupane, "sep1"); CreateMenuButton(menupane, "close", "Close", 'C', (XtCallbackProc) destroy_nonl_frame, (XtPointer) NONL_ACCEPT, NULL); menupane = CreateMenu(menubar, "nonlDataMenu", "Data", 'D', NULL, NULL); CreateMenuButton(menupane, "reset", "Reset", 'R', (XtCallbackProc) reset_nonl_frame, (XtPointer) NULL, 0); CreateMenuButton(menupane, "update", "Update", 'U', (XtCallbackProc) update_nonl_frame, (XtPointer) NULL, 0); menupane = CreateMenu(menubar, "nonlOptionsMenu", "Options", 'O', NULL, NULL); submenupane = CreateMenu(menupane, "nonlLoadMenu", "Load", 'L', NULL, NULL); nonl_load_item[0] = CreateMenuToggle(submenupane, "values", "Fitted values", 'v', (XtCallbackProc) do_nonl_toggle, (XtPointer) 0, NULL); nonl_load_item[1] = CreateMenuToggle(submenupane, "residuals", "Residuals", 'R', (XtCallbackProc) do_nonl_toggle, (XtPointer) 1, NULL); nonl_load_item[2] = CreateMenuToggle(submenupane, "function", "Function", 'F', (XtCallbackProc) do_nonl_toggle, (XtPointer) 2, NULL); nonl_autol_item = CreateMenuToggle(menupane, "autoload", "Autoload", 'A', (XtCallbackProc) NULL, (XtPointer) NULL, NULL); menupane = CreateMenu(menubar, "nonlHelpMenu", "Help", 'H', &cascade, NULL); XtVaSetValues(menubar, XmNmenuHelpWidget, cascade, NULL); CreateMenuButton(menupane, "onFit", "On fit", 'f', (XtCallbackProc) HelpCB, (XtPointer) "trans.html#nlcurve", 0); CreateMenuButton(menupane, "onContext", "On context", 'x', (XtCallbackProc) ContextHelpCB, (XtPointer) NULL, 0); XtManageChild(menubar); XtVaSetValues(menubar, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL); fr1 = XmCreateFrame(nonl_panel, "nonl_frame", NULL, 0); nonl_set_item = CreateSetSelector(fr1, "Apply to set:", SET_SELECT_ACTIVE, FILTER_SELECT_NONE, GRAPH_SELECT_CURRENT, SELECTION_TYPE_SINGLE); XtManageChild(fr1); XtVaSetValues(fr1, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, menubar, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL); fr = XmCreateFrame(nonl_panel, "nonl_frame", NULL, 0); rc = XmCreateRowColumn(fr, "nonl_rc", NULL, 0); title_fr = XmCreateFrame(rc, "nonl_title_frame", NULL, 0); XtVaSetValues(title_fr, XmNshadowType, XmSHADOW_ETCHED_OUT, NULL); nonl_title_item = XmCreateLabel(title_fr, nonl_opts.title, NULL, 0); XtManageChild(nonl_title_item); XtManageChild(title_fr); nonl_formula_item = (Widget) CreateTextItem2(rc, 35, "Formula:"); rc1 = XmCreateRowColumn(rc, "nonl_rc", NULL, 0); XtVaSetValues(rc1, XmNorientation, XmHORIZONTAL, NULL); nonl_nparm_item = CreatePanelChoice(rc1, "Number of parameters:", 12, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", NULL, NULL); for (i = 0; i < MAXPARM + 1; i++) { XtAddCallback(nonl_nparm_item[2 + i], XmNactivateCallback, (XtCallbackProc) do_nparm_toggle, (XtPointer) i); } nonl_tol_item = CreateTextItem2(rc1, 10, "Tolerance:"); XtManageChild(rc1); sw = XtVaCreateManagedWidget("sw", xmScrolledWindowWidgetClass, rc, XmNheight, 180, XmNscrollingPolicy, XmAUTOMATIC, NULL); rc2 = XmCreateRowColumn(sw, "rc2", NULL, 0); for (i = 0; i < MAXPARM; i++) { nonl_parm_item[i] = XmCreateRowColumn(rc2, "rc1", NULL, 0); XtVaSetValues(nonl_parm_item[i], XmNorientation, XmHORIZONTAL, NULL); sprintf(buf, "A%1d: ", i); nonl_value_item[i] = CreateTextItem2(nonl_parm_item[i], 10, buf); nonl_constr_item[i] = XmCreateToggleButton(nonl_parm_item[i], "Bounds:", NULL, 0); XtAddCallback(nonl_constr_item[i], XmNvalueChangedCallback, (XtCallbackProc) do_constr_toggle, (XtPointer) i); XtManageChild(nonl_constr_item[i]); nonl_lowb_item[i] = CreateTextItem2(nonl_parm_item[i], 6, ""); sprintf(buf, "< A%1d < ", i); lab = XmCreateLabel(nonl_parm_item[i], buf, NULL, 0); XtManageChild(lab); nonl_uppb_item[i] = CreateTextItem2(nonl_parm_item[i], 6, ""); XtManageChild(nonl_parm_item[i]); } XtManageChild(rc2); XtManageChild(rc); XtManageChild(fr); XtVaSetValues(fr, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, fr1, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL); fr3 = XmCreateFrame(nonl_panel, "nonl_frame", NULL, 0); rc3 = XmCreateRowColumn(fr3, "rc3", NULL, 0); CreateCommandButtons(rc3, 4, fitbut, fitlabel); XtAddCallback(fitbut[0], XmNactivateCallback, (XtCallbackProc) do_nonl_proc, (XtPointer) (0)); XtAddCallback(fitbut[1], XmNactivateCallback, (XtCallbackProc) do_nonl_proc, (XtPointer) (5)); XtAddCallback(fitbut[2], XmNactivateCallback, (XtCallbackProc) do_nonl_proc, (XtPointer) (20)); XtAddCallback(fitbut[3], XmNactivateCallback, (XtCallbackProc) do_nonl_proc, (XtPointer) (100)); XtVaCreateManagedWidget("sep", xmSeparatorWidgetClass, rc3, NULL); nonl_fload_rc = XmCreateRowColumn(rc3, "nonl_fload_rc", NULL, 0); XtVaSetValues(nonl_fload_rc, XmNorientation, XmHORIZONTAL, NULL); nonl_start_item = CreateTextItem2(nonl_fload_rc, 6, "Start load at:"); nonl_stop_item = CreateTextItem2(nonl_fload_rc, 6, "Stop load at:"); nonl_npts_item = CreateTextItem2(nonl_fload_rc, 4, "# of points:"); XtManageChild(nonl_fload_rc); XtSetSensitive(nonl_fload_rc, False); CreateCommandButtons(rc3, 2, but1, blabel); XtAddCallback(but1[0], XmNactivateCallback, (XtCallbackProc) destroy_nonl_frame, (XtPointer) NONL_ACCEPT); XtAddCallback(but1[1], XmNactivateCallback, (XtCallbackProc) destroy_nonl_frame, (XtPointer) NONL_CANCEL); XtManageChild(rc3); XtManageChild(fr3); XtVaSetValues(fr3, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, fr, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); XtManageChild(nonl_panel); } update_nonl_frame(); XtRaise(nonl_frame); unset_wait_cursor(); }