Skip to content

Commit

Permalink
Fixed missing button icons in Windows CMake build. Privatised enums i…
Browse files Browse the repository at this point in the history
…n src/gui/canvas.h (removing some old unused UserActions along the way), src/classes/measurement.h (renaming GeometryType to MeasurementType), and src/classes/undostate.h. Added new Windows uninstall icon. Fixed undo state creation for Chain drawing going over existing atoms, and spurious persistent bond drawn over the new bond.
  • Loading branch information
t.youngs committed Apr 18, 2008
1 parent cc61707 commit 9bcc19e
Show file tree
Hide file tree
Showing 50 changed files with 458 additions and 451 deletions.
14 changes: 11 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,18 @@ FIND_FILE(HRline history5.dll ENV PATH)
Find_File(qtgui QtGui4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qtgl QtOpenGL4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qtcore QtCore4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)

install(FILES ${qtgui} ${qtgl} ${qtcore} ${Rline} ${HRline}
Find_File(qtsvg QtSvg4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qtxml QtXml4.dll PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
Find_File(qsvg qsvg4.dll PATHS ${QT_PLUGINS_DIR}/iconengines NO_DEFAULT_PATH)
install(FILES ${qtgui} ${qtgl} ${qtcore} ${Rline} ${HRline} ${qtsvg} ${qtxml}
DESTINATION bin
)
message("tt: ${QT_PLUGINS_DIR} ${qsvg}")
install(FILES ${qsvg}
DESTINATION bin/iconengines
)


ENDIF(WIN32)


Expand Down Expand Up @@ -140,7 +148,7 @@ IF(WIN32)
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
Push \\\"ATENDATA\\\"
Push \\\"$INSTDIR\\\\share\\\\aten\\\"
Call WriteEnvStr
Call WriteEnvStr
"
)
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
Expand Down
20 changes: 11 additions & 9 deletions src/classes/measurement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@
#include "classes/cell.h"

// Geometry types
int GT_natoms_[GT_NITEMS] = { 0,2,3,4 };
int natoms_from_GT(GeometryType gt)
{ return GT_natoms_[gt]; }
int MeasurementAtoms[Measurement::nMeasurementTypes] = { 0,2,3,4 };
int Measurement::nMeasurementAtoms(Measurement::MeasurementType mt)
{
return MeasurementAtoms[mt];
}

// Constructor
Measurement::Measurement()
{
// Private variables
type_ = GT_NONE;
type_ = Measurement::NoMeasurement;
for (int n=0; n<4; n++) atoms_[n] = NULL;
value_ = 0.0;
// Public variables
Expand All @@ -41,13 +43,13 @@ Measurement::Measurement()
}

// Set type of Measurement
void Measurement::setType(GeometryType gt)
void Measurement::setType(Measurement::MeasurementType gt)
{
type_ = gt;
}

// Return type of Measurement
GeometryType Measurement::type()
Measurement::MeasurementType Measurement::type()
{
return type_;
}
Expand Down Expand Up @@ -75,13 +77,13 @@ void Measurement::calculate(Cell *cell)
{
switch (type_)
{
case (GT_DISTANCE):
case (Measurement::DistanceMeasurement):
value_ = cell->distance(atoms_[0],atoms_[1]);
break;
case (GT_ANGLE):
case (Measurement::AngleMeasurement):
value_ = cell->angle(atoms_[0],atoms_[1],atoms_[2]) * DEGRAD;
break;
case (GT_TORSION):
case (Measurement::TorsionMeasurement):
value_ = cell->torsion(atoms_[0],atoms_[1],atoms_[2],atoms_[3]) * DEGRAD;
break;
default:
Expand Down
13 changes: 6 additions & 7 deletions src/classes/measurement.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
#ifndef ATEN_MEASUREMENT_H
#define ATEN_MEASUREMENT_H

// Geometry types
enum GeometryType { GT_NONE, GT_DISTANCE, GT_ANGLE, GT_TORSION, GT_NITEMS };
int natoms_from_GT(GeometryType);

// Forward Declarations
class Atom;
class Cell;
Expand All @@ -38,23 +34,26 @@ class Measurement
Measurement();
// List pointers
Measurement *next, *prev;
// Geometry types
enum MeasurementType { NoMeasurement, DistanceMeasurement, AngleMeasurement, TorsionMeasurement, nMeasurementTypes };
static int nMeasurementAtoms(MeasurementType);

/*
// Measurement Data
*/
private:
// Type of Measurement
GeometryType type_;
MeasurementType type_;
// Atoms involved Measurement
Atom* atoms_[4];
// Value of Measurement
double value_;

public:
// Set type of Measurement
void setType(GeometryType gt);
void setType(MeasurementType gt);
// Return type of Measurement
GeometryType type();
MeasurementType type();
// Calculate Measurement value
void calculate(Cell *cell);
// Return value of the Measurement
Expand Down
3 changes: 0 additions & 3 deletions src/classes/pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@
#ifndef ATEN_PATTERN_H
#define ATEN_PATTERN_H

//#include "classes/atom.h"
#include "templates/vector3.h"
#include "templates/list.h"
//#include "classes/ring.h"
//#include "energy/forms.h"
#include "classes/forcefield.h"

// Forward declarations
Expand Down
102 changes: 51 additions & 51 deletions src/classes/undostate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Change::Change()
vecData_[1] = NULL;
vecData_[2] = NULL;
vecData_[3] = NULL;
type_ = UE_NONE;
direction_ = UD_REVERSE;
type_ = Change::NoEvent;
direction_ = Change::Reverse;
// Public variables
prev = NULL;
next = NULL;
Expand Down Expand Up @@ -61,7 +61,7 @@ Change::~Change()
void Change::set(int ue, Atom *i, Atom *j)
{
dbgBegin(Debug::Calls,"Change::set[Atom]");
direction_ = (ue > 0 ? UD_REVERSE : UD_FORWARDS);
direction_ = (ue > 0 ? Change::Reverse : Change::Forwards);
type_ = (UndoEvent) abs(ue);
// Copy atom data from source atoms, unless they are NULL
if (i != NULL)
Expand All @@ -83,7 +83,7 @@ void Change::set(int ue, Atom *i, Atom *j)
void Change::set(int ue, int i, int j, int k, int l, int m)
{
dbgBegin(Debug::Calls,"Change::set[int]");
direction_ = (ue > 0 ? UD_REVERSE : UD_FORWARDS);
direction_ = (ue > 0 ? Change::Reverse : Change::Forwards);
type_ = (UndoEvent) abs(ue);
data_[0] = i;
data_[1] = j;
Expand All @@ -97,7 +97,7 @@ void Change::set(int ue, int i, int j, int k, int l, int m)
void Change::set(int ue, Vec3<double> *v1, Vec3<double> *v2, Vec3<double> *v3, Vec3<double> *v4)
{
dbgBegin(Debug::Calls,"Change::set[vector]");
direction_ = (ue > 0 ? UD_REVERSE : UD_FORWARDS);
direction_ = (ue > 0 ? Change::Reverse : Change::Forwards);
type_ = (UndoEvent) abs(ue);
// Copy data from source vectors, unless they are NULL
if (v1 != NULL)
Expand Down Expand Up @@ -133,9 +133,9 @@ void Change::reverse(Model *m)
Bond *b;
switch (type_)
{
// Atom creation (UD_REVERSE) and deletion (UD_FORWARDS)
case (UE_ATOM):
if (direction_ == UD_REVERSE)
// Atom creation (Change::Reverse) and deletion (Change::Forwards)
case (Change::AtomEvent):
if (direction_ == Change::Reverse)
{
// We delete the atom at the position referenced by the ID in the atom
id = atomData_[0]->id();
Expand All @@ -151,11 +151,11 @@ void Change::reverse(Model *m)
else m->addCopy(modelatoms[id-1], atomData_[0]);
}
break;
// Bond creation (UD_REVERSE) and deletion (UD_FORWARDS)
case (UE_BOND):
// Bond creation (Change::Reverse) and deletion (Change::Forwards)
case (Change::BondEvent):
i = modelatoms[data_[0]];
j = modelatoms[data_[1]];
if (direction_ == UD_REVERSE)
if (direction_ == Change::Reverse)
{
// Delete bond between stored atom ids
msg(Debug::Verbose,"Reversing bond creation - atom ids = %i %i\n", data_[0], data_[1]);
Expand All @@ -168,10 +168,10 @@ void Change::reverse(Model *m)
m->bondAtoms(i,j,(Bond::BondType) data_[2]);
}
break;
// Atom selection (UD_REVERSE) and deselection (UD_FORWARDS)
case (UE_SELECT):
// Atom selection (Change::Reverse) and deselection (Change::Forwards)
case (Change::SelectEvent):
i = modelatoms[data_[0]];
if (direction_ == UD_REVERSE)
if (direction_ == Change::Reverse)
{
msg(Debug::Verbose,"Reversing atom selection - atom id = %i\n", data_[0]);
m->deselectAtom(i);
Expand All @@ -182,12 +182,12 @@ void Change::reverse(Model *m)
m->selectAtom(i);
}
break;
// Bond order change - from data[3] to data[2] (UD_REVERSE) or vice versa (UD_FORWARDS)
case (UE_BONDORDER):
// Bond order change - from data[3] to data[2] (Change::Reverse) or vice versa (Change::Forwards)
case (Change::BondEventORDER):
i = modelatoms[data_[0]];
j = modelatoms[data_[1]];
b = i->findBond(j);
if (direction_ == UD_REVERSE)
if (direction_ == Change::Reverse)
{
msg(Debug::Verbose,"Reversing bond order change - atoms %i-%i, old = %i, new = %i\n", i->id(), j->id(), data_[3], data_[2]);
m->changeBond(b,(Bond::BondType) data_[2]);
Expand All @@ -198,30 +198,30 @@ void Change::reverse(Model *m)
m->changeBond(b,(Bond::BondType) data_[3]);
}
break;
// Geometry measurement creation (UD_REVERSE) and deletion (UD_FORWARDS)
case (UE_MEASUREMENT):
// Geometry measurement creation (Change::Reverse) and deletion (Change::Forwards)
case (Change::MeasurementEvent):
i = modelatoms[data_[1]];
j = modelatoms[data_[2]];
k = modelatoms[data_[3]];
l = modelatoms[data_[4]];
if (direction_ == UD_REVERSE)
if (direction_ == Change::Reverse)
{
GeometryType gt = (GeometryType) data_[0];
msg(Debug::Verbose,"Reversing measurement - type = %i\n", gt);
Measurement *me = m->findMeasurement(gt, i, j, k, l);
Measurement::MeasurementType mt = (Measurement::MeasurementType) data_[0];
msg(Debug::Verbose,"Reversing measurement - type = %i\n", mt);
Measurement *me = m->findMeasurement(mt, i, j, k, l);
if (me != NULL) m->removeMeasurement(me);
}
else
{
GeometryType gt = (GeometryType) data_[0];
msg(Debug::Verbose,"Replaying measurement - type = %i\n", gt);
m->addMeasurement(gt, i, j, k, l);
Measurement::MeasurementType mt = (Measurement::MeasurementType) data_[0];
msg(Debug::Verbose,"Replaying measurement - type = %i\n", mt);
m->addMeasurement(mt, i, j, k, l);
}
break;
// Atom transmute - from data[2] to data[1] (UD_REVERSE) or vice versa (UD_FORWARDS)
case (UE_TRANSMUTE):
// Atom transmute - from data[2] to data[1] (Change::Reverse) or vice versa (Change::Forwards)
case (Change::TransmuteEvent):
i = modelatoms[data_[0]];
if (direction_ == UD_REVERSE)
if (direction_ == Change::Reverse)
{
msg(Debug::Verbose,"Reversing atom transmute - atom %i, old = %i, new = %i\n", i->id(), data_[2], data_[1]);
m->transmuteAtom(i,data_[1]);
Expand All @@ -232,9 +232,9 @@ void Change::reverse(Model *m)
m->transmuteAtom(i,data_[2]);
}
break;
// Cell change - from matrix[1] to matrix[0] (UD_REVERSE) or vice versa (UD_FORWARDS)
case (UE_CELL):
if (direction_ == UD_REVERSE)
// Cell change - from matrix[1] to matrix[0] (Change::Reverse) or vice versa (Change::Forwards)
case (Change::CellEvent):
if (direction_ == Change::Reverse)
{
msg(Debug::Verbose,"Reversing cell change\n");
if (vecData_[0] == NULL) m->removeCell();
Expand All @@ -247,10 +247,10 @@ void Change::reverse(Model *m)
else m->setCell(*vecData_[2], *vecData_[3]);
}
break;
// Atom label change - from data[2] to data[1] (UD_REVERSE) or vice versa (UD_FORWARDS)
case (UE_LABEL):
// Atom label change - from data[2] to data[1] (Change::Reverse) or vice versa (Change::Forwards)
case (Change::LabelEvent):
i = modelatoms[data_[0]];
if (direction_ == UD_REVERSE)
if (direction_ == Change::Reverse)
{
msg(Debug::Verbose,"Reversing atom label change - atom %i, from %i to %i\n",data_[0],data_[2],data_[1]);
i->setLabels(data_[1]);
Expand All @@ -261,10 +261,10 @@ void Change::reverse(Model *m)
i->setLabels(data_[2]);
}
break;
// Atom position change - add (UD_REVERSE) or subtract (UD_FORWARDS) vecData_[0]
case (UE_TRANSLATE):
// Atom position change - add (Change::Reverse) or subtract (Change::Forwards) vecData_[0]
case (Change::TranslateEvent):
i = modelatoms[data_[0]];
if (direction_ == UD_REVERSE)
if (direction_ == Change::Reverse)
{
msg(Debug::Verbose,"Reversing atom translation - atom %i, subtracting %f %f %f\n", data_[0], vecData_[0]->x, vecData_[0]->y, vecData_[0]->z);
i->r() -= *vecData_[0];
Expand All @@ -275,9 +275,9 @@ void Change::reverse(Model *m)
i->r() += *vecData_[0];
}
break;
// Atom list position change - -data[1] (UD_REVERSE) or +data[1] places in list (UD_FORWARDS)
case (UE_SHIFT):
if (direction_ == UD_REVERSE)
// Atom list position change - -data[1] (Change::Reverse) or +data[1] places in list (Change::Forwards)
case (Change::ShiftEvent):
if (direction_ == Change::Reverse)
{
msg(Debug::Verbose,"Reversing atom shift - atom %i moves %i places\n", data_[0]+data_[1], -data_[1]);
m->atoms_.move(data_[0]+data_[1], -data_[1]);
Expand All @@ -301,10 +301,10 @@ void Change::perform(Model *m)
{
dbgBegin(Debug::Calls,"Change::perform");
// Re-use the commands in Change::revert, performing the change in the opposite direction
direction_ = (direction_ == UD_REVERSE ? UD_FORWARDS : UD_REVERSE);
direction_ = (direction_ == Change::Reverse ? Change::Forwards : Change::Reverse);
// Now just call reverse instead, and then set the old direction back at the end
reverse(m);
direction_ = (direction_ == UD_REVERSE ? UD_FORWARDS : UD_REVERSE);
direction_ = (direction_ == Change::Reverse ? Change::Forwards : Change::Reverse);
dbgEnd(Debug::Calls,"Change::perform");
}

Expand All @@ -313,25 +313,25 @@ void Change::perform(Model *m)
*/

// Set log point at start of state
void Undostate::setStartLog(ChangeLog log, int value)
void Undostate::setStartLog(Change::ChangeLog log, int value)
{
startLogs_[log] = value;
}

// Get structure log point at start of state
int Undostate::startLog(ChangeLog log)
int Undostate::startLog(Change::ChangeLog log)
{
return startLogs_[log];
}

// Set log point at end of state
void Undostate::setEndLog(ChangeLog log, int value)
void Undostate::setEndLog(Change::ChangeLog log, int value)
{
endLogs_[log] = value;
}

// Get structure log point at end of state
int Undostate::endLog(ChangeLog log)
int Undostate::endLog(Change::ChangeLog log)
{
return endLogs_[log];
}
Expand Down Expand Up @@ -381,11 +381,11 @@ void Undostate::perform(Model *m)
dbgEnd(Debug::Calls,"Undostate::perform");
}

// Check differences between LOG_STRUCTURE and LOG_COORDS for start/end points
// Check differences between Change::StructureLog and Change::CoordinateLog for start/end points
bool Undostate::doLogsDiffer()
{
if (startLogs_[LOG_STRUCTURE] != endLogs_[LOG_STRUCTURE]) return TRUE;
if (startLogs_[LOG_COORDS] != endLogs_[LOG_COORDS]) return TRUE;
if (startLogs_[LOG_SELECTION] != endLogs_[LOG_SELECTION]) return TRUE;
if (startLogs_[Change::StructureLog] != endLogs_[Change::StructureLog]) return TRUE;
if (startLogs_[Change::CoordinateLog] != endLogs_[Change::CoordinateLog]) return TRUE;
if (startLogs_[Change::SelectionLog] != endLogs_[Change::SelectionLog]) return TRUE;
return FALSE;
}
Loading

0 comments on commit 9bcc19e

Please sign in to comment.