Example #1
0
BOOL FAR PASCAL DialogProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam)
	{
	BOOL fResult;
	void FileOpen();

	switch(wm)
		{
	default:
		return FALSE;
	case WM_COMMAND:
		if(wParam == IDOK)
			{
			EndDialog(hdlg, fResult);
			}
		else if (wParam == 1000)
			{
            MessageBox(hdlg, TEXT( "asdf" ),TEXT( "asdf" ), MB_OK);
			FileOpen(hdlg);
			}
		else
			{
			HWND hwndT;

			hwndT = GetDlgItem(hdlg, wParam-1000);
//			hwndT = GetDlgItem(hdlg, wParam);
			if (hwndT != NULL)
				{
//				ShowWindow(hwndT, IsWindowVisible(hwndT) ? SW_HIDE : SW_SHOW);//
				EnableWindow(hwndT, !IsWindowEnabled(hwndT));
				}
			}
		break;
#ifndef AUTOSUBCLASS
	// NOTNEEDED because we call Ctl3dAutoSubclass
#ifdef WIN32
    case WM_CTLCOLORMSGBOX:
    case WM_CTLCOLOREDIT:
    case WM_CTLCOLORLISTBOX:
    case WM_CTLCOLORBTN:
    case WM_CTLCOLORDLG:
    case WM_CTLCOLORSCROLLBAR:
    case WM_CTLCOLORSTATIC:
#else
    case WM_CTLCOLOR:
#endif // WIN32
        return (BOOL) Ctl3dCtlColorEx(wm, wParam, lParam);
	case WM_INITDIALOG:
		fResult = Ctl3dEnabled();
		fResult = Ctl3dSubclassDlg(hdlg, CTL3D_ALL);
		break;
	case WM_SYSCOLORCHANGE:
		Ctl3dColorChange();
#endif
		}
	return TRUE;
	}
Example #2
0
static void OnSysColorChange(HWND hwnd)
{
#ifdef _USE_CTL3D
   Ctl3dColorChange();
#endif
}
Example #3
0
BOOL _DLLFAR _CB_Ctl3dColorChange( void )
{
    return( Ctl3dColorChange() );
}
Example #4
0
LRESULT EXPORT KappaWndProc(HWND hWnd, UINT message,
                            WPARAM wParam, LPARAM lParam)
{
    switch (message) {
        
#ifndef RUNTIME
      case WM_CREATE:
          KappaCreate(hWnd, lParam);
          break;
          
      case WM_SYSCOLORCHANGE:
#ifdef CTL3D
          if (Kpp3dCtrls())
              Ctl3dColorChange();
#endif
          if (hbrColor)
              hbrColor = KppGetBrush(TRUE);
          break;

      case WM_SIZE:
          /* Window's size is changing.  lParam contains the width
          ** and height, in the low and high words, respectively.
          ** wParam contains SIZENORMAL for "normal" size changes,
          ** SIZEICONIC when the window is being made iconic, and
          ** SIZEFULLSCREEN when the window is being made full screen. */
          KappaSize(hWnd, LOWORD(lParam), HIWORD(lParam));
          break;

      case WM_LBUTTONDOWN:
          SetCapture(hWnd);
          KappaMouseSelect(hWnd, lParam);
          break;

      case WM_LBUTTONUP:
          ReleaseCapture();
          KappaMouseApply(hWnd, lParam);
          break;

      case WM_PAINT:
      {
          PAINTSTRUCT ps;
          
          BeginPaint(hWnd, &ps);
          KappaPaint(hWnd, &ps);
          EndPaint(hWnd, &ps);
          break;
      }

      case WM_CLOSE:
          SendMessage(hWnd, WM_COMMAND, IDM_EXIT, 0L);
          return TRUE;

#endif /* not RUNTIME */

      case WM_DESTROY:
          /* Window's being destroyed. */
          PostQuitMessage(0);        /* Cause application to be terminated */
          break;

      case WM_QUERYENDSESSION:
#ifdef RUNTIME
          if (hWnd == KpsGetMainSessionWindow())
              return KappaQueryEndSession(hWnd);
          else
              return FALSE;
#else
          return KappaQueryEndSession(hWnd);
#endif
          
      case WM_ENDSESSION:
          if (wParam)
          {
#ifdef RUNTIME
              if (hWnd == KpsGetMainSessionWindow())
#endif
                  KppKappaRMTmp();
          }
          break;

      case WM_COMMAND:
#ifndef RUNTIME
          if (KppGetAppChanged() &&
              HIWORD(lParam) == EN_CHANGE &&
              LOWORD(lParam) == hWndComment)
              MarkAppAsModified();
#endif
          KappaCommand(hWnd, wParam, LOWORD(lParam), lParam);
          break;

      case WM_SYSCOMMAND:
          return (long) KappaSysCommand(hWnd, message, wParam, lParam);

      case WM_INITMENUPOPUP:
      {
          WORD fEnabled = 
              in_wait_for_input || CheckPopupWindows(FALSE) ? MF_GRAYED
                                                            : MF_ENABLED;

          if (HIWORD(lParam))
              EnableMenuItem(wParam, SC_CLOSE, MF_BYCOMMAND | fEnabled);
          else
              switch (LOWORD(lParam)) {
                case 0:
                    EnablePrintMenuItemCB(wParam, IDM_SETUPPRINT);
                    if (KppGetAppChanged())
                    {
#ifndef LIMITED
                        EnableMenuItem(wParam, IDM_SAVE,
                                       MF_ENABLED | MF_BYCOMMAND);
                        EnableMenuItem(wParam, IDM_SAVEAS,
                                       MF_ENABLED | MF_BYCOMMAND);
#endif
                    }
                    
                    EnableMenuItem(wParam, IDM_EXIT, MF_BYCOMMAND | fEnabled);
                    EnableMenuItem(wParam, IDM_NEW, MF_BYCOMMAND | fEnabled);
                    
#ifndef RUNTIME
                    if (GetModuleHandle("KAPHELP"))
                        EnableMenuItem(wParam, IDM_ONLINEHELP,
                                       MF_ENABLED | MF_BYCOMMAND);
                    else
                        EnableMenuItem(wParam, IDM_ONLINEHELP,
                                       MF_GRAYED | MF_BYCOMMAND);
#endif
                    break;
#ifndef RUNTIME
                case 1:
                    EditControlMenuOptions(bCommentUndo, wParam,
                                           hWnd, hWndComment);
                    break;
                case 2:
                    EnableMenuItem(wParam, IDM_EDITORS,
                                   MF_BYCOMMAND |
                                   (idWindowsList ? MF_ENABLED : MF_GRAYED));
                    break;
                case 3:
                    EnableMenuItem(wParam, IDM_COMMENT,
                                   MF_BYCOMMAND |
                                   (IsZoomed(hWnd) ? MF_GRAYED : MF_ENABLED));
                    break;
#endif
              }
          break;
      }

      case WM_WININICHANGE:
          if (lParam && !lstrcmp((LPSTR) lParam, "intl"))
              KppResetFNSettings();
          
      case WM_DESTROYCLIPBOARD:
      case WM_RENDERALLFORMATS:
      case WM_RENDERFORMAT:
          return KppClipboardHandlerCB(message, wParam);
          
      default:
          return DefWindowProc(hWnd, message, wParam, lParam);
    }

    return 0L;
}
Example #5
0
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    CLIENTCREATESTRUCT ccs;
    HWND hwndChild = 0;
    
    if ( IsWindow(hwndMDIClient) )
        hwndChild = ChildGetActive();

    switch ( uMsg )
        {
        case WM_CREATE:
            /* following is regular MDI incantation */
            ccs.hWindowMenu = GetSubMenu(GetMenu(hWnd), WINDOW_MENU_POS);
            ccs.idFirstChild = IDM_WINDOW_CHILDREN;
            hwndMDIClient = CreateWindow(
                "mdiclient",
                NULL,
                WS_CHILD | WS_CLIPCHILDREN,
                0,
                0,
                0,
                0,
                hWnd,
                0,
                hinstThis,
                &ccs);
            if ( hwndMDIClient != 0 )
                {
                ShowWindow(hwndMDIClient, SW_SHOW);
                /* subclass the hwndMDIClient window so we can change the cursor
                    to a wait cursor when desired */
                pfnOldMDIClientWndProc =
                    (WNDPROC)SetWindowLong(hwndMDIClient, GWL_WNDPROC, (LONG)MDIClientWndProc);
                }
            return ( 0 );
        
        case WM_INITMENUPOPUP:
            /* some popup menu is about to be displayed */
            MenuStatus((int)LOWORD(lParam), (HMENU)wParam);
            return ( 0 );
        
        case WM_COMMAND:
            /* if WM_COMMAND is not from a control (then it's from a menu item) */
            if ( LOWORD(lParam) == 0 && MenuOnCommand(LOWORD(wParam)) )
                return ( 0 );
            break;

        case WM_QUERYENDSESSION:
            return ( ChildQueryCloseAll() );

        case WM_CLOSE:
            if ( !ChildQueryCloseAll() )
                return ( 0 );
            break;                
            
        case WM_DESTROY:
            WinHelp(hwndFrame, APPLICATION_HELPFILENAME, HELP_QUIT, 0);
            PostQuitMessage(0);
            return ( 0 );

        case WM_QUERYNEWPALETTE:
            /* set the system palette to the active child's palette */
            return ( OnQueryNewPalette(hwndChild) );

        case WM_MDIACTIVATE:
            /* set the system palette to the newly active child's palette */
            OnQueryNewPalette((HWND)wParam);
            return ( 0 );

        case WM_PALETTECHANGED:
            /* forwarded to children so they can each realize their background palettes */
            ForwardToChildren(hWnd, uMsg, wParam, lParam);
            return ( 0 );

        case WM_SYSCOLORCHANGE:
            Ctl3dColorChange();
            break;

        case WM_SYSCOMMAND:
            switch ( wParam & 0xfff0 )
                {
                case SC_MAXIMIZE:
                case SC_RESTORE:
                    /* since we effectively change our image origin when maximized or restored,
                        we have to _force_ the window repaint to include the entire window --
                        else win '95 (at least) optimizes away some of the regions */
                    DefFrameProc(hWnd, hwndMDIClient, uMsg, wParam, lParam);
                    if ( IsWindow(hwndChild) )
                        {
                        InvalidateRect(hwndChild, NULL, FALSE);
                        UpdateWindow(hwndChild);
                        }
                    return ( 0 );
                
                default:
                    break;                    
                }
            break;
            
        case WM_MOUSEMOVE:
            if ( nWaitCursor != 0 )
                SetCursor(hWaitCursor);
            else
                SetCursor(hArrowCursor);                
            break;
        
        default:
            break;
        }
    if ( !IsWindow(hwndMDIClient) )
        return ( DefFrameProc(hWnd, 0, uMsg, wParam, lParam) );
    return ( DefFrameProc(hWnd, hwndMDIClient, uMsg, wParam, lParam) );
}
/*****
* Main window dialog box procedure
*****/
long FAR PASCAL _export
WndProc(HWND hwnd, UINT message, UINT wParam, LONG lParam)
{
	HBRUSH hbrush;

	switch (message)
	{
		case WM_CREATE:
			file_sel_changed = 0;
			/* attach keyboard interface */
			if((myhookproc = SetWindowsHookEx(WH_KEYBOARD,
				(HOOKPROC)KeyboardProc, hInst,
				GetCurrentTask())) == NULL)
				ErrHandler(NULL, R_ERROR, RB_OK1, "Winfflow "
					"Error: failed to set keyboard hook.\n"
					"Keyboard interface not installed.");
			return FALSE;
		/* following four cases ctl3d specific */
		case WM_SYSCOLORCHANGE:
			Ctl3dColorChange();
			return FALSE;
		case WM_SETTEXT:
		case WM_NCPAINT:
		case WM_NCACTIVATE:
			SetWindowLong(hwnd, DWL_MSGRESULT,
				Ctl3dDlgFramePaint(hwnd, message, wParam, 
				lParam));
			return TRUE;
		/*
		* paint window background with a brush provided by the response
		* to the WM_CTLCOLOR message
		*/
		case WM_ERASEBKGND:
		{
			RECT lprc;
			HDC hdc = (HDC)wParam;

			if(hwnd != hWndMain)
				return TRUE;
			if(!background_brush)
				return TRUE;
			UnrealizeObject(background_brush);
			GetClientRect(hwnd, &lprc);
			SetBrushOrg(hdc, 0, 0);
			SelectObject(hdc, background_brush);
			FillRect(hdc, &lprc, background_brush);
			return TRUE;
		}
		case WM_SIZE:
			switch(wParam)
			{
				case SIZE_MAXIMIZED:
				case SIZE_RESTORED:
					if(!block_resize)
						DoResize(hwnd, 0);
					return FALSE;
				default:
					break;
			}
			break;
		case WM_COMMAND:
		switch(GET_COMMAND_ID)
		{
			case IDC_MAIN_ABOUT:
				DisplayDialog(hwnd, hInst,WINFFLOW_ABOUT_DIALOG,
					AboutProc);
				break;
			/* add files to the listbox */
			case IDC_MAIN_ADD:
				get_fortran_files(hwnd);
				break;

			/* double click will edit selected file */
			case IDC_MAIN_LISTBOX:
				if(GET_COMMAND_CMD == LBN_DBLCLK)
					get_selected_file(hwnd, 
						IDC_MAIN_LISTBOX);
				break;

			/* remove/edit selected file */
			case IDC_MAIN_EDIT:
			case IDC_MAIN_REMOVE:
				get_selected_file(hwnd, GET_COMMAND_ID);
				break;
			case IDC_MAIN_REMOVE_ALL:
				SendDlgItemMessage(hwnd, IDC_MAIN_LISTBOX, 
					LB_RESETCONTENT, 0, 0L);
				destroy_filelist();
				break;
			/* settings */
			case IDC_MAIN_SETTINGS:
				DisplayDialog(hwnd, hInst,
					WINFFLOW_SETTINGS_DIALOG,
					(FARPROC)SettingsProc);
				break;

			/* scan the files */
			case IDOK:
				/*
				* scan the files when the selection has changed,
				* there is no current flowgraph or when the 
				* previous scan has been aborted
				*/
				if(file_sel_changed || flow == NULL ||
					yylex_abort)
				{
					/* pick up files */
					if(!get_files_to_scan(hwnd))
						break;
					generate_flowgraph();
				}
				/* hide main window */
				ShowWindow(hWndMain, SW_HIDE);
				/* display selector dialog box */
				DisplayDialog(hwnd, hInst,
					WINFFLOW_OUTPUTSELECTOR_DIALOG,
					(FARPROC)SelectorProc);
				/* display main window again */
				ShowWindow(hWndMain, SW_RESTORE);
				break;
			case IDCANCEL:
				/* save the filelist */
				save_ini_file_data(hwnd);
				SendMessage(hWndMain, WM_CLOSE, 0, 0L);
				break;
			case IDHELP:
				WinHelp(hWndMain, "winfflow.hlp", 
					HELP_CONTEXT, WINFFLOW_MAIN_DIALOG);
				break;
		} return(FALSE);
		case WM_SYSCOMMAND:
			if(GET_COMMAND_ID == SC_CLOSE)	/* Get the close item */
			{
				SendMessage(hWndMain, WM_CLOSE, 0, 0L);
				return FALSE;
			}
			break;
		case WM_CLOSE:
			UnregisterResize(hwnd);
			DestroyWindow(hwnd);
			return FALSE;
		case WM_DESTROY:
			PostQuitMessage (0) ;
			return FALSE;
/* Ctl3d specific code */
#ifdef WIN32
		case WM_CTLCOLORBTN:
		case WM_CTLCOLORDLG:
		case WM_CTLCOLOREDIT:
		case WM_CTLCOLORLISTBOX:
		case WM_CTLCOLORMSGBOX:
		case WM_CTLCOLORSCROLLBAR:
		case WM_CTLCOLORSTATIC:
#else
		case WM_CTLCOLOR:
#endif
			hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
			if (hbrush != (HBRUSH) FALSE)
			{
				/* save this brush */
				background_brush = hbrush;
				return hbrush;
			}
			/* fall through */
		default:
			break;
	 }
	 return (DefWindowProc (hwnd, message, wParam, lParam));
}