//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTextureBrowser::OnUsed() { if(!GetActiveWorld()) return; SetUsed(m_cUsed.GetCheck()); }
//----------------------------------------------------------------------------- // Purpose: Invokes the replace texture dialog. //----------------------------------------------------------------------------- void CTextureBrowser::OnReplace(void) { CMapDoc *pDoc = CMapDoc::GetActiveMapDoc(); if(!pDoc) return; CReplaceTexDlg dlg(pDoc->GetSelection()->GetCount()); dlg.m_strFind = m_cTextureWindow.szCurTexture; if(dlg.DoModal() != IDOK) return; // mark undo position GetHistory()->MarkUndoPosition(pDoc->GetSelection()->GetList(), "Replace Textures"); if(dlg.m_bMarkOnly) { pDoc->SelectObject(NULL, scClear); // clear selection first } dlg.DoReplaceTextures(); //EndDialog(IDOK); if (m_bUsed) { SetUsed(TRUE); } }
POINTER GetSetMemberEx( GENERICSET **pSet, INDEX nMember, int setsize, int unitsize, int maxcnt DBG_PASS ) { POINTER result; int bUsed; if( nMember == INVALID_INDEX ) return NULL; //if( nMember > 1000 ) // DebugBreak(); result = GetSetMemberExx( pSet, nMember, setsize, unitsize, maxcnt, &bUsed DBG_RELAY ); if( !bUsed ) SetUsed( *pSet, nMember ); return result; }
bool UserDefinedEncodings::Get(uint16 unicode, uint8 &encoding, uint8 &index) { bool missing = !IsUsed(unicode); if (missing) { SetUsed(unicode); fEncoding[unicode] = fCurrentEncoding; fIndex[unicode] = fCurrentIndex; if (fCurrentIndex == 255) { fCurrentIndex = 0; fCurrentEncoding ++; } else { fCurrentIndex ++; } } encoding = fEncoding[unicode]; index = fIndex[unicode]; return missing; }
MonthCell::MonthCell(int CellNum,BRect frame,int DayOfMonth,bool isCellUsed):BView(frame,"noname",B_FOLLOW_ALL_SIDES,B_WILL_DRAW|B_FULL_UPDATE_ON_RESIZE|B_FRAME_EVENTS){ myCellNum = CellNum; mDay = DayOfMonth; isToday = false; listView = 0; isUsed = isCellUsed; mCalendarView = (BHandler*)Global::calendarView(); char buffer[3]; /*contains DayOfMonth in a string*/ snprintf(buffer,3,"%d",DayOfMonth); /* setup the listview */ BRect listViewRect = Bounds(); listView = new EventListView(myCellNum,listViewRect,"name"); listView->SetInvocationMessage(new BMessage(EVENT_EDITOR)); AddChild(listView); /* setup the topItem , the reserved first item in the listView, users click on this to create a new event */ topItem = new EventListItem(BString(""),buffer,0); listView->AddItem(topItem,0); /* Setup first item in listview */ SetUsed(isUsed); SetDate(DayOfMonth); listView->SetTarget((BHandler*)mCalendarView); listView->SetFontSize(11); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- BOOL CTextureBrowser::OnInitDialog() { CDialog::OnInitDialog(); // Iterate all the active textures for debugging. //int nCount = g_Textures.GetActiveTextureCount(); //for (int nTexture = 0; nTexture < nCount; nTexture++) //{ // IEditorTexture *pTexture = g_Textures.GetActiveTexture(nTexture); // const char *pszName = pTexture->GetName(); // DBG("%d: %s\n", nTexture, pszName); //} m_cSizeList.SubclassDlgItem(IDC_TEXTURESIZE, this); m_cFilter.SubclassDlgItem(IDC_FILTER, this); m_cKeywords.SubclassDlgItem(IDC_KEYWORDS, this); m_cCurName.SubclassDlgItem(IDC_CURNAME, this); m_cCurDescription.SubclassDlgItem(IDC_CURDESCRIPTION, this); m_cUsed.SubclassDlgItem(IDC_USED, this); m_FilterOpaque.SubclassDlgItem(IDC_FILTER_OPAQUE, this); m_FilterTranslucent.SubclassDlgItem(IDC_FILTER_TRANSLUCENT, this); m_FilterSelfIllum.SubclassDlgItem(IDC_FILTER_SELFILLUM, this); m_FilterEnvMask.SubclassDlgItem(IDC_FILTER_ENVMASK, this); m_ShowErrors.SubclassDlgItem(IDC_SHOW_ERROR, this); m_FilterOpaque.SetCheck( true ); m_FilterTranslucent.SetCheck( true ); m_FilterSelfIllum.SetCheck( true ); m_FilterEnvMask.SetCheck( true ); m_ShowErrors.SetCheck( true ); // // Create CTextureWindow that takes up area of dummy control. // RECT r; GetDlgItem(IDC_BROWSERDUMMY)->GetClientRect(&r); m_cTextureWindow.Create(this, r); // Show everything initially m_cTextureWindow.SetTypeFilter( ~0, true ); // // Add latest history to the filter combo. // for (int i = 0; i < m_nFilterHistory; i++) { m_cFilter.AddString(m_FilterHistory[i]); } // // Set the name filter unless one was explicitly specified. // if (m_szNameFilter[0] == '\0') { // // No name filter specified. Use whatever is on top of the history. // if (m_cFilter.GetCount() > 0) { m_cFilter.GetLBText(0, m_szNameFilter); m_cFilter.SetCurSel(0); } } m_cFilter.SetWindowText(m_szNameFilter); m_cTextureWindow.SetNameFilter(m_szNameFilter); // // Done with the name filter; clear it for next time. // m_szNameFilter[0] = '\0'; // Add the global list of keywords to the keywords combo. for( int i=0; i< g_Textures.GetNumKeywords(); i++ ) { m_cKeywords.AddString( g_Textures.GetKeyword(i) ); } // // Set the keyword filter. // m_cKeywords.SetWindowText(m_szLastKeywords); m_cTextureWindow.SetKeywords(m_szLastKeywords); m_cUsed.SetCheck(m_bUsed); // Refresh the list of used textures if enabled. if (m_bUsed) { SetUsed(TRUE); } CWinApp *pApp = AfxGetApp(); CString str = pApp->GetProfileString(pszIniSection, "Position"); if (!str.IsEmpty()) { CRect r; sscanf(str, "%d %d %d %d", &r.left, &r.top, &r.right, &r.bottom); if (r.left < 0) { ShowWindow(SW_SHOWMAXIMIZED); } else { MoveWindow(r.left, r.top, r.right-r.left, r.bottom-r.top, FALSE); } } int iSize = pApp->GetProfileInt(pszIniSection, "ShowSize", 0); m_cSizeList.SetCurSel(iSize); OnSelendokTexturesize(); if (szInitialTexture[0]) { m_cTextureWindow.SelectTexture(szInitialTexture); } m_cTextureWindow.ShowWindow(SW_SHOW); SetTimer(1, 500, NULL); m_cFilter.SetFocus(); return(FALSE); }
int NFCRecord::AddRow(const int nRow, const NFDataList& var) { bool bCover = false; int nFindRow = nRow; if (nFindRow >= mnMaxRow) { return -1; } if (var.GetCount() != GetCols()) { return -1; } if (nFindRow < 0) { for (int i = 0; i < mnMaxRow; i++) { if (!IsUsed(i)) { nFindRow = i; break; } } } else { if (IsUsed(nFindRow)) { bCover = true; } } if (nFindRow < 0) { return -1; } for (int i = 0; i < GetCols(); ++i) { if (var.Type(i) != GetColType(i)) { return -1; } } SetUsed(nFindRow, 1); for (int i = 0; i < GetCols(); ++i) { NF_SHARE_PTR<NFData>& pVar = mtRecordVec.at(GetPos(nFindRow, i)); if (nullptr == pVar) { pVar = NF_SHARE_PTR<NFData>(NF_NEW NFData(var.Type(i))); } pVar->variantData = var.GetStack(i)->variantData; } RECORD_EVENT_DATA xEventData; xEventData.nOpType = bCover? RECORD_EVENT_DATA::Cover : RECORD_EVENT_DATA::Add; xEventData.nRow = nFindRow; xEventData.nCol = 0; xEventData.strRecordName = mstrRecordName; NFData tData; OnEventHandler(mSelf, xEventData, tData, tData); //FIXME:RECORD return nFindRow; }
ULONG CmpCheckValueList( PHHIVE Hive, PCELL_DATA List, ULONG Count ) /*++ Routine Description: Check consistency of a value list. . Each element allocated? . Each element have valid signature? . Data properly allocated? Arguments: Hive - containing Hive. List - pointer to an array of HCELL_INDEX entries. Count - number of entries in list. Return Value: 0 if Hive is OK. Error return indicator if not. RANGE: 5000 - 5999 --*/ { ULONG i; HCELL_INDEX Cell; PCELL_DATA pcell; ULONG size; ULONG usedlen; ULONG DataLength; HCELL_INDEX Data; ULONG rc = 0; CmpCheckValueListDebug.Hive = Hive; CmpCheckValueListDebug.Status = 0; CmpCheckValueListDebug.List = List; CmpCheckValueListDebug.Index = (ULONG)-1; CmpCheckValueListDebug.Cell = 0; // NOT HCELL_NIL CmpCheckValueListDebug.CellPoint = NULL; for (i = 0; i < Count; i++) { // // Check out value entry's refs. // Cell = List->u.KeyList[i]; if (Cell == HCELL_NIL) { KdPrint(("CmpCheckValueList: List:%08lx i:%08lx\n", List, i)); KdPrint(("\tEntry is null\n")); rc = 5010; CmpCheckValueListDebug.Status = rc; CmpCheckValueListDebug.Index = i; CmpCheckValueListDebug.Cell = Cell; return rc; } if (HvIsCellAllocated(Hive, Cell) == FALSE) { KdPrint(("CmpCheckValueList: List:%08lx i:%08lx\n", List, i)); KdPrint(("\tEntry is not allocated\n")); rc = 5020; CmpCheckValueListDebug.Status = rc; CmpCheckValueListDebug.Index = i; CmpCheckValueListDebug.Cell = Cell; return rc; } else { SetUsed(Hive, Cell); } // // Check out the value entry itself // pcell = HvGetCell(Hive, Cell); size = HvGetCellSize(Hive, pcell); if (pcell->u.KeyValue.Signature != CM_KEY_VALUE_SIGNATURE) { KdPrint(("CmpCheckValueList: List:%08lx i:%08lx\n", List, i)); KdPrint(("\tCell:%08lx - invalid value signature\n", Cell)); rc = 5030; CmpCheckValueListDebug.Status = rc; CmpCheckValueListDebug.Index = i; CmpCheckValueListDebug.Cell = Cell; CmpCheckValueListDebug.CellPoint = pcell; return rc; } usedlen = FIELD_OFFSET(CM_KEY_VALUE, Name) + pcell->u.KeyValue.NameLength; if (usedlen > size) { KdPrint(("CmpCheckValueList: List:%08lx i:%08lx\n", List, i)); KdPrint(("\tCell:%08lx - value bigger than containing cell\n", Cell)); rc = 5040; CmpCheckValueListDebug.Status = rc; CmpCheckValueListDebug.Index = i; CmpCheckValueListDebug.Cell = Cell; CmpCheckValueListDebug.CellPoint = pcell; return rc; } // // Check out value entry's data // DataLength = pcell->u.KeyValue.DataLength; if (DataLength < CM_KEY_VALUE_SPECIAL_SIZE) { Data = pcell->u.KeyValue.Data; if ((DataLength == 0) && (Data != HCELL_NIL)) { KdPrint(("CmpCheckValueList: List:%08lx i:%08lx\n", List, i)); KdPrint(("\tCell:%08lx Data:%08lx - data not null\n", Cell, Data)); rc = 5050; CmpCheckValueListDebug.Status = rc; CmpCheckValueListDebug.Index = i; CmpCheckValueListDebug.Cell = Cell; CmpCheckValueListDebug.CellPoint = pcell; return rc; } if (DataLength > 0) { if (HvIsCellAllocated(Hive, Data) == FALSE) { KdPrint(("CmpCheckValueList: List:%08lx i:%08lx\n", List, i)); KdPrint(("\tCell:%08lx Data:%08lx - unallocated\n", Cell, Data)); rc = 5060; CmpCheckValueListDebug.Status = rc; CmpCheckValueListDebug.Index = i; CmpCheckValueListDebug.Cell = Cell; CmpCheckValueListDebug.CellPoint = pcell; return rc; } else { SetUsed(Hive, Data); } } } } return rc; }
ULONG CmpCheckKey( HCELL_INDEX Cell, HCELL_INDEX ParentCell ) /*++ Routine Description: Check consistency of the registry, for a particular cell . Check that the cell's value list, child key list, class, security are OK. . Check that each value entry IN the list is OK. Globals: CmpCheckHive - hive we're working on CmpCheckClean - flag TRUE -> clean off volatiles, FALSE -> don't Arguments: Cell - HCELL_INDEX of subkey to work on. ParentCell - expected value of parent cell for Cell, unless HCELL_NIL, in which case ignore. Return Value: 0 if Hive is OK. Error return indicator if not. RANGE: 4000 - 4999 --*/ { PCELL_DATA pcell; ULONG size; ULONG usedlen; ULONG ClassLength; HCELL_INDEX Class; ULONG ValueCount; HCELL_INDEX ValueList; HCELL_INDEX Security; ULONG rc = 0; ULONG nrc = 0; ULONG i; PCM_KEY_INDEX Root; PCM_KEY_INDEX Leaf; ULONG SubCount; CmpCheckKeyDebug.Hive = CmpCheckHive; CmpCheckKeyDebug.Status = 0; CmpCheckKeyDebug.Cell = Cell; CmpCheckKeyDebug.CellPoint = NULL; CmpCheckKeyDebug.RootPoint = NULL; CmpCheckKeyDebug.Index = (ULONG)-1; // // Check key itself // if (! HvIsCellAllocated(CmpCheckHive, Cell)) { KdPrint(("CmpCheckKey: CmpCheckHive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); KdPrint(("\tNot allocated\n")); rc = 4010; CmpCheckKeyDebug.Status = rc; return rc; } pcell = HvGetCell(CmpCheckHive, Cell); SetUsed(CmpCheckHive, Cell); CmpCheckKeyDebug.CellPoint = pcell; size = HvGetCellSize(CmpCheckHive, pcell); if (size > REG_MAX_PLAUSIBLE_KEY_SIZE) { KdPrint(("CmpCheckKey: CmpCheckHive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); KdPrint(("\tImplausible size %lx\n", size)); rc = 4020; CmpCheckKeyDebug.Status = rc; return rc; } usedlen = FIELD_OFFSET(CM_KEY_NODE, Name) + pcell->u.KeyNode.NameLength; if (usedlen > size) { KdPrint(("CmpCheckKey: CmpCheckHive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); KdPrint(("\tKey is bigger than containing cell.\n")); rc = 4030; CmpCheckKeyDebug.Status = rc; return rc; } if (pcell->u.KeyNode.Signature != CM_KEY_NODE_SIGNATURE) { KdPrint(("CmpCheckKey: CmpCheckHive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); KdPrint(("\tNo key signature\n")); rc = 4040; CmpCheckKeyDebug.Status = rc; return rc; } if (ParentCell != HCELL_NIL) { if (pcell->u.KeyNode.Parent != ParentCell) { KdPrint(("CmpCheckKey: CmpCheckHive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); KdPrint(("\tWrong parent value.\n")); rc = 4045; CmpCheckKeyDebug.Status = rc; return rc; } } ClassLength = pcell->u.KeyNode.ClassLength; Class = pcell->u.KeyNode.Class; ValueCount = pcell->u.KeyNode.ValueList.Count; ValueList = pcell->u.KeyNode.ValueList.List; Security = pcell->u.KeyNode.Security; // // Check simple non-empty cases // if (ClassLength > 0) { if( Class == HCELL_NIL ) { pcell->u.KeyNode.ClassLength = 0; HvMarkCellDirty(CmpCheckHive, Cell); KdPrint(("CmpCheckKey: CmpCheckHive:%08lx Cell:%08lx has ClassLength = %lu and Class == HCELL_NIL\n", CmpCheckHive, Cell,ClassLength)); } else { if (HvIsCellAllocated(CmpCheckHive, Class) == FALSE) { KdPrint(("CmpCheckKey: CmpCheckHive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); KdPrint(("\tClass:%08lx - unallocated class\n", Class)); rc = 4080; CmpCheckKeyDebug.Status = rc; return rc; } else { SetUsed(CmpCheckHive, Class); } } } if (Security != HCELL_NIL) { if (HvIsCellAllocated(CmpCheckHive, Security) == FALSE) { KdPrint(("CmpCheckKey: CmpCheckHive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); KdPrint(("\tSecurity:%08lx - unallocated security\n", Security)); rc = 4090; CmpCheckKeyDebug.Status = rc; return rc; } else if (HvGetCellType(Security) == Volatile) { SetUsed(CmpCheckHive, Security); } // // Else CmpValidateHiveSecurityDescriptors must do computation // } // // Check value list case // if (ValueCount > 0) { if (HvIsCellAllocated(CmpCheckHive, ValueList) == FALSE) { KdPrint(("CmpCheckKey: CmpCheckHive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); KdPrint(("\tValueList:%08lx - unallocated valuelist\n", ValueList)); rc = 4100; CmpCheckKeyDebug.Status = rc; return rc; } else { SetUsed(CmpCheckHive, ValueList); pcell = HvGetCell(CmpCheckHive, ValueList); nrc = CmpCheckValueList(CmpCheckHive, pcell, ValueCount); if (nrc != 0) { KdPrint(("List was for CmpCheckHive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); rc = nrc; CmpCheckKeyDebug.CellPoint = pcell; CmpCheckKeyDebug.Status = rc; return rc; } } } // // Check subkey list case // pcell = HvGetCell(CmpCheckHive, Cell); CmpCheckKeyDebug.CellPoint = pcell; if ((HvGetCellType(Cell) == Volatile) && (pcell->u.KeyNode.SubKeyCounts[Stable] != 0)) { KdPrint(("CmpCheckKey: CmpCheckHive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); KdPrint(("\tVolatile Cell has Stable children\n")); rc = 4108; CmpCheckKeyDebug.Status = rc; return rc; } else if (pcell->u.KeyNode.SubKeyCounts[Stable] > 0) { if (! HvIsCellAllocated(CmpCheckHive, pcell->u.KeyNode.SubKeyLists[Stable])) { KdPrint(("CmpCheckKey: CmpCheckHive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); KdPrint(("\tStableKeyList:%08lx - unallocated\n", pcell->u.KeyNode.SubKeyLists[Stable])); rc = 4110; CmpCheckKeyDebug.Status = rc; return rc; } else { SetUsed(CmpCheckHive, pcell->u.KeyNode.SubKeyLists[Stable]); // // Prove that the index is OK // Root = (PCM_KEY_INDEX)HvGetCell( CmpCheckHive, pcell->u.KeyNode.SubKeyLists[Stable] ); CmpCheckKeyDebug.RootPoint = Root; if ((Root->Signature == CM_KEY_INDEX_LEAF) || (Root->Signature == CM_KEY_FAST_LEAF)) { if ((ULONG)Root->Count != pcell->u.KeyNode.SubKeyCounts[Stable]) { KdPrint(("CmpCheckKey: CmpCheckHive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); KdPrint(("\tBad Index count @%08lx\n", Root)); rc = 4120; CmpCheckKeyDebug.Status = rc; return rc; } } else if (Root->Signature == CM_KEY_INDEX_ROOT) { SubCount = 0; for (i = 0; i < Root->Count; i++) { CmpCheckKeyDebug.Index = i; if (! HvIsCellAllocated(CmpCheckHive, Root->List[i])) { KdPrint(("CmpCheckKey: Hive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); KdPrint(("\tBad Leaf Cell %08lx Root@%08lx\n", Root->List[i], Root)); rc = 4130; CmpCheckKeyDebug.Status = rc; return rc; } Leaf = (PCM_KEY_INDEX)HvGetCell(CmpCheckHive, Root->List[i]); if ((Leaf->Signature != CM_KEY_INDEX_LEAF) && (Leaf->Signature != CM_KEY_FAST_LEAF)) { KdPrint(("CmpCheckKey: CmpCheckHive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); KdPrint(("\tBad Leaf Index @%08lx Root@%08lx\n", Leaf, Root)); rc = 4140; CmpCheckKeyDebug.Status = rc; return rc; } SetUsed(CmpCheckHive, Root->List[i]); SubCount += Leaf->Count; } if (pcell->u.KeyNode.SubKeyCounts[Stable] != SubCount) { KdPrint(("CmpCheckKey: CmpCheckHive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); KdPrint(("\tBad count in index, SubCount=%08lx\n", SubCount)); rc = 4150; CmpCheckKeyDebug.Status = rc; return rc; } } else { KdPrint(("CmpCheckKey: CmpCheckHive:%08lx Cell:%08lx\n", CmpCheckHive, Cell)); KdPrint(("\tBad Root index signature @%08lx\n", Root)); rc = 4120; CmpCheckKeyDebug.Status = rc; return rc; } } } // // force volatiles to be empty, if this is a load operation // if (CmpCheckClean == TRUE) { pcell->u.KeyNode.SubKeyCounts[Volatile] = 0; pcell->u.KeyNode.SubKeyLists[Volatile] = HCELL_NIL; } return rc; }