See attached. I'd appreciate it if the LaTeX-savvy would cast an eye
over this:
int InsetExternal::latex(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
+ if (params_.draft) {
+ os << "\\fbox{\\ttfamily{}"
+ << params_.filename.outputFilename(buf.filePath())
+ << "}\n";
+ return 1;
+ }
José, how would we do this (or similar) in docbook and linuxdoc?
--
Angus
Index: src/insets/insetexternal.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetexternal.C,v
retrieving revision 1.135
diff -u -p -r1.135 insetexternal.C
--- src/insets/insetexternal.C 10 Dec 2003 21:32:05 -0000 1.135
+++ src/insets/insetexternal.C 11 Dec 2003 00:00:54 -0000
@@ -137,6 +137,7 @@ Translator<DisplayType, string> const &
InsetExternalParams::InsetExternalParams()
: display(defaultDisplayType),
lyxscale(defaultLyxScale),
+ draft(false),
templatename_(defaultTemplateName)
{}
@@ -199,6 +200,9 @@ void InsetExternalParams::write(Buffer c
if (lyxscale != defaultLyxScale)
os << "\tlyxscale " << tostr(lyxscale) << '\n';
+ if (draft)
+ os << "\tdraft\n";
+
if (!clipdata.bbox.empty())
os << "\tboundingBox " << clipdata.bbox << '\n';
if (clipdata.clip)
@@ -247,6 +251,7 @@ bool InsetExternalParams::read(Buffer co
EX_FILENAME,
EX_DISPLAY,
EX_LYXSCALE,
+ EX_DRAFT,
EX_BOUNDINGBOX,
EX_CLIP,
EX_EXTRA,
@@ -264,6 +269,7 @@ bool InsetExternalParams::read(Buffer co
{ "boundingBox", EX_BOUNDINGBOX },
{ "clip", EX_CLIP },
{ "display", EX_DISPLAY},
+ { "draft", EX_DRAFT},
{ "extra", EX_EXTRA },
{ "filename", EX_FILENAME},
{ "height", EX_HEIGHT },
@@ -307,6 +313,10 @@ bool InsetExternalParams::read(Buffer co
lyxscale = lex.getInteger();
break;
+ case EX_DRAFT:
+ draft = true;
+ break;
+
case EX_BOUNDINGBOX:
lex.next();
clipdata.bbox.xl = lex.getInteger();
@@ -665,6 +675,13 @@ void InsetExternal::read(Buffer const &
int InsetExternal::latex(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
+ if (params_.draft) {
+ os << "\\fbox{\\ttfamily{}"
+ << params_.filename.outputFilename(buf.filePath())
+ << "}\n";
+ return 1;
+ }
+
// "nice" means that the buffer is exported to LaTeX format but not
// run through the LaTeX compiler.
// If we're running through the LaTeX compiler, we should write the
@@ -716,6 +733,9 @@ int InsetExternal::docbook(Buffer const
void InsetExternal::validate(LaTeXFeatures & features) const
{
+ if (params_.draft)
+ return;
+
external::Template const * const et_ptr =
external::getTemplatePtr(params_);
if (!et_ptr)
Index: src/insets/insetexternal.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetexternal.h,v
retrieving revision 1.68
diff -u -p -r1.68 insetexternal.h
--- src/insets/insetexternal.h 5 Nov 2003 12:06:08 -0000 1.68
+++ src/insets/insetexternal.h 11 Dec 2003 00:00:54 -0000
@@ -86,6 +86,11 @@ struct InsetExternalParams {
lyx::external::ResizeData resizedata;
lyx::external::RotationData rotationdata;
+ /** if \c true, simply output the filename, maybe wrapped in a
+ * box, rather than generate and display the image etc.
+ */
+ bool draft;
+
private:
lyx::external::TempName tempname_;
std::string templatename_;
Index: lib/lyx2lyx/lyxrevert_227.py
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/lyxrevert_227.py,v
retrieving revision 1.1
diff -u -p -r1.1 lyxrevert_227.py
--- lib/lyx2lyx/lyxrevert_227.py 10 Dec 2003 21:48:37 -0000 1.1
+++ lib/lyx2lyx/lyxrevert_227.py 11 Dec 2003 00:00:47 -0000
@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-from parser_tools import find_token
+from parser_tools import find_token, find_end_of_inset
def convert_box(lines):
box_header = "\\begin_inset Box "
@@ -28,8 +28,25 @@ def convert_box(lines):
lines[i] = "\\begin_inset " + lines[i][len(box_header):]
i = i + 1
+def convert_external(lines):
+ draft_token = '\tdraft'
+ i = 0
+ while 1:
+ i = find_token(lines, '\\begin_inset External', i)
+ if i == -1:
+ break
+ j = find_end_of_inset(lines, i + 1)
+ if j == -1:
+ #this should not happen
+ break
+ k = find_token(lines, draft_token, i+1, j-1)
+ if (k != -1 and len(draft_token) == len(lines[k])):
+ del lines[k]
+ i = j + 1
+
def convert(header, body):
convert_box(body)
+ convert_external(body)
if __name__ == "__main__":
pass
Index: src/frontends/qt2/QExternal.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QExternal.C,v
retrieving revision 1.36
diff -u -p -r1.36 QExternal.C
--- src/frontends/qt2/QExternal.C 8 Dec 2003 13:00:16 -0000 1.36
+++ src/frontends/qt2/QExternal.C 11 Dec 2003 00:00:49 -0000
@@ -291,6 +291,7 @@ void QExternal::build_dialog()
bcview().addReadOnly(dialog_->browsePB);
bcview().addReadOnly(dialog_->editPB);
bcview().addReadOnly(dialog_->externalCO);
+ bcview().addReadOnly(dialog_->draftCB);
bcview().addReadOnly(dialog_->displayscaleED);
bcview().addReadOnly(dialog_->showCO);
bcview().addReadOnly(dialog_->displayCB);
@@ -352,6 +353,8 @@ void QExternal::update_contents()
controller().getTemplateNumber(params.templatename()));
updateTemplate();
+ dialog_->draftCB->setChecked(params.draft);
+
setDisplay(*dialog_->displayCB, *dialog_->showCO,
*dialog_->displayscaleED,
params.display, params.lyxscale, readOnly());
@@ -443,6 +446,8 @@ void QExternal::apply()
params.settemplate(controller().getTemplate(
dialog_->externalCO->currentItem()).lyxName);
+
+ params.draft = dialog_->draftCB->isChecked();
getDisplay(params.display, params.lyxscale,
*dialog_->displayCB, *dialog_->showCO,
Index: src/frontends/qt2/ui/QExternalDialogBase.ui
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ui/QExternalDialogBase.ui,v
retrieving revision 1.10
diff -u -p -r1.10 QExternalDialogBase.ui
--- src/frontends/qt2/ui/QExternalDialogBase.ui 5 Dec 2003 13:26:46 -0000 1.10
+++ src/frontends/qt2/ui/QExternalDialogBase.ui 11 Dec 2003 00:00:51 -0000
@@ -13,8 +13,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>331</width>
- <height>320</height>
+ <width>386</width>
+ <height>419</height>
</rect>
</property>
<property stdset="1">
@@ -228,6 +228,42 @@
</widget>
</hbox>
</widget>
+ <spacer row="1" column="1" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer8</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget row="1" column="0" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>editPB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Edit File...</string>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Edit the file externally</string>
+ </property>
+ </widget>
<widget row="2" column="0" rowspan="1" colspan="2" >
<class>QGroupBox</class>
<property stdset="1">
@@ -299,40 +335,15 @@
</spacer>
</grid>
</widget>
- <spacer row="1" column="1" >
- <property>
- <name>name</name>
- <cstring>Spacer8</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
- </property>
- <property stdset="1">
- <name>sizeType</name>
- <enum>Expanding</enum>
- </property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget row="1" column="0" >
- <class>QPushButton</class>
+ <widget row="3" column="0" rowspan="1" colspan="2" >
+ <class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>editPB</cstring>
+ <cstring>draftCB</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>&Edit File...</string>
- </property>
- <property>
- <name>toolTip</name>
- <string>Edit the file externally</string>
+ <string>&Draft</string>
</property>
</widget>
</grid>
@@ -1388,6 +1399,12 @@
<signal>textChanged(const QString&)</signal>
<receiver>QExternalDialogBase</receiver>
<slot>bbChanged()</slot>
+ </connection>
+ <connection>
+ <sender>draftCB</sender>
+ <signal>clicked()</signal>
+ <receiver>QExternalDialogBase</receiver>
+ <slot>change_adaptor()</slot>
</connection>
<slot access="public">browseClicked()</slot>
<slot access="public">change_adaptor()</slot>
Index: src/frontends/xforms/FormExternal.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormExternal.C,v
retrieving revision 1.50
diff -u -p -r1.50 FormExternal.C
--- src/frontends/xforms/FormExternal.C 5 Dec 2003 13:13:42 -0000 1.50
+++ src/frontends/xforms/FormExternal.C 11 Dec 2003 00:00:52 -0000
@@ -341,6 +341,7 @@ void FormExternal::build()
bcview().addReadOnly(file_->button_browse);
bcview().addReadOnly(file_->button_edit);
bcview().addReadOnly(file_->choice_template);
+ bcview().addReadOnly(file_->check_draft);
bcview().addReadOnly(lyxview_->check_show);
bcview().addReadOnly(lyxview_->choice_show);
@@ -476,6 +477,8 @@ void FormExternal::update()
updateComboChange();
+ fl_set_button(file_->check_draft, params.draft);
+
setDisplay(lyxview_->check_show, lyxview_->choice_show,
lyxview_->input_displayscale,
params.display, params.lyxscale,
@@ -583,6 +586,8 @@ void FormExternal::apply()
int const choice = fl_get_choice(file_->choice_template) - 1;
params.settemplate(controller().getTemplate(choice).lyxName);
+
+ params.draft = fl_get_button(file_->check_draft);
getDisplay(params.display, params.lyxscale,
lyxview_->check_show, lyxview_->choice_show,
Index: src/frontends/xforms/forms/form_external.fd
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/forms/form_external.fd,v
retrieving revision 1.17
diff -u -p -r1.17 form_external.fd
--- src/frontends/xforms/forms/form_external.fd 5 Dec 2003 13:26:46 -0000 1.17
+++ src/frontends/xforms/forms/form_external.fd 11 Dec 2003 00:00:53 -0000
@@ -107,7 +107,7 @@ argument: 0
Name: form_external_file
Width: 375
Height: 235
-Number of Objects: 6
+Number of Objects: 7
--------------------
class: FL_BOX
@@ -202,7 +202,7 @@ argument: 0
--------------------
class: FL_BROWSER
type: NORMAL_BROWSER
-box: 25 115 325 105
+box: 25 110 325 90
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_BOTTOM
@@ -216,6 +216,24 @@ gravity: FL_NoGravity FL_NoGravity
name: browser_template
callback:
argument:
+
+--------------------
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 25 205 180 25
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Draft|#D
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: check_draft
+callback: C_FormDialogView_InputCB
+argument: 0
=============== FORM ===============
Name: form_external_lyxview