1 /**********************************************************************************************
2 Copyright (C) 2014-2015 Oliver Eichler <oliver.eichler@gmx.de>
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 **********************************************************************************************/
18
19 #include "gis/CGisDraw.h"
20 #include "mouse/CMouseAdapter.h"
21 #include "mouse/CMousePrint.h"
22 #include "mouse/CScrOptPrint.h"
23 #include "print/CPrintDialog.h"
24
25 #include <QtWidgets>
26
CMousePrint(CGisDraw * gis,CCanvas * canvas,CMouseAdapter * mouse)27 CMousePrint::CMousePrint(CGisDraw* gis, CCanvas* canvas, CMouseAdapter* mouse)
28 : IMouseSelect(gis, canvas, mouse)
29 {
30 cursor = QCursor(QPixmap("://cursors/cursorSave.png"), 0, 0);
31
32 canvas->reportStatus("IMouseSelect",
33 tr(
34 "<b>Save(Print) Map</b><br/>Select a rectangular area on the map. "
35 "Use the left mouse button and move the mouse. Abort with a right "
36 "click. Adjust the selection by point-click-move on the corners.")
37 );
38
39 CScrOptPrint* scrOptPrint;
40 scrOpt = scrOptPrint = new CScrOptPrint(this);
41
42 connect(scrOptPrint->toolSave, &QToolButton::clicked, this, &CMousePrint::slotSave);
43 connect(scrOptPrint->toolPrint, &QToolButton::clicked, this, &CMousePrint::slotPrint);
44 }
45
~CMousePrint()46 CMousePrint::~CMousePrint()
47 {
48 }
49
slotSave()50 void CMousePrint::slotSave()
51 {
52 CPrintDialog dlg(CPrintDialog::eTypeImage, rectSelection, canvas);
53 dlg.exec();
54 canvas->resetMouse();
55 canvas->slotTriggerCompleteUpdate(CCanvas::eRedrawAll);
56
57 canvas->resetMouse();
58 }
59
slotPrint()60 void CMousePrint::slotPrint()
61 {
62 CPrintDialog dlg(CPrintDialog::eTypePrint, rectSelection, canvas);
63 dlg.exec();
64 canvas->resetMouse();
65 canvas->slotTriggerCompleteUpdate(CCanvas::eRedrawAll);
66
67 canvas->resetMouse();
68 }
69
70