RenderedSubtitle* Renderer::Lookup(const Subtitle* s, const CSize& vs, const CRect& vr) { m_sra.UpdateTarget(vs, vr); if(s->m_text.IsEmpty()) return NULL; CRect spdrc = s->m_frame.reference == _T("video") ? vr : CRect(CPoint(0, 0), vs); if(spdrc.IsRectEmpty()) return NULL; RenderedSubtitle* rs = NULL; if(m_rsc.Lookup(s->m_name, rs)) { if(!s->m_animated && rs->m_spdrc == spdrc) return rs; m_rsc.Invalidate(s->m_name); } const Style& style = s->m_text.GetHead().style; Size scale; scale.cx = (float)spdrc.Width() / s->m_frame.resolution.cx; scale.cy = (float)spdrc.Height() / s->m_frame.resolution.cy; CRect frame; frame.left = (int)(64.0f * (spdrc.left + style.placement.margin.l * scale.cx) + 0.5); frame.top = (int)(64.0f * (spdrc.top + style.placement.margin.t * scale.cy) + 0.5); frame.right = (int)(64.0f * (spdrc.right - style.placement.margin.r * scale.cx) + 0.5); frame.bottom = (int)(64.0f * (spdrc.bottom - style.placement.margin.b * scale.cy) + 0.5); CRect clip; if(style.placement.clip.l == -1) clip.left = 0; else clip.left = (int)(spdrc.left + style.placement.clip.l * scale.cx); if(style.placement.clip.t == -1) clip.top = 0; else clip.top = (int)(spdrc.top + style.placement.clip.t * scale.cy); if(style.placement.clip.r == -1) clip.right = vs.cx; else clip.right = (int)(spdrc.left + style.placement.clip.r * scale.cx); if(style.placement.clip.b == -1) clip.bottom = vs.cy; else clip.bottom = (int)(spdrc.top + style.placement.clip.b * scale.cy); clip.left = max(clip.left, 0); clip.top = max(clip.top, 0); clip.right = min(clip.right, vs.cx); clip.bottom = min(clip.bottom, vs.cy); scale.cx *= 64; scale.cy *= 64; bool vertical = s->m_direction.primary == _T("down") || s->m_direction.primary == _T("up"); // create glyph paths WCHAR c_prev = 0, c_next; CAutoPtrList<Glyph> glyphs; POSITION pos = s->m_text.GetHeadPosition(); while(pos) { const Text& t = s->m_text.GetNext(pos); LOGFONT lf; memset(&lf, 0, sizeof(lf)); lf.lfCharSet = DEFAULT_CHARSET; _tcscpy_s(lf.lfFaceName, CString(t.style.font.face)); lf.lfHeight = (LONG)(t.style.font.size * scale.cy + 0.5); lf.lfWeight = (LONG)(t.style.font.weight + 0.5); lf.lfItalic = !!t.style.font.italic; lf.lfUnderline = !!t.style.font.underline; lf.lfStrikeOut = !!t.style.font.strikethrough; lf.lfOutPrecision = OUT_TT_PRECIS; lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; lf.lfQuality = ANTIALIASED_QUALITY; lf.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE; FontWrapper* font; if(!(font = m_fc.Create(m_hDC, lf))) { _tcscpy_s(lf.lfFaceName, _T("Arial")); if(!(font = m_fc.Create(m_hDC, lf))) { ASSERT(0); continue; } } HFONT hOldFont = SelectFont(m_hDC, *font); const TEXTMETRIC& tm = font->GetTextMetric(); for(LPCWSTR c = t.str; *c; c++) { CAutoPtr<Glyph> g(DNew Glyph()); g->c = *c; g->style = t.style; g->scale = scale; g->vertical = vertical; g->font = font; c_next = !c[1] && pos ? c_next = s->m_text.GetAt(pos).str[0] : c[1]; Arabic::Replace(g->c, c_prev, c_next); c_prev = c[0]; CSize extent; GetTextExtentPoint32W(m_hDC, &g->c, 1, &extent); ASSERT(extent.cx >= 0 && extent.cy >= 0); if(vertical) { g->spacing = (int)(t.style.font.spacing * scale.cy + 0.5); g->ascent = extent.cx / 2; g->descent = extent.cx - g->ascent; g->width = extent.cy; // TESTME if(g->c == Text::SP) { g->width /= 2; } } else { g->spacing = (int)(t.style.font.spacing * scale.cx + 0.5); g->ascent = tm.tmAscent; g->descent = tm.tmDescent; g->width = extent.cx; } if(g->c == Text::LSEP) { g->spacing = 0; g->width = 0; g->ascent /= 2; g->descent /= 2; } else { GlyphPath* path = m_gpc.Create(m_hDC, font, g->c); if(!path) {ASSERT(0); continue;} g->path = *path; } glyphs.AddTail(g); } SelectFont(m_hDC, hOldFont); } // break glyphs into rows CAutoPtrList<Row> rows; CAutoPtr<Row> row; pos = glyphs.GetHeadPosition(); while(pos) { CAutoPtr<Glyph> g = glyphs.GetNext(pos); if(!row) row.Attach(DNew Row()); WCHAR c = g->c; row->AddTail(g); if(c == Text::LSEP || !pos) rows.AddTail(row); } // kerning if(s->m_direction.primary == _T("right")) // || s->m_direction.primary == _T("left") { for(POSITION rpos = rows.GetHeadPosition(); rpos; rows.GetNext(rpos)) { Row* r = rows.GetAt(rpos); POSITION gpos = r->GetHeadPosition(); while(gpos) { Glyph* g1 = r->GetNext(gpos); if(!gpos) break; Glyph* g2 = r->GetAt(gpos); if(g1->font != g2->font || !g1->style.font.kerning || !g2->style.font.kerning) continue; if(int size = g1->font->GetKernAmount(g1->c, g2->c)) { g2->path.MovePoints(CPoint(size, 0)); g2->width += size; } } } } // wrap rows if(s->m_wrap == _T("normal") || s->m_wrap == _T("even")) { int maxwidth = abs((int)(vertical ? frame.Height() : frame.Width())); int minwidth = 0; for(POSITION rpos = rows.GetHeadPosition(); rpos; rows.GetNext(rpos)) { Row* r = rows.GetAt(rpos); POSITION brpos = NULL; if(s->m_wrap == _T("even")) { int fullwidth = 0; for(POSITION gpos = r->GetHeadPosition(); gpos; r->GetNext(gpos)) { const Glyph* g = r->GetAt(gpos); fullwidth += g->width + g->spacing; } fullwidth = abs(fullwidth); if(fullwidth > maxwidth) { maxwidth = fullwidth / ((fullwidth / maxwidth) + 1); minwidth = maxwidth; } } int width = 0; for(POSITION gpos = r->GetHeadPosition(); gpos; r->GetNext(gpos)) { const Glyph* g = r->GetAt(gpos); width += g->width + g->spacing; if(brpos && abs(width) > maxwidth && g->c != Text::SP) { row.Attach(DNew Row()); POSITION next = brpos; r->GetNext(next); do {row->AddHead(r->GetPrev(brpos));} while(brpos); rows.InsertBefore(rpos, row); while(!r->IsEmpty() && r->GetHeadPosition() != next) r->RemoveHeadNoReturn(); g = r->GetAt(gpos = next); width = g->width + g->spacing; } if(abs(width) >= minwidth) { if(g->style.linebreak == _T("char") || g->style.linebreak == _T("word") && g->c == Text::SP) { brpos = gpos; } } } } } // trim rows for(POSITION pos = rows.GetHeadPosition(); pos; rows.GetNext(pos)) { Row* r = rows.GetAt(pos); while(!r->IsEmpty() && r->GetHead()->c == Text::SP) r->RemoveHead(); while(!r->IsEmpty() && r->GetTail()->c == Text::SP) r->RemoveTail(); } // calc fill width for each glyph CAtlList<Glyph*> glypsh2fill; int fill_id = 0; int fill_width = 0; for(POSITION pos = rows.GetHeadPosition(); pos; rows.GetNext(pos)) { Row* r = rows.GetAt(pos); POSITION gpos = r->GetHeadPosition(); while(gpos) { Glyph* g = r->GetNext(gpos); if(!glypsh2fill.IsEmpty() && fill_id && (g->style.fill.id != fill_id || !pos && !gpos)) { int w = (int)(g->style.fill.width * fill_width + 0.5); while(!glypsh2fill.IsEmpty()) { Glyph* g = glypsh2fill.RemoveTail(); fill_width -= g->width; g->fill = w - fill_width; } ASSERT(glypsh2fill.IsEmpty()); ASSERT(fill_width == 0); glypsh2fill.RemoveAll(); fill_width = 0; } fill_id = g->style.fill.id; if(g->style.fill.id) { glypsh2fill.AddTail(g); fill_width += g->width; } } } // calc row sizes and total subtitle size CSize size(0, 0); if(s->m_direction.secondary == _T("left") || s->m_direction.secondary == _T("up")) ReverseList(rows); for(POSITION pos = rows.GetHeadPosition(); pos; rows.GetNext(pos)) { Row* r = rows.GetAt(pos); if(s->m_direction.primary == _T("left") || s->m_direction.primary == _T("up")) ReverseList(*r); int w = 0, h = 0; r->width = 0; for(POSITION gpos = r->GetHeadPosition(); gpos; r->GetNext(gpos)) { const Glyph* g = r->GetAt(gpos); w += g->width; if(gpos) w += g->spacing; h = max(h, g->ascent + g->descent); r->width += g->width; if(gpos) r->width += g->spacing; r->ascent = max(r->ascent, g->ascent); r->descent = max(r->descent, g->descent); r->border = max(r->border, g->GetBackgroundSize()); } for(POSITION gpos = r->GetHeadPosition(); gpos; r->GetNext(gpos)) { Glyph* g = r->GetAt(gpos); g->row_ascent = r->ascent; g->row_descent = r->descent; } if(vertical) { size.cx += h; size.cy = max(size.cy, w); } else { size.cx = max(size.cx, w); size.cy += h; } } // align rows and calc glyph positions rs = DNew RenderedSubtitle(spdrc, clip); CPoint p = GetAlignPoint(style.placement, scale, frame, size); CPoint org = GetAlignPoint(style.placement, scale, frame); // collision detection if(!s->m_animated) { int tlb = !rows.IsEmpty() ? rows.GetHead()->border : 0; int brb = !rows.IsEmpty() ? rows.GetTail()->border : 0; CRect r(p, size); m_sra.GetRect(r, s, style.placement.align, tlb, brb); org += r.TopLeft() - p; p = r.TopLeft(); } CRect subrect(p, size); // continue positioning for(POSITION pos = rows.GetHeadPosition(); pos; rows.GetNext(pos)) { Row* r = rows.GetAt(pos); CSize rsize; rsize.cx = rsize.cy = r->width; if(vertical) { p.y = GetAlignPoint(style.placement, scale, frame, rsize).y; for(POSITION gpos = r->GetHeadPosition(); gpos; r->GetNext(gpos)) { CAutoPtr<Glyph> g = r->GetAt(gpos); g->tl.x = p.x + (int)(g->style.placement.offset.x * scale.cx + 0.5) + r->ascent - g->ascent; g->tl.y = p.y + (int)(g->style.placement.offset.y * scale.cy + 0.5); p.y += g->width + g->spacing; rs->m_glyphs.AddTail(g); } p.x += r->ascent + r->descent; } else { p.x = GetAlignPoint(style.placement, scale, frame, rsize).x; for(POSITION gpos = r->GetHeadPosition(); gpos; r->GetNext(gpos)) { CAutoPtr<Glyph> g = r->GetAt(gpos); g->tl.x = p.x + (int)(g->style.placement.offset.x * scale.cx + 0.5); g->tl.y = p.y + (int)(g->style.placement.offset.y * scale.cy + 0.5) + r->ascent - g->ascent; p.x += g->width + g->spacing; rs->m_glyphs.AddTail(g); } p.y += r->ascent + r->descent; } } // bkg, precalc style.placement.path, transform pos = rs->m_glyphs.GetHeadPosition(); while(pos) { Glyph* g = rs->m_glyphs.GetNext(pos); g->CreateBkg(); g->CreateSplineCoeffs(spdrc); g->Transform(org, subrect); } // merge glyphs (TODO: merge 'fill' too) Glyph* g0 = NULL; pos = rs->m_glyphs.GetHeadPosition(); while(pos) { POSITION cur = pos; Glyph* g = rs->m_glyphs.GetNext(pos); CRect r = g->bbox + g->tl; int size = (int)(g->GetBackgroundSize() + 0.5); int depth = (int)(g->GetShadowDepth() + 0.5); r.InflateRect(size, size); r.InflateRect(depth, depth); r.left >>= 6; r.top >>= 6; r.right = (r.right + 32) >> 6; r.bottom = (r.bottom + 32) >> 6; if((r & clip).IsRectEmpty()) // clip { rs->m_glyphs.RemoveAt(cur); } else if(g0 && g0->style.IsSimilar(g->style)) // append { CPoint o = g->tl - g0->tl; g->path.MovePoints(o); g0->path.types.Append(g->path.types); g0->path.points.Append(g->path.points); g->path_bkg.MovePoints(o); g0->path_bkg.types.Append(g->path_bkg.types); g0->path_bkg.points.Append(g->path_bkg.points); g0->bbox |= g->bbox + o; rs->m_glyphs.RemoveAt(cur); } else // leave alone { g0 = g; } } // rasterize pos = rs->m_glyphs.GetHeadPosition(); while(pos) rs->m_glyphs.GetNext(pos)->Rasterize(); // cache m_rsc.Add(s->m_name, rs); m_fc.Flush(); return rs; }
void CGLBase::Draw(double rot, int x,int y,int pattern) { //Rotate = Rotate + rot; //Image.x = Image.x + x; //Image.y = Image.y + y; //int ObjNum; CPoint touch; glClearColor(1.0, 1.0, 1.0, 1.0); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); //L字型になった時の描画処理 if(IsLshape) { //2枚目の下部 if(2760 < currentTouchPos.x && currentTouchPos.x < 3840 && 1010 < currentTouchPos.y) { GhostTouchPos.x = currentTouchPos.y + 2760; GhostTouchPos.y = 3840 - currentTouchPos.x; //3枚目の左 }else if(3830 <= currentTouchPos.x && currentTouchPos.x < 3910) { GhostTouchPos.x = 3840 - currentTouchPos.y; GhostTouchPos.y = currentTouchPos.x - 2760; if(1080 < GhostTouchPos.y) { Elaser.x = GhostTouchPos.x; Elaser.y = GhostTouchPos.y - 140; GhostTouchPos.y = 1079; //glColor3d(1.0,1.0,1.0); //DrawSquare(Elaser); } }else{ GhostTouchPos.x = -100; GhostTouchPos.y = -100; } } if(!IsLshape) GhostTouchPos = CPoint(-100,-100); if(m_CreateGoalFlag) DrawGoal(TargetPos[m_correct]); if(IsStandby && m_Moving == false) { if(IsLshape) { glClearColor(1.0, 1.0, 1.0, 1.0); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glPushMatrix(); glBegin(GL_QUADS); glColor3d(0.0,0.0,0.0); glVertex2d(-0.52, 0.1); glVertex2d(-0.52, -0.1); glVertex2d(-0.48, -0.1); glVertex2d(-0.48, 0.1); glEnd(); glPopMatrix(); }else{ glClearColor(1.0, 1.0, 1.0, 1.0); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glPushMatrix(); glBegin(GL_QUADS); glColor3d(0.0,0.0,0.0); glVertex2d(-0.02, 0.1); glVertex2d(-0.02, -0.1); glVertex2d( 0.02, -0.1); glVertex2d( 0.02, 0.1); glEnd(); glPopMatrix(); } //Sleep(3000); m_CreateGoalFlag = false; //IsStandby = false; IsFirstTouch = true; IsTasking = false; GhostObjectPos[m_correct] = ObjectPos[m_correct]; }else if(m_Moving == true){ glClearColor(1.0, 1.0, 1.0, 1.0); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); }else{ if(IsTaskFinish == true){ //タッチしていない状態 glColor3d(1.0,0.0,0.0); DrawSquare(ObjectPos[m_correct]); tmpObjectPos[m_correct] = ObjectPos[m_correct]; IsTaskFinish = false; //TRACE("スタート\n"); }else if(IsTasking == true && IsCorrectTouch == true) //ドラッグしている状態 { glColor3d(0.0,1.0,0.0); //if(1930 < currentTouchPos.x && currentTouchPos.y < 1080 && IsLined) // glColor3d(1.0,1.0,1.0); // if(!IsLshape) // glColor3d(1.0,1.0,1.0); DrawSquare(GhostTouchPos); //glColor3d(0.0,1.0,0.0); DrawSquare(currentTouchPos); }else if(IsTasking == false && IsCorrectTouch == true){ //手を放した状態 glColor3d(0.0,0.0,1.0); if(1930 < currentTouchPos.x && currentTouchPos.y < 1080 && IsLined) glColor3d(1.0,1.0,1.0); // if(!IsLshape) // glColor3d(1.0,1.0,1.0); DrawSquare(GhostTouchPos); glColor3d(0.0,0.0,1.0); DrawSquare(tmpObjectPos[m_correct]); }else{ //TRACE("ハズレ\n"); glColor3d(1.0,0.0,0.0); // if(!IsLshape) // glColor3d(1.0,1.0,1.0); DrawSquare(GhostTouchPos); glColor3d(1.0,0.0,0.0); DrawSquare(tmpObjectPos[m_correct]); //TRACE("(%d,%d)\n",currentTouchPos.x, currentTouchPos.y); } } if(IsLshape) { if(3830 <= currentTouchPos.x && currentTouchPos.x < 3910) { glColor3d(1.0,1.0,1.0); GhostTouchPos.y = 1080 + (currentTouchPos.x - 3980); DrawSquare(GhostTouchPos); Elaser.x = 3770; Elaser.y = currentTouchPos.y; DrawSquare(Elaser); } if(2760 < currentTouchPos.x && currentTouchPos.x < 3840 && 1010 < currentTouchPos.y) { Elaser.x = 3770; Elaser.y = 3840 - currentTouchPos.x; glColor3d(1.0,1.0,1.0); DrawSquare(Elaser); } } }
//STL_NORMAL=0,STL_FLAT=1,STL_SEMIFLAT=2,STL_XP=3 void CGuiNormalButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { CDC* pdc= CDC::FromHandle(lpDrawItemStruct->hDC); CRect rc=lpDrawItemStruct->rcItem; UINT uState=lpDrawItemStruct->itemState; CBrush cb; cb.CreateSolidBrush(m_clColor); COLORREF clrTL =GuiDrawLayer::GetRGBColorBTNHigh(); COLORREF clrBR =GuiDrawLayer::GetRGBColorShadow(); pdc->FillRect(rc,&cb); if( uState & ODS_SELECTED) //the button is pressed { switch(m_stlbtn) { case STL_FLAT: case STL_NORMAL: case STL_SEMIFLAT: pdc->Draw3dRect(rc,clrBR,clrTL); rc.DeflateRect(1,1); break; } } else if(m_bMouserOver) { switch(m_stlbtn) { case STL_FLAT: case STL_NORMAL: case STL_SEMIFLAT: pdc->Draw3dRect(rc,clrTL,clrBR); rc.DeflateRect(1,1); break; } }else { switch(m_stlbtn) { case STL_NORMAL: pdc->Draw3dRect(rc,clrTL,clrBR); rc.DeflateRect(1,1); break; case STL_SEMIFLAT: pdc->Draw3dRect(rc,clrTL,clrBR); rc.DeflateRect(1,1); break; case STL_FLAT: break; } } int calculodify; calculodify=rc.Height()-(m_SizeImage.cy); calculodify/=2; int nHeigh=calculodify+(m_bShowDark?1:0); int nWidth=rc.Width()/2 ; CPoint m_point=CPoint(nWidth,nHeigh); if (m_SizeImage.cx > 2) { if(m_bMouserOver == 1 && !(uState & ODS_DISABLED) && !(uState & ODS_SELECTED) && m_bShowDark) { CPoint p(m_point.x+1,m_point.y+1); pdc->DrawState(p,m_SizeImage,m_Icon,DSS_MONO,CBrush (GuiDrawLayer::GetRGBColorShadow())); m_point.x-=1; m_point.y-=1; } pdc->DrawState (m_point, m_SizeImage,m_Icon, (uState==ODS_DISABLED?DSS_DISABLED:DSS_NORMAL),(CBrush*)NULL); } if (m_SizeText.cx > 2) { int nMode = pdc->SetBkMode(TRANSPARENT); CRect rectletra=rc; rectletra.left+=m_SizeImage.cx; CPoint pt=CSize(rectletra.top,rectletra.left); if (uState & ODS_DISABLED) pdc->DrawState(pt, m_SizeText, m_szText, DSS_DISABLED, TRUE, 0, (CBrush*)NULL); else pdc->DrawText(m_szText,rectletra,DT_SINGLELINE|DT_LEFT|DT_VCENTER); pdc->SetBkMode(nMode); } }
// 처음 이 함수를 부르면 윈도가 열린다. BOOL CWndGuildWarPeaceConfirm::Initialize( CWndBase* pWndParent, DWORD /*dwWndId*/ ) { // Daisy에서 설정한 리소스로 윈도를 연다. return CWndNeuz::InitDialog( g_Neuz.GetSafeHwnd(), APP_GUILD_WARPEACECONFIRM, 0, CPoint( 0, 0 ), pWndParent ); }
bool CMpaDecSettingsWnd::OnActivate() { DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_TABSTOP; CRect r; CPoint p(10, 10); m_outputformat_static.Create(ResStr(IDS_MPADECSETTINGSWND_0), dwStyle, CRect(p, CSize(120, m_fontheight)), this); p.y += m_fontheight + 5; m_outputformat_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CSize(10, 0), CSize(100, 200)), this, IDC_PP_COMBO1); m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("PCM 16 Bit")), SF_PCM16); m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("PCM 24 Bit")), SF_PCM24); m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("PCM 32 Bit")), SF_PCM32); m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("IEEE Float")), SF_FLOAT32); m_outputformat_combo.SetCurSel(0); for(int i = 0; i < m_outputformat_combo.GetCount(); i++) if((int)m_outputformat_combo.GetItemData(i) == m_outputformat) m_outputformat_combo.SetCurSel(i); p.y += 30; CString strSpeak; strSpeak.Format (_T("%s%s"), ResStr(IDS_MPADECSETTINGSWND_1), GetDolbyMode(m_ddmode)); m_ac3spkcfg_static.Create(ResStr(IDS_MPADECSETTINGSWND_1) + GetDolbyMode(m_ddmode), dwStyle, CRect(p, CSize(220, m_fontheight)), this); p.y += m_fontheight + 5; m_ac3spkcfg_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CSize(150, 0), CSize(100, 200)), this, IDC_PP_COMBO2); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("单声道")), A52_MONO); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("双单声道")), A52_CHANNEL); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("立体声")), A52_STEREO); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("杜比立体声")), A52_DOLBY); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_3F)), A52_3F); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_2F_1R)), A52_2F1R); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_3F_1R)), A52_3F1R); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_2F_2R)), A52_2F2R); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_3F_2R)), A52_3F2R); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_CHANNEL_1)), A52_CHANNEL1); m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(ResStr(IDS_MPA_CHANNEL_2)), A52_CHANNEL2); for(int i = 0, sel = abs(m_ac3spkcfg) & A52_CHANNEL_MASK; i < m_ac3spkcfg_combo.GetCount(); i++) if((int)m_ac3spkcfg_combo.GetItemData(i) == sel) m_ac3spkcfg_combo.SetCurSel(i); m_ac3spkcfg_combo.GetWindowRect(r); ScreenToClient(r); m_ac3lfe_check.Create(_T("LFE"), dwStyle|BS_AUTOCHECKBOX, CRect(CPoint(r.left, r.bottom + 3), CSize(50, m_fontheight)), this, IDC_PP_CHECK4); m_ac3lfe_check.SetCheck(!!(abs(m_ac3spkcfg) & A52_LFE)); for(int i = 0, h = max(20, m_fontheight)+1; i < countof(m_ac3spkcfg_radio); i++, p.y += h) { static const TCHAR* labels[] = {m_strDecodeToSpeaker, _T("SPDIF")}; DWORD ddwStyle = dwStyle; if(wcscmp(labels[i],_T("SPDIF")) == 0){ ddwStyle = (dwStyle& ~WS_VISIBLE); } m_ac3spkcfg_radio[i].Create(labels[i],ddwStyle|BS_AUTORADIOBUTTON|(i == 0 ? WS_GROUP : 0), CRect(p + CPoint(10, 0), CSize(140, h)), this, IDC_PP_RADIO1+i); } CheckRadioButton(IDC_PP_RADIO1, IDC_PP_RADIO2, m_ac3spkcfg >= 0 ? IDC_PP_RADIO1 : IDC_PP_RADIO2); p.y += 5; m_ac3spkcfg_check.Create(ResStr(IDS_MPA_DYNRANGE), dwStyle|BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(150, m_fontheight)), this, IDC_PP_CHECK1); m_ac3spkcfg_check.SetCheck(m_ac3drc); p.y += m_fontheight + 10; m_dtsspkcfg_static.Create(ResStr(IDS_MPADECSETTINGSWND_7), dwStyle, CRect(p, CSize(120, m_fontheight)), this); p.y += m_fontheight + 5; m_dtsspkcfg_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CSize(150, 0), CSize(100, 200)), this, IDC_PP_COMBO3); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("单声道")), DTS_MONO); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("双单声道")), DTS_CHANNEL); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("立体声")), DTS_STEREO); //m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Stereo ..")), DTS_STEREO_SUMDIFF); //m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Stereo ..")), DTS_STEREO_TOTAL); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_3F)), DTS_3F); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_2F_1R)), DTS_2F1R); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_3F_1R)), DTS_3F1R); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_2F_2R)), DTS_2F2R); m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(ResStr(IDS_MPA_3F_2R)), DTS_3F2R); for(int i = 0, sel = abs(m_dtsspkcfg) & DTS_CHANNEL_MASK; i < m_dtsspkcfg_combo.GetCount(); i++) if((int)m_dtsspkcfg_combo.GetItemData(i) == sel) m_dtsspkcfg_combo.SetCurSel(i); m_dtsspkcfg_combo.GetWindowRect(r); ScreenToClient(r); m_dtslfe_check.Create(_T("LFE"), dwStyle|BS_AUTOCHECKBOX, CRect(CPoint(r.left, r.bottom + 3), CSize(50, m_fontheight)), this, IDC_PP_CHECK5); m_dtslfe_check.SetCheck(!!(abs(m_dtsspkcfg) & DTS_LFE)); for(int i = 0, h = max(20, m_fontheight)+1; i < countof(m_dtsspkcfg_radio); i++, p.y += h) { static const TCHAR* labels[] = {m_strDecodeToSpeaker, _T("SPDIF")}; DWORD ddwStyle = dwStyle; if(wcscmp(labels[i],_T("SPDIF")) == 0){ ddwStyle = (dwStyle& ~WS_VISIBLE); } m_dtsspkcfg_radio[i].Create(labels[i], ddwStyle|BS_AUTORADIOBUTTON|(i == 0 ? WS_GROUP : 0), CRect(p + CPoint(10, 0), CSize(140, h)), this, IDC_PP_RADIO3+i); } CheckRadioButton(IDC_PP_RADIO3, IDC_PP_RADIO4, m_dtsspkcfg >= 0 ? IDC_PP_RADIO3 : IDC_PP_RADIO4); p.y += 5; m_dtsspkcfg_check.Create(ResStr(IDS_MPA_DYNRANGE), dwStyle|WS_DISABLED|BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(150, m_fontheight)), this, IDC_PP_CHECK2); m_dtsspkcfg_check.SetCheck(m_dtsdrc); p.y += m_fontheight + 10; m_aacspkcfg_static.Create(ResStr(IDS_MPADECSETTINGSWND_11), dwStyle, CRect(p, CSize(120, m_fontheight)), this); p.y += m_fontheight + 5; m_aacdownmix_check.Create(ResStr(IDS_MPADECSETTINGSWND_12), dwStyle|BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(150, m_fontheight)), this, IDC_PP_CHECK3); m_aacdownmix_check.SetCheck(m_aacdownmix); for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow()) pWnd->SetFont(&m_font, FALSE); return true; }
//重画消息 void CButtonBar::OnPaint() { CPaintDC dc(this); //获取位置 CRect rcRect; GetClientRect(&rcRect); //加载资源 CImageHandle ImageHotHandle(&m_ImageHot); CImageHandle ImageActiveHandle(&m_ImageActive); CImageHandle ImageNormalHandle(&m_ImageNormal); CImageHandle m_ImageBackGroundHandle(&m_ImageBackGround); //建立缓冲 CDC BufferDC; CBitmap BufferBmp; BufferDC.CreateCompatibleDC(&dc); BufferBmp.CreateCompatibleBitmap(&dc,rcRect.Width(),rcRect.Height()); BufferDC.SelectObject(&BufferBmp); //绘画背景 CBrush BackBrush(TITLE_GROUND_COLOR); CPen BorderPen(PS_SOLID,1,CSkinWndObject::m_SkinAttribute.m_crInsideBorder); CPen * pOldPen=BufferDC.SelectObject(&BorderPen); CBrush * pOldBrush=BufferDC.SelectObject(&BackBrush); BufferDC.FillSolidRect(&rcRect,CSkinWndObject::m_SkinAttribute.m_crBackGround); BufferDC.RoundRect(&rcRect,CPoint(10,10)); m_ImageBackGround.BitBlt(BufferDC,1,rcRect.Height()-m_ImageBackGround.GetHeight()-3); BufferDC.SelectObject(pOldPen); BufferDC.SelectObject(pOldBrush); BackBrush.DeleteObject(); BorderPen.DeleteObject(); //绘画按钮 BufferDC.SetBkMode(TRANSPARENT); BufferDC.SelectObject(&CSkinAttribute::m_DefaultFont); //绘画按钮 CRect rcButton; CSkinImage * pSkinImage=NULL; for (INT_PTR i=0; i<m_OptionsItemPtr.GetCount(); i++) { LPCTSTR pszButtonText=m_OptionsItemPtr[i]->GetButtonText(); rcButton.SetRect(1,(int)(ITEM_HEIGHT*i+10+2*i),rcRect.Width(),(int)(ITEM_HEIGHT*(i+1)+10+2*i)); if (i==m_nActiveItem) { pSkinImage=&m_ImageActive; BufferDC.SetTextColor(RGB(0,0,0)); } else if (i==m_nHotItem) { pSkinImage=&m_ImageHot; BufferDC.SetTextColor(RGB(0,0,0)); } else { pSkinImage=&m_ImageNormal; BufferDC.SetTextColor(RGB(0,0,0)); } pSkinImage->BitBlt(BufferDC,rcButton.left,rcButton.top,ITEM_WIDTH,ITEM_HEIGHT,0,0,SRCCOPY); BufferDC.DrawText(pszButtonText,lstrlen(pszButtonText),rcButton,DT_END_ELLIPSIS|DT_VCENTER|DT_CENTER|DT_SINGLELINE); } //绘画界面 dc.BitBlt(0,0,rcRect.Width(),rcRect.Height(),&BufferDC,0,0,SRCCOPY); //清理资源 BufferDC.DeleteDC(); BufferBmp.DeleteObject(); return; }
void CPreviewClientWindow::CalcXYPos(LPARAM lParam, sInt &x, sInt &y) { CalcXYPos(CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)), x, y); }
/** * Obtenir un point obtenu en multipliant le point courant * par un réel. * @param K facteur multiplicateur. * @return Elément de type Cpoint. */ CPoint operator*(const CPoint &op) const { return CPoint(x*op.x, y*op.y, z*op.z); };
/** Aditionner deux points */ virtual CPoint operator+(const CPoint& P) const { return CPoint (x+P.x,y+P.y,z+P.z); }//operator+
// start dragging. This is the only routine exposed externally. // pt = mouse position at start of drag (screen co-ords) void COXDragDockContext::StartDrag(CPoint pt) { ASSERT_VALID(m_pBar); ASSERT(m_pBar->IsKindOf(RUNTIME_CLASS(COXSizeControlBar))); COXSizeControlBar* pSzBar = (COXSizeControlBar*)m_pBar; // get styles from bar m_dwDockStyle = m_pBar->m_dwDockStyle; m_dwStyle = m_pBar->m_dwStyle & CBRS_ALIGN_ANY; ASSERT(m_dwStyle != 0); // check to see we're not hanging from a COXMDIFloatWnd. // Disallow dragging if we are... if (m_pBar->IsFloating()) { CFrameWnd* pFrameWnd = m_pBar->GetParentFrame(); ASSERT(pFrameWnd != NULL); ASSERT(pFrameWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd))); if (pFrameWnd->IsKindOf(RUNTIME_CLASS(COXMDIFloatWnd))) return; // do nothing if floating inside a COXMDIFloatWnd } // dragging has started message (only if window will actually dock !) if ((m_dwDockStyle & CBRS_ALIGN_ANY) == CBRS_ALIGN_ANY) AfxGetMainWnd()->SendMessage(WM_SETMESSAGESTRING, IDS_OX_MRC_STARTDOCKING); // handle pending WM_PAINT messages MSG msg; while (::PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_NOREMOVE)) { if (!GetMessage(&msg, NULL, WM_PAINT, WM_PAINT)) return; ASSERT(msg.message == WM_PAINT); DispatchMessage(&msg); } // initialize drag state m_rectLast.SetRectEmpty(); m_sizeLast.cx = m_sizeLast.cy = 0; m_bForceFrame = m_bFlip = m_bDitherLast = FALSE; // get current bar location CRect rect; m_pBar->GetWindowRect(rect); m_ptLast = pt; m_ptStart = pt; BOOL bHorz = HORZF(m_dwStyle); // MFC includes code for flipping orientation using the shift key - I wasn't keen // on this... (sorry) so I've left it out for now. Some references are still left // in for it, in case I decide to implement it. // Start by working out the possible rectangles that dragging could result in. // These are: // m_rectFrameDragHorz : floating frame, horizontal orientation // m_rectFrameDragVert : floating frame, vertical orientation (not used, 'cos // flipping not allowed) // // m_rectDragHorz : docking horizontally, another bar already on this row // m_rectDragVert : docking vertically, another bar already on this row // m_rectDragHorzAlone : docking horizontally, on a new row // m_rectDragVertAlone : docking vertically, on a new row // calculate dragging rects if you drag on the new row/column // CRect rectBorder; m_pDockSite->RepositionBars(0,0xffff,AFX_IDW_PANE_FIRST, CFrameWnd::reposQuery,&rectBorder); m_pDockSite->ClientToScreen(rectBorder); CWnd* pLeftDockBar=m_pDockSite->GetControlBar(AFX_IDW_DOCKBAR_LEFT); if(pLeftDockBar!=NULL && pLeftDockBar->GetStyle()&WS_VISIBLE) { CRect rectDockBar; pLeftDockBar->GetWindowRect(rectDockBar); rectBorder.left-=rectDockBar.Width(); } CWnd* pRightDockBar=m_pDockSite->GetControlBar(AFX_IDW_DOCKBAR_RIGHT); if(pRightDockBar!=NULL && pRightDockBar->GetStyle()&WS_VISIBLE) { CRect rectDockBar; pRightDockBar->GetWindowRect(rectDockBar); rectBorder.right+=rectDockBar.Width(); } m_rectDragHorzAlone=CRect(CPoint(rectBorder.left,rect.top),rectBorder.Size()); m_rectDragVertAlone=CRect(CPoint(rect.left,rectBorder.top),rectBorder.Size()); m_rectDragHorzAlone.bottom=m_rectDragHorzAlone.top+pSzBar->m_HorzDockSize.cy; m_rectDragVertAlone.right=m_rectDragVertAlone.left+pSzBar->m_VertDockSize.cx; // ////////////////////////////////////////////////////////////// ////////////////// // int nDockAreaWidth = rectBorder.Width(); int nDockAreaHeight = rectBorder.Height(); CSize HorzAloneSize(nDockAreaWidth, pSzBar->m_HorzDockSize.cy); CSize VertAloneSize(pSzBar->m_VertDockSize.cx, nDockAreaHeight); // sizes to use when docking into a row that already has some bars. // use the stored sizes - unless they are > the max dock area - // in which case make a guess. if (pSzBar->m_VertDockSize.cy >= nDockAreaHeight - 16) VertAloneSize.cy = nDockAreaHeight / 3; else VertAloneSize.cy = pSzBar->m_VertDockSize.cy; if (pSzBar->m_HorzDockSize.cx >= nDockAreaWidth - 16) HorzAloneSize.cx = nDockAreaWidth / 3; else HorzAloneSize.cx = pSzBar->m_HorzDockSize.cx; m_rectDragHorz = CRect(rect.TopLeft(), HorzAloneSize); m_rectDragVert = CRect(rect.TopLeft(), VertAloneSize); // /////////////////// // rectangle for the floating frame... m_rectFrameDragVert = m_rectFrameDragHorz = CRect(rect.TopLeft(), pSzBar->m_FloatSize); // To work out the size we actually create a floating mini frame, and then see how big // it is CMiniDockFrameWnd* pFloatFrame = m_pDockSite->CreateFloatingFrame(bHorz ? CBRS_ALIGN_TOP : CBRS_ALIGN_LEFT); if (pFloatFrame == NULL) AfxThrowMemoryException(); pFloatFrame->CalcWindowRect(&m_rectFrameDragHorz); pFloatFrame->CalcWindowRect(&m_rectFrameDragVert); // m_rectFrameDragHorz.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); // m_rectFrameDragVert.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); pFloatFrame->DestroyWindow(); // adjust rectangles so that point is inside AdjustRectangle(m_rectDragHorzAlone, pt); AdjustRectangle(m_rectDragVertAlone, pt); AdjustRectangle(m_rectDragHorz, pt); AdjustRectangle(m_rectDragVert, pt); AdjustRectangle(m_rectFrameDragHorz, pt); AdjustRectangle(m_rectFrameDragVert, pt); // lock window update while dragging ASSERT(m_pDC == NULL); CWnd* pWnd = CWnd::GetDesktopWindow(); #ifndef _MAC if (pWnd->LockWindowUpdate()) m_pDC = pWnd->GetDCEx(NULL, DCX_WINDOW|DCX_CACHE|DCX_LOCKWINDOWUPDATE); else #endif m_pDC = pWnd->GetDCEx(NULL, DCX_WINDOW|DCX_CACHE); ASSERT(m_pDC != NULL); // initialize tracking state and enter tracking loop m_dwOverDockStyle = CanDock(); Move(pt); // call it here to handle special keys Track(); }
/** * Obtenir un point obtenu en multipliant le point courant * par un réel.(Ajout de Michel Leblond). * @param K facteur multiplicateur. * @return Elément de type Cpoint. */ CPoint operator*(const GLfloat &K) const { return CPoint(x*K,y*K,z*K); };
void CDxDatePickerMonth::DrawScrollTriangle(CDCHandle dc, CRect rcSpot, BOOL bLeftDirection, COLORREF clrColor, BOOL bYears) { CPoint ptCenter(rcSpot.CenterPoint()); if (bLeftDirection) { Triangle(dc, ptCenter, CPoint(ptCenter.x + 4, ptCenter.y - 4), CPoint(ptCenter.x + 4, ptCenter.y + 4), clrColor); if (bYears) { Triangle(dc, CPoint(ptCenter.x - 8, ptCenter.y), CPoint(ptCenter.x - 4, ptCenter.y - 4), CPoint(ptCenter.x - 4, ptCenter.y + 4), clrColor); Triangle(dc, CPoint(ptCenter.x + 4, ptCenter.y), CPoint(ptCenter.x + 8, ptCenter.y - 4), CPoint(ptCenter.x + 8, ptCenter.y + 4), clrColor); //Triangle(pDC, // CPoint(ptCenter.x + 2, ptCenter.y), // CPoint(ptCenter.x + 3, ptCenter.y - 2), // CPoint(ptCenter.x + 3, ptCenter.y + 2), // RGB(255,255,255)); } } else { Triangle(dc, ptCenter, CPoint(ptCenter.x - 4, ptCenter.y - 4), CPoint(ptCenter.x - 4, ptCenter.y + 4), clrColor); if (bYears) { Triangle(dc, CPoint(ptCenter.x + 8, ptCenter.y), CPoint(ptCenter.x + 4, ptCenter.y - 4), CPoint(ptCenter.x + 4, ptCenter.y + 4), clrColor); Triangle(dc, CPoint(ptCenter.x - 4, ptCenter.y), CPoint(ptCenter.x - 8, ptCenter.y - 4), CPoint(ptCenter.x - 8, ptCenter.y + 4), clrColor); //Triangle(pDC, // CPoint(ptCenter.x - 2, ptCenter.y), // CPoint(ptCenter.x - 3, ptCenter.y - 2), // CPoint(ptCenter.x - 3, ptCenter.y + 2), // RGB(255,255,255)); } } }
void CGfxPopupMenu::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { // CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC); // CRect rcItem(lpDrawItemStruct->rcItem); // pDC->FillSolidRect(rcItem, RGB(255,0,0)); if (lpDrawItemStruct->CtlType == ODT_MENU) { UINT id = lpDrawItemStruct->itemID; UINT state = lpDrawItemStruct->itemState; bool bEnab = !(state & ODS_DISABLED); bool bSelect = (state & ODS_SELECTED) ? true : false; bool bChecked = (state & ODS_CHECKED) ? true : false; // David 08/04/98 - start - bold font handling bool bBold = (state & ODS_DEFAULT) ? true : false; // David 08/04/98 - end - bold font handling SpawnItem * pItem = (SpawnItem *) lpDrawItemStruct->itemData; if (pItem) { CDC * pDC = CDC::FromHandle(lpDrawItemStruct->hDC); CFont * pft; // David 08/04/98 - start - bold font handling if (!bBold) pft = CFont::FromHandle((HFONT) hMenuFont ? hMenuFont : hGuiFont); else pft = CFont::FromHandle((HFONT) hMenuBoldFont ? hMenuBoldFont : hGuiFont); // David 08/04/98 - end - bold font handling CFont * of = pDC->SelectObject(pft); CRect rc(lpDrawItemStruct->rcItem); CRect rcImage(rc), rcText(rc); rcImage.right = rcImage.left + rc.Height(); rcImage.bottom = rc.bottom; if (pItem->iCmd == -3) // is a separator { CPen pnDk(PS_SOLID,1,cr3dShadow); CPen pnLt(PS_SOLID,1,cr3dHilight); CPen * opn = pDC->SelectObject(&pnDk); pDC->MoveTo(rc.left + 2, rc.top + 2); pDC->LineTo(rc.right - 2, rc.top + 2); pDC->SelectObject(&pnLt); pDC->MoveTo(rc.left + 2, rc.top + 3); pDC->LineTo(rc.right - 2, rc.top + 3); pDC->SelectObject(opn); } else if (pItem->iCmd == -4) // is a title item { CString cs(pItem->cText), cs1; CRect rcBdr(rcText); if (bSelect && bEnab) { rcText.top ++; rcText.left += 2; } pDC->FillSolidRect(rcText, crMenu); pDC->DrawText(cs, rcText, DT_VCENTER|DT_CENTER|DT_SINGLELINE); if (bSelect && bEnab) pDC->Draw3dRect(rcBdr,cr3dShadow,cr3dHilight); } else { rcText.left += rcImage.right + 1; int obk = pDC->SetBkMode(TRANSPARENT); COLORREF ocr; if (bSelect) { if (pItem->iImageIdx >= 0 || (state & ODS_CHECKED)) pDC->FillSolidRect(rcText, crHighlight); else pDC->FillSolidRect(rc, crHighlight); ocr = pDC->SetTextColor(crMenuTextSel); } else { if (pItem->iImageIdx >= 0 || (state & ODS_CHECKED)) pDC->FillSolidRect(rcText, crMenu); else pDC->FillSolidRect(rc/*rcText*/, crMenu); ocr = pDC->SetTextColor(crMenuText); } if (pItem->iImageIdx >= 0) { int ay = (rcImage.Height() - szImage.cy) / 2; int ax = (rcImage.Width() - szImage.cx) / 2; if (bSelect && bEnab) pDC->Draw3dRect(rcImage,cr3dHilight,cr3dShadow); else { pDC->Draw3dRect(rcImage,crMenu,crMenu); } if (bEnab) { ilList.Draw(pDC, pItem->iImageIdx, CPoint(rcImage.left + ax, rcImage.top +ay), ILD_NORMAL); } else { HICON hIcon = ilList.ExtractIcon( pItem->iImageIdx ); pDC->DrawState( CPoint(rcImage.left + ax, rcImage.top + ay ), szImage, (HICON)hIcon, DST_ICON | DSS_DISABLED, (CBrush *)NULL ); } } else { if (bChecked) { int ay = (rcImage.Height() - szImage.cy) / 2; int ax = (rcImage.Width() - szImage.cx) / 2; ilOther.Draw(pDC, 0, CPoint(rcImage.left + ax, rcImage.top + ay - 2), ILD_NORMAL); } } CString cs(pItem->cText), cs1; CSize sz; sz = pDC->GetTextExtent(cs); int ay1 = (rcText.Height() - sz.cy) / 2; rcText.top += ay1; rcText.left += 2; rcText.right -= 15; int tf = cs.Find('\t'); if (tf >= 0) { cs1 = cs.Right(cs.GetLength() - tf - 1); cs = cs.Left(tf); if (!bEnab) { if (!bSelect) { CRect rcText1(rcText); rcText1.InflateRect(-1,-1); pDC->SetTextColor(cr3dHilight); pDC->DrawText(cs, rcText1, DT_VCENTER|DT_LEFT); pDC->DrawText(cs1, rcText1, DT_VCENTER|DT_RIGHT); pDC->SetTextColor(crGrayText); pDC->DrawText(cs, rcText, DT_VCENTER|DT_LEFT); pDC->DrawText(cs1, rcText, DT_VCENTER|DT_RIGHT); } else { pDC->SetTextColor(crMenu); pDC->DrawText(cs, rcText, DT_VCENTER|DT_LEFT); pDC->DrawText(cs1, rcText, DT_VCENTER|DT_RIGHT); } } else { pDC->DrawText(cs, rcText, DT_VCENTER|DT_LEFT); pDC->DrawText(cs1, rcText, DT_VCENTER|DT_RIGHT); } } else { if (!bEnab) { if (!bSelect) { CRect rcText1(rcText); rcText1.InflateRect(-1,-1); pDC->SetTextColor(cr3dHilight); pDC->DrawText(cs, rcText1, DT_VCENTER|DT_LEFT|DT_EXPANDTABS); pDC->SetTextColor(crGrayText); pDC->DrawText(cs, rcText, DT_VCENTER|DT_LEFT|DT_EXPANDTABS); } else { pDC->SetTextColor(crMenu); pDC->DrawText(cs, rcText, DT_VCENTER|DT_LEFT|DT_EXPANDTABS); } } else pDC->DrawText(cs, rcText, DT_VCENTER|DT_LEFT|DT_EXPANDTABS); } pDC->SetTextColor(ocr); pDC->SetBkMode(obk); } pDC->SelectObject(of); } } }
void CDisplayView::drawofl(void) { CFrame *parentframe = getParent(); if(!parentframe) return; CDrawContext *srccon; long dsplw,dsplh; #if 1 // quantise near-grey to grey for transparent-draw // could be removed if q'ed bitmap is compiled to resource if(stConverted==false) { stConverted = true; srccon = new CDrawContext(parentframe,0); COffscreenContext *charcon; CColor pcl; int w,h; for(int nf=0; nf<kNumFtTypes; nf++) { dsplw = stFonts[nf].font->getWidth(); dsplh = stFonts[nf].font->getHeight(); charcon = new COffscreenContext(srccon,stFonts[nf].font,true); CPoint cp = CPoint(0,0); CRect cr = CRect(0,0, dsplw,dsplh); stFonts[nf].font->draw(charcon, cr, cp ); for(w=0; w<dsplw; w++) { for(h=0; h<dsplh; h++) { #define RNG 14 pcl = charcon->getPoint(CPoint(w,h)); if( pcl.red==128 && pcl.green==128 && pcl.blue==128 ) continue; if(pcl.red<(128-RNG) || pcl.red>128+RNG) continue; if(pcl.green<(128-RNG) || pcl.green>128+RNG) continue; if(pcl.blue<(128-RNG) || pcl.blue>128+RNG) continue; pcl.red=pcl.green=pcl.blue = 128; charcon->drawPoint(CPoint(w,h), pcl); } } delete charcon; } delete srccon; } #endif #if 0 // 0=PixelDrawing, else transparent drawing COffscreenContext *charcon; CPoint cp; CRect cr; char c; dsplw = mDsplBmp->getWidth(); dsplh = mDsplBmp->getHeight(); CBitmap *bgnd = parentframe->getBackground(); // get fresh background image cp = CPoint(size.left+mXAlign,size.top+mYAlign); cr = CRect(0,0,dsplw,dsplh); srccon = new CDrawContext(parentframe,0); COffscreenContext *dspcon = new COffscreenContext(srccon,mDsplBmp,true); bgnd->draw(dspcon, cr, cp); // get fresh font image cp = CPoint(0,0); cr = CRect(0,0, mFontBmp->getWidth(),mFontBmp->getHeight()); charcon = new COffscreenContext(parentframe,mFontBmp->getWidth(),mFontBmp->getHeight()); CColor scl,dcl; mFontBmp->draw(charcon, cr, cp ); for(int i=0; i<mCharsfit && (c = mText[i]); i++) { int h,w,wd = i*mPaintWidth; int ws = (c - 33) * mCharWidth; // left position in font if(ws < 0) { continue; } for(w=0,ws+=mCharOfs; w<(mCharWidth-mCharOfs); w++,ws++,wd++) { for(h=0; h<dsplh; h++) { scl = charcon->getPoint(CPoint(ws,h)); if( scl.red==128 && scl.green==128 && scl.blue==128 ) continue; dcl = dspcon->getPoint(CPoint(wd,h)); dcl.red = stClip[scl.red + (scl.red>>1) + dcl.red]; dcl.green = stClip[scl.green + (scl.green>>1) + dcl.green]; dcl.blue = stClip[scl.blue + (scl.blue>>1) + dcl.blue]; dspcon->drawPoint(CPoint(wd,h), dcl); } } } delete srccon; delete dspcon; delete charcon; #else CPoint cp; CRect cr; char c; dsplw = mDsplBmp->getWidth(); dsplh = mDsplBmp->getHeight(); // get fresh background image CBitmap *bgnd = parentframe->getBackground(); cp = CPoint(size.left+mXAlign,size.top+mYAlign); cr = CRect(0,0,dsplw,dsplh); srccon = new CDrawContext(parentframe,0); COffscreenContext *dspcon = new COffscreenContext(srccon,mDsplBmp,true); bgnd->draw(dspcon, cr, cp); for(int i=0; i<mCharsfit && (c = mText[i]); i++) { int ws = (c - 33) * mCharWidth; // left position in font if(ws < 0) { continue; } CPoint dp = CPoint(ws+mCharOfs,0); CRect dr = CRect(i*mPaintWidth,0, i*mPaintWidth+mCharWidth,dsplh); mFontBmp->drawTransparent(dspcon, dr, dp); } delete srccon; delete dspcon; #endif m1stSight = false; setDirty(true); }
void CSAPrefsStatic::MakeCaptionBitmap() { if (m_bm.m_hObject) return; // already have bitmap; return CRect cr; GetClientRect(cr); int w = cr.Width(); int h = cr.Height(); // Create bitmap same size as caption area and select into memory DC // CWindowDC dcWin(this); CDC dc; dc.CreateCompatibleDC(&dcWin); m_bm.DeleteObject(); m_bm.CreateCompatibleBitmap(&dcWin, w, h); CBitmap* pOldBitmap = dc.SelectObject(&m_bm); COLORREF clrBG = ::GetSysColor(COLOR_3DFACE); // background color int r = GetRValue(clrBG); // red.. int g = GetGValue(clrBG); // ..green int b = GetBValue(clrBG); // ..blue color vals int x = 8*cr.right/8; // start 5/6 of the way right int w1 = x - cr.left; // width of area to shade int NCOLORSHADES = 128; // this many shades in gradient int xDelta= max( w / NCOLORSHADES , 1); // width of one shade band PaintRect(dc, x, 0, cr.right-x, h, clrBG); while (x > xDelta) { // paint bands right to left x -= xDelta; // next band int wmx2 = (w1-x)*(w1-x); // w minus x squared int w2 = w1*w1; // w squared PaintRect(dc, x, 0, xDelta, h, RGB(r-(r*wmx2)/w2, g-(g*wmx2)/w2, b-(b*wmx2)/w2)); } PaintRect(dc,0,0,x,h,RGB(0,0,0)); // whatever's left ==> black // draw the 'constant' text // create a font, if we need to if (m_nameFont.GetSafeHandle()==NULL) { m_nameFont.CreateFont( 18, 0, 0, 0, FW_BOLD, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_MODERN, m_csFontName); } CFont * OldFont = dc.SelectObject(&m_nameFont); // back up a little cr.right-=5; // draw text in DC dc.SetBkMode(TRANSPARENT); dc.SetTextColor( ::GetSysColor( COLOR_3DHILIGHT)); dc.DrawText( m_csConstantText, cr + CPoint(1,1), DT_SINGLELINE | DT_RIGHT | DT_VCENTER); dc.SetTextColor( ::GetSysColor( COLOR_3DSHADOW)); dc.DrawText( m_csConstantText, cr, DT_SINGLELINE | DT_RIGHT | DT_VCENTER); // restore old font dc.SelectObject(OldFont); // Restore DC dc.SelectObject(pOldBitmap); }
CPoint operator+(const GLfloat &K) const { return CPoint(x+K,y+K,z+K); };
#include "stdafx.h" #include "ScribApp.h" #ifdef _MANAGED MyScribDoc::MyScribDoc(CScribbleDoc * scribDoc) { m_ScribDoc = scribDoc; } void MyScribDoc::DrawLine(Point ^ p1, Point ^ p2) { CStroke * pStroke = m_ScribDoc->NewStroke(); pStroke->m_pointArray.Add(CPoint(p1->X, p1->Y)); pStroke->m_pointArray.Add(CPoint(p2->X, p2->Y)); pStroke->FinishStroke(); m_ScribDoc->UpdateAllViews(NULL, 0L, pStroke); } void MyScribDoc::SetPenColor(Color c) { m_ScribDoc->SetPenColor(RGB(c.R, c.G, c.B)); } Color MyScribDoc::GetPenColor() {
/** Diviser toutes les composantes par un scalaire. * @param div Scalaire. */ virtual CPoint operator/(GLfloat div) const { return CPoint(x/div,y/div,z/div); }
//------------------------------------------------------------------------ //! Reacts to clicking on the cell image, and switch to the next image index //! //! @param owner The list control starting edit //! @param nRow The index of the row for the cell to edit //! @param nCol The index of the column for the cell to edit //! @param pt The position clicked, in client coordinates. //! @return Pointer to the cell editor to use (NULL if cell edit is not possible) //------------------------------------------------------------------------ CWnd* CGridColumnTraitImage::OnEditBegin(CGridListCtrlEx& owner, int nRow, int nCol, CPoint pt) { // Check if the user used a shortcut key to edit the label if (pt==CPoint(-1,-1)) return OnEditBegin(owner, nRow, nCol); // Check if mouse click was inside the label-part of the cell CRect labelRect; if (owner.GetCellRect(nRow, nCol, LVIR_LABEL, labelRect) && labelRect.PtInRect(pt)) return OnEditBegin(owner, nRow, nCol); CRect iconRect; if (owner.GetCellRect(nRow, nCol, LVIR_ICON, iconRect) && iconRect.PtInRect(pt)) { int nOldImageIdx = owner.GetCellImage(nRow, nCol); int nNewImageIdx = FlipImageIndex(owner, nRow, nCol); if (nNewImageIdx == -1) return NULL; CString strOldImageText, strNewImageText; for(int i=0; i < m_ImageIndexes.GetSize(); ++i) { if (m_ImageIndexes.GetKeyAt(i)==nOldImageIdx) strOldImageText = m_ImageIndexes.GetValueAt(i).m_CellText; if (m_ImageIndexes.GetKeyAt(i)==nNewImageIdx) strNewImageText = m_ImageIndexes.GetValueAt(i).m_CellText; } // Send Notification to parent of ListView ctrl LV_DISPINFO dispinfo = {0}; dispinfo.hdr.hwndFrom = owner.m_hWnd; dispinfo.hdr.idFrom = (UINT_PTR)owner.GetDlgCtrlID(); dispinfo.hdr.code = LVN_ENDLABELEDIT; dispinfo.item.iItem = nRow; dispinfo.item.iSubItem = nCol; dispinfo.item.mask = LVIF_IMAGE; dispinfo.item.iImage = nNewImageIdx; if (strNewImageText!=strOldImageText) { dispinfo.item.mask |= LVIF_TEXT; dispinfo.item.pszText = strNewImageText.GetBuffer(0); dispinfo.item.cchTextMax = strNewImageText.GetLength(); } owner.GetParent()->SendMessage( WM_NOTIFY, (WPARAM)owner.GetDlgCtrlID(), (LPARAM)&dispinfo ); // Toggle all selected rows to the same image index as the one clicked if (m_ToggleSelection) { // The click event for check-boxes doesn't change selection or focus if (owner.IsRowSelected(nRow)) { POSITION pos = owner.GetFirstSelectedItemPosition(); while(pos!=NULL) { int nSelectedRow = owner.GetNextSelectedItem(pos); if (nSelectedRow==nRow) continue; // Don't flip the clicked row int nNextOldImageIdx = owner.GetCellImage(nSelectedRow, nCol); if (nNextOldImageIdx==nNewImageIdx) continue; // Already flipped // Send Notification to parent of ListView ctrl LV_DISPINFO nextDispinfo = {0}; nextDispinfo.hdr.hwndFrom = owner.m_hWnd; nextDispinfo.hdr.idFrom = (UINT_PTR)owner.GetDlgCtrlID(); nextDispinfo.hdr.code = LVN_ENDLABELEDIT; nextDispinfo.item.iItem = nSelectedRow; nextDispinfo.item.iSubItem = nCol; nextDispinfo.item.mask = LVIF_IMAGE; nextDispinfo.item.iImage = nNewImageIdx; if (strNewImageText!=strOldImageText) { nextDispinfo.item.mask |= LVIF_TEXT; nextDispinfo.item.pszText = strNewImageText.GetBuffer(0); nextDispinfo.item.cchTextMax = strNewImageText.GetLength(); } owner.GetParent()->SendMessage( WM_NOTIFY, (WPARAM)owner.GetDlgCtrlID(), (LPARAM)&nextDispinfo ); } } } } else if (nCol==0 && m_ToggleSelection && owner.GetExtendedStyle() & LVS_EX_CHECKBOXES) { // Check if we should toggle the label-column checkboxes for all the selected rows if (!labelRect.PtInRect(pt)) { // The click event for check-boxes doesn't change selection or focus if (owner.IsRowSelected(nRow)) { BOOL bChecked = FALSE; if (owner.GetStyle() & LVS_OWNERDATA) bChecked = owner.OnOwnerDataDisplayCheckbox(nRow) ? TRUE : FALSE; else bChecked = owner.GetCheck(nRow); // The clicked row have already been changed by the click-event. We flip the other rows POSITION pos = owner.GetFirstSelectedItemPosition(); while(pos!=NULL) { int nSelectedRow = owner.GetNextSelectedItem(pos); if (nSelectedRow==nRow) continue; // Don't flip the clicked row if (owner.GetStyle() & LVS_OWNERDATA) { BOOL bSelChecked = owner.OnOwnerDataDisplayCheckbox(nSelectedRow) ? TRUE : FALSE; if (bChecked==bSelChecked) continue; // Already flipped } else { if (owner.GetCheck(nSelectedRow)==bChecked) continue; // Already flipped } if (owner.GetStyle() & LVS_OWNERDATA) owner.OnOwnerDataToggleCheckBox(nSelectedRow, bChecked ? true : false); else owner.SetCheck(nSelectedRow, bChecked); } } } } return NULL; // Editor is never really started }
/** Diviser deux points composante par composante. * @param div Scalaire. */ virtual CPoint operator/(CPoint& div) const { return CPoint(x/div.x,y/div.y,z/div.z); }
CRegPoint::CRegPoint(void) : CRegTypedBase<CPoint, CRegBase>(CPoint(0,0)) { }
static CPoint pointBetween( const CPoint* const pt1, const CPoint* const pt2 ) { return CPoint( (pt2->x + pt1->x)/2.0, (pt2->y + pt1->y)/2.0, (pt2->z + pt1->z)/2.0); }
void CDlgTipDetail::OnPaint(CDCHandle dc) { PAINTSTRUCT ps; HDC hDC = ::BeginPaint( m_hWnd, &ps ); Gdiplus::Graphics grap(hDC); Gdiplus::Image *pImg = NULL; CDC memDC(hDC); int nDownHeightPos = m_rcClient.Height() - 27; memDC.SetBkMode(TRANSPARENT); pImg = BkPngPool::Get(IDP_VUL_TIP_HEAD); grap.DrawImage(pImg, 0,0); pImg = BkPngPool::Get(IDP_VUL_TIP_DOWN); grap.DrawImage(pImg, 0, nDownHeightPos); pImg = BkPngPool::Get(IDP_VUL_TIP_CLOSE); if (m_nCloseState == -1) { grap.DrawImage(pImg, m_rcCloseBtn.left, m_rcCloseBtn.top); } CRect rcGrant(0,84, DEF_VUL_TIP_DETAIL_WIDTH, nDownHeightPos); _DrawGradualColorRect(memDC, rcGrant,RGB(0xE4, 0xF0, 0xFE), RGB(0xD7, 0xE6, 0xF9), TRUE); _DrawLine(memDC, CPoint(0,0), CPoint(0,m_rcClient.Height()), RGB(0x87, 0x98, 0xA8)); _DrawLine(memDC, CPoint(DEF_VUL_TIP_DETAIL_WIDTH - 1, 0), CPoint(DEF_VUL_TIP_DETAIL_WIDTH - 1, m_rcClient.Height()), RGB(0x87, 0x98, 0xA8)); HFONT hHeadFont = BkFontPool::GetFont(TRUE, FALSE, FALSE, 1); HFONT hNormalFont = BkFontPool::GetFont(FALSE, FALSE, FALSE); CString strTitle; CString strTmp = BkString::Get(IDS_VULFIX_5019); FormatKBString(m_pItemData->nID, strTitle); strTitle = strTmp + _T(":") + strTitle; CRect rcText(13, 10, 220, 25); CRect rcTemp; _DrawText(memDC, rcText, strTitle, RGB(0x0, 0x0, 0x0), hHeadFont); rcText.SetRect(15, 32, 200, 47); strTmp = BkString::Get(IDS_VULFIX_5021); strTitle = strTmp + _T(":") + m_pItemData->strPubDate; _DrawText(memDC, rcText, strTitle, RGB(0x44, 0x61, 0x83), hNormalFont); // 大小 rcText.SetRect(275,32,DEF_VUL_TIP_DETAIL_WIDTH,47); FormatSizeString(m_pItemData->nFileSize, strTitle); strTmp = BkString::Get(IDS_VULFIX_5124); strTitle = strTmp + strTitle; _DrawText(memDC, rcText, strTitle, RGB(0x44, 0x61, 0x83), hNormalFont); // 绘制小点 和 描述文字 pImg = BkPngPool::Get(IDP_VUL_TIP_POINT); CRect rcContent(15, 72, DEF_VUL_TIP_DETAIL_WIDTH, 72 + 15); if (!m_pItemData->strMSID.IsEmpty()) { grap.DrawImage(pImg, rcContent.left, rcContent.top + 5); strTmp = BkString::Get(IDS_VULFIX_5123); strTmp += m_pItemData->strMSID; rcContent.left += 10; _DrawText(memDC, rcContent, strTmp, RGB(0,0,0), hNormalFont); rcContent.top += 17; rcContent.bottom += 17; rcContent.left = 15; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; } grap.DrawImage(pImg, rcContent.left, rcContent.top + 5); rcContent.left += 10; strTmp = BkString::Get(IDS_VULFIX_5125); _DrawText(memDC, rcContent, strTmp, RGB(0,0,0), hNormalFont); rcContent.left = rcContent.right; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; CString strAff = m_pItemData->strAffects; if (strAff.GetLength() < 25) { _DrawText(memDC, rcContent, strAff, RGB(255, 0, 0), hNormalFont); } else { strTmp = strAff.Mid(0, 25); _DrawText(memDC, rcContent, strTmp, RGB(255, 0, 0), hNormalFont); strAff = strAff.Mid(25); while(1) { if (strAff.GetLength() > 0) { int len = strAff.GetLength(); rcContent.top += 17; rcContent.bottom += 17; rcContent.left = 25; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; if (strAff.GetLength() > 30) len = 30; strTmp = strAff.Mid(0, len); _DrawText(memDC, rcContent, strTmp, RGB(255, 0, 0), hNormalFont); strAff = strAff.Mid(len); } else { break; } } } // 描述 rcContent.top += 17; rcContent.bottom += 17; rcContent.left = 15; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; grap.DrawImage(pImg, rcContent.left, rcContent.top + 5); rcContent.left += 10; strTmp = BkString::Get(IDS_VULFIX_5172); _DrawText(memDC, rcContent, strTmp, RGB(0,0,0), hNormalFont); rcContent.left = rcContent.right; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; CString strDes = m_pItemData->strDesc; if (strDes.GetLength() < 25) { _DrawText(memDC, rcContent, strDes, RGB(0, 0, 0), hNormalFont); } else { HFONT oldFont = memDC.SelectFont(hNormalFont);; int len = 25; strTmp = strDes.Mid(0, len); int nCount = 0; while(1) { CSize nSize; memDC.GetTextExtent(strTmp, -1, &nSize); if (rcContent.left + nSize.cx < DEF_VUL_TIP_DETAIL_WIDTH - 30) { if (len < strDes.GetLength()) { ++len; strTmp = strDes.Mid(0, len); } else { break; } } else break; } _DrawText(memDC, rcContent, strTmp, RGB(0, 0, 0), hNormalFont); strDes = strDes.Mid(len); while(1) { if (nCount >= 2) { break; } if (strDes.GetLength() > 0) { int len = strDes.GetLength(); rcContent.left = 25; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; if (strDes.GetLength() > 30) len = 30; else break; strTmp = strDes.Mid(0, len); // 文字可能是混合的,从个数到计算长度来确定本行的个数。 while(1) { CSize nSize; memDC.GetTextExtent(strTmp, -1, &nSize); if (rcContent.left + nSize.cx < DEF_VUL_TIP_DETAIL_WIDTH - 30) { if (len < strDes.GetLength()) { ++len; strTmp = strDes.Mid(0, len); } else { break; } } else break; } if (len == strDes.GetLength()) break; rcContent.top += 17; rcContent.bottom += 17; _DrawText(memDC, rcContent, strTmp, RGB(0, 0, 0), hNormalFont); strDes = strDes.Mid(len); } else { break; } nCount ++; } memDC.SelectFont(oldFont); } CSize nSize; rcContent.top += 17; rcContent.bottom += 17; rcContent.left = 25; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; memDC.GetTextExtent(strDes, -1, &nSize); if (rcContent.left + nSize.cx > DEF_VUL_TIP_DETAIL_WIDTH - 90) rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH - 90; _DrawText(memDC, rcContent, strDes, RGB(0, 0, 0), hNormalFont); rcContent.left = rcContent.right; rcContent.right = DEF_VUL_TIP_DETAIL_WIDTH; _DrawText(memDC, rcContent, BkString::Get(IDS_VULFIX_5128), RGB(0x33, 0x62, 0x9A), BkFontPool::GetFont(FALSE, TRUE ,FALSE)); ::CopyRect(m_rcDetail, rcContent); // draw link HFONT hLinkFont = BkFontPool::GetFont(FALSE, TRUE, FALSE); CRect rcLink; COLORREF clrLink = RGB(0x33, 0x62, 0x9A); rcLink.SetRect(15, m_rcClient.Height() - 20, 300, m_rcClient.Height() - 5); _DrawText(memDC, rcLink, BkString::Get(IDS_VULFIX_5170), clrLink, hLinkFont); ::CopyRect(m_rcQuestion, rcLink); rcLink.left = 250; rcLink.right = DEF_VUL_TIP_DETAIL_WIDTH; _DrawText(memDC, rcLink, BkString::Get(IDS_VULFIX_5129), clrLink, hLinkFont); ::CopyRect(m_rcOfficial, rcLink); rcLink.left = 325; rcLink.right = DEF_VUL_TIP_DETAIL_WIDTH; _DrawText(memDC, rcLink, BkString::Get(IDS_VULFIX_5171), clrLink, hLinkFont); ::CopyRect(m_rcIgnoreVul, rcLink); ::EndPaint( m_hWnd, &ps ); }
/** * Opérateur de soustraction. Retourne la différence entre deux points. Cet opérateur doit être surchargé * dans toute classe fille de CPoint. * @param P point a soustraire au point courant. * @return Elément de type Cpoint. */ virtual CPoint operator- (const CPoint& P) const { return CPoint(x-P.x,y-P.y,z-P.z); };
void CNewHeaderCtrl::DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct ) { CDC dc; dc.Attach( lpDrawItemStruct->hDC ); // Save DC int nSavedDC = dc.SaveDC(); /* if(m_RTL) { dc.SetViewportOrg(0, 0); dc.SetMapMode(MM_TEXT); } */ // Get the column rect CRect rcLabel( lpDrawItemStruct->rcItem ); /* CTLFrame *pFrame = (CTLFrame *)GetParent(); CRect m_clientRect; pFrame->m_tree.GetClientRect(&m_clientRect); if(m_RTL) { int left = rcLabel.left; int right = rcLabel.right; rcLabel.left = m_clientRect.Width() - right; rcLabel.right = m_clientRect.Width() - left; } */ // Set clipping region to limit drawing within column CRgn rgn; rgn.CreateRectRgnIndirect( &rcLabel ); dc.SelectObject( &rgn ); rgn.DeleteObject(); // Labels are offset by a certain amount // This offset is related to the width of a space character int offset = dc.GetTextExtent(_T(" "), 1 ).cx*2; // Draw image from image list // Get the column text and format TCHAR buf[256]; HD_ITEM hditem; hditem.mask = HDI_TEXT | HDI_FORMAT; hditem.pszText = buf; hditem.cchTextMax = 255; GetItem( lpDrawItemStruct->itemID, &hditem ); // Determine format for drawing column label UINT uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER | DT_END_ELLIPSIS ; if( hditem.fmt & HDF_CENTER) uFormat |= DT_CENTER; else if( hditem.fmt & HDF_RIGHT) uFormat |= DT_RIGHT; else uFormat |= DT_LEFT; if(!(uFormat & DT_RIGHT)) { // Adjust the rect if the mouse button is pressed on it if( lpDrawItemStruct->itemState == ODS_SELECTED ) { rcLabel.left++; rcLabel.top += 2; rcLabel.right++; } rcLabel.left += offset; rcLabel.right -= offset; // Draw column label if( rcLabel.left < rcLabel.right ) dc.DrawText(buf,-1,rcLabel, uFormat); } int imageIndex; if (m_pImageList && m_mapImageIndex.Lookup( lpDrawItemStruct->itemID, imageIndex ) ) { if( imageIndex != -1 ) { if(uFormat & DT_RIGHT) // draw to the left of the label m_pImageList->Draw(&dc, imageIndex, CPoint( rcLabel.left + offset,offset/3 ), ILD_TRANSPARENT ); else // draw to the right m_pImageList->Draw(&dc, imageIndex, CPoint( rcLabel.right - dc.GetTextExtent(_T(buf), 1 ).cx*2,offset/3 ), ILD_TRANSPARENT ); // Now adjust the label rectangle IMAGEINFO imageinfo; if( m_pImageList->GetImageInfo( imageIndex, &imageinfo ) ) { rcLabel.left += offset/2 + imageinfo.rcImage.right - imageinfo.rcImage.left; } } } if(uFormat & DT_RIGHT) { // Adjust the rect if the mouse button is pressed on it if( lpDrawItemStruct->itemState == ODS_SELECTED ) { rcLabel.left++; rcLabel.top += 2; rcLabel.right++; } rcLabel.left += offset; rcLabel.right -= offset; // Draw column label if( rcLabel.left < rcLabel.right ) dc.DrawText(buf,-1,rcLabel, uFormat); } /* if(m_RTL) { dc.SetViewportOrg(m_clientRect.Width(), 0); CSize ext = dc.GetViewportExt(); ext.cx = ext.cx > 0 ? -ext.cx : ext.cx; dc.SetMapMode(MM_ANISOTROPIC); dc.SetViewportExt(ext); } */ // Restore dc dc.RestoreDC( nSavedDC ); // Detach the dc before returning dc.Detach(); }
//******************************************************************************** void CBCGPRibbonButtonsGroup::OnAfterChangeRect (CDC* pDC) { ASSERT_VALID (this); BOOL bIsFirst = TRUE; const BOOL bIsOnStatusBar = IsStatusBarMode(); const BOOL bIsQATOnBottom = IsQAT () && !m_pRibbonBar->IsQuickAccessToolbarOnTop (); const int nMarginX = IsQAT () ? 2 : 0; const int nMarginTop = bIsQATOnBottom ? 2 : bIsOnStatusBar ? 1 : 0; const int nMarginBottom = (IsQAT () || bIsOnStatusBar) ? 1 : 0; const int nButtonHeight = m_rect.Height () - nMarginTop - nMarginBottom; CRect rectGroup = m_rect; if (!IsQAT() && !bIsOnStatusBar && m_pParentMenu == NULL) { rectGroup.DeflateRect(CBCGPVisualManager::GetInstance ()->GetRibbonButtonsGroupHorzMargin(), 0); } int x = rectGroup.left + nMarginX; int nCustomizeButtonIndex = -1; if (IsQAT () && m_arButtons.GetSize () > 0) { //--------------------------------------------- // Last button is customize - it always visible. // Leave space for it: //--------------------------------------------- nCustomizeButtonIndex = (int) m_arButtons.GetSize () - 1; CBCGPBaseRibbonElement* pButton = m_arButtons [nCustomizeButtonIndex]; ASSERT_VALID (pButton); CSize sizeButton = pButton->GetSize (pDC); rectGroup.right -= sizeButton.cx; } BOOL bHasHiddenItems = FALSE; for (int i = 0; i < m_arButtons.GetSize (); i++) { CBCGPBaseRibbonElement* pButton = m_arButtons [i]; ASSERT_VALID (pButton); pButton->m_bShowGroupBorder = TRUE; if (pButton->m_pRibbonBar != NULL && !pButton->m_pRibbonBar->IsShowGroupBorder (this)) { pButton->m_bShowGroupBorder = FALSE; } if (m_rect.IsRectEmpty ()) { pButton->m_rect = CRect (0, 0, 0, 0); pButton->OnAfterChangeRect (pDC); continue; } BOOL bIsLast = i == m_arButtons.GetSize () - 1; pButton->SetParentCategory (m_pParent); CSize sizeButton = pButton->GetSize (pDC); sizeButton.cy = i != nCustomizeButtonIndex ? nButtonHeight : nButtonHeight - 1; const int y = i != nCustomizeButtonIndex ? rectGroup.top + nMarginTop : rectGroup.top; pButton->m_rect = CRect (CPoint (x, y), sizeButton); const BOOL bIsHiddenSeparator = bHasHiddenItems && pButton->IsSeparator (); if ((pButton->m_rect.right > rectGroup.right || bIsHiddenSeparator) && i != nCustomizeButtonIndex) { pButton->m_rect = CRect (0, 0, 0, 0); bHasHiddenItems = TRUE; } else { x += sizeButton.cx; } pButton->OnAfterChangeRect (pDC); if (bIsFirst && bIsLast) { pButton->m_Location = RibbonElementSingleInGroup; } else if (bIsFirst) { pButton->m_Location = RibbonElementFirstInGroup; } else if (bIsLast) { pButton->m_Location = RibbonElementLastInGroup; } else { pButton->m_Location = RibbonElementMiddleInGroup; } bIsFirst = FALSE; } }
void CPropTreeList::OnKeyDown(UINT nChar, UINT, UINT) { CPropTreeItem* pItem; ASSERT(m_pProp!=NULL); if (m_pProp->IsDisableInput() || !m_pProp->IsWindowEnabled()) return; switch (nChar) { case VK_RETURN: if ((pItem = m_pProp->GetFocusedItem())!=NULL && !pItem->IsRootLevel() && !pItem->IsReadOnly()) { pItem->Activate(CPropTreeItem::ACTIVATE_TYPE_KEYBOARD, CPoint(0,0)); } break; case VK_HOME: if (m_pProp->FocusFirst()) Invalidate(); break; case VK_END: if (m_pProp->FocusLast()) Invalidate(); break; case VK_LEFT: if ((pItem = m_pProp->GetFocusedItem())!=NULL) { if (!m_pProp->SendNotify(PTN_ITEMEXPANDING, pItem)) { if (pItem->GetChild() && pItem->IsExpanded()) { pItem->Expand(FALSE); UpdateResize(); Invalidate(); UpdateWindow(); CheckVisibleFocus(); break; } } } else break; // pass thru to next case VK_UP case VK_UP: if (m_pProp->FocusPrev()) Invalidate(); break; case VK_RIGHT: if ((pItem = m_pProp->GetFocusedItem())!=NULL) { if (!m_pProp->SendNotify(PTN_ITEMEXPANDING, pItem)) { if (pItem->GetChild() && !pItem->IsExpanded()) { pItem->Expand(); UpdateResize(); Invalidate(); UpdateWindow(); CheckVisibleFocus(); break; } } } else break; // pass thru to next case VK_DOWN case VK_DOWN: if (m_pProp->FocusNext()) Invalidate(); break; } }
bool CView::HandleMessage(CMessage* pMessage) { bool bHandled = false; if (pMessage) { switch(pMessage->MessageType()) { case CMessage::APP_PAINT : if (pMessage->Destination() == this || pMessage->Destination() == 0) { vid_plugin->lock(); SDL_Surface* pFloatingSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, m_pScreenSurface->w, m_pScreenSurface->h, CApplication::Instance()->GetBitsPerPixel(), 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); PaintToSurface(*m_pScreenSurface, *pFloatingSurface, CPoint(0, 0)); // judb use entire application SDL surface (otherwise strange clipping effects occur // when moving frames, also clipping of listboxes.) // SDL_Rect SourceRect = CRect(m_WindowRect.SizeRect()).SDLRect(); SDL_Rect SourceRect = CRect(0, 0, m_pScreenSurface->w, m_pScreenSurface->h).SDLRect(); // SDL_Rect DestRect = CRect(m_WindowRect.SizeRect()).SDLRect(); SDL_Rect DestRect = CRect(0, 0, m_pScreenSurface->w, m_pScreenSurface->h).SDLRect(); SDL_BlitSurface(pFloatingSurface, &SourceRect, m_pScreenSurface, &DestRect); SDL_FreeSurface(pFloatingSurface); //SDL_UpdateRect(m_pScreenSurface, 0, 0, 0, 0); vid_plugin->unlock(); vid_plugin->flip(); bHandled = true; } break; case CMessage::APP_DESTROY_FRAME: if (pMessage->Destination() == this || pMessage->Destination() == 0) { CFrame* pFrame = dynamic_cast<CFrame*>(const_cast<CMessageClient*>(pMessage->Source())); if (pFrame) { pFrame->SetModal(false); pFrame->SetNewParent(0); CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, 0, this)); delete pFrame; } bHandled = true; } break; case CMessage::CTRL_RESIZE: { TPointMessage* pResizeMessage = dynamic_cast<TPointMessage*>(pMessage); if (pResizeMessage && pResizeMessage->Source() == CApplication::Instance()) { CWindow::SetWindowRect(CRect(m_WindowRect.TopLeft(), m_WindowRect.TopLeft() + pResizeMessage->Value())); Uint32 iFlags = SDL_SWSURFACE | SDL_ANYFORMAT; if(m_bResizable) { iFlags |= SDL_RESIZABLE; } m_ClientRect = CRect(m_ClientRect.Left(), m_ClientRect.Top(), m_WindowRect.Width(), m_WindowRect.Height()); m_ClientRect.ClipTo(m_WindowRect.SizeRect()); m_pScreenSurface = SDL_SetVideoMode(m_WindowRect.Width(), m_WindowRect.Height(), DEFAULT_BPP, iFlags); if (m_pScreenSurface == NULL) throw( Wg_Ex_SDL(std::string("Could not set video mode : ") + SDL_GetError()) ); bHandled = true; } break; } case CMessage::MOUSE_BUTTONDOWN: { CMouseMessage* pMouseMessage = dynamic_cast<CMouseMessage*>(pMessage); if (pMouseMessage && m_WindowRect.HitTest(pMouseMessage->Point) == CRect::RELPOS_INSIDE) { if (!m_pFloatingWindow || !m_pFloatingWindow->OnMouseButtonDown(pMouseMessage->Point, pMouseMessage->Button)) { if (pMouseMessage->Destination() == 0) { OnMouseButtonDown(pMouseMessage->Point, pMouseMessage->Button); } else if (dynamic_cast<const CWindow*>(pMouseMessage->Destination())) { const_cast<CWindow*>(static_cast<const CWindow*>(pMouseMessage->Destination()))-> OnMouseButtonDown(pMouseMessage->Point, pMouseMessage->Button); } } } break; } case CMessage::MOUSE_BUTTONUP: { CMouseMessage* pMouseMessage = dynamic_cast<CMouseMessage*>(pMessage); if (pMouseMessage && m_WindowRect.HitTest(pMouseMessage->Point) == CRect::RELPOS_INSIDE) { if (!m_pFloatingWindow || !m_pFloatingWindow->OnMouseButtonUp(pMouseMessage->Point, pMouseMessage->Button)) { if (pMouseMessage->Destination() == 0) { OnMouseButtonUp(pMouseMessage->Point, pMouseMessage->Button); } else if (dynamic_cast<const CWindow*>(pMouseMessage->Destination())) { const_cast<CWindow*>(static_cast<const CWindow*>(pMouseMessage->Destination()))-> OnMouseButtonUp(pMouseMessage->Point, pMouseMessage->Button); } } } break; } default : bHandled = CWindow::HandleMessage(pMessage); break; } } return bHandled; }
void CWndFriendCtrl::OnDraw( C2DRender* p2DRender ) { #if __VER >= 11 // __SYS_PLAYER_DATA CPlayerDataCenter* pPlayerDataCenter = CPlayerDataCenter::GetInstance(); #endif // __SYS_PLAYER_DATA CPoint pt( 3, 3 ); m_nDrawCount = 0; memset( m_nServerCount, 0, sizeof( m_nServerCount ) ); if( NULL == g_pPlayer ) return; // Draw Max Count int nMax = GetDrawCount(); CWndWorld* pWndWorld = (CWndWorld*)g_WndMng.GetWndBase( APP_WORLD ); TEXTUREVERTEX2* pVertex = new TEXTUREVERTEX2[ 6 * 3 * nMax ]; TEXTUREVERTEX2* pVertices = pVertex; C2FriendPtr::iterator iter = g_WndMng.m_Messenger.m_aFriend.begin(); // for( int i = 0; i < m_wndScrollBar.GetScrollPos() && iter != g_WndMng.m_Messenger.m_aFriend.end(); i++, iter++, m_nDrawCount++ ); int i = 0; m_nDrawCount = m_wndScrollBar.GetScrollPos(); // Draw Select for( ; iter != g_WndMng.m_Messenger.m_aFriend.end() ; ++iter ) { LPFRIEND lpFriend = (LPFRIEND)iter->second; int nMuilti = lpFriend->m_uIdofMulti -1; if( lpFriend->m_uIdofMulti == 100 || lpFriend->dwState == FRS_OFFLINE ) // logOff Last Draw { m_uServerPlayerId[10][m_nServerCount[10]] = lpFriend->dwUserId; ++m_nServerCount[10]; } else // Multi Server { m_uServerPlayerId[nMuilti][m_nServerCount[nMuilti]] = lpFriend->dwUserId; ++m_nServerCount[nMuilti]; } } // My Multi Draw int nMyMuilti = g_Neuz.m_uIdofMulti - 1; for( int j = 0 ; j < m_nServerCount[nMyMuilti] && i < nMax; ++j, ++i ) { if( i < m_nDrawCount ) continue; LPFRIEND lpFriend = g_WndMng.m_Messenger.GetFriend( m_uServerPlayerId[nMyMuilti][j] ); DWORD dwState; // 상태에 따라 색 변경 DWORD dwColor = 0xff000000; if( i == m_nCurSelect ) dwColor = 0xff6060ff; int x = 0, nWidth = m_rectClient.Width();// - 1; CRect rect( x, pt.y, x + nWidth, pt.y + m_nFontHeight ); rect.SetRect( x + 3, pt.y + 6, x + 3 + 32, pt.y + 6 + 32 ); if( lpFriend->dwState == FRS_AUTOABSENT ) { dwState = FRS_ABSENT; } else { if( lpFriend->dwState == FRS_OFFLINEBLOCK ) dwState = FRS_OFFLINE; else dwState = lpFriend->dwState; } CString string; if( lpFriend->dwState == FRS_ONLINE || lpFriend->dwState == FRS_OFFLINE || lpFriend->dwState == FRS_OFFLINEBLOCK ) { if( lpFriend->dwState == FRS_OFFLINEBLOCK ) { #if __VER >= 11 // __SYS_PLAYER_DATA string.Format( "%s(%s)", pPlayerDataCenter->GetPlayerString( lpFriend->dwUserId ), prj.GetText( TID_FRS_ONLINE + 2 ) ); #else // __SYS_PLAYER_DATA string.Format( "%s(%s)", lpFriend->szName, prj.GetText( TID_FRS_ONLINE + 2 ) ); #endif // __SYS_PLAYER_DATA dwColor = 0xff000000; } else { #if __VER >= 11 // __SYS_PLAYER_DATA string = pPlayerDataCenter->GetPlayerString( lpFriend->dwUserId ); #else // __SYS_PLAYER_DATA string = lpFriend->szName; #endif // __SYS_PLAYER_DATA } } else { #if __VER >= 11 // __SYS_PLAYER_DATA string.Format( "%s(%s)", pPlayerDataCenter->GetPlayerString( lpFriend->dwUserId ), prj.GetText( TID_FRS_ONLINE + dwState ) ); #else // __SYS_PLAYER_DATA string.Format( "%s(%s)", lpFriend->szName, prj.GetText( TID_FRS_ONLINE + dwState ) ); #endif // __SYS_PLAYER_DATA } p2DRender->TextOut( x + 40, pt.y + 3, string, dwColor ); #if __VER >= 11 // __SYS_PLAYER_DATA PlayerData* pPlayerData = pPlayerDataCenter->GetPlayerData( lpFriend->dwUserId ); LONG nJob = pPlayerData->nJob; BYTE nSex = pPlayerData->nSex; #else // __SYS_PLAYER_DATA LONG nJob = lpFriend->nJob; BYTE nSex = lpFriend->nSex; #endif // __SYS_PLAYER_DATA if( dwState == FRS_OFFLINE ) { if( MAX_EXPERT <= nJob ) { #if __VER >= 10 // __LEGEND if( MAX_PROFESSIONAL <= nJob && nJob < MAX_MASTER ) pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), ( 70 + nJob - 16 ) + ( 8 * nSex ), &pVertices, 0xffff6464 ); else if( MAX_MASTER <= nJob ) pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), ( 70 + nJob - 24 ) + ( 8 * nSex ), &pVertices, 0xffff6464 ); else #endif //__LEGEND pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), ( 66 + nJob - 6 ) + ( 8 * nSex ), &pVertices, 0xffff6464 ); } else { pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), 12 + nJob + ( 6 * nSex ), &pVertices, 0xffff6464 ); } } else { if( MAX_EXPERT <= nJob ) { #if __VER >= 10 // __LEGEND if( MAX_PROFESSIONAL <= nJob && nJob < MAX_MASTER ) pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), ( 70 + nJob - 16 ) + ( 8 * nSex ), &pVertices, 0xffffffff ); else if( MAX_MASTER <= nJob ) pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), ( 70 + nJob - 24 ) + ( 8 * nSex ), &pVertices, 0xffffffff ); else #endif //__LEGEND pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), ( 70 + nJob - 6 ) + ( 8 * nSex ), &pVertices, 0xffffffff ); } else { pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), 12 + nJob + ( 6 * nSex ), &pVertices, 0xffffffff ); } if( dwState != FRS_ONLINE ) { pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 12, pt.y + 10 ), 33 + ( dwState - 2 ), &pVertices, 0xffffffff ); } if( lpFriend->m_uIdofMulti != 100 ) { pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 21, pt.y ), 38 + lpFriend->m_uIdofMulti, &pVertices, 0xffffffff ); } } pt.y += m_nFontHeight;// + 3; } // Differ Multi Draw for( j = 0 ; j < 11 ; ++j ) { if( j == nMyMuilti ) continue; for( int k = 0 ; k < m_nServerCount[j] && i < nMax ; ++k , ++i ) { if( i < m_nDrawCount ) continue; u_long uFriendId = m_uServerPlayerId[j][k]; LPFRIEND lpFriend = g_WndMng.m_Messenger.GetFriend( uFriendId ); DWORD dwState; // 상태에 따라 색 변경 DWORD dwColor = 0xff000000; if( i == m_nCurSelect ) dwColor = 0xff6060ff; int x = 0, nWidth = m_rectClient.Width();// - 1; CRect rect( x, pt.y, x + nWidth, pt.y + m_nFontHeight ); rect.SetRect( x + 3, pt.y + 6, x + 3 + 32, pt.y + 6 + 32 ); if( lpFriend->dwState == FRS_AUTOABSENT ) { dwState = FRS_ABSENT; } else { if( lpFriend->dwState == FRS_OFFLINEBLOCK ) dwState = FRS_OFFLINE; else dwState = lpFriend->dwState; } CString string; if( lpFriend->dwState == FRS_ONLINE || lpFriend->dwState == FRS_OFFLINE || lpFriend->dwState == FRS_OFFLINEBLOCK ) { if( lpFriend->dwState == FRS_OFFLINEBLOCK ) { #if __VER >= 11 // __SYS_PLAYER_DATA string.Format( "%s(%s)", pPlayerDataCenter->GetPlayerString( lpFriend->dwUserId ), prj.GetText( TID_FRS_ONLINE + 2 ) ); #else // __SYS_PLAYER_DATA string.Format( "%s(%s)", lpFriend->szName, prj.GetText( TID_FRS_ONLINE + 2 ) ); #endif // __SYS_PLAYER_DATA dwColor = 0xff000000; } else { #if __VER >= 11 // __SYS_PLAYER_DATA string = pPlayerDataCenter->GetPlayerString( lpFriend->dwUserId ); #else // __SYS_PLAYER_DATA string = lpFriend->szName; #endif // __SYS_PLAYER_DATA } } else { #if __VER >= 11 // __SYS_PLAYER_DATA string.Format( "%s(%s)", pPlayerDataCenter->GetPlayerString( lpFriend->dwUserId ), prj.GetText( TID_FRS_ONLINE + dwState ) ); #else // __SYS_PLAYER_DATA string.Format( "%s(%s)", lpFriend->szName, prj.GetText( TID_FRS_ONLINE + dwState ) ); #endif // __SYS_PLAYER_DATA } p2DRender->TextOut( x + 40, pt.y + 3, string, dwColor ); #if __VER >= 11 // __SYS_PLAYER_DATA PlayerData* pPlayerData = pPlayerDataCenter->GetPlayerData( lpFriend->dwUserId ); LONG nJob = pPlayerData->nJob; BYTE nSex = pPlayerData->nSex; #else // __SYS_PLAYER_DATA LONG nJob = lpFriend->nJob; BYTE nSex = lpFriend->nSex; #endif // __SYS_PLAYER_DATA if( dwState == FRS_OFFLINE ) { if( MAX_EXPERT <= nJob ) { #if __VER >= 10 // __LEGEND if( MAX_PROFESSIONAL <= nJob && nJob < MAX_MASTER ) pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), ( 70 + nJob - 16 ) + ( 8 * nSex ), &pVertices, 0xffff6464 ); else if( MAX_MASTER <= nJob ) pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), ( 70 + nJob - 24 ) + ( 8 * nSex ), &pVertices, 0xffff6464 ); else #endif //__LEGEND pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), ( 70 + nJob - 6 ) + ( 8 * nSex ), &pVertices, 0xffff6464 ); } else { pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), 12 + nJob + ( 6 * nSex ), &pVertices, 0xffff6464 ); } } else { if( MAX_EXPERT <= nJob ) { #if __VER >= 10 // __LEGEND if( MAX_PROFESSIONAL <= nJob && nJob < MAX_MASTER ) pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), ( 70 + nJob - 16 ) + ( 8 * nSex ), &pVertices, 0xffffffff ); else if( MAX_MASTER <= nJob ) pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), ( 70 + nJob - 24 ) + ( 8 * nSex ), &pVertices, 0xffffffff ); else #endif //__LEGEND pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), ( 70 + nJob - 6 ) + ( 8 * nSex ), &pVertices, 0xffffffff ); } else { pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 2, pt.y ), 12 + nJob + ( 6 * nSex ), &pVertices, 0xffffffff ); } if( dwState != FRS_ONLINE ) { pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 12, pt.y + 10 ), 33 + ( dwState - 2 ), &pVertices, 0xffffffff ); } if( lpFriend->m_uIdofMulti != 100 ) { pWndWorld->m_texMsgIcon.MakeVertex( p2DRender, CPoint( 21, pt.y ), 38 + lpFriend->m_uIdofMulti, &pVertices, 0xffffffff ); } } pt.y += m_nFontHeight;// + 3; } } pWndWorld->m_texMsgIcon.Render( m_pApp->m_pd3dDevice, pVertex, ( (int) pVertices - (int) pVertex ) / sizeof( TEXTUREVERTEX2 ) ); SAFE_DELETE_ARRAY( pVertex ); }
CXTPPopupControl::CXTPPopupControl(BOOL bAutoDelete/*=FALSE*/) : m_bAutoDelete(bAutoDelete) { //set default paint manager m_pPaintManager = new CXTPPopupThemeOffice2000(); m_paintTheme = xtpPopupThemeOffice2000; m_pPaintManager->RefreshMetrics(); //init handels and flags for mouse operation m_pSelected = NULL; m_pPressed = NULL; m_bCapture = FALSE; //default state popup window m_popupAnimation = xtpPopupAnimationNone; m_popupState = xtpPopupStateClosed; //select def transparency value m_nCurrentTransparency = m_nTransparency = 255; m_pfnSetLayeredWindowAttributes = NULL; m_pfnUpdateLayeredWindow = NULL; m_bLayered = FALSE; //init animation vars m_nAnimationInterval = 16; m_uShowDelay = 5000L; m_uAnimationDelay = 256L; m_nStep = 0; m_bRightToLeft = FALSE; m_nBackgroundBitmap = 0; //popup pos&size init m_szPopup = CSize(170, 130); m_ptPopup = CPoint(-1, -1); m_bSplashScreenMode = FALSE; //init layered function (for Win98 compatible) HMODULE hLib = GetModuleHandle(_T("USER32")); if (hLib) { m_pfnSetLayeredWindowAttributes = (PFNSETLAYEREDWINDOWATTRIBUTES) ::GetProcAddress(hLib, "SetLayeredWindowAttributes"); m_pfnUpdateLayeredWindow = (LPFNUPDATELAYEREDWINDOW) GetProcAddress(hLib, "UpdateLayeredWindow"); } m_bAllowMove = FALSE; m_pImageManager = new CXTPImageManager; m_pMarkupContext = NULL; m_nPopupLocation = xtpPopupLocationNearTaskBar; // load the system hand cursor for hyperlink items. m_hHandCursor = AfxGetApp()->LoadStandardCursor(IDC_HAND); // if not found, use the toolkit version if (m_hHandCursor == NULL) m_hHandCursor = XTPResourceManager()->LoadCursor(XTP_IDC_HAND); }