00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <math.h>
00025 #include "PickModeUser.h"
00026 #include "Pickable.h"
00027 #include "DisplayDevice.h"
00028 #include "Inform.h"
00029 #include "DrawMolecule.h"
00030 #include "CommandQueue.h"
00031 #include "TextEvent.h"
00032 #include "VMDApp.h"
00033 #include "utilities.h"
00034
00035 PickModeUser::PickModeUser(VMDApp *vmdapp)
00036 : app(vmdapp) {
00037 needName = FALSE;
00038
00039
00040 haveItems = 0;
00041 }
00042
00043 void PickModeUser::pick_molecule_start(DrawMolecule *mol, DisplayDevice *d,
00044 int, int tag, const int * , int dim, const float *pos) {
00045
00046 atom = tag;
00047 memcpy(pPos, pos, dim*sizeof(float));
00048 needName = TRUE;
00049
00050 int shift_pressed = d->shift_state() & DisplayDevice::SHIFT;
00051 app->commandQueue->runcommand(new PickAtomEvent(mol->id(), tag,
00052 shift_pressed, true));
00053 }
00054
00055 void PickModeUser::pick_molecule_end(DrawMolecule *m, DisplayDevice *) {
00056
00057 if(needName) {
00058
00059
00060 int id = m->id();
00061 molid = id;
00062 atmid = atom;
00063
00064
00065 haveItems++;
00066
00067
00068 if(haveItems >= 1) {
00069 msgInfo << "User Pick: mol" << molid << " atom:" << atmid << sendmsg;
00070
00071 haveItems = 0;
00072 }
00073 }
00074 needName = FALSE;
00075 }
00076