]> git.lyx.org Git - lyx.git/commitdiff
Add an updateParagraph signal, take the opportunity to make a couple of
authorAngus Leeming <leeming@lyx.org>
Fri, 15 Jun 2001 16:18:43 +0000 (16:18 +0000)
committerAngus Leeming <leeming@lyx.org>
Fri, 15 Jun 2001 16:18:43 +0000 (16:18 +0000)
cosmetic name changes to existing signals.
updateParagraph signal emitted from BufferView::fitCursor().
Add crude machinery to deal with it in the xforms Paragraph dialog.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2130 a592a061-630c-0410-9148-cb99ea01b6c8

14 files changed:
src/BufferView_pimpl.C
src/ChangeLog
src/frontends/ChangeLog
src/frontends/Dialogs.h
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlCharacter.C
src/frontends/qt2/ChangeLog
src/frontends/qt2/FormCharacter.C
src/frontends/qt2/FormParagraph.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormDocument.C
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/FormParagraph.h
src/lyxfunc.C

index cf88692a48a6de4bdc919ef0ff686ff124ab37a2..1538a7515f9fbb0f119ef098e5db8f0bba5afb04 100644 (file)
@@ -251,7 +251,9 @@ void BufferView::Pimpl::redraw()
 bool BufferView::Pimpl::fitCursor(LyXText * text)
 {
        lyx::Assert(screen_.get());
+
+       bv_->owner()->getDialogs()->updateParagraph();
+
        bool const ret = screen_->FitCursor(text, bv_);
        if (ret)
            updateScrollbar();
@@ -297,7 +299,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
                selendpos = bv_->text->selection.end.pos();
                selection = bv_->text->selection.set();
                mark_set = bv_->text->selection.mark();
-               the_locking_inset = bv_->text->the_locking_inset;
+               the_locking_inset = bv_->theLockingInset();
                delete bv_->text;
                bv_->text = new LyXText(bv_);
        } else {
@@ -336,7 +338,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
                        bv_->text->selection.set(false);
                }
                // remake the inset locking
-               bv_->text->the_locking_inset = the_locking_inset;
+               bv_->theLockingInset(the_locking_inset);
        }
        bv_->text->first = screen_->TopCursorVisible(bv_->text);
        buffer_->resizeInsets(bv_);
index b7a885b7f2b68887fe6d4ccf1173a16956d63bf0..55f9e2535338e448dc38dc3f4851ddcc4668993d 100644 (file)
@@ -1,3 +1,12 @@
+2001-06-15  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * BufferView_pimpl.C (fitCursor): emit a signal updateParagraph.
+       (resizeCurrentBuffer): have functions BufferView::theLockingInset()
+       and BufferView::theLockingInset(Inset*), so should use them and not
+       access bv_->text->the_locking_inset directly.
+
+       * lyxfunc.C (Dispatch): cosmetic name change of three signals.
+
 2001-06-02  John Levon  <moz@compsoc.man.ac.uk>
 
        * Makefile.am:
index 72bb5b3ed210b1fe9ccced061d3d8be974374e34..6b209d68401884e9b524f9a98f50bf15505d8924 100644 (file)
@@ -1,3 +1,12 @@
+2001-06-15  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * Dialogs.h: removed unused signal showCharacter.
+       Renamed signals showLayoutDocument -> showDocument,
+       showLayoutParagraph -> showParagraph,
+       showLayoutCharacter -> showCharacter.
+       Added signal updateParagraph.
+       Rearranged signals in some sort of alphabetical order again.
+
 2001-06-14  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * FileDialog.h:
index 97cd57e610b42c171340c400fc7f15e805ff17b6..1e807ba45eeb0b3191bcc9887edb5aca9a193c41 100644 (file)
@@ -44,6 +44,7 @@ class InsetInfo;
 class InsetTabular;
 class InsetCommand;
 class InsetMinipage;
+class LyXParagraph;
 
 /** Container of all dialogs and signals a LyXView needs or uses to access them
     The list of dialog signals isn't comprehensive but should be a good guide
@@ -90,6 +91,8 @@ public:
        SigC::Signal1<void, InsetCommand *> showBibtex;
        ///
        SigC::Signal0<void> showCharacter;
+       /// connected to the character dialog also
+       SigC::Signal0<void> setUserFreeFont;
        ///
        SigC::Signal1<void, InsetCommand *> showCitation;
        ///
@@ -99,6 +102,8 @@ public:
        ///
        SigC::Signal0<void> showCredits;
        ///
+       SigC::Signal0<void> showDocument;
+       ///
        SigC::Signal1<void, InsetError *> showError;
        /// show the external inset dialog
        SigC::Signal1<void, InsetExternal *> showExternal; 
@@ -112,21 +117,19 @@ public:
        SigC::Signal1<void, string const &> createIndex;
        ///
        SigC::Signal1<void, InsetInfo *> showInfo;
-       ///
-       SigC::Signal0<void> showLayoutDocument;
-       ///
-       SigC::Signal0<void> showLayoutParagraph;
-       ///
-       SigC::Signal0<void> showLayoutCharacter;
-       ///
-       SigC::Signal0<void> setUserFreeFont;
-       /// show the version control log
-       SigC::Signal0<void> showVCLogFile;
        /// show the LaTeX log or build file
        SigC::Signal0<void> showLogFile;
        /// display the top-level maths panel
        SigC::Signal0<void> showMathPanel;
        ///
+       SigC::Signal1<void, InsetMinipage *> showMinipage;
+       ///
+       SigC::Signal1<void, InsetMinipage *> updateMinipage;
+       ///
+       SigC::Signal0<void> showParagraph;
+       ///
+       SigC::Signal0<void> updateParagraph;
+       ///
        SigC::Signal0<void> showPreamble;
        ///
        SigC::Signal0<void> showPreferences;
@@ -149,10 +152,6 @@ public:
        ///
        SigC::Signal0<void> showTabularCreate;
        ///
-       SigC::Signal1<void, InsetMinipage *> showMinipage;
-       ///
-       SigC::Signal1<void, InsetMinipage *> updateMinipage;
-       ///
        SigC::Signal1<void, InsetCommand *> showTOC;
        ///
        SigC::Signal1<void, string const &> createTOC;
@@ -160,8 +159,8 @@ public:
        SigC::Signal1<void, InsetCommand *> showUrl;
        ///
        SigC::Signal1<void, string const &> createUrl;
-       ///
-       SigC::Signal0<void> updateCharacter;  // allow update as cursor moves
+       /// show the version control log
+       SigC::Signal0<void> showVCLogFile;
        //@}
 private:
        /// Add a dialog to the vector of dialogs.
index 86ae572e92767d908c99d14249ada2ce2e01bd01..105e445ac17c3c917e26db33d138f08a0858af6d 100644 (file)
@@ -1,3 +1,7 @@
+2001-06-15  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * ControlCharacter.C (c-tor): cosmetic name change of signal.
+
 2001-06-13  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * *.[h]: added // -*- C++ -*-
index 10cce2c8ce8ba7d669b0532b6df05e979970aa7d..4f14ca4f030613442e923a1ddb13b3e58c158ad5 100644 (file)
@@ -33,7 +33,7 @@ ControlCharacter::ControlCharacter(LyXView & lv, Dialogs & d)
        : ControlDialog<ControlConnectBD>(lv, d),
          font_(0), toggleall_(false)
 {
-       d_.showLayoutCharacter.connect(slot(this, &ControlCharacter::show));
+       d_.showCharacter.connect(slot(this, &ControlCharacter::show));
        d_.setUserFreeFont.connect(slot(this, &ControlCharacter::apply));
 }
 
index 6d25ff085d4146c2fe88ca57f64830ee9e8d4953..67bff5a584a781c68e599fee390b092567a9b3b6 100644 (file)
@@ -1,3 +1,8 @@
+2001-06-15  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * FormCharacter.C:
+       * FormParagraph.C (c-tor): cosmetic name change of signal.
+
 2001-06-14  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * FormCitation.C:
index c50be783297117b481e157d2ccc34bf186941e3c..fd50819ef5b011ee9fc7890cff00aee5500b47a4 100644 (file)
@@ -29,7 +29,7 @@ FormCharacter::FormCharacter(LyXView *v, Dialogs *d)
        // let the dialog be shown
        // This is a permanent connection so we won't bother
        // storing a copy because we won't be disconnecting.
-       d->showLayoutCharacter.connect(slot(this, &FormCharacter::show));
+       d->showCharacter.connect(slot(this, &FormCharacter::show));
        // for LFUN_FREE
        d->setUserFreeFont.connect(slot(this, &FormCharacter::apply));
 }
index 513514b5b8234aee3efda897cec780a7d463f298..451f499a8ae10b88043169d3c4053d601d8ba434 100644 (file)
@@ -30,7 +30,7 @@ FormParagraph::FormParagraph(LyXView *v, Dialogs *d)
        // let the dialog be shown
        // This is a permanent connection so we won't bother
        // storing a copy because we won't be disconnecting.
-       d->showLayoutParagraph.connect(slot(this, &FormParagraph::show));
+       d->showParagraph.connect(slot(this, &FormParagraph::show));
 }
 
 
index 3ee35c5dec3347404f0b4fe2afcdf8ec8ef7327d..c41894d9c260358b3210adbba8328ad26b4bc455 100644 (file)
@@ -1,3 +1,13 @@
+2001-06-15  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * FormDocument.C:
+       * FormParagraph.C (c-tor): cosmetic name change of signal.
+
+       * FormParagraph.[Ch]: added machinery to act on an updateParagraph
+       signal. It's pretty crude at the moment! Mental note: would be more
+       elegant if we passed a LyXParagraph & with both the signals rather than
+       search through the Buffer.
+
 2001-06-13  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * *.[h]: added // -*- C++ -*-
index 99e626cd2f571c6452c6da24e13b137e0defda88..9242973071c9691a72bd5fe35eb9c5ef982be22b 100644 (file)
@@ -49,7 +49,7 @@ FormDocument::FormDocument(LyXView * lv, Dialogs * d)
     // let the dialog be shown
     // This is a permanent connection so we won't bother
     // storing a copy because we won't be disconnecting.
-    d->showLayoutDocument.connect(slot(this, &FormDocument::show));
+    d->showDocument.connect(slot(this, &FormDocument::show));
 }
 
 
index ef51c02e2761b00cf17314aac01ddcb1f89ad0c8..9173cd4c22409e0093453472c566027fee2a8ba0 100644 (file)
@@ -31,12 +31,52 @@ using SigC::slot;
 
 
 FormParagraph::FormParagraph(LyXView * lv, Dialogs * d)
-       : FormBaseBD(lv, d, _("Paragraph Layout"))
+       : FormBaseBD(lv, d, _("Paragraph Layout")), par_(0)
 {
     // let the dialog be shown
     // This is a permanent connection so we won't bother
     // storing a copy because we won't be disconnecting.
-    d->showLayoutParagraph.connect(slot(this, &FormParagraph::show));
+    d->showParagraph.connect(slot(this, &FormParagraph::show));
+}
+
+
+void FormParagraph::connect()
+{
+       cp_ = d_->updateParagraph
+               .connect(slot(this, &FormParagraph::changedParagraph));
+       FormBaseBD::connect();
+}
+
+
+void FormParagraph::disconnect()
+{
+       cp_.disconnect();
+       FormBaseBD::disconnect();
+}
+
+
+LyXParagraph const * FormParagraph::getCurrentParagraph() const
+{
+       LyXText * text = 0;
+
+       if (lv_->view()->theLockingInset())
+               text = lv_->view()->theLockingInset()->getLyXText(lv_->view());
+       if (!text)
+               text = lv_->view()->text;
+       return text->cursor.par();
+}
+
+
+void FormParagraph::changedParagraph()
+{
+       /// Record the paragraph
+       LyXParagraph const * const p = getCurrentParagraph();
+       if (p == 0 || p == par_)
+               return;
+
+       // For now don't bother checking if the params are different,
+       // just activate the Apply button
+       bc().valid();
 }
 
 
@@ -240,24 +280,21 @@ void FormParagraph::general_update()
         return;
 
     Buffer * buf = lv_->view()->buffer();
-    LyXText * text = 0;
 
-    if (lv_->view()->theLockingInset())
-       text = lv_->view()->theLockingInset()->getLyXText(lv_->view());
-    if (!text)
-       text = lv_->view()->text;
+    /// Record the paragraph
+    par_ = getCurrentParagraph();
 
     fl_set_input(general_->input_labelwidth,
-                text->cursor.par()->GetLabelWidthString().c_str());
+                par_->GetLabelWidthString().c_str());
     fl_set_button(general_->radio_align_right, 0);
     fl_set_button(general_->radio_align_left, 0);
     fl_set_button(general_->radio_align_center, 0);
     fl_set_button(general_->radio_align_block, 0);
 
-    int align = text->cursor.par()->GetAlign();
+    int align = par_->GetAlign();
     if (align == LYX_ALIGN_LAYOUT)
        align = textclasslist.Style(buf->params.textclass,
-                                   text->cursor.par()->GetLayout()).align;
+                                   par_->GetLayout()).align;
 
     switch (align) {
     case LYX_ALIGN_RIGHT:
@@ -276,7 +313,7 @@ void FormParagraph::general_update()
 
     LyXAlignment alignpos =
            textclasslist.Style(buf->params.textclass,
-                               text->cursor.par()->GetLayout()).alignpossible;
+                               par_->GetLayout()).alignpossible;
 
     setEnabled(general_->radio_align_block,  bool(alignpos & LYX_ALIGN_BLOCK));
     setEnabled(general_->radio_align_center, bool(alignpos & LYX_ALIGN_CENTER));
@@ -284,19 +321,19 @@ void FormParagraph::general_update()
     setEnabled(general_->radio_align_right,  bool(alignpos & LYX_ALIGN_RIGHT));
     
     fl_set_button(general_->check_lines_top,
-                 text->cursor.par()->params.lineTop());
+                 par_->params.lineTop());
     fl_set_button(general_->check_lines_bottom,
-                 text->cursor.par()->params.lineBottom());
+                 par_->params.lineBottom());
     fl_set_button(general_->check_pagebreaks_top,
-                 text->cursor.par()->params.pagebreakTop());
+                 par_->params.pagebreakTop());
     fl_set_button(general_->check_pagebreaks_bottom,
-                 text->cursor.par()->params.pagebreakBottom());
+                 par_->params.pagebreakBottom());
     fl_set_button(general_->check_noindent,
-                 text->cursor.par()->params.noindent());
+                 par_->params.noindent());
 
     fl_set_input (general_->input_space_above, "");
 
-    switch (text->cursor.par()->params.spaceTop().kind()) {
+    switch (par_->params.spaceTop().kind()) {
     case VSpace::NONE:
        fl_set_choice (general_->choice_space_above, 1);
        break;
@@ -317,16 +354,16 @@ void FormParagraph::general_update()
        break;
     case VSpace::LENGTH:
        fl_set_choice (general_->choice_space_above, 7);
-       fl_set_input(general_->input_space_above, text->cursor.par()->
+       fl_set_input(general_->input_space_above, par_->
                     params.spaceTop().length().asString().c_str());
        break;
     }
     
     fl_set_button (general_->check_space_above,
-                  text->cursor.par()->params.spaceTop().keep());
+                  par_->params.spaceTop().keep());
     fl_set_input (general_->input_space_below, "");
 
-    switch (text->cursor.par()->params.spaceBottom().kind()) {
+    switch (par_->params.spaceBottom().kind()) {
     case VSpace::NONE:
        fl_set_choice (general_->choice_space_below, 1);
        break;
@@ -347,14 +384,14 @@ void FormParagraph::general_update()
        break;
     case VSpace::LENGTH:
        fl_set_choice (general_->choice_space_below, 7);
-        fl_set_input(general_->input_space_below, text->cursor.par()->
+        fl_set_input(general_->input_space_below, par_->
                     params.spaceBottom().length().asString().c_str());
        break;
     }
     fl_set_button(general_->check_space_below,
-                  text->cursor.par()->params.spaceBottom().keep());
+                  par_->params.spaceBottom().keep());
     fl_set_button(general_->check_noindent,
-                 text->cursor.par()->params.noindent());
+                 par_->params.noindent());
 }
 
 
index 279c96224672d997cf34ce96d27b51248f9ea5c2..fffb70b1d479225ceec484b2e74f024c899c60b8 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "FormBaseDeprecated.h"
 
+class LyXParagraph;
 struct FD_form_tabbed_paragraph;
 struct FD_form_paragraph_general;
 struct FD_form_paragraph_extra;
@@ -46,7 +47,14 @@ private:
        virtual void update();
        /// Filter the inputs on callback from xforms
        virtual bool input(FL_OBJECT * ob, long);
-
+       /// Connect signals
+       virtual void connect();
+       /// Disconnect signals
+       virtual void disconnect();
+       ///
+       void changedParagraph();
+       ///
+       LyXParagraph const * getCurrentParagraph() const;
        ///
        virtual FL_FORM * form() const;
        
@@ -67,6 +75,11 @@ private:
        boost::scoped_ptr<FD_form_paragraph_general> general_;
        /// The ButtonController
        ButtonController<NoRepeatedApplyReadOnlyPolicy, xformsBC> bc_;
+       /// Changed Paragraph connection.
+       SigC::Connection cp_;
+
+       /// The current LyXParagraph
+       LyXParagraph const * par_;
 };
 
 
index 94a1710e48c05fce2334d490a504f6be315f2273..1ea444bac6da58b2cbb10faf9d63a8e32eda7c54 100644 (file)
@@ -1152,15 +1152,15 @@ string const LyXFunc::Dispatch(int ac,
        }
                
        case LFUN_LAYOUT_DOCUMENT:
-               owner->getDialogs()->showLayoutDocument();
+               owner->getDialogs()->showDocument();
                break;
                
        case LFUN_LAYOUT_PARAGRAPH:
-               owner->getDialogs()->showLayoutParagraph();
+               owner->getDialogs()->showParagraph();
                break;
                
        case LFUN_LAYOUT_CHARACTER:
-               owner->getDialogs()->showLayoutCharacter();
+               owner->getDialogs()->showCharacter();
                break;
 
        case LFUN_LAYOUT_TABULAR: