Exemple #1
0
void ReflowPage::stopReflow() {

    FlashGraphics flash(_panel);

    // stop the process

    _reflow->stop();

    // disable the "pause" and "stop" buttons

    drawButtonCenteredGraphic(flash,GuiButtons[START_PAUSE],FlashInfo::PAUSE_DISABLED::OFFSET);
    drawButtonCenteredGraphic(flash,GuiButtons[STOP]);

    // enable the exit button

    drawButtonCenteredGraphic(flash,GuiButtons[EXIT]);

    // move the selected button to "exit"

    drawSelection(false);
    _selectedButton=EXIT;
    drawSelection(true);

    // erase the power rectangle

    Panel::LcdPanel& gl(flash.getGraphicsLibrary());
    gl.setBackground(0x9f489e);
    gl.clearRectangle(Rectangle(POWER_RECT_X,POWER_RECT_Y,POWER_RECT_WIDTH,POWER_RECT_HEIGHT));

    // the state is now finished

    _mode=FINISHED;
}
Exemple #2
0
void ReflowPage::handleDirection() {

    // erase old selection

    drawSelection(false);

    // set the new selection

    switch(_selectedButton) {

    case START_PAUSE:           // mode must be WAITING or COOKING
        _selectedButton=_mode==WAITING ? EXIT : STOP;
        break;

    case STOP:                  // mode must be COOKING
        _selectedButton=START_PAUSE;
        break;

    case EXIT:                  // mode must be WAITING or FINISHED
        if(_mode==WAITING)
            _selectedButton=START_PAUSE;
        break;

    default:
        break;
    }

    // draw the new selection

    drawSelection(true);
}
Exemple #3
0
void CursorClass::endSelection()
{
  if(selection_active == false) return ;

  drawSelection(0);
  selection_end_pos   = abs_pos;
  selection_end_col   = real_col + size;
  selection_end_row   = real_row;
  drawSelection(1);
}
void Selection::selectUnity(sf::RenderWindow *win,InputManager &input)
{
  sf::IntRect mouse(input.mPositionX(),input.mPositionY(),10,10);

  if(input.mouseButtons(sf::Mouse::Left)) {
    for(int sLoop = 0; sLoop < count; sLoop++) {
      if(mouse.intersects(playerSelection[sLoop]))
	{
	  nSelection = sLoop;
	}
      
    }
  
  }
	
  if(input.mouseButtons(sf::Mouse::Left)) {
    if(mouse.intersects(playerSelection[nSelection])) {
      if(!isSelected)
	isSelected = true;
      else isSelected = false;
    }
  }

  if(isSelected)  drawSelection(win,SELECT);   
}
Exemple #5
0
void CursorClass::moveSelection(int8_t sc, int8_t sr)
{
  if(selection_active == false) return ;

  uint16_t new_pos = Display.getDataPosition(selection_start_rel_col + sc,selection_start_rel_row + sr);
  if (new_pos == 0 || (((int16_t)selection_start_rel_col) + sc) < 0 ) return ;

  drawSelection(0);
  selection_start_col += sc;
  selection_start_rel_col += sc;
  selection_start_row += sr;
  selection_start_rel_row += sr;

  selection_start_pos = (selection_start_row*40)+selection_start_col;
  drawSelection(1);
}
Exemple #6
0
void CursorClass::startSelection()
{
  drawSelection(0);
  selection_start_pos = abs_pos;
  selection_start_col = real_col;
  selection_start_row = real_row;
  selection_start_rel_col = col;
  selection_start_rel_row = row;
  selection_start_size = size;

  selection_end_pos   = abs_pos;
  selection_end_col   = (real_col + size);
  selection_end_row   = (real_row);
  selection_active = true;
  drawSelection(1);
}
Exemple #7
0
void Summary::paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * /*widget*/)
{
	QRectF rect = (option->type == QStyleOption::SO_GraphicsItem) ? boundingRect() : option->exposedRect;

	setupPainter(painter);
	painter->fillRect(rect,painter->brush());

	if (option->type == QStyleOption::SO_GraphicsItem)
	{
		drawSelection(painter, rect);
		drawTitle(tr("Summary"), TitleLeft, Qt::AlignCenter);
	}

	adjustRect(rect);

	if (frame()&DrawLeft)
		painter->drawLine(rect.left(), rect.top(), rect.left(), rect.bottom());

	if (frame()&DrawRight)
		painter->drawLine(rect.right(), rect.top(), rect.right(), rect.bottom());

	if (frame()&DrawTop)
		painter->drawLine(rect.left(), rect.top(), rect.right(), rect.top());

	if (frame()&DrawBottom)
		painter->drawLine(rect.left(), rect.bottom(), rect.right(), rect.bottom());
}
void ZoomableAssemblyOverview::drawAll() {
    if(!model->isEmpty()) {
        //no coverage -> draw nothing
        if(!coverageTaskRunner.isIdle()) {
            cachedBackground = QPixmap(size());
            QPainter p(&cachedBackground);
            p.fillRect(cachedBackground.rect(), Qt::gray);
            p.drawText(cachedBackground.rect(), Qt::AlignCenter, tr("Background is rendering..."));
        }
        //coverage is ready -> redraw background if needed
        else if(redrawBackground) {
            cachedBackground = QPixmap(size());
            QPainter p(&cachedBackground);
            drawBackground(p);
            redrawBackground = false;
        }
        //draw selection and labels
        if (redrawSelection) {
            cachedView = cachedBackground;
            QPainter p(&cachedView);
            drawSelection(p);
            drawCoordLabels(p);
            redrawSelection = false;
        }
        QPixmap cachedViewCopy(cachedView);
        if(zoomToRegionSelector.scribbling) {
            QPainter p(&cachedViewCopy);
            drawZoomToRegion(p);
        }
        QPainter p(this);
        p.drawPixmap(0, 0, cachedViewCopy);
    }
}
Exemple #9
0
void Overlay::paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * /*widget*/)
{
	QRectF rect = (option->type == QStyleOption::SO_GraphicsItem) ? boundingRect() : option->exposedRect;

	setupPainter(painter);

	painter->fillRect(rect, painter->brush());

	if (option->type == QStyleOption::SO_GraphicsItem)
	{
		drawSelection(painter, rect);
		painter->setPen(QColor(225,224,224));
		painter->drawText(rect, tr("Overlay"));
	}

	adjustRect(rect);

	if (frame()&DrawLeft)
		painter->drawLine(rect.left(), rect.top(), rect.left(), rect.bottom());

	if (frame()&DrawRight)
		painter->drawLine(rect.right(), rect.top(), rect.right(), rect.bottom());

	if (frame()&DrawTop)
		painter->drawLine(rect.left(), rect.top(), rect.right(), rect.top());

	if (frame()&DrawBottom)
		painter->drawLine(rect.left(), rect.bottom(), rect.right(), rect.bottom());
}
  bool ControlPage::handleOk() {

    if(_captive) {
      _captive=false;
      drawSelection(true);
    }
    else {

      switch(_selectedButton) {

        case PROPORTIONAL:
        case INTEGER:
        case DERIVATIVE:
          _captive^=true;       // move into/out of the captive state where left/right are directed to these buttons
          drawSelection(true);
          break;

        case LEADED:
        case LEAD_FREE:
          {
            // change the selected profile to leaded/unleaded

            FlashGraphics flash(_panel);

            _leadedChecked=_selectedButton==LEADED;
            drawCheck(flash);
          }
          break;

        case REFLOW:
          if(_broken) {
            handleBroken();
            break;
          }
          else
            return true;      // trigger this class to exit

        default:
          break;
      }
    }

    // no exit from the page

    return false;
  }
void CanvasMode_Rotate::drawControls(QPainter* p)
{
	drawSelection(p, true);
	if (m_inItemRotation)
	{
		drawItemOutlines(p);
	}
}
Exemple #12
0
void Picture_erase (Picture me) {
	Graphics_clearRecording (my graphics.get());
	Graphics_clearWs (my graphics.get());
	if (my drawingArea) {
		drawMarkers (me);
		drawSelection (me, 1);
	}
}
void HeatmapDisplay::paintGL(){
    setMouseTracking(true);
    glClearColor(1.0, 1.0, 1.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    drawHeatMap();
    drawSelection();
    drawHopOver();
    drawVarNames();
}
void ossimQtVceShape::draw(QPainter& painter)
{
  painter.setPen(pen());
  painter.setBrush(brush());
  drawShape(painter);
  if(isSelected())
  {
     drawSelection(painter);
  }
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// draw
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TCanvas* ResonanceMatrixVisualisation::draw( size_t nBinsTime )
{
   size_t nBinsFreq = m_resonanceMatrix.size();
   if ( nBinsFreq < 1 )
   {
      return 0;
   }
   size_t iSampleBeg = 0;
   size_t iSampleEnd = m_resonanceMatrix[0].size();
   return drawSelection( nBinsTime, iSampleBeg, iSampleEnd );
}
 //***************************************************************************************************
//The refreshPixmap() function redraws the plot onto the off-screen pixmap and updates the display.
//We resize the pixmap to have the same size as the widget and fill it with the widget's erase color.
//This color is the "dark" component of the palette, because of the call to setBackgroundRole() in the
//Plotter constructor. If the background is a non-solid brush, QPixmap::fill() needs to know the
//offset in the widget where the pixmap will end up to align the brush pattern correctly. Here, the
//pixmap corresponds to the entire widget, so we specify position (0, 0).
//Then we create a QPainter to draw on the pixmap. The initFrom() call sets the painter's pen,
//background, and font to the same ones as the Plotter widget. Next we call drawGrid() and
//drawCurves() to perform the drawing. At the end, we call update() to schedule a paint event for the
//whole widget. The pixmap is copied to the widget in the paintEvent() function (p. 123).
//***************************************************************************************************
void ScatterView::refreshPixmap()
{
	this->updateAxis();
	pixmap = QPixmap(size());
	pixmap.fill(QColor(220,220,220));
	QPainter painter(&pixmap);
	painter.initFrom(this);
	drawGrid(&painter);
	drawCurves(&painter);
	drawSelection(&painter);
}
void CanvasMode_EditPolygon::drawControls(QPainter* p)
{
	p->save();
	if (m_canvas->m_viewMode.operItemMoving)
		drawOutline(p);
	else
		drawSelection(p, false);
	if (m_doc->appMode == modeEditPolygon)
		drawControlsPolygon(p, m_doc->m_Selection->itemAt(0));
	p->restore();
}
Exemple #18
0
void Picture_setSelection
	(Picture me, double x1NDC, double x2NDC, double y1NDC, double y2NDC, bool notify)
{
	if (my drawingArea) {
		Melder_assert (my drawingArea -> d_widget);
		drawSelection (me, 0);   // unselect
	}
	my selx1 = x1NDC;
	my selx2 = x2NDC;
	my sely1 = y1NDC;
	my sely2 = y2NDC;
	if (my drawingArea) {
		drawSelection (me, 1);   // select
	}

	if (notify && my selectionChangedCallback) {
		//Melder_casual (U"selectionChangedCallback from Picture_setSelection");
		my selectionChangedCallback (me, my selectionChangedClosure,
			my selx1, my selx2, my sely1, my sely2);
	}
}
	void KviCanvasRichText::draw(QPainter & p)
	{
		if(isEnabled())
		{
			QString szText = m_properties["szText"].asString();
			QSimpleRichText text(szText,m_properties["fntDefault"].asFont());
			text.setWidth(width());
			text.draw(&p,(int)x() + 1,(int)y() + 1,QRegion(QRect((int)x() + 1,(int)y() + 1,width(),height())),QColorGroup());
		}

		if(isSelected())drawSelection(p);
	}
Exemple #20
0
void CanvasMode_Normal::drawControls(QPainter* p)
{
//	qDebug() << "CanvasMode_Normal::drawControls";
	if (m_canvas->m_viewMode.operItemMoving)
	{
		drawOutline(p, 1.0, 1.0, m_objectDeltaPos.x(), m_objectDeltaPos.y());
	}
	else
	{
		drawSelection(p, true);
	}
}
void TileLayerPanel::draw(gcn::Graphics *g)
{
    if(IsCovered())
        return;

    gcn::Panel::draw(g); // we call the normal panel draw routine here, because the selection frame is treated specially below
    if(_mgr)
        _mgr->Render();
    for(uint32 i = 0; i < _layers.size(); ++i)
        _layers[i]->Render();
    drawSelection(g); // last; it would be overdrawn otherwise
}
Exemple #22
0
void IconWidget::paintEvent(QPaintEvent *event)
{
    QLabel::paintEvent(event);

    QPainter painter(this);
    painter.setPen(QPen(Qt::green));

    if(selection.x() >= 0 && selection.y() >= 0)
    {
        drawSelection(painter, selection);
    }
}
Exemple #23
0
//--------------------------------------------------------------
void ofApp::draw(){
	camera.begin();
	
	ofPushStyle();
	ofSetColor(200, 100, 100);
	ofDrawGrid(10,5,true);
	ofPopStyle();
	plane.draw();
	
	camera.end();
	
	drawSelection();
}
	void KviCanvasEllipticItem::draw(QPainter &p)
	{
		if(isEnabled())
		{
			QBrush b = p.brush();
			if(m_properties["bHasBackground"].asBool())p.setBrush(m_properties["clrBackground"].asColor());
			else p.setBrush(QBrush());
			p.setPen(pen());
			drawContent(p);
			p.setBrush(b);
		}

		if(isSelected())drawSelection(p);
	}
	void KviCanvasRectangle::draw(QPainter & p)
	{
		if(isEnabled())
		{
			if(m_properties["bHasBackground"].asBool())
			{
				p.fillRect((int)x() + 1,(int)y() + 1,width() - 2,height() - 2,m_properties["clrBackground"].asColor());
			}
			p.setPen(pen());
			p.drawRect((int)x(),(int)y(),width(),height());
		}

		if(isSelected())drawSelection(p);
	}
Exemple #26
0
void World::drawSelection(Window* window, float delta, Grid grid, bool selectable)
{
    selection_offset += multiplier * delta * 10;
    if(multiplier == 1 && selection_offset > 2)
    {
        multiplier = -1;
    }
    else if(multiplier == -1 && selection_offset < -2)
    {
        multiplier = 1;
    }

    drawSelection(window,delta,grid.col * gconsts::TILE_SIZE, grid.row * gconsts::TILE_SIZE,(int)selection_offset,24);
}
void CanvasMode_EditArc::drawControls(QPainter* p)
{
	p->save();
	if (m_canvas->m_viewMode.operItemMoving)
	{
		drawOutline(p);
	}
	else
	{
		drawSelection(p, false);
	}
	if (m_doc->appMode == modeEditArc)
	{
		drawControlsArc(p, m_doc->m_Selection->itemAt(0));
	}
	p->restore();
}
Exemple #28
0
static void gui_drawingarea_cb_expose (Picture me, GuiDrawingArea_ExposeEvent event) {
	#if gtk
		/*
		 * The size of the viewable part of the drawing area may have changed.
		 */
		Melder_assert (event -> widget);
		#if ALLOW_GDK_DRAWING
			gdk_cairo_reset_clip ((cairo_t *) Graphics_x_getCR (my graphics.get()),          GDK_DRAWABLE (GTK_WIDGET (event -> widget -> d_widget) -> window));
			gdk_cairo_reset_clip ((cairo_t *) Graphics_x_getCR (my selectionGraphics.get()), GDK_DRAWABLE (GTK_WIDGET (event -> widget -> d_widget) -> window));
		#endif
	#else
		(void) event;
	#endif
	drawMarkers (me);
	Graphics_play (my graphics.get(), my graphics.get());
	drawSelection (me, 1);
}
Exemple #29
0
//--------------------------------------------------------------
void testApp::draw(){
	camera.begin();
	
	if (drawEnabled["ofGrid"]) {
		ofPushStyle();
		ofSetColor(155,100,100);
		ofDrawGrid(1.0f, 5.0f, true);
		ofPopStyle();
	}
	
	if (drawEnabled["ofRay"])
		ray.draw();
	
	if (drawEnabled["ofPlane"]) {
		plane.draw();
		for (int i=0; i<4; i++)
			corners[i].draw();
	}
	
	if (drawEnabled["ofProjector"]) {
		projector.draw();
		pRay.draw();
	}

	if (drawEnabled["ofRay"] && drawEnabled["ofRay"]) {
		bool intersects;
		ofVec3f intersect;
		intersects = plane.intersect(ray, intersect);
		
		ofPushMatrix();
		ofPushStyle();
		ofTranslate(intersect);
		if (intersects)
			ofFill();
		else
			ofNoFill();
		ofCircle(0, 0, 0.1f);
		ofPopStyle();
		ofPopMatrix();
	}
	
	camera.end();
	
	drawSelection();
}
Exemple #30
0
void drawRoomEditor(void)
{
	projectCamera(&editorCamera);
	glLoadIdentity();
	
	glPushMatrix();		
		glScalef32(editorScale,editorScale,editorScale);
		transformCamera(&editorCamera);

		drawEditorRoom(&editorRoom);
		drawEntities();
		drawSelection(NULL);
	glPopMatrix(1);

	drawContextButtons();
	
	glFlush(0);
}