~ubuntu-branches/ubuntu/quantal/gnumeric/quantal

« back to all changes in this revision

Viewing changes to src/dialogs/dialog-cell-format.c

  • Committer: Bazaar Package Importer
  • Author(s): Gauvain Pocentek
  • Date: 2009-06-07 11:10:47 UTC
  • mfrom: (1.1.19 upstream) (2.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090607111047-l3rtbzfjxvmi1kx0
Tags: 1.9.8-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Promoted gnumeric-doc to Recommends in gnumeric package for help to be
    installed automatically
  - gnumeric-gtk is a transitional package
  - gnumeric conflicts with gnumeric-gtk << 1.8.3-3ubuntu1
  - call initltool-update in po*
  - remove psiconv support (psiconv is in universe):
    o debian/control: remove B-D on libpsiconv-dev
    o debian/rules: don't pass --with-psiconv to ./configure

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
#include <validation.h>
48
48
#include <workbook.h>
49
49
#include <wbc-gtk.h>
50
 
#include <workbook-view.h>
51
50
#include <commands.h>
52
51
#include <mathfunc.h>
53
52
#include <preview-grid.h>
54
 
#include <widgets/gnumeric-expr-entry.h>
55
53
#include <widgets/widget-font-selector.h>
56
54
#include <widgets/gnumeric-dashed-canvas-line.h>
57
55
#include <widgets/gnm-format-sel.h>
64
62
#include <goffice/cut-n-paste/foocanvas/foo-canvas-util.h>
65
63
#include <goffice/cut-n-paste/foocanvas/foo-canvas-rect-ellipse.h>
66
64
#include <glade/glade.h>
67
 
#include <gtk/gtklabel.h>
68
 
#include <gtk/gtknotebook.h>
69
 
#include <gtk/gtkcheckbutton.h>
70
 
#include <gtk/gtkspinbutton.h>
71
 
#include <gtk/gtktogglebutton.h>
72
 
#include <gtk/gtkframe.h>
73
 
#include <gtk/gtkimage.h>
74
 
#include <gtk/gtkcombobox.h>
75
 
#include <gtk/gtkcelllayout.h>
76
 
#include <gtk/gtkcellrenderertext.h>
77
 
#include <gtk/gtkcellrendererpixbuf.h>
78
 
#include <gtk/gtktextview.h>
79
 
#include <gtk/gtkstock.h>
80
 
#include <gtk/gtktable.h>
81
 
#include <gtk/gtkicontheme.h>
82
 
#include <gtk/gtkbox.h>
 
65
#include <gtk/gtk.h>
83
66
 
84
 
#include <math.h>
85
67
#include <string.h>
86
68
 
87
69
static struct {
244
226
 
245
227
        if (state->dialog_changed)
246
228
                state->dialog_changed (state->dialog_changed_user_data);
247
 
        else
248
 
                gtk_widget_set_sensitive (state->apply_button, TRUE);
 
229
        else {
 
230
                GOFormatSel *gfs = GO_FORMAT_SEL (state->format_sel);
 
231
                GOFormat const *fmt = go_format_sel_get_fmt (gfs);
 
232
                gboolean ok = !go_format_is_invalid (fmt);
 
233
 
 
234
                gtk_widget_set_sensitive (state->apply_button, ok);
 
235
                gtk_widget_set_sensitive (state->ok_button, ok);
 
236
        }
249
237
}
250
238
 
251
239
/* Default to the 'Format' page but remember which page we were on between
364
352
                if (0 == (state->conflicts & (1 << MSTYLE_COLOR_PATTERN)))
365
353
                        mcolor = gnm_style_get_pattern_color (state->style);
366
354
 
 
355
                /* fallthrough */
 
356
 
367
357
        case MSTYLE_BORDER_TOP: /* MSTYLE_BORDER_TOP is abused as representing all borders. */
368
358
                def_sc = sheet_style_get_auto_pattern_color (state->sheet);
369
359
                break;
473
463
                                   gtk_label_new (_("Number")));
474
464
        gtk_widget_show (GTK_WIDGET (gfs));
475
465
 
476
 
        if (0 == (state->conflicts & (1 << MSTYLE_FORMAT)))
477
 
                go_format_sel_set_style_format (gfs,
478
 
                        gnm_style_get_format (state->style));
 
466
        if (0 == (state->conflicts & (1 << MSTYLE_FORMAT))) {
 
467
                GOFormat const *fmt = gnm_style_get_format (state->style);
 
468
                go_format_sel_set_style_format (gfs, fmt);
 
469
        }
479
470
        if (state->value)
480
471
                gnm_format_sel_set_value (gfs, state->value);
481
472
        go_format_sel_set_dateconv (gfs,
2310
2301
        set_initial_focus (state);
2311
2302
        gtk_notebook_set_scrollable (state->notebook, TRUE);
2312
2303
 
 
2304
        gnm_dialog_setup_destroy_handlers (GTK_DIALOG (dialog), state->wbcg,
 
2305
                                           GNM_DIALOG_DESTROY_CURRENT_SHEET_REMOVED);
 
2306
        
2313
2307
        /* Ok, edit events from now on are real */
2314
2308
        state->enable_edit = TRUE;
2315
2309
 
2344
2338
        FormatState *state = user;
2345
2339
        GnmValue const *value = iter->cell->value;
2346
2340
        GOFormat const *common = gnm_style_get_format (state->style);
2347
 
 
2348
 
        if (!value || !VALUE_FMT (value))
2349
 
                return NULL;
2350
 
 
2351
 
        if (go_format_eq (common, VALUE_FMT (value)))
 
2341
        GOFormat const *fmt = value ? VALUE_FMT (value) : NULL;
 
2342
 
 
2343
        if (!fmt ||
 
2344
            go_format_is_markup (fmt) ||
 
2345
            go_format_eq (common, fmt))
2352
2346
                return NULL;
2353
2347
 
2354
2348
        if (go_format_is_general (common)) {
2355
 
                gnm_style_set_format (state->style, VALUE_FMT (value));
 
2349
                gnm_style_set_format (state->style, fmt);
2356
2350
                return NULL;
2357
2351
        } else {
2358
2352
                state->conflicts |= MSTYLE_FORMAT;