denemo-devel
[Top][All Lists]
Advanced

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

Re: [Denemo-devel] The thumbnailer


From: Éloi Rivard
Subject: Re: [Denemo-devel] The thumbnailer
Date: Wed, 15 Jan 2014 19:03:58 +0100

My separation makes sense: everything that is related to Gtk should NOT be part of the model. Else you could not use your model without initializing Gtk, and that would mean that separation between the model and the view is not correctly done.

Now I understand this is not how Denemo is built, I saw that for example when I replaced several gtk_tree_view by some g_hash_table.
If we can use GtkTextBuffer without initializing Gtk, we can probably do something here.
But if GtkTextBuffer needs gtk to be initialized, we are facing a problem here, because non interactive mode just don't initialize Gtk. I can see several solutions :
- Initialize Gtk even in non interactive mode. A bad idea I think, because it would mean that we get rid of travis, and it would prevent denemo to be used to do some batch processing in machines that don't have graphic interface.
- Make thumbnail generation a special case where Gtk is actually initalized, but the graphical interface is not.
- Use an Gtk independant structure to store the lilypond code. I think that would be the cleaner way.


2014/1/15 Richard Shann <address@hidden>
On Wed, 2014-01-15 at 10:03 +0100, Éloi Rivard wrote:
> To fit the MVC (this is very basic software design) I believe it is
> not a good idea to use anything that directly depends on Gtk in the
> model (i.e. in structures present in include/*.h). Simply to keep the
> principle of separating GUI and real data, and because in the case we
> need to use Denemo without a GUI it becomes problematic.
>
>
> I did not deeply looked at this part of the code, so I am not sure.
> Don't you think Denemo.textbuffer can be transformed as a gchar*, and
> be synchronized with a GtkTextBuffer (or GtkSourceView) that would be
> internal to exportlilypond.c ?

I think you have made the division between model and view at the wrong
place. The GtkTextBuffer is part of the model: it is derived from the
main model data located in the DenemoMovements by computing bits of
LilyPond syntax for data in the DenemoMovement and associating them with
links to the relevant structures in the DenemoMovement. The resultant
structure, the GtkTextBuffer, is then used as the model for the
GtkTextView and that is the view bit you would not want when going
non-interactive.
If you just had the LilyPond text (which is extracted from the
GtkTextBuffer by removing all the link data) then you would not be able
to re-construct the GtkTextBuffer.

Richard

>
>
>
> 2014/1/14 Richard Shann <address@hidden>
>         On Tue, 2014-01-14 at 17:34 +0100, Éloi Rivard wrote:
>
>         > Do you know why Denemo.textbuffer is a GtkTextBuffer and not
>         a simple
>         > gchar* ?
>
>
>         See:
>
>         src/exportlilypond.c:   gtk_text_view_set_buffer
>         (GTK_TEXT_VIEW
>         (Denemo.textview), Denemo.textbuffer);
>
>         and much else ... it just *is* a GtkTextBuffer for all the
>         reasons that
>         a GtkTextView requires. What would be an interesting project
>         is to merge
>         this as a GtkSourceView so that the LilyPond code could
>         benefit from
>         syntax highlighting, line numbering etc. There could be
>         serious problems
>         though with the GtkAnchors embedded to navigate from PDF to
>         Denemo.
>
>         Richard
>
>
>         >
>         > 2014/1/14 Éloi Rivard <address@hidden>
>         >         Ok I did not know that. I get those warnings with
>         this
>         >         command:
>         >         src/denemo -n --verbose -a "(d-CreateThumbnail
>         #f)(d-Exit)"
>         >         tests/integration-data/blank.denemo
>         >
>         >
>         >
>         >         2014/1/14 Richard Shann <address@hidden>
>         >                 On Tue, 2014-01-14 at 16:27 +0100, Éloi
>         Rivard wrote:
>         >                 > 2014/1/14 Richard Shann
>         <address@hidden>
>         >                 >         The thumbnailer (run on exit from
>         denemo) is
>         >                 now throwing up a
>         >                 >         warning
>         >                 >         dialog saying "No text buffer"
>         when it runs.
>         >                 > Do you mean it is ran each time you quit
>         denemo ?
>         >
>         >
>         >                 It should run every time you close a file
>         which does
>         >                 not have an
>         >                 up-to-date thumbnail. I haven't checked that
>         this is
>         >                 still working, but
>         >                 as thumbnails haven't been working for a
>         while nearly
>         >                 every file I close
>         >                 provokes this.
>         >
>         >                 Richard
>         >
>         >
>         >
>         >
>         >
>         >
>         >
>         >         --
>         >         Éloi Rivard - address@hidden
>         >
>         >         « On perd plus à être indécis qu'à se tromper. »
>         >
>         >
>         >
>         >
>         > --
>         > Éloi Rivard - address@hidden
>         >
>         > « On perd plus à être indécis qu'à se tromper. »
>         >
>
>
>
>
>
>
> --
> Éloi Rivard - address@hidden
>
> « On perd plus à être indécis qu'à se tromper. »
>





--
Éloi Rivard - address@hidden
       
« On perd plus à être indécis qu'à se tromper. »

reply via email to

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