/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016 Free Software Foundation
+ Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014,
+ 2016, 2017 Free Software Foundation
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
#include "ui/gui/helper.h"
#include "ui/gui/psppire-import-assistant.h"
#include "ui/gui/psppire-data-window.h"
+#include "ui/gui/psppire-data-editor.h"
#include "ui/gui/psppire-dialog-action.h"
#include "ui/gui/psppire-encoding-selector.h"
#include "ui/gui/psppire-syntax-window.h"
#include "ui/gui/psppire-window.h"
-#include "ui/gui/psppire-data-sheet.h"
-#include "ui/gui/psppire-var-sheet.h"
#include "ui/gui/windows-menu.h"
#include "ui/gui/goto-case-dialog.h"
#include "ui/gui/psppire.h"
#include "gl/c-strcasestr.h"
#include "gl/xvasprintf.h"
+#include <ssw-sheet.h>
+
#include "find-dialog.h"
#include "options-dialog.h"
#include "psppire-dialog-action-1sks.h"
#include "psppire-dialog-action-frequencies.h"
#include "psppire-dialog-action-histogram.h"
#include "psppire-dialog-action-indep-samps.h"
+#include "psppire-dialog-action-k-independent.h"
#include "psppire-dialog-action-k-related.h"
#include "psppire-dialog-action-kmeans.h"
#include "psppire-dialog-action-logistic.h"
"transform-pending");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
- transformations_pending);
+ transformations_pending);
}
if ( transformations_pending)
{
gchar *utf8_file_name;
struct string filename;
-
+
utf8_file_name = g_filename_to_utf8 (file_name, -1, NULL, NULL, NULL);
if (NULL == utf8_file_name)
return FALSE;
- ds_init_empty (&filename);
+ ds_init_empty (&filename);
syntax_gen_string (&filename, ss_cstr (utf8_file_name));
-
+
g_free (utf8_file_name);
if (encoding && encoding[0])
mime_type = "application/x-spss-por";
else if (name_has_sav_suffix (file_name))
mime_type = "application/x-spss-sav";
-
+
add_most_recent (file_name, mime_type, encoding);
}
status_bar_activate (GAction *action, GVariant *param, PsppireDataWindow *de)
{
GtkWidget *statusbar = get_widget_assert (de->builder, "status-bar");
-
+
GVariant *state = g_action_get_state (action);
const gboolean visible = g_variant_get_boolean (state);
g_action_change_state (action, g_variant_new_boolean (!visible));
gtk_widget_show (GTK_WIDGET (de->mi_clear_cases));
break;
-
+
case 1:
g_action_change_state (action, g_variant_new_string ("VARS"));
gtk_widget_hide (GTK_WIDGET (de->ti_insert_case));
gtk_widget_hide (GTK_WIDGET (de->mi_find));
gtk_widget_hide (GTK_WIDGET (de->mi_find_separator));
gtk_widget_hide (GTK_WIDGET (de->mi_clear_cases));
-
+
break;
- }
+ }
}
GtkWidget *dialog = gtk_font_chooser_dialog_new (NULL, GTK_WINDOW (toplevel));
GtkStyleContext *style = gtk_widget_get_style_context (GTK_WIDGET(de->data_editor));
const PangoFontDescription *current_font ;
-
+
gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL, "font", ¤t_font, NULL);
gtk_font_chooser_set_font_desc (GTK_FONT_CHOOSER (dialog), current_font);
GVariant *new_state = g_action_get_state (action);
labels_active = g_variant_get_boolean (new_state);
g_object_set (de->data_editor, "value-labels", labels_active, NULL);
-
+
gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (de->ti_value_labels_button),
labels_active);
}
free (encoding);
- if ( psppire_window_load (PSPPIRE_WINDOW (se), file, encoding, NULL) )
+ if ( psppire_window_load (PSPPIRE_WINDOW (se), file, encoding, NULL) )
gtk_widget_show (se);
else
gtk_widget_destroy (se);
GtkWidget *w = psppire_import_assistant_new (GTK_WINDOW (dw));
PsppireImportAssistant *asst = PSPPIRE_IMPORT_ASSISTANT (w);
gtk_widget_show_all (w);
-
- asst->main_loop = g_main_loop_new (NULL, TRUE);
- g_main_loop_run (asst->main_loop);
- g_main_loop_unref (asst->main_loop);
-
- if (!asst->file_name)
- goto end;
-
- switch (asst->response)
+
+ int response = psppire_import_assistant_run (asst);
+
+ switch (response)
{
case GTK_RESPONSE_APPLY:
{
default:
break;
}
-
- end:
+
gtk_widget_destroy (GTK_WIDGET (asst));
}
GAction *act = g_object_new (type,
"top-level", de,
NULL);
-
+
g_action_map_add_action (G_ACTION_MAP (de), act);
}
connect_action_to_menuitem (GActionMap *map, const gchar *action_name, GtkWidget *w, const gchar *accel)
{
GAction *a = g_action_map_lookup_action (map, action_name);
-
+
if (NULL == a)
g_error ("Action \"%s\" not found in map", action_name);
detailed_action_name = g_strdup_printf ("win.%s", action_name);
else if (GTK_IS_APPLICATION (map))
detailed_action_name = g_strdup_printf ("app.%s", action_name);
-
+
gtk_application_set_accels_for_action (app,
detailed_action_name,
accels);
free (detailed_action_name);
}
-
+
g_signal_connect_swapped (w, "activate", G_CALLBACK (g_action_activate_null), a);
}
static void
-set_data_page (PsppireDataWindow *dw)
+on_realize (PsppireDataWindow *dw)
{
gtk_notebook_set_current_page (GTK_NOTEBOOK (dw->data_editor), 1);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (dw->data_editor), 0);
}
on_cut (PsppireDataWindow *dw)
{
int p = gtk_notebook_get_current_page (GTK_NOTEBOOK (dw->data_editor));
- if (p == 0)
- {
- PsppireDataSheet *ds = psppire_data_editor_get_active_data_sheet (dw->data_editor);
- psppire_data_sheet_edit_cut (ds);
+ if (p == PSPPIRE_DATA_EDITOR_DATA_VIEW)
+ {
+ PsppireDict *dict = NULL;
+ g_object_get (dw->data_editor, "dictionary", &dict, NULL);
+
+ gint x, y;
+ SswSheet *sheet = SSW_SHEET (dw->data_editor->data_sheet);
+ SswRange sel = *sheet->selection;
+
+ GtkClipboard *clip =
+ gtk_clipboard_get_for_display (gtk_widget_get_display (GTK_WIDGET (dw)),
+ GDK_SELECTION_CLIPBOARD);
+
+ /* Save the selected area to a string */
+ GString *str = g_string_new ("");
+ for (y = sel.start_y ; y <= sel.end_y; ++y)
+ {
+ for (x = sel.start_x ; x <= sel.end_x; ++x)
+ {
+ const struct variable * var = psppire_dict_get_variable (dict, x);
+ gchar *s = psppire_data_store_get_string (dw->data_editor->data_store,
+ y, var, FALSE);
+ g_string_append (str, s);
+ g_string_append (str, "\t");
+ g_free (s);
+ }
+ g_string_append (str, "\n");
+ }
+
+ gtk_clipboard_set_text (clip, str->str, str->len);
+ g_string_free (str, TRUE);
+
+ /* Now fill the selected area with SYSMIS */
+ union value sm ;
+ sm.f = SYSMIS;
+ for (x = sel.start_x ; x <= sel.end_x; ++x)
+ {
+ const struct variable * var = psppire_dict_get_variable (dict, x);
+ for (y = sel.start_y ; y <= sel.end_y; ++y)
+ {
+ psppire_data_store_set_value (dw->data_editor->data_store,
+ y,
+ var, &sm);
+ }
+ }
+
}
}
on_copy (PsppireDataWindow *dw)
{
int p = gtk_notebook_get_current_page (GTK_NOTEBOOK (dw->data_editor));
- if (p == 0)
+ if (p == PSPPIRE_DATA_EDITOR_DATA_VIEW)
{
- PsppireDataSheet *ds = psppire_data_editor_get_active_data_sheet (dw->data_editor);
- psppire_data_sheet_edit_copy (ds);
+ GtkClipboard *clip =
+ gtk_clipboard_get_for_display (gtk_widget_get_display (GTK_WIDGET (dw)),
+ GDK_SELECTION_CLIPBOARD);
+
+ ssw_sheet_set_clip (SSW_SHEET (dw->data_editor->data_sheet), clip);
}
}
on_paste (PsppireDataWindow *dw)
{
int p = gtk_notebook_get_current_page (GTK_NOTEBOOK (dw->data_editor));
- if (p == 0)
+ if (p == PSPPIRE_DATA_EDITOR_DATA_VIEW)
{
- PsppireDataSheet *ds = psppire_data_editor_get_active_data_sheet (dw->data_editor);
- psppire_data_sheet_edit_paste (ds);
+ psppire_data_editor_paste (dw->data_editor);
}
}
-
static void
on_clear_cases (PsppireDataWindow *dw)
{
- int p = gtk_notebook_get_current_page (GTK_NOTEBOOK (dw->data_editor));
- if (p == 0)
+ PsppireDataEditor *de = dw->data_editor;
+ int p = gtk_notebook_get_current_page (GTK_NOTEBOOK (de));
+ if (p == PSPPIRE_DATA_EDITOR_DATA_VIEW)
{
- PsppireDataSheet *ds = psppire_data_editor_get_active_data_sheet (dw->data_editor);
- psppire_data_sheet_edit_clear_cases (ds);
+ SswRange *range = SSW_SHEET(de->data_sheet)->selection;
+ g_return_if_fail (range->start_y >= 0);
+ psppire_data_store_delete_cases (de->data_store, range->start_y,
+ range->end_y - range->start_y + 1);
+ gtk_widget_queue_draw (GTK_WIDGET (de->data_sheet));
}
}
static void
on_clear_variables (PsppireDataWindow *dw)
{
- int p = gtk_notebook_get_current_page (GTK_NOTEBOOK (dw->data_editor));
- if (p == 0)
+ PsppireDataEditor *de = dw->data_editor;
+ int p = gtk_notebook_get_current_page (GTK_NOTEBOOK (de));
+ if (p == PSPPIRE_DATA_EDITOR_DATA_VIEW)
{
- PsppireDataSheet *ds = psppire_data_editor_get_active_data_sheet (dw->data_editor);
- psppire_data_sheet_edit_clear_variables (ds);
+ psppire_data_editor_data_delete_variables (de);
}
else
{
- psppire_var_sheet_clear_variables (PSPPIRE_VAR_SHEET (dw->data_editor->var_sheet));
+ psppire_data_editor_var_delete_variables (de);
}
}
-
static void
insert_variable (PsppireDataWindow *dw)
{
- int p = gtk_notebook_get_current_page (GTK_NOTEBOOK (dw->data_editor));
- if (p == 0)
+ PsppireDataEditor *de = dw->data_editor;
+ int p = gtk_notebook_get_current_page (GTK_NOTEBOOK (de));
+
+ if (p == PSPPIRE_DATA_EDITOR_DATA_VIEW)
{
- PsppireDataSheet *ds = psppire_data_editor_get_active_data_sheet (dw->data_editor);
- psppire_data_sheet_insert_variable (ds);
+ SswRange *range = SSW_SHEET(de->data_sheet)->selection;
+ psppire_data_editor_insert_new_variable_at_posn (de, range->start_x);
}
else
{
- psppire_var_sheet_insert_variable (PSPPIRE_VAR_SHEET (dw->data_editor->var_sheet));
+ SswRange *range = SSW_SHEET(de->var_sheet)->selection;
+ psppire_data_editor_insert_new_variable_at_posn (de, range->start_y);
}
}
-
static void
insert_case_at_row (PsppireDataWindow *dw)
{
- PsppireDataSheet *ds = psppire_data_editor_get_active_data_sheet (dw->data_editor);
-
- psppire_data_sheet_insert_case (ds);
+ PsppireDataEditor *de = dw->data_editor;
+ SswRange *range = SSW_SHEET(de->data_sheet)->selection;
+ psppire_data_editor_insert_new_case_at_posn (de, range->start_y);
}
static void
goto_case (PsppireDataWindow *dw)
{
- PsppireDataSheet *ds = psppire_data_editor_get_active_data_sheet (dw->data_editor);
-
- goto_case_dialog (ds);
+ PsppireDataEditor *de = dw->data_editor;
+ int p = gtk_notebook_get_current_page (GTK_NOTEBOOK (de));
+ if (p == PSPPIRE_DATA_EDITOR_DATA_VIEW)
+ {
+ goto_case_dialog (PSPPIRE_DATA_SHEET (de->data_sheet));
+ }
}
-
-
static GtkWidget *
create_file_menu (PsppireDataWindow *dw)
{
GtkWidget *new_menu = gtk_menu_new ();
g_object_set (new, "submenu", new_menu, NULL);
-
+
GtkWidget *syntax = gtk_menu_item_new_with_mnemonic (_("_Syntax"));
connect_action_to_menuitem (G_ACTION_MAP (g_application_get_default ()), "new-syntax", syntax, 0);
-
+
GtkWidget *data = gtk_menu_item_new_with_mnemonic (_("_Data"));
connect_action_to_menuitem (G_ACTION_MAP (g_application_get_default ()), "new-data", data, 0);
gtk_menu_attach (GTK_MENU (new_menu), syntax, 0, 1, 0, 1);
gtk_menu_attach (GTK_MENU (new_menu), data, 0, 1, 1, 2);
}
-
+
GtkWidget *open = gtk_menu_item_new_with_mnemonic (_("_Open"));
connect_action_to_menuitem (G_ACTION_MAP (dw), "open", open, "<Ctrl>O");
-
+
GtkWidget *import = gtk_menu_item_new_with_mnemonic (_("_Import Data..."));
connect_action_to_menuitem (G_ACTION_MAP (dw), "file-import", import, 0);
-
+
gtk_menu_attach (GTK_MENU (menu), open, 0, 1, 1, 2);
gtk_menu_attach (GTK_MENU (menu), import, 0, 1, 2, 3);
GtkWidget *save = gtk_menu_item_new_with_mnemonic (_("_Save..."));
connect_action_to_menuitem (G_ACTION_MAP (dw), "save", save, "<Ctrl>S");
-
+
GtkWidget *save_as = gtk_menu_item_new_with_mnemonic (_("Save _As..."));
connect_action_to_menuitem (G_ACTION_MAP (dw), "save-as", save_as, "<Shift><Ctrl>S");
-
+
GtkWidget *rename_dataset = gtk_menu_item_new_with_mnemonic (_("_Rename Dataset..."));
connect_action_to_menuitem (G_ACTION_MAP (dw), "rename-dataset", rename_dataset, 0);
-
+
gtk_menu_attach (GTK_MENU (menu), save, 0, 1, 4, 5);
gtk_menu_attach (GTK_MENU (menu), save_as, 0, 1, 5, 6);
gtk_menu_attach (GTK_MENU (menu), rename_dataset, 0, 1, 6, 7);
GtkWidget *dd_menu = gtk_menu_new ();
g_object_set (display_data, "submenu", dd_menu, NULL);
-
+
GtkWidget *working_file = gtk_menu_item_new_with_mnemonic (_("Working File"));
connect_action_to_menuitem (G_ACTION_MAP (dw), "info-working", working_file, 0);
GtkWidget *external_file = gtk_menu_item_new_with_mnemonic (_("_External File..."));
gtk_menu_attach (GTK_MENU (dd_menu), working_file, 0, 1, 0, 1);
gtk_menu_attach (GTK_MENU (dd_menu), external_file, 0, 1, 1, 2);
}
-
+
gtk_menu_attach (GTK_MENU (menu), gtk_separator_menu_item_new (), 0, 1, 9, 10);
{
gtk_menu_attach (GTK_MENU (menu), mi_data, 0, 1, 10, 11);
gtk_menu_attach (GTK_MENU (menu), mi_files, 0, 1, 11, 12);
-
+
g_object_set (menu_data, "show-tips", TRUE, NULL);
g_object_set (menu_files, "show-tips", TRUE, NULL);
g_object_set (mi_data, "submenu", menu_data, NULL);
g_object_set (mi_files, "submenu", menu_files, NULL);
-
+
{
GtkRecentFilter *filter = gtk_recent_filter_new ();
connect_action_to_menuitem (G_ACTION_MAP (g_application_get_default ()),
"quit", quit, "<Ctrl>Q");
}
-
+
g_object_set (menuitem, "submenu", menu, NULL);
gtk_widget_show_all (menuitem);
-
+
return menuitem;
}
+
static GtkWidget *
create_edit_menu (PsppireDataWindow *dw)
{
GAction *a = g_action_map_lookup_action (G_ACTION_MAP (dw), "PsppireDialogActionVarInfo");
g_assert (a);
g_signal_connect_swapped (go_to_variable, "activate", G_CALLBACK (psppire_dialog_action_activate_null), a);
-
+
gtk_menu_attach (GTK_MENU (menu), go_to_variable, 0, 1, i, i + 1); ++i;
gtk_menu_attach (GTK_MENU (menu), dw->mi_go_to_case, 0, 1, i, i + 1); ++i;
{
GtkAccelGroup *ag = gtk_accel_group_new ();
-
+
dw->mi_edit_separator = gtk_separator_menu_item_new ();
gtk_menu_attach (GTK_MENU (menu), dw->mi_edit_separator, 0, 1, i, i + 1); ++i;
gtk_window_add_accel_group (GTK_WINDOW (dw), ag);
gtk_widget_add_accelerator (dw->mi_cut, "activate", ag,
'X', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
-
+
dw->mi_copy = gtk_menu_item_new_with_mnemonic (_("_Copy"));
gtk_menu_attach (GTK_MENU (menu), dw->mi_copy, 0, 1, i, i + 1); ++i;
g_signal_connect_swapped (dw->mi_copy, "activate", G_CALLBACK (on_copy), dw);
gtk_widget_add_accelerator (dw->mi_copy, "activate", ag,
'C', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
-
+
dw->mi_paste = gtk_menu_item_new_with_mnemonic (_("_Paste"));
gtk_menu_attach (GTK_MENU (menu), dw->mi_paste, 0, 1, i, i + 1); ++i;
g_signal_connect_swapped (dw->mi_paste, "activate", G_CALLBACK (on_paste), dw);
dw->mi_clear_variables = gtk_menu_item_new_with_mnemonic (_("Clear _Variables"));
gtk_menu_attach (GTK_MENU (menu), dw->mi_clear_variables, 0, 1, i, i + 1); ++i;
g_signal_connect_swapped (dw->mi_clear_variables, "activate", G_CALLBACK (on_clear_variables), dw);
-
+
dw->mi_clear_cases = gtk_menu_item_new_with_mnemonic (_("Cl_ear Cases"));
gtk_menu_attach (GTK_MENU (menu), dw->mi_clear_cases, 0, 1, i, i + 1); ++i;
g_signal_connect_swapped (dw->mi_clear_cases, "activate", G_CALLBACK (on_clear_cases), dw);
}
-
+
{
dw->mi_find_separator = gtk_separator_menu_item_new ();
gtk_menu_attach (GTK_MENU (menu), dw->mi_find_separator, 0, 1, i, i + 1); ++i;
-
+
dw->mi_find = gtk_menu_item_new_with_mnemonic (_("_Find..."));
g_signal_connect_swapped (dw->mi_find, "activate", G_CALLBACK (find_dialog), dw);
gtk_menu_attach (GTK_MENU (menu), dw->mi_find, 0, 1, i, i + 1); ++i;
G_CALLBACK (options_dialog), dw);
gtk_menu_attach (GTK_MENU (menu), dw->mi_options, 0, 1, i, i + 1); ++i;
}
-
+
g_object_set (menuitem, "submenu", menu, NULL);
-
+
gtk_widget_show_all (menuitem);
-
+
return menuitem;
}
-
static void
psppire_data_window_finish_init (PsppireDataWindow *de,
struct dataset *ds)
de->data_editor =
PSPPIRE_DATA_EDITOR (psppire_data_editor_new (de->dict, de->data_store));
-
+
g_signal_connect (de, "realize",
- G_CALLBACK (set_data_page), de);
+ G_CALLBACK (on_realize), de);
g_signal_connect_swapped (de->data_store, "case-changed",
G_CALLBACK (set_unsaved), de);
- g_signal_connect_swapped (de->data_store, "case-inserted",
- G_CALLBACK (set_unsaved), de);
-
- g_signal_connect_swapped (de->data_store, "cases-deleted",
- G_CALLBACK (set_unsaved), de);
-
dataset_set_callbacks (de->dataset, &cbs, de);
connect_help (de->builder);
G_CALLBACK (on_split_change),
de);
- g_signal_connect_swapped (de->dict, "backend-changed",
+ g_signal_connect_swapped (de->dict, "items-changed",
G_CALLBACK (enable_save), de);
g_signal_connect_swapped (de->dict, "variable-inserted",
G_CALLBACK (enable_save), de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_FLIP, de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_AGGREGATE, de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_WEIGHT, de);
-
+
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_COMPUTE, de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_COUNT, de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_AUTORECODE, de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_RECODE_SAME, de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_RECODE_DIFFERENT, de);
-
+
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_DESCRIPTIVES, de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_FREQUENCIES, de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_EXAMINE, de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_REGRESSION, de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_LOGISTIC, de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_ROC, de);
-
+
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_COMMENTS, de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_VAR_INFO, de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_1SKS, de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_TWO_SAMPLE, de);
connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_K_RELATED, de);
+ connect_dialog_action (PSPPIRE_TYPE_DIALOG_ACTION_K_INDEPENDENT, de);
{
GSimpleAction *file_import_action = g_simple_action_new ("file-import", NULL);
g_signal_connect_swapped (file_import_action, "activate", G_CALLBACK (file_import), de);
g_action_map_add_action (G_ACTION_MAP (de), G_ACTION (file_import_action));
}
-
+
{
GSimpleAction *save = g_simple_action_new ("save", NULL);
g_signal_connect_swapped (save, "activate", G_CALLBACK (psppire_window_save), de);
g_action_map_add_action (G_ACTION_MAP (de), G_ACTION (act_gridlines));
}
-
+
{
GSimpleAction *act_view_data = g_simple_action_new_stateful ("view_dv", G_VARIANT_TYPE_STRING,
g_variant_new_string ("DATA"));
g_signal_connect_swapped (find, "activate", G_CALLBACK (find_dialog), de);
g_action_map_add_action (G_ACTION_MAP (de), G_ACTION (find));
}
-
+
{
int idx = 0;
{
{
de->ti_jump_to_case = gtk_tool_button_new (NULL, "Jump to Case");
-
+
GAction *a = g_action_map_lookup_action (G_ACTION_MAP (de), "jump-to-case");
g_assert (a);
g_signal_connect_swapped (de->ti_jump_to_case, "clicked",
G_CALLBACK (g_action_activate_null), a);
-
+
gtk_toolbar_insert (GTK_TOOLBAR (hb), de->ti_jump_to_case, idx++);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (de->ti_jump_to_case), "edit-go-to-case");
gtk_widget_set_tooltip_text (GTK_WIDGET (de->ti_jump_to_case), _("Jump to a case in the data sheet"));
g_signal_connect_swapped (de->ti_find, "clicked",
G_CALLBACK (g_action_activate_null), a);
-
+
gtk_toolbar_insert (GTK_TOOLBAR (hb), de->ti_find, idx++);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (de->ti_find), "edit-find");
gtk_widget_set_tooltip_text (GTK_WIDGET (de->ti_find), _("Search for values in the data"));
ll_push_head (&all_data_windows, &de->ll);
}
+
static void
psppire_data_window_dispose (GObject *object)
{
}
+
GtkWidget*
psppire_data_window_new (struct dataset *ds)
{
GApplication *app = g_application_get_default ();
gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (dw));
-
+
return dw;
}
+
+
bool
psppire_data_window_is_empty (PsppireDataWindow *dw)
{
return psppire_dict_get_var_cnt (dw->dict) == 0;
}
+
static void
psppire_data_window_iface_init (PsppireWindowIface *iface)
{
\f
+
PsppireDataWindow *
psppire_default_data_window (void)
{
return ll_data (ll_head (&all_data_windows), PsppireDataWindow, ll);
}
+
+
void
psppire_data_window_set_default (PsppireDataWindow *pdw)
{
ll_push_tail (&all_data_windows, &pdw->ll);
}
+
+
PsppireDataWindow *
psppire_data_window_for_dataset (struct dataset *ds)
{
GtkWidget *w = psppire_data_window_new (NULL);
gtk_widget_show (w);
-
+
return GTK_WINDOW (w);
}