~ubuntu-branches/ubuntu/maverick/freecad/maverick

« back to all changes in this revision

Viewing changes to src/Gui/CommandView.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adam C. Powell, IV
  • Date: 2010-01-11 08:48:33 UTC
  • mfrom: (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100111084833-4g9vgdqbkw8u34zb
Tags: 0.9.2646.5-1
* New upstream version (closes: #561696).
* Added swig to Build-Depends (closes: #563523, #563772).
* Removed python-opencv from Build-Depends and Recommends (closes: #560768).

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
#ifndef _PreComp_
27
27
# include <sstream>
 
28
# include <Inventor/events/SoMouseButtonEvent.h>
 
29
# include <Inventor/nodes/SoOrthographicCamera.h>
 
30
# include <Inventor/nodes/SoPerspectiveCamera.h>
 
31
# include <QFile>
 
32
# include <QMessageBox>
 
33
# include <QTextStream>
28
34
#endif
29
35
 
30
36
#include "Command.h"
53
59
#include <Base/Reader.h>
54
60
#include <App/Document.h>
55
61
#include <App/GeoFeature.h>
 
62
#include <App/DocumentObjectGroup.h>
56
63
#include <App/MeasureDistance.h>
57
64
#include <App/Feature.h>
58
65
 
74
81
  sToolTipText  = QT_TR_NOOP("Switches to orthographic view mode");
75
82
  sWhatsThis    = "Std_OrthographicCamera";
76
83
  sStatusTip    = QT_TR_NOOP("Switches to orthographic view mode");
 
84
  sPixmap       = "view-isometric";
77
85
  iAccel        = Qt::Key_O;
78
86
}
79
87
 
120
128
  sToolTipText  = QT_TR_NOOP("Switches to perspective view mode");
121
129
  sWhatsThis    = "Std_PerspectiveCamera";
122
130
  sStatusTip    = QT_TR_NOOP("Switches to perspective view mode");
 
131
  sPixmap       = "view-perspective";
123
132
  iAccel        = Qt::Key_P;
124
133
}
125
134
 
503
512
    const std::vector<App::Document*> docs = App::GetApplication().getDocuments();
504
513
    for (std::vector<App::Document*>::const_iterator it = docs.begin(); it != docs.end(); ++it) {
505
514
        Document *pcDoc = Application::Instance->getDocument(*it);
506
 
        const std::vector<App::DocumentObject*> sel = Selection().getObjectsOfType
 
515
        std::vector<App::DocumentObject*> sel = Selection().getObjectsOfType
507
516
            (App::DocumentObject::getClassTypeId(), (*it)->getName());
508
 
        for(std::vector<App::DocumentObject*>::const_iterator ft=sel.begin();ft!=sel.end();ft++) {
 
517
 
 
518
        // in case a group object and an object of the group is selected then ignore the group object
 
519
        std::vector<App::DocumentObject*> ignore;
 
520
        for (std::vector<App::DocumentObject*>::iterator ft=sel.begin();ft!=sel.end();ft++) {
 
521
            if ((*ft)->getTypeId().isDerivedFrom(App::DocumentObjectGroup::getClassTypeId())) {
 
522
                App::DocumentObjectGroup* grp = static_cast<App::DocumentObjectGroup*>(*ft);
 
523
                std::vector<App::DocumentObject*> sub = grp->Group.getValues();
 
524
                for (std::vector<App::DocumentObject*>::iterator st = sub.begin(); st != sub.end(); ++st) {
 
525
                    if (std::find(sel.begin(), sel.end(), *st) != sel.end()) {
 
526
                        ignore.push_back(*ft);
 
527
                        break;
 
528
                    }
 
529
                }
 
530
            }
 
531
        }
 
532
 
 
533
        if (!ignore.empty()) {
 
534
            std::sort(sel.begin(), sel.end());
 
535
            std::sort(ignore.begin(), ignore.end());
 
536
            std::vector<App::DocumentObject*> diff;
 
537
            std::back_insert_iterator<std::vector<App::DocumentObject*> > biit(diff);
 
538
            std::set_difference(sel.begin(), sel.end(), ignore.begin(), ignore.end(), biit);
 
539
            sel = diff;
 
540
        }
 
541
 
 
542
        for (std::vector<App::DocumentObject*>::const_iterator ft=sel.begin();ft!=sel.end();ft++) {
509
543
            if (pcDoc && pcDoc->isShow((*ft)->getNameInDocument()))
510
544
                doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Visibility=False"
511
545
                             , (*it)->getName(), (*ft)->getNameInDocument());
1203
1237
{
1204
1238
  sGroup        = QT_TR_NOOP("Standard-View");
1205
1239
  sMenuText     = QT_TR_NOOP("Inventor example #2");
1206
 
  sToolTipText  = QT_TR_NOOP("Shows spheres an dragglights");
 
1240
  sToolTipText  = QT_TR_NOOP("Shows spheres and drag-lights");
1207
1241
  sWhatsThis    = "Std_ViewExamples";
1208
 
  sStatusTip    = QT_TR_NOOP("Shows spheres an dragglights");
 
1242
  sStatusTip    = QT_TR_NOOP("Shows spheres and drag-lights");
1209
1243
  sPixmap       = "Std_Tool2";
1210
1244
  iAccel        = 0;
1211
1245
}