Add an updateParagraph signal, take the opportunity to make a couple of

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
This commit is contained in:
Angus Leeming 2001-06-15 16:18:43 +00:00
parent ce5660a75c
commit 0e7b7c2125
14 changed files with 138 additions and 50 deletions

View 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_);

View 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:

View 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:

View 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.

View 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++ -*-

View 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));
}

View 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:

View 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));
}

View 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));
}

View 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++ -*-

View 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));
}

View 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());
}

View 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_;
};

View 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: