[ghex] libgtkhex: Great Renaming(tm): s/GtkHex/HexWidget
- From: Logan Rathbone <larathbone src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ghex] libgtkhex: Great Renaming(tm): s/GtkHex/HexWidget
- Date: Mon, 27 Dec 2021 21:35:16 +0000 (UTC)
commit 3537c5414fad2fd5b6c49870da2707ae0ecbba72
Author: Logan Rathbone <poprocks gmail com>
Date: Sun Dec 26 15:25:16 2021 -0500
libgtkhex: Great Renaming(tm): s/GtkHex/HexWidget
src/chartable.c | 18 +-
src/chartable.h | 2 +-
src/common-ui.c | 12 +-
src/common-ui.h | 4 +-
src/configuration.c | 2 +-
src/converter.c | 18 +-
src/converter.h | 4 +-
src/findreplace.c | 68 ++---
src/findreplace.h | 2 +-
src/ghex-application-window.c | 126 +++++-----
src/ghex-application-window.h | 8 +-
src/ghex-notebook-tab.c | 18 +-
src/ghex-notebook-tab.h | 4 +-
src/gtkhex-layout-manager.c | 114 ++++-----
src/gtkhex-layout-manager.h | 45 ++--
src/gtkhex-paste-data.c | 24 +-
src/gtkhex-paste-data.h | 15 +-
src/gtkhex.c | 560 +++++++++++++++++++++---------------------
src/gtkhex.h | 66 ++---
src/hex-document.c | 12 +-
src/hex-document.h | 2 +-
src/meson.build | 18 +-
src/paste-special.c | 32 +--
src/preferences.c | 16 +-
src/print.c | 4 +-
25 files changed, 588 insertions(+), 606 deletions(-)
---
diff --git a/src/chartable.c b/src/chartable.c
index 0486798..a72cc31 100644
--- a/src/chartable.c
+++ b/src/chartable.c
@@ -37,7 +37,7 @@
/* STATIC GLOBALS */
static GtkTreeSelection *sel_row = NULL;
-static GtkHex *gh_glob = NULL;
+static HexWidget *gh_glob = NULL;
static char *ascii_non_printable_label[] = {
"NUL",
@@ -82,9 +82,9 @@ insert_char (GtkTreeView *treeview, GtkTreeModel *model)
GValue value = { 0 };
HexDocument *doc;
- g_return_if_fail (GTK_IS_HEX(gh_glob));
+ g_return_if_fail (HEX_IS_WIDGET(gh_glob));
- doc = gtk_hex_get_document (gh_glob);
+ doc = hex_widget_get_document (gh_glob);
selection = gtk_tree_view_get_selection(treeview);
if (! gtk_tree_selection_get_selected (selection, &model, &iter))
@@ -94,11 +94,11 @@ insert_char (GtkTreeView *treeview, GtkTreeModel *model)
if (selection == sel_row) {
hex_document_set_byte (doc,
(guchar)atoi(g_value_get_string(&value)),
- gtk_hex_get_cursor (gh_glob),
- gtk_hex_get_insert_mode (gh_glob),
+ hex_widget_get_cursor (gh_glob),
+ hex_widget_get_insert_mode (gh_glob),
TRUE); /* undoable */
- gtk_hex_set_cursor (gh_glob, gtk_hex_get_cursor (gh_glob) + 1);
+ hex_widget_set_cursor (gh_glob, hex_widget_get_cursor (gh_glob) + 1);
}
g_value_unset(&value);
sel_row = selection;
@@ -142,7 +142,7 @@ hide_chartable_cb (GtkButton *button, gpointer user_data)
gtk_window_close (win);
}
-GtkWidget *create_char_table(GtkWindow *parent_win, GtkHex *gh)
+GtkWidget *create_char_table(GtkWindow *parent_win, HexWidget *gh)
{
static gchar *fmt[] = { NULL, "%02X", "%03d", "%03o" };
static gchar *titles[] = { N_("ASCII"), N_("Hex"), N_("Decimal"),
@@ -157,8 +157,8 @@ GtkWidget *create_char_table(GtkWindow *parent_win, GtkHex *gh)
int i, col;
gchar *label, ascii_printable_label[2], bin_label[9], *row[5];
- /* set global GtkHex widget */
- g_assert (GTK_IS_HEX(gh));
+ /* set global HexWidget widget */
+ g_assert (HEX_IS_WIDGET(gh));
gh_glob = gh;
/* Create our char table window and set as child of parent window,
diff --git a/src/chartable.h b/src/chartable.h
index 5b2ac47..88f66bf 100644
--- a/src/chartable.h
+++ b/src/chartable.h
@@ -35,7 +35,7 @@
G_BEGIN_DECLS
GtkWidget *create_char_table (GtkWindow *parent_win, /* can-NULL */
- GtkHex *gh);
+ HexWidget *gh);
G_END_DECLS
diff --git a/src/common-ui.c b/src/common-ui.c
index 0931fc1..6f06ab9 100644
--- a/src/common-ui.c
+++ b/src/common-ui.c
@@ -188,9 +188,9 @@ set_css_provider_font_from_settings (void)
}
void
-common_set_gtkhex_font_from_settings (GtkHex *gh)
+common_set_gtkhex_font_from_settings (HexWidget *gh)
{
- g_return_if_fail (GTK_IS_HEX(gh));
+ g_return_if_fail (HEX_IS_WIDGET(gh));
g_return_if_fail (GTK_IS_STYLE_PROVIDER(provider));
/* Ensure global provider and settings are in sync font-wise. */
@@ -298,7 +298,7 @@ common_about_cb (GtkWindow *parent)
* display the print dialog.
*/
void
-common_print (GtkWindow *parent, GtkHex *gh, gboolean preview)
+common_print (GtkWindow *parent, HexWidget *gh, gboolean preview)
{
GHexPrintJobInfo *job;
HexDocument *doc;
@@ -306,14 +306,14 @@ common_print (GtkWindow *parent, GtkHex *gh, gboolean preview)
GError *error = NULL;
char *basename;
- g_return_if_fail (GTK_IS_HEX (gh));
+ g_return_if_fail (HEX_IS_WIDGET (gh));
- doc = gtk_hex_get_document (gh);
+ doc = hex_widget_get_document (gh);
g_return_if_fail (HEX_IS_DOCUMENT (doc));
basename = g_file_get_basename (hex_document_get_file (doc));
- job = ghex_print_job_info_new (doc, gtk_hex_get_group_type (gh));
+ job = ghex_print_job_info_new (doc, hex_widget_get_group_type (gh));
job->master = gtk_print_operation_new ();
job->config = gtk_print_settings_new ();
gtk_print_settings_set (job->config, GTK_PRINT_SETTINGS_OUTPUT_BASENAME,
diff --git a/src/common-ui.h b/src/common-ui.h
index 2c6b94e..b779116 100644
--- a/src/common-ui.h
+++ b/src/common-ui.h
@@ -46,8 +46,8 @@ G_BEGIN_DECLS
void common_help_cb (GtkWindow *parent);
void common_about_cb (GtkWindow *parent);
-void common_print (GtkWindow *parent, GtkHex *gh, gboolean preview);
-void common_set_gtkhex_font_from_settings (GtkHex *gh);
+void common_print (GtkWindow *parent, HexWidget *gh, gboolean preview);
+void common_set_gtkhex_font_from_settings (HexWidget *gh);
void display_error_dialog (GtkWindow *parent, const char *msg);
void display_info_dialog (GtkWindow *parent, const char *msg);
diff --git a/src/configuration.c b/src/configuration.c
index 9fea4d2..9ecccba 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -35,7 +35,7 @@
#include "configuration.h"
GSettings *settings;
-/* Global CSS provider for our GtkHex widgets */
+/* Global CSS provider for our HexWidget widgets */
GtkCssProvider *provider;
int def_group_type;
diff --git a/src/converter.c b/src/converter.c
index 6a634fe..932544d 100644
--- a/src/converter.c
+++ b/src/converter.c
@@ -48,7 +48,7 @@
typedef struct _Converter {
GtkWidget *window;
- GtkHex *gh;
+ HexWidget *gh;
GtkWidget *entry[5];
GtkWidget *close;
GtkWidget *get;
@@ -164,7 +164,7 @@ close_converter(GtkWidget *dialog, int response_id, gpointer user_data)
}
GtkWidget *create_converter (GtkWindow *parent_win, /* can-NULL */
- GtkHex *gh)
+ HexWidget *gh)
{
Converter *conv;
GtkWidget *grid;
@@ -176,8 +176,8 @@ GtkWidget *create_converter (GtkWindow *parent_win, /* can-NULL */
/* set global for usage in other functions. */
converter = conv;
- /* set struct's GtkHex widget */
- g_assert (GTK_IS_HEX(gh));
+ /* set struct's HexWidget widget */
+ g_assert (HEX_IS_WIDGET(gh));
conv->gh = gh;
conv->window = gtk_dialog_new_with_buttons(_("Base Converter"),
@@ -240,18 +240,18 @@ get_cursor_val_cb(GtkButton *button, Converter *conv)
HexDocument *doc;
size_t payload;
- g_return_if_fail (GTK_IS_HEX(conv->gh));
+ g_return_if_fail (HEX_IS_WIDGET(conv->gh));
- doc = gtk_hex_get_document (conv->gh);
+ doc = hex_widget_get_document (conv->gh);
payload = hex_buffer_get_payload_size (hex_document_get_buffer (doc));
- group_type = gtk_hex_get_group_type (conv->gh);
- start = gtk_hex_get_cursor (conv->gh);
+ group_type = hex_widget_get_group_type (conv->gh);
+ start = hex_widget_get_cursor (conv->gh);
start = start - start % group_type;
val = 0;
do {
val <<= 8;
- val |= gtk_hex_get_byte(conv->gh, start);
+ val |= hex_widget_get_byte(conv->gh, start);
start++;
} while((start % group_type != 0) &&
(start < payload) );
diff --git a/src/converter.h b/src/converter.h
index 0348fac..4358ae8 100644
--- a/src/converter.h
+++ b/src/converter.h
@@ -1,7 +1,7 @@
/* vim: colorcolumn=80 ts=4 sw=4
*/
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* gtkhex.h - definition of a GtkHex widget, modified for use with GnomeMDI
+/* gtkhex.h - definition of a HexWidget widget, modified for use with GnomeMDI
Copyright (C) 2004 Free Software Foundation
@@ -38,7 +38,7 @@
G_BEGIN_DECLS
GtkWidget *create_converter (GtkWindow *parent_win, /* can-NULL */
- GtkHex *gh);
+ HexWidget *gh);
G_END_DECLS
diff --git a/src/findreplace.c b/src/findreplace.c
index 2ec599e..758defc 100644
--- a/src/findreplace.c
+++ b/src/findreplace.c
@@ -54,8 +54,8 @@ static guint signals[LAST_SIGNAL];
typedef struct
{
- GtkHex *gh;
- GtkHex_AutoHighlight *auto_highlight;
+ HexWidget *gh;
+ HexWidget_AutoHighlight *auto_highlight;
} PaneDialogPrivate;
@@ -113,21 +113,21 @@ static void replace_clear_cb (GtkButton *button, gpointer user_data);
static void goto_byte_cb (GtkButton *button, gpointer user_data);
static gint64 get_search_string (HexDocument *doc, gchar **str);
static void pane_dialog_update_busy_state (PaneDialog *self);
-static void mark_gh_busy (GtkHex *gh, gboolean busy);
+static void mark_gh_busy (HexWidget *gh, gboolean busy);
static GtkWidget *
create_hex_view (HexDocument *doc)
{
GtkWidget *gh;
- gh = gtk_hex_new (doc);
+ gh = hex_widget_new (doc);
g_object_ref (gh);
gtk_widget_set_hexpand (gh, TRUE);
- gtk_hex_set_group_type (GTK_HEX(gh), def_group_type);
- common_set_gtkhex_font_from_settings (GTK_HEX(gh));
- gtk_hex_set_insert_mode (GTK_HEX(gh), TRUE);
- gtk_hex_set_geometry (GTK_HEX(gh), 16, 4);
+ hex_widget_set_group_type (HEX_WIDGET(gh), def_group_type);
+ common_set_gtkhex_font_from_settings (HEX_WIDGET(gh));
+ hex_widget_set_insert_mode (HEX_WIDGET(gh), TRUE);
+ hex_widget_set_geometry (HEX_WIDGET(gh), 16, 4);
return gh;
}
@@ -151,7 +151,7 @@ pane_dialog_real_close (PaneDialog *self)
PaneDialogPrivate *priv = pane_dialog_get_instance_private (self);
if (priv->auto_highlight && priv->gh) {
- gtk_hex_delete_autohighlight (priv->gh, priv->auto_highlight);
+ hex_widget_delete_autohighlight (priv->gh, priv->auto_highlight);
}
priv->auto_highlight = NULL;
@@ -202,14 +202,14 @@ set_watch_cursor (GtkWidget *widget, gboolean enabled)
}
static void
-mark_gh_busy (GtkHex *gh, gboolean busy)
+mark_gh_busy (HexWidget *gh, gboolean busy)
{
set_watch_cursor (GTK_WIDGET(gh), busy);
g_object_set_data (G_OBJECT(gh), "busy", GINT_TO_POINTER(busy));
}
static gboolean
-gh_is_busy (GtkHex *gh)
+gh_is_busy (HexWidget *gh)
{
gpointer data = g_object_get_data (G_OBJECT(gh), "busy");
@@ -244,15 +244,15 @@ find_ready_cb (GObject *source_object,
if (find_data->found)
{
f_priv->found = TRUE;
- gtk_hex_set_cursor (priv->gh, find_data->offset);
+ hex_widget_set_cursor (priv->gh, find_data->offset);
/* If string found, insert auto-highlights of search string */
if (priv->auto_highlight)
- gtk_hex_delete_autohighlight (priv->gh, priv->auto_highlight);
+ hex_widget_delete_autohighlight (priv->gh, priv->auto_highlight);
priv->auto_highlight = NULL;
- priv->auto_highlight = gtk_hex_insert_autohighlight (priv->gh,
+ priv->auto_highlight = hex_widget_insert_autohighlight (priv->gh,
find_data->what, find_data->len);
gtk_widget_grab_focus (GTK_WIDGET(priv->gh));
@@ -287,14 +287,14 @@ find_common (FindDialog *self, enum FindDirection direction,
g_return_if_fail (FIND_IS_DIALOG(self));
priv = pane_dialog_get_instance_private (PANE_DIALOG(self));
- g_return_if_fail (GTK_IS_HEX (priv->gh));
+ g_return_if_fail (HEX_IS_WIDGET (priv->gh));
f_priv = find_dialog_get_instance_private (self);
g_return_if_fail (HEX_IS_DOCUMENT (f_priv->f_doc));
parent = GTK_WINDOW(gtk_widget_get_native (widget));
- doc = gtk_hex_get_document (priv->gh);
- cursor_pos = gtk_hex_get_cursor (priv->gh);
+ doc = hex_widget_get_document (priv->gh);
+ cursor_pos = hex_widget_get_cursor (priv->gh);
str_len = get_search_string (f_priv->f_doc, &str);
if (str_len == 0)
@@ -375,7 +375,7 @@ find_clear_cb (GtkButton *button, gpointer user_data)
g_return_if_fail (FIND_IS_DIALOG (self));
f_priv = find_dialog_get_instance_private (self);
- g_return_if_fail (GTK_IS_HEX (f_priv->f_gh));
+ g_return_if_fail (HEX_IS_WIDGET (f_priv->f_gh));
g_return_if_fail (HEX_IS_DOCUMENT (f_priv->f_doc));
new_doc = hex_document_new ();
@@ -412,14 +412,14 @@ goto_byte_cb (GtkButton *button, gpointer user_data)
g_return_if_fail (JUMP_IS_DIALOG(self));
priv = pane_dialog_get_instance_private (PANE_DIALOG(self));
- g_return_if_fail (GTK_IS_HEX(priv->gh));
+ g_return_if_fail (HEX_IS_WIDGET(priv->gh));
parent = GTK_WINDOW(gtk_widget_get_native (widget));
if (! GTK_IS_WINDOW(parent))
parent = NULL;
- doc = gtk_hex_get_document (priv->gh);
- cursor_pos = gtk_hex_get_cursor (priv->gh);
+ doc = hex_widget_get_document (priv->gh);
+ cursor_pos = hex_widget_get_cursor (priv->gh);
payload = hex_buffer_get_payload_size (hex_document_get_buffer (doc));
entry = GTK_ENTRY(self->int_entry);
@@ -477,7 +477,7 @@ goto_byte_cb (GtkButton *button, gpointer user_data)
"end of file."));
} else {
/* SUCCESS */
- gtk_hex_set_cursor (priv->gh, byte);
+ hex_widget_set_cursor (priv->gh, byte);
gtk_widget_grab_focus (GTK_WIDGET(priv->gh));
}
}
@@ -509,7 +509,7 @@ replace_one_cb (GtkButton *button, gpointer user_data)
g_return_if_fail (REPLACE_IS_DIALOG(self));
priv = pane_dialog_get_instance_private (PANE_DIALOG(self));
- g_return_if_fail (GTK_IS_HEX (priv->gh));
+ g_return_if_fail (HEX_IS_WIDGET (priv->gh));
f_priv = find_dialog_get_instance_private (FIND_DIALOG(self));
g_return_if_fail (HEX_IS_DOCUMENT (f_priv->f_doc));
@@ -519,8 +519,8 @@ replace_one_cb (GtkButton *button, gpointer user_data)
if (! GTK_IS_WINDOW(parent))
parent = NULL;
- doc = gtk_hex_get_document (priv->gh);
- cursor_pos = gtk_hex_get_cursor (priv->gh);
+ doc = hex_widget_get_document (priv->gh);
+ cursor_pos = hex_widget_get_cursor (priv->gh);
payload = hex_buffer_get_payload_size (hex_document_get_buffer (doc));
if ((find_len = get_search_string(f_priv->f_doc, &find_str)) == 0)
@@ -542,7 +542,7 @@ replace_one_cb (GtkButton *button, gpointer user_data)
if (hex_document_find_forward(doc, cursor_pos + rep_len,
find_str, find_len, &offset))
{
- gtk_hex_set_cursor(priv->gh, offset);
+ hex_widget_set_cursor(priv->gh, offset);
}
else {
display_info_dialog (parent, _("String was not found."));
@@ -573,7 +573,7 @@ replace_all_cb (GtkButton *button, gpointer user_data)
g_return_if_fail (REPLACE_IS_DIALOG (self));
priv = pane_dialog_get_instance_private (PANE_DIALOG(self));
- g_return_if_fail (GTK_IS_HEX (priv->gh));
+ g_return_if_fail (HEX_IS_WIDGET (priv->gh));
f_priv = find_dialog_get_instance_private (FIND_DIALOG(self));
g_return_if_fail (HEX_IS_DOCUMENT (f_priv->f_doc));
g_return_if_fail (HEX_IS_DOCUMENT (self->r_doc));
@@ -582,8 +582,8 @@ replace_all_cb (GtkButton *button, gpointer user_data)
if (! GTK_IS_WINDOW(parent))
parent = NULL;
- doc = gtk_hex_get_document (priv->gh);
- cursor_pos = gtk_hex_get_cursor (priv->gh);
+ doc = hex_widget_get_document (priv->gh);
+ cursor_pos = hex_widget_get_cursor (priv->gh);
payload = hex_buffer_get_payload_size (hex_document_get_buffer (doc));
if ((find_len = get_search_string(f_priv->f_doc, &find_str)) == 0)
@@ -606,7 +606,7 @@ replace_all_cb (GtkButton *button, gpointer user_data)
count++;
}
- gtk_hex_set_cursor(priv->gh, MIN(offset, payload));
+ hex_widget_set_cursor(priv->gh, MIN(offset, payload));
if (count == 0) {
display_info_dialog (parent, _("No occurrences were found."));
@@ -625,7 +625,7 @@ replace_clear_cb (GtkButton *button, gpointer user_data)
GtkWidget *new_r_gh;
HexDocument *new_r_doc;
- g_return_if_fail (GTK_IS_HEX (self->r_gh));
+ g_return_if_fail (HEX_IS_WIDGET (self->r_gh));
g_return_if_fail (HEX_IS_DOCUMENT (self->r_doc));
new_r_doc = hex_document_new ();
@@ -757,19 +757,19 @@ pane_dialog_update_busy_state (PaneDialog *self)
}
void
-pane_dialog_set_hex (PaneDialog *self, GtkHex *gh)
+pane_dialog_set_hex (PaneDialog *self, HexWidget *gh)
{
PaneDialogPrivate *priv;
g_return_if_fail (PANE_IS_DIALOG (self));
- g_return_if_fail (GTK_IS_HEX (gh));
+ g_return_if_fail (HEX_IS_WIDGET (gh));
priv = pane_dialog_get_instance_private (PANE_DIALOG(self));
/* Clear auto-highlight if any.
*/
if (priv->auto_highlight)
- gtk_hex_delete_autohighlight (priv->gh, priv->auto_highlight);
+ hex_widget_delete_autohighlight (priv->gh, priv->auto_highlight);
priv->auto_highlight = NULL;
priv->gh = gh;
diff --git a/src/findreplace.h b/src/findreplace.h
index a2541d2..08e3b60 100644
--- a/src/findreplace.h
+++ b/src/findreplace.h
@@ -78,7 +78,7 @@ G_DECLARE_FINAL_TYPE (JumpDialog, jump_dialog, JUMP, DIALOG, PaneDialog)
/* PUBLIC METHOD DECLARATIONS */
/* PaneDialog (generic) */
-void pane_dialog_set_hex (PaneDialog *self, GtkHex *gh);
+void pane_dialog_set_hex (PaneDialog *self, HexWidget *gh);
void pane_dialog_close (PaneDialog *self);
/* FindDialog */
diff --git a/src/ghex-application-window.c b/src/ghex-application-window.c
index 9defd25..c948dbe 100644
--- a/src/ghex-application-window.c
+++ b/src/ghex-application-window.c
@@ -50,7 +50,7 @@ struct _GHexApplicationWindow
{
GtkApplicationWindow parent_instance;
- GtkHex *gh;
+ HexWidget *gh;
HexDialog *dialog;
GtkWidget *dialog_widget;
GtkCssProvider *conversions_box_provider;
@@ -167,9 +167,9 @@ static void doc_read_ready_cb (GObject *source_object, GAsyncResult *res,
g_return_if_fail (GTK_IS_NOTEBOOK (notebook)); \
for (i = gtk_notebook_get_n_pages(notebook) - 1; i >= 0; --i) { \
GHexNotebookTab *tab;
\
- GtkHex *gh;
\
- gh = GTK_HEX(gtk_notebook_get_nth_page (notebook, i)); \
- g_return_if_fail (GTK_IS_HEX (gh));
\
+ HexWidget *gh;
\
+ gh = HEX_WIDGET(gtk_notebook_get_nth_page (notebook, i)); \
+ g_return_if_fail (HEX_IS_WIDGET (gh));
\
tab = GHEX_NOTEBOOK_TAB(gtk_notebook_get_tab_label (notebook, \
GTK_WIDGET(gh)));
\
g_return_if_fail (GHEX_IS_NOTEBOOK_TAB (tab)); \
@@ -188,15 +188,15 @@ static void doc_read_ready_cb (GObject *source_object, GAsyncResult *res,
*/
static void
-set_gtkhex_offsets_column_from_settings (GtkHex *gh)
+set_gtkhex_offsets_column_from_settings (HexWidget *gh)
{
- gtk_hex_show_offsets (gh, show_offsets_column);
+ hex_widget_show_offsets (gh, show_offsets_column);
}
static void
-set_gtkhex_group_type_from_settings (GtkHex *gh)
+set_gtkhex_group_type_from_settings (HexWidget *gh)
{
- gtk_hex_set_group_type (gh, def_group_type);
+ hex_widget_set_group_type (gh, def_group_type);
}
static void
@@ -279,13 +279,13 @@ static GHexNotebookTab *
ghex_application_window_get_current_tab (GHexApplicationWindow *self)
{
GtkNotebook *notebook;
- GtkHex *gh;
+ HexWidget *gh;
GHexNotebookTab *tab;
g_return_val_if_fail (GTK_IS_NOTEBOOK (self->hex_notebook), NULL);
notebook = GTK_NOTEBOOK(self->hex_notebook);
- gh = GTK_HEX(gtk_notebook_get_nth_page (notebook,
+ gh = HEX_WIDGET(gtk_notebook_get_nth_page (notebook,
gtk_notebook_get_current_page (notebook)));
if (gh)
@@ -303,10 +303,10 @@ ghex_application_window_remove_tab (GHexApplicationWindow *self,
{
GtkNotebook *notebook = GTK_NOTEBOOK(self->hex_notebook);
int page_num;
- GtkHex *tab_gh;
+ HexWidget *tab_gh;
tab_gh = ghex_notebook_tab_get_hex (tab);
- g_return_if_fail (GTK_IS_HEX(tab_gh));
+ g_return_if_fail (HEX_IS_WIDGET(tab_gh));
page_num = gtk_notebook_page_num (notebook, GTK_WIDGET(tab_gh));
gtk_notebook_remove_page (notebook, page_num);
@@ -319,9 +319,9 @@ file_save (GHexApplicationWindow *self)
{
HexDocument *doc;
- g_return_if_fail (GTK_IS_HEX (ACTIVE_GH));
+ g_return_if_fail (HEX_IS_WIDGET (ACTIVE_GH));
- doc = gtk_hex_get_document (ACTIVE_GH);
+ doc = hex_widget_get_document (ACTIVE_GH);
g_return_if_fail (HEX_IS_DOCUMENT (doc));
if (hex_document_write (doc)) {
@@ -358,10 +358,10 @@ close_all_tabs (GHexApplicationWindow *self)
for (i = gtk_notebook_get_n_pages(notebook) - 1; i >= 0; --i)
{
GHexNotebookTab *tab;
- GtkHex *gh;
+ HexWidget *gh;
- gh = GTK_HEX(gtk_notebook_get_nth_page (notebook, i));
- g_return_if_fail (GTK_IS_HEX (gh));
+ gh = HEX_WIDGET(gtk_notebook_get_nth_page (notebook, i));
+ g_return_if_fail (HEX_IS_WIDGET (gh));
tab = GHEX_NOTEBOOK_TAB(gtk_notebook_get_tab_label (notebook,
GTK_WIDGET(gh)));
@@ -423,13 +423,13 @@ check_close_window (GHexApplicationWindow *self)
for (i = gtk_notebook_get_n_pages(notebook) - 1; i >= 0; --i)
{
- GtkHex *gh;
+ HexWidget *gh;
HexDocument *doc = NULL;
- gh = GTK_HEX(gtk_notebook_get_nth_page (notebook, i));
- g_return_if_fail (GTK_IS_HEX (gh));
+ gh = HEX_WIDGET(gtk_notebook_get_nth_page (notebook, i));
+ g_return_if_fail (HEX_IS_WIDGET (gh));
- doc = gtk_hex_get_document (gh);
+ doc = hex_widget_get_document (gh);
g_return_if_fail (HEX_IS_DOCUMENT (doc));
if (hex_document_has_changed (doc))
@@ -493,8 +493,8 @@ close_doc_confirmation_dialog (GHexApplicationWindow *self,
char *message;
char *basename = NULL;
- GtkHex *gh = ghex_notebook_tab_get_hex (tab);
- doc = gtk_hex_get_document (gh);
+ HexWidget *gh = ghex_notebook_tab_get_hex (tab);
+ doc = hex_widget_get_document (gh);
g_return_if_fail (HEX_IS_DOCUMENT (doc));
if (G_IS_FILE (file = hex_document_get_file (doc)))
@@ -609,7 +609,7 @@ copy_special (GtkWidget *widget,
GdkClipboard *clipboard;
(void)action_name; (void)parameter;
- g_return_if_fail (GTK_IS_HEX (ACTIVE_GH));
+ g_return_if_fail (HEX_IS_WIDGET (ACTIVE_GH));
clipboard = gtk_widget_get_clipboard (GTK_WIDGET(ACTIVE_GH));
@@ -633,7 +633,7 @@ paste_special (GtkWidget *widget,
GdkClipboard *clipboard;
(void)action_name; (void)parameter;
- g_return_if_fail (GTK_IS_HEX (ACTIVE_GH));
+ g_return_if_fail (HEX_IS_WIDGET (ACTIVE_GH));
clipboard = gtk_widget_get_clipboard (GTK_WIDGET(ACTIVE_GH));
@@ -695,7 +695,7 @@ document_loaded_or_saved_common (GHexApplicationWindow *self,
/* The appwindow as a whole not interested in any document changes that
* don't pertain to the one that is actually in view.
*/
- if (doc != gtk_hex_get_document (ACTIVE_GH))
+ if (doc != hex_widget_get_document (ACTIVE_GH))
return;
ghex_application_window_set_can_save (self, assess_can_save (doc));
@@ -728,10 +728,10 @@ tab_close_request_cb (GHexNotebookTab *tab,
{
GHexApplicationWindow *self = GHEX_APPLICATION_WINDOW(user_data);
HexDocument *doc;
- GtkHex *gh;
+ HexWidget *gh;
gh = ghex_notebook_tab_get_hex (tab);
- doc = gtk_hex_get_document (gh);
+ doc = hex_widget_get_document (gh);
g_return_if_fail (HEX_IS_DOCUMENT (doc));
if (hex_document_has_changed (doc)) {
@@ -754,7 +754,7 @@ notebook_page_changed_cb (GtkNotebook *notebook,
refresh_dialogs (self);
/* Assess saveability based on new tab we've switched to */
- doc = gtk_hex_get_document (ACTIVE_GH);
+ doc = hex_widget_get_document (ACTIVE_GH);
ghex_application_window_set_can_save (self, assess_can_save (doc));
/* Update dialogs, offset status bar, etc. */
@@ -841,7 +841,7 @@ converter_close_cb (GtkWindow *window,
static void
setup_chartable (GHexApplicationWindow *self)
{
- g_return_if_fail (GTK_IS_HEX(ACTIVE_GH));
+ g_return_if_fail (HEX_IS_WIDGET(ACTIVE_GH));
self->chartable = create_char_table (GTK_WINDOW(self), ACTIVE_GH);
@@ -852,7 +852,7 @@ setup_chartable (GHexApplicationWindow *self)
static void
setup_converter (GHexApplicationWindow *self)
{
- g_return_if_fail (GTK_IS_HEX(ACTIVE_GH));
+ g_return_if_fail (HEX_IS_WIDGET(ACTIVE_GH));
self->converter = create_converter (GTK_WINDOW(self), ACTIVE_GH);
@@ -874,7 +874,7 @@ update_titlebar (GHexApplicationWindow *self)
{
char *basename;
char *title;
- HexDocument *doc = gtk_hex_get_document (ACTIVE_GH);
+ HexDocument *doc = hex_widget_get_document (ACTIVE_GH);
if (G_IS_FILE (file = hex_document_get_file (doc)))
basename = g_file_get_basename (file);
@@ -910,12 +910,12 @@ update_gui_data (GHexApplicationWindow *self)
if (ACTIVE_GH)
{
- current_pos = gtk_hex_get_cursor (ACTIVE_GH);
+ current_pos = hex_widget_get_cursor (ACTIVE_GH);
for (int i = 0; i < 8; i++)
{
/* returns 0 on buffer overflow, which is what we want */
- val.v[i] = gtk_hex_get_byte (ACTIVE_GH, current_pos+i);
+ val.v[i] = hex_widget_get_byte (ACTIVE_GH, current_pos+i);
}
hex_dialog_updateview (self->dialog, &val);
refresh_dialogs (self);
@@ -923,13 +923,13 @@ update_gui_data (GHexApplicationWindow *self)
}
static void
-cursor_moved_cb (GtkHex *gh, gpointer user_data)
+cursor_moved_cb (HexWidget *gh, gpointer user_data)
{
GHexApplicationWindow *self = GHEX_APPLICATION_WINDOW(user_data);
int current_pos;
HexDialogVal64 val;
- /* If the cursor has been moved by a function call for a GtkHex that is
+ /* If the cursor has been moved by a function call for a HexWidget that is
* *not* in view, we're not interested. */
if (ACTIVE_GH != gh) {
return;
@@ -1019,7 +1019,7 @@ ghex_application_window_set_insert_mode (GHexApplicationWindow *self,
NOTEBOOK_GH_FOREACH_START
- gtk_hex_set_insert_mode(gh, insert_mode);
+ hex_widget_set_insert_mode(gh, insert_mode);
NOTEBOOK_GH_FOREACH_END
@@ -1054,7 +1054,7 @@ save_as_response_cb (GtkNativeDialog *dialog,
goto end;
/* Fetch doc. No need for sanity checks as this is just a helper. */
- doc = gtk_hex_get_document (ACTIVE_GH);
+ doc = hex_widget_get_document (ACTIVE_GH);
gfile = gtk_file_chooser_get_file (chooser);
@@ -1095,9 +1095,9 @@ save_as (GtkWidget *widget,
HexDocument *doc;
GFile *default_file;
- g_return_if_fail (GTK_IS_HEX (ACTIVE_GH));
+ g_return_if_fail (HEX_IS_WIDGET (ACTIVE_GH));
- doc = gtk_hex_get_document (ACTIVE_GH);
+ doc = hex_widget_get_document (ACTIVE_GH);
g_return_if_fail (HEX_IS_DOCUMENT (doc));
default_file = hex_document_get_file (doc);
@@ -1134,7 +1134,7 @@ revert_response_cb (GtkDialog *dialog,
if (response_id != GTK_RESPONSE_ACCEPT)
goto end;
- doc = gtk_hex_get_document (ACTIVE_GH);
+ doc = hex_widget_get_document (ACTIVE_GH);
extra_user_data = ACTIVE_GH;
hex_document_read_async (doc, NULL, doc_read_ready_cb, self);
@@ -1154,9 +1154,9 @@ revert (GtkWidget *widget,
gint reply;
char *basename = NULL;
- g_return_if_fail (GTK_IS_HEX (ACTIVE_GH));
+ g_return_if_fail (HEX_IS_WIDGET (ACTIVE_GH));
- doc = gtk_hex_get_document (ACTIVE_GH);
+ doc = hex_widget_get_document (ACTIVE_GH);
g_return_if_fail (HEX_IS_DOCUMENT (doc));
/* Yes, this *is* a programmer error. The Revert menu should not be shown
@@ -1196,7 +1196,7 @@ print_preview (GtkWidget *widget,
{
GHexApplicationWindow *self = GHEX_APPLICATION_WINDOW(widget);
- g_return_if_fail (GTK_IS_HEX(ACTIVE_GH));
+ g_return_if_fail (HEX_IS_WIDGET(ACTIVE_GH));
(void)widget, (void)action_name, (void)parameter; /* unused */
common_print (GTK_WINDOW(self), ACTIVE_GH, /* preview: */ TRUE);
@@ -1209,7 +1209,7 @@ do_print (GtkWidget *widget,
{
GHexApplicationWindow *self = GHEX_APPLICATION_WINDOW(widget);
- g_return_if_fail (GTK_IS_HEX(ACTIVE_GH));
+ g_return_if_fail (HEX_IS_WIDGET(ACTIVE_GH));
(void)widget, (void)action_name, (void)parameter; /* unused */
common_print (GTK_WINDOW(self), ACTIVE_GH, /* preview: */ FALSE);
@@ -1222,10 +1222,10 @@ new_file (GtkWidget *widget,
{
GHexApplicationWindow *self = GHEX_APPLICATION_WINDOW(widget);
HexDocument *doc;
- GtkHex *gh;
+ HexWidget *gh;
doc = hex_document_new ();
- gh = GTK_HEX(gtk_hex_new (doc));
+ gh = HEX_WIDGET(hex_widget_new (doc));
ghex_application_window_add_hex (self, gh);
refresh_dialogs (self);
@@ -1353,9 +1353,9 @@ update_status_message (GHexApplicationWindow *self)
if (! ACTIVE_GH)
goto out;
- current_pos = gtk_hex_get_cursor (ACTIVE_GH);
+ current_pos = hex_widget_get_cursor (ACTIVE_GH);
- if (gtk_hex_get_selection (ACTIVE_GH, &ss, &se))
+ if (hex_widget_get_selection (ACTIVE_GH, &ss, &se))
{
status = g_strdup_printf (
_("Offset: 0x%lX; 0x%lX bytes from 0x%lX to 0x%lX selected"),
@@ -1900,12 +1900,12 @@ ghex_application_window_new (GtkApplication *app)
void
ghex_application_window_activate_tab (GHexApplicationWindow *self,
- GtkHex *gh)
+ HexWidget *gh)
{
GtkNotebook *notebook = GTK_NOTEBOOK(self->hex_notebook);
int page_num;
- g_return_if_fail (GTK_IS_HEX (gh));
+ g_return_if_fail (HEX_IS_WIDGET (gh));
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
page_num = gtk_notebook_page_num (notebook, GTK_WIDGET(gh));
@@ -1916,25 +1916,25 @@ ghex_application_window_activate_tab (GHexApplicationWindow *self,
void
ghex_application_window_add_hex (GHexApplicationWindow *self,
- GtkHex *gh)
+ HexWidget *gh)
{
GtkWidget *tab;
HexDocument *doc;
- g_return_if_fail (GTK_IS_HEX(gh));
+ g_return_if_fail (HEX_IS_WIDGET(gh));
- doc = gtk_hex_get_document (gh);
+ doc = hex_widget_get_document (gh);
g_return_if_fail (HEX_IS_DOCUMENT(doc));
- /* GtkHex: Setup based on global settings. */
+ /* HexWidget: Setup based on global settings. */
common_set_gtkhex_font_from_settings (gh);
- /* GtkHex: Sync up appwindow-specific settings. */
+ /* HexWidget: Sync up appwindow-specific settings. */
set_gtkhex_offsets_column_from_settings (gh);
set_gtkhex_group_type_from_settings (gh);
- /* GtkHex: Set insert mode based on our global appwindow prop */
- gtk_hex_set_insert_mode (gh, self->insert_mode);
+ /* HexWidget: Set insert mode based on our global appwindow prop */
+ hex_widget_set_insert_mode (gh, self->insert_mode);
/* Generate a tab */
tab = ghex_notebook_tab_new (gh);
@@ -2028,7 +2028,7 @@ doc_read_ready_cb (GObject *source_object,
gpointer user_data)
{
GHexApplicationWindow *self = GHEX_APPLICATION_WINDOW(user_data);
- GtkHex *gh = GTK_HEX(extra_user_data);
+ HexWidget *gh = HEX_WIDGET(extra_user_data);
HexDocument *doc = HEX_DOCUMENT(source_object);
gboolean result;
GError *local_error = NULL;
@@ -2066,7 +2066,7 @@ void
ghex_application_window_open_file (GHexApplicationWindow *self, GFile *file)
{
HexDocument *doc;
- GtkHex *gh = NULL;
+ HexWidget *gh = NULL;
#ifndef BACKEND_MMAP
static gboolean nag_screen_shown = FALSE;
#endif
@@ -2095,7 +2095,7 @@ ghex_application_window_open_file (GHexApplicationWindow *self, GFile *file)
g_object_unref (file);
if (doc)
- gh = GTK_HEX(gtk_hex_new (doc));
+ gh = HEX_WIDGET(hex_widget_new (doc));
/* Display a fairly generic error message if we can't even get this far. */
if (! gh)
@@ -2117,11 +2117,11 @@ ghex_application_window_open_file (GHexApplicationWindow *self, GFile *file)
hex_document_read_async (doc, NULL, doc_read_ready_cb, self);
}
-GtkHex *
+HexWidget *
ghex_application_window_get_hex (GHexApplicationWindow *self)
{
GHexNotebookTab *tab;
- GtkHex *gh = NULL;
+ HexWidget *gh = NULL;
g_return_val_if_fail (GHEX_IS_APPLICATION_WINDOW (self), NULL);
diff --git a/src/ghex-application-window.h b/src/ghex-application-window.h
index 949ed38..f5c9c8d 100644
--- a/src/ghex-application-window.h
+++ b/src/ghex-application-window.h
@@ -47,15 +47,15 @@ G_DECLARE_FINAL_TYPE (GHexApplicationWindow, ghex_application_window,
GtkWidget * ghex_application_window_new (GtkApplication *app);
void ghex_application_window_add_hex (GHexApplicationWindow *self,
- GtkHex *gh);
+ HexWidget *gh);
void ghex_application_window_set_hex (GHexApplicationWindow *self,
- GtkHex *gh);
+ HexWidget *gh);
void ghex_application_window_activate_tab (GHexApplicationWindow *self,
- GtkHex *gh);
+ HexWidget *gh);
GList * ghex_application_window_get_list (GHexApplicationWindow *self);
void ghex_application_window_open_file (GHexApplicationWindow *self,
GFile *file);
-GtkHex * ghex_application_window_get_hex (GHexApplicationWindow *self);
+HexWidget * ghex_application_window_get_hex (GHexApplicationWindow *self);
G_END_DECLS
diff --git a/src/ghex-notebook-tab.c b/src/ghex-notebook-tab.c
index f1462ad..df90168 100644
--- a/src/ghex-notebook-tab.c
+++ b/src/ghex-notebook-tab.c
@@ -35,7 +35,7 @@ struct _GHexNotebookTab
GtkWidget *label;
GtkWidget *close_btn;
- GtkHex *gh; /* GtkHex widget activated when tab is clicked */
+ HexWidget *gh; /* HexWidget widget activated when tab is clicked */
};
static char *untitled_label = N_("Untitled document");
@@ -187,7 +187,7 @@ refresh_file_name (GHexNotebookTab *self)
char *basename;
GFile *file;
- doc = gtk_hex_get_document (self->gh);
+ doc = hex_widget_get_document (self->gh);
file = hex_document_get_file (doc);
if (G_IS_FILE (file))
@@ -202,21 +202,21 @@ refresh_file_name (GHexNotebookTab *self)
}
static void
-ghex_notebook_tab_add_hex (GHexNotebookTab *self, GtkHex *gh)
+ghex_notebook_tab_add_hex (GHexNotebookTab *self, HexWidget *gh)
{
HexDocument *doc;
/* Do some sanity checks, as this method requires that some ducks be in
- * a row -- we need a valid GtkHex that is pre-loaded with a valid
+ * a row -- we need a valid HexWidget that is pre-loaded with a valid
* HexDocument.
*/
g_return_if_fail (GHEX_IS_NOTEBOOK_TAB (self));
- g_return_if_fail (GTK_IS_HEX (gh));
+ g_return_if_fail (HEX_IS_WIDGET (gh));
- doc = gtk_hex_get_document (gh);
+ doc = hex_widget_get_document (gh);
g_return_if_fail (HEX_IS_DOCUMENT (doc));
- /* Associate this notebook tab with a GtkHex widget. */
+ /* Associate this notebook tab with a HexWidget widget. */
self->gh = gh;
g_object_add_weak_pointer (G_OBJECT(self->gh), (gpointer *)&self->gh);
@@ -238,7 +238,7 @@ ghex_notebook_tab_add_hex (GHexNotebookTab *self, GtkHex *gh)
/* Public Methods */
GtkWidget *
-ghex_notebook_tab_new (GtkHex *gh)
+ghex_notebook_tab_new (HexWidget *gh)
{
GHexNotebookTab *self = g_object_new (GHEX_TYPE_NOTEBOOK_TAB, NULL);
ghex_notebook_tab_add_hex (self, gh);
@@ -255,7 +255,7 @@ ghex_notebook_tab_get_filename (GHexNotebookTab *self)
return gtk_label_get_text (GTK_LABEL(self->label));
}
-GtkHex *
+HexWidget *
ghex_notebook_tab_get_hex (GHexNotebookTab *self)
{
g_return_val_if_fail (GHEX_IS_NOTEBOOK_TAB (self), NULL);
diff --git a/src/ghex-notebook-tab.h b/src/ghex-notebook-tab.h
index eaea4d3..cb23d80 100644
--- a/src/ghex-notebook-tab.h
+++ b/src/ghex-notebook-tab.h
@@ -38,9 +38,9 @@ G_DECLARE_FINAL_TYPE (GHexNotebookTab, ghex_notebook_tab, GHEX, NOTEBOOK_TAB,
/* Method Declarations */
-GtkWidget * ghex_notebook_tab_new (GtkHex *gh);
+GtkWidget * ghex_notebook_tab_new (HexWidget *gh);
const char * ghex_notebook_tab_get_filename (GHexNotebookTab *self);
-GtkHex * ghex_notebook_tab_get_hex (GHexNotebookTab *self);
+HexWidget * ghex_notebook_tab_get_hex (GHexNotebookTab *self);
G_END_DECLS
diff --git a/src/gtkhex-layout-manager.c b/src/gtkhex-layout-manager.c
index 196f35d..8419111 100644
--- a/src/gtkhex-layout-manager.c
+++ b/src/gtkhex-layout-manager.c
@@ -1,6 +1,6 @@
/* vim: ts=4 sw=4 colorcolumn=80
* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* gtkhex-layout-manager.c - definition of a GtkHex layout manager
+/* gtkhex-layout-manager.c - definition of a HexWidget layout manager
Copyright © 2021 Logan Rathbone <poprocks gmail com>
@@ -26,11 +26,11 @@
#define DEFAULT_OFFSET_CPL 8
-struct _GtkHexLayout {
+struct _HexWidgetLayout {
GtkLayoutManager parent_instance;
int char_width;
- GtkHexGroupType group_type;
+ HexWidgetGroupType group_type;
int cpl;
int hex_cpl;
@@ -39,12 +39,12 @@ struct _GtkHexLayout {
int cursor_x, cursor_y;
};
-G_DEFINE_TYPE (GtkHexLayout, gtk_hex_layout, GTK_TYPE_LAYOUT_MANAGER)
+G_DEFINE_TYPE (HexWidgetLayout, hex_widget_layout, GTK_TYPE_LAYOUT_MANAGER)
-struct _GtkHexLayoutChild {
+struct _HexWidgetLayoutChild {
GtkLayoutChild parent_instance;
- GtkHexLayoutColumn column;
+ HexWidgetLayoutColumn column;
};
enum {
@@ -56,9 +56,9 @@ static GParamSpec *child_props[N_CHILD_PROPERTIES];
/* Some code required to use g_param_spec_enum below. */
-#define GTK_HEX_LAYOUT_COLUMN (gtk_hex_layout_column_get_type ())
+#define HEX_WIDGET_LAYOUT_COLUMN (hex_widget_layout_column_get_type ())
static GType
-gtk_hex_layout_column_get_type (void)
+hex_widget_layout_column_get_type (void)
{
static GType hex_layout_column_type = 0;
static const GEnumValue format_types[] = {
@@ -70,24 +70,24 @@ gtk_hex_layout_column_get_type (void)
};
if (! hex_layout_column_type) {
hex_layout_column_type =
- g_enum_register_static ("GtkHexLayoutColumn", format_types);
+ g_enum_register_static ("HexWidgetLayoutColumn", format_types);
}
return hex_layout_column_type;
}
-G_DEFINE_TYPE (GtkHexLayoutChild, gtk_hex_layout_child, GTK_TYPE_LAYOUT_CHILD)
+G_DEFINE_TYPE (HexWidgetLayoutChild, hex_widget_layout_child, GTK_TYPE_LAYOUT_CHILD)
/* LAYOUT CHILD METHODS */
static void
-gtk_hex_layout_child_set_property (GObject *gobject,
+hex_widget_layout_child_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- GtkHexLayoutChild *self = GTK_HEX_LAYOUT_CHILD(gobject);
+ HexWidgetLayoutChild *self = HEX_WIDGET_LAYOUT_CHILD(gobject);
switch (prop_id)
{
@@ -102,12 +102,12 @@ gtk_hex_layout_child_set_property (GObject *gobject,
}
static void
-gtk_hex_layout_child_get_property (GObject *gobject,
+hex_widget_layout_child_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- GtkHexLayoutChild *self = GTK_HEX_LAYOUT_CHILD(gobject);
+ HexWidgetLayoutChild *self = HEX_WIDGET_LAYOUT_CHILD(gobject);
switch (prop_id)
{
@@ -122,35 +122,35 @@ gtk_hex_layout_child_get_property (GObject *gobject,
}
static void
-gtk_hex_layout_child_finalize (GObject *gobject)
+hex_widget_layout_child_finalize (GObject *gobject)
{
- GtkHexLayoutChild *self = GTK_HEX_LAYOUT_CHILD (gobject);
+ HexWidgetLayoutChild *self = HEX_WIDGET_LAYOUT_CHILD (gobject);
- G_OBJECT_CLASS (gtk_hex_layout_child_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (hex_widget_layout_child_parent_class)->finalize (gobject);
}
static void
-gtk_hex_layout_child_dispose (GObject *gobject)
+hex_widget_layout_child_dispose (GObject *gobject)
{
- GtkHexLayoutChild *self = GTK_HEX_LAYOUT_CHILD (gobject);
+ HexWidgetLayoutChild *self = HEX_WIDGET_LAYOUT_CHILD (gobject);
- G_OBJECT_CLASS (gtk_hex_layout_child_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (hex_widget_layout_child_parent_class)->finalize (gobject);
}
static void
-gtk_hex_layout_child_class_init (GtkHexLayoutChildClass *klass)
+hex_widget_layout_child_class_init (HexWidgetLayoutChildClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->set_property = gtk_hex_layout_child_set_property;
- gobject_class->get_property = gtk_hex_layout_child_get_property;
- gobject_class->finalize = gtk_hex_layout_child_finalize;
- gobject_class->dispose = gtk_hex_layout_child_dispose;
+ gobject_class->set_property = hex_widget_layout_child_set_property;
+ gobject_class->get_property = hex_widget_layout_child_get_property;
+ gobject_class->finalize = hex_widget_layout_child_finalize;
+ gobject_class->dispose = hex_widget_layout_child_dispose;
child_props[PROP_CHILD_COLUMN] = g_param_spec_enum ("column",
"Column type",
"The column type of a child of a hex layout",
- GTK_HEX_LAYOUT_COLUMN,
+ HEX_WIDGET_LAYOUT_COLUMN,
NO_COLUMN,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
@@ -160,7 +160,7 @@ gtk_hex_layout_child_class_init (GtkHexLayoutChildClass *klass)
}
static void
-gtk_hex_layout_child_init (GtkHexLayoutChild *self)
+hex_widget_layout_child_init (HexWidgetLayoutChild *self)
{
}
@@ -168,7 +168,7 @@ gtk_hex_layout_child_init (GtkHexLayoutChild *self)
/* LAYOUT MANAGER METHODS */
static void
-gtk_hex_layout_measure (GtkLayoutManager *layout_manager,
+hex_widget_layout_measure (GtkLayoutManager *layout_manager,
GtkWidget *widget,
GtkOrientation orientation,
int for_size,
@@ -206,13 +206,13 @@ gtk_hex_layout_measure (GtkLayoutManager *layout_manager,
#define BASE_ALLOC {.x = 0, .y = 0, .width = 0, .height = full_height}
static void
-gtk_hex_layout_allocate (GtkLayoutManager *layout_manager,
+hex_widget_layout_allocate (GtkLayoutManager *layout_manager,
GtkWidget *widget,
int full_width,
int full_height,
int baseline) /* N/A */
{
- GtkHexLayout *self = GTK_HEX_LAYOUT (layout_manager);
+ HexWidgetLayout *self = HEX_WIDGET_LAYOUT (layout_manager);
GtkWidget *child;
gboolean have_hex = FALSE;
gboolean have_ascii = FALSE;
@@ -228,7 +228,7 @@ gtk_hex_layout_allocate (GtkLayoutManager *layout_manager,
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
- GtkHexLayoutChild *child_info;
+ HexWidgetLayoutChild *child_info;
if (GTK_IS_POPOVER (child))
{
@@ -243,7 +243,7 @@ gtk_hex_layout_allocate (GtkLayoutManager *layout_manager,
/* Setup allocation depending on what column we're in.
* This loop is run through again once we obtain some initial values. */
- child_info = GTK_HEX_LAYOUT_CHILD(
+ child_info = HEX_WIDGET_LAYOUT_CHILD(
gtk_layout_manager_get_layout_child (layout_manager, child));
switch (child_info->column)
@@ -426,7 +426,7 @@ gtk_hex_layout_allocate (GtkLayoutManager *layout_manager,
#undef BASE_ALLOC
static GtkSizeRequestMode
-gtk_hex_layout_get_request_mode (GtkLayoutManager *layout_manager,
+hex_widget_layout_get_request_mode (GtkLayoutManager *layout_manager,
GtkWidget *widget)
{
/* I understand this is the default return type anyway; but I guess it
@@ -436,46 +436,46 @@ gtk_hex_layout_get_request_mode (GtkLayoutManager *layout_manager,
}
static GtkLayoutChild *
-gtk_hex_layout_create_layout_child (GtkLayoutManager *manager,
+hex_widget_layout_create_layout_child (GtkLayoutManager *manager,
GtkWidget *widget,
GtkWidget *for_child)
{
- return g_object_new (GTK_TYPE_HEX_LAYOUT_CHILD,
+ return g_object_new (HEX_TYPE_WIDGET_LAYOUT_CHILD,
"layout-manager", manager,
"child-widget", for_child,
NULL);
}
static void
-gtk_hex_layout_class_init (GtkHexLayoutClass *klass)
+hex_widget_layout_class_init (HexWidgetLayoutClass *klass)
{
GtkLayoutManagerClass *layout_class = GTK_LAYOUT_MANAGER_CLASS (klass);
- layout_class->get_request_mode = gtk_hex_layout_get_request_mode;
- layout_class->measure = gtk_hex_layout_measure;
- layout_class->allocate = gtk_hex_layout_allocate;
- layout_class->create_layout_child = gtk_hex_layout_create_layout_child;
+ layout_class->get_request_mode = hex_widget_layout_get_request_mode;
+ layout_class->measure = hex_widget_layout_measure;
+ layout_class->allocate = hex_widget_layout_allocate;
+ layout_class->create_layout_child = hex_widget_layout_create_layout_child;
}
static void
-gtk_hex_layout_init (GtkHexLayout *self)
+hex_widget_layout_init (HexWidgetLayout *self)
{
self->offset_cpl = DEFAULT_OFFSET_CPL;
/* FIXME - dumb test initial default */
self->char_width = 20;
- self->group_type = GTK_HEX_GROUP_BYTE;
+ self->group_type = HEX_WIDGET_GROUP_BYTE;
}
-/* GtkHexLayout - Public Methods */
+/* HexWidgetLayout - Public Methods */
GtkLayoutManager *
-gtk_hex_layout_new (void)
+hex_widget_layout_new (void)
{
- return g_object_new (GTK_TYPE_HEX_LAYOUT, NULL);
+ return g_object_new (HEX_TYPE_WIDGET_LAYOUT, NULL);
}
void
-gtk_hex_layout_set_char_width (GtkHexLayout *layout, int width)
+hex_widget_layout_set_char_width (HexWidgetLayout *layout, int width)
{
layout->char_width = width;
@@ -483,8 +483,8 @@ gtk_hex_layout_set_char_width (GtkHexLayout *layout, int width)
}
void
-gtk_hex_layout_set_group_type (GtkHexLayout *layout,
- GtkHexGroupType group_type)
+hex_widget_layout_set_group_type (HexWidgetLayout *layout,
+ HexWidgetGroupType group_type)
{
layout->group_type = group_type;
@@ -492,43 +492,43 @@ gtk_hex_layout_set_group_type (GtkHexLayout *layout,
}
int
-gtk_hex_layout_get_cpl (GtkHexLayout *layout)
+hex_widget_layout_get_cpl (HexWidgetLayout *layout)
{
return layout->cpl;
}
int
-gtk_hex_layout_get_hex_cpl (GtkHexLayout *layout)
+hex_widget_layout_get_hex_cpl (HexWidgetLayout *layout)
{
return layout->hex_cpl;
}
void
-gtk_hex_layout_set_cursor_pos (GtkHexLayout *layout, int x, int y)
+hex_widget_layout_set_cursor_pos (HexWidgetLayout *layout, int x, int y)
{
layout->cursor_x = x;
layout->cursor_y = y;
}
void
-gtk_hex_layout_set_offset_cpl (GtkHexLayout *layout, int offset_cpl)
+hex_widget_layout_set_offset_cpl (HexWidgetLayout *layout, int offset_cpl)
{
layout->offset_cpl = offset_cpl;
}
int
-gtk_hex_layout_get_offset_cpl (GtkHexLayout *layout)
+hex_widget_layout_get_offset_cpl (HexWidgetLayout *layout)
{
return layout->offset_cpl;
}
-/* GtkHexLayoutChild - Public Methods */
+/* HexWidgetLayoutChild - Public Methods */
void
-gtk_hex_layout_child_set_column (GtkHexLayoutChild *child,
- GtkHexLayoutColumn column)
+hex_widget_layout_child_set_column (HexWidgetLayoutChild *child,
+ HexWidgetLayoutColumn column)
{
- g_return_if_fail (GTK_IS_HEX_LAYOUT_CHILD (child));
+ g_return_if_fail (HEX_IS_WIDGET_LAYOUT_CHILD (child));
if (child->column == column)
return;
diff --git a/src/gtkhex-layout-manager.h b/src/gtkhex-layout-manager.h
index df8360c..8ec846a 100644
--- a/src/gtkhex-layout-manager.h
+++ b/src/gtkhex-layout-manager.h
@@ -1,6 +1,6 @@
/* vim: ts=4 sw=4 colorcolumn=80
* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* gtkhex-layout-manager.h - declaration of a GtkHex layout manager
+/* gtkhex-layout-manager.h - declaration of a HexWidget layout manager
Copyright © 2021 Logan Rathbone <poprocks gmail com>
@@ -22,19 +22,19 @@
Original GHex Author: Jaka Mocnik <jaka gnu org>
*/
-#ifndef GTK_HEX_LAYOUT_MANAGER_H
-#define GTK_HEX_LAYOUT_MANAGER_H
+#ifndef HEX_WIDGET_LAYOUT_MANAGER_H
+#define HEX_WIDGET_LAYOUT_MANAGER_H
#include <gtk/gtk.h>
-/* Not a circular dep; this is just for the GTK_HEX_GROUP_* enums defined
+/* Not a circular dep; this is just for the HEX_WIDGET_GROUP_* enums defined
* there. */
#include "gtkhex.h"
G_BEGIN_DECLS
-#define GTK_TYPE_HEX_LAYOUT (gtk_hex_layout_get_type ())
-G_DECLARE_FINAL_TYPE (GtkHexLayout, gtk_hex_layout, GTK, HEX_LAYOUT,
+#define HEX_TYPE_WIDGET_LAYOUT (hex_widget_layout_get_type ())
+G_DECLARE_FINAL_TYPE (HexWidgetLayout, hex_widget_layout, HEX, WIDGET_LAYOUT,
GtkLayoutManager)
typedef enum {
@@ -43,28 +43,27 @@ typedef enum {
HEX_COLUMN,
ASCII_COLUMN,
SCROLLBAR_COLUMN
-} GtkHexLayoutColumn;
+} HexWidgetLayoutColumn;
-#define GTK_TYPE_HEX_LAYOUT_CHILD (gtk_hex_layout_child_get_type ())
-G_DECLARE_FINAL_TYPE (GtkHexLayoutChild, gtk_hex_layout_child,
- GTK, HEX_LAYOUT_CHILD,
- GtkLayoutChild)
+#define HEX_TYPE_WIDGET_LAYOUT_CHILD (hex_widget_layout_child_get_type ())
+G_DECLARE_FINAL_TYPE (HexWidgetLayoutChild, hex_widget_layout_child,
+ HEX, WIDGET_LAYOUT_CHILD, GtkLayoutChild)
-GtkLayoutManager * gtk_hex_layout_new (void);
-void gtk_hex_layout_set_char_width (GtkHexLayout *layout,
+GtkLayoutManager * hex_widget_layout_new (void);
+void hex_widget_layout_set_char_width (HexWidgetLayout *layout,
int width);
-void gtk_hex_layout_child_set_column (GtkHexLayoutChild *child,
- GtkHexLayoutColumn column);
-int gtk_hex_layout_get_cpl (GtkHexLayout *layout);
-int gtk_hex_layout_get_hex_cpl (GtkHexLayout *layout);
-void gtk_hex_layout_set_group_type (GtkHexLayout *layout,
- GtkHexGroupType group_type);
-void gtk_hex_layout_set_cursor_pos (GtkHexLayout *layout,
+void hex_widget_layout_child_set_column (HexWidgetLayoutChild *child,
+ HexWidgetLayoutColumn column);
+int hex_widget_layout_get_cpl (HexWidgetLayout *layout);
+int hex_widget_layout_get_hex_cpl (HexWidgetLayout *layout);
+void hex_widget_layout_set_group_type (HexWidgetLayout *layout,
+ HexWidgetGroupType group_type);
+void hex_widget_layout_set_cursor_pos (HexWidgetLayout *layout,
int x, int y);
-void gtk_hex_layout_set_offset_cpl (GtkHexLayout *layout,
+void hex_widget_layout_set_offset_cpl (HexWidgetLayout *layout,
int offset_cpl);
-int gtk_hex_layout_get_offset_cpl (GtkHexLayout *layout);
+int hex_widget_layout_get_offset_cpl (HexWidgetLayout *layout);
G_END_DECLS
-#endif /* GTK_HEX_LAYOUT_MANAGER_H */
+#endif /* HEX_WIDGET_LAYOUT_MANAGER_H */
diff --git a/src/gtkhex-paste-data.c b/src/gtkhex-paste-data.c
index 9f90f4f..f28ad23 100644
--- a/src/gtkhex-paste-data.c
+++ b/src/gtkhex-paste-data.c
@@ -1,6 +1,6 @@
/* vim: ts=4 sw=4 colorcolumn=80
* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* gtkhex-paste-data.c - Paste data for GtkHex
+/* gtkhex-paste-data.c - Paste data for HexWidget
Copyright © 2021 Logan Rathbone <poprocks gmail com>
@@ -27,7 +27,7 @@
/* GObject Definition */
-struct _GtkHexPasteData
+struct _HexPasteData
{
GObject parent_instance;
@@ -35,7 +35,7 @@ struct _GtkHexPasteData
int elems;
};
-G_DEFINE_TYPE (GtkHexPasteData, gtk_hex_paste_data, G_TYPE_OBJECT)
+G_DEFINE_TYPE (HexPasteData, hex_paste_data, G_TYPE_OBJECT)
/* Helper Functions */
@@ -76,27 +76,27 @@ doc_data_to_string (const char *data, int len)
/* Constructors and Destructors */
static void
-gtk_hex_paste_data_init (GtkHexPasteData *self)
+hex_paste_data_init (HexPasteData *self)
{
}
static void
-gtk_hex_paste_data_class_init (GtkHexPasteDataClass *klass)
+hex_paste_data_class_init (HexPasteDataClass *klass)
{
}
/* Public Method Definitions */
-GtkHexPasteData *
-gtk_hex_paste_data_new (char *doc_data, int elems)
+HexPasteData *
+hex_paste_data_new (char *doc_data, int elems)
{
- GtkHexPasteData *self;
+ HexPasteData *self;
g_return_val_if_fail (doc_data, NULL);
g_return_val_if_fail (elems, NULL);
- self = g_object_new (GTK_TYPE_HEX_PASTE_DATA, NULL);
+ self = g_object_new (HEX_TYPE_PASTE_DATA, NULL);
self->doc_data = doc_data;
self->elems = elems;
@@ -106,7 +106,7 @@ gtk_hex_paste_data_new (char *doc_data, int elems)
/* String returned should be freed with g_free. */
char *
-gtk_hex_paste_data_get_string (GtkHexPasteData *self)
+hex_paste_data_get_string (HexPasteData *self)
{
char *string;
@@ -119,7 +119,7 @@ gtk_hex_paste_data_get_string (GtkHexPasteData *self)
}
char *
-gtk_hex_paste_data_get_doc_data (GtkHexPasteData *self)
+hex_paste_data_get_doc_data (HexPasteData *self)
{
g_return_val_if_fail (self->doc_data, NULL);
@@ -127,7 +127,7 @@ gtk_hex_paste_data_get_doc_data (GtkHexPasteData *self)
}
int
-gtk_hex_paste_data_get_elems (GtkHexPasteData *self)
+hex_paste_data_get_elems (HexPasteData *self)
{
return self->elems;
}
diff --git a/src/gtkhex-paste-data.h b/src/gtkhex-paste-data.h
index dcf0864..75ab8da 100644
--- a/src/gtkhex-paste-data.h
+++ b/src/gtkhex-paste-data.h
@@ -1,6 +1,6 @@
/* vim: ts=4 sw=4 colorcolumn=80
* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* gtkhex-paste-data.h - declaration of paste data for GtkHex
+/* gtkhex-paste-data.h - declaration of paste data for HexWidget
Copyright © 2021 Logan Rathbone <poprocks gmail com>
@@ -31,16 +31,15 @@
G_BEGIN_DECLS
-#define GTK_TYPE_HEX_PASTE_DATA (gtk_hex_paste_data_get_type ())
-G_DECLARE_FINAL_TYPE (GtkHexPasteData, gtk_hex_paste_data, GTK, HEX_PASTE_DATA,
- GObject)
+#define HEX_TYPE_PASTE_DATA (hex_paste_data_get_type ())
+G_DECLARE_FINAL_TYPE (HexPasteData, hex_paste_data, HEX, PASTE_DATA, GObject)
/* Method Declarations */
-GtkHexPasteData * gtk_hex_paste_data_new (char *doc_data, int elems);
-char * gtk_hex_paste_data_get_string (GtkHexPasteData *self);
-char * gtk_hex_paste_data_get_doc_data (GtkHexPasteData *self);
-int gtk_hex_paste_data_get_elems (GtkHexPasteData *self);
+HexPasteData * hex_paste_data_new (char *doc_data, int elems);
+char * hex_paste_data_get_string (HexPasteData *self);
+char * hex_paste_data_get_doc_data (HexPasteData *self);
+int hex_paste_data_get_elems (HexPasteData *self);
G_END_DECLS
diff --git a/src/gtkhex.c b/src/gtkhex.c
index 3261589..8fcb2e0 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -1,7 +1,7 @@
/* vim: ts=4 sw=4 colorcolumn=80
* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* gtkhex.c - definition of a GtkHex widget
+/* gtkhex.c - definition of a HexWidget widget
Copyright © 1997 - 2004 Free Software Foundation
@@ -68,7 +68,7 @@ enum {
typedef enum {
VIEW_HEX,
VIEW_ASCII
-} GtkHexViewType;
+} HexWidgetViewType;
enum {
CURSOR_MOVED_SIGNAL,
@@ -82,24 +82,24 @@ enum {
/* highlighting information.
*/
-typedef struct _GtkHex_Highlight GtkHex_Highlight;
+typedef struct _HexWidget_Highlight HexWidget_Highlight;
/* start_line and end_line only have to be set (and valid) of
* valid is set to TRUE. */
-struct _GtkHex_Highlight
+struct _HexWidget_Highlight
{
gint64 start, end;
gint64 start_line, end_line;
gboolean valid;
- GtkHex_Highlight *prev, *next;
+ HexWidget_Highlight *prev, *next;
};
/* used to automatically highlight all visible occurrences
* of the string.
*/
-struct _GtkHex_AutoHighlight
+struct _HexWidget_AutoHighlight
{
char *search_string;
int search_len;
@@ -107,24 +107,24 @@ struct _GtkHex_AutoHighlight
gint64 view_min;
gint64 view_max;
- GtkHex_Highlight *highlights;
- GtkHex_AutoHighlight *next, *prev;
+ HexWidget_Highlight *highlights;
+ HexWidget_AutoHighlight *next, *prev;
};
/* ------------------------------
- * Main GtkHex GObject definition
+ * Main HexWidget GObject definition
* ------------------------------
*/
/**
- * GtkHex:
+ * HexWidget:
*
- * #GtkHex is a widget which can display #HexDocument data as a
+ * #HexWidget is a widget which can display #HexDocument data as a
* side-by-side representation of offets, hexadecimal nibbles, and ASCII
* characters.
*/
-struct _GtkHex
+struct _HexWidget
{
GtkWidget parent_instance;
@@ -146,7 +146,7 @@ struct _GtkHex
GtkAdjustment *adj;
- GtkHexViewType active_view;
+ HexWidgetViewType active_view;
int char_width, char_height;
@@ -154,10 +154,10 @@ struct _GtkHex
guint button;
gint64 cursor_pos;
- GtkHex_Highlight selection;
+ HexWidget_Highlight selection;
gboolean lower_nibble;
- GtkHexGroupType group_type;
+ HexWidgetGroupType group_type;
/* cpl == `characters per line` */
int cpl;
@@ -174,7 +174,7 @@ struct _GtkHex
/* width of the hex display `xdisp` and ascii display `adisp` */
int xdisp_width, adisp_width;
- GtkHex_AutoHighlight *auto_highlight;
+ HexWidget_AutoHighlight *auto_highlight;
/* scroll direction: 0 means no scrolling; a -ve number means we're
* scrolling up, and a +ve number means we're scrolling down. */
@@ -194,7 +194,7 @@ struct _GtkHex
int default_lines;
};
-G_DEFINE_TYPE (GtkHex, gtk_hex, GTK_TYPE_WIDGET)
+G_DEFINE_TYPE (HexWidget, hex_widget, GTK_TYPE_WIDGET)
/* ----- */
@@ -204,31 +204,31 @@ static guint gtkhex_signals[LAST_SIGNAL] = { 0 };
static char *char_widths = NULL;
-static void render_highlights (GtkHex *gh, cairo_t *cr, gint64 cursor_line,
- GtkHexViewType type);
-static void render_lines (GtkHex *gh, cairo_t *cr, int min_lines, int max_lines,
- GtkHexViewType type);
+static void render_highlights (HexWidget *gh, cairo_t *cr, gint64 cursor_line,
+ HexWidgetViewType type);
+static void render_lines (HexWidget *gh, cairo_t *cr, int min_lines, int max_lines,
+ HexWidgetViewType type);
-static void gtk_hex_validate_highlight (GtkHex *gh, GtkHex_Highlight *hl);
-static void gtk_hex_invalidate_highlight (GtkHex *gh, GtkHex_Highlight *hl);
-static void gtk_hex_invalidate_all_highlights (GtkHex *gh);
+static void hex_widget_validate_highlight (HexWidget *gh, HexWidget_Highlight *hl);
+static void hex_widget_invalidate_highlight (HexWidget *gh, HexWidget_Highlight *hl);
+static void hex_widget_invalidate_all_highlights (HexWidget *gh);
-static void gtk_hex_update_all_auto_highlights (GtkHex *gh);
+static void hex_widget_update_all_auto_highlights (HexWidget *gh);
-static GtkHex_Highlight *gtk_hex_insert_highlight (GtkHex *gh,
- GtkHex_AutoHighlight *ahl, gint64 start, gint64 end);
+static HexWidget_Highlight *hex_widget_insert_highlight (HexWidget *gh,
+ HexWidget_AutoHighlight *ahl, gint64 start, gint64 end);
-static void gtk_hex_delete_highlight (GtkHex *gh, GtkHex_AutoHighlight *ahl,
- GtkHex_Highlight *hl);
+static void hex_widget_delete_highlight (HexWidget *gh, HexWidget_AutoHighlight *ahl,
+ HexWidget_Highlight *hl);
-static void gtk_hex_update_auto_highlight (GtkHex *gh, GtkHex_AutoHighlight *ahl,
+static void hex_widget_update_auto_highlight (HexWidget *gh, HexWidget_AutoHighlight *ahl,
gboolean delete, gboolean add);
-static void recalc_displays (GtkHex *gh);
+static void recalc_displays (HexWidget *gh);
-static void show_cursor (GtkHex *gh, gboolean show);
+static void show_cursor (HexWidget *gh, gboolean show);
-/* GtkHex - Method Definitions */
+/* HexWidget - Method Definitions */
/* ACTIONS */
@@ -237,12 +237,12 @@ copy_action (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
- GtkHex *gh = GTK_HEX(widget);
+ HexWidget *gh = HEX_WIDGET(widget);
- g_return_if_fail (GTK_IS_HEX(gh));
+ g_return_if_fail (HEX_IS_WIDGET(gh));
(void)action_name, (void)parameter;
- gtk_hex_copy_to_clipboard (gh);
+ hex_widget_copy_to_clipboard (gh);
}
static void
@@ -250,12 +250,12 @@ cut_action (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
- GtkHex *gh = GTK_HEX(widget);
+ HexWidget *gh = HEX_WIDGET(widget);
- g_return_if_fail (GTK_IS_HEX(gh));
+ g_return_if_fail (HEX_IS_WIDGET(gh));
(void)action_name, (void)parameter;
- gtk_hex_cut_to_clipboard (gh);
+ hex_widget_cut_to_clipboard (gh);
}
static void
@@ -263,12 +263,12 @@ paste_action (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
- GtkHex *gh = GTK_HEX(widget);
+ HexWidget *gh = HEX_WIDGET(widget);
- g_return_if_fail (GTK_IS_HEX(gh));
+ g_return_if_fail (HEX_IS_WIDGET(gh));
(void)action_name, (void)parameter;
- gtk_hex_paste_from_clipboard (gh);
+ hex_widget_paste_from_clipboard (gh);
}
static void
@@ -276,12 +276,12 @@ redo_action (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
- GtkHex *gh = GTK_HEX(widget);
+ HexWidget *gh = HEX_WIDGET(widget);
HexChangeData *cd;
(void)action_name, (void)parameter;
- g_return_if_fail (GTK_IS_HEX(gh));
+ g_return_if_fail (HEX_IS_WIDGET(gh));
g_return_if_fail (HEX_IS_DOCUMENT(gh->document));
if (hex_document_can_redo (gh->document))
@@ -290,8 +290,8 @@ redo_action (GtkWidget *widget,
cd = hex_document_get_undo_data (gh->document);
- gtk_hex_set_cursor (gh, cd->start);
- gtk_hex_set_nibble (gh, cd->lower_nibble);
+ hex_widget_set_cursor (gh, cd->start);
+ hex_widget_set_nibble (gh, cd->lower_nibble);
}
}
@@ -299,7 +299,7 @@ static void
state_flags_changed_cb (GtkWidget *widget, GtkStateFlags flags,
gpointer user_data)
{
- GtkHex *gh = GTK_HEX(widget);
+ HexWidget *gh = HEX_WIDGET(widget);
if (flags | GTK_STATE_FLAG_FOCUS_WITHIN)
gtk_widget_queue_draw (widget);
@@ -308,8 +308,8 @@ state_flags_changed_cb (GtkWidget *widget, GtkStateFlags flags,
static void
doc_undo_redo_cb (HexDocument *doc, gpointer user_data)
{
- GtkHex *gh = GTK_HEX(user_data);
- g_return_if_fail (GTK_IS_HEX (gh));
+ HexWidget *gh = HEX_WIDGET(user_data);
+ g_return_if_fail (HEX_IS_WIDGET (gh));
gtk_widget_action_set_enabled (GTK_WIDGET(gh),
"gtkhex.undo", hex_document_can_undo (doc));
@@ -322,12 +322,12 @@ undo_action (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
- GtkHex *gh = GTK_HEX(widget);
+ HexWidget *gh = HEX_WIDGET(widget);
HexChangeData *cd;
(void)action_name, (void)parameter;
- g_return_if_fail (GTK_IS_HEX(gh));
+ g_return_if_fail (HEX_IS_WIDGET(gh));
g_return_if_fail (HEX_IS_DOCUMENT(gh->document));
if (hex_document_can_undo (gh->document))
@@ -336,8 +336,8 @@ undo_action (GtkWidget *widget,
hex_document_undo (gh->document);
- gtk_hex_set_cursor (gh, cd->start);
- gtk_hex_set_nibble (gh, cd->lower_nibble);
+ hex_widget_set_cursor (gh, cd->start);
+ hex_widget_set_nibble (gh, cd->lower_nibble);
}
}
@@ -346,7 +346,7 @@ toggle_hex_action (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
- GtkHex *gh = GTK_HEX (widget);
+ HexWidget *gh = HEX_WIDGET (widget);
gh->active_view = VIEW_HEX;
gtk_widget_queue_draw (widget);
@@ -357,7 +357,7 @@ toggle_ascii_action (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
- GtkHex *gh = GTK_HEX (widget);
+ HexWidget *gh = HEX_WIDGET (widget);
gh->active_view = VIEW_ASCII;
gtk_widget_queue_draw (widget);
@@ -368,7 +368,7 @@ toggle_ascii_action (GtkWidget *widget,
* to cursor coordinates.
*/
static void
-hex_to_pointer (GtkHex *gh, int mx, int my)
+hex_to_pointer (HexWidget *gh, int mx, int my)
{
int x = 0, cx = 0;
gint64 cy;
@@ -381,8 +381,8 @@ hex_to_pointer (GtkHex *gh, int mx, int my)
if (x > mx)
{
- gtk_hex_set_cursor_by_row_and_col (gh, cx/2, cy);
- gtk_hex_set_nibble (gh, ((cx%2 == 0)?UPPER_NIBBLE:LOWER_NIBBLE));
+ hex_widget_set_cursor_by_row_and_col (gh, cx/2, cy);
+ hex_widget_set_nibble (gh, ((cx%2 == 0)?UPPER_NIBBLE:LOWER_NIBBLE));
cx = 2*gh->cpl;
}
@@ -395,17 +395,17 @@ hex_to_pointer (GtkHex *gh, int mx, int my)
}
static void
-ascii_to_pointer (GtkHex *gh, int mx, int my)
+ascii_to_pointer (HexWidget *gh, int mx, int my)
{
gint64 cy;
cy = gh->top_line + my/gh->char_height;
- gtk_hex_set_cursor_by_row_and_col (gh, mx/gh->char_width, cy);
+ hex_widget_set_cursor_by_row_and_col (gh, mx/gh->char_width, cy);
}
static int
-get_char_height (GtkHex *gh)
+get_char_height (HexWidget *gh)
{
PangoContext *context;
PangoFontMetrics *metrics;
@@ -421,7 +421,7 @@ get_char_height (GtkHex *gh)
}
static int
-get_char_width (GtkHex *gh)
+get_char_width (HexWidget *gh)
{
PangoContext *context;
PangoFontMetrics *metrics;
@@ -440,8 +440,8 @@ get_char_width (GtkHex *gh)
width = PANGO_PIXELS(width);
/* update layout manager */
- if (GTK_IS_HEX_LAYOUT (gh->layout_manager)) {
- gtk_hex_layout_set_char_width (GTK_HEX_LAYOUT(gh->layout_manager),
+ if (HEX_IS_WIDGET_LAYOUT (gh->layout_manager)) {
+ hex_widget_layout_set_char_width (HEX_WIDGET_LAYOUT(gh->layout_manager),
width);
}
return width;
@@ -453,7 +453,7 @@ get_char_width (GtkHex *gh)
* Returns: length of resulting number of bytes/characters in buffer.
*/
static int
-format_xblock (GtkHex *gh, char *out, gint64 start, gint64 end)
+format_xblock (HexWidget *gh, char *out, gint64 start, gint64 end)
{
gint64 i, j;
int low, high;
@@ -461,7 +461,7 @@ format_xblock (GtkHex *gh, char *out, gint64 start, gint64 end)
for (i = start + 1, j = 0; i <= end; i++)
{
- c = gtk_hex_get_byte (gh, i - 1);
+ c = hex_widget_get_byte (gh, i - 1);
low = c & 0x0F;
high = (c & 0xF0) >> 4;
@@ -475,13 +475,13 @@ format_xblock (GtkHex *gh, char *out, gint64 start, gint64 end)
}
static int
-format_ablock (GtkHex *gh, char *out, gint64 start, gint64 end)
+format_ablock (HexWidget *gh, char *out, gint64 start, gint64 end)
{
gint64 i, j;
guchar c;
for (i = start, j = 0; i < end; i++, j++) {
- c = gtk_hex_get_byte (gh, i);
+ c = hex_widget_get_byte (gh, i);
if (is_displayable(c))
out[j] = c;
else
@@ -495,7 +495,7 @@ format_ablock (GtkHex *gh, char *out, gint64 start, gint64 end)
* the block into x,y coordinates of the xdisp/adisp, respectively
*/
static gboolean
-get_xcoords (GtkHex *gh, gint64 pos, int *x, int *y)
+get_xcoords (HexWidget *gh, gint64 pos, int *x, int *y)
{
gint64 cx, cy, spaces;
@@ -528,7 +528,7 @@ get_xcoords (GtkHex *gh, gint64 pos, int *x, int *y)
}
static gboolean
-get_acoords (GtkHex *gh, gint64 pos, int *x, int *y)
+get_acoords (HexWidget *gh, gint64 pos, int *x, int *y)
{
gint64 cx, cy;
@@ -557,7 +557,7 @@ get_acoords (GtkHex *gh, gint64 pos, int *x, int *y)
}
static void
-invalidate_xc (GtkHex *gh)
+invalidate_xc (HexWidget *gh)
{
GtkWidget *widget = gh->xdisp;
int cx, cy;
@@ -572,7 +572,7 @@ invalidate_xc (GtkHex *gh)
}
static void
-invalidate_ac (GtkHex *gh)
+invalidate_ac (HexWidget *gh)
{
GtkWidget *widget = gh->adisp;
int cx, cy;
@@ -584,12 +584,12 @@ invalidate_ac (GtkHex *gh)
}
static void
-render_cursor (GtkHex *gh,
+render_cursor (HexWidget *gh,
cairo_t *cr,
GtkWidget *widget,
PangoLayout *layout,
int y,
- GtkHexViewType cursor_type)
+ HexWidgetViewType cursor_type)
{
GdkRGBA fg_color;
gint64 index;
@@ -727,7 +727,7 @@ render_cursor (GtkHex *gh,
}
static void
-show_cursor (GtkHex *gh, gboolean show)
+show_cursor (HexWidget *gh, gboolean show)
{
if (gh->cursor_shown == show)
return;
@@ -742,14 +742,14 @@ show_cursor (GtkHex *gh, gboolean show)
}
static void
-render_highlights (GtkHex *gh,
+render_highlights (HexWidget *gh,
cairo_t *cr,
gint64 cursor_line,
- GtkHexViewType type)
+ HexWidgetViewType type)
{
/* Shorthand tracers to walk through highlight lists */
- GtkHex_Highlight *highlight = &gh->selection;
- GtkHex_AutoHighlight *auto_highlight = gh->auto_highlight;
+ HexWidget_Highlight *highlight = &gh->selection;
+ HexWidget_AutoHighlight *auto_highlight = gh->auto_highlight;
GtkWidget *widget; /* shorthand for the hex or ascii drawing area */
PangoLayout *layout; /* shorthand for the hex or ascii pango layout */
GtkStyleContext *context;
@@ -770,7 +770,7 @@ render_highlights (GtkHex *gh,
layout = gh->alayout;
}
- hex_cpl = gtk_hex_layout_get_hex_cpl (GTK_HEX_LAYOUT(gh->layout_manager));
+ hex_cpl = hex_widget_layout_get_hex_cpl (HEX_WIDGET_LAYOUT(gh->layout_manager));
y = cursor_line * gh->char_height;
while (highlight)
@@ -801,7 +801,7 @@ render_highlights (GtkHex *gh,
gtk_style_context_set_state (context, state);
- gtk_hex_validate_highlight (gh, highlight);
+ hex_widget_validate_highlight (gh, highlight);
start = MIN(highlight->start, highlight->end);
end = MAX(highlight->start, highlight->end);
@@ -906,7 +906,7 @@ end_of_loop:
* [0 .. gh->vis_lines-1] AND NOT [0 .. gh->lines]!
*/
static void
-invalidate_lines (GtkHex *gh,
+invalidate_lines (HexWidget *gh,
GtkWidget *widget,
int imin,
int imax)
@@ -928,7 +928,7 @@ invalidate_lines (GtkHex *gh,
}
static void
-invalidate_hex_lines (GtkHex *gh,
+invalidate_hex_lines (HexWidget *gh,
int imin, /* FIXME - imin/imax for next few funcs */
int imax) /* presently ignored. */
{
@@ -936,7 +936,7 @@ invalidate_hex_lines (GtkHex *gh,
}
static void
-invalidate_ascii_lines (GtkHex *gh,
+invalidate_ascii_lines (HexWidget *gh,
int imin,
int imax)
{
@@ -944,7 +944,7 @@ invalidate_ascii_lines (GtkHex *gh,
}
static void
-invalidate_offsets (GtkHex *gh,
+invalidate_offsets (HexWidget *gh,
int imin,
int imax)
{
@@ -962,16 +962,16 @@ invalidate_offsets (GtkHex *gh,
cursor_line * gh->char_height, /* y */ \
type);
static void
-render_lines (GtkHex *gh,
+render_lines (HexWidget *gh,
cairo_t *cr,
int min_lines,
int max_lines,
- GtkHexViewType type)
+ HexWidgetViewType type)
{
GtkWidget *widget;
GtkStateFlags state;
PangoLayout *layout;
- int (*block_format_func) (GtkHex *gh, char *out, gint64 start, gint64 end);
+ int (*block_format_func) (HexWidget *gh, char *out, gint64 start, gint64 end);
int block_format_len;
GtkAllocation allocation;
GtkStyleContext *context;
@@ -989,7 +989,7 @@ render_lines (GtkHex *gh,
widget = gh->xdisp;
layout = gh->xlayout;
block_format_func = format_xblock;
- cpl = gtk_hex_layout_get_hex_cpl (GTK_HEX_LAYOUT(gh->layout_manager));
+ cpl = hex_widget_layout_get_hex_cpl (HEX_WIDGET_LAYOUT(gh->layout_manager));
}
else /* VIEW_ASCII */
{
@@ -1070,7 +1070,7 @@ no_more_lines_to_draw:
#define BUFLEN 32
#define MIN_CPL 8
static void
-render_offsets (GtkHex *gh,
+render_offsets (HexWidget *gh,
cairo_t *cr,
int min_lines,
int max_lines)
@@ -1107,7 +1107,7 @@ render_offsets (GtkHex *gh,
MAX ((gh->top_line + max_lines), 0) * gh->cpl);
off_cpl = MAX (MIN_CPL, strlen (buf));
snprintf (fmt, BUFLEN-1, "%%0%dlX", off_cpl);
- gtk_hex_layout_set_offset_cpl (GTK_HEX_LAYOUT(gh->layout_manager), off_cpl);
+ hex_widget_layout_set_offset_cpl (HEX_WIDGET_LAYOUT(gh->layout_manager), off_cpl);
for (int i = min_lines; i <= max_lines; i++) {
/* generate offset string and place in temporary buffer */
@@ -1134,9 +1134,9 @@ hex_draw (GtkDrawingArea *drawing_area,
int height,
gpointer user_data)
{
- GtkHex *gh = GTK_HEX(user_data);
+ HexWidget *gh = HEX_WIDGET(user_data);
- g_return_if_fail (GTK_IS_HEX(gh));
+ g_return_if_fail (HEX_IS_WIDGET(gh));
/* Now that we have gh->cpl defined, run this function to bump all
* required values:
@@ -1156,8 +1156,8 @@ ascii_draw (GtkDrawingArea *drawing_area,
int height,
gpointer user_data)
{
- GtkHex *gh = GTK_HEX(user_data);
- g_return_if_fail(GTK_IS_HEX(gh));
+ HexWidget *gh = HEX_WIDGET(user_data);
+ g_return_if_fail(HEX_IS_WIDGET(gh));
render_lines (gh, cr, 0, gh->vis_lines, VIEW_ASCII);
}
@@ -1169,8 +1169,8 @@ offsets_draw (GtkDrawingArea *drawing_area,
int height,
gpointer user_data)
{
- GtkHex *gh = GTK_HEX(user_data);
- g_return_if_fail(GTK_IS_HEX(gh));
+ HexWidget *gh = HEX_WIDGET(user_data);
+ g_return_if_fail(HEX_IS_WIDGET(gh));
render_offsets (gh, cr, 0, gh->vis_lines);
}
@@ -1180,13 +1180,13 @@ offsets_draw (GtkDrawingArea *drawing_area,
* lines we can display according to the current size of the widget
*/
static void
-recalc_displays (GtkHex *gh)
+recalc_displays (HexWidget *gh)
{
GtkWidget *widget = GTK_WIDGET (gh);
int hex_cpl;
gint64 payload_size;
- hex_cpl = gtk_hex_layout_get_hex_cpl (GTK_HEX_LAYOUT(gh->layout_manager));
+ hex_cpl = hex_widget_layout_get_hex_cpl (HEX_WIDGET_LAYOUT(gh->layout_manager));
payload_size = HEX_BUFFER_PAYLOAD (gh->document);
/*
@@ -1208,7 +1208,7 @@ recalc_displays (GtkHex *gh)
}
static void
-recalc_scrolling (GtkHex *gh)
+recalc_scrolling (HexWidget *gh)
{
gboolean scroll_to_cursor;
double value;
@@ -1253,7 +1253,7 @@ recalc_scrolling (GtkHex *gh)
* connected to value-changed signal of scrollbar's GtkAdjustment
*/
static void
-display_scrolled (GtkAdjustment *adj, GtkHex *gh)
+display_scrolled (GtkAdjustment *adj, HexWidget *gh)
{
int dx, dy;
@@ -1262,8 +1262,8 @@ display_scrolled (GtkAdjustment *adj, GtkHex *gh)
gh->top_line = gtk_adjustment_get_value (adj);
- gtk_hex_update_all_auto_highlights (gh);
- gtk_hex_invalidate_all_highlights (gh);
+ hex_widget_update_all_auto_highlights (gh);
+ hex_widget_invalidate_all_highlights (gh);
/* FIXME - this works, but feels hackish. The problem is, _snapshot_child
* does nothing if it 'detects' that a widget does not need to be redrawn
@@ -1279,16 +1279,16 @@ display_scrolled (GtkAdjustment *adj, GtkHex *gh)
* mouse signal handlers (button 1 and motion) for both displays
*/
static gboolean
-scroll_timeout_handler (GtkHex *gh)
+scroll_timeout_handler (HexWidget *gh)
{
if (gh->scroll_dir < 0)
{
- gtk_hex_set_cursor (gh,
+ hex_widget_set_cursor (gh,
MAX (0, gh->cursor_pos - gh->cpl));
}
else if (gh->scroll_dir > 0)
{
- gtk_hex_set_cursor (gh,
+ hex_widget_set_cursor (gh,
MIN (HEX_BUFFER_PAYLOAD (gh->document) - 1,
gh->cursor_pos + gh->cpl));
}
@@ -1301,10 +1301,10 @@ scroll_cb (GtkEventControllerScroll *controller,
double dy,
gpointer user_data)
{
- GtkHex *gh = GTK_HEX (user_data);
+ HexWidget *gh = HEX_WIDGET (user_data);
double old_value, new_value;
- g_return_val_if_fail (GTK_IS_HEX(gh), FALSE);
+ g_return_val_if_fail (HEX_IS_WIDGET(gh), FALSE);
old_value = gtk_adjustment_get_value (gh->adj);
new_value = old_value + dy;
@@ -1319,11 +1319,11 @@ scroll_cb (GtkEventControllerScroll *controller,
/* Helper function for *_pressed_cb 's
*/
static void
-pressed_gesture_helper (GtkHex *gh,
+pressed_gesture_helper (HexWidget *gh,
GtkGestureClick *gesture,
double x,
double y,
- GtkHexViewType type)
+ HexWidgetViewType type)
{
GtkWidget *widget;
guint button;
@@ -1333,7 +1333,7 @@ pressed_gesture_helper (GtkHex *gh,
else
widget = gh->adisp;
- g_return_if_fail (GTK_IS_HEX(gh));
+ g_return_if_fail (HEX_IS_WIDGET(gh));
g_return_if_fail (GTK_IS_WIDGET(widget));
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE(gesture));
@@ -1356,7 +1356,7 @@ pressed_gesture_helper (GtkHex *gh,
if (! gh->selecting)
{
gh->selecting = TRUE;
- gtk_hex_set_selection (gh, gh->cursor_pos, gh->cursor_pos);
+ hex_widget_set_selection (gh, gh->cursor_pos, gh->cursor_pos);
}
}
else
@@ -1374,12 +1374,12 @@ pressed_gesture_helper (GtkHex *gh,
}
static void
-released_gesture_helper (GtkHex *gh,
+released_gesture_helper (HexWidget *gh,
GtkGestureClick *gesture,
int n_press,
double x,
double y,
- GtkHexViewType type)
+ HexWidgetViewType type)
{
GtkWidget *widget;
guint button;
@@ -1389,7 +1389,7 @@ released_gesture_helper (GtkHex *gh,
else
widget = gh->adisp;
- g_return_if_fail (GTK_IS_HEX(gh));
+ g_return_if_fail (HEX_IS_WIDGET(gh));
g_return_if_fail (GTK_IS_WIDGET(widget));
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE(gesture));
@@ -1419,9 +1419,9 @@ gh_pressed_cb (GtkGestureClick *gesture,
double y,
gpointer user_data)
{
- GtkHex *gh = GTK_HEX (user_data);
+ HexWidget *gh = HEX_WIDGET (user_data);
- gtk_hex_layout_set_cursor_pos (GTK_HEX_LAYOUT(gh->layout_manager), x, y);
+ hex_widget_layout_set_cursor_pos (HEX_WIDGET_LAYOUT(gh->layout_manager), x, y);
gtk_popover_popup (GTK_POPOVER(gh->context_menu));
}
@@ -1432,7 +1432,7 @@ hex_pressed_cb (GtkGestureClick *gesture,
double y,
gpointer user_data)
{
- GtkHex *gh = GTK_HEX (user_data);
+ HexWidget *gh = HEX_WIDGET (user_data);
pressed_gesture_helper (gh, gesture, x, y, VIEW_HEX);
}
@@ -1444,17 +1444,17 @@ hex_released_cb (GtkGestureClick *gesture,
double y,
gpointer user_data)
{
- GtkHex *gh = GTK_HEX (user_data);
+ HexWidget *gh = HEX_WIDGET (user_data);
released_gesture_helper (gh, gesture, n_press, x, y, VIEW_HEX);
}
static void
-drag_update_helper (GtkHex *gh,
+drag_update_helper (HexWidget *gh,
GtkGestureDrag *gesture,
double offset_x,
double offset_y,
- GtkHexViewType type)
+ HexWidgetViewType type)
{
GtkWidget *widget;
double start_x, start_y;
@@ -1466,7 +1466,7 @@ drag_update_helper (GtkHex *gh,
else
widget = gh->adisp;
- g_return_if_fail (GTK_IS_HEX(gh));
+ g_return_if_fail (HEX_IS_WIDGET(gh));
g_return_if_fail (GTK_IS_WIDGET(widget));
gtk_widget_get_allocation (widget, &allocation);
@@ -1514,7 +1514,7 @@ hex_drag_update_cb (GtkGestureDrag *gesture,
double offset_y,
gpointer user_data)
{
- GtkHex *gh = GTK_HEX (user_data);
+ HexWidget *gh = HEX_WIDGET (user_data);
drag_update_helper (gh, gesture, offset_x, offset_y, VIEW_HEX);
}
@@ -1528,7 +1528,7 @@ ascii_pressed_cb (GtkGestureClick *gesture,
double y,
gpointer user_data)
{
- GtkHex *gh = GTK_HEX (user_data);
+ HexWidget *gh = HEX_WIDGET (user_data);
pressed_gesture_helper (gh, gesture, x, y, VIEW_ASCII);
}
@@ -1540,7 +1540,7 @@ ascii_released_cb (GtkGestureClick *gesture,
double y,
gpointer user_data)
{
- GtkHex *gh = GTK_HEX (user_data);
+ HexWidget *gh = HEX_WIDGET (user_data);
released_gesture_helper (gh, gesture, n_press, x, y, VIEW_ASCII);
}
@@ -1551,7 +1551,7 @@ ascii_drag_update_cb (GtkGestureDrag *gesture,
double offset_y,
gpointer user_data)
{
- GtkHex *gh = GTK_HEX (user_data);
+ HexWidget *gh = HEX_WIDGET (user_data);
drag_update_helper (gh, gesture, offset_x, offset_y, VIEW_ASCII);
}
@@ -1563,7 +1563,7 @@ key_press_cb (GtkEventControllerKey *controller,
GdkModifierType state,
gpointer user_data)
{
- GtkHex *gh = GTK_HEX(user_data);
+ HexWidget *gh = HEX_WIDGET(user_data);
GtkWidget *widget = GTK_WIDGET(user_data);
gboolean ret = GDK_EVENT_PROPAGATE;
size_t payload_size;
@@ -1595,7 +1595,7 @@ key_press_cb (GtkEventControllerKey *controller,
0, 1, NULL, TRUE);
if (gh->selecting)
gh->selecting = FALSE;
- gtk_hex_set_cursor (gh, gh->cursor_pos - 1);
+ hex_widget_set_cursor (gh, gh->cursor_pos - 1);
ret = GDK_EVENT_STOP;
}
break;
@@ -1604,28 +1604,28 @@ key_press_cb (GtkEventControllerKey *controller,
if (gh->cursor_pos < payload_size) {
hex_document_set_data (gh->document, gh->cursor_pos,
0, 1, NULL, TRUE);
- gtk_hex_set_cursor (gh, gh->cursor_pos);
+ hex_widget_set_cursor (gh, gh->cursor_pos);
ret = GDK_EVENT_STOP;
}
break;
case GDK_KEY_Up:
- gtk_hex_set_cursor (gh, gh->cursor_pos - gh->cpl);
+ hex_widget_set_cursor (gh, gh->cursor_pos - gh->cpl);
ret = GDK_EVENT_STOP;
break;
case GDK_KEY_Down:
- gtk_hex_set_cursor (gh, gh->cursor_pos + gh->cpl);
+ hex_widget_set_cursor (gh, gh->cursor_pos + gh->cpl);
ret = GDK_EVENT_STOP;
break;
case GDK_KEY_Page_Up:
- gtk_hex_set_cursor (gh, MAX (0, gh->cursor_pos - gh->vis_lines*gh->cpl));
+ hex_widget_set_cursor (gh, MAX (0, gh->cursor_pos - gh->vis_lines*gh->cpl));
ret = GDK_EVENT_STOP;
break;
case GDK_KEY_Page_Down:
- gtk_hex_set_cursor(gh, MIN (payload_size,
+ hex_widget_set_cursor(gh, MIN (payload_size,
gh->cursor_pos + gh->vis_lines*gh->cpl));
ret = GDK_EVENT_STOP;
break;
@@ -1637,12 +1637,12 @@ key_press_cb (GtkEventControllerKey *controller,
{
case GDK_KEY_Left:
if (state & GDK_SHIFT_MASK) {
- gtk_hex_set_cursor (gh, gh->cursor_pos - 1);
+ hex_widget_set_cursor (gh, gh->cursor_pos - 1);
}
else {
gh->lower_nibble = !gh->lower_nibble;
if (gh->lower_nibble)
- gtk_hex_set_cursor (gh, gh->cursor_pos - 1);
+ hex_widget_set_cursor (gh, gh->cursor_pos -
1);
}
ret = GDK_EVENT_STOP;
break;
@@ -1654,12 +1654,12 @@ key_press_cb (GtkEventControllerKey *controller,
}
if (state & GDK_SHIFT_MASK) {
- gtk_hex_set_cursor (gh, gh->cursor_pos + 1);
+ hex_widget_set_cursor (gh, gh->cursor_pos + 1);
}
else {
gh->lower_nibble = !gh->lower_nibble;
if (!gh->lower_nibble)
- gtk_hex_set_cursor (gh, gh->cursor_pos + 1);
+ hex_widget_set_cursor (gh, gh->cursor_pos +
1);
}
ret = GDK_EVENT_STOP;
break;
@@ -1674,7 +1674,7 @@ key_press_cb (GtkEventControllerKey *controller,
gh->selecting = FALSE;
gh->lower_nibble = !gh->lower_nibble;
if (!gh->lower_nibble)
- gtk_hex_set_cursor (gh, gh->cursor_pos + 1);
+ hex_widget_set_cursor (gh, gh->cursor_pos +
1);
ret = GDK_EVENT_STOP;
}
else if (keyval >= 'A' && keyval <= 'F')
@@ -1686,7 +1686,7 @@ key_press_cb (GtkEventControllerKey *controller,
gh->selecting = FALSE;
gh->lower_nibble = !gh->lower_nibble;
if (!gh->lower_nibble)
- gtk_hex_set_cursor (gh, gh->cursor_pos + 1);
+ hex_widget_set_cursor (gh, gh->cursor_pos +
1);
ret = GDK_EVENT_STOP;
}
else if (keyval >= 'a' && keyval <= 'f')
@@ -1698,7 +1698,7 @@ key_press_cb (GtkEventControllerKey *controller,
gh->selecting = FALSE;
gh->lower_nibble = !gh->lower_nibble;
if (!gh->lower_nibble)
- gtk_hex_set_cursor (gh, gh->cursor_pos + 1);
+ hex_widget_set_cursor (gh, gh->cursor_pos +
1);
ret = GDK_EVENT_STOP;
}
else if (keyval >= GDK_KEY_KP_0 && keyval <= GDK_KEY_KP_9)
@@ -1710,7 +1710,7 @@ key_press_cb (GtkEventControllerKey *controller,
gh->selecting = FALSE;
gh->lower_nibble = !gh->lower_nibble;
if (!gh->lower_nibble)
- gtk_hex_set_cursor (gh, gh->cursor_pos + 1);
+ hex_widget_set_cursor (gh, gh->cursor_pos +
1);
ret = GDK_EVENT_STOP;
}
break;
@@ -1721,12 +1721,12 @@ key_press_cb (GtkEventControllerKey *controller,
switch (keyval)
{
case GDK_KEY_Left:
- gtk_hex_set_cursor (gh, gh->cursor_pos - 1);
+ hex_widget_set_cursor (gh, gh->cursor_pos - 1);
ret = GDK_EVENT_STOP;
break;
case GDK_KEY_Right:
- gtk_hex_set_cursor (gh, gh->cursor_pos + 1);
+ hex_widget_set_cursor (gh, gh->cursor_pos + 1);
ret = GDK_EVENT_STOP;
break;
@@ -1737,7 +1737,7 @@ key_press_cb (GtkEventControllerKey *controller,
gh->cursor_pos, gh->insert, TRUE);
if (gh->selecting)
gh->selecting = FALSE;
- gtk_hex_set_cursor (gh, gh->cursor_pos + 1);
+ hex_widget_set_cursor (gh, gh->cursor_pos + 1);
ret = GDK_EVENT_STOP;
}
else if (keyval >= GDK_KEY_KP_0 && keyval <= GDK_KEY_KP_9)
@@ -1746,7 +1746,7 @@ key_press_cb (GtkEventControllerKey *controller,
gh->cursor_pos, gh->insert, TRUE);
if (gh->selecting)
gh->selecting = FALSE;
- gtk_hex_set_cursor (gh, gh->cursor_pos + 1);
+ hex_widget_set_cursor (gh, gh->cursor_pos + 1);
ret = GDK_EVENT_STOP;
}
break;
@@ -1765,7 +1765,7 @@ key_release_cb (GtkEventControllerKey *controller,
GdkModifierType state,
gpointer user_data)
{
- GtkHex *gh = GTK_HEX(user_data);
+ HexWidget *gh = HEX_WIDGET(user_data);
GtkWidget *widget = GTK_WIDGET(user_data);
gboolean ret = GDK_EVENT_PROPAGATE;
@@ -1778,7 +1778,7 @@ key_release_cb (GtkEventControllerKey *controller,
}
static void
-show_offsets_widget(GtkHex *gh)
+show_offsets_widget(HexWidget *gh)
{
g_return_if_fail (GTK_IS_WIDGET (gh->offsets));
@@ -1786,7 +1786,7 @@ show_offsets_widget(GtkHex *gh)
}
static void
-hide_offsets_widget(GtkHex *gh)
+hide_offsets_widget(HexWidget *gh)
{
g_return_if_fail (gtk_widget_get_realized (gh->offsets));
@@ -1799,7 +1799,7 @@ hide_offsets_widget(GtkHex *gh)
* default data_changed signal handler
*/
static void
-gtk_hex_real_data_changed (GtkHex *gh, gpointer data)
+hex_widget_real_data_changed (HexWidget *gh, gpointer data)
{
HexChangeData *change_data = (HexChangeData *)data;
gint64 start_line, end_line;
@@ -1856,7 +1856,7 @@ gtk_hex_real_data_changed (GtkHex *gh, gpointer data)
}
static void
-bytes_changed (GtkHex *gh, gint64 start, gint64 end)
+bytes_changed (HexWidget *gh, gint64 start, gint64 end)
{
gint64 start_line;
gint64 end_line;
@@ -1883,7 +1883,7 @@ bytes_changed (GtkHex *gh, gint64 start, gint64 end)
}
static void
-gtk_hex_validate_highlight(GtkHex *gh, GtkHex_Highlight *hl)
+hex_widget_validate_highlight(HexWidget *gh, HexWidget_Highlight *hl)
{
if (!hl->valid)
{
@@ -1894,20 +1894,20 @@ gtk_hex_validate_highlight(GtkHex *gh, GtkHex_Highlight *hl)
}
static void
-gtk_hex_invalidate_highlight (GtkHex *gh, GtkHex_Highlight *hl)
+hex_widget_invalidate_highlight (HexWidget *gh, HexWidget_Highlight *hl)
{
hl->valid = FALSE;
}
static void
-gtk_hex_invalidate_all_highlights (GtkHex *gh)
+hex_widget_invalidate_all_highlights (HexWidget *gh)
{
- GtkHex_Highlight *cur = &gh->selection;
- GtkHex_AutoHighlight *nextList = gh->auto_highlight;
+ HexWidget_Highlight *cur = &gh->selection;
+ HexWidget_AutoHighlight *nextList = gh->auto_highlight;
while (cur)
{
- gtk_hex_invalidate_highlight (gh, cur);
+ hex_widget_invalidate_highlight (gh, cur);
cur = cur->next;
while (cur == NULL && nextList)
@@ -1918,9 +1918,9 @@ gtk_hex_invalidate_all_highlights (GtkHex *gh)
}
}
-static GtkHex_Highlight *
-gtk_hex_insert_highlight (GtkHex *gh,
- GtkHex_AutoHighlight *ahl,
+static HexWidget_Highlight *
+hex_widget_insert_highlight (HexWidget *gh,
+ HexWidget_AutoHighlight *ahl,
gint64 start,
gint64 end)
{
@@ -1929,7 +1929,7 @@ gtk_hex_insert_highlight (GtkHex *gh,
g_return_val_if_fail (HEX_IS_DOCUMENT (gh->document), NULL);
payload_size = HEX_BUFFER_PAYLOAD (gh->document);
- GtkHex_Highlight *new = g_new0 (GtkHex_Highlight, 1);
+ HexWidget_Highlight *new = g_new0 (HexWidget_Highlight, 1);
new->start = CLAMP(MIN(start, end), 0, payload_size);
new->end = MIN(MAX(start, end), payload_size);
@@ -1947,8 +1947,8 @@ gtk_hex_insert_highlight (GtkHex *gh,
}
static void
-gtk_hex_delete_highlight (GtkHex *gh, GtkHex_AutoHighlight *ahl,
- GtkHex_Highlight *hl)
+hex_widget_delete_highlight (HexWidget *gh, HexWidget_AutoHighlight *ahl,
+ HexWidget_Highlight *hl)
{
gint64 start, end;
start = hl->start;
@@ -1963,15 +1963,15 @@ gtk_hex_delete_highlight (GtkHex *gh, GtkHex_AutoHighlight *ahl,
}
/* stolen from hex_document_compare_data - but uses
- * gtk_hex_* stuff rather than hex_document_* directly
+ * hex_widget_* stuff rather than hex_document_* directly
* and simply returns a gboolean.
*/
static gboolean
-gtk_hex_compare_data (GtkHex *gh, guchar *cmp, gint64 pos, int len)
+hex_widget_compare_data (HexWidget *gh, guchar *cmp, gint64 pos, int len)
{
for (int i = 0; i < len; i++)
{
- guchar c = gtk_hex_get_byte (gh, pos + i);
+ guchar c = hex_widget_get_byte (gh, pos + i);
if (c != *(cmp + i))
return FALSE;
@@ -1980,14 +1980,14 @@ gtk_hex_compare_data (GtkHex *gh, guchar *cmp, gint64 pos, int len)
}
static gboolean
-gtk_hex_find_limited (GtkHex *gh, char *find, int findlen,
+hex_widget_find_limited (HexWidget *gh, char *find, int findlen,
gint64 lower, gint64 upper, gint64 *found)
{
gint64 pos = lower;
while (pos < upper)
{
- if (gtk_hex_compare_data (gh, (guchar *)find, pos, findlen))
+ if (hex_widget_compare_data (gh, (guchar *)find, pos, findlen))
{
*found = pos;
return TRUE;
@@ -2002,14 +2002,14 @@ gtk_hex_find_limited (GtkHex *gh, char *find, int findlen,
* view_min () and view_max () value.
*/
static inline void
-ahl_set_view_min_max (GtkHex *gh, GtkHex_AutoHighlight *ahl)
+ahl_set_view_min_max (HexWidget *gh, HexWidget_AutoHighlight *ahl)
{
ahl->view_min = gh->top_line * gh->cpl;
ahl->view_max = (gh->top_line + gh->vis_lines) * gh->cpl;
}
static void
-gtk_hex_update_auto_highlight (GtkHex *gh, GtkHex_AutoHighlight *ahl,
+hex_widget_update_auto_highlight (HexWidget *gh, HexWidget_AutoHighlight *ahl,
gboolean delete, gboolean add)
{
gint64 del_min, del_max;
@@ -2017,7 +2017,7 @@ gtk_hex_update_auto_highlight (GtkHex *gh, GtkHex_AutoHighlight *ahl,
gint64 foundpos = -1;
gint64 prev_min = ahl->view_min;
gint64 prev_max = ahl->view_max;
- GtkHex_Highlight *cur;
+ HexWidget_Highlight *cur;
ahl_set_view_min_max (gh, ahl);
@@ -2051,27 +2051,27 @@ gtk_hex_update_auto_highlight (GtkHex *gh, GtkHex_AutoHighlight *ahl,
{
if (cur->start >= del_min && cur->start <= del_max)
{
- GtkHex_Highlight *next = cur->next;
+ HexWidget_Highlight *next = cur->next;
- gtk_hex_delete_highlight (gh, ahl, cur);
+ hex_widget_delete_highlight (gh, ahl, cur);
cur = next;
}
else cur = cur->next;
}
while (add &&
- gtk_hex_find_limited (gh, ahl->search_string, ahl->search_len,
+ hex_widget_find_limited (gh, ahl->search_string, ahl->search_len,
/* lower */ MAX(add_min, foundpos+1), add_max, &foundpos))
{
- gtk_hex_insert_highlight (gh, ahl,
+ hex_widget_insert_highlight (gh, ahl,
foundpos, foundpos+(ahl->search_len)-1);
}
}
static void
-gtk_hex_update_all_auto_highlights (GtkHex *gh)
+hex_widget_update_all_auto_highlights (HexWidget *gh)
{
- GtkHex_AutoHighlight *cur = gh->auto_highlight;
+ HexWidget_AutoHighlight *cur = gh->auto_highlight;
int mult = 10;
@@ -2089,18 +2089,18 @@ gtk_hex_update_all_auto_highlights (GtkHex *gh)
}
else
{
- gtk_hex_update_auto_highlight (gh, cur, TRUE, TRUE);
+ hex_widget_update_auto_highlight (gh, cur, TRUE, TRUE);
}
cur = cur->next;
}
}
static void
-gtk_hex_real_copy_to_clipboard (GtkHex *gh)
+hex_widget_real_copy_to_clipboard (HexWidget *gh)
{
GtkWidget *widget = GTK_WIDGET(gh);
GdkClipboard *clipboard;
- GtkHexPasteData *paste;
+ HexPasteData *paste;
GdkContentProvider *provider_union;
GdkContentProvider *provider_array[2];
gint64 start_pos, end_pos;
@@ -2124,12 +2124,12 @@ gtk_hex_real_copy_to_clipboard (GtkHex *gh)
start_pos, len);
/* Setup a union of HexPasteData and a plain C string */
- paste = gtk_hex_paste_data_new (doc_data, len);
- g_return_if_fail (GTK_IS_HEX_PASTE_DATA(paste));
- string = gtk_hex_paste_data_get_string (paste);
+ paste = hex_paste_data_new (doc_data, len);
+ g_return_if_fail (HEX_IS_PASTE_DATA(paste));
+ string = hex_paste_data_get_string (paste);
provider_array[0] =
- gdk_content_provider_new_typed (GTK_TYPE_HEX_PASTE_DATA, paste);
+ gdk_content_provider_new_typed (HEX_TYPE_PASTE_DATA, paste);
provider_array[1] =
gdk_content_provider_new_typed (G_TYPE_STRING, string);
@@ -2140,14 +2140,14 @@ gtk_hex_real_copy_to_clipboard (GtkHex *gh)
}
static void
-gtk_hex_real_cut_to_clipboard(GtkHex *gh,
+hex_widget_real_cut_to_clipboard(HexWidget *gh,
gpointer user_data)
{
(void)user_data;
if (gh->selection.start != -1 && gh->selection.end != -1) {
- gtk_hex_real_copy_to_clipboard(gh);
- gtk_hex_delete_selection(gh);
+ hex_widget_real_copy_to_clipboard(gh);
+ hex_widget_delete_selection(gh);
}
}
@@ -2156,7 +2156,7 @@ plaintext_paste_received_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
- GtkHex *gh = GTK_HEX(user_data);
+ HexWidget *gh = HEX_WIDGET(user_data);
GdkClipboard *clipboard;
char *text;
GError *error = NULL;
@@ -2178,7 +2178,7 @@ plaintext_paste_received_cb (GObject *source_object,
text,
TRUE);
- gtk_hex_set_cursor (gh, gh->cursor_pos + strlen(text));
+ hex_widget_set_cursor (gh, gh->cursor_pos + strlen(text));
g_free(text);
}
@@ -2190,21 +2190,21 @@ plaintext_paste_received_cb (GObject *source_object,
}
static void
-gtk_hex_real_paste_from_clipboard (GtkHex *gh,
+hex_widget_real_paste_from_clipboard (HexWidget *gh,
gpointer user_data)
{
GtkWidget *widget = GTK_WIDGET(gh);
GdkClipboard *clipboard;
GdkContentProvider *content;
GValue value = G_VALUE_INIT;
- GtkHexPasteData *paste;
+ HexPasteData *paste;
gboolean have_hex_paste_data = FALSE;
(void)user_data; /* unused */
clipboard = gtk_widget_get_clipboard (widget);
content = gdk_clipboard_get_content (clipboard);
- g_value_init (&value, GTK_TYPE_HEX_PASTE_DATA);
+ g_value_init (&value, HEX_TYPE_PASTE_DATA);
/* If the clipboard contains our special HexPasteData, we'll use it.
* If not, just fall back to plaintext.
@@ -2229,9 +2229,9 @@ gtk_hex_real_paste_from_clipboard (GtkHex *gh,
g_debug("%s: We HAVE our special HexPasteData.",
__func__);
- paste = GTK_HEX_PASTE_DATA(g_value_get_object (&value));
- doc_data = gtk_hex_paste_data_get_doc_data (paste);
- elems = gtk_hex_paste_data_get_elems (paste);
+ paste = HEX_PASTE_DATA(g_value_get_object (&value));
+ doc_data = hex_paste_data_get_doc_data (paste);
+ elems = hex_paste_data_get_elems (paste);
hex_document_set_data (gh->document,
gh->cursor_pos,
@@ -2240,7 +2240,7 @@ gtk_hex_real_paste_from_clipboard (GtkHex *gh,
doc_data,
TRUE);
- gtk_hex_set_cursor (gh, gh->cursor_pos + elems);
+ hex_widget_set_cursor (gh, gh->cursor_pos + elems);
}
else {
gdk_clipboard_read_text_async (clipboard,
@@ -2251,7 +2251,7 @@ gtk_hex_real_paste_from_clipboard (GtkHex *gh,
}
static void
-gtk_hex_real_draw_complete (GtkHex *gh,
+hex_widget_real_draw_complete (HexWidget *gh,
gpointer user_data)
{
(void)user_data;
@@ -2260,9 +2260,9 @@ gtk_hex_real_draw_complete (GtkHex *gh,
}
static void
-gtk_hex_snapshot (GtkWidget *widget, GtkSnapshot *snapshot)
+hex_widget_snapshot (GtkWidget *widget, GtkSnapshot *snapshot)
{
- GtkHex *gh = GTK_HEX(widget);
+ HexWidget *gh = HEX_WIDGET(widget);
GtkWidget *child;
float height;
@@ -2272,7 +2272,7 @@ gtk_hex_snapshot (GtkWidget *widget, GtkSnapshot *snapshot)
/* Get cpl from layout manager */
height = gtk_widget_get_allocated_height (widget);
- gh->cpl = gtk_hex_layout_get_cpl (GTK_HEX_LAYOUT(gh->layout_manager));
+ gh->cpl = hex_widget_layout_get_cpl (HEX_WIDGET_LAYOUT(gh->layout_manager));
/* set visible lines - do this here and now as we can use the height
* of the widget as a whole. */
@@ -2298,7 +2298,7 @@ gtk_hex_snapshot (GtkWidget *widget, GtkSnapshot *snapshot)
}
static void
-set_busy_state (GtkHex *gh, gboolean busy)
+set_busy_state (HexWidget *gh, gboolean busy)
{
GtkWidget *widget = GTK_WIDGET(gh);
@@ -2323,7 +2323,7 @@ set_busy_state (GtkHex *gh, gboolean busy)
static void
file_read_started_cb (HexDocument *doc, gpointer data)
{
- GtkHex *gh = GTK_HEX (data);
+ HexWidget *gh = HEX_WIDGET (data);
set_busy_state (gh, TRUE);
}
@@ -2331,7 +2331,7 @@ file_read_started_cb (HexDocument *doc, gpointer data)
static void
file_loaded_cb (HexDocument *doc, gpointer data)
{
- GtkHex *gh = GTK_HEX(data);
+ HexWidget *gh = HEX_WIDGET(data);
gtk_widget_action_set_enabled (GTK_WIDGET(gh),
"gtkhex.undo", hex_document_can_undo (doc));
@@ -2347,10 +2347,10 @@ static void
document_changed_cb (HexDocument* doc, gpointer change_data,
gboolean push_undo, gpointer data)
{
- GtkHex *gh = GTK_HEX(data);
- g_return_if_fail (GTK_IS_HEX (gh));
+ HexWidget *gh = HEX_WIDGET(data);
+ g_return_if_fail (HEX_IS_WIDGET (gh));
- gtk_hex_real_data_changed (gh, change_data);
+ hex_widget_real_data_changed (gh, change_data);
gtk_widget_action_set_enabled (GTK_WIDGET(gh),
"gtkhex.undo", hex_document_can_undo (doc));
@@ -2359,9 +2359,9 @@ document_changed_cb (HexDocument* doc, gpointer change_data,
}
static void
-gtk_hex_dispose (GObject *object)
+hex_widget_dispose (GObject *object)
{
- GtkHex *gh = GTK_HEX(object);
+ HexWidget *gh = HEX_WIDGET(object);
GtkWidget *widget = GTK_WIDGET(gh);
GtkWidget *child;
@@ -2388,39 +2388,39 @@ gtk_hex_dispose (GObject *object)
g_clear_object (&gh->document);
/* Chain up */
- G_OBJECT_CLASS(gtk_hex_parent_class)->dispose(object);
+ G_OBJECT_CLASS(hex_widget_parent_class)->dispose(object);
}
static void
-gtk_hex_finalize (GObject *gobject)
+hex_widget_finalize (GObject *gobject)
{
- GtkHex *gh = GTK_HEX(gobject);
+ HexWidget *gh = HEX_WIDGET(gobject);
if (gh->disp_buffer)
g_free (gh->disp_buffer);
/* Boilerplate; keep here. Chain up to the parent class.
*/
- G_OBJECT_CLASS(gtk_hex_parent_class)->finalize(gobject);
+ G_OBJECT_CLASS(hex_widget_parent_class)->finalize(gobject);
}
static void
-gtk_hex_class_init (GtkHexClass *klass)
+hex_widget_class_init (HexWidgetClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
/* vfuncs */
- object_class->dispose = gtk_hex_dispose;
- object_class->finalize = gtk_hex_finalize;
- widget_class->snapshot = gtk_hex_snapshot;
+ object_class->dispose = hex_widget_dispose;
+ object_class->finalize = hex_widget_finalize;
+ widget_class->snapshot = hex_widget_snapshot;
/* Layout manager: box-style layout. */
gtk_widget_class_set_layout_manager_type (widget_class,
- GTK_TYPE_HEX_LAYOUT);
+ HEX_TYPE_WIDGET_LAYOUT);
/* CSS name */
@@ -2448,7 +2448,7 @@ gtk_hex_class_init (GtkHexClass *klass)
g_signal_new_class_handler ("data-changed",
G_OBJECT_CLASS_TYPE(object_class),
G_SIGNAL_RUN_FIRST,
- G_CALLBACK(gtk_hex_real_data_changed),
+ G_CALLBACK(hex_widget_real_data_changed),
NULL, NULL,
NULL,
G_TYPE_NONE,
@@ -2458,7 +2458,7 @@ gtk_hex_class_init (GtkHexClass *klass)
g_signal_new_class_handler ("cut-clipboard",
G_OBJECT_CLASS_TYPE(object_class),
G_SIGNAL_RUN_FIRST,
- G_CALLBACK(gtk_hex_real_cut_to_clipboard),
+ G_CALLBACK(hex_widget_real_cut_to_clipboard),
NULL, NULL,
NULL,
G_TYPE_NONE,
@@ -2468,7 +2468,7 @@ gtk_hex_class_init (GtkHexClass *klass)
g_signal_new_class_handler ("copy-clipboard",
G_OBJECT_CLASS_TYPE(object_class),
G_SIGNAL_RUN_FIRST,
- G_CALLBACK(gtk_hex_real_copy_to_clipboard),
+ G_CALLBACK(hex_widget_real_copy_to_clipboard),
NULL, NULL,
NULL,
G_TYPE_NONE,
@@ -2478,7 +2478,7 @@ gtk_hex_class_init (GtkHexClass *klass)
g_signal_new_class_handler ("paste-clipboard",
G_OBJECT_CLASS_TYPE(object_class),
G_SIGNAL_RUN_FIRST,
- G_CALLBACK(gtk_hex_real_paste_from_clipboard),
+ G_CALLBACK(hex_widget_real_paste_from_clipboard),
NULL, NULL,
NULL,
G_TYPE_NONE,
@@ -2488,7 +2488,7 @@ gtk_hex_class_init (GtkHexClass *klass)
g_signal_new_class_handler ("draw-complete",
G_OBJECT_CLASS_TYPE(object_class),
G_SIGNAL_RUN_FIRST,
- G_CALLBACK(gtk_hex_real_draw_complete),
+ G_CALLBACK(hex_widget_real_draw_complete),
NULL, NULL,
NULL,
G_TYPE_NONE,
@@ -2525,7 +2525,7 @@ gtk_hex_class_init (GtkHexClass *klass)
toggle_ascii_action);
/* SHORTCUTS FOR ACTIONS (not to be confused with keybindings, which are
- * set up in gtk_hex_init) */
+ * set up in hex_widget_init) */
/* Ctrl+c - copy */
gtk_widget_class_add_binding_action (widget_class,
@@ -2578,11 +2578,11 @@ gtk_hex_class_init (GtkHexClass *klass)
}
static void
-gtk_hex_init (GtkHex *gh)
+hex_widget_init (HexWidget *gh)
{
GtkWidget *widget = GTK_WIDGET(gh);
- GtkHexLayoutChild *child_info;
+ HexWidgetLayoutChild *child_info;
GtkStyleContext *context;
@@ -2603,7 +2603,7 @@ gtk_hex_init (GtkHex *gh)
gh->document = NULL;
gh->active_view = VIEW_HEX;
- gh->group_type = GTK_HEX_GROUP_BYTE;
+ gh->group_type = HEX_WIDGET_GROUP_BYTE;
gh->lines = gh->vis_lines = gh->top_line = gh->cpl = 0;
gh->cursor_pos = 0;
gh->lower_nibble = FALSE;
@@ -2639,9 +2639,9 @@ gtk_hex_init (GtkHex *gh)
gh->offsets = gtk_drawing_area_new();
gtk_widget_set_parent (gh->offsets, widget);
- child_info = GTK_HEX_LAYOUT_CHILD (gtk_layout_manager_get_layout_child
+ child_info = HEX_WIDGET_LAYOUT_CHILD (gtk_layout_manager_get_layout_child
(gh->layout_manager, gh->offsets));
- gtk_hex_layout_child_set_column (child_info, OFFSETS_COLUMN);
+ hex_widget_layout_child_set_column (child_info, OFFSETS_COLUMN);
/* Create the pango layout for the widget */
gh->olayout = gtk_widget_create_pango_layout (gh->offsets, "");
@@ -2669,9 +2669,9 @@ gtk_hex_init (GtkHex *gh)
gh->xdisp = gtk_drawing_area_new();
gtk_widget_set_parent (gh->xdisp, widget);
- child_info = GTK_HEX_LAYOUT_CHILD (gtk_layout_manager_get_layout_child
+ child_info = HEX_WIDGET_LAYOUT_CHILD (gtk_layout_manager_get_layout_child
(gh->layout_manager, gh->xdisp));
- gtk_hex_layout_child_set_column (child_info, HEX_COLUMN);
+ hex_widget_layout_child_set_column (child_info, HEX_COLUMN);
/* Create the pango layout for the widget */
gh->xlayout = gtk_widget_create_pango_layout (gh->xdisp, "");
@@ -2694,9 +2694,9 @@ gtk_hex_init (GtkHex *gh)
gh->adisp = gtk_drawing_area_new();
gtk_widget_set_parent (gh->adisp, widget);
- child_info = GTK_HEX_LAYOUT_CHILD (gtk_layout_manager_get_layout_child
+ child_info = HEX_WIDGET_LAYOUT_CHILD (gtk_layout_manager_get_layout_child
(gh->layout_manager, gh->adisp));
- gtk_hex_layout_child_set_column (child_info, ASCII_COLUMN);
+ hex_widget_layout_child_set_column (child_info, ASCII_COLUMN);
/* Create the pango layout for the widget */
gh->alayout = gtk_widget_create_pango_layout (gh->adisp, "");
@@ -2746,9 +2746,9 @@ gtk_hex_init (GtkHex *gh)
GTK_STYLE_PROVIDER_PRIORITY_THEME);
gtk_widget_set_parent (gh->scrollbar, widget);
- child_info = GTK_HEX_LAYOUT_CHILD (gtk_layout_manager_get_layout_child
+ child_info = HEX_WIDGET_LAYOUT_CHILD (gtk_layout_manager_get_layout_child
(gh->layout_manager, gh->scrollbar));
- gtk_hex_layout_child_set_column (child_info, SCROLLBAR_COLUMN);
+ hex_widget_layout_child_set_column (child_info, SCROLLBAR_COLUMN);
/* Setup busy spinner */
@@ -2764,7 +2764,7 @@ gtk_hex_init (GtkHex *gh)
/* GESTURES */
- /* Whole GtkHex widget (for right-click context menu) */
+ /* Whole HexWidget widget (for right-click context menu) */
gesture = gtk_gesture_click_new ();
@@ -2871,11 +2871,11 @@ gtk_hex_init (GtkHex *gh)
}
GtkWidget *
-gtk_hex_new (HexDocument *owner)
+hex_widget_new (HexDocument *owner)
{
- GtkHex *gh;
+ HexWidget *gh;
- gh = GTK_HEX (g_object_new (GTK_TYPE_HEX, NULL));
+ gh = HEX_WIDGET (g_object_new (HEX_TYPE_WIDGET, NULL));
g_return_val_if_fail (gh != NULL, NULL);
gh->document = owner;
@@ -2904,25 +2904,25 @@ gtk_hex_new (HexDocument *owner)
/*-------- public API starts here --------*/
void
-gtk_hex_copy_to_clipboard (GtkHex *gh)
+hex_widget_copy_to_clipboard (HexWidget *gh)
{
g_signal_emit_by_name(G_OBJECT(gh), "copy-clipboard");
}
void
-gtk_hex_cut_to_clipboard (GtkHex *gh)
+hex_widget_cut_to_clipboard (HexWidget *gh)
{
g_signal_emit_by_name(G_OBJECT(gh), "cut-clipboard");
}
void
-gtk_hex_paste_from_clipboard (GtkHex *gh)
+hex_widget_paste_from_clipboard (HexWidget *gh)
{
g_signal_emit_by_name(G_OBJECT(gh), "paste-clipboard");
}
void
-gtk_hex_set_selection (GtkHex *gh, gint64 start, gint64 end)
+hex_widget_set_selection (HexWidget *gh, gint64 start, gint64 end)
{
size_t payload_size;
gint64 oe, os, ne, ns;
@@ -2940,7 +2940,7 @@ gtk_hex_set_selection (GtkHex *gh, gint64 start, gint64 end)
gh->selection.start = CLAMP(start, 0, payload_size);
gh->selection.end = MIN(end, payload_size);
- gtk_hex_invalidate_highlight(gh, &gh->selection);
+ hex_widget_invalidate_highlight(gh, &gh->selection);
ns = MIN(gh->selection.start, gh->selection.end);
ne = MAX(gh->selection.start, gh->selection.end);
@@ -2957,7 +2957,7 @@ gtk_hex_set_selection (GtkHex *gh, gint64 start, gint64 end)
}
gboolean
-gtk_hex_get_selection (GtkHex *gh, gint64 *start, gint64 *end)
+hex_widget_get_selection (HexWidget *gh, gint64 *start, gint64 *end)
{
gint64 ss, se;
@@ -2979,13 +2979,13 @@ gtk_hex_get_selection (GtkHex *gh, gint64 *start, gint64 *end)
}
void
-gtk_hex_clear_selection (GtkHex *gh)
+hex_widget_clear_selection (HexWidget *gh)
{
- gtk_hex_set_selection(gh, 0, 0);
+ hex_widget_set_selection(gh, 0, 0);
}
void
-gtk_hex_delete_selection (GtkHex *gh)
+hex_widget_delete_selection (HexWidget *gh)
{
gint64 start, end;
size_t len;
@@ -2996,21 +2996,21 @@ gtk_hex_delete_selection (GtkHex *gh)
len = end - start + 1;
g_return_if_fail (len);
- gtk_hex_clear_selection (gh);
+ hex_widget_clear_selection (gh);
hex_document_delete_data (gh->document,
MIN(start, end), len, TRUE);
- gtk_hex_set_cursor (gh, start);
+ hex_widget_set_cursor (gh, start);
}
/*
* moves cursor to UPPER_NIBBLE or LOWER_NIBBLE of the current byte
*/
void
-gtk_hex_set_nibble (GtkHex *gh, gboolean lower_nibble)
+hex_widget_set_nibble (HexWidget *gh, gboolean lower_nibble)
{
- g_return_if_fail (GTK_IS_HEX(gh));
+ g_return_if_fail (HEX_IS_WIDGET(gh));
if (gh->selecting) {
bytes_changed(gh, gh->cursor_pos, gh->cursor_pos);
@@ -3034,13 +3034,13 @@ gtk_hex_set_nibble (GtkHex *gh, gboolean lower_nibble)
* moves cursor to byte index
*/
void
-gtk_hex_set_cursor (GtkHex *gh, gint64 index)
+hex_widget_set_cursor (HexWidget *gh, gint64 index)
{
gint64 y;
gint64 old_pos;
size_t payload_size;
- g_return_if_fail (GTK_IS_HEX (gh));
+ g_return_if_fail (HEX_IS_WIDGET (gh));
old_pos = gh->cursor_pos;
payload_size = HEX_BUFFER_PAYLOAD (gh->document);
@@ -3078,7 +3078,7 @@ gtk_hex_set_cursor (GtkHex *gh, gint64 index)
if (gh->selecting)
{
- gtk_hex_set_selection(gh, gh->selection.start, gh->cursor_pos);
+ hex_widget_set_selection(gh, gh->selection.start, gh->cursor_pos);
bytes_changed (gh,
MIN (gh->cursor_pos, old_pos),
@@ -3105,13 +3105,13 @@ gtk_hex_set_cursor (GtkHex *gh, gint64 index)
* currently visible part)
*/
void
-gtk_hex_set_cursor_by_row_and_col (GtkHex *gh, int col_x, gint64 line_y)
+hex_widget_set_cursor_by_row_and_col (HexWidget *gh, int col_x, gint64 line_y)
{
gint64 tmp_cursor_pos;
gint64 old_pos;
gint64 payload_size;
- g_return_if_fail (GTK_IS_HEX(gh));
+ g_return_if_fail (HEX_IS_WIDGET(gh));
old_pos = gh->cursor_pos;
tmp_cursor_pos = line_y * gh->cpl + col_x;
@@ -3142,7 +3142,7 @@ gtk_hex_set_cursor_by_row_and_col (GtkHex *gh, int col_x, gint64 line_y)
g_signal_emit_by_name(G_OBJECT(gh), "cursor-moved");
if (gh->selecting) {
- gtk_hex_set_selection(gh, gh->selection.start, gh->cursor_pos);
+ hex_widget_set_selection(gh, gh->selection.start, gh->cursor_pos);
bytes_changed(gh,
MIN(gh->cursor_pos, old_pos), MAX(gh->cursor_pos,
old_pos));
@@ -3162,10 +3162,10 @@ gtk_hex_set_cursor_by_row_and_col (GtkHex *gh, int col_x, gint64 line_y)
* returns cursor position
*/
gint64
-gtk_hex_get_cursor (GtkHex *gh)
+hex_widget_get_cursor (HexWidget *gh)
{
g_return_val_if_fail (gh != NULL, -1);
- g_return_val_if_fail (GTK_IS_HEX(gh), -1);
+ g_return_val_if_fail (HEX_IS_WIDGET(gh), -1);
return gh->cursor_pos;
}
@@ -3174,9 +3174,9 @@ gtk_hex_get_cursor (GtkHex *gh)
* returns value of the byte at position offset
*/
guchar
-gtk_hex_get_byte (GtkHex *gh, gint64 offset)
+hex_widget_get_byte (HexWidget *gh, gint64 offset)
{
- g_return_val_if_fail (GTK_IS_HEX(gh), 0);
+ g_return_val_if_fail (HEX_IS_WIDGET(gh), 0);
if ((offset >= 0) && (offset < HEX_BUFFER_PAYLOAD (gh->document)))
return hex_buffer_get_byte (hex_document_get_buffer (gh->document), offset);
@@ -3185,15 +3185,15 @@ gtk_hex_get_byte (GtkHex *gh, gint64 offset)
}
void
-gtk_hex_set_group_type (GtkHex *gh, GtkHexGroupType gt)
+hex_widget_set_group_type (HexWidget *gh, HexWidgetGroupType gt)
{
g_return_if_fail(gh != NULL);
- g_return_if_fail(GTK_IS_HEX(gh));
+ g_return_if_fail(HEX_IS_WIDGET(gh));
show_cursor (gh, FALSE);
gh->group_type = gt;
- gtk_hex_layout_set_group_type (GTK_HEX_LAYOUT(gh->layout_manager), gt);
+ hex_widget_layout_set_group_type (HEX_WIDGET_LAYOUT(gh->layout_manager), gt);
recalc_displays(gh);
gtk_widget_queue_resize (GTK_WIDGET(gh));
@@ -3204,9 +3204,9 @@ gtk_hex_set_group_type (GtkHex *gh, GtkHexGroupType gt)
* do we show the offsets of lines?
*/
void
-gtk_hex_show_offsets (GtkHex *gh, gboolean show)
+hex_widget_show_offsets (HexWidget *gh, gboolean show)
{
- g_return_if_fail (GTK_IS_HEX (gh));
+ g_return_if_fail (HEX_IS_WIDGET (gh));
gh->show_offsets = show;
if (show)
@@ -3216,7 +3216,7 @@ gtk_hex_show_offsets (GtkHex *gh, gboolean show)
}
void
-gtk_hex_set_insert_mode (GtkHex *gh, gboolean insert)
+hex_widget_set_insert_mode (HexWidget *gh, gboolean insert)
{
size_t payload_size;
@@ -3229,12 +3229,12 @@ gtk_hex_set_insert_mode (GtkHex *gh, gboolean insert)
gh->cursor_pos = payload_size - 1;
}
-GtkHex_AutoHighlight *
-gtk_hex_insert_autohighlight (GtkHex *gh,
+HexWidget_AutoHighlight *
+hex_widget_insert_autohighlight (HexWidget *gh,
const char *search,
int len)
{
- GtkHex_AutoHighlight *new = g_new0 (GtkHex_AutoHighlight, 1);
+ HexWidget_AutoHighlight *new = g_new0 (HexWidget_AutoHighlight, 1);
new->search_string = g_memdup2 (search, len);
new->search_len = len;
@@ -3248,18 +3248,18 @@ gtk_hex_insert_autohighlight (GtkHex *gh,
ahl_set_view_min_max (gh, new);
- gtk_hex_update_auto_highlight (gh, new, FALSE, TRUE);
+ hex_widget_update_auto_highlight (gh, new, FALSE, TRUE);
return new;
}
-void gtk_hex_delete_autohighlight(GtkHex *gh, GtkHex_AutoHighlight *ahl)
+void hex_widget_delete_autohighlight(HexWidget *gh, HexWidget_AutoHighlight *ahl)
{
g_free(ahl->search_string);
while (ahl->highlights)
{
- gtk_hex_delete_highlight(gh, ahl, ahl->highlights);
+ hex_widget_delete_highlight(gh, ahl, ahl->highlights);
}
if (ahl->next) ahl->next->prev = ahl->prev;
@@ -3270,14 +3270,14 @@ void gtk_hex_delete_autohighlight(GtkHex *gh, GtkHex_AutoHighlight *ahl)
g_free(ahl);
}
-void gtk_hex_set_geometry (GtkHex *gh, int cpl, int vis_lines)
+void hex_widget_set_geometry (HexWidget *gh, int cpl, int vis_lines)
{
gh->default_cpl = cpl;
gh->default_lines = vis_lines;
}
GtkAdjustment *
-gtk_hex_get_adjustment (GtkHex *gh)
+hex_widget_get_adjustment (HexWidget *gh)
{
g_return_val_if_fail (GTK_IS_ADJUSTMENT(gh->adj), NULL);
@@ -3285,7 +3285,7 @@ gtk_hex_get_adjustment (GtkHex *gh)
}
HexDocument *
-gtk_hex_get_document (GtkHex *gh)
+hex_widget_get_document (HexWidget *gh)
{
g_return_val_if_fail (HEX_IS_DOCUMENT(gh->document), NULL);
@@ -3293,17 +3293,17 @@ gtk_hex_get_document (GtkHex *gh)
}
gboolean
-gtk_hex_get_insert_mode (GtkHex *gh)
+hex_widget_get_insert_mode (HexWidget *gh)
{
- g_return_val_if_fail (GTK_IS_HEX (gh), FALSE);
+ g_return_val_if_fail (HEX_IS_WIDGET (gh), FALSE);
return gh->insert;
}
-GtkHexGroupType
-gtk_hex_get_group_type (GtkHex *gh)
+HexWidgetGroupType
+hex_widget_get_group_type (HexWidget *gh)
{
- g_assert (GTK_IS_HEX (gh));
+ g_assert (HEX_IS_WIDGET (gh));
return gh->group_type;
}
diff --git a/src/gtkhex.h b/src/gtkhex.h
index d719154..67bdfe2 100644
--- a/src/gtkhex.h
+++ b/src/gtkhex.h
@@ -1,6 +1,6 @@
/* vim: ts=4 sw=4 colorcolumn=80
* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* gtkhex.h - declaration of a GtkHex widget
+/* gtkhex.h - declaration of a HexWidget widget
Copyright © 1997 - 2004 Free Software Foundation
@@ -43,57 +43,57 @@ G_BEGIN_DECLS
typedef enum
{
- GTK_HEX_GROUP_BYTE = 1,
- GTK_HEX_GROUP_WORD = 2,
- GTK_HEX_GROUP_LONG = 4,
- GTK_HEX_GROUP_QUAD = 8
-} GtkHexGroupType;
+ HEX_WIDGET_GROUP_BYTE = 1,
+ HEX_WIDGET_GROUP_WORD = 2,
+ HEX_WIDGET_GROUP_LONG = 4,
+ HEX_WIDGET_GROUP_QUAD = 8
+} HexWidgetGroupType;
/* GOBJECT DECLARATION */
-#define GTK_TYPE_HEX (gtk_hex_get_type ())
-G_DECLARE_FINAL_TYPE(GtkHex, gtk_hex, GTK, HEX, GtkWidget)
+#define HEX_TYPE_WIDGET (hex_widget_get_type ())
+G_DECLARE_FINAL_TYPE(HexWidget, hex_widget, HEX, WIDGET, GtkWidget)
/* OPAQUE DATATYPES */
-typedef struct _GtkHex_AutoHighlight GtkHex_AutoHighlight;
+typedef struct _HexWidget_AutoHighlight HexWidget_AutoHighlight;
/* PUBLIC METHOD DECLARATIONS */
-GtkWidget *gtk_hex_new (HexDocument *owner);
+GtkWidget *hex_widget_new (HexDocument *owner);
-void gtk_hex_set_cursor (GtkHex *gh, gint64 index);
-void gtk_hex_set_cursor_by_row_and_col (GtkHex *gh, int col_x, gint64 line_y);
-void gtk_hex_set_nibble (GtkHex *gh, gboolean lower_nibble);
+void hex_widget_set_cursor (HexWidget *gh, gint64 index);
+void hex_widget_set_cursor_by_row_and_col (HexWidget *gh, int col_x, gint64 line_y);
+void hex_widget_set_nibble (HexWidget *gh, gboolean lower_nibble);
-gint64 gtk_hex_get_cursor (GtkHex *gh);
-guchar gtk_hex_get_byte (GtkHex *gh, gint64 offset);
+gint64 hex_widget_get_cursor (HexWidget *gh);
+guchar hex_widget_get_byte (HexWidget *gh, gint64 offset);
-void gtk_hex_set_group_type (GtkHex *gh, GtkHexGroupType gt);
-GtkHexGroupType gtk_hex_get_group_type (GtkHex *gh);
+void hex_widget_set_group_type (HexWidget *gh, HexWidgetGroupType gt);
+HexWidgetGroupType hex_widget_get_group_type (HexWidget *gh);
-void gtk_hex_show_offsets (GtkHex *gh, gboolean show);
+void hex_widget_show_offsets (HexWidget *gh, gboolean show);
-gboolean gtk_hex_get_insert_mode (GtkHex *gh);
-void gtk_hex_set_insert_mode (GtkHex *gh, gboolean insert);
+gboolean hex_widget_get_insert_mode (HexWidget *gh);
+void hex_widget_set_insert_mode (HexWidget *gh, gboolean insert);
-void gtk_hex_set_geometry (GtkHex *gh, int cpl, int vis_lines);
+void hex_widget_set_geometry (HexWidget *gh, int cpl, int vis_lines);
-void gtk_hex_copy_to_clipboard (GtkHex *gh);
-void gtk_hex_cut_to_clipboard (GtkHex *gh);
-void gtk_hex_paste_from_clipboard (GtkHex *gh);
+void hex_widget_copy_to_clipboard (HexWidget *gh);
+void hex_widget_cut_to_clipboard (HexWidget *gh);
+void hex_widget_paste_from_clipboard (HexWidget *gh);
-void gtk_hex_set_selection (GtkHex *gh, gint64 start, gint64 end);
-gboolean gtk_hex_get_selection (GtkHex *gh, gint64 *start, gint64 *end);
-void gtk_hex_clear_selection (GtkHex *gh);
-void gtk_hex_delete_selection (GtkHex *gh);
+void hex_widget_set_selection (HexWidget *gh, gint64 start, gint64 end);
+gboolean hex_widget_get_selection (HexWidget *gh, gint64 *start, gint64 *end);
+void hex_widget_clear_selection (HexWidget *gh);
+void hex_widget_delete_selection (HexWidget *gh);
-GtkHex_AutoHighlight *
-gtk_hex_insert_autohighlight (GtkHex *gh, const char *search, int len);
-void gtk_hex_delete_autohighlight (GtkHex *gh, GtkHex_AutoHighlight *ahl);
+HexWidget_AutoHighlight *
+hex_widget_insert_autohighlight (HexWidget *gh, const char *search, int len);
+void hex_widget_delete_autohighlight (HexWidget *gh, HexWidget_AutoHighlight *ahl);
-GtkAdjustment *gtk_hex_get_adjustment(GtkHex *gh);
-HexDocument *gtk_hex_get_document (GtkHex *gh);
+GtkAdjustment *hex_widget_get_adjustment(HexWidget *gh);
+HexDocument *hex_widget_get_document (HexWidget *gh);
G_END_DECLS
diff --git a/src/hex-document.c b/src/hex-document.c
index 0c87b9f..9fb3891 100644
--- a/src/hex-document.c
+++ b/src/hex-document.c
@@ -82,7 +82,7 @@ static guint hex_signals[LAST_SIGNAL];
* HexDocument:
*
* `HexDocument` is an object which allows raw data to be loaded,
- * saved and manipulated, intended primarily to be used with the `GtkHex`
+ * saved and manipulated, intended primarily to be used with the `HexWidget`
* widget.
*/
struct _HexDocument
@@ -941,7 +941,7 @@ hex_document_export_html (HexDocument *doc,
/**
* hex_document_compare_data:
* @doc: a [class@Hex.Document] object
- * @what: (array length=len) a pointer to the data to compare to data within
+ * @what: (array length=len): a pointer to the data to compare to data within
* the #HexDocument
* @pos: offset position of the #HexDocument data to compare with @what
* @len: size of the #HexDocument data to compare with @what, in bytes
@@ -972,7 +972,7 @@ hex_document_compare_data (HexDocument *doc,
* hex_document_find_forward:
* @doc: a [class@Hex.Document] object
* @start: starting offset byte of the payload to commence the search
- * @what: (array length=len) a pointer to the data to search within the
+ * @what: (array length=len): a pointer to the data to search within the
* #HexDocument
* @len: length in bytes of the data to be searched for
* @offset: (out): offset of the found string, if the method returns %TRUE
@@ -1049,7 +1049,7 @@ hex_document_find_forward_thread (GTask *task,
* hex_document_find_forward_async:
* @doc: a [class@Hex.Document] object
* @start: starting offset byte of the payload to commence the search
- * @what: (array length=len) a pointer to the data to search within the
+ * @what: (array length=len): a pointer to the data to search within the
* #HexDocument
* @len: length in bytes of the data to be searched for
* @offset: (out): offset of the found string, if the method returns %TRUE
@@ -1095,7 +1095,7 @@ hex_document_find_forward_async (HexDocument *doc,
* hex_document_find_backward:
* @doc: a [class@Hex.Document] object
* @start: starting offset byte of the payload to commence the search
- * @what: (array length=len) a pointer to the data to search within the
+ * @what: (array length=len): a pointer to the data to search within the
* #HexDocument
* @len: length in bytes of the data to be searched for
* @offset: (out): offset of the found string, if the method returns %TRUE
@@ -1150,7 +1150,7 @@ hex_document_find_backward_thread (GTask *task,
* hex_document_find_backward_async:
* @doc: a [class@Hex.Document] object
* @start: starting offset byte of the payload to commence the search
- * @what: (array length=len) a pointer to the data to search within the
+ * @what: (array length=len): a pointer to the data to search within the
* #HexDocument
* @len: length in bytes of the data to be searched for
* @offset: (out): offset of the found string, if the method returns %TRUE
diff --git a/src/hex-document.h b/src/hex-document.h
index de39d62..3ab1a6d 100644
--- a/src/hex-document.h
+++ b/src/hex-document.h
@@ -59,7 +59,7 @@ typedef enum
* HexDocumentFindData:
* @found: whether the string was found
* @start: start offset of the payload, in bytes
- * @what: (array length=len) a pointer to the data to search within the
+ * @what: (array length=len): a pointer to the data to search within the
* #HexDocument
* @len: length in bytes of the data to be searched for
* @offset: offset of the found string
diff --git a/src/meson.build b/src/meson.build
index 5d17a8e..f302448 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -129,8 +129,6 @@ if generate_gir
gtkhex_gir_sources = [
'gtkhex.c',
'gtkhex.h',
- ]
- hexdocument_gir_sources = [
'hex-document.c',
'hex-document.h',
'hex-buffer-iface.c',
@@ -142,21 +140,7 @@ if generate_gir
]
gtkhex_gir = gnome.generate_gir(libgtkhex,
- sources: gtkhex_gir_sources,
- nsversion: libgtkhex_version_major.to_string(),
- namespace: 'Gtk',
- symbol_prefix: 'gtk',
- link_with: libgtkhex,
- dependencies: libgtkhex_deps,
- includes: [ 'Gtk-4.0' ],
- install: true,
- install_dir_gir: ghex_girdir,
- install_dir_typelib: ghex_typelibdir,
- extra_args: [ '--warn-all' ],
- )
-
- hexdocument_gir = gnome.generate_gir(libgtkhex,
- sources: hexdocument_gir_sources,
+ sources: gtkhex_gir_sources,
nsversion: libgtkhex_version_major.to_string(),
namespace: 'Hex',
symbol_prefix: 'hex',
diff --git a/src/paste-special.c b/src/paste-special.c
index beea8d1..9832d3c 100644
--- a/src/paste-special.c
+++ b/src/paste-special.c
@@ -88,7 +88,7 @@ static void destroy_paste_special_dialog (void);
static GtkBuilder *builder;
static GHexApplicationWindow *app_window;
static GdkClipboard *clipboard;
-static GtkHexPasteData *hex_paste_data;
+static HexPasteData *hex_paste_data;
static GHashTable *mime_hash;
static GSList *known_mime[LAST_MIME];
static GtkWidget *hex_paste_data_label;
@@ -150,7 +150,7 @@ mime_sub_type_label_new (KnownMimeType *known_type)
/* PRIVATE FUNCTIONS */
-/* Note - I looked into reusing the hex block formatting code from GtkHex,
+/* Note - I looked into reusing the hex block formatting code from HexWidget,
* but honestly, it looks like it'd be more trouble than it's worth.
*/
static char *
@@ -161,11 +161,11 @@ hex_paste_data_to_delimited_hex (void)
int elems;
char *ret_str;
- g_return_val_if_fail (GTK_IS_HEX_PASTE_DATA (hex_paste_data), NULL);
+ g_return_val_if_fail (HEX_IS_PASTE_DATA (hex_paste_data), NULL);
buf = g_string_new (NULL);
- doc_data = gtk_hex_paste_data_get_doc_data (hex_paste_data);
- elems = gtk_hex_paste_data_get_elems (hex_paste_data);
+ doc_data = hex_paste_data_get_doc_data (hex_paste_data);
+ elems = hex_paste_data_get_elems (hex_paste_data);
for (int i = 0; i < elems; ++i)
{
@@ -230,7 +230,7 @@ delimited_paste_received_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
- GtkHex *gh;
+ HexWidget *gh;
HexDocument *doc;
char *text;
GString *buf = NULL;
@@ -254,13 +254,13 @@ delimited_paste_received_cb (GObject *source_object,
}
gh = ghex_application_window_get_hex (app_window);
- g_return_if_fail (GTK_IS_HEX (gh));
+ g_return_if_fail (HEX_IS_WIDGET (gh));
- doc = gtk_hex_get_document (gh);
+ doc = hex_widget_get_document (gh);
g_return_if_fail (HEX_IS_DOCUMENT (doc));
hex_document_set_data (doc,
- gtk_hex_get_cursor (gh),
+ hex_widget_get_cursor (gh),
buf->len,
0, /* rep_len (0 to insert w/o replacing; what we want) */
buf->str,
@@ -286,14 +286,14 @@ delimited_hex_copy (void)
char *hex_str = NULL;
/* Save selection to clipboard as HexPasteData */
- gtk_hex_copy_to_clipboard (ghex_application_window_get_hex(app_window));
+ hex_widget_copy_to_clipboard (ghex_application_window_get_hex(app_window));
provider = gdk_clipboard_get_content (clipboard);
g_return_if_fail (GDK_IS_CONTENT_PROVIDER(provider));
- g_value_init (&value, GTK_TYPE_HEX_PASTE_DATA);
+ g_value_init (&value, HEX_TYPE_PASTE_DATA);
gdk_content_provider_get_value (provider, &value, &error);
- hex_paste_data = GTK_HEX_PASTE_DATA(g_value_get_object (&value));
+ hex_paste_data = HEX_PASTE_DATA(g_value_get_object (&value));
hex_str = hex_paste_data_to_delimited_hex ();
@@ -318,11 +318,11 @@ row_activated_cb (GtkListBox *box,
gpointer user_data)
{
#define STANDARD_PASTE \
- gtk_hex_paste_from_clipboard \
+ hex_widget_paste_from_clipboard \
(ghex_application_window_get_hex(app_window));
#define STANDARD_COPY \
- gtk_hex_copy_to_clipboard \
+ hex_widget_copy_to_clipboard \
(ghex_application_window_get_hex(app_window));
GtkWidget *child = gtk_list_box_row_get_child (row);
@@ -592,13 +592,13 @@ paste_special_populate_listbox (void)
mime_types = gdk_content_formats_get_mime_types (formats, NULL);
- g_value_init (&value, GTK_TYPE_HEX_PASTE_DATA);
+ g_value_init (&value, HEX_TYPE_PASTE_DATA);
have_hex_paste_data = GDK_IS_CONTENT_PROVIDER (provider) &&
gdk_content_provider_get_value (provider, &value, &error);
if (have_hex_paste_data)
{
- hex_paste_data = GTK_HEX_PASTE_DATA(g_value_get_object (&value));
+ hex_paste_data = HEX_PASTE_DATA(g_value_get_object (&value));
create_hex_paste_data_label ();
diff --git a/src/preferences.c b/src/preferences.c
index 9d94ea8..fb01845 100644
--- a/src/preferences.c
+++ b/src/preferences.c
@@ -350,16 +350,16 @@ setup_signals (void)
/* group type checkbuttons */
g_signal_connect (bytes_chkbtn, "toggled",
- G_CALLBACK(group_type_set_cb), GINT_TO_POINTER(GTK_HEX_GROUP_BYTE));
+ G_CALLBACK(group_type_set_cb), GINT_TO_POINTER(HEX_WIDGET_GROUP_BYTE));
g_signal_connect (words_chkbtn, "toggled",
- G_CALLBACK(group_type_set_cb), GINT_TO_POINTER(GTK_HEX_GROUP_WORD));
+ G_CALLBACK(group_type_set_cb), GINT_TO_POINTER(HEX_WIDGET_GROUP_WORD));
g_signal_connect (long_chkbtn, "toggled",
- G_CALLBACK(group_type_set_cb), GINT_TO_POINTER(GTK_HEX_GROUP_LONG));
+ G_CALLBACK(group_type_set_cb), GINT_TO_POINTER(HEX_WIDGET_GROUP_LONG));
g_signal_connect (quad_chkbtn, "toggled",
- G_CALLBACK(group_type_set_cb), GINT_TO_POINTER(GTK_HEX_GROUP_QUAD));
+ G_CALLBACK(group_type_set_cb), GINT_TO_POINTER(HEX_WIDGET_GROUP_QUAD));
/* show offsets checkbutton */
@@ -426,22 +426,22 @@ grab_widget_values_from_settings (void)
/* group_type radio buttons
*/
switch (def_group_type) {
- case GTK_HEX_GROUP_BYTE:
+ case HEX_WIDGET_GROUP_BYTE:
gtk_check_button_set_active (GTK_CHECK_BUTTON(bytes_chkbtn),
TRUE);
break;
- case GTK_HEX_GROUP_WORD:
+ case HEX_WIDGET_GROUP_WORD:
gtk_check_button_set_active (GTK_CHECK_BUTTON(words_chkbtn),
TRUE);
break;
- case GTK_HEX_GROUP_LONG:
+ case HEX_WIDGET_GROUP_LONG:
gtk_check_button_set_active (GTK_CHECK_BUTTON(long_chkbtn),
TRUE);
break;
- case GTK_HEX_GROUP_QUAD:
+ case HEX_WIDGET_GROUP_QUAD:
gtk_check_button_set_active (GTK_CHECK_BUTTON(quad_chkbtn),
TRUE);
break;
diff --git a/src/print.c b/src/print.c
index ad16f23..bd04222 100644
--- a/src/print.c
+++ b/src/print.c
@@ -211,7 +211,7 @@ static void print_shaded_box (GHexPrintJobInfo *pji, guint row, guint rows)
/**
* ghex_print_job_info_new:
* @doc: Pointer to the HexDocument to be printed.
- * @group_type: How to group bytes, as GtkHexGroupType.
+ * @group_type: How to group bytes, as HexWidgetGroupType.
*
* Return value: A pointer to a newly-created GHexPrintJobInfo object.
* NULL if unable to create.
@@ -219,7 +219,7 @@ static void print_shaded_box (GHexPrintJobInfo *pji, guint row, guint rows)
* Creates a new GHexPrintJobInfo object.
**/
GHexPrintJobInfo *
-ghex_print_job_info_new (HexDocument *doc, GtkHexGroupType group_type)
+ghex_print_job_info_new (HexDocument *doc, HexWidgetGroupType group_type)
{
GHexPrintJobInfo *pji;
PangoFontDescription *d_font;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]