>>>>> "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

Juergen> The attached patch fixes some real problems with the output
Juergen> of change tracked documents and implements a possibility to
Juergen> check whether a (required) package is installed.

Good idea.

Juergen> - If dvipost is not installed, export to dvi/ps is broken
Juergen> (because dvipost is needed). This is annoying since dvipost
Juergen> is far from being a standard package.

Indeed.

Juergen> - The "Show changes in output" menu item is grayed out if
Juergen> dvipost is not installed; also, output_changes is set to
Juergen> false in this case. For this, I had to implement a list which
Juergen> holds the contents of packages.lst and a method isAvailable,
Juergen> which returns whether one of the required packages is
Juergen> installed or not. I was surprised that this method didn't
Juergen> exist yet and I think it will be useful for other cases too
Juergen> (indicate the user if he can actually use a certain feature).

Yes, this is something I never did, because I am lazy :)

The patch looks good. A few remarks:

+       case LFUN_OUTPUT_CHANGES: {
+               LaTeXFeatures features(*buf, buf->params(), false);
+               if (!features.isAvailable("dvipost"))
+                       buf->params().output_changes = false;
+               flag.enabled(buf && buf->params().tracking_changes 
+                       && features.isAvailable("dvipost"));
+               flag.setOnOff(buf->params().output_changes);
+               break;
+       }

You should not change variables from ::getStatus. Why do you reset
BufferParams::output_changes there?


+
+       case LFUN_OUTPUT_CHANGES: {
+               Buffer * buf = bv_->buffer();
+               if (!buf->params().tracking_changes)
+                       break;
+               else {
+                       bool const state = buf->params().output_changes;
+                       buf->params().output_changes = !state;
+               }
+               break;
+       }
 
The LFUN is disabled when tracking_changes is off, so you do not need
to test for this condition.


+void LaTeXFeatures::getAvailable()

I am not sure putting this list in LaTeXFeatures like that is the best
solution, since packages.lst will be parsed everytime one exports to
latex... You may want to turn packages_ into a static variable and
make getPackage static too.


--- bufferparams.h      19 Jan 2005 15:03:29 -0000      1.53
+++ bufferparams.h      23 Jan 2005 17:03:30 -0000
@@ -209,6 +209,8 @@
        bool use_bibtopic;
        /// revision tracking for this buffer ?
        bool tracking_changes;
+       /// output changes to dvi?
+       bool output_changes;

The 'to dvi' part is a bit to terse here. You could maybe add here a
short motivation for this variable, based on what you just wrote.

JMarc

Reply via email to