@@ -58,16 +58,7 @@ static void free_particles_resources(gui_view_t *view);
5858 * Variables
5959 *============================================================================*/
6060/* View Management */
61- static gui_view_t * current_view = NULL ;
62-
63- static gui_view_descriptor_t const descriptor =
64- {
65- /* change Here for current view */
66- .name = (const char * )CURRENT_VIEW_NAME ,
67- .pView = & current_view ,
68- .on_switch_in = butterfly_particle_app ,
69- .on_switch_out = free_particles_resources ,
70- };
61+ GUI_VIEW_INSTANCE (CURRENT_VIEW_NAME , false, butterfly_particle_app , free_particles_resources );
7162
7263/* Butterfly Design */
7364gui_img_t * butterfly_wing1 = NULL ;
@@ -109,15 +100,6 @@ static char date_text_content[10];
109100/*============================================================================*
110101 * Private Functions
111102 *============================================================================*/
112- static int gui_view_descriptor_register_init (void )
113- {
114- gui_view_descriptor_register (& descriptor );
115- gui_log ("File: %s, Function: %s\n" , __FILE__ , __func__ );
116- return 0 ;
117- }
118- static GUI_INIT_VIEW_DESCRIPTOR_REGISTER (gui_view_descriptor_register_init );
119-
120-
121103static int x_to_screen_w (float butterfly_x )
122104{
123105 float a = 30.0f ; //left fish's max x (most left)
@@ -483,23 +465,23 @@ static void time_update_cb(void *p)
483465
484466 extern struct tm * timeinfo ;
485467#endif
486- GUI_WIDGET_POINTER_BY_NAME_ROOT (text , "date_text" , current_view );
468+ GUI_WIDGET_POINTER_BY_NAME_ROOT (text , "date_text" , gui_view_get_current () );
487469 sprintf (date_text_content , "%s %d" , day [timeinfo -> tm_wday ], timeinfo -> tm_mday );
488470 gui_text_content_set ((gui_text_t * )text , date_text_content , strlen (date_text_content ));
489471
490- GUI_WIDGET_POINTER_BY_NAME_ROOT (img_hour_decimal , "watch_hour_decimal" , current_view );
472+ GUI_WIDGET_POINTER_BY_NAME_ROOT (img_hour_decimal , "watch_hour_decimal" , gui_view_get_current () );
491473 gui_img_set_src ((gui_img_t * )img_hour_decimal , text_num_array [timeinfo -> tm_hour / 10 ],
492474 ((gui_img_t * )img_hour_decimal )-> storage_type );
493475
494- GUI_WIDGET_POINTER_BY_NAME_ROOT (img_hour_single , "watch_hour_single" , current_view );
476+ GUI_WIDGET_POINTER_BY_NAME_ROOT (img_hour_single , "watch_hour_single" , gui_view_get_current () );
495477 gui_img_set_src ((gui_img_t * )img_hour_single , text_num_array [timeinfo -> tm_hour % 10 ],
496478 ((gui_img_t * )img_hour_single )-> storage_type );
497479
498- GUI_WIDGET_POINTER_BY_NAME_ROOT (img_minute_decimal , "watch_minute_decimal" , current_view );
480+ GUI_WIDGET_POINTER_BY_NAME_ROOT (img_minute_decimal , "watch_minute_decimal" , gui_view_get_current () );
499481 gui_img_set_src ((gui_img_t * )img_minute_decimal ,
500482 text_num_array [timeinfo -> tm_min / 10 ], ((gui_img_t * )img_minute_decimal )-> storage_type );
501483
502- GUI_WIDGET_POINTER_BY_NAME_ROOT (img_minute_single , "watch_minute_single" , current_view );
484+ GUI_WIDGET_POINTER_BY_NAME_ROOT (img_minute_single , "watch_minute_single" , gui_view_get_current () );
503485 gui_img_set_src ((gui_img_t * )img_minute_single , text_num_array [timeinfo -> tm_min % 10 ],
504486 ((gui_img_t * )img_minute_single )-> storage_type );
505487}
0 commit comments