mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Changed to always show if a feature is a toggle also if disabled.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@979 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e445df8e4f
commit
61a3cac30d
@ -1,5 +1,10 @@
|
||||
2000-08-18 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* src/insets/insettabular.C (getStatus): changed to return func_status.
|
||||
|
||||
* src/lyxfunc.C (getStatus): fixed TabularFeatures menu to always
|
||||
display toggle menu entries if they are.
|
||||
|
||||
* src/lyx_cb.C: #ifdef'ed out layout stuff which is in the
|
||||
new document layout now.
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "insets/insettext.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "debug.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
const int ADD_TO_HEIGHT = 2;
|
||||
const int ADD_TO_TABULAR_WIDTH = 2;
|
||||
@ -1585,11 +1586,12 @@ void InsetTabular::OpenLayoutDialog(BufferView * bv) const
|
||||
// 2 ... toggled on
|
||||
// 3 ... toggled off
|
||||
//
|
||||
int InsetTabular::getStatus(string what) const
|
||||
LyXFunc::func_status InsetTabular::getStatus(string what) const
|
||||
{
|
||||
int action = LyXTabular::LAST_ACTION;
|
||||
string argument;
|
||||
int i;
|
||||
LyXFunc::func_status status = LyXFunc::OK;
|
||||
|
||||
for(i=0; tabularFeatures[i].action != LyXTabular::LAST_ACTION; ++i) {
|
||||
if (!strncmp(tabularFeatures[i].feature.c_str(), what.c_str(),
|
||||
@ -1599,7 +1601,7 @@ int InsetTabular::getStatus(string what) const
|
||||
}
|
||||
}
|
||||
if (action == LyXTabular::LAST_ACTION)
|
||||
return 0;
|
||||
return LyXFunc::Unknown;
|
||||
|
||||
argument = frontStrip(what.substr(tabularFeatures[i].feature.length()));
|
||||
|
||||
@ -1625,7 +1627,8 @@ int InsetTabular::getStatus(string what) const
|
||||
case LyXTabular::SET_MPWIDTH:
|
||||
case LyXTabular::SET_SPECIAL_COLUMN:
|
||||
case LyXTabular::SET_SPECIAL_MULTI:
|
||||
return 0;
|
||||
status |= LyXFunc::Disabled;
|
||||
return status;
|
||||
|
||||
case LyXTabular::APPEND_ROW:
|
||||
case LyXTabular::APPEND_COLUMN:
|
||||
@ -1633,142 +1636,169 @@ int InsetTabular::getStatus(string what) const
|
||||
case LyXTabular::DELETE_COLUMN:
|
||||
case LyXTabular::SET_ALL_LINES:
|
||||
case LyXTabular::UNSET_ALL_LINES:
|
||||
return 1;
|
||||
return status;
|
||||
|
||||
case LyXTabular::MULTICOLUMN:
|
||||
if (tabular->IsMultiColumn(actcell))
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::M_TOGGLE_LINE_TOP:
|
||||
flag = false;
|
||||
case LyXTabular::TOGGLE_LINE_TOP:
|
||||
if (tabular->TopLine(actcell, flag))
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::M_TOGGLE_LINE_BOTTOM:
|
||||
flag = false;
|
||||
case LyXTabular::TOGGLE_LINE_BOTTOM:
|
||||
if (tabular->BottomLine(actcell, flag))
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::M_TOGGLE_LINE_LEFT:
|
||||
flag = false;
|
||||
case LyXTabular::TOGGLE_LINE_LEFT:
|
||||
if (tabular->LeftLine(actcell, flag))
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::M_TOGGLE_LINE_RIGHT:
|
||||
flag = false;
|
||||
case LyXTabular::TOGGLE_LINE_RIGHT:
|
||||
if (tabular->RightLine(actcell, flag))
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::M_ALIGN_LEFT:
|
||||
flag = false;
|
||||
case LyXTabular::ALIGN_LEFT:
|
||||
if (tabular->GetAlignment(actcell, flag) == LYX_ALIGN_LEFT)
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::M_ALIGN_RIGHT:
|
||||
flag = false;
|
||||
case LyXTabular::ALIGN_RIGHT:
|
||||
if (tabular->GetAlignment(actcell, flag) == LYX_ALIGN_RIGHT)
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::M_ALIGN_CENTER:
|
||||
flag = false;
|
||||
case LyXTabular::ALIGN_CENTER:
|
||||
if (tabular->GetAlignment(actcell, flag) == LYX_ALIGN_CENTER)
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::M_VALIGN_TOP:
|
||||
flag = false;
|
||||
case LyXTabular::VALIGN_TOP:
|
||||
if (tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_TOP)
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::M_VALIGN_BOTTOM:
|
||||
flag = false;
|
||||
case LyXTabular::VALIGN_BOTTOM:
|
||||
if (tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_BOTTOM)
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::M_VALIGN_CENTER:
|
||||
flag = false;
|
||||
case LyXTabular::VALIGN_CENTER:
|
||||
if (tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_CENTER)
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::SET_LONGTABULAR:
|
||||
if (tabular->IsLongTabular())
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::UNSET_LONGTABULAR:
|
||||
if (!tabular->IsLongTabular())
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::SET_ROTATE_TABULAR:
|
||||
if (tabular->GetRotateTabular())
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::UNSET_ROTATE_TABULAR:
|
||||
if (!tabular->GetRotateTabular())
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::SET_ROTATE_CELL:
|
||||
if (tabular->GetRotateCell(actcell))
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::UNSET_ROTATE_CELL:
|
||||
if (!tabular->GetRotateCell(actcell))
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::SET_USEBOX:
|
||||
if (strToInt(argument) == tabular->GetUsebox(actcell))
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::SET_LTFIRSTHEAD:
|
||||
if (tabular->GetRowOfLTHead(actcell, dummy))
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::SET_LTHEAD:
|
||||
if (tabular->GetRowOfLTHead(actcell, dummy))
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::SET_LTFOOT:
|
||||
if (tabular->GetRowOfLTFoot(actcell, dummy))
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::SET_LTLASTFOOT:
|
||||
if (tabular->GetRowOfLTFoot(actcell, dummy))
|
||||
return 2;
|
||||
return 3;
|
||||
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
case LyXTabular::SET_LTNEWPAGE:
|
||||
if (tabular->GetLTNewPage(actcell))
|
||||
return 2;
|
||||
return 3;
|
||||
status |= LyXFunc::ToggleOn;
|
||||
else
|
||||
status |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
default:
|
||||
status = LyXFunc::Disabled;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
return status;
|
||||
}
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "tabular.h"
|
||||
#include "LString.h"
|
||||
#include "lyxcursor.h"
|
||||
#include "lyxfunc.h"
|
||||
|
||||
class LyXLex;
|
||||
class Painter;
|
||||
@ -163,7 +164,7 @@ public:
|
||||
LyXText * getLyXText(BufferView *) const;
|
||||
void resizeLyXText(BufferView *) const;
|
||||
void OpenLayoutDialog(BufferView *) const;
|
||||
int getStatus(string argument) const;
|
||||
LyXFunc::func_status getStatus(string argument) const;
|
||||
|
||||
///
|
||||
/// Public structures and variables
|
||||
|
@ -569,7 +569,7 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
|
||||
case LFUN_TABULAR_FEATURE:
|
||||
disable = true;
|
||||
if (owner->view()->the_locking_inset) {
|
||||
int ret = 0;
|
||||
func_status ret = LyXFunc::Disabled;
|
||||
if (owner->view()->the_locking_inset->LyxCode() == Inset::TABULAR_CODE) {
|
||||
ret = static_cast<InsetTabular *>
|
||||
(owner->view()->the_locking_inset)->
|
||||
@ -580,21 +580,16 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
|
||||
GetFirstLockingInsetOfType(Inset::TABULAR_CODE))->
|
||||
getStatus(argument);
|
||||
}
|
||||
switch(ret) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
disable = false;
|
||||
break;
|
||||
case 2:
|
||||
disable = false;
|
||||
flag |= LyXFunc::ToggleOn;
|
||||
break;
|
||||
case 3:
|
||||
disable = false;
|
||||
flag |= LyXFunc::ToggleOff;
|
||||
break;
|
||||
}
|
||||
flag |= ret;
|
||||
} else {
|
||||
static InsetTabular inset(owner->buffer(), 1, 1);
|
||||
func_status ret;
|
||||
|
||||
disable = true;
|
||||
ret = inset.getStatus(argument);
|
||||
if ((ret & LyXFunc::ToggleOn) ||
|
||||
(ret & LyXFunc::ToggleOff))
|
||||
flag |= LyXFunc::ToggleOff;
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user