On Wed, Oct 20, 2010 at 11:00:46AM +0200, Andre Poenitz wrote:
> I think the necessity of bidirectional core-gui communication would
> be gone, if the core were driven by the gui, not the other way round:
> 
> In core (pseudo code):
> 
>     Result Buffer::export(File file)
>     {
>         // No Gui code here.
>         if (file.exists())
>             return FileExistsError;
>         doTheExport();
>         return EverythingOk;
>     }
> 
> In gui:
> 
>     void Foo::export(File file)
>     {
>         if (file.exists()) {
>             ConfirmOverwriteDialog dialog;
>             if (dialog.exec() == NotConfirmed)
>                 return;
>             file.remove();
>         }
>         if (buffer.export() != EverythingOk) {
>             ProblemDialog dialog;
>             dialog.exec(); 
>         }
>     }
> 
> and in the server:
> 
>     void Bar::export(File)
>     {
>         if (file.exists()) {
>             if (!forceFlagWasGiven())
>                 return FileExistsError;
>             file.remove();
>         }
>         if (buffer.export() != EverythingOk)
>             bark();
>     }
> 

It is a bit more complicated than that. For example, if you export to
latex, every bitmap graphics is converted to eps and, if an eps with
same name exists, LyX tries to popup a dialog for overwrite confirmation.
The moral is that a change like this should be first well thought and
designed, instead of throwing it there and then trying to solve the
problems that will inevitably arise.

-- 
Enrico

Reply via email to