File: gui_sketch_request.inl

package info (click to toggle)
crystal-facet-uml 1.47.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 17,628 kB
  • sloc: ansic: 101,927; xml: 2,677; sh: 114; cpp: 62; makefile: 51
file content (144 lines) | stat: -rw-r--r-- 4,442 bytes parent folder | download
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
/* File: gui_sketch_request.inl; Copyright and License: see below */

#include "u8/u8_trace.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

static inline void gui_sketch_request_init( gui_sketch_request_t *this_ )
{
    (*this_).tool_mode = GUI_TOOL_NAVIGATE;
    data_id_init_void ( &((*this_).focused_diagram) );
    data_id_init_void ( &((*this_).parent_diagram) );
    data_small_set_init( &((*this_).search_result_diagrams) );
}

static inline void gui_sketch_request_reinit( gui_sketch_request_t *this_ )
{
    (*this_).tool_mode = GUI_TOOL_NAVIGATE;
    data_id_reinit_void ( &((*this_).focused_diagram) );
    data_id_reinit_void ( &((*this_).parent_diagram) );
    data_small_set_reinit( &((*this_).search_result_diagrams) );
}

static inline void gui_sketch_request_destroy( gui_sketch_request_t *this_ )
{
    (*this_).tool_mode = GUI_TOOL_NAVIGATE;
    data_id_destroy ( &((*this_).focused_diagram) );
    data_id_destroy ( &((*this_).parent_diagram) );
    data_small_set_destroy( &((*this_).search_result_diagrams) );
}

static inline gui_tool_t gui_sketch_request_get_tool_mode( const gui_sketch_request_t *this_ )
{
    return (*this_).tool_mode;
}

static inline void gui_sketch_request_set_tool_mode( gui_sketch_request_t *this_, gui_tool_t tool_mode )
{
    switch ( tool_mode )
    {
        case GUI_TOOL_NAVIGATE:
        {
            U8_TRACE_INFO("GUI_TOOL_NAVIGATE");
        }
        break;

        case GUI_TOOL_EDIT:
        {
            U8_TRACE_INFO("GUI_TOOL_EDIT");
        }
        break;

        case GUI_TOOL_SEARCH:
        {
            U8_TRACE_INFO("GUI_TOOL_SEARCH");
        }
        break;

        case GUI_TOOL_CREATE:
        {
            U8_TRACE_INFO("GUI_TOOL_CREATE");
        }
        break;

        default:
        {
            U8_LOG_ERROR("selected_tool is out of range");
        }
        break;
    }

    (*this_).tool_mode = tool_mode;
}

static inline data_id_t gui_sketch_request_get_focused_diagram( const gui_sketch_request_t *this_ )
{
    return (*this_).focused_diagram;
}

static inline data_row_id_t gui_sketch_request_get_focused_diagram_row_id( const gui_sketch_request_t *this_ )
{
    return data_id_get_row_id( &((*this_).focused_diagram) );
}

static inline void gui_sketch_request_set_focused_diagram( gui_sketch_request_t *this_, data_id_t focused_diagram )
{
    (*this_).focused_diagram = focused_diagram;
    data_id_trace( &((*this_).focused_diagram) );
}

static inline void gui_sketch_request_set_focused_diagram_row_id( gui_sketch_request_t *this_, data_row_id_t focused_diagram )
{
    data_id_reinit( &((*this_).focused_diagram), DATA_TABLE_DIAGRAM, focused_diagram );
    data_id_trace( &((*this_).focused_diagram) );
}

static inline data_id_t gui_sketch_request_get_parent_diagram( const gui_sketch_request_t *this_ )
{
    return (*this_).parent_diagram;
}

static inline data_row_id_t gui_sketch_request_get_parent_diagram_row_id( const gui_sketch_request_t *this_ )
{
    return data_id_get_row_id( &((*this_).parent_diagram ) );
}

static inline void gui_sketch_request_set_parent_diagram( gui_sketch_request_t *this_, data_id_t parent_diagram )
{
    (*this_).parent_diagram = parent_diagram;
    data_id_trace( &((*this_).parent_diagram) );
}

static inline void gui_sketch_request_set_parent_diagram_row_id( gui_sketch_request_t *this_, data_row_id_t parent_diagram )
{
    data_id_reinit( &((*this_).parent_diagram), DATA_TABLE_DIAGRAM, parent_diagram );
    data_id_trace( &((*this_).parent_diagram) );
}

static inline const data_small_set_t * gui_sketch_request_get_search_result_diagrams_const( const gui_sketch_request_t *this_ )
{
    return &((*this_).search_result_diagrams);
}

static inline data_small_set_t * gui_sketch_request_get_search_result_diagrams_ptr( gui_sketch_request_t *this_ )
{
    return &((*this_).search_result_diagrams);
}


/*
Copyright 2021-2023 Andreas Warnke

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/