mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
Martins and my getStatus and infoize fixes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9772 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d6981c3b30
commit
b542257bd8
@ -1,3 +1,18 @@
|
||||
2005-03-31 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* math_amsarrayinset.[Ch], math_tabularinset.[Ch],
|
||||
math_splitinset.[Ch] (infoize): implement
|
||||
* math_casesinset.C (getStatus, doDispatch): use cmd.argument directly
|
||||
* math_gridinset.C (getStatus): ditto
|
||||
* math_arrayinset.C (infoize): generalize
|
||||
|
||||
2005-03-30 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* math_amsarrayinset.[Ch] (getStatus):
|
||||
* math_splitinset.[Ch] (getStatus):
|
||||
* math_substackinset.[Ch]: suppress output of vertical gridlines
|
||||
where appropriate
|
||||
|
||||
2005-04-03 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* math_fontinset.[Ch] (draw): add call to setPosCache,
|
||||
|
@ -17,8 +17,17 @@
|
||||
#include "math_streamstr.h"
|
||||
#include "math_support.h"
|
||||
|
||||
#include "funcrequest.h"
|
||||
#include "FuncStatus.h"
|
||||
#include "gettext.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/std_ostream.h"
|
||||
|
||||
|
||||
using std::string;
|
||||
using std::auto_ptr;
|
||||
using lyx::support::bformat;
|
||||
|
||||
|
||||
MathAMSArrayInset::MathAMSArrayInset(string const & name, int m, int n)
|
||||
@ -90,6 +99,27 @@ void MathAMSArrayInset::draw(PainterInfo & pi, int x, int y) const
|
||||
}
|
||||
|
||||
|
||||
bool MathAMSArrayInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
string const s = cmd.argument;
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.message(bformat(
|
||||
N_("Can't add vertical grid lines in '%1$s'"),
|
||||
name_));
|
||||
flag.enabled(false);
|
||||
return true;
|
||||
}
|
||||
return MathGridInset::getStatus(cur, cmd, flag);
|
||||
}
|
||||
default:
|
||||
return MathGridInset::getStatus(cur, cmd, flag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MathAMSArrayInset::write(WriteStream & os) const
|
||||
{
|
||||
os << "\\begin{" << name_ << '}';
|
||||
@ -98,6 +128,14 @@ void MathAMSArrayInset::write(WriteStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void MathAMSArrayInset::infoize(std::ostream & os) const
|
||||
{
|
||||
string name = name_;
|
||||
name[0] = lyx::support::uppercase(name[0]);
|
||||
os << name << ' ';
|
||||
}
|
||||
|
||||
|
||||
void MathAMSArrayInset::normalize(NormalStream & os) const
|
||||
{
|
||||
os << '[' << name_ << ' ';
|
||||
|
@ -31,9 +31,14 @@ public:
|
||||
///
|
||||
MathAMSArrayInset const * asAMSArrayInset() const { return this; }
|
||||
|
||||
///
|
||||
bool getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
///
|
||||
void infoize(std::ostream & os) const;
|
||||
///
|
||||
void normalize(NormalStream &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include "math_mathmlstream.h"
|
||||
#include "math_streamstr.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
|
||||
@ -113,7 +115,9 @@ void MathArrayInset::write(WriteStream & os) const
|
||||
|
||||
void MathArrayInset::infoize(std::ostream & os) const
|
||||
{
|
||||
os << "Array";
|
||||
string name = name_;
|
||||
name[0] = lyx::support::uppercase(name[0]);
|
||||
os << name << ' ';
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using lyx::support::bformat;
|
||||
|
||||
@ -32,7 +31,6 @@ using std::endl;
|
||||
using std::max;
|
||||
using std::min;
|
||||
using std::swap;
|
||||
using std::istringstream;
|
||||
using std::string;
|
||||
|
||||
using std::auto_ptr;
|
||||
@ -71,9 +69,7 @@ void MathCasesInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
recordUndo(cur);
|
||||
istringstream is(cmd.argument);
|
||||
string s;
|
||||
is >> s;
|
||||
string const s = cmd.argument;
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
cur.undispatched();
|
||||
break;
|
||||
@ -90,9 +86,7 @@ bool MathCasesInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
istringstream is(cmd.argument);
|
||||
string s;
|
||||
is >> s;
|
||||
string const s = cmd.argument;
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.enabled(false);
|
||||
flag.message(bformat(
|
||||
|
@ -1237,9 +1237,7 @@ bool MathGridInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
istringstream is(cmd.argument);
|
||||
string s;
|
||||
is >> s;
|
||||
string const s = cmd.argument;
|
||||
if (nrows() <= 1 && (s == "delete-row" || s == "swap-row")) {
|
||||
flag.enabled(false);
|
||||
flag.message(N_("Only one row"));
|
||||
|
@ -15,7 +15,15 @@
|
||||
#include "math_mathmlstream.h"
|
||||
#include "math_streamstr.h"
|
||||
|
||||
#include "funcrequest.h"
|
||||
#include "FuncStatus.h"
|
||||
#include "gettext.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/std_ostream.h"
|
||||
|
||||
|
||||
using lyx::support::bformat;
|
||||
using std::string;
|
||||
using std::auto_ptr;
|
||||
|
||||
@ -47,6 +55,27 @@ char MathSplitInset::defaultColAlign(col_type col)
|
||||
}
|
||||
|
||||
|
||||
bool MathSplitInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
string const s = cmd.argument;
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.message(bformat(
|
||||
N_("Can't add vertical grid lines in '%1$s'"),
|
||||
name_));
|
||||
flag.enabled(false);
|
||||
return true;
|
||||
}
|
||||
return MathGridInset::getStatus(cur, cmd, flag);
|
||||
}
|
||||
default:
|
||||
return MathGridInset::getStatus(cur, cmd, flag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MathSplitInset::write(WriteStream & ws) const
|
||||
{
|
||||
if (ws.fragile())
|
||||
@ -57,3 +86,11 @@ void MathSplitInset::write(WriteStream & ws) const
|
||||
ws << "\\protect";
|
||||
ws << "\\end{" << name_ << "}\n";
|
||||
}
|
||||
|
||||
|
||||
void MathSplitInset::infoize(std::ostream & os) const
|
||||
{
|
||||
string name = name_;
|
||||
name[0] = lyx::support::uppercase(name[0]);
|
||||
os << name << ' ';
|
||||
}
|
||||
|
@ -19,9 +19,15 @@ class MathSplitInset : public MathGridInset {
|
||||
public:
|
||||
///
|
||||
explicit MathSplitInset(std::string const & name);
|
||||
|
||||
///
|
||||
bool getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const;
|
||||
|
||||
void write(WriteStream & os) const;
|
||||
///
|
||||
void infoize(std::ostream & os) const;
|
||||
///
|
||||
int defaultColSpace(col_type) { return 0; }
|
||||
///
|
||||
char defaultColAlign(col_type);
|
||||
|
@ -16,6 +16,15 @@
|
||||
#include "math_mathmlstream.h"
|
||||
#include "support/std_ostream.h"
|
||||
|
||||
#include "funcrequest.h"
|
||||
#include "FuncStatus.h"
|
||||
#include "gettext.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
|
||||
using lyx::support::bformat;
|
||||
using std::string;
|
||||
using std::auto_ptr;
|
||||
|
||||
|
||||
@ -48,6 +57,27 @@ void MathSubstackInset::draw(PainterInfo & pi, int x, int y) const
|
||||
}
|
||||
|
||||
|
||||
bool MathSubstackInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
string const name("substack");
|
||||
string const s = cmd.argument;
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.message(bformat(
|
||||
N_("Can't add vertical grid lines in '%1$s'"), name));
|
||||
flag.enabled(false);
|
||||
return true;
|
||||
}
|
||||
return MathGridInset::getStatus(cur, cmd, flag);
|
||||
}
|
||||
default:
|
||||
return MathGridInset::getStatus(cur, cmd, flag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MathSubstackInset::infoize(std::ostream & os) const
|
||||
{
|
||||
os << "Substack ";
|
||||
|
@ -29,7 +29,8 @@ public:
|
||||
MathSubstackInset const * asSubstackInset() const { return this; }
|
||||
|
||||
///
|
||||
void normalize();
|
||||
bool getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const;
|
||||
///
|
||||
void infoize(std::ostream & os) const;
|
||||
///
|
||||
|
@ -15,6 +15,9 @@
|
||||
#include "math_mathmlstream.h"
|
||||
#include "math_streamstr.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/std_ostream.h"
|
||||
|
||||
#include <iterator>
|
||||
|
||||
|
||||
@ -79,6 +82,14 @@ void MathTabularInset::write(WriteStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void MathTabularInset::infoize(std::ostream & os) const
|
||||
{
|
||||
string name = name_;
|
||||
name[0] = lyx::support::uppercase(name[0]);
|
||||
os << name << ' ';
|
||||
}
|
||||
|
||||
|
||||
void MathTabularInset::normalize(NormalStream & os) const
|
||||
{
|
||||
os << '[' << name_ << ' ';
|
||||
|
@ -37,6 +37,8 @@ public:
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
///
|
||||
void infoize(std::ostream & os) const;
|
||||
///
|
||||
void normalize(NormalStream &) const;
|
||||
///
|
||||
void maple(MapleStream &) const;
|
||||
|
Loading…
Reference in New Issue
Block a user