Huw Davies : riched20: Use cell ptrs to link the cells.
Alexandre Julliard
julliard at winehq.org
Fri Nov 6 14:15:24 CST 2020
Module: wine
Branch: master
Commit: 3131f919405dd2373259f087cc779aeff9ab86a5
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3131f919405dd2373259f087cc779aeff9ab86a5
Author: Huw Davies <huw at codeweavers.com>
Date: Fri Nov 6 08:32:22 2020 +0000
riched20: Use cell ptrs to link the cells.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/riched20/editstr.h | 4 ++--
dlls/riched20/para.c | 31 ++++++++++++++-----------------
dlls/riched20/table.c | 8 +++-----
3 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h
index bd839afb0c0..9c2cdd685b1 100644
--- a/dlls/riched20/editstr.h
+++ b/dlls/riched20/editstr.h
@@ -206,7 +206,7 @@ typedef struct tagME_Paragraph
PARAFORMAT2 fmt;
ME_String *text;
- struct tagME_DisplayItem *pCell; /* v4.1 */
+ struct tagME_Cell *cell; /* v4.1 */
ME_BorderRect border;
int nCharOfs;
@@ -228,7 +228,7 @@ typedef struct tagME_Cell /* v4.1 */
POINT pt;
int nHeight, nWidth;
int yTextOffset; /* The text offset is caused by the largest top border. */
- struct tagME_DisplayItem *prev_cell, *next_cell, *parent_cell;
+ struct tagME_Cell *prev_cell, *next_cell, *parent_cell;
} ME_Cell;
typedef struct tagME_Row
diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c
index 47640a6fd50..d01a264765a 100644
--- a/dlls/riched20/para.c
+++ b/dlls/riched20/para.c
@@ -126,8 +126,7 @@ BOOL para_in_table( ME_Paragraph *para )
ME_Cell *para_cell( ME_Paragraph *para )
{
- if (!para->pCell) return NULL;
- return ¶->pCell->member.cell;
+ return para->cell;
}
ME_Row *para_first_row( ME_Paragraph *para )
@@ -625,13 +624,13 @@ ME_Paragraph *para_split( ME_TextEditor *editor, ME_Run *run, ME_Style *style,
{
ME_Cell *cell = cell_create();
ME_InsertBefore( para_get_di( new_para ), cell_get_di( cell ) );
- new_para->pCell = cell_get_di( cell );
+ new_para->cell = cell;
cell->next_cell = NULL;
if (paraFlags & MEPF_ROWSTART)
{
old_para->nFlags |= MEPF_ROWSTART;
cell->prev_cell = NULL;
- cell->parent_cell = old_para->pCell;
+ cell->parent_cell = old_para->cell;
if (para_cell( old_para ))
cell->nNestingLevel = para_cell( old_para )->nNestingLevel + 1;
else
@@ -639,8 +638,8 @@ ME_Paragraph *para_split( ME_TextEditor *editor, ME_Run *run, ME_Style *style,
}
else
{
- cell->prev_cell = old_para->pCell;
- cell_prev( cell )->next_cell = cell_get_di( cell );
+ cell->prev_cell = old_para->cell;
+ cell_prev( cell )->next_cell = cell;
assert( old_para->nFlags & MEPF_CELL );
assert( !(old_para->nFlags & MEPF_ROWSTART) );
cell->nNestingLevel = cell_prev( cell )->nNestingLevel;
@@ -650,19 +649,19 @@ ME_Paragraph *para_split( ME_TextEditor *editor, ME_Run *run, ME_Style *style,
else if (paraFlags & MEPF_ROWEND)
{
old_para->nFlags |= MEPF_ROWEND;
- old_para->pCell = old_para->pCell->member.cell.parent_cell;
- new_para->pCell = old_para->pCell;
+ old_para->cell = old_para->cell->parent_cell;
+ new_para->cell = old_para->cell;
assert( para_prev( old_para )->nFlags & MEPF_CELL );
assert( !(para_prev( old_para )->nFlags & MEPF_ROWSTART) );
- if (new_para->pCell != para_next( new_para )->pCell
- && para_next( new_para )->pCell
- && !para_next( new_para )->pCell->member.cell.prev_cell)
+ if (new_para->cell != para_next( new_para )->cell
+ && para_next( new_para )->cell
+ && !cell_prev( para_next( new_para )->cell ))
{
/* Row starts just after the row that was ended. */
new_para->nFlags |= MEPF_ROWSTART;
}
}
- else new_para->pCell = old_para->pCell;
+ else new_para->cell = old_para->cell;
table_update_flags( old_para );
table_update_flags( new_para );
@@ -721,7 +720,7 @@ ME_Paragraph *para_join( ME_TextEditor *editor, ME_Paragraph *para, BOOL use_fir
{
/* Table cell/row properties are always moved over from the removed para. */
para->nFlags = next->nFlags;
- para->pCell = next->pCell;
+ para->cell = next->cell;
/* Remove cell boundary if it is between the end paragraph run and the next
* paragraph display item. */
@@ -740,10 +739,8 @@ ME_Paragraph *para_join( ME_TextEditor *editor, ME_Paragraph *para, BOOL use_fir
if (cell)
{
ME_Remove( cell_get_di( cell ) );
- if (cell_prev( cell ))
- cell_prev( cell )->next_cell = cell_next( cell ) ? cell_get_di( cell_next( cell ) ) : NULL;
- if (cell_next( cell ))
- cell_next( cell )->prev_cell = cell_prev( cell ) ? cell_get_di( cell_prev( cell ) ) : NULL;
+ if (cell_prev( cell )) cell_prev( cell )->next_cell = cell_next( cell );
+ if (cell_next( cell )) cell_next( cell )->prev_cell = cell_prev( cell );
ME_DestroyDisplayItem( cell_get_di( cell ) );
}
diff --git a/dlls/riched20/table.c b/dlls/riched20/table.c
index 08f04e06ca7..8d58c3e4f8f 100644
--- a/dlls/riched20/table.c
+++ b/dlls/riched20/table.c
@@ -96,7 +96,7 @@ ME_Paragraph* table_insert_row_start_at_para( ME_TextEditor *editor, ME_Paragrap
while (para != end_para)
{
- para->pCell = cell_get_di( para_cell( prev_para ) );
+ para->cell = para_cell( prev_para );
para->nFlags |= MEPF_CELL;
para->nFlags &= ~(MEPF_ROWSTART | MEPF_ROWEND);
para->fmt.dwMask |= PFM_TABLE | PFM_TABLEROWDELIMITER;
@@ -193,14 +193,12 @@ ME_Cell *cell_create( void )
ME_Cell *cell_next( ME_Cell *cell )
{
- if (!cell->next_cell) return NULL;
- return &cell->next_cell->member.cell;
+ return cell->next_cell;
}
ME_Cell *cell_prev( ME_Cell *cell )
{
- if (!cell->prev_cell) return NULL;
- return &cell->prev_cell->member.cell;
+ return cell->prev_cell;
}
ME_Paragraph *cell_first_para( ME_Cell *cell )
More information about the wine-cvs
mailing list