Remove font information from cell attributes and sheet model.
[pspp-builds.git] / src / ui / gui / data-editor.c
index b4da5b9f49bc2a8e94ad14bb702baaecac2fdc09..c242f764f5ad02dac73c92227ff664f2a8912ccf 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);
@@ -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));
@@ -1023,9 +1038,19 @@ static void
 fonts_activate (GtkMenuItem *menuitem, gpointer data)
 {
   struct data_editor *de = data;
+  PangoFontDescription *current_font;
+  gchar *font_name;
   GtkWidget *dialog =
     gtk_font_selection_dialog_new (_("Font Selection"));
 
+
+  current_font = GTK_WIDGET(de->data_editor)->style->font_desc;
+  font_name = pango_font_description_to_string (current_font);
+
+  gtk_font_selection_dialog_set_font_name (dialog, font_name);
+
+  g_free (font_name);
+
   gtk_window_set_transient_for (GTK_WINDOW (dialog),
                                GTK_WINDOW (get_widget_assert (de->xml,
                                                               "data_editor")));
@@ -1056,6 +1081,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 +1412,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 +1548,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 +1578,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 +1603,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 ());