File: database.h

package info (click to toggle)
dia 0.98%2Bgit20250827-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 52,064 kB
  • sloc: ansic: 155,731; xml: 14,062; python: 6,250; cpp: 3,635; sh: 447; perl: 137; makefile: 29
file content (161 lines) | stat: -rw-r--r-- 4,233 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* Dia -- an diagram creation/manipulation program
 * Copyright (C) 1998 Alexander Larsson
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#pragma once

#include "element.h"
#include "connectionpoint.h"
#include "orth_conn.h"

G_BEGIN_DECLS

#define DIA_DB_TYPE_TABLE_OBJECT_CHANGE dia_db_table_object_change_get_type ()
G_DECLARE_FINAL_TYPE (DiaDBTableObjectChange,
                      dia_db_table_object_change,
                      DIA_DB, TABLE_OBJECT_CHANGE,
                      DiaObjectChange)


#define DIA_DB_TYPE_COMPOUND_OBJECT_CHANGE dia_db_compound_object_change_get_type ()
G_DECLARE_FINAL_TYPE (DiaDBCompoundObjectChange,
                      dia_db_compound_object_change,
                      DIA_DB, COMPOUND_OBJECT_CHANGE,
                      DiaObjectChange)


#define DIA_DB_TYPE_COMPOUND_MOUNT_OBJECT_CHANGE dia_db_compound_mount_object_change_get_type ()
G_DECLARE_FINAL_TYPE (DiaDBCompoundMountObjectChange,
                      dia_db_compound_mount_object_change,
                      DIA_DB, COMPOUND_MOUNT_OBJECT_CHANGE,
                      DiaObjectChange)


#define IS_NOT_EMPTY(str) (((str) != NULL) && ((str)[0] != '\0'))

#define TABLE_CONNECTIONPOINTS 12

typedef struct _Table Table;
typedef struct _TableAttribute TableAttribute;
typedef struct _TableReference TableReference;
typedef struct _TableState TableState;
typedef struct _Disconnect Disconnect;

struct _Table {
  Element element; /**< inheritance */

  /** static connection point storage */
  ConnectionPoint connections[TABLE_CONNECTIONPOINTS];

  /* data */

  gchar * name;
  gchar * comment;
  gint visible_comment;
  gint tagging_comment;
  gint underline_primary_key;
  gint bold_primary_key;
  GList * attributes; /**< the attributes of this database table */

  /* fonts */
  real normal_font_height;
  DiaFont * normal_font;

  real primary_key_font_height;
  DiaFont * primary_key_font;

  real name_font_height;
  DiaFont * name_font;

  real comment_font_height;
  DiaFont * comment_font;

  /* colors */
  Color line_color;
  Color fill_color;
  Color text_color;

  real border_width;

  /* computed variables */
  gboolean destroyed;

  real namebox_height;
  real attributesbox_height;
  real maxwidth_attr_name;
};

struct _TableAttribute {
  gchar * name;          /* column name */
  gchar * type;          /* the type of the values in this column */
  gchar * default_value; /* optional default column value */
  gchar * comment;
  gint primary_key;
  gint nullable;
  gint unique;

  ConnectionPoint * left_connection;
  ConnectionPoint * right_connection;
};

struct _Disconnect {
  ConnectionPoint *cp;
  DiaObject *other_object;
  Handle *other_handle;
};

struct _TableState {
  gchar * name;
  gchar * comment;
  gint visible_comment;
  gint tagging_comment;
  gint underline_primary_key;
  gint bold_primary_key;
  real border_width;

  GList * attributes;
};


struct _TableReference {
  OrthConn orth; /* inheritance */

  double line_width;
  double dashlength;
  DiaLineStyle line_style;
  Color line_color;
  Color text_color;

  char *start_point_desc;
  char *end_point_desc;
  Arrow end_arrow;
  double corner_radius;

  DiaFont *normal_font;
  double normal_font_height;

  /* computed data */

  double sp_desc_width;         /* start-point */
  Point sp_desc_pos;            /* start-point */
  DiaAlignment sp_desc_text_align; /* start-point */
  double ep_desc_width;         /* end-point */
  Point ep_desc_pos;            /* end-point */
  DiaAlignment ep_desc_text_align; /* end-point */
};

G_END_DECLS