IComparison* Comparisons::Open(LPCTSTR wdfDocId) { AFX_MANAGE_STATE(AfxGetAppModuleState()); AutomationInteractionSuppressor ais; CMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd()); GetApp()->RealFileNew(); // TODO - can we get the frame in a better way CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() ); if (pFrame) { // TODO - do we need this GetDVController(pFrame)->CloseDocument(true); GetDVController(pFrame)->CloseDocument(false); GetDVController(pFrame)->CloseCompositeDocument(); GetDVController(pFrame)->GetComparisonDocController().CloseComparisonDocument(); if( pFrame->GetCompositeBar() ) pFrame->GetCompositeBar()->OnInitialUpdate(); pFrame->ShowWindow(SW_SHOW); pFrame->BringWindowToTop(); if (!GetDVController(pFrame)->LoadWDF(wdfDocId)) { AfxThrowOleDispatchException(1102, L"File not found : " + CString(wdfDocId)); } pFrame->GetDocument()->UpdateAllViews(NULL); UpdateOpenList(); return FindComObject(pFrame->GetDocument()); } AfxThrowOleDispatchException(1101, L"Internal Error"); return NULL; }
void CXFA_FFPushButton::RenderWidget(CFX_Graphics* pGS, CFX_Matrix* pMatrix, FX_DWORD dwStatus, int32_t iRotate) { if (!IsMatchVisibleStatus(dwStatus)) { return; } CFX_Matrix mtRotate; GetRotateMatrix(mtRotate); if (pMatrix) { mtRotate.Concat(*pMatrix); } CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus); RenderHighlightCaption(pGS, &mtRotate); CFX_RectF rtWidget; GetRectWithoutRotate(rtWidget); CFX_Matrix mt; mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top); mt.Concat(mtRotate); GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget->GetWidget(), pGS, &mt); }
void DVControllerTests::TestGetSaveFormatAsDVCode() { AFX_MANAGE_STATE(AfxGetAppModuleState()); short nStoreOption = Workshare::OptionApi::GetInt(L"DocFormat"); CMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd()); CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() ); assertTest( pFrame ); Workshare::OptionApi::SetInt(L"DocFormat", -1); long lRetVal = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode(); assertTest(lRetVal == WSCONVERTERLib::dvFormatWDF); Workshare::OptionApi::SetInt(L"DocFormat", 6); lRetVal = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode(); assertTest(lRetVal == WSCONVERTERLib::dvFormatRTF); Workshare::OptionApi::SetInt(L"DocFormat", 0); lRetVal = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode(); assertTest(lRetVal == WSCONVERTERLib::dvFormatDocument); Workshare::OptionApi::SetInt(L"DocFormat", 12); lRetVal = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode(); assertTest(lRetVal == WSCONVERTERLib::dvFormatXMLDocument); Workshare::OptionApi::SetInt(L"DocFormat", 2); lRetVal = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode(); assertTest(lRetVal == WSCONVERTERLib::dvFormatText); Workshare::OptionApi::SetInt(L"DocFormat", -7); lRetVal = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode(); assertTest(lRetVal == WSCONVERTERLib::dvFormatPDF); //check for default Workshare::OptionApi::SetInt(L"DocFormat", 50); lRetVal = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode(); assertTest(lRetVal == WSCONVERTERLib::dvFormatWDF); Workshare::OptionApi::SetInt(L"DocFormat", nStoreOption); }
BOOL COptFont::OnInitDialog() { u32 i; GF_BaseInterface *ifce; CDialog::OnInitDialog(); COsmo4 *gpac = GetApp(); TCHAR wTmp[500]; const char *sOpt; /*video drivers enum*/ while (m_Fonts.GetCount()) m_Fonts.DeleteString(0); sOpt = gf_cfg_get_key(gpac->m_user.config, "FontEngine", "DriverName"); s32 to_sel = 0; s32 select = 0; u32 count = gf_modules_get_count(gpac->m_user.modules); for (i=0; i<count; i++) { ifce = gf_modules_load_interface(gpac->m_user.modules, i, GF_FONT_READER_INTERFACE); if (!ifce) continue; if (sOpt && !stricmp(((GF_BaseInterface *)ifce)->module_name, sOpt)) select = to_sel; CE_CharToWide((char *) ifce->module_name, (u16 *)wTmp); m_Fonts.AddString(wTmp); gf_modules_close_interface(ifce); to_sel++; } m_Fonts.SetCurSel(select); sOpt = gf_cfg_get_key(gpac->m_user.config, "FontEngine", "FontDirectory"); CE_CharToWide((char *)sOpt, (u16 *)wTmp); if (sOpt) m_BrowseFont.SetWindowText(wTmp); sOpt = gf_cfg_get_key(gpac->m_user.config, "Compositor", "TextureTextMode"); m_UseTexture.SetCheck( (!sOpt || stricmp(sOpt, "Never")) ? 1 : 0); return TRUE; }
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam) { int ID = LOWORD(wParam); WinGPAC *app = GetApp(); if ( (ID>=ID_VP_0) && (ID<=ID_VP_0+nb_viewpoints)) { ID -= ID_VP_0; M4T_SetViewpoint(app->m_term, ID+1, NULL); return TRUE; } if ( (ID>=ID_NAV_PREV_0) && (ID<=ID_NAV_PREV_9)) { ID -= ID_NAV_PREV_0; s32 prev = m_pPlayList->m_cur_entry - ID; if (prev>=0) { m_pPlayList->m_cur_entry = prev; m_pPlayList->PlayPrev(); } return TRUE; } if ( (ID>=ID_NAV_NEXT_0) && (ID<=ID_NAV_NEXT_9)) { ID -= ID_NAV_NEXT_0; u32 next = m_pPlayList->m_cur_entry + ID; if (next < ChainGetCount(m_pPlayList->m_entries) ) { m_pPlayList->m_cur_entry = next; m_pPlayList->PlayNext(); } return TRUE; } if ( (ID>=ID_SELOBJ_0) && (ID<=ID_SELOBJ_9)) { ID -= ID_SELOBJ_0; LPODMANAGER root_od = M4T_GetRootOD(app->m_term); if (!root_od) return TRUE; LPODMANAGER odm = M4T_GetODManager(app->m_term, root_od, ID); M4T_SelectOD(app->m_term, odm); return TRUE; } return CFrameWnd::OnCommand(wParam, lParam); }
bool COptionsDlgSelector::ValidateFileFormats(const CStdString& sResolvedDocID1, const int nIndex, const CStdString& sResolvedDocID2) { // If neither of the docs are PDF then they'll valid // (for the purposes of this method) HRESULT hr = FileTypeHelper::IsPDF(sResolvedDocID1); if (FAILED(hr)) // test DMS connection good first return false; HRESULT hr2 = FileTypeHelper::IsPDF(sResolvedDocID2); if (FAILED(hr2)) return false; if( S_OK != hr && S_OK == hr2 ) return true; if(!Workshare::OptionApi::GetBool(L"EnablePDFCompare")) { GetApp()->ShowMessageEx(AfxGetMainWnd()->m_hWnd, L"Your system administrator has disabled PDF comparisons.", WsOK, WsDefault, WsInfoIcon, L"", functionality_not_available, LOG_LOCATION); return false; } return true; }
void CMainFrame::UpdateTime() { u32 now; COsmo4 *app = GetApp(); if (!app->m_open || app->m_stoped) return; now = gf_term_get_time_in_ms(app->m_term); if (!now) return; if (app->m_can_seek && (now>=app->m_duration + 100)) { if (gf_term_get_option(app->m_term, GF_OPT_IS_FINISHED)) { if (app->m_Loop && m_full_screen) { gf_term_play_from_time(app->m_term, 0, 0); } else { OnFileStop(); if (app->m_Loop) OnFilePause(); } return; } } if (!m_full_screen) m_progBar.SetPosition(now); }
BOOL COptRender3D::OnInitDialog() { CDialog::OnInitDialog(); COsmo4 *gpac = GetApp(); const char *sOpt; sOpt = gf_cfg_get_key(gpac->m_user.config, "Compositor", "ForceOpenGL"); m_Use3DRender.SetCheck( (sOpt && !strcmp(sOpt, "yes")) ? 1 : 0); sOpt = gf_cfg_get_key(gpac->m_user.config, "Compositor", "BackFaceCulling"); m_NoBackFace.SetCheck( (sOpt && !stricmp(sOpt, "Off")) ? 1 : 0); sOpt = gf_cfg_get_key(gpac->m_user.config, "Compositor", "EmulatePOW2"); m_EmulatePOW2.SetCheck( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); m_WireMode.ResetContent(); m_WireMode.AddString(_T("Solid Draw")); m_WireMode.AddString(_T("Wireframe")); m_WireMode.AddString(_T("Both")); sOpt = gf_cfg_get_key(gpac->m_user.config, "Compositor", "Wireframe"); if (sOpt && !stricmp(sOpt, "WireOnly")) m_WireMode.SetCurSel(1); else if (sOpt && !stricmp(sOpt, "WireOnSolid")) m_WireMode.SetCurSel(2); else m_WireMode.SetCurSel(0); m_DrawNormals.ResetContent(); m_DrawNormals.AddString(_T("Never")); m_DrawNormals.AddString(_T("Per Face")); m_DrawNormals.AddString(_T("Per Vertex")); sOpt = gf_cfg_get_key(gpac->m_user.config, "Compositor", "DrawNormals"); if (sOpt && !stricmp(sOpt, "PerFace")) m_DrawNormals.SetCurSel(1); else if (sOpt && !stricmp(sOpt, "PerVertex")) m_DrawNormals.SetCurSel(2); else m_DrawNormals.SetCurSel(0); return TRUE; }
void AddressBar::SelectionReady() { void UpdateLastFiles(GF_Config *cfg, const char *URL); CString URL; int sel = m_Address.GetCurSel(); if (sel == CB_ERR) { m_Address.GetWindowText(URL); } else { m_Address.GetLBText(sel, URL); } if (!URL.GetLength()) return; WinGPAC *gpac = GetApp(); Playlist *pl = ((CMainFrame*)gpac->m_pMainWnd)->m_pPlayList; /*don't store local files*/ if (URL.Find("://", 0)>0) { UpdateLastFiles(gpac->m_user.config, URL); ReloadURLs(); } pl->Truncate(); pl->QueueURL(URL); pl->RefreshList(); pl->PlayNext(); }
void CEditProjectMgr::UpdateBUTFile() { //get the resource directory for the currently open project, and add on //our filename to get the BUT file CString sBUTFile = m_BaseProjectDir + "\\ClassHlp.but"; //now create a but manager to load this CButeMgr* pNewMgr = new CButeMgr; //bail if memory failed if(pNewMgr == NULL) return; if (!pNewMgr->Parse(sBUTFile)) { //failed to find a new but file, no worries, just bail delete pNewMgr; return; } //this worked, we want to override the old but file with this one GetApp()->SetClassHelpButeAgg(pNewMgr); }
void Playlist::RefreshList() { u32 i, top_idx; char szPath[GF_MAX_PATH]; top_idx = m_FileList.GetTopIndex(); m_FileList.DeleteAllItems(); for (i=0; i<gf_list_count(m_entries); i++) { PLEntry *ple = (PLEntry *) gf_list_get(m_entries, i); m_FileList.InsertItem(i, ""); m_FileList.SetItemData(i, (u32) ple); UpdateEntry(i); /*in case of sorting*/ if (ple->m_bIsPlaying) m_cur_entry = i; if (ple->m_bIsSelected) { m_FileList.SetItemState(i, LVIS_SELECTED, LVIS_SELECTED); ple->m_bIsSelected = GF_FALSE; } } if (m_cur_entry >= (s32)gf_list_count(m_entries)) m_cur_entry = gf_list_count(m_entries); else { s32 last_idx = top_idx + m_FileList.GetCountPerPage(); m_FileList.EnsureVisible(top_idx, 0); if (gf_list_count(m_entries)<(u32) last_idx) last_idx = gf_list_count(m_entries); m_FileList.EnsureVisible(last_idx, 1); } strcpy((char *) szPath, GetApp()->szUserPath); strcat(szPath, "gpac_pl.m3u"); Save(szPath, GF_TRUE); }
void CXFA_FFField::RenderWidget(CFX_Graphics* pGS, CFX_Matrix* pMatrix, uint32_t dwStatus) { if (!IsMatchVisibleStatus(dwStatus)) { return; } CFX_Matrix mtRotate; GetRotateMatrix(mtRotate); if (pMatrix) { mtRotate.Concat(*pMatrix); } CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus); CXFA_Border borderUI = m_pDataAcc->GetUIBorder(); DrawBorder(pGS, borderUI, m_rtUI, &mtRotate); RenderCaption(pGS, &mtRotate); DrawHighlight(pGS, &mtRotate, dwStatus, FALSE); CFX_RectF rtWidget; m_pNormalWidget->GetWidgetRect(rtWidget); CFX_Matrix mt; mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top); mt.Concat(mtRotate); GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget->GetWidget(), pGS, &mt); }
BOOL COrderFailedDialog::OnInitDialog() { CBaseDialog::OnInitDialog(); CMlsPropertyControl::SubclassPropertyControls(this); // If there is no help number, get rid of the reference. CWnd* pHelp = GetDlgItem(IDC_HELP_INFO); if (pHelp != NULL) { CInternationalData* pInternationalData = GetApp()->GetInternationalData(); if (pInternationalData != NULL) { if (!pInternationalData->m_InstantSales.m_Help.Exists()) { pHelp->ShowWindow(SW_HIDE); } } } CenterWindow(); return TRUE; // return TRUE unless you set the focus to a control }
void CDocSelector::OnTimer(UINT nIDEvent) { for ( int i = 0; i < m_Buttons.GetSize(); i++ ) { CSwitcherButton* wndButton = (CSwitcherButton *) m_Buttons.GetAt( i ); // May be the user has destroyed the view... if ( wndButton->m_AttachedView ) { // Modified by Bender to fix akward problem with CFormView and GetFocus() // MFC works in misterious ways ;) if(GetApp()->GetMainFrame()->MDIGetActive() == wndButton->m_AttachedView->GetParentFrame()) //if ( GetFocus() == wndButton->m_AttachedView) { if ( wndButton->m_nState != SWITCHBUTTON_SELECTED ) { wndButton->Select(); m_iSelectedButton = i; } } else { if ( wndButton->m_nState == SWITCHBUTTON_SELECTED ) wndButton->Unselect(); } } // Yes, he has, critical condition..., break... else break; } CControlBar::OnTimer(nIDEvent); }
void CommandSystem::Draw() { if (!mCommandMode) return; int nHeight = GetApp()->getHeight() * 0.7f; GetApp()->text_->SetInsertionPos(50, nHeight); GetApp()->text_->SetForegroundColor(D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f)); GetApp()->text_->DrawFormattedTextLine(mStatusLine.c_str()); idStr displayString = "edit"; GetApp()->text_->SetInsertionPos(50, nHeight+10); displayString += "> "; displayString += mCommand.c_str(); if (timeGetTime() & 0x200) { displayString += "_"; } GetApp()->text_->DrawFormattedTextLine(displayString.c_str()); }
status_t Initialize() { try { //os::RegistrarManager* pcRegManager = os::RegistrarManager::Get(); /* Register remote calls */ pcPlayEvent = os::Event::Register( "media/Coldfish/Play","Play",GetApp(),CF_GUI_PLAY); pcStopEvent = os::Event::Register( "media/Coldfish/Stop","Stop",GetApp(),CF_GUI_STOP); pcPauseEvent = os::Event::Register( "media/Coldfish/Pause","Pause",GetApp(),CF_GUI_PAUSE); pcNextEvent = os::Event::Register( "media/Coldfish/Next","Next",GetApp(),CF_PLAY_NEXT); pcPrevEvent = os::Event::Register( "media/Coldfish/Previous","Previous",GetApp(),CF_PLAY_PREVIOUS); pcGetSongEvent = os::Event::Register( "media/Coldfish/GetSong", "Gets the current song",GetApp(), CF_GET_SONG); pcGetPlayStateEvent = os::Event::Register( "media/Coldfish/GetPlayState", "Gets the current playstate",GetApp(), CF_GET_PLAYSTATE); pcAddFileEvent = os::Event::Register( "media/Coldfish/AddFile", "Calls the file requester to add a file to ColdFish",GetApp(), CF_GUI_ADD_FILE); pcAboutEvent = os::Event::Register( "media/Coldfish/About", "Calls the about box",GetApp(), CF_GUI_ABOUT); } catch( ... ) { return( -1 ); } return( 0 ); }
//-------------------------------------------------------------------------------------- // Render the scene using the D3D11 device //-------------------------------------------------------------------------------------- void RenderToBackBuffer(Renderer* renderer, double fTime, float fElapsedTime, void* pUserContext) { ID3D11DeviceContext* pContext = GetApp()->GetContext(); // Something's wrong in the shader and the tri size is out by a factor of 2. Why?!? g_pTriSizeVar->SetInt(2 * g_tessellatedTriWidth); const bool debugDrawPatches = false; g_DebugShowPatchesVar->SetBool(debugDrawPatches); const bool debugDrawTiles = false; g_DebugShowTilesVar->SetBool(debugDrawTiles); const float wireAlpha = 0.01f * (float)80; // Below 1.0, we fade the lines out with blending; above 1, we increase line thickness. if (wireAlpha < 1) { g_WireAlphaVar->SetFloat(wireAlpha); g_WireWidthVar->SetFloat(1); } else { g_WireAlphaVar->SetFloat(1); g_WireWidthVar->SetFloat(wireAlpha); } g_DetailNoiseVar->SetFloat(0.001f * (float)g_DetailNoiseScale); float samplesapcing = WORLD_SCALE * g_pTileRings[g_nRings-1]->outerWidth() / (float) COARSE_HEIGHT_MAP_SIZE; g_SampleSpacingVar->SetFloat(samplesapcing); // If the settings dialog is being shown, then render it instead of rendering the app's scene BaseCamera* pCam = GetApp()->ActiveCam_; D3DXMATRIX mProj; D3DXMATRIX mView; const unsigned int size16 = sizeof(float) * 16; memcpy(&mView, pCam->getViewMatrix(), size16); memcpy(&mProj, pCam->getProjectionMatrix(), size16); SetViewport(pContext, g_BackBufferVP); D3DXMATRIX mViewCopy = mView; mViewCopy._41 = mViewCopy._42 = mViewCopy._43 = 0; D3DXMATRIX mWVP = StarWorldMatrix() * mViewCopy * mProj; if (!g_CheckForCracks) g_Skybox.D3D11Render(&mWVP, pContext); RenderStars(pContext, mViewCopy, mProj, g_ScreenSize); int vec[3] = { g_RidgeOctaves, g_fBmOctaves, g_TexTwistOctaves }; g_pFractalOctavesTVar->SetIntVector(vec); // I'm still trying to figure out if the detail scale can be derived from any combo of ridge + twist. // I don't think this works well (nor does ridge+twist+fBm). By contrast the relationship with fBm is // straightforward. The -4 is a fudge factor that accounts for the frequency of the coarsest ocatve // in the pre-rendered detail map. const float DETAIL_UV_SCALE = powf(2.0f, std::max(g_RidgeOctaves, g_TexTwistOctaves) + g_fBmOctaves - 4.0f); g_DetailUVVar->SetFloatVector(D3DXVECTOR2(DETAIL_UV_SCALE, 1.0f/DETAIL_UV_SCALE)); SetUVOffset(g_pUVOffsetTVar); /*ID3D11Query* pFreeQuery = FindFreeQuery(); if (pFreeQuery) pContext->Begin(pFreeQuery);*/ RenderTerrain(pContext, mProj, g_BackBufferVP); //if (pFreeQuery) // pContext->End(pFreeQuery); //for (int i=0; i!=N_QUERIES; ++i) //{ // if (!g_FreePipelineQueries[i] && g_PipelineQueries[i]) // in use & exists // { // D3D11_QUERY_DATA_PIPELINE_STATISTICS stats; // if (S_OK == pContext->GetData(g_PipelineQueries[i], &stats, sizeof(stats), D3D11_ASYNC_GETDATA_DONOTFLUSH)) // { // g_PrimitivesRendered = stats.CInvocations; // g_FreePipelineQueries[i] = g_PipelineQueries[i]; // Put back on free list. // } // } //} }
void CWorldsDlg::OnFileNewWorld() { GetApp()->OnFileNewWorld(); }
bool PlayerManager::Entry( DNID dnidClient, LINKSTATUS enumStatus, void *data, size_t size ) { //这里收到玩家启动客户端的消息,发送服务器状态 SMessage *pMsg = (SMessage *)data; if ( pMsg == NULL ) { return true; } //给客户端发送服务器状态数据 if ( pMsg->_protocol == pMsg->EPRO_Center_MESSAGE ) { SCenterBaseMsg* _pMsg = static_cast< SCenterBaseMsg* >( pMsg ); switch (_pMsg->_protocol) { case SCenterBaseMsg::EPRO_RequestClientVersionInfo: //返回当前游戏资源更新信息 { SARequestAssetUpdateInfo _msg; CDAppMain& appMain = GetApp(); _msg.streamLength = appMain.m_iAssetBundleInfoLength; memcpy(_msg.streamData, appMain.m_AssetbundleVersionInfo, appMain.m_iAssetBundleInfoLength); SendToClient(dnidClient, &_msg, sizeof(SARequestAssetUpdateInfo) - (MAX_ASSET_SIZE - appMain.m_iAssetBundleInfoLength)); //rfalse(2, 1, ""); } break; case SCenterBaseMsg::EPRO_RequestServerState: { //接受请求数据 SARequestServerState _msg; bool b = GetApp().m_ServerManager[GAMESERVER_FLAG].GetGameServerList(&_msg); if (b) { SendToClient(dnidClient, &_msg, _msg.MySize()); m_dPlayerConnectNum++; char string[100] = {}; sprintf_s(string, "\nPlayeConnectCenterServer: %d ", m_dPlayerConnectNum); GetApp().SaveConnectNumString(string); } } break; case SCenterBaseMsg::EPRO_RequestServerDetailInfo: { SQRequestServeDetailInfoMsg *psrcMsg = static_cast<SQRequestServeDetailInfoMsg*>(pMsg); if (NULL == psrcMsg) break; ServerData *pServerData = NULL; GameServer *pGameServer = NULL; if (GetApp().m_ServerManager[GAMESERVER_FLAG].FindGameServerByIndex(psrcMsg->dwIndex, &pGameServer)) { if (NULL != pGameServer) { pServerData = pGameServer->GetServerData(); } } if (NULL != pServerData) { SARequestServeDetailInfoMsg msg; msg.dwIndex = pServerData->m_dwIndex; lite::Serializer sl(msg.streamData, sizeof(msg.streamData)); sl(pServerData->m_dwIP)(pServerData->m_dwPort); SendToClient(dnidClient, &msg, sizeof(msg) - sl.EndEdition()); } } break; default: break; } } else if (pMsg->_protocol == SMessage::EPRO_SYSTEM_MESSAGE) { SQLoginMsg* _pMsg = static_cast<SQLoginMsg*>(pMsg); } return true; }
BOOL COrderFormInformationDialog::PrintOrderForm() { COrderForm OrderForm; CString csFormat; CString csOfferCode; Util::SafeLoadString(IDS_OFFER_CODE, csFormat); csOfferCode.Format(csFormat, GetApp()->Offer()->OfferCode()); OrderForm.AddStringMapping("~RCODE", csOfferCode); CString csFaxNumber = GetApp()->GetFaxNumber(); OrderForm.AddStringMapping("~LFAXNUMBER", csFaxNumber); int nIndex = 1; CString csValue; wsprintf(csValue.GetBuffer(128), "%s %s", (LPCSTR)m_csFirstName, (LPCSTR)m_csLastName); csValue.ReleaseBuffer(); OrderForm.AddIndexedStringMapping("~LSHIPADDRESS", nIndex++, csValue); if (!m_csCompany.IsEmpty()) { OrderForm.AddIndexedStringMapping("~LSHIPADDRESS", nIndex++, m_csCompany); } if (!m_csAddress1.IsEmpty()) { OrderForm.AddIndexedStringMapping("~LSHIPADDRESS", nIndex++, m_csAddress1); } if (!m_csAddress2.IsEmpty()) { OrderForm.AddIndexedStringMapping("~LSHIPADDRESS", nIndex++, m_csAddress2); } wsprintf(csValue.GetBuffer(128), "%s, %s %s", (LPCSTR)m_csCity, (LPCSTR)m_csState, (LPCSTR)m_csZip); csValue.ReleaseBuffer(); OrderForm.AddIndexedStringMapping("~LSHIPADDRESS", nIndex++, csValue); if (m_wCountryId != COUNTRY_UnitedStatesOfAmerica) { OrderForm.AddIndexedStringMapping("~LSHIPADDRESS", nIndex++, m_csCountry); } if (!m_csPhone.IsEmpty()) { OrderForm.AddIndexedStringMapping("~LSHIPADDRESS", nIndex++, m_csPhone); } nIndex = 1; CString csPaymentMethod; Util::SafeLoadString(PaymentMethodNames[m_nPaymentMethod], csPaymentMethod); OrderForm.AddIndexedStringMapping("~LPAYMENTMETHOD", nIndex++, csPaymentMethod); if ((m_nPaymentMethod >= CCreditCard::VISA) && (m_nPaymentMethod <= CCreditCard::DISCOVER)) { csValue = m_csCardNumber; CCreditCard::PrettyCreditCardNumber(m_nPaymentMethod, csValue); OrderForm.AddIndexedStringMapping("~LPAYMENTMETHOD", nIndex++, csValue); Util::SafeLoadString(IDS_EXPIRES, csFormat); csValue.Format(csFormat, m_csExpirationDate); OrderForm.AddIndexedStringMapping("~LPAYMENTMETHOD", nIndex++, csValue); } CInternationalData* pInternationalData = GetApp()->GetInternationalData(); if (pInternationalData != NULL) { CNameList MailList(pInternationalData->m_InstantSales.m_Mail.m_szAddress); for (nIndex = 1; nIndex <= MailList.GetSize(); nIndex++) { csValue = MailList.ElementAt(nIndex-1); PerformIniKeySubstitution(csValue); OrderForm.AddIndexedStringMapping("~LMAILADDRESS", nIndex, csValue); } } Util::SafeLoadString(IDS_PRINTED, csFormat); CString csDate; #ifdef WIN32 SYSTEMTIME SystemTime; GetLocalTime(&SystemTime); csDate.Format( csFormat, (int)SystemTime.wMonth, (int)SystemTime.wDay, (int)(SystemTime.wYear % 100), (int)SystemTime.wHour, (int)SystemTime.wMinute, (int)SystemTime.wSecond); #else time_t BinaryTime; time(&BinaryTime); CTime Time(BinaryTime); csDate.Format( csFormat, Time.GetMonth(), Time.GetDay(), Time.GetYear(), Time.GetHour(), Time.GetMinute(), Time.GetSecond()); #endif OrderForm.AddStringMapping("~LDATE", csDate); CString csSubTotal; CString csTaxLabel; CString csTax; CString csFeeLabel; CString csFee; CString csTotal; long lPrice = m_lPrice; long lSubTotal = lPrice; long lTax = CSalesTaxComboBox::StateTax(m_csState, lSubTotal); if (lTax > 0) { Util::SafeLoadString(IDS_TAX, csFormat); csTaxLabel.Format(csFormat, m_csState); } else { Util::SafeLoadString(IDS_APPLICABLE_TAX_WILL_BE_ADDED, csTaxLabel); } long lFee = GetApp()->Offer()->ProcessingFee(); csFeeLabel.Empty(); if (lFee != 0) { Util::SafeLoadString(IDS_PROCESSING_FEE, csFeeLabel); } PriceString(csFee, lFee, TRUE, TRUE); long lTotal = lPrice+lTax+lFee; PriceString(csSubTotal, lSubTotal); PriceString(csTax, lTax, TRUE, TRUE); PriceString(csTotal, lTotal); int nProducts = m_Products.ProductCount(); int nItemNumber = 1; for (int nProduct = 0; nProduct < nProducts; nProduct++) { CMailOrderProduct* pProduct = m_Products.Product(nProduct); if (pProduct != NULL) { int nNumber = (pProduct->Price().GetLength() == 0) ? 0 : nItemNumber; if (nNumber != 0) { nItemNumber++; } OrderForm.AddItem(nNumber, pProduct->Name(), pProduct->Price(), FALSE); } } Util::SafeLoadString(IDS_SUBTOTAL, csFormat); OrderForm.AddItem(-1, csFormat, csSubTotal, TRUE); OrderForm.AddItem(-1, csTaxLabel, csTax, FALSE); OrderForm.AddItem(-1, csFeeLabel, csFee, FALSE); Util::SafeLoadString(IDS_TOTAL, csFormat); OrderForm.AddItem(-1, csFormat, csTotal, TRUE); Util::SafeLoadString(IDS_REQUEST_CODE, csFormat); OrderForm.AddItem(-2, csFormat, m_csLRC, TRUE); OrderForm.Wmf(AfxGetResourceHandle(), MAKEINTRESOURCE(ID_ORDERFORM_WMF), "METAFILE"); OrderForm.Bounds(776, 8679, 16147, 192, 12699, MulDiv(284, 3, 4), 284); return OrderForm.Print(this); }
void GameOnSelect( VariantList* pVList ) { Entity *pEntClicked = pVList->m_variant[1].GetEntity(); Tetris* tetris = Tetris::GetInstance(); Config* config = Config::GetInstance(); if( pEntClicked->GetName() == GUI_IMAGEBUTTON_GAMEPLAY_MENU_BUTTON ) { GetApp()->buttonClickSound(); if( tetris->isEndGame() ) { SlideScreen( pEntClicked->GetParent(), false ); GetMessageManager()->CallEntityFunction( pEntClicked->GetParent(), 500, "OnDelete", NULL ); GetApp()->setGame( false ); GetApp()->setContinueBtn( false ); if( tetris->getScoreInt() > config->getMinScore() ) { GameState::SetState( new GS_Menu() ); InputBestScoreCreate( pEntClicked->GetParent()->GetParent() ); } else { tetris->ResetEndGame(); GameState::SetState( new GS_Menu() ); MainMenuCreate( pEntClicked->GetParent()->GetParent() ); } tetris->FreeInstance(); config->FreeInstance(); return; } GameState::SetState( new GS_Menu() ); if( config->getMusic() ) { GetAudioManager()->StopMusic(); } GetApp()->setGame( false ); SlideScreen( pEntClicked->GetParent(), false ); GetMessageManager()->CallEntityFunction( pEntClicked->GetParent(), 500, "OnDelete", NULL ); MainMenuCreate( pEntClicked->GetParent()->GetParent() ); } if( pEntClicked->GetName() == GUI_IMAGEBUTTON_GAMEPLAY_DOWN && !tetris->isEndGame() ) { if( config->getSoundEffects() ) { GetAudioManager()->Play( GetApp()->getResourceInstance()->getItem(GetApp()->getResolutionType(), RES_TYPE_AUDIO, RES_ID_AUDIO_FIGURE_DOWN ) ); } tetris->ClickForceDown(); } if( pEntClicked->GetName() == GUI_IMAGEBUTTON_GAMEPLAY_LEFT && !tetris->isEndGame() ) { buttonMoveSound(); tetris->ClickLeft(); } if( pEntClicked->GetName() == GUI_IMAGEBUTTON_GAMEPLAY_RIGHT && !tetris->isEndGame() ) { buttonMoveSound(); tetris->ClickRight(); } if( pEntClicked->GetName() == GUI_IMAGEBUTTON_GAMEPLAY_ROTATE && !tetris->isEndGame() ) { buttonMoveSound(); tetris->ClickRotate(); } tetris->FreeInstance(); config->FreeInstance(); }
HWND CWnd::HtmlHelp(UINT uCommand,DWORD_PTR dwData,LPCSTR szHelpFile) { if (szHelpFile!=NULL) { if (FirstCharIndex(szHelpFile,'\\')!=-1) return HtmlHelpA(m_hWnd,szHelpFile,uCommand,dwData); // Insert path #ifdef DEF_WCHAR if (IsUnicodeSystem()) { CStringW sExeName=GetApp()->GetExeNameW(); return HtmlHelpW(*this,sExeName.Left(sExeName.FindLast(L'\\')+1)+szHelpFile, uCommand,dwData); } #endif CString sExeName=GetApp()->GetExeName(); return HtmlHelpA(*this,sExeName.Left(sExeName.FindLast(L'\\')+1)+szHelpFile, uCommand,dwData); } #ifdef DEF_WCHAR LPCWSTR szwHelpFile=GetApp()->m_szHelpFile; if (szwHelpFile!=NULL) { if (FirstCharIndex(szwHelpFile,L'\\')!=-1) { if (IsUnicodeSystem()) return HtmlHelpW(m_hWnd,szwHelpFile,uCommand,dwData); else return HtmlHelpA(m_hWnd,W2A(szwHelpFile),uCommand,dwData); } // Insert path if (IsUnicodeSystem()) { CStringW sExeName=GetApp()->GetExeNameW(); return HtmlHelpW(*this,sExeName.Left(sExeName.FindLast(L'\\')+1)+szwHelpFile, uCommand,dwData); } CString sExeName=GetApp()->GetExeName(); return HtmlHelpA(*this,sExeName.Left(sExeName.FindLast(L'\\')+1)+szwHelpFile, uCommand,dwData); } if (IsUnicodeSystem()) { CStringW sExeName=GetApp()->GetExeNameW(); return HtmlHelpW(*this,sExeName.Left(sExeName.FindLast(L'.')+1)+L"chm", uCommand,dwData); } #endif CString sExeName=GetApp()->GetExeName(); return HtmlHelpA(*this,sExeName.Left(sExeName.FindLast(L'.')+1)+"chm", uCommand,dwData); }
bool remove( dp::sg::core::ObjectSharedPtr const& parent, dp::sg::core::ObjectSharedPtr const& child ) { switch( parent->getObjectCode() ) { case dp::sg::core::OC_GEONODE : if ( child.isPtrTo<dp::sg::core::EffectData>() ) { parent.staticCast<dp::sg::core::GeoNode>()->setMaterialEffect( dp::sg::core::EffectDataSharedPtr() ); } else { DP_ASSERT( child.isPtrTo<dp::sg::core::Primitive>() ); parent.staticCast<dp::sg::core::GeoNode>()->setPrimitive( dp::sg::core::PrimitiveSharedPtr() ); } break; case dp::sg::core::OC_GROUP : case dp::sg::core::OC_LOD : case dp::sg::core::OC_SWITCH : case dp::sg::core::OC_TRANSFORM : case dp::sg::core::OC_BILLBOARD : if ( child.isPtrTo<dp::sg::core::Node>() ) { parent.staticCast<dp::sg::core::Group>()->removeChild( child.staticCast<dp::sg::core::Node>() ); } else { DP_ASSERT( child.isPtrTo<dp::sg::core::ClipPlane>() ); parent.staticCast<dp::sg::core::Group>()->removeClipPlane( child.staticCast<dp::sg::core::ClipPlane>() ); } break; case dp::sg::core::OC_PRIMITIVE : if ( child.isPtrTo<dp::sg::core::IndexSet>() ) { parent.staticCast<dp::sg::core::Primitive>()->setIndexSet( dp::sg::core::IndexSetSharedPtr() ); } else { DP_ASSERT( child.isPtrTo<dp::sg::core::VertexAttributeSet>() ); parent.staticCast<dp::sg::core::Primitive>()->setVertexAttributeSet( dp::sg::core::VertexAttributeSetSharedPtr() ); } break; case dp::sg::core::OC_EFFECT_DATA : DP_ASSERT( child.isPtrTo<dp::sg::core::ParameterGroupData>() ); { dp::sg::core::ParameterGroupDataSharedPtr const& pgd = child.staticCast<dp::sg::core::ParameterGroupData>(); dp::sg::core::EffectDataSharedPtr const& ed = parent.staticCast<dp::sg::core::EffectData>(); dp::fx::SmartEffectSpec const & es = ed->getEffectSpec(); DP_ASSERT( es->findParameterGroupSpec( pgd->getParameterGroupSpec() ) != es->endParameterGroupSpecs() ); parent.staticCast<dp::sg::core::EffectData>()->setParameterGroupData( es->findParameterGroupSpec( pgd->getParameterGroupSpec() ), dp::sg::core::ParameterGroupDataSharedPtr() ); } break; case dp::sg::core::OC_PARAMETER_GROUP_DATA : DP_ASSERT( child->getObjectCode() == dp::sg::core::OC_SAMPLER ); { dp::sg::core::ParameterGroupDataSharedPtr const& pgd = parent.staticCast<dp::sg::core::ParameterGroupData>(); const dp::fx::SmartParameterGroupSpec & pgs = pgd->getParameterGroupSpec(); dp::fx::ParameterGroupSpec::iterator it = pgs->findParameterSpec( child.staticCast<dp::sg::core::Sampler>()->getName() ); DP_ASSERT( it != pgs->endParameterSpecs() ); pgd->setParameter( it, dp::sg::core::SamplerSharedPtr() ); } break; case dp::sg::core::OC_PARALLELCAMERA : case dp::sg::core::OC_PERSPECTIVECAMERA : case dp::sg::core::OC_MATRIXCAMERA : DP_ASSERT( child->getObjectCode() == dp::sg::core::OC_LIGHT_SOURCE ); parent.staticCast<dp::sg::core::Camera>()->removeHeadLight( child.staticCast<dp::sg::core::LightSource>() ); break; case dp::sg::core::OC_SCENE : if ( child.isPtrTo<dp::sg::core::Camera>() ) { DP_VERIFY( parent.staticCast<dp::sg::core::Scene>()->removeCamera( child.staticCast<dp::sg::core::Camera>() ) ); } else { DP_ASSERT( child.isPtrTo<dp::sg::core::Node>() ); parent.staticCast<dp::sg::core::Scene>()->setRootNode( dp::sg::core::NodeSharedPtr() ); } break; default : DP_ASSERT( false ); break; } GetApp()->outputStatistics(); return true; }
void CAxialAnalysisOptionsDlg::OnOK() { UpdateData(TRUE); if (m_radius.IsEmpty() || m_radius.FindOneOf(_T("nN123456789")) == -1) { AfxMessageBox(_T("The radius must either be numeric or 'n'\n") _T("Alternatively, for multiple radii, type a list of comma separated numeric radii (you can include 'n')")); m_radius = _T("n"); UpdateData(FALSE); m_radius_ctrl.SetFocus(); return; } // now parse radius list: GetApp()->m_options.radius_list.clear(); CString curr_radius; int curr_comma = -1, last_comma = 0; bool add_rn = false; do { curr_comma = m_radius.Find(',',last_comma); if (curr_comma != -1) { curr_radius = m_radius.Mid(last_comma, curr_comma-last_comma); last_comma = curr_comma + 1; } else { curr_radius = m_radius.Mid(last_comma); } curr_radius.TrimLeft(' '); curr_radius.TrimRight(' '); if (!curr_radius.IsEmpty()) { if (curr_radius == "n" || curr_radius == "N") { add_rn = true; } else { int radius = _wtoi(curr_radius); if (radius <= 0) { AfxMessageBox(_T("Each radius in the list must either be 'n' or a number in the range 1-99")); m_radius_ctrl.SetFocus(); return; } GetApp()->m_options.radius_list.add((double) radius); } } } while (curr_comma != -1); if (GetApp()->m_options.radius_list.size() == 0 || add_rn) { GetApp()->m_options.radius_list.push_back(-1); } GetApp()->m_options.choice = m_choice; GetApp()->m_options.local = m_local; GetApp()->m_options.fulloutput = m_rra; // attributes: if (!m_weighted) { GetApp()->m_options.weighted_measure_col = -1; } else { GetApp()->m_options.weighted_measure_col = m_attribute; } CDialog::OnOK(); }
BOOL CRVTrackerNodeMove::OnUpdate(const CUIEvent &cEvent) { // Only update on idle if (cEvent.GetType() != UIEVENT_NONE) return TRUE; // Don't update if it hasn't moved if (m_cCurPt == m_cLastPt) return TRUE; LTVector newVert, moveOffset, translateAmount; DWORD i, j; CWorldNode *pNode; CEditBrush *pBrush; CEditPoly *pPoly; // If the mouse is outside of the view, then autoscroll the view DoAutoScroll(); // Use the current mouse position and use the delta from the last to update the // position of the node in 3d views... if( m_pView->GetVertexFromPoint(m_cCurPt, newVert)) { moveOffset = newVert - m_vStartVec; // Snap the movement to the current move axis (may be all axis) moveOffset.x *= m_vMoveSnapAxis.x; moveOffset.y *= m_vMoveSnapAxis.y; moveOffset.z *= m_vMoveSnapAxis.z; // If the shift key is pressed, then snap the object to horizontal or vertical movement if // that hasn't been done already. if (m_bLockAxis) { // Make sure that there isn't currently a move axis defined if (m_vMoveSnapAxis == CVector(1.0f, 1.0f, 1.0f)) { // Create an absolute vector so that the magnitudes can be compared CVector vAbsolute(fabs(m_vTotalMoveOffset.x), fabs(m_vTotalMoveOffset.y), fabs(m_vTotalMoveOffset.z)); // Check to see if we should snap to the x axis if (vAbsolute.x > vAbsolute.y && vAbsolute.x > vAbsolute.z) { // Cancel the movement along the y and z axis moveOffset.y=(-1)*m_vTotalMoveOffset.y; moveOffset.z=(-1)*m_vTotalMoveOffset.z; m_vMoveSnapAxis=CVector(1.0f, 0.0f, 0.0f); } // Check to see if we should snap to the y axis if (vAbsolute.y > vAbsolute.x && vAbsolute.y > vAbsolute.z) { // Cancel the movement along the y and z axis moveOffset.x=(-1)*m_vTotalMoveOffset.x; moveOffset.z=(-1)*m_vTotalMoveOffset.z; m_vMoveSnapAxis=CVector(0.0f, 1.0f, 0.0f); } // Check to see if we should snap to the z axis if (vAbsolute.z > vAbsolute.x && vAbsolute.z > vAbsolute.y) { // Cancel the movement along the y and z axis moveOffset.x=(-1)*m_vTotalMoveOffset.x; moveOffset.y=(-1)*m_vTotalMoveOffset.y; m_vMoveSnapAxis=CVector(0.0f, 0.0f, 1.0f); } } } else { m_vMoveSnapAxis=CVector(1.0f, 1.0f, 1.0f); } // Update the total move offset. This is used to snap the nodes when the shift key is pressed. m_vTotalMoveOffset+=moveOffset; // Go through all the selected nodes and move them... for( i=0; i < m_pView->GetRegion()->m_Selections; i++ ) { pNode = m_pView->GetRegion()->m_Selections[i]; // Handle movement for Brush nodes... if(pNode->GetType() == Node_Brush) { // Get the brush pointer... pBrush = pNode->AsBrush(); // Check for perpendicular movement... if(m_bPerp) { translateAmount = -(m_pView->EditGrid().Forward() * (CReal)(m_cCurPt.y - m_cLastPt.y)); } // planar movement... else { translateAmount = moveOffset; } for( j=0; j < pBrush->m_Points; j++ ) pBrush->m_Points[j] += translateAmount; // Update the texture space on the polies that are stuck. for(j=0; j < pBrush->m_Polies; j++) { pPoly = pBrush->m_Polies[j]; for(uint32 nCurrTex = 0; nCurrTex < CEditPoly::NUM_TEXTURES; nCurrTex++) { CTexturedPlane& Texture = pPoly->GetTexture(nCurrTex); pPoly->SetTextureSpace(nCurrTex, Texture.GetO() + translateAmount, Texture.GetP(), Texture.GetQ()); } } m_pView->GetRegion()->UpdateBrush(pBrush); } // Handle movement for object nodes... else if((pNode->GetType() == Node_Object) || (pNode->GetType() == Node_PrefabRef)) { // Check if perpendicular movement... if(m_bPerp) { LTVector vCurPos = pNode->GetPos(); vCurPos -= m_pView->EditGrid().Forward() * (CReal)(m_cCurPt.y - m_cLastPt.y); pNode->SetPos(vCurPos); } // planar movement... else { pNode->SetPos(pNode->GetPos() + moveOffset); } } } // Update starting vertex for next pass... m_vStartVec = newVert; } // If user wants all the views updated, then do it... if( GetApp()->m_bFullUpdate ) { m_pView->GetDocument()->UpdateAllViews(m_pView); m_pView->DrawRect(); } m_cLastPt = m_cCurPt; return TRUE; }
bool Mesh_D3D11::CreateBuffers(void) { // Define the input layout D3D11_INPUT_ELEMENT_DESC layout[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 24, D3D11_INPUT_PER_VERTEX_DATA, 0 }, }; unsigned int iElements = sizeof(layout)/sizeof(layout[0]); // create shaders if not created yet if(g_pTechniqueShadows == NULL) { if(!CreateShaders()) return false; } // Create the input layout HRESULT hr; D3DX11_PASS_DESC PassDesc; hr = g_pTechniqueShadows->GetPassByIndex(0)->GetDesc(&PassDesc); if(FAILED(hr)) { MessageBox(NULL, TEXT("Getting technique pass description failed!"), TEXT("Error!"), MB_OK); return false; } hr = GetApp()->GetDevice()->CreateInputLayout(layout, iElements, PassDesc.pIAInputSignature, PassDesc.IAInputSignatureSize, &m_pVertexLayout); if(FAILED(hr)) { MessageBox(NULL, TEXT("Creating input layout failed!"), TEXT("Error!"), MB_OK); return false; } // Create vertex buffer D3D11_BUFFER_DESC bd; bd.Usage = D3D11_USAGE_DEFAULT; bd.ByteWidth = m_iVertexSize * m_iNumVertices; bd.BindFlags = D3D11_BIND_VERTEX_BUFFER; bd.CPUAccessFlags = 0; bd.MiscFlags = 0; D3D11_SUBRESOURCE_DATA InitData; InitData.pSysMem = m_pVertices; hr = GetApp()->GetDevice()->CreateBuffer( &bd, &InitData, &m_pVertexBuffer ); if(FAILED(hr)) { MessageBox(NULL, TEXT("Creating vertex buffer failed!"), TEXT("Error!"), MB_OK); return false; } // Create index buffer bd.Usage = D3D11_USAGE_DEFAULT; bd.ByteWidth = sizeof(unsigned short) * m_iNumTris * 3; bd.BindFlags = D3D11_BIND_INDEX_BUFFER; bd.CPUAccessFlags = 0; bd.MiscFlags = 0; InitData.pSysMem = m_pIndices; hr = GetApp()->GetDevice()->CreateBuffer( &bd, &InitData, &m_pIndexBuffer ); if(FAILED(hr)) { MessageBox(NULL, TEXT("Creating index buffer failed!"), TEXT("Error!"), MB_OK); return false; } return true; }
void CFileProps::SetGeneralInfo() { char info[10000]; char buf[1000]; GF_MediaInfo odi; GF_ObjectManager *odm; u32 h, m, s, i, j; Osmo4 *gpac = GetApp(); odm = current_odm; strcpy(info, ""); if (!odm || gf_term_get_object_info(gpac->m_term, odm, &odi) != GF_OK) return; if (!odi.od) { strcat(info, odi.service_url); m_ODInfo.SetWindowText(info); return; } sprintf(buf, "%sObject Descriptor ID %d\r\n", (odi.has_profiles) ? "Initial " : "", odi.od->objectDescriptorID); strcat(info, buf); if (odi.duration) { h = (u32) (odi.duration / 3600); m = (u32) (odi.duration / 60) - h*60; s = (u32) (odi.duration) - h*3600 - m*60; sprintf(buf, "Duration %02d:%02d:%02d\r\n", h, m, s); strcat(info, buf); } else { strcat(info, "Unknown duration\r\n"); } if (odi.owns_service) { strcat(info, "Service Handler: "); strcat(info, odi.service_handler); strcat(info, "\r\n"); strcat(info, "Service URL: "); strcat(info, odi.service_url); strcat(info, "\r\n"); } if (odi.od->URLString) { strcat(info, "Remote OD - URL: "); strcat(info, odi.od->URLString); strcat(info, "\r\n"); } /*get OD content info*/ if (odi.codec_name) { switch (odi.od_type) { case GF_STREAM_VISUAL: sprintf(buf, "Video Object: Width %d - Height %d\r\n", odi.width, odi.height); strcat(info, buf); strcat(info, "Media Codec "); strcat(info, odi.codec_name); strcat(info, "\r\n"); if (odi.par) { sprintf(buf, "Pixel Aspect Ratio: %d:%d\r\n", (odi.par>>16)&0xFF, (odi.par)&0xFF); strcat(info, buf); } break; case GF_STREAM_AUDIO: sprintf(buf, "Audio Object: Sample Rate %d - %d channels\r\n", odi.sample_rate, odi.num_channels); strcat(info, buf); strcat(info, "Media Codec "); strcat(info, odi.codec_name); strcat(info, "\r\n"); break; case GF_STREAM_PRIVATE_SCENE: case GF_STREAM_SCENE: if (odi.width && odi.height) { sprintf(buf, "Scene Description: Width %d - Height %d\r\n", odi.width, odi.height); } else { sprintf(buf, "Scene Description: No size specified\r\n"); } strcat(info, buf); strcat(info, "Scene Codec "); strcat(info, odi.codec_name); strcat(info, "\r\n"); break; case GF_STREAM_TEXT: if (odi.width && odi.height) { sprintf(buf, "Text Object: Width %d - Height %d\r\n", odi.width, odi.height); } else { sprintf(buf, "Text Object: No size specified\r\n"); } strcat(info, buf); strcat(info, "Text Codec "); strcat(info, odi.codec_name); strcat(info, "\r\n"); break; } }
LOCAL void Slider_Paint (HWND hWindow, HDC hDC, LPRECT lpRect, BOOL fHighlight) /***********************************************************************/ { BOOL bHasFocus, bSelected, bDown; DWORD dwStyle; RECT rSrcArea, rDstArea; POINT ptDst; UINT id; PDIB pdibSrc, pdibDst; HDC hWinGDC; LPHSLIDERINFO lpInfo; if (! (lpInfo = (LPHSLIDERINFO)GetWindowLong (hWindow, GWL_DATAPTR) ) ) return; rSrcArea = *lpRect; rDstArea = *lpRect; MapWindowPoints (hWindow, GetParent(hWindow), (LPPOINT)& rDstArea, 2 ); LPSCENE lpScene = CScene::GetScene (GetParent (hWindow) ); if (! lpScene) return; if ( !lpScene->GetDIBs( &pdibSrc, &pdibDst, &hWinGDC ) ) return; if ( !pdibSrc || !pdibDst || !hWinGDC ) return; bSelected = GetWindowWord (hWindow, GWW_STATE); dwStyle = GetWindowLong (hWindow, GWL_STYLE); bHasFocus = (GetFocus () == hWindow); bDown = ( bSelected || (lpInfo->bTrack && lpInfo->bInRect && bHasFocus) ); // Repair the dirty bitmap with the clean bitmap if ( pdibSrc->GetCompression() == BI_RLE8 || pdibDst->GetCompression() == BI_RLE8) { // compressed DIBs must use GDI copying (lose transparency ability) pdibSrc->DCBlt( hWinGDC, rDstArea.left, rDstArea.top, rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top, rDstArea.left, rDstArea.top, rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top ); } else { pdibSrc->DibBlt( pdibDst, rDstArea.left, rDstArea.top, rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top, rDstArea.left, rDstArea.top, rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top, NO /*bTransparent*/ ); } // Draw the slider background RECT rSlider = lpInfo->rSlider; RECT rInner = lpInfo->rSlider; rInner.top = lpInfo->iCenter - (lpInfo->iTrackWidth / 2); rInner.bottom = lpInfo->iCenter + (lpInfo->iTrackWidth / 2); MapWindowPoints (hWindow, GetParent(hWindow), (LPPOINT)& rSlider, 2); MapWindowPoints (hWindow, GetParent(hWindow), (LPPOINT)& rInner, 2); // Turn off tick painting because using background bitmap #ifdef UNUSED HBRUSH hBrush = CreateSolidBrush (lpInfo->rgbBackgnd); HBRUSH hBrush2 = (HBRUSH)GetStockObject (BLACK_BRUSH); FillRect (hWinGDC, & rSlider, hBrush); FillRect (hWinGDC, & rInner, hBrush2); DeleteObject (hBrush); #endif RECT rClient; GetClientRect (hWindow, & rClient); MapWindowPoints (hWindow, GetParent(hWindow), (LPPOINT)& rClient, 2 ); // Turn off tick painting because using background bitmap #ifdef UNUSED // Draw a chiselled border RECT rBorder = rClient; InflateRect (& rBorder, 1, 1); int cxButton = rBorder.right - rBorder.left; int cyButton = rBorder.bottom - rBorder.top; HPEN hLitePen = CreatePen (PS_SOLID, 1, RGB (255, 255, 255)); HPEN hDarkPen = CreatePen (PS_SOLID, 1, RGB (128, 128, 128)); HPEN hOldPen = (HPEN)SelectObject (hWinGDC, hLitePen); MoveToEx (hWinGDC, rBorder.left, rBorder.bottom - 1, NULL); LineTo (hWinGDC, rBorder.left, rBorder.top); LineTo (hWinGDC, rBorder.right - 1, rBorder.top); MoveToEx (hWinGDC, rBorder.left + 1, rBorder.bottom - 2, NULL); LineTo (hWinGDC, rBorder.left + 1, rBorder.top + 1); LineTo (hWinGDC, rBorder.right - 2, rBorder.top + 1); SelectObject (hWinGDC, hDarkPen); MoveToEx (hWinGDC, rBorder.right - 1, rBorder.top, NULL); LineTo (hWinGDC, rBorder.right - 1, rBorder.bottom - 1); LineTo (hWinGDC, rBorder.left, rBorder.bottom - 1); MoveToEx (hWinGDC, rBorder.right - 2, rBorder.top + 1, NULL); LineTo (hWinGDC, rBorder.right - 2, rBorder.bottom - 2); LineTo (hWinGDC, rBorder.left + 1, rBorder.bottom - 2); SelectObject (hWinGDC, hOldPen); DeleteObject (hLitePen); DeleteObject (hDarkPen); // If tick-marks are wanted if (lpInfo->iTicks) { int pw = 2; // pen width HPEN hTickPen = CreatePen (PS_SOLID, pw, lpInfo->rgbBackgnd); hOldPen = (HPEN)SelectObject (hWinGDC, hTickPen); int iBmpWidth = lpInfo->rBitmap.right - lpInfo->rBitmap.left; int wx = rClient.right - rClient.left - iBmpWidth; int dx = wx / lpInfo->iTicks; wx = wx - (dx * lpInfo->iTicks) - pw; int x = rClient.left + (iBmpWidth + wx + pw) / 2; // wx is now the excess int y1 = rClient.top + 2; int y2 = y1 + 10; for (int idx = 0; idx <= lpInfo->iTicks ; idx++) { MoveToEx (hWinGDC, x, y1, NULL); LineTo (hWinGDC, x, y2); x += dx; } SelectObject (hWinGDC, hOldPen); DeleteObject (hTickPen); } #endif rSrcArea = lpInfo->rBitmap; rDstArea = lpInfo->rBitmap; MapWindowPoints (hWindow, GetParent(hWindow), (LPPOINT)& rDstArea, 2 ); // Get the control ID to load the bitmap resource if (! (id = GetWindowWord (hWindow, GWW_ICONID) ) ) id = GET_WINDOW_ID (hWindow); if (pdibSrc = CDib::LoadDibFromResource (GetWindowInstance (hWindow), MAKEINTRESOURCE(id), GetApp()->m_hPal, (dwStyle & BS_MASK) != 0 )) { // Load the resource if ( pdibSrc->GetCompression() == BI_RLE8 || pdibDst->GetCompression() == BI_RLE8 ) { // compressed DIBs must use GDI copying (lose transparency ability) pdibSrc->DCBlt( hWinGDC, rDstArea.left, rDstArea.top, rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top, rSrcArea.left, rSrcArea.top, rSrcArea.right - rSrcArea.left, rSrcArea.bottom - rSrcArea.top ); } else { RGBTRIPLE rgb; LPRGBTRIPLE lpRGB = NULL; if (dwStyle & BS_MASK) { STRING szColor; GetWindowText(hWindow, szColor, sizeof(szColor)); AsciiRGB( szColor, &rgb ); lpRGB = &rgb; } if (dwStyle & BS_HIGHLIGHT) { // Get the transparency color BYTE bTrans = *pdibSrc->GetXY(0, 0); // Get the color to replace LPTR lpColor = pdibSrc->GetXY(1, 0); BYTE bColor = *lpColor; *lpColor = bTrans; // Get the hightlight color LPTR lpHighlight = pdibSrc->GetXY(2, 0); BYTE bHighlight = *lpHighlight; *lpHighlight = bTrans; // Replace the pixels in the DIB if (bDown && (bColor != bHighlight)) { HPTR hp = pdibSrc->GetPtr(); DWORD dwSize = pdibSrc->GetSizeImage(); while ( dwSize-- ) { if (*hp == bColor) *hp = bHighlight; ++hp; } } } // Set slider position if needed if (lpInfo->Position) { int iBmpWidth = lpInfo->rBitmap.right - lpInfo->rBitmap.left; int iWidth = rClient.right - rClient.left - iBmpWidth; int x = (int)(((long)(lpInfo->Position - lpInfo->Min) * iWidth) / (lpInfo->Max - lpInfo->Min)); rDstArea.left += x; if (rDstArea.left < rClient.left) rDstArea.left = rClient.left; else if (rDstArea.left + iBmpWidth > rClient.right) rDstArea.left = rClient.right - iBmpWidth; rDstArea.right = rDstArea.left + iBmpWidth; } pdibSrc->DibBlt( pdibDst, rDstArea.left, rDstArea.top, rDstArea.right - rDstArea.left, rDstArea.bottom - rDstArea.top, rSrcArea.left, rSrcArea.top, rSrcArea.right - rSrcArea.left, rSrcArea.bottom - rSrcArea.top, (dwStyle & BS_TRANSPARENT) != 0 /*bTransparent*/, lpRGB ); } delete pdibSrc; } ptDst.x = rSrcArea.left; ptDst.y = rSrcArea.top; if (lpScene) lpScene->Paint( hDC, &rClient, &ptDst ); }
const char* GetString(enumSTRING eString) { return c_pszText[GetApp()->GetLanguage()][eString]; }
void CFileProps::OnDestroy() { CDialog::OnDestroy(); delete this; ((CMainFrame *)GetApp()->m_pMainWnd)->m_pProps = NULL; }