1use crate::makepad_micro_serde::*;
2use crate::makepad_derive_live::*;
3use crate::LiveId;
4use crate::action::*;
5use crate::log::LogLevel;
6#[derive(SerBin, DeBin, Debug)]
9pub struct EventSample{
10 pub event_u32: u32,
11 pub event_meta: u64,
12 pub start: f64,
13 pub end: f64,
14}
15
16#[derive(SerBin, DeBin, Debug)]
17pub struct GPUSample{
18 pub start: f64,
19 pub end: f64,
20}
21
22#[derive(SerBin, DeBin, Debug)]
23pub struct StudioLogItem{
24 pub file_name:String,
25 pub line_start: u32,
26 pub line_end: u32,
27 pub column_start: u32,
28 pub column_end: u32,
29 pub message: String,
30 pub explanation: Option<String>,
31 pub level: LogLevel
32}
33
34#[derive(SerBin, DeBin, Debug, Clone)]
35pub struct JumpToFile{
36 pub file_name: String,
37 pub line: u32,
38 pub column: u32
39}
40
41#[derive(SerBin, DeBin, Debug, Clone)]
42pub struct PatchFile{
43 pub file_name: String,
44 pub line: u32,
45 pub column_start: u32,
46 pub column_end: u32,
47 pub undo_group: u64,
48 pub replace: String
49}
50
51#[derive(SerBin, DeBin, SerRon, DeRon, Debug, Clone)]
52pub struct DesignerComponentPosition{
53 pub id: LiveId,
54 pub left: f64,
55 pub top: f64,
56 pub width: f64,
57 pub height: f64
58}
59
60
61#[derive(Default, SerBin, DeBin, SerRon, DeRon, Debug, Clone)]
62pub struct DesignerZoomPan{
63 pub zoom: f64,
64 pub pan_x: f64,
65 pub pan_y: f64,
66}
67
68#[derive(SerBin, DeBin, Debug, Clone)]
69pub struct EditFile{
70 pub file_name: String,
71 pub line_start: u32,
72 pub line_end: u32,
73 pub column_start: u32,
74 pub column_end: u32,
75 pub replace: String
76}
77
78#[derive(SerBin, DeBin, Debug, Clone)]
79pub struct SelectInFile{
80 pub file_name: String,
81 pub line_start: u32,
82 pub line_end: u32,
83 pub column_start: u32,
84 pub column_end: u32,
85}
86
87#[derive(SerBin, DeBin, Debug, Clone)]
88pub struct SwapSelection{
89 pub s1_file_name: String,
90 pub s1_line_start: u32,
91 pub s1_line_end: u32,
92 pub s1_column_start: u32,
93 pub s1_column_end: u32,
94 pub s2_file_name: String,
95 pub s2_line_start: u32,
96 pub s2_line_end: u32,
97 pub s2_column_start: u32,
98 pub s2_column_end: u32,
99}
100
101
102#[derive(SerBin, DeBin, Debug)]
103pub enum AppToStudio{
104 LogItem(StudioLogItem),
105 EventSample(EventSample),
106 GPUSample(GPUSample),
107 JumpToFile(JumpToFile),
108 SelectInFile(SelectInFile),
109 PatchFile(PatchFile),
110 DesignerComponentMoved(DesignerComponentPosition),
111 DesignerZoomPan(DesignerZoomPan),
112 EditFile(EditFile),
113 DesignerStarted,
114 DesignerFileSelected{
115 file_name:String,
116 },
117 SwapSelection(SwapSelection),
118 Screenshot(StudioScreenshotResponse),
119 FocusDesign
120}
121
122#[derive(SerBin, DeBin, Debug)]
123pub struct StudioScreenshotResponse{
124 pub request_ids: Vec<u64>,
125 pub image: Option<Vec<u8>>,
126 pub width: u32,
127 pub height: u32
128}
129
130#[derive(SerBin, DeBin)]
131pub struct AppToStudioVec(pub Vec<AppToStudio>);
132
133#[derive(Debug, Default, SerBin, DeBin)]
134pub struct StudioScreenshotRequest{
135 pub request_id: u64,
136 pub kind_id: u32
137}
138
139#[derive(Debug, DefaultNone, SerBin, DeBin)]
140pub enum StudioToApp{
141 Screenshot(StudioScreenshotRequest),
142 KeepAlive,
143 LiveChange{
144 file_name: String,
145 content: String
146 },
147 DesignerLoadState{
148 zoom_pan: DesignerZoomPan,
149 positions: Vec<DesignerComponentPosition>
150 },
151 DesignerSelectFile{
152 file_name: String,
153 },
154 None,
155}
156
157#[derive(SerBin, DeBin)]
158pub struct StudioToAppVec(pub Vec<StudioToApp>);