[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: g_rc.nw
User: ahvezda
Date: 06/05/20 15:02:31
Modified: . g_rc.nw g_register.nw i_vars.nw o_complex_basic.nw
s_toplevel.nw
Log:
Added code to support arbitrary attribute promotion
Revision Changes Path
1.17 +27 -1 eda/geda/devel/libgeda/noweb/g_rc.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_rc.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/libgeda/noweb/g_rc.nw,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- g_rc.nw 18 May 2006 02:13:06 -0000 1.16
+++ g_rc.nw 20 May 2006 19:02:31 -0000 1.17
@@ -39,6 +39,8 @@
<<g_rc.c : g_rc_map_font_character_to_file()>>
+<<g_rc.c : g_rc_always_promote_attributes()>>
+
@
@@ -934,7 +936,7 @@
}
-@ %def g_rc_postscript_prolog
+@ %def g_rc_bus_ripper_symname
/* ----------------------------------------------------------- */
@section Function @code{g_rc_postscript_prolog()}
@@ -1051,3 +1053,27 @@
@ %def g_rc_map_font_character_to_file
+
+/* ----------------------------------------------------------- */
+@section Function @code{g_rc_always_promote_attributes()}
+
+@defun g_rc_always_promote_attributes string
+@end defun
+
+<<g_rc.c : g_rc_always_promote_attributes()>>=
+SCM
+g_rc_always_promote_attributes(SCM scmsymname)
+{
+ SCM_ASSERT (SCM_NIMP (scmsymname) && SCM_STRINGP (scmsymname), scmsymname,
+ SCM_ARG1, "always-promote-attributes");
+
+ if (default_always_promote_attributes) {
+ free (default_always_promote_attributes);
+ }
+ default_always_promote_attributes = g_strdup (SCM_STRING_CHARS (scmsymname));
+
+ return SCM_BOOL_T;
+}
+
+
+@ %def g_rc_always_promote_attributes
1.6 +1 -0 eda/geda/devel/libgeda/noweb/g_register.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_register.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/libgeda/noweb/g_register.nw,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- g_register.nw 18 May 2006 02:13:06 -0000 1.5
+++ g_register.nw 20 May 2006 19:02:31 -0000 1.6
@@ -102,6 +102,7 @@
{ "bus-ripper-symname", 1, 0, 0, g_rc_bus_ripper_symname },
{ "postscript-prolog", 1, 0, 0, g_rc_postscript_prolog },
{ "map-font-character-to-file", 2, 0, 0, g_rc_map_font_character_to_file },
+ { "always-promote-attributes",1, 0, 0, g_rc_always_promote_attributes },
{ NULL, 0, 0, 0, NULL } };
@ %def libgeda_funcs
1.6 +7 -1 eda/geda/devel/libgeda/noweb/i_vars.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: i_vars.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/libgeda/noweb/i_vars.nw,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- i_vars.nw 18 May 2006 02:13:06 -0000 1.5
+++ i_vars.nw 20 May 2006 19:02:31 -0000 1.6
@@ -86,8 +86,9 @@
#define DEFAULT_BITMAP_DIRECTORY "../lib/bitmaps"
#define DEFAULT_BUS_RIPPER_SYMNAME "busripper-1.sym"
#define DEFAULT_POSTSCRIPT_PROLOG "prolog.ps"
+#define DEFAULT_ALWAYS_PROMOTE_ATTRIBUTES ""
-@ %def INIT_STR DEFAULT_SERIES_NAME DEFAULT_UNTITLED_NAME DEFAULT_SCHEME_DIRECTORY DEFAULT_FONT_DIRECTORY DEFAULT_BITMAP_DIRECTORY DEFAULT_POSTSCRIPT_PROLOG
+@ %def INIT_STR DEFAULT_SERIES_NAME DEFAULT_UNTITLED_NAME DEFAULT_SCHEME_DIRECTORY DEFAULT_FONT_DIRECTORY DEFAULT_BITMAP_DIRECTORY DEFAULT_POSTSCRIPT_PROLOG DEFAULT_ALWAYS_PROMOTE_ATTRIBUTES
@@ -101,6 +102,7 @@
char *default_bitmap_directory = NULL;
char *default_bus_ripper_symname = NULL;
char *default_postscript_prolog = NULL;
+char *default_always_promote_attributes = NULL;
@ %def default_init_right default_init_bottom
@@ -127,6 +129,8 @@
INIT_STR(w_current, bitmap_directory, DEFAULT_BITMAP_DIRECTORY);
INIT_STR(w_current, bus_ripper_symname, DEFAULT_BUS_RIPPER_SYMNAME);
INIT_STR(w_current, postscript_prolog, DEFAULT_POSTSCRIPT_PROLOG);
+ INIT_STR(w_current, always_promote_attributes, DEFAULT_ALWAYS_PROMOTE_ATTRIBUTES);
+
}
@ %def i_vars_libgeda_set
@@ -147,6 +151,7 @@
w_current->scheme_directory = g_strdup (DEFAULT_SCHEME_DIRECTORY);
w_current->bitmap_directory = g_strdup (DEFAULT_BITMAP_DIRECTORY);
w_current->bus_ripper_symname = g_strdup (DEFAULT_BUS_RIPPER_SYMNAME);
+ w_current->always_promote_attributes = g_strdup (DEFAULT_ALWAYS_PROMOTE_ATTRIBUTES);
}
@ %def i_vars_setnames
@@ -168,6 +173,7 @@
free(default_bitmap_directory);
free(default_bus_ripper_symname);
free(default_postscript_prolog);
+ free(default_always_promote_attributes);
}
1.27 +27 -8 eda/geda/devel/libgeda/noweb/o_complex_basic.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_complex_basic.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/libgeda/noweb/o_complex_basic.nw,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- o_complex_basic.nw 22 Apr 2006 20:34:02 -0000 1.26
+++ o_complex_basic.nw 20 May 2006 19:02:31 -0000 1.27
@@ -409,43 +409,61 @@
@section Function @code{o_complex_is_eligible_attribute()}
-@defun o_complex_is_eligible_attribute object promote_invisible
+@defun o_complex_is_eligible_attribute toplevel object promote_invisible
@end defun
<<o_complex_basic.c : o_complex_is_eligible_attribute()>>=
/* The promote_invisible flag is either TRUE or FALSE */
/* It controls if invisible text is promoted (TRUE) or not (FALSE) */
int
-o_complex_is_eligible_attribute (OBJECT *object, int promote_invisible)
+o_complex_is_eligible_attribute (TOPLEVEL *w_current, OBJECT *object,
+ int promote_invisible)
{
+ char *name = NULL;
+ char *value = NULL;
char *ptr;
if (object->type != OBJ_TEXT || object->attribute || object->attached_to)
{
- return 0; /* not a text item or is already attached */
+ return FALSE; /* not a text item or is already attached */
}
/* Make sure text item is an attribute */
ptr = strchr(object->text->string, '=');
if (!ptr || ptr[1] == '\0' || ptr[1] == ' ')
{
- return 0; /* not an attribute */
+ return FALSE; /* not an attribute */
}
/* always promote symversion= attribute, even if it is invisible */
if (strncmp(object->text->string, "symversion=", 11) == 0)
{
- return 1;
+ return TRUE;
+ }
+
+ /* check list against attributes which can be promoted */
+ if (w_current->always_promote_attributes &&
+ (strlen(w_current->always_promote_attributes) != 0))
+ {
+ if (o_attrib_get_name_value(object->text->string, &name, &value))
+ {
+ if (strstr(w_current->always_promote_attributes, name))
+ {
+ /* Yes the name of the attribute was in the always promote */
+ /* attributes list */
+ return TRUE;
+ }
+ }
}
/* object is invisible and we do not want to promote invisible text */
if (object->visibility == INVISIBLE && promote_invisible == FALSE)
{
- return 0; /* attribute not eligible for promotion */
+ return FALSE; /* attribute not eligible for promotion */
}
/* yup, attribute can be promoted */
- return 1;
+ return TRUE;
}
@ %def o_complex_is_eligible_attribute
@@ -658,7 +676,8 @@
next=tmp->next;
/* valid floating attrib? */
- if (o_complex_is_eligible_attribute(tmp, w_current->promote_invisible))
+ if (o_complex_is_eligible_attribute(w_current, tmp,
+ w_current->promote_invisible))
{
/* Is attribute promotion called for? (passed in parameter) */
if (attribute_promotion)
1.7 +5 -1 eda/geda/devel/libgeda/noweb/s_toplevel.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: s_toplevel.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/libgeda/noweb/s_toplevel.nw,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- s_toplevel.nw 28 Oct 2005 22:26:33 -0000 1.6
+++ s_toplevel.nw 20 May 2006 19:02:31 -0000 1.7
@@ -447,6 +447,10 @@
toplevel->add_attribute_offset = 50;
+ toplevel->drag_can_move = TRUE;
+
+ toplevel->always_promote_attributes = NULL;
+
toplevel->net_naming_priority = 0;
toplevel->hierarchy_traversal = 0;
toplevel->hierarchy_uref_mangle = 0;