Beispiel #1
0
AG_Window *
DEV_UnicodeBrowser(void)
{
	AG_Window *win;
	AG_Combo *comRange;
	AG_Treetbl *tt;
	int i, w, wMax = 0;

	if ((win = AG_WindowNewNamedS(0, "DEV_UnicodeBrowser")) == NULL) {
		return (NULL);
	}
	AG_WindowSetCaptionS(win, _("Unicode Browser"));
	AG_WindowSetCloseAction(win, AG_WINDOW_DETACH);

	comRange = AG_ComboNew(win, AG_COMBO_HFILL, _("Range: "));
	for (i = 0; i < unicodeRangeCount; i++) {
		AG_TextSize(unicodeRanges[i].name, &w, NULL);
		if (w > wMax) { wMax = w; }
		AG_TlistAddPtr(comRange->list, NULL, unicodeRanges[i].name,
		    (void *)&unicodeRanges[i]);
	}
	AG_ComboSizeHintPixels(comRange, wMax, 10);
	
	tt = AG_TreetblNew(win, AG_TREETBL_EXPAND, NULL, NULL);
	AG_TreetblSizeHint(tt, 200, 6);
	AG_TreetblAddCol(tt, 0, "<XXXXXXX>", "Char");
	AG_TreetblAddCol(tt, 1, "<XXXXXXX>", "Hex");

	AG_SetEvent(comRange, "combo-selected", SelectUnicodeRange, "%p", tt);

	AG_WidgetFocus(comRange);
	return (win);
}
Beispiel #2
0
static void
EditNumValues(AG_Event *event)
{
	AG_HSVPal *pal = AG_PTR(1);
	AG_Window *pwin;
	AG_Window *win;
	AG_Numerical *num;
	AG_Variable *b1, *b2;
	float v;

	if ((pwin = AG_ParentWindow(pal)) == NULL)
		return;

	if ((win = AG_WindowNewNamed(AG_WINDOW_NOMAXIMIZE, "hsvpal-%p-numedit",
	    pal)) == NULL) {
		return;
	}
	AG_WindowSetCaption(win, _("Color values"));
	AG_WindowSetPosition(win, AG_WINDOW_LOWER_LEFT, 0);
	AG_WindowSetCloseAction(win, AG_WINDOW_DETACH);
	{
		AG_Variable *bAlpha;
		void *pAlpha;

		num = AG_NumericalNew(win, 0, NULL, _("Hue: "));
		AG_NumericalSizeHint(num, "000");
		AG_WidgetCopyBinding(num, "value", pal, "hue");
		AG_NumericalSetRange(num, 0.0, 359.0);
		AG_NumericalSetIncrement(num, 1);
		AG_NumericalSetPrecision(num, "f", 0);
		
		num = AG_NumericalNew(win, 0, NULL, _("Saturation: "));
		AG_NumericalSizeHint(num, "00.00");
		AG_WidgetCopyBinding(num, "value", pal, "saturation");
		AG_NumericalSetRange(num, 0.0, 1.0);
		AG_NumericalSetIncrement(num, 0.01);
		AG_NumericalSetPrecision(num, "f", 2);

		num = AG_NumericalNew(win, 0, NULL, _("Value: "));
		AG_NumericalSizeHint(num, "00.00");
		AG_WidgetCopyBinding(num, "value", pal, "value");
		AG_NumericalSetRange(num, 0.0, 1.0);
		AG_NumericalSetIncrement(num, 0.01);
		AG_NumericalSetPrecision(num, "f", 2);

		num = AG_NumericalNew(win, 0, NULL, _("Alpha: "));
		AG_NumericalSizeHint(num, "0.000");
		AG_WidgetCopyBinding(num, "value", pal, "alpha");
		bAlpha = AG_GetVariable(pal, "alpha", &pAlpha);
		switch (AG_VARIABLE_TYPE(bAlpha)) {
		case AG_VARIABLE_FLOAT:
		case AG_VARIABLE_DOUBLE:
			AG_NumericalSetRange(num, 0.0, 1.0);
			AG_NumericalSetIncrement(num, 0.005);
			AG_NumericalSetPrecision(num, "f", 3);
			break;
		case AG_VARIABLE_INT:
		case AG_VARIABLE_UINT:
		case AG_VARIABLE_UINT8:
			AG_NumericalSetRange(num, 0.0, 255.0);
			AG_NumericalSetIncrement(num, 1.0);
			AG_NumericalSetPrecision(num, "f", 0);
			break;
		default:
			break;
		}
		AG_UnlockVariable(bAlpha);
	}

	AG_WindowAttach(pwin, win);
	AG_WindowShow(win);
}
Beispiel #3
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);
}