Bear with me on this one. It isn't difficult, just long!

The current version of LyXGUI contains the following code
LyXGUI::init()
{
        ...
        create_forms();
        ...
        // the print form
        fl_set_input(fd_form_print->input_printer, lyxrc->printer.c_str());     
}

where lyxrc is a global LyXRC variable and the call
to create_forms() does the following in the slowly evolving
"way forward" (TM):

 void LyXGUI::create_forms()
{
        ...
        lyxViews = new LyXView(width, height);
        ...
}

LyXView::LyXView(int width, int height)
{
        ...
        dialogs_ = new Dialogs(lyxfunc);
        ...
}
class Dialogs
{
        ...
        vector<DialogBase *> dialogs_;
};
Dialogs::Dialogs(LyXFunc * lf)
{
        ...
        dialogs_.push_back(new FormPrint(lf, this, this->showPrint));
        ...
}

class FormPrint : public DialogBase
{
        ...
private:
        struct FD_form_print
        {
                ...
                FL_OBJECT *input_printer;
        };

        FD_form_print * dialog_;
}

Ultimately, therefore, create_forms() creates a vector of
Dialogs, one of which is the Print Dialog which contains
the private data "input_printer". It is this (in its old
form) that is being set right at the top of this page in
LyXGUI::init():

        fl_set_input(fd_form_print->input_printer, lyxrc->printer.c_str());     

I propose that the Dialogs constructor be modified to:
        Dialogs(LyXFunc * lyxfunc, LyXRC const & lyxrc )
so that this info can be passed into FormPrint when it is
constructed (and any other similar information to the other
dialogs). This would clean up the main code, removing
GUI-specific stuff to where it belongs, somewhere behind
Dialogs.h.

Is this a Good Idea?
Angus

Reply via email to