Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop dead code #965

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 0 additions & 174 deletions src/editor/slib-editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
"<ui>\n"
" <menubar name='main-menu'>\n"
Expand Down Expand Up @@ -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),
Expand All @@ -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);

Expand Down
25 changes: 0 additions & 25 deletions src/gtk/bibletext.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
70 changes: 0 additions & 70 deletions src/gtk/commentary_dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 ******/
68 changes: 0 additions & 68 deletions src/gtk/dictlex.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
Loading