void KisPainterlyMixer::initSpots()
{
    kDebug();
    int row, col;
    QGridLayout *l = new QGridLayout(m_spotsFrame);

    m_bgColors = new QButtonGroup(m_spotsFrame);
    loadColors();

    l->setSpacing(5);

    for (row = 0; row < ROWS; row++) {
        for (col = 0; col < COLS; col++) {
            int index = row * COLS + col;
            QToolButton *curr = new ColorSpot(m_spotsFrame, m_vColors[index]);
            QPalette p (curr->palette());
            p.setColor(QPalette::Button, m_vColors[index].toQColor());
            curr->setPalette(p);
            curr->setAutoFillBackground(false);

            l->addWidget(curr, row, col);

            m_bgColors->addButton(curr, index);
        }
    }

    l->setColumnStretch(col++, 1);

    connect(m_bgColors, SIGNAL(buttonClicked(int)), this, SLOT(slotChangeColor(int)));
}
Beispiel #2
0
ColorDialog::ColorDialog(QWidget *parent, LPlugins *plugs, QString colorFilePath) : QDialog(parent), ui(new Ui::ColorDialog){
  ui->setupUi(this); //load the designer file
  filepath = colorFilePath;
  this->setWindowIcon( LXDG::findIcon("format-stroke-color","") );
  ui->line_name->setText( colorFilePath.section("/",-1).section(".qss",0,0) );
  //Load the icons for the window
  ui->push_cancel->setIcon( LXDG::findIcon("dialog-cancel","") );
  ui->push_save->setIcon( LXDG::findIcon("document-save","") );
  ui->tool_getcolor->setIcon( LXDG::findIcon("color-picker","") );
  ui->tool_editcolor->setIcon( LXDG::findIcon("edit-rename","") );
  //Now create entries for the available colors in the database
  ui->tree_color->clear();
  QStringList colors = plugs->colorItems();
  colors.sort();
  for(int i=0; i<colors.length(); i++){
    LPI info = plugs->colorInfo(colors[i]);
    QTreeWidgetItem *it = new QTreeWidgetItem(QStringList() << info.name);
      it->setWhatsThis(0,info.ID);
      it->setToolTip(0,info.description);
    ui->tree_color->addTopLevelItem(it);
  }
  //Now load the given file
  loadColors();
  //Now center the window on the parent
  QPoint cen = parent->geometry().center();
  this->move( cen.x() - (this->width()/2) , cen.y() - (this->height()/2) );
}
Beispiel #3
0
	void Txtr::load(const fschar *colorsFileName, const fschar *alphaFileName)
	{
		removeImage();
		if (colorsFileName) loadColors(colorsFileName);
		if (alphaFileName && hasImage()) loadAlpha(alphaFileName, 255);
		else setAlpha(255);
	}
Beispiel #4
0
CMinimap::CMinimap(const Rect &position):
    CIntObject(LCLICK | RCLICK | HOVER | MOVE, position.topLeft()),
    aiShield(nullptr),
    minimap(nullptr),
    level(0),
    colors(loadColors("config/terrains.json"))
{
    pos.w = position.w;
    pos.h = position.h;
}
Beispiel #5
0
FileFactory::FileError File_v1::load(QDataStream *stream)
{

    mInternalStitchSet = new StitchSet();
    mInternalStitchSet->isTemporary = true;
    mInternalStitchSet->stitchSetFileName = StitchLibrary::inst()->nextSetSaveFile();
    QString dest = mInternalStitchSet->stitchSetFileName;
    QFileInfo info(dest);
    QDir(info.path()).mkpath(info.path() + "/" + info.baseName());

    mInternalStitchSet->loadIcons(stream);

    QByteArray docData;
    *stream >> docData;

    QXmlStreamReader xmlStream(docData);

    if(xmlStream.hasError()) {
        qWarning() << "Error loading saved file: " << xmlStream.errorString();
        return FileFactory::Err_GettingFileContents;
    }

    while (!xmlStream.atEnd() && !xmlStream.hasError()) {

        xmlStream.readNext();
        if (xmlStream.isStartElement()) {
            QString name = xmlStream.name().toString();

            if(name == "colors") {
                loadColors(&xmlStream);

            } else if(name == "chart") {
                loadChart(&xmlStream);

            } else if(name == "stitch_set") {
                mInternalStitchSet->loadXmlStitchSet(&xmlStream, true);

            }
        }
    }

    StitchLibrary::inst()->addStitchSet(mInternalStitchSet);

    return FileFactory::No_Error;
}
Beispiel #6
0
//--------------------------------------------------------------
void testApp::setup() {
	
	ofSetVerticalSync(true);
	ofBackgroundHex(0x333333);
	ofSetLogLevel(OF_LOG_NOTICE);
    
    loadColors();
    
    ofSetCircleResolution(200);
    
	numEmailsStart = 20;
    numCategories = 5;

    radius = 24;
    
    unitRadius = 80;

    xShift = 70;
    yShift = 10;
    
    saved = 0;
    trash = 0;
    
	box2d.init();
	box2d.setFPS(30.0);
    box2d.registerGrabbing();
    box2d.setGravity(-8,8);
    box2d.createBounds(0,0,ofGetWidth()+1000,ofGetHeight());
		

    
    for(int i=0; i<numCategories; i++) {
        resetAttractionPoints(numCategories);
    }
   
    // add email/circles to world
	for (int i=0; i < numEmailsStart; i++) {
        addEmail(i % numCategories);
        emails[i].setInitialConditions();
    }
}
Beispiel #7
0
//--------------------------------------------------------------
void testApp::setup() {
	
	ofSetVerticalSync(true);
	ofBackgroundHex(0x333333);
	ofSetLogLevel(OF_LOG_NOTICE);
    
    loadColors();
    
    // load NYTimes data
    dataString = fileLoader.loadFromUrl("http://localhost/algo/algo-dummy_data.txt");

    result = ofSplitString(dataString, "!");

    for(int i = 0; i< result.size(); i++){
        if(tempResult.size() > 0){
            tempResult.clear();
        }
        tempResult = ofSplitString(result[i], "#");
        nestedResults.push_back(tempResult);
    }
    

//    for(int i=0; i< nestedResults[0].size(); i++){
//        cout << nestedResults[0][i] << "###\n";        
//    }

    

    
	numEmailsStart = 80;
    numCategories = 20;

    radius = 12;
    
    unitRadius = 80;

    xShift = 70;
    yShift = 10;
    
    saved = 0;
    trash = 0;
    
	box2d.init();
	box2d.setFPS(30.0);
    box2d.registerGrabbing();
    box2d.setGravity(-8,8);
    box2d.createBounds(0,0,ofGetWidth()+1000,ofGetHeight());
		

    
    for(int i=0; i<numCategories; i++) {
        resetAttractionPoints(numCategories);
    }
   
    // add email/circles to world
	for (int i=0; i < numEmailsStart; i++) {
        addEmail(i % numCategories);
        emails[i].setInitialConditions();
    }
    

    
    
}
Beispiel #8
0
DisplayGrid::DisplayGrid(GridBool* obsMap) : obsMap(obsMap)
{
	loadColors();
}
Beispiel #9
0
DisplayGrid::DisplayGrid()
{
	loadColors();
}
bool SpriteMeshLoader::loadSpriteMesh( string filename, string meshID ){


    //check if meshID already exists!
    if (renderer->vboList[meshID]){
        renderer->vboList.erase(meshID);
        }

    // XML File Open

    cout << "Loading file..." << filename <<endl;

    TiXmlDocument doc( filename );
    if (!doc.LoadFile()) return false;

    TiXmlHandle hDoc(&doc);
    TiXmlElement * element;
    TiXmlHandle hRoot(0);

    //***********************************************************************
    //Skip over first Element
    //***********************************************************************
    element=hDoc.FirstChildElement().Element();
    // should always have a valid root but handle gracefully if it doesn't
    if (!element) return false;

    // save this for later
    hRoot=TiXmlHandle(element);
    //end XML file open;

    //setup new MeshData
    MeshData* myMesh=new MeshData;
    myMesh->bIsSkeletal=false;
    myMesh->bIsHead=false;
    myMesh->bVertexColor=true;
    myMesh->boneCount=0;
    myMesh->texCoordPerVertexCount=3;
    myMesh->verticesPerShapeCount=4;
    myMesh->vertexInterpretation=GL_POINTS;
    myMesh->drawType=DRAW_VBOMESH;
    renderer->vboList[meshID]=myMesh;


    loadVertices(meshID, hRoot.FirstChild("vertices").Element());
    loadNormals(meshID, hRoot.FirstChild("normals").Element());
    loadTexCoords(meshID, hRoot.FirstChild("texCoords").Element());

    loadColors(meshID, hRoot.FirstChild("colors").Element());
    loadSecondaryColors(meshID, hRoot.FirstChild("secondaryColors").Element());

    loadBoneReferences(meshID, hRoot.FirstChild("boneReferences").Element());
    loadVertexWeights(meshID, hRoot.FirstChild("vertexWeights").Element());

    cout << "loading bones..." << endl;

    loadBones(meshID, hRoot.FirstChild("bone").Element());


	//fill vertex data for editing
	if (!renderer->vboList[meshID]->vData.empty())
		renderer->vboList[meshID]->vData.clear();

	for (int i=0;i<vertexCount;i++){
        vertexData myVData;
        myVData.location=vertices[i];
        myVData.normal=normals[i];
        myVData.color=colors[i];
        myVData.secondaryColor=secondaryColors[i];
        myVData.birth=0.0f;
        myVData.texCoord=texCoords[i];
        myVData.vertexWeights=vertexWeights[i];
        myVData.boneReferences=boneReference[i];
        renderer->vboList[meshID]->vData.push_back(myVData);
    }

    cout << "before creating vbos..." << endl;


    createVBOs(meshID);

    cout << "after creating vbos..." << endl;


   //now free our resources:
	delete(vertices);
	delete(normals);
	delete(texCoords);
	delete(colors);
	delete(secondaryColors);
	delete(vertexWeights);
	delete(boneReference);

    doc.Clear();

    cout << "finished loading SpriteMesh" << endl;

    return true;
}
Beispiel #11
0
//--------------------------------------------------------------
void testApp::setup() {
	
	ofSetVerticalSync(true);
	ofSetLogLevel(OF_LOG_NOTICE);
    
    ofEnableAlphaBlending();

	ofBackgroundHex(0x333333);
    bgImage.loadImage("bg.png");
   

    
    loadColors();
    sortByCategory = false;
//    bool mousePressed = false;
    
    ofTrueTypeFont::setGlobalDpi(72);

    myFont.loadFont("GothamHTF-Bold.otf", 29, true, true, true);
    myFontMed.loadFont("GothamHTF-Bold.otf", 18, true, true, true);
    myFontSmall.loadFont("GothamHTF-Bold.otf", 14, true, true, true);

    myFont.setLineHeight(28.0f);
    myFontSmall.setLineHeight(18.0f);
	myFontMed.setLetterSpacing(.95);

    
  //  myFont.loadFont("GothamHTF-Bold.otf", 32, true, true, true);
    
    typeString = "hiyoooo";
    
    // load NYTimes data
    dataString = fileLoader.loadFromUrl("http://localhost/algo/algo-dummy_data.txt");

    result = ofSplitString(dataString, "!");

    for(int i = 0; i< result.size(); i++){
        if(tempResult.size() > 0){
            tempResult.clear();
        }
        tempResult = ofSplitString(result[i], "#");
        nestedResults.push_back(tempResult);
    }
    

//    for(int i=0; i< nestedResults[0].size(); i++){
//        cout << nestedResults[0][i] << "###\n";        
//    }

    

    
	numEmailsStart = 80;
    numCategoriesStart = 20;
    numCategories = 20;
    
    radius = 17;
    
    unitRadius = 110;

    xShift = 0;
    yShift = 20;
    
    saved = 0;
    trash = 0;
    
	box2d.init();
	box2d.setFPS(30.0);
    box2d.registerGrabbing();
    box2d.setGravity(0,0);
    box2d.createBounds(0,0,ofGetWidth()+1000,ofGetHeight());
		

    
    for(int i=0; i<numCategoriesStart; i++) {
   //     resetAttractionPoints(numCategories);
        catHasArticles[i] = false;
    }
   
    // add email/circles to world
	for (int i=0; i < numEmailsStart; i++) {
       if(nestedResults[i].size() > 0) {    
            if(indexForCategory(nestedResults[i][CATEGORY]) > -1){
              //  addEmail(i%numCategories);
                addEmail(indexForCategory(nestedResults[i][CATEGORY]), i);
                
                // keeping track of which articles actually have articles in them
                catHasArticles[indexForCategory(nestedResults[i][CATEGORY])] = true;
            }
        }
    }
    
    for (int i=0; i<emails.size(); i++) {
        emails[i].setInitialConditions();
    }
    
    //now keep track of reverse (what index is for current category)
    for(int i=0; i<numCategoriesStart; i++) {
        if(catHasArticles[i] == true){
            categoriesWithArticles.push_back(i);
            currentCategoryKeys[i] = categoriesWithArticles.size() -1;
        }
        else {
            currentCategoryKeys[i] = -1;
        }
    }
    
    
    for(int i=0; i<numCategoriesStart; i++) {
        cout << currentCategoryKeys[i] << "\n";
    }

    numCategories = categoriesWithArticles.size();
    
    for (int i = 0; i < numCategories ; i++) {
         resetAttractionPoints(numCategories);
    }
    ;
}
Beispiel #12
0
/* - Fill / update dialog with known information (from HASH table) ---------- */
void fill_dialog() {
	gint listID;
	gchar *licence_path = NULL;
	DIR *licence_dir = NULL;
	GList *licence_list = NULL;

    /* -- Fill in values for 'General' tab ---------------------------------- */
	if(SHASH("hostname") != NULL) {
#ifdef _DEBUG_
		g_warning("Hostname to be set active: %s", SHASH("hostname"));
#endif
		listID = g_list_index(hostnames, SHASH("hostname"));
		gtk_combo_box_set_active(GTK_COMBO_BOX(combo_host), listID);
		gtk_combo_box_set_active(GTK_COMBO_BOX(combo_host2), listID);		                         
	}

	if(SHASH("username") != NULL)
		gtk_entry_set_text(GTK_ENTRY(input_username), SHASH("username"));
	if(SHASH("password") != NULL)
		gtk_entry_set_text(GTK_ENTRY(input_password), SHASH("password"));
	if(SHASH("domain") != NULL)
		gtk_entry_set_text(GTK_ENTRY(input_domain), SHASH("domain"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_savepw),
		iSHASH("savepw"));

	loadRdpProtocols(combo_rdp_proto);  /* Set RDP version */
	
    /* -- Fill in values for 'Display' tab ---------------------------------- */
	loadScreens(combo_screen_size);
	sig_screensize(combo_screen_size, NULL);

	loadColors(menu_colorsize);
	sig_colchange(NULL, NULL);

    /* -- Fill in values for 'Resources' tab -------------------------------- */
	loadSoundOptions(menu_sound);
	sig_sound(NULL, NULL);

    /* -- Fill in values for 'Program' tab ---------------------------------- */
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_prog),
		iSHASH("runprog"));
	if(SHASH("program") != NULL)
		gtk_entry_set_text(GTK_ENTRY(input_program), SHASH("program"));
	if(SHASH("ppath") != NULL)
		gtk_entry_set_text(GTK_ENTRY(input_ppath), SHASH("ppath"));
	gtk_widget_set_sensitive(input_program, iSHASH("runprog"));
	gtk_widget_set_sensitive(input_ppath, iSHASH("runprog"));

    /* -- Fill in values for 'Extended' tab --------------------------------- */
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_bitmapupd),
		iSHASH("bitmapupd"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_motionevt),
		iSHASH("motionevt"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_hidewmdecoration),
		iSHASH("hidewmdecoration"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_noencr),
		iSHASH("noencryption"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_wmkeybindings),
		iSHASH("wmkeybindings"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_attconsole),
		iSHASH("attconsole"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_sshopts),
		iSHASH("usessh"));
	gtk_widget_set_sensitive(btn_sshopts, iSHASH("usessh"));

	// TODO MKA 2015-09-02 What is this? Licenses to remote servers...
//	licence_path = gnome_util_prepend_user_home(".rdesktop");
	licence_path = g_strconcat(g_get_home_dir(), ".rdesktop", NULL);
#ifdef _DEBUG_
    g_warning("Licence path: %s", licence_path);
#endif
	licence_dir = opendir(licence_path);
	if(licence_dir != NULL) {
		struct dirent *entry = NULL;
		const gchar *prefix = "licence.";

		while((entry = readdir(licence_dir)) != NULL) {
			gchar *fullname = NULL;
			gchar *hostname = &entry->d_name[strlen(prefix)];
			struct stat sts;

			fullname = g_strdup_printf("%s/%s", licence_path, entry->d_name);

			if(stat(fullname, &sts) == -1)
				continue;
			if(!S_ISREG(sts.st_mode))
				continue;
	
			if(strlen(entry->d_name) <= strlen(prefix))
				continue;

			licence_list = g_list_append(licence_list, g_strdup(hostname));
		}
		closedir(licence_dir);
		if (licence_list != NULL) {
            fill_combo_with_list(combo_clientname, licence_list);
		}
	}

	if ((SHASH("clientname") != NULL) &&
		(licence_list != NULL)) {
			listID = g_list_index(licence_list, SHASH("clientname"));
			gtk_combo_box_set_active(GTK_COMBO_BOX(combo_clientname), listID);
	}

    /* MKA -- Fill in values for 'Redirect' tab ----------------------------- */
	if(SHASH("redirect") != NULL) {
        gtk_entry_set_text(GTK_ENTRY(entryOutput), SHASH("redirect"));
	}

	/* finally, we deactivate all rdp unsupported widgets */
	sig_rdp_protocol(NULL, NULL);
}
Beispiel #13
0
	void Txtr::load(const fschar *colorsFileName, gl_ubyte alpha)
	{
		removeImage();
		if (colorsFileName) loadColors(colorsFileName);
		setAlpha(alpha);
	}