@@ -69,7 +69,6 @@ QgsGrassPlugin::QgsGrassPlugin( QgisInterface * theQgisInterFace )
69
69
, qGisInterface( theQgisInterFace )
70
70
, mCanvas( 0 )
71
71
, mRegionAction( 0 )
72
- , mRegion( 0 )
73
72
, mRegionBand( 0 )
74
73
, mTools( 0 )
75
74
, mNewMapset( 0 )
@@ -78,7 +77,6 @@ QgsGrassPlugin::QgsGrassPlugin( QgisInterface * theQgisInterFace )
78
77
, mNewMapsetAction( 0 )
79
78
, mCloseMapsetAction( 0 )
80
79
, mOpenToolsAction( 0 )
81
- , mEditRegionAction( 0 )
82
80
, mEditAction( 0 )
83
81
, mNewVectorAction( 0 )
84
82
{
@@ -135,7 +133,6 @@ void QgsGrassPlugin::initGui()
135
133
mToolBarPointer = 0 ;
136
134
mTools = 0 ;
137
135
mNewMapset = 0 ;
138
- mRegion = 0 ;
139
136
140
137
QSettings settings;
141
138
QgsGrass::init ();
@@ -169,9 +166,6 @@ void QgsGrassPlugin::initGui()
169
166
mRegionAction ->setWhatsThis ( tr ( " Displays the current GRASS region as a rectangle on the map canvas" ) );
170
167
mRegionAction ->setCheckable ( true );
171
168
172
- mEditRegionAction = new QAction ( QIcon (), tr ( " Edit Current Grass Region" ), this );
173
- mEditRegionAction ->setObjectName ( " mEditRegionAction" );
174
- mEditRegionAction ->setWhatsThis ( tr ( " Edit the current GRASS region" ) );
175
169
mEditAction = new QAction ( QIcon (), tr ( " Edit Grass Vector layer" ), this );
176
170
mEditAction ->setObjectName ( " mEditAction" );
177
171
mEditAction ->setWhatsThis ( tr ( " Edit the currently selected GRASS vector layer." ) );
@@ -183,7 +177,6 @@ void QgsGrassPlugin::initGui()
183
177
connect ( mEditAction , SIGNAL ( triggered () ), this , SLOT ( edit () ) );
184
178
connect ( mNewVectorAction , SIGNAL ( triggered () ), this , SLOT ( newVector () ) );
185
179
connect ( mRegionAction , SIGNAL ( toggled ( bool ) ), this , SLOT ( switchRegion ( bool ) ) );
186
- connect ( mEditRegionAction , SIGNAL ( triggered () ), this , SLOT ( changeRegion () ) );
187
180
connect ( mOpenMapsetAction , SIGNAL ( triggered () ), this , SLOT ( openMapset () ) );
188
181
connect ( mNewMapsetAction , SIGNAL ( triggered () ), this , SLOT ( newMapset () ) );
189
182
connect ( mCloseMapsetAction , SIGNAL ( triggered () ), this , SLOT ( closeMapset () ) );
@@ -196,7 +189,6 @@ void QgsGrassPlugin::initGui()
196
189
qGisInterface->addPluginToMenu ( tr ( " &GRASS" ), mEditAction );
197
190
qGisInterface->addPluginToMenu ( tr ( " &GRASS" ), mOpenToolsAction );
198
191
qGisInterface->addPluginToMenu ( tr ( " &GRASS" ), mRegionAction );
199
- qGisInterface->addPluginToMenu ( tr ( " &GRASS" ), mEditRegionAction );
200
192
201
193
// Add the toolbar to the main window
202
194
mToolBarPointer = qGisInterface->addToolBar ( tr ( " GRASS" ) );
@@ -211,7 +203,6 @@ void QgsGrassPlugin::initGui()
211
203
mToolBarPointer ->addAction ( mEditAction );
212
204
mToolBarPointer ->addAction ( mOpenToolsAction );
213
205
mToolBarPointer ->addAction ( mRegionAction );
214
- mToolBarPointer ->addAction ( mEditRegionAction );
215
206
216
207
// Set icons to current theme
217
208
setCurrentTheme ( " " );
@@ -226,6 +217,7 @@ void QgsGrassPlugin::initGui()
226
217
this , SLOT ( setEditAction () ) );
227
218
228
219
connect ( QgsGrass::instance (), SIGNAL ( mapsetChanged () ), SLOT ( mapsetChanged () ) );
220
+ connect ( QgsGrass::instance (), SIGNAL ( regionChanged () ), SLOT ( displayRegion () ) );
229
221
connect ( QgsGrass::instance (), SIGNAL ( regionPenChanged () ), SLOT ( displayRegion () ) );
230
222
231
223
mapsetChanged ();
@@ -241,15 +233,13 @@ void QgsGrassPlugin::mapsetChanged()
241
233
if ( !QgsGrass::activeMode () )
242
234
{
243
235
mRegionAction ->setEnabled ( false );
244
- mEditRegionAction ->setEnabled ( false );
245
236
mRegionBand ->reset ();
246
237
mCloseMapsetAction ->setEnabled ( false );
247
238
mNewVectorAction ->setEnabled ( false );
248
239
}
249
240
else
250
241
{
251
242
mRegionAction ->setEnabled ( true );
252
- mEditRegionAction ->setEnabled ( true );
253
243
mCloseMapsetAction ->setEnabled ( true );
254
244
mNewVectorAction ->setEnabled ( true );
255
245
@@ -458,15 +448,19 @@ void QgsGrassPlugin::postRender( QPainter *painter )
458
448
459
449
void QgsGrassPlugin::displayRegion ()
460
450
{
461
- // QgsDebugMsg("entered." );
451
+ QgsDebugMsg ( " entered" );
462
452
463
453
mRegionBand ->reset ();
464
454
if ( !mRegionAction ->isChecked () )
455
+ {
465
456
return ;
457
+ }
466
458
467
459
// Display region of current mapset if in active mode
468
460
if ( !QgsGrass::activeMode () )
461
+ {
469
462
return ;
463
+ }
470
464
471
465
struct Cell_head window;
472
466
try
@@ -512,29 +506,6 @@ void QgsGrassPlugin::redrawRegion()
512
506
displayRegion ();
513
507
}
514
508
515
- void QgsGrassPlugin::changeRegion ( void )
516
- {
517
- // QgsDebugMsg("entered.");
518
-
519
- if ( mRegion ) // running
520
- {
521
- mRegion ->show ();
522
- return ;
523
- }
524
-
525
- // Warning: don't use Qt::WType_Dialog, it would ignore restorePosition
526
- mRegion = new QgsGrassRegion ( this , qGisInterface, qGisInterface->mainWindow () );
527
-
528
- connect ( mRegion , SIGNAL ( destroyed ( QObject * ) ), this , SLOT ( regionClosed () ) );
529
-
530
- mRegion ->show ();
531
- }
532
-
533
- void QgsGrassPlugin::regionClosed ()
534
- {
535
- mRegion = 0 ;
536
- }
537
-
538
509
void QgsGrassPlugin::openMapset ()
539
510
{
540
511
// QgsDebugMsg("entered.");
@@ -647,7 +618,6 @@ void QgsGrassPlugin::unload()
647
618
qGisInterface->removePluginMenu ( tr ( " &GRASS" ), mCloseMapsetAction );
648
619
qGisInterface->removePluginMenu ( tr ( " &GRASS" ), mOpenToolsAction );
649
620
qGisInterface->removePluginMenu ( tr ( " &GRASS" ), mRegionAction );
650
- qGisInterface->removePluginMenu ( tr ( " &GRASS" ), mEditRegionAction );
651
621
qGisInterface->removePluginMenu ( tr ( " &GRASS" ), mEditAction );
652
622
qGisInterface->removePluginMenu ( tr ( " &GRASS" ), mNewVectorAction );
653
623
@@ -656,7 +626,6 @@ void QgsGrassPlugin::unload()
656
626
delete mCloseMapsetAction ;
657
627
delete mOpenToolsAction ;
658
628
delete mRegionAction ;
659
- delete mEditRegionAction ;
660
629
delete mEditAction ;
661
630
delete mNewVectorAction ;
662
631
@@ -690,7 +659,6 @@ void QgsGrassPlugin::setCurrentTheme( QString theThemeName )
690
659
691
660
mRegionAction ->setIcon ( getThemeIcon ( " grass_region.png" ) );
692
661
693
- mEditRegionAction ->setIcon ( getThemeIcon ( " grass_region_edit.png" ) );
694
662
mEditAction ->setIcon ( getThemeIcon ( " grass_edit.png" ) );
695
663
mNewVectorAction ->setIcon ( getThemeIcon ( " grass_new_vector_layer.png" ) );
696
664
}
0 commit comments