bool Ccemem::InitDisplay(void) { // CPObject::InitDisplay(); paintingImage.lock(); delete BackgroundImageBackup; BackgroundImageBackup = CreateImage(QSize(getDX(), getDY()),BackGroundFname,false,false,90); delete BackgroundImage; BackgroundImage = new QImage(*BackgroundImageBackup); delete FinalImage; FinalImage = new QImage(*BackgroundImageBackup); // pCONNECTOR->setSnap(rotate?QPoint(406,72):QPoint(34,72)); pCONNECTOR->setDir(Cconnector::EAST); mask = QPixmap::fromImage(*BackgroundImageBackup).scaled(getDX()*mainwindow->zoom, getDY()*mainwindow->zoom); setMask(mask.mask()); paintingImage.unlock(); return true; }
void Crlp1002::Rotate() { paintingImage.lock(); rotate = ! rotate; delete BackgroundImageBackup; BackgroundImageBackup = CreateImage(QSize(getDX(), getDY()),BackGroundFname,false,false,rotate?180:0); delete BackgroundImage; BackgroundImage = new QImage(*BackgroundImageBackup); delete FinalImage; FinalImage = new QImage(*BackgroundImageBackup); pCONNECTOR->setSnap(rotate?QPoint(811,72):QPoint(37,72)); pCONNECTOR->setDir(rotate?Cconnector::EAST:Cconnector::WEST); mask = QPixmap::fromImage(*BackgroundImageBackup).scaled(getDX()*mainwindow->zoom, getDY()*mainwindow->zoom); setMask(mask.mask()); paintingImage.unlock(); update(); // adapt SNAP connector }
void Crlp9001::Rotate() { rotate = ! rotate; delete BackgroundImageBackup; BackgroundImageBackup = LoadImage(QSize(getDX(), getDY()),BackGroundFname,false,false,rotate?180:0); delete BackgroundImage; BackgroundImage = new QImage(*BackgroundImageBackup); delete FinalImage; FinalImage = new QImage(*BackgroundImageBackup); pMAINCONNECTOR->setSnap(rotate?QPoint(372,72):QPoint(30,72)); pMAINCONNECTOR->setDir(rotate?Cconnector::EAST:Cconnector::WEST); mask = QPixmap::fromImage(*BackgroundImageBackup).scaled(getDX()*mainwindow->zoom/100,getDY()*mainwindow->zoom/100); setMask(mask.mask()); // adapt SNAP connector }
void uiScrollbar::setOnScrollbarScroll(const wfunctor1<void, const SPtr<uiScrollbar>&>& cb) { _cb_on_scrollbar_scroll = cb; } void uiScrollbar::realizeThumbPos() { _slider->setSlideValueX(0); _slider->setSlideValueY(0); if(_hsb_layout) _slider->setSlideValueX((_cur_value - _min_value) * _slider->getSlideRangeX() / max(_max_value - _min_value, 1)); else _slider->setSlideValueY((_cur_value - _min_value) * _slider->getSlideRangeY() / max(_max_value - _min_value, 1)); } void uiScrollbar::doLayout_HScrollbar() { _btn_lt->setPos(0, (getDY() - _btn_lt->getDY()) >> 1); _btn_rb->setPos(getDX() - _btn_rb->getDX(), (getDY() - _btn_rb->getDY()) >> 1); _slider->setRange(_btn_lt->getDX(), (getDY() - _slider->getDY()) >> 1, getDX() - _btn_lt->getDX() - _btn_rb->getDX() - _slider->getDX(), 0); realizeThumbPos(); _hsb_layout = true; } void uiScrollbar::doLayout_VScrollbar() { _btn_lt->setPos((getDX() - _btn_lt->getDX()) >> 1, 0); _btn_rb->setPos((getDX() - _btn_rb->getDX()) >> 1, getDY() - _btn_rb->getDY()); _slider->setRange((getDX() - _slider->getDX()) >> 1, _btn_lt->getDY(), 0, getDY() - _btn_lt->getDY() - _btn_rb->getDY() - _slider->getDY()); realizeThumbPos();
bool Csio::initSignalMap(Cconnector::ConnectorType type) { SMapMutex.lock(); switch (type) { case Cconnector::Sharp_11 : signalMap.clear(); signalMap[S_SD] = 7; // ok signalMap[S_RD] = 6; // ok signalMap[S_RS] = 5; signalMap[S_CS] = 9; // ok signalMap[S_CD] = 8; signalMap[S_RR] = 4; signalMap[S_ER] = 5; updateMapConsole(); pSIOCONNECTOR->Desc = "Sharp 11 pins"; pSIOCONNECTOR->setNbpins(11); pSIOCONNECTOR->setType(Cconnector::Sharp_11); WatchPoint.remove((qint64*)pSIOCONNECTOR_value); WatchPoint.add(&pSIOCONNECTOR_value,64,11,this,pSIOCONNECTOR->Desc); BackGroundFname = P_RES(":/ext/simu.png"); pSIOCONNECTOR->setSnap(QPoint(130,7)); setDX(160); setDY(160); resize(getDX(),getDY()); InitDisplay(); break; case Cconnector::Sharp_15 : signalMap.clear(); signalMap[S_SD] = 2; signalMap[S_RD] = 3; signalMap[S_RS] = 4; signalMap[S_CS] = 5; signalMap[S_CD] = 8; signalMap[S_RR] = 11; signalMap[S_ER] = 14; updateMapConsole(); pSIOCONNECTOR->Desc = "Sharp 15 pins"; pSIOCONNECTOR->setNbpins(15); pSIOCONNECTOR->setType(Cconnector::Sharp_15); WatchPoint.remove((qint64*)pSIOCONNECTOR_value); WatchPoint.add(&pSIOCONNECTOR_value,64,15,this,pSIOCONNECTOR->Desc); BackGroundFname = P_RES(":/ext/serial.png"); pSIOCONNECTOR->setSnap(QPoint(23,28)); setDX(195); setDY(145); resize(getDX(),getDY()); InitDisplay(); break; case Cconnector::Canon_9 : signalMap.clear(); signalMap[S_SD] = 2; signalMap[S_RD] = 3; signalMap[S_RS] = 4; signalMap[S_CS] = 5; signalMap[S_CD] = 8; signalMap[S_RR] = 11; signalMap[S_ER] = 14; updateMapConsole(); pSIOCONNECTOR->Desc = "Canon 9 pins"; pSIOCONNECTOR->setNbpins(9); pSIOCONNECTOR->setType(Cconnector::Canon_9); WatchPoint.remove((qint64*)pSIOCONNECTOR_value); WatchPoint.add(&pSIOCONNECTOR_value,64,9,this,pSIOCONNECTOR->Desc); break; case Cconnector::DB_25 : signalMap.clear(); signalMap[S_SD] = 2; signalMap[S_RD] = 3; signalMap[S_RS] = 4; signalMap[S_CS] = 5; signalMap[S_CD] = 8; signalMap[S_RR] = 11; signalMap[S_ER] = 14; updateMapConsole(); pSIOCONNECTOR->Desc = "DB25 Serial Connector"; pSIOCONNECTOR->setNbpins(25); pSIOCONNECTOR->setType(Cconnector::DB_25); WatchPoint.remove((qint64*)pSIOCONNECTOR_value); WatchPoint.add(&pSIOCONNECTOR_value,64,25,this,pSIOCONNECTOR->Desc); break; case Cconnector::DIN_8 : signalMap.clear(); signalMap[S_SD] = 2; signalMap[S_RD] = 3; signalMap[S_RS] = 4; signalMap[S_CS] = 5; signalMap[S_CD] = 8; signalMap[S_RR] = 11; signalMap[S_ER] = 14; updateMapConsole(); pSIOCONNECTOR->Desc = "DIN 8 pins"; pSIOCONNECTOR->setNbpins(8); pSIOCONNECTOR->setType(Cconnector::DIN_8); WatchPoint.remove((qint64*)pSIOCONNECTOR_value); WatchPoint.add(&pSIOCONNECTOR_value,64,8,this,pSIOCONNECTOR->Desc); break; case Cconnector::Jack : signalMap.clear(); signalMap[S_SD] = 2; signalMap[S_RD] = 1; signalMap[S_RS] = 0xff; signalMap[S_CS] = 0; signalMap[S_CD] = 0; signalMap[S_RR] = 0; signalMap[S_ER] = 0xff; updateMapConsole(); pSIOCONNECTOR->Desc = "Jack"; pSIOCONNECTOR->setNbpins(3); pSIOCONNECTOR->setType(Cconnector::Jack); WatchPoint.remove((qint64*)pSIOCONNECTOR_value); WatchPoint.add(&pSIOCONNECTOR_value,64,3,this,pSIOCONNECTOR->Desc); BackGroundFname = P_RES(":/ext/jackR.png"); pSIOCONNECTOR->setSnap(QPoint(56,6)); setDX(75); setDY(20); resize(getDX(),getDY()); InitDisplay(); break; default: return false; break; } SMapMutex.unlock(); return true; }