예제 #1
0
static int nasluch(GOC_HANDLER uchwyt, GOC_MSG wiesc, void *pBuf, unsigned int nBuf)
{
	if ( uchwyt == GOC_HANDLER_SYSTEM )
	{
		if ( wiesc == GOC_MSG_CHAR )
		{
			if ( nBuf == 27 )
				return GOC_ERR_OK;
		}
	}
	else if ( uchwyt == lLista )
	{
		if ( wiesc == GOC_MSG_CHAR )
		{
			if ( nBuf == 0x0D )
			{
				char *selFile = goc_listGetUnderCursor( lLista );
				if ( selFile )
					doAction(ACTION_PLAY, selFile);
				return GOC_ERR_OK;
			}
			else if ( nBuf == 0x116 )
			{
				int pos = goc_listGetCursor(lLista);
				if ( pos > 0 )
				{
					int size = 0;
					const char **ptr;
					doAction(ACTION_PLAYLIST_REMOVEFILE, &pos);
					doAction(ACTION_PLAYLIST_GETSIZE, &size);
					doAction(ACTION_PLAYLIST_GETTABLE, &ptr);
					goc_listSetExtTable(lLista, ptr, size);
					doAction(ACTION_PLAYLIST_GETACTUAL, &size);
					goc_sellistSelect(lLista, size);
					goc_listSetCursor(lLista, pos);
//		goc_elementOrFlag(lLista, GOC_EFLAGA_PAINTED | GOC_EFLAGA_ENABLE);
//		goc_systemFocusOn(lLista);
					goc_systemSendMsg(lLista, GOC_MSG_PAINT, 0, 0);
				}
				return GOC_ERR_OK;
			}
		}
		else if ( wiesc == GOC_MSG_LISTCHANGE )
		{
			// TODO: Opis zaznaczonej pozycji
			return GOC_ERR_OK;
		}
	}
/*	else if ( uchwyt == pLista )
	{
		// selekcjonuj tylko katalogi do dodawania
		if ( wiesc == GOC_MSG_FILELISTADDFILE )
		{
			if ( nBuf != GOC_FILELISTFLAG_FOLDER )
				return GOC_ERR_REFUSE;
		}
	}*/
	return goc_systemDefaultAction(uchwyt, wiesc, pBuf, nBuf);
}
예제 #2
0
static int nasluch(GOC_HANDLER uchwyt, GOC_MSG wiesc, void *pBuf, unsigned int nBuf)
{
	if ( wiesc == GOC_MSG_TIMERTICK )
	{
		goc_systemSendMsg(uchwyt, GOC_MSG_PAINT, 0, 0);
		return GOC_ERR_OK;
	}
	return goc_systemDefaultAction(uchwyt, wiesc, pBuf, nBuf);
}
예제 #3
0
static int nasluchForm(
	GOC_HANDLER uchwyt, GOC_MSG wiesc, void *pBuf, unsigned int nBuf)
{
	if ( wiesc == GOC_MSG_ACTION )
	{
		goc_formShow( forma );
		return GOC_ERR_OK;
	}
	return goc_systemDefaultAction(uchwyt, wiesc, pBuf, nBuf);
}
예제 #4
0
static int nasluchOk(
	GOC_HANDLER uchwyt, GOC_MSG wiesc, void *pBuf, unsigned int nBuf)
{
	if ( wiesc == GOC_MSG_ACTION )
	{
		goc_labelRemLines( napis );
		goc_labelAddLine( napis, "Formularz wype³niono" );
		goc_formHide( forma );
		return GOC_ERR_OK;
	}
	return goc_systemDefaultAction(uchwyt, wiesc, pBuf, nBuf);
}
예제 #5
0
파일: common.c 프로젝트: rojekabc/okienkoc
static int buildCommonListener(GOC_HANDLER uchwyt, GOC_StMessage* msg)
{
	if ( msg->id == GOC_MSG_MAPGETCHAR_ID )
	{
		// here is our own organization
		GOC_StMsgMapChar* msgchar = (GOC_StMsgMapChar*)msg;
		// goc_systemDefaultAction(uchwyt, msg);
		switch ( msgchar->position & 0x0F ) {
			case 0x00: msgchar->charcode = 0; break;
			case 0x01: msgchar->charcode = 'S'; break;
			case 0x02: msgchar->charcode = 'f'; break;
			case 0x03: msgchar->charcode = 'O'; break;
			case 0x04: msgchar->charcode = 'L'; break;
			case 0x05: msgchar->charcode = 'o'; break;
			case 0x06: msgchar->charcode = '#'; break;
			case 0x07: msgchar->charcode = '0'; break;
			case 0x08: msgchar->charcode = '-'; break;
			case 0x09: msgchar->charcode = '|'; break;
		}
		switch (msgchar->position & 0xF0) {
			case FLAG_GREEN: msgchar->charcolor=GOC_GREEN | GOC_FBOLD; break;
			case FLAG_RED: msgchar->charcolor=GOC_RED | GOC_FBOLD; break;
			default: msgchar->charcolor=GOC_WHITE; break;
		}
		return GOC_ERR_OK;
	}
	else if ( msg->id == GOC_MSG_POSMAPFREEPOINT_ID )
	{
		/* TODO FREE
		switch ( punkt->value )
		{
			case 0x03:
				cityFree((StCity*)punkt);
				break;
			case 0x07:
				capitalFree((StCapital*)punkt);
				break;
			case 0x04:
				airportFree((StAirport*)punkt);
				break;
			case 0x02:
				factoryFree((StFactory*)punkt);
				break;
			case 0x01:
				supplyFree((StSupply*)punkt);
				break;
			case 0x06:
				fortFree((StFort*)punkt);
				break;
			case 0x05:
				villageFree((StVillage*)punkt);
				break;
			case 0x08:
				bridgehFree((StBridgeH*)punkt);
				break;
			case 0x09:
				bridgevFree((StBridgeV*)punkt);
				break;
			default:
				goc_systemDefaultAction(uchwyt, wiesc, pBuf, nBuf);
				break;
		}
		*/
		return GOC_ERR_OK;
	}
	return goc_systemDefaultAction(uchwyt, msg);
}
예제 #6
0
파일: common.c 프로젝트: rojekabc/okienkoc
static int mapaCommonListener(GOC_HANDLER uchwyt, GOC_StMessage *msg)
{
	if ( msg->id == GOC_MSG_CURSORCHANGE_ID )
	{
		GOC_StMsgMapPoint* msgp = (GOC_StMsgMapPoint*)msg;
		char buf[80];
		GOC_StValuePoint *v;
		int p;
		StAirport* airport = NULL;

		goc_labelRemLines(labelDesc);
		p = goc_maparawGetPoint(terrain, msgp->x, msgp->y);
		memset(buf, 0, 80);
		switch ( p )
		{
			case 0:
				sprintf(buf, "Terrain: forrest" );
				break;
			case 1:
				sprintf(buf, "Terrain: clear" );
				break;
			case 2:
				sprintf(buf, "Terrain: river" );
				break;
			case 3:
				sprintf(buf, "Terrain: mountains" );
				break;
			default:
				sprintf(buf, "Terrain: unknown" );
				break;
		}
		goc_labelAddLine(labelDesc, buf);
		v = goc_mapaposReadPoint(build, msgp->x, msgp->y);
		memset(buf, 0, 80);
		if ( v != NULL )
		{
			switch ( v-> value & 0x0F )
			{
				case 0x00:
					sprintf(buf, "");
					break;
				case 0x01:
					sprintf(buf, "Build: Supply");
					break;
				case 0x02:
					sprintf(buf, "Build: Factory");
					break;
				case 0x03:
					sprintf(buf, "Build: City");
					break;
				case 0x04:
					sprintf(buf, "Build: Airport");
					airport = (StAirport*)FROMGOC(v);
					break;
				case 0x05:
					sprintf(buf, "Build: Village");
					break;
				case 0x06:
					sprintf(buf, "Build: Fort");
					break;
				case 0x07:
					sprintf(buf, "Build: Capital");
					break;
				case 0x08:
				case 0x09:
					sprintf(buf, "Build: Bridge");
					break;
				default:
					sprintf(buf, "Build: unknown" );
					break;
			}
		}
		if ( strlen(buf) )
			goc_labelAddLine(labelDesc, buf);
		if ( airport )
		{
			int i;
			for (i=0; i<airport->nfly; i++)
			{
				sprintf(buf, "  %-20s [%1s:%1d]",
					airport->pfly[i]->pilotName,
					airport->pfly[i]->cname == cn_Fighter ? "F" : "B",
					airport->pfly[i]->pilotExp/10);
				goc_labelAddLine(labelDesc, buf);
			}

		}
		memset(buf, 0, 80);
		if ( v != NULL ) {
			switch ( v->value & 0xF0 )
			{
				case 0x00:
					break;
				case 0x10:
					sprintf(buf, "Front: green power" );
					break;
				case 0x20:
					sprintf(buf, "Front: red power" );
					break;
				case 0x30:
					sprintf(buf, "Front: none power" );
					break;
				default:
					sprintf(buf, "Front: unknown" );
					break;
			}
		}
		if ( strlen( buf ) )
			goc_labelAddLine(labelDesc, buf);
		goc_systemClearArea(labelDesc);
		GOC_MSG_PAINT( msgPaint );
		goc_systemSendMsg(labelDesc, msgPaint);
		return GOC_ERR_OK;
	}
	return goc_systemDefaultAction(uchwyt, msg);
}