|
From: | Ben Abbott |
Subject: | Re: where to initialized property defaults? |
Date: | Sat, 03 Jan 2009 18:43:46 -0500 |
Shai Thanks! I'll study those examples. Ben On Jan 3, 2009, at 4:58 PM, Shai Ayal wrote:
I'm not sure either, but lloking at graphics.h.in I can see two options (Maybe Michael has a better way): the "init" member of the property as is done in: http://hg.savannah.gnu.org/hgweb/octave/file/cc3ac5eb6be3/src/graphics.h.in#2384 or by calling a special function to initialise it, as is done in: http://hg.savannah.gnu.org/hgweb/octave/file/cc3ac5eb6be3/src/graphics.h.in#2334 Shai On Sat, Jan 3, 2009 at 11:00 PM, Ben Abbott <address@hidden> wrote:Shai, Thanks for the prompt reply.When you have a moment, please look at setting a default for a vector, suchas root.screensize.I don't see how to initialize the values unless they each have the samevalue. I'd like to do something like ...set (0, "screensize", [1, 1, 1440, 900])... but I don't see how. Ben On Jan 3, 2009, at 2:31 PM, Shai Ayal wrote:Ben, The place to set default properties is in src/graphics.h.in. properties are defined and assigned default values inside BEGIN_PROPERTIES/END_PROPERTIES blocks for each graphics object type (e.g. figure, axes, etc...). these are system-wide defaults and are not backend dependant. As you noticed, the root figure was neglected during our work and has very little properties. Anyway, you can find examples of how to specify properties and their values in the file, just look at axes and figure. You can also add more elaborate inital values in the init member for each object. The graphics.h.in file is parsed by the genprops.awk script during compile to produce the actual graphics.h and the graphics-props.cc files which contain the definitions for the properties plus all the appropriate get/set functions. The awk script also has some documentation inside. Shai p.s. sorry for not being able to contribute more than pointers ... On Sat, Jan 3, 2009 at 9:10 PM, Ben Abbott <address@hidden> wrote:Michael/Shai, I've copied you specifically because of your work on thebackend.I've been investing some effort improving the gnuplot backend's supportof root/figure/axes/text/etc properties. One rather significant difficulty is where/how many of the default property values are to be set.In graphics.h.in it is simple enough to initialize each index of vector associated with a property to a scalar value ... but what is to be donewithproperties like figure.papersize, figure.paperposition, root.screensize,In my octaverc I set several property defaults. See below ... if compare_versions (version, "3.1.0", ">=") set (0, "defaultaxesfontname", "Helvetica") set (0, "defaultaxesfontsize", 14) set (0, "defaultaxesinterpreter", "tex") set (0, "defaultaxesxtick", [0:0.2:1]) set (0, "defaultaxesytick", [0:0.2:1]) set (0, "defaultaxesztick", [0:0.2:1]) set (0, "defaultaxesxtickmode", "auto") set (0, "defaultaxesytickmode", "auto") set (0, "defaultaxesztickmode", "auto") set (0, "defaultaxesactivepositionproperty", "outerposition") set (0, "defaultfigurepapertype", "usletter") set (0, "defaultfigurepapersize", [8.5 11]) set (0, "defaultfigureposition", [440 314 560 420]) set (0, "defaultfigurepaperposition", [0.25, 2.5, 8, 6]) set (0, "screensize", [1, 1, 1440, 900]) set (0, "screenpixelsperinch", 1440/14) edit editinplace true edit home . endifThis should obviously be done at a lower level. Some of this is alreadybeing handled in gnuplot_drawnow.m.I'm not sure where, or how, such defaults should be set in the sources,but having gnuplot_drawnow.m handle it is obviously bad practice.Might someone be up to the task of taking this on, or offering guidanceforthe c++ deficient like myself? I don't see where in the sources xlim,ylim are set, so perhaps this is already in place for axes? Ben
[Prev in Thread] | Current Thread | [Next in Thread] |