Commit d8f93b97 authored by Jukka-Pekka Iivonen's avatar Jukka-Pekka Iivonen Committed by jpekka

moved set_bold and set_underlined into src/tools/dao.[ch].

2002-03-12  Jukka-Pekka Iivonen  <jiivonen@hutcs.cs.hut.fi>

	* src/tools/dao.[ch], src/tools/solver/reports.c : moved
	set_bold and set_underlined into src/tools/dao.[ch].
parent 0a7573a4
......@@ -2,14 +2,14 @@ Gnumeric 1.1.2
Andreas:
* Make Single-Factor ANOVA undoable.
* Port search dialog
* Port search dialog.
Jody:
* Fix XL import of external function names.
* plug item-bar leak.
Jukka:
* More solver improvements
* More solver improvements.
--------------------------------------------------------------------------
Gnumeric 1.1.0 and 1.1.1
......
2002-03-12 Jukka-Pekka Iivonen <jiivonen@hutcs.cs.hut.fi>
* dao.[ch] (dao_set_bold): New function. Moved from
src/tools/solver/reports.c.
(dao_set_underlined): Ditto.
2002-03-11 Andreas J. Guelzow <aguelzow@taliesin.ca>
* dao.[hc] : new files, code extracted from
......
......@@ -510,6 +510,64 @@ dao_autofit_columns (data_analysis_output_t *dao)
dao_autofit_these_columns (dao, 0, dao->cols - 1);
}
/**
* dao_set_bold:
* @dao:
* @col1:
* @row1:
* @col2:
* @row2:
*
* sets the given cell range to bold
*
*
**/
void
dao_set_bold (data_analysis_output_t *dao, int col1, int row1,
int col2, int row2)
{
MStyle *mstyle = mstyle_new ();
Range range;
range.start.col = col1;
range.start.row = row1;
range.end.col = col2;
range.end.row = row2;
mstyle_set_font_bold (mstyle, TRUE);
sheet_style_apply_range (dao->sheet, &range, mstyle);
}
/**
* dao_set_underlined:
* @dao:
* @col1:
* @row1:
* @col2:
* @row2:
*
* sets the given cell range to underlined
*
*
**/
void
dao_set_underlined (data_analysis_output_t *dao, int col1, int row1,
int col2, int row2)
{
MStyle *mstyle = mstyle_new ();
Range range;
range.start.col = col1;
range.start.row = row1;
range.end.col = col2;
range.end.row = row2;
mstyle_set_font_uline (mstyle, TRUE);
sheet_style_apply_range (dao->sheet, &range, mstyle);
}
/**
* dao_set_italic:
* @dao:
......
......@@ -57,22 +57,26 @@ data_analysis_output_t *dao_init (data_analysis_output_t *dao,
void dao_autofit_columns (data_analysis_output_t *dao);
void dao_autofit_these_columns (data_analysis_output_t *dao, int from_col, int to_col);
void dao_set_bold (data_analysis_output_t *dao, int col1, int row1,
int col2, int row2);
void dao_set_italic (data_analysis_output_t *dao, int col1, int row1,
int col2, int row2);
int col2, int row2);
void dao_set_underlined (data_analysis_output_t *dao, int col1, int row1,
int col2, int row2);
void dao_set_percent (data_analysis_output_t *dao, int col1, int row1,
int col2, int row2);
int col2, int row2);
void dao_set_cell (data_analysis_output_t *dao, int col, int row, char const *text);
void dao_set_cell_printf (data_analysis_output_t *dao,
int col, int row, char const *fmt, ...)
int col, int row, char const *fmt, ...)
G_GNUC_PRINTF (4, 5);
void dao_set_cell_value (data_analysis_output_t *dao, int col, int row, Value *v);
void dao_set_cell_float (data_analysis_output_t *dao,
int col, int row, gnum_float v);
int col, int row, gnum_float v);
void dao_set_cell_int (data_analysis_output_t *dao,
int col, int row, int v);
int col, int row, int v);
void dao_set_cell_na (data_analysis_output_t *dao,
int col, int row);
int col, int row);
void dao_set_cell_float_na (data_analysis_output_t *dao, int col, int row, gnum_float v,
gboolean is_valid);
void dao_set_cell_comment (data_analysis_output_t *dao, int col, int row,
......
2002-03-12 Jukka-Pekka Iivonen <jiivonen@hutcs.cs.hut.fi>
* reports.c : moved set_bold and set_underlined into
src/tools/dao.[ch].
2002-03-11 Andreas J. Guelzow <aguelzow@taliesin.ca>
* reports.c : changed names of utility functions now in
......
......@@ -59,6 +59,7 @@ Misc:
- ILP
* update the user documentation
* document the LP solving API
* fix XL import and export of the solver parameters
* lpkit: the column numbering should start from 0
* lpkit: remove/#if0 obsolete code
* lpkit: fix the name space bloat
......
......@@ -36,36 +36,6 @@
/* ------------------------------------------------------------------------- */
static void
set_bold (Sheet *sheet, int col1, int row1, int col2, int row2)
{
MStyle *mstyle = mstyle_new ();
Range range;
range.start.col = col1;
range.start.row = row1;
range.end.col = col2;
range.end.row = row2;
mstyle_set_font_bold (mstyle, TRUE);
sheet_style_apply_range (sheet, &range, mstyle);
}
static void
set_underlined (Sheet *sheet, int col1, int row1, int col2, int row2)
{
MStyle *mstyle = mstyle_new ();
Range range;
range.start.col = col1;
range.start.row = row1;
range.end.col = col2;
range.end.row = row2;
mstyle_set_font_uline (mstyle, TRUE);
sheet_style_apply_range (sheet, &range, mstyle);
}
static char *
find_name (Sheet *sheet, int col, int row)
{
......@@ -138,7 +108,7 @@ fill_header_titles (data_analysis_output_t *dao, gchar *title, Sheet *sheet)
dao_set_cell (dao, 0, 2, buf->str);
g_string_free (buf, FALSE);
set_bold (dao->sheet, 0, 0, 0, 2);
dao_set_bold (dao, 0, 0, 0, 2);
}
......@@ -172,7 +142,7 @@ solver_answer_report (WorkbookControl *wbc,
dao_set_cell (&dao, 2, 6, _("Name"));
dao_set_cell (&dao, 3, 6, _("Original Value"));
dao_set_cell (&dao, 4, 6, _("Final Value"));
set_bold (dao.sheet, 0, 6, 4, 6);
dao_set_bold (&dao, 0, 6, 4, 6);
/* Set `Cell' field (cell reference to the target cell). */
dao_set_cell (&dao, 1, 7, cell_name (res->param->target_cell));
......@@ -198,7 +168,7 @@ solver_answer_report (WorkbookControl *wbc,
dao_set_cell (&dao, 2, 11, _("Name"));
dao_set_cell (&dao, 3, 11, _("Original Value"));
dao_set_cell (&dao, 4, 11, _("Final Value"));
set_bold (dao.sheet, 0, 11, 4, 11);
dao_set_bold (&dao, 0, 11, 4, 11);
for (i = 0; i < vars; i++) {
/* Set `Cell' column */
......@@ -228,7 +198,7 @@ solver_answer_report (WorkbookControl *wbc,
dao_set_cell (&dao, 4, 15 + vars, _("Formula"));
dao_set_cell (&dao, 5, 15 + vars, _("Status"));
dao_set_cell (&dao, 6, 15 + vars, _("Slack"));
set_bold (dao.sheet, 0, 15 + vars, 6, 15 + vars);
dao_set_bold (&dao, 0, 15 + vars, 6, 15 + vars);
for (i = 0; i < res->param->n_constraints +
res->param->n_int_bool_constraints; i++) {
......@@ -329,7 +299,7 @@ solver_sensitivity_report (WorkbookControl *wbc,
dao_set_cell (&dao, 5, 7, _("Coefficient"));
dao_set_cell (&dao, 6, 7, _("Increase"));
dao_set_cell (&dao, 7, 7, _("Decrease"));
set_bold (dao.sheet, 0, 6, 7, 7);
dao_set_bold (&dao, 0, 6, 7, 7);
for (i = 0; i < vars; i++) {
/* Set `Cell' column */
......@@ -376,7 +346,7 @@ solver_sensitivity_report (WorkbookControl *wbc,
dao_set_cell (&dao, 5, 11 + vars, _("R.H. Side"));
dao_set_cell (&dao, 6, 11 + vars, _("Increase"));
dao_set_cell (&dao, 7, 11 + vars, _("Decrease"));
set_bold (dao.sheet, 0, 10 + vars, 7, 11 + vars);
dao_set_bold (&dao, 0, 10 + vars, 7, 11 + vars);
for (i = 0; i < res->param->n_constraints +
res->param->n_int_bool_constraints; i++) {
......@@ -460,8 +430,8 @@ solver_limits_report (WorkbookControl *wbc,
dao_set_cell (&dao, 1, 6, _("Cell"));
dao_set_cell (&dao, 2, 6, _("Name"));
dao_set_cell (&dao, 3, 6, _("Value"));
set_bold (dao.sheet, 2, 5, 2, 5);
set_bold (dao.sheet, 0, 6, 3, 6);
dao_set_bold (&dao, 2, 5, 2, 5);
dao_set_bold (&dao, 0, 6, 3, 6);
dao_set_cell (&dao, 2, 10, _("Adjustable"));
dao_set_cell (&dao, 1, 11, _("Cell"));
......@@ -478,8 +448,8 @@ solver_limits_report (WorkbookControl *wbc,
dao_set_cell (&dao, 8, 11, _("Limit"));
dao_set_cell (&dao, 9, 11, _("Result"));
set_bold (dao.sheet, 2, 10, 9, 10);
set_bold (dao.sheet, 0, 11, 9, 11);
dao_set_bold (&dao, 2, 10, 9, 10);
dao_set_bold (&dao, 0, 11, 9, 11);
/*
......@@ -627,8 +597,8 @@ solver_performance_report (WorkbookControl *wbc,
dao_set_cell (&dao, 4, 6, _("Int Constraints"));
dao_set_cell (&dao, 5, 6, _("Bool Constraints"));
dao_set_cell (&dao, 1, 7, _("Number of"));
set_bold (dao.sheet, 0, 6, 5, 6);
set_bold (dao.sheet, 1, 7, 1, 7);
dao_set_bold (&dao, 0, 6, 5, 6);
dao_set_bold (&dao, 1, 7, 1, 7);
/* Set the `Nbr of Variables'. */
dao_set_cell_value (&dao, 2, 7, value_new_float (res->param->n_variables));
......@@ -655,8 +625,8 @@ solver_performance_report (WorkbookControl *wbc,
dao_set_cell (&dao, 6, 11, _("Zeros (obj. fn)"));
dao_set_cell (&dao, 1, 12, _("Number of"));
dao_set_cell (&dao, 1, 13, _("Ratio"));
set_bold (dao.sheet, 0, 11, 6, 11);
set_bold (dao.sheet, 1, 12, 1, 13);
dao_set_bold (&dao, 0, 11, 6, 11);
dao_set_bold (&dao, 1, 12, 1, 13);
/* Set the `Nbr of Matrix Elements'. */
mat_size = res->param->n_variables * res->param->n_constraints;
......@@ -712,8 +682,8 @@ solver_performance_report (WorkbookControl *wbc,
dao_set_cell (&dao, 3, 17, _("System"));
dao_set_cell (&dao, 4, 17, _("Real"));
dao_set_cell (&dao, 1, 18, _("Time (sec.)"));
set_bold (dao.sheet, 0, 17, 4, 17);
set_bold (dao.sheet, 1, 18, 1, 18);
dao_set_bold (&dao, 0, 17, 4, 17);
dao_set_bold (&dao, 1, 18, 1, 18);
/* Set the `User Time'. */
dao_set_cell_value (&dao, 2, 18, value_new_float (res->time_user));
......@@ -733,8 +703,8 @@ solver_performance_report (WorkbookControl *wbc,
dao_set_cell (&dao, 3, 22, _("CPU MHz"));
dao_set_cell (&dao, 4, 22, _("OS"));
dao_set_cell (&dao, 1, 23, _("Name"));
set_bold (dao.sheet, 0, 22, 3, 22);
set_bold (dao.sheet, 1, 23, 1, 23);
dao_set_bold (&dao, 0, 22, 3, 22);
dao_set_bold (&dao, 1, 23, 1, 23);
if (get_cpu_info (model_name, cpu_mhz, 255)) {
/* Set the `CPU Model'. */
......@@ -875,13 +845,13 @@ solver_program_report (WorkbookControl *wbc,
switch (c->type) {
case SolverLE:
dao_set_cell (&dao, col*3 + 1, 10 + i, "<");
set_underlined (dao.sheet, col*3 + 1, 10 + i,
col*3 + 1, 10 + i);
dao_set_underlined (&dao, col*3 + 1, 10 + i,
col*3 + 1, 10 + i);
break;
case SolverGE:
dao_set_cell (&dao, col*3 + 1, 10 + i, ">");
set_underlined (dao.sheet, col*3 + 1, 10 + i,
col*3 + 1, 10 + i);
dao_set_underlined (&dao, col*3 + 1, 10 + i,
col*3 + 1, 10 + i);
break;
case SolverEQ:
dao_set_cell (&dao, col*3 + 1, 10 + i, "=");
......@@ -927,11 +897,11 @@ solver_program_report (WorkbookControl *wbc,
dao_set_cell (&dao, 0, 5, _("Equal to"));
break;
}
set_bold (dao.sheet, 0, 5, 0, 5);
dao_set_bold (&dao, 0, 5, 0, 5);
/* Print `Subject to' title. */
dao_set_cell (&dao, 0, 9, _("Subject to"));
set_bold (dao.sheet, 0, 9, 0, 9);
dao_set_bold (&dao, 0, 9, 0, 9);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment