OS/2 bug fixes and new mod file

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13755 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
2002-01-22 23:19:28 +00:00
parent 0c53263298
commit 54ffa10747
8 changed files with 120 additions and 45 deletions

View File

@@ -253,22 +253,6 @@ bool wxApp::Initialize(
#endif //wxUSE_CONSOLEDEBUG #endif //wxUSE_CONSOLEDEBUG
#endif #endif
//
// OS2 has to have an anchorblock
//
vHab = WinInitialize(0);
if (!vHab)
return FALSE;
else
vHabmain = vHab;
// Some people may wish to use this, but
// probably it shouldn't be here by default.
#ifdef __WXDEBUG__
// wxRedirectIOToConsole();
#endif
wxBuffer = new wxChar[1500]; // FIXME; why? wxBuffer = new wxChar[1500]; // FIXME; why?
wxClassInfo::InitializeClasses(); wxClassInfo::InitializeClasses();
@@ -289,7 +273,22 @@ bool wxApp::Initialize(
wxBitmap::InitStandardHandlers(); wxBitmap::InitStandardHandlers();
RegisterWindowClasses(vHab); //
// OS2 has to have an anchorblock
//
vHab = WinInitialize(0);
if (!vHab)
return FALSE;
else
vHabmain = vHab;
// Some people may wish to use this, but
// probably it shouldn't be here by default.
#ifdef __WXDEBUG__
// wxRedirectIOToConsole();
#endif
wxWinHandleList = new wxList(wxKEY_INTEGER); wxWinHandleList = new wxList(wxKEY_INTEGER);
// This is to foil optimizations in Visual C++ that throw out dummy.obj. // This is to foil optimizations in Visual C++ that throw out dummy.obj.
@@ -304,6 +303,7 @@ bool wxApp::Initialize(
wxModule::RegisterModules(); wxModule::RegisterModules();
if (!wxModule::InitializeModules()) if (!wxModule::InitializeModules())
return FALSE; return FALSE;
RegisterWindowClasses(vHab);
return TRUE; return TRUE;
} // end of wxApp::Initialize } // end of wxApp::Initialize
@@ -413,7 +413,7 @@ bool wxApp::RegisterWindowClasses(
if (!::WinRegisterClass( vHab if (!::WinRegisterClass( vHab
,wxCanvasClassName ,wxCanvasClassName
,wxWndProc ,wxWndProc
,CS_SIZEREDRAW | CS_HITTEST | CS_SYNCPAINT | CS_CLIPCHILDREN ,CS_SIZEREDRAW | CS_HITTEST | CS_SYNCPAINT
,sizeof(ULONG) ,sizeof(ULONG)
)) ))
{ {
@@ -901,6 +901,16 @@ bool wxApp::ProcessMessage(
if (pMsg->msg == WM_TIMER) if (pMsg->msg == WM_TIMER)
wxTimerProc(NULL, 0, (int)pMsg->mp1, 0); wxTimerProc(NULL, 0, (int)pMsg->mp1, 0);
//
// Allow the window to prevent certain messages from being
// translated/processed (this is currently used by wxTextCtrl to always
// grab Ctrl-C/V/X, even if they are also accelerators in some parent)
//
if (pWndThis && !pWndThis->OS2ShouldPreProcessMessage(pWxmsg))
{
return FALSE;
}
// //
// For some composite controls (like a combobox), wndThis might be NULL // For some composite controls (like a combobox), wndThis might be NULL
// because the subcontrol is not a wxWindow, but only the control itself // because the subcontrol is not a wxWindow, but only the control itself

View File

@@ -368,7 +368,7 @@ bool wxFontRefData::Alloc(
{ {
wxFillLogFont( &m_vNativeFontInfo.fa wxFillLogFont( &m_vNativeFontInfo.fa
,&m_vNativeFontInfo.fn ,&m_vNativeFontInfo.fn
,m_hPS ,&m_hPS
,&flId ,&flId
,sFaceName ,sFaceName
,pFont ,pFont
@@ -425,6 +425,8 @@ bool wxFontRefData::Alloc(
m_nFamily = wxSCRIPT; m_nFamily = wxSCRIPT;
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Courier New") == 0) else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Courier New") == 0)
m_nFamily = wxMODERN; m_nFamily = wxMODERN;
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Courier") == 0)
m_nFamily = wxMODERN;
else else
m_nFamily = wxSWISS; m_nFamily = wxSWISS;

View File

@@ -261,7 +261,7 @@ bool wxTestFontEncoding(
void wxFillLogFont( void wxFillLogFont(
LOGFONT* pFattrs // OS2 GPI FATTRS LOGFONT* pFattrs // OS2 GPI FATTRS
, PFACENAMEDESC pFaceName , PFACENAMEDESC pFaceName
, HPS hPS , HPS* phPS
, long* pflId , long* pflId
, wxString& sFaceName , wxString& sFaceName
, wxFont* pFont , wxFont* pFont
@@ -269,7 +269,7 @@ void wxFillLogFont(
{ {
LONG lNumFonts = 0L; // For system font count LONG lNumFonts = 0L; // For system font count
ERRORID vError; // For logging API errors ERRORID vError; // For logging API errors
LONG lTemp; LONG lTemp = 0L;
bool bInternalPS = FALSE; // if we have to create one bool bInternalPS = FALSE; // if we have to create one
PFONTMETRICS pFM = NULL; PFONTMETRICS pFM = NULL;
@@ -277,22 +277,30 @@ void wxFillLogFont(
// Initial house cleaning to free data buffers and ensure we have a // Initial house cleaning to free data buffers and ensure we have a
// functional PS to work with // functional PS to work with
// //
if (!hPS) if (!*phPS)
{ {
hPS = ::WinGetPS(HWND_DESKTOP); *phPS = ::WinGetPS(HWND_DESKTOP);
bInternalPS = TRUE; bInternalPS = TRUE;
} }
// //
// Determine the number of fonts. // Determine the number of fonts.
// //
lNumFonts = ::GpiQueryFonts( hPS if((lNumFonts = ::GpiQueryFonts( *phPS
,QF_PUBLIC ,QF_PUBLIC
,NULL ,NULL
,&lTemp ,&lTemp
,(LONG) sizeof(FONTMETRICS) ,(LONG) sizeof(FONTMETRICS)
,NULL ,NULL
); )) < 0L)
{
ERRORID vError;
wxString sError;
vError = ::WinGetLastError(wxGetInstance());
sError = wxPMErrorToStr(vError);
return;
}
// //
// Allocate space for the font metrics. // Allocate space for the font metrics.
@@ -303,7 +311,7 @@ void wxFillLogFont(
// Retrieve the font metrics. // Retrieve the font metrics.
// //
lTemp = lNumFonts; lTemp = lNumFonts;
lTemp = ::GpiQueryFonts( hPS lTemp = ::GpiQueryFonts( *phPS
,QF_PUBLIC ,QF_PUBLIC
,NULL ,NULL
,&lTemp ,&lTemp
@@ -355,7 +363,7 @@ void wxFillLogFont(
// We should now have the correct FATTRS set with the selected // We should now have the correct FATTRS set with the selected
// font, so now we need to generate an ID // font, so now we need to generate an ID
// //
long lNumLids = ::GpiQueryNumberSetIds(hPS); long lNumLids = ::GpiQueryNumberSetIds(*phPS);
long lGpiError; long lGpiError;
if(lNumLids ) if(lNumLids )
@@ -364,7 +372,7 @@ void wxFillLogFont(
STR8 azNames[255]; STR8 azNames[255];
long alIds[255]; long alIds[255];
if(!::GpiQuerySetIds( hPS if(!::GpiQuerySetIds( *phPS
,lNumLids ,lNumLids
,alTypes ,alTypes
,azNames ,azNames
@@ -372,7 +380,7 @@ void wxFillLogFont(
)) ))
{ {
if (bInternalPS) if (bInternalPS)
::WinReleasePS(hPS); ::WinReleasePS(*phPS);
return; return;
} }
@@ -382,16 +390,17 @@ void wxFillLogFont(
if(*pflId > 254) // wow, no id available! if(*pflId > 254) // wow, no id available!
{ {
if (bInternalPS) if (bInternalPS)
::WinReleasePS(hPS); ::WinReleasePS(*phPS);
return; return;
} }
} }
else
*pflId = 1L;
// //
// Release and delete the current font // Release and delete the current font
// //
::GpiSetCharSet(hPS, LCID_DEFAULT);/* release the font before deleting */ ::GpiSetCharSet(*phPS, LCID_DEFAULT);/* release the font before deleting */
::GpiDeleteSetId(hPS, 1L); /* delete the logical font */ ::GpiDeleteSetId(*phPS, 1L); /* delete the logical font */
// //
// Now build a facestring // Now build a facestring
@@ -400,7 +409,7 @@ void wxFillLogFont(
strcpy(zFacename, pFattrs->szFacename); strcpy(zFacename, pFattrs->szFacename);
if(::GpiQueryFaceString( hPS if(::GpiQueryFaceString( *phPS
,zFacename ,zFacename
,pFaceName ,pFaceName
,FACESIZE ,FACESIZE

View File

@@ -248,6 +248,26 @@ wxStatusBar* wxFrame::OnCreateStatusBar(
if( !pStatusBar ) if( !pStatusBar )
return NULL; return NULL;
wxClientDC vDC(pStatusBar);
int nY;
//
// Set the height according to the font and the border size
//
vDC.SetFont(pStatusBar->GetFont()); // Screws up the menues for some reason
vDC.GetTextExtent( "X"
,NULL
,&nY
);
int nHeight = ((11 * nY) / 10 + 2 * pStatusBar->GetBorderY());
pStatusBar->SetSize( -1
,-1
,-1
,nHeight
);
::WinSetParent( pStatusBar->GetHWND() ::WinSetParent( pStatusBar->GetHWND()
,m_hFrame ,m_hFrame
,FALSE ,FALSE

View File

@@ -965,6 +965,13 @@ WXHBRUSH wxTextCtrl::OnCtlColor(
return (WXHBRUSH)pBackgroundBrush->GetResourceHandle(); return (WXHBRUSH)pBackgroundBrush->GetResourceHandle();
} // end of wxTextCtrl::OnCtlColor } // end of wxTextCtrl::OnCtlColor
bool wxTextCtrl::OS2ShouldPreProcessMessage(
WXMSG* pMsg
)
{
return wxControl::OS2ShouldPreProcessMessage(pMsg);
} // end of wxTextCtrl::OS2ShouldPreProcessMessage
void wxTextCtrl::OnChar( void wxTextCtrl::OnChar(
wxKeyEvent& rEvent wxKeyEvent& rEvent
) )

View File

@@ -351,7 +351,7 @@ bool wxTopLevelWindowOS2::CreateFrame(
wxAssociateWinWithHandle(m_hWnd, this); wxAssociateWinWithHandle(m_hWnd, this);
wxAssociateWinWithHandle(m_hFrame, this); wxAssociateWinWithHandle(m_hFrame, this);
m_backgroundColour.Set(wxString("GREY")); m_backgroundColour.Set(wxString("DARK GREY"));
LONG lColor = (LONG)m_backgroundColour.GetPixel(); LONG lColor = (LONG)m_backgroundColour.GetPixel();
@@ -403,6 +403,14 @@ bool wxTopLevelWindowOS2::CreateFrame(
wxLogError("Error sizing frame. Error: %s\n", sError); wxLogError("Error sizing frame. Error: %s\n", sError);
return FALSE; return FALSE;
} }
lStyle = ::WinQueryWindowULong( m_hWnd
,QWL_STYLE
);
lStyle |= WS_CLIPCHILDREN;
::WinSetWindowULong( m_hWnd
,QWL_STYLE
,lStyle
);
return TRUE; return TRUE;
} // end of wxTopLevelWindowOS2::CreateFrame } // end of wxTopLevelWindowOS2::CreateFrame
@@ -584,7 +592,7 @@ void wxTopLevelWindowOS2::DoShowWindow(
int nShowCmd int nShowCmd
) )
{ {
::WinShowWindow(m_hFrame, (BOOL)nShowCmd); ::WinShowWindow(m_hFrame, (BOOL)(nShowCmd & SWP_SHOW));
m_bIconized = nShowCmd == SWP_MINIMIZE; m_bIconized = nShowCmd == SWP_MINIMIZE;
} // end of wxTopLevelWindowOS2::DoShowWindow } // end of wxTopLevelWindowOS2::DoShowWindow
@@ -600,12 +608,12 @@ bool wxTopLevelWindowOS2::Show(
{ {
if (m_bMaximizeOnShow) if (m_bMaximizeOnShow)
{ {
nShowCmd = SWP_SHOW; nShowCmd = SWP_MAXIMIZE;
m_bMaximizeOnShow = FALSE; m_bMaximizeOnShow = FALSE;
} }
else else
{ {
nShowCmd = SWP_HIDE; nShowCmd = SWP_SHOW;
} }
} }
else // hide else // hide

View File

@@ -2265,6 +2265,14 @@ bool wxWindowOS2::OS2TranslateMessage(
#endif //wxUSE_ACCEL #endif //wxUSE_ACCEL
} // end of wxWindowOS2::OS2TranslateMessage } // end of wxWindowOS2::OS2TranslateMessage
bool wxWindowOS2::OS2ShouldPreProcessMessage(
WXMSG* pMsg
)
{
// preprocess all messages by default
return TRUE;
} // end of wxWindowOS2::OS2ShouldPreProcessMessage
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// message params unpackers // message params unpackers
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -3138,6 +3146,13 @@ bool wxWindowOS2::HandleSetFocus(
WXHWND WXUNUSED(hWnd) WXHWND WXUNUSED(hWnd)
) )
{ {
//
// Notify the parent keeping track of focus for the kbd navigation
// purposes that we got it
//
wxChildFocusEvent vEventFocus((wxWindow *)this);
(void)GetEventHandler()->ProcessEvent(vEventFocus);
#if wxUSE_CARET #if wxUSE_CARET
// //
// Deal with caret // Deal with caret

View File

@@ -12321,8 +12321,8 @@ EXPORTS
wxGetNativeFontEncoding__F14wxFontEncodingP20wxNativeEncodingInfo wxGetNativeFontEncoding__F14wxFontEncodingP20wxNativeEncodingInfo
;wxOS2SelectMatchingFontByName(_FATTRS*,_FACENAMEDESC*,_FONTMETRICS*,int,const wxFont*) ;wxOS2SelectMatchingFontByName(_FATTRS*,_FACENAMEDESC*,_FONTMETRICS*,int,const wxFont*)
wxOS2SelectMatchingFontByName__FP7_FATTRSP13_FACENAMEDESCP12_FONTMETRICSiPC6wxFont wxOS2SelectMatchingFontByName__FP7_FATTRSP13_FACENAMEDESCP12_FONTMETRICSiPC6wxFont
;wxFillLogFont(_FATTRS*,_FACENAMEDESC*,unsigned long,long*,wxString&,wxFont*) ;wxFillLogFont(_FATTRS*,_FACENAMEDESC*,unsigned long*,long*,wxString&,wxFont*)
wxFillLogFont__FP7_FATTRSP13_FACENAMEDESCUlPlR8wxStringP6wxFont wxFillLogFont__FP7_FATTRSP13_FACENAMEDESCPUlPlR8wxStringP6wxFont
;wxGpiStrcmp(char*,char*) ;wxGpiStrcmp(char*,char*)
wxGpiStrcmp__FPcT1 wxGpiStrcmp__FPcT1
;wxNativeEncodingInfo::FromString(const wxString&) ;wxNativeEncodingInfo::FromString(const wxString&)
@@ -14019,6 +14019,8 @@ EXPORTS
Cut__10wxTextCtrlFv Cut__10wxTextCtrlFv
;wxTextCtrl::SetInsertionPointEnd() ;wxTextCtrl::SetInsertionPointEnd()
SetInsertionPointEnd__10wxTextCtrlFv SetInsertionPointEnd__10wxTextCtrlFv
;wxTextCtrl::OS2ShouldPreProcessMessage(void**)
OS2ShouldPreProcessMessage__10wxTextCtrlFPPv
;wxTextCtrl::DiscardEdits() ;wxTextCtrl::DiscardEdits()
DiscardEdits__10wxTextCtrlFv DiscardEdits__10wxTextCtrlFv
;wxTextCtrl::CanUndo() const ;wxTextCtrl::CanUndo() const
@@ -14650,6 +14652,8 @@ EXPORTS
OS2WindowProc__8wxWindowFUiPvT2 OS2WindowProc__8wxWindowFUiPvT2
;wxWindow::OS2TranslateMessage(void**) ;wxWindow::OS2TranslateMessage(void**)
OS2TranslateMessage__8wxWindowFPPv OS2TranslateMessage__8wxWindowFPPv
;wxWindow::OS2ShouldPreProcessMessage(void**)
OS2ShouldPreProcessMessage__8wxWindowFPPv
;wxWindow::OS2DefWindowProc(unsigned int,void*,void*) ;wxWindow::OS2DefWindowProc(unsigned int,void*,void*)
OS2DefWindowProc__8wxWindowFUiPvT2 OS2DefWindowProc__8wxWindowFUiPvT2
;wxWindow::HandleMinimize() ;wxWindow::HandleMinimize()