| 1 |
/* File: pencil_size.h; Copyright and License: see below */ |
| 2 |
|
| 3 |
#ifndef PENCIL_SIZE_H |
| 4 |
#define PENCIL_SIZE_H |
| 5 |
|
| 6 |
/* public file for the doxygen documentation: */ |
| 7 |
/*! |
| 8 |
* \file |
| 9 |
* \brief Provides a set of size values used to draw a diagram |
| 10 |
*/ |
| 11 |
|
| 12 |
#include <pango/pangocairo.h> |
| 13 |
#include <cairo.h> |
| 14 |
#if __GNUC__ >= 8 |
| 15 |
#pragma GCC diagnostic push |
| 16 |
#pragma GCC diagnostic ignored "-Wpedantic" |
| 17 |
#endif |
| 18 |
#include <gdk/gdk.h> |
| 19 |
#if __GNUC__ >= 8 |
| 20 |
#pragma GCC diagnostic pop |
| 21 |
#endif |
| 22 |
#include <stdint.h> |
| 23 |
#include <stdbool.h> |
| 24 |
|
| 25 |
/*! |
| 26 |
* \brief enumeration of alignment buffers for text rendering |
| 27 |
*/ |
| 28 |
enum pencil_size_font_enum { |
| 29 |
PENCIL_SIZE_FONT_ALIGN_MARGIN = 1, /*!< to align font rendering on pixel borders, 1 pixel margin is needed */ |
| 30 |
}; |
| 31 |
|
| 32 |
/*! |
| 33 |
* \brief attributes of the pencil_size_t |
| 34 |
*/ |
| 35 |
struct pencil_size_struct { |
| 36 |
double footnote_font_size; /*!< text size of footnote text */ |
| 37 |
PangoFontDescription *footnote_font_description; /*!< text description of footnote text */ |
| 38 |
double standard_font_size; /*!< text size of standard text */ |
| 39 |
PangoFontDescription *standard_font_description; /*!< text description of standard text */ |
| 40 |
double title_font_size; /*!< text size of title text */ |
| 41 |
PangoFontDescription *title_font_description; /*!< text description of title text */ |
| 42 |
double standard_line_width; /*!< line width of standard lines */ |
| 43 |
double bold_line_width; /*!< line width of bold lines */ |
| 44 |
double line_dash_length; /*!< dash length of a short-dashed line */ |
| 45 |
double standard_object_border; /*!< gap between the bounding rectangle and the outer line of an object */ |
| 46 |
double arrow_stroke_length; /*!< length of a stroke to paint an arrow tip */ |
| 47 |
double arrow_stroke_087_length; /*!< sqrt(0.75)=0.8660 parts of the length of a stroke to paint an arrow */ |
| 48 |
double preferred_object_distance; /*!< preferred distance between two objects or object and connector */ |
| 49 |
double classifier_symbol_height; /*!< height of actors, timeouts, fork, join, start, end */ |
| 50 |
GdkRGBA standard_color; /*!< foreground color of all standard objects */ |
| 51 |
GdkRGBA select_color; /*!< foreground color of all currently selected objects (user selected set): pink */ |
| 52 |
GdkRGBA highlight_color; /*!< foreground color of the current highlighted/mouse over object: turquoise */ |
| 53 |
GdkRGBA focus_color; /*!< foreground color of the one currently focused object: yellow */ |
| 54 |
GdkRGBA emphasized_bgcolor; /*!< background color of the durable-emphasized objects: yellow */ |
| 55 |
GdkRGBA gray_out_color; /*!< foreground color of the durable-greyed_out objects: gray */ |
| 56 |
}; |
| 57 |
|
| 58 |
typedef struct pencil_size_struct pencil_size_t; |
| 59 |
|
| 60 |
/*! |
| 61 |
* \brief initializes the size values |
| 62 |
* |
| 63 |
* \param this_ pointer to own object attributes |
| 64 |
* \param width of the area where to draw the diagram |
| 65 |
* \param height of the area where to draw the diagram |
| 66 |
*/ |
| 67 |
static inline void pencil_size_init( pencil_size_t *this_, double width, double height ); |
| 68 |
|
| 69 |
/*! |
| 70 |
* \brief initializes the size values by defaults |
| 71 |
* |
| 72 |
* \param this_ pointer to own object attributes |
| 73 |
*/ |
| 74 |
static inline void pencil_size_init_empty( pencil_size_t *this_ ); |
| 75 |
|
| 76 |
/*! |
| 77 |
* \brief destroys the pencil_size_t |
| 78 |
* |
| 79 |
* \param this_ pointer to own object attributes |
| 80 |
*/ |
| 81 |
static inline void pencil_size_destroy( pencil_size_t *this_ ); |
| 82 |
|
| 83 |
/*! |
| 84 |
* \brief re-initializes the pencil_size_t |
| 85 |
* |
| 86 |
* \param this_ pointer to own object attributes |
| 87 |
* \param width of the area where to draw the diagram |
| 88 |
* \param height of the area where to draw the diagram |
| 89 |
*/ |
| 90 |
static inline void pencil_size_reinit( pencil_size_t *this_, double width, double height ); |
| 91 |
|
| 92 |
/*! |
| 93 |
* \brief gets the attribute of pencil_size_t: footnote_font_size |
| 94 |
* |
| 95 |
* \param this_ pointer to own object attributes |
| 96 |
*/ |
| 97 |
static inline double pencil_size_get_footnote_font_size( const pencil_size_t *this_ ); |
| 98 |
|
| 99 |
/*! |
| 100 |
* \brief gets the PangoFontDescription for the footnote font |
| 101 |
* |
| 102 |
* \param this_ pointer to own object attributes |
| 103 |
*/ |
| 104 |
static inline const PangoFontDescription *pencil_size_get_footnote_font_description( const pencil_size_t *this_ ); |
| 105 |
|
| 106 |
/*! |
| 107 |
* \brief gets the attribute of pencil_size_t: standard_font_size |
| 108 |
* |
| 109 |
* \param this_ pointer to own object attributes |
| 110 |
*/ |
| 111 |
static inline double pencil_size_get_standard_font_size( const pencil_size_t *this_ ); |
| 112 |
|
| 113 |
/*! |
| 114 |
* \brief gets the PangoFontDescription for the standard font |
| 115 |
* |
| 116 |
* \param this_ pointer to own object attributes |
| 117 |
*/ |
| 118 |
static inline const PangoFontDescription *pencil_size_get_standard_font_description( const pencil_size_t *this_ ); |
| 119 |
|
| 120 |
/*! |
| 121 |
* \brief gets the attribute of pencil_size_t: title_font_size |
| 122 |
* |
| 123 |
* \param this_ pointer to own object attributes |
| 124 |
*/ |
| 125 |
static inline double pencil_size_get_title_font_size( const pencil_size_t *this_ ); |
| 126 |
|
| 127 |
/*! |
| 128 |
* \brief determines PangoFontDescription for the title font |
| 129 |
* |
| 130 |
* \param this_ pointer to own object attributes |
| 131 |
*/ |
| 132 |
static inline const PangoFontDescription *pencil_size_get_title_font_description( const pencil_size_t *this_ ); |
| 133 |
|
| 134 |
/*! |
| 135 |
* \brief proposes a tab size |
| 136 |
* |
| 137 |
* \param this_ pointer to own object attributes |
| 138 |
*/ |
| 139 |
static inline double pencil_size_get_font_tab_size( const pencil_size_t *this_ ); |
| 140 |
|
| 141 |
/*! |
| 142 |
* \brief determines the gap between font lines |
| 143 |
* |
| 144 |
* \param this_ pointer to own object attributes |
| 145 |
*/ |
| 146 |
static inline double pencil_size_get_font_line_gap( const pencil_size_t *this_ ); |
| 147 |
|
| 148 |
/*! |
| 149 |
* \brief gets the attribute of pencil_size_t: standard_line_width |
| 150 |
* |
| 151 |
* \param this_ pointer to own object attributes |
| 152 |
*/ |
| 153 |
static inline double pencil_size_get_standard_line_width( const pencil_size_t *this_ ); |
| 154 |
|
| 155 |
/*! |
| 156 |
* \brief gets the attribute of pencil_size_t: bold_line_width |
| 157 |
* |
| 158 |
* \param this_ pointer to own object attributes |
| 159 |
*/ |
| 160 |
static inline double pencil_size_get_bold_line_width( const pencil_size_t *this_ ); |
| 161 |
|
| 162 |
/*! |
| 163 |
* \brief gets the attribute of pencil_size_t: line_dash_length |
| 164 |
* |
| 165 |
* \param this_ pointer to own object attributes |
| 166 |
*/ |
| 167 |
static inline double pencil_size_get_line_dash_length( const pencil_size_t *this_ ); |
| 168 |
|
| 169 |
/*! |
| 170 |
* \brief gets the attribute of pencil_size_t: standard_object_border aka gap |
| 171 |
* |
| 172 |
* \param this_ pointer to own object attributes |
| 173 |
*/ |
| 174 |
static inline double pencil_size_get_standard_object_border( const pencil_size_t *this_ ); |
| 175 |
|
| 176 |
/*! |
| 177 |
* \brief gets the attribute of pencil_size_t: arrow_stroke_length |
| 178 |
* |
| 179 |
* \param this_ pointer to own object attributes |
| 180 |
*/ |
| 181 |
static inline double pencil_size_get_arrow_stroke_length( const pencil_size_t *this_ ); |
| 182 |
|
| 183 |
/*! |
| 184 |
* \brief gets the attribute of pencil_size_t: arrow_stroke_087_length |
| 185 |
* |
| 186 |
* \param this_ pointer to own object attributes |
| 187 |
*/ |
| 188 |
static inline double pencil_size_get_arrow_stroke_087_length( const pencil_size_t *this_ ); |
| 189 |
|
| 190 |
/*! |
| 191 |
* \brief gets the attribute of pencil_size_t: preferred_object_distance |
| 192 |
* |
| 193 |
* \param this_ pointer to own object attributes |
| 194 |
*/ |
| 195 |
static inline double pencil_size_get_preferred_object_distance( const pencil_size_t *this_ ); |
| 196 |
|
| 197 |
/*! |
| 198 |
* \brief gets the attribute of pencil_size_t: classifier_symbol_height |
| 199 |
* |
| 200 |
* \param this_ pointer to own object attributes |
| 201 |
*/ |
| 202 |
static inline double pencil_size_get_classifier_symbol_height( const pencil_size_t *this_ ); |
| 203 |
|
| 204 |
/*! |
| 205 |
* \brief gets the attribute of pencil_size_t: standard_color |
| 206 |
* |
| 207 |
* \param this_ pointer to own object attributes |
| 208 |
*/ |
| 209 |
static inline GdkRGBA pencil_size_get_standard_color( const pencil_size_t *this_ ); |
| 210 |
|
| 211 |
/*! |
| 212 |
* \brief gets the attribute of pencil_size_t: select_color |
| 213 |
* |
| 214 |
* \param this_ pointer to own object attributes |
| 215 |
*/ |
| 216 |
static inline GdkRGBA pencil_size_get_select_color( const pencil_size_t *this_ ); |
| 217 |
|
| 218 |
/*! |
| 219 |
* \brief gets the attribute of pencil_size_t: highlight_color |
| 220 |
* |
| 221 |
* \param this_ pointer to own object attributes |
| 222 |
*/ |
| 223 |
static inline GdkRGBA pencil_size_get_highlight_color( const pencil_size_t *this_ ); |
| 224 |
|
| 225 |
/*! |
| 226 |
* \brief gets the attribute of pencil_size_t: focus_color |
| 227 |
* |
| 228 |
* \param this_ pointer to own object attributes |
| 229 |
*/ |
| 230 |
static inline GdkRGBA pencil_size_get_focus_color( const pencil_size_t *this_ ); |
| 231 |
|
| 232 |
/*! |
| 233 |
* \brief gets the attribute of pencil_size_t: emphasized_bgcolor |
| 234 |
* |
| 235 |
* \param this_ pointer to own object attributes |
| 236 |
*/ |
| 237 |
static inline GdkRGBA pencil_size_get_emphasized_bgcolor( const pencil_size_t *this_ ); |
| 238 |
|
| 239 |
/*! |
| 240 |
* \brief gets the attribute of pencil_size_t: gray_out_color |
| 241 |
* |
| 242 |
* \param this_ pointer to own object attributes |
| 243 |
*/ |
| 244 |
static inline GdkRGBA pencil_size_get_gray_out_color( const pencil_size_t *this_ ); |
| 245 |
|
| 246 |
#include "pencil_size.inl" |
| 247 |
|
| 248 |
#endif /* PENCIL_SIZE_H */ |
| 249 |
|
| 250 |
|
| 251 |
/* |
| 252 |
Copyright 2016-2026 Andreas Warnke |
| 253 |
|
| 254 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 255 |
you may not use this file except in compliance with the License. |
| 256 |
You may obtain a copy of the License at |
| 257 |
|
| 258 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 259 |
|
| 260 |
Unless required by applicable law or agreed to in writing, software |
| 261 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 262 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 263 |
See the License for the specific language governing permissions and |
| 264 |
limitations under the License. |
| 265 |
*/ |