/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation
+ Copyright (C) 2009, 2010, 2011, 2012, 2013 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
struct variable *var;
gtk_tree_model_get (model, iter, DICT_TVM_COL_VAR, &var, -1);
+ g_object_set (cell, "stock_id",
+ psppire_dict_view_get_var_measurement_stock_id (var), NULL);
+}
+
+const char *
+psppire_dict_view_get_var_measurement_stock_id (const struct variable *var)
+{
if ( var_is_alpha (var))
- {
- g_object_set (cell, "stock-id", "var-string", NULL);
- }
+ return "var-string";
else
{
const struct fmt_spec *fs = var_get_print_format (var);
int cat = fmt_get_category (fs->type);
+
switch ( var_get_measure (var))
{
case MEASURE_NOMINAL:
- g_object_set (cell, "stock-id", "var-nominal", NULL);
- break;
+ return "var-nominal";
+
case MEASURE_ORDINAL:
- g_object_set (cell, "stock-id", "var-ordinal", NULL);
- break;
+ return "var-ordinal";
+
case MEASURE_SCALE:
if ( ( FMT_CAT_DATE | FMT_CAT_TIME ) & cat )
- g_object_set (cell, "stock-id", "var-date-scale", NULL);
+ return "var-date-scale";
else
- g_object_set (cell, "stock-id", "var-scale", NULL);
+ return "var-scale";
break;
+
default:
- g_assert_not_reached ();
- };
+ g_return_val_if_reached ("");
+ }
}
}
+
/* Sets the tooltip to be the name of the variable under the cursor */
static gboolean
set_tooltip_for_variable (GtkTreeView *treeview,
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2009, 2011, 2012, 2013 Free Software Foundation, Inc.
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/psppire-data-editor.h"
#include "ui/gui/psppire-data-window.h"
#include "ui/gui/psppire-dialog-action-var-info.h"
+#include "ui/gui/psppire-dictview.h"
#include "ui/gui/psppire-empty-list-store.h"
#include "ui/gui/psppire-marshal.h"
#include "ui/gui/val-labs-dialog.h"
if (row >= psppire_dict_get_var_cnt (var_sheet->dict))
{
- g_object_set (cell,
- "text", "",
- "editable", column_id == VS_NAME,
- NULL);
- if (column_id == VS_WIDTH
- || column_id == VS_DECIMALS
- || column_id == VS_COLUMNS)
- g_object_set (cell, "adjustment", NULL, NULL);
+ if (GTK_IS_CELL_RENDERER_TEXT (cell))
+ {
+ g_object_set (cell,
+ "text", "",
+ "editable", column_id == VS_NAME,
+ NULL);
+ if (column_id == VS_WIDTH
+ || column_id == VS_DECIMALS
+ || column_id == VS_COLUMNS)
+ g_object_set (cell, "adjustment", NULL, NULL);
+ }
+ else
+ g_object_set (cell, "stock-id", "", NULL);
return;
}
break;
case VS_MEASURE:
- g_object_set (cell,
- "text", measure_to_string (var_get_measure (var)),
- "editable", TRUE,
- NULL);
+ if (GTK_IS_CELL_RENDERER_TEXT (cell))
+ g_object_set (cell,
+ "text", measure_to_string (var_get_measure (var)),
+ "editable", TRUE,
+ NULL);
+ else
+ g_object_set (cell, "stock-id",
+ psppire_dict_view_get_var_measurement_stock_id (var),
+ NULL);
break;
}
}
{
PsppSheetView *sheet_view = PSPP_SHEET_VIEW (obj);
PsppSheetViewColumn *column;
+ GtkCellRenderer *cell;
GtkAction *action;
GList *list;
alignment_to_string (ALIGN_RIGHT), ALIGN_RIGHT,
NULL);
- add_combo_column (obj, VS_MEASURE, _("Measure"), 10,
- measure_to_string (MEASURE_NOMINAL), MEASURE_NOMINAL,
- measure_to_string (MEASURE_ORDINAL), MEASURE_ORDINAL,
- measure_to_string (MEASURE_SCALE), MEASURE_SCALE,
- NULL);
+ column
+ = add_combo_column (obj, VS_MEASURE, _("Measure"), 12,
+ measure_to_string (MEASURE_NOMINAL), MEASURE_NOMINAL,
+ measure_to_string (MEASURE_ORDINAL), MEASURE_ORDINAL,
+ measure_to_string (MEASURE_SCALE), MEASURE_SCALE,
+ NULL);
+ cell = gtk_cell_renderer_pixbuf_new ();
+ pspp_sheet_view_column_pack_end (column, cell, FALSE);
+ pspp_sheet_view_column_set_cell_data_func (
+ column, cell, render_var_cell, obj, NULL);
pspp_sheet_view_set_rubber_banding (sheet_view, TRUE);
pspp_sheet_selection_set_mode (pspp_sheet_view_get_selection (sheet_view),