Example #1
0
void wxStaticBitmap::SetImage( const wxGDIImage& rBitmap )
{
    int nX = 0;
    int nY = 0;
    int nWidth = 0;
    int nHeight = 0;

    Free();
    ::WinSendMsg( GetHwnd()
                 ,SM_SETHANDLE
                 ,MPFROMHWND(rBitmap.GetHandle())
                 ,NULL
                );
    m_pImage = ConvertImage(rBitmap);

    GetPosition(&nX, &nY);
    GetSize(&nWidth, &nHeight);
    // Convert to OS/2 coordinate system
    nY = wxWindow::GetOS2ParentHeight(GetParent()) - nY - nHeight;

    RECTL                           vRect;

    vRect.xLeft   = nX;
    vRect.yTop    = nY + nHeight;
    vRect.xRight  = nX + nWidth;
    vRect.yBottom = nY;

    ::WinInvalidateRect(GetHwndOf(GetParent()), &vRect, TRUE);
}
Example #2
0
MRESULT	mrNotifyOwner(PENTRYFWIN pefw, ULONG ulNotification)

{

    return(WinSendMsg(pefw->hwndOwner, WM_CONTROL,
                      MPFROM2SHORT(pefw->id, (USHORT)ulNotification),
                      MPFROMHWND((pefw->hWnd))));
}
Example #3
0
/*
 * CreateNewDrawPad - creates a new draw pad which is a child of the client
 *                    window.  These are the mdi children.
 */
void CreateNewDrawPad( img_node *node )
{
#ifdef __OS2_PM__
    hDrawArea = PMNewDrawPad( node );
    WinSendMsg( hDrawArea, WM_ACTIVATE, MPFROMSHORT(TRUE), MPFROMHWND(hDrawArea) );
#else
    hDrawArea = WinNewDrawPad( node );
#endif
} /* CreateNewDrawPad */
Example #4
0
File: kimehook.c Project: komh/kime
VOID toggleOS2IMEHanEng( HWND hwnd )
{
    BOOL fHanStatus;

    toggleIMEHanEng( hwnd );

    fHanStatus = queryIMEHanEng( hwnd );
    WinSendMsg( hwndKHS, KHSM_SETHANSTATUS, MPFROMHWND( hwnd ),
                MPFROMLONG( fHanStatus ));
    WinSendMsg( hwndKime, KIMEM_SETHAN, MPFROMLONG( fHanStatus ), 0 );
}
Example #5
0
File: kimehook.c Project: komh/kime
VOID initKimeStatus( HWND hwnd, BOOL ztelnet )
{
    BOOL hanStatus;
    BOOL imStatus;

    if( checkExceptWindow( hwnd ))
    {
        WinSendMsg( hwndKime, WM_COMMAND, MPFROM2SHORT( IDM_HIDE, 0 ), MPFROM2SHORT( CMDSRC_MENU, 0 ));
        return;
    }

    if( !findWnd( hwnd ))
        addWnd( hwnd );

    hanStatus = ( BOOL )WinSendMsg( hwndKHS, KHSM_QUERYHANSTATUS, MPFROMHWND( hwnd ), 0 );
    WinSendMsg( hwndKime, KIMEM_SETHAN, MPFROMLONG( hanStatus ), 0 );
    if( !ztelnet )
        WinSendMsg( hwndHIA, HIAM_SETHANMODE, MPFROMLONG( hanStatus ? HCH_HAN : HCH_ENG ), 0 );

    imStatus = ( BOOL )WinSendMsg( hwndKHS, KHSM_QUERYIMSTATUS, MPFROMHWND( hwnd ), 0 );
    WinSendMsg( hwndKime, KIMEM_SETIM, MPFROMLONG( imStatus ), 0 );
}
Example #6
0
File: khserver.c Project: komh/kime
MRESULT khs_umChangeImStatus( HWND hwnd, MPARAM mp1, MPARAM mp2 )
{
    PKHSCD  pkhscd = WinQueryWindowPtr( hwnd, 0 );
    HWND    hwndInput = HWNDFROMMP( mp1 );

    if(( BOOL )WinSendMsg( hwnd, KHSM_FINDWND, MPFROMHWND( hwndInput ), 0 ))
    {
        PHWNDLIST list;

        list = hwndlistSearch( pkhscd->list, hwndInput );
        list->line = !list->line;
    }

    return 0;
}
Example #7
0
File: khserver.c Project: komh/kime
MRESULT khs_umDelWnd( HWND hwnd, MPARAM mp1, MPARAM mp2 )
{
    PKHSCD  pkhscd = WinQueryWindowPtr( hwnd, 0 );
    HWND    hwndInput = HWNDFROMMP( mp1 );

    if(( BOOL ) WinSendMsg( hwnd, KHSM_FINDWND, MPFROMHWND( hwndInput ), 0 ))
    {
        PHWNDLIST list;

        list = hwndlistSearch( pkhscd->list, hwndInput );
        hwndlistDelete( list );
    }

    return 0;
}
Example #8
0
File: khserver.c Project: komh/kime
MRESULT khs_umAddWnd( HWND hwnd, MPARAM mp1, MPARAM mp2 )
{
    PKHSCD  pkhscd = WinQueryWindowPtr( hwnd, 0 );
    HWND    hwndInput = HWNDFROMMP( mp1 );

    if(!( BOOL ) WinSendMsg( hwnd, KHSM_FINDWND, MPFROMHWND( hwndInput ), 0 ))
    {
        PHWNDLIST list = hwndlistCreate();

        if( list != NULL )
        {
            list->hwnd = hwndInput;
            hwndlistInsert( pkhscd->list, list );
        }
    }

    return 0;
}
Example #9
0
MRESULT EXPENTRY WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
{
//	static POINTS DragStartPtrPos;
    POINTL ptl;
    static char Row, Col;
    static BOOL HasMoved = FALSE;
    static BOOL IntroSoundPlayed = FALSE;
    static BOOL RealPaint = TRUE;           // indicates whether the board
				// has to be repainted or just copied
    INT aktscan;
    CHAR msgtext[256];
    ULONG ulResponse;
//	ERRORID errId;

	
    switch( msg ){
    case WM_CREATE:
	if( !InfoData.LoadHigh() ){	// get previously saved highscores
	    InfoData.ResetHigh();
	    WinMessageBox( HWND_DESKTOP, hwndMain,
			   "The file scores.dat " \
			   "(which is in the current directory) was somehow corrupted." \
			   " All Highscores will be reset to Zero.",
			   "Error when loading Highscores",
			   0, MB_OK | MB_INFORMATION );
	}

	// allocate memory for global variables; see GLOBALS struct in tgraph.h
	pg = new GLOBALS;
	// initialize globals to zero
	memset( pg, 0, sizeof( GLOBALS ));
	// store globals pointer into client window words; see WinRegisterClass
//    WinSetWindowULong( hwnd, QWL_USER, (ULONG) pg );

    wcprintf("1: %x", WinGetLastError( hab ) );
	DosCreateEventSem( NULL, &hevWaitAfterScan, 0, FALSE );
				// Sem is created in reset state
	DosCreateEventSem( NULL, &hevHiScoreWin, 0, FALSE );
	DosCreateEventSem( NULL, &hevWaitAfterSound, 0, FALSE );
	DosCreateEventSem( NULL, &hevWaitSoundReady, 0, TRUE );
				// Sem is created in posted state
	// hevWaitAfterScan and hewWaitAfterSound are used to indicate
	// when the respective WM_CREATE routines are done.
	// after that they are in posted state, as desired
            
	// initialize globals with important data
	pg->hab          = hab;
	pg->hwndClient   = hwnd;
	pg->hwndFrame    = WinQueryWindow( hwnd, QW_PARENT );
	pg->hwndTitlebar = WinWindowFromID( pg->hwndFrame, FID_TITLEBAR );
	pg->hwndMenubar  = WinWindowFromID( pg->hwndFrame, FID_MENU );
	// create graphics and sound threads
	pg->tidTSound = _beginthread( &threadsound, NULL, LEN_STACK, NULL );
	pg->tidTGraph = _beginthread( &threadgraph, NULL, LEN_STACK, NULL );
	DosWaitEventSem( hevWaitAfterSound, SEM_INDEFINITE_WAIT );
	WinPostMsg( pg->hwndTSound, WM_SOUND_INTRO, MPFROMHWND(hwnd), 0 );
	// wait for the sound's WM_CREATE
	DosWaitEventSem( hevWaitAfterScan, SEM_INDEFINITE_WAIT );
	// wait for the graphics' WM_CREATE
	InfoData.ShipsNotFound = GBoard.GetShipNumber();
	wcprintf("create: %x", WinGetLastError( hab ) );
	return (MRESULT)0;
			
    case WM_CONTROL:
	break;
    case WM_QUIT:
	break;
			
    case WM_CLOSE:	// this message is sent before WM_QUIT
	InfoData.SaveHigh( WinGetCurrentTime(hab) );
				// save the highscores and provide a random seed
	// get pointer to globals from window words
//    pg = (PGLOBALS) WinQueryWindowULong( hwnd, QWL_USER );
	// tell object windows to quit, then exit their threads
//			WinSendMsg( pg->hwndTGraph, WM_DESTROY, mp1, mp2 );
	WinPostMsg( pg->hwndTGraph, WM_QUIT, mp1, mp2 );
//			WinSendMsg( pg->hwndTSound, WM_DESTROY, mp1, mp2 );
	WinPostMsg( pg->hwndTSound, WM_QUIT, mp1, mp2 );
	DosCloseEventSem( hevWaitAfterScan );
	DosCloseEventSem( hevHiScoreWin );
	DosCloseEventSem( hevWaitAfterSound );
	DosCloseEventSem( hevWaitSoundReady );
	WriteProfile( hab );
	delete pg;
	return (MRESULT) 0;
	
    case WM_ERASEBACKGROUND:
	wcprintf("erasebackground");        
//	return (MRESULT) FALSE;
	return (MRESULT) TRUE;

    case WM_PAINT:
///////////////////////////////////
	    {
		RECTL rectl;
		WinQueryWindowRect( pg->hwndClient, &rectl );
wcprintf("Linienrechteck: Breite: %d H”he: %d", rectl.xRight, rectl.yTop );
		// test size:
		GpiSetColor( hpsGlob, CLR_RED );
		ptl.x = rectl.xLeft; ptl.y = rectl.yBottom;
		GpiMove( hpsGlob, &ptl );
		ptl.x = rectl.xRight; ptl.y = rectl.yTop;
		GpiLine( hpsGlob, &ptl );
	    }
///////////////////////////
	break;

    case WM_SIZE:
	wcprintf("main wnd function wm-size");
	RealPaint = TRUE;
	GBoard.SetPMBoardValues( SHORT1FROMMP( mp2 ), SHORT2FROMMP( mp2 ) );
	WndResize( hwnd );
	wcprintf("size: %x", WinGetLastError( hab ) );
	break;
			
    case WM_BEGINDRAG:
	WinSetCapture( HWND_DESKTOP, hwnd );	// capture the mouse pointer
	GBoard.SetfDrag( TRUE );	// indicate that mouse is being dragged
	GBoard.ResetFirstDraw();	// for initialization of drag op.
	fHideSquare = TRUE;
	WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd),
		    MPFROM2SHORT( 0, 0 ) );
//			GBoard.ShowPointerPos( hwnd, 0, 0 ); // removes the square
	ptl.x = SHORT1FROMMP(mp1);
	ptl.y = SHORT2FROMMP(mp1);
	Row = GBoard.GetBoardRow( ptl.y );	// starting point of drag
	Col = GBoard.GetBoardCol( ptl.x );	// operation; static!
	return (MRESULT)TRUE;
			
    case WM_MOUSEMOVE:
	if( GBoard.GetfDrag() ){	// if mouse is being dragged
	    WinSendMsg( pg->hwndTGraph, WM_DRAWDRAGLINE, mp1,
			MPFROM2SHORT( Row, Col ) );
	    HasMoved = TRUE;
	} else {		// mouse is moved normally
	    if( !fHideSquare )
		WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd),
			    mp1 );
//					GBoard.ShowPointerPos( hwnd, SHORT1FROMMP(mp1),
//														  SHORT2FROMMP(mp1));
	}
	break;	
    case WM_ENDDRAG:
	WinSetCapture( HWND_DESKTOP, NULLHANDLE ); // release the captured
				// mouse pointer
	if( HasMoved ){	// mousemove has actually been moved
	    WinSendMsg( pg->hwndTGraph, WM_MARKDRAGLINE,
			MPFROM2SHORT( Row, Col ), 0 );
	    HasMoved = FALSE;
	}
	GBoard.SetfDrag( FALSE );
	GBoard.ClearDrawPoint();	// because no square is drawn right now
	fHideSquare = FALSE;
	WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd),
		    mp1 );
//			GBoard.ShowPointerPos( hwnd, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1));
				// draws square at the current ptr pos
	break;
			
    case WM_CHAR:	// key was pressed
	if( SHORT2FROMMP( mp2 ) != VK_SPACE ) break;	// only space is interesting
	if( GBoard.GetfDrag() ) break;	// do nothing while dragging
	if( !GBoard.GetfShowLines() ){	// lines not visible yet
	    GBoard.SetfShowLines( TRUE );
	    WinSendMsg( pg->hwndTGraph, WM_DISPLAYLINES, 0, 0 );
	}
	break;
			
    case WM_BUTTON1CLICK:
	if( !InfoData.ShipsNotFound ) break;	// game is finished
	ptl.x = (LONG)SHORT1FROMMP( mp1 );
	ptl.y = (LONG)SHORT2FROMMP( mp1 );
	Row = GBoard.GetBoardRow( ptl.y );
	Col = GBoard.GetBoardCol( ptl.x );
	if( !Row || !Col ) break;
	fHideSquare = TRUE;
	WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd),
		    MPFROM2SHORT( 0, 0 ) );
//			GBoard.ShowPointerPos( hwnd, 0, 0 );	// hides pointer square
	if(( aktscan = GBoard.GetDiscovered( Row, Col )) != -1 ){
	    WinSendMsg( pg->hwndTGraph, WM_DRAWPMPLACE, MPFROMHWND(hwnd),
			MPFROMSH2CH( MAKESHORT(Row, Col),
				     (CHAR)aktscan,(CHAR)TRUE));
// umstricken auf WinPostMsg												 
				// toggle Place display
	} else {	// scan Place
	    DosResetEventSem( hevWaitAfterScan, &ulResponse );
// DosBeep(500, 150 );				
	    WinPostMsg( pg->hwndTGraph, WM_GRAPH_SCAN, MPFROMHWND(hwnd),
			MPFROM2SHORT( Row, Col ) );
// DosBeep( 800, 150 );								
	    WinWaitEventSem( hevWaitAfterScan, SEM_INDEFINITE_WAIT );
// DosBeep( 1000, 150 );				
				// first the scanning sounds must be played (and finished)
	    aktscan = GBoard.Scan( Row, Col );
	    if( aktscan == GBoard.GetShipNumber() + 10 ){
		InfoData.ShipsNotFound--;
		WinPostMsg( pg->hwndTSound, WM_SOUND_FOUNDSHIP, MPFROMHWND(hwnd), 0 );
	    } else {
		if( aktscan )
		    WinPostMsg( pg->hwndTSound, WM_SOUND_FOUND,
				MPFROMHWND(hwnd), MPFROMLONG( aktscan ) );
		else	
		    WinPostMsg( pg->hwndTSound, WM_SOUND_FOUND0, MPFROMHWND(hwnd), 0 );
	    }
	    WinWaitEventSem( hevWaitAfterScan, SEM_INDEFINITE_WAIT );
				// waits until scanning is done, and only then displays the
				// field icon
//				hps = WinGetPS( hwnd );
	    WinSendMsg( pg->hwndTGraph, WM_DRAWPMPLACE, MPFROMHWND(hwnd),
			MPFROMSH2CH( MAKESHORT(Row, Col),
				     (CHAR)aktscan,(CHAR)TRUE));
// umstricken auf WinPostMsg
	    WinPostMsg( pg->hwndTGraph, WM_SHOWSTATUSLINE, 0, 0 );
				
//				ShowStatusLine( hps, GBoard.MovesNeeded(), InfoData.ShipsNotFound,
//									 GBoard.GetWinWidth(), GBoard.GetWinHeight() );
//				WinReleasePS( hps );
	    if( !InfoData.ShipsNotFound ){	// game is finished, all ships found
		Score = GBoard.MovesNeeded();
		if	( !InfoData.ReturnLastHigh()	// still space in the hiscore table
		|| Score < InfoData.ReturnLastHigh() ){	// player kicks last one out
				// player enters highscore table
		    WinPostMsg( pg->hwndTSound, WM_SOUND_NEWHISCORE, MPFROMHWND(hwnd), 0 );
		    WinWaitEventSem( hevHiScoreWin, SEM_INDEFINITE_WAIT );
				// waits until the NEWHISCORE sound is actually played
		    WinDlgBox( HWND_DESKTOP, hwnd, HighScoreDlgProc, (HMODULE)0,
			       IDR_HIGHSCOREDLG, NULL );
		    WinPostMsg( hwnd, WM_COMMAND,
				MPFROMSHORT(IDM_GAMEHIGH), (MPARAM)0 );
				// show highscore-table
		    DosResetEventSem( hevHiScoreWin, &ulResponse ); // resets the sem again
		} else {
		    WinPostMsg( pg->hwndTSound, WM_SOUND_LOST, MPFROMHWND(hwnd), 0 );
		    WinWaitEventSem( hevHiScoreWin, SEM_INDEFINITE_WAIT );
				// waits until the NEWHISCORE sound is actually played
		    sprintf( msgtext,
			     "You needed %d moves to find the lost ships. " \
			     "To enter the highscore list you need %d moves." \
			     " So try again!", Score, InfoData.ReturnLastHigh() - 1 );
		    WinMessageBox( HWND_DESKTOP, hwnd, msgtext, "Oh, Shit!", 0,
				   MB_OK | MB_INFORMATION | MB_HELP );
		}
	    }
	}
	fHideSquare = FALSE;
	WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd),
		    MPFROM2SHORT( ptl.x, ptl.y ) );
//			GBoard.ShowPointerPos( hwnd, ptl.x, ptl.y ); // redisplay ptr square
	break;
			
    case WM_BUTTON2CLICK:
	fHideSquare = TRUE;
	WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd),
		    MPFROM2SHORT( 0, 0 ) );
	ptl.x = (LONG)SHORT1FROMMP( mp1 );
	ptl.y = (LONG)SHORT2FROMMP( mp1 );
	Row = GBoard.GetBoardRow( ptl.y );
	Col = GBoard.GetBoardCol( ptl.x );
	WinSendMsg( pg->hwndTGraph, WM_DRAWPMMARK, MPFROMHWND(hwnd),
		    MPFROM2SHORT( Row, Col ) );
	fHideSquare = FALSE;
	WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd),
		    MPFROM2SHORT( ptl.x, ptl.y ) );
	break;
			
    case WM_COMMAND:
	switch( SHORT1FROMMP( mp1 ) ){
	case IDM_GAMENEW:
	    GBoard.NewGame();
	    InfoData.ShipsNotFound = GBoard.GetShipNumber();
	    RealPaint = TRUE;
	    WinInvalidateRect( hwnd, NULL, TRUE );
	    break;
	case IDM_GAMESETTINGS:
	    if( WinDlgBox( HWND_DESKTOP, hwndFrame,
			   GameSettingsDlgProc, (HMODULE)0,
			   IDR_GAMESETTINGSDLG, NULL ) ){
				// screen must be repainted
		RealPaint = TRUE;
		WinInvalidateRect( hwnd, NULL, TRUE );
	    }
	    break;
	case IDM_GAMEHIGH:
	    if( !WinDlgBox( HWND_DESKTOP, hwndFrame,
			    ShowHighDlgProc, (HMODULE)0,
			    IDR_SHOWHIGHDLG, NULL ) ){	// user requested "Clear"
		if( WinMessageBox( HWND_DESKTOP, hwndMain,
				   "Do you really want to eradicate all those " \
				   "arduously achieved highscores?",
				   "Clear Highscores",
				   0, MB_OKCANCEL | MB_WARNING ) == MBID_OK )
		    InfoData.ResetHigh();
	    }
	    break;
					
	case IDM_HELPINDEX:	// help index
	    WinSendMsg( hwndHelp, HM_HELP_INDEX, 0, 0 );
	    break;
					
	case IDM_HELPGENERAL:	// general help
	    WinSendMsg( hwndHelp, HM_EXT_HELP, 0, 0 );
	    break;
					
	case IDM_HELPEXTENDED:	// help on help (system page)
	    WinSendMsg( hwndHelp, HM_DISPLAY_HELP, 0, 0 );
	    break;
					
	case IDM_HELPKEYS:	// keys help
	    WinSendMsg( hwndHelp, HM_KEYS_HELP, 0, 0 );
	    break;
					
	
	case IDM_HELPPRODUCTINFO:
	    ulResponse = WinDlgBox( HWND_DESKTOP, hwndFrame,
				    ProdInfoDlgProc, (HMODULE)0,
				    IDR_PRODINFODLG, NULL );
	    break;		
	}
	break;

    case HM_QUERY_KEYS_HELP:                // system asks which page to display
	return MRFROMSHORT( PANEL_HELPKEYS );
	      
    case HM_HELPSUBITEM_NOT_FOUND:
	return (MRESULT)FALSE;
			
    case WM_USER_ACK:	// graphics task finished its work
//         DosBeep( 1000, 150 );
	switch( (ULONG)mp1 ){
	case WM_USER_PAINT:
	    WinQueryPointerPos( HWND_DESKTOP, &ptl );
	    WinMapWindowPoints( HWND_DESKTOP, hwnd, &ptl, 1);
	    fHideSquare = FALSE;
	    WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd),
			MPFROM2SHORT( ptl.x, ptl.y ) );
//					GBoard.ShowPointerPos( hwnd, ptl.x, ptl.y );
				// painting has finished, square can be displayed now
	    break;
	}
	break;	
    case WM_SOUND_ACK:
	switch( (ULONG)mp1 ){
	case WM_SOUND_INTRO:
	    break;
	}
	break;

			
    default:
	return (MRESULT)WinDefWindowProc( hwnd, msg, mp1, mp2 );
    }		// end switch( msg )
    return (MRESULT)WinDefWindowProc( hwnd, msg, mp1, mp2 );
}		// end MRESULT EXPENTRY WndProc()
Example #10
0
BOOL SETTINGS :: Dialog (BOOL fOnlyLanguage)
{
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 1" );
#endif
    fAutoLanguage = fOnlyLanguage;

    // load the main dialog window
    hwndDlg = WinLoadDlg (HWND_DESKTOP, hwndFrame, PFNWP (DialogProcedure),
                          GETMODULE, ID_DLG_SETTINGS, this);
    // FIXME YUKKI! YUKKI!! YUKKI!!! But I'm too lazy to do it better now :-)
    g_hwndSettingsDialog = hwndDlg;
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 2" );
#endif

    // disable this two buttons if only language select
    if (fAutoLanguage)
    {
        WinEnableWindow (WinWindowFromID (hwndDlg, WID_PB_HELP), FALSE);
        WinEnableWindow (WinWindowFromID (hwndDlg, WID_PB_UNDO), FALSE);
    }

    HWND   hwndNB = WinWindowFromID (hwndDlg, WID_NB_SETTINGS);
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 3" );
#endif

    // set notebook background color
    WinSendMsg (hwndNB, BKM_SETNOTEBOOKCOLORS,
                MPFROMLONG (SYSCLR_DIALOGBACKGROUND),
                MPFROMSHORT (BKA_BACKGROUNDPAGECOLORINDEX));

    // set tab dimensions
    WinSendMsg (hwndNB, BKM_SETDIMENSIONS,
                MPFROM2SHORT (80, 25), MPFROMSHORT (BKA_MAJORTAB));
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 4" );
#endif

    ULONG   idPage[COUNT_PAGES];
    USHORT  i, cPages;

    if (fOnlyLanguage)
    {
        cPages = 1;

        idPage[0] = (ULONG)
            WinSendMsg (hwndNB, BKM_INSERTPAGE, 0L,
                        MPFROM2SHORT (BKA_MAJOR | BKA_AUTOPAGESIZE,
                                      BKA_LAST));
        WinSendMsg (hwndNB, BKM_SETTABTEXT, MPFROMLONG (idPage[0]),
                    MPFROMP (pszPageTab[COUNT_PAGES-1]));
        hwndPage[0] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page4Procedure,
                                  GETMODULE, ID_DLG_SETTINGSPAGE4, this);
    }
    else
    {
        cPages = COUNT_PAGES;

        // insert empty pages
        for (i = 0; i < cPages; i++)
        {
            idPage[i] = (ULONG)
                WinSendMsg (hwndNB, BKM_INSERTPAGE, 0L,
                            MPFROM2SHORT (BKA_MAJOR | BKA_AUTOPAGESIZE,
                                          BKA_LAST));
            WinSendMsg (hwndNB, BKM_SETTABTEXT,
                        MPFROMLONG (idPage[i]), MPFROMP (pszPageTab[i]));
        }

        // open and assign dialogs to pages
        hwndPage[0] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page1Procedure,
                                  GETMODULE, ID_DLG_SETTINGSPAGE1, this);
        hwndPage[1] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page2Procedure,
                                  GETMODULE, ID_DLG_SETTINGSPAGE2, this);
        hwndPage[2] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page3Procedure,
                                  GETMODULE, ID_DLG_SETTINGSPAGE3, this);
        hwndPage[3] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page4Procedure,
                                  GETMODULE, ID_DLG_SETTINGSPAGE4, this);
    }
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 5" );
#endif

    // combine dlg-handle and page ids
    for (i = 0; i < cPages; i++)
        WinSendMsg (hwndNB, BKM_SETPAGEWINDOWHWND,
                    MPFROMLONG (idPage[i]), MPFROMHWND (hwndPage[i]));

/*    if (fAutoLanguage)
        WinSendMsg (hwndNB, BKM_TURNTOPAGE, MPFROMLONG (idPage[0]), 0L);
#if (COUNT_PAGES != 4)
#warning FIXME settings.cpp 264 or so ...
#endif */
    for (i = 0; i < cPages; i++)
        WinSendMsg (hwndPage[i], UM_SETTINGS2DIALOG, 0,0);
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 6" );
#endif

    //WinSetFocus (WinWindowFromID (hwndDlg, WID_PB_OK), TRUE);
    //WinSetFocus( hwndPage[0], TRUE );
    WinSetActiveWindow( HWND_DESKTOP, hwndPage[0] );
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 7" );
#endif

    WinProcessDlg (hwndDlg);
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 7.5" );
#endif
    WinDestroyWindow (hwndDlg);
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 8" );
#endif

    // it ain't the best way to do it, but ...
    SetIdlePriority(QueryFlag(SEI_IDLEPRIORITY));

    for (i = 0; i < COUNT_PAGES; i++)
        hwndPage[i] = NULL;

    hwndDlg = NULLHANDLE;
#ifdef _DOLOGDEBUG_
    LogDebug( "Dialog: checkpoint 9" );
#endif
    return TRUE;
}
Example #11
0
bool wxStaticBitmap::Create( wxWindow*         pParent,
                             wxWindowID        nId,
                             const wxGDIImage& rBitmap,
                             const wxPoint&    rPos,
                             const wxSize&     WXUNUSED(rSize),
                             long              lStyle,
                             const wxString&   rName )
{
    ERRORID                         vError;
    wxString                        sError;

    Init();

    SetName(rName);
    if (pParent)
        pParent->AddChild(this);

    if (nId == -1)
        m_windowId = (int)NewControlId();
    else
        m_windowId = nId;

    m_windowStyle = lStyle;

    int                             nX= rPos.x;
    int                             nY = rPos.y;
    char                            zId[16];

    m_windowStyle = lStyle;

    m_bIsIcon = rBitmap.IsKindOf(CLASSINFO(wxIcon));

    //
    // For now we only support an ICON
    //
    int                             nWinstyle = SS_ICON;

    m_hWnd = (WXHWND)::WinCreateWindow( pParent->GetHWND()
                                       ,(PSZ)wxCanvasClassName
                                       ,zId
                                       ,nWinstyle | WS_VISIBLE
                                       ,0,0,0,0
                                       ,pParent->GetHWND()
                                       ,HWND_TOP
                                       ,m_windowId
                                       ,NULL
                                       ,NULL
                                      );
    if (!m_hWnd)
    {
        vError = ::WinGetLastError(wxGetInstance());
        sError = wxPMErrorToStr(vError);
        return false;
    }
    wxCHECK_MSG( m_hWnd, false, wxT("Failed to create static bitmap") );
    m_pImage = ConvertImage(rBitmap);
    ::WinSendMsg(   m_hWnd,
                    SM_SETHANDLE,
                    MPFROMHWND(rBitmap.GetHandle()),
                    (MPARAM)0);

    // Subclass again for purposes of dialog editing mode
    SubclassWin(m_hWnd);
    SetSize(nX, nY, m_pImage->GetWidth(), m_pImage->GetHeight());

    return true;
} // end of wxStaticBitmap::Create
Example #12
0
File: kimehook.c Project: komh/kime
MRESULT EXPENTRY newKimeWndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
{
    if( msg == KIMEM_RELOAD )
    {
        WinSendMsg( hwndKHS, KHSM_RELOADEXCEPTFILE, 0, 0 );
        hwndCurrentInput = NULLHANDLE;
    }

    if( msg == KIMEM_CALLHANJAINPUT )
    {
        initKimeStatus( hwndCurrentInput, FALSE );

        WinSendMsg( hwndHIA, WM_CHAR, MPFROMSH2CH( KC_LONEKEY | KC_SCANCODE, 0, 0x5B ), 0 );

        WinSetFocus( HWND_DESKTOP, hwndCurrentInput );

        return 0;
    }

    if( msg == KIMEM_CHANGEHANHOOK )
    {
        WinSendMsg( hwndHIA, HIAM_CHANGEHANMODE, 0, 0 );

        if( kimeOpt.useOS2IME )
            toggleOS2IMEHanEng( hwndCurrentInput );

        return 0;
    }

    if( msg == WM_CONTROL )
    {
        switch (SHORT1FROMMP(mp1))
        {
            case ID_HIA:
                switch (SHORT2FROMMP(mp1))
                {
                    case HIAN_INSERTHCH:
                        if (!(SHORT1FROMMP(mp2) & 0x8000))
                        {
                            sendCharToWnd( SHORT1FROMMP( mp2 ));

                            setInputBoxHch( 0 );
                            showInputBox( FALSE );
                        }
                        break;

                    case HIAN_COMPO_BEGIN:
                    case HIAN_COMPO_STEP:
                    case HIAN_COMPO_STEPBACK:
                        hchComposing = SHORT2FROMMP(mp2);

                        setInputBoxHch( hchComposing );
                        showInputBox( TRUE );
                        break;

#if 0
                    case HIAN_COMPO_STEP:
                        hchComposing = SHORT2FROMMP(mp2);

                        setInputBoxHch( hchComposing );
                        break;

                    case HIAN_COMPO_STEPBACK:
                        hchComposing = SHORT2FROMMP(mp2);

                        setInputBoxHch( hchComposing );
                        break;
#endif

                    case HIAN_COMPO_CANCEL:
                        setInputBoxHch( 0 );
                        showInputBox( FALSE );
                        hchComposing = 0;
                        break;

                    case HIAN_COMPO_COMPLETE:
                        sendCharToWnd( SHORT1FROMMP( mp2 ));

                        setInputBoxHch( 0 );
                        showInputBox( FALSE );
                        hchComposing = 0;
                        break;

                    case HIAN_HANMODECHANGED:
                        WinSendMsg( hwndKHS, KHSM_SETHANSTATUS, MPFROMHWND( hwndCurrentInput ), MPFROMLONG( LONGFROMMP( mp2 ) == HCH_HAN ));
                        WinSendMsg( hwndKime, KIMEM_SETHAN, MPFROMLONG( LONGFROMMP( mp2 ) == HCH_HAN ), 0 );
                        break;

                    case HIAN_KBDTYPECHANGED:
                        kimeOpt.kbdLayout = LONGFROMMR( mp2 );
                        break;

                    case HIAN_INSERTMODECHANGED:
                        break;

                    case HIAN_HGHJCONVERT:
                        WinSendMsg( hwndHIA, WM_CHAR, 0, 0 ); // call special char input

                        WinSetFocus( HWND_DESKTOP, hwndCurrentInput);
                        break;

                } // note switch end
                break;
        } // control switch end

        return 0;
    }

    return oldKimeWndProc( hwnd, msg, mp1, mp2 );
}
Example #13
0
File: kimehook.c Project: komh/kime
BOOL ztelnetAccelHook( PQMSG pQmsg )
{
    if( pQmsg->msg == WM_CHAR )
    {
        USHORT  fsFlags = SHORT1FROMMP( pQmsg->mp1 );
        //UCHAR   ucRepeat = CHAR3FROMMP( pQmsg->mp1 );
        //UCHAR   ucScancode = CHAR4FROMMP( pQmsg->mp1 );
        USHORT  usCh = SHORT1FROMMP( pQmsg->mp2 );
        USHORT  usVk = SHORT2FROMMP( pQmsg->mp2 );

        if( fsFlags & KC_KEYUP )
            return FALSE;

        if(( fsFlags & ( KC_SHIFT | KC_CTRL )) && ( usVk == VK_SPACE ))
        {
            WinSendMsg( hwndKime, KIMEM_CHANGEHAN, 0, 0 );
            WinSendMsg( hwndKHS, KHSM_CHANGEHANSTATUS, MPFROMHWND( pQmsg->hwnd ), 0 );
        }
        else if( !( fsFlags & KC_ALT ) && ( usVk == VK_F3 ))
        {
            WinSendMsg( hwndKime, KIMEM_CHANGEIM, 0, 0 );
            WinSendMsg( hwndKHS, KHSM_CHANGEIMSTATUS, MPFROMHWND( pQmsg->hwnd ), 0 );
        }
        else if( LONGFROMMR( WinSendMsg( hwndKime, KIMEM_QUERYHAN, 0, 0 ))
                 && ( !( fsFlags & ( KC_CTRL | KC_ALT ))))
        {
            UCHAR uch;
            UCHAR *kbdConv;
            BOOL  shiftOn;

            usCh = kbdKeyTranslate( pQmsg );
            uch = tolower( LOUCHAR( usCh ));
            if( fsFlags & KC_SHIFT )
                uch = toupper( uch );
            else if( kimeOpt.patchChat && prevHanInput &&
                     LONGFROMMR( WinSendMsg( hwndKime, KIMEM_QUERYIM, 0, 0 )) &&
                     ( usVk == VK_SPACE ))
                     WinSendMsg( pQmsg->hwnd, pQmsg->msg, pQmsg->mp1, pQmsg->mp2 );

            shiftOn = FALSE;
            if( isDblJaum( uch ))
            {
                if( dblJaumPressed )
                {
                    if( uchPrevDbl == uch )
                    {
                        if( kimeOpt.patch3bul )
                            WinSendMsg( pQmsg->hwnd, WM_CHAR,
                                        MPFROMSH2CH( fsFlags | KC_VIRTUALKEY, 0, 0 ),
                                        MPFROM2SHORT( 0, VK_BACKSPACE ));

                        uchPrevDbl = 0;
                        dblJaumPressed = FALSE;
                        shiftOn = TRUE;
                    }
                    else
                        uchPrevDbl = uch;
                }
                else
                {
                    uchPrevDbl = uch;
                    dblJaumPressed = TRUE;
                }
            }
            else
                dblJaumPressed = FALSE;

            if(( kbdConv = findKbdConv( uch )) != NULL )
            {
                fsFlags &= ~KC_SHIFT;
                if( kbdConv[ 3 ] || shiftOn )
                    fsFlags |= KC_SHIFT;

                usCh = MAKEUSHORT( kbdConv[ 1 ], 0 );
                if( kbdConv[ 2 ])
                {
                    if( kimeOpt.patch3bul )
                        WinSendMsg( pQmsg->hwnd, WM_CHAR,
                                    MPFROMSH2CH( fsFlags, 0, 0 ),
                                    MPFROM2SHORT( usCh, 0 ));

                    usCh = MAKEUSHORT( kbdConv[ 2 ], 0 );
                }

                if( usCh )
                {
                    if( kimeOpt.patch3bul )
                    {
                        //pQmsg->mp1 = MPFROMSH2CH( fsFlags, ucRepeat, ucScancode );
                        //pQmsg->mp2 = MPFROM2SHORT( usCh, usVk );

                        pQmsg->mp1 = MPFROMSH2CH( fsFlags, 0, 0 );
                        pQmsg->mp2 = MPFROM2SHORT( usCh, 0 );
                    }
                }
            }

            prevHanInput = ( strchr( SBCS_CHARS, SHORT1FROMMP( pQmsg->mp2 )) == NULL ) &&
                           !( fsFlags & KC_VIRTUALKEY );
        }
    }

    return FALSE;
}
BOOL AddNotebookPage(HWND hwndNoteBook, long pageID, PFNWP pfnDlgProc,
                     char szTabText[], char szMinorText[],
                     char szStatusText[], BOOL bMajor, char szClassName[])
{
    ULONG ulPageID;
    HWND hwndDialog;
    BOOKPAGEINFO bpInfo;

    if (bMajor)
    {
        // insert page
        if ((ulPageID = (ULONG) WinSendMsg(hwndNoteBook,
                                           BKM_INSERTPAGE,
                                           (MPARAM) NULL,
                                           MPFROM2SHORT(BKA_AUTOPAGESIZE |
                                                   BKA_STATUSTEXTON |
                                                   BKA_MAJOR | BKA_MINOR,
                                                   BKA_LAST))) == 0L)
        {
            PSUTErrorFunc(hwndNoteBook, "Error", "AddNotebookPage",
                          "Error Inserting the Major Notebook Page", 0UL);
            return FALSE;
        }
    }
    else
    {
        // insert page
        if ((ulPageID = (ULONG) WinSendMsg(hwndNoteBook,
                                           BKM_INSERTPAGE,
                                           (MPARAM) NULL,
                                           MPFROM2SHORT(BKA_AUTOPAGESIZE |
                                                   BKA_STATUSTEXTON |
                                                   BKA_MINOR,
                                                   BKA_LAST))) == 0L)
        {
            PSUTErrorFunc(hwndNoteBook, "Error", "AddNotebookPage",
                          "Error Inserting the Minor Notebook Page", 0UL);
            return FALSE;
        }
    }

    if ((hwndDialog = WinLoadDlg(hwndNoteBook,
                                 hwndNoteBook,
                                 pfnDlgProc,
                                 NULLHANDLE,
                                 pageID,
                                 MPFROMP(szClassName))) == NULLHANDLE)
    {
        PSUTErrorFunc(hwndNoteBook, "Error", "AddNotebookPage",
                      "Error Loading the Notebook Dialog", 0UL);

        return FALSE;
    }

    // set page info
    WinSendMsg(hwndNoteBook,
               BKM_SETPAGEDATA,
               MPFROMLONG(ulPageID),
               MPFROMSHORT(pageID));
    WinSendMsg(hwndNoteBook,
               BKM_SETTABTEXT,
               MPFROMLONG(ulPageID),
               MPFROMP(szTabText));
    WinSendMsg(hwndNoteBook,
               BKM_SETPAGEWINDOWHWND,
               MPFROMLONG(ulPageID),
               MPFROMHWND(hwndDialog));
    WinSendMsg(hwndNoteBook,
               BKM_SETSTATUSLINETEXT,
               MPFROMLONG(ulPageID),
               MPFROMP(szStatusText));

    // minor tab info
    memset(&bpInfo, 0, sizeof(bpInfo));
    bpInfo.cb = sizeof(bpInfo);
    bpInfo.fl = BFA_MINORTABTEXT;
    bpInfo.cbMinorTab = strlen(szMinorText);
    bpInfo.pszMinorTab = szMinorText;
    //Set the Minor text info, so popup menu has the correct text
    WinSendMsg(hwndNoteBook,
               BKM_SETPAGEINFO,
               MPFROMLONG(ulPageID),
               MPFROMP(&bpInfo));

    return TRUE;
}
MRESULT EXPENTRY cdTypeOptionDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
  CWDataFolder* thisPtr;
  ULONG ulFlags;
  LONG lSpinValue;
  static HWND hwndStatus;
  int a;
  char chrCD[4];
  char text[CCHMAXPATH];
  char title[CCHMAXPATH];
  char text2[40];

  ULONG rc;
  THISPTR thisPtrStruct;

  switch(msg)
    {
    case WM_INITDLG :	
      WinSetWindowULong(hwnd, QWL_USER,(ULONG)PVOIDFROMMP(mp2));//Save object ptr.

      thisPtr=(CWDataFolder*)PVOIDFROMMP(mp2);
      if(somIsObj(thisPtr)) {
        ulFlags=((CWDataFolder*)PVOIDFROMMP(mp2))->cwQueryCDTypeFlags();
        // enableCDTypeCntrls(hwnd,(CWDataFolder*)PVOIDFROMMP(mp2));
        enableCDTypeCntrls(hwnd,ulFlags);

        /*        if(ulFlags&IDCDT_FIXDISK) 
          WinCheckButton(hwnd,IDCB_FIXDISK,1);*/

        getMessage(title,IDSTRD_BOOTIMAGE,sizeof(title), hDataResource,hwnd);
        getMessage(text2,IDSTRD_BOOTIMAGENAME,sizeof(text2), hDataResource,hwnd);
        sprintf(text,title,text2);
        WinSetWindowText( WinWindowFromID(hwnd,IDST_BOOTIMAGE), text );
        getMessage(title,IDSTRD_BOOTCATALOG,sizeof(title), hDataResource,hwnd);
        getMessage(text2,IDSTRD_BOOTCATALOGNAME,sizeof(text2), hDataResource,hwnd);
        sprintf(text,title,text2);
        WinSetWindowText( WinWindowFromID(hwnd,IDST_BOOTCATALOG), text );
      }

      /* Move default buttons on Warp 4 */
      cwMoveNotebookButtonsWarp4(hwnd, IDPB_CDTYPEHELP, 20);
      return (MRESULT) TRUE;
      /* This prevents switching the notebook page behind the open folder */
    case WM_WINDOWPOSCHANGED:
      {
        MRESULT mr;

        if(WinQueryFocus(HWND_DESKTOP)!=
           WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT)) {
          mp2=MPFROMLONG(LONGFROMMP(mp2)|0x80000);/*AWP_ACTIVATE 0x00080000L*/
          mr=WinDefDlgProc(hwnd, msg, mp1, mp2);
          return mr;  
        }
        break;
      }
    case WM_FOCUSCHANGE:
      {
        if(!SHORT1FROMMP(mp2)) {
          if(HWNDFROMMP(mp1)==hwnd) {
            MRESULT mr;

            mr=WinDefDlgProc(hwnd, msg, mp1, mp2);
            WinSendMsg(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT), WM_SETFOCUS, MPFROMHWND(hwnd), (MPARAM)TRUE);
            return mr;
          }
        }
        break;
      }
#if 0
    case WM_WINDOWPOSCHANGED:
      {
        /* This prevents switching the notebook page behind the open folder */
        if(!(WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_FLAGS) & FF_ACTIVE))
          mp2=MPFROMLONG(0x80000);
        break;
      }
#endif
    case WM_DESTROY:
      /* The notebook closes and gets destroyed */
      /* Set focus to desktop to prevent PM freeze */
      WinSetFocus(HWND_DESKTOP, HWND_DESKTOP);

      /* Let the WPS save the new instance data */
      //      thisPtr=(CWDataFolder*) WinQueryWindowULong(WinWindowFromID(hwnd,IDPB_CDTYPEUNDO),QWL_USER);
      thisPtr=(CWDataFolder*) WinQueryWindowULong(hwnd, QWL_USER);
      if(somIsObj(thisPtr)) {
        ulFlags=0;
        if(WinQueryButtonCheckstate(hwnd,IDRB_MULTISESSION)&1) {
          ulFlags|=IDCDT_MULTISESSION;
        }
        if(WinQueryButtonCheckstate(hwnd,IDRB_USERDEFINED)&1)
          ulFlags|=IDCDT_USERDEFINED;

        if(WinQueryButtonCheckstate(hwnd,IDRB_BOOTCD)&1)
          ulFlags|=IDCDT_BOOTCD;
        
        if(WinQueryButtonCheckstate(hwnd,IDRB_TRACKDATA)&1)
          ulFlags|=IDCDT_TRACKDATA;
        else
          if(WinQueryButtonCheckstate(hwnd,IDRB_TRACKMODE2)&1)
            ulFlags|=IDCDT_TRACKMODE2;
          else
            if(WinQueryButtonCheckstate(hwnd,IDRB_TRACKXA1)&1)
              ulFlags|=IDCDT_TRACKXA1;
            else
              if(WinQueryButtonCheckstate(hwnd,IDRB_TRACKXA2)&1)
                ulFlags|=IDCDT_TRACKXA2;
              else
                if(WinQueryButtonCheckstate(hwnd,IDRB_TRACKCDI)&1)
                  ulFlags|=IDCDT_TRACKCDI;
        
        if(WinQueryButtonCheckstate(hwnd,IDCB_FIXDISK)&1)
          ulFlags|=IDCDT_FIXDISK;
        thisPtr->cwSetCDTypeFlags(ulFlags,CDT_ALLFLAGS);
        thisPtr->wpSaveImmediate();
      }
      /* Setup is done */   
      bMultiSessionDone=TRUE;
      return (MRESULT) FALSE;
    case WM_CONTROL:
      //      thisPtr=(CWDataFolder*) WinQueryWindowULong(WinWindowFromID(hwnd,IDPB_CDTYPEUNDO),QWL_USER);
      thisPtr=(CWDataFolder*) WinQueryWindowULong(hwnd,QWL_USER);
      if(!somIsObj(thisPtr)) return (MRESULT) TRUE;
      ulFlags=thisPtr->cwQueryCDTypeFlags();/* Get current flags */
      ulFlags&=(IDCDT_ALLTRACKTYPES|IDCDT_FIXDISK);/* Keep the tracktype information */
      switch(SHORT1FROMMP(mp1))
        {
        case IDRB_SINGLESESSION:
          enableCDTypeCntrls(hwnd, ulFlags);
          break;
        case IDRB_MULTISESSION:
          ulFlags|=IDCDT_MULTISESSION;
          enableCDTypeCntrls(hwnd, ulFlags);
          break;
        case IDRB_BOOTCD:
          ulFlags|=IDCDT_BOOTCD;
          enableCDTypeCntrls(hwnd, ulFlags);
          break;
        case IDRB_USERDEFINED:
          ulFlags|=IDCDT_USERDEFINED;
          enableCDTypeCntrls(hwnd, ulFlags);
          break;
#if 0
        case IDRB_SINGLESESSION:
          _showMultiSessionCntrls(hwnd,FALSE);
          _showBootCDCntrls(hwnd, FALSE);
          _showTrackCntrls(hwnd, FALSE);
          _showSingleSessionCntrls(hwnd,TRUE);
          break;
        case IDRB_MULTISESSION:
          _showTrackCntrls(hwnd, FALSE);
          _showBootCDCntrls(hwnd, FALSE);
          _showMultiSessionCntrls(hwnd,TRUE);
          thisPtr->cwEnableMultiSessionCntrls(hwnd,FALSE);
          break;
        case IDRB_BOOTCD:
          _showTrackCntrls(hwnd, FALSE);
          _showMultiSessionCntrls(hwnd,FALSE);
          _showBootCDCntrls(hwnd, TRUE);
          break;
        case IDRB_USERDEFINED:
          _showMultiSessionCntrls(hwnd,FALSE);
          _showBootCDCntrls(hwnd, FALSE);
          _showTrackCntrls(hwnd, TRUE);
          break;
#endif
        default:
          break;
        }
      break;
    case WM_COMMAND:	
      switch(SHORT1FROMMP(mp1))
        {
        case IDPB_BOOTCDCONFIGURE:
          //thisPtr=(CWDataFolder*) WinQueryWindowULong(WinWindowFromID(hwnd,IDPB_CDTYPEUNDO),QWL_USER);
          thisPtr=(CWDataFolder*) WinQueryWindowULong(hwnd,QWL_USER);
          if(!somIsObj(thisPtr)) return (MRESULT) TRUE;

          thisPtrStruct.usSize=sizeof(thisPtrStruct);
          thisPtrStruct.thisPtr=thisPtr;
          if( WinDlgBox( HWND_DESKTOP, NULLHANDLE, _bootCDOptionsDialogProc, hDataResource, 
                         IDDLG_BOOTCDOPTIONS, &thisPtrStruct) == DID_OK )
            {
              getMessage(title,IDSTRD_BOOTIMAGE,sizeof(title), hDataResource,hwnd);
              sprintf(text,title,thisPtr->chrBootImage);
              WinSetWindowText( WinWindowFromID(hwnd,IDST_BOOTIMAGE), text );
              
              getMessage(title,IDSTRD_BOOTCATALOG,sizeof(title), hDataResource,hwnd);
              sprintf(text,title,thisPtr->chrBootCatalog);
              WinSetWindowText( WinWindowFromID(hwnd,IDST_BOOTCATALOG), text );
            }
          break;
        case IDPB_CDTYPEUNDO:
          // thisPtr=(CWDataFolder*) WinQueryWindowULong(WinWindowFromID(hwnd,IDPB_CDTYPEUNDO),QWL_USER);
          thisPtr=(CWDataFolder*) WinQueryWindowULong(hwnd,QWL_USER);
          /* User pressed the UNDO button */
          if(somIsObj(thisPtr)) {
            //ulFlags=thisPtr->cwQueryCDTypeFlags();
            /* Enable all multisesson controls */
            //  thisPtr->cwEnableMultiSessionCntrls(hwnd,TRUE);
            //            enableCDTypeCntrls(hwnd,thisPtr);
            enableCDTypeCntrls(hwnd, thisPtr->cwQueryCDTypeFlags());
            /*            if(ulFlags&IDCDT_FIXDISK) 
                          WinCheckButton(hwnd,IDCB_FIXDISK,1);
                          else
                          WinCheckButton(hwnd,IDCB_FIXDISK,0);*/
          }
          break;  
        default:
          break;
        }
      return (MRESULT) TRUE;
    default:
      break;
    }
  return WinDefDlgProc(hwnd, msg, mp1, mp2); 
}
/* This procedure handles the filename options page */ 
MRESULT EXPENTRY fileNameOptionDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 
{
  CWDataFolder* thisPtr;
  ULONG ulFlags;

  switch(msg)
    {
    case WM_INITDLG :	
      WinSetWindowULong(hwnd, QWL_USER,(ULONG)PVOIDFROMMP(mp2));//Save object ptr.

      thisPtr=(CWDataFolder*)PVOIDFROMMP(mp2);
      if(!somIsObj(thisPtr))
        return (MRESULT) TRUE;
      if(thisPtr->cwQueryMkisofsFlags()&IDMK_ALLOW32CHARS) {
        WinCheckButton(hwnd,IDRB_32CHARNAMES,1);
        WinCheckButton(hwnd,IDRB_DOSNAMES,0);
      }
      else {
        WinCheckButton(hwnd,IDRB_32CHARNAMES,0);
        WinCheckButton(hwnd,IDRB_DOSNAMES,1);
      }

      /* TRANS.TBL files */
      if(thisPtr->cwQueryMkisofsFlags() & IDMK_TRANSTABLE)
        WinCheckButton(hwnd,IDCB_TRANSTABLE,1);
      else
        WinCheckButton(hwnd,IDCB_TRANSTABLE,0);

      if(((CWDataFolder*)PVOIDFROMMP(mp2))->cwQueryMkisofsFlags()&IDMK_JOLIET)
        WinCheckButton(hwnd,IDCB_JOLIET,1);

      WinShowWindow(WinWindowFromID(hwnd,IDCB_DEEPDIRECTORIES),FALSE);
      
      /* Move default buttons on Warp 4 */
      cwMoveNotebookButtonsWarp4(hwnd, IDPB_FILENAMEHELP, 20);
      return (MRESULT) TRUE;
      /*    case WM_HELP:
			thisPtr=(CWAudioFolder*) WinQueryWindowULong(WinWindowFromID(hwnd,IDPB_CDRECORDBROWSE),QWL_USER);
			if(!thisPtr)
            break;
			switch(WinQueryWindowUShort(WinQueryFocus(HWND_DESKTOP),QWS_ID))
            {
            case IDEF_CDRECORDOPTIONS:
            return (MRESULT)thisPtr->wpDisplayHelp(IDEF_CDRECORDOPTIONS,AFHELPLIBRARY);
            case IDPB_WIDERRUFEN:
            return (MRESULT)thisPtr->wpDisplayHelp(IDPB_WIDERRUFEN,AFHELPLIBRARY);
            case IDPB_CDRECORDBROWSE:
            return (MRESULT)thisPtr->wpDisplayHelp(IDPB_CDRECORDBROWSE,AFHELPLIBRARY);
            case IDEF_CDRECORDPATH:
            return (MRESULT)thisPtr->wpDisplayHelp(IDEF_CDRECORDPATH,AFHELPLIBRARY);
            default:
            break;
            }
			return (MRESULT)thisPtr->wpDisplayHelp(IDDLG_CDRECORDSETUP,AFHELPLIBRARY);
			break;*/
      /* This prevents switching the notebook page behind the open folder */
    case WM_WINDOWPOSCHANGED:
      {
        MRESULT mr;

        if(WinQueryFocus(HWND_DESKTOP)!=
           WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT)) {
          mp2=MPFROMLONG(LONGFROMMP(mp2)|0x80000);/*AWP_ACTIVATE 0x00080000L*/
          mr=WinDefDlgProc(hwnd, msg, mp1, mp2);
          return mr;  
        }
        break;
      }
    case WM_FOCUSCHANGE:
      {
        if(!SHORT1FROMMP(mp2)) {
          if(HWNDFROMMP(mp1)==hwnd) {
            MRESULT mr;

            mr=WinDefDlgProc(hwnd, msg, mp1, mp2);
            WinSendMsg(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT), WM_SETFOCUS, MPFROMHWND(hwnd), (MPARAM)TRUE);
            return mr;
          }
        }
        break;
      }
#if 0
    case WM_WINDOWPOSCHANGED:
      {
        /* This prevents switching the notebook page behind the open folder */
        if(!(WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_FLAGS) & FF_ACTIVE))
          mp2=MPFROMLONG(0x80000);
        break;
      }
#endif
    case WM_DESTROY:
      /* The notebook closes and gets destroyed */
      /* Set focus to desktop to prevent PM freeze */
      WinSetFocus(HWND_DESKTOP, HWND_DESKTOP);

      /* Let the WPS save the new instance data */
          //      thisPtr=(CWDataFolder*) WinQueryWindowULong(WinWindowFromID(hwnd,IDPB_FILENAMEUNDO),QWL_USER);
      thisPtr=(CWDataFolder*) WinQueryWindowULong(hwnd,QWL_USER);
      if(somIsObj(thisPtr)) {
        ulFlags=0;


        if(WinQueryButtonCheckstate(hwnd,IDCB_JOLIET) &1 )
          ulFlags|=IDMK_JOLIET;
        if(WinQueryButtonCheckstate(hwnd,IDRB_32CHARNAMES) &1 )
          ulFlags|=IDMK_ALLOW32CHARS;
        /* TRANS.TBL files */
        if(WinQueryButtonCheckstate(hwnd,IDCB_TRANSTABLE) &1 )
          ulFlags|=IDMK_TRANSTABLE;

        thisPtr->cwSetMkisofsFlags(ulFlags,
                                   IDMK_ALLOW32CHARS|IDMK_JOLIET| IDMK_TRANSTABLE);
        thisPtr->wpSaveImmediate();
      }
      /* Setup is done */   
      return (MRESULT) TRUE;
    case WM_COMMAND:	
    switch(SHORT1FROMMP(mp1))
      {
      case IDPB_FILENAMEUNDO:
        /* User pressed the UNDO button */
        //thisPtr=(CWDataFolder*) WinQueryWindowULong(WinWindowFromID(hwnd,IDPB_FILENAMEUNDO),QWL_USER);
        thisPtr=(CWDataFolder*) WinQueryWindowULong(hwnd,QWL_USER);
        if(somIsObj(thisPtr)) {
          ulFlags=thisPtr->cwQueryMkisofsFlags();
          if(ulFlags&IDMK_ALLOW32CHARS) {
            WinCheckButton(hwnd,IDRB_32CHARNAMES,1);
            WinCheckButton(hwnd,IDRB_DOSNAMES,0);
          }
          else {
            WinCheckButton(hwnd,IDRB_32CHARNAMES,0);
            WinCheckButton(hwnd,IDRB_DOSNAMES,1);
          }

          if(ulFlags&IDMK_TRANSTABLE)
            WinCheckButton(hwnd,IDCB_TRANSTABLE,1);
          else
            WinCheckButton(hwnd,IDCB_TRANSTABLE,0);

          if(ulFlags&IDMK_JOLIET)
            WinCheckButton(hwnd,IDCB_JOLIET,1);
          else
            WinCheckButton(hwnd,IDCB_JOLIET,0);
        }
        break;
      default:
        break;
      }
    return (MRESULT) TRUE;
    default:
      break;
    }
  return WinDefDlgProc(hwnd, msg, mp1, mp2);
}
Example #17
0
//
// Same as AddPage() but does it at given position
//
bool wxNotebook::InsertPage ( size_t          nPage,
                              wxNotebookPage* pPage,
                              const wxString& rsStrText,
                              bool            bSelect,
                              int             nImageId )
{
    ULONG                           ulApiPage;

    wxASSERT( pPage != NULL );
    wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), false );

    //
    // Under OS/2 we can only insert FIRST, LAST, NEXT or PREV.  Requires
    // two different calls to the API.  Page 1 uses the BKA_FIRST.  Subsequent
    // pages use the previous page ID coupled with a BKA_NEXT call.  Unlike
    // Windows, OS/2 uses an internal Page ID to ID the pages.
    //
    // OS/2 also has a nice auto-size feature that automatically sizes the
    // the attached window so we don't have to worry about the size of the
    // window on the page.
    //
    if (nPage == 0)
    {
        ulApiPage = LONGFROMMR(::WinSendMsg( GetHWND()
                                            ,BKM_INSERTPAGE
                                            ,(MPARAM)0
                                            ,MPFROM2SHORT(BKA_AUTOPAGESIZE | BKA_MAJOR, BKA_FIRST)
                                           ));
        if (ulApiPage == 0L)
        {
            ERRORID                 vError;
            wxString                sError;

            vError = ::WinGetLastError(vHabmain);
            sError = wxPMErrorToStr(vError);
            return false;
        }
        m_alPageId.Insert((long)ulApiPage, nPage);
    }
    else
    {
        ulApiPage = LONGFROMMR(::WinSendMsg( GetHWND()
                                            ,BKM_INSERTPAGE
                                            ,MPFROMLONG((ULONG)m_alPageId[nPage - 1])
                                            ,MPFROM2SHORT(BKA_AUTOPAGESIZE | BKA_MAJOR, BKA_NEXT)
                                           ));
        if (ulApiPage == 0L)
        {
            ERRORID                     vError;
            wxString                    sError;

            vError = ::WinGetLastError(vHabmain);
            sError = wxPMErrorToStr(vError);
            return false;
        }
        m_alPageId.Insert((long)ulApiPage, nPage);
    }

    //
    // Associate a window handle with the page
    //
    if (pPage)
    {
        if (!::WinSendMsg( GetHWND()
                          ,BKM_SETPAGEWINDOWHWND
                          ,MPFROMLONG((ULONG)m_alPageId[nPage])
                          ,MPFROMHWND(pPage->GetHWND())
                         ))
            return false;
    }
    //
    // If the inserted page is before the selected one, we must update the
    // index of the selected page
    //
    if (nPage <= (size_t)m_nSelection)
    {
        //
        // One extra page added
        //
        m_nSelection++;
    }

    if (pPage)
    {
        //
        // Save the pointer to the page
        //
        m_pages.Insert( pPage
                       ,nPage
                      );
    }

    //
    // Now set TAB dimenstions
    //

    wxWindowDC vDC(this);
    wxCoord    nTextX;
    wxCoord    nTextY;

    vDC.GetTextExtent(rsStrText, &nTextX, &nTextY);
    nTextY *= 2;
    nTextX  = (wxCoord)(nTextX * 1.3);
    if (nTextX > m_nTabSize)
    {
        m_nTabSize = nTextX;
        ::WinSendMsg( GetHWND()
                     ,BKM_SETDIMENSIONS
                     ,MPFROM2SHORT((USHORT)m_nTabSize, (USHORT)nTextY)
                     ,(MPARAM)BKA_MAJORTAB
                    );
    }
    //
    // Now set any TAB text
    //
    if (!rsStrText.empty())
    {
        if (!SetPageText( nPage
                         ,rsStrText
                        ))
            return false;
    }

    //
    // Now set any TAB bitmap image
    //
    if (nImageId != -1)
    {
        if (!SetPageImage( nPage
                          ,nImageId
                         ))
            return false;
    }

    if (pPage)
    {
        //
        // Don't show pages by default (we'll need to adjust their size first)
        //
        HWND hWnd = GetWinHwnd(pPage);

        WinSetWindowULong( hWnd
                          ,QWL_STYLE
                          ,WinQueryWindowULong( hWnd
                                               ,QWL_STYLE
                                              ) & ~WS_VISIBLE
                         );

        //
        // This updates internal flag too - otherwise it will get out of sync
        //
        pPage->Show(false);
    }

    //
    // Some page should be selected: either this one or the first one if there is
    // still no selection
    //
    int nSelNew = -1;

    if (bSelect)
        nSelNew = nPage;
    else if ( m_nSelection == -1 )
        nSelNew = 0;

    if (nSelNew != -1)
        SetSelection(nSelNew);

    InvalidateBestSize();

    return true;
} // end of wxNotebook::InsertPage
/* This procedure handles the author settings page */ 
MRESULT EXPENTRY authorOptionDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 
{
  CWDataFolder* thisPtr;

  switch(msg)
    {
    case WM_INITDLG :	
      WinSetWindowULong(hwnd, QWL_USER,(ULONG)PVOIDFROMMP(mp2));//Save object ptr.
      thisPtr=(CWDataFolder*)PVOIDFROMMP(mp2);
      WinSendMsg(WinWindowFromID(hwnd,IDEF_APPLICATION),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)128),0);
      WinSetWindowText(WinWindowFromID(hwnd,IDEF_APPLICATION),thisPtr->chrApplication);
      WinSendMsg(WinWindowFromID(hwnd,IDEF_PUBLISHER),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)128),0);
      WinSetWindowText(WinWindowFromID(hwnd,IDEF_PUBLISHER),thisPtr->chrPublisher);
      WinSendMsg(WinWindowFromID(hwnd,IDEF_PREPARER),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)128),0);
      WinSetWindowText(WinWindowFromID(hwnd,IDEF_PREPARER),thisPtr->chrPreparer);
      WinSendMsg(WinWindowFromID(hwnd,IDEF_VOLUMENAME),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)32),0);
      WinSetWindowText(WinWindowFromID(hwnd,IDEF_VOLUMENAME),thisPtr->chrVolumeName);

      /* Move default buttons on Warp 4 */
      cwMoveNotebookButtonsWarp4(hwnd, IDPB_AUTHORHELP, 20);
      return (MRESULT) TRUE;
      /* This prevents switching the notebook page behind the open folder */
    case WM_WINDOWPOSCHANGED:
      {
        MRESULT mr;

        if(WinQueryFocus(HWND_DESKTOP)!=
           WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT)) {
          mp2=MPFROMLONG(LONGFROMMP(mp2)|0x80000);/*AWP_ACTIVATE 0x00080000L*/
          mr=WinDefDlgProc(hwnd, msg, mp1, mp2);
          return mr;  
        }
        break;
      }
    case WM_FOCUSCHANGE:
      {
        if(!SHORT1FROMMP(mp2)) {
          if(HWNDFROMMP(mp1)==hwnd) {
            MRESULT mr;

            mr=WinDefDlgProc(hwnd, msg, mp1, mp2);
            WinSendMsg(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT), WM_SETFOCUS, MPFROMHWND(hwnd), (MPARAM)TRUE);
            return mr;
          }
        }
        break;
      }
    case WM_DESTROY:
      /* The notebook closes and gets destroyed */
      /* Set focus to desktop to prevent PM freeze */
      WinSetFocus(HWND_DESKTOP, HWND_DESKTOP);

      /* Let the WPS save the new instance data */
      //      thisPtr=(CWDataFolder*) WinQueryWindowULong(WinWindowFromID(hwnd,IDPB_AUTHORUNDO),QWL_USER);
      thisPtr=(CWDataFolder*) WinQueryWindowULong(hwnd,QWL_USER);
      if(somIsObj(thisPtr)) {
        WinQueryWindowText( WinWindowFromID(hwnd,IDEF_APPLICATION),sizeof(thisPtr->chrApplication),thisPtr->chrApplication);
        WinQueryWindowText( WinWindowFromID(hwnd,IDEF_PUBLISHER),sizeof(thisPtr->chrPublisher),thisPtr->chrPublisher);
        WinQueryWindowText( WinWindowFromID(hwnd,IDEF_PREPARER),sizeof(thisPtr->chrPreparer),thisPtr->chrPreparer);
        WinQueryWindowText( WinWindowFromID(hwnd,IDEF_VOLUMENAME),sizeof(thisPtr->chrVolumeName),thisPtr->chrVolumeName);
        thisPtr->wpSaveDeferred();
      }
      /* Setup is done */
      return (MRESULT) TRUE;
    case WM_COMMAND:	
    switch(SHORT1FROMMP(mp1))
      {
      case IDPB_AUTHORUNDO:
        /* User pressed the UNDO button */
        //   thisPtr=(CWDataFolder*) WinQueryWindowULong(WinWindowFromID(hwnd,IDPB_AUTHORUNDO),QWL_USER);
        thisPtr=(CWDataFolder*) WinQueryWindowULong(hwnd,QWL_USER);
        if(somIsObj(thisPtr)) {
          WinSetWindowText(WinWindowFromID(hwnd,IDEF_APPLICATION),thisPtr->chrApplication);
          WinSetWindowText(WinWindowFromID(hwnd,IDEF_PUBLISHER),thisPtr->chrPublisher);
          WinSetWindowText(WinWindowFromID(hwnd,IDEF_PREPARER),thisPtr->chrPreparer);
          WinSetWindowText(WinWindowFromID(hwnd,IDEF_VOLUMENAME),thisPtr->chrVolumeName);
        }
        break;
      default:
        break;
      }
    return (MRESULT) TRUE;
    default:
      break;
    }
  return WinDefDlgProc(hwnd, msg, mp1, mp2);
}
MRESULT EXPENTRY specialOptionDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
  CWDataFolder* thisPtr;
  ULONG ulFlags;
  LONG lSpinValue;
  static HWND hwndStatus;
  int a;
  char chrCD[4];
  char text[CCHMAXPATH];
  char title[CCHMAXPATH];
  char text2[40];

  ULONG rc;
  THISPTR thisPtrStruct;

  switch(msg)
    {
    case WM_INITDLG :	
      WinSetWindowULong(hwnd, QWL_USER,(ULONG)PVOIDFROMMP(mp2));//Save object ptr.
      thisPtr=(CWDataFolder*)PVOIDFROMMP(mp2);
      if(somIsObj(thisPtr)) {
        ulFlags=((CWDataFolder*)PVOIDFROMMP(mp2))->cwQueryMkisofsFlags();
        
        if(ulFlags & IDMK_SHADOWSINROOTONLY) { 
          WinCheckButton(hwnd,IDRB_SHADOWSINROOTONLY,1);
          enableArchiveCntrls(hwnd, FALSE);
        }
        else {
          WinCheckButton(hwnd,IDRB_FOLLOWALLSHADOWS,1);
          enableArchiveCntrls(hwnd, TRUE);
        }
        /* Use archive bit */
        if(ulFlags & IDMK_USEARCHIVEBIT) 
          WinCheckButton(hwnd, IDCB_USEARCHIVEBIT, 1);
        else
          WinCheckButton(hwnd, IDCB_USEARCHIVEBIT, 0);
        /* Reset archive bit */
        if(ulFlags & IDMK_RESETARCHIVEBIT) 
          WinCheckButton(hwnd, IDCB_RESETARCHIVEBIT,1);
        else
          WinCheckButton(hwnd, IDCB_RESETARCHIVEBIT, 0);
      }
      /* Move default buttons on Warp 4 */
      cwMoveNotebookButtonsWarp4(hwnd, IDPB_SPECIALHELP, 20);
      return (MRESULT) TRUE;
      /* This prevents switching the notebook page behind the open folder */
    case WM_WINDOWPOSCHANGED:
      {
        MRESULT mr;

        if(WinQueryFocus(HWND_DESKTOP)!=
           WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT)) {
          mp2=MPFROMLONG(LONGFROMMP(mp2)|0x80000);/*AWP_ACTIVATE 0x00080000L*/
          mr=WinDefDlgProc(hwnd, msg, mp1, mp2);
          return mr;  
        }
        break;
      }
    case WM_FOCUSCHANGE:
      {
        if(!SHORT1FROMMP(mp2)) {
          if(HWNDFROMMP(mp1)==hwnd) {
            MRESULT mr;

            mr=WinDefDlgProc(hwnd, msg, mp1, mp2);
            WinSendMsg(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT), QW_PARENT), WM_SETFOCUS, MPFROMHWND(hwnd), (MPARAM)TRUE);
            return mr;
          }
        }
        break;
      }
    case WM_DESTROY:
      /* The notebook closes and gets destroyed */
      /* Set focus to desktop to prevent PM freeze */
      WinSetFocus(HWND_DESKTOP, HWND_DESKTOP);

      /* Let the WPS save the new instance data */
      //      thisPtr=(CWDataFolder*) WinQueryWindowULong(WinWindowFromID(hwnd,IDPB_SPECIALUNDO),QWL_USER);
      thisPtr=(CWDataFolder*) WinQueryWindowULong(hwnd,QWL_USER);
      if(somIsObj(thisPtr)) {
        ulFlags=thisPtr->cwQueryMkisofsFlags();
        if(WinQueryButtonCheckstate(hwnd,IDRB_SHADOWSINROOTONLY) & 1) {
          ulFlags|=IDMK_SHADOWSINROOTONLY;
        }
        else
          ulFlags&=~IDMK_SHADOWSINROOTONLY;
        /* Use archive bit */
        if(WinQueryButtonCheckstate(hwnd, IDCB_USEARCHIVEBIT) & 1) {
          ulFlags|=IDMK_USEARCHIVEBIT;
        }
        else
          ulFlags&=~IDMK_USEARCHIVEBIT;
        /* Reset archive bit */
        if(WinQueryButtonCheckstate(hwnd, IDCB_RESETARCHIVEBIT) & 1) {
          ulFlags|=IDMK_RESETARCHIVEBIT;
        }
        else
          ulFlags&=~IDMK_RESETARCHIVEBIT;

        thisPtr->cwSetMkisofsFlags(ulFlags,MK_ALLFLAGS);
        thisPtr->wpSaveImmediate();
      }
      /* Setup is done */   
    
      return (MRESULT) FALSE;
    case WM_CONTROL:
      switch(SHORT1FROMMP(mp1))
        {
        case IDRB_SHADOWSINROOTONLY:
          enableArchiveCntrls(hwnd, FALSE);
          break;
        case IDRB_FOLLOWALLSHADOWS:
          enableArchiveCntrls(hwnd, TRUE);          
          break;
        default:
          break;
        }
      break;
    case WM_COMMAND:	
      //thisPtr=(CWDataFolder*) WinQueryWindowULong(WinWindowFromID(hwnd,IDPB_SPECIALUNDO),QWL_USER);
      thisPtr=(CWDataFolder*) WinQueryWindowULong(hwnd,QWL_USER);
      if(!somIsObj(thisPtr)) 
        return (MRESULT) TRUE;
      switch(SHORT1FROMMP(mp1))
        {
        case IDPB_SPECIALUNDO:
          /* User pressed the UNDO button */
          ulFlags=thisPtr->cwQueryMkisofsFlags();
          if(ulFlags & IDMK_SHADOWSINROOTONLY) 
            WinCheckButton(hwnd,IDRB_SHADOWSINROOTONLY,1);
          else
            WinCheckButton(hwnd, IDRB_FOLLOWALLSHADOWS,1);
          /* Use archive bit */
          if(ulFlags & IDMK_USEARCHIVEBIT) 
            WinCheckButton(hwnd, IDCB_USEARCHIVEBIT, 1);
          else
            WinCheckButton(hwnd, IDCB_USEARCHIVEBIT, 0);
          /* Reset archive bit */
          if(ulFlags & IDMK_RESETARCHIVEBIT) 
            WinCheckButton(hwnd, IDCB_RESETARCHIVEBIT,1);
          else
            WinCheckButton(hwnd, IDCB_RESETARCHIVEBIT, 0);          
          break;  
        case IDPB_SPECIALHELP:
          thisPtr->wpDisplayHelp(IDHLP_DATAFOLDERSPECIAL,AFHELPLIBRARY);
          break;
        case IDPB_RESETNOW:
          /* Text: ""
             Title: ""
             */
          rc=messageBox( text, IDSTRD_RESETARCHIVEBITCONFIRM , sizeof(text),
                      title, IDSTRD_RESETARCHIVEBITTITLE, sizeof(title),
                      hDataResource, HWND_DESKTOP, MB_YESNO | MB_ICONQUESTION | MB_MOVEABLE | MB_DEFBUTTON2);          
          if(rc==MBID_YES)
            DosBeep(5000,1000);
          break;
        default:
          break;
        }
      return (MRESULT) TRUE;
    default:
      break;
    }
  return WinDefDlgProc(hwnd, msg, mp1, mp2); 
}
Example #20
0
BOOL InitializeNoteBook(HWND hwnd)
{
   HWND hwndPage;
   ULONG ulPageId;
   ULONG ipt = 0;
   CHAR pszMleBuffer[512];
   PSZ   pszNoteBookText = "TEST";

   /*
    * Insert the first page.
    */
   ulPageId = (LONG)WinSendDlgItemMsg(hwnd, IDC_NOTEBOOK,
        BKM_INSERTPAGE, NULL,
        MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR),
        BKA_LAST));

   if ( !ulPageId)
     return FALSE;

   if ( !WinSendDlgItemMsg(hwnd, IDC_NOTEBOOK,
        BKM_SETSTATUSLINETEXT, MPFROMLONG(ulPageId),
        MPFROMP("Page 1 of 2")))
     return FALSE;

   if ( !WinSendDlgItemMsg(hwnd, IDC_NOTEBOOK,
        BKM_SETTABTEXT, MPFROMLONG(ulPageId),
        MPFROMP("~1")))
     return FALSE;

   hwndPage =
   WinCreateWindow(               /* parent-window handle                    */
      hwnd,                       /* pointer to registered class name        */
      WC_STATIC,                  /* pointer to window text                  */
      "#6",                       /* window style                            */
      WS_VISIBLE | SS_BITMAP,     /* horizontal position of window           */
      0,                          /* vertical position of window             */
      0,                          /* window width                            */
      0,                          /* window height                           */
      0,                          /* owner-window handle                     */
      NULLHANDLE,                 /* handle to sibling window                */
      HWND_TOP,                   /* window identifier                       */
      0,                          /* pointer to buffer                       */
      NULL,                       /* pointer to structure with pres. params. */
      NULL);

   if (!hwndPage)
     return FALSE;

   if ( !WinSendDlgItemMsg(hwnd, IDC_NOTEBOOK,
         BKM_SETPAGEWINDOWHWND, MPFROMLONG(ulPageId),
         MPFROMHWND(hwndPage)))
     return FALSE;

   /*
    * Insert the second page.
    */
    ulPageId = (LONG)WinSendDlgItemMsg(hwnd, IDC_NOTEBOOK,
         BKM_INSERTPAGE, NULL,
         MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR),
         BKA_LAST));

   if (!ulPageId)
     return FALSE;

   if ( !WinSendDlgItemMsg(hwnd, IDC_NOTEBOOK,
         BKM_SETSTATUSLINETEXT, MPFROMLONG(ulPageId),
         MPFROMP("Page 2 of 2")))
     return FALSE;

   if ( !WinSendDlgItemMsg(hwnd, IDC_NOTEBOOK,
        BKM_SETTABTEXT, MPFROMLONG(ulPageId),
        MPFROMP("~2")))
     return FALSE;

   hwndPage =
   WinCreateWindow(
      hwnd,                       /* parent-window handle                    */
      WC_MLE,                     /* pointer to registered class name        */
      NULL,                       /* pointer to window text                  */
      WS_VISIBLE | MLS_WORDWRAP | /* window style                            */
         MLS_READONLY,
      0,                          /* horizontal position of window           */
      0,                          /* vertical position of window             */
      0,                          /* window width                            */
      0,                          /* window height                           */
      NULLHANDLE,                 /* owner-window handle                     */
      HWND_TOP,                   /* handle to sibling window                */
      0,                          /* window identifier                       */
      NULL,                       /* pointer to buffer                       */
      NULL);                      /* pointer to structure with pres. params. */

   if (!hwndPage)
     return FALSE;

   if ( !WinSendMsg(hwndPage, MLM_SETIMPORTEXPORT,
         MPFROMP(pszMleBuffer),
         MPFROMSHORT(sizeof(pszMleBuffer))))
     return FALSE;

     memset(pszMleBuffer,'\0',sizeof(pszMleBuffer));
     strcpy(pszMleBuffer, pszNoteBookText);

   if ( !WinSendMsg(hwndPage, MLM_IMPORT, &ipt,
         MPFROMSHORT(sizeof(pszMleBuffer))))
     return FALSE;

   if( !WinSendDlgItemMsg(hwnd, IDC_NOTEBOOK,
         BKM_SETPAGEWINDOWHWND, MPFROMLONG(ulPageId),
         MPFROMHWND(hwndPage)))
     return FALSE;

   return TRUE;
}                                       /* End of InitializeNotebook    */
Example #21
0
/*----------------------------------------------------------------------*/
void DMLBCheckTargetLocation(HWND SrcHwnd, DMLBData *InstData, SHORT X, SHORT Y)
/*----------------------------------------------------------------------*/
/* X,Y is in SrcHwnd window coordinates.                                */
/* Given an Y,Y coordinate of the pointer, determine if the pointer is  */
/* over a listbox that will accept a drop.  If it is, we save the       */
/* handle of the listbox and set the PrevLocation to POINT_INSIDE in    */
/* the instance data.  Otherwise, we see if the position is near the    */
/* top/bottom edge of the last good target listbox we had.  If so, set  */
/* the PrevLocation to POINT_NORTH/SOUTH as appropriate.  Finally, if   */
/* none of the above, just set the PrevLocation to POINT_OUTSIDE.       */
/*----------------------------------------------------------------------*/
{
RECTL Rect;
POINTL ScreenPoint;
HWND  OverHwnd;
char  OverClass[10];

  InstData->PrevLocation = POINT_OUTSIDE; // Assume this until we know otherwise

  /* See if window under the pointer is a listbox.             */
  ScreenPoint.x = X;
  ScreenPoint.y = Y;
  WinMapWindowPoints(SrcHwnd, HWND_DESKTOP, &ScreenPoint, 1L);
  OverHwnd = WinWindowFromPoint(HWND_DESKTOP, &ScreenPoint, TRUE);
  WinQueryClassName(OverHwnd, sizeof(OverClass), OverClass);

  if (!strcmp(OverClass, LISTBOX_CLASS_STRING)) {
    /* Yes, it is a listbox -- see if it will accept our drop */
    MRESULT Answer;

    /* If this is part of an MCLB, the MCLB is really the target */
    WinQueryClassName(WinQueryWindow(OverHwnd, QW_OWNER), sizeof(OverClass), OverClass);
    if (!strcmp(OverClass, "MCLBCls"))
      OverHwnd = WinQueryWindow(OverHwnd, QW_OWNER);

    Answer = WinSendMsg(WinQueryWindow(OverHwnd, QW_OWNER),
                        WM_CONTROL,
                        MPFROM2SHORT(WinQueryWindowUShort(OverHwnd, QWS_ID), LN_DMLB_QRYDROP),
                        MPFROMHWND(SrcHwnd));
    if ((BOOL)SHORT1FROMMR(Answer)) {
      /* Yes, it will accept the drop */
      InstData->TargetHwnd = OverHwnd;                 // Note new target
   // if (SrcHwnd == OverHwnd)
   //   InstData->TargetDropMode = DROPMODE_MOVE;      // Force MOVE for same-listbox drops
   // else
        InstData->TargetDropMode = SHORT2FROMMR(Answer); // Copy, Move, or Delete
      InstData->PrevLocation = POINT_INSIDE;           // We are inside the listbox now
      return;
    }
    /* It will not accept a drop, proceed as point outside */
    return;
  }

  /* Not a listbox class window.  See if pointer is near north/south */
  /* edge of last good target listbox.  ("Near" is defined as the    */
  /* height of a menu bar).                                          */

  WinQueryWindowRect(InstData->TargetHwnd, &Rect);
  /* Translate rectangle to screen coordinates */
  WinMapWindowPoints(InstData->TargetHwnd, HWND_DESKTOP, (POINTL *)&Rect, 2L);

  if ((ScreenPoint.x >= Rect.xLeft) && (ScreenPoint.x <= Rect.xRight)) {
    if ((ScreenPoint.y < Rect.yTop + WinQuerySysValue(HWND_DESKTOP, SV_CYMENU)) &&
        (ScreenPoint.y > Rect.yBottom - WinQuerySysValue(HWND_DESKTOP, SV_CYMENU))) {
       if (ScreenPoint.y > Rect.yTop)
         InstData->PrevLocation = POINT_NORTH;
       else if (ScreenPoint.y < Rect.yBottom)
         InstData->PrevLocation = POINT_SOUTH;
       return;
    } // Within a menu-size distance of north/south edge
  } // Within the horizontal boundries of the listbox

  /* Pointer is outside the range of interest */
  return;
}
Example #22
0
/*----------------------------------------------------------------------*/
MRESULT EXPENTRY DMLBSubclassListboxProc( HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
/*----------------------------------------------------------------------*/
/* This window procedure is used to subclass a standard PM listbox      */
/* control.  This procedure will intercept certain mouse events on the  */
/* listbox to implement direct-manipulation functions.                  */
/*----------------------------------------------------------------------*/
{
SHORT    Item;          /* Listbox item number                          */
DMLBData  *InstData;     /* This instance-specific data (per listbox)    */

   /* The lisbox window pointer is to our instance data. */

   InstData = WinQueryWindowPtr(hwnd, QWL_USER);
     
   switch (msg) {
      /* Since this is just a subclass setup after the listbox window */
      /* is created, we never get a WM_CREATE message here.           */

      case WM_DESTROY:
           /* The listbox window is being destroyed.  Cleanup any     */
           /* resources we have allocated in this subclass.           */
           if (InstData->DragMIcon != NULLHANDLE) {
             WinDestroyPointer(InstData->DragMIcon);
             WinDestroyPointer(InstData->DragCIcon);
             WinDestroyPointer(InstData->NorthIcon);
             WinDestroyPointer(InstData->SouthIcon);
             WinDestroyPointer(InstData->DragNoDrp);
             WinDestroyPointer(InstData->DeletIcon);
             InstData->DragMIcon = NULLHANDLE;
           }
           /* Cleanup other resources */
           if (InstData->Dragging) {
             WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,DRAG_TIMERID);
           }
           /* Release instance data */
           free(InstData);
           WinSetWindowPtr(hwnd, 0L, NULL);
           break;

      case WM_TIMER:
           /* We get timer messages during dragging to implement */
           /* auto-scrolling of listbox when pointer is placed   */
           /* north or south of the listbox while dragging.      */

           if (!InstData->Dragging)  /* Ignore if not dragging   */
             break;

           if (SHORT1FROMMP(mp1)==DRAG_TIMERID) {
             switch (InstData->PrevLocation) { // Last known location of the pointer
               case POINT_INSIDE:
               case POINT_OUTSIDE:
                 /* Do nothing */
                 break;

               case POINT_NORTH:
                 /* Scroll up one item */
                 Item = (SHORT)WinSendMsg(InstData->TargetHwnd, LM_QUERYTOPINDEX,  0L, 0L);
                 if ((Item != LIT_NONE) && (Item != 0))
                    WinPostMsg(InstData->TargetHwnd, LM_SETTOPINDEX, MPFROMSHORT(Item-1), 0L);
                 break;

               case POINT_SOUTH:
                 /* Scroll down one item */
                 Item = (SHORT)WinSendMsg(InstData->TargetHwnd, LM_QUERYTOPINDEX,  0L, 0L);
                 if (Item != LIT_NONE)
                    WinPostMsg(InstData->TargetHwnd, LM_SETTOPINDEX, MPFROMSHORT(Item+1), 0L);
                 break;
             } /* switch on PrevLocation */
             return 0;
           }
           break;

      case WM_CONTEXTMENU: {
           SHORT CursorIndx, Max;

           /* User requested context menu... notify our owner.          */

           /* First find out what item the pointer is over.             */
           Max = (SHORT)WinSendMsg( hwnd, LM_QUERYITEMCOUNT, 0L, 0L );
           CursorIndx = DMLBLocateListboxItem(hwnd, hwnd, SHORT2FROMMP(mp1), LLI_UNDER);
           if ((Max == 0) || (CursorIndx+1 > Max))
             CursorIndx = LIT_NONE;

           /* Tell our owner about it */
           return WinSendMsg(WinQueryWindow(hwnd, QW_OWNER), WM_CONTROL,
                      MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), LN_DMLB_CONTEXT),
                      MPFROMSHORT(CursorIndx));
           }
 
      case WM_MOUSEMOVE:
           /* Monitor the position of the mouse relative to the listbox */
           /* so we can set the pointer icon correctly and note the     */
           /* position for use during WM_TIMER processing.              */

           if (!InstData->Dragging)   /* Ignore if not dragging */
             break;

           DMLBCheckTargetLocation(hwnd, InstData, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1));

           /* Set pointer icon appropriate for location */
           if (InstData->DragMIcon == NULLHANDLE) {
             // Load all the pointers (one time only)
             InstData->DragMIcon= WinLoadPointer(HWND_DESKTOP, InstData->ResHMod, ID_DMLB_DRAGMOVE);
             InstData->DragCIcon= WinLoadPointer(HWND_DESKTOP, InstData->ResHMod, ID_DMLB_DRAGCOPY);
             InstData->DragNoDrp= WinLoadPointer(HWND_DESKTOP, InstData->ResHMod, ID_DMLB_DRAGNONE);
             InstData->NorthIcon= WinLoadPointer(HWND_DESKTOP, InstData->ResHMod, ID_DMLB_DRGNORTH);
             InstData->SouthIcon= WinLoadPointer(HWND_DESKTOP, InstData->ResHMod, ID_DMLB_DRGSOUTH);
             InstData->DeletIcon= WinLoadPointer(HWND_DESKTOP, InstData->ResHMod, ID_DMLB_DRGDEL);
           }
           switch (InstData->PrevLocation) {
             case POINT_INSIDE:
               switch (InstData->TargetDropMode) {
               case DROPMODE_MOVE:
                 WinSetPointer(HWND_DESKTOP, InstData->DragMIcon); // Use MOVE pointer 
                 break;
               case DROPMODE_COPY:
                 WinSetPointer(HWND_DESKTOP, InstData->DragCIcon); // Use COPY pointer
                 break;
               case DROPMODE_DELETE:
                 WinSetPointer(HWND_DESKTOP, InstData->DeletIcon); // Use DELETE pointer
                 break;
               }
               break;
             case POINT_OUTSIDE:
               WinSetPointer(HWND_DESKTOP, InstData->DragNoDrp);   // No-drop pointer
               break;
             case POINT_NORTH:
               WinSetPointer(HWND_DESKTOP, InstData->NorthIcon);   // Scroll-up pointer
               break;
             case POINT_SOUTH:
               WinSetPointer(HWND_DESKTOP, InstData->SouthIcon);   // Scroll-down poineter
               break;
           }
 
           return (MRESULT)TRUE;  /* Note we processed the message */

      case WM_BEGINDRAG:
           {
           SHORT  Max;
           SHORT i, CursorIndx, hit;

           /* User started dragging with the pointer on our window */

           Max = (SHORT)WinSendMsg( hwnd, LM_QUERYITEMCOUNT, 0L, 0L );

           /* If we are currently dragging, cancel it (should not happen) */
 
           if ( InstData->Dragging ) {
             InstData->Dragging = FALSE;
             WinSetCapture( HWND_DESKTOP, NULLHANDLE );
             return (MRESULT)FALSE;
           }

           /* Get index of item under the mouse pointer and check */
           /* for reasonable numeric bounds.                      */
 
           CursorIndx = DMLBLocateListboxItem(hwnd, hwnd, SHORT2FROMMP(mp1), LLI_UNDER);
           if ((Max == 0) || (CursorIndx+1 > Max)) {
             DosBeep( 440L, 50L );  // Don't allow drag if not on a listbox item
             return (MRESULT)FALSE;
           }

           /* Since we currently support dragging only a single item, */
           /* de-select all items and just select the one under the   */
           /* pointer.  To support multiple-drag we would probably    */
           /* need to notify the owner so they could set the selection*/
           /* status of all items to be dragged (which may or may not */
           /* include the item under the pointer).                    */

           WinSendMsg(hwnd, LM_SELECTITEM, MPFROMSHORT(LIT_NONE), MPVOID);
           WinSendMsg(hwnd, LM_SELECTITEM, MPFROMSHORT(CursorIndx), MPFROMSHORT(TRUE));

           /* Note we are now dragging and capture the pointer. */
 
           InstData->Dragging = TRUE;
           WinSetCapture( HWND_DESKTOP, hwnd );
           InstData->PrevLocation = POINT_INSIDE;
           WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,DRAG_TIMERID, WinQuerySysValue(HWND_DESKTOP, SV_SCROLLRATE));
           return (MRESULT)TRUE;
           break;
           }
 
      case WM_ENDDRAG:
            {
            SHORT DropIndx, CurrIndx;
            SHORT SourceMax, TargetMax;      /* Num of items in source/target listbox */
            char  *CopyText;                 /* Text to be copied/moved */
            USHORT CopyTextLen;              /* Length of text */
            void   *CopyHand;                /* Handle of item to be copied/moved */
            BOOL  SameList = FALSE;          /* Source and target are same listbox */
 
            if (!InstData->Dragging)         /* Ignore if we are not dragging */
              return (MRESULT)FALSE;
 
            /* Clear dragging indicators and release pointer */

            InstData->Dragging = FALSE;
            WinSetCapture( HWND_DESKTOP, NULLHANDLE );
            WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,DRAG_TIMERID);

            /* See if what is under the pointer will accept the drop */
            DMLBCheckTargetLocation(hwnd, InstData, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1));
            if (InstData->PrevLocation != POINT_INSIDE)
              return (MRESULT)TRUE;  /* Ignore drop outside a good listbox */

            if (hwnd == InstData->TargetHwnd)  // Source and target are same listbox
              SameList = TRUE;

            SourceMax = (SHORT)WinSendMsg(hwnd, LM_QUERYITEMCOUNT, 0L, 0L ) -1;
            TargetMax = (SHORT)WinSendMsg(InstData->TargetHwnd, LM_QUERYITEMCOUNT, 0L, 0L ) -1;

            /* Get drop point and original selected point */

            DropIndx = DMLBLocateListboxItem(InstData->TargetHwnd, hwnd, SHORT2FROMMP(mp1), LLI_INSERTPOINT);
            CurrIndx = (SHORT)WinSendMsg(hwnd, LM_QUERYSELECTION, MPFROMSHORT(LIT_FIRST), 0L);

            /* Prevent move onto same item as source, in same listbox           */
            /* being careful of DropIndx > SourceMax when drop after last item. */
            if ((InstData->TargetDropMode==DROPMODE_MOVE) &&
                (SameList) &&
                ((min(DropIndx,SourceMax) == CurrIndx) || (DropIndx == CurrIndx+1))) {
              DosBeep( 700L, 50L );  /* Don't drop before or after original */
              return (MRESULT)TRUE;
            }

            /* Make a copy of original to insert */

            CopyTextLen = (SHORT)WinSendMsg(hwnd,LM_QUERYITEMTEXTLENGTH,MPFROMSHORT(CurrIndx), 0L) + 1;
            CopyText = malloc(CopyTextLen);
            WinSendMsg(hwnd, LM_QUERYITEMTEXT, MPFROM2SHORT(CurrIndx, CopyTextLen), MPFROMP(CopyText));
            CopyHand = WinSendMsg(hwnd, LM_QUERYITEMHANDLE, MPFROMSHORT(CurrIndx), 0L);

            /* Insert before insertion point, or at end of list */
            if (DropIndx > TargetMax)
              DropIndx = LIT_END;

            /* Disable update during insert/delete for smoother visual and */
            /* prevent ownerdraw from occuring before new handles are set. */

            WinEnableWindowUpdate(hwnd, FALSE);
            WinEnableWindowUpdate(InstData->TargetHwnd, FALSE);
            
            /* Insert into target list */
            if (InstData->TargetDropMode != DROPMODE_DELETE) {
              DropIndx = (SHORT)WinSendMsg(InstData->TargetHwnd, LM_INSERTITEM, MPFROMSHORT(DropIndx), MPFROMP(CopyText));
              WinSendMsg(InstData->TargetHwnd, LM_SETITEMHANDLE, MPFROMSHORT(DropIndx), MPFROMP(CopyHand));
            }
            free(CopyText);

            /* Tell owner of originating listbox what we are doing.  We must notify */
            /* the owner before we delete items because they may keep dynamic data  */
            /* in the item handles that has to be freed.  The item in question is   */
            /* the currently selected item in the listbox.                          */

            switch (InstData->TargetDropMode) {
              case DROPMODE_MOVE:
                 if (!SameList)
                   WinSendMsg(WinQueryWindow(hwnd, QW_OWNER), WM_CONTROL,
                           MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), LN_DMLB_DELETE_MOVE),
                           MPFROMHWND(InstData->TargetHwnd));
                 break;
              case DROPMODE_DELETE:
                 WinSendMsg(WinQueryWindow(hwnd, QW_OWNER), WM_CONTROL,
                           MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), LN_DMLB_DELETE),
                           MPFROMHWND(InstData->TargetHwnd));
                 break;
            }

            /* If this is a move, delete original.  If it is in the same  */
            /* listbox as target, get new index since it may have         */
            /* changed due to inserted copy.                              */

            if ((InstData->TargetDropMode == DROPMODE_MOVE) || (InstData->TargetDropMode == DROPMODE_DELETE)) {
              CurrIndx = (SHORT)WinSendMsg(hwnd, LM_QUERYSELECTION, MPFROMSHORT(LIT_FIRST), 0L);
              WinSendMsg(hwnd, LM_DELETEITEM, MPFROMSHORT(CurrIndx), 0L);
            }

            /* Select the newly inserted item.  If the old copy was             */
            /* above it in the same list, then the item number has changed by 1 */

            if ((DropIndx > CurrIndx) && (SameList) && (InstData->TargetDropMode==DROPMODE_MOVE))
              DropIndx--;
            if (InstData->TargetDropMode != DROPMODE_DELETE) {
              WinSendMsg(InstData->TargetHwnd, LM_SELECTITEM, MPFROMSHORT(LIT_NONE), MPFROMSHORT(FALSE));
              WinSendMsg(InstData->TargetHwnd, LM_SELECTITEM, MPFROMSHORT(DropIndx), MPFROMSHORT(TRUE));
            }

            WinEnableWindowUpdate(hwnd, TRUE);
            WinEnableWindowUpdate(InstData->TargetHwnd, TRUE);

            /* Notify target of inserted items if necessary */

            switch (InstData->TargetDropMode) {
              case DROPMODE_MOVE:
                if (SameList)
                   WinSendMsg(WinQueryWindow(InstData->TargetHwnd, QW_OWNER), WM_CONTROL,
                         MPFROM2SHORT(WinQueryWindowUShort(InstData->TargetHwnd, QWS_ID), LN_DMLB_REORDERED),
                         MPFROMHWND(hwnd));
                else
                   WinSendMsg(WinQueryWindow(InstData->TargetHwnd, QW_OWNER), WM_CONTROL,
                         MPFROM2SHORT(WinQueryWindowUShort(InstData->TargetHwnd, QWS_ID), LN_DMLB_INSERT_MOVE),
                         MPFROMHWND(hwnd));
                break;
              case DROPMODE_COPY:
                WinSendMsg(WinQueryWindow(InstData->TargetHwnd, QW_OWNER), WM_CONTROL,
                         MPFROM2SHORT(WinQueryWindowUShort(InstData->TargetHwnd, QWS_ID), LN_DMLB_INSERT_COPY),
                         MPFROMHWND(hwnd));
                break;
            }

            return (MRESULT)TRUE;
            }
 
      }
 
   /* Call previous window procedure to process this message */
   return ( (*(InstData->OldProcAddr)) ( hwnd, msg, mp1, mp2 )  );
   }
Example #23
0
/**************************************************************************
*
* FUNCTION NAME: ProcessHiScoreDialog
*
* DESCRIPTION:
*
*
* INPUT PARAMETERS:
*     None.
*
* OUTPUT PARAMETERS:
*     None.
*
**************************************************************************/
MRESULT EXPENTRY ProcessHiScoreDialog (HWND hwnd, 
                                       ULONG msg,
                                       MPARAM mp1, 
                                       MPARAM mp2)
{
   HWND  hwndPage;
   ULONG ulPageId;
   ULONG ipt = 0;
	INT   i;
   CHAR  szMleBuffer[512];

   switch (msg)
   {
		case WM_INITDLG:
			for (i = 0;  i < NUM_HISCORES;  i++)
			{
   			/*
    			* Insert a page of the notebook
    			*/
   			ulPageId = (LONG) WinSendDlgItemMsg (hwnd, NOTEBOOK_ID,
        									  BKM_INSERTPAGE, NULL,
        									  MPFROM2SHORT((BKA_STATUSTEXTON | 
											  					 BKA_AUTOPAGESIZE | BKA_MAJOR),
        									  BKA_LAST));

				sprintf (szMleBuffer, "Page %d of %d", i + 1, NUM_HISCORES);
   			WinSendDlgItemMsg (hwnd, NOTEBOOK_ID,
        							    BKM_SETSTATUSLINETEXT, MPFROMLONG(ulPageId),
        								 MPFROMP(szMleBuffer));
				

				sprintf (szMleBuffer, "%d", i + 1);
   			WinSendDlgItemMsg (hwnd, NOTEBOOK_ID,
        								 BKM_SETTABTEXT, MPFROMLONG(ulPageId),
        								 MPFROMP(szMleBuffer));
   			WinSendDlgItemMsg (hwnd, NOTEBOOK_ID,
        								 BKM_SETDIMENSIONS, MPFROM2SHORT(40,25),
        								 MPFROMSHORT(BKA_MAJORTAB));
				
   			hwndPage = WinCreateWindow (hwnd,
													 WC_MLE,
      											 NULL,
      											 WS_VISIBLE | MLS_READONLY,
         	                            0,
         	                            0,
         	                            0,
         	                            0,
         	                            NULLHANDLE,
         	                            HWND_TOP,
         	                            0,
         	                            NULL,
         	                            NULL);

   			WinSendDlgItemMsg (hwnd, NOTEBOOK_ID,
         							 BKM_SETPAGEWINDOWHWND, MPFROMLONG(ulPageId),
         							 MPFROMHWND(hwndPage));
				
   			WinSendMsg (hwndPage, MLM_SETIMPORTEXPORT,
         					MPFROMP(szMleBuffer),
         					MPFROMSHORT(sizeof(szMleBuffer)));
				
     			sprintf (szMleBuffer, 
				         HISCORE_TEXT,
							i + 1,
							stHiscore[i].szName,
							stHiscore[i].lScore,
							stHiscore[i].szDate,
							stHiscore[i].sAliens,
							stHiscore[i].sHitRate,
							stHiscore[i].sWave + 1,
							stHiscore[i].sShips,
							stHiscore[i].sSmarts,
							(stHiscore[i].fBullets) ? "ON" : "OFF");
				
   			WinSendMsg (hwndPage, MLM_IMPORT, &ipt,
         				   MPFROMSHORT(strlen(szMleBuffer)));
				
   			WinSendDlgItemMsg (hwnd, NOTEBOOK_ID,
         							 BKM_SETPAGEWINDOWHWND, MPFROMLONG(ulPageId),
         							 MPFROMHWND(hwndPage));
			}

			CenterDialog (hwnd);
			return (0);
				
      case WM_COMMAND :
         switch (SHORT1FROMMP (mp1))
         {
            case DID_OK:
				   /* Dismiss the dialog */
               WinDismissDlg (hwnd, DID_OK);
               return (0);

			   case DID_HELP:
				   /* Display the keys help panel */
    				WinSendMsg (hwndHelpInstance, HM_DISPLAY_HELP,
                            MPFROM2SHORT(PANEL_HIGHSCORE, NULL), 
									 MPFROMSHORT(HM_RESOURCEID));
               return (0);
         }
			break;

      default:
		   break;
   }

   return (WinDefDlgProc (hwnd, msg, mp1, mp2));
}
Example #24
0
/**********************************************************************
 * Function: LoadNoteBookPages
 * Info    : Load notebook pages
 * Result  :
 **********************************************************************/
static BOOL LoadNoteBookPages(HWND hwndNoteBook)
{

  /* Insert "General" page */
  if (NO_ERROR != DosGetResource(hRessourceModule,
                                 RT_DIALOG,
                                 DID_GENERAL_DLG,
                                 &pPointerDialog1))
  {
   pPointerDialog1 = NULL;
   return FALSE;
  }

  ulGeneralPageId = (LONG)WinSendDlgItemMsg(hwndNoteBook, DID_PREF_NOTEBOOK,
       BKM_INSERTPAGE, NULL,
       MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR),
       BKA_LAST));

  if ( !ulGeneralPageId)
  {
    DosFreeResource(&pPointerDialog1);
    pPointerDialog1 = NULL;
    return FALSE;
  }

#if 0
  if ( !WinSendDlgItemMsg(hwndNoteBook, DID_PREF_NOTEBOOK,
       BKM_SETSTATUSLINETEXT, MPFROMLONG(ulGeneralPageId),
       MPFROMP("Page 1 of 2")))
    return FALSE;
#endif

  Len = WinLoadString(Hab, hRessourceModule, IDS_GENERAL_TAB,
                      TITLESTRN_MAXLEN, Title);

  if (!WinSendDlgItemMsg(hwndNoteBook, DID_PREF_NOTEBOOK,
      BKM_SETTABTEXT, MPFROMLONG(ulGeneralPageId), Title))
  {
    DosFreeResource(&pPointerDialog1);
    pPointerDialog1 = NULL;
    return FALSE;
  }

  hwndGeneralWindow = WinCreateDlg(hwndNoteBook,
                                   hwndNoteBook,
                                   PrefGeneralDlgProc,
                                   pPointerDialog1,
                                   NULL);
 if (NULLHANDLE != hwndGeneralWindow)
  WinSendDlgItemMsg(hwndNoteBook, DID_PREF_NOTEBOOK,
                    BKM_SETPAGEWINDOWHWND,
                    MPFROMLONG(ulGeneralPageId),
                    MPFROMHWND(hwndGeneralWindow));
 else
 {
    DosFreeResource(&pPointerDialog1);
    pPointerDialog1 = NULL;
    return FALSE;
 }

  /* Insert "Files" page */
 if (NO_ERROR != DosGetResource(hRessourceModule,
                                RT_DIALOG,
                                DID_FILES_DLG,
                                &pPointerDialog2))
 {
    DosFreeResource(&pPointerDialog1);
    pPointerDialog1 = NULL;
    pPointerDialog2 = NULL;
    return FALSE;
 }

  ulFilesPageId = (LONG)WinSendDlgItemMsg(hwndNoteBook, DID_PREF_NOTEBOOK,
       BKM_INSERTPAGE, NULL,
       MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR),
       BKA_LAST));

  if (!ulFilesPageId)
  {
    DosFreeResource(&pPointerDialog1);
    DosFreeResource(&pPointerDialog2);
    pPointerDialog1 = NULL;
    pPointerDialog2 = NULL;
    return FALSE;
  }

  Len = WinLoadString(Hab, hRessourceModule, IDS_FILES_TAB,
                      TITLESTRN_MAXLEN, Title);

  if (!WinSendDlgItemMsg(hwndNoteBook, DID_PREF_NOTEBOOK,
      BKM_SETTABTEXT, MPFROMLONG(ulFilesPageId), Title))
  {
    DosFreeResource(&pPointerDialog1);
    DosFreeResource(&pPointerDialog2);
    pPointerDialog1 = NULL;
    pPointerDialog2 = NULL;
    return FALSE;
  }

  hwndFilesWindow = WinCreateDlg(hwndNoteBook,
                                 hwndNoteBook,
                                 PrefFilesDlgProc,
                                 pPointerDialog2,
                                 NULL);
 if (NULLHANDLE != hwndFilesWindow)
  WinSendDlgItemMsg(hwndNoteBook, DID_PREF_NOTEBOOK,
                    BKM_SETPAGEWINDOWHWND,
                    MPFROMLONG(ulFilesPageId),
                    MPFROMHWND(hwndFilesWindow));
 else
 {
   DosFreeResource(&pPointerDialog1);
   DosFreeResource(&pPointerDialog2);
   pPointerDialog1 = NULL;
   pPointerDialog2 = NULL;
   return FALSE;
 }

 return TRUE;
}