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:
Jean-Marc Lasgouttes 2002-01-09 09:36:35 +00:00
parent dca91cf463
commit d719688df3
18 changed files with 253 additions and 211 deletions

View File

@ -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>
* src/LaTeX.C

View File

@ -161,8 +161,8 @@ LYX_WITH_SIGC
CHECK_WITH_PSPELL
### Check for X libraries
# Check for the pt library (for SCO, needed for X)
AC_CHECK_LIB(pt,ptsname,X_EXTRA_LIBS="-lpt $X_EXTRA_LIBS")
dnl # Check for the pt library (for SCO, needed for X)
dnl AC_CHECK_LIB(pt,ptsname,X_EXTRA_LIBS="-lpt $X_EXTRA_LIBS")
# The real thing.
AC_PATH_XTRA
LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"

View File

@ -9,7 +9,6 @@ src/converter.C
src/CutAndPaste.C
src/debug.C
src/exporter.C
src/ext_l10n.h
src/figure_form.C
src/figureForm.C
src/FontLoader.C

View File

@ -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>
* text.C (nextBreakPoint): use function Inset::isChar().

78
src/FuncStatus.C Normal file
View 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
View 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

View File

@ -50,6 +50,8 @@ lyx_SOURCES = \
FontInfo.h \
FontLoader.C \
FontLoader.h \
FuncStatus.C \
FuncStatus.h \
LColor.C \
LColor.h \
LString.h \
@ -119,7 +121,6 @@ lyx_SOURCES = \
figureForm.h \
font.C \
font.h \
func_status.h \
gettext.C \
gettext.h \
importer.C \

View File

@ -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>
* Dialogs.h: fix compilation.

View File

@ -22,7 +22,7 @@
#include "debug.h"
#include "LyXAction.h"
#include "lyxfunc.h"
#include "func_status.h"
#include "FuncStatus.h"
#include "kbmap.h"
#include "bufferlist.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)
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;
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.
if (item.optional() && (flag & func_status::Disabled)) {
if (item.optional() && (flag.disabled())) {
lyxerr[Debug::GUI]
<< "Skipping optional item " << item.label() << endl;
break;
}
if ((flag & func_status::ToggleOn) ||
(flag & func_status::ToggleOff))
if ((flag.onoff(true)) ||
(flag.onoff(false)))
gitem = Gnome::UI::ToggleItem(label, cback, lyxaction.helpText(item.action()));
Menus.push_back(gitem);
@ -386,19 +386,19 @@ void Menubar::Pimpl::update()
for (vector<GtkWidgetToAction>::const_iterator i = wid_act_.begin(); i != end; ++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);
if ( flag & func_status::ToggleOn )
if ( flag.onoff(true))
{
ignore_action_=true;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(wa.widget_), true);
ignore_action_=false;
}
if ( flag & func_status::ToggleOff )
if ( flag.onoff(false))
{
ignore_action_=true;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(wa.widget_), false);

View File

@ -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>
* xform_helpers.[Ch] (getStringFromBrowser): a littel wrapper function

View File

@ -426,8 +426,7 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
if (i->kind() == MenuItem::Separator)
*last = "%l";
else if (!i->optional() ||
!(view->getLyXFunc()->getStatus(i->action())
& func_status::Disabled))
!(view->getLyXFunc()->getStatus(i->action()).disabled()))
last = it;
it = extra_labels.begin();
@ -437,12 +436,12 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
switch (item.kind()) {
case MenuItem::Command: {
func_status::value_type flag =
FuncStatus flag =
view->getLyXFunc()->getStatus(item.action());
// handle optional entries.
if (item.optional()
&& (flag & func_status::Disabled)) {
&& (flag.disabled())) {
lyxerr[Debug::GUI]
<< "Skipping optional item "
<< item.label() << endl;
@ -468,12 +467,11 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
// Modify the entry using the function status
string pupmode;
if (flag & (func_status::Disabled
| func_status::Unknown))
if (flag.disabled() || flag.unknown())
pupmode += "%i";
if (flag & func_status::ToggleOn)
if (flag.onoff(true))
pupmode += "%B";
if (flag & func_status::ToggleOff)
if (flag.onoff(false))
pupmode += "%b";
label += pupmode;

View File

@ -23,7 +23,7 @@
#include "debug.h"
#include "XFormsView.h"
#include "lyxfunc.h"
#include "func_status.h"
#include "FuncStatus.h"
#include "BufferView.h"
#include "buffer.h"
#include "lyxtextclasslist.h"
@ -190,8 +190,8 @@ void Toolbar::Pimpl::update()
ToolbarList::const_iterator end = toollist.end();
for (; p != end; ++p) {
if (p->icon) {
int status = owner->getLyXFunc()->getStatus(p->action);
if (status & func_status::ToggleOn) {
FuncStatus status = owner->getLyXFunc()->getStatus(p->action);
if (status.onoff(true)) {
// I'd like to use a different color
// here, but then the problem is to
// 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_boxtype(p->icon, FL_UP_BOX);
}
if (status & func_status::Disabled) {
if (status.disabled()) {
// Is there a way here to specify a
// mask in order to show that the
// button is disabled? (JMarc)

View File

@ -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

View File

@ -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>
* insettabular.C (insetButtonRelease): now this should work too

View File

@ -2205,16 +2205,13 @@ void InsetTabular::openLayoutDialog(BufferView * bv) const
//
// functions returns:
// 0 ... disabled
// 1 ... enabled
// 2 ... toggled on
// 3 ... toggled off
// function returns an object as defined in func_status.h:
// states OK, Unknown, Disabled, On, Off.
//
func_status::value_type InsetTabular::getStatus(string const & what) const
FuncStatus InsetTabular::getStatus(string const & what) const
{
int action = LyXTabular::LAST_ACTION;
func_status::value_type status = func_status::OK;
FuncStatus status;
int i = 0;
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)
return func_status::Unknown;
status.clear();
return status.unknown(true);
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_SPECIAL_COLUMN:
case LyXTabular::SET_SPECIAL_MULTI:
status |= func_status::Disabled;
return status;
return status.disabled(true);
case LyXTabular::APPEND_ROW:
case LyXTabular::APPEND_COLUMN:
@ -2257,169 +2254,100 @@ func_status::value_type InsetTabular::getStatus(string const & what) const
case LyXTabular::DELETE_COLUMN:
case LyXTabular::SET_ALL_LINES:
case LyXTabular::UNSET_ALL_LINES:
status |= func_status::OK;
return status;
return status.clear();
case LyXTabular::MULTICOLUMN:
if (tabular->IsMultiColumn(actcell))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->IsMultiColumn(actcell));
break;
case LyXTabular::M_TOGGLE_LINE_TOP:
flag = false;
case LyXTabular::TOGGLE_LINE_TOP:
if (tabular->TopLine(actcell, flag))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->TopLine(actcell, flag));
break;
case LyXTabular::M_TOGGLE_LINE_BOTTOM:
flag = false;
case LyXTabular::TOGGLE_LINE_BOTTOM:
if (tabular->BottomLine(actcell, flag))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->BottomLine(actcell, flag));
break;
case LyXTabular::M_TOGGLE_LINE_LEFT:
flag = false;
case LyXTabular::TOGGLE_LINE_LEFT:
if (tabular->LeftLine(actcell, flag))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->LeftLine(actcell, flag));
break;
case LyXTabular::M_TOGGLE_LINE_RIGHT:
flag = false;
case LyXTabular::TOGGLE_LINE_RIGHT:
if (tabular->RightLine(actcell, flag))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->RightLine(actcell, flag));
break;
case LyXTabular::M_ALIGN_LEFT:
flag = false;
case LyXTabular::ALIGN_LEFT:
if (tabular->GetAlignment(actcell, flag) == LYX_ALIGN_LEFT)
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->GetAlignment(actcell, flag) == LYX_ALIGN_LEFT);
break;
case LyXTabular::M_ALIGN_RIGHT:
flag = false;
case LyXTabular::ALIGN_RIGHT:
if (tabular->GetAlignment(actcell, flag) == LYX_ALIGN_RIGHT)
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->GetAlignment(actcell, flag) == LYX_ALIGN_RIGHT);
break;
case LyXTabular::M_ALIGN_CENTER:
flag = false;
case LyXTabular::ALIGN_CENTER:
if (tabular->GetAlignment(actcell, flag) == LYX_ALIGN_CENTER)
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->GetAlignment(actcell, flag) == LYX_ALIGN_CENTER);
break;
case LyXTabular::M_VALIGN_TOP:
flag = false;
case LyXTabular::VALIGN_TOP:
if (tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_TOP)
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_TOP);
break;
case LyXTabular::M_VALIGN_BOTTOM:
flag = false;
case LyXTabular::VALIGN_BOTTOM:
if (tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_BOTTOM)
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_BOTTOM);
break;
case LyXTabular::M_VALIGN_CENTER:
flag = false;
case LyXTabular::VALIGN_CENTER:
if (tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_CENTER)
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_CENTER);
break;
case LyXTabular::SET_LONGTABULAR:
if (tabular->IsLongTabular())
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->IsLongTabular());
break;
case LyXTabular::UNSET_LONGTABULAR:
if (!tabular->IsLongTabular())
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(!tabular->IsLongTabular());
break;
case LyXTabular::SET_ROTATE_TABULAR:
if (tabular->GetRotateTabular())
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->GetRotateTabular());
break;
case LyXTabular::UNSET_ROTATE_TABULAR:
if (!tabular->GetRotateTabular())
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(!tabular->GetRotateTabular());
break;
case LyXTabular::SET_ROTATE_CELL:
if (tabular->GetRotateCell(actcell))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->GetRotateCell(actcell));
break;
case LyXTabular::UNSET_ROTATE_CELL:
if (!tabular->GetRotateCell(actcell))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(!tabular->GetRotateCell(actcell));
break;
case LyXTabular::SET_USEBOX:
if (strToInt(argument) == tabular->GetUsebox(actcell))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(strToInt(argument) == tabular->GetUsebox(actcell));
break;
case LyXTabular::SET_LTFIRSTHEAD:
if (tabular->GetRowOfLTHead(sel_row_start, dummyltt))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->GetRowOfLTHead(sel_row_start, dummyltt));
break;
case LyXTabular::SET_LTHEAD:
if (tabular->GetRowOfLTHead(sel_row_start, dummyltt))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->GetRowOfLTHead(sel_row_start, dummyltt));
break;
case LyXTabular::SET_LTFOOT:
if (tabular->GetRowOfLTFoot(sel_row_start, dummyltt))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->GetRowOfLTFoot(sel_row_start, dummyltt));
break;
case LyXTabular::SET_LTLASTFOOT:
if (tabular->GetRowOfLTFoot(sel_row_start, dummyltt))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->GetRowOfLTFoot(sel_row_start, dummyltt));
break;
case LyXTabular::SET_LTNEWPAGE:
if (tabular->GetLTNewPage(sel_row_start))
status |= func_status::ToggleOn;
else
status |= func_status::ToggleOff;
status.setOnOff(tabular->GetLTNewPage(sel_row_start));
break;
default:
status = func_status::Disabled;
status.clear();
status.disabled(true);
break;
}
return status;

View File

@ -56,7 +56,7 @@
#include "tabular.h"
#include "LString.h"
#include "lyxcursor.h"
#include "func_status.h"
#include "FuncStatus.h"
class LyXLex;
class Painter;
@ -183,7 +183,7 @@ public:
///
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;
///

View File

@ -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());
}
func_status::value_type LyXFunc::getStatus(int ac,
FuncStatus LyXFunc::getStatus(int ac,
string const & not_to_use_arg) const
{
kb_action action;
func_status::value_type flag = func_status::OK;
FuncStatus flag;
string argument;
Buffer * buf = owner->buffer();
@ -361,12 +361,12 @@ func_status::value_type LyXFunc::getStatus(int ac,
else {
action = static_cast<kb_action>(ac);
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) {
setErrorMessage(N_("Unknown action"));
return func_status::Unknown;
return flag.unknown(true);
}
// Check whether we need a buffer
@ -380,14 +380,13 @@ func_status::value_type LyXFunc::getStatus(int ac,
LyXAction::ReadOnly)) {
// no
setErrorMessage(N_("Document is read-only"));
flag |= func_status::Disabled;
flag.disabled(true);
}
} else {
// no
setErrorMessage(N_("Command not allowed with"
"out any document open"));
flag |= func_status::Disabled;
return flag;
return flag.disabled(true);
}
}
@ -435,7 +434,8 @@ func_status::value_type LyXFunc::getStatus(int ac,
case LFUN_TABULAR_FEATURE:
disable = true;
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) {
ret = static_cast<InsetTabular *>
(owner->view()->theLockingInset())->
@ -450,13 +450,11 @@ func_status::value_type LyXFunc::getStatus(int ac,
disable = false;
} else {
static InsetTabular inset(*owner->buffer(), 1, 1);
func_status::value_type ret;
FuncStatus ret;
disable = true;
ret = inset.getStatus(argument);
if ((ret & func_status::ToggleOn) ||
(ret & func_status::ToggleOff))
flag |= func_status::ToggleOff;
if (ret.onoff(true) || ret.onoff(false)) flag.setOnOff(false);
}
break;
@ -498,14 +496,14 @@ func_status::value_type LyXFunc::getStatus(int ac,
break;
}
if (argument.empty()) {
flag = func_status::OK;
flag.clear();
break;
}
if (!contains("tcb", argument[0])) {
disable = true;
break;
}
func_status::toggle(flag, argument[0] == align);
flag.setOnOff(argument[0] == align);
} else
disable = true;
break;
@ -521,14 +519,14 @@ func_status::value_type LyXFunc::getStatus(int ac,
break;
}
if (argument.empty()) {
flag = func_status::OK;
flag.clear();
break;
}
if (!contains("lcr", argument[0])) {
disable = true;
break;
}
func_status::toggle(flag, argument[0] == align);
flag.setOnOff(argument[0] == align);
} else
disable = true;
break;
@ -538,13 +536,13 @@ func_status::value_type LyXFunc::getStatus(int ac,
if (tli && (tli->lyxCode() == Inset::MATH_CODE)) {
MathInsetTypes type = mathcursor->formula()->getType();
if (argument == "inline") {
func_status::toggle(flag, type == LM_OT_SIMPLE);
flag.setOnOff(type == LM_OT_SIMPLE);
} else if (argument == "display") {
func_status::toggle(flag, type == LM_OT_EQUATION);
flag.setOnOff(type == LM_OT_EQUATION);
} else if (argument == "eqnarray") {
func_status::toggle(flag, type == LM_OT_EQNARRAY);
flag.setOnOff(type == LM_OT_EQNARRAY);
} else if (argument == "align") {
func_status::toggle(flag, type == LM_OT_ALIGN);
flag.setOnOff(type == LM_OT_ALIGN);
} else {
disable = true;
}
@ -683,15 +681,15 @@ func_status::value_type LyXFunc::getStatus(int ac,
}
if (disable)
flag |= func_status::Disabled;
flag.disabled(true);
// A few general toggles
switch (action) {
case LFUN_READ_ONLY_TOGGLE:
func_status::toggle(flag, buf->isReadonly());
flag.setOnOff(buf->isReadonly());
break;
case LFUN_APPENDIX:
func_status::toggle(flag, TEXT(false)->cursor.par()->params().startOfAppendix());
flag.setOnOff(TEXT(false)->cursor.par()->params().startOfAppendix());
break;
default:
break;
@ -702,22 +700,22 @@ func_status::value_type LyXFunc::getStatus(int ac,
LyXFont const & font = TEXT(false)->real_current_font;
switch (action) {
case LFUN_EMPH:
func_status::toggle(flag, font.emph() == LyXFont::ON);
flag.setOnOff(font.emph() == LyXFont::ON);
break;
case LFUN_NOUN:
func_status::toggle(flag, font.noun() == LyXFont::ON);
flag.setOnOff(font.noun() == LyXFont::ON);
break;
case LFUN_BOLD:
func_status::toggle(flag, font.series() == LyXFont::BOLD_SERIES);
flag.setOnOff(font.series() == LyXFont::BOLD_SERIES);
break;
case LFUN_SANS:
func_status::toggle(flag, font.family() == LyXFont::SANS_FAMILY);
flag.setOnOff(font.family() == LyXFont::SANS_FAMILY);
break;
case LFUN_ROMAN:
func_status::toggle(flag, font.family() == LyXFont::ROMAN_FAMILY);
flag.setOnOff(font.family() == LyXFont::ROMAN_FAMILY);
break;
case LFUN_CODE:
func_status::toggle(flag, font.family() == LyXFont::TYPEWRITER_FAMILY);
flag.setOnOff(font.family() == LyXFont::TYPEWRITER_FAMILY);
break;
default:
break;
@ -727,25 +725,25 @@ func_status::value_type LyXFunc::getStatus(int ac,
MathTextCodes tc = mathcursor->getLastCode();
switch (action) {
case LFUN_BOLD:
func_status::toggle(flag, tc == LM_TC_BF);
flag.setOnOff(tc == LM_TC_BF);
break;
case LFUN_SANS:
func_status::toggle(flag, tc == LM_TC_SF);
flag.setOnOff(tc == LM_TC_SF);
break;
case LFUN_EMPH:
func_status::toggle(flag, tc == LM_TC_CAL);
flag.setOnOff(tc == LM_TC_CAL);
break;
case LFUN_ROMAN:
func_status::toggle(flag, tc == LM_TC_RM);
flag.setOnOff(tc == LM_TC_RM);
break;
case LFUN_CODE:
func_status::toggle(flag, tc == LM_TC_TT);
flag.setOnOff(tc == LM_TC_TT);
break;
case LFUN_NOUN:
func_status::toggle(flag, tc == LM_TC_BB);
flag.setOnOff(tc == LM_TC_BB);
break;
case LFUN_DEFAULT:
func_status::toggle(flag, tc == LM_TC_VAR);
flag.setOnOff(tc == LM_TC_VAR);
break;
default:
break;
@ -827,7 +825,7 @@ string const LyXFunc::dispatch(int ac,
owner->view()->hideCursor();
// 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: "
<< lyxaction.getActionName(ac)
<< " [" << ac << "] is disabled at this location"

View File

@ -10,7 +10,7 @@
#include <sigc++/signal_system.h>
#include "commandtags.h" // for kb_action enum
#include "func_status.h"
#include "FuncStatus.h"
#include "kbsequence.h"
#include "LString.h"
@ -47,9 +47,9 @@ public:
/// we need one internall which is called from inside LyXAction and
/// 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;
/// The last key was meta