[scribus-dev] Tables GSoC - Weekly Report #1

Elvis Stansvik elvstone at gmail.com
Sun Jun 5 16:16:13 UTC 2011


Hi all,

I'll be writing simple weekly reports for the work I'm doing on
tables, starting today. One report each Sunday. The reports will have
the following format

Work Report
List of things I've been up to in the past week.

Project Status
Status report on how well I'm keeping up with the schedule in my
proposal, and if I'm behind/ahead of schedule what the reasons for
that is.

Problems / Questions
Any questions / road blocks / problems I'm having trouble with as well
as smaller questions, and possibly if I need any advice on the
direction to take next.

Next Week
An outlook on the work ahead of me and plans for next week, and if
there are any changes to the schedule in my proposal, a rationale for
these changes.

The reports are mainly intended for Craig, but as this is such a low
volume list it probably can't hurt sending the reports directly to
here instead of privately to Craig.

So without further a ado, here's my first report. The report covers
the work I've been doing since the project start (and before). I'll
use wiki markup for the titles, since who knows if these reports might
go in there at some point, and besides I kind of like the look of
them. As this is the very first report, I also took the time and did a
little screencast where I create and manipulate a table. It pretty
much shows off what I have so far. It's available at

http://www.nya-doxa.se/elvis/gsoc2011/week1_screencast.ogv

I probably won't do this for every report.

I'll also try in the next few days to make a first blog post, but as
you know, blogging takes time off from hacking :)

Regards,
Elvis

= Tables GSoC - Weekly Report #1 =

== Work Report ==
* Added a skeleton of a table style. This was way back in April, just
to see what work is involved in creating a new type of style. The
style is the most basic one imaginable. At the moment I think it has a
single property for background color and styles can be managed in the
SM. Also, it doesn't do inheritance yet, though that should be
relatively easy to fix.
* Added class PageItem_Table, a new page item for tables. The class
represents a grid of table cells by keeping a few lists with row /
column geometries.
* Added ability to insert a new PageItem_Table from toolbar or Insert
menu followed by mouse dragging. Just like the current "tables".
* Added API to PageItem_Table for the basic table operations
** insert and remove rows and columns,
** resize rows and column,
* Added support for merging cells to PageItem_Table as well as an
accompanying helper class CellArea used when keeping track of areas of
merged cells. The CellArea class also comes with what I think is the
very first unit tests in Scribus. The tests are in tests/ and can be
runned using `make test'. In the future, feel free to add more unit
tests here if you think there are classes in Scribus that that are
easy to unit test and could benefit from it.
* Added some rudimentary painting to PageItem_Table, just to be able
to see the cells. Still a long way to go for proper table / cell
painting, which is kind of non-trivial.
* As scriptability allows me to experiment with tables before any UI
is done, I've added the following new scripting methods. These have
been added to the old scripter, but should be easy enough to port to
ScripterNG later on.
** createTable(x, y, width, height, numRows, numColumns, ["name"])
** getTableRows(["name"])
** getTableColumns(["name"])
** insertTableRows(index, numRows, ["name"])
** removeTableRows(index, numRows, ["name"])
** getTableRowHeight(row, ["name"])
** setTableRowHeight(row, height, ["name"])
** insertTableColumns(index, numColumns, ["name"])
** removeTableColumns(index, numColumns, ["name"])
** getTableColumnWidth(column, ["name"])
** setTableColumnWidth(row, height, ["name"])
** mergeTableCells(row, column, numRows, numColumns, ["name"])

== Project Status ==
The goal in the schedule for this first week was simply "Data
structures for tables". Intentionally a quite moderate goal, as I
didn't know how long it would take to get up to speed. So
unsurprisingly, I think I'm a little ahead of schedule. Worth noting
though is that the tables are currently only skeletal in their nature;
they hold no content and are simply a grid of empty cells. This is all
according to plan though, and integration with text frames is
scheduled for later.

== Problems / Questions ==
Only have one quite specific question at the moment (though more will
come for sure):

* How do I set a clipping rectangle on the painter when painting an
item in PageItem::DrawObj_Item(...) ? Some method call to set the
clipping path followed by a call to setClipPath on the painter? I
looked a bit at the other items but haven't quite figured it out yet.
So if someone knows off-hand how to do it that would be great.

== Next Week ==
The goals for next week according to the schedule is

* Basic table layout with fixed column widths and mock content in cells.
* Insertion/removal of rows/columns.
* Basic drawing of table.

but as at least some of this has already been done, I think I'll start
looking at other things as well. Ideas include

* Cell borders / padding.
* Add splitCells(int, int, int, int), symmetric to the current
mergeCells(int, int, int, int).
* Painting of table / cells.
* Table and cell styles.
* Start looking at UI:
** Editing through Property Palette.
** Canvas mode for editing and selecting cells / rows / columns.
* Start looking at saving / loading (probably a bit premature).

Lots of things to pick and choose from, and if you have thoughts on
which direction to go in first, I'm idle ears. Otherwise I'll just
pick what feels most natural and go with it.

I don't think I want to start looking at integration of text frames
just yet as I have a feeling that is going to be one of the toughest
parts of the project. Besides, there are plenty of things to do before
that can be done orthogonally to the integration of text frames. I'd
like to have quite robust support for the other things before starting
to crack that nut. Keep my back clear and don't spread myself too thin
so to speak. So I think I'll stick to my schedule when it comes to
this and not stick my head in that beehive until week 4 ;)



More information about the scribus-dev mailing list