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_HFILL | AG_BOX_FRAME); AG_LabelNewS(wdbox, 0, "Wad Directories"); wdbox = AG_BoxNewHoriz(wdbox, AG_BOX_HFILL); 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; }
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; }
/* Set the label text (C string). */ void AG_ButtonTextS(AG_Button *bu, const char *label) { AG_ObjectLock(bu); if (bu->surface != -1) { AG_ButtonSurface(bu, NULL); } if (bu->lbl == NULL) { bu->lbl = AG_LabelNewS(bu, 0, label); AG_LabelJustify(bu->lbl, bu->justify); AG_LabelValign(bu->lbl, bu->valign); } else { AG_LabelTextS(bu->lbl, label); } AG_ObjectUnlock(bu); AG_Redraw(bu); }
AG_Label *AGOL_Settings::CreateOdamexPathLabel(void *parent) { AG_Label *oplabel; string oppath; oplabel = AG_LabelNewS(parent, AG_LABEL_FRAME | AG_LABEL_EXPAND, ""); AG_LabelValign(oplabel, AG_TEXT_MIDDLE); GuiConfig::Read("OdamexPath", oppath); if(oppath.size()) AG_LabelTextS(oplabel, oppath.c_str()); AG_ButtonNewFn(parent, 0, "Browse", EventReceiver, "%p", RegisterEventHandler((EVENT_FUNC_PTR)&AGOL_Settings::OnBrowseOdamexPath)); return oplabel; }
/* Set the label text (format string). */ void AG_BoxSetLabelS(AG_Box *box, const char *s) { AG_ObjectLock(box); if (s != NULL) { if (box->lbl == NULL) { box->lbl = AG_LabelNewS(box, 0, s); AG_SetStyle(box->lbl, "font-size", "80%"); } else { AG_LabelTextS(box->lbl, s); } } else { AG_ObjectDetach(box->lbl); AG_ObjectDestroy(box->lbl); box->lbl = NULL; } AG_Redraw(box); AG_ObjectUnlock(box); }
AG_Button * AG_ButtonNewS(void *parent, Uint flags, const char *label) { AG_Button *bu; bu = Malloc(sizeof(AG_Button)); AG_ObjectInit(bu, &agButtonClass); if (label != NULL) { bu->lbl = AG_LabelNewS(bu, 0, label); AG_LabelJustify(bu->lbl, bu->justify); AG_LabelValign(bu->lbl, bu->valign); } bu->flags |= flags; if (flags & AG_BUTTON_HFILL) { AG_ExpandHoriz(bu); } if (flags & AG_BUTTON_VFILL) { AG_ExpandVert(bu); } AG_ObjectAttach(parent, bu); return (bu); }
static void CreateTestWindow(AG_Event *event) { MyTestInstance *ti = AG_PTR(1); AG_Window *winParent = AG_PTR(2); AG_Window *win; if ((win = AG_WindowNew(ti->testFlags)) == NULL) { TestMsg(ti, "AG_WindowNew() failed: %s", AG_GetError()); return; } AG_WindowSetCaption(win, "Test window"); AG_LabelNewS(win, 0, "This is a test window"); AG_LabelNew(win, 0, "Flags = 0x%x", ti->testFlags); AG_ButtonNewFn(win, AG_BUTTON_HFILL, "Close this window", AGWINDETACH(win)); AG_WindowAttach(winParent, win); if (ti->makeTransient) AG_WindowMakeTransient(winParent, win); if (ti->makePinned) AG_WindowPin(winParent, win); AG_WindowShow(win); }
static int TestGUI(void *obj, AG_Window *win) { MyTestInstance *ti = obj; AG_FlagDescr winFlags[] = { { AG_WINDOW_MODAL, "MODAL", 1 }, { AG_WINDOW_KEEPABOVE, "KEEPABOVE", 1 }, { AG_WINDOW_KEEPBELOW, "KEEPBELOW", 1 }, { AG_WINDOW_NOTITLE, "NOTITLE", 1 }, { AG_WINDOW_NOBORDERS, "NOBORDERS", 1 }, { AG_WINDOW_NOHRESIZE, "NOHRESIZE", 1 }, { AG_WINDOW_NOVRESIZE, "NOVRESIZE", 1 }, { AG_WINDOW_NOCLOSE, "NOCLOSE", 1 }, { AG_WINDOW_NOMINIMIZE, "NOMINIMIZE", 1 }, { AG_WINDOW_NOMAXIMIZE, "NOMAXIMIZE", 1 }, { AG_WINDOW_NOBACKGROUND, "NOBACKGROUND", 1 }, { AG_WINDOW_NOMOVE, "NOMOVE", 1 }, { AG_WINDOW_DENYFOCUS, "DENYFOCUS", 1 }, { 0, NULL, 0 } }; ti->testFlags = 0; ti->makeTransient = 0; ti->makePinned = 0; AG_LabelNewS(win, 0, "Create test window with flags:"); AG_CheckboxSetFromFlags(win, 0, &ti->testFlags, winFlags); AG_CheckboxNewInt(win, 0, "Make transient", &ti->makeTransient); AG_CheckboxNewInt(win, 0, "Make pinned", &ti->makePinned); AG_ButtonNewFn(win, AG_BUTTON_HFILL, "Create Test Window", CreateTestWindow, "%p,%p", ti, win); AG_SeparatorNewHoriz(win); AG_ButtonNewFn(win, AG_BUTTON_HFILL, "Test Desktop Alignment", TestDesktopAlign, "%p", win); return (0); }
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 TestDesktopAlign(AG_Event *event) { AG_Window *winParent = AG_PTR(1); AG_Window *win; int i; for (i = 0; i < 2; i++) { if ((win = AG_WindowNew(0))) { AG_WindowSetCaption(win, "Auto%d", i); AG_LabelNew(win, 0, "Autopositioned #%d", i); AG_LabelNewS(win, 0, "(AG_WINDOW_ALIGNMENT_NONE)"); AG_WindowAttach(winParent, win); AG_WindowMakeTransient(winParent, win); AG_WindowShow(win); } if ((win = AG_WindowNew(0))) { AG_WindowSetCaption(win, "TL%d", i); AG_LabelNew(win, 0, "Top Left #%d", i); AG_LabelNewS(win, 0, "(AG_WINDOW_TL)"); AG_WindowSetPosition(win, AG_WINDOW_TL, 1); AG_WindowAttach(winParent, win); AG_WindowMakeTransient(winParent, win); AG_WindowShow(win); } if ((win = AG_WindowNew(0))) { AG_WindowSetCaption(win, "TC%d", i); AG_LabelNew(win, 0, "Top Center #%d", i); AG_LabelNewS(win, 0, "(AG_WINDOW_TC)"); AG_WindowSetPosition(win, AG_WINDOW_TC, 1); AG_WindowAttach(winParent, win); AG_WindowMakeTransient(winParent, win); AG_WindowShow(win); } if ((win = AG_WindowNew(0))) { AG_WindowSetCaption(win, "TR%d", i); AG_LabelNew(win, 0, "Top Right #%d", i); AG_LabelNewS(win, 0, "(AG_WINDOW_TR)"); AG_WindowSetPosition(win, AG_WINDOW_TR, 1); AG_WindowAttach(winParent, win); AG_WindowMakeTransient(winParent, win); AG_WindowShow(win); } if ((win = AG_WindowNew(0))) { AG_WindowSetCaption(win, "MC%d", i); AG_LabelNew(win, 0, "Center #%d", i); AG_LabelNewS(win, 0, "(AG_WINDOW_MC)"); AG_WindowSetPosition(win, AG_WINDOW_MC, 1); AG_WindowAttach(winParent, win); AG_WindowMakeTransient(winParent, win); AG_WindowShow(win); } if ((win = AG_WindowNew(0))) { AG_WindowSetCaption(win, "BL%d", i); AG_LabelNew(win, 0, "Bottom Left #%d", i); AG_LabelNewS(win, 0, "(AG_WINDOW_BL)"); AG_WindowSetPosition(win, AG_WINDOW_BL, 1); AG_WindowAttach(winParent, win); AG_WindowMakeTransient(winParent, win); AG_WindowShow(win); } if ((win = AG_WindowNew(0))) { AG_WindowSetCaption(win, "BR%d", i); AG_LabelNew(win, 0, "Bottom Right #%d", i); AG_LabelNewS(win, 0, "(AG_WINDOW_BR)"); AG_WindowSetPosition(win, AG_WINDOW_BR, 1); AG_WindowAttach(winParent, win); AG_WindowMakeTransient(winParent, win); AG_WindowShow(win); } if ((win = AG_WindowNew(0))) { AG_WindowSetCaption(win, "BC%d", i); AG_LabelNew(win, 0, "Bottom Center #%d", i); AG_LabelNewS(win, 0, "(AG_WINDOW_BC)"); AG_WindowSetPosition(win, AG_WINDOW_BC, 1); AG_WindowAttach(winParent, win); AG_WindowMakeTransient(winParent, win); AG_WindowShow(win); } } AG_LabelNewS(winParent, 0, "OK"); }
int main(int argc, char *argv[]) { #ifdef HAVE_SDL AG_Window *win; SDL_Surface *screen, *bmp, *tex1, *tex2, *avatar; AG_Surface *agbmp, *agavatar; int c, useGL = 0; Uint32 sdlFlags = 0; char *optArg; Uint32 rmask, gmask, bmask, amask; if (AG_InitCore("agar-sdl-demo", 0) == -1) { fprintf(stderr, "AG_InitCore: %s\n", AG_GetError()); goto fail; } while ((c = AG_Getopt(argc, argv, "?g", &optArg, NULL)) != -1) { switch (c) { case 'g': useGL = 1; break; default: printf("Usage: %s [-g]\n", agProgName); break; } } /* Set up SDL */ if (SDL_Init(SDL_INIT_VIDEO) == -1) { fprintf(stderr, "SDL_Init: %s\n", SDL_GetError()); return (1); } if (useGL) { sdlFlags = SDL_RESIZABLE|SDL_OPENGL; } else { sdlFlags = SDL_RESIZABLE|SDL_SWSURFACE; } if ((screen = SDL_SetVideoMode(320, 240, 32, sdlFlags)) == NULL) { fprintf(stderr, "SDL_SetVideoMode: %s\n", SDL_GetError()); goto fail; } if (useGL) { /* Set up OpenGL viewport and projection. */ AG_GL_InitContext(AG_RECT(0,0,320,240)); } /* Initialize Agar-GUI to reuse display */ if (AG_InitVideoSDL(screen, 0) == -1) { fprintf(stderr, "%s\n", AG_GetError()); AG_Destroy(); goto fail; } AG_BindGlobalKey(AG_KEY_ESCAPE, AG_KEYMOD_ANY, AG_QuitGUI); /* Display some test widgets. */ win = AG_WindowNew(AG_WINDOW_PLAIN); AG_LabelNew(win, 0, "Attached to existing %s display", useGL ? "SDL/OpenGL" : "SDL"); /* Test conversion from SDL_Surface to AG_Surface. */ if ((bmp = SDL_LoadBMP("agar.bmp")) != NULL) { if ((agbmp = AG_SurfaceFromSDL(bmp)) != NULL) { AG_PixmapFromSurface(win, 0, agbmp); } else { AG_LabelNewS(win, 0, AG_GetError()); } } #ifdef HAVE_SDL_IMAGE if ((tex1 = IMG_Load("test1.png")) == NULL || (tex2 = IMG_Load("test2.png")) == NULL) { fprintf(stderr, "IMG_Load() failed\n"); goto fail; } # if SDL_BYTEORDER == SDL_BIG_ENDIAN rmask = 0xff000000; gmask = 0x00ff0000; bmask = 0x0000ff00; amask = 0x000000ff; # else rmask = 0x000000ff; gmask = 0x0000ff00; bmask = 0x00ff0000; amask = 0xff000000; # endif avatar = SDL_CreateRGBSurface(SDL_SWSURFACE|SDL_SRCALPHA, 64, 128, tex1->format->BitsPerPixel, rmask, gmask, bmask, amask); SDL_SetAlpha(tex1, 0, 0); SDL_BlitSurface(tex1, NULL, avatar, NULL); SDL_SetAlpha(tex2, SDL_SRCALPHA, 0); SDL_BlitSurface(tex2, NULL, avatar, NULL); if ((agavatar = AG_SurfaceFromSDL(avatar)) != NULL) { AG_PixmapFromSurface(win, 0, agavatar); } else { AG_LabelNewS(win, 0, AG_GetError()); } #endif /* HAVE_SDL_IMAGE */ AG_WindowShow(win); AG_EventLoop(); AG_Destroy(); SDL_Quit(); return (0); fail: SDL_Quit(); return (1); #else fprintf(stderr, "Agar was compiled without SDL support\n"); return (1); #endif /* HAVE_SDL */ }
static int TestGUI(void *obj, AG_Window *win) { char path[AG_PATHNAME_MAX]; AG_Surface *su, *su2; /* Load, display and save a PNG file. */ AG_LabelNewS(win, 0, "Loading agar.png:"); if (!AG_ConfigFile("load-path", "agar", "png", path, sizeof(path))) { if ((su = AG_SurfaceFromPNG(path)) == NULL) { AG_LabelNew(win, 0, "%s: %s", path, AG_GetError()); } else { AG_PixmapFromSurface(win, 0, su); } AG_LabelNewS(win, 0, "Saving agar.png:"); if (AG_SurfaceExportPNG(su, "agar-save.png") == -1) { AG_LabelNew(win, 0, "Save failed: %s", AG_GetError()); } else { if ((su2 = AG_SurfaceFromPNG("agar-save.png")) == NULL) { AG_LabelNew(win, 0, "Load failed: %s", AG_GetError()); } else { AG_PixmapFromSurface(win, 0, su2); } } } else { AG_LabelNewS(win, 0, AG_GetError()); } /* Load/save a PNG file in indexed color format. */ AG_LabelNewS(win, 0, "Loading agar-index.png:"); if (!AG_ConfigFile("load-path", "agar-index", "png", path, sizeof(path))) { if ((su = AG_SurfaceFromPNG(path)) == NULL) { AG_LabelNew(win, 0, "Failed: %s", AG_GetError()); } else { AG_PixmapFromSurface(win, 0, su); } AG_LabelNewS(win, 0, "Saving agar-index.png:"); if (AG_SurfaceExportPNG(su, "agar-index-save.png") == -1) { AG_LabelNew(win, 0, "Save failed: %s", AG_GetError()); } else { if ((su2 = AG_SurfaceFromPNG("agar-index-save.png")) == NULL) { AG_LabelNew(win, 0, "Load failed: %s", AG_GetError()); } else { AG_PixmapFromSurface(win, 0, su2); } } } else { AG_LabelNewS(win, 0, AG_GetError()); } /* Load/save a JPEG file. */ AG_LabelNewS(win, 0, "Loading pepe.jpg:"); if (!AG_ConfigFile("load-path", "pepe", "jpg", path, sizeof(path))) { if ((su = AG_SurfaceFromJPEG(path)) == NULL) { AG_LabelNew(win, 0, "Failed: %s", AG_GetError()); } else { AG_PixmapFromSurface(win, 0, su); } AG_LabelNewS(win, 0, "Saving pepe.jpg:"); if (AG_SurfaceExportJPEG(su, "pepe-save.jpg") == -1) { AG_LabelNew(win, 0, "Save failed: %s", AG_GetError()); } else { if ((su2 = AG_SurfaceFromJPEG("pepe-save.jpg")) == NULL) { AG_LabelNew(win, 0, "Load failed: %s", AG_GetError()); } else { AG_PixmapFromSurface(win, 0, su2); } } } else { AG_LabelNewS(win, 0, AG_GetError()); } return (0); }
static AG_Window * DEV_ConfigWindow(AG_Config *cfg) { char path[AG_PATHNAME_MAX]; AG_Window *win; AG_Box *hb; AG_Textbox *tbox; /* AG_Checkbox *cb; */ AG_Notebook *nb; AG_NotebookTab *tab; if ((win = AG_WindowNewNamedS(0, "DEV_Config")) == NULL) { return (NULL); } AG_WindowSetCaptionS(win, _("Agar settings")); AG_WindowSetCloseAction(win, AG_WINDOW_DETACH); nb = AG_NotebookNew(win, AG_NOTEBOOK_HFILL|AG_NOTEBOOK_VFILL); tab = AG_NotebookAdd(nb, _("Video"), AG_BOX_VERT); { AG_NumericalNewIntR(tab, 0, "%", _("Screenshot quality: "), &agScreenshotQuality, 1, 100); } tab = AG_NotebookAdd(nb, _("GUI"), AG_BOX_VERT); { AG_CheckboxNewInt(tab, 0, _("Built-in key composition"), &agTextComposition); AG_CheckboxNewInt(tab, 0, _("Bidirectional"), &agTextBidi); AG_SeparatorNewHoriz(tab); AG_LabelNewS(tab, 0, _("Timer settings (milliseconds):")); AG_NumericalNewIntR(tab, 0, NULL, _("Double click delay: "), &agMouseDblclickDelay, 1, 10000); AG_NumericalNewIntR(tab, 0, NULL, _("Cursor spin delay: "), &agMouseSpinDelay, 1, 10000); AG_NumericalNewIntR(tab, 0, NULL, _("Cursor spin interval: "), &agMouseSpinIval, 1, 10000); AG_NumericalNewIntR(tab, 0, NULL, _("Key repeat delay: "), &agKbdDelay, 1, 1000); AG_NumericalNewIntR(tab, 0, NULL, _("Key repeat interval: "), &agKbdRepeat, 1, 500); } tab = AG_NotebookAdd(nb, _("Directories"), AG_BOX_VERT); { hb = AG_BoxNewHoriz(tab, AG_BOX_HFILL); tbox = AG_TextboxNewS(hb, AG_TEXTBOX_HFILL, _("Temporary file directory: ")); AG_GetString(agConfig, "tmp-path", path, sizeof(path)); AG_TextboxSetString(tbox, path); AG_SetEvent(tbox, "textbox-return", SetPath, "%s", "tmp-path"); AG_TextboxSizeHint(tbox, "XXXXXXXXXXXXXXXXXXXX"); AG_ButtonNewFn(hb, 0, "...", SelectPath, "%s,%p", "tmp-path", tbox); hb = AG_BoxNewHoriz(tab, AG_BOX_HFILL); tbox = AG_TextboxNewS(hb, AG_TEXTBOX_HFILL, _("Dataset save directory: ")); AG_GetString(agConfig, "save-path", path, sizeof(path)); AG_TextboxSetString(tbox, path); AG_SetEvent(tbox, "textbox-return", SetPath, "%s", "save-path"); AG_ButtonNewFn(hb, 0, "...", SelectPath, "%s,%p", "save-path", tbox); hb = AG_BoxNewHoriz(tab, AG_BOX_HFILL); tbox = AG_TextboxNewS(hb, AG_TEXTBOX_HFILL, _("Dataset search path: ")); AG_GetString(agConfig, "load-path", path, sizeof(path)); AG_TextboxSetString(tbox, path); AG_SetEvent(tbox, "textbox-return", SetPath, "%s", "load-path"); hb = AG_BoxNewHoriz(tab, AG_BOX_HFILL); tbox = AG_TextboxNewS(hb, AG_TEXTBOX_HFILL, _("Font search path: ")); AG_GetString(agConfig, "font-path", path, sizeof(path)); AG_TextboxSetString(tbox, path); AG_SetEvent(tbox, "textbox-return", SetPath, "%s", "font-path"); } #if 0 tab = AG_NotebookAdd(nb, _("Colors"), AG_BOX_VERT); { AG_Pane *hPane; AG_HSVPal *hsv; AG_Tlist *tl; AG_TlistItem *it; AG_Label *lbl; int i; hPane = AG_PaneNew(tab, AG_PANE_HORIZ, AG_PANE_EXPAND); { tl = AG_TlistNew(hPane->div[0], AG_TLIST_EXPAND); AG_TlistSizeHint(tl, "Tileview text background", 10); for (i = 0; i < LAST_COLOR; i++) { it = AG_TlistAdd(tl, NULL, _(agColorNames[i])); it->p1 = &agColors[i]; } hsv = AG_HSVPalNew(hPane->div[1], AG_HSVPAL_EXPAND); AG_SetEvent(hsv, "h-changed", SetColor, "%p", tl); AG_SetEvent(hsv, "sv-changed", SetColor, "%p", tl); AG_SetEvent(tl, "tlist-selected", BindSelectedColor, "%p", hsv); } lbl = AG_LabelNew(tab, 0, _("Warning: Some color changes will not " "take effect until %s is restarted."), agProgName); AG_LabelSetPaddingLeft(lbl, 10); AG_LabelSetPaddingRight(lbl, 10); hb = AG_BoxNewHoriz(tab, AG_BOX_HOMOGENOUS|AG_BOX_HFILL); { AG_ButtonNewFn(hb, 0, _("Load scheme"), LoadColorSchemeDlg, NULL); AG_ButtonNewFn(hb, 0, _("Save scheme"), SaveColorSchemeDlg, NULL); } } #endif #ifdef AG_DEBUG tab = AG_NotebookAdd(nb, _("Debug"), AG_BOX_VERT); { AG_NumericalNewIntR(tab, 0, NULL, _("Debug level: "), &agDebugLvl, 0, 255); } #endif hb = AG_BoxNewHoriz(win, AG_BOX_HOMOGENOUS|AG_BOX_HFILL); { AG_ButtonNewFn(hb, 0, _("Close"), AGWINDETACH(win)); AG_ButtonNewFn(hb, 0, _("Save"), SaveConfig, NULL); } return (win); }