From 6650d90bfaff36a7dcd592174de243b663204eed Mon Sep 17 00:00:00 2001 From: Wu Xiaotian Date: Wed, 2 Oct 2019 12:02:08 +0800 Subject: [PATCH] drop dead code --- src/editor/slib-editor.c | 174 ------------------------------------ src/gtk/bibletext.c | 25 ------ src/gtk/commentary_dialog.c | 70 --------------- src/gtk/dictlex.c | 68 -------------- src/gtk/display_info.c | 26 ------ src/gtk/gbs.c | 77 ---------------- src/gtk/gbs_dialog.c | 29 ------ src/gtk/main_menu.c | 5 -- src/gtk/main_window.c | 14 --- src/gtk/mod_mgr.c | 7 -- src/gtk/parallel_dialog.c | 47 ---------- src/gtk/parallel_tab.c | 51 ----------- src/gtk/search_dialog.c | 8 -- src/gtk/sidebar.c | 29 ------ src/gtk/tabbed_browser.c | 44 --------- src/gtk/utilities.c | 92 ------------------- src/main/biblesync_glue.cc | 22 ----- src/main/display.cc | 29 ------ src/main/modulecache.cc | 12 --- src/main/navbar.cc | 69 -------------- src/main/parallel_view.cc | 116 ------------------------ src/main/previewer.cc | 39 -------- src/main/sword.cc | 147 ------------------------------ src/main/sword_treekey.cc | 12 --- src/main/tab_history.c | 6 -- src/main/xml.c | 25 ------ 26 files changed, 1243 deletions(-) diff --git a/src/editor/slib-editor.c b/src/editor/slib-editor.c index 7943d43e9..851e6bffa 100644 --- a/src/editor/slib-editor.c +++ b/src/editor/slib-editor.c @@ -102,173 +102,6 @@ static void change_window_title(GtkWidget *window, const gchar *window_title) gtk_window_set_title(GTK_WINDOW(window), window_title); } -#if 0 -static gint -_calc_header_height(GtkHTML * html, GtkPrintOperation * operation, - GtkPrintContext * context) -{ - PangoContext *pango_context; - PangoFontDescription *desc; - PangoFontMetrics *metrics; - gint header_height; - - pango_context = gtk_print_context_create_pango_context(context); - desc = pango_font_description_from_string("Sans Regular 10"); - - metrics = - pango_context_get_metrics(pango_context, desc, - pango_language_get_default()); - header_height = - pango_font_metrics_get_ascent(metrics) + - pango_font_metrics_get_descent(metrics); - pango_font_metrics_unref(metrics); - - pango_font_description_free(desc); - g_object_unref(pango_context); - - return header_height; -} - -static gint -_calc_footer_height(GtkHTML * html, GtkPrintOperation * operation, - GtkPrintContext * context) -{ - PangoContext *pango_context; - PangoFontDescription *desc; - PangoFontMetrics *metrics; - gint footer_height; - - pango_context = gtk_print_context_create_pango_context(context); - desc = pango_font_description_from_string("Sans Regular 10"); - - metrics = - pango_context_get_metrics(pango_context, desc, - pango_language_get_default()); - footer_height = - pango_font_metrics_get_ascent(metrics) + - pango_font_metrics_get_descent(metrics); - pango_font_metrics_unref(metrics); - - pango_font_description_free(desc); - g_object_unref(pango_context); - - return footer_height; -} - -static void -_draw_header(GtkHTML * html, GtkPrintOperation * operation, - GtkPrintContext * context, - gint page_nr, PangoRectangle * rec, EDITOR * e) -{ - PangoFontDescription *desc; - PangoLayout *layout; - gdouble x, y; - gchar *text; - cairo_t *cr; - - text = g_strdup(e->filename); - - desc = pango_font_description_from_string("Sans Regular 10"); - layout = gtk_print_context_create_pango_layout(context); - pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER); - pango_layout_set_font_description(layout, desc); - pango_layout_set_text(layout, text, -1); - pango_layout_set_width(layout, rec->width); - - x = pango_units_to_double(rec->x); - y = pango_units_to_double(rec->y); - - cr = gtk_print_context_get_cairo_context(context); - - cairo_save(cr); - cairo_set_source_rgb(cr, .0, .0, .0); - cairo_move_to(cr, x, y); - pango_cairo_show_layout(cr, layout); - cairo_restore(cr); - - g_object_unref(layout); - pango_font_description_free(desc); - - g_free(text); -} - - -static void -_draw_footer(GtkHTML * html, GtkPrintOperation * operation, - GtkPrintContext * context, - gint page_nr, PangoRectangle * rec, EDITOR * e) -{ - PangoFontDescription *desc; - PangoLayout *layout; - gdouble x, y; - gint n_pages; - gchar *text; - cairo_t *cr; - - g_object_get(operation, "n-pages", &n_pages, NULL); - text = g_strdup_printf(_("Page %d of %d"), page_nr + 1, n_pages); - - desc = pango_font_description_from_string("Sans Regular 10"); - layout = gtk_print_context_create_pango_layout(context); - pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER); - pango_layout_set_font_description(layout, desc); - pango_layout_set_text(layout, text, -1); - pango_layout_set_width(layout, rec->width); - - x = pango_units_to_double(rec->x); - y = pango_units_to_double(rec->y); - - cr = gtk_print_context_get_cairo_context(context); - - cairo_save(cr); - cairo_set_source_rgb(cr, .0, .0, .0); - cairo_move_to(cr, x, y); - pango_cairo_show_layout(cr, layout); - cairo_restore(cr); - - g_object_unref(layout); - pango_font_description_free(desc); - - g_free(text); -} - -static GtkPrintOperationResult -_do_print(EDITOR * e, GtkPrintOperationAction action) -{ - GtkPrintOperation *operation; - GtkPrintSettings *psettings; - GtkPageSetup *setup; - GtkPrintOperationResult result; - GError *error = NULL; - - operation = gtk_print_operation_new(); - psettings = gtk_print_settings_new(); - - psettings = gtk_print_operation_get_print_settings(operation); - - setup = gtk_page_setup_new(); - gtk_page_setup_set_top_margin(setup, 30, GTK_UNIT_PIXEL); - gtk_page_setup_set_left_margin(setup, 50, GTK_UNIT_PIXEL); - -#ifdef WIN32 - gtk_print_operation_set_unit(operation, GTK_UNIT_POINTS); -#endif - gtk_print_operation_set_default_page_setup(operation, setup); - - result = gtk_html_print_operation_run(GTK_HTML(e->html_widget), operation, action, GTK_WINDOW(e->window), (GtkHTMLPrintCalcHeight) _calc_header_height, /* GtkHTMLPrintCalcHeight calc_header_height */ - (GtkHTMLPrintCalcHeight) _calc_footer_height, /* GtkHTMLPrintCalcHeight calc_footer_height */ - (GtkHTMLPrintDrawFunc) _draw_header, /* GtkHTMLPrintDrawFunc draw_header */ - (GtkHTMLPrintDrawFunc) _draw_footer, /* GtkHTMLPrintDrawFunc draw_footer */ - e, /* gpointer user_data */ - &error); - - g_object_unref(operation); - handle_error(&error); - - return result; -} -#endif /* 0 */ - static const gchar *file_ui = "\n" " \n" @@ -360,9 +193,6 @@ static gint open_dialog(EDITOR *e) { GtkWidget *dialog; gint response; -#if 0 - const gchar *filename; -#endif dialog = gtk_file_chooser_dialog_new(_("Open"), GTK_WINDOW(e->window), @@ -381,10 +211,6 @@ static gint open_dialog(EDITOR *e) /*gtk_file_chooser_set_do_overwrite_confirmation ( GTK_FILE_CHOOSER (dialog), TRUE); */ -#if 0 - filename = gtkhtml_editor_get_filename(GTKHTML_EDITOR(e->window)); -#endif - gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), settings.studypaddir); diff --git a/src/gtk/bibletext.c b/src/gtk/bibletext.c index e3c8bedd5..3a92feb3c 100644 --- a/src/gtk/bibletext.c +++ b/src/gtk/bibletext.c @@ -56,31 +56,6 @@ gboolean shift_key_pressed = FALSE; guint scroll_adj_signal; GtkAdjustment *adjustment; -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * - * - * Synopsis - * #include "gui/.h" - * - * - * - * Description - * - * - * Return value - * void - */ - -void gui_popup_pm_text(void) -{ - /* gui_menu_popup (settings.MainWindowModule, - NULL); */ -} -#endif - static gboolean _popupmenu_requested_cb(XiphosHtml *html, gchar *uri, gpointer user_data) { diff --git a/src/gtk/commentary_dialog.c b/src/gtk/commentary_dialog.c index 2b4fbd753..4b459cbf8 100644 --- a/src/gtk/commentary_dialog.c +++ b/src/gtk/commentary_dialog.c @@ -78,33 +78,6 @@ static void on_dialog_destroy(GObject *object, DIALOG_DATA *d) dialog_freed = FALSE; } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * gui_close_comm_dialog - * - * Synopsis - * #include "commentary_dialog.h" - * - * void gui_close_comm_dialog(DIALOG_DATA * d) - * - * Description - * - * - * Return value - * void - */ - -void gui_close_comm_dialog(DIALOG_DATA *d) -{ - if (d->dialog) { - dialog_freed = FALSE; - gtk_widget_destroy(d->dialog); - } -} -#endif - /****************************************************************************** * Name * on_dialog_motion_notify_event @@ -130,32 +103,6 @@ static gboolean on_dialog_motion_notify_event(GtkWidget *widget, return FALSE; } -#if 0 -/****************************************************************************** - * Name - * sync_with_main - * - * Synopsis - * #include "gui/commentary_dialog.h" - * - * void sync_with_main(DIALOG_DATA * d) - * - * Descriptiond->navbar.lookup_entry - * bring the the View Commentay Dialog module into sync with main window - * - * Return value - * void - */ - -static void sync_with_main(DIALOG_DATA *d) -{ - gchar *url = g_strdup_printf("sword:///%s", settings.currentverse); - main_dialogs_url_handler(d, url, TRUE); - cur_d = d; - g_free(url); -} -#endif - /****************************************************************************** * Name * create_nav_toolbar @@ -276,20 +223,3 @@ void gui_create_commentary_dialog(DIALOG_DATA *d, gboolean do_edit) "motion_notify_event", G_CALLBACK(on_dialog_motion_notify_event), d); } - -#if 0 -// unneeded at this time. disabled to silence cppcheck. -void gui_commentary_dialog_sync_toggled(GtkToggleButton *button, - DIALOG_DATA *d) -{ - if (d == NULL) - d = cur_d; - if (gtk_toggle_button_get_active(button)) { - sync_with_main(d); - d->sync = TRUE; - } else - d->sync = FALSE; -} -#endif - -/****** end of file ******/ diff --git a/src/gtk/dictlex.c b/src/gtk/dictlex.c index fc7071d4b..d1401757b 100644 --- a/src/gtk/dictlex.c +++ b/src/gtk/dictlex.c @@ -113,14 +113,6 @@ void gui_get_clipboard_text_for_lookup(GtkClipboard *clipboard, g_free(dict); } -#if 0 -static void set_label(gchar * mod_name) -{ - gtk_label_set_text(GTK_LABEL(widgets.label_dict), mod_name); - -} -#endif - /****************************************************************************** * Name * on_entryDictLookup_changed @@ -143,66 +135,6 @@ void on_entryDictLookup_changed(GtkEditable *editable, gpointer data) main_dictionary_entry_changed(settings.DictWindowModule); } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * gui_display_dictlex - * - * Synopsis - * #include "dictlex.h" - * - * void gui_display_dictlex(gchar * key) - * - * Description - * - * - * Return value - * void - */ - -void gui_display_dictlex(gchar *key) -{ - gtk_entry_set_text(GTK_ENTRY(widgets.entry_dict), key); -} -#endif - -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * gui_set_dictlex_mod_and_key - * - * Synopsis - * #include "_dictlex.h" - * - * void gui_set_dictlex_mod_and_key(gchar *mod, gchar *key) - * - * Description - * sets the dictionary module and key. Primarily added for use in tabbed browsing - * - * Return value - * void - */ - -void gui_set_dictlex_mod_and_key(gchar *mod_name, gchar *key) -{ - const gchar *old_key; - - //xml_set_value("Xiphos", "modules", "dict", mod_name); - //settings.DictWindowModule = xml_get_value("modules", "dict"); - //set_label(settings.DictWindowModule); - if (key == NULL) - key = "Grace"; - - old_key = gtk_entry_get_text(GTK_ENTRY(widgets.entry_dict)); - if (!strcmp(old_key, key)) - on_entryDictLookup_changed(NULL, NULL); - else - gtk_entry_set_text(GTK_ENTRY(widgets.entry_dict), key); -} -#endif - void dict_key_entry_changed(GtkEntry *entry, gpointer data) { gchar *buf = NULL; diff --git a/src/gtk/display_info.c b/src/gtk/display_info.c index 81beb798e..84e8bc586 100644 --- a/src/gtk/display_info.c +++ b/src/gtk/display_info.c @@ -69,32 +69,6 @@ void gui_display_mod_and_key(const gchar *mod_name, const gchar *key) } } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * - * - * Synopsis - * #include "display_info.h" - * - * - * - * Description - * - * - * Return value - * void - */ - -void gui_display_text_information(gchar *information) -{ - XIPHOS_HTML_OPEN_STREAM(html_widget, "text/html"); - XIPHOS_HTML_WRITE(html_widget, information, strlen(information)); - XIPHOS_HTML_CLOSE(html_widget); -} -#endif - /****************************************************************************** * Name * on_dlgInformation_destroy diff --git a/src/gtk/gbs.c b/src/gtk/gbs.c index 37869b531..47e79db6c 100644 --- a/src/gtk/gbs.c +++ b/src/gtk/gbs.c @@ -58,83 +58,6 @@ #include "gui/debug_glib_null.h" -//static void create_menu(GdkEventButton * event); - -/****************************************************************************** - * Name - * gui_set_gbs_frame_label - * - * Synopsis - * #include "gbs.h" - * - * void gui_set_gbs_frame_label(void) - * - * Description - * sets gbs label to module name - * - * Return value - * void - */ -#if 0 -static void set_gbs_label(gchar * mod_name) -{ - /* - * set label to module name - */ - gtk_label_set_text(GTK_LABEL(widgets.label_comm), mod_name); -} -#endif /* 0 */ - -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * gui_set_book_page_and_key - * - * Synopsis - * #include "gbs.h" - * - * void gui_set_book_page_and_key(gint page_num, gchar * key) - * - * Description - * - * - * Return value - * void - */ - -void gui_set_book_mod_and_key(gchar *mod_name, gchar *key) -{ - main_display_book(mod_name, key); -} -#endif - -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * - * - * Synopsis - * #include ".h" - * - * - * - * Description - * - * - * Return value - * void - */ - -void gui_update_gbs_global_ops(gchar *option, gboolean choice) -{ - /*save_module_options(cur_t->mod_name, option, - choice); */ - //gbs_display(cur_g, tree_level); -} -#endif - static void _popupmenu_requested_cb(XiphosHtml *html, gchar *uri, gpointer user_data) { diff --git a/src/gtk/gbs_dialog.c b/src/gtk/gbs_dialog.c index 766e11dcc..7703630b2 100644 --- a/src/gtk/gbs_dialog.c +++ b/src/gtk/gbs_dialog.c @@ -337,32 +337,3 @@ void gui_create_gbs_dialog(DIALOG_DATA *dlg) G_CALLBACK(dialog_destroy), (DIALOG_DATA *)dlg); cur_dlg = dlg; } - -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * gui_close_gbs_dialog - * - * Synopsis - * #include "gbs_dialog.h" - * - * void gui_close_gbs_dialog(DL_DIALOG *dlg) - * - * Description - * - * - * Return value - * void - */ - -void gui_close_gbs_dialog(DIALOG_DATA *dlg) -{ - if (dlg->dialog) { - dialog_freed = FALSE; - gtk_widget_destroy(dlg->dialog); - } -} -#endif - -//****** end of file ******/ diff --git a/src/gtk/main_menu.c b/src/gtk/main_menu.c index 1fa2e76f1..79b4c12f0 100644 --- a/src/gtk/main_menu.c +++ b/src/gtk/main_menu.c @@ -592,11 +592,6 @@ on_quit_activate(GtkMenuItem *menuitem, gpointer user_data) /* shutdown the sword stuff */ main_shutdown_backend(); gtk_main_quit(); -#if 0 - /* this causes trouble when paratab is active. - and frankly, why do we care? we're about to exit. just leave. */ - gtk_widget_destroy(widgets.app); -#endif exit(0); } diff --git a/src/gtk/main_window.c b/src/gtk/main_window.c index cbd473bba..2fb7f4926 100644 --- a/src/gtk/main_window.c +++ b/src/gtk/main_window.c @@ -483,12 +483,6 @@ static void on_notebook_bible_parallel_switch_page(GtkNotebook *notebook, gint page_num, GList **tl) { -#if 0 - if (page_num == 0) - gui_set_drop_target(widgets.html_text); - else - gtk_drag_dest_unset(GTK_WIDGET(widgets.html_text)); -#endif /* 0 */ } #ifdef USE_GTK_3 @@ -504,17 +498,9 @@ static void on_notebook_comm_book_switch_page(GtkNotebook *notebook, gchar *url = NULL; if (page_num == 0) { -#if 0 - gtk_drag_dest_unset(GTK_WIDGET(widgets.html_book)); - gui_set_drop_target(widgets.html_comm); -#endif /* 0 */ settings.comm_showing = TRUE; gtk_widget_show(nav_toolbar); } else { -#if 0 - gtk_drag_dest_unset(GTK_WIDGET(widgets.html_comm)); - gui_set_drop_target(widgets.html_book); -#endif /* 0 */ settings.comm_showing = FALSE; if (!settings.showtexts) gtk_widget_hide(nav_toolbar); diff --git a/src/gtk/mod_mgr.c b/src/gtk/mod_mgr.c index 05b15046f..392d1fc93 100644 --- a/src/gtk/mod_mgr.c +++ b/src/gtk/mod_mgr.c @@ -981,13 +981,6 @@ static void remove_install_modules(GList *modules, int activity) if (activity == FASTMOD) { XI_print(("index %s\n", buf)); -#if 0 - // why did we ever preclude indexing these? - if (main_get_mod_config_entry - (module_name, "GSType")) - gui_generic_warning(_("Journals and prayer lists cannot be indexed.")); - else -#endif result = ((main_module_mgr_index_mod(module_name)) ? 0 diff --git a/src/gtk/parallel_dialog.c b/src/gtk/parallel_dialog.c index fc5c07355..6e2d79b3b 100644 --- a/src/gtk/parallel_dialog.c +++ b/src/gtk/parallel_dialog.c @@ -222,29 +222,6 @@ void gui_keep_parallel_dialog_in_sync(void) sync_with_main(); } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * gui_set_parallel_navbar - * - * Synopsis - * #include "gui/parallel_dialog.h" - * - * void gui_set_parallel_navbar(const char key) - * - * - * - * Return value - * void - */ - -void gui_set_parallel_navbar(const char *key) -{ - main_navbar_set(navbar, key); -} -#endif - /****************************************************************************** * Name * create_nav_toolbar @@ -377,30 +354,6 @@ static GtkWidget *create_parallel_dialog(void) gtk_container_set_border_width(GTK_CONTAINER(box_parallel_labels), 2); -#if 0 - if (settings.parallel_list) { - GtkWidget *plabel; - gchar *label; - gint modidx; - - for (modidx = 0; settings.parallel_list[modidx]; ++modidx) { - plabel = gtk_label_new(NULL); - gtk_widget_show(plabel); - gtk_box_pack_start(GTK_BOX(box_parallel_labels), - plabel, FALSE, FALSE, 0); - gtk_label_set_use_markup(GTK_LABEL(plabel), TRUE); - - label = - g_strdup_printf - ("%s", - settings.bible_verse_num_color, - settings.parallel_list[modidx]); - gtk_label_set_markup(GTK_LABEL(plabel), label); - g_free(label); - } - } -#endif /* 0 */ - #ifndef USE_WEBKIT2 scrolled_window = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(scrolled_window); diff --git a/src/gtk/parallel_tab.c b/src/gtk/parallel_tab.c index abee1192e..7ce480db7 100644 --- a/src/gtk/parallel_tab.c +++ b/src/gtk/parallel_tab.c @@ -69,33 +69,6 @@ _popupmenu_requested_cb(XiphosHtml *html, gchar *uri, gpointer user_data) gui_popup_menu_parallel(); } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * on_btnDockInt_clicked - * - * Synopsis - * #include "parallel_dialog.h" - * - * void on_btnDockInt_clicked(GtkButton * button, gpointer user_data) - * - * Description - * - * - * - * - * - * Return value - * void - */ - -void gui_parallel_close_tab(GtkButton *button, gpointer user_data) -{ - //gtk_widget_destroy(parallel_UnDock_Dialog); -} -#endif - /****************************************************************************** * Name * on_dlgparallel_destroy @@ -268,30 +241,6 @@ GtkWidget *_create_parallel_tab(void) gtk_container_set_border_width(GTK_CONTAINER(box_parallel_labels), 2); -#if 0 - if (settings.parallel_list) { - GtkWidget *plabel; - gchar *label; - gint modidx; - - for (modidx = 0; settings.parallel_list[modidx]; ++modidx) { - plabel = gtk_label_new(NULL); - gtk_widget_show(plabel); - gtk_box_pack_start(GTK_BOX(box_parallel_labels), - plabel, FALSE, FALSE, 0); - gtk_label_set_use_markup(GTK_LABEL(plabel), TRUE); - - label = - g_strdup_printf - ("%s", - settings.bible_verse_num_color, - settings.parallel_list[modidx]); - gtk_label_set_markup(GTK_LABEL(plabel), label); - g_free(label); - } - } -#endif /* 0 */ - #ifndef USE_WEBKIT2 scrolled_window = gtk_scrolled_window_new(NULL, NULL); gtk_widget_show(scrolled_window); diff --git a/src/gtk/search_dialog.c b/src/gtk/search_dialog.c index 94ef7dedb..21fa61247 100644 --- a/src/gtk/search_dialog.c +++ b/src/gtk/search_dialog.c @@ -694,14 +694,6 @@ void delete_list(GtkButton *button, gpointer user_data) GtkTreeIter selected; gchar *str; -#if 0 - // #if 0'd until list_rows is properly managed. - if (search1.list_rows < 2) { - gui_generic_warning_modal(_("The last module list may not be deleted")); - return; - } -#endif - model = gtk_tree_view_get_model(GTK_TREE_VIEW(search1.module_lists)); list_store = GTK_LIST_STORE(model); diff --git a/src/gtk/sidebar.c b/src/gtk/sidebar.c index 6defeff5b..700b0a5e9 100644 --- a/src/gtk/sidebar.c +++ b/src/gtk/sidebar.c @@ -81,29 +81,6 @@ static GtkWidget *create_menu_modules(void); void on_export_verselist_activate(GtkMenuItem *menuitem, gpointer user_data); -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * - * - * Synopsis - * #include "gui/sidebar.h" - * - * - * - * Description - * - * - * Return value - * void - */ - -void gui_sync_module_treeview(gint direction) -{ -} -#endif - #ifdef USE_TREEVIEW_PATH /****************************************************************************** * Name @@ -405,12 +382,6 @@ void gui_set_sidebar_program_start(void) /* set width of bible pane */ //gtk_paned_set_position(GTK_PANED(widgets.hpaned), settings.biblepane_width); -#if 0 - if (!settings.docked) { - settings.docked = TRUE; - //gui_attach_detach_shortcutbar(); - } -#endif } /****************************************************************************** diff --git a/src/gtk/tabbed_browser.c b/src/gtk/tabbed_browser.c index defbe5cdd..4f0f7d55a 100644 --- a/src/gtk/tabbed_browser.c +++ b/src/gtk/tabbed_browser.c @@ -169,18 +169,6 @@ void gui_recompute_view_menu_choices(void) change_tabs_no_redisplay = FALSE; } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -void setup_book_editor_tab(PASSAGE_TAB_INFO *pt) -{ - /*pt->editor = editor_create_new_book_editor(pt->book_mod, PRAYERLIST_TYPE); - gtk_widget_show(GTK_WIDGET(pt->editor)); - - gtk_box_pack_start (GTK_BOX (widgets.vboxMain), GTK_WIDGET(pt->editor), - TRUE, TRUE, 0); */ -} -#endif - /****************************************************************************** * Name * set_current_tab @@ -1493,38 +1481,6 @@ void gui_close_all_tabs(void) // gui_set_text_frame_label(cur_t); } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * gui_open_tabs - * - * Synopsis - * #include "tabbed_browser.h" - * - * void gui_open_tabs(void) - * - * Description - * called from preferences dialog when enable browsing is chosen - * - * Return value - * void - */ -void gui_open_tabs(void) -{ - if (stop_refresh) - return; - - removed_page = 1; - cur_passage_tab = NULL; - passage_list = NULL; - - gui_load_tabs(default_tab_filename); - - gtk_widget_show(widgets.button_new_tab); -} -#endif - /****************************************************************************** * Name * gui_close_passage_tab diff --git a/src/gtk/utilities.c b/src/gtk/utilities.c index b0d8f27b7..2b1953c4e 100644 --- a/src/gtk/utilities.c +++ b/src/gtk/utilities.c @@ -851,34 +851,6 @@ void free_font(MOD_FONT *mf) g_free(mf); } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * remove_linefeeds - * - * Synopsis - * #include "gui/utilities.h" - * - * gchar * remove_linefeeds(gchar * buf) - * - * Description - * remove line feeds so we can display string in appbar - * - * Return value - * gchar * - */ - -gchar *remove_linefeeds(gchar *buf) -{ - gchar *key = NULL; - - key = g_strdelimit(buf, "\n", ' '); - - return (key ? g_strdup(key) : NULL); -} -#endif - /****************************************************************************** * Name * add_mods_2_gtk_menu @@ -915,70 +887,6 @@ void gui_add_mods_2_gtk_menu(gint mod_type, GtkWidget *menu, } } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * ncr_to_utf8 - * - * Synopsis - * #include "gui/utilities.h" - * - * gchar * util_ncr2utf8(gchar * text) - * - * Description - * Converts a string containing numeric character references (NCR) to utf-8 encoding - * - * A numeric character reference (NCR) is a common markup construct used in html - * pages. It consists of a short sequence of characters that represent a single - * character from the Universal Character Set (UCS) of Unicode. - * - * NCR markup : &#; ex: é - * - * Return value - * gchar - */ - -gchar *ncr_to_utf8(gchar *text) -{ - gchar *ncr; - gunichar unicode; - gchar utf8[7]; - guint len; - GString *newtext = g_string_new(NULL); - - for (ncr = strstr(text, "&#"); - ncr; text = ncr, ncr = strstr(text, "&#")) { - newtext = g_string_append_len(newtext, text, ncr - text); - - // convert ncr value (string) to unicode (guint32) - unicode = 0; - for (ncr = ncr + 2; // just past "&#" - (*ncr != '\0') && (*ncr >= '0') && (*ncr <= '9'); - ncr++) - unicode = (unicode * 10) + ((*ncr) - '0'); - - // converts unicode char to utf8 - // need proper terminator + validation of content - if ((*ncr == ';') && g_unichar_validate(unicode)) { - ncr++; // step past ';' - len = g_unichar_to_utf8(unicode, utf8); - utf8[len] = '\0'; - newtext = g_string_append(newtext, utf8); - } else { - g_string_append_printf(newtext, "&#%d;", unicode); - XI_message(("ncr2utf8: invalid unicode &#%d;\n", - unicode)); - } - } - - if (*text != '\0') // residual text? paste it on. - newtext = g_string_append(newtext, text); - - return g_string_free(newtext, FALSE); -} -#endif - // // for choosing variants, primary/secondary/all. // diff --git a/src/main/biblesync_glue.cc b/src/main/biblesync_glue.cc index e15251791..247ca520a 100644 --- a/src/main/biblesync_glue.cc +++ b/src/main/biblesync_glue.cc @@ -770,28 +770,6 @@ int biblesync_personal() return biblesync->getMode() == BSP_MODE_PERSONAL; } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * biblesync_active - * - * Synopsis - * #include "backend/biblesync.hh" - * void biblesync_active() - * - * Description - * determines whether BibleSync is active or disabled. - * - * Return value - * int - */ -int biblesync_active() -{ - return biblesync->getMode() != BSP_MODE_DISABLE; -} -#endif - /****************************************************************************** * Name * biblesync_active_xmit_allowed diff --git a/src/main/display.cc b/src/main/display.cc index 5c005dc2d..9ee1570d7 100644 --- a/src/main/display.cc +++ b/src/main/display.cc @@ -1100,9 +1100,6 @@ GTKChapDisp::getVerseBefore(SWModule &imodule) int chapter = key->getChapter(); int curBook = key->getBook(); int curTest = key->getTestament(); -#if 0 - const char *ModuleName = imodule.getName(); -#endif key->setVerse(1); imodule--; @@ -1184,27 +1181,6 @@ GTKChapDisp::getVerseBefore(SWModule &imodule) key->setChapter(i * chapter); key->setVerse(0); -#if 0 // with footnote counting, we no longer cache before/after verses. - ModuleCache::CacheVerse& cVerse = ModuleMap - [ModuleName] - [key->Testament()] - [key->Book()] - [key->Chapter()] - [key->Verse()]; - - if (!cVerse.CacheIsValid(cache_flags)) - cVerse.SetText((strongs_or_morph - ? block_render(imodule.renderText().c_str()) - : imodule.renderText().c_str()), - cache_flags); - buf = g_strdup_printf("%s
", cVerse.GetText()); -#else -# if 0 - buf = g_strdup_printf("%s
", - (strongs_or_morph - ? block_render(imodule.renderText().c_str()) - : imodule.renderText().c_str())); -# else // gosh this is gross. // hunt down self-closing
and stomp them with spaces. // this is disgustingly special-case, caused by self-closing
@@ -1239,8 +1215,6 @@ GTKChapDisp::getVerseBefore(SWModule &imodule) buf = g_strdup_printf("%s
", (strongs_or_morph ? block_render(divBuf->str) : divBuf->str)); g_string_free(divBuf, TRUE); -# endif -#endif /* !0 */ swbuf.append(buf); g_free(buf); } @@ -1258,9 +1232,6 @@ void GTKChapDisp::getVerseAfter(SWModule &imodule) { gchar *buf; -#if 0 - const char *ModuleName = imodule.Name(); -#endif sword::VerseKey *key = (VerseKey *)(SWKey *) imodule; imodule++; diff --git a/src/main/modulecache.cc b/src/main/modulecache.cc index eb16f1cd5..7d27f1556 100644 --- a/src/main/modulecache.cc +++ b/src/main/modulecache.cc @@ -80,15 +80,3 @@ ModuleCacheErase(const char *modname) ModuleMap.erase(itr); // or just ModuleMap.erase(modname), i guess. } - -#if 0 -// unused at this time -- we don't cache book content. -void -BookModuleCacheErase(const char *modname) -{ - BookCacheMap::iterator itr = BookModuleMap.find(modname); - - if (itr != BookModuleMap.end()) - BookModuleMap.erase(itr); -} -#endif diff --git a/src/main/navbar.cc b/src/main/navbar.cc index e4dd65491..f376cb2a9 100644 --- a/src/main/navbar.cc +++ b/src/main/navbar.cc @@ -127,72 +127,3 @@ void main_navbar_set(NAVBAR navbar, const char *key) delete vkey; } - -#if 0 -// unneeded at this time. disabled to silence cppcheck. -void main_navbar_fill_book_combo(NAVBAR navbar) -{ - if (!navbar.module_name) - return; - - SWModule *mod = backend->get_SWModule(navbar.module_name); - if (!mod) - return; - - VerseKey *key = (VerseKey *)mod->createKey(); - char *book = NULL; - GtkTreeIter iter; - int i = 0; - - if (navbar.testaments == backend->module_get_testaments(navbar.module_name)) - return; - - navbar.testaments = backend->module_get_testaments(navbar.module_name); - - do_display = FALSE; - - GtkTreeModel *book_model = gtk_combo_box_get_model( - GTK_COMBO_BOX(navbar.comboboxentry_book)); - gtk_list_store_clear(GTK_LIST_STORE(book_model)); - - if (backend->module_has_testament(navbar.module_name, 1)) { - while (i < key->BMAX[0]) { - key->setTestament(1); - key->setBook(i + 1); - book = strdup((const char *)key->getBookName()); - XI_message(("book: %s", book)); - gtk_list_store_append(GTK_LIST_STORE(book_model), &iter); - gtk_list_store_set(GTK_LIST_STORE(book_model), - &iter, - 0, - book, - -1); - - ++i; - g_free(book); - } - } - - i = 0; - if (backend->module_has_testament(navbar.module_name, 2)) { - while (i < key->BMAX[1]) { - key->setTestament(2); - key->setBook(i + 1); - book = strdup((const char *)key->getBookName()); - XI_message(("book: %s", book)); - gtk_list_store_append(GTK_LIST_STORE(book_model), &iter); - gtk_list_store_set(GTK_LIST_STORE(book_model), - &iter, - 0, - book, - -1); - ++i; - g_free(book); - } - } - main_navbar_set(navbar, navbar.key); - do_display = TRUE; - - delete key; -} -#endif diff --git a/src/main/parallel_view.cc b/src/main/parallel_view.cc index 86249b59b..5eb078ea2 100644 --- a/src/main/parallel_view.cc +++ b/src/main/parallel_view.cc @@ -144,66 +144,6 @@ static void set_global_textual_reading(const char *option, int choice) g_free(buf); } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * main_parallel_change_verse - * - * Synopsis - * #include ".h" - * - * gchar *main_parallel_change_verse(void) - * - * Description - * this is for the parallel dialog only - * - * - * - * Return value - * gchar * - */ - -gchar *main_parallel_change_verse(void) -{ - gchar *retval; - const gchar *bookname; - gchar buf[256]; - gint chapter, verse; - char *newbook; - char *numC, *numV; - - bookname = gtk_entry_get_text(GTK_ENTRY(entrycbIntBook)); - chapter = - gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sbIntChapter)); - verse = - gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sbIntVerse)); - - sprintf(buf, "%s %d:%d", bookname, chapter, verse); - - newbook = backend_p->key_get_book(settings.parallel_list[0], buf); - chapter = backend_p->key_get_chapter(settings.parallel_list[0], buf); - verse = backend_p->key_get_verse(settings.parallel_list[0], buf); - - if (strcmp(bookname, newbook)) - gtk_entry_set_text(GTK_ENTRY(entrycbIntBook), newbook); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(sbIntChapter), - chapter); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(sbIntVerse), verse); - - numC = main_format_number(chapter); - numV = main_format_number(verse); - sprintf(buf, "%s %s:%s", newbook, numC, numV); - g_free(numC); - g_free(numV); - - gtk_entry_set_text(GTK_ENTRY(entryIntLookup), buf); - retval = buf; - g_free(newbook); - return retval; -} -#endif - /****************************************************************************** * Name * gui_set_parallel_module_global_options @@ -479,11 +419,7 @@ void main_load_g_ops_parallel(GtkWidget *menu) (char *)"Headings"); item = gtk_check_menu_item_new_with_label(_("Morpheme Segmentation")); -#if 0 - gtk_widget_show(item); -#else gtk_widget_hide(item); -#endif gtk_container_add(GTK_CONTAINER(menu), item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), settings.parallel_segmentation); @@ -1036,58 +972,6 @@ void main_swap_parallel_with_main(char *intmod) gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets.notebook_bible_parallel), 0); } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * load_menu_formmod_list - * - * Synopsis - * #include "main/parallel_view.h - * - * void load_menu_formmod_list(GtkWidget *pmInt, GList *mods, - * gchar *label, GCallback mycallback) - * - * Description - * - * - * Return value - * void - */ - -void main_load_menu_form_mod_list(GtkWidget *pmInt, gchar *label, - GCallback mycallback) -{ - GList *tmp = get_list(TEXT_DESC_LIST); - GtkWidget *view_module; - GtkWidget *view_module_menu; - - view_module = gtk_menu_item_new_with_label(label); - gtk_widget_show(view_module); - gtk_container_add(GTK_CONTAINER(pmInt), view_module); - - view_module_menu = gtk_menu_new(); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(view_module), - view_module_menu); - /* view_module_menu_accels = - gtk_menu_ensure_uline_accel_group(GTK_MENU - (view_module_menu));*/ - while (tmp != NULL) { - GtkWidget *item = - gtk_menu_item_new_with_label((gchar *)tmp->data); - gtk_widget_show(item); - g_signal_connect(G_OBJECT(item), "activate", - G_CALLBACK(mycallback), - g_strdup((gchar *)tmp->data)); - - gtk_container_add(GTK_CONTAINER(view_module_menu), - item); - tmp = g_list_next(tmp); - } - g_list_free(tmp); -} -#endif - /****************************************************************************** * Name * main_init_parallel_view diff --git a/src/main/previewer.cc b/src/main/previewer.cc index 827a1e24d..a920f8ad0 100644 --- a/src/main/previewer.cc +++ b/src/main/previewer.cc @@ -68,16 +68,6 @@ void main_set_previewer_widget(int in_sidebar) previewer_html_widget = widgets.html_previewer_text; } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -GtkWidget *main_get_previewer_widget(void) -{ - return settings.show_previewer_in_sidebar - ? sidebar.html_viewer_widget - : widgets.html_previewer_text; -} -#endif - /****************************************************************************** * Name * main_init_previewer @@ -113,35 +103,6 @@ void main_init_previewer(void) g_string_free(str, TRUE); } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * main_clear_viewer - * - * Synopsis - * #include "main/previewer.h" - * - * void main_clear_viewer(void) - * - * Description - * clear the information viewer - * - * Return value - * void - */ - -void main_clear_viewer(void) -{ -#ifdef USE_PREVIEWER_AUTOCLEAR - if (!previewer_html_widget || - !GTK_WIDGET_REALIZED(GTK_WIDGET(previewer_html_widget))) - return; - main_init_previewer(); -#endif /* USE_PREVIEWER_AUTOCLEAR */ -} -#endif - /****************************************************************************** * Name * main_information_viewer diff --git a/src/main/sword.cc b/src/main/sword.cc index a7c41a898..ef1c35595 100644 --- a/src/main/sword.cc +++ b/src/main/sword.cc @@ -559,30 +559,6 @@ const char *main_get_sword_version(void) return backend->get_sword_version(); } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * - * - * Synopsis - * #include "main/.h" - * - * - * - * Description - * - * - * Return value - * char* - */ - -char *main_get_treekey_local_name(unsigned long offset) -{ - return backend->treekey_get_local_name(offset); -} -#endif - /****************************************************************************** * Name * get_search_results_text @@ -1450,17 +1426,6 @@ void main_display_devotional(void) g_free(prettybuf); } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -void main_refresh_all(void) -{ - main_display_bible(settings.MainWindowModule, settings.currentverse); - main_display_commentary(settings.CommWindowModule, settings.currentverse); - main_display_book(settings.book_mod, settings.book_key); - main_display_dictionary(settings.DictWindowModule, settings.dictkey); -} -#endif - void main_setup_displays(void) { backend->textDisplay = new GTKChapDisp(widgets.html_text, backend); @@ -1583,30 +1548,6 @@ int main_optimal_search(char *mod_name) return mod->isSearchOptimallySupported("God", -4, 0, 0); } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * get_mod_about_info - * - * Synopsis - * #include "main/module.h" - * - * gchar *get_mod_about_info(char * mod_name) - * - * Description - * - * - * Return value - * gchar * - */ - -char *main_get_mod_about_info(char *mod_name) -{ - return backend->get_config_entry(mod_name, (char *)"About"); -} -#endif - char *main_get_mod_config_entry(const char *module_name, const char *entry) { @@ -1749,30 +1690,6 @@ char *main_get_striptext(char *module_name, char *key) return backend->get_strip_text(module_name, key); } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * main_get_striptext - * - * Synopsis - * #include "main/sword.h" - * - * char *main_get_striptext(char *module_name, char *key) - * - * Description - * - * - * Return value - * char * - */ - -char *main_get_striptext_from_string(char *module_name, char *string) -{ - return backend->get_strip_text_from_string(module_name, string); -} -#endif - /****************************************************************************** * Name * main_get_rendered_text @@ -1815,30 +1732,6 @@ char *main_get_raw_text(char *module_name, char *key) return backend->get_raw_text(module_name, key); } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * main_get_raw_text - * - * Synopsis - * #include "main/sword.h" - * - * char *main_get_raw_text(char *module_name, char *key) - * - * Description - * - * - * Return value - * char * - */ - -char *main_get_book_key_from_offset(unsigned long offset) -{ - return backend->get_key_from_offset(offset); -} -#endif - /****************************************************************************** * Name * main_get_mod_type @@ -1925,46 +1818,6 @@ main_format_number(int x) return digits; } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * main_deformat_number - * - * Synopsis - * #include "main/sword.h" - * int main_deformat_number(char *digitstring) - * - * Description - * returns the numeric value of the digitstring with - * respect to whether it's ordinary digits or farsi. - * - * Return value - * int - */ - -int -main_deformat_number(char *digitstring) -{ - if (re_encode_digits) { - // we can afford to make big assumptions because - // we produced this string, so we can play fast-n-loose. - // - digits have a particular content. - // - never negative. - // - one digit == 2 characters & only the 2nd is important. - char *d; - int result = 0; - d = digitstring; - while (*d) { - result = 10 * result + (*(++d) - '\260'); - ++d; - } - return result; - } - return atoi(digitstring); -} -#endif - /****************************************************************************** * Name * main_flush_widgets_content diff --git a/src/main/sword_treekey.cc b/src/main/sword_treekey.cc index b86eca623..d5b95bceb 100644 --- a/src/main/sword_treekey.cc +++ b/src/main/sword_treekey.cc @@ -129,18 +129,6 @@ void setEntryText(RawGenBook *book, const gchar *text) } } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -void appendSibbling(TreeKeyIdx *treeKey, const gchar *name) -{ - if (treeKey->getOffset()) { - treeKey->append(); - treeKey->setLocalName(name); - treeKey->save(); - } -} -#endif - void appendChild(TreeKeyIdx *treeKey, const gchar *name) { treeKey->appendChild(); diff --git a/src/main/tab_history.c b/src/main/tab_history.c index ef9e60c0c..f99396975 100644 --- a/src/main/tab_history.c +++ b/src/main/tab_history.c @@ -394,12 +394,6 @@ void main_navigate_tab_history(gint direction) } else { if (tab->current_history_item > 0) { --tab->current_history_item; -#if 0 - if (tab->first_back_click && - (tab->current_history_item > 0)) - --tab->current_history_item; -#endif - main_change_verse_tab_history(tab->current_history_item); tab->first_back_click = FALSE; } diff --git a/src/main/xml.c b/src/main/xml.c index cc47bbdef..f6678ebcf 100644 --- a/src/main/xml.c +++ b/src/main/xml.c @@ -190,31 +190,6 @@ void xml_add_bookmark_to_parent(xmlNodePtr parent, (const xmlChar *) caption); */ } -#if 0 -// unneeded at this time. disabled to silence cppcheck. -/****************************************************************************** - * Name - * xml_write_bookmark_doc - * - * Synopsis - * #include "main/xml.h" - * - * void xml_write_bookmark_doc(const xmlChar * xml_filename) - * - * Description - * - * - * Return value - * void - */ - -void xml_write_bookmark_doc(const xmlChar *xml_filename) -{ - XI_print(("\nsaving = %s\n", xml_filename)); - xmlSaveFormatFile((const char *)xml_filename, bookmark_doc, 1); -} -#endif - /****************************************************************************** * Name *