void Listlay::subrender() { Graphics *gfx = Graphics::FromImage(this->image); gfx->Clear(CLR_WHITE); Cacher *cacher = this->core->getCacher(); if( cacher != NULL ){ FwCHAR *string = NULL; FwCHAR *name = NULL; Cell *cell = NULL; int i, x, y; bool top, bot, archived = false; top = false; bot = false; x = LST_X; y = LST_Y; for( i = -CACHE_SIZE; i < CACHE_SIZE; i++ ){ cacher->lockCache(); if( cacher->getCache() != NULL ){ cell = cacher->getCache()->gettoThat(i); if( cell != NULL ){ if( cell->getFile() != NULL ){ name = cell->getFile()->getFileName(); } if( name != NULL ){ if( i == 0 ) gfx->FillRectangle(this->Brush_LiteBack,0,y+1,OVL_SIZE,FONTSIZE+2); string = name; if( cell->getFile()->isArchived() == true ){ if( archived == false ) archived = true; string = new FwCHAR(L"~"); string->mergeWith(name); x = 3*LST_X; } else if( archived == true ){ archived = false; x = LST_X; } gfx->DrawString(string->toWCHAR(), string->toLength(), this->Font_Default, PointF((REAL)x,(REAL)y), this->Brush_DarkBack); if( archived == true ) delete string; } if( i == -1 && cacher->getCache()->isThatHead() == false ) top = true; if( i == 1 && cacher->getCache()->isThatTail() == false ) bot = true; } } cacher->unlockCache(); y += (FONTSIZE + 2); } int size = 3; int width = 20; int ax = (int)(OVL_SIZE/2); int ay = LST_Y; int asize = OVL_SIZE - 2*LST_Y; Point arrow[3]; if( top == true ){ arrow[0].X = ax - width; arrow[0].Y = ay; arrow[1].X = ax; arrow[1].Y = ay - width; arrow[2].X = ax + width; arrow[2].Y = ay; gfx->FillPolygon(this->Brush_LiteBack,arrow,size); } if( bot == true ){ arrow[0].X = ax - width; arrow[0].Y = ay + asize; arrow[1].X = ax; arrow[1].Y = ay + asize + width; arrow[2].X = ax + width; arrow[2].Y = ay + asize; gfx->FillPolygon(this->Brush_LiteBack,arrow,size); } } if( this->ticker > TICKER_OFF ){ int tsize = TICKER_SIZE; int tx,ty; if( this->ticker == 0 ){ tx = OVL_SIZE - 2*TICKER_INDENT; ty = OVL_SIZE - 2*TICKER_INDENT; } if( this->ticker == 1 ){ tx = OVL_SIZE - TICKER_INDENT; ty = OVL_SIZE - 2*TICKER_INDENT; } if( this->ticker == 2 ){ tx = OVL_SIZE - TICKER_INDENT; ty = OVL_SIZE - TICKER_INDENT; } if( this->ticker == 3 ){ tx = OVL_SIZE - 2*TICKER_INDENT; ty = OVL_SIZE - TICKER_INDENT; } gfx->FillRectangle(this->Brush_DarkBack,tx,ty,tsize,tsize); } delete gfx; }
void Thumblay::subrender() { Graphics *gfx = Graphics::FromImage(this->image); gfx->Clear(CLR_WHITE); Cacher *cacher = this->core->getCacher(); if( cacher != NULL ){ Image *thumb = NULL; Cell *cell = NULL; int i, x, y, mx, my, count; bool top, bot, left, right; right = false; left = false; top = false; bot = false; mx = OVL_MARGIN + 2 * (THB_SMSIZE + THB_SPACE); my = mx; x = y = OVL_MARGIN; count = 0; for( i = -THB_COUNT - this->picker; i <= THB_COUNT - this->picker; i++ ){ cacher->lockCache(); if( cacher->getCache() != NULL ){ cell = cacher->getCache()->gettoThat(i); if( cell != NULL ){ thumb = cell->getImageThumb(); if( thumb != NULL ){ if( i != 0 ){ gfx->DrawImage(thumb,x,y,THB_SMSIZE,THB_SMSIZE); gfx->DrawRectangle(this->Pen_Border, x, y, THB_SMSIZE, THB_SMSIZE); } else { mx = x + (int)((THB_SIZE - THB_SMSIZE)/4); my = y + (int)((THB_SIZE - THB_SMSIZE)/4); } } if( i == -THB_ROW ) top = true; if( i == THB_ROW ) bot = true; if( i == -1 && cacher->getCache()->isThatHead() == false ) left = true; if( i == 1 && cacher->getCache()->isThatTail() == false ) right = true; } } count++; x += THB_SMSIZE + THB_SPACE; if( count >= THB_ROW ){ x = OVL_MARGIN; y += THB_SMSIZE + THB_SPACE; count = 0; } cacher->unlockCache(); } int frame = 2; cacher->lockCache(); if( cacher->getCache() != NULL ){ cell = cacher->getThat(); if( cell != NULL ){ thumb = cell->getImageThumb(); if( thumb != NULL ){ gfx->FillRectangle(this->Brush_Back, mx - THB_SIZE/4, my - THB_SIZE/4, THB_SIZE, THB_SIZE); gfx->DrawImage(thumb, mx - THB_SIZE/4, my - THB_SIZE/4, THB_SIZE, THB_SIZE); gfx->DrawRectangle(this->Pen_Border, mx - THB_SIZE/4, my - THB_SIZE/4, THB_SIZE, THB_SIZE); gfx->DrawRectangle( this->Pen_DarkBorder, mx - frame - THB_SIZE/4, my - frame - THB_SIZE/4, THB_SIZE + 2*frame, THB_SIZE + 2*frame ); } } } cacher->unlockCache(); int size = 3; int width = 10; int ax = (int)(mx - frame - THB_SIZE/4); int ay = (int)(my - frame - THB_SIZE/4); int asize = THB_SIZE + 2*frame; Point arrow[3]; if( top == true ){ arrow[0].X = (int)(ax + (THB_SIZE/2) - width); arrow[0].Y = ay; arrow[1].X = (int)(ax + (THB_SIZE/2)); arrow[1].Y = ay - width; arrow[2].X = (int)(ax + (THB_SIZE/2) + width); arrow[2].Y = ay; gfx->FillPolygon(this->Brush_DarkBack,arrow,size); } if( bot == true ){ arrow[0].X = (int)(ax + (THB_SIZE/2) - width); arrow[0].Y = ay + asize; arrow[1].X = (int)(ax + (THB_SIZE/2)); arrow[1].Y = ay + asize + width; arrow[2].X = (int)(ax + (THB_SIZE/2) + width); arrow[2].Y = ay + asize; gfx->FillPolygon(this->Brush_DarkBack,arrow,size); } if( left == true ){ arrow[0].X = ax; arrow[0].Y = (int)(ay + (THB_SIZE/2) - width); arrow[1].X = ax - width; arrow[1].Y = (int)(ay + (THB_SIZE/2)); arrow[2].X = ax; arrow[2].Y = (int)(ay + (THB_SIZE/2) + width); gfx->FillPolygon(this->Brush_DarkBack,arrow,size); } if( right == true ){ arrow[0].X = ax + asize; arrow[0].Y = (int)(ay + (THB_SIZE/2) - width); arrow[1].X = ax + asize + width; arrow[1].Y = (int)(ay + (THB_SIZE/2)); arrow[2].X = ax + asize; arrow[2].Y = (int)(ay + (THB_SIZE/2) + width); gfx->FillPolygon(this->Brush_DarkBack,arrow,size); } } if( this->ticker > TICKER_OFF ){ int tsize = TICKER_SIZE; int tx,ty; if( this->ticker == 0 ){ tx = OVL_SIZE - 2*TICKER_INDENT; ty = OVL_SIZE - 2*TICKER_INDENT; } if( this->ticker == 1 ){ tx = OVL_SIZE - TICKER_INDENT; ty = OVL_SIZE - 2*TICKER_INDENT; } if( this->ticker == 2 ){ tx = OVL_SIZE - TICKER_INDENT; ty = OVL_SIZE - TICKER_INDENT; } if( this->ticker == 3 ){ tx = OVL_SIZE - 2*TICKER_INDENT; ty = OVL_SIZE - TICKER_INDENT; } gfx->FillRectangle(this->Brush_DarkBack,tx,ty,tsize,tsize); } delete gfx; }
void MFCClipItemView::Draw(Graphics &dc, CRect &clipBox) { // !!!??? need to clip properly for short instances with long names cerr << "clip item draw " << item->sym->name << endl; Pen blackPen(Color(250, 0, 0, 0), 1); Pen redPen(Color(250, 238, 100, 100), 1); Pen orangePen(Color(200, 250, 150, 10), 1); SolidBrush blueBrush(Color(100, 100, 100, 238)); SolidBrush blackBrush(Color(200, 0, 0, 0)); SolidBrush orangeBrush(Color(190, 250, 150, 10)); dc.DrawLine( &orangePen, bounds.left, 0, bounds.left, bounds.bottom); bool isMarker = false; if (item != NULL && item->duration.ticks <= 0) { isMarker = true; } if (!isMarker) { dc.DrawLine( &orangePen, bounds.right, 0, bounds.right, bounds.bottom); } PointF tri[3]; Font labelFont(L"Arial", 8.0, FontStyleRegular, UnitPoint, NULL); wstring nm; const char *cp = item->sym->uniqueName(); while (*cp) { nm.push_back(*cp++); } PointF p; UINT py = 0; do { if (!isMarker) { // a triangle bit tri[0].X = bounds.left; tri[0].Y = py; tri[1].X = bounds.left+6; tri[1].Y = py+3; tri[2].X = bounds.left; tri[2].Y = py+6; dc.FillPolygon(&orangeBrush, tri, 3); } p.X = bounds.left-1; p.Y = py+5; RectF box; StringFormat sff = StringFormatFlagsDirectionVertical; dc.MeasureString(nm.c_str(), -1, &labelFont, p, &sff, &box); dc.DrawString(nm.c_str(), -1, &labelFont, box, &sff, &blackBrush); if (!isMarker) { // a nother triangle bit tri[0].X = bounds.right; tri[1].X = bounds.right-6; tri[2].X = bounds.right; dc.FillPolygon(&orangeBrush, tri, 3); p.X = bounds.right-10; p.Y = py+5; dc.MeasureString(nm.c_str(), -1, &labelFont, p, &sff, &box); dc.DrawString(nm.c_str(), -1, &labelFont, box, &sff, &blackBrush); } py += editor->bounds.bottom; } while (py < bounds.bottom); }