source: dev/ProjectEditor/ChildWndOnRebar.cpp@ 21

Last change on this file since 21 was 3, checked in by dai_9181, 18 years ago
File size: 13.0 KB
Line 
1#include "Common.h"
2
3
4
5//ファイル選択コンボボックス
6HWND hDocCombo;
7
8//スタンダードツールバー
9HWND hStandardToolbarPager; //ページャー
10ILuxToolbar *pobj_StandardToolbar;
11
12//デバッガツールバー
13HWND hDebuggerToolbarPager; //ページャー
14ILuxToolbar *pobj_DebuggerToolbar;
15
16//ビルドツールバー
17HWND hReleaseToolbarPager;
18ILuxToolbar *pobj_ReleaseToolbar;
19
20//プラットフォーム選択コンボボックス
21HWND hSelectCompilerCombo;
22
23//WebSearchコンボボックス
24HWND hWebSearchCombo;
25
26
27
28
29/////////////////
30// レバー追加
31// ※Add~プロシージャを追加
32/////////////////
33
34
35/* 以下は各バンドのメッセージプロシージャ */
36
37//hDocCombo(Rebar)プロシージャ
38LRESULT CALLBACK DocComboProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
39 extern WNDPROC OldDocComboProc;
40 extern MDIINFO MdiInfo[MAX_WNDNUM];
41 int i;
42 char str[MAX_PATH];
43 RECT rect;
44 switch(message){
45 case WM_COMMAND:
46 if(HIWORD(wParam)==CBN_SELCHANGE){
47 SendMessage(hwnd,CB_GETLBTEXT,SendMessage(hwnd,CB_GETCURSEL,0,0),(long)str);
48 for(i=0;i<MAX_WNDNUM;i++){
49 if(lstrcmpi(str,MdiInfo[i].title)==0) break;
50 }
51 BringWindowToTop(MdiInfo[i].hwnd);
52 }
53 break;
54 case WM_LBUTTONDOWN:
55 GetClientRect(hwnd,&rect);
56 SetWindowPos(hwnd,NULL,0,0,rect.right,120,SWP_NOMOVE);
57 break;
58 case WM_RBUTTONUP:
59 pobj_Rebar->menu_popup(hwnd,LOWORD(lParam),HIWORD(lParam));
60 break;
61 }
62 return CallWindowProc(OldDocComboProc,hwnd,message,wParam,lParam);
63}
64
65//hStandardToolbar(Rebar)プロシージャ
66LRESULT CALLBACK StandardToolbarProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
67 extern char CmdMsg[255];
68 extern WNDPROC OldStandardToolbarProc;
69 if(message==WM_RBUTTONUP){
70 pobj_Rebar->menu_popup(hwnd,LOWORD(lParam),HIWORD(lParam));
71 InvalidateRect(hwnd,NULL,0);
72 }
73 return CallWindowProc(OldStandardToolbarProc,hwnd,message,wParam,lParam);
74}
75
76//hSelectCompilerCombo(Rebar)プロシージャ
77LRESULT CALLBACK SelectCompilerComboProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
78 extern WNDPROC OldSelectCompilerComboProc;
79 int i;
80 switch(message){
81 case WM_COMMAND:
82 if(HIWORD(wParam)==CBN_SELCHANGE){
83 i=SendMessage(hwnd,CB_GETCURSEL,0,0);
84
85 extern char *lpszCompilerName;
86 if(i==0) lpszCompilerName=WIN32_COMPILER_NAME;
87 if(i==1) lpszCompilerName=WIN64_COMPILER_NAME;
88 }
89 break;
90 case WM_LBUTTONDOWN:
91 RECT rect;
92 GetClientRect(hwnd,&rect);
93 SetWindowPos(hwnd,NULL,0,0,rect.right,120,SWP_NOMOVE);
94 break;
95 case WM_RBUTTONUP:
96 pobj_Rebar->menu_popup(hwnd,LOWORD(lParam),HIWORD(lParam));
97 break;
98 }
99 return CallWindowProc(OldSelectCompilerComboProc,hwnd,message,wParam,lParam);
100}
101
102//hWebSearchCombo(Rebar)プロシージャ
103LRESULT CALLBACK WebSearchProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
104 extern WNDPROC OldWebSearchProc;
105 switch(message){
106 case WM_LBUTTONDOWN:
107 RECT rect;
108 GetClientRect(hwnd,&rect);
109 SetWindowPos(hwnd,NULL,0,0,rect.right,120,SWP_NOMOVE);
110 break;
111 }
112 return CallWindowProc(OldWebSearchProc,hwnd,message,wParam,lParam);
113}
114
115LRESULT CALLBACK WebSearchEditProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
116 extern WNDPROC OldWebSearchEditProc;
117 switch(message){
118 case WM_CHAR:
119 if(LOWORD(wParam)==VK_RETURN){
120 char *buffer,*temporary;
121 buffer=(char *)HeapAlloc(hHeap,0,MAX_PATH*3+1024);
122 temporary=(char *)HeapAlloc(hHeap,0,MAX_PATH*3+1024);
123
124 GetWindowText(hwnd,temporary,MAX_PATH);
125
126 int i=0;
127 while(temporary[i]==' ') i++;
128
129 char temp2[MAX_PATH];
130 strncpy(temp2,temporary+i,MAX_PATH);
131
132 i=lstrlen(temp2);
133 while(i>0){
134 if(temp2[i-1]==' ') i--;
135 else break;
136 }
137 temp2[i]=0;
138
139 //EUCに変換
140 nkf.pSetNkfOption("-wx");
141 nkf.pNkfConvert(buffer,temp2);
142
143 //URLエンコード
144 URLEncode(buffer);
145
146
147 if(bProfessional){
148 //Pro版は埋め込み型で表示
149 lstrcpy(temporary,"http://www.activebasic.com/application_search.php?query=");
150 lstrcat(temporary,buffer);
151 lstrcat(temporary,"&type=web&utf_sw=1");
152
153 pobj_SideWeb->GoPage(temporary);
154 }
155 else{
156 //Standard版は外部リンクとして表示
157 lstrcpy(temporary,"http://www.activebasic.com/search.php?query=");
158 lstrcat(temporary,buffer);
159 lstrcat(temporary,"&type=web&utf_sw=1");
160
161 ShellExecute(hwnd,"open","iexplore.exe",temporary,NULL,SW_SHOWNORMAL);
162 }
163
164
165 AddFindData(GetParent(hwnd),pobj_nv->WebStr,temp2);
166
167 HeapDefaultFree(buffer);
168 HeapDefaultFree(temporary);
169 }
170 break;
171 }
172 return CallWindowProc(OldWebSearchEditProc,hwnd,message,wParam,lParam);
173}
174
175
176
177/*----- 以下はRebarの初期生成 -----*/
178
179//ドキュメント選択コンボボックスをレバーに追加
180HWND AddDocCombo(HWND hRebar,int num,char *lpszText){
181 extern HINSTANCE hInst;
182 extern HWND hDocCombo,hClient;
183 extern WNDPROC OldDocComboProc;
184 extern HFONT hStatusFont;
185 extern MDIINFO MdiInfo[MAX_WNDNUM];
186 int i,i2;
187 HWND hTempWnd;
188 char buffer[MAX_PATH];
189
190 //コンボボックスを生成
191 hDocCombo=CreateWindow("COMBOBOX",NULL,
192 WS_CHILD|WS_VSCROLL|WS_VISIBLE|CBS_DROPDOWNLIST|CBS_DROPDOWN|CBS_HASSTRINGS|CBS_SORT,
193 0,0,0,120,hRebar,NULL,hInst,NULL);
194
195 //サブクラス化
196 OldDocComboProc=(WNDPROC)GetWindowLong(hDocCombo,GWL_WNDPROC);
197 SetWindowLong(hDocCombo,GWL_WNDPROC,(long)DocComboProc);
198
199 //フォントを設定
200 SendMessage(hDocCombo,WM_SETFONT,(unsigned int)hStatusFont,0);
201
202 hTempWnd=GetWindow(hClient,GW_CHILD);
203 if(IsWindow(hTempWnd)){
204 for(i=0,i2=0;i<MAX_WNDNUM;i++){
205 if(MdiInfo[i].hwnd){
206 GetWindowText(MdiInfo[i].hwnd,buffer,MAX_PATH);
207 if(MdiInfo[i].hwnd==hTempWnd) i2=SendMessage(hDocCombo,CB_ADDSTRING,0,(long)buffer);
208 else SendMessage(hDocCombo,CB_ADDSTRING,0,(long)buffer);
209 }
210 }
211 SendMessage(hDocCombo,CB_SETCURSEL,i2,0);
212 }
213
214 lstrcpy(lpszText,"File:");
215 return hDocCombo;
216}
217
218//ファイル管理ツールバーをレバーに追加
219HWND AddStandardToolbar(HWND hRebar,int num,char *lpszText){
220 extern HWND hStandardToolbarPager;
221
222 //ページャーウィンドウを生成
223 hStandardToolbarPager=CreateWindow(WC_PAGESCROLLER,NULL,
224 WS_CHILD|WS_VISIBLE|PGS_HORZ,
225 0,0,0,0,
226 hRebar,NULL,hInst,NULL);
227
228
229 //LuxToolbarオブジェクトを生成
230 if(pobj_StandardToolbar) pobj_StandardToolbar->Release();
231 pobj_StandardToolbar=LuxToolbar_CreateInstance();
232 pobj_StandardToolbar->Create(hStandardToolbarPager);
233
234
235#define ADD_TOOLBAR_BUTTON(id,iconID,lpszToolTip) pobj_StandardToolbar->Add(id,(HICON)LoadImage(hIconResInst,MAKEINTRESOURCE(iconID),IMAGE_ICON,16,16,0),lpszToolTip)
236#define ADD_TOOLBAR_SEPARATOR pobj_StandardToolbar->Add(0,0,0)
237 //ボタン類を追加
238 ADD_TOOLBAR_BUTTON(IDM_NEW,IDI_NEW,"新規作成(Ctrl+N)");
239 ADD_TOOLBAR_SEPARATOR;
240 ADD_TOOLBAR_BUTTON(IDM_OPEN,IDI_OPEN,"開く(Ctrl+O)");
241 ADD_TOOLBAR_BUTTON(IDM_SAVE,IDI_SAVE,"保存(Ctrl+S)");
242 ADD_TOOLBAR_BUTTON(IDM_ALLSAVE,IDI_ALLSAVE,"すべて保存");
243 ADD_TOOLBAR_SEPARATOR;
244 ADD_TOOLBAR_BUTTON(IDM_CUT,IDI_CUT,"切り取り(Ctrl+X)");
245 ADD_TOOLBAR_BUTTON(IDM_COPY,IDI_COPY,"コピー(Ctrl+C)");
246 ADD_TOOLBAR_BUTTON(IDM_PASTE,IDI_PASTE,"貼り付け(Ctrl+V)");
247 ADD_TOOLBAR_SEPARATOR;
248 ADD_TOOLBAR_BUTTON(IDM_UNDO,IDI_UNDO,"元に戻す(Ctrl+Z)");
249 ADD_TOOLBAR_BUTTON(IDM_REDO,IDI_REDO,"やり直し(Ctrl+Y)");
250 ADD_TOOLBAR_SEPARATOR;
251 ADD_TOOLBAR_BUTTON(IDM_FIND,IDI_FIND,"検索(Ctrl+F)");
252#undef ADD_TOOLBAR_SEPARATOR
253#undef ADD_TOOLBAR_BUTTON
254
255
256 //ページャー設定
257 Pager_SetChild(hStandardToolbarPager,pobj_StandardToolbar->GetHandle());
258
259
260 //サブクラス化
261 extern WNDPROC OldStandardToolbarProc;
262 OldStandardToolbarProc=(WNDPROC)GetWindowLong(pobj_StandardToolbar->GetHandle(),GWL_WNDPROC);
263 SetWindowLong(pobj_StandardToolbar->GetHandle(),GWL_WNDPROC,(long)StandardToolbarProc);
264
265 lpszText[0]=0;
266 return hStandardToolbarPager;
267}
268
269//デバッガツールバーをレバーに追加
270HWND AddDebuggerToolbar(HWND hRebar,int num,char *lpszText){
271#ifndef THETEXT
272
273 extern HWND hDebuggerToolbarPager;
274
275 hDebuggerToolbarPager=CreateWindow(WC_PAGESCROLLER,NULL,
276 WS_CHILD|WS_VISIBLE|PGS_HORZ,
277 0,0,0,0,
278 hRebar,NULL,hInst,NULL);
279
280 //LuxToolbarオブジェクトを生成
281 if(pobj_DebuggerToolbar) pobj_DebuggerToolbar->Release();
282 pobj_DebuggerToolbar=LuxToolbar_CreateInstance();
283 pobj_DebuggerToolbar->Create(hDebuggerToolbarPager);
284
285#define ADD_TOOLBAR_BUTTON(id,iconID,lpszToolTip) pobj_DebuggerToolbar->Add(id,(HICON)LoadImage(hIconResInst,MAKEINTRESOURCE(iconID),IMAGE_ICON,16,16,0),lpszToolTip)
286#define ADD_TOOLBAR_SEPARATOR pobj_DebuggerToolbar->Add(0,0,0)
287 //ボタン類を追加
288 ADD_TOOLBAR_BUTTON(IDM_DEBUGCOMPILE,IDI_DEBUGCOMPILE,"デバッグ コンパイル");
289 ADD_TOOLBAR_SEPARATOR;
290 ADD_TOOLBAR_BUTTON(IDM_DEBUG,IDI_DEBUGRUN,"デバッグ実行(F8)");
291 ADD_TOOLBAR_BUTTON(IDM_DEBUG_PAUSE,IDI_DEBUGPAUSE,"デバッグを一時停止");
292 ADD_TOOLBAR_BUTTON(IDM_DEBUG_STOP,IDI_DEBUGSTOP,"デバッグを中断");
293 ADD_TOOLBAR_SEPARATOR;
294 ADD_TOOLBAR_BUTTON(IDM_STEP_IN,IDI_STEPIN,"ステップ イン(F10)");
295 ADD_TOOLBAR_BUTTON(IDM_STEP_OVER,IDI_STEPOVER,"ステップ オーバー(F11)");
296 ADD_TOOLBAR_BUTTON(IDM_STEP_CURSOR,IDI_STEPTOCURSOR,"カーソル行まで実行(Ctrl+F11)");
297 ADD_TOOLBAR_SEPARATOR;
298 ADD_TOOLBAR_BUTTON(IDM_BREAKPOINT,IDI_BREAKPOINT,"ブレークポイントの設置/解除(F9)");
299#undef ADD_TOOLBAR_SEPARATOR
300#undef ADD_TOOLBAR_BUTTON
301
302 //ページャー設定
303 Pager_SetChild(hDebuggerToolbarPager,pobj_DebuggerToolbar->GetHandle());
304
305 //サブクラス化
306 extern WNDPROC OldStandardToolbarProc;
307 OldStandardToolbarProc=(WNDPROC)GetWindowLong(pobj_DebuggerToolbar->GetHandle(),GWL_WNDPROC);
308 SetWindowLong(pobj_DebuggerToolbar->GetHandle(),GWL_WNDPROC,(long)StandardToolbarProc);
309
310 lpszText[0]=0;
311 return hDebuggerToolbarPager;
312#else //THETEXT
313 return 0;
314#endif //THETEXT
315}
316
317//リリースツールバーをレバーに追加
318HWND AddReleaseToolbar(HWND hRebar,int num,char *lpszText){
319#ifndef THETEXT
320
321 extern HWND hReleaseToolbarPager;
322
323 hReleaseToolbarPager=CreateWindow(WC_PAGESCROLLER,NULL,
324 WS_CHILD|WS_VISIBLE|PGS_HORZ,
325 0,0,0,0,
326 hRebar,NULL,hInst,NULL);
327
328 //LuxToolbarオブジェクトを生成
329 if(pobj_ReleaseToolbar) pobj_ReleaseToolbar->Release();
330 pobj_ReleaseToolbar=LuxToolbar_CreateInstance();
331 pobj_ReleaseToolbar->Create(hReleaseToolbarPager);
332
333#define ADD_TOOLBAR_BUTTON(id,iconID,lpszToolTip) pobj_ReleaseToolbar->Add(id,(HICON)LoadImage(hIconResInst,MAKEINTRESOURCE(iconID),IMAGE_ICON,16,16,0),lpszToolTip)
334#define ADD_TOOLBAR_SEPARATOR pobj_ReleaseToolbar->Add(0,0,0)
335 //ボタン類を追加
336 ADD_TOOLBAR_BUTTON(IDM_RELEASECOMPILE,IDI_RELEASECOMPILE,"リリース コンパイル(F6)");
337 ADD_TOOLBAR_BUTTON(IDM_RELEASERUN,IDI_RELEASERUN,"実行");
338#undef ADD_TOOLBAR_SEPARATOR
339#undef ADD_TOOLBAR_BUTTON
340
341 //ページャー設定
342 Pager_SetChild(hReleaseToolbarPager,pobj_ReleaseToolbar->GetHandle());
343
344 //サブクラス化
345 extern WNDPROC OldStandardToolbarProc;
346 OldStandardToolbarProc=(WNDPROC)GetWindowLong(pobj_ReleaseToolbar->GetHandle(),GWL_WNDPROC);
347 SetWindowLong(pobj_ReleaseToolbar->GetHandle(),GWL_WNDPROC,(long)StandardToolbarProc);
348
349 lpszText[0]=0;
350 return hReleaseToolbarPager;
351#else //THETEXT
352 return 0;
353#endif //THETEXT
354}
355
356//コンパイラ選択コンボボックスをレバーに追加
357HWND AddBand_SelectCompiler(HWND hRebar,int num,char *lpszText){
358
359 //コンボボックスを生成
360 extern HINSTANCE hInst;
361 extern HWND hSelectCompilerCombo;
362 hSelectCompilerCombo=CreateWindow("COMBOBOX",NULL,
363 WS_CHILD|WS_VSCROLL|WS_VISIBLE|CBS_DROPDOWNLIST|CBS_DROPDOWN|CBS_HASSTRINGS|CBS_SORT,
364 0,0,0,120,hRebar,NULL,hInst,NULL);
365
366 //サブクラス化
367 extern WNDPROC OldSelectCompilerComboProc;
368 OldSelectCompilerComboProc=(WNDPROC)GetWindowLong(hSelectCompilerCombo,GWL_WNDPROC);
369 SetWindowLong(hSelectCompilerCombo,GWL_WNDPROC,(long)SelectCompilerComboProc);
370
371 //フォントを設定
372 extern HFONT hStatusFont;
373 SendMessage(hSelectCompilerCombo,WM_SETFONT,(WPARAM)hStatusFont,0);
374
375 //コンボボックスに文字列を挿入
376 SendMessage(hSelectCompilerCombo,CB_ADDSTRING,0,(long)"Win32");
377 if(IsWow64()) SendMessage(hSelectCompilerCombo,CB_ADDSTRING,0,(long)"Win64");
378
379 //Win32を選択
380 SendMessage(hSelectCompilerCombo,CB_SETCURSEL,0,0);
381
382 lpszText[0]=0;
383 return hSelectCompilerCombo;
384}
385
386HWND AddBand_WebSearch(HWND hRebar,int num,char *lpszText){
387 //コンボボックスを生成
388 extern HINSTANCE hInst;
389 extern HWND hWebSearchCombo;
390 hWebSearchCombo=CreateWindow("COMBOBOX",NULL,
391 WS_CHILD|WS_VSCROLL|WS_VISIBLE|CBS_DROPDOWN|CBS_HASSTRINGS|CBS_AUTOHSCROLL,
392 0,0,0,120,hRebar,NULL,hInst,NULL);
393
394 //サブクラス化
395 extern WNDPROC OldWebSearchProc;
396 OldWebSearchProc=(WNDPROC)GetWindowLong(hWebSearchCombo,GWL_WNDPROC);
397 SetWindowLong(hWebSearchCombo,GWL_WNDPROC,(long)WebSearchProc);
398 extern WNDPROC OldWebSearchEditProc;
399 OldWebSearchEditProc=(WNDPROC)GetWindowLong(GetWindow(hWebSearchCombo,GW_CHILD),GWL_WNDPROC);
400 SetWindowLong(GetWindow(hWebSearchCombo,GW_CHILD),GWL_WNDPROC,(long)WebSearchEditProc);
401
402 //フォントを設定
403 extern HFONT hStatusFont;
404 SendMessage(hWebSearchCombo,WM_SETFONT,(WPARAM)hStatusFont,0);
405
406 lstrcpy(lpszText,"WebSearch(F5):");
407
408
409
410 //Web検索文字列コンボボックスを初期化
411 int i;
412 SendMessage(hWebSearchCombo,CB_RESETCONTENT,0,0);
413 for(i=0;i<MAX_FINDLIST;i++){
414 if(pobj_nv->WebStr[i][0]=='\0') break;
415 SendMessage(hWebSearchCombo,CB_ADDSTRING,0,(long)pobj_nv->WebStr[i]);
416 }
417 SendMessage(hWebSearchCombo,CB_LIMITTEXT,8192,0);
418
419 return hWebSearchCombo;
420}
Note: See TracBrowser for help on using the repository browser.