3 * Copyright (C) 2005 Laboratoire d'Informatique de Paris 6
4 * Author: Pierre Duquesne
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 #include "diarenderer.h"
34 #include "attributes.h"
36 #include "properties.h"
39 #define min(a,b) (a<b?a:b)
41 #define max(a,b) (a>b?a:b)
43 #define L1 printf("%d\n", __LINE__);
46 /***********************************************
48 ***********************************************/
50 static const double AADLBOX_BORDERWIDTH
= 0.1;
51 static const double AADLBOX_FONTHEIGHT
= 0.8;
52 static const double AADLBOX_TEXT_MARGIN
= 0.5;
54 #define AADL_PORT_MAX_OUT 1.0 /* Maximum size out of the box */
56 #define AADL_MEMORY_FACTOR 0.1
57 #define AADLBOX_INCLINE_FACTOR 0.2
58 #define AADLBOX_DASH_LENGTH 0.3
59 #define AADL_BUS_ARROW_SIZE_FACTOR 0.16
60 #define AADL_BUS_HEIGHT_FACTOR 0.3
61 #define AADL_ROUNDEDBOX_CORNER_SIZE_FACTOR 0.25
63 /***********************************************
65 ***********************************************/
67 typedef struct _Aadlport Aadlport
;
68 typedef struct _Aadlbox Aadlbox
;
70 typedef struct _Aadlbox_specific Aadlbox_specific
;
86 ConnectionPoint
**connections
;
91 Aadlbox_specific
*specific
;
116 IN_OUT_EVENT_DATA_PORT
,
133 typedef void (*AadlProjectionFunc
) (Aadlbox
*aadlbox
,Point
*p
,real
*angle
);
134 typedef void (*AadlDrawFunc
) (Aadlbox
* obj
, DiaRenderer
* ddisp
);
135 typedef void (*AadlTextPosFunc
) (Aadlbox
* obj
, Point
*p
);
136 typedef void (*AadlSizeFunc
) (Aadlbox
* obj
, Point
*size
);
138 /* In the abstract class system (see aadlbox.c), these are the
139 functions an inherited class *must* define, because they are
140 used by aadlbox_ functions */
142 struct _Aadlbox_specific
144 AadlProjectionFunc project_point_on_nearest_border
;
145 AadlTextPosFunc text_position
;
146 AadlSizeFunc min_size
;
150 /***********************************************
152 ***********************************************/
156 void aadldata_text_position(Aadlbox
*aadlbox
, Point
*p
);
157 void aadldata_minsize(Aadlbox
*aadlbox
, Point
*size
);
159 void aadlprocess_text_position(Aadlbox
*aadlbox
, Point
*p
);
160 void aadlprocess_minsize(Aadlbox
*aadlbox
, Point
*size
);
162 void aadlbus_text_position(Aadlbox
*aadlbox
, Point
*p
);
163 void aadlbus_minsize(Aadlbox
*aadlbox
, Point
*size
);
165 void aadlsystem_text_position(Aadlbox
*aadlbox
, Point
*p
);
166 void aadlsystem_minsize(Aadlbox
*aadlbox
, Point
*size
);
168 void aadlsubprogram_text_position(Aadlbox
*aadlbox
, Point
*p
);
169 void aadlsubprogram_minsize(Aadlbox
*aadlbox
, Point
*size
);
171 void aadlmemory_text_position(Aadlbox
*aadlbox
, Point
*p
);
172 void aadlmemory_minsize(Aadlbox
*aadlbox
, Point
*size
);
175 void rotate_around_origin (Point
*p
, real angle
);
176 void aadlbox_draw_port(Aadlport
*port
, DiaRenderer
*renderer
);
177 void aadlbox_update_port(Aadlbox
*aadlbox
, Aadlport
*port
);
178 void aadlbox_update_ports(Aadlbox
*aadlbox
);
181 real
aadlbox_distance_from(Aadlbox
*aadlbox
, Point
*point
);
182 void aadlbox_select(Aadlbox
*aadlbox
, Point
*clicked_point
,
183 DiaRenderer
*interactive_renderer
);
184 ObjectChange
* aadlbox_move_handle(Aadlbox
*aadlbox
, Handle
*handle
,
185 Point
*to
, ConnectionPoint
*cp
,
186 HandleMoveReason reason
,
187 ModifierKeys modifiers
);
188 ObjectChange
* aadlbox_move(Aadlbox
*aadlbox
, Point
*to
);
189 void aadlbox_draw(Aadlbox
*aadlbox
, DiaRenderer
*renderer
);
190 DiaObject
*aadlbox_create(Point
*startpoint
, void *user_data
,
191 Handle
**handle1
, Handle
**handle2
);
192 void aadlbox_destroy(Aadlbox
*aadlbox
);
193 PropDescription
*aadlbox_describe_props(Aadlbox
*aadlbox
);
194 void aadlbox_get_props(Aadlbox
*aadlbox
, GPtrArray
*props
);
195 void aadlbox_set_props(Aadlbox
*aadlbox
, GPtrArray
*props
);
196 DiaObject
*aadlbox_copy(DiaObject
*obj
);
197 DiaMenu
* aadlbox_get_object_menu(Aadlbox
*aadlbox
, Point
*clickedpoint
);
198 void aadlbox_save(Aadlbox
*aadlbox
, ObjectNode obj_node
, const char *filename
);
199 void aadlbox_load(ObjectNode obj_node
, int version
, const char *filename
,
203 void aadlbox_project_point_on_rectangle(Rectangle
*rectangle
,
204 Point
*p
,real
*angle
);
205 void aadldata_project_point_on_nearest_border(Aadlbox
*aadlbox
,
206 Point
*p
,real
*angle
);
211 aadlbox_inclined_project_point_on_nearest_border(Aadlbox
*aadlbox
,Point
*p
,
213 void aadlprocess_text_position(Aadlbox
*aadlbox
, Point
*p
);
214 real
aadlprocess_blank_space_height(Aadlbox
*aadlbox
);
215 real
aadlprocess_blank_space_width(Aadlbox
*aadlbox
);
218 void aadlbox_draw_inclined_box(Aadlbox
*aadlbox
, DiaRenderer
*renderer
,
219 LineStyle linestyle
);
220 /* aadlsubprogram.c */
222 aadlsubprogram_project_point_on_nearest_border(Aadlbox
*aadlbox
,Point
*p
,
225 void aadlbox_draw_rounded_box (Aadlbox
*aadlbox
, DiaRenderer
*renderer
,
226 LineStyle linestyle
);