comparison src/graphics.cc @ 6425:0cc5ca7b1e91

[project @ 2007-03-21 15:57:19 by jwe]
author jwe
date Wed, 21 Mar 2007 15:57:19 +0000
parents 05a48d6cf163
children 5bec61ae1576
comparison
equal deleted inserted replaced
6424:05a48d6cf163 6425:0cc5ca7b1e91
699 static graphics_handle current_figure (void) 699 static graphics_handle current_figure (void)
700 { 700 {
701 return instance_ok () ? instance->do_current_figure () : octave_NaN; 701 return instance_ok () ? instance->do_current_figure () : octave_NaN;
702 } 702 }
703 703
704 static Matrix list (void) 704 static Matrix handle_list (void)
705 { 705 {
706 return instance_ok () ? instance->do_list () : Matrix (); 706 return instance_ok () ? instance->do_handle_list () : Matrix ();
707 }
708
709 static Matrix figure_handle_list (void)
710 {
711 return instance_ok () ? instance->do_figure_handle_list () : Matrix ();
707 } 712 }
708 713
709 private: 714 private:
710 715
711 static gh_manager *instance; 716 static gh_manager *instance;
798 graphics_handle do_make_graphics_handle (const std::string& go_name, 803 graphics_handle do_make_graphics_handle (const std::string& go_name,
799 const graphics_handle& p); 804 const graphics_handle& p);
800 805
801 graphics_handle do_make_figure_handle (double val); 806 graphics_handle do_make_figure_handle (double val);
802 807
803 Matrix do_list (void) 808 Matrix do_handle_list (void)
804 { 809 {
805 Matrix retval (1, handle_map.size ()); 810 Matrix retval (1, handle_map.size ());
806 octave_idx_type i = 0; 811 octave_idx_type i = 0;
807 for (const_iterator p = handle_map.begin (); p != handle_map.end (); p++) 812 for (const_iterator p = handle_map.begin (); p != handle_map.end (); p++)
808 retval(i++) = p->first; 813 retval(i++) = p->first;
814 return retval;
815 }
816
817 Matrix do_figure_handle_list (void)
818 {
819 Matrix retval (1, figure_list.size ());
820 octave_idx_type i = 0;
821 for (const_figure_list_iterator p = figure_list.begin ();
822 p != figure_list.end ();
823 p++)
824 retval(i++) = *p;
809 return retval; 825 return retval;
810 } 826 }
811 827
812 void do_push_figure (const graphics_handle& h); 828 void do_push_figure (const graphics_handle& h);
813 829
1335 gripe_set_invalid ("currentaxes"); 1351 gripe_set_invalid ("currentaxes");
1336 } 1352 }
1337 else if (name.compare ("colormap")) 1353 else if (name.compare ("colormap"))
1338 colormap = colormap_property (val); 1354 colormap = colormap_property (val);
1339 else if (name.compare ("visible")) 1355 else if (name.compare ("visible"))
1340 visible = val; 1356 {
1357 std::string s = val.string_value ();
1358
1359 if (! error_state)
1360 {
1361 if (s == "on")
1362 xset (0, "currentfigure", __myhandle__);
1363
1364 visible = val;
1365 }
1366 }
1341 else if (name.compare ("paperorientation")) 1367 else if (name.compare ("paperorientation"))
1342 paperorientation = val; 1368 paperorientation = val;
1343 else 1369 else
1344 warning ("set: invalid property `%s'", name.c_str ()); 1370 warning ("set: invalid property `%s'", name.c_str ());
1345 } 1371 }
3413 "-*- texinfo -*-\n\ 3439 "-*- texinfo -*-\n\
3414 @deftypefn {Built-in Function} {} __go_handles__ ()\n\ 3440 @deftypefn {Built-in Function} {} __go_handles__ ()\n\
3415 Return current list of function handles.\n\ 3441 Return current list of function handles.\n\
3416 @end deftypefn") 3442 @end deftypefn")
3417 { 3443 {
3418 return octave_value (gh_manager::list ()); 3444 return octave_value (gh_manager::handle_list ());
3445 }
3446
3447 DEFUN (__go_figure_handles__, , ,
3448 "-*- texinfo -*-\n\
3449 @deftypefn {Built-in Function} {} __go_figure_handles__ ()\n\
3450 Return current list of function handles.\n\
3451 @end deftypefn")
3452 {
3453 return octave_value (gh_manager::figure_handle_list ());
3419 } 3454 }
3420 3455
3421 /* 3456 /*
3422 ;;; Local Variables: *** 3457 ;;; Local Variables: ***
3423 ;;; mode: C++ *** 3458 ;;; mode: C++ ***