mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Add a 'draft' option to InsetExternal.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8231 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d29005d2d1
commit
041004baac
@ -1,3 +1,7 @@
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FORMAT: document the addition of a 'draft' option to InsetExternal.
|
||||
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FORMAT: document formats 226 and 227
|
||||
|
@ -3,6 +3,12 @@ LyX file-format changes
|
||||
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* format NOT incremented.
|
||||
* add a 'draft' option to InsetExternal.
|
||||
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* format incremented to 227.
|
||||
* Change the output of InsetBox:
|
||||
\begin_inset Boxed -> \begin_inset Box Boxed
|
||||
\begin_inset Doublebox -> \begin_inset Box Doublebox
|
||||
@ -13,6 +19,7 @@ LyX file-format changes
|
||||
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* format incremented to 226.
|
||||
* Change the output of InsetNote:
|
||||
\begin_inset Note -> \begin_inset Note Note
|
||||
\begin_inset Comment -> \begin_inset Note Comment
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lyxrevert_227.py: InsetExternal gains a 'draft' option, so remove
|
||||
this when reverting to format 226.
|
||||
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lyx2lyx: up the format to 227.
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* QExternal.C, ui/QExternalDialogBase.ui: add a 'draft' check box
|
||||
and use it to fill InsetExternalParams::draft.
|
||||
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* QNote.C: changes due to the change of type of InsetNoteParams::type
|
||||
|
@ -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());
|
||||
@ -444,6 +447,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,
|
||||
*dialog_->displayscaleED);
|
||||
|
@ -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>
|
||||
@ -1389,6 +1400,12 @@
|
||||
<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>
|
||||
<slot access="public">editClicked()</slot>
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FormExternal.C, forms/form_external.fd: add a 'draft' check box
|
||||
and use it to fill InsetExternalParams::draft.
|
||||
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FormNote.C: changes due to the change of type of InsetNoteParams::type
|
||||
|
@ -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,
|
||||
@ -584,6 +587,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,
|
||||
lyxview_->input_displayscale);
|
||||
|
@ -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
|
||||
@ -217,6 +217,24 @@ 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
|
||||
Width: 375
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insetexternal.[Ch]: add a draft option and respect it when
|
||||
outputting LaTeX.
|
||||
|
||||
2003-12-10 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insetbox.C: (read, write): now prepend the inset contents with
|
||||
|
@ -137,6 +137,7 @@ Translator<DisplayType, string> const & displayTranslator()
|
||||
InsetExternalParams::InsetExternalParams()
|
||||
: display(defaultDisplayType),
|
||||
lyxscale(defaultLyxScale),
|
||||
draft(false),
|
||||
templatename_(defaultTemplateName)
|
||||
{}
|
||||
|
||||
@ -199,6 +200,9 @@ void InsetExternalParams::write(Buffer const & buffer, ostream & os) const
|
||||
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 const & buffer, LyXLex & lex)
|
||||
EX_FILENAME,
|
||||
EX_DISPLAY,
|
||||
EX_LYXSCALE,
|
||||
EX_DRAFT,
|
||||
EX_BOUNDINGBOX,
|
||||
EX_CLIP,
|
||||
EX_EXTRA,
|
||||
@ -264,6 +269,7 @@ bool InsetExternalParams::read(Buffer const & buffer, LyXLex & lex)
|
||||
{ "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 const & buffer, LyXLex & lex)
|
||||
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 & buffer, LyXLex & lex)
|
||||
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 & buf, ostream & os,
|
||||
|
||||
void InsetExternal::validate(LaTeXFeatures & features) const
|
||||
{
|
||||
if (params_.draft)
|
||||
return;
|
||||
|
||||
external::Template const * const et_ptr =
|
||||
external::getTemplatePtr(params_);
|
||||
if (!et_ptr)
|
||||
|
@ -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_;
|
||||
|
Loading…
Reference in New Issue
Block a user