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