static void view_show_prompt (view_t *view, const char *prompt, const char *entered_text) { int display_width, display_height; int i; display_width = ply_text_display_get_number_of_columns (view->display); display_height = ply_text_display_get_number_of_rows (view->display); ply_text_display_set_background_color (view->display, PLY_TERMINAL_COLOR_DEFAULT); ply_text_display_clear_screen (view->display); ply_text_display_set_cursor_position (view->display, 0, display_height / 2); for (i = 0; i < display_width; i++) { ply_text_display_write (view->display, "%c", ' '); } ply_text_display_set_cursor_position (view->display, display_width / 2 - (strlen (prompt)), display_height / 2); ply_text_display_write (view->display, "%s:%s", prompt, entered_text); ply_text_display_show_cursor (view->display); }
static void animate_frame (ply_boot_splash_plugin_t *plugin, int frame) { ply_list_node_t *node; node = ply_list_get_first_node (plugin->views); while (node != NULL) { ply_list_node_t *next_node; view_t *view; int display_width, display_height; view = ply_list_node_get_data (node); next_node = ply_list_get_next_node (plugin->views, node); display_width = ply_text_display_get_number_of_columns (view->display); display_height = ply_text_display_get_number_of_rows (view->display); ply_text_display_set_cursor_position (view->display, (display_width - 12) / 2, display_height / 2); ply_text_display_set_background_color (view->display, PLY_TERMINAL_COLOR_BLACK); ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_WHITE); ply_text_display_write (view->display, "Ubuntu 10.04"); ply_text_display_set_cursor_position (view->display, (display_width - 10) / 2, (display_height / 2) + 2); if ((frame < 1) || (frame > 4)) ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_WHITE); else ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_BROWN); ply_text_display_write (view->display, ". "); if ((frame < 2) || (frame > 5)) ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_WHITE); else ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_BROWN); ply_text_display_write (view->display, ". "); if ((frame < 3) || (frame > 6)) ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_WHITE); else ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_BROWN); ply_text_display_write (view->display, ". "); if (frame < 4) ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_WHITE); else ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_BROWN); ply_text_display_write (view->display, "."); node = next_node; } }
static void view_show_prompt (view_t *view, const char *prompt, const char *entered_text) { ply_boot_splash_plugin_t *plugin; int display_width, display_height; int i; plugin = view->plugin; display_width = ply_text_display_get_number_of_columns (view->display); display_height = ply_text_display_get_number_of_rows (view->display); ply_text_display_set_cursor_position (view->display, 0, display_height / 2 + 8); ply_text_display_clear_line (view->display); ply_text_display_set_cursor_position (view->display, display_width / 2 - (strlen (prompt)), display_height / 2 + 8); ply_text_display_write (view->display, "%s:%s", prompt, entered_text); ply_text_display_show_cursor (view->display); }
static void view_show_message (view_t *view) { ply_boot_splash_plugin_t *plugin; int display_width, display_height; plugin = view->plugin; display_width = ply_text_display_get_number_of_columns (view->display); display_height = ply_text_display_get_number_of_rows (view->display); ply_text_display_set_cursor_position (view->display, 0, display_height / 2); ply_text_display_clear_line (view->display); ply_text_display_set_cursor_position (view->display, (display_width - strlen (plugin->message)) / 2, display_height / 2); ply_text_display_write (view->display, "%s", plugin->message); }
static void view_show_message (view_t *view) { ply_boot_splash_plugin_t *plugin; int display_width, display_height, y; ply_terminal_color_t color; char *message; plugin = view->plugin; display_width = ply_text_display_get_number_of_columns (view->display); display_height = ply_text_display_get_number_of_rows (view->display); if (!strncmp (plugin->message, "keys:", 5)) { message = plugin->message + 5; color = PLY_TERMINAL_COLOR_WHITE; y = display_height - 4; } else { message = plugin->message; color = PLY_TERMINAL_COLOR_BLUE; y = display_height / 2 + 7; } ply_text_display_set_cursor_position (view->display, 0, y); ply_text_display_clear_line (view->display); ply_text_display_set_cursor_position (view->display, (display_width - strlen (message)) / 2, y); ply_text_display_set_foreground_color (view->display, color); ply_text_display_write (view->display, "%s", message); }