mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 12:32:26 +00:00
Move graphics code from class to namespace.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24958 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5c0c53ccf8
commit
cd1cc0b647
@ -1410,7 +1410,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
if (argument.empty() || !lyx_view_->buffer())
|
if (argument.empty() || !lyx_view_->buffer())
|
||||||
break;
|
break;
|
||||||
//view()->cursor().recordUndoFullDocument(); let inset-apply do that job
|
//view()->cursor().recordUndoFullDocument(); let inset-apply do that job
|
||||||
InsetGraphics::unifyGraphicsGroups(*lyx_view_->buffer(), argument);
|
graphics::unifyGraphicsGroups(*lyx_view_->buffer(), argument);
|
||||||
lyx_view_->buffer()->markDirty();
|
lyx_view_->buffer()->markDirty();
|
||||||
updateFlags = Update::Force | Update::FitCursor;
|
updateFlags = Update::Force | Update::FitCursor;
|
||||||
break;
|
break;
|
||||||
|
@ -893,14 +893,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_SET_GRAPHICS_GROUP: {
|
case LFUN_SET_GRAPHICS_GROUP: {
|
||||||
InsetGraphics * ins = InsetGraphics::getCurrentGraphicsInset(cur);
|
InsetGraphics * ins = graphics::getCurrentGraphicsInset(cur);
|
||||||
if (!ins)
|
if (!ins)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
cur.recordUndoFullDocument();
|
cur.recordUndoFullDocument();
|
||||||
|
|
||||||
string id = to_utf8(cmd.argument());
|
string id = to_utf8(cmd.argument());
|
||||||
string grp = InsetGraphics::getGroupParams(bv->buffer(), id);
|
string grp = graphics::getGroupParams(bv->buffer(), id);
|
||||||
InsetGraphicsParams tmp, inspar = ins->getParams();
|
InsetGraphicsParams tmp, inspar = ins->getParams();
|
||||||
|
|
||||||
if (id.empty())
|
if (id.empty())
|
||||||
@ -2183,7 +2183,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_SET_GRAPHICS_GROUP: {
|
case LFUN_SET_GRAPHICS_GROUP: {
|
||||||
InsetGraphics * ins = InsetGraphics::getCurrentGraphicsInset(cur);
|
InsetGraphics * ins = graphics::getCurrentGraphicsInset(cur);
|
||||||
if (!ins)
|
if (!ins)
|
||||||
enable = false;
|
enable = false;
|
||||||
else
|
else
|
||||||
|
@ -640,7 +640,7 @@ void MenuDefinition::expandGraphicsGroups(BufferView const * bv)
|
|||||||
if (!bv)
|
if (!bv)
|
||||||
return;
|
return;
|
||||||
set<string> grp;
|
set<string> grp;
|
||||||
InsetGraphics::getGraphicsGroups(bv->buffer(), grp);
|
graphics::getGraphicsGroups(bv->buffer(), grp);
|
||||||
if (grp.empty())
|
if (grp.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -949,8 +949,9 @@ string InsetGraphics::params2string(InsetGraphicsParams const & params,
|
|||||||
return data.str();
|
return data.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace graphics {
|
||||||
|
|
||||||
void InsetGraphics::getGraphicsGroups(Buffer const & b, std::set<string> & ids)
|
void getGraphicsGroups(Buffer const & b, std::set<string> & ids)
|
||||||
{
|
{
|
||||||
Inset & inset = b.inset();
|
Inset & inset = b.inset();
|
||||||
InsetIterator it = inset_iterator_begin(inset);
|
InsetIterator it = inset_iterator_begin(inset);
|
||||||
@ -965,7 +966,7 @@ void InsetGraphics::getGraphicsGroups(Buffer const & b, std::set<string> & ids)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string InsetGraphics::getGroupParams(Buffer const & b, std::string const & groupId)
|
string getGroupParams(Buffer const & b, std::string const & groupId)
|
||||||
{
|
{
|
||||||
if (groupId.empty())
|
if (groupId.empty())
|
||||||
return string();
|
return string();
|
||||||
@ -979,14 +980,14 @@ string InsetGraphics::getGroupParams(Buffer const & b, std::string const & group
|
|||||||
if (inspar.groupId == groupId) {
|
if (inspar.groupId == groupId) {
|
||||||
InsetGraphicsParams tmp = inspar;
|
InsetGraphicsParams tmp = inspar;
|
||||||
tmp.filename.erase();
|
tmp.filename.erase();
|
||||||
return params2string(tmp, b);
|
return InsetGraphics::params2string(tmp, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetGraphics::unifyGraphicsGroups(Buffer const & b, std::string const & argument)
|
void unifyGraphicsGroups(Buffer const & b, std::string const & argument)
|
||||||
{
|
{
|
||||||
InsetGraphicsParams params;
|
InsetGraphicsParams params;
|
||||||
InsetGraphics::string2params(argument, b, params);
|
InsetGraphics::string2params(argument, b, params);
|
||||||
@ -1008,7 +1009,7 @@ void InsetGraphics::unifyGraphicsGroups(Buffer const & b, std::string const & ar
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetGraphics * InsetGraphics::getCurrentGraphicsInset(Cursor const & cur)
|
InsetGraphics * getCurrentGraphicsInset(Cursor const & cur)
|
||||||
{
|
{
|
||||||
Inset * instmp = &cur.inset();
|
Inset * instmp = &cur.inset();
|
||||||
if (instmp->lyxCode() != GRAPHICS_CODE)
|
if (instmp->lyxCode() != GRAPHICS_CODE)
|
||||||
@ -1019,4 +1020,6 @@ InsetGraphics * InsetGraphics::getCurrentGraphicsInset(Cursor const & cur)
|
|||||||
return static_cast<InsetGraphics *>(instmp);
|
return static_cast<InsetGraphics *>(instmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace graphics
|
||||||
|
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
@ -48,16 +48,6 @@ public:
|
|||||||
///
|
///
|
||||||
static std::string params2string(InsetGraphicsParams const &,
|
static std::string params2string(InsetGraphicsParams const &,
|
||||||
Buffer const &);
|
Buffer const &);
|
||||||
/// Saves the list of currently used groups in the document.
|
|
||||||
static void getGraphicsGroups(Buffer const &, std::set<std::string> &);
|
|
||||||
/// Returns parameters of a given graphics group (except filename).
|
|
||||||
static std::string getGroupParams(Buffer const &,
|
|
||||||
std::string const &);
|
|
||||||
/** Synchronize all Graphics insets of the group.
|
|
||||||
Both groupId and params are taken from argument.
|
|
||||||
*/
|
|
||||||
static void unifyGraphicsGroups(Buffer const &, std::string const &);
|
|
||||||
static InsetGraphics * getCurrentGraphicsInset(Cursor const &);
|
|
||||||
|
|
||||||
/** Set the inset parameters, used by the GUIndependent dialog.
|
/** Set the inset parameters, used by the GUIndependent dialog.
|
||||||
Return true of new params are different from what was so far.
|
Return true of new params are different from what was so far.
|
||||||
@ -133,6 +123,22 @@ private:
|
|||||||
boost::scoped_ptr<RenderGraphic> const graphic_;
|
boost::scoped_ptr<RenderGraphic> const graphic_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace graphics {
|
||||||
|
|
||||||
|
/// Saves the list of currently used groups in the document.
|
||||||
|
void getGraphicsGroups(Buffer const &, std::set<std::string> &);
|
||||||
|
|
||||||
|
/// Returns parameters of a given graphics group (except filename).
|
||||||
|
std::string getGroupParams(Buffer const &, std::string const &);
|
||||||
|
|
||||||
|
/** Synchronize all Graphics insets of the group.
|
||||||
|
Both groupId and params are taken from argument.
|
||||||
|
*/
|
||||||
|
void unifyGraphicsGroups(Buffer const &, std::string const &);
|
||||||
|
InsetGraphics * getCurrentGraphicsInset(Cursor const &);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
|
||||||
#endif // INSET_GRAPHICS_H
|
#endif // INSET_GRAPHICS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user