本文整理汇总了C++中VMDApp::molecule_load方法的典型用法代码示例。如果您正苦于以下问题:C++ VMDApp::molecule_load方法的具体用法?C++ VMDApp::molecule_load怎么用?C++ VMDApp::molecule_load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VMDApp
的用法示例。
在下文中一共展示了VMDApp::molecule_load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle
int handle(int event) {
// handle paste operations
if (event == FL_PASTE) {
// ignore paste operations that weren't due to drag-and-drop
// since they could be any arbitrary data/text, and not just filenames.
if (dragpending) {
int len = Fl::event_length();
// ignore zero-length paste events (why do these occur???)
if (len > 0) {
int numfiles, i;
const char *lastc;
int lasti;
FileSpec spec;
const char *ctext = Fl::event_text();
char *filename = (char *) malloc((1 + len) * sizeof(char));
for (lasti=0,lastc=ctext,numfiles=0,i=0; i<len; i++) {
// parse out all but last filename, which doesn't have a CR
if (ctext[i] == '\n') {
memcpy(filename, lastc, (i-lasti)*sizeof(char));
filename[i-lasti] = '\0';
// attempt to load the file into a new molecule
app->molecule_load(-1, filename, NULL, &spec);
lasti=i+1;
lastc=&ctext[lasti];
numfiles++;
}
// special-case last filename, since there's no CR
if (i == (len-1)) {
memcpy(filename, lastc, (1+i-lasti)*sizeof(char));
filename[1+i-lasti] = '\0';
// attempt to load the file into a new molecule
app->molecule_load(-1, filename, NULL, &spec);
numfiles++;
}
}
free(filename);
}
dragpending = 0; // no longer waiting for drag-and-drop paste
}
return 1; // indicate that we handled the paste operation
}
// handle drag-and-drop operations
if (event == FL_DND_ENTER || event == FL_DND_DRAG) {
return 1; // indicate that we want the drag-and-drop operation
}
if (event == FL_DND_RELEASE) {
Fl::paste(*this);
dragpending = 1; // flag to expect incoming paste due to DND operation
return 1;
}
// end of cut-paste and drag-and-drop handling
switch (event) {
case FL_MOUSEWHEEL:
dispdev->lastevent = event;
dispdev->lastzdelta = Fl::event_dy();
break;
case FL_PUSH:
dispdev->lastevent = event;
dispdev->lastbtn = Fl::event_button();
if (dispdev->lastbtn == FL_LEFT_MOUSE && Fl::event_state(FL_META)) {
dispdev->lastbtn = FL_MIDDLE_MOUSE;
}
break;
case FL_DRAG:
dispdev->lastevent = event;
break;
case FL_RELEASE:
dispdev->lastevent = event;
break;
#if (FL_MAJOR_VERSION >= 1) && (FL_MINOR_VERSION >= 1)
case FL_KEYDOWN:
#else
// This event code is superceded by FL_KEYDOWN in newer revs of FLTK
case FL_KEYBOARD:
#endif
dispdev->lastevent = event;
dispdev->lastkeycode = Fl::event_key();
dispdev->lastbtn = *Fl::event_text();
break;
default:
return Fl_Gl_Window::handle(event);
}
return 1;
}