mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +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())
|
||||
break;
|
||||
//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();
|
||||
updateFlags = Update::Force | Update::FitCursor;
|
||||
break;
|
||||
|
@ -893,14 +893,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
|
||||
case LFUN_SET_GRAPHICS_GROUP: {
|
||||
InsetGraphics * ins = InsetGraphics::getCurrentGraphicsInset(cur);
|
||||
InsetGraphics * ins = graphics::getCurrentGraphicsInset(cur);
|
||||
if (!ins)
|
||||
break;
|
||||
|
||||
cur.recordUndoFullDocument();
|
||||
|
||||
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();
|
||||
|
||||
if (id.empty())
|
||||
@ -2183,7 +2183,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
break;
|
||||
|
||||
case LFUN_SET_GRAPHICS_GROUP: {
|
||||
InsetGraphics * ins = InsetGraphics::getCurrentGraphicsInset(cur);
|
||||
InsetGraphics * ins = graphics::getCurrentGraphicsInset(cur);
|
||||
if (!ins)
|
||||
enable = false;
|
||||
else
|
||||
|
@ -640,7 +640,7 @@ void MenuDefinition::expandGraphicsGroups(BufferView const * bv)
|
||||
if (!bv)
|
||||
return;
|
||||
set<string> grp;
|
||||
InsetGraphics::getGraphicsGroups(bv->buffer(), grp);
|
||||
graphics::getGraphicsGroups(bv->buffer(), grp);
|
||||
if (grp.empty())
|
||||
return;
|
||||
|
||||
|
@ -949,8 +949,9 @@ string InsetGraphics::params2string(InsetGraphicsParams const & params,
|
||||
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();
|
||||
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())
|
||||
return string();
|
||||
@ -979,14 +980,14 @@ string InsetGraphics::getGroupParams(Buffer const & b, std::string const & group
|
||||
if (inspar.groupId == groupId) {
|
||||
InsetGraphicsParams tmp = inspar;
|
||||
tmp.filename.erase();
|
||||
return params2string(tmp, b);
|
||||
return InsetGraphics::params2string(tmp, b);
|
||||
}
|
||||
}
|
||||
return string();
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphics::unifyGraphicsGroups(Buffer const & b, std::string const & argument)
|
||||
void unifyGraphicsGroups(Buffer const & b, std::string const & argument)
|
||||
{
|
||||
InsetGraphicsParams 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();
|
||||
if (instmp->lyxCode() != GRAPHICS_CODE)
|
||||
@ -1019,4 +1020,6 @@ InsetGraphics * InsetGraphics::getCurrentGraphicsInset(Cursor const & cur)
|
||||
return static_cast<InsetGraphics *>(instmp);
|
||||
}
|
||||
|
||||
} // namespace graphics
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -48,16 +48,6 @@ public:
|
||||
///
|
||||
static std::string params2string(InsetGraphicsParams 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.
|
||||
Return true of new params are different from what was so far.
|
||||
@ -133,6 +123,22 @@ private:
|
||||
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
|
||||
|
||||
#endif // INSET_GRAPHICS_H
|
||||
|
Loading…
Reference in New Issue
Block a user