//--------------------------------------------------------------------- // Creates one of our simple document windows and returns a ref to it. // WindowRef MyCreateNewDocumentWindow(void) { IBNibRef nib; WindowRef window = NULL; OSStatus status; // Create one of our special main document windows status = CreateNibReference(CFSTR("main"), &nib); require_noerr( status, CantGetNIBRef ); status = CreateWindowFromNib(nib, CFSTR("MainDocumentWindow"), &window); require_noerr( status, CantCreateWindow ); // Set its default options status = MySetTextViewOptions(GetTextViewFromWindow(window)); check_noerr( status ); // Make the window transparent status = MakeWindowTransparent(window); check_noerr( status ); // Make the TextView partially transparent status = TextViewSetAlpha(GetTextViewFromWindow(window), 0.25); check_noerr( status ); // Initialize the window title and proxy icon status = SetWindowTitleWithCFString(window, CFSTR("Untitled")); check_noerr( status ); status = SetWindowProxyCreatorAndType(window, kUnknownType, kUnknownType, kOnSystemDisk); check_noerr( status ); // Show the window ShowWindow(window); // Cleanup CantGetViewRef: CantCreateWindow: DisposeNibReference(nib); CantGetNIBRef: return window; }
boolean wpedit (hdlexternalvariable hvariable, hdlwindowinfo hparent, ptrfilespec fs, bigstring bstitle, rectparam rzoom) { // // 2006-09-16 creedon: on Mac, set window proxy icon // // 5.0b18 dmb: further protection: set flwindowopen bit before newchildwindow, which will yield // // 1997-04-17 dmb: protect against globals smashing under Windows // // 5.0.2b6 dmb: added flwindowopen loop to handle Windows async overlap // register hdlwpvariable hv = (hdlwpvariable) hvariable; register hdlwprecord hwp; Rect rwindow; WindowPtr w; hdlwindowinfo hi; if (!wpverbinmemory ((hdlexternalvariable) hv)) // couldn't swap it into memory return (false); hwp = (hdlwprecord) (**hv).variabledata; // it's in memory while ((**hwp).flwindowopen) { // bring to front, return true if (shellfinddatawindow ((Handle) hwp, &hi)) { if ((*rzoom).top > -2) shellbringtofront (hi); return (true); } #ifdef MACVERSION break; #else if (!shellyield (false)) return (false); #endif } rwindow = (**hwp).windowrect; // window comes up where it was last time (**hwp).flwindowopen = true; if (!newchildwindow (idwpconfig, hparent, &rwindow, rzoom, bstitle, &w)) { (**hwp).flwindowopen = false; return (false); } wpdata = hwp; // copy into global getwindowinfo (w, &hi); (**hi).hdata = (Handle) hwp; if ( fs != nil ) { (**hi).fspec = *fs; #ifdef MACVERSION if (macfilespecisresolvable (fs)) SetWindowProxyCreatorAndType (w, 'LAND', 'FTwp', kOnSystemDisk); #endif } shellpushglobals (w); wplinkwindowinfo (); shellpopglobals (); // (**hwp).flwindowopen = true; if ((**hwp).fldirty) shellsetwindowchanges (hi, true); windowzoom (w); // show the window to the user. do last, or we'd have to push globals return (true); } // wpedit
boolean menuedit (hdlexternalvariable hvariable, hdlwindowinfo hparent, ptrfilespec fs, bigstring bstitle, rectparam rzoom) { // // 2006-09-16 creedon: on Mac, set window proxy icon // // 5.0d19 dmb: set flwindowopen; use locals, not menu globals. // register hdlmenuvariable hv = (hdlmenuvariable) hvariable; hdlmenurecord hm; Rect rwindow; WindowPtr w; hdlwindowinfo hi; if ((**hv).flinmemory) { if (shellfinddatawindow ((Handle) (**hv).variabledata, &hi)) { if ((*rzoom).top > -2) shellbringtofront (hi); return (true); } } if (!menuverbinmemory (hv)) // error swapping menurecord into memory return (false); hm = (hdlmenurecord) (**hv).variabledata; rwindow = (**hm).menuwindowrect; // window comes up where it was last time if (!newchildwindow (idmenueditorconfig, hparent, &rwindow, rzoom, bstitle, &w)) return (false); getwindowinfo (w, &hi); (**hi).hdata = (Handle) hm; // link data into shell's structure if ( fs != nil ) { (**hi).fspec = *fs; #ifdef MACVERSION if (macfilespecisresolvable (fs)) SetWindowProxyCreatorAndType ( w, 'LAND', 'FTmb', kOnSystemDisk ); #endif } shellpushglobals (w); meeditmenurecord (); shellpopglobals (); (**hm).flwindowopen = true; if ((**hm).fldirty) shellsetwindowchanges (hi, true); windowzoom (w); // show the window to the user return (true); } // menuedit