/* ARGSUSED */ int spawncli(int f, int n) { /* i never thought i'd see an ifdef like this one... strange bedfellows */ #if DISP_X11 || SYS_WIN31 mlforce("[This version of vile cannot spawn an interactive shell]"); return FALSE; #else #if SYS_UNIX bottomleft(); ttclean(TRUE); TTputc('\n'); (void)system_SHELL((char *)0); TTflush(); ttunclean(); sgarbf = TRUE; return AfterShell(); #endif /* SYS_UNIX */ #if SYS_VMS bottomleft(); mlforce("[Starting DCL]\r\n"); TTflush(); /* Ignore "ttcol". */ sgarbf = TRUE; return sys(NULL); /* NULL => DCL. */ #endif #if SYS_MSDOS || SYS_OS2 || SYS_WINNT bottomleft(); TTflush(); TTkclose(); { char *shell; if ((shell = getenv("COMSPEC")) == NULL) { #if SYS_OS2 shell = "cmd.exe"; #else shell = "command.com"; #endif system(shell); /* Will search path */ } else { #if SYS_OS2 /* * spawn it if we know it. Some 3rd party command processors fail * if they system themselves (eg 4OS2). CCM 24-MAR-94 */ spawnl( P_WAIT, shell, shell, NULL); #else system(shell); #endif } } TTkopen(); sgarbf = TRUE; return AfterShell(); #endif #endif }
static void draw_image_button(button obj, rect r) { image img; bitmap store = NULL; rect ir; rgb up, down; rgb old = currentcolour(); img = obj->img; if (has_transparent_pixels(img)) { store = newbitmap(r.width, r.height, 0); drawto(store); setcolour(getbackground(obj)); fillrect(r); } if (img) { ir = insetr(r,2); if (ishighlighted(obj)) /* button is pressed */ ir.x += 1, ir.y += 1; /* Draw the button image. */ if (ischecked(obj)) drawdarker(img, ir, getrect(img)); else if (isenabled(obj)) drawimage(img, ir, getrect(img)); else drawgreyscale(img, ir, getrect(img)); if (ishighlighted(obj)) { /* fill the gap */ ir.x -= 1, ir.y -= 1; setcolour(getbackground(obj)); drawline(topleft(ir),topright(ir)); drawline(topleft(ir),bottomleft(ir)); } } /* Draw button border. */ setcolour(getforeground(obj)); setlinewidth(1); drawrect(r); /* Draw button shadow. */ up = White, down = Grey; if (ishighlighted(obj)) up = Grey, down = LightGrey; draw_shadow(insetr(r,1), up, down, 1); if (store != NULL) { drawto(obj); copyrect(store, pt(0,0), getrect(store)); del(store); } setcolour(old); }
QStringList ImageInstance::getAnnotations() { QString topleft("Im: %1 Se: %3\n%4%5Scalor: 100mm"); QString topright("%1\n%2 %3/%4\n%5"); QString bottomleft("%1\n%2"); QString bottomright("%1 mAs %2 kV\n%3\n%4"); topleft = topleft.arg(instanceNumber, seriesNumber, studyDes.isEmpty()?studyDes:QString("\n").prepend(studyDes), seriesDes.isEmpty()?seriesDes:QString("\n").prepend(seriesDes)); topright = topright.arg(patientName, patientID, patientSex, patientAge, patientBirth.toString("yyyy/M/d")); bottomleft = bottomleft.arg(procId.isEmpty()?bodyPart:procId, manufacturer); bottomright = bottomright.arg(QString::number(mAs), QString::number(kvp), acquisitionTime.toString("yyyy/M/d hh:mm:ss"), institution); return QStringList() << topleft << topright << bottomleft << bottomright; }
void KoUniColorChooser::updateSelectorsB() { //kDebug(30004)() <<"B selected"; quint8 data[4]; data[2] = 0; data[1] = 255; data[0] = m_BIn->value(); data[3] = 255; KoColor topleft(data, rgbColorSpace()); data[2] = 255; data[1] = 255; KoColor topright(data, rgbColorSpace()); data[2] = 0; data[1] = 0; KoColor bottomleft(data, rgbColorSpace()); data[2] = 255; data[1] = 0; KoColor bottomright(data, rgbColorSpace()); m_xycolorselector->setColors(topleft,topright,bottomleft,bottomright); data[2] = m_RIn->value(); data[1] = m_GIn->value(); data[0] = 0; KoColor mincolor(data, rgbColorSpace()); data[0] = 255; KoColor maxcolor(data, rgbColorSpace()); m_colorSlider->setColors(mincolor, maxcolor); m_xycolorselector->blockSignals(true); m_colorSlider->blockSignals(true); m_xycolorselector->setValues(m_RIn->value(), m_GIn->value()); m_colorSlider->setValue(m_BIn->value()); m_xycolorselector->blockSignals(false); m_colorSlider->blockSignals(false); }
/* the #ifdefs have been totally separated, for readability */ static int spawn1(int rerun, int pressret) { #if DISP_IBMPC int closed; #endif #if COMMON_SH_PROMPT register int s; char line[NLINE]; /* command line send to shell */ if ((s = ShellPrompt(&save_shell[0], line, rerun)) != TRUE) return s; #endif /* COMMON_SH_PROMPT */ /* take care of autowrite */ if (writeall(FALSE,1,FALSE,TRUE,TRUE) != TRUE) return FALSE; #if SYS_UNIX #if DISP_X11 (void)system_SHELL(line); #else ttclean(TRUE); (void)system_SHELL(line); TTflush(); ttunclean(); if (pressret) pressreturn(); TTopen(); TTkopen(); TTflush(); sgarbf = TRUE; #endif /* DISP_X11 */ return AfterShell(); #endif /* SYS_UNIX */ #if SYS_VMS TTputc('\n'); /* Already have '\r' */ TTflush(); s = sys(line); /* Run the command. */ mlforce("\r\n\n[End]"); /* Pause. */ TTflush(); (void)keystroke(); sgarbf = TRUE; return (s); #endif #if SYS_WIN31 mlforce("[Not in Windows 3.1]"); return FALSE; #endif #if SYS_MSDOS || SYS_OS2 || SYS_WINNT bottomleft(); TTputc('\n'); TTflush(); TTkclose(); #if DISP_IBMPC /* If we don't reset to 80x25, parts of the shell-output will go * astray. */ closed = term.t_ncol != 80 || term.t_nrow != 25; if (closed) TTclose(); #endif system(line); TTkopen(); /* if we are interactive, pause here */ if (pressret) { pressreturn(); } #if DISP_IBMPC /* Reopen the display _after_ the prompt, to keep the shell-output * in the same type of screen as the prompt. */ if (closed) TTopen(); #endif sgarbf = TRUE; return AfterShell(); #endif }
void ImageDialog::DrawVisualObjects(QImage *image) { QPainter painter(image); painter.setRenderHints(QPainter::HighQualityAntialiasing); /***********************draw horizonline*****************************/ Vector2<int> bottomleft(0, 0), topright(IMAGE_WIDTH-1, IMAGE_HEIGHT-1); Vector2<int> point1,point2; // if(SComm->TJScanVision->HorizonExist) // { // if( Geometry::getIntersectionPointsOfLineAndRectangle(bottomleft,topright, // SComm->TJScanVision->HorizonLine,point1,point2)) // { QPen temppen; // getDebugPen(temppen,1,Drawings::ps_SolidLine,Drawings::red); // painter.setPen(temppen); // painter.drawLine(point1.x,point1.y,point2.x,point2.y); // } // } if(BDrawScanLines){ //////////////===========New Draw===========//////////// DebugLine tempLine; //Draw Lines std::vector< DebugLine >::const_iterator DebugLineIter = PlotManager::getInstance()->DrawdataBuffer.DebugLinesBuffer.begin(); while (DebugLineIter != PlotManager::getInstance()->DrawdataBuffer.DebugLinesBuffer.end()) { QPen temppen; tempLine = *DebugLineIter; getDebugPen(temppen,tempLine.penWidth,tempLine.penStyle,tempLine.pencolor); painter.setPen(temppen); painter.drawLine(tempLine.startp.x,tempLine.startp.y,tempLine.endp.x,tempLine.endp.y); DebugLineIter++; } //Draw Points DebugPoint tempPoint; std::vector< DebugPoint >::const_iterator DebugPointIter = PlotManager::getInstance()->DrawdataBuffer.DebugFeaturePoint.begin(); while (DebugPointIter != PlotManager::getInstance()->DrawdataBuffer.DebugFeaturePoint.end()) { QPen temppen; int pradius = 1; tempPoint = *DebugPointIter; QBrush tempb(Qt::SolidPattern); tempb.setColor(QColor(Qt::GlobalColor (tempPoint.fillColor))); getDebugPen(temppen,1,Drawings::ps_SolidLine,tempPoint.pencolor); painter.setPen(temppen); painter.setBrush(tempb); painter.drawEllipse(QPoint(tempPoint.point.x,tempPoint.point.y),pradius,pradius); DebugPointIter++; } //Draw Big Dots std::vector< DebugPoint >::const_iterator DebugBigDotIter = PlotManager::getInstance()->DrawdataBuffer.DebugBigDotBuff.begin(); while (DebugBigDotIter != PlotManager::getInstance()->DrawdataBuffer.DebugBigDotBuff.end()) { QPen temppen; int pradius = 2; tempPoint = *DebugBigDotIter; QBrush tempb(Qt::SolidPattern); tempb.setColor(QColor(Qt::GlobalColor(tempPoint.fillColor))); getDebugPen(temppen,1,Drawings::ps_SolidLine,tempPoint.pencolor); painter.setPen(temppen); painter.setBrush(tempb); painter.drawEllipse(QPoint(tempPoint.point.x,tempPoint.point.y),pradius,pradius); DebugBigDotIter++; } //Draw Rectangles // DebugRectangle tempHARect; // Vector2<int>point3,point4,point5,point6; // std::vector< DebugRectangle >::const_iterator DebugHARectIter = object_to_draw->DebugHARectangleBuffer.begin(); // while (DebugHARectIter != object_to_draw->DebugHARectangleBuffer.end()) // { // QPen temppen; // tempHARect = *DebugHARectIter; // point3=SComm->imagetj.CoordinateHA2Image(Vector2<double>(static_cast<double>(tempHARect.topLeftpoint.x),static_cast<double>(tempHARect.topLeftpoint.y)), // SComm->TJScanVision->HorizonLine); // point4=SComm->imagetj.CoordinateHA2Image(Vector2<double>(static_cast<double>(tempHARect.bottomRightpoint.x),static_cast<double>(tempHARect.topLeftpoint.y)), // SComm->TJScanVision->HorizonLine); // point5=SComm->imagetj.CoordinateHA2Image(Vector2<double>(static_cast<double>(tempHARect.bottomRightpoint.x),static_cast<double>(tempHARect.bottomRightpoint.y)), // SComm->TJScanVision->HorizonLine); // point6=SComm->imagetj.CoordinateHA2Image(Vector2<double>(static_cast<double>(tempHARect.topLeftpoint.x),static_cast<double>(tempHARect.bottomRightpoint.y)), // SComm->TJScanVision->HorizonLine); // // getDebugPen(temppen,tempHARect.penWidth,tempHARect.penStyle,tempHARect.pencolor); // painter.setPen(temppen); // painter.drawLine(QPoint(point3.x,point3.y)QPoint(point4.x,point4.y)); // painter.drawLine(QPoint(point4.x,point4.y),QPoint(point5.x,point5.y)); // painter.drawLine(QPoint(point5.x,point5.y),QPoint(point6.x,point6.y)); // painter.drawLine(QPoint(point6.x,point6.y),QPoint(point3.x,point3.y)); // DebugHARectIter++; // } //Draw Cirecles DebugCircle tempCircle; std::vector< DebugCircle >::const_iterator DebugCircelIter = PlotManager::getInstance()->DrawdataBuffer.DebugCircleBuffer.begin(); while(DebugCircelIter != PlotManager::getInstance()->DrawdataBuffer.DebugCircleBuffer.end()) { QPen temppen; tempCircle = *DebugCircelIter; getDebugPen(temppen,tempCircle.penWidth,tempCircle.penStyle,tempCircle.pencolor); painter.setPen(temppen); painter.setBrush(Qt::NoBrush); painter.drawEllipse(QPoint(tempCircle.Center.x,tempCircle.Center.y),tempCircle.radius,tempCircle.radius); DebugCircelIter++; } }//if(BDrawScanLines) }
void CGetBlackOutDlg::OnMouseDown( UINT nflags, CPoint point) { if (mWon) return; int x,y,cx,cy,i,piece; x=y=cx=cy=piece=0; for(i = 0 ; i < mBoard.numpieces(); i++) { x = mBoard.pborder() + (mBoard.piece(i)->xpos() * (mBoard.pper() + mBoard.pborder())); y = mBoard.pborder() + (mBoard.piece(i)->ypos() * (mBoard.pper() + mBoard.pborder())); cx = (mBoard.piece(i)->width() * mBoard.pper()); if (mBoard.piece(i)->width() == 2) cx += mBoard.pborder(); cy = (mBoard.piece(i)->height() * mBoard.pper()); if (mBoard.piece(i)->height() == 2) cy += mBoard.pborder(); CRect piecerect(x,y,x+cx,y+cy); if (piecerect.PtInRect(point)) { piece=i; i=mBoard.numpieces(); mMoving = TRUE; mMouseStartPoint = point; mPieceMoving = piece; break; } } int moves = 0; if (mMoving) { int x,y,sx,sy,sx2,sy2; x=y=sx=sy=sx2=sy2=0; x = -mBoard.pper(); y = 0; if (mBoard.canmove(mPieceMoving,x,y)) { moves++; sx=x;sy=y; } x = mBoard.pper(); y = 0; if (mBoard.canmove(mPieceMoving,x,y)) { moves++; if (moves < 2) { sx=x;sy=y; } else { sx2=x;sy2=y; } } x = 0; y = mBoard.pper(); if (mBoard.canmove(mPieceMoving,x,y)) { moves++; if (moves < 2) { sx=x;sy=y; } else { sx2=x;sy2=y; } } x = 0; y = -mBoard.pper(); if (mBoard.canmove(mPieceMoving,x,y)) { moves++; if (moves < 2) { sx=x;sy=y; } else { sx2=x;sy2=y; } } if (moves == 1) { CPoint delta(point); delta += CPoint(sx,sy); OnMouseMove(0, delta); OnMouseUp(0,CPoint()); } else if (moves == 2) { CRect piecerect(mBoard.piece(mPieceMoving)->mPieceRect); int deltax, deltay;deltax=deltay=0; if (abs(sx) == mBoard.pper() && abs(sx2) == mBoard.pper()) { CRect lhalf(piecerect); CRect rhalf(piecerect); lhalf.BottomRight().x -= lhalf.Width() / 2; rhalf.TopLeft().x = lhalf.BottomRight().x; if (lhalf.PtInRect(point)) { deltax = sx2; } else { deltax = sx; } CPoint delta(point); delta += CPoint(deltax,deltay); OnMouseMove(0, delta); OnMouseUp(0,CPoint()); } else if (abs(sy) == mBoard.pper() && abs(sy2) == mBoard.pper()) { CRect thalf(piecerect); CRect bhalf(piecerect); thalf.BottomRight().y -= thalf.Height() / 2; bhalf.TopLeft().y = thalf.BottomRight().y; if (thalf.PtInRect(point)) { deltay = sy; } else { deltay = sy2; } CPoint delta(point); delta += CPoint(deltax,deltay); OnMouseMove(0, delta); OnMouseUp(0,CPoint()); } else if ( sx == mBoard.pper() && sy2 == mBoard.pper() || sx2 == mBoard.pper() && sy == mBoard.pper() ) { if (distance(topright(piecerect),point) < distance(point, bottomleft(piecerect))) { deltay = sy2; } else { deltax = sx; } CPoint delta(point); delta += CPoint(deltax,deltay); OnMouseMove(0, delta); OnMouseUp(0,CPoint()); } else if ( sx == -mBoard.pper() && sy2 == mBoard.pper() || sx2 == -mBoard.pper() && sy == mBoard.pper() ) { if (distance(topleft(piecerect),point) < distance(point, bottomright(piecerect))) { deltay = sy2; } else { deltax = sx; } CPoint delta(point); delta += CPoint(deltax,deltay); OnMouseMove(0, delta); OnMouseUp(0,CPoint()); } else if ( sx == mBoard.pper() && sy2 == -mBoard.pper() || sx2 == mBoard.pper() && sy == -mBoard.pper() ) { if (distance(topleft(piecerect),point) < distance(point, bottomright(piecerect))) { deltax = sx; } else { deltay = sy2; } CPoint delta(point); delta += CPoint(deltax,deltay); OnMouseMove(0, delta); OnMouseUp(0,CPoint()); } else if ( sx == -mBoard.pper() && sy2 == -mBoard.pper() || sx2 == -mBoard.pper() && sy == -mBoard.pper() ) { if (distance(topright(piecerect),point) < distance(point, bottomleft(piecerect))) { deltax = sx; } else { deltay = sy2; } CPoint delta(point); delta += CPoint(deltax,deltay); OnMouseMove(0, delta); OnMouseUp(0,CPoint()); } } } }
void openTableImageGroup::draw() { float current_rotation = m_rotation - 45.0; float rotation_inc = 90.0 / m_images.size(); ofPath path; ofPoint axis( 0, 0, 1.0); for ( int i = 0; i < m_images.size(); i++ ) { if ( m_images[ i ].isLoaded() ) { ofPushMatrix(); ofPoint dim(m_images[ i ].m_image->getWidth(),m_images[ i ].m_image->getHeight()); float scale = MIN(160./dim.x, 120./dim.y); dim *= scale; ofTranslate( m_position ); ofRotate( current_rotation ); m_images[ i ].m_image->draw( 0, 0, dim.x, dim.y ); ofPopMatrix(); // // update outline path // dim /= 2.; ofPoint topleft( -dim.x, -dim.y ); ofPoint topright( dim.x, -dim.y ); ofPoint bottomright( dim.x, dim.y ); ofPoint bottomleft( -dim.x, dim.y ); topleft.rotate(current_rotation, axis); topleft += m_position; topright.rotate(current_rotation, axis); topright += m_position; bottomright.rotate(current_rotation, axis); bottomright += m_position; bottomleft.rotate(current_rotation, axis); bottomleft += m_position; path.newSubPath(); path.moveTo( topleft ); path.lineTo( topright ); path.lineTo( bottomright ); path.lineTo( bottomleft ); path.close(); // // // current_rotation += rotation_inc; } } if ( m_annotation.length() > 0 ) { ofApp* app = ( ofApp* ) ofGetAppPtr(); //ofRectangle bounds = app->m_default_font.getStringBoundingBox(m_annotation, 0, 0, 24.); ofRectangle bounds = app->m_default_font.getBBox(m_annotation, 24., 0, 0); ofPoint dim( bounds.width, bounds.height ); ofPushStyle(); ofPushMatrix(); ofTranslate( m_position ); ofRotate( m_rotation ); ofTranslate( -( dim.x/2. ), 120.0 ); ofSetColor(255, 255, 255, 127); ofRect( -8, -( dim.y / 2 + 16 ), dim.x + 16, dim.y + 16 ); ofSetColor(ofColor::black); //app->m_default_font.drawString(m_annotation, 0, 0, 24.); app->m_default_font.draw(m_annotation, 24., 0, 0); ofPopMatrix(); ofPopStyle(); // // add to outline // ofPoint position = m_position; dim.x += 16; dim.y += 16; dim /= 2.; ofPoint topleft( -dim.x, -dim.y + 112. ); ofPoint topright( dim.x, -dim.y + 112. ); ofPoint bottomright( dim.x, dim.y + 112. ); ofPoint bottomleft( -dim.x, dim.y + 112. ); topleft.rotate(m_rotation, axis); topleft += position; topright.rotate(m_rotation, axis); topright += position; bottomright.rotate(m_rotation, axis); bottomright += position; bottomleft.rotate(m_rotation, axis); bottomleft += position; path.newSubPath(); path.moveTo( topleft ); path.lineTo( topright ); path.lineTo( bottomright ); path.lineTo( bottomleft ); path.close(); } // // convert path to polyline for hit test // m_hit_lock.lock(); m_outline = path.getOutline(); m_hit_lock.unlock(); /* ofPushStyle(); path.setStrokeWidth( 1 ); path.setStrokeColor( ofColor::red ); path.setFillColor( ofColor( 255, 0, 0, 128 ) ); path.draw(); ofSetColor( ofColor::green ); ofNoFill(); for ( auto& poly : m_outline ) { poly.draw(); } ofPopStyle(); */ }