Esempio n. 1
0
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y){
    
    //draggable vertices
    
    for (int i = 0; i < curveVertices.size(); i++){
        float diffx = x - curveVertices[i].x;
        float diffy = y - curveVertices[i].y;
        float dist = sqrt(diffx*diffx + diffy*diffy);
        if (dist < curveVertices[i].radius){
            curveVertices[i].bOver = true;
        } else {
            curveVertices[i].bOver = false;
            
            saveXml(); //saving Xml file

        }
        
    }

    if (colorPickerRect.inside(mouseX, mouseX)) {
    
        img.reloadTexture();
    
    }




}
Esempio n. 2
0
bool VondelBook::save()
{
    QDir path(bookPath);

    if (!path.exists()) {
        path.mkpath(bookPath);
    }

    saveXml(bookPath);

    // Save the modified scenes.
    QString scenesPath(bookPath + "/scenes");
    QDir scenes(scenesPath);
    if (!scenes.exists()) {
        scenes.mkpath(scenesPath);
    }

    QHashIterator<int, VondelScene *> i(vondelScenes);
    i.toFront();
    while (i.hasNext()) {
        i.next();
        i.value()->save(scenesPath);
    }
    return true;
}
Esempio n. 3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{    
    ui->setupUi(this);

    // Table of markers
    ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
    ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
    connect(ui->buttonMarkerAdd,SIGNAL(clicked()),ui->plot,SLOT(addMarker()));
    connect(ui->plot,SIGNAL(MarkerListUpdate(int)),this,SLOT(tableWidget_update(int)));

    // connecting markers actions
    connect(ui->actionMark_save, SIGNAL(triggered()), ui->plot, SLOT(saveXml()));

    // Horizontal ScrollBar config
    ui->horizontalScrollBar->setMinimum(0);
    ui->horizontalScrollBar->setMaximum(0);
    connect(ui->horizontalScrollBar,SIGNAL(valueChanged(int)),ui->plot,SLOT(setImgOffset(int)));
    connect(ui->plot,SIGNAL(ImgOffset(int)),ui->horizontalScrollBar,SLOT(setValue(int)));
    connect(ui->plot,SIGNAL(MaximumOffset(int)),this,SLOT(setScrollBarMaximumValue(int)));

    //splitter default size
    QList<int> size;
    size.append(10);
    size.append(800);
    ui->splitter_2->setSizes(size);
    ui->zoomSpinBox->setValue(ui->plot->settings->plotZoomX() * 100);
}
Esempio n. 4
0
ofxBoxObj & ofxBoxObj::init(int _x, int _y){
	box = new ofxBox();
	box->setPhysics(den, bou, fri);
	box->load(file).setScale(scale).setDebug(bDebug).loadToWorld(gameEng, ofPoint(_x,_y));
	width = box->getWidth()*2;
	height = box->getHeight()*2;
	saveXml();
	return * this;
}
Esempio n. 5
0
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){

    //draggable vertices

    for (int i = 0; i < curveVertices.size(); i++){
        curveVertices[i].bBeingDragged = false;
        saveXml(); //saving Xml file

    }

    
}
 void sm::BoostPropertyTree::save(const boost::filesystem::path& fileName) const {
   switch(getFileFormatAndThrowIfUnknown(fileName)){
     case XML:
       saveXml(fileName);
       break;
     case INI:
       saveIni(fileName);
       break;
     case JSON:
       saveJson(fileName);
       break;
     case INFO:
       saveInfo(fileName);
       break;
   }
 }
Esempio n. 7
0
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
    
    //draggable vertices

    
    for (int i = 0; i < curveVertices.size(); i++){
        if (curveVertices[i].bBeingDragged == true){
            curveVertices[i].x = x;
            curveVertices[i].y = y;
            saveXml(); //saving Xml file

        }
    }


}
Esempio n. 8
0
void MainWindow::actionSaveAndSaveAs(bool askFileName,
                                     const QString &directory) {
    // Save XML file
    QString xmlFileName;

    if (this->xmlFileName.isEmpty() || askFileName == true) {
        // Open file dialog
        QFileDialog fileDialog(this, tr("Save"));
        fileDialog.setFileMode(QFileDialog::AnyFile);
        fileDialog.setNameFilter(QString("Blockly Files %1").arg("(*.bly)"));
        fileDialog.setDefaultSuffix("bly");
        fileDialog.setLabelText(QFileDialog::Accept, tr("Save"));
        if (!directory.isEmpty()) fileDialog.setDirectory(directory);
        if (!fileDialog.exec()) return; // Return if cancelled
        QStringList selectedFiles = fileDialog.selectedFiles();
        // Return if no file to open
        if (selectedFiles.count() < 1) return;
        xmlFileName = selectedFiles.at(0);
    } else {
        xmlFileName = this->xmlFileName;
    }

    int result = saveXml(xmlFileName);

    if (result == 0) {
        // Display error message
        QMessageBox msgBox(this);
        msgBox.setText(QString(tr("Couldn't open file to save content: %1.")
                               ).arg(xmlFileName));
        msgBox.exec();
        return;
    }

    // Set file name
    setXmlFileName(xmlFileName);

    // Feedback
    statusBar()->showMessage(tr("Done saving."), 2000);

    // Reset status changed status
    webHelper->resetSourceChanged();
}
Esempio n. 9
0
bool MTest::saveMusicXml(Score* score, const QString& saveName)
      {
      return saveXml(score, saveName);
      }
Esempio n. 10
0
void GameProfile::saveProfile()
{
    saveXml();

//  saveTopTen();
}
Esempio n. 11
0
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
    

    
    if (colorPickerRect.inside(mouseX, mouseX) && selectedColor.size()>0) {
        
            selectedColor.clear();
            selectedColor.push_back(colorPicked);
        

    }
    
    
    
    ofColor newColor(int r, int g,int b, int a);
    selectedColor.push_back(colorPicked);
    
//    img.clear();
    
  
    
    // if the size of the vector color is > 1 then start drawing the shape
    

    
        if (selectedColor.size()>1 && ableClick==true) {
            
            printf("V %lu \n",myPoints.size() );
            printf("curvevertices %lu \n",curveVertices.size() );
            
            draggableVertex newDraggableVertex(x,y,randomZ);
            curveVertices.push_back(newDraggableVertex);
            
            ofPoint newPoint(x,y,0);
            myPoints.push_back(newPoint);
            
            
            
//            saveXml(); //saving Xml file


            }
    
    
    //draggable vertices
    
    for (int i = 0; i < curveVertices.size(); i++){
        float diffx = x - curveVertices[i].x;
        float diffy = y - curveVertices[i].y;
        float dist = sqrt(diffx*diffx + diffy*diffy);
        
        
//        curveVertices[i].x=xt;
//        curveVertices[i].y=yt;
        
        if (curveVertices[i].bOver==true) {
            ofSetColor(0);
            ofDrawBitmapString(ofToString(curveVertices[i].bOver), 30,100);
//            ableClick=false;

        }
        
        if (dist < curveVertices[i].radius){
            curveVertices[i].bBeingDragged = true;
            saveXml(); //saving Xml file

            
        } else {
            curveVertices[i].bBeingDragged = false;
        }
     
    }
    

    

}
Esempio n. 12
0
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
    
    ///screen false/true
    
    if(key=='a'){
        ofColor transpaColor(colorPicked.r,colorPicked.g,colorPicked.b,ofRandom(20,150));
        selectedColor.clear();
        selectedColor.push_back(transpaColor);
        
        ofSetBackgroundAuto(false);
        
            }
    
    //easycam
    
    if(key=='z'){
        camActive=true;
        randomZ=ofRandom(-1000,1000);
        
    }else{
    
        camActive=false;
    }

    
    
    
    
//    ///close path with spacebar
//    if(key==' '){
//        if(ofFill){
//            ofNoFill();
//        }else{
//            ofFill;
//        }
//    }
    
    
    ///DELETE LAST POINT
    
    if(key=='b' && curveVertices.size()>0){
        open=true;
        curveVertices.pop_back();
        myPoints.pop_back();
        ableClick=true;
        saveXml(); //saving Xml file

    }
    
    //DELETE ALL
    
    if(key==OF_KEY_BACKSPACE){
        
        curveVertices.clear();
        myPoints.clear();
        distance=0;

        open=true;
        ableClick=true;
        saveXml(); //saving Xml file

    }
  
    ///MAKE IT CURVE
    
    if(key=='c' && curveVertices.size()>0){
        if (curved) {
            curved=false;
            curvedVal= "Curved";


        } else {
            curved=true;
            curvedVal= "Straight";


        }
            
        saveXml(); //saving Xml file
    }
    
    ///FULLSCREEN
    
    if(key=='f'){
        ofToggleFullscreen();  // set fullscreen
    }
        
     ///TEST RANDOM
    
    if(key=='k'){
        
        
        
        if (curved) {
//            ofBackground(15);
            ofColor randomColor(ofRandom(255), ofRandom(255),ofRandom(255),curveVertices.size()*10);
            selectedColor.clear();
            selectedColor.push_back(randomColor);

            
            for (int i = 0; i < curveVertices.size(); i++){
                
                curveVertices[i].x=ofRandom(ofGetWidth());
                curveVertices[i].y=ofRandom(ofGetHeight());
            
            }
            
        } else {
            ofColor randomColor(ofRandom(255), ofRandom(255),ofRandom(255),curveVertices.size()*10);
            selectedColor.clear();
            selectedColor.push_back(randomColor);

//            ofSetBackgroundAuto(false);
            for (int i = 0; i < curveVertices.size(); i++){
                ofPoint position(curveVertices[i].x,curveVertices[i].y);
                ofPoint centre(ofGetWidth()/2,ofGetHeight()/2);
                
                float dist = ofDist(position.x,position.y , centre.x,centre.y);
                
                
                
                
                if (stage.inside(curveVertices[i].x,curveVertices[i].y)) {
   
                    directionX=ofMap(mouseX, 0, ofGetWidth(), -100, 100);
                    directionY=ofMap(mouseY, 0, ofGetHeight(), -100, 100);

                    
                    curveVertices[i].x+=ofRandom(directionX);
                    curveVertices[i].y+=ofRandom(directionY);
                   
            }
        
        else {
            curveVertices[i].x=ofGetWidth() -  curveVertices[i].x;
            curveVertices[i].y=ofGetHeight() -  curveVertices[i].y;
            curveVertices[i].x+=ofRandom(directionX);
            curveVertices[i].y+=ofRandom(directionY);
            
            

          }
       }
    }
        
        saveXml(); //saving Xml file
        
        
    }
    

    
}