📄 dialog2.c
字号:
(GetDefglobalPPForm (Ptr) != NULL), HIDE, HIDE, HIDE, HIDE, ENABLE); GlobalUnlock ( hString ); GlobalFree ( hString ); return (TRUE); } } break; } }#endif return (FALSE);}/************************************************************* DefRuleManager: Callback Function for the DefRule List* Box Manager.************************************************************/#if IBM_TBC#pragma argsused#endifBOOL FAR PASCAL _export DefRuleManager (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: { int count = 0; VOID *defrulePtr = NULL; StartWaitCursor(); while ((defrulePtr = GetNextDefrule ( defrulePtr )) != NULL) { count ++; SendMessage ( hListBox, LB_ADDSTRING, 0,(LPARAM)(LPCSTR) GetDefruleName (defrulePtr)); WinRunEvent(); } StopWaitCursor(); SendMessage ( hListBox, LB_SETCURSEL, 0, 0L ); sprintf ( DialogName,"Defrule Manager - %4d Items",count); SetWindowText( hDlg, (LPSTR)DialogName ); ShowButtons ( hDlg, DISABLE, DISABLE, DISABLE, DISABLE, HIDE, GRAY, GRAY, GRAY, ENABLE ); SetWindowText ( GetDlgItem ( hDlg, IDC_CBOX1 ), "&Breakpoint" ); SetWindowText ( GetDlgItem ( hDlg, IDC_CBOX3 ), "Watch &Firings" ); return (TRUE); } case WM_COMMAND: { switch (wParam) { case IDC_PBUTTON6: { EndDialog( hDlg, IDOK); return (TRUE); } /*------------------------------*/ case IDC_PBUTTON1: /* Remove */ case IDC_PBUTTON2: /* Refresh */ case IDC_PBUTTON3: /* Matches */ case IDC_PBUTTON4: /* PPrint */ case IDC_CBOX1: /* Remove-Set Break */ case IDC_CBOX2: /* Remove-Set Trace Activations */ case IDC_CBOX3: /* Remove-Set Trace Firings */ case IDC_LISTBOX: /*------------------------------*/ { int index = (int) SendMessage ( hListBox, LB_GETCURSEL, 0, 0L ); int stringsize = (int) SendMessage(hListBox, LB_GETTEXTLEN, index, 0); VOID *defrulePtr; 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) ); defrulePtr = FindDefrule ( string ); if (defrulePtr == NULL) break; /*---------------+ | Remove Defrule | +---------------*/ if ( wParam == IDC_PBUTTON1 ) { int count; Undefrule ( defrulePtr ); SendMessage (hListBox, LB_DELETESTRING, index, 0L ); count = (int) SendMessage (hListBox, LB_GETCOUNT, 0, 0); sprintf ( DialogName,"Defrule Manager - %4d Items",count); SetWindowText ( hDlg, (LPSTR)DialogName ); PrintCLIPS ("wclips", "(undefrule "); PrintCLIPS ("wclips", string ); PrintCLIPS ("wclips", ")\n"); PrintPrompt (); InvalidateRect (WinDialog.hWnd, NULL, TRUE ); SetFocus (hListBox); GlobalUnlock ( hString ); GlobalFree ( hString ); break; } /*----------------+ | Refresh Defrule | +----------------*/ if ( wParam == IDC_PBUTTON2 ) { Refresh ( defrulePtr ); PrintCLIPS ("wclips", "(refresh "); PrintCLIPS ("wclips", string ); PrintCLIPS ("wclips", ")\n"); PrintPrompt (); InvalidateRect (WinDialog.hWnd, NULL, TRUE ); SetFocus (hListBox); } /*--------------+ | Match Defrule | +--------------*/ if ( wParam == IDC_PBUTTON3 ) { PrintCLIPS ("wclips", "(matches "); PrintCLIPS ("wclips", string ); PrintCLIPS ("wclips", ")\n"); Matches ( defrulePtr ); PrintPrompt (); InvalidateRect (WinDialog.hWnd, NULL, TRUE ); SetFocus ( hListBox ); } /*---------------+ | PPrint Defrule | +---------------*/ if ( wParam == IDC_PBUTTON4 ) { PrintCLIPS ("wclips", "(ppdefrule "); PrintCLIPS ("wclips", string ); PrintCLIPS ("wclips", ")\n"); PrintCLIPS ("wclips", GetDefrulePPForm ( defrulePtr )); PrintPrompt (); InvalidateRect (WinDialog.hWnd, NULL, TRUE ); SetFocus (hListBox); } /*----------------------------+ | Set-Remove Break on Defrule | +----------------------------*/ if ( wParam == IDC_CBOX1 ) { if ( RemoveBreak(defrulePtr)) { RemoveBreak(defrulePtr); PrintCLIPS ("wclips", "(remove-break "); } else { SetBreak(defrulePtr); PrintCLIPS ("wclips", "(set-break "); } PrintCLIPS ("wclips", string ); PrintCLIPS ("wclips", ")\n"); PrintPrompt (); SetFocus (hListBox); } /*----------------------------+ | Set-Remove Trace Activation | +----------------------------*/ if ( wParam == IDC_CBOX2 ) { SetDefruleWatchActivations (!GetDefruleWatchActivations(defrulePtr), defrulePtr); SetFocus (hListBox); } /*-------------------------+ | Set-Remove Trace Firings | +-------------------------*/ if ( wParam == IDC_CBOX3 ) { SetDefruleWatchFirings (!GetDefruleWatchFirings(defrulePtr), defrulePtr); SetFocus (hListBox); } /*-------------------+ | Update Check Boxes | +-------------------*/ ShowButtons ( hDlg, IsDefruleDeletable (defrulePtr), ENABLE, ENABLE, (GetDefrulePPForm ( defrulePtr ) != NULL), HIDE, DefruleHasBreakpoint(defrulePtr), GetDefruleWatchActivations(defrulePtr), GetDefruleWatchFirings(defrulePtr), ENABLE); GlobalUnlock ( hString ); GlobalFree ( hString ); return (TRUE); } } break; } }#endif return (FALSE);}/************************************************************* DefGenericManager: Callback Function for the DefGeneric* List Box Manager.************************************************************/#if IBM_TBC#pragma argsused#endifBOOL FAR PASCAL _export DefGenericManager (hDlg, message, wParam, lParam) HWND hDlg; unsigned message; WORD wParam; LONG lParam;{#if DEFGENERIC_CONSTRUCT HWND hListBox = GetDlgItem ( hDlg, IDC_LISTBOX); switch (message) { case WM_INITDIALOG: { VOID *defPtr = NULL; int count=0; StartWaitCursor(); while ((defPtr = GetNextDefgeneric ( defPtr )) != NULL) { count ++; WinRunEvent(); SendMessage ( hListBox, LB_ADDSTRING, 0,(LPARAM)(LPCSTR) GetDefgenericName (defPtr)); } StopWaitCursor(); SendMessage ( hListBox, LB_SETCURSEL, 0, 0L); sprintf ( DialogName,"Defgeneric Manager - %4d Items",count); SetWindowText ( hDlg, (LPSTR)DialogName ); ShowButtons ( hDlg, DISABLE, HIDE ,HIDE , DISABLE, DISABLE, GRAY, HIDE, HIDE, ENABLE); SetWindowText(GetDlgItem (hDlg, IDC_PBUTTON5), "&Methods"); return (TRUE); } case WM_COMMAND: { switch (wParam) { /*-----+ | Done | +-----*/ case IDC_PBUTTON6: { EndDialog( hDlg, IDOK); return (TRUE); } /*---------*/ case IDC_CBOX1: /* Trace */ case IDC_PBUTTON1: /* Remove */ case IDC_PBUTTON4: /* PPrint */ case IDC_PBUTTON5: /* Methods */ case IDC_LISTBOX: /*---------*/ { int index = (int) SendMessage ( hListBox, LB_GETCURSEL, 0, 0L ); int stringsize = (int) SendMessage(hListBox, LB_GETTEXTLEN, index, 0); VOID *defPtr;#if WIN_32 char *string;#else char far *string;#endif HANDLE hString; 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)); defPtr = FindDefgeneric ( string ); /*------------------+ | Remove Defgeneric | +------------------*/ if ( wParam == IDC_PBUTTON1 ) { int count; extern SCREEN WinDialog; Undefgeneric ( defPtr ); SendMessage (hListBox, LB_DELETESTRING, index, 0L ); count = (int) SendMessage (hListBox, LB_GETCOUNT, 0, 0); sprintf ( DialogName,"Defgenerics Manager - %4d Items",count); SetWindowText ( hDlg, (LPSTR)DialogName ); PrintCLIPS ("wclips", "(undefgeneric "); PrintCLIPS ("wclips", string ); PrintCLIPS ("wclips", ")\n"); PrintPrompt (); InvalidateRect ( WinDialog.hWnd, NULL, TRUE ); SetFocus ( hListBox ); GlobalUnlock ( hString ); GlobalFree ( hString ); break; } /*------------------+ | PPrint Defgeneric | +------------------*/ if ( wParam == IDC_PBUTTON4 ) { extern SCREEN WinDialog; PrintCLIPS ("wclips", "(ppdefgeneric "); PrintCLIPS ("wclips", string ); PrintCLIPS ("wclips", ")\n"); PrintCLIPS ("wclips", GetDefgenericPPForm ( defPtr )); PrintPrompt (); InvalidateRect ( WinDialog.hWnd, NULL, TRUE ); } /*----------------+ | Methods Handler | +----------------*/ if ( wParam == IDC_PBUTTON5 ) { FARPROC lpProc; extern HANDLE hInst; lpProc = MakeProcInstance(DefMethodsManager, hInst); DialogBoxParam(hInst,"List_Manager", hDlg, lpProc, (LPARAM)defPtr); FreeProcInstance(lpProc); } /*---------------------------+ | Set-Remove Trace Instances | +---------------------------*/ if ( wParam == IDC_CBOX1 ) { SetDefgenericWatch (!GetDefgenericWatch(defPtr), defPtr); SetFocus (hListBox); } /*-------------------+ | Update Check Boxes | +-------------------*/ ShowButtons ( hDlg, IsDefgenericDeletable(defPtr), HIDE, HIDE, (GetDefgenericPPForm(defPtr)!= NULL), (GetNextDefmethod(defPtr,0) != 0), GetDefgenericWatch(defPtr), HIDE, HIDE, ENABLE); GlobalUnlock ( hString ); GlobalFree ( hString ); return (TRUE); } } } }#endif return (FALSE);}/****************************************************** CommandComplete: Callback Function for the Command* Complete Dialog.******************************************************/BOOL FAR PASCAL _export CommandComplete (hDlg, message, wParam, lParam) HWND hDlg; unsigned message; WORD wParam; LONG lParam;{ HWND hListBox = GetDlgItem ( hDlg, IDC_LISTBOX); switch (message) { case WM_INITDIALOG: { int count = 0; void *symbolPtr; extern char CompleteString[255]; extern struct symbolMatch *matches; CompleteString[0] = '\0'; symbolPtr = matches; StartWaitCursor(); while ( symbolPtr != NULL) { LPSTR foo; count ++; foo = (LPSTR)ValueToString (((struct symbolMatch *)symbolPtr)->match); SendMessage ( hListBox, LB_ADDSTRING, 0, (LPARAM)foo); WinRunEvent(); symbolPtr = (((struct symbolMatch *)symbolPtr)->next); } StopWaitCursor(); SendMessage ( hListBox, LB_SETCURSEL,0, 0L); sprintf ( DialogName,"Command Completion for \"%s\" - %4d Items",(LPSTR)lParam, count); SetWindowText( hDlg, (LPSTR)DialogName ); ShowButtons ( hDlg, ENABLE, HIDE, HIDE, ENABLE, HIDE, HIDE, HIDE, HIDE, ENABLE ); SetWindowText ( GetDlgItem ( hDlg, IDC_PBUTTON6 ), "&OK" ); SetWindowText ( GetDlgItem ( hDlg, IDC_PBUTTON4 ), "&Cancel" ); SetWindowText ( GetDlgItem ( hDlg, IDC_PBUTTON1 ), "&Help" ); return (TRUE); } case WM_COMMAND: { switch (wParam) { /*-------+ | Cancel | +-------*/ case IDC_PBUTTON4: { extern char CompleteString[255]; CompleteString[0] = '\0'; EndDialog( hDlg, IDC_CANCEL); return (TRUE); } /*------------+ | Help Button | +------------*/ case IDC_PBUTTON1: { extern char CompleteString[255]; int index = (int) SendMessage ( hListBox, LB_GETCURSEL, 0, 0L); SendMessage(hListBox,LB_GETTEXT,index,(LPARAM)(CompleteString)); WinHelp (hDlg, "CLIPS6.HLP", HELP_KEY, (DWORD) CompleteString); return (TRUE); } case IDC_LISTBOX: if ( HIWORD(lParam) != LBN_DBLCLK ) break; /*----------+ | OK Button | +----------*/ case IDC_PBUTTON6: { extern char CompleteString[255]; int index = (int) SendMessage ( hListBox, LB_GETCURSEL, 0, 0L ); SendMessage(hListBox,LB_GETTEXT,index,(LPARAM)(CompleteString)); EndDialog (hDlg, IDC_OK); return (TRUE); } } break; } } return (FALSE);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -