void UiPropertyGrid::CreateGrid() { //Add object properties m_component->GetPropertyList( m_propertyList ); SceneManager::PropertyList::PropIterator pIter( m_propertyList.GetProperties().begin() ); SceneManager::PropertyList::PropIterator pIterBeforeAdd( pIter ); for ( ; pIter != m_propertyList.GetProperties().end() ; pIter++) { AddElement( *pIter ); pIterBeforeAdd = pIter; } SceneManager::Object* object( dynamic_cast<SceneManager::Object*>(m_component) ); SceneManager::PointCloud* pointCloud (dynamic_cast<SceneManager::PointCloud*>(m_component)); if ( object && !pointCloud ) { //Add Lighting properties object->GetMaterial()->GetLightingPropertyList( m_propertyList ); pIter = ++pIterBeforeAdd; for ( ; pIter != m_propertyList.GetProperties().end() ; pIter++) { AddElement( *pIter,UI_LIGHTING_TECH_GROUP ); pIterBeforeAdd = pIter; } //Add Effects properties object->GetMaterial()->GetEffectPropertyList( m_propertyList ); pIter = ++pIterBeforeAdd; for ( ; pIter != m_propertyList.GetProperties().end() ; pIter++) { AddElement( *pIter,UI_EFFECTS_GROUP ); pIterBeforeAdd = pIter; } } }
void CFDE_TxtEdtParag::CalcLines() { CFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak(); CFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf(); int32_t nCount = 0; uint32_t dwBreakStatus = FX_TXTBREAK_None; int32_t nEndIndex = m_nCharStart + m_nCharCount; std::unique_ptr<IFX_CharIter> pIter( new CFDE_TxtEdtBuf::Iterator(static_cast<CFDE_TxtEdtBuf*>(pTxtBuf))); pIter->SetAt(m_nCharStart); bool bReload = false; do { if (bReload) { dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); } else { FX_WCHAR wAppend = pIter->GetChar(); dwBreakStatus = pTxtBreak->AppendChar(wAppend); } if (pIter->GetAt() + 1 == nEndIndex && dwBreakStatus < FX_TXTBREAK_LineBreak) { dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); } if (dwBreakStatus > FX_TXTBREAK_PieceBreak) { nCount++; pTxtBreak->ClearBreakPieces(); } if ((pIter->GetAt() + 1 == nEndIndex) && (dwBreakStatus == FX_TXTBREAK_LineBreak)) { bReload = true; pIter->Next(true); } } while (pIter->Next(false) && (pIter->GetAt() < nEndIndex)); pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); pTxtBreak->ClearBreakPieces(); m_nLineCount = nCount; }
int32_t CFDE_TxtEdtPage::SelectWord(const CFX_PointF& fPoint, int32_t& nCount) { if (m_nRefCount < 0) { return -1; } CFDE_TxtEdtBuf* pBuf = m_pEditEngine->GetTextBuf(); FX_BOOL bBefore; int32_t nIndex = GetCharIndex(fPoint, bBefore); if (nIndex == m_pEditEngine->GetTextBufLength()) { nIndex = m_pEditEngine->GetTextBufLength() - 1; } if (nIndex < 0) { return -1; } std::unique_ptr<CFX_WordBreak> pIter(new CFX_WordBreak); pIter->Attach(new CFDE_TxtEdtBufIter(pBuf)); pIter->SetAt(nIndex); nCount = pIter->GetWordLength(); return pIter->GetWordPos(); }
void CFDE_TxtEdtEngine::RebuildParagraphs() { RemoveAllParags(); FX_WCHAR wChar = L' '; int32_t nParagStart = 0; int32_t nIndex = 0; std::unique_ptr<IFX_CharIter> pIter(new CFDE_TxtEdtBufIter(m_pTxtBuf.get())); pIter->SetAt(0); do { wChar = pIter->GetChar(); nIndex = pIter->GetAt(); if (wChar == m_wLineEnd) { CFDE_TxtEdtParag* pParag = new CFDE_TxtEdtParag(this); pParag->SetStartIndex(nParagStart); pParag->SetTextLength(nIndex - nParagStart + 1); pParag->SetLineCount(-1); m_ParagPtrArray.Add(pParag); nParagStart = nIndex + 1; } } while (pIter->Next()); }
PatchMap<1>* Cartographer::buildAdjacencyMap(const UnitType *uType, const Vec2i &pos, CardinalDir facing, Field f, int size) { PF_TRACE(); const Vec2i mapPos = pos + (OrdinalOffsets[odNorthWest] * size); const int sx = pos.x; const int sy = pos.y; Rectangle rect(mapPos.x, mapPos.y, uType->getSize() + 2 + size, uType->getSize() + 2 + size); PatchMap<1> *pMap = new PatchMap<1>(rect, 0); pMap->zeroMap(); PatchMap<1> tmpMap(rect, 0); tmpMap.zeroMap(); // mark cells occupied by unitType at pos (on tmpMap) Util::RectIterator rIter(pos, pos + Vec2i(uType->getSize() - 1)); while (rIter.more()) { Vec2i gpos = rIter.next(); if (!uType->hasCellMap() || uType->getCellMapCell(gpos.x - sx, gpos.y - sy, facing)) { tmpMap.setInfluence(gpos, 1); } } // mark goal cells on result map rIter = Util::RectIterator(mapPos, pos + Vec2i(uType->getSize())); while (rIter.more()) { Vec2i gpos = rIter.next(); if (tmpMap.getInfluence(gpos) || !masterMap->canOccupy(gpos, size, f)) { continue; // building or obstacle } Util::PerimeterIterator pIter(gpos - Vec2i(1), gpos + Vec2i(size)); while (pIter.more()) { if (tmpMap.getInfluence(pIter.next())) { pMap->setInfluence(gpos, 1); break; } } } return pMap; }
void CFDE_TxtEdtParag::LoadParag() { if (m_lpData) { m_lpData[0]++; return; } CFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak(); CFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf(); const FDE_TXTEDTPARAMS* pParam = m_pEngine->GetEditParams(); FX_WCHAR wcAlias = 0; if (pParam->dwMode & FDE_TEXTEDITMODE_Password) { wcAlias = m_pEngine->GetAliasChar(); } std::unique_ptr<IFX_CharIter> pIter(new CFDE_TxtEdtBuf::Iterator( static_cast<CFDE_TxtEdtBuf*>(pTxtBuf), wcAlias)); pIter->SetAt(m_nCharStart); int32_t nEndIndex = m_nCharStart + m_nCharCount; CFX_ArrayTemplate<int32_t> LineBaseArr; bool bReload = false; uint32_t dwBreakStatus = FX_TXTBREAK_None; do { if (bReload) { dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); } else { FX_WCHAR wAppend = pIter->GetChar(); dwBreakStatus = pTxtBreak->AppendChar(wAppend); } if (pIter->GetAt() + 1 == nEndIndex && dwBreakStatus < FX_TXTBREAK_LineBreak) { dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); } if (dwBreakStatus > FX_TXTBREAK_PieceBreak) { int32_t nCount = pTxtBreak->CountBreakPieces(); int32_t nTotal = 0; for (int32_t j = 0; j < nCount; j++) { const CFX_TxtPiece* Piece = pTxtBreak->GetBreakPiece(j); nTotal += Piece->GetLength(); } LineBaseArr.Add(nTotal); pTxtBreak->ClearBreakPieces(); } if ((pIter->GetAt() + 1 == nEndIndex) && (dwBreakStatus == FX_TXTBREAK_LineBreak)) { bReload = true; pIter->Next(true); } } while (pIter->Next(false) && (pIter->GetAt() < nEndIndex)); pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); pTxtBreak->ClearBreakPieces(); int32_t nLineCount = LineBaseArr.GetSize(); m_nLineCount = nLineCount; if (m_lpData) { m_lpData = FX_Realloc(int32_t, m_lpData, nLineCount + 1); } else { m_lpData = FX_Alloc(int32_t, nLineCount + 1); } int32_t* pIntArr = m_lpData; pIntArr[0] = 1; m_nLineCount = nLineCount; pIntArr++; for (int32_t j = 0; j < nLineCount; j++, pIntArr++) { *pIntArr = LineBaseArr[j]; } LineBaseArr.RemoveAll(); }
int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, IFX_Pause* pPause) { if (m_nRefCount > 0) { m_nRefCount++; return m_nRefCount; } CFDE_TxtEdtBuf* pBuf = m_pEditEngine->GetTextBuf(); const FDE_TXTEDTPARAMS* pParams = m_pEditEngine->GetEditParams(); FX_WCHAR wcAlias = 0; if (pParams->dwMode & FDE_TEXTEDITMODE_Password) { wcAlias = m_pEditEngine->GetAliasChar(); } m_pIter.reset( new CFDE_TxtEdtBufIter(static_cast<CFDE_TxtEdtBuf*>(pBuf), wcAlias)); CFX_TxtBreak* pBreak = m_pEditEngine->GetTextBreak(); pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); pBreak->ClearBreakPieces(); int32_t nPageLineCount = m_pEditEngine->GetPageLineCount(); int32_t nStartLine = nPageLineCount * m_nPageIndex; int32_t nEndLine = std::min((nStartLine + nPageLineCount - 1), (m_pEditEngine->GetLineCount() - 1)); int32_t nPageStart, nPageEnd, nTemp, nBgnParag, nStartLineInParag, nEndParag, nEndLineInParag; nBgnParag = m_pEditEngine->Line2Parag(0, 0, nStartLine, nStartLineInParag); m_pBgnParag = static_cast<CFDE_TxtEdtParag*>(m_pEditEngine->GetParag(nBgnParag)); m_pBgnParag->LoadParag(); m_pBgnParag->GetLineRange(nStartLine - nStartLineInParag, nPageStart, nTemp); nEndParag = m_pEditEngine->Line2Parag(nBgnParag, nStartLineInParag, nEndLine, nEndLineInParag); m_pEndParag = static_cast<CFDE_TxtEdtParag*>(m_pEditEngine->GetParag(nEndParag)); m_pEndParag->LoadParag(); m_pEndParag->GetLineRange(nEndLine - nEndLineInParag, nPageEnd, nTemp); nPageEnd += (nTemp - 1); FX_BOOL bVertial = pParams->dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical; FX_BOOL bLineReserve = pParams->dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve; FX_FLOAT fLineStart = bVertial ? (bLineReserve ? (pParams->fPlateWidth - pParams->fLineSpace) : 0.0f) : 0.0f; FX_FLOAT fLineStep = (bVertial && bLineReserve) ? (-pParams->fLineSpace) : pParams->fLineSpace; FX_FLOAT fLinePos = fLineStart; if (!m_pTextSet) m_pTextSet = new CFDE_TxtEdtTextSet(this); m_PieceMassArr.RemoveAll(TRUE); uint32_t dwBreakStatus = FX_TXTBREAK_None; int32_t nPieceStart = 0; delete[] m_pCharWidth; m_pCharWidth = new int32_t[nPageEnd - nPageStart + 1]; pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); pBreak->ClearBreakPieces(); m_nPageStart = nPageStart; m_nCharCount = nPageEnd - nPageStart + 1; FX_BOOL bReload = FALSE; FX_FLOAT fDefCharWidth = 0; std::unique_ptr<IFX_CharIter> pIter(m_pIter->Clone()); pIter->SetAt(nPageStart); m_pIter->SetAt(nPageStart); FX_BOOL bFirstPiece = TRUE; do { if (bReload) { dwBreakStatus = pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); } else { FX_WCHAR wAppend = pIter->GetChar(); dwBreakStatus = pBreak->AppendChar(wAppend); } if (pIter->GetAt() == nPageEnd && dwBreakStatus < FX_TXTBREAK_LineBreak) { dwBreakStatus = pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); } if (dwBreakStatus > FX_TXTBREAK_PieceBreak) { int32_t nPieceCount = pBreak->CountBreakPieces(); for (int32_t j = 0; j < nPieceCount; j++) { const CFX_TxtPiece* pPiece = pBreak->GetBreakPiece(j); FDE_TEXTEDITPIECE TxtEdtPiece; FXSYS_memset(&TxtEdtPiece, 0, sizeof(FDE_TEXTEDITPIECE)); TxtEdtPiece.nBidiLevel = pPiece->m_iBidiLevel; TxtEdtPiece.nCount = pPiece->GetLength(); TxtEdtPiece.nStart = nPieceStart; TxtEdtPiece.dwCharStyles = pPiece->m_dwCharStyles; if (FX_IsOdd(pPiece->m_iBidiLevel)) { TxtEdtPiece.dwCharStyles |= FX_TXTCHARSTYLE_OddBidiLevel; } FX_FLOAT fParaBreakWidth = 0.0f; if (pPiece->m_dwStatus > FX_TXTBREAK_PieceBreak) { FX_WCHAR wRtChar = pParams->wLineBreakChar; if (TxtEdtPiece.nCount >= 2) { FX_WCHAR wChar = pBuf->GetCharByIndex( m_nPageStart + TxtEdtPiece.nStart + TxtEdtPiece.nCount - 1); FX_WCHAR wCharPre = pBuf->GetCharByIndex( m_nPageStart + TxtEdtPiece.nStart + TxtEdtPiece.nCount - 2); if (wChar == wRtChar) { fParaBreakWidth += fDefCharWidth; } if (wCharPre == wRtChar) { fParaBreakWidth += fDefCharWidth; } } else if (TxtEdtPiece.nCount >= 1) { FX_WCHAR wChar = pBuf->GetCharByIndex( m_nPageStart + TxtEdtPiece.nStart + TxtEdtPiece.nCount - 1); if (wChar == wRtChar) { fParaBreakWidth += fDefCharWidth; } } } if (pParams->dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) { TxtEdtPiece.rtPiece.left = fLinePos; TxtEdtPiece.rtPiece.top = (FX_FLOAT)pPiece->m_iStartPos / 20000.0f; TxtEdtPiece.rtPiece.width = pParams->fLineSpace; TxtEdtPiece.rtPiece.height = (FX_FLOAT)pPiece->m_iWidth / 20000.0f + fParaBreakWidth; } else { TxtEdtPiece.rtPiece.left = (FX_FLOAT)pPiece->m_iStartPos / 20000.0f; TxtEdtPiece.rtPiece.top = fLinePos; TxtEdtPiece.rtPiece.width = (FX_FLOAT)pPiece->m_iWidth / 20000.0f + fParaBreakWidth; TxtEdtPiece.rtPiece.height = pParams->fLineSpace; } if (bFirstPiece) { m_rtPageContents = TxtEdtPiece.rtPiece; bFirstPiece = FALSE; } else { m_rtPageContents.Union(TxtEdtPiece.rtPiece); } nPieceStart += TxtEdtPiece.nCount; m_PieceMassArr.Add(TxtEdtPiece); for (int32_t k = 0; k < TxtEdtPiece.nCount; k++) { CFX_Char* ptc = pPiece->GetCharPtr(k); m_pCharWidth[TxtEdtPiece.nStart + k] = ptc->m_iCharWidth; } } fLinePos += fLineStep; pBreak->ClearBreakPieces(); } if (pIter->GetAt() == nPageEnd && dwBreakStatus == FX_TXTBREAK_LineBreak) { bReload = TRUE; pIter->Next(TRUE); } } while (pIter->Next(FALSE) && (pIter->GetAt() <= nPageEnd)); if (m_rtPageContents.left != 0) { FX_FLOAT fDelta = 0.0f; if (m_rtPageContents.width < pParams->fPlateWidth) { if (pParams->dwAlignment & FDE_TEXTEDITALIGN_Right) { fDelta = pParams->fPlateWidth - m_rtPageContents.width; } else if (pParams->dwAlignment & FDE_TEXTEDITALIGN_Center) { if ((pParams->dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText) && m_nCharCount > 1) { int32_t nCount = m_nCharCount - 1; int32_t n = (m_pEditEngine->m_nLimit - nCount) / 2; fDelta = (m_rtPageContents.width / nCount) * n; } else { fDelta = (pParams->fPlateWidth - m_rtPageContents.width) / 2; } } } FX_FLOAT fOffset = m_rtPageContents.left - fDelta; int32_t nCount = m_PieceMassArr.GetSize(); for (int32_t i = 0; i < nCount; i++) { FDE_TEXTEDITPIECE* pPiece = m_PieceMassArr.GetPtrAt(i); pPiece->rtPiece.Offset(-fOffset, 0.0f); } m_rtPageContents.Offset(-fOffset, 0.0f); } if (m_pEditEngine->GetEditParams()->dwLayoutStyles & FDE_TEXTEDITLAYOUT_LastLineHeight) { m_rtPageContents.height -= pParams->fLineSpace - pParams->fFontSize; int32_t nCount = m_PieceMassArr.GetSize(); FDE_TEXTEDITPIECE* pPiece = m_PieceMassArr.GetPtrAt(nCount - 1); pPiece->rtPiece.height = pParams->fFontSize; } m_nRefCount = 1; m_bLoaded = TRUE; return 0; }
////////////////////////////////////////////////////////////////////////////////////////////////////// // Execute : // Drives the DebugDb mode of tripwire, which will only be used for internal use. ////////////////////////////////////////////////////////////////////////////////////////////////////// void cDbDebug::Execute( cFCODatabaseFileIter& dbIter, const TSTRING& dbFile ) { cDebug d("cDebugDb::Execute"); cDbDebug DbDebug; // //A derived class with extra methods for obtaining blockfile information. cDebugHierDb* db; // // Cast the database object that we have inherited from the "common" command line // information to a cDebugHierDb. This will expose all the information that we // need to debug the database. // db = static_cast<cDebugHierDb*>(&(dbIter.GetDb())); try { cDebugHierDbIter pIter( db ); // //First, map the state of the underlying quantyum database. Store this info. in //the hierDbMap. // DbDebug.MapQuantumDatabase( *db ); //DbDebug.DisplayDbMap(); //TODO : get rid of these display calls. // // Uncomment ManipDb() to allow manipulation of the database // This may be handy if one does not want to do a full update... //DbDebug.ManipDb( dbIter ); // Next, traverse the hierarchical overlay and "tag" all entries in the map that // we see: ASSERT( pIter.AtRoot() ); // // check to make sure we are at the root of the hierarchy, if so, map the root // before calling the recursive traversal function. // util_MapHierRoot( DbDebug.GetHierDbMap() ); DbDebug.TraverseHierarchy( pIter /*, db*/ ); //DbDebug.DisplayDbMap(); //TODO: get rid of these display calls. // // Finally, iterate over the map and see if there is any data that the hierarchy // does not account for: // DbDebug.CongruencyTest(); // // Output the results // DbDebug.OutputResults(); }//try catch( eError& e ) { cErrorReporter::PrintErrorMsg( e ); } }