diff options
author | Adam NAILI | 2017-12-28 22:52:28 +0100 |
---|---|---|
committer | Adam NAILI | 2017-12-28 22:52:28 +0100 |
commit | 9ed3c28a0335137d34e51d5fd49be6e523f65a89 (patch) | |
tree | 1abc903ff235f921eecadcbb68fe7a37449274e0 /include/gui | |
parent | 9e4eb30f33867bcb37d5accfb5588cfb3b450f90 (diff) | |
download | morpher-9ed3c28a0335137d34e51d5fd49be6e523f65a89.tar.gz |
Implementing the add constraint feature, need to be fixed
Diffstat (limited to 'include/gui')
-rw-r--r-- | include/gui/button.h | 3 | ||||
-rw-r--r-- | include/gui/component.h | 6 | ||||
-rw-r--r-- | include/gui/pictureframe.h | 38 |
3 files changed, 39 insertions, 8 deletions
diff --git a/include/gui/button.h b/include/gui/button.h index 6f91e37..26d7970 100644 --- a/include/gui/button.h +++ b/include/gui/button.h | |||
@@ -1,6 +1,5 @@ | |||
1 | #ifndef UPEM_MORPHING_BUTTON | 1 | #ifndef UPEM_MORPHING_BUTTON |
2 | #define UPEM_MORPHING_BUTTON | 2 | #define UPEM_MORPHING_BUTTON |
3 | |||
4 | /** | 3 | /** |
5 | * File: button.h | 4 | * File: button.h |
6 | * Buttons handling | 5 | * Buttons handling |
@@ -58,6 +57,7 @@ void button_print(Component *parameterSelf); | |||
58 | */ | 57 | */ |
59 | void button_click_test(int x, int y, Component *parameterSelf); | 58 | void button_click_test(int x, int y, Component *parameterSelf); |
60 | 59 | ||
60 | void button_click_add_constraint(int x, int y, Component *parameterSelf); | ||
61 | /** | 61 | /** |
62 | * Function: button_is_selected | 62 | * Function: button_is_selected |
63 | * Checks if the button is selected or not. | 63 | * Checks if the button is selected or not. |
@@ -70,6 +70,7 @@ void button_click_test(int x, int y, Component *parameterSelf); | |||
70 | * Returns: | 70 | * Returns: |
71 | * A bool from stdbool | 71 | * A bool from stdbool |
72 | */ | 72 | */ |
73 | |||
73 | bool button_is_selected(int x, int y, Button *button); | 74 | bool button_is_selected(int x, int y, Button *button); |
74 | 75 | ||
75 | #endif | 76 | #endif |
diff --git a/include/gui/component.h b/include/gui/component.h index dd101dc..0e8f437 100644 --- a/include/gui/component.h +++ b/include/gui/component.h | |||
@@ -1,7 +1,10 @@ | |||
1 | #ifndef UPEM_C_COMPONENT_H | 1 | #ifndef UPEM_C_COMPONENT_H |
2 | #define UPEM_C_COMPONENT_H | 2 | #define UPEM_C_COMPONENT_H |
3 | typedef enum { | ||
4 | WAITING_BUTTON, INSERT_ORIGIN, INSERT_TARGET,PRINTING | ||
5 | } Mode; | ||
3 | 6 | ||
4 | #include <stdbool.h> | 7 | extern Mode mode; |
5 | /** | 8 | /** |
6 | * File: component.h | 9 | * File: component.h |
7 | * Windows and components handling. | 10 | * Windows and components handling. |
@@ -38,7 +41,6 @@ typedef void (*PrintMethod)(struct Component *); | |||
38 | typedef struct Component { | 41 | typedef struct Component { |
39 | int width, height; | 42 | int width, height; |
40 | int x_pos, y_pos; | 43 | int x_pos, y_pos; |
41 | bool activated; | ||
42 | ClickHandler click_handler; | 44 | ClickHandler click_handler; |
43 | PrintMethod print_method; | 45 | PrintMethod print_method; |
44 | } Component; | 46 | } Component; |
diff --git a/include/gui/pictureframe.h b/include/gui/pictureframe.h index 1f5407c..f06a530 100644 --- a/include/gui/pictureframe.h +++ b/include/gui/pictureframe.h | |||
@@ -1,13 +1,14 @@ | |||
1 | #ifndef UPEM_MORPHING_PITUREFRAME | 1 | #ifndef UPEM_MORPHING_PITUREFRAME |
2 | #define UPEM_MORPHING_PITUREFRAME | 2 | #define UPEM_MORPHING_PITUREFRAME |
3 | 3 | ||
4 | #include <blender/canvas.h> | ||
5 | #include <morpher/morphing.h> | 4 | #include <morpher/morphing.h> |
5 | #include <painter/canvas.h> | ||
6 | #include "component.h" | 6 | #include "component.h" |
7 | |||
8 | /** | 7 | /** |
9 | * File: pictureframe.h | 8 | * File: pictureframe.h |
10 | */ | 9 | */ |
10 | |||
11 | CartesianVector savedPoint; | ||
11 | /** | 12 | /** |
12 | * Type: CartesianMappingDivision | 13 | * Type: CartesianMappingDivision |
13 | * Type of functions needed to split CartesianMapping and keep only the CartesianVector needed, related to the type of PictureFrame involved | 14 | * Type of functions needed to split CartesianMapping and keep only the CartesianVector needed, related to the type of PictureFrame involved |
@@ -49,8 +50,24 @@ CartesianVector pictureframe_origin_split(const CartesianMapping *cartesianMappi | |||
49 | */ | 50 | */ |
50 | CartesianVector pictureframe_target_split(const CartesianMapping *cartesianMapping); | 51 | CartesianVector pictureframe_target_split(const CartesianMapping *cartesianMapping); |
51 | 52 | ||
53 | bool pictureframe_is_selected(int x, int y, PictureFrame *pictureFrame); | ||
54 | |||
55 | /** | ||
56 | * Function: pictureframe_conversion_to_origin | ||
57 | * Returns the relative coordinate on the picture corresponding to the input values | ||
58 | * | ||
59 | * Parameters: | ||
60 | * x - value on x axis from the origin of the window to convert | ||
61 | * y - value on y axis from the origin of the window to convert | ||
62 | * *pictureFrame - pointer to the reference pictureframe that will give his relative coordinates | ||
63 | */ | ||
64 | CartesianVector pictureframe_conversion_to_origin(int x, int y, PictureFrame *pictureFrame); | ||
65 | |||
66 | CartesianVector pictureframe_conversion_to_picture(int x, int y, PictureFrame *pictureFrame); | ||
67 | |||
52 | void pictureframe_init(PictureFrame *pictureFrame, int width, int height, int x_pos, int y_pos, | 68 | void pictureframe_init(PictureFrame *pictureFrame, int width, int height, int x_pos, int y_pos, |
53 | CartesianMappingDivision cartesianMappingDivision, Morphing *morphing, Canvas *canvas); | 69 | CartesianMappingDivision cartesianMappingDivision, Morphing *morphing, Canvas *canvas, |
70 | ClickHandler clickHandler); | ||
54 | 71 | ||
55 | void pictureframe_free(PictureFrame *pictureFrame); | 72 | void pictureframe_free(PictureFrame *pictureFrame); |
56 | 73 | ||
@@ -73,7 +90,18 @@ void pictureframe_draw_canvas(PictureFrame *pictureFrame); | |||
73 | void pictureframe_print(Component *parameterSelf); | 90 | void pictureframe_print(Component *parameterSelf); |
74 | 91 | ||
75 | /** | 92 | /** |
76 | * Function: pictureframe_click_handler | 93 | * Function: pictureframe_click_handler_origin |
94 | * Adds a point on the coordinate of the picture that the mouse is pointing. | ||
95 | * | ||
96 | * Parameters: | ||
97 | * x_pos - coordinate on x axis of the mouse | ||
98 | * y_pos - coordinate on y axis of the mouse | ||
99 | * *parameterSelf - pointer that will be casted into a PictureFrame | ||
100 | */ | ||
101 | void pictureframe_click_handler_origin(int x_pos, int y_pos, Component *parameterSelf); | ||
102 | |||
103 | /** | ||
104 | * Function: pictureframe_click_handler_target | ||
77 | * Adds a point on the coordinate of the picture that the mouse is pointing. | 105 | * Adds a point on the coordinate of the picture that the mouse is pointing. |
78 | * | 106 | * |
79 | * Parameters: | 107 | * Parameters: |
@@ -81,7 +109,7 @@ void pictureframe_print(Component *parameterSelf); | |||
81 | * y_pos - coordinate on y axis of the mouse | 109 | * y_pos - coordinate on y axis of the mouse |
82 | * *parameterSelf - pointer that will be casted into a PictureFrame | 110 | * *parameterSelf - pointer that will be casted into a PictureFrame |
83 | */ | 111 | */ |
84 | void pictureframe_click_handler(int x_pos, int y_pos, Component *parameterSelf); | 112 | void pictureframe_click_handler_target(int x_pos, int y_pos, Component *parameterSelf); |
85 | 113 | ||
86 | 114 | ||
87 | #endif | 115 | #endif |