Bring Table menu and table properties dialog up to intended 5.0 functionality.

This commit is contained in:
akkana%netscape.com 1998-08-03 20:51:45 +00:00
Родитель 1506b919fa
Коммит 3bdf782a5b
9 изменённых файлов: 322 добавлений и 226 удалений

Просмотреть файл

@ -1439,7 +1439,15 @@ fe_EditorIndent(MWContext* context, Boolean is_indent)
void
fe_EditorAlignSet(MWContext* pMWContext, ED_Alignment align)
{
ED_ElementType type = EDT_GetCurrentElementType(pMWContext);
ED_ElementType type;
if (EDT_IsInsertPointInTable(pMWContext))
{
EDT_SetTableAlign(pMWContext, align);
return;
}
type = EDT_GetCurrentElementType(pMWContext);
switch ( type ){
case ED_ELEMENT_HRULE:

Просмотреть файл

@ -1948,6 +1948,18 @@ Remove the link corresponding to the selected text
*selectTable.mnemonic: l
*selectTable.documentationString: \
Select the table at the current cursor location
*selectRow.labelString: Row
*selectRow.documentationString: \
Select the table row at the current cursor location
*selectColumn.labelString: Column
*selectColumn.documentationString: \
Select the table Column at the current cursor location
*selectCell.labelString: Cell
*selectCell.documentationString: \
Select the table cell at the current cursor location
*selectAllCells.labelString: All Cells
*selectAllCells.documentationString: \
Select all cells in the table at the current cursor location
*menuBar*editPageSource.labelString: HTML Source
*editPageSource.documentationString: \
@ -2918,7 +2930,7 @@ Set the style to Blink
*menuBar*clearAllStyles.mnemonic: r
*clearAllStyles.documentationString: Remove all character styles
*menuBar*setTableProperties.labelString: Table Properties
*menuBar*setTableProperties.labelString: Table Properties...
*menuBar*setTableProperties.mnemonic: T
*setTableProperties.documentationString: Change table properties
@ -3023,9 +3035,18 @@ Right-justify the current paragraph
!=============================
*menuBar*tableMenu.labelString: Table
!*menuBar*tableMenu*align.labelString: Align Table
*tableInsertMenu.labelString: Insert
*tableDeleteMenu.labelString: Delete
*tableSelectMenu.labelString: Select
*tableSelectMenu*selectTable.labelString: Table
*tableSelectMenu*selectTableRow.labelString: Row
*tableSelectMenu*selectTableColumn.labelString: Column
*tableSelectMenu*selectTableCell.labelString: Cell
*tableSelectMenu*selectTableAllCells.labelString: All Cells
*tableJoin.labelString: Join
*convertTextToTable.labelString: Convert Text to Table
*convertTableToText.labelString: Convert Table to Text
!============================
Tools Menu - Page Composer
@ -4028,10 +4049,10 @@ File/New Document/From Template.
! Cell tab in table dialog
*changeSelection.labelString: Selection
*previous.labelString: Previous
*tableCreateDialog_popup*next.labelString: Next
*selectCell.labelString: Cell
*selectRow.labelString: Row
*selectColumn.labelString: Column
*cellTab*next.labelString: Next
*cellSelect.labelString: Cell
*rowSelect.labelString: Row
*columnSelect.labelString: Column
*cellRowsLabel.labelString: Cell spans
*cellColumnsLabel.labelString: row(s), and
*cellColumnsUnits.labelString: column(s)

Просмотреть файл

@ -118,6 +118,7 @@ static Widget fe_create_background_group(Widget parent, char* name,
/* A routine that comes from Mail/News SearchRuleView.cpp, of all places: */
extern Widget fe_make_option_menu(Widget toplevel, Widget parent,
char* widgetName, Widget *popup);
Widget fe_get_current_attribute_option(Widget parent);
/* Some defs of stuff in editordialogs.c */
extern char* fe_SimpleTableAlignment[];
@ -175,7 +176,6 @@ XFE_EditTableDialog::XFE_EditTableDialog(Widget parent, char *name,
m_context = context;
m_table = table;
m_cell = new fe_EditorTablesCellStruct; // XXX need to get real cell
n = 0;
folder = fe_CreateFolder(m_chrome, "folder", args, n);
@ -202,7 +202,7 @@ XFE_EditTableDialog::XFE_EditTableDialog(Widget parent, char *name,
XFE_EditTableDialog::~XFE_EditTableDialog()
{
delete m_cell;
delete m_table;
}
void
@ -275,10 +275,10 @@ XFE_EditTableDialog::table_toggle_cb(Widget widget,
void
XFE_EditTableDialog::cell_toggle_cb(Widget widget,
XtPointer , XtPointer closure)
XtPointer clientData, XtPointer)
{
#if 1
fe_EditorTablesCellStruct* w_data = (fe_EditorTablesCellStruct*)closure;
XFE_EditTableDialog* edt = (XFE_EditTableDialog*)clientData;
fe_EditorTablesCellStruct* w_data = &(edt->m_cell);
Boolean enabled = XmToggleButtonGetState(widget);
MWContext* context = fe_WidgetToMWContext(widget);
Widget text = NULL;
@ -296,41 +296,41 @@ XFE_EditTableDialog::cell_toggle_cb(Widget widget,
fe_TextFieldSetEditable(context, text, enabled);
if (radio != NULL)
fe_SimpleRadioGroupSetSensitive(radio, enabled);
#else
Widget first = (Widget)closure;
Boolean enabled = XmToggleButtonGetState(widget);
MWContext* context = fe_WidgetToMWContext(widget);
Widget* children;
Cardinal num_children;
Cardinal i;
Widget* group = NULL;
}
XtVaGetValues(XtParent(widget),
XmNchildren, &children,
XmNnumChildren, &num_children, 0);
void
XFE_EditTableDialog::changeSelection(Boolean nextP)
{
ED_MoveSelType moveType;
if (nextP)
moveType = ED_MOVE_NEXT;
else
moveType = ED_MOVE_PREV;
EDT_TableCellData* cellData = EDT_GetTableCellData(m_context);
Widget which = fe_get_current_attribute_option(m_cell.option_menu);
if (!strncmp(XtName(which), "cell", 4))
{
EDT_ChangeTableSelection(m_context, ED_HIT_SEL_CELL,
moveType, cellData);
}
else if (!strncmp(XtName(which), "row", 3))
{
EDT_ChangeTableSelection(m_context, ED_HIT_SEL_ROW,
moveType, cellData);
}
else if (!strncmp(XtName(which), "col", 3))
{
EDT_ChangeTableSelection(m_context, ED_HIT_SEL_COL,
moveType, cellData);
}
}
for (i = 0; i < num_children; i++) {
if (children[i] == first) {
group = &children[i];
break;
}
}
if (!group)
return;
for (i = 0; i < 3; i++) {
if (group[i] == widget)
break;
}
if (i == 0 || i == 1) { /* width & height */
fe_TextFieldSetEditable(context, group[i+3], enabled);
fe_SimpleRadioGroupSetSensitive(group[i+6], enabled);
} else if (i == 2) { /* color */
XtVaSetValues(group[i+3], XmNsensitive, enabled, 0);
}
#endif
void
XFE_EditTableDialog::cell_selection_cb(Widget w, XtPointer clientData,
XtPointer)
{
XFE_EditTableDialog* edt = (XFE_EditTableDialog*)clientData;
edt->changeSelection(strncmp(XtName(w), "next", 4) == 0);
}
void
@ -528,63 +528,59 @@ XFE_EditTableDialog::cellPropertiesCreate(Widget parent)
other_frame = XmCreateFrame(form, "_frame", args, n);
XtManageChild(other_frame);
#ifdef DEBUG_akkana
n = 0;
XtSetArg(args[n], XmNchildType, XmFRAME_TITLE_CHILD); n++;
w = XmCreateLabelGadget(other_frame, "changeSelection", args, n);
XtManageChild(w);
n = 0;
XtSetArg(args[n], XmNfractionBase, 3); n++;
XtSetArg(args[n], XmNfractionBase, 4); n++;
prevnext_form = XmCreateForm(other_frame, "_form", args, n);
XtManageChild(prevnext_form);
n = 0;
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
w = XmCreatePushButtonGadget(prevnext_form, "previous", args, n);
Widget pulldownParent, option_menu;
option_menu = fe_make_option_menu(FE_GetToplevelWidget(),
prevnext_form, "searchTypeOpt",
&pulldownParent);
XtVaSetValues(option_menu,
XmNtopAttachment, XmATTACH_FORM,
XmNleftAttachment, XmATTACH_FORM,
XmNbottomAttachment, XmATTACH_FORM,
0);
w = XmCreatePushButtonGadget(pulldownParent, "cellSelect", NULL, 0);
XtManageChild(w);
w = XmCreatePushButtonGadget(pulldownParent, "rowSelect", NULL, 0);
XtManageChild(w);
w = XmCreatePushButtonGadget(pulldownParent, "columnSelect", NULL, 0);
XtManageChild(w);
XtManageChild(option_menu);
// Set the menu appropriately:
//XtVaSetValues(m_opt_valueField, XmNsubMenuId, popup, 0);
n = 0;
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
XtSetArg(args[n], XmNleftPosition, 1); n++;
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
w = XmCreatePushButtonGadget(prevnext_form, "previous", args, n);
XtManageChild(w);
XtAddCallback(w, XmNactivateCallback,
cell_selection_cb, (XtPointer)this);
n = 0;
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
XtSetArg(args[n], XmNleftWidget, w); n++;
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
w = XmCreatePushButtonGadget(prevnext_form, "next", args, n);
XtManageChild(w);
Widget pulldownParent, optionMenu;
optionMenu = fe_make_option_menu(FE_GetToplevelWidget(),
prevnext_form, "searchTypeOpt",
&pulldownParent);
XtVaSetValues(optionMenu,
XmNtopAttachment, XmATTACH_FORM,
XmNleftAttachment, XmATTACH_POSITION,
XmNleftPosition, 2,
XmNrightAttachment, XmATTACH_FORM,
XmNbottomAttachment, XmATTACH_FORM,
0);
w = XmCreatePushButtonGadget(pulldownParent, "selectCell", NULL, 0);
XtManageChild(w);
w = XmCreatePushButtonGadget(pulldownParent, "selectRow", NULL, 0);
XtManageChild(w);
w = XmCreatePushButtonGadget(pulldownParent, "selectColumn", NULL, 0);
XtManageChild(w);
//XtAddCallback(w, XmNactivateCallback, selectOptionCB, this);
XtManageChild(optionMenu);
// Set the menu appropriately:
//XtVaSetValues(m_opt_valueField, XmNsubMenuId, popup, 0);
#endif /* DEBUG_akkana */
XtAddCallback(w, XmNactivateCallback,
cell_selection_cb, (XtPointer)this);
n = 0;
#ifdef DEBUG_akkana
XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
XtSetArg(args[n], XmNtopWidget, other_frame); n++;
#else /* DEBUG_akkana */
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
#endif /* DEBUG_akkana */
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
rows_label = XmCreateLabelGadget(form, "cellRowsLabel", args, n);
XtManageChild(rows_label);
@ -720,9 +716,9 @@ XFE_EditTableDialog::cellPropertiesCreate(Widget parent)
XtManageChild(height_toggle);
XtAddCallback(width_toggle, XmNvalueChangedCallback,
cell_toggle_cb, (XtPointer)m_cell);
cell_toggle_cb, (XtPointer)this);
XtAddCallback(height_toggle, XmNvalueChangedCallback,
cell_toggle_cb, (XtPointer)m_cell);
cell_toggle_cb, (XtPointer)this);
/*
* Background..
@ -735,19 +731,20 @@ XFE_EditTableDialog::cellPropertiesCreate(Widget parent)
bg_group = fe_create_background_group(form, "background", args, n);
XtManageChild(bg_group);
m_cell->number_rows_text = rows_text;
m_cell->number_columns_text = columns_text;
m_cell->horizontal_alignment = horizontal_alignment;
m_cell->vertical_alignment = vertical_alignment;
m_cell->header_style = header_style;
m_cell->wrap_text = wrap_text;
m_cell->width_toggle = width_toggle;
m_cell->width_text = width_text;
m_cell->width_units = width_units;
m_cell->height_toggle = height_toggle;
m_cell->height_text = height_text;
m_cell->height_units = height_units;
m_cell->bg_group = bg_group;
m_cell.number_rows_text = rows_text;
m_cell.number_columns_text = columns_text;
m_cell.horizontal_alignment = horizontal_alignment;
m_cell.vertical_alignment = vertical_alignment;
m_cell.header_style = header_style;
m_cell.wrap_text = wrap_text;
m_cell.width_toggle = width_toggle;
m_cell.width_text = width_text;
m_cell.width_units = width_units;
m_cell.height_toggle = height_toggle;
m_cell.height_text = height_text;
m_cell.height_units = height_units;
m_cell.bg_group = bg_group;
m_cell.option_menu = option_menu;
return form;
}
@ -755,73 +752,6 @@ XFE_EditTableDialog::cellPropertiesCreate(Widget parent)
void
XFE_EditTableDialog::cellPropertiesInit()
{
#if 0
Boolean is_nested = EDT_IsInsertPointInNestedTable(context);
EDT_TableCellData cell_data;
Boolean enabled = TRUE;
Widget widget;
memset(&cell_data, 0, sizeof(EDT_TableCellData));
if (!fe_EditorTableCellGetData(context, &cell_data)) {
memset(&cell_data, 0, sizeof(EDT_TableCellData));
cell_data.iColSpan = 1;
cell_data.iRowSpan = 1;
cell_data.align = ED_ALIGN_DEFAULT;
cell_data.valign = ED_ALIGN_DEFAULT;
cell_data.pColorBackground = NULL;
enabled = FALSE;
}
fe_set_numeric_text_field(m_cell->number_rows_text,
cell_data.iRowSpan);
fe_TextFieldSetEditable(context, m_cell->number_rows_text, enabled);
fe_set_numeric_text_field(m_cell->number_columns_text,
cell_data.iColSpan);
fe_TextFieldSetEditable(context, m_cell->number_columns_text, enabled);
fe_SimpleRadioGroupSetWhich(m_cell->horizontal_alignment,
fe_ED_Alignment_to_index(cell_data.align));
fe_SimpleRadioGroupSetSensitive(m_cell->horizontal_alignment, enabled);
fe_SimpleRadioGroupSetWhich(m_cell->vertical_alignment,
fe_ED_Alignment_to_index(cell_data.valign));
fe_SimpleRadioGroupSetSensitive(m_cell->vertical_alignment, enabled);
XmToggleButtonGadgetSetState(m_cell->header_style, cell_data.bHeader,
FALSE);
XtVaSetValues(m_cell->header_style, XmNsensitive, enabled, 0);
XmToggleButtonGadgetSetState(m_cell->wrap_text, cell_data.bNoWrap, FALSE);
XtVaSetValues(m_cell->wrap_text, XmNsensitive, enabled, 0);
fe_table_tbr_set(context, m_cell->width_toggle,
m_cell->width_text, m_cell->width_units,
cell_data.bWidthDefined,
cell_data.iWidth,
(cell_data.bWidthPercent));
XtVaSetValues(m_cell->width_toggle, XmNsensitive, enabled, 0);
widget = fe_SimpleRadioGroupGetChild(m_cell->width_units, 1);
fe_table_percent_label_set(widget, is_nested);
fe_table_tbr_set(context, m_cell->height_toggle,
m_cell->height_text, m_cell->height_units,
cell_data.bHeightDefined,
cell_data.iHeight,
(cell_data.bHeightPercent));
XtVaSetValues(m_cell->height_toggle, XmNsensitive, enabled, 0);
widget = fe_SimpleRadioGroupGetChild(m_cell->height_units, 1);
fe_table_percent_label_set(widget, is_nested);
/*
* Background stuff
*/
fe_bg_group_set(m_cell->bg_group,
cell_data.pColorBackground,
cell_data.pBackgroundImage,
cell_data.bBackgroundNoSave);
#else
Boolean is_nested = EDT_IsInsertPointInNestedTable(m_context);
EDT_TableCellData* cell_data = EDT_GetTableCellData(m_context);
Boolean enabled = TRUE;
@ -832,57 +762,56 @@ XFE_EditTableDialog::cellPropertiesInit()
enabled = FALSE;
}
fe_set_numeric_text_field(m_cell->number_rows_text,
fe_set_numeric_text_field(m_cell.number_rows_text,
cell_data->iRowSpan);
fe_TextFieldSetEditable(m_context, m_cell->number_rows_text, enabled);
fe_set_numeric_text_field(m_cell->number_columns_text,
fe_TextFieldSetEditable(m_context, m_cell.number_rows_text, enabled);
fe_set_numeric_text_field(m_cell.number_columns_text,
cell_data->iColSpan);
fe_TextFieldSetEditable(m_context, m_cell->number_columns_text, enabled);
fe_TextFieldSetEditable(m_context, m_cell.number_columns_text, enabled);
fe_SimpleRadioGroupSetWhich(m_cell->horizontal_alignment,
fe_SimpleRadioGroupSetWhich(m_cell.horizontal_alignment,
fe_ED_Alignment_to_index(cell_data->align));
fe_SimpleRadioGroupSetSensitive(m_cell->horizontal_alignment, enabled);
fe_SimpleRadioGroupSetSensitive(m_cell.horizontal_alignment, enabled);
fe_SimpleRadioGroupSetWhich(m_cell->vertical_alignment,
fe_SimpleRadioGroupSetWhich(m_cell.vertical_alignment,
fe_ED_Alignment_to_index(cell_data->valign));
fe_SimpleRadioGroupSetSensitive(m_cell->vertical_alignment, enabled);
fe_SimpleRadioGroupSetSensitive(m_cell.vertical_alignment, enabled);
XmToggleButtonGadgetSetState(m_cell->header_style, cell_data->bHeader,
XmToggleButtonGadgetSetState(m_cell.header_style, cell_data->bHeader,
FALSE);
XtVaSetValues(m_cell->header_style, XmNsensitive, enabled, 0);
XmToggleButtonGadgetSetState(m_cell->wrap_text, cell_data->bNoWrap, FALSE);
XtVaSetValues(m_cell->wrap_text, XmNsensitive, enabled, 0);
XtVaSetValues(m_cell.header_style, XmNsensitive, enabled, 0);
XmToggleButtonGadgetSetState(m_cell.wrap_text, cell_data->bNoWrap, FALSE);
XtVaSetValues(m_cell.wrap_text, XmNsensitive, enabled, 0);
fe_table_tbr_set(m_context, m_cell->width_toggle,
m_cell->width_text, m_cell->width_units,
fe_table_tbr_set(m_context, m_cell.width_toggle,
m_cell.width_text, m_cell.width_units,
cell_data->bWidthDefined,
cell_data->iWidth,
(cell_data->bWidthPercent));
XtVaSetValues(m_cell->width_toggle, XmNsensitive, enabled, 0);
XtVaSetValues(m_cell.width_toggle, XmNsensitive, enabled, 0);
widget = fe_SimpleRadioGroupGetChild(m_cell->width_units, 1);
widget = fe_SimpleRadioGroupGetChild(m_cell.width_units, 1);
fe_table_percent_label_set(widget, is_nested);
fe_table_tbr_set(m_context, m_cell->height_toggle,
m_cell->height_text, m_cell->height_units,
fe_table_tbr_set(m_context, m_cell.height_toggle,
m_cell.height_text, m_cell.height_units,
cell_data->bHeightDefined,
cell_data->iHeight,
(cell_data->bHeightPercent));
XtVaSetValues(m_cell->height_toggle, XmNsensitive, enabled, 0);
XtVaSetValues(m_cell.height_toggle, XmNsensitive, enabled, 0);
widget = fe_SimpleRadioGroupGetChild(m_cell->height_units, 1);
widget = fe_SimpleRadioGroupGetChild(m_cell.height_units, 1);
fe_table_percent_label_set(widget, is_nested);
/*
* Background stuff
*/
fe_bg_group_set(m_cell->bg_group,
fe_bg_group_set(m_cell.bg_group,
cell_data->pColorBackground,
cell_data->pBackgroundImage,
cell_data->bBackgroundNoSave);
EDT_FreeTableCellData(cell_data);
#endif
}
void
@ -891,30 +820,30 @@ XFE_EditTableDialog::cellPropertiesSetValidateCommon(EDT_TableCellData* cell_dat
unsigned index;
cell_data->iRowSpan =
fe_get_numeric_text_field(m_cell->number_rows_text);
fe_get_numeric_text_field(m_cell.number_rows_text);
cell_data->iColSpan =
fe_get_numeric_text_field(m_cell->number_columns_text);
fe_get_numeric_text_field(m_cell.number_columns_text);
index = fe_SimpleRadioGroupGetWhich(m_cell->horizontal_alignment);
index = fe_SimpleRadioGroupGetWhich(m_cell.horizontal_alignment);
cell_data->align = fe_index_to_ED_Alignment(index, TRUE);
index = fe_SimpleRadioGroupGetWhich(m_cell->vertical_alignment);
index = fe_SimpleRadioGroupGetWhich(m_cell.vertical_alignment);
cell_data->valign = fe_index_to_ED_Alignment(index, FALSE);
cell_data->bHeader = XmToggleButtonGadgetGetState(m_cell->header_style);
cell_data->bNoWrap = XmToggleButtonGadgetGetState(m_cell->wrap_text);
cell_data->bHeader = XmToggleButtonGadgetGetState(m_cell.header_style);
cell_data->bNoWrap = XmToggleButtonGadgetGetState(m_cell.wrap_text);
cell_data->bWidthDefined = XmToggleButtonGetState(m_cell->width_toggle);
cell_data->iWidth = fe_get_numeric_text_field(m_cell->width_text);
cell_data->bWidthDefined = XmToggleButtonGetState(m_cell.width_toggle);
cell_data->iWidth = fe_get_numeric_text_field(m_cell.width_text);
cell_data->bWidthPercent =
(fe_SimpleRadioGroupGetWhich(m_cell->width_units) == 1);
(fe_SimpleRadioGroupGetWhich(m_cell.width_units) == 1);
cell_data->bHeightDefined =
XmToggleButtonGetState(m_cell->height_toggle);
XmToggleButtonGetState(m_cell.height_toggle);
cell_data->iHeight =
fe_get_numeric_text_field(m_cell->height_text);
fe_get_numeric_text_field(m_cell.height_text);
cell_data->bHeightPercent =
(fe_SimpleRadioGroupGetWhich(m_cell->height_units) == 1);
(fe_SimpleRadioGroupGetWhich(m_cell.height_units) == 1);
}
@ -960,7 +889,7 @@ XFE_EditTableDialog::cellPropertiesValidate()
}
if (nerrors > 0) {
fe_editor_range_error_dialog(m_context, m_cell->number_rows_text,
fe_editor_range_error_dialog(m_context, m_cell.number_rows_text,
errors, nerrors);
return FALSE;
}
@ -980,7 +909,7 @@ XFE_EditTableDialog::cellPropertiesSet()
/*
* Background stuff
*/
fe_bg_group_get(m_cell->bg_group,
fe_bg_group_get(m_cell.bg_group,
&cell_data.pColorBackground,
&cell_data.pBackgroundImage,
&cell_data.bBackgroundNoSave);
@ -1019,9 +948,6 @@ XFE_EditTableDialog::tablePropertiesCreate(Widget parent)
Widget caption_type;
Widget alignframe;
Widget alignBox;
#ifdef EQUAL_COLUMN_TOGGLE
Widget equal_column_toggle;
#endif /* EQUAL_COLUMN_TOGGLE */
Widget bg_group;
Widget w;
Arg args[16];
@ -1308,9 +1234,6 @@ XFE_EditTableDialog::tablePropertiesCreate(Widget parent)
m_table->caption_toggle = caption_toggle;
m_table->caption_type = caption_type;
m_table->alignBox = alignBox;
#ifdef EQUAL_COLUMN_TOGGLE
m_table->equal_column_toggle = equal_column_toggle;
#endif /* EQUAL_COLUMN_TOGGLE */
m_table->bg_group = bg_group;
}
@ -1385,12 +1308,6 @@ XFE_EditTableDialog::tablePropertiesInit()
0,
(table_data.cd.align != ED_ALIGN_ABSTOP));
#ifdef EQUAL_COLUMN_TOGGLE
XmToggleButtonGadgetSetState(m_table->equal_column_toggle,
table_data.td.bUseCols,
FALSE);
#endif /* EQUAL_COLUMN_TOGGLE */
/* we don't have default for alignment yet, so we need to subtract one
* from index
*/
@ -1461,10 +1378,6 @@ XFE_EditTableDialog::tablePropertiesCommonSet(EDT_AllTableData* table_data)
*/
table_data->has_caption = XmToggleButtonGetState(m_table->caption_toggle);
#ifdef EQUAL_COLUMN_TOGGLE
table_data->td.bUseCols =
XmToggleButtonGetState(m_table->equal_column_toggle);
#endif /* EQUAL_COLUMN_TOGGLE */
if (fe_SimpleRadioGroupGetWhich(m_table->caption_type) == 1)
table_data->cd.align = ED_ALIGN_ABSBOTTOM;

Просмотреть файл

@ -33,6 +33,10 @@
class XFE_Frame;
class EDT_AllTableData;
//
// I don't think we really need to save all these variables.
// 2DO: clean out the ones we don't need to save.
//
typedef struct fe_EditorTablesTableStruct
{
Widget number_rows_text;
@ -52,9 +56,6 @@ typedef struct fe_EditorTablesTableStruct
LO_Color color_value;
Widget caption_toggle;
Widget caption_type;
#ifdef EQUAL_COLUMN_TOGGLE
Widget equal_column_toggle;
#endif /* EQUAL_COLUMN_TOGGLE */
Widget alignBox;
Boolean inserting;
} fe_EditorTablesTableStruct;
@ -84,6 +85,7 @@ typedef struct fe_EditorTablesCellStruct
Widget height_units;
Widget bg_group;
LO_Color color_value;
Widget option_menu;
} fe_EditorTablesCellStruct;
class XFE_EditTableDialog: public XFE_Dialog
@ -102,10 +104,11 @@ private:
XP_Bool m_doneWithLoop;
fe_EditorTablesTableStruct* m_table;
fe_EditorTablesCellStruct* m_cell;
fe_EditorTablesCellStruct m_cell;
void ok();
void cancel();
void changeSelection(Boolean);
Widget tablePropertiesCreate(Widget parent);
void tablePropertiesInit();
@ -113,7 +116,6 @@ private:
void cellPropertiesInit();
void cellPropertiesSet();
Boolean cellPropertiesValidate();
void tablePropertiesCommonSet(EDT_AllTableData* table_data);
Boolean tablePropertiesValidate();
void tablePropertiesSet();
@ -124,6 +126,7 @@ private:
static void cancel_cb(Widget, XtPointer, XtPointer);
static void table_toggle_cb(Widget, XtPointer, XtPointer);
static void cell_toggle_cb(Widget, XtPointer, XtPointer);
static void cell_selection_cb(Widget, XtPointer, XtPointer);
};
#endif /* _xfe_EditTableDialog_h */

Просмотреть файл

@ -168,7 +168,7 @@ MenuSpec XFE_EditorFrame::view_menu_spec[] = {
{ NULL }
};
static MenuSpec insert_table_menu_spec[] = {
MenuSpec XFE_EditorFrame::insert_table_menu_spec[] = {
{ xfeCmdInsertTable, PUSHBUTTON },
{ xfeCmdInsertTableRow, PUSHBUTTON },
{ xfeCmdInsertTableColumn, PUSHBUTTON },
@ -282,7 +282,12 @@ MenuSpec XFE_EditorFrame::format_menu_spec[] = {
{ NULL }
};
MenuSpec XFE_EditorFrame::table_insert_delete_submenu_spec[] = {
MenuSpec XFE_EditorFrame::table_select_submenu_spec[] = {
{ xfeCmdSelectTable, PUSHBUTTON },
{ xfeCmdSelectTableRow, PUSHBUTTON },
{ xfeCmdSelectTableColumn, PUSHBUTTON },
{ xfeCmdSelectTableCell, PUSHBUTTON },
{ xfeCmdSelectTableAllCells, PUSHBUTTON },
{ NULL }
};
@ -291,14 +296,15 @@ MenuSpec XFE_EditorFrame::table_menu_spec[] = {
(MenuSpec*)&XFE_EditorFrame::alignment_style_menu_spec },
MENU_SEPARATOR,
{ "tableInsertMenu", CASCADEBUTTON,
(MenuSpec*)&XFE_EditorFrame::table_insert_delete_submenu_spec },
(MenuSpec*)&XFE_EditorFrame::insert_table_menu_spec },
{ "tableDeleteMenu", CASCADEBUTTON,
(MenuSpec*)&XFE_EditorFrame::table_insert_delete_submenu_spec },
(MenuSpec*)&XFE_EditorFrame::delete_table_menu_spec },
{ "tableSelectMenu", CASCADEBUTTON,
(MenuSpec*)&XFE_EditorFrame::table_insert_delete_submenu_spec },
(MenuSpec*)&XFE_EditorFrame::table_select_submenu_spec },
MENU_SEPARATOR,
// { "join", PUSHBUTTON },
// { "convertTextToTable", PUSHBUTTON },
{ xfeCmdTableJoin, PUSHBUTTON },
{ xfeCmdConvertTextToTable, PUSHBUTTON },
{ xfeCmdConvertTableToText, PUSHBUTTON },
MENU_SEPARATOR,
{ xfeCmdSetTableProperties, PUSHBUTTON },
{ NULL }

Просмотреть файл

@ -72,7 +72,8 @@ public:
// Table menu & submenus
static MenuSpec table_menu_spec[];
static MenuSpec table_insert_delete_submenu_spec[];
static MenuSpec table_select_submenu_spec[];
static MenuSpec insert_table_menu_spec[];
static MenuSpec tools_menu_spec[];

Просмотреть файл

@ -36,6 +36,8 @@
#include "pk11func.h"
#endif
extern "C" int XFE_EDITOR_NEWTABLE_COLS;
#define FE_SYNTAX_ERROR() doSyntaxErrorAlert(view, info)
//
@ -618,6 +620,131 @@ public:
};
};
class SelectTableCommand : public XFE_EditorViewCommand
{
public:
SelectTableCommand() : XFE_EditorViewCommand(xfeCmdSelectTable) {};
XP_Bool isEnabled(XFE_View* view, XFE_CommandInfo*) {
return (EDT_IsInsertPointInTable(view->getContext()) != 0);
};
void reallyDoCommand(XFE_View* view, XFE_CommandInfo*) {
EDT_ChangeTableSelection(view->getContext(), ED_HIT_SEL_TABLE,
ED_MOVE_NONE,
EDT_GetTableCellData(view->getContext()));
};
};
class SelectTableCellCommand : public XFE_EditorViewCommand
{
public:
SelectTableCellCommand() : XFE_EditorViewCommand(xfeCmdSelectTableCell) {};
XP_Bool isEnabled(XFE_View* view, XFE_CommandInfo*) {
return (EDT_IsInsertPointInTable(view->getContext()) != 0);
};
void reallyDoCommand(XFE_View* view, XFE_CommandInfo*) {
EDT_ChangeTableSelection(view->getContext(), ED_HIT_SEL_CELL,
ED_MOVE_NONE,
EDT_GetTableCellData(view->getContext()));
};
};
class SelectTableRowCommand : public XFE_EditorViewCommand
{
public:
SelectTableRowCommand() : XFE_EditorViewCommand(xfeCmdSelectTableRow) {};
XP_Bool isEnabled(XFE_View* view, XFE_CommandInfo*) {
return (EDT_IsInsertPointInTable(view->getContext()) != 0);
};
void reallyDoCommand(XFE_View* view, XFE_CommandInfo*) {
EDT_ChangeTableSelection(view->getContext(), ED_HIT_SEL_ROW,
ED_MOVE_NONE,
EDT_GetTableCellData(view->getContext()));
};
};
class SelectTableColumnCommand : public XFE_EditorViewCommand
{
public:
SelectTableColumnCommand()
: XFE_EditorViewCommand(xfeCmdSelectTableColumn) {};
XP_Bool isEnabled(XFE_View* view, XFE_CommandInfo*) {
return (EDT_IsInsertPointInTable(view->getContext()) != 0);
};
void reallyDoCommand(XFE_View* view, XFE_CommandInfo*) {
EDT_ChangeTableSelection(view->getContext(), ED_HIT_SEL_COL,
ED_MOVE_NONE,
EDT_GetTableCellData(view->getContext()));
};
};
class SelectTableAllCellsCommand : public XFE_EditorViewCommand
{
public:
SelectTableAllCellsCommand()
: XFE_EditorViewCommand(xfeCmdSelectTableAllCells) {};
XP_Bool isEnabled(XFE_View* view, XFE_CommandInfo*) {
return (EDT_IsInsertPointInTable(view->getContext()) != 0);
};
void reallyDoCommand(XFE_View* view, XFE_CommandInfo*) {
EDT_ChangeTableSelection(view->getContext(), ED_HIT_SEL_ALL_CELLS,
ED_MOVE_NONE,
EDT_GetTableCellData(view->getContext()));
};
};
class TableJoinCommand : public XFE_EditorViewCommand
{
public:
TableJoinCommand()
: XFE_EditorViewCommand(xfeCmdTableJoin) {};
XP_Bool isEnabled(XFE_View* view, XFE_CommandInfo*) {
return (EDT_GetMergeTableCellsType(view->getContext()) != 0);
};
void reallyDoCommand(XFE_View* view, XFE_CommandInfo*) {
EDT_MergeTableCells(view->getContext());
};
};
class ConvertTextToTableCommand : public XFE_EditorViewCommand
{
public:
ConvertTextToTableCommand()
: XFE_EditorViewCommand(xfeCmdConvertTextToTable) {};
XP_Bool isEnabled(XFE_View* view, XFE_CommandInfo*) {
return EDT_CanConvertTextToTable(view->getContext());
};
void reallyDoCommand(XFE_View* view, XFE_CommandInfo*) {
char* cols_str = XFE_Prompt(view->getContext(),
XP_GetString(XFE_EDITOR_NEWTABLE_COLS),
"1");
int cols = atoi(cols_str);
if (cols <= 0)
return;
EDT_ConvertTextToTable(view->getContext(), cols);
};
};
class ConvertTableToTextCommand : public XFE_EditorViewCommand
{
public:
ConvertTableToTextCommand()
: XFE_EditorViewCommand(xfeCmdConvertTableToText) {};
XP_Bool isEnabled(XFE_View* view, XFE_CommandInfo*) {
return (EDT_IsInsertPointInTable(view->getContext()) != 0);
};
void reallyDoCommand(XFE_View* view, XFE_CommandInfo*) {
EDT_ConvertTableToText(view->getContext());
};
};
class InsertHtmlCommand : public AlwaysEnabledCommand
{
public:
@ -2768,6 +2895,13 @@ XFE_EditorView::XFE_EditorView(XFE_Component *toplevel_component,
registerCommand(my_commands, new DeleteTableCellCommand);
registerCommand(my_commands, new DeleteTableRowCommand);
registerCommand(my_commands, new DeleteTableColumnCommand);
registerCommand(my_commands, new SelectTableCommand);
registerCommand(my_commands, new SelectTableCellCommand);
registerCommand(my_commands, new SelectTableRowCommand);
registerCommand(my_commands, new SelectTableColumnCommand);
registerCommand(my_commands, new TableJoinCommand);
registerCommand(my_commands, new ConvertTextToTableCommand);
registerCommand(my_commands, new ConvertTableToTextCommand);
registerCommand(my_commands, new RemoveLinkCommand);
registerCommand(my_commands, new SelectAllCommand);
registerCommand(my_commands, new FindCommand);

Просмотреть файл

@ -431,6 +431,13 @@ xfeCmdSetDefaultColor setDefaultCol
xfeCmdSetTableProperties setTableProperties
xfeCmdIndent indent
xfeCmdOutdent outdent
xfeCmdSelectTableRow selectRow
xfeCmdSelectTableColumn selectColumn
xfeCmdSelectTableCell selectCell
xfeCmdSelectTableAllCells selectAllCells
xfeCmdTableJoin tableJoin
xfeCmdConvertTextToTable convertTextToTable
xfeCmdConvertTableToText convertTableToText
xfeCmdSetTextProperties setTextProperties
xfeCmdSetPageTitle setPageTitle
xfeCmdSetDefaultTextProperties setDefaultTextProperties

Просмотреть файл

@ -1568,6 +1568,9 @@ ResDef(XFE_SUBUPGRADE_AUTOSUBSCRIBE, XFE_ERR_OFFSET+635, "Automatically subscrib
ResDef(XFE_MOVEMAIL_TAB, XFE_ERR_OFFSET + 636, "MoveMail")
ResDef(XFE_EDITOR_NEWTABLE_COLS, XFE_ERR_OFFSET + 637,
"Number of columns in new table?")
END_STR(mcom_cmd_xfe_xfe_err_h_strings)
#endif /* __XFE_XFE_ERR_H_ */