mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 14:15:32 +00:00
Better conditioning of drawing vertical grid lines
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9744 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a73ed93eb0
commit
1506064b51
@ -1,4 +1,10 @@
|
||||
|
||||
2005-03-24 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* math_hullinset.C:
|
||||
* math_casesinset.[Ch]: more precise conditioning of
|
||||
output of vertical grid lines
|
||||
|
||||
2005-03-22 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* math_hullinset.C (getStatus): intercept and suppress the
|
||||
|
@ -14,8 +14,26 @@
|
||||
#include "math_data.h"
|
||||
#include "math_mathmlstream.h"
|
||||
#include "math_support.h"
|
||||
#include "FuncStatus.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "support/std_ostream.h"
|
||||
#include "cursor.h"
|
||||
#include "funcrequest.h"
|
||||
#include "gettext.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using lyx::support::bformat;
|
||||
|
||||
using std::endl;
|
||||
using std::max;
|
||||
using std::min;
|
||||
using std::swap;
|
||||
using std::istringstream;
|
||||
using std::string;
|
||||
|
||||
using std::auto_ptr;
|
||||
|
||||
@ -47,6 +65,47 @@ void MathCasesInset::draw(PainterInfo & pi, int x, int y) const
|
||||
}
|
||||
|
||||
|
||||
void MathCasesInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
{
|
||||
//lyxerr << "*** MathCasesInset: request: " << cmd << endl;
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
recordUndo(cur);
|
||||
istringstream is(cmd.argument);
|
||||
string s;
|
||||
is >> s;
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
cur.undispatched();
|
||||
break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
MathGridInset::doDispatch(cur, cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool MathCasesInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
istringstream is(cmd.argument);
|
||||
string s;
|
||||
is >> s;
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.enabled(false);
|
||||
flag.message(bformat(
|
||||
N_("No vertical grid lines in '%1$s'"), s));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
default:
|
||||
return MathGridInset::getStatus(cur, cmd, flag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MathCasesInset::write(WriteStream & os) const
|
||||
{
|
||||
if (os.fragile())
|
||||
|
@ -25,6 +25,11 @@ public:
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
|
||||
///
|
||||
bool getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const;
|
||||
|
||||
///
|
||||
void infoize(std::ostream & os) const;
|
||||
|
@ -1125,10 +1125,16 @@ bool MathHullInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
if ((type_ == "simple"
|
||||
|| type_ == "equation"
|
||||
|| type_ == "none") &&
|
||||
(s == "add-hline-above" || s == "add-hline-below" ||
|
||||
s == "add-vline-left" || s == "add-vline-right")) {
|
||||
(s == "add-hline-above" || s == "add-hline-below")) {
|
||||
flag.message(bformat(
|
||||
N_("Can't add grid lines in '%1$s'"),
|
||||
N_("Can't add horizontal grid lines in '%1$s'"),
|
||||
type_));
|
||||
flag.enabled(false);
|
||||
return true;
|
||||
}
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.message(bformat(
|
||||
N_("Can't add vertical grid lines in '%1$s'"),
|
||||
type_));
|
||||
flag.enabled(false);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user