[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with printing plots
From: |
Ben Abbott |
Subject: |
Re: Problem with printing plots |
Date: |
Sat, 10 Mar 2012 10:51:54 -0500 |
On Mar 10, 2012, at 3:44 AM, Michael Goffioul wrote:
> 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.
Nice. I hadn't noticed the resize method before, and wouldn't have realized it
could be used to copy a 1x2 octave_value into a 1x3 octave_value.
The attached works for me. Ok to push ?
Ben
changeset.patch
Description: Binary data
- Re: Problem with printing plots, (continued)
- Re: Problem with printing plots, Ben Abbott, 2012/03/09
- Re: Problem with printing plots, Ben Abbott, 2012/03/09
- Re: Problem with printing plots, Ben Abbott, 2012/03/09
- Re: Problem with printing plots, Michael Goffioul, 2012/03/09
- Re: Problem with printing plots, Ben Abbott, 2012/03/09
- Re: Problem with printing plots, Ben Abbott, 2012/03/09
- Re: Problem with printing plots, Michael Goffioul, 2012/03/09
- Re: Problem with printing plots, Ben Abbott, 2012/03/09
- Re: Problem with printing plots, Ben Abbott, 2012/03/09
- Re: Problem with printing plots, Michael Goffioul, 2012/03/10
- Re: Problem with printing plots,
Ben Abbott <=
- Re: Problem with printing plots, Michael Goffioul, 2012/03/10
- Re: Problem with printing plots, Ben Abbott, 2012/03/10
- Re: Problem with printing plots, Michael Goffioul, 2012/03/10
- Re: Problem with printing plots, Ben Abbott, 2012/03/10
- Re: Problem with printing plots, logari81, 2012/03/12
- Re: Problem with printing plots, Jordi GutiƩrrez Hermoso, 2012/03/10
- Re: Problem with printing plots, Michael Goffioul, 2012/03/09