Merge branch 'master' into rewrite-sheet
[pspp-builds.git] / src / ui / gui / data-editor.c
index a94acaf2a0cd4a8f7468c6ca59e288a27ca6c326..d4cbae1e6716640ea5d2f85c878c91422c410e9f 100644 (file)
@@ -81,6 +81,8 @@ static void on_insert_variable (GtkAction *, gpointer data);
 static void insert_case (GtkAction *a, gpointer data);
 
 static void toggle_value_labels (GtkToggleAction *a, gpointer data);
+static void toggle_split_window (GtkToggleAction *ta, gpointer data);
+
 
 /* Callback for when the dictionary changes properties*/
 static void on_weight_change (GObject *, gint, gpointer);
@@ -320,7 +322,7 @@ new_data_editor (void)
 
   de->toggle_value_labels =
     gtk_toggle_action_new ("toggle-value-labels",
-                          _("Labels"),
+                          _("_Labels"),
                           _("Show/hide value labels"),
                           "pspp-value-labels");
 
@@ -374,7 +376,7 @@ new_data_editor (void)
 
   de->insert_variable =
     gtk_action_new ("insert-variable",
-                   _("Insert Variable"),
+                   _("Insert _Variable"),
                    _("Create a new variable at the current position"),
                    "pspp-insert-variable");
 
@@ -393,7 +395,7 @@ new_data_editor (void)
 
   de->insert_case =
     gtk_action_new ("insert-case",
-                   _("Insert Case"),
+                   _("Insert Ca_se"),
                    _("Create a new case at the current position"),
                    "pspp-insert-case");
 
@@ -414,7 +416,7 @@ new_data_editor (void)
 
   de->invoke_goto_dialog =
     gtk_action_new ("goto-case-dialog",
-                   _("Goto Case"),
+                   _("_Goto Case"),
                    _("Jump to a Case in the Data Sheet"),
                    "gtk-jump-to");
 
@@ -434,7 +436,7 @@ new_data_editor (void)
 
   de->invoke_weight_cases_dialog =
     gtk_action_new ("weight-cases-dialog",
-                   _("Weights"),
+                   _("_Weights"),
                    _("Weight cases by variable"),
                    "pspp-weight-cases");
 
@@ -444,7 +446,7 @@ new_data_editor (void)
 
   de->invoke_transpose_dialog =
     gtk_action_new ("transpose-dialog",
-                   _("Transpose"),
+                   _("_Transpose"),
                    _("Transpose the cases with the variables"),
                    NULL);
 
@@ -456,7 +458,7 @@ new_data_editor (void)
 
   de->invoke_split_file_dialog =
     gtk_action_new ("split-file-dialog",
-                   _("Split"),
+                   _("S_plit"),
                    _("Split the active file"),
                    "pspp-split-file");
 
@@ -467,7 +469,7 @@ new_data_editor (void)
 
   de->invoke_sort_cases_dialog =
     gtk_action_new ("sort-cases-dialog",
-                   _("Sort"),
+                   _("_Sort"),
                    _("Sort cases in the active file"),
                    "pspp-sort-cases");
 
@@ -476,7 +478,7 @@ new_data_editor (void)
 
   de->invoke_select_cases_dialog =
     gtk_action_new ("select-cases-dialog",
-                   _("Select Cases"),
+                   _("Select _Cases"),
                    _("Select cases from the active file"),
                    "pspp-select-cases");
 
@@ -486,7 +488,7 @@ new_data_editor (void)
 
   de->invoke_compute_dialog =
     gtk_action_new ("compute-dialog",
-                   _("Compute"),
+                   _("_Compute"),
                    _("Compute new values for a variable"),
                    "pspp-compute");
 
@@ -534,7 +536,7 @@ new_data_editor (void)
 
   de->invoke_comments_dialog =
     gtk_action_new ("commments-dialog",
-                   _("Data File Comments"),
+                   _("Data File _Comments"),
                    _("Commentary text for the data file"),
                    NULL);
 
@@ -543,7 +545,7 @@ new_data_editor (void)
 
   de->invoke_find_dialog  =
     gtk_action_new ("find-dialog",
-                   _("Find"),
+                   _("_Find"),
                    _("Find Case"),
                    "gtk-find");
 
@@ -583,7 +585,7 @@ new_data_editor (void)
 
   de->invoke_variable_info_dialog  =
     gtk_action_new ("variable-info-dialog",
-                   _("Variables"),
+                   _("_Variables"),
                    _("Jump to Variable"),
                    "pspp-goto-variable");
 
@@ -914,6 +916,19 @@ new_data_editor (void)
                    "activate",
                    G_CALLBACK (minimise_all_windows), NULL);
 
+  de->toggle_split_window =
+    gtk_toggle_action_new ("toggle-split-window",
+                          _("_Split Window"),
+                          _("Split the window vertically and horizontally"),
+                          "pspp-split-window");
+
+  g_signal_connect (de->toggle_split_window, "toggled",
+                   G_CALLBACK (toggle_split_window),
+                   de);
+
+  gtk_action_connect_proxy (GTK_ACTION (de->toggle_split_window),
+                           get_widget_assert (de->xml,
+                                              "windows_split"));
 
   de->data_sheet_variable_popup_menu =
     GTK_MENU (create_data_sheet_variable_popup_menu (de));
@@ -1056,6 +1071,18 @@ toggle_value_labels (GtkToggleAction *ta, gpointer data)
 
 
 
+static void
+toggle_split_window (GtkToggleAction *ta, gpointer data)
+{
+  struct data_editor *de = data;
+
+  psppire_data_editor_split_window (de->data_editor,
+                                   gtk_toggle_action_get_active (ta));
+}
+
+
+
+
 static void
 file_quit (GtkCheckMenuItem *menuitem, gpointer data)
 {
@@ -1375,6 +1402,11 @@ data_save_as_dialog (GtkAction *action, struct data_editor *de)
        de->save_as_portable =
          ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_sys));
 
+       if ( de->save_as_portable)
+         append_filename_suffix (de, ".por");
+       else
+         append_filename_suffix (de, ".sav");
+
        save_file (de);
 
        window_set_name_from_filename (e, de->file_name);
@@ -1506,9 +1538,6 @@ create_data_sheet_variable_popup_menu (struct data_editor *de)
   GtkWidget *clear_variable =
     gtk_menu_item_new_with_label (_("Clear"));
 
-  gtk_action_connect_proxy (de->insert_variable,
-                           insert_variable );
-
 
   gtk_action_connect_proxy (de->delete_variables,
                            clear_variable );
@@ -1539,6 +1568,11 @@ create_data_sheet_variable_popup_menu (struct data_editor *de)
                            G_CALLBACK (psppire_data_editor_sort_descending),
                            de->data_editor);
 
+  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), sort_descending);
 
   gtk_widget_show_all (menu);
@@ -1559,16 +1593,16 @@ create_data_sheet_cases_popup_menu (struct data_editor *de)
     gtk_menu_item_new_with_label (_("Clear"));
 
 
-  gtk_action_connect_proxy (de->insert_case,
-                           insert_case);
-
-
   gtk_action_connect_proxy (de->delete_cases,
                            delete_case);
 
 
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_case);
 
+  g_signal_connect_swapped (G_OBJECT (insert_case), "activate",
+                           G_CALLBACK (gtk_action_activate),
+                           de->insert_case);
+
 
   gtk_menu_shell_append (GTK_MENU_SHELL (menu),
                         gtk_separator_menu_item_new ());