Fix remaining issues with InsetSpace. The identifier "Space" used in the .lyx

file has been changed to "space" to match the identifier used for the inset in
Inset.cpp and for the dialog in GuiView.cpp.

In future, we will want to get a similar uniformity elsewhere: The identifier
used in the LyX file should match the one used as inset identifier. The easy
way to do this, in the code, is to have insets write themselves this way:
	os << insetName(lyxCode()) << " ";
rather than at present:
	os << "space ";
Similar things could then happen elsewhere. E.g., if the dialog names are in
sync with the inset names, then we could do something like:
	hideDialogs(insetName(lyxCode()), this);
rather than
	hideDialogs("space", this);
and perhaps even put that into the Inset destructor rather than have specific
versions in each inset---with a test for whether there is such a dialog, of
course.

But this is all for later.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25016 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-05-30 15:38:43 +00:00
parent 66fa2a2e27
commit 2a47858dda
5 changed files with 29 additions and 4 deletions

View File

@ -1,6 +1,9 @@
LyX file-format changes LyX file-format changes
----------------------- -----------------------
2008-05-30 Richard Heck <rgheck@brown.edu>
* Format incremented to 335: fixes for InsetSpace problems.
2008-05-16 Uwe Stöhr <uwestoehr@web.de> 2008-05-16 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 334: fix for bug 4868. * Format incremented to 334: fix for bug 4868.

View File

@ -2280,6 +2280,26 @@ def revert_paper_sizes(document):
document.header[j] = "\\papersize executivepaper" document.header[j] = "\\papersize executivepaper"
def convert_InsetSpace(document):
" Convert '\\begin_inset Space foo' to '\\begin_inset space foo'"
i = 0
while True:
i = find_token(document.body, "\\begin_inset Space", i)
if i == -1:
return
document.body[i] = document.body[i].replace('\\begin_inset Space', '\\begin_inset space')
def revert_InsetSpace(document):
" Revert '\\begin_inset space foo' to '\\begin_inset Space foo'"
i = 0
while True:
i = find_token(document.body, "\\begin_inset space", i)
if i == -1:
return
document.body[i] = document.body[i].replace('\\begin_inset space', '\\begin_inset Space')
## ##
# Conversion hub # Conversion hub
# #
@ -2343,9 +2363,11 @@ convert = [[277, [fix_wrong_tables]],
[332, []], [332, []],
[333, [update_apa_styles]], [333, [update_apa_styles]],
[334, [convert_paper_sizes]], [334, [convert_paper_sizes]],
[335, [convert_InsetSpace]],
] ]
revert = [[333, [revert_paper_sizes]], revert = [[334, [revert_InsetSpace]],
[333, [revert_paper_sizes]],
[332, []], [332, []],
[331, [revert_graphics_group]], [331, [revert_graphics_group]],
[330, [revert_ltcaption]], [330, [revert_ltcaption]],

View File

@ -115,7 +115,7 @@ namespace os = support::os;
namespace { namespace {
int const LYX_FORMAT = 334; int const LYX_FORMAT = 335;
typedef map<string, bool> DepClean; typedef map<string, bool> DepClean;
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache; typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;

View File

@ -528,7 +528,7 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
inset.reset(new InsetERT(buf)); inset.reset(new InsetERT(buf));
} else if (tmptok == "listings") { } else if (tmptok == "listings") {
inset.reset(new InsetListings(buf)); inset.reset(new InsetListings(buf));
} else if (tmptok == "Space") { } else if (tmptok == "space") {
inset.reset(new InsetSpace); inset.reset(new InsetSpace);
} else if (tmptok == "Tabular") { } else if (tmptok == "Tabular") {
inset.reset(new InsetTabular(buf)); inset.reset(new InsetTabular(buf));

View File

@ -446,7 +446,7 @@ void InsetSpaceParams::read(Lexer & lex)
void InsetSpace::write(ostream & os) const void InsetSpace::write(ostream & os) const
{ {
os << "Space "; os << "space ";
params_.write(os); params_.write(os);
} }