Changeset 772 in dev
- Timestamp:
- Aug 29, 2009, 7:55:19 AM (15 years ago)
- Location:
- trunk/ab5.0/abdev/abdev
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/abdev/Backup.cpp
r629 r772 111 111 //ドキュメント セレクト コンボボックスから消去 112 112 extern HWND hDocCombo; 113 i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,( long)MdiInfo[WndNum]->title.c_str());113 i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(LPARAM)MdiInfo[WndNum]->title.c_str()); 114 114 SendMessage(hDocCombo,CB_DELETESTRING,i2,0); 115 115 … … 141 141 TabColor=pobj_nv->pobj_ExtLink->GetTabColorFromFilePath(MdiInfo[WndNum]->path); 142 142 pobj_MainTab->DeleteItem( szOldTitle, false ); 143 pobj_MainTab->InsertItem( MdiInfo[WndNum]->title.c_str(), false, TabColor );143 pobj_MainTab->InsertItem( hChild, MdiInfo[WndNum]->title.c_str(), false, TabColor ); 144 144 145 145 MdiInfo[WndNum]->pMdiTextEdit->Modify(); -
trunk/ab5.0/abdev/abdev/Common.h
r717 r772 727 727 728 728 //DrawBuffer.cpp 729 void TextEdit_DrawBuffer(HDC hdc,int WndNum );729 void TextEdit_DrawBuffer(HDC hdc,int WndNum,bool drawDirectly=false); 730 730 731 731 //TextEditor.cpp -
trunk/ab5.0/abdev/abdev/DrawBuffer.cpp
r771 r772 23 23 public: 24 24 HDC memdc; 25 CDrawReserve(int WndNum,HDC _hDC,int cx,int cy,int ctrl_tab_space,int nMaxOnePageChar,int linenum_textcount, BOOL isRemoteSession){25 CDrawReserve(int WndNum,HDC _hDC,int cx,int cy,int ctrl_tab_space,int nMaxOnePageChar,int linenum_textcount,bool drawDirectly){ 26 26 m_WndNum=WndNum; 27 27 x=-1; … … 34 34 iMax_OneLine_TextLength=cx/font_width+1; 35 35 iLineNumberTextCount=linenum_textcount; 36 if( isRemoteSession){36 if(drawDirectly){ 37 37 hdc=0; 38 memdc=_hDC; 38 memdc=_hDC; // メモリDCを使わず、直接描画する 39 39 } 40 40 else{ … … 273 273 }; 274 274 275 void TextEdit_DrawBuffer(HDC hdc,int WndNum ){275 void TextEdit_DrawBuffer(HDC hdc,int WndNum,bool drawDirectly){ 276 276 int i,i2; 277 277 int x,y; … … 307 307 OnePage_CharHeight, 308 308 iLineNumberTextCount, 309 GetSystemMetrics(SM_REMOTESESSION));309 drawDirectly || GetSystemMetrics(SM_REMOTESESSION)); 310 310 311 311 -
trunk/ab5.0/abdev/abdev/FileOperation.cpp
r717 r772 524 524 color=pobj_MainTab->GetItemColor(oldTitle.c_str()); 525 525 pobj_MainTab->DeleteItem( oldTitle.c_str(), false ); 526 pobj_MainTab->InsertItem( MdiInfo[WndNum]->title.c_str(), false, color );526 pobj_MainTab->InsertItem( hChild, MdiInfo[WndNum]->title.c_str(), false, color ); 527 527 } 528 528 else{ -
trunk/ab5.0/abdev/abdev/IconEditor.cpp
r705 r772 346 346 mdic.lParam=0; 347 347 mdic.style |= WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; 348 hChild=(HWND)SendMessage(hClient,WM_MDICREATE,0,( long)&mdic); //ウィンドウ作成348 hChild=(HWND)SendMessage(hClient,WM_MDICREATE,0,(LPARAM)&mdic); //ウィンドウ作成 349 349 350 350 //////////////////// … … 440 440 441 441 //タブに追加 442 pobj_MainTab->InsertItem( str, true );442 pobj_MainTab->InsertItem( hChild, str, true ); 443 443 444 444 SetStatusText(NULL); -
trunk/ab5.0/abdev/abdev/MenuProc.cpp
r629 r772 229 229 mdic.lParam=0; 230 230 mdic.style |= WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; 231 hChild=(HWND)SendMessage(hClient,WM_MDICREATE,0,( long)&mdic); //ウィンドウ作成231 hChild=(HWND)SendMessage(hClient,WM_MDICREATE,0,(LPARAM)&mdic); //ウィンドウ作成 232 232 233 233 … … 291 291 292 292 //タブに追加 293 pobj_MainTab->InsertItem( pMenuInfo->IdName, true );293 pobj_MainTab->InsertItem( hChild, pMenuInfo->IdName, true ); 294 294 295 295 SetFocus(hListWnd); -
trunk/ab5.0/abdev/abdev/RadProc.cpp
r629 r772 47 47 mdic.lParam=0; 48 48 mdic.style |= WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; 49 hChild=(HWND)SendMessage(hClient,WM_MDICREATE,0,( long)&mdic); //ウィンドウ作成49 hChild=(HWND)SendMessage(hClient,WM_MDICREATE,0,(LPARAM)&mdic); //ウィンドウ作成 50 50 51 51 … … 140 140 141 141 //タブに追加 142 pobj_MainTab->InsertItem( windowInfo.GetName().c_str(), true );142 pobj_MainTab->InsertItem( hChild, windowInfo.GetName().c_str(), true ); 143 143 144 144 //メニュー状態を設定 … … 784 784 SIZE size; 785 785 SCROLLINFO ScrollInfo,si2; 786 PAINTSTRUCT ps;787 786 POINTANDSIZE PointAndSize; 788 787 … … 793 792 794 793 SetFocus(hwnd); 795 mouse.x= LOWORD(lParam);796 mouse.y= HIWORD(lParam);794 mouse.x=GET_X_LPARAM(lParam); 795 mouse.y=GET_Y_LPARAM(lParam); 797 796 CursorPos_LocalToGlobal(hwnd,&mouse.x,&mouse.y); 798 797 … … 872 871 873 872 SetFocus(hwnd); 874 mouse.x= (int)(short)LOWORD(lParam);875 mouse.y= (int)(short)HIWORD(lParam);873 mouse.x=GET_X_LPARAM(lParam); 874 mouse.y=GET_Y_LPARAM(lParam); 876 875 CursorPos_LocalToGlobal(hwnd,&mouse.x,&mouse.y); 877 876 … … 1466 1465 case WM_MOUSEMOVE: 1467 1466 { 1468 mouse.x= (int)(short)LOWORD(lParam);1469 mouse.y= (int)(short)HIWORD(lParam);1467 mouse.x=GET_X_LPARAM(lParam); 1468 mouse.y=GET_Y_LPARAM(lParam); 1470 1469 CursorPos_LocalToGlobal(hwnd,&mouse.x,&mouse.y); 1471 1470 … … 1631 1630 case WM_LBUTTONDBLCLK: 1632 1631 { 1633 mouse.x= LOWORD(lParam);1634 mouse.y= HIWORD(lParam);1632 mouse.x=GET_X_LPARAM(lParam); 1633 mouse.y=GET_Y_LPARAM(lParam); 1635 1634 CursorPos_LocalToGlobal(hwnd,&mouse.x,&mouse.y); 1636 1635 … … 1816 1815 return 0; 1817 1816 case WM_PAINT: 1817 { 1818 WTL::CPaintDC dc(hwnd); 1819 SendMessage(hwnd, WM_PRINTCLIENT, reinterpret_cast<WPARAM>(dc.m_hDC), 0); 1820 return 0; 1821 } 1822 case WM_PRINTCLIENT: 1818 1823 i=GetWndNum(GetParent(hwnd)); 1819 if(i==-1) return 0; //ウィンドウが初期状態の場合1824 if(i==-1) break; //ウィンドウが初期状態の場合 1820 1825 i2=GetWndInfoNum(MdiInfo[i]->path); 1821 1826 … … 1827 1832 GetScrollInfo(hwnd,SB_HORZ,&si2); 1828 1833 1829 hdc= BeginPaint(hwnd,&ps);1834 hdc=reinterpret_cast<HDC>(wParam); 1830 1835 BitBlt(hdc,0,0,ScreenX*2,ScreenY*2, 1831 1836 MdiInfo[i]->MdiRadInfo->hMemDC,si2.nPos,ScrollInfo.nPos,SRCCOPY); 1832 EndPaint(hwnd,&ps);1833 1837 1834 1838 if(MdiInfo[i]->MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE||MdiInfo[i]->MdiRadInfo->ButtonSelect==NON_TOOL) … … 1845 1849 1846 1850 if(MdiInfo[i]->MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE){ 1847 mouse.x= LOWORD(lParam);1848 mouse.y= HIWORD(lParam);1851 mouse.x=GET_X_LPARAM(lParam); 1852 mouse.y=GET_Y_LPARAM(lParam); 1849 1853 ScreenToClient(hwnd,&mouse); 1850 1854 CursorPos_LocalToGlobal(hwnd,&mouse.x,&mouse.y); … … 1853 1857 extern HMENU hRadMenuBase; 1854 1858 if(MdiInfo[i]->MdiRadInfo->SelectingItem[0]==SELECT_WINDOW) 1855 TrackPopupMenu(GetSubMenu(hRadMenuBase,0),TPM_LEFTALIGN, LOWORD(lParam),HIWORD(lParam),0,hwnd,0);1856 else TrackPopupMenu(GetSubMenu(hRadMenuBase,1),TPM_LEFTALIGN, LOWORD(lParam),HIWORD(lParam),0,hwnd,0);1859 TrackPopupMenu(GetSubMenu(hRadMenuBase,0),TPM_LEFTALIGN,GET_X_LPARAM(lParam),GET_Y_LPARAM(lParam),0,hwnd,0); 1860 else TrackPopupMenu(GetSubMenu(hRadMenuBase,1),TPM_LEFTALIGN,GET_X_LPARAM(lParam),GET_Y_LPARAM(lParam),0,hwnd,0); 1857 1861 } 1858 1862 return 0; … … 1989 1993 case WM_CREATE: 1990 1994 extern HICON hWindowDocumentIcon; 1991 SendMessage(hwnd,WM_SETICON,ICON_SMALL,( long)hWindowDocumentIcon);1995 SendMessage(hwnd,WM_SETICON,ICON_SMALL,(LPARAM)hWindowDocumentIcon); 1992 1996 break; 1993 1997 case WM_MDIACTIVATE: … … 1996 2000 if(i==-1) return 0; //ウィンドウが初期状態の場合 1997 2001 1998 i=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,( long)MdiInfo[i]->title.c_str());2002 i=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(LPARAM)MdiInfo[i]->title.c_str()); 1999 2003 SendMessage(hDocCombo,CB_SETCURSEL,i,0); 2000 2004 SetStatusText(NULL); -
trunk/ab5.0/abdev/abdev/Ruler.cpp
r655 r772 3 3 #include "common.h" 4 4 5 void OnPaint(HWND hwnd,HDC hdc) 6 { 7 CRuler *pobj_Ruler = reinterpret_cast<CRuler *>(GetWindowLongPtr(hwnd,GWLP_USERDATA)); 8 pobj_Ruler->draw(hdc); 9 } 10 5 11 LRESULT CALLBACK RulerProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){ 6 12 switch(message){ 7 13 case WM_PAINT: 8 CRuler *pobj_Ruler;9 pobj_Ruler=(CRuler *)GetWindowLongPtr(hwnd,GWLP_USERDATA);10 11 HDC hdc;12 14 PAINTSTRUCT ps; 13 hdc=BeginPaint(hwnd,&ps); 14 15 pobj_Ruler->draw(hdc); 16 15 OnPaint(hwnd,BeginPaint(hwnd,&ps)); 17 16 EndPaint(hwnd,&ps); 17 break; 18 case WM_PRINTCLIENT: 19 OnPaint(hwnd, reinterpret_cast<HDC>(wParam)); 18 20 break; 19 21 } … … 28 30 0,0,0,0, 29 31 hParent,0,hInst,0); 30 SetWindowLongPtr(hRulerWnd,GWLP_USERDATA,( long)this);32 SetWindowLongPtr(hRulerWnd,GWLP_USERDATA,(LONG_PTR)this); 31 33 32 34 HDC hdc; -
trunk/ab5.0/abdev/abdev/SubOperation.cpp
r705 r772 153 153 } 154 154 void SlideString(char *buffer, int slide){ 155 char *temp; 156 temp=(char *)malloc(lstrlen(buffer)+1); 157 lstrcpy(temp,buffer); 158 lstrcpy(buffer+slide,temp); 159 free(temp); 155 SlideBuffer(buffer, strlen(buffer) + 1, slide); 160 156 } 161 157 void SlideBuffer(char *buffer,int length,int slide){ 162 void *temp; 163 temp=malloc(length+1); 164 memcpy(temp,buffer,length); 165 memcpy(buffer+slide,temp,length); 166 free(temp); 158 memmove(buffer+slide, buffer, length); 167 159 } 168 160 BOOL IsVariableTopChar(char c){ … … 745 737 extern FWINLAYER pSetLayeredWindowAttributes; 746 738 extern HINSTANCE hUser32Lib; 747 hUser32Lib=GetModuleHandle( "user32.dll");739 hUser32Lib=GetModuleHandle(TEXT("user32.dll")); 748 740 pSetLayeredWindowAttributes=reinterpret_cast<FWINLAYER>(GetProcAddress(hUser32Lib,"SetLayeredWindowAttributes")); 749 741 … … 754 746 // フォントを定義 755 747 ///////////////////// 748 749 NONCLIENTMETRICS NCMetrics = {0}; 750 NCMetrics.cbSize = sizeof( NONCLIENTMETRICS ); 751 SystemParametersInfo( SPI_GETNONCLIENTMETRICS, NCMetrics.cbSize, &NCMetrics, 0 ); 756 752 757 753 //パラメータ ヒント フォント … … 764 760 765 761 //ステータスバー フォント 766 LOGFONT LogFont;767 762 extern HFONT hStatusFont; 768 LogFont.lfHeight=-12; 769 LogFont.lfWidth=0; 770 LogFont.lfEscapement=0; 771 LogFont.lfOrientation=0; 772 LogFont.lfWeight=FW_REGULAR; 773 LogFont.lfItalic=NULL; 774 LogFont.lfUnderline=NULL; 775 LogFont.lfStrikeOut=NULL; 776 LogFont.lfCharSet=SHIFTJIS_CHARSET; 777 LogFont.lfOutPrecision=OUT_STRING_PRECIS; 778 LogFont.lfClipPrecision=CLIP_STROKE_PRECIS; 779 LogFont.lfQuality=DRAFT_QUALITY; 780 LogFont.lfPitchAndFamily=VARIABLE_PITCH; 781 sprintf(LogFont.lfFaceName,"MS Pゴシック"); 782 hStatusFont=CreateFontIndirect(&LogFont); 763 hStatusFont=CreateFontIndirect(&NCMetrics.lfStatusFont); 783 764 784 765 //ハイパーリンク フォント 785 766 extern HFONT hHyperLinkFont; 767 LOGFONT LogFont; 786 768 LogFont.lfHeight=-12; 787 769 LogFont.lfWidth=0; … … 797 779 LogFont.lfQuality=DRAFT_QUALITY; 798 780 LogFont.lfPitchAndFamily=VARIABLE_PITCH; 799 sprintf(LogFont.lfFaceName,"MS Pゴシック");781 _tcscpy(LogFont.lfFaceName,TEXT("MS Pゴシック")); 800 782 hHyperLinkFont=CreateFontIndirect(&LogFont); 801 783 … … 815 797 LogFont.lfQuality=DRAFT_QUALITY; 816 798 LogFont.lfPitchAndFamily=VARIABLE_PITCH; 817 sprintf(LogFont.lfFaceName,"MS ゴシック");799 _tcscpy(LogFont.lfFaceName,TEXT("MS ゴシック")); 818 800 hRulerFont=CreateFontIndirect(&LogFont); 819 801 … … 833 815 LogFont.lfQuality=DRAFT_QUALITY; 834 816 LogFont.lfPitchAndFamily=VARIABLE_PITCH; 835 sprintf(LogFont.lfFaceName,"Courier New");817 _tcscpy(LogFont.lfFaceName,TEXT("Courier New")); 836 818 hFont_LineNumber=CreateFontIndirect(&LogFont); 837 819 838 820 //メニューフォント 839 NONCLIENTMETRICS NCMetrics;840 int sizeof_NONCLIENTMETRICS = sizeof( NONCLIENTMETRICS );841 #if WINVER >= 0x0600842 sizeof_NONCLIENTMETRICS -= sizeof(int);843 #endif844 NCMetrics.cbSize = sizeof_NONCLIENTMETRICS;845 SystemParametersInfo( SPI_GETNONCLIENTMETRICS, sizeof_NONCLIENTMETRICS, &NCMetrics, 0 );846 821 hMenuFont=CreateFontIndirect(&NCMetrics.lfMenuFont); 847 822 … … 1195 1170 WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBARS_SIZEGRIP|CCS_BOTTOM, 1196 1171 NULL,hwnd,NULL); 1197 Se ndMessage(hStatusBar,WM_SETFONT,(long)hStatusFont,0);1172 SetWindowFont(hStatusBar,hStatusFont,FALSE); 1198 1173 1199 1174 //プロジェクト ビュー -
trunk/ab5.0/abdev/abdev/TabCtrl.cpp
r700 r772 3 3 #include "Common.h" 4 4 5 struct ItemInfo 6 { 7 HWND hwndChild; 8 COLORREF Color; 9 10 ItemInfo( HWND hChild, COLORREF color) : 11 hwndChild( hChild ), 12 Color( color ) 13 { 14 } 15 }; 16 17 ItemInfo* GetItemInfo( HWND hTab, int i ) 18 { 19 TC_ITEM tcItem; 20 tcItem.mask=TCIF_PARAM; 21 TabCtrl_GetItem( hTab, i, &tcItem ); 22 return reinterpret_cast<ItemInfo*>( tcItem.lParam ); 23 } 24 25 void SetTabOrder( HWND hTab, ItemInfo* itemInfo, int pos ) 26 { 27 HWND next = 28 pos + 1 < TabCtrl_GetItemCount( hTab ) 29 ? GetItemInfo( hTab, pos + 1 )->hwndChild 30 : 0 31 ; 32 ActiveBasic::IDE::Program::mainFrame.SetTabOrder( itemInfo->hwndChild, next ); 33 } 5 34 6 35 CMainTab *pobj_MainTab=0; … … 57 86 58 87 indexDrag=iNewPos; 88 SetTabOrder( hwnd, GetItemInfo( hwnd, iNewPos ), iNewPos ); 59 89 60 90 LockWindowUpdate(0); … … 148 178 149 179 //サブクラス化 150 OldMainTabWndProc=(WNDPROC)GetWindowLongPtr(hTab,GWLP_WNDPROC); 151 SetWindowLongPtr(hTab,GWLP_WNDPROC,(LONG_PTR)MainTabWndProc); 180 OldMainTabWndProc = (WNDPROC)SetWindowLongPtr(hTab,GWLP_WNDPROC,(LONG_PTR)MainTabWndProc); 152 181 153 182 //ボールド体フォントを生成 … … 157 186 hBoldFont=CreateFontIndirect(&lf); 158 187 159 Se ndMessage(hTab,WM_SETFONT,(long)hBoldFont,0);188 SetWindowFont(hTab,hBoldFont,FALSE); 160 189 } 161 190 … … 164 193 } 165 194 166 void CMainTab::InsertItem( const char *lpszText, bool isResize, COLORREF color ){195 void CMainTab::InsertItem( HWND hwnd, const char *lpszText, bool isResize, COLORREF color ){ 167 196 int sw=0; 168 197 if(TabCtrl_GetItemCount(hTab)==0) sw=1; 169 198 OutputDebugString("CMainTab::InsertItem--------------------------------------------------------\r\n"); 170 199 if(color==-1) color=RGB(230,230,230); 200 201 ItemInfo* itemInfo = new ItemInfo( hwnd, color ); 171 202 172 203 TC_ITEM tcItem; 173 204 tcItem.mask=TCIF_TEXT|TCIF_PARAM; 174 205 tcItem.pszText=(LPSTR)lpszText; 175 tcItem.lParam= color;206 tcItem.lParam=reinterpret_cast<LPARAM>( itemInfo ); 176 207 TabCtrl_InsertItem(hTab,0,&tcItem); 177 208 TabCtrl_SetCurSel(hTab,0); 209 ActiveBasic::IDE::Program::mainFrame.AddChildWindow( hwnd ); 210 SetTabOrder( hTab, itemInfo, 0 ); 178 211 179 212 if(isResize){ … … 186 219 i2=SearchItemIndex(lpszText); 187 220 if(i2==-1) return; 188 221 OutputDebugString("CMainTab::DeleteItem--------------------------------------------------------\r\n"); 222 ItemInfo* p = GetItemInfo( hTab, i2 ); 223 ActiveBasic::IDE::Program::mainFrame.DeleteChildWindow( p->hwndChild ); 224 delete p; 189 225 TabCtrl_DeleteItem(hTab,i2); 190 226 … … 195 231 196 232 void CMainTab::RenameItem( const char *lpszOldText, const char *lpszNewText ){ 197 int i2; 198 i2=SearchItemIndex(lpszOldText); 233 int i2=SearchItemIndex(lpszOldText); 199 234 if(i2==-1) return; 200 235 … … 242 277 tcItem.mask = TCIF_PARAM; 243 278 TabCtrl_GetItem( hTab, index, &tcItem ); 244 return tcItem.lParam;279 return reinterpret_cast<ItemInfo*>( tcItem.lParam )->Color; 245 280 } 246 281 … … 272 307 273 308 TabCtrl_SetCurSel(hTab,i2); 309 // ActiveBasic::IDE::Program::mainFrame.ActivateChildWindow( *GetItemInfo( hTab, i2 )->TaskbarButtonWindow ); 274 310 } 275 311 … … 321 357 // タブ枠を描画 322 358 //////////////////////////// 323 colorGray= item.lParam;359 colorGray=reinterpret_cast<ItemInfo*>( item.lParam )->Color; 324 360 325 361 //ブラシを生成 … … 376 412 // タブ枠を描画 377 413 //////////////////////////// 378 colorGray= item.lParam;414 colorGray=reinterpret_cast<ItemInfo*>( item.lParam )->Color; 379 415 380 416 //ブラシを生成 -
trunk/ab5.0/abdev/abdev/TabCtrl.h
r700 r772 1 1 #pragma once 2 2 3 3 class CMainTab{ … … 23 23 24 24 //アイテムを挿入 25 void InsertItem( const char *lpszText, bool isResize, COLORREF color = -1 );25 void InsertItem( HWND hwnd, const char *lpszText, bool isResize, COLORREF color = -1 ); 26 26 27 27 //アイテムを削除 -
trunk/ab5.0/abdev/abdev/TextEditor_EventProc.cpp
r770 r772 138 138 TextEdit_DrawBuffer(hdc,WndNum); 139 139 EndPaint(hwnd,&ps); 140 ActiveBasic::IDE::Program::mainFrame.InvalidateBitmap(GetParent(hwnd)); 141 return 0; 142 case WM_PRINTCLIENT: 143 WndNum=GetWndNum(GetParent(hwnd)); 144 if(WndNum==-1) return 0; 145 TextEdit_DrawBuffer(reinterpret_cast<HDC>(wParam),WndNum); 140 146 return 0; 141 147 case WM_SETFOCUS: … … 261 267 MdiInfo[wParam]->pMdiTextEdit->pobj_WebResult->hwnd,0,hInst,0); 262 268 263 SetWindowLongPtr(hOneTabWnd,GWLP_USERDATA, (long)lParam);269 SetWindowLongPtr(hOneTabWnd,GWLP_USERDATA,lParam); 264 270 265 271 return (LRESULT)hOneTabWnd; -
trunk/ab5.0/abdev/abdev/abdev.cpp
r705 r772 196 196 197 197 if(MenuText){ 198 SendMessage(hStatusBar,SB_SETTEXT,0,( long)MenuText);198 SendMessage(hStatusBar,SB_SETTEXT,0,(LPARAM)MenuText); 199 199 if((char *)MenuText!=(char *)CmdMsg) CmdMsg[0]=0; 200 200 } … … 979 979 if( hDocCombo ) 980 980 { 981 i=SendMessage(hDocCombo,CB_ADDSTRING,0,( long)str);981 i=SendMessage(hDocCombo,CB_ADDSTRING,0,(LPARAM)str); 982 982 SendMessage(hDocCombo,CB_SETCURSEL,i,0); 983 983 } 984 984 985 985 //タブに追加 986 pobj_MainTab->InsertItem( str, true, TabColor );986 pobj_MainTab->InsertItem( hChild, str, true, TabColor ); 987 987 988 988 ::SetFocus(hEdit); … … 1004 1004 } 1005 1005 } 1006 1006 UpdateWindow(hChild); 1007 1007 return hChild; 1008 1008 } … … 1014 1014 //ドキュメントコンボボックスから文字列を消去 1015 1015 extern HWND hDocCombo; 1016 i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,( long)MdiInfo[WndNum]->title.c_str());1016 i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(LPARAM)MdiInfo[WndNum]->title.c_str()); 1017 1017 SendMessage(hDocCombo,CB_DELETESTRING,i2,0); 1018 1018 1019 1019 //タブコントロールからアイテムを消去 1020 1020 if(pobj_MainTab) pobj_MainTab->DeleteItem( MdiInfo[WndNum]->title.c_str(), true ); 1021 1022 1021 1023 1022 if(IS_DOCUMENT_TEXT(MdiInfo[WndNum]->DocType)){ … … 1151 1150 WebResultWndHeight); 1152 1151 } 1152 1153 1153 LRESULT CALLBACK MDIClientWindow_TextEdit(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){ 1154 1154 int i,i2; … … 1157 1157 switch(message){ 1158 1158 case WM_CREATE: 1159 CREATESTRUCT *lpcs; 1160 lpcs=(CREATESTRUCT *)lParam; 1161 MDICREATESTRUCT *lpmcs; 1162 lpmcs=(MDICREATESTRUCT *)lpcs->lpCreateParams; 1163 SendMessage(hwnd,WM_SETICON,ICON_SMALL,(LPARAM)lpmcs->lParam); 1164 break; 1159 { 1160 CREATESTRUCT *lpcs = (CREATESTRUCT *)lParam; 1161 MDICREATESTRUCT *lpmcs = (MDICREATESTRUCT *)lpcs->lpCreateParams; 1162 SendMessage(hwnd,WM_SETICON,ICON_SMALL,lpmcs->lParam); 1163 1164 break; 1165 } 1165 1166 case WM_MDIACTIVATE: 1166 //以前のMDIウィンドウのパラメータ ヒントを破棄する 1167 if(MethodCheckInfo.hWnd){ 1168 DestroyWindow(MethodCheckInfo.hWnd); 1169 MethodCheckInfo.hWnd=0; 1170 } 1171 1172 //以前のコード補完リストを破棄する 1173 if(ComplementWndInfo.hWnd){ 1174 DestroyWindow(ComplementWndInfo.hWnd); 1175 ComplementWndInfo.hWnd=0; 1176 } 1177 1178 if(!lParam) return 0; 1179 i=GetWndNum((HWND)lParam); 1180 if(i==-1) return 0; //ウィンドウが初期状態の場合 1167 { 1168 //以前のMDIウィンドウのパラメータ ヒントを破棄する 1169 if(MethodCheckInfo.hWnd){ 1170 DestroyWindow(MethodCheckInfo.hWnd); 1171 MethodCheckInfo.hWnd=0; 1172 } 1173 1174 //以前のコード補完リストを破棄する 1175 if(ComplementWndInfo.hWnd){ 1176 DestroyWindow(ComplementWndInfo.hWnd); 1177 ComplementWndInfo.hWnd=0; 1178 } 1179 1180 if(!lParam) return 0; 1181 i=GetWndNum((HWND)lParam); 1182 if(i==-1) return 0; //ウィンドウが初期状態の場合 1181 1183 1182 1184 #ifndef THETEXT 1183 //デバッガ メニューの状態を設定1184 pobj_Debugger->ResetCommandEnabled();1185 #endif 1186 1187 //ドキュメント セレクト コンボボックス1188 extern HWND hDocCombo;1189 i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(long)MdiInfo[i]->title.c_str());1190 SendMessage(hDocCombo,CB_SETCURSEL,i2,0);1191 1192 //タブコントロール1193 pobj_MainTab->MdiActiveEvent(MdiInfo[i]->title.c_str());1194 1195 if( !projectInfo.IsOpened() ){1196 ResetClassTree((HTREEITEM)-1);1197 }1198 1199 return 0;1185 //デバッガ メニューの状態を設定 1186 pobj_Debugger->ResetCommandEnabled(); 1187 #endif 1188 1189 //ドキュメント セレクト コンボボックス 1190 extern HWND hDocCombo; 1191 i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(LPARAM)MdiInfo[i]->title.c_str()); 1192 SendMessage(hDocCombo,CB_SETCURSEL,i2,0); 1193 1194 //タブコントロール 1195 pobj_MainTab->MdiActiveEvent(MdiInfo[i]->title.c_str()); 1196 1197 if( !projectInfo.IsOpened() ){ 1198 ResetClassTree((HTREEITEM)-1); 1199 } 1200 return 0; 1201 } 1200 1202 case WM_SETFOCUS: 1201 1203 hEdit=GetWindow(hwnd,GW_CHILD); … … 1244 1246 switch(message) 1245 1247 { 1246 1247 1248 #ifndef THETEXT 1248 1249 case WM_SETCOMPILEVIEW: … … 1253 1254 case WM_DESTROYCOMPILEVIEW: 1254 1255 //コンパイラウィンドウ(埋め込み型)が破棄されたとき 1255 if(( int)hCompileView==-1){1256 if((LONG_PTR)hCompileView==-1){ 1256 1257 //すぐに次のコンパイラウィンドウが起動するとき 1257 1258 hCompileView=0; … … 1260 1261 //完全にコンパイラウィンドウを閉じたときはリサイズ 1261 1262 hCompileView=0; 1262 1263 1263 1264 ActiveBasic::IDE::Program::mainFrame.Resized(); 1264 1265 } … … 1300 1301 static int start; 1301 1302 1302 pos.x= (long)(short)LOWORD(lParam);1303 pos.y= (long)(short)HIWORD(lParam);1303 pos.x=GET_X_LPARAM(lParam); 1304 pos.y=GET_Y_LPARAM(lParam); 1304 1305 ClientToScreen(hwnd,&pos); 1305 1306 … … 1377 1378 return 0; 1378 1379 case WM_LBUTTONDOWN: 1379 pos.x= LOWORD(lParam);1380 pos.y= HIWORD(lParam);1380 pos.x=GET_X_LPARAM(lParam); 1381 pos.y=GET_Y_LPARAM(lParam); 1381 1382 ClientToScreen(hwnd,&pos); 1382 1383 … … 1532 1533 if(!RegWndClass(SideWebProc,"SideWeb",(HBRUSH)COLOR_APPWORKSPACE+1,FLAG_DBLCLK)) return 0; 1533 1534 1534 ActiveBasic::IDE::Program::Main( );1535 ActiveBasic::IDE::Program::Main(hThisInst); 1535 1536 1536 1537 //return 0; … … 1553 1554 SetTimer(hOwner,ID_TIMER_BACKUP,10000,NULL); 1554 1555 1555 SendMessage(hOwner,WM_SETICON,ICON_SMALL,( long)hOwnerIcon);1556 SendMessage(hOwner,WM_SETICON,ICON_SMALL,(LPARAM)hOwnerIcon); 1556 1557 SetClipboardViewer(hOwner); 1557 1558 … … 1638 1639 #endif 1639 1640 1640 return msg.wParam;1641 } 1641 return static_cast<int>(msg.wParam); 1642 } -
trunk/ab5.0/abdev/abdev/abdev.vcproj
r688 r772 83 83 SuppressStartupBanner="true" 84 84 AdditionalLibraryDirectories="..\..\jenga\lib\x86;..\lib\x86" 85 DelayLoadDLLs="DWMAPI.DLL" 85 86 ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb" 86 87 SubSystem="2" … … 182 183 SuppressStartupBanner="true" 183 184 AdditionalLibraryDirectories="..\..\jenga\lib\x86;..\lib\x86" 185 DelayLoadDLLs="DWMAPI.DLL" 184 186 GenerateDebugInformation="true" 185 187 ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb" … … 282 284 SuppressStartupBanner="true" 283 285 AdditionalLibraryDirectories="..\..\jenga\lib\x86;..\lib\x86" 286 DelayLoadDLLs="DWMAPI.DLL" 284 287 ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb" 285 288 SubSystem="2" … … 381 384 SuppressStartupBanner="true" 382 385 AdditionalLibraryDirectories="..\..\jenga\lib\x86;..\lib\x86" 386 DelayLoadDLLs="DWMAPI.DLL" 383 387 GenerateDebugInformation="true" 384 388 ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb" -
trunk/ab5.0/abdev/abdev/include/MainFrame.h
r749 r772 1 1 #pragma once 2 3 #include <boost/shared_ptr.hpp> 2 4 3 5 //サイズ変更枠の太さ … … 14 16 #define WM_SETDEBUGGERVIEW WM_USER+75 //デバッガウィンドウが表示されたとき 15 17 #define WM_DESTROYDEBUGGERVIEW WM_USER+76 //デバッガウィンドウが表示されたとき 18 19 #ifdef HAVE_WINDOWS_7_SDK 20 class TaskbarList; 21 #endif 16 22 17 23 namespace ActiveBasic{ namespace IDE{ … … 22 28 { 23 29 WindowAreaManager wam; 30 UINT TaskbarButtonCreated; 31 #ifdef HAVE_WINDOWS_7_SDK 32 boost::shared_ptr<TaskbarList> taskbarList; 33 #endif 24 34 25 35 public: 36 MainFrame(); 37 26 38 // リサイズ時のリフレッシュ 27 39 void Resized(); … … 77 89 // ソースコード表示メッセージ 78 90 ::LRESULT OnShowSourceLine( ::UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled ); 91 92 #ifdef HAVE_WINDOWS_7_SDK 93 // タスクバーボタンが生成された 94 ::LRESULT OnTaskbarButtonCreated(::UINT msg, ::WPARAM wParam, ::LPARAM lParam); 95 96 // 子ウィンドウが生成された 97 void AddChildWindow( HWND hwndChild ); 98 99 // 子ウィンドウが破棄された 100 void DeleteChildWindow( HWND hwndChild ); 101 102 // 子ウィンドウがアクティブになった 103 void ActivateChildWindow( HWND hwndChild ); 104 105 // タブの順序が変更になった 106 void SetTabOrder( HWND hwndChild, HWND hwndInsertBefore ); 107 108 // サムネイル画像が古くなった(ので更新したい) 109 void InvalidateBitmap( HWND hwndChild ); 110 #endif 79 111 80 112 // 「新規作成」メニューがクリックされた … … 269 301 MSG_WM_DROPFILES( OnDropFiles ) 270 302 MSG_WM_PAINT( OnPaint ) 271 MESSAGE_HANDLER( WM_SHOWERROR, OnShowSourceLine ) 272 303 MESSAGE_HANDLER( WM_SHOWERROR, OnShowSourceLine ) 304 #ifdef HAVE_WINDOWS_7_SDK 305 MESSAGE_HANDLER_EX( TaskbarButtonCreated, OnTaskbarButtonCreated ) 306 #endif 273 307 COMMAND_ID_HANDLER_EX( IDM_NEW, OnCmdNew ) 274 308 COMMAND_ID_HANDLER_EX( IDM_OPEN, OnCmdOpen ) -
trunk/ab5.0/abdev/abdev/include/Program.h
r719 r772 19 19 static const std::string GetIdeUserAppDir(); 20 20 21 static void Main( );21 static void Main(HINSTANCE hinst); 22 22 23 23 -
trunk/ab5.0/abdev/abdev/src/MainFrame.cpp
r749 r772 10 10 void CreateProcessWithStdHandle( const std::string &appPath, const std::string &cmdLine, bool isShowWindow = true ) 11 11 { 12 std::string argsStr = "\""+ appPath + "\" " + cmdLine;12 std::string argsStr = '\"' + appPath + "\" " + cmdLine; 13 13 STARTUPINFO si; 14 14 PROCESS_INFORMATION pi; … … 21 21 si.hStdError = GetStdHandle(STD_ERROR_HANDLE); 22 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 ); 23 std::vector<char> args( argsStr.c_str(), argsStr.c_str() + argsStr.size() + 1 ); 24 25 CreateProcess( NULL, &args[0], NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi ); 27 26 CloseHandle( pi.hProcess ); 28 27 CloseHandle( pi.hThread ); 29 28 } 29 30 #ifdef HAVE_WINDOWS_7_SDK 31 32 #define MSGFLT_ADD 1 33 34 #pragma push_macro("_WIN32_WINNT") 35 #undef _WIN32_WINNT 36 #define _WIN32_WINNT 0x0601 37 #include <dwmapi.h> 38 #pragma pop_macro("_WIN32_WINNT") 39 40 #define WM_DWMSENDICONICTHUMBNAIL 0x0323 41 #define WM_DWMSENDICONICLIVEPREVIEWBITMAP 0x0326 42 43 // Windows 7タスクバーにボタンとして表示させるためのウィンドウ。 44 // 各MDI子ウィンドウ (wndTarget) と1対1に対応する。 45 class DummyWindowForTaskbarButton : public ATL::CWindowImpl<DummyWindowForTaskbarButton>, boost::noncopyable 46 { 47 public: 48 DECLARE_WND_CLASS(TEXT("DummyWindow For Taskbar Button")); 49 50 BEGIN_MSG_MAP(DummyWindowForTaskbarButton) 51 MESSAGE_HANDLER_EX(WM_DWMSENDICONICTHUMBNAIL, OnDwmSendIconicThumnail) 52 MESSAGE_HANDLER_EX(WM_DWMSENDICONICLIVEPREVIEWBITMAP, OnDwmSendIconicLivePreviewBitmap) 53 MSG_WM_ACTIVATE(OnActivate) 54 END_MSG_MAP() 55 56 explicit DummyWindowForTaskbarButton(HWND hwndTarget, const char* title) : 57 wndTarget(hwndTarget) 58 { 59 HWND hwndDummy = Create( hOwner, CRect( -32000, -32000, 1, 1 ), title, 60 WS_BORDER | WS_SYSMENU | WS_CAPTION, WS_EX_NOACTIVATE); 61 SetIcon( wndTarget.GetIcon( FALSE ), FALSE ); 62 SetIcon( wndTarget.GetIcon( TRUE ), TRUE ); 63 64 BOOL iconicRepresentation = TRUE; 65 HRESULT hr; 66 hr = DwmSetWindowAttribute( 67 *this, 68 DWMWA_FORCE_ICONIC_REPRESENTATION, 69 &iconicRepresentation, 70 sizeof iconicRepresentation); 71 BOOL iconicBitmap = TRUE; 72 hr = DwmSetWindowAttribute( 73 *this, 74 DWMWA_HAS_ICONIC_BITMAP, 75 &iconicBitmap, 76 sizeof iconicBitmap); 77 } 78 79 ~DummyWindowForTaskbarButton() 80 { 81 } 82 private: 83 void OnActivate(UINT state, BOOL /*minimized*/, HWND /*hwndOther*/) 84 { 85 if (state == WA_ACTIVE) 86 { 87 if (ActiveBasic::IDE::Program::mainFrame.IsIconic()) 88 { 89 ActiveBasic::IDE::Program::mainFrame.ShowWindow(SW_RESTORE); 90 } 91 SetForegroundWindow(ActiveBasic::IDE::Program::mainFrame); 92 ActiveBasic::IDE::Program::mainFrame.MDIActivate(wndTarget); 93 wndTarget.Invalidate(FALSE); 94 } 95 } 96 97 class BitmapMemoryDC : public WTL::CDC, boost::noncopyable 98 { 99 public: 100 explicit BitmapMemoryDC(HBITMAP hbmp) : 101 WTL::CDC(::CreateCompatibleDC(0)), 102 bmp(hbmp), 103 hbmpOld(SelectBitmap(bmp)) 104 { 105 } 106 BitmapMemoryDC(int width, int height, void*& bits) : 107 WTL::CDC(::CreateCompatibleDC(0)), 108 bmp(CreateDIBSection32(m_hDC, width, height, bits)), 109 hbmpOld(SelectBitmap(bmp)) 110 { 111 } 112 ~BitmapMemoryDC() 113 { 114 SelectBitmap(hbmpOld); // この後、CDCとbmpのデストラクタでそれぞれDeleteDCとDeleteObjectがなされる。 115 } 116 WTL::CBitmap& GetBitmap() 117 { 118 return bmp; 119 } 120 private: 121 WTL::CBitmap bmp; 122 HBITMAP hbmpOld; 123 }; 124 125 LRESULT OnDwmSendIconicThumnail(UINT, WPARAM, LPARAM lp) 126 { 127 HRESULT hr = SetIconicThumbnail(HIWORD(lp), LOWORD(lp)); 128 return 0; 129 } 130 131 LRESULT OnDwmSendIconicLivePreviewBitmap(UINT, WPARAM, LPARAM) 132 { 133 HRESULT hr = SetIconicLivePreviewBitmap(); 134 return 0; 135 } 136 137 HRESULT SetIconicThumbnail(int maximumWidth, int maximumHeight) 138 { 139 int widthBmp, heightBmp; 140 BitmapMemoryDC dcSrc(CreateBitmap(widthBmp, heightBmp)); 141 if (dcSrc) 142 { 143 int width, height; // dcSrcの縦横比に合わせて縮小する 144 if (widthBmp * maximumHeight > maximumWidth * heightBmp) // (widthBmp / heightBmp > maximumWidth / maximumHeight) 145 { 146 width = maximumWidth; 147 height = heightBmp * maximumWidth / widthBmp; 148 } 149 else 150 { 151 height = maximumHeight; 152 width = widthBmp * maximumHeight / heightBmp; 153 } 154 void* pvBits; 155 BitmapMemoryDC dc(width, height, pvBits); 156 if (dc) 157 { 158 StretchBlt(dc, 0, 0, width, height, dcSrc, 0, 0, widthBmp, heightBmp, SRCCOPY); 159 return DwmSetIconicThumbnail(*this, dc.GetBitmap(), DWM_SIT_DISPLAYFRAME); 160 } 161 } 162 return HRESULT_FROM_WIN32(GetLastError()); 163 } 164 165 HRESULT SetIconicLivePreviewBitmap() 166 { 167 int w, h; 168 WTL::CBitmap bmp(CreateBitmap(w, h)); 169 if (bmp) 170 { 171 POINT pt = {}; 172 wndTarget.MapWindowPoints(hOwner, &pt, 1); 173 pt.y += GetSystemMetrics(SM_CYMENU); 174 return DwmSetIconicLivePreviewBitmap(*this, bmp, &pt, wndTarget.IsZoomed() ? 0 : DWM_SIT_DISPLAYFRAME); 175 } 176 return HRESULT_FROM_WIN32(GetLastError()); 177 } 178 179 static void SetAlpha(DWORD& pixel) 180 { 181 pixel |= 0xff000000; 182 } 183 184 HBITMAP CreateBitmap(int& width, int& height) 185 { 186 RECT rcClient; 187 wndTarget.GetClientRect(&rcClient); 188 void* pvBits; 189 BitmapMemoryDC dc(rcClient.right, rcClient.bottom, pvBits); 190 if (dc) 191 { 192 int wndNum = GetWndNum(wndTarget); 193 if (wndNum != -1) 194 { 195 CPoint origin(0, 0); 196 wndTarget.ClientToScreen( &origin ); 197 CRect rcWindow; 198 wndTarget.GetWindowRect( rcWindow ); 199 origin -= rcWindow.TopLeft(); 200 dc.SetWindowOrg( origin ); // クライアント領域の(0, 0)がビットマップの(0, 0)になるよう合わせる 201 wndTarget.Print( dc, PRF_CHECKVISIBLE | PRF_ERASEBKGND | PRF_CHILDREN | PRF_CLIENT ); 202 width = rcClient.right; 203 height = rcClient.bottom; 204 DWORD* pdwBits = static_cast<DWORD*>(pvBits); 205 std::for_each(pdwBits, pdwBits + width * height, SetAlpha); 206 return dc.GetBitmap().Detach(); 207 } 208 } 209 return 0; 210 } 211 // 32ビットトップダウンのDIBセクションを作る補助 212 static HBITMAP CreateDIBSection32(HDC hdc, int width, int height, void*& pb) 213 { 214 BITMAPINFO bi; 215 ZeroMemory(&bi.bmiHeader, sizeof bi.bmiHeader); 216 bi.bmiHeader.biSize = sizeof bi.bmiHeader; 217 bi.bmiHeader.biWidth = width; 218 bi.bmiHeader.biHeight = -height; // トップダウンDIBにする必要があるらしい 219 bi.bmiHeader.biPlanes = 1; 220 bi.bmiHeader.biBitCount = 32; 221 return CreateDIBSection(hdc, &bi, DIB_RGB_COLORS, &pb, 0, 0); 222 } 223 224 CWindow wndTarget; 225 }; 226 227 class TaskbarList 228 { 229 typedef boost::shared_ptr<DummyWindowForTaskbarButton> DummyWindowForTaskbarButtonPtr; 230 typedef std::map<HWND, DummyWindowForTaskbarButtonPtr> WindowMap; 231 public: 232 TaskbarList(HWND hwndFrame) : 233 wndFrame(hwndFrame) 234 { 235 HRESULT hr = taskbarList.CoCreateInstance( CLSID_TaskbarList ); 236 if ( FAILED( hr ) ) { 237 return; 238 } 239 HRESULT hr2 = taskbarList->HrInit(); 240 if ( FAILED( hr2 ) ) { 241 taskbarList.Release(); 242 return; 243 } 244 } 245 246 void RegisterTab(HWND hwndChild, const char* title) 247 { 248 assert( hwndChild ); 249 if (taskbarList) 250 { 251 assert( windowMap.find(hwndChild) == windowMap.end() ); 252 DummyWindowForTaskbarButtonPtr p(new DummyWindowForTaskbarButton(hwndChild, title)); 253 windowMap.insert(std::make_pair(hwndChild, p)); 254 //タスクバーボタンに追加 255 HRESULT hr = taskbarList->RegisterTab(*p, wndFrame); 256 } 257 } 258 259 void RegisterTab(HWND hwndChild) 260 { 261 ATL::CWindow wnd = hwndChild; 262 ATL::CString title; 263 wnd.GetWindowText(title); 264 RegisterTab(hwndChild, title); 265 } 266 267 void UnregisterTab(HWND hwndChild) 268 { 269 if (taskbarList) 270 { 271 WindowMap::iterator it = windowMap.find(hwndChild); 272 assert( it != windowMap.end() ); 273 HRESULT hr = taskbarList->UnregisterTab(*it->second); 274 it->second->DestroyWindow(); 275 windowMap.erase( it ); 276 } 277 } 278 279 void InvalidateIconicBitmaps(HWND hwndChild) 280 { 281 DwmInvalidateIconicBitmaps(*mapAt(hwndChild)); 282 } 283 284 void SetTabActivate(HWND hwndChild) 285 { 286 if (taskbarList) 287 { 288 taskbarList->SetTabActive(*mapAt(hwndChild), wndFrame, 0); 289 } 290 } 291 292 void SetTabOrder( HWND hwndChild, HWND hwndInsertBefore ) 293 { 294 if (taskbarList) 295 { 296 taskbarList->SetTabOrder(*mapAt(hwndChild), 297 hwndInsertBefore 298 ? static_cast<HWND>(*mapAt(hwndInsertBefore)) 299 : 0); 300 } 301 } 302 private: 303 DummyWindowForTaskbarButtonPtr mapAt(HWND hwndChild) 304 { 305 DummyWindowForTaskbarButtonPtr p = windowMap[hwndChild]; 306 assert(p); 307 return p; 308 } 309 CWindow wndFrame; 310 ATL::CComPtr<ITaskbarList3> taskbarList; 311 WindowMap windowMap; 312 }; 313 #endif HAVE_WINDOWS_7_SDK 314 315 #ifdef HAVE_WINDOWS_7_SDK 316 MainFrame::MainFrame() : 317 TaskbarButtonCreated( RegisterWindowMessage( TEXT("TaskbarButtonCreated") ) ) 318 { 319 if ( TaskbarButtonCreated != 0 ) 320 { 321 typedef BOOL WINAPI CWMF(UINT, DWORD); 322 HMODULE hmodUser = GetModuleHandle( TEXT("user32.dll") ); 323 assert( hmodUser != 0 ); 324 if ( CWMF* pcwmf = reinterpret_cast<CWMF*>( GetProcAddress( hmodUser, "ChangeWindowMessageFilter" ) ) ) 325 { 326 pcwmf(TaskbarButtonCreated, MSGFLT_ADD); 327 pcwmf(WM_DWMSENDICONICTHUMBNAIL, MSGFLT_ADD); 328 pcwmf(WM_DWMSENDICONICLIVEPREVIEWBITMAP, MSGFLT_ADD); 329 } 330 } 331 } 332 #else 333 MainFrame::MainFrame() {} 334 #endif 30 335 31 336 void MainFrame::Resized() … … 59 364 //Status bar 60 365 int height_Statusbar; 61 SendMessage(hStatusBar,SB_GETRECT,0,( long)&StatusRect);366 SendMessage(hStatusBar,SB_GETRECT,0,(LPARAM)&StatusRect); 62 367 height_Statusbar=StatusRect.bottom; 63 368 … … 227 532 hOwner = m_hWnd; 228 533 extern WNDPROC oldMainFrameWndProc; 229 oldMainFrameWndProc = (WNDPROC)::GetWindowLong( hOwner, GWL_WNDPROC ); 230 ::SetWindowLongPtr( hOwner, GWL_WNDPROC, reinterpret_cast<LONG_PTR>(WindowFunc) ); 534 oldMainFrameWndProc = (WNDPROC)::SetWindowLongPtr( hOwner, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(WindowFunc) ); 231 535 232 536 SetupWindow(hOwner); … … 234 538 //テキストエディタフォント設定 235 539 ResetTextEditFont(hOwner); 236 237 238 540 239 541 return 0; … … 549 851 void MainFrame::OnPaint( HDC ) 550 852 { 551 PAINTSTRUCT ps; 552 HDC hdc = this->BeginPaint( &ps ); 553 554 HBRUSH hBrush = CreateSolidBrush( GetSysColor( COLOR_3DFACE ) ); 853 WTL::CPaintDC dc( m_hWnd ); 555 854 556 855 RECT rect; 557 856 this->GetClientRect( &rect ); 558 857 559 FillRect( hdc, &rect, hBrush ); 560 561 DeleteObject( hBrush ); 562 563 this->EndPaint( &ps ); 858 dc.FillRect( &rect, GetSysColorBrush( COLOR_3DFACE ) ); 564 859 } 565 860 … … 600 895 ::UpdateWindow(hChild); 601 896 602 c har *pTemp=MdiInfo[WndNum]->pMdiTextEdit->buffer;897 const char *pTemp=MdiInfo[WndNum]->pMdiTextEdit->buffer; 603 898 604 899 //行の先頭インデックスを取得(取得する行の番号はwParamで渡される) … … 628 923 } 629 924 925 ::LRESULT MainFrame::OnTaskbarButtonCreated( ::UINT msg, ::WPARAM, ::LPARAM ) 926 { 927 #ifdef HAVE_WINDOWS_7_SDK 928 if ( msg == 0 ) { // 念のため確認 929 return 0; 930 } 931 taskbarList.reset(new TaskbarList(*this)); 932 #endif 933 return 0; 934 } 935 936 void MainFrame::AddChildWindow( HWND hwndChild ) 937 { 938 #ifdef HAVE_WINDOWS_7_SDK 939 taskbarList->RegisterTab( hwndChild ); 940 #endif 941 } 942 943 void MainFrame::DeleteChildWindow( HWND hwndChild ) 944 { 945 #ifdef HAVE_WINDOWS_7_SDK 946 taskbarList->UnregisterTab( hwndChild ); 947 #endif 948 } 949 950 void MainFrame::ActivateChildWindow( HWND hwndChild ) 951 { 952 #ifdef HAVE_WINDOWS_7_SDK 953 taskbarList->SetTabActivate( hwndChild ); 954 #endif 955 } 956 957 void MainFrame::SetTabOrder( HWND hwndChild, HWND hwndInsertBefore ) 958 { 959 #ifdef HAVE_WINDOWS_7_SDK 960 taskbarList->SetTabOrder( hwndChild, hwndInsertBefore ); 961 #endif 962 } 963 964 void MainFrame::InvalidateBitmap( HWND hwndChild ) 965 { 966 #ifdef HAVE_WINDOWS_7_SDK 967 taskbarList->InvalidateIconicBitmaps( hwndChild ); 968 #endif 969 } 970 630 971 void MainFrame::OnCmdNew( UINT uNotifyCode, int nID, CWindow wndCtl ) 631 972 { … … 639 980 char temporary[MAX_PATH]; 640 981 641 FileType=DialogBox(hResInst,MAKEINTRESOURCE(IDD_NEWFILE),hOwner, (DLGPROC)DlgNewFile);982 FileType=DialogBox(hResInst,MAKEINTRESOURCE(IDD_NEWFILE),hOwner,DlgNewFile); 642 983 if(FileType==-1) return; 643 984 … … 745 1086 { 746 1087 //文字コードを指定して保存 747 DialogBox(hResInst,MAKEINTRESOURCE(IDD_CODE_SAVE),m_hWnd, (DLGPROC)nkfDlgCodeSave);1088 DialogBox(hResInst,MAKEINTRESOURCE(IDD_CODE_SAVE),m_hWnd,nkfDlgCodeSave); 748 1089 } 749 1090 750 1091 void MainFrame::OnCmdAllSave( UINT uNotifyCode, int nID, CWindow wndCtl ) 751 1092 { 752 for ( int i=0;i<MdiInfo.size();i++){753 if( MdiInfo[i]->hwnd) SaveDocument(MdiInfo[i]->hwnd,NULL);1093 foreach( MDIINFO *mi, MdiInfo ){ 1094 if(mi->hwnd) SaveDocument(mi->hwnd,NULL); 754 1095 } 755 1096 if( projectInfo.IsOpened() ) … … 824 1165 TextEdit_GetSel(WndNum,&CharRange); 825 1166 826 HGLOBAL hGlobal= (char *)GlobalAlloc(GMEM_MOVEABLE,CharRange.cpMax-CharRange.cpMin+1);1167 HGLOBAL hGlobal=GlobalAlloc(GMEM_MOVEABLE,CharRange.cpMax-CharRange.cpMin+1); 827 1168 char *pTemp=(char *)GlobalLock(hGlobal); 828 1169 memcpy(pTemp,MdiInfo[WndNum]->pMdiTextEdit->buffer+CharRange.cpMin,CharRange.cpMax-CharRange.cpMin); … … 885 1226 TextEdit_GetSel(WndNum,&CharRange); 886 1227 887 HGLOBAL hGlobal= (char *)GlobalAlloc(GMEM_MOVEABLE,CharRange.cpMax-CharRange.cpMin+1);1228 HGLOBAL hGlobal=GlobalAlloc(GMEM_MOVEABLE,CharRange.cpMax-CharRange.cpMin+1); 888 1229 char *pTemp=(char *)GlobalLock(hGlobal); 889 1230 memcpy(pTemp,MdiInfo[WndNum]->pMdiTextEdit->buffer+CharRange.cpMin,CharRange.cpMax-CharRange.cpMin); … … 1030 1371 void MainFrame::OnCmdFind( UINT uNotifyCode, int nID, CWindow wndCtl ) 1031 1372 { 1032 DialogBox(hResInst,MAKEINTRESOURCE(IDD_FIND),m_hWnd, (DLGPROC)DlgFind);1373 DialogBox(hResInst,MAKEINTRESOURCE(IDD_FIND),m_hWnd,DlgFind); 1033 1374 } 1034 1375 1035 1376 void MainFrame::OnCmdPermutation( UINT uNotifyCode, int nID, CWindow wndCtl ) 1036 1377 { 1037 DialogBox(hResInst,MAKEINTRESOURCE(IDD_PERMUTATION),m_hWnd, (DLGPROC)DlgPermutation);1378 DialogBox(hResInst,MAKEINTRESOURCE(IDD_PERMUTATION),m_hWnd,DlgPermutation); 1038 1379 } 1039 1380 … … 1046 1387 void MainFrame::OnCmdStringCount( UINT uNotifyCode, int nID, CWindow wndCtl ) 1047 1388 { 1048 DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_STRING_COUNT),m_hWnd, (DLGPROC)DlgStringCount,0);1389 DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_STRING_COUNT),m_hWnd,DlgStringCount,0); 1049 1390 } 1050 1391 1051 1392 void MainFrame::OnCmdSelStringCount( UINT uNotifyCode, int nID, CWindow wndCtl ) 1052 1393 { 1053 DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_STRING_COUNT),m_hWnd, (DLGPROC)DlgStringCount,1);1394 DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_STRING_COUNT),m_hWnd,DlgStringCount,1); 1054 1395 } 1055 1396 #endif … … 1290 1631 int idProcess; 1291 1632 DWORD dwPlatform; 1292 idProcess=DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_ATTACH),m_hWnd, (DLGPROC)DlgAttach,(LPARAM)&dwPlatform);1633 idProcess=DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_ATTACH),m_hWnd,DlgAttach,(LPARAM)&dwPlatform); 1293 1634 if(idProcess==0) return; 1294 1635 … … 1552 1893 void MainFrame::OnCmdAbout( UINT uNotifyCode, int nID, CWindow wndCtl ) 1553 1894 { 1554 DialogBox(hResInst,MAKEINTRESOURCE(IDD_ABOUT),m_hWnd, (DLGPROC)DialogAbout);1895 DialogBox(hResInst,MAKEINTRESOURCE(IDD_ABOUT),m_hWnd,DialogAbout); 1555 1896 } 1556 1897 … … 1611 1952 //このウィンドウ以外をすべて閉じる(&A) 1612 1953 HWND hChild=::GetWindow(hClient,GW_CHILD); 1613 int WndNum=GetWndNum(hChild); 1614 for(int i=0;i<MdiInfo.size();i++){ 1615 if(i==WndNum) continue; 1616 if(MdiInfo[i]->hwnd) SendMessage(MdiInfo[i]->hwnd,WM_CLOSE,0,0); 1954 foreach ( MDIINFO *mi, MdiInfo ){ 1955 if ( mi->hwnd == hChild ){ 1956 continue; 1957 } 1958 if(mi->hwnd){ 1959 ::PostMessage( mi->hwnd, WM_CLOSE, 0, 0 ); 1960 //foreachの最中に削除されるとイテレータが回らないのでSendを使っていない。 1961 } 1617 1962 } 1618 1963 } -
trunk/ab5.0/abdev/abdev/src/Program.cpp
r719 r772 17 17 // メインフレームを作成 18 18 mainFrame.Create( 19 HWND_DESKTOP,19 0, 20 20 pobj_nv->StartupWindowRect, 21 21 APPLICATION_NAME, … … 32 32 } 33 33 34 void Program::Main( )34 void Program::Main(HINSTANCE hinst) 35 35 { 36 _Module.Init( NULL, GetModuleHandle( NULL ));36 _Module.Init( NULL, hinst ); 37 37 38 38 CMessageLoop loop; -
trunk/ab5.0/abdev/abdev/stdafx.h
r681 r772 1 1 #pragma once 2 #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1 2 3 3 4 #include <map> … … 8 9 9 10 #include <windows.h> 11 #include <windowsx.h> 10 12 #include <stdio.h> 11 13 #include <string.h> … … 18 20 #include <fcntl.h> 19 21 #include <io.h> 22 #include <assert.h> 20 23 21 24 #include <atlbase.h> 25 #include <atlstr.h> 22 26 #include <atlcom.h> 23 27 #include <atlhost.h> … … 64 68 65 69 #include <ProjectManager/ProjectManager.h> 70
Note:
See TracChangeset
for help on using the changeset viewer.