Esempio n. 1
0
//The callback calls this function passing the relative y position of where
//the user clicked on the hot spot.
void SelectFileDialogYPos( UINT16 usRelativeYPos )
{
	INT16 sSelName;
	INT32 x;
	FDLG_LIST *FListNode;

	sSelName = usRelativeYPos / 15;
	
	//This is a field in the text editmode, but clicked via mouse.
	SetActiveField( 1 );

	// Skip to first filename
	FListNode = FileList;
	for(x=0;x<iTopFileShown && x<iTotalFiles && FListNode != NULL;x++)
	{
		FListNode = FListNode->pNext;
	}
	
	for(x=iTopFileShown;x<(iTopFileShown+8) && x<iTotalFiles && FListNode != NULL; x++)
	{
		if( (INT32)sSelName == (x-iTopFileShown) )
		{
			INT32 iCurrClickTime;
			iCurrFileShown = x;
			FListNode->FileInfo.zFileName[30] = 0;
			swprintf( gzFilename, L"%S", FListNode->FileInfo.zFileName );
			if( ValidFilename() )
			{
				SetInputFieldStringWith16BitString( 0, gzFilename );
			}
			else
			{
				SetInputFieldStringWith16BitString( 0, L"" );
				wcscpy( gzFilename, L"" );
			}

			RenderInactiveTextField( 0 );

			//Calculate and process any double clicking...
			iCurrClickTime = GetJA2Clock();
			if( iCurrClickTime - iLastClickTime < 400 && x == iLastFileClicked )
			{ //Considered a double click, so activate load/save this filename.
				gfDestroyFDlg = TRUE;
				iFDlgState = iCurrentAction == ACTION_SAVE_MAP ? DIALOG_SAVE : DIALOG_LOAD;
			}
			iLastClickTime = iCurrClickTime;
			iLastFileClicked = x;
		}
		FListNode = FListNode->pNext;
	}
}
Esempio n. 2
0
BOOLEAN ApplyNewExitGridValuesToTextFields()
{
    UINT16 str[10];
    //exit grid input fields
    if( iCurrentTaskbar != TASK_MAPINFO )
        return FALSE;
    swprintf( str, L"%c%d", gExitGrid.ubGotoSectorY + 'A' - 1, gExitGrid.ubGotoSectorX );
    SetInputFieldStringWith16BitString( 7, str );
    swprintf( str, L"%d", gExitGrid.ubGotoSectorZ );
    SetInputFieldStringWith16BitString( 8, str );
    swprintf( str, L"%d", gExitGrid.usGridNo );
    SetInputFieldStringWith16BitString( 9, str );
    SetActiveField( 0 );
    return TRUE;
}
Esempio n. 3
0
void UpdateMapInfoFields()
{
    UINT16 str[10];
    //Update the text fields to reflect the validated values.
    //light rgb fields
    swprintf( str, L"%d", gEditorLightColor.peRed );
    SetInputFieldStringWith16BitString( 1, str );
    swprintf( str, L"%d", gEditorLightColor.peGreen );
    SetInputFieldStringWith16BitString( 2, str );
    swprintf( str, L"%d", gEditorLightColor.peBlue );
    SetInputFieldStringWith16BitString( 3, str );

    swprintf( str, L"%d", gsLightRadius );
    SetInputFieldStringWith16BitString( 4, str );
    swprintf( str, L"%d", gusLightLevel );
    SetInputFieldStringWith16BitString( 5, str );

    if( !gMapInformation.ubRestrictedScrollID )
        swprintf( str, L"" );
    else
        swprintf( str, L"%d", gMapInformation.ubRestrictedScrollID );
    SetInputFieldStringWith16BitString( 6, str );

    ApplyNewExitGridValuesToTextFields();
}
void ExtractAndUpdateBuildingInfo()
{
	UINT16 str[4];
	INT32 temp;
	//extract light1 colors
	temp = min( GetNumericStrictValueFromField( 1 ), 255 );
	if( temp != -1 )
	{
		gubCurrRoomNumber = (UINT8)temp;
	}
	else
	{
		gubCurrRoomNumber = 0;
	}
	swprintf( str, L"%d", gubCurrRoomNumber );
	SetInputFieldStringWith16BitString( 1, str );
	SetActiveField( 0 );
}
Esempio n. 5
0
UINT32 ProcessLoadSaveScreenMessageBoxResult()
{
	FDLG_LIST *curr, *temp;
	gfRenderWorld = TRUE;
	RemoveMessageBox();
	if( gfIllegalName )
	{
		fEnteringLoadSaveScreen = TRUE;
		RemoveFileDialog();
		MarkWorldDirty();
		return gfMessageBoxResult ? LOADSAVE_SCREEN : EDIT_SCREEN;
	}
	if( gfDeleteFile )
	{
		if( gfMessageBoxResult )
		{ //delete file
			INT32 x;
			curr = FileList;
			for( x = 0; x < iCurrFileShown && x < iTotalFiles && curr; x++ )
			{
				curr = curr->pNext;
			}
			if( curr )
			{
				if( gfReadOnly )
				{
					FileClearAttributes( gszCurrFilename );
					gfReadOnly = FALSE;
				}
				FileDelete( gszCurrFilename );

				//File is deleted so redo the text fields so they show the 
				//next file in the list.
				temp = curr->pNext;
				if( !temp )
					temp = curr->pPrev;
				if( !temp )
					wcscpy( gzFilename, L"" );
				else
					swprintf( gzFilename, L"%S", temp->FileInfo.zFileName );
				if( ValidFilename() )
				{
					SetInputFieldStringWith16BitString( 0, gzFilename );
				}
				else
				{
					SetInputFieldStringWith16BitString( 0, L"" );
					wcscpy( gzFilename, L"" );
				}
				RemoveFromFDlgList( &FileList, curr );
				iTotalFiles--;
				if( !iTotalFiles )
				{
					gfNoFiles = TRUE;
					if( iCurrentAction == ACTION_LOAD_MAP )
						DisableButton( iFileDlgButtons[0] );
				}
				if( iCurrFileShown >= iTotalFiles )
					iCurrFileShown--;
				if( iCurrFileShown < iTopFileShown )
					iTopFileShown -= 8;
				if( iTopFileShown < 0 )
					iTopFileShown = 0;
			}
		}
		MarkWorldDirty();
		RenderWorld();
		gfDeleteFile = FALSE;
		iFDlgState = DIALOG_NONE;
		return LOADSAVE_SCREEN;
	}
	if(gfLoadError || gfSaveError)//dnl ch37 200909
	{
		MarkWorldDirty();
		RenderWorld();
		fEnteringLoadSaveScreen = TRUE;
		return(gfMessageBoxResult ? LOADSAVE_SCREEN : EDIT_SCREEN);
	}
	if( gfReadOnly )
	{ //file is readonly.  Result will determine if the file dialog stays up.
		fEnteringLoadSaveScreen = TRUE;
		RemoveFileDialog();
		return gfMessageBoxResult ? LOADSAVE_SCREEN : EDIT_SCREEN;
	}
	if( gfFileExists )
	{
		if( gfMessageBoxResult )
		{ //okay to overwrite file
			RemoveFileDialog();
			gbCurrentFileIOStatus = INITIATE_MAP_SAVE;
			return LOADSAVE_SCREEN;
		}
		fEnteringLoadSaveScreen = TRUE;
		RemoveFileDialog();
		return(LOADSAVE_SCREEN);//dnl ch36 210909
	}
//	Assert( 0 );
	return LOADSAVE_SCREEN;
}