Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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