void tui::LayoutCanvas::OnZoom(wxCommandEvent& evt) { DBbox* box = NULL; switch (evt.GetInt()) { case ZOOM_WINDOW : box = static_cast<DBbox*>(evt.GetClientData());break; case ZOOM_WINDOWM: box = DEBUG_NEW DBbox(presspoint.x(),presspoint.y(), ScrMARK.x(),ScrMARK.y());break; case ZOOM_IN : box = DEBUG_NEW DBbox( (3*lp_BL.x() + lp_TR.x())/4, //in (3*lp_BL.y() + lp_TR.y())/4, (3*lp_TR.x() + lp_BL.x())/4, (3*lp_TR.y() + lp_BL.y())/4); break; case ZOOM_OUT : box = DEBUG_NEW DBbox( (5*lp_BL.x() - lp_TR.x())/4, //out (5*lp_BL.y() - lp_TR.y())/4, (5*lp_TR.x() - lp_BL.x())/4, (5*lp_TR.y() - lp_BL.y())/4); break; case ZOOM_LEFT : box = DEBUG_NEW DBbox( ( lp_TR.x() + lp_BL.x())/2, //left lp_BL.y() , (3*lp_BL.x() - lp_TR.x())/2, lp_TR.y() ); break; case ZOOM_RIGHT : box = DEBUG_NEW DBbox( (3*lp_TR.x() - lp_BL.x())/2, // right lp_BL.y() , ( lp_TR.x() + lp_BL.x())/2, lp_TR.y() ); break; case ZOOM_UP : box = DEBUG_NEW DBbox( lp_BL.x() , // up (3*lp_BL.y() - lp_TR.y())/2, lp_TR.x() , ( lp_TR.y() + lp_BL.y())/2); break; case ZOOM_DOWN : box = DEBUG_NEW DBbox( lp_BL.x() , // down ( lp_TR.y() + lp_BL.y())/2, lp_TR.x() , (3*lp_TR.y() - lp_BL.y())/2); break; case ZOOM_EMPTY : box = DEBUG_NEW DBbox(-10,-10,90,90); break; case ZOOM_REFRESH: invalid_window = true; Refresh(); return; default: assert(false); } int Wcl, Hcl; GetClientSize(&Wcl,&Hcl); // To prevent a loss of precision in the following lines - don't use // integer variables (Wcl & Hcl) directly double W = Wcl; double H = Hcl; double w = abs(box->p1().x() - box->p2().x()); double h = abs(box->p1().y() - box->p2().y()); double sc = ((W/H < w/h) ? w/W : h/H); double tx = ((box->p1().x() + box->p2().x()) - W*sc) / 2; double ty = ((box->p1().y() + box->p2().y()) - H*sc) / 2; _LayCTM.setCTM( sc, 0.0, 0.0, sc, tx, ty); _LayCTM.FlipX((box->p1().y() + box->p2().y())/2); // flip Y coord towards the center DATC->setScrCTM(_LayCTM.Reversed()); delete box; invalid_window = true; Refresh(); }
int tellstdfunc::stdOPENCELL::execute() { std::string nm = getStringValue(); laydata::tdtdesign* ATDB = DATC->lockDB(false); std::string oldnm = ATDB->activecellname(); telldata::ttlist* selected = NULL; if ("" != oldnm) selected = make_ttlaylist(ATDB->shapesel()); if (ATDB->opencell(nm)) { DATC->clearRulers(); if (oldnm != "") { UNDOcmdQ.push_front(this); UNDOPstack.push_front(selected); } DBbox* ovl = DEBUG_NEW DBbox(ATDB->activeoverlap()); /*-!-*/ DATC->unlockDB(); if (*ovl == DEFAULT_OVL_BOX) *ovl = DEFAULT_ZOOM_BOX; browsers::celltree_open(nm); wxCommandEvent eventZOOM(wxEVT_CANVAS_ZOOM); eventZOOM.SetInt(tui::ZOOM_WINDOW); eventZOOM.SetClientData(static_cast<void*>(ovl)); wxPostEvent(TopedCanvasW, eventZOOM); LogFile << LogFile.getFN() << "(\""<< nm << "\");"; LogFile.flush(); } else { /*-!-*/ DATC->unlockDB(); std::string news = "cell \""; news += nm; news += "\" doesn't exists"; tell_log(console::MT_ERROR,news); if (selected) delete selected; } return EXEC_NEXT; }
void layprop::SupplementaryData::getConsts(const CTM& LayCTM, DBline& long_mark, DBline& short_mark, DBline& text_bp, double& scaledpix) { // Side ticks (segments) of the rulers has to be with constant size. The next lines // are generating a segment with the size 7/3 screen pixels centered in // the {0,0} point of the canvas (logical coords) // the coeffitients 1e3/1e-3 are picked ramdomly attempting to reduce the // error const double ico = 1e3; const double dco = 1/ico; DBline tick_sample = DBline(TP(0,0),TP(0,7,ico)) * LayCTM; double tick_size = ((double)(tick_sample.p2().y()-tick_sample.p1().y())); long_mark = DBline(TP(0,-tick_size, dco),TP(0,tick_size, dco)); tick_sample = DBline(TP(0,0),TP(0,3,ico)) * LayCTM; tick_size = ((double)(tick_sample.p2().y()-tick_sample.p1().y())); short_mark = DBline(TP(0,-tick_size, dco),TP(0,tick_size, dco)); tick_sample = DBline(TP(0,0),TP(0,20,ico)) * LayCTM; tick_size = ((double)(tick_sample.p1().y()-tick_sample.p2().y())); text_bp = DBline(TP(0,0),TP(0,tick_size, dco)); // now prepare to draw the size DBbox pixelbox = DBbox(TP(),TP(15,15)) * LayCTM; scaledpix = ((double)(pixelbox.p2().x()-pixelbox.p1().x())); }
void trend::TrendBase::genRulerMarks(const CTM& LayCTM, DBline& long_mark, DBline& short_mark, DBline& text_bp, double& scaledpix) { // Side ticks (segments) of the rulers has to be with constant size. The next // lines are generating a segment with the size 7/3 screen pixels centred in // the {0,0} point of the canvas (logical coordinates) // The coefficients 1e3/1e-3 are picked arbitrary in an attempt to reduce the // error const double ico = 1e3; const double dco = 1/ico; DBline tick_sample = DBline(TP(0,0),TP(0,7,ico)) * LayCTM; double tick_size = ((double)(tick_sample.p2().y()-tick_sample.p1().y())); long_mark = DBline(TP(0,-tick_size, dco),TP(0,tick_size, dco)); tick_sample = DBline(TP(0,0),TP(0,3,ico)) * LayCTM; tick_size = ((double)(tick_sample.p2().y()-tick_sample.p1().y())); short_mark = DBline(TP(0,-tick_size, dco),TP(0,tick_size, dco)); tick_sample = DBline(TP(0,0),TP(0,20,ico)) * LayCTM; tick_size = ((double)(tick_sample.p1().y()-tick_sample.p2().y())); text_bp = DBline(TP(0,0),TP(0,tick_size, dco)); // now prepare to draw the size DBbox pixelbox = DBbox(TP(),TP(15,15)) * LayCTM; scaledpix = ((double)(pixelbox.p2().x()-pixelbox.p1().x())); }
void trend::TrendBase::grcwire (int4b* pdata, unsigned psize, WireWidth width) { // first check whether to draw only the center line DBbox wsquare = DBbox(TP(0,0),TP(width,width)); bool center_line_only = !wsquare.visible(topCTM() * scrCTM(), visualLimit()); _grcLayer->wire(pdata, psize, width, center_line_only); }
void trend::TrendBase::wirem(int4b* pdata, unsigned psize, WireWidth width, const SGBitSet* psel) { // first check whether to draw only the center line DBbox wsquare = DBbox(TP(0,0),TP(width,width)); bool center_line_only = !wsquare.visible(topCTM() * scrCTM(), visualLimit()); _clayer->wire(pdata, psize, width, center_line_only,psel,*_rmm); }
void trend::TrendBase::wiret(const PointVector& pdata, WireWidth width) { // first check whether to draw only the center line DBbox wsquare = DBbox(TP(0,0),TP(width,width)); bool center_line_only = !wsquare.visible(topCTM() * scrCTM(), visualLimit()); _clayer->wire(pdata, width, center_line_only, *_rmm); }
void tui::LayoutCanvas::OnMouseWheel(wxMouseEvent& event) { int delta = event.GetWheelDelta(); int fulldist = event.GetWheelRotation(); double scroll = fulldist / delta; wxCommandEvent eventZOOM(wxEVT_CANVAS_ZOOM); if (event.ShiftDown()) { if ( 1 <= scroll) eventZOOM.SetInt(ZOOM_UP); else if (-1 >= scroll) eventZOOM.SetInt(ZOOM_DOWN); } else if (event.ControlDown()) { if ( 1 <= scroll) eventZOOM.SetInt(ZOOM_RIGHT); else if (-1 >= scroll) eventZOOM.SetInt(ZOOM_LEFT); } else { const double scalefactor = event.AltDown() ? 0.8 : 0.5; CTM tmpmtrx; TP markerpos(event.GetX(), event.GetY()); if ( 1 <= scroll) tmpmtrx.Scale(scalefactor,scalefactor); else if (-1 >= scroll) tmpmtrx.Scale(1/scalefactor,1/scalefactor); tmpmtrx.Translate(markerpos * _LayCTM - markerpos * _LayCTM * tmpmtrx); DBbox* box = DEBUG_NEW DBbox( lp_BL, lp_TR ); (*box) = (*box) * tmpmtrx; eventZOOM.SetInt(tui::ZOOM_WINDOW); eventZOOM.SetClientData(static_cast<void*>(box)); } OnZoom(eventZOOM); PointUpdate(event.GetX(), event.GetY()); }
//tui::CanvasStatus::CanvasStatus(){}; void tui::StatusLine::update(const int4b width, const CTM& _LayCTM) { _sb_BL = TP(0,0) * _LayCTM; _sb_TR = TP(width, 30) * _LayCTM; DBbox pixelbox = DBbox(TP(),TP(14,14)) * _LayCTM; _scaledpix = ((double)(pixelbox.p2().x()-pixelbox.p1().x())); _cY = TP(width-150, 17) * _LayCTM; _cX = TP(width-300, 17) * _LayCTM; _dY = TP(width-450, 17) * _LayCTM; _dX = TP(width-600, 17) * _LayCTM; _Ycoord = DBbox(TP(width - 130, 28), TP(width - 2, 2)) * _LayCTM; _Xcoord = DBbox(TP(width - 280, 28), TP(width - 162, 2)) * _LayCTM; _wcY = TP(width-120, 16) * _LayCTM; _wcX = TP(width-270, 16) * _LayCTM; }
void tui::LayoutCanvas::update_viewport() { int W, H; GetClientSize(&W,&H); lp_BL = TP(0,0) * _LayCTM; lp_TR = TP(W, H) * _LayCTM; Properties->setClipRegion(DBbox(lp_BL.x(),lp_TR.y(), lp_TR.x(), lp_BL.y())); glClearColor(0,0,0,0); }
void tui::LayoutCanvas::update_viewport() { int W, H; GetClientSize(&W,&H); lp_BL = TP(0,0) * _LayCTM; lp_TR = TP(W, H) * _LayCTM; // _status_line.update(W, _LayCTM); DATC->setClipRegion(DBbox(lp_BL.x(),lp_TR.y(), lp_TR.x(), lp_BL.y())); glClearColor(0,0,0,0); }
int tellstdfunc::stdZOOMALL::execute() { laydata::tdtdesign* ATDB = DATC->lockDB(); DBbox* ovl = DEBUG_NEW DBbox(ATDB->activeoverlap()); DATC->unlockDB(); wxCommandEvent eventZOOM(wxEVT_CANVAS_ZOOM); eventZOOM.SetInt(tui::ZOOM_WINDOW); eventZOOM.SetClientData(static_cast<void*>(ovl)); wxPostEvent(TopedCanvasW, eventZOOM); return EXEC_NEXT; }
int tellstdfunc::stdZOOMWINb::execute() { telldata::ttwnd *w = static_cast<telldata::ttwnd*>(OPstack.top());OPstack.pop(); real DBscale = DATC->DBscale(); DBbox* box = DEBUG_NEW DBbox(TP(w->p1().x(), w->p1().y(), DBscale), TP(w->p2().x(), w->p2().y(), DBscale)); wxCommandEvent eventZOOM(wxEVT_CANVAS_ZOOM); eventZOOM.SetInt(tui::ZOOM_WINDOW); eventZOOM.SetClientData(static_cast<void*>(box)); wxPostEvent(TopedCanvasW, eventZOOM); return EXEC_NEXT; }
void tui::LayoutCanvas::OnPanCenter(wxCommandEvent&) { CTM tmpmtrx; TP center((lp_TR.x() + lp_BL.x())/2, (lp_TR.y() + lp_BL.y())/2); tmpmtrx.Translate(ScrMARK - center); DBbox* box = DEBUG_NEW DBbox( lp_BL, lp_TR ); (*box) = (*box) * tmpmtrx; wxCommandEvent eventZOOM(wxEVT_CANVAS_ZOOM); eventZOOM.SetInt(tui::ZOOM_WINDOW); eventZOOM.SetClientData(static_cast<void*>(box)); OnZoom(eventZOOM); }
void tellstdfunc::stdOPENCELL::undo() { TEUNDO_DEBUG("opencell( string ) UNDO"); laydata::tdtdesign* ATDB = DATC->lockDB(); VERIFY(ATDB->editprev(true)); browsers::celltree_open(ATDB->activecellname()); telldata::ttlist* selected = static_cast<telldata::ttlist*>(UNDOPstack.front());UNDOPstack.pop_front(); ATDB->select_fromList(get_ttlaylist(selected)); DBbox* ovl = DEBUG_NEW DBbox(ATDB->activeoverlap()); DATC->unlockDB(); wxCommandEvent eventZOOM(wxEVT_CANVAS_ZOOM); eventZOOM.SetInt(tui::ZOOM_WINDOW); eventZOOM.SetClientData(static_cast<void*>(ovl)); wxPostEvent(TopedCanvasW, eventZOOM); }
void Calbr::CalbrFile::ShowError(const std::string & error, long number) { RuleChecksVector::const_iterator it; for(it = _RuleChecks.begin(); it!= _RuleChecks.end(); ++it) { if((*it)->ruleCheckName() == error) { drcRuleCheck *rule = (*it); for(std::vector <Calbr::drcPolygon>::iterator it2poly = rule->polygons()->begin(); it2poly!= rule->polygons()->end(); ++it2poly) { bool dbExists = true; if (number == (*it2poly).ordinal()) { drcPolygon *poly = &(*it2poly); try { _ATDB = DATC->lockDB(); } catch (EXPTNactive_DB) {dbExists = false;} if(dbExists) { word drcLayer = DATC->getLayerNo("drcResults"); assert(drcLayer); poly->showError(_ATDB, drcLayer); DATC->unlockDB(); int4b maxx, maxy, minx, miny; maxx = poly->coords()->begin()->x(); minx = poly->coords()->begin()->x(); maxy = poly->coords()->begin()->y(); miny = poly->coords()->begin()->y(); for(pointlist::const_iterator it3 = poly->coords()->begin(); it3!= poly->coords()->end(); ++it3) { maxx = std::max((*it3).x(), maxx); maxy = std::max((*it3).y(), maxy); minx = std::min((*it3).x(), minx); miny = std::min((*it3).y(), miny); } DBbox *box = DEBUG_NEW DBbox(TP(minx, miny), TP(maxx, maxy)); //DBbox box(TP(minx, miny), TP(maxx, maxy)); wxCommandEvent eventZOOM(wxEVT_CANVAS_ZOOM); eventZOOM.SetInt(tui::ZOOM_WINDOW); eventZOOM.SetClientData(static_cast<void*>(box)); wxPostEvent(Toped->view(), eventZOOM); } else tell_log(console::MT_ERROR, "No Data base loaded... Sergey, update this string"); } } for(std::vector <Calbr::drcEdge>::iterator it2edge = rule->edges()->begin(); it2edge!= rule->edges()->end(); ++it2edge) { bool dbExists = true; if (number == (*it2edge).ordinal()) { try { _ATDB = DATC->lockDB(); } catch (EXPTNactive_DB) {dbExists = false;} if (dbExists) { word drcLayer = DATC->getLayerNo("drcResults"); assert(drcLayer); (*it2edge).showError(_ATDB, drcLayer); DATC->unlockDB(); DBbox *box = DEBUG_NEW DBbox(TP((*it2edge).coords()->x1, (*it2edge).coords()->y1), TP((*it2edge).coords()->x2, (*it2edge).coords()->y2)); wxCommandEvent eventZOOM(wxEVT_CANVAS_ZOOM); eventZOOM.SetInt(tui::ZOOM_WINDOW); eventZOOM.SetClientData(static_cast<void*>(box)); wxPostEvent(Toped->view(), eventZOOM); } } } } } assert(it == _RuleChecks.end()); }