void WorldMap::SetAreaStatus(const ieResRef AreaName, int Bits, int Op) { unsigned int i; WMPAreaEntry* ae=GetArea(AreaName,i); if (!ae) return; ae->SetAreaStatus(Bits, Op); }
QString MythUIText::cutDown(const QString &data, MythFontProperties *font, bool multiline) { int length = data.length(); if (length == 0) return data; int maxwidth = GetArea().width(); int maxheight = GetArea().height(); int justification = Qt::AlignLeft | Qt::TextWordWrap; QFontMetrics fm(font->face()); int margin = length - 1; int index = 0; int diff = 0; while (margin > 0) { if (multiline) diff = maxheight - fm.boundingRect(0, 0, maxwidth, maxheight, justification, data.left(index + margin + 1) ).height(); else diff = maxwidth - fm.width(data, index + margin + 1); if (diff >= 0) index += margin; margin /= 2; if (index + margin >= length - 1) margin = (length - 1) - index; } if (index < length - 1) { QString tmpStr(data); tmpStr.truncate(index); if (index >= 3) tmpStr.replace(index - 3, 3, "..."); return tmpStr; } return data; }
/** \brief Return the first MythUIType at the given coordinates * * \param p QPoint coordinates * \param recursive Whether to perform a recursive search * \param focusable Only consider widgets that are focusable. * * \return The widget at these coordinates */ MythUIType *MythUIType::GetChildAt(const QPoint &p, bool recursive, bool focusable) const { if (GetArea().contains(p)) { if (!IsVisible() || !IsEnabled()) return nullptr; if (m_ChildrenList.isEmpty()) return nullptr; /* check all children */ QList<MythUIType *>::const_iterator it; for (it = m_ChildrenList.end() - 1; it != m_ChildrenList.begin() - 1; --it) { if (!(*it)) continue; // If this point doesn't fall within the child's area then move on // This requires that the area is actually accurate and in some // cases this still isn't true if (!(*it)->GetArea().contains(p - GetArea().topLeft())) continue; MythUIType *child = *it; if (recursive && (focusable && !child->CanTakeFocus())) child = child->GetChildAt(p - GetArea().topLeft(), recursive, focusable); if (child) { // NOTE: Assumes no selectible ui type will contain another // selectible ui type. if (focusable && !child->CanTakeFocus()) continue; return child; } } } return nullptr; }
void InfoItem::Draw(HDC hDC,ePipeline* Pipe /*=Pipe*/){ RECT rc = GetArea(); COLORREF Oldcr = ::SetTextColor(hDC,RGB(0,255,0)); ::DrawText(hDC,m_Text.c_str(),m_Text.size(),&rc,DT_LEFT|DT_EXPANDTABS| DT_NOPREFIX|DT_VCENTER); ::SetTextColor(hDC,Oldcr); }
std::string CTriangle::ToString() const { std::stringstream stream; stream << "Triangle <<" << m_firstVertex.GetX() << "," << m_firstVertex.GetY() << ">"; stream << "<" << m_secondVertex.GetX() << "," << m_secondVertex.GetY() << ">"; stream << "<" << m_thirdVertex.GetX() << "," << m_thirdVertex.GetY() << ">>"; stream << ", Perimeter=" << GetPerimeter() << ", Area=" << GetArea(); return stream.str(); }
string CIncomingFriendList :: GetDescription( ) { string Description; Description += GetAccount( ) + "\n"; Description += ExtractStatus( GetStatus( ) ) + "\n"; Description += ExtractArea( GetArea( ) ) + "\n"; Description += ExtractLocation( GetLocation( ) ) + "\n\n"; return Description; }
/** \brief Return the first MythUIType which accepts focus found at the given * coordinates * * \param p QPoint coordinates * \param recursive Whether to perform a recursive search * * \return The widget at these coordinates */ MythUIType *MythUIType::GetChildAt(const QPoint &p, bool recursive, bool focusable) const { if (GetArea().contains(p)) { if (!IsVisible() || !IsEnabled()) return NULL; if (m_ChildrenList.isEmpty()) return NULL; /* check all children */ QList<MythUIType *>::const_iterator it; for (it = m_ChildrenList.end() - 1; it != m_ChildrenList.begin() - 1; --it) { if (!(*it)) continue; MythUIType *child = NULL; if ((*it)->GetArea().contains(p - GetArea().topLeft())) child = *it; if (!child && recursive) child = (*it)->GetChildAt(p - GetArea().topLeft(), recursive, focusable); if (child) { // NOTE: Assumes no selectible ui type will contain another // selectible ui type. if (focusable && !child->CanTakeFocus()) continue; return child; } } } return NULL; }
void MythUISimpleText::DrawSelf(MythPainter *p, int xoffset, int yoffset, int alphaMod, QRect clipRect) { QRect area = GetArea().toQRect(); area.translate(xoffset, yoffset); int alpha = CalcAlpha(alphaMod); p->SetClipRect(clipRect); p->DrawText(area, m_Message, m_Justification, m_Font, alpha, area); }
int WorldMap::GetDistance(const ieResRef AreaName) const { if (!Distances) { return -1; } unsigned int i; if (GetArea( AreaName, i )) { return Distances[i]; } return -1; }
void CMemoryView::CTitle::Draw(HDC hDC,ePipeline* Pipe ){ //输出文字 RECT rc = GetArea(); COLORREF Oldcr = ::SetTextColor(hDC,RGB(0,0,0)); tstring s = Format1024(_T("%s (%3d) "),m_Text.c_str(),m_ChildList.size()); ::DrawText(hDC,s.c_str(),s.size(),&rc,DT_LEFT|DT_EXPANDTABS| DT_NOPREFIX|DT_VCENTER); ::SetTextColor(hDC,Oldcr); }
void Damage::DrawAreas () { BoxObj visible(0, 0, _canvas->Width() - 1, _canvas->Height() - 1); BoxObj b, *a; Iterator i; for (FirstArea(i); !Done(i); Next(i)) { a = GetArea(i); b = *a - visible; _output->ClearRect(_canvas, b._left, b._bottom, b._right, b._top); _graphic->DrawClipped(_canvas, b._left, b._bottom, b._right, b._top); } }
void MythUIText::DrawSelf(MythPainter *p, int xoffset, int yoffset, int alphaMod, QRect clipRect) { QRect area = GetArea().toQRect(); area.translate(xoffset, yoffset); QRect drawrect = m_drawRect.toQRect(); drawrect.translate(xoffset, yoffset); int alpha = CalcAlpha(alphaMod); p->DrawText(drawrect, m_CutMessage, m_Justification, *m_Font, alpha, area); }
void MythUIScrollBar::CalculatePosition(void) { if (m_maximum > 0) Show(); else { Hide(); return; } MythUIType *slider = GetChild("slider"); if (!slider) { LOG(VB_GENERAL, LOG_ERR, "Slider element doesn't exist"); return; } float percentage = (float)m_sliderPosition / m_maximum; float relativeSize = (float)m_pageStep / (m_maximum + m_pageStep); MythRect newSliderArea = slider->GetArea(); MythRect fillArea = GetArea(); QPoint endPos(newSliderArea.left(), newSliderArea.top()); if (m_layout == LayoutHorizontal) { int width = qMax((int)(fillArea.width() * relativeSize + 0.5), m_sliderArea.width()); newSliderArea.setWidth(width); endPos.setX((int)((fillArea.width() - width) * percentage + 0.5)); } else { int height = qMax((int)(fillArea.height() * relativeSize + 0.5), m_sliderArea.height()); newSliderArea.setHeight(height); endPos.setY((int)((fillArea.height() - height) * percentage + 0.5)); } slider->SetArea(newSliderArea); slider->SetPosition(endPos); if (m_hideDelay > 0) { if (m_timerId) killTimer(m_timerId); m_timerId = startTimer(m_hideDelay); AdjustAlpha(1, 10, 0, 255); } }
void CLogicView::CRefItem::Draw(HDC hDC, ePipeline* Pipe){ FillRect(hDC,GetArea(),SS.crTaskMassBk); if(m_State & SPACE_FOCUSED){ DrawEdge(hDC,GetArea(),RGB(192,192,255)); } COLORREF crOld = SetTextColor(hDC,SS.crBrainViewItemText); RECT rc = GetArea(); rc.right = rc.left + 80; rc.bottom = rc.top + 18; rc.left +=2; //被引用名 ::DrawText(hDC,m_RefName.c_str(),m_RefName.size(),&rc,DT_END_ELLIPSIS|DT_LEFT|DT_SINGLELINE|DT_VCENTER); //引用者名 rc.left = rc.right; rc.right +=100 ; ::DrawText(hDC,m_WhoRef.c_str(),m_WhoRef.size(),&rc,DT_END_ELLIPSIS|DT_LEFT|DT_SINGLELINE|DT_VCENTER); SetTextColor(hDC,crOld); };
void CGFrameArea::Update (void) // Update // // Update the area { for (int i = 0; i < GetAreaCount(); i++) { AGArea *pArea = GetArea(i); pArea->Update(); } }
std::string CCircle::ToString() const { std::stringstream ss; ss << std::fixed << std::setprecision(2) << "circle <" << m_center.GetPosition().first << ", " << m_center.GetPosition().second << ">, R = " << GetRadius() << ", S = " << GetArea() << ", P = " << GetPerimeter() << ", " << m_outlineColor << ", " << m_fillColor; return ss.str(); }
void CBaseJungle::Init() { //--------------------------------------------------------------------------- //初期化 //--------------------------------------------------------------------------- SetFadeIn(); Sint32 col1 = 0xF0408080; Sint32 col2 = 0xF0808040; pGame->pBg->SetSkyColor(50,col1,col2); viiSub::SetScroll_l( GetTargetPlayer()->x , GetTargetPlayer()->y ); //--------------------------------------------------------------------------- //ファイル初期化 //--------------------------------------------------------------------------- // LoadTexture( enTexPageSoldier , "HoundData\\enemychara\\common\\ene_soldier.bmp",0xff00ff00); // UploadTexture(); //--------------------------------------------------------------------------- //エリア初期化 //--------------------------------------------------------------------------- switch(GetArea( )){ case enAreaSeq01: LoadConfig( "HoundData\\[email protected]" ); viiSub::SetScroll_l( GetTargetPlayer()->x , GetTargetPlayer()->y ); // viiMus::ReadBGM( 0,"HoundData\\bgm\\A\\A3_Bgm1.ogg"); viiMus::PlayBGM(enSoundBgm1,enMusicBgmStageA); // LoadConfig( "HoundData\\[email protected]" ); // LoadConfig( "HoundData\\[email protected]" ); // LoadConfig( "HoundData\\[email protected]" ); // LoadConfig( "HoundData\\[email protected]" ); break; case enAreaSeq02: break; case enAreaSeq03: break; case enAreaSeq04: break; case enAreaSeq05: break; } InitEnemies(); }
void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aOutlines ) { // convert tracks and vias: for( TRACK* track = m_Track; track != NULL; track = track->Next() ) { if( !track->IsOnLayer( aLayer ) ) continue; track->TransformShapeWithClearanceToPolygon( aOutlines, 0 ); } // convert pads for( MODULE* module = m_Modules; module != NULL; module = module->Next() ) { module->TransformPadsShapesWithClearanceToPolygon( aLayer, aOutlines, 0 ); // Micro-wave modules may have items on copper layers module->TransformGraphicShapesWithClearanceToPolygonSet( aLayer, aOutlines, 0 ); } // convert copper zones for( int ii = 0; ii < GetAreaCount(); ii++ ) { ZONE_CONTAINER* zone = GetArea( ii ); PCB_LAYER_ID zonelayer = zone->GetLayer(); if( zonelayer == aLayer ) zone->TransformSolidAreasShapesToPolygonSet( aOutlines ); } // convert graphic items on copper layers (texts) for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() ) { if( !item->IsOnLayer( aLayer ) ) continue; switch( item->Type() ) { case PCB_LINE_T: ( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon( aOutlines, 0 ); break; case PCB_TEXT_T: ( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet( aOutlines, 0 ); break; default: break; } } }
void CDebugView::MassItem::Draw(HDC hDC, ePipeline* Pipe){ RECT rc = GetArea(); COLORREF crFg = SS.crTaskMassText, crBk = SS.crTaskMassBk; if(m_State & SPACE_SELECTED){ // crFg = m_crBk; crBk = m_crText; rc.bottom -= 25; } //画背景 if(m_State & SPACE_PAUSE ){ FillRect(hDC,rc,SS.crTaskMassPause); crFg = SS.crTaskMassBk; }else if (m_State & SPACE_BREAK) { FillRect(hDC,rc,SS.crTaskMassBreak); crFg = SS.crTaskMassBk; } else{ FillRect(hDC,rc,crBk); } // rc.left += RectHeight(rc)+2; //Draw MassName COLORREF crOld = SetTextColor(hDC,crFg); tstring s = Format1024(_T("%I64ld %s"),m_Alias,m_Name.c_str()); ::DrawText(hDC,s.c_str(),s.size(),&rc,DT_END_ELLIPSIS|DT_LEFT|DT_SINGLELINE|DT_VCENTER); ::SetTextColor(hDC,crOld); if(m_State & SPACE_FOCUSED || m_State & SPACE_SELECTED) { DrawEdge(hDC,GetArea(),SS.crTaskMassBorder); } }
/** * \brief Assign a set of MythImages to the widget for animation. * Use is strongly discouraged, use SetFilepattern() instead. * */ void MythUIImage::SetImages(QVector<MythImage *> &images) { Clear(); QWriteLocker updateLocker(&d->m_UpdateLock); QSize aSize = GetArea().size(); QVector<MythImage *>::iterator it; for (it = images.begin(); it != images.end(); ++it) { MythImage *im = (*it); if (!im) { QMutexLocker locker(&m_ImagesLock); m_Images[m_Images.size()] = im; continue; } im->UpRef(); if (!m_ForceSize.isNull()) { int w = (m_ForceSize.width() <= 0) ? im->width() : m_ForceSize.width(); int h = (m_ForceSize.height() <= 0) ? im->height() : m_ForceSize.height(); im->Resize(QSize(w, h), m_preserveAspect); } if (m_isReflected && !im->IsReflected()) im->Reflect(m_reflectAxis, m_reflectShear, m_reflectScale, m_reflectLength, m_reflectSpacing); if (m_isGreyscale && !im->isGrayscale()) im->ToGreyscale(); m_ImagesLock.lock(); m_Images[m_Images.size()] = im; m_ImagesLock.unlock(); aSize = aSize.expandedTo(im->size()); } SetImageCount(1, m_Images.size()); if (m_ForceSize.isNull()) SetSize(aSize); m_CurPos = 0; SetRedraw(); }
void CAddressBar::SeparatorLine::Draw(HDC hDC, ePipeline* Pipe){ RECT rc = GetArea(); int32 pading = 2; if (m_bVerDraw) { rc.top +=pading; rc.bottom-=pading; int w = m_NumLine*(2); rc.left = rc.left+(RectWidth(rc)-w)/2; for (int i=0; i<m_NumLine; i++) { rc.right = rc.left+1; //::DrawEdge(hDC,&rc,BDR_RAISEDINNER,BF_RECT); FillRect(hDC,rc,m_crDark); rc.left = rc.right; rc.right = rc.left+1; FillRect(hDC,rc,m_crLight); rc.left = rc.right+2; } }else{ rc.left +=pading; rc.right -=pading; int h = m_NumLine*(2); rc.top = rc.top+(RectHeight(rc)-h)/2; for (int i=0; i<m_NumLine; i++) { rc.bottom = rc.top+1; //::DrawEdge(hDC,&rc,BDR_RAISEDINNER,BF_RECT); FillRect(hDC,rc,m_crDark); //rc.top = rc.bottom; //rc.bottom = rc.top+1; //FillRect(hDC,rc,RGB(64,64,64)); rc.top = rc.bottom; rc.bottom = rc.top+1; FillRect(hDC,rc,m_crLight); rc.top = rc.bottom+2; } } }
bool Board::IsSquareValid(Coords coords, int solvedValue) { // Check that the solved value of this square doesn't appear in any of // the rows, columns or areas it belongs to as a solved value too if (ContainsSolvedValue(GetRow(coords), solvedValue, coords.XCoord()) || ContainsSolvedValue(GetCol(coords), solvedValue, coords.YCoord()) || ContainsSolvedValue(GetArea(coords), solvedValue, IndexInAreaMap(coords))) { cout << "Found invalid repeated value of " << solvedValue << endl; return false; } return true; }
void CFooterBar::ControlBnt::Draw(HDC hDC,ePipeline* Pipe /*=NULL*/){ RECT rc = GetArea(); HFONT GuiFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); HFONT OldFont = (HFONT)::SelectObject(hDC, GuiFont ); DWORD Format = DT_CENTER|DT_VCENTER|DT_SINGLELINE; COLORREF crBorder = RGB(192,192,192); COLORREF crFkg = RGB(0,0,0); COLORREF crBkg = RGB(192,192,192); //画文字边框 // DrawEdge(hDC,m_Area,crBorder); DeflateRect(&rc,1,1,1,1); COLORREF Oldcr; if(m_State & SPACE_DISABLE){ DrawEdge(hDC,&rc,crBorder); Oldcr = ::SetTextColor(hDC,crBkg); ::DrawText(hDC,m_Name.c_str(),m_Name.size(),&rc,Format); ::SetTextColor(hDC,Oldcr); } else if(m_State & SPACE_SELECTED){ DrawEdge(hDC,&rc,crBorder); //FillRect(hDC,rc,crFkg); Oldcr = ::SetTextColor(hDC,crFkg); ::DrawText(hDC,m_Name.c_str(),m_Name.size(),&rc,Format); ::SetTextColor(hDC,Oldcr); } else if(m_State&SPACE_FOCUSED){ FillRect(hDC,rc,crBkg); DrawEdge(hDC,&rc,BDR_RAISEDOUTER|BDR_RAISEDINNER,BF_BOTTOMRIGHT|BF_TOPLEFT); Oldcr = ::SetTextColor(hDC,crFkg); rc.left-=1; rc.top -=1; ::DrawText(hDC,m_Name.c_str(),m_Name.size(),&rc,Format); ::SetTextColor(hDC,Oldcr); } else { FillRect(hDC,rc,crBkg); DrawEdge(hDC,&rc,BDR_RAISEDOUTER|BDR_RAISEDINNER,BF_BOTTOMRIGHT|BF_TOPLEFT); COLORREF Oldcr = ::SetTextColor(hDC,crFkg); ::DrawText(hDC,m_Name.c_str(),m_Name.size(),&rc,Format); ::SetTextColor(hDC,Oldcr); } ::SelectObject(hDC,OldFont ); }
void AGScreen::Update (void) // Update // // Update the screen { int i; for (i = 0; i < GetAreaCount(); i++) { AGArea *pArea = GetArea(i); pArea->Update(); } }
void ObjectHeader::Draw(HDC hDC, ePipeline* Pipe){ //输出内容 RECT rc = GetArea(); COLORREF Oldcr = ::SetTextColor(hDC,m_crText); rc.right = rc.left + 22; rc.bottom = rc.top + 22; DeflateRect(&rc,4,4,4,4); if(m_State & SPACE_DISABLE) FillRect(hDC,&rc,RGB(128,0,0)); else FillRect(hDC,&rc,RGB(255,0,0)); rc.left = rc.right+5; rc.right = m_AreaRight-10; //rc.bottom = rc.top+22; ::DrawText(hDC,m_Title.c_str(),m_Title.size(),&rc,DT_LEFT|DT_EXPANDTABS|DT_END_ELLIPSIS| DT_WORDBREAK|DT_NOPREFIX|DT_VCENTER); rc.top = m_AreaTop + 22; rc.bottom = m_AreaBottom-4; //名字 rc.right = rc.left+170; ::DrawText(hDC,m_Name.c_str(),m_Name.size(),&rc,DT_LEFT|DT_EXPANDTABS|DT_END_ELLIPSIS| DT_WORDBREAK|DT_NOPREFIX|DT_VCENTER); //给header添加一根横线 rc = GetArea(); rc.top = rc.bottom-4; rc.bottom = rc.bottom-2; FillRect(hDC,&rc,m_crText); ::SetTextColor(hDC,Oldcr); };
std::string CRectangle::ToString() const { std::stringstream ss; std::pair<double, double> position = m_position.GetPosition(); ss << std::fixed << std::setprecision(2) << "rectangle <" << position.first << ", " << position.second << "> " << "width = " << m_width << ", height = " << m_height << ", S = " << GetArea() << ", P = " << GetPerimeter() << ", " << m_outlineColor << ", " << m_fillColor; return ss.str(); }
AGArea *AGScreen::FindArea (DWORD dwTag) // FindArea // // Finds area by tag. Returns NULL if do not find the area { for (int i = 0; i < GetAreaCount(); i++) { AGArea *pArea = GetArea(i); if (pArea->GetTag() == dwTag) return pArea; } return NULL; }
//Mouse-clicks observing function: void SliderX::mouseClicks(int button,bool IsPressed,VectorF position) { GetArea(); // check if mouse is clicked and if its over this element if((button!=1) && Area.Containes(position)) { if(IsPressed) // if clicked, sign in for Mouse-Move-Event invocation / as mouse-movement-observer INPUT->attachMouseMove(this); XIsUnderControll = button==0?IsPressed:XIsUnderControll; // set flags signaling "under control" if button pressed YIsUnderControll = button==2?IsPressed:YIsUnderControll; //set lastMouse to new warp-position, to prevent counting the warp as a regular mouse-movement, //when warping the cursor to the actual slider-position when clicked... lastMouse = VectorF(left + ((DimensionsSwitched?ValueY:ValueX) *(right-left)),Area.GetCenter().y); glutWarpPointer(lastMouse.x,lastMouse.y); } }
//Find Worldmap location by nearest area with a smaller number //Counting backwards, stop at 1000 boundaries. //It is not possible to simply round to 1000, because there are //WMP entries like AR8001, and we need to find the best match WMPAreaEntry* WorldMap::FindNearestEntry(const ieResRef AreaName, unsigned int &i) const { int value = 0; ieResRef tmp; sscanf(&AreaName[2],"%4d", &value); do { snprintf(tmp, 9, "%.2s%04d", AreaName, value); WMPAreaEntry* ret = GetArea(tmp, i); if (ret) { return ret; } if (value%1000 == 0) break; value--; } while(1); //value%1000 should protect us from infinite loops i = -1; return NULL; }
void BOARD::DrawHighLight( EDA_DRAW_PANEL* am_canvas, wxDC* DC, int aNetCode ) { GR_DRAWMODE draw_mode; if( IsHighLightNetON() ) draw_mode = GR_HIGHLIGHT | GR_OR; else draw_mode = GR_AND | GR_HIGHLIGHT; // Redraw zones for( int ii = 0; ii < GetAreaCount(); ii++ ) { ZONE_CONTAINER* zone = GetArea( ii ); if( zone->GetNetCode() == aNetCode ) { zone->Draw( am_canvas, DC, draw_mode ); } } // Redraw any pads that have aNetCode for( MODULE* module = m_Modules; module; module = module->Next() ) { for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() ) { if( pad->GetNetCode() == aNetCode ) { pad->Draw( am_canvas, DC, draw_mode ); } } } // Redraw track and vias that have aNetCode for( TRACK* seg = m_Track; seg; seg = seg->Next() ) { if( seg->GetNetCode() == aNetCode ) { seg->Draw( am_canvas, DC, draw_mode ); } } }