⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialog2.c

📁 NASA 开发使用的一个专家系统
💻 C
📖 第 1 页 / 共 4 页
字号:
	       /*--------------------+	       | Describe Defclasses |	       +--------------------*/	       if ( wParam == IDC_PBUTTON2 )	       {  extern SCREEN WinDialog;		  PrintCLIPS ("wclips", "(describe-class ");		  PrintCLIPS ("wclips", string );		  PrintCLIPS ("wclips", ")\n");		  DescribeClass ("wclips", defclassPtr );		  PrintPrompt ();		  InvalidateRect ( WinDialog.hWnd, NULL, TRUE );	       }	       /*------------------+	       | Browse Defclasses |	       +------------------*/	       if ( wParam == IDC_PBUTTON3 )	       {  extern SCREEN WinDialog;		  PrintCLIPS ("wclips", "(browse-classes ");		  PrintCLIPS ("wclips", string );		  PrintCLIPS ("wclips", ")\n");		  BrowseClasses ("wclips" ,defclassPtr );		  PrintPrompt ();		  InvalidateRect ( WinDialog.hWnd, NULL, TRUE );	       }	       /*------------------+	       | PPrint Defclasses |	       +------------------*/	       if ( wParam == IDC_PBUTTON4 )	       {  extern SCREEN WinDialog;		  PrintCLIPS ("wclips", "(ppdefclass ");		  PrintCLIPS ("wclips", string );		  PrintCLIPS ("wclips", ")\n");		  PrintCLIPS ("wclips", GetDefclassPPForm ( defclassPtr ));		  PrintPrompt ();		  InvalidateRect ( WinDialog.hWnd, NULL, TRUE );	       }	       /*----------------+	       | Message Handler |	       +----------------*/	       if ( wParam == IDC_PBUTTON5 )	       {  FARPROC lpProc;		  extern HANDLE hInst;		  lpProc = MakeProcInstance(DefMessageManager, hInst);		  DialogBoxParam(hInst,"List_Manager", hDlg, lpProc, (LPARAM)defclassPtr);		  FreeProcInstance(lpProc);	       }	       /*---------------------------+	       | Set-Remove Trace Instances |	       +---------------------------*/	       if ( wParam == IDC_CBOX2 )	       {  SetDefclassWatchInstances(!GetDefclassWatchInstances(defclassPtr), defclassPtr);		  SetFocus (hListBox);	       }	       /*------------------------------+	       | Set-Remove Trace Slot Changes |	       +------------------------------*/	       if ( wParam == IDC_CBOX3 )	       {  SetDefclassWatchSlots (!GetDefclassWatchSlots(defclassPtr), defclassPtr);		  SetFocus (hListBox);	       }	       /*-------------------+	       | Update Check Boxes |	       +-------------------*/	       {  int Intstances = GRAY;		  int Slots = GRAY;		  if ( !(ClassAbstractP(defclassPtr)))		  {  Intstances = GetDefclassWatchInstances(defclassPtr);		     Slots = GetDefclassWatchSlots(defclassPtr);		  }		  ShowButtons ( hDlg,		     IsDefclassDeletable(defclassPtr), ENABLE, ENABLE,		     ( GetDefclassPPForm(defclassPtr)!= NULL),		     ( GetNextDefmessageHandler(defclassPtr,0) != 0),		     HIDE,		     Intstances,		     Slots,		     ENABLE);	       }	       GlobalUnlock ( hString );	       GlobalFree ( hString );	       return ( TRUE );	    }	 }	 break;      }   }#endif   return (FALSE);}/************************************************************* DefMessageManager: Callback Function for the DefMessage*   List Box Manager.************************************************************/BOOL FAR PASCAL _export DefMessageManager (hDlg, message, wParam, lParam)   HWND       hDlg;   unsigned   message;   WORD       wParam;   LONG       lParam;{#if OBJECT_SYSTEM   HWND hListBox = GetDlgItem ( hDlg, IDC_LISTBOX);   static VOID *defclassPtr;   switch (message)   {  case WM_INITDIALOG:      {  unsigned handlerIndex = 0 ;	 int count=0;	 char buffer[100];	 defclassPtr = (VOID *)lParam;	 StartWaitCursor();	 while ((handlerIndex = GetNextDefmessageHandler ( defclassPtr, handlerIndex )) != 0)	 {  char Name[100];	    int index;	    sprintf (Name,"%s (%s)",	       GetDefmessageHandlerName (defclassPtr, handlerIndex),	       GetDefmessageHandlerType ( defclassPtr, handlerIndex));	    index = (int) SendMessage ( hListBox, LB_ADDSTRING, 0,(LPARAM)(LPCSTR) Name);	    SendMessage ( hListBox,LB_SETITEMDATA,index,handlerIndex);	    WinRunEvent();	    count ++;	 }	 StopWaitCursor();	 SendMessage ( hListBox, LB_SETCURSEL, 0, 0L);	 sprintf ( DialogName,"Defmessage-Handler Manager - %4d Items",count);	 sprintf ( buffer,"Message Handler for - <%s>",GetDefclassName(defclassPtr));	 SetWindowText(GetDlgItem (hDlg, IDC_TEXT), buffer);	 SetWindowText ( hDlg, (LPSTR)DialogName );	 ShowButtons (hDlg, DISABLE, HIDE, HIDE, DISABLE, HIDE,	    DISABLE, HIDE, HIDE, ENABLE);	 return (TRUE);      }      case WM_COMMAND:      {  switch (wParam)	 {  /*------*/	    /* Done */	    /*------*/	    case IDC_PBUTTON6:	    {  EndDialog( hDlg, IDOK);	       return (TRUE);	    }			       /*-------------------*/	    case IDC_PBUTTON1: /* Remove Defmessage */	    case IDC_PBUTTON4: /* PPrint Defmessage */	    case IDC_CBOX1:    /* Trace Defmessage  */	    case IDC_LISTBOX:  /*-------------------*/	    {  int index =(int) SendMessage ( hListBox, LB_GETCURSEL, 0, 0L );	       unsigned handlerIndex;	       extern SCREEN WinDialog;	       int count = (int) SendMessage(hListBox, LB_GETCOUNT, 0, 0);	       if (index == LB_ERR )		  break;	       handlerIndex = (unsigned) SendMessage ( hListBox,LB_GETITEMDATA,index ,0);	       /*-------------------*/	       /* Remove Defmessage */	       /*-------------------*/	       if ( wParam == IDC_PBUTTON1 )			 {		  count--;		  sprintf ( DialogName,"Defmessage-Handler Manager - %4d Items",count);		  SetWindowText ( hDlg, (LPSTR)DialogName );		  SendMessage (hListBox, LB_DELETESTRING, index, 0L );		  UndefmessageHandler ( defclassPtr, handlerIndex);		  PrintPrompt ();		  InvalidateRect ( WinDialog.hWnd, NULL, TRUE );		  SetFocus (hListBox);		  break;  	       }	       /*-------------------*/	       /* Pprint Defmessage */	       /*-------------------*/	       if ( wParam == IDC_PBUTTON4 )	       {  PrintCLIPS ("wclips", "(ppdefmessage-handler ");		  PrintCLIPS ("wclips", GetDefclassName(defclassPtr));		  PrintCLIPS ("wclips"," ");		  PrintCLIPS ("wclips", GetDefmessageHandlerName(defclassPtr, handlerIndex));		  PrintCLIPS ("wclips"," ");		  PrintCLIPS ("wclips", GetDefmessageHandlerType(defclassPtr, handlerIndex));		  PrintCLIPS ("wclips", ")\n");		  PrintCLIPS ("wclips", GetDefmessageHandlerPPForm ( defclassPtr, handlerIndex ));		  PrintPrompt ();		  InvalidateRect ( WinDialog.hWnd, NULL, TRUE );		  SetFocus (hListBox);	       }	       /*----------------------------+	       | Set-Remove Defmessage Trace |	       +----------------------------*/	       if ( wParam == IDC_CBOX1 )	       {  SetDefmessageHandlerWatch(		     !GetDefmessageHandlerWatch(defclassPtr, handlerIndex),		     defclassPtr, handlerIndex);		  SetFocus (hListBox);	       }	       ShowButtons (hDlg,		  IsDefmessageHandlerDeletable(defclassPtr, handlerIndex),		  HIDE, HIDE,		  (GetDefmessageHandlerPPForm(defclassPtr, handlerIndex)!= NULL),		  HIDE,		  GetDefmessageHandlerWatch(defclassPtr, handlerIndex),		  HIDE, HIDE, ENABLE);	       return (TRUE);	    }	 }	 break;      }   }#endif   return (FALSE);}/************************************************************* AgendaManager: Callback Function for the Agenda*   List Box Manager.************************************************************/#if IBM_TBC#pragma argsused#endifBOOL FAR PASCAL _export AgendaManager (hDlg, message, wParam, lParam)   HWND       hDlg;   unsigned   message;   WORD       wParam;   LONG       lParam;{#if DEFRULE_CONSTRUCT   HWND hListBox = GetDlgItem ( hDlg, IDC_LISTBOX);   switch (message)   {  case WM_INITDIALOG:      {  VOID *activationPtr = NULL;	 int count=0;	 ShowButtons   ( hDlg, DISABLE, HIDE, HIDE, DISABLE, HIDE,	    HIDE, HIDE, HIDE, ENABLE);	 SetWindowText ( GetDlgItem ( hDlg, IDC_PBUTTON4 ), "&Fire" );	 StartWaitCursor();	 while((activationPtr=GetNextActivation(activationPtr)) != NULL)	 {  char Buffer[200];	    int index;	    GetActivationPPForm (Buffer, 199 ,activationPtr);	    index = (int) SendMessage ( hListBox, LB_ADDSTRING, 0,(LPARAM)(LPCSTR) Buffer);	    SendMessage ( hListBox, LB_SETITEMDATA, (WPARAM)index, (LPARAM)activationPtr );	    WinRunEvent();	    count++;	 }	 StopWaitCursor();	 SendMessage ( hListBox, LB_SETCURSEL, 0, 0L);	 sprintf ( DialogName,"Agenda Manager - %4d Items",count);	 SetWindowText ( hDlg, (LPSTR)DialogName );	 return (TRUE);      }      case WM_COMMAND:      {  switch (wParam)	 {  /*-----+	    | Done |	    +-----*/	    case IDC_PBUTTON6:	    {  EndDialog( hDlg, IDOK);	       return (TRUE);	    }			       /*-------------------*/	    case IDC_PBUTTON1: /* Remove Activation */	    case IDC_PBUTTON4: /* Fire Activation   */	    case IDC_LISTBOX:  /*-------------------*/	    {  int index = (int) SendMessage ( hListBox, LB_GETCURSEL, 0, 0L );	       extern SCREEN WinAgenda;	       VOID *activationPtr;	       int count;	       if (index == LB_ERR ) break;	       activationPtr = (VOID *)SendMessage (hListBox, LB_GETITEMDATA, (WPARAM)index, 0L);	       /*------------------+	       | Remove Activation |	       +------------------*/	       if ( wParam == IDC_PBUTTON1 )	       {  SendMessage (hListBox, LB_DELETESTRING, (WPARAM)index, 0L );		  DeleteActivation ( activationPtr );		  count = (int) SendMessage(hListBox, LB_GETCOUNT, 0, 0);		  sprintf ( DialogName,"Agenda Manager - %4d Items",count);		  SetWindowText ( hDlg, (LPSTR)DialogName );		  InvalidateRect (WinAgenda.hWnd, NULL, TRUE );		  SetFocus ( hListBox );	       }	       /*-----+	       | Fire |	       +-----*/	       if ( wParam == IDC_PBUTTON4 )	       {  MoveActivationToTop ( activationPtr );		  InvalidateRect ( WinAgenda.hWnd, NULL, TRUE );		  SetAgendaChanged (FALSE);		  FlushCommandString();		  SetCommandString ("(run 1)\n");		  PrintCLIPS ("stdout","(run 1)\n");		  SendMessage ( hDlg, WM_COMMAND, IDC_PBUTTON6, 0L );		  break;	       }	       ShowButtons ( hDlg,		  ENABLE, HIDE, HIDE,		  ENABLE, HIDE,		  HIDE, HIDE, HIDE,		  ENABLE);	       return (TRUE);	    }	 }	 break;      }   }#endif   return (FALSE);}/************************************************************* DefGlobalManager: Callback Function for the DefGeneric List*   Box Manager.************************************************************/#if IBM_TBC#pragma argsused#endifBOOL FAR PASCAL _export DefGlobalManager (hDlg, message, wParam, lParam)   HWND       hDlg;   unsigned   message;   WORD       wParam;   LONG       lParam;{#if DEFGLOBAL_CONSTRUCT   HWND hListBox = GetDlgItem ( hDlg, IDC_LISTBOX);   switch (message)   {  case WM_INITDIALOG:      {  int count = 0;	 VOID *Ptr = NULL;	 StartWaitCursor();	 while ((Ptr = GetNextDefglobal ( Ptr )) != NULL)	 {  count ++;	    SendMessage ( hListBox, LB_ADDSTRING, 0,(LPARAM)(LPCSTR) GetDefglobalName (Ptr));	    WinRunEvent();	 }	 StopWaitCursor();	 SendMessage ( hListBox, LB_SETCURSEL, 0, 0L );	 sprintf ( DialogName,"Defglobal Manager - %4d Items",count);	 SetWindowText( hDlg, (LPSTR)DialogName );	 ShowButtons ( hDlg, DISABLE, HIDE, HIDE, DISABLE, HIDE,	    HIDE, HIDE, HIDE, ENABLE);	 return (TRUE);      }      case WM_COMMAND:      {  switch (wParam)	 {  case IDC_PBUTTON6: /* Done */	    {  EndDialog( hDlg, IDOK);	       return (TRUE);	    }			       /*------------------------------*/	    case IDC_PBUTTON1: /* Remove                       */	    case IDC_PBUTTON4: /* PPrint                       */	    case IDC_LISTBOX:  /*------------------------------*/	    {  int index = (int) SendMessage ( hListBox, LB_GETCURSEL, 0, 0L );	       int stringsize = (int) SendMessage(hListBox, LB_GETTEXTLEN, index, 0);	       VOID *Ptr;	       HANDLE hString;#if WIN_32			 char *string;#else			 char far *string;#endif			 extern SCREEN WinDialog;	       if (stringsize == LB_ERR)		  break;					       hString = GlobalAlloc(GMEM_FIXED, (WORD) stringsize+1);	       if ( hString == NULL)	       {  EndDialog( hDlg, IDOK);		  ExitToShell();	       }	       string =  GlobalLock ( hString );	       SendMessage( hListBox, LB_GETTEXT, index,(LPARAM)((LPSTR) string) );	       Ptr = FindDefglobal ( string );	       if (Ptr == NULL) break;	       /*-----------------+	       | Remove Defglobal |	       +-----------------*/	       if ( wParam == IDC_PBUTTON1 )			 {     int count;		  Undefglobal ( Ptr );		  SendMessage (hListBox, LB_DELETESTRING, index, 0L );		  count = (int)  SendMessage (hListBox, LB_GETCOUNT, 0, 0);		  sprintf ( DialogName,"Defglobal Manager - %4d Items",count);		  SetWindowText ( hDlg, (LPSTR)DialogName );		  PrintCLIPS ("wclips", "(undefglobal ");		  PrintCLIPS ("wclips", string );		  PrintCLIPS ("wclips", ")\n");		  PrintPrompt ();		  InvalidateRect (WinDialog.hWnd, NULL, TRUE );		  SetFocus (hListBox);		  GlobalUnlock ( hString );		  GlobalFree ( hString );		  break;	       }	       /*-----------------+	       | PPrint Defglobal |	       +-----------------*/	       if ( wParam == IDC_PBUTTON4 )	       {  PrintCLIPS ("wclips", "(ppdefglobal ");		  PrintCLIPS ("wclips", string );		  PrintCLIPS ("wclips", ")\n");		  PrintCLIPS ("wclips", GetDefglobalPPForm ( Ptr ));		  PrintPrompt ();		  InvalidateRect (WinDialog.hWnd, NULL, TRUE );		  SetFocus (hListBox);	       }	       /*-------------------+	       | Update Check Boxes |	       +-------------------*/	       ShowButtons ( hDlg,		  IsDefglobalDeletable (Ptr), HIDE, HIDE,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -