예제 #1
0
파일: gfx.c 프로젝트: 3calabera/tiny3d
void LoadTexture()
{

    u32 * texture_mem = tiny3d_AllocTexture(64*1024*1024); // alloc 64MB of space for textures (this pointer can be global)    


    if(!texture_mem) return; // fail!

    texture_pointer = texture_mem;

    ResetFont();
    texture_pointer = (u32 *) AddFontFromBitmapArray((u8 *) font  , (u8 *) texture_pointer, 32, 255, 16, 32, 2, BIT0_FIRST_PIXEL);

    // here you can add more textures using 'texture_pointer'. It is returned aligned to 16 bytes

    jpg1.jpg_in= (void *) psl1ght_jpg_bin;
	jpg1.jpg_size= sizeof(psl1ght_jpg_bin);

    LoadJPG(&jpg1, NULL);

    jpg1_offset = 0;
       
    if(jpg1.bmp_out) {

        memcpy(texture_pointer, jpg1.bmp_out, jpg1.wpitch * jpg1.height);
        
        free(jpg1.bmp_out);

        jpg1.bmp_out= texture_pointer;

        texture_pointer += (jpg1.wpitch/4 * jpg1.height + 3) & ~3; // aligned to 16 bytes (it is u32) and update the pointer

        jpg1_offset = tiny3d_TextureOffset(jpg1.bmp_out);      // get the offset (RSX use offset instead address)
     }
}
예제 #2
0
/*!
@brief フォントをデバイスロストから復帰させる。
@par   関数説明
デバイスロストでフォント設定が全て消えるので、それを再設定する。
@return 0を返す。
*/
int DirectXDraw9::FontRecover( void )
{
	unsigned int f;

	for ( f = 0; f < fontmax; ++f )
	{
		ResetFont( f );
	}

	return 0;
}
예제 #3
0
int CFontGen::Prepare()
{
	if( isWorking ) return -1;
	arePagesGenerated = false;

	// Update some properties that are exclusive
	if( fourChnlPacked && outBitDepth != 32 )
		Set4ChnlPacked(false);

	ResetFont();

	return 0;
}
예제 #4
0
파일: main.c 프로젝트: Estwald/PSDK3v2
void LoadTexture()
{

    u32 * texture_mem = tiny3d_AllocTexture(64*1024*1024); // alloc 64MB of space for textures (this pointer can be global)
    
    u32 * texture_pointer; // use to asign texture space without changes texture_mem

    if(!texture_mem) return; // fail!

    ResetFont();

    texture_pointer = texture_mem;

    texture_pointer = (u32 *) AddFontFromBitmapArray((u8 *) msx   , (u8 *) texture_pointer,  0, 254,  8,  8, 1, BIT7_FIRST_PIXEL);
    
}
예제 #5
0
파일: main.c 프로젝트: Estwald/PSDK3v2
void LoadTexture()
{

    u32 * texture_mem = tiny3d_AllocTexture(64*1024*1024); // alloc 64MB of space for textures (this pointer can be global)    

    u32 * texture_pointer; // use to asign texture space without changes texture_mem

    if(!texture_mem) return; // fail!

    texture_pointer = texture_mem;

    ResetFont();
    texture_pointer = (u32 *) AddFontFromBitmapArray((u8 *) font  , (u8 *) texture_pointer, 32, 255, 16, 32, 2, BIT0_FIRST_PIXEL);
    texture_pointer = (u32 *) AddFontFromBitmapArray((u8 *) font_b, (u8 *) texture_pointer, 32, 255, 16, 32, 2, BIT0_FIRST_PIXEL);
    texture_pointer = (u32 *) AddFontFromBitmapArray((u8 *) msx   , (u8 *) texture_pointer,  0, 254,  8,  8, 1, BIT7_FIRST_PIXEL);

    // here you can add more textures using 'texture_pointer'. It is returned aligned to 16 bytes
}
예제 #6
0
static void
ResetFonts(bool bUseCustom)
{
  ResetFont(TempInfoWindowFont, bUseCustom,
            szProfileFontInfoWindowFont, log_infobox);
  ResetFont(TempTitleWindowFont, bUseCustom,
            szProfileFontTitleWindowFont, log_title);
  ResetFont(TempMapWindowFont, bUseCustom,
            szProfileFontMapWindowFont, log_map);
  ResetFont(TempTitleSmallWindowFont, bUseCustom,
            szProfileFontTitleSmallWindowFont, log_infobox_small);
  ResetFont(TempMapWindowBoldFont, bUseCustom,
            szProfileFontMapWindowBoldFont, log_map_bold);
  ResetFont(TempCDIWindowFont, bUseCustom,
            szProfileFontCDIWindowFont, log_cdi);
  ResetFont(TempMapLabelFont, bUseCustom,
            szProfileFontMapLabelFont, log_map_label);
  ResetFont(TempMapLabelImportantFont, bUseCustom,
            szProfileFontMapLabelImportantFont, log_map_label_important);
}
예제 #7
0
static void
ResetFonts(bool bUseCustom)
{
  ResetFont(TempInfoWindowFont, bUseCustom,
            szProfileFontInfoWindowFont, LogInfoBox);
  ResetFont(TempTitleWindowFont, bUseCustom,
            szProfileFontTitleWindowFont, LogTitle);
  ResetFont(TempMapWindowFont, bUseCustom,
            szProfileFontMapWindowFont, LogMap);
  ResetFont(TempTitleSmallWindowFont, bUseCustom,
            szProfileFontTitleSmallWindowFont, LogInfoBoxSmall);
  ResetFont(TempMapWindowBoldFont, bUseCustom,
            szProfileFontMapWindowBoldFont, LogMapBold);
  ResetFont(TempCDIWindowFont, bUseCustom,
            szProfileFontCDIWindowFont, LogCDI);
  ResetFont(TempMapLabelFont, bUseCustom,
            szProfileFontMapLabelFont, LogMapLabel);
  ResetFont(TempMapLabelImportantFont, bUseCustom,
            szProfileFontMapLabelImportantFont, LogMapLabelImportant);
}
예제 #8
0
파일: main.c 프로젝트: 3calabera/tiny3d
void LoadTexture()
{

    u32 * texture_mem = tiny3d_AllocTexture(64*1024*1024); // alloc 64MB of space for textures (this pointer can be global)
    
    u32 * texture_pointer; // use to asign texture space without changes texture_mem

    if(!texture_mem) exit(0); // fail!

    texture_pointer = texture_mem;


    Load_PNG();

    if(!png1.bmp_out) exit(0); // fail!

    ResetFont();
    texture_pointer = (u32 *) AddFontFromBitmapArray((u8 *) msx, (u8 *) texture_pointer,  0, 254,  8,  8, 1, BIT7_FIRST_PIXEL);

    // build AYUV 32 bits map from PNG

    texture[0].addr   = (void *) texture_pointer;
    texture[0].offset = tiny3d_TextureOffset(texture_pointer);
    texture[0].w      = png1.width;
    texture[0].h      = png1.height;
    texture[0].stride = png1.wpitch;

    texture_pointer = (u32 *) build_AYUV_32bits((u8 *)texture_pointer, png1.bmp_out, png1.width, png1.height, png1.wpitch);

    

    // build Y 8 bits map from PNG (width * height) * 1

    texture[1].addr   = (void *) texture_pointer;
    texture[1].offset = tiny3d_TextureOffset(texture_pointer);
    texture[1].w      = png1.width;
    texture[1].h      = png1.height;
    texture[1].stride = png1.wpitch/4;

    texture_pointer = (u32 *)  build_Y_8bits((u8 *)texture_pointer, png1.bmp_out, png1.width, png1.height, png1.wpitch);

    // build U 8 bits map from PNG (width/2 * height/2) * 1

    texture[2].addr   = (void *) texture_pointer;
    texture[2].offset = tiny3d_TextureOffset(texture_pointer);
    texture[2].w      = png1.width/2;
    texture[2].h      = png1.height/2;
    texture[2].stride = texture[2].w;

    texture_pointer = (u32 *)  build_U_8bits((u8 *)texture_pointer, png1.bmp_out, png1.width, png1.height, png1.wpitch);

    // build V 8 bits map from PNG (width/2 * height/2) * 1

    texture[3].addr   = (void *) texture_pointer;
    texture[3].offset = tiny3d_TextureOffset(texture_pointer);
    texture[3].w      = png1.width/2;
    texture[3].h      = png1.height/2;
    texture[3].stride = texture[3].w;

    texture_pointer = (u32 *)  build_V_8bits((u8 *)texture_pointer, png1.bmp_out, png1.width, png1.height, png1.wpitch);


}
예제 #9
0
s32 main(s32 argc, const char* argv[])
{

    int count = 0;
    int n;
    padInfo padinfo;
	padData paddata;

    char *cur_device = "/ntfs0:";
    char path[1024];

    // map file functions to libc open, fopen, ...
    NTFS_init_system_io();

    tiny3d_Init(1024*1024);
    tiny3d_Project2D();

    u32 * texture_mem = tiny3d_AllocTexture(64*1024*1024); // alloc 64MB of space for textures (this pointer can be global)    

    u32 * texture_pointer; // use to asign texture space without changes texture_mem

    if(!texture_mem) return 0; // fail!

    texture_pointer = texture_mem;

    ResetFont();
    texture_pointer = (u32 *) AddFontFromBitmapArray((u8 *) font  , (u8 *) texture_pointer, 32, 255, 16, 32, 2, BIT0_FIRST_PIXEL);

    initConsole();
    ioPadInit(7);

    DbgHeader("NTFS EXT2/3/4 Example");
    
   /*
    // Mount all NTFS volumes on all inserted block devices
    mountCount = ntfsMountAll(&mounts, NTFS_DEFAULT | NTFS_RECOVER);

   // mountCount = ntfsMountDevice (&__io_ntfs_usb000, &mounts, NTFS_DEFAULT | NTFS_RECOVER);
    
    if (mountCount == -1)
        DPrintf("Error whilst mounting devices (%i).\n", errno);
    else if (mountCount == 0)
        DPrintf("No NTFS volumes were found and/or mounted.\n");
    else
        DPrintf("%i NTFS volumes(s) mounted!\n\n", mountCount);
    */


    int i;

    count = 1;
    
    while(1) {
    if(count > 0) {
        count--;
        if(count == 0) {
            int k;
            initConsole();
            
            for(k = 0; k < 8; k++) {
                for (i = 0; i < mountCount[k]; i++)
                DPrintf("%i - %s:/ (%s) (from usb00%i)\n", i + 1, 
                (mounts[k]+i)->name, ntfsGetVolumeName((mounts[k] + i)->name), 
                    ((mounts[k] + i)->interface->ioType & 0xff) - '0');
            }

            
            int r;

            cur_device = NULL;
            r = NTFS_Test_Device("ext0"); DPrintf("\nTest ext0 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ext0:";

            r = NTFS_Test_Device("ext1"); DPrintf("Test ext1 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ext1:";

            r = NTFS_Test_Device("ext2"); DPrintf("Test ext2 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ext2:";

            r = NTFS_Test_Device("ext3"); DPrintf("Test ext3 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ext3:";

            r = NTFS_Test_Device("ntfs0"); DPrintf("Test ntfs0 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ntfs0:";

            r = NTFS_Test_Device("ntfs1"); DPrintf("Test ntfs1 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ntfs1:";

            r = NTFS_Test_Device("ntfs2"); DPrintf("Test ntfs2 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ntfs2:";

            r = NTFS_Test_Device("ntfs3"); DPrintf("Test ntfs3 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ntfs3:";

            if(!cur_device) cur_device = "/ntfs0:"; // by default
            
          

        }
    }

    DbgHeader("NTFS EXT2/3/4 Example");
    DbgMess("Press X to list device, O to test file and /\\ to exit");

    for(i = 0; i < 8 ; i++) {
        int r = NTFS_Event_Mount(i);

        if(r == 1) { // mount device
            
            NTFS_UnMount(i);

            mounts[i] = NULL;
            mountCount[i] = 0;

            mountCount[i] = ntfsMountDevice (disc_ntfs[i], &mounts[i], NTFS_DEFAULT | NTFS_RECOVER);
            
            if(mountCount[i]>0) {count = 1;} // update counter
        } else if(r == -1) { // unmount device
            NTFS_UnMount(i);
            count = 1;
        }
    }

    

  //  DbgMess();


    DbgDraw();
    tiny3d_Flip();
    ioPadGetInfo(&padinfo);

            for(n = 0; n < MAX_PADS; n++) {
                static u32 btn_flags = 0;
            
                if(padinfo.status[n]) {
                    
                    ioPadGetData(n, &paddata);
                   
                    if(paddata.BTN_CROSS) {
                        if((btn_flags & 1)==0){
                            btn_flags|=1;
                            max_list = 0;
                            initConsole();

                            count = 300;

                            DPrintf("Listing 10 entries from %s (5 seconds)\n", cur_device);
                            
                            sprintf(path, "%s", cur_device);

                            list(path, 0);
                           
                        }
        
                    } else btn_flags&=~1;

                    if(paddata.BTN_CIRCLE) {
                        if((btn_flags & 2)==0){
                            btn_flags|=2;
                            
                            DPrintf("\n\nWriting / Reading a file from %s\n", cur_device);
                            
                            sprintf(path, "%s/0text", cur_device);
                            
                            mkdir(path, 0777);

                            sprintf(path, "%s/0text/test.txt", cur_device);

                            FILE *fp;
                          
                            fp =fopen(path, "wb");
        
                            if(fp) {

                                int i;
 
                                i = fwrite(message, 1, strlen(message), fp);

                                if(i != strlen(message)) DPrintf("Error writing the file!\n");

                                fclose(fp);
                      

                            } else DPrintf("Error creating the file!\n");
           
                            memset(buffer, 0, 1024);

                            sprintf(path, "%s/0text/test.txt", cur_device);

                            fp = fopen(path, "rb");

             
                            if(fp) {

                                int i;

                 // NOTE: for files > 2GB you can use 64 bit method

                                #ifdef USE_64BIT_SEEK
    
                                struct _reent reent1;

                                DPrintf ("Using _lseek64_r for large files\n");

                                s64 size = _lseek64_r(&reent1, fp->_file, 0, SEEK_END);
                                
                                _lseek64_r(&reent1, fp->_file, 0, SEEK_SET);

                                DPrintf ("Size of file %i bytes\n", (int) size);

                                #else

                                fseek(fp, 0, SEEK_END);

                                int size = ftell(fp);

                                DPrintf ("Size of file %i bytes\n", size);

                                fseek(fp, 0, SEEK_SET);

                                #endif
                                
                                i = fread(buffer, 1, size, fp);

                                if(i != size) DPrintf("Error reading the file %i!\n", i);

                                fclose(fp);

                            } else DPrintf("Error Reading the file!\n");

                            DPrintf("Readed From file: %s\n\n", buffer);
                        }
 
                        
                    } else btn_flags&=~2;



                    if(paddata.BTN_TRIANGLE){
                       
                        goto out;				
        
                    }
                }
            }

    
           
    }

    out:;
    DPrintf("Umounting\n");
    DbgDraw();
    tiny3d_Flip();
 
    NTFS_UnMountAll();

	return 0;
}
예제 #10
0
/* %%Function:FIdle %%Owner:PETERJ */
FIdle()
{ /* Idle routine -- executes in the background when no messages are waiting */
	/* Returns fTrue iff there is a message in the queue on return */

	/* WARNING: in Preview mode, we skip everything except:
				Enable AwfulNoise
				OnTime Macro
				Updating Menus
				Initializing SDM
				Autosave
				Debug Checks
		Due to the special nature of the font cache while in preview, we cannot
		do FormatLines except while in the preview code!
	*/
	extern int vfDeactByOtherApp;
	extern int vlm;
	extern HWND vhwndRibbon;
	extern HWND vhwndStatLine;
	struct RPL rpl;
	struct LBS lbsText, lbsFtn;
	int ww;
	int wwHdr = wwNil;
	int docCur = PselActive()->doc;
	static int cPassUninterrupt = 0;
#define cPassOne    5
#define cPassTwo    20

#ifdef DEBUG
	int iGotoLRet = -1;
#endif /* DEBUG */

	Assert(vidf.fInIdle == 0);
	vidf.fInIdle = fTrue;

#ifdef RSH
	RestartUatTimer();
	CheckUat();
#endif /* RSH */

	Assert(vpvs.lmSave != lmPreview);
#ifdef BATCH
	/* If vfBatchIdle is true, allow idle-ing in batch mode */
	if (vfBatchMode && !vfBatchIdle)
		BatchModeError(SzShared("Idle entered!"), NULL, 0, 0);
#endif /* BATCH */

/* if free heap space has changed, dump the new cbFree to the comm port */
	Debug (vdbs.fReportHeap ? ReportHeapSz (SzShared("memory usage "), 1) : 0);
	Debug (vdbs.fHeapAct||vdbs.fWinAct ? ReportFailCalls() : 0);

#ifdef DEBUG
/* show each pass through idle */
		{
		static int cIdlePasses = 0;

		Scribble (ispIdle1, 'I'); /* indicate in idle */
		Scribble (ispIdle2, '0'+cIdlePasses);
		cIdlePasses = (cIdlePasses + 1) % 10;
		}

	if (vdbs.fShowDirty)
		ScribbleDirty(DocMother(selCur.doc));
#endif  /* DEBUG */

	Assert( cHpFreeze == 0 );
	Debug( cHpFreeze = 0 );
	Assert( vfInsertMode || cpInsert == cpNil );
	Assert(vcPreload == 0 && vfnPreload == fnNil);

	ClearInputState();

	if (vidf.fInvalSeqLev)
		{
		InvalSeqLevFields();
		Assert(!vidf.fInvalSeqLev);
		}

/* Re-enable beep, disk full alert, memory alert, other alerts */
	vfAwfulNoise = fFalse;

	if (vlm == lmPreview)
		goto LPrvw1;

/* Reset the cound of consecutive scrolls. */
	if (vcConseqScroll != 0 &&
			GetKeyState(VK_UP) >= 0 && GetKeyState(VK_DOWN) >= 0 &&
			GetKeyState(VK_LBUTTON) >= 0 && GetKeyState(VK_RBUTTON) >= 0)
		{
		vcConseqScroll = 0;
		}

	Assert(vlm != lmPreview);
/* Update all document windows */
	UpdateAllWws( fTrue );

	Debug (iGotoLRet = 0);
	if (FMsgPresent(mtyIdle & ~mtyMouseMove))
		goto LRet;

/* scroll active cp of selection into view */
	if (vfSeeSel && hwwdCur != hNil)
		SeeSel();
	vfSeeSel = fFalse;

	Debug (iGotoLRet = 1);
	if (FMsgPresent(mtyIdle))
		goto LRet;

	Assert(vlm != lmPreview);
/* turn on selection highlight */
	if (!vfDeactByOtherApp)
		{
		if (!selCur.fNil && selCur.fHidden)
			TurnOnSelCur();
		if (!selDotted.fNil && selDotted.fHidden)
			TurnOnSel(&selDotted);
		}

	Debug (iGotoLRet = 2);
	if (FMsgPresent(mtyIdle))
		goto LRet;

	Assert(vlm != lmPreview);

/* make sure we have our full swap area (or reduce if we have used up memory) */
	if (!(cPassUninterrupt+1 & 0x00ff))
		{
#ifdef DEBUG
		if (vcShrinkSwapArea != 0)
			ReportSz("vcShringSwapArea non zero at idle");
#endif /* DEBUG */
		vcShrinkSwapArea = 0;
		OurSetSas(sasFull);
		}

/* bring in our core (wait until now so screen is up to date & we don't
	postpone our responsiveness) */
	if (cPassUninterrupt > cPassOne)
		CoreNewest (cPassUninterrupt >= cPassTwo/*fLoad*/);

	Debug (iGotoLRet = 3);
	if (FMsgPresent(mtyIdle))
		goto LRet;

/* update ruler */
	if (hmwdCur != hNil && (*hmwdCur)->hwndRuler != hNil)
		if (selCur.fUpdatePap || selCur.fUpdateRuler)
			UpdateRuler(hmwdCur, fFalse /*!fInit*/, -1/*rk*/, fTrue /*fAbortOK*/);

	Debug (iGotoLRet = 4);
	if (FMsgPresent(mtyIdle))
		goto LRet;

	Assert(vlm != lmPreview);
/* update outline iconbar if in outline. */
	if (hwwdCur != hNil && (*hwwdCur)->fOutline)
		{
		UpdateOutlineIconBar();
		}

	Debug (iGotoLRet = 5);
	if (FMsgPresent(mtyIdle))
		goto LRet;

/* Update the beautification of edited text in the various macro windows */
	if (vhmes != hNil)
		{
		uns imei;
		uns imeiMax;
		MEI * pmei;
		MES * pmes;
		struct CA ca;

		pmes = *vhmes;
		pmei = &pmes->rgmei[0];
		imeiMax = pmes->imeiMax;
		for (imei = 0; imei < imeiMax; ++imei, ++pmei)
			/* okay to ignore expansion failure 
				as beauty is at stake */
			if (pmei->fNotExpanded && !DiDirtyDoc(pmei->docEdit))
				{
				if (FExpandHqrgbToPca(pmei->hqrgbTokens, 
						pmei->cbTokens, 
						PcaSetWholeDoc(&ca,pmei->docEdit),imei,fTrue))
					PmeiImei(imei)->fNotExpanded = fFalse;
				pmei = PmeiImei(imei);
				}
		}

/* Update Start/Continue button on macro icon bar */
	{
	MEI * pmei;
	
	if (vhmes != hNil && (pmei = PmeiCur())->heli != hNil && 
			PdodDoc(pmei->docEdit)->fDirty)
		{
		FreeEditMacro(iNil);
		}
	}

	Debug (iGotoLRet = 6);
	if (FMsgPresent(mtyIdle))
		goto LRet;

/* notice editing in header pane, enable "link with prev/reset" button if 
	it is not the first section's header/footer */
/* Why is this not done at NewCurWw time? - because you don't know when it 
is dirtied */
	if (wwCur != wwNil && PwwdWw(wwCur)->wk == wkHdr && 
			PdodDoc(docCur)->fDirty)
		{
		Assert(PdodDoc(docCur)->fDispHdr);
		if (FCanLinkPrev(wwCur))
			{
			SetSameAsPrevCtl(wwCur, fTrue /*fEnable*/);
			}
		}

	Assert(vlm != lmPreview);
/* update ribbon */
	if (vhwndRibbon != NULL)
		if (selCur.fUpdateChp || selCur.fUpdateChpGray ||
				selCur.fUpdateRibbon)
			UpdateRibbon(fFalse);

	Debug (iGotoLRet = 7);
	if (FMsgPresent(mtyIdle))
		goto LRet;

	Assert(vlm != lmPreview);

/* update header window's iconbar text */
	if (vdocHdrEdit != docNil)
		{
		int docHdrDisp = docNil;
		int docMom = vdocHdrEdit; /* saved away because vdocHdrEdit may
		be reset to zero */
		while ((wwHdr = WwHdrFromDocMom(docMom, &docHdrDisp)) != wwNil)
			{
			Assert(docHdrDisp);
			if (PwwdWw(wwHdr)->fHdr)
				SetHdrIBarName(docHdrDisp, IhtstFromDoc(docHdrDisp), wwHdr);
			}
		}

	Debug (iGotoLRet = 8);
	if (FMsgPresent(mtyIdle))
		goto LRet;

	Assert(vlm != lmPreview);

/* perform background DDE processes, if any */
	if (vfDdeIdle)
		{
		DoDdeIdle ();
		}

	Debug (iGotoLRet = 9);
	if (FMsgPresent(mtyIdle))
		goto LRet;

	/* WwCur enhancement for pictures. If window was dirtied and there
		are lines with pictures whose display was postponed, do the
		full display now. Other windows done later.
	
		Can use this loop for gray-scale fonts too.
	
	*/

	Assert(vlm != lmPreview);
	if (hwwdCur != hNil && (*hwwdCur)->fNeedEnhance)   /* wwCur first */
		{
		UpdateWw(wwCur, fTrue /* fAbortOK */); /* be sure window is up to date first */
		if (FEnhanceWw(wwCur))
			(*hwwdCur)->fNeedEnhance = fFalse;
		else  /* false if interrupted */				
			{
			Debug (iGotoLRet = 10);
			goto LRet;
			}
		}

	Debug (iGotoLRet = 11);
	if (FMsgPresent(mtyIdle))
		goto LRet;

/* Update the status line */
	if (vhwndStatLine != NULL && 
			(selCur.fUpdateStatLine || selCur.fUpdateStatLine2))
		UpdateStatusLine(usoCache);
	Debug (iGotoLRet = 12);
	if (FMsgPresent(mtyIdle))
		goto LRet;

/* preload font, if changed, to avoid delay when typing commences */
	if (vrf.fPreloadSelFont)
		{
		vrf.fPreloadSelFont = fFalse;
		if (selCur.fIns && hwwdCur != hNil &&
				DocMother(vfli.doc) == DocMother(selCur.doc))
	/* one case where vfli.doc not equal to selCur.doc is we are stepping
	through macro statement in an active window.  vfli.doc may point to the
	macro doc because we just hilighted the macro statement but selCur.doc
	is the active doc that the macro is executing on.
*/
			{
#ifdef BRYANL
			CommSz( SzShared( "Preloading font!!\r\n") );
#endif
			SetFlm( (*hwwdCur)->grpfvisi.flm );
			LoadFont( &selCur.chp, fFalse /*fWidthsOnly*/ );
			}
		}
	Debug (iGotoLRet = 12);
	if (FMsgPresent(mtyIdle))
		goto LRet;

LPrvw1:

/* Check for OnTime macro */
	if (vhotd != hNil)
		{
		extern unsigned long LTimeCur();
		OTD * potd;
		unsigned long lTime;

		lTime = LTimeCur();
		potd = *vhotd;
		if (lTime >= potd->lTime && 
				lTime < potd->lTime + potd->lTolerance)
			{
			extern BOOL vfAbortInsert;

			if (vfInsertMode)
				{
LAbortInsert:
				Assert(vfInsertMode); /* protect the label */
				/* Have to run next time in idle... */
				vfAbortInsert = fTrue;

				/* need to idle again ASAP! */
				Scribble (ispIdleComplete, 'M'); /* successful idle  */
				Scribble (ispIdle1, ' '); /* no longer in idle */
				cPassUninterrupt++;
				vidf.fInIdle = fFalse;
				return fFalse;
				}
			else
				{
				char stMacro [cchMaxSt];

				CopySt(potd->stMacro, stMacro);
				FreePh(&vhotd);
				FRunMacro(stMacro);
				}
			}
		}


	Debug (iGotoLRet = 13);
	if (FMsgPresent(mtyIdle))
		goto LRet;

/* make sure all the menus are up to date */
	if ((vgrfMenuCmdsAreDirty || vgrfMenuKeysAreDirty) && 
			cPassUninterrupt > cPassTwo)
		BringMenusUpToDate();

	Debug (iGotoLRet = 14);
	if (FMsgPresent(mtyIdle))
		goto LRet;

	if (cPassUninterrupt > cPassTwo+1 && 
			(!vmerr.fSdmInit||vpvs.fLoadPrvwFon))
		{
		FAbortNewestCmg(cmgInitStuff, fFalse, fTrue);
/* init SDM if we haven't already */
		if (!vmerr.fSdmInit)
			FAssureSdmInit();
		Debug (iGotoLRet = 15);
		if (FMsgPresent(mtyIdle))
			goto LRet;
/* Add preview font to master font table */
		if (vpvs.fLoadPrvwFon)
			LoadPreviewFont();
		OldestCmg(cmgInitStuff);
		}


	Debug (iGotoLRet = 16);
	if (FMsgPresent(mtyIdle))
		goto LRet;

	if (vlm == lmPreview)
		goto LPrvw2;

/* perform background repagination */
	if (selCur.doc != docNil && cPassUninterrupt >= cPassOne)
		{
		if (vpref.fBkgrndPag && !vpref.fDraftView 
				&& PwwdWw(wwCur)->wk != wkMacro)
			{
			int docMother = DocMother(selCur.doc);
			int lmSave = vlm;
			int flmSave = vflm;

			if (FInitWwLbsForRepag(wwCur, docMother, lmBRepag, &lbsText, &lbsFtn))
				{
				int fAbort, ipgdMacOld;

				SetWords(&rpl, pgnMax, cwRPL);
				rpl.cp = cpMax;
				ipgdMacOld = IMacPlc(PdodDoc(docMother)->hplcpgd);
				fAbort = !FUpdateHplcpgd(wwTemp, docMother, &lbsText, &lbsFtn, &rpl, patSilent );
				EndFliLayout(lmSave, flmSave);
				EndLayout(&lbsText, &lbsFtn);
				Debug (iGotoLRet = 17);
				if (fAbort)
					goto LRet;
				if (vhwndStatLine && ipgdMacOld !=
						IMacPlc(PdodDoc(docMother)->hplcpgd))
					UpdateStatusLine(usoCache);
				}
			}

		Debug (iGotoLRet = 18);
		if (FMsgPresent(mtyIdle))
			goto LRet;

		CoreNewest(fFalse);
		}


	Debug (iGotoLRet = 19);
	if (FMsgPresent(mtyIdle))
		goto LRet;

/* Get rid of the monster printer DC if we can live without it */
	if (vpri.hdc)
		{
		SetFlm( flmTossPrinter );
		Debug(hdcPrint = NULL);
		}

	Debug (iGotoLRet = 20);
	if (FMsgPresent(mtyIdle))
		goto LRet;

/* To improve global memory conditions, unlock any locked bitmaps */
	if (vsci.hdcScratch)
		SetScratchPbmi( &vbmiEmpty );

/* Shrink heap blocks for FormatLine.  Call this when it's
possible that the contents of the screen have gotten less complex */
	Assert(vbchrMax >= bchrMaxInit);
	if (vbchrMax - vbchrMac > bchrMaxFree)
		{
		vbchrMax = max(bchrMaxInit,vbchrMac);
		FChngSizeHCw(vhgrpchr, CwFromCch(vbchrMax + cbCHRE), fTrue);
		}

/* inside ruler functions the ruler grpprl is never shrunk.  This
	checks to see if it is bigger then it needs to be & shrinks it */
	if (vrulss.hgrpprl != hNil)
		CheckRulerGrpprlSize ();

	Assert (vdocTemp == docNil || mpdochdod[vdocTemp] != hNil);
	Assert (vdocScratch == docNil || mpdochdod[vdocScratch] != hNil);

	Assert(vlm != lmPreview);

	Debug (iGotoLRet = 21);
	if (FMsgPresent(mtyIdle))
		goto LRet;

/* delete vdocScratch here to free heap */
	if (vdocScratch != docNil)
		{
#ifdef DEBUG
		extern BOOL fDocScratchInUse;
		Assert (!fDocScratchInUse);
#endif /* DEBUG */
		DisposeDoc (vdocScratch);
		/* vdocScratch = docNil; */
		}
	if (vdocTemp != docNil && CpMacDocEdit(vdocTemp) > cp0)
		{
		struct CA caT;
		PdodDoc(vdocTemp)->doc = docScrap;   /* ensure valid chain */
		FDelete(PcaSetWholeDoc(&caT, vdocTemp));
		}

LPrvw2:
	Debug (iGotoLRet = 22);
	if (FMsgPresent(mtyIdle))
		goto LRet;

/* check to see if autosave should be done.  If so, do it. */
	Assert(GetTickCount() > 0L);
	if (vpref.iAS == iASNever || mwMac == 0 || !FAnyDirtyDocs())
		ResetASBase();
	else if (cPassUninterrupt > cPassTwo && FDoAutoSave())
		{
		if (vfInsertMode)
			/* must exit insert mode before we can save */
			goto LAbortInsert;
		else
			CmdAutosave();
		}

	Debug (iGotoLRet = 23);
	if (FMsgPresent(mtyIdle))
		goto LRet;

	/* check for discardable cursors */
	if (vhcOtlCross)
		{
		int ww;
		for (ww = 0; ww < wwMac; ww++)
			if (mpwwhwwd[ww] != hNil && PwwdWw(ww)->fOutline)
				break;
		if (ww == wwMac)
			/* no one in outline mode, discard outline cursors */
			{
			FreeIrcds(ircdsOtlCross);
			FreeIrcds(ircdsOtlVert);
			FreeIrcds(ircdsOtlHorz);
			}
		}
	if (vhcPrvwCross && vlm != lmPreview)
		FreeIrcds(ircdsPrvwCross);

	Assert(!vhcHelp == !vfHelp);

	Debug (iGotoLRet = 24);
	if (FMsgPresent(mtyIdle))
		goto LRet;

	if (vlm == lmPreview)
		goto LPrvw3;

	if (cPassUninterrupt > cPassTwo && selCur.doc != docNil)
		/* load pieces of selCur.doc into file cache */
		{
		int doc = DocMother(selCur.doc);
		int fn = PdodDoc(doc)->fn;
		CP ccpScan = CpMin((vbptbExt.ibpMac / 4) * cbSector, 
				CpMacDoc(doc));
		CP cpCur = doc != selCur.doc ? cp0 :
				CpMax(cp0, selCur.cpFirst - (ccpScan/3));
		if (fn != fnNil)
			EnablePreload(fn);
		while (ccpScan > cp0 && cpCur < CpMacDoc(doc) && 
				!FMsgPresent(mtyIdle))
			{
			CachePara(doc, cpCur);
			FetchCp(doc, cpCur, fcmProps+fcmChars);
			cpCur += vccpFetch;
			ccpScan -= vccpFetch;
			}
		if (fn != fnNil)
			DisablePreload();
		}

	Debug (iGotoLRet = 25);
	if (FMsgPresent(mtyIdle))
		goto LRet;

	/* GlobalWire the current font (leaves it unselected) 
		(DavidW says DON'T try to access the bits under win3) */
 	if (vwWinVersion < 0x0300)
		{
		int f;
		HFONT hfont;
		HANDLE hfontPhy;
		HDC hdc;

		if (vsci.pfti != NULL && (hfont = vsci.pfti->hfont) != NULL && 
				hwwdCur != hNil && (hdc = (*hwwdCur)->hdc) != NULL)
			{
			hfontPhy = GetPhysicalFontHandle(hdc);

			ResetFont(fFalse);

			if (((f = GlobalFlags(hfontPhy)) & GMEM_LOCKCOUNT) == 0 &&
					(f & ~GMEM_LOCKCOUNT) != 0)
				{
				Scribble(ispWireFont, 'W');
				/* Make the block non-discardable so that
				   windows won't throw out the block when
				   making room to GlobalWire it. */
				Assert(f & GMEM_DISCARDABLE);
				if (f & GMEM_DISCARDABLE)
					GlobalReAlloc(hfontPhy, GlobalSize(hfontPhy),
						GMEM_MODIFY);
				GlobalWire(hfontPhy);
				if (f & GMEM_DISCARDABLE)
					GlobalReAlloc(hfontPhy, GlobalSize(hfontPhy),
						GMEM_MODIFY | GMEM_DISCARDABLE);
				GlobalUnlock(hfontPhy);
				}
			}
		}

	/*  make sure temp files used (especially TIFF files, etc) won't cause
		us to run out of fns. */
	if (fnMac > fnMax-5 && cPassUninterrupt > cPassTwo)
		KillExtraFns();

	Debug (iGotoLRet = 26);
	if (FMsgPresent(mtyIdle))
		goto LRet;

	/* Enhancement loop for pictures. If window was dirtied and there
		are lines with pictures whose display was postponed, do the
		full display now.
	
		Did wwCur above before background repag; should not now be dirty 
		Can use this loop for gray-scale fonts too.
	
	*/

	Assert(vlm != lmPreview);

	if (cPassUninterrupt > cPassOne)
		{
		if (hwwdCur != hNil && (*hwwdCur)->fNeedEnhance && (*hwwdCur)->fDirty)
			UpdateWw(wwCur, fTrue /* fAbortOK */);

		for (ww = wwDocMin; ww < wwMac; ++ww)
			{
			struct WWD **hwwd;
			if (((hwwd = mpwwhwwd[ww]) != hNil) && (*hwwd)->fNeedEnhance)
				{
				if (FEnhanceWw(ww))
					(*hwwd)->fNeedEnhance = fFalse;
				else  /* false if interrupted */							
					{
					Debug (iGotoLRet = 27);
					goto LRet;
					}

				}
			}
		}

LPrvw3:
	Debug (iGotoLRet = 28);
	if (FMsgPresent(mtyIdle))
		goto LRet;

/* debugging checks */
#ifdef DEBUG
/* Check to see if the toolbox has been trashed */
	Debug(vdbs.fCkTlbx ? CkTlbx(fFalse) : 0 );

/* following Asserts try to catch storing into NULL pointers */
	Assert( *((char *) 0) == 0 );
	Assert( *((char *) 2) == 0 );
	Assert( *((char *) 8) == 0 );

	if (cPassUninterrupt > cPassOne)
		DoDebugTests(fTrue);
#endif  /* DEBUG */

	Debug (iGotoLRet = 29);
	if (FMsgPresent(mtyIdle))
		goto LRet;

	if (vlm == lmPreview)
		goto LPrvw4;

/* quietly load each of the code segments we use */
	if (!(cPassUninterrupt+1 & 0x0007))
		GetNextHcd();

	Debug (iGotoLRet = 30);
	if (FMsgPresent(mtyIdle))
		goto LRet;

/* make sure our core is loaded in */
	CoreNewest (fFalse);

LPrvw4:
	Scribble (ispIdleComplete, '*'); /* successful idle  */
	Scribble (ispIdle1, ' '); /* no longer in idle */
	cPassUninterrupt++;
	vidf.fInIdle = fFalse;
	return fFalse;

LRet:   /* Idle was interrupted by the arrival of an interesting message */

/* show each interrupted pass through idle with indicator of how far through */
	Scribble (ispIdleComplete, 'a'+iGotoLRet);
	Scribble (ispIdle1, ' '); /* no longer in idle */
	cPassUninterrupt = 0;
	vidf.fInIdle = fFalse;
	return fTrue;
}
예제 #11
0
/*
 * HeapWalkProc - show task status
 */
BOOL FAR PASCAL HeapWalkProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    HMENU       mh;
    HMENU       mh2;
    HCURSOR     hourglass;
    HCURSOR     oldcursor;
    DLGPROC     dlgproc;
    DWORD       index;
    heap_list   hl;
    GblWndInfo  *info;
    RECT        area;
    about_info  ai;

    info = (GblWndInfo *)GetWindowLong( hwnd, 0 );
    switch( msg ) {
    case WM_CREATE:
        InitPaintProc();
        info = MemAlloc( sizeof( GblWndInfo ) );
        if( info == NULL ) {
            ErrorBox( hwnd, STR_UNABLE_2_STARTUP, MB_OK | MB_ICONINFORMATION );
            PostQuitMessage( 0 );
        }
        memset( info, 0, sizeof( GblWndInfo ) );
        SetWindowLong( hwnd, 0, (DWORD)info );
//      hdc = GetDC( hwnd );
//      ReleaseDC(hwnd, hdc);
        SetDisplayType( hwnd, &( info->list.title ), HEAPMENU_DISPLAY_INIT );
        CreateListBox( hwnd, &info->list, GLOBAL_LB );
        info->alloc_dlgproc = MakeProcInstance_DLG( AllocDlgProc, Instance );
        info->alloc_dialog = JCreateDialog( Instance, "ALLOC_DLG", hwnd, info->alloc_dlgproc );
        memset( &ResHwnd, 0, MAX_RES * sizeof( HWND ) );
        break;
    case WM_MEASUREITEM:
        break;
    case WM_MOVE:
        GetWindowRect( hwnd, &area );
        if( !info->minimized ) {
            Config.last_glob_xpos = Config.glob_xpos;
            Config.last_glob_ypos = Config.glob_ypos;
            Config.glob_xpos = area.left;
            Config.glob_ypos = area.top;
        }
        break;
    case WM_SIZE:
        ResizeListBox( LOWORD( lparam ), HIWORD( lparam ), &( info->list ) );
        if( wparam == SIZE_MINIMIZED || wparam == SIZE_MAXIMIZED ) {
            Config.glob_xpos = Config.last_glob_xpos;
            Config.glob_ypos = Config.last_glob_ypos;
        }
        if( wparam == SIZE_MINIMIZED ) {
            info->minimized = TRUE;
            HideResources( TRUE );
        } else if( info->minimized ) {
            HideResources( FALSE );
            info->minimized = FALSE;
        } else if( wparam != SIZE_MAXIMIZED )  {
            GetWindowRect( hwnd, &area );
            Config.glob_xsize = area.right - area.left;
            Config.glob_ysize = area.bottom - area.top;
        }
        return( DefWindowProc( hwnd, msg, wparam, lparam ) );
        break;
    case WM_CLOSE:
        PostMessage( hwnd, WM_COMMAND, HEAPMENU_EXIT, 0L );
        return( TRUE );
    case WM_QUERYENDSESSION:
        SaveConfigFile( FALSE );
        return( TRUE );
        break;
    case WM_DESTROY:
        FiniPaintProc();
        KillPushWin( info->list.title );
        SaveConfigFile( FALSE );
        if( info != NULL ) {
            FreeProcInstance_DLG( info->alloc_dlgproc );
            MemFree( info );
        }
        DestroyMonoFonts();
        CvrCtl3dUnregister( Instance );
        CvrCtl3DFini( Instance );
        WWinHelp( hwnd, "heapwalk.hlp", HELP_QUIT, 0 );
        PostQuitMessage( 0 );
        break;
    case WM_ACTIVATEAPP:
        if( wparam && !NoRefresh ) {
            if( info->doing_add ) {
                info->need_refresh = TRUE;
            } else {
                InitHeapList( info->list.box, TRUE );
            }
        }
        break;
    case WM_MENUSELECT:
        if( LOWORD( lparam & MF_POPUP ) ) {
            mh = GetMenu( hwnd );
            mh2 = GetSubMenu( mh, 6 );
            if( (HMENU)wparam == mh2  ) {
                ShowWindow( info->alloc_dialog, SW_SHOWNOACTIVATE );
            } else if( (HMENU)wparam != GetSubMenu( mh2, 3 ) &&
                        (HMENU)wparam != GetSubMenu( mh2, 4 ) &&
                        (HMENU)wparam != GetSubMenu( mh2, 5 ) ) {
                ShowWindow( info->alloc_dialog, SW_HIDE );
            }
        }
        return( DefWindowProc( hwnd, msg, wparam, lparam ) );
        break;
    case WM_COMMAND:
        switch( wparam ) {
        case HEAPMENU_ABOUT:
            ai.owner = hwnd;
            ai.inst = Instance;
            ai.name = HWAllocRCString( STR_ABOUT_NAME );
            ai.version = HWAllocRCString( STR_ABOUT_VERSION );
            ai.title = HWAllocRCString( STR_ABOUT_TITLE );
            DoAbout( &ai );
            HWFreeRCString( ai.title );
            HWFreeRCString( ai.version );
            HWFreeRCString( ai.name );
            break;
        case HEAPMENU_HELP_CONTENTS:
            WWinHelp( hwnd, "heapwalk.hlp", HELP_CONTENTS, 0 );
            break;
        case HEAPMENU_HELP_SRCH:
            WWinHelp( hwnd, "heapwalk.hlp", HELP_PARTIALKEY, (HELP_DATA)(LPCSTR)"" );
            break;
        case HEAPMENU_HELP_ON_HELP:
            WWinHelp( hwnd, "winhelp.hlp", HELP_HELPONHELP, 0 );
            break;
        case HEAPEX_LIST:
            if( !info->doing_add ) {
                if( HIWORD( lparam ) == LBN_DBLCLK ) {
                    ShowHeapObject( (HWND)LOWORD( lparam ) );
                }
            } else {
                if( HIWORD( lparam ) == LBN_SELCHANGE
                    || HIWORD( lparam ) == LBN_DBLCLK ) {
                    RefreshAdd( info->add_dialog, info->list.box );
                    RedrawBox( info->list.box, index );
                }
            }
            break;
        case HEAPMENU_GLOBAL_REFRESH:
            InitHeapList( info->list.box, TRUE );
            break;
        case HEAPMENU_FONT:
            if( ChooseMonoFont( hwnd ) ) {
                ResetFont( info );
            }
            break;
        case HEAPMENU_EXIT:
            DestroyWindow( hwnd );
            FreeHeapList();
            break;
        case HEAPMENU_DISPLAY_DPMI:
        case HEAPMENU_DISPLAY_ENTIRE:
        case HEAPMENU_DISPLAY_LRU:
        case HEAPMENU_DISPLAY_FREE:
            SetDisplayType( hwnd, &( info->list.title ), wparam );
            InitHeapList( info->list.box, FALSE );
            break;
        case HEAPMENU_SORT_ADDR:
        case HEAPMENU_SORT_HANDLE:
        case HEAPMENU_SORT_MODULE:
        case HEAPMENU_SORT_SIZE:
        case HEAPMENU_SORT_TYPE:
        case HEAPMENU_SORT_GRAN:
        case HEAPMENU_SORT_DPL:
        case HEAPMENU_SORT_FLAG:
        case HEAPMENU_SORT_LRU:
            mh = GetMenu( hwnd );
            CheckMenuItem( mh, GSortType, MF_UNCHECKED | MF_BYCOMMAND );
            CheckMenuItem( mh, wparam, MF_CHECKED | MF_BYCOMMAND );
            if( GSortType != wparam ) {
                GSortType = wparam;
                SortHeapList();
                ReDisplayHeapList( info->list.box, NULL );
            }
            break;
        case HEAPMENU_OBJECT_SHOW:
            ShowHeapObject( info->list.box );
            break;
        case HEAPMENU_OBJECT_DISCARD:
            if( GlobDiscardObj( info->list.box ) ) {
                InitHeapList( info->list.box, TRUE );
            }
            break;
        case HEAPMENU_OBJECT_NEWEST:
            if( GlobSetObjPos( info->list.box, FALSE ) ) {
                if( GSortType == HEAPMENU_SORT_LRU ) {
                    InitHeapList( info->list.box, TRUE );
                }
            }
            break;
        case HEAPMENU_OBJECT_OLDEST:
            if( GlobSetObjPos( info->list.box, TRUE ) ) {
                if( GSortType == HEAPMENU_SORT_LRU ) {
                    InitHeapList( info->list.box, TRUE );
                }
            }
            break;
        case HEAPMENU_OBJECT_GET_SELECTOR:
            ShowSelector( info->list.box );
            break;
        case HEAPMENU_GLOBAL_HEAPINFO:
            DisplayGlobHeapInfo( hwnd );
            break;
        case HEAPMENU_GLOBAL_MEMORYINFO:
            DisplayMemManInfo( hwnd );
            break;
        case HEAPMENU_GLOBAL_COMPACT:
            GlobalCompact( 0 );
            InitHeapList( info->list.box, TRUE );
            break;
        case HEAPMENU_GLOBAL_COMP_DISC:
            GlobalCompact( -1 );
            InitHeapList( info->list.box, TRUE );
            break;
        case HEAPMENU_GLOBAL_CODE_SIZE:
            dlgproc = MakeProcInstance_DLG( SetCodeDlgProc, Instance );
            JDialogBox( Instance, "CODE_AREA_DLG", hwnd, dlgproc );
            FreeProcInstance_DLG( dlgproc );
            break;
        case HEAPMENU_FILE_SAVE:
            InitHeapList( info->list.box, TRUE );
            SaveListBox( SLB_SAVE_TMP, PutOutGlobalHeader, DumpGlobalLine, Config.gfname, HeapWalkName, hwnd, info->list.box );
            break;
        case HEAPMENU_FILE_SAVE_TO:
            InitHeapList( info->list.box, TRUE );
            SaveListBox( SLB_SAVE_AS, PutOutGlobalHeader, DumpGlobalLine, Config.gfname, HeapWalkName, hwnd, info->list.box );
            break;
        case HEAPMENU_SAVE_CONFIG:
            SaveConfigFile( TRUE );
            break;
        case HEAPMENU_CONFIGURE:
            HWConfigure();
            break;
        case HEAPMENU_LOCAL_MONITOR:
            index = CheckForLocalSelect( info );
            if( index != LB_ERR ) {
                BeginMonitor( HeapList[index] );
            }
            break;
        case HEAPMENU_COMPACT_AND_LOCALWALK:
            LocalCompact( -1 );
            /* fall through */
        case HEAPMENU_LOCAL_LOCALWALK:
            index = CheckForLocalSelect( info );
            if( index != LB_ERR ) {
                LocalWalk( HeapList[index] );
            }
            break;
        case HEAPMENU_GDI_LOCALWALK:
            if( GetDGroupItem( "GDI", &hl ) ) {
                LocalWalk( &hl );
            }
            break;
        case HEAPMENU_USER_LOCALWALK:
            if( GetDGroupItem( "USER", &hl ) ) {
                LocalWalk( &hl );
            }
            break;
        case HEAPMENU_FREE_ALL:
            MyFreeAllMem();
            UpdateAllocInfo( info->alloc_dialog );
            PaintAllWindows();
            break;
        case HEAPMENU_FREE_1K:
        case HEAPMENU_FREE_2K:
        case HEAPMENU_FREE_5K:
        case HEAPMENU_FREE_10K:
        case HEAPMENU_FREE_25K:
        case HEAPMENU_FREE_50K:
            hourglass = LoadCursor( NULL, IDC_WAIT );
            SetCapture( hwnd );
            oldcursor= SetCursor( hourglass );
            FreeSomeMem( wparam );
            UpdateAllocInfo( info->alloc_dialog );
            SetCursor( oldcursor );
            ReleaseCapture();
            PaintAllWindows();
            break;
        case HEAPMENU_ALLOC_1K:
        case HEAPMENU_ALLOC_2K:
        case HEAPMENU_ALLOC_5K:
        case HEAPMENU_ALLOC_10K:
        case HEAPMENU_ALLOC_25K:
        case HEAPMENU_ALLOC_50K:
            hourglass = LoadCursor( NULL, IDC_WAIT );
            SetCapture( hwnd );
            oldcursor= SetCursor( hourglass );
            AllocMore( wparam );
            UpdateAllocInfo( info->alloc_dialog );
            SetCursor( oldcursor );
            ReleaseCapture();
            PaintAllWindows();
            break;
        case HEAPMENU_ALLOC_ALL:
        case HEAPMENU_ALLOC_BUT_1K:
        case HEAPMENU_ALLOC_BUT_2K:
        case HEAPMENU_ALLOC_BUT_5K:
        case HEAPMENU_ALLOC_BUT_10K:
        case HEAPMENU_ALLOC_BUT_25K:
        case HEAPMENU_ALLOC_BUT_50K:
            hourglass = LoadCursor( NULL, IDC_WAIT );
            SetCapture( hwnd );
            oldcursor= SetCursor( hourglass );
            AllocAllBut( wparam );
            UpdateAllocInfo( info->alloc_dialog );
            SetCursor( oldcursor );
            ReleaseCapture();
            PaintAllWindows();
            break;
        case HEAPMENU_ALLOC_NK:
        case HEAPMENU_ALLOC_BUT_NK:
        case HEAPMENU_FREE_NK:
            DoNBytes( hwnd, wparam );
            UpdateAllocInfo( info->alloc_dialog );
            PaintAllWindows();
            break;
        case HEAPMENU_ADD:
            info->add_dialog = StartAdd( hwnd, &info->list );
            if( info->add_dialog != NULL ) {
                info->doing_add = TRUE;
                info->need_refresh = FALSE;
            } else {
                ErrorBox( hwnd, STR_UNABLE_TO_ADD,
                          MB_OK| MB_ICONINFORMATION );
            }
            break;
        }
        break;
    case WM_USER:
        /* an owned window is being destroyed make sure
         * Windows doesn't take the focus away from us*/
        NoRefresh = TRUE;
        SetFocus( hwnd );
        NoRefresh = FALSE;
        break;
    default:
        return( DefWindowProc( hwnd, msg, wparam, lparam ) );
    }
    return( FALSE );

} /* HeapWalkProc */