output: Introduce group_item in place of TEXT_ITEM_COMMAND_OPEN and CLOSE.
[pspp] / src / ui / gui / psppire-output-view.c
index 2feaf90d62cc37135adb01d757f8c0d6bcd3c338..80e394faf528978c8d204f9d74a1d364a457588e 100644 (file)
@@ -27,6 +27,7 @@
 #include "output/driver-provider.h"
 #include "output/driver.h"
 #include "output/chart-item.h"
+#include "output/group-item.h"
 #include "output/message-item.h"
 #include "output/output-item.h"
 #include "output/table-item.h"
@@ -183,9 +184,10 @@ create_drawing_area (struct psppire_output_view *view,
     {
       GdkRGBA green = {0, 1, 0, 1};
       gtk_widget_override_background_color (GTK_WIDGET (view->output),
-                                           GTK_STATE_NORMAL, &green);
+                                           GTK_STATE_FLAG_NORMAL, &green);
       GdkRGBA red = {1, 0, 0, 1};
-      gtk_widget_override_background_color (drawing_area, GTK_STATE_NORMAL, &red);
+      gtk_widget_override_background_color (drawing_area,
+                                            GTK_STATE_FLAG_NORMAL, &red);
     }
 
   g_object_set_data_full (G_OBJECT (drawing_area),
@@ -291,18 +293,19 @@ psppire_output_view_put (struct psppire_output_view *view,
   GtkTreeIter iter;
   int tw, th;
 
-  if (is_text_item (item))
+  if (is_group_close_item (item))
     {
-      const struct text_item *text_item = to_text_item (item);
-      enum text_item_type type = text_item_get_type (text_item);
-      const char *text = text_item_get_text (text_item);
-
-      if (type == TEXT_ITEM_COMMAND_CLOSE)
+      if (output_get_group_level () == 0)
         {
           view->in_command = false;
           return;
         }
-      else if (text[0] == '\0')
+    }
+  else if (is_text_item (item))
+    {
+      const struct text_item *text_item = to_text_item (item);
+      const char *text = text_item_get_text (text_item);
+      if (text[0] == '\0')
         return;
     }
 
@@ -343,8 +346,7 @@ psppire_output_view_put (struct psppire_output_view *view,
       store = GTK_TREE_STORE (gtk_tree_view_get_model (view->overview));
 
       ds_init_empty (&name);
-      if (is_text_item (item)
-          && text_item_get_type (to_text_item (item)) == TEXT_ITEM_COMMAND_OPEN)
+      if (is_group_open_item (item) && output_get_group_level () == 1)
         {
           gtk_tree_store_append (store, &iter, NULL);
           view->cur_command = iter; /* XXX shouldn't save a GtkTreeIter */
@@ -368,9 +370,10 @@ psppire_output_view_put (struct psppire_output_view *view,
         }
       else if (is_table_item (item))
         {
-          const char *title = table_item_get_title (to_table_item (item));
+          const struct table_item_text *title
+            = table_item_get_title (to_table_item (item));
           if (title != NULL)
-            ds_put_format (&name, "Table: %s", title);
+            ds_put_format (&name, "Table: %s", title->content);
           else
             ds_put_cstr (&name, "Table");
         }