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::stdGETOVERLAP::execute() { telldata::TtLayout* layObject = static_cast<telldata::TtLayout*>(OPstack.top());OPstack.pop(); assert(layObject); real DBscale = PROPC->DBscale(); DBbox ovlBox = layObject->data()->overlap(); telldata::TtPnt p1DB(ovlBox.p1().x()/DBscale, ovlBox.p1().y()/DBscale ); telldata::TtPnt p2DB(ovlBox.p2().x()/DBscale, ovlBox.p2().y()/DBscale); OPstack.push(DEBUG_NEW telldata::TtBox( p1DB, p2DB )); delete layObject; 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::pushCell(std::string cname, const CTM& trans, const DBbox& overlap, bool active, bool selected) { TrxCellRef* cRefBox = DEBUG_NEW TrxCellRef(cname, trans * _cellStack.top()->ctm(), overlap, _cellStack.size() ); if (selected || (!_drawprop->cellBoxHidden())) _refLayer->addCellOBox(cRefBox, _cellStack.size(), selected); else // This list is to keep track of the hidden cRefBox - so we can clean // them up. Don't get confused - we need cRefBox during the collecting // and drawing phase so we can't really delete them here or after they're // poped-up from _cellStack. The confusion is coming from the "duality" // of the TrxCellRef - once as a cell reference with CTM, view depth etc. // and then as a placeholder of the overlapping reference box _hiddenRefBoxes.push_back(cRefBox); _cellStack.push(cRefBox); if (active) { assert(NULL == _activeCS); _activeCS = cRefBox; } else if (!_drawprop->cellMarksHidden()) { _marks->addRefMark(overlap.p1(), _cellStack.top()->ctm()); } }
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 = new DBbox(presspoint.x(),presspoint.y(), ScrMARK.x(),ScrMARK.y());break; case ZOOM_IN : box = 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 = 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 = 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 = 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 = 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 = 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 = new DBbox(-10,-10,90,90); break; default: assert(false); } int W, H; GetClientSize(&W,&H); 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 Properties->setScrCTM(_LayCTM.Reversed()); invalid_window = true; delete box; Refresh(); }
void trend::TrendBase::text (const std::string* txt, const CTM& ftmtrx, const DBbox& ovl, const TP& cor, bool sel) { if (sel) _clayer->text(txt, ftmtrx, &ovl, cor, true); else if (_drawprop->textBoxHidden()) _clayer->text(txt, ftmtrx, NULL, cor, false); else _clayer->text(txt, ftmtrx, &ovl, cor, false); if (!_drawprop->textMarksHidden()) { _marks->addTextMark(ovl.p1(),ftmtrx*_cellStack.top()->ctm()); } }
//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 trend::TrendBase::arefOBox(std::string cname, const CTM& trans, const DBbox& overlap, bool selected) { if (!_drawprop->cellMarksHidden()) { _marks->addARefMark(overlap.p1(), trans * _cellStack.top()->ctm()); } if (selected || (!_drawprop->cellBoxHidden())) { TrxCellRef* cRefBox = DEBUG_NEW TrxCellRef(cname, trans * _cellStack.top()->ctm(), overlap, _cellStack.size() ); _refLayer->addCellOBox(cRefBox, _cellStack.size(), selected); } }