~librecad-dev/librecad/librecad

« back to all changes in this revision

Viewing changes to librecad/src/actions/rs_actionlayersfreezeall.cpp

  • Committer: Scott Howard
  • Date: 2014-02-21 19:07:55 UTC
  • Revision ID: showard@debian.org-20140221190755-csjax9wb146hgdq4
first commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** This file is part of the LibreCAD project, a 2D CAD program
 
4
**
 
5
** Copyright (C) 2010 R. van Twisk (librecad@rvt.dds.nl)
 
6
** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
 
7
**
 
8
**
 
9
** This file may be distributed and/or modified under the terms of the
 
10
** GNU General Public License version 2 as published by the Free Software
 
11
** Foundation and appearing in the file gpl-2.0.txt included in the
 
12
** packaging of this file.
 
13
**
 
14
** This program is distributed in the hope that it will be useful,
 
15
** but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
** GNU General Public License for more details.
 
18
**
 
19
** You should have received a copy of the GNU General Public License
 
20
** along with this program; if not, write to the Free Software
 
21
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
22
**
 
23
** This copyright notice MUST APPEAR in all copies of the script!
 
24
**
 
25
**********************************************************************/
 
26
 
 
27
#include "rs_actionlayersfreezeall.h"
 
28
 
 
29
#include <QAction>
 
30
#include "rs_graphic.h"
 
31
 
 
32
 
 
33
 
 
34
RS_ActionLayersFreezeAll::RS_ActionLayersFreezeAll(bool freeze,
 
35
        RS_EntityContainer& container,
 
36
        RS_GraphicView& graphicView)
 
37
        :RS_ActionInterface("Freeze all Layers",
 
38
                    container, graphicView) {
 
39
 
 
40
    this->freeze = freeze;
 
41
}
 
42
 
 
43
QAction* RS_ActionLayersFreezeAll::createGUIAction(RS2::ActionType type, QObject* /*parent*/) {
 
44
    QAction* action=NULL;
 
45
 
 
46
        if (type==RS2::ActionLayersFreezeAll) {
 
47
                // tr("Freeze all")
 
48
                action = new QAction(tr("&Hide all"),  NULL);
 
49
        //action->zetStatusTip(tr("Freeze all layers"));
 
50
                action->setIcon(QIcon(":/ui/hiddenblock.png"));
 
51
        }
 
52
        else if (type==RS2::ActionLayersDefreezeAll) {
 
53
                // tr("Defreeze all")
 
54
        action = new QAction(tr("&Show all"),   NULL);
 
55
        //action->zetStatusTip(tr("Defreeze all layers"));
 
56
                action->setIcon(QIcon(":/ui/visibleblock.png"));
 
57
        }
 
58
    return action;
 
59
}
 
60
 
 
61
 
 
62
void RS_ActionLayersFreezeAll::trigger() {
 
63
    RS_DEBUG->print("RS_ActionLayersFreezeAll::trigger");
 
64
    if (graphic!=NULL) {
 
65
        //RS_Layer* layer = graphic->getActiveLayer();
 
66
        graphic->freezeAllLayers(freeze);
 
67
    }
 
68
    finish(false);
 
69
}
 
70
 
 
71
 
 
72
 
 
73
void RS_ActionLayersFreezeAll::init(int status) {
 
74
    RS_ActionInterface::init(status);
 
75
    trigger();
 
76
}
 
77
 
 
78
// EOF