/*
* Text commands
*
* Authors:
* bulia byak
* Jon A. Cruz <jon@joncruz.org>
* Abhishek Sharma
*
* Copyright (C) 2004 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <cstring>
#include <string>
#include "sp-rect.h"
#include "sp-textpath.h"
#include "inkscape.h"
#include "desktop.h"
#include "document.h"
#include "document-undo.h"
#include "message-stack.h"
#include "selection.h"
#include "style.h"
#include "text-editing.h"
#include "text-chemistry.h"
#include "sp-flowtext.h"
#include "sp-flowregion.h"
#include "sp-flowdiv.h"
#include "sp-tspan.h"
#include "verbs.h"
using Inkscape::DocumentUndo;
static SPItem *
{
if (SP_IS_FLOWTEXT(*i))
return *i;
}
return NULL;
}
static SPItem *
{
if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i))
return *i;
}
return NULL;
}
static SPItem *
{
if (SP_IS_SHAPE(*i))
return *i;
}
return NULL;
}
void
{
if (!desktop)
return;
desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>a text and a path</b> to put text on path."));
return;
}
if (SP_IS_TEXT_TEXTPATH(text)) {
desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("This text object is <b>already put on a path</b>. Remove it from the path first. Use <b>Shift+D</b> to look up its path."));
return;
}
if (SP_IS_RECT(shape)) {
// rect is the only SPShape which is not <path> yet, and thus SVG forbids us from putting text on it
desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("You cannot put text on a rectangle in this version. Convert rectangle to path first."));
return;
}
// if a flowed text is selected, convert it to a regular text object
if (SP_IS_FLOWTEXT(text)) {
desktop->getMessageStack()->
_("The flowed text(s) must be <b>visible</b> in order to be put on a path."));
}
if (!repr) return;
new_item->updateRepr();
}
// remove transform from text, but recursively scale text's fontsize by the expansion
// make a list of text children
}
// create textPath and put it into the text
// reference the shape
}
// Make a copy of each text child
// We cannot have multiline in textpath, so remove line attrs from tspans
}
// remove the old repr from under text
// put its copy into under textPath
}
// x/y are useless with textpath, and confuse Batik 1.5
_("Put text on path"));
}
void
{
desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>a text on path</b> to remove it from path."));
return;
}
bool did = false;
if (SP_IS_TEXT_TEXTPATH(obj)) {
did = true;
}
}
if (!did) {
desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No texts-on-paths</b> in the selection."));
} else {
_("Remove text from path"));
}
}
static void
{
// if x contains a list, leave only the first value
if (x) {
}
}
}
}
//FIXME: must work with text selection
void
{
desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>text(s)</b> to remove kerns from."));
return;
}
bool did = false;
continue;
}
did = true;
}
if (!did) {
desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("Select <b>text(s)</b> to remove kerns from."));
} else {
_("Remove manual kerns"));
}
}
void
{
if (!desktop)
return;
desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>a text</b> and one or more <b>paths or shapes</b> to flow text into frame."));
return;
}
if (SP_IS_TEXT(text)) {
// remove transform from text, but recursively scale text's fontsize by the expansion
}
root_repr->setAttribute("xml:space", "preserve"); // we preserve spaces in the text objects we create
root_repr->setAttribute("style", text->getRepr()->attribute("style")); // fixme: transfer style attrs too
/* Add clones */
if (SP_IS_SHAPE(item)){
// add the new clone to the region
}
}
Inkscape::XML::Node *text_repr = xml_doc->createTextNode(text_ustring.c_str()); // FIXME: transfer all formatting! and convert newlines into flowParas!
} else { // reflow an already flowed text, preserving paras
if (SP_IS_FLOWPARA(o)) {
}
}
}
text->deleteObject(true);
_("Flow text into shape"));
}
void
text_unflow ()
{
if (!desktop)
return;
desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>a flowed text</b> to unflow it."));
return;
}
if (!SP_IS_FLOWTEXT(*i)) {
continue;
}
// we discard transform when unflowing, but we must preserve expansion which is visible as
// font size multiplier
continue;
}
/* Create <text> */
/* Set style */
rtext->setAttribute("style", flowtext->getRepr()->attribute("style")); // fixme: transfer style attrs too; and from descendants
if (bbox) {
}
/* Create <tspan> */
Inkscape::XML::Node *text_repr = xml_doc->createTextNode(text_string); // FIXME: transfer all formatting!!!
// restore the font size multiplier from the flowtext's transform
}
}
_("Unflow flowed text"));
}
void
{
_("Select <b>flowed text(s)</b> to convert."));
return;
}
bool did = false;
if (!SP_IS_FLOWTEXT(item))
continue;
desktop->getMessageStack()->
_("The flowed text(s) must be <b>visible</b> in order to be converted."));
return;
}
if (!repr) break;
did = true;
new_item->updateRepr();
item->deleteObject();
}
if (did) {
_("Convert flowed text to text"));
} else {
desktop->getMessageStack()->
_("<b>No flowed text(s)</b> to convert in the selection."));
}
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :