status_t ChannelMenuItem::Invoke(BMessage* message) { if (IsMarked()) return B_OK; return BMenuItem::Invoke(message); }
void ColorMenuItem::Draw /*Content*/() { float w, h; BPoint p; BMenu *m = Menu(); if (m == NULL) return; p = ContentLocation(); GetContentSize(&w, &h); rgb_color c = color; if (!IsEnabled()) { c.green = c.blue = c.red = (uint8) (0.4 * c.red + 0.2 * c.blue + 0.4 * c.green); } m->SetHighColor(c); m->FillRect(BRect(p.x+2, p.y+2, p.x+w-2, p.y+h-2)); if (IsMarked()) { rgb_color blue={0, 0, 255, 255}; m->SetHighColor(blue); m->StrokeRect(BRect(p.x, p.y, p.x+w, p.y+h)); } if (IsSelected()) { rgb_color red={0, 0, 255, 255}; m->SetHighColor(red); m->StrokeRect(BRect(p.x, p.y, p.x+w, p.y+h)); } }
/*-------------------------------------- * Function: SolveMaze() * Parameters: pt Den punkt utifrån vilken vi vill lösa labyrinten. * num_calls Räknare för antal anrop. * unmark Indikerar huruvida UnmarkSquare()-funktionen ska * anropas. * * Description: * Löser labyrinten (om möjligt) och räknar antalet anrop. *------------------------------------*/ static bool SolveMaze(pointT pt, int* num_calls, bool unmark) { ++(*num_calls); if (OutsideMaze(pt)) return TRUE; if (IsMarked(pt)) return FALSE; MarkSquare(pt); for (directionT dir = North; dir <= West; dir++) { // Om det är en vägg ivägen går vi vidare till nästa riktning. if (WallExists(pt, dir)) continue; if (SolveMaze(AdjacentPoint(pt, dir), num_calls, unmark)) { // Vi måste avmarkera även här så att inte lösningen ligger kvar // som markerad i labyrinten. if (unmark) UnmarkSquare(pt); return TRUE; } } if (unmark) UnmarkSquare(pt); return FALSE; }
void BombsGame::Mark(int x, int y) { m_field[x+y*m_width] ^= BG_MARKED; if (IsMarked(x, y)) m_numMarkedCells++; else m_numMarkedCells--; }
int EList::UnmarkAll() { NeedsRedraw = 1; for (int i = 0; i < Count; i++) { if (IsMarked(i)) if (Unmark(i) != 1) return ErFAIL; } return ErOK; }
bool cMenuFileBrowserBase::AllIsMarked() const { for (int i= 0; i < Count(); i++) { if(IsMarked(GetItem(i))) return false; } return true; }
bool cMenuFileBrowserBase::AllFilesAreMarked(bool onlyXinePlayable) const { for (int i= 0; i < Count(); i++) { if(GetItem(i)->IsFile() && !IsMarked(GetItem(i)) && (!onlyXinePlayable || static_cast<cMenuFileItem *>(GetItem(i))->IsXinePlayable())) return false; } return true; }
/////////////////////////////////////////////////////////////////////////////////////////// // MarkTriangle() // // Marks the face with the current strip ID // inline void NvStripInfo::MarkTriangle(NvFaceInfo *faceInfo){ assert(!IsMarked(faceInfo)); if (IsExperiment()){ faceInfo->m_experimentId = m_experimentId; faceInfo->m_testStripId = m_stripId; } else{ assert(faceInfo->m_stripId == -1); faceInfo->m_experimentId = -1; faceInfo->m_stripId = m_stripId; } }
void cMenuFileBrowserBase::ClearAllFileMarks(bool onlyXinePlayable) { for (int i = 0; i < Count(); i++) { cMenuBrowserItem *item = GetItem(i); if(item->IsFile() && IsMarked(item) && (!onlyXinePlayable || static_cast<cMenuFileItem *>(item)->IsXinePlayable())) { RemoveMark(item, false); } } Display(); }
bool cMenuFileBrowserBase::HasUnMarkedOrUnFlaggedFileItems(bool onlyXinePlayable) const { for (int i = 0; i < Count(); i++) { cMenuBrowserItem *item = GetItem(i); if(item->IsFile() && !IsMarked(item) && !IsFlagged(item) && (!onlyXinePlayable || static_cast<cMenuFileItem *>(item)->IsXinePlayable())) { return true; } } return false; }
void cMenuFileBrowserBase::MarkAllFiles(bool onlyXinePlayable) { cMenuBrowserItem* item; for (int i= 0; i < Count(); i++) { item = GetItem(i); SetCurrent(Get(i)); if(item->IsFile() && !IsMarked(item) && (!onlyXinePlayable || static_cast<cMenuFileItem *>(item)->IsXinePlayable())) { MarkItem(item); } } }
BOOL COXNotesEditView::ShowBookmark(UINT nChar) { if (IsMarked(nChar)) { UINT nLine=GetEditCtrl().LineFromChar(nChar); UINT nFirstVisible=GetEditCtrl().GetFirstVisibleLine(); UINT nLastVisible=GetLastVisibleLine(); if (nFirstVisible>nLine || nLastVisible<nLine) GetEditCtrl().LineScroll(nLine-nFirstVisible); return TRUE; } else return FALSE; }
void COXNotesEditView::OnLButtonDblClk(UINT nFlags, CPoint point) { CRect rct; GetNotesRect(&rct); if (rct.PtInRect(point)) { int n=HIWORD(GetEditCtrl().CharFromPos(point)); int nChar=GetEditCtrl().LineIndex(n); if (IsMarked(nChar)) RemoveBookmarks(nChar,nChar); else SetBookmark(nChar); } CEditView::OnLButtonDblClk(nFlags, point); }
int EList::ToggleMark() { if (Count > 0) { if (IsMarked(Row)) { if (Unmark(Row) == 1) { NeedsRedraw = 1; return ErOK; } } else { if (Mark(Row) == 1) { NeedsRedraw = 1; return ErOK; } } } return ErFAIL; }
bool SolveMaze(pointT pt) { if (OutsideMaze(pt)) return true; if (IsMarked(pt)) return false; MarkSquare(pt); for (directionT dir = North; dir <= West; dir=directionT(dir + 1)) { if (!WallExists(pt, dir) && SolveMaze(AdjacentPoint(pt, dir))) { return true; } } UnmarkSquare(pt); return false; }
bool CCachedLogInfo::CCacheFileManager::ShouldDrop ( const TFileName& name , int maxFailures) { // no mark -> no crash -> no drop here if (!IsMarked (name)) { failureCount = NO_FAILURE; return false; } // can we open it? // If not, somebody else owns the lock -> don't touch it. HANDLE tempHandle = CreateFile ( name.c_str() , GENERIC_READ , 0 , 0 , OPEN_ALWAYS , FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_NOT_CONTENT_INDEXED , NULL); if (tempHandle == INVALID_HANDLE_VALUE) return false; try { // any failure count so far? CFile file (tempHandle); if (file.GetLength() != 0) { CArchive stream (&file, CArchive::load); stream >> failureCount; } else { failureCount = 0; } // too many of them? CloseHandle (tempHandle); return failureCount >= maxFailures; }
void cMenuFileBrowserBase::MarkUnmarkCurrentItem() { cMenuBrowserItem *item = GetCurrentItem(); if (item && (item->IsFile() || item->IsDir())) { if(!IsMarked(GetCurrentItem())) { //select line MarkItem(GetCurrentItem()); } else { //deselect line RemoveMark(GetCurrentItem()); } Display(); } }
void StorageBase::Delete() { // avoid double deletion if (IsMarked()) return; SetManaged(true); // remove from all containers DetachFromContainers(); // remove from parent StorageBase *parent = GetParentBasePtr(); if (parent != 0) parent->Remove(GetLabel()); // set this and all referent objects to be white, and mark it for deletion. SetColorRecursive(ObjectColor::White); SetMarked(true); }
void _SetMarked(bool marked, bool updateBlacklist) { if (marked == IsMarked()) return; // For directories toggle the availability of the submenu. if (IsDirectoryItem()) SetSubmenu(marked ? NULL : fSubMenu); if (updateBlacklist) { BlacklistedPath path; if (GetPath(path)) { if (marked) sPathBlacklist->Add(path.Path()); else sPathBlacklist->Remove(path.Path()); } } MenuItem::SetMarked(marked); }
/////////////////////////////////////////////////////////////////////////////////////////// // Build() // // Builds a strip forward as far as we can go, then builds backwards, and joins the two lists // void NvStripInfo::Build(NvEdgeInfoVec &edgeInfos, NvFaceInfoVec &faceInfos) { // used in building the strips forward and backward WordVec scratchIndices; // build forward... start with the initial face NvFaceInfoVec forwardFaces, backwardFaces; forwardFaces.push_back(m_startInfo.m_startFace); MarkTriangle(m_startInfo.m_startFace); int v0 = (m_startInfo.m_toV1 ? m_startInfo.m_startEdge->m_v0 : m_startInfo.m_startEdge->m_v1); int v1 = (m_startInfo.m_toV1 ? m_startInfo.m_startEdge->m_v1 : m_startInfo.m_startEdge->m_v0); // easiest way to get v2 is to use this function which requires the // other indices to already be in the list. scratchIndices.push_back(v0); scratchIndices.push_back(v1); int v2 = NvStripifier::GetNextIndex(scratchIndices, m_startInfo.m_startFace); scratchIndices.push_back(v2); // // build the forward list // int nv0 = v1; int nv1 = v2; NvFaceInfo *nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, m_startInfo.m_startFace); while (nextFace != NULL && !IsMarked(nextFace)) { //check to see if this next face is going to cause us to die soon int testnv0 = nv1; int testnv1 = NvStripifier::GetNextIndex(scratchIndices, nextFace); NvFaceInfo* nextNextFace = NvStripifier::FindOtherFace(edgeInfos, testnv0, testnv1, nextFace); if( (nextNextFace == NULL) || (IsMarked(nextNextFace)) ) { //uh, oh, we're following a dead end, try swapping NvFaceInfo* testNextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, testnv1, nextFace); if( ((testNextFace != NULL) && !IsMarked(testNextFace)) ) { //we only swap if it buys us something //add a "fake" degenerate face NvFaceInfo* tempFace = new NvFaceInfo(nv0, nv1, nv0, true); forwardFaces.push_back(tempFace); MarkTriangle(tempFace); scratchIndices.push_back(nv0); testnv0 = nv0; ++m_numDegenerates; } } // add this to the strip forwardFaces.push_back(nextFace); MarkTriangle(nextFace); // add the index //nv0 = nv1; //nv1 = NvStripifier::GetNextIndex(scratchIndices, nextFace); scratchIndices.push_back(testnv1); // and get the next face nv0 = testnv0; nv1 = testnv1; nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, nextFace); } // tempAllFaces is going to be forwardFaces + backwardFaces // it's used for Unique() NvFaceInfoVec tempAllFaces; for(size_t i = 0; i < forwardFaces.size(); i++) tempAllFaces.push_back(forwardFaces[i]); // // reset the indices for building the strip backwards and do so // scratchIndices.resize(0); scratchIndices.push_back(v2); scratchIndices.push_back(v1); scratchIndices.push_back(v0); nv0 = v1; nv1 = v0; nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, m_startInfo.m_startFace); while (nextFace != NULL && !IsMarked(nextFace)) { //this tests to see if a face is "unique", meaning that its vertices aren't already in the list // so, strips which "wrap-around" are not allowed if(!Unique(tempAllFaces, nextFace)) break; //check to see if this next face is going to cause us to die soon int testnv0 = nv1; int testnv1 = NvStripifier::GetNextIndex(scratchIndices, nextFace); NvFaceInfo* nextNextFace = NvStripifier::FindOtherFace(edgeInfos, testnv0, testnv1, nextFace); if( (nextNextFace == NULL) || (IsMarked(nextNextFace)) ) { //uh, oh, we're following a dead end, try swapping NvFaceInfo* testNextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, testnv1, nextFace); if( ((testNextFace != NULL) && !IsMarked(testNextFace)) ) { //we only swap if it buys us something //add a "fake" degenerate face NvFaceInfo* tempFace = new NvFaceInfo(nv0, nv1, nv0, true); backwardFaces.push_back(tempFace); MarkTriangle(tempFace); scratchIndices.push_back(nv0); testnv0 = nv0; ++m_numDegenerates; } } // add this to the strip backwardFaces.push_back(nextFace); //this is just so Unique() will work tempAllFaces.push_back(nextFace); MarkTriangle(nextFace); // add the index //nv0 = nv1; //nv1 = NvStripifier::GetNextIndex(scratchIndices, nextFace); scratchIndices.push_back(testnv1); // and get the next face nv0 = testnv0; nv1 = testnv1; nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, nextFace); } // Combine the forward and backwards stripification lists and put into our own face vector Combine(forwardFaces, backwardFaces); }
bool HierarchyTreeScreenNode::IsNeedSave() const { return IsMarked() | (this->unsavedChangesCounter != 0); }
VOID Mark(UINT x) { if (!IsMarked(x)) { m_MAP[x / 8] |= (1 << (x % 8)); --m_FREE; } }
static AddError() { a_sym *xsym, *sym; a_pro *xpro, *pro; a_state *x, **s, **t, *AddErrState(); a_shift_action *tx, *ty, *trans; a_reduce_action *rx, *ry, *redun; int i; a_word *defined, *conflict, *rset; short int *at; trans = CALLOC( nsym, a_shift_action ); rx = redun = CALLOC( npro + 1, a_reduce_action ); rset = conflict = AllocSet( npro + 2 ); for( i = 0; i <= npro; ++i ) { (rx++)->follow = rset; rset += GetSetSize( 1 ); } defined = rset; s = CALLOC( nstate, a_state * ); at = CALLOC( nstate, short int ); s = t = CALLOC( nstate + 1, a_state * ); for( x = statelist; x != NULL; x = x->next ) { Mark( *x ); *t++ = x; } restart = AddErrState( &errsym->enter, s, t ); for( x = restart; x != NULL; x = x->next ) { Clear( defined ); Clear( conflict ); xpro = NULL; for( i = 0; i < x->kersize; ++i ) { at[i] = 0; pro = x->name.state[i]->redun->pro; if( pro > xpro ) { xpro = pro; } } redun->pro = errpro; rx = redun + 1; if( x != restart ) while( xpro ) { pro = xpro; xpro = NULL; Clear( rx->follow ); for( i = 0; i < x->kersize; ++i ) { ry = &x->name.state[i]->redun[at[i]]; if( ry->pro == pro ) { Union( rx->follow, ry->follow ); ++(at[i]); ++ry; } if( ry->pro > xpro ) { xpro = ry->pro; } } UnionAnd( conflict, rx->follow, defined ); Union( defined, rx->follow ); rx->pro = pro; ++rx; } xsym = NULL; for( i = 0; i < x->kersize; ++i ) { at[i] = 0; sym = x->name.state[i]->trans->sym; if( sym > xsym ) { xsym = sym; } } tx = trans; while( xsym ) { sym = xsym; xsym = NULL; t = s; for( i = 0; i < x->kersize; ++i ) { ty = &x->name.state[i]->trans[at[i]]; if( ty->sym == sym ) { if( !IsMarked( *ty->state ) ) { Mark( *ty->state ); *t++ = ty->state; } ++(at[i]); ++ty; } if( ty->sym > xsym ) { xsym = ty->sym; } } tx->sym = sym; if( sym->pro != NULL ) { ++nvtrans; } else { if( IsBitSet( defined, sym->id ) ) { SetBit( conflict, sym->id ); while( --t >= s ) { Unmark( **t ); } continue; } else { SetBit( defined, sym->id ); } } tx->state = AddErrState( &errsym->enter, s, t ); ++tx; } x->trans = CALLOC( tx - trans + 1, a_shift_action ); memcpy( x->trans, trans, ((char *) tx) - ((char *) trans) ); if( Empty( conflict ) ) { redun->pro = NULL; i = 0; } else { i = 1; } while( --rx > redun ) { AndNot( rx->follow, conflict ); if( Empty( rx->follow ) ) { rx->pro = NULL; } else { ++i; } } x->redun = CALLOC( i + 1, a_reduce_action ); if( i ) { rset = AllocSet( i ); rx = redun; while( i > 0 ) { if( rx->pro != NULL ) { --i; x->redun[i].pro = rx->pro; x->redun[i].follow = rset; Assign( rset, rx->follow ); rset += GetSetSize( 1 ); } ++rx; } } } FREE( trans ); FREE( redun ); FREE( conflict ); FREE( s ); FREE( at ); }
/////////////////////////////////////////////////////////////////////////////////////////// // Build() // // Builds a strip forward as far as we can go, then builds backwards, and joins the two lists // void NvStripInfo::Build(NvEdgeInfoVec &edgeInfos, NvFaceInfoVec &faceInfos){ // used in building the strips forward and backward static WordVec scratchIndices; scratchIndices.resize(0); // build forward... start with the initial face NvFaceInfoVec forwardFaces, backwardFaces; forwardFaces.push_back(m_startInfo.m_startFace); MarkTriangle(m_startInfo.m_startFace); int v0 = (m_startInfo.m_toV1 ? m_startInfo.m_startEdge->m_v0 : m_startInfo.m_startEdge->m_v1); int v1 = (m_startInfo.m_toV1 ? m_startInfo.m_startEdge->m_v1 : m_startInfo.m_startEdge->m_v0); // easiest way to get v2 is to use this function which requires the // other indices to already be in the list. scratchIndices.push_back(u16(v0)); scratchIndices.push_back(u16(v1)); int v2 = NvStripifier::GetNextIndex(scratchIndices, m_startInfo.m_startFace); scratchIndices.push_back(u16(v2)); // // build the forward list // int nv0 = v1; int nv1 = v2; NvFaceInfo *nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, m_startInfo.m_startFace); while (nextFace != NULL && !IsMarked(nextFace)) { //this tests to see if a face is "unique", meaning that its vertices aren't already in the list // so, strips which "wrap-around" are not allowed if(!Unique(forwardFaces, nextFace)) break; // add this to the strip forwardFaces.push_back(nextFace); MarkTriangle(nextFace); // add the index nv0 = nv1; nv1 = NvStripifier::GetNextIndex(scratchIndices, nextFace); scratchIndices.push_back(u16(nv1)); // and get the next face nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, nextFace); } // tempAllFaces is going to be forwardFaces + backwardFaces // it's used for Unique() NvFaceInfoVec tempAllFaces; for(int i = 0; i < forwardFaces.size(); i++) tempAllFaces.push_back(forwardFaces[i]); // // reset the indices for building the strip backwards and do so // scratchIndices.resize(0); scratchIndices.push_back(u16(v2)); scratchIndices.push_back(u16(v1)); scratchIndices.push_back(u16(v0)); nv0 = v1; nv1 = v0; nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, m_startInfo.m_startFace); while (nextFace != NULL && !IsMarked(nextFace)) { //this tests to see if a face is "unique", meaning that its vertices aren't already in the list // so, strips which "wrap-around" are not allowed if(!Unique(tempAllFaces, nextFace)) break; // add this to the strip backwardFaces.push_back(nextFace); //this is just so Unique() will work tempAllFaces.push_back(nextFace); MarkTriangle(nextFace); // add the index nv0 = nv1; nv1 = NvStripifier::GetNextIndex(scratchIndices, nextFace); scratchIndices.push_back(u16(nv1)); // and get the next face nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, nextFace); } // Combine the forward and backwards stripification lists and put into our own face vector3 Combine(forwardFaces, backwardFaces); }
// --------------------------------------------------------------------------- // From class CAknTreeItem. // Checks whether the item can be removed from the tree when its parent node // is being collapsed. // --------------------------------------------------------------------------- // TBool CAknTreeLeaf::IsRemovableFromCollapsedNode() const { return !( IsMarked() || IsPersistent() ); }
VOID UnMark(UINT x) { if (IsMarked(x)) { m_MAP[x / 8] &= ~(1 << (x % 8)); } }
bool HierarchyTreeNode::IsNeedSave() const { return IsMarked() | (this->unsavedChangesCounter != 0) | HasUnsavedChilder(); }
int EList::Unmark() { if (Count > 0 && IsMarked(Row) && Unmark(Row) == 1) { NeedsRedraw = 1; return ErOK; } else return ErFAIL; }