Mercurial > octave-nkf
comparison src/graphics.cc @ 7860:67edbcb19665
rudimentry (i.e. no font metrics) sync of axes.position and axes.outerposition
* * *
preserve axes position if mode is replace
* * *
use default_axes_postion when syncing outerposition and position
* * *
Update transformation matrices when axes position changes.
author | Shai Ayal <shaiay@users.sourceforge.net> |
---|---|
date | Fri, 14 Mar 2008 21:02:16 +0200 |
parents | fdd465b00ec0 |
children | 8f3459a90bf3 |
comparison
equal
deleted
inserted
replaced
7859:fdd465b00ec0 | 7860:67edbcb19665 |
---|---|
169 m(1) = 200; | 169 m(1) = 200; |
170 m(2) = 560; | 170 m(2) = 560; |
171 m(3) = 420; | 171 m(3) = 420; |
172 return m; | 172 return m; |
173 } | 173 } |
174 | |
175 | |
174 | 176 |
175 static void | 177 static void |
176 xset_gcbo (const graphics_handle& h) | 178 xset_gcbo (const graphics_handle& h) |
177 { | 179 { |
178 graphics_object go = gh_manager::get_object (0); | 180 graphics_object go = gh_manager::get_object (0); |
1819 return retval; | 1821 return retval; |
1820 } | 1822 } |
1821 | 1823 |
1822 // --------------------------------------------------------------------- | 1824 // --------------------------------------------------------------------- |
1823 | 1825 |
1826 void | |
1827 axes::properties::sync_positions (void) | |
1828 { | |
1829 // FIXME -- this should take font metrics into consideration, | |
1830 // for now we'll just make it position 90% of outerposition | |
1831 if (activepositionproperty.is ("outerposition")) | |
1832 { | |
1833 Matrix outpos = outerposition.get ().matrix_value (); | |
1834 Matrix defpos = default_axes_position (); | |
1835 Matrix pos(outpos); | |
1836 pos(0) = outpos(0) + defpos(0) * outpos(2); | |
1837 pos(1) = outpos(1) + defpos(1) * outpos(3); | |
1838 pos(2) = outpos(2) * defpos(2); | |
1839 pos(3) = outpos(3) * defpos(3); | |
1840 position = pos; | |
1841 } | |
1842 else | |
1843 { | |
1844 Matrix pos = position.get ().matrix_value (); | |
1845 pos(0) -= pos(2)*0.05; | |
1846 pos(1) -= pos(3)*0.05; | |
1847 pos(2) *= 1.1; | |
1848 pos(3) *= 1.1; | |
1849 outerposition = pos; | |
1850 } | |
1851 | |
1852 update_transform (); | |
1853 } | |
1854 | |
1824 void | 1855 void |
1825 axes::properties::set_title (const octave_value& v) | 1856 axes::properties::set_title (const octave_value& v) |
1826 { | 1857 { |
1827 graphics_handle val = ::reparent (v, "set", "title", __myhandle__, false); | 1858 graphics_handle val = ::reparent (v, "set", "title", __myhandle__, false); |
1828 | 1859 |
1871 | 1902 |
1872 void | 1903 void |
1873 axes::properties::set_defaults (base_graphics_object& obj, | 1904 axes::properties::set_defaults (base_graphics_object& obj, |
1874 const std::string& mode) | 1905 const std::string& mode) |
1875 { | 1906 { |
1876 position = default_axes_position (); | |
1877 title = graphics_handle (); | 1907 title = graphics_handle (); |
1878 box = "on"; | 1908 box = "on"; |
1879 key = "off"; | 1909 key = "off"; |
1880 keybox = "off"; | 1910 keybox = "off"; |
1881 keypos = 1.0; | 1911 keypos = 1.0; |
1974 { | 2004 { |
1975 Matrix touterposition (1, 4, 0.0); | 2005 Matrix touterposition (1, 4, 0.0); |
1976 touterposition(2) = 1; | 2006 touterposition(2) = 1; |
1977 touterposition(3) = 1; | 2007 touterposition(3) = 1; |
1978 outerposition = touterposition; | 2008 outerposition = touterposition; |
2009 | |
2010 position = default_axes_position (); | |
1979 } | 2011 } |
1980 | 2012 |
1981 activepositionproperty = "outerposition"; | 2013 activepositionproperty = "outerposition"; |
1982 __colorbar__ = "none"; | 2014 __colorbar__ = "none"; |
1983 | 2015 |