• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

作図ソフト dia の改良版


Commit MetaInfo

Revision5b764705d89ff165f9d2eed22cfe0c55b740947e (tree)
Time2002-05-19 08:39:18
AuthorLars Clausen <lclausen@src....>
CommiterLars Clausen

Log Message

Text size change.

Change Summary

Incremental Difference

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
1+2002-05-18 Lars Clausen <lrclause@cs.uiuc.edu>
2+
3+ * objects/ER/entity.c:
4+ * objects/ER/attribute.c:
5+ * objects/ER/relationship.c: Patch to allow text size change from
6+ Celso Tetsuo Nagase Suzuki.
7+
18 2002-05-18 Steffen Macke <sdteffen@web.de>
29
310 * app/app_procs.c: #ifdef'd xmlerror.h (comes with
--- a/objects/ER/attribute.c
+++ b/objects/ER/attribute.c
@@ -66,6 +66,7 @@ struct _Attribute {
6666 Element element;
6767
6868 DiaFont *font;
69+ real font_height;
6970 utfchar *name;
7071 real name_width;
7172
@@ -158,6 +159,7 @@ static PropDescription attribute_props[] = {
158159 PROP_STD_LINE_COLOUR,
159160 PROP_STD_FILL_COLOUR,
160161 PROP_STD_TEXT_FONT,
162+ PROP_STD_TEXT_HEIGHT,
161163 PROP_DESC_END
162164 };
163165
@@ -180,6 +182,7 @@ static PropOffset attribute_offsets[] = {
180182 { "line_colour", PROP_TYPE_COLOUR, offsetof(Attribute, border_color) },
181183 { "fill_colour", PROP_TYPE_COLOUR, offsetof(Attribute, inner_color) },
182184 { "text_font", PROP_TYPE_FONT, offsetof(Attribute, font) },
185+ { "text_height", PROP_TYPE_REAL, offsetof(Attribute, font_height) },
183186 { NULL, 0, 0}
184187 };
185188
@@ -276,10 +279,10 @@ attribute_draw(Attribute *attribute, Renderer *renderer)
276279 }
277280
278281 p.x = elem->corner.x + elem->width / 2.0;
279- p.y = elem->corner.y + (elem->height - FONT_HEIGHT)/2.0 +
280- font_ascent(attribute->font, FONT_HEIGHT);
282+ p.y = elem->corner.y + (elem->height - attribute->font_height)/2.0 +
283+ font_ascent(attribute->font, attribute->font_height);
281284
282- renderer->ops->set_font(renderer, attribute->font, FONT_HEIGHT);
285+ renderer->ops->set_font(renderer, attribute->font, attribute->font_height);
283286 renderer->ops->draw_string(renderer, attribute->name,
284287 &p, ALIGN_CENTER,
285288 &color_black);
@@ -291,7 +294,7 @@ attribute_draw(Attribute *attribute, Renderer *renderer)
291294 } else {
292295 renderer->ops->set_linestyle(renderer, LINESTYLE_SOLID);
293296 }
294- width = font_string_width(attribute->name, attribute->font, FONT_HEIGHT);
297+ width = font_string_width(attribute->name, attribute->font, attribute->font_height);
295298 start.x = center.x - width / 2;
296299 start.y = center.y + 0.4;
297300 end.x = center.x + width / 2;
@@ -310,10 +313,10 @@ attribute_update_data(Attribute *attribute)
310313 real half_x, half_y;
311314
312315 attribute->name_width =
313- font_string_width(attribute->name, attribute->font, FONT_HEIGHT);
316+ font_string_width(attribute->name, attribute->font, attribute->font_height);
314317
315318 elem->width = attribute->name_width + 2*TEXT_BORDER_WIDTH_X;
316- elem->height = FONT_HEIGHT + 2*TEXT_BORDER_WIDTH_Y;
319+ elem->height = attribute->font_height + 2*TEXT_BORDER_WIDTH_Y;
317320
318321 center.x = elem->corner.x + elem->width / 2.0;
319322 center.y = elem->corner.y + elem->height / 2.0;
@@ -389,6 +392,7 @@ attribute_create(Point *startpoint,
389392 /* choose default font name for your locale. see also font_data structure
390393 in lib/font.c. if "Courier" works for you, it would be better. */
391394 attribute->font = font_getfont(_("Courier"));
395+ attribute->font_height = FONT_HEIGHT;
392396 #ifdef GTK_DOESNT_TALK_UTF8_WE_DO
393397 attribute->name = charconv_local8_to_utf8 (_("Attribute"));
394398 #else
@@ -396,7 +400,7 @@ attribute_create(Point *startpoint,
396400 #endif
397401
398402 attribute->name_width =
399- font_string_width(attribute->name, attribute->font, FONT_HEIGHT);
403+ font_string_width(attribute->name, attribute->font, attribute->font_height);
400404
401405 attribute_update_data(attribute);
402406
@@ -445,6 +449,7 @@ attribute_copy(Attribute *attribute)
445449 }
446450
447451 newattribute->font = attribute->font;
452+ newattribute->font_height = attribute->font_height;
448453 newattribute->name = strdup(attribute->name);
449454 newattribute->name_width = attribute->name_width;
450455
@@ -481,6 +486,8 @@ attribute_save(Attribute *attribute, ObjectNode obj_node,
481486 attribute->multivalue);
482487 data_add_font (new_attribute (obj_node, "font"),
483488 attribute->font);
489+ data_add_real(new_attribute(obj_node, "font_height"),
490+ attribute->font_height);
484491 }
485492
486493 static Object *attribute_load(ObjectNode obj_node, int version,
@@ -542,6 +549,11 @@ static Object *attribute_load(ObjectNode obj_node, int version,
542549 if (attr != NULL)
543550 attribute->font = data_font (attribute_first_data (attr));
544551
552+ attribute->font_height = FONT_HEIGHT;
553+ attr = object_find_attribute (obj_node, "font_height");
554+ if (attr != NULL)
555+ attribute->font_height = data_real( attribute_first_data(attr) );
556+
545557 element_init(elem, 8, 8);
546558
547559 for (i=0;i<8;i++) {
@@ -556,8 +568,7 @@ static Object *attribute_load(ObjectNode obj_node, int version,
556568 attribute->font = font_getfont(_("Courier"));
557569 }
558570
559- attribute->name_width = font_string_width(attribute->name, attribute->font, FONT_HEIGHT);
560-
571+ attribute->name_width = font_string_width(attribute->name, attribute->font, attribute->font_height);
561572 attribute_update_data(attribute);
562573
563574 for (i=0;i<8;i++) {
--- a/objects/ER/entity.c
+++ b/objects/ER/entity.c
@@ -55,6 +55,7 @@ struct _Entity {
5555 Color inner_color;
5656
5757 DiaFont *font;
58+ real font_height;
5859 utfchar *name;
5960 real name_width;
6061
@@ -130,6 +131,7 @@ static PropDescription entity_props[] = {
130131 PROP_STD_LINE_COLOUR,
131132 PROP_STD_FILL_COLOUR,
132133 PROP_STD_TEXT_FONT,
134+ PROP_STD_TEXT_HEIGHT,
133135 PROP_DESC_END
134136 };
135137
@@ -149,6 +151,7 @@ static PropOffset entity_offsets[] = {
149151 { "line_colour", PROP_TYPE_COLOUR, offsetof(Entity, border_color) },
150152 { "fill_colour", PROP_TYPE_COLOUR, offsetof(Entity, inner_color) },
151153 { "text_font", PROP_TYPE_FONT, offsetof (Entity, font) },
154+ { "text_height", PROP_TYPE_REAL, offsetof(Entity, font_height) },
152155 { NULL, 0, 0}
153156 };
154157
@@ -255,9 +258,9 @@ entity_draw(Entity *entity, Renderer *renderer)
255258 }
256259
257260 p.x = elem->corner.x + elem->width / 2.0;
258- p.y = elem->corner.y + (elem->height - FONT_HEIGHT)/2.0 + font_ascent(entity->font, FONT_HEIGHT);
261+ p.y = elem->corner.y + (elem->height - entity->font_height)/2.0 + font_ascent(entity->font, entity->font_height);
259262 renderer->ops->set_font(renderer,
260- entity->font, FONT_HEIGHT);
263+ entity->font, entity->font_height);
261264 renderer->ops->draw_string(renderer,
262265 entity->name,
263266 &p, ALIGN_CENTER,
@@ -272,10 +275,10 @@ entity_update_data(Entity *entity)
272275 ElementBBExtras *extra = &elem->extra_spacing;
273276
274277 entity->name_width =
275- font_string_width(entity->name, entity->font, FONT_HEIGHT);
278+ font_string_width(entity->name, entity->font, entity->font_height);
276279
277280 elem->width = entity->name_width + 2*TEXT_BORDER_WIDTH_X;
278- elem->height = FONT_HEIGHT + 2*TEXT_BORDER_WIDTH_Y;
281+ elem->height = entity->font_height + 2*TEXT_BORDER_WIDTH_Y;
279282
280283 /* Update connections: */
281284 entity->connections[0].pos = elem->corner;
@@ -341,6 +344,7 @@ entity_create(Point *startpoint,
341344 /* choose default font name for your locale. see also font_data structure
342345 in lib/font.c. if "Courier" works for you, it would be better. */
343346 entity->font = font_getfont(_("Courier"));
347+ entity->font_height = FONT_HEIGHT;
344348 #ifdef GTK_DOESNT_TALK_UTF8_WE_DO
345349 entity->name = charconv_local8_to_utf8 (_("Entity"));
346350 #else
@@ -348,7 +352,7 @@ entity_create(Point *startpoint,
348352 #endif
349353
350354 entity->name_width =
351- font_string_width(entity->name, entity->font, FONT_HEIGHT);
355+ font_string_width(entity->name, entity->font, entity->font_height);
352356
353357 entity_update_data(entity);
354358
@@ -397,6 +401,7 @@ entity_copy(Entity *entity)
397401 }
398402
399403 newentity->font = entity->font;
404+ newentity->font_height = entity->font_height;
400405 newentity->name = strdup(entity->name);
401406 newentity->name_width = entity->name_width;
402407
@@ -422,6 +427,8 @@ entity_save(Entity *entity, ObjectNode obj_node, const char *filename)
422427 entity->weak);
423428 data_add_font (new_attribute (obj_node, "font"),
424429 entity->font);
430+ data_add_real(new_attribute(obj_node, "font_height"),
431+ entity->font_height);
425432 }
426433
427434 static Object *
@@ -471,6 +478,11 @@ entity_load(ObjectNode obj_node, int version, const char *filename)
471478 if (attr != NULL)
472479 entity->font = data_font (attribute_first_data (attr));
473480
481+ entity->font_height = FONT_HEIGHT;
482+ attr = object_find_attribute(obj_node, "font_height");
483+ if (attr != NULL)
484+ entity->font_height = data_real(attribute_first_data(attr));
485+
474486 element_init(elem, 8, 8);
475487
476488 for (i=0;i<8;i++) {
@@ -486,7 +498,7 @@ entity_load(ObjectNode obj_node, int version, const char *filename)
486498 }
487499
488500 entity->name_width =
489- font_string_width(entity->name, entity->font, FONT_HEIGHT);
501+ font_string_width(entity->name, entity->font, entity->font_height);
490502
491503 entity_update_data(entity);
492504
--- a/objects/ER/relationship.c
+++ b/objects/ER/relationship.c
@@ -50,6 +50,7 @@ struct _Relationship {
5050 Element element;
5151
5252 DiaFont *font;
53+ real font_height;
5354 utfchar *name;
5455 utfchar *left_cardinality;
5556 utfchar *right_cardinality;
@@ -145,6 +146,7 @@ static PropDescription relationship_props[] = {
145146 PROP_STD_LINE_COLOUR,
146147 PROP_STD_FILL_COLOUR,
147148 PROP_STD_TEXT_FONT,
149+ PROP_STD_TEXT_HEIGHT,
148150 PROP_DESC_END
149151 };
150152
@@ -167,6 +169,7 @@ static PropOffset relationship_offsets[] = {
167169 { "line_colour", PROP_TYPE_COLOUR, offsetof(Relationship, border_color) },
168170 { "fill_colour", PROP_TYPE_COLOUR, offsetof(Relationship, inner_color) },
169171 { "text_font", PROP_TYPE_FONT, offsetof (Relationship, font) },
172+ { "text_height", PROP_TYPE_REAL, offsetof(Relationship, font_height) },
170173 { NULL, 0, 0}
171174 };
172175
@@ -268,7 +271,7 @@ relationship_draw(Relationship *relationship, Renderer *renderer)
268271 lc.x = corners[1].x + 0.2;
269272 lc.y = corners[1].y - 0.3;
270273 rc.x = corners[3].x + 0.2;
271- rc.y = corners[3].y + 0.3 + FONT_HEIGHT;
274+ rc.y = corners[3].y + 0.3 + relationship->font_height;
272275 left_align = ALIGN_LEFT;
273276 } else {
274277 lc.x = corners[0].x - CARDINALITY_DISTANCE;
@@ -289,7 +292,7 @@ relationship_draw(Relationship *relationship, Renderer *renderer)
289292 &relationship->border_color);
290293 }
291294
292- renderer->ops->set_font(renderer, relationship->font, FONT_HEIGHT);
295+ renderer->ops->set_font(renderer, relationship->font, relationship->font_height);
293296 renderer->ops->draw_string(renderer,
294297 relationship->left_cardinality,
295298 &lc, left_align,
@@ -300,8 +303,8 @@ relationship_draw(Relationship *relationship, Renderer *renderer)
300303 &color_black);
301304
302305 p.x = elem->corner.x + elem->width / 2.0;
303- p.y = elem->corner.y + (elem->height - FONT_HEIGHT)/2.0 +
304- font_ascent(relationship->font, FONT_HEIGHT);
306+ p.y = elem->corner.y + (elem->height - relationship->font_height)/2.0 +
307+ font_ascent(relationship->font, relationship->font_height);
305308
306309 renderer->ops->draw_string(renderer,
307310 relationship->name,
@@ -317,11 +320,11 @@ relationship_update_data(Relationship *relationship)
317320 ElementBBExtras *extra = &elem->extra_spacing;
318321
319322 relationship->name_width =
320- font_string_width(relationship->name, relationship->font, FONT_HEIGHT);
323+ font_string_width(relationship->name, relationship->font, relationship->font_height);
321324 relationship->left_card_width =
322- font_string_width(relationship->left_cardinality, relationship->font, FONT_HEIGHT);
325+ font_string_width(relationship->left_cardinality, relationship->font, relationship->font_height);
323326 relationship->right_card_width =
324- font_string_width(relationship->right_cardinality, relationship->font, FONT_HEIGHT);
327+ font_string_width(relationship->right_cardinality, relationship->font, relationship->font_height);
325328
326329 elem->width = relationship->name_width + 2*TEXT_BORDER_WIDTH_X;
327330 elem->height = elem->width * DIAMOND_RATIO;
@@ -370,8 +373,8 @@ relationship_update_data(Relationship *relationship)
370373
371374 /* fix boundingrelationship for line_width: */
372375 if(relationship->rotate) {
373- obj->bounding_box.top -= FONT_HEIGHT + CARDINALITY_DISTANCE;
374- obj->bounding_box.bottom += FONT_HEIGHT + CARDINALITY_DISTANCE;
376+ obj->bounding_box.top -= relationship->font_height + CARDINALITY_DISTANCE;
377+ obj->bounding_box.bottom += relationship->font_height + CARDINALITY_DISTANCE;
375378 }
376379 else {
377380 obj->bounding_box.left -= CARDINALITY_DISTANCE + relationship->left_card_width;
@@ -419,6 +422,7 @@ relationship_create(Point *startpoint,
419422 /* choose default font name for your locale. see also font_data structure
420423 in lib/font.c. if "Courier" works for you, it would be better. */
421424 relationship->font = font_getfont(_("Courier"));
425+ relationship->font_height = FONT_HEIGHT;
422426 #ifdef GTK_DOESNT_TALK_UTF8_WE_DO
423427 relationship->name = charconv_local8_to_utf8 (_("Relationship"));
424428 #else
@@ -430,11 +434,11 @@ relationship_create(Point *startpoint,
430434 relationship->rotate = FALSE;
431435
432436 relationship->name_width =
433- font_string_width(relationship->name, relationship->font, FONT_HEIGHT);
437+ font_string_width(relationship->name, relationship->font, relationship->font_height);
434438 relationship->left_card_width =
435- font_string_width(relationship->left_cardinality, relationship->font, FONT_HEIGHT);
439+ font_string_width(relationship->left_cardinality, relationship->font, relationship->font_height);
436440 relationship->right_card_width =
437- font_string_width(relationship->right_cardinality, relationship->font, FONT_HEIGHT);
441+ font_string_width(relationship->right_cardinality, relationship->font, relationship->font_height);
438442
439443 relationship_update_data(relationship);
440444
@@ -485,6 +489,7 @@ relationship_copy(Relationship *relationship)
485489 }
486490
487491 newrelationship->font = relationship->font;
492+ newrelationship->font_height = relationship->font_height;
488493 newrelationship->name = strdup(relationship->name);
489494 newrelationship->left_cardinality =
490495 strdup(relationship->left_cardinality);
@@ -524,6 +529,8 @@ relationship_save(Relationship *relationship, ObjectNode obj_node,
524529 relationship->rotate);
525530 data_add_font (new_attribute (obj_node, "font"),
526531 relationship->font);
532+ data_add_real(new_attribute(obj_node, "font_height"),
533+ relationship->font_height);
527534 }
528535
529536 static Object *
@@ -587,6 +594,11 @@ relationship_load(ObjectNode obj_node, int version, const char *filename)
587594 if (attr != NULL)
588595 relationship->font = data_font (attribute_first_data (attr));
589596
597+ relationship->font_height = FONT_HEIGHT;
598+ attr = object_find_attribute(obj_node, "font_height");
599+ if (attr != NULL)
600+ relationship->font_height = data_real(attribute_first_data(attr));
601+
590602 element_init(elem, 8, 8);
591603
592604 for (i=0;i<8;i++) {
@@ -602,11 +614,11 @@ relationship_load(ObjectNode obj_node, int version, const char *filename)
602614 }
603615
604616 relationship->name_width =
605- font_string_width(relationship->name, relationship->font, FONT_HEIGHT);
617+ font_string_width(relationship->name, relationship->font, relationship->font_height);
606618 relationship->left_card_width =
607- font_string_width(relationship->left_cardinality, relationship->font, FONT_HEIGHT);
619+ font_string_width(relationship->left_cardinality, relationship->font, relationship->font_height);
608620 relationship->right_card_width =
609- font_string_width(relationship->right_cardinality, relationship->font, FONT_HEIGHT);
621+ font_string_width(relationship->right_cardinality, relationship->font, relationship->font_height);
610622
611623 relationship_update_data(relationship);
612624