The VSpace inset is now fully functional AFAICT.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8151 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-11-28 17:38:39 +00:00
parent 3bb6b37043
commit 48f7421140
8 changed files with 70 additions and 7 deletions

View File

@ -1,3 +1,7 @@
2003-11-28 Angus Leeming <leeming@lyx.org>
* ui/stdmenus.ui: add Insert VSpace.
2003-11-28 Angus Leeming <leeming@lyx.org>
* scripts/convertDefault.sh: use cut in preference to sed, but use it

View File

@ -265,6 +265,7 @@ Menuset
Item "Thin Space|T" "space-insert thin"
Item "Horizontal Fill|H" "hfill-insert"
Item "Horizontal Line" "line-insert"
Item "Vertical Space" "dialog-show-new-inset vspace"
Separator
Item "Hyphenation Point|P" "hyphenation-point-insert"
Item "Ligature Break|k" "ligature-break-insert"

View File

@ -139,6 +139,7 @@ src/frontends/xforms/FormThesaurus.C
src/frontends/xforms/FormToc.C
src/frontends/xforms/FormUrl.C
src/frontends/xforms/FormVCLog.C
src/frontends/xforms/FormVSpace.C
src/frontends/xforms/FormWrap.C
src/frontends/xforms/XFormsMenubar.C
src/frontends/xforms/XMiniBuffer.C
@ -173,6 +174,7 @@ src/insets/insettext.C
src/insets/insettheorem.C
src/insets/insettoc.C
src/insets/inseturl.C
src/insets/insetvspace.C
src/insets/insetwrap.C
src/insets/render_graphic.C
src/insets/render_preview.C

View File

@ -1,3 +1,7 @@
2003-11-28 Angus Leeming <leeming@lyx.org>
* FormVSpace (build): fill the 'choice_space' widget. Enable the other
two widgets when it is set to 'Length.
2003-11-28 André Pönitz <poenitz@gmx.net>

View File

@ -167,8 +167,10 @@ void FormVSpace::build()
// disable for read-only documents
bcview().addReadOnly(dialog_->choice_space);
bcview().addReadOnly(dialog_->input_space);
bcview().addReadOnly(dialog_->choice_unit_space);
// check validity of "length + unit" input
// check validity of "length + unit" input.
// If invalid, the label of choice_space is displayed in red.
addCheckedGlueLength(bcview(),
dialog_->input_space,
dialog_->choice_space);
@ -178,6 +180,10 @@ void FormVSpace::build()
fl_set_input_return(dialog_->input_space, FL_RETURN_CHANGED);
string const spacing =
_("None|DefSkip|SmallSkip|MedSkip|BigSkip|VFill|Length");
fl_addto_choice(dialog_->choice_space, spacing.c_str());
// Create the contents of the unit choices; don't include the "%" terms.
vector<string> units_vec = getLatexUnits();
vector<string>::iterator del =
@ -236,6 +242,10 @@ void FormVSpace::update()
dialog_->input_space,
dialog_->choice_unit_space);
bool const custom_length =
fl_get_choice(dialog_->choice_space) == 7;
setEnabled(dialog_->input_space, custom_length);
setEnabled(dialog_->choice_unit_space, custom_length);
}
@ -246,6 +256,8 @@ ButtonPolicy::SMInput FormVSpace::input(FL_OBJECT * ob, long)
if (ob == dialog_->choice_space) {
bool const custom_length =
fl_get_choice(dialog_->choice_space) == 7;
setEnabled(dialog_->input_space, custom_length);
setEnabled(dialog_->choice_unit_space, custom_length);
}
return ButtonPolicy::SMI_VALID;
}

View File

@ -1,3 +1,9 @@
2003-11-28 Angus Leeming <leeming@lyx.org>
* insetvspace.[Ch] (d-tor, priv_dispatch): new member functions,
hiding and showing the dialog respectively.
(priv_dispatch): also actually update the inset contents.
2003-11-28 Angus Leeming <leeming@lyx.org>
* insetbox.C (d-tor):

View File

@ -14,19 +14,20 @@
#include "insetvspace.h"
#include "buffer.h"
#include "debug.h"
#include "BufferView.h"
#include "dispatchresult.h"
#include "funcrequest.h"
#include "gettext.h"
#include "LColor.h"
#include "lyxlex.h"
#include "lyxtext.h"
#include "metricsinfo.h"
#include "gettext.h"
#include "frontends/Painter.h"
#include "frontends/font_metrics.h"
#include "frontends/Painter.h"
#include "support/std_sstream.h"
using std::endl;
using std::istringstream;
using std::ostream;
using std::ostringstream;
@ -40,12 +41,39 @@ InsetVSpace::InsetVSpace(VSpace const & space)
{}
InsetVSpace::~InsetVSpace()
{
InsetVSpaceMailer(*this).hideDialog();
}
std::auto_ptr<InsetBase> InsetVSpace::clone() const
{
return std::auto_ptr<InsetBase>(new InsetVSpace(*this));
}
DispatchResult
InsetVSpace::priv_dispatch(FuncRequest const & cmd,
idx_type & idx, pos_type & pos)
{
switch (cmd.action) {
case LFUN_INSET_MODIFY: {
InsetVSpaceMailer::string2params(cmd.argument, space_);
return DispatchResult(true, true);
}
case LFUN_MOUSE_PRESS:
InsetVSpaceMailer(*this).showDialog(cmd.view());
return DispatchResult(true, true);
default:
return InsetOld::priv_dispatch(cmd, idx, pos);
}
}
void InsetVSpace::read(Buffer const &, LyXLex & lex)
{
if (lex.isOK()) {
@ -200,8 +228,6 @@ string const InsetVSpaceMailer::inset2string(Buffer const &) const
void InsetVSpaceMailer::string2params(string const & in, VSpace & vspace)
{
//lyxerr << "\nInsetVSpaceMailer::string2params, got: '" << in << "'" << endl;
vspace = VSpace();
if (in.empty())

View File

@ -24,6 +24,8 @@ public:
///
InsetVSpace(VSpace const &);
///
~InsetVSpace();
///
std::auto_ptr<InsetBase> clone() const;
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
@ -48,6 +50,12 @@ public:
///
bool display() const { return true; }
protected:
///
virtual
DispatchResult
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
public:
/// how much
VSpace space_;