X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ComputeDlg.cxx;h=875eb675d5d59141c306af78227de61a8ebcd293;hp=2d236261798dd734b4cf79ad13ea39322fca0fcc;hb=9493563cbc59acba2b9b036bb22fb184f5be946d;hpb=88068fce89e10cb32b60ea51cae3440240d42e9f diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index 2d2362617..875eb675d 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -23,21 +23,20 @@ // #include "SMESHGUI_ComputeDlg.h" +#include "SMDS_Mesh.hxx" +#include "SMDS_SetIterator.hxx" #include "SMESHGUI.h" #include "SMESHGUI_GEOMGenUtils.h" -#include "SMESHGUI_MeshUtils.h" -#include "SMESHGUI_VTKUtils.h" -#include "SMESHGUI_MeshInfosBox.h" #include "SMESHGUI_HypothesesUtils.h" #include "SMESHGUI_MeshEditPreview.h" -#include "SMESHGUI_MeshOrderOp.h" +#include "SMESHGUI_MeshInfosBox.h" #include "SMESHGUI_MeshOrderDlg.h" - +#include "SMESHGUI_MeshOrderOp.h" +#include "SMESHGUI_MeshUtils.h" +#include "SMESHGUI_VTKUtils.h" +#include "SMESH_Actor.h" #include "SMESH_ActorUtils.h" -#include -#include - // SALOME GEOM includes #include #include @@ -46,36 +45,37 @@ // SALOME GUI includes #include #include +#include #include -#include +#include +#include +#include +#include +#include #include +#include #include -#include -#include -#include -#include -#include // SALOME KERNEL includes #include #include #include +#include "utilities.h" #include CORBA_SERVER_HEADER(SMESH_Group) // OCCT includes +#include +#include #include +#include +#include #include #include +#include #include #include -#include -#include -#include -#include -#include - #include // Qt includes @@ -91,6 +91,7 @@ #include #include #include +#include // VTK includes #include @@ -99,25 +100,15 @@ #include #include +#ifndef WIN32 +#include +#endif + #define SPACING 6 #define MARGIN 11 #define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" ) -/* OBSOLETE -static void addSeparator( QWidget* parent ) -{ - QGridLayout* l = qobject_cast( parent->layout() ); - int row = l->rowCount(); - int cols = l->columnCount(); - for ( int i = 0; i < cols; i++ ) { - QFrame* hline = new QFrame( parent ); - hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); - l->addWidget( hline, row, i ); - } -} -*/ - enum TCol { COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, COL_BAD_MESH, NB_COLUMNS }; @@ -206,6 +197,7 @@ namespace SMESH void Show( int subShapeID, GEOM::GEOM_Object_var aMainShape, bool only = false) { SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( SMESHGUI::GetSMESHGUI() ); + SUIT_ResourceMgr* resMgr = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() ); std::string mainEntry; if ( !aMainShape->_is_nil() ) mainEntry = aMainShape->GetStudyEntry(); @@ -234,8 +226,13 @@ namespace SMESH TopAbs_ShapeEnum type( aShape.ShapeType() >= TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE ); for ( TopExp_Explorer exp( aShape, type ); exp.More(); exp.Next() ) { //checkTriangulation( exp.Current() ); - if ( GEOM_Actor* anActor = getActor( exp.Current() )) + if ( GEOM_Actor* anActor = getActor( exp.Current() ) ) { + int UNbIsos = resMgr->integerValue( "Geometry", "iso_number_u", 1); + int VNbIsos = resMgr->integerValue( "Geometry", "iso_number_v", 1); + int aNbIsos[2] = { UNbIsos ? UNbIsos : 1, VNbIsos ? VNbIsos : 1 }; + anActor->SetNbIsos( aNbIsos ); myShownActors.push_back( anActor ); + } } if ( type == TopAbs_FACE ) { for ( TopExp_Explorer exp( aShape, TopAbs_EDGE ); exp.More(); exp.Next() ) { @@ -351,12 +348,14 @@ namespace SMESH CASE2TEXT( COMPERR_BAD_SHAPE ); CASE2TEXT( COMPERR_CANCELED ); CASE2TEXT( COMPERR_NO_MESH_ON_SHAPE ); + CASE2TEXT( COMPERR_BAD_PARMETERS ); case SMESH::COMPERR_ALGO_FAILED: if ( strlen(comment) == 0 ) text = QObject::tr("COMPERR_ALGO_FAILED"); break; case SMESH::COMPERR_WARNING: - return comment ? QString(comment) : QObject::tr("COMPERR_UNKNOWN"); + text = QObject::tr( (comment && strlen(comment)) ? "COMPERR_WARNING" : "COMPERR_UNKNOWN"); + break; default: text = QString("#%1").arg( -errCode ); } @@ -382,7 +381,11 @@ namespace SMESH if ( !geom->_is_nil() ) { GEOM::ListOfLong_var list = geom->GetSubShapeIndices(); if ( list->length() == 1 && list[0] == subShapeID ) - subSO = it->Value(); + { + GEOM::GEOM_Object_var mainGO = geom->GetMainShape(); + if ( aMainShape->IsSame( mainGO )) + subSO = it->Value(); + } } } } @@ -439,8 +442,10 @@ namespace SMESH QString shapeText(int subShapeID, GEOM::GEOM_Object_var aMainShape ) { QString text; - if ( _PTR(SObject) aSO = getSubShapeSO( subShapeID, aMainShape )) - text = aSO->GetName().c_str(); + if ( _PTR(SObject) aSO = getSubShapeSO( subShapeID, aMainShape )) { + text = aSO->GetName().c_str(); + text += QString(" (%1)").arg( aSO->GetID().c_str() ); + } else { text = QString("#%1").arg( subShapeID ); GEOM::GEOM_Object_wrap shape = getSubShape( subShapeID, aMainShape ); @@ -482,7 +487,7 @@ namespace SMESH //======================================================================= SMESHGUI_ComputeDlg::SMESHGUI_ComputeDlg( QWidget* parent, bool ForEval ) - : SMESHGUI_Dialog( parent, false, true, Close/* | Help*/ ) + : SMESHGUI_Dialog( parent, false, true, Close | Help ) { QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame()); aDlgLay->setMargin( 0 ); @@ -613,8 +618,8 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent, bool ForEval) // add all widgets to aFrame QVBoxLayout* aLay = new QVBoxLayout(aFrame); - aLay->setMargin( 0 ); - aLay->setSpacing( 0 ); + aLay->setMargin( MARGIN ); + aLay->setSpacing( SPACING ); aLay->addWidget( aPixGrp ); aLay->addWidget( nameBox ); aLay->addWidget( myBriefInfo ); @@ -739,25 +744,39 @@ SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget qthread(gen, mesh, mainShape) { // -- - setWindowTitle(tr("Compute")); + setWindowTitle(tr("TITLE")); setMinimumWidth( 200 ); - cancelButton = new QPushButton(tr("Cancel")); + cancelButton = new QPushButton(tr("CANCEL")); cancelButton->setDefault(true); + cancelButton->setCheckable(true); QLabel * nbNodesName = new QLabel(tr("SMESH_MESHINFO_NODES"), this ); QLabel * nbElemsName = new QLabel(tr("SMESH_MESHINFO_ELEMENTS"), this ); nbNodesLabel = new QLabel("0", this ); nbElemsLabel = new QLabel("0", this ); +#ifndef WIN32 + QLabel * freeRAMName = new QLabel(tr("SMESH_FREERAM"), this ); + freeRAMLabel = new QLabel("", this ); +#endif + progressBar = new QProgressBar(this); + progressBar->setMinimum( 0 ); + progressBar->setMaximum( 1000 ); QGridLayout* layout = new QGridLayout(this); layout->setMargin( MARGIN ); layout->setSpacing( SPACING ); - layout->addWidget(nbNodesName, 0, 0); - layout->addWidget(nbNodesLabel, 0, 1); - layout->addWidget(nbElemsName, 1, 0); - layout->addWidget(nbElemsLabel, 1, 1); - layout->addWidget(cancelButton, 2, 0, 1, 2); + int row = 0; + layout->addWidget(nbNodesName, row, 0); + layout->addWidget(nbNodesLabel, row++, 1); + layout->addWidget(nbElemsName, row, 0); + layout->addWidget(nbElemsLabel, row++, 1); +#ifndef WIN32 + layout->addWidget(freeRAMName, row, 0); + layout->addWidget(freeRAMLabel, row++, 1); +#endif + layout->addWidget(progressBar, row++, 0, 1, 2); + layout->addWidget(cancelButton, row++, 0, 1, 2); adjustSize(); update(); @@ -775,23 +794,40 @@ bool SMESHGUI_ComputeDlg_QThreadQDialog::result() void SMESHGUI_ComputeDlg_QThreadQDialog::onCancel() { qthread.cancel(); -} + cancelButton->setText( tr("CANCELING")); + cancelButton->setEnabled(false); +} void SMESHGUI_ComputeDlg_QThreadQDialog::timerEvent(QTimerEvent *event) { + if ( !cancelButton->isChecked() ) // not yet cancelled + progressBar->setValue( progressBar->maximum() * qthread.getMesh()->GetComputeProgress() ); + if(qthread.isFinished()) - { - close(); - } - nbNodesLabel->setText( QString("%1").arg( qthread.getMesh()->NbNodes() )); - nbElemsLabel->setText( QString("%1").arg( qthread.getMesh()->NbElements() )); + { + close(); + } + else + { + nbNodesLabel->setText( QString("%1").arg( qthread.getMesh()->NbNodes() )); + nbElemsLabel->setText( QString("%1").arg( qthread.getMesh()->NbElements() )); +#ifndef WIN32 + struct sysinfo si; + const int err = sysinfo( &si ); + if ( err ) + freeRAMLabel->setText(""); + else + freeRAMLabel->setText( tr("SMESH_GIGABYTE").arg + ( si.freeram * si.mem_unit /1024./1024./1024., 0, 'f', 2 )); +#endif + } event->accept(); } void SMESHGUI_ComputeDlg_QThreadQDialog::closeEvent(QCloseEvent *event) { if(qthread.isRunning()) - { + { event->ignore(); return; } @@ -838,13 +874,9 @@ void SMESHGUI_BaseComputeOp::computeMesh() #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; #endif - bool res; SMESHGUI_ComputeDlg_QThreadQDialog qthreaddialog(desktop(), gen, myMesh, myMainShape); qthreaddialog.exec(); - res = qthreaddialog.result(); - res = gen->Compute(myMesh, myMainShape); - if (res) - computeFailed = false; + computeFailed = !qthreaddialog.result(); } catch(const SALOME::SALOME_Exception & S_ex) { memoryLack = true; @@ -868,42 +900,108 @@ void SMESHGUI_BaseComputeOp::computeMesh() // NPAL16631: if ( !memoryLack ) { - SMESH::ModifiedMesh(aMeshSObj, !computeFailed, myMesh->NbNodes() == 0); + SMESH::ModifiedMesh( aMeshSObj, + !computeFailed && aHypErrors.isEmpty(), + myMesh->NbNodes() == 0); update( UF_ObjBrowser | UF_Model ); // SHOW MESH // NPAL16631: if ( getSMESHGUI()->automaticUpdate() ) SUIT_ResourceMgr* resMgr = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() ); - long newSize = myMesh->NbElements(); bool limitExceeded; + long limitSize = resMgr->integerValue( "SMESH", "update_limit", 500000 ); + int entities = SMESH_Actor::eAllEntity; + int hidden = 0; + long nbElements = 0; if ( !memoryLack ) { - if ( getSMESHGUI()->automaticUpdate( newSize, &limitExceeded ) ) - { - try { + // List of objects that will be updated automatically + QList< QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) > > aListToUpdate; + SMESH::SMESH_IDSource_var aMeshObj = SMESH::SObjectToInterface( aMeshSObj ); + // put Mesh into list + aListToUpdate.append( QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) >(aMeshObj, aMeshSObj) ); + SMESH::submesh_array_var aSubMeshes = myMesh->GetSubMeshes(); + // put SubMeshes into list + for ( int i = 0; i < aSubMeshes->length(); i++ ) { + SMESH::SMESH_subMesh_var sm = aSubMeshes[i]; + if ( CORBA::is_nil( sm ) ) continue; + _PTR(SObject) smSObj = SMESH::ObjectToSObject( sm ); + if ( !smSObj ) continue; + SMESH::SMESH_IDSource_var aSubMeshObj = SMESH::SObjectToInterface( smSObj ); + aListToUpdate.append( QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) >(aSubMeshObj, smSObj) ); + } + // put Groups into list + SMESH::ListOfGroups_var aGroups = myMesh->GetGroups(); + for ( size_t i = 0; i < aGroups->length(); ++i ) { + SMESH::SMESH_GroupBase_var aGrp = aGroups[i]; + if ( CORBA::is_nil( aGrp ) ) continue; + SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp ); + SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp ); + SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp ); + if ( !aStdGroup->_is_nil() ) continue; // don't update the standalone groups + _PTR(SObject) aGroupSO = SMESH::FindSObject( aGrp ); + if ( !aGroupSO ) continue; + SMESH::SMESH_IDSource_var aGroupObj = SMESH::SObjectToInterface( aGroupSO ); + aListToUpdate.append( QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) >(aGroupObj, aGroupSO) ); + } + + // update mesh, sub-mesh and groups, if it's possible + QList< QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) > >::iterator anIter; + for( anIter = aListToUpdate.begin(); anIter != aListToUpdate.end(); anIter++ ) { + SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( (*anIter).second )); + if ( getSMESHGUI()->automaticUpdate( (*anIter).first, &entities, &limitExceeded, &hidden, &nbElements ) ) + { + try { #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; + OCC_CATCH_SIGNALS; #endif - SMESH::Update(myIObject, true); - } - catch (...) { + bool toDisplay = false; + + if ( !aMesh->_is_nil() ) { // display a mesh only + toDisplay = true; + SMESH_Actor *anActor = SMESH::FindActorByObject( aMesh ); + if ( !anActor ) anActor = SMESH::CreateActor( (*anIter).second->GetStudy(), (*anIter).second->GetID().c_str(), true ); + if ( anActor ) // actor is not created for an empty mesh + { + anActor->SetEntityMode( entities ); + SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor ); + } + } + Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject + ( (*anIter).second->GetID().c_str(), "SMESH", (*anIter).second->GetName().c_str() ); + SMESH::Update(anIO, toDisplay); + + if ( limitExceeded && !aMesh->_is_nil() ) + { + QStringList hiddenMsg; + if ( hidden & SMESH_Actor::e0DElements ) hiddenMsg << tr( "SMESH_ELEMS0D" ); + if ( hidden & SMESH_Actor::eEdges ) hiddenMsg << tr( "SMESH_EDGES" ); + if ( hidden & SMESH_Actor::eFaces ) hiddenMsg << tr( "SMESH_FACES" ); + if ( hidden & SMESH_Actor::eVolumes ) hiddenMsg << tr( "SMESH_VOLUMES" ); + if ( hidden & SMESH_Actor::eBallElem ) hiddenMsg << tr( "SMESH_BALLS" ); + SUIT_MessageBox::warning( desktop(), + tr( "SMESH_WRN_WARNING" ), + tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).arg( nbElements ).arg( limitSize ).arg( hiddenMsg.join(", ") ) ); + } + } + catch (...) { #ifdef _DEBUG_ - MESSAGE ( "Exception thrown during mesh visualization" ); + MESSAGE ( "Exception thrown during mesh visualization" ); #endif - if ( SMDS_Mesh::CheckMemory(true) ) { // has memory to show warning? - SMESH::OnVisuException(); - } - else { - memoryLack = true; + if ( SMDS_Mesh::CheckMemory(true) ) { // has memory to show warning? + SMESH::OnVisuException(); + } + else { + memoryLack = true; + } } } - } - else if ( limitExceeded ) - { - long limitSize = resMgr->integerValue( "SMESH", "update_limit", 500000 ); - SUIT_MessageBox::warning( desktop(), - tr( "SMESH_WRN_WARNING" ), - tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ).arg( newSize ).arg( limitSize ) ); + else if ( limitExceeded && !aMesh->_is_nil() ) + { + SUIT_MessageBox::warning( desktop(), + tr( "SMESH_WRN_WARNING" ), + tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ).arg( nbElements ).arg( limitSize ) ); + } } } LightApp_SelectionMgr *Sel = selectionMgr(); @@ -1123,6 +1221,7 @@ void SMESHGUI_BaseComputeOp::onPublishShape() GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); SALOMEDS::Study_var study = SMESHGUI::GetSMESHGen()->GetCurrentStudy(); + QStringList entryList; QList rows; SMESH::getSelectedRows( table(), rows ); int row; @@ -1143,7 +1242,8 @@ void SMESHGUI_BaseComputeOp::onPublishShape() if ( so->_is_nil() ) { CORBA::String_var name = so->GetName(); CORBA::String_var entry = so->GetID(); - table()->item( r, COL_SHAPE )->setText( name.in() ); + QString shapeText = QString("%1 (%2)").arg( name.in() ).arg( entry.in() ); + table()->item( r, COL_SHAPE )->setText( shapeText ); table()->item( r, COL_PUBLISHED )->setText( entry.in() ); } break; @@ -1156,12 +1256,16 @@ void SMESHGUI_BaseComputeOp::onPublishShape() if ( !so->_is_nil() ) { CORBA::String_var name = so->GetName(); CORBA::String_var entry = so->GetID(); - table()->item( row, COL_SHAPE )->setText( name.in() ); + QString shapeText = QString("%1 (%2)").arg( name.in() ).arg( entry.in() ); + table()->item( row, COL_SHAPE )->setText( shapeText ); table()->item( row, COL_PUBLISHED )->setText( entry.in() ); + entryList.push_back( entry.in() ); } } } getSMESHGUI()->getApp()->updateObjectBrowser(); + getSMESHGUI()->getApp()->browseObjects( entryList, /*isApplyAndClose=*/true ); + currentCellChanged(); // to update buttons } @@ -1274,6 +1378,7 @@ void SMESHGUI_BaseComputeOp::currentCellChanged() myCompDlg->myPublishBtn->setEnabled( publishEnable ); myCompDlg->myShowBtn ->setEnabled( showEnable ); myCompDlg->myBadMeshBtn->setEnabled( hasBadMesh && ( nbSelected == 1 )); + myCompDlg->myBadMeshToGroupBtn->setEnabled( hasBadMesh && ( nbSelected == 1 )); } //================================================================================ @@ -1377,6 +1482,7 @@ QTableWidget* SMESHGUI_BaseComputeOp::table() SMESHGUI_ComputeOp::SMESHGUI_ComputeOp() : SMESHGUI_BaseComputeOp() { + myHelpFileName = "constructing_meshes_page.html#compute_anchor"; } @@ -1446,7 +1552,6 @@ SMESHGUI_PrecomputeOp::SMESHGUI_PrecomputeOp() myActiveDlg( 0 ), myPreviewDisplayer( 0 ) { - myHelpFileName = "constructing_meshes_page.html#preview_mesh_anchor"; } //================================================================================ @@ -1487,6 +1592,8 @@ LightApp_Dialog* SMESHGUI_PrecomputeOp::dlg() const void SMESHGUI_PrecomputeOp::startOperation() { + myHelpFileName = "constructing_meshes_page.html#preview_anchor"; // other anchor onCompute() + if ( !myDlg ) { myDlg = new SMESHGUI_PrecomputeDlg( desktop() ); @@ -1673,6 +1780,7 @@ void SMESHGUI_PrecomputeOp::onCompute() myOrderMgr->SetMeshOrder(); myMapShapeId.clear(); myActiveDlg = computeDlg(); + myHelpFileName = "constructing_meshes_page.html#compute_anchor"; computeMesh(); } @@ -1745,19 +1853,19 @@ void SMESHGUI_PrecomputeOp::onPreview() if (myOrderMgr && myOrderMgr->IsOrderChanged()) myOrderMgr->SetMeshOrder(); - // Compute preview of mesh, + // Compute preview of mesh, // i.e. compute mesh till indicated dimension int dim = myDlg->getPreviewMode(); - + SMESH::MemoryReserve aMemoryReserve; - + SMESH::compute_error_array_var aCompErrors; QString aHypErrors; bool computeFailed = true, memoryLack = false; SMESHGUI_ComputeDlg* aCompDlg = computeDlg(); - aCompDlg->myMeshName->setText( aMeshSObj->GetName().c_str() ); + aCompDlg->myMeshName->setText( aMeshSObj->GetName().c_str() ); SMESHGUI* gui = getSMESHGUI(); SMESH::SMESH_Gen_var gen = gui->GetSMESHGen(); @@ -1940,6 +2048,7 @@ SMESHGUI_MeshOrderBox* SMESHGUI_PrecomputeDlg::getMeshOrderBox() const SMESHGUI_EvaluateOp::SMESHGUI_EvaluateOp() : SMESHGUI_BaseComputeOp() { + myHelpFileName = "constructing_meshes_page.html#evaluate_anchor"; } @@ -2170,10 +2279,15 @@ void SMESHGUI_BaseComputeOp::showEvaluateResult(const SMESH::long_array& theRes, tbl->setWordWrap( true ); if ( hasBadMesh ) + { aCompDlg->myBadMeshBtn->show(); + aCompDlg->myBadMeshToGroupBtn->show(); + } else + { aCompDlg->myBadMeshBtn->hide(); - + aCompDlg->myBadMeshToGroupBtn->hide(); + } tbl->setCurrentCell(0,0); currentCellChanged(); // to update buttons }