octave-maintainers
[Top][All Lists]
Advanced

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

Re: Problem with printing plots


From: Michael Goffioul
Subject: Re: Problem with printing plots
Date: Sat, 10 Mar 2012 08:44:21 +0000

On Sat, Mar 10, 2012 at 1:41 AM, Ben Abbott <address@hidden> wrote:
>> The attached passed a few tests for me, but I suspect it is ugly to those 
>> with c++ skills.
>>
>> Critiques welcome :-)
>>
>> Ben
>>
>> <changeset.patch>
>
> This change breaks the synchronization of the axes position.
>
> To see the effect run the legend demos.

I think your patch is a bit too complicated and misses a few things,
especially running automatic updaters. The easiest is to start from
the auto-generated code (did you have a look at it?):

  void set_position (const octave_value& val)
  {
    if (! error_state)
      {
        if (position.set (val, false))
          {
            set_positionmode ("manual");
            update_position ();
            position.run_listeners (POSTSET);
            mark_modified ();
          }
        else
          set_positionmode ("manual");
      }
  }

As you can see, you're missing calling update_position() and
set_positionmode(). I can;t test at the moment, but what I'd do is
something like this:

  void set_position (const octave_value& val)
  {
    if (! error_state)
      {
        octave_value new_val (val);

        if (new_val.numel () == 2)
          {
            dim_vector dv (1, 3);

            new_val = new_val.resize (dv, true);
          }

        if (position.set (new_val, false))
          {
            set_positionmode ("manual");
            update_position ();
            position.run_listeners (POSTSET);
            mark_modified ();
          }
        else
          set_positionmode ("manual");
      }
  }

Michael.


reply via email to

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