Mercurial > octave-libgccjit
comparison src/graphics.cc @ 6874:94bda6abc224
[project @ 2007-09-06 21:34:24 by jwe]
author | jwe |
---|---|
date | Thu, 06 Sep 2007 21:34:24 +0000 |
parents | 11dd2cb3825c |
children | b2b7526a5772 |
comparison
equal
deleted
inserted
replaced
6873:e03d52dc3d12 | 6874:94bda6abc224 |
---|---|
44 | 44 |
45 static void | 45 static void |
46 gripe_set_invalid (const std::string& pname) | 46 gripe_set_invalid (const std::string& pname) |
47 { | 47 { |
48 error ("set: invalid value for %s property", pname.c_str ()); | 48 error ("set: invalid value for %s property", pname.c_str ()); |
49 } | |
50 | |
51 static octave_value | |
52 nan_to_empty (double val) | |
53 { | |
54 return xisnan (val) ? octave_value (Matrix ()) : octave_value (val); | |
55 } | |
56 | |
57 static octave_value | |
58 empty_to_nan (const octave_value& val) | |
59 { | |
60 return val.is_empty () ? octave_value (octave_NaN) : val; | |
61 } | 49 } |
62 | 50 |
63 // --------------------------------------------------------------------- | 51 // --------------------------------------------------------------------- |
64 | 52 |
65 radio_values::radio_values (const std::string& opt_string) | 53 radio_values::radio_values (const std::string& opt_string) |
378 } | 366 } |
379 | 367 |
380 return m; | 368 return m; |
381 } | 369 } |
382 | 370 |
371 graphics_handle::graphics_handle (const octave_value& a) | |
372 : val (octave_NaN) | |
373 { | |
374 if (a.is_empty ()) | |
375 /* do nothing */; | |
376 else | |
377 { | |
378 double tval = a.double_value (); | |
379 | |
380 if (! error_state) | |
381 val = tval; | |
382 else | |
383 error ("invalid graphics handle"); | |
384 } | |
385 } | |
386 | |
383 void | 387 void |
384 graphics_object::set (const octave_value_list& args) | 388 graphics_object::set (const octave_value_list& args) |
385 { | 389 { |
386 int nargin = args.length (); | 390 int nargin = args.length (); |
387 | 391 |
452 } | 456 } |
453 | 457 |
454 void | 458 void |
455 gh_manager::do_free (const graphics_handle& h) | 459 gh_manager::do_free (const graphics_handle& h) |
456 { | 460 { |
457 if (h != 0) | 461 if (h) |
458 { | 462 { |
459 iterator p = handle_map.find (h); | 463 if (h.value () != 0) |
460 | |
461 if (p != handle_map.end ()) | |
462 { | 464 { |
463 handle_map.erase (p); | 465 iterator p = handle_map.find (h); |
464 | 466 |
465 if (h < 0) | 467 if (p != handle_map.end ()) |
466 handle_free_list.insert (h); | 468 { |
469 handle_map.erase (p); | |
470 | |
471 if (h.value () < 0) | |
472 handle_free_list.insert (h); | |
473 } | |
474 else | |
475 error ("graphics_handle::free: invalid object %g", h.value ()); | |
467 } | 476 } |
468 else | 477 else |
469 error ("graphics_handle::free: invalid object %g", h); | 478 error ("graphics_handle::free: can't delete root figure"); |
470 } | 479 } |
471 else | 480 } |
472 error ("graphics_handle::free: can't delete root figure"); | |
473 } | |
474 | |
475 | 481 |
476 gh_manager *gh_manager::instance = 0; | 482 gh_manager *gh_manager::instance = 0; |
477 | 483 |
478 static void | 484 static void |
479 xset (const graphics_handle& h, const property_name& name, | 485 xset (const graphics_handle& h, const property_name& name, |
512 | 518 |
513 if (! error_state) | 519 if (! error_state) |
514 { | 520 { |
515 h = gh_manager::lookup (val); | 521 h = gh_manager::lookup (val); |
516 | 522 |
517 if (! xisnan (h)) | 523 if (h) |
518 { | 524 { |
519 graphics_object obj = gh_manager::get_object (h); | 525 graphics_object obj = gh_manager::get_object (h); |
520 | 526 |
521 graphics_handle parent_h = obj.get_parent (); | 527 graphics_handle parent_h = obj.get_parent (); |
522 | 528 |
523 graphics_object parent_obj = gh_manager::get_object (parent_h); | 529 graphics_object parent_obj = gh_manager::get_object (parent_h); |
524 | 530 |
525 parent_obj.remove_child (h); | 531 parent_obj.remove_child (h); |
526 | 532 |
527 if (adopt) | 533 if (adopt) |
528 obj.set ("parent", new_parent); | 534 obj.set ("parent", new_parent.value ()); |
529 else | 535 else |
530 obj.reparent (new_parent); | 536 obj.reparent (new_parent); |
531 } | 537 } |
532 else | 538 else |
533 error ("%s: invalid graphics handle (= %g) for %s", | 539 error ("%s: invalid graphics handle (= %g) for %s", |
567 } | 573 } |
568 | 574 |
569 static bool | 575 static bool |
570 is_handle (double val) | 576 is_handle (double val) |
571 { | 577 { |
572 return ! xisnan (gh_manager::lookup (val)); | 578 graphics_handle h = gh_manager::lookup (val); |
579 | |
580 return h.ok (); | |
573 } | 581 } |
574 | 582 |
575 static bool | 583 static bool |
576 is_handle (const octave_value& val) | 584 is_handle (const octave_value& val) |
577 { | 585 { |
665 { | 673 { |
666 octave_idx_type k = -1; | 674 octave_idx_type k = -1; |
667 octave_idx_type n = children.numel (); | 675 octave_idx_type n = children.numel (); |
668 for (octave_idx_type i = 0; i < n; i++) | 676 for (octave_idx_type i = 0; i < n; i++) |
669 { | 677 { |
670 if (h == children(i)) | 678 if (h.value () == children(i)) |
671 { | 679 { |
672 k = i; | 680 k = i; |
673 break; | 681 break; |
674 } | 682 } |
675 } | 683 } |
696 | 704 |
697 if (! error_state) | 705 if (! error_state) |
698 { | 706 { |
699 new_parent = gh_manager::lookup (tmp); | 707 new_parent = gh_manager::lookup (tmp); |
700 | 708 |
701 if (! xisnan (new_parent)) | 709 if (new_parent) |
702 { | 710 { |
703 graphics_object parent_obj = gh_manager::get_object (parent); | 711 graphics_object parent_obj = gh_manager::get_object (parent); |
704 | 712 |
705 parent_obj.remove_child (__myhandle__); | 713 parent_obj.remove_child (__myhandle__); |
706 | 714 |
738 for (octave_idx_type i = 0; i < n; i++) | 746 for (octave_idx_type i = 0; i < n; i++) |
739 gh_manager::free (children(i)); | 747 gh_manager::free (children(i)); |
740 } | 748 } |
741 | 749 |
742 void | 750 void |
751 root_figure::properties::set_currentfigure (const graphics_handle& val) | |
752 { | |
753 if (error_state) | |
754 return; | |
755 | |
756 if (is_handle (val)) | |
757 { | |
758 currentfigure = val; | |
759 | |
760 gh_manager::push_figure (currentfigure); | |
761 } | |
762 else | |
763 gripe_set_invalid ("currentfigure"); | |
764 } | |
765 | |
766 void | |
743 root_figure::properties::set (const property_name& name, | 767 root_figure::properties::set (const property_name& name, |
744 const octave_value& val) | 768 const octave_value& val) |
745 { | 769 { |
746 if (name.compare ("currentfigure")) | 770 if (name.compare ("currentfigure")) |
747 { | 771 set_currentfigure (val); |
748 octave_value tval = empty_to_nan (val); | |
749 | |
750 if (is_handle (tval)) | |
751 { | |
752 currentfigure = tval.double_value (); | |
753 | |
754 gh_manager::push_figure (currentfigure); | |
755 } | |
756 else | |
757 gripe_set_invalid ("currentfigure"); | |
758 } | |
759 else if (name.compare ("children")) | 772 else if (name.compare ("children")) |
760 children = maybe_set_children (children, val); | 773 children = maybe_set_children (children, val); |
761 else if (name.compare ("visible")) | 774 else if (name.compare ("visible")) |
762 visible = val; | 775 set_visible (val); |
763 else | 776 else |
764 warning ("set: invalid property `%s'", name.c_str ()); | 777 warning ("set: invalid property `%s'", name.c_str ()); |
765 } | 778 } |
766 | 779 |
767 octave_value root_figure::properties::get (void) const | 780 octave_value root_figure::properties::get (void) const |
768 { | 781 { |
769 Octave_map m; | 782 Octave_map m; |
770 | 783 |
771 m.assign ("type", type); | 784 m.assign ("type", type); |
772 m.assign ("currentfigure", nan_to_empty (currentfigure)); | 785 m.assign ("currentfigure", currentfigure.as_octave_value ()); |
773 m.assign ("children", children); | 786 m.assign ("children", children); |
774 m.assign ("visible", visible); | 787 m.assign ("visible", visible); |
775 | 788 |
776 return m; | 789 return m; |
777 } | 790 } |
782 octave_value retval; | 795 octave_value retval; |
783 | 796 |
784 if (name.compare ("type")) | 797 if (name.compare ("type")) |
785 retval = type; | 798 retval = type; |
786 else if (name.compare ("currentfigure")) | 799 else if (name.compare ("currentfigure")) |
787 retval = nan_to_empty (currentfigure); | 800 retval = currentfigure.as_octave_value (); |
788 else if (name.compare ("children")) | 801 else if (name.compare ("children")) |
789 retval = children; | 802 retval = children; |
790 else if (name.compare ("visible")) | 803 else if (name.compare ("visible")) |
791 retval = visible; | 804 retval = visible; |
792 else | 805 else |
813 visible ("on"), | 826 visible ("on"), |
814 paperorientation ("portrait") | 827 paperorientation ("portrait") |
815 { } | 828 { } |
816 | 829 |
817 void | 830 void |
818 figure::properties::set (const property_name& name, | 831 figure::properties::set_currentaxes (const graphics_handle& val) |
819 const octave_value& val) | 832 { |
833 if (error_state) | |
834 return; | |
835 | |
836 if (is_handle (val)) | |
837 currentaxes = val; | |
838 else | |
839 gripe_set_invalid ("currentaxes"); | |
840 } | |
841 | |
842 void | |
843 figure::properties::set_visible (const octave_value& val) | |
844 { | |
845 std::string s = val.string_value (); | |
846 | |
847 if (! error_state) | |
848 { | |
849 if (s == "on") | |
850 xset (0, "currentfigure", __myhandle__.value ()); | |
851 | |
852 visible = val; | |
853 } | |
854 } | |
855 | |
856 void | |
857 figure::properties::set (const property_name& name, const octave_value& val) | |
820 { | 858 { |
821 bool modified = true; | 859 bool modified = true; |
822 | 860 |
823 if (name.compare ("children")) | 861 if (name.compare ("children")) |
824 children = maybe_set_children (children, val); | 862 children = maybe_set_children (children, val); |
826 { | 864 { |
827 __modified__ = val.bool_value (); | 865 __modified__ = val.bool_value (); |
828 modified = false; | 866 modified = false; |
829 } | 867 } |
830 else if (name.compare ("__plot_stream__")) | 868 else if (name.compare ("__plot_stream__")) |
831 __plot_stream__ = val; | 869 set___plot_stream__ (val); |
832 else if (name.compare ("nextplot")) | 870 else if (name.compare ("nextplot")) |
833 nextplot = val; | 871 set_nextplot (val); |
834 else if (name.compare ("closerequestfcn")) | 872 else if (name.compare ("closerequestfcn")) |
835 closerequestfcn = val; | 873 set_closerequestfcn (val); |
836 else if (name.compare ("currentaxes")) | 874 else if (name.compare ("currentaxes")) |
837 { | 875 set_currentaxes (val); |
838 octave_value tval = empty_to_nan (val); | |
839 | |
840 if (is_handle (tval)) | |
841 currentaxes = tval.double_value (); | |
842 else | |
843 gripe_set_invalid ("currentaxes"); | |
844 } | |
845 else if (name.compare ("colormap")) | 876 else if (name.compare ("colormap")) |
846 colormap = colormap_property (val); | 877 set_colormap (val); |
847 else if (name.compare ("visible")) | 878 else if (name.compare ("visible")) |
848 { | 879 set_visible (val); |
849 std::string s = val.string_value (); | |
850 | |
851 if (! error_state) | |
852 { | |
853 if (s == "on") | |
854 xset (0, "currentfigure", __myhandle__); | |
855 | |
856 visible = val; | |
857 } | |
858 } | |
859 else if (name.compare ("paperorientation")) | 880 else if (name.compare ("paperorientation")) |
860 paperorientation = val; | 881 set_paperorientation (val); |
861 else | 882 else |
862 { | 883 { |
863 modified = false; | 884 modified = false; |
864 warning ("set: invalid property `%s'", name.c_str ()); | 885 warning ("set: invalid property `%s'", name.c_str ()); |
865 } | 886 } |
872 figure::properties::get (void) const | 893 figure::properties::get (void) const |
873 { | 894 { |
874 Octave_map m; | 895 Octave_map m; |
875 | 896 |
876 m.assign ("type", type); | 897 m.assign ("type", type); |
877 m.assign ("parent", parent); | 898 m.assign ("parent", parent.as_octave_value ()); |
878 m.assign ("children", children); | 899 m.assign ("children", children); |
879 m.assign ("__modified__", __modified__); | 900 m.assign ("__modified__", __modified__); |
880 m.assign ("__plot_stream__", __plot_stream__); | 901 m.assign ("__plot_stream__", __plot_stream__); |
881 m.assign ("nextplot", nextplot); | 902 m.assign ("nextplot", nextplot); |
882 m.assign ("closerequestfcn", closerequestfcn); | 903 m.assign ("closerequestfcn", closerequestfcn); |
883 m.assign ("currentaxes", nan_to_empty (currentaxes)); | 904 m.assign ("currentaxes", currentaxes.as_octave_value ()); |
884 m.assign ("colormap", colormap); | 905 m.assign ("colormap", colormap); |
885 m.assign ("visible", visible); | 906 m.assign ("visible", visible); |
886 m.assign ("paperorientation", paperorientation); | 907 m.assign ("paperorientation", paperorientation); |
887 | 908 |
888 return m; | 909 return m; |
894 octave_value retval; | 915 octave_value retval; |
895 | 916 |
896 if (name.compare ("type")) | 917 if (name.compare ("type")) |
897 retval = type; | 918 retval = type; |
898 else if (name.compare ("parent")) | 919 else if (name.compare ("parent")) |
899 retval = parent; | 920 retval = parent.as_octave_value (); |
900 else if (name.compare ("children")) | 921 else if (name.compare ("children")) |
901 retval = children; | 922 retval = children; |
902 else if (name.compare ("__modified__")) | 923 else if (name.compare ("__modified__")) |
903 retval = __modified__; | 924 retval = __modified__; |
904 else if (name.compare ("__plot_stream__")) | 925 else if (name.compare ("__plot_stream__")) |
906 else if (name.compare ("nextplot")) | 927 else if (name.compare ("nextplot")) |
907 retval = nextplot; | 928 retval = nextplot; |
908 else if (name.compare ("closerequestfcn")) | 929 else if (name.compare ("closerequestfcn")) |
909 retval = closerequestfcn; | 930 retval = closerequestfcn; |
910 else if (name.compare ("currentaxes")) | 931 else if (name.compare ("currentaxes")) |
911 retval = nan_to_empty (currentaxes); | 932 retval = currentaxes.as_octave_value (); |
912 else if (name.compare ("colormap")) | 933 else if (name.compare ("colormap")) |
913 retval = colormap; | 934 retval = colormap; |
914 else if (name.compare ("visible")) | 935 else if (name.compare ("visible")) |
915 retval = visible; | 936 retval = visible; |
916 else if (name.compare ("paperorientation")) | 937 else if (name.compare ("paperorientation")) |
935 feval ("pclose", args); | 956 feval ("pclose", args); |
936 } | 957 } |
937 | 958 |
938 gh_manager::pop_figure (__myhandle__); | 959 gh_manager::pop_figure (__myhandle__); |
939 | 960 |
940 xset (0, "currentfigure", gh_manager::current_figure ()); | 961 graphics_handle cf = gh_manager::current_figure (); |
962 | |
963 xset (0, "currentfigure", cf.value ()); | |
941 } | 964 } |
942 | 965 |
943 property_list::pval_map_type | 966 property_list::pval_map_type |
944 figure::properties::factory_defaults (void) | 967 figure::properties::factory_defaults (void) |
945 { | 968 { |
1045 touterposition(3) = 1; | 1068 touterposition(3) = 1; |
1046 outerposition = touterposition; | 1069 outerposition = touterposition; |
1047 } | 1070 } |
1048 | 1071 |
1049 void | 1072 void |
1073 axes::properties::set_title (const graphics_handle& val) | |
1074 { | |
1075 if (! error_state) | |
1076 { | |
1077 gh_manager::free (title); | |
1078 title = val; | |
1079 } | |
1080 } | |
1081 | |
1082 void | |
1083 axes::properties::set_title (const octave_value& val) | |
1084 { | |
1085 set_title (::reparent (val, "set", "title", __myhandle__, false)); | |
1086 } | |
1087 | |
1088 void | |
1089 axes::properties::set_xlabel (const graphics_handle& val) | |
1090 { | |
1091 if (! error_state) | |
1092 { | |
1093 gh_manager::free (xlabel); | |
1094 xlabel = val; | |
1095 } | |
1096 } | |
1097 | |
1098 void | |
1099 axes::properties::set_xlabel (const octave_value& val) | |
1100 { | |
1101 set_xlabel (::reparent (val, "set", "xlabel", __myhandle__, false)); | |
1102 } | |
1103 | |
1104 void | |
1105 axes::properties::set_ylabel (const graphics_handle& val) | |
1106 { | |
1107 if (! error_state) | |
1108 { | |
1109 gh_manager::free (ylabel); | |
1110 ylabel = val; | |
1111 } | |
1112 } | |
1113 | |
1114 void | |
1115 axes::properties::set_ylabel (const octave_value& val) | |
1116 { | |
1117 set_ylabel (::reparent (val, "set", "ylabel", __myhandle__, false)); | |
1118 } | |
1119 | |
1120 void | |
1121 axes::properties::set_zlabel (const graphics_handle& val) | |
1122 { | |
1123 if (! error_state) | |
1124 { | |
1125 gh_manager::free (zlabel); | |
1126 zlabel = val; | |
1127 } | |
1128 } | |
1129 | |
1130 void | |
1131 axes::properties::set_zlabel (const octave_value& val) | |
1132 { | |
1133 set_zlabel (::reparent (val, "set", "zlabel", __myhandle__, false)); | |
1134 } | |
1135 | |
1136 void | |
1050 axes::properties::set (const property_name& name, const octave_value& val) | 1137 axes::properties::set (const property_name& name, const octave_value& val) |
1051 { | 1138 { |
1052 bool modified = true; | 1139 bool modified = true; |
1053 | 1140 |
1054 if (name.compare ("parent")) | 1141 if (name.compare ("parent")) |
1059 { | 1146 { |
1060 __modified__ = val.bool_value (); | 1147 __modified__ = val.bool_value (); |
1061 modified = false; | 1148 modified = false; |
1062 } | 1149 } |
1063 else if (name.compare ("position")) | 1150 else if (name.compare ("position")) |
1064 position = val; | 1151 set_position (val); |
1065 else if (name.compare ("title")) | 1152 else if (name.compare ("title")) |
1066 { | 1153 set_title (val); |
1067 graphics_handle h = ::reparent (val, "set", "title", | |
1068 __myhandle__, false); | |
1069 if (! error_state) | |
1070 { | |
1071 if (! xisnan (title)) | |
1072 gh_manager::free (title); | |
1073 | |
1074 title = h; | |
1075 } | |
1076 } | |
1077 else if (name.compare ("box")) | 1154 else if (name.compare ("box")) |
1078 box = val; | 1155 set_box (val); |
1079 else if (name.compare ("key")) | 1156 else if (name.compare ("key")) |
1080 key = val; | 1157 set_key (val); |
1081 else if (name.compare ("keybox")) | 1158 else if (name.compare ("keybox")) |
1082 keybox = val; | 1159 set_keybox (val); |
1083 else if (name.compare ("keypos")) | 1160 else if (name.compare ("keypos")) |
1084 keypos = val; | 1161 set_keypos (val); |
1085 else if (name.compare ("dataaspectratio")) | 1162 else if (name.compare ("dataaspectratio")) |
1086 { | 1163 set_dataaspectratio (val); |
1087 dataaspectratio = val; | |
1088 dataaspectratiomode = "manual"; | |
1089 } | |
1090 else if (name.compare ("dataaspectratiomode")) | 1164 else if (name.compare ("dataaspectratiomode")) |
1091 dataaspectratiomode = val; | 1165 set_dataaspectratiomode (val); |
1092 else if (name.compare ("xlim")) | 1166 else if (name.compare ("xlim")) |
1093 { | 1167 set_xlim (val); |
1094 xlim = val; | |
1095 xlimmode = "manual"; | |
1096 } | |
1097 else if (name.compare ("ylim")) | 1168 else if (name.compare ("ylim")) |
1098 { | 1169 set_ylim (val); |
1099 ylim = val; | |
1100 ylimmode = "manual"; | |
1101 } | |
1102 else if (name.compare ("zlim")) | 1170 else if (name.compare ("zlim")) |
1103 { | 1171 set_zlim (val); |
1104 zlim = val; | |
1105 zlimmode = "manual"; | |
1106 } | |
1107 else if (name.compare ("clim")) | 1172 else if (name.compare ("clim")) |
1108 { | 1173 set_clim (val); |
1109 clim = val; | |
1110 climmode = "manual"; | |
1111 } | |
1112 else if (name.compare ("xlimmode")) | 1174 else if (name.compare ("xlimmode")) |
1113 xlimmode = val; | 1175 set_xlimmode (val); |
1114 else if (name.compare ("ylimmode")) | 1176 else if (name.compare ("ylimmode")) |
1115 ylimmode = val; | 1177 set_ylimmode (val); |
1116 else if (name.compare ("zlimmode")) | 1178 else if (name.compare ("zlimmode")) |
1117 zlimmode = val; | 1179 set_zlimmode (val); |
1118 else if (name.compare ("climmode")) | 1180 else if (name.compare ("climmode")) |
1119 climmode = val; | 1181 set_climmode (val); |
1120 else if (name.compare ("xlabel")) | 1182 else if (name.compare ("xlabel")) |
1121 { | 1183 set_xlabel (val); |
1122 graphics_handle h = ::reparent (val, "set", "xlabel", | |
1123 __myhandle__, false); | |
1124 if (! error_state) | |
1125 { | |
1126 if (! xisnan (xlabel)) | |
1127 gh_manager::free (xlabel); | |
1128 | |
1129 xlabel = h; | |
1130 } | |
1131 } | |
1132 else if (name.compare ("ylabel")) | 1184 else if (name.compare ("ylabel")) |
1133 { | 1185 set_ylabel (val); |
1134 graphics_handle h = ::reparent (val, "set", "ylabel", | |
1135 __myhandle__, false); | |
1136 if (! error_state) | |
1137 { | |
1138 if (! xisnan (ylabel)) | |
1139 gh_manager::free (ylabel); | |
1140 | |
1141 ylabel = h; | |
1142 } | |
1143 } | |
1144 else if (name.compare ("zlabel")) | 1186 else if (name.compare ("zlabel")) |
1145 { | 1187 set_zlabel (val); |
1146 graphics_handle h = ::reparent (val, "set", "zlabel", | |
1147 __myhandle__, false); | |
1148 if (! error_state) | |
1149 { | |
1150 if (! xisnan (zlabel)) | |
1151 gh_manager::free (zlabel); | |
1152 | |
1153 zlabel = h; | |
1154 } | |
1155 } | |
1156 else if (name.compare ("xgrid")) | 1188 else if (name.compare ("xgrid")) |
1157 xgrid = val; | 1189 set_xgrid (val); |
1158 else if (name.compare ("ygrid")) | 1190 else if (name.compare ("ygrid")) |
1159 ygrid = val; | 1191 set_ygrid (val); |
1160 else if (name.compare ("zgrid")) | 1192 else if (name.compare ("zgrid")) |
1161 zgrid = val; | 1193 set_zgrid (val); |
1162 else if (name.compare ("xminorgrid")) | 1194 else if (name.compare ("xminorgrid")) |
1163 xminorgrid = val; | 1195 set_xminorgrid (val); |
1164 else if (name.compare ("yminorgrid")) | 1196 else if (name.compare ("yminorgrid")) |
1165 yminorgrid = val; | 1197 set_yminorgrid (val); |
1166 else if (name.compare ("zminorgrid")) | 1198 else if (name.compare ("zminorgrid")) |
1167 zminorgrid = val; | 1199 set_zminorgrid (val); |
1168 else if (name.compare ("xtick")) | 1200 else if (name.compare ("xtick")) |
1169 { | 1201 set_xtick (val); |
1170 xtick = val; | |
1171 xtickmode = "manual"; | |
1172 } | |
1173 else if (name.compare ("ytick")) | 1202 else if (name.compare ("ytick")) |
1174 { | 1203 set_xtick (val); |
1175 ytick = val; | |
1176 ytickmode = "manual"; | |
1177 } | |
1178 else if (name.compare ("ztick")) | 1204 else if (name.compare ("ztick")) |
1179 { | 1205 set_ztick (val); |
1180 ztick = val; | |
1181 ztickmode = "manual"; | |
1182 } | |
1183 else if (name.compare ("xtickmode")) | 1206 else if (name.compare ("xtickmode")) |
1184 xtickmode = val; | 1207 set_xtickmode (val); |
1185 else if (name.compare ("ytickmode")) | 1208 else if (name.compare ("ytickmode")) |
1186 ytickmode = val; | 1209 set_ytickmode (val); |
1187 else if (name.compare ("ztickmode")) | 1210 else if (name.compare ("ztickmode")) |
1188 ztickmode = val; | 1211 set_ztickmode (val); |
1189 else if (name.compare ("xticklabel")) | 1212 else if (name.compare ("xticklabel")) |
1190 { | 1213 set_xticklabel (val); |
1191 xticklabel = val; | |
1192 xticklabelmode = "manual"; | |
1193 } | |
1194 else if (name.compare ("yticklabel")) | 1214 else if (name.compare ("yticklabel")) |
1195 { | 1215 set_yticklabel (val); |
1196 yticklabel = val; | |
1197 yticklabelmode = "manual"; | |
1198 } | |
1199 else if (name.compare ("zticklabel")) | 1216 else if (name.compare ("zticklabel")) |
1200 { | 1217 set_zticklabel (val); |
1201 zticklabel = val; | |
1202 zticklabelmode = "manual"; | |
1203 } | |
1204 else if (name.compare ("xticklabelmode")) | 1218 else if (name.compare ("xticklabelmode")) |
1205 xticklabelmode = val; | 1219 set_xticklabelmode (val); |
1206 else if (name.compare ("yticklabelmode")) | 1220 else if (name.compare ("yticklabelmode")) |
1207 yticklabelmode = val; | 1221 set_yticklabelmode (val); |
1208 else if (name.compare ("zticklabelmode")) | 1222 else if (name.compare ("zticklabelmode")) |
1209 zticklabelmode = val; | 1223 set_zticklabelmode (val); |
1210 else if (name.compare ("xscale")) | 1224 else if (name.compare ("xscale")) |
1211 xscale = val; | 1225 set_xscale (val); |
1212 else if (name.compare ("yscale")) | 1226 else if (name.compare ("yscale")) |
1213 yscale = val; | 1227 set_yscale (val); |
1214 else if (name.compare ("zscale")) | 1228 else if (name.compare ("zscale")) |
1215 zscale = val; | 1229 set_zscale (val); |
1216 else if (name.compare ("xdir")) | 1230 else if (name.compare ("xdir")) |
1217 xdir = val; | 1231 set_xdir (val); |
1218 else if (name.compare ("ydir")) | 1232 else if (name.compare ("ydir")) |
1219 ydir = val; | 1233 set_ydir (val); |
1220 else if (name.compare ("zdir")) | 1234 else if (name.compare ("zdir")) |
1221 zdir = val; | 1235 set_zdir (val); |
1222 else if (name.compare ("xaxislocation")) | 1236 else if (name.compare ("xaxislocation")) |
1223 xaxislocation = val; | 1237 set_xaxislocation (val); |
1224 else if (name.compare ("yaxislocation")) | 1238 else if (name.compare ("yaxislocation")) |
1225 yaxislocation = val; | 1239 set_yaxislocation (val); |
1226 else if (name.compare ("view")) | 1240 else if (name.compare ("view")) |
1227 view = val; | 1241 set_view (val); |
1228 else if (name.compare ("visible")) | 1242 else if (name.compare ("visible")) |
1229 visible = val; | 1243 set_visible (val); |
1230 else if (name.compare ("nextplot")) | 1244 else if (name.compare ("nextplot")) |
1231 nextplot = val; | 1245 set_nextplot (val); |
1232 else if (name.compare ("outerposition")) | 1246 else if (name.compare ("outerposition")) |
1233 outerposition = val; | 1247 set_outerposition (val); |
1234 else | 1248 else |
1235 { | 1249 { |
1236 modified = false; | 1250 modified = false; |
1237 warning ("set: invalid property `%s'", name.c_str ()); | 1251 warning ("set: invalid property `%s'", name.c_str ()); |
1238 } | 1252 } |
1321 children = Matrix (); | 1335 children = Matrix (); |
1322 | 1336 |
1323 override_defaults (obj); | 1337 override_defaults (obj); |
1324 } | 1338 } |
1325 | 1339 |
1340 graphics_handle | |
1341 axes::properties::get_title (void) const | |
1342 { | |
1343 if (! title) | |
1344 title = gh_manager::make_graphics_handle ("text", __myhandle__); | |
1345 | |
1346 return title; | |
1347 } | |
1348 | |
1349 graphics_handle | |
1350 axes::properties::get_xlabel (void) const | |
1351 { | |
1352 if (! xlabel) | |
1353 xlabel = gh_manager::make_graphics_handle ("text", __myhandle__); | |
1354 | |
1355 return xlabel; | |
1356 } | |
1357 | |
1358 graphics_handle | |
1359 axes::properties::get_ylabel (void) const | |
1360 { | |
1361 if (! ylabel) | |
1362 ylabel = gh_manager::make_graphics_handle ("text", __myhandle__); | |
1363 | |
1364 return ylabel; | |
1365 } | |
1366 | |
1367 graphics_handle | |
1368 axes::properties::get_zlabel (void) const | |
1369 { | |
1370 if (! zlabel) | |
1371 zlabel = gh_manager::make_graphics_handle ("text", __myhandle__); | |
1372 | |
1373 return zlabel; | |
1374 } | |
1375 | |
1326 octave_value | 1376 octave_value |
1327 axes::properties::get (void) const | 1377 axes::properties::get (void) const |
1328 { | 1378 { |
1329 Octave_map m; | 1379 Octave_map m; |
1330 | 1380 |
1331 if (xisnan (title)) | |
1332 title = gh_manager::make_graphics_handle ("text", __myhandle__); | |
1333 | |
1334 if (xisnan (xlabel)) | |
1335 xlabel = gh_manager::make_graphics_handle ("text", __myhandle__); | |
1336 | |
1337 if (xisnan (ylabel)) | |
1338 ylabel = gh_manager::make_graphics_handle ("text", __myhandle__); | |
1339 | |
1340 if (xisnan (zlabel)) | |
1341 zlabel = gh_manager::make_graphics_handle ("text", __myhandle__); | |
1342 | |
1343 m.assign ("type", type); | 1381 m.assign ("type", type); |
1344 m.assign ("parent", parent); | 1382 m.assign ("parent", parent.as_octave_value ()); |
1345 m.assign ("children", children); | 1383 m.assign ("children", children); |
1346 m.assign ("__modified__", __modified__); | 1384 m.assign ("__modified__", __modified__); |
1347 m.assign ("position", position); | 1385 m.assign ("position", position); |
1348 m.assign ("title", title); | 1386 m.assign ("title", get_title().as_octave_value ()); |
1349 m.assign ("box", box); | 1387 m.assign ("box", box); |
1350 m.assign ("key", key); | 1388 m.assign ("key", key); |
1351 m.assign ("keybox", keybox); | 1389 m.assign ("keybox", keybox); |
1352 m.assign ("keypos", keypos); | 1390 m.assign ("keypos", keypos); |
1353 m.assign ("dataaspectratio", dataaspectratio); | 1391 m.assign ("dataaspectratio", dataaspectratio); |
1358 m.assign ("clim", clim); | 1396 m.assign ("clim", clim); |
1359 m.assign ("xlimmode", xlimmode); | 1397 m.assign ("xlimmode", xlimmode); |
1360 m.assign ("ylimmode", ylimmode); | 1398 m.assign ("ylimmode", ylimmode); |
1361 m.assign ("zlimmode", zlimmode); | 1399 m.assign ("zlimmode", zlimmode); |
1362 m.assign ("climmode", climmode); | 1400 m.assign ("climmode", climmode); |
1363 m.assign ("xlabel", xlabel); | 1401 m.assign ("xlabel", get_xlabel().as_octave_value ()); |
1364 m.assign ("ylabel", ylabel); | 1402 m.assign ("ylabel", get_ylabel().as_octave_value ()); |
1365 m.assign ("zlabel", zlabel); | 1403 m.assign ("zlabel", get_zlabel().as_octave_value ()); |
1366 m.assign ("xgrid", xgrid); | 1404 m.assign ("xgrid", xgrid); |
1367 m.assign ("ygrid", ygrid); | 1405 m.assign ("ygrid", ygrid); |
1368 m.assign ("zgrid", zgrid); | 1406 m.assign ("zgrid", zgrid); |
1369 m.assign ("xminorgrid", xminorgrid); | 1407 m.assign ("xminorgrid", xminorgrid); |
1370 m.assign ("yminorgrid", yminorgrid); | 1408 m.assign ("yminorgrid", yminorgrid); |
1403 octave_value retval; | 1441 octave_value retval; |
1404 | 1442 |
1405 if (name.compare ("type")) | 1443 if (name.compare ("type")) |
1406 retval = type; | 1444 retval = type; |
1407 else if (name.compare ("parent")) | 1445 else if (name.compare ("parent")) |
1408 retval = parent; | 1446 retval = parent.value (); |
1409 else if (name.compare ("children")) | 1447 else if (name.compare ("children")) |
1410 retval = children; | 1448 retval = children; |
1411 else if (name.compare ("__modified__")) | 1449 else if (name.compare ("__modified__")) |
1412 retval = __modified__; | 1450 retval = __modified__; |
1413 else if (name.compare ("position")) | 1451 else if (name.compare ("position")) |
1414 retval = position; | 1452 retval = position; |
1415 else if (name.compare ("title")) | 1453 else if (name.compare ("title")) |
1416 { | 1454 retval = get_title().as_octave_value (); |
1417 if (xisnan (title)) | |
1418 title = gh_manager::make_graphics_handle ("text", __myhandle__); | |
1419 | |
1420 retval = title; | |
1421 } | |
1422 else if (name.compare ("box")) | 1455 else if (name.compare ("box")) |
1423 retval = box; | 1456 retval = box; |
1424 else if (name.compare ("key")) | 1457 else if (name.compare ("key")) |
1425 retval = key; | 1458 retval = key; |
1426 else if (name.compare ("keybox")) | 1459 else if (name.compare ("keybox")) |
1446 else if (name.compare ("zlimmode")) | 1479 else if (name.compare ("zlimmode")) |
1447 retval = zlimmode; | 1480 retval = zlimmode; |
1448 else if (name.compare ("climmode")) | 1481 else if (name.compare ("climmode")) |
1449 retval = climmode; | 1482 retval = climmode; |
1450 else if (name.compare ("xlabel")) | 1483 else if (name.compare ("xlabel")) |
1451 { | 1484 retval = get_xlabel().as_octave_value (); |
1452 if (xisnan (xlabel)) | |
1453 xlabel = gh_manager::make_graphics_handle ("text", __myhandle__); | |
1454 | |
1455 retval = xlabel; | |
1456 } | |
1457 else if (name.compare ("ylabel")) | 1485 else if (name.compare ("ylabel")) |
1458 { | 1486 retval = get_ylabel().as_octave_value (); |
1459 if (xisnan (ylabel)) | |
1460 ylabel = gh_manager::make_graphics_handle ("text", __myhandle__); | |
1461 | |
1462 retval = ylabel; | |
1463 } | |
1464 else if (name.compare ("zlabel")) | 1487 else if (name.compare ("zlabel")) |
1465 { | 1488 retval = get_zlabel().as_octave_value (); |
1466 if (xisnan (zlabel)) | |
1467 zlabel = gh_manager::make_graphics_handle ("text", __myhandle__); | |
1468 | |
1469 retval = zlabel; | |
1470 } | |
1471 else if (name.compare ("xgrid")) | 1489 else if (name.compare ("xgrid")) |
1472 retval = xgrid; | 1490 retval = xgrid; |
1473 else if (name.compare ("ygrid")) | 1491 else if (name.compare ("ygrid")) |
1474 retval = ygrid; | 1492 retval = ygrid; |
1475 else if (name.compare ("zgrid")) | 1493 else if (name.compare ("zgrid")) |
1535 } | 1553 } |
1536 | 1554 |
1537 void | 1555 void |
1538 axes::properties::remove_child (const graphics_handle& h) | 1556 axes::properties::remove_child (const graphics_handle& h) |
1539 { | 1557 { |
1540 if (! xisnan (title) && h == title) | 1558 if (title && h == title) |
1541 title = gh_manager::make_graphics_handle ("text", __myhandle__); | 1559 title = gh_manager::make_graphics_handle ("text", __myhandle__); |
1542 else if (! xisnan (xlabel) && h == xlabel) | 1560 else if (xlabel && h == xlabel) |
1543 xlabel = gh_manager::make_graphics_handle ("text", __myhandle__); | 1561 xlabel = gh_manager::make_graphics_handle ("text", __myhandle__); |
1544 else if (! xisnan (ylabel) && h == ylabel) | 1562 else if (ylabel && h == ylabel) |
1545 ylabel = gh_manager::make_graphics_handle ("text", __myhandle__); | 1563 ylabel = gh_manager::make_graphics_handle ("text", __myhandle__); |
1546 else if (! xisnan (zlabel) && h == zlabel) | 1564 else if (zlabel && h == zlabel) |
1547 zlabel = gh_manager::make_graphics_handle ("text", __myhandle__); | 1565 zlabel = gh_manager::make_graphics_handle ("text", __myhandle__); |
1548 else | 1566 else |
1549 base_properties::remove_child (h); | 1567 base_properties::remove_child (h); |
1550 } | 1568 } |
1551 | 1569 |
1552 void | 1570 void |
1553 axes::properties::delete_children (void) | 1571 axes::properties::delete_children (void) |
1554 { | 1572 { |
1555 base_properties::delete_children (); | 1573 base_properties::delete_children (); |
1556 | 1574 |
1557 if (! xisnan (title)) | 1575 gh_manager::free (title); |
1558 gh_manager::free (title); | 1576 gh_manager::free (xlabel); |
1559 | 1577 gh_manager::free (ylabel); |
1560 if (! xisnan (xlabel)) | 1578 gh_manager::free (zlabel); |
1561 gh_manager::free (xlabel); | |
1562 | |
1563 if (! xisnan (ylabel)) | |
1564 gh_manager::free (ylabel); | |
1565 | |
1566 if (! xisnan (zlabel)) | |
1567 gh_manager::free (zlabel); | |
1568 } | 1579 } |
1569 | 1580 |
1570 property_list::pval_map_type | 1581 property_list::pval_map_type |
1571 axes::properties::factory_defaults (void) | 1582 axes::properties::factory_defaults (void) |
1572 { | 1583 { |
1708 { | 1719 { |
1709 __modified__ = val.bool_value (); | 1720 __modified__ = val.bool_value (); |
1710 modified = false; | 1721 modified = false; |
1711 } | 1722 } |
1712 else if (name.compare ("xdata")) | 1723 else if (name.compare ("xdata")) |
1713 xdata = val; | 1724 set_xdata (val); |
1714 else if (name.compare ("ydata")) | 1725 else if (name.compare ("ydata")) |
1715 ydata = val; | 1726 set_ydata (val); |
1716 else if (name.compare ("zdata")) | 1727 else if (name.compare ("zdata")) |
1717 zdata = val; | 1728 set_zdata (val); |
1718 else if (name.compare ("ldata")) | 1729 else if (name.compare ("ldata")) |
1719 ldata = val; | 1730 set_ldata (val); |
1720 else if (name.compare ("udata")) | 1731 else if (name.compare ("udata")) |
1721 udata = val; | 1732 set_udata (val); |
1722 else if (name.compare ("xldata")) | 1733 else if (name.compare ("xldata")) |
1723 xldata = val; | 1734 set_xldata (val); |
1724 else if (name.compare ("xudata")) | 1735 else if (name.compare ("xudata")) |
1725 xudata = val; | 1736 set_xudata (val); |
1726 else if (name.compare ("color")) | 1737 else if (name.compare ("color")) |
1727 color = val; | 1738 set_color (val); |
1728 else if (name.compare ("linestyle")) | 1739 else if (name.compare ("linestyle")) |
1729 linestyle = val; | 1740 set_linestyle (val); |
1730 else if (name.compare ("linewidth")) | 1741 else if (name.compare ("linewidth")) |
1731 linewidth = val; | 1742 set_linewidth (val); |
1732 else if (name.compare ("marker")) | 1743 else if (name.compare ("marker")) |
1733 marker = val; | 1744 set_marker (val); |
1734 else if (name.compare ("markeredgecolor")) | 1745 else if (name.compare ("markeredgecolor")) |
1735 markeredgecolor = val; | 1746 set_markeredgecolor (val); |
1736 else if (name.compare ("markerfacecolor")) | 1747 else if (name.compare ("markerfacecolor")) |
1737 markerfacecolor = val; | 1748 set_markerfacecolor (val); |
1738 else if (name.compare ("markersize")) | 1749 else if (name.compare ("markersize")) |
1739 markersize = val; | 1750 set_markersize (val); |
1740 else if (name.compare ("keylabel")) | 1751 else if (name.compare ("keylabel")) |
1741 keylabel = val; | 1752 set_keylabel (val); |
1742 else | 1753 else |
1743 { | 1754 { |
1744 modified = false; | 1755 modified = false; |
1745 warning ("set: invalid property `%s'", name.c_str ()); | 1756 warning ("set: invalid property `%s'", name.c_str ()); |
1746 } | 1757 } |
1753 line::properties::get (void) const | 1764 line::properties::get (void) const |
1754 { | 1765 { |
1755 Octave_map m; | 1766 Octave_map m; |
1756 | 1767 |
1757 m.assign ("type", type); | 1768 m.assign ("type", type); |
1758 m.assign ("parent", parent); | 1769 m.assign ("parent", parent.as_octave_value ()); |
1759 m.assign ("children", children); | 1770 m.assign ("children", children); |
1760 m.assign ("__modified__", __modified__); | 1771 m.assign ("__modified__", __modified__); |
1761 m.assign ("xdata", xdata); | 1772 m.assign ("xdata", xdata); |
1762 m.assign ("ydata", ydata); | 1773 m.assign ("ydata", ydata); |
1763 m.assign ("zdata", zdata); | 1774 m.assign ("zdata", zdata); |
1783 octave_value retval; | 1794 octave_value retval; |
1784 | 1795 |
1785 if (name.compare ("type")) | 1796 if (name.compare ("type")) |
1786 retval = type; | 1797 retval = type; |
1787 else if (name.compare ("parent")) | 1798 else if (name.compare ("parent")) |
1788 retval = parent; | 1799 retval = parent.as_octave_value (); |
1789 else if (name.compare ("children")) | 1800 else if (name.compare ("children")) |
1790 retval = children; | 1801 retval = children; |
1791 else if (name.compare ("__modified__")) | 1802 else if (name.compare ("__modified__")) |
1792 retval = __modified__; | 1803 retval = __modified__; |
1793 else if (name.compare ("xdata")) | 1804 else if (name.compare ("xdata")) |
1878 { | 1889 { |
1879 __modified__ = val.bool_value (); | 1890 __modified__ = val.bool_value (); |
1880 modified = false; | 1891 modified = false; |
1881 } | 1892 } |
1882 else if (name.compare ("string")) | 1893 else if (name.compare ("string")) |
1883 string = val; | 1894 set_string (val); |
1884 else if (name.compare ("units")) | 1895 else if (name.compare ("units")) |
1885 units = val; | 1896 set_units (val); |
1886 else if (name.compare ("position")) | 1897 else if (name.compare ("position")) |
1887 position = val; | 1898 set_position (val); |
1888 else if (name.compare ("rotation")) | 1899 else if (name.compare ("rotation")) |
1889 rotation = val; | 1900 set_rotation (val); |
1890 else if (name.compare ("horizontalalignment")) | 1901 else if (name.compare ("horizontalalignment")) |
1891 horizontalalignment = val; | 1902 set_horizontalalignment (val); |
1892 else if (name.compare ("color")) | 1903 else if (name.compare ("color")) |
1893 color = val; | 1904 set_color (val); |
1894 else | 1905 else |
1895 { | 1906 { |
1896 modified = false; | 1907 modified = false; |
1897 warning ("set: invalid property `%s'", name.c_str ()); | 1908 warning ("set: invalid property `%s'", name.c_str ()); |
1898 } | 1909 } |
1905 text::properties::get (void) const | 1916 text::properties::get (void) const |
1906 { | 1917 { |
1907 Octave_map m; | 1918 Octave_map m; |
1908 | 1919 |
1909 m.assign ("type", type); | 1920 m.assign ("type", type); |
1910 m.assign ("parent", parent); | 1921 m.assign ("parent", parent.as_octave_value ()); |
1911 m.assign ("children", children); | 1922 m.assign ("children", children); |
1912 m.assign ("__modified__", __modified__); | 1923 m.assign ("__modified__", __modified__); |
1913 m.assign ("string", string); | 1924 m.assign ("string", string); |
1914 m.assign ("units", units); | 1925 m.assign ("units", units); |
1915 m.assign ("position", position); | 1926 m.assign ("position", position); |
1926 octave_value retval; | 1937 octave_value retval; |
1927 | 1938 |
1928 if (name.compare ("type")) | 1939 if (name.compare ("type")) |
1929 retval = type; | 1940 retval = type; |
1930 else if (name.compare ("parent")) | 1941 else if (name.compare ("parent")) |
1931 retval = parent; | 1942 retval = parent.as_octave_value (); |
1932 else if (name.compare ("children")) | 1943 else if (name.compare ("children")) |
1933 retval = children; | 1944 retval = children; |
1934 else if (name.compare ("__modified__")) | 1945 else if (name.compare ("__modified__")) |
1935 retval = __modified__; | 1946 retval = __modified__; |
1936 else if (name.compare ("string")) | 1947 else if (name.compare ("string")) |
1992 { | 2003 { |
1993 __modified__ = val.bool_value (); | 2004 __modified__ = val.bool_value (); |
1994 modified = false; | 2005 modified = false; |
1995 } | 2006 } |
1996 else if (name.compare ("cdata")) | 2007 else if (name.compare ("cdata")) |
1997 cdata = val; | 2008 set_cdata (val); |
1998 else if (name.compare ("xdata")) | 2009 else if (name.compare ("xdata")) |
1999 xdata = val; | 2010 set_xdata (val); |
2000 else if (name.compare ("ydata")) | 2011 else if (name.compare ("ydata")) |
2001 ydata = val; | 2012 set_ydata (val); |
2002 else | 2013 else |
2003 { | 2014 { |
2004 modified = false; | 2015 modified = false; |
2005 warning ("set: invalid property `%s'", name.c_str ()); | 2016 warning ("set: invalid property `%s'", name.c_str ()); |
2006 } | 2017 } |
2013 image::properties::get (void) const | 2024 image::properties::get (void) const |
2014 { | 2025 { |
2015 Octave_map m; | 2026 Octave_map m; |
2016 | 2027 |
2017 m.assign ("type", type); | 2028 m.assign ("type", type); |
2018 m.assign ("parent", parent); | 2029 m.assign ("parent", parent.as_octave_value ()); |
2019 m.assign ("children", children); | 2030 m.assign ("children", children); |
2020 m.assign ("__modified__", __modified__); | 2031 m.assign ("__modified__", __modified__); |
2021 m.assign ("cdata", cdata); | 2032 m.assign ("cdata", cdata); |
2022 m.assign ("xdata", xdata); | 2033 m.assign ("xdata", xdata); |
2023 m.assign ("ydata", ydata); | 2034 m.assign ("ydata", ydata); |
2031 octave_value retval; | 2042 octave_value retval; |
2032 | 2043 |
2033 if (name.compare ("type")) | 2044 if (name.compare ("type")) |
2034 retval = type; | 2045 retval = type; |
2035 else if (name.compare ("parent")) | 2046 else if (name.compare ("parent")) |
2036 retval = parent; | 2047 retval = parent.as_octave_value (); |
2037 else if (name.compare ("children")) | 2048 else if (name.compare ("children")) |
2038 retval = children; | 2049 retval = children; |
2039 else if (name.compare ("__modified__")) | 2050 else if (name.compare ("__modified__")) |
2040 retval = __modified__; | 2051 retval = __modified__; |
2041 else if (name.compare ("cdata")) | 2052 else if (name.compare ("cdata")) |
2098 { | 2109 { |
2099 __modified__ = val.bool_value (); | 2110 __modified__ = val.bool_value (); |
2100 modified = false; | 2111 modified = false; |
2101 } | 2112 } |
2102 else if (name.compare ("cdata")) | 2113 else if (name.compare ("cdata")) |
2103 cdata = val; | 2114 set_cdata (val); |
2104 else if (name.compare ("xdata")) | 2115 else if (name.compare ("xdata")) |
2105 xdata = val; | 2116 set_xdata (val); |
2106 else if (name.compare ("ydata")) | 2117 else if (name.compare ("ydata")) |
2107 ydata = val; | 2118 set_ydata (val); |
2108 else if (name.compare ("zdata")) | 2119 else if (name.compare ("zdata")) |
2109 zdata = val; | 2120 set_zdata (val); |
2110 else if (name.compare ("facecolor")) | 2121 else if (name.compare ("facecolor")) |
2111 facecolor = val; | 2122 set_facecolor (val); |
2112 else if (name.compare ("facealpha")) | 2123 else if (name.compare ("facealpha")) |
2113 facealpha = val; | 2124 set_facealpha (val); |
2114 else if (name.compare ("edgecolor")) | 2125 else if (name.compare ("edgecolor")) |
2115 edgecolor = val; | 2126 set_edgecolor (val); |
2116 else if (name.compare ("linestyle")) | 2127 else if (name.compare ("linestyle")) |
2117 linestyle = val; | 2128 set_linestyle (val); |
2118 else if (name.compare ("linewidth")) | 2129 else if (name.compare ("linewidth")) |
2119 linewidth = val; | 2130 set_linewidth (val); |
2120 else if (name.compare ("marker")) | 2131 else if (name.compare ("marker")) |
2121 marker = val; | 2132 set_marker (val); |
2122 else if (name.compare ("markeredgecolor")) | 2133 else if (name.compare ("markeredgecolor")) |
2123 markeredgecolor = val; | 2134 set_markeredgecolor (val); |
2124 else if (name.compare ("markerfacecolor")) | 2135 else if (name.compare ("markerfacecolor")) |
2125 markerfacecolor = val; | 2136 set_markerfacecolor (val); |
2126 else if (name.compare ("markersize")) | 2137 else if (name.compare ("markersize")) |
2127 markersize = val; | 2138 set_markersize (val); |
2128 | |
2129 else | 2139 else |
2130 { | 2140 { |
2131 modified = false; | 2141 modified = false; |
2132 warning ("set: invalid property `%s'", name.c_str ()); | 2142 warning ("set: invalid property `%s'", name.c_str ()); |
2133 } | 2143 } |
2140 patch::properties::get (void) const | 2150 patch::properties::get (void) const |
2141 { | 2151 { |
2142 Octave_map m; | 2152 Octave_map m; |
2143 | 2153 |
2144 m.assign ("type", type); | 2154 m.assign ("type", type); |
2145 m.assign ("parent", parent); | 2155 m.assign ("parent", parent.as_octave_value ()); |
2146 m.assign ("children", children); | 2156 m.assign ("children", children); |
2147 m.assign ("__modified__", __modified__); | 2157 m.assign ("__modified__", __modified__); |
2148 m.assign ("cdata", cdata); | 2158 m.assign ("cdata", cdata); |
2149 m.assign ("xdata", xdata); | 2159 m.assign ("xdata", xdata); |
2150 m.assign ("ydata", ydata); | 2160 m.assign ("ydata", ydata); |
2168 octave_value retval; | 2178 octave_value retval; |
2169 | 2179 |
2170 if (name.compare ("type")) | 2180 if (name.compare ("type")) |
2171 retval = type; | 2181 retval = type; |
2172 else if (name.compare ("parent")) | 2182 else if (name.compare ("parent")) |
2173 retval = parent; | 2183 retval = parent.as_octave_value (); |
2174 else if (name.compare ("children")) | 2184 else if (name.compare ("children")) |
2175 retval = children; | 2185 retval = children; |
2176 else if (name.compare ("__modified__")) | 2186 else if (name.compare ("__modified__")) |
2177 retval = __modified__; | 2187 retval = __modified__; |
2178 else if (name.compare ("cdata")) | 2188 else if (name.compare ("cdata")) |
2257 { | 2267 { |
2258 __modified__ = val.bool_value (); | 2268 __modified__ = val.bool_value (); |
2259 modified = false; | 2269 modified = false; |
2260 } | 2270 } |
2261 else if (name.compare ("xdata")) | 2271 else if (name.compare ("xdata")) |
2262 xdata = val; | 2272 set_xdata (val); |
2263 else if (name.compare ("ydata")) | 2273 else if (name.compare ("ydata")) |
2264 ydata = val; | 2274 set_ydata (val); |
2265 else if (name.compare ("zdata")) | 2275 else if (name.compare ("zdata")) |
2266 zdata = val; | 2276 set_zdata (val); |
2267 else if (name.compare ("keylabel")) | 2277 else if (name.compare ("keylabel")) |
2268 keylabel = val; | 2278 set_keylabel (val); |
2269 else | 2279 else |
2270 { | 2280 { |
2271 modified = false; | 2281 modified = false; |
2272 warning ("set: invalid property `%s'", name.c_str ()); | 2282 warning ("set: invalid property `%s'", name.c_str ()); |
2273 } | 2283 } |
2280 surface::properties::get (void) const | 2290 surface::properties::get (void) const |
2281 { | 2291 { |
2282 Octave_map m; | 2292 Octave_map m; |
2283 | 2293 |
2284 m.assign ("type", type); | 2294 m.assign ("type", type); |
2285 m.assign ("parent", parent); | 2295 m.assign ("parent", parent.as_octave_value ()); |
2286 m.assign ("children", children); | 2296 m.assign ("children", children); |
2287 m.assign ("__modified__", __modified__); | 2297 m.assign ("__modified__", __modified__); |
2288 m.assign ("xdata", xdata); | 2298 m.assign ("xdata", xdata); |
2289 m.assign ("ydata", ydata); | 2299 m.assign ("ydata", ydata); |
2290 m.assign ("zdata", zdata); | 2300 m.assign ("zdata", zdata); |
2299 octave_value retval; | 2309 octave_value retval; |
2300 | 2310 |
2301 if (name.compare ("type")) | 2311 if (name.compare ("type")) |
2302 retval = type; | 2312 retval = type; |
2303 else if (name.compare ("parent")) | 2313 else if (name.compare ("parent")) |
2304 retval = parent; | 2314 retval = parent.as_octave_value (); |
2305 else if (name.compare ("children")) | 2315 else if (name.compare ("children")) |
2306 retval = children; | 2316 retval = children; |
2307 else if (name.compare ("__modified__")) | 2317 else if (name.compare ("__modified__")) |
2308 retval = __modified__; | 2318 retval = __modified__; |
2309 else if (name.compare ("xdata")) | 2319 else if (name.compare ("xdata")) |
2577 return retval; | 2587 return retval; |
2578 } | 2588 } |
2579 | 2589 |
2580 static octave_value | 2590 static octave_value |
2581 make_graphics_object (const std::string& go_name, | 2591 make_graphics_object (const std::string& go_name, |
2582 const octave_value_list& args) | 2592 const octave_value_list& args) |
2583 { | 2593 { |
2584 octave_value retval; | 2594 octave_value retval; |
2585 | 2595 |
2586 double val = args(0).double_value (); | 2596 double val = args(0).double_value (); |
2587 | 2597 |
2588 if (! error_state) | 2598 if (! error_state) |
2589 { | 2599 { |
2590 graphics_handle parent = gh_manager::lookup (val); | 2600 graphics_handle parent = gh_manager::lookup (val); |
2591 | 2601 |
2592 if (! xisnan (parent)) | 2602 if (parent) |
2593 { | 2603 { |
2594 graphics_handle h | 2604 graphics_handle h |
2595 = gh_manager::make_graphics_handle (go_name, parent); | 2605 = gh_manager::make_graphics_handle (go_name, parent); |
2596 | 2606 |
2597 if (! error_state) | 2607 if (! error_state) |
2598 { | 2608 { |
2599 adopt (parent, h); | 2609 adopt (parent, h); |
2600 | 2610 |
2601 xset (h, args.splice (0, 1)); | 2611 xset (h, args.splice (0, 1)); |
2602 | 2612 |
2603 retval = h; | 2613 retval = h.value (); |
2604 } | 2614 } |
2605 else | 2615 else |
2606 error ("__go%s__: unable to create graphics handle", | 2616 error ("__go%s__: unable to create graphics handle", |
2607 go_name.c_str ()); | 2617 go_name.c_str ()); |
2608 } | 2618 } |
2633 { | 2643 { |
2634 graphics_handle h = gh_manager::lookup (val); | 2644 graphics_handle h = gh_manager::lookup (val); |
2635 | 2645 |
2636 xset (h, args.splice (0, 1)); | 2646 xset (h, args.splice (0, 1)); |
2637 | 2647 |
2638 retval = h; | 2648 retval = h.value (); |
2639 } | 2649 } |
2640 else | 2650 else |
2641 { | 2651 { |
2642 graphics_handle h = octave_NaN; | 2652 graphics_handle h = octave_NaN; |
2643 | 2653 |
2646 else if (val > 0 && D_NINT (val) == val) | 2656 else if (val > 0 && D_NINT (val) == val) |
2647 h = gh_manager::make_figure_handle (val); | 2657 h = gh_manager::make_figure_handle (val); |
2648 else | 2658 else |
2649 error ("__go_figure__: invalid figure number"); | 2659 error ("__go_figure__: invalid figure number"); |
2650 | 2660 |
2651 if (! (error_state || xisnan (h))) | 2661 if (! error_state && h) |
2652 { | 2662 { |
2653 adopt (0, h); | 2663 adopt (0, h); |
2654 | 2664 |
2655 xset (h, args.splice (0, 1)); | 2665 xset (h, args.splice (0, 1)); |
2656 | 2666 |
2657 retval = h; | 2667 retval = h.value (); |
2658 } | 2668 } |
2659 else | 2669 else |
2660 error ("__go_figure__: failed to create figure handle"); | 2670 error ("__go_figure__: failed to create figure handle"); |
2661 } | 2671 } |
2662 } | 2672 } |
2748 | 2758 |
2749 if (! error_state) | 2759 if (! error_state) |
2750 { | 2760 { |
2751 h = gh_manager::lookup (val); | 2761 h = gh_manager::lookup (val); |
2752 | 2762 |
2753 if (! xisnan (h)) | 2763 if (h) |
2754 { | 2764 { |
2755 graphics_object obj = gh_manager::get_object (h); | 2765 graphics_object obj = gh_manager::get_object (h); |
2756 | 2766 |
2757 graphics_handle parent_h = obj.get_parent (); | 2767 graphics_handle parent_h = obj.get_parent (); |
2758 | 2768 |
2802 | 2812 |
2803 if (! error_state) | 2813 if (! error_state) |
2804 { | 2814 { |
2805 h = gh_manager::lookup (val); | 2815 h = gh_manager::lookup (val); |
2806 | 2816 |
2807 if (! xisnan (h)) | 2817 if (h) |
2808 { | 2818 { |
2809 graphics_object obj = gh_manager::get_object (h); | 2819 graphics_object obj = gh_manager::get_object (h); |
2810 | 2820 |
2811 obj.set_defaults (mode); | 2821 obj.set_defaults (mode); |
2812 } | 2822 } |