This is the first in a series of blog posts detailing my work with bringing proper support for tables to Scribus as part of Summer of Code 2011. I’ll try to keep the posts in roughly the same format as the reports I’m sending off to my mentor Craig each week. This will make it easier for me to reuse some of the material, saving hacking time :) Each post will be divided into the following sections:
- Work Report, a report on what I’ve been up to since my last report.
- Project Status, how I’m standing with regard to the schedule in my project proposal.
- Upcoming Work, a rough outline of my next steps.
As this is the very first blog post about my project, I’ll start with a little introduction with general information about my project.
Tables provide a compact way of representing tabular information in a page layout, and is a common design element in books, magazines and advertisements. Scribus currently has a shortcut for creating an automatically grouped table-like array of text frames. These are not proper tables. To stay competitive, Scribus needs better support for tables. Support that enables the user to create and edit tables as distinct items with their own set of properties as commonly found in other table implementations. This is the rationale for my Summer of Code project, in which I’ll add a new table page item to Scribus.
The user should be able to perform common table operations such as inserting rows and columns, merging and splitting cells, formatting borders and backgrounds as well as editing the text of the table. The table will represent the text of the cells using standard Scribus text frames.
More information can be found in my project proposal.
So without further ado, here follows my first report.
- Bootstrapping: Drafted an initial design document including some mockups on the Scribus wiki and discussed the ideas in detail on the scribus-dev mailing list. Also set up a development environment (using Qt Creator this time even though I’m a die-hard Vim junkie).
- 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. Instances of the new table style can be managed in the Style Manager. It doesn’t do style 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_Tablefrom toolbar or Insert menu followed by mouse dragging. Just like the current “tables”.
- Added API to
PageItem_Tablefor the basic table operations
- insert and remove rows and columns,
- resize rows and column.
- Added support for merging cells to
PageItem_Tableas well as an accompanying helper class
CellAreaused when keeping track of areas of merged cells. The
CellAreaclass also comes with what I think is the very first unit tests in Scribus. The tests are in
tests/and can be runned using
- 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"])
insertTableRows(index, numRows, ["name"])
removeTableRows(index, numRows, ["name"])
setTableRowHeight(row, height, ["name"])
insertTableColumns(index, numColumns, ["name"])
removeTableColumns(index, numColumns, ["name"])
setTableColumnWidth(column, width, ["name"])
mergeTableCells(row, column, numRows, numColumns, ["name"])
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.
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. Right now I’m looking at proper table / cell border painting, as well as fixing a couple of bugs in the code I have so far.
I have an installation of Adobe InDesign CS5.5 running in VirtualBox and I’ve been looking at what border model they’re using and how they’re doing border conflict resolution. It seems to be a variant of the CSS2 collapsing border model, which is probably what I’ll try to go for initially in Scribus as well.
That’s all for now folks! I’ll conclude with a little screencast showing me playing around with a table using the new scripting methods. I highly recommend you download the source OGV instead of watching it here, as the quality turned out quite bad in the blip.tv conversion.