Name | Short description |
---|---|
binding.h | implements bindings |
callbacks.h | contains callback functions |
click_handle.h | contains functions for handling clicks |
color.h | contains color schemes |
draw.h | contains functions for drawing |
fd_format.h | contains functions for outputting shapes to a file |
figure.h | includes functions for creating and processing shapes |
geometry.h | includes functions for creating and processing geometry |
list.h | implements a doubly linked list of shapes |
error.h | implements error handling functions |
help.h | implements help messages |
multi_obj.h | combines figure and text |
text.h | implements text |
util.h | contains utility functions |
this file includes functions for creating three types of bindings: object bindings, binding of intersection, and vertical bindings
object snaps, the cursor is fixed on the object
here white point is the cursor snapped to the edge of the rect
these bindings are formed at the intersection of 2 objects:
these bindings are to the x or y of another object:
void bl_bind(list *lptr, double *x, double *y);
-- this function creates a binding for the x and y coordinates relative to the list of lptr shapeslptr
-- pointer to a list of objectsx
-- the x coordinate of the cursory
-- the y coordinate of the cursor
For all of the following functions:
lptr
-- pointer to th list of objectsx
-- the x coordinate of the cursory
-- the y coordinate of the cursor
char *bl_try_make_object_bind(list *lptr, double *x, double *y);
-- an internal function that attempts to create an object binding to an objectchar *bl_try_make_intersection_binding(list *lptr, double *x, double *y);
-- tries to create an intersection binding, otherwise similarbl_try_make_object_binding
char *bl_try_make_vertical_binding(list *lptr, double *x, double *y);
-- tries to create a vertical binding, similar tobl_try_make_object_binding
int bl_is_create_binding(figure *target, double x, double y);
-- returns 1 if you can create an object binding, 0 otherwisetarget
-- target figurex
-- the x coordinate of the cursory
-- the y coordinate of the cursor
double bl_get_coords_dif(double c1, double c2);
-- returns the difference of the coordinatesc1
-- first coordinatec2
-- second coordinate
For all of the following functions:
figure_name
-- target figurex
-- the x coordinate of the cursory
-- the y coordinate of the cursor
int bl_get_binding_possibility_point(figure *point, double x, double y);
-- returns the ability to create a binding to a point (1 or 0)int bl_get_binding_possibility_line(figure *line, double x, double y);
-- similar tobl_get_binding_possibility_point
int bl_get_binding_possibility_rect(figure *rect, double x, double y);
-- similar tobl_get_binding_possibility_point
int bl_get_binding_possibility_circle(figure *circle, double x, double y);
-- similar tobl_get_binding_possibility_point
For all of the following functions:
figure_name
-- target figurex
-- the x coordinate of the cursory
-- the y coordinate of the cursor
void bl_make_binding(figure *fptr, double *x, double *y);
-- directly creates a bindingvoid bl_make_binding_point(figure *point, double *x, double *y);
-- directly creates a binding to pointvoid bl_make_binding_line(figure *line, double *x, double *y);
-- directly creates a binding to linevoid bl_make_binding_rect(figure *rect, double *x, double *y);
-- directly creates a binding to rectvoid bl_make_binding_circle(figure *circle, double *x, double *y);
-- directly creates a binding to circle
char *bl_make_vertical_bind_if_possible(list *node, double *x, double *y);
-- creates a vertical bindingnode
-- target nodex
-- the x coordinate of the pointy
-- the x coordinate of the point
BINDING_AREA
-- the distance within which the binding is created
contains callback functions for the interface created in main.c
DRAW_BUTTONS
-- specifies the number of buttons responsible for drawing
-
gboolean draw_area_draw(GtkWidget *area, cairo_t *cr, gpointer data);
-- drawing the canvasarea
-- drawing areacr
-- cairo contextdata
-- not used
-
gboolean mouse_move(GtkWidget *widget, GdkEvent *event, GtkWidget *crd_label);
-- tracks the mouse movementwidget
-- drawing areaevent
-- GdkEvent pointercrd_label
-- label the coordinate display
-
gboolean mouse_click(GtkWidget *widget, GdkEvent *event, gpointer data);
-- tracks mouse clickswidget
-- drawing areaevent
-- GdkEvent pointercrd_label
-- label the coordinate display
-
gboolean key_press(GtkWidget *widget, GdkEvent *event, gpointer data);
-- monitors keystrokes of the keyboard. Currently not usedwidget
-- drawing areaevent
-- Gdkevent pointerdata
-- not used
For all of the following functions:
bttn
-- pointer to the button that the signal is bound todata
-- not used
void point_bttn_click(GtkWidget *bttn, gpointer data);
-- callback for point buttonvoid line_bttn_click(GtkWidget *bttn, gpointer data);
-- callback for line pp buttonvoid line_la_bttn_click(GtkWidget *bttn, gpointer data);
-- callback for line la buttonvoid rect_pp_bttn_click(GtkWidget *bttn, gpointer data);
-- callback for rect pp buttonvoid rect_wh_bttn_click(GtkWidget *bttn, gpointer data);
-- callback for rect wh buttonvoid circle_bttn_click(GtkWidget *bttn, gpointer data);
-- callback for circle buttonvoid arc_bttn_click(GtkWidget *bttn, gpointer data);
-- callback for arc buttonvoid curs_bttn_click(GtkWidget *bttn, gpointer data);
-- callback for curs button
For all of the following functions:
bttn
-- pointer to the button that the signal is bound toparent_window
-- the parent window of the dialog
void circle_prm_bttn_click(GtkWidget *bttn, GtkWidget *parent_window);
-- callback for parametric circlevoid arc_prm_bttn_click(GtkWidget *bttn, GtkWidget *parent_window);
-- callback for parametric arcsvoid text_bttn_click(GtkWidget *bttn, GtkWindow *parent_window);
-- callback for text button
For all of the following functions:
bttn
-- pointer to the button that the signal is bound toparent_window
-- the parent window of the dialog
void save_bttn_click(GtkWidget *bttn, gpointer data);
-- signal for file saving dialogvoid open_bttn_click(GtkWidget *bttn, gpointer data);
-- signal for file open dialog
void del_bttn_click(GtkWidget *bttn, GtkWidget *da);
-- callback for delete buttonbttn
-- pointer to the button that the signal is bound toda
-- drawing area
For all of the following functions:
bttn
-- pointer to the button that the signal is bound toparent_window
-- the parent window of the dialog
void move_bttn_click(GtkWidget *bttn, gpointer data);
-- callback for move buttonvoid cp_bttn_click(GtkWidget *bttn, gpointer data);
-- callback for copy-paste button
-
void dc_bttn_click(GtkWidget *bttn, GtkWidget *draw_area);
-- callback for decouple buttonbttn
-- pointer to the button that the signal is bound todrawing_area
-- drawing area
-
void rot_bttn_click(GtkWidget *bttn, GtkWidget *parent_window);
-- callback for rotation buttonbttn
-- pointer to the button that the signal is bound toparent_window
-- the parent window of the dialog
For all of the following functions:
bttn
-- pointer to the button that the signal is bound todata
-- not used
void line_la_dialog_ok_bttn_click(GtkWidget *bttn, gpointer data);
-- callback for OK button in line la dialogvoid rect_wh_dialog_ok_bttn_click(GtkWidget *bttn, gpointer data);
-- callback for OK button in the rect wh dialogvoid arc_dialog_ok_bttn_click(GtkWidget *bttn, gpointer data);
-- callback for OK button in parametric arcs dialogvoid text_dialog_font_button_set(GtkFontButton *bttn, gpointer data);
-- callback for font choosing button in text dialog
For all of the following functions:
bttn
-- pointer to the button that the signal is bound toentry
-- a field containing some necessary data
void save_dialog_ok_bttn_click(GtkWidget *bttn, GtkWidget *entry);
-- callback for OK button in save dialogvoid open_dialog_ok_bttn_click(GtkWidget *bttn, GtkWidget *entry);
-- callback for OK button in open dialogvoid rot_dialog_apply_bttn(GtkWidget *bttn, GtkWidget *entry)
-- callback for apply button in rotation dialogvoid circle_dialog_ok_bttn_click(GtkWidget *bttn, GtkWidget *entry);
-- callback for OK button in parametric circle dialog
-
void text_dialog_ok_bttn_click(GtkWidget *bttn, GtkTextBuffer *tb);
-- callback for OK button in text dialogbttn
-- pointer to the button that the signal is bound totb
-- text buffer that contains text
-
void text_dialog_color_button_set(GtkColorButton *bttn, int *color);
-- gets the RGB color assigned to the buttonbttn
-- pointer to the button that the signal is bound tocolor
-- an array of three elements representing an rgb palette in the range [0; 255]
-
void text_dialog_color_button_click(GtkWidget *bttn, GtkWidget *parent);
-- callback for color button in text dialogbttn
-- pointer to the button that the signal is bound toparent
-- the parent window of the dialog
For all of the following functions:
bttn
-- pointer to the button that the signal is bound toentry
-- a field containing some necessary data
void set_lay_bttn_click(GtkWidget *bttn, GtkWidget *entry);
-- callback for set lay buttonvoid all_bttn_click(GtkWidget *bttn, GtkWidget *entry);
-- callback for all lays buttonvoid add_projection_lay_bttn_click(GtkWidget *bttn, GtkWidget *entry);
-- callback for add projection lay button
bttn
-- pointer to the button that the signal is bound toparent_window
-- the parent window of the dialog
void options_bttn_click(GtkWidget *bttn, GtkWidget *parent_window);
-- callback for options buttonvoid help_bttn_click(GtkWidget *bttn, GtkWidget *parent_window);
-- callback for help button
-
void direction_bttn_click(GtkWidget *bttn, gpointer data);
-- callback for diarection button in line la, rect wh dialogsbttn
-- pointer to the button that the signal is bound todata
-- unused
-
void prm_bttn_click(GtkWidget *bttn, GtkWidget *elms[])
-- callback for prm / free button, its change free / prm drawing modebttn
-- pointer to the button that the signal is bound toelms
-- array of widgets (buttons) to change
-
void unselect(list *node);
-- function for unselectnode
-- figure list
-
void cb_dc(list *lptr);
-- function that decouple figure of given nodenode
-- figure list
this section contains functions that handle clicks, and here you can add and select shapes
CH_WORK_MODES
-- contain work modes of click handler
enum CH_WORK_MODES {
WM_MOVE = FG_TYPE_NONE + 1,
WM_CP,
WM_ROTATE,
WM_TEXT
};
void ch_click_handler(GtkWidget *draw_area, list *lptr, int x, int y);
-- common function for click handling, that call rest handle functionsdraw_area
-- the area where the click occurslptr
-- figure listx
-- the x coordinate of the clicky
-- the y coordinate of the click
-
void ch_set_draw_mode(int new_mode);
-- function for selecting the drawing mode (see figure.h)new_mode
-- new value
-
void ch_set_external_figure(figure *fptr);
-- function for selecting a external figure (only for multi-step figure: line_pp, rect_pp, circle, arc)fptr
-- figure pointer
-
void ch_set_state(int new_state);
-- function that set creation step for multi-step figures (see ch_set_external_figure)new_state
-- new value
int ch_get_draw_mode();
-- function that returns draw mode
For all following functions:
draw_area
-- drawing arealptr
-- figure listx
-- the x coordinate of the cursory
-- the y coordinate of the cursor
void ch_add_point(GtkWidget *draw_area, list *lptr, double x, double y);
-- creates new point by x, y in figure list lptr, and draw it in draw_areavoid ch_add_line_pp(GtkWidget *draw_area, list *lptr, double x, double y);
-- creates new line_pp by x, y in figure list lptr, and draw it in draw_areavoid ch_add_line_la(GtkWidget *draw_area, list *lptr, double x, double y);
-- creates new line_la by x, y in figure list lptr, and draw it in draw_areavoid ch_add_rect_pp(GtkWidget *draw_area, list *lptr, double x, double y);
-- creates new rect_pp by x, y in figure list lptr, and draw it in draw_areavoid ch_add_rect_wh(GtkWidget *draw_area, list *lptr, double x, double y);
-- creates new rect_wh by x, y in figure list lptr, and draw it in draw_areavoid ch_add_circle(GtkWidget *draw_area, list *lptr, double x, double y);
-- creates new circle by x, y in figure list lptr, and draw it in draw_areavoid ch_add_arc(GtkWidget *draw_area, list *lptr, double x, double y);
-- creates new arc by x, y in figure list lptr, and draw it in draw_areavoid ch_add_circle_prm(GtkWidget *draw_area, list *lptr, double x, double y);
-- creates new circle by x and y, and draw it in draw_areavoid ch_add_arc_prm(GtkWidget *draw_area, list *lptr, double x, double y);
-- creates new arc by x and y, and draw it in draw_area
For all following functions:
draw_area
-- drawing arealptr
-- figure listx
-- the x coordinate of the cursory
-- the y coordinate of the cursor
void ch_click_cursor_select(GtkWidget *draw_area, list *lptr, double x, double y);
-- handle a click, when select Cursor modevoid ch_click_cursor_unselect_all(GtkWidget *draw_area, list *lptr, double x, double y);
-- unselect all selected
For all following functions:
lptr
-- figure listx
-- the x coordinate of the cursory
-- the y coordinate of the cursor
list *ch_click_cursor_select_text(list *lptr, double x, double y);
-- function for text selectinglist *ch_click_cursor_select_figure(list *lptr, double x, double y);
-- function for figure selecting
For all following functions:
draw_area
-- drawing arealptr
-- figure listx
-- the x coordinate of the cursory
-- the y coordinate of the cursor
void ch_move(GtkWidget *draw_area, list *lptr, double x, double y);
-- figure movingvoid ch_cp(GtkWidget *draw_area, list *lptr, double x, double y);
-- figure copy-pastevoid ch_rotate(GtkWidget *draw_area, list *lptr, double x, double y);
-- figure rotationvoid ch_text(GtkWidget *draw_area, list *lptr, double x, double y);
-- add text
For all following functions:
lptr
-- figure list
void ch_text_move(list *lptr);
-- text movevoid ch_copy_text(list *lptr);
-- text copy-paste
For all following functions:
lptr
-- figure list
void ch_fugure_move(list *lptr);
-- service function for moving all selected figuresvoid ch_copy_offset(list *lptr);
-- service function for copy-paste all selected figures with movingvoid ch_rot(list *lptr);
-- service function for rotation all selected figuresaround base pointvoid ch_proc_text(list *lptr);
-- sets text coordinatesvoid ch_click_cursor_unselect_text(list *lptr);
-- unselect all selected text
void ch_unselect_last();
-- function that unselect last selected
thats header contain enum and functions for colorisation
DEF_COLORS
-- thats enum contain color set for FlatDraw
enum DEF_COLORS {
CL_DEF_CURS_COLOR = 0,
CL_DEF_DRAW_COLOR,
CL_DEF_PREVIEW_COLOR,
CL_DEF_PROJECTION_COLOR,
CL_DEF_SELECTED_COLOR
};
-
void cl_set_color(cairo_t *cr, int color_set);
-- set drawing color for cairo context cr, form color_set (seeDEF_COLORS
)cr
-- cairo contextcolor_set
-- color mode (seeDEF_COLORS
)
-
void cl_set_color_fg(cairo_t *cr, int fg_color_set);
-- set drawing color for cairo context cr, from VM colorset (see figure.h)cr
-- cairo contextfg_color_set
-- figure color mode (seeVISIBLE_MODES
in figure.h)
that header defines drawing functions
For all following functions:
fptr
-- figure pointer
void dl_draw_figure(figure *fptr);
-- common function for drawing figure thats call rest functionsvoid dl_draw_figure_list(list *lptr);
-- similar todl_draw_figure
, but takes a list of figuresvoid dl_draw_point(figure *fptr);
-- draw pointvoid dl_draw_line_pp(figure *fptr);
-- draw line_ppvoid dl_draw_rect_pp(figure *fptr);
-- draw rect_ppvoid dl_draw_circle(figure *fptr);
-- draw circlevoid dl_draw_arc(figure *fptr);
-- draw arcvoid dl_draw_preview(figure *fptr);
-- draw preview figure (is a milti-step figure, thats not finished, see click_handle.h)
void dl_draw_text(text *tptr);
-- draw texttptr
-- text pointer
-
void dl_set_cairo_context(cairo_t *cr);
-- set a cairo contextcr
-- cairo context
-
void dl_set_preview_coords(double px, double py);
-- set a curcor position, for drawing a preview figurepx
-- preview x coordinatepy
-- preview y coordinate
-
void dl_set_show_preview(int val);
-- enable or disable drawing preview figureval
-- new value
int dl_is_need_draw(figure *fptr);
-- returns 1 if need draw, 0 otherwisefptr
-- figure pointer
void dl_switch_display_all_lays();
-- switch displaying all laysvoid dl_switch_show_preview();
-- switch showing preview figure
void dl_send_preview_figure(figure *fptr);
-- send to draw system a preview figurefptr
-- figure pointer
int dl_get_preview();
-- returns whether or not a thumbnail is shown
this header defines functions for working with .fd files
FD_FORMAT_END
-- this symbol declarates end of figure defenition
void fdl_target_file(char *name);
-- specifies the name of the target filename
-- name of target file
-
void fdl_write_object_stream(FILE *stream, list *lptr);
-- writes lptr to streamstream
-- file stream, wich object will be writtenlptr
-- figure list
-
void fdl_write_from_list(list *lptr);
-- writes figures from list to target filelptr
-- figure list
-
void fdl_read_string(figure *fptr, char *str);
-- reads string from .fd filefptr
-- figure pointerstr
-- buffer
-
void fdl_read_file(list *lptr);
-- read figures from target file to listlptr
-- figure list
For all following functions:
stream
-- the file stream from which the shape will be readlptr
-- figure list
void fdl_pars_figure(FILE *stream, list *lptr);
-- extract figure from filevoid fdl_pars_text(FILE *stream, list *lptr);
-- extract text from file
this header contains functions for working with figures
figure
-- this struct defines a base figure
typedef struct {
double x; // base x coord
double y; // base y coord
// additionals
double a1;
double a2;
double a3;
int type; // figure type (see FG_TYPES)
int visible; // figure visible mode (see VISIBLE_MODES)
int lay; // layer of the figure
} figure;
FG_TYPES
-- this enum defines figure types
enum FG_TYPES {
FG_TYPE_POINT = 0,
FG_TYPE_LINE_PP,
FG_TYPE_LINE_LA,
FG_TYPE_RECT_PP,
FG_TYPE_RECT_WH,
FG_TYPE_CIRCLE,
FG_TYPE_ARC,
FG_TYPE_CIRCLE_PRM,
FG_TYPE_ARC_PRM,
FG_TYPE_NONE // cursor
};
VISIBLE_MODES
-- this enum defines visible modes of figure
enum VISIBLE_MODES {
VM_HIDE = 0,
VM_SHOW,
VM_PREVIEW,
VM_PROJECTION,
VM_SELECTED,
VM_NOT_FINISHED
};
-
figure *figure_new(double type, double x, double y, double a1, double a2, double a3);
-- this function creates a new figure by given parametrs, default visibility - VM_SHOWtype
-- type of the figurex
-- x coordinatey
-- y coordinatea1
-- additional argument 1a1
-- additional argument 2a1
-- additional argument 3
-
figure *figure_new_point(double x, double y);
-- creates new point by x, yx
-- x coordinatey
-- y coordinate
-
figure *figure_new_line_pp(double x1, double y1, double x2, double y2);
-- creates new line_pp by x1, y1 and x2, y2x1
&y1
-- start pointx2
&y2
-- end point
-
figure *figure_new_rect_pp(double x, double y, double w, double h);
-- creates new rect_pp by x1, y1, and x2, y2x
-- x coordinatey
-- y coordinatew
-- weighth
-- height
-
figure *figure_new_circle(double x, double y, double r);
-- creates new circle by x, y with R radiix
-- x coordinatey
-- y coordinater
-- radii
-
figure *figure_new_arc(double xc, double yc, double r, double angle1, double angle2);
-- creates new arc by xc, yc, starts in angle1 and end in angle2 (doesn't work)
-
void figure_free(figure *fptr);
-- free allocated figurefptr
-- figure pointer
-
void figure_free_list(list *lptr);
-- free allocated figure from listlptr
-- figure list
-
int figure_get_current_lay();
-- returns current working layer -
figure *figure_get_from_node(list *lptr);
-- extract figure from node of listlptr
-- figure list
-
void figure_set_visible_by_lay_list(list *lptr, int lay, int vm_mode);
-- set visible mode for figures on given layerlptr
-- figure listlay
-- layer numbervm_mode
-- visible mode
-
void figure_set_current_lay(int new_lay);
-- set currunt working layernew_lay
-- layer number
-
int figure_is_line(figure *fptr);
-- returns 1 if it is line, 0 otherwisefptr
-- figure pointer
-
int figure_is_projection_lay_list(list *lptr, int lay);
-- returns 1 if lay is a projection lay, 0 otherwiselptr
-- figure listlay
-- layer number
For all following functions:
lptr
-- figure listbase (p, l, r)
-- figure pointerangle
-- the angle at which the shape will be rotated
void figure_rotate(list *lptr, figure *base, double angle);
-- rotates the figure contained in thelptr
around thebase
point by anangle
void figure_rotate_point(figure *base, figure *p, double angle);
-- rotates pointp
aroundbase
by anangle
void figure_rotate_line(figure *base, figure *l, double angle);
-- rotates linel
aroundbase
by anangle
void figure_rotate_rect(figure *base, figure *r, double angle, list *lptr);
-- rotates rectangler
aroundbase
by anangle
-
figure *figure_rect_decompose(figure *rect);
-- decomposes rect to 4 linesrect
-- rect to be decouple
-
void figure_fill(figure *fptr, double x, double y, double a1, double a2, double type);
-- fill allocated figure given parametrsfptr
-- figure pointerx
-- x coordinatey
-- y coordinatea1
-- additional argiment 1a2
-- additional argiment 1type
-- figure type (seeFIGURE_TYPES
)
-
void figure_copy(figure *dst, figure *src);
-- copy dst parametrs to srcdst
-- target figuresrc
-- source figure
this header contains geometry processing functions
PI
-- it is pi
-
double gel_calculate_lenght(figure *line);
-- calculates line lenghtline
-- the line whose length will be calculated
-
char *gel_calculate_intersection(figure *line1, figure *line2, figure *p);
-- calculate intersection of 2 linesline1
-- first lineline2
-- second linep
-- result point
-
void gel_calculate_line_la(figure *point, double lenght, double angle);
-- convert line_la to line_pppoint
-- start point of linelenght
-- line lenghtangle
-- line angle
-
double gel_calculate_line_angle(figure *l);
-- calculates angle of linel
-- line
-
double gel_calculate_heron_formula(double a, double b, double c);
-- calculates square by heron formulaa
-- first sideb
-- second sidec
-- third side
For all following functions:
line
-- line by 2 points
double gel_lf_calculate_k(figure *line);
-- calculates k from linear function by given linedouble gel_lf_calculate_b(figure *line);
-- calculates b from linear function by given line
int gel_lf_is_parallel(figure *line1, figure *line2);
-- return 1 if lines are parallelline1
-- first lineline2
-- second line
-
double gel_convert_grades_to_rads(double grades);
-- converts grades to radsgrades
-- value in grades
-
double gel_convert_rads_to_grades(double rads);
-- converts rads to gradesrads
-- value in rads
-
double gel_convert_angle_by_crd(figure *l, double a);
-- converts anglea
by given coordiantes (in view of the coordinate quarter)l
-- linea
-- angle for conversion
-
void gel_convert_crd_by_angle(figure *l, double a, double lx, double ly);
-- converts given coordinates in view of anglea
l
-- start point of linea
-- anglelx
-- end point of line (x)ly
-- end point of line (y)
-
figure *gel_get_middle_point(figure *line);
-- return middle point of lineline
-- line
-
double gel_get_line_angle(figure *l);
-- return angle of linel
-- line
-
double gel_get_max_lenght(figure *a, figure *b, figure *c);
-- returns the length of the longest linea
-- first lineb
-- second linec
-- third line
-
figure *gel_get_equal_point(figure *line1, figure *line2);
-- returns point where lines begins or ends otherwise NULLline1
-- first lineline2
-- second line
-
figure *gel_get_arc_center(figure *l1, figure *l2);
-- returns center of the arcl1
-- first linel2
-- second line
int gel_is_middle_point_area(figure *line, double x, double y, int area);
-- returns 1 if point by x y is a middle point of line in arealine
-- linex
-- x coordinate of pointy
-- y coordinate of pointarea
-- valid area
For all following functions:
l/r/c/p1/area
-- base figurep/p2
-- the figure lying (or not lying) on (inside) the base
int gel_is_point_in_line(figure *l, figure *p);
-- returns 1 if point p lies on the lineint gel_is_point_in_rect(figure *r, figure *p);
-- similar togel_is_point_in_line
int gel_is_point_in_circle(figure *c, figure *p);
-- similar togel_is_point_in_line
int gel_is_point_in_point(figure *p1, figure *p2);
-- similar togel_is_point_in_line
int gel_is_point_in_area(figure *area, figure *p);
-- similar togel_is_point_in_line
void gel_rotate_point(double *x, double *y, double angle);
-- rotate point withx
andy
coordinates onangle
around (0; 0)x
-- x coordinatey
-- y coordinateangle
-- rotate angle
this header contains functions for working with twice-linked lists
list
-- structure of 1 element of list
typedef struct __list__ {
struct __list__ *prev;
struct __list__ *next;
void *data;
OBJ_TYPE dt; // data type
} list;
OBJ_TYPE
-- enum of object types
typedef enum {
OT_FIGURE = 0,
OT_TEXT
} OBJ_TYPE;
list *list_init_node(list *parent);
-- creates new node with parentparent
-- parent (previous) node
For all following functions:
node
-- figure list
void list_free_node(list *node);
-- free nodevoid list_free_list(list *node);
-- free all list
-
list *list_get_last(list *root);
-- returns last element of the listroot
-- some node (or root) of list
-
void *list_get_data(list *lptr);
-- returns data field of the listlptr
-- node pointer
-
void list_add_node(list *root);
-- add new node to end of listroot
-- root of the list
-
void list_set_data(list *node, void *new_data);
-- set data field of the listnode
-- node pointernew_data
-- new value
-
void list_show(list *root);
-- prints list to consoleroot
-- root of the list
-
void list_crawl(list *root, void (*func)(list*));
-- crawls list and call func for each noderoot
-- foor of the listfunc
-- function to be called for each node
this header contains functions and symbols for error handling
ERROR_TYPES
-- this enum stores errors codes
enum ERROR_TYPES {
ET_WRONG_SELECTING = 0
};
void el_set_par_window(GtkWidget *window);
-- sets parent window for error dialogwindow
-- parent window widget
-
void el_call_error(int err_type);
-- calls dialog by given codeerr_type
-- error type (seeERROR_TYPES
)
-
void el_call_dialog(char *msg);
-- creates dialog with given textmsg
-- custom message
this header contains help messages and functions for processing them
HELP_CODES
-- this enum stores help messages codes
enum HELP_CODES {
HC_MAIN = 0,
HC_POINT,
HC_START_POINT,
HC_END_POINT,
HC_CENTER_POINT,
HC_RADIUS_POINT,
HC_CUROR,
HC_INS_POINT,
HC_BASE_POINT
};
char *hl_get_help(int code);
-- returns help message by codecode
-- help code (seeHELP_CODES
)
-
void hl_set_widget(GtkWidget *label);
-- sets label for help messageslabel
-- label, that will used for hints showing
-
void hl_set_help(int code);
-- sets help message by codecode
-- help code (seeHELP_CODES
)
this header contains functions for combine text and figures
multi_obj
-- this struct implements multi_obj -- common interface for figure and text
typedef struct {
double x;
double y;
int visible;
int lay;
} multi_obj;
For all following functions:
lptr
-- list pointer
void mol_free_from_node(list *lptr);
-- common interface for freeing up memoryvoid mol_draw_obj_from_node(list *lptr);
-- common interface for drawing objects (figure and text)figure *mol_conv_to_figure(list *lptr);
-- converts multi_object to point
For all following functions:
lptr
-- list pointer
multi_obj *mol_extract(list *lptr);
-- extracts multi_obj from a list nodemulti_obj *mol_extract_from_text(list *lptr);
-- extract multi_obj from text structuremulti_obj *mol_extract_from_figure(list *lptr);
-- extract multi_obj from figure structure
For all following functions:
lptr
-- list pointermo
-- multi_obj pointer
void mol_apply(list *lptr, multi_obj *mo);
-- writes multi_obj to list nodevoid mol_apply_text(list *lptr, multi_obj *mo);
-- writes multi_obj to textvoid mol_apply_figure(list *lptr, multi_obj *mo);
-- writes multi_obj to figure
this header contains functions for text processing
text
-- implements text
typedef struct {
char *buffer;
char *font;
int size;
int color_r;
int color_g;
int color_b;
int visible;
double x;
double y;
int lay;
} text;
For all following functions:
tptr
-- text pointer
void tl_free(text *tptr);
-- frees textvoid tl_free_buffer(text *tptr);
-- free buffer of text
-
text *tl_new(char *font, int size, int r, int g, int b);
-- creates new textfont
-- fontsize
-- text sizer
&g
&b
-- RGB palette in the range [0; 255]
-
void tl_add_buffer(text *tptr, char *buf);
-- adds buffer to texttptr
-- text pointerbuf
-- buffer
this header contains utility functions
-
double ul_map(double x, double in_min, double in_max, double out_min, double out_max);
-- converts a value from one system of units to anotherx
-- converted valuein_min
&in_max
-- values of range [in_min; in_max] which contains xout_min
&out_max
-- values of range [out_min; out_max]
-
void ul_get_colors(int *arr, GtkWidget *color_entry);
-- writes colors of color_entry to arrarr
-- the array to return the palette tocolor_entry
-- a field containing the feed text:R G B
-
void ul_pars_font(char *str, char *font_name, char *font_size);
-- parses a string like "font-name font-size", returns the result in argumentsstr
-- str cantaining text: "Font-name font-size"font_name
-- a buffer in which to return the name of the fontfont_size
-- a buffer int which to return the size of the font
FlatDraw v0.17 17.02.2021 by Centrix14