]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
de.po
[lyx.git] / src / Text3.cpp
index d63bb93e42f5a791d4b78c4462f26d50ef67be4b..7e24041cef7f7918aa64dd6341970f44b8e613ea 100644 (file)
@@ -562,10 +562,10 @@ void Text::number(Cursor & cur)
 }
 
 
-bool Text::isRTL(Paragraph const & par) const
+bool Text::isRTL(pit_type const pit) const
 {
        Buffer const & buffer = owner_->buffer();
-       return par.isRTL(buffer.params());
+       return pars_[pit].isRTL(buffer.params());
 }
 
 
@@ -927,6 +927,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                break;
        }
 
+       case LFUN_PARAGRAPH_SELECT:
+               if (cur.pos() > 0)
+                       needsUpdate |= setCursor(cur, cur.pit(), 0);
+               needsUpdate |= cur.selHandle(true);
+               if (cur.pos() < cur.lastpos())
+                       needsUpdate |= setCursor(cur, cur.pit(), cur.lastpos());
+               break;
+
        case LFUN_PARAGRAPH_UP:
        case LFUN_PARAGRAPH_UP_SELECT:
                needsUpdate |= cur.selHandle(cmd.action() == LFUN_PARAGRAPH_UP_SELECT);
@@ -1762,9 +1770,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_MOUSE_TRIPLE:
                if (cmd.button() == mouse_button::button1) {
-                       tm->cursorHome(cur);
+                       if (cur.pos() > 0)
+                               setCursor(cur, cur.pit(), 0);
+                       bv->cursor() = cur;
                        cur.resetAnchor();
-                       tm->cursorEnd(cur);
+                       if (cur.pos() < cur.lastpos())
+                               setCursor(cur, cur.pit(), cur.lastpos());
                        cur.setSelection();
                        bv->cursor() = cur;
                }
@@ -2077,14 +2088,31 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                break;
        }
 
-       case LFUN_TABULAR_INSERT:
+       case LFUN_TABULAR_INSERT: {
                // if there were no arguments, just open the dialog
+               if (cmd.argument().empty()) {
+                       bv->showDialog("tabularcreate");
+                       break;
+               } else if (cur.buffer()->masterParams().tablestyle != "default"
+                          || bv->buffer().params().documentClass().tablestyle() != "default") {
+                       string tabstyle = cur.buffer()->masterParams().tablestyle;
+                       if (tabstyle == "default")
+                               tabstyle = bv->buffer().params().documentClass().tablestyle();
+                       if (!libFileSearch("tabletemplates", tabstyle + ".lyx").empty()) {
+                               FuncRequest fr(LFUN_TABULAR_STYLE_INSERT,
+                                              tabstyle + " " + to_ascii(cmd.argument()));
+                               lyx::dispatch(fr);
+                               break;
+                       } else
+                               // Unknown style. Report and fall back to default.
+                               cur.errorMessage(from_utf8(N_("Table Style ")) + from_utf8(tabstyle) +
+                                                    from_utf8(N_(" not known")));
+                       
+               }
                if (doInsertInset(cur, this, cmd, false, true))
                        cur.posForward();
-               else
-                       bv->showDialog("tabularcreate");
-
                break;
+       }
 
        case LFUN_TABULAR_STYLE_INSERT: {
                string const style = cmd.getArg(0);
@@ -2109,30 +2137,27 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                cur.recordUndo();
                FuncRequest cmd2(LFUN_FILE_INSERT, tabstyle.absFileName() + " ignorelang");
                lyx::dispatch(cmd2);
+               // go into table
+               cur.backwardPos();
                if (r > 2) {
-                       // go into table
-                       cur.backwardPos();
                        // move one cell up to middle cell
                        cur.up();
-                       // now add the missing rows and columns
+                       // add the missing rows
                        int const addrows = r - 3;
-                       int const addcols = c - 1;
                        for (int i = 0 ; i < addrows ; ++i) {
                                FuncRequest fr(LFUN_TABULAR_FEATURE, "append-row");
                                lyx::dispatch(fr);
                        }
-                       for (int i = 0 ; i < addcols ; ++i) {
-                               FuncRequest fr(LFUN_TABULAR_FEATURE, "append-column");
-                               lyx::dispatch(fr);
-                       }
+               }
+               // add the missing columns
+               int const addcols = c - 1;
+               for (int i = 0 ; i < addcols ; ++i) {
+                       FuncRequest fr(LFUN_TABULAR_FEATURE, "append-column");
+                       lyx::dispatch(fr);
+               }
+               if (r > 1)
                        // go to first cell
                        cur.up();
-               } else {
-                       // jump over table
-                       cur.backwardChar();
-                       // go to first cell
-                       cur.forwardPos();
-               }
                break;
        }
 
@@ -3520,6 +3545,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_UP_SELECT:
        case LFUN_DOWN:
        case LFUN_DOWN_SELECT:
+       case LFUN_PARAGRAPH_SELECT:
        case LFUN_PARAGRAPH_UP_SELECT:
        case LFUN_PARAGRAPH_DOWN_SELECT:
        case LFUN_LINE_BEGIN_SELECT: