source: dev/ProjectEditor/ChildWndOnRebar.cpp@ 109

Last change on this file since 109 was 22, checked in by dai_9181, 18 years ago

バックアップ用ディレクトリが消去されていたときは、自動生成する。
プロ版の概念を除去。機能制限を解除。

File size: 12.7 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 //埋め込み型で表示
148 lstrcpy(temporary,"http://www.activebasic.com/application_search.php?query=");
149 lstrcat(temporary,buffer);
150 lstrcat(temporary,"&type=web&utf_sw=1");
151
152 pobj_SideWeb->GoPage(temporary);
153
154
155 AddFindData(GetParent(hwnd),pobj_nv->WebStr,temp2);
156
157 HeapDefaultFree(buffer);
158 HeapDefaultFree(temporary);
159 }
160 break;
161 }
162 return CallWindowProc(OldWebSearchEditProc,hwnd,message,wParam,lParam);
163}
164
165
166
167/*----- 以下はRebarの初期生成 -----*/
168
169//ドキュメント選択コンボボックスをレバーに追加
170HWND AddDocCombo(HWND hRebar,int num,char *lpszText){
171 extern HINSTANCE hInst;
172 extern HWND hDocCombo,hClient;
173 extern WNDPROC OldDocComboProc;
174 extern HFONT hStatusFont;
175 extern MDIINFO MdiInfo[MAX_WNDNUM];
176 int i,i2;
177 HWND hTempWnd;
178 char buffer[MAX_PATH];
179
180 //コンボボックスを生成
181 hDocCombo=CreateWindow("COMBOBOX",NULL,
182 WS_CHILD|WS_VSCROLL|WS_VISIBLE|CBS_DROPDOWNLIST|CBS_DROPDOWN|CBS_HASSTRINGS|CBS_SORT,
183 0,0,0,120,hRebar,NULL,hInst,NULL);
184
185 //サブクラス化
186 OldDocComboProc=(WNDPROC)GetWindowLong(hDocCombo,GWL_WNDPROC);
187 SetWindowLong(hDocCombo,GWL_WNDPROC,(long)DocComboProc);
188
189 //フォントを設定
190 SendMessage(hDocCombo,WM_SETFONT,(unsigned int)hStatusFont,0);
191
192 hTempWnd=GetWindow(hClient,GW_CHILD);
193 if(IsWindow(hTempWnd)){
194 for(i=0,i2=0;i<MAX_WNDNUM;i++){
195 if(MdiInfo[i].hwnd){
196 GetWindowText(MdiInfo[i].hwnd,buffer,MAX_PATH);
197 if(MdiInfo[i].hwnd==hTempWnd) i2=SendMessage(hDocCombo,CB_ADDSTRING,0,(long)buffer);
198 else SendMessage(hDocCombo,CB_ADDSTRING,0,(long)buffer);
199 }
200 }
201 SendMessage(hDocCombo,CB_SETCURSEL,i2,0);
202 }
203
204 lstrcpy(lpszText,"File:");
205 return hDocCombo;
206}
207
208//ファイル管理ツールバーをレバーに追加
209HWND AddStandardToolbar(HWND hRebar,int num,char *lpszText){
210 extern HWND hStandardToolbarPager;
211
212 //ページャーウィンドウを生成
213 hStandardToolbarPager=CreateWindow(WC_PAGESCROLLER,NULL,
214 WS_CHILD|WS_VISIBLE|PGS_HORZ,
215 0,0,0,0,
216 hRebar,NULL,hInst,NULL);
217
218
219 //LuxToolbarオブジェクトを生成
220 if(pobj_StandardToolbar) pobj_StandardToolbar->Release();
221 pobj_StandardToolbar=LuxToolbar_CreateInstance();
222 pobj_StandardToolbar->Create(hStandardToolbarPager);
223
224
225#define ADD_TOOLBAR_BUTTON(id,iconID,lpszToolTip) pobj_StandardToolbar->Add(id,(HICON)LoadImage(hIconResInst,MAKEINTRESOURCE(iconID),IMAGE_ICON,16,16,0),lpszToolTip)
226#define ADD_TOOLBAR_SEPARATOR pobj_StandardToolbar->Add(0,0,0)
227 //ボタン類を追加
228 ADD_TOOLBAR_BUTTON(IDM_NEW,IDI_NEW,"新規作成(Ctrl+N)");
229 ADD_TOOLBAR_SEPARATOR;
230 ADD_TOOLBAR_BUTTON(IDM_OPEN,IDI_OPEN,"開く(Ctrl+O)");
231 ADD_TOOLBAR_BUTTON(IDM_SAVE,IDI_SAVE,"保存(Ctrl+S)");
232 ADD_TOOLBAR_BUTTON(IDM_ALLSAVE,IDI_ALLSAVE,"すべて保存");
233 ADD_TOOLBAR_SEPARATOR;
234 ADD_TOOLBAR_BUTTON(IDM_CUT,IDI_CUT,"切り取り(Ctrl+X)");
235 ADD_TOOLBAR_BUTTON(IDM_COPY,IDI_COPY,"コピー(Ctrl+C)");
236 ADD_TOOLBAR_BUTTON(IDM_PASTE,IDI_PASTE,"貼り付け(Ctrl+V)");
237 ADD_TOOLBAR_SEPARATOR;
238 ADD_TOOLBAR_BUTTON(IDM_UNDO,IDI_UNDO,"元に戻す(Ctrl+Z)");
239 ADD_TOOLBAR_BUTTON(IDM_REDO,IDI_REDO,"やり直し(Ctrl+Y)");
240 ADD_TOOLBAR_SEPARATOR;
241 ADD_TOOLBAR_BUTTON(IDM_FIND,IDI_FIND,"検索(Ctrl+F)");
242#undef ADD_TOOLBAR_SEPARATOR
243#undef ADD_TOOLBAR_BUTTON
244
245
246 //ページャー設定
247 Pager_SetChild(hStandardToolbarPager,pobj_StandardToolbar->GetHandle());
248
249
250 //サブクラス化
251 extern WNDPROC OldStandardToolbarProc;
252 OldStandardToolbarProc=(WNDPROC)GetWindowLong(pobj_StandardToolbar->GetHandle(),GWL_WNDPROC);
253 SetWindowLong(pobj_StandardToolbar->GetHandle(),GWL_WNDPROC,(long)StandardToolbarProc);
254
255 lpszText[0]=0;
256 return hStandardToolbarPager;
257}
258
259//デバッガツールバーをレバーに追加
260HWND AddDebuggerToolbar(HWND hRebar,int num,char *lpszText){
261#ifndef THETEXT
262
263 extern HWND hDebuggerToolbarPager;
264
265 hDebuggerToolbarPager=CreateWindow(WC_PAGESCROLLER,NULL,
266 WS_CHILD|WS_VISIBLE|PGS_HORZ,
267 0,0,0,0,
268 hRebar,NULL,hInst,NULL);
269
270 //LuxToolbarオブジェクトを生成
271 if(pobj_DebuggerToolbar) pobj_DebuggerToolbar->Release();
272 pobj_DebuggerToolbar=LuxToolbar_CreateInstance();
273 pobj_DebuggerToolbar->Create(hDebuggerToolbarPager);
274
275#define ADD_TOOLBAR_BUTTON(id,iconID,lpszToolTip) pobj_DebuggerToolbar->Add(id,(HICON)LoadImage(hIconResInst,MAKEINTRESOURCE(iconID),IMAGE_ICON,16,16,0),lpszToolTip)
276#define ADD_TOOLBAR_SEPARATOR pobj_DebuggerToolbar->Add(0,0,0)
277 //ボタン類を追加
278 ADD_TOOLBAR_BUTTON(IDM_DEBUGCOMPILE,IDI_DEBUGCOMPILE,"デバッグ コンパイル");
279 ADD_TOOLBAR_SEPARATOR;
280 ADD_TOOLBAR_BUTTON(IDM_DEBUG,IDI_DEBUGRUN,"デバッグ実行(F8)");
281 ADD_TOOLBAR_BUTTON(IDM_DEBUG_PAUSE,IDI_DEBUGPAUSE,"デバッグを一時停止");
282 ADD_TOOLBAR_BUTTON(IDM_DEBUG_STOP,IDI_DEBUGSTOP,"デバッグを中断");
283 ADD_TOOLBAR_SEPARATOR;
284 ADD_TOOLBAR_BUTTON(IDM_STEP_IN,IDI_STEPIN,"ステップ イン(F10)");
285 ADD_TOOLBAR_BUTTON(IDM_STEP_OVER,IDI_STEPOVER,"ステップ オーバー(F11)");
286 ADD_TOOLBAR_BUTTON(IDM_STEP_CURSOR,IDI_STEPTOCURSOR,"カーソル行まで実行(Ctrl+F11)");
287 ADD_TOOLBAR_SEPARATOR;
288 ADD_TOOLBAR_BUTTON(IDM_BREAKPOINT,IDI_BREAKPOINT,"ブレークポイントの設置/解除(F9)");
289#undef ADD_TOOLBAR_SEPARATOR
290#undef ADD_TOOLBAR_BUTTON
291
292 //ページャー設定
293 Pager_SetChild(hDebuggerToolbarPager,pobj_DebuggerToolbar->GetHandle());
294
295 //サブクラス化
296 extern WNDPROC OldStandardToolbarProc;
297 OldStandardToolbarProc=(WNDPROC)GetWindowLong(pobj_DebuggerToolbar->GetHandle(),GWL_WNDPROC);
298 SetWindowLong(pobj_DebuggerToolbar->GetHandle(),GWL_WNDPROC,(long)StandardToolbarProc);
299
300 lpszText[0]=0;
301 return hDebuggerToolbarPager;
302#else //THETEXT
303 return 0;
304#endif //THETEXT
305}
306
307//リリースツールバーをレバーに追加
308HWND AddReleaseToolbar(HWND hRebar,int num,char *lpszText){
309#ifndef THETEXT
310
311 extern HWND hReleaseToolbarPager;
312
313 hReleaseToolbarPager=CreateWindow(WC_PAGESCROLLER,NULL,
314 WS_CHILD|WS_VISIBLE|PGS_HORZ,
315 0,0,0,0,
316 hRebar,NULL,hInst,NULL);
317
318 //LuxToolbarオブジェクトを生成
319 if(pobj_ReleaseToolbar) pobj_ReleaseToolbar->Release();
320 pobj_ReleaseToolbar=LuxToolbar_CreateInstance();
321 pobj_ReleaseToolbar->Create(hReleaseToolbarPager);
322
323#define ADD_TOOLBAR_BUTTON(id,iconID,lpszToolTip) pobj_ReleaseToolbar->Add(id,(HICON)LoadImage(hIconResInst,MAKEINTRESOURCE(iconID),IMAGE_ICON,16,16,0),lpszToolTip)
324#define ADD_TOOLBAR_SEPARATOR pobj_ReleaseToolbar->Add(0,0,0)
325 //ボタン類を追加
326 ADD_TOOLBAR_BUTTON(IDM_RELEASECOMPILE,IDI_RELEASECOMPILE,"リリース コンパイル(F6)");
327 ADD_TOOLBAR_BUTTON(IDM_RELEASERUN,IDI_RELEASERUN,"実行");
328#undef ADD_TOOLBAR_SEPARATOR
329#undef ADD_TOOLBAR_BUTTON
330
331 //ページャー設定
332 Pager_SetChild(hReleaseToolbarPager,pobj_ReleaseToolbar->GetHandle());
333
334 //サブクラス化
335 extern WNDPROC OldStandardToolbarProc;
336 OldStandardToolbarProc=(WNDPROC)GetWindowLong(pobj_ReleaseToolbar->GetHandle(),GWL_WNDPROC);
337 SetWindowLong(pobj_ReleaseToolbar->GetHandle(),GWL_WNDPROC,(long)StandardToolbarProc);
338
339 lpszText[0]=0;
340 return hReleaseToolbarPager;
341#else //THETEXT
342 return 0;
343#endif //THETEXT
344}
345
346//コンパイラ選択コンボボックスをレバーに追加
347HWND AddBand_SelectCompiler(HWND hRebar,int num,char *lpszText){
348
349 //コンボボックスを生成
350 extern HINSTANCE hInst;
351 extern HWND hSelectCompilerCombo;
352 hSelectCompilerCombo=CreateWindow("COMBOBOX",NULL,
353 WS_CHILD|WS_VSCROLL|WS_VISIBLE|CBS_DROPDOWNLIST|CBS_DROPDOWN|CBS_HASSTRINGS|CBS_SORT,
354 0,0,0,120,hRebar,NULL,hInst,NULL);
355
356 //サブクラス化
357 extern WNDPROC OldSelectCompilerComboProc;
358 OldSelectCompilerComboProc=(WNDPROC)GetWindowLong(hSelectCompilerCombo,GWL_WNDPROC);
359 SetWindowLong(hSelectCompilerCombo,GWL_WNDPROC,(long)SelectCompilerComboProc);
360
361 //フォントを設定
362 extern HFONT hStatusFont;
363 SendMessage(hSelectCompilerCombo,WM_SETFONT,(WPARAM)hStatusFont,0);
364
365 //コンボボックスに文字列を挿入
366 SendMessage(hSelectCompilerCombo,CB_ADDSTRING,0,(long)"Win32");
367 if(IsWow64()) SendMessage(hSelectCompilerCombo,CB_ADDSTRING,0,(long)"Win64");
368
369 //Win32を選択
370 SendMessage(hSelectCompilerCombo,CB_SETCURSEL,0,0);
371
372 lpszText[0]=0;
373 return hSelectCompilerCombo;
374}
375
376HWND AddBand_WebSearch(HWND hRebar,int num,char *lpszText){
377 //コンボボックスを生成
378 extern HINSTANCE hInst;
379 extern HWND hWebSearchCombo;
380 hWebSearchCombo=CreateWindow("COMBOBOX",NULL,
381 WS_CHILD|WS_VSCROLL|WS_VISIBLE|CBS_DROPDOWN|CBS_HASSTRINGS|CBS_AUTOHSCROLL,
382 0,0,0,120,hRebar,NULL,hInst,NULL);
383
384 //サブクラス化
385 extern WNDPROC OldWebSearchProc;
386 OldWebSearchProc=(WNDPROC)GetWindowLong(hWebSearchCombo,GWL_WNDPROC);
387 SetWindowLong(hWebSearchCombo,GWL_WNDPROC,(long)WebSearchProc);
388 extern WNDPROC OldWebSearchEditProc;
389 OldWebSearchEditProc=(WNDPROC)GetWindowLong(GetWindow(hWebSearchCombo,GW_CHILD),GWL_WNDPROC);
390 SetWindowLong(GetWindow(hWebSearchCombo,GW_CHILD),GWL_WNDPROC,(long)WebSearchEditProc);
391
392 //フォントを設定
393 extern HFONT hStatusFont;
394 SendMessage(hWebSearchCombo,WM_SETFONT,(WPARAM)hStatusFont,0);
395
396 lstrcpy(lpszText,"WebSearch(F5):");
397
398
399
400 //Web検索文字列コンボボックスを初期化
401 int i;
402 SendMessage(hWebSearchCombo,CB_RESETCONTENT,0,0);
403 for(i=0;i<MAX_FINDLIST;i++){
404 if(pobj_nv->WebStr[i][0]=='\0') break;
405 SendMessage(hWebSearchCombo,CB_ADDSTRING,0,(long)pobj_nv->WebStr[i]);
406 }
407 SendMessage(hWebSearchCombo,CB_LIMITTEXT,8192,0);
408
409 return hWebSearchCombo;
410}
Note: See TracBrowser for help on using the repository browser.