• 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
  • popup
builtindocumentactionsprovider.cc
Go to the documentation of this file.
1 
20 #include "builtindocumentactionsprovider.h"
21 
22 #include "popup.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 "../../modes/normal.h"
29 #include "../../misc/coordinate_system.h"
30 
31 #include <KLocale>
32 
33 void BuiltinDocumentActionsProvider::fillUpMenu( NormalModePopupObjects& popup, int menu, int& nextfree )
34 {
35  if ( menu == NormalModePopupObjects::ToplevelMenu )
36  {
37  popup.addInternalAction( menu, i18n( "U&nhide All" ), nextfree++ );
38  popup.addInternalAction( menu, popup.part().action( "view_zoom_in" ) );
39  popup.addInternalAction( menu, popup.part().action( "view_zoom_out" ) );
40  popup.addInternalAction( menu, popup.part().action( "fullscreen" ) );
41  nextfree += 3;
42  }
43  else if ( menu == NormalModePopupObjects::SetCoordinateSystemMenu )
44  {
45  QStringList l = CoordinateSystemFactory::names();
46  mnumberofcoordsystems = l.count();
47  int current = popup.part().document().coordinateSystem().id();
48  QAction* act = 0;
49  for ( int i = 0; i < mnumberofcoordsystems; ++i )
50  {
51  act = popup.addInternalAction( menu, l.at( i ), nextfree++ );
52  act->setCheckable( true );
53  if ( i == current )
54  act->setChecked( true );
55  }
56  }
57 }
58 
59 bool BuiltinDocumentActionsProvider::executeAction(
60  int menu, int& id, const std::vector<ObjectHolder*>&,
61  NormalModePopupObjects&,
62  KigPart& doc, KigWidget&, NormalMode& m )
63 {
64  if ( menu == NormalModePopupObjects::ToplevelMenu )
65  {
66  kDebug() << "id: " << id;
67  if ( id == 0 )
68  {
69  doc.showHidden();
70  m.clearSelection();
71  return true;
72  }
73  id -= 1;
74  return false;
75  }
76  else if ( menu == NormalModePopupObjects::SetCoordinateSystemMenu )
77  {
78  if ( id >= mnumberofcoordsystems )
79  {
80  id -= mnumberofcoordsystems;
81  return false;
82  };
83  CoordinateSystem* sys = CoordinateSystemFactory::build( id );
84  assert( sys );
85  doc.history()->push( KigCommand::changeCoordSystemCommand( doc, sys ) );
86  m.clearSelection();
87  return true;
88  }
89  else return false;
90 }
popup.h
NormalModePopupObjects::part
KigPart & part()
Definition: popup.h:70
CoordinateSystemFactory::build
static CoordinateSystem * build(int which)
Definition: coordinate_system.cpp:535
CoordinateSystem
a CoordinateSystem is what the user sees: it is kept by KigPart to show the user a grid...
Definition: coordinate_system.h:60
NormalModePopupObjects::addInternalAction
QAction * addInternalAction(int menu, const QString &name, int id)
Definition: popup.cc:276
BuiltinDocumentActionsProvider::executeAction
bool executeAction(int menu, int &id, const std::vector< ObjectHolder * > &os, NormalModePopupObjects &popup, KigPart &doc, KigWidget &w, NormalMode &m)
try to execute the id'th action you added to menu menu in popup popup ( first is 0 )...
Definition: builtindocumentactionsprovider.cc:59
KigPart::document
const KigDocument & document() const
Definition: kig_part.cpp:989
NormalModePopupObjects::ToplevelMenu
Definition: popup.h:60
KigPart::history
QUndoStack * history()
Definition: kig_part.cpp:633
CoordinateSystemFactory::names
static QStringList names()
Definition: coordinate_system.cpp:527
NormalModePopupObjects
This is the popup menu that appears when you click on selected objects in NormalMode.
Definition: popup.h:46
KigWidget
This class is the real widget showing the document.
Definition: kig_view.h:50
KigCommand::changeCoordSystemCommand
static KigCommand * changeCoordSystemCommand(KigPart &doc, CoordinateSystem *s)
This creates directly a command to change the coordinate system to s .
Definition: kig_commands.cpp:118
builtindocumentactionsprovider.h
BuiltinDocumentActionsProvider::fillUpMenu
void fillUpMenu(NormalModePopupObjects &popup, int menu, int &nextfree)
This file is part of Kig, a KDE program for Interactive Geometry...
Definition: builtindocumentactionsprovider.cc:33
NormalMode::clearSelection
void clearSelection()
Definition: normal.cc:88
NormalModePopupObjects::SetCoordinateSystemMenu
Definition: popup.h:61
KigPart
This is a "Part".
Definition: kig_part.h:68
KigDocument::coordinateSystem
const CoordinateSystem & coordinateSystem() const
Definition: kig_document.cc:40
CoordinateSystem::id
virtual int id() const =0
NormalMode
Definition: normal.h:26
KigPart::showHidden
void showHidden()
Definition: kig_part.cpp:596
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