static void FileMenu_BootMode(AG_Event *event) { AG_Menu *self = (AG_Menu *)AG_SELF(); AG_MenuItem *item = (AG_MenuItem *)AG_SENDER(); AG_Window *w; AG_Button *btn[3]; AG_Box *box; AG_Box *box2; char *label; AG_Label *lbl; w = AG_WindowNew(AG_WINDOW_NOMINIMIZE | AG_WINDOW_NOMAXIMIZE | FILEDIALOG_WINDOW_DEFAULT); AG_WindowSetMinSize(w, 230, 80); label = gettext("Select mode (Notice: If select , reboot.)"); AG_WindowSetMinSize(w, 230, 80); box = AG_BoxNewHorizNS(w, AG_BOX_HFILL); AG_WidgetSetSize(box, 230, 32); lbl = AG_LabelNew(AGWIDGET(box), AG_LABEL_EXPAND, "%s", label); box = AG_BoxNewVert(w, AG_BOX_HFILL); AG_WidgetSetSize(box, 230, 32); box2 = AG_BoxNewHoriz(box, 0); btn[0] = AG_ButtonNewFn (AGWIDGET(box2), 0, gettext("BASIC"), SetBootMode, "%i", FALSE); box2 = AG_BoxNewVert(box, 0); btn[1] = AG_ButtonNewFn (AGWIDGET(box2), 0, gettext("DOS"), SetBootMode, "%i", TRUE); box2 = AG_BoxNewVert(box, 0); btn[2] = AG_ButtonNewFn (AGWIDGET(box2), 0, gettext("Cancel"), OnPushCancel, NULL); AG_ActionFn(AGWIDGET(w), "window-close", OnPushCancel, NULL); AG_WindowSetCaption(w, gettext("Boot Mode")); AG_WindowShow(w); }
static void SoundMenu(AG_NotebookTab *parent, struct gui_sound *cfg) { AG_Radio *radio; AG_Checkbox *check; AG_Numerical *num; AG_Label *lbl; AG_Box *box; AG_Box *box2; int i; for(i = 0; i < 6 ; i++) { if(cfg->nSampleRate == SampleRates[i]) break; } if(i > 6) i = 6; box = AG_BoxNewVert(AGWIDGET(parent), AG_BOX_VFILL); { lbl = AG_LabelNew(AGWIDGET(box), 0, "%s", gettext("Sample Rate")); radio = AG_RadioNewFn(AGWIDGET(box), 0, SampleRateName, OnChangeSampleRate, "%p", cfg); AG_SetInt(radio, "value", i); box = AG_BoxNewVert(AGWIDGET(parent), AG_BOX_HFILL); check = AG_CheckboxNewInt(AGWIDGET(box), AG_CHECKBOX_HFILL, gettext("HQ Rendering"), &(cfg->bFMHQmode)); } box = AG_BoxNewVert(AGWIDGET(parent), AG_BOX_VFILL); { num = AG_NumericalNewInt(AGWIDGET(box), AG_NUMERICAL_HFILL, gettext("Per Second") ,gettext("Sound Buffer"), &(cfg->nSoundBuffer)); AG_NumericalSetRangeInt(num, 30, 2000); AG_NumericalSetIncrement(num, 10.0); check = AG_CheckboxNewInt(AGWIDGET(box), AG_CHECKBOX_HFILL, gettext("Force Stereo"), &(cfg->nStereoOut)); check = AG_CheckboxNewInt(AGWIDGET(box), AG_CHECKBOX_HFILL, gettext("FDD Seek & Motor"), &(cfg->bFddSound)); check = AG_CheckboxNewInt(AGWIDGET(box), AG_CHECKBOX_HFILL, gettext("CMT Monitor"), &(cfg->bTapeMon)); } }
AG_Box *AGOL_About::CreateLicenseBox(void *parent) { AG_Box *lbox; AG_Textbox *text; lbox = AG_BoxNewVert(parent, AG_BOX_EXPAND); AG_LabelNewS(lbox, 0, "License"); lbox = AG_BoxNewHoriz(lbox, AG_BOX_EXPAND); AG_BoxSetPadding(lbox, 5); AG_BoxSetSpacing(lbox, 5); #if !AG_VERSION_ATLEAST(1,4,2) text = AG_TextboxNewS(lbox, AG_TEXTBOX_MULTILINE | AG_TEXTBOX_EXPAND, ""); #else text = AG_TextboxNewS(lbox, AG_TEXTBOX_READONLY | AG_TEXTBOX_MULTILINE | AG_TEXTBOX_EXPAND, ""); #endif AG_TextboxSetWordWrap(text, true); AG_TextboxSetString(text, license.c_str()); #if !AG_VERSION_ATLEAST(1,4,2) AG_SetEvent(text, "textbox-prechg", EventReceiver, "%p", RegisterEventHandler((EVENT_FUNC_PTR)&AGOL_About::OnLicensePrechg)); AG_SetEvent(text, "textbox-postchg", EventReceiver, "%p", RegisterEventHandler((EVENT_FUNC_PTR)&AGOL_About::OnLicensePostchg)); #else AG_TextboxSetCursorPos(text, 0); #endif return lbox; }
AG_Box *AGOL_About::CreateLicenseBox(void *parent) { AG_Box *lbox; AG_Textbox *text; lbox = AG_BoxNewVert(parent, AG_BOX_EXPAND); AG_LabelNewS(lbox, 0, "License"); lbox = AG_BoxNewHoriz(lbox, AG_BOX_EXPAND); AG_BoxSetPadding(lbox, 5); AG_BoxSetSpacing(lbox, 5); text = AG_TextboxNewS(lbox, AG_TEXTBOX_MULTILINE | AG_TEXTBOX_EXPAND, ""); AG_TextboxSetWordWrap(text, true); AG_TextboxSetString(text, "This program is free software; you can redistribute it" " and/or modify it under the terms of the GNU General" " Public License as published by the Free Software" " Foundation; either version 2 of the License, or (at your" " option) any later version.\n\n" "This program is distributed in the hope that it will be" " useful, but WITHOUT ANY WARRANTY; without even the" " implied warranty of MERCHANTABILITY or FITNESS FOR" " A PARTICULAR PURPOSE. See the GNU General Public" " License for more details."); return lbox; }
AG_Box *AGOL_Settings::CreateWadDirButtonBox(void *parent) { AG_Box *bbox; bbox = AG_BoxNewVert(parent, AG_BOX_VFILL); AG_ButtonNewFn(bbox, AG_BUTTON_HFILL, "Add", EventReceiver, "%p", RegisterEventHandler((EVENT_FUNC_PTR)&AGOL_Settings::OnAddWadDir)); AG_ButtonNewFn(bbox, AG_BUTTON_HFILL, "Replace", EventReceiver, "%p", RegisterEventHandler((EVENT_FUNC_PTR)&AGOL_Settings::OnReplaceWadDir)); AG_ButtonNewFn(bbox, AG_BUTTON_HFILL, "Delete", EventReceiver, "%p", RegisterEventHandler((EVENT_FUNC_PTR)&AGOL_Settings::OnDeleteWadDir)); AG_SeparatorNewHoriz(bbox); AG_ButtonNewFn(bbox, AG_BUTTON_HFILL, "Move Up", EventReceiver, "%p", RegisterEventHandler((EVENT_FUNC_PTR)&AGOL_Settings::OnMoveWadDirUp)); AG_ButtonNewFn(bbox, AG_BUTTON_HFILL, "Move Down", EventReceiver, "%p", RegisterEventHandler((EVENT_FUNC_PTR)&AGOL_Settings::OnMoveWadDirDown)); #ifndef GCONSOLE AG_SeparatorNewHoriz(bbox); AG_ButtonNew(bbox, AG_BUTTON_HFILL, "Get Environment"); #endif return bbox; }
static int TestGUI(void *obj, AG_Window *win) { AG_FileDlg *fd; AG_DirDlg *dd; AG_FileType *ft[3]; AG_Box *box; AG_Notebook *nb; AG_NotebookTab *ntab; int i; nb = AG_NotebookNew(win, AG_NOTEBOOK_EXPAND); ntab = AG_NotebookAdd(nb, "Load file", AG_BOX_VERT); { /* Create the file loader widget. */ fd = AG_FileDlgNew(ntab, AG_FILEDLG_EXPAND); /* Set some default directory. */ if (strcmp(DATADIR, "NONE") != 0) { AG_FileDlgSetDirectoryMRU(fd, "images-dir", DATADIR); } else { AG_FileDlgSetDirectoryMRU(fd, "images-dir", "."); } /* Set some default filename. */ AG_FileDlgSetFilenameS(fd, "agar.bmp"); /* * Register the loader functions. We can assign a set of user * specified options to specific types as well. */ ft[0] = AG_FileDlgAddType(fd, "Windows Bitmap", "*.bmp", LoadImage, "%p", win); ft[1] = AG_FileDlgAddType(fd, "JPEG image", "*.jpg,*.jpeg", LoadImage, "%p", win); ft[2] = AG_FileDlgAddType(fd, "Portable Network Graphics", "*.png", LoadImage, "%p", win); for (i = 0; i < 3; i++) AG_FileOptionNewBool(ft[i], "Inverted", "invert", 0); /* * As different file types are selected, FileDlg may create * widgets for type specific options. We specify where those * widgets will be created here. */ box = AG_BoxNewVert(ntab, AG_BOX_HFILL|AG_BOX_FRAME); AG_BoxSetPadding(box, 10); AG_FileDlgSetOptionContainer(fd, box); } ntab = AG_NotebookAdd(nb, "Select directory", AG_BOX_VERT); { /* Create the directory selector widget. */ dd = AG_DirDlgNew(ntab, AG_DIRDLG_EXPAND); /* Set some default directory. */ AG_DirDlgSetDirectoryMRU(dd, "images-dir", "./Images"); } AG_WindowSetPosition(win, AG_WINDOW_MIDDLE_LEFT, 0); return (0); }
static void * Edit(void *p, VG_View *vv) { VG_Circle *vc = p; AG_Box *box = AG_BoxNewVert(NULL, AG_BOX_EXPAND); AG_NumericalNewFlt(box, 0, NULL, _("Radius: "), &vc->r); return (box); }
ODA_GuiOptionsBox *AGOL_Settings::CreateGuiOptionsBox(void *parent) { char drvList[128]; AG_Box *vdbox; ODA_GuiOptionsBox *gbox = new ODA_GuiOptionsBox; gbox->optionsBox = AG_BoxNewVert(parent, AG_BOX_FRAME); AG_LabelNewS(gbox->optionsBox, 0, "Gui Options"); gbox->optionsBox = AG_BoxNewVert(gbox->optionsBox, AG_BOX_EXPAND); AG_BoxSetPadding(gbox->optionsBox, 5); AG_BoxSetSpacing(gbox->optionsBox, 5); // Video Driver Option vdbox = AG_BoxNewHoriz(gbox->optionsBox, AG_BOX_HFILL); AG_BoxSetPadding(vdbox, 0); AG_BoxSetSpacing(vdbox, 0); gbox->driverLabel = AG_LabelNewS(vdbox, 0, "Video Driver: "); gbox->driverCombo = AG_UComboNew(vdbox, AG_UCOMBO_HFILL); AG_UComboSizeHint(gbox->driverCombo, "XXXXXXXXXXXX", 3); AG_ListDriverNames(drvList, 128); if(strlen(drvList) > 0) { size_t oldpos = 0; size_t pos = 0; while(pos != string::npos) { AG_TlistItem *item; pos = string(drvList).find(' ', oldpos); item = AG_TlistAdd(gbox->driverCombo->list, NULL, string(drvList).substr(oldpos, pos - oldpos).c_str()); if(string(item->text) == string(agDriverOps->name)) AG_ButtonTextS(gbox->driverCombo->button, item->text); oldpos = pos + 1; } } // End - Video Driver Option return gbox; }
AG_Box *AGOL_Settings::CreateExtraCmdParamsBox(void *parent) { AG_Box *ecpbox; ecpbox = AG_BoxNewVert(parent, AG_BOX_HFILL | AG_BOX_FRAME); AG_LabelNewS(ecpbox, 0, "Extra command line arguments"); ecpbox = AG_BoxNewHoriz(ecpbox, AG_BOX_HFILL); AG_BoxSetPadding(ecpbox, 5); AG_BoxSetSpacing(ecpbox, 5); return ecpbox; }
AG_Box *AGOL_Settings::CreateWadDirConfigBox(void *parent) { AG_Box *wdbox; wdbox = AG_BoxNewVert(parent, AG_BOX_FRAME); AG_LabelNewS(wdbox, 0, "Wad Directories"); wdbox = AG_BoxNewHoriz(wdbox, 0); AG_BoxSetPadding(wdbox, 5); AG_BoxSetSpacing(wdbox, 5); return wdbox; }
AG_Box *AGOL_Settings::CreateOdamexPathBox(void *parent) { AG_Box *opbox; opbox = AG_BoxNewVert(parent, AG_BOX_HFILL | AG_BOX_FRAME); AG_LabelNewS(opbox, 0, "Odamex Path"); opbox = AG_BoxNewHoriz(opbox, AG_BOX_HFILL); AG_BoxSetPadding(opbox, 5); AG_BoxSetSpacing(opbox, 5); return opbox; }
static void * Edit(void *p, VG_View *vv) { VG_TextTool *t = p; AG_Box *box = AG_BoxNewVert(NULL, AG_BOX_EXPAND); AG_Textbox *tb; AG_LabelNew(box, 0, _("Text: ")); tb = AG_TextboxNewS(box, AG_TEXTBOX_MULTILINE|AG_TEXTBOX_HFILL, NULL); AG_TextboxBindUTF8(tb, t->text, sizeof(t->text)); return (box); }
ODA_SrvOptionsBox *AGOL_Settings::CreateSrvOptionsBox(void *parent) { ODA_SrvOptionsBox *obox = new ODA_SrvOptionsBox; obox->optionsBox = AG_BoxNewVert(parent, AG_BOX_FRAME); AG_LabelNewS(obox->optionsBox, 0, "Masters and Servers"); obox->optionsBox = AG_BoxNewVert(obox->optionsBox, AG_BOX_EXPAND); AG_BoxSetPadding(obox->optionsBox, 5); AG_BoxSetSpacing(obox->optionsBox, 5); obox->masterOnStartCheck = AG_CheckboxNewInt(obox->optionsBox, 0, "Get Master List on application start", &MasterOnStart); obox->showBlockedCheck = AG_CheckboxNewInt(obox->optionsBox, 0, "Show blocked servers", &ShowBlocked); // Read the options. If they are not set they will be 0. GuiConfig::Read("MasterOnStart", MasterOnStart); GuiConfig::Read("ShowBlockedServers", ShowBlocked); // Read the timeout options. If they are not set use a default value of 500ms. if(GuiConfig::Read("MasterTimeout", MasterTimeout) || MasterTimeout <= 0) MasterTimeout = 500; if(GuiConfig::Read("ServerTimeout", ServerTimeout) || ServerTimeout <= 0) ServerTimeout = 500; obox->masterTimeoutSpin = AG_NumericalNewUint(obox->optionsBox, 0, NULL, "Master Timeout (ms)", &MasterTimeout); AG_NumericalSetRangeInt(obox->masterTimeoutSpin, 1, 5000); obox->serverTimeoutSpin = AG_NumericalNewUint(obox->optionsBox, 0, NULL, "Server Timeout (ms)", &ServerTimeout); AG_NumericalSetRangeInt(obox->serverTimeoutSpin, 1, 5000); return obox; }
static void SoundMenu2(AG_NotebookTab *parent, struct gui_sound *cfg) { AG_Radio *radio; AG_Checkbox *check; AG_Numerical *num; AG_Label *lbl; AG_Box *box; AG_Box *box2; int i; box = AG_BoxNewVert(AGWIDGET(parent), AG_BOX_VFILL); { check = AG_CheckboxNewInt(AGWIDGET(box), AG_CHECKBOX_HFILL, gettext("Enable OPN"), &(cfg->bOPNEnable)); check = AG_CheckboxNewInt(AGWIDGET(box), AG_CHECKBOX_HFILL, gettext("Enable WHG"), &(cfg->bWHGEnable)); check = AG_CheckboxNewInt(AGWIDGET(box), AG_CHECKBOX_HFILL, gettext("Enable THG"), &(cfg->bTHGEnable)); } }
void osdInitIntroWindow() { AG_Window *w = osdNewWindow("Welcome to Gravit!"); AG_Box *vBox = AG_BoxNewVert(w, 0); AG_Box *hBox = AG_BoxNewHoriz(w, 0); AG_Label *text; AG_BoxSetSpacing(vBox, 10); text = AG_LabelNew(vBox, 0, 0); AG_LabelText(text, "Gravit is a free, visually stunning gravity simulator, where you can spend endless\ntime experimenting with various configurations of simulated universes.\n\nQuick Start:\n\n - Click on RESPAWN to start a new simulation.\n - Click on PLAY to replay a recording\n - Click on RECORD to resume recording\n - Hold down a mouse button and move it around to change your perspective.\n - Use the A and Z keys, or the scroll wheel to zoom in and out.\n"); AG_WidgetSetSize(text, 200, 100); // AG_Checkbox *showAgain = AG_CheckboxNew(vBox, AG_CHECKBOX_SET, "Show this window on startup"); AG_ButtonNewFn(hBox, 0, " OK ", AG_WindowCloseGenEv, "%p", w); AG_WindowShow(w); }
AG_Box *AGOL_About::CreateDevBox(void *parent) { AG_Box *dbox; AG_Label *label; dbox = AG_BoxNewVert(parent, AG_BOX_HFILL); AG_LabelNewS(dbox, 0, "Developed by"); dbox = AG_BoxNewHoriz(dbox, AG_BOX_EXPAND); AG_BoxSetPadding(dbox, 5); AG_BoxSetSpacing(dbox, 5); dbox = AG_BoxNewHoriz(dbox, AG_BOX_FRAME | AG_BOX_EXPAND); label = AG_LabelNewS(dbox, AG_LABEL_EXPAND, "Michael Wood (mailto:[email protected])\n" "Russell Rice (mailto:[email protected])"); AG_LabelJustify(label, AG_TEXT_CENTER); return dbox; }
static void Init(void *obj) { AG_FontSelector *fs = obj; fs->flags = AG_FONTSELECTOR_UPDATE; fs->hPane = AG_PaneNewHoriz(fs, AG_PANE_EXPAND); fs->tlFaces = AG_TlistNew(fs->hPane->div[0], AG_TLIST_EXPAND); fs->hPane2 = AG_PaneNewHoriz(fs->hPane->div[1], AG_PANE_EXPAND); fs->tlStyles = AG_TlistNew(fs->hPane2->div[0], AG_TLIST_EXPAND); fs->sizeBox = AG_BoxNewVert(fs->hPane2->div[1], AG_BOX_EXPAND); fs->tlSizes = AG_TlistNew(fs->sizeBox, AG_TLIST_EXPAND); fs->font = NULL; fs->curFace[0] = '\0'; fs->curStyle = 0; fs->curSize = 0; fs->rPreview = AG_RECT(0,0,0,64); fs->sPreview = -1; AG_TlistSizeHint(fs->tlFaces, "XXXXXXXXXXXXXXX", 8); AG_TlistSizeHint(fs->tlStyles, "XXXXXXXXX", 8); AG_TlistSizeHint(fs->tlSizes, "100", 8); AG_BindPointer(fs, "font", (void *)&fs->font); AG_SetEvent(fs, "bound", Bound, NULL); AG_AddEvent(fs, "widget-shown", UpdateFaces, NULL); AG_SetEvent(fs->tlFaces, "tlist-selected", SelectedFace, "%p", fs); AG_SetEvent(fs->tlStyles, "tlist-selected", SelectedStyle, "%p", fs); AG_SetEvent(fs->tlSizes, "tlist-selected", SelectedSize, "%p", fs); #ifdef AG_DEBUG AG_BindUint(fs, "flags", &fs->flags); /* AG_BindString(fs, "curFace", fs->curFace, sizeof(fs->curFace)); */ AG_BindUint(fs, "curStyle", &fs->curStyle); AG_BindInt(fs, "curSize", &fs->curSize); AG_BindInt(fs, "sPreview", &fs->sPreview); #endif }
static void * Edit(void *p, VG_View *vv) { VG_Text *vt = p; AG_Box *box = AG_BoxNewVert(NULL, AG_BOX_EXPAND); AG_Pane *vPane; AG_Textbox *tb; AG_Box *bAl, *bAlv; vPane = AG_PaneNewVert(box, AG_PANE_EXPAND); AG_LabelNew(vPane->div[0], 0, _("Text: ")); tb = AG_TextboxNewS(vPane->div[0], AG_TEXTBOX_MULTILINE|AG_TEXTBOX_EXPAND, NULL); AG_TextboxBindUTF8(tb, vt->text, sizeof(vt->text)); bAlv = AG_BoxNewVertNS(vPane->div[1], AG_BOX_HFILL|AG_BOX_FRAME); AG_LabelNew(bAlv, 0, _("Alignment: ")); bAl = AG_BoxNewHorizNS(bAlv, AG_BOX_HFILL|AG_BOX_HOMOGENOUS); AG_ButtonNewFn(bAl, 0, _("TL"), SetAlign, "%p,%i", vt, VG_ALIGN_TL); AG_ButtonNewFn(bAl, 0, _("TC"), SetAlign, "%p,%i", vt, VG_ALIGN_TC); AG_ButtonNewFn(bAl, 0, _("TR"), SetAlign, "%p,%i", vt, VG_ALIGN_TR); bAl = AG_BoxNewHorizNS(bAlv, AG_BOX_HFILL|AG_BOX_HOMOGENOUS); AG_ButtonNewFn(bAl, 0, _("ML"), SetAlign, "%p,%i", vt, VG_ALIGN_ML); AG_ButtonNewFn(bAl, 0, _("MC"), SetAlign, "%p,%i", vt, VG_ALIGN_MC); AG_ButtonNewFn(bAl, 0, _("MR"), SetAlign, "%p,%i", vt, VG_ALIGN_MR); bAl = AG_BoxNewHorizNS(bAlv, AG_BOX_HFILL|AG_BOX_HOMOGENOUS); AG_ButtonNewFn(bAl, 0, _("BL"), SetAlign, "%p,%i", vt, VG_ALIGN_BL); AG_ButtonNewFn(bAl, 0, _("BC"), SetAlign, "%p,%i", vt, VG_ALIGN_BC); AG_ButtonNewFn(bAl, 0, _("BR"), SetAlign, "%p,%i", vt, VG_ALIGN_BR); AG_ButtonNewFn(vPane->div[1], AG_BUTTON_HFILL, _("Select font"), SelectFontDlg, "%p,%p", vt, vv); AG_CheckboxNewFlag(vPane->div[1], 0, _("Underline"), &vt->fontFlags, VG_TEXT_UNDERLINE); AG_CheckboxNewFlag(vPane->div[1], 0, _("Scale to view"), &vt->fontFlags, VG_TEXT_SCALED); return (box); }
AG_Box *AGOL_About::CreateTopBox(void *parent) { AG_Box *tbox; AG_Box *box; AG_Label *label; AG_DataSource *pngdata; AG_AgarVersion agv; tbox = AG_BoxNewHoriz(parent, 0); box = AG_BoxNewHoriz(tbox, 0); if((pngdata = AG_OpenConstCore(icon_odalaunch_96, sizeof(icon_odalaunch_96))) != NULL) { AG_PixmapFromSurface(box, AG_PIXMAP_EXPAND, AG_ReadSurfaceFromPNG(pngdata)); AG_CloseDataSource(pngdata); } box = AG_BoxNewVert(tbox, AG_BOX_HFILL); label = AG_LabelNewS(box, AG_LABEL_HFILL, "The Odamex Launcher"); AG_LabelJustify(label, AG_TEXT_CENTER); label = AG_LabelNewS(box, AG_LABEL_HFILL, "Copyright (C) 2010-2012 by The Odamex Team"); AG_LabelJustify(label, AG_TEXT_CENTER); label = AG_LabelNew(box, AG_LABEL_HFILL, "Version %d.%d.%d - Protocol Version %d", VERSIONMAJOR(VERSION), VERSIONMINOR(VERSION), VERSIONPATCH(VERSION), PROTOCOL_VERSION); AG_LabelJustify(label, AG_TEXT_CENTER); label = AG_LabelNewS(box, AG_LABEL_HFILL, "http://www.odamex.net"); AG_LabelJustify(label, AG_TEXT_CENTER); AG_GetVersion(&agv); label = AG_LabelNew(parent, AG_LABEL_HFILL, "Built with Agar, Version %d.%d.%d", agv.major, agv.minor, agv.patch); AG_LabelJustify(label, AG_TEXT_CENTER); label = AG_LabelNew(parent, AG_LABEL_HFILL, "(%s)", agv.release); AG_LabelJustify(label, AG_TEXT_CENTER); return tbox; }
AG_Box *AGOL_About::CreateTopBox(void *parent) { AG_Box *tbox; AG_Box *box; AG_Label *label; SDL_Surface *sf; AG_AgarVersion agv; tbox = AG_BoxNewHoriz(parent, 0); box = AG_BoxNewHoriz(tbox, 0); sf = IMG_Load_RW(SDL_RWFromConstMem(icon_odalaunch_96, sizeof(icon_odalaunch_96)), 1); if(sf) AG_PixmapFromSurface(box, AG_PIXMAP_EXPAND, AG_SurfaceFromSDL(sf)); box = AG_BoxNewVert(tbox, 0); label = AG_LabelNewS(box, AG_LABEL_HFILL, "The Odamex Launcher"); AG_LabelJustify(label, AG_TEXT_CENTER); label = AG_LabelNewS(box, AG_LABEL_HFILL, "Copyright (C) 2010 by The Odamex Team"); AG_LabelJustify(label, AG_TEXT_CENTER); label = AG_LabelNew(box, AG_LABEL_HFILL, "Version %d.%d.%d - Protocol Version %d", VERSIONMAJOR(VERSION), VERSIONMINOR(VERSION), VERSIONPATCH(VERSION), PROTOCOL_VERSION); AG_LabelJustify(label, AG_TEXT_CENTER); label = AG_LabelNewS(box, AG_LABEL_HFILL, "http://www.odamex.net"); AG_LabelJustify(label, AG_TEXT_CENTER); AG_GetVersion(&agv); label = AG_LabelNew(parent, AG_LABEL_HFILL, "Built with Agar, Version %d.%d.%d", agv.major, agv.minor, agv.patch); AG_LabelJustify(label, AG_TEXT_CENTER); label = AG_LabelNew(parent, AG_LABEL_HFILL, "(%s)", agv.release); AG_LabelJustify(label, AG_TEXT_CENTER); return tbox; }
void OnConfigDisplayMenu(AG_Event *event) { AG_MenuItem *self = (AG_MenuItem *)AG_SELF(); AG_Window *win; AG_Notebook *note; AG_Notebook *note2; AG_NotebookTab *tab; AG_NotebookTab *tab2; AG_Box *box; AG_Button *btn; struct gui_disp *cfg; int i, num; cfg = (struct gui_disp *)malloc(sizeof(struct gui_disp)); if(cfg == NULL) return; { LockVM(); cfg->nDrawFPS = configdat.nDrawFPS; cfg->nEmuFPS = configdat.nEmuFPS; cfg->nBrightness = configdat.nBrightness; cfg->nRenderMethod = configdat.nRenderMethod; cfg->uWidth = configdat.uWidth; cfg->uHeight = configdat.uHeight; cfg->bFullScan = configdat.bFullScan; cfg->bFullScanFS = configdat.bFullScanFS; cfg->bSmoosing = configdat.bSmoosing; cfg->bUseSIMD = configdat.bUseSIMD; #ifdef _USE_OPENCL cfg->bUseOpenCL = configdat.bUseOpenCL; cfg->nCLGlobalWorkThreads = configdat.nCLGlobalWorkThreads; cfg->bCLSparse = configdat.bCLSparse; cfg->nCLDeviceNum = configdat.nCLDeviceNum; cfg->nCLPlatformNum = configdat.nCLPlatformNum; cfg->bCLInteropGL = configdat.bCLInteropGL; for(i = 0; i <= 8; i++) cfg->sDeviceName[i] = NULL; if(cldraw == NULL) { num = 8; } else { num = cldraw->GetDevices(); } if(num >= 8) num = 8; if(num <= 0) num = 0; for(i = 0; i < num; i++) { cfg->sDeviceName[i] = malloc(96 * sizeof(char)); cfg->sDeviceName[i][0] = '\0'; if(cldraw == NULL) { snprintf(cfg->sDeviceName[i], 94, "Processor #%d", i); } else { char sName[64]; char sType[16]; cldraw->GetDeviceName(sName, 64, i); cldraw->GetDeviceType(sType, 16, i); snprintf(cfg->sDeviceName[i], 94, "%s(%s)", sType, sName); } } cfg->sDeviceName[8] = NULL; #endif UnlockVM(); } win= AG_WindowNew(DIALOG_WINDOW_DEFAULT); note = AG_NotebookNew(AGWIDGET(win), AG_NOTEBOOK_HFILL); { tab = AG_NotebookAddTab(note, gettext("Screen"), AG_BOX_HORIZ); OnConfigMenuScreen(cfg, tab); #ifdef USE_OPENGL tab = AG_NotebookAddTab(note, gettext("Display"), AG_BOX_HORIZ); ConfigMenuBright(cfg, tab); #endif /* USE_OPENGL */ #ifdef _USE_OPENCL tab = AG_NotebookAddTab(note, gettext("OpenCL"), AG_BOX_HORIZ); ConfigMenuOpenCL(cfg, tab); #endif /* USE_OPENGL */ } box = AG_BoxNewHoriz(AGWIDGET(win), AG_BOX_HFILL); AG_WidgetSetSize(AGWIDGET(box), 320, 24); { AG_Box *vbox; vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL); btn = AG_ButtonNewFn(AGWIDGET(box), 0, gettext("OK"), OnConfigApplyDisp, "%p", cfg); vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL); AG_WidgetSetSize(AGWIDGET(vbox), 80, 24); vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL); btn = AG_ButtonNewFn(AGWIDGET(box), 0, gettext("Cancel"), OnPushCancel2, "%p", cfg); } AG_SetEvent(win, "window-close", OnPushCancel2, "%p", cfg); AG_WindowSetCaption(win, gettext("Display")); AG_WindowShow(win); }
static void OnConfigMenuScreen(struct gui_disp *cfg, AG_NotebookTab *parent) { AG_Radio *radio; AG_Checkbox *check; AG_Numerical *fps; AG_Box *box; AG_Box *box2; AG_Combo *combo; AG_TlistItem *TlistItem[RENDERING_END]; int i; int limit; box = AG_BoxNewHoriz(AGWIDGET(parent), AG_BOX_VFILL); { radio = AG_RadioNewFn(AGWIDGET(box), 0, ScreenSizeName, OnChangeScreenReso, "%p", cfg); limit = sizeof(ScreenSizeHeight) / sizeof(WORD); for(i = 0; i <= limit; i++){ if((ScreenSizeWidth[i] == cfg->uWidth) && (ScreenSizeHeight[i] == cfg->uHeight)) break; } if(i >= limit) i = 2; AG_SetInt(radio, "value", i); box = AG_BoxNewVert(AGWIDGET(parent), AG_BOX_HFILL); fps = AG_NumericalNewS(AGWIDGET(box), AG_NUMERICAL_HFILL, NULL ,gettext("Display rate")); AG_BindUint16(fps, "value", &(cfg->nDrawFPS)); { AG_SetInt(fps, "min", 2); AG_SetInt(fps, "max", 75); AG_SetInt(fps, "inc", 1); } fps = AG_NumericalNewS(AGWIDGET(box), AG_NUMERICAL_HFILL, NULL ,gettext("Emulation rate")); AG_BindUint16(fps, "value", &(cfg->nEmuFPS)); { AG_SetInt(fps, "min", 2); AG_SetInt(fps, "max", 75); AG_SetInt(fps, "inc", 1); } box2 = AG_BoxNewHoriz(AGWIDGET(box), AG_BOX_HFILL); combo = AG_ComboNewS(AGWIDGET(box2), AG_COMBO_SCROLLTOSEL | AG_COMBO_HFILL, gettext("Rendering Method")); AG_ComboSizeHint(combo, "XXXXXXXXXXXXXX", RENDERING_END); TlistItem[0] = AG_TlistAddPtrHead(combo->list, NULL, gettext("Full Draw"), (void *)&RenderMethodsList[0]); TlistItem[1] = AG_TlistAddPtr(combo->list, NULL, gettext("Diff Block"), (void *)&RenderMethodsList[1]); TlistItem[2] = AG_TlistAddPtr(combo->list, NULL, gettext("Diff Raster"), (void *)&RenderMethodsList[2]); for(i = RENDERING_FULL; i < RENDERING_END; i++) { if(i == cfg->nRenderMethod) { AG_ComboSelect(combo, TlistItem[i]); } } AG_SetEvent(combo, "combo-selected", RenderMethodSelected, "%p", cfg); box2 = AG_BoxNewHoriz(AGWIDGET(box), AG_BOX_HFILL); check = AG_CheckboxNewInt(AGWIDGET(box2), AG_CHECKBOX_HFILL, gettext("Full Scan (15KHz)"), &(cfg->bFullScan)); box2 = AG_BoxNewHoriz(AGWIDGET(box), AG_BOX_HFILL); check = AG_CheckboxNewInt(AGWIDGET(box2), AG_CHECKBOX_HFILL, gettext("SMOOSING"), &(cfg->bSmoosing)); box2 = AG_BoxNewHoriz(AGWIDGET(box), AG_BOX_HFILL); check = AG_CheckboxNewInt(AGWIDGET(box2), AG_CHECKBOX_HFILL, gettext("Use OpenCL(Need REBOOT)"), &(cfg->bUseOpenCL)); box2 = AG_BoxNewHoriz(AGWIDGET(box), AG_BOX_HFILL); check = AG_CheckboxNewInt(AGWIDGET(box2), AG_CHECKBOX_HFILL, gettext("Use SIMD instructions(Need REBOOT)"), &(cfg->bUseSIMD)); } }
void OnConfigSoundMenu(AG_Event *event) { AG_MenuItem *self = (AG_MenuItem *)AG_SELF(); AG_Window *win; AG_Notebook *note; AG_Notebook *note2; AG_NotebookTab *tab; AG_NotebookTab *tab2; AG_Box *box; AG_Button *btn; struct gui_sound *cfg; cfg = malloc(sizeof(struct gui_sound)); if(cfg == NULL) return; { cfg->iTotalVolume = configdat.iTotalVolume; cfg->nFMVolume = configdat.nFMVolume; cfg->nPSGVolume = configdat.nPSGVolume; cfg->nBeepVolume = configdat.nBeepVolume; cfg->nCMTVolume = configdat.nCMTVolume; cfg->nWaveVolume = configdat.nWaveVolume; cfg->uChSeparation = configdat.uChSeparation; cfg->nSampleRate = configdat.nSampleRate; cfg->nSoundBuffer = configdat.nSoundBuffer; cfg->nBeepFreq = configdat.nBeepFreq; cfg->bFMHQmode = configdat.bFMHQmode; cfg->nStereoOut = configdat.nStereoOut; cfg->bTapeMon = configdat.bTapeMon; cfg->bOPNEnable = configdat.bOPNEnable; cfg->bWHGEnable = configdat.bWHGEnable; cfg->bTHGEnable = configdat.bTHGEnable; #ifdef FDDSND cfg->bFddSound = configdat.bFddSound; #endif } win= AG_WindowNew(DIALOG_WINDOW_DEFAULT); note = AG_NotebookNew(AGWIDGET(win), AG_NOTEBOOK_HFILL); { tab = AG_NotebookAddTab(note, gettext("Volume"), AG_BOX_VERT); VolumeMenu(tab, cfg); tab = AG_NotebookAddTab(note, gettext("Rendering"), AG_BOX_HORIZ); SoundMenu(tab, cfg); tab = AG_NotebookAddTab(note, gettext("Misc"), AG_BOX_HORIZ); SoundMenu2(tab, cfg); } box = AG_BoxNewHoriz(AGWIDGET(win), AG_BOX_HFILL); AG_WidgetSetSize(AGWIDGET(box), 320, 24); { AG_Box *vbox; vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL); btn = AG_ButtonNewFn(AGWIDGET(box), 0, gettext("OK"), OnConfigApplySound, "%p", cfg); vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL); AG_WidgetSetSize(AGWIDGET(vbox), 80, 24); vbox = AG_BoxNewVert(AGWIDGET(box), AG_BOX_VFILL); btn = AG_ButtonNewFn(AGWIDGET(box), 0, gettext("Cancel"), OnPushCancel2, "%p", cfg); } AG_SetEvent(win, "window-close", OnPushCancel2, "%p", cfg); AG_WindowSetCaption(win, gettext("Sound Preferences")); AG_WindowShow(win); }