- 积分
- 10
- 注册时间
- 2007-10-5
- 仿真币
-
- 最后登录
- 1970-1-1
|
#include <stdio.h>
#include <string.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_drf.h>
#include <uf_object_types.h>
#include <uf_tabnot.h>
#include <uf_obj.h>
#include <uf_plist.h>
#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))
static int report_error( char *file, int line, char *call, int irc)
{
if (irc)
{
char err[133],
msg[133];
sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ",
irc, line, file);
UF_get_fail_message(irc, err);
/* NOTE: UF_print_syslog is new in V18 */
UF_print_syslog(msg, FALSE);
UF_print_syslog(err, FALSE);
UF_print_syslog("\n", FALSE);
UF_print_syslog(call, FALSE);
UF_print_syslog(";\n", FALSE);
if (!UF_UI_open_listing_window())
{
UF_UI_write_listing_window(msg);
UF_UI_write_listing_window(err);
UF_UI_write_listing_window("\n");
UF_UI_write_listing_window(call);
UF_UI_write_listing_window(";\n");
}
}
return(irc);
}
/*ARGSUSED*/
static int mask_for_tabular_notes(UF_UI_selection_p_t select, void *type)
{
UF_UI_mask_t
mask = { UF_tabular_note_type, UF_tabular_note_section_subtype, 0 };
if (!UF_CALL(UF_UI_set_sel_mask(select,
UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC, 1, &mask)))
return (UF_UI_SEL_SUCCESS);
else
return (UF_UI_SEL_FAILURE);
}
static tag_t select_a_tabular_note(char *prompt)
{
int
resp;
double
cp[3];
tag_t
object,
view;
UF_CALL(UF_UI_select_with_single_dialog(prompt, "",
UF_UI_SEL_SCOPE_WORK_PART, mask_for_tabular_notes, NULL, &resp,
&object, cp, &view));
if (resp == UF_UI_OBJECT_SELECTED || resp == UF_UI_OBJECT_SELECTED_BY_NAME)
{
UF_CALL(UF_DISP_set_highlight(object, 0));
return object;
}
else return NULL_TAG;
}
static void do_it(void)
{
int
cfw[3],
ii, jj,
n_cols,
n_headers,
n_rows;
tag_t
cell,
col,
row,
section,
tabular_note;
UF_TABNOT_cell_prefs_t
cell_prefs;
UF_CALL(UF_TABNOT_enable_automatic_update(FALSE));
while ((section = select_a_tabular_note("Add/Edit Column")) != NULL_TAG)
{
UF_CALL(UF_TABNOT_ask_tabular_note_of_section(section, &tabular_note));
UF_CALL(UF_TABNOT_ask_nm_columns(tabular_note, &n_cols));
UF_CALL(UF_TABNOT_ask_nm_header_rows(tabular_note, &n_headers));
UF_CALL(UF_TABNOT_ask_nm_rows(tabular_note, &n_rows));
for (ii = 0; ii < n_headers; ii++)
{
UF_CALL(UF_TABNOT_ask_nth_header_row(tabular_note, ii, &row));
UF_CALL(UF_TABNOT_ask_row_head_cfw(row, cfw));
cfw[1] = UF_OBJ_FONT_INVISIBLE;
UF_CALL(UF_TABNOT_set_row_head_cfw(row, cfw));
}
for (ii = 0; ii < n_rows; ii++)
{
UF_CALL(UF_TABNOT_ask_nth_row(tabular_note, ii, &row));
UF_CALL(UF_TABNOT_ask_row_head_cfw(row, cfw));
cfw[1] = UF_OBJ_FONT_INVISIBLE;
UF_CALL(UF_TABNOT_set_row_head_cfw(row, cfw));
}
for (jj = 0; jj < n_cols; jj++)
{
UF_CALL(UF_TABNOT_ask_nth_column(tabular_note, jj, &col));
UF_CALL(UF_TABNOT_ask_column_head_cfw(col, section, cfw));
cfw[1] = UF_OBJ_FONT_INVISIBLE;
UF_CALL(UF_TABNOT_set_column_head_cfw(col, section, cfw));
for (ii = 0; ii < n_headers; ii++)
{
UF_CALL(UF_TABNOT_ask_nth_header_row(tabular_note, ii, &row));
UF_CALL(UF_TABNOT_ask_cell_at_row_col(row, col, &cell));
UF_CALL(UF_TABNOT_ask_cell_prefs(cell, &cell_prefs));
cell_prefs.bottom_line_cfw[1] = UF_OBJ_FONT_INVISIBLE;
cell_prefs.right_line_cfw[1] = UF_OBJ_FONT_INVISIBLE;
UF_CALL(UF_TABNOT_set_cell_prefs(cell, &cell_prefs));
}
for (ii = 0; ii < n_rows; ii++)
{
UF_CALL(UF_TABNOT_ask_nth_row(tabular_note, ii, &row));
UF_CALL(UF_TABNOT_ask_cell_at_row_col(row, col, &cell));
UF_CALL(UF_TABNOT_ask_cell_prefs(cell, &cell_prefs));
cell_prefs.bottom_line_cfw[1] = UF_OBJ_FONT_INVISIBLE;
cell_prefs.right_line_cfw[1] = UF_OBJ_FONT_INVISIBLE;
UF_CALL(UF_TABNOT_set_cell_prefs(cell, &cell_prefs));
}
}
UF_CALL(UF_TABNOT_update(tabular_note));
}
UF_CALL(UF_TABNOT_enable_automatic_update(TRUE));
}
/*ARGSUSED*/
void ufusr(char *param, int *retcode, int paramLen)
{
if (UF_CALL(UF_initialize())) return;
do_it();
UF_terminate();
}
int ufusr_ask_unload(void)
{
return (UF_UNLOAD_IMMEDIATELY);
} |
评分
-
1
查看全部评分
-
|