diff --git a/aten.kdevelop b/aten.kdevelop index f471278e7..f8c62bc8f 100644 --- a/aten.kdevelop +++ b/aten.kdevelop @@ -10,8 +10,8 @@ aten . false - - + + kdevsubversion @@ -57,20 +57,20 @@ true - false + true 4 false - + 4 libtool - - - - + + + + true false false @@ -179,7 +179,7 @@ false - + set m_,_ theValue diff --git a/aten.spec b/aten.spec index 98b81c8a1..eb8766d17 100644 --- a/aten.spec +++ b/aten.spec @@ -30,7 +30,7 @@ BuildRoot : %{_tmppath}/%{fullname} # Boolean that specifies if you want to automatically determine some # dependencies. -AutoReqProv: no +AutoReqProv: yes # In-depth description. %description diff --git a/src/base/master.cpp b/src/base/master.cpp index 6f04e5745..44e84e24e 100644 --- a/src/base/master.cpp +++ b/src/base/master.cpp @@ -75,7 +75,7 @@ void Master::clear() // Set the active model void Master::setCurrentModel(Model *m) { - dbgBegin(Debug::Calls,"master::setCurrentModel"); + dbgBegin(Debug::Calls,"Master::setCurrentModel"); // Set current.m and tell the mainview canvas to display it current.m = m; // Set other Bundle objects based on model @@ -83,8 +83,8 @@ void Master::setCurrentModel(Model *m) current.i = NULL; current.m->calculateViewMatrix(); current.m->projectAll(); - gui.refresh(); - dbgEnd(Debug::Calls,"master::setCurrentModel"); + gui.updateModelLists(); + dbgEnd(Debug::Calls,"Master::setCurrentModel"); } /* @@ -130,13 +130,13 @@ int Master::nModels() const // Add model Model *Master::addModel() { - dbgBegin(Debug::Calls,"master::addModel"); + dbgBegin(Debug::Calls,"Master::addModel"); current.m = models_.add(); char newname[16]; sprintf(newname,"Unnamed%03i",++modelId_); current.m->setName(newname); gui.addModel(current.m); - dbgEnd(Debug::Calls,"master::addModel"); + dbgEnd(Debug::Calls,"Master::addModel"); return current.m; } @@ -144,7 +144,7 @@ Model *Master::addModel() void Master::removeModel(Model *xmodel) { // Remove this model from the model_list in the main window - dbgBegin(Debug::Calls,"master::removeModel"); + dbgBegin(Debug::Calls,"Master::removeModel"); Model *m; // Unset the datamodel for the canvas // Delete the current model, but don't allow there to be zero models_... @@ -156,17 +156,17 @@ void Master::removeModel(Model *xmodel) int id = models_.indexOf(xmodel); models_.remove(xmodel); gui.removeModel(id); - dbgEnd(Debug::Calls,"master::removeModel"); + dbgEnd(Debug::Calls,"Master::removeModel"); } // Find model by name Model *Master::findModel(const char *s) const { // Search model list for name 's' (script function) - dbgBegin(Debug::Calls,"master::findModel"); + dbgBegin(Debug::Calls,"Master::findModel"); Model *result = NULL; for (result = models_.first(); result != NULL; result = result->next) if (strcmp(s,result->name()) == 0) break; - dbgEnd(Debug::Calls,"master::findModel"); + dbgEnd(Debug::Calls,"Master::findModel"); return result ; } @@ -195,11 +195,7 @@ Grid *Master::grid(int id) // Add new surface Grid *Master::addGrid() { - dbgBegin(Debug::Calls,"master::addGrid"); current.g = grids_.add(); - gui.addGrid(current.g); - gui.selectGrid(current.g); - dbgEnd(Debug::Calls,"master::addGrid"); return current.g; } @@ -208,8 +204,6 @@ void Master::removeGrid(Grid *xgrid) { Grid *g; xgrid->next != NULL ? g = xgrid->next : g = xgrid->prev; - gui.removeGrid(xgrid); - gui.selectGrid(g); // Finally, delete the old surface grids_.remove(xgrid); } @@ -221,49 +215,43 @@ void Master::removeGrid(Grid *xgrid) // Load forcefield Forcefield *Master::loadForcefield(const char *filename) { - dbgBegin(Debug::Calls,"master::loadForcefield"); + dbgBegin(Debug::Calls,"Master::loadForcefield"); Forcefield *newff = forcefields_.add(); if (!newff->load(filename)) { msg(Debug::None,"Couldn't load forcefield file '%s'.\n",filename); forcefields_.remove(newff); - dbgEnd(Debug::Calls,"master::loadForcefield"); + dbgEnd(Debug::Calls,"Master::loadForcefield"); return NULL; } - else - { - gui.addForcefield(newff); - current.ff = newff; - } - dbgEnd(Debug::Calls,"master::loadForcefield"); + else current.ff = newff; + dbgEnd(Debug::Calls,"Master::loadForcefield"); return newff; } // Unload forcefield from the master's list void Master::removeForcefield(Forcefield *xff) { - dbgBegin(Debug::Calls,"master::removeForcefield"); + dbgBegin(Debug::Calls,"Master::removeForcefield"); Forcefield *newff; // If possible, set the active row to the next model. Otherwise, the previous. xff->next != NULL ? newff = xff->next : newff = xff->prev; current.ff = newff; dereferenceForcefield(xff); - gui.removeForcefield(xff); - gui.selectForcefield(newff); // Finally, delete the ff forcefields_.remove(xff); - dbgEnd(Debug::Calls,"master::removeForcefield"); + dbgEnd(Debug::Calls,"Master::removeForcefield"); } // Find forcefield by name Forcefield *Master::findForcefield(const char *s) const { // Search forcefield list for name 's' (script function) - dbgBegin(Debug::Calls,"master::findForcefield"); + dbgBegin(Debug::Calls,"Master::findForcefield"); Forcefield *ff; for (ff = forcefields_.first(); ff != NULL; ff = ff->next) if (strcmp(s,ff->name()) == 0) break; if (ff == NULL) msg(Debug::None,"Forcefield '%s' is not loaded.\n",s); - dbgEnd(Debug::Calls,"master::findForcefield"); + dbgEnd(Debug::Calls,"Master::findForcefield"); return ff; } @@ -271,7 +259,7 @@ Forcefield *Master::findForcefield(const char *s) const void Master::dereferenceForcefield(Forcefield *xff) { // Remove references to the forcefield in the models - dbgBegin(Debug::Calls,"master::dereferenceForcefield"); + dbgBegin(Debug::Calls,"Master::dereferenceForcefield"); for (Model *m = models_.first(); m != NULL; m = m->next) { if (m->forcefield() == xff) @@ -293,7 +281,7 @@ void Master::dereferenceForcefield(Forcefield *xff) } } } - dbgEnd(Debug::Calls,"master::dereferenceForcefield"); + dbgEnd(Debug::Calls,"Master::dereferenceForcefield"); } // Set the default forcefield @@ -353,7 +341,7 @@ Forcefield *Master::defaultForcefield() const // Load filters bool Master::openFilters(const char *path, bool isdatadir) { - dbgBegin(Debug::Calls,"master::openFilters"); + dbgBegin(Debug::Calls,"Master::openFilters"); // Load in model filters Filter *f; int n; @@ -381,7 +369,7 @@ bool Master::openFilters(const char *path, bool isdatadir) printf("%s ",parser.argc(0)); if (!loadFilter(longname)) { - dbgEnd(Debug::Calls,"master::openFilters"); + dbgEnd(Debug::Calls,"Master::openFilters"); return FALSE; } } @@ -399,14 +387,14 @@ bool Master::openFilters(const char *path, bool isdatadir) msg(Debug::None,"Expression (%i/%i) ", filters_[FT_EXPRESSION_IMPORT].nItems(), filters_[FT_EXPRESSION_EXPORT].nItems()); msg(Debug::None,"Grid (%i/%i)\n", filters_[FT_GRID_IMPORT].nItems(), filters_[FT_GRID_EXPORT].nItems()); } - dbgEnd(Debug::Calls,"master::openFilters"); + dbgEnd(Debug::Calls,"Master::openFilters"); return TRUE; } // Read commands from filter file bool Master::loadFilter(const char *filename) { - dbgBegin(Debug::Calls,"master::loadFilter"); + dbgBegin(Debug::Calls,"Master::loadFilter"); FilterType ft; Filter *newfilter; bool foundmain, error; @@ -445,14 +433,14 @@ bool Master::loadFilter(const char *filename) } filterfile.close(); //variables.print(); - dbgEnd(Debug::Calls,"master::loadFilter"); + dbgEnd(Debug::Calls,"Master::loadFilter"); return (!error); } // Set filter partners void Master::partnerFilters() { - dbgBegin(Debug::Calls,"master::partnerFilters"); + dbgBegin(Debug::Calls,"Master::partnerFilters"); // Loop through import filters and search / set export partners Filter *imp, *exp; int importid; @@ -500,18 +488,18 @@ void Master::partnerFilters() if (exp == NULL) printf("o]"); } printf("\n"); - dbgEnd(Debug::Calls,"master::partnerFilters"); + dbgEnd(Debug::Calls,"Master::partnerFilters"); } // Find filter with specified type and nickname Filter *Master::findFilter(FilterType ft, const char *nickname) const { - dbgBegin(Debug::Calls,"master::findFilter"); + dbgBegin(Debug::Calls,"Master::findFilter"); Filter *result; for (result = filters_[ft].first(); result != NULL; result = result->next) if (strcmp(result->nickname(), nickname) == 0) break; if (result == NULL) msg(Debug::None,"No %s filter with nickname '%s' defined.\n",text_from_FT(ft),nickname); - dbgEnd(Debug::Calls,"master::findFilter"); + dbgEnd(Debug::Calls,"Master::findFilter"); return result; } diff --git a/src/command/ff.cpp b/src/command/ff.cpp index ea475a829..9a3d5d584 100644 --- a/src/command/ff.cpp +++ b/src/command/ff.cpp @@ -66,7 +66,7 @@ int CommandData::function_CA_FFPATTERNID(Command *&c, Bundle &obj) int nodeid = c->argi(0) - 1; if ((nodeid < 0) || (nodeid > obj.m->nPatterns())) { - msg(Debug::None,"Pattern ID %i is out of range for model (which has %i atterns).\n", nodeid, obj.m->nPatterns()); + msg(Debug::None,"Pattern ID %i is out of range for model (which has %i patterns).\n", nodeid, obj.m->nPatterns()); return CR_FAIL; } else obj.m->pattern(nodeid)->setForcefield(obj.ff); diff --git a/src/command/prefs.cpp b/src/command/prefs.cpp index 00358ad19..612e4f786 100644 --- a/src/command/prefs.cpp +++ b/src/command/prefs.cpp @@ -30,7 +30,7 @@ int CommandData::function_CA_ATOMDETAIL(Command *&c, Bundle &obj) { prefs.setAtomDetail(c->argi(0)); if (obj.m != NULL) obj.m->logChange(LOG_VISUAL); - if (gui.exists()) gui.refresh(); + gui.mainView.postRedisplay(); return CR_SUCCESS; } @@ -39,7 +39,7 @@ int CommandData::function_CA_BONDDETAIL(Command *&c, Bundle &obj) { prefs.setBondDetail(c->argi(0)); if (obj.m != NULL) obj.m->logChange(LOG_VISUAL); - if (gui.exists()) gui.refresh(); + gui.mainView.postRedisplay(); return CR_SUCCESS; } @@ -52,7 +52,7 @@ int CommandData::function_CA_COLOUR(Command *&c, Bundle &obj) GLfloat alpha = (c->hasArg(4) ? (GLfloat) c->argd(4) : 1.0f); prefs.setColour(col, colvec.x, colvec.y, colvec.z, alpha); if (obj.m != NULL) obj.m->logChange(LOG_VISUAL); - if (gui.exists()) gui.refresh(); + gui.mainView.postRedisplay(); return CR_SUCCESS; } @@ -103,7 +103,7 @@ int CommandData::function_CA_ELEMENTAMBIENT(Command *&c, Bundle &obj) elements.setAmbientColour(el,1,c->argi(2)); elements.setAmbientColour(el,2,c->argi(3)); if (obj.m != NULL) obj.m->logChange(LOG_VISUAL); - if (gui.exists()) gui.refresh(); + gui.mainView.postRedisplay(); return CR_SUCCESS; } @@ -116,7 +116,7 @@ int CommandData::function_CA_ELEMENTDIFFUSE(Command *&c, Bundle &obj) elements.setDiffuseColour(el,1,c->argi(2)); elements.setDiffuseColour(el,2,c->argi(3)); if (obj.m != NULL) obj.m->logChange(LOG_VISUAL); - if (gui.exists()) gui.refresh(); + gui.mainView.postRedisplay(); return CR_SUCCESS; } @@ -127,7 +127,7 @@ int CommandData::function_CA_ELEMENTRADIUS(Command *&c, Bundle &obj) if (el == 0) return CR_FAIL; elements.setAtomicRadius(el, c->argd(1)); if (obj.m != NULL) obj.m->logChange(LOG_VISUAL); - if (gui.exists()) gui.refresh(); + gui.mainView.postRedisplay(); return CR_SUCCESS; } @@ -149,7 +149,7 @@ int CommandData::function_CA_GL(Command *&c, Bundle &obj) else prefs.removeGlOption(go); if (gui.exists()) gui.mainView.initGl(); if (obj.m != NULL) obj.m->logChange(LOG_VISUAL); - if (gui.exists()) gui.refresh(); + gui.mainView.postRedisplay(); return CR_SUCCESS; } @@ -194,7 +194,7 @@ int CommandData::function_CA_SHININESS(Command *&c, Bundle &obj) { prefs.setShininess(c->argi(0)); if (obj.m != NULL) obj.m->logChange(LOG_VISUAL); - if (gui.exists()) gui.refresh(); + gui.mainView.postRedisplay(); return CR_SUCCESS; } @@ -206,7 +206,7 @@ int CommandData::function_CA_SHOW(Command *&c, Bundle &obj) { prefs.setVisible(vo, c->argb(1)); if (obj.m != NULL) obj.m->logChange(LOG_VISUAL); - if (gui.exists()) gui.refresh(); + gui.mainView.postRedisplay(); } else return CR_FAIL; return CR_SUCCESS; @@ -220,7 +220,7 @@ int CommandData::function_CA_STYLE(Command *&c, Bundle &obj) { prefs.setRenderStyle(ds); if (obj.m != NULL) obj.m->logChange(LOG_VISUAL); - if (gui.exists()) gui.refresh(); + gui.mainView.postRedisplay(); } else return CR_FAIL; return CR_SUCCESS; diff --git a/src/command/view.cpp b/src/command/view.cpp index e490c9fe8..cd4ee94c4 100644 --- a/src/command/view.cpp +++ b/src/command/view.cpp @@ -30,7 +30,7 @@ int CommandData::function_CA_RESETVIEW(Command *&c, Bundle &obj) { if (obj.notifyNull(BP_MODEL)) return CR_FAIL; obj.m->resetView(); - gui.refresh(); + gui.mainView.postRedisplay(); return CR_SUCCESS; } @@ -39,7 +39,7 @@ int CommandData::function_CA_ROTATEVIEW(Command *&c, Bundle &obj) { if (obj.notifyNull(BP_MODEL)) return CR_FAIL; obj.m->rotate(c->argd(0), c->argd(1)); - gui.refresh(); + gui.mainView.postRedisplay(); return CR_SUCCESS; } @@ -48,7 +48,7 @@ int CommandData::function_CA_TRANSLATEVIEW(Command *&c, Bundle &obj) { if (obj.notifyNull(BP_MODEL)) return CR_FAIL; obj.m->adjustCamera(c->arg3d(0),0.0); - gui.refresh(); + gui.mainView.postRedisplay(); return CR_SUCCESS; } @@ -57,7 +57,7 @@ int CommandData::function_CA_ZOOMVIEW(Command *&c, Bundle &obj) { if (obj.notifyNull(BP_MODEL)) return CR_FAIL; obj.m->adjustCamera(0.0,0.0,c->argd(2),0.0); - gui.refresh(); + gui.mainView.postRedisplay(); return CR_SUCCESS; } @@ -66,7 +66,7 @@ int CommandData::function_CA_ZROTATEVIEW(Command *&c, Bundle &obj) { if (obj.notifyNull(BP_MODEL)) return CR_FAIL; obj.m->zRotate(c->argd(0)); - gui.refresh(); + gui.mainView.postRedisplay(); return CR_SUCCESS; } @@ -85,7 +85,7 @@ int CommandData::function_CA_SPEEDTEST(Command *&c, Bundle &obj) for (int n=0; n < nrenders; n ++) { obj.m->rotate(5.0,0.0); - gui.refresh(); + gui.mainView.postRedisplay(); } clock_t tfinish = clock(); double nsec = double(tfinish-tstart) / CLOCKS_PER_SEC; diff --git a/src/gui/atomlist_funcs.cpp b/src/gui/atomlist_funcs.cpp index 03f29a66f..21d5ba21a 100644 --- a/src/gui/atomlist_funcs.cpp +++ b/src/gui/atomlist_funcs.cpp @@ -53,8 +53,7 @@ void AtenForm::on_AtomTree_itemSelectionChanged() i = ri->item->atom(); ri->item->isSelected() ? m->selectAtom(i) : m->deselectAtom(i); } - gui.mainView.postRedisplay(); - gui.updateLabels(); + gui.modelChanged(); dbgEnd(Debug::Calls,"AtenForm::on_AtomTree_selectionChanged"); } @@ -178,7 +177,7 @@ void AtenForm::on_ShiftUpButton_clicked(bool checked) peekScrollBar(); refreshAtomPage(); pokeScrollBar(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_ShiftDownButton_clicked(bool checked) @@ -190,7 +189,7 @@ void AtenForm::on_ShiftDownButton_clicked(bool checked) peekScrollBar(); refreshAtomPage(); pokeScrollBar(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_MoveToStartButton_clicked(bool checked) diff --git a/src/gui/cell_funcs.cpp b/src/gui/cell_funcs.cpp index 4b9948610..ead94cfc6 100644 --- a/src/gui/cell_funcs.cpp +++ b/src/gui/cell_funcs.cpp @@ -59,6 +59,12 @@ void AtenForm::on_CellAngleCSpin_valueChanged(double d) void AtenForm::refreshCellPage() { + // If the cell page is not visible, don't do anything + if (!ui.ShowCellPageButton->isChecked()) + { + dbgEnd(Debug::Calls,"AtenForm::refreshCellPage"); + return; + } // Set label to show cell volume (do this before early exit check so we update the cell volume after widget-enforced cell changes) Cell *cell = master.currentModel()->cell(); CellType ct = cell->type(); @@ -68,7 +74,6 @@ void AtenForm::refreshCellPage() if (cellpage_refreshing) return; else cellpage_refreshing = TRUE; // Update the widgets on the page to reflect the current model's unit cell - if (cell->type() == CT_NONE) { // No cell, so disable group boxes and quit @@ -113,7 +118,7 @@ void AtenForm::cellChanged() m->setCell(lengths, angles); m->endUndostate(); m->calculateDensity(); - gui.refresh(); + gui.modelChanged(FALSE,FALSE,FALSE); cellpage_refreshing = FALSE; } @@ -128,7 +133,7 @@ void AtenForm::on_CellDefinitionGroup_clicked(bool checked) m->removeCell(); m->endUndostate(); } - gui.refresh(); + gui.modelChanged(FALSE,FALSE,FALSE); } void AtenForm::on_CellReplicateButton_clicked(bool checked) @@ -145,7 +150,7 @@ void AtenForm::on_CellReplicateButton_clicked(bool checked) m->beginUndostate("Replicate Cell"); m->replicateCell(neg, pos); m->endUndostate(); - gui.refresh(); + gui.modelChanged(); } void AtenForm::on_CellScaleButton_clicked(bool checked) @@ -158,5 +163,5 @@ void AtenForm::on_CellScaleButton_clicked(bool checked) m->beginUndostate("Scale Cell"); m->scaleCell(scale); m->endUndostate(); - gui.refresh(); + gui.modelChanged(FALSE,TRUE,FALSE); } diff --git a/src/gui/contextmenu_funcs.cpp b/src/gui/contextmenu_funcs.cpp index f90aeac1f..c689516c2 100644 --- a/src/gui/contextmenu_funcs.cpp +++ b/src/gui/contextmenu_funcs.cpp @@ -94,7 +94,7 @@ void AtenForm::removeAtomLabels(bool all) master.currentModel()->selectionClearLabels(); } m->endUndostate(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_actionAtomLabelID_triggered(bool checked) diff --git a/src/gui/edit_funcs.cpp b/src/gui/edit_funcs.cpp index 7e2cf88c7..cf7e7d73c 100644 --- a/src/gui/edit_funcs.cpp +++ b/src/gui/edit_funcs.cpp @@ -112,7 +112,7 @@ void AtenForm::on_BondCalcButton_clicked(bool on) m->clearBonding(); m->calculateBonding(); m->endUndostate(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_BondClearButton_clicked(bool on) @@ -121,7 +121,7 @@ void AtenForm::on_BondClearButton_clicked(bool on) m->beginUndostate("Clear Bonding"); m->clearBonding(); m->endUndostate(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_BondCalcSelButton_clicked(bool on) @@ -130,7 +130,7 @@ void AtenForm::on_BondCalcSelButton_clicked(bool on) m->beginUndostate("Calculate Bonding (Selection)"); m->selectionCalculateBonding(); m->endUndostate(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_BondClearSelButton_clicked(bool on) @@ -139,7 +139,7 @@ void AtenForm::on_BondClearSelButton_clicked(bool on) m->beginUndostate("Clear Bonding (Selection)"); m->selectionClearBonding(); m->endUndostate(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_BondAugmentButton_clicked(bool on) @@ -148,7 +148,7 @@ void AtenForm::on_BondAugmentButton_clicked(bool on) m->beginUndostate("Augment Bonding"); m->augmentBonding(); m->endUndostate(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_ElementEdit_editingFinished() @@ -175,5 +175,5 @@ void AtenForm::on_AddHydrogenButton_clicked(bool on) m->beginUndostate("Hydrogen Satisfy Model"); m->hydrogenSatisfy(); m->endUndostate(); - gui.refresh(); + gui.modelChanged(); } diff --git a/src/gui/editactions.cpp b/src/gui/editactions.cpp index d04320e98..b779a3944 100644 --- a/src/gui/editactions.cpp +++ b/src/gui/editactions.cpp @@ -32,13 +32,15 @@ void AtenForm::on_actionEditUndo_triggered(bool checked) { master.currentModel()->undo(); - gui.refresh(); + gui.mainView.postRedisplay(); + gui.modelChanged(); } void AtenForm::on_actionEditRedo_triggered(bool checked) { master.currentModel()->redo(); - gui.refresh(); + gui.mainView.postRedisplay(); + gui.modelChanged(); } void AtenForm::on_actionEditCut_triggered(bool checked) @@ -50,7 +52,7 @@ void AtenForm::on_actionEditCut_triggered(bool checked) m->beginUndostate(s); master.userClipboard->cutSelection(m); m->endUndostate(); - gui.refresh(); + gui.modelChanged(TRUE,FALSE,TRUE); } void AtenForm::on_actionEditCopy_triggered(bool checked) @@ -70,7 +72,8 @@ void AtenForm::on_actionEditPaste_triggered(bool checked) m->beginUndostate(s); master.userClipboard->pasteToModel(m); m->endUndostate(); - gui.refresh(); + gui.mainView.postRedisplay(); + gui.modelChanged(TRUE,FALSE,TRUE); } void AtenForm::on_actionEditDelete_triggered(bool checked) @@ -84,7 +87,7 @@ void AtenForm::on_actionEditDelete_triggered(bool checked) m->beginUndostate(s); m->selectionDelete(); m->endUndostate(); - gui.refresh(); + gui.modelChanged(TRUE,FALSE,TRUE); } void AtenForm::on_actionEditSelectAll_triggered(bool checked) @@ -94,7 +97,7 @@ void AtenForm::on_actionEditSelectAll_triggered(bool checked) m->beginUndostate("Select All"); m->selectAll(); m->endUndostate(); - gui.refresh(); + gui.modelChanged(TRUE,FALSE,FALSE); } void AtenForm::on_actionEditSelectNone_triggered(bool checked) @@ -104,7 +107,7 @@ void AtenForm::on_actionEditSelectNone_triggered(bool checked) m->beginUndostate("Select None"); m->selectNone(); m->endUndostate(); - gui.refresh(); + gui.modelChanged(TRUE,FALSE,FALSE); } void AtenForm::on_actionEditInvert_triggered(bool checked) @@ -114,7 +117,7 @@ void AtenForm::on_actionEditInvert_triggered(bool checked) m->beginUndostate("Invert Selection"); m->selectionInvert(); m->endUndostate(); - gui.refresh(); + gui.modelChanged(TRUE,FALSE,FALSE); } void AtenForm::on_actionEditSelectExpand_triggered(bool on) @@ -123,6 +126,6 @@ void AtenForm::on_actionEditSelectExpand_triggered(bool on) m->beginUndostate("Expand Selection"); m->selectionExpand(); m->endUndostate(); - gui.refresh(); + gui.modelChanged(TRUE,FALSE,FALSE); } diff --git a/src/gui/fileactions.cpp b/src/gui/fileactions.cpp index 5f8649673..9d37c33d9 100644 --- a/src/gui/fileactions.cpp +++ b/src/gui/fileactions.cpp @@ -64,7 +64,7 @@ void AtenForm::on_actionFileOpen_triggered(bool checked) } refreshModelTabs(); master.currentModel()->logChange(LOG_VISUAL); - gui.refresh(); + gui.modelChanged(); } } @@ -101,8 +101,7 @@ void AtenForm::on_actionFileSaveAs_triggered(bool checked) m->setFilter(saveModelFilter); m->setFilename(saveModelFilename.get()); saveModelFilter->execute(saveModelFilename.get()); - refreshModelTabs(); - gui.refresh(); + //refreshModelTabs(); } } @@ -124,11 +123,11 @@ void AtenForm::on_actionFileSave_triggered(bool checked) m->setFilter(saveModelFilter); m->setFilename(saveModelFilename.get()); saveModelFilter->execute(saveModelFilename.get()); - refreshModelTabs(); + //refreshModelTabs(); } } else f->execute(saveModelFilename.get()); - gui.refresh(); + gui.modelChanged(FALSE,FALSE,FALSE); } void AtenForm::on_actionFileClose_triggered(bool checked) @@ -220,7 +219,7 @@ void AtenForm::on_actionFileAddTrajectory_triggered(bool checked) ui.actionViewTrajectory->setChecked(TRUE); } else msg(Debug::None, "Couldn't determine trajectory file format.\n"); - gui.refresh(); + gui.modelChanged(); } } @@ -270,7 +269,7 @@ void AtenForm::on_actionFileOpenGrid_triggered(bool checked) } } refreshGridsPage(); - gui.refresh(); + gui.mainView.postRedisplay(); } } diff --git a/src/gui/forcefield_funcs.cpp b/src/gui/forcefield_funcs.cpp index f1ae590e6..a0b234fd1 100644 --- a/src/gui/forcefield_funcs.cpp +++ b/src/gui/forcefield_funcs.cpp @@ -35,6 +35,12 @@ int typelist_element = 1; // Update the list of loaded forcefields void AtenForm::refreshForcefieldPage() { + // If the cell page is not visible, don't do anything + if (!ui.ShowCellPageButton->isChecked()) + { + dbgEnd(Debug::Calls,"AtenForm::refreshCellPage"); + return; + } ui.ForcefieldList->clear(); TListWidgetItem *item; for (Forcefield *ff = master.forcefields(); ff != NULL; ff = ff->next) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index d78df55a6..558b2772b 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -132,51 +132,6 @@ void GuiQt::updateTrajControls() } } -// Update labels -void GuiQt::updateLabels() -{ - // Update the information labels in the button bar - if (!doesExist_) return; - dbgBegin(Debug::Calls,"GuiQt::update_labels"); - QString s; - Model *m = master.currentModel(); - // Trajectory information label - if (m->totalFrames() != 0) - { - s = "(Frame "; - s += itoa(m->framePosition()); - s += " of "; - s += itoa(m->totalFrames()); - s += ") "; - } - // Model information - s += itoa(m->nAtoms()); - s += " Atoms "; - if (m->nSelected() != 0) - { - s += "("; - s += itoa(m->nSelected()); - s += " selected) "; - } - s += ftoa(m->mass()); - s += " g mol-1 "; - CellType ct = m->cell()->type(); - if (ct != CT_NONE) - { - s += "("; - s += text_from_CT(ct); - s += ", "; - s += ftoa(m->density()); - switch (prefs.densityUnit()) - { - case (Prefs::GramsPerCm): s += " g cm-3)"; break; - case (Prefs::AtomsPerAngstrom): s += " atoms Å-3)"; break; - } - } - mainWindow->statusLabel->setText(s); - dbgEnd(Debug::Calls,"GuiQt::update_labels"); -} - /* // General GUI Routines */ @@ -227,7 +182,7 @@ void GuiQt::addModel(Model *m) // Create new tab in ModelTabs QTabBar int tabid = mainWindow->ui.ModelTabs->addTab(m->name()); m->resetView(); - gui.refresh(); + gui.modelChanged(); } // Remove model from list @@ -235,55 +190,10 @@ void GuiQt::removeModel(int id) { if (!doesExist_) return; mainWindow->ui.ModelTabs->removeTab(id); - gui.refresh(); -} - -/* -// Forcefields -*/ - -// Add ff to list -void GuiQt::addForcefield(Forcefield *ff) -{ - if (!doesExist_) return; -} - -// Remove ff from list -void GuiQt::removeForcefield(Forcefield *ff) -{ - // Find iter that matches the old model in the model master - if (!doesExist_) return; -} - -// Select ff in list -void GuiQt::selectForcefield(Forcefield *ff) -{ - if (!doesExist_) return; -} - -/* -// Grids -*/ - -// Add grid to list -void GuiQt::addGrid(Grid *g) -{ - if (isAvailable_) printf("GuiQt::addGrid - Not defined.\n"); -} - -// Remove grid from list -void GuiQt::removeGrid(Grid *g) -{ - if (isAvailable_) printf("GuiQt::removeGrid - Not defined.\n"); -} - -// Select grid in list and show in main/sub windows -void GuiQt::selectGrid(Grid *g) -{ - if (isAvailable_) printf("GuiQt::select_grid - Not defined.\n"); + gui.modelChanged(); } -// Redraw main window canvas +/* Redraw main window canvas void GuiQt::refresh() { if (!doesExist_) return; @@ -291,30 +201,74 @@ void GuiQt::refresh() int id = master.currentModelIndex(); if (id <= mainWindow->ui.ModelTabs->count()) mainWindow->ui.ModelTabs->setCurrentIndex(id); else printf("GUI_ERROR: Current model index (%i) is out of bounds of tab list.\n",id); - // Update labels on status bar - updateLabels(); - // Update contents of the atom list - mainWindow->refreshAtomPage(); - // Update the contents of the cell page - mainWindow->refreshCellPage(); // Update the disorder page mainWindow->refreshDisorderPage(); - // Update forcefields in the forcefield window - mainWindow->refreshForcefieldPage(); // Update pattern list in forcefield window mainWindow->refreshForcefieldPatterns(); - // Update trajectory playback controls - updateTrajControls(); - // Update Undo/Redo menuitems + // Enable View->Trajectory menu item if a trajectory is associated + mainWindow->ui.actionViewTrajectory->setEnabled( master.currentModel()->currentFrame() == NULL ? FALSE : TRUE); +} */ + +// Update GUI after model change (or different model selected) +void GuiQt::modelChanged(bool updateAtoms, bool updateCell, bool updateForcefield) +{ + if (!doesExist_) return; + // Update status bar + QString s; + Model *m = master.currentModel(); + // Trajectory information label + if (m->totalFrames() != 0) + { + s = "(Frame "; + s += itoa(m->framePosition()); + s += " of "; + s += itoa(m->totalFrames()); + s += ") "; + } + // Model information + s += itoa(m->nAtoms()); + s += " Atoms "; + if (m->nSelected() != 0) + { + s += "("; + s += itoa(m->nSelected()); + s += " selected) "; + } + s += ftoa(m->mass()); + s += " g mol-1 "; + CellType ct = m->cell()->type(); + if (ct != CT_NONE) + { + s += "("; + s += text_from_CT(ct); + s += ", "; + s += ftoa(m->density()); + switch (prefs.densityUnit()) + { + case (Prefs::GramsPerCm): s += " g cm-3)"; break; + case (Prefs::AtomsPerAngstrom): s += " atoms Å-3)"; break; + } + } + mainWindow->statusLabel->setText(s); + // Update save button status + mainWindow->ui.actionFileSave->setEnabled( m->isModified() ); + // Update contents of the atom list + if (updateAtoms) mainWindow->refreshAtomPage(); + // Update the contents of the cell page + if (updateCell) mainWindow->refreshCellPage(); + // Update forcefields in the forcefield window + if (updateForcefield) mainWindow->refreshForcefieldPage(); + // Enable the Atom menu if one or more atoms are selected + mainWindow->ui.AtomMenu->setEnabled( master.currentModel()->nSelected() == 0 ? FALSE : TRUE); + // Update Undo Redo lists mainWindow->updateUndoRedo(); // Request redraw of the main canvas mainView.postRedisplay(); - // If the model save_point is recent, disable save button - mainWindow->ui.actionFileSave->setEnabled(master.currentModel()->isModified()); - // Enable the Atom menu if one or more atoms are selected - mainWindow->ui.AtomMenu->setEnabled( master.currentModel()->nSelected() == 0 ? FALSE : TRUE); - // Enable View->Trajectory menu item if a trajectory is associated - mainWindow->ui.actionViewTrajectory->setEnabled( master.currentModel()->currentFrame() == NULL ? FALSE : TRUE); +} + +// Update model lists +void GuiQt::updateModelLists() +{ } int GuiQt::userQuestion(const char *s, const char *t) @@ -564,5 +518,5 @@ void GuiQt::stopTrajectoryPlayback() mainWindow->ui.ModelView->killTimer(trajectoryTimerId_); mainWindow->ui.actionPlayPause->setChecked(FALSE); trajectoryPlaying_ = FALSE; - refresh(); + modelChanged(); } diff --git a/src/gui/gui.h b/src/gui/gui.h index f14221910..ad0b7b7d7 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -84,39 +84,34 @@ class GuiQt public: // Add a message to the main window's message output box void printMessage(const char*); - // Refresh main canvas - void refresh(); - // Update trajectory control widgets - void updateTrajControls(); - // Update main window labels - void updateLabels(); // Process events from GUI void processEvents(); // Save before close bool saveBeforeClose(); - // Update Undo/Redo menu items - void updateUndoRedo(); /* - // Object management + // Gui Refresh Functions + */ + public: + // Update model tabs and lists + void updateModelLists(); + // Update forcefield list + void updateForcefieldList(); + // Update grid list + void updateGridList(); + // Update trajectory control widgets + void updateTrajControls(); + // Refreshes all widgets to do with the model + void modelChanged(bool updateAtoms = TRUE, bool updateCell = TRUE, bool updateForcefield = TRUE); + + /* + // Model management */ public: // Add model (adds new model to list) void addModel(Model*); // Remove model from list void removeModel(int id); - // Add forcefield (adds ff to list) - void addForcefield(Forcefield*); - // Remove ff from list - void removeForcefield(Forcefield*); - // Select forcefield in list - void selectForcefield(Forcefield*); - // Add surface (adds new surface to list) - void addGrid(Grid*); - // Remove surface from list - void removeGrid(Grid*); - // Select surface (show in main/sub windows) - void selectGrid(Grid*); /* // Files diff --git a/src/gui/input.cpp b/src/gui/input.cpp index 50901053f..45f478173 100644 --- a/src/gui/input.cpp +++ b/src/gui/input.cpp @@ -317,6 +317,9 @@ void Canvas::endMode(Prefs::MouseButton button) } else displayModel_->selectBox(rMouseDown_.x, rMouseDown_.y, rMouseUp_.x, rMouseUp_.y); displayModel_->endUndostate(); + // Set activeMode_ early to prevent presistence of selection box + activeMode_ = UA_NONE; + gui.modelChanged(TRUE,FALSE,FALSE); break; // Now do the rest case (UA_PICKFRAG): @@ -324,12 +327,14 @@ void Canvas::endMode(Prefs::MouseButton button) if (!keyModifier_[Prefs::ShiftKey]) displayModel_->selectNone(); if (atomHover_ != NULL) displayModel_->selectTree(atomHover_); displayModel_->endUndostate(); + gui.modelChanged(TRUE,FALSE,FALSE); break; case (UA_PICKELEMENT): displayModel_->beginUndostate("Select Element"); if (!keyModifier_[Prefs::ShiftKey]) displayModel_->selectNone(); if (atomHover_ != NULL) displayModel_->selectElement(atomHover_); displayModel_->endUndostate(); + gui.modelChanged(TRUE,FALSE,FALSE); break; case (UA_PICKRADIAL): displayModel_->beginUndostate("Select Radial"); @@ -341,6 +346,7 @@ void Canvas::endMode(Prefs::MouseButton button) displayModel_->selectRadial(atomHover_,radius); } displayModel_->endUndostate(); + gui.modelChanged(TRUE,FALSE,FALSE); break; // Measurements case (UA_GEOMDIST): @@ -351,6 +357,7 @@ void Canvas::endMode(Prefs::MouseButton button) displayModel_->measureDistance(atoms[0],atoms[1]); displayModel_->endUndostate(); subselection_.clear(); + gui.modelChanged(FALSE,FALSE,FALSE); break; case (UA_GEOMANGLE): // Must be two atoms in subselection to continue @@ -360,6 +367,7 @@ void Canvas::endMode(Prefs::MouseButton button) displayModel_->measureAngle(atoms[0],atoms[1],atoms[2]); displayModel_->endUndostate(); subselection_.clear(); + gui.modelChanged(FALSE,FALSE,FALSE); break; case (UA_GEOMTORSION): // Must be two atoms in subselection to continue @@ -369,6 +377,7 @@ void Canvas::endMode(Prefs::MouseButton button) displayModel_->measureTorsion(atoms[0],atoms[1],atoms[2],atoms[3]); displayModel_->endUndostate(); subselection_.clear(); + gui.modelChanged(FALSE,FALSE,FALSE); break; // Draw single atom case (UA_DRAWATOM): @@ -380,6 +389,7 @@ void Canvas::endMode(Prefs::MouseButton button) displayModel_->endUndostate(); displayModel_->projectAtom(i); } + gui.modelChanged(TRUE,FALSE,TRUE); break; // Draw chains of atoms case (UA_DRAWCHAIN): @@ -403,16 +413,19 @@ void Canvas::endMode(Prefs::MouseButton button) displayModel_->bondAtoms(i,atomHover_,bt); } displayModel_->endUndostate(); + gui.modelChanged(TRUE,FALSE,TRUE); break; case (UA_TRANSATOM): displayModel_->beginUndostate("Transmute"); displayModel_->transmuteAtom(atomHover_, master.sketchElement()); displayModel_->endUndostate(); + gui.modelChanged(TRUE,FALSE,TRUE); break; case (UA_DELATOM): displayModel_->beginUndostate("Delete Atom"); displayModel_->deleteAtom(atomHover_); displayModel_->endUndostate(); + gui.modelChanged(TRUE,FALSE,TRUE); break; case (UA_PROBEATOM): if (atomHover_ != NULL) atomHover_->print(); @@ -438,6 +451,7 @@ void Canvas::endMode(Prefs::MouseButton button) displayModel_->endUndostate(); } subselection_.clear(); + gui.modelChanged(FALSE,FALSE,FALSE); break; case (UA_DELBOND): // Must be two atoms in subselection to continue @@ -450,13 +464,16 @@ void Canvas::endMode(Prefs::MouseButton button) displayModel_->endUndostate(); } subselection_.clear(); + gui.modelChanged(FALSE,FALSE,FALSE); break; // Misc case (UA_ATOMADDHYDROGEN): if (atomHover_ != NULL) { - displayModel_->beginUndostate("Delete Bond"); displayModel_->hydrogenSatisfy(atomHover_); + displayModel_->beginUndostate("Add Hydrogen to Atom"); + displayModel_->hydrogenSatisfy(atomHover_); displayModel_->endUndostate(); + gui.modelChanged(TRUE,FALSE,TRUE); } break; // Model transformations @@ -466,6 +483,7 @@ void Canvas::endMode(Prefs::MouseButton button) // Clear list of rSelection_ if nothing was moved if (!hasMoved_) rSelection_.clear(); displayModel_->finalizeTransform(rSelection_); + gui.modelChanged(TRUE,FALSE,FALSE); break; // View changes (no action) case (UA_ROTATEXY): @@ -478,7 +496,6 @@ void Canvas::endMode(Prefs::MouseButton button) break; } activeMode_ = UA_NONE; - postRedisplay(); dbgEnd(Debug::Calls,"Canvas::endMode"); } diff --git a/src/gui/mainwindow_funcs.cpp b/src/gui/mainwindow_funcs.cpp index a4b755916..1a47e60fc 100644 --- a/src/gui/mainwindow_funcs.cpp +++ b/src/gui/mainwindow_funcs.cpp @@ -108,7 +108,7 @@ void AtenForm::on_ModelTabs_currentChanged(int n) dbgBegin(Debug::Calls,"AtenForm::on_ModelTabs_currentChanged"); // Different model tab has been selected, so set master.currentmodel to reflect it. master.setCurrentModel(master.model(n)); - gui.refresh(); + gui.modelChanged(); dbgEnd(Debug::Calls,"AtenForm::on_ModelTabs_currentChanged"); } @@ -134,7 +134,6 @@ void AtenForm::executeCommand() // Check for no commands given if (parser.nArgs() == 0) return; if (master.tempScript.cacheCommand()) master.tempScript.execute(NULL); - gui.refresh(); commandEdit_->setText(""); } @@ -192,7 +191,7 @@ void AtenForm::loadRecent() { f->execute(filename.get()); master.currentModel()->logChange(LOG_VISUAL); - gui.refresh(); + gui.mainView.postRedisplay(); } else { @@ -421,9 +420,6 @@ void AtenForm::switchStack(int buttonid, bool checked) for (n=0; nsetChecked(FALSE); ui.MainWindowStack->setCurrentIndex(buttonid); ui.MainWindowStack->show(); - // If the new visible page is the atom list, do a quick refresh of it - if (buttonid == SP_ATOMS) refreshAtomPage(); - // Change to plain selection mode } else ui.MainWindowStack->hide(); // Choose a plain selection mode again... @@ -440,6 +436,7 @@ void AtenForm::switchStack(int buttonid, bool checked) void AtenForm::on_ShowAtomPageButton_clicked(bool checked) { switchStack(SP_ATOMS, checked); + if (checked) refreshAtomPage(); } void AtenForm::on_ShowEditPageButton_clicked(bool checked) @@ -460,6 +457,7 @@ void AtenForm::on_ShowPositionPageButton_clicked(bool checked) void AtenForm::on_ShowCellPageButton_clicked(bool checked) { switchStack(SP_CELL, checked); + if (checked) refreshCellPage(); } void AtenForm::on_ShowMinimiserPageButton_clicked(bool checked) @@ -475,6 +473,7 @@ void AtenForm::on_ShowDisorderPageButton_clicked(bool checked) void AtenForm::on_ShowForcefieldsPageButton_clicked(bool checked) { switchStack(SP_FORCEFIELD, checked); + if (checked) refreshForcefieldPage(); } void AtenForm::on_ShowGridsPageButton_clicked(bool checked) diff --git a/src/gui/modelactions.cpp b/src/gui/modelactions.cpp index 4153c69ae..e2adf342b 100644 --- a/src/gui/modelactions.cpp +++ b/src/gui/modelactions.cpp @@ -31,25 +31,25 @@ void AtenForm::on_actionFFType_triggered(bool checked) { master.currentModel()->typeAll(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_actionFFUntype_triggered(bool checked) { master.currentModel()->removeTyping(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_actionFoldAtoms_triggered(bool checked) { master.currentModel()->foldAllAtoms(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_actionFoldMolecules_triggered(bool checked) { master.currentModel()->foldAllMolecules(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_actionModelNext_triggered(bool checked) @@ -76,7 +76,6 @@ void AtenForm::on_actionModelShowAll_triggered(bool checked) { // Make all atoms in model visible Model *m = master.currentModel(); - for (Atom *i = m->atoms(); i != NULL; i = i->next) - m->setHidden(i, FALSE); + for (Atom *i = m->atoms(); i != NULL; i = i->next) m->setHidden(i, FALSE); m->logChange(LOG_VISUAL); } diff --git a/src/gui/position_funcs.cpp b/src/gui/position_funcs.cpp index 321fe24d3..0fabd6d90 100644 --- a/src/gui/position_funcs.cpp +++ b/src/gui/position_funcs.cpp @@ -66,5 +66,5 @@ void AtenForm::on_CentreSelectionButton_clicked(bool checked) m->beginUndostate(s); m->centre(centre); m->endUndostate(); - gui.refresh(); + gui.mainView.postRedisplay(); } diff --git a/src/gui/prefs_funcs.cpp b/src/gui/prefs_funcs.cpp index de0399ca2..370f63f1f 100644 --- a/src/gui/prefs_funcs.cpp +++ b/src/gui/prefs_funcs.cpp @@ -158,7 +158,7 @@ void AtenPrefs::updateAfterViewPrefs() gui.mainView.createLists(); master.currentModel()->projectAll(); master.currentModel()->logChange(LOG_VISUAL); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenPrefs::setRadiusChanged(Atom::DrawStyle ds, double value) @@ -215,7 +215,7 @@ void AtenPrefs::setVisibleObject(Prefs::ViewObject vo, int state) { prefs.setVisible(vo, (state == Qt::Checked ? TRUE : FALSE)); master.currentModel()->logChange(LOG_VISUAL); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenPrefs::on_AtomsVisibleCheck_stateChanged(int state) @@ -246,7 +246,7 @@ void AtenPrefs::on_SpotlightGroup_clicked(bool checked) { prefs.setSpotlightActive(checked); gui.mainView.initGl(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenPrefs::spotlightPosChanged(int i, double value) @@ -311,7 +311,7 @@ void AtenPrefs::on_ShininessSpin_valueChanged(int value) { prefs.setShininess(value); master.currentModel()->logChange(LOG_VISUAL); - gui.refresh(); + gui.mainView.postRedisplay(); } /* diff --git a/src/gui/tcanvas_funcs.cpp b/src/gui/tcanvas_funcs.cpp index 5309fcd5e..9a417352a 100644 --- a/src/gui/tcanvas_funcs.cpp +++ b/src/gui/tcanvas_funcs.cpp @@ -125,7 +125,6 @@ void TCanvas::mouseReleaseEvent(QMouseEvent *event) } // Finalize the requested action gui.mainView.informMouseUp(button,event->x(),event->y()); - gui.refresh(); dbgEnd(Debug::Calls,"TCanvas::mouseReleaseEvent"); } @@ -154,8 +153,7 @@ void TCanvas::timerEvent(QTimerEvent *event) Model *m = master.currentModel(); m->seekNextFrame(); if (m->framePosition() == m->totalFrames()) gui.stopTrajectoryPlayback(); - gui.updateLabels(); - gui.mainView.postRedisplay(); + gui.modelChanged(FALSE,FALSE,FALSE); DONTDRAW = FALSE; } } diff --git a/src/gui/trajectoryactions.cpp b/src/gui/trajectoryactions.cpp index 7deb4f941..7b46dec2b 100644 --- a/src/gui/trajectoryactions.cpp +++ b/src/gui/trajectoryactions.cpp @@ -31,25 +31,25 @@ void AtenForm::on_actionFrameNext_triggered(bool checked) { master.currentModel()->seekNextFrame(); - gui.refresh(); + gui.modelChanged(TRUE,TRUE,FALSE); } void AtenForm::on_actionFramePrevious_triggered(bool checked) { master.currentModel()->seekPreviousFrame(); - gui.refresh(); + gui.modelChanged(TRUE,TRUE,FALSE); } void AtenForm::on_actionFrameFirst_triggered(bool checked) { master.currentModel()->seekFirstFrame(); - gui.refresh(); + gui.modelChanged(TRUE,TRUE,FALSE); } void AtenForm::on_actionFrameLast_triggered(bool checked) { master.currentModel()->seekLastFrame(); - gui.refresh(); + gui.modelChanged(TRUE,TRUE,FALSE); } void AtenForm::on_actionPlayPause_triggered(bool checked) diff --git a/src/gui/transform_funcs.cpp b/src/gui/transform_funcs.cpp index 8f8bdc4b7..bb274ec5a 100644 --- a/src/gui/transform_funcs.cpp +++ b/src/gui/transform_funcs.cpp @@ -109,7 +109,7 @@ void AtenForm::rotateSelection(double direction) m->rotateSelectionVector(o, v, direction * ui.RotateAngleSpin->value()); m->endUndostate(); m->updateMeasurements(); - gui.refresh(); + gui.mainView.postRedisplay(); } /* @@ -156,5 +156,5 @@ void AtenForm::translateSelection(int axis, int dir) } m->endUndostate(); m->updateMeasurements(); - gui.refresh(); + gui.mainView.postRedisplay(); } diff --git a/src/gui/viewactions.cpp b/src/gui/viewactions.cpp index 31b206b7e..a853cd46b 100644 --- a/src/gui/viewactions.cpp +++ b/src/gui/viewactions.cpp @@ -31,19 +31,19 @@ void AtenForm::on_actionViewZoomIn_triggered(bool checked) { master.currentModel()->adjustCamera(0.0,0.0,5.0,0.0); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_actionViewZoomOut_triggered(bool checked) { master.currentModel()->adjustCamera(0.0,0.0,-5.0,0.0); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_actionViewReset_triggered(bool checked) { master.currentModel()->resetView(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_actionViewPerspective_triggered(bool checked) @@ -52,7 +52,7 @@ void AtenForm::on_actionViewPerspective_triggered(bool checked) prefs.setPerspective(TRUE); gui.mainView.doProjection(); master.currentModel()->resetView(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_actionViewOrthographic_triggered(bool checked) @@ -60,21 +60,21 @@ void AtenForm::on_actionViewOrthographic_triggered(bool checked) prefs.setPerspective(FALSE); gui.mainView.doProjection(); master.currentModel()->resetView(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_actionViewModel_triggered(bool checked) { // Switch render focus from the model's trajectory to the model. master.currentModel()->setRenderFromSelf(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_actionViewTrajectory_triggered(bool checked) { // Switch render focus from the model to the trajectory. master.currentModel()->setRenderFromFrames(); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::setCartesianView(double x, double y, double z) @@ -86,7 +86,7 @@ void AtenForm::setCartesianView(double x, double y, double z) // set_rotation() expects the degrees of rotation about the x and y axes respectively, // so give it phi and theta in the reverse order. master.currentModel()->setRotation(-v.z,v.y); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::setCellView(double x, double y, double z) @@ -99,7 +99,7 @@ void AtenForm::setCellView(double x, double y, double z) // set_rotation() expects the degrees of rotation about the x and y axes respectively, // so give it phi and theta in the reverse order. master.currentModel()->setRotation(-v.z,v.y); - gui.refresh(); + gui.mainView.postRedisplay(); } void AtenForm::on_actionViewSetCartesianPosX_triggered(bool checked) diff --git a/src/methods/mc.cpp b/src/methods/mc.cpp index 141bb2e13..d13d9a9bc 100644 --- a/src/methods/mc.cpp +++ b/src/methods/mc.cpp @@ -750,14 +750,11 @@ bool MethodMc::disorder(Model *destmodel) p->setEndAtom( p->startAtom() + p->nAtoms() - 1 ); //printf("PATTERN %li NEW START/END = %i/%i\n",p,p->startAtom(),p->endAtom()); } - //bakmodel.copy(destmodel); - //destmodel->recreate_from_patterns(&bakmodel); - //destmodel->renderFromSelf(); destmodel->foldAllAtoms(); destmodel->calculateMass(); destmodel->calculateDensity(); destmodel->logChange(LOG_COORDS); - gui.refresh(); + gui.modelChanged(); dbgEnd(Debug::Calls,"MethodMc::insert"); return TRUE; }