gboolean check_if_every_vte_is_using_restore_font_name(struct Window *win_data) { #ifdef DETAIL g_debug("! Launch check_if_every_vte_is_using_restore_font_name() with win_data = %p", win_data); #endif #ifdef SAFEMODE if ((win_data==NULL) || (win_data->notebook==NULL)) return FALSE; #endif if (win_data->restore_font_name == NULL) // win_data->restore_font_name = g_strdup(page_data->font_name); win_data->restore_font_name = g_strdup(win_data->default_font_name); gint i; struct Page *page_data = NULL; gboolean return_value = TRUE; for (i=0; i<gtk_notebook_get_n_pages(GTK_NOTEBOOK(win_data->notebook)); i++) { page_data = get_page_data_from_nth_page(win_data, i); #ifdef SAFEMODE if (page_data==NULL) continue; #endif if (compare_strings(page_data->font_name, win_data->restore_font_name, TRUE)) { return_value = FALSE; break; } } return return_value; }
void apply_font_to_every_vte(GtkWidget *window, gchar *new_font_name, glong column, glong row) { #ifdef DETAIL g_debug("! Launch apply_font_to_every_vte() with window = %p, new_font_name = %s," " column = %ld, row = %ld", window, new_font_name, column, row); #endif #ifdef SAFEMODE if ((window==NULL) || (new_font_name==NULL) || (column<1) || (row<1)) return; #endif struct Window *win_data = (struct Window *)g_object_get_data(G_OBJECT(window), "Win_Data"); // g_debug("Get win_data = %d when apply font to every vte!", win_data); #ifdef SAFEMODE if (win_data==NULL) return; #endif struct Page *page_data = NULL; gint i; // g_debug("Trying to apply every vte to %dx%d!", column, row); // g_debug("Trying to apply font %s to every vte!", new_font_name); for (i=0; i<gtk_notebook_get_n_pages(GTK_NOTEBOOK(win_data->notebook)); i++) { page_data = get_page_data_from_nth_page(win_data, i); #ifdef SAFEMODE if (page_data==NULL) continue; #endif #ifdef USE_GTK3_GEOMETRY_METHOD save_current_vte_geometry(win_data, page_data->vte); #endif // g_debug("The default font for %d page is: %s (%s)", i, page_data->font_name, new_font_name); vte_terminal_set_font_from_string_full(VTE_TERMINAL(page_data->vte), new_font_name, win_data->font_anti_alias); vte_terminal_set_size(VTE_TERMINAL(page_data->vte), column, row); #ifdef USE_GTK3_GEOMETRY_METHOD page_data->column = column; page_data->row = row; # ifdef GEOMETRY g_debug("@ apply_font_to_every_vte (for %p): Trying set the geometry to %ld x %ld", window, column, row); # endif #endif g_free(page_data->font_name); page_data->font_name = g_strdup(new_font_name); // g_debug("The new font for %d page is: %s (%s)", i, page_data->font_name, new_font_name); } // g_debug("Set hints to FALSE!"); win_data->update_hints = 1; // win_data->keep_vte_size |= 0x30; // g_debug("window_resizable in apply_font_to_every_vte!"); // window_resizable(window, page_data->vte, 2, 1); // g_debug("apply_font_to_every_vte(): launch keep_window_size()!"); #ifdef USE_GTK2_GEOMETRY_METHOD # ifdef GEOMETRY g_debug("@ apply_font_to_every_vte(): Call keep_gtk2_window_size() with win_data->unfullscreen = %d", win_data->unfullscreen); # endif // Don't need to call keep_gtk2_window_size() when fullscreen switch (win_data->unfullscreen) { case FULLSCREEN_NORMAL: case FULLSCREEN_UNFS_OK: # ifdef GEOMETRY g_debug("@ apply_font_to_every_vte(): Call keep_gtk2_window_size() with keep_vte_size = %x", win_data->keep_vte_size); # endif keep_gtk2_window_size (win_data, page_data->vte, 0x380); break; default: break; } #endif #ifdef USE_GTK3_GEOMETRY_METHOD win_data->keep_vte_size += 2; # ifdef GEOMETRY g_debug("@ apply_font_to_every_vte(for %p): Set win_data->keep_vte_size to %d", win_data->window, win_data->keep_vte_size); # endif #endif }
void reorder_page_number(GtkNotebook *notebook, GtkWidget *child, guint page_num, GtkWidget *window) { #ifdef DETAIL g_debug("! Launch reorder_page_number() with notebook = %p, page_num = %d, window = %p", notebook, page_num, window); #endif #ifdef DEFENSIVE if (window==NULL) return; #endif struct Window *win_data = (struct Window *)g_object_get_data(G_OBJECT(window), "Win_Data"); #ifdef DEFENSIVE if (win_data==NULL) return; #endif gint total_page = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); // g_debug("total_page = %d", total_page); struct Page *page_data; gint i; for (i=0; i<total_page; i++) { page_data = get_page_data_from_nth_page (win_data, i); #ifdef DEFENSIVE if (page_data==NULL) continue; #endif // g_debug("Got page_data = %p", page_data); // we store current_page_no in "struct Page" for performance. page_data->page_no = i; // g_debug("Launch get_and_update_page_name() in reorder_page_number()"); // g_debug("page_data->label_text = %p " // "page_data->page_name = %s " // "page_data->custom_page_name = %s " // "page_data->tab_color = %s " // "win_data->default_encoding = %p " // "page_data->encoding_str = %s", // page_data->label_text, // page_data->page_name, // page_data->custom_page_name, // page_data->tab_color, // win_data->default_menuitem_encoding, // page_data->encoding_str); // Don't update page name when win_data->kill_color_demo_vte. // Or LilyTerm will got warning: "Failed to set text from markup due to error parsing markup" if (((win_data->page_shows_number) || win_data->adding_page) && (dialog_activated==0) && (! win_data->kill_color_demo_vte)) update_page_name(window, page_data->vte, page_data->page_name, page_data->label_text, i+1, page_data->custom_page_name, page_data->tab_color, page_data->is_root, page_data->is_bold, compare_strings(win_data->runtime_encoding, page_data->encoding_str, FALSE), page_data->encoding_str, page_data->custom_window_title, FALSE); } }
void apply_font_to_every_vte(GtkWidget *window, gchar *new_font_name, glong column, glong row) { #ifdef DETAIL g_debug("! Launch apply_font_to_every_vte() with window = %p, new_font_name = %s," " column = %ld, row = %ld", window, new_font_name, column, row); #endif #ifdef SAFEMODE if ((window==NULL) || (new_font_name==NULL) || (column<1) || (row<1)) return; #endif struct Window *win_data = (struct Window *)g_object_get_data(G_OBJECT(window), "Win_Data"); // g_debug("Get win_data = %d when apply font to every vte!", win_data); #ifdef SAFEMODE if (win_data==NULL) return; #endif struct Page *page_data = NULL; gint i; // g_debug("Trying to apply every vte to %dx%d!", column, row); // g_debug("Trying to apply font %s to every vte!", new_font_name); for (i=0; i<gtk_notebook_get_n_pages(GTK_NOTEBOOK(win_data->notebook)); i++) { page_data = get_page_data_from_nth_page(win_data, i); #ifdef SAFEMODE if (page_data==NULL) continue; #endif // g_debug("The default font for %d page is: %s (%s)", i, page_data->font_name, new_font_name); fake_vte_terminal_set_font_from_string( page_data->vte, new_font_name, win_data->font_anti_alias); vte_terminal_set_size(VTE_TERMINAL(page_data->vte), column, row); g_free(page_data->font_name); page_data->font_name = g_strdup(new_font_name); // g_debug("The new font for %d page is: %s (%s)", i, page_data->font_name, new_font_name); } // g_debug("* Set hints to HINTS_FONT_BASE!, win_data->window_status = %d", win_data->window_status); win_data->hints_type = HINTS_FONT_BASE; // win_data->keep_vte_size |= 0x30; // g_debug("window_resizable in apply_font_to_every_vte!"); // window_resizable(window, page_data->vte, 2, 1); // g_debug("apply_font_to_every_vte(): launch keep_window_size()!"); #ifdef USE_GTK2_GEOMETRY_METHOD // Don't need to call keep_gtk2_window_size() when fullscreen switch (win_data->window_status) { case FULLSCREEN_NORMAL: case FULLSCREEN_UNFS_OK: # ifdef GEOMETRY g_debug("@ apply_font_to_every_vte(): Call keep_gtk2_window_size() with keep_vte_size = 0x%X", win_data->keep_vte_size); # endif keep_gtk2_window_size (win_data, page_data->vte, GEOMETRY_CHANGING_FONT); break; default: break; } #endif }
void apply_font_to_every_vte(GtkWidget *window, gchar *new_font_name, glong column, glong row) { #ifdef DETAIL g_debug("! Launch apply_font_to_every_vte() with window = %p, new_font_name = %s," " column = %ld, row = %ld", window, new_font_name, column, row); #endif #ifdef SAFEMODE if ((window==NULL) || (new_font_name==NULL) || (column<1) || (row<1)) return; #endif struct Window *win_data = (struct Window *)g_object_get_data(G_OBJECT(window), "Win_Data"); // g_debug("Get win_data = %d when apply font to every vte!", win_data); #ifdef SAFEMODE if (win_data==NULL) return; #endif struct Page *page_data = NULL; gint i; // g_debug("Trying to apply every vte to %dx%d!", column, row); // g_debug("Trying to apply font %s to every vte!", new_font_name); for (i=0; i<gtk_notebook_get_n_pages(GTK_NOTEBOOK(win_data->notebook)); i++) { page_data = get_page_data_from_nth_page(win_data, i); #ifdef SAFEMODE if (page_data==NULL) continue; #endif // g_debug("The default font for %d page is: %s (%s)", i, page_data->font_name, new_font_name); vte_terminal_set_font_from_string_full(VTE_TERMINAL(page_data->vte), new_font_name, win_data->font_anti_alias); vte_terminal_set_size(VTE_TERMINAL(page_data->vte), column, row); g_free(page_data->font_name); page_data->font_name = g_strdup(new_font_name); // g_debug("The new font for %d page is: %s (%s)", i, page_data->font_name, new_font_name); } // g_debug("* Set hints to HINTS_FONT_BASE!, win_data->window_status = %d", win_data->window_status); win_data->hints_type = HINTS_FONT_BASE; // win_data->keep_vte_size |= 0x30; // g_debug("window_resizable in apply_font_to_every_vte!"); // window_resizable(window, page_data->vte, 2, 1); // g_debug("apply_font_to_every_vte(): launch keep_window_size()!"); // Don't need to call keep_gtk2_window_size() when fullscreen switch (win_data->window_status) { #ifdef USE_GTK2_GEOMETRY_METHOD case FULLSCREEN_NORMAL: case FULLSCREEN_UNFS_OK: # ifdef GEOMETRY g_debug("@ apply_font_to_every_vte(): Call keep_gtk2_window_size() with keep_vte_size = %x", win_data->keep_vte_size); # endif keep_gtk2_window_size (win_data, page_data->vte, 0x380); #endif #ifdef USE_GTK3_GEOMETRY_METHOD case WINDOW_NORMAL: case WINDOW_APPLY_PROFILE_NORMAL: # ifdef GEOMETRY fprintf(stderr, "\033[1;%dm!! apply_font_to_every_vte(win_data %p): Calling keep_gtk3_window_size() with hints_type = %d\n", ANSI_COLOR_MAGENTA, win_data, win_data->hints_type); # endif window_resizable(win_data->window, win_data->current_vte, win_data->hints_type); if (win_data->window_status==WINDOW_NORMAL) win_data->resize_type = GEOMETRY_AUTOMATIC; else win_data->resize_type = GEOMETRY_CUSTOM; win_data->geometry_width = column; win_data->geometry_height = row; keep_gtk3_window_size(win_data, TRUE); #endif break; default: break; } }