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