}
}
+ UpdatableInset * tli = owner->view()->theLockingInset();
+
// I would really like to avoid having this switch and rather try to
// encode this in the function itself.
bool disable = false;
break;
case LFUN_LAYOUT_TABULAR:
- disable = true;
- if (owner->view()->theLockingInset()) {
- disable = (owner->view()->theLockingInset()->lyxCode() != Inset::TABULAR_CODE) &&
- !owner->view()->theLockingInset()->getFirstLockingInsetOfType(Inset::TABULAR_CODE);
- }
+ disable = !tli
+ || (tli->lyxCode() != Inset::TABULAR_CODE
+ && !tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE));
+ break;
+
+ case LFUN_LAYOUT:
+ case LFUN_LAYOUT_PARAGRAPH: {
+ Inset * inset = TEXT(false)->cursor.par()->inInset();
+ disable = inset && inset->forceDefaultParagraphs(inset);
break;
+ }
case LFUN_TABULAR_FEATURE:
disable = true;
- if (owner->view()->theLockingInset()) {
+ if (tli) {
FuncStatus ret;
//ret.disabled(true);
- if (owner->view()->theLockingInset()->lyxCode() == Inset::TABULAR_CODE) {
- ret = static_cast<InsetTabular *>
- (owner->view()->theLockingInset())->
- getStatus(argument);
- } else if (owner->view()->theLockingInset()->getFirstLockingInsetOfType(Inset::TABULAR_CODE)) {
+ if (tli->lyxCode() == Inset::TABULAR_CODE) {
+ ret = static_cast<InsetTabular *>(tli)
+ ->getStatus(argument);
+ } else if (tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE)) {
ret = static_cast<InsetTabular *>
- (owner->view()->theLockingInset()->
- getFirstLockingInsetOfType(Inset::TABULAR_CODE))->
- getStatus(argument);
+ (tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE))
+ ->getStatus(argument);
}
flag |= ret;
disable = false;
disable = true;
ret = inset.getStatus(argument);
- if (ret.onoff(true) || ret.onoff(false)) flag.setOnOff(false);
+ if (ret.onoff(true) || ret.onoff(false))
+ flag.setOnOff(false);
}
break;
disable = (TEXT(false)->getInset() == 0);
break;
- case LFUN_MATH_VALIGN: {
- // I think this test can be simplified (Andre')
- // mathcursor is != 0 iff we are in math mode
- //Inset * tli = owner->view()->theLockingInset();
- //if (tli && (tli->lyxCode() == Inset::MATH_CODE
- // || tli->lyxCode() == Inset::MATHMACRO_CODE)) {
- //
+ case LFUN_MATH_VALIGN:
if (mathcursor) {
char align = mathcursor->valign();
if (align == '\0') {
} else
disable = true;
break;
- }
- case LFUN_MATH_HALIGN: {
- //Inset * tli = owner->view()->theLockingInset();
- //if (tli && (tli->lyxCode() == Inset::MATH_CODE
- // || tli->lyxCode() == Inset::MATHMACRO_CODE)) {
+
+ case LFUN_MATH_HALIGN:
if (mathcursor) {
char align = mathcursor->halign();
if (align == '\0') {
} else
disable = true;
break;
- }
- case LFUN_MATH_MUTATE: {
- Inset * tli = owner->view()->theLockingInset();
+
+ case LFUN_MATH_MUTATE:
if (tli && (tli->lyxCode() == Inset::MATH_CODE)) {
MathInsetTypes type = mathcursor->formula()->getType();
if (argument == "inline") {
} else
disable = true;
break;
- }
// we just need to be in math mode to enable that
case LFUN_MATH_SIZE:
default:
break;
}
- if (code != Inset::NO_CODE
- && owner->view()->theLockingInset()
- && !owner->view()->theLockingInset()->insetAllowed(code)) {
+ if (code != Inset::NO_CODE && tli && !tli->insetAllowed(code)) {
disable = true;
}
}
-void const LyXFunc::verboseDispatch(string const & s, bool show_sc)
+void LyXFunc::verboseDispatch(string const & s, bool show_sc)
{
- // Split command string into command and argument
- string cmd;
- string line = frontStrip(s);
- string const arg = strip(frontStrip(split(line, cmd, ' ')));
-
- int action = lyxaction.LookupFunc(cmd);
+ int action = lyxaction.LookupFunc(frontStrip(s));
if (action == LFUN_UNKNOWN_ACTION) {
string const msg = string(_("Unknown function ("))
- + cmd + ")";
+ + s + ")";
owner->message(msg);
} else {
verboseDispatch(action, show_sc);
}
-void const LyXFunc::verboseDispatch(int ac, bool show_sc)
+void LyXFunc::verboseDispatch(int ac, bool show_sc)
{
string argument;
kb_action action;
-void const LyXFunc::verboseDispatch(kb_action action,
- string const & argument, bool show_sc)
+void LyXFunc::verboseDispatch(kb_action action,
+ string const & argument, bool show_sc)
{
string res = dispatch(action, argument);
case LFUN_GOTO_PARAGRAPH:
{
- istringstream istr(argument.c_str());
+ istringstream istr(argument.c_str());
int id;
istr >> id;
<< " found." << endl;
}
+ if (owner->view()->theLockingInset())
+ owner->view()->unlockInset(owner->view()->theLockingInset());
+ if (par->inInset()) {
+ par->inInset()->edit(owner->view());
+ }
// Set the cursor
- owner->view()->text->setCursor(owner->view(), par, 0);
+ owner->view()->getLyXText()->setCursor(owner->view(), par, 0);
owner->view()->setState();
owner->showState();
{
string const filename =
MakeAbsPath(argument,
- OnlyPath(owner->buffer()->fileName()));
+ owner->buffer()->filePath());
setMessage(N_("Opening child document ") +
MakeDisplayPath(filename) + "...");
owner->view()->savePosition(0);
string initpath = lyxrc.document_path;
if (owner->view()->available()) {
- string const trypath = owner->buffer()->filepath;
+ string const trypath = owner->buffer()->filePath();
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath))
initpath = trypath;
string initpath = lyxrc.document_path;
if (owner->view()->available()) {
- string const trypath = owner->buffer()->filepath;
+ string const trypath = owner->buffer()->filePath();
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath))
initpath = trypath;
string initpath = lyxrc.document_path;
if (owner->view()->available()) {
- string const trypath = owner->buffer()->filepath;
+ string const trypath = owner->buffer()->filePath();
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath))
initpath = trypath;