Example #1
0
ofxPDSPMidiKeys::ofxPDSPMidiKeys(){
   
    gates.reserve(16);
    values.reserve(16);
    outs_trig.reserve(32);
    outs_pitch.reserve(32);
    unisonPitchDetune.reserve(32);
    voiceUnisonMod.reserve(32);
    out_singletrigger.setSingleTrigger(true);
    setUnisonDetune(0.3f);

    portamentoMode = Off;
    portamentoTime = 200.0f;
    slewMode = pdsp::Time;

    setSlew(40.0f);
    setPitchBend(-2, 2);

    setPolyMode(8, 1);
}
void ofCairoRenderer::setStyle(const ofStyle & style){
	//color
	setColor((int)style.color.r, (int)style.color.g, (int)style.color.b, (int)style.color.a);

	//bg color
	setBackgroundColor(style.bgColor);

	//circle resolution - don't worry it only recalculates the display list if the res has changed
	setCircleResolution(style.circleResolution);

	setSphereResolution(style.sphereResolution);

	setCurveResolution(style.curveResolution);

	//line width - finally!
	setLineWidth(style.lineWidth);

	//rect mode: corner/center
	setRectMode(style.rectMode);

	//poly mode: winding type
	setPolyMode(style.polyMode);

	//fill
	setFillMode(style.bFill?OF_FILLED:OF_OUTLINE);

	//smoothing
	//setSmoothingEnabled(style.smoothing);

	//blending
	setBlendMode(style.blendingMode);

	//bitmap draw mode
	//setDrawBitmapMode(style.drawBitmapMode);
	currentStyle = style;
}
Example #3
0
/**************************************************************
 *
 *  constructor 
 *  @param MainWindow the mainWindow
 *  @param parent the parent widget
 *  @return name the name of the canvas
 *
 *************************************************************/
Canvas2D::Canvas2D(MainWindow* mw, QWidget* parent, const char* name)
    : AbsCanvas(parent, name)
{ 

  _mw = mw;

  //set square number to default
  _squareNumber = SQUARE_NUMBER_DEFAULT; 

  //define canvas2D type
  QString type(name);
  if((type.compare(sectionS))==0){
    _canvasType = SECTION_CANVAS;
  }
  else if((type.compare(cheminS))==0){
        _canvasType = CHEMIN_CANVAS;
  }
  else if((type.compare(profilS))==0){
        _canvasType = PROFIL_CANVAS;
  }
  else{
    _canvasType = W3D_CANVAS;
  }

  //popup menu building (differs from canvas type)
  _fileMenu = new QPopupMenu(this);

  //creation of the QActions
  QAction *polyAction = 
    new QAction(QIconSet(QPixmap("../images/polyline.png")),
		"Polyline",0,this);

  QAction *nurbsAction = 
    new QAction(QIconSet(QPixmap("../images/nurbs.png")),
		"Nurbs",0,this);

  QAction *circleAction = 
    new QAction(QIconSet(QPixmap("../images/ellipse.png")),
		"Circle",0,this);

  QAction *quadriAction = 
    new QAction(QIconSet(QPixmap("../images/quadri.png")),
		"Rectangle",0,this);

  QAction *polygAction = 
    new QAction(QIconSet(QPixmap("../images/polygone.png")),
		"Polygon",0,this);

  QAction *selectAllAction = 
    new QAction(QIconSet(QPixmap("../images/selectAll.png")),
		"Select all",0,this);

  QAction *deselectAllAction = 
    new QAction(QIconSet(QPixmap("../images/deselectAll.png")),
		"Deselect all",0,this);

  QAction *deleteAllAction = 
    new QAction(QIconSet(QPixmap("../images/deleteAll.png")),
		"DeleteAll",0,this);

  //connect actions
  connect(polyAction,
          SIGNAL( activated() ),
          this,
          SLOT(setPolyMode()) );
  connect(nurbsAction,
          SIGNAL( activated() ),
          this,
          SLOT(setNurbsMode()) );
  connect(circleAction,
          SIGNAL( activated() ),
          this,
          SLOT(setCircleMode()) );
  connect(quadriAction,
          SIGNAL( activated() ),
          this,
          SLOT(setRecMode()) );
  connect(polygAction,
          SIGNAL( activated() ),
          this,
          SLOT(setPolygMode()) );

  connect(selectAllAction,
          SIGNAL( activated() ),
          this,
	  SLOT(selectAllPoints()) );

  connect(deselectAllAction,
          SIGNAL( activated() ),
          this,
          SLOT(deselectAllPoints()) );

  connect(deleteAllAction,
          SIGNAL( activated() ),
          this,
          SLOT(deleteAllPoints()) );

  //add QActions to menu
  polyAction->addTo(_fileMenu);
  nurbsAction->addTo(_fileMenu);
  circleAction->addTo(_fileMenu);
  quadriAction->addTo(_fileMenu);
  polygAction->addTo(_fileMenu);
  
  //if it's the canvas profil, disable many tools
  if(_canvasType == PROFIL_CANVAS){
    
    _fileMenu->setItemEnabled(_fileMenu->idAt(2),false);
    _fileMenu->setItemEnabled(_fileMenu->idAt(3),false);
    _fileMenu->setItemEnabled(_fileMenu->idAt(4),false);  
  }

  _fileMenu->insertSeparator();

  selectAllAction->addTo(_fileMenu);
  deselectAllAction->addTo(_fileMenu);
  _fileMenu->insertSeparator();
  deleteAllAction->addTo(_fileMenu);

  //polyline default tool
  _toolMode = POLY_MODE;
  
  //creation of the curves class
  _figure = new Curves(this);;
}