mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
func_status cleanup from Martin; fix small configure bug
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3320 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dca91cf463
commit
d719688df3
@ -1,3 +1,8 @@
|
|||||||
|
2002-01-08 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||||
|
|
||||||
|
* configure.in: remove test for -lpt on SCO. Hopefully it is not
|
||||||
|
needed anymore. This fixes bug #137
|
||||||
|
|
||||||
2001-11-29 Ben Stanley <bds02@uow.edu.au>
|
2001-11-29 Ben Stanley <bds02@uow.edu.au>
|
||||||
|
|
||||||
* src/LaTeX.C
|
* src/LaTeX.C
|
||||||
|
@ -161,8 +161,8 @@ LYX_WITH_SIGC
|
|||||||
CHECK_WITH_PSPELL
|
CHECK_WITH_PSPELL
|
||||||
|
|
||||||
### Check for X libraries
|
### Check for X libraries
|
||||||
# Check for the pt library (for SCO, needed for X)
|
dnl # Check for the pt library (for SCO, needed for X)
|
||||||
AC_CHECK_LIB(pt,ptsname,X_EXTRA_LIBS="-lpt $X_EXTRA_LIBS")
|
dnl AC_CHECK_LIB(pt,ptsname,X_EXTRA_LIBS="-lpt $X_EXTRA_LIBS")
|
||||||
# The real thing.
|
# The real thing.
|
||||||
AC_PATH_XTRA
|
AC_PATH_XTRA
|
||||||
LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
|
LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
|
||||||
|
@ -9,7 +9,6 @@ src/converter.C
|
|||||||
src/CutAndPaste.C
|
src/CutAndPaste.C
|
||||||
src/debug.C
|
src/debug.C
|
||||||
src/exporter.C
|
src/exporter.C
|
||||||
src/ext_l10n.h
|
|
||||||
src/figure_form.C
|
src/figure_form.C
|
||||||
src/figureForm.C
|
src/figureForm.C
|
||||||
src/FontLoader.C
|
src/FontLoader.C
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2002-01-08 Martin Vermeer <martin.vermeer@hut.fi>
|
||||||
|
|
||||||
|
* FuncStatus.[Ch]: new files. This is a rewrite as a proper class
|
||||||
|
of the func_satus stuff. Edited and massaged in various ways by
|
||||||
|
JMarc.
|
||||||
|
|
||||||
|
* lyxfunc.C (getStatus): use FuncStatus
|
||||||
|
|
||||||
2002-01-08 Juergen Vigna <jug@sad.it>
|
2002-01-08 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
* text.C (nextBreakPoint): use function Inset::isChar().
|
* text.C (nextBreakPoint): use function Inset::isChar().
|
||||||
|
78
src/FuncStatus.C
Normal file
78
src/FuncStatus.C
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/* This file is part of
|
||||||
|
* ======================================================
|
||||||
|
*
|
||||||
|
* LyX, The Document Processor
|
||||||
|
*
|
||||||
|
* Copyright 2001 The LyX Team.
|
||||||
|
*
|
||||||
|
* ====================================================== */
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "FuncStatus.h"
|
||||||
|
|
||||||
|
FuncStatus::FuncStatus() : v_(OK)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FuncStatus::FuncStatus & FuncStatus::clear ()
|
||||||
|
{
|
||||||
|
v_ = OK;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FuncStatus::operator |= (FuncStatus const & f)
|
||||||
|
{
|
||||||
|
v_ |= f.v_;
|
||||||
|
}
|
||||||
|
|
||||||
|
FuncStatus::FuncStatus & FuncStatus::unknown (bool b)
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
v_ |= UNKNOWN;
|
||||||
|
else
|
||||||
|
v_ &= !UNKNOWN;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FuncStatus::unknown () const
|
||||||
|
{
|
||||||
|
return (v_ & UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FuncStatus::FuncStatus & FuncStatus::disabled (bool b)
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
v_ |= DISABLED;
|
||||||
|
else
|
||||||
|
v_ &= !DISABLED;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FuncStatus::disabled () const
|
||||||
|
{
|
||||||
|
return (v_ & DISABLED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FuncStatus::setOnOff (bool b)
|
||||||
|
{
|
||||||
|
v_ |= (b ? ON : OFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FuncStatus::onoff (bool b) const
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
return (v_ & ON);
|
||||||
|
else
|
||||||
|
return (v_ & OFF);
|
||||||
|
}
|
49
src/FuncStatus.h
Normal file
49
src/FuncStatus.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
#ifndef FUNC_STATUS_H
|
||||||
|
#define FUNC_STATUS_H
|
||||||
|
|
||||||
|
/// The status of a function.
|
||||||
|
|
||||||
|
class FuncStatus
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
enum StatusCodes {
|
||||||
|
///
|
||||||
|
OK = 0,
|
||||||
|
///
|
||||||
|
UNKNOWN = 1,
|
||||||
|
///
|
||||||
|
DISABLED = 2, // Command cannot be executed
|
||||||
|
///
|
||||||
|
ON = 4,
|
||||||
|
///
|
||||||
|
OFF = 8
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned int v_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
FuncStatus();
|
||||||
|
//
|
||||||
|
FuncStatus & clear ();
|
||||||
|
///
|
||||||
|
void operator |= (FuncStatus const & f);
|
||||||
|
///
|
||||||
|
FuncStatus & unknown(bool b);
|
||||||
|
///
|
||||||
|
bool unknown() const;
|
||||||
|
|
||||||
|
///
|
||||||
|
FuncStatus & disabled (bool b);
|
||||||
|
///
|
||||||
|
bool disabled () const;
|
||||||
|
|
||||||
|
///
|
||||||
|
void setOnOff (bool b);
|
||||||
|
///
|
||||||
|
bool onoff (bool b) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -50,6 +50,8 @@ lyx_SOURCES = \
|
|||||||
FontInfo.h \
|
FontInfo.h \
|
||||||
FontLoader.C \
|
FontLoader.C \
|
||||||
FontLoader.h \
|
FontLoader.h \
|
||||||
|
FuncStatus.C \
|
||||||
|
FuncStatus.h \
|
||||||
LColor.C \
|
LColor.C \
|
||||||
LColor.h \
|
LColor.h \
|
||||||
LString.h \
|
LString.h \
|
||||||
@ -119,7 +121,6 @@ lyx_SOURCES = \
|
|||||||
figureForm.h \
|
figureForm.h \
|
||||||
font.C \
|
font.C \
|
||||||
font.h \
|
font.h \
|
||||||
func_status.h \
|
|
||||||
gettext.C \
|
gettext.C \
|
||||||
gettext.h \
|
gettext.h \
|
||||||
importer.C \
|
importer.C \
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2002-01-08 Martin Vermeer <martin.vermeer@hut.fi>
|
||||||
|
|
||||||
|
* Menubar_pimpl.C (composeUIInfo):
|
||||||
|
(update): use FuncStatus
|
||||||
|
|
||||||
2002-01-03 Michael Koziarski <michael@koziarski.com>
|
2002-01-03 Michael Koziarski <michael@koziarski.com>
|
||||||
|
|
||||||
* Dialogs.h: fix compilation.
|
* Dialogs.h: fix compilation.
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "LyXAction.h"
|
#include "LyXAction.h"
|
||||||
#include "lyxfunc.h"
|
#include "lyxfunc.h"
|
||||||
#include "func_status.h"
|
#include "FuncStatus.h"
|
||||||
#include "kbmap.h"
|
#include "kbmap.h"
|
||||||
#include "bufferlist.h"
|
#include "bufferlist.h"
|
||||||
#include "lastfiles.h"
|
#include "lastfiles.h"
|
||||||
@ -233,7 +233,7 @@ void Menubar::Pimpl::composeUIInfo(string const & menu_name, vector<Gnome::UI::I
|
|||||||
if (label.find(item.shortcut()) != string::npos)
|
if (label.find(item.shortcut()) != string::npos)
|
||||||
label.insert(label.find(item.shortcut()), "_");
|
label.insert(label.find(item.shortcut()), "_");
|
||||||
|
|
||||||
func_status::value_type flag = owner_->getLyXFunc()->getStatus(item.action());
|
FuncStatus flag = owner_->getLyXFunc()->getStatus(item.action());
|
||||||
|
|
||||||
Gnome::UI::Info gitem;
|
Gnome::UI::Info gitem;
|
||||||
SigC::Slot0<void> cback = SigC::bind<int>(SigC::slot(this, &Menubar::Pimpl::callback),item.action());
|
SigC::Slot0<void> cback = SigC::bind<int>(SigC::slot(this, &Menubar::Pimpl::callback),item.action());
|
||||||
@ -308,13 +308,13 @@ void Menubar::Pimpl::composeUIInfo(string const & menu_name, vector<Gnome::UI::I
|
|||||||
}
|
}
|
||||||
|
|
||||||
// first handle optional entries.
|
// first handle optional entries.
|
||||||
if (item.optional() && (flag & func_status::Disabled)) {
|
if (item.optional() && (flag.disabled())) {
|
||||||
lyxerr[Debug::GUI]
|
lyxerr[Debug::GUI]
|
||||||
<< "Skipping optional item " << item.label() << endl;
|
<< "Skipping optional item " << item.label() << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((flag & func_status::ToggleOn) ||
|
if ((flag.onoff(true)) ||
|
||||||
(flag & func_status::ToggleOff))
|
(flag.onoff(false)))
|
||||||
gitem = Gnome::UI::ToggleItem(label, cback, lyxaction.helpText(item.action()));
|
gitem = Gnome::UI::ToggleItem(label, cback, lyxaction.helpText(item.action()));
|
||||||
|
|
||||||
Menus.push_back(gitem);
|
Menus.push_back(gitem);
|
||||||
@ -386,19 +386,19 @@ void Menubar::Pimpl::update()
|
|||||||
for (vector<GtkWidgetToAction>::const_iterator i = wid_act_.begin(); i != end; ++i)
|
for (vector<GtkWidgetToAction>::const_iterator i = wid_act_.begin(); i != end; ++i)
|
||||||
{
|
{
|
||||||
GtkWidgetToAction wa = (*i);
|
GtkWidgetToAction wa = (*i);
|
||||||
func_status::value_type flag = owner_->getLyXFunc()->getStatus(wa.action_);
|
FuncStatus flag = owner_->getLyXFunc()->getStatus(wa.action_);
|
||||||
|
|
||||||
if ( flag & (func_status::Disabled | func_status::Unknown) ) gtk_widget_set_sensitive(wa.widget_, false);
|
if ( flag.disabled() || flag.unknown()) gtk_widget_set_sensitive(wa.widget_, false);
|
||||||
else gtk_widget_set_sensitive(wa.widget_, true);
|
else gtk_widget_set_sensitive(wa.widget_, true);
|
||||||
|
|
||||||
if ( flag & func_status::ToggleOn )
|
if ( flag.onoff(true))
|
||||||
{
|
{
|
||||||
ignore_action_=true;
|
ignore_action_=true;
|
||||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(wa.widget_), true);
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(wa.widget_), true);
|
||||||
ignore_action_=false;
|
ignore_action_=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( flag & func_status::ToggleOff )
|
if ( flag.onoff(false))
|
||||||
{
|
{
|
||||||
ignore_action_=true;
|
ignore_action_=true;
|
||||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(wa.widget_), false);
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(wa.widget_), false);
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2002-01-08 Martin Vermeer <martin.vermeer@hut.fi>
|
||||||
|
|
||||||
|
* Menubar_pimpl.C (create_submenu):
|
||||||
|
* Toolbar_pimpl.C (update): use FuncStatus.
|
||||||
|
|
||||||
2002-01-08 Angus Leeming <a.leeming@ic.ac.uk>
|
2002-01-08 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
* xform_helpers.[Ch] (getStringFromBrowser): a littel wrapper function
|
* xform_helpers.[Ch] (getStringFromBrowser): a littel wrapper function
|
||||||
|
@ -426,8 +426,7 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
|
|||||||
if (i->kind() == MenuItem::Separator)
|
if (i->kind() == MenuItem::Separator)
|
||||||
*last = "%l";
|
*last = "%l";
|
||||||
else if (!i->optional() ||
|
else if (!i->optional() ||
|
||||||
!(view->getLyXFunc()->getStatus(i->action())
|
!(view->getLyXFunc()->getStatus(i->action()).disabled()))
|
||||||
& func_status::Disabled))
|
|
||||||
last = it;
|
last = it;
|
||||||
|
|
||||||
it = extra_labels.begin();
|
it = extra_labels.begin();
|
||||||
@ -437,12 +436,12 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
|
|||||||
|
|
||||||
switch (item.kind()) {
|
switch (item.kind()) {
|
||||||
case MenuItem::Command: {
|
case MenuItem::Command: {
|
||||||
func_status::value_type flag =
|
FuncStatus flag =
|
||||||
view->getLyXFunc()->getStatus(item.action());
|
view->getLyXFunc()->getStatus(item.action());
|
||||||
|
|
||||||
// handle optional entries.
|
// handle optional entries.
|
||||||
if (item.optional()
|
if (item.optional()
|
||||||
&& (flag & func_status::Disabled)) {
|
&& (flag.disabled())) {
|
||||||
lyxerr[Debug::GUI]
|
lyxerr[Debug::GUI]
|
||||||
<< "Skipping optional item "
|
<< "Skipping optional item "
|
||||||
<< item.label() << endl;
|
<< item.label() << endl;
|
||||||
@ -468,12 +467,11 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
|
|||||||
|
|
||||||
// Modify the entry using the function status
|
// Modify the entry using the function status
|
||||||
string pupmode;
|
string pupmode;
|
||||||
if (flag & (func_status::Disabled
|
if (flag.disabled() || flag.unknown())
|
||||||
| func_status::Unknown))
|
|
||||||
pupmode += "%i";
|
pupmode += "%i";
|
||||||
if (flag & func_status::ToggleOn)
|
if (flag.onoff(true))
|
||||||
pupmode += "%B";
|
pupmode += "%B";
|
||||||
if (flag & func_status::ToggleOff)
|
if (flag.onoff(false))
|
||||||
pupmode += "%b";
|
pupmode += "%b";
|
||||||
label += pupmode;
|
label += pupmode;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "XFormsView.h"
|
#include "XFormsView.h"
|
||||||
#include "lyxfunc.h"
|
#include "lyxfunc.h"
|
||||||
#include "func_status.h"
|
#include "FuncStatus.h"
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "lyxtextclasslist.h"
|
#include "lyxtextclasslist.h"
|
||||||
@ -190,8 +190,8 @@ void Toolbar::Pimpl::update()
|
|||||||
ToolbarList::const_iterator end = toollist.end();
|
ToolbarList::const_iterator end = toollist.end();
|
||||||
for (; p != end; ++p) {
|
for (; p != end; ++p) {
|
||||||
if (p->icon) {
|
if (p->icon) {
|
||||||
int status = owner->getLyXFunc()->getStatus(p->action);
|
FuncStatus status = owner->getLyXFunc()->getStatus(p->action);
|
||||||
if (status & func_status::ToggleOn) {
|
if (status.onoff(true)) {
|
||||||
// I'd like to use a different color
|
// I'd like to use a different color
|
||||||
// here, but then the problem is to
|
// here, but then the problem is to
|
||||||
// know how to use transparency with
|
// know how to use transparency with
|
||||||
@ -203,8 +203,7 @@ void Toolbar::Pimpl::update()
|
|||||||
fl_set_object_color(p->icon, FL_MCOL, FL_BLUE);
|
fl_set_object_color(p->icon, FL_MCOL, FL_BLUE);
|
||||||
fl_set_object_boxtype(p->icon, FL_UP_BOX);
|
fl_set_object_boxtype(p->icon, FL_UP_BOX);
|
||||||
}
|
}
|
||||||
|
if (status.disabled()) {
|
||||||
if (status & func_status::Disabled) {
|
|
||||||
// Is there a way here to specify a
|
// Is there a way here to specify a
|
||||||
// mask in order to show that the
|
// mask in order to show that the
|
||||||
// button is disabled? (JMarc)
|
// button is disabled? (JMarc)
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
#ifndef FUNC_STATUS_H
|
|
||||||
#define FUNC_STATUS_H
|
|
||||||
|
|
||||||
/// The status of a function.
|
|
||||||
namespace func_status {
|
|
||||||
|
|
||||||
enum value_type {
|
|
||||||
/// No problem
|
|
||||||
OK = 0,
|
|
||||||
///
|
|
||||||
Unknown = 1,
|
|
||||||
/// Command cannot be executed
|
|
||||||
Disabled = 2,
|
|
||||||
///
|
|
||||||
ToggleOn = 4,
|
|
||||||
///
|
|
||||||
ToggleOff = 8
|
|
||||||
};
|
|
||||||
|
|
||||||
inline
|
|
||||||
void toggle(value_type & flag, bool b)
|
|
||||||
{
|
|
||||||
flag = static_cast<value_type>(flag | (b ? ToggleOn : ToggleOff));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
|
||||||
inline
|
|
||||||
void operator|=(func_status::value_type & fs, func_status::value_type f)
|
|
||||||
{
|
|
||||||
fs = static_cast<func_status::value_type>(fs | f);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,3 +1,7 @@
|
|||||||
|
2002-01-08 Martin Vermeer <martin.vermeer@hut.fi>
|
||||||
|
|
||||||
|
* insettabular.C (getStatus): use FuncStatus
|
||||||
|
|
||||||
2002-01-08 Juergen Vigna <jug@sad.it>
|
2002-01-08 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
* insettabular.C (insetButtonRelease): now this should work too
|
* insettabular.C (insetButtonRelease): now this should work too
|
||||||
|
@ -2205,16 +2205,13 @@ void InsetTabular::openLayoutDialog(BufferView * bv) const
|
|||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// functions returns:
|
// function returns an object as defined in func_status.h:
|
||||||
// 0 ... disabled
|
// states OK, Unknown, Disabled, On, Off.
|
||||||
// 1 ... enabled
|
|
||||||
// 2 ... toggled on
|
|
||||||
// 3 ... toggled off
|
|
||||||
//
|
//
|
||||||
func_status::value_type InsetTabular::getStatus(string const & what) const
|
FuncStatus InsetTabular::getStatus(string const & what) const
|
||||||
{
|
{
|
||||||
int action = LyXTabular::LAST_ACTION;
|
int action = LyXTabular::LAST_ACTION;
|
||||||
func_status::value_type status = func_status::OK;
|
FuncStatus status;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; tabularFeature[i].action != LyXTabular::LAST_ACTION; ++i) {
|
for (; tabularFeature[i].action != LyXTabular::LAST_ACTION; ++i) {
|
||||||
@ -2227,7 +2224,8 @@ func_status::value_type InsetTabular::getStatus(string const & what) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (action == LyXTabular::LAST_ACTION)
|
if (action == LyXTabular::LAST_ACTION)
|
||||||
return func_status::Unknown;
|
status.clear();
|
||||||
|
return status.unknown(true);
|
||||||
|
|
||||||
string const argument = frontStrip(what.substr(tabularFeature[i].feature.length()));
|
string const argument = frontStrip(what.substr(tabularFeature[i].feature.length()));
|
||||||
|
|
||||||
@ -2248,8 +2246,7 @@ func_status::value_type InsetTabular::getStatus(string const & what) const
|
|||||||
case LyXTabular::SET_MPWIDTH:
|
case LyXTabular::SET_MPWIDTH:
|
||||||
case LyXTabular::SET_SPECIAL_COLUMN:
|
case LyXTabular::SET_SPECIAL_COLUMN:
|
||||||
case LyXTabular::SET_SPECIAL_MULTI:
|
case LyXTabular::SET_SPECIAL_MULTI:
|
||||||
status |= func_status::Disabled;
|
return status.disabled(true);
|
||||||
return status;
|
|
||||||
|
|
||||||
case LyXTabular::APPEND_ROW:
|
case LyXTabular::APPEND_ROW:
|
||||||
case LyXTabular::APPEND_COLUMN:
|
case LyXTabular::APPEND_COLUMN:
|
||||||
@ -2257,169 +2254,100 @@ func_status::value_type InsetTabular::getStatus(string const & what) const
|
|||||||
case LyXTabular::DELETE_COLUMN:
|
case LyXTabular::DELETE_COLUMN:
|
||||||
case LyXTabular::SET_ALL_LINES:
|
case LyXTabular::SET_ALL_LINES:
|
||||||
case LyXTabular::UNSET_ALL_LINES:
|
case LyXTabular::UNSET_ALL_LINES:
|
||||||
status |= func_status::OK;
|
return status.clear();
|
||||||
return status;
|
|
||||||
|
|
||||||
case LyXTabular::MULTICOLUMN:
|
case LyXTabular::MULTICOLUMN:
|
||||||
if (tabular->IsMultiColumn(actcell))
|
status.setOnOff(tabular->IsMultiColumn(actcell));
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::M_TOGGLE_LINE_TOP:
|
case LyXTabular::M_TOGGLE_LINE_TOP:
|
||||||
flag = false;
|
flag = false;
|
||||||
case LyXTabular::TOGGLE_LINE_TOP:
|
case LyXTabular::TOGGLE_LINE_TOP:
|
||||||
if (tabular->TopLine(actcell, flag))
|
status.setOnOff(tabular->TopLine(actcell, flag));
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::M_TOGGLE_LINE_BOTTOM:
|
case LyXTabular::M_TOGGLE_LINE_BOTTOM:
|
||||||
flag = false;
|
flag = false;
|
||||||
case LyXTabular::TOGGLE_LINE_BOTTOM:
|
case LyXTabular::TOGGLE_LINE_BOTTOM:
|
||||||
if (tabular->BottomLine(actcell, flag))
|
status.setOnOff(tabular->BottomLine(actcell, flag));
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::M_TOGGLE_LINE_LEFT:
|
case LyXTabular::M_TOGGLE_LINE_LEFT:
|
||||||
flag = false;
|
flag = false;
|
||||||
case LyXTabular::TOGGLE_LINE_LEFT:
|
case LyXTabular::TOGGLE_LINE_LEFT:
|
||||||
if (tabular->LeftLine(actcell, flag))
|
status.setOnOff(tabular->LeftLine(actcell, flag));
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::M_TOGGLE_LINE_RIGHT:
|
case LyXTabular::M_TOGGLE_LINE_RIGHT:
|
||||||
flag = false;
|
flag = false;
|
||||||
case LyXTabular::TOGGLE_LINE_RIGHT:
|
case LyXTabular::TOGGLE_LINE_RIGHT:
|
||||||
if (tabular->RightLine(actcell, flag))
|
status.setOnOff(tabular->RightLine(actcell, flag));
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::M_ALIGN_LEFT:
|
case LyXTabular::M_ALIGN_LEFT:
|
||||||
flag = false;
|
flag = false;
|
||||||
case LyXTabular::ALIGN_LEFT:
|
case LyXTabular::ALIGN_LEFT:
|
||||||
if (tabular->GetAlignment(actcell, flag) == LYX_ALIGN_LEFT)
|
status.setOnOff(tabular->GetAlignment(actcell, flag) == LYX_ALIGN_LEFT);
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::M_ALIGN_RIGHT:
|
case LyXTabular::M_ALIGN_RIGHT:
|
||||||
flag = false;
|
flag = false;
|
||||||
case LyXTabular::ALIGN_RIGHT:
|
case LyXTabular::ALIGN_RIGHT:
|
||||||
if (tabular->GetAlignment(actcell, flag) == LYX_ALIGN_RIGHT)
|
status.setOnOff(tabular->GetAlignment(actcell, flag) == LYX_ALIGN_RIGHT);
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::M_ALIGN_CENTER:
|
case LyXTabular::M_ALIGN_CENTER:
|
||||||
flag = false;
|
flag = false;
|
||||||
case LyXTabular::ALIGN_CENTER:
|
case LyXTabular::ALIGN_CENTER:
|
||||||
if (tabular->GetAlignment(actcell, flag) == LYX_ALIGN_CENTER)
|
status.setOnOff(tabular->GetAlignment(actcell, flag) == LYX_ALIGN_CENTER);
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::M_VALIGN_TOP:
|
case LyXTabular::M_VALIGN_TOP:
|
||||||
flag = false;
|
flag = false;
|
||||||
case LyXTabular::VALIGN_TOP:
|
case LyXTabular::VALIGN_TOP:
|
||||||
if (tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_TOP)
|
status.setOnOff(tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_TOP);
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::M_VALIGN_BOTTOM:
|
case LyXTabular::M_VALIGN_BOTTOM:
|
||||||
flag = false;
|
flag = false;
|
||||||
case LyXTabular::VALIGN_BOTTOM:
|
case LyXTabular::VALIGN_BOTTOM:
|
||||||
if (tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_BOTTOM)
|
status.setOnOff(tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_BOTTOM);
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::M_VALIGN_CENTER:
|
case LyXTabular::M_VALIGN_CENTER:
|
||||||
flag = false;
|
flag = false;
|
||||||
case LyXTabular::VALIGN_CENTER:
|
case LyXTabular::VALIGN_CENTER:
|
||||||
if (tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_CENTER)
|
status.setOnOff(tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_CENTER);
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::SET_LONGTABULAR:
|
case LyXTabular::SET_LONGTABULAR:
|
||||||
if (tabular->IsLongTabular())
|
status.setOnOff(tabular->IsLongTabular());
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::UNSET_LONGTABULAR:
|
case LyXTabular::UNSET_LONGTABULAR:
|
||||||
if (!tabular->IsLongTabular())
|
status.setOnOff(!tabular->IsLongTabular());
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::SET_ROTATE_TABULAR:
|
case LyXTabular::SET_ROTATE_TABULAR:
|
||||||
if (tabular->GetRotateTabular())
|
status.setOnOff(tabular->GetRotateTabular());
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::UNSET_ROTATE_TABULAR:
|
case LyXTabular::UNSET_ROTATE_TABULAR:
|
||||||
if (!tabular->GetRotateTabular())
|
status.setOnOff(!tabular->GetRotateTabular());
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::SET_ROTATE_CELL:
|
case LyXTabular::SET_ROTATE_CELL:
|
||||||
if (tabular->GetRotateCell(actcell))
|
status.setOnOff(tabular->GetRotateCell(actcell));
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::UNSET_ROTATE_CELL:
|
case LyXTabular::UNSET_ROTATE_CELL:
|
||||||
if (!tabular->GetRotateCell(actcell))
|
status.setOnOff(!tabular->GetRotateCell(actcell));
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::SET_USEBOX:
|
case LyXTabular::SET_USEBOX:
|
||||||
if (strToInt(argument) == tabular->GetUsebox(actcell))
|
status.setOnOff(strToInt(argument) == tabular->GetUsebox(actcell));
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::SET_LTFIRSTHEAD:
|
case LyXTabular::SET_LTFIRSTHEAD:
|
||||||
if (tabular->GetRowOfLTHead(sel_row_start, dummyltt))
|
status.setOnOff(tabular->GetRowOfLTHead(sel_row_start, dummyltt));
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::SET_LTHEAD:
|
case LyXTabular::SET_LTHEAD:
|
||||||
if (tabular->GetRowOfLTHead(sel_row_start, dummyltt))
|
status.setOnOff(tabular->GetRowOfLTHead(sel_row_start, dummyltt));
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::SET_LTFOOT:
|
case LyXTabular::SET_LTFOOT:
|
||||||
if (tabular->GetRowOfLTFoot(sel_row_start, dummyltt))
|
status.setOnOff(tabular->GetRowOfLTFoot(sel_row_start, dummyltt));
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::SET_LTLASTFOOT:
|
case LyXTabular::SET_LTLASTFOOT:
|
||||||
if (tabular->GetRowOfLTFoot(sel_row_start, dummyltt))
|
status.setOnOff(tabular->GetRowOfLTFoot(sel_row_start, dummyltt));
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
case LyXTabular::SET_LTNEWPAGE:
|
case LyXTabular::SET_LTNEWPAGE:
|
||||||
if (tabular->GetLTNewPage(sel_row_start))
|
status.setOnOff(tabular->GetLTNewPage(sel_row_start));
|
||||||
status |= func_status::ToggleOn;
|
|
||||||
else
|
|
||||||
status |= func_status::ToggleOff;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
status = func_status::Disabled;
|
status.clear();
|
||||||
|
status.disabled(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
#include "tabular.h"
|
#include "tabular.h"
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
#include "lyxcursor.h"
|
#include "lyxcursor.h"
|
||||||
#include "func_status.h"
|
#include "FuncStatus.h"
|
||||||
|
|
||||||
class LyXLex;
|
class LyXLex;
|
||||||
class Painter;
|
class Painter;
|
||||||
@ -183,7 +183,7 @@ public:
|
|||||||
///
|
///
|
||||||
bool showInsetDialog(BufferView *) const;
|
bool showInsetDialog(BufferView *) const;
|
||||||
///
|
///
|
||||||
func_status::value_type getStatus(string const & argument) const;
|
FuncStatus getStatus(string const & argument) const;
|
||||||
///
|
///
|
||||||
std::vector<string> const getLabelList() const;
|
std::vector<string> const getLabelList() const;
|
||||||
///
|
///
|
||||||
|
@ -343,16 +343,16 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func_status::value_type LyXFunc::getStatus(int ac) const
|
FuncStatus LyXFunc::getStatus(int ac) const
|
||||||
{
|
{
|
||||||
return getStatus(ac, string());
|
return getStatus(ac, string());
|
||||||
}
|
}
|
||||||
|
|
||||||
func_status::value_type LyXFunc::getStatus(int ac,
|
FuncStatus LyXFunc::getStatus(int ac,
|
||||||
string const & not_to_use_arg) const
|
string const & not_to_use_arg) const
|
||||||
{
|
{
|
||||||
kb_action action;
|
kb_action action;
|
||||||
func_status::value_type flag = func_status::OK;
|
FuncStatus flag;
|
||||||
string argument;
|
string argument;
|
||||||
Buffer * buf = owner->buffer();
|
Buffer * buf = owner->buffer();
|
||||||
|
|
||||||
@ -361,12 +361,12 @@ func_status::value_type LyXFunc::getStatus(int ac,
|
|||||||
else {
|
else {
|
||||||
action = static_cast<kb_action>(ac);
|
action = static_cast<kb_action>(ac);
|
||||||
if (!not_to_use_arg.empty())
|
if (!not_to_use_arg.empty())
|
||||||
argument = not_to_use_arg; // exept here
|
argument = not_to_use_arg; // except here
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == LFUN_UNKNOWN_ACTION) {
|
if (action == LFUN_UNKNOWN_ACTION) {
|
||||||
setErrorMessage(N_("Unknown action"));
|
setErrorMessage(N_("Unknown action"));
|
||||||
return func_status::Unknown;
|
return flag.unknown(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether we need a buffer
|
// Check whether we need a buffer
|
||||||
@ -380,14 +380,13 @@ func_status::value_type LyXFunc::getStatus(int ac,
|
|||||||
LyXAction::ReadOnly)) {
|
LyXAction::ReadOnly)) {
|
||||||
// no
|
// no
|
||||||
setErrorMessage(N_("Document is read-only"));
|
setErrorMessage(N_("Document is read-only"));
|
||||||
flag |= func_status::Disabled;
|
flag.disabled(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// no
|
// no
|
||||||
setErrorMessage(N_("Command not allowed with"
|
setErrorMessage(N_("Command not allowed with"
|
||||||
"out any document open"));
|
"out any document open"));
|
||||||
flag |= func_status::Disabled;
|
return flag.disabled(true);
|
||||||
return flag;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,7 +434,8 @@ func_status::value_type LyXFunc::getStatus(int ac,
|
|||||||
case LFUN_TABULAR_FEATURE:
|
case LFUN_TABULAR_FEATURE:
|
||||||
disable = true;
|
disable = true;
|
||||||
if (owner->view()->theLockingInset()) {
|
if (owner->view()->theLockingInset()) {
|
||||||
func_status::value_type ret = func_status::Disabled;
|
FuncStatus ret;
|
||||||
|
ret.disabled(true);
|
||||||
if (owner->view()->theLockingInset()->lyxCode() == Inset::TABULAR_CODE) {
|
if (owner->view()->theLockingInset()->lyxCode() == Inset::TABULAR_CODE) {
|
||||||
ret = static_cast<InsetTabular *>
|
ret = static_cast<InsetTabular *>
|
||||||
(owner->view()->theLockingInset())->
|
(owner->view()->theLockingInset())->
|
||||||
@ -450,13 +450,11 @@ func_status::value_type LyXFunc::getStatus(int ac,
|
|||||||
disable = false;
|
disable = false;
|
||||||
} else {
|
} else {
|
||||||
static InsetTabular inset(*owner->buffer(), 1, 1);
|
static InsetTabular inset(*owner->buffer(), 1, 1);
|
||||||
func_status::value_type ret;
|
FuncStatus ret;
|
||||||
|
|
||||||
disable = true;
|
disable = true;
|
||||||
ret = inset.getStatus(argument);
|
ret = inset.getStatus(argument);
|
||||||
if ((ret & func_status::ToggleOn) ||
|
if (ret.onoff(true) || ret.onoff(false)) flag.setOnOff(false);
|
||||||
(ret & func_status::ToggleOff))
|
|
||||||
flag |= func_status::ToggleOff;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -498,14 +496,14 @@ func_status::value_type LyXFunc::getStatus(int ac,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (argument.empty()) {
|
if (argument.empty()) {
|
||||||
flag = func_status::OK;
|
flag.clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!contains("tcb", argument[0])) {
|
if (!contains("tcb", argument[0])) {
|
||||||
disable = true;
|
disable = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
func_status::toggle(flag, argument[0] == align);
|
flag.setOnOff(argument[0] == align);
|
||||||
} else
|
} else
|
||||||
disable = true;
|
disable = true;
|
||||||
break;
|
break;
|
||||||
@ -521,14 +519,14 @@ func_status::value_type LyXFunc::getStatus(int ac,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (argument.empty()) {
|
if (argument.empty()) {
|
||||||
flag = func_status::OK;
|
flag.clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!contains("lcr", argument[0])) {
|
if (!contains("lcr", argument[0])) {
|
||||||
disable = true;
|
disable = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
func_status::toggle(flag, argument[0] == align);
|
flag.setOnOff(argument[0] == align);
|
||||||
} else
|
} else
|
||||||
disable = true;
|
disable = true;
|
||||||
break;
|
break;
|
||||||
@ -538,13 +536,13 @@ func_status::value_type LyXFunc::getStatus(int ac,
|
|||||||
if (tli && (tli->lyxCode() == Inset::MATH_CODE)) {
|
if (tli && (tli->lyxCode() == Inset::MATH_CODE)) {
|
||||||
MathInsetTypes type = mathcursor->formula()->getType();
|
MathInsetTypes type = mathcursor->formula()->getType();
|
||||||
if (argument == "inline") {
|
if (argument == "inline") {
|
||||||
func_status::toggle(flag, type == LM_OT_SIMPLE);
|
flag.setOnOff(type == LM_OT_SIMPLE);
|
||||||
} else if (argument == "display") {
|
} else if (argument == "display") {
|
||||||
func_status::toggle(flag, type == LM_OT_EQUATION);
|
flag.setOnOff(type == LM_OT_EQUATION);
|
||||||
} else if (argument == "eqnarray") {
|
} else if (argument == "eqnarray") {
|
||||||
func_status::toggle(flag, type == LM_OT_EQNARRAY);
|
flag.setOnOff(type == LM_OT_EQNARRAY);
|
||||||
} else if (argument == "align") {
|
} else if (argument == "align") {
|
||||||
func_status::toggle(flag, type == LM_OT_ALIGN);
|
flag.setOnOff(type == LM_OT_ALIGN);
|
||||||
} else {
|
} else {
|
||||||
disable = true;
|
disable = true;
|
||||||
}
|
}
|
||||||
@ -683,15 +681,15 @@ func_status::value_type LyXFunc::getStatus(int ac,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (disable)
|
if (disable)
|
||||||
flag |= func_status::Disabled;
|
flag.disabled(true);
|
||||||
|
|
||||||
// A few general toggles
|
// A few general toggles
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case LFUN_READ_ONLY_TOGGLE:
|
case LFUN_READ_ONLY_TOGGLE:
|
||||||
func_status::toggle(flag, buf->isReadonly());
|
flag.setOnOff(buf->isReadonly());
|
||||||
break;
|
break;
|
||||||
case LFUN_APPENDIX:
|
case LFUN_APPENDIX:
|
||||||
func_status::toggle(flag, TEXT(false)->cursor.par()->params().startOfAppendix());
|
flag.setOnOff(TEXT(false)->cursor.par()->params().startOfAppendix());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -702,22 +700,22 @@ func_status::value_type LyXFunc::getStatus(int ac,
|
|||||||
LyXFont const & font = TEXT(false)->real_current_font;
|
LyXFont const & font = TEXT(false)->real_current_font;
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case LFUN_EMPH:
|
case LFUN_EMPH:
|
||||||
func_status::toggle(flag, font.emph() == LyXFont::ON);
|
flag.setOnOff(font.emph() == LyXFont::ON);
|
||||||
break;
|
break;
|
||||||
case LFUN_NOUN:
|
case LFUN_NOUN:
|
||||||
func_status::toggle(flag, font.noun() == LyXFont::ON);
|
flag.setOnOff(font.noun() == LyXFont::ON);
|
||||||
break;
|
break;
|
||||||
case LFUN_BOLD:
|
case LFUN_BOLD:
|
||||||
func_status::toggle(flag, font.series() == LyXFont::BOLD_SERIES);
|
flag.setOnOff(font.series() == LyXFont::BOLD_SERIES);
|
||||||
break;
|
break;
|
||||||
case LFUN_SANS:
|
case LFUN_SANS:
|
||||||
func_status::toggle(flag, font.family() == LyXFont::SANS_FAMILY);
|
flag.setOnOff(font.family() == LyXFont::SANS_FAMILY);
|
||||||
break;
|
break;
|
||||||
case LFUN_ROMAN:
|
case LFUN_ROMAN:
|
||||||
func_status::toggle(flag, font.family() == LyXFont::ROMAN_FAMILY);
|
flag.setOnOff(font.family() == LyXFont::ROMAN_FAMILY);
|
||||||
break;
|
break;
|
||||||
case LFUN_CODE:
|
case LFUN_CODE:
|
||||||
func_status::toggle(flag, font.family() == LyXFont::TYPEWRITER_FAMILY);
|
flag.setOnOff(font.family() == LyXFont::TYPEWRITER_FAMILY);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -727,25 +725,25 @@ func_status::value_type LyXFunc::getStatus(int ac,
|
|||||||
MathTextCodes tc = mathcursor->getLastCode();
|
MathTextCodes tc = mathcursor->getLastCode();
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case LFUN_BOLD:
|
case LFUN_BOLD:
|
||||||
func_status::toggle(flag, tc == LM_TC_BF);
|
flag.setOnOff(tc == LM_TC_BF);
|
||||||
break;
|
break;
|
||||||
case LFUN_SANS:
|
case LFUN_SANS:
|
||||||
func_status::toggle(flag, tc == LM_TC_SF);
|
flag.setOnOff(tc == LM_TC_SF);
|
||||||
break;
|
break;
|
||||||
case LFUN_EMPH:
|
case LFUN_EMPH:
|
||||||
func_status::toggle(flag, tc == LM_TC_CAL);
|
flag.setOnOff(tc == LM_TC_CAL);
|
||||||
break;
|
break;
|
||||||
case LFUN_ROMAN:
|
case LFUN_ROMAN:
|
||||||
func_status::toggle(flag, tc == LM_TC_RM);
|
flag.setOnOff(tc == LM_TC_RM);
|
||||||
break;
|
break;
|
||||||
case LFUN_CODE:
|
case LFUN_CODE:
|
||||||
func_status::toggle(flag, tc == LM_TC_TT);
|
flag.setOnOff(tc == LM_TC_TT);
|
||||||
break;
|
break;
|
||||||
case LFUN_NOUN:
|
case LFUN_NOUN:
|
||||||
func_status::toggle(flag, tc == LM_TC_BB);
|
flag.setOnOff(tc == LM_TC_BB);
|
||||||
break;
|
break;
|
||||||
case LFUN_DEFAULT:
|
case LFUN_DEFAULT:
|
||||||
func_status::toggle(flag, tc == LM_TC_VAR);
|
flag.setOnOff(tc == LM_TC_VAR);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -827,7 +825,7 @@ string const LyXFunc::dispatch(int ac,
|
|||||||
owner->view()->hideCursor();
|
owner->view()->hideCursor();
|
||||||
|
|
||||||
// We cannot use this function here
|
// We cannot use this function here
|
||||||
if (getStatus(ac, do_not_use_this_arg) & func_status::Disabled) {
|
if (getStatus(ac, do_not_use_this_arg).disabled()) {
|
||||||
lyxerr[Debug::ACTION] << "LyXFunc::Dispatch: "
|
lyxerr[Debug::ACTION] << "LyXFunc::Dispatch: "
|
||||||
<< lyxaction.getActionName(ac)
|
<< lyxaction.getActionName(ac)
|
||||||
<< " [" << ac << "] is disabled at this location"
|
<< " [" << ac << "] is disabled at this location"
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <sigc++/signal_system.h>
|
#include <sigc++/signal_system.h>
|
||||||
|
|
||||||
#include "commandtags.h" // for kb_action enum
|
#include "commandtags.h" // for kb_action enum
|
||||||
#include "func_status.h"
|
#include "FuncStatus.h"
|
||||||
#include "kbsequence.h"
|
#include "kbsequence.h"
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
|
|
||||||
@ -47,9 +47,9 @@ public:
|
|||||||
|
|
||||||
/// we need one internall which is called from inside LyXAction and
|
/// we need one internall which is called from inside LyXAction and
|
||||||
/// can contain the string argument.
|
/// can contain the string argument.
|
||||||
func_status::value_type getStatus(int ac) const;
|
FuncStatus getStatus(int ac) const;
|
||||||
///
|
///
|
||||||
func_status::value_type getStatus(int ac,
|
FuncStatus getStatus(int ac,
|
||||||
string const & not_to_use_arg) const;
|
string const & not_to_use_arg) const;
|
||||||
|
|
||||||
/// The last key was meta
|
/// The last key was meta
|
||||||
|
Loading…
Reference in New Issue
Block a user