Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 135 lines (97 sloc) 3.068 kb
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
1 /*
2 ** wintags.c -- windows interface for the ctags program.
3 **
4 ** Copyright 1996, Serge Pirotte.
5 */
6
7 #define CHAR Char
8 #include "elvis.h"
9 #undef CHAR
9f1c6f0 @mbert Import Elvis 2.2_0 (written by Steve Kirkendall)
authored
10 #undef ELVBOOL
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored
11
12 #if defined (GUI_WIN32)
13
14 #include <windows.h>
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include "wintools.h"
18 #include "wintags.h"
19
20 static HWND tagsDlgWnd;
21 static char *cmdLineP;
22
23 extern int main (int argc, char **argv);
24
25 static void get_messages (void);
26 static LRESULT CALLBACK TagsDlgProc (HWND hDlg, UINT message,
27 WPARAM wParam, LPARAM lParam);
28
29 /* ---[ WinMain ]------------------------------------------------------ */
30
31 int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
32 LPSTR lpCmdLine, int nCmdShow)
33
34 {
35 /* parse the command line */
36 cmdLineP = lpCmdLine;
37 parse_cmd_line (lpCmdLine);
38
39 /* create the dialog box */
40 tagsDlgWnd = CreateDialog (hInstance, MAKEINTRESOURCE (IDD_TAGS),
41 NULL, (DLGPROC)TagsDlgProc);
42 center_window (NULL, tagsDlgWnd);
43 ShowWindow (tagsDlgWnd, SW_SHOW);
44 get_messages ();
45
46 /* call ctags */
47 main (cmd_line_argc, cmd_line_argv);
48
49 /* terminate dialog */
50 DestroyWindow (tagsDlgWnd);
51 get_messages ();
52 return 0;
53 }
54
55 /* ---[ get_messages ]------------------------------------------------- */
56
57 static void get_messages (void)
58
59 {
60 MSG msg;
61
62 while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) {
63 TranslateMessage (&msg);
64 DispatchMessage (&msg);
65 }
66 }
67
68 /* ---[ set_current_file ]--------------------------------------------- */
69
70 void set_current_file (char *file_name)
71
72 {
73 SetDlgItemText (tagsDlgWnd, ID_CUR_FILE, file_name);
74
75 /* schedule messages */
76 get_messages ();
77 }
78
79 /* ---[ set_current_tags ]--------------------------------------------- */
80
81 void set_current_tags (int num_tags)
82
83 {
84 char msg[20];
85
86 sprintf (msg, "%d", num_tags);
87 SetDlgItemText (tagsDlgWnd, ID_CUR_TAGS, msg);
88
89 /* schedule messages */
90 get_messages ();
91 }
92
93 /* ---[ set_total_tags ]----------------------------------------------- */
94
95 void set_total_tags (int num_tags)
96
97 {
98 char msg[20];
99
100 sprintf (msg, "%d", num_tags);
101 SetDlgItemText (tagsDlgWnd, ID_TOTAL_TAGS, msg);
102
103 /* schedule messages */
104 get_messages ();
105 }
106
107 /* ---[ TagsDlgProc ]-------------------------------------------------- */
108
109 static LRESULT CALLBACK TagsDlgProc (HWND hDlg, UINT message,
110 WPARAM wParam, LPARAM lParam)
111
112 {
113 char msg[256];
114
115 switch (message) {
116 case WM_INITDIALOG:
117 sprintf (msg, "WinTags %s", cmdLineP);
118 SetWindowText (hDlg, msg);
119 return TRUE;
120
121 case WM_COMMAND:
122 if (LOWORD (wParam) == IDCANCEL) {
123 DestroyWindow (tagsDlgWnd);
124 get_messages ();
125 exit (1);
126 }
127 break;
128 }
129
130 return FALSE;
131 }
132
133 #endif
3a9bb55 @mbert Import Elvis 2.1_3 (written by Steve Kirkendall)
authored
134 /* ex:se ts=4 sw=4: */
Something went wrong with that request. Please try again.