@@ -127,27 +127,26 @@ static void dtmf_dolphin_dialer_draw_callback(Canvas* canvas, void* _model) {
127127
128128 draw_dialer (canvas , model );
129129
130- string_t output ;
131- string_init (output );
130+ FuriString * output = furi_string_alloc ();
132131
133132 if (model -> freq1 && model -> freq2 ) {
134- string_cat_printf (
133+ furi_string_cat_printf (
135134 output ,
136135 "Dual Tone\nF1: %u Hz\nF2: %u Hz\n" ,
137136 (unsigned int ) model -> freq1 ,
138137 (unsigned int ) model -> freq2 );
139138 } else if (model -> freq1 ) {
140- string_cat_printf (
139+ furi_string_cat_printf (
141140 output ,
142141 "Single Tone\nF: %u Hz\n" ,
143142 (unsigned int ) model -> freq1 );
144143 }
145144
146145 canvas_set_font (canvas , FontSecondary );
147146 canvas_set_color (canvas , ColorBlack );
148- elements_multiline_text (canvas , (max_span * DTMF_DOLPHIN_BUTTON_WIDTH ) + 4 , 21 , string_get_cstr (output ));
147+ elements_multiline_text (canvas , (max_span * DTMF_DOLPHIN_BUTTON_WIDTH ) + 4 , 21 , furi_string_get_cstr (output ));
149148
150- string_clear (output );
149+ furi_string_free (output );
151150}
152151
153152static bool dtmf_dolphin_dialer_input_callback (InputEvent * event , void * context ) {
@@ -175,7 +174,9 @@ static bool dtmf_dolphin_dialer_input_callback(InputEvent* event, void* context)
175174
176175static bool dtmf_dolphin_dialer_process_up (DTMFDolphinDialer * dtmf_dolphin_dialer ) {
177176 with_view_model (
178- dtmf_dolphin_dialer -> view , (DTMFDolphinDialerModel * model ) {
177+ dtmf_dolphin_dialer -> view ,
178+ DTMFDolphinDialerModel * model ,
179+ {
179180 uint8_t span = 0 ;
180181 uint8_t cursor = model -> row ;
181182 while (span == 0 && cursor > 0 ) {
@@ -185,8 +186,8 @@ static bool dtmf_dolphin_dialer_process_up(DTMFDolphinDialer* dtmf_dolphin_diale
185186 if (span != 0 ) {
186187 model -> row = cursor ;
187188 }
188- return true;
189- } );
189+ },
190+ true );
190191 return true;
191192}
192193
@@ -197,7 +198,9 @@ static bool dtmf_dolphin_dialer_process_down(DTMFDolphinDialer* dtmf_dolphin_dia
197198 dtmf_dolphin_tone_get_max_pos (& max_rows , & max_cols , & max_span );
198199
199200 with_view_model (
200- dtmf_dolphin_dialer -> view , (DTMFDolphinDialerModel * model ) {
201+ dtmf_dolphin_dialer -> view ,
202+ DTMFDolphinDialerModel * model ,
203+ {
201204 uint8_t span = 0 ;
202205 uint8_t cursor = model -> row ;
203206 while (span == 0 && cursor < max_rows - 1 ) {
@@ -207,14 +210,16 @@ static bool dtmf_dolphin_dialer_process_down(DTMFDolphinDialer* dtmf_dolphin_dia
207210 if (span != 0 ) {
208211 model -> row = cursor ;
209212 }
210- return true;
211- } );
213+ },
214+ true );
212215 return true;
213216}
214217
215218static bool dtmf_dolphin_dialer_process_left (DTMFDolphinDialer * dtmf_dolphin_dialer ) {
216219 with_view_model (
217- dtmf_dolphin_dialer -> view , (DTMFDolphinDialerModel * model ) {
220+ dtmf_dolphin_dialer -> view ,
221+ DTMFDolphinDialerModel * model ,
222+ {
218223 uint8_t span = 0 ;
219224 uint8_t cursor = model -> col ;
220225 while (span == 0 && cursor > 0 ) {
@@ -224,8 +229,8 @@ static bool dtmf_dolphin_dialer_process_left(DTMFDolphinDialer* dtmf_dolphin_dia
224229 if (span != 0 ) {
225230 model -> col = cursor ;
226231 }
227- return true;
228- } );
232+ },
233+ true );
229234 return true;
230235}
231236
@@ -236,7 +241,9 @@ static bool dtmf_dolphin_dialer_process_right(DTMFDolphinDialer* dtmf_dolphin_di
236241 dtmf_dolphin_tone_get_max_pos (& max_rows , & max_cols , & max_span );
237242
238243 with_view_model (
239- dtmf_dolphin_dialer -> view , (DTMFDolphinDialerModel * model ) {
244+ dtmf_dolphin_dialer -> view ,
245+ DTMFDolphinDialerModel * model ,
246+ {
240247 uint8_t span = 0 ;
241248 uint8_t cursor = model -> col ;
242249 while (span == 0 && cursor < max_cols - 1 ) {
@@ -246,24 +253,25 @@ static bool dtmf_dolphin_dialer_process_right(DTMFDolphinDialer* dtmf_dolphin_di
246253 if (span != 0 ) {
247254 model -> col = cursor ;
248255 }
249- return true;
250- } );
256+ },
257+ true );
251258 return true;
252259}
253260
254261static bool dtmf_dolphin_dialer_process_ok (DTMFDolphinDialer * dtmf_dolphin_dialer , InputEvent * event ) {
255262 bool consumed = false;
256263
257264 with_view_model (
258- dtmf_dolphin_dialer -> view , (DTMFDolphinDialerModel * model ) {
265+ dtmf_dolphin_dialer -> view ,
266+ DTMFDolphinDialerModel * model ,
267+ {
259268 if (event -> type == InputTypePress ) {
260269 model -> playing = dtmf_dolphin_audio_play_tones (model -> freq1 , model -> freq2 );
261270 } else if (event -> type == InputTypeRelease ) {
262271 model -> playing = !dtmf_dolphin_audio_stop_tones ();
263272 }
264-
265- return true;
266- });
273+ },
274+ true);
267275
268276 return consumed ;
269277}
@@ -273,15 +281,17 @@ static void dtmf_dolphin_dialer_enter_callback(void* context) {
273281 DTMFDolphinDialer * dtmf_dolphin_dialer = context ;
274282
275283 with_view_model (
276- dtmf_dolphin_dialer -> view , (DTMFDolphinDialerModel * model ) {
284+ dtmf_dolphin_dialer -> view ,
285+ DTMFDolphinDialerModel * model ,
286+ {
277287 model -> col = 0 ;
278288 model -> row = 0 ;
279289 model -> section = 0 ;
280290 model -> freq1 = 0.0 ;
281291 model -> freq2 = 0.0 ;
282292 model -> playing = false;
283- return true;
284- }
293+ },
294+ true
285295 );
286296}
287297
@@ -292,15 +302,17 @@ DTMFDolphinDialer* dtmf_dolphin_dialer_alloc() {
292302 view_allocate_model (dtmf_dolphin_dialer -> view , ViewModelTypeLocking , sizeof (DTMFDolphinDialerModel ));
293303
294304 with_view_model (
295- dtmf_dolphin_dialer -> view , (DTMFDolphinDialerModel * model ) {
305+ dtmf_dolphin_dialer -> view ,
306+ DTMFDolphinDialerModel * model ,
307+ {
296308 model -> col = 0 ;
297309 model -> row = 0 ;
298310 model -> section = 0 ;
299311 model -> freq1 = 0.0 ;
300312 model -> freq2 = 0.0 ;
301313 model -> playing = false;
302- return true;
303- }
314+ },
315+ true
304316 );
305317
306318 view_set_context (dtmf_dolphin_dialer -> view , dtmf_dolphin_dialer );
0 commit comments