Source Code (Use browser search to find items of interest.)

Class Index

killustrator'BlendCmd (./koffice/killustrator/share/BlendCmd.h:34)

class BlendCmd : public Command {
public:
  BlendCmd (GDocument* doc, int steps);

  ~BlendCmd ();

  void execute ();
  void unexecute ();

private:
  GDocument* document;
  GObject *sobj, *eobj;
  GCurve *start, *end;
  list<GCurve*> curves;
  int num_steps;
};

killustrator'BlendCmd::BlendCmd() (./koffice/killustrator/share/BlendCmd.cc:32)

BlendCmd::BlendCmd (GDocument* doc, int steps) 
  : Command(i18n("Blend objects"))
{
  document = doc;
  num_steps = steps;
  list<GObject*>::iterator it = doc->getSelection ().begin ();
  for (int i = 0; it != doc->getSelection ().end (); it++, i++) {
    if (i == 2)
      break;
    (*it)->ref ();
    if (i == 0)
      sobj = *it;
    else
      eobj = *it;
  }
  start = end = 0L;
}


killustrator'BlendCmd::~BlendCmd() (./koffice/killustrator/share/BlendCmd.cc:50)

BlendCmd::~BlendCmd () {
  if (sobj)
    sobj->unref ();
  if (eobj)
    eobj->unref ();
  list<GCurve*>::iterator i;
  for (i = curves.begin (); i != curves.end (); i++)
    (*i)->unref ();
  if (start)
    start->unref ();
  if (end)
    end->unref ();
}


killustrator'BlendCmd::execute() (./koffice/killustrator/share/BlendCmd.cc:64)

void BlendCmd::execute () {
  if (! start) {
    if (sobj->isA ("GCurve"))
      start = (GCurve *) sobj;
    else
      start = sobj->convertToCurve ();
  }
  if (! end) {
    if (eobj->isA ("GCurve"))
      end = (GCurve *) eobj;
    else
      end = eobj->convertToCurve ();
  }
  if (start == NULL || end == NULL)
    return;
  document->setAutoUpdate (false);
  for (int i = 0; i < num_steps; i++) {
    unsigned int idx = document->findIndexOfObject (sobj);
    GCurve *curve = GCurve::blendCurves (start, end, i, num_steps);
    document->insertObjectAtIndex (curve, idx + i + 1);
    curves.push_back (curve);
  }
  document->setAutoUpdate (true);
}


killustrator'BlendCmd::unexecute() (./koffice/killustrator/share/BlendCmd.cc:89)

void BlendCmd::unexecute () {
  if (start == NULL || end == NULL)
    return;
  list<GCurve*>::iterator i;
  document->setAutoUpdate (false);
  for (i = curves.begin (); i != curves.end (); i++) {
    document->deleteObject (*i);
  }
  document->setAutoUpdate (true);
}