Commit 9ae1ebeb authored by Alexander Larsson's avatar Alexander Larsson

Added samples directory with UML and ER samples.

Fixed stupid bug in umlclass.
Zoom is now x1.41 instead x2.
Larger initial diagram-window.
Smaller uml classname font.
Some cleanups.
parent d8536ed8
1999-01-16 Alexander Larsson <alla@lysator.liu.se>
* Makefile.am:
* configure.in:
* samples/Makefile.am:
* samples/ER-demo.dia:
* samples/UML-demo.dia:
Added samples directory.
Added samples for ER and UML.
* app/commands.c:
* app/disp_callbacks.c:
* app/menus.c:
Zoom is done by sqrt(2) instead of 2.
Lots of more zoom options in the menu.
* objects/ER/relationship.c:
Relationships have 8 connectionpoints instead of 4.
* objects/UML/class.c:
UML class name font a bit smaller.
Fixed stupid bug in the copy operation.
* app/display.c:
Displays are opened at 500x400 instead of 256x256.
* app/load_save.c:
Fixup of internal error message.
* app/color_area.c:
* app/diagram.c:
* app/modify_tool.c:
* lib/object.c:
Removed debug printf's.
* TODO (BUGS):
Added new known bug.
1999-01-16 Alexander Larsson <alla@lysator.liu.se>
* app/interface.c:
......
## Process this file with automake to produce Makefile.in
SUBDIRS = lib objects app
SUBDIRS = lib objects app samples
......@@ -47,6 +47,9 @@ Big stuff:
BUGS:
=====
* Sometimes (dunno when it happens) menu shortcuts don't work in a view
until the menu is pulled down.
* doesn't use latin-1 or some other well-known 8-bit encoding in eps_renderer
* If you move an object outside the visible screen, scroll there move the object back
......
......@@ -345,7 +345,6 @@ color_area_events (GtkWidget *widget,
color_area_draw ();
break;
case GDK_BUTTON_PRESS:
printf("button event\n");
bevent = (GdkEventButton *) event;
if (bevent->button == 1) {
......
......@@ -20,6 +20,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <math.h>
#include "commands.h"
#include "app_procs.h"
......@@ -445,7 +446,7 @@ view_zoom_in_callback(GtkWidget *widget, gpointer data)
middle.x = visible->left*0.5 + visible->right*0.5;
middle.y = visible->top*0.5 + visible->bottom*0.5;
ddisplay_zoom(ddisp, &middle, 2.0);
ddisplay_zoom(ddisp, &middle, M_SQRT2);
}
void
......@@ -460,7 +461,7 @@ view_zoom_out_callback(GtkWidget *widget, gpointer data)
middle.x = visible->left*0.5 + visible->right*0.5;
middle.y = visible->top*0.5 + visible->bottom*0.5;
ddisplay_zoom(ddisp, &middle, 0.5);
ddisplay_zoom(ddisp, &middle, M_SQRT1_2);
}
void
......@@ -478,7 +479,7 @@ view_zoom_set_callback(GtkWidget *widget, gpointer data)
middle.y = visible->top*0.5 + visible->bottom*0.5;
percent = (int) data;
scale = ((real) percent)/100.0 * DDISPLAY_NORMAL_ZOOM;
scale = ((real) percent)/1000.0 * DDISPLAY_NORMAL_ZOOM;
ddisplay_zoom(ddisp, &middle, scale / ddisp->zoom_factor);
......
......@@ -116,7 +116,7 @@ diagram_remove_all_selected(Diagram *diagram, int delete_empty)
object_add_updates(selected_obj, diagram);
if (delete_empty && selected_obj->ops->is_empty(selected_obj)) {
printf("removed empty object.\n");
/* printf("removed empty object.\n"); */
layer_remove_object(diagram->data->active_layer, selected_obj);
selected_obj->ops->destroy(selected_obj);
g_free(selected_obj);
......@@ -142,7 +142,7 @@ diagram_remove_selected(Diagram *diagram, Object *obj)
}
if (obj->ops->is_empty(obj)) {
printf("removed empty object.\n");
/* printf("removed empty object.\n"); */
layer_remove_object(diagram->data->active_layer, obj);
obj->ops->destroy(obj);
g_free(obj);
......
......@@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <math.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
......@@ -216,7 +217,7 @@ ddisplay_canvas_events (GtkWidget *canvas,
middle.x = visible->left*0.5 + visible->right*0.5;
middle.y = visible->top*0.5 + visible->bottom*0.5;
ddisplay_zoom(ddisp, &middle, 2.0);
ddisplay_zoom(ddisp, &middle, M_SQRT2);
break;
case GDK_KP_Subtract:
case GDK_minus:
......@@ -224,7 +225,7 @@ ddisplay_canvas_events (GtkWidget *canvas,
middle.x = visible->left*0.5 + visible->right*0.5;
middle.y = visible->top*0.5 + visible->bottom*0.5;
ddisplay_zoom(ddisp, &middle, 0.5);
ddisplay_zoom(ddisp, &middle, M_SQRT1_2);
break;
default:
return_val = FALSE;
......@@ -269,7 +270,7 @@ ddisplay_delete (GtkWidget *widget, GdkEvent *event, gpointer data)
{
DDisplay *ddisp;
printf("delete\n");
/*printf("delete\n");*/
ddisp = (DDisplay *)data;
ddisplay_close(ddisp);
......
......@@ -77,7 +77,7 @@ new_display(Diagram *dia)
filename++;
}
create_display_shell(ddisp, 256, 256, filename);
create_display_shell(ddisp, 500, 400, filename);
if (!display_ht)
display_ht = g_hash_table_new ((GHashFunc) display_hash, NULL);
......
......@@ -309,7 +309,7 @@ write_connections(GList *objects, xmlNodePtr layer_node,
while (other_obj->connections[con_point_nr] != con_point) {
con_point_nr++;
if (con_point_nr>=other_obj->num_connections) {
message_error("Error saving diagram\n");
message_error("Internal error saving diagram\n con_point_nr >= other_obj->num_connections\n");
return FALSE;
}
}
......
......@@ -66,11 +66,16 @@ static GtkItemFactoryEntry display_menu_items[] =
{"/View/Zoom _In", NULL, view_zoom_in_callback, 0},
{"/View/Zoom _Out", NULL, view_zoom_out_callback, 0},
{"/View/_Zoom", NULL, NULL, 0, "<Branch>"},
{"/View/Zoom/400%", NULL, view_zoom_set_callback, 400},
{"/View/Zoom/200%", NULL, view_zoom_set_callback, 200},
{"/View/Zoom/100%", NULL, view_zoom_set_callback, 100},
{"/View/Zoom/50%", NULL, view_zoom_set_callback, 50},
{"/View/Zoom/25%", NULL, view_zoom_set_callback, 25},
{"/View/Zoom/400%", NULL, view_zoom_set_callback, 4000},
{"/View/Zoom/283%", NULL, view_zoom_set_callback, 2828},
{"/View/Zoom/200%", NULL, view_zoom_set_callback, 2000},
{"/View/Zoom/141%", NULL, view_zoom_set_callback, 1414},
{"/View/Zoom/100%", NULL, view_zoom_set_callback, 1000},
{"/View/Zoom/85%", NULL, view_zoom_set_callback, 850},
{"/View/Zoom/70.7%", NULL, view_zoom_set_callback, 707},
{"/View/Zoom/50%", NULL, view_zoom_set_callback, 500},
{"/View/Zoom/35.4%", NULL, view_zoom_set_callback, 354},
{"/View/Zoom/25%", NULL, view_zoom_set_callback, 250},
{"/View/Edit Grid...", NULL, view_edit_grid_callback, 0},
{"/View/_Visible Grid", NULL, view_visible_grid_callback, 0, "<CheckItem>"},
{"/View/_Snap To Grid", NULL, view_snap_to_grid_callback, 0, "<CheckItem>"},
......
......@@ -84,11 +84,11 @@ click_select_object(DDisplay *ddisp, Point *clickedpoint,
if (obj!=NULL) {
/* Selected an object. */
GList *already;
printf("Selected object!\n");
/*printf("Selected object!\n");*/
already = g_list_find(diagram->data->selected, obj);
if (already == NULL) { /* Not already selected */
printf("Not already selected\n");
/*printf("Not already selected\n");*/
if (!(event->state & GDK_SHIFT_MASK)) {
/* Not Multi-select => remove current selection */
......@@ -104,7 +104,7 @@ click_select_object(DDisplay *ddisp, Point *clickedpoint,
return obj;
} else { /* Clicked on already selected. */
printf("Already selected\n");
/*printf("Already selected\n");*/
obj->ops->select(obj, clickedpoint,
(Renderer *)ddisp->renderer);
object_add_updates_list(diagram->data->selected, diagram);
......@@ -119,7 +119,7 @@ click_select_object(DDisplay *ddisp, Point *clickedpoint,
}
}
} else { /* No object selected */
printf("didn't select object\n");
/*printf("didn't select object\n");*/
if (!(event->state & GDK_SHIFT_MASK)) {
/* Not Multi-select => Remove all selected */
diagram_remove_all_selected(diagram, TRUE);
......
......@@ -75,5 +75,6 @@ objects/ER/Makefile
objects/ER/pixmaps/Makefile
app/Makefile
app/pixmaps/Makefile
samples/Makefile
)
......@@ -195,8 +195,6 @@ object_connect(Object *obj, Handle *handle,
handle->connected_to = connectionpoint;
connectionpoint->connected =
g_list_prepend(connectionpoint->connected, obj);
printf("*** Made connection\n");
}
void
......@@ -210,7 +208,6 @@ object_unconnect(Object *connected_obj, Handle *handle)
connectionpoint->connected =
g_list_remove(connectionpoint->connected, connected_obj);
handle->connected_to = NULL;
printf("*** Broke connection!\n");
}
}
......@@ -228,7 +225,6 @@ object_remove_connections_to(ConnectionPoint *conpoint)
for (i=0;i<connected_obj->num_handles;i++) {
if (connected_obj->handles[i]->connected_to == conpoint) {
connected_obj->handles[i]->connected_to = NULL;
printf("*** Broke connection!\n");
}
}
list = g_list_next(list);
......
......@@ -55,7 +55,7 @@ struct _Relationship {
gboolean identifying;
gboolean rotate;
ConnectionPoint connections[4];
ConnectionPoint connections[8];
real border_width;
Color border_color;
......@@ -400,14 +400,43 @@ relationship_update_data(Relationship *relationship)
elem->height = elem->width * DIAMOND_RATIO;
/* Update connections: */
/*
2
*
1 / \ 3
* *
/ \
0 * * 4
\ /
* *
7 \ / 5
*
6
*/
relationship->connections[0].pos.x = elem->corner.x;
relationship->connections[0].pos.y = elem->corner.y + elem->height / 2.0;
relationship->connections[1].pos.x = elem->corner.x + elem->width / 2.0;
relationship->connections[1].pos.y = elem->corner.y;
relationship->connections[2].pos.x = elem->corner.x + elem->width;
relationship->connections[2].pos.y = elem->corner.y + elem->height / 2.0;
relationship->connections[3].pos.x = elem->corner.x + elem->width / 2.0;
relationship->connections[3].pos.y = elem->corner.y + elem->height;
relationship->connections[1].pos.x = elem->corner.x + elem->width / 4.0;
relationship->connections[1].pos.y = elem->corner.y + elem->height / 4.0;
relationship->connections[2].pos.x = elem->corner.x + elem->width / 2.0;
relationship->connections[2].pos.y = elem->corner.y;
relationship->connections[3].pos.x = elem->corner.x + 3.0 * elem->width / 4.0;
relationship->connections[3].pos.y = elem->corner.y + elem->height / 4.0;
relationship->connections[4].pos.x = elem->corner.x + elem->width;
relationship->connections[4].pos.y = elem->corner.y + elem->height / 2.0;
relationship->connections[5].pos.x = elem->corner.x + 3.0 * elem->width / 4.0;
relationship->connections[5].pos.y = elem->corner.y + 3.0 * elem->height / 4.0;
relationship->connections[6].pos.x = elem->corner.x + elem->width / 2.0;
relationship->connections[6].pos.y = elem->corner.y + elem->height;
relationship->connections[7].pos.x = elem->corner.x + elem->width / 4.0;
relationship->connections[7].pos.y = elem->corner.y + 3.0 * elem->height / 4.0;
element_update_boundingbox(elem);
......@@ -461,9 +490,9 @@ relationship_create(Point *startpoint,
relationship->border_color = attributes_get_foreground();
relationship->inner_color = attributes_get_background();
element_init(elem, 8, 4);
element_init(elem, 8, 8);
for (i=0;i<4;i++) {
for (i=0;i<8;i++) {
obj->connections[i] = &relationship->connections[i];
relationship->connections[i].object = obj;
relationship->connections[i].connected = NULL;
......@@ -527,7 +556,7 @@ relationship_copy(Relationship *relationship)
newrelationship->border_color = relationship->border_color;
newrelationship->inner_color = relationship->inner_color;
for (i=0;i<4;i++) {
for (i=0;i<8;i++) {
newobj->connections[i] = &newrelationship->connections[i];
newrelationship->connections[i].object = newobj;
newrelationship->connections[i].connected = NULL;
......@@ -634,9 +663,9 @@ relationship_load(ObjectNode obj_node, int version)
if (attr != NULL)
relationship->rotate = data_boolean(attribute_first_data(attr));
element_init(elem, 8, 4);
element_init(elem, 8, 8);
for (i=0;i<4;i++) {
for (i=0;i<8;i++) {
obj->connections[i] = &relationship->connections[i];
relationship->connections[i].object = obj;
relationship->connections[i].connected = NULL;
......
......@@ -587,7 +587,7 @@ static void
fill_in_fontdata(UMLClass *umlclass)
{
umlclass->font_height = 0.8;
umlclass->classname_font_height = 1.2;
umlclass->classname_font_height = 1.0;
umlclass->normal_font = font_getfont("Courier");
umlclass->abstract_font = font_getfont("Courier-Oblique");
umlclass->classname_font = font_getfont("Helvetica-Bold");
......@@ -804,8 +804,13 @@ umlclass_copy(UMLClass *umlclass)
newop = uml_operation_copy(op);
newop->left_connection = g_new(ConnectionPoint,1);
*newop->left_connection = *op->left_connection;
newop->left_connection->object = newobj;
newop->left_connection->connected = NULL;
newop->right_connection = g_new(ConnectionPoint,1);
*newop->right_connection = *op->right_connection;
newop->right_connection->object = newobj;
newop->right_connection->connected = NULL;
newumlclass->operations = g_list_prepend(newumlclass->operations,
newop);
......@@ -844,7 +849,7 @@ umlclass_copy(UMLClass *umlclass)
i = 8;
if ( (newumlclass->visible_attributes) &&
(!newumlclass->suppress_attributes)) {
list = umlclass->attributes;
list = newumlclass->attributes;
while (list != NULL) {
attr = (UMLAttribute *)list->data;
newobj->connections[i++] = attr->left_connection;
......@@ -856,7 +861,7 @@ umlclass_copy(UMLClass *umlclass)
if ( (newumlclass->visible_operations) &&
(!newumlclass->suppress_operations)) {
list = umlclass->operations;
list = newumlclass->operations;
while (list != NULL) {
op = (UMLOperation *)list->data;
newobj->connections[i++] = op->left_connection;
......
## Process this file with automake to produce Makefile.in
EXTRA_DIST = ER-demo.dia UML-demo.dia
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment