Start with the project you created in implementing the vector automation
Take the following steps to implement an edit menu in the application:
1. |
Select the File->New menu option. In the dialog box, select Resource Script and press Enter. |
2. |
Right click the script you just created. Select Insert and then Menu from the dialog box that appears and click OK. |
3. |
Create this Menu structure: |
IDR_MENU1
&File
&Undo with ID = IDM_EDIT_UNDO
&Redo with ID = IDM_EDIT_REDO
Cu&t with ID = IDM_EDIT_CUT
&Copy with ID = IDM_EDIT_COPY
&Paste with ID = IDM_EDIT_PASTE
&Delete with ID = IDM_EDIT_DELETE
Select &All with ID = IDM_EDIT_SELECTALL
&Unselect All with ID = IDM_EDIT_UNSELECTALL
P&rint with ID = IDM_EDIT_PRINT
&Reset with ID = IDM_EDIT_RESET
4. |
Select File->Save from the menu. Enter vecaut.rc in the Save As box and click Save. |
5. |
Select Insert->Files into Project, browse to the vecaut.rc file just created and click Add. |
6. |
Add the following line right under #include "c:\lead\include\ltaut.h". |
#include "resource.h"
7. |
Change the line |
WndClass.lpszMenuName = NULL;
In the WinMain function to
WndClass.lpszMenuName = MAKEINTRESOURCE( IDR_MENU1 );
8. |
Add the following lines of code right after the return 0L; statement of case |
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDM_EDIT_UNDO:
L_AutUndo(pAutomation, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_REDO:
L_AutUndo(pAutomation, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_CUT:
L_AutCut(pAutomation, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_COPY:
L_AutCopy(pAutomation, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_PASTE:
L_AutPaste(pAutomation, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_DELETE:
L_AutDelete(pAutomation, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_SELECTALL:
L_AutSelect(pAutomation, AUTOMATION_SELECT_ALL, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_UNSELECTALL:
L_AutSelect(pAutomation, AUTOMATION_SELECT_NONE, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_PRINT:
L_AutPrint(pAutomation, 0L);
return 0L;
case IDM_EDIT_RESET:
ResetView(hWnd, &Vector, pAutomation);
return 0L;
default:
break;
}
break;
9. |
Compile and run the demo. You should be able to perform common operations found in most Windows programs on your vector image. |