1
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
2
/* This file is part of the GtkHTML library.
4
Copyright (C) 2000 Helix Code, Inc.
5
Copyright (C) 2001, 2002 Ximian, Inc.
8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Library General Public
10
License as published by the Free Software Foundation; either
11
version 2 of the License, or (at your option) any later version.
13
This library is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
Library General Public License for more details.
18
You should have received a copy of the GNU Library General Public License
19
along with this library; see the file COPYING.LIB. If not, write to
20
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
Boston, MA 02110-1301, USA.
4
* Copyright (C) 2000 Helix Code, Inc.
5
* Copyright (C) 2001, 2002 Ximian, Inc.
6
* Authors: Radek Doulik
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Library General Public
10
* License as published by the Free Software Foundation; either
11
* version 2 of the License, or (at your option) any later version.
13
* This library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Library General Public License for more details.
18
* You should have received a copy of the GNU Library General Public License
19
* along with this library; see the file COPYING.LIB. If not, write to
20
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
* Boston, MA 02110-1301, USA.
24
24
#include <config.h>
104
html_engine_insert_table (HTMLEngine *e, gint cols, gint rows, gint width, gint percent,
105
gint padding, gint spacing, gint border)
105
html_engine_insert_table (HTMLEngine *e,
107
114
HTMLObject *table;
119
126
html_table_end_row (HTML_TABLE (table));
122
html_engine_append_object (e, table, 1 + rows*cols);
123
html_cursor_backward_n (e->cursor, e, rows*cols);
129
html_engine_append_object (e, table, 1 + rows * cols);
130
html_cursor_backward_n (e->cursor, e, rows * cols);
150
insert_column_undo_action (HTMLEngine *e, HTMLUndoData *data, HTMLUndoDirection dir, guint position_after)
157
insert_column_undo_action (HTMLEngine *e,
159
HTMLUndoDirection dir,
160
guint position_after)
152
162
html_table_delete_column (html_engine_get_table (e), e, INSERT_UNDO (data)->pos, html_undo_direction_reverse (dir));
156
insert_column_setup_undo (HTMLEngine *e, gint col, guint position_before, HTMLUndoDirection dir)
166
insert_column_setup_undo (HTMLEngine *e,
168
guint position_before,
169
HTMLUndoDirection dir)
158
171
html_undo_add_action (e->undo, e,
159
172
html_undo_action_new ("Insert table column", insert_column_undo_action,
166
html_engine_goto_table_0 (HTMLEngine *e, HTMLTable *table)
179
html_engine_goto_table_0 (HTMLEngine *e,
168
182
return html_cursor_jump_to (e->cursor, e, HTML_OBJECT (table), 0);
172
html_engine_goto_table (HTMLEngine *e, HTMLTable *table, gint row, gint col)
186
html_engine_goto_table (HTMLEngine *e,
174
191
HTMLTableCell *cell;
358
delete_column_setup_undo (HTMLEngine *e, HTMLTableCell **column, gint size, guint position_after, gint col, HTMLUndoDirection dir)
389
delete_column_setup_undo (HTMLEngine *e,
390
HTMLTableCell **column,
392
guint position_after,
394
HTMLUndoDirection dir)
360
396
html_undo_add_action (e->undo, e,
361
397
html_undo_action_new ("Delete table column", delete_column_undo_action,
433
html_engine_get_table_start_end_cells (HTMLEngine *e, HTMLTableCell **start_cell, HTMLTableCell **end_cell)
474
html_engine_get_table_start_end_cells (HTMLEngine *e,
475
HTMLTableCell **start_cell,
476
HTMLTableCell **end_cell)
435
478
if (!e->cursor->object->parent ||
436
479
!e->cursor->object->parent->parent ||
503
insert_row_undo_action (HTMLEngine *e, HTMLUndoData *data, HTMLUndoDirection dir, guint position_after)
546
insert_row_undo_action (HTMLEngine *e,
548
HTMLUndoDirection dir,
549
guint position_after)
505
551
html_table_delete_row (html_engine_get_table (e), e, INSERT_UNDO (data)->pos, html_undo_direction_reverse (dir));
509
insert_row_setup_undo (HTMLEngine *e, gint row, guint position_before, HTMLUndoDirection dir)
555
insert_row_setup_undo (HTMLEngine *e,
557
guint position_before,
558
HTMLUndoDirection dir)
511
560
html_undo_add_action (e->undo, e,
512
561
html_undo_action_new ("Insert table row", insert_row_undo_action,
520
html_table_insert_row (HTMLTable *t, HTMLEngine *e, gint row, HTMLTableCell **row_cells, HTMLUndoDirection dir)
569
html_table_insert_row (HTMLTable *t,
572
HTMLTableCell **row_cells,
573
HTMLUndoDirection dir)
522
575
HTMLTableCell *cell;
612
delete_row_setup_undo (HTMLEngine *e, HTMLTableCell **row_cells, gint size, guint position_after,
613
gint row, HTMLUndoDirection dir)
669
delete_row_setup_undo (HTMLEngine *e,
670
HTMLTableCell **row_cells,
672
guint position_after,
674
HTMLUndoDirection dir)
615
676
html_undo_add_action (e->undo, e,
616
677
html_undo_action_new ("Delete table row", delete_row_undo_action,
786
852
static void table_set_border_width (HTMLEngine *e, HTMLTable *t, gint border_width, gboolean relative, HTMLUndoDirection dir);
789
table_set_border_width_undo_action (HTMLEngine *e, HTMLUndoData *undo_data, HTMLUndoDirection dir, guint position_after)
855
table_set_border_width_undo_action (HTMLEngine *e,
856
HTMLUndoData *undo_data,
857
HTMLUndoDirection dir,
858
guint position_after)
791
860
table_set_border_width (e, html_engine_get_table (e), ((HTMLTableSetAttrUndo *) undo_data)->attr.border, FALSE,
792
861
html_undo_direction_reverse (dir));
796
table_set_border_width (HTMLEngine *e, HTMLTable *t, gint border_width, gboolean relative, HTMLUndoDirection dir)
865
table_set_border_width (HTMLEngine *e,
869
HTMLUndoDirection dir)
798
871
HTMLTableSetAttrUndo *undo;
829
html_engine_table_set_border_width (HTMLEngine *e, HTMLTable *t, gint border_width, gboolean relative)
902
html_engine_table_set_border_width (HTMLEngine *e,
831
907
table_set_border_width (e, t, border_width, relative, HTML_UNDO_UNDO);
839
915
static void table_set_bg_color (HTMLEngine *e, HTMLTable *t, GdkColor *c, HTMLUndoDirection dir);
842
table_set_bg_color_undo_action (HTMLEngine *e, HTMLUndoData *undo_data, HTMLUndoDirection dir, guint position_after)
918
table_set_bg_color_undo_action (HTMLEngine *e,
919
HTMLUndoData *undo_data,
920
HTMLUndoDirection dir,
921
guint position_after)
844
923
HTMLTableSetAttrUndo *data = (HTMLTableSetAttrUndo *) undo_data;
845
924
HTMLTable *table = html_engine_get_table (e);
883
html_engine_table_set_bg_color (HTMLEngine *e, HTMLTable *t, GdkColor *c)
965
html_engine_table_set_bg_color (HTMLEngine *e,
885
969
table_set_bg_color (e, t, c, HTML_UNDO_UNDO);
893
977
static void table_set_bg_pixmap (HTMLEngine *e, HTMLTable *t, gchar *url, HTMLUndoDirection dir);
896
table_set_bg_pixmap_undo_action (HTMLEngine *e, HTMLUndoData *undo_data, HTMLUndoDirection dir, guint position_after)
980
table_set_bg_pixmap_undo_action (HTMLEngine *e,
981
HTMLUndoData *undo_data,
982
HTMLUndoDirection dir,
983
guint position_after)
898
985
HTMLTableSetAttrUndo *data = (HTMLTableSetAttrUndo *) undo_data;
925
html_engine_table_set_bg_pixmap (HTMLEngine *e, HTMLTable *t, gchar *url)
1015
html_engine_table_set_bg_pixmap (HTMLEngine *e,
927
1019
table_set_bg_pixmap (e, t, url, HTML_UNDO_UNDO);
935
1027
static void table_set_spacing (HTMLEngine *e, HTMLTable *t, gint spacing, gboolean relative, HTMLUndoDirection dir);
938
table_set_spacing_undo_action (HTMLEngine *e, HTMLUndoData *undo_data, HTMLUndoDirection dir, guint position_after)
1030
table_set_spacing_undo_action (HTMLEngine *e,
1031
HTMLUndoData *undo_data,
1032
HTMLUndoDirection dir,
1033
guint position_after)
940
1035
HTMLTableSetAttrUndo *data = (HTMLTableSetAttrUndo *) undo_data;
946
table_set_spacing (HTMLEngine *e, HTMLTable *t, gint spacing, gboolean relative, HTMLUndoDirection dir)
1041
table_set_spacing (HTMLEngine *e,
1045
HTMLUndoDirection dir)
948
1047
HTMLTableSetAttrUndo *undo;
949
1048
gint new_spacing;
976
html_engine_table_set_spacing (HTMLEngine *e, HTMLTable *t, gint spacing, gboolean relative)
1075
html_engine_table_set_spacing (HTMLEngine *e,
978
1080
table_set_spacing (e, t, spacing, relative, HTML_UNDO_UNDO);
986
1088
static void table_set_padding (HTMLEngine *e, HTMLTable *t, gint padding, gboolean relative, HTMLUndoDirection dir);
989
table_set_padding_undo_action (HTMLEngine *e, HTMLUndoData *undo_data, HTMLUndoDirection dir, guint position_after)
1091
table_set_padding_undo_action (HTMLEngine *e,
1092
HTMLUndoData *undo_data,
1093
HTMLUndoDirection dir,
1094
guint position_after)
991
1096
HTMLTableSetAttrUndo *data = (HTMLTableSetAttrUndo *) undo_data;
997
table_set_padding (HTMLEngine *e, HTMLTable *t, gint padding, gboolean relative, HTMLUndoDirection dir)
1102
table_set_padding (HTMLEngine *e,
1106
HTMLUndoDirection dir)
999
1108
HTMLTableSetAttrUndo *undo;
1035
html_engine_table_set_padding (HTMLEngine *e, HTMLTable *t, gint padding, gboolean relative)
1144
html_engine_table_set_padding (HTMLEngine *e,
1037
1149
table_set_padding (e, t, padding, relative, HTML_UNDO_UNDO);
1045
1157
static void table_set_align (HTMLEngine *e, HTMLTable *t, HTMLHAlignType align, HTMLUndoDirection dir);
1048
table_set_align_undo_action (HTMLEngine *e, HTMLUndoData *undo_data, HTMLUndoDirection dir, guint position_after)
1160
table_set_align_undo_action (HTMLEngine *e,
1161
HTMLUndoData *undo_data,
1162
HTMLUndoDirection dir,
1163
guint position_after)
1050
1165
HTMLTableSetAttrUndo *data = (HTMLTableSetAttrUndo *) undo_data;
1102
html_engine_table_set_align (HTMLEngine *e, HTMLTable *t, HTMLHAlignType align)
1220
html_engine_table_set_align (HTMLEngine *e,
1222
HTMLHAlignType align)
1104
1224
table_set_align (e, t, align, HTML_UNDO_UNDO);
1112
1232
static void table_set_width (HTMLEngine *e, HTMLTable *t, gint width, gboolean percent, HTMLUndoDirection dir);
1115
table_set_width_undo_action (HTMLEngine *e, HTMLUndoData *undo_data, HTMLUndoDirection dir, guint position_after)
1235
table_set_width_undo_action (HTMLEngine *e,
1236
HTMLUndoData *undo_data,
1237
HTMLUndoDirection dir,
1238
guint position_after)
1117
1240
HTMLTableSetAttrUndo *data = (HTMLTableSetAttrUndo *) undo_data;
1124
table_set_width (HTMLEngine *e, HTMLTable *t, gint width, gboolean percent, HTMLUndoDirection dir)
1247
table_set_width (HTMLEngine *e,
1251
HTMLUndoDirection dir)
1126
1253
HTMLTableSetAttrUndo *undo;
1157
html_engine_table_set_width (HTMLEngine *e, HTMLTable *t, gint width, gboolean percent)
1284
html_engine_table_set_width (HTMLEngine *e,
1159
1289
table_set_width (e, t, width, percent, HTML_UNDO_UNDO);