//--------------------------------------------------------------------------------------
// Entry point to the program. Initializes everything and goes into a message processing 
// loop. Idle time is used to render the scene.
//--------------------------------------------------------------------------------------
int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow )
{
    // Enable run-time memory check for debug builds.
#if defined(DEBUG) | defined(_DEBUG)
    _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif

    DXUTSetCallbackDeviceChanging( ModifyDeviceSettings );
    DXUTSetCallbackMsgProc( MsgProc );
    DXUTSetCallbackKeyboard( KeyboardProc );
    DXUTSetCallbackFrameMove( OnFrameMove );

    DXUTSetCallbackD3D11DeviceAcceptable( IsD3D11DeviceAcceptable );
    DXUTSetCallbackD3D11DeviceCreated( OnD3D11CreateDevice );
    DXUTSetCallbackD3D11SwapChainResized( OnD3D11ResizedSwapChain );
    DXUTSetCallbackD3D11FrameRender( OnD3D11FrameRender );
    DXUTSetCallbackD3D11SwapChainReleasing( OnD3D11ReleasingSwapChain );
    DXUTSetCallbackD3D11DeviceDestroyed( OnD3D11DestroyDevice );

    InitApp();

    DXUTInit( true, true );                 // Use this line instead to try to create a hardware device

    DXUTSetCursorSettings( true, true ); // Show the cursor and clip it when in full screen
    DXUTCreateWindow( L"AdaptiveTessellationCS40" );
    CWaitDlg CompilingShadersDlg;
    if ( DXUT_EnsureD3D11APIs() )
        CompilingShadersDlg.ShowDialog( L"Compiling Shaders" );
    DXUTCreateDevice(D3D_FEATURE_LEVEL_10_0, true, 1024, 768 );
    CompilingShadersDlg.DestroyDialog();
    DXUTMainLoop(); // Enter into the DXUT render loop

    return DXUTGetExitCode();
}
//--------------------------------------------------------------------------------------
// Entry point to the program. Initializes everything and goes into a message processing 
// loop. Idle time is used to render the scene.
//--------------------------------------------------------------------------------------
int WINAPI wWinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpCmdLine*/, INT /*nCmdShow*/)
{
    // Enable run-time memory check for debug builds.
#if defined(DEBUG) | defined(_DEBUG)
    _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif

    // Set DXUT callbacks
    DXUTSetCallbackDeviceChanging(ModifyDeviceSettings);
    DXUTSetCallbackMsgProc(MsgProc);
    DXUTSetCallbackKeyboard(OnKeyboard);
    DXUTSetCallbackFrameMove(OnFrameMove);

    DXUTSetCallbackD3D11DeviceAcceptable(IsD3D11DeviceAcceptable);
    DXUTSetCallbackD3D11DeviceCreated(OnD3D11CreateDevice);
    DXUTSetCallbackD3D11SwapChainResized(OnD3D11ResizedSwapChain);
    DXUTSetCallbackD3D11FrameRender(OnD3D11FrameRender);
    DXUTSetCallbackD3D11SwapChainReleasing(OnD3D11ReleasingSwapChain);
    DXUTSetCallbackD3D11DeviceDestroyed(OnD3D11DestroyDevice);
    InitApp();

    DXUTInit(true, true, NULL); // Parse the command line, show msgboxes on error, no extra command line params

    DXUTSetCursorSettings(true, true); // Show the cursor and clip it when in full screen
    DXUTCreateWindow(L"CascadedShadowDepthMap");
    CWaitDlg CompilingShadersDlg;
    if (DXUT_EnsureD3D11APIs())
        CompilingShadersDlg.ShowDialog(L"Compiling Shaders and loading models.");
    DXUTCreateDevice(D3D_FEATURE_LEVEL_10_0, true, 800, 600);
    CompilingShadersDlg.DestroyDialog();
    DXUTMainLoop(); // Enter into the DXUT render loop

    return DXUTGetExitCode();
}
void CDownloadProperties_MirrorsPage::OnCalcmirrspeed() 
{
	CWaitDlg dlg;
	dlg.StartWaiting (LS (L_CALCULATINGMIRRORSSPEED), _threadCalcMirrSpeed, TRUE, this);

	UpdateMirrSpeed ();
	UpdateMirrUsing ();
}
Example #4
0
BOOL CFlashVideoDownloadsWnd::CreateDownload(LPCSTR pszUrl, bool bTopMostErrMessages)
{
	DWORD dwMB = bTopMostErrMessages ? MB_SYSTEMMODAL : 0;

	if (_App.FlvMonitoring_Enable () == FALSE)
	{
		MessageBox (LS (L_ENABLE_FLVMONITORING_FIRST), NULL, MB_ICONEXCLAMATION | dwMB);
		return FALSE;
	}

	CString strUrl;

	if (pszUrl == NULL || *pszUrl == 0)
	{
		CDlgCreateFlvDownloadsByWebPageUrl dlg;
		if (IDOK != AfxGetApp ()->m_pMainWnd->SendMessage (WM_DOMODAL, 0, (LPARAM)&dlg))
			return FALSE;
		strUrl = dlg.m_strWebPageUrl;
	}
	else
	{
		strUrl = pszUrl;
	}

	CWaitDlg dlgWait;
	HRESULT hrRes;
	dlgWait.StartWaiting (LS (L_SEARCHING_FLVS), _threadPassWebPageUrlToFlvSniffDll, FALSE, (LPVOID)(LPCTSTR)strUrl, (LPVOID)&hrRes);

	if (hrRes != S_OK)
	{
		switch (hrRes)
		{
		case S_FALSE:
			MessageBox (LS (L_NOFLVSFOUND), NULL, MB_ICONEXCLAMATION | dwMB);
			break;

		case E_INVALIDARG:
			MessageBox (LS (L_FLVWEBPAGENOTFOUND), NULL, MB_ICONEXCLAMATION | dwMB);
			break;

		default:
			CString str;
			str.Format (LS (L_ERRGETFLVDLDS), hrRes);
			MessageBox (str, LS (L_ERROR), MB_ICONERROR | dwMB);
			break;
		}
	}

	return hrRes == S_OK;

	
}
Example #5
0
void CDialogTextures::OnLoad() {
    CWaitCursor cursor;
    CWaitDlg dlg;
    dlg.AllowCancel( true );
    dlg.SetWindowText( "Loading textures..." );
    Texture_HideAll();
    HTREEITEM item = m_treeTextures.GetSelectedItem();
    idStr name = buildItemName( item, TypeNames[TEXTURES] );
    if ( !name.Cmpn( TypeNames[MATERIALS], strlen( TypeNames[MATERIALS] ) ) ) {
        name = buildItemName( item, TypeNames[MATERIALS] );
    }
    loadTree( item, name, &dlg );
}
Example #6
0
void CDownloads_History::ApplyFilter(fsDldHistRecFilter* filter)
{
	if (filter == NULL)
	{
		DeleteAllRecords ();
		return;
	}

	if (m_mgr->GetRecordCount () < 600)	
		ApplyFilter_imp (filter);	
	else
	{
		
		CWaitDlg dlg;
		dlg.StartWaiting (LS (L_BUILDINGLISTOFHISTORY), _threadApplyFilter, FALSE, this, filter);
	}
}
void vmsMediaConvertMgr::ConvertMediaFile(vmsDownloadSmartPtr dld, vmsMediaConvertMgr_OptionsSource enOs)
{
	vmsConvertMediaFileContext *pcmfc = new vmsConvertMediaFileContext;

	if (enOs == MCM_OS_SEARCH_IN_MGR)
	{
		int nIndex = FindDownload (dld);
		if (nIndex == -1)
			return;

		vmsConvertMediaFileContext* ctx = (vmsConvertMediaFileContext*)m_vTasks [nIndex];
		if (ctx == 0)
			return;
		pcmfc->dld = ctx->dld;	
		pcmfc->stgs = ctx->stgs;
		
		
		m_vTasks.erase (m_vTasks.begin () + nIndex);
		setDirty();
		getPersistObjectChildren ()->removePersistObject (nIndex);
		
		
	}
	else
	{
		pcmfc->dld = dld;
		GetDefaultSettings (pcmfc->stgs);

		if (enOs == MCM_OS_SHOW_OPTIONS_UI)
		{
			CDlg_Convert dlg (&pcmfc->stgs);
			if (IDOK != _DlgMgr.DoModal (&dlg))
			{
				delete pcmfc;
				return;
			}
		}
	}

	CWaitDlg *dlg = new CWaitDlg;
	dlg->StartWaiting (LS (L_CONVERTING), _threadConvertMediaFile, TRUE, pcmfc, 
		(LPVOID)(enOs == MCM_OS_SHOW_OPTIONS_UI), 
		NULL, NULL, NULL, NULL, FALSE);
}
Example #8
0
void CCreateBatchDownload::OnQuerysize() 
{
	if (FALSE == CheckUrl ())
		return;

	if (FALSE == ReadAuth ())
		return;

	
	if (m_bBLParametersChanged)
	{
		if (FALSE == BuildBatchList ())
			return;

		m_pvDownloads = GenerateDownloads ();
	}

	CWaitDlg dlg;	
	dlg.StartWaiting (LS (L_QUERINGSIZE), _threadCalcSize, TRUE, this, &dlg);
}
Example #9
0
void vmsGetItButton::onClick()
{
	m_bWasClick = true;

	if (m_youtubeVideo)
	{
		IFDMFlashVideoDownloadsPtr spFVDownloads;
		verify (SUCCEEDED (spFVDownloads.CreateInstance (__uuidof (FDMFlashVideoDownloads))));
		assert (spFVDownloads != NULL);
		if (spFVDownloads == NULL)
		{
			return;
		}
		verify (SUCCEEDED (spFVDownloads->CreateFromUrl (SysAllocString (m_wstrHtmlPageUrl.c_str ()))));
		return;
	}

	DWORD dw;
	CloseHandle (
		CreateThread (NULL, 0, _threadOnDownloadItBtnClicked, this, 0, &dw));

	CWaitDlg dlg;
	dlg.m_strMsg = vmsFdmTranslations::o ().GetString (L_SEARCHING_FLVS);
	dlg.m_hEvCloseDlg = m_hEvCloseDlg = CreateEvent (NULL, TRUE, FALSE, NULL);
	if (dlg.m_strMsg.empty ())
		dlg.m_strMsg = _T ("Searching flash videos...");
	dlg.Create (GetFocus ());

	while (IsWindow (dlg))
	{
		MSG msg;
		while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
			DispatchMessage (&msg);
		Sleep (10);
	}
	
	CloseHandle (m_hEvCloseDlg);
	m_hEvCloseDlg = NULL;
}
void CDownloadProperties_MirrorsPage::OnFindmirrors() 
{
	if (m_dld->pMgr->GetDownloadMgr ()->GetDownloader ()->IsMirrSearchPerformed ())
	{
		MessageBox (LS (L_MIRRSEARCHPERFORMEDALREADY), LS (L_DONE), MB_ICONEXCLAMATION);
		return;
	}

	CWaitDlg dlg;
	dlg.StartWaiting (LS (L_SEARCHINGFORMIRRORS), _threadFindMirrors, TRUE, this);

	FullUpdateMirrList ();

	if (m_dld->pMgr->GetDownloadMgr ()->GetDownloader ()->GetFoundMirrorCount ())
	{
		char sz [10000];
		sprintf (sz, LS (L_NMIRRORSFOUND), m_dld->pMgr->GetDownloadMgr ()->GetDownloader ()->GetFoundMirrorCount ());
		MessageBox (sz, LS (L_DONE));
		CancelToClose ();
	}
	else
		MessageBox (LS (L_NOMIRRORSFOUND), LS (L_DONE));
}
Example #11
0
UINT AfxRecalculateYield( int nDays, BOOL bReport )
{
	// 计算市场年平均收益率
	double	market_yield_average = 0.0, market_yield_d = 0.0;
	double	market_dayyield_average = 0.0, market_dayyield_d = 0.0;
	CKData	& kdayMain	=	AfxGetStockMain().GetKDataDay();

	if( kdayMain.GetSize() <= nDays )
	{
		if( bReport )
			AfxMessageBox( IDS_RECALYIELD_NOSZZS, MB_OK | MB_ICONINFORMATION );
		return 0;
	}
	BOOL bmarket_yield_ok = CalculateYieldYear( kdayMain, &market_yield_average, &market_yield_d, nDays );
	BOOL bmarket_dayyield_ok = CalculateYieldDay( kdayMain, &market_dayyield_average, &market_dayyield_d, nDays );

	if( !bmarket_yield_ok && !bmarket_dayyield_ok )
	{
		if( bReport )
			AfxMessageBox( IDS_RECALYIELD_NOSZZS, MB_OK | MB_ICONINFORMATION );
	}
	
	// 开始生成结果数据
	CStockContainer & container = AfxGetStockContainer();
	int	nCount	=	0;
	// 等待对话框
	CWaitDlg	*	pWait	=	NULL;
	if( bReport )
	{
		pWait	=	new CWaitDlg( AfxGetMainWnd() );
		pWait->SetProgressRange( 0, container.GetSize()-1 );
	}
	for( int i=0; i<container.GetSize(); i++ )
	{
		if( pWait )
		{
			pWait->SetProgress( i );
			if( pWait->WaitForCancel( ) )
				break;
		}

		CStockInfo	& info	=	container.ElementAt(i);

		LONG	stocktype	=	info.GetType();
		if( CStock::typeshIndex != stocktype && CStock::typeshA != stocktype && CStock::typeshB != stocktype
			&& CStock::typeszIndex != stocktype && CStock::typeszA != stocktype && CStock::typeszB != stocktype )
			continue;

		CStock	stock;
		stock.SetStockInfo( &info );
		AfxPrepareStockData(&AfxGetDB(),stock,CKData::ktypeDay,CKData::formatXDRup,CKData::mdtypeClose,TRUE,TRUE);
		CKData	& kday	=	stock.GetKDataDay();

		info.m_fYield_average		=	(float)STKLIB_DATA_INVALID;
		info.m_fYield_stddev		=	(float)STKLIB_DATA_INVALID;
		info.m_fBeite				=	(float)STKLIB_DATA_INVALID;

		double	yield_average = 0., yield_d = 0., beite = 0. ;
		if( CalculateYieldYear( kday, &yield_average, &yield_d, nDays ) )
		{
			info.m_fYield_average	=	(float)( 100. * yield_average );
			info.m_fYield_stddev	=	(float)( 100. * yield_d );
			if( bmarket_yield_ok && CalculateBeiteYear( kday, kdayMain, market_yield_average, market_yield_d, &beite, nDays ) )
				info.m_fBeite		=	(float)( beite );
			else if( bmarket_dayyield_ok && CalculateBeiteDay( kday, kdayMain, market_dayyield_average, market_dayyield_d, &beite, nDays ) )
				info.m_fBeite		=	(float)( beite );
		}
		else if( CalculateYieldDay( kday, &yield_average, &yield_d, nDays ) )
		{
			info.m_fYield_average	=	(float)( 100. * (pow(1+yield_average,STKLIB_DAYS_INONEYEAR)-1) );
			info.m_fYield_stddev	=	(float)( 100. * sqrt((double)STKLIB_DAYS_INONEYEAR) * yield_d );
			if( bmarket_dayyield_ok && CalculateBeiteDay( kday, kdayMain, market_dayyield_average, market_dayyield_d, &beite, nDays ) )
				info.m_fBeite		=	(float)( beite );
		}

		nCount	++;
	}

	// 保存到硬盘文件
	AfxGetDB().StoreBasetable( container );

	// 关闭等待对话框和目标文件
	if( pWait )
	{
		pWait->DestroyWindow();
		delete	pWait;
	}

	return nCount;
}
Example #12
0
/*
 =======================================================================================================================
	Map_SaveFile
 =======================================================================================================================
 */
bool Map_SaveFile(const char *filename, bool use_region, bool autosave) {
	entity_t	*e, *next;
	idStr		temp;
	int			count;
	brush_t		*b;
	idStr status;

	int len = strlen(filename);
	WIN32_FIND_DATA FileData;
	if (FindFirstFile(filename, &FileData) != INVALID_HANDLE_VALUE) {
		// the file exists;
		if (len > 0 && GetFileAttributes(filename) & FILE_ATTRIBUTE_READONLY) {
			g_pParentWnd->MessageBox("File is read only", "Read Only", MB_OK);
			return false;
		}
	}

	if (filename == NULL || len == 0 || (filename && stricmp(filename, "unnamed.map") == 0)) {
		CFileDialog dlgSave(FALSE,"map",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,"Map Files (*.map)|*.map||",AfxGetMainWnd());
		if (dlgSave.DoModal() == IDOK) {
			filename = dlgSave.m_ofn.lpstrFile;
			strcpy(currentmap, filename);
		}
		else {
			return false;
		}
	}

	MEMORYSTATUSEX statex;
	statex.dwLength = sizeof (statex);
	GlobalMemoryStatusEx (&statex);
	if ( statex.dwMemoryLoad > 95 ) {
		g_pParentWnd->MessageBox("Physical memory is over 95% utilized. Consider saving and restarting", "Memory");
	}

	CWaitDlg dlg;
	Pointfile_Clear();

	temp = filename;
	temp.BackSlashesToSlashes();

	if ( !use_region ) {
		idStr backup;
		backup = temp;
		backup.StripFileExtension();
		backup.SetFileExtension( ".bak" );
		if ( _unlink(backup) != 0 && errno != 2 ) { // errno 2 means the file doesn't exist, which we don't care about
			g_pParentWnd->MessageBox( va("Unable to delete %s: %s", backup.c_str(), strerror(errno) ), "File Error" );
		}

		if ( rename(filename, backup) != 0 ) {
			g_pParentWnd->MessageBox( va("Unable to rename %s to %s: %s", filename, backup.c_str(), strerror(errno) ), "File Error" );
		}
	}

	common->Printf("Map_SaveFile: %s\n", filename);

	idStr mapFile;
	bool localFile = (strstr(filename, ":") != NULL);
	if (autosave || localFile) {
		mapFile = filename;
	} else {
		mapFile = fileSystem->OSPathToRelativePath( filename );
	}

	if (use_region) {
		AddRegionBrushes();
	}

	idMapFile map;
	world_entity->origin.Zero();
	idMapEntity *mapentity = EntityToMapEntity(world_entity, use_region, &dlg);
	dlg.SetText("Saving worldspawn...");
	map.AddEntity(mapentity);

	if ( use_region ) {
		idStr buf;
		sprintf( buf, "{\n\"classname\"    \"info_player_start\"\n\"origin\"\t \"%i %i %i\"\n\"angle\"\t \"%i\"\n}\n",
					(int)g_pParentWnd->GetCamera()->Camera().origin[0],
					(int)g_pParentWnd->GetCamera()->Camera().origin[1],
					(int)g_pParentWnd->GetCamera()->Camera().origin[2],
					(int)g_pParentWnd->GetCamera()->Camera().angles[YAW] );
		idLexer src( LEXFL_NOSTRINGCONCAT | LEXFL_NOSTRINGESCAPECHARS | LEXFL_ALLOWPATHNAMES );
		src.LoadMemory( buf, buf.Length(), "regionbuf" );
		idMapEntity *playerstart = idMapEntity::Parse( src );
		map.AddEntity( playerstart );
	}

	count = -1;
	for ( e = entities.next; e != &entities; e = next ) {
		count++;
		next = e->next;
		if (e->brushes.onext == &e->brushes) {
			Entity_Free(e); // no brushes left, so remove it
		}
		else {
			if (use_region) {
				for (b = e->brushes.onext; b != &e->brushes; b = b->onext) {
					if (!Map_IsBrushFiltered(b)) {
						break;	// got one
					}
				}

				if (b == &e->brushes) {
					continue;		// nothing visible
				}

			}
			idVec3 origin;
			if (!GetVectorForKey(e, "origin", origin)) {
				idStr text;
				VectorSubtract(e->brushes.onext->mins, e->eclass->mins, origin);
				sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
				SetKeyValue(e, "origin", text);
			}

			if (use_region && !idStr::Icmp(ValueForKey(e, "classname"), "info_player_start")) {
				continue;
			}

			idStr classname = e->epairs.GetString("classname");
			sprintf(status, "Saving entity %i (%s)...", count, classname.c_str());
			dlg.SetText(status);

			map.AddEntity(EntityToMapEntity(e, use_region, &dlg));
			count++;
		}
	}

	mapFile.StripFileExtension();
	idStr mapExt = (use_region) ? ".reg" : ".map";
	sprintf(status, "Writing file %s.%s...", mapFile.c_str(), mapExt.c_str());
	dlg.SetText(status);
	map.Write(mapFile, mapExt, !(autosave || localFile));
	mapModified = 0;

	if (use_region) {
		RemoveRegionBrushes();
	}

	if (!strstr(temp, "autosave")) {
		Sys_SetTitle(temp);
	}

	Sys_Status("Saved.\n", 0);

	return true;
}
Example #13
0
 /*
 =======================================================================================================================
	Map_LoadFile
 =======================================================================================================================
 */
void Map_LoadFile(const char *filename) {
	entity_t *ent;
	CWaitDlg dlg;
	idStr fileStr, status;
	idMapFile mapfile;

	Sys_BeginWait();
	Select_Deselect();

	dlg.AllowCancel( true );
	idStr( filename ).ExtractFileName( fileStr );
	sprintf( status, "Loading %s...", fileStr.c_str() );
	dlg.SetWindowText( status );
	sprintf( status, "Reading file %s...", fileStr.c_str() );
	dlg.SetText( status );

	// SetInspectorMode(W_CONSOLE);
	fileStr = filename;
	fileStr.BackSlashesToSlashes();

	common->Printf( "Map_LoadFile: %s\n", fileStr.c_str() );

	Map_Free();

	g_qeglobals.d_parsed_brushes = 0;
	strcpy( currentmap, filename );

	if(mapfile.Parse(filename, true, true)) {
		g_qeglobals.bNeedConvert = false;
		g_qeglobals.bOldBrushes = false;
		g_qeglobals.bPrimitBrushes = false;
		g_qeglobals.mapVersion = 1.0;

		long lastUpdate = 0;
		int count = mapfile.GetNumEntities();
		for (int i = 0; i < count; i++) {
			idMapEntity *mapent = mapfile.GetEntity(i);
			if (mapent) {
				idStr classname = mapent->epairs.GetString("classname");
				// Update 20 times a second
				if ( (GetTickCount() - lastUpdate) > 50 ) {
					lastUpdate = GetTickCount();
					sprintf(status, "Loading entity %i (%s)...", i, classname.c_str());
					dlg.SetText(status);
				}
				if ( dlg.CancelPressed() ) {
					Sys_Status("Map load cancelled.\n");
					Map_New();
					return;
				}
				if (classname == "worldspawn") {
					world_entity = EntityFromMapEntity(mapent, &dlg);
					Entity_PostParse(world_entity, &active_brushes);
				} else {
					ent = EntityFromMapEntity(mapent, &dlg);
					Entity_PostParse(ent, &active_brushes);
					Entity_Name(ent, true);
					// add the entity to the end of the entity list
					ent->next = &entities;
					ent->prev = entities.prev;
					entities.prev->next = ent;
					entities.prev = ent;
					g_qeglobals.d_num_entities++;
				}
			}
		}
	}

	if (!world_entity) {
		Sys_Status("No worldspawn in map.\n");
		Map_New();
		return;
	}

	common->Printf("--- LoadMapFile ---\n");
	common->Printf("%s\n", fileStr.c_str());

	common->Printf("%5i brushes\n", g_qeglobals.d_parsed_brushes);
	common->Printf("%5i entities\n", g_qeglobals.d_num_entities);

	dlg.SetText("Restoring Between");
	Map_RestoreBetween();

	dlg.SetText("Building Brush Data");
	common->Printf("Map_BuildAllDisplayLists\n");
	Map_BuildBrushData();

	//
	// reset the "need conversion" flag conversion to the good format done in
	// Map_BuildBrushData
	//
	g_qeglobals.bNeedConvert = false;

	// move the view to a start position
	ent = AngledEntity();

	g_pParentWnd->GetCamera()->Camera().angles[PITCH] = 0;

	if (ent) {
		GetVectorForKey(ent, "origin", g_pParentWnd->GetCamera()->Camera().origin);
		GetVectorForKey(ent, "origin", g_pParentWnd->GetXYWnd()->GetOrigin());
		g_pParentWnd->GetCamera()->Camera().angles[YAW] = FloatForKey(ent, "angle");
	}
	else {
		g_pParentWnd->GetCamera()->Camera().angles[YAW] = 0;
		VectorCopy(vec3_origin, g_pParentWnd->GetCamera()->Camera().origin);
		VectorCopy(vec3_origin, g_pParentWnd->GetXYWnd()->GetOrigin());
	}

	Map_RegionOff();

	mapModified = 0;

	if (GetFileAttributes(filename) & FILE_ATTRIBUTE_READONLY) {
		fileStr += " (read only) ";
	}
	Sys_SetTitle(fileStr);

	Texture_ShowInuse();

	if (g_pParentWnd->GetCamera()->GetRenderMode()) {
		g_pParentWnd->GetCamera()->BuildRendererState();
	}

	Sys_EndWait();
	Sys_UpdateWindows(W_ALL);
}
Example #14
0
DWORD WINAPI CCreateBatchDownload::_threadCalculateSize(LPVOID lp)
{
	ProcWaitInfo *info = (ProcWaitInfo*) lp;
	CWaitDlg* dlg = (CWaitDlg*) info->lpParam2;
	CCreateBatchDownload* pThis = (CCreateBatchDownload*) info->lpParam1;

	int iFailed = 0;	
	UINT64 uSummSize = 0;	

	
	for (size_t i = 0; i < pThis->m_pvDownloads->size () && info->bNeedStop == FALSE; i++)
	{
		vmsDownloadSmartPtr dld = pThis->m_pvDownloads->at (i);
		if (IR_SUCCESS != dld->pMgr->GetDownloadMgr ()->QuerySize ())	
			iFailed ++;	

		UINT64 uSize = dld->pMgr->GetDownloadMgr ()->GetDownloader ()->GetSSFileSize ();

		
		if (uSize == _UI64_MAX)
		{
			uSummSize = _UI64_MAX;	
			break;
		}

		uSummSize += uSize;

		CString str;
		str.Format ("%s (%d - %s, %d - %s)", LS (L_QUERINGSIZE), i+1, LS (L_DONE), iFailed, LS (L_ERR));
		dlg->SetDlgItemText (IDC_MESSAGE, str);	

		info->iProgress = (int) ((double) i / pThis->m_pvDownloads->size () * 100);
	}

	if (info->bNeedStop == FALSE)
	{
		CString strSize;

		if (uSummSize == _UI64_MAX)
			strSize = LS (L_UNKNOWN);
		else
		{
			if (_pwndDownloads->IsSizesInBytes () == FALSE)
			{
				char szDim [50];
				float fSize;
				BytesToXBytes (uSummSize, &fSize, szDim);
				strSize.Format ("%.*g %s", fSize > 999 ? 4 : 3, fSize, szDim);
			}
			else
				strSize = fsBytesToStr (uSummSize);
		}

		
		pThis->SetDlgItemText (IDC_QUERYSIZE, strSize);
	}
	else
		pThis->SetDlgItemText (IDC_QUERYSIZE, LS (L_QUERYSIZE));

	info->bWaitDone = TRUE;

	return 0;
}
Example #15
0
//--------------------------------------------------------------------------//
//--------------------------------------------------------------------------//
LRESULT CCtlPanel::OnPrint(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/,
							BOOL & /*bHandled*/)
{
	if (m_pAGDoc)
	{
		AGDOCTYPE DocType = m_pAGDoc->GetDocType();
		bool bSingleFold = (DocType == DOC_CARD_SINGLEFOLD_PORTRAIT || DocType == DOC_CARD_SINGLEFOLD_LANDSCAPE);

		PRINTDLG pd;
		memset(&pd, 0, sizeof(pd));
		pd.lStructSize = sizeof(pd);
		pd.hwndOwner = GetParent();
		pd.hDevMode = m_hDevMode;
		pd.hDevNames = m_hDevNames;
		pd.hInstance = _Module.GetResourceInstance();
		pd.lCustData = (DWORD) &bSingleFold;
		pd.lpfnPrintHook = PrintHookProc;
		pd.lpPrintTemplateName = MAKEINTRESOURCE(PRINTDLGORD);
		pd.Flags = PD_ENABLEPRINTTEMPLATE | PD_ENABLEPRINTHOOK;

		if (PrintDlg(&pd))
		{
			DEVNAMES *pDevNames = (DEVNAMES *) GlobalLock(pd.hDevNames);
			DEVMODE *pDevMode = (DEVMODE *) GlobalLock(pd.hDevMode);
			char *pszDriver = ((char *) pDevNames) + pDevNames->wDriverOffset;
			char *pszDevice = ((char *) pDevNames) + pDevNames->wDeviceOffset;
			char *pszOutput = ((char *) pDevNames) + pDevNames->wOutputOffset;

			int nDuplex;
			if (! GetRegistryDuplex(pszDevice, nDuplex))
				nDuplex = -1;

			if (bSingleFold && nDuplex == -1)
			{
				CDblSideIntro	Intro;
				CDblSideStep1	Step1;
				CDblSideStep2	Step2;
				CDblSideEnd 	End;

				PROPSHEETPAGE *pPropPages = new PROPSHEETPAGE[4];
				pPropPages[0] = Intro.m_psp;
				pPropPages[1] = Step1.m_psp;
				pPropPages[2] = Step2.m_psp;
				pPropPages[3] = End.m_psp;

				Intro.m_pszDriver = Step1.m_pszDriver = pszDriver;
				Intro.m_pszDevice = Step1.m_pszDevice = pszDevice;
				Intro.m_pszOutput = Step1.m_pszOutput = pszOutput;
				Intro.m_pDevMode = Step1.m_pDevMode = pDevMode;

				PROPSHEETHEADER psh;
				psh.dwSize = sizeof(PROPSHEETHEADER);
				psh.dwFlags = PSH_WIZARD | PSH_PROPSHEETPAGE;
				psh.hwndParent = GetParent();
				psh.hInstance = NULL;
				psh.hIcon = NULL;
				psh.pszCaption = NULL;
				psh.nPages = 4;
				psh.nStartPage = 0;
				psh.ppsp = pPropPages;
				psh.pfnCallback = NULL;

				::PropertySheet(&psh);
				if (End.IsFinished())
				{
					nDuplex = Step2.GetSelected();
					SetRegistryDuplex(pszDevice, nDuplex);
				}

				delete [] pPropPages;
			}

			if (!(bSingleFold && nDuplex == -1))
			{
				CWaitDlg WaitDlg;
				WaitDlg.Create(GetParent());
				WaitDlg.UpdateWindow();

				MSG msg;
				while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
				{
					TranslateMessage(&msg);
					DispatchMessage(&msg);
				}

				bool bRotated;
				int nCopies = pd.nCopies;
				while (nCopies-- > 0)
				{
					if (bSingleFold)
					{
						m_pAGDoc->PrintCardSingle(PRINT_OUTSIDE, pszDriver,
						  pszDevice, pszOutput, pDevMode, bRotated);
					}
					else
					{
						m_pAGDoc->PrintCardQuarter(pszDriver, pszDevice,
						  pszOutput, pDevMode);
					}
				}

				WaitDlg.DestroyWindow();

				if (bSingleFold)
				{
					char szFace[10];
					if (nDuplex > 2)
						lstrcpy(szFace, "UP");
					else
						lstrcpy(szFace, "DOWN");

					DWORD dwOrientation = ::DeviceCapabilities(pszDevice,
					  pszOutput, DC_ORIENTATION, NULL, pDevMode);

					bool bHorz = (DocType == DOC_CARD_SINGLEFOLD_LANDSCAPE || DocType == DOC_CARD_QUARTERFOLD_LANDSCAPE);
					if (!bHorz && dwOrientation == 270)
						bRotated = !bRotated;

					char szDirection[15];
					int nDirection = PaperDirection[nDuplex % 2][bHorz][bRotated];
					if (nDirection == 1)
						lstrcpy(szDirection, "AWAY FROM");
					else
						lstrcpy(szDirection, "TOWARD");

					char szMsg[256];
					wsprintf(szMsg, "To print the inside of your card, reinsert the page with the printed side %s\nand the front panel of the card %s the printer.\n\n\nClick OK when you are ready to print the inside.",
					  szFace, szDirection);

					if (MessageBox(szMsg, "Print inside", MB_OKCANCEL) == IDOK)
					{
						WaitDlg.Create(GetParent());
						WaitDlg.UpdateWindow();

						MSG msg;
						while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
						{
							TranslateMessage(&msg);
							DispatchMessage(&msg);
						}

						nCopies = pd.nCopies;
						while (nCopies-- > 0)
						{
							m_pAGDoc->PrintCardSingle(PRINT_INSIDE, pszDriver,
							  pszDevice, pszOutput, pDevMode, bRotated);
						}

						WaitDlg.DestroyWindow();
					}
				}
			}

			GlobalUnlock(pd.hDevNames);
			GlobalUnlock(pd.hDevMode);
		}

		m_hDevMode = pd.hDevMode;
		m_hDevNames = pd.hDevNames;
	
		m_pMainWnd->SetFocus();
	}
	
	return (TRUE);
}
Example #16
0
BOOL
COptions4Page::OnWizardFinish() 
{
    CWaitDlg	wait;
    CFailDlg	fail;
    CSuccessDlg	success;
    HANDLE	hThread;
    DWORD	ThreadID, status = 0;
    CString	FileName;
    CButton	*pCheckOutput = (CButton *)GetDlgItem(IDC_CHECK_OUTFILE);
    CButton	*pCheckError = (CButton *)GetDlgItem(IDC_CHECK_ERRFILE);
    CButton	*pCheckOptions = (CButton *)GetDlgItem(IDC_CHECK_OPTFILE);
    CButton	*pCheckSQL = (CButton *)GetDlgItem(IDC_CHECK_SQLFILE);

    Options4 = "";
    if (pCheckOutput->GetCheck())
    {
	GetDlgItemText(IDC_EDIT_OUTPUT_LOG, OutFile);
	if (OutFile == "")
	{
	    Message.LoadString(IDS_NEED_OUTFILE);
	    Message2.LoadString(IDS_TITLE);
	    MessageBox(Message, Message2, MB_OK | MB_ICONEXCLAMATION);
	    return 0;
	}

	Options4 += CString("-fl") + OutFile + CString(" ");
    }
    if (pCheckError->GetCheck())
    {
	GetDlgItemText(IDC_EDIT_ERROR_LOG, ErrFile);
	if (ErrFile == "")
	{
	    Message.LoadString(IDS_NEED_ERRFILE);
	    Message2.LoadString(IDS_TITLE);
	    MessageBox(Message, Message2, MB_OK | MB_ICONEXCLAMATION);
	    return 0;
	}

	Options4 += CString("-fe") + ErrFile + CString(" ");
    }
    if (pCheckOptions->GetCheck())
    {
	GetDlgItemText(IDC_EDIT_OPTIONS_LOG, FileName);
	if (FileName == "")
	{
	    Message.LoadString(IDS_NEED_OPTFILE);
	    Message2.LoadString(IDS_TITLE);
	    MessageBox(Message, Message2, MB_OK | MB_ICONEXCLAMATION);
	    return 0;
	}

	Options4 += CString("-fo") + FileName + CString(" ");
    }
    if (pCheckSQL->GetCheck())
    {
	GetDlgItemText(IDC_EDIT_SQL_COPY, FileName);
	if (FileName == "")
	{
	    Message.LoadString(IDS_NEED_SQLFILE);
	    Message2.LoadString(IDS_TITLE);
	    MessageBox(Message, Message2, MB_OK | MB_ICONEXCLAMATION);
	    return 0;
	}

	Options4 += CString("-fc") + FileName + CString(" ");
    }

    hThread = CreateThread( NULL, 0,
			    (LPTHREAD_START_ROUTINE)ExecuteCommand,
			    NULL, 0, &ThreadID);
    wait.DoModal();
    while (WaitForSingleObject(hThread, 0) != WAIT_OBJECT_0);
    GetExitCodeThread(hThread, &status);
    if (status)
    {
	fail.DoModal();
	return 0;
    }

    success.DoModal();

    return CPropertyPage::OnWizardFinish();
}