1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- |
---|
2 | * |
---|
3 | * Bonobo::ZoomableFrame - container side part of Bonobo::Zoomable. |
---|
4 | * |
---|
5 | * Copyright (C) 2000 Eazel, Inc. |
---|
6 | * 2000 SuSE GmbH. |
---|
7 | * |
---|
8 | * This library is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU Lesser General Public |
---|
10 | * License as published by the Free Software Foundation; either |
---|
11 | * version 2 of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This library is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 | * Lesser General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU Lesser General Public |
---|
19 | * License along with this library; if not, write to the Free |
---|
20 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
21 | * |
---|
22 | * Authors: Maciej Stachowiak <mjs@eazel.com> |
---|
23 | * Martin Baulig <baulig@suse.de> |
---|
24 | * |
---|
25 | */ |
---|
26 | |
---|
27 | #include <config.h> |
---|
28 | #include <bonobo/bonobo-exception.h> |
---|
29 | #include <bonobo/bonobo-zoomable-frame.h> |
---|
30 | #include <gtk/gtksignal.h> |
---|
31 | |
---|
32 | #undef ZOOMABLE_DEBUG |
---|
33 | |
---|
34 | static BonoboObjectClass *bonobo_zoomable_frame_parent_class; |
---|
35 | static BonoboZoomableFrameClass *bonobo_zoomable_frame_class; |
---|
36 | |
---|
37 | struct _BonoboZoomableFramePrivate { |
---|
38 | Bonobo_Zoomable zoomable; |
---|
39 | }; |
---|
40 | |
---|
41 | enum { |
---|
42 | ZOOM_LEVEL_CHANGED, |
---|
43 | ZOOM_PARAMETERS_CHANGED, |
---|
44 | LAST_SIGNAL |
---|
45 | }; |
---|
46 | |
---|
47 | static guint signals[LAST_SIGNAL]; |
---|
48 | |
---|
49 | typedef struct { |
---|
50 | POA_Bonobo_ZoomableFrame servant; |
---|
51 | |
---|
52 | BonoboZoomableFrame *gtk_object; |
---|
53 | } impl_POA_Bonobo_ZoomableFrame; |
---|
54 | |
---|
55 | POA_Bonobo_ZoomableFrame__vepv bonobo_zoomable_frame_vepv; |
---|
56 | |
---|
57 | static inline BonoboZoomableFrame * |
---|
58 | bonobo_zoomable_frame_from_servant (PortableServer_Servant servant) |
---|
59 | { |
---|
60 | if (!BONOBO_IS_ZOOMABLE_FRAME (bonobo_object_from_servant (servant))) |
---|
61 | return NULL; |
---|
62 | else |
---|
63 | return BONOBO_ZOOMABLE_FRAME (bonobo_object_from_servant (servant)); |
---|
64 | } |
---|
65 | |
---|
66 | static void |
---|
67 | impl_Bonobo_ZoomableFrame_onLevelChanged (PortableServer_Servant servant, |
---|
68 | const CORBA_float zoom_level, |
---|
69 | CORBA_Environment *ev) |
---|
70 | { |
---|
71 | BonoboZoomableFrame *zoomable_frame; |
---|
72 | |
---|
73 | zoomable_frame = bonobo_zoomable_frame_from_servant (servant); |
---|
74 | gtk_signal_emit (GTK_OBJECT (zoomable_frame), signals[ZOOM_LEVEL_CHANGED], |
---|
75 | zoom_level); |
---|
76 | } |
---|
77 | |
---|
78 | static void |
---|
79 | impl_Bonobo_ZoomableFrame_onParametersChanged (PortableServer_Servant servant, |
---|
80 | CORBA_Environment *ev) |
---|
81 | { |
---|
82 | BonoboZoomableFrame *zoomable_frame; |
---|
83 | |
---|
84 | zoomable_frame = bonobo_zoomable_frame_from_servant (servant); |
---|
85 | gtk_signal_emit (GTK_OBJECT (zoomable_frame), signals[ZOOM_PARAMETERS_CHANGED]); |
---|
86 | } |
---|
87 | |
---|
88 | |
---|
89 | /** |
---|
90 | * bonobo_zoomable_frame_get_epv: |
---|
91 | * |
---|
92 | * Returns: The EPV for the default BonoboZoomableFrame implementation. |
---|
93 | */ |
---|
94 | POA_Bonobo_ZoomableFrame__epv * |
---|
95 | bonobo_zoomable_frame_get_epv (void) |
---|
96 | { |
---|
97 | POA_Bonobo_ZoomableFrame__epv *epv; |
---|
98 | |
---|
99 | epv = g_new0 (POA_Bonobo_ZoomableFrame__epv, 1); |
---|
100 | |
---|
101 | epv->onLevelChanged = impl_Bonobo_ZoomableFrame_onLevelChanged; |
---|
102 | epv->onParametersChanged = impl_Bonobo_ZoomableFrame_onParametersChanged; |
---|
103 | |
---|
104 | return epv; |
---|
105 | } |
---|
106 | |
---|
107 | static void |
---|
108 | init_zoomable_corba_class (void) |
---|
109 | { |
---|
110 | /* The VEPV */ |
---|
111 | bonobo_zoomable_frame_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); |
---|
112 | bonobo_zoomable_frame_vepv.Bonobo_ZoomableFrame_epv = bonobo_zoomable_frame_get_epv (); |
---|
113 | } |
---|
114 | |
---|
115 | static void |
---|
116 | marshal_NONE__FLOAT (GtkObject *object, |
---|
117 | GtkSignalFunc func, |
---|
118 | gpointer func_data, |
---|
119 | GtkArg *args) |
---|
120 | { |
---|
121 | (* (void (*)(GtkObject *, float, gpointer)) func) |
---|
122 | (object, |
---|
123 | GTK_VALUE_FLOAT (args[0]), |
---|
124 | func_data); |
---|
125 | } |
---|
126 | |
---|
127 | static void |
---|
128 | bonobo_zoomable_frame_destroy (GtkObject *object) |
---|
129 | { |
---|
130 | BonoboZoomableFrame *zoomable_frame; |
---|
131 | |
---|
132 | g_return_if_fail (object != NULL); |
---|
133 | g_return_if_fail (BONOBO_IS_ZOOMABLE_FRAME (object)); |
---|
134 | |
---|
135 | zoomable_frame = BONOBO_ZOOMABLE_FRAME (object); |
---|
136 | |
---|
137 | if (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL) |
---|
138 | bonobo_object_release_unref (zoomable_frame->priv->zoomable, NULL); |
---|
139 | zoomable_frame->priv->zoomable = CORBA_OBJECT_NIL; |
---|
140 | |
---|
141 | GTK_OBJECT_CLASS (bonobo_zoomable_frame_parent_class)->destroy (object); |
---|
142 | } |
---|
143 | |
---|
144 | static void |
---|
145 | bonobo_zoomable_frame_finalize (GtkObject *object) |
---|
146 | { |
---|
147 | BonoboZoomableFrame *zoomable_frame; |
---|
148 | |
---|
149 | g_return_if_fail (object != NULL); |
---|
150 | g_return_if_fail (BONOBO_IS_ZOOMABLE_FRAME (object)); |
---|
151 | |
---|
152 | zoomable_frame = BONOBO_ZOOMABLE_FRAME (object); |
---|
153 | |
---|
154 | g_free (zoomable_frame->priv); |
---|
155 | zoomable_frame->priv = NULL; |
---|
156 | |
---|
157 | GTK_OBJECT_CLASS (bonobo_zoomable_frame_parent_class)->finalize (object); |
---|
158 | } |
---|
159 | |
---|
160 | static void |
---|
161 | bonobo_zoomable_frame_class_init (BonoboZoomableFrameClass *klass) |
---|
162 | { |
---|
163 | GtkObjectClass *object_class; |
---|
164 | |
---|
165 | object_class = (GtkObjectClass*) klass; |
---|
166 | |
---|
167 | bonobo_zoomable_frame_parent_class = gtk_type_class (bonobo_object_get_type ()); |
---|
168 | bonobo_zoomable_frame_class = klass; |
---|
169 | |
---|
170 | signals[ZOOM_LEVEL_CHANGED] = |
---|
171 | gtk_signal_new ("zoom_level_changed", |
---|
172 | GTK_RUN_LAST, |
---|
173 | object_class->type, |
---|
174 | GTK_SIGNAL_OFFSET (BonoboZoomableFrameClass, zoom_level_changed), |
---|
175 | marshal_NONE__FLOAT, |
---|
176 | GTK_TYPE_NONE, 1, GTK_TYPE_FLOAT); |
---|
177 | signals[ZOOM_PARAMETERS_CHANGED] = |
---|
178 | gtk_signal_new ("zoom_parameters_changed", |
---|
179 | GTK_RUN_LAST, |
---|
180 | object_class->type, |
---|
181 | GTK_SIGNAL_OFFSET (BonoboZoomableFrameClass, zoom_parameters_changed), |
---|
182 | gtk_marshal_NONE__NONE, |
---|
183 | GTK_TYPE_NONE, 0); |
---|
184 | |
---|
185 | gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); |
---|
186 | |
---|
187 | object_class->destroy = bonobo_zoomable_frame_destroy; |
---|
188 | object_class->finalize = bonobo_zoomable_frame_finalize; |
---|
189 | |
---|
190 | init_zoomable_corba_class (); |
---|
191 | } |
---|
192 | |
---|
193 | static void |
---|
194 | bonobo_zoomable_frame_init (BonoboZoomableFrame *zoomable) |
---|
195 | { |
---|
196 | zoomable->priv = g_new0 (BonoboZoomableFramePrivate, 1); |
---|
197 | |
---|
198 | } |
---|
199 | |
---|
200 | /** |
---|
201 | * bonobo_zoomable_frame_get_type: |
---|
202 | * |
---|
203 | * Returns: the GtkType for a BonoboZoomableFrame object. |
---|
204 | */ |
---|
205 | GtkType |
---|
206 | bonobo_zoomable_frame_get_type (void) |
---|
207 | { |
---|
208 | static GtkType type = 0; |
---|
209 | |
---|
210 | if (!type) { |
---|
211 | GtkTypeInfo info = { |
---|
212 | "BonoboZoomableFrame", |
---|
213 | sizeof (BonoboZoomableFrame), |
---|
214 | sizeof (BonoboZoomableFrameClass), |
---|
215 | (GtkClassInitFunc) bonobo_zoomable_frame_class_init, |
---|
216 | (GtkObjectInitFunc) bonobo_zoomable_frame_init, |
---|
217 | NULL, /* reserved 1 */ |
---|
218 | NULL, /* reserved 2 */ |
---|
219 | (GtkClassInitFunc) NULL |
---|
220 | }; |
---|
221 | |
---|
222 | type = gtk_type_unique (bonobo_object_get_type (), &info); |
---|
223 | } |
---|
224 | |
---|
225 | return type; |
---|
226 | } |
---|
227 | |
---|
228 | Bonobo_ZoomableFrame |
---|
229 | bonobo_zoomable_frame_corba_object_create (BonoboObject *object) |
---|
230 | { |
---|
231 | POA_Bonobo_ZoomableFrame *servant; |
---|
232 | CORBA_Environment ev; |
---|
233 | |
---|
234 | servant = (POA_Bonobo_ZoomableFrame *) g_new0 (BonoboObjectServant, 1); |
---|
235 | servant->vepv = &bonobo_zoomable_frame_vepv; |
---|
236 | |
---|
237 | CORBA_exception_init (&ev); |
---|
238 | |
---|
239 | POA_Bonobo_ZoomableFrame__init ((PortableServer_Servant) servant, &ev); |
---|
240 | if (BONOBO_EX (&ev)){ |
---|
241 | g_free (servant); |
---|
242 | CORBA_exception_free (&ev); |
---|
243 | return CORBA_OBJECT_NIL; |
---|
244 | } |
---|
245 | |
---|
246 | CORBA_exception_free (&ev); |
---|
247 | return (Bonobo_ZoomableFrame) bonobo_object_activate_servant (object, servant); |
---|
248 | } |
---|
249 | |
---|
250 | BonoboZoomableFrame * |
---|
251 | bonobo_zoomable_frame_construct (BonoboZoomableFrame *p, |
---|
252 | Bonobo_ZoomableFrame corba_p) |
---|
253 | { |
---|
254 | g_return_val_if_fail (p != NULL, NULL); |
---|
255 | g_return_val_if_fail (BONOBO_IS_ZOOMABLE_FRAME (p), NULL); |
---|
256 | g_return_val_if_fail (corba_p != NULL, NULL); |
---|
257 | |
---|
258 | bonobo_object_construct (BONOBO_OBJECT (p), corba_p); |
---|
259 | |
---|
260 | return p; |
---|
261 | } |
---|
262 | |
---|
263 | /** |
---|
264 | * bonobo_zoomable_frame_new: |
---|
265 | * |
---|
266 | * Create a new bonobo-zoomable implementing BonoboObject |
---|
267 | * interface. |
---|
268 | * |
---|
269 | * Return value: |
---|
270 | **/ |
---|
271 | BonoboZoomableFrame * |
---|
272 | bonobo_zoomable_frame_new (void) |
---|
273 | { |
---|
274 | BonoboZoomableFrame *p; |
---|
275 | Bonobo_ZoomableFrame corba_p; |
---|
276 | |
---|
277 | p = gtk_type_new (bonobo_zoomable_frame_get_type ()); |
---|
278 | g_return_val_if_fail (p != NULL, NULL); |
---|
279 | |
---|
280 | corba_p = bonobo_zoomable_frame_corba_object_create (BONOBO_OBJECT (p)); |
---|
281 | if (corba_p == CORBA_OBJECT_NIL){ |
---|
282 | bonobo_object_unref (BONOBO_OBJECT (p)); |
---|
283 | return NULL; |
---|
284 | } |
---|
285 | |
---|
286 | return bonobo_zoomable_frame_construct (p, corba_p); |
---|
287 | } |
---|
288 | |
---|
289 | /** |
---|
290 | * bonobo_zoomable_frame_bind_to_zoomable: |
---|
291 | * @zoomable_frame: A BonoboZoomableFrame object. |
---|
292 | * @zoomable: The CORBA object for the BonoboZoomable embedded |
---|
293 | * in this BonoboZoomableFrame. |
---|
294 | * |
---|
295 | * Associates @zoomable with this @zoomable_frame. |
---|
296 | */ |
---|
297 | void |
---|
298 | bonobo_zoomable_frame_bind_to_zoomable (BonoboZoomableFrame *zoomable_frame, Bonobo_Zoomable zoomable) |
---|
299 | { |
---|
300 | CORBA_Environment ev; |
---|
301 | |
---|
302 | g_return_if_fail (zoomable != CORBA_OBJECT_NIL); |
---|
303 | g_return_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame)); |
---|
304 | |
---|
305 | /* |
---|
306 | * Keep a local handle to the Zoomable. |
---|
307 | */ |
---|
308 | if (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL) |
---|
309 | g_warning ("FIXME: leaking zoomable reference"); |
---|
310 | |
---|
311 | zoomable_frame->priv->zoomable = bonobo_object_dup_ref (zoomable, NULL); |
---|
312 | |
---|
313 | /* |
---|
314 | * Introduce ourselves to the Zoomable. |
---|
315 | */ |
---|
316 | CORBA_exception_init (&ev); |
---|
317 | Bonobo_Zoomable_setFrame (zoomable, BONOBO_OBJREF (zoomable_frame), |
---|
318 | &ev); |
---|
319 | if (BONOBO_EX (&ev)) |
---|
320 | bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), zoomable, &ev); |
---|
321 | CORBA_exception_free (&ev); |
---|
322 | } |
---|
323 | |
---|
324 | /** |
---|
325 | * bonobo_zoomable_frame_get_zoomable: |
---|
326 | * @zoomable_frame: A BonoboZoomableFrame which is bound to a remote |
---|
327 | * BonoboZoomable. |
---|
328 | * |
---|
329 | * Returns: The Bonobo_Zoomable CORBA interface for the remote Zoomable |
---|
330 | * which is bound to @frame. See also |
---|
331 | * bonobo_zoomable_frame_bind_to_zoomable(). |
---|
332 | */ |
---|
333 | Bonobo_Zoomable |
---|
334 | bonobo_zoomable_frame_get_zoomable (BonoboZoomableFrame *zoomable_frame) |
---|
335 | { |
---|
336 | g_return_val_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame), CORBA_OBJECT_NIL); |
---|
337 | |
---|
338 | return zoomable_frame->priv->zoomable; |
---|
339 | } |
---|
340 | |
---|
341 | void |
---|
342 | bonobo_zoomable_frame_zoom_in (BonoboZoomableFrame *zoomable_frame) |
---|
343 | { |
---|
344 | CORBA_Environment ev; |
---|
345 | |
---|
346 | g_return_if_fail (zoomable_frame != NULL); |
---|
347 | g_return_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame)); |
---|
348 | g_return_if_fail (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL); |
---|
349 | |
---|
350 | CORBA_exception_init (&ev); |
---|
351 | Bonobo_Zoomable_zoomIn (zoomable_frame->priv->zoomable, &ev); |
---|
352 | bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), |
---|
353 | zoomable_frame->priv->zoomable, &ev); |
---|
354 | CORBA_exception_free (&ev); |
---|
355 | } |
---|
356 | |
---|
357 | void |
---|
358 | bonobo_zoomable_frame_zoom_out (BonoboZoomableFrame *zoomable_frame) |
---|
359 | { |
---|
360 | CORBA_Environment ev; |
---|
361 | |
---|
362 | g_return_if_fail (zoomable_frame != NULL); |
---|
363 | g_return_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame)); |
---|
364 | g_return_if_fail (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL); |
---|
365 | |
---|
366 | CORBA_exception_init (&ev); |
---|
367 | Bonobo_Zoomable_zoomOut (zoomable_frame->priv->zoomable, &ev); |
---|
368 | bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), |
---|
369 | zoomable_frame->priv->zoomable, &ev); |
---|
370 | CORBA_exception_free (&ev); |
---|
371 | } |
---|
372 | |
---|
373 | void |
---|
374 | bonobo_zoomable_frame_zoom_to_fit (BonoboZoomableFrame *zoomable_frame) |
---|
375 | { |
---|
376 | CORBA_Environment ev; |
---|
377 | |
---|
378 | g_return_if_fail (zoomable_frame != NULL); |
---|
379 | g_return_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame)); |
---|
380 | g_return_if_fail (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL); |
---|
381 | |
---|
382 | CORBA_exception_init (&ev); |
---|
383 | Bonobo_Zoomable_zoomFit (zoomable_frame->priv->zoomable, &ev); |
---|
384 | bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), |
---|
385 | zoomable_frame->priv->zoomable, &ev); |
---|
386 | CORBA_exception_free (&ev); |
---|
387 | } |
---|
388 | |
---|
389 | void |
---|
390 | bonobo_zoomable_frame_zoom_to_default (BonoboZoomableFrame *zoomable_frame) |
---|
391 | { |
---|
392 | CORBA_Environment ev; |
---|
393 | |
---|
394 | g_return_if_fail (zoomable_frame != NULL); |
---|
395 | g_return_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame)); |
---|
396 | g_return_if_fail (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL); |
---|
397 | |
---|
398 | CORBA_exception_init (&ev); |
---|
399 | Bonobo_Zoomable_zoomDefault (zoomable_frame->priv->zoomable, &ev); |
---|
400 | bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), |
---|
401 | zoomable_frame->priv->zoomable, &ev); |
---|
402 | CORBA_exception_free (&ev); |
---|
403 | } |
---|
404 | |
---|
405 | float |
---|
406 | bonobo_zoomable_frame_get_zoom_level (BonoboZoomableFrame *zoomable_frame) |
---|
407 | { |
---|
408 | CORBA_Environment ev; |
---|
409 | float retval; |
---|
410 | |
---|
411 | g_return_val_if_fail (zoomable_frame != NULL, 0.0); |
---|
412 | g_return_val_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame), 0.0); |
---|
413 | g_return_val_if_fail (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL, 0.0); |
---|
414 | |
---|
415 | CORBA_exception_init (&ev); |
---|
416 | retval = Bonobo_Zoomable__get_level (zoomable_frame->priv->zoomable, &ev); |
---|
417 | if (BONOBO_EX (&ev)) |
---|
418 | retval = 0.0; |
---|
419 | bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), |
---|
420 | zoomable_frame->priv->zoomable, &ev); |
---|
421 | CORBA_exception_free (&ev); |
---|
422 | |
---|
423 | return retval; |
---|
424 | } |
---|
425 | |
---|
426 | float |
---|
427 | bonobo_zoomable_frame_get_min_zoom_level (BonoboZoomableFrame *zoomable_frame) |
---|
428 | { |
---|
429 | CORBA_Environment ev; |
---|
430 | float retval; |
---|
431 | |
---|
432 | g_return_val_if_fail (zoomable_frame != NULL, 0.0); |
---|
433 | g_return_val_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame), 0.0); |
---|
434 | g_return_val_if_fail (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL, 0.0); |
---|
435 | |
---|
436 | CORBA_exception_init (&ev); |
---|
437 | retval = Bonobo_Zoomable__get_minLevel (zoomable_frame->priv->zoomable, &ev); |
---|
438 | if (BONOBO_EX (&ev)) |
---|
439 | retval = 0.0; |
---|
440 | bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), |
---|
441 | zoomable_frame->priv->zoomable, &ev); |
---|
442 | CORBA_exception_free (&ev); |
---|
443 | |
---|
444 | return retval; |
---|
445 | } |
---|
446 | |
---|
447 | float |
---|
448 | bonobo_zoomable_frame_get_max_zoom_level (BonoboZoomableFrame *zoomable_frame) |
---|
449 | { |
---|
450 | CORBA_Environment ev; |
---|
451 | float retval; |
---|
452 | |
---|
453 | g_return_val_if_fail (zoomable_frame != NULL, 0.0); |
---|
454 | g_return_val_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame), 0.0); |
---|
455 | g_return_val_if_fail (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL, 0.0); |
---|
456 | |
---|
457 | CORBA_exception_init (&ev); |
---|
458 | retval = Bonobo_Zoomable__get_maxLevel (zoomable_frame->priv->zoomable, &ev); |
---|
459 | if (BONOBO_EX (&ev)) |
---|
460 | retval = 0.0; |
---|
461 | bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), |
---|
462 | zoomable_frame->priv->zoomable, &ev); |
---|
463 | CORBA_exception_free (&ev); |
---|
464 | |
---|
465 | return retval; |
---|
466 | } |
---|
467 | |
---|
468 | gboolean |
---|
469 | bonobo_zoomable_frame_has_min_zoom_level (BonoboZoomableFrame *zoomable_frame) |
---|
470 | { |
---|
471 | CORBA_Environment ev; |
---|
472 | gboolean retval; |
---|
473 | |
---|
474 | g_return_val_if_fail (zoomable_frame != NULL, FALSE); |
---|
475 | g_return_val_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame), FALSE); |
---|
476 | g_return_val_if_fail (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL, FALSE); |
---|
477 | |
---|
478 | CORBA_exception_init (&ev); |
---|
479 | retval = Bonobo_Zoomable__get_hasMinLevel (zoomable_frame->priv->zoomable, &ev); |
---|
480 | if (BONOBO_EX (&ev)) |
---|
481 | retval = FALSE; |
---|
482 | bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), |
---|
483 | zoomable_frame->priv->zoomable, &ev); |
---|
484 | CORBA_exception_free (&ev); |
---|
485 | |
---|
486 | return retval; |
---|
487 | } |
---|
488 | |
---|
489 | gboolean |
---|
490 | bonobo_zoomable_frame_has_max_zoom_level (BonoboZoomableFrame *zoomable_frame) |
---|
491 | { |
---|
492 | CORBA_Environment ev; |
---|
493 | gboolean retval; |
---|
494 | |
---|
495 | g_return_val_if_fail (zoomable_frame != NULL, FALSE); |
---|
496 | g_return_val_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame), FALSE); |
---|
497 | g_return_val_if_fail (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL, FALSE); |
---|
498 | |
---|
499 | CORBA_exception_init (&ev); |
---|
500 | retval = Bonobo_Zoomable__get_hasMaxLevel (zoomable_frame->priv->zoomable, &ev); |
---|
501 | if (BONOBO_EX (&ev)) |
---|
502 | retval = FALSE; |
---|
503 | bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), |
---|
504 | zoomable_frame->priv->zoomable, &ev); |
---|
505 | CORBA_exception_free (&ev); |
---|
506 | |
---|
507 | return retval; |
---|
508 | } |
---|
509 | |
---|
510 | gboolean |
---|
511 | bonobo_zoomable_frame_is_continuous (BonoboZoomableFrame *zoomable_frame) |
---|
512 | { |
---|
513 | CORBA_Environment ev; |
---|
514 | gboolean retval; |
---|
515 | |
---|
516 | g_return_val_if_fail (zoomable_frame != NULL, FALSE); |
---|
517 | g_return_val_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame), FALSE); |
---|
518 | g_return_val_if_fail (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL, FALSE); |
---|
519 | |
---|
520 | CORBA_exception_init (&ev); |
---|
521 | retval = Bonobo_Zoomable__get_isContinuous (zoomable_frame->priv->zoomable, &ev); |
---|
522 | if (BONOBO_EX (&ev)) |
---|
523 | retval = FALSE; |
---|
524 | bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), |
---|
525 | zoomable_frame->priv->zoomable, &ev); |
---|
526 | CORBA_exception_free (&ev); |
---|
527 | |
---|
528 | return retval; |
---|
529 | } |
---|
530 | |
---|
531 | GList * |
---|
532 | bonobo_zoomable_frame_get_preferred_zoom_levels (BonoboZoomableFrame *zoomable_frame) |
---|
533 | { |
---|
534 | CORBA_Environment ev; |
---|
535 | Bonobo_ZoomLevelList *zoom_levels; |
---|
536 | GList *list = NULL; |
---|
537 | int i; |
---|
538 | |
---|
539 | g_return_val_if_fail (zoomable_frame != NULL, NULL); |
---|
540 | g_return_val_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame), NULL); |
---|
541 | |
---|
542 | CORBA_exception_init (&ev); |
---|
543 | |
---|
544 | zoom_levels = Bonobo_Zoomable__get_preferredLevels ( |
---|
545 | zoomable_frame->priv->zoomable, &ev); |
---|
546 | |
---|
547 | if (BONOBO_EX (&ev)) { |
---|
548 | bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), |
---|
549 | zoomable_frame->priv->zoomable, &ev); |
---|
550 | CORBA_exception_free (&ev); |
---|
551 | return NULL; |
---|
552 | } |
---|
553 | |
---|
554 | CORBA_exception_free (&ev); |
---|
555 | |
---|
556 | if (zoom_levels == CORBA_OBJECT_NIL) |
---|
557 | return NULL; |
---|
558 | |
---|
559 | for (i = 0; i < zoom_levels->_length; i++) { |
---|
560 | float *this; |
---|
561 | |
---|
562 | this = g_new0 (float, 1); |
---|
563 | *this = zoom_levels->_buffer [i]; |
---|
564 | |
---|
565 | list = g_list_prepend (list, this); |
---|
566 | } |
---|
567 | |
---|
568 | CORBA_free (zoom_levels); |
---|
569 | |
---|
570 | return g_list_reverse (list); |
---|
571 | } |
---|
572 | |
---|
573 | GList * |
---|
574 | bonobo_zoomable_frame_get_preferred_zoom_level_names (BonoboZoomableFrame *zoomable_frame) |
---|
575 | { |
---|
576 | CORBA_Environment ev; |
---|
577 | Bonobo_ZoomLevelNameList *zoom_level_names; |
---|
578 | GList *list = NULL; |
---|
579 | int i; |
---|
580 | |
---|
581 | g_return_val_if_fail (zoomable_frame != NULL, NULL); |
---|
582 | g_return_val_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame), NULL); |
---|
583 | |
---|
584 | CORBA_exception_init (&ev); |
---|
585 | |
---|
586 | zoom_level_names = Bonobo_Zoomable__get_preferredLevelNames ( |
---|
587 | zoomable_frame->priv->zoomable, &ev); |
---|
588 | |
---|
589 | if (BONOBO_EX (&ev)) { |
---|
590 | bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), |
---|
591 | zoomable_frame->priv->zoomable, &ev); |
---|
592 | CORBA_exception_free (&ev); |
---|
593 | return NULL; |
---|
594 | } |
---|
595 | CORBA_exception_free (&ev); |
---|
596 | |
---|
597 | if (zoom_level_names == CORBA_OBJECT_NIL) |
---|
598 | return NULL; |
---|
599 | |
---|
600 | for (i = 0; i < zoom_level_names->_length; i++) |
---|
601 | list = g_list_prepend (list, g_strdup (zoom_level_names->_buffer [i])); |
---|
602 | |
---|
603 | CORBA_free (zoom_level_names); |
---|
604 | |
---|
605 | return g_list_reverse (list); |
---|
606 | } |
---|
607 | |
---|
608 | void |
---|
609 | bonobo_zoomable_frame_set_zoom_level (BonoboZoomableFrame *zoomable_frame, float zoom_level) |
---|
610 | { |
---|
611 | CORBA_Environment ev; |
---|
612 | |
---|
613 | g_return_if_fail (zoomable_frame != NULL); |
---|
614 | g_return_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame)); |
---|
615 | |
---|
616 | CORBA_exception_init (&ev); |
---|
617 | Bonobo_Zoomable_setLevel (zoomable_frame->priv->zoomable, zoom_level, &ev); |
---|
618 | bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), |
---|
619 | zoomable_frame->priv->zoomable, &ev); |
---|
620 | CORBA_exception_free (&ev); |
---|
621 | } |
---|