Jean-Marc Lasgouttes wrote:
> Angus> The attached patch defines a new function prependEnvVar(name,
> Angus> prefix) and adds a new variable, path_prefix, to LyXRC. They
> Angus> are used to modify the PATH environment variable. It also adds
> Angus> a GUI interface to the Qt and XForms preferences dialogs.
> 
> Angus> As a result, I'm able to remove this hard-coded nastiness from
> Angus> lyx_main.C.
> 
> Very good.
> 
> Angus> The question is, should I modify lib/configure to initialise
> Angus> lyxrc.path_prefix with it, or should I just leave that to the
> Angus> packagers?
> 
> I think personally we should leave that to the packagers (to avoid
> trying to be too clever).

I hoped you'd say that.

What this patch does not do yet is change the PATH when the change is 
received from the frontends. I propose to do nothing at all in this 
direction for 1.3.x. The user should just restart LyX for the change to 
take effect.

For 1.4.x, I propose that the LFUN_LYXRC_APPLY block becomes:

    case LFUN_LYXRC_APPLY: {
+       LyXRC lyxrc_orig = lyxrc;
+
        istringstream ss(argument);
        bool const success = lyxrc.read(ss) == 0;

        if (!success) {
            lyxerr << "Warning in LFUN_LYXRC_APPLY!\n"
                   << "Unable to read lyxrc data"
                   << endl;
+           break;
        }

+       update(lyxrc_orig, lyxrc);
+
        break;
    }

where 'update' is a new function that collects together all of the actions 
that should be taken when lyxrc is changed. I anticipate that this 
function will contain a huge switch statement without any 'break's, just 
like LyXRC::write:

void update(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
{
    LyXRCTags tag = RC_LAST;
    switch (tag) {
    case RC_BINDFILE:
        if (lyxrc_orig.bind_file != lyxrc_new.bind_file) {
            // Act on change.
        }
    case RC_PATH_PREFIX: 
        if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
            // Act on change.
        }
    ...
    }
}

I propose to fill this function gradually.

Thoughts?

-- 
Angus

Reply via email to