diff libinterp/octave-value/ov-cell.cc @ 24643:78aff6f14227

more variable editor improvements; allow more variable types to be edited * ov.h (octave_value::edit_display): New function. * ov-base.h (octave_base_value::edit_display): New virtual function. * ov-base-mat.h, ov-base-mat.cc, ov-base-scalar.h, ov-base-scalar.cc, ov-cell.h, ov-cell.cc: Overload edit_display function. * variable-editor.cc (variable_editor::variable_editor): Increase default width to 30. * variable-editor-model.h, variable-editor-model.cc (make_label): Now file-scope static function instead of member function. (get_rows_and_columns): New file-scope static function. Use to eliminate duplicated code. (impl::cell::cell (const octave_value&, int, int)): New ctor. (variable_editor_model::resize_columns_signal): New signal. (variable_editor_model::update_data): Emit resize_columns_signal when done. (variable_editor_model::variable_editor_model): Connect resize_columns_signal. Don't nest calls to insertRows and insertColumns. (variable_editor_model::type_is_editable) Allow all numeric types, logical arrays, and cells to be edited. Include dimensions in error message.
author John W. Eaton <jwe@octave.org>
date Fri, 26 Jan 2018 19:39:46 -0500
parents f5ad5d6f16fd
children ef60416c4686
line wrap: on
line diff
--- a/libinterp/octave-value/ov-cell.cc	Fri Jan 26 00:11:11 2018 -0500
+++ b/libinterp/octave-value/ov-cell.cc	Fri Jan 26 19:39:46 2018 -0500
@@ -100,6 +100,19 @@
 // really ask whether octave_cell should inherit from octave_base_matrix at all.
 
 template <>
+std::string
+octave_base_matrix<Cell>::edit_display (octave_idx_type i,
+                                        octave_idx_type j) const
+{
+  octave_value val = matrix(i,j);
+
+  if (val.numel () == 1)
+    return edit_display(0,0);
+  else
+    return "type + dims";
+}
+
+template <>
 octave_value
 octave_base_matrix<Cell>::fast_elem_extract (octave_idx_type n) const
 {