Пример #1
0
void Storage::Crc32Check(const HANDLE &rDataFileHandle)
{
    Log.Notice(__FUNCTION__, "Checking integrity of data file. This can take some time.");
    
    size_t dataIndexesSize;
    WriteInfoVec rInfo;
    
    //
    dataIndexesSize = m_dataIndexes.size();
    
    //fill list
    rInfo.reserve(dataIndexesSize);
    for(RecordIndexMap::const_iterator itr = m_dataIndexes.begin();itr != m_dataIndexes.end();++itr)
    {
        rInfo.push_back(WriteInfo(itr->first, itr->second.m_recordStart));
    }
    
    //sort by record pos
    tbb::parallel_sort(rInfo.begin(), rInfo.end(), &SortWriteInfoForCRC32Check);
    
    //start paraller crc32
    tbb::affinity_partitioner rAp;
    size_t grainsize = std::max<size_t>(1, rInfo.size() / g_cfg.MaxParallelReadTasks);
    tbb::parallel_for(tbb::blocked_range<uint64>(0, rInfo.size(), grainsize), StorageCrc32Check(m_dataIndexes, rInfo, m_rDataPath), rAp);
    
    Log.Notice(__FUNCTION__, "Finished checking integrity of data file.");
}
Пример #2
0
void asCBuilder::CompileFunctions()
{
	// Compile each function
	for( asUINT n = 0; n < functions.GetLength(); n++ )
	{
		asCCompiler compiler;

		int r, c;
		functions[n]->script->ConvertPosToRowCol(functions[n]->node->tokenPos, &r, &c);
		asCString str = module->scriptFunctions[n]->GetDeclaration(engine);
		str.Format(TXT_COMPILING_s, str.AddressOf());
		WriteInfo(functions[n]->script->name.AddressOf(), str.AddressOf(), r, c, true);

		if( compiler.CompileFunction(this, functions[n]->script, functions[n]->node) >= 0 )
		{
			// Copy byte code to the registered function
			module->scriptFunctions[n]->byteCode.SetLength(compiler.byteCode.GetSize());
			compiler.byteCode.Output(module->scriptFunctions[n]->byteCode.AddressOf());
			module->scriptFunctions[n]->stackNeeded = compiler.byteCode.largestStackUsed;
			module->scriptFunctions[n]->lineNumbers = compiler.byteCode.lineNumbers;

			module->scriptFunctions[n]->objVariablePos = compiler.objVariablePos;
			module->scriptFunctions[n]->objVariableTypes = compiler.objVariableTypes;

#ifdef AS_DEBUG
			// DEBUG: output byte code
			compiler.byteCode.DebugOutput(("__" + functions[n]->name + ".txt").AddressOf(), module, engine);
#endif
		}

		preMessage = "";
	}
}
Пример #3
0
int MSGinput(int len, char *buffer)
{
	extern MP_MSG msg;
	extern STATUS_WERTE sta;
	extern int sprache;

	char *to_buffers[MAX_MENU_ITEMS];
	int  status = MPOK;

	status = UtilSplitMenubuffer(buffer, to_buffers, (char)NULL);
	if (status != MPOK)
		{
		UtilMsg((int)MPE_CUTBUFFERIN, MSGTYP_ERROR, NULL);
		msg.msg_id=(int)_UNDEF;
		return((int)MPERROR);
		}

	if (ACTIONTYP == (unsigned char)INSERT)
		msg.msg_id=(int)_UNDEF;


	if (*to_buffers[MMSG_NR] != NULL)
		msg.msg_id = atoi(to_buffers[MMSG_NR]);
	else
		msg.msg_id = (int)_UNDEF;

	if (*to_buffers[MMSG_SPR] != NULL)
		msg.s_id = sprache;
	else
		msg.s_id = sprache;

	/* Meldungstyp setzen - default ist Typ MESSAGE */
	sta.typ = (int)_MSGTYP;
	if (getAttribut((int)_MSGTYP, to_buffers[MMSG_TYP]) != (int)MPERROR)
		msg.msg_typ = sta.sta_id;
	else
		msg.msg_typ = (int)MSGTYP_MSG; /* default */

	/* initialisiere Textsegment */
	msg.textnr = 0;
	*msg.text = NULL;

	/* insert/update a msg or delete a msg */
	if (msg.msg_id != (int)_UNDEF)
		{
		status = MPAPIdeleteEntry((int)_MSG, (char *)&msg);
		if ((ACTIONTYP == (unsigned char)INSERT ||
			 ACTIONTYP == (unsigned char)UPDATE) &&
			 status != (int)MPERROR)
			status = MsgTextWrite(&msg, to_buffers[MMSG_TXT]);

		if (status != (int)MPERROR)
			(void)WriteInfo((int)_MSG, (char *)&msg, buffer);
		else
			msg.msg_id = (int)_UNDEF;
		}

	UtilSplitFreeMenubuffer(to_buffers);
	return(status);
}
Пример #4
0
int PRGinput(int len , char *buffer )
{
	extern PROGRAMM prg;
	extern BEZEICHNUNG bez;
	extern TEXTE txt;
	extern SAISON sai;
	extern int sprache;

	char *to_buffers[MAX_MENU_ITEMS];
	int status=(int)MPOK;

	status = UtilSplitMenubuffer(buffer, to_buffers, (char)NULL );
	if (status != (int)MPOK )
		{
		UtilMsg((int)MPE_CUTBUFFERIN, MSGTYP_ERROR, NULL);
		prg.prg_id = (int)_UNDEF;
		return((int)MPERROR);
		}

	if (ACTIONTYP == (unsigned char)INSERT)
		{
		prg.prg_id = (int)_UNDEF;
		prg.textid = (int)_UNDEF;
		txt.textid = (int)_UNDEF;
		}

	bez.s_id = (int)sprache;
	bez.typ = (int)_PROGRAMM;
	(void)copyTextTo( bez.bez, to_buffers[MPRG_BEZ], (int)_CHAR30 );
	if (*bez.bez != NULL )
		{
		if ( *to_buffers[MPRG_SAI] != NULL )
			prg.sai_id = (int)MPAPIselectEntry( (int)_SAISON, to_buffers[MPRG_SAI],
			   (char *)&sai, sizeof( SAISON ), sizeof( prg.sai_id ) );
		else
			prg.sai_id = (int)_UNDEF;

     	(void)copyTextTo(prg.code, to_buffers[MPRG_CODE], (int)_KRZLLEN);

		txt.typ = (int)_PROGRAMM;
		txt.s_id = (int)sprache;
		txt.textid = prg.textid;
		prg.textid = xTxtWrite( to_buffers[MPRG_TXT] );

		status = WriteEntry( (int)_PROGRAMM, (char *)&prg, &bez );
		if ( status == (int)MPERROR )
			prg.prg_id = (int)_UNDEF;
		else
			(void)WriteInfo((int)_PROGRAMM, (char *)&prg, buffer);
		}
	else
		{
		UtilMsg((int)MSG2, MSGTYP_ERROR, NULL);
		prg.prg_id = (int)_UNDEF;
		status = (int)MPERROR;
		}

	UtilSplitFreeMenubuffer( to_buffers );
	return( status );
}
Пример #5
0
void asCBuilder::WriteWarning(const char *scriptname, const char *message, int r, int c)
{
	numWarnings++;

	// Need to pass the preMessage first
	if( preMessage.isSet )
		WriteInfo(scriptname, preMessage.message.AddressOf(), preMessage.r, preMessage.c, false);

	engine->CallMessageCallback(scriptname, r, c, asMSGTYPE_WARNING, message);
}
Пример #6
0
int KOLTinput(int len, char *buffer)
{
	extern KOLLEKTIV_TYP kolt;
	extern BEZEICHNUNG bez;
	extern TEXTE txt;
	extern int sprache;

	char *to_buffers[MAX_MENU_ITEMS];
	int status=(int)MPOK;

	status = UtilSplitMenubuffer(buffer, to_buffers, (char)NULL);
	if (status != MPOK)
		{
		UtilMsg((int)MPE_CUTBUFFERIN, MSGTYP_ERROR, NULL);
		kolt.k_typ_id = (int)_UNDEF;
		return((int)MPERROR);
		}

	if (ACTIONTYP == (unsigned char)INSERT)
		{
		kolt.k_typ_id=(int)_UNDEF;
		kolt.textid=(int)_UNDEF;
		txt.textid=(int)_UNDEF;
		}

	bez.s_id=(int)sprache;
	bez.typ=(int)_KOLLEKTIV_TYP;
	(void)copyTextTo(bez.bez, to_buffers[MKOLT_BEZ], (int)_BEZLEN);
	if (*bez.bez != NULL)
		{
		(void)copyTextTo(kolt.kolcode, to_buffers[MKOLT_CODE], (int)_CHAR10);

		txt.typ=(int)_KOLLEKTIV_TYP;
		txt.s_id=sprache;
		txt.textid=kolt.textid;
		kolt.textid=xTxtWrite(to_buffers[MKOLT_TXT]);

		status=WriteEntry((int)_KOLLEKTIV_TYP, (char *)&kolt, &bez);
		if (status == (int)MPERROR)
			kolt.k_typ_id=(int)_UNDEF;
		else
			(void)WriteInfo((int)_KOLLEKTIV_TYP, (char *)&kolt, buffer);

		}
	else
		{
		UtilMsg((int)MSG2, MSGTYP_ERROR, NULL);
		kolt.k_typ_id=(int)_UNDEF;
		status=(int)MPERROR;
		}

	UtilSplitFreeMenubuffer(to_buffers);
	return(status);
}
Пример #7
0
void TarAnalog::Pack()
{
	errno_t errorCode = fopen_s(&mArchFile, mArchFilename.c_str(), "wb+"); // IZ: файл архива не надо открывать каждый раз, когда ты в него пишешь, это бьет по перфомансу
	if (errorCode != 0)
	{
		return;
	}

	for (const std::string& filename : mFiles) // IZ: range based for твой друг
	{
		WriteInArch(filename);
	}
	fclose(mArchFile);
	WriteInfo();
	ReadInfo();// дважды запись
}
Пример #8
0
static bool WriteSegData( void *_sdata, void *_start )
/****************************************************/
{
    segdata *sdata = _sdata;
    signed long *start = _start;
    signed long newpos;
    signed long pad;

    if( !sdata->isuninit && !sdata->isdead ) {
        newpos = *start + sdata->a.delta;
        if( newpos + (signed long)sdata->length <= 0 )
            return( FALSE );
        pad = newpos - COMAmountWritten;
        if( pad > 0 ) {
            PadLoad( pad );
            COMAmountWritten += pad;
            pad = 0;
        }
        WriteInfo( sdata->data - pad, sdata->length + pad );
        COMAmountWritten += sdata->length + pad;
    }
    return( FALSE );
}
Пример #9
0
LRESULT LogWindow::OnInitDialog(HWND, LPARAM)
{
	DlgResize_Init(false);

	_events.Attach(GetDlgItem(IDC_EVENTS));

	_events.AddColumn(L"Type", 1);
	_events.AddColumn(L"Timestamp", 2);
	_events.AddColumn(L"Source", 3);
	_events.AddColumn(L"Message", 4);
	
	_events.SetImageList(_imageList, LVSIL_SMALL);
	_events.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT);

	_events.SetColumnWidth(0, 75);
	_events.SetColumnWidth(1, 75);
	_events.SetColumnWidth(2, 100);
	_events.SetColumnWidth(3, LVSCW_AUTOSIZE_USEHEADER);

	WriteInfo(L"System", TEXT(OPENIM_VERSION_STRING) L" (built: " TEXT(OPENIM_BUILD_TIMESTAMP) L")", 0);

	return 0;
}
Пример #10
0
void asCBuilder::CompileGlobalVariables()
{
	bool compileSucceeded = true;

	asCByteCode finalInit;

	// Store state of compilation (errors, warning, output)
	int currNumErrors = numErrors;
	int currNumWarnings = numWarnings;

	// Backup the original message stream
	bool                       msgCallback     = engine->msgCallback;
	asSSystemFunctionInterface msgCallbackFunc = engine->msgCallbackFunc;
	void                      *msgCallbackObj  = engine->msgCallbackObj;

	// Set the new temporary message stream
	asCOutputBuffer outBuffer;
	engine->SetMessageCallback(asMETHOD(asCOutputBuffer, Callback), &outBuffer, asCALL_THISCALL);	

	asCOutputBuffer finalOutput;

	while( compileSucceeded )
	{
		compileSucceeded = false;

		int accumErrors = 0;
		int accumWarnings = 0;

		// Restore state of compilation
		finalOutput.Clear();

		for( asUINT n = 0; n < globVariables.GetLength(); n++ )
		{
			numWarnings = 0;
			numErrors = 0;
			outBuffer.Clear();
			asCByteCode init;

			sGlobalVariableDescription *gvar = globVariables[n];
			if( gvar->isCompiled == false )
			{
				if( gvar->node )
				{
					int r, c;
					gvar->script->ConvertPosToRowCol(gvar->node->tokenPos, &r, &c);
					asCString str = gvar->datatype.Format();
					str += " " + gvar->name;
					str.Format(TXT_COMPILING_s, str.AddressOf());
					WriteInfo(gvar->script->name.AddressOf(), str.AddressOf(), r, c, true);
				}

				asCCompiler comp;
				int r = comp.CompileGlobalVariable(this, gvar->script, gvar->node, gvar);
				if( r >= 0 )
				{
					// Compilation succeeded
					gvar->isCompiled = true;
					compileSucceeded = true;

					init.AddCode(&comp.byteCode);
				}

				if( gvar->isCompiled )
				{
					// Add warnings for this constant to the total build
					if( numWarnings )
					{
						currNumWarnings += numWarnings;
						if( msgCallback )
							outBuffer.SendToCallback(engine, &msgCallbackFunc, msgCallbackObj);
					}

					// Add compiled byte code to the final init and exit functions
					finalInit.AddCode(&init);
				}
				else
				{
					// Add output to final output
					finalOutput.Append(outBuffer);
					accumErrors += numErrors;
					accumWarnings += numWarnings;
				}

				preMessage.isSet = false;
			}
		}

		if( !compileSucceeded )
		{
			// Add errors and warnings to total build
			currNumWarnings += accumWarnings;
			currNumErrors += accumErrors;
			if( msgCallback )
				finalOutput.SendToCallback(engine, &msgCallbackFunc, msgCallbackObj);
		}
	}

	// Restore states
	engine->msgCallback     = msgCallback;
	engine->msgCallbackFunc = msgCallbackFunc;
	engine->msgCallbackObj  = msgCallbackObj;

	numWarnings = currNumWarnings;
	numErrors   = currNumErrors;

	// Register init code and clean up code
	finalInit.Ret(0);

	finalInit.Finalize();

	asCByteCode cleanInit;
	asCByteCode cleanExit;

	int id = engine->GetNextScriptFunctionId();
	asCScriptFunction *init = new asCScriptFunction(module);

	init->id = id;
	module->initFunction = init;
	engine->SetScriptFunction(init);

	init->byteCode.SetLength(finalInit.GetSize());
	// TODO: Pass the function pointer directly
	finalInit.Output(init->byteCode.AddressOf());
	init->stackNeeded = finalInit.largestStackUsed;

#ifdef AS_DEBUG
	// DEBUG: output byte code
	finalInit.DebugOutput("*****@*****.**", module, engine);
#endif

}
Пример #11
0
void asCBuilder::CompileGlobalVariables()
{
	bool compileSucceeded = true;

	asCByteCode finalInit;

	// Store state of compilation (errors, warning, output)
	int currNumErrors = numErrors;
	int currNumWarnings = numWarnings;
	asIOutputStream *stream = out;
	asCOutputBuffer outBuffer;
	out = &outBuffer;

	asCString finalOutput;

	while( compileSucceeded )
	{
		compileSucceeded = false;

		int accumErrors = 0;
		int accumWarnings = 0;

		// Restore state of compilation
		finalOutput = "";

		for( asUINT n = 0; n < globVariables.GetLength(); n++ )
		{
			numWarnings = 0;
			numErrors = 0;
			outBuffer.output = "";
			asCByteCode init;

			sGlobalVariableDescription *gvar = globVariables[n];
			if( gvar->isCompiled == false )
			{
				if( gvar->node )
				{
					int r, c;
					gvar->script->ConvertPosToRowCol(gvar->node->tokenPos, &r, &c);
					asCString str = gvar->datatype.Format();
					str += " " + gvar->name;
					str.Format(TXT_COMPILING_s, str.AddressOf());
					WriteInfo(gvar->script->name.AddressOf(), str.AddressOf(), r, c, true);
				}

				asCCompiler comp;
				int r = comp.CompileGlobalVariable(this, gvar->script, gvar->node, gvar);
				if( r >= 0 )
				{
					// Compilation succeeded
					gvar->isCompiled = true;
					compileSucceeded = true;

					init.AddCode(&comp.byteCode);
				}

				if( gvar->isCompiled )
				{
					// Add warnings for this constant to the total build
					if( numWarnings )
					{
						currNumWarnings += numWarnings;
						stream->Write(outBuffer.output.AddressOf());
					}

					// Add compiled byte code to the final init and exit functions
					finalInit.AddCode(&init);
				}
				else
				{
					// Add output to final output
					finalOutput += outBuffer.output;
					accumErrors += numErrors;
					accumWarnings += numWarnings;
				}

				preMessage = "";
			}
		}

		if( !compileSucceeded )
		{
			// Add errors and warnings to total build
			currNumWarnings += accumWarnings;
			currNumErrors += accumErrors;

			if( stream && finalOutput != "" ) stream->Write(finalOutput.AddressOf());
		}
	}

	// Restore states
	out = stream;
	numWarnings = currNumWarnings;
	numErrors = currNumErrors;

	// Register init code and clean up code
	finalInit.Ret(0);

	finalInit.Finalize();

	asCByteCode cleanInit;
	asCByteCode cleanExit;

	module->initFunction.byteCode.SetLength(finalInit.GetSize());
	finalInit.Output(module->initFunction.byteCode.AddressOf());
	module->initFunction.stackNeeded = finalInit.largestStackUsed;

#ifdef AS_DEBUG
	// DEBUG: output byte code
	finalInit.DebugOutput("*****@*****.**", module, engine);
#endif

}
Пример #12
0
void MapWindow::DrawInfoPage(HDC hdc,  RECT rc, bool forceinit )
{
  HFONT		oldfont=0;
  //SIZE TextSize;
  TCHAR Buffer[LKSIZEBUFFERLARGE];
  TCHAR BufferTitle[LKSIZEBUFFERTITLE];
  TCHAR BufferValue[LKSIZEBUFFERVALUE];
  TCHAR BufferUnit[LKSIZEBUFFERUNIT];
  TCHAR Empty[2]; // 100407
  int index=-1;

  static short	column[PANELCOLUMNS+1], hcolumn[(PANELCOLUMNS*2)+1], qcolumn[(PANELCOLUMNS*4)+1];
  static short	row[PANELROWS+1], hrow[(PANELCOLUMNS*2)+1], qrow[(PANELROWS*4)+1];

  bool showunit=false;
  _tcscpy(Empty,_T(""));

  if (forceinit) DoInit[MDI_DRAWINFOPAGE]=true;

	oldfont = (HFONT)SelectObject(hdc, LKINFOFONT); // save font

  if (DoInit[MDI_DRAWINFOPAGE]) {
	DoInit[MDI_DRAWINFOPAGE]=false;
	// function can only be called in fullscreen  and thus can be inited here
	column[0]=LEFTLIMITER;
	column[1]=((rc.right-RIGHTLIMITER-LEFTLIMITER)/PANELCOLUMNS)+LEFTLIMITER;
	column[2]=column[1]*2-LEFTLIMITER;
	column[3]=column[1]*3-LEFTLIMITER*2;
	column[PANELCOLUMNS]=rc.right-RIGHTLIMITER;
	row[0]=rc.top+TOPLIMITER;
	row[1]=((rc.bottom-BottomSize-row[0]-BOTTOMLIMITER)/PANELROWS)+row[0];
	row[2]=((rc.bottom-BottomSize-row[0]-BOTTOMLIMITER)/PANELROWS)*2+row[0];
	row[3]=((rc.bottom-BottomSize-row[0]-BOTTOMLIMITER)/PANELROWS)*3+row[0];
	row[PANELROWS]=rc.bottom-BottomSize-BOTTOMLIMITER;

	hcolumn[0]=column[0];
	hcolumn[1]=(column[1]-column[0])/2;
	hcolumn[2]=column[1];
	hcolumn[3]=(column[2]-column[1])/2+column[1];
	hcolumn[4]=column[2];
	hcolumn[5]=(column[3]-column[2])/2+column[2];
	hcolumn[6]=column[3];
	hcolumn[7]=(column[4]-column[3])/2+column[3];
	hcolumn[8]=column[4];

	hrow[0]=row[0];
	hrow[1]=(row[1]-row[0])/2;
	hrow[2]=row[1];
	hrow[3]=(row[2]-row[1])/2+row[1];
	hrow[4]=row[2];
	hrow[5]=(row[3]-row[2])/2+row[2];
	hrow[6]=row[3];
	hrow[7]=(row[4]-row[3])/2+row[3];
	hrow[8]=row[4];

	qcolumn[0]=hcolumn[0];
	qcolumn[1]=(hcolumn[1]-hcolumn[0])/2+hcolumn[0];
	qcolumn[2]=hcolumn[1];
	qcolumn[3]=(hcolumn[2]-hcolumn[1])/2+hcolumn[1];
	qcolumn[4]=hcolumn[2];
	qcolumn[5]=(hcolumn[3]-hcolumn[2])/2+hcolumn[2];
	qcolumn[6]=hcolumn[3];
	qcolumn[7]=(hcolumn[4]-hcolumn[3])/2+hcolumn[3];
	qcolumn[8]=hcolumn[4];
	qcolumn[9]=(hcolumn[5]-hcolumn[4])/2+hcolumn[4];
	qcolumn[10]=hcolumn[5];
	qcolumn[11]=(hcolumn[6]-hcolumn[5])/2+hcolumn[5];
	qcolumn[12]=hcolumn[6];
	qcolumn[13]=(hcolumn[7]-hcolumn[6])/2+hcolumn[6];
	qcolumn[14]=hcolumn[7];
	qcolumn[15]=(hcolumn[8]-hcolumn[7])/2+hcolumn[7];
	qcolumn[16]=hcolumn[8];

	qrow[0]=hrow[0];
	qrow[1]=(hrow[1]-hrow[0])/2+hrow[0];
	qrow[2]=hrow[1];
	qrow[3]=(hrow[2]-hrow[1])/2+hrow[1];
	qrow[4]=hrow[2];
	qrow[5]=(hrow[3]-hrow[2])/2+hrow[2];
	qrow[6]=hrow[3];
	qrow[7]=(hrow[4]-hrow[3])/2+hrow[3];
	qrow[8]=hrow[4];
	qrow[9]=(hrow[5]-hrow[4])/2+hrow[4];
	qrow[10]=hrow[5];
	qrow[11]=(hrow[6]-hrow[5])/2+hrow[5];
	qrow[12]=hrow[6];
	qrow[13]=(hrow[7]-hrow[6])/2+hrow[6];
	qrow[14]=hrow[7];
	qrow[15]=(hrow[8]-hrow[7])/2+hrow[7];
	qrow[16]=hrow[8];

	qrow[5]+=NIBLSCALE(6);
	qrow[6]+=NIBLSCALE(6);
	qrow[7]+=NIBLSCALE(6);
	qrow[8]+=NIBLSCALE(6)*2;
	qrow[9]+=NIBLSCALE(6)*2;
	qrow[10]+=NIBLSCALE(6)*2;
	qrow[11]+=NIBLSCALE(6)*3;
	qrow[12]+=NIBLSCALE(6)*3;
	qrow[13]+=NIBLSCALE(6)*3;

  } // doinit

#include "./LKMW3include2.cpp"

	SelectObject(hdc, LK8PanelBigFont);
#include "./LKMW3include1.cpp"

	int curtype; // 100404
	bool ontarget=false;
	FLARM_TRAFFIC *pTarget=NULL;
	if ( (MapSpaceMode != MSM_INFO_TRF) && (MapSpaceMode != MSM_INFO_TARGET) ) {
		curtype=CURTYPE;
	} else {
		if (MapSpaceMode == MSM_INFO_TRF)
			curtype=IM_TRF + IM_TOP;
		else
			curtype=IM_TARGET + IM_TOP;

		if (LKTargetIndex<0 || LKTargetIndex>=MAXTRAFFIC) {
			ontarget=false;
		} else {
			if (DrawInfo.FLARM_Traffic[LKTargetIndex].ID <=0) {
				ontarget=false;
			} else {
				ontarget=true;
				pTarget=&DrawInfo.FLARM_Traffic[LKTargetIndex];
			}
		}
	}

	if (ontarget) DoTarget(&DrawInfo, &DerivedDrawInfo);

	switch (LKevent) {
		case LKEVENT_NONE:
			break;
		case LKEVENT_ENTER:
			break;
		case LKEVENT_NEWRUN:
			break;
		case LKEVENT_PAGEUP:
			break;
		case LKEVENT_PAGEDOWN:
			break;
		default:
			break;
	}
	LKevent=LKEVENT_NONE; 

	COLORREF icolor; // 091229

	// R0 C0	= status
	SelectObject(hdc, LK8PanelMediumFont);
	switch(curtype) {
		case IM_THERMAL:
			_stprintf(Buffer,_T("%d.%d %s"),ModeIndex, curtype+1, gettext(TEXT("_@M905_"))); // Thermal
			break;
		case IM_CRUISE:
			_stprintf(Buffer,_T("%d.%d %s"),ModeIndex, curtype+1, gettext(TEXT("_@M906_"))); // Cruise
			break;
		case IM_TASK:
			_stprintf(Buffer,_T("%d.%d %s"),ModeIndex, curtype+1, gettext(TEXT("_@M907_"))); // Task
			break;
		case IM_AUX:
			_stprintf(Buffer,_T("%d.%d %s"),ModeIndex, curtype+1, gettext(TEXT("_@M908_"))); // Custom
			break;
		case IM_TRI:
#ifndef LKCOMPETITION
			_stprintf(Buffer,_T("%d.%d %s"), ModeIndex, curtype+1, gettext(TEXT("_@M909_"))); // Turn
#else
			_stprintf(Buffer,_T("%d.%d %s"), ModeIndex, curtype+1, gettext(TEXT("_@M1600_"))); // DISABLED
#endif
			break;
		case IM_HSI:
			wsprintf(Buffer,_T("%d.%d %s"), ModeIndex, curtype+1, gettext(TEXT("_@M1860_"))); // HSI
			break;
		case IM_CONTEST:
			_stprintf(Buffer,_T("%d.%d %s"), ModeIndex, curtype+1, gettext(TEXT("_@M957_"))); // Contest
			break;
		case IM_TRF+IM_TOP:
			_stprintf(Buffer,_T("%d.%d %s"), ModeIndex, IM_TRF+1, gettext(TEXT("_@M910_"))); // Target
			break;
		case IM_TARGET+IM_TOP:
			_stprintf(Buffer,_T("%d.%d %s"), ModeIndex, IM_TARGET+1, gettext(TEXT("_@M911_"))); // Sight
			break;
		default:
			_stprintf(Buffer,_T("error"));
			break;
	}
        LKWriteText(hdc, Buffer, qcolumn[0],qrow[0], 0, WTMODE_NORMAL, WTALIGN_LEFT, RGB_LIGHTGREEN, false);

	// R0 C1
	icolor=RGB_WHITE;
	switch(curtype) {
		case IM_THERMAL:
		case IM_CRUISE:
		case IM_TASK:
		case IM_AUX:
			if ( ValidTaskPoint(ActiveWayPoint) != false ) {
				index = Task[ActiveWayPoint].Index;
				if ( index >=0 ) {
					_tcscpy(Buffer, WayPointList[index].Name);
				} else {
					_stprintf(Buffer,gettext(TEXT("_@M912_"))); // [no dest]
					icolor=RGB_AMBER;
				}
			} else {
				_stprintf(Buffer,gettext(TEXT("_@M912_"))); // [no dest]
				icolor=RGB_AMBER;
			}
			break;
		case IM_TRI:
#ifndef LKCOMPETITION
			_stprintf(Buffer,gettext(TEXT("_@M913_"))); // Experimental
#else
			_stprintf(Buffer,_T("---"));
#endif
			break;
		case IM_CONTEST:
		case IM_HSI: //for the HSI the title text is computed in his section down
			_stprintf(Buffer,gettext(TEXT("")));
			break;
		case IM_TRF+IM_TOP:
		case IM_TARGET+IM_TOP:
			if (ontarget) {
				switch (pTarget->Status ) {
					case LKT_GHOST:
						icolor=RGB_LIGHTYELLOW;
						break;
					case LKT_ZOMBIE:
						icolor=RGB_LIGHTRED;
						break;
					default:
						icolor=RGB_WHITE;
						break;
				}
				//TCHAR status[80];
				if (_tcslen(pTarget->Name) == 1) {
					_stprintf(Buffer,_T("%0x"),(unsigned)pTarget->ID);
				} else {
					_stprintf(Buffer,_T("%s"),pTarget->Name);
				}

			} else {
				_stprintf(Buffer,gettext(TEXT("_@M914_"))); // [no target]
				icolor=RGB_AMBER;
			}

			break;
		default:
			_stprintf(Buffer,_T("error"));
			icolor=RGB_AMBER;
			break;
	}
        LKWriteText(hdc, Buffer, qcolumn[8],qrow[1], 0, WTMODE_NORMAL, WTALIGN_CENTER, icolor, false);

	// R0 C2	= time of day
	if ( (curtype == (IM_TOP+IM_TRF)) || (curtype == (IM_TOP+IM_TARGET)) ) {
		if (ontarget) {
			TCHAR tpas[30];
			Units::TimeToTextDown(tpas,(int)(DrawInfo.Time - pTarget->Time_Fix));

			switch (pTarget->Status) {
				case LKT_REAL:
					_stprintf(Buffer,_T("LIVE"));
					break;
				case LKT_GHOST:
					_stprintf(Buffer,_T("ghost %s\""),tpas);
					break;
				case LKT_ZOMBIE:
					_stprintf(Buffer,_T("zombie %s\""),tpas);
					break;
				default:
					_stprintf(Buffer,_T("??? %s\""),tpas);
					break;
			}
        		LKWriteText(hdc, Buffer, qcolumn[16],qrow[0], 0, WTMODE_NORMAL, WTALIGN_RIGHT, icolor, false);
		} else {
			LKFormatValue(LK_TIME_LOCALSEC, false, BufferValue, BufferUnit, BufferTitle); // 091219
        		LKWriteText(hdc, BufferValue, qcolumn[16],qrow[0], 0, WTMODE_NORMAL, WTALIGN_RIGHT, RGB_WHITE, false);
		}
		if ( curtype == (IM_TOP+IM_TARGET) ) goto label_Target;
	} else {
		LKFormatValue(LK_TIME_LOCALSEC, false, BufferValue, BufferUnit, BufferTitle); // 091219
        	LKWriteText(hdc, BufferValue, qcolumn[16],qrow[0], 0, WTMODE_NORMAL, WTALIGN_RIGHT, RGB_WHITE, false);
	}

	if (curtype == IM_TRI) goto label_TRI;
	if (curtype == IM_HSI) goto label_HSI;

	VDrawLine(hdc,rc, qcolumn[0],qrow[2],qcolumn[16],qrow[2],RGB_DARKGREEN);
	VDrawLine(hdc,rc, qcolumn[0],qrow[8],qcolumn[16],qrow[8],RGB_DARKGREEN);

	// R1 C1
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_NEXT_DIST, true, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4], &qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_CRUISE:
		case IM_TASK:
			showunit=LKFormatValue(LK_NEXT_DIST, true, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4], &qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_AUX:
			index=GetInfoboxType(1);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4], &qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_CONTEST:
			showunit=LKFormatValue(LK_OLC_CLASSIC_DIST, true, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4], &qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_TRF+IM_TOP:
			showunit=LKFormatValue(LK_TARGET_DIST, true, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4], &qrow[3],&qrow[4],&qrow[2]);
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4], &qrow[3],&qrow[4],&qrow[2]);
			break;
	}

	// R1 C2
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_BRG, true, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[8],&qcolumn[8], &qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_CRUISE:
		case IM_TASK:
			showunit=LKFormatValue(LK_BRGDIFF, true, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[9],&qcolumn[8], &qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_CONTEST:
			showunit=LKFormatValue(LK_OLC_FAI_DIST, true, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[8],&qcolumn[8], &qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_AUX:
			index=GetInfoboxType(2);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[8],&qcolumn[8], &qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_TRF+IM_TOP:
			showunit=LKFormatValue(LK_TARGET_TO, true, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[9],&qcolumn[8], &qrow[3],&qrow[4],&qrow[2]);
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[9],&qcolumn[8], &qrow[3],&qrow[4],&qrow[2]);
			break;
	}


	// R1 C3
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_NEXT_ALTDIFF, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[12], &qcolumn[12], &qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_CRUISE:
		case IM_TASK:
			showunit=LKFormatValue(LK_NEXT_GR, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[12], &qcolumn[12], &qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_CONTEST:
			showunit=LKFormatValue(LK_OLC_LEAGUE_DIST, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[12], &qcolumn[12], &qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_AUX:
			index=GetInfoboxType(3);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[12], &qcolumn[12], &qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_TRF+IM_TOP:
			showunit=LKFormatValue(LK_TARGET_GR, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[12], &qcolumn[12], &qrow[3],&qrow[4],&qrow[2]);
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[12], &qcolumn[12], &qrow[3],&qrow[4],&qrow[2]);
			break;
	}

	// R1 C4
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_NEXT_GR, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16],&qcolumn[16], 
											&qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_CRUISE:
		case IM_TASK:
			showunit=LKFormatValue(LK_LD_AVR, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16],&qcolumn[16], 
											&qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_CONTEST:
			showunit=LKFormatValue(LK_OLC_3TPS_DIST, false, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16],&qcolumn[16], 
											&qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_AUX:
			index=GetInfoboxType(4);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16],&qcolumn[16], 
											&qrow[3],&qrow[4],&qrow[2]);
			break;
		case IM_TRF+IM_TOP:
			showunit=LKFormatValue(LK_TARGET_ALTARRIV, false, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16],&qcolumn[16], 
											&qrow[3],&qrow[4],&qrow[2]);
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16],&qcolumn[16], 
											&qrow[3],&qrow[4],&qrow[2]);
			break;
	}

	// R2  C1
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_HNAV, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_CRUISE:
		case IM_TASK:
			showunit=LKFormatValue(LK_NEXT_ALTDIFF, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_CONTEST:
			showunit=LKFormatValue(LK_OLC_CLASSIC_PREDICTED_DIST, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_AUX:
			index=GetInfoboxType(5);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_TRF+IM_TOP:
			showunit=LKFormatValue(LK_TARGET_ALTDIFF, false, BufferValue, BufferUnit, BufferTitle);
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			break;
	}
	WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4],&qcolumn[4], &qrow[6],&qrow[7],&qrow[5]);

	// R2  C2
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_GNDSPEED, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[8], &qcolumn[8], &qrow[6],&qrow[7],&qrow[5]);
			break;
		case IM_CRUISE:
		case IM_TASK:
			showunit=LKFormatValue(LK_BRG, true , BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[9], &qcolumn[8], &qrow[6],&qrow[7],&qrow[5]);
			break;
		case IM_CONTEST:
			showunit=LKFormatValue(LK_OLC_FAI_PREDICTED_DIST, true , BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[8], &qcolumn[8], &qrow[6],&qrow[7],&qrow[5]);
			break;
		case IM_AUX:
			index=GetInfoboxType(6);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[8], &qcolumn[8], &qrow[6],&qrow[7],&qrow[5]);
			break;
		case IM_TRF+IM_TOP:
			showunit=LKFormatValue(LK_TARGET_BEARING, true , BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[9], &qcolumn[8], &qrow[6],&qrow[7],&qrow[5]);
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[9], &qcolumn[8], &qrow[6],&qrow[7],&qrow[5]);
			break;
	}

	// R2  C3
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_VARIO, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_CRUISE:
		case IM_TASK:
			showunit=LKFormatValue(LK_LD_CRUISE, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_CONTEST:
			_tcscpy(BufferValue,_T("")); 
            _tcscpy(BufferTitle,_T(""));
			break;
		case IM_AUX:
			index=GetInfoboxType(7);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_TRF+IM_TOP:
			showunit=LKFormatValue(LK_EMPTY, true , BufferValue, BufferUnit, BufferTitle);
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			break;
	}
	WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[12], &qcolumn[12],&qrow[6],&qrow[7],&qrow[5]);

	// R2  C4
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_FL, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_CRUISE:
		case IM_TASK:
			showunit=LKFormatValue(LK_LD_INST, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_CONTEST:
			showunit=LKFormatValue(LK_OLC_3TPS_PREDICTED_DIST, false, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			break;
		case IM_AUX:
			index=GetInfoboxType(8);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			break;
		case IM_TRF+IM_TOP:
			showunit=LKFormatValue(LK_EMPTY, false, BufferValue, BufferUnit, BufferTitle);
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			break;
	}
	WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[6],&qrow[7],&qrow[5]);

	// R3  C1
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_TC_GAIN, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_CRUISE:
			showunit=LKFormatValue(LK_HNAV, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_TASK:
			showunit=LKFormatValue(LK_FIN_ALTDIFF, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_CONTEST:
			//showunit=LKFormatValue(LK_OLC_PLUS_SCORE, false, BufferValue, BufferUnit, BufferTitle);
			showunit=LKFormatValue(LK_OLC_CLASSIC_SPEED, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_AUX:
			index=GetInfoboxType(9);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_TRF+IM_TOP:
			showunit=LKFormatValue(LK_TARGET_ALT, false, BufferValue, BufferUnit, BufferTitle);
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			break;
	}
	WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4],&qrow[9],&qrow[10],&qrow[8]);

	// R3  C2
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_TC_30S, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[8], &qcolumn[8],&qrow[9],&qrow[10],&qrow[8]);
			break;
		case IM_CRUISE:
			showunit=LKFormatValue(LK_TRACK, true, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[9], &qcolumn[8],&qrow[9],&qrow[10],&qrow[8]);
			break;
		case IM_TASK:
			showunit=LKFormatValue(LK_FIN_DIST, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[8], &qcolumn[8],&qrow[9],&qrow[10],&qrow[8]);
			break;
		case IM_CONTEST:
			//showunit=LKFormatValue(LK_OLC_PLUS_PREDICTED_SCORE, false, BufferValue, BufferUnit, BufferTitle);
			showunit=LKFormatValue(LK_OLC_FAI_SPEED, false, BufferValue, BufferUnit, BufferTitle); 
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[8], &qcolumn[8],&qrow[9],&qrow[10],&qrow[8]);
			break;
		case IM_AUX:
			index=GetInfoboxType(10);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[8], &qcolumn[8],&qrow[9],&qrow[10],&qrow[8]);
			break;
		case IM_TRF+IM_TOP:
			showunit=LKFormatValue(LK_TARGET_SPEED, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[8], &qcolumn[8],&qrow[9],&qrow[10],&qrow[8]);
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[9], &qcolumn[8],&qrow[9],&qrow[10],&qrow[8]);
			break;
	}

	// R3  C3
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_TC_AVG, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_CRUISE:
			showunit=LKFormatValue(LK_GNDSPEED, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_TASK:
			showunit=LKFormatValue(LK_TASK_DISTCOV, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_CONTEST:
			//showunit=LKFormatValue(LK_OLC_LEAGUE_SCORE, false, BufferValue, BufferUnit, BufferTitle);
			showunit=LKFormatValue(LK_OLC_LEAGUE_SPEED, true, BufferValue, BufferUnit, BufferTitle); 
			break;
		case IM_AUX:
			index=GetInfoboxType(11);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_TRF+IM_TOP:
			showunit=LKFormatValue(LK_TARGET_VARIO, false, BufferValue, BufferUnit, BufferTitle);
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			break;
	}
	WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[12], &qcolumn[12],&qrow[9],&qrow[10],&qrow[8]);


	// R3  C4
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_TC_ALL, false, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			break;
		case IM_CRUISE:
			showunit=LKFormatValue(LK_FL, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_TASK:
			showunit=LKFormatValue(LK_FIN_GR, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_CONTEST:
			showunit=LKFormatValue(LK_OLC_3TPS_SPEED, true, BufferValue, BufferUnit, BufferTitle); 
			_tcscpy(BufferUnit,_T(""));
			break;
		case IM_AUX:
			index=GetInfoboxType(12);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			break;
		case IM_TRF+IM_TOP:
			showunit=LKFormatValue(LK_TARGET_AVGVARIO, false, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			break;
	}
	WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[9],&qrow[10],&qrow[8]);


	// R4  C1
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_WIND, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[5], &qcolumn[4],&qrow[12],&qrow[13],&qrow[11]);
			break;
		case IM_CRUISE:
			showunit=LKFormatValue(LK_WIND, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[5], &qcolumn[4],&qrow[12],&qrow[13],&qrow[11]);
			break;
		case IM_TASK:
			showunit=LKFormatValue(LK_FIN_ALTDIFF0, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4],&qrow[12],&qrow[13],&qrow[11]);
			break;
		case IM_CONTEST:
			showunit=LKFormatValue(LK_OLC_PLUS_SCORE, false, BufferValue, BufferUnit, BufferTitle);
			//showunit=LKFormatValue(LK_OLC_CLASSIC_SPEED, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4],&qrow[12],&qrow[13],&qrow[11]);
			break;
		case IM_AUX:
			index=GetInfoboxType(13);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4],&qrow[12],&qrow[13],&qrow[11]);
			break;
		case IM_TRF+IM_TOP:
			LKFormatValue(LK_EMPTY, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4],&qrow[12],&qrow[13],&qrow[11]);
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4],&qrow[12],&qrow[13],&qrow[11]);
			break;
	}

	// R4  C2
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_EMPTY, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[9], &qcolumn[9],&qrow[12],&qrow[13],&qrow[11]);
			break;
		case IM_CRUISE:
			showunit=LKFormatValue(LK_TL_AVG, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[9], &qcolumn[9],&qrow[12],&qrow[13],&qrow[11]);
			break;
		case IM_TASK:
			showunit=LKFormatValue(LK_LKFIN_ETE, false, BufferValue, BufferUnit, BufferTitle); 
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[9], &qcolumn[9],&qrow[12],&qrow[13],&qrow[11]);
			break;
		case IM_CONTEST:
			//showunit=LKFormatValue(LK_OLC_FAI_SPEED, false, BufferValue, BufferUnit, BufferTitle); 
			showunit=LKFormatValue(LK_OLC_PLUS_PREDICTED_SCORE, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[8], &qcolumn[8],&qrow[12],&qrow[13],&qrow[11]);
			break;
		case IM_AUX:
			index=GetInfoboxType(14);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[8], &qcolumn[8],&qrow[12],&qrow[13],&qrow[11]);
			break;
		case IM_TRF+IM_TOP:
			showunit=LKFormatValue(LK_TARGET_EIAS, false, BufferValue, BufferUnit, BufferTitle); 
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[8], &qcolumn[8],&qrow[12],&qrow[13],&qrow[11]);
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[9], &qcolumn[9],&qrow[12],&qrow[13],&qrow[11]);
			break;
	}

	// R4  C3
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_EMPTY, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[13], &qcolumn[13],&qrow[12],&qrow[13],&qrow[11]);
			break;
		case IM_CRUISE:
			showunit=LKFormatValue(LK_TC_ALL, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[13], &qcolumn[13],&qrow[12],&qrow[13],&qrow[11]);
			break;
		case IM_TASK:
			showunit=LKFormatValue(LK_SPEEDTASK_ACH, true, BufferValue, BufferUnit, BufferTitle); 
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[13], &qcolumn[13],&qrow[12],&qrow[13],&qrow[11]);
			break;
		case IM_CONTEST:
			//showunit=LKFormatValue(LK_OLC_LEAGUE_SPEED, true, BufferValue, BufferUnit, BufferTitle); 
			showunit=LKFormatValue(LK_OLC_LEAGUE_SCORE, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[12], &qcolumn[12],&qrow[12],&qrow[13],&qrow[11]);
			break;
		case IM_AUX:
			index=GetInfoboxType(15);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[12], &qcolumn[12],&qrow[12],&qrow[13],&qrow[11]);
			break;
		case IM_TRF+IM_TOP:
			showunit=LKFormatValue(LK_EMPTY, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[13], &qcolumn[13],&qrow[12],&qrow[13],&qrow[11]);
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[13], &qcolumn[13],&qrow[12],&qrow[13],&qrow[11]);
			break;
	}

	// R4  C4
	showunit=false;
	switch(curtype) {
		case IM_THERMAL:
			showunit=LKFormatValue(LK_EMPTY, false, BufferValue, BufferUnit, BufferTitle);
			break;
		case IM_CRUISE:
		case IM_TASK:
			showunit=LKFormatValue(LK_MC, true, BufferValue, BufferUnit, BufferTitle); 
			break;
		case IM_CONTEST:
			_tcscpy(BufferValue,_T("")); 
            _tcscpy(BufferTitle,_T(""));
			//showunit=LKFormatValue(LK_OLC_3TPS_SPEED, true, BufferValue, BufferUnit, BufferTitle); 
			break;
		case IM_AUX:
			index=GetInfoboxType(16);
			showunit=LKFormatValue(index, false, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			break;
		case IM_TRF+IM_TOP:
			showunit=LKFormatValue(LK_EMPTY, true, BufferValue, BufferUnit, BufferTitle); 
			break;
		default:
			LKFormatValue(LK_ERROR, false, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			break;
	}
	WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[12],&qrow[13],&qrow[11]);
	goto label_End;

	// This is the TRI page
	//
	// ATTENTION PLEASE
	// Some values are using direct access to CALCULATED_INFO for fast responses.
	// Other values are using the copy of struct made 1 second later
	//
label_TRI:
#ifndef LKCOMPETITION
	VDrawLine(hdc,rc, qcolumn[0],qrow[2],qcolumn[16],qrow[2],RGB_DARKGREEN);
	DrawTRI(hdc, rc);
	showunit=true; // 091219
	if (ScreenLandscape) {
		// right
		LKFormatValue(LK_TRACK, true, BufferValue, BufferUnit, BufferTitle);
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[14], &qcolumn[14],&qrow[3],&qrow[4],&qrow[2]);
		LKFormatValue(LK_GNDSPEED, true, BufferValue, BufferUnit, BufferTitle);
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[14], &qcolumn[14],&qrow[6],&qrow[7],&qrow[5]);
		LKFormatValue(LK_HNAV, true, BufferValue, BufferUnit, BufferTitle);
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[15], &qcolumn[15],&qrow[9],&qrow[10],&qrow[8]);
		LKFormatValue(LK_VARIO, true, BufferValue, BufferUnit, BufferTitle);
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[14], &qcolumn[14],&qrow[12],&qrow[13],&qrow[11]);

		// left
		LKFormatValue(LK_IAS, true, BufferValue, BufferUnit, BufferTitle);
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[3], &qcolumn[3],&qrow[6],&qrow[7],&qrow[5]);
		LKFormatValue(LK_BANK_ANGLE, true, BufferValue, BufferUnit, BufferTitle);
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4],&qrow[3],&qrow[4],&qrow[2]);
		LKFormatValue(LK_GLOAD, true, BufferValue, BufferUnit, BufferTitle);
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[3], &qcolumn[3],&qrow[9],&qrow[10],&qrow[8]);
		LKFormatValue(LK_ODOMETER, true, BufferValue, BufferUnit, BufferTitle);
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4],&qrow[12],&qrow[13],&qrow[11]);
	} else {
		// right
		LKFormatValue(LK_TRACK, true, BufferValue, BufferUnit, BufferTitle);
		_tcscpy(BufferUnit,_T(""));
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[14], &qcolumn[14],&qrow[3],&qrow[4],&qrow[2]);
		LKFormatValue(LK_GNDSPEED, true, BufferValue, BufferUnit, BufferTitle);
		_tcscpy(BufferUnit,_T(""));
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[6],&qrow[7],&qrow[5]);
		LKFormatValue(LK_HNAV, true, BufferValue, BufferUnit, BufferTitle);
		_tcscpy(BufferUnit,_T(""));
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[9],&qrow[10],&qrow[8]);
		LKFormatValue(LK_VARIO, true, BufferValue, BufferUnit, BufferTitle);
		_tcscpy(BufferUnit,_T(""));
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[12],&qrow[13],&qrow[11]);

		// left
		LKFormatValue(LK_IAS, true, BufferValue, BufferUnit, BufferTitle);
		_tcscpy(BufferUnit,_T(""));
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[3], &qcolumn[3],&qrow[6],&qrow[7],&qrow[5]);
		LKFormatValue(LK_BANK_ANGLE, true, BufferValue, BufferUnit, BufferTitle);
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4],&qrow[3],&qrow[4],&qrow[2]);
		LKFormatValue(LK_GLOAD, true, BufferValue, BufferUnit, BufferTitle);
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[3], &qcolumn[3],&qrow[9],&qrow[10],&qrow[8]);
		LKFormatValue(LK_ODOMETER, true, BufferValue, BufferUnit, BufferTitle);
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4],&qrow[12],&qrow[13],&qrow[11]);
	}
#if 0
	_stprintf(BufferValue,_T("%0.1f"),CALCULATED_INFO.TurnRate);
	_stprintf(BufferTitle,_T("Rate"));
	WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[3], &qcolumn[3],&qrow[9],&qrow[10],&qrow[8]);

	LKFormatValue(LK_GLOAD, true, BufferValue, BufferUnit, BufferTitle);
	WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4],&qrow[12],&qrow[13],&qrow[11]);
#endif
	wsprintf(BufferTitle, gettext(TEXT("_@M915_"))); // NOT FOR IFR USAGE
	SelectObject(hdc, LK8PanelSmallFont);
	LKWriteText(hdc, BufferTitle, qcolumn[8],qrow[12], 0, WTMODE_OUTLINED, WTALIGN_CENTER, RGB_ORANGE, false);
#endif // not in LKCOMPETITION 
	goto label_End; // End of TRI

	// This is the HSI page
label_HSI:
	VDrawLine(hdc,rc, qcolumn[0],qrow[2],qcolumn[16],qrow[2],RGB_DARKGREEN);
	static bool showQFU=false;
	static bool showVFRlanding=false;
	HSIreturnStruct HSI;
	HSI=DrawHSI(hdc,rc);
	if(HSI.landing) {
		showVFRlanding=!showVFRlanding; //make it blinking
		if(HSI.usingQFU) showQFU=!showVFRlanding;
		else showQFU=false;
	} else {
		showVFRlanding=false;
		if(HSI.usingQFU) showQFU=!showQFU; //make it blinking
		else showQFU=false;
	}
	if(showVFRlanding || showQFU) { //show QFU or "VFR landing"
		if(showVFRlanding) {
			wsprintf(Buffer,TEXT("VFR %s"),gettext(TEXT("_@M931_"))); //TODO: toupper()
			icolor=INVERTCOLORS?RGB_YELLOW:RGB_DARKYELLOW;
		}
		if(showQFU) {
			#ifndef __MINGW32__
			wsprintf(Buffer, TEXT("QFU: %d\xB0"),WayPointList[Task[ActiveWayPoint].Index].RunwayDir);
			#else
			wsprintf(Buffer, TEXT("QFU: %d°"),WayPointList[Task[ActiveWayPoint].Index].RunwayDir);
			#endif
			icolor=RGB_GREEN;
		}
	} else { //show next waypoint name
		icolor=RGB_WHITE;
		if(ValidTaskPoint(ActiveWayPoint)) {
			if(Task[ActiveWayPoint].Index >=0) _tcscpy(Buffer, WayPointList[Task[ActiveWayPoint].Index].Name);
			else {
				wsprintf(Buffer,gettext(TEXT("_@M912_"))); // [no dest]
				icolor=RGB_AMBER;
			}
		} else {
			wsprintf(Buffer,gettext(TEXT("_@M912_"))); // [no dest]
			icolor=RGB_AMBER;
		}
	}
	SelectObject(hdc, LK8PanelMediumFont);
	LKWriteText(hdc, Buffer, qcolumn[8],qrow[1], 0, WTMODE_NORMAL, WTALIGN_CENTER, icolor, false);
	showunit=true;
	if (ScreenLandscape) {
		LKFormatValue(LK_NEXT_ETE, true, BufferValue, BufferUnit, BufferTitle);
		_tcscpy(BufferUnit,_T(""));
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4],&qrow[3],&qrow[4],&qrow[2]);
		LKFormatValue(LK_NEXT_DIST, true, BufferValue, BufferUnit, BufferTitle);
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[3], &qcolumn[3],&qrow[7],&qrow[8],&qrow[6]);
		LKFormatValue(LK_NEXT_ETA, true, BufferValue, BufferUnit, BufferTitle);
		_tcscpy(BufferUnit,_T(""));
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4],&qrow[12],&qrow[13],&qrow[11]);
		if(!HSI.approach) { //if not landing print also dist, ETE and ETA respect task end
			LKFormatValue(LK_FIN_ETE, true, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[3],&qrow[4],&qrow[2]);
			LKFormatValue(LK_FIN_DIST, true, BufferValue, BufferUnit, BufferTitle);
			if(ScreenSize==ss800x480 || ScreenSize==ss480x272)
				WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[15], &qcolumn[15],&qrow[7],&qrow[8],&qrow[6]);
			else {
				_tcscpy(BufferUnit,_T(""));
				WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[7],&qrow[8],&qrow[6]);
			}
			LKFormatValue(LK_FIN_ETA, true, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[12],&qrow[13],&qrow[11]);
		} else { //show other interesting things for landing
			int col=16;
			bool unitInvisible=true;
			if(ScreenSize==ss800x480 || ScreenSize==ss480x272) {
				col=15;
				unitInvisible=false;
			}
			LKFormatValue(LK_IAS, true, BufferValue, BufferUnit, BufferTitle);
			if(unitInvisible) _tcscpy(BufferUnit,_T(""));
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[col], &qcolumn[col],&qrow[3],&qrow[4],&qrow[2]);
			LKFormatValue(LK_HAGL, true, BufferValue, BufferUnit, BufferTitle);
			if(unitInvisible) _tcscpy(BufferUnit,_T(""));
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[col], &qcolumn[col],&qrow[12],&qrow[13],&qrow[11]);
		}
	} else {
		LKFormatValue(LK_NEXT_ETE, true, BufferValue, BufferUnit, BufferTitle);
		_tcscpy(BufferUnit,_T(""));
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4],&qrow[3],&qrow[4],&qrow[2]);
		LKFormatValue(LK_NEXT_DIST, true, BufferValue, BufferUnit, BufferTitle);
		_tcscpy(BufferUnit,_T(""));
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[3], &qcolumn[3],&qrow[6],&qrow[7],&qrow[5]);
		LKFormatValue(LK_NEXT_ETA, true, BufferValue, BufferUnit, BufferTitle);
		_tcscpy(BufferUnit,_T(""));
		WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[4], &qcolumn[4],&qrow[12],&qrow[13],&qrow[11]);
		if(!HSI.approach) { //if not landing print also dist, ETE and ETA respect task end
			LKFormatValue(LK_FIN_ETE, true, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[3],&qrow[4],&qrow[2]);
			LKFormatValue(LK_FIN_DIST, true, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[6],&qrow[7],&qrow[5]);
			LKFormatValue(LK_FIN_ETA, true, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[12],&qrow[13],&qrow[11]);
		} else {
			LKFormatValue(LK_IAS, true, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[3],&qrow[4],&qrow[2]);
			LKFormatValue(LK_HAGL, true, BufferValue, BufferUnit, BufferTitle);
			_tcscpy(BufferUnit,_T(""));
			WriteInfo(hdc, &showunit, BufferValue, BufferUnit, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[12],&qrow[13],&qrow[11]);
		}
	}
	goto label_End; // End of HSI

	// Traffic Target page
	
label_Target:
	VDrawLine(hdc,rc, qcolumn[0],qrow[2],qcolumn[16],qrow[2],RGB_DARKGREEN);
	// pass the sight rectangle to use on the screen. Warning: DrawTarget will cache these values
	// and will not use them after the first run time anymore...
	DrawTarget(hdc, rc, qrow[3],qrow[15],qcolumn[3],qcolumn[13]);

	showunit=false; // 091219

	// left
	
	showunit=LKFormatValue(LK_TARGET_DIST, true, BufferValue, BufferUnit, BufferTitle);
	WriteInfo(hdc, &showunit, BufferValue, Empty, BufferTitle, &qcolumn[3], &qcolumn[3],&qrow[3],&qrow[4],&qrow[2]);

	showunit=LKFormatValue(LK_TARGET_EIAS, true, BufferValue, BufferUnit, BufferTitle);
	WriteInfo(hdc, &showunit, BufferValue, Empty, BufferTitle, &qcolumn[3], &qcolumn[3],&qrow[6],&qrow[7],&qrow[5]);

	showunit=LKFormatValue(LK_TARGET_AVGVARIO, true, BufferValue, BufferUnit, BufferTitle);
	WriteInfo(hdc, &showunit, BufferValue, Empty, BufferTitle, &qcolumn[3], &qcolumn[3],&qrow[9],&qrow[10],&qrow[8]);

	showunit=LKFormatValue(LK_TARGET_GR, true, BufferValue, BufferUnit, BufferTitle);
	WriteInfo(hdc, &showunit, BufferValue, Empty, BufferTitle, &qcolumn[3], &qcolumn[3],&qrow[12],&qrow[13],&qrow[11]);

	// right
	showunit=LKFormatValue(LK_TARGET_ALTDIFF, true, BufferValue, BufferUnit, BufferTitle);
	WriteInfo(hdc, &showunit, BufferValue, Empty, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[3],&qrow[4],&qrow[2]);

	showunit=LKFormatValue(LK_EMPTY, true, BufferValue, BufferUnit, BufferTitle);
	WriteInfo(hdc, &showunit, BufferValue, Empty, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[6],&qrow[7],&qrow[5]);

	showunit=LKFormatValue(LK_EMPTY, true, BufferValue, BufferUnit, BufferTitle);
	WriteInfo(hdc, &showunit, BufferValue, Empty, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[9],&qrow[10],&qrow[8]);

	showunit=LKFormatValue(LK_TARGET_ALTARRIV, true, BufferValue, BufferUnit, BufferTitle);
	WriteInfo(hdc, &showunit, BufferValue, Empty, BufferTitle, &qcolumn[16], &qcolumn[16],&qrow[12],&qrow[13],&qrow[11]);


label_End:
  // restore font and return
  SelectObject(hdc, oldfont); 

}
void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) {
    gInfos.setCount(kNumberOfTypes);
    memset(gInfos.begin(), 0, sizeof(gInfos[0]) * kNumberOfTypes);
    gInfosCounts.setCount(kNumberOfTypes);
    memset(gInfosCounts.begin(), -1, sizeof(gInfosCounts[0]) * kNumberOfTypes);
    // check to see if it is condensable
    int index, infoCount;
    for (index = 0; index < kTypeNamesSize; index++) {
        const SkMemberInfo* info = GetMembers(maker, gTypeNames[index].fType, &infoCount);
        if (info == NULL)
            continue;
        AddInfo(gTypeNames[index].fType, info, infoCount);
    }
    const SkMemberInfo* extraInfo =
        SkDisplayType::GetMembers(maker, SkType_3D_Point, &infoCount);
    AddInfo(SkType_Point, extraInfo, infoCount);
    AddInfo(SkType_3D_Point, extraInfo, infoCount);
//  int baseInfos = gInfos.count();
    do {
        SkTDMemberInfoArray oldRefs = gUnknowns;
        SkTDIntArray oldRefCounts = gUnknownsCounts;
        gUnknowns.reset();
        gUnknownsCounts.reset();
        for (index = 0; index < oldRefs.count(); index++) {
            const SkMemberInfo* info = oldRefs[index];
            if (gInfos.find(info) == -1) {
                int typeIndex = 0;
                for (; typeIndex < kNumberOfTypes; typeIndex++) {
                    const SkMemberInfo* temp = SkDisplayType::GetMembers(
                        maker, (SkDisplayTypes) typeIndex, NULL);
                    if (temp == info)
                        break;
                }
                SkASSERT(typeIndex < kNumberOfTypes);
                AddInfo((SkDisplayTypes) typeIndex, info, oldRefCounts[index]);
            }
        }
    } while (gUnknowns.count() > 0);
    qsort(gInfosTypeIDs.begin(), gInfosTypeIDs.count(), sizeof(gInfosTypeIDs[0]), &type_compare);
#ifdef SK_DEBUG
    FILE* condensed = fopen("../../src/animator/SkCondensedDebug.cpp", "w+");
    fprintf(condensed, "#include \"SkTypes.h\"\n");
    fprintf(condensed, "#ifdef SK_DEBUG\n");
#else
    FILE* condensed = fopen("../../src/animator/SkCondensedRelease.cpp", "w+");
    fprintf(condensed, "#include \"SkTypes.h\"\n");
    fprintf(condensed, "#ifdef SK_RELEASE\n");
#endif
    // write header
    fprintf(condensed, "// This file was automatically generated.\n");
    fprintf(condensed, "// To change it, edit the file with the matching debug info.\n");
    fprintf(condensed, "// Then execute SkDisplayType::BuildCondensedInfo() to "
        "regenerate this file.\n\n");
    // write name of memberInfo
    int typeNameIndex = 0;
    int unknown = 1;
    for (index = 0; index < gInfos.count(); index++) {
        const SkMemberInfo* info = gInfos[index];
        if (info == NULL)
            continue;
        char scratch[64];
        bool drawPrefix, displayPrefix;
        while (gTypeNames[typeNameIndex].fType < index)
            typeNameIndex++;
        if (gTypeNames[typeNameIndex].fType == index) {
            Get3DName(scratch, gTypeNames[typeNameIndex].fName);
            drawPrefix = gTypeNames[typeNameIndex].fDrawPrefix;
            displayPrefix = gTypeNames[typeNameIndex].fDisplayPrefix;
        } else {
            sprintf(scratch, "Unknown%d", unknown++);
            drawPrefix = displayPrefix = false;
        }
        WriteInfo(condensed, info, gInfosCounts[index], scratch, drawPrefix, displayPrefix);
    }
    // write array of table pointers
//  start here;
    fprintf(condensed, "static const SkMemberInfo* const gInfoTables[] = {");
    typeNameIndex = 0;
    unknown = 1;
    for (index = 0; index < gInfos.count(); index++) {
        const SkMemberInfo* info = gInfos[index];
        if (info == NULL)
            continue;
        char scratch[64];
        bool drawPrefix, displayPrefix;
        while (gTypeNames[typeNameIndex].fType < index)
            typeNameIndex++;
        if (gTypeNames[typeNameIndex].fType == index) {
            Get3DName(scratch, gTypeNames[typeNameIndex].fName);
            drawPrefix = gTypeNames[typeNameIndex].fDrawPrefix;
            displayPrefix = gTypeNames[typeNameIndex].fDisplayPrefix;
        } else {
            sprintf(scratch, "Unknown%d", unknown++);
            drawPrefix = displayPrefix = false;
        }
        fprintf(condensed, "\n\tg");
        if (drawPrefix)
            fprintf(condensed, "Draw");
        if (displayPrefix)
            fprintf(condensed, "Display");
        fprintf(condensed, "%sInfo", scratch);
        if (index < gInfos.count() - 1)
                putc(',', condensed);
    }
    fprintf(condensed, "\n};\n\n");
    // write the array of number of entries in the info table
    fprintf(condensed, "static const unsigned char gInfoCounts[] = {\n\t");
    int written = 0;
    for (index = 0; index < gInfosCounts.count(); index++) {
        int count = gInfosCounts[index];
        if (count < 0)
            continue;
        if (written > 0)
            putc(',', condensed);
        if (written % 20 == 19)
            fprintf(condensed, "\n\t");
        fprintf(condensed, "%d",count);
        written++;
    }
    fprintf(condensed, "\n};\n\n");
    // write array of type ids table entries correspond to
    fprintf(condensed, "static const unsigned char gTypeIDs[] = {\n\t");
    int typeIDCount = 0;
    typeNameIndex = 0;
    unknown = 1;
    for (index = 0; index < gInfosCounts.count(); index++) {
        const SkMemberInfo* info = gInfos[index];
        if (info == NULL)
            continue;
        typeIDCount++;
        char scratch[64];
        while (gTypeNames[typeNameIndex].fType < index)
            typeNameIndex++;
        if (gTypeNames[typeNameIndex].fType == index) {
            Get3DName(scratch, gTypeNames[typeNameIndex].fName);
        } else
            sprintf(scratch, "Unknown%d", unknown++);
        fprintf(condensed, "%d%c // %s\n\t", index,
            index < gInfosCounts.count() ? ',' : ' ', scratch);
    }
    fprintf(condensed, "\n};\n\n");
    fprintf(condensed, "static const int kTypeIDs = %d;\n\n", typeIDCount);
    // write the array of string pointers
    fprintf(condensed, "static const char* const gInfoNames[] = {");
    typeNameIndex = 0;
    unknown = 1;
    written = 0;
    for (index = 0; index < gInfosCounts.count(); index++) {
        const SkMemberInfo* info = gInfos[index];
        if (info == NULL)
            continue;
        if (written > 0)
                putc(',', condensed);
        written++;
        fprintf(condensed, "\n\tg");
        char scratch[64];
        while (gTypeNames[typeNameIndex].fType < index)
            typeNameIndex++;
        if (gTypeNames[typeNameIndex].fType == index) {
            Get3DName(scratch, gTypeNames[typeNameIndex].fName);
        } else
            sprintf(scratch, "Unknown%d", unknown++);
        fprintf(condensed, "%sStrings", scratch);
    }
    fprintf(condensed, "\n};\n\n");
    fprintf(condensed, "#endif\n");
    fclose(condensed);
    gInfos.reset();
    gInfosCounts.reset();
    gInfosTypeIDs.reset();
    gUnknowns.reset();
    gUnknownsCounts.reset();
}
Пример #14
0
int KUNinput(int len, char *buffer)
{
	extern int sprache;
	extern PERSONEN pers;
	extern PERSADR adr;
	extern KUNDEN kun;
	extern SPRACHEN spr;
	extern KUNDEN_TYP kunt;
	extern LAND land;
	extern WAEHRUNG whr;
	extern TEXTE txt;

	char *to_buffers[MAX_MENU_ITEMS];
	int status=(int)MPOK;

	if (ACTIONTYP == (unsigned char)INSERT)
		{
		pers.pers_id = (int)_UNDEF;
		pers.sta_id = (int)_UNDEF;

		kun.pers_id = (int)_UNDEF;
		kun.leiter = (int)_UNDEF;
		*kun.handy = NULL;
		*kun.attr1 = NULL;
		*kun.attr2 = NULL;
		*kun.email = NULL;
		*kun.fax = NULL;
		*kun.konto = NULL;
		*kun.tel = NULL;
		*kun.web = NULL;

		adr.pers_id = (int)_UNDEF;
		*adr.ans = NULL;
		*adr.adr1 = NULL;
		*adr.adr2 = NULL;
		*adr.adr3 = NULL;
		*adr.plz = NULL;
		*adr.kant = NULL;
		*adr.ort = NULL;
		*adr.tel = NULL;
		*adr.handy = NULL;
		*adr.tlx = NULL;
		*adr.fax = NULL;
		*adr.email = NULL;
		*adr.web = NULL;
		adr.sta_id = (int)_UNDEF;
		adr.mail_flag = _UNDEF;
		adr.rch_flag = _UNDEF;
		adr.haupt_flag = (int)1;

		}

	/* read menu string */
	status = UtilSplitMenubuffer(buffer, to_buffers, (char)NULL);
	if (status != MPOK)
		{
		UtilMsg((int)MPE_CUTBUFFERIN, MSGTYP_ERROR, NULL);
		kun.pers_id=(int)_UNDEF;
		return((int)MPERROR);
		}

	/* set PERSONEN to firmen/kunden typ */
	pers.pers_typ = (int)_PERS_FIRMEN;

	/* init */
	if (ACTIONTYP == (unsigned char)INSERT)
		{
		pers.pers_id = (int)_UNDEF;
		pers.s_id    = sprache;
		kun.pers_id  = (int)_UNDEF;
		pers.textid  = (int)_UNDEF;
		}

	/* PERSONEN name */
	if (*to_buffers[MKUN_NAME] != NULL)
		(void)copyTextTo((char *)pers.name, to_buffers[MKUN_NAME], (int)_CHAR512);
	else
		{
		UtilMsg((int)MPE_NONAM, MSGTYP_ERROR, NULL);
		pers.pers_id = (int)_UNDEF;
		kun.pers_id  = (int)_UNDEF;
		UtilSplitFreeMenubuffer(to_buffers);
		return((int)MPERROR);
		}

	/* PERSONEN ort */
	if (*to_buffers[MKUN_ORT] != NULL)
		(void)copyTextTo((char *)adr.ort,to_buffers[MKUN_ORT],(int)_CHAR256);
	else
		{
		UtilMsg((int)MPE_NOPERSORT, MSGTYP_ERROR, NULL);
		pers.pers_id = (int)_UNDEF;
		kun.pers_id  = (int)_UNDEF;
		UtilSplitFreeMenubuffer(to_buffers);
		return((int)MPERROR);
		}

	/* KUNDEN kundentyp */
	if (*to_buffers[MKUN_KUNT] != NULL)
		kun.k_typ_id = MPAPIselectEntry((int)_KUNDEN_TYP, to_buffers[MKUN_KUNT],
		               (char *)&kunt, sizeof(KUNDEN_TYP), sizeof(kun.k_typ_id));
	else
		kun.k_typ_id = (int)_UNDEF;
	if (kun.k_typ_id == (int)_UNDEF)
		{
		UtilMsg((int)MPE_NOKUNT, MSGTYP_ERROR, NULL);
		pers.pers_id = (int)_UNDEF;
		kun.pers_id  = (int)_UNDEF;
		UtilSplitFreeMenubuffer(to_buffers);
		return((int)MPERROR);
		}

	/* KUNDEN land */
	if (*to_buffers[MKUN_LAND] != NULL)
		adr.land_id = MPAPIselectEntry((int)_LAND, to_buffers[MKUN_LAND],
		               (char *)&land, sizeof(LAND), sizeof(adr.land_id));
	else
		adr.land_id = (int)_UNDEF;
	if (adr.land_id == (int)_UNDEF)
		{
		UtilMsg((int)MPE_NOLAND, MSGTYP_ERROR, NULL);
		pers.pers_id = (int)_UNDEF;
		kun.pers_id  = (int)_UNDEF;
		UtilSplitFreeMenubuffer(to_buffers);
		return((int)MPERROR);
		}

	/* KUNDEN waehrung */
	if (*to_buffers[MKUN_WHR] != NULL)
		kun.whr_id = MPAPIselectEntry((int)_WAEHRUNG, to_buffers[MKUN_WHR],
		               (char *)&whr, sizeof(WAEHRUNG), sizeof(kun.whr_id));
	else
		kun.whr_id = (int)_UNDEF;
	if (kun.whr_id == (int)_UNDEF)
		{
		UtilMsg((int)MPE_NOWHR, MSGTYP_ERROR, NULL);
		pers.pers_id = (int)_UNDEF;
		kun.pers_id  = (int)_UNDEF;
		UtilSplitFreeMenubuffer(to_buffers);
		return((int)MPERROR);
		}

	/* PERSONEN sprache */
	if (*to_buffers[MKUN_SPR] != NULL)
		{
		pers.s_id = MPAPIselectEntry((int)_SPRACHEN, to_buffers[MKUN_SPR],
		            (char *)&spr, sizeof(SPRACHEN), sizeof(pers.s_id));
		if (pers.s_id == (int)_UNDEF)
			pers.s_id = sprache;
		}
	else
		pers.s_id = sprache;

	/* KUNDEN diverses */
	(void)copyTextTo((char *)kun.tel,to_buffers[MKUN_TEL],_CHAR256);
	(void)copyTextTo((char *)kun.fax,to_buffers[MKUN_FAX],_CHAR256);
	(void)copyTextTo((char *)kun.tlx,to_buffers[MKUN_TLX],_CHAR256);
	(void)copyTextTo((char *)kun.konto,to_buffers[MKUN_KONTO],_CHAR256);
	(void)copyTextTo((char *)adr.kant,to_buffers[MKUN_KANT],_CHAR256);
	(void)copyTextTo((char *)kun.attr1,to_buffers[MKUN_ATTR1],_CHAR2000);
	(void)copyTextTo((char *)kun.attr2,to_buffers[MKUN_ATTR2],_CHAR2000);

	txt.typ = (int)_PERSONEN;
	txt.s_id = sprache;
	txt.textid = pers.textid;
	pers.textid = xTxtWrite(to_buffers[MKUN_TXT]);

	/* write PERSONEN entry first, because of new pers_id */
	/* but in DELETE case, this job is done by KUNdelete() */
	if (ACTIONTYP != (unsigned char)MPDELETE)
		{
		status = WriteEntry((int)_PERSONEN, (char *)&pers, (BEZEICHNUNG *)NULL);
		if (status == (int)MPOK)
			{
			WriteInfo((int)_PERSONEN, (char *)&pers, buffer);
			kun.pers_id = pers.pers_id;
			adr.pers_id = pers.pers_id;
			}
		else
			{
			UtilMsg(status, MSGTYP_ERROR, NULL);
			pers.pers_id = (int)_UNDEF;
			kun.pers_id  = (int)_UNDEF;
			UtilSplitFreeMenubuffer(to_buffers);
			return((int)MPERROR);
			}

		/* write PERSADR entry after PERSONEN (exept in DELETE case) */
		if (status == (int)MPOK)
			{
			status = WriteEntry((int)_PERSADR, (char *)&adr, (BEZEICHNUNG *)NULL);
			if (status == (int)MPOK)
				WriteInfo((int)_PERSADR, (char *)&adr, buffer);
			else
				{
				UtilMsg(status, MSGTYP_ERROR, NULL);
				pers.pers_id = (int)_UNDEF;
				kun.pers_id  = (int)_UNDEF;
				adr.pers_id  = (int)_UNDEF;
				return((int)MPERROR);
				}
			}
		}

	/* write KUNDEN entry after PERSONEN (exept in DELETE case) */
	status = WriteEntry((int)_KUNDEN, (char *)&kun, (BEZEICHNUNG *)NULL);
	if (status == (int)MPOK)
		WriteInfo((int)_KUNDEN, (char *)&kun, buffer);
	else
		{
		UtilMsg(status, MSGTYP_ERROR, NULL);
		pers.pers_id = (int)_UNDEF;
		kun.pers_id  = (int)_UNDEF;
		UtilSplitFreeMenubuffer(to_buffers);
		return((int)MPERROR);
		}

	UtilSplitFreeMenubuffer(to_buffers);
	return(status);
}
Пример #15
0
	void CogWriteLogStage() {
		auto stage = GETCOMPONENT(Stage);
		stage->WriteInfo(0);
	}
Пример #16
0
int KOMDinput(int len, char *buffer)
{
	extern int sprache;
	extern KOMM_DETAIL komd;
	extern KOMMISSION kom;
	extern KUNDEN kun;
	extern BUCHUNG bch;
	extern PERSONEN pers;
	extern REISENDER rei;
	extern KOLLEKTIV kol;

	char message[RECLAENGE];
	char *to_buffers[MAX_MENU_ITEMS];
	int status=(int)MPOK;

	/* Menueintraege holen */
	status = UtilSplitMenubuffer(buffer, to_buffers, '~');
	if (status != MPOK)
		{
		UtilMsg((int)MPE_CUTBUFFERIN, MSGTYP_ERROR, NULL);
		return((int)MPERROR);
		}

	/* Init */
	komd.komm_id = (int)_UNDEF;
	komd.bid     = (int)_UNDEF;
	komd.dln_id  = (int)_UNDEF;
	komd.kun_id  = (int)_UNDEF;
	komd.kol_id  = (int)_UNDEF;
	komd.prio    = (int)1;

	/* Kommissionsbezeichnung - zwingend */
	if (*to_buffers[MKOMD_KOM] != NULL)
		{
		komd.komm_id = MPAPIselectEntry((int)_KOMMISSION, to_buffers[MKOMD_KOM],
		       (char *)&kom,	sizeof(KOMMISSION), sizeof(komd.komm_id));
		}
	else
		komd.komm_id = (int)_UNDEF;
	if (komd.komm_id == (int)_UNDEF)
		{
		UtilMsg((int)MPE_NOKOMM, MSGTYP_ERROR, NULL);
		UtilSplitFreeMenubuffer(to_buffers);
		return((int)MPERROR);
		}

	/* REISENDER Kommission */
	if (*to_buffers[MKOMD_DLN] != NULL)
		{
		if (kom.komm_typ == (int)_KOMM_DLN)
			{
			komd.dln_id = MPAPIselectEntry((int)_REISENDER, to_buffers[MKOMD_DLN],
			  (char *)&rei, sizeof(REISENDER), sizeof(komd.dln_id));

			/* BUCHUNG relation DLN to BCH */
			if (*to_buffers[MKOMD_BCH] != NULL)
				{
				if (MPAPIselectEntry((int)_BUCHUNG, to_buffers[MKOMD_BCH], (char *)&bch,
				    sizeof(BUCHUNG), (size_t)0) != (int)_UNDEF)
					komd.bid=bch.bid;
				}
			}
		}

	/* KUNDEN Kommission */
	if (*to_buffers[MKOMD_KUN] != NULL && komd.dln_id == (int)_UNDEF)
		{
		if (kom.komm_typ == (int)_KOMM_KUNDE)
			komd.kun_id = MPAPIselectEntry((int)_KUNDEN, to_buffers[MKOMD_KUN],
			  (char *)&kun, sizeof(KUNDEN), sizeof(komd.kun_id));
		}

	/* KOLLEKTIV Kommission */
	if (*to_buffers[MKOMD_KOL] != NULL && komd.dln_id == (int)_UNDEF &&
	    komd.kun_id == (int)_UNDEF)
		{
		if (kom.komm_typ == (int)_KOMM_KOLLEKTIV)
			komd.kol_id = MPAPIselectEntry((int)_KOLLEKTIV, to_buffers[MKOMD_KOL],
			   (char *)&kol, sizeof(KOLLEKTIV), sizeof(komd.kol_id));
		}

	/* UNDEF ordering */
	if (*to_buffers[MKOMD_ORD] == NULL)
		komd.prio = MPAPIid_max((int)_KOMM_DETAIL, (int)_ORD, (char *)&komd) + (int)1;
	else
		{
		status = readInteger(&komd.prio, to_buffers[MKOMD_ORD]);
		if (status == (int)MPERROR)
			komd.prio = MPAPIid_max((int)_KOMM_DETAIL, (int)_ORD,
			   (char *)&komd) + (int)1;
		else
			{
			if (komd.prio < (int)1)
				komd.prio = MPAPIid_max((int)_KOMM_DETAIL, (int)_ORD,
				   (char *)&komd) + (int)1;
			}
		}

	UtilSplitFreeMenubuffer(to_buffers);

	/* security check if the entry is OK or not */
	if ((komd.dln_id != (int)_UNDEF && komd.bid != (int)_UNDEF) ||
	    (komd.kun_id != (int)_UNDEF) || (komd.kol_id != (int)_UNDEF))
		{
		/* schreibe Kommissionseintrag auf DB */
		status=WriteEntry((int)_KOMM_DETAIL, (char *)&komd, (BEZEICHNUNG *)NULL);
		if (status == (int)MPERROR)
			komd.komm_id = (int)_UNDEF;
		else
			(void)WriteInfo((int)_KOMM_DETAIL, (char *)&komd, message);
		}
	else
		{
		UtilMsg((int)MPE_NOKOMM, MSGTYP_ERROR, NULL);
		status = (int)MPERROR;
		}

	return(status);
}
Пример #17
0
int PCXinput(int len , char *buffer )
{
	extern MEMOBJ sqlmem;
	extern PCX_FILES pcx;
	extern BEZEICHNUNG bez;
	extern int sprache;

	BEZEICHNUNG *Pbez;
	BEZEICHNUNG localbez;
	char *to_buffers[MAX_MENU_ITEMS];
	char query[_RECORDLEN];
	int status=MPOK;
	int anzahl;

	/* init at insert mode */
	if (ACTIONTYP == (unsigned char)INSERT)
		{
		pcx.pcx_id = (int)_UNDEF;
		pcx.x = (int)0;
		pcx.y = (int)0;
		pcx.folge = (int)0;
		}

	/* get menu fields */
	status = UtilSplitMenubuffer(buffer, to_buffers, (char)NULL);
	if (status != MPOK)
		{
		UtilMsg((int)MPE_CUTBUFFERIN, MSGTYP_ERROR, NULL);
		pcx.pcx_id = (int)_UNDEF;
		return((int)MPERROR);
		}

	/* check up BEZEICHNUNG */
	if (*to_buffers[MPCX_BEZ] == NULL)
		{
		UtilMsg((int)MPE_NOPCX, MSGTYP_ERROR, NULL);
		UtilSplitFreeMenubuffer(to_buffers);
		return((int)MPERROR);
		}

	/* manage */
	switch(ACTIONTYP)
		{
		case (unsigned char)INSERT:
		case (unsigned char)UPDATE:
			/* it's not allowed to entries with the same bez */
			if (ACTIONTYP == (unsigned char)INSERT)
				{
				if (MPAPIselectEntry(_PCX_FILES, to_buffers[MPCX_BEZ], (char *)&pcx,
				    sizeof(pcx), sizeof(pcx.pcx_id)) != (int)_UNDEF)
					{
					UtilMsg((int)MPE_PCXINPUT, MSGTYP_ERROR, NULL);
					status = (int)MPERROR;
					break;
					}
				}
			/* file name must be present */
			if (*to_buffers[MPCX_FILE] == NULL)
				{
				UtilMsg((int)MPE_PCXINPUT, MSGTYP_ERROR, NULL);
				status = (int)MPERROR;
				break;
				}

			bez.s_id=(int)sprache;
			bez.typ=(int)_PCX_FILES;
			(void)copyTextTo(bez.bez, to_buffers[MPCX_BEZ], (int)_BEZLEN);
			(void)copyTextTo(pcx.filename, to_buffers[MPCX_FILE], (int)_FILELEN);

			/* typ, objekt, folge */
			localbez.s_id=(int)sprache;
			localbez.typ=(int)_UNDEF;
			(void)strcpy(localbez.bez, to_buffers[MPCX_TYP]);
			if (MPAPIselectEntry((int)_BEZEICHNUNG, to_buffers[MPCX_TYP], (char *)&localbez,
			    sizeof(BEZEICHNUNG), sizeof(localbez.bez_id)) != (int)_UNDEF)
				{
				pcx.typ = localbez.typ;
				(void)sprintf(query, _SEL_BEZ_FROMTYP, to_buffers[MPCX_TYPCODE],
				         sprache, pcx.typ);
				status=MPAPIdb_sqlquery((int)_BEZEICHNUNG, &sqlmem.buffer, query,
				                   &anzahl, &sqlmem.datalen, &sqlmem.alloclen);
				if (status == (int)MPOK && anzahl > 0)
					{
					Pbez = (BEZEICHNUNG *)sqlmem.buffer;
					pcx.typcode = Pbez[0].bez_id;
					if (pcx.typcode != (int)_UNDEF)
						{
						/* image nr and koordinates */
						if (*to_buffers[MPCX_NR] != NULL)
							readInteger(&pcx.folge, to_buffers[MPCX_NR]);
						if (*to_buffers[MPCX_X] != NULL)
							readInteger(&pcx.x, to_buffers[MPCX_X]);
						if (*to_buffers[MPCX_Y] != NULL)
		   				readInteger(&pcx.y, to_buffers[MPCX_Y]);
						}
					else
						{
						UtilMsg((int)MPE_PCXINPUT, MSGTYP_ERROR, NULL);
						status = (int)MPERROR;
						}
					}
				else
					{
					UtilMsg((int)MPE_PCXINPUT, MSGTYP_ERROR, NULL);
					status = (int)MPERROR;
					}
				}
			else
				{
				UtilMsg((int)MPE_PCXINPUT, MSGTYP_ERROR, NULL);
				status = (int)MPERROR;
				}
			break;
		case (unsigned char)MPDELETE:
			if (MPAPIselectEntry(_PCX_FILES, to_buffers[MPCX_BEZ], (char *)&pcx,
			    sizeof(pcx), sizeof(pcx.pcx_id)) == (int)_UNDEF)
				{
				UtilMsg((int)MPE_NOENTRYFOUND, MSGTYP_ERROR, NULL);
				status = (int)MPERROR;
				}
			break;
		}

	if (status == (int)MPOK)
		{
		/* write entry or delete entry */
		status=WriteEntry((int)_PCX_FILES, (char *)&pcx, &bez);
		if (status != (int)MPOK)
			pcx.pcx_id=(int)_UNDEF;
		else
			(void)WriteInfo((int)_PCX_FILES, (char *)&pcx, buffer);
		}

	UtilSplitFreeMenubuffer(to_buffers);

	return(status);
}
Пример #18
0
	void CogWriteLogActualScene() {
		auto stage = GETCOMPONENT(Stage);
		auto actualScene = stage->GetActualScene();
		if (actualScene != nullptr) actualScene->WriteInfo(0);
	}
    void FabricTimeController::RefreshAndPersist()
    {
        shared_ptr<ScopedActiveFlag> scopedActiveFlag;
        if (!ScopedActiveFlag::TryAcquire(refreshActive_, scopedActiveFlag))
        {
            WriteInfo(
                TraceComponent, 
                "{0} FabricTimeController refresh already active",
                this->TraceId);
            TryScheduleTimer(StoreConfig::GetConfig().FabricTimePersistInterval);
            return;
        }
        
		if (cancelled_.load())
		{
			WriteInfo(
				TraceComponent,
				"{0} FabricTimeController refresh already cencelled",
				this->TraceId);
            refreshTimer_->Cancel();
			return;
		}

		ActivityId activityId;
        StoreTransactionInternal tx=StoreTransactionInternal::Create(&replicatedStore_,replicatedStore_.PartitionedReplicaId,activityId);

        //if the controller is not ready, then initialize the controller
        if(!ready_)
        {
            //first time call            
            ErrorCode error=tx.Exists(fabricTimeData_);
            if(error.IsError(ErrorCodeValue::NotFound))
            {
                fabricTimeData_.RefreshAndGetCurrentStoreTime();
                error=tx.Insert(fabricTimeData_);
                if(!error.IsSuccess())
                {
                    WriteWarning(
                        TraceComponent,
                        "{0} Fail to insert logical time in replicated store. Error:{1}, PartitionReplicaId:{2}, Activity:{3}",
                        this->TraceId,
                        error,
                        PartitionedReplicaId,
                        activityId);       
                    TryScheduleTimer(StoreConfig::GetConfig().FabricTimePersistInterval);
                    return;
                }
            }
            //load logical time from store
            else
            {
                error=tx.ReadExact(fabricTimeData_);
                if(!error.IsSuccess())
                {
                    WriteWarning(
                        TraceComponent,
                        "{0} Fail to read logical time in replicated store. Error:{1}, PartitionReplicaId:{2}, Activity:{3}",
                        this->TraceId,
                        error,
                        PartitionedReplicaId,
                        activityId);       
                    TryScheduleTimer(StoreConfig::GetConfig().FabricTimePersistInterval);
                    return;
                }
            }
            auto operation=StoreTransactionInternal::BeginCommit(
                std::move(tx),
                StoreConfig::GetConfig().FabricTimeRefreshTimeoutValue,
                [this,activityId](AsyncOperationSPtr const & operation) 
                    { 
                        RefreshAndPersistCompletedCallback(operation,true,false,activityId);          
                    },
                this->CreateAsyncOperationRoot());
            //Complete Synchronously
            RefreshAndPersistCompletedCallback(operation,true,true,activityId);   
        }
        else
        {
            //refresh the value
            fabricTimeData_.RefreshAndGetCurrentStoreTime();
            tx.Update(fabricTimeData_,false);
            auto componentRoot=this->CreateComponentRoot();
            auto operation=StoreTransactionInternal::BeginCommit(
                std::move(tx),
                StoreConfig::GetConfig().FabricTimeRefreshTimeoutValue,
                [componentRoot,this,activityId](AsyncOperationSPtr const & operation) 
                    { 
                        RefreshAndPersistCompletedCallback(operation,false,false,activityId);          
                    },
                 this->CreateAsyncOperationRoot());
            //Complete Synchronously
            RefreshAndPersistCompletedCallback(operation,false,true,activityId);    
        }
    }