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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines