From 24bc44ad0c17a7b9104de125680d7934e9b0241a Mon Sep 17 00:00:00 2001
From: stefan schippers
Date: Tue, 3 Oct 2023 13:21:04 +0200
Subject: [PATCH] doc updates (text attributes), prepare improvements for
new_prop_string()
---
doc/xschem_man/developer_info.html | 6 ++++--
doc/xschem_man/xschem_elements.html | 3 ++-
src/token.c | 8 ++++----
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html
index a1b8d5d1..114222f1 100644
--- a/doc/xschem_man/developer_info.html
+++ b/doc/xschem_man/developer_info.html
@@ -261,7 +261,7 @@ device="tantalium capacitor"
are perfectly equivalent.
- TEXT OBJECT
+ TEXT OBJECT
Example: T {3 of 4 NANDS of a 74ls00} 500 -580 0 0 0.4 0.4 {font=Monospace layer=4}
This line defines a text object, the first field after the type tag is the displayed text,
@@ -277,7 +277,7 @@ device="tantalium capacitor"
with respect to its anchor point.
text X and Y sizes are stored as floating point numbers.
- Finally a property string is stored with the same syntax as the displayed text field.
+ Finally a property string is available to attach attributes to the text object.
Currently the following attributes are predefined for text objects:
- font Name of font to be used (ex: font=Arial)
@@ -286,6 +286,8 @@ device="tantalium capacitor"
- vcenter If set to true vertical center text
- weight If set to bold use bold style
- slant If set to italic or oblique use that style for text
+ - hide If set to true text will be hidden unless View->Show hidden texts
+ is enabled
diff --git a/doc/xschem_man/xschem_elements.html b/doc/xschem_man/xschem_elements.html
index 46fa8361..1b027ff4 100644
--- a/doc/xschem_man/xschem_elements.html
+++ b/doc/xschem_man/xschem_elements.html
@@ -98,7 +98,8 @@ p{padding: 15px 30px 10px;}
the 2 attributes may be set both to get full centered text box.
A weight=bold attribute may be given for bold text, while a slant=italic or
slant=oblique may specify italic or slanted text.
- A hide=true will make the specified text invisible when the symbol is displayed as a component in a schematic.
+ A hide=true will make the specified text invisible unless the View->Show hidden texts
+ option is enabled.
diff --git a/src/token.c b/src/token.c
index eaf2de08..9ff8be34 100644
--- a/src/token.c
+++ b/src/token.c
@@ -678,8 +678,8 @@ void hash_names(int inst, int action)
if(upinst) my_free(_ALLOC_ID_, &upinst);
}
-/* return -1 if name is not used, else return instance number with same name found */
-static int name_is_used(char *name)
+/* return -1 if name is not used, else return first instance number with same name found */
+static int name_is_used(char *name, int q)
{
int mult, used = -1;
char *upinst = NULL;
@@ -732,7 +732,7 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names)
}
/* don't change old_prop if name does not conflict. */
/* if no hash_names() is done and inst_table uninitialized --> use old_prop */
- is_used = name_is_used(old_name);
+ is_used = name_is_used(old_name, -1);
if(dis_uniq_names || is_used == -1 || is_used == i) {
my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, old_prop);
my_free(_ALLOC_ID_, &old_name);
@@ -752,7 +752,7 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names)
} else { /* goes here if weird name set for example to name=[3:0] or name=12 */
my_snprintf(new_name, old_name_len + 40, "%d%s", q, brkt);
}
- is_used = name_is_used(new_name);
+ is_used = name_is_used(new_name, q);
if(is_used == -1 ) break;
}
my_free(_ALLOC_ID_, &old_name_base);