add lfun 'quote-insert' arguments single/double (ERT fixes not included)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8450 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2004-02-20 10:32:44 +00:00
parent 5ede7e4889
commit 56a3e2e1c0
24 changed files with 264 additions and 324 deletions

View File

@ -1,3 +1,14 @@
2004-02-20 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* bind/cua.bind:
* bind/emacs.bind:
* bind/sciword.bind:
* bind/xemacs.bind: added binding for "quote-insert single"
NB: Still TODO for aqua.bind (see FIXME)
* ui/classic.ui:
* ui/stdmenus.ui: added "quote-insert single"
2004-02-18 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* kbd/espanol.kmap: new file from David Raymond

View File

@ -30,6 +30,8 @@
\bind "M-~S-i s i" "dots-insert"
\bind "M-~S-i s e" "end-of-sentence-period-insert"
\bind "M-~S-i s q" "self-insert \""
# FIXME: find a binding for single quotes
# \bind "M-~S-i s q" "quote-insert single"
\bind "M-~S-i s m" "menu-separator-insert"
\bind "M-~S-i h i" "math-mode"

View File

@ -72,7 +72,8 @@
\bind "C-S-Z" "redo"
\bind "C-S-E" "track-changes" # it's what MS Word uses
\bind "~S-C-quotedbl" "self-insert \""
\bind "~S-C-quotedbl" "quote-insert single"
\bind "M-S-quotedbl" "self-insert \""
\bind "C-minus" "hyphenation-point-insert"
\bind "M-S-Right" "depth-increment"
\bind "M-S-Left" "depth-decrement"

View File

@ -69,7 +69,8 @@
\bind "C-~S-slash" "undo"
\bind "C-~S-underscore" "undo"
\bind "~S-C-quotedbl" "self-insert \""
\bind "~S-C-quotedbl" "quote-insert single"
\bind "~S-M-quotedbl" "self-insert \""
\bind "C-x a" "buffer-auto-save"
#\bind "C-x b" "buffer-previous"

View File

@ -113,6 +113,7 @@
# This combination makes an umlaut accent now.
#\bind "S-C-quotedbl" "quote-insert"
\bind "S-M-quotedbl" "quote-insert single"
# Bracket delimiters. Sciword mnemonic is to press Control-<bracket key>

View File

@ -73,7 +73,8 @@
\bind "C-~S-slash" "undo"
\bind "C-~S-underscore" "undo"
\bind "~S-C-quotedbl" "self-insert \""
\bind "~S-C-quotedbl" "quote-insert single"
\bind "~S-M-quotedbl" "self-insert \""
\bind "C-x a" "buffer-auto-save"
# not currently supported

View File

@ -245,7 +245,8 @@ Menuset
Item "Linebreak|L" "break-line"
Item "Ellipsis|i" "dots-insert"
Item "End of Sentence|E" "end-of-sentence-period-insert"
Item "Ordinary Quote|Q" "self-insert \""
Item "Single Quote|Q" "quote-insert single"
Item "Ordinary Quote|O" "self-insert \""
Item "Menu Separator|M" "menu-separator-insert"
Item "Horizontal Line" "line-insert"
Item "Page Break" "pagebreak-insert"

View File

@ -253,6 +253,7 @@ Menuset
Item "Ellipsis|i" "dots-insert"
Item "End of Sentence|E" "end-of-sentence-period-insert"
Item "Ordinary Quote|Q" "self-insert \""
Item "Single Quote|S" "quote-insert single"
Item "Menu Separator|M" "menu-separator-insert"
End

View File

@ -1,3 +1,6 @@
2004-02-20 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* text3.C: fixed LFUN_QUOTE and add lfun arguments single/double.
2004-02-20 André Pönitz <poenitz@gmx.net>

View File

@ -1,3 +1,10 @@
2004-02-20 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* QDocument.C:
* QDocumentDialog.C:
* ui/LanguageModuleBase.ui: get rid of the single/double
quote toggle (accessible via lfuns now).
2004-02-19 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* QRef.[Ch]: Real fix for bug 1511 (restore latest settings);

View File

@ -194,11 +194,6 @@ void QDocument::apply()
dialog_->biblioModule->citeStyleCO->currentItem();
// language & quotes
if (dialog_->langModule->singleQuoteRB->isChecked())
params.quotes_times = InsetQuotes::SingleQ;
else
params.quotes_times = InsetQuotes::DoubleQ;
if (dialog_->langModule->defaultencodingCB->isChecked()) {
params.inputenc = "auto";
} else {
@ -449,11 +444,6 @@ void QDocument::update_contents()
params.use_numerical_citations ? 1 : 0);
// language & quotes
dialog_->langModule->singleQuoteRB->setChecked(
params.quotes_times == InsetQuotes::SingleQ);
dialog_->langModule->doubleQuoteRB->setChecked(
params.quotes_times == InsetQuotes::DoubleQ);
int const pos = int(findPos(lang_,
params.language->lang()));
dialog_->langModule->languageCO->setCurrentItem(pos);

View File

@ -88,8 +88,6 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
connect(biblioModule->natbibCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
connect(biblioModule->citeStyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
// language & quote
connect(langModule->singleQuoteRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
connect(langModule->doubleQuoteRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
connect(langModule->languageCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(langModule->defaultencodingCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
connect(langModule->encodingCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));

View File

@ -13,7 +13,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>444</width>
<width>440</width>
<height>451</height>
</rect>
</property>
@ -21,7 +21,7 @@
<name>caption</name>
<string>Form1</string>
</property>
<vbox>
<grid>
<property stdset="1">
<name>margin</name>
<number>11</number>
@ -30,7 +30,7 @@
<name>spacing</name>
<number>6</number>
</property>
<widget>
<widget row="0" column="0" rowspan="1" colspan="2" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
@ -97,7 +97,7 @@
</spacer>
</hbox>
</widget>
<widget>
<widget row="1" column="0" rowspan="1" colspan="2" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
@ -108,192 +108,7 @@
<string>&amp;Use language's default encoding</string>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout17</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>encodingL</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Encoding:</string>
</property>
<property>
<name>buddy</name>
<cstring>encodingCO</cstring>
</property>
</widget>
<widget>
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>encodingCO</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>duplicatesEnabled</name>
<bool>false</bool>
</property>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer31</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>MinimumExpanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</hbox>
</widget>
<widget>
<class>QButtonGroup</class>
<property stdset="1">
<name>name</name>
<cstring>quoteBG</cstring>
</property>
<property stdset="1">
<name>title</name>
<string>Quote Style</string>
</property>
<property stdset="1">
<name>exclusive</name>
<bool>true</bool>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QRadioButton</class>
<property stdset="1">
<name>name</name>
<cstring>singleQuoteRB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Single</string>
</property>
</widget>
<widget>
<class>QRadioButton</class>
<property stdset="1">
<name>name</name>
<cstring>doubleQuoteRB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Double</string>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout19</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>typeL</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Type:</string>
</property>
<property>
<name>buddy</name>
<cstring>quoteStyleCO</cstring>
</property>
</widget>
<widget>
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>quoteStyleCO</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer33</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>MinimumExpanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</hbox>
</widget>
</vbox>
</widget>
<spacer>
<spacer row="4" column="1" >
<property>
<name>name</name>
<cstring>Spacer7</cstring>
@ -314,7 +129,162 @@
</size>
</property>
</spacer>
</vbox>
<spacer row="3" column="1" >
<property>
<name>name</name>
<cstring>Spacer33</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>MinimumExpanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget row="2" column="0" rowspan="2" colspan="1" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout6</cstring>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget row="0" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout5</cstring>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>encodingL</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Encoding:</string>
</property>
<property>
<name>buddy</name>
<cstring>encodingCO</cstring>
</property>
</widget>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>typeL</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Quote Style:</string>
</property>
<property>
<name>buddy</name>
<cstring>quoteStyleCO</cstring>
</property>
</widget>
</grid>
</widget>
<widget row="0" column="1" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout4</cstring>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget row="1" column="0" >
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>quoteStyleCO</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
</widget>
<widget row="0" column="0" >
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>encodingCO</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>duplicatesEnabled</name>
<bool>false</bool>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
<spacer row="2" column="1" >
<property>
<name>name</name>
<cstring>Spacer31</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>MinimumExpanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</grid>
</widget>
<connections>
<connection>
@ -334,8 +304,6 @@
<tabstop>languageCO</tabstop>
<tabstop>defaultencodingCB</tabstop>
<tabstop>encodingCO</tabstop>
<tabstop>singleQuoteRB</tabstop>
<tabstop>doubleQuoteRB</tabstop>
<tabstop>quoteStyleCO</tabstop>
</tabstops>
</UI>

View File

@ -1,3 +1,9 @@
2004-02-20 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* FormDocument.C:
* forms/form_document.fd: get rid of the single/double
quote toggle (accessible via lfuns now).
2004-02-01 Lars Gullik Bjonnes <larsbj@gullik.net>
* FormFloat.C (update): "c" -> 'c' in calls to contains

View File

@ -270,8 +270,6 @@ void FormDocument::build()
bcview().addReadOnly(language_->combox_language);
bcview().addReadOnly(language_->choice_inputenc);
bcview().addReadOnly(language_->choice_quotes_language);
bcview().addReadOnly(language_->radio_single);
bcview().addReadOnly(language_->radio_double);
fl_addto_choice(language_->choice_inputenc,
"default|auto|latin1|latin2|latin3|latin4|latin5|latin9"
@ -973,10 +971,6 @@ bool FormDocument::language_apply(BufferParams & params)
break;
}
params.quotes_language = lga;
if (fl_get_button(language_->radio_single))
params.quotes_times = InsetQuotes::SingleQ;
else
params.quotes_times = InsetQuotes::DoubleQ;
int const pos = fl_get_combox(language_->combox_language);
Language const * new_language = languages.getLanguage(lang_[pos-1]);
@ -1154,12 +1148,6 @@ void FormDocument::language_update(BufferParams const & params)
fl_set_choice_text(language_->choice_inputenc, params.inputenc.c_str());
fl_set_choice(language_->choice_quotes_language, params.quotes_language + 1);
fl_set_button(language_->radio_single, 0);
fl_set_button(language_->radio_double, 0);
if (params.quotes_times == InsetQuotes::SingleQ)
fl_set_button(language_->radio_single, 1);
else
fl_set_button(language_->radio_double, 1);
}

View File

@ -1182,7 +1182,7 @@ argument: 0
Name: form_document_language
Width: 395
Height: 310
Number of Objects: 9
Number of Objects: 4
--------------------
class: FL_BOX
@ -1202,24 +1202,6 @@ name:
callback:
argument:
--------------------
class: FL_LABELFRAME
type: ENGRAVED_FRAME
box: 40 120 290 110
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Quote Style
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
@ -1241,14 +1223,14 @@ argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 110 140 190 25
box: 120 140 190 25
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Type:|#T
label: Quote Style:|#Q
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
@ -1256,78 +1238,6 @@ name: choice_quotes_language
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_BEGIN_GROUP
type: 0
box: 0 0 0 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_ROUND3DBUTTON
type: RADIO_BUTTON
box: 110 180 95 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: Single|#S
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_single
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_ROUND3DBUTTON
type: RADIO_BUTTON
box: 210 180 90 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: Double|#D
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_double
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_END_GROUP
type: 0
box: 0 0 0 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_CHOICE
type: DROPLIST_CHOICE

View File

@ -1,3 +1,9 @@
2004-02-20 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* insetquotes.[Ch]: added new member that allows direct access
to single/double quotation marks.
* insetnewline.[Ch]:
* insethfill.[Ch]: treat as space (i.e. opening quotes follow)
2004-02-16 André Pönitz <poenitz@gmx.net>

View File

@ -79,3 +79,9 @@ void InsetHFill::write(Buffer const &, ostream & os) const
{
os << "\n\\hfill \n";
}
bool InsetHFill::isSpace() const
{
return true;
}

View File

@ -43,6 +43,9 @@ public:
void write(Buffer const & buf, std::ostream & os) const;
/// We don't need \begin_inset and \end_inset
bool directWrite() const { return true; }
/// is this equivalent to a space (which is BTW different from
// a line separator)?
bool isSpace() const;
};

View File

@ -126,3 +126,9 @@ void InsetNewline::draw(PainterInfo & pi, int x, int y) const
pi.pain.lines(xp, yp, 3, LColor::eolmarker);
}
bool InsetNewline::isSpace() const
{
return true;
}

View File

@ -47,6 +47,9 @@ public:
virtual void write(Buffer const & buf, std::ostream & os) const;
/// We don't need \begin_inset and \end_inset
virtual bool directWrite() const { return true; }
/// is this equivalent to a space (which is BTW different from
// a line separator)?
bool isSpace() const;
};
#endif // INSET_NEWLINE_H

View File

@ -93,13 +93,24 @@ InsetQuotes::InsetQuotes(quote_language l, quote_side s, quote_times t)
InsetQuotes::InsetQuotes(char c, BufferParams const & params)
: language_(params.quotes_language), times_(params.quotes_times)
{
getPosition(c);
}
InsetQuotes::InsetQuotes(char c, quote_language l, quote_times t)
: language_(l), times_(t)
{
getPosition(c);
}
void InsetQuotes::getPosition(char c)
{
// Decide whether left or right
switch (c) {
case ' ': case '(':
#warning eh ? I am lost here ...
//case Paragraph::META_HFILL:
// case Paragraph::META_NEWLINE:
// FIXME: what about '['? (jspitzm)
side_ = LeftQ; // left quote
break;
default:

View File

@ -67,6 +67,8 @@ public:
InsetQuotes(std::string const & str = "eld");
/// Create the right quote inset after character c
InsetQuotes(char c, BufferParams const & params);
/// Direct access to inner/outer quotation marks
InsetQuotes(char c, quote_language l, quote_times t);
///
virtual std::auto_ptr<InsetBase> clone() const;
///
@ -97,7 +99,7 @@ public:
void validate(LaTeXFeatures &) const;
///
InsetOld::Code lyxCode() const;
// should this inset be handled like a normal charater
// should this inset be handled like a normal character
bool isChar() const { return true; }
private:
@ -112,6 +114,8 @@ private:
side and the multiplicity of the quote.
*/
InsetQuotes(quote_language l, quote_side s, quote_times t);
/// Decide whether we need left or right quotation marks
void getPosition(char c);
///
void parseString(std::string const &);
///

View File

@ -45,6 +45,7 @@
#include "insets/insetcommand.h"
#include "insets/insetfloatlist.h"
#include "insets/insetnewline.h"
#include "insets/insetquotes.h"
#include "insets/insetspecialchar.h"
#include "insets/insettext.h"
@ -1030,9 +1031,20 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd)
LyXLayout_ptr const & style = par.layout();
BufferParams const & bufparams = bv->buffer()->params();
if (style->pass_thru ||
par.getFontSettings(bufparams, pos).language()->lang() == "hebrew")
if (!style->pass_thru
&& par.getFontSettings(bufparams, pos).language()->lang() != "hebrew") {
string arg = cmd.argument;
if (arg == "single")
cur.insert(new InsetQuotes(c,
bufparams.quotes_language,
InsetQuotes::SingleQ));
else if (arg == "double")
cur.insert(new InsetQuotes(c,
bufparams.quotes_language,
InsetQuotes::DoubleQ));
else
cur.insert(new InsetQuotes(c, bufparams));
}
else
bv->owner()->dispatch(FuncRequest(LFUN_SELFINSERT, "\""));
break;