Exemple #1
0
void apply_colors_apps(Fl_Color fg, Fl_Color bg, Fl_Color text, Fl_String font)
{
    uchar r, g, b, r1, g1, b1, r2, g2, b2;
    fl_get_color(bg, r, g, b);
    fl_get_color(fg, r1, g1, b1);
    fl_get_color(text, r2, g2, b2);

    Fl_String filePath(fl_homedir()); 
    filePath += "/.Xdefaults";
    
    char *backgroundTypes[34] = 
    {
    "*XmList.background" ,    "*XmLGrid.background",
    "Netscape*XmList.background" ,   "Netscape*XmLGrid.background",
    "*text*background",   "*list*background",
    "*Text*background",   "*List*background", 
    "*textBackground",   "*XmTextField.background", 
    "*XmText.background",     "Netscape*XmTextField.background", 
    "Netscape*XmText.background",     "*background", 
    "*Background",  "nscal*Background",
    "*Menu*background",     "OpenWindows*WindowColor",
    "Window.Color.Background",   "netscape*background",
    "Netscape*background",   ".netscape*background",
    "Ddd*background",   "Emacs*Background",
    "Emacs*backgroundToolBarColor",//25 
    "*XmList.selectBackground" ,   "*XmLGrid.selectBackground",
    "Netscape*XmList.selectBackground" ,  "Netscape*XmLGrid.selectBackground",
    "*XmTextField.selectBackground",  "*XmText.selectBackground", 
    "Netscape*XmTextField.selectBackground",  "Netscape*XmText.selectBackground", 
    "*selectBackground" //34
		   
    };	

    FILE *colorFile = fopen(filePath, "w");
    for (int i = 0 ; i < 34; i++)
    {
        fprintf(colorFile, "%s:  #%02X%02X%02X\n", backgroundTypes[i],(short int) r, (short int) g, (short int) b);
    }	
    fprintf(colorFile, "foreground:  #%02X%02X%02X\n", r1, g1, b1);
    fprintf(colorFile, "xterm*background:  #FFFFFF\n");	//especialy for Xterm
    fclose(colorFile);

    Fl_String runString("xrdb -merge -all ");
    runString += fl_homedir(); 
    runString += "/.Xdefaults";
    
    if (fl_start_child_process(runString)==-1)
	fl_alert("Error executing xrdb program.");
}
Exemple #2
0
void MainMenu::clear_favourites()
{
    static Fl_String favourites;
    if(favourites.empty()) {
        favourites = fl_homedir();
        favourites += "/.ede/favourites/";

        if(!fl_file_exists(favourites)) {
            mkdir( favourites, 0777 );
        }
    }

    dirent **files;
    int pNumFiles = fl_filename_list(favourites, &files);

    if (pNumFiles > 10)
    {
        for (int i=0; i<(pNumFiles-10); i++) {
            if (strcmp(files[i]->d_name, ".") != 0 && strcmp(files[i]->d_name, "..") != 0 ) {
                Fl_String filename(favourites);
                filename += files[i]->d_name;
                unlink(filename);
            }
        }
    }

    for(int i = 0; i < pNumFiles; i++)
        free(files[i]);

    if(pNumFiles && files)
        free(files);
}
Exemple #3
0
void saveActiveScheme()
{
    Fl_String pathActive(fl_homedir()); 
    pathActive += "/.ede/schemes/Active.scheme";

    saveScheme(pathActive);
}
Exemple #4
0
void apply_colors_qt(Fl_Color fg, Fl_Color bg, Fl_Color text, Fl_String font)
{
    uchar r, g, b, r1, g1, b1, r2, g2, b2;
    fl_get_color(bg, r, g, b);
    fl_get_color(fg, r1, g1, b1);
    fl_get_color(text, r2, g2, b2);

    Fl_String filePath(fl_homedir()); 
    filePath += "/.qt/qtrc";

    FILE *qtfile = fopen(filePath.c_str(), "w");
    
    fprintf(qtfile, "[General]\n");
    fprintf(qtfile, "GUIEffects=none^e\n");
    fprintf(qtfile, "style=Windows\n\n");
    fprintf(qtfile, "[Palette]\n");
    fprintf(qtfile, "active=#000000^e#%02x%02x%02x^e#ffffff^e#%02x%02x%02x^e#000000^e"
	    "#%02x%02x%02x^e#000000^e#ffffff^e#000000^e#ffffff^e#%02x%02x%02x^e#000000^e"
	    "#7783bd^e#ffffff^e#0000ff^e#ff00ff^e\n",
	    r,g,b, r,g,b, r,g,b, r,g,b);
    fprintf(qtfile, "disabled=#808080^e#%02x%02x%02x^e#ffffff^e#f2f2f2^e#%02x%02x%02x^e"
	    "#b7b7b7^e#b7b7b7^e#ffffff^e#000000^e#ffffff^e#dcdcdc^e#000000^e"
	    "#000080^e#ffffff^e#0000ff^e#ff00ff^e\n", 
	    r,g,b, r,g,b);
    fprintf(qtfile, "inactive=#000000^e#%02x%02x%02x^e#ffffff^e#f2f2f2^e#%02x%02x%02x^e"
		    "#b7b7b7^e#000000^e#ffffff^e#000000^e#ffffff^e#dcdcdc^e"
		    "#000000^e#7783bd^e#ffffff^e#0000ff^e#ff00ff^e\n",
		    r,g,b, r,g,b);

    fclose(qtfile);
}
Exemple #5
0
int main(int argc, char ** argv) 
{
    signal(SIGTERM, exit_signal);
    signal(SIGKILL, exit_signal);
    signal(SIGINT, exit_signal);

    fl_init_locale_support("eiconman", PREFIX"/share/locale");
    fl_init_images_lib();

    desktop = new Desktop();
    desktop->begin();

    Fl_String homedir(fl_homedir() + "/.ede/desktop/");
    if(fl_is_dir(homedir)) {
        scanIcons(homedir);
    }

    desktop->end();
    desktop->show();

    readIconsConfiguration();

    desktop->update_workarea();
    desktop->update_bg();
    desktop->update_icons();

    Fl::add_handler(iconChangeHandler);

    while(running) Fl::wait();

    delete desktop;

    return 0;
}
Exemple #6
0
void saveSchemeAs()
{
    const char *schemeName = fl_input(_("Save scheme as:"), _("New scheme"));
    if (schemeName) 
    {
	Fl_String pathScheme; 
	pathScheme.printf("%s/.ede/schemes/%s.scheme", fl_homedir().c_str(), schemeName);
	saveScheme(pathScheme);
	schemeListBox->add(fl_file_filename(pathScheme));
    }	
}
Exemple #7
0
void apply_colors_kde(Fl_Color fg, Fl_Color bg, Fl_Color text, Fl_String font)
{
    uchar r, g, b, r1, g1, b1, r2, g2, b2;
    fl_get_color(bg, r, g, b);
    fl_get_color(fg, r1, g1, b1);
    fl_get_color(text, r2, g2, b2);

    Fl_String filePath(fl_homedir()); 
    filePath += "/.kderc";

    FILE *kdefile = fopen(filePath.c_str(), "w");
    
    fprintf(kdefile, "[General]\n");
    fprintf(kdefile, "background=%d,%d,%d\n", r, g, b);
    fprintf(kdefile, "foreground=%d,%d,%d\n", r1, g1, b1);
    

    fclose(kdefile);
}
Exemple #8
0
void fillItems() 
{
    char *file;

    Fl_String path(fl_homedir()); 
    path += "/.ede/schemes";

    dirent **files;
    int count = fl_filename_list(path, &files);

    if (count > 0)
    {
        new Fl_Item("Active");
	schemeListBox->value("Active");


        for(int n=0; n<count; n++)
        {
            file = files[n]->d_name;
            if( strcmp(file, ".") && strcmp(file, ".."))
            {
		char *filename = fl_strdup_printf("%s/%s", (char*)path, file);
                if (!fl_is_dir(filename) &&
                    fl_file_match(file, "*.scheme") && strcmp(file, "Active.scheme")!=0) 
		{
                    new Fl_Item(strdup(fl_file_filename(filename)));
                }
		delete [] filename;
            }
            free(files[n]);
        }
        free(files);
	getSchemeColors(); //we apply first scheme - active.scheme
    }

}
Exemple #9
0
void apply_colors_gtk(Fl_Color fg, 
		      Fl_Color bg, 
		      Fl_Color selection, 
		      Fl_Color selection_text, 
		      Fl_Color tooltip, 
		      Fl_Color tooltip_text, 
		      
		      Fl_Color text, 		      
		      Fl_String font)
{
    uchar r, g, b;
    uchar text_r, text_g, text_b;
    //, b1, r2, g2, b2;
    
    uchar selection_r, selection_g, selection_b;
    uchar selection_text_r, selection_text_g, selection_text_b;
    uchar tooltip_r, tooltip_g, tooltip_b;
    uchar tooltip_text_r, tooltip_text_g, tooltip_text_b;
    
    fl_get_color(bg, r, g, b);
    fl_get_color(fg, text_r, text_g, text_b);

    fl_get_color(selection, selection_r, selection_g, selection_b);
    fl_get_color(selection_text, selection_text_r, selection_text_g, selection_text_b);
    fl_get_color(tooltip, tooltip_r, tooltip_g, tooltip_b);
    fl_get_color(tooltip_text, tooltip_text_r, tooltip_text_g, tooltip_text_b);
    
//    fl_get_color(text, r2, g2, b2);

    Fl_String filePath(fl_homedir()); 
    filePath += "/.gtkrc";

    FILE *gtkFile = fopen(filePath.c_str(), "w");
    
    fprintf(gtkFile, "style \"default\" \n");
    fprintf(gtkFile, "{\n");
    fprintf(gtkFile, "fontset = \"%s\" \n", font.c_str());
    fprintf(gtkFile, "bg[NORMAL] = \"#%02X%02X%02X\"\n", r, g, b);
    fprintf(gtkFile, "fg[NORMAL] = \"#%02X%02X%02X\"\n", text_r, text_g, text_b);
    fprintf(gtkFile, "bg[PRELIGHT] = \"#%02X%02X%02X\"\n", r, g, b);
    fprintf(gtkFile, "fg[PRELIGHT] = \"#%02X%02X%02X\"\n", text_r, text_g, text_b);
    fprintf(gtkFile, "bg[ACTIVE] = \"#%02X%02X%02X\"\n", r, g, b);
    fprintf(gtkFile, "fg[ACTIVE] = \"#%02X%02X%02X\"\n", text_r, text_g, text_b);
    fprintf(gtkFile, "bg[SELECTED] = \"#%02X%02X%02X\"\n", selection_r, selection_g, selection_b);
    fprintf(gtkFile, "fg[SELECTED] = \"#%02X%02X%02X\"\n", selection_text_r, selection_text_g, selection_text_b);
    fprintf(gtkFile, "}\n");
    
    fprintf(gtkFile, "style \"menu\" \n");
    fprintf(gtkFile, "{\n");
    fprintf(gtkFile, "bg[PRELIGHT] = \"#%02X%02X%02X\"\n", selection_r, selection_g, selection_b);
    fprintf(gtkFile, "fg[PRELIGHT] = \"#%02X%02X%02X\"\n", selection_text_r, selection_text_g, selection_text_b);
    fprintf(gtkFile, "}\n");

    fprintf(gtkFile, "style \"tooltip\" \n");
    fprintf(gtkFile, "{\n");
    fprintf(gtkFile, "bg[NORMAL] = \"#%02X%02X%02X\"\n", tooltip_r, tooltip_g, tooltip_b);
    fprintf(gtkFile, "fg[NORMAL] = \"#%02X%02X%02X\"\n", tooltip_text_r, tooltip_text_g, tooltip_text_b);
    fprintf(gtkFile, "}\n");
    
    fprintf(gtkFile, "class \"*\" style \"default\"\n");
    fprintf(gtkFile, "widget_class \"*Menu*\" style \"menu\"  \n");
    fprintf(gtkFile, "widget \"gtk-tooltips\" style \"tooltip\"  \n");
    
    
    fclose(gtkFile);
}