[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Changeset]: Re: cla() ?
From: |
Michael Goffioul |
Subject: |
Re: [Changeset]: Re: cla() ? |
Date: |
Tue, 7 Oct 2008 15:10:39 +0200 |
While we're talking about __go_delete__, does anybody
remember what was the idea behind removing an object
from its parent's children in __go_delete__, instead of
gh_manager::free? This makes life slighlty more complex
if you want to delete an object from C++, where you would
typically use gh_manager::free, but you then have to remove
the child manually from its parent's children.
I don't think I wrote that part of the code, and I can't figure
out why it is written that way.
Michael.
On Tue, Oct 7, 2008 at 2:55 PM, David Bateman
<address@hidden> wrote:
> # HG changeset patch
> # User David Bateman <address@hidden>
> # Date 1223382217 -3600
> # Node ID 7c81fecfe3f081b7926c7c6635484329f62a7a4c
> # Parent ec94fee5e23488f98dd45d36d5535024446a0be7
> Allow arrays of graphic handles to F__go_delete__
>
> diff --git a/src/ChangeLog b/src/ChangeLog
> --- a/src/ChangeLog
> +++ b/src/ChangeLog
> @@ -1,3 +1,7 @@
> +2008-10-07 David Bateman <address@hidden>
> +
> + * graphics.cc (F__go_delete__): Allow arrays of graphic handles
> +
> 2008-10-01 Jaroslav Hajek <address@hidden>
>
> * OPERATORS/op-i64-i64.cc: Instantiate all 64-bit operations.
> diff --git a/src/graphics.cc b/src/graphics.cc
> --- a/src/graphics.cc
> +++ b/src/graphics.cc
> @@ -4419,32 +4419,40 @@
> {
> graphics_handle h = octave_NaN;
>
> - double val = args(0).double_value ();
> -
> - if (! error_state)
> - {
> - h = gh_manager::lookup (val);
> -
> - if (h.ok ())
> - {
> - graphics_object obj = gh_manager::get_object (h);
> -
> - graphics_handle parent_h = obj.get_parent ();
> -
> - graphics_object parent_obj = gh_manager::get_object
> (parent_h);
> -
> - // NOTE: free the handle before removing it from its parent's
> - // children, such that the object's state is correct
> when
> - // the deletefcn callback is executed
> -
> - gh_manager::free (h);
> -
> - parent_obj.remove_child (h);
> -
> - Vdrawnow_requested = true;
> - }
> - else
> - error ("delete: invalid graphics object (= %g)", val);
> + const NDArray vals = args (0).array_value ();
> +
> + if (! error_state)
> + {
> + for (octave_idx_type i = 0; i < vals.numel (); i++)
> + {
> + h = gh_manager::lookup (vals.elem (i));
> +
> + if (h.ok ())
> + {
> + graphics_object obj = gh_manager::get_object (h);
> +
> + graphics_handle parent_h = obj.get_parent ();
> +
> + graphics_object parent_obj =
> + gh_manager::get_object (parent_h);
> +
> + // NOTE: free the handle before removing it from its
> parent's
> + // children, such that the object's state is correct
> + // when the deletefcn callback is executed
> +
> + gh_manager::free (h);
> +
> + parent_obj.remove_child (h);
> +
> + Vdrawnow_requested = true;
> + }
> + else
> + {
> + error ("delete: invalid graphics object (= %g)",
> + vals.elem (i));
> + break;
> + }
> + }
> }
> else
> error ("delete: invalid graphics object");
>
>
- Re: [Changeset]: delete (vector), (continued)
- Re: [Changeset]: delete (vector), Michael Goffioul, 2008/10/07
- Re: [Changeset]: Re: cla() ?, Ben Abbott, 2008/10/06
- Re: [Changeset]: Re: cla() ?, John W. Eaton, 2008/10/06
- Re: [Changeset]: Re: cla() ?, Ben Abbott, 2008/10/06
- Re: [Changeset]: Re: cla() ?, Ben Abbott, 2008/10/06
- Re: [Changeset]: Re: cla() ?, John W. Eaton, 2008/10/06
- Re: [Changeset]: Re: cla() ?, Michael Goffioul, 2008/10/07
- Re: [Changeset]: Re: cla() ?, Ben Abbott, 2008/10/07
- Re: [Changeset]: Re: cla() ?, Michael Goffioul, 2008/10/07
- Re: [Changeset]: Re: cla() ?, David Bateman, 2008/10/07
- Re: [Changeset]: Re: cla() ?,
Michael Goffioul <=
- Re: [Changeset]: Re: cla() ?, Ben Abbott, 2008/10/07
- Strange handle behavior (was Re: [Changeset]: Re: cla() ?), Ben Abbott, 2008/10/07
- Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?), Søren Hauberg, 2008/10/08
- Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?), Ben Abbott, 2008/10/08
- Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?), Michael Goffioul, 2008/10/08
- Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?), Ben Abbott, 2008/10/08
- Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?), John W. Eaton, 2008/10/08
- Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?), Michael Goffioul, 2008/10/08
- Re: Strange handle behavior (was Re: [Changeset]: Re: cla() ?), John W. Eaton, 2008/10/08
- Re: [Changeset]: Re: cla() ?, John W. Eaton, 2008/10/08