File: bonobo-zoomable.c

package info (click to toggle)
libbonoboui 2.24.5-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,808 kB
  • ctags: 3,596
  • sloc: ansic: 30,221; sh: 10,256; xml: 599; makefile: 475
file content (658 lines) | stat: -rw-r--r-- 18,364 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
 *
 *  Bonobo::Zoomable - zoomable interface for Controls.
 *
 *  Authors: Maciej Stachowiak <mjs@eazel.com>
 *           Martin Baulig <baulig@suse.de>
 *
 *  Copyright (C) 2000 Eazel, Inc.
 *                2000 SuSE GmbH.
 */
#include <config.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-zoomable.h>
#include <bonobo/bonobo-property-bag.h>

#undef ZOOMABLE_DEBUG

static GObjectClass *bonobo_zoomable_parent_class = NULL;

struct _BonoboZoomablePrivate {
	CORBA_float		 zoom_level;

	CORBA_float		 min_zoom_level;
	CORBA_float		 max_zoom_level;
	CORBA_boolean		 has_min_zoom_level;
	CORBA_boolean		 has_max_zoom_level;
	CORBA_boolean		 is_continuous;

	GArray                  *pref_levels;
	GPtrArray               *pref_names;

	Bonobo_ZoomableFrame	 zoomable_frame;
};

enum {
	SET_FRAME,
	SET_ZOOM_LEVEL,
	ZOOM_IN,
	ZOOM_OUT,
	ZOOM_TO_FIT,
	ZOOM_TO_DEFAULT,
	LAST_SIGNAL
};

enum {
	PARAM_0,
	PARAM_ZOOM_LEVEL,
	PARAM_MIN_ZOOM_LEVEL,
	PARAM_MAX_ZOOM_LEVEL,
	PARAM_HAS_MIN_ZOOM_LEVEL,
	PARAM_HAS_MAX_ZOOM_LEVEL,
	PARAM_IS_CONTINUOUS
};

static guint signals [LAST_SIGNAL];

#define CLASS(o) BONOBO_ZOOMABLE_GET_CLASS(o)

static inline BonoboZoomable *
bonobo_zoomable_from_servant (PortableServer_Servant servant)
{
	return BONOBO_ZOOMABLE (bonobo_object_from_servant (servant));
}

static CORBA_float
impl_Bonobo_Zoomable__get_level (PortableServer_Servant  servant,
				 CORBA_Environment      *ev)
{
	BonoboZoomable *zoomable = bonobo_zoomable_from_servant (servant);

	return zoomable->priv->zoom_level;
}

static CORBA_float
impl_Bonobo_Zoomable__get_minLevel (PortableServer_Servant  servant,
				    CORBA_Environment      *ev)
{
	BonoboZoomable *zoomable = bonobo_zoomable_from_servant (servant);

	return zoomable->priv->min_zoom_level;
}

static CORBA_float
impl_Bonobo_Zoomable__get_maxLevel (PortableServer_Servant  servant,
				    CORBA_Environment      *ev)
{
	BonoboZoomable *zoomable = bonobo_zoomable_from_servant (servant);

	return zoomable->priv->max_zoom_level;
}

static CORBA_boolean
impl_Bonobo_Zoomable__get_hasMinLevel (PortableServer_Servant  servant,
				       CORBA_Environment      *ev)
{
	BonoboZoomable *zoomable = bonobo_zoomable_from_servant (servant);

	return zoomable->priv->has_min_zoom_level;
}

static CORBA_boolean
impl_Bonobo_Zoomable__get_hasMaxLevel (PortableServer_Servant  servant,
				       CORBA_Environment      *ev)
{
	BonoboZoomable *zoomable = bonobo_zoomable_from_servant (servant);

	return zoomable->priv->has_max_zoom_level;
}

static CORBA_boolean
impl_Bonobo_Zoomable__get_isContinuous (PortableServer_Servant  servant,
					CORBA_Environment      *ev)
{
	BonoboZoomable *zoomable = bonobo_zoomable_from_servant (servant);

	return zoomable->priv->is_continuous;
}

static Bonobo_ZoomLevelList *
impl_Bonobo_Zoomable__get_preferredLevels (PortableServer_Servant  servant,
					   CORBA_Environment      *ev)
{
	int                   levels;
	BonoboZoomable       *zoomable;
	Bonobo_ZoomLevelList *list;

	zoomable = bonobo_zoomable_from_servant (servant);
	levels = zoomable->priv->pref_levels->len;

	list = Bonobo_ZoomLevelList__alloc ();
	list->_length  = levels;
	list->_buffer  = CORBA_sequence_Bonobo_ZoomLevel_allocbuf (levels);

	memcpy (list->_buffer, zoomable->priv->pref_levels->data,
		sizeof (CORBA_float) * levels);
	
	CORBA_sequence_set_release (list, CORBA_TRUE);

	return list;
}

static Bonobo_ZoomLevelNameList *
impl_Bonobo_Zoomable__get_preferredLevelNames (PortableServer_Servant servant,
					       CORBA_Environment     *ev)
{
	int levels,i;
	gchar **names;
	BonoboZoomable *zoomable;
	Bonobo_ZoomLevelNameList *list;

	zoomable = bonobo_zoomable_from_servant (servant);

	levels = zoomable->priv->pref_names->len;
	names = (gchar **) zoomable->priv->pref_names->pdata;

	list = Bonobo_ZoomLevelNameList__alloc ();
	list->_length  = levels;
	list->_buffer  = CORBA_sequence_Bonobo_ZoomLevelName_allocbuf (levels);

	for (i = 0; i < levels; ++i)
		list->_buffer [i] = CORBA_string_dup (names [i]);

	CORBA_sequence_set_release (list, CORBA_TRUE);

	return list;
}

static void 
impl_Bonobo_Zoomable_setLevel (PortableServer_Servant  servant,
			       const CORBA_float       zoom_level,
			       CORBA_Environment      *ev)
{
	BonoboZoomable *zoomable = bonobo_zoomable_from_servant (servant);

	g_signal_emit (G_OBJECT (zoomable), signals [SET_ZOOM_LEVEL],
		       0, zoom_level);
}

static void
impl_Bonobo_Zoomable_zoomIn (PortableServer_Servant  servant,
			     CORBA_Environment      *ev)
{	
	BonoboZoomable *zoomable = bonobo_zoomable_from_servant (servant);

	g_signal_emit (G_OBJECT (zoomable), signals [ZOOM_IN], 0);
}

static void
impl_Bonobo_Zoomable_zoomOut (PortableServer_Servant  servant,
			      CORBA_Environment      *ev)
{	
	BonoboZoomable *zoomable = bonobo_zoomable_from_servant (servant);

	g_signal_emit (G_OBJECT (zoomable), signals [ZOOM_OUT], 0);
}

static void
impl_Bonobo_Zoomable_zoomFit (PortableServer_Servant  servant,
			      CORBA_Environment      *ev)
{	
	BonoboZoomable *zoomable = bonobo_zoomable_from_servant (servant);

	g_signal_emit (G_OBJECT (zoomable), signals [ZOOM_TO_FIT], 0);
}

static void
impl_Bonobo_Zoomable_zoomDefault (PortableServer_Servant  servant,
				  CORBA_Environment      *ev)
{	
	BonoboZoomable *zoomable = bonobo_zoomable_from_servant (servant);

	g_signal_emit (G_OBJECT (zoomable), signals [ZOOM_TO_DEFAULT], 0);
}

static void
impl_Bonobo_Zoomable_setFrame (PortableServer_Servant  servant,
			       Bonobo_ZoomableFrame    zoomable_frame,
			       CORBA_Environment      *ev)
{	
	BonoboZoomable *zoomable = bonobo_zoomable_from_servant (servant);

	g_assert (zoomable->priv->zoomable_frame == CORBA_OBJECT_NIL);

	zoomable->priv->zoomable_frame = CORBA_Object_duplicate (zoomable_frame, ev);

	g_signal_emit (G_OBJECT (zoomable), signals [SET_FRAME], 0);
}


static void
bonobo_zoomable_get_property (GObject    *object,
			      guint       property_id,
			      GValue     *value,
			      GParamSpec *pspec)
{
	BonoboZoomable *zoomable = BONOBO_ZOOMABLE (object);
	BonoboZoomablePrivate *priv = zoomable->priv;

	switch (property_id) {
	case PARAM_ZOOM_LEVEL:
		g_value_set_float (value, priv->zoom_level);
		break;
	case PARAM_MIN_ZOOM_LEVEL:
		g_value_set_float (value, priv->min_zoom_level);
		break;
	case PARAM_MAX_ZOOM_LEVEL:
		g_value_set_float (value, priv->max_zoom_level);
		break;
	case PARAM_HAS_MIN_ZOOM_LEVEL:
		g_value_set_boolean (value, priv->has_min_zoom_level);;
		break;
	case PARAM_HAS_MAX_ZOOM_LEVEL:
		g_value_set_boolean (value, priv->has_max_zoom_level);;
		break;
	case PARAM_IS_CONTINUOUS:
		g_value_set_boolean (value, priv->is_continuous);
		break;
	default:
		g_message ("Unknown property_id `%d'", property_id);
		break;
	};
}

static void
bonobo_zoomable_free_preferred_zoom_level_arrays (BonoboZoomable *zoomable)
{
	if (zoomable->priv->pref_names) {
		int        i;
		GPtrArray *array;

		array = zoomable->priv->pref_names;

		for (i = 0; i < array->len; i++)
			g_free (g_ptr_array_index (array, i));
	
		g_ptr_array_free (array, TRUE);
		zoomable->priv->pref_names = NULL;
	}

	if (zoomable->priv->pref_levels) {
		g_array_free (zoomable->priv->pref_levels, TRUE);
		zoomable->priv->pref_levels = NULL;
	}
}

static void
bonobo_zoomable_dispose (GObject *object)
{
	BonoboZoomable *zoomable = (BonoboZoomable *) object;

	bonobo_zoomable_free_preferred_zoom_level_arrays (zoomable);

	bonobo_zoomable_parent_class->dispose (object);
}

static void
bonobo_zoomable_finalize (GObject *object)
{
	BonoboZoomable *zoomable = (BonoboZoomable *) object;

	g_free (zoomable->priv);

	bonobo_zoomable_parent_class->finalize (object);
}

static void
bonobo_zoomable_class_init (BonoboZoomableClass *klass)
{
	POA_Bonobo_Zoomable__epv *epv = &klass->epv;
	GObjectClass *object_class;
	
	object_class = (GObjectClass *) klass;
	
	bonobo_zoomable_parent_class = g_type_class_peek_parent (klass);

	object_class->get_property = bonobo_zoomable_get_property;
	object_class->dispose  = bonobo_zoomable_dispose;
	object_class->finalize = bonobo_zoomable_finalize;

	g_object_class_install_property (
		object_class,
		PARAM_ZOOM_LEVEL,
		g_param_spec_float ("zoom_level",
				    _("Zoom level"),
				    _("The degree of enlargment"),
				    0, G_MAXFLOAT, 1.0,
				    G_PARAM_READABLE));

	g_object_class_install_property (
		object_class,
		PARAM_MIN_ZOOM_LEVEL,
		g_param_spec_float ("min_zoom_level",
				    _("Minimum Zoom level"),
				    _("The minimum degree of enlargment"),
				    0, G_MAXFLOAT, 0.0,
				    G_PARAM_READABLE));

	g_object_class_install_property (
		object_class,
		PARAM_MAX_ZOOM_LEVEL,
		g_param_spec_float ("max_zoom_level",
				    _("Maximum Zoom level"),
				    _("The maximum degree of enlargment"),
				    0, G_MAXFLOAT, 0.0,
				    G_PARAM_READABLE));

	g_object_class_install_property (
		object_class,
		PARAM_HAS_MIN_ZOOM_LEVEL,
		g_param_spec_boolean ("has_min_zoom_level",
				    _("Has a minimum Zoom level"),
				    _("Whether we have a valid minimum zoom level"),
				      FALSE, G_PARAM_READABLE));
				    
	g_object_class_install_property (
		object_class,
		PARAM_HAS_MAX_ZOOM_LEVEL,
		g_param_spec_boolean ("has_max_zoom_level",
				    _("Has a maximum Zoom level"),
				    _("Whether we have a valid maximum zoom level"),
				      FALSE, G_PARAM_READABLE));

	g_object_class_install_property (
		object_class,
		PARAM_IS_CONTINUOUS,
		g_param_spec_boolean ("is_continuous",
				    _("Is continuous"),
				    _("Whether we zoom continuously (as opposed to jumps)"),
				      FALSE, G_PARAM_READABLE));
				    
	signals [SET_FRAME] =
		g_signal_new ("set_frame",
			      G_TYPE_FROM_CLASS (klass),
			      G_SIGNAL_RUN_LAST,
			      G_STRUCT_OFFSET (BonoboZoomableClass, set_frame),
			      NULL, NULL,
			      g_cclosure_marshal_VOID__VOID,
			      G_TYPE_NONE, 0);
	signals [SET_ZOOM_LEVEL] =
		g_signal_new ("set_zoom_level",
			      G_TYPE_FROM_CLASS (klass),
			      G_SIGNAL_RUN_LAST,
			      G_STRUCT_OFFSET (BonoboZoomableClass, set_zoom_level),
			      NULL, NULL,
			      g_cclosure_marshal_VOID__FLOAT,
			      G_TYPE_NONE, 1, G_TYPE_FLOAT);
	signals [ZOOM_IN] = 
		g_signal_new ("zoom_in",
			      G_TYPE_FROM_CLASS (klass),
			      G_SIGNAL_RUN_LAST,
			      G_STRUCT_OFFSET (BonoboZoomableClass, zoom_in),
			      NULL, NULL,
			      g_cclosure_marshal_VOID__VOID,
			      G_TYPE_NONE, 0);
	signals [ZOOM_OUT] = 
		g_signal_new ("zoom_out",
			      G_TYPE_FROM_CLASS (klass),
			      G_SIGNAL_RUN_LAST,
			      G_STRUCT_OFFSET (BonoboZoomableClass, zoom_out),
			      NULL, NULL,
			      g_cclosure_marshal_VOID__VOID,
			      G_TYPE_NONE, 0);
	signals [ZOOM_TO_FIT] = 
		g_signal_new ("zoom_to_fit",
			      G_TYPE_FROM_CLASS (klass),
			      G_SIGNAL_RUN_LAST,
			      G_STRUCT_OFFSET (BonoboZoomableClass, zoom_to_fit),
			      NULL, NULL,
			      g_cclosure_marshal_VOID__VOID,
			      G_TYPE_NONE, 0);
	signals [ZOOM_TO_DEFAULT] = 
		g_signal_new ("zoom_to_default",
			      G_TYPE_FROM_CLASS (klass),
			      G_SIGNAL_RUN_LAST,
			      G_STRUCT_OFFSET (BonoboZoomableClass, zoom_to_default),
			      NULL, NULL,
			      g_cclosure_marshal_VOID__VOID,
			      G_TYPE_NONE, 0);

	epv->_get_level = impl_Bonobo_Zoomable__get_level;
	epv->_get_minLevel = impl_Bonobo_Zoomable__get_minLevel;
	epv->_get_maxLevel = impl_Bonobo_Zoomable__get_maxLevel;
	epv->_get_hasMinLevel = impl_Bonobo_Zoomable__get_hasMinLevel;
	epv->_get_hasMaxLevel = impl_Bonobo_Zoomable__get_hasMaxLevel;
	epv->_get_isContinuous = impl_Bonobo_Zoomable__get_isContinuous;
	epv->_get_preferredLevels = impl_Bonobo_Zoomable__get_preferredLevels;
	epv->_get_preferredLevelNames = impl_Bonobo_Zoomable__get_preferredLevelNames;

	epv->zoomIn      = impl_Bonobo_Zoomable_zoomIn;
	epv->zoomOut     = impl_Bonobo_Zoomable_zoomOut;
	epv->zoomFit     = impl_Bonobo_Zoomable_zoomFit;
	epv->zoomDefault = impl_Bonobo_Zoomable_zoomDefault;

	epv->setLevel = impl_Bonobo_Zoomable_setLevel;
	epv->setFrame = impl_Bonobo_Zoomable_setFrame;
}

static void
bonobo_zoomable_init (BonoboZoomable *zoomable)
{
	zoomable->priv = g_new0 (BonoboZoomablePrivate, 1);

	zoomable->priv->zoom_level = 0.0;
	zoomable->priv->min_zoom_level = 0.0;
	zoomable->priv->max_zoom_level = 0.0;
	zoomable->priv->has_min_zoom_level = FALSE;
	zoomable->priv->has_max_zoom_level = FALSE;
	zoomable->priv->is_continuous = TRUE;
	zoomable->priv->pref_levels = g_array_new (FALSE, TRUE, sizeof (CORBA_float));
	zoomable->priv->pref_names = g_ptr_array_new ();
}

BONOBO_TYPE_FUNC_FULL (BonoboZoomable, Bonobo_Zoomable, BONOBO_TYPE_OBJECT, bonobo_zoomable)

/**
 * bonobo_zoomable_set_parameters_full:
 * 
 * This is used by the component to set new zooming parameters (and to set the
 * initial zooming parameters including the initial zoom level after creating
 * the BonoboZoomable) - for instance after loading a new file.
 *
 * If any of the zoom parameters such as the minimum or maximum zoom level has
 * changed, it is likely that the zoom level has become invalid as well - at
 * least, the container must query it in any case, so we set it here.
 * 
 * Return value: 
 **/
void
bonobo_zoomable_set_parameters_full (BonoboZoomable  *zoomable,
				     float            zoom_level,
				     float            min_zoom_level,
				     float            max_zoom_level,
				     gboolean         has_min_zoom_level,
				     gboolean         has_max_zoom_level,
				     gboolean         is_continuous,
				     float           *pref_levels,
				     const gchar    **pref_names,
				     gint             num_pref_levels)
{
	BonoboZoomablePrivate *priv;

	g_return_if_fail (BONOBO_IS_ZOOMABLE (zoomable));

	priv = zoomable->priv;

	priv->zoom_level = zoom_level;
	priv->min_zoom_level = min_zoom_level;
	priv->max_zoom_level = max_zoom_level;
	priv->has_min_zoom_level = has_min_zoom_level;
	priv->has_max_zoom_level = has_max_zoom_level;
	priv->is_continuous = is_continuous;

	bonobo_zoomable_free_preferred_zoom_level_arrays (zoomable);
	
	priv->pref_levels = g_array_new (FALSE, TRUE, sizeof (CORBA_float));
	
	if (pref_levels)
		g_array_append_vals (priv->pref_levels,
				     pref_levels,
				     num_pref_levels);
	
	priv->pref_names = g_ptr_array_new ();
	
	if (pref_names) {
		int     i;
		gchar **p;

		g_ptr_array_set_size (priv->pref_names, num_pref_levels);
		
		p = (gchar **) priv->pref_names->pdata;

		for (i = 0; i < num_pref_levels; i++)
			p [i] = g_strdup (pref_names [i]);
	}
}

/**
 * bonobo_zoomable_set_parameters:
 * 
 * This is a simple version of @bonobo_zoomable_set_parameters_full()
 * for components which support continuous zooming. It does not
 * override any of the parameters which can only be set by the _full
 * version.
 **/
void
bonobo_zoomable_set_parameters (BonoboZoomable  *zoomable,
                                float            zoom_level,
                                float            min_zoom_level,
                                float            max_zoom_level,
                                gboolean         has_min_zoom_level,
                                gboolean         has_max_zoom_level)
{
	BonoboZoomablePrivate *priv;

	g_return_if_fail (BONOBO_IS_ZOOMABLE (zoomable));

	priv = zoomable->priv;

	priv->zoom_level = zoom_level;
	priv->min_zoom_level = min_zoom_level;
	priv->max_zoom_level = max_zoom_level;
	priv->has_min_zoom_level = has_min_zoom_level;
	priv->has_max_zoom_level = has_max_zoom_level;
}

/**
 * bonobo_zoomable_add_preferred_zoom_level:
 * @zoomable: the zoomable
 * @zoom_level: the new level
 * @zoom_level_name: the new level's name
 * 
 * This appends a new zoom level's name and value to the
 * internal list of these.
 **/
void
bonobo_zoomable_add_preferred_zoom_level (BonoboZoomable *zoomable,
                                          CORBA_float     zoom_level,
                                          const gchar    *zoom_level_name)
{
	gchar *name;
	
	g_array_append_val (zoomable->priv->pref_levels, zoom_level);

	name = g_strdup (zoom_level_name);
	g_ptr_array_add (zoomable->priv->pref_names, name);
}


/**
 * bonobo_zoomable_new:
 * 
 * Create a new bonobo-zoomable implementing BonoboObject
 * interface.
 * 
 * Return value: 
 **/
BonoboZoomable *
bonobo_zoomable_new (void)
{
	return g_object_new (bonobo_zoomable_get_type (), NULL);
}

/**
 * bonobo_zoomable_report_zoom_level_changed:
 *
 * @new_zoom_level: The new zoom level.
 * 
 * Reports the BonoboZoomableFrame that the zoom level has changed (but the
 * other zoom parameters are still the same).
 *
 * This is called after the component has successfully completed a zooming
 * operation - the @new_zoom_level may have been modified from what the
 * container requested to match what the component actually displays at the
 * moment.
 **/
void
bonobo_zoomable_report_zoom_level_changed (BonoboZoomable    *zoomable,
					   float              new_zoom_level,
					   CORBA_Environment *opt_ev)
{
	CORBA_Environment *ev, temp_ev;

	g_return_if_fail (BONOBO_IS_ZOOMABLE (zoomable));

	zoomable->priv->zoom_level = new_zoom_level;

	if (zoomable->priv->zoomable_frame == CORBA_OBJECT_NIL)
		return;

	if (!opt_ev) {
		CORBA_exception_init (&temp_ev);
		ev = &temp_ev;
	} else
		ev = opt_ev;

	Bonobo_ZoomableFrame_onLevelChanged (
		zoomable->priv->zoomable_frame,
		zoomable->priv->zoom_level, ev);

	if (!opt_ev)
		CORBA_exception_free (&temp_ev);
}

/**
 * bonobo_zoomable_report_zoom_parameters_changed:
 *
 * Reports the BonoboZoomableFrame that the zoom parameters have changed;
 * this also includes the zoom level.
 *
 * On the container side (the BonoboZoomableFrame) this implies that the
 * zoom level has changed as well, so you need to query the BonoboZoomable
 * for the new zoom level as well.
 **/
void
bonobo_zoomable_report_zoom_parameters_changed (BonoboZoomable    *zoomable,
						CORBA_Environment *opt_ev)
{
	CORBA_Environment *ev, temp_ev;

	g_return_if_fail (BONOBO_IS_ZOOMABLE (zoomable));

	if (zoomable->priv->zoomable_frame == CORBA_OBJECT_NIL)
		return;

	if (!opt_ev) {
		CORBA_exception_init (&temp_ev);
		ev = &temp_ev;
	} else
		ev = opt_ev;

	Bonobo_ZoomableFrame_onParametersChanged (
		zoomable->priv->zoomable_frame, ev);

	if (!opt_ev)
		CORBA_exception_free (&temp_ev);
}