Exemplo n.º 1
0
static void update_playlisttable(AG_Event *event) {

        AG_Table *tbl = AG_SELF();

	if(playlistData) {
        	AG_TableBegin(tbl);

		do {
			if(playlistData->type == MPD_DATA_TYPE_SONG) 
				printf("%i, %s\n", 
				playlistData->song->id,
				playlistData->song->title);
				AG_TableAddRow(tbl, "%s:%s:%s:%i",
					playlistData->song->artist, 
					playlistData->song->title,
					format_time(playlistData->song->time),
					playlistData->song->id);

			playlistData = mpd_data_get_next(playlistData);

			/*if(mpd_data_is_last(playlistData)) {
				printf("last\n");
			}*/

		} while(playlistData);

		AG_TableEnd(tbl);
	}
}
Exemplo n.º 2
0
void AGOL_About::OnLicensePrechg(AG_Event *event)
{
	AG_Textbox *text = static_cast<AG_Textbox*>(AG_SELF());

	// Store the cursor position before change
	LicenseCursorPos = AG_TextboxGetCursorPos(text);
}
Exemplo n.º 3
0
Arquivo: combo.c Projeto: adsr/agar
static void
Return(AG_Event *event)
{
	char text[AG_TEXTBOX_STRING_MAX];
	AG_Textbox *tbox = AG_SELF();
	AG_Combo *com = AG_PTR(1);
	
	AG_ObjectLock(com->list);

	AG_TextboxCopyString(tbox, text, sizeof(text));

	if ((com->flags & AG_COMBO_ANY_TEXT) == 0) {
		AG_TlistItem *it;
	
		if (text[0] != '\0' &&
		    (it = AG_TlistSelectText(com->list, text)) != NULL) {
			AG_TextboxSetString(com->tbox, it->text);
			AG_PostEvent(NULL, com, "combo-selected", "%p", it);
		} else {
			AG_TlistDeselectAll(com->list);
			AG_TextboxSetString(com->tbox, "");
			AG_PostEvent(NULL, com, "combo-text-unknown", "%s",
			    text);
		}
	} else {
		AG_TlistDeselectAll(com->list);
		AG_PostEvent(NULL, com, "combo-text-entry", "%s", text);
	}

	AG_ObjectUnlock(com->list);
}
Exemplo n.º 4
0
Arquivo: animal.c Projeto: adsr/agar
/* Handle the "attached" event by starting our timer. */
static void
Attached(AG_Event *event)
{
	Animal *animal = AG_SELF();

	AG_ScheduleTimeout(animal, &animal->time, 1000);
}
Exemplo n.º 5
0
/* todo: zrefaktoryzowac update_*table, bo moze wystarczy jedna funckcja? */
static void update_librarytable(AG_Event *event) {

        AG_Table *tbl = AG_SELF();

	if(libraryData) {
        	AG_TableBegin(tbl);

		do {
			if(libraryData->type == MPD_DATA_TYPE_SONG)  {

				if(libraryData->song->file && 
					libraryData->song->title && 
					libraryData->song->artist ) {  
				
					AG_TableAddRow(tbl, "%s:%s:%s:%s",
					libraryData->song->artist, 
					libraryData->song->title,
					format_time(libraryData->song->time),
					libraryData->song->file); 
				}
			}
			libraryData = mpd_data_get_next(libraryData);
		} while(libraryData);

		AG_TableEnd(tbl);
	}
}
Exemplo n.º 6
0
Arquivo: glview.c Projeto: adsr/agar
static void
MouseButtonDown(AG_Event *event)
{
    AG_GLView *glv = AG_SELF();

    AG_WidgetFocus(glv);
}
Exemplo n.º 7
0
static void
MouseButtonUp(AG_Event *event)
{
	AG_HSVPal *pal = AG_SELF();

	pal->state = AG_HSVPAL_SEL_NONE;
}
Exemplo n.º 8
0
static void
OnFocusLoss(AG_Event *event)
{
	AG_Slider *sl = AG_SELF();

	AG_DelTimer(sl, &sl->moveTo);
}
Exemplo n.º 9
0
static void
Bound(AG_Event *event)
{
	AG_HSVPal *hsv = AG_SELF();
	AG_Variable *V = AG_PTR(1);

	if (AG_VARIABLE_TYPE(V) == AG_VARIABLE_UINT32 &&
	    strcmp(V->name, "pixel") == 0) {
#if 0
		hsv->flags |= AG_HSVPAL_PIXEL;
#endif
		UpdateHSVFromPixel(hsv, *(Uint32 *)V->data.p);
	} else if (strcmp(V->name, "RGBAv") == 0) {
		UpdateHSVFromRGBAv(hsv);
	} else if (strcmp(V->name, "RGBv") == 0) {
		UpdateHSVFromRGBv(hsv);
	} else if (strcmp(V->name, "pixel-format") == 0) {
		if (!(hsv->flags & AG_HSVPAL_FORCE_NOALPHA)) {
			AG_PixelFormat **pFormat = (AG_PixelFormat **)V->data.p;
			if ((*pFormat)->Amask != 0) {
				hsv->flags &= ~(AG_HSVPAL_NOALPHA);
			} else {
				hsv->flags |= AG_HSVPAL_NOALPHA;
			}
		}
	}
	AG_Redraw(hsv);
}
Exemplo n.º 10
0
static void
KeyDown(AG_Event *event)
{
	AG_Button *bu = AG_SELF();
	AG_Variable *binding;
	void *pState;
	int keysym = AG_INT(1);
	
	if (AG_WidgetDisabled(bu))
		return;
	if (keysym != AG_KEY_RETURN &&		/* TODO AG_Action */
	    keysym != AG_KEY_KP_ENTER &&
	    keysym != AG_KEY_SPACE) {
		return;
	}
	binding = AG_GetVariable(bu, "state", &pState);
	SetState(bu, binding, pState, 1);
	AG_PostEvent(NULL, bu, "button-pushed", "%i", 1);
	bu->flags |= AG_BUTTON_KEYDOWN;

	if (bu->flags & AG_BUTTON_REPEAT) {
		AG_DelTimer(bu, &bu->repeatTo);
		AG_AddTimer(bu, &bu->delayTo, agKbdDelay,
		    ExpireDelay, "%i", agKbdRepeat);
	}
	AG_UnlockVariable(binding);
}
Exemplo n.º 11
0
static void
MouseButtonUp(AG_Event *event)
{
	AG_Button *bu = AG_SELF();
	int button = AG_INT(1);
	AG_Variable *binding;
	void *pState;
	int x = AG_INT(2);
	int y = AG_INT(3);
		
	if (bu->flags & AG_BUTTON_REPEAT) {
		AG_DelTimer(bu, &bu->repeatTo);
		AG_DelTimer(bu, &bu->delayTo);
		return;
	}
	
	if (AG_WidgetDisabled(bu) ||
	    x < 0 || y < 0 ||
	    x > WIDGET(bu)->w || y > WIDGET(bu)->h) {
		return;
	}
	
	binding = AG_GetVariable(bu, "state", &pState);
	if (GetState(bu, binding, pState) && button == AG_MOUSE_LEFT &&
	    !(bu->flags & AG_BUTTON_STICKY)) {
	    	SetState(bu, binding, pState, 0);
		AG_PostEvent(NULL, bu, "button-pushed", "%i", 0);
	}
	AG_UnlockVariable(binding);
}
Exemplo n.º 12
0
static void
MouseButtonDown(AG_Event *event)
{
	AG_Button *bu = AG_SELF();
	int button = AG_INT(1);
	AG_Variable *binding;
	void *pState;
	int newState;
	
	if (AG_WidgetDisabled(bu))
		return;

	if (!AG_WidgetIsFocused(bu))
		AG_WidgetFocus(bu);

	if (button != AG_MOUSE_LEFT)
		return;
	
	binding = AG_GetVariable(bu, "state", &pState);
	if (!(bu->flags & AG_BUTTON_STICKY)) {
		SetState(bu, binding, pState, 1);
	} else {
		newState = !GetState(bu, binding, pState);
		SetState(bu, binding, pState, newState);
		AG_PostEvent(NULL, bu, "button-pushed", "%i", newState);
	}
	AG_UnlockVariable(binding);

	if (bu->flags & AG_BUTTON_REPEAT) {
		AG_DelTimer(bu, &bu->repeatTo);
		AG_PostEvent(NULL, bu, "button-pushed", "%i", 1);
		AG_AddTimer(bu, &bu->delayTo, agMouseSpinDelay,
		    ExpireDelay, "%i", agMouseSpinIval);
	}
}
Exemplo n.º 13
0
Arquivo: textbox.c Projeto: adsr/agar
static void
MouseButtonDown(AG_Event *event)
{
	AG_Textbox *tb = AG_SELF();
	AG_WidgetFocus(tb);
	AG_ForwardEvent(NULL, tb->ed, event);
}
Exemplo n.º 14
0
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);

}
Exemplo n.º 15
0
static void
MouseMotion(AG_Event *event)
{
	AG_HSVPal *pal = AG_SELF();
	int x = AG_INT(1);
	int y = AG_INT(2);

	switch (pal->state) {
	case AG_HSVPAL_SEL_NONE:
		break;
	case AG_HSVPAL_SEL_H:
		UpdateHue(pal,
		    x - pal->circle.x,
		    y - pal->circle.y);
		break;
	case AG_HSVPAL_SEL_SV:
		UpdateSV(pal, x, y);
		break;
	case AG_HSVPAL_SEL_A:
		UpdateAlpha(pal, x);
		break;
	default:
		break;
	}
}
Exemplo n.º 16
0
Arquivo: glview.c Projeto: adsr/agar
static void
WidgetMoved(AG_Event *event)
{
    AG_GLView *glv = AG_SELF();

    glv->flags |= AG_GLVIEW_RESHAPE;
}
Exemplo n.º 17
0
static void OnChangeTotalVolume(AG_Event *event)
{
	AG_Slider *self = (AG_Slider *)AG_SELF();
	struct gui_sound *cfg = AG_PTR(1);
	if(cfg == NULL) return;
	SetTotalVolume(cfg->iTotalVolume);
}
Exemplo n.º 18
0
/* Keystroke event handler */
static void
KeyUp(AG_Event *event)
{
	formaText *my = (formaText*)AG_SELF();
	int keysym = AG_INT(1);

	/* ... */
}
Exemplo n.º 19
0
static void
OnShow(AG_Event *event)
{
	AG_Button *bu = AG_SELF();

	if ((bu->flags & AG_BUTTON_EXCL) == 0)
		AG_RedrawOnChange(bu, 100, "state");
}
Exemplo n.º 20
0
Arquivo: animal.c Projeto: adsr/agar
/*
 * Example of an event handler function. Event handlers use a stack of
 * arguments. Both AG_SetEvent() and AG_PostEvent() can push arguments
 * onto this stack.
 */
static void
Die(AG_Event *event)
{
	Animal *animal = AG_SELF();
	AG_Object *killer = AG_SENDER();

	printf("%s: killed by %s!\n", AGOBJECT(animal)->name, killer->name);
}
Exemplo n.º 21
0
/* Delay/repeat timer callbacks for AG_BUTTON_REPEAT */
static Uint32
ExpireRepeat(AG_Timer *to, AG_Event *event)
{
	AG_Button *bu = AG_SELF();

	AG_PostEvent(NULL, bu, "button-pushed", "%i", 1);
	return (to->ival);
}
Exemplo n.º 22
0
/* Keystroke event handler */
static void
KeyDown(AG_Event *event)
{
	formaText *my = (formaText*)AG_SELF();
	int keysym = AG_INT(1);

	printf("Keystroke: 0x%x\n", keysym);
}
Exemplo n.º 23
0
void
MapMoveFunction(AG_Event *event)
{
        void *p=AG_SELF();
    int cursorX=AG_INT(1);
    int cursorY=AG_INT(2);

};
Exemplo n.º 24
0
static Uint32
ExpireDelay(AG_Timer *to, AG_Event *event)
{
	AG_Button *bu = AG_SELF();
	int repeatIval = AG_INT(1);

	AG_AddTimer(bu, &bu->repeatTo, repeatIval, ExpireRepeat, NULL);
	return (0);
}
Exemplo n.º 25
0
static void XM7_DbgMMRDrawFn(AG_Event *event)
{
   XM7_SDLView *view = (XM7_SDLView *)AG_SELF();
    struct XM7_DbgMMRDump *p = (struct XM7_DbgMMRDump *)AG_PTR(1);
    BOOL forceredraw = AG_INT(2);

    if(p == NULL) return;
    XM7_ConsoleUpdate(view, p->cons, forceredraw);
}
Exemplo n.º 26
0
/* Mouse motion event handler */
static void
MouseMotion(AG_Event *event)
{
	formaText *my = (formaText*)AG_SELF();
	int x = AG_INT(1);
	int y = AG_INT(2);

	/* ... */
}
Exemplo n.º 27
0
static void
OnAttach(AG_Event *event)
{
	AG_HSVPal *pal = AG_SELF();
	
	pal->pixel = AG_MapPixelRGBA(agSurfaceFmt, 0,0,0,255);
	pal->color = AG_ColorRGBA(0,0,0,255);
	AG_BindPointer(pal, "pixel-format", (void *)&agSurfaceFmt);
}
Exemplo n.º 28
0
static void OnChangeVolume(AG_Event *event)
{
	AG_Slider *self = (AG_Slider *)AG_SELF();
	struct gui_sound *cfg = AG_PTR(1);
	
	if(cfg == NULL) return;
	SetSoundVolume2(cfg->uChSeparation, cfg->nFMVolume,
			cfg->nPSGVolume, cfg->nBeepVolume,
			cfg->nCMTVolume, cfg->nWaveVolume);
}
Exemplo n.º 29
0
/* Mouse click event handler */
static void
MouseButtonUp(AG_Event *event)
{
	formaText *my = (formaText*)AG_SELF();
	int button = AG_INT(1);
	int x = AG_INT(2);
	int y = AG_INT(3);

	/* ... */
}
Exemplo n.º 30
0
Arquivo: ucombo.c Projeto: adsr/agar
static void
OnDetach(AG_Event *event)
{
	AG_UCombo *com = AG_SELF();

	if (com->panel != NULL) {
		AG_ObjectDetach(com->list);
		AG_ObjectDetach(com->panel);
		com->panel = NULL;
	}
}