comparison src/graphics.h.in @ 6874:94bda6abc224

[project @ 2007-09-06 21:34:24 by jwe]
author jwe
date Thu, 06 Sep 2007 21:34:24 +0000
parents
children b2b7526a5772
comparison
equal deleted inserted replaced
6873:e03d52dc3d12 6874:94bda6abc224
1 /*
2
3 Copyright (C) 2007 John W. Eaton
4
5 This file is part of Octave.
6
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
10 later version.
11
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, write to the Free
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 02110-1301, USA.
21
22 */
23
24 #if !defined (graphics_h)
25 #define graphics_h 1
26
27 #ifdef HAVE_CONFIG_H
28 #include <config.h>
29 #endif
30
31 #include <cctype>
32
33 #include <algorithm>
34 #include <list>
35 #include <map>
36 #include <set>
37 #include <string>
38
39 #include "oct-map.h"
40 #include "ov.h"
41
42 class
43 radio_values
44 {
45 public:
46 radio_values (const std::string& opt_string = std::string ());
47 radio_values (const radio_values& a)
48 : default_val (a.default_val), possible_vals (a.possible_vals) { }
49
50 radio_values& operator = (const radio_values& a)
51 {
52 if (&a != this)
53 {
54 default_val = a.default_val;
55 possible_vals = a.possible_vals;
56 }
57
58 return *this;
59 }
60
61 std::string default_value (void) const { return default_val; }
62
63 std::set<std::string> possible_values (void) const { return possible_vals; }
64
65 bool validate (const std::string& val)
66 {
67 bool retval = true;
68
69 if (possible_vals.find (val) == possible_vals.end ())
70 {
71 error ("invalid value = %s", val.c_str ());
72 retval = false;
73 }
74
75 return retval;
76 }
77
78 private:
79 // Might also want to cache
80 std::string default_val;
81 std::set<std::string> possible_vals;
82 };
83
84 class
85 radio_property
86 {
87 public:
88 radio_property (const radio_values& v)
89 : vals (v), current_val (v.default_value ()) { }
90
91 radio_property (const radio_values& v, const std::string& initial_value)
92 : vals (v), current_val (initial_value) { }
93
94 radio_property (const radio_property& a)
95 : vals (a.vals), current_val (a.current_val) { }
96
97 radio_property& operator = (const radio_property& a)
98 {
99 if (&a != this)
100 {
101 vals = a.vals;
102 current_val = a.current_val;
103 }
104
105 return *this;
106 }
107
108 radio_property& operator = (const std::string& newval)
109 {
110 if (vals.validate (newval))
111 current_val = newval;
112
113 return *this;
114 }
115
116 const std::string& current_value (void) const { return current_val; }
117
118 private:
119 radio_values vals;
120 std::string current_val;
121 };
122
123 class
124 color_values
125 {
126 public:
127 color_values (double r = 0, double g = 0, double b = 1)
128 {
129 xrgb[0] = r;
130 xrgb[1] = g;
131 xrgb[2] = b;
132
133 validate ();
134 }
135
136 color_values (std::string str)
137 {
138 if (! str2rgb (str))
139 error ("invalid color specification");
140 }
141
142 color_values (const color_values& c)
143 {
144 xrgb[0] = c.xrgb[0];
145 xrgb[1] = c.xrgb[1];
146 xrgb[2] = c.xrgb[2];
147 }
148
149 color_values& operator = (const color_values& c)
150 {
151 if (&c != this)
152 {
153 xrgb[0] = c.xrgb[0];
154 xrgb[1] = c.xrgb[1];
155 xrgb[2] = c.xrgb[2];
156
157 }
158
159 return *this;
160 }
161
162 const double* rgb (void) const { return xrgb; }
163
164 void validate (void) const
165 {
166 for (int i = 0; i < 3; i++)
167 {
168 if (xrgb[i] < 0 || xrgb[i] > 1)
169 {
170 error ("invalid RGB color specification");
171 break;
172 }
173 }
174 }
175
176 private:
177 double xrgb[3];
178
179 bool str2rgb (std::string str);
180 };
181
182
183 class
184 color_property
185 {
186 public:
187 color_property (const color_values& c = color_values (),
188 const radio_values& v = radio_values ())
189 : current_type (color_t), color_val (c), radio_val (v),
190 current_val (v.default_value ())
191 { }
192
193 color_property (const radio_values& v)
194 : current_type (radio_t), color_val (color_values ()), radio_val (v),
195 current_val (v.default_value ())
196 { }
197
198 color_property (const radio_values& v, const std::string& initial_value)
199 : current_type (radio_t), color_val (color_values ()), radio_val (v),
200 current_val (initial_value)
201 { }
202
203 color_property (const octave_value& val);
204
205 operator octave_value (void) const
206 {
207 if (current_type == color_t)
208 {
209 Matrix retval (1, 3);
210 const double *xrgb = color_val.rgb ();
211
212 for (int i = 0; i < 3 ; i++)
213 retval(i) = xrgb[i];
214
215 return retval;
216 }
217
218 return current_val;
219 }
220
221 color_property& operator = (const color_property& a)
222 {
223 if (&a != this)
224 {
225 current_type = a.current_type;
226 color_val = a.color_val;
227 radio_val = a.radio_val;
228 current_val = a.current_val;
229 }
230
231 return *this;
232 }
233
234 color_property& operator = (const std::string& newval)
235 {
236 if (radio_val.validate (newval))
237 {
238 current_val = newval;
239 current_type = radio_t;
240 }
241
242 return *this;
243 }
244
245 color_property& operator = (const color_values& newval)
246 {
247 color_val = newval;
248 current_type = color_t;
249
250 return *this;
251 }
252
253 color_property& operator = (const octave_value& newval);
254
255 bool is_rgb (void) const { return (current_type == color_t); }
256
257 bool is_radio (void) const { return (current_type == radio_t); }
258
259 const double* rgb (void) const
260 {
261 if (current_type != color_t)
262 error ("color has no rgb value");
263
264 return color_val.rgb ();
265 }
266
267 const std::string& current_value (void) const
268 {
269 if (current_type != radio_t)
270 error ("color has no radio value");
271
272 return current_val;
273 }
274
275 private:
276 enum current_enum { color_t, radio_t } current_type;
277 color_values color_val;
278 radio_values radio_val;
279 std::string current_val;
280 };
281
282 class
283 colormap_property
284 {
285 public:
286 colormap_property (const Matrix& m = Matrix ())
287 : cmap (m)
288 {
289 if (cmap.is_empty ())
290 {
291 cmap = Matrix (64, 3);
292
293 for (octave_idx_type i = 0; i < 64; i++)
294 cmap(i,0) = cmap(i,1) = cmap(i,2) = i / 64.0;
295 }
296
297 validate ();
298 }
299
300 colormap_property (const octave_value& val)
301 {
302 cmap = val.matrix_value ();
303
304 validate ();
305 }
306
307 void validate (void) const
308 {
309 if (error_state || cmap.columns () != 3)
310 error ("invalid colormap specification");
311 }
312
313 operator octave_value (void) const { return cmap; }
314
315 private:
316 Matrix cmap;
317 };
318
319 // ---------------------------------------------------------------------
320
321 class property_name : public std::string
322 {
323 public:
324 typedef std::string::iterator iterator;
325 typedef std::string::const_iterator const_iterator;
326
327 property_name (void) : std::string () { }
328 property_name (const std::string& s) : std::string (s) { }
329 property_name (const char *s) : std::string (s) { }
330
331 property_name (const property_name& name) : std::string (name) { }
332
333 property_name& operator = (const property_name& pname)
334 {
335 std::string::operator = (pname);
336 return *this;
337 }
338
339 operator std::string (void) const { return *this; }
340
341 // Case-insensitive comparison.
342 bool compare (const std::string& s, size_t limit = NPOS) const
343 {
344 const_iterator p1 = begin ();
345 const_iterator p2 = s.begin ();
346
347 size_t k = 0;
348
349 while (p1 != end () && p2 != s.end () && k++ < limit)
350 {
351 if (std::tolower (*p1) != std::tolower (*p2))
352 return false;
353
354 *p1++;
355 *p2++;
356 }
357
358 return (limit == NPOS) ? size () == s.size () : k == limit;
359 }
360 };
361
362 // ---------------------------------------------------------------------
363
364 class property_list
365 {
366 public:
367 typedef std::map<std::string, octave_value> pval_map_type;
368 typedef std::map<std::string, pval_map_type> plist_map_type;
369
370 typedef pval_map_type::iterator pval_map_iterator;
371 typedef pval_map_type::const_iterator pval_map_const_iterator;
372
373 typedef plist_map_type::iterator plist_map_iterator;
374 typedef plist_map_type::const_iterator plist_map_const_iterator;
375
376 property_list (const plist_map_type& m = plist_map_type ())
377 : plist_map (m) { }
378
379 ~property_list (void) { }
380
381 void set (const property_name& name, const octave_value& val);
382
383 octave_value lookup (const property_name& name) const;
384
385 plist_map_iterator begin (void) { return plist_map.begin (); }
386 plist_map_const_iterator begin (void) const { return plist_map.begin (); }
387
388 plist_map_iterator end (void) { return plist_map.end (); }
389 plist_map_const_iterator end (void) const { return plist_map.end (); }
390
391 plist_map_iterator find (const std::string& go_name)
392 {
393 return plist_map.find (go_name);
394 }
395
396 plist_map_const_iterator find (const std::string& go_name) const
397 {
398 return plist_map.find (go_name);
399 }
400
401 Octave_map as_struct (const std::string& prefix_arg) const;
402
403 private:
404 plist_map_type plist_map;
405 };
406
407 // ---------------------------------------------------------------------
408
409 class graphics_handle
410 {
411 public:
412 graphics_handle (void) : val (octave_NaN) { }
413
414 graphics_handle (const octave_value& a);
415
416 graphics_handle (int a) : val (a) { }
417
418 graphics_handle (double a) : val (a) { }
419
420 graphics_handle (const graphics_handle& a) : val (a.val) { }
421
422 graphics_handle& operator = (const graphics_handle& a)
423 {
424 if (&a != this)
425 val = a.val;
426
427 return *this;
428 }
429
430 ~graphics_handle (void) { }
431
432 operator double (void) const { return val; }
433
434 double value (void) const { return val; }
435
436 octave_value as_octave_value (void) const
437 {
438 return ok () ? octave_value (val) : octave_value (Matrix ());
439 }
440
441 graphics_handle operator ++ (void)
442 {
443 ++val;
444 return *this;
445 }
446
447 graphics_handle operator ++ (int)
448 {
449 graphics_handle h = *this;
450 ++val;
451 return h;
452 }
453
454 graphics_handle operator -- (void)
455 {
456 --val;
457 return *this;
458 }
459
460 graphics_handle operator -- (int)
461 {
462 graphics_handle h = *this;
463 --val;
464 return h;
465 }
466
467 bool ok (void) const { return ! xisnan (val); }
468
469 operator bool () const { return ok (); }
470
471 private:
472 double val;
473 };
474
475 inline bool
476 operator == (const graphics_handle& a, const graphics_handle& b)
477 {
478 return a.value () == b.value ();
479 }
480
481 inline bool
482 operator != (const graphics_handle& a, const graphics_handle& b)
483 {
484 return a.value () != b.value ();
485 }
486
487 inline bool
488 operator < (const graphics_handle& a, const graphics_handle& b)
489 {
490 return a.value () < b.value ();
491 }
492
493 inline bool
494 operator <= (const graphics_handle& a, const graphics_handle& b)
495 {
496 return a.value () <= b.value ();
497 }
498
499 inline bool
500 operator >= (const graphics_handle& a, const graphics_handle& b)
501 {
502 return a.value () >= b.value ();
503 }
504
505 inline bool
506 operator > (const graphics_handle& a, const graphics_handle& b)
507 {
508 return a.value () > b.value ();
509 }
510
511 // ---------------------------------------------------------------------
512
513 class base_graphics_object;
514
515 class base_properties
516 {
517 public:
518 base_properties (const std::string& t = "unknown",
519 const graphics_handle& mh = graphics_handle (),
520 const graphics_handle& p = graphics_handle ())
521 : type (t), __modified__ (true), __myhandle__ (mh), parent (p),
522 children () { }
523
524 virtual ~base_properties (void) { }
525
526 virtual std::string graphics_object_name (void) const { return "unknonwn"; }
527
528 void mark_modified (void);
529
530 void override_defaults (base_graphics_object& obj);
531
532 // Look through DEFAULTS for properties with given CLASS_NAME, and
533 // apply them to the current object with set (virtual method).
534
535 void set_from_list (base_graphics_object& obj, property_list& defaults);
536
537 virtual void set (const property_name&, const octave_value&) { }
538
539 graphics_handle get_parent (void) const { return parent; }
540
541 void remove_child (const graphics_handle& h);
542
543 void adopt (const graphics_handle& h)
544 {
545 octave_idx_type n = children.numel ();
546 children.resize (1, n+1);
547 children(n) = h;
548 }
549
550 void set_parent (const octave_value& val);
551
552 void reparent (const graphics_handle& new_parent) { parent = new_parent; }
553
554 virtual void delete_children (void);
555
556 protected:
557 std::string type;
558 bool __modified__;
559 graphics_handle __myhandle__;
560 graphics_handle parent;
561 Matrix children;
562 };
563
564 class base_graphics_object
565 {
566 public:
567 friend class graphics_object;
568
569 base_graphics_object (void) : count (1) { }
570
571 base_graphics_object (const base_graphics_object&) { }
572
573 virtual ~base_graphics_object (void) { }
574
575 virtual void mark_modified (void)
576 {
577 error ("base_graphics_object::mark_modified: invalid graphics object");
578 }
579
580 virtual void override_defaults (base_graphics_object&)
581 {
582 error ("base_graphics_object::override_defaults: invalid graphics object");
583 }
584
585 virtual void set_from_list (property_list&)
586 {
587 error ("base_graphics_object::set_from_list: invalid graphics object");
588 }
589
590 virtual void set (const property_name&, const octave_value&)
591 {
592 error ("base_graphics_object::set: invalid graphics object");
593 }
594
595 virtual void set_defaults (const std::string&)
596 {
597 error ("base_graphics_object::set_defaults: invalid graphics object");
598 }
599
600 virtual octave_value get (void) const
601 {
602 error ("base_graphics_object::get: invalid graphics object");
603 return octave_value ();
604 }
605
606 virtual octave_value get (const property_name&) const
607 {
608 error ("base_graphics_object::get: invalid graphics object");
609 return octave_value ();
610 }
611
612 virtual octave_value get_default (const property_name&) const;
613
614 virtual octave_value get_factory_default (const property_name&) const;
615
616 virtual octave_value get_defaults (void) const
617 {
618 error ("base_graphics_object::get_defaults: invalid graphics object");
619 return octave_value ();
620 }
621
622 virtual octave_value get_factory_defaults (void) const
623 {
624 error ("base_graphics_object::get_factory_defaults: invalid graphics object");
625 return octave_value ();
626 }
627
628 virtual graphics_handle get_parent (void) const
629 {
630 error ("base_graphics_object::get_parent: invalid graphics object");
631 return graphics_handle ();
632 }
633
634 virtual void remove_child (const graphics_handle&)
635 {
636 error ("base_graphics_object::remove_child: invalid graphics object");
637 }
638
639 virtual void adopt (const graphics_handle&)
640 {
641 error ("base_graphics_object::adopt: invalid graphics object");
642 }
643
644 virtual void reparent (const graphics_handle&)
645 {
646 error ("base_graphics_object::reparent: invalid graphics object");
647 }
648
649 virtual void defaults (void) const
650 {
651 error ("base_graphics_object::default: invalid graphics object");
652 }
653
654 virtual base_properties& get_properties (void)
655 {
656 static base_properties properties;
657 error ("base_graphics_object::get_properties: invalid graphics object");
658 return properties;
659 }
660
661 virtual bool valid_object (void) const { return false; }
662
663 virtual std::string type (void) const { return "unknown"; }
664
665 bool isa (const std::string& go_name) const
666 {
667 return type () == go_name;
668 }
669
670 protected:
671 // A reference count.
672 int count;
673 };
674
675 class graphics_object
676 {
677 public:
678 graphics_object (void) : rep (new base_graphics_object ()) { }
679
680 graphics_object (base_graphics_object *new_rep)
681 : rep (new_rep) { }
682
683 graphics_object (const graphics_object& obj)
684 {
685 rep = obj.rep;
686 rep->count++;
687 }
688
689 graphics_object& operator = (const graphics_object& obj)
690 {
691 if (rep != obj.rep)
692 {
693 if (--rep->count == 0)
694 delete rep;
695
696 rep = obj.rep;
697 rep->count++;
698 }
699
700 return *this;
701 }
702
703 ~graphics_object (void)
704 {
705 if (--rep->count == 0)
706 delete rep;
707 }
708
709 void mark_modified (void) { rep->mark_modified (); }
710
711 void override_defaults (base_graphics_object& obj)
712 {
713 rep->override_defaults (obj);
714 }
715
716 void set_from_list (property_list& plist)
717 {
718 rep->set_from_list (plist);
719 }
720
721 void set (const property_name& name, const octave_value& val)
722 {
723 rep->set (name, val);
724 }
725
726 void set (const octave_value_list& args);
727
728 void set_defaults (const std::string& mode)
729 {
730 rep->set_defaults (mode);
731 }
732
733 octave_value get (void) const
734 {
735 return rep->get ();
736 }
737
738 octave_value get (const property_name& name) const
739 {
740 return name.compare ("default")
741 ? get_defaults ()
742 : (name.compare ("factory")
743 ? get_factory_defaults () : rep->get (name));
744 }
745
746 octave_value get_default (const property_name& name) const
747 {
748 return rep->get_default (name);
749 }
750
751 octave_value get_factory_default (const property_name& name) const
752 {
753 return rep->get_factory_default (name);
754 }
755
756 octave_value get_defaults (void) const { return rep->get_defaults (); }
757
758 octave_value get_factory_defaults (void) const
759 {
760 return rep->get_factory_defaults ();
761 }
762
763 graphics_handle get_parent (void) const { return rep->get_parent (); }
764
765 void remove_child (const graphics_handle& h) { return rep->remove_child (h); }
766
767 void adopt (const graphics_handle& h) { return rep->adopt (h); }
768
769 void reparent (const graphics_handle& h) { return rep->reparent (h); }
770
771 void defaults (void) const { rep->defaults (); }
772
773 bool isa (const std::string& go_name) const { return rep->isa (go_name); }
774
775 base_properties& get_properties (void) { return rep->get_properties (); }
776
777 bool valid_object (void) const { return rep->valid_object (); }
778
779 operator bool (void) const { return rep->valid_object (); }
780
781 private:
782 base_graphics_object *rep;
783 };
784
785 // ---------------------------------------------------------------------
786
787 class root_figure : public base_graphics_object
788 {
789 public:
790 class properties : public base_properties
791 {
792 public:
793 properties (void)
794 : base_properties ("root figure", 0, graphics_handle ()),
795 currentfigure (),
796 visible ("on")
797 { }
798
799 ~properties (void) { }
800
801 void set (const property_name& name, const octave_value& val);
802
803 octave_value get (void) const;
804
805 octave_value get (const property_name& name) const;
806
807 std::string graphics_object_name (void) const { return go_name; }
808
809 // See the genprops.awk script for an explanation of the
810 // properties declarations.
811
812 BEGIN_PROPERTIES
813 graphics_handle currentfigure S
814 octave_value visible
815 END_PROPERTIES
816
817 static std::string go_name;
818 };
819
820 private:
821 properties xproperties;
822
823 public:
824
825 root_figure (void) : xproperties (), default_properties () { }
826
827 ~root_figure (void) { xproperties.delete_children (); }
828
829 std::string type (void) const { return xproperties.graphics_object_name (); }
830
831 void mark_modified (void) { }
832
833 void override_defaults (base_graphics_object& obj)
834 {
835 // Now override with our defaults. If the default_properties
836 // list includes the properties for all defaults (line,
837 // surface, etc.) then we don't have to know the type of OBJ
838 // here, we just call its set function and let it decide which
839 // properties from the list to use.
840 obj.set_from_list (default_properties);
841 }
842
843 void set_from_list (property_list& plist)
844 {
845 xproperties.set_from_list (*this, plist);
846 }
847
848 void set (const property_name& name, const octave_value& value)
849 {
850 if (name.compare ("default", 7))
851 // strip "default", pass rest to function that will
852 // parse the remainder and add the element to the
853 // default_properties map.
854 default_properties.set (name.substr (7), value);
855 else
856 xproperties.set (name, value);
857 }
858
859 octave_value get (void) const
860 {
861 return xproperties.get ();
862 }
863
864 octave_value get (const property_name& name) const
865 {
866 octave_value retval;
867
868 if (name.compare ("default", 7))
869 return get_default (name.substr (7));
870 else if (name.compare ("factory", 7))
871 return get_factory_default (name.substr (7));
872 else
873 retval = xproperties.get (name);
874
875 return retval;
876 }
877
878 octave_value get_default (const property_name& name) const
879 {
880 octave_value retval = default_properties.lookup (name);
881
882 if (retval.is_undefined ())
883 error ("get: invalid default property `%s'", name.c_str ());
884
885 return retval;
886 }
887
888 octave_value get_factory_default (const property_name& name) const
889 {
890 octave_value retval = factory_properties.lookup (name);
891
892 if (retval.is_undefined ())
893 error ("get: invalid factory default property `%s'", name.c_str ());
894
895 return retval;
896 }
897
898 octave_value get_defaults (void) const
899 {
900 return default_properties.as_struct ("default");
901 }
902
903 octave_value get_factory_defaults (void) const
904 {
905 return factory_properties.as_struct ("factory");
906 }
907
908 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
909
910 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
911
912 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
913
914 void reparent (const graphics_handle& np) { xproperties.reparent (np); }
915
916 base_properties& get_properties (void) { return xproperties; }
917
918 bool valid_object (void) const { return true; }
919
920 private:
921 property_list default_properties;
922
923 static property_list factory_properties;
924
925 static property_list::plist_map_type init_factory_properties (void);
926 };
927
928 // ---------------------------------------------------------------------
929
930 class figure : public base_graphics_object
931 {
932 public:
933 class properties : public base_properties
934 {
935 public:
936 properties (const graphics_handle& mh, const graphics_handle& p);
937
938 ~properties (void) { }
939
940 void set (const property_name& name, const octave_value& val);
941
942 octave_value get (void) const;
943
944 octave_value get (const property_name& name) const;
945
946 void close (void);
947
948 std::string graphics_object_name (void) const { return go_name; }
949
950 static property_list::pval_map_type factory_defaults (void);
951
952 // See the genprops.awk script for an explanation of the
953 // properties declarations.
954
955 BEGIN_PROPERTIES
956 octave_value __plot_stream__
957 octave_value nextplot
958 octave_value closerequestfcn
959 graphics_handle currentaxes S
960 colormap_property colormap
961 octave_value visible S
962 octave_value paperorientation
963 END_PROPERTIES
964
965 static std::string go_name;
966 };
967
968 private:
969 properties xproperties;
970
971 public:
972 figure (const graphics_handle& mh, const graphics_handle& p)
973 : base_graphics_object (), xproperties (mh, p), default_properties ()
974 {
975 xproperties.override_defaults (*this);
976 }
977
978 ~figure (void)
979 {
980 xproperties.delete_children ();
981 xproperties.close ();
982 }
983
984 std::string type (void) const { return xproperties.graphics_object_name (); }
985
986 void mark_modified (void) { xproperties.mark_modified (); }
987
988 void override_defaults (base_graphics_object& obj)
989 {
990 // Allow parent (root figure) to override first (properties knows how
991 // to find the parent object).
992 xproperties.override_defaults (obj);
993
994 // Now override with our defaults. If the default_properties
995 // list includes the properties for all defaults (line,
996 // surface, etc.) then we don't have to know the type of OBJ
997 // here, we just call its set function and let it decide which
998 // properties from the list to use.
999 obj.set_from_list (default_properties);
1000 }
1001
1002 void set_from_list (property_list& plist)
1003 {
1004 xproperties.set_from_list (*this, plist);
1005 }
1006
1007 void set (const property_name& name, const octave_value& value)
1008 {
1009 if (name.compare ("default", 7))
1010 // strip "default", pass rest to function that will
1011 // parse the remainder and add the element to the
1012 // default_properties map.
1013 default_properties.set (name.substr (7), value);
1014 else
1015 xproperties.set (name, value);
1016 }
1017
1018 octave_value get (void) const
1019 {
1020 return xproperties.get ();
1021 }
1022
1023 octave_value get (const property_name& name) const
1024 {
1025 octave_value retval;
1026
1027 if (name.compare ("default", 7))
1028 retval = get_default (name.substr (7));
1029 else
1030 retval = xproperties.get (name);
1031
1032 return retval;
1033 }
1034
1035 octave_value get_default (const property_name& name) const;
1036
1037 octave_value get_defaults (void) const
1038 {
1039 return default_properties.as_struct ("default");
1040 }
1041
1042 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
1043
1044 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
1045
1046 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
1047
1048 void reparent (const graphics_handle& np) { xproperties.reparent (np); }
1049
1050 base_properties& get_properties (void) { return xproperties; }
1051
1052 bool valid_object (void) const { return true; }
1053
1054 private:
1055 property_list default_properties;
1056 };
1057
1058 // ---------------------------------------------------------------------
1059
1060 class axes : public base_graphics_object
1061 {
1062 public:
1063 class properties : public base_properties
1064 {
1065 public:
1066 properties (const graphics_handle& mh, const graphics_handle& p);
1067
1068 ~properties (void) { }
1069
1070 void set (const property_name& name, const octave_value& val);
1071
1072 void set_defaults (base_graphics_object& obj, const std::string& mode);
1073
1074 octave_value get (void) const;
1075
1076 octave_value get (const property_name& name) const;
1077
1078 void remove_child (const graphics_handle& h);
1079
1080 void delete_children (void);
1081
1082 std::string graphics_object_name (void) const { return go_name; }
1083
1084 static property_list::pval_map_type factory_defaults (void);
1085
1086 // See the genprops.awk script for an explanation of the
1087 // properties declarations.
1088
1089 BEGIN_PROPERTIES
1090 octave_value position
1091 mutable graphics_handle title GSO
1092 octave_value box
1093 octave_value key
1094 octave_value keybox
1095 octave_value keypos
1096 octave_value dataaspectratio m
1097 octave_value dataaspectratiomode
1098 octave_value xlim m
1099 octave_value ylim m
1100 octave_value zlim m
1101 octave_value clim m
1102 octave_value xlimmode
1103 octave_value ylimmode
1104 octave_value zlimmode
1105 octave_value climmode
1106 mutable graphics_handle xlabel GSO
1107 mutable graphics_handle ylabel GSO
1108 mutable graphics_handle zlabel GSO
1109 octave_value xgrid
1110 octave_value ygrid
1111 octave_value zgrid
1112 octave_value xminorgrid
1113 octave_value yminorgrid
1114 octave_value zminorgrid
1115 octave_value xtick m
1116 octave_value ytick m
1117 octave_value ztick m
1118 octave_value xtickmode
1119 octave_value ytickmode
1120 octave_value ztickmode
1121 octave_value xticklabel m
1122 octave_value yticklabel m
1123 octave_value zticklabel m
1124 octave_value xticklabelmode
1125 octave_value yticklabelmode
1126 octave_value zticklabelmode
1127 octave_value xscale
1128 octave_value yscale
1129 octave_value zscale
1130 octave_value xdir
1131 octave_value ydir
1132 octave_value zdir
1133 octave_value xaxislocation
1134 octave_value yaxislocation
1135 octave_value view
1136 octave_value visible
1137 octave_value nextplot
1138 octave_value outerposition
1139 END_PROPERTIES
1140
1141 static std::string go_name;
1142 };
1143
1144 private:
1145 properties xproperties;
1146
1147 public:
1148 axes (const graphics_handle& mh, const graphics_handle& p)
1149 : base_graphics_object (), xproperties (mh, p), default_properties ()
1150 {
1151 xproperties.override_defaults (*this);
1152 }
1153
1154 ~axes (void) { xproperties.delete_children (); }
1155
1156 std::string type (void) const { return xproperties.graphics_object_name (); }
1157
1158 void mark_modified (void) { xproperties.mark_modified (); }
1159
1160 void override_defaults (base_graphics_object& obj)
1161 {
1162 // Allow parent (figure) to override first (properties knows how
1163 // to find the parent object).
1164 xproperties.override_defaults (obj);
1165
1166 // Now override with our defaults. If the default_properties
1167 // list includes the properties for all defaults (line,
1168 // surface, etc.) then we don't have to know the type of OBJ
1169 // here, we just call its set function and let it decide which
1170 // properties from the list to use.
1171 obj.set_from_list (default_properties);
1172 }
1173
1174 void set_from_list (property_list& plist)
1175 {
1176 xproperties.set_from_list (*this, plist);
1177 }
1178
1179 void set (const property_name& name, const octave_value& value)
1180 {
1181 if (name.compare ("default", 7))
1182 // strip "default", pass rest to function that will
1183 // parse the remainder and add the element to the
1184 // default_properties map.
1185 default_properties.set (name.substr (7), value);
1186 else
1187 xproperties.set (name, value);
1188 }
1189
1190 void set_defaults (const std::string& mode)
1191 {
1192 xproperties.set_defaults (*this, mode);
1193 }
1194
1195 octave_value get (void) const
1196 {
1197 return xproperties.get ();
1198 }
1199
1200 octave_value get (const property_name& name) const
1201 {
1202 octave_value retval;
1203
1204 // FIXME -- finish this.
1205 if (name.compare ("default", 7))
1206 retval = get_default (name.substr (7));
1207 else
1208 retval = xproperties.get (name);
1209
1210 return retval;
1211 }
1212
1213 octave_value get_default (const property_name& name) const;
1214
1215 octave_value get_defaults (void) const
1216 {
1217 return default_properties.as_struct ("default");
1218 }
1219
1220 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
1221
1222 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
1223
1224 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
1225
1226 void reparent (const graphics_handle& np) { xproperties.reparent (np); }
1227
1228 base_properties& get_properties (void) { return xproperties; }
1229
1230 bool valid_object (void) const { return true; }
1231
1232 private:
1233 property_list default_properties;
1234 };
1235
1236 // ---------------------------------------------------------------------
1237
1238 class line : public base_graphics_object
1239 {
1240 public:
1241 class properties : public base_properties
1242 {
1243 public:
1244 properties (const graphics_handle& mh, const graphics_handle& p);
1245
1246 ~properties (void) { }
1247
1248 void set (const property_name& name, const octave_value& val);
1249
1250 octave_value get (void) const;
1251
1252 octave_value get (const property_name& name) const;
1253
1254 std::string graphics_object_name (void) const { return go_name; }
1255
1256 static property_list::pval_map_type factory_defaults (void);
1257
1258 // See the genprops.awk script for an explanation of the
1259 // properties declarations.
1260
1261 BEGIN_PROPERTIES
1262 octave_value xdata
1263 octave_value ydata
1264 octave_value zdata
1265 octave_value ldata
1266 octave_value udata
1267 octave_value xldata
1268 octave_value xudata
1269 color_property color
1270 octave_value linestyle
1271 octave_value linewidth
1272 octave_value marker
1273 octave_value markeredgecolor
1274 octave_value markerfacecolor
1275 octave_value markersize
1276 octave_value keylabel
1277 END_PROPERTIES
1278
1279 static std::string go_name;
1280 };
1281
1282 private:
1283 properties xproperties;
1284
1285 public:
1286 line (const graphics_handle& mh, const graphics_handle& p)
1287 : base_graphics_object (), xproperties (mh, p)
1288 {
1289 xproperties.override_defaults (*this);
1290 }
1291
1292 ~line (void) { xproperties.delete_children (); }
1293
1294 std::string type (void) const { return xproperties.graphics_object_name (); }
1295
1296 void mark_modified (void) { xproperties.mark_modified (); }
1297
1298 void override_defaults (base_graphics_object& obj)
1299 {
1300 // Allow parent (figure) to override first (properties knows how
1301 // to find the parent object).
1302 xproperties.override_defaults (obj);
1303 }
1304
1305 void set_from_list (property_list& plist)
1306 {
1307 xproperties.set_from_list (*this, plist);
1308 }
1309
1310 void set (const property_name& name, const octave_value& val)
1311 {
1312 xproperties.set (name, val);
1313 }
1314
1315 octave_value get (void) const
1316 {
1317 return xproperties.get ();
1318 }
1319
1320 octave_value get (const property_name& name) const
1321 {
1322 return xproperties.get (name);
1323 }
1324
1325 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
1326
1327 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
1328
1329 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
1330
1331 void reparent (const graphics_handle& h) { xproperties.reparent (h); }
1332
1333 base_properties& get_properties (void) { return xproperties; }
1334
1335 bool valid_object (void) const { return true; }
1336 };
1337
1338 // ---------------------------------------------------------------------
1339
1340 class text : public base_graphics_object
1341 {
1342 public:
1343 class properties : public base_properties
1344 {
1345 public:
1346 properties (const graphics_handle& mh, const graphics_handle& p);
1347
1348 ~properties (void) { }
1349
1350 void set (const property_name& name, const octave_value& val);
1351
1352 octave_value get (void) const;
1353
1354 octave_value get (const property_name& name) const;
1355
1356 std::string graphics_object_name (void) const { return go_name; }
1357
1358 static property_list::pval_map_type factory_defaults (void);
1359
1360 // See the genprops.awk script for an explanation of the
1361 // properties declarations.
1362
1363 BEGIN_PROPERTIES
1364 octave_value string
1365 octave_value units
1366 octave_value position
1367 octave_value rotation
1368 octave_value horizontalalignment
1369 octave_value color
1370 END_PROPERTIES
1371
1372 static std::string go_name;
1373 };
1374
1375 private:
1376 properties xproperties;
1377
1378 public:
1379 text (const graphics_handle& mh, const graphics_handle& p)
1380 : base_graphics_object (), xproperties (mh, p)
1381 {
1382 xproperties.override_defaults (*this);
1383 }
1384
1385 ~text (void) { xproperties.delete_children (); }
1386
1387 std::string type (void) const { return xproperties.graphics_object_name (); }
1388
1389 void mark_modified (void) { xproperties.mark_modified (); }
1390
1391 void override_defaults (base_graphics_object& obj)
1392 {
1393 // Allow parent (figure) to override first (properties knows how
1394 // to find the parent object).
1395 xproperties.override_defaults (obj);
1396 }
1397
1398 void set_from_list (property_list& plist)
1399 {
1400 xproperties.set_from_list (*this, plist);
1401 }
1402
1403 void set (const property_name& name, const octave_value& val)
1404 {
1405 xproperties.set (name, val);
1406 }
1407
1408 octave_value get (void) const
1409 {
1410 return xproperties.get ();
1411 }
1412
1413 octave_value get (const property_name& name) const
1414 {
1415 return xproperties.get (name);
1416 }
1417
1418 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
1419
1420 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
1421
1422 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
1423
1424 void reparent (const graphics_handle& h) { xproperties.reparent (h); }
1425
1426 base_properties& get_properties (void) { return xproperties; }
1427
1428 bool valid_object (void) const { return true; }
1429 };
1430
1431 // ---------------------------------------------------------------------
1432
1433 class image : public base_graphics_object
1434 {
1435 public:
1436 class properties : public base_properties
1437 {
1438 public:
1439 properties (const graphics_handle& mh, const graphics_handle& p);
1440
1441 ~properties (void) { }
1442
1443 void set (const property_name& name, const octave_value& val);
1444
1445 octave_value get (void) const;
1446
1447 octave_value get (const property_name& name) const;
1448
1449 std::string graphics_object_name (void) const { return go_name; }
1450
1451 static property_list::pval_map_type factory_defaults (void);
1452
1453 // See the genprops.awk script for an explanation of the
1454 // properties declarations.
1455
1456 BEGIN_PROPERTIES
1457 octave_value cdata
1458 octave_value xdata
1459 octave_value ydata
1460 END_PROPERTIES
1461
1462 static std::string go_name;
1463 };
1464
1465 private:
1466 properties xproperties;
1467
1468 public:
1469 image (const graphics_handle& mh, const graphics_handle& p)
1470 : base_graphics_object (), xproperties (mh, p)
1471 {
1472 xproperties.override_defaults (*this);
1473 }
1474
1475 ~image (void) { xproperties.delete_children (); }
1476
1477 std::string type (void) const { return xproperties.graphics_object_name (); }
1478
1479 void mark_modified (void) { xproperties.mark_modified (); }
1480
1481 void override_defaults (base_graphics_object& obj)
1482 {
1483 // Allow parent (figure) to override first (properties knows how
1484 // to find the parent object).
1485 xproperties.override_defaults (obj);
1486 }
1487
1488 void set_from_list (property_list& plist)
1489 {
1490 xproperties.set_from_list (*this, plist);
1491 }
1492
1493 void set (const property_name& name, const octave_value& val)
1494 {
1495 xproperties.set (name, val);
1496 }
1497
1498 octave_value get (void) const
1499 {
1500 return xproperties.get ();
1501 }
1502
1503 octave_value get (const property_name& name) const
1504 {
1505 return xproperties.get (name);
1506 }
1507
1508 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
1509
1510 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
1511
1512 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
1513
1514 void reparent (const graphics_handle& h) { xproperties.reparent (h); }
1515
1516 base_properties& get_properties (void) { return xproperties; }
1517
1518 bool valid_object (void) const { return true; }
1519 };
1520
1521 // ---------------------------------------------------------------------
1522
1523 class patch : public base_graphics_object
1524 {
1525 public:
1526 class properties : public base_properties
1527 {
1528 public:
1529 properties (const graphics_handle& mh, const graphics_handle& p);
1530
1531 ~properties (void) { }
1532
1533 void set (const property_name& name, const octave_value& val);
1534
1535 octave_value get (void) const;
1536
1537 octave_value get (const property_name& name) const;
1538
1539 std::string graphics_object_name (void) const { return go_name; }
1540
1541 static property_list::pval_map_type factory_defaults (void);
1542
1543 // See the genprops.awk script for an explanation of the
1544 // properties declarations.
1545
1546 BEGIN_PROPERTIES
1547 octave_value cdata
1548 octave_value xdata
1549 octave_value ydata
1550 octave_value zdata
1551 color_property facecolor
1552 octave_value facealpha
1553 color_property edgecolor
1554 octave_value linestyle
1555 octave_value linewidth
1556 octave_value marker
1557 octave_value markeredgecolor
1558 octave_value markerfacecolor
1559 octave_value markersize
1560 END_PROPERTIES
1561
1562 static std::string go_name;
1563 };
1564
1565 private:
1566 properties xproperties;
1567
1568 public:
1569 patch (const graphics_handle& mh, const graphics_handle& p)
1570 : base_graphics_object (), xproperties (mh, p)
1571 {
1572 xproperties.override_defaults (*this);
1573 }
1574
1575 ~patch (void) { xproperties.delete_children (); }
1576
1577 std::string type (void) const { return xproperties.graphics_object_name (); }
1578
1579 void mark_modified (void) { xproperties.mark_modified (); }
1580
1581 void override_defaults (base_graphics_object& obj)
1582 {
1583 // Allow parent (figure) to override first (properties knows how
1584 // to find the parent object).
1585 xproperties.override_defaults (obj);
1586 }
1587
1588 void set_from_list (property_list& plist)
1589 {
1590 xproperties.set_from_list (*this, plist);
1591 }
1592
1593 void set (const property_name& name, const octave_value& val)
1594 {
1595 xproperties.set (name, val);
1596 }
1597
1598 octave_value get (void) const
1599 {
1600 return xproperties.get ();
1601 }
1602
1603 octave_value get (const property_name& name) const
1604 {
1605 return xproperties.get (name);
1606 }
1607
1608 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
1609
1610 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
1611
1612 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
1613
1614 void reparent (const graphics_handle& h) { xproperties.reparent (h); }
1615
1616 base_properties& get_properties (void) { return xproperties; }
1617
1618 bool valid_object (void) const { return true; }
1619 };
1620
1621 // ---------------------------------------------------------------------
1622
1623 class surface : public base_graphics_object
1624 {
1625 public:
1626 class properties : public base_properties
1627 {
1628 public:
1629 properties (const graphics_handle& mh, const graphics_handle& p);
1630
1631 ~properties (void) { }
1632
1633 void set (const property_name& name, const octave_value& val);
1634
1635 octave_value get (void) const;
1636
1637 octave_value get (const property_name& name) const;
1638
1639 std::string graphics_object_name (void) const { return go_name; }
1640
1641 static property_list::pval_map_type factory_defaults (void);
1642
1643 // See the genprops.awk script for an explanation of the
1644 // properties declarations.
1645
1646 BEGIN_PROPERTIES
1647 octave_value xdata
1648 octave_value ydata
1649 octave_value zdata
1650 octave_value keylabel
1651 END_PROPERTIES
1652
1653 static std::string go_name;
1654 };
1655
1656 private:
1657 properties xproperties;
1658
1659 public:
1660 surface (const graphics_handle& mh, const graphics_handle& p)
1661 : base_graphics_object (), xproperties (mh, p)
1662 {
1663 xproperties.override_defaults (*this);
1664 }
1665
1666 ~surface (void) { xproperties.delete_children (); }
1667
1668 std::string type (void) const { return xproperties.graphics_object_name (); }
1669
1670 void mark_modified (void) { xproperties.mark_modified (); }
1671
1672 void override_defaults (base_graphics_object& obj)
1673 {
1674 // Allow parent (figure) to override first (properties knows how
1675 // to find the parent object).
1676 xproperties.override_defaults (obj);
1677 }
1678
1679 void set_from_list (property_list& plist)
1680 {
1681 xproperties.set_from_list (*this, plist);
1682 }
1683
1684 void set (const property_name& name, const octave_value& val)
1685 {
1686 xproperties.set (name, val);
1687 }
1688
1689 octave_value get (void) const
1690 {
1691 return xproperties.get ();
1692 }
1693
1694 octave_value get (const property_name& name) const
1695 {
1696 return xproperties.get (name);
1697 }
1698
1699 graphics_handle get_parent (void) const { return xproperties.get_parent (); }
1700
1701 void remove_child (const graphics_handle& h) { xproperties.remove_child (h); }
1702
1703 void adopt (const graphics_handle& h) { xproperties.adopt (h); }
1704
1705 void reparent (const graphics_handle& h) { xproperties.reparent (h); }
1706
1707 base_properties& get_properties (void) { return xproperties; }
1708
1709 bool valid_object (void) const { return true; }
1710 };
1711
1712 octave_value
1713 get_property_from_handle (double handle, const std::string &property,
1714 const std::string &func);
1715 bool
1716 set_property_in_handle (double handle, const std::string &property,
1717 const octave_value &arg, const std::string &func);
1718
1719 // ---------------------------------------------------------------------
1720
1721 class gh_manager
1722 {
1723 protected:
1724
1725 gh_manager (void);
1726
1727 public:
1728
1729 static bool instance_ok (void)
1730 {
1731 bool retval = true;
1732
1733 if (! instance)
1734 instance = new gh_manager ();
1735
1736 if (! instance)
1737 {
1738 ::error ("unable to create gh_manager!");
1739
1740 retval = false;
1741 }
1742
1743 return retval;
1744 }
1745
1746 static void free (const graphics_handle& h)
1747 {
1748 if (instance_ok ())
1749 instance->do_free (h);
1750 }
1751
1752 static graphics_handle lookup (double val)
1753 {
1754 return instance_ok () ? instance->do_lookup (val) : graphics_handle ();
1755 }
1756
1757 static graphics_object get_object (const graphics_handle& h)
1758 {
1759 return instance_ok () ? instance->do_get_object (h) : graphics_object ();
1760 }
1761
1762 static graphics_handle
1763 make_graphics_handle (const std::string& go_name,
1764 const graphics_handle& parent)
1765 {
1766 return instance_ok ()
1767 ? instance->do_make_graphics_handle (go_name, parent)
1768 : graphics_handle ();
1769 }
1770
1771 static graphics_handle make_figure_handle (double val)
1772 {
1773 return instance_ok ()
1774 ? instance->do_make_figure_handle (val) : graphics_handle ();
1775 }
1776
1777 static void push_figure (const graphics_handle& h)
1778 {
1779 if (instance_ok ())
1780 instance->do_push_figure (h);
1781 }
1782
1783 static void pop_figure (const graphics_handle& h)
1784 {
1785 if (instance_ok ())
1786 instance->do_pop_figure (h);
1787 }
1788
1789 static graphics_handle current_figure (void)
1790 {
1791 return instance_ok ()
1792 ? instance->do_current_figure () : graphics_handle ();
1793 }
1794
1795 static Matrix handle_list (void)
1796 {
1797 return instance_ok () ? instance->do_handle_list () : Matrix ();
1798 }
1799
1800 static Matrix figure_handle_list (void)
1801 {
1802 return instance_ok () ? instance->do_figure_handle_list () : Matrix ();
1803 }
1804
1805 private:
1806
1807 static gh_manager *instance;
1808
1809 typedef std::map<graphics_handle, graphics_object>::iterator iterator;
1810 typedef std::map<graphics_handle, graphics_object>::const_iterator const_iterator;
1811
1812 typedef std::set<graphics_handle>::iterator free_list_iterator;
1813 typedef std::set<graphics_handle>::const_iterator const_free_list_iterator;
1814
1815 typedef std::list<graphics_handle>::iterator figure_list_iterator;
1816 typedef std::list<graphics_handle>::const_iterator const_figure_list_iterator;
1817
1818 // A map of handles to graphics objects.
1819 std::map<graphics_handle, graphics_object> handle_map;
1820
1821 // The available graphics handles.
1822 std::set<graphics_handle> handle_free_list;
1823
1824 // The next handle available if handle_free_list is empty.
1825 graphics_handle next_handle;
1826
1827 // The allocated figure handles. Top of the stack is most recently
1828 // created.
1829 std::list<graphics_handle> figure_list;
1830
1831 graphics_handle get_handle (const std::string& go_name);
1832
1833 void do_free (const graphics_handle& h);
1834
1835 graphics_handle do_lookup (double val)
1836 {
1837 iterator p = handle_map.find (val);
1838
1839 return (p != handle_map.end ()) ? p->first : graphics_handle ();
1840 }
1841
1842 graphics_object do_get_object (const graphics_handle& h)
1843 {
1844 iterator p = handle_map.find (h);
1845
1846 return (p != handle_map.end ()) ? p->second : graphics_object ();
1847 }
1848
1849 graphics_handle do_make_graphics_handle (const std::string& go_name,
1850 const graphics_handle& p);
1851
1852 graphics_handle do_make_figure_handle (double val);
1853
1854 Matrix do_handle_list (void)
1855 {
1856 Matrix retval (1, handle_map.size ());
1857 octave_idx_type i = 0;
1858 for (const_iterator p = handle_map.begin (); p != handle_map.end (); p++)
1859 retval(i++) = p->first;
1860 return retval;
1861 }
1862
1863 Matrix do_figure_handle_list (void)
1864 {
1865 Matrix retval (1, figure_list.size ());
1866 octave_idx_type i = 0;
1867 for (const_figure_list_iterator p = figure_list.begin ();
1868 p != figure_list.end ();
1869 p++)
1870 retval(i++) = *p;
1871 return retval;
1872 }
1873
1874 void do_push_figure (const graphics_handle& h);
1875
1876 void do_pop_figure (const graphics_handle& h);
1877
1878 graphics_handle do_current_figure (void) const
1879 {
1880 return figure_list.empty () ? graphics_handle () : figure_list.front ();
1881 }
1882 };
1883
1884
1885 // This function is NOT equivalent to the scripting language function gcf.
1886 graphics_handle gcf (void);
1887
1888 // This function is NOT equivalent to the scripting language function gca.
1889 graphics_handle gca (void);
1890
1891 #endif
1892
1893 /*
1894 ;;; Local Variables: ***
1895 ;;; mode: C++ ***
1896 ;;; End: ***
1897 */