5 #include <gtkmathview.h>
10 static GObjectClass* view_parent_class;
13 view_object_finalize(GObject* object)
15 View* view = VIEW(object);
17 view_parent_class->finalize(object);
22 impl_view_freeze(PortableServer_Servant servant,
23 CORBA_Environment *ev)
25 View* view = VIEW (bonobo_object (servant));
26 gtk_math_view_freeze(view->control_data->math_view);
31 impl_view_thaw(PortableServer_Servant servant,
32 CORBA_Environment *ev)
34 View* view = VIEW (bonobo_object (servant));
35 gtk_math_view_thaw(view->control_data->math_view);
40 impl_view_load(PortableServer_Servant servant,
41 const CORBA_char *uri,
42 CORBA_Environment *ev)
44 View* view = VIEW (bonobo_object (servant));
45 return gtk_math_view_load_uri(view->control_data->math_view, uri);
49 impl_view_unload(PortableServer_Servant servant,
50 CORBA_Environment *ev)
52 View* view = VIEW (bonobo_object (servant));
53 gtk_math_view_unload(view->control_data->math_view);
57 impl_view_setIdAttribute (PortableServer_Servant servant,
59 const CORBA_char *name,
60 CORBA_Environment *ev)
62 View* view = VIEW (bonobo_object (servant));
63 gtk_math_view_control_data_set_id_attribute(view->control_data, ns, name);
67 impl_view_getIdAttribute (PortableServer_Servant servant,
70 CORBA_Environment *ev)
72 View* view = VIEW (bonobo_object (servant));
73 if (view->control_data->id_ns_uri != NULL)
74 *ns = CORBA_string_dup(view->control_data->id_ns_uri->str);
78 if (view->control_data->id_name != NULL)
79 *name = CORBA_string_dup(view->control_data->id_name);
85 impl_view_select(PortableServer_Servant servant,
87 CORBA_Environment *ev)
89 View* view = VIEW (bonobo_object (servant));
90 GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view);
93 GdomeException exc = 0;
94 GdomeElement* el = find_element_by_id(root,
95 view->control_data->id_ns_uri,
96 view->control_data->id_name,
100 gtk_math_view_select(view->control_data->math_view, el);
101 gdome_el_unref(el, &exc);
104 gdome_el_unref(root, &exc);
110 impl_view_unselect(PortableServer_Servant servant,
111 const CORBA_char *id,
112 CORBA_Environment *ev)
114 View* view = VIEW (bonobo_object (servant));
115 GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view);
118 GdomeException exc = 0;
119 GdomeElement* el = find_element_by_id(root,
120 view->control_data->id_ns_uri,
121 view->control_data->id_name,
125 gtk_math_view_unselect(view->control_data->math_view, el);
126 gdome_el_unref(el, &exc);
129 gdome_el_unref(root, &exc);
135 impl_view_isSelected(PortableServer_Servant servant,
136 const CORBA_char *id,
137 CORBA_Environment *ev)
139 View* view = VIEW (bonobo_object (servant));
140 GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view);
141 CORBA_boolean res = CORBA_FALSE;
144 GdomeException exc = 0;
145 GdomeElement* el = find_element_by_id(root,
146 view->control_data->id_ns_uri,
147 view->control_data->id_name,
151 res = gtk_math_view_is_selected(view->control_data->math_view, el) ? CORBA_TRUE : CORBA_FALSE;
152 gdome_el_unref(el, &exc);
155 gdome_el_unref(root, &exc);
162 impl_view_elementCoords(PortableServer_Servant servant,
163 const CORBA_char *id,
164 CORBA_short *x, CORBA_short *y,
165 CORBA_Environment *ev)
167 View* view = VIEW (bonobo_object (servant));
168 GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view);
169 CORBA_boolean res = CORBA_FALSE;
172 GdomeException exc = 0;
173 GdomeElement* el = find_element_by_id(root,
174 view->control_data->id_ns_uri,
175 view->control_data->id_name,
181 res = gtk_math_view_get_element_coords(view->control_data->math_view, el, &xx, &yy) ? CORBA_TRUE : CORBA_FALSE;
182 gdome_el_unref(el, &exc);
187 gdome_el_unref(root, &exc);
194 impl_view_elementBoundingBox(PortableServer_Servant servant,
195 const CORBA_char *id,
196 CORBA_short *width, CORBA_short *height, CORBA_short *depth,
197 CORBA_Environment *ev)
199 View* view = VIEW (bonobo_object (servant));
200 GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view);
201 CORBA_boolean res = CORBA_FALSE;
204 GdomeException exc = 0;
205 GdomeElement* el = find_element_by_id(root,
206 view->control_data->id_ns_uri,
207 view->control_data->id_name,
214 res = gtk_math_view_get_element_bounding_box(view->control_data->math_view, el, &w, &h, &d) ? CORBA_TRUE : CORBA_FALSE;
215 gdome_el_unref(el, &exc);
221 gdome_el_unref(root, &exc);
228 impl_view_getSize(PortableServer_Servant servant,
229 CORBA_short *width, CORBA_short *height,
230 CORBA_Environment *ev)
232 View* view = VIEW (bonobo_object (servant));
233 *width = gtk_math_view_get_width(view->control_data->math_view);
234 *height = gtk_math_view_get_height(view->control_data->math_view);
238 impl_view_getTop(PortableServer_Servant servant,
239 CORBA_short *x, CORBA_short *y,
240 CORBA_Environment *ev)
242 View* view = VIEW (bonobo_object (servant));
245 gtk_math_view_get_top(view->control_data->math_view, &xx, &yy);
251 impl_view_setTop (PortableServer_Servant servant,
252 CORBA_short x, CORBA_short y,
253 CORBA_Environment *ev)
255 View* view = VIEW (bonobo_object (servant));
256 gtk_math_view_set_top(view->control_data->math_view, x, y);
260 impl_view_setDefaultFontSize(PortableServer_Servant servant,
262 CORBA_Environment *ev)
264 View* view = VIEW (bonobo_object (servant));
265 gtk_math_view_set_font_size(view->control_data->math_view, size);
269 impl_view_getDefaultFontSize(PortableServer_Servant servant,
270 CORBA_Environment *ev)
272 View* view = VIEW (bonobo_object (servant));
273 return gtk_math_view_get_font_size(view->control_data->math_view);
277 impl_view_setVerbosity(PortableServer_Servant servant,
278 const CORBA_short level,
279 CORBA_Environment *ev)
281 View* view = VIEW (bonobo_object (servant));
282 gtk_math_view_set_log_verbosity(view->control_data->math_view, level);
286 impl_view_getVerbosity(PortableServer_Servant servant,
287 CORBA_Environment *ev)
289 View* view = VIEW (bonobo_object (servant));
290 return gtk_math_view_get_log_verbosity(view->control_data->math_view);
294 view_class_init(ViewClass* klass)
296 GObjectClass* object_class = (GObjectClass *) klass;
297 POA_GNOME_GtkMathView_View__epv* epv = &klass->epv;
299 view_parent_class = g_type_class_peek_parent (klass);
300 object_class->finalize = view_object_finalize;
302 epv->freeze = impl_view_freeze;
303 epv->thaw = impl_view_thaw;
304 epv->load = impl_view_load;
305 epv->unload = impl_view_unload;
306 epv->setIdAttribute = impl_view_setIdAttribute;
307 epv->getIdAttribute = impl_view_getIdAttribute;
308 epv->select = impl_view_select;
309 epv->unselect = impl_view_unselect;
310 epv->isSelected = impl_view_isSelected;
311 epv->elementCoords = impl_view_elementCoords;
312 epv->elementBoundingBox = impl_view_elementBoundingBox;
313 epv->getSize = impl_view_getSize;
314 epv->getTop = impl_view_getTop;
315 epv->setTop = impl_view_setTop;
316 epv->setDefaultFontSize = impl_view_setDefaultFontSize;
317 epv->getDefaultFontSize = impl_view_getDefaultFontSize;
318 epv->setVerbosity = impl_view_setVerbosity;
319 epv->getVerbosity = impl_view_getVerbosity;
323 view_init(View* view)
325 /* do some initialization */
328 BONOBO_TYPE_FUNC_FULL (View, GNOME_GtkMathView_View, BONOBO_TYPE_OBJECT, view)
331 view_new(GtkMathViewControlData* control_data)
334 g_return_val_if_fail(control_data != NULL, NULL);
335 view = g_object_new(VIEW_TYPE, NULL);
336 view->control_data = control_data;