Line data Source code
1 : /* File: gui_sketch_request.inl; Copyright and License: see below */ 2 : 3 : #include "u8/u8_trace.h" 4 : #include <stdio.h> 5 : #include <stdlib.h> 6 : #include <assert.h> 7 : 8 0 : static inline void gui_sketch_request_init( gui_sketch_request_t *this_ ) 9 : { 10 0 : (*this_).tool_mode = GUI_TOOL_NAVIGATE; 11 0 : data_id_init_void ( &((*this_).focused_diagram) ); 12 0 : data_id_init_void ( &((*this_).parent_diagram) ); 13 0 : data_small_set_init( &((*this_).search_result_diagrams) ); 14 0 : } 15 : 16 0 : static inline void gui_sketch_request_reinit( gui_sketch_request_t *this_ ) 17 : { 18 0 : (*this_).tool_mode = GUI_TOOL_NAVIGATE; 19 0 : data_id_reinit_void ( &((*this_).focused_diagram) ); 20 0 : data_id_reinit_void ( &((*this_).parent_diagram) ); 21 0 : data_small_set_reinit( &((*this_).search_result_diagrams) ); 22 0 : } 23 : 24 0 : static inline void gui_sketch_request_destroy( gui_sketch_request_t *this_ ) 25 : { 26 0 : (*this_).tool_mode = GUI_TOOL_NAVIGATE; 27 0 : data_id_destroy ( &((*this_).focused_diagram) ); 28 0 : data_id_destroy ( &((*this_).parent_diagram) ); 29 0 : data_small_set_destroy( &((*this_).search_result_diagrams) ); 30 0 : } 31 : 32 0 : static inline gui_tool_t gui_sketch_request_get_tool_mode( const gui_sketch_request_t *this_ ) 33 : { 34 0 : return (*this_).tool_mode; 35 : } 36 : 37 0 : static inline void gui_sketch_request_set_tool_mode( gui_sketch_request_t *this_, gui_tool_t tool_mode ) 38 : { 39 0 : switch ( tool_mode ) 40 : { 41 0 : case GUI_TOOL_NAVIGATE: 42 : { 43 0 : U8_TRACE_INFO("GUI_TOOL_NAVIGATE"); 44 : } 45 0 : break; 46 : 47 0 : case GUI_TOOL_EDIT: 48 : { 49 0 : U8_TRACE_INFO("GUI_TOOL_EDIT"); 50 : } 51 0 : break; 52 : 53 0 : case GUI_TOOL_SEARCH: 54 : { 55 0 : U8_TRACE_INFO("GUI_TOOL_SEARCH"); 56 : } 57 0 : break; 58 : 59 0 : case GUI_TOOL_CREATE: 60 : { 61 0 : U8_TRACE_INFO("GUI_TOOL_CREATE"); 62 : } 63 0 : break; 64 : 65 0 : default: 66 : { 67 0 : U8_LOG_ERROR("selected_tool is out of range"); 68 : } 69 0 : break; 70 : } 71 : 72 0 : (*this_).tool_mode = tool_mode; 73 0 : } 74 : 75 0 : static inline data_id_t gui_sketch_request_get_focused_diagram( const gui_sketch_request_t *this_ ) 76 : { 77 0 : return (*this_).focused_diagram; 78 : } 79 : 80 : static inline data_row_id_t gui_sketch_request_get_focused_diagram_row_id( const gui_sketch_request_t *this_ ) 81 : { 82 : return data_id_get_row_id( &((*this_).focused_diagram) ); 83 : } 84 : 85 0 : static inline void gui_sketch_request_set_focused_diagram( gui_sketch_request_t *this_, data_id_t focused_diagram ) 86 : { 87 0 : (*this_).focused_diagram = focused_diagram; 88 0 : data_id_trace( &((*this_).focused_diagram) ); 89 0 : } 90 : 91 : static inline void gui_sketch_request_set_focused_diagram_row_id( gui_sketch_request_t *this_, data_row_id_t focused_diagram ) 92 : { 93 : data_id_reinit( &((*this_).focused_diagram), DATA_TABLE_DIAGRAM, focused_diagram ); 94 : data_id_trace( &((*this_).focused_diagram) ); 95 : } 96 : 97 0 : static inline data_id_t gui_sketch_request_get_parent_diagram( const gui_sketch_request_t *this_ ) 98 : { 99 0 : return (*this_).parent_diagram; 100 : } 101 : 102 : static inline data_row_id_t gui_sketch_request_get_parent_diagram_row_id( const gui_sketch_request_t *this_ ) 103 : { 104 : return data_id_get_row_id( &((*this_).parent_diagram ) ); 105 : } 106 : 107 0 : static inline void gui_sketch_request_set_parent_diagram( gui_sketch_request_t *this_, data_id_t parent_diagram ) 108 : { 109 0 : (*this_).parent_diagram = parent_diagram; 110 0 : data_id_trace( &((*this_).parent_diagram) ); 111 0 : } 112 : 113 : static inline void gui_sketch_request_set_parent_diagram_row_id( gui_sketch_request_t *this_, data_row_id_t parent_diagram ) 114 : { 115 : data_id_reinit( &((*this_).parent_diagram), DATA_TABLE_DIAGRAM, parent_diagram ); 116 : data_id_trace( &((*this_).parent_diagram) ); 117 : } 118 : 119 0 : static inline const data_small_set_t * gui_sketch_request_get_search_result_diagrams_const( const gui_sketch_request_t *this_ ) 120 : { 121 0 : return &((*this_).search_result_diagrams); 122 : } 123 : 124 0 : static inline data_small_set_t * gui_sketch_request_get_search_result_diagrams_ptr( gui_sketch_request_t *this_ ) 125 : { 126 0 : return &((*this_).search_result_diagrams); 127 : } 128 : 129 : 130 : /* 131 : Copyright 2021-2024 Andreas Warnke 132 : 133 : Licensed under the Apache License, Version 2.0 (the "License"); 134 : you may not use this file except in compliance with the License. 135 : You may obtain a copy of the License at 136 : 137 : http://www.apache.org/licenses/LICENSE-2.0 138 : 139 : Unless required by applicable law or agreed to in writing, software 140 : distributed under the License is distributed on an "AS IS" BASIS, 141 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 142 : See the License for the specific language governing permissions and 143 : limitations under the License. 144 : */