void keyboard(int key, int x, int y) { switch(key) { case 'b': // Blink eyes blink(); break; case 'c': // Change color changeColor(); break; case 'd': // Increase diffusive reflection diffuseReflect(); break; case 's': // Increase specular reflection specularReflect(); break; case 'h': // Increase shiny increaseShiny(); break; case 'j': // Jump jump(); break; case 'r': // Run run(); break; case 't': // Turn Around rightRun = 0; leftRun = 0; ypos = 0; bodyRotate.y+=5; moved = false; break; case 'w': // Wave arms waveArms(); break; case 'q': // Quit exit(0); break; } glutPostRedisplay(); }
DragBaseLine::DragBaseLine(const QPoint & p1, const QPoint & p2, DragWidget *canvasWidget, const QColor &defaultColor) : QWidget(canvasWidget), AbstractDragInterface(canvasWidget), m_AbsoluteLine(p1,p2), m_iLineWidth(LINE_WIDTH_2), m_iLineWidthToPaint(m_iLineWidth), m_LineStyle(Qt::SolidLine) { setAttribute(Qt::WA_DeleteOnClose); changeColor(defaultColor); qDebug() << "DragBaseLine() m_AbsoluteLine(" << p1 << p2 << ")"; m_PaintingArea.setTop( qMin(p1.y(),p2.y())); m_PaintingArea.setBottom( qMax(p1.y(),p2.y())); m_PaintingArea.setLeft(qMin(p1.x(),p2.x())); m_PaintingArea.setRight(qMax(p1.x(),p2.x())); qDebug() << "DragBaseLine():m_PaintingArea topleft:" << m_PaintingArea.topLeft() << " bottomright:"<< m_PaintingArea.bottomRight(); //relative to widget QPoint rel_p1(0,0), rel_p2(0,0); if(p1.x() <= p2.x()) rel_p2.setX(p2.x() - p1.x()); else rel_p1.setX(p1.x() - p2.x()); if (p1.y() <= p2.y()) rel_p2.setY( p2.y() - p1.y()); else rel_p1.setY(p1.y() - p2.y()); m_RelativeWidgetLine.setPoints(rel_p1, rel_p2); qDebug() << "DragBaseLine():m_RelativeWidgetLine " << m_RelativeWidgetLine.p1() << m_RelativeWidgetLine.p2(); setAttribute( Qt::WA_TranslucentBackground, true ); move(m_PaintingArea.left(), m_PaintingArea.top()); resize(m_PaintingArea.size().width(), m_PaintingArea.size().height()); qDebug() << "DragBaseLine():moving left:" << m_PaintingArea.left() << " top:"<< m_PaintingArea.top(); show(); }
// Slot called when the menu item is activated void QgsScaleBarPlugin::run() { QgsScaleBarPluginGui *myPluginGui = new QgsScaleBarPluginGui( qGisInterface->mainWindow(), QgisGui::ModalDialogFlags ); myPluginGui->setAttribute( Qt::WA_DeleteOnClose ); myPluginGui->setPreferredSize( mPreferredSize ); myPluginGui->setSnapping( mSnapping ); myPluginGui->setPlacementLabels( mPlacementLabels ); myPluginGui->setPlacement( mPlacementIndex ); myPluginGui->setEnabled( mEnabled ); myPluginGui->setStyleLabels( mStyleLabels ); myPluginGui->setStyle( mStyleIndex ); myPluginGui->setColor( mColor ); connect( myPluginGui, SIGNAL( changePreferredSize( int ) ), this, SLOT( setPreferredSize( int ) ) ); connect( myPluginGui, SIGNAL( changeSnapping( bool ) ), this, SLOT( setSnapping( bool ) ) ); connect( myPluginGui, SIGNAL( changePlacement( int ) ), this, SLOT( setPlacement( int ) ) ); connect( myPluginGui, SIGNAL( changeEnabled( bool ) ), this, SLOT( setEnabled( bool ) ) ); connect( myPluginGui, SIGNAL( changeStyle( int ) ), this, SLOT( setStyle( int ) ) ); connect( myPluginGui, SIGNAL( changeColor( QColor ) ), this, SLOT( setColor( QColor ) ) ); connect( myPluginGui, SIGNAL( refreshCanvas() ), this, SLOT( refreshCanvas() ) ); myPluginGui->show(); //set the map units in the spin box int myUnits = qGisInterface->mapCanvas()->mapUnits(); switch ( myUnits ) { case 0: myPluginGui->getSpinSize()->setSuffix( tr( " metres/km" ) ); break; case 1: myPluginGui->getSpinSize()->setSuffix( tr( " feet/miles" ) ); break; case 2: myPluginGui->getSpinSize()->setSuffix( tr( " degrees" ) ); break; default: QgsDebugMsg( QString( "Error: not picked up map units - actual value = %1" ).arg( myUnits ) ); }; }
void AttributesEditor::connectSlots() { // General connect(_generalColorButton, SIGNAL(clicked()), this, SLOT(changeColor())); connect(_boxStartValue, SIGNAL(valueChanged(double)), this, SLOT(startChanged())); connect(_boxLengthValue, SIGNAL(valueChanged(double)), this, SLOT(lengthChanged())); connect(_boxName, SIGNAL(returnPressed()), this, SLOT(nameChanged())); connect(_networkTree, SIGNAL(startMessageValueChanged(QTreeWidgetItem *)), this, SLOT(startMessageChanged(QTreeWidgetItem *))); connect(_networkTree, SIGNAL(endMessageValueChanged(QTreeWidgetItem *)), this, SLOT(endMessageChanged(QTreeWidgetItem *))); connect(_snapshotAssignStart, SIGNAL(clicked()), this, SLOT(snapshotStartAssignment())); connect(_snapshotAssignEnd, SIGNAL(clicked()), this, SLOT(snapshotEndAssignment())); connect(_networkTree, SIGNAL(itemExpanded(QTreeWidgetItem *)), this, SLOT(addToExpandedItemsList(QTreeWidgetItem*))); connect(_networkTree, SIGNAL(itemCollapsed(QTreeWidgetItem *)), this, SLOT(removeFromExpandedItemsList(QTreeWidgetItem*))); connect(_networkTree, SIGNAL(curveActivationChanged(QTreeWidgetItem*, bool)), this, SLOT(curveActivationChanged(QTreeWidgetItem*, bool))); connect(_networkTree, SIGNAL(curveRedundancyChanged(QTreeWidgetItem*, bool)), this, SLOT(curveRedundancyChanged(QTreeWidgetItem*, bool))); connect(_networkTree, SIGNAL(curveSampleRateChanged(QTreeWidgetItem*, int)), this, SLOT(curveSampleRateChanged(QTreeWidgetItem*, int))); connect(_networkTree, SIGNAL(messageChanged(QTreeWidgetItem*, QString)), this, SLOT(deployMessageChanged(QTreeWidgetItem*, QString))); connect(_networkTree, SIGNAL(deviceChanged(QString, QString)), this, SLOT(deployDeviceChanged(QString, QString))); }
const char *LH_LgBacklight::userInit() { if( const char *err = LH_QtPlugin::userInit() ) return err; devselect_ = new LH_Qt_QStringList( this, "Device", QStringList(), LH_FLAG_NOSAVE_DATA|LH_FLAG_NOSAVE_LINK|LH_FLAG_NOSOURCE|LH_FLAG_NOSINK|LH_FLAG_HIDDEN ); devselect_->setHelp( "The device which backlight you want to control." ); connect( devselect_, SIGNAL(changed()), this, SLOT(changeDev()) ); devcolor_ = new LH_Qt_QColor( this, "Color", Qt::white, LH_FLAG_NOSAVE_DATA|LH_FLAG_NOSAVE_LINK|LH_FLAG_HIDDEN ); devcolor_->setHelp("The color you want to see used as backlight."); connect( devcolor_, SIGNAL(changed()), this, SLOT(changeColor()) ); allcolor_ = new LH_Qt_QColor( this, "SetAllColor", Qt::white, LH_FLAG_NOSAVE_DATA|LH_FLAG_NOSAVE_LINK|LH_FLAG_HIDDEN|LH_FLAG_NOSOURCE ); allcolor_->setSubscribePath("/plugin/backlight/all/set"); connect( allcolor_, SIGNAL(changed()), this, SLOT(setAllColor()) ); poll_interval_ = new LH_Qt_int(this, "Poll interval", 500, 100, 5000); poll_interval_->setHelp("Interval in milliseconds to check for device color changes"); connect(poll_interval_, SIGNAL(changed()), this, SLOT(pollIntervalChanged())); LH_HidDevice::subscribe(this, SLOT(onlineChanged(LH_HidDevice*,bool))); pollIntervalChanged(); return 0; }
static void initColor (struct state *st, double r, double g, double b) { int n,n1; unsigned long pixels[12]; unsigned long dummy; st->cmap = st->xgwa.colormap; if(st->hsvcycl!=0.0 && XAllocColorCells(st->dpy, st->cmap, 0, &dummy, 0, pixels, 12)) { for(n1=0;n1<12;n1++) { st->colors[n1].pixel=pixels[n1]; st->colors[n1].flags=DoRed | DoGreen | DoBlue; } changeColor(st,r,g,b); } else { n1=0; for(n=30;n<64;n+=3) { st->colors[n1].red =1023+ n*(int)(1024.*r); st->colors[n1].blue =1023+ n*(int)(1024.*b); st->colors[n1].green =1023+ n*(int)(1024.*g); if (!(XAllocColor (st->dpy, st->cmap, &st->colors[n1]))) { fprintf (stderr, "Error: Cannot allocate colors\n"); exit (1); } n1++; } } }
int SeqEdgeColoringPar<DefaultStructs>::VizingState<Graph,ColorMap>:: altPathRecoloring(int ivert, int col) { typedef typename Graph::PEdge Edge; int iCol = (col==colSubgraph[0]) ? 0 : 1; assert(colSubgraph[iCol]==col); assert(tabVert[ivert].vc[iCol^1]<0); //it's a beginning of the alternating path tabVert[ivert].freeColor = colSubgraph[iCol]; if(tabVert[ivert].vc[iCol]>=0) { while(tabVert[ivert].vc[iCol]>=0) { Edge ee = tabVert[ivert].ec[iCol]; int oldColor = colSubgraph[iCol]; int newColor = colSubgraph[iCol^1]; colors[ee] = newColor; changeColor(ee, oldColor, newColor); ivert = tabVert[ivert].vc[iCol]; iCol ^= 1; } tabVert[ivert].freeColor = colSubgraph[iCol^1]; } return ivert; }
void printLogo() { int line; if (!DEBUG) kprintf("\n\n\n\n\n\n\n"); else kprintf("\n\n"); changeColor(0x0, 0xE); for(line = 1; line <= 26; line++) kprintf(" "); kprintf("# # ### ###\n"); changeColor(0x0, 0xC); for(line = 1; line <= 26; line++) kprintf(" "); kprintf("# # # #\n"); changeColor(0x0, 0xB); for(line = 1; line <= 26; line++) kprintf(" "); kprintf("# # ### ## # # ##\n"); changeColor(0x0, 0xA); for(line = 1; line <= 26; line++) kprintf(" "); kprintf("# # # # # # # # #\n"); changeColor(0x0, 0xD); for(line = 1; line <= 26; line++) kprintf(" "); kprintf("#### # ### # # ### ###\n\n\n"); changeColor(0x0, 0xF); }
void OpenSGLatticeGeometry::setUnselected() { selectedPoints.clear(); changeColor(); }
void Node::hit() { changeColor(); }
void Node::mousePressed() { // std::cout << "Node::mousePressed" << std::endl; changeColor(); }
void Button::getColor() { emit changeColor(color_); }
void Global::createToolBars() { // ----- Tool modes ----- // Create toolbar toolBar_ = mainWindow()->addToolBar(tr("Toolbar")); toolBar_->setOrientation(Qt::Vertical); toolBar_->setMovable(false); mainWindow()->addToolBar(Qt::LeftToolBarArea, toolBar_); // Set toolbar size int iconWidth = 32; toolBar_->setIconSize(QSize(iconWidth,iconWidth)); currentColor_->setIconSize(QSize(iconWidth,iconWidth)); currentColor_->updateIcon(); // Create actions (exclusive checkable) QActionGroup * actionGroup = new QActionGroup(this); for(int i=0; i<NUMBER_OF_TOOL_MODES; i++) { toolModeActions[i] = new ToolModeAction(static_cast<ToolMode>(i), actionGroup); toolModeActions[i]->setCheckable(true); toolModeActions[i]->setShortcutContext(Qt::ApplicationShortcut); toolBar_->addAction(toolModeActions[i]); connect(toolModeActions[i], SIGNAL(triggered(Global::ToolMode)), this, SLOT(setToolMode(Global::ToolMode))); } // Select toolModeActions[SELECT]->setText(tr("Select and move (F1)")); toolModeActions[SELECT]->setIcon(QIcon(":/images/select.png")); toolModeActions[SELECT]->setStatusTip(tr("Select objects, move objects, glue objects together, and split curves.")); toolModeActions[SELECT]->setShortcut(QKeySequence(Qt::Key_F1)); // Sketch toolModeActions[SKETCH]->setText(tr("Sketch (F2)")); toolModeActions[SKETCH]->setIcon(QIcon(":/images/sketch.png")); toolModeActions[SKETCH]->setStatusTip(tr("Sketch curves.")); toolModeActions[SKETCH]->setShortcut(QKeySequence(Qt::Key_F2)); // Paint toolModeActions[PAINT]->setText(tr("Paint (F3)")); toolModeActions[PAINT]->setIcon(QIcon(":/images/paint.png")); toolModeActions[PAINT]->setStatusTip(tr("Paint an empty space or an existing object.")); toolModeActions[PAINT]->setShortcut(QKeySequence(Qt::Key_F3)); // Sculpt toolModeActions[SCULPT]->setText(tr("Sculpt (F4)")); toolModeActions[SCULPT]->setIcon(QIcon(":/images/sculpt.png")); toolModeActions[SCULPT]->setStatusTip(tr("Sculpt curves.")); toolModeActions[SCULPT]->setShortcut(QKeySequence(Qt::Key_F4)); // ----- Color selectors ----- // Colors colorSelectorAction_ = toolBar_->addWidget(currentColor_); colorSelectorAction_->setText(tr("Color")); colorSelectorAction_->setToolTip(tr("Color (C)")); colorSelectorAction_->setStatusTip(tr("Click to open the color selector")); colorSelectorAction_->setShortcut(QKeySequence(Qt::Key_C)); colorSelectorAction_->setShortcutContext(Qt::ApplicationShortcut); connect(colorSelectorAction_, SIGNAL(triggered()), currentColor_, SLOT(click())); // ----- Tool Options ----- toolModeToolBar_ = new QToolBar("Action Bar"); toolModeToolBar_->setIconSize(QSize(200,iconWidth)); toolModeToolBar_->setMovable(false); mainWindow()->addToolBar(toolModeToolBar_); // --------------------- Color ------------------------ actionChangeColor_ = new QAction(this); actionChangeColor_->setText(tr("Change color")); actionChangeColor_->setIcon(QIcon(":/images/change-color.png")); actionChangeColor_->setStatusTip(tr("Change the color of the selected cells")); //actionChangeColor_->setShortcut(QKeySequence(Qt::Key_C)); actionChangeColor_->setShortcutContext(Qt::ApplicationShortcut); mainWindow()->addAction(actionChangeColor_); connect(actionChangeColor_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(changeColor())); // --------------------- Edges ------------------------ actionChangeEdgeWidth_ = new QAction(this); actionChangeEdgeWidth_->setText(tr("Change edge width (W)")); actionChangeEdgeWidth_->setIcon(QIcon(":/images/change-width.png")); actionChangeEdgeWidth_->setStatusTip(tr("Change the width of the selected edges")); actionChangeEdgeWidth_->setShortcut(QKeySequence(Qt::Key_W)); actionChangeEdgeWidth_->setShortcutContext(Qt::ApplicationShortcut); mainWindow()->addAction(actionChangeEdgeWidth_); connect(actionChangeEdgeWidth_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(changeEdgeWidth())); // --------------------- Faces ------------------------ actionCreateFace_ = new QAction(this); actionCreateFace_->setText(tr("Create Face (F)")); actionCreateFace_->setIcon(QIcon(":/images/create-face.png")); actionCreateFace_->setStatusTip(tr("Create a face whose boundary is the selected edges")); actionCreateFace_->setShortcut(QKeySequence(Qt::Key_F)); actionCreateFace_->setShortcutContext(Qt::ApplicationShortcut); mainWindow()->addAction(actionCreateFace_); connect(actionCreateFace_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(createFace())); actionAddCycles_ = new QAction(this); actionAddCycles_->setText(tr("Add Holes (H)")); actionAddCycles_->setIcon(QIcon(":/images/add-cycles.png")); actionAddCycles_->setStatusTip(tr("Add holes to the selected face, whose boundaries are the selected edges")); actionAddCycles_->setShortcut(QKeySequence(Qt::Key_H)); actionAddCycles_->setShortcutContext(Qt::ApplicationShortcut); mainWindow()->addAction(actionAddCycles_); connect(actionAddCycles_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(addCyclesToFace())); actionRemoveCycles_ = new QAction(this); actionRemoveCycles_->setText(tr("Remove Holes (Ctrl+H)")); actionRemoveCycles_->setIcon(QIcon(":/images/remove-cycles.png")); actionRemoveCycles_->setStatusTip(tr("Remove holes from the selected face, whose boundaries are the selected edges")); actionRemoveCycles_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_H)); actionRemoveCycles_->setShortcutContext(Qt::ApplicationShortcut); mainWindow()->addAction(actionRemoveCycles_); connect(actionRemoveCycles_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(removeCyclesFromFace())); // --------------------- Topological operations ------------------------ actionGlue_ = new QAction(this); actionGlue_->setText(tr("Glue")); actionGlue_->setToolTip(tr("Glue (G)")); actionGlue_->setIcon(QIcon(":/images/glue.png")); actionGlue_->setStatusTip(tr("Glue two endpoints or two curves together")); actionGlue_->setShortcut(QKeySequence(Qt::Key_G)); actionGlue_->setShortcutContext(Qt::ApplicationShortcut); mainWindow()->addAction(actionGlue_); connect(actionGlue_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(glue())); actionUnglue_ = new QAction(this); actionUnglue_->setText(tr("Explode")); actionUnglue_->setToolTip(tr("Explode (E)")); actionUnglue_->setIcon(QIcon(":/images/unglue.png")); actionUnglue_->setStatusTip(tr("Duplicate the selected objects to disconnect adjacent curves and surfaces")); //actionUnglue_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G)); actionUnglue_->setShortcut(QKeySequence(Qt::Key_E)); actionUnglue_->setShortcutContext(Qt::ApplicationShortcut); mainWindow()->addAction(actionUnglue_); connect(actionUnglue_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(unglue())); actionUncut_ = new QAction(this); actionUncut_->setText(tr("Simplify")); actionUncut_->setToolTip(tr("Simplify (Backspace)")); actionUncut_->setIcon(QIcon(":/images/simplify.png")); actionUncut_->setStatusTip(tr("Simplify the selected objects, by merging curves and surfaces together")); actionUncut_->setShortcut(QKeySequence(Qt::Key_Backspace)); actionUncut_->setShortcutContext(Qt::ApplicationShortcut); mainWindow()->addAction(actionUncut_); connect(actionUncut_, SIGNAL(triggered()), mainWindow()->scene(), SLOT(uncut())); // Desired icon size double sideLength = 40; // --------------------- Shared actions/options ------------------------ // None // --------------------- Select options ------------------------ toolModeToolBar_->addAction(actionChangeColor_); toolModeToolBar_->addAction(actionChangeEdgeWidth_); separatorSelect1_ = toolModeToolBar_->addSeparator(); toolModeToolBar_->addAction(actionCreateFace_); toolModeToolBar_->addAction(actionAddCycles_); toolModeToolBar_->addAction(actionRemoveCycles_); separatorSelect2_ = toolModeToolBar_->addSeparator(); toolModeToolBar_->widgetForAction(actionChangeColor_)->setFixedSize(sideLength,sideLength); toolModeToolBar_->widgetForAction(actionChangeEdgeWidth_)->setFixedSize(sideLength,sideLength); toolModeToolBar_->widgetForAction(actionCreateFace_)->setFixedSize(sideLength,sideLength); toolModeToolBar_->widgetForAction(actionAddCycles_)->setFixedSize(sideLength,sideLength); toolModeToolBar_->widgetForAction(actionRemoveCycles_)->setFixedSize(sideLength,sideLength); toolModeToolBar_->addAction(actionGlue_); toolModeToolBar_->addAction(actionUnglue_); toolModeToolBar_->addAction(actionUncut_); toolModeToolBar_->widgetForAction(actionGlue_)->setFixedSize(sideLength+20,sideLength); toolModeToolBar_->widgetForAction(actionUnglue_)->setFixedSize(sideLength+20,sideLength); toolModeToolBar_->widgetForAction(actionUncut_)->setFixedSize(sideLength+20,sideLength); // --------------------- Sketch options ------------------------ // Tablet pressure actionUseTabletPressure_ = new QAction(this); actionUseTabletPressure_->setCheckable(true); actionUseTabletPressure_->setChecked(true); toolModeToolBar_->addAction(actionUseTabletPressure_); toolModeToolBar_->widgetForAction(actionUseTabletPressure_)->setFixedSize(sideLength,sideLength); actionUseTabletPressure_->setText(tr("Toggle stylus pressure")); actionUseTabletPressure_->setIcon(QIcon(":/images/pressure.png")); actionUseTabletPressure_->setStatusTip(tr("Enable or disable stylus pressure (only for users with a pen tablet)")); //actionUseTabletPressure_->setShortcut(QKeySequence(Qt::Key_Backspace)); actionUseTabletPressure_->setShortcutContext(Qt::ApplicationShortcut); mainWindow()->addAction(actionUseTabletPressure_); connect(actionUseTabletPressure_, SIGNAL(triggered()), this, SLOT(toggleStylusPressure())); // Edge width edgeWidth_ = new SpinBox(); edgeWidth_->setCaption(tr(" pen width ")); edgeWidth_->setValue(settings().edgeWidth()); actionEdgeWidth_ = toolModeToolBar_->addWidget(edgeWidth_); connect(edgeWidth_, SIGNAL(valueChanged(double)), this, SLOT(setEdgeWidth_(double))); // Separator separatorSketch1_ = toolModeToolBar_->addSeparator(); // Planar map mode actionPlanarMapMode_ = new QAction(this); actionPlanarMapMode_->setCheckable(true); actionPlanarMapMode_->setChecked(true); toolModeToolBar_->addAction(actionPlanarMapMode_); toolModeToolBar_->widgetForAction(actionPlanarMapMode_)->setFixedSize(110,sideLength); actionPlanarMapMode_->setText(tr("Toggle intersections")); actionPlanarMapMode_->setIcon(QIcon(":/images/planar-map-on.png")); actionPlanarMapMode_->setStatusTip(tr("When intersections are enabled, the sketched curve automatically splits existing curves and surfaces.")); //actionPlanarMapMode_->setShortcut(QKeySequence(Qt::Key_Backspace)); actionPlanarMapMode_->setShortcutContext(Qt::ApplicationShortcut); mainWindow()->addAction(actionPlanarMapMode_); connect(actionPlanarMapMode_, SIGNAL(triggered()), this, SLOT(togglePlanarMapMode())); // Separator separatorSketch2_ = toolModeToolBar_->addSeparator(); // Snapping actionSnapMode_ = new QAction(this); actionSnapMode_->setCheckable(true); actionSnapMode_->setChecked(true); toolModeToolBar_->addAction(actionSnapMode_); toolModeToolBar_->widgetForAction(actionSnapMode_)->setFixedSize(110,sideLength); actionSnapMode_->setText(tr("Toggle snapping")); actionSnapMode_->setIcon(QIcon(":/images/snapping-on.png")); actionSnapMode_->setStatusTip(tr("When snapping is enabled, the sketched curve is automatically glued to existing curves.")); //actionSnapMode_->setShortcut(QKeySequence(Qt::Key_Backspace)); actionSnapMode_->setShortcutContext(Qt::ApplicationShortcut); mainWindow()->addAction(actionSnapMode_); connect(actionSnapMode_, SIGNAL(triggered()), this, SLOT(toggleSnapping())); // Edge width actionSnapThreshold_ = toolModeToolBar_->addWidget(snapThreshold_); // --------------------- Sculpt options ------------------------ actionSculptRadius_ = toolModeToolBar_->addWidget(sculptRadius_); // --------------------- Cut options ------------------------ // Set default Tool Mode setToolMode(SKETCH); }
void ColoringRulesDialog::on_fGPushButton_clicked() { changeColor(); }
QgsGrassRegion::QgsGrassRegion( QgsGrassPlugin *plugin, QgisInterface *iface, QWidget * parent, Qt::WFlags f ) : QDialog( parent, f ), QgsGrassRegionBase( ) { QgsDebugMsg( "QgsGrassRegion()" ); setupUi( this ); setAttribute( Qt::WA_DeleteOnClose ); connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) ); connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); mPlugin = plugin; mInterface = iface; mCanvas = mInterface->mapCanvas(); restorePosition(); mUpdatingGui = false; // Set input validators QDoubleValidator *dv = new QDoubleValidator( 0 ); QIntValidator *iv = new QIntValidator( 0 ); mNorth->setValidator( dv ); mSouth->setValidator( dv ); mEast->setValidator( dv ); mWest->setValidator( dv ); mNSRes->setValidator( dv ); mEWRes->setValidator( dv ); mRows->setValidator( iv ); mCols->setValidator( iv ); // Group radio buttons mRadioGroup = new QButtonGroup(); mRadioGroup->addButton( mCellResRadio ); mRadioGroup->addButton( mRowsColsRadio ); mCellResRadio->setChecked( true ); radioChanged(); connect( mRadioGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( radioChanged() ) ); // Set values to current region QString gisdbase = QgsGrass::getDefaultGisdbase(); QString location = QgsGrass::getDefaultLocation(); QString mapset = QgsGrass::getDefaultMapset(); if ( gisdbase.isEmpty() || location.isEmpty() || mapset.isEmpty() ) { QMessageBox::warning( 0, tr( "Warning" ), tr( "GISDBASE, LOCATION_NAME or MAPSET is not set, cannot display current region." ) ); } QgsGrass::setLocation( gisdbase, location ); char *err = G__get_window( &mWindow, ( char * ) "", ( char * ) "WIND", mapset.toLatin1().data() ); if ( err ) { QMessageBox::warning( 0, tr( "Warning" ), tr( "Cannot read current region: %1" ).arg( QString::fromUtf8( err ) ) ); return; } mRegionEdit = new QgsGrassRegionEdit( mCanvas ); connect( mRegionEdit, SIGNAL( captureStarted() ), this, SLOT( hide() ) ); connect( mRegionEdit, SIGNAL( captureEnded() ), this, SLOT( onCaptureFinished() ) ); mCanvas->setMapTool( mRegionEdit ); refreshGui(); connect( mCanvas, SIGNAL( renderComplete( QPainter * ) ), this, SLOT( postRender( QPainter * ) ) ); // Connect entries connect( mNorth, SIGNAL( editingFinished() ), this, SLOT( northChanged() ) ); connect( mSouth, SIGNAL( editingFinished() ), this, SLOT( southChanged() ) ); connect( mEast, SIGNAL( editingFinished() ), this, SLOT( eastChanged() ) ); connect( mWest, SIGNAL( editingFinished() ), this, SLOT( westChanged() ) ); connect( mNSRes, SIGNAL( editingFinished() ), this, SLOT( NSResChanged() ) ); connect( mEWRes, SIGNAL( editingFinished() ), this, SLOT( EWResChanged() ) ); connect( mRows, SIGNAL( editingFinished() ), this, SLOT( rowsChanged() ) ); connect( mCols, SIGNAL( editingFinished() ), this, SLOT( colsChanged() ) ); // Symbology QPen pen = mPlugin->regionPen(); mColorButton->setColor( pen.color() ); connect( mColorButton, SIGNAL( clicked() ), this, SLOT( changeColor() ) ); mWidthSpinBox->setValue( pen.width() ); connect( mWidthSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( changeWidth() ) ); }
void ComDraw::drawSolidPoly(const CCPoint *poli, unsigned int numberOfPoints, string color) { ccDrawSolidPoly(poli, numberOfPoints, changeColor(color, 1.f)); }
void initKeycodes() { pc("[06.000050] -initKeycodes() called"); int line; int scan; if (askKeycodes) { pc("[06.000055] +Ask User"); pc("[06.000056] +Attemp Overlay - Debug Output frozen"); char vm[25 * 2 * 80]; kmemcpy(&(vm[0]), &(video[0]), 25 * 80 * 2); setFix(0); clearscreen(); printLogo(); for(line = 1; line <= 23; line++) kprintf(" "); kprintf("%c Please choose Keyboard layout %c\n\n", (char) 174, (char) 175); for(line = 1; line <= 26; line++) kprintf(" "); kprintf("<1> QWERTY (English Layout)\n"); for(line = 1; line <= 26; line++) kprintf(" "); kprintf("<2> QWERTZ (German Layout)\n"); changeColor(0x0, 0x0); kprintf(" \b"); scan = FetchAndAnalyzeScancode(); changeColor(0x0, 0xF); kmemcpy(&(video[0]), &(vm[0]), 25 * 80 * 2); setFix(10); pc("[06.000056] +overlay finished"); } else { PS("[06.%s] +echo \"Using Keyboard Layout QWERTZ (GERMAN)", dl); DEBUG_MSG("IO: Using Keyboard Layout QWERTZ (German)..."); scan = 3; dbg(true); } pc("[06.000081] +setIOKbLeyout to %s", (scan == 2) ? "QWERTY - US" : "QWERTZ - DE"); if (scan == 2) // QWERTY -- US { unsigned char tasciiNonShift[100] = { 0, ESC, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', BACKSPACE, TAB, 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', ENTER, 0, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', 0, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 0, 0, 0, ' ', 0, KF1, KF2, KF3, KF4, KF5, KF6, KF7, KF8, KF9, KF10, 0, 0, KHOME, KUP, KPGUP,'-', KLEFT, '5', KRIGHT, '+', KEND, KDOWN, KPGDN, KINS, KDEL, 0, 0, 0, KF11, KF12 }; tasciiNonShift[86] = '<'; unsigned char tasciiShift[100] = { 0, ESC, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', BACKSPACE, TAB, 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', ENTER, 0, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '\"', '~', 0, '|', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?', 0, 0, 0, ' ', 0, KF1, KF2, KF3, KF4, KF5, KF6, KF7, KF8, KF9, KF10, 0, 0, KHOME, KUP, KPGUP, '-', KLEFT, '5', KRIGHT, '+', KEND, KDOWN, KPGDN, KINS, KDEL, 0, 0, 0, KF11, KF12 }; tasciiShift[86] = '>'; unsigned char tasciiAltGR[100] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; tasciiAltGR[86] = '|'; int i; for(i = 0; i <= 100; i++) { asciiNonShift[i] = tasciiNonShift[i]; asciiShift[i] = tasciiShift[i]; asciiAltGR[i] = tasciiAltGR[i]; } } else // QWERTZ -- Germany { unsigned char tasciiNonShift[100] = { 0, ESC, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 225,0, BACKSPACE, TAB, 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', 0, '+', ENTER, 0,//29 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0,0, '#', 0, '#', 'y', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '-', '<', 0, 0, ' ', 0, KF1, KF2, KF3, KF4, KF5, KF6, KF7, KF8, KF9, KF10, 0, 0, KHOME, KUP, KPGUP,'-', KLEFT, '5', KRIGHT, '+', KEND, KDOWN, KPGDN, KINS, KDEL, 0, 0, 0, KF11, KF12 }; tasciiNonShift[86] = '<'; tasciiNonShift[26] = (char) 129; tasciiNonShift[39] = (char) 148; tasciiNonShift[40] = (char) 132; tasciiNonShift[41] = (char) 95; unsigned char tasciiShift[100] = { 0, ESC, '!', '\"', 0, '$', '%', '&', '/', '(', ')', '=', '?', '`', BACKSPACE, TAB, 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 0, '*', ENTER, 0, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0,0, '\'', 0, '\'', 'Y', 'X', 'C', 'V', 'B', 'N', 'M', ';', ':', '_', '>', 0, 0, ' ', 0, KF1, KF2, KF3, KF4, KF5, KF6, KF7, KF8, KF9, KF10, 0, 0, KHOME, KUP, KPGUP, '-', KLEFT, '5', KRIGHT, '+', KEND, KDOWN, KPGDN, KINS, KDEL, 0, 0, 0, KF11, KF12 }; tasciiShift[86] = '>'; tasciiShift[26] = (char) 154; tasciiShift[39] = (char) 153; tasciiShift[40] = (char) 142; tasciiShift[41] = (char) 248; unsigned char tasciiAltGR[100] = { 0, 170, 173,253,0, 0,0,0, '{', '[', ']', '}', '\\', 0, 0, 0, '@', 0, 0, 0, 0,0,0, 0,237,0, 0, '~', 0, 0, 145, 0, 0, 0,0,0, 0, 0,0,0, '^', '`', 0, 0, 0,0,0,0,0,0, 0,0,0, 0, '|', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; tasciiAltGR[86] = '|'; int i; for(i = 0; i < 100; i++) { asciiNonShift[i] = tasciiNonShift[i]; asciiShift[i] = tasciiShift[i]; asciiAltGR[i] = tasciiAltGR[i]; } } pc("[06.000165] +ret"); }
// Utilizamos esta función sólo para pintar en pantalla. La lógica del programa debe ir en logic void paint( const World& world ) { // La pantalla tiene unas dimensiones de 500x500 changeColor(WHITE); plot(0, 0); // Punto inferior izquierdo plot(500, 500); // Punto superior derecho plot(499, 0); // Punto inferior derecho plot(0, 499); // Punto superior izquierdo /*changeColor(RED); drawQuad(100, 100, 25, 50); changeColor(GREEN); drawCircle(200, 200, 25);*/ // Cualquier número que se salga de este margen no se mostrará por pantalla //dibujar las estrellas changeColor(WHITE); paintStars(world.stars); //dibujar el cuadrado de informacion changeColor(world.infoBox.color); paintRectangle(world.infoBox); //dibujar el area del juego changeColor(world.gameBox.color); paintRectangle(world.gameBox); printText(10, 475, "TIME:", world.colorTime); printText(70, 475, world.time, world.colorTime); //string chivato = int2string(world.ship.position.x); string levelPlayer = int2string(world.numberLevel+1); string livesPlayer = int2string(world.lives); string scorePlayer = int2string(world.score); printText(170, 475, "LEVEL: ", world.colorTime); printText(240, 475, levelPlayer, world.colorTime); printText(270, 475, "Lives: ", world.colorTime); printText(325, 475, livesPlayer, world.colorTime); printText(370, 475, "Score: ", world.colorTime); printText(430, 475, scorePlayer, world.colorTime); //Pinto los bloques for(int i = 0; i < world.blocks.size(); i++) { if(world.blocks[i].numberOfImpacts > 0) { changeColor(world.blocks[i].form.color); paintShip(world.blocks[i].form); } } //pintar nave paintShip(world.ship); //paintShip(world.prueba); //plot(215 + world.ship.width, 40); //plot(0, 499); //pintar pelota paintBall(world.ball); //dump /*string coordenadaX = int2string(world.ship.position.x); string limitX = int2string(world.ship.position.x + world.ship.width); printText(150, 475, coordenadaX, world.colorTime); printText(200, 475, limitX, world.colorTime);*/ plot(world.includesBall.position.x, world.includesBall.position.y); /*if(checkCollision2(world.includesBall, world.ship)) { printText(300, 475, "colision!", world.colorTime); }*/ if(world.states.gameStates == GAMEOVER) { printText(200, 250, "GAME OVER", world.colorTime); printText(155, 200, "Press space to continue", world.colorTime); }else if(world.states.gameStates == WIN) { printText(200, 250, "YOU WIN", world.colorTime); printText(110, 200, "Press space to continue next level", world.colorTime); } }
connect(icon, SIGNAL(selected(GraphicsIcon*)), this, SLOT(selectIcon(GraphicsIcon*))); } // Append number icon NumberIcon* thickness = new NumberIcon(this); d->layout->addItem(thickness); connect(thickness, SIGNAL(numberShifted(int)), this, SLOT(changeThickness(int))); connect(this, SIGNAL(thicknessChanged(int)), thickness, SLOT(setNumber(int))); // Append colors icon d->colors = new ColorsIcon(this); d->layout->addItem(d->colors); connect(d->colors, SIGNAL(colorPicked(QPalette::ColorRole,QColor)), this, SLOT(changeColor(QPalette::ColorRole,QColor))); connect(this, SIGNAL(colorChanged(QPalette::ColorRole,QColor)), d->colors, SLOT(setColor(QPalette::ColorRole,QColor))); // Connect thickness to color connect(this, SIGNAL(colorChanged(QPalette::ColorRole,QColor)), thickness, SLOT(setColor(QPalette::ColorRole,QColor))); } Overlay::~Overlay() { delete d; } Canvas::Tool Overlay::tool() {
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); this->resize(800,680); this->setWindowState(Qt::WindowMaximized); ImageItem *image = new ImageItem(); //create ColorSelection ColorSelection *CS1 = new ColorSelection(Qt::black); ColorSelection *CS2 = new ColorSelection(Qt::white); QObject::connect(CS1,SIGNAL(changeColor(QColor)),image,SLOT(setColor1(QColor))); QObject::connect(image->getPipette(),SIGNAL(changeColor1(QColor)),CS1,SLOT(setColor(QColor))); QObject::connect(CS2,SIGNAL(changeColor(QColor)),image,SLOT(setColor2(QColor))); QObject::connect(image->getPipette(),SIGNAL(changeColor2(QColor)),CS2,SLOT(setColor(QColor))); QHBoxLayout *Hlayout = new QHBoxLayout(); Hlayout->addStretch(5); Hlayout->addWidget(CS1); Hlayout->addWidget(CS2); Hlayout->addStretch(5); //Create slider QSlider *slider = new QSlider(Qt::Horizontal); slider->setMaximum(100); slider->setMinimum(1); slider->setValue(10); QObject::connect(slider,SIGNAL(valueChanged(int)),image,SLOT(setSize(int))); QVBoxLayout *Blayout = new QVBoxLayout(); Blayout->addWidget(slider); Blayout->addLayout(Hlayout); QWidget *wdg = new QWidget(); wdg->setLayout(Blayout); // Create Dock // // QDockWidget *dock = new QDockWidget(tr("Настройка"),this); dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); dock->setFeatures(QDockWidget::NoDockWidgetFeatures); wdg->setFixedSize(200,100); dock->setWidget(wdg); dock->setMaximumHeight(300); dock->setMaximumWidth(300); addDockWidget(Qt::RightDockWidgetArea,dock); QActionGroup *GP = new QActionGroup(this); GP->addAction(ui->actionPencil); GP->addAction(ui->actionEraser); GP->addAction(ui->actionEllipse); GP->addAction(ui->actionRectangle); GP->addAction(ui->actionLine); GP->addAction(ui->actionCurveLine); GP->addAction(ui->actionFill); GP->addAction(ui->actionPipette); GP->addAction(ui->actionSelection); GP->setExclusive(true); //create tool bar QToolBar *TB = new QToolBar(); TB->setAllowedAreas(Qt::TopToolBarArea | Qt::LeftToolBarArea); TB->setFloatable(false); TB->setMovable(true); TB->insertAction(0,ui->actionSaveAs); TB->insertAction(ui->actionSaveAs,ui->actionSave); TB->insertAction(ui->actionSave,ui->actionOpen); TB->insertAction(ui->actionOpen,ui->actionCreate); TB->addSeparator(); TB->insertAction(0,ui->actionSelection); TB->insertAction(ui->actionSelection,ui->actionPipette); TB->insertAction(ui->actionPipette,ui->actionFill); TB->insertAction(ui->actionFill,ui->actionCurveLine); TB->insertAction(ui->actionCurveLine,ui->actionLine); TB->insertAction(ui->actionLine,ui->actionRectangle); TB->insertAction(ui->actionRectangle,ui->actionEllipse); TB->insertAction(ui->actionEllipse,ui->actionEraser); TB->insertAction(ui->actionEraser,ui->actionPencil); addToolBar(Qt::TopToolBarArea, TB); // create action connecting QObject::connect(ui->actionOpen,SIGNAL(triggered(bool)),image,SLOT(open())); QObject::connect(ui->actionSaveAs,SIGNAL(triggered(bool)),image,SLOT(saveAs())); QObject::connect(ui->actionSave,SIGNAL(triggered(bool)),image,SLOT(save())); QObject::connect(ui->actionPencil,SIGNAL(toggled(bool)),image,SLOT(setPencil(bool))); QObject::connect(ui->actionEraser,SIGNAL(toggled(bool)),image,SLOT(setEraser(bool))); QObject::connect(ui->actionEllipse,SIGNAL(toggled(bool)),image,SLOT(setEllipse(bool))); QObject::connect(ui->actionRectangle,SIGNAL(toggled(bool)),image,SLOT(setRectangle(bool))); QObject::connect(ui->actionLine,SIGNAL(toggled(bool)),image,SLOT(setLine(bool))); QObject::connect(ui->actionCurveLine,SIGNAL(toggled(bool)),image,SLOT(setCurveLine(bool))); QObject::connect(ui->actionFill,SIGNAL(toggled(bool)),image,SLOT(setFill(bool))); QObject::connect(ui->actionPipette,SIGNAL(toggled(bool)),image,SLOT(setPipette(bool))); QObject::connect(ui->actionSelection,SIGNAL(toggled(bool)),image,SLOT(setSelection(bool))); //undo and redo ui->actionUndo->setEnabled(false); ui->actionRedo->setEnabled(false); QObject::connect(image->getUndoStack(),SIGNAL(canUndo(bool)),ui->actionUndo,SLOT(setEnabled(bool))); QObject::connect(ui->actionUndo,SIGNAL(triggered(bool)),image->getUndoStack(),SLOT(undo())); QObject::connect(image->getUndoStack(),SIGNAL(canRedo(bool)),ui->actionRedo,SLOT(setEnabled(bool))); QObject::connect(image->getUndoStack(),SIGNAL(canRedo(bool)),image,SLOT(setNewCurve(bool))); QObject::connect(ui->actionRedo,SIGNAL(triggered(bool)),image->getUndoStack(),SLOT(redo())); //copy and cut and put ui->actionCopy->setEnabled(false); ui->actionCut->setEnabled(false); ui->actionPut->setEnabled(false); QObject::connect(image->getSelection(),SIGNAL(canCopy(bool)),ui->actionCopy,SLOT(setEnabled(bool))); QObject::connect(ui->actionCopy,SIGNAL(triggered(bool)),image,SLOT(makeCopy())); QObject::connect(image->getSelection(),SIGNAL(canCopy(bool)),ui->actionCut,SLOT(setEnabled(bool))); QObject::connect(ui->actionCut,SIGNAL(triggered(bool)),image,SLOT(makeCut())); QObject::connect(image->getSelection(),SIGNAL(canPut(bool)),ui->actionPut,SLOT(setEnabled(bool))); QObject::connect(ui->actionPut,SIGNAL(triggered(bool)),image,SLOT(makePut())); QObject::connect(ui->actionSelection,SIGNAL(changed()),image,SLOT(clearSelection())); ui->scrollArea->setBackgroundRole(QPalette :: Dark); ui->scrollArea->setWidget(image); }
//---------------------------------------------------------- void ofxVectorGraphics::setColor(int _r, int _g, int _b){ float r = (float)_r / 255.0f; r = MAX(0,MIN(r,1.0f)); float g = (float)_g / 255.0f; g = MAX(0,MIN(g,1.0f)); float b = (float)_b / 255.0f; b = MAX(0,MIN(b,1.0f)); changeColor(r, g, b); }
void startAnimation () { //***debug**mode****on/off**** int DEBUGGING=FALSE; //**************************** int blink=0; changeColor(ARROW); system ("CLS"); changeColor(ARROW); positionCursor(50,20); printf ("RESIZE WINDOW TO FULL SCREEN \n" " \n" " -/++/-` \n" " `syyhhhhho. \n" " `/yyyyhhhhhho- \n" " :hsoyyyyhhhhhhs: \n" " :ddmsoyyhhhhhhhhy/` \n" " :hmmmyoshhhhhhhhhh/` \n" " :ymmmhoshhhhhhhhdh+. \n" " -smmmhoohhhhhhddddo. \n" " .odmmdoohhhhhhhddds- \n" " `+ddddsoyhhhhhhddhy: \n" " `/hdddsoyhhyhhddddh/` ` \n" " :yddhsoyhhhhdddddh+` `:sd- \n" " -sdhhyoshhhhddddddo/sdmmmy \n" " -shhhyoshdddddddddddmmmm: \n" " `.+hhhyoohdddddddddmmmmh` \n" " `/sooydddddddddmmmmmm+ \n" " ``/ydddddddddddddmmmmmd` \n" " yysosssshddddddddddmmmms \n" " -hhhhhhhysosssshdddddmmmm- \n" " `-:+oyhhhhhhhhsosssshdmmy \n" " `.:/oshhhhhhhhyssss- \n" " .-/+syhhhhhhy` \n" " `-:+oy+ "); if (!DEBUGGING) Sleep(3200); changeColor(ETF); system ("CLS"); changeColor(ETF); positionCursor(0,9); printf (" ``.-:://+oosssyyyyyyyysso++/:.` \n" " +dmNNNNMMMMMMMNNNmdddhhhyyyyyyyyhhhhyo:. \n" " .NMMMMyo+/:-..`````` ````.-//` \n" " +MMMMh .--://++oosssyyyyyys. -so. \n" " dMMMM+ :NNMMMMMMMMMMMMMMNNNd- :do` \n" " -MMMMN. odhhyso++oMMMN/-.```` `.. \n" " yMMMMh `` `:ohMMMMNNmmho:. \n" " .NMMMM/ `omNMMdmMMMMyoyhmNh+. `os- \n" " oMMMMm` /mMMmo-`-NMMMm. ``-odms- -mN/ \n" " `mMMMMo +NMMs. +MMMMh` `/dNs` -mN/ \n" " +MMMMN. -NMMo yMMMMo `+Nd- :NN/ \n" " `mMMMMy yMMm` .mMMMN-``.--:/hMNssyNMN: \n" " +MMMMN- mMMy `.--yMMMMNdmmNNMMMMMMMMMMMm. \n" " `mMMMMh mMMd/oshdmmNNMMMMMMMMMMMMMMMMMNhyomMh` \n" " +MMMMM/:/oshNMMMMMMMMMMMMMMMMMMMNmdhyo+:+MN. :NM+ \n" " `mMMMMMMMMMMMMMMMMMMMMNmmdydMMMMd.` -MM- yMN. \n" " +MMMMMMMMMNNNMMMmso/:-.`` .NMMMM: +MM. .NMs \n" " `NMMMMNs+:-..dMMm: sMMMMh .mMd oho \n" " oMMMMM- .hMMNo. .NMMMM- -dMN- \n" " .NMMMMy `omMMmo-` yMMMMy .omMm/ \n" " sMMMMM. .smMMNhs/-.`:MMMMMhNMNy- `-+. \n" " .NMMMMs .+hNMMMNNmdMMMMMMms: .NM+ \n" " yMMMMN. .:oyhdmmmMMMMh...:+sh+ mMy \n" " -MMMMMo ``.dMMMNdmNMMMMh hMd \n" " hMMMMm` ``.-/oyhmMMMMMMMMMNmds yMd \n" " /MMMMM/ smNMMMMMMMMMNmdyo/-` ``:hMd \n" " `mMMMMh +MMMMNNmdy+/-` `./shmMMNy \n" " oMMMMN. .dyo/:.` ``-/shmMMMMNds:` \n" " .NMMMMo ``.:oydNMMMMMNds/. \n" " yMMMMm ``-/oydmMMMMMMNmho:. \n" " :MMMMM- ``.:+shdNMMMMMMNNmyo/. \n" " `mMMMMy/+shmNMMMMMMMNNmhs/:. \n" " oMMMMMMMMMMMMNNdyo/-` \n" " .MMMMMMNdhs+:.` \n" " sso/-. \n"); if (!DEBUGGING) Sleep(2000); changeColor(GROUND); system ("CLS"); changeColor(GROUND); positionCursor(0,20); printf (" ______ _ ______ _ \n" " / _____|_)_ / _____) (_)_ \n" " | / ___ _| |_ | / ___ ____ ____ _| |_ \n" " | | (___) | _) | | / _ \\| \\| \\| | _) \n" " | \\____/| | |__ | \\____| |_| | | | | | | | | |__ \n" " \\_____/|_|\\___) \\______)___/|_|_|_|_|_|_|_|\\___)\n" " \n" " _______ _______ ______ \n" " (_______|_______) /\\ | ___ \\ \n" " _ _____ / \\ | | _ | | \n" " | | | ___) / /\\ \\| || || | \n" " | |_____| |_____| |__| | || || | \n" " \\______)_______)______|_||_||_| \n"); positionCursor(62,34); printf ("---PRESENTS YOU---"); if (!DEBUGGING) Sleep(2000); system ("CLS"); backgroundImage(WELCOME); if (!DEBUGGING) while (1) { switch (blink) { case 0:{positionCursor (62,40);printf (" -- Press any key -- ");Sleep(500);blink=1;break;} case 1:{positionCursor (62,40);printf (" ");Sleep(500);blink=0;break;} } if(_kbhit()) { positionCursor (62,40); printf (" "); break; } } backgroundImage(MENU); }
void OpenSGLatticeGeometry::updateGeometry(const bool all) { showAll = all; calcNumOfPoints(all); // set number of points for each OPEN_GL type for lattice beginEditCP(numOfPointsPerType, GeoPLengthsUI32::GeoPropDataFieldMask); numOfPointsPerType->setValue(numOfLatticePoints, 0); numOfPointsPerType->setValue(numOfLatticeLinePoints, 1); endEditCP(numOfPointsPerType, GeoPLengthsUI32::GeoPropDataFieldMask); cellDivisions = lattice.getCellDivisions(); const Lattice::Vector3d& cellPoints = lattice.getCellPoints(); // create all used vertices for the lattice (gl_points) beginEditCP(latticePoints, GeoPositions3f::GeoPropDataFieldMask); latticePoints->clear(); // vertices for gl_points for (int h = 0; h <= cellDivisions[0]; h+=step) for (int w = 0; w <= cellDivisions[1]; w+=step) for (int l = 0; l <= cellDivisions[2]; l+=step) latticePoints->addValue(Pnt3f(cellPoints[h][w][l][0], cellPoints[h][w][l][1], cellPoints[h][w][l][2])); // vertices for gl_lines for (int h = 0; h < cellDivisions[0]; h+=step) for (int w = 0; w <= cellDivisions[1]; w+=step) for (int l = 0; l <= cellDivisions[2]; l+=step) { latticePoints->addValue(Pnt3f(cellPoints[h][w][l][0], cellPoints[h][w][l][1], cellPoints[h][w][l][2])); latticePoints->addValue(Pnt3f(cellPoints[h + step][w][l][0], cellPoints[h + step][w][l][1], cellPoints[h + step][w][l][2]) ); } for (int h = 0; h <= cellDivisions[0]; h+=step) for (int w = 0; w < cellDivisions[1]; w+=step) for (int l = 0; l <= cellDivisions[2]; l+=step) { latticePoints->addValue(Pnt3f(cellPoints[h][w][l][0], cellPoints[h][w][l][1], cellPoints[h][w][l][2])); latticePoints->addValue(Pnt3f(cellPoints[h][w + step][l][0], cellPoints[h][w + step][l][1], cellPoints[h][w + step][l][2]) ); } for (int h = 0; h <= cellDivisions[0]; h+=step) for (int w = 0; w <= cellDivisions[1]; w+=step) for (int l = 0; l < cellDivisions[2]; l+=step) { latticePoints->addValue(Pnt3f(cellPoints[h][w][l][0], cellPoints[h][w][l][1], cellPoints[h][w][l][2])); latticePoints->addValue(Pnt3f(cellPoints[h][w][l + step][0], cellPoints[h][w][l + step][1], cellPoints[h][w][l + step][2]) ); } endEditCP(latticePoints, GeoPositions3f::GeoPropDataFieldMask); // create all indices for lattice <-> vertex assignment beginEditCP(latticeIndices, GeoIndicesUI32::GeoPropDataFieldMask); latticeIndices->clear(); for (size_t i = 0; i < numOfLatticePoints; ++i) latticeIndices->addValue(i); for (size_t i = 0; i < numOfLatticeLinePoints; ++i) latticeIndices->addValue(numOfLatticePoints + i); endEditCP(latticeIndices, GeoIndicesUI32::GeoPropDataFieldMask); // assign vertices, colors, indices to geometry #if OSG_MAJOR_VERSION >= 2 beginEditCP(latticeGeo); #else beginEditCP(latticeGeo, Geometry::TypesFieldMask | Geometry::LengthsFieldMask | Geometry::PositionsFieldMask | Geometry::IndicesFieldMask | Geometry::ColorsFieldMask); #endif latticeGeo->setTypes(latticeTypes); latticeGeo->setLengths(numOfPointsPerType); latticeGeo->setIndices(latticeIndices); latticeGeo->setPositions(latticePoints); latticeGeo->setColors(latticeColors); calcVertexNormals(latticeGeo); #if OSG_MAJOR_VERSION >= 2 endEditCP(latticeGeo); #else endEditCP(latticeGeo, Geometry::TypesFieldMask | Geometry::LengthsFieldMask | Geometry::PositionsFieldMask | Geometry::IndicesFieldMask | Geometry::ColorsFieldMask); #endif changeColor(); }
void NWcolorGradientWidget::mouseDoubleClickEvent( QMouseEvent* event ) { changeColor(); }
//------------------------------------------------------------------------- SetupDialog::SetupDialog(MainWindow *parent) : QDialog(parent), mMainWindow(parent) { setupUi(this); QObject::connect (fDefaultButton, SIGNAL(clicked()), this, SLOT(reset())); QObject::connect (fSysDistBox, SIGNAL(valueChanged(int)), this, SLOT(setup())); QObject::connect (fMaxDistBox, SIGNAL(valueChanged(int)), this, SLOT(setup())); QObject::connect (fSpringBox, SIGNAL(valueChanged(int)), this, SLOT(setup())); QObject::connect (fForceBox, SIGNAL(valueChanged(int)), this, SLOT(setup())); QObject::connect (fSysDistrMenu, SIGNAL(currentIndexChanged(int)), this, SLOT(setup())); QObject::connect (fOPFcheckBox, SIGNAL(clicked()), this, SLOT(setup())); QObject::connect (fNSpacingcheckBox, SIGNAL(clicked()), this, SLOT(setup())); QObject::connect (fResizePage2Music, SIGNAL(clicked()), this, SLOT(setup())); QObject::connect (fColorButton, SIGNAL(clicked()) , this, SLOT(changeColor())); QObject::connect (fMapping, SIGNAL(clicked()), this, SLOT(setup())); QObject::connect (fRawMapping, SIGNAL(clicked()), this, SLOT(setup())); QObject::connect (fBoundingBoxes, SIGNAL(clicked()), this, SLOT(setup())); QObject::connect (fPageBB, SIGNAL(clicked()), this, SLOT(setup())); QObject::connect (fSystemBB, SIGNAL(clicked()), this, SLOT(setup())); QObject::connect (fSystemSliceBB, SIGNAL(clicked()), this, SLOT(setup())); QObject::connect (fStaffBB, SIGNAL(clicked()), this, SLOT(setup())); QObject::connect (fMeasureBB, SIGNAL(clicked()), this, SLOT(setup())); QObject::connect (fEventBB, SIGNAL(clicked()), this, SLOT(setup())); QObject::connect (fVoiceNumEdit, SIGNAL(valueChanged(int)), this, SLOT(voiceStaffSetup(int))); QObject::connect (fStaffNumEdit, SIGNAL(valueChanged(int)), this, SLOT(voiceStaffSetup(int))); QObject::connect (fShowAllStaffsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(voiceStaffSetup(int))); QObject::connect (fShowAllVoicesCheckBox, SIGNAL(stateChanged(int)), this, SLOT(voiceStaffSetup(int))); mSavedSettings = mMainWindow->getEngineSettings(); mSavedBBMap = mMainWindow->getBBMap(); mSavedShowMapping = mMainWindow->getShowMapping(); mSavedRawMapping = mMainWindow->getRawMapping(); mSavedShowBoxes = mMainWindow->getShowBoxes(); mSavedVoiceNum = mMainWindow->getVoiceNum(); mSavedStaffNum = mMainWindow->getStaffNum(); scoreColorChanged( mMainWindow->getScoreColor() ); set (mSavedSettings, mSavedBBMap, mSavedShowMapping, mSavedRawMapping, mSavedShowBoxes, mSavedVoiceNum, mSavedStaffNum); mFontColorMap[ GuidoHighlighter::VOICE_SEPARATOR_ELT ] = fVoiceSeparatorColorButton; mFontColorMap[ GuidoHighlighter::SCORE_SEPARATOR_ELT ] = fScoreSeparatorColorButton; mFontColorMap[ GuidoHighlighter::DURATION_ELT ] = fDurationsColorButton; mFontColorMap[ GuidoHighlighter::NOTE_ELT ] = fNotesColorButton; mFontColorMap[ GuidoHighlighter::TAG_PARAM_ELT ] = fTagsParametersColorButton; mFontColorMap[ GuidoHighlighter::TAG_ELT ] = fTagsColorButton; mFontColorMap[ GuidoHighlighter::COMMENT_ELT ] = fCommentsColorButton; mFontWeightMap[ GuidoHighlighter::VOICE_SEPARATOR_ELT ] = fVoiceSeparatorWeight; mFontWeightMap[ GuidoHighlighter::SCORE_SEPARATOR_ELT ] = fScoreSeparatorWeight; mFontWeightMap[ GuidoHighlighter::DURATION_ELT ] = fDurationsWeight; mFontWeightMap[ GuidoHighlighter::NOTE_ELT ] = fNotesWeight; mFontWeightMap[ GuidoHighlighter::TAG_PARAM_ELT ] = fTagsParametersWeight; mFontWeightMap[ GuidoHighlighter::TAG_ELT ] = fTagsWeight; mFontWeightMap[ GuidoHighlighter::COMMENT_ELT ] = fCommentsWeight; fTabWidget->setCurrentIndex(0); for ( int i = 0 ; i < GuidoHighlighter::SIZE ; i++ ) { // Set widgets properties with syntax-element id mFontColorMap[ i ]->setProperty( SYNTAX_ELT_ID , i ); mFontWeightMap[ i ]->setProperty( SYNTAX_ELT_ID , i ); // Set the color of the font-color button QColor c = mMainWindow->getHighlighter()->color( i ); QPixmap pixmap(30 , 30); pixmap.fill( c ); mFontColorMap[ i ]->setIcon( QIcon(pixmap) ); mFontColorMap[ i ]->setProperty( BUTTON_COLOR , c ); // Adds font-weight items in the combobox for ( int w = 0 ; w <= QFont::Black ; w++ ) { QString weightString = weightToString( w ); if ( weightString.size() ) mFontWeightMap[i]->addItem( weightString , w ); } // Set the current combobox item QFont::Weight weight = (QFont::Weight)mMainWindow->getHighlighter()->weight( i ); mFontWeightMap[i]->setCurrentIndex( mFontWeightMap[i]->findData( weight ) ); // Connect the font widgets to their methods connect( mFontColorMap[i] , SIGNAL(clicked()) , this , SLOT(fontColorButtonClicked()) ); connect( mFontWeightMap[i] , SIGNAL(currentIndexChanged(int)) , this , SLOT(fontWeightChanged(int)) ); mSavedColors[i] = c; mSavedWeights[i]= int(weight); } if (!mColorDialog) { mColorDialog = new QColorDialog( this ); mColorDialog->setWindowTitle("Choose score color"); mColorDialog->setOption (QColorDialog::NoButtons); } QSettings settings; QPoint pos = settings.value(SETUP_DIALOG_POS_SETTING, QPoint(300, 300)).toPoint(); QSize winSize = settings.value(SETUP_DIALOG_SIZE_SETTING, sizeHint() ).toSize(); resize(winSize); move(pos); }
void ComDraw::drawSolidRect(CCPoint origin, CCPoint destination, string color, double fog) { ccDrawSolidRect(origin, destination, changeColor(color, fog)); }
void ColoringRulesDialog::on_bGPushButton_clicked() { changeColor(false); }
MainWindow::MainWindow(QWidget *parent) : QWidget(parent) { QHBoxLayout* layoutH=new QHBoxLayout; QVBoxLayout* layoutV=new QVBoxLayout; MyField* field = new MyField; field->setMinimumSize(500,500); layoutH->addWidget(field); layoutH->addLayout(layoutV); dl = new QColorDialog(); QLabel* lbl1=new QLabel("Set universe size"); lbl1->setFixedHeight(10); layoutV->addWidget(lbl1); spinBox1 = new QSpinBox; spinBox1->setFixedSize(90,30); spinBox1->setValue(50); spinBox1->setMaximum(50); spinBox1->setMinimum(5); layoutV->addWidget(spinBox1); QObject::connect(spinBox1,SIGNAL(valueChanged(int)),field,SLOT(changeUniverseSize(int))); QLabel* lbl2=new QLabel("Set interval size"); lbl2->setFixedHeight(10); layoutV->addWidget(lbl2); spinBox2 = new QSpinBox; spinBox2->setFixedSize(90,30); spinBox2->setValue(50); spinBox2->setMaximum(1000); spinBox2->setMinimum(10); layoutV->addWidget(spinBox2); QObject::connect(spinBox2,SIGNAL(valueChanged(int)),field,SLOT(changeInterval(int))); btnStart = new QPushButton("Start"); btnStart->setFixedSize(90,30); QObject::connect(btnStart,SIGNAL(clicked()),field,SLOT(startGame())); layoutV->addWidget(btnStart); btnStop = new QPushButton("Stop"); btnStop->setFixedSize(90,30); QObject::connect(btnStop,SIGNAL(clicked()),field,SLOT(stopGame())); layoutV->addWidget(btnStop); btnClear = new QPushButton("Clear"); btnClear->setFixedSize(90,30); QObject::connect(btnClear,SIGNAL(clicked()),field,SLOT(clearUniverse())); layoutV->addWidget(btnClear); setColor = new QPushButton("Set color"); setColor->setFixedSize(90,30); QObject::connect( setColor,SIGNAL(clicked()),this,SLOT(setCellColor())); QObject::connect(dl,SIGNAL(colorSelected(QColor)),field,SLOT(changeColor(QColor))); layoutV->addWidget( setColor); btnNewRules=new QPushButton("New Rules"); btnNewRules->setFixedSize(90,30); QObject::connect(btnNewRules,SIGNAL(clicked()),field,SLOT(newRules())); layoutV->addWidget(btnNewRules); ResetRules=new QPushButton("Reset Rules"); ResetRules->setFixedSize(90,30); QObject::connect(ResetRules,SIGNAL(clicked()),field,SLOT(resetRules())); layoutV->addWidget(ResetRules); this->setLayout(layoutH); }
void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*rect*/ ) { if (!m_feedbackNode.isValid()) return; if (m_feedbackOriginPoint.isNull()) return; painter->save(); painter->resetTransform(); painter->translate(m_feedbackOriginPoint); QColor defaultColor(Qt::white); QColor changeColor("#9999ff"); QFont font; font.setFamily("Helvetica"); font.setPixelSize(12); painter->setFont(font); if (m_bubblePixmap.isNull()) m_bubblePixmap = createBubblePixmap(); painter->drawPixmap(-13, -7, m_bubblePixmap); if (m_beginXHasExpression) { if(m_feedbackNode.hasBindingProperty("x")) painter->setPen(defaultColor); else painter->setPen(Qt::red); } else { if (m_beginX != m_feedbackNode.instanceValue("x")) painter->setPen(changeColor); else painter->setPen(defaultColor); } painter->drawText(QPoint(8.0, 13.0), QString("x:")); painter->drawText(QPoint(22.0, 13.0), m_feedbackNode.instanceValue("x").toString()); if (m_beginYHasExpression) { if(m_feedbackNode.hasBindingProperty("y")) painter->setPen(defaultColor); else painter->setPen(Qt::red); } else { if (m_beginY != m_feedbackNode.instanceValue("y")) painter->setPen(changeColor); else painter->setPen(defaultColor); } painter->drawText(QPoint(60.0, 13.0), QString("y:")); painter->drawText(QPoint(72.0, 13.0), m_feedbackNode.instanceValue("y").toString()); if (m_beginWidthHasExpression) { if(m_feedbackNode.hasBindingProperty("width")) painter->setPen(defaultColor); else painter->setPen(Qt::red); } else { if (m_beginWidth != m_feedbackNode.instanceValue("width")) painter->setPen(changeColor); else painter->setPen(defaultColor); } painter->drawText(QPoint(8.0, 29.0), QString("w:")); painter->drawText(QPoint(22.0, 29.0), m_feedbackNode.instanceValue("width").toString()); if (m_beginHeightHasExpression) { if(m_feedbackNode.hasBindingProperty("height")) painter->setPen(defaultColor); else painter->setPen(Qt::red); } else { if (m_beginHeight != m_feedbackNode.instanceValue("height")) painter->setPen(changeColor); else painter->setPen(defaultColor); } painter->drawText(QPoint(60.0, 29.0), QString("h:")); painter->drawText(QPoint(72.0, 29.0), m_feedbackNode.instanceValue("height").toString()); if (m_parentNode != m_feedbackNode.instanceParent()) { painter->setPen(changeColor); painter->drawText(QPoint(2.0, 39.0), QString("Parent changed")); } painter->restore(); }
void initScreen() { setFix(0); changeColor(0x0, 0xF); clearscreen(); }