1 /* 2 * Copyright (c) 2008-2010 Lu, Chao-Ming (Tetralet). All rights reserved. 3 * 4 * This file is part of LilyTerm. 5 * 6 * LilyTerm is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * LilyTerm is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with LilyTerm. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #include <gtk/gtk.h> 21 #include <vte/vte.h> 22 // for L10n 23 #include <glib/gi18n.h> 24 #include <locale.h> 25 // for opendir() readdir() closedir() 26 #include <dirent.h> 27 // for stat() 28 #include <sys/stat.h> 29 // for memcpy() memset() 30 #include <string.h> 31 // for aoti() 32 #include <stdlib.h> 33 // for XParseGeometry() 34 #include <X11/Xlib.h> 35 36 #include "lilyterm.h" 37 38 typedef enum { 39 IMAGE_MENU_ITEM, 40 CHECK_MENU_ITEM, 41 } Menu_Itemn_Type; 42 43 typedef enum { 44 NEW_WINDOW_FROM_SYSTEM_PROFILE, 45 NEW_WINDOW_FROM_PROFILE, 46 LOAD_FROM_SYSTEM_PROFILE, 47 LOAD_FROM_PROFILE, 48 APPLY_FROM_NEW_WIN_DATA, 49 } Apply_Profile_Type; 50 51 struct Preview 52 { 53 gchar *default_filename; 54 GtkWidget *mainbox; 55 GtkWidget *frame; 56 GtkWidget *vbox; 57 GtkWidget *image; 58 GtkWidget *no_image_text; 59 GtkWidget *scroll_background; 60 }; 61 62 void new_tab_with_locale(GtkWidget *local_menuitem, gboolean VTE_CJK_WIDTH); 63 GtkWidget *check_name_in_menuitem(GtkWidget *sub_menu, const gchar *name, gboolean case_sensitive); 64 void set_trans_bg(GtkWidget *menuitem_trans_bg, struct Window *win_data); 65 void set_trans_win(GtkWidget *widget, GtkWidget *window); 66 void invert_color_theme(GtkWidget *menuitem, struct Window *win_data); 67 void select_ansi_theme(GtkWidget *menuitem, gint index); 68 void set_ansi_theme(GtkWidget *menuitem, Set_ANSI_Theme_Type type, gboolean use_custom_theme, gboolean invert_color, 69 gint theme_index, struct Window *win_data); 70 void set_auto_save(GtkWidget *menuitem, struct Window *win_data); 71 void set_erase_binding (GtkWidget *menuitem, gint value); 72 #ifdef ENABLE_CURSOR_SHAPE 73 void set_cursor_shape (GtkWidget *menuitem, gint value); 74 #endif 75 GSList *create_theme_menu_items(struct Window *win_data, GtkWidget *sub_menu, GSList *theme_group, gint current_theme, gint custom_theme); 76 void clean_scrollback_lines(GtkWidget *widget, struct Window *win_data); 77 void reset_vte(GtkWidget *widget, struct Window *win_data); 78 void select_font(GtkWidget *widget, struct Window *win_data); 79 void set_dim_text(GtkWidget *menuitem_dim_text, struct Window *win_data); 80 #ifdef ENABLE_RGBA 81 void set_dim_window(GtkWidget *menuitem_dim_text, struct Window *win_data); 82 #endif 83 void set_cursor_blinks(GtkWidget *widget, struct Window *win_data); 84 void set_audible_bell(GtkWidget *widget, struct Window *win_data); 85 void set_visible_bell(GtkWidget *widget, struct Window *win_data); 86 void urgent_beep(GtkWidget *window, struct Page *page_data); 87 void launch_hide_and_show_tabs_bar(GtkWidget *widget, Switch_Type show_tabs_bar); 88 void copy_url_clipboard(GtkWidget *widget, gpointer user_data); 89 void copy_clipboard(GtkWidget *widget, struct Window *win_data); 90 void paste_clipboard(GtkWidget *widget, struct Window *win_data); 91 void paste_to_every_vte(GtkWidget *widget, struct Window *win_data); 92 void open_current_dir_with_file_manager(GtkWidget *widget, struct Window *win_data); 93 void view_clipboard(GtkWidget *widget, struct Window *win_data); 94 void view_primary(GtkWidget *widget, struct Window *win_data); 95 gint add_menuitem_to_locale_sub_menu(struct Window *win_data, gint no, gchar *name); 96 GtkWidget *recreate_profile_menu_item(GtkWidget *menuitem, GtkWidget *subitem, 97 struct Window *win_data, Apply_Profile_Type type); 98 void create_new_window_from_menu_items(GtkWidget *sub_menu, const gchar *stock_id); 99 void create_load_profile_from_menu_items(GtkWidget *sub_menu, const gchar *stock_id, struct Window *win_data); 100 gboolean create_profile_menu_list(GtkWidget *sub_menu, const gchar *stock_id, GSourceFunc func, gpointer func_data); 101 void load_background_image_from_file(GtkWidget *widget, struct Window *win_data); 102 void apply_profile_from_file_dialog(GtkWidget *menu_item, Apply_Profile_Type type); 103 void apply_profile_from_menu_item(GtkWidget *menu_item, Apply_Profile_Type type); 104 void apply_profile_from_file(const gchar *path, Apply_Profile_Type type); 105 void reload_settings(GtkWidget *menu_item, struct Window *win_data); 106 void apply_to_every_window(GtkWidget *menu_item, struct Window *win_data); 107 void save_user_settings_as(GtkWidget *widget, struct Window *win_data); 108 GtkWidget *create_load_file_dialog(GtkFileChooserAction action, GtkWidget *window, gchar *button_text, gchar *filename); 109 void update_preview_image (GtkFileChooser *dialog, struct Preview *preview); 110 GtkWidget *create_menu_item (Menu_Itemn_Type type, GtkWidget *sub_menu, const gchar *label, const gchar *label_name, 111 const gchar *stock_id, GSourceFunc func, gpointer func_data); 112 GtkWidget *create_sub_item (GtkWidget *menu, gchar *label, const gchar *stock_id); 113 GtkWidget *create_sub_item_subitem (gchar *label, const gchar *stock_id); 114 GtkWidget *create_sub_item_submenu (GtkWidget *menu, GtkWidget *menu_item); 115 GtkWidget *add_separator_menu(GtkWidget *sub_menu); 116 void set_menuitem_label(GtkWidget *menu_item, gchar *text); 117 gboolean check_if_win_data_is_still_alive(struct Window *win_data); 118