mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
This should be the last of the commits refactoring the InsetLayout code.
This one just moves the Decoration enum into InsetLayout, changing the names to avoid possible conflicts now that it is in the lyx namespace. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23135 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
561466d45d
commit
2c357c1d23
@ -92,7 +92,7 @@ void InsetBranch::setButtonLabel()
|
||||
s = _("Undef: ") + s;
|
||||
}
|
||||
}
|
||||
if (decoration() == Classic)
|
||||
if (decoration() == Deco_Classic)
|
||||
setLabel(isOpen() ? s : getNewLabel(s) );
|
||||
else
|
||||
setLabel(params_.branch + ": " + getNewLabel(s));
|
||||
|
@ -52,7 +52,7 @@ InsetCollapsable::CollapseStatus InsetCollapsable::status() const
|
||||
InsetCollapsable::Geometry InsetCollapsable::geometry() const
|
||||
{
|
||||
switch (decoration()) {
|
||||
case Classic:
|
||||
case Deco_Classic:
|
||||
if (status() == Open) {
|
||||
if (openinlined_)
|
||||
return LeftButton;
|
||||
@ -61,11 +61,14 @@ InsetCollapsable::Geometry InsetCollapsable::geometry() const
|
||||
} else
|
||||
return ButtonOnly;
|
||||
|
||||
case Minimalistic:
|
||||
case Deco_Minimalistic:
|
||||
return status() == Open ? NoButton : ButtonOnly ;
|
||||
|
||||
case Conglomerate:
|
||||
case Deco_Conglomerate:
|
||||
return status() == Open ? SubLabel : Corners ;
|
||||
|
||||
case Deco_Default:
|
||||
break; // this shouldn't happen
|
||||
}
|
||||
|
||||
// dummy return value to shut down a warning,
|
||||
@ -533,7 +536,7 @@ void InsetCollapsable::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
if (cmd.button() == mouse_button::button3) {
|
||||
// There is no button to right click:
|
||||
if (decoration() == Minimalistic ||
|
||||
if (decoration() == Deco_Minimalistic ||
|
||||
geometry() == Corners ||
|
||||
geometry() == SubLabel ||
|
||||
geometry() == NoButton
|
||||
@ -798,18 +801,23 @@ docstring InsetCollapsable::floatName(string const & type, BufferParams const &
|
||||
}
|
||||
|
||||
|
||||
InsetCollapsable::Decoration InsetCollapsable::decoration() const
|
||||
InsetDecoration InsetCollapsable::decoration() const
|
||||
{
|
||||
if (!layout_ || layout_->decoration() == "classic")
|
||||
return Classic;
|
||||
if (layout_->decoration() == "minimalistic")
|
||||
return Minimalistic;
|
||||
if (layout_->decoration() == "conglomerate")
|
||||
return Conglomerate;
|
||||
if (!layout_)
|
||||
return Deco_Classic;
|
||||
InsetDecoration const dec = layout_->decoration();
|
||||
switch (dec) {
|
||||
case Deco_Classic:
|
||||
case Deco_Minimalistic:
|
||||
case Deco_Conglomerate:
|
||||
return dec;
|
||||
case Deco_Default:
|
||||
break;
|
||||
}
|
||||
if (lyxCode() == FLEX_CODE)
|
||||
// FIXME: Is this really necessary?
|
||||
return Conglomerate;
|
||||
return Classic;
|
||||
return Deco_Conglomerate;
|
||||
return Deco_Classic;
|
||||
}
|
||||
|
||||
|
||||
|
@ -117,14 +117,8 @@ public:
|
||||
* x) toggled by autoOpen_
|
||||
*/
|
||||
|
||||
///
|
||||
enum Decoration {
|
||||
Classic,
|
||||
Minimalistic,
|
||||
Conglomerate
|
||||
};
|
||||
/// Default looks
|
||||
virtual Decoration decoration() const;
|
||||
virtual InsetDecoration decoration() const;
|
||||
///
|
||||
enum Geometry {
|
||||
TopButton,
|
||||
|
@ -189,7 +189,7 @@ bool InsetERT::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
void InsetERT::setButtonLabel()
|
||||
{
|
||||
if (decoration() == Classic)
|
||||
if (decoration() == Deco_Classic)
|
||||
setLabel(isOpen() ? _("ERT") : getNewLabel(_("ERT")));
|
||||
else
|
||||
setLabel(getNewLabel(_("ERT")));
|
||||
|
@ -59,6 +59,20 @@ enum InsetLayoutTags {
|
||||
};
|
||||
|
||||
|
||||
namespace {
|
||||
InsetDecoration translateDecoration(std::string const & str)
|
||||
{
|
||||
if (str == "classic")
|
||||
return Deco_Classic;
|
||||
if (str == "minimalistic")
|
||||
return Deco_Minimalistic;
|
||||
if (str == "conglomerate")
|
||||
return Deco_Conglomerate;
|
||||
return Deco_Default;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool InsetLayout::read(Lexer & lexrc)
|
||||
{
|
||||
name_ = support::subst(lexrc.getDocString(), '_', ' ');
|
||||
@ -114,7 +128,7 @@ bool InsetLayout::read(Lexer & lexrc)
|
||||
break;
|
||||
case IL_DECORATION:
|
||||
lexrc.next();
|
||||
decoration_ = lexrc.getString();
|
||||
decoration_ = translateDecoration(lexrc.getString());
|
||||
break;
|
||||
case IL_LATEXNAME:
|
||||
lexrc.next();
|
||||
|
@ -24,7 +24,15 @@
|
||||
namespace lyx {
|
||||
|
||||
class Lexer;
|
||||
|
||||
|
||||
///
|
||||
enum InsetDecoration {
|
||||
Deco_Classic,
|
||||
Deco_Minimalistic,
|
||||
Deco_Conglomerate,
|
||||
Deco_Default
|
||||
};
|
||||
|
||||
///
|
||||
class InsetLayout {
|
||||
public:
|
||||
@ -39,8 +47,7 @@ public:
|
||||
///
|
||||
docstring labelstring() const { return labelstring_; };
|
||||
///
|
||||
//FIXME This could be an enum
|
||||
std::string decoration() const { return decoration_; };
|
||||
InsetDecoration decoration() const { return decoration_; };
|
||||
///
|
||||
std::string latextype() const { return latextype_; };
|
||||
///
|
||||
@ -77,7 +84,7 @@ private:
|
||||
///
|
||||
docstring labelstring_;
|
||||
///
|
||||
std::string decoration_;
|
||||
InsetDecoration decoration_;
|
||||
///
|
||||
std::string latextype_;
|
||||
///
|
||||
|
@ -251,7 +251,7 @@ bool InsetListings::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
void InsetListings::setButtonLabel()
|
||||
{
|
||||
// FIXME UNICODE
|
||||
if (decoration() == Classic)
|
||||
if (decoration() == Deco_Classic)
|
||||
setLabel(isOpen() ? _("Listing") : getNewLabel(_("Listing")));
|
||||
else
|
||||
setLabel(getNewLabel(_("Listing")));
|
||||
|
Loading…
Reference in New Issue
Block a user