/*! \file action.cpp
** \brief Template File
**
-** $Id: action.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+** $Id$
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2008 Chris Moore
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
#include "canvasinterface.h"
+#include "general.h"
+
#endif
using namespace std;
#define ADD_ACTION(x) { BookEntry &be(book()[x::name__]); \
be.name=x::name__; \
- be.local_name=x::local_name__; \
+ be.local_name=dgettext("synfigstudio",x::local_name__); \
be.version=x::version__; \
be.task=x::task__; \
be.priority=x::priority__; \
Action::Handle
-Action::create(const String &name)
+Action::create(const synfig::String &name)
{
if(!book().count(name))
return 0; //! \todo perhaps we should throw something instead?
}
Action::CandidateList::iterator
-Action::CandidateList::find(const String& x)
+Action::CandidateList::find(const synfig::String& x)
{
iterator iter;
for(iter=begin();iter!=end();++iter)
set_param(iter->first,iter->second);
}
+synfig::String
+Action::Base::get_layer_descriptions(const std::list<synfig::Layer::Handle> layers, synfig::String singular_prefix, synfig::String plural_prefix)
+{
+ String ret;
+ bool first = true;
+
+ if (plural_prefix.empty())
+ plural_prefix = singular_prefix;
+
+ if (layers.empty())
+ return plural_prefix;
+
+ if (layers.size() == 1)
+ ret = singular_prefix;
+ else
+ ret = plural_prefix;
+
+ if (!ret.empty())
+ ret.push_back(' ');
+
+ for(std::list<synfig::Layer::Handle>::const_iterator iter=layers.begin(); iter!=layers.end(); ++iter)
+ {
+ if (first)
+ first = false;
+ else
+ ret += ", ";
+
+ ret += strprintf("'%s'", (*iter)->get_non_empty_description().c_str());
+ }
+
+ return ret;
+}
+
+synfig::String
+Action::Base::get_layer_descriptions(const std::list<std::pair<synfig::Layer::Handle,int> > layers, synfig::String singular_prefix, synfig::String plural_prefix)
+{
+ String ret;
+ bool first = true;
+
+ if (plural_prefix.empty())
+ plural_prefix = singular_prefix;
+
+ if (layers.empty())
+ return plural_prefix;
+
+ if (layers.size() == 1)
+ ret = singular_prefix;
+ else
+ ret = plural_prefix;
+
+ if (!ret.empty())
+ ret.push_back(' ');
+
+ for(std::list<std::pair<synfig::Layer::Handle,int> >::const_iterator iter=layers.begin(); iter!=layers.end(); ++iter)
+ {
+ if (first)
+ first = false;
+ else
+ ret += ", ";
+
+ ret += strprintf("'%s'", iter->first->get_non_empty_description().c_str());
+ }
+
+ return ret;
+}
+
void
Super::perform()
{
}
-Group::Group(const std::string &str):
+Group::Group(const synfig::String &str):
name_(str),
ready_(true)
{