void Create_AGMainBar(AG_Widget *Parent) { AG_MenuItem *item; // MenuBar = AG_MenuNew(Parent, AG_MENU_HFILL); // MenuBar = AG_MenuNewGlobal(AG_MENU_HFILL); if(!MenuBar) return; AG_LockVFS(AGOBJECT(MenuBar)); item = AG_MenuNode(MenuBar->root , gettext("File"), NULL); Create_FileMenu(item); item = AG_MenuNode(MenuBar->root, gettext("Drive 1"), NULL); Create_Drive1Menu(item); item = AG_MenuNode(MenuBar->root, gettext("Drive 0"), NULL); Create_Drive0Menu(item); item = AG_MenuNode(MenuBar->root, gettext("Tape"), NULL); Create_TapeMenu(item); item = AG_MenuNode(MenuBar->root, gettext("Debug"), NULL); Create_DebugMenu(item); item = AG_MenuNode(MenuBar->root, gettext("Tools"), NULL); Create_ToolsMenu(item); item = AG_MenuNode(MenuBar->root, gettext("Help"), NULL); Create_HelpMenu(item); item = AG_MenuNode(MenuBar->root, gettext("About"), NULL); Create_AboutMenu(item); AG_UnlockVFS(AGOBJECT(MenuBar)); // F12 -> Menu 閉じる AG_ActionFn(AGWIDGET(MenuBar), "close-menu", UnraiseMenu, NULL); AG_ActionOnKeyDown(AGWIDGET(MenuBar), AG_KEY_F12, AG_KEYMOD_NONE, "close-menu"); }
static void PollWidgets(AG_Event *event) { AG_Tlist *tl = AG_SELF(); AG_Driver *drv = WIDGET(tl)->drv; AG_Window *win; AG_TlistClear(tl); AG_LockVFS(drv); AG_FOREACH_WINDOW_REVERSE(win, drv) { FindWindows(tl, win, 0); }
void drawAgar() { AG_Window *win; if (AG_TIMEOUTS_QUEUED()) AG_ProcessTimeouts(AG_GetTicks()); // do not draw windows in screensaver mode if (!view.screenSaver) { AG_LockVFS(&agDrivers); AG_BeginRendering(agDriverSw); AG_FOREACH_WINDOW(win, agDriverSw) { AG_ObjectLock(win); AG_WindowDraw(win); AG_ObjectUnlock(win); }
/* * Dump the display surface(s) to a jpeg in ~/.appname/screenshot/. * It is customary to assign a AG_GlobalKeys(3) shortcut for this function. */ void AG_ViewCapture(void) { AG_Surface *s; char *pname; char dir[AG_PATHNAME_MAX]; char file[AG_PATHNAME_MAX]; Uint seq; if (agDriverSw == NULL) { Verbose("AG_ViewCapture() is not implemented under " "multiple-window drivers\n"); return; } AG_LockVFS(&agDrivers); if (AGDRIVER_SW_CLASS(agDriverSw)->videoCapture(agDriverSw, &s) == -1) { Verbose("Capture failed: %s\n", AG_GetError()); goto out; } /* Save to a new file. */ AG_GetString(agConfig, "save-path", dir, sizeof(dir)); Strlcat(dir, AG_PATHSEP, sizeof(dir)); Strlcat(dir, "screenshot", sizeof(dir)); if (!AG_FileExists(dir) && AG_MkPath(dir) == -1) { Verbose("Capture failed: %s\n", AG_GetError()); goto out; } pname = (agProgName != NULL) ? agProgName : "agarapp"; for (seq = 0; ; seq++) { Snprintf(file, sizeof(file), "%s%c%s%u.jpg", dir, AG_PATHSEPCHAR, pname, seq++); if (!AG_FileExists(file)) break; /* XXX race condition */ } if (AG_SurfaceExportJPEG(s, file) == 0) { Verbose("Saved capture to: %s\n", file); } else { Verbose("Capture failed: %s\n", AG_GetError()); } AG_SurfaceFree(s); out: AG_UnlockVFS(&agDrivers); }