xbindkeys_config-0.1.3/0040755000175000001440000000000007670641730014766 5ustar lapinatorusersxbindkeys_config-0.1.3/BUGS0100644000175000001440000000012607465775127015457 0ustar lapinatorusers NO KNOWN BUGS for current version. Please report with bugs, patches or suggestions! xbindkeys_config-0.1.3/TODO0100644000175000001440000000012307670641554015453 0ustar lapinatorusersUpd: xbindkeys 1.6.0. Add: automake && autoconf Add: languages support Fix: Manuelxbindkeys_config-0.1.3/Makefile0100644000175000001440000000074507670641721016431 0ustar lapinatorusers# makefile crée par Laurent VUIBERT CC= gcc -O3 -Wall STD= _GNU_SOURCE GTK= `gtk-config --cflags --libs` GTK2= `gtk-config --cflags` OBJS= xbindkeys_config.o menu.o middle.o speedc.o NOM= xbindkeys_config prefix= /usr .c.o: $(CC) $(GTK2) -D$(STD) -c $< all: main main: $(OBJS) $(CC) $(GTK) $(OBJS) -o $(NOM) clean: rm -f *.o */*.o */*~ core $(NOM) *~ rm -rf .v* install: cp $(NOM) $(DESTDIR)$(prefix)/bin/ unistall: rm $(DESTDIR)$(prefix)/bin/$(NOM) #End Makefile xbindkeys_config-0.1.3/speedc.c0100644000175000001440000002075407477101204016372 0ustar lapinatorusers/*************************************************************************** xbindkeys_config : config programme for xbindkey. ------------------- begin : Sat jan 5 14:11:34 CEST 2002 copyright : (C) 2002 by Laurent VUIBERT email : lapinator@gmx.fr ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include #include #include #include #include #include #include #include #include #include "speedc.h" #include "middle.h" #include "version.h" /* TODO change to dynamic list */ typedef struct list_speedc { char Name[30]; char File[1024]; } list_speedc; list_speedc list[30]; int SPEEDC_ROW; GtkWidget *Speed_config; /*****************************************************************************/ void xbindkeys_config_speed_init() { char *p, buf[1024]; int i; DIR *dir; struct dirent *dp; /* clear the Speed_config */ gtk_clist_clear (GTK_CLIST(Speed_config)); /* create $HOME/.xbindkey_config is not exist */ sprintf(buf,"%s/.xbindkeys_config", getenv ("HOME")); dir = opendir(buf); if( dir==NULL ) { if( errno==ENOENT ){ i = mkdir( buf, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); printf("make file ~/.xbindkeys_config\n"); } } else closedir(dir); /* create $HOME/.xbindkey_config/speed_c is not exist */ sprintf(buf,"%s/.xbindkeys_config/speed_c", getenv ("HOME")); dir = opendir(buf); if( dir==NULL ) { if( errno==ENOENT ){ i = mkdir( buf, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); printf("make file ~/.xbindkeys_config/speed_c\n"); } } else closedir(dir); /* add the default file */ p = g_strdup_printf("Default"); gtk_clist_append(GTK_CLIST(Speed_config), &p ); sprintf(list[0].Name, "Default"); sprintf(list[0].File, "%s/.xbindkeysrc", getenv ("HOME")); /* list all file in $HOME/.xbindkey_config/speed_c */ if(!(dir = opendir(buf))) { return; } dp = readdir(dir); while(dp!=NULL){ if(dp->d_name[0]!='.'){ p = g_strdup_printf(dp->d_name); gtk_clist_append(GTK_CLIST(Speed_config), &p ); } dp=readdir(dir); } closedir(dir); } /*****************************************************************************/ void speedc_load(GtkWidget *parent, void *data) { char buf2[1024]; char *buf[1024]; if(SPEEDC_ROW==0){ sprintf(buf2, "%s/.xbindkeysrc", getenv ("HOME")); read_file(buf2); } else { gtk_clist_get_text (GTK_CLIST(Speed_config), SPEEDC_ROW, 0, buf); sprintf(buf2, "%s/.xbindkeys_config/speed_c/%s", getenv ("HOME"), buf[0]); read_file(buf2); } return; } /*****************************************************************************/ void speedc_apply (GtkWidget *parent, void *data) { middle_apply_action(NULL, NULL); } /*****************************************************************************/ void speed_select_row (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer user_data) { SPEEDC_ROW=row; return; } /*****************************************************************************/ void speed_select_row_show(GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer user_data) { SPEEDC_ROW=row; speedc_load(NULL, NULL); } /*****************************************************************************/ void speedc_save_ok(GtkWidget *parent, GtkWidget *label) { char buf2[1024]; sprintf(buf2, "%s/.xbindkeys_config/speed_c/%s", getenv ("HOME"), gtk_entry_get_text(GTK_ENTRY(label))); save_file(buf2); xbindkeys_config_speed_init(); return; } /*****************************************************************************/ void speedc_save_cancel(GtkWidget *parent, void *data) { printf("cancel\n"); } /*****************************************************************************/ void speedc_save(GtkWidget *parent, void *data) { GtkWidget *window; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *label; GtkWidget *button; window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_window_set_title(GTK_WINDOW(window), "Xbindkeys Config Version : " XBINDKEYS_CONFIG_VERSION ); vbox = gtk_vbox_new (FALSE, 4); gtk_container_add(GTK_CONTAINER(window),vbox); /* The txt */ hbox = gtk_hbox_new (FALSE, 4); gtk_container_add(GTK_CONTAINER(vbox),hbox); label = gtk_label_new("Save As :"); gtk_container_add(GTK_CONTAINER(hbox),label); label = gtk_entry_new_with_max_length(16); gtk_container_add(GTK_CONTAINER(hbox),label); /* Button */ hbox = gtk_hbox_new (FALSE, 4); gtk_container_add(GTK_CONTAINER(vbox),hbox); button = gtk_button_new_with_label("Save"); gtk_container_add(GTK_CONTAINER(hbox),button); gtk_signal_connect(GTK_OBJECT(button), "pressed", (GtkSignalFunc)speedc_save_ok, label); gtk_signal_connect_object(GTK_OBJECT(button), "pressed", (GtkSignalFunc)gtk_widget_destroy, GTK_OBJECT(window)); button = gtk_button_new_with_label("Cancel"); gtk_container_add(GTK_CONTAINER(hbox),button); gtk_signal_connect(GTK_OBJECT(button), "pressed", (GtkSignalFunc)speedc_save_cancel, NULL); gtk_signal_connect_object(GTK_OBJECT(button), "pressed", (GtkSignalFunc)gtk_widget_destroy, GTK_OBJECT(window)); gtk_widget_show_all(window); return; } /*****************************************************************************/ void speedc_del(GtkWidget *parent, void *data) { char buf2[1024]; char *buf[1024]; if(SPEEDC_ROW==0){ gtk_label_set_text (GTK_LABEL(label_warning), "\nDefault cannot be deleted\n"); } else { gtk_clist_get_text (GTK_CLIST(Speed_config), SPEEDC_ROW, 0, buf); sprintf(buf2, "%s/.xbindkeys_config/speed_c/%s", getenv ("HOME"), buf[0]); unlink(buf2); xbindkeys_config_speed_init(); } return; } /*****************************************************************************/ GtkWidget * xbindkeys_config_speed_config(int show) { GtkWidget *frame; GtkWidget *src; GtkWidget *vbox; GtkWidget *vbox2; GtkWidget *hbox; GtkWidget *button; vbox = gtk_vbox_new (FALSE, 4); vbox2 = gtk_vbox_new (FALSE, 4); frame = gtk_frame_new ("Speed Config:"); gtk_container_add(GTK_CONTAINER(vbox), frame); src = gtk_scrolled_window_new ( NULL, NULL ); gtk_container_add(GTK_CONTAINER(frame), vbox2); gtk_box_pack_start(GTK_BOX(vbox2), src, TRUE, TRUE, 0); Speed_config = gtk_clist_new (1); if(show) gtk_signal_connect(GTK_OBJECT(Speed_config), "select-row", (GtkSignalFunc)speed_select_row_show, NULL); else gtk_signal_connect(GTK_OBJECT(Speed_config), "select-row", (GtkSignalFunc)speed_select_row, NULL); gtk_clist_set_selection_mode (GTK_CLIST(Speed_config), GTK_SELECTION_BROWSE); gtk_clist_set_reorderable(GTK_CLIST(Speed_config), TRUE); gtk_container_add (GTK_CONTAINER(src), Speed_config); hbox = gtk_hbox_new (FALSE, 4); if(show){ button = gtk_button_new_with_label("Apply"); gtk_container_add(GTK_CONTAINER(hbox), button); gtk_signal_connect(GTK_OBJECT(button), "pressed", (GtkSignalFunc)speedc_apply, NULL); } else { button = gtk_button_new_with_label("Load"); gtk_container_add(GTK_CONTAINER(hbox), button); gtk_signal_connect(GTK_OBJECT(button), "pressed", (GtkSignalFunc)speedc_load, NULL); button = gtk_button_new_with_label("Save"); gtk_container_add(GTK_CONTAINER(hbox), button); gtk_signal_connect(GTK_OBJECT(button), "pressed", (GtkSignalFunc)speedc_save, NULL); button = gtk_button_new_with_label("Del"); gtk_container_add(GTK_CONTAINER(hbox), button); gtk_signal_connect(GTK_OBJECT(button), "pressed", (GtkSignalFunc)speedc_del, NULL); } gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); xbindkeys_config_speed_init(); return vbox; } xbindkeys_config-0.1.3/speedc.h0100644000175000001440000000013707477077221016403 0ustar lapinatorusers#include #include GtkWidget * xbindkeys_config_speed_config(int show); xbindkeys_config-0.1.3/README0100644000175000001440000000221707670635425015651 0ustar lapinatorusers/*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ this is a config program for xbindkeys it can create and modify the file ~/.xbindkeysrc, stop and restart xbindkeys. -- Required XFree86 to compile from source: the GTK+ include files and libraries. -- Instructions for instalation: You have need xbindkeys program http://hocwp.free.fr/xbindkeys/xbindkeys.html xbindkeys_config instalation: make su root make install for uninstall su root make unistall too use xbindkeys_config type: xbindkeys_config -- Contact Info Laurent Vuibert lapinator@gmx.netxbindkeys_config-0.1.3/middle.c0100644000175000001440000007027407670641646016405 0ustar lapinatorusers/*************************************************************************** xbindkeys_config : config programme for xbindkey. ------------------- begin : Sat jan 5 14:11:34 CEST 2002 copyright : (C) 2002 by Laurent VUIBERT email : lapinator@gmx.fr ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include #include #include #include #include #include "middle.h" #include "version.h" #include "speedc.h" #define TEMP_FILE "/tmp/xbindkeysrc-tmp" gboolean middle_get_key(GtkWidget *parent, void *data); gboolean middle_run_action(GtkWidget *parent, void *data); void select_row (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer user_data); void unselect_row(GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer user_data); void clist_set_text (GtkButton *button, gpointer user_data); void append_file(char file_in[]); void middle_delete_item(GtkWidget *parent, void *data); void middle_append_item(GtkWidget *parent, void *data); void middle_up_item(GtkWidget *parent, void *data); void middle_down_item(GtkWidget *parent, void *data); void middle_save_apply_exit_action(GtkWidget *parent, void *data); void middle_copy_item(GtkWidget *parent, void *data); void middle_apply_action(GtkWidget *parent, void *data); void middle_clist_set_visible(); void restart_xbindkeys(); #define TITLE_NB_ITEMS 3 static char *titles[TITLE_NB_ITEMS]= { "Name", "Key", "Action" }; static int titles_width[TITLE_NB_ITEMS]= { 100, 220, 100 }; static int ROW=-1; /* Active ROW -1 if no seleced row */ gboolean allow_refresh_gtk_entry = TRUE; /* For bugs */ GtkWidget *entry_rem; GtkWidget *entry_key; GtkWidget *entry_act; GtkWidget *clist; GtkWidget *button_get_key; GtkWidget *button_run_act; GtkWidget *button_del_sel; GtkWidget *button_cp_item; GtkWidget *button_up; GtkWidget *button_down; GtkWidget *Flag_NumLock; GtkWidget *Flag_ScrollLock; GtkWidget *Flag_CapsLock; GtkWidget *button_undo; gchar button_undo_rem[128]; gchar button_undo_key[128]; gchar button_undo_act[128]; //GtkWidget *label_warning; GtkWidget *Speed_config; /*****************************************************************************/ GtkWidget * xbindkeys_config_middle() { GtkWidget *panedH; GtkWidget *src; GtkWidget *label; GtkWidget *button; GtkWidget *table; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *hbox2; GtkWidget *frame; panedH = gtk_hpaned_new(); /* LEFT paned */ vbox = gtk_vbox_new (FALSE, 4); gtk_paned_pack1 ( GTK_PANED(panedH), vbox, TRUE, TRUE); src = xbindkeys_config_middle_list(FALSE); gtk_box_pack_start(GTK_BOX(vbox), src, TRUE, TRUE, 0); hbox = gtk_hbox_new (FALSE, 4); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); button_del_sel = gtk_button_new_with_label("Delete Selected"); gtk_box_pack_start(GTK_BOX(hbox), button_del_sel, TRUE, TRUE, 0); gtk_signal_connect(GTK_OBJECT(button_del_sel), "released", (GtkSignalFunc)middle_delete_item, NULL); button = gtk_button_new_with_label("New"); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_signal_connect(GTK_OBJECT(button), "pressed", (GtkSignalFunc)middle_append_item, NULL); button_cp_item = gtk_button_new_with_label("Copy Item"); gtk_box_pack_start(GTK_BOX(hbox), button_cp_item, TRUE, TRUE, 0); gtk_signal_connect(GTK_OBJECT(button_cp_item), "pressed", (GtkSignalFunc)middle_copy_item, NULL); hbox2 = gtk_hbox_new (TRUE, 4); gtk_box_pack_start(GTK_BOX(hbox), hbox2, TRUE, TRUE, 0); button_up = gtk_button_new_with_label("Up"); gtk_box_pack_start(GTK_BOX(hbox2), button_up, TRUE, TRUE, 0); gtk_signal_connect(GTK_OBJECT(button_up), "pressed", (GtkSignalFunc)middle_up_item, NULL); button_down = gtk_button_new_with_label("Down"); gtk_box_pack_start(GTK_BOX(hbox2), button_down, TRUE, TRUE, 0); gtk_signal_connect(GTK_OBJECT(button_down), "pressed", (GtkSignalFunc)middle_down_item, NULL); /* RIGHT paned */ vbox = gtk_vbox_new (FALSE, 4); gtk_paned_pack2 ( GTK_PANED(panedH), vbox, TRUE, TRUE); frame = gtk_frame_new ("Edit :"); gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); table = gtk_table_new (5, 2, FALSE); gtk_container_add(GTK_CONTAINER(frame), table); /* Remark */ label = gtk_label_new ("Name : "); gtk_label_set_justify (GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_table_attach (GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); entry_rem = gtk_entry_new(); gtk_table_attach (GTK_TABLE(table), entry_rem, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); gtk_signal_connect(GTK_OBJECT(entry_rem), "changed", (GtkSignalFunc)clist_set_text, NULL); /* key */ label = gtk_label_new ("Key : "); gtk_label_set_justify (GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_table_attach (GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0); entry_key = gtk_entry_new(); gtk_table_attach (GTK_TABLE(table), entry_key, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); gtk_signal_connect(GTK_OBJECT(entry_key), "changed", (GtkSignalFunc)clist_set_text, NULL); /* Get Key */ button_get_key = gtk_button_new_with_label("Get Key"); gtk_label_set_justify (GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_table_attach (GTK_TABLE(table), button_get_key, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); gtk_signal_connect(GTK_OBJECT(button_get_key), "pressed", (GtkSignalFunc)middle_get_key, NULL); /* Action */ label = gtk_label_new ("Action : "); gtk_table_attach (GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, GTK_FILL, 0, 0); entry_act = gtk_entry_new(); gtk_table_attach (GTK_TABLE(table), entry_act, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); gtk_signal_connect(GTK_OBJECT(entry_act), "changed", (GtkSignalFunc)clist_set_text, NULL); /* Action */ button_run_act = gtk_button_new_with_label("Run Action"); gtk_table_attach (GTK_TABLE(table), button_run_act, 1, 2, 4, 5, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); gtk_signal_connect(GTK_OBJECT(button_run_act), "pressed", (GtkSignalFunc)middle_run_action, NULL); /* Undo */ button_undo = gtk_button_new_with_label("Undo"); gtk_table_attach (GTK_TABLE(table), button_undo, 1, 2, 5, 6, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); gtk_signal_connect(GTK_OBJECT(button_undo), "pressed", (GtkSignalFunc)undo, NULL); /* Flags */ frame = gtk_frame_new ("Use state of:"); gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); /* vbox2 : warnning the name is hbox */ hbox = gtk_vbox_new (FALSE, 4); gtk_container_add(GTK_CONTAINER(frame), hbox); /* NumLock */ Flag_NumLock = gtk_check_button_new_with_label ("NumLock"); gtk_box_pack_start(GTK_BOX(hbox), Flag_NumLock, FALSE, FALSE, 0); /* Flag_ScrollLock */ Flag_ScrollLock = gtk_check_button_new_with_label ("ScrollLock"); gtk_box_pack_start(GTK_BOX(hbox), Flag_ScrollLock, FALSE, FALSE, 0); /* Flag_CapsLock */ Flag_CapsLock = gtk_check_button_new_with_label ("CapsLock"); gtk_box_pack_start(GTK_BOX(hbox), Flag_CapsLock, FALSE, FALSE, 0); /* Update */ button = gtk_button_new_with_label("Apply"); gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(button), "pressed", (GtkSignalFunc)middle_apply_action, NULL); /* Exit & Update */ button = gtk_button_new_with_label("Save & Apply & Exit"); gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 4); gtk_signal_connect(GTK_OBJECT(button), "pressed", (GtkSignalFunc)middle_save_apply_exit_action, NULL); unselect_row((GtkCList*)NULL , 0, 0, (GdkEventButton *) NULL, (gpointer) NULL) ; /* Speed Config */ frame = xbindkeys_config_speed_config(0); gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); /* Warning */ frame = gtk_frame_new ("Warning :"); gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); label_warning = gtk_label_new ("\n \n"); gtk_container_add(GTK_CONTAINER(frame), label_warning); /* End */ return panedH; } /*****************************************************************************/ GtkWidget * xbindkeys_config_middle_list(gboolean show) { GtkWidget *src; int i; src = gtk_scrolled_window_new ( NULL, NULL ); gtk_widget_set_usize(src,550,400); clist = gtk_clist_new_with_titles ( TITLE_NB_ITEMS, titles ); gtk_clist_set_selection_mode (GTK_CLIST(clist), GTK_SELECTION_BROWSE); gtk_clist_set_reorderable(GTK_CLIST(clist), TRUE); gtk_container_add (GTK_CONTAINER(src), clist); if(!show){ gtk_signal_connect(GTK_OBJECT(clist), "select-row", (GtkSignalFunc)select_row, NULL); gtk_signal_connect(GTK_OBJECT(clist), "unselect-row", (GtkSignalFunc)unselect_row, NULL); } else { /* For dont display a bug */ Flag_NumLock = gtk_check_button_new_with_label ("NumLock"); Flag_ScrollLock = gtk_check_button_new_with_label ("ScrollLock"); Flag_CapsLock = gtk_check_button_new_with_label ("CapsLock"); } for(i=0; i< TITLE_NB_ITEMS; i++){ gtk_clist_column_title_passive (GTK_CLIST(clist), i); } for(i=0; i pos1){ pos1=strchr(line, '='); if(pos1++){ for(pos1++; *pos1==' ' || *pos1=='\b'; pos1++); for(pp=line; *pp==' ' || *pp=='\b'; pp++); if(*pp=='k'){ if(strncmp (pp, "keystate_numlock",16)) if(strncmp (pos1-1, "enable",6)) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(Flag_NumLock), TRUE); if(strncmp (pp, "keystate_capslock",17)) if(strncmp (pos1-1, "enable",6)) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(Flag_CapsLock), TRUE); if(strncmp (pp, "keystate_scrolllock",19)) if(strncmp (pos1-1, "enable",6)) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(Flag_ScrollLock), TRUE); } } } } /* test is is a command */ pos1 = strchr (line, '"'); if (pos1){ pos2 = strchr (line, '#'); if (! pos2 || pos2 > pos1){ pos2 = strrchr (line, '"'); if (pos2 && pos1 < pos2){ /* get line 1 */ *(pos2)=0; pos1++; /* get line 2 */ fgets (line2, sizeof(line), f); for(i=strlen(line2)-1; line2[i]==' ' || line2[i]=='\t' || line2[i]==10; i--) line2[i]=0; for(i=0; line2[i]==' ' || line2[i]=='\t'; i++); p2=line2+i; /* get line 3 */ fgets (line3, sizeof(line), f); for(i=strlen(line3)-1; line3[i]==' ' || line3[i]=='\t' || line3[i]==10; i--) line3[i]=0; for(i=0; line3[i]==' ' || line3[i]=='\t'; i++); p3=line3+i; /* get line p */ for(i=strlen(linep)-1; linep[i]==' ' || linep[i]=='\t' || linep[i]==10; i--) linep[i]=0; for(i=0; linep[i]==' ' || linep[i]=='\t'; i++); pp=linep+i+1; /* +1 to del '#' */ text[0] = g_strdup_printf("%s", pp); if(*p3 && *p2) text[1] = g_strdup_printf("%s | %s", p3, p2); if(*p3 && !*p2) text[1] = g_strdup_printf("%s", p3); if(!*p3 && *p2) text[1] = g_strdup_printf("%s", p2); text[2] = g_strdup_printf("%s", pos1); gtk_clist_append(GTK_CLIST(clist), text); for(i=0; i0){ gtk_clist_swap_rows (GTK_CLIST(clist), ROW, ROW -1); ROW--; middle_clist_set_visible(); } } /*****************************************************************************/ void middle_down_item(GtkWidget *parent, void *data) { char *buf[1024]; if( gtk_clist_get_text (GTK_CLIST(clist), ROW+1, 0, buf) && ROW!=-1 ){ gtk_clist_swap_rows (GTK_CLIST(clist), ROW+1, ROW); ROW++; middle_clist_set_visible(); } } /*****************************************************************************/ void main_exit() { g_print("Exit\n"); exit(0); unlink(TEMP_FILE); } /*****************************************************************************/ void middle_save_apply_exit_action(GtkWidget *parent, void *data) { char buf[1024]; sprintf(buf, "%s/.xbindkeysrc", getenv ("HOME")); save_file(buf); system("killall -HUP xbindkeys"); //usleep(500); //system("xbindkeys&"); main_exit(); } /*****************************************************************************/ void middle_apply_action(GtkWidget *parent, void *data) { unlink(TEMP_FILE); save_file(TEMP_FILE); system("killall -9 xbindkeys"); usleep(500); /* printf("****\n\noutput = %d\n\n****",system("xbindkeys -f " TEMP_FILE )); */ system("xbindkeys -f " TEMP_FILE ); } /*****************************************************************************/ void selectable_clist(gboolean state) { char *buf[1024]; int i; for(i=0; gtk_clist_get_text (GTK_CLIST(clist), i, 0, buf); i++) gtk_clist_set_selectable(GTK_CLIST(clist), i, state); } /*****************************************************************************/ void middle_clist_set_visible() { /* if(!(gtk_clist_row_is_visible(GTK_CLIST(clist), ROW)==GTK_VISIBILITY_NONE)) */ gtk_clist_moveto(GTK_CLIST(clist), ROW, 0, 0.5, 0.5); } /*****************************************************************************/ void undo() { gtk_entry_set_text (GTK_ENTRY(entry_rem), button_undo_rem); gtk_entry_set_text (GTK_ENTRY(entry_key), button_undo_key); gtk_entry_set_text (GTK_ENTRY(entry_act), button_undo_act); } /*****************************************************************************/ void set_default() { char *text[TITLE_NB_ITEMS]; int i; gtk_clist_clear (GTK_CLIST(clist)); text[0] = g_strdup_printf("key win"); text[1] = g_strdup_printf("Mod2 + Menu | m:0x10 + c:117"); text[2] = g_strdup_printf("xbindkeys_show"); gtk_clist_append(GTK_CLIST(clist), text); for(i=0; i GtkWidget * xbindkeys_config_middle(); GtkWidget * xbindkeys_config_middle_list(gboolean show); GtkWidget *button_undo_menu; GtkWidget *label_warning; void new_file(); void read_file(char file[]); void save_file(char file_out[]); void append_file(char file_in[]); void view_generated_file(); void undo(); void set_default(); void selectable_clist(gboolean state); void main_exit(); void middle_apply_action(GtkWidget *parent, void *data); xbindkeys_config-0.1.3/xbindkeys_config.c0100644000175000001440000000735207670634105020461 0ustar lapinatorusers/*************************************************************************** xbindkeys_config : config programme for xbindkey. ------------------- begin : Sat jan 5 14:11:34 CEST 2002 copyright : (C) 2002 by Laurent VUIBERT email : lapinator@gmx.fr ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include #include #include #include #include "menu.h" #include "middle.h" #include "version.h" #include "speedc.h" int main (int argc, char *argv[]) { GtkWidget *window; GtkWidget *menu; GtkWidget *middle; GtkWidget *vbox; GtkWidget *hbox; GtkAccelGroup *accel_group; char buf[1024]; int i; gboolean show=FALSE; sprintf(buf, "%s/.xbindkeysrc", getenv ("HOME")); for(i=1; i #include #include #include "middle.h" #include "menu.h" #include "version.h" void menu_open_file (GtkMenuItem *menuitem, gpointer user_data); void menu_open_default_file (GtkMenuItem *menuitem, gpointer user_data); gboolean menu_open_file_ok(GtkFileSelection *Sel); void menu_save_default_file (GtkMenuItem *menuitem, gpointer user_data); void menu_save_file (GtkMenuItem *menuitem, gpointer user_data); gboolean menu_save_file_ok(GtkFileSelection *Sel); void menu_append_file (GtkMenuItem *menuitem, gpointer user_data); gboolean menu_append_file_ok(GtkFileSelection *Sel); void menu_about (GtkMenuItem *menuitem, gpointer user_data); void menu_manual (GtkMenuItem *menuitem, gpointer user_data); void lockfilewindow(); void unlockfilewindow(); GtkWidget *OpenAs; GtkWidget *AppendAs; GtkWidget *SaveAs; GtkWidget *About; GtkWidget *Manual; GtkWidget * xbindkeys_config_menu(GtkAccelGroup *accel_group) { GtkWidget *Handle; GtkWidget *MenuBar; GtkItemFactory *item_factory; static GtkItemFactoryEntry menu_items[] = { {"/_File", NULL, 0, 0, ""}, {"/File/tearoff", NULL, 0, 0, ""}, {"/File/New file", "N", new_file, 0}, {"/File/Open default file", "O", menu_open_default_file, 0}, {"/File/Save to default file", "S", menu_save_default_file, 0}, {"/File/Nothing", NULL, 0, 0,""}, {"/File/Open as ...", "O", menu_open_file, 0}, {"/File/Append file ...", "A", menu_append_file, 0}, {"/File/Save as ...", "S", menu_save_file, 0}, {"/File/Nothing", NULL, 0, 0,""}, {"/File/Exit (no Saving)", "Q", main_exit, 0}, {"/_Edit", NULL, 0, 0, ""}, {"/Edit/tearoff", NULL, 0, 0, ""}, {"/Edit/Undo", "Z", undo, 0}, {"/Edit/Nothing", NULL, 0, 0,""}, {"/Edit/View generated rc file", NULL, view_generated_file, 0}, {"/Edit/Set to default rc file", NULL, set_default, 0}, /* {"/_SpeedConfig", NULL, 0, 0, ""}, {"/SpeedConfig/tearoff", NULL, 0, 0, ""}, {"/SpeedConfig/Quik Save", NULL, undo, 0}, {"/Edit/Nothing", NULL, 0, 0,""}, {"/Edit/View generated rc file", NULL, view_generated_file, 0}, {"/Edit/Set to default rc file", NULL, set_default, 0}, */ {"/_Help", NULL, 0, 0, ""}, {"/Help/tearoff", NULL, 0, 0, ""}, {"/Help/About ...", "A", menu_about, 0, ""}, {"/Help/Manual ...", "M", menu_manual, 0} }; Handle = gtk_handle_box_new(); item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "
", accel_group); gtk_item_factory_create_items ( item_factory, 21, menu_items, NULL); MenuBar = gtk_item_factory_get_widget( item_factory, "
"); button_undo_menu = gtk_item_factory_get_widget( item_factory, "/Edit/Undo"); OpenAs = gtk_item_factory_get_widget( item_factory, "/File/Open as ..."); AppendAs = gtk_item_factory_get_widget( item_factory, "/File/Append file ..."); SaveAs = gtk_item_factory_get_widget( item_factory, "/File/Save as ..."); About = gtk_item_factory_get_widget( item_factory, "/Help/About ..."); Manual = gtk_item_factory_get_widget( item_factory, "/Help/Manual ..."); gtk_container_add(GTK_CONTAINER(Handle), MenuBar ); return Handle; } void menu_open_file (GtkMenuItem *menuitem, gpointer user_data) { GtkFileSelection *FichierDgl; FichierDgl=(GtkFileSelection*) gtk_file_selection_new("Open xbindkeysrc file"); gtk_signal_connect_object(GTK_OBJECT(FichierDgl->ok_button), "clicked", (GtkSignalFunc)menu_open_file_ok, GTK_OBJECT(FichierDgl)); gtk_signal_connect_object(GTK_OBJECT(FichierDgl->ok_button), "clicked", (GtkSignalFunc)unlockfilewindow, NULL); gtk_signal_connect_object(GTK_OBJECT(FichierDgl->ok_button), "clicked", (GtkSignalFunc)gtk_widget_destroy, GTK_OBJECT(FichierDgl)); gtk_signal_connect_object(GTK_OBJECT(FichierDgl->cancel_button), "clicked", (GtkSignalFunc)unlockfilewindow, NULL); gtk_signal_connect_object(GTK_OBJECT(FichierDgl->cancel_button), "clicked", (GtkSignalFunc)gtk_widget_destroy, GTK_OBJECT(FichierDgl)); gtk_signal_connect(GTK_OBJECT(FichierDgl), "delete_event", (GtkSignalFunc)gtk_widget_destroy, NULL); gtk_signal_connect_object(GTK_OBJECT(FichierDgl), "delete_event", (GtkSignalFunc)unlockfilewindow, NULL); gtk_signal_connect(GTK_OBJECT(FichierDgl), "destroy", (GtkSignalFunc)gtk_widget_destroy, NULL); gtk_signal_connect_object(GTK_OBJECT(FichierDgl), "destroy", (GtkSignalFunc)unlockfilewindow, NULL); gtk_widget_show(GTK_WIDGET(FichierDgl)); lockfilewindow(); } gboolean menu_open_file_ok(GtkFileSelection *Sel) { gchar *nom; nom=gtk_file_selection_get_filename(Sel); read_file(nom); return TRUE; } void menu_open_default_file (GtkMenuItem *menuitem, gpointer user_data) { char buf[1024]; sprintf(buf, "%s/.xbindkeysrc", getenv ("HOME")); read_file(buf); } void menu_save_default_file (GtkMenuItem *menuitem, gpointer user_data) { char buf[1024]; sprintf(buf, "%s/.xbindkeysrc", getenv ("HOME")); save_file(buf); } void menu_save_file (GtkMenuItem *menuitem, gpointer user_data) { GtkFileSelection *FichierDgl; FichierDgl=(GtkFileSelection*) gtk_file_selection_new("Save xbindkeysrc file"); gtk_signal_connect_object(GTK_OBJECT(FichierDgl->ok_button), "clicked", (GtkSignalFunc)menu_save_file_ok, GTK_OBJECT(FichierDgl)); gtk_signal_connect_object(GTK_OBJECT(FichierDgl->ok_button), "clicked", (GtkSignalFunc)gtk_widget_destroy, GTK_OBJECT(FichierDgl)); gtk_signal_connect_object(GTK_OBJECT(FichierDgl->cancel_button), "clicked", (GtkSignalFunc)unlockfilewindow, NULL); gtk_signal_connect_object(GTK_OBJECT(FichierDgl->cancel_button), "clicked", (GtkSignalFunc)gtk_widget_destroy, GTK_OBJECT(FichierDgl)); gtk_signal_connect(GTK_OBJECT(FichierDgl), "delete_event", (GtkSignalFunc)gtk_widget_destroy, NULL); gtk_signal_connect_object(GTK_OBJECT(FichierDgl), "delete_event", (GtkSignalFunc)unlockfilewindow, NULL); gtk_signal_connect(GTK_OBJECT(FichierDgl), "destroy", (GtkSignalFunc)gtk_widget_destroy, NULL); gtk_signal_connect_object(GTK_OBJECT(FichierDgl), "destroy", (GtkSignalFunc)unlockfilewindow, NULL); gtk_widget_show(GTK_WIDGET(FichierDgl)); lockfilewindow(); } gboolean menu_save_file_ok(GtkFileSelection *Sel) { gchar *nom; nom=gtk_file_selection_get_filename(Sel); save_file(nom); return TRUE; } void menu_append_file (GtkMenuItem *menuitem, gpointer user_data) { GtkFileSelection *FichierDgl; FichierDgl=(GtkFileSelection*) gtk_file_selection_new("Append xbindkeysrc file"); gtk_signal_connect_object(GTK_OBJECT(FichierDgl->ok_button), "clicked", (GtkSignalFunc)menu_append_file_ok, GTK_OBJECT(FichierDgl)); gtk_signal_connect_object(GTK_OBJECT(FichierDgl->ok_button), "clicked", (GtkSignalFunc)gtk_widget_destroy, GTK_OBJECT(FichierDgl)); gtk_signal_connect_object(GTK_OBJECT(FichierDgl->cancel_button), "clicked", (GtkSignalFunc)unlockfilewindow, NULL); gtk_signal_connect_object(GTK_OBJECT(FichierDgl->cancel_button), "clicked", (GtkSignalFunc)gtk_widget_destroy, GTK_OBJECT(FichierDgl)); gtk_signal_connect(GTK_OBJECT(FichierDgl), "delete_event", (GtkSignalFunc)gtk_widget_destroy, NULL); gtk_signal_connect_object(GTK_OBJECT(FichierDgl), "delete_event", (GtkSignalFunc)unlockfilewindow, GTK_OBJECT(FichierDgl)); gtk_signal_connect(GTK_OBJECT(FichierDgl), "destroy", (GtkSignalFunc)gtk_widget_destroy, NULL); gtk_signal_connect_object(GTK_OBJECT(FichierDgl), "destroy", (GtkSignalFunc)unlockfilewindow, GTK_OBJECT(FichierDgl)); gtk_widget_show(GTK_WIDGET(FichierDgl)); lockfilewindow(); } gboolean menu_append_file_ok(GtkFileSelection *Sel) { gchar *nom; nom=gtk_file_selection_get_filename(Sel); append_file(nom); return TRUE; } void unlockabout() { gtk_widget_set_sensitive (GTK_WIDGET(About), TRUE); } void unlockmanual() { gtk_widget_set_sensitive (GTK_WIDGET(Manual), TRUE); } void menu_about (GtkMenuItem *menuitem, gpointer user_data) { GtkWidget *window; GtkWidget *text; window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_window_set_title(GTK_WINDOW(window), "About XBindKeys Config"); text = gtk_label_new("\n XBindKeys_Config \n\n"\ "ver : " XBINDKEYS_CONFIG_VERSION "\n\n"\ "by Laurent VUIBERT\n"\ " lapinator@gmx.fr\n\n"); gtk_signal_connect(GTK_OBJECT(window), "delete_event", (GtkSignalFunc)unlockabout, NULL); gtk_signal_connect_object(GTK_OBJECT(window), "delete_event", (GtkSignalFunc)gtk_widget_destroy, GTK_OBJECT(window)); gtk_signal_connect(GTK_OBJECT(window), "destroy", (GtkSignalFunc)unlockabout, NULL); gtk_signal_connect_object(GTK_OBJECT(window), "delete_event", (GtkSignalFunc)gtk_widget_destroy, GTK_OBJECT(window)); gtk_container_add(GTK_CONTAINER(window),text); gtk_widget_set_sensitive (GTK_WIDGET(About), FALSE); gtk_widget_show_all(window); } #define MANUAL_TEXT "To edit action, first append item and select them.\n\nTo get key use button \"Get Key\", don't write \nthe key (only for expert).\n\n\n FIX ME (HELP ME)\n\n\n" void menu_manual (GtkMenuItem *menuitem, gpointer user_data) { GtkWidget *window; GtkWidget *text; GtkWidget *vbox; window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_window_set_title(GTK_WINDOW(window), "Manual of xbindkeys Config"); vbox = gtk_vbox_new (FALSE,0); text = gtk_label_new("\nManual\n"); gtk_box_pack_start(GTK_BOX(vbox), text, FALSE, FALSE, 0); text = gtk_text_new(NULL,NULL); gtk_text_insert (GTK_TEXT(text), NULL, NULL, NULL, MANUAL_TEXT, sizeof(MANUAL_TEXT)-1); gtk_box_pack_start(GTK_BOX(vbox), text, TRUE, TRUE, 0); gtk_widget_set_usize(text,300,250); gtk_signal_connect(GTK_OBJECT(window), "delete_event", (GtkSignalFunc)unlockmanual, NULL); gtk_signal_connect_object(GTK_OBJECT(window), "delete_event", (GtkSignalFunc)gtk_widget_destroy, GTK_OBJECT(window)); gtk_signal_connect(GTK_OBJECT(window), "destroy", (GtkSignalFunc)unlockmanual, NULL); gtk_signal_connect_object(GTK_OBJECT(window), "delete_event", (GtkSignalFunc)gtk_widget_destroy, GTK_OBJECT(window)); /*gtk_label_set_justify (GTK_LABEL(text), GTK_JUSTIFY_LEFT);*/ gtk_container_add(GTK_CONTAINER(window),vbox); gtk_widget_set_sensitive (GTK_WIDGET(Manual), FALSE); gtk_widget_show_all(window); } void lockfilewindow() { gtk_widget_set_sensitive (GTK_WIDGET(OpenAs), FALSE); gtk_widget_set_sensitive (GTK_WIDGET(AppendAs), FALSE); gtk_widget_set_sensitive (GTK_WIDGET(SaveAs), FALSE); } void unlockfilewindow() { gtk_widget_set_sensitive (GTK_WIDGET(OpenAs), TRUE); gtk_widget_set_sensitive (GTK_WIDGET(AppendAs), TRUE); gtk_widget_set_sensitive (GTK_WIDGET(SaveAs), TRUE); } xbindkeys_config-0.1.3/menu.h0100644000175000001440000000214007422357440016072 0ustar lapinatorusers/*************************************************************************** xbindkeys_config : config programme for xbindkey. ------------------- begin : Sat jan 5 14:11:34 CEST 2002 copyright : (C) 2002 by Laurent VUIBERT email : lapinator@gmx.fr ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include GtkWidget * xbindkeys_config_menu(GtkAccelGroup *accel_group); xbindkeys_config-0.1.3/AUTHORS0100644000175000001440000000004407422311446016022 0ustar lapinatorusersLaurent Vuibert xbindkeys_config-0.1.3/ChangeLog0100644000175000001440000000114007670641307016531 0ustar lapinatorusersxbindkeys_config changelog by Laurent Vuibert version: 0.1.3: Fix: Crash bug when delete all entry. Fix: Build-error with gcc-3.3 (thank to Joerg Jaspert for the patch). Add: make unistall 0.1.2: Add: Update to xbindkey 1.5.5 Add: Speed_config (for change config quikly) 0.1.1: Add: Fix Crash Bugs 0.1.0: Add: upgrate to xbindkey 1.4.0 0.0.3: Add: Undo button Add: Command line options Add: "View genrated rc" button Add: Warning Area Add: Drag & drop Add: accel button 0.0.2: Add: read .xbindkeysrc file Add: write .xbindkeysrc file Add: grab keys: xbindkeys_config-0.1.3/version.h0100644000175000001440000000031607670634704016624 0ustar lapinatorusers/* set the current version of xbindkeys_config */ #define XBINDKEYS_CONFIG_VERSION "0.1.3" /* Set the pat tu xbinkeys program */ #define XBINDKEYS_PATCH "xbindkeys" /* Change this only for debbuging */ xbindkeys_config-0.1.3/COPYING0100644000175000001440000004324107417626603016023 0ustar lapinatorusers GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.