Commit 0d4172b7 authored by Arturo Espinosa's avatar Arturo Espinosa

Last night hacking:



Last night hacking:

	- Bound toolbar alignment buttons.
	- Redraw logic fixed (although multi-span single-repaint
	  is still broken).
	- Small other fixes.

Miguel.
parent 4e6a1342
1998-09-02 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/sheet.c (sheet_clear_region): Redraw the deleted region.
(sheet_clear_region_content): Same.
(sheet_cell_remove): same.
* src/sheet-view.c (sheet_view_redraw_cell_region):
* src/cell.c (cell_set_halign): New routine: Only changes the
Horizontal alignment of a cell.
(cell_set_format, cell_set_text, cell_set_font_from_style,
cell_set_halign, cell_set_alignment): Queue a redraw to a cell
before making changes to the properties, to repaint correctly the
regions it covers before the change.
* src/workbook.c (center_cmd, left_align_cmd, right_align_cmd,
set_selection_halign): New routines used to bind the alignment
commands from the toolbar.
* src/sheet-view.c (sheet_view_redraw_cell_region): Silly mistake
fix. Last time I touched this routine i got too excited. I
should use *_col_get_distance only for numbers, not rows.
My variables were badly named and I thus commmited a mistake, fix.
1998-09-01 Miguel de Icaza <miguel@nuclecu.unam.mx> 1998-09-01 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/dialog-cell-format.c (create_align_page): Added support for * src/dialog-cell-format.c (create_align_page): Added support for
......
1998-09-02 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/sheet.c (sheet_clear_region): Redraw the deleted region.
(sheet_clear_region_content): Same.
(sheet_cell_remove): same.
* src/sheet-view.c (sheet_view_redraw_cell_region):
* src/cell.c (cell_set_halign): New routine: Only changes the
Horizontal alignment of a cell.
(cell_set_format, cell_set_text, cell_set_font_from_style,
cell_set_halign, cell_set_alignment): Queue a redraw to a cell
before making changes to the properties, to repaint correctly the
regions it covers before the change.
* src/workbook.c (center_cmd, left_align_cmd, right_align_cmd,
set_selection_halign): New routines used to bind the alignment
commands from the toolbar.
* src/sheet-view.c (sheet_view_redraw_cell_region): Silly mistake
fix. Last time I touched this routine i got too excited. I
should use *_col_get_distance only for numbers, not rows.
My variables were badly named and I thus commmited a mistake, fix.
1998-09-01 Miguel de Icaza <miguel@nuclecu.unam.mx> 1998-09-01 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/dialog-cell-format.c (create_align_page): Added support for * src/dialog-cell-format.c (create_align_page): Added support for
......
1998-09-02 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/sheet.c (sheet_clear_region): Redraw the deleted region.
(sheet_clear_region_content): Same.
(sheet_cell_remove): same.
* src/sheet-view.c (sheet_view_redraw_cell_region):
* src/cell.c (cell_set_halign): New routine: Only changes the
Horizontal alignment of a cell.
(cell_set_format, cell_set_text, cell_set_font_from_style,
cell_set_halign, cell_set_alignment): Queue a redraw to a cell
before making changes to the properties, to repaint correctly the
regions it covers before the change.
* src/workbook.c (center_cmd, left_align_cmd, right_align_cmd,
set_selection_halign): New routines used to bind the alignment
commands from the toolbar.
* src/sheet-view.c (sheet_view_redraw_cell_region): Silly mistake
fix. Last time I touched this routine i got too excited. I
should use *_col_get_distance only for numbers, not rows.
My variables were badly named and I thus commmited a mistake, fix.
1998-09-01 Miguel de Icaza <miguel@nuclecu.unam.mx> 1998-09-01 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/dialog-cell-format.c (create_align_page): Added support for * src/dialog-cell-format.c (create_align_page): Added support for
......
1998-09-02 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/sheet.c (sheet_clear_region): Redraw the deleted region.
(sheet_clear_region_content): Same.
(sheet_cell_remove): same.
* src/sheet-view.c (sheet_view_redraw_cell_region):
* src/cell.c (cell_set_halign): New routine: Only changes the
Horizontal alignment of a cell.
(cell_set_format, cell_set_text, cell_set_font_from_style,
cell_set_halign, cell_set_alignment): Queue a redraw to a cell
before making changes to the properties, to repaint correctly the
regions it covers before the change.
* src/workbook.c (center_cmd, left_align_cmd, right_align_cmd,
set_selection_halign): New routines used to bind the alignment
commands from the toolbar.
* src/sheet-view.c (sheet_view_redraw_cell_region): Silly mistake
fix. Last time I touched this routine i got too excited. I
should use *_col_get_distance only for numbers, not rows.
My variables were badly named and I thus commmited a mistake, fix.
1998-09-01 Miguel de Icaza <miguel@nuclecu.unam.mx> 1998-09-01 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/dialog-cell-format.c (create_align_page): Added support for * src/dialog-cell-format.c (create_align_page): Added support for
......
<!DOCTYPE book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
\title {The Gnumeric Spreadsheet Internal Design} ]>
\author { Miguel de Icaza \\ \bf {(miguel@gnu.org)} }
<book id="gnumeric-design">
<bookinfo>
\section { Design goals } <title>The Gnumeric Spreadsheet Internal Design</title>
<releaseinfo>September 2, 1998</releaseinfo>
The Gnumeric Spreadsheet is a spreadsheet that is intended to grow in <author>
the future to provide all of the features available in <firstname>Miguel</firstname>
commercial-grade spreadsheets. <surname>de Icaza</surname>
<affiliation>
I am not only intending to provide Gnumeric with a very good <shortaffil>Instituto de Ciencias Nucleares, Universidad
computation engine, but I am also interested in making the GUI Nacional Autónoma de México
experience for the user as pleasant as possible, and that includes </shortaffil>
taking a lot of ideas from existing spreadsheets. </affiliation>
</author>
\section {Basic organization} <address><email>miguel@gnu.org</email></address>
<date>September 2, 1998</date>
The Gnumeric spreadsheet is basically organized as Workbooks (see </bookinfo>
src/sheet.h for the definition of the workbook object). There might
be various workbooks loaded at the same time. Every one of these <chapter>
workbooks might have a variable number of Sheets (see src/sheet.h for <title>Gnumeric Internal Design</title>
the definition of the Sheet object), and finally each sheet contains <sect1>
cells (The definition of a Gnumeric Cell is in src/cell.h). <title>Design Goals</title>
\begin{itemize} <para>
The Gnumeric Spreadsheet is a spreadsheet that is intended to grow in
\item Workbooks only take care of keeping various sheets together and giving the future to provide all of the features available in
a name to them. commercial-grade spreadsheets.
</para>
\item Sheets are the repository of information: cells are kept here,
information on the columns and rows is kept here, and the styles <para>
attached to the regions is also kept here. I am not only intending to provide Gnumeric with a very good
computation engine, but I am also interested in making the GUI
Sheets might have multiple views, this is required to support split experience for the user as pleasant as possible, and that includes
views and in the future to support the GNOME document model. The taking a lot of ideas from existing spreadsheets.
actual front-end to the Sheet object is the SheetView object: </para>
SheetView object each one has a number of components: </sect1>
\begin {itemize} <sect1>
\item Their scrollbars. <title>Basic organization</title>
\item Their cell display engine (more in a second).
\item Their bar display (column and row display). <para>
\end{itemize} The Gnumeric spreadsheet is basically organized as Workbooks (see
src/sheet.h for the definition of the workbook object). There might
The cell display engine is basically a modified GnomeCanvas that can be various workbooks loaded at the same time. Every one of these
deal with keystrokes and can do some extra spreadsheet oriented workbooks might have a variable number of Sheets (see src/sheet.h for
tasks. This cell display engine is of type GnumericSheet. the definition of the Sheet object), and finally each sheet contains
cells (The definition of a Gnumeric Cell is in src/cell.h).
\item GnumericSheet objects usually contain a number of Gnome Canvas items </para>
specially designed to be used for a spreadsheet: the Grid Item and the
Cursor Item: <itemizedlist>
\begin{itemize} <listitem><para> Workbooks only take care of keeping various sheets together and giving
a name to them.</para>
\item The Grid item takes care of rendering the actual contents of the Sheet
object and displaying the Cells in the way the user requested, this is <listitem><para>item Sheets are the repository of information:
the actual "core" display engine. cells are kept here, information on the columns and rows is kept
here, and the styles attached to the regions is also kept here.</para>
\item The Cursor item is the item that actually draws the spreadsheet
cursor. This item, as every other Gnome Canvas item can take events <para>Sheets might have multiple views, this is required to support split
and this one is specially interesting, as it provides the basic views and in the future to support the GNOME document model. The
facilities for dragging a region of cells. actual front-end to the Sheet object is the SheetView object:
SheetView object each one has a number of components:</para>
\end{itemize}
<itemizedlist>
During the course of a user session, Gnumeric will create Items of <listitem><para>
type Editor, a special item designed to display the contents of a cell Their scrollbars.</para>
as it is being typed and it is syncronized with a GtkEntry (to provide
an Excel-like way of typing text into the cells). <listitem><para>
Their cell display engine (more in a second).</para>
\end{itemize}
<listitem><para>
\section{Sheet organization} Their bar display (column and row display).</para>
</itemizedlist>
Sheets contain information for columns and rows in linked lists to
facilitate their traversal (in the future, when bottlenecks are <para>The cell display engine is basically a modified GnomeCanvas that can
identified, we will provide an alternate quick access method based on deal with keystrokes and can do some extra spreadsheet oriented
hash tables). tasks. This cell display engine is of type GnumericSheet.</para>
The column and row information is stored in GList's that contain <para>GnumericSheet objects usually contain a number of Gnome Canvas items
ColRowInfo structures. These structures include a number of specially designed to be used for a spreadsheet: the Grid Item and the
interesting bits: Cursor Item:</para>
- Their assigned position (or -1 if they are the "default" <itemizedlist>
style), field name "pos".
<listitem><para>
- The actual width used in pixels (for the current The Grid item takes care of rendering the
magnification setting) as well as their logical size, plus actual contents of the Sheet object and displaying the Cells
the margins required in pixels for displaying various cell in the way the user requested, this is the actual "core"
adornements. display engine.</para>
When a cell is allocated, both ColRowInfos (for column and row) are <listitem><para>
allocated and properly linked, the cell is made to point to these new The Cursor item is the item that actually draws the spreadsheet
structures. cursor. This item, as every other Gnome Canvas item can take events
and this one is specially interesting, as it provides the basic
The column ColRowInfos have a field called "data", this is a linked facilities for dragging a region of cells. </para>
list of Cells for every row where a cell exists.
</itemizedlist>
Cells are stored in a hash table inside the Sheet data structure for
quick retrieval and they are also linked properly in their respective <para>During the course of a user session, Gnumeric will create
columns. Items of type Editor, a special item designed to display the
contents of a cell as it is being typed and it is syncronized
\section{Resource management} with a GtkEntry (to provide an Excel-like way of typing text
into the cells).</para>
Data structures in Gnumeric are lightweight, they are designed to
consume little memory by reusing as much information as possible. </itemizedlist>
This is achieved by making common information be hashed and
reference-counted. This is done with strings, parser/interprester <para> Sheets contain information for columns and rows in linked
symbols and styles. lists to facilitate their traversal (in the future, when
bottlenecks are identified, we will provide an alternate quick
\end{document} access method based on hash tables).</para>
<para>The column and row information is stored in GList's that
contain ColRowInfo structures. These structures include a number
of interesting bits:</para>
<itemizedlist>
<listitem><para> Their assigned position (or -1 if they are
the "default" style), field name "pos".</para>
<listitem><para> The actual width used in pixels (for the
current magnification setting) as well as their logical
size, plus the margins required in pixels for displaying
various cell adornements.</para>
</itemizedlist>
<para>When a cell is allocated, both ColRowInfos (for column and row) are
allocated and properly linked, the cell is made to point to these new
structures.</para>
<para>The column ColRowInfos have a field called "data", this is a linked
list of Cells for every row where a cell exists. </para>
<para>Cells are stored in a hash table inside the Sheet data
structure for quick retrieval and they are also linked properly in
their respective columns. </para>
</sect1>
<sect1>
<title>Resource management</title>
<para>Data structures in Gnumeric are lightweight, they are
designed to consume little memory by reusing as much information
as possible. This is achieved by making common information be
hashed and reference-counted. This is done with strings,
parser/interprester symbols and styles.</para>
</sect1>
</chapter>
</book>
<!DOCTYPE book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
\title {The Gnumeric Spreadsheet Internal Design} ]>
\author { Miguel de Icaza \\ \bf {(miguel@gnu.org)} }
<book id="gnumeric-design">
<bookinfo>
\section { Design goals } <title>The Gnumeric Spreadsheet Internal Design</title>
<releaseinfo>September 2, 1998</releaseinfo>
The Gnumeric Spreadsheet is a spreadsheet that is intended to grow in <author>
the future to provide all of the features available in <firstname>Miguel</firstname>
commercial-grade spreadsheets. <surname>de Icaza</surname>
<affiliation>
I am not only intending to provide Gnumeric with a very good <shortaffil>Instituto de Ciencias Nucleares, Universidad
computation engine, but I am also interested in making the GUI Nacional Autónoma de México
experience for the user as pleasant as possible, and that includes </shortaffil>
taking a lot of ideas from existing spreadsheets. </affiliation>
</author>
\section {Basic organization} <address><email>miguel@gnu.org</email></address>
<date>September 2, 1998</date>
The Gnumeric spreadsheet is basically organized as Workbooks (see </bookinfo>
src/sheet.h for the definition of the workbook object). There might
be various workbooks loaded at the same time. Every one of these <chapter>
workbooks might have a variable number of Sheets (see src/sheet.h for <title>Gnumeric Internal Design</title>
the definition of the Sheet object), and finally each sheet contains <sect1>
cells (The definition of a Gnumeric Cell is in src/cell.h). <title>Design Goals</title>
\begin{itemize} <para>
The Gnumeric Spreadsheet is a spreadsheet that is intended to grow in
\item Workbooks only take care of keeping various sheets together and giving the future to provide all of the features available in
a name to them. commercial-grade spreadsheets.
</para>
\item Sheets are the repository of information: cells are kept here,
information on the columns and rows is kept here, and the styles <para>
attached to the regions is also kept here. I am not only intending to provide Gnumeric with a very good
computation engine, but I am also interested in making the GUI
Sheets might have multiple views, this is required to support split experience for the user as pleasant as possible, and that includes
views and in the future to support the GNOME document model. The taking a lot of ideas from existing spreadsheets.
actual front-end to the Sheet object is the SheetView object: </para>
SheetView object each one has a number of components: </sect1>
\begin {itemize} <sect1>
\item Their scrollbars. <title>Basic organization</title>
\item Their cell display engine (more in a second).
\item Their bar display (column and row display). <para>
\end{itemize} The Gnumeric spreadsheet is basically organized as Workbooks (see
src/sheet.h for the definition of the workbook object). There might
The cell display engine is basically a modified GnomeCanvas that can be various workbooks loaded at the same time. Every one of these
deal with keystrokes and can do some extra spreadsheet oriented workbooks might have a variable number of Sheets (see src/sheet.h for
tasks. This cell display engine is of type GnumericSheet. the definition of the Sheet object), and finally each sheet contains
cells (The definition of a Gnumeric Cell is in src/cell.h).
\item GnumericSheet objects usually contain a number of Gnome Canvas items </para>
specially designed to be used for a spreadsheet: the Grid Item and the
Cursor Item: <itemizedlist>
\begin{itemize} <listitem><para> Workbooks only take care of keeping various sheets together and giving
a name to them.</para>
\item The Grid item takes care of rendering the actual contents of the Sheet
object and displaying the Cells in the way the user requested, this is <listitem><para>item Sheets are the repository of information:
the actual "core" display engine. cells are kept here, information on the columns and rows is kept
here, and the styles attached to the regions is also kept here.</para>
\item The Cursor item is the item that actually draws the spreadsheet
cursor. This item, as every other Gnome Canvas item can take events <para>Sheets might have multiple views, this is required to support split
and this one is specially interesting, as it provides the basic views and in the future to support the GNOME document model. The
facilities for dragging a region of cells. actual front-end to the Sheet object is the SheetView object:
SheetView object each one has a number of components:</para>
\end{itemize}
<itemizedlist>
During the course of a user session, Gnumeric will create Items of <listitem><para>
type Editor, a special item designed to display the contents of a cell Their scrollbars.</para>
as it is being typed and it is syncronized with a GtkEntry (to provide
an Excel-like way of typing text into the cells). <listitem><para>
Their cell display engine (more in a second).</para>
\end{itemize}
<listitem><para>
\section{Sheet organization} Their bar display (column and row display).</para>
</itemizedlist>
Sheets contain information for columns and rows in linked lists to
facilitate their traversal (in the future, when bottlenecks are <para>The cell display engine is basically a modified GnomeCanvas that can
identified, we will provide an alternate quick access method based on deal with keystrokes and can do some extra spreadsheet oriented
hash tables). tasks. This cell display engine is of type GnumericSheet.</para>
The column and row information is stored in GList's that contain <para>GnumericSheet objects usually contain a number of Gnome Canvas items
ColRowInfo structures. These structures include a number of specially designed to be used for a spreadsheet: the Grid Item and the
interesting bits: Cursor Item:</para>
- Their assigned position (or -1 if they are the "default" <itemizedlist>
style), field name "pos".
<listitem><para>
- The actual width used in pixels (for the current The Grid item takes care of rendering the
magnification setting) as well as their logical size, plus actual contents of the Sheet object and displaying the Cells
the margins required in pixels for displaying various cell in the way the user requested, this is the actual "core"
adornements. display engine.</para>
When a cell is allocated, both ColRowInfos (for column and row) are <listitem><para>
allocated and properly linked, the cell is made to point to these new The Cursor item is the item that actually draws the spreadsheet
structures. cursor. This item, as every other Gnome Canvas item can take events
and this one is specially interesting, as it provides the basic
The column ColRowInfos have a field called "data", this is a linked facilities for dragging a region of cells. </para>
list of Cells for every row where a cell exists.
</itemizedlist>
Cells are stored in a hash table inside the Sheet data structure for
quick retrieval and they are also linked properly in their respective <para>During the course of a user session, Gnumeric will create
columns. Items of type Editor, a special item designed to display the
contents of a cell as it is being typed and it is syncronized
\section{Resource management} with a GtkEntry (to provide an Excel-like way of typing text
into the cells).</para>
Data structures in Gnumeric are lightweight, they are designed to
consume little memory by reusing as much information as possible. </itemizedlist>
This is achieved by making common information be hashed and
reference-counted. This is done with strings, parser/interprester <para> Sheets contain information for columns and rows in linked
symbols and styles. lists to facilitate their traversal (in the future, when
bottlenecks are identified, we will provide an alternate quick
\end{document} access method based on hash tables).</para>
<para>The column and row information is stored in GList's that
contain ColRowInfo structures. These structures include a number
of interesting bits:</para>
<itemizedlist>
<listitem><para> Their assigned position (or -1 if they are
the "default" style), field name "pos".</para>
<listitem><para> The actual width used in pixels (for the
current magnification setting) as well as their logical
size, plus the margins required in pixels for displaying
various cell adornements.</para>
</itemizedlist>
<para>When a cell is allocated, both ColRowInfos (for column and row) are
allocated and properly linked, the cell is made to point to these new
structures.</para>
<para>The column ColRowInfos have a field called "data", this is a linked
list of Cells for every row where a cell exists. </para>
<para>Cells are stored in a hash table inside the Sheet data
structure for quick retrieval and they are also linked properly in
their respective columns. </para>
</sect1>
<sect1>
<title>Resource management</title>
<para>Data structures in Gnumeric are lightweight, they are
designed to consume little memory by reusing as much information
as possible. This is achieved by making common information be
hashed and reference-counted. This is done with strings,
parser/interprester symbols and styles.</para>
</sect1>
</chapter>
</book>
...@@ -59,10 +59,12 @@ cell_set_alignment (Cell *cell, int halign, int valign, int orient, int auto_ret ...@@ -59,10 +59,12 @@ cell_set_alignment (Cell *cell, int halign, int valign, int orient, int auto_ret
g_return_if_fail (cell->style != NULL); g_return_if_fail (cell->style != NULL);
if ((cell->style->halign == halign) && if ((cell->style->halign == halign) &&
(cell->style->halign == valign) && (cell->style->valign == valign) &&
(cell->style->orientation == orient)) (cell->style->orientation == orient))
return; return;
cell_queue_redraw (cell);
cell->style->halign = halign; cell->style->halign = halign;
cell->style->valign = valign; cell->style->valign = valign;
cell->style->orientation = orient; cell->style->orientation = orient;
...@@ -73,6 +75,21 @@ cell_set_alignment (Cell *cell, int halign, int valign, int orient, int auto_ret ...@@ -73,6 +75,21 @@ cell_set_alignment (Cell *cell, int halign, int valign, int orient, int auto_ret
cell_queue_redraw (cell); cell_queue_redraw (cell);
} }
void
cell_set_halign (Cell *cell, StyleHAlignFlags halign)
{
g_return_if_fail (cell != NULL);
if (cell->style->halign == halign)
return;
cell_queue_redraw (cell);
cell->style->halign = halign;
cell_calc_dimensions (cell);
cell_queue_redraw (cell);
}
void void
cell_set_font_from_style (Cell *cell, StyleFont *style_font) cell_set_font_from_style (Cell *cell, StyleFont *style_font)
{ {
...@@ -81,6 +98,8 @@ cell_set_font_from_style (Cell *cell, StyleFont *style_font) ...@@ -81,6 +98,8 @@ cell_set_font_from_style (Cell *cell, StyleFont *style_font)
g_return_if_fail (cell != NULL); g_return_if_fail (cell != NULL);
g_return_if_fail (style_font != NULL); g_return_if_fail (style_font != NULL);
cell_queue_redraw (cell);
style_font_unref (cell->style->font); style_font_unref (cell->style->font);
style_font_ref (style_font); style_font_ref (style_font);
...@@ -155,6 +174,8 @@ cell_set_text (Cell *cell, char *text) ...@@ -155,6 +174,8 @@ cell_set_text (Cell *cell, char *text)
g_return_if_fail (cell != NULL); g_return_if_fail (cell != NULL);
g_return_if_fail (text != NULL); g_return_if_fail (text != NULL);