Commit e6fef7a7 authored by Michael Meeks's avatar Michael Meeks

Font selector sets name, italic/bold, size independantly.

parent d533e180
1999-12-01 Michael Meeks <mmeeks@gnu.org>
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_font_page):
Update to new API.
* src/widgets/widget-font-selector.c (font_selector_set): Kill.
(font_selector_set_points, font_selector_set_style),
(font_selector_set_name): create.
1999-12-01 Federico Mena Quintero <federico@redhat.com>
* src/item-grid.c: item_grid_parent_class should be a
......
1999-12-01 Michael Meeks <mmeeks@gnu.org>
* src/dialogs/dialog-cell-format.c (fmt_dialog_init_font_page):
Update to new API.
* src/widgets/widget-font-selector.c (font_selector_set): Kill.
(font_selector_set_points, font_selector_set_style),
(font_selector_set_name): create.
1999-12-01 Federico Mena Quintero <federico@redhat.com>
* src/item-grid.c: item_grid_parent_class should be a
......
......@@ -100,7 +100,7 @@ Gnumeric Spread Sheet task list
TODO :
- Too much parsing is taking place when formating. We should
have set all that up before hand when the format was parsed.
have set all that up beforehand when the format was parsed.
A methodology similar to that used by the regexp compiler should
be used.
......@@ -181,12 +181,6 @@ Gnumeric Spread Sheet task list
** Style
Borders:
Font:
Font selector needs to display whether bold / italic / font name
is unique, and if so to show which it is.
Protection:
Bloqued/Hidden
......@@ -254,12 +248,9 @@ Office 2000 and 'explorer' compatibility.
* Rendering
* Sort out the mess with cell span's
* Sort out the cell span stuff
* Have a 'merged cell' structure that can be overridden
* have a 'user-set' feature for 'merge cells'
* Store merges as ( ranges a la. styles ) or GPtrArray's
linked from the leftmost existing cell.
* Calculation
* Rework dependencies to only supply one level of indirection.
......
......@@ -23,7 +23,7 @@ Comment[no]=Regnearkprogram
Comment[pt]=Folha de clculo Gnumeric
Comment[pl]=Arkusz kalkulacyjny
Comment[sv]=Kalkylblad
Exec=gnumeric-bonobo
Exec=gnumeric
Icon=gnome-gnumeric.png
Terminal=0
Type=Application
......@@ -1185,19 +1185,18 @@ fmt_dialog_init_font_page (FormatState *state)
state->font.selector = FONT_SELECTOR (font_widget);
/* If there is a conflict dont initialize the font */
if (mstyle_is_element_conflict (state->style, MSTYLE_FONT_NAME) ||
mstyle_is_element_conflict (state->style, MSTYLE_FONT_BOLD) ||
mstyle_is_element_conflict (state->style, MSTYLE_FONT_ITALIC) ||
mstyle_is_element_conflict (state->style, MSTYLE_FONT_SIZE))
return;
/* Init the font selector with the current font */
font_selector_set (state->font.selector,
mstyle_get_font_name (state->style),
mstyle_get_font_bold (state->style),
mstyle_get_font_italic (state->style),
mstyle_get_font_size (state->style));
if (!mstyle_is_element_conflict (state->style, MSTYLE_FONT_NAME))
font_selector_set_name (state->font.selector,
mstyle_get_font_name (state->style));
if (!mstyle_is_element_conflict (state->style, MSTYLE_FONT_BOLD) &&
!mstyle_is_element_conflict (state->style, MSTYLE_FONT_ITALIC))
font_selector_set_style (state->font.selector,
mstyle_get_font_bold (state->style),
mstyle_get_font_italic (state->style));
if (!mstyle_is_element_conflict (state->style, MSTYLE_FONT_SIZE))
font_selector_set_points (state->font.selector,
mstyle_get_font_size (state->style));
}
/*****************************************************************************/
......
......@@ -40,7 +40,7 @@ reload_preview (FontSelector *fs)
fs->is_bold ? GNOME_FONT_BOLD : GNOME_FONT_BOOK,
fs->is_italic,
fs->size);
if (!gnome_font){
if (!gnome_font) {
g_warning ("Uh oh, cannot get the font!");
return;
}
......@@ -52,12 +52,12 @@ reload_preview (FontSelector *fs)
fs->size,
1.0);
if (!display_font){
if (!display_font) {
g_warning ("Uh oh, cannot get the display font");
return;
}
if (!display_font->gdk_font){
if (!display_font->gdk_font) {
gtk_object_unref (GTK_OBJECT (gnome_font));
return;
}
......@@ -104,7 +104,7 @@ fs_fill_font_name_list (FontSelector *fs)
{
GList *l;
for (l = gnumeric_font_family_list; l; l = l->next){
for (l = gnumeric_font_family_list; l; l = l->next) {
char *name = l->data;
char *array [1];
......@@ -134,7 +134,7 @@ style_selected (GtkCList *style_list, int col, int row, GdkEvent *event, FontSel
{
row = GPOINTER_TO_INT (style_list->selection->data);
switch (row){
switch (row) {
case 0:
fs->is_bold = fs->is_italic = FALSE;
break;
......@@ -162,7 +162,7 @@ fs_fill_font_style_list (FontSelector *fs)
GtkCList *style_list = GTK_CLIST (fs->font_style_list);
int i;
for (i = 0; styles [i] != NULL; i++){
for (i = 0; styles [i] != NULL; i++) {
char *array [1];
array [0] = _(styles [i]);
......@@ -195,7 +195,7 @@ size_changed (GtkEntry *entry, FontSelector *fs)
text = gtk_entry_get_text (entry);
size = atof (text);
if (size > 0 && size < 128){
if (size > 0 && size < 128) {
fs->size = size;
reload_preview (fs);
}
......@@ -206,7 +206,7 @@ fs_fill_font_size_list (FontSelector *fs)
{
int i;
for (i = 0; gnumeric_point_sizes [i] != 0; i++){
for (i = 0; gnumeric_point_sizes [i] != 0; i++) {
char buffer [10];
char *array [1];
......@@ -280,7 +280,7 @@ font_selector_get_type (void)
{
static GtkType fs_type = 0;
if (!fs_type){
if (!fs_type) {
GtkTypeInfo fs_info = {
"FontSelector",
sizeof (FontSelector),
......@@ -316,26 +316,37 @@ select_row (GtkWidget *list, int row)
}
void
font_selector_set (FontSelector *fs,
const char *name, gboolean is_bold, gboolean is_italic, double size)
font_selector_set_name (FontSelector *fs,
const char *font_name)
{
GList *l;
int row;
int n, i;
g_return_if_fail (fs != NULL);
g_return_if_fail (IS_FONT_SELECTOR (fs));
g_return_if_fail (name != NULL);
g_return_if_fail (font_name != NULL);
for (row = 0, l = gnumeric_font_family_list; l; l = l->next, row++){
if (strcasecmp (name, l->data) == 0)
for (row = 0, l = gnumeric_font_family_list; l; l = l->next, row++) {
if (strcasecmp (font_name, l->data) == 0)
break;
}
if (l != NULL)
select_row (fs->font_name_list, row);
if (is_bold){
}
void
font_selector_set_style (FontSelector *fs,
gboolean is_bold,
gboolean is_italic)
{
int n;
g_return_if_fail (fs != NULL);
g_return_if_fail (IS_FONT_SELECTOR (fs));
if (is_bold) {
if (is_italic)
n = 2;
else
......@@ -347,18 +358,28 @@ font_selector_set (FontSelector *fs,
n = 0;
}
select_row (fs->font_style_list, n);
}
void
font_selector_set_points (FontSelector *fs,
double point_size)
{
int i;
g_return_if_fail (fs != NULL);
g_return_if_fail (IS_FONT_SELECTOR (fs));
for (i = 0; gnumeric_point_sizes [i] != 0; i++) {
if (gnumeric_point_sizes [i] == size) {
if (gnumeric_point_sizes [i] == point_size) {
select_row (fs->font_size_list, i);
break;
}
}
if (gnumeric_point_sizes [i] == 0){
if (gnumeric_point_sizes [i] == 0) {
char buffer [20];
sprintf (buffer, "%g", size);
sprintf (buffer, "%g", point_size);
gtk_entry_set_text (GTK_ENTRY (fs->font_size_entry), buffer);
}
......
......@@ -37,11 +37,13 @@ typedef struct {
GtkType font_selector_get_type (void);
GtkWidget *font_selector_new (void);
void font_selector_set (FontSelector *fs,
const char *fontname,
gboolean bold,
gboolean italic,
double point_size);
void font_selector_set_name (FontSelector *fs,
const char *font_name);
void font_selector_set_style (FontSelector *fs,
gboolean is_bold,
gboolean is_italic);
void font_selector_set_points (FontSelector *fs,
double point_size);
#endif /* GNUMERIC_WIDGET_FONT_SELECTOR_H */
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