* change LFUN file-insert-ascii to file-insert-plaintext

* change LFUN file-insert-ascii-para to file-insert-plaintext-para
* change LyXRC::RC_ASCIIROFF_COMMAND to LyXRC::RC_PLAINTEXT_ROFF_COMMAND
* change LyXRC::RC_ASCII_LINELEN to LyXRC::RC_PLAINTEXT_LINELEN
* replace "ascii" by "plaintext" in method names


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16697 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Michael Schmitt 2007-01-15 22:49:14 +00:00
parent 74c655ed79
commit 1f7a1257f1
23 changed files with 89 additions and 89 deletions

View File

@ -49,8 +49,8 @@
\bind "M-~S-i o b" "bibtex-insert"
\bind "M-~S-i e x" "file-insert"
\bind "M-~S-i e l" "file-insert-ascii"
\bind "M-~S-i e p" "file-insert-ascii-para"
\bind "M-~S-i e l" "file-insert-plaintext"
\bind "M-~S-i e p" "file-insert-plaintext-para"
\bind "M-~S-f p" "buffer-print"
\bind "M-~S-f n" "buffer-new"

View File

@ -496,9 +496,9 @@ def checkOtherEntries():
''' entries other than Format and Converter '''
checkProg('a *roff formatter', ['groff', 'nroff'],
rc_entry = [
r'\ascii_roff_command "groff -t -Tlatin1 $$FName"',
r'\ascii_roff_command "tbl $$FName | nroff"',
r'\ascii_roff_command ""' ])
r'\plaintext_roff_command "groff -t -Tlatin1 $$FName"',
r'\plaintext_roff_command "tbl $$FName | nroff"',
r'\plaintext_roff_command ""' ])
checkProg('ChkTeX', ['chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38'],
rc_entry = [ r'\chktex_command "%%"' ])
checkProg('a spellchecker', ['ispell'],

View File

@ -317,8 +317,8 @@ Menuset
Menu "insert_file"
Item "LyX Document...|X" "file-insert"
Item "Plain Text as Lines...|L" "file-insert-ascii"
Item "Plain Text as Paragraphs...|P" "file-insert-ascii-para"
Item "Plain Text as Lines...|L" "file-insert-plaintext"
Item "Plain Text as Paragraphs...|P" "file-insert-plaintext-para"
End
Menu "edit_change"

View File

@ -377,8 +377,8 @@ Menuset
Menu "insert_file"
Item "LyX Document...|X" "file-insert"
Item "Plain Text as Lines...|L" "file-insert-ascii"
Item "Plain Text as Paragraphs...|P" "file-insert-ascii-para"
Item "Plain Text as Lines...|L" "file-insert-plaintext"
Item "Plain Text as Paragraphs...|P" "file-insert-plaintext-para"
Separator
Item "External Material...|M" "dialog-show-new-inset external"
Item "Child Document...|d" "dialog-show-new-inset include"

View File

@ -610,8 +610,8 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
flag.enabled(!buffer_->redostack().empty());
break;
case LFUN_FILE_INSERT:
case LFUN_FILE_INSERT_ASCII_PARA:
case LFUN_FILE_INSERT_ASCII:
case LFUN_FILE_INSERT_PLAINTEXT_PARA:
case LFUN_FILE_INSERT_PLAINTEXT:
case LFUN_BOOKMARK_SAVE:
// FIXME: Actually, these LFUNS should be moved to LyXText
flag.enabled(cursor_.inTexted());
@ -727,14 +727,14 @@ bool BufferView::dispatch(FuncRequest const & cmd)
menuInsertLyXFile(to_utf8(cmd.argument()));
break;
case LFUN_FILE_INSERT_ASCII_PARA:
case LFUN_FILE_INSERT_PLAINTEXT_PARA:
// FIXME UNICODE
insertAsciiFile(this, to_utf8(cmd.argument()), true);
insertPlaintextFile(this, to_utf8(cmd.argument()), true);
break;
case LFUN_FILE_INSERT_ASCII:
case LFUN_FILE_INSERT_PLAINTEXT:
// FIXME UNICODE
insertAsciiFile(this, to_utf8(cmd.argument()), false);
insertPlaintextFile(this, to_utf8(cmd.argument()), false);
break;
case LFUN_FONT_STATE:

View File

@ -158,8 +158,8 @@ void LyXAction::init()
{ LFUN_ERROR_NEXT, "error-next", ReadOnly },
{ LFUN_ERT_INSERT, "ert-insert", Noop },
{ LFUN_FILE_INSERT, "file-insert", Noop },
{ LFUN_FILE_INSERT_ASCII, "file-insert-ascii", Noop },
{ LFUN_FILE_INSERT_ASCII_PARA, "file-insert-ascii-para", Noop },
{ LFUN_FILE_INSERT_PLAINTEXT, "file-insert-plaintext", Noop },
{ LFUN_FILE_INSERT_PLAINTEXT_PARA, "file-insert-plaintext-para", Noop },
{ LFUN_FILE_NEW, "file-new", NoBuffer },
{ LFUN_FILE_OPEN, "file-open", NoBuffer },
{ LFUN_FLOAT_INSERT, "float-insert", Noop },

View File

@ -1672,7 +1672,7 @@ void Buffer::getSourceCode(odocstream & os, pit_type par_begin,
OutputParams runparams;
runparams.nice = true;
runparams.flavor = OutputParams::LATEX;
runparams.linelen = lyxrc.ascii_linelen;
runparams.linelen = lyxrc.plaintext_linelen;
// No side effect of file copying and image conversion
runparams.dryrun = true;

View File

@ -151,7 +151,7 @@ bool Exporter::Export(Buffer * buffer, string const & format,
string backend_format;
OutputParams runparams;
runparams.flavor = OutputParams::LATEX;
runparams.linelen = lyxrc.ascii_linelen;
runparams.linelen = lyxrc.plaintext_linelen;
vector<string> backends = Backends(*buffer);
// FIXME: Without this test export to lyx1[34] would be through
// latex -> lyx -> lyx1[34], because the first backend below with a

View File

@ -194,24 +194,24 @@ PrefAscii::PrefAscii(QWidget * parent)
: PrefModule(_(Outputs), _("Plain text"), 0, parent)
{
setupUi(this);
connect(asciiLinelengthSB, SIGNAL(valueChanged(int)),
connect(plaintextLinelengthSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
connect(asciiRoffED, SIGNAL(textChanged(const QString&)),
connect(plaintextRoffED, SIGNAL(textChanged(const QString&)),
this, SIGNAL(changed()));
}
void PrefAscii::apply(LyXRC & rc) const
{
rc.ascii_linelen = asciiLinelengthSB->value();
rc.ascii_roff_command = fromqstr(asciiRoffED->text());
rc.plaintext_linelen = plaintextLinelengthSB->value();
rc.plaintext_roff_command = fromqstr(plaintextRoffED->text());
}
void PrefAscii::update(LyXRC const & rc)
{
asciiLinelengthSB->setValue(rc.ascii_linelen);
asciiRoffED->setText(toqstr(rc.ascii_roff_command));
plaintextLinelengthSB->setValue(rc.plaintext_linelen);
plaintextRoffED->setText(toqstr(rc.plaintext_roff_command));
}

View File

@ -31,12 +31,12 @@
<number>6</number>
</property>
<item row="1" column="0" >
<widget class="QLabel" name="asciiRoffLA" >
<widget class="QLabel" name="plaintextRoffLA" >
<property name="text" >
<string>&amp;roff command:</string>
</property>
<property name="buddy" >
<cstring>asciiRoffED</cstring>
<cstring>plaintextRoffED</cstring>
</property>
</widget>
</item>
@ -49,7 +49,7 @@
<number>6</number>
</property>
<item>
<widget class="QSpinBox" name="asciiLinelengthSB" >
<widget class="QSpinBox" name="plaintextLinelengthSB" >
<property name="toolTip" >
<string>Max. line length of exported plain text/LaTeX/SGML files</string>
</property>
@ -77,17 +77,17 @@
</layout>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="asciiLinelengthLA" >
<widget class="QLabel" name="plaintextLinelengthLA" >
<property name="text" >
<string>Output &amp;line length:</string>
</property>
<property name="buddy" >
<cstring>asciiLinelengthSB</cstring>
<cstring>plaintextLinelengthSB</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="asciiRoffED" >
<widget class="QLineEdit" name="plaintextRoffED" >
<property name="toolTip" >
<string>External app for formating tables in plain text output</string>
</property>

View File

@ -87,7 +87,7 @@ bool Importer::Import(LyXView * lv, FileName const & filename,
string filename2 = (loader_format == format) ? filename.absFilename()
: changeExtension(filename.absFilename(),
formats.extension(loader_format));
insertAsciiFile(lv->view(), filename2, as_paragraphs);
insertPlaintextFile(lv->view(), filename2, as_paragraphs);
lv->dispatch(FuncRequest(LFUN_MARK_OFF));
}

View File

@ -679,12 +679,12 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
break;
// insert file functions
case LFUN_FILE_INSERT_ASCII_PARA:
case LFUN_FILE_INSERT_ASCII: {
case LFUN_FILE_INSERT_PLAINTEXT_PARA:
case LFUN_FILE_INSERT_PLAINTEXT: {
// FIXME UNICODE
string const tmpstr = getContentsOfAsciiFile(&cur.bv(), to_utf8(cmd.argument()), false);
string const tmpstr = getContentsOfPlaintextFile(&cur.bv(), to_utf8(cmd.argument()), false);
// FIXME: We don't know the encoding of the file
if (!tmpstr.empty() && !insertAsciiString(cur.bv(), from_utf8(tmpstr), false))
if (!tmpstr.empty() && !insertPlaintextString(cur.bv(), from_utf8(tmpstr), false))
cur.undispatched();
break;
}
@ -727,10 +727,10 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
theSelection().get();
if (clip.empty())
break;
// pass to InsertAsciiString, but
// pass to InsertPlaintextString, but
// only if we have multi-cell content
if (clip.find_first_of(from_ascii("\t\n")) != docstring::npos) {
if (insertAsciiString(cur.bv(), clip, false)) {
if (insertPlaintextString(cur.bv(), clip, false)) {
// content has been replaced,
// so cursor might be invalid
cur.pos() = cur.lastpos();
@ -1957,7 +1957,7 @@ bool InsetTabular::forceDefaultParagraphs(idx_type cell) const
}
bool InsetTabular::insertAsciiString(BufferView & bv, docstring const & buf,
bool InsetTabular::insertPlaintextString(BufferView & bv, docstring const & buf,
bool usePaste)
{
if (buf.length() <= 0)

View File

@ -188,7 +188,7 @@ private:
void getSelection(LCursor & cur, row_type & rs, row_type & re,
col_type & cs, col_type & ce) const;
///
bool insertAsciiString(BufferView &, docstring const & buf, bool usePaste);
bool insertPlaintextString(BufferView &, docstring const & buf, bool usePaste);
/// are we operating on several cells?
bool tablemode(LCursor & cur) const;

View File

@ -202,8 +202,8 @@ enum kb_action {
// 140
LFUN_COMMAND_EXECUTE,
LFUN_FILE_INSERT,
LFUN_FILE_INSERT_ASCII, // CFO-G 1997-11-19
LFUN_FILE_INSERT_ASCII_PARA, // Levon 2001-02-14
LFUN_FILE_INSERT_PLAINTEXT, // CFO-G 1997-11-19
LFUN_FILE_INSERT_PLAINTEXT_PARA,// Levon 2001-02-14
LFUN_FILE_NEW, // for scripting purposes
// 145
LFUN_FILE_OPEN,

View File

@ -318,14 +318,14 @@ void newFile(BufferView * bv, string const & filename)
}
// Insert ascii file (if filename is empty, prompt for one)
void insertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
// Insert plain text file (if filename is empty, prompt for one)
void insertPlaintextFile(BufferView * bv, string const & f, bool asParagraph)
{
if (!bv->buffer())
return;
// FIXME: We don't know the encoding of the file
docstring const tmpstr = from_utf8(getContentsOfAsciiFile(bv, f, asParagraph));
docstring const tmpstr = from_utf8(getContentsOfPlaintextFile(bv, f, asParagraph));
if (tmpstr.empty())
return;
@ -341,14 +341,14 @@ void insertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
}
// Insert ascii file (if filename is empty, prompt for one)
string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagraph)
// Insert plain text file (if filename is empty, prompt for one)
string getContentsOfPlaintextFile(BufferView * bv, string const & f, bool asParagraph)
{
FileName fname(f);
if (fname.empty()) {
FileDialog fileDlg(_("Select file to insert"),
(asParagraph) ? LFUN_FILE_INSERT_ASCII_PARA : LFUN_FILE_INSERT_ASCII);
(asParagraph) ? LFUN_FILE_INSERT_PLAINTEXT_PARA : LFUN_FILE_INSERT_PLAINTEXT);
FileDialog::Result result =
fileDlg.open(from_utf8(bv->buffer()->filePath()),

View File

@ -32,9 +32,9 @@ void autoSave(BufferView * bv);
///
void newFile(BufferView * bv, std::string const & filename);
///
void insertAsciiFile(BufferView * bv, std::string const & f, bool asParagraph);
void insertPlaintextFile(BufferView * bv, std::string const & f, bool asParagraph);
///
std::string getContentsOfAsciiFile(BufferView * bv, std::string const & f, bool asParagraph);
std::string getContentsOfPlaintextFile(BufferView * bv, std::string const & f, bool asParagraph);
///
void reconfigure(LyXView & lv);

View File

@ -2112,8 +2112,8 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
switch (tag) {
case LyXRC::RC_ACCEPT_COMPOUND:
case LyXRC::RC_ALT_LANG:
case LyXRC::RC_ASCIIROFF_COMMAND:
case LyXRC::RC_ASCII_LINELEN:
case LyXRC::RC_PLAINTEXT_ROFF_COMMAND:
case LyXRC::RC_PLAINTEXT_LINELEN:
case LyXRC::RC_AUTOREGIONDELETE:
case LyXRC::RC_AUTORESET_OPTIONS:
case LyXRC::RC_AUTOSAVE:

View File

@ -68,8 +68,6 @@ namespace {
keyword_item lyxrcTags[] = {
{ "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
{ "\\alternate_language", LyXRC::RC_ALT_LANG },
{ "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN },
{ "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND },
{ "\\auto_number", LyXRC::RC_AUTO_NUMBER },
{ "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
{ "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
@ -114,6 +112,8 @@ keyword_item lyxrcTags[] = {
{ "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
{ "\\path_prefix", LyXRC::RC_PATH_PREFIX },
{ "\\personal_dictionary", LyXRC::RC_PERS_DICT },
{ "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
{ "\\plaintext_roff_command", LyXRC::RC_PLAINTEXT_ROFF_COMMAND },
{ "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
{ "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
{ "\\popup_normal_font", LyXRC::RC_POPUP_NORMAL_FONT },
@ -254,7 +254,7 @@ void LyXRC::setDefaults() {
autosave = 300;
auto_region_delete = true;
auto_reset_options = false;
ascii_linelen = 65;
plaintext_linelen = 65;
num_lastfiles = maxlastfiles;
check_lastfiles = true;
use_lastfilepos = true;
@ -892,14 +892,14 @@ int LyXRC::read(LyXLex & lexrc)
}
break;
case RC_ASCIIROFF_COMMAND:
case RC_PLAINTEXT_ROFF_COMMAND:
if (lexrc.next()) {
ascii_roff_command = lexrc.getString();
plaintext_roff_command = lexrc.getString();
}
break;
case RC_ASCII_LINELEN:
case RC_PLAINTEXT_LINELEN:
if (lexrc.next()) {
ascii_linelen = lexrc.getInteger();
plaintext_linelen = lexrc.getInteger();
}
break;
// Spellchecker settings:
@ -1856,10 +1856,10 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
}
case RC_USETEMPDIR:
// Ignore it
case RC_ASCII_LINELEN:
case RC_PLAINTEXT_LINELEN:
if (ignore_system_lyxrc ||
ascii_linelen != system_lyxrc.ascii_linelen) {
os << "\\ascii_linelen " << ascii_linelen << '\n';
plaintext_linelen != system_lyxrc.plaintext_linelen) {
os << "\\plaintext_linelen " << plaintext_linelen << '\n';
}
case RC_MAKE_BACKUP:
if (ignore_system_lyxrc ||
@ -1877,10 +1877,10 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
<< "# ASCII EXPORT SECTION ##############################\n"
<< "#\n\n";
case RC_ASCIIROFF_COMMAND:
case RC_PLAINTEXT_ROFF_COMMAND:
if (ignore_system_lyxrc ||
ascii_roff_command != system_lyxrc.ascii_roff_command) {
os << "\\ascii_roff_command \"" << ascii_roff_command
plaintext_roff_command != system_lyxrc.plaintext_roff_command) {
os << "\\plaintext_roff_command \"" << plaintext_roff_command
<< "\"\n";
}
@ -2172,12 +2172,12 @@ string const LyXRC::getDescription(LyXRCTags tag)
str = _("Specify an alternate language. The default is to use the language of the document.");
break;
case RC_ASCIIROFF_COMMAND:
case RC_PLAINTEXT_ROFF_COMMAND:
str = _("Use to define an external program to render tables in plain text output. E.g. \"groff -t -Tlatin1 $$FName\" where $$FName is the input file. If \"\" is specified, an internal routine is used.");
break;
case RC_ASCII_LINELEN:
str = _("This is the maximum line length of an exported text file (LaTeX, SGML or plain text).");
case RC_PLAINTEXT_LINELEN:
str = _("This is the maximum line length of an exported text file (LaTeX, SGML or plain text). If set to 0, paragraphs are output in a single line; if the line length is != 0, paragraphs are separated by a blank line.");
break;
case RC_AUTOREGIONDELETE:

View File

@ -40,8 +40,8 @@ public:
enum LyXRCTags {
RC_ACCEPT_COMPOUND = 1,
RC_ALT_LANG,
RC_ASCIIROFF_COMMAND,
RC_ASCII_LINELEN,
RC_PLAINTEXT_ROFF_COMMAND,
RC_PLAINTEXT_LINELEN,
RC_AUTOREGIONDELETE,
RC_AUTORESET_OPTIONS,
RC_AUTOSAVE,
@ -309,9 +309,9 @@ public:
///
unsigned int autosave;
///
std::string ascii_roff_command;
std::string plaintext_roff_command;
///
unsigned int ascii_linelen;
unsigned int plaintext_linelen;
/// use library instead of process
bool use_spell_lib;
/// Ispell command

View File

@ -1152,7 +1152,7 @@ void sgmlLineBreak(ostream & os, string::size_type & colcount,
string::size_type newcol)
{
colcount += newcol;
if (colcount > lyxrc.ascii_linelen) {
if (colcount > lyxrc.plaintext_linelen) {
os << "\n";
colcount = newcol; // assume write after this call
}

View File

@ -390,7 +390,7 @@ void Paragraph::Pimpl::simpleTeXBlanks(odocstream & os, TexRow & texrow,
if (style.pass_thru)
return;
if (column > lyxrc.ascii_linelen
if (column > lyxrc.plaintext_linelen
&& i
&& getChar(i - 1) != ' '
&& (i < size() - 1)

View File

@ -2453,7 +2453,7 @@ int LyXTabular::docbook(Buffer const & buf, odocstream & os,
}
int LyXTabular::asciiTopHLine(odocstream & os, row_type row,
int LyXTabular::plaintextTopHLine(odocstream & os, row_type row,
vector<unsigned int> const & clen) const
{
idx_type const fcell = getFirstCellInRow(row);
@ -2501,7 +2501,7 @@ int LyXTabular::asciiTopHLine(odocstream & os, row_type row,
}
int LyXTabular::asciiBottomHLine(odocstream & os, row_type row,
int LyXTabular::plaintextBottomHLine(odocstream & os, row_type row,
vector<unsigned int> const & clen) const
{
idx_type const fcell = getFirstCellInRow(row);
@ -2549,7 +2549,7 @@ int LyXTabular::asciiBottomHLine(odocstream & os, row_type row,
}
int LyXTabular::asciiPrintCell(Buffer const & buf, odocstream & os,
int LyXTabular::plaintextPrintCell(Buffer const & buf, odocstream & os,
OutputParams const & runparams,
idx_type cell, row_type row, col_type column,
vector<unsigned int> const & clen,
@ -2645,21 +2645,21 @@ int LyXTabular::plaintext(Buffer const & buf, odocstream & os,
}
idx_type cell = 0;
for (row_type i = 0; i < rows_; ++i) {
if (!onlydata && asciiTopHLine(os, i, clen))
if (!onlydata && plaintextTopHLine(os, i, clen))
os << docstring(depth * 2, ' ');
for (col_type j = 0; j < columns_; ++j) {
if (isPartOfMultiColumn(i, j))
continue;
if (onlydata && j > 0)
os << delim;
ret += asciiPrintCell(buf, os, runparams,
ret += plaintextPrintCell(buf, os, runparams,
cell, i, j, clen, onlydata);
++cell;
}
os << endl;
if (!onlydata) {
os << docstring(depth * 2, ' ');
if (asciiBottomHLine(os, i, clen))
if (plaintextBottomHLine(os, i, clen))
os << docstring(depth * 2, ' ');
}
}

View File

@ -604,18 +604,18 @@ public:
int TeXRow(odocstream &, row_type const row, Buffer const & buf,
OutputParams const &) const;
///
// helper function for ASCII returns number of newlines
// helper functions for plain text return number of newlines
///
int asciiTopHLine(odocstream &, row_type row,
std::vector<unsigned int> const &) const;
int plaintextTopHLine(odocstream &, row_type row,
std::vector<unsigned int> const &) const;
///
int asciiBottomHLine(odocstream &, row_type row,
std::vector<unsigned int> const &) const;
int plaintextBottomHLine(odocstream &, row_type row,
std::vector<unsigned int> const &) const;
///
int asciiPrintCell(Buffer const &, odocstream &,
OutputParams const &,
idx_type cell, row_type row, col_type column,
std::vector<unsigned int> const &,
int plaintextPrintCell(Buffer const &, odocstream &,
OutputParams const &,
idx_type cell, row_type row, col_type column,
std::vector<unsigned int> const &,
bool onlydata) const;
/// auxiliary function for docbook
int docbookRow(Buffer const & buf, odocstream & os, row_type,