static GtkWidget * create_data_sheet_variable_popup_menu (struct data_editor *);
+
+static GtkWidget * create_var_sheet_variable_popup_menu (struct data_editor *);
+
static GtkWidget * create_data_sheet_cases_popup_menu (struct data_editor *);
static void register_data_editor_actions (struct data_editor *de);
de->data_sheet_variable_popup_menu =
GTK_MENU (create_data_sheet_variable_popup_menu (de));
+ de->var_sheet_variable_popup_menu =
+ GTK_MENU (create_var_sheet_variable_popup_menu (de));
+
de->data_sheet_cases_popup_menu =
GTK_MENU (create_data_sheet_cases_popup_menu (de));
g_object_set (de->data_editor,
- "datasheet-column-menu", de->data_sheet_variable_popup_menu, NULL);
+ "datasheet-column-menu", de->data_sheet_variable_popup_menu,
+ "datasheet-row-menu", de->data_sheet_cases_popup_menu,
+ "varsheet-row-menu", de->var_sheet_variable_popup_menu,
+ NULL);
- g_object_set (de->data_editor,
- "datasheet-row-menu", de->data_sheet_cases_popup_menu, NULL);
-
return de;
}
}
+static GtkWidget *
+create_var_sheet_variable_popup_menu (struct data_editor *de)
+{
+ GtkWidget *menu = gtk_menu_new ();
+
+ GtkWidget *insert_variable =
+ gtk_menu_item_new_with_label (_("Insert Variable"));
+
+ GtkWidget *delete_variable =
+ gtk_menu_item_new_with_label (_("Clear"));
+
+
+ gtk_action_connect_proxy (de->delete_variables,
+ delete_variable);
+
+
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_variable);
+
+ g_signal_connect_swapped (G_OBJECT (insert_variable), "activate",
+ G_CALLBACK (gtk_action_activate),
+ de->insert_variable);
+
+
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu),
+ gtk_separator_menu_item_new ());
+
+
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), delete_variable);
+
+
+ gtk_widget_show_all (menu);
+
+ return menu;
+}
+
+
+
\f
static void
-static void popup_variable_menu (GtkSheet *sheet, gint column,
- GdkEventButton *event, gpointer data);
+static void popup_variable_column_menu (GtkSheet *sheet, gint column,
+ GdkEventButton *event, gpointer data);
+
+static void popup_variable_row_menu (GtkSheet *sheet, gint row,
+ GdkEventButton *event, gpointer data);
+
static void popup_cases_menu (GtkSheet *sheet, gint row,
GdkEventButton *event, gpointer data);
+
/* Callback which occurs when the data sheet's column title
is double clicked */
static gboolean
PROP_0,
PROP_DATA_STORE,
PROP_VAR_STORE,
+ PROP_VS_ROW_MENU,
PROP_DS_COLUMN_MENU,
PROP_DS_ROW_MENU,
PROP_VALUE_LABELS,
"model", de->var_store,
NULL);
break;
+ case PROP_VS_ROW_MENU:
+ {
+ GObject *menu = g_value_get_object (value);
+
+ g_signal_connect (de->var_sheet, "button-event-row",
+ G_CALLBACK (popup_variable_row_menu), menu);
+ }
+ break;
case PROP_DS_COLUMN_MENU:
{
GObject *menu = g_value_get_object (value);
g_signal_connect (de->data_sheet[0], "button-event-column",
- G_CALLBACK (popup_variable_menu), menu);
+ G_CALLBACK (popup_variable_column_menu), menu);
}
break;
case PROP_DS_ROW_MENU:
GParamSpec *data_store_spec ;
GParamSpec *var_store_spec ;
GParamSpec *column_menu_spec;
- GParamSpec *row_menu_spec;
+ GParamSpec *ds_row_menu_spec;
+ GParamSpec *vs_row_menu_spec;
GParamSpec *value_labels_spec;
GParamSpec *current_case_spec;
GParamSpec *current_var_spec;
column_menu_spec);
- row_menu_spec =
+ ds_row_menu_spec =
g_param_spec_object ("datasheet-row-menu",
"Data Sheet Row Menu",
"A menu to be displayed when button 3 is pressed in the data sheet's row title buttons",
g_object_class_install_property (object_class,
PROP_DS_ROW_MENU,
- row_menu_spec);
+ ds_row_menu_spec);
+
+
+ vs_row_menu_spec =
+ g_param_spec_object ("varsheet-row-menu",
+ "Variable Sheet Row Menu",
+ "A menu to be displayed when button 3 is pressed in the variable sheet's row title buttons",
+ GTK_TYPE_MENU,
+ G_PARAM_WRITABLE);
+
+ g_object_class_install_property (object_class,
+ PROP_VS_ROW_MENU,
+ vs_row_menu_spec);
+
value_labels_spec =
g_param_spec_boolean ("value-labels",
/* Popup menu related stuff */
static void
-popup_variable_menu (GtkSheet *sheet, gint column,
+popup_variable_column_menu (GtkSheet *sheet, gint column,
GdkEventButton *event, gpointer data)
{
GtkMenu *menu = GTK_MENU (data);
}
+static void
+popup_variable_row_menu (GtkSheet *sheet, gint row,
+ GdkEventButton *event, gpointer data)
+{
+ GtkMenu *menu = GTK_MENU (data);
+
+ PsppireVarStore *var_store =
+ PSPPIRE_VAR_STORE (gtk_sheet_get_model (sheet));
+
+ const struct variable *v =
+ psppire_dict_get_variable (var_store->dict, row);
+
+ if ( v && event->button == 3)
+ {
+ gtk_sheet_select_row (sheet, row);
+
+ gtk_menu_popup (menu,
+ NULL, NULL, NULL, NULL,
+ event->button, event->time);
+ }
+}
+
+
static void
popup_cases_menu (GtkSheet *sheet, gint row,
GdkEventButton *event, gpointer data)