]> git.lyx.org Git - features.git/commitdiff
Fixed various "missing features" in the tabular/textinset code.
authorJürgen Vigna <jug@sad.it>
Fri, 22 Dec 2000 14:44:29 +0000 (14:44 +0000)
committerJürgen Vigna <jug@sad.it>
Fri, 22 Dec 2000 14:44:29 +0000 (14:44 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1286 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
po/POTFILES.in
src/bufferview_funcs.C
src/bufferview_funcs.h
src/insets/insettabular.C
src/lyxfunc.C
src/mathed/formula.C
src/tabular.C
src/text.C

index c54d9d5b0d0862e7c2c5500559cf059cf82316b0..1a7262007eb3eb674055530400a7b20f3d8bc48d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2000-12-22  Juergen Vigna  <jug@sad.it>
+
+       * src/insets/insettabular.C (InsetButtonPress): do nothing if we
+       have a selection and button == 3.
+       (UpdateLocal): if what == INIT clear selection if existent!
+       (InsetButtonPress): don't activate the cell inset on button==3
+       (Edit): ditto
+       (LocalDispatch): move curor up/down if exiting an inset which this
+       keys.
+
+2000-12-20  Juergen Vigna  <jug@sad.it>
+
+       * src/mathed/formula.C (LocalDispatch): return UNDISPATCHED when
+       calling for the math-panel (do not unlock the math-inset if locked)!
+
+       * src/text.C (GetVisibleRow): fixed drawing of depth lines inside
+       text-insets (with x-offset).
+
+       * src/tabular.C (TeXCellPreamble): fixed wrong output of special
+       alignment of multicolumn-cells.
+
+2000-12-19  Juergen Vigna  <jug@sad.it>
+
+       * src/lyxfunc.C (Dispatch): 
+       * src/bufferview_funcs.C (changeDepth): implemented DEPTH functions
+       for insettext.
+
 2000-12-19  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
        * src/WorkArea.C (work_area_handler): simplify the key/keysym
index 6bbe76c9238b543b588a1d074c3a5eb31ac3312f..59c622c5603bf49229119b68e9af317e5922d8d6 100644 (file)
@@ -53,35 +53,35 @@ src/frontends/kde/refdlg.C
 src/frontends/kde/tocdlg.C
 src/frontends/kde/urldlg.C
 src/frontends/xforms/FormBase.h
-src/frontends/xforms/form_citation.C
 src/frontends/xforms/FormCitation.C
-src/frontends/xforms/form_copyright.C
+src/frontends/xforms/form_citation.C
 src/frontends/xforms/FormCopyright.C
-src/frontends/xforms/form_document.C
+src/frontends/xforms/form_copyright.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_graphics.C
+src/frontends/xforms/form_error.C
 src/frontends/xforms/FormGraphics.C
-src/frontends/xforms/form_index.C
+src/frontends/xforms/form_graphics.C
 src/frontends/xforms/FormIndex.C
+src/frontends/xforms/form_index.C
 src/frontends/xforms/FormInset.h
-src/frontends/xforms/form_paragraph.C
 src/frontends/xforms/FormParagraph.C
-src/frontends/xforms/form_preferences.C
+src/frontends/xforms/form_paragraph.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_tabular.C
+src/frontends/xforms/form_ref.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/input_validators.C
 src/frontends/xforms/Menubar_pimpl.C
 src/frontends/xforms/xform_helpers.C
index a68acf56c069943f5c72bf1d9266e7d32e3f7689..7130348ece2be60db4b4a85b16d967e877bc029d 100644 (file)
@@ -127,16 +127,19 @@ void Tex(BufferView * bv)
 // Change environment depth.
 // if decInc >= 0, increment depth
 // if decInc <  0, decrement depth
-void changeDepth(BufferView * bv, int decInc)
+void changeDepth(BufferView * bv, LyXText * text, int decInc)
 {
-       if (!bv->available()) return;
+       if (!bv->available() || !text)
+           return;
        
        bv->hideCursor();
        bv->update(BufferView::SELECT|BufferView::FITCUR);
        if (decInc >= 0)
-               bv->text->IncDepth(bv);
+               text->IncDepth(bv);
        else
-               bv->text->DecDepth(bv);
+               text->DecDepth(bv);
+       if (text->inset_owner)
+           bv->updateInset((Inset *)text->inset_owner, true);
        bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
        bv->owner()->getMiniBuffer()
                ->Set(_("Changed environment depth"
index 2ba44d3013ef8b8774bf65f5418e96db85ec2dff..2a062c9eee3b60ceec50128a87ec1da15e066216 100644 (file)
@@ -20,6 +20,7 @@
 
 class BufferView;
 class LyXFont;
+class LyXText;
 
 #ifndef NEW_INSETS
 ///
@@ -50,7 +51,7 @@ extern void Melt(BufferView *);
 ///
 extern void Tex(BufferView *);
 ///
-extern void changeDepth(BufferView *, int);
+extern void changeDepth(BufferView *, LyXText *, int);
 ///
 extern void Free(BufferView *);
 ///
index 0563397d6c10a2e5a7847f0b0885dc7b897e7289..0872c83b9cacca3bc883e7460ae9beda86637154 100644 (file)
@@ -494,7 +494,7 @@ void InsetTabular::Edit(BufferView * bv, int x, int y, unsigned int button)
     sel_pos_start = sel_pos_end = cursor.pos();
     sel_cell_start = sel_cell_end = actcell;
     bv->text->FinishUndo();
-    if (InsetHit(bv, x, y)) {
+    if (InsetHit(bv, x, y) && (button != 3)) {
        ActivateCellInset(bv, x, y, button);
     }
 //    UpdateLocal(bv, NONE, false);
@@ -529,6 +529,8 @@ void InsetTabular::UpdateLocal(BufferView * bv, UpdateCodes what,
 {
     if (need_update < what) // only set this if it has greater update
        need_update = what;
+    if ((what == INIT) && hasSelection())
+       clearSelection();
     // Dirty Cast! (Lgb)
     if (need_update != NONE) {
        bv->updateInset(const_cast<InsetTabular *>(this), mark_dirty);
@@ -645,10 +647,14 @@ bool InsetTabular::InsertInset(BufferView * bv, Inset * inset)
 
 void InsetTabular::InsetButtonPress(BufferView * bv, int x, int y, int button)
 {
-    if (hasSelection() && (button != 3)) {
+    if (hasSelection() && (button == 3))
+       return;
+
+    if (hasSelection()) {
        clearSelection();
        UpdateLocal(bv, SELECTION, false);
     }
+
     no_selection = false;
 
     int const ocell = actcell;
@@ -660,6 +666,14 @@ void InsetTabular::InsetButtonPress(BufferView * bv, int x, int y, int button)
        UpdateLocal(bv, NONE, false);
     sel_pos_start = sel_pos_end = cursor.pos();
     sel_cell_start = sel_cell_end = actcell;
+    if (button == 3) {
+       if ((ocell != actcell) && the_locking_inset) {
+           the_locking_inset->InsetUnlock(bv);
+           the_locking_inset = 0;
+       }
+       ShowInsetCursor(bv);
+       return;
+    }
 
     bool const inset_hit = InsetHit(bv, x, y);
 
@@ -767,15 +781,25 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
            the_locking_inset->ToggleInsetCursor(bv);
             return result;
         } else if (result == FINISHED) {
+           result = DISPATCHED;
            if ((action == LFUN_RIGHT) || (action == -1)) {
                cursor.pos(inset_pos + 1);
                resetPos(bv);
+           } else if (action == LFUN_DOWN) {
+               if (moveDown(bv) == FINISHED) {
+                   bv->unlockInset(this);
+                   result = FINISHED;
+               }
+           } else if (action == LFUN_UP) {
+               if (moveUp(bv) == FINISHED) {
+                   bv->unlockInset(this);
+                   result = FINISHED;
+               }
            }
            sel_pos_start = sel_pos_end = cursor.pos();
            sel_cell_start = sel_cell_end = actcell;
            the_locking_inset=0;
            ShowInsetCursor(bv);
-           result = DISPATCHED;
            return result;
        }
     }
index 551fb8e4f7a6766b31765c1f27c176aec60412de..10ba450958c625bf0dba79471e10b677c7070aec 100644 (file)
@@ -1017,15 +1017,15 @@ string const LyXFunc::Dispatch(int ac,
                break;
                
        case LFUN_DEPTH:
-               changeDepth(owner->view(), 0);
+               changeDepth(owner->view(), text, 0);
                break;
                
        case LFUN_DEPTH_MIN:
-               changeDepth(owner->view(), -1);
+               changeDepth(owner->view(), text, -1);
                break;
                
        case LFUN_DEPTH_PLUS:
-               changeDepth(owner->view(), 1);
+               changeDepth(owner->view(), text, 1);
                break;
                
        case LFUN_FREE:
index c5c616177f2120b7261fce58d6cd8dbe26009368..9f0935094cbc990875162f248019653c3344de9e 100644 (file)
@@ -1235,6 +1235,8 @@ InsetFormula::LocalDispatch(BufferView * bv,
               mathcursor->setLastCode(LM_TC_TEX);
           } 
         UpdateLocal(bv);
+      } else if (action == LFUN_MATH_PANEL) {
+        result = UNDISPATCHED;
       } else {
        // lyxerr << "Closed by action " << action << endl;
        result =  FINISHED;
@@ -1248,7 +1250,8 @@ InsetFormula::LocalDispatch(BufferView * bv,
    if (mathcursor->Selection() || was_selection)
        ToggleInsetSelection(bv);
     
-   if ((result == DISPATCHED) || (result == DISPATCHED_NOUPDATE))
+   if ((result == DISPATCHED) || (result == DISPATCHED_NOUPDATE) ||
+       (result == UNDISPATCHED))
       ShowInsetCursor(bv);
    else
       bv->unlockInset(this);
index 546ab310efca947fa66d4001b413253e10958bab..d158cf339fbeeec518181ca2583c5a71433345ee 100644 (file)
@@ -2034,8 +2034,8 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const
     }
     if (IsMultiColumn(cell)) {
        os << "\\multicolumn{" << cells_in_multicolumn(cell) << "}{";
-       if (!cellinfo_of_cell(cell+1)->align_special.empty()) {
-           os << cellinfo_of_cell(cell+1)->align_special << "}{";
+       if (!cellinfo_of_cell(cell)->align_special.empty()) {
+           os << cellinfo_of_cell(cell)->align_special << "}{";
        } else {
            if (LeftLine(cell))
                os << '|';
index d915aac7280447325cb8f12ab8e540039e70dcc8..52307ec5c3543502a4e46550b7311c4b442de313 100644 (file)
@@ -3391,7 +3391,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
 
                for (int i = 1; i <= depth; ++i) {
                        int const line_x = (LYX_PAPER_MARGIN / 5) *
-                               (i + minipage) + box_x;
+                               (i + minipage) + box_x + x_offset;
                        pain.line(line_x, y_offset, line_x,
                                  y_offset + row_ptr->height() - 1 - (i - next_depth - 1) * 3,
                                  LColor::depthbar);