[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: g_funcs.c
User: pcjc2
Date: 07/02/24 12:14:36
Modified: . Tag: noscreen g_funcs.c g_keys.c g_register.c
gschem.c x_basic.c x_dialog.c x_event.c x_window.c
Log:
Sync with trunk
Revision Changes Path
No revision
No revision
1.19.6.3 +0 -66 eda/geda/gaf/gschem/src/g_funcs.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_funcs.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/g_funcs.c,v
retrieving revision 1.19.6.2
retrieving revision 1.19.6.3
diff -u -b -r1.19.6.2 -r1.19.6.3
--- g_funcs.c 23 Feb 2007 23:32:12 -0000 1.19.6.2
+++ g_funcs.c 24 Feb 2007 17:14:34 -0000 1.19.6.3
@@ -236,72 +236,6 @@
return SCM_BOOL_T;
}
-/*! \brief */
-static gchar *key_value_string = NULL;
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- * \bug there is no string size checking here... so if it core dumps... DOH!
- * it's actually pretty usable right now, but needs to be reviewed again
- */
-SCM g_funcs_key_name(SCM keystring)
-{
- SCM_ASSERT (SCM_STRINGP (keystring), keystring, 1, "gschem-key-name");
-
- if (key_value_string != NULL) {
- x_dialog_hotkeys_fill (key_value_string);
- g_free (key_value_string);
- key_value_string = NULL;
- }
-
- /* the 25 is for a few spaces and the characters */
- key_value_string = g_strdup_printf ("%s :%25c",
- SCM_STRING_CHARS (keystring), ' ');
-
- return SCM_BOOL_T;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-SCM g_funcs_key_value(SCM keystring)
-{
- gchar *temp;
-
- SCM_ASSERT (SCM_STRINGP (keystring), keystring, 1, "gschem-key-value");
-
- if (key_value_string == NULL) {
- fprintf(stderr, _("Ack! something got fouled up with the keymappings!\n"));
- exit(-1);
- }
-
- temp = g_strdup_printf ("%s %s",
- key_value_string,
- SCM_STRING_CHARS (keystring));
- g_free (key_value_string);
- key_value_string = temp;
-
- return SCM_BOOL_T;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-SCM g_funcs_key_done(void)
-{
- x_dialog_hotkeys_fill (key_value_string);
- g_free(key_value_string);
- key_value_string = NULL;
- return SCM_BOOL_T;
-}
-
-
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
1.4.6.2 +45 -11 eda/geda/gaf/gschem/src/g_keys.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_keys.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/g_keys.c,v
retrieving revision 1.4.6.1
retrieving revision 1.4.6.2
diff -u -b -r1.4.6.1 -r1.4.6.2
--- g_keys.c 23 Feb 2007 23:32:12 -0000 1.4.6.1
+++ g_keys.c 24 Feb 2007 17:14:34 -0000 1.4.6.2
@@ -45,17 +45,6 @@
* \par Function Description
*
*/
-void set_window_current_key(TOPLEVEL *w_current)
-{
- /*window_current = w_current;*/
- /* this function is now a nop, remove it */
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
/* for now this only supports single chars, not shift/alt/ctrl etc... */
int g_keys_execute(int state, int keyval)
{
@@ -108,6 +97,51 @@
return (SCM_FALSEP (scm_retval)) ? 0 : 1;
}
+/*! \brief Exports the keymap in scheme to a GLib GArray.
+ * \par Function Description
+ * This function converts the list of key sequence/action pairs
+ * returned by the scheme function \c dump-current-keymap into an
+ * array of C structures.
+ *
+ * The returned value must be freed by caller.
+ *
+ * \return A GArray with keymap data.
+ */
+GArray*
+g_keys_dump_keymap (void)
+{
+ SCM dump_proc = scm_c_lookup ("dump-current-keymap");
+ SCM scm_ret;
+ GArray *ret = NULL;
+ struct keyseq_action_t {
+ gchar *keyseq, *action;
+ };
+
+ dump_proc = scm_variable_ref (dump_proc);
+ g_return_val_if_fail (SCM_NFALSEP (scm_procedure_p (dump_proc)), NULL);
+
+ scm_ret = scm_call_0 (dump_proc);
+ g_return_val_if_fail (SCM_CONSP (scm_ret), NULL);
+
+ ret = g_array_sized_new (FALSE,
+ FALSE,
+ sizeof (struct keyseq_action_t),
+ (guint)scm_ilength (scm_ret));
+ for (; scm_ret != SCM_EOL; scm_ret = SCM_CDR (scm_ret)) {
+ SCM scm_keymap_entry = SCM_CAR (scm_ret);
+ struct keyseq_action_t keymap_entry;
+
+ g_return_val_if_fail (SCM_CONSP (scm_keymap_entry) &&
+ SCM_SYMBOLP (SCM_CAR (scm_keymap_entry)) &&
+ SCM_STRINGP (SCM_CDR (scm_keymap_entry)), ret);
+ keymap_entry.action = g_strdup (SCM_SYMBOL_CHARS (SCM_CAR (scm_keymap_entry)));
+ keymap_entry.keyseq = g_strdup (SCM_STRING_CHARS (SCM_CDR (scm_keymap_entry)));
+ ret = g_array_append_val (ret, keymap_entry);
+ }
+
+ return ret;
+}
+
/*! \brief
*
*/
1.49.2.3 +0 -3 eda/geda/gaf/gschem/src/g_register.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_register.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/g_register.c,v
retrieving revision 1.49.2.2
retrieving revision 1.49.2.3
diff -u -b -r1.49.2.2 -r1.49.2.3
--- g_register.c 23 Feb 2007 23:32:12 -0000 1.49.2.2
+++ g_register.c 24 Feb 2007 17:14:34 -0000 1.49.2.3
@@ -160,9 +160,6 @@
{ "gschem-print", 1, 0, 0, g_funcs_print },
{ "gschem-postscript", 1, 0, 0, g_funcs_postscript },
{ "gschem-image", 1, 0, 0, g_funcs_image },
- { "gschem-key-name", 1, 0, 0, g_funcs_key_name },
- { "gschem-key-value", 1, 0, 0, g_funcs_key_value },
- { "gschem-key-done", 0, 0, 0, g_funcs_key_done },
{ "gschem-use-rc-values", 0, 0, 0, g_funcs_use_rc_values },
{ "gschem-exit", 0, 0, 0, g_funcs_exit },
{ "gschem-log", 1, 0, 0, g_funcs_log },
1.39.6.1 +0 -4 eda/geda/gaf/gschem/src/gschem.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: gschem.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/gschem.c,v
retrieving revision 1.39
retrieving revision 1.39.6.1
diff -u -b -r1.39 -r1.39.6.1
--- gschem.c 18 Oct 2006 19:01:29 -0000 1.39
+++ gschem.c 24 Feb 2007 17:14:34 -0000 1.39.6.1
@@ -59,7 +59,6 @@
s_attrib_free();
s_papersizes_free();
x_stroke_free_all();
- x_dialog_hotkeys_free_all();
s_color_destroy_all();
o_undo_cleanup();
/* s_stroke_free(); no longer needed */
@@ -207,9 +206,6 @@
x_window_setup (w_current);
- /* so we can call key funcs from guile */
- set_window_current_key(w_current);
-
/* o_text_init(); goes away */
/* o_text_init(); Moved inside libgeda_init() */
1.14.6.1 +0 -86 eda/geda/gaf/gschem/src/x_basic.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_basic.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_basic.c,v
retrieving revision 1.14
retrieving revision 1.14.6.1
diff -u -b -r1.14 -r1.14.6.1
--- x_basic.c 14 Jul 2006 02:23:55 -0000 1.14
+++ x_basic.c 24 Feb 2007 17:14:34 -0000 1.14.6.1
@@ -241,92 +241,6 @@
w_current->DONT_RESIZE = 0;
}
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-GtkWidget *x_create_dialog_box(GtkWidget **out_vbox,
- GtkWidget **out_action_area)
-{
- GtkWidget *separator;
- GtkWidget *vbox;
- GtkWidget *action_area;
- GtkWidget *dialog;
-
- if (!out_vbox)
- return(NULL);
-
- if (!out_action_area)
- return(NULL);
-
- dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (dialog), vbox);
- gtk_widget_show (vbox);
-
- action_area = gtk_hbox_new (TRUE, 5);
- gtk_container_set_border_width (GTK_CONTAINER (action_area), 10);
- gtk_box_pack_end (GTK_BOX (vbox), action_area, FALSE, TRUE, 0);
- gtk_widget_show (action_area);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_end (GTK_BOX (vbox), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
- *out_vbox = vbox;
- *out_action_area = action_area;
-
- return(dialog);
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- * \note
- * not used
- */
-GtkWidget *x_create_dialog_box_horiz(GtkWidget **out_hbox,
- GtkWidget **out_action_area)
-{
- GtkWidget *separator;
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *action_area;
- GtkWidget *dialog;
-
- if (!out_hbox)
- return(NULL);
-
- if (!out_action_area)
- return(NULL);
-
- dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (dialog), vbox);
- gtk_widget_show (vbox);
-
- hbox = gtk_hbox_new (FALSE, 5);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
- gtk_widget_show (hbox);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_end (GTK_BOX (vbox), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
- action_area = gtk_hbox_new (FALSE, 5);
- gtk_container_set_border_width (GTK_CONTAINER (action_area), 10);
- gtk_box_pack_end (GTK_BOX (vbox), action_area, FALSE, FALSE, 0);
- gtk_widget_show (action_area);
-
- *out_hbox = hbox;
- *out_action_area = action_area;
-
- return(dialog);
-}
/*! \todo Finish function documentation!!!
* \brief
1.68.2.5 +33 -155 eda/geda/gaf/gschem/src/x_dialog.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_dialog.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_dialog.c,v
retrieving revision 1.68.2.4
retrieving revision 1.68.2.5
diff -u -b -r1.68.2.4 -r1.68.2.5
--- x_dialog.c 12 Feb 2007 02:20:24 -0000 1.68.2.4
+++ x_dialog.c 24 Feb 2007 17:14:34 -0000 1.68.2.5
@@ -85,6 +85,11 @@
*window = NULL;
}
+/* TODO: This string is used by the dialogs: show_text, find_text and hide_text
+ * I think it should be removed. (Werner Hoch)
+ */
+char generic_textstring[256] = "refdes=R";
+
/***************** Start of Text Input dialog box *********************/
/*! \brief worker function for the text entry dialog
@@ -2372,63 +2377,6 @@
/***************** Start of help/keymapping dialog box **************/
-static GList *hotkeys = NULL;
-
-typedef struct _HOTKEY ST_HOTKEY;
-
-struct _HOTKEY {
- gchar *name;
- gchar *value;
-};
-
-
-/*! \brief Clear the hotkey list of the hotkeys dialog
- * \par Function Description
- * This function free's all elements allocated by the hotkey dialog
- */
-void x_dialog_hotkeys_free_all(void)
-{
- GList *item;
- ST_HOTKEY *hotkey;
-
- for (item = hotkeys; item != NULL; item = g_list_next(item)) {
- hotkey = item->data;
- g_free(hotkey->name);
- g_free(hotkey->value);
- g_free(hotkey);
- }
- g_list_free(hotkeys);
- hotkeys = NULL;
-}
-
-/*! \brief Insert a hotkey string into the dialog hotkey list
- * \par Function Description
- * This function splits the given hotkey string and adds it to the hotkey
- * list.
- * \todo Change the function and its callers to f(char *name, char *value).
- */
-void x_dialog_hotkeys_fill(char *string)
-{
- ST_HOTKEY *hotkey;
- gchar **token;
-
- hotkey = g_new(ST_HOTKEY, 1);
- token = g_strsplit(string, ":", 2);
-
- if (token[0] != NULL) {
- hotkey->name = g_strdup(token[0]);
- if (token[1] != NULL) {
- g_strstrip(token[1]);
- hotkey->value = g_strdup(token[1]);
- hotkeys = g_list_append(hotkeys, hotkey);
- }
- else {
- g_free(hotkey->name);
- }
- }
- g_strfreev(token);
-}
-
/*! \brief Response function for the hotkey dialog
* \par Function Description
* This function destroys the hotkey dialog and does some cleanup.
@@ -2459,11 +2407,13 @@
GtkWidget *vbox, *scrolled_win;
GtkListStore *store;
GtkWidget *treeview;
- GtkTreeIter iter;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
- ST_HOTKEY *hotkey;
- GList *item;
+ GArray *keymap;
+ gint i;
+ struct keyseq_action_t {
+ gchar *keyseq, *action;
+ };
if (!w_current->hkwindow) {
w_current->hkwindow = gtk_dialog_new_with_buttons(_("Hotkeys"),
@@ -2498,15 +2448,31 @@
/* the model */
store = gtk_list_store_new (2,G_TYPE_STRING, G_TYPE_STRING);
- for (item=hotkeys; item != NULL; item =g_list_next(item)) {
- hotkey = item->data;
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- 0, hotkey->name,
- 1, hotkey->value,
+
+ /* retrieve current keymap */
+ keymap = g_keys_dump_keymap ();
+ /* add each keymap entry to the list store of the dialog */
+ for (i = 0; i < keymap->len; i++) {
+ GtkTreeIter iter;
+ struct keyseq_action_t *keymap_entry;
+
+ keymap_entry = &g_array_index (keymap, struct keyseq_action_t, i);
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ 0, keymap_entry->action,
+ 1, keymap_entry->keyseq,
-1);
}
+ /* finally free the array for keymap */
+ for (i = 0; i < keymap->len; i++) {
+ struct keyseq_action_t *keymap_entry;
+ keymap_entry = &g_array_index (keymap, struct keyseq_action_t, i);
+ g_free (keymap_entry->keyseq);
+ g_free (keymap_entry->action);
+ }
+ g_array_free (keymap, TRUE);
+
/* the tree view */
treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
gtk_container_add(GTK_CONTAINER(scrolled_win), treeview);
@@ -2792,94 +2758,6 @@
/***************** End of generic file select dialog box *****************/
-/*********** Start of generic text input dialog box *******/
-char generic_textstring[256] = "refdes=R";
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void generic_text_input_ok(GtkWidget * w, TOPLEVEL * w_current)
-{
- char *string = NULL;
-
- string = (char *) gtk_entry_get_text(GTK_ENTRY(w_current->tsentry));
- strncpy(generic_textstring, string, 256);
-
- gtk_grab_remove(w_current->tswindow);
- gtk_widget_destroy(w_current->tswindow);
- w_current->tswindow = NULL;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void generic_text_input_dialog(TOPLEVEL * w_current)
-{
- int len;
- GtkWidget *label = NULL;
- GtkWidget *buttonok = NULL;
- GtkWidget *vbox, *action_area;
-
- if (!w_current->tswindow) {
- w_current->tswindow = x_create_dialog_box(&vbox, &action_area);
-
- gtk_window_position(GTK_WINDOW(w_current->tswindow),
- GTK_WIN_POS_MOUSE);
-
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow),
- "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->tswindow);
-
-
-#if 0 /* removed because it was causing the dialog box to not close */
- gtk_signal_connect(GTK_OBJECT(w_current->tswindow),
- "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->tswindow);
-#endif
-
- gtk_window_set_title(GTK_WINDOW(w_current->tswindow),
- _("Generic String"));
- gtk_container_border_width(GTK_CONTAINER(w_current->tswindow), 10);
-
- label = gtk_label_new(_("Enter new string."));
- gtk_misc_set_padding(GTK_MISC(label), 20, 20);
- gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
- gtk_widget_show(label);
-
- w_current->tsentry = gtk_entry_new_with_max_length(20);
- gtk_editable_select_region(GTK_EDITABLE(w_current->tsentry), 0, -1);
- gtk_box_pack_start(GTK_BOX(vbox), w_current->tsentry, FALSE, FALSE, 5);
- gtk_signal_connect(GTK_OBJECT(w_current->tsentry), "activate",
- GTK_SIGNAL_FUNC(generic_text_input_ok), w_current);
- gtk_widget_show(w_current->tsentry);
- gtk_widget_grab_focus(w_current->tsentry);
-
- buttonok = gtk_button_new_from_stock (GTK_STOCK_OK);
- GTK_WIDGET_SET_FLAGS(buttonok, GTK_CAN_DEFAULT);
- gtk_box_pack_start(GTK_BOX(action_area), buttonok, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT(buttonok), "clicked",
- GTK_SIGNAL_FUNC(generic_text_input_ok), w_current);
- gtk_widget_show(buttonok);
- gtk_widget_grab_default(buttonok);
- }
-
- if (!GTK_WIDGET_VISIBLE(w_current->tswindow)) {
- len = strlen(generic_textstring);
- gtk_entry_set_text(GTK_ENTRY(w_current->tsentry), generic_textstring);
- gtk_entry_select_region(GTK_ENTRY(w_current->tsentry), 0, len);
- gtk_widget_show(w_current->tswindow);
- gtk_grab_add(w_current->tswindow);
- }
-}
-
-/*********** End of generic text input dialog box *******/
-
/*********** Start of find text dialog box *******/
int start_find;
1.41.6.6 +0 -2 eda/geda/gaf/gschem/src/x_event.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_event.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_event.c,v
retrieving revision 1.41.6.5
retrieving revision 1.41.6.6
diff -u -b -r1.41.6.5 -r1.41.6.6
--- x_event.c 12 Feb 2007 01:53:32 -0000 1.41.6.5
+++ x_event.c 24 Feb 2007 17:14:34 -0000 1.41.6.6
@@ -1497,8 +1497,6 @@
exit_if_null(w_current);
global_window_current = w_current;
- set_window_current_key(w_current);
-
if (event) {
#if DEBUG
printf("x_event_key_pressed: Pressed key %i.\n", event->keyval);
1.50.2.1 +0 -26 eda/geda/gaf/gschem/src/x_window.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_window.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_window.c,v
retrieving revision 1.50
retrieving revision 1.50.2.1
diff -u -b -r1.50 -r1.50.2.1
--- x_window.c 19 Nov 2006 18:08:43 -0000 1.50
+++ x_window.c 24 Feb 2007 17:14:34 -0000 1.50.2.1
@@ -884,32 +884,6 @@
}
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- *
- * \todo GROSS! but this is required because clist widgets don't seem to
- * allow you pass data to callback functions, so I need to get w_current
- * by searching the entire window list for page_clist widget :( If
- * somebody knows a better way of doing this, please let me know!
- */
-TOPLEVEL *x_window_search_page_clist(GtkWidget *findme)
-{
- TOPLEVEL *w_current;
-
- /* find the toplevel head */
- for (w_current = global_window_current;
- w_current->prev != NULL;
- w_current = w_current->prev);
- /* now examine page_clist of each toplevel */
- for (;
- w_current != NULL && w_current->page_clist != findme;
- w_current = w_current->next);
-
- return w_current;
-}
-
/*! \brief Opens a new untitled page.
* \par Function Description
* This function creates an empty, untitled page in <B>toplevel</B>.
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs