/*! * \brief Create a document from a specified file. * * \param path Pathname of the configuration file. */ bool CNutConfDoc::OnCreate(const wxString & path, long flags) { bool rc = false; wxString normPath(path); CSettings *cfg = wxGetApp().GetSettings(); normPath.Replace(wxT("\\"), wxT("/")); cfg->m_configname = normPath; wxGetApp().m_currentDoc = this; /* * The repository may refer to certain configuration values. Thus, * it must be loaded before reading the repository. */ cfg->Load(cfg->m_configname); if ((rc = ReadRepository(cfg->m_repositoryname, normPath)) == true) { Modify(false); SetDocumentSaved(false); rc = wxDocument::OnCreate(path, flags); if (rc) { if (flags & wxDOC_NEW) { wxBusyCursor wait; CNutConfHint hint(NULL, nutSelChanged); UpdateAllViews(NULL, &hint); SetFilename(GetFilename(), true); } } } if(!rc) { wxGetApp().m_currentDoc = NULL; } return rc; }
HRESULT CDxtexDoc::LoadAlphaBmp(CString& strPath) { HRESULT hr; LPDIRECT3DTEXTURE9 pmiptex; LPDIRECT3DSURFACE9 psurf; if (IsCubeMap()) return E_FAIL; pmiptex = (LPDIRECT3DTEXTURE9)m_ptexOrig; hr = pmiptex->GetSurfaceLevel(0, &psurf); if (FAILED(hr)) return hr; hr = LoadAlphaIntoSurface(strPath, psurf); ReleasePpo(&psurf); if (FAILED(hr)) return hr; UpdateAllViews(NULL, 1); // tell CView to pick up new surface pointers return S_OK; }
void CModelerDoc::OnFileAddTexture() { CModelerView *pModelerView = CModelerView::GetActiveView(); if( pModelerView == NULL) return; // call file requester for adding textures CDynamicArray<CTFileName> afnTextures; CTFileName fnDocName = CTString(GetPathName()); theApp.WriteProfileString( "Scape", "Add texture directory", fnDocName.FileDir()); _EngineGUI.FileRequester( "Choose textures to add", FILTER_TEX FILTER_END, "Add texture directory", "Textures\\", fnDocName.FileName()+".tex", &afnTextures); MEX mexWidth, mexHeight; m_emEditModel.edm_md.GetTextureDimensions( mexWidth, mexHeight); // add selected textures FOREACHINDYNAMICARRAY( afnTextures, CTFileName, itTexture) { CTextureDataInfo *pNewTDI; // add texture CTFileName fnTexName = itTexture.Current(); try { pNewTDI =m_emEditModel.AddTexture_t( fnTexName, mexWidth, mexHeight); } catch( char *err_str) { pNewTDI = NULL; AfxMessageBox( err_str); } if( pNewTDI != NULL) { SetModifiedFlag(); pModelerView->m_ptdiTextureDataInfo = pNewTDI; // switch to texture mode pModelerView->OnRendUseTexture(); UpdateAllViews( NULL); } }
CZoneView* CSimPetriDoc::AddZone(Point& firstPoint, Point& lastPoint) { Rect rectangle; if(gridMode) Rect::Union(rectangle, CElement::GridCellRect(firstPoint), CElement::GridCellRect(lastPoint)); else rectangle = CElement::RectangleFromPoints(firstPoint, lastPoint); CZoneView* zoneView = new CZoneView(rectangle); auto rit = drawingElements.rbegin(); while(rit!= drawingElements.rend() && (*rit)->Type() == CElement::ZONE) ++rit; drawingElements.insert(rit.base(), zoneView); //Notifier le changement SetModifiedFlag(); UpdateAllViews(NULL); RefreshIDs(); return zoneView; }
void CCreepingLineDoc::OnOptions() { CLinePropertySheet propSheet; propSheet.m_line = m_line; int res = propSheet.DoModal(); if( res == IDOK ) { m_line = propSheet.m_line; BOOL bChanged = !(m_line_orig == m_line); this->SetModifiedFlag( bChanged ); UpdateAllViews( NULL ); if(m_CrippingLinePreview.IsPlay()) { OnStopCreepingLine(); OnRunCreepingLine(); } } }
// Try to set up a new instrument that is linked to a given plugin INSTRUMENTINDEX CModDoc::InsertInstrumentForPlugin(PLUGINDEX plug) //---------------------------------------------------------------- { #ifndef NO_PLUGINS const bool first = (GetNumInstruments() == 0); if(first && !ConvertSamplesToInstruments()) return INSTRUMENTINDEX_INVALID; INSTRUMENTINDEX instr = m_SndFile.GetNextFreeInstrument(); if(instr == INSTRUMENTINDEX_INVALID) return INSTRUMENTINDEX_INVALID; ModInstrument *ins = m_SndFile.AllocateInstrument(instr, 0); if(ins == nullptr) return INSTRUMENTINDEX_INVALID; InitializeInstrument(ins); _snprintf(ins->name, CountOf(ins->name) - 1, _T("%u: %s"), plug + 1, m_SndFile.m_MixPlugins[plug].GetName()); mpt::String::Copy(ins->filename, mpt::ToCharset(mpt::CharsetLocale, mpt::CharsetUTF8, m_SndFile.m_MixPlugins[plug].GetLibraryName())); ins->nMixPlug = plug + 1; ins->nMidiChannel = 1; // People will forget to change this anyway, so the following lines can lead to some bad surprises after re-opening the module. //pIns->wMidiBank = (WORD)((m_pVstPlugin->GetCurrentProgram() >> 7) + 1); //pIns->nMidiProgram = (BYTE)((m_pVstPlugin->GetCurrentProgram() & 0x7F) + 1); if(instr > m_SndFile.m_nInstruments) m_SndFile.m_nInstruments = instr; InstrumentHint hint = InstrumentHint(instr).Info().Envelope().Names(); if(first) hint.ModType(); UpdateAllViews(nullptr, hint); if(m_SndFile.GetModSpecifications().supportsPlugins) { SetModified(); } return instr; #else return INSTRUMENTINDEX_INVALID; #endif }
void CSubdivisionDoc::OnImport() { CString lpszFilter = _T("Obj files (*.obj)|*.obj|Off files (*.off)|*.off||"); CFileDialog dlg(true, NULL, NULL, OFN_READONLY, lpszFilter); dlg.m_ofn.lpstrTitle = _T("Import 3D model"); //// dlg.m_ofn.lpstrDefExt = _T("obj"); if(dlg.DoModal() == IDOK) { CString strFile = dlg.GetPathName(); // delete m_pmesh, m_pmesh = NULL; if (m_pmesh==NULL) { m_pmesh = new Mesh3D; } CString extension = strFile; extension = extension.Right(extension.GetLength()-extension.ReverseFind('.')); extension.MakeLower(); if (extension == ".off") { CStringA ss(strFile); m_pmesh->load_off((LPCSTR)(ss)); } else if (extension == ".obj") { //const char * ss = CString2constchar(strFile); CStringA ss(strFile); m_pmesh->load_obj((LPCSTR)(ss)); } m_pmesh->update_mesh(); } UpdateAllViews(NULL); }
/*! * \brief Create all configuration items. */ void CNutConfDoc::AddAllItems() { CConfigTree *treeCtrl = wxGetApp().GetMainFrame()->GetTreeCtrl(); wxGetApp().GetMainFrame()->GetPropertyListWindow()->Fill(NULL); treeCtrl->DeleteAllItems(); CConfigItem *item = new CConfigItem(); wxTreeItemId rootId = treeCtrl->AddRoot(wxT(""), -1, -1, new CTreeItemData(item)); item->SetTreeItem(rootId); item->UpdateTreeItem(*treeCtrl); m_items.Append(item); AddChildItems(m_root, rootId); UpdateAllViews(); if (GetItems().GetCount() > 0) { wxGetApp().GetMainFrame()->GetTreeCtrl()->Expand(rootId); } wxGetApp().GetMainFrame()->GetTreeCtrl()->SetFocus(); }
CTransView* CSimPetriDoc::AddTransition(Point& center, pm::Transition* transitionModel) { //Modèle if(!transitionModel) transitionModel = skeleton.addTransition(); //Les mémoires ont été supprimées RefreshMemoryComboBox(); //Vue transition CTransView* transitionView = new CTransView(center, transitionModel); if(gridMode) transitionView->AdjustOnGrid(); drawingElements.push_front(transitionView); //Ajout dans la map des transitions transitions[transitionView] = transitionModel; //Notifier le chagement SetModifiedFlag(); UpdateAllViews(NULL); RefreshIDs(); return transitionView; }
// ************************************************************************** // AddServer () // // Description: // Adds a server that was created during document load from disk or during a // cut and paste operation to the document. // // Parameters: // CKServer *pServer Pointer to server object to add. // bool bConnect Set to true to connect to server after add. // // Returns: // void // ************************************************************************** void CKDocument::AddServer (CKServer *pServer, bool bConnect /* = false */) { // Check that pointer to server is not NULL (for debug only): ASSERT (pServer != NULL); // Add the server to head of linked list list. // Next item will be previous head of linked list: pServer->SetNext (m_pServerHead); // If we had a head to the linked list, it's previous item will be // new server: if (m_pServerHead) m_pServerHead->SetPrev (pServer); // New server is now the head of the linked list: m_pServerHead = pServer; // Increment the server count: ++m_cdwServers; // Connect to the OPC Server if asked: if (bConnect) { // Start the server: pServer->Start (); // Update views to indicate new server connection status. // Architecture will assue that new server will get added // to views if we don't connect at this point. UpdateAllViews (NULL, HINT_ADD_SERVER_AND_GROUPS, pServer); // Set document modified flag: SetModified (); } }
// Open the document bool ctConfigToolDoc::OnOpenDocument(const wxString& filename) { wxBusyCursor cursor; bool opened = DoOpen(filename); if (opened) { SetFilename(filename); wxGetApp().GetSettings().m_lastFilename = filename; ((ctConfigToolView*)GetFirstView())->OnChangeFilename(); RefreshDependencies(); // ctConfigToolHint hint(NULL, ctFilenameChanged); ctConfigToolHint hint(NULL, ctInitialUpdate); UpdateAllViews (NULL, & hint); } SetDocumentSaved(true); // Necessary or it will pop up the Save As dialog return opened; }
// -------------------------------------------------------------------------- void CFabAtHomeDoc::OnModelScale() // -------------------------------------------------------------------------- { CString action; action.Format("Rescale Model"); CAxesDlg dlg(NULL, action); dlg.m_xax = "1.0"; dlg.m_yax = "1.0"; dlg.m_zax = "1.0"; if (dlg.DoModal() == IDOK) { //check for zero scale factor CVec s(atof(dlg.m_xax),atof(dlg.m_yax),atof(dlg.m_zax)); if(s.x==0 || s.y==0 || s.z==0) { ((CFabAtHomeApp *)AfxGetApp())->Log("Scale factor of zero is not allowed."); return; } double pi = atan(1.0)*4; for (int i=0; i<model.chunk.GetSize(); i++) { if (model.chunk[i].IsSelected()) { model.chunk[i].geometry.Scale(s); } } model.Flush(); model.MoveToOrigin(); SetModifiedFlag(); UpdateAllViews(0); } }
bool csDiagramDocument::OnOpenDocument(const wxString& file) { if (!OnSaveModified()) return false; wxString msgTitle; if (wxTheApp->GetAppName() != wxEmptyString) msgTitle = wxTheApp->GetAppName(); else msgTitle = wxString(_T("File error")); m_diagram.DeleteAllShapes(); if (!m_diagram.LoadFile(file)) { (void)wxMessageBox(_T("Sorry, could not open this file."), msgTitle, wxOK|wxICON_EXCLAMATION, GetDocumentWindow()); return false; } SetFilename(file, true); Modify(false); UpdateAllViews(); return true; }
/// Open the settings file bool ctConfigToolDoc::DoOpen(const wxString& filename) { wxSimpleHtmlParser parser; if (parser.ParseFile(filename)) { ctConfigToolHint hint(NULL, ctClear); UpdateAllViews (NULL, & hint); m_topItem = NULL; if (parser.GetTopLevelTag()->GetChildren()) { wxSimpleHtmlTag* settingsTag = parser.GetTopLevelTag()->GetChildren()->FindTag(wxT("settings")); if (settingsTag && settingsTag->GetChildren()) { wxSimpleHtmlTag* firstSettingTag = settingsTag->GetChildren(); if (firstSettingTag) DoOpen(firstSettingTag, NULL); return true; } return true; } } return false; }
// -------------------------------------------------------------------------- void CFabAtHomeDoc::OnModelDelete() // -------------------------------------------------------------------------- { int cnt = 0; for (int i=0; i<model.chunk.GetSize(); i++) { if (model.chunk[i].IsSelected()) { model.chunk.RemoveAt(i); i--; cnt++; } } if (cnt > 0) { model.FocusCentroid(); model.fab.layer.RemoveAll(); model.fab.SetCurrentLayer(0); SetModifiedFlag(); } model.Flush(); UpdateAllViews(0); }
void CHelloDoc::SetColor(COLORREF color) { m_curColor = color; UpdateAllViews(NULL); }
void DrawingDocument::DoUpdate() { Modify(true); UpdateAllViews(); }
int CInv3DDoc::ImportModel(CString strFilePath, BOOL bAppend) { CFile file(strFilePath, CFile::modeRead); int tag; int nTmp; double dTmp; char hdr[1024]; file.Read(hdr, 1024); file.Read(&m_nX, sizeof(int)); file.Read(&m_nY, sizeof(int)); file.Read(&m_nZ, sizeof(int)); file.Read(&m_xMin, sizeof(double)); file.Read(&m_yMin, sizeof(double)); file.Read(&m_zMax, sizeof(double)); file.Read(&m_xCs, sizeof(double)); file.Read(&m_yCs, sizeof(double)); file.Read(&m_zCs, sizeof(double)); file.Read(&nTmp, sizeof(int)); // CG iterations file.Read(&nTmp, sizeof(int)); // CG restart file.Read(&nTmp, sizeof(int)); // focusing iterations file.Read(&dTmp, sizeof(double)); // CG EPS file.Read(&dTmp, sizeof(double)); // focusing power file.Read(&dTmp, sizeof(double)); // initial model //file.Read(&dTmp, sizeof(double)); // penalization minimum //file.Read(&dTmp, sizeof(double)); // penalization maximum file.Read(&tag, sizeof(int)); m_xMax = m_xMin + m_nX*m_xCs; if(m_nY>1) m_yMax = m_yMin +m_nY*m_yCs; else m_yMax = m_yMin + m_xCs; // 2D model m_zMin = m_zMax - m_nZ*m_zCs; UINT nRead=0; int nModelsOld = m_nModels; if(!bAppend || m_nModels==-1) { m_nModels = 0; m_model.clear(); //if(m_pModel != NULL) { // for(int i=0; i<100; i++) { // if(m_pModel[i] != NULL){ // delete[] m_pModel[i]; // } // } // delete[] m_pModel; //} //m_pModel = new double*[100]; //for(int i=0; i<100; i++) // m_pModel[i]=NULL; } UINT nModSize = m_nX*m_nZ*m_nY; do { UINT nSize; if(m_nModels!=0 && m_nModels!=nModelsOld ) file.Read(&tag, sizeof(int)); file.Read(&nSize, sizeof(UINT)); //if(m_pModel[m_nModels] != NULL) // delete[] m_pModel[m_nModels]; //m_pModel[m_nModels] = new double[nModSize]; m_model.emplace_back( std::vector<double>(nModSize) ); ASSERT(nSize==nModSize); //nRead = file.Read(m_pModel[m_nModels], nSize*sizeof(double)); nRead = file.Read(m_model.back().data(), nSize*sizeof(double)); if(nRead==0) { //delete[] m_pModel[m_nModels]; //m_pModel[m_nModels] = NULL; m_model.pop_back(); } m_nModels++; } while(nRead!=0); m_nModels--; file.Close(); UpdateAllViews(NULL, UPDATE_MODEL_NEW); return 0; }
HRESULT CResourceMapDoc::OnResourceDeleted(DWORD dwID) { // phil TODO UpdateAllViews(NULL, VIEWUPDATEHINT_RESOURCEMAPCHANGED); return S_OK; }
void CResourceMapDoc::Serialize(CArchive& ar) { if (ar.IsStoring()) { // There is nothing to save. int x = 0; } else { CFile *pFile = ar.GetFile(); // Set the current directory, so we know where to look for the resource files. // If not, clicking on an item in the recent documents list won't work CString path = pFile->GetFilePath(); path.MakeLower(); int iFileOffset = path.Find(TEXT("\\resource.map")); if (iFileOffset > 0) { path.SetAt(iFileOffset, 0); // Null terminate it // Set this folder as our new game folder CResourceMap &map = theApp.GetResourceMap(); map.SetGameFolder(path); // Close it. We only wanted the path. pFile->Close(); // Clear the current view. _DeleteAllResourceData(); _DeleteAllPics(); CResourceEnumerator *pEnum; if (SUCCEEDED(map.CreateEnumerator(RTF_PIC, &pEnum))) { CResourceData *pData; while (S_OK == pEnum->Next(&pData)) { // TODO: try catch, and free pData? // Add these resource datas. _resources.Add(pData); // And create a pic from them. CPic *ppic = new CPic(); if (ppic) { if (SUCCEEDED(ppic->InitFromResource(pData))) { _pics.Add(ppic); } else { delete ppic; } } } #ifdef DEBUG INT_PTR iSizeMemory = 0; for (INT_PTR i = 0; i < _pics.GetSize(); i++) { CPic *ppic = _pics.GetAt(i); iSizeMemory += ppic->GetMemorySize(); } TCHAR sz[MAX_PATH]; StringCchPrintf(sz, ARRAYSIZE(sz), TEXT("Memory size of pics: %d"), iSizeMemory); OutputDebugString(sz); #endif SetModifiedFlag(TRUE); UpdateAllViews(NULL, VIEWUPDATEHINT_RESOURCEMAPCHANGED); delete pEnum; } } else { AfxMessageBox(TEXT("SCI game resources must be called resource.map"), MB_OK | MB_ICONEXCLAMATION); } } }
void CStudentDoc::OnEditClearAll() { DeleteContents(); UpdateAllViews(NULL); }
OPENMPT_NAMESPACE_BEGIN #pragma warning(disable:4244) //"conversion from 'type1' to 'type2', possible loss of data" // Change the number of channels. // Return true on success. bool CModDoc::ChangeNumChannels(CHANNELINDEX nNewChannels, const bool showCancelInRemoveDlg) //------------------------------------------------------------------------------------------ { const CHANNELINDEX maxChans = m_SndFile.GetModSpecifications().channelsMax; if (nNewChannels > maxChans) { CString error; error.Format("Error: Max number of channels for this file type is %d", maxChans); Reporting::Warning(error); return false; } if (nNewChannels == GetNumChannels()) return false; if (nNewChannels < GetNumChannels()) { // Remove channels UINT nChnToRemove = 0; CHANNELINDEX nFound = 0; //nNewChannels = 0 means user can choose how many channels to remove if(nNewChannels > 0) { nChnToRemove = GetNumChannels() - nNewChannels; nFound = nChnToRemove; } else { nChnToRemove = 0; nFound = GetNumChannels(); } CRemoveChannelsDlg rem(m_SndFile, nChnToRemove, showCancelInRemoveDlg); CheckUsedChannels(rem.m_bKeepMask, nFound); if (rem.DoModal() != IDOK) return false; // Removing selected channels return RemoveChannels(rem.m_bKeepMask, true); } else { // Increasing number of channels BeginWaitCursor(); std::vector<CHANNELINDEX> channels(nNewChannels, CHANNELINDEX_INVALID); for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++) { channels[nChn] = nChn; } const bool success = (ReArrangeChannels(channels) == nNewChannels); if(success) { SetModified(); UpdateAllViews(nullptr, UpdateHint().ModType()); } EndWaitCursor(); return success; } }
void CHelloDoc::SetLocation(CPoint pt) { m_ptLoc = pt; UpdateAllViews(NULL); }
void CBptDoc::Sync() { UpdateAllViews(0); }
void CBTGDoc::Reset(void) { // Start in this mode by default. Remember to set up menus. if (!undoing) { btgDocMode = btgDocMode_EditBTGVertices; undoBufferIndex = 0; for(long i=0;i<BTG_NUM_UNDOS;i++) { if(undoBuffers[i]) { delete undoBuffers[i]; undoBuffers[i] = 0; } } } xScrollVal = yScrollVal = 10; zoomVal = 0.5; EverythingClearSelected(); DisableBandBox(); DisableDragMode(); mRed = mGreen = mBlue = mAlpha = mBrightness = 255; mBGRed = mBGGreen = mBGBlue = 0; pageWidth = 2*1280; pageHeight = 2*1024; BTGVertexList.PurgeList(); BTGPolygonList.PurgeList(); BTGStarList.PurgeList(); //gBMPFileList.PurgeList(); bStars = 1; renderMode = btgRenderMode_Realistic; if(undoing == 0) { drawMode = btgDrawMode_Basic; } bDisableModified = 0; UpdateAllViews(NULL); UpdateMainFrmDialogs(); curStarFileName = 0; if(undoing == 0) { KillTGAFile(&backgroundImage); drawSolidPolys = TRUE; drawBackground = TRUE; bgPixelGrabEnabled = FALSE; } }
void CMUSHclientDoc::Redraw() { UpdateAllViews (NULL); }
BOOL CdIpmDoc::UpdateDisplay() { TRACE0("CdIpmDoc::UpdateDisplay()\n"); try { m_pTreeGD->RefreshAllTreeBranches(); // refresh left pane IPMUPDATEPARAMS ups; memset (&ups, 0, sizeof (ups)); CTreeItem* pItem = NULL; CTreeCtrl* pTree = m_pTreeGD->GetPTree(); ASSERT (pTree); HTREEITEM hSelectedItem = pTree->GetSelectedItem(); if (!hSelectedItem) return FALSE; pItem = (CTreeItem*)pTree->GetItemData(hSelectedItem); ASSERT (pItem); if (pItem->IsNoItem() || pItem->IsErrorItem()) { m_pTabDialog->DisplayPage (NULL); } else if (pItem->ItemDisplaysNoPage()) { CString caption = pItem->ItemNoPageCaption(); m_pTabDialog->DisplayPage (NULL, caption); } else { int nImage = -1, nSelectedImage = -1; CImageList* pImageList = pTree->GetImageList (TVSIL_NORMAL); HICON hIcon = NULL; int nImageCount = pImageList? pImageList->GetImageCount(): 0; if (pImageList && pTree->GetItemImage(hSelectedItem, nImage, nSelectedImage)) { if (nImage < nImageCount) hIcon = pImageList->ExtractIcon(nImage); } CuPageInformation* pPageInfo = pItem->GetPageInformation(); CString strItem = pItem->GetRightPaneTitle(); ups.nType = pItem->GetType(); ups.pStruct = pItem->GetPTreeItemData()? pItem->GetPTreeItemData()->GetDataPtr(): NULL; ups.pSFilter= m_pTreeGD->GetPSFilter(); pPageInfo->SetUpdateParam (&ups); pPageInfo->SetTitle ((LPCTSTR)strItem, pItem, this); pPageInfo->SetImage (hIcon); m_pTabDialog->DisplayPage (pPageInfo); } // Replicator Monitor special management // ASSUMES we did not change the current item! BOOL bReplMonWasOn = (m_hReplMonHandle != -1) ? TRUE: FALSE; BOOL bReplMonToBeOn = pItem->HasReplicMonitor(); // 3 cases : // - on to off ---> replicator has been uninstalled // - off to on ---> replicator has been installed // - on to on, or off to off: state has not changed if (bReplMonWasOn && !bReplMonToBeOn) { BOOL bOK = TerminateReplicator(); ASSERT (bOK); } else if (!bReplMonWasOn && bReplMonToBeOn) { CString csDbName = pItem->GetDBName(); BOOL bOK = InitializeReplicator(csDbName); ASSERT (bOK); } // // Refresh right pane CfIpmFrame* pIpmFrame = (CfIpmFrame*)pTree->GetParentFrame(); UpdateAllViews((CView *)pIpmFrame->GetLeftPane()); } catch(CMemoryException* e) { theApp.OutOfMemoryMessage(); e->Delete(); return FALSE; } catch(CResourceException* e) { //_T("Cannot load dialog box"); AfxMessageBox (IDS_E_LOAD_DLG); e->Delete(); return FALSE; } catch(...) { //_T("Cannot construct the property pane"); AfxMessageBox (IDS_E_CONSTRUCT_PROPERTY); return FALSE; } return TRUE; }
// set main window foreground image long CMUSHclientDoc::SetForegroundImage(LPCTSTR FileName, short Mode) { if (Mode < 0 || Mode > 13) return eBadParameter; if ((HBITMAP) m_ForegroundBitmap) m_ForegroundBitmap.DeleteObject (); m_strForegroundImageName.Empty (); UpdateAllViews (NULL); CString strFileName = FileName; strFileName.TrimLeft (); strFileName.TrimRight (); // no file name means get rid of image if (strFileName.IsEmpty ()) return eOK; // have to be long enough to have x.bmp if (strFileName.GetLength () < 5) return eBadParameter; HBITMAP hBmp; // handle PNG files separately if (strFileName.Right (4).CompareNoCase (".png") == 0) { long result = LoadPng (FileName, hBmp); if (result != eOK) return result; } // png file else { // must be .bmp or .png file if (strFileName.Right (4).CompareNoCase (".bmp") != 0) return eBadParameter; hBmp = (HBITMAP)::LoadImage( NULL, FileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION ); } // bmp file if (hBmp) { m_ForegroundBitmap.Attach (hBmp); m_iForegroundMode = Mode; m_strForegroundImageName = FileName; return eOK; } // end of having a bitmap loaded if (GetLastError () == 2) return eFileNotFound; return eCouldNotOpenFile; } // end of CMUSHclientDoc::SetForegroundImage
void CEx_DrawDoc::WriteLog( CGraphicLog::GOS gos, CGraphic* P, int index ) { m_log.Operator(gos, P, index); Trace(); UpdateAllViews(NULL, 0x6000); }
BOOL CdIpmDoc::FilterChange(FilterCause nCause, BOOL bSet) { try { switch (nCause) { case FILTER_NOTHING: return TRUE; case FILTER_NULL_RESOURCES: if (m_sFilter.bNullResources == bSet) return TRUE; m_sFilter.bNullResources = bSet; break; case FILTER_INTERNAL_SESSIONS: if (m_sFilter.bInternalSessions == bSet) return TRUE; m_sFilter.bInternalSessions = bSet; break; case FILTER_SYSTEM_LOCK_LISTS: if (m_sFilter.bSystemLockLists == bSet) return TRUE; m_sFilter.bSystemLockLists = bSet; break; case FILTER_INACTIVE_TRANSACTIONS: if (m_sFilter.bInactiveTransactions == bSet) return TRUE; m_sFilter.bInactiveTransactions = bSet; break; case FILTER_RESOURCE_TYPE: break; default: ASSERT(FALSE); return TRUE; } BOOL bOK = m_pTreeGD->FilterAllDisplayedItemsLists(nCause); if (bOK) { POSITION pos = GetFirstViewPosition(); while (pos != NULL) { CView* pView = GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(CvIpmLeft))) { UpdateAllViews(pView, (LPARAM)(int)nCause); // will only update right pane break; } } } return bOK; } catch (CeIpmException e) { AfxMessageBox (e.GetReason(), MB_ICONEXCLAMATION|MB_OK); } catch (...) { TRACE0("Exception in: CdIpmDoc::FilterChange\n"); } return FALSE; }