octave-maintainers
[Top][All Lists]
Advanced

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

Re: fltk printing


From: Shai Ayal
Subject: Re: fltk printing
Date: Sun, 8 Aug 2010 06:04:32 +0300

On Sun, Aug 8, 2010 at 5:34 AM, Shai Ayal <address@hidden> wrote:
> On Sun, Aug 8, 2010 at 4:40 AM, Ben Abbott <address@hidden> wrote:
>> On Aug 7, 2010, at 8:16 PM, Ben Abbott wrote:
>>
>>> On Aug 7, 2010, at 8:00 PM, Dmitri A. Sergatskov wrote:
>>>
>>>> On Sat, Aug 7, 2010 at 6:37 PM, Michael D Godfrey
>>>> <address@hidden> wrote:
>>>>
>>>>> It may be good to look at the drawnow code.
>>>>>
>>>>
>>>> Here is some interesting test:
>>>>
>>>> # drawnowt.m
>>>> backend("fltk");
>>>> plot(1:2);
>>>> drawnow("eps","junk111.eps");
>>>>
>>>> running
>>>> octave < drawnowt.m
>>>>
>>>> results in:
>>>>
>>>> warning: implicit conversion from matrix to sq_string
>>>> error: fltk_backend: could not recognize fltk index
>>>> error: called from:
>>>> error:   /home/dima/src/octave/scripts/miscellaneous/delete.m at line
>>>> 48, column 1
>>>> error:   /home/dima/src/octave/scripts/plot/closereq.m at line 37, column 7
>>>> error:   /home/dima/src/octave/scripts/plot/close.m at line 63, column 5
>>>> error:   /home/dima/src/octave/scripts/plot/close.m at line 77, column 1
>>>> error:   /home/dima/src/octave/scripts/plot/close.m at line 57, column 5
>>>> error:   /home/dima/src/octave/scripts/plot/__go_close_all__.m at line
>>>> 27, column 3
>>>>
>>>> If I add at the end of the test file "pause(0)" it finishes correctly.
>>>> That suggests me that drawnow spawns some  asynchronous processes.
>>>>
>>>>> Michael
>>>>>
>>>>>
>>>>
>>>> Sincerely,
>>>>
>>>> Dmitri.
>>>> --
>>>
>>> Very strange ... The error doesn't give any indication of your test file, 
>>> drawnowt.m.
>>>
>>> I can'f find any instance where __go_close_all__ is called in the sources.
>>>
>>> I tried you example on MacOS X, and as expected, no error.
>>>
>>> Ben
>>
>> sigh : -( ... my bad. __go_close_all__ can be called by drawnow() in 
>> graphics.cc (I had misplaced a trust in MacOS X's finder).
>>
>> >From graphics .cc ...
>>
>> 5775 DEFUN (drawnow, args, ,
>> 5776    "-*- texinfo -*-\n\
>> 5777 @deftypefn  {Built-in Function} {} drawnow ()\n\
>> 5778 @deftypefnx {Built-in Function} {} drawnow (\"expose\")\n\
>> 5779 @deftypefnx {Built-in Function} {} drawnow (@var{term}, @var{file}, 
>> @var{mono}, @var{debug_file})\n\
>> 5780 Update figure windows and their children.  The event queue is flushed 
>> and\n\
>> 5781 any callbacks generated are executed.  With the optional argument\n\
>> 5782 @code{\"expose\"}, only graphic objects are updated and no other events 
>> or\n\
>> 5783 callbacks are processed.\n\
>> 5784 The third calling form of @code{drawnow} is for debugging and is\n\
>> 5785 undocumented.\n\
>> 5786 @end deftypefn")
>> 5787 {
>> 5788   static int drawnow_executing = 0;
>> 5789   static bool __go_close_all_registered__ = false;
>> 5790
>> 5791   octave_value retval;
>> 5792
>> 5793   gh_manager::lock ();
>> 5794
>> 5795   unwind_protect frame;
>> 5796   frame.protect_var (Vdrawnow_requested, false);
>> 5797
>> 5798   frame.protect_var (drawnow_executing);
>> 5799
>> 5800   if (++drawnow_executing <= 1)
>> 5801     {
>> 5802       if (! __go_close_all_registered__)
>> 5803         {
>> 5804           octave_add_atexit_function ("__go_close_all__");
>> 5805
>> 5806           __go_close_all_registered__ = true;
>> 5807         }
>>
>> The function __go_close_all__ is trivial
>>
>>        function __go_close_all__ ()
>>          close ("all", "hidden");
>>        endfunction
>>
>> As a simple check, I added `disp ("__go_close_all__")' to the end of 
>> __go_close_all__.m
>>
>> When I try ...
>>
>>        plot (1:10)
>>        print test.pdf
>>
>> ... there is no indication that __go_close_all__ is called.
>>
>> My understanding is that the function octave_add_atexit_function, registers 
>> "__go_close_all__" to be called when Octave exits. Additional functions may 
>> be registered using `atexit ("foobar")' from the command line. I created a 
>> function ...
>>
>>        function foobar ()
>>          disp ("Bye World")
>>          pause ()
>>        endfunction
>>
>> .... then entered the command `atexit ("foobar")'. When I exit octave I get 
>> "__go_close_all__", and "Bye World", with the pause.
>>
>> When I use the print function ...
>>
>>        close all
>>        backend fltk
>>        plot (1:10)
>>        print test.pdf
>>
>> ... I get neither "__go_close_all__" or "Bye World" (I do get a correct 
>> test.pdf).
>>
>> Dimitri / Michael,
>>
>> If you add `'disp("__go_close_all__")'  to __go_close_all__, create the my 
>> foobar.m function add type `atexit ("foobar")' at the command line, what 
>> happens when you ...
>>
>>        close all
>>        backend fltk
>>        plot (1:10)
>>        print test.pdf
>>
>> Ben
>
> I'm sorry to stir up all of this work. If you just waited until I woke up ....
>
> Anyway, this is totally the fltk_backend's fault.
> fltk is very good -- it will not redraw if it doesn't really have to--
> e.g. if the figure window is minimized, it will not redraw. I am not
> 100% sure how to force it to redraw. It's a long standing issue for
> me. I'll ask on the fltk mailing list
>
> Shai
>
Until fltk answers, I've pushed a small changeset which should make
things better, although it does not work in all cases (e.g. on my
debian, if the figure window is minimized, no file is produced)

Shai



reply via email to

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