/* called by SystemMenue / Print */ LRESULT PrintPlot( HWND hwnd) { GRAPH * graph; GRAPH * temp; /* get pointer to graph */ graph = pGraph( hwnd); if (!graph) return 0; /* switch to printer */ /* (results in WPRINT_Init()) */ if (DevSwitch("WinPrint")) return 0; /* Cursor = wait */ SetCursor( LoadCursor( NULL, IDC_WAIT)); /* copy graph */ temp = CopyGraph(graph); if (!temp) goto PrintEND; /* add to the copy the new printer data */ if (NewViewport(temp)) goto PrintEND2; /* make correction to placement of grid (copy from gr_init) */ temp->viewportxoff = temp->fontwidth * 8; temp->viewportyoff = temp->fontheight * 4; /* print the graph */ gr_resize(temp); PrintEND2: /* delete temporary graph */ DestroyGraph(temp->graphid); PrintEND: /* switch back to screen */ DevSwitch(NULL); /* Cursor = normal */ SetCursor( LoadCursor( NULL, IDC_ARROW)); return 0; }
void com_quit(wordlist *wl) { int exitcode = EXIT_NORMAL; bool noask = (wl && wl->wl_word && 1 == sscanf(wl->wl_word, "%d", &exitcode)) || (wl && wl->wl_word && cieq(wl->wl_word, "noask")) || cp_getvar("noaskquit", CP_BOOL, NULL); /* update screen and reset terminal */ gr_clean(); cp_ccon(FALSE); /* Make sure the guy really wants to quit. */ if (!ft_nutmeg) if (!noask && !confirm_quit()) return; /* start to clean up the mess */ #ifdef SHARED_MODULE { wordlist all = { "all", NULL, NULL }; wordlist star = { "*", NULL, NULL }; // com_remcirc(NULL); com_destroy(&all); com_unalias(&star); com_undefine(&star); cp_remvar("history"); cp_remvar("noglob"); cp_remvar("brief"); cp_remvar("sourcepath"); cp_remvar("program"); cp_remvar("prompt"); } #endif #ifdef EXPERIMENTAL_CODE /* Destroy CKT when quit. Add by Gong Ding, [email protected] */ if (!ft_nutmeg) { struct circ *cc; for (cc = ft_circuits; cc; cc = cc->ci_next) if (SIMinfo.deleteCircuit) SIMinfo.deleteCircuit(cc->ci_ckt); } #endif #ifdef SHARED_MODULE /* Destroy CKT when quit. */ if (!ft_nutmeg) { while(ft_curckt) com_remcirc(NULL); } #endif DevSwitch(NULL); DevSwitch(NULL); /* then go away */ #ifdef SHARED_MODULE cp_destroy_keywords(); destroy_ivars(); #endif byemesg(); #ifdef SHARED_MODULE destroy_const_plot(); spice_destroy_devices(); #endif #ifdef SHARED_MODULE /* add 1000 to notify that we exit from 'quit' */ controlled_exit(1000 + exitcode); #else exit(exitcode); #endif }