]> git.lyx.org Git - lyx.git/commitdiff
selection improvement + inset quote fixes
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 27 Jul 2001 16:07:33 +0000 (16:07 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 27 Jul 2001 16:07:33 +0000 (16:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2373 a592a061-630c-0410-9148-cb99ea01b6c8

po/POTFILES.in
src/BufferView_pimpl.C
src/ChangeLog
src/insets/ChangeLog
src/insets/insetquotes.C
src/lyxtext.h
src/text.C
src/text2.C

index 1e07b1cca4c6e63a6e6eb2afffe7360c54d95b13..15d17461eb2f5d4fad616b0eadcc41d1013edc9b 100644 (file)
@@ -10,8 +10,8 @@ src/CutAndPaste.C
 src/debug.C
 src/exporter.C
 src/ext_l10n.h
-src/figure_form.C
 src/figureForm.C
+src/figure_form.C
 src/FontLoader.C
 src/frontends/controllers/biblio.C
 src/frontends/controllers/ButtonController.h
@@ -49,67 +49,67 @@ src/frontends/qt2/paragraphdlgimpl.C
 src/frontends/qt2/tabularcreatedlgimpl.C
 src/frontends/xforms/combox.C
 src/frontends/xforms/FileDialog.C
-src/frontends/xforms/form_aboutlyx.C
 src/frontends/xforms/FormAboutlyx.C
-src/frontends/xforms/form_bibitem.C
+src/frontends/xforms/form_aboutlyx.C
 src/frontends/xforms/FormBibitem.C
-src/frontends/xforms/form_bibtex.C
+src/frontends/xforms/form_bibitem.C
 src/frontends/xforms/FormBibtex.C
+src/frontends/xforms/form_bibtex.C
 src/frontends/xforms/form_browser.C
-src/frontends/xforms/form_character.C
 src/frontends/xforms/FormCharacter.C
-src/frontends/xforms/form_citation.C
+src/frontends/xforms/form_character.C
 src/frontends/xforms/FormCitation.C
-src/frontends/xforms/form_document.C
+src/frontends/xforms/form_citation.C
 src/frontends/xforms/FormDocument.C
-src/frontends/xforms/form_error.C
+src/frontends/xforms/form_document.C
 src/frontends/xforms/FormError.C
-src/frontends/xforms/form_external.C
+src/frontends/xforms/form_error.C
 src/frontends/xforms/FormExternal.C
-src/frontends/xforms/form_filedialog.C
+src/frontends/xforms/form_external.C
 src/frontends/xforms/FormFiledialog.C
-src/frontends/xforms/form_graphics.C
+src/frontends/xforms/form_filedialog.C
 src/frontends/xforms/FormGraphics.C
-src/frontends/xforms/form_include.C
+src/frontends/xforms/form_graphics.C
 src/frontends/xforms/FormInclude.C
-src/frontends/xforms/form_index.C
+src/frontends/xforms/form_include.C
 src/frontends/xforms/FormIndex.C
+src/frontends/xforms/form_index.C
 src/frontends/xforms/FormLog.C
 src/frontends/xforms/FormMathsBitmap.C
-src/frontends/xforms/form_maths_deco.C
 src/frontends/xforms/FormMathsDeco.C
-src/frontends/xforms/form_maths_delim.C
+src/frontends/xforms/form_maths_deco.C
 src/frontends/xforms/FormMathsDelim.C
-src/frontends/xforms/form_maths_matrix.C
+src/frontends/xforms/form_maths_delim.C
 src/frontends/xforms/FormMathsMatrix.C
-src/frontends/xforms/form_maths_panel.C
+src/frontends/xforms/form_maths_matrix.C
 src/frontends/xforms/FormMathsPanel.C
-src/frontends/xforms/form_maths_space.C
+src/frontends/xforms/form_maths_panel.C
 src/frontends/xforms/FormMathsSpace.C
-src/frontends/xforms/form_minipage.C
+src/frontends/xforms/form_maths_space.C
 src/frontends/xforms/FormMinipage.C
-src/frontends/xforms/form_paragraph.C
+src/frontends/xforms/form_minipage.C
 src/frontends/xforms/FormParagraph.C
-src/frontends/xforms/form_preamble.C
+src/frontends/xforms/form_paragraph.C
 src/frontends/xforms/FormPreamble.C
-src/frontends/xforms/form_preferences.C
+src/frontends/xforms/form_preamble.C
 src/frontends/xforms/FormPreferences.C
-src/frontends/xforms/form_print.C
+src/frontends/xforms/form_preferences.C
 src/frontends/xforms/FormPrint.C
-src/frontends/xforms/form_ref.C
+src/frontends/xforms/form_print.C
 src/frontends/xforms/FormRef.C
-src/frontends/xforms/form_search.C
+src/frontends/xforms/form_ref.C
 src/frontends/xforms/FormSearch.C
-src/frontends/xforms/form_spellchecker.C
+src/frontends/xforms/form_search.C
 src/frontends/xforms/FormSpellchecker.C
-src/frontends/xforms/form_tabular.C
+src/frontends/xforms/form_spellchecker.C
 src/frontends/xforms/FormTabular.C
-src/frontends/xforms/form_tabular_create.C
+src/frontends/xforms/form_tabular.C
 src/frontends/xforms/FormTabularCreate.C
-src/frontends/xforms/form_toc.C
+src/frontends/xforms/form_tabular_create.C
 src/frontends/xforms/FormToc.C
-src/frontends/xforms/form_url.C
+src/frontends/xforms/form_toc.C
 src/frontends/xforms/FormUrl.C
+src/frontends/xforms/form_url.C
 src/frontends/xforms/FormVCLog.C
 src/frontends/xforms/input_validators.C
 src/frontends/xforms/Menubar_pimpl.C
@@ -130,7 +130,6 @@ src/insets/insetfoot.C
 src/insets/insetgraphics.C
 src/insets/insetinclude.C
 src/insets/insetindex.C
-src/insets/insetinfo.C
 src/insets/insetlabel.C
 src/insets/insetlist.C
 src/insets/insetmarginal.C
index e3a4b0f8a13e98ecc826367dea6ad9c34d03d2c1..f52dd19560c789d99af6f29e0dbd92a000819267 100644 (file)
@@ -678,10 +678,10 @@ void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button)
            if (text->bv_owner) {
                screen_->hideCursor();
                screen_->toggleSelection(text, bv_);
-               text->selectWord(bv_);
+               text->selectWord(bv_, LyXText::WHOLE_WORD_STRICT);
                screen_->toggleSelection(text, bv_, false);
            } else {
-               text->selectWord(bv_);
+               text->selectWord(bv_, LyXText::WHOLE_WORD_STRICT);
            }
            /* This will fit the cursor on the screen
             * if necessary */
@@ -2979,15 +2979,22 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
        case LFUN_INDEX_CREATE:
        {
                InsetCommandParams p("index");
+               LyXText * lt = bv_->getLyXText();
                
                if (argument.empty()) {
                        // Get word or selection
-                       bv_->getLyXText()->selectWordWhenUnderCursor(bv_);
+                       lt->selectWordWhenUnderCursor(bv_, LyXText::PREVIOUS_WORD);
                        
-                       string const curstring = 
-                               bv_->getLyXText()->selectionAsString(buffer_);
-
-                       p.setContents(curstring);
+                       if (!lt->selection.set()) {
+                               owner_->message(_("Nothing to index!"));
+                               break;
+                       }
+                       if (lt->selection.start.par() != lt->selection.end.par()) {
+                               owner_->message(_("Cannot index more than one paragraph!"));
+                               break;
+                       }
+                       
+                       p.setContents(lt->selectionAsString(buffer_));
                } else {
                        p.setContents(argument);
                }
@@ -3011,13 +3018,20 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                    
        case LFUN_INDEX_INSERT_LAST:
        {
+               LyXText * lt = bv_->getLyXText();
                // Get word or selection
-               bv_->getLyXText()->selectWordWhenUnderCursor(bv_);
-
-               string const curstring = 
-                       bv_->getLyXText()->selectionAsString(buffer_);
+               lt->selectWordWhenUnderCursor(bv_, LyXText::PREVIOUS_WORD);
 
-               InsetCommandParams p("index", curstring);
+               if (!lt->selection.set()) {
+                       owner_->message(_("Nothing to index!"));
+                       break;
+               }
+               if (lt->selection.start.par() != lt->selection.end.par()) {
+                       owner_->message(_("Cannot index more than one paragraph!"));
+                       break;
+               }
+               
+               InsetCommandParams p("index", lt->selectionAsString(buffer_));
                InsetIndex * inset = new InsetIndex(p);
 
                if (!insertInset(inset))
index 087933c3794ddd131e7e1238da874b8124a12c51..0990cc7243385e07604d6db4cccbccfd75223496 100644 (file)
@@ -1,3 +1,15 @@
+2001-07-27  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * BufferView_pimpl.C (Dispatch): use WHOLE_WORD selection for
+       index; also, check that there is something to index, and that it
+       does not span over several paragraphs.
+       (doubleClick): use WHOLE_WORD_STRICT for double click.
+
+       * text.C (getWord): handle new WHOLE_WORD_STRICT word_location value.
+
+       * text2.C (toggleFree): do selection with WHOLE_WORD_STRICT
+       scheme.
+
 2001-07-27  Juergen Vigna  <jug@sad.it>
 
        * text2.C: font.realize function adaption.
index 13fc1ad36fc0368db5eb8c3422b20240229616e7..fa4c5b4a58d4d5379640125ac92c721a649d2dbf 100644 (file)
@@ -1,3 +1,8 @@
+2001-07-26  Yves Bastide  <stid@libd-pc11.univ-bpclermont.fr>
+
+       * insetquotes.C (dispString): display the right ISO8859-{1,9,15}
+       quotes
+
 2001-07-27  Juergen Vigna  <jug@sad.it>
 
        * inset.h: remove not used font variable in parameter.
index 6ae646b0bb1867daede4e22284cbe4726c65fdec..3c6c1d1e81d75ab3fc0dfa1708518d15fe456d36 100644 (file)
@@ -153,11 +153,17 @@ string const InsetQuotes::dispString(Language const * loclang) const
                disp += disp;
 
        if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
-           || lyxrc.font_norm_type == LyXRC::ISO_8859_15)
-               if (disp == "<<")
+           || lyxrc.font_norm_type == LyXRC::ISO_8859_9
+           || lyxrc.font_norm_type == LyXRC::ISO_8859_15) {
+               if (disp == "'")
+                       disp = "´";
+               else if (disp == "''")
+                       disp = "´´";
+               else if (disp == "<<")
                        disp = '«';
                else if (disp == ">>")
                        disp = '»';
+       }
 
        // in french, spaces are added inside double quotes
        if (times_ == DoubleQ && prefixIs(loclang->code(), "fr")) {
index 0cb33eac0d73f6a629fb9769fd45408ba5dc0fbb..e446658a6dbcdb8376728cb27e4166a7f5262a9b 100644 (file)
@@ -48,10 +48,15 @@ public:
        };
        ///
        enum word_location {
-               /// the word around the cursor
+               // the word around the cursor, only if the cursor is
+               //not at a boundary
+               WHOLE_WORD_STRICT,
+               // the word around the cursor
                WHOLE_WORD,
                /// the word begining from the cursor position
                PARTIAL_WORD,
+               /// the word around the cursor or before the cursor
+               PREVIOUS_WORD,
                /// the next word (not yet used)
                NEXT_WORD
        };
@@ -272,7 +277,7 @@ public:
        void getWord(LyXCursor & from, LyXCursor & to, 
                     word_location const) const;
        /// just selects the word the cursor is in
-       void selectWord(BufferView *, word_location const = WHOLE_WORD);
+       void selectWord(BufferView *, word_location const);
        /// returns the inset at cursor (if it exists), 0 otherwise
        Inset * getInset() const;
 
@@ -354,7 +359,7 @@ public:
        void deleteLineForward(BufferView *);
        ///
        bool selectWordWhenUnderCursor(BufferView *, 
-                                      word_location const = WHOLE_WORD);
+                                      word_location const);
        ///
        enum TextCase {
                ///
index 303559a852df35b30ee1918ea837e2be14864e92..bda7eb5ce3d6665498090c0611a079b41d265569 100644 (file)
@@ -2180,12 +2180,27 @@ void LyXText::getWord(LyXCursor & from, LyXCursor & to,
        // first put the cursor where we wana start to select the word
        from = cursor;
        switch(loc) {
+       case WHOLE_WORD_STRICT:
+               if (cursor.pos() == 0 || cursor.pos() == cursor.par()->size()
+                   || cursor.par()->isSeparator(cursor.pos())
+                   || cursor.par()->isKomma(cursor.pos())
+                   || cursor.par()->isSeparator(cursor.pos() -1)
+                   || cursor.par()->isKomma(cursor.pos() -1)) {
+                       to = from;
+                       return;
+               }
+               // no break here, we go to the next
+               
        case WHOLE_WORD:
                // Move cursor to the beginning, when not already there.
                if (from.pos() && !from.par()->isSeparator(from.pos() - 1)
                    && !from.par()->isKomma(from.pos() - 1))
                        cursorLeftOneWord(from);
                break;
+       case PREVIOUS_WORD:
+               // always move the cursor to the beginning of previous word
+               cursorLeftOneWord(from);
+               break;
        case NEXT_WORD:
                lyxerr << "LyXText::getWord: NEXT_WORD not implemented yet\n";
                break;
@@ -2210,29 +2225,22 @@ void LyXText::selectWord(BufferView * bview, word_location const loc)
        getWord(from, to, loc);
        if (cursor != from)
                setCursor(bview, from.par(), from.pos());
+       if (to == from)
+               return;
        selection.cursor = cursor;
        setCursor(bview, to.par(), to.pos() );
        setSelection(bview);
 }
 
-/* -------> Select the word currently under the cursor when:
-                       1: no selection is currently set,
-       [disabled]      2: the cursor is not at the borders of the word. */
 
+/* -------> Select the word currently under the cursor when no
+       selection is currently set */
 bool LyXText::selectWordWhenUnderCursor(BufferView * bview, 
                                        word_location const loc) 
 {
-       if (!selection.set() 
-#if 0
-           && cursor.pos() > 0 && cursor.pos() < cursor.par()->size()
-           && !cursor.par()->isSeparator(cursor.pos())
-           && !cursor.par()->isKomma(cursor.pos())
-           && !cursor.par()->isSeparator(cursor.pos() -1)
-           && !cursor.par()->isKomma(cursor.pos() -1)
-#endif
-           ) {
+       if (!selection.set()) {
                selectWord(bview, loc);
-               return true;
+               return selection.set();
        }
        return false;
 }
index c61d56219ea49188cbb6af5881c50000d3a5f54d..1d4b918dfeddccedef330a6060928e283e5ca41e 100644 (file)
@@ -1040,7 +1040,7 @@ void LyXText::toggleFree(BufferView * bview,
        LyXCursor resetCursor = cursor;
        bool implicitSelection = (font.language() == ignore_language
                                  && font.number() == LyXFont::IGNORE)
-               ? selectWordWhenUnderCursor(bview) : false;
+               ? selectWordWhenUnderCursor(bview, WHOLE_WORD_STRICT) : false;
 
        // Set font
        setFont(bview, font, toggleall);