[gnumeric] Introspection: cleanup



commit d5df8836e598fd28c93bb0a29057123cead92806
Author: Morten Welinder <terra gnome org>
Date:   Fri Apr 13 09:18:20 2018 -0400

    Introspection: cleanup

 ChangeLog            |    5 +++++
 README-introspection |    6 +++++-
 src/cell.c           |   46 ++++++++++++++--------------------------------
 src/cell.h           |    1 -
 src/mstyle.c         |   14 +++++++++++++-
 src/sheet-style.c    |   18 +++++++++++++++++-
 src/sheet-style.h    |    2 ++
 src/sheet.c          |   12 ++++++------
 8 files changed, 62 insertions(+), 42 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9da9c70..22b57e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-04-13  Morten Welinder  <terra gnome org>
+
+       * src/cell.c (gnm_cell_set_format): Remove.  Unused and badly
+       named.
+
 2018-04-12  Morten Welinder  <terra gnome org>
 
        * src/sheet-merge.c (gnm_sheet_merge_remove): Drop unused command
diff --git a/README-introspection b/README-introspection
index 12075aa..6f3203f 100644
--- a/README-introspection
+++ b/README-introspection
@@ -16,7 +16,7 @@ This is incomplete.  In particular, I'll have to look at
 -----------------------------------------------------------------------------
 Note: the Python version of type names excludes the Gnm prefix.
 
-Workbook: [GObject]
+Workbook: [GObject, derived from GODoc]
   new_with_sheets(count)
   sheet_by_index(no)
   sheet_by_name(string)
@@ -24,6 +24,9 @@ Workbook: [GObject]
   recalc_all()
   cells(qcomments,visibility)
   props.recalc_mode
+
+
+GODoc: [GObject]
   props.uri
   props.dirty
   props.pristine
@@ -81,6 +84,7 @@ GnmCell: [Boxed structure] [2]
   name()
   get_value()
   get_entered_text()
+  get_format()
   pos
 
 
diff --git a/src/cell.c b/src/cell.c
index 56f5300..fc96324 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -968,6 +968,12 @@ gnm_cell_rendered_offset (GnmCell const * cell)
                : 0;
 }
 
+/**
+ * gnm_cell_get_style:
+ * @cell: #GnmCell to query
+ *
+ * Returns: (transfer none): the fully qualified style for @cell.
+ */
 GnmStyle const *
 gnm_cell_get_style (GnmCell const *cell)
 {
@@ -978,12 +984,12 @@ gnm_cell_get_style (GnmCell const *cell)
 }
 
 /**
- * gnm_cell_get_format_given_style:
- * @cell:
- * @style:
+ * gnm_cell_get_format_given_style: (skip)
+ * @cell: #GnmCell to query
+ * @style: (nullable): #GnmStyle for @cell.
  *
- * Get the display format.  If the assigned format is General,
- * the format of the value will be used.
+ * Returns: (transfer none): the effective format for the cell, i.e., @style's
+ * format unless that is General and the cell value has a format.
  **/
 GOFormat const *
 gnm_cell_get_format_given_style (GnmCell const *cell, GnmStyle const *style)
@@ -1008,10 +1014,10 @@ gnm_cell_get_format_given_style (GnmCell const *cell, GnmStyle const *style)
 
 /**
  * gnm_cell_get_format:
- * @cell:
+ * @cell: #GnmCell to query
  *
- * Get the display format.  If the assigned format is General,
- * the format of the value will be used.
+ * Returns: (transfer none): the effective format for the cell, i.e., the
+ * cell style's format unless that is General and the cell value has a format.
  **/
 GOFormat const *
 gnm_cell_get_format (GnmCell const *cell)
@@ -1019,30 +1025,6 @@ gnm_cell_get_format (GnmCell const *cell)
        return gnm_cell_get_format_given_style (cell, NULL);
 }
 
-/*
- * gnm_cell_set_format:
- *
- * Changes the format for CELL to be FORMAT.  FORMAT should be
- * a number display format as specified on the manual
- *
- * Does not render, redraw, or respan.
- */
-void
-gnm_cell_set_format (GnmCell *cell, char const *format)
-{
-       GnmRange r;
-       GnmStyle *mstyle;
-
-       g_return_if_fail (cell != NULL);
-       g_return_if_fail (format != NULL);
-
-       mstyle = gnm_style_new ();
-       gnm_style_set_format_text (mstyle, format);
-
-       r.start = r.end = cell->pos;
-       sheet_style_apply_range (cell->base.sheet, &r, mstyle);
-}
-
 static GnmValue *
 cb_set_array_value (GnmCellIter const *iter, gpointer user)
 {
diff --git a/src/cell.h b/src/cell.h
index 3cc02a0..0afe302 100644
--- a/src/cell.h
+++ b/src/cell.h
@@ -77,7 +77,6 @@ void gnm_cell_convert_expr_to_value   (GnmCell *cell);
 GnmStyle const *gnm_cell_get_style     (GnmCell const *cell);
 GOFormat const *gnm_cell_get_format    (GnmCell const *cell);
 GOFormat const *gnm_cell_get_format_given_style (GnmCell const *cell, GnmStyle const *style);
-void   gnm_cell_set_format             (GnmCell *cell, char const *format);
 
 GnmRenderedValue *gnm_cell_get_rendered_value (GnmCell const *cell);
 GnmRenderedValue *gnm_cell_fetch_rendered_value (GnmCell const *cell,
diff --git a/src/mstyle.c b/src/mstyle.c
index 26fb1bd..5f21445 100644
--- a/src/mstyle.c
+++ b/src/mstyle.c
@@ -1460,6 +1460,12 @@ gnm_style_get_font (GnmStyle const *style, PangoContext *context)
        return style->font;
 }
 
+/**
+ * gnm_style_set_font_name:
+ * @style: the style to change
+ * @name: the font name as a string
+ *
+ */
 void
 gnm_style_set_font_name (GnmStyle *style, char const *name)
 {
@@ -1477,7 +1483,7 @@ gnm_style_set_font_name (GnmStyle *style, char const *name)
 }
 
 /**
- * gnm_style_set_font_name:
+ * gnm_style_get_font_name:
  * @style: the style to query
  *
  * Returns: (transfer none): the currently set font name
@@ -1503,6 +1509,12 @@ gnm_style_set_font_bold (GnmStyle *style, gboolean bold)
        gnm_style_clear_pango (style);
 }
 
+/**
+ * gnm_style_get_font_bold:
+ * @style: #GnmStyle to query
+ *
+ * Returns: %TRUE if the style has a bold font.
+ */
 gboolean
 gnm_style_get_font_bold (GnmStyle const *style)
 {
diff --git a/src/sheet-style.c b/src/sheet-style.c
index 94ee564..8cca134 100644
--- a/src/sheet-style.c
+++ b/src/sheet-style.c
@@ -1746,7 +1746,7 @@ style_row_init (GnmBorder const * * *prev_vert,
 }
 
 /**
- * sheet_style_apply_range:
+ * sheet_style_apply_range: (skip)
  * @sheet: #Sheet
  * @range: #GnmRange to apply over
  * @pstyle: (transfer full): A partial style to apply
@@ -1779,6 +1779,22 @@ sheet_style_apply_range (Sheet *sheet, GnmRange const *range, GnmStyle *pstyle)
        rstyle_dtor (&rs);
 }
 
+/**
+ * sheet_style_apply_range2: (rename-to sheet_style_apply_range)
+ * @sheet: #Sheet
+ * @range: #GnmRange to apply over
+ * @pstyle: A partial style to apply
+ *
+ * Apply a partial style to a region.
+ */
+void
+sheet_style_apply_range2 (Sheet *sheet, GnmRange const *range, GnmStyle *pstyle)
+{
+       gnm_style_ref (pstyle);
+       sheet_style_apply_range (sheet, range, pstyle);
+}
+
+
 static void
 apply_border (Sheet *sheet, GnmRange const *r,
              GnmStyleBorderLocation side,
diff --git a/src/sheet-style.h b/src/sheet-style.h
index 8d88671..1cc0d0a 100644
--- a/src/sheet-style.h
+++ b/src/sheet-style.h
@@ -30,6 +30,8 @@ void   sheet_style_apply_border       (Sheet *sheet, GnmRange const *range,
                                         GnmBorder **borders);
 void    sheet_style_apply_range        (Sheet *sheet, GnmRange const *range,
                                         GnmStyle *pstyle);
+void    sheet_style_apply_range2       (Sheet *sheet, GnmRange const *range,
+                                        GnmStyle *pstyle);
 void    sheet_style_set_range          (Sheet  *sheet, GnmRange const *range,
                                         GnmStyle *style);
 void    sheet_style_apply_col          (Sheet  *sheet, int col,
diff --git a/src/sheet.c b/src/sheet.c
index 511e16b..3f0bfbd 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -2074,7 +2074,7 @@ sheet_cell_get (Sheet const *sheet, int col, int row)
  * @col:    the cell column
  * @row:    the cell row
  *
- * Return value: a (GnmCell *) containing the GnmCell at col, row.
+ * Return value: a #GnmCell containing at (@col,@row).
  * If no cell existed at that location before, it is created.
  **/
 GnmCell *
@@ -3035,7 +3035,7 @@ sheet_cell_set_expr (GnmCell *cell, GnmExprTop const *texpr)
 }
 
 /**
- * sheet_cell_set_value:
+ * sheet_cell_set_value: (skip)
  * @cell: #GnmCell
  * @v: (transfer full): #GnmValue
  *
@@ -3062,10 +3062,9 @@ sheet_cell_set_value (GnmCell *cell, GnmValue *v)
  * @sheet: #Sheet
  * @col: column number
  * @row: row number
- * @v: (transfer full): #GnmValue
+ * @v: #GnmValue
  *
- * Stores, without copying, the supplied value.  It marks the
- * sheet as dirty.
+ * Set the the value of the cell at (@col,@row) to @v.
  *
  * The value is rendered and spans are calculated.  It queues a redraw
  * and checks to see if the edit region or selection content changed.
@@ -3073,7 +3072,8 @@ sheet_cell_set_value (GnmCell *cell, GnmValue *v)
 void
 sheet_cell_set_value_gi (Sheet *sheet, int col, int row, GnmValue *v)
 {
-       sheet_cell_set_value (sheet_cell_fetch (sheet, col, row), v);
+       sheet_cell_set_value (sheet_cell_fetch (sheet, col, row),
+                             value_dup (v));
 }
 
 /****************************************************************************/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]