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.empty()){ |
---|
319 | _splitpath(MdiInfo[WndNum].path.c_str(),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.empty()){ |
---|
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.c_str(),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 | |
---|
449 | lstrcpy( temporary, projectInfo.GetWorkDir().GetFullPath( temporary ).c_str() ); |
---|
450 | } |
---|
451 | else bAddToProject=0; |
---|
452 | |
---|
453 | switch(FileType){ |
---|
454 | case FT_BASICPROGRAM: //Basicプログラム |
---|
455 | case FT_SUBPROGRAM: |
---|
456 | if(bAddToProject){ |
---|
457 | WriteBuffer(temporary,0,0); |
---|
458 | NewTextEditWindow(temporary,WNDTYPE_BASIC); |
---|
459 | Project_File_Insert(temporary); |
---|
460 | } |
---|
461 | else NewTextEditWindow(NULL,WNDTYPE_BASIC); |
---|
462 | break; |
---|
463 | |
---|
464 | case FT_PROJECT: |
---|
465 | DlgNewProjectWizard(hOwner); |
---|
466 | break; |
---|
467 | |
---|
468 | case FT_TEXT: |
---|
469 | NewTextEditWindow(NULL,WNDTYPE_TEXT); |
---|
470 | break; |
---|
471 | |
---|
472 | case FT_HTML: |
---|
473 | NewTextEditWindow(NULL,WNDTYPE_HTML); |
---|
474 | break; |
---|
475 | |
---|
476 | case FT_ICON: |
---|
477 | NewIconEditWindow(NULL); |
---|
478 | break; |
---|
479 | } |
---|
480 | #endif |
---|
481 | } |
---|
482 | |
---|
483 | void MainFrame::OnCmdOpen( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
484 | { |
---|
485 | //"ファイルを指定してください" |
---|
486 | extern LPSTR DefFileFilter; |
---|
487 | char temporary[1024]; |
---|
488 | if(!GetFilePathDialog(m_hWnd,temporary,DefFileFilter,STRING_FILEOPENTITLE_DEFAULT,TRUE)) return; |
---|
489 | |
---|
490 | OpenFileWithExtension( temporary ); |
---|
491 | } |
---|
492 | |
---|
493 | void MainFrame::OnCmdClose( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
494 | { |
---|
495 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
496 | if(::IsWindow(hChild)) SendMessage(hChild,WM_CLOSE,0,0); |
---|
497 | } |
---|
498 | |
---|
499 | void MainFrame::OnCmdProjectOpen( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
500 | { |
---|
501 | //"プロジェクト ファイルを指定して下さい" |
---|
502 | extern LPSTR ProjectFileFilter; |
---|
503 | char temporary[1024]; |
---|
504 | if(!GetFilePathDialog(m_hWnd,temporary,ProjectFileFilter,STRING_FILEOPENTITLE_PROJECT,TRUE)) |
---|
505 | { |
---|
506 | return; |
---|
507 | } |
---|
508 | |
---|
509 | projectInfo.Load(temporary); |
---|
510 | } |
---|
511 | |
---|
512 | void MainFrame::OnCmdProjectSave( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
513 | { |
---|
514 | projectInfo.Save(); |
---|
515 | } |
---|
516 | |
---|
517 | void MainFrame::OnCmdProjectClose( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
518 | { |
---|
519 | projectInfo.Close(); |
---|
520 | } |
---|
521 | |
---|
522 | void MainFrame::OnCmdProjectFolderOpen( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
523 | { |
---|
524 | ShellExecute(m_hWnd,"explore",projectInfo.GetWorkDir().GetPath().c_str(),NULL,NULL,SW_SHOWNORMAL); |
---|
525 | } |
---|
526 | |
---|
527 | void MainFrame::OnCmdSave( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
528 | { |
---|
529 | SaveDocument(::GetWindow(hClient,GW_CHILD),NULL); |
---|
530 | } |
---|
531 | |
---|
532 | void MainFrame::OnCmdNewSave( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
533 | { |
---|
534 | //"保存先のファイルを指定してください" |
---|
535 | extern LPSTR DefFileFilter; |
---|
536 | char temporary[1024]; |
---|
537 | if(!GetFilePathDialog(m_hWnd,temporary,DefFileFilter,STRING_FILESAVETITLE_DEFAULT,FALSE)) return; |
---|
538 | |
---|
539 | SaveDocument(::GetWindow(hClient,GW_CHILD),temporary); |
---|
540 | } |
---|
541 | |
---|
542 | void MainFrame::OnCmdCodeSave( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
543 | { |
---|
544 | //文字コードを指定して保存 |
---|
545 | DialogBox(hResInst,MAKEINTRESOURCE(IDD_CODE_SAVE),m_hWnd,(DLGPROC)nkfDlgCodeSave); |
---|
546 | } |
---|
547 | |
---|
548 | void MainFrame::OnCmdAllSave( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
549 | { |
---|
550 | for( int i=0;i<MdiInfo.size();i++){ |
---|
551 | if(MdiInfo[i].hwnd) SaveDocument(MdiInfo[i].hwnd,NULL); |
---|
552 | } |
---|
553 | if( projectInfo.IsOpened() ) |
---|
554 | { |
---|
555 | projectInfo.Save(); |
---|
556 | } |
---|
557 | } |
---|
558 | |
---|
559 | void MainFrame::OnCmdPageSet( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
560 | { |
---|
561 | //ページ設定 |
---|
562 | obj_Page.SetupDlg(); |
---|
563 | } |
---|
564 | |
---|
565 | void MainFrame::OnCmdPreview( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
566 | { |
---|
567 | //プレビュー(Pro版のみ) |
---|
568 | Preview(); |
---|
569 | } |
---|
570 | |
---|
571 | void MainFrame::OnCmdPrintOut( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
572 | { |
---|
573 | //印刷 |
---|
574 | Printout(); |
---|
575 | } |
---|
576 | |
---|
577 | void MainFrame::OnCmdExit( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
578 | { |
---|
579 | SendMessage(WM_CLOSE); |
---|
580 | } |
---|
581 | |
---|
582 | void MainFrame::OnCmdUndo( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
583 | { |
---|
584 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
585 | if(!hChild) return; |
---|
586 | int WndNum=GetWndNum(hChild); |
---|
587 | if( IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType) ) |
---|
588 | { |
---|
589 | TextEdit_UndoCommand(WndNum); |
---|
590 | } |
---|
591 | else if( MdiInfo[WndNum].DocType == WNDTYPE_RAD ) |
---|
592 | { |
---|
593 | Rad_UndoCommand(WndNum); |
---|
594 | } |
---|
595 | else if( MdiInfo[WndNum].DocType == WNDTYPE_ICONEDIT ) |
---|
596 | { |
---|
597 | IconEdit_UndoCommand(WndNum); |
---|
598 | } |
---|
599 | } |
---|
600 | |
---|
601 | void MainFrame::OnCmdRedo( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
602 | { |
---|
603 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
604 | if(!hChild) return; |
---|
605 | int WndNum=GetWndNum(hChild); |
---|
606 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)) |
---|
607 | TextEdit_RedoCommand(WndNum); |
---|
608 | else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD) |
---|
609 | Rad_RedoCommand(WndNum); |
---|
610 | else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT) |
---|
611 | IconEdit_RedoCommand(WndNum); |
---|
612 | } |
---|
613 | |
---|
614 | void MainFrame::OnCmdCut( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
615 | { |
---|
616 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
617 | int WndNum=GetWndNum(hChild); |
---|
618 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){ |
---|
619 | HWND hEdit=::GetWindow(hChild,GW_CHILD); |
---|
620 | |
---|
621 | CHARRANGE CharRange; |
---|
622 | TextEdit_GetSel(WndNum,&CharRange); |
---|
623 | |
---|
624 | HGLOBAL hGlobal=(char *)GlobalAlloc(GMEM_MOVEABLE,CharRange.cpMax-CharRange.cpMin+1); |
---|
625 | char *pTemp=(char *)GlobalLock(hGlobal); |
---|
626 | memcpy(pTemp,MdiInfo[WndNum].pMdiTextEdit->buffer+CharRange.cpMin,CharRange.cpMax-CharRange.cpMin); |
---|
627 | pTemp[CharRange.cpMax-CharRange.cpMin]=0; |
---|
628 | GlobalUnlock(hGlobal); |
---|
629 | |
---|
630 | //クリップボードに保存 |
---|
631 | OpenClipboard(); |
---|
632 | EmptyClipboard(); |
---|
633 | SetClipboardData(CF_TEXT,hGlobal); |
---|
634 | CloseClipboard(); |
---|
635 | |
---|
636 | //選択文字列を消去 |
---|
637 | SendMessage(hEdit,WM_KEYDOWN,VK_DELETE,0); |
---|
638 | } |
---|
639 | else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD){ |
---|
640 | ActiveBasic::PM::WindowInfo *pWindowInfo = GetWndInfo(MdiInfo[WndNum].path); |
---|
641 | int indexOfWndInfo = GetWndInfoNum(MdiInfo[WndNum].path); |
---|
642 | |
---|
643 | //クリップボードに格納するためのデータを用意する |
---|
644 | pWindowInfo->childWindowInfos[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]]->pos.x-=17; |
---|
645 | pWindowInfo->childWindowInfos[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]]->pos.y-=10; |
---|
646 | HGLOBAL hGlobal=Rad_GetChildInfoClipboardData(WndNum,indexOfWndInfo); |
---|
647 | pWindowInfo->childWindowInfos[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]]->pos.x+=17; |
---|
648 | pWindowInfo->childWindowInfos[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]]->pos.y+=10; |
---|
649 | |
---|
650 | OpenClipboard(); |
---|
651 | EmptyClipboard(); |
---|
652 | extern DWORD dwRadClipboardID; |
---|
653 | SetClipboardData(dwRadClipboardID,hGlobal); |
---|
654 | CloseClipboard(); |
---|
655 | |
---|
656 | SendMessage(MdiInfo[WndNum].MdiRadInfo->hRad,WM_COMMAND,IDM_RAD_ITEM_DELETE,0); |
---|
657 | } |
---|
658 | else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){ |
---|
659 | //クリップボードに格納するためのデータを用意する |
---|
660 | HGLOBAL hGlobal=IconEdit_GetChildInfoClipboardData(WndNum); |
---|
661 | if(hGlobal==0) return; |
---|
662 | |
---|
663 | OpenClipboard(); |
---|
664 | EmptyClipboard(); |
---|
665 | SetClipboardData(CF_BITMAP,hGlobal); |
---|
666 | CloseClipboard(); |
---|
667 | |
---|
668 | DeleteObject(MdiInfo[WndNum].MdiIconEditInfo->hSelectingBmp); |
---|
669 | MdiInfo[WndNum].MdiIconEditInfo->SelectLevel=0; |
---|
670 | |
---|
671 | IconEdit_EraseRect(WndNum,&MdiInfo[WndNum].MdiIconEditInfo->DraggingRect); |
---|
672 | } |
---|
673 | } |
---|
674 | |
---|
675 | void MainFrame::OnCmdCopy( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
676 | { |
---|
677 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
678 | int WndNum=GetWndNum(hChild); |
---|
679 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){ |
---|
680 | HWND hEdit = ::GetWindow(hChild,GW_CHILD); |
---|
681 | |
---|
682 | CHARRANGE CharRange; |
---|
683 | TextEdit_GetSel(WndNum,&CharRange); |
---|
684 | |
---|
685 | HGLOBAL hGlobal=(char *)GlobalAlloc(GMEM_MOVEABLE,CharRange.cpMax-CharRange.cpMin+1); |
---|
686 | char *pTemp=(char *)GlobalLock(hGlobal); |
---|
687 | memcpy(pTemp,MdiInfo[WndNum].pMdiTextEdit->buffer+CharRange.cpMin,CharRange.cpMax-CharRange.cpMin); |
---|
688 | pTemp[CharRange.cpMax-CharRange.cpMin]=0; |
---|
689 | GlobalUnlock(hGlobal); |
---|
690 | |
---|
691 | //クリップボードに保存 |
---|
692 | OpenClipboard(); |
---|
693 | EmptyClipboard(); |
---|
694 | SetClipboardData(CF_TEXT,hGlobal); |
---|
695 | CloseClipboard(); |
---|
696 | } |
---|
697 | else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD){ |
---|
698 | int indexOfWndInfo = GetWndInfoNum(MdiInfo[WndNum].path); |
---|
699 | |
---|
700 | //クリップボードに格納するためのデータを用意する |
---|
701 | HGLOBAL hGlobal=Rad_GetChildInfoClipboardData(WndNum,indexOfWndInfo); |
---|
702 | |
---|
703 | OpenClipboard(); |
---|
704 | EmptyClipboard(); |
---|
705 | extern DWORD dwRadClipboardID; |
---|
706 | SetClipboardData(dwRadClipboardID,hGlobal); |
---|
707 | CloseClipboard(); |
---|
708 | } |
---|
709 | else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){ |
---|
710 | //クリップボードに格納するためのデータを用意する |
---|
711 | HGLOBAL hGlobal=IconEdit_GetChildInfoClipboardData(WndNum); |
---|
712 | |
---|
713 | OpenClipboard(); |
---|
714 | EmptyClipboard(); |
---|
715 | SetClipboardData(CF_BITMAP,hGlobal); |
---|
716 | CloseClipboard(); |
---|
717 | } |
---|
718 | } |
---|
719 | |
---|
720 | void MainFrame::OnCmdPaste( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
721 | { |
---|
722 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
723 | int WndNum=GetWndNum(hChild); |
---|
724 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){ |
---|
725 | HWND hEdit=::GetWindow(hChild,GW_CHILD); |
---|
726 | |
---|
727 | //クリップボードを開く |
---|
728 | OpenClipboard(); |
---|
729 | HGLOBAL hGlobal=GetClipboardData(CF_TEXT); |
---|
730 | if(!hGlobal){ |
---|
731 | CloseClipboard(); |
---|
732 | return; |
---|
733 | } |
---|
734 | |
---|
735 | |
---|
736 | char *pTemp; |
---|
737 | if(pobj_nv->bPasteIndent){ |
---|
738 | //インデント整形 |
---|
739 | pTemp=CodeFormatter((char *)GlobalLock(hGlobal)); |
---|
740 | GlobalUnlock(hGlobal); |
---|
741 | } |
---|
742 | else pTemp=(char *)GlobalLock(hGlobal); |
---|
743 | |
---|
744 | |
---|
745 | //テキストエディタの文字列をリプレイス |
---|
746 | TextEdit_ReplaceUpdateUndoData(WndNum, |
---|
747 | pTemp, |
---|
748 | 1, |
---|
749 | 1); |
---|
750 | |
---|
751 | if(pobj_nv->bPasteIndent) |
---|
752 | HeapDefaultFree(pTemp); |
---|
753 | else |
---|
754 | GlobalUnlock(hGlobal); |
---|
755 | |
---|
756 | //クリップボードを閉じる |
---|
757 | CloseClipboard(); |
---|
758 | |
---|
759 | |
---|
760 | //キャレット位置までスクロールする |
---|
761 | TextEdit_ScrollCaret(WndNum,0); |
---|
762 | ResetCaretPos(WndNum); |
---|
763 | } |
---|
764 | else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD){ |
---|
765 | OpenClipboard(); |
---|
766 | extern DWORD dwRadClipboardID; |
---|
767 | HGLOBAL hGlobal=GetClipboardData(dwRadClipboardID); |
---|
768 | if(!hGlobal){ |
---|
769 | CloseClipboard(); |
---|
770 | return; |
---|
771 | } |
---|
772 | Rad_PasteChildInfoClipboardData(WndNum,hGlobal); |
---|
773 | CloseClipboard(); |
---|
774 | } |
---|
775 | else if(MdiInfo[WndNum].DocType==WNDTYPE_ICONEDIT){ |
---|
776 | OpenClipboard(); |
---|
777 | HGLOBAL hGlobal=GetClipboardData(CF_BITMAP); |
---|
778 | if(!hGlobal){ |
---|
779 | CloseClipboard(); |
---|
780 | return; |
---|
781 | } |
---|
782 | IconEdit_PasteChildInfoClipboardData(WndNum,(HBITMAP)hGlobal); |
---|
783 | CloseClipboard(); |
---|
784 | } |
---|
785 | } |
---|
786 | |
---|
787 | void MainFrame::OnCmdDelete( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
788 | { |
---|
789 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
790 | int WndNum=GetWndNum(hChild); |
---|
791 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){ |
---|
792 | HWND hEdit=::GetWindow(hChild,GW_CHILD); |
---|
793 | TextEdit_ReplaceUpdateUndoData(WndNum,"",0,1); |
---|
794 | } |
---|
795 | else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD) |
---|
796 | SendMessage(MdiInfo[WndNum].MdiRadInfo->hRad,WM_COMMAND,IDM_RAD_ITEM_DELETE,0); |
---|
797 | } |
---|
798 | |
---|
799 | void MainFrame::OnCmdAllSelect( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
800 | { |
---|
801 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
802 | int WndNum=GetWndNum(hChild); |
---|
803 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){ |
---|
804 | HWND hEdit=::GetWindow(hChild,GW_CHILD); |
---|
805 | |
---|
806 | MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.x=0; |
---|
807 | MdiInfo[WndNum].pMdiTextEdit->StartCaretPos.y=0; |
---|
808 | |
---|
809 | GetCaretPosFromBufferIndex( |
---|
810 | MdiInfo[WndNum].pMdiTextEdit->buffer, |
---|
811 | lstrlen(MdiInfo[WndNum].pMdiTextEdit->buffer), |
---|
812 | &MdiInfo[WndNum].pMdiTextEdit->EndCaretPos); |
---|
813 | |
---|
814 | ::InvalidateRect(hEdit,NULL,0); |
---|
815 | |
---|
816 | ResetState_EditMenu(); |
---|
817 | } |
---|
818 | else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD){ |
---|
819 | ActiveBasic::PM::WindowInfo *pWindowInfo = GetWndInfo(MdiInfo[WndNum].path); |
---|
820 | for( int i3=0; i3<static_cast<int>(pWindowInfo->childWindowInfos.size()); i3++ ) |
---|
821 | { |
---|
822 | MdiInfo[WndNum].MdiRadInfo->SelectingItem[i3] = i3; |
---|
823 | } |
---|
824 | DrawRadWindow(WndNum,pWindowInfo); |
---|
825 | } |
---|
826 | } |
---|
827 | |
---|
828 | void MainFrame::OnCmdFind( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
829 | { |
---|
830 | DialogBox(hResInst,MAKEINTRESOURCE(IDD_FIND),m_hWnd,(DLGPROC)DlgFind); |
---|
831 | } |
---|
832 | |
---|
833 | void MainFrame::OnCmdPermutation( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
834 | { |
---|
835 | DialogBox(hResInst,MAKEINTRESOURCE(IDD_PERMUTATION),m_hWnd,(DLGPROC)DlgPermutation); |
---|
836 | } |
---|
837 | |
---|
838 | void MainFrame::OnCmdConvertX( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
839 | { |
---|
840 | TextEdit_Convert( nID ); |
---|
841 | } |
---|
842 | |
---|
843 | #ifdef THETEXT |
---|
844 | void MainFrame::OnCmdStringCount( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
845 | { |
---|
846 | DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_STRING_COUNT),m_hWnd,(DLGPROC)DlgStringCount,0); |
---|
847 | } |
---|
848 | |
---|
849 | void MainFrame::OnCmdSelStringCount( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
850 | { |
---|
851 | DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_STRING_COUNT),m_hWnd,(DLGPROC)DlgStringCount,1); |
---|
852 | } |
---|
853 | #endif |
---|
854 | |
---|
855 | void MainFrame::OnCmdProjectView( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
856 | { |
---|
857 | extern HWND hProjectView; |
---|
858 | bool isCheck = false; |
---|
859 | if(pobj_nv->bClipProjectView){ |
---|
860 | if(::IsWindowVisible(hProjectView)){ |
---|
861 | ::ShowWindow(hProjectView,SW_HIDE); |
---|
862 | } |
---|
863 | else{ |
---|
864 | ::ShowWindow(hProjectView,SW_SHOW); |
---|
865 | isCheck = true; |
---|
866 | } |
---|
867 | } |
---|
868 | else{ |
---|
869 | extern HWND hProjectView_ToolWindow; |
---|
870 | if(::IsWindowVisible(hProjectView_ToolWindow)){ |
---|
871 | ::ShowWindow(hProjectView_ToolWindow,SW_HIDE); |
---|
872 | } |
---|
873 | else{ |
---|
874 | ::ShowWindow(hProjectView_ToolWindow,SW_SHOW); |
---|
875 | ::ShowWindow(hProjectView,SW_SHOW); |
---|
876 | isCheck = true; |
---|
877 | } |
---|
878 | } |
---|
879 | pobj_MainMenu->CheckMenu(IDM_PROJECTVIEW,isCheck); |
---|
880 | |
---|
881 | //再配置 |
---|
882 | ResizeOwnerWnd(); |
---|
883 | |
---|
884 | ::ShowWindow(hClient,SW_SHOW); |
---|
885 | } |
---|
886 | |
---|
887 | void MainFrame::OnCmdProjectOption( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
888 | { |
---|
889 | DlgProjectOptionSetting( m_hWnd ); |
---|
890 | } |
---|
891 | |
---|
892 | void MainFrame::OnCmdTopMost( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
893 | { |
---|
894 | if(pobj_MainMenu->IsCheck(IDM_TOPMOST)){ |
---|
895 | SetWindowPos( HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); |
---|
896 | pobj_MainMenu->CheckMenu(IDM_TOPMOST,0); |
---|
897 | } |
---|
898 | else{ |
---|
899 | SetWindowPos( HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); |
---|
900 | pobj_MainMenu->CheckMenu(IDM_TOPMOST,1); |
---|
901 | } |
---|
902 | } |
---|
903 | |
---|
904 | void ResetState_ViewMenu(void); |
---|
905 | void MainFrame::OnCmdRightTurn( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
906 | { |
---|
907 | pobj_nv->bRightTurn^=1; |
---|
908 | ResetState_ViewMenu(); |
---|
909 | |
---|
910 | //トップのウィンドウを再描画 |
---|
911 | RedrawAllWindow(); |
---|
912 | } |
---|
913 | |
---|
914 | void MainFrame::OnCmdSet( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
915 | { |
---|
916 | DlgOptionSetting( m_hWnd ); |
---|
917 | } |
---|
918 | |
---|
919 | void CreateProcessWithStdHandle( const std::string &appPath, const std::string &cmdLine) |
---|
920 | { |
---|
921 | std::string argsStr = (std::string)"\"" + appPath + "\" " + cmdLine; |
---|
922 | STARTUPINFO si; |
---|
923 | PROCESS_INFORMATION pi; |
---|
924 | memset(&si,0,sizeof(STARTUPINFO)); |
---|
925 | si.cb=sizeof(STARTUPINFO); |
---|
926 | si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; |
---|
927 | si.wShowWindow = SW_HIDE; |
---|
928 | si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); |
---|
929 | si.hStdInput = GetStdHandle(STD_INPUT_HANDLE); |
---|
930 | si.hStdError = GetStdHandle(STD_ERROR_HANDLE); |
---|
931 | |
---|
932 | char args[8192]; |
---|
933 | lstrcpy( args, argsStr.c_str() ); |
---|
934 | |
---|
935 | CreateProcess( NULL, args, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi ); |
---|
936 | } |
---|
937 | |
---|
938 | #ifndef THETEXT |
---|
939 | void MainFrame::OnCmdDebug( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
940 | { |
---|
941 | char temporary[1024], temp2[1024], temp3[1024]; |
---|
942 | if(pobj_Debugger->IsDebugging()){ |
---|
943 | pobj_Debugger->DebugContinue(); |
---|
944 | return; |
---|
945 | } |
---|
946 | |
---|
947 | HWND hChild = ::GetWindow(hClient,GW_CHILD); |
---|
948 | if( projectInfo.IsOpened() ){ |
---|
949 | //プロジェクトが開かれている場合 |
---|
950 | if(!SetProjectToRun()) return; |
---|
951 | |
---|
952 | //デバッグ用のコマンドライン及び実行可能ファイル(DLLのみ) |
---|
953 | sprintf(temporary,"%s\r\n%s",projectInfo.szExePath,projectInfo.szCmdLine); |
---|
954 | sprintf(temp2,"%spgm.tmp",pj_editor_Dir); |
---|
955 | HANDLE hFile=CreateFile(temp2,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_TEMPORARY,NULL); |
---|
956 | DWORD dwAccessBytes; |
---|
957 | WriteFile(hFile,temporary,lstrlen(temporary),&dwAccessBytes,NULL); |
---|
958 | CloseHandle(hFile); |
---|
959 | |
---|
960 | //ソースファイル名をtemp2へ |
---|
961 | projectInfo.pobj_DBFileInfo->ppobj_FileInfo[0]->GetFullPath(temp2); |
---|
962 | |
---|
963 | //出力ファイル名をtemp3へ |
---|
964 | lstrcpy(temp3,projectInfo.lpszOutput_Debug); |
---|
965 | lstrcpy( temp3, projectInfo.GetWorkDir().GetFullPath( temp3 ).c_str() ); |
---|
966 | |
---|
967 | if(IsNeedCompileForProject(1)) |
---|
968 | sprintf(temporary,"\"%s\" \"%s\" /debug /run /wnd:%08x",temp2,temp3,m_hWnd); |
---|
969 | else |
---|
970 | sprintf(temporary,"\"%s\" \"%s\" /run /wnd:%08x",temp2,temp3,m_hWnd); |
---|
971 | |
---|
972 | // DLLオプション |
---|
973 | if( projectInfo.GetModuleType() == ActiveBasic::Common::TargetModuleType::Dll ) |
---|
974 | { |
---|
975 | lstrcat(temporary," /dll"); |
---|
976 | } |
---|
977 | |
---|
978 | // SLLオプション |
---|
979 | if( projectInfo.GetModuleType() == ActiveBasic::Common::TargetModuleType::Sll ) |
---|
980 | { |
---|
981 | lstrcat(temporary," /static_library"); |
---|
982 | } |
---|
983 | |
---|
984 | //Unicodeオプション |
---|
985 | if(projectInfo.dwOption & PJ_OP_UNICODE) lstrcat(temporary," /unicode"); |
---|
986 | |
---|
987 | //ブレークポイントをセーブ |
---|
988 | projectInfo.pobj_DBBreakPoint->SaveToTempFile(); |
---|
989 | } |
---|
990 | else{ |
---|
991 | //単独ソースコード |
---|
992 | if(!SetRunning(hChild)) return; |
---|
993 | if(IsNeedCompile(MdiInfo[GetWndNum(hChild)].path,1)) |
---|
994 | sprintf(temporary,"\"%s\" /debug /run /wnd:%08x",MdiInfo[GetWndNum(hChild)].path.c_str(),m_hWnd); |
---|
995 | else |
---|
996 | sprintf(temporary,"\"%s\" /run /wnd:%08x",MdiInfo[GetWndNum(hChild)].path.c_str(),m_hWnd); |
---|
997 | |
---|
998 | //ブレークポイントをセーブ |
---|
999 | extern CDBBreakPoint *pobj_DBBreakPoint; |
---|
1000 | pobj_DBBreakPoint->SaveToTempFile(); |
---|
1001 | } |
---|
1002 | |
---|
1003 | //コンパイルビューをクリップするかどうか |
---|
1004 | extern BOOL bClipCompileView; |
---|
1005 | if(bClipCompileView){ |
---|
1006 | lstrcat(temporary," /clip_compile_view"); |
---|
1007 | |
---|
1008 | //コンパイラビューを閉じる |
---|
1009 | extern HWND hCompileView; |
---|
1010 | if(hCompileView==(HWND)-1) return; |
---|
1011 | if(hCompileView){ |
---|
1012 | hChild=hCompileView; |
---|
1013 | hCompileView=(HWND)-1; |
---|
1014 | SendMessage(hChild,WM_COMMAND,IDCANCEL,0); |
---|
1015 | } |
---|
1016 | |
---|
1017 | //重複起動防止のため |
---|
1018 | hCompileView=(HWND)-1; |
---|
1019 | } |
---|
1020 | |
---|
1021 | //インクルードディレクトリ |
---|
1022 | sprintf(temp2," /include_dir:\"%s\"",pobj_nv->GetIncludeDirFullPath().c_str()); |
---|
1023 | lstrcat(temporary,temp2); |
---|
1024 | |
---|
1025 | extern ActiveBasic::Common::Platform::EnumType selectingPlatform; |
---|
1026 | CreateProcessWithStdHandle( ActiveBasic::Common::Environment::GetCompilerExePath( selectingPlatform ), temporary ); |
---|
1027 | } |
---|
1028 | |
---|
1029 | void MainFrame::OnCmdDebugCompile( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1030 | { |
---|
1031 | char temporary[1024], temp2[1024], temp3[1024]; |
---|
1032 | |
---|
1033 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1034 | if( projectInfo.IsOpened() ){ |
---|
1035 | //プロジェクトが開かれている場合 |
---|
1036 | if(!SetProjectToRun()) return; |
---|
1037 | |
---|
1038 | //ソースファイル名をtemp2へ |
---|
1039 | projectInfo.pobj_DBFileInfo->ppobj_FileInfo[0]->GetFullPath(temp2); |
---|
1040 | |
---|
1041 | //出力ファイル名をtemp3へ |
---|
1042 | lstrcpy(temp3,projectInfo.lpszOutput_Debug); |
---|
1043 | lstrcpy( temp3, projectInfo.GetWorkDir().GetFullPath( temp3 ).c_str() ); |
---|
1044 | |
---|
1045 | sprintf(temporary,"\"%s\" \"%s\" /debug /wnd:%08x",temp2,temp3,m_hWnd); |
---|
1046 | |
---|
1047 | //DLLオプション |
---|
1048 | if( projectInfo.GetModuleType() == ActiveBasic::Common::TargetModuleType::Dll ) |
---|
1049 | { |
---|
1050 | lstrcat(temporary," /dll"); |
---|
1051 | } |
---|
1052 | |
---|
1053 | //Unicodeオプション |
---|
1054 | if(projectInfo.dwOption & PJ_OP_UNICODE) lstrcat(temporary," /unicode"); |
---|
1055 | } |
---|
1056 | else{ |
---|
1057 | //単独ソースコード |
---|
1058 | if(!SetRunning(hChild)) return; |
---|
1059 | sprintf(temporary,"\"%s\" /debug /wnd:%08x",MdiInfo[GetWndNum(hChild)].path.c_str(),m_hWnd); |
---|
1060 | } |
---|
1061 | |
---|
1062 | //コンパイルビューをクリップするかどうか |
---|
1063 | extern BOOL bClipCompileView; |
---|
1064 | if(bClipCompileView){ |
---|
1065 | lstrcat(temporary," /clip_compile_view"); |
---|
1066 | |
---|
1067 | //コンパイラビューを閉じる |
---|
1068 | extern HWND hCompileView; |
---|
1069 | if(hCompileView==(HWND)-1) return; |
---|
1070 | if(hCompileView){ |
---|
1071 | hChild=hCompileView; |
---|
1072 | hCompileView=(HWND)-1; |
---|
1073 | if( ::IsWindow( hChild ) ) |
---|
1074 | { |
---|
1075 | SendMessage(hChild,WM_COMMAND,IDCANCEL,0); |
---|
1076 | } |
---|
1077 | } |
---|
1078 | |
---|
1079 | //重複起動防止のため |
---|
1080 | hCompileView=(HWND)-1; |
---|
1081 | } |
---|
1082 | |
---|
1083 | //インクルードディレクトリ |
---|
1084 | sprintf(temp2," /include_dir:\"%s\"",pobj_nv->GetIncludeDirFullPath().c_str()); |
---|
1085 | lstrcat(temporary,temp2); |
---|
1086 | |
---|
1087 | extern ActiveBasic::Common::Platform::EnumType selectingPlatform; |
---|
1088 | CreateProcessWithStdHandle( ActiveBasic::Common::Environment::GetCompilerExePath( selectingPlatform ), temporary ); |
---|
1089 | |
---|
1090 | } |
---|
1091 | |
---|
1092 | void MainFrame::OnCmdAttach( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1093 | { |
---|
1094 | char temporary[1024], temp2[1024]; |
---|
1095 | |
---|
1096 | int idProcess; |
---|
1097 | DWORD dwPlatform; |
---|
1098 | idProcess=DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_ATTACH),m_hWnd,(DLGPROC)DlgAttach,(LPARAM)&dwPlatform); |
---|
1099 | if(idProcess==0) return; |
---|
1100 | |
---|
1101 | sprintf(temporary,"/attach:%08x /wnd:%08x",idProcess,m_hWnd); |
---|
1102 | |
---|
1103 | //コンパイルビューをクリップするかどうか |
---|
1104 | extern BOOL bClipCompileView; |
---|
1105 | if(bClipCompileView){ |
---|
1106 | lstrcat(temporary," /clip_compile_view"); |
---|
1107 | |
---|
1108 | //コンパイラビューを閉じる |
---|
1109 | extern HWND hCompileView; |
---|
1110 | if(hCompileView==(HWND)-1) return; |
---|
1111 | if(hCompileView){ |
---|
1112 | HWND hChild=hCompileView; |
---|
1113 | hCompileView=(HWND)-1; |
---|
1114 | SendMessage(hChild,WM_COMMAND,IDCANCEL,0); |
---|
1115 | } |
---|
1116 | |
---|
1117 | //重複起動防止のため |
---|
1118 | hCompileView=(HWND)-1; |
---|
1119 | } |
---|
1120 | |
---|
1121 | //インクルードディレクトリ |
---|
1122 | sprintf(temp2," /include_dir:\"%s\"",pobj_nv->GetIncludeDirFullPath().c_str()); |
---|
1123 | lstrcat(temporary,temp2); |
---|
1124 | |
---|
1125 | ActiveBasic::Common::Platform::EnumType platform; |
---|
1126 | if(dwPlatform==IMAGE_FILE_MACHINE_I386) |
---|
1127 | { |
---|
1128 | platform = ActiveBasic::Common::Platform::X86; |
---|
1129 | } |
---|
1130 | else if(dwPlatform==IMAGE_FILE_MACHINE_AMD64) |
---|
1131 | { |
---|
1132 | platform = ActiveBasic::Common::Platform::X64; |
---|
1133 | } |
---|
1134 | else |
---|
1135 | { |
---|
1136 | throw; |
---|
1137 | } |
---|
1138 | |
---|
1139 | extern ActiveBasic::Common::Platform::EnumType selectingPlatform; |
---|
1140 | CreateProcessWithStdHandle( ActiveBasic::Common::Environment::GetCompilerExePath( platform ), temporary ); |
---|
1141 | } |
---|
1142 | |
---|
1143 | void MainFrame::OnCmdReleaseCompile( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1144 | { |
---|
1145 | char temporary[1024], temp2[1024], temp3[1024]; |
---|
1146 | |
---|
1147 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1148 | if( projectInfo.IsOpened() ){ |
---|
1149 | //プロジェクトが開かれている場合 |
---|
1150 | if(!SetProjectToRun()) return; |
---|
1151 | |
---|
1152 | //ソースファイル名をtemp2へ |
---|
1153 | projectInfo.pobj_DBFileInfo->ppobj_FileInfo[0]->GetFullPath(temp2); |
---|
1154 | |
---|
1155 | //出力ファイル名をtemp3へ |
---|
1156 | lstrcpy(temp3,projectInfo.lpszOutput_Release); |
---|
1157 | lstrcpy( temp3, projectInfo.GetWorkDir().GetFullPath( temp3 ).c_str() ); |
---|
1158 | |
---|
1159 | sprintf(temporary,"\"%s\" \"%s\" /wnd:%08x",temp2,temp3,m_hWnd); |
---|
1160 | |
---|
1161 | //DLLオプション |
---|
1162 | if( projectInfo.GetModuleType() == ActiveBasic::Common::TargetModuleType::Dll ) |
---|
1163 | { |
---|
1164 | lstrcat(temporary," /dll"); |
---|
1165 | } |
---|
1166 | |
---|
1167 | //Unicodeオプション |
---|
1168 | if(projectInfo.dwOption & PJ_OP_UNICODE) lstrcat(temporary," /unicode"); |
---|
1169 | } |
---|
1170 | else{ |
---|
1171 | //単独ソースコード |
---|
1172 | if(!SetRunning(hChild)) return; |
---|
1173 | sprintf(temporary,"\"%s\" /wnd:%08x",MdiInfo[GetWndNum(hChild)].path.c_str(),m_hWnd); |
---|
1174 | } |
---|
1175 | |
---|
1176 | //コンパイルビューをクリップするかどうか |
---|
1177 | extern BOOL bClipCompileView; |
---|
1178 | if(bClipCompileView){ |
---|
1179 | lstrcat(temporary," /clip_compile_view"); |
---|
1180 | |
---|
1181 | //コンパイラビューを閉じる |
---|
1182 | extern HWND hCompileView; |
---|
1183 | if(hCompileView==(HWND)-1) return; |
---|
1184 | if(hCompileView){ |
---|
1185 | hChild=hCompileView; |
---|
1186 | hCompileView=(HWND)-1; |
---|
1187 | SendMessage(hChild,WM_COMMAND,IDCANCEL,0); |
---|
1188 | } |
---|
1189 | |
---|
1190 | //重複起動防止のため |
---|
1191 | hCompileView=(HWND)-1; |
---|
1192 | } |
---|
1193 | |
---|
1194 | //インクルードディレクトリ |
---|
1195 | sprintf(temp2," /include_dir:\"%s\"",pobj_nv->GetIncludeDirFullPath().c_str()); |
---|
1196 | lstrcat(temporary,temp2); |
---|
1197 | |
---|
1198 | extern ActiveBasic::Common::Platform::EnumType selectingPlatform; |
---|
1199 | CreateProcessWithStdHandle( ActiveBasic::Common::Environment::GetCompilerExePath( selectingPlatform ), temporary ); |
---|
1200 | } |
---|
1201 | |
---|
1202 | void MainFrame::OnCmdReleaseRun( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1203 | { |
---|
1204 | char temporary[1024], temp2[1024], temp3[1024]; |
---|
1205 | |
---|
1206 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1207 | if( projectInfo.IsOpened() ){ |
---|
1208 | /* //プロジェクトが開かれている場合 |
---|
1209 | if(!SetProjectToRun()) return; |
---|
1210 | |
---|
1211 | //必要であればリリースコンパイル |
---|
1212 | if(IsNeedCompileForProject(0)) |
---|
1213 | SendMessage(WM_COMMAND,IDM_RELEASECOMPILE,0);*/ |
---|
1214 | |
---|
1215 | if( projectInfo.GetModuleType() == ActiveBasic::Common::TargetModuleType::Dll ) |
---|
1216 | { |
---|
1217 | lstrcpy(temporary,projectInfo.szExePath); |
---|
1218 | } |
---|
1219 | else{ |
---|
1220 | lstrcpy(temporary,projectInfo.lpszOutput_Debug); |
---|
1221 | lstrcpy( temporary, projectInfo.GetWorkDir().GetFullPath( temporary ).c_str() ); |
---|
1222 | } |
---|
1223 | } |
---|
1224 | else{ |
---|
1225 | /* //必要であればリリースコンパイル |
---|
1226 | if(!SetRunning(hChild)) return; |
---|
1227 | |
---|
1228 | if(IsNeedCompile(MdiInfo[GetWndNum(hChild)].path,0)) |
---|
1229 | SendMessage(WM_COMMAND,IDM_RELEASECOMPILE,0);*/ |
---|
1230 | |
---|
1231 | //単独ソースコード |
---|
1232 | _splitpath(MdiInfo[GetWndNum(hChild)].path.c_str(),temporary,temp2,temp3,NULL); |
---|
1233 | lstrcat(temporary,temp2); |
---|
1234 | lstrcat(temporary,temp3); |
---|
1235 | lstrcat(temporary,".exe"); |
---|
1236 | } |
---|
1237 | |
---|
1238 | //インクルードディレクトリ |
---|
1239 | sprintf(temp2," /include_dir:\"%s\"",pobj_nv->GetIncludeDirFullPath().c_str()); |
---|
1240 | lstrcat(temporary,temp2); |
---|
1241 | |
---|
1242 | ShellExecute(m_hWnd,"open",temporary,NULL,NULL,SW_SHOWNORMAL); |
---|
1243 | } |
---|
1244 | |
---|
1245 | void MainFrame::OnCmdStepIn( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1246 | { |
---|
1247 | pobj_Debugger->StepIn(); |
---|
1248 | } |
---|
1249 | |
---|
1250 | void MainFrame::OnCmdStepOver( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1251 | { |
---|
1252 | pobj_Debugger->StepOver(); |
---|
1253 | } |
---|
1254 | |
---|
1255 | void MainFrame::OnCmdStepCursor( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1256 | { |
---|
1257 | pobj_Debugger->StepToCursor(); |
---|
1258 | } |
---|
1259 | |
---|
1260 | void MainFrame::OnCmdBreakPoint( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1261 | { |
---|
1262 | if( projectInfo.IsOpened() ){ |
---|
1263 | projectInfo.pobj_DBBreakPoint->Event_BreakPoint(); |
---|
1264 | } |
---|
1265 | else{ |
---|
1266 | extern CDBBreakPoint *pobj_DBBreakPoint; |
---|
1267 | pobj_DBBreakPoint->Event_BreakPoint(); |
---|
1268 | } |
---|
1269 | } |
---|
1270 | |
---|
1271 | void MainFrame::OnCmdDebugStop( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1272 | { |
---|
1273 | pobj_Debugger->DebugStop(); |
---|
1274 | } |
---|
1275 | |
---|
1276 | void MainFrame::OnCmdDebugPause( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1277 | { |
---|
1278 | pobj_Debugger->DebugPause(); |
---|
1279 | } |
---|
1280 | |
---|
1281 | #endif // not THETEXT |
---|
1282 | |
---|
1283 | void MainFrame::OnCmdWebLink( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1284 | { |
---|
1285 | switch( nID ) |
---|
1286 | { |
---|
1287 | #ifndef THETEXT |
---|
1288 | case IDM_COMMUNITY: |
---|
1289 | OpenWebBrowser( "http://www.activebasic.com/forum/" ); |
---|
1290 | break; |
---|
1291 | case IDM_COMMU_SEARCH: |
---|
1292 | OpenWebBrowser( "http://www.activebasic.com/forum/search.php" ); |
---|
1293 | break; |
---|
1294 | case IDM_COMMU_PM: |
---|
1295 | OpenWebBrowser( "http://www.activebasic.com/forum/privmsg.php?folder=inbox" ); |
---|
1296 | break; |
---|
1297 | case ID_COMMU_FORUM1: |
---|
1298 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=1" ); |
---|
1299 | break; |
---|
1300 | case ID_COMMU_FORUM2: |
---|
1301 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=2" ); |
---|
1302 | break; |
---|
1303 | case ID_COMMU_FORUM3: |
---|
1304 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=5" ); |
---|
1305 | break; |
---|
1306 | case ID_COMMU_FORUM4: |
---|
1307 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=3" ); |
---|
1308 | break; |
---|
1309 | case ID_COMMU_FORUM5: |
---|
1310 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=6" ); |
---|
1311 | break; |
---|
1312 | case ID_COMMU_FORUM6: |
---|
1313 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=8" ); |
---|
1314 | break; |
---|
1315 | case ID_COMMU_FORUM7: |
---|
1316 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=4" ); |
---|
1317 | break; |
---|
1318 | case ID_COMMU_FORUM8: |
---|
1319 | OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=7" ); |
---|
1320 | break; |
---|
1321 | case IDM_AB_WEBSITE: |
---|
1322 | OpenWebBrowser( "http://www.activebasic.com/" ); |
---|
1323 | break; |
---|
1324 | case IDM_ACTBDL: |
---|
1325 | OpenWebBrowser( "http://www.activebasic.com/activebasic5/download.htm" ); |
---|
1326 | break; |
---|
1327 | #else |
---|
1328 | case IDM_DSHOMEPAGE: |
---|
1329 | OpenWebBrowser( "http://www.discoversoft.net/" ); |
---|
1330 | break; |
---|
1331 | #endif // not THETEXT |
---|
1332 | default: |
---|
1333 | throw; |
---|
1334 | } |
---|
1335 | } |
---|
1336 | |
---|
1337 | void MainFrame::OnCmdTopics( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1338 | { |
---|
1339 | char temporary[1024]; |
---|
1340 | #ifdef THETEXT |
---|
1341 | sprintf(temporary,"%sTopics\\index.html",pj_editor_Dir); |
---|
1342 | ShellExecute(m_hWnd,"open",temporary,NULL,NULL,SW_SHOWNORMAL); |
---|
1343 | #else |
---|
1344 | sprintf(temporary,"%sBasicHelp.chm",pj_editor_Dir); |
---|
1345 | HtmlHelp(NULL,temporary,HH_DISPLAY_TOPIC,0); |
---|
1346 | #endif |
---|
1347 | } |
---|
1348 | |
---|
1349 | void MainFrame::OnCmdAbout( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1350 | { |
---|
1351 | DialogBox(hResInst,MAKEINTRESOURCE(IDD_ABOUT),m_hWnd,(DLGPROC)DialogAbout); |
---|
1352 | } |
---|
1353 | |
---|
1354 | void MainFrame::OnCmdDocSelectBand( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1355 | { |
---|
1356 | pobj_Rebar->ChangeRebarBand(ID_DOCCOMBO); |
---|
1357 | } |
---|
1358 | |
---|
1359 | void MainFrame::OnCmdStandardBand( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1360 | { |
---|
1361 | pobj_Rebar->ChangeRebarBand(ID_STANDARDTOOLBAR); |
---|
1362 | } |
---|
1363 | |
---|
1364 | void MainFrame::OnCmdReleaseBand( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1365 | { |
---|
1366 | pobj_Rebar->ChangeRebarBand(ID_RELEASETOOLBAR); |
---|
1367 | } |
---|
1368 | |
---|
1369 | void MainFrame::OnCmdDebugBand( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1370 | { |
---|
1371 | pobj_Rebar->ChangeRebarBand(ID_DEBUGGERTOOLBAR); |
---|
1372 | } |
---|
1373 | |
---|
1374 | void MainFrame::OnCmdSelectCompilerBand( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1375 | { |
---|
1376 | pobj_Rebar->ChangeRebarBand(ID_SELECTCOMPILERCOMBO); |
---|
1377 | } |
---|
1378 | |
---|
1379 | void MainFrame::OnCmdNoGripper( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1380 | { |
---|
1381 | if(pobj_nv->bNoGripper) pobj_nv->bNoGripper=0; |
---|
1382 | else pobj_nv->bNoGripper=1; |
---|
1383 | |
---|
1384 | //レバーコントロールを再生成 |
---|
1385 | pobj_Rebar->ResetRebar(); |
---|
1386 | |
---|
1387 | //メニュー状態を設定 |
---|
1388 | ResetState_DocMenu(); |
---|
1389 | } |
---|
1390 | |
---|
1391 | void MainFrame::OnCmdResetRebar( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1392 | { |
---|
1393 | //"ツールバーの配置をすべて初期状態に戻します。\nよろしいですか?" |
---|
1394 | if( MessageBox(STRING_TOOLBAR_RESET,APPLICATION_NAME,MB_OKCANCEL|MB_ICONEXCLAMATION) == IDCANCEL ) |
---|
1395 | { |
---|
1396 | return; |
---|
1397 | } |
---|
1398 | |
---|
1399 | //レバーコントロールを再生成 |
---|
1400 | pobj_Rebar->ResetInitRebar(); |
---|
1401 | |
---|
1402 | //メニュー状態を設定 |
---|
1403 | ResetState_DocMenu(); |
---|
1404 | } |
---|
1405 | |
---|
1406 | void MainFrame::OnCmdAllCloseOmitMyself( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1407 | { |
---|
1408 | //このウィンドウ以外をすべて閉じる(&A) |
---|
1409 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1410 | int WndNum=GetWndNum(hChild); |
---|
1411 | for(int i=0;i<MdiInfo.size();i++){ |
---|
1412 | if(i==WndNum) continue; |
---|
1413 | if(MdiInfo[i].hwnd) SendMessage(MdiInfo[i].hwnd,WM_CLOSE,0,0); |
---|
1414 | } |
---|
1415 | } |
---|
1416 | |
---|
1417 | void MainFrame::OnCmdPathCopy( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1418 | { |
---|
1419 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1420 | int WndNum=GetWndNum(hChild); |
---|
1421 | |
---|
1422 | //絶対パスをコピー |
---|
1423 | HGLOBAL hGlobal=(char *)GlobalAlloc(GMEM_MOVEABLE,MdiInfo[WndNum].path.size()+1); |
---|
1424 | char *pTemp=(char *)GlobalLock(hGlobal); |
---|
1425 | lstrcpy(pTemp,MdiInfo[WndNum].path.c_str()); |
---|
1426 | GlobalUnlock(hGlobal); |
---|
1427 | |
---|
1428 | //クリップボードに保存 |
---|
1429 | OpenClipboard(); |
---|
1430 | EmptyClipboard(); |
---|
1431 | SetClipboardData(CF_TEXT,hGlobal); |
---|
1432 | CloseClipboard(); |
---|
1433 | } |
---|
1434 | |
---|
1435 | void MainFrame::OnCmdFolderOpen( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1436 | { |
---|
1437 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1438 | int WndNum=GetWndNum(hChild); |
---|
1439 | |
---|
1440 | char temporary[1024], temp2[1024]; |
---|
1441 | _splitpath(MdiInfo[WndNum].path.c_str(),temporary,temp2,NULL,NULL); |
---|
1442 | lstrcat(temporary,temp2); |
---|
1443 | |
---|
1444 | OpenExplorer( temporary ); |
---|
1445 | } |
---|
1446 | |
---|
1447 | void MainFrame::OnCmdDeleteFile( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1448 | { |
---|
1449 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1450 | int WndNum=GetWndNum(hChild); |
---|
1451 | |
---|
1452 | char temporary[1024], temp2[1024]; |
---|
1453 | _splitpath(MdiInfo[WndNum].path.c_str(),NULL,NULL,temporary,temp2); |
---|
1454 | lstrcat(temporary,temp2); |
---|
1455 | |
---|
1456 | lstrcat(temporary," をごみ箱に移動して閉じます。よろしいですか?"); |
---|
1457 | if(MessageBox(temporary,APPLICATION_NAME,MB_OKCANCEL|MB_ICONQUESTION)==IDCANCEL) return; |
---|
1458 | |
---|
1459 | //ゴミ箱へ |
---|
1460 | SHFILEOPSTRUCT fo; |
---|
1461 | fo.hwnd=m_hWnd; |
---|
1462 | fo.wFunc=FO_DELETE; |
---|
1463 | fo.pFrom =MdiInfo[WndNum].path.c_str(); |
---|
1464 | fo.pTo="\0"; |
---|
1465 | fo.fFlags =FOF_ALLOWUNDO|FOF_NOCONFIRMATION; |
---|
1466 | SHFileOperation(&fo); |
---|
1467 | |
---|
1468 | //閉じる |
---|
1469 | MdiInfo[WndNum].pMdiTextEdit->UnModify(); |
---|
1470 | SendMessage(MdiInfo[WndNum].hwnd,WM_CLOSE,0,0); |
---|
1471 | } |
---|
1472 | |
---|
1473 | void MainFrame::OnCmdColor( UINT uNotifyCode, int nID, CWindow wndCtl ) |
---|
1474 | { |
---|
1475 | static COLORREF colorUser=RGB(255,255,255); |
---|
1476 | |
---|
1477 | switch( nID ) |
---|
1478 | { |
---|
1479 | case IDM_USER_COLOR: |
---|
1480 | { |
---|
1481 | CHOOSECOLOR cc; |
---|
1482 | COLORREF CusColors[16]={ |
---|
1483 | RGB(255,255,255), |
---|
1484 | RGB(0,0,0), |
---|
1485 | RGB(128,128,128), |
---|
1486 | RGB(192,192,192), |
---|
1487 | RGB(128,0,0), |
---|
1488 | RGB(255,0,0), |
---|
1489 | RGB(128,128,0), |
---|
1490 | RGB(255,255,0), |
---|
1491 | RGB(0,128,0), |
---|
1492 | RGB(0,255,0), |
---|
1493 | RGB(0,128,128), |
---|
1494 | RGB(0,255,255), |
---|
1495 | RGB(0,0,128), |
---|
1496 | RGB(0,0,255), |
---|
1497 | RGB(128,0,128), |
---|
1498 | RGB(255,0,255)}; |
---|
1499 | cc.lStructSize=sizeof(CHOOSECOLOR); |
---|
1500 | cc.hwndOwner=m_hWnd; |
---|
1501 | cc.rgbResult=colorUser; |
---|
1502 | cc.lpCustColors=CusColors; |
---|
1503 | cc.Flags=CC_RGBINIT|CC_FULLOPEN; |
---|
1504 | if(!ChooseColor(&cc)){ |
---|
1505 | return; |
---|
1506 | } |
---|
1507 | colorUser=cc.rgbResult; |
---|
1508 | } |
---|
1509 | case IDM_GRAY: |
---|
1510 | case IDM_WHITE: |
---|
1511 | case IDM_RED: |
---|
1512 | case IDM_GREEN: |
---|
1513 | case IDM_BLUE: |
---|
1514 | case IDM_YELLOW: |
---|
1515 | { |
---|
1516 | HWND hChild=::GetWindow(hClient,GW_CHILD); |
---|
1517 | int WndNum=GetWndNum(hChild); |
---|
1518 | |
---|
1519 | TC_ITEM tcItem; |
---|
1520 | tcItem.mask=TCIF_PARAM; |
---|
1521 | if(nID==IDM_GRAY) tcItem.lParam=TABCOLOR_GRAY; |
---|
1522 | if(nID==IDM_WHITE) tcItem.lParam=TABCOLOR_WHITE; |
---|
1523 | if(nID==IDM_RED) tcItem.lParam=TABCOLOR_RED; |
---|
1524 | if(nID==IDM_GREEN) tcItem.lParam=TABCOLOR_GREEN; |
---|
1525 | if(nID==IDM_BLUE) tcItem.lParam=TABCOLOR_BLUE; |
---|
1526 | if(nID==IDM_YELLOW) tcItem.lParam=TABCOLOR_YELLOW; |
---|
1527 | if(nID==IDM_USER_COLOR) tcItem.lParam=colorUser; |
---|
1528 | TabCtrl_SetItem(pobj_MainTab->hTab, |
---|
1529 | TabCtrl_GetCurSel(pobj_MainTab->hTab), |
---|
1530 | &tcItem); |
---|
1531 | ::InvalidateRect(pobj_MainTab->hTab,NULL,0); |
---|
1532 | break; |
---|
1533 | } |
---|
1534 | default: |
---|
1535 | throw; |
---|
1536 | } |
---|
1537 | } |
---|