Commit 63e8e7cd authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

if nothing is selected fall back on the list size req. This is not

2002-03-17  Jody Goldberg <jody@gnome.org>

	* gnumeric-combo-text.c (cb_scroll_size_request) : if nothing is
	  selected fall back on the list size req.  This is not correct,
	  but it will do for now.

2002-03-17  Jody Goldberg <jody@gnome.org>

	* dialog-cell-format.c (fmt_dialog_init_font_page) : fix underline
	  handling by converting to gnumeric-combo-text.  Thanks to Almer for
	  pointing me at this code.
	(cb_font_underline_changed) : change signal semantics to match
	  the new combo.
	* cell-format.glade : Use a custom type.
parent 9c33e237
......@@ -10,248 +10,15 @@
module GNOME {
module Gnumeric {
struct CellRange {
string cell_a;
string cell_b;
};
const short VALUE_STRING = 0;
const short VALUE_INTEGER = 1;
const short VALUE_FLOAT = 2;
const short VALUE_CELLRANGE = 3;
const short VALUE_ARRAY = 4;
const short VALUE_BOOLEAN = 5;
const short VALUE_ERROR = 6;
const short VALUE_EMPTY = 7;
union Value switch(short) {
case VALUE_BOOLEAN: boolean v_bool;
case VALUE_FLOAT: double v_float;
case VALUE_INTEGER: long v_int;
case VALUE_STRING: string str;
case VALUE_ERROR: string error;
case VALUE_ARRAY: string array;
case VALUE_CELLRANGE: CellRange cell_range;
};
union VecValue switch (short) {
case VALUE_FLOAT: double v_float;
case VALUE_STRING: string str;
};
typedef sequence<VecValue> VecValueVec;
exception PluginProblem { string mesg; };
interface Sheet {
exception OutOfRange {};
exception ParseError {};
exception InvalidCmd {};
void cursor_set (in long base_col, in long base_row,
in long start_col, in long start_row,
in long end_col, in long end_row)
raises (OutOfRange);
void cursor_move (in long col, in long row)
raises (OutOfRange);
void make_cell_visible (in long col, in long row)
raises (OutOfRange);
//
// Selection
//
boolean is_all_selected ();
void selection_append (in long col, in long row)
raises (OutOfRange);
void selection_append_range (in long start_col,
in long start_row,
in long end_col,
in long end_row)
raises (OutOfRange);
void selection_copy ();
void selection_cut ()
raises (InvalidCmd);
//
// Operations on the region
//
void clear_region (in long start_col, in long start_row,
in long end_col, in long end_row)
raises (OutOfRange, InvalidCmd);
void clear_region_content (in long start_col, in long start_row,
in long end_col, in long end_row)
raises (OutOfRange, InvalidCmd);
void clear_region_comments (in long start_col, in long start_row,
in long end_col, in long end_row)
raises (OutOfRange);
void clear_region_formats (in long start_col, in long start_row,
in long end_col, in long end_row)
raises (OutOfRange);
//
// Cell management
//
void cell_set_value (in long col, in long row,
in Gnumeric::Value value)
raises (OutOfRange, InvalidCmd);
Value cell_get_value (in long col, in long row)
raises (OutOfRange);
void cell_set_text (in long col, in long row, in string text)
raises (OutOfRange, InvalidCmd);
string cell_get_text (in long col, in long row)
raises (OutOfRange);
void cell_set_format (in long col, in long row, in string format)
raises (OutOfRange);
string cell_get_format (in long col, in long row)
raises (OutOfRange);
void cell_set_font (in long col, in long row, in string font, in double points)
raises (OutOfRange);
string cell_get_font (in long col, in long row)
raises (OutOfRange);
void cell_set_comment (in long col, in long row, in string comment)
raises (OutOfRange);
string cell_get_comment (in long col, in long row)
raises (OutOfRange);
void cell_set_foreground (in long col, in long row, in string color)
raises (OutOfRange);
string cell_get_foreground (in long col, in long row)
raises (OutOfRange);
void cell_set_background (in long col, in long row, in string color)
raises (OutOfRange);
string cell_get_background (in long col, in long row)
raises (OutOfRange);
void cell_set_pattern (in long col, in long row, in long pattern)
raises (OutOfRange);
long cell_get_pattern (in long col, in long row)
raises (OutOfRange);
const short HALIGN_GENERAL = 1;
const short HALIGN_LEFT = 2;
const short HALIGN_RIGHT = 4;
const short HALIGN_CENTER = 8;
const short HALIGN_FILL = 16;
const short HALIGN_JUSTIFY = 32;
const short HALIGN_CENTER_ACROSS_SELECTION = 64;
const short VALIGN_TOP = 1;
const short VALIGN_BOTTOM = 2;
const short VALIGN_CENTER = 4;
const short VALIGN_JUSTIFY = 8;
void cell_set_alignment (in long col, in long row,
in long halign, in long valign,
in long orientation, in boolean wrap_text)
raises (OutOfRange);
void cell_get_alignment (in long col, in long row,
out long halign, out long valign,
out long orientation, out boolean wrap_text)
raises (OutOfRange);
//
// Cell regions
//
typedef sequence<Value> ValueVector;
ValueVector range_get_values (in string range)
raises (OutOfRange);
void range_set_text (in string range, in string text)
raises (OutOfRange, InvalidCmd);
void range_set_format (in string range, in string format)
raises (OutOfRange);
void range_set_font (in string range, in string font, in short points)
raises (OutOfRange);
void range_set_foreground (in string range, in string color)
raises (OutOfRange);
void range_set_background (in string range, in string color)
raises (OutOfRange);
void range_set_pattern (in string range, in long pattern)
raises (OutOfRange);
void range_set_alignment (in string range,
in long halign, in long valign,
in long orientation, in boolean auto_return)
raises (OutOfRange);
//
// Sheet administrivia
//
void set_dirty (in boolean is_dirty);
//
// Sheet manipulation
//
void insert_col (in long col, in long count)
raises(InvalidCmd);
void delete_col (in long col, in long count)
raises(InvalidCmd);
void insert_row (in long row, in long count)
raises(InvalidCmd);
void delete_row (in long row, in long count)
raises(InvalidCmd);
void shift_rows (in long col,
in long start_row, in long end_row,
in long count);
void shift_cols (in long col,
in long start_row, in long end_row,
in long count);
//
// Information
//
long max_cols_used ();
long max_rows_used ();
double col_width (in long col);
double row_height (in long row);
attribute string name;
};
interface Workbook : Bonobo::Embeddable {
exception NameExists {};
Sheet sheet_new (in string name) raises (NameExists);
Sheet sheet_lookup (in string name);
void set_filename (in string name);
void save_to (in string filename);
Sheet sheet_current ();
Sheet sheet_nth (in long n);
long sheet_count ();
//
// Workbook administrivia
//
void set_dirty (in boolean is_dirty);
boolean sheet_rename (in string old_name, in string new_name);
//
// Recomputation
//
void recalc ();
void recalc_all ();
//
// Cell reference parsing
//
void parse (in string cellref,
out Gnumeric::Sheet sheet,
out long col, out long row);
interface Workbook {
attribute string name;
};
interface Grid : Bonobo::Embeddable {
Sheet get_sheet ();
void set_header_visibility (in boolean cols, in boolean rows);
void get_header_visibility (out boolean cols, out boolean rows);
interface Application {
Workbook new_workbook (void);
Workbook open_workbook (in string file);
};
};
};
......
2002-03-17 Jody Goldberg <jody@gnome.org>
* dialog-cell-format.c (fmt_dialog_init_font_page) : fix underline
handling by converting to gnumeric-combo-text. Thanks to Almer for
pointing me at this code.
(cb_font_underline_changed) : change signal semantics to match
the new combo.
* cell-format.glade : Use a custom type.
2002-03-17 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/dialogs/dialog-search-replace.c : ported to gnome2
......
......@@ -1351,92 +1351,17 @@
</child>
<child>
<widget class="GtkCombo" id="underline_combo">
<property name="value_in_list">yes</property>
<property name="case_sensitive">no</property>
<property name="width-request">100</property>
<property name="enable_arrow_keys">yes</property>
<property name="enable_arrows_always">no</property>
<property name="allow_empty">yes</property>
<property name="visible">yes</property>
<child internal-child="entry">
<widget class="GtkEntry" id="combo-entry2">
<property name="can_focus">yes</property>
<property name="editable">no</property>
<property name="text" translatable="yes">None</property>
<property name="max-length">0</property>
<property name="visibility">yes</property>
<property name="visible">yes</property>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="convertwidget10">
<property name="visible">yes</property>
<child>
<widget class="GtkListItem" id="convertwidget11">
<property name="visible">yes</property>
<child>
<widget class="GtkLabel" id="convertwidget12">
<property name="label" translatable="yes">None</property>
<property name="xalign">0.0</property>
<property name="visible">yes</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkListItem" id="convertwidget13">
<property name="visible">yes</property>
<child>
<widget class="GtkLabel" id="convertwidget14">
<property name="label" translatable="yes">Single</property>
<property name="xalign">0.0</property>
<property name="visible">yes</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkListItem" id="convertwidget15">
<property name="visible">yes</property>
<child>
<widget class="GtkLabel" id="convertwidget16">
<property name="label" translatable="yes">Double</property>
<property name="xalign">0.0</property>
<property name="visible">yes</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkListItem" id="convertwidget17">
<property name="visible">yes</property>
<child>
<widget class="GtkLabel" id="convertwidget18">
<property name="label" translatable="yes"></property>
<property name="xalign">0.0</property>
<property name="visible">yes</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<widget class="Custom" id="underline_combo">
<property name="visible">True</property>
<property name="creation_function">gnm_combo_text_glade_new</property>
<property name="int1">0</property>
<property name="int2">0</property>
<property name="last_modification_time">Sun, 17 Mar 2002 21:20:33 GMT</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">no</property>
<property name="fill">no</property>
<property name="fill">yes</property>
</packing>
</child>
</widget>
......
......@@ -17,6 +17,7 @@
#include <style-color.h>
#include <widgets/widget-font-selector.h>
#include <widgets/gnumeric-dashed-canvas-line.h>
#include <widgets/gnumeric-combo-text.h>
#include <gui-util.h>
#include <selection.h>
#include <str.h>
......@@ -1291,24 +1292,25 @@ cb_font_strike_toggle (GtkToggleButton *button, FormatState *state)
}
}
static void
cb_font_underline_changed (GtkEditable *w, FormatState *state)
static gboolean
cb_font_underline_changed (GtkWidget *ct, char *new_text, FormatState *state)
{
gchar const *tmp = gtk_entry_get_text (GTK_ENTRY (w));
StyleUnderlineType res = UNDERLINE_NONE;
if (!state->enable_edit)
return;
/* ignore the clear while assigning a new value */
if (!state->enable_edit || new_text == NULL || *new_text == '\0')
return FALSE;
/* There must be a better way than this */
if (!g_strcasecmp (tmp, _("Single")))
if (!g_strcasecmp (new_text, _("Single")))
res = UNDERLINE_SINGLE;
else if (!g_strcasecmp (tmp, _("Double")))
else if (!g_strcasecmp (new_text, _("Double")))
res = UNDERLINE_DOUBLE;
else if (g_strcasecmp (tmp, _("None")))
g_warning ("Invalid underline style, assuming NONE");
else if (g_strcasecmp (new_text, _("None")))
g_warning ("Invalid underline style '%s', assuming NONE", new_text);
font_selector_set_underline (state->font.selector, res);
return TRUE;
}
/* Manually insert the font selector, and setup signals */
......@@ -1319,6 +1321,7 @@ fmt_dialog_init_font_page (FormatState *state)
FontSelector *font_widget = FONT_SELECTOR (tmp);
GtkWidget *container = glade_xml_get_widget (state->gui, "font_box");
GtkWidget *uline = glade_xml_get_widget (state->gui, "underline_combo");
char const *uline_str;
GtkWidget *strike = glade_xml_get_widget (state->gui, "strikethrough_button");
gboolean strikethrough = FALSE;
......@@ -1358,23 +1361,26 @@ fmt_dialog_init_font_page (FormatState *state)
font_selector_set_points (state->font.selector,
mstyle_get_font_size (state->style));
gnm_combo_text_add_item (GNM_COMBO_TEXT (uline), _("None"));
gnm_combo_text_add_item (GNM_COMBO_TEXT (uline), _("Single"));
gnm_combo_text_add_item (GNM_COMBO_TEXT (uline), _("Double"));
if (!mstyle_is_element_conflict (state->style, MSTYLE_FONT_UNDERLINE)) {
GtkCombo *combo = GTK_COMBO (uline);
char const *val;
switch (mstyle_get_font_uline (state->style)) {
default :
case UNDERLINE_NONE : val = _("None"); break;
case UNDERLINE_SINGLE :val = _("Single"); break;
case UNDERLINE_DOUBLE :val = _("Double"); break;
case UNDERLINE_NONE : uline_str = _("None"); break;
case UNDERLINE_SINGLE : uline_str = _("Single"); break;
case UNDERLINE_DOUBLE : uline_str = _("Double"); break;
};
gtk_entry_set_text (GTK_ENTRY (combo->entry), val);
font_selector_set_underline (state->font.selector, mstyle_get_font_uline (state->style));
g_signal_connect (GTK_OBJECT (combo->entry),
"changed", G_CALLBACK (cb_font_underline_changed),
state);
}
font_selector_set_underline (state->font.selector,
mstyle_get_font_uline (state->style));
} else
uline_str = "";
gnm_combo_text_set_text (GNM_COMBO_TEXT (uline), uline_str,
GNM_COMBO_TEXT_FROM_TOP);
g_signal_connect (GTK_OBJECT (uline),
"entry_changed",
G_CALLBACK (cb_font_underline_changed), state);
gtk_widget_show_all (uline);
if (!mstyle_is_element_conflict (state->style, MSTYLE_FONT_STRIKETHROUGH))
strikethrough = mstyle_get_font_strike (state->style);
......@@ -1383,18 +1389,18 @@ fmt_dialog_init_font_page (FormatState *state)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (strike), strikethrough);
font_selector_set_strike (state->font.selector, strikethrough);
g_signal_connect (GTK_OBJECT (strike), "toggled",
G_CALLBACK (cb_font_strike_toggle),
state);
g_signal_connect (GTK_OBJECT (strike),
"toggled",
G_CALLBACK (cb_font_strike_toggle), state);
if (!mstyle_is_element_conflict (state->style, MSTYLE_COLOR_FORE))
font_selector_set_color (
state->font.selector,
style_color_ref (mstyle_get_color (state->style, MSTYLE_COLOR_FORE)));
g_signal_connect (GTK_OBJECT (font_widget), "font_changed",
G_CALLBACK (cb_font_changed),
state);
g_signal_connect (GTK_OBJECT (font_widget),
"font_changed",
G_CALLBACK (cb_font_changed), state);
}
/*****************************************************************************/
......@@ -1596,12 +1602,12 @@ border_format_has_changed (FormatState *state, BorderPicker *edge)
gboolean changed = FALSE;
edge->is_set = TRUE;
if (edge->is_auto_color)
if (edge->is_auto_color) {
if (!state->border.is_auto_color) {
edge->is_auto_color = state->border.is_auto_color;
changed = TRUE;
}
else if (edge->rgba != state->border.rgba)
} else if (edge->rgba != state->border.rgba)
changed = TRUE;
if (edge->rgba != state->border.rgba) {
......
2002-03-17 Jody Goldberg <jody@gnome.org>
* gnumeric-combo-text.c (cb_scroll_size_request) : if nothing is
selected fall back on the list size req. This is not correct,
but it will do for now.
2002-03-15 Jody Goldberg <jody@gnome.org>
* widget-editable-label.c (editable_label_set_color) : permit colour
......
......@@ -173,15 +173,15 @@ cb_scroll_size_request (GtkWidget *widget, GtkRequisition *requisition,
gtk_widget_size_request (ct->list, &list_req);
if (requisition->height < list_req.height) {
int height = 0;
int height = list_req.height;
GtkWidget const *w = GTK_CONTAINER (ct->list)->focus_child;
if (w != NULL)
if (w != NULL) {
/* Magic number, max number of items before we scroll */
height = w->requisition.height * 10;
if (height > list_req.height)
height = list_req.height;
if (height > list_req.height)
height = list_req.height;
}
/* FIXME : Why do we need 4 ??
* without it things end up scrolling.
......@@ -299,6 +299,11 @@ gnm_combo_text_new (GCompareFunc cmp_func)
ct->cmp_func = cmp_func;
return GTK_WIDGET (ct);
}
GtkWidget *
gnm_combo_text_glade_new (void)
{
return gnm_combo_text_new (NULL);
}
E_MAKE_TYPE(gnm_combo_text, "GnmComboText", GnmComboText,
gnm_combo_text_class_init, gnm_combo_text_init,
......
......@@ -32,6 +32,7 @@ typedef enum { /* begin the search from : */
GType gnm_combo_text_get_type (void);
GtkWidget *gnm_combo_text_new (GCompareFunc cmp_func);
GtkWidget *gnm_combo_text_glade_new (void);
gboolean gnm_combo_text_set_text (GnmComboText *ct, const gchar *label,
GnmComboTextSearch start);
......
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