void CMDITestDialog::OnIsquiescentButton() { AcApDocument *pDoc = acDocManager->curDocument(); if(pDoc) { CString tempStr; tempStr.Format("Current Doc is %s\nlockMode() returned %s\nand myLockMode() returned %s.", pDoc->isQuiescent() ? "Quiescent." : "NOT Quiescent.", modeStr(pDoc->lockMode()), modeStr(pDoc->myLockMode()) ); AfxMessageBox( tempStr ); } }
LRESULT CMDITestDialog::onAcadUpdateDialog( WPARAM, LPARAM ) { // update elements of the dialog to reflect the current // state of the documents // get the current number of documents m_staticDocNum.SetWindowText( getDocCount() ); // check/uncheck document activation m_activationCheck.SetCheck( acDocManager->isDocumentActivationEnabled() ); // set the current document fields CString fName; AcApDocument *pCurrDoc = acDocManager->curDocument(); if( pCurrDoc ) { fName = pCurrDoc->docTitle(); m_staticCurrentDoc.SetWindowText(fName); m_staticToBeCurrDoc.SetWindowText(fName); m_staticCurDocLockStatus.SetWindowText( modeStr(pCurrDoc->lockMode()) ); m_staticCurDocMyLockStatus.SetWindowText( modeStr(pCurrDoc->myLockMode()) ); } else { m_staticCurrentDoc.SetWindowText(fName); m_staticToBeCurrDoc.SetWindowText(""); m_staticCurDocLockStatus.SetWindowText(""); m_staticCurDocMyLockStatus.SetWindowText(""); } // set the active document data AcApDocument *pActDoc = acDocManager->mdiActiveDocument(); if( pActDoc ) { // active document name fName = pActDoc->docTitle(); m_staticActiveDoc.SetWindowText(fName); // active document lock modes m_staticActDocLockStatus.SetWindowText( modeStr(pActDoc->lockMode()) ); m_staticActDocMyLockStatus.SetWindowText( modeStr(pActDoc->myLockMode()) ); } else { m_staticActiveDoc.SetWindowText(""); m_staticActDocLockStatus.SetWindowText(""); m_staticActDocMyLockStatus.SetWindowText(""); } // rebuild listbox RebuildListBox(); return TRUE; }
void AsdkDocReactor::documentLockModeChanged(AcApDocument* pDoc, AcAp::DocLockMode myPrevMode, AcAp::DocLockMode myCurMode, AcAp::DocLockMode curMode, const char* pCommandName) { if(!pDoc) return; acutPrintf("%s %sLOCK %s CHANGED TO %s FOR %s\n", pDoc->fileName(), acDocManager->isApplicationContext() ? "APP " : "", modeStr(myPrevMode), modeStr(myCurMode), pCommandName); }
ifstream(const char* filename, ios_base::openmode mode = ios_base::in) : f(NULL) { string modeStr("r"); printf("Open file (read): %s\n", filename); if (mode & ios_base::binary) modeStr += "b"; f = fopen(filename, modeStr.c_str()); if (f == NULL) { printf("Can't open file: %s\n", filename); return; } fseek(f, 0, SEEK_END); size_t sz = ftell(f); if (sz > 0) { char* buf = (char*) malloc(sz); fseek(f, 0, SEEK_SET); if (fread(buf, 1, sz, f) == sz) { this->str(std::string(buf, sz)); } free(buf); } }
bool ContextClosest::handle_D() { bool strandError = false; if ((_i+1) < _argc) { _reportDistance = true; _signDistance = true; _haveStrandedDistMode = true; QuickString modeStr(_argv[_i + 1]); if (modeStr == "ref") { _strandedDistMode = REF_DIST; } else if (modeStr == "a") { _strandedDistMode = A_DIST; } else if (modeStr == "b") { _strandedDistMode = B_DIST; } else { strandError = true; } } else { strandError = true; } if (!strandError) { markUsed(_i - _skipFirstArgs); _i++; markUsed(_i - _skipFirstArgs); return true; } _errorMsg = "*****ERROR: -D option must be followed with \"ref\", \"a\", or \"b\""; return false; }
void AsdkDocToModReactor::documentLockModeWillChange(AcApDocument* pDoc, AcAp::DocLockMode myCurMode, AcAp::DocLockMode myNewMode, AcAp::DocLockMode currentMode, const char* pGlobalCmdName) { if(!pDoc) return; TRACE("#### Docman AsdkDocToModReactor::documentLockModeWillChange called (%s - from %s to %s)\n", pDoc ? pDoc->fileName() : "NULL", modeStr(myCurMode), modeStr(myNewMode) ); char *p = new char[20]; // this will be deleted on the dialog's side strcpy( p, modeStr(myNewMode) ); if( modelessDlg ) modelessDlg->SendMessage(WM_ACAD_LOCKMODWILLCHANGE, 0, (LONG)p ); }
void onDeliver() { if (m_pbValue == -1) m_pb->hide(); else { QString modeStr(m_pb->m_renderer->getMultimediaMode() == MultimediaRenderer::COLUMNS ? "column " : "layer "); m_pb->setLabelText( "Rendering " + modeStr + QString::number(m_column) + ", frame " + QString::number(m_frame) + "/" + m_labelText); m_pb->setValue(m_pbValue); } }
void open(const char* filename, ios_base::openmode mode = ios_base::out) { string modeStr("w+"); if (mode & ios_base::trunc) modeStr = "w"; if (mode & ios_base::binary) modeStr += "b"; f = fopen(filename, modeStr.c_str()); printf("Open file (write): %s\n", filename); if (f == NULL) { printf("Can't open file (write): %s\n", filename); return; } }