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