fpaquet / gtksheet

A spreadsheet widget for Gtk+
http://fpaquet.github.io/gtksheet/
Other
27 stars 9 forks source link

gtksheet crashes #10

Closed songqingshan closed 5 years ago

songqingshan commented 5 years ago

testgtksheet.exe crashes. I have tried gtksheet testgtksheet.exe under msys2/mingw64. There are three pages (e.g., folder 1, folder 2, and folder 3). If you start from page 1(folder 1), it works. if you visit other two pages (folder 2 or folder 3 or both) after visiting page 1, then you go back to the page 1 and the button "Show me a calendar" disappears. When clicking the some areas on the same page, the button maybe shows again (the best scenario), maybe disappears forever, maybe the program crashes (worst scenario), maybe shows warning "(testgtksheet.exe:3508): GLib-CRITICAL **: 22:43:05.957: Source ID 2344 was not found when attempting to remove it". I check following link: https://stackoverflow.com/questions/23199699/glib-critical-source-id-xxx-was-not-found-when-attempting-to-remove-it. It says "This isn't a bug in your code, and it's not a crash either. It's actually just a warning that g_source_remove() was called to disconnect a certain event handler that was already disconnected, in this case, in code that is part of gtk." I believe this kind of saying is incorrect. testgtksheet.exe crashes. In addition, I make a small sheet with a button cell using gtksheet. first, the button can be seen. If we visit others, then come to the same page with the button. The button disappears forever (similar to testgtksheet.exe).

fpaquet commented 5 years ago

Which branch are you using?

songqingshan commented 5 years ago

Hello,

Thanks for your reply. Since I post it for a quite while and I have not got any response, I can not remember which branch now. Do you know how many branches? I remember I posted multiple issues in two branches.


From: Fredy Paquet notifications@github.com Sent: March 3, 2019 11:24 AM To: fpaquet/gtksheet Cc: songqingshan; Author Subject: Re: [fpaquet/gtksheet] gtksheet crashes (#10)

Which branch are you using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/fpaquet/gtksheet/issues/10#issuecomment-469044179, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ApTBU3-ssC-amWDYL8IZryMkBTz11IMHks5vTAVDgaJpZM4ZdUr8.

fpaquet commented 5 years ago

Sorry for the late reply, issue notifications are not yet configured properly.

The current "gtk3" branch could produce these crashes. Since last Gtk3 release, I made a lot of Bugfixes in the "gtk3_fixes" branch which should solve the crash and missing buttons.

I'm planning to publish a bugfix release by next weekend.

The timer issue is new to me.

songqingshan commented 5 years ago

Hello Fredy,

Thanks for your response. I believe that the issues are caused by gtk component (e.g., gtkbuttons) mapping. Some did not map which causes ID cannot be found. I made some changes in the gtksheet. Some of issues(like buttons disappear after turning page) are solved , but row title button or the top-left button still exists mapping issue which is not solved yet. Currently I do not have time to make commit for this issue. If you like to know what changes that I made, I can send your gtksheet in which you can find my notes. Thank you again. Song


From: Fredy Paquet notifications@github.com Sent: March 4, 2019 12:36 AM To: fpaquet/gtksheet Cc: songqingshan; Author Subject: Re: [fpaquet/gtksheet] gtksheet crashes (#10)

Sorry for the late reply, issue notifications are not yet configured properly.

The current "gtk3" branch could produce these crashes. Since last Gtk3 release, I made a lot of Bugfixes in the "gtk3_fixes" branch which should solve the crash and missing buttons.

I'm planning to publish a bugfix release by next weekend.

The timer issue is new to me.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/fpaquet/gtksheet/issues/10#issuecomment-469135664, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ApTBUw9mf7iA0CI2E8tL5pGXI10Kn2jjks5vTL8LgaJpZM4ZdUr8.

fpaquet commented 5 years ago

I've now released V4.3.0 for Gtk3 (branch gtk3) https://github.com/fpaquet/gtksheet/releases/tag/V4.3.0

And published online docs V4 https://fpaquet.github.io/gtksheet/reference/index.html

This should fix the crash issue.

songqingshan commented 5 years ago

Hello Fredy Paquet,

Thanks for your informing me. That is great! I will try it once I have time. I had found a few more programs which are not submitted a quite while ago . After I try your new version, I will submit them if they still exist. Thank you for your work. I believe that you solve mapping problems.

Song


From: Fredy Paquet notifications@github.com Sent: March 9, 2019 5:37 AM To: fpaquet/gtksheet Cc: songqingshan; Author Subject: Re: [fpaquet/gtksheet] gtksheet crashes (#10)

I've now released V4.3.0 for Gtk3 (branch gtk3) https://github.com/fpaquet/gtksheet/releases/tag/V4.3.0

And published online docs V4 https://fpaquet.github.io/gtksheet/reference/index.html

This should fix the crash issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/fpaquet/gtksheet/issues/10#issuecomment-471169673, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ApTBUxuwqHSiVBt7ZpmCu1U0iR9fvQTBks5vU5zhgaJpZM4ZdUr8.

fpaquet commented 5 years ago

The timer issue was fixed in commit 6620015 in branch gtk3_fixes Thank you for reporting.

songqingshan commented 5 years ago

Hello Fredy, According to my experience, this issue is highly possible related to the button "0" mapping. When I delete all cells in the sheet, button "0" still is here. After a while, the button "0" is gone by clicking somewhere on the sheet. Song

songqingshan commented 5 years ago

Hi Fredy, Attached is the gtksheet that I made some changes which solves the part of mapping issues. You just need to type "shan", then you can find notes and changes that I made. I hope it is useful for you.

Song


From: Fredy Paquet notifications@github.com Sent: March 9, 2019 5:37 AM To: fpaquet/gtksheet Cc: songqingshan; Author Subject: Re: [fpaquet/gtksheet] gtksheet crashes (#10)

I've now released V4.3.0 for Gtk3 (branch gtk3) https://github.com/fpaquet/gtksheet/releases/tag/V4.3.0

And published online docs V4 https://fpaquet.github.io/gtksheet/reference/index.html

This should fix the crash issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/fpaquet/gtksheet/issues/10#issuecomment-471169673, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ApTBUxuwqHSiVBt7ZpmCu1U0iR9fvQTBks5vU5zhgaJpZM4ZdUr8.

/* GtkSheet widget for Gtk+.

/**

include

include

include

include

include <glib/gprintf.h>

include <gdk/gdk.h>

include <gtk/gtk.h>

include <gdk/gdkkeysyms.h>

include <gobject/gvaluecollector.h>

include <pango/pango.h>

define GTKSHEET_H_INSIDE

include "gtksheet-compat.h"

include "gtkdataentry.h"

include "gtkdatatextview.h"

include "gtksheet.h"

include "gtkdataformat.h"

include "gtksheet-marshal.h"

include "gtksheettypebuiltins.h"

undef GTK_SHEET_DEBUG

ifdef DEBUG

undef GTK_SHEET_DEBUG

define GTK_SHEET_DEBUG 1 / define to activate debug output /

endif

ifdef GTK_SHEET_DEBUG

define GTK_SHEET_DEBUG_ENABLE_DEPRECATION_WARNINGS 1

define GTK_SHEET_DEBUG_ADJUSTMENT 0

define GTK_SHEET_DEBUG_ALLOCATION 0

define GTK_SHEET_DEBUG_BUILDER 0

define GTK_SHEET_DEBUG_CELL_ACTIVATION 0

define GTK_SHEET_DEBUG_CHILDREN 0

define GTK_SHEET_DEBUG_CLICK 0

define GTK_SHEET_DEBUG_COLORS 0

define GTK_SHEET_DEBUG_DRAW 0

define GTK_SHEET_DEBUG_DRAW_BACKGROUND 0

define GTK_SHEET_DEBUG_DRAW_BUTTON 0

define GTK_SHEET_DEBUG_DRAW_INVALIDATE 0

define GTK_SHEET_DEBUG_DRAW_LABEL 0

define GTK_SHEET_DEBUG_ENTER_PRESSED 0

define GTK_SHEET_DEBUG_ENTRY 0

define GTK_SHEET_DEBUG_EXPOSE 0

define GTK_SHEET_DEBUG_FINALIZE 0

define GTK_SHEET_DEBUG_FONT_METRICS 0

define GTK_SHEET_DEBUG_FREEZE 0

define GTK_SHEET_DEBUG_KEYPRESS 0

define GTK_SHEET_DEBUG_MOUSE 0

define GTK_SHEET_DEBUG_MOVE 0

define GTK_SHEET_DEBUG_MOTION 0

define GTK_SHEET_DEBUG_PIXEL_INFO 0

define GTK_SHEET_DEBUG_PROPERTIES 0

define GTK_SHEET_DEBUG_REALIZE 0

define GTK_SHEET_DEBUG_SELECTION 0

define GTK_SHEET_DEBUG_SIGNALS 0

define GTK_SHEET_DEBUG_SIZE 0

define GTK_SHEET_DEBUG_SCROLL 0

define GTK_SHEET_DEBUG_SET_CELL_TIMER 0

define GTK_SHEET_DEBUG_SET_CELL_TEXT 0

define GTK_SHEET_ENABLE_DEBUG_MACROS

endif

include "gtksheetdebug.h"

define GTK_SHEET_MOD_MASK GDK_MOD1_MASK / main modifier for sheet navigation /

ifndef GDK_KEY_KP_Up

define GDK_KEY_KP_Up GDK_KP_Up

define GDK_KEY_KP_Down GDK_KP_Down

define GDK_KEY_KP_Page_Up GDK_KP_Page_Up

define GDK_KEY_KP_Page_Down GDK_KP_Page_Down

define GDK_KEY_KP_Page_Left GDK_KP_Page_Left

define GDK_KEY_KP_Page_Right GDK_KP_Page_Right

define GDK_KEY_KP_Home GDK_KP_Home

define GDK_KEY_KP_End GDK_KP_End

define GDK_KEY_KP_Left GDK_KP_Left

define GDK_KEY_KP_Right GDK_KP_Right

define GDK_KEY_KP_Enter GDK_KP_Enter

endif

if !GTK_CHECK_VERSION(2,22,0)

static GdkCursorType gdk_cursor_get_cursor_type (GdkCursor *cursor) { g_return_val_if_fail (cursor != NULL, GDK_BLANK_CURSOR); return cursor->type; }

endif

/ sheet flags / enum _GtkSheetFlags { GTK_SHEET_IS_LOCKED = 1 << 0, / sheet is not editable / GTK_SHEET_IS_FROZEN = 1 << 1, / frontend updates temporarily disabled / GTK_SHEET_IN_XDRAG = 1 << 2, / column being resized / GTK_SHEET_IN_YDRAG = 1 << 3, / row being resized / GTK_SHEET_IN_DRAG = 1 << 4, / cell selection being moved / GTK_SHEET_IN_SELECTION = 1 << 5, / cell selection being created / GTK_SHEET_IN_RESIZE = 1 << 6, / cell selection being resized / GTK_SHEET_IN_CLIP = 1 << 7, / cell selection in clipboard / GTK_SHEET_IN_REDRAW_PENDING = 1 << 8, / redraw on deactivate / GTK_SHEET_IN_AUTORESIZE_PENDING = 1 << 9, / autoresize pending / GTK_SHEET_IS_DESTROYED = 1 << 10, / set by destruct handler / };

enum _GtkSheetProperties { PROP_GTK_SHEET_0, / dummy / PROP_GTK_SHEET_TITLE, / gtk_sheet_set_title() / PROP_GTK_SHEET_DESCRIPTION, / gtk_sheet_set_description() / PROP_GTK_SHEET_NCOLS, / number of colunms - necessary for glade object creation / PROP_GTK_SHEET_NROWS, / number of rows - necessary for glade object creation / PROP_GTK_SHEET_LOCKED, / gtk_sheet_set_locked() / PROP_GTK_SHEET_SELECTION_MODE, / gtk_sheet_set_selection_mode() / PROP_GTK_SHEET_AUTO_RESIZE, / gtk_sheet_set_autoresize() / PROP_GTK_SHEET_AUTO_RESIZE_ROWS, / gtk_sheet_set_autoresize_rows() / PROP_GTK_SHEET_AUTO_RESIZE_COLUMNS, / gtk_sheet_set_autoresize_columns() / PROP_GTK_SHEET_AUTO_SCROLL, / gtk_sheet_set_autoscroll() / PROP_GTK_SHEET_CLIP_TEXT, / gtk_sheet_set_clip_text() / PROP_GTK_SHEET_JUSTIFY_ENTRY, / gtk_sheet_set_justify_entry() / PROP_GTK_SHEET_BG_COLOR, / gtk_sheet_set_background() / PROP_GTK_SHEET_GRID_VISIBLE, / gtk_sheet_show_grid() / PROP_GTK_SHEET_GRID_COLOR, / gtk_sheet_set_grid() / PROP_GTK_SHEET_COLUMN_TITLES_VISIBLE, / gtk_sheet_show_column_titles() / PROP_GTK_SHEET_COLUMNS_RESIZABLE, / gtk_sheet_columns_set_resizable() / PROP_GTK_SHEET_COLUMN_TITLES_HEIGHT, / gtk_sheet_set_column_titles_height() / PROP_GTK_SHEET_ROW_TITLES_VISIBLE, / gtk_sheet_show_row_titles() / PROP_GTK_SHEET_ROWS_RESIZABLE, / gtk_sheet_rows_set_resizable() / PROP_GTK_SHEET_ROW_TITLES_WIDTH, / gtk_sheet_set_row_titles_width() / PROP_GTK_SHEET_ENTRY_TYPE, / gtk_sheet_change_entry() / PROP_GTK_SHEET_VJUST, / gtk_sheet_set_vjustification() / PROP_GTK_SHEET_HADJUSTMENT, / gtk_sheet_set_hadjustment() / PROP_GTK_SHEET_VADJUSTMENT, / gtk_sheet_set_vadjustment() / PROP_GTK_SHEET_HSCROLL_POLICY, / GtkScrollable interface / PROP_GTK_SHEET_VSCROLL_POLICY, / GtkScrollable interface / };

/ Signals /

enum _GtkSheetSignals { SELECT_ROW, SELECT_COLUMN, SELECT_RANGE, CLIP_RANGE, RESIZE_RANGE, MOVE_RANGE, TRAVERSE, DEACTIVATE, ACTIVATE, SET_CELL, CLEAR_CELL, CHANGED, NEW_COL_WIDTH, NEW_ROW_HEIGHT, ENTRY_FOCUS_IN, ENTRY_FOCUS_OUT, ENTRY_POPULATE_POPUP, MOVE_CURSOR, ENTER_PRESSED, LAST_SIGNAL }; static guint sheet_signals[LAST_SIGNAL] = { 0 };

typedef enum _GtkSheetArea { ON_SHEET_BUTTON_AREA, ON_ROW_TITLES_AREA, ON_COLUMN_TITLES_AREA, ON_CELL_AREA } GtkSheetArea;

define GTK_SHEET_FLAGS(sheet) \

(GTK_SHEET (sheet)->flags)

define GTK_SHEET_SET_FLAGS(sheet,flag) \

(GTK_SHEET_FLAGS (sheet) |= (flag))

define GTK_SHEET_UNSET_FLAGS(sheet,flag) \

(GTK_SHEET_FLAGS (sheet) &= ~(flag))

define GTK_SHEET_IS_FROZEN(sheet) \

(GTK_SHEET_FLAGS (sheet) & GTK_SHEET_IS_FROZEN)

define GTK_SHEET_IN_XDRAG(sheet) \

(GTK_SHEET_FLAGS (sheet) & GTK_SHEET_IN_XDRAG)

define GTK_SHEET_IN_YDRAG(sheet) \

(GTK_SHEET_FLAGS (sheet) & GTK_SHEET_IN_YDRAG)

define GTK_SHEET_IN_DRAG(sheet) \

(GTK_SHEET_FLAGS (sheet) & GTK_SHEET_IN_DRAG)

define GTK_SHEET_IN_SELECTION(sheet) \

(GTK_SHEET_FLAGS (sheet) & GTK_SHEET_IN_SELECTION)

define GTK_SHEET_IN_RESIZE(sheet) \

(GTK_SHEET_FLAGS (sheet) & GTK_SHEET_IN_RESIZE)

define GTK_SHEET_IN_CLIP(sheet) \

(GTK_SHEET_FLAGS (sheet) & GTK_SHEET_IN_CLIP)

define GTK_SHEET_REDRAW_PENDING(sheet) \

(GTK_SHEET_FLAGS (sheet) & GTK_SHEET_IN_REDRAW_PENDING)

/ data access macros - no frontend update! /

define COLPTR(sheet, colidx) (sheet->column[colidx])

define ROWPTR(sheet, rowidx) (&sheet->row[rowidx])

define MIN_VIEW_ROW(sheet) \

(sheet->view.row0)

/ beware: MAX_VISIBLE_ROW() can be maxrow+1 /

define MAX_VIEW_ROW(sheet) \

(sheet->view.rowi)

define MIN_VIEW_COLUMN(sheet) \

(sheet->view.col0)

/ beware: MAX_VISIBLE_COLUMN() can be maxcol+1 /

define MAX_VIEW_COLUMN(sheet) \

(sheet->view.coli)

/ widget flag tests and settings /

define GTK_SHEET_ROW_IS_VISIBLE(rowptr) \

((rowptr)->is_visible)

define GTK_SHEET_ROW_SET_VISIBLE(rowptr, value) \

((rowptr)->is_visible = (value))

define GTK_SHEET_ROW_IS_SENSITIVE(rowptr) \

((rowptr)->is_sensitive)

define GTK_SHEET_ROW_SET_SENSITIVE(rowptr, value) \

((rowptr)->is_sensitive = (value))

define GTK_SHEET_ROW_CAN_FOCUS(rowptr) \

GTK_SHEET_ROW_IS_SENSITIVE(rowptr)

/ cell is in range or on range border /

define CELL_IN_RANGE(row, col, range) \

(range.row0 <= row && row <= range.rowi  \
&& range.col0 <= col && col <= range.coli)

/ cell is on range border /

define CELL_ON_RANGE_BORDER(row, col, range) \

(row == range.row0 || row == range.rowi \
|| col == range.col0 || col == range.coli)

/ some constants /

/ unrealized maximum width /

define COLUMN_UNREALIZED_MAX_WIDTH 512

/ maximized: free space left for others /

define COLUMN_REMNANT_PIXELS 32

/ unrealized maximum height /

define ROW_UNREALIZED_MAX_HEIGHT 128

/ maximized: free space left for others /

define ROW_REMNANT_PIXELS 32

define COLUMN_MAX_WIDTH(sheet) \

(sheet->sheet_window_width < COLUMN_REMNANT_PIXELS ? \
COLUMN_UNREALIZED_MAX_WIDTH : \
sheet->sheet_window_width - COLUMN_REMNANT_PIXELS )

if 0

define ROW_MAX_HEIGHT(sheet) \

(sheet->sheet_window_height < ROW_REMNANT_PIXELS ? \
ROW_UNREALIZED_MAX_HEIGHT : \
sheet->sheet_window_height - ROW_REMNANT_PIXELS )

else

define ROW_MAX_HEIGHT(sheet) \

(sheet->sheet_window_height < ROW_REMNANT_PIXELS ? \
ROW_UNREALIZED_MAX_HEIGHT : \
sheet->sheet_window_height * 1/3 )

endif

define CELL_EXTENT_WIDTH(text_width, attr_border_width) \

(text_width + attr_border_width)

define CELL_EXTENT_HEIGHT(text_height, attr_border_height) \

(text_height + attr_border_height)

define COLUMN_EXTENT_TO_WIDTH(extent_width) \

(extent_width + 2*CELLOFFSET > COLUMN_MAX_WIDTH(sheet) ? \
COLUMN_MAX_WIDTH(sheet) : \
extent_width + 2*CELLOFFSET)

define ROW_EXTENT_TO_HEIGHT(extent_height) \

(extent_height + 2*CELLOFFSET > ROW_MAX_HEIGHT(sheet) ? \
ROW_MAX_HEIGHT(sheet) : \
extent_height + 2*CELLOFFSET)

/ GtkSheetRange macros /

define _RECT_IN_RANGE(row_0, row_i, col_0, col_i, range) \

 ((range)->row0 <= (row_0) && (row_i) <= (range)->rowi \
 && (range)->col0 <= (col_0) && (col_i) <= (range)->coli)

define _POINT_IN_RANGE(row, col, range) \

_RECT_IN_RANGE(row, row, col, col, range)

define _RECT_EQ_RANGE(row_0, row_i, col_0, col_i, range) \

 ((row_0) == (range)->row0 && (row_i) == (range)->rowi \
 && (col_0) == (range)->col0 && (col_i) == (range)->coli)

define _RECT_NEQ_RANGE(row_0, row_i, col_0, col_i, range) \

 ((row_0) != (range)->row0 || (row_i) != (range)->rowi \
 || (col_0) != (range)->col0 || (col_i) != (range)->coli)

define _RANGE_EQ_RANGE(range1, range2) \

 ((range1)->row0 == (range2)->row0 && (range1)->rowi == (range2)->rowi \
 && (range1)->col0 == (range2)->col0 && (range1)->coli == (range2)->coli)

define _RANGE_NEQ_RANGE(range1, range2) \

 ((range1)->row0) != (range2)->row0 || (range1)->rowi != (range2)->rowi \
 || (range1)->col0 != (range2)->col0 || (range1)->coli != (range2)->coli)

define SET_ACTIVE_CELL(r, c) \

{ \
/*g_debug("%s(%d): SET_ACTIVE_CELL(%d, %d)", \
        __FUNCTION__, __LINE__, (r), (c));*/ \
sheet->active_cell.row = (r); \
    sheet->active_cell.col = (c); \
}

define SET_SELECTION_PIN(r, c) \

{ \
    /*g_debug("%s(%d): SET_SELECTION_PIN(%d, %d)", \
        __FUNCTION__, __LINE__, (r), (c));*/ \
    sheet->selection_pin.row = (r); \
    sheet->selection_pin.col = (c); \
}

define SET_SELECTION_CURSOR(r, c) \

{ \
    /*g_debug("%s(%d): SET_SELECTION_CURSOR(%d, %d)", \
        __FUNCTION__, __LINE__, (r), (c));*/ \
    sheet->selection_cursor.row = (r); \
    sheet->selection_cursor.col = (c); \
}

const guint gtksheet_major_version = GTKSHEET_MAJOR_VERSION; const guint gtksheet_minor_version = GTKSHEET_MINOR_VERSION; const guint gtksheet_micro_version = GTKSHEET_MICRO_VERSION;

gchar * gtksheet_check_version ( guint required_major, guint required_minor, guint required_micro) { if (required_major > GTKSHEET_MAJOR_VERSION) return "GtkExtra version too old (major mismatch)"; if (required_major < GTKSHEET_MAJOR_VERSION) return "GtkExtra version too new (major mismatch)"; if (required_minor > GTKSHEET_MINOR_VERSION) return "GtkExtra version too old (minor mismatch)"; if (required_minor < GTKSHEET_MINOR_VERSION) return "GtkExtra version too new (minor mismatch)"; if (required_micro > GTKSHEET_MICRO_VERSION) return "GtkExtra version too old (micro mismatch)"; return NULL; }

/ void _gtksheet_signal_test( GObject object, guint signal_id, gint arg1, gint arg2, gboolean *default_ret) { gboolean result; GValue ret = { 0, }; GValue instance_and_param[3] = { { 0, }, {0, }, {0, } };

g_value_init(instance_and_param + 0, G_OBJECT_TYPE(object)); g_value_set_instance(instance_and_param + 0, G_OBJECT(object));

g_value_init(instance_and_param + 1, G_TYPE_INT); g_value_set_int(instance_and_param + 1, arg1);

g_value_init(instance_and_param + 2, G_TYPE_INT); g_value_set_int(instance_and_param + 2, arg2);

g_value_init(&ret, G_TYPE_BOOLEANEAN); g_value_set_boolean(&ret, *default_ret);

g_signal_emitv(instance_and_param, signal_id, 0, &ret); *default_ret = g_value_get_boolean(&ret);

g_value_unset(instance_and_param + 0); g_value_unset(instance_and_param + 1); g_value_unset(instance_and_param + 2); } */

void _gtksheet_signal_emit(GObject object, guint signal_id, ...) { gboolean result; GValue ret = { 0, }; GValue instance_and_params [10] = { {0, }, }; va_list var_args; GSignalQuery query; gchar *error; int i;

va_start (var_args, signal_id);

g_value_init(instance_and_params + 0, G_OBJECT_TYPE(object)); g_value_set_instance (instance_and_params + 0, G_OBJECT(object));

g_signal_query(signal_id, &query);

for (i = 0; i < query.n_params; i++) { gboolean static_scope = query.param_types[i]&~G_SIGNAL_TYPE_STATIC_SCOPE; g_value_init(instance_and_params + i + 1, query.param_types[i]);

  G_VALUE_COLLECT (instance_and_params + i + 1,
                   var_args,
                   static_scope ? G_VALUE_NOCOPY_CONTENTS : 0,
                   &error);

  if (error)
    {
      g_warning ("%s: %s", G_STRLOC, error);
      g_free (error);
      while (i-- > 0)
        g_value_unset (instance_and_params + i);

      va_end (var_args);
      return;
    }

}

g_value_init(&ret, query.return_type); result = va_arg(var_args,gboolean ); g_value_set_boolean(&ret, result);
g_signal_emitv(instance_and_params, signal_id, 0, &ret); *result = g_value_get_boolean(&ret);
g_value_unset (&ret);

for (i = 0; i < query.n_params; i++) g_value_unset (instance_and_params + 1 + i); g_value_unset (instance_and_params + 0);

va_end (var_args); }

/ defaults /

define GTK_SHEET_ROW_DEFAULT_HEIGHT 24

define GTK_SHEET_DEFAULT_FONT_ASCENT 12

define GTK_SHEET_DEFAULT_FONT_DESCENT 12

define GTK_SHEET_DEFAULT_BG_COLOR "lightgray"

define GTK_SHEET_DEFAULT_GRID_COLOR "gray"

define GTK_SHEET_DEFAULT_TM_COLOR "red" / tooltip marker /

/ enable focus hunt when no active cell is set when sheet is shown /

define GTK_SHEET_ENABLE_FOCUS_ON_SHOW 0

/ size of tooltip marker, pixels /

define GTK_SHEET_DEFAULT_TM_SIZE 4

/ number of rows to stay visible with PageUp/Dn /

define GTK_SHEET_PAGE_OVERLAP 1

define CELL_SPACING 1

define DRAG_WIDTH 6

define TIMEOUT_SCROLL 20

define TIMEOUT_FLASH 200

define TIME_INTERVAL 8

define MINROWS 0

define MINCOLS 0

define MAXLENGTH 30

define CELLOFFSET 4 / inner border from grid to text /

define CELLOFFSET_NF (CELLOFFSET) / no frame, GtkTextView /

define CELLOFFSET_WF (CELLOFFSET-2) / w/frame, GtkEntry /

define DEFAULT_SELECTION_BORDER_WIDTH 3

define DEFAULT_CORNER_EXTENT 2

static gdouble selection_border_width = DEFAULT_SELECTION_BORDER_WIDTH; static gdouble selection_border_offset = 0; / + to outside, - to inner /

/ beware: keep corner within border! / static gdouble selection_corner_size = DEFAULT_SELECTION_BORDER_WIDTH + DEFAULT_CORNER_EXTENT; static gdouble selection_corner_offset = -DEFAULT_CORNER_EXTENT;

static gdouble selection_bb_offset = 1; / border/background/

static GdkRGBA color_black; static GdkRGBA color_white;

ifdef GTK_SHEET_DEBUG

define GTK_SHEET_DEBUG_COLOR "green"

static GdkRGBA debug_color;

if GTK_SHEET_DEBUG_EXPOSE > 0

static void _debug_cairo_clip_extent(gchar where, cairo_t cr) { double x1, y1, x2, y2; cairo_clip_extents (cr, &x1, &y1, &x2, &y2); g_debug( "%s: _debug_cairo_clip_extent: x1 %0.1f y1 %0.1f x2 %0.1f y2 %0.1f", where, x1, y1, x2, y2); }

endif

ifdef GTK_SHEET_DEBUG

static void _debug_color_rect( gchar where, cairo_t cr, double x, double y, double w, double h) { g_debug( "%s: _debug_color_rect: x %0.1f y %0.1f w %0.1f h %0.1f", where, x, y, w, h);

cairo_save(cr);  // debug color

cairo_set_line_width(cr, 1.0);
cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
cairo_set_line_join(cr, CAIRO_LINE_JOIN_MITER);
gdk_cairo_set_source_rgba(cr, &debug_color);
cairo_rectangle(cr, x, y, w, h);
cairo_stroke(cr);

cairo_restore(cr);  // debug color

}

endif

if 0

include

static void g_debug_popup(char fmt, ...) / used to intercept/debug drawing sequences */ { va_list ap; va_start(ap, fmt);

GtkWidget *dialog = gtk_message_dialog_new (NULL,
                    GTK_DIALOG_DESTROY_WITH_PARENT,
                    GTK_MESSAGE_ERROR,
                    GTK_BUTTONS_CLOSE,
                    fmt, ap);

gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);

}

endif

static void g_debug_style_context_list_classes( gchar hint, GtkStyleContext context) { GList l = gtk_style_context_list_classes (context); while (l) { g_debug("%s: style_context class <%s>", hint, (gchar ) l->data); l = l->next; } g_list_free(l); }

endif

/**

static inline guint _default_font_ascent(GtkWidget widget) { PangoFontDescription font_desc = NULL; GtkStyleContext *style_context = gtk_widget_get_style_context(widget);

gtk_style_context_get (style_context, GTK_STATE_FLAG_NORMAL,
                   GTK_STYLE_PROPERTY_FONT, &font_desc, NULL);

if (!font_desc)
return (GTK_SHEET_DEFAULT_FONT_ASCENT);

PangoContext *context = gtk_widget_get_pango_context(widget);

PangoFontMetrics *metrics = pango_context_get_metrics(context,
font_desc, pango_context_get_language(context));
guint val = pango_font_metrics_get_ascent(metrics);
pango_font_metrics_unref(metrics);

return (PANGO_PIXELS(val));

}

static void _get_string_extent(GtkSheet sheet, GtkSheetColumn colptr, PangoFontDescription font_desc, const gchar text, guint width, guint height) { PangoRectangle extent; PangoLayout *layout;

layout = gtk_widget_create_pango_layout(GTK_WIDGET(sheet), text);
pango_layout_set_font_description(layout, font_desc);

if (colptr && !gtk_sheet_autoresize_columns(sheet))
{
switch(colptr->wrap_mode)
{
    case GTK_WRAP_NONE: 
    break;

    case GTK_WRAP_CHAR:
    pango_layout_set_width(layout, colptr->width * PANGO_SCALE);
    pango_layout_set_wrap(layout, PANGO_WRAP_CHAR);
    break;

    case GTK_WRAP_WORD:
    pango_layout_set_width(layout, colptr->width * PANGO_SCALE);
    pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
    break;

    case GTK_WRAP_WORD_CHAR:
    pango_layout_set_width(layout, colptr->width * PANGO_SCALE);
    pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
    break;
}
}

pango_layout_get_pixel_extents(layout, NULL, &extent);

if GTK_SHEET_DEBUG_FONT_METRICS > 0

{
PangoContext *context = gtk_widget_get_pango_context(GTK_WIDGET(sheet));
PangoFontMetrics *metrics = pango_context_get_metrics(
    context, font_desc, pango_context_get_language(context));

gint ascent = pango_font_metrics_get_ascent(metrics) / PANGO_SCALE;
gint descent = pango_font_metrics_get_descent(metrics) / PANGO_SCALE;
gint spacing = pango_layout_get_spacing(layout) / PANGO_SCALE;

pango_font_metrics_unref(metrics);

g_debug("_get_string_extent(%s): ext (%d, %d, %d, %d) asc %d desc %d spac %d",
    text,
    extent.x, extent.y,
    extent.width, extent.height,
    ascent, descent, spacing);
}

endif

g_object_unref(G_OBJECT(layout));

if (width)
*width = extent.width;
if (height)
*height = extent.height;

}

static inline guint _default_font_descent(GtkWidget widget) { PangoFontDescription font_desc = NULL; GtkStyleContext *style_context = gtk_widget_get_style_context(widget);

gtk_style_context_get (style_context, GTK_STATE_FLAG_NORMAL,
                   GTK_STYLE_PROPERTY_FONT, &font_desc, NULL);

if (!font_desc)
return (GTK_SHEET_DEFAULT_FONT_DESCENT);

PangoContext *context = gtk_widget_get_pango_context(widget);

PangoFontMetrics *metrics = pango_context_get_metrics(context,
font_desc, pango_context_get_language(context));
guint val =  pango_font_metrics_get_descent(metrics);
pango_font_metrics_unref(metrics);

return (PANGO_PIXELS(val));

}

/ gives the top/bottom pixel of the given row in context of the sheet's voffset /

static inline gint _gtk_sheet_row_top_ypixel(GtkSheet *sheet, gint row) { if (row < 0 || row > sheet->maxrow) return (sheet->voffset); return (sheet->voffset + sheet->row[row].top_ypixel); }

static inline gint _gtk_sheet_row_bottom_ypixel(GtkSheet *sheet, gint row) { gint ypixel = _gtk_sheet_row_top_ypixel(sheet, row); if (0 <= row && row <= sheet->maxrow) ypixel += sheet->row[row].height; return (ypixel); }

/**

static inline gint _gtk_sheet_row_from_ypixel(GtkSheet *sheet, gint y) { gint i, cy;

cy = sheet->voffset;
if (sheet->column_titles_visible)
cy += sheet->column_title_area.height;

if (y < cy)
return (-1);    /* top outside */

for (i = 0; i <= sheet->maxrow; i++)
{
if (GTK_SHEET_ROW_IS_VISIBLE(ROWPTR(sheet, i)))
{
    if (cy <= y  && y < (cy + sheet->row[i].height))
    return (i);
    cy += sheet->row[i].height;
}
}

/* no match */
return (sheet->maxrow + 1);

}

/**

/**

/**

/**

/**

/**

/**

/**

/**

/**

/**

/**

/*

/*

/*

static inline gint POSSIBLE_RESIZE(GtkSheet sheet, gint x, gint y, gint drag_row, gint *drag_column) { gint xdrag, ydrag;

xdrag = _gtk_sheet_column_right_xpixel(sheet, sheet->range.coli);
ydrag = _gtk_sheet_row_bottom_ypixel(sheet, sheet->range.rowi);

if (sheet->state == GTK_SHEET_COLUMN_SELECTED)
ydrag = _gtk_sheet_row_top_ypixel(sheet, sheet->view.row0);

if (sheet->state == GTK_SHEET_ROW_SELECTED)
xdrag = _gtk_sheet_column_left_xpixel(sheet, sheet->view.col0);

*drag_column = _gtk_sheet_column_from_xpixel(sheet, x);
*drag_row = _gtk_sheet_row_from_ypixel(sheet, y);

if (xdrag - DRAG_WIDTH / 2 <= x && x <= xdrag + DRAG_WIDTH / 2 &&
ydrag - DRAG_WIDTH / 2 <= y && y <= ydrag + DRAG_WIDTH / 2)
{
return (TRUE);
}

return (FALSE);

}

/ Prototypes (extern) /

extern void _gtksheet_signal_emit(GObject *object, guint signal_id, ...);

/ Prototypes (static) /

static void gtk_sheet_class_init(GtkSheetClass klass); static void gtk_sheet_init(GtkSheet sheet); static void gtk_sheet_destroy_handler(GtkWidget widget); static void gtk_sheet_finalize_handler(GObject object); static void gtk_sheet_style_set_handler(GtkWidget widget, GtkStyle previous_style); static void gtk_sheet_realize_handler(GtkWidget widget); static void gtk_sheet_unrealize_handler(GtkWidget widget); static void gtk_sheet_map_handler(GtkWidget widget); static void gtk_sheet_unmap_handler(GtkWidget widget);

static gboolean gtk_sheet_draw(GtkWidget widget, cairo_t cr);

static void gtk_sheet_forall_handler(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data);

static void gtk_sheet_set_scroll_adjustments(GtkSheet sheet, GtkAdjustment hadjustment, GtkAdjustment *vadjustment);

static gboolean gtk_sheet_button_press_handler(GtkWidget widget, GdkEventButton event); static gboolean gtk_sheet_button_release_handler(GtkWidget widget, GdkEventButton event); static gboolean gtk_sheet_motion_handler(GtkWidget widget, GdkEventMotion event);

static gboolean gtk_sheet_entry_key_press_handler(GtkWidget widget, GdkEventKey key, gpointer user_data);

static gboolean gtk_sheet_key_press_handler(GtkWidget widget, GdkEventKey key);

static void gtk_sheet_size_request(GtkWidget widget, GtkRequisition requisition); static void gtk_sheet_get_preferred_width (GtkWidget widget, gint minimal_width, gint natural_width); static void gtk_sheet_get_preferred_height (GtkWidget widget, gint minimal_height, gint natural_height); static void gtk_sheet_size_allocate_handler(GtkWidget widget, GtkAllocation allocation);

static gboolean gtk_sheet_focus(GtkWidget *widget, GtkDirectionType direction);

static void _gtk_sheet_move_cursor(GtkSheet *sheet, GtkMovementStep step, gint count, gboolean extend_selection);

/ Sheet queries /

static gint gtk_sheet_range_isvisible(GtkSheet sheet, GtkSheetRange range); static gint gtk_sheet_cell_isvisible(GtkSheet sheet, gint row, gint column);

/ Clipped Range /

static gint _gtk_sheet_scroll_to_pointer(gpointer data); static gint gtk_sheet_flash(gpointer data);

/ Drawing Routines /

/ draw cell background and frame / static void _cell_draw_background(GtkSheet sheet, gint row, gint column, cairo_t swin_cr);

/ draw cell border / static void _cell_draw_border(GtkSheet *sheet, gint row, gint column, gint mask);

/ draw cell contents / static void _cell_draw_label(GtkSheet sheet, gint row, gint column, cairo_t swin_cr);

/ highlight the visible part of the selected range / static void gtk_sheet_range_draw_selection( GtkSheet sheet, GtkSheetRange range, cairo_t cr);

/ Selection /

static gint _gtk_sheet_move_query( GtkSheet sheet, gint row, gint column, gboolean need_focus); static void gtk_sheet_real_select_range( GtkSheet sheet, GtkSheetRange range); static void gtk_sheet_real_unselect_range( GtkSheet sheet, GtkSheetRange range); static void gtk_sheet_extend_selection( GtkSheet sheet, gint row, gint column); static void gtk_sheet_new_selection( GtkSheet sheet, GtkSheetRange range); static void gtk_sheet_draw_border( GtkSheet sheet, GtkSheetRange range, cairo_t cr); static void gtk_sheet_draw_corners( GtkSheet sheet, GtkSheetRange range, cairo_t cr);

/ Active Cell handling /

static void gtk_sheet_entry_changed_handler( GtkWidget widget, gpointer data); static gboolean gtk_sheet_activate_cell( GtkSheet sheet, gint row, gint col); static void gtk_sheet_draw_active_cell(GtkSheet sheet, cairo_t cr); static void gtk_sheet_show_active_cell(GtkSheet sheet); void gtk_sheet_click_cell( GtkSheet sheet, gint row, gint column, gboolean *veto);

/ Backing Pixmap /

static void gtk_sheet_make_bsurf( GtkSheet sheet, guint width, guint height); static void gtk_sheet_draw_backing_pixmap( GtkSheet sheet, GtkSheetRange range, cairo_t *cr);

/ Scrollbars /

static void _vadjustment_changed_handler( GtkAdjustment adjustment, gpointer data); static void _hadjustment_changed_handler( GtkAdjustment adjustment, gpointer data); static void _vadjustment_value_changed_handler( GtkAdjustment adjustment, gpointer data); static void _hadjustment_value_changed_handler( GtkAdjustment adjustment, gpointer data);

static void draw_xor_vline(GtkSheet sheet, gboolean draw); static void draw_xor_hline(GtkSheet sheet, gboolean draw); static void gtk_sheet_draw_flashing_range( GtkSheet sheet, cairo_t xor_cr); static guint new_column_width(GtkSheet sheet, gint column, gint x); static guint new_row_height(GtkSheet sheet, gint row, gint y);

/ Sheet Entry /

static void create_sheet_entry(GtkSheet sheet, GType new_entry_type); //static void gtk_sheet_entry_set_max_size(GtkSheet sheet);

/ Sheet button gadgets /

static void _gtk_sheet_row_buttons_size_allocate(GtkSheet *sheet);

static void row_button_set(GtkSheet sheet, gint row); static void row_button_release(GtkSheet sheet, gint row);

/ global sheet button / static void _global_sheet_button_create(GtkSheet sheet); static void _global_sheet_button_size_allocate(GtkSheet sheet);

/ Attributes routines /

static void gtk_sheet_set_cell_attributes(GtkSheet sheet, gint row, gint col, GtkSheetCellAttr attributes); static void init_attributes(GtkSheet sheet, gint col, GtkSheetCellAttr *attributes);

/ Memory allocation routines / static void gtk_sheet_real_range_clear(GtkSheet sheet, const GtkSheetRange range, gboolean delete); static void gtk_sheet_real_cell_clear(GtkSheet *sheet, gint row, gint column, gboolean delete);

static GtkSheetCell *gtk_sheet_cell_new(void);

static void AddRows(GtkSheet sheet, gint position, gint nrows); static void AddColumns(GtkSheet sheet, gint position, gint ncols); static void InsertRow(GtkSheet sheet, gint row, gint nrows); static void InsertColumn(GtkSheet sheet, gint col, gint ncols); static void DeleteRow(GtkSheet sheet, gint row, gint nrows); static void DeleteColumn(GtkSheet sheet, gint col, gint ncols); static gint GrowSheet(GtkSheet sheet, gint newrows, gint newcols); static void CheckBounds(GtkSheet sheet, gint row, gint col); static void CheckCellData(GtkSheet *sheet, const gint row, const gint col);

/ Container Functions / static void gtk_sheet_remove_handler( GtkContainer container, GtkWidget widget); static void gtk_sheet_realize_child( GtkSheet sheet, GtkSheetChild child); static void gtk_sheet_position_child( GtkSheet sheet, GtkSheetChild child); static void gtk_sheet_row_size_request( GtkSheet sheet, gint row, guint requisition);

/ GtkBuildableIface /

/*

void gtk_sheet_buildable_add_child_internal(GtkSheet sheet, GtkSheetColumn child, const char *name) {

g_return_if_fail(GTK_IS_SHEET(sheet));
g_return_if_fail(GTK_IS_SHEET_COLUMN(child));

gtk_sheet_add_column(sheet, 1);
int col = gtk_sheet_get_columns_count(sheet) - 1;

if (sheet->column[col])
{
COLPTR(sheet, col)->sheet = NULL;

g_object_unref(sheet->column[col]);
sheet->column[col] = NULL;
}

child->sheet = sheet;
sheet->column[col] = child;

g_object_ref_sink(G_OBJECT(child));

if GTK_SHEET_DEBUG_BUILDER > 0

g_debug("%s(%d): %p %s child %s %p name %s m %d r %d v %d",
    __FUNCTION__, __LINE__,
    sheet, gtk_widget_get_name(GTK_WIDGET(sheet)),
    G_OBJECT_TYPE_NAME(child), child, 
    name ? name : "NULL",
    gtk_widget_get_mapped(GTK_WIDGET(child)),
gtk_widget_get_realized(GTK_WIDGET(child)),
gtk_widget_get_visible(GTK_WIDGET(child))
);

endif

/* we always set the parent in order to track into what sheet the column belongs,
   which leads to problems with invisible columns.
   When trying to set them visible, Gtk 2.24.5 terminates the application with
   ? Gtk - gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
   see also the fix in gtk_sheet_column_set_visibility()
   */

DEBUG_WIDGET_SET_PARENT(child, sheet);
gtk_widget_set_parent(GTK_WIDGET(child), GTK_WIDGET(sheet));

if (gtk_widget_get_realized(GTK_WIDGET(sheet))
    && GTK_IS_SHEET_COLUMN(child))
{
    _gtk_sheet_column_realize(child, sheet);

    _gtk_sheet_column_check_windows(child, sheet);
}

if (name)
gtk_widget_set_name(GTK_WIDGET(child), name);

_gtk_sheet_reset_text_column(sheet, col);
_gtk_sheet_recalc_left_xpixels(sheet);

}

static void gtk_sheet_buildable_add_child( GtkBuildable buildable, GtkBuilder builder, GObject child, const gchar type) { const gchar *name = gtk_widget_get_name(GTK_WIDGET(child));

if GTK_SHEET_DEBUG_BUILDER > 0

g_debug("gtk_sheet_buildable_add_child %p: %s type %s", child,
name ? name : "NULL",
type ? type : "NULL");

endif

GtkSheet *sheet = GTK_SHEET(buildable);
GtkSheetColumn *newcol = GTK_SHEET_COLUMN(child);

if GTK_SHEET_DEBUG_BUILDER > 0

{
gchar *strval;

g_object_get(G_OBJECT(newcol), "label", &strval, NULL);
    g_debug("gtk_sheet_buildable_add_child: label=%s",
        strval ? strval : "NULL");

g_free(strval);
}

endif

gtk_sheet_buildable_add_child_internal(sheet, newcol, name);

}

static void gtk_sheet_buildable_init(GtkBuildableIface *iface) {

if GTK_SHEET_DEBUG_BUILDER > 0

g_debug("gtk_sheet_buildable_init");

endif

iface->add_child = gtk_sheet_buildable_add_child;

}

static GtkSheetArea gtk_sheet_get_area_at(GtkSheet *sheet, gint x, gint y) { if (sheet->column_titles_visible && (y < sheet->column_title_area.height)) { if (sheet->row_titles_visible && (x < sheet->row_title_area.width)) return (ON_SHEET_BUTTON_AREA);

return (ON_COLUMN_TITLES_AREA);
}
else
{
if (sheet->row_titles_visible && (x < sheet->row_title_area.width))
    return (ON_ROW_TITLES_AREA);
}
return (ON_CELL_AREA);

}

/*

/ Type initialisation /

static GtkContainerClass *sheet_parent_class = NULL;

GType gtk_sheet_get_type(void) { static GType sheet_type = 0;

if (!sheet_type)
{
static const GTypeInfo sheet_info =
{
    sizeof(GtkSheetClass),
    NULL,
    NULL,
    (GClassInitFunc)gtk_sheet_class_init,
    NULL,
    NULL,
    sizeof(GtkSheet),
    0,
    (GInstanceInitFunc)gtk_sheet_init,
    NULL,
};

sheet_type = g_type_register_static(gtk_container_get_type(),
    "GtkSheet",
    &sheet_info,
    0);

static const GInterfaceInfo interface_info = {
    (GInterfaceInitFunc)gtk_sheet_buildable_init,
    (GInterfaceFinalizeFunc)NULL,
    (gpointer)NULL 
};

g_type_add_interface_static(sheet_type, GTK_TYPE_BUILDABLE,
    &interface_info);

static const GInterfaceInfo scrollable_info = {
    (GInterfaceInitFunc) NULL,
    (GInterfaceFinalizeFunc) NULL,
    (gpointer) NULL
    };

    g_type_add_interface_static(sheet_type, GTK_TYPE_SCROLLABLE,
    &scrollable_info);
}
return (sheet_type);

}

static GtkSheetRange gtk_sheet_range_copy(const GtkSheetRange range) { GtkSheetRange *new_range;

g_return_val_if_fail(range != NULL, NULL);

new_range = g_new(GtkSheetRange, 1);

*new_range = *range;

return (new_range);

}

static void gtk_sheet_range_free(GtkSheetRange *range) { g_return_if_fail(range != NULL);

g_free(range);

}

GType gtk_sheet_range_get_type(void) { static GType sheet_range_type = 0;

if (!sheet_range_type)
{
sheet_range_type = g_boxed_type_register_static("GtkSheetRange", (GBoxedCopyFunc)gtk_sheet_range_copy, (GBoxedFreeFunc)gtk_sheet_range_free);
}
return (sheet_range_type);

}

/**

if !GTK_CHECK_VERSION(2,24,0)

else if (entry_type == GTK_TYPE_COMBO_BOX_ENTRY)
return (GTK_SHEET_ENTRY_TYPE_GTK_COMBO_BOX_ENTRY);

endif

if !GTK_CHECK_VERSION(2,4,0)

else if (entry_type == GTK_TYPE_COMBO)
return (GTK_SHEET_ENTRY_TYPE_GTK_COMBO);

endif

return (GTK_SHEET_ENTRY_TYPE_DEFAULT);

}

/**

if !GTK_CHECK_VERSION(2,24,0)

case GTK_SHEET_ENTRY_TYPE_GTK_COMBO_BOX_ENTRY:
    return (GTK_TYPE_COMBO_BOX_ENTRY);

endif

if !GTK_CHECK_VERSION(2,4,0)

case GTK_SHEET_ENTRY_TYPE_GTK_COMBO:
    return (GTK_TYPE_COMBO);

endif

default:
    break;
}
return (G_TYPE_NONE);

}

/*

static void gtk_sheet_set_property(GObject object, guint property_id, const GValue value, GParamSpec pspec) { GtkSheet sheet = GTK_SHEET(object);

if GTK_SHEET_DEBUG_PROPERTIES > 0

g_debug("gtk_sheet_set_property: %s", pspec->name);

endif

switch(property_id)
{
case PROP_GTK_SHEET_TITLE:
    gtk_sheet_set_title(sheet, g_value_get_string(value));
    break;

case PROP_GTK_SHEET_DESCRIPTION:
    gtk_sheet_set_description(sheet, g_value_get_string(value));
    break;

case PROP_GTK_SHEET_NROWS:
    {
    gint newval = g_value_get_int(value);

    if (newval < 0)
        break;

if GTK_SHEET_DEBUG_PROPERTIES > 0

    g_debug("gtk_sheet_set_property: newval = %d sheet->maxrow %d", newval, sheet->maxrow);

endif

    if (newval < (sheet->maxrow + 1))
    {
        gtk_sheet_delete_rows(sheet, newval, (sheet->maxrow + 1) - newval);
        _gtk_sheet_recalc_view_range(sheet);
    }
    else if (newval > (sheet->maxrow + 1))
    {
        gtk_sheet_add_row(sheet, newval - (sheet->maxrow + 1));
        _gtk_sheet_recalc_view_range(sheet);
    }
    }
    break;

case PROP_GTK_SHEET_NCOLS:
    {
    gint newval = g_value_get_int(value);

    if (newval < 0)
        break;

if GTK_SHEET_DEBUG_PROPERTIES > 0

    g_debug("gtk_sheet_set_property: newval = %d sheet->maxcol %d", newval, sheet->maxcol);

endif

    if (newval < (sheet->maxcol + 1))
    {
        gtk_sheet_delete_columns(sheet, newval, (sheet->maxcol + 1) - newval);
        _gtk_sheet_recalc_view_range(sheet);
    }
    else if (newval > (sheet->maxcol + 1))
    {
        gtk_sheet_add_column(sheet, newval - (sheet->maxcol + 1));
        _gtk_sheet_recalc_view_range(sheet);
    }
    }
    break;

case PROP_GTK_SHEET_LOCKED:
    gtk_sheet_set_locked(sheet, g_value_get_boolean(value));
    break;

case PROP_GTK_SHEET_SELECTION_MODE:
    gtk_sheet_set_selection_mode(sheet, g_value_get_enum(value));
    break;

case PROP_GTK_SHEET_AUTO_RESIZE:
    gtk_sheet_set_autoresize(sheet, g_value_get_boolean(value));
    break;

case PROP_GTK_SHEET_AUTO_RESIZE_ROWS:
    gtk_sheet_set_autoresize_rows(sheet, g_value_get_boolean(value));
    break;

case PROP_GTK_SHEET_AUTO_RESIZE_COLUMNS:
    gtk_sheet_set_autoresize_columns(sheet, g_value_get_boolean(value));
    break;

case PROP_GTK_SHEET_AUTO_SCROLL:
    gtk_sheet_set_autoscroll(sheet, g_value_get_boolean(value));
    break;

case PROP_GTK_SHEET_CLIP_TEXT:
    gtk_sheet_set_clip_text(sheet, g_value_get_boolean(value));
    break;

case PROP_GTK_SHEET_JUSTIFY_ENTRY:
    gtk_sheet_set_justify_entry(sheet, g_value_get_boolean(value));
    break;

case PROP_GTK_SHEET_BG_COLOR:
    gtk_sheet_set_background(sheet, g_value_get_boxed(value));
    break;

case PROP_GTK_SHEET_GRID_VISIBLE:
    gtk_sheet_show_grid(sheet, g_value_get_boolean(value));
    break;

case PROP_GTK_SHEET_GRID_COLOR:
    gtk_sheet_set_grid(sheet, g_value_get_boxed(value));
    break;

case PROP_GTK_SHEET_COLUMN_TITLES_VISIBLE:
    if (g_value_get_boolean(value))
    gtk_sheet_show_column_titles(sheet);
    else
    gtk_sheet_hide_column_titles(sheet);
    break;

case PROP_GTK_SHEET_COLUMNS_RESIZABLE:
    gtk_sheet_columns_set_resizable(sheet, g_value_get_boolean(value));
    break;

case PROP_GTK_SHEET_COLUMN_TITLES_HEIGHT:
    gtk_sheet_set_column_titles_height(sheet, g_value_get_uint(value));
    break;

case PROP_GTK_SHEET_ROW_TITLES_VISIBLE:
    if (g_value_get_boolean(value))
    gtk_sheet_show_row_titles(sheet);
    else
    gtk_sheet_hide_row_titles(sheet);
    break;

case PROP_GTK_SHEET_ROWS_RESIZABLE:
    gtk_sheet_rows_set_resizable(sheet, g_value_get_boolean(value));
    break;

case PROP_GTK_SHEET_ROW_TITLES_WIDTH:
    gtk_sheet_set_row_titles_width(sheet, g_value_get_uint(value));
    break;

case PROP_GTK_SHEET_ENTRY_TYPE:
    {
    GType entry_type = _gtk_sheet_entry_type_to_gtype(g_value_get_enum(value));

    sheet->entry_type = entry_type;  /* wanted entry type */
    gtk_sheet_change_entry(sheet, entry_type);
    }
    break;

case PROP_GTK_SHEET_VJUST:
    gtk_sheet_set_vjustification(sheet, g_value_get_enum(value));
    break;

case PROP_GTK_SHEET_HADJUSTMENT:
    gtk_sheet_set_hadjustment(sheet, g_value_get_object (value));
    break;

case PROP_GTK_SHEET_VADJUSTMENT:
    gtk_sheet_set_vadjustment(sheet, g_value_get_object (value));
    break;

case PROP_GTK_SHEET_HSCROLL_POLICY:
    if (sheet->hscroll_policy != g_value_get_enum (value))
    {
    sheet->hscroll_policy = g_value_get_enum (value);
    gtk_widget_queue_resize (GTK_WIDGET (sheet));
    g_object_notify_by_pspec (object, pspec);
      }
    break;

case PROP_GTK_SHEET_VSCROLL_POLICY:
    if (sheet->vscroll_policy != g_value_get_enum (value))
      {
    sheet->vscroll_policy = g_value_get_enum (value);
    gtk_widget_queue_resize (GTK_WIDGET (sheet));
    g_object_notify_by_pspec (object, pspec);
      }
    break;

default:
    /* We don't have any other property... */
    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
    break;
}
_gtk_sheet_range_draw(sheet, NULL, TRUE);

/* this one will not work, it simply does noop

gtk_widget_queue_draw(GTK_WIDGET(sheet));*/ }

static void gtk_sheet_get_property(GObject object, guint property_id, GValue value, GParamSpec pspec) { GtkSheet sheet = GTK_SHEET(object);

switch(property_id)
{
case PROP_GTK_SHEET_TITLE:
    g_value_set_string(value, sheet->title);
    break;

case PROP_GTK_SHEET_DESCRIPTION:
    g_value_set_string(value, sheet->description);
    break;

case PROP_GTK_SHEET_NROWS:
    g_value_set_int(value, sheet->maxrow + 1);
    break;

case PROP_GTK_SHEET_NCOLS:
    g_value_set_int(value, sheet->maxcol + 1);
    break;

case PROP_GTK_SHEET_LOCKED:
    g_value_set_boolean(value, sheet->locked);
    break;

case PROP_GTK_SHEET_SELECTION_MODE:
    g_value_set_enum(value, sheet->selection_mode);
    break;

case PROP_GTK_SHEET_AUTO_RESIZE:
    g_value_set_boolean(value, gtk_sheet_autoresize(sheet));
    break;

case PROP_GTK_SHEET_AUTO_RESIZE_ROWS:
    g_value_set_boolean(value, gtk_sheet_autoresize_rows(sheet));
    break;

case PROP_GTK_SHEET_AUTO_RESIZE_COLUMNS:
    g_value_set_boolean(value, gtk_sheet_autoresize_columns(sheet));
    break;

case PROP_GTK_SHEET_AUTO_SCROLL:
    g_value_set_boolean(value, sheet->autoscroll);
    break;

case PROP_GTK_SHEET_CLIP_TEXT:
    g_value_set_boolean(value, sheet->clip_text);
    break;

case PROP_GTK_SHEET_JUSTIFY_ENTRY:
    g_value_set_boolean(value, sheet->justify_entry);
    break;

case PROP_GTK_SHEET_BG_COLOR:
    g_value_set_boxed(value, &sheet->bg_color);
    break;

case PROP_GTK_SHEET_GRID_VISIBLE:
    g_value_set_boolean(value, sheet->show_grid);
    break;

case PROP_GTK_SHEET_GRID_COLOR:
    g_value_set_boxed(value, &sheet->grid_color);
    break;

case PROP_GTK_SHEET_COLUMN_TITLES_VISIBLE:
    g_value_set_boolean(value, sheet->column_titles_visible);
    break;

case PROP_GTK_SHEET_COLUMNS_RESIZABLE:
    g_value_set_boolean(value, sheet->columns_resizable);
    break;

case PROP_GTK_SHEET_COLUMN_TITLES_HEIGHT:
    g_value_set_uint(value, sheet->column_title_area.height);
    break;

case PROP_GTK_SHEET_ROW_TITLES_VISIBLE:
    g_value_set_boolean(value, sheet->row_titles_visible);
    break;

case PROP_GTK_SHEET_ROWS_RESIZABLE:
    g_value_set_boolean(value, sheet->rows_resizable);
    break;

case PROP_GTK_SHEET_ROW_TITLES_WIDTH:
    g_value_set_uint(value, sheet->row_title_area.width);
    break;

case PROP_GTK_SHEET_ENTRY_TYPE:
    g_value_set_enum(value, _gtk_sheet_entry_type_from_gtype(sheet->entry_type));
    break;

case PROP_GTK_SHEET_VJUST:
    g_value_set_enum(value, sheet->vjust);
    break;

case PROP_GTK_SHEET_HADJUSTMENT:
    g_value_set_object(value, sheet->hadjustment);
    break;

case PROP_GTK_SHEET_VADJUSTMENT:
    g_value_set_object(value, sheet->vadjustment);
    break;

case PROP_GTK_SHEET_HSCROLL_POLICY:
    g_value_set_enum (value, sheet->hscroll_policy);
    break;

case P
songqingshan commented 3 years ago

Hello FPaquet, I know that you join two projects: gtkextra and gtksheet. gtkextra includes a gtksheet. I want to know what are differences between the gtksheet in the gtkextra and the single gtksheet? Which one should we use? I found the multiple issues in the single gtksheet version 4.2.0, 4.3.0 and 4.3.5. I want to report them. But I can not report them in git like before. I do not why? Thanks, Song


From: Fredy Paquet notifications@github.com Sent: March 9, 2019 5:37 AM To: fpaquet/gtksheet gtksheet@noreply.github.com Cc: songqingshan shans123@hotmail.com; Author author@noreply.github.com Subject: Re: [fpaquet/gtksheet] gtksheet crashes (#10)

I've now released V4.3.0 for Gtk3 (branch gtk3) https://github.com/fpaquet/gtksheet/releases/tag/V4.3.0

And published online docs V4 https://fpaquet.github.io/gtksheet/reference/index.html

This should fix the crash issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/fpaquet/gtksheet/issues/10#issuecomment-471169673, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ApTBUxuwqHSiVBt7ZpmCu1U0iR9fvQTBks5vU5zhgaJpZM4ZdUr8.

fpaquet commented 3 years ago

Hello Song Nobody was taking care of the plot widgets in GtkExtra. So i moved the sheet code into the GtkSheet project. GtkExtra is dead and unmaintained. You should be able to report bugs to the GtkSheet project.

I can not report them in git like before.

I'm not aware of any problems with the github bug tracking system. Someone created a new issue no 26 on 28 Jul 2020.

Can you describe what happens when you try to create a new issue?

songqingshan commented 3 years ago

Hello Fredy,

I appreciate your reply. the plot widgets in GtkExtra are very useful and important in the scientific community. I believe that the reason "Nobody was taking care of the plot widgets in GtkExtra" is just because nobody knows. Can GtkExtra be used for Gtk3? If not, what do we need to do for advancing GtkExtra for Gtk3? any suggestions? I will try to report some glitches and bugs in the gtksheet in git later. If still can not do it, I will copy them to you. Thank you, Song


From: Fredy Paquet notifications@github.com Sent: September 19, 2020 12:54 AM To: fpaquet/gtksheet gtksheet@noreply.github.com Cc: songqingshan shans123@hotmail.com; Author author@noreply.github.com Subject: Re: [fpaquet/gtksheet] gtksheet crashes (#10)

Hello Song Nobody was taking care of the plot widgets in GtkExtra. So i moved the sheet code into the GtkSheet project. GtkExtra is dead and unmaintained. You should be able to report bugs to the GtkSheet project.

I can not report them in git like before.

I'm not aware of any problems with the github bug tracking system. Someone created a new issue no 26 on 28 Jul 2020.

Can you describe what happens when you try to create a new issue?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/fpaquet/gtksheet/issues/10#issuecomment-695169740, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKKMCU2FK5FOYMDAYTS7AE3SGRBQVANCNFSM4GLVJL6A.

fpaquet commented 3 years ago

Hello Song

The main repo of GtkExtra is hosted on SourceForge. I was publishing request for a new maintainer in April 2018. http://gtkextra.sourceforge.net/cms/index.php?option=com_content&view=article&id=63:new-maintainer-searched&catid=3:news

A google search reveals multiple forks and also a discussion about Gtk3 port of GtkExtra https://stackoverflow.com/questions/22907417/can-gtkextra-work-with-gtk3

Before splitting the GtkSheet into a separate project, i was starting to add support for Gtk3. Have a look at the gtk3 branch there. I managed to get ONE of the plot widgets running with Gtk3, but capitulated on the other plot widgets due to lack of documentation and deeper understanding of the functionality.

Adrian E. Feiguin (the initiator of GtkExtra) quit the project more than 10 years ago. Since then, he didn't respond to my e-mails any further.

songqingshan commented 3 years ago

Hello Fredy Paquet, I appreciate your insistency and contribution to gtkextra and gtksheet. I also believe many people do so. Although gtksheet still has some glitches and bugs, it has been used in some applications. Without your effort, there is not today's gtksheet. Regarding gtkextra, You mentioned "Have a look at the gtk3 branch there. I managed to get ONE of the plot widgets running with Gtk3,...". But I can not find the gtk3 branch. Can you send me a link? I would like to take a look at it. Thanks, Song


From: Fredy Paquet notifications@github.com Sent: September 20, 2020 2:30 AM To: fpaquet/gtksheet gtksheet@noreply.github.com Cc: songqingshan shans123@hotmail.com; Author author@noreply.github.com Subject: Re: [fpaquet/gtksheet] gtksheet crashes (#10)

Hello Song

The main repo of GtkExtra is hosted on SourceForge. I was publishing request for a new maintainer in April 2018. http://gtkextra.sourceforge.net/cms/index.php?option=com_content&view=article&id=63:new-maintainer-searched&catid=3:news

A google search reveals multiple forks and also a discussion about Gtk3 port of GtkExtra https://stackoverflow.com/questions/22907417/can-gtkextra-work-with-gtk3

Before splitting the GtkSheet into a separate project, i was starting to add support for Gtk3. Have a look at the gtk3 branch there. I managed to get ONE of the plot widgets running with Gtk3, but capitulated on the other plot widgets due to lack of documentation and deeper understanding of the functionality.

Adrian E. Feiguin (the initiator of GtkExtra) quit the project more than 10 years ago. Since then, he didn't respond to my e-mails any further.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/fpaquet/gtksheet/issues/10#issuecomment-695755614, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKKMCUYPM5H7ONMTXLC6Z4LSGWVSBANCNFSM4GLVJL6A.

fpaquet commented 3 years ago

When you browse sf repo, you can see branches on the left side https://sourceforge.net/p/gtkextra/gtkextra-3/ci/master/tree/

Or simply clone the repo, then use 'git checkout gtk3'

songqingshan commented 3 years ago

Hello Fredy Paquet, I appreciate your help. I down load this version and compile it successfully yesterday. Since README says it requires GTK+ 2.14.4, I assumed that I down load the wrong version. Thanks for your clarifying it.

I compile and try the gtkextra-3, gtkextra-3.3.4,gtksheet-4.2.0, gtksheet-4.3.0, and gtksheet-4.3.5. The grid in gtksheet-4.3.0 and gtksheet-4.3.5 did not show (missing). The grid in gtkextra-3, gtkextra-3.3.4,and gtksheet-4.2.0 shows well. I try to report other glitches and bugs in gtksheet-4.3.5 again, but new issue button still is dead. Thanks for your help. Regards, Song


From: Fredy Paquet notifications@github.com Sent: September 20, 2020 11:58 AM To: fpaquet/gtksheet gtksheet@noreply.github.com Cc: songqingshan shans123@hotmail.com; Author author@noreply.github.com Subject: Re: [fpaquet/gtksheet] gtksheet crashes (#10)

When you browse sf repo, you can see branches on the left side https://sourceforge.net/p/gtkextra/gtkextra-3/ci/master/tree/

Or simply clone the repo, then use 'git checkout gtk3'

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/fpaquet/gtksheet/issues/10#issuecomment-695809857, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKKMCU66JFBX62TSOIDDYXDSGYYCZANCNFSM4GLVJL6A.

fpaquet commented 3 years ago

Are you using this page for GtkSheet issues? https://github.com/fpaquet/gtksheet/issues

I can see a green button "New Issue", which is active. The same button also on top of this page here, it's active.