• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kig

  • sources
  • kde-4.12
  • kdeedu
  • kig
  • modes
label.cc
Go to the documentation of this file.
1 // Copyright (C) 2002 Dominique Devriese <devriese@kde.org>
2 
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
7 
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 // 02110-1301, USA.
17 
18 #include "label.h"
19 
20 #include "linkslabel.h"
21 #include "normal.h"
22 #include "textlabelwizard.h"
23 
24 #include "../kig/kig_commands.h"
25 #include "../kig/kig_document.h"
26 #include "../kig/kig_part.h"
27 #include "../kig/kig_view.h"
28 #include "../misc/common.h"
29 #include "../misc/kigpainter.h"
30 #include "../misc/calcpaths.h"
31 #include "../objects/bogus_imp.h"
32 #include "../objects/curve_imp.h"
33 #include "../objects/object_factory.h"
34 #include "../objects/point_imp.h"
35 #include "../objects/text_imp.h"
36 #include "../objects/text_type.h"
37 
38 #include <qaction.h>
39 #include <qevent.h>
40 #include <qmenu.h>
41 #include <qregexp.h>
42 #include <qvariant.h>
43 
44 #include <kcursor.h>
45 #include <kdebug.h>
46 #include <kicon.h>
47 #include <klocale.h>
48 #include <kmessagebox.h>
49 
50 #include <algorithm>
51 #include <functional>
52 #include <iterator>
53 
54 class TextLabelModeBase::Private
55 {
56 public:
57  // point last clicked..
58  QPoint plc;
59  // the currently selected coordinate
60  Coordinate mcoord;
61  // the possible parent object that defines the location of the label..
62  ObjectCalcer* locationparent;
63 
64  // the text is only kept in the text input widget, not here
65  // QString mtext;
66 
67  // the property objects we'll be using as args, we keep a reference
68  // to them in the args object, and keep a pointer to them ( or 0 )
69  // in the correct order in args ( separately, because we can't use
70  // the order of the parents of a ReferenceObject, and certainly
71  // can't give 0 as a parent..
72  argvect args;
73 
74  // if we're ReallySelectingArgs, then this var points to the arg
75  // we're currently selecting...
76  int mwaaws;
77 
78  // last percent count...
79  uint lpc;
80 
81  TextLabelWizard* wiz;
82 
83  // What Are We Doing
84  wawdtype mwawd;
85 };
86 
87 TextLabelModeBase::~TextLabelModeBase()
88 {
89  delete d->wiz;
90  delete d;
91 }
92 
93 TextLabelModeBase::TextLabelModeBase( KigPart& doc )
94  : KigMode( doc ), d( new Private )
95 {
96  d->locationparent = 0;
97  d->lpc = 0;
98  d->mwawd = SelectingLocation;
99  d->wiz = new TextLabelWizard( doc.widget(), this );
100 }
101 
102 void TextLabelModeBase::leftClicked( QMouseEvent* e, KigWidget* )
103 {
104  d->plc = e->pos();
105  switch( d->mwawd )
106  {
107  case RequestingText:
108  case SelectingArgs:
109  d->wiz->raise();
110  d->wiz->activateWindow();
111  break;
112  default:
113  break;
114  };
115 }
116 
117 void TextLabelModeBase::leftReleased( QMouseEvent* e, KigWidget* v )
118 {
119  leftReleased( e, v, 0 );
120 }
121 
122 /*
123  * prevlabel is nonzero only if we are redefining an existing label
124  * in which case we have to check that the new parents of the label
125  * are not children of the label itself, thus causing circular dependence
126  * in the object hierarchy
127  */
128 void TextLabelModeBase::leftReleased( QMouseEvent* e, KigWidget* v,
129  ObjectTypeCalcer* prevlabel )
130 {
131  switch( d->mwawd )
132  {
133  case SelectingLocation:
134  {
135  if ( ( d->plc - e->pos() ).manhattanLength() > 4 ) return;
136  /*
137  * in case we are redefining a text label:
138  * we postpone the circular recursion check untill the
139  * finish() method is called. This is not the optimal
140  * solution, since the user receives confusing feedback
141  * from the cursor, which seemingly indicates that some
142  * curve or point could be selected for the new position
143  * although in the end a new fixed point will be created
144  * if the circularity (isChild) test fails.
145  */
146  setCoordinate( v->fromScreen( d->plc ) );
147  break;
148  }
149  case RequestingText:
150  case SelectingArgs:
151  d->wiz->raise();
152  d->wiz->activateWindow();
153  break;
154  case ReallySelectingArgs:
155  {
156  if ( ( d->plc - e->pos() ).manhattanLength() > 4 ) break;
157  std::vector<ObjectHolder*> os = mdoc.document().whatAmIOn( v->fromScreen( d->plc ), *v );
158  if ( os.empty() ) break;
159  ObjectHolder* o = os[0];
160  /*
161  * if prevlabel != 0 then we are redefining an existing label.
162  * In this case it is important to check that the new arguments
163  * are not children of the label
164  */
165  if ( prevlabel && isChild( o->calcer(), prevlabel ) ) break;
166  QMenu p( v );
167  p.setObjectName( "text_label_select_arg_popup" );
168  QAction* act = p.addAction( i18n( "Name" ) );
169  act->setData( QVariant::fromValue( 0 ) );
170  QByteArrayList l = o->imp()->properties();
171  assert( l.size() == o->imp()->numberOfProperties() );
172  for ( int i = 0; i < l.size(); ++i )
173  {
174  QString s = i18n( l[i] );
175  const char* iconfile = o->imp()->iconForProperty( i );
176  if ( iconfile && *iconfile )
177  {
178  act = p.addAction( KIcon( QLatin1String( iconfile ), mdoc.iconLoader() ), s );
179  }
180  else
181  {
182  act = p.addAction( s );
183  };
184  act->setData( QVariant::fromValue( i + 1 ) );
185  };
186  act = p.exec( v->mapToGlobal( d->plc ) );
187  if ( !act ) break;
188  int result = act->data().toInt();
189  ObjectCalcer::shared_ptr argcalcer;
190  if ( result < 0 ) break;
191  else if ( result == 0 )
192  {
193  argcalcer = o->nameCalcer();
194  if ( !argcalcer )
195  {
196  ObjectConstCalcer* c = new ObjectConstCalcer( new StringImp( i18n( "<unnamed object>" ) ) );
197  o->setNameCalcer( c );
198  argcalcer = c;
199  }
200  }
201  else
202  {
203  assert( result < l.size() + 1 );
204 // argcalcer = new ObjectPropertyCalcer( o->calcer(), result - 1 );
205  argcalcer = new ObjectPropertyCalcer( o->calcer(), result - 1, true );
206  }
207  d->args[d->mwaaws] = argcalcer.get();
208  argcalcer->calc( mdoc.document() );
209 
210  updateLinksLabel();
211  break;
212  }
213  default:
214  assert( false );
215  break;
216  };
217 }
218 
219 void TextLabelModeBase::killMode()
220 {
221  mdoc.doneMode( this );
222 }
223 
224 void TextLabelModeBase::cancelConstruction()
225 {
226  killMode();
227 }
228 
229 void TextLabelModeBase::enableActions()
230 {
231  KigMode::enableActions();
232 
233  mdoc.aCancelConstruction->setEnabled( true );
234 }
235 
236 void TextLabelModeBase::mouseMoved( QMouseEvent* e, KigWidget* w )
237 {
238  if ( d->mwawd == ReallySelectingArgs )
239  {
240  std::vector<ObjectHolder*> os = mdoc.document().whatAmIOn( w->fromScreen( e->pos() ), *w );
241  if ( !os.empty() ) w->setCursor( Qt::PointingHandCursor );
242  else w->setCursor( Qt::ArrowCursor );
243  }
244  else if ( d->mwawd == SelectingLocation )
245  {
246  std::vector<ObjectHolder*> os = mdoc.document().whatAmIOn( w->fromScreen( e->pos() ), *w );
247  bool attachable = false;
248  d->locationparent = 0;
249  for ( std::vector<ObjectHolder*>::iterator i = os.begin(); i != os.end(); ++i )
250  {
251  if( (*i)->imp()->attachPoint().valid() ||
252  (*i)->imp()->inherits( PointImp::stype() ) ||
253  (*i)->imp()->inherits( CurveImp::stype() ) )
254  {
255  attachable = true;
256  d->locationparent = (*i)->calcer();
257  break;
258  };
259  };
260  w->updateCurPix();
261  if ( attachable )
262  {
263  w->setCursor( Qt::PointingHandCursor );
264  QString s = d->locationparent->imp()->type()->attachToThisStatement();
265  mdoc.emitStatusBarText( s );
266 
267  KigPainter p( w->screenInfo(), &w->curPix, mdoc.document() );
268 
269  // set the text next to the arrow cursor
270  QPoint point = e->pos();
271  point.setX(point.x()+15);
272 
273  p.drawTextStd( point, s );
274  w->updateWidget( p.overlay() );
275  }
276  else
277  {
278  w->setCursor( Qt::CrossCursor );
279  mdoc.emitStatusBarText( 0 );
280  w->updateWidget();
281  };
282  }
283 }
284 
285 void TextLabelModeBase::enterTextPageEntered()
286 {
287 }
288 
289 void TextLabelModeBase::selectArgumentsPageEntered()
290 {
291  updateLinksLabel();
292 }
293 
294 void TextLabelModeBase::cancelPressed()
295 {
296  cancelConstruction();
297 }
298 
299 // also used in textlabelwizard.cc
300 uint percentCount( const QString& s )
301 {
302 // QRegExp re( QString::fromUtf8( "%[0-9]" ) );
303  QRegExp re( QString::fromUtf8( "%[\\d]+" ) );
304  int offset = 0;
305  uint percentcount = 0;
306  while ( ( offset = re.indexIn( s, offset ) ) != -1 )
307  {
308  ++percentcount;
309  offset += re.matchedLength();
310  };
311  return percentcount;
312 }
313 
314 bool TextLabelModeBase::canFinish()
315 {
316  bool finish = true;
317  QString s = d->wiz->text();
318 
319  assert( percentCount( s ) == d->args.size() );
320  if ( d->wiz->currentId() == TextLabelWizard::TextPageId )
321  assert( d->args.size() == 0 );
322 
323  for ( argvect::iterator i = d->args.begin(); i != d->args.end(); ++i )
324  finish = finish && ( *i != 0 );
325 
326  if ( ! finish )
327  {
328  KMessageBox::sorry( mdoc.widget(),
329  i18n( "There are '%n' parts in the text that you have not selected a "
330  "value for. Please remove them or select enough arguments." ) );
331  };
332 
333  return finish;
334 }
335 
336 void TextLabelModeBase::finishPressed()
337 {
338  bool needframe = d->wiz->field( "wantframe" ).toBool();
339  QString s = d->wiz->text();
340 
341  finish( d->mcoord, s, d->args, needframe, d->locationparent );
342  killMode();
343 }
344 
345 bool TextLabelModeBase::percentCountChanged( uint percentcount )
346 {
347  bool finish = true;
348  if ( d->lpc > percentcount )
349  {
350  d->args = argvect( d->args.begin(), d->args.begin() + percentcount );
351  }
352  else if ( d->lpc < percentcount )
353  {
354  d->args.resize( percentcount, 0 );
355  };
356 
357  if ( percentcount != 0 )
358  {
359  bool finished = true;
360  for ( argvect::iterator i = d->args.begin(); i != d->args.end(); ++i )
361  finished &= ( *i != 0 );
362  assert( percentcount == d->args.size() );
363  finish = finished;
364  };
365 
366  d->lpc = percentcount;
367 
368  return finish;
369 }
370 
371 void TextLabelModeBase::updateLinksLabel()
372 {
373  LinksLabel::LinksLabelEditBuf buf = d->wiz->linksLabel()->startEdit();
374  QString s = d->wiz->text();
375 // QRegExp re( "%[0-9]" );
376  QRegExp re( "%[\\d]+" );
377  int prevpos = 0;
378  int pos = 0;
379  uint count = 0;
380  // we split up the string into text and "links"
381  while ( ( pos = re.indexIn( s, pos ) ) != -1 )
382  {
383  // prevpos is the first character after the last match, pos is the
384  // first char of the current match..
385  if ( prevpos != pos )
386  {
387  // there is a text part between the previous and the current
388  // "link"...
389  assert( prevpos < pos );
390  // fetch the text part...
391  QString subs = s.mid( prevpos, pos - prevpos );
392  // and add it...
393  d->wiz->linksLabel()->addText( subs, buf );
394  };
395  // we always need a link part...
396  QString linktext( "%1" );
397  assert( count < d->args.size() );
398  if ( d->args[count] )
399  {
400  // if the user has already selected a property, then we show its
401  // value...
402  d->args[count]->imp()->fillInNextEscape( linktext, mdoc.document() );
403  }
404  else
405  // otherwise, we show a stub...
406  linktext = i18n( "argument %1", count + 1 );
407 
408  d->wiz->linksLabel()->addLink( linktext, buf );
409  // set pos and prevpos to the next char after the last match, so
410  // we don't enter infinite loops...
411 // pos += 2;
412  pos += re.matchedLength();
413  prevpos = pos;
414  ++count;
415  };
416 
417  if ( prevpos != s.length() )
418  d->wiz->linksLabel()->addText( s.mid( prevpos ), buf );
419 
420  d->wiz->linksLabel()->applyEdit( buf );
421 
422  d->wiz->resize( d->wiz->size() );
423 }
424 
425 void TextLabelModeBase::linkClicked( int i )
426 {
427  mdoc.widget()->activateWindow();
428  mdoc.widget()->raise();
429 
430  assert( d->args.size() >= static_cast<uint>( i + 1 ) );
431 
432  d->mwawd = ReallySelectingArgs;
433  d->mwaaws = i;
434 
435  mdoc.emitStatusBarText( i18n( "Selecting argument %1", i + 1 ) );
436 }
437 
438 void TextLabelModeBase::redrawScreen( KigWidget* w )
439 {
440  w->redrawScreen( std::vector<ObjectHolder*>() );
441  w->updateScrollBars();
442 }
443 
444 void TextLabelModeBase::setCoordinate( const Coordinate& coord )
445 {
446  d->mcoord = coord;
447  if ( d->mwawd == SelectingLocation )
448  {
449  d->mwawd = RequestingText;
450  d->wiz->show();
451  };
452 }
453 
454 void TextLabelModeBase::setText( const QString& s )
455 {
456  d->wiz->setText( s );
457 }
458 
459 void TextLabelModeBase::setPropertyObjects( const argvect& props )
460 {
461  d->args = props;
462  for ( argvect::iterator i = d->args.begin(); i != d->args.end(); ++i )
463  (*i)->calc( mdoc.document() );
464 }
465 
466 TextLabelConstructionMode::TextLabelConstructionMode( KigPart& d )
467  : TextLabelModeBase( d )
468 {
469 }
470 
471 TextLabelConstructionMode::~TextLabelConstructionMode()
472 {
473 }
474 
475 void TextLabelConstructionMode::finish(
476  const Coordinate& coord, const QString& s,
477  const argvect& props, bool needframe,
478  ObjectCalcer* locationparent )
479 {
480  std::vector<ObjectCalcer*> args;
481  for ( argvect::const_iterator i = props.begin();
482  i != props.end(); ++i )
483  args.push_back( i->get() );
484 
485  ObjectHolder* label = 0;
486  if ( locationparent )
487  label = ObjectFactory::instance()->attachedLabel( s, locationparent, coord, needframe, args, mdoc.document() );
488  else
489  label = ObjectFactory::instance()->label( s, coord, needframe, args, mdoc.document() );
490  mdoc.addObject( label );
491 }
492 
493 TextLabelRedefineMode::TextLabelRedefineMode( KigPart& d, ObjectTypeCalcer* label )
494  : TextLabelModeBase( d ), mlabel( label )
495 {
496  assert( label->imp()->inherits( TextImp::stype() ) );
497  std::vector<ObjectCalcer*> parents = label->parents();
498  assert( parents.size() >= 3 );
499  std::vector<ObjectCalcer*> firstthree( parents.begin(), parents.begin() + 3 );
500  std::vector<ObjectCalcer*> rest( parents.begin() + 3, parents.end() );
501  firstthree = TextType::instance()->argParser().parse( firstthree );
502 
503  assert( firstthree[0]->imp()->inherits( IntImp::stype() ) );
504  assert( firstthree[1]->imp()->inherits( PointImp::stype() ) );
505  assert( firstthree[2]->imp()->inherits( StringImp::stype() ) );
506 
507  bool frame = static_cast<const IntImp*>( firstthree[0]->imp() )->data() != 0;
508  Coordinate coord = static_cast<const PointImp*>( firstthree[1]->imp() )->coordinate();
509  QString text = static_cast<const StringImp*>( firstthree[2]->imp() )->data();
510 
511  // don't set it, let the user redefine it..
512 // setCoordinate( coord );
513  setText( text );
514  setFrame( frame );
515 
516  argvect v;
517  for ( uint i = 0; i < rest.size(); ++i )
518  {
519  v.push_back( rest[i] );
520  };
521  assert( v.size() == rest.size() );
522 
523  setPropertyObjects( v );
524 }
525 
526 TextLabelRedefineMode::~TextLabelRedefineMode()
527 {
528 }
529 
530 void TextLabelRedefineMode::leftReleased( QMouseEvent* e, KigWidget* v )
531 {
532  TextLabelModeBase::leftReleased( e, v, mlabel );
533 }
534 
535 void TextLabelRedefineMode::finish(
536  const Coordinate& coord, const QString& s,
537  const argvect& props, bool needframe,
538  ObjectCalcer* locationparent )
539 {
540  std::vector<ObjectCalcer*> parents = mlabel->parents();
541  assert( parents.size() >= 3 );
542  std::vector<ObjectCalcer*> firstthree( parents.begin(), parents.begin() + 3 );
543  std::vector<ObjectCalcer*> rest( parents.begin() + 3, parents.end() );
544  firstthree = TextType::instance()->argParser().parse( firstthree );
545 
546  KigCommand* kc = new KigCommand( mdoc, i18n( "Change Label" ) );
547  MonitorDataObjects mon( firstthree );
548 
549  assert( firstthree[0]->imp()->inherits( IntImp::stype() ) );
550  assert( firstthree[1]->imp()->inherits( PointImp::stype() ) );
551  assert( firstthree[2]->imp()->inherits( StringImp::stype() ) );
552 
553  assert( dynamic_cast<ObjectConstCalcer*>( firstthree[0] ) );
554  assert( dynamic_cast<ObjectConstCalcer*>( firstthree[2] ) );
555  static_cast<ObjectConstCalcer*>( firstthree[0] )->setImp( new IntImp( needframe ? 1 : 0 ) );
556 
557  // we don't do this, because
558  // 1 this isn't necessarily a DataObject, we also support it to be a
559  // user-known point, or an internal constrained point..
560  // 2 we don't know that we don't want it to become a user-known
561  // point or an internal constrained point, instead of a
562  // DataObject..
563  // static_cast<DataObject*>( firstthree[1] )->setImp( new PointImp(
564  // coord ) );
565 
566  static_cast<ObjectConstCalcer*>( firstthree[2] )->setImp( new StringImp( s ) );
567  mon.finish( kc );
568 
569  std::vector<ObjectCalcer*> oldparents = mlabel->parents();
570  std::vector<ObjectCalcer*> p;
571  for ( argvect::const_iterator i = props.begin();
572  i != props.end(); ++i )
573  p.push_back( i->get() );
574  for ( std::vector<ObjectCalcer*>::iterator i = p.begin();
575  i != p.end(); ++i )
576  ( *i )->calc( mdoc.document() );
577 
578  std::vector<ObjectCalcer*> np = firstthree;
579  /*
580  * this avoids circular recursion in case the location parent
581  * is actually a child of this label
582  */
583  if ( locationparent && isChild( locationparent, mlabel ) )
584  locationparent = 0;
585  /*
586  * take advantage of the method "getAttachPoint" that should
587  * do all the work; it is also used when creating a new label
588  */
589  np[1] = ObjectFactory::instance()->getAttachPoint( locationparent, coord, mdoc.document() );
590 
591 /* this is the old code, just in case... */
592 // if ( locationparent && locationparent->imp()->inherits( CurveImp::stype() ) )
593 // {
594 // double param = static_cast<const CurveImp*>( locationparent->imp() )->getParam( coord, mdoc.document() );
595 // np[1] = ObjectFactory::instance()->constrainedPointCalcer( locationparent, param );
596 // np[1]->calc( mdoc.document() );
597 // }
598 // else if ( locationparent )
599 // {
600 // assert( locationparent->imp()->inherits( PointImp::stype() ) );
601 // np[1] = locationparent;
602 // }
603 // else
604 // np[1] = new ObjectConstCalcer( new PointImp( coord ) );
605 
606  copy( p.begin(), p.end(), back_inserter( np ) );
607 
608  kc->addTask(
609  new ChangeParentsAndTypeTask(
610  mlabel, np, TextType::instance() ) );
611 
612  mdoc.history()->push( kc );
613 }
614 
615 void TextLabelModeBase::setFrame( bool f )
616 {
617  d->wiz->setField( "wantframe", f );
618 }
619 
620 void TextLabelModeBase::setLocationParent( ObjectCalcer* o )
621 {
622  d->locationparent = o;
623 }
624 
625 NumericLabelMode::NumericLabelMode( KigPart& doc )
626  : KigMode( doc )
627 {
628 }
629 
630 NumericLabelMode::~NumericLabelMode()
631 {
632 }
633 
634 void NumericLabelMode::leftClicked( QMouseEvent* e, KigWidget* )
635 {
636  mplc = e->pos();
637 }
638 
639 void NumericLabelMode::leftReleased( QMouseEvent* e, KigWidget* v )
640 {
641  if ( ( mplc - e->pos() ).manhattanLength() > 4 ) return;
642 
643  bool ok;
644  double val = getDoubleFromUser(
645  i18n( "Set Value" ), i18n( "Enter value:" ),
646  0.0, v, &ok, -2147483647, 2147483647, 7 );
647 
648  if ( !ok )
649  {
650  cancelConstruction();
651  return;
652  }
653  Coordinate loc = v->fromScreen( mplc );
654  ObjectHolder* p = ObjectFactory::instance()->numericValue( val, loc, mdoc.document() );
655  p->calc( mdoc.document() );
656  mdoc.addObject( p );
657  killMode();
658 }
659 
660 void NumericLabelMode::killMode()
661 {
662  mdoc.doneMode( this );
663 }
664 
665 void NumericLabelMode::cancelConstruction()
666 {
667  killMode();
668 }
669 
670 void NumericLabelMode::enableActions()
671 {
672  KigMode::enableActions();
673 
674  mdoc.aCancelConstruction->setEnabled( true );
675 
676  mdoc.emitStatusBarText( i18n( "Select the position for the new numeric value..." ) );
677 }
678 
679 void NumericLabelMode::mouseMoved( QMouseEvent*, KigWidget* w )
680 {
681  w->setCursor( Qt::CrossCursor );
682 }
683 
684 void NumericLabelMode::redrawScreen( KigWidget* w )
685 {
686  w->redrawScreen( std::vector<ObjectHolder*>() );
687  w->updateScrollBars();
688 }
ObjectFactory::instance
static const ObjectFactory * instance()
Definition: object_factory.cc:90
TextLabelWizard
Definition: textlabelwizard.h:28
TextLabelModeBase::redrawScreen
void redrawScreen(KigWidget *w)
Redraw the document on KigWidget w .
Definition: label.cc:438
ObjectImp::inherits
bool inherits(const ObjectImpType *t) const
Returns true if this ObjectImp inherits the ObjectImp type represented by t.
Definition: object_imp.cc:279
NumericLabelMode::killMode
void killMode()
Definition: label.cc:660
StringImp
This ObjectImp is a BogusImp containing only a string value.
Definition: bogus_imp.h:167
KigCommand
a KigCommand represents almost every action performed in Kig.
Definition: kig_commands.h:44
TextLabelModeBase::setText
void setText(const QString &s)
Definition: label.cc:454
TextLabelModeBase::enterTextPageEntered
void enterTextPageEntered()
Definition: label.cc:285
ObjectConstCalcer
This is an ObjectCalcer that keeps an ObjectImp, and never calculates a new one.
Definition: object_calcer.h:232
KigCommand::addTask
void addTask(KigCommandTask *)
Definition: kig_commands.cpp:74
KigPart::document
const KigDocument & document() const
Definition: kig_part.cpp:989
TextLabelModeBase::canFinish
bool canFinish()
Definition: label.cc:314
NumericLabelMode::enableActions
void enableActions()
actions: we enable the actions we want when our mode is made active.
Definition: label.cc:670
KigPart::history
QUndoStack * history()
Definition: kig_part.cpp:633
KigPart::emitStatusBarText
void emitStatusBarText(const QString &text)
Definition: kig_part.cpp:695
ObjectFactory::getAttachPoint
ObjectCalcer * getAttachPoint(ObjectCalcer *locationparent, const Coordinate &loc, const KigDocument &doc) const
this has been added because it comes handy when redefining a text label, we move here all the code fo...
Definition: object_factory.cc:421
TextLabelConstructionMode::finish
void finish(const Coordinate &coord, const QString &s, const argvect &props, bool needframe, ObjectCalcer *locationparent)
Definition: label.cc:475
KigMode::enableActions
virtual void enableActions()
actions: we enable the actions we want when our mode is made active.
Definition: mode.cc:27
TextLabelModeBase::cancelPressed
void cancelPressed()
Definition: label.cc:294
IntImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the IntImp type.
Definition: bogus_imp.cc:278
TextLabelModeBase::linkClicked
void linkClicked(int)
Definition: label.cc:425
NumericLabelMode::leftClicked
void leftClicked(QMouseEvent *, KigWidget *)
Definition: label.cc:634
ObjectTypeCalcer
This is an ObjectCalcer that uses one of the various ObjectType's to calculate its ObjectImp...
Definition: object_calcer.h:183
NumericLabelMode::leftReleased
void leftReleased(QMouseEvent *, KigWidget *)
Definition: label.cc:639
ObjectHolder::nameCalcer
const ObjectConstCalcer * nameCalcer() const
Definition: object_holder.cc:63
IntImp
This ObjectImp is a BogusImp containing only an int value.
Definition: bogus_imp.h:128
KigMode::mdoc
KigPart & mdoc
Definition: mode.h:94
TextLabelRedefineMode::TextLabelRedefineMode
TextLabelRedefineMode(KigPart &d, ObjectTypeCalcer *label)
Definition: label.cc:493
myboost::intrusive_ptr< ObjectCalcer >
TextLabelRedefineMode::leftReleased
void leftReleased(QMouseEvent *, KigWidget *)
Definition: label.cc:530
KigMode
this is an ABC of a class containing the current "Mode" of the Kig document...
Definition: mode.h:37
NumericLabelMode::mouseMoved
void mouseMoved(QMouseEvent *, KigWidget *)
mouse moved without any buttons down...
Definition: label.cc:679
NumericLabelMode::NumericLabelMode
NumericLabelMode(KigPart &d)
Definition: label.cc:625
Coordinate
The Coordinate class is the basic class representing a 2D location by its x and y components...
Definition: coordinate.h:33
ObjectHolder::calc
void calc(const KigDocument &)
Make our ObjectCalcer recalculate its ObjectImp.
Definition: object_holder.cc:73
KigWidget::updateScrollBars
void updateScrollBars()
Definition: kig_view.cpp:298
TextLabelModeBase::leftReleased
void leftReleased(QMouseEvent *, KigWidget *, ObjectTypeCalcer *prevlabel=0)
Definition: label.cc:128
KigWidget::screenInfo
const ScreenInfo & screenInfo() const
the part of the document we're currently showing i.e.
Definition: kig_view.cpp:272
TextLabelRedefineMode::~TextLabelRedefineMode
~TextLabelRedefineMode()
Definition: label.cc:526
linkslabel.h
TextLabelModeBase::setCoordinate
void setCoordinate(const Coordinate &coord)
Definition: label.cc:444
TextLabelModeBase::TextLabelModeBase
TextLabelModeBase(KigPart &d)
Definition: label.cc:93
ObjectFactory::label
ObjectHolder * label(const QString &s, const Coordinate &loc, bool needframe, const std::vector< ObjectCalcer * > &parents, const KigDocument &doc) const
returns a label with text s at point c .
Definition: object_factory.cc:386
ObjectImp::iconForProperty
virtual const char * iconForProperty(int which) const
Definition: object_imp.cc:187
TextLabelModeBase::argvect
std::vector< ObjectCalcer::shared_ptr > argvect
Definition: label.h:59
KigPainter
KigPainter is an extended QPainter.
Definition: kigpainter.h:51
getDoubleFromUser
double getDoubleFromUser(const QString &caption, const QString &label, double value, QWidget *parent, bool *ok, double min, double max, int decimals)
Here, we define some algorithms which we need in various places...
Definition: common.cpp:349
ObjectHolder
An ObjectHolder represents an object as it is known to the document.
Definition: object_holder.h:40
ObjectTypeCalcer::imp
const ObjectImp * imp() const
Returns the ObjectImp of this ObjectCalcer.
Definition: object_calcer.cc:100
PointImp
An ObjectImp representing a point.
Definition: point_imp.h:27
TextLabelModeBase::selectArgumentsPageEntered
void selectArgumentsPageEntered()
Definition: label.cc:289
ObjectCalcer
An ObjectCalcer is an object that represents an algorithm for calculating an ObjectImp from other Obj...
Definition: object_calcer.h:66
KigWidget::fromScreen
const Coordinate fromScreen(const QPoint &p)
Definition: kig_view.cpp:282
MonitorDataObjects
this class monitors a set of DataObjects for changes and returns an appropriate ChangeObjectImpsComma...
Definition: kig_commands.h:153
KigDocument::whatAmIOn
std::vector< ObjectHolder * > whatAmIOn(const Coordinate &p, const KigWidget &w) const
Return a vector of objects that contain the given point.
Definition: kig_document.cc:68
NumericLabelMode::cancelConstruction
void cancelConstruction()
Definition: label.cc:665
TextLabelWizard::TextPageId
static const int TextPageId
Definition: textlabelwizard.h:35
ObjectCalcer::calc
virtual void calc(const KigDocument &)=0
Makes the ObjectCalcer recalculate its ObjectImp from its parents.
KigWidget
This class is the real widget showing the document.
Definition: kig_view.h:50
percentCount
uint percentCount(const QString &s)
Definition: label.cc:300
KigPart::doneMode
void doneMode(KigMode *)
Definition: kig_part.cpp:749
ObjectPropertyCalcer
This is an ObjectCalcer that has a single parent, and gets a certain property from it in its calc() m...
Definition: object_calcer.h:276
KigWidget::updateCurPix
void updateCurPix(const std::vector< QRect > &=std::vector< QRect >())
update curPix (bitBlt stillPix onto curPix..)
Definition: kig_view.cpp:187
isChild
bool isChild(const ObjectCalcer *o, ObjectCalcer *op)
Definition: calcpaths.cc:256
ObjectHolder::setNameCalcer
void setNameCalcer(ObjectConstCalcer *namecalcer)
Setting the namecalcer is only allowed if previously none was set.
Definition: object_holder.cc:151
TextLabelModeBase::setLocationParent
void setLocationParent(ObjectCalcer *o)
Definition: label.cc:620
ObjectHolder::imp
const ObjectImp * imp() const
Definition: object_holder.cc:48
ObjectHolder::calcer
const ObjectCalcer * calcer() const
Definition: object_holder.cc:53
KigPart::addObject
void addObject(ObjectHolder *inObject)
Definition: kig_part.cpp:492
KigWidget::curPix
QPixmap curPix
temporary, gets bitBlt'd (copied) onto the widget (to avoid flickering)
Definition: kig_view.h:84
GenericTextType::argParser
const ArgsParser & argParser() const
Definition: text_type.cc:130
PointImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing PointImp's.
Definition: point_imp.cc:159
TextLabelModeBase::finishPressed
void finishPressed()
Definition: label.cc:336
TextLabelConstructionMode::~TextLabelConstructionMode
~TextLabelConstructionMode()
Definition: label.cc:471
LinksLabel::LinksLabelEditBuf
Definition: linkslabel.h:38
ObjectFactory::attachedLabel
ObjectHolder * attachedLabel(const QString &s, ObjectCalcer *locationparent, const Coordinate &loc, bool needframe, const std::vector< ObjectCalcer * > &parents, const KigDocument &doc) const
Definition: object_factory.cc:474
CurveImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the CurveImp type.
Definition: curve_imp.cc:27
KigWidget::updateWidget
void updateWidget(const std::vector< QRect > &=std::vector< QRect >())
this means bitBlting curPix on the actual widget...
Definition: kig_view.cpp:115
TextLabelModeBase::setFrame
void setFrame(bool f)
Definition: label.cc:615
StringImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the StringImp type.
Definition: bogus_imp.cc:220
ChangeParentsAndTypeTask
Definition: kig_commands.h:196
TextLabelModeBase::finish
virtual void finish(const Coordinate &c, const QString &s, const argvect &props, bool needframe, ObjectCalcer *locationparent)=0
ObjectTypeCalcer::parents
std::vector< ObjectCalcer * > parents() const
Returns the parent ObjectCalcer's of this ObjectCalcer.
Definition: object_calcer.cc:105
label.h
textlabelwizard.h
normal.h
TextLabelModeBase::~TextLabelModeBase
~TextLabelModeBase()
Definition: label.cc:87
QByteArrayList
QList< QByteArray > QByteArrayList
Definition: objects/common.h:50
TextLabelModeBase::setPropertyObjects
void setPropertyObjects(const argvect &props)
objects you pass here, should be newly created property objects, that have no children.
Definition: label.cc:459
KigPart
This is a "Part".
Definition: kig_part.h:68
TextType::instance
static const TextType * instance()
Definition: text_type.cc:237
NumericLabelMode::~NumericLabelMode
~NumericLabelMode()
Definition: label.cc:630
TextImp::stype
static const ObjectImpType * stype()
Definition: text_imp.cc:143
myboost::intrusive_ptr::get
T * get() const
Definition: boost_intrusive_pointer.hpp:122
ObjectFactory::numericValue
ObjectHolder * numericValue(const double value, const Coordinate &loc, const KigDocument &doc) const
this returns a numeric label with the value value at the position loc .
Definition: object_factory.cc:59
KigPart::aCancelConstruction
KAction * aCancelConstruction
Definition: kig_part.h:236
TextLabelModeBase
this is the base class for TextLabelConstructionMode and TextLabelRedefineMode.
Definition: label.h:41
KigWidget::redrawScreen
void redrawScreen(const std::vector< ObjectHolder * > &selection, bool paintOnWidget=true)
Definition: kig_view.cpp:252
TextLabelModeBase::percentCountChanged
bool percentCountChanged(uint percentcount)
Definition: label.cc:345
NumericLabelMode::redrawScreen
void redrawScreen(KigWidget *w)
Redraw the document on KigWidget w .
Definition: label.cc:684
ObjectImp::numberOfProperties
virtual int numberOfProperties() const
Definition: object_imp.cc:58
uint
unsigned int uint
Definition: object_imp.h:87
TextLabelConstructionMode::TextLabelConstructionMode
TextLabelConstructionMode(KigPart &d)
Definition: label.cc:466
ObjectImp::properties
virtual const QByteArrayList properties() const
Definition: object_imp.cc:51
ArgsParser::parse
Args parse(const Args &os) const
Definition: argsparser.cpp:135
KigPainter::drawTextStd
void drawTextStd(const QPoint &p, const QString &s)
draws text in a standard manner, convenience function...
Definition: kigpainter.cpp:531
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:35:39 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kig

Skip menu "kig"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal