octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [changeset] Missing ScreenSize & ScreenPixelsPerInch properties


From: Ben Abbott
Subject: Re: [changeset] Missing ScreenSize & ScreenPixelsPerInch properties
Date: Thu, 13 Nov 2008 07:53:29 -0500

On Nov 12, 2008, at 11:47 PM, Shai Ayal wrote:

properties are defined in src/graphics.h.in thsi file is preprocessed
by the genprops.awk script to produce graphics.h
you properties are defined between BEGIN_PROPERTIES/END_PROPERTIES
line.s Each object type has these (e.g. there is a pair for
figure/axes/....) the properties are defined there and you can add
properties and define their initial value there

Shai

Thanks Shai!

This changeset adds the properties "screensize" and "screenpixelsperinch" to the root object.

To set the property values local to my machine I've added the lines below to my ~/.octaverc

        set (0, "screensize", [1 1 1440 900])
        set (0, "screenpixelsperinch", 74.951])

Those value correspond to my Mac PowerBook. The defaults should probably be;

        set (0, "screensize", [1 1 1024 768])
        set (0, "screenpixelsperinch", 72])

One other change I've included is to make the figure property "papersize" writable.

< 2354       array_property papersize r , Matrix (1, 2, 0)
> 2354       array_property papersize , Matrix (1, 2, 0)

I need that so to allow users to specify custom pagersizes for printing. By that I imply that I'll follow up with a changeset for the gnuplot backend which respects the figure size (i.e. position(3:4)) for x11, aqua, windows, etc, and respects the papersize when printing.

As there is no low level capability to translate changes in size/type to their recpective type/size, I thought I'd add a short term solution to gnuplot_drawnow and make sure it doesn't break print(). My solution to do this translation is below.

papertypes = {"usletter", "uslegal",
              "a0", "a1", "a2", "a3", "a4", "a5",
              "b0", "b1", "b2", "b3", "b4", "b5",
              "arch-a", "arch-b", "arch-c", "arch-d", "arch-e",
              "a", "b", "c", "d", "e",
              "tabloid", "<custom>"};
papersizes = [ 8.500,  8.500
              33.135, 23.404
              16.548, 11.694
               8.268,  5.847
              40.543, 28.683
              20.252, 14.342
              10.126,  7.171
               9.000, 12.000
              18.000, 24.000
              36.000,  8.500
              11.000, 17.000
              22.000, 34.000
              11.000,  8.500
              11.000, 14.000
              46.847, 33.135
              23.404, 16.528
              11.693,  8.264
              57.366, 40.503
              28.683, 20.252
              14.342, 10.126
              12.000, 18.000
              24.000, 36.000
              48.000, 11.000
              17.000, 22.000
              34.000, 44.000
              17.000, 11.000];

if (strcmpi (get (h, "papertype"), "<custom>"))
## if the type is custom but the size is a standard, then set the standard type.
  papersize = get (h, "papersize");
n = find (all (round (1000 * ones ([size(papersizes, 1), 1]) * papersize) - 1000 * papersizes) == 0, 2));
  if (! isempty (n))
    set (h, "papertype", papertypes{n});
  endif
else
  n = strcmpi (papertypes, get (h, "papertype"));
  set (h, "papersize", papersizes(n,:));
endif

Once the low level functionality is in place, this should be removed.

Ben


Attachment: screensize.patch
Description: Binary data



reply via email to

[Prev in Thread] Current Thread [Next in Thread]