4 #include <gtkmathview.h>
9 static GObjectClass* view_parent_class;
12 view_object_finalize(GObject* object)
14 View* view = VIEW(object);
16 view_parent_class->finalize(object);
21 impl_view_freeze(PortableServer_Servant servant,
22 CORBA_Environment *ev)
24 View* view = VIEW (bonobo_object (servant));
25 gtk_math_view_freeze(view->control_data->math_view);
30 impl_view_thaw(PortableServer_Servant servant,
31 CORBA_Environment *ev)
33 View* view = VIEW (bonobo_object (servant));
34 gtk_math_view_thaw(view->control_data->math_view);
39 impl_view_load(PortableServer_Servant servant,
40 const CORBA_char *uri,
41 CORBA_Environment *ev)
43 View* view = VIEW (bonobo_object (servant));
44 return gtk_math_view_load_uri(view->control_data->math_view, uri);
48 impl_view_unload(PortableServer_Servant servant,
49 CORBA_Environment *ev)
51 View* view = VIEW (bonobo_object (servant));
52 gtk_math_view_unload(view->control_data->math_view);
56 impl_view_setIdAttribute (PortableServer_Servant servant,
58 const CORBA_char *name,
59 CORBA_Environment *ev)
61 View* view = VIEW (bonobo_object (servant));
62 gtk_math_view_control_data_set_id_attribute(view->control_data, ns, name);
66 impl_view_getIdAttribute (PortableServer_Servant servant,
69 CORBA_Environment *ev)
71 View* view = VIEW (bonobo_object (servant));
72 if (view->control_data->id_ns_uri != NULL)
73 *ns = CORBA_string_dup(view->control_data->id_ns_uri->str);
77 if (view->control_data->id_name != NULL)
78 *name = CORBA_string_dup(view->control_data->id_name);
84 impl_view_select(PortableServer_Servant servant,
86 CORBA_Environment *ev)
88 View* view = VIEW (bonobo_object (servant));
89 GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view);
92 GdomeException exc = 0;
93 GdomeElement* el = find_element_by_id(root,
94 view->control_data->id_ns_uri,
95 view->control_data->id_name,
99 gtk_math_view_select(view->control_data->math_view, el);
100 gdome_el_unref(el, &exc);
103 gdome_el_unref(root, &exc);
109 impl_view_unselect(PortableServer_Servant servant,
110 const CORBA_char *id,
111 CORBA_Environment *ev)
113 View* view = VIEW (bonobo_object (servant));
114 GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view);
117 GdomeException exc = 0;
118 GdomeElement* el = find_element_by_id(root,
119 view->control_data->id_ns_uri,
120 view->control_data->id_name,
124 gtk_math_view_unselect(view->control_data->math_view, el);
125 gdome_el_unref(el, &exc);
128 gdome_el_unref(root, &exc);
134 impl_view_isSelected(PortableServer_Servant servant,
135 const CORBA_char *id,
136 CORBA_Environment *ev)
138 View* view = VIEW (bonobo_object (servant));
139 GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view);
140 CORBA_boolean res = CORBA_FALSE;
143 GdomeException exc = 0;
144 GdomeElement* el = find_element_by_id(root,
145 view->control_data->id_ns_uri,
146 view->control_data->id_name,
150 res = gtk_math_view_is_selected(view->control_data->math_view, el) ? CORBA_TRUE : CORBA_FALSE;
151 gdome_el_unref(el, &exc);
154 gdome_el_unref(root, &exc);
161 impl_view_elementCoords(PortableServer_Servant servant,
162 const CORBA_char *id,
163 CORBA_short *x, CORBA_short *y,
164 CORBA_Environment *ev)
166 View* view = VIEW (bonobo_object (servant));
167 GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view);
168 CORBA_boolean res = CORBA_FALSE;
171 GdomeException exc = 0;
172 GdomeElement* el = find_element_by_id(root,
173 view->control_data->id_ns_uri,
174 view->control_data->id_name,
180 res = gtk_math_view_get_element_coords(view->control_data->math_view, el, &xx, &yy) ? CORBA_TRUE : CORBA_FALSE;
181 gdome_el_unref(el, &exc);
186 gdome_el_unref(root, &exc);
193 impl_view_elementBoundingBox(PortableServer_Servant servant,
194 const CORBA_char *id,
195 CORBA_short *width, CORBA_short *height, CORBA_short *depth,
196 CORBA_Environment *ev)
198 View* view = VIEW (bonobo_object (servant));
199 GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view);
200 CORBA_boolean res = CORBA_FALSE;
203 GdomeException exc = 0;
204 GdomeElement* el = find_element_by_id(root,
205 view->control_data->id_ns_uri,
206 view->control_data->id_name,
213 res = gtk_math_view_get_element_coords(view->control_data->math_view, el, &w, &h, &d) ? CORBA_TRUE : CORBA_FALSE;
214 gdome_el_unref(el, &exc);
220 gdome_el_unref(root, &exc);
227 impl_view_getSize(PortableServer_Servant servant,
228 CORBA_short *width, CORBA_short *height,
229 CORBA_Environment *ev)
231 View* view = VIEW (bonobo_object (servant));
232 *width = gtk_math_view_get_width(view->control_data->math_view);
233 *height = gtk_math_view_get_height(view->control_data->math_view);
237 impl_view_getTop(PortableServer_Servant servant,
238 CORBA_short *x, CORBA_short *y,
239 CORBA_Environment *ev)
241 View* view = VIEW (bonobo_object (servant));
244 gtk_math_view_get_top(view->control_data->math_view, &xx, &yy);
250 impl_view_setTop (PortableServer_Servant servant,
251 CORBA_short x, CORBA_short y,
252 CORBA_Environment *ev)
254 View* view = VIEW (bonobo_object (servant));
255 gtk_math_view_set_top(view->control_data->math_view, x, y);
259 impl_view_setDefaultFontSize(PortableServer_Servant servant,
261 CORBA_Environment *ev)
263 View* view = VIEW (bonobo_object (servant));
264 gtk_math_view_set_font_size(view->control_data->math_view, size);
268 impl_view_getDefaultFontSize(PortableServer_Servant servant,
269 CORBA_Environment *ev)
271 View* view = VIEW (bonobo_object (servant));
272 return gtk_math_view_get_font_size(view->control_data->math_view);
276 impl_view_setVerbosity(PortableServer_Servant servant,
277 const CORBA_short level,
278 CORBA_Environment *ev)
280 View* view = VIEW (bonobo_object (servant));
281 gtk_math_view_set_log_verbosity(view->control_data->math_view, level);
285 impl_view_getVerbosity(PortableServer_Servant servant,
286 CORBA_Environment *ev)
288 View* view = VIEW (bonobo_object (servant));
289 return gtk_math_view_get_log_verbosity(view->control_data->math_view);
293 view_class_init(ViewClass* klass)
295 GObjectClass* object_class = (GObjectClass *) klass;
296 POA_GNOME_GtkMathView_View__epv* epv = &klass->epv;
298 view_parent_class = g_type_class_peek_parent (klass);
299 object_class->finalize = view_object_finalize;
301 epv->freeze = impl_view_freeze;
302 epv->thaw = impl_view_thaw;
303 epv->load = impl_view_load;
304 epv->unload = impl_view_unload;
305 epv->setIdAttribute = impl_view_setIdAttribute;
306 epv->getIdAttribute = impl_view_getIdAttribute;
307 epv->select = impl_view_select;
308 epv->unselect = impl_view_unselect;
309 epv->isSelected = impl_view_isSelected;
310 epv->elementCoords = impl_view_elementCoords;
311 epv->elementBoundingBox = impl_view_elementBoundingBox;
312 epv->getSize = impl_view_getSize;
313 epv->getTop = impl_view_getTop;
314 epv->setTop = impl_view_setTop;
315 epv->setDefaultFontSize = impl_view_setDefaultFontSize;
316 epv->getDefaultFontSize = impl_view_getDefaultFontSize;
317 epv->setVerbosity = impl_view_setVerbosity;
318 epv->getVerbosity = impl_view_getVerbosity;
322 view_init(View* view)
324 /* do some initialization */
327 BONOBO_TYPE_FUNC_FULL (View, GNOME_GtkMathView_View, BONOBO_TYPE_OBJECT, view)
330 view_new(GtkMathViewControlData* control_data)
333 g_return_val_if_fail(control_data != NULL, NULL);
334 view = g_object_new(VIEW_TYPE, NULL);
335 view->control_data = control_data;