[ghex/gtk4-port: 20/91] Edit README so it is clear this is WIP.




commit 79418ce34004b6f0df80ffdb2ec71812068b0b98
Author: Logan Rathbone <poprocks gmail com>
Date:   Thu Jan 7 16:12:42 2021 -0500

    Edit README so it is clear this is WIP.

 README       | 65 +++++++++---------------------------------------------------
 src/gtkhex.c | 31 ++++++++++++++---------------
 2 files changed, 24 insertions(+), 72 deletions(-)
---
diff --git a/README b/README
index 5b68f83d..2c0b885a 100644
--- a/README
+++ b/README
@@ -1,60 +1,13 @@
-Copyright
-=========
+ghex gtk4-port
+==============
 
-   GHex - a binary editor
-   Copyright (C) 1998, 1999, 2000 Jaka Mocnik
+This is an ongoing effort to port the venerable ghex application to GTK4.
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
+Please note that this is NOT working code! Work so far has mostly been on the
+GtkHex widget itself.
 
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation, Inc.,
-   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-   For more details see the file COPYING.
-
-
-What is GHex
-============
-
-GHex is a hex editor for the GNOME desktop.
-
-GHex can load raw data from binary files and display them for editing in the
-traditional hex editor view. The display is split in two columns, with
-hexadecimal values in one column and the ASCII representation in the other.
-A useful tool for working with raw data.
-
-
-System Requirements
-===================
-
-GHex should build on (I guess) most unices. It needs the X11R6 libraries,
-glib, gdk and gtk 1.2.x libraries and GNOME 1.0.x libraries.
-
-
-Use
-===
-
-Read the help files.
-
-
-Author
-======
-
-GHex is being maintained by Jaka Mocnik <jaka gnu org>. If
-you are having trouble installing and/or running GHex, feel free to
-e-mail me.
-
-You can check on the current status of GHex via www at: 
-       https://wiki.gnome.org/Apps/Ghex
-
-Comments, ideas and (most of all) bug reports (and especially patches) are
-very welcome.
+If you are brave enough to test the WIP, first run meson as per usual, and
+then head into the 'src' directory, and run `make STUB`.
 
+You can then run ./STUB or ./debug-test.sh to try out the port of the GtkHex
+widget thus far.
diff --git a/src/gtkhex.c b/src/gtkhex.c
index cedbf0f5..612c2868 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -1402,10 +1402,10 @@ hex_pressed_cb (GtkGestureClick *gesture,
                
                gh->button = button;
                
-               if(gh->active_view == VIEW_HEX) {
+               if (gh->active_view == VIEW_HEX) {
                        hex_to_pointer(gh, x, y);
 
-                       if(! gh->selecting) {
+                       if (! gh->selecting) {
                                gh->selecting = TRUE;
                                gtk_hex_set_selection(gh, gh->cursor_pos, gh->cursor_pos);
                        }
@@ -1428,7 +1428,7 @@ hex_pressed_cb (GtkGestureClick *gesture,
                hex_to_pointer(gh, event->x, event->y);
 
                text = gtk_clipboard_wait_for_text(klass->primary);
-               if(text) {
+               if (text) {
                        hex_document_set_data(gh->document, gh->cursor_pos,
                                                                  strlen(text), 0, text, TRUE);
                        gtk_hex_set_cursor(gh, gh->cursor_pos + strlen(text));
@@ -1558,8 +1558,8 @@ hex_drag_update_cb (GtkGestureDrag *gesture,
                gh->scroll_dir = 0;
        }
 
-       if(gh->scroll_dir != 0) {
-               if(gh->scroll_timeout == -1) {
+       if (gh->scroll_dir != 0) {
+               if (gh->scroll_timeout == -1) {
                        gh->scroll_timeout =
                                g_timeout_add(SCROLL_TIMEOUT,
                                                          G_SOURCE_FUNC(scroll_timeout_handler),
@@ -1570,7 +1570,7 @@ hex_drag_update_cb (GtkGestureDrag *gesture,
                return;
        }
        else {
-               if(gh->scroll_timeout != -1) {
+               if (gh->scroll_timeout != -1) {
                        g_source_remove(gh->scroll_timeout);
                        gh->scroll_timeout = -1;
                }
@@ -1613,10 +1613,10 @@ ascii_pressed_cb (GtkGestureClick *gesture,
                
                gh->button = button;
                
-               if(gh->active_view == VIEW_ASCII) {
+               if (gh->active_view == VIEW_ASCII) {
                        ascii_to_pointer(gh, x, y);
 
-                       if(! gh->selecting) {
+                       if (! gh->selecting) {
                                gh->selecting = TRUE;
                                gtk_hex_set_selection(gh, gh->cursor_pos, gh->cursor_pos);
                        }
@@ -1639,7 +1639,7 @@ ascii_pressed_cb (GtkGestureClick *gesture,
                hex_to_pointer(gh, event->x, event->y);
 
                text = gtk_clipboard_wait_for_text(klass->primary);
-               if(text) {
+               if (text) {
                        hex_document_set_data(gh->document, gh->cursor_pos,
                                                                  strlen(text), 0, text, TRUE);
                        gtk_hex_set_cursor(gh, gh->cursor_pos + strlen(text));
@@ -1734,8 +1734,8 @@ ascii_drag_update_cb (GtkGestureDrag *gesture,
                gh->scroll_dir = 0;
        }
 
-       if(gh->scroll_dir != 0) {
-               if(gh->scroll_timeout == -1) {
+       if (gh->scroll_dir != 0) {
+               if (gh->scroll_timeout == -1) {
                        gh->scroll_timeout =
                                g_timeout_add(SCROLL_TIMEOUT,
                                                          G_SOURCE_FUNC(scroll_timeout_handler),
@@ -1746,7 +1746,7 @@ ascii_drag_update_cb (GtkGestureDrag *gesture,
                return;
        }
        else {
-               if(gh->scroll_timeout != -1) {
+               if (gh->scroll_timeout != -1) {
                        g_source_remove(gh->scroll_timeout);
                        gh->scroll_timeout = -1;
                }
@@ -1777,6 +1777,7 @@ hide_offsets_widget(GtkHex *gh)
        gtk_widget_hide (gh->offsets);
 }
 
+// FIXME - REORGANIZE!
 /*
  * default data_changed signal handler
  */
@@ -1785,7 +1786,7 @@ static void gtk_hex_real_data_changed(GtkHex *gh, gpointer data) {
        gint start_line, end_line;
        guint lines;
 
-       g_debug("%s: start", __func__);
+       TEST_DEBUG_FUNCTION_START 
 
        if(gh->cpl == 0)
                return;
@@ -1840,9 +1841,7 @@ bytes_changed(GtkHex *gh, gint start, gint end)
        gint start_line = start/gh->cpl - gh->top_line;
        gint end_line = end/gh->cpl - gh->top_line;
 
-       if(end_line < 0 ||
-          start_line > gh->vis_lines)
-               return;
+       g_return_if_fail(end_line >=0 && start_line <= gh->vis_lines);
 
        start_line = MAX(start_line, 0);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]