Skip to content

Commit 01d2dc2

Browse files
author
timlinux
committedApr 2, 2006
Removed popup label in vector and raster context menus.
Changed maptool to use bool isZoomTool() instead of toolName and updated dependent classes. git-svn-id: http://svn.osgeo.org/qgis/trunk@5130 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 0776750 commit 01d2dc2

17 files changed

+351
-222
lines changed
 

‎src/core/qgsgeometry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ bool QgsGeometry::intersects(QgsRect* r) const
13451345
geos::Geometry *geosRect = wktReader->read( qstrdup(rectwkt) );
13461346
if(geosGeom->intersects(geosRect))
13471347
{
1348-
returnval=true;
1348+
returnval=true;
13491349
}
13501350

13511351
delete geosGeom;

‎src/core/qgssearchstringparser.cc

Lines changed: 333 additions & 177 deletions
Large diffs are not rendered by default.

‎src/core/qgssearchstringparser.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/* A Bison parser, made by GNU Bison 1.875d. */
1+
/* A Bison parser, made by GNU Bison 2.1. */
22

33
/* Skeleton parser for Yacc-like parsing with Bison,
4-
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4+
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
55
66
This program is free software; you can redistribute it and/or modify
77
it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
1515
1616
You should have received a copy of the GNU General Public License
1717
along with this program; if not, write to the Free Software
18-
Foundation, Inc., 59 Temple Place - Suite 330,
19-
Boston, MA 02111-1307, USA. */
18+
Foundation, Inc., 51 Franklin Street, Fifth Floor,
19+
Boston, MA 02110-1301, USA. */
2020

2121
/* As a special exception, when this file is copied by Bison into a
2222
Bison output file, you may use that output file without restriction.
@@ -40,6 +40,7 @@
4040
UMINUS = 266
4141
};
4242
#endif
43+
/* Tokens. */
4344
#define NUMBER 258
4445
#define COMPARISON 259
4546
#define STRING 260
@@ -56,8 +57,8 @@
5657
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
5758
#line 60 "qgssearchstringparser.yy"
5859
typedef union YYSTYPE { QgsSearchTreeNode* node; double number; QgsSearchTreeNode::Operator op; } YYSTYPE;
59-
/* Line 1285 of yacc.c. */
60-
#line 61 "qgssearchstringparser.h"
60+
/* Line 1447 of yacc.c. */
61+
#line 62 "y.tab.h"
6162
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
6263
# define YYSTYPE_IS_DECLARED 1
6364
# define YYSTYPE_IS_TRIVIAL 1

‎src/gui/qgsmapcanvas.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,7 @@ void QgsMapCanvas::contentsMouseReleaseEvent(QMouseEvent * e)
666666
mMapTool->canvasReleaseEvent(e);
667667

668668
// right button was pressed in zoom tool? return to previous non zoom tool
669-
QString name = mMapTool->toolName();
670-
if (e->button() == Qt::RightButton && (name == MapTool_Zoom || name == MapTool_Pan))
669+
if (e->button() == Qt::RightButton && mMapTool->isZoomTool())
671670
{
672671
#ifdef QGISDEBUG
673672
std::cout << "Right click in map tool zoom or pan, last tool is " << (mLastNonZoomMapTool ? "not null." : "null.") << std::endl;
@@ -786,17 +785,13 @@ void QgsMapCanvas::setMapTool(QgsMapTool* tool)
786785
if (mMapTool)
787786
mMapTool->deactivate();
788787

789-
#ifdef QGISDEBUG
790-
std::cout << "setMapTool: using tool " <<
791-
(tool ? tool->toolName().toLocal8Bit().data() : "null") << std::endl;
792-
#endif
793788

794-
if (tool && (tool->toolName() == MapTool_Zoom || tool->toolName() == MapTool_Pan))
789+
if (tool && tool->isZoomTool() )
795790
{
796791
// if zoom or pan tool will be active, save old tool
797792
// to bring it back on right click
798793
// (but only if it wasn't also zoom or pan tool)
799-
if (mMapTool && mMapTool->toolName() != MapTool_Zoom && mMapTool->toolName() != MapTool_Pan)
794+
if (mMapTool && !mMapTool->isZoomTool())
800795
{
801796
delete mLastNonZoomMapTool;
802797
mLastNonZoomMapTool = mMapTool;

‎src/gui/qgsmaplayer.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,6 @@ void QgsMapLayer::initContextMenu(QgisApp * app)
529529
popMenu = new QMenu();
530530

531531
// Initialise and insert Qt4 QAction
532-
myPopupLabel = new QAction( popMenu );
533-
popMenu->addAction(myPopupLabel);
534-
535532
popMenu->addAction(tr("&Zoom to extent of selected layer"), app, SLOT(zoomToLayerExtent()));
536533
mShowInOverviewAction = popMenu->addAction(tr("Toggle in Overview"), app, SLOT(inOverview()));
537534
mShowInOverviewAction->setCheckable(true);

‎src/gui/qgsmaplayer.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,6 @@ public slots:
432432
//! context menu
433433
QMenu* popMenu;
434434

435-
//! header for popMenu
436-
QAction * myPopupLabel;
437-
438435
//! the action in popmenu that sets overview status
439436
QAction* mShowInOverviewAction;
440437

‎src/gui/qgsmaptool.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ class QgsMapTool
5555

5656
QAction* action() { return mAction; }
5757

58-
/** TODO change this method name to bool isZoomTool() ???? */
59-
virtual QString toolName() { return "generic tool"; }
58+
/** Check whether this MapTool performs a zoom or pan operation.
59+
* If it does, we will be able to perform the zoom and then
60+
* resume operations with the original / previously used tool.*/
61+
virtual bool isZoomTool() { return false;}
6062

6163
//! called when set as currently active map tool
6264
virtual void activate();

‎src/gui/qgsmaptoolcapture.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "qgsmaptool.h"
2121
#include "qgspoint.h"
2222

23-
#define MapTool_Capture "capture"
2423

2524
class QgsRubberBand;
2625

@@ -56,7 +55,6 @@ class QgsMapToolCapture : public QgsMapTool
5655
//! Resize rubber band
5756
virtual void renderComplete();
5857

59-
virtual QString toolName() { return MapTool_Capture; }
6058

6159
virtual void deactivate();
6260

‎src/gui/qgsmaptoolemitpoint.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#include "qgsmaptool.h"
2121

22-
#define MapTool_EmitPoint "emit point"
2322

2423
class QgsMapCanvas;
2524

@@ -38,7 +37,6 @@ class QgsMapToolEmitPoint : public QgsMapTool
3837
//! Overridden mouse release event
3938
virtual void canvasReleaseEvent(QMouseEvent * e);
4039

41-
virtual QString toolName() { return MapTool_EmitPoint; }
4240
};
4341

4442
#endif

‎src/gui/qgsmaptoolidentify.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
#include "qgsmaptool.h"
2121
#include "qgspoint.h"
2222

23-
#define MapTool_Identify "identify"
24-
2523
class QgsIdentifyResults;
2624
class QgsMessageViewer;
2725
class QgsMapLayer;
@@ -52,7 +50,6 @@ class QgsMapToolIdentify : public QgsMapTool
5250
//! Overridden mouse release event
5351
virtual void canvasReleaseEvent(QMouseEvent * e);
5452

55-
virtual QString toolName() { return MapTool_Identify; }
5653

5754
private:
5855

‎src/gui/qgsmaptoolpan.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "qgsmaptool.h"
2121
class QgsMapCanvas;
2222

23-
#define MapTool_Pan "pan"
2423

2524
class QgsMapToolPan : public QgsMapTool
2625
{
@@ -37,7 +36,7 @@ class QgsMapToolPan : public QgsMapTool
3736
//! Overridden mouse release event
3837
virtual void canvasReleaseEvent(QMouseEvent * e);
3938

40-
virtual QString toolName() { return MapTool_Pan; }
39+
virtual bool isZoomTool() { return true; }
4140

4241
private:
4342

‎src/gui/qgsmaptoolselect.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "qgsmaptool.h"
2121
#include <QRect>
2222

23-
#define MapTool_Select "select"
2423

2524
class QRubberBand;
2625
class QgsMapCanvas;
@@ -40,7 +39,6 @@ class QgsMapToolSelect : public QgsMapTool
4039
//! Overridden mouse release event
4140
virtual void canvasReleaseEvent(QMouseEvent * e);
4241

43-
virtual QString toolName() { return MapTool_Select; }
4442

4543
protected:
4644

‎src/gui/qgsmaptoolvertexedit.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
class QgsRubberBand;
2424
class QgsVertexMarker;
2525

26-
#define MapTool_VertexEdit "vertex edit"
27-
2826
class QgsMapToolVertexEdit : public QgsMapTool
2927
{
3028
public:
@@ -50,8 +48,6 @@ class QgsMapToolVertexEdit : public QgsMapTool
5048
//! Overridden mouse release event
5149
virtual void canvasReleaseEvent(QMouseEvent * e);
5250

53-
virtual QString toolName() { return MapTool_VertexEdit; }
54-
5551
virtual void deactivate();
5652

5753
private:

‎src/gui/qgsmaptoolzoom.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "qgsmaptool.h"
2121
#include <QRect>
2222

23-
#define MapTool_Zoom "zoom"
2423

2524
class QRubberBand;
2625

@@ -39,7 +38,7 @@ class QgsMapToolZoom : public QgsMapTool
3938
//! Overridden mouse release event
4039
virtual void canvasReleaseEvent(QMouseEvent * e);
4140

42-
virtual QString toolName() { return MapTool_Zoom; }
41+
virtual bool isZoomTool() { return true; }
4342

4443
protected:
4544
//! stores actual zoom rect

‎src/gui/qgsvectorlayer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,6 @@ QgsVectorLayerProperties *QgsVectorLayer::propertiesDialog()
12851285

12861286
void QgsVectorLayer::initContextMenu_(QgisApp * app)
12871287
{
1288-
myPopupLabel->setText( tr("Vector Layer") );
12891288

12901289
popMenu->addAction(tr("&Open attribute table"), app, SLOT(attributeTable()));
12911290

‎src/plugins/grass/qgsgrassedit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1931,7 +1931,7 @@ void QgsGrassEdit::mouseEventReceiverMove ( QgsPoint & newPoint )
19311931
std::cerr << "QgsGrassEdit::mouseEventReceiverMove() mTool = " << mTool << std::endl;
19321932
#endif
19331933

1934-
if ( mCanvas->mapTool()->toolName() != MapTool_EmitPoint) return;
1934+
if (!dynamic_cast<QgsMapToolEmitPoint *> (mCanvas->mapTool())) return;
19351935

19361936
statusBar()->message(mCanvasPrompt);
19371937

‎src/raster/qgsrasterlayer.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3768,8 +3768,6 @@ void QgsRasterLayer::initContextMenu_(QgisApp * theApp)
37683768
#if 0 //In qt4, inserting a slider in QMenu seems difficult
37693769
popMenu->setCheckable ( true );
37703770

3771-
myPopupLabel->setText( tr("<center><b>Raster Layer</b></center>") );
3772-
37733771
QLabel * myTransparencyLabel = new QLabel( popMenu );
37743772

37753773
myTransparencyLabel->setFrameStyle( Q3Frame::Panel | Q3Frame::Raised );
@@ -3793,7 +3791,6 @@ void QgsRasterLayer::initContextMenu_(QgisApp * theApp)
37933791

37943792
#endif //0
37953793

3796-
myPopupLabel->setText( tr("Raster Layer") );
37973794
popMenu->addAction(tr("&Convert to..."), this, SLOT(convertTo()));
37983795
} // QgsRasterLayer::initContextMenu
37993796

0 commit comments

Comments
 (0)
Please sign in to comment.