void ListEditor::quitConfirmDone(int result) { switch(result) { case QMessageBox::Save: saveMacro(); case QMessageBox::Discard: qApp->quit(); break; } }
int macroLoad(char *name, char *filepath) { node *codeTree; int res; rmMacro(name); renameAllocation("newMacro","tmpSavenewMacro"); if ( (codeTree = loadMacro(filepath,NOSEARCH, &res)) ) { saveMacro(name,codeTree,PERMANENT); releaseAllWithId("newMacro"); renameAllocation("tmpSavenewMacro","newMacro"); return(0); } releaseAllWithId("newMacro"); renameAllocation("tmpSavenewMacro","newMacro"); return(-1); }
/*-------------------------------------------------------------------------- | | macroLd | | This command loads a macro into cache memory. If the macro | of the same name already exists in the cache memory, it is first | deleted before the new macro is loaded. | /+--------------------------------------------------------------------------*/ int macroLd(int argc, char *argv[], int retc, char *retv[]) { int i; node *codeTree; int res; int ret = 0; if (argc == 1) { Werrprintf("Usage -- %s('macro1'[,'macro2',...])",argv[0]); ABORT; } else { if (retc > 1) WstoreMessageOn(); for (i=1;i<argc;i++) { TPRINT1("macroLd: removing macro \"%s\"\n",argv[i]); rmMacro(argv[i]); renameAllocation("newMacro","tmpSavenewMacro"); if (argv[i][0] == '/') { char *s; s = strrchr(argv[i],'/'); rmMacro(s+1); if ( (codeTree = loadMacro(argv[i],NOSEARCH, &res)) ) { TPRINT1("macroLd: saving macro \"%s\"\n",s+1); saveMacro(s+1,codeTree,PERMANENT); ret = 1; if (!retc) Winfoprintf("Loaded macro '%s'",s+1); else if (retc > 1) sprintf(storeMessage,"Loaded macro '%s'",s+1); } } else if ( (codeTree = loadMacro(argv[i],SEARCH, &res)) ) { TPRINT1("macroLd: saving macro \"%s\"\n",argv[i]); saveMacro(argv[i],codeTree,PERMANENT); ret = 1; if (!retc) Winfoprintf("Loaded macro '%s'",argv[i]); else if (retc > 1) sprintf(storeMessage,"Loaded macro '%s'",argv[i]); } releaseAllWithId("newMacro"); renameAllocation("tmpSavenewMacro","newMacro"); } if (retc) { retv[0] = intString( ret ); if (retc > 1) { retv[1] = newString(storeMessage); WstoreMessageOff(); } } } RETURN; }