X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-data-window.c;h=ad7e9250f7d404389aefaa0e79bf55e23d2f32d3;hb=ff5de86ff88b3d3c8552ac0e29c94f4ce3a4f2eb;hp=5cb7f1b74500913ab665ebd87c4cda963fbe5176;hpb=174fe8e41ef09534218803189529cbd797750934;p=pspp diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c index 5cb7f1b745..ad7e9250f7 100644 --- a/src/ui/gui/psppire-data-window.c +++ b/src/ui/gui/psppire-data-window.c @@ -101,10 +101,6 @@ struct session *the_session; struct ll_list all_data_windows = LL_INITIALIZER (all_data_windows); -static void psppire_data_window_class_init (PsppireDataWindowClass *class); -static void psppire_data_window_init (PsppireDataWindow *data_editor); - - static void psppire_data_window_iface_init (PsppireWindowIface *iface); static void psppire_data_window_dispose (GObject *object); @@ -118,45 +114,10 @@ static void psppire_data_window_get_property (GObject *object, GValue *value, GParamSpec *pspec); -GType -psppire_data_window_get_type (void) -{ - static GType psppire_data_window_type = 0; - if (!psppire_data_window_type) - { - static const GTypeInfo psppire_data_window_info = - { - sizeof (PsppireDataWindowClass), - NULL, - NULL, - (GClassInitFunc)psppire_data_window_class_init, - (GClassFinalizeFunc) NULL, - NULL, - sizeof (PsppireDataWindow), - 0, - (GInstanceInitFunc) psppire_data_window_init, - }; - - static const GInterfaceInfo window_interface_info = - { - (GInterfaceInitFunc) psppire_data_window_iface_init, - NULL, - NULL - }; - - psppire_data_window_type = - g_type_register_static (PSPPIRE_TYPE_WINDOW, "PsppireDataWindow", - &psppire_data_window_info, 0); - - - g_type_add_interface_static (psppire_data_window_type, - PSPPIRE_TYPE_WINDOW_MODEL, - &window_interface_info); - } - - return psppire_data_window_type; -} +G_DEFINE_TYPE_WITH_CODE (PsppireDataWindow, psppire_data_window, PSPPIRE_TYPE_WINDOW, + G_IMPLEMENT_INTERFACE (PSPPIRE_TYPE_WINDOW_MODEL, + psppire_data_window_iface_init)) static GObjectClass *parent_class ; @@ -253,7 +214,7 @@ on_split_change (PsppireDict *dict, gpointer data) { PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data); - size_t n_split_vars = dict_get_split_cnt (dict->dict); + size_t n_split_vars = dict_get_n_splits (dict->dict); GtkWidget *split_status_area = get_widget_assert (de->builder, "split-file-status-area"); @@ -938,7 +899,7 @@ set_unsaved (gpointer w) static void enable_save (PsppireDataWindow *dw) { - gboolean enable = psppire_dict_get_var_cnt (dw->dict) > 0; + gboolean enable = psppire_dict_get_n_vars (dw->dict) > 0; GAction *save_as = g_action_map_lookup_action (G_ACTION_MAP (dw), "save-as"); GAction *save = g_action_map_lookup_action (G_ACTION_MAP (dw), "save"); @@ -1073,11 +1034,22 @@ on_cut (PsppireDataWindow *dw) SswSheet *sheet = SSW_SHEET (dw->data_editor->data_sheet); SswRange sel = *sheet->selection; -#if (SSW_SHEET_API_VERSION >= 1) - if ((ssw_sheet_get_api_version() >= 1) && ssw_sheet_try_cut (sheet)) + if (ssw_sheet_try_cut (sheet)) return; -#endif + if (sel.start_x > sel.end_x) + { + gint tmp = sel.start_x; + sel.start_x = sel.end_x; + sel.end_x = tmp; + } + if (sel.start_y > sel.end_y) + { + gint tmp = sel.start_y; + sel.start_y = sel.end_y; + sel.end_y = tmp; + } + GtkClipboard *clip = gtk_clipboard_get_for_display (gtk_widget_get_display (GTK_WIDGET (dw)), GDK_SELECTION_CLIPBOARD); @@ -1089,8 +1061,10 @@ on_cut (PsppireDataWindow *dw) for (x = sel.start_x ; x <= sel.end_x; ++x) { const struct variable * var = psppire_dict_get_variable (dict, x); + gboolean use_value_label = FALSE; + g_object_get (dw->data_editor, "value-labels", &use_value_label, NULL); gchar *s = psppire_data_store_get_string (dw->data_editor->data_store, - y, var, FALSE); + y, var, use_value_label); g_string_append (str, s); if (x < sel.end_x) g_string_append (str, "\t"); @@ -1946,7 +1920,7 @@ psppire_data_window_new (struct dataset *ds) bool psppire_data_window_is_empty (PsppireDataWindow *dw) { - return psppire_dict_get_var_cnt (dw->dict) == 0; + return psppire_dict_get_n_vars (dw->dict) == 0; }