4 * Created by Toshi Nagata on Sun Jun 17 2001.
6 Copyright (c) 2010 Toshi Nagata. All rights reserved.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation version 2 of the License.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
18 /* Empty stub functions for command-line tool */
21 #include "Ruby_bind/Molby_extern.h"
33 MoleculeCallback_moleculeAtOrderedIndex(int idx)
39 MainViewCallback_setNeedsDisplay(MainView *mview, int flag)
45 MainViewCallback_moleculeReplaced(MainView *mview, struct Molecule *mol)
51 MyAppCallback_beginUndoGrouping(void)
56 MoleculeCallback_currentMolecule(void)
62 MoleculeCallback_lockMutex(void *mutex)
67 MoleculeCallback_unlockMutex(void *mutex)
72 MoleculeCallback_callSubProcessAsync(Molecule *mol, const char *cmd, int (*callback)(Molecule *, int), int (*timerCallback)(Molecule *, int), FILE *output, FILE *errout)
78 MyAppCallback_setGlobalSettings(const char *key, const char *value)
83 MyAppCallback_hideProgressPanel(void)
88 MyAppCallback_showScriptMessage(const char *fmt, ...)
92 return vprintf(fmt, ap);
96 MyAppCallback_getDocumentHomeDir(void)
100 return (s == NULL ? NULL : strdup(s));
104 MyAppCallback_getHomeDir(void)
108 return (s == NULL ? NULL : strdup(s));
112 MyAppCallback_executeScriptFromFile(const char *path, int *status)
118 MyAppCallback_setProgressMessage(const char *msg)
123 MainView_isAtomHidden(MainView *mview, int index)
129 MolActionCallback_isUndoRegistrationEnabled(Molecule *mol)
135 MyAppCallback_messageBox(const char *message, const char *title, int flags, int icon)
137 return printf("%s\n%s\n", title, message);
141 MainViewCallback_drawInfoText(MainView *mview, const char *label)
146 MyAppCallback_checkInterrupt(void)
152 MyAppCallback_getGlobalSettings(const char *key)
158 MyAppCallback_setProgressValue(double dval)
163 MyAppCallback_showProgressPanel(const char *msg)
168 MyAppCallback_getTextWithPrompt(const char *prompt, char *buf, int bufsize)
175 MyAppCallback_callSubProcess(const char *cmdline, const char *procname, int (*callback)(void *), void *callback_data, FILE *output, FILE *errout)
177 return system(cmdline);
181 MainViewCallback_display(MainView *mview)
186 MainViewCallback_makeFront(MainView *mview)
191 MolActionCallback_setUndoRegistrationEnabled(Molecule *mol, int flag)
197 MoleculeCallback_notifyModification(Molecule *mp, int now_flag)
202 MyAppCallback_setConsoleColor(int color)
207 MyAppCallback_errorMessageBox(const char *fmt, ...)
211 vfprintf(stderr, fmt, ap);
215 MyAppCallback_registerScriptMenu(const char *title)
221 MyAppCallback_lookupScriptMenu(const char *title)
227 MyAppCallback_endUndoGrouping(void)
232 MyAppCallback_showConsoleWindow(void)
237 MyAppCallback_hideConsoleWindow(void)
242 MoleculeCallback_openNewMolecule(const char *fname)
247 void MyAppCallback_bell(void)
251 int MyAppCallback_playSound(const char *filename, int flag)
256 void MyAppCallback_stopSound(void)
261 MainView_getCamera(MainView *mview, Vector *outCamera, Vector *outLookAt, Vector *outUp)
266 RubyDialogInitClass(void)
271 MoleculeCallback_moleculeAtIndex(int idx)
277 MoleculeCallback_displayName(Molecule *mol, char *buf, int bufsize)
283 MoleculeCallback_setDisplayName(Molecule *mol, const char *name)
289 MoleculeCallback_pathName(Molecule *mol, char *buf, int bufsize)
291 if (mol != NULL && mol->path != NULL) {
292 strncpy(buf, mol->path, bufsize - 1);
293 buf[bufsize - 1] = 0;
298 MainView_selectedMO(MainView *mview)
304 MainView_resizeToFit(MainView *mview)
309 MolActionCallback_registerUndo(Molecule *mol, MolAction *action)
314 main(int argc, char **argv)
318 static const char fname[] = "startup.rb";
319 char *molbydir = getenv("MOLBYDIR");
320 if (molbydir == NULL) {
321 fprintf(stderr, "Please define the environmental variable MOLBYDIR to specify the location in which the 'Scripts' directory is present.\n");
324 asprintf(&scriptdir, "%s%cScripts", molbydir, PATH_SEPARATOR);
325 fd = open(".", O_RDONLY);
328 Molby_startup(fname, scriptdir);
335 ruby_run_node(ruby_options(argc, argv));