From 56a3e2e1c0399c92e8461ee87f743b4dff7d2307 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Fri, 20 Feb 2004 10:32:44 +0000 Subject: [PATCH] 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 --- lib/ChangeLog | 11 + lib/bind/aqua.bind | 2 + lib/bind/cua.bind | 3 +- lib/bind/emacs.bind | 3 +- lib/bind/sciword.bind | 1 + lib/bind/xemacs.bind | 7 +- lib/ui/classic.ui | 3 +- lib/ui/stdmenus.ui | 1 + src/ChangeLog | 3 + src/frontends/qt2/ChangeLog | 7 + src/frontends/qt2/QDocument.C | 10 - src/frontends/qt2/QDocumentDialog.C | 2 - src/frontends/qt2/ui/LanguageModuleBase.ui | 236 +++++++++----------- src/frontends/xforms/ChangeLog | 6 + src/frontends/xforms/FormDocument.C | 12 - src/frontends/xforms/forms/form_document.fd | 96 +------- src/insets/ChangeLog | 6 + src/insets/insethfill.C | 6 + src/insets/insethfill.h | 3 + src/insets/insetnewline.C | 6 + src/insets/insetnewline.h | 3 + src/insets/insetquotes.C | 17 +- src/insets/insetquotes.h | 6 +- src/text3.C | 20 +- 24 files changed, 205 insertions(+), 265 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index ddf8d585d3..7c74ddd4bf 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,14 @@ +2004-02-20 Jürgen Spitzmüller + + * 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 * kbd/espanol.kmap: new file from David Raymond diff --git a/lib/bind/aqua.bind b/lib/bind/aqua.bind index b759d30d51..bf30aaa471 100644 --- a/lib/bind/aqua.bind +++ b/lib/bind/aqua.bind @@ -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" diff --git a/lib/bind/cua.bind b/lib/bind/cua.bind index 386d2d45d0..9aa7fba25c 100644 --- a/lib/bind/cua.bind +++ b/lib/bind/cua.bind @@ -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" diff --git a/lib/bind/emacs.bind b/lib/bind/emacs.bind index 1dcc54372e..c9d8eb4334 100644 --- a/lib/bind/emacs.bind +++ b/lib/bind/emacs.bind @@ -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" diff --git a/lib/bind/sciword.bind b/lib/bind/sciword.bind index 857dff7539..5b0737668c 100644 --- a/lib/bind/sciword.bind +++ b/lib/bind/sciword.bind @@ -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- diff --git a/lib/bind/xemacs.bind b/lib/bind/xemacs.bind index 451cdf5b56..963e2b6cf3 100644 --- a/lib/bind/xemacs.bind +++ b/lib/bind/xemacs.bind @@ -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 @@ -204,8 +205,8 @@ \bind "C-Return" "break-line" \bind "C-S-L" "ligature-break-insert" \bind "C-space" "space-insert protected" -\bind "C-M-space" "space-insert normal" -\bind "S-C-space" "space-insert thin" +\bind "C-M-space" "space-insert normal" +\bind "S-C-space" "space-insert thin" \bind "C-period" "end-of-sentence-period-insert" \bind "M-period" "dots-insert" \bind "M-w" "copy" diff --git a/lib/ui/classic.ui b/lib/ui/classic.ui index eace7ba9f2..779ca99c81 100644 --- a/lib/ui/classic.ui +++ b/lib/ui/classic.ui @@ -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" diff --git a/lib/ui/stdmenus.ui b/lib/ui/stdmenus.ui index 624c81308e..fd83c7bd73 100644 --- a/lib/ui/stdmenus.ui +++ b/lib/ui/stdmenus.ui @@ -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 diff --git a/src/ChangeLog b/src/ChangeLog index da9c31955d..13956e8bfd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,6 @@ +2004-02-20 Jürgen Spitzmüller + + * text3.C: fixed LFUN_QUOTE and add lfun arguments single/double. 2004-02-20 André Pönitz diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 1a02268438..9f037d2905 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,10 @@ +2004-02-20 Jürgen Spitzmüller + + * 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 * QRef.[Ch]: Real fix for bug 1511 (restore latest settings); diff --git a/src/frontends/qt2/QDocument.C b/src/frontends/qt2/QDocument.C index 5091903304..ac2669f540 100644 --- a/src/frontends/qt2/QDocument.C +++ b/src/frontends/qt2/QDocument.C @@ -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); diff --git a/src/frontends/qt2/QDocumentDialog.C b/src/frontends/qt2/QDocumentDialog.C index 938ccaa62d..0c1d173eb2 100644 --- a/src/frontends/qt2/QDocumentDialog.C +++ b/src/frontends/qt2/QDocumentDialog.C @@ -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())); diff --git a/src/frontends/qt2/ui/LanguageModuleBase.ui b/src/frontends/qt2/ui/LanguageModuleBase.ui index a171de5304..f655898bc5 100644 --- a/src/frontends/qt2/ui/LanguageModuleBase.ui +++ b/src/frontends/qt2/ui/LanguageModuleBase.ui @@ -13,7 +13,7 @@ 0 0 - 444 + 440 451 @@ -21,7 +21,7 @@ caption Form1 - + margin 11 @@ -30,7 +30,7 @@ spacing 6 - + QLayoutWidget name @@ -97,7 +97,7 @@ - + QCheckBox name @@ -108,129 +108,70 @@ &Use language's default encoding - - QLayoutWidget - + + name - Layout17 + Spacer7 + + + orientation + Vertical - - - margin - 0 - - - spacing - 6 - - - QLabel - - name - encodingL - - - text - &Encoding: - - - buddy - encodingCO - - - - QComboBox - - name - encodingCO - - - sizePolicy - - 5 - 0 - - - - duplicatesEnabled - false - - - - - name - Spacer31 - - - orientation - Horizontal - - - sizeType - MinimumExpanding - - - sizeHint - - 20 - 20 - - - - - - - QButtonGroup + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + name - quoteBG + Spacer33 - title - Quote Style + orientation + Horizontal - exclusive - true + sizeType + MinimumExpanding - + + sizeHint + + 20 + 20 + + + + + QLayoutWidget + + name + Layout6 + + margin - 11 + 0 spacing 6 - - QRadioButton - - name - singleQuoteRB - - - text - &Single - - - - QRadioButton - - name - doubleQuoteRB - - - text - &Double - - - + QLayoutWidget name - Layout19 + Layout5 - + margin 0 @@ -239,7 +180,22 @@ spacing 6 - + + QLabel + + name + encodingL + + + text + &Encoding: + + + buddy + encodingCO + + + QLabel name @@ -247,14 +203,31 @@ text - &Type: + &Quote Style: buddy quoteStyleCO - + + + + QLayoutWidget + + name + Layout4 + + + + margin + 0 + + + spacing + 6 + + QComboBox name @@ -268,43 +241,40 @@ - - + + QComboBox + name - Spacer33 + encodingCO - orientation - Horizontal + sizePolicy + + 5 + 0 + - sizeType - MinimumExpanding - - - sizeHint - - 20 - 20 - + duplicatesEnabled + false - - + + - + - + name - Spacer7 + Spacer31 orientation - Vertical + Horizontal sizeType - Expanding + MinimumExpanding sizeHint @@ -314,7 +284,7 @@ - + @@ -334,8 +304,6 @@ languageCO defaultencodingCB encodingCO - singleQuoteRB - doubleQuoteRB quoteStyleCO diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 8f6ee4b1f6..612e492e1a 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,9 @@ +2004-02-20 Jürgen Spitzmüller + + * FormDocument.C: + * forms/form_document.fd: get rid of the single/double + quote toggle (accessible via lfuns now). + 2004-02-01 Lars Gullik Bjonnes * FormFloat.C (update): "c" -> 'c' in calls to contains diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index e15aa4018a..3121190f0a 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -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); } diff --git a/src/frontends/xforms/forms/form_document.fd b/src/frontends/xforms/forms/form_document.fd index 25a8c36cfc..01fe060b95 100644 --- a/src/frontends/xforms/forms/form_document.fd +++ b/src/frontends/xforms/forms/form_document.fd @@ -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 diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index b0eee06f16..655e9e264e 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,9 @@ +2004-02-20 Jürgen Spitzmüller + + * 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 diff --git a/src/insets/insethfill.C b/src/insets/insethfill.C index cb6c812707..c84bff45e8 100644 --- a/src/insets/insethfill.C +++ b/src/insets/insethfill.C @@ -79,3 +79,9 @@ void InsetHFill::write(Buffer const &, ostream & os) const { os << "\n\\hfill \n"; } + + +bool InsetHFill::isSpace() const +{ + return true; +} diff --git a/src/insets/insethfill.h b/src/insets/insethfill.h index a258686647..2d21203a12 100644 --- a/src/insets/insethfill.h +++ b/src/insets/insethfill.h @@ -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; }; diff --git a/src/insets/insetnewline.C b/src/insets/insetnewline.C index eaf577966c..9b05ff477c 100644 --- a/src/insets/insetnewline.C +++ b/src/insets/insetnewline.C @@ -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; +} diff --git a/src/insets/insetnewline.h b/src/insets/insetnewline.h index d89a41723a..e3b3879609 100644 --- a/src/insets/insetnewline.h +++ b/src/insets/insetnewline.h @@ -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 diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index 3a21ce6bf7..32e49d75eb 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -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: diff --git a/src/insets/insetquotes.h b/src/insets/insetquotes.h index dc35fb800d..f8d453b983 100644 --- a/src/insets/insetquotes.h +++ b/src/insets/insetquotes.h @@ -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 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 &); /// diff --git a/src/text3.C b/src/text3.C index 6ae3f541c6..f07306eaf9 100644 --- a/src/text3.C +++ b/src/text3.C @@ -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" @@ -1028,11 +1029,22 @@ DispatchResult LyXText::dispatch(LCursor & cur, FuncRequest const & cmd) c = par.getChar(pos - 1); LyXLayout_ptr const & style = par.layout(); - + BufferParams const & bufparams = bv->buffer()->params(); - if (style->pass_thru || - par.getFontSettings(bufparams, pos).language()->lang() == "hebrew") - cur.insert(new InsetQuotes(c, bufparams)); + 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; -- 2.39.2