[ghex] UI: fix some GTK4/libadwaita papercuts
- From: Logan Rathbone <larathbone src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ghex] UI: fix some GTK4/libadwaita papercuts
- Date: Tue, 21 Jun 2022 18:30:00 +0000 (UTC)
commit aa38d084680b077bbba07c9825d24d7f984c52be
Author: Logan Rathbone <poprocks gmail com>
Date: Tue Jun 21 02:59:31 2022 -0400
UI: fix some GTK4/libadwaita papercuts
See #48
Next step is to port prefs dialog to AdwPreferencesWindow
src/chartable.c | 17 ++--
src/common-ui.c | 6 +-
src/configuration.c | 4 +-
src/configuration.h | 2 +-
src/converter.c | 1 +
src/find-dialog.ui | 17 +++-
src/findreplace.c | 43 ++++----
src/ghex-application-window.c | 76 +++++++++------
src/ghex-application-window.ui.in | 199 +++++++++++++++++++-------------------
src/ghex.css | 74 +++++++-------
src/ghex.gresource.xml.in | 3 +
src/gtkhex.c | 2 +-
src/gtkhex.css | 59 +++++++++++
src/jump-dialog.ui | 6 +-
src/libgtkhex.gresource.xml.in | 2 +-
src/replace-dialog.ui | 13 ++-
16 files changed, 309 insertions(+), 215 deletions(-)
---
diff --git a/src/chartable.c b/src/chartable.c
index 86c904d..1701c7d 100644
--- a/src/chartable.c
+++ b/src/chartable.c
@@ -10,7 +10,7 @@
to maintain the source code under the licensing terms described
herein and below.
- Copyright © 2021 Logan Rathbone <poprocks gmail com>
+ Copyright © 2021-2022 Logan Rathbone <poprocks gmail com>
GHex is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -138,13 +138,13 @@ hide_chartable_cb (GtkButton *button, gpointer user_data)
gtk_window_close (win);
}
-GtkWidget *create_char_table(GtkWindow *parent_win, HexWidget *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"),
N_("Octal"), N_("Binary") };
gchar *real_titles[5];
- GtkWidget *ct, *sw, *ctv, *inbtn, *cbtn, *vbox, *hbox, *lbl;
+ GtkWidget *ct, *sw, *ctv, *inbtn, *cbtn, *vbox, *hbox, *lbl, *sep;
GtkListStore *store;
GtkCellRenderer *cell_renderer;
GtkTreeViewColumn *column;
@@ -247,17 +247,22 @@ GtkWidget *create_char_table(GtkWindow *parent_win, HexWidget *gh)
lbl = gtk_label_new ("");
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+ gtk_widget_set_name (hbox, "chartable-action-area");
+
+ sep = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_box_append (GTK_BOX(vbox), sw);
gtk_box_append (GTK_BOX(hbox), lbl);
gtk_box_append (GTK_BOX(hbox), inbtn);
gtk_box_append (GTK_BOX(hbox), cbtn);
+
+ gtk_box_append (GTK_BOX(vbox), sw);
+ gtk_box_append (GTK_BOX(vbox), sep);
gtk_box_append (GTK_BOX(vbox), hbox);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW(sw), ctv);
- gtk_window_set_child (GTK_WINDOW (ct), vbox);
+ gtk_window_set_child (GTK_WINDOW(ct), vbox);
- gtk_widget_set_size_request(ct, 320, 320);
+ gtk_widget_set_size_request (ct, 320, 320);
return ct;
}
diff --git a/src/common-ui.c b/src/common-ui.c
index 3ad1b0e..9a3f00f 100644
--- a/src/common-ui.c
+++ b/src/common-ui.c
@@ -182,7 +182,7 @@ set_css_provider_font_from_settings (void)
desc = pango_font_description_from_string (def_font_name);
css_str = pango_font_description_to_css (desc, ".hex");
- gtk_css_provider_load_from_data (provider,
+ gtk_css_provider_load_from_data (global_provider,
css_str, -1);
g_free (css_str);
}
@@ -191,13 +191,13 @@ void
common_set_gtkhex_font_from_settings (HexWidget *gh)
{
g_return_if_fail (HEX_IS_WIDGET(gh));
- g_return_if_fail (GTK_IS_STYLE_PROVIDER(provider));
+ g_return_if_fail (GTK_IS_STYLE_PROVIDER(global_provider));
/* Ensure global provider and settings are in sync font-wise. */
set_css_provider_font_from_settings ();
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
- GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER (global_provider),
GTK_STYLE_PROVIDER_PRIORITY_SETTINGS);
}
diff --git a/src/configuration.c b/src/configuration.c
index 032fa86..56dbf28 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -36,7 +36,7 @@
GSettings *settings;
/* Global CSS provider for our HexWidget widgets */
-GtkCssProvider *provider;
+GtkCssProvider *global_provider;
int def_group_type;
char *def_font_name;
@@ -173,5 +173,5 @@ void ghex_init_configuration ()
/* Global CSS provider */
- provider = gtk_css_provider_new ();
+ global_provider = gtk_css_provider_new ();
}
diff --git a/src/configuration.h b/src/configuration.h
index ffea2a8..e8eedc8 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -65,7 +65,7 @@ extern int def_group_type;
extern int def_dark_mode;
extern GSettings *settings;
-extern GtkCssProvider *provider;
+extern GtkCssProvider *global_provider;
/* Initializes the gsettings client */
void ghex_init_configuration (void);
diff --git a/src/converter.c b/src/converter.c
index 932544d..4398c1c 100644
--- a/src/converter.c
+++ b/src/converter.c
@@ -197,6 +197,7 @@ GtkWidget *create_converter (GtkWindow *parent_win, /* can-NULL */
G_CALLBACK(close_converter), conv->window);
grid = gtk_grid_new ();
+ gtk_widget_set_name (grid, "converter-grid");
gtk_grid_set_row_spacing (GTK_GRID (grid), 4);
gtk_grid_set_column_spacing (GTK_GRID (grid), 4);
gtk_box_append (GTK_BOX(gtk_dialog_get_content_area (GTK_DIALOG(conv->window))),
diff --git a/src/find-dialog.ui b/src/find-dialog.ui
index dbf3763..a44f28b 100644
--- a/src/find-dialog.ui
+++ b/src/find-dialog.ui
@@ -29,15 +29,27 @@
<child><object class="GtkBox" id="vbox">
<property name="orientation">vertical</property>
- <child><object class="GtkFrame" id="frame">
- <property name="label" translatable="yes">Find
String</property>
+ <child><object class="GtkBox" id="find_frame">
+ <property name="orientation">vertical</property>
+ <style>
+ <class name="findreplace-frame" />
+ </style>
<accessibility>
<property name="description" translatable="yes">Enter
the hex data or ASCII data to search for</property>
</accessibility>
+ <child><object class="GtkLabel" id="find_string_label">
+ <property name="label"
translatable="yes">Find String</property>
+ <property name="use-markup">true</property>
+ <property name="halign">start</property>
+ <property name="hexpand">true</property>
+ <property name="visible">false</property>
+ </object></child>
</object></child>
<child><object class="GtkBox" id="hbox">
+ <property name="name">findreplace-buttonbox</property>
<property name="orientation">horizontal</property>
+ <property name="spacing">6</property>
<child><object class="GtkButton" id="f_next">
<property name="label"
translatable="yes">Find _Next</property>
@@ -68,6 +80,7 @@
<property name="hexpand">true</property>
<property name="halign">end</property>
<property
name="icon-name">emblem-system-symbolic</property>
+ <property name="has-frame">false</property>
<accessibility>
<property name="label"
translatable="yes">Find options</property>
<property name="description"
translatable="yes">View options of the find pane</property>
diff --git a/src/findreplace.c b/src/findreplace.c
index 0233c32..e5596ad 100644
--- a/src/findreplace.c
+++ b/src/findreplace.c
@@ -10,7 +10,7 @@
to maintain the source code under the licensing terms described
herein and below.
- Copyright © 2021 Logan Rathbone <poprocks gmail com>
+ Copyright © 2021-2022 Logan Rathbone <poprocks gmail com>
GHex is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -64,7 +64,8 @@ G_DEFINE_TYPE_WITH_PRIVATE (PaneDialog, pane_dialog, GTK_TYPE_WIDGET)
typedef struct {
HexDocument *f_doc;
GtkWidget *f_gh;
- GtkWidget *frame;
+ GtkWidget *find_frame;
+ GtkWidget *find_string_label;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *f_next, *f_prev, *f_clear;
@@ -421,7 +422,9 @@ find_clear_cb (GtkButton *button, gpointer user_data)
new_doc = hex_document_new ();
new_gh = create_hex_view (new_doc);
- gtk_frame_set_child (GTK_FRAME(f_priv->frame), new_gh);
+ gtk_box_remove (GTK_BOX(f_priv->find_frame),
+ gtk_widget_get_last_child (f_priv->find_frame));
+ gtk_box_append (GTK_BOX(f_priv->find_frame), new_gh);
f_priv->f_doc = new_doc;
f_priv->f_gh = new_gh;
@@ -666,7 +669,9 @@ replace_clear_cb (GtkButton *button, gpointer user_data)
new_r_doc = hex_document_new ();
new_r_gh = create_hex_view (new_r_doc);
- gtk_frame_set_child (GTK_FRAME(self->r_frame), new_r_gh);
+ gtk_box_remove (GTK_BOX(self->r_frame),
+ gtk_widget_get_last_child (self->r_frame));
+ gtk_box_append (GTK_BOX(self->r_frame), new_r_gh);
self->r_doc = new_r_doc;
self->r_gh = new_r_gh;
@@ -827,7 +832,7 @@ find_dialog_init (FindDialog *self)
/* Setup HexWidget and make child of our frame */
f_priv->f_doc = hex_document_new ();
f_priv->f_gh = create_hex_view (f_priv->f_doc);
- gtk_frame_set_child (GTK_FRAME(f_priv->frame), f_priv->f_gh);
+ gtk_box_append (GTK_BOX(f_priv->find_frame), f_priv->f_gh);
/* Setup find options popover as child of our options menubutton */
builder = gtk_builder_new_from_resource (RESOURCE_BASE_PATH "/find-options.ui");
@@ -903,7 +908,9 @@ find_dialog_class_init (FindDialogClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, FindDialog,
vbox);
gtk_widget_class_bind_template_child_private (widget_class, FindDialog,
- frame);
+ find_frame);
+ gtk_widget_class_bind_template_child_private (widget_class, FindDialog,
+ find_string_label);
gtk_widget_class_bind_template_child_private (widget_class, FindDialog,
hbox);
gtk_widget_class_bind_template_child_private (widget_class, FindDialog,
@@ -941,9 +948,11 @@ replace_dialog_init (ReplaceDialog *self)
*/
builder = gtk_builder_new_from_resource (RESOURCE_BASE_PATH "/replace-dialog.ui");
+ gtk_widget_set_visible (f_priv->find_string_label, TRUE);
+
self->r_frame = GTK_WIDGET(gtk_builder_get_object (builder, "r_frame"));
- gtk_frame_set_child (GTK_FRAME(self->r_frame), self->r_gh);
- gtk_box_insert_child_after (GTK_BOX(f_priv->vbox), self->r_frame, f_priv->frame);
+ gtk_box_append (GTK_BOX(self->r_frame), self->r_gh);
+ gtk_box_insert_child_after (GTK_BOX(f_priv->vbox), self->r_frame, f_priv->find_frame);
self->replace = GTK_WIDGET(gtk_builder_get_object (builder, "replace"));
gtk_box_insert_child_after (GTK_BOX(f_priv->hbox), self->replace, f_priv->f_prev);
@@ -995,24 +1004,6 @@ static void
jump_dialog_init (JumpDialog *self)
{
GtkWidget *widget = GTK_WIDGET(self);
- GtkStyleContext *context;
- GtkCssProvider *provider;
-
- /* CSS */
-
- context = gtk_widget_get_style_context (widget);
- provider = gtk_css_provider_new ();
-
- gtk_css_provider_load_from_data (provider,
- JUMP_DIALOG_CSS_NAME " {\n"
- " padding-left: 20px;\n"
- " padding-top: 6px;\n"
- " padding-bottom: 6px;\n"
- "}\n", -1);
-
- gtk_style_context_add_provider (context,
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_SETTINGS);
/* Widget - template, signals, etc. */
diff --git a/src/ghex-application-window.c b/src/ghex-application-window.c
index 91da0e4..9ef0bed 100644
--- a/src/ghex-application-window.c
+++ b/src/ghex-application-window.c
@@ -64,7 +64,6 @@ struct _GHexApplicationWindow
HexWidget *gh;
HexDialog *dialog;
GtkWidget *dialog_widget;
- GtkCssProvider *conversions_box_provider;
GtkAdjustment *adj;
gboolean can_save;
gboolean insert_mode;
@@ -79,15 +78,16 @@ struct _GHexApplicationWindow
GtkWidget *copy_special_dialog;
/* From GtkBuilder: */
+ GtkWidget *headerbar_window_title;
GtkWidget *no_doc_label;
- GtkWidget *tab_view_box;
+ GtkWidget *child_box;
GtkWidget *hex_tab_view;
GtkWidget *conversions_box;
GtkWidget *findreplace_box;
GtkWidget *pane_toggle_button;
GtkWidget *insert_mode_button;
GtkWidget *statusbar;
- GtkWidget *pane_revealer;
+ GtkWidget *findreplace_revealer;
GtkWidget *conversions_revealer;
};
@@ -561,13 +561,13 @@ static void
show_hex_tab_view (GHexApplicationWindow *self)
{
gtk_widget_hide (self->no_doc_label);
- gtk_widget_show (self->tab_view_box);
+ gtk_widget_show (self->child_box);
}
static void
show_no_file_loaded_label (GHexApplicationWindow *self)
{
- gtk_widget_hide (self->tab_view_box);
+ gtk_widget_hide (self->child_box);
gtk_widget_show (self->no_doc_label);
}
@@ -729,8 +729,10 @@ pane_close_cb (PaneDialog *pane, gpointer user_data)
if (ACTIVE_GH)
gtk_widget_grab_focus (GTK_WIDGET(ACTIVE_GH));
- gtk_revealer_set_transition_type (GTK_REVEALER(self->pane_revealer),
GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
- gtk_revealer_set_reveal_child (GTK_REVEALER(self->pane_revealer), FALSE);
+ gtk_revealer_set_transition_type (GTK_REVEALER(self->findreplace_revealer),
+ GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
+ gtk_revealer_set_reveal_child (GTK_REVEALER(self->findreplace_revealer),
+ FALSE);
g_object_notify_by_pspec (G_OBJECT(self), properties[PROP_FIND_OPEN]);
g_object_notify_by_pspec (G_OBJECT(self), properties[PROP_REPLACE_OPEN]);
@@ -790,22 +792,43 @@ update_titlebar (GHexApplicationWindow *self)
adw_tab_view_get_n_pages (ADW_TAB_VIEW(self->hex_tab_view)))
{
char *basename;
+ char *pathname = NULL;
char *title;
HexDocument *doc = hex_widget_get_document (ACTIVE_GH);
if (G_IS_FILE (file = hex_document_get_file (doc)))
+ {
+ GFile *parent = g_file_get_parent (file);
+
basename = g_file_get_basename (file);
+ if (parent)
+ pathname = g_file_get_path (parent);
+
+ g_clear_object (&parent);
+ }
else
+ {
basename = g_strdup (_(UNTITLED_STRING));
+ }
+
+ adw_window_title_set_title (
+ ADW_WINDOW_TITLE(self->headerbar_window_title), basename);
+ adw_window_title_set_subtitle (
+ ADW_WINDOW_TITLE(self->headerbar_window_title), pathname);
title = g_strdup_printf ("%s - GHex", basename);
gtk_window_set_title (GTK_WINDOW(self), title);
g_free (basename);
g_free (title);
+ g_free (pathname);
}
else
{
+ adw_window_title_set_title (
+ ADW_WINDOW_TITLE(self->headerbar_window_title), "GHex");
+ adw_window_title_set_subtitle (
+ ADW_WINDOW_TITLE(self->headerbar_window_title), NULL);
gtk_window_set_title (GTK_WINDOW(self), "GHex");
}
}
@@ -893,11 +916,11 @@ ghex_application_window_set_show_ ##WIDGET (GHexApplicationWindow *self,
\
gtk_widget_hide (self->OTHER2 ## _dialog);
\
gtk_widget_show (self->WIDGET ## _dialog);
\
gtk_widget_grab_focus (self->WIDGET ## _dialog);
\
- if (! gtk_revealer_get_reveal_child (GTK_REVEALER(self->pane_revealer))) \
+ if (! gtk_revealer_get_reveal_child (GTK_REVEALER(self->findreplace_revealer))) \
{
\
- gtk_revealer_set_transition_type (GTK_REVEALER(self->pane_revealer), \
+ gtk_revealer_set_transition_type (GTK_REVEALER(self->findreplace_revealer), \
GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP);
\
- gtk_revealer_set_reveal_child (GTK_REVEALER(self->pane_revealer), TRUE);\
+ gtk_revealer_set_reveal_child (GTK_REVEALER(self->findreplace_revealer), TRUE); \
}
\
g_object_notify_by_pspec (G_OBJECT(self), properties[PROP_FIND_OPEN]); \
g_object_notify_by_pspec (G_OBJECT(self), properties[PROP_REPLACE_OPEN]); \
@@ -1406,7 +1429,7 @@ get_pane_visible (GHexApplicationWindow *self, PaneDialog *pane)
{
return (GTK_IS_WIDGET(GTK_WIDGET(pane)) &&
gtk_widget_get_visible (GTK_WIDGET(pane)) &&
- gtk_revealer_get_reveal_child (GTK_REVEALER(self->pane_revealer)));
+ gtk_revealer_get_reveal_child (GTK_REVEALER(self->findreplace_revealer)));
}
/* PROPERTIES */
@@ -1520,6 +1543,7 @@ ghex_application_window_init (GHexApplicationWindow *self)
GtkWidget *widget = GTK_WIDGET(self);
GtkStyleContext *context;
GAction *action;
+ GtkCssProvider *provider;
gtk_widget_init_template (widget);
@@ -1529,21 +1553,6 @@ ghex_application_window_init (GHexApplicationWindow *self)
gtk_box_append (GTK_BOX(self->conversions_box), self->dialog_widget);
- /* CSS - conversions_box */
-
- context = gtk_widget_get_style_context (self->conversions_box);
- self->conversions_box_provider = gtk_css_provider_new ();
-
- gtk_css_provider_load_from_data (self->conversions_box_provider,
- "box {\n"
- " padding: 12px;\n"
- "}\n", -1);
-
- /* add the provider to our widget's style context. */
- gtk_style_context_add_provider (context,
- GTK_STYLE_PROVIDER (self->conversions_box_provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
/* Setup signals */
g_signal_connect (self, "close-request",
@@ -1614,6 +1623,12 @@ ghex_application_window_init (GHexApplicationWindow *self)
/* Grey out save (special case - it's not lumped in with mains */
gtk_widget_action_set_enabled (GTK_WIDGET(self),
"ghex.save", FALSE);
+
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_resource (provider, RESOURCE_BASE_PATH "/css/ghex.css");
+ gtk_style_context_add_provider_for_display (gdk_display_get_default (),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
static void
@@ -1631,9 +1646,6 @@ ghex_application_window_dispose(GObject *object)
g_clear_pointer (&self->chartable, gtk_widget_unparent);
g_clear_pointer (&self->converter, gtk_widget_unparent);
- /* Clear conversions box CSS provider */
- g_clear_object (&self->conversions_box_provider);
-
/* Boilerplate: chain up
*/
G_OBJECT_CLASS(ghex_application_window_parent_class)->dispose(object);
@@ -1899,10 +1911,12 @@ ghex_application_window_class_init(GHexApplicationWindowClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
RESOURCE_BASE_PATH "/ghex-application-window.ui");
+ gtk_widget_class_bind_template_child (widget_class, GHexApplicationWindow,
+ headerbar_window_title);
gtk_widget_class_bind_template_child (widget_class, GHexApplicationWindow,
no_doc_label);
gtk_widget_class_bind_template_child (widget_class, GHexApplicationWindow,
- tab_view_box);
+ child_box);
gtk_widget_class_bind_template_child (widget_class, GHexApplicationWindow,
hex_tab_view);
gtk_widget_class_bind_template_child (widget_class, GHexApplicationWindow,
@@ -1916,7 +1930,7 @@ ghex_application_window_class_init(GHexApplicationWindowClass *klass)
gtk_widget_class_bind_template_child (widget_class, GHexApplicationWindow,
statusbar);
gtk_widget_class_bind_template_child (widget_class, GHexApplicationWindow,
- pane_revealer);
+ findreplace_revealer);
gtk_widget_class_bind_template_child (widget_class, GHexApplicationWindow,
conversions_revealer);
}
diff --git a/src/ghex-application-window.ui.in b/src/ghex-application-window.ui.in
index 9b773ac..1a7bdd1 100644
--- a/src/ghex-application-window.ui.in
+++ b/src/ghex-application-window.ui.in
@@ -155,17 +155,26 @@
<object class="GtkBox"> <!-- main vert gtkbox -->
<property name="orientation">vertical</property>
-
<child>
<object class="GtkHeaderBar" id="headerbar">
<property name="show-title-buttons">true</property>
+ <property name="title-widget">
+ <object class="AdwWindowTitle"
id="headerbar_window_title">
+ <property name="title">GHex</property>
+ </object>
+ </property>
<child>
<object class="GtkButton">
- <property name="valign">center</property>
- <property name="label">Open</property>
<property
name="action-name">ghex.open</property>
<property name="tooltip-text"
translatable="yes">Open a file for hex editing</property>
+ <property name="child">
+ <object class="AdwButtonContent">
+ <property
name="label">_Open</property>
+ <property
name="icon-name">document-open-symbolic</property>
+ <property
name="use-underline">True</property>
+ </object>
+ </property>
</object>
</child>
@@ -198,135 +207,123 @@
</object>
</child>
</object> <!-- headerbar -->
- </child> <!-- titlebar -->
-
- <child> <!-- child_box for notebook & content area -->
- <object class="GtkBox" id="child_box">
- <property name="orientation">horizontal</property>
- <property name="homogeneous">false</property>
- <property name="vexpand">true</property>
- <property name="hexpand">true</property>
-
- <child> <!-- label showing no doc loaded -->
- <object class="AdwStatusPage" id="no_doc_label">
- <property name="title" translatable="yes">No
File Loaded</property>
- <property name="child">
- <object class="GtkLabel">
- <property name="label"
translatable="yes">• Press the Open button
+ </child> <!-- headerbar -->
+
+ <child> <!-- label showing no doc loaded -->
+ <object class="AdwStatusPage" id="no_doc_label">
+ <property name="title" translatable="yes">No File
Loaded</property>
+ <property name="child">
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">•
Press the Open button
• Press Ctrl+N to start a new document
• Press Ctrl+O to browse for a document
Or, press Ctrl+W to close the window.</property>
- </object>
- </property>
- <property
name="icon-name">accessories-text-editor-symbolic</property>
- <property name="hexpand">true</property>
- <property name="vexpand">true</property>
</object>
- </child> <!-- /no_doc_label -->
+ </property>
+ <property
name="icon-name">accessories-text-editor-symbolic</property>
+ <property name="hexpand">true</property>
+ <property name="vexpand">true</property>
+ </object>
+ </child> <!-- /no_doc_label -->
- <child> <!-- spinner showing document loading -->
- <object class="GtkSpinner" id="doc_loading_spinner">
- <property name="spinning">true</property>
<!-- doesn't seem to work -->
- <property name="halign">center</property>
- <property name="valign">center</property>
- <property name="hexpand">true</property>
- <property name="vexpand">true</property>
- <!-- invisible by default to show the
no_doc_label -->
- <property name="visible">false</property>
- </object>
- </child> <!-- /doc_loading_spinner -->
+ <child> <!-- child_box for notebook & content area -->
+ <object class="GtkBox" id="child_box">
+ <property name="orientation">vertical</property>
+ <property name="homogeneous">false</property>
+ <property name="vexpand">true</property>
+ <property name="hexpand">true</property>
+ <!-- invisible by default to show the no_doc_label -->
+ <property name="visible">false</property>
<child>
<object class="GtkBox" id="tab_view_box">
<property
name="orientation">vertical</property>
- <!-- invisible by default to show the
no_doc_label -->
- <property name="visible">false</property>
<child>
<object class="AdwTabBar">
<property
name="view">hex_tab_view</property>
</object>
</child>
+ <child> <!-- type="overlay" -->
+ <object class="GtkRevealer"
id="findreplace_revealer">
+ <property
name="name">findreplace-revealer</property>
+ <property
name="transition-type">slide-up</property>
+ <property
name="valign">start</property>
+ <!-- box to put the
`findreplace' dialogs. -->
+ <child>
+ <object
class="GtkBox" id="findreplace_box">
+ <property
name="name">findreplace-box</property>
+ </object>
+ </child>
+ </object>
+ </child>
<child>
<object class="AdwTabView"
id="hex_tab_view">
<property
name="hexpand">true</property>
<property
name="vexpand">true</property>
</object>
</child>
- </object>
- </child> <!-- tab_view_box -->
-
- </object> <!-- child_box -->
- </child> <!-- child_box -->
-
- <!-- "statusbar" separator -->
- <child>
- <object class="GtkSeparator">
- <property name="orientation">horizontal</property>
- </object>
- </child>
-
- <child>
- <object class="GtkRevealer" id="pane_revealer">
- <property name="transition-type">slide-up</property>
- <child> <!-- box to put the `findreplace' dialogs. -->
- <object class="GtkBox" id="findreplace_box" />
+ </object> <!-- tab_view_box -->
</child>
- </object>
- </child>
-
- <!-- "findreplace" separator which comes and goes. -->
- <child>
- <object class="GtkSeparator">
- <property name="orientation">horizontal</property>
- </object>
- </child>
-
- <child>
- <object class="GtkRevealer" id="conversions_revealer">
- <property name="transition-type">slide-up</property>
- <child> <!-- box just to put the conversions_pane; APPEND -->
- <object class="GtkBox" id="conversions_box" />
- </child>
- </object>
- </child>
-
- <child> <!-- status_box -->
- <object class="GtkBox" id="status_box">
- <property name="orientation">horizontal</property>
- <property name="homogeneous">false</property>
-
<child>
- <object class="HexStatusbar" id="statusbar">
- <property name="hexpand">true</property>
+ <object class="GtkSeparator">
+ <property
name="orientation">horizontal</property>
</object>
</child>
- <child> <!-- insert_mode_button -->
- <object class="GtkToggleButton"
id="insert_mode_button">
- <property name="valign">center</property>
- <property name="halign">end</property>
- <property
name="icon-name">insert-text-symbolic</property>
- <property
name="action-name">ghex.insert-mode</property>
- <property name="tooltip-text"
translatable="yes">Toggle insert mode (add data to file rather than replace existing data)</property>
- </object>
- </child> <!-- insert_mode_button -->
-
- <!-- pane toggle btn -->
<child>
- <object class="GtkButton" id="pane_toggle_button">
- <property name="valign">center</property>
- <property name="halign">end</property>
- <property
name="icon-name">pan-up-symbolic</property>
- <property name="has-frame">false</property>
- <property
name="action-name">ghex.show-conversions</property>
- <property name="tooltip-text"
translatable="yes">Toggle a pane showing various numeric conversions</property>
+ <object class="GtkRevealer" id="conversions_revealer">
+ <property
name="transition-type">slide-up</property>
+ <child> <!-- box just to put the
conversions_pane; APPEND -->
+ <object class="GtkBox"
id="conversions_box">
+ <property
name="name">conversions-box</property>
+ </object>
+ </child>
</object>
</child>
- </object> <!-- status_box -->
- </child> <!-- status_box -->
+ <child> <!-- status_box -->
+ <object class="GtkBox" id="status_box">
+ <property name="name">status-box</property>
+ <property
name="orientation">horizontal</property>
+ <property name="homogeneous">false</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <object class="HexStatusbar"
id="statusbar">
+ <property
name="hexpand">true</property>
+ </object>
+ </child>
+
+ <child> <!-- insert_mode_button -->
+ <object class="GtkToggleButton"
id="insert_mode_button">
+ <property
name="valign">center</property>
+ <property
name="halign">end</property>
+ <property
name="icon-name">insert-text-symbolic</property>
+ <property
name="has-frame">false</property>
+ <property
name="action-name">ghex.insert-mode</property>
+ <property name="tooltip-text"
translatable="yes">Toggle insert mode (add data to file rather than replace existing data)</property>
+ </object>
+ </child> <!-- insert_mode_button -->
+
+ <!-- pane toggle btn -->
+ <child>
+ <object class="GtkButton"
id="pane_toggle_button">
+ <property
name="valign">center</property>
+ <property
name="halign">end</property>
+ <property
name="icon-name">pan-up-symbolic</property>
+ <property
name="has-frame">false</property>
+ <property
name="action-name">ghex.show-conversions</property>
+ <property name="tooltip-text"
translatable="yes">Toggle a pane showing various numeric conversions</property>
+ </object>
+ </child>
+
+ </object> <!-- status_box -->
+ </child> <!-- status_box -->
+
+ </object> <!-- child_box -->
+ </child> <!-- child_box -->
</object> <!-- main vert gtkbox -->
</child> <!-- main vert gtkbox -->
diff --git a/src/ghex.css b/src/ghex.css
index 1b6c530..2682f89 100644
--- a/src/ghex.css
+++ b/src/ghex.css
@@ -1,59 +1,57 @@
-.hex {
- font-family: Monospace;
- font-size: 12pt;
- font-feature-settings: "tnum";
- color: @theme_fg_color;
- background-color: @theme_bg_color;
+/* Status Bar at bottom */
+
+#status-box {
+ padding-top: 4px;
+ padding-bottom: 3px;
}
-/* nb: order matters for the next 2 selectors. */
+/* Find, replace and jump dialogs */
-#hex-display:selected, #ascii-display:selected {
- color: @theme_selected_fg_color;
- background-color: alpha(shade(@theme_selected_bg_color, 0), 0.2);
+#findreplace-buttonbox {
+ padding-top: 6px;
+ padding-bottom: 6px;
}
-#hex-display:focus-within, #ascii-display:focus-within {
- color: @theme_selected_fg_color;
- background-color: @theme_selected_bg_color;
+#findreplace-box {
+ background: @popover_bg_color;
+ color: @popover_fg_color;
+ padding: 6px;
+ border-bottom: @borders solid 1px;
}
-/* ---- */
-
-.hex:link {
- background-color: alpha(red, 0.5);
+.findreplace-frame label {
+ padding-left: 12px;
+ padding-bottom: 2px;
+ font-size: small;
}
-.hex:checked {
- color: @theme_bg_color;
- background-color: alpha(@theme_fg_color, 0.9);
+.findreplace-frame hexwidget {
+ border-top: shade(@theme_bg_color, 0.9) 1px dashed;
+ border-bottom: shade(@theme_bg_color, 0.9) 1px dashed;
}
-.hex #offsets {
- padding-top: 6px;
- padding-left: 12px;
- padding-right: 12px;
- border-right: solid @borders 2px;
- background-color: shade(@theme_bg_color, 0.9);
+jumpdialog {
+ padding-left: 12px;
}
-.hex #hex-display {
- padding-top: 6px;
- padding-left: 12px;
- border-right: dotted 2px @borders;
+jumpdialog entry {
+ font-family: monospace;
}
-.hex #ascii-display {
- padding-top: 6px;
- padding-left: 12px;
+/* Conversions pane/box */
+
+#conversions-box {
+ padding: 12px;
}
-.hex scrollbar {
- opacity: 0.25;
- transition: opacity 300ms ease;
+/* Character table */
+#chartable-action-area {
+ padding: 6px;
}
-.hex scrollbar:hover {
- opacity: 1.0;
+/* Base converter */
+
+#converter-grid {
+ padding: 6px;
}
diff --git a/src/ghex.gresource.xml.in b/src/ghex.gresource.xml.in
index 020f256..512f174 100644
--- a/src/ghex.gresource.xml.in
+++ b/src/ghex.gresource.xml.in
@@ -33,6 +33,9 @@
<file preprocess="xml-stripblanks" compressed="true">jump-dialog.ui</file>
<file preprocess="xml-stripblanks" compressed="true">find-options.ui</file>
</gresource>
+ <gresource prefix="@resource_base_path@/css">
+ <file>ghex.css</file>
+ </gresource>
<gresource prefix="@resource_base_path@/gtk">
<file preprocess="xml-stripblanks">help-overlay.ui</file>
</gresource>
diff --git a/src/gtkhex.c b/src/gtkhex.c
index 6913524..a104966 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -2720,7 +2720,7 @@ hex_widget_init (HexWidget *self)
self->provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (self->provider),
- RESOURCE_BASE_PATH "/css/ghex.css");
+ RESOURCE_BASE_PATH "/css/gtkhex.css");
gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER (self->provider),
GTK_STYLE_PROVIDER_PRIORITY_THEME);
diff --git a/src/gtkhex.css b/src/gtkhex.css
new file mode 100644
index 0000000..1b6c530
--- /dev/null
+++ b/src/gtkhex.css
@@ -0,0 +1,59 @@
+.hex {
+ font-family: Monospace;
+ font-size: 12pt;
+ font-feature-settings: "tnum";
+ color: @theme_fg_color;
+ background-color: @theme_bg_color;
+}
+
+/* nb: order matters for the next 2 selectors. */
+
+#hex-display:selected, #ascii-display:selected {
+ color: @theme_selected_fg_color;
+ background-color: alpha(shade(@theme_selected_bg_color, 0), 0.2);
+}
+
+#hex-display:focus-within, #ascii-display:focus-within {
+ color: @theme_selected_fg_color;
+ background-color: @theme_selected_bg_color;
+}
+
+/* ---- */
+
+.hex:link {
+ background-color: alpha(red, 0.5);
+}
+
+.hex:checked {
+ color: @theme_bg_color;
+ background-color: alpha(@theme_fg_color, 0.9);
+}
+
+.hex #offsets {
+ padding-top: 6px;
+ padding-left: 12px;
+ padding-right: 12px;
+ border-right: solid @borders 2px;
+ background-color: shade(@theme_bg_color, 0.9);
+}
+
+.hex #hex-display {
+ padding-top: 6px;
+ padding-left: 12px;
+ border-right: dotted 2px @borders;
+}
+
+.hex #ascii-display {
+ padding-top: 6px;
+ padding-left: 12px;
+}
+
+.hex scrollbar {
+ opacity: 0.25;
+ transition: opacity 300ms ease;
+
+}
+
+.hex scrollbar:hover {
+ opacity: 1.0;
+}
diff --git a/src/jump-dialog.ui b/src/jump-dialog.ui
index b9c9111..e8b2a63 100644
--- a/src/jump-dialog.ui
+++ b/src/jump-dialog.ui
@@ -36,6 +36,9 @@
</object></child>
<child><object class="GtkEntry" id="int_entry">
+ <property name="max-length">19</property> <!-- enough chars
for 64-bit offset + 2 for '0x' + 1 for +/- -->
+ <property name="width-chars">19</property>
+ <property name="max-width-chars">20</property>
<accessibility>
<property name="description" translatable="yes">Enter
the offset byte to jump to. The default is decimal format, but other format strings are supported such as
hexidecimal format, if C-style notation using the '0x' prefix is used. If your string is not recognized, a
dialog will be presented explaining the valid formats of strings accepted.</property>
</accessibility>
@@ -45,6 +48,8 @@
<property name="label" translatable="yes">_Jump</property>
<property name="use-underline">true</property>
<property name="receives-default">true</property>
+ <property name="halign">end</property>
+ <property name="hexpand">true</property>
<accessibility>
<property name="description" translatable="yes">Jumps
to the specified byte</property>
</accessibility>
@@ -52,7 +57,6 @@
<child><object class="GtkButton" id="cancel">
<property name="icon-name">window-close-symbolic</property>
- <property name="hexpand">true</property>
<property name="halign">end</property>
<property name="has-frame">false</property>
<accessibility>
diff --git a/src/libgtkhex.gresource.xml.in b/src/libgtkhex.gresource.xml.in
index 72e2622..5d1f812 100644
--- a/src/libgtkhex.gresource.xml.in
+++ b/src/libgtkhex.gresource.xml.in
@@ -28,6 +28,6 @@
<file preprocess="xml-stripblanks" compressed="true">context-menu.ui</file>
</gresource>
<gresource prefix="@resource_base_path@/css">
- <file>ghex.css</file>
+ <file>gtkhex.css</file>
</gresource>
</gresources>
diff --git a/src/replace-dialog.ui b/src/replace-dialog.ui
index edfbd45..4c60fdc 100644
--- a/src/replace-dialog.ui
+++ b/src/replace-dialog.ui
@@ -24,11 +24,20 @@
-->
<interface domain="gtk40">
- <object class="GtkFrame" id="r_frame">
- <property name="label" translatable="yes">Replace With</property>
+
+ <object class="GtkBox" id="r_frame">
+ <property name="orientation">vertical</property>
+ <style>
+ <class name="findreplace-frame" />
+ </style>
<accessibility>
<property name="description" translatable="yes">Enter the hex data or ASCII data to
replace with</property>
</accessibility>
+ <child><object class="GtkLabel">
+ <property name="label" translatable="yes">Replace With</property>
+ <property name="halign">start</property>
+ <property name="hexpand">true</property>
+ </object></child>
</object>
<object class="GtkButton" id="replace">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]