- Timestamp:
- Apr 24, 2008, 1:33:12 PM (17 years ago)
- Location:
- trunk/ab5.0/abdev/abdev
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/abdev/abdev.cpp
r501 r503 1324 1324 WNDPROC oldMainFrameWndProc; 1325 1325 LRESULT CALLBACK WindowFunc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){ 1326 int i,i2,WndNum; 1327 char str[MAX_PATH],temporary[1024],temp2[MAX_PATH],*pTemp; 1328 HWND hChild; 1326 char str[MAX_PATH]; 1329 1327 RECT rect; 1330 1328 POINT pos; 1331 HDROP hDrop;1332 1333 static COLORREF colorUser=RGB(255,255,255);1334 1329 1335 1330 if(message==WM_COMMAND&&IS_FILEHISTORY_COMMAND(LOWORD(wParam))){ … … 1349 1344 switch(message) 1350 1345 { 1351 case WM_COMMAND:1352 switch(LOWORD(wParam)){1353 1354 1355 ////////////////////////////////////////////////////1356 // メイン タブ コントロールのサブメニューコマンド1357 ////////////////////////////////////////////////////1358 1359 1360 case IDM_USER_COLOR:1361 {1362 CHOOSECOLOR cc;1363 COLORREF CusColors[16]={1364 RGB(255,255,255),1365 RGB(0,0,0),1366 RGB(128,128,128),1367 RGB(192,192,192),1368 RGB(128,0,0),1369 RGB(255,0,0),1370 RGB(128,128,0),1371 RGB(255,255,0),1372 RGB(0,128,0),1373 RGB(0,255,0),1374 RGB(0,128,128),1375 RGB(0,255,255),1376 RGB(0,0,128),1377 RGB(0,0,255),1378 RGB(128,0,128),1379 RGB(255,0,255)};1380 cc.lStructSize=sizeof(CHOOSECOLOR);1381 cc.hwndOwner=hwnd;1382 cc.rgbResult=colorUser;1383 cc.lpCustColors=CusColors;1384 cc.Flags=CC_RGBINIT|CC_FULLOPEN;1385 if(!ChooseColor(&cc)){1386 return 0;1387 }1388 colorUser=cc.rgbResult;1389 }1390 case IDM_GRAY:1391 case IDM_WHITE:1392 case IDM_RED:1393 case IDM_GREEN:1394 case IDM_BLUE:1395 case IDM_YELLOW:1396 hChild=GetWindow(hClient,GW_CHILD);1397 WndNum=GetWndNum(hChild);1398 1399 TC_ITEM tcItem;1400 tcItem.mask=TCIF_PARAM;1401 if(LOWORD(wParam)==IDM_GRAY) tcItem.lParam=TABCOLOR_GRAY;1402 if(LOWORD(wParam)==IDM_WHITE) tcItem.lParam=TABCOLOR_WHITE;1403 if(LOWORD(wParam)==IDM_RED) tcItem.lParam=TABCOLOR_RED;1404 if(LOWORD(wParam)==IDM_GREEN) tcItem.lParam=TABCOLOR_GREEN;1405 if(LOWORD(wParam)==IDM_BLUE) tcItem.lParam=TABCOLOR_BLUE;1406 if(LOWORD(wParam)==IDM_YELLOW) tcItem.lParam=TABCOLOR_YELLOW;1407 if(LOWORD(wParam)==IDM_USER_COLOR) tcItem.lParam=colorUser;1408 TabCtrl_SetItem(pobj_MainTab->hTab,1409 TabCtrl_GetCurSel(pobj_MainTab->hTab),1410 &tcItem);1411 InvalidateRect(pobj_MainTab->hTab,NULL,0);1412 return 0;1413 1414 1415 1416 //////////////////////////////////1417 // SideWeb1418 //////////////////////////////////1419 1420 case IDC_CLIP:1421 pobj_SideWeb->bShow=0;1422 ResizeOwnerWnd();1423 return 0;1424 }1425 break;1426 case WM_DROPFILES:1427 hDrop=(HDROP)wParam;1428 1429 i2=DragQueryFile(hDrop,-1,0,0);1430 for(i=0;i<i2;i++){1431 DragQueryFile(hDrop,i,str,MAX_PATH);1432 OpenFileWithExtension(str);1433 }1434 DragFinish(hDrop);1435 return 0;1436 case WM_SHOWERROR:1437 //エラー部分を反転表示1438 DWORD AccBytes;1439 HANDLE fh;1440 sprintf(temporary,"%spgm.tmp",pj_editor_Dir);1441 fh=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);1442 ReadFile(fh,temporary,MAX_PATH,&AccBytes,NULL);1443 CloseHandle(fh);1444 temporary[AccBytes]=0;1445 hChild=GetWindow(hClient,GW_CHILD);1446 while(hChild){1447 WndNum=GetWndNum(hChild);1448 if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){1449 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0) break;1450 }1451 hChild=GetNextWindow(hChild,GW_HWNDNEXT);1452 }1453 if(!hChild){1454 hChild=OpenFileWithExtension(temporary);1455 WndNum=GetWndNum(hChild);1456 }1457 1458 if(WndNum==-1) return 0;1459 1460 //ウィンドウを最前面に表示1461 BringWindowToTop(hChild);1462 UpdateWindow(hChild);1463 1464 pTemp=MdiInfo[WndNum].pMdiTextEdit->buffer;1465 1466 //行の先頭インデックスを取得(取得する行の番号はwParamで渡される)1467 for(i=0,i2=0;;i++){1468 if(i2>=(int)wParam) break;1469 if(pTemp[i]=='\0') break;1470 if(pTemp[i]=='\r'&&pTemp[i+1]=='\n'){1471 i++;1472 i2++;1473 }1474 }1475 pos.x=i;1476 1477 //行の終端インデックスを取得1478 for(;;i++){1479 if(pTemp[i]=='\0') break;1480 if(pTemp[i]=='\r'&&pTemp[i+1]=='\n') break;1481 }1482 pos.y=i;1483 1484 //行を選択する1485 TextEdit_SetSel(WndNum,pos.x,pos.y,TRUE);1486 1487 return 0;1488 1346 1489 1347 #ifndef THETEXT -
trunk/ab5.0/abdev/abdev/include/MainFrame.h
r501 r503 54 54 LRESULT OnNotify( int idCtrl, LPNMHDR pnmh ); 55 55 56 // ファイルがドロップされた 57 void OnDropFiles( HDROP hDropInfo ); 58 59 // ソースコード表示メッセージ 60 ::LRESULT OnShowSourceLine( ::UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled ); 61 56 62 // 「新規作成」メニューがクリックされた 57 63 void OnCmdNew( UINT uNotifyCode, int nID, CWindow wndCtl ); … … 224 230 // タブの「ファイルを削除」メニューがクリックされた 225 231 void OnCmdDeleteFile( UINT uNotifyCode, int nID, CWindow wndCtl ); 232 233 // タブの「タブの色」メニューがクリックされた 234 void OnCmdColor( UINT uNotifyCode, int nID, CWindow wndCtl ); 226 235 227 236 private: … … 238 247 MSG_WM_MEASUREITEM( OnMeasureItem ) 239 248 MSG_WM_DRAWITEM( OnDrawItem ) 240 241 249 MSG_WM_NOTIFY( OnNotify ); 250 MSG_WM_DROPFILES( OnDropFiles ) 251 MESSAGE_HANDLER( WM_SHOWERROR, OnShowSourceLine ) 242 252 243 253 COMMAND_ID_HANDLER_EX( IDM_NEW, OnCmdNew ) … … 335 345 COMMAND_ID_HANDLER_EX( IDM_FOLDER_OPEN, OnCmdFolderOpen ) 336 346 COMMAND_ID_HANDLER_EX( IDM_DELETE_FILE, OnCmdDeleteFile ) 347 COMMAND_ID_HANDLER_EX( IDM_USER_COLOR, OnCmdColor ) 348 COMMAND_ID_HANDLER_EX( IDM_GRAY, OnCmdColor ) 349 COMMAND_ID_HANDLER_EX( IDM_WHITE, OnCmdColor ) 350 COMMAND_ID_HANDLER_EX( IDM_RED, OnCmdColor ) 351 COMMAND_ID_HANDLER_EX( IDM_GREEN, OnCmdColor ) 352 COMMAND_ID_HANDLER_EX( IDM_BLUE, OnCmdColor ) 353 COMMAND_ID_HANDLER_EX( IDM_YELLOW, OnCmdColor ) 337 354 END_MSG_MAP() 338 355 }; -
trunk/ab5.0/abdev/abdev/src/MainFrame.cpp
r501 r503 349 349 } 350 350 } 351 352 return 0; 353 } 354 355 void MainFrame::OnDropFiles( HDROP hDropInfo ) 356 { 357 int max = DragQueryFile(hDropInfo,-1,0,0); 358 for(int i=0;i<max;i++){ 359 char temporary[1024]; 360 DragQueryFile(hDropInfo,i,temporary,MAX_PATH); 361 OpenFileWithExtension(temporary); 362 } 363 DragFinish(hDropInfo); 364 } 365 366 ::LRESULT MainFrame::OnShowSourceLine( ::UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled ) 367 { 368 char temporary[1024]; 369 370 //エラー部分を反転表示 371 DWORD AccBytes; 372 HANDLE fh; 373 sprintf(temporary,"%spgm.tmp",pj_editor_Dir); 374 fh=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); 375 ReadFile(fh,temporary,MAX_PATH,&AccBytes,NULL); 376 CloseHandle(fh); 377 temporary[AccBytes]=0; 378 HWND hChild=::GetWindow(hClient,GW_CHILD); 379 int WndNum = -1; 380 while(hChild){ 381 WndNum=GetWndNum(hChild); 382 if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){ 383 if(lstrcmpi(MdiInfo[WndNum].path,temporary)==0) break; 384 } 385 hChild=::GetNextWindow(hChild,GW_HWNDNEXT); 386 } 387 if(!hChild){ 388 hChild=OpenFileWithExtension(temporary); 389 WndNum=GetWndNum(hChild); 390 } 391 392 if(WndNum==-1) return 0; 393 394 //ウィンドウを最前面に表示 395 ::BringWindowToTop(hChild); 396 ::UpdateWindow(hChild); 397 398 char *pTemp=MdiInfo[WndNum].pMdiTextEdit->buffer; 399 400 //行の先頭インデックスを取得(取得する行の番号はwParamで渡される) 401 int i,i2; 402 for(i=0,i2=0;;i++){ 403 if(i2>=(int)wParam) break; 404 if(pTemp[i]=='\0') break; 405 if(pTemp[i]=='\r'&&pTemp[i+1]=='\n'){ 406 i++; 407 i2++; 408 } 409 } 410 POINT pos; 411 pos.x=i; 412 413 //行の終端インデックスを取得 414 for(;;i++){ 415 if(pTemp[i]=='\0') break; 416 if(pTemp[i]=='\r'&&pTemp[i+1]=='\n') break; 417 } 418 pos.y=i; 419 420 //行を選択する 421 TextEdit_SetSel(WndNum,pos.x,pos.y,TRUE); 351 422 352 423 return 0; … … 1366 1437 SendMessage(MdiInfo[WndNum].hwnd,WM_CLOSE,0,0); 1367 1438 } 1439 1440 void MainFrame::OnCmdColor( UINT uNotifyCode, int nID, CWindow wndCtl ) 1441 { 1442 static COLORREF colorUser=RGB(255,255,255); 1443 1444 switch( nID ) 1445 { 1446 case IDM_USER_COLOR: 1447 { 1448 CHOOSECOLOR cc; 1449 COLORREF CusColors[16]={ 1450 RGB(255,255,255), 1451 RGB(0,0,0), 1452 RGB(128,128,128), 1453 RGB(192,192,192), 1454 RGB(128,0,0), 1455 RGB(255,0,0), 1456 RGB(128,128,0), 1457 RGB(255,255,0), 1458 RGB(0,128,0), 1459 RGB(0,255,0), 1460 RGB(0,128,128), 1461 RGB(0,255,255), 1462 RGB(0,0,128), 1463 RGB(0,0,255), 1464 RGB(128,0,128), 1465 RGB(255,0,255)}; 1466 cc.lStructSize=sizeof(CHOOSECOLOR); 1467 cc.hwndOwner=m_hWnd; 1468 cc.rgbResult=colorUser; 1469 cc.lpCustColors=CusColors; 1470 cc.Flags=CC_RGBINIT|CC_FULLOPEN; 1471 if(!ChooseColor(&cc)){ 1472 return; 1473 } 1474 colorUser=cc.rgbResult; 1475 } 1476 case IDM_GRAY: 1477 case IDM_WHITE: 1478 case IDM_RED: 1479 case IDM_GREEN: 1480 case IDM_BLUE: 1481 case IDM_YELLOW: 1482 { 1483 HWND hChild=::GetWindow(hClient,GW_CHILD); 1484 int WndNum=GetWndNum(hChild); 1485 1486 TC_ITEM tcItem; 1487 tcItem.mask=TCIF_PARAM; 1488 if(nID==IDM_GRAY) tcItem.lParam=TABCOLOR_GRAY; 1489 if(nID==IDM_WHITE) tcItem.lParam=TABCOLOR_WHITE; 1490 if(nID==IDM_RED) tcItem.lParam=TABCOLOR_RED; 1491 if(nID==IDM_GREEN) tcItem.lParam=TABCOLOR_GREEN; 1492 if(nID==IDM_BLUE) tcItem.lParam=TABCOLOR_BLUE; 1493 if(nID==IDM_YELLOW) tcItem.lParam=TABCOLOR_YELLOW; 1494 if(nID==IDM_USER_COLOR) tcItem.lParam=colorUser; 1495 TabCtrl_SetItem(pobj_MainTab->hTab, 1496 TabCtrl_GetCurSel(pobj_MainTab->hTab), 1497 &tcItem); 1498 ::InvalidateRect(pobj_MainTab->hTab,NULL,0); 1499 break; 1500 } 1501 default: 1502 throw; 1503 } 1504 } -
trunk/ab5.0/abdev/abdev/stdafx.h
r499 r503 44 44 #endif 45 45 46 #include "Common.h" 47 46 48 #include <WindowComponents/BaseWindow.h> 47 49 #include <WindowComponents/MdiChild.h> … … 53 55 #include <MainFrame.h> 54 56 #include <Program.h> 55 56 #include "Common.h"
Note:
See TracChangeset
for help on using the changeset viewer.