1 | #include "stdafx.h" |
---|
2 | |
---|
3 | using namespace ActiveBasic::IDE; |
---|
4 | using namespace ActiveBasic::IDE::WindowComponents; |
---|
5 | |
---|
6 | LRESULT CALLBACK WindowFunc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam); |
---|
7 | void SetupWindow(HWND hwnd); |
---|
8 | void ResetTextEditFont(HWND hwnd); |
---|
9 | |
---|
10 | void MainFrame::OpenWebBrowser( const std::string &url ) |
---|
11 | { |
---|
12 | ShellExecute(m_hWnd,"open",url.c_str(),"",NULL,SW_SHOWNORMAL); |
---|
13 | } |
---|
14 | |
---|
15 | void MainFrame::OpenExplorer( const std::string &path ) |
---|
16 | { |
---|
17 | ShellExecute(m_hWnd,"explore",path.c_str(),NULL,NULL,SW_SHOWNORMAL); |
---|
18 | } |
---|
19 | |
---|
20 | ::LRESULT MainFrame::OnCreate( ::UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled ) |
---|
21 | { |
---|
22 | // ウィンドウエリアマネージャに親ウィンドウを登録 |
---|
23 | wam.SetParentWnd( m_hWnd ); |
---|
24 | |
---|
25 | RECT rect; |
---|
26 | GetClientRect( &rect ); |
---|
27 | |
---|
28 | // MDIベースを作成 |
---|
29 | mdiWindow = new MdiWindow(); |
---|
30 | mdiWindow->Create( |
---|
31 | m_hWnd, |
---|
32 | rect, |
---|
33 | NULL, |
---|
34 | WS_CHILD |
---|
35 | ); |
---|
36 | wam.AddMdiWindow( mdiWindow ); |
---|
37 | |
---|
38 | |
---|
39 | |
---|
40 | |
---|
41 | |
---|
42 | extern HWND hOwner; |
---|
43 | hOwner = m_hWnd; |
---|
44 | extern WNDPROC oldMainFrameWndProc; |
---|
45 | oldMainFrameWndProc = (WNDPROC)::GetWindowLong( hOwner, GWL_WNDPROC ); |
---|
46 | ::SetWindowLong( hOwner, GWL_WNDPROC, (LONG)WindowFunc ); |
---|
47 | |
---|
48 | SetupWindow(hOwner); |
---|
49 | |
---|
50 | //テキストエディタフォント設定 |
---|
51 | ResetTextEditFont(hOwner); |
---|
52 | |
---|
53 | |
---|
54 | |
---|
55 | return 0; |
---|
56 | } |
---|
57 | |
---|
58 | void MainFrame::OnSize(UINT nType, CSize size) |
---|
59 | { |
---|
60 | //mdiWindow->MoveWindow( 0, 0, size.cx, size.cy ); |
---|
61 | } |
---|
62 | |
---|
63 | BOOL MainFrame::OnQueryEndSession(UINT nSource, UINT uLogOff) |
---|
64 | { |
---|
65 | OnClose(); |
---|
66 | |
---|
67 | return TRUE; |
---|
68 | } |
---|
69 | |
---|
70 | void MainFrame::OnClose() |
---|
71 | { |
---|
72 | extern BOOL bSearchingClasses; |
---|
73 | if(bSearchingClasses){ |
---|
74 | pobj_ClassTreeView->bCloseSwitch=1; |
---|
75 | return; |
---|
76 | } |
---|
77 | |
---|
78 | //コンパイラビューを閉じる |
---|
79 | extern HWND hCompileView; |
---|
80 | if( hCompileView && ::IsWindow( hCompileView ) ) |
---|
81 | { |
---|
82 | SendMessage(hCompileView,WM_COMMAND,IDCANCEL,0); |
---|
83 | } |
---|
84 | |
---|
85 | //次回起動時にMDIウィンドウを最大化させるかを判定 |
---|
86 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
87 | pobj_nv->bMDIZoomed=::IsZoomed(hChild); |
---|
88 | |
---|
89 | //プロジェクトを閉じる |
---|
90 | if( projectInfo.IsOpened() ){ |
---|
91 | if(!projectInfo.Close()) return; |
---|
92 | } |
---|
93 | |
---|
94 | //MDIウィンドウの保存確認 |
---|
95 | hChild=::GetWindow(hClient,GW_CHILD); |
---|
96 | while(hChild){ |
---|
97 | if(!DocumentModifyCheck(hChild)) return; |
---|
98 | hChild=::GetNextWindow(hChild,GW_HWNDNEXT); |
---|
99 | } |
---|
100 | |
---|
101 | |
---|
102 | KillTimer(ID_TIMER_BACKUP); |
---|
103 | |
---|
104 | |
---|
105 | //ProjectViewの位置を保存、ProjectViewを破棄 |
---|
106 | extern HWND hProjectView; |
---|
107 | extern HWND hProjectView_ToolWindow; |
---|
108 | ::GetWindowRect(hProjectView_ToolWindow,&pobj_nv->rectProjectView); |
---|
109 | ::DestroyWindow(hProjectView); |
---|
110 | ::DestroyWindow(hProjectView_ToolWindow); |
---|
111 | |
---|
112 | //Rebarの位置を保存、Rebarを破棄 |
---|
113 | delete pobj_Rebar; |
---|
114 | pobj_Rebar=0; |
---|
115 | |
---|
116 | //タブコントロールを破棄 |
---|
117 | delete pobj_MainTab; |
---|
118 | pobj_MainTab=0; |
---|
119 | |
---|
120 | //SideWebを破棄 |
---|
121 | delete pobj_SideWeb; |
---|
122 | pobj_SideWeb=0; |
---|
123 | |
---|
124 | //メインウィンドウの最大化有無、座標を保存 |
---|
125 | if(IsZoomed()) pobj_nv->bWindowMax=1; |
---|
126 | else if(!IsIconic()){ |
---|
127 | pobj_nv->bWindowMax=0; |
---|
128 | GetWindowRect(&pobj_nv->StartupWindowRect); |
---|
129 | } |
---|
130 | |
---|
131 | hChild=::GetWindow(hClient,GW_CHILD); |
---|
132 | while(hChild){ |
---|
133 | CloseDocWindow(GetWndNum(hChild)); |
---|
134 | ::DestroyWindow(hChild); |
---|
135 | hChild=::GetWindow(hClient,GW_CHILD); |
---|
136 | } |
---|
137 | |
---|
138 | EndProjectEditor(); //ProjectEditorの情報を保存 |
---|
139 | |
---|
140 | //エディタ用フォントを破棄 |
---|
141 | extern HFONT hFont_TextEdit,hFont_HyperLink_TextEdit; |
---|
142 | if(hFont_TextEdit) DeleteObject(hFont_TextEdit); |
---|
143 | if(hFont_HyperLink_TextEdit) DeleteObject(hFont_HyperLink_TextEdit); |
---|
144 | |
---|
145 | DestroyWindow(); |
---|
146 | } |
---|
147 | void MainFrame::OnDestroy() |
---|
148 | { |
---|
149 | mdiWindow->DestroyWindow(); |
---|
150 | delete mdiWindow; |
---|
151 | |
---|
152 | ::PostQuitMessage( 0 ); |
---|
153 | } |
---|
154 | |
---|
155 | void backup(void *dummy); |
---|
156 | void MainFrame::OnTimer( UINT_PTR id ) |
---|
157 | { |
---|
158 | switch( id ) |
---|
159 | { |
---|
160 | case ID_TIMER_BACKUP: |
---|
161 | _beginthread( backup, 0, 0 ); |
---|
162 | break; |
---|
163 | |
---|
164 | #ifndef THETEXT |
---|
165 | case ID_DEBUGSAFTY: |
---|
166 | { |
---|
167 | //BasicCompiler.exeが強制終了しているかどうかを検証 |
---|
168 | extern CDebugger *pobj_Debugger; |
---|
169 | pobj_Debugger->SaftyCheck(); |
---|
170 | break; |
---|
171 | } |
---|
172 | #endif |
---|
173 | } |
---|
174 | } |
---|
175 | |
---|
176 | void ResetState_EditMenu(void); |
---|
177 | void MainFrame::OnDrawClipboard() |
---|
178 | { |
---|
179 | ResetState_EditMenu(); |
---|
180 | } |
---|
181 | |
---|
182 | void MenuAdvice(WPARAM msg); |
---|
183 | void MainFrame::OnMenuSelect( UINT nItemID, UINT nFlags, HMENU menu ) |
---|
184 | { |
---|
185 | MenuAdvice( nItemID ); |
---|
186 | } |
---|
187 | |
---|
188 | void MainFrame::OnInitMenu( HMENU menu ) |
---|
189 | { |
---|
190 | extern CNonVolatile *pobj_nv; |
---|
191 | extern CSubMenuEx *pobj_FileHistoryMenu; |
---|
192 | pobj_nv->pobj_History->ResetFileMenu(pobj_FileHistoryMenu,1); |
---|
193 | #ifndef THETEXT |
---|
194 | extern CSubMenuEx *pobj_ProjectHistoryMenu; |
---|
195 | pobj_nv->pobj_ProjectHistory->ResetFileMenu(pobj_ProjectHistoryMenu,0); |
---|
196 | #endif |
---|
197 | } |
---|
198 | |
---|
199 | void MainFrame::OnMeasureItem( int nIDCtl, LPMEASUREITEMSTRUCT lpMI ) |
---|
200 | { |
---|
201 | if(lpMI->CtlType==ODT_MENU){ |
---|
202 | SIZE size; |
---|
203 | CMenuItemData *pobj_MenuItemData; |
---|
204 | pobj_MenuItemData=(CMenuItemData *)lpMI->itemData; |
---|
205 | if(pobj_MenuItemData->pobj_ThisMenu->hMenu==pobj_MainMenu->hMenu){ |
---|
206 | //メインメニューの親アイテム |
---|
207 | pobj_MainMenu->GetItemSize(pobj_MenuItemData->item_index,&size); |
---|
208 | lpMI->itemWidth = size.cx; |
---|
209 | lpMI->itemHeight = size.cy; |
---|
210 | } |
---|
211 | else{ |
---|
212 | //メインメニューにぶらさがるサブメニュー |
---|
213 | pobj_MenuItemData->pobj_ThisMenu->GetItemSize(pobj_MenuItemData->item_index,&size); |
---|
214 | lpMI->itemWidth = size.cx; |
---|
215 | lpMI->itemHeight = size.cy; |
---|
216 | } |
---|
217 | } |
---|
218 | } |
---|
219 | |
---|
220 | void MainFrame::OnDrawItem( int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct ) |
---|
221 | { |
---|
222 | if(lpDrawItemStruct->CtlType==ODT_MENU){ |
---|
223 | if(!pobj_MainMenu) return; |
---|
224 | |
---|
225 | CMenuItemData *pobj_MenuItemData; |
---|
226 | pobj_MenuItemData=(CMenuItemData *)lpDrawItemStruct->itemData; |
---|
227 | if(pobj_MainMenu->hMenu==pobj_MenuItemData->pobj_ThisMenu->hMenu){ |
---|
228 | //メインメニューの親アイテム |
---|
229 | pobj_MainMenu->OwnerDrawMenu(lpDrawItemStruct->hDC, |
---|
230 | &lpDrawItemStruct->rcItem, |
---|
231 | (lpDrawItemStruct->itemState&ODS_SELECTED)!=0, |
---|
232 | pobj_MenuItemData->item_index); |
---|
233 | } |
---|
234 | else{ |
---|
235 | //メインメニューにぶらさがるサブメニュー |
---|
236 | pobj_MainMenu->OwnerDrawSubMenu(pobj_MenuItemData->pobj_ThisMenu->hMenu, |
---|
237 | lpDrawItemStruct->hDC, |
---|
238 | &lpDrawItemStruct->rcItem, |
---|
239 | (lpDrawItemStruct->itemState&ODS_SELECTED)!=0, |
---|
240 | pobj_MenuItemData->item_index); |
---|
241 | } |
---|
242 | } |
---|
243 | } |
---|
244 | |
---|
245 | LRESULT MainFrame::OnNotify( int idCtrl, LPNMHDR pnmh ) |
---|
246 | { |
---|
247 | NMPGCALCSIZE *lpCalcSize; |
---|
248 | NMPGSCROLL *lpScroll; |
---|
249 | |
---|
250 | if(!pnmh) return 0; |
---|
251 | LPTOOLTIPTEXT TipText=(LPTOOLTIPTEXT)pnmh; |
---|
252 | if(TipText->hdr.code==TTN_NEEDTEXT) ShowToolTipText(TipText); |
---|
253 | |
---|
254 | extern HWND hStandardToolbarPager; |
---|
255 | extern HWND hDebuggerToolbarPager; |
---|
256 | if(pobj_Rebar){ |
---|
257 | //レバーオブジェクトが存在するとき |
---|
258 | if(pnmh->hwndFrom==pobj_Rebar->hRebar&&pnmh->code==RBN_HEIGHTCHANGE){ |
---|
259 | ResizeOwnerWnd(); |
---|
260 | return 0; |
---|
261 | } |
---|
262 | } |
---|
263 | if(pnmh->hwndFrom==hStandardToolbarPager){ |
---|
264 | if(pnmh->code==PGN_CALCSIZE){ |
---|
265 | lpCalcSize=(LPNMPGCALCSIZE)pnmh; |
---|
266 | if(lpCalcSize->dwFlag==PGF_CALCWIDTH) |
---|
267 | lpCalcSize->iWidth=BMPNUM_STANDARDTOOLBAR*23+SEPNUM_STANDARDTOOLBAR*8; |
---|
268 | } |
---|
269 | else if(pnmh->code==PGN_SCROLL){ |
---|
270 | lpScroll=(LPNMPGSCROLL)pnmh; |
---|
271 | lpScroll->iScroll=20; |
---|
272 | } |
---|
273 | } |
---|
274 | else if(pnmh->hwndFrom==hDebuggerToolbarPager){ |
---|
275 | if(pnmh->code==PGN_CALCSIZE){ |
---|
276 | lpCalcSize=(LPNMPGCALCSIZE)pnmh; |
---|
277 | if(lpCalcSize->dwFlag==PGF_CALCWIDTH) |
---|
278 | lpCalcSize->iWidth=BMPNUM_DEBUGGERTOOLBAR*23+SEPNUM_DEBUGGERTOOLBAR*8; |
---|
279 | } |
---|
280 | else if(pnmh->code==PGN_SCROLL){ |
---|
281 | lpScroll=(LPNMPGSCROLL)pnmh; |
---|
282 | lpScroll->iScroll=20; |
---|
283 | } |
---|
284 | } |
---|
285 | |
---|
286 | if(pobj_MainTab){ |
---|
287 | if(pnmh->hwndFrom==pobj_MainTab->hTab){ |
---|
288 | if(pnmh->code==TCN_SELCHANGE) |
---|
289 | pobj_MainTab->SelChangeEvent(); |
---|
290 | |
---|
291 | if(pnmh->code==NM_RCLICK){ |
---|
292 | |
---|
293 | TCHITTESTINFO tcHitTest; |
---|
294 | GetCursorPos(&tcHitTest.pt); |
---|
295 | ::ScreenToClient(pobj_MainTab->hTab,&tcHitTest.pt); |
---|
296 | int index = TabCtrl_HitTest(pobj_MainTab->hTab,&tcHitTest); |
---|
297 | if( index == -1 ) return 0; |
---|
298 | |
---|
299 | TabCtrl_SetCurSel(pobj_MainTab->hTab,index); |
---|
300 | |
---|
301 | pobj_MainTab->SelChangeEvent(); |
---|
302 | |
---|
303 | |
---|
304 | ///////////////////// |
---|
305 | // メニューを表示 |
---|
306 | ///////////////////// |
---|
307 | |
---|
308 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
309 | int WndNum=GetWndNum(hChild); |
---|
310 | |
---|
311 | //保存コマンドの文字列をセット |
---|
312 | char temporary[1024], temp2[1024]; |
---|
313 | MENUITEMINFO mii; |
---|
314 | mii.cbSize=sizeof(MENUITEMINFO); |
---|
315 | mii.fMask=MIIM_TYPE; |
---|
316 | mii.dwTypeData=temporary; |
---|
317 | mii.fType=MFT_STRING; |
---|
318 | if(MdiInfo[WndNum].path[0]){ |
---|
319 | _splitpath(MdiInfo[WndNum].path,NULL,NULL,temporary,temp2); |
---|
320 | lstrcat(temporary,temp2); |
---|
321 | lstrcat(temporary," を保存(&S)"); |
---|
322 | } |
---|
323 | else{ |
---|
324 | lstrcpy(temporary,"保存(&S)"); |
---|
325 | } |
---|
326 | extern HMENU hTabMenu; |
---|
327 | SetMenuItemInfo(hTabMenu,IDM_SAVE,FALSE,&mii); |
---|
328 | |
---|
329 | /*「絶対パスをコピー」「フォルダを開く」「ファイルを削除」 |
---|
330 | コマンドを場合によって無効化にする */ |
---|
331 | if(MdiInfo[WndNum].path[0]){ |
---|
332 | EnableMenuItem(hTabMenu,IDM_PATH_COPY,MF_BYCOMMAND|MF_ENABLED); |
---|
333 | EnableMenuItem(hTabMenu,IDM_FOLDER_OPEN,MF_BYCOMMAND|MF_ENABLED); |
---|
334 | EnableMenuItem(hTabMenu,IDM_DELETE_FILE,MF_BYCOMMAND|MF_ENABLED); |
---|
335 | } |
---|
336 | else{ |
---|
337 | EnableMenuItem(hTabMenu,IDM_PATH_COPY,MF_BYCOMMAND|MF_GRAYED); |
---|
338 | EnableMenuItem(hTabMenu,IDM_FOLDER_OPEN,MF_BYCOMMAND|MF_GRAYED); |
---|
339 | EnableMenuItem(hTabMenu,IDM_DELETE_FILE,MF_BYCOMMAND|MF_GRAYED); |
---|
340 | } |
---|
341 | |
---|
342 | POINT MousePos; |
---|
343 | GetCursorPos(&MousePos); |
---|
344 | TrackPopupMenu(hTabMenu,TPM_LEFTALIGN|TPM_RIGHTBUTTON,MousePos.x,MousePos.y,0,hOwner,NULL); |
---|
345 | } |
---|
346 | } |
---|
347 | } |
---|
348 | if(pobj_SideWeb){ |
---|
349 | if(pnmh->hwndFrom==pobj_SideWeb->hTab&&pnmh->code==TCN_SELCHANGE){ |
---|
350 | pobj_SideWeb->SelChangeEvent(); |
---|
351 | } |
---|
352 | } |
---|
353 | |
---|
354 | return 0; |
---|
355 | } |
---|
356 | |
---|
357 | void MainFrame::OnDropFiles( HDROP hDropInfo ) |
---|
358 | { |
---|
359 | int max = DragQueryFile(hDropInfo,-1,0,0); |
---|
360 | for(int i=0;i<max;i++){ |
---|
361 | char temporary[1024]; |
---|
362 | DragQueryFile(hDropInfo,i,temporary,MAX_PATH); |
---|
363 | OpenFileWithExtension(temporary); |
---|
364 | } |
---|
365 | DragFinish(hDropInfo); |
---|
366 | } |
---|
367 | |
---|
368 | ::LRESULT MainFrame::OnShowSourceLine( ::UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled ) |
---|
369 | { |
---|
370 | char temporary[1024]; |
---|
371 | |
---|
372 | //エラー部分を反転表示 |
---|
373 | DWORD AccBytes; |
---|
374 | HANDLE fh; |
---|
375 | sprintf(temporary,"%spgm.tmp",pj_editor_Dir); |
---|
376 | fh=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); |
---|
377 | ReadFile(fh,temporary,MAX_PATH,&AccBytes,NULL); |
---|
378 | CloseHandle(fh); |
---|
379 | temporary[AccBytes]=0; |
---|
380 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
381 | int WndNum = -1; |
---|
382 | while(hChild){ |
---|
383 | WndNum=GetWndNum(hChild); |
---|
384 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){ |
---|
385 | if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0) break; |
---|
386 | } |
---|
387 | hChild=::GetNextWindow(hChild,GW_HWNDNEXT); |
---|
388 | } |
---|
389 | if(!hChild){ |
---|
390 | hChild=OpenFileWithExtension(temporary); |
---|
391 | WndNum=GetWndNum(hChild); |
---|
392 | } |
---|
393 | |
---|
394 | if(WndNum==-1) return 0; |
---|
395 | |
---|
396 | //ウィンドウを最前面に表示 |
---|
397 | ::BringWindowToTop(hChild); |
---|
398 | ::UpdateWindow(hChild); |
---|
399 | |
---|
400 | char *pTemp=MdiInfo[WndNum].pMdiTextEdit->buffer; |
---|
401 | |
---|
402 | //行の先頭インデックスを取得(取得する行の番号はwParamで渡される) |
---|
403 | int i,i2; |
---|
404 | for(i=0,i2=0;;i++){ |
---|
405 | if(i2>=(int)wParam) break; |
---|
406 | if(pTemp[i]=='\0') break; |
---|
407 | if(pTemp[i]=='\r'&&pTemp[i+1]=='\n'){ |
---|
408 | i++; |
---|
409 | i2++; |
---|
410 | } |
---|
411 | } |
---|
412 | POINT pos; |
---|
413 | pos.x=i; |
---|
414 | |
---|
415 | //行の終端インデックスを取得 |
---|
416 | for(;;i++){ |
---|
417 | if(pTemp[i]=='\0') break; |
---|
418 | if(pTemp[i]=='\r'&&pTemp[i+1]=='\n') break; |
---|
419 | } |
---|
420 | pos.y=i; |
---|
421 | |
---|
422 | //行を選択する |
---|
423 | TextEdit_SetSel(WndNum,pos.x,pos.y,TRUE); |
---|
424 | |
---|
425 | return 0; |
---|
426 | } |
---|
427 | |
---|
428 | void MainFrame::OnCmdNew( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
429 | { |
---|
430 | |
---|
431 | #ifdef THETEXT |
---|
432 | NewTextEditWindow(NULL,WNDTYPE_TEXT); |
---|
433 | return; |
---|
434 | #else |
---|
435 | int FileType; |
---|
436 | BOOL bAddToProject; |
---|
437 | char temporary[MAX_PATH]; |
---|
438 | |
---|
439 | FileType=DialogBox(hResInst,MAKEINTRESOURCE(IDD_NEWFILE),hOwner,(DLGPROC)DlgNewFile); |
---|
440 | if(FileType==-1) return; |
---|
441 | |
---|
442 | if(FileType&0x00008000){ |
---|
443 | bAddToProject=1; |
---|
444 | FileType&=0x0FFF; |
---|
445 | extern char NewFileName[MAX_PATH]; |
---|
446 | lstrcpy(temporary,NewFileName); |
---|
447 | if(!strstr(temporary,".")) lstrcat(temporary,".ab"); |
---|
448 | GetFullPath(temporary,projectInfo.dir); |
---|
449 | } |
---|
450 | else bAddToProject=0; |
---|
451 | |
---|
452 | switch(FileType){ |
---|
453 | case FT_BASICPROGRAM: //Basicプログラム |
---|
454 | case FT_SUBPROGRAM: |
---|
455 | if(bAddToProject){ |
---|
456 | WriteBuffer(temporary,0,0); |
---|
457 | NewTextEditWindow(temporary,WNDTYPE_BASIC); |
---|
458 | Project_File_Insert(temporary); |
---|
459 | } |
---|
460 | else NewTextEditWindow(NULL,WNDTYPE_BASIC); |
---|
461 | break; |
---|
462 | |
---|
463 | case FT_PROJECT: |
---|
464 | DlgNewProjectWizard(hOwner); |
---|
465 | break; |
---|
466 | |
---|
467 | case FT_TEXT: |
---|
468 | NewTextEditWindow(NULL,WNDTYPE_TEXT); |
---|
469 | break; |
---|
470 | |
---|
471 | case FT_HTML: |
---|
472 | NewTextEditWindow(NULL,WNDTYPE_HTML); |
---|
473 | break; |
---|
474 | |
---|
475 | case FT_ICON: |
---|
476 | NewIconEditWindow(NULL); |
---|
477 | break; |
---|
478 | } |
---|
479 | #endif |
---|
480 | } |
---|
481 | |
---|
482 | void MainFrame::OnCmdOpen( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
483 | { |
---|
484 | //"ファイルを指定してください" |
---|
485 | extern LPSTR DefFileFilter; |
---|
486 | char temporary[1024]; |
---|
487 | if(!GetFilePathDialog(m_hWnd,temporary,DefFileFilter,STRING_FILEOPENTITLE_DEFAULT,TRUE)) return; |
---|
488 | |
---|
489 | OpenFileWithExtension( temporary ); |
---|
490 | } |
---|
491 | |
---|
492 | void MainFrame::OnCmdClose( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
493 | { |
---|
494 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
495 | if(::IsWindow(hChild)) SendMessage(hChild,WM_CLOSE,0,0); |
---|
496 | } |
---|
497 | |
---|
498 | void MainFrame::OnCmdProjectOpen( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
499 | { |
---|
500 | //"プロジェクト ファイルを指定して下さい" |
---|
501 | extern LPSTR ProjectFileFilter; |
---|
502 | char temporary[1024]; |
---|
503 | if(!GetFilePathDialog(m_hWnd,temporary,ProjectFileFilter,STRING_FILEOPENTITLE_PROJECT,TRUE)) |
---|
504 | { |
---|
505 | return; |
---|
506 | } |
---|
507 | |
---|
508 | projectInfo.Open(temporary); |
---|
509 | } |
---|
510 | |
---|
511 | void MainFrame::OnCmdProjectSave( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
512 | { |
---|
513 | SaveProject(); |
---|
514 | } |
---|
515 | |
---|
516 | void MainFrame::OnCmdProjectClose( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
517 | { |
---|
518 | projectInfo.Close(); |
---|
519 | } |
---|
520 | |
---|
521 | void MainFrame::OnCmdProjectFolderOpen( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
522 | { |
---|
523 | ShellExecute(m_hWnd,"explore",projectInfo.dir,NULL,NULL,SW_SHOWNORMAL); |
---|
524 | } |
---|
525 | |
---|
526 | void MainFrame::OnCmdSave( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
527 | { |
---|
528 | SaveDocument(::GetWindow(hClient,GW_CHILD),NULL); |
---|
529 | } |
---|
530 | |
---|
531 | void MainFrame::OnCmdNewSave( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
532 | { |
---|
533 | //"保存先のファイルを指定してください" |
---|
534 | extern LPSTR DefFileFilter; |
---|
535 | char temporary[1024]; |
---|
536 | if(!GetFilePathDialog(m_hWnd,temporary,DefFileFilter,STRING_FILESAVETITLE_DEFAULT,FALSE)) return; |
---|
537 | |
---|
538 | SaveDocument(::GetWindow(hClient,GW_CHILD),temporary); |
---|
539 | } |
---|
540 | |
---|
541 | void MainFrame::OnCmdCodeSave( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
542 | { |
---|
543 | //文字コードを指定して保存 |
---|
544 | DialogBox(hResInst,MAKEINTRESOURCE(IDD_CODE_SAVE),m_hWnd,(DLGPROC)nkfDlgCodeSave); |
---|
545 | } |
---|
546 | |
---|
547 | void MainFrame::OnCmdAllSave( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
548 | { |
---|
549 | for( int i=0;i<MAX_WNDNUM;i++){ |
---|
550 | if(MdiInfo[i].hwnd) SaveDocument(MdiInfo[i].hwnd,NULL); |
---|
551 | } |
---|
552 | if( projectInfo.IsOpened() ) SaveProject(); |
---|
553 | } |
---|
554 | |
---|
555 | void MainFrame::OnCmdPageSet( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
556 | { |
---|
557 | //ページ設定 |
---|
558 | obj_Page.SetupDlg(); |
---|
559 | } |
---|
560 | |
---|
561 | void MainFrame::OnCmdPreview( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
562 | { |
---|
563 | //プレビュー(Pro版のみ) |
---|
564 | Preview(); |
---|
565 | } |
---|
566 | |
---|
567 | void MainFrame::OnCmdPrintOut( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
568 | { |
---|
569 | //印刷 |
---|
570 | Printout(); |
---|
571 | } |
---|
572 | |
---|
573 | void MainFrame::OnCmdExit( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
574 | { |
---|
575 | SendMessage(WM_CLOSE); |
---|
576 | } |
---|
577 | |
---|
578 | void MainFrame::OnCmdUndo( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
579 | { |
---|
580 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
581 | if(!hChild) return; |
---|
582 | int WndNum=GetWndNum(hChild); |
---|
583 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)) |
---|
584 | TextEdit_UndoCommand(WndNum); |
---|
585 | else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD) |
---|
586 | Rad_UndoCommand(WndNum); |
---|
587 | else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT) |
---|
588 | IconEdit_UndoCommand(WndNum); |
---|
589 | } |
---|
590 | |
---|
591 | void MainFrame::OnCmdRedo( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
592 | { |
---|
593 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
594 | if(!hChild) return; |
---|
595 | int WndNum=GetWndNum(hChild); |
---|
596 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)) |
---|
597 | TextEdit_RedoCommand(WndNum); |
---|
598 | else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD) |
---|
599 | Rad_RedoCommand(WndNum); |
---|
600 | else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT) |
---|
601 | IconEdit_RedoCommand(WndNum); |
---|
602 | } |
---|
603 | |
---|
604 | void MainFrame::OnCmdCut( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
605 | { |
---|
606 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
607 | int WndNum=GetWndNum(hChild); |
---|
608 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){ |
---|
609 | HWND hEdit=::GetWindow(hChild,GW_CHILD); |
---|
610 | |
---|
611 | CHARRANGE CharRange; |
---|
612 | TextEdit_GetSel(WndNum,&CharRange); |
---|
613 | |
---|
614 | HGLOBAL hGlobal=(char *)GlobalAlloc(GMEM_MOVEABLE,CharRange.cpMax-CharRange.cpMin+1); |
---|
615 | char *pTemp=(char *)GlobalLock(hGlobal); |
---|
616 | memcpy(pTemp,MdiInfo[WndNum].pMdiTextEdit->buffer+CharRange.cpMin,CharRange.cpMax-CharRange.cpMin); |
---|
617 | pTemp[CharRange.cpMax-CharRange.cpMin]=0; |
---|
618 | GlobalUnlock(hGlobal); |
---|
619 | |
---|
620 | //クリップボードに保存 |
---|
621 | OpenClipboard(); |
---|
622 | EmptyClipboard(); |
---|
623 | SetClipboardData(CF_TEXT,hGlobal); |
---|
624 | CloseClipboard(); |
---|
625 | |
---|
626 | //選択文字列を消去 |
---|
627 | SendMessage(hEdit,WM_KEYDOWN,VK_DELETE,0); |
---|
628 | } |
---|
629 | else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD){ |
---|
630 | WindowInfo *pWindowInfo = GetWndInfo(MdiInfo[WndNum].path); |
---|
631 | int indexOfWndInfo = GetWndInfoNum(MdiInfo[WndNum].path); |
---|
632 | |
---|
633 | //クリップボードに格納するためのデータを用意する |
---|
634 | pWindowInfo->childWindowInfos[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]]->pos.x-=17; |
---|
635 | pWindowInfo->childWindowInfos[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]]->pos.y-=10; |
---|
636 | HGLOBAL hGlobal=Rad_GetChildInfoClipboardData(WndNum,indexOfWndInfo); |
---|
637 | pWindowInfo->childWindowInfos[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]]->pos.x+=17; |
---|
638 | pWindowInfo->childWindowInfos[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]]->pos.y+=10; |
---|
639 | |
---|
640 | OpenClipboard(); |
---|
641 | EmptyClipboard(); |
---|
642 | extern DWORD dwRadClipboardID; |
---|
643 | SetClipboardData(dwRadClipboardID,hGlobal); |
---|
644 | CloseClipboard(); |
---|
645 | |
---|
646 | SendMessage(MdiInfo[WndNum].MdiRadInfo->hRad,WM_COMMAND,IDM_RAD_ITEM_DELETE,0); |
---|
647 | } |
---|
648 | else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){ |
---|
649 | //クリップボードに格納するためのデータを用意する |
---|
650 | HGLOBAL hGlobal=IconEdit_GetChildInfoClipboardData(WndNum); |
---|
651 | if(hGlobal==0) return; |
---|
652 | |
---|
653 | OpenClipboard(); |
---|
654 | EmptyClipboard(); |
---|
655 | SetClipboardData(CF_BITMAP,hGlobal); |
---|
656 | CloseClipboard(); |
---|
657 | |
---|
658 | DeleteObject(MdiInfo[WndNum].MdiIconEditInfo->hSelectingBmp); |
---|
659 | MdiInfo[WndNum].MdiIconEditInfo->SelectLevel=0; |
---|
660 | |
---|
661 | IconEdit_EraseRect(WndNum,&MdiInfo[WndNum].MdiIconEditInfo->DraggingRect); |
---|
662 | } |
---|
663 | } |
---|
664 | |
---|
665 | void MainFrame::OnCmdCopy( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
666 | { |
---|
667 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
668 | int WndNum=GetWndNum(hChild); |
---|
669 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){ |
---|
670 | HWND hEdit = ::GetWindow(hChild,GW_CHILD); |
---|
671 | |
---|
672 | CHARRANGE CharRange; |
---|
673 | TextEdit_GetSel(WndNum,&CharRange); |
---|
674 | |
---|
675 | HGLOBAL hGlobal=(char *)GlobalAlloc(GMEM_MOVEABLE,CharRange.cpMax-CharRange.cpMin+1); |
---|
676 | char *pTemp=(char *)GlobalLock(hGlobal); |
---|
677 | memcpy(pTemp,MdiInfo[WndNum].pMdiTextEdit->buffer+CharRange.cpMin,CharRange.cpMax-CharRange.cpMin); |
---|
678 | pTemp[CharRange.cpMax-CharRange.cpMin]=0; |
---|
679 | GlobalUnlock(hGlobal); |
---|
680 | |
---|
681 | //クリップボードに保存 |
---|
682 | OpenClipboard(); |
---|
683 | EmptyClipboard(); |
---|
684 | SetClipboardData(CF_TEXT,hGlobal); |
---|
685 | CloseClipboard(); |
---|
686 | } |
---|
687 | else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD){ |
---|
688 | int indexOfWndInfo = GetWndInfoNum(MdiInfo[WndNum].path); |
---|
689 | |
---|
690 | //クリップボードに格納するためのデータを用意する |
---|
691 | HGLOBAL hGlobal=Rad_GetChildInfoClipboardData(WndNum,indexOfWndInfo); |
---|
692 | |
---|
693 | OpenClipboard(); |
---|
694 | EmptyClipboard(); |
---|
695 | extern DWORD dwRadClipboardID; |
---|
696 | SetClipboardData(dwRadClipboardID,hGlobal); |
---|
697 | CloseClipboard(); |
---|
698 | } |
---|
699 | else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){ |
---|
700 | //クリップボードに格納するためのデータを用意する |
---|
701 | HGLOBAL hGlobal=IconEdit_GetChildInfoClipboardData(WndNum); |
---|
702 | |
---|
703 | OpenClipboard(); |
---|
704 | EmptyClipboard(); |
---|
705 | SetClipboardData(CF_BITMAP,hGlobal); |
---|
706 | CloseClipboard(); |
---|
707 | } |
---|
708 | } |
---|
709 | |
---|
710 | void MainFrame::OnCmdPaste( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
711 | { |
---|
712 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
713 | int WndNum=GetWndNum(hChild); |
---|
714 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){ |
---|
715 | HWND hEdit=::GetWindow(hChild,GW_CHILD); |
---|
716 | |
---|
717 | //クリップボードを開く |
---|
718 | OpenClipboard(); |
---|
719 | HGLOBAL hGlobal=GetClipboardData(CF_TEXT); |
---|
720 | if(!hGlobal){ |
---|
721 | CloseClipboard(); |
---|
722 | return; |
---|
723 | } |
---|
724 | |
---|
725 | |
---|
726 | char *pTemp; |
---|
727 | if(pobj_nv->bPasteIndent){ |
---|
728 | //インデント整形 |
---|
729 | pTemp=CodeFormatter((char *)GlobalLock(hGlobal)); |
---|
730 | GlobalUnlock(hGlobal); |
---|
731 | } |
---|
732 | else pTemp=(char *)GlobalLock(hGlobal); |
---|
733 | |
---|
734 | |
---|
735 | //テキストエディタの文字列をリプレイス |
---|
736 | TextEdit_ReplaceUpdateUndoData(WndNum, |
---|
737 | pTemp, |
---|
738 | 1, |
---|
739 | 1); |
---|
740 | |
---|
741 | if(pobj_nv->bPasteIndent) |
---|
742 | HeapDefaultFree(pTemp); |
---|
743 | else |
---|
744 | GlobalUnlock(hGlobal); |
---|
745 | |
---|
746 | //クリップボードを閉じる |
---|
747 | CloseClipboard(); |
---|
748 | |
---|
749 | |
---|
750 | //キャレット位置までスクロールする |
---|
751 | TextEdit_ScrollCaret(WndNum,0); |
---|
752 | ResetCaretPos(WndNum); |
---|
753 | } |
---|
754 | else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD){ |
---|
755 | OpenClipboard(); |
---|
756 | extern DWORD dwRadClipboardID; |
---|
757 | HGLOBAL hGlobal=GetClipboardData(dwRadClipboardID); |
---|
758 | if(!hGlobal){ |
---|
759 | CloseClipboard(); |
---|
760 | return; |
---|
761 | } |
---|
762 | Rad_PasteChildInfoClipboardData(WndNum,hGlobal); |
---|
763 | CloseClipboard(); |
---|
764 | } |
---|
765 | else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){ |
---|
766 | OpenClipboard(); |
---|
767 | HGLOBAL hGlobal=GetClipboardData(CF_BITMAP); |
---|
768 | if(!hGlobal){ |
---|
769 | CloseClipboard(); |
---|
770 | return; |
---|
771 | } |
---|
772 | IconEdit_PasteChildInfoClipboardData(WndNum,(HBITMAP)hGlobal); |
---|
773 | CloseClipboard(); |
---|
774 | } |
---|
775 | } |
---|
776 | |
---|
777 | void MainFrame::OnCmdDelete( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
778 | { |
---|
779 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
780 | int WndNum=GetWndNum(hChild); |
---|
781 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){ |
---|
782 | HWND hEdit=::GetWindow(hChild,GW_CHILD); |
---|
783 | TextEdit_ReplaceUpdateUndoData(WndNum,"",0,1); |
---|
784 | } |
---|
785 | else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD) |
---|
786 | SendMessage(MdiInfo[WndNum].MdiRadInfo->hRad,WM_COMMAND,IDM_RAD_ITEM_DELETE,0); |
---|
787 | } |
---|
788 | |
---|
789 | void MainFrame::OnCmdAllSelect( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
790 | { |
---|
791 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
792 | int WndNum=GetWndNum(hChild); |
---|
793 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){ |
---|
794 | HWND hEdit=::GetWindow(hChild,GW_CHILD); |
---|
795 | |
---|
796 | MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x=0; |
---|
797 | MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y=0; |
---|
798 | |
---|
799 | GetCaretPosFromBufferIndex( |
---|
800 | MdiInfo[WndNum].pMdiTextEdit->buffer, |
---|
801 | lstrlen(MdiInfo[WndNum].pMdiTextEdit->buffer), |
---|
802 | &MdiInfo[WndNum].pMdiTextEdit->EndCaretPos); |
---|
803 | |
---|
804 | ::InvalidateRect(hEdit,NULL,0); |
---|
805 | |
---|
806 | ResetState_EditMenu(); |
---|
807 | } |
---|
808 | else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD){ |
---|
809 | WindowInfo *pWindowInfo = GetWndInfo(MdiInfo[WndNum].path); |
---|
810 | for(int i3=0;i3<pWindowInfo->childWindowInfos.size();i3++){ |
---|
811 | MdiInfo[WndNum].MdiRadInfo->SelectingItem[i3]=i3; |
---|
812 | } |
---|
813 | DrawRadWindow(WndNum,pWindowInfo); |
---|
814 | } |
---|
815 | } |
---|
816 | |
---|
817 | void MainFrame::OnCmdFind( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
818 | { |
---|
819 | DialogBox(hResInst,MAKEINTRESOURCE(IDD_FIND),m_hWnd,(DLGPROC)DlgFind); |
---|
820 | } |
---|
821 | |
---|
822 | void MainFrame::OnCmdPermutation( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
823 | { |
---|
824 | DialogBox(hResInst,MAKEINTRESOURCE(IDD_PERMUTATION),m_hWnd,(DLGPROC)DlgPermutation); |
---|
825 | } |
---|
826 | |
---|
827 | void MainFrame::OnCmdConvertX( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
828 | { |
---|
829 | TextEdit_Convert( nID ); |
---|
830 | } |
---|
831 | |
---|
832 | #ifdef THETEXT |
---|
833 | void MainFrame::OnCmdStringCount( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
834 | { |
---|
835 | DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_STRING_COUNT),m_hWnd,(DLGPROC)DlgStringCount,0); |
---|
836 | } |
---|
837 | |
---|
838 | void MainFrame::OnCmdSelStringCount( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
839 | { |
---|
840 | DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_STRING_COUNT),m_hWnd,(DLGPROC)DlgStringCount,1); |
---|
841 | } |
---|
842 | #endif |
---|
843 | |
---|
844 | void MainFrame::OnCmdProjectView( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
845 | { |
---|
846 | extern HWND hProjectView; |
---|
847 | bool isCheck = false; |
---|
848 | if(pobj_nv->bClipProjectView){ |
---|
849 | if(::IsWindowVisible(hProjectView)){ |
---|
850 | ::ShowWindow(hProjectView,SW_HIDE); |
---|
851 | } |
---|
852 | else{ |
---|
853 | ::ShowWindow(hProjectView,SW_SHOW); |
---|
854 | isCheck = true; |
---|
855 | } |
---|
856 | } |
---|
857 | else{ |
---|
858 | extern HWND hProjectView_ToolWindow; |
---|
859 | if(::IsWindowVisible(hProjectView_ToolWindow)){ |
---|
860 | ::ShowWindow(hProjectView_ToolWindow,SW_HIDE); |
---|
861 | } |
---|
862 | else{ |
---|
863 | ::ShowWindow(hProjectView_ToolWindow,SW_SHOW); |
---|
864 | ::ShowWindow(hProjectView,SW_SHOW); |
---|
865 | isCheck = true; |
---|
866 | } |
---|
867 | } |
---|
868 | pobj_MainMenu->CheckMenu(IDM_PROJECTVIEW,isCheck); |
---|
869 | |
---|
870 | //再配置 |
---|
871 | ResizeOwnerWnd(); |
---|
872 | |
---|
873 | ::ShowWindow(hClient,SW_SHOW); |
---|
874 | } |
---|
875 | |
---|
876 | void MainFrame::OnCmdProjectOption( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
877 | { |
---|
878 | DlgProjectOptionSetting( m_hWnd ); |
---|
879 | } |
---|
880 | |
---|
881 | void MainFrame::OnCmdTopMost( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
882 | { |
---|
883 | if(pobj_MainMenu->IsCheck(IDM_TOPMOST)){ |
---|
884 | SetWindowPos( HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); |
---|
885 | pobj_MainMenu->CheckMenu(IDM_TOPMOST,0); |
---|
886 | } |
---|
887 | else{ |
---|
888 | SetWindowPos( HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); |
---|
889 | pobj_MainMenu->CheckMenu(IDM_TOPMOST,1); |
---|
890 | } |
---|
891 | } |
---|
892 | |
---|
893 | void ResetState_ViewMenu(void); |
---|
894 | void MainFrame::OnCmdRightTurn( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
895 | { |
---|
896 | pobj_nv->bRightTurn^=1; |
---|
897 | ResetState_ViewMenu(); |
---|
898 | |
---|
899 | //トップのウィンドウを再描画 |
---|
900 | RedrawAllWindow(); |
---|
901 | } |
---|
902 | |
---|
903 | void MainFrame::OnCmdSet( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
904 | { |
---|
905 | DlgOptionSetting( m_hWnd ); |
---|
906 | } |
---|
907 | |
---|
908 | void CreateProcessWithStdHandle( const std::string &appPath, const std::string &cmdLine) |
---|
909 | { |
---|
910 | std::string argsStr = (std::string)"\"" + appPath + "\" " + cmdLine; |
---|
911 | STARTUPINFO si; |
---|
912 | PROCESS_INFORMATION pi; |
---|
913 | memset(&si,0,sizeof(STARTUPINFO)); |
---|
914 | si.cb=sizeof(STARTUPINFO); |
---|
915 | si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; |
---|
916 | si.wShowWindow = SW_HIDE; |
---|
917 | si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); |
---|
918 | si.hStdInput = GetStdHandle(STD_INPUT_HANDLE); |
---|
919 | si.hStdError = GetStdHandle(STD_ERROR_HANDLE); |
---|
920 | |
---|
921 | char args[8192]; |
---|
922 | lstrcpy( args, argsStr.c_str() ); |
---|
923 | |
---|
924 | CreateProcess( NULL, args, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi ); |
---|
925 | } |
---|
926 | |
---|
927 | #ifndef THETEXT |
---|
928 | void MainFrame::OnCmdDebug( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
929 | { |
---|
930 | char temporary[1024], temp2[1024], temp3[1024]; |
---|
931 | if(pobj_Debugger->IsDebugging()){ |
---|
932 | pobj_Debugger->DebugContinue(); |
---|
933 | return; |
---|
934 | } |
---|
935 | |
---|
936 | HWND hChild = ::GetWindow(hClient,GW_CHILD); |
---|
937 | if( projectInfo.IsOpened() ){ |
---|
938 | //プロジェクトが開かれている場合 |
---|
939 | if(!SetProjectToRun()) return; |
---|
940 | |
---|
941 | //デバッグ用のコマンドライン及び実行可能ファイル(DLLのみ) |
---|
942 | sprintf(temporary,"%s\r\n%s",projectInfo.szExePath,projectInfo.szCmdLine); |
---|
943 | sprintf(temp2,"%spgm.tmp",pj_editor_Dir); |
---|
944 | HANDLE hFile=CreateFile(temp2,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_TEMPORARY,NULL); |
---|
945 | DWORD dwAccessBytes; |
---|
946 | WriteFile(hFile,temporary,lstrlen(temporary),&dwAccessBytes,NULL); |
---|
947 | CloseHandle(hFile); |
---|
948 | |
---|
949 | //ソースファイル名をtemp2へ |
---|
950 | projectInfo.pobj_DBFileInfo->ppobj_FileInfo[0]->GetFullPath(temp2); |
---|
951 | |
---|
952 | //出力ファイル名をtemp3へ |
---|
953 | lstrcpy(temp3,projectInfo.lpszOutput_Debug); |
---|
954 | GetFullPath(temp3,projectInfo.dir); |
---|
955 | |
---|
956 | if(IsNeedCompileForProject(1)) |
---|
957 | sprintf(temporary,"\"%s\" \"%s\" /debug /run /wnd:%08x",temp2,temp3,m_hWnd); |
---|
958 | else |
---|
959 | sprintf(temporary,"\"%s\" \"%s\" /run /wnd:%08x",temp2,temp3,m_hWnd); |
---|
960 | |
---|
961 | // DLLオプション |
---|
962 | if( projectInfo.GetModuleType() == ActiveBasic::Common::TargetModuleType::Dll ) |
---|
963 | { |
---|
964 | lstrcat(temporary," /dll"); |
---|
965 | } |
---|
966 | |
---|
967 | // SLLオプション |
---|
968 | if( projectInfo.GetModuleType() == ActiveBasic::Common::TargetModuleType::Sll ) |
---|
969 | { |
---|
970 | lstrcat(temporary," /static_library"); |
---|
971 | } |
---|
972 | |
---|
973 | //Unicodeオプション |
---|
974 | if(projectInfo.dwOption & PJ_OP_UNICODE) lstrcat(temporary," /unicode"); |
---|
975 | |
---|
976 | //ブレークポイントをセーブ |
---|
977 | projectInfo.pobj_DBBreakPoint->SaveToTempFile(); |
---|
978 | } |
---|
979 | else{ |
---|
980 | //単独ソースコード |
---|
981 | if(!SetRunning(hChild)) return; |
---|
982 | if(IsNeedCompile(MdiInfo[GetWndNum(hChild)].path,1)) |
---|
983 | sprintf(temporary,"\"%s\" /debug /run /wnd:%08x",MdiInfo[GetWndNum(hChild)].path,m_hWnd); |
---|
984 | else |
---|
985 | sprintf(temporary,"\"%s\" /run /wnd:%08x",MdiInfo[GetWndNum(hChild)].path,m_hWnd); |
---|
986 | |
---|
987 | //ブレークポイントをセーブ |
---|
988 | extern CDBBreakPoint *pobj_DBBreakPoint; |
---|
989 | pobj_DBBreakPoint->SaveToTempFile(); |
---|
990 | } |
---|
991 | |
---|
992 | //コンパイルビューをクリップするかどうか |
---|
993 | extern BOOL bClipCompileView; |
---|
994 | if(bClipCompileView){ |
---|
995 | lstrcat(temporary," /clip_compile_view"); |
---|
996 | |
---|
997 | //コンパイラビューを閉じる |
---|
998 | extern HWND hCompileView; |
---|
999 | if(hCompileView==(HWND)-1) return; |
---|
1000 | if(hCompileView){ |
---|
1001 | hChild=hCompileView; |
---|
1002 | hCompileView=(HWND)-1; |
---|
1003 | SendMessage(hChild,WM_COMMAND,IDCANCEL,0); |
---|
1004 | } |
---|
1005 | |
---|
1006 | //重複起動防止のため |
---|
1007 | hCompileView=(HWND)-1; |
---|
1008 | } |
---|
1009 | |
---|
1010 | //インクルードディレクトリ |
---|
1011 | sprintf(temp2," /include_dir:\"%s\"",pobj_nv->GetIncludeDirFullPath().c_str()); |
---|
1012 | lstrcat(temporary,temp2); |
---|
1013 | |
---|
1014 | extern ActiveBasic::Common::Platform::EnumType selectingPlatform; |
---|
1015 | CreateProcessWithStdHandle( ActiveBasic::Common::Environment::GetCompilerExePath( selectingPlatform ), temporary ); |
---|
1016 | } |
---|
1017 | |
---|
1018 | void MainFrame::OnCmdDebugCompile( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1019 | { |
---|
1020 | char temporary[1024], temp2[1024], temp3[1024]; |
---|
1021 | |
---|
1022 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1023 | if( projectInfo.IsOpened() ){ |
---|
1024 | //プロジェクトが開かれている場合 |
---|
1025 | if(!SetProjectToRun()) return; |
---|
1026 | |
---|
1027 | //ソースファイル名をtemp2へ |
---|
1028 | projectInfo.pobj_DBFileInfo->ppobj_FileInfo[0]->GetFullPath(temp2); |
---|
1029 | |
---|
1030 | //出力ファイル名をtemp3へ |
---|
1031 | lstrcpy(temp3,projectInfo.lpszOutput_Debug); |
---|
1032 | GetFullPath(temp3,projectInfo.dir); |
---|
1033 | |
---|
1034 | sprintf(temporary,"\"%s\" \"%s\" /debug /wnd:%08x",temp2,temp3,m_hWnd); |
---|
1035 | |
---|
1036 | //DLLオプション |
---|
1037 | if( projectInfo.GetModuleType() == ActiveBasic::Common::TargetModuleType::Dll ) |
---|
1038 | { |
---|
1039 | lstrcat(temporary," /dll"); |
---|
1040 | } |
---|
1041 | |
---|
1042 | //Unicodeオプション |
---|
1043 | if(projectInfo.dwOption & PJ_OP_UNICODE) lstrcat(temporary," /unicode"); |
---|
1044 | } |
---|
1045 | else{ |
---|
1046 | //単独ソースコード |
---|
1047 | if(!SetRunning(hChild)) return; |
---|
1048 | sprintf(temporary,"\"%s\" /debug /wnd:%08x",MdiInfo[GetWndNum(hChild)].path,m_hWnd); |
---|
1049 | } |
---|
1050 | |
---|
1051 | //コンパイルビューをクリップするかどうか |
---|
1052 | extern BOOL bClipCompileView; |
---|
1053 | if(bClipCompileView){ |
---|
1054 | lstrcat(temporary," /clip_compile_view"); |
---|
1055 | |
---|
1056 | //コンパイラビューを閉じる |
---|
1057 | extern HWND hCompileView; |
---|
1058 | if(hCompileView==(HWND)-1) return; |
---|
1059 | if(hCompileView){ |
---|
1060 | hChild=hCompileView; |
---|
1061 | hCompileView=(HWND)-1; |
---|
1062 | if( ::IsWindow( hChild ) ) |
---|
1063 | { |
---|
1064 | SendMessage(hChild,WM_COMMAND,IDCANCEL,0); |
---|
1065 | } |
---|
1066 | } |
---|
1067 | |
---|
1068 | //重複起動防止のため |
---|
1069 | hCompileView=(HWND)-1; |
---|
1070 | } |
---|
1071 | |
---|
1072 | //インクルードディレクトリ |
---|
1073 | sprintf(temp2," /include_dir:\"%s\"",pobj_nv->GetIncludeDirFullPath().c_str()); |
---|
1074 | lstrcat(temporary,temp2); |
---|
1075 | |
---|
1076 | extern ActiveBasic::Common::Platform::EnumType selectingPlatform; |
---|
1077 | CreateProcessWithStdHandle( ActiveBasic::Common::Environment::GetCompilerExePath( selectingPlatform ), temporary ); |
---|
1078 | |
---|
1079 | } |
---|
1080 | |
---|
1081 | void MainFrame::OnCmdAttach( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1082 | { |
---|
1083 | char temporary[1024], temp2[1024]; |
---|
1084 | |
---|
1085 | int idProcess; |
---|
1086 | DWORD dwPlatform; |
---|
1087 | idProcess=DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_ATTACH),m_hWnd,(DLGPROC)DlgAttach,(LPARAM)&dwPlatform); |
---|
1088 | if(idProcess==0) return; |
---|
1089 | |
---|
1090 | sprintf(temporary,"/attach:%08x /wnd:%08x",idProcess,m_hWnd); |
---|
1091 | |
---|
1092 | //コンパイルビューをクリップするかどうか |
---|
1093 | extern BOOL bClipCompileView; |
---|
1094 | if(bClipCompileView){ |
---|
1095 | lstrcat(temporary," /clip_compile_view"); |
---|
1096 | |
---|
1097 | //コンパイラビューを閉じる |
---|
1098 | extern HWND hCompileView; |
---|
1099 | if(hCompileView==(HWND)-1) return; |
---|
1100 | if(hCompileView){ |
---|
1101 | HWND hChild=hCompileView; |
---|
1102 | hCompileView=(HWND)-1; |
---|
1103 | SendMessage(hChild,WM_COMMAND,IDCANCEL,0); |
---|
1104 | } |
---|
1105 | |
---|
1106 | //重複起動防止のため |
---|
1107 | hCompileView=(HWND)-1; |
---|
1108 | } |
---|
1109 | |
---|
1110 | //インクルードディレクトリ |
---|
1111 | sprintf(temp2," /include_dir:\"%s\"",pobj_nv->GetIncludeDirFullPath().c_str()); |
---|
1112 | lstrcat(temporary,temp2); |
---|
1113 | |
---|
1114 | ActiveBasic::Common::Platform::EnumType platform; |
---|
1115 | if(dwPlatform==IMAGE_FILE_MACHINE_I386) |
---|
1116 | { |
---|
1117 | platform = ActiveBasic::Common::Platform::X86; |
---|
1118 | } |
---|
1119 | else if(dwPlatform==IMAGE_FILE_MACHINE_AMD64) |
---|
1120 | { |
---|
1121 | platform = ActiveBasic::Common::Platform::X64; |
---|
1122 | } |
---|
1123 | else |
---|
1124 | { |
---|
1125 | throw; |
---|
1126 | } |
---|
1127 | |
---|
1128 | extern ActiveBasic::Common::Platform::EnumType selectingPlatform; |
---|
1129 | CreateProcessWithStdHandle( ActiveBasic::Common::Environment::GetCompilerExePath( platform ), temporary ); |
---|
1130 | } |
---|
1131 | |
---|
1132 | void MainFrame::OnCmdReleaseCompile( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1133 | { |
---|
1134 | char temporary[1024], temp2[1024], temp3[1024]; |
---|
1135 | |
---|
1136 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1137 | if( projectInfo.IsOpened() ){ |
---|
1138 | //プロジェクトが開かれている場合 |
---|
1139 | if(!SetProjectToRun()) return; |
---|
1140 | |
---|
1141 | //ソースファイル名をtemp2へ |
---|
1142 | projectInfo.pobj_DBFileInfo->ppobj_FileInfo[0]->GetFullPath(temp2); |
---|
1143 | |
---|
1144 | //出力ファイル名をtemp3へ |
---|
1145 | lstrcpy(temp3,projectInfo.lpszOutput_Release); |
---|
1146 | GetFullPath(temp3,projectInfo.dir); |
---|
1147 | |
---|
1148 | sprintf(temporary,"\"%s\" \"%s\" /wnd:%08x",temp2,temp3,m_hWnd); |
---|
1149 | |
---|
1150 | //DLLオプション |
---|
1151 | if( projectInfo.GetModuleType() == ActiveBasic::Common::TargetModuleType::Dll ) |
---|
1152 | { |
---|
1153 | lstrcat(temporary," /dll"); |
---|
1154 | } |
---|
1155 | |
---|
1156 | //Unicodeオプション |
---|
1157 | if(projectInfo.dwOption & PJ_OP_UNICODE) lstrcat(temporary," /unicode"); |
---|
1158 | } |
---|
1159 | else{ |
---|
1160 | //単独ソースコード |
---|
1161 | if(!SetRunning(hChild)) return; |
---|
1162 | sprintf(temporary,"\"%s\" /wnd:%08x",MdiInfo[GetWndNum(hChild)].path,m_hWnd); |
---|
1163 | } |
---|
1164 | |
---|
1165 | //コンパイルビューをクリップするかどうか |
---|
1166 | extern BOOL bClipCompileView; |
---|
1167 | if(bClipCompileView){ |
---|
1168 | lstrcat(temporary," /clip_compile_view"); |
---|
1169 | |
---|
1170 | //コンパイラビューを閉じる |
---|
1171 | extern HWND hCompileView; |
---|
1172 | if(hCompileView==(HWND)-1) return; |
---|
1173 | if(hCompileView){ |
---|
1174 | hChild=hCompileView; |
---|
1175 | hCompileView=(HWND)-1; |
---|
1176 | SendMessage(hChild,WM_COMMAND,IDCANCEL,0); |
---|
1177 | } |
---|
1178 | |
---|
1179 | //重複起動防止のため |
---|
1180 | hCompileView=(HWND)-1; |
---|
1181 | } |
---|
1182 | |
---|
1183 | //インクルードディレクトリ |
---|
1184 | sprintf(temp2," /include_dir:\"%s\"",pobj_nv->GetIncludeDirFullPath().c_str()); |
---|
1185 | lstrcat(temporary,temp2); |
---|
1186 | |
---|
1187 | extern ActiveBasic::Common::Platform::EnumType selectingPlatform; |
---|
1188 | CreateProcessWithStdHandle( ActiveBasic::Common::Environment::GetCompilerExePath( selectingPlatform ), temporary ); |
---|
1189 | } |
---|
1190 | |
---|
1191 | void MainFrame::OnCmdReleaseRun( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1192 | { |
---|
1193 | char temporary[1024], temp2[1024], temp3[1024]; |
---|
1194 | |
---|
1195 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1196 | if( projectInfo.IsOpened() ){ |
---|
1197 | /* //プロジェクトが開かれている場合 |
---|
1198 | if(!SetProjectToRun()) return; |
---|
1199 | |
---|
1200 | //必要であればリリースコンパイル |
---|
1201 | if(IsNeedCompileForProject(0)) |
---|
1202 | SendMessage(WM_COMMAND,IDM_RELEASECOMPILE,0);*/ |
---|
1203 | |
---|
1204 | if( projectInfo.GetModuleType() == ActiveBasic::Common::TargetModuleType::Dll ) |
---|
1205 | { |
---|
1206 | lstrcpy(temporary,projectInfo.szExePath); |
---|
1207 | } |
---|
1208 | else{ |
---|
1209 | lstrcpy(temporary,projectInfo.lpszOutput_Debug); |
---|
1210 | GetFullPath(temporary,projectInfo.dir); |
---|
1211 | } |
---|
1212 | } |
---|
1213 | else{ |
---|
1214 | /* //必要であればリリースコンパイル |
---|
1215 | if(!SetRunning(hChild)) return; |
---|
1216 | |
---|
1217 | if(IsNeedCompile(MdiInfo[GetWndNum(hChild)].path,0)) |
---|
1218 | SendMessage(WM_COMMAND,IDM_RELEASECOMPILE,0);*/ |
---|
1219 | |
---|
1220 | //単独ソースコード |
---|
1221 | _splitpath(MdiInfo[GetWndNum(hChild)].path,temporary,temp2,temp3,NULL); |
---|
1222 | lstrcat(temporary,temp2); |
---|
1223 | lstrcat(temporary,temp3); |
---|
1224 | lstrcat(temporary,".exe"); |
---|
1225 | } |
---|
1226 | |
---|
1227 | //インクルードディレクトリ |
---|
1228 | sprintf(temp2," /include_dir:\"%s\"",pobj_nv->GetIncludeDirFullPath().c_str()); |
---|
1229 | lstrcat(temporary,temp2); |
---|
1230 | |
---|
1231 | ShellExecute(m_hWnd,"open",temporary,NULL,NULL,SW_SHOWNORMAL); |
---|
1232 | } |
---|
1233 | |
---|
1234 | void MainFrame::OnCmdStepIn( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1235 | { |
---|
1236 | pobj_Debugger->StepIn(); |
---|
1237 | } |
---|
1238 | |
---|
1239 | void MainFrame::OnCmdStepOver( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1240 | { |
---|
1241 | pobj_Debugger->StepOver(); |
---|
1242 | } |
---|
1243 | |
---|
1244 | void MainFrame::OnCmdStepCursor( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1245 | { |
---|
1246 | pobj_Debugger->StepToCursor(); |
---|
1247 | } |
---|
1248 | |
---|
1249 | void MainFrame::OnCmdBreakPoint( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1250 | { |
---|
1251 | if( projectInfo.IsOpened() ){ |
---|
1252 | projectInfo.pobj_DBBreakPoint->Event_BreakPoint(); |
---|
1253 | } |
---|
1254 | else{ |
---|
1255 | extern CDBBreakPoint *pobj_DBBreakPoint; |
---|
1256 | pobj_DBBreakPoint->Event_BreakPoint(); |
---|
1257 | } |
---|
1258 | } |
---|
1259 | |
---|
1260 | void MainFrame::OnCmdDebugStop( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1261 | { |
---|
1262 | pobj_Debugger->DebugStop(); |
---|
1263 | } |
---|
1264 | |
---|
1265 | void MainFrame::OnCmdDebugPause( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1266 | { |
---|
1267 | pobj_Debugger->DebugPause(); |
---|
1268 | } |
---|
1269 | |
---|
1270 | #endif // not THETEXT |
---|
1271 | |
---|
1272 | void MainFrame::OnCmdWebLink( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1273 | { |
---|
1274 | switch( nID ) |
---|
1275 | { |
---|
1276 | #ifndef THETEXT |
---|
1277 | case IDM_COMMUNITY: |
---|
1278 | OpenWebBrowser( "http://www.activebasic.com/forum/" ); |
---|
1279 | break; |
---|
1280 | case IDM_COMMU_SEARCH: |
---|
1281 | OpenWebBrowser( "http://www.activebasic.com/forum/search.php" ); |
---|
1282 | break; |
---|
1283 | case IDM_COMMU_PM: |
---|
1284 | OpenWebBrowser( "http://www.activebasic.com/forum/privmsg.php?folder=inbox" ); |
---|
1285 | break; |
---|
1286 | case ID_COMMU_FORUM1: |
---|
1287 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=1" ); |
---|
1288 | break; |
---|
1289 | case ID_COMMU_FORUM2: |
---|
1290 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=2" ); |
---|
1291 | break; |
---|
1292 | case ID_COMMU_FORUM3: |
---|
1293 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=5" ); |
---|
1294 | break; |
---|
1295 | case ID_COMMU_FORUM4: |
---|
1296 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=3" ); |
---|
1297 | break; |
---|
1298 | case ID_COMMU_FORUM5: |
---|
1299 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=6" ); |
---|
1300 | break; |
---|
1301 | case ID_COMMU_FORUM6: |
---|
1302 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=8" ); |
---|
1303 | break; |
---|
1304 | case ID_COMMU_FORUM7: |
---|
1305 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=4" ); |
---|
1306 | break; |
---|
1307 | case ID_COMMU_FORUM8: |
---|
1308 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=7" ); |
---|
1309 | break; |
---|
1310 | case IDM_AB_WEBSITE: |
---|
1311 | OpenWebBrowser( "http://www.activebasic.com/" ); |
---|
1312 | break; |
---|
1313 | case IDM_ACTBDL: |
---|
1314 | OpenWebBrowser( "http://www.activebasic.com/activebasic5/download.htm" ); |
---|
1315 | break; |
---|
1316 | #else |
---|
1317 | case IDM_DSHOMEPAGE: |
---|
1318 | OpenWebBrowser( "http://www.discoversoft.net/" ); |
---|
1319 | break; |
---|
1320 | #endif // not THETEXT |
---|
1321 | default: |
---|
1322 | throw; |
---|
1323 | } |
---|
1324 | } |
---|
1325 | |
---|
1326 | void MainFrame::OnCmdTopics( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1327 | { |
---|
1328 | char temporary[1024]; |
---|
1329 | #ifdef THETEXT |
---|
1330 | sprintf(temporary,"%sTopics\\index.html",pj_editor_Dir); |
---|
1331 | ShellExecute(m_hWnd,"open",temporary,NULL,NULL,SW_SHOWNORMAL); |
---|
1332 | #else |
---|
1333 | sprintf(temporary,"%sBasicHelp.chm",pj_editor_Dir); |
---|
1334 | HtmlHelp(NULL,temporary,HH_DISPLAY_TOPIC,0); |
---|
1335 | #endif |
---|
1336 | } |
---|
1337 | |
---|
1338 | void MainFrame::OnCmdAbout( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1339 | { |
---|
1340 | DialogBox(hResInst,MAKEINTRESOURCE(IDD_ABOUT),m_hWnd,(DLGPROC)DialogAbout); |
---|
1341 | } |
---|
1342 | |
---|
1343 | void MainFrame::OnCmdDocSelectBand( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1344 | { |
---|
1345 | pobj_Rebar->ChangeRebarBand(ID_DOCCOMBO); |
---|
1346 | } |
---|
1347 | |
---|
1348 | void MainFrame::OnCmdStandardBand( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1349 | { |
---|
1350 | pobj_Rebar->ChangeRebarBand(ID_STANDARDTOOLBAR); |
---|
1351 | } |
---|
1352 | |
---|
1353 | void MainFrame::OnCmdReleaseBand( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1354 | { |
---|
1355 | pobj_Rebar->ChangeRebarBand(ID_RELEASETOOLBAR); |
---|
1356 | } |
---|
1357 | |
---|
1358 | void MainFrame::OnCmdDebugBand( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1359 | { |
---|
1360 | pobj_Rebar->ChangeRebarBand(ID_DEBUGGERTOOLBAR); |
---|
1361 | } |
---|
1362 | |
---|
1363 | void MainFrame::OnCmdSelectCompilerBand( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1364 | { |
---|
1365 | pobj_Rebar->ChangeRebarBand(ID_SELECTCOMPILERCOMBO); |
---|
1366 | } |
---|
1367 | |
---|
1368 | void MainFrame::OnCmdNoGripper( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1369 | { |
---|
1370 | if(pobj_nv->bNoGripper) pobj_nv->bNoGripper=0; |
---|
1371 | else pobj_nv->bNoGripper=1; |
---|
1372 | |
---|
1373 | //レバーコントロールを再生成 |
---|
1374 | pobj_Rebar->ResetRebar(); |
---|
1375 | |
---|
1376 | //メニュー状態を設定 |
---|
1377 | ResetState_DocMenu(); |
---|
1378 | } |
---|
1379 | |
---|
1380 | void MainFrame::OnCmdResetRebar( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1381 | { |
---|
1382 | //"ツールバーの配置をすべて初期状態に戻します。\nよろしいですか?" |
---|
1383 | if( MessageBox(STRING_TOOLBAR_RESET,APPLICATION_NAME,MB_OKCANCEL|MB_ICONEXCLAMATION) == IDCANCEL ) |
---|
1384 | { |
---|
1385 | return; |
---|
1386 | } |
---|
1387 | |
---|
1388 | //レバーコントロールを再生成 |
---|
1389 | pobj_Rebar->ResetInitRebar(); |
---|
1390 | |
---|
1391 | //メニュー状態を設定 |
---|
1392 | ResetState_DocMenu(); |
---|
1393 | } |
---|
1394 | |
---|
1395 | void MainFrame::OnCmdAllCloseOmitMyself( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1396 | { |
---|
1397 | //このウィンドウ以外をすべて閉じる(&A) |
---|
1398 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1399 | int WndNum=GetWndNum(hChild); |
---|
1400 | for(int i=0;i<MAX_WNDNUM;i++){ |
---|
1401 | if(i==WndNum) continue; |
---|
1402 | if(MdiInfo[i].hwnd) SendMessage(MdiInfo[i].hwnd,WM_CLOSE,0,0); |
---|
1403 | } |
---|
1404 | } |
---|
1405 | |
---|
1406 | void MainFrame::OnCmdPathCopy( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1407 | { |
---|
1408 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1409 | int WndNum=GetWndNum(hChild); |
---|
1410 | |
---|
1411 | //絶対パスをコピー |
---|
1412 | HGLOBAL hGlobal=(char *)GlobalAlloc(GMEM_MOVEABLE,lstrlen(MdiInfo[WndNum].path)+1); |
---|
1413 | char *pTemp=(char *)GlobalLock(hGlobal); |
---|
1414 | lstrcpy(pTemp,MdiInfo[WndNum].path); |
---|
1415 | GlobalUnlock(hGlobal); |
---|
1416 | |
---|
1417 | //クリップボードに保存 |
---|
1418 | OpenClipboard(); |
---|
1419 | EmptyClipboard(); |
---|
1420 | SetClipboardData(CF_TEXT,hGlobal); |
---|
1421 | CloseClipboard(); |
---|
1422 | } |
---|
1423 | |
---|
1424 | void MainFrame::OnCmdFolderOpen( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1425 | { |
---|
1426 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1427 | int WndNum=GetWndNum(hChild); |
---|
1428 | |
---|
1429 | char temporary[1024], temp2[1024]; |
---|
1430 | _splitpath(MdiInfo[WndNum].path,temporary,temp2,NULL,NULL); |
---|
1431 | lstrcat(temporary,temp2); |
---|
1432 | |
---|
1433 | OpenExplorer( temporary ); |
---|
1434 | } |
---|
1435 | |
---|
1436 | void MainFrame::OnCmdDeleteFile( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1437 | { |
---|
1438 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1439 | int WndNum=GetWndNum(hChild); |
---|
1440 | |
---|
1441 | char temporary[1024], temp2[1024]; |
---|
1442 | _splitpath(MdiInfo[WndNum].path,NULL,NULL,temporary,temp2); |
---|
1443 | lstrcat(temporary,temp2); |
---|
1444 | |
---|
1445 | lstrcat(temporary," をごみ箱に移動して閉じます。よろしいですか?"); |
---|
1446 | if(MessageBox(temporary,APPLICATION_NAME,MB_OKCANCEL|MB_ICONQUESTION)==IDCANCEL) return; |
---|
1447 | |
---|
1448 | //ゴミ箱へ |
---|
1449 | SHFILEOPSTRUCT fo; |
---|
1450 | fo.hwnd=m_hWnd; |
---|
1451 | fo.wFunc=FO_DELETE; |
---|
1452 | fo.pFrom =MdiInfo[WndNum].path; |
---|
1453 | fo.pTo="\0"; |
---|
1454 | fo.fFlags =FOF_ALLOWUNDO|FOF_NOCONFIRMATION; |
---|
1455 | SHFileOperation(&fo); |
---|
1456 | |
---|
1457 | //閉じる |
---|
1458 | MdiInfo[WndNum].pMdiTextEdit->UnModify(); |
---|
1459 | SendMessage(MdiInfo[WndNum].hwnd,WM_CLOSE,0,0); |
---|
1460 | } |
---|
1461 | |
---|
1462 | void MainFrame::OnCmdColor( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1463 | { |
---|
1464 | static COLORREF colorUser=RGB(255,255,255); |
---|
1465 | |
---|
1466 | switch( nID ) |
---|
1467 | { |
---|
1468 | case IDM_USER_COLOR: |
---|
1469 | { |
---|
1470 | CHOOSECOLOR cc; |
---|
1471 | COLORREF CusColors[16]={ |
---|
1472 | RGB(255,255,255), |
---|
1473 | RGB(0,0,0), |
---|
1474 | RGB(128,128,128), |
---|
1475 | RGB(192,192,192), |
---|
1476 | RGB(128,0,0), |
---|
1477 | RGB(255,0,0), |
---|
1478 | RGB(128,128,0), |
---|
1479 | RGB(255,255,0), |
---|
1480 | RGB(0,128,0), |
---|
1481 | RGB(0,255,0), |
---|
1482 | RGB(0,128,128), |
---|
1483 | RGB(0,255,255), |
---|
1484 | RGB(0,0,128), |
---|
1485 | RGB(0,0,255), |
---|
1486 | RGB(128,0,128), |
---|
1487 | RGB(255,0,255)}; |
---|
1488 | cc.lStructSize=sizeof(CHOOSECOLOR); |
---|
1489 | cc.hwndOwner=m_hWnd; |
---|
1490 | cc.rgbResult=colorUser; |
---|
1491 | cc.lpCustColors=CusColors; |
---|
1492 | cc.Flags=CC_RGBINIT|CC_FULLOPEN; |
---|
1493 | if(!ChooseColor(&cc)){ |
---|
1494 | return; |
---|
1495 | } |
---|
1496 | colorUser=cc.rgbResult; |
---|
1497 | } |
---|
1498 | case IDM_GRAY: |
---|
1499 | case IDM_WHITE: |
---|
1500 | case IDM_RED: |
---|
1501 | case IDM_GREEN: |
---|
1502 | case IDM_BLUE: |
---|
1503 | case IDM_YELLOW: |
---|
1504 | { |
---|
1505 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1506 | int WndNum=GetWndNum(hChild); |
---|
1507 | |
---|
1508 | TC_ITEM tcItem; |
---|
1509 | tcItem.mask=TCIF_PARAM; |
---|
1510 | if(nID==IDM_GRAY) tcItem.lParam=TABCOLOR_GRAY; |
---|
1511 | if(nID==IDM_WHITE) tcItem.lParam=TABCOLOR_WHITE; |
---|
1512 | if(nID==IDM_RED) tcItem.lParam=TABCOLOR_RED; |
---|
1513 | if(nID==IDM_GREEN) tcItem.lParam=TABCOLOR_GREEN; |
---|
1514 | if(nID==IDM_BLUE) tcItem.lParam=TABCOLOR_BLUE; |
---|
1515 | if(nID==IDM_YELLOW) tcItem.lParam=TABCOLOR_YELLOW; |
---|
1516 | if(nID==IDM_USER_COLOR) tcItem.lParam=colorUser; |
---|
1517 | TabCtrl_SetItem(pobj_MainTab->hTab, |
---|
1518 | TabCtrl_GetCurSel(pobj_MainTab->hTab), |
---|
1519 | &tcItem); |
---|
1520 | ::InvalidateRect(pobj_MainTab->hTab,NULL,0); |
---|
1521 | break; |
---|
1522 | } |
---|
1523 | default: |
---|
1524 | throw; |
---|
1525 | } |
---|
1526 | } |
---|