ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/VTBFileUtil2/VTBFileUtil2.cxx
(Generate patch)

Comparing trunk/VTBFileUtil2/VTBFileUtil2.cxx (file contents):
Revision 257 by douglas, 2003-08-15T23:44:42-07:00 vs.
Revision 259 by douglas, 2003-08-16T01:40:55-07:00

# Line 2 | Line 2
2   //
3   // Douglas Thrift
4   //
5 < // $Id: VTBFileUtil2.cxx,v 1.3 2003/08/16 06:44:42 douglas Exp $
5 > // $Id: VTBFileUtil2.cxx,v 1.4 2003/08/16 08:40:55 douglas Exp $
6  
7   #include "VTBFileUtil2.h"
8  
# Line 16 | Line 16 | string program;
16   string programName = "Vance Thrift and Biller File Utility 2";
17   string programVersion = "2.0alpha";
18  
19 + HINSTANCE instance;
20   HICON icon;
21   Mode choiceMode = none;
22   bool choiceAlways = false;
23 + UINT_PTR tips = 0;
24  
25   INT_PTR CALLBACK usage(HWND dialog, UINT msg, WPARAM w, LPARAM l);
26   INT_PTR CALLBACK version(HWND dialog, UINT msg, WPARAM w, LPARAM l);
# Line 50 | Line 52 | inline void arguments(vector<string>& ar
52   inline void munge(void)
53   {
54          AllocConsole();
55 <        SetConsoleTitle("Renegade Map Selector");
55 >        SetConsoleTitle(programName.c_str());
56  
57          int hin = _open_osfhandle(long(GetStdHandle(STD_INPUT_HANDLE)), _O_TEXT);
58          int hout = _open_osfhandle(long(GetStdHandle(STD_OUTPUT_HANDLE)), _O_TEXT);
# Line 73 | Line 75 | inline void munge(void)
75          cerr.sync_with_stdio();
76   }
77  
78 < inline void usage(HINSTANCE instance, HWND parent)
78 > inline void usage(HWND parent)
79   {
80          DialogBox(instance, MAKEINTRESOURCE(IDD_USAGE), parent, usage);
81   }
82  
83 < inline void version(HINSTANCE instance, HWND parent)
83 > inline void version(HWND parent)
84   {
85          DialogBox(instance, MAKEINTRESOURCE(IDD_VERSION), parent, version);
86   }
87  
88 < inline void choice(Mode& mode, HINSTANCE instance, HWND parent)
88 > inline void choice(Mode& mode, HWND parent)
89   {
90          DialogBox(instance, MAKEINTRESOURCE(IDD_CHOICE), parent, choice);
91  
# Line 98 | Line 100 | int WINAPI WinMain(HINSTANCE hInstance,
100          InitCommonControls();
101          arguments(args, GetCommandLine());
102  
103 +        instance = hInstance;
104          program = args[0];
105  
106          Mode mode = none;
# Line 108 | Line 111 | int WINAPI WinMain(HINSTANCE hInstance,
111          {
112                  if (args[index] == "-help")
113                  {
114 <                        usage(hInstance);
114 >                        usage();
115                          return 0;
116                  }
117                  else if (args[index] == "-version")
118                  {
119 <                        version(hInstance);
119 >                        version();
120                          return 0;
121                  }
122                  else if (args[index] == "-disc")
# Line 168 | Line 171 | int WINAPI WinMain(HINSTANCE hInstance,
171  
172          if (mode == none)
173          {
174 <                choice(mode, hInstance);
174 >                choice(mode);
175  
176                  if (debug)
177                  {
# Line 214 | Line 217 | int WINAPI WinMain(HINSTANCE hInstance,
217          return 0;
218   }
219  
220 + void tooltip(HWND tool, const string& tip)
221 + {
222 +        HWND tooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP
223 +                | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT,
224 +                CW_USEDEFAULT, CW_USEDEFAULT, tool, NULL, instance, NULL);
225 +        RECT rect;
226 +
227 +        SetWindowPos(tooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE |
228 +                SWP_NOACTIVATE);
229 +
230 +        GetClientRect(tool, &rect);
231 +
232 +        TOOLINFO toolinfo;
233 +        char* ctip = new char[tip.length()];
234 +
235 +        sprintf(ctip, "%s", tip.c_str());
236 +
237 +        if (debug) cerr << "ctip = " << ctip << "\n";
238 +
239 +        toolinfo.cbSize = sizeof(TOOLINFO);
240 +        toolinfo.uFlags = TTF_SUBCLASS;
241 +        toolinfo.hwnd = tool;
242 +        toolinfo.hinst = instance;
243 +        toolinfo.uId = tips++;
244 +        toolinfo.lpszText = ctip;
245 +        toolinfo.rect.left = rect.left;
246 +        toolinfo.rect.top = rect.top;
247 +        toolinfo.rect.right = rect.right;
248 +        toolinfo.rect.bottom = rect.bottom;
249 +
250 +        SendMessage(tooltip, TTM_ADDTOOL, 0, LPARAM(LPTOOLINFO(&toolinfo)));
251 + }
252 +
253   INT_PTR CALLBACK usage(HWND dialog, UINT msg, WPARAM w, LPARAM l)
254   {
255          switch (msg)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines