From c2ff68d3fd238a3b943fa0638c88c30b9f2818af Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 26 Feb 2002 21:58:07 +0000 Subject: [PATCH] Got dialog sizing to work, downsized fonts a bit (though it always returns the same standard font right now) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14415 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/msw/tardist | 6 +++++ include/wx/x11/nanox/X11/Xlib.h | 6 +++++ src/univ/dialog.cpp | 12 ++++++++++ src/unix/fontutil.cpp | 40 ++++++++++++++++++++++++++++++--- src/x11/app.cpp | 1 + src/x11/toplevel.cpp | 1 - 6 files changed, 62 insertions(+), 4 deletions(-) diff --git a/distrib/msw/tardist b/distrib/msw/tardist index 536ceafa8f..d9735b4200 100644 --- a/distrib/msw/tardist +++ b/distrib/msw/tardist @@ -86,6 +86,12 @@ tar cvf $2/wxMotif-${WXVER}.tar -T /tmp/wxmotif.txt gzip $2/wxMotif-${WXVER}.tar mv $2/wxMotif-${WXVER}.tar.gz $2/wxMotif-${WXVER}.tgz +### wxX: combined wxMotif and wxX11 distributions +ls `cat $1/distrib/msw/generic.rsp $1/distrib/msw/motif.rsp $1/distrib/msw/x11.rsp $1/distrib/msw/contrib.rsp $1/distrib/msw/xml.rsp $1/distrib/msw/ogl.rsp $1/distrib/msw/makefile.rsp $1/distrib/msw/tiff.rsp $1/distrib/msw/jpeg.rsp` | uniq > /tmp/wxx.txt +tar cvf $2/wxWindows-X-${WXVER}.tar -T /tmp/wxx.txt +gzip $2/wxWindows-X-${WXVER}.tar +mv $2/wxWindows-X-${WXVER}.tar.gz $2/wxWindows-X-${WXVER}.tgz + ### wxMSW ls `cat $1/distrib/msw/msw.rsp $1/distrib/msw/vc.rsp $1/distrib/msw/bc.rsp $1/distrib/msw/contrib.rsp $1/distrib/msw/xml.rsp $1/distrib/msw/makefile.rsp $1/distrib/msw/tiff.rsp $1/distrib/msw/jpeg.rsp` > /tmp/wxmsw.txt tar cvf $2/wxMSW-${WXVER}.tar -T /tmp/wxmsw.txt diff --git a/include/wx/x11/nanox/X11/Xlib.h b/include/wx/x11/nanox/X11/Xlib.h index 3a4fb63db2..01ebd461b2 100644 --- a/include/wx/x11/nanox/X11/Xlib.h +++ b/include/wx/x11/nanox/X11/Xlib.h @@ -284,6 +284,12 @@ typedef int (*XErrorHandler) ( /* WARNING, this type not in Xlib spec */ #define KeymapStateMask 0 #define StructureNotifyMask GR_EVENT_MASK_UPDATE +#ifdef ConfigureNotify +/* XtoNX.h gets it wrong */ +#undef ConfigureNotify +#endif +#define ConfigureNotify GR_EVENT_TYPE_UPDATE + #ifndef FocusIn #define FocusIn GR_EVENT_TYPE_FOCUS_IN #define FocusOut GR_EVENT_TYPE_FOCUS_OUT diff --git a/src/univ/dialog.cpp b/src/univ/dialog.cpp index 6b42e73d02..cf1d19793b 100644 --- a/src/univ/dialog.cpp +++ b/src/univ/dialog.cpp @@ -153,6 +153,18 @@ bool wxDialog::Show(bool show) EndModal(wxID_CANCEL); } + // Not sure how to put this in platform-specific + // code just yet. Nano-X has to force a size event, + // else there's no initial size. +#if wxUSE_NANOX + if (show) + { + wxSizeEvent event(GetSize(), GetId()); + event.SetEventObject(this); + GetEventHandler()->ProcessEvent(event); + } +#endif + bool ret = wxDialogBase::Show(show); if ( show ) diff --git a/src/unix/fontutil.cpp b/src/unix/fontutil.cpp index dd89039962..6ac7550395 100644 --- a/src/unix/fontutil.cpp +++ b/src/unix/fontutil.cpp @@ -614,6 +614,31 @@ static wxNativeFont wxLoadQueryFont(int pointSize, default: xfamily = wxT("*"); } #if wxUSE_NANOX + int xweight; + switch (weight) + { + case wxBOLD: + { + xweight = MWLF_WEIGHT_BOLD; + break; + } + case wxLIGHT: + { + xweight = MWLF_WEIGHT_LIGHT; + break; + } + case wxNORMAL: + { + xweight = MWLF_WEIGHT_NORMAL; + break; + } + + default: + { + xweight = MWLF_WEIGHT_DEFAULT; + break; + } + } GR_SCREEN_INFO screenInfo; GrGetScreenInfo(& screenInfo); @@ -622,15 +647,24 @@ static wxNativeFont wxLoadQueryFont(int pointSize, // A point is 1/20 of an inch. // An inch is 2.541 cm. // So pixelHeight = (pointSize / 20) (inches) * 2.541 (for cm) * yPixelsPerCM (for pixels) - - int pixelHeight = (int) ( (((float)pointSize) / 20.0) * 2.541 * (float) yPixelsPerCM) ; + // In fact pointSize is 10 * the normal point size so + // divide by 10. + + // I don't know why this is necessary, but otherwise fonts + // are just too big. + float fudgeFactor = 0.6 ; + int pixelHeight = (int) ( (((float)pointSize) / 200.0) * 2.541 * (float) yPixelsPerCM * fudgeFactor) ; + + // An alternative: assume that the screen is 72 dpi. + // This gets a similar result to above (pre-fudge factor) + //int pixelHeight = (int) (((float)pointSize / 200.0) * 72.0) ; GR_LOGFONT logFont; logFont.lfHeight = pixelHeight; logFont.lfWidth = 0; logFont.lfEscapement = 0; logFont.lfOrientation = 0; - logFont.lfWeight = weight; // TODO: check of conversion req'd + logFont.lfWeight = xweight; logFont.lfItalic = (style == wxNORMAL ? 0 : 1) ; logFont.lfUnderline = 0; logFont.lfStrikeOut = 0; diff --git a/src/x11/app.cpp b/src/x11/app.cpp index fe76481c95..9dc4c4243b 100644 --- a/src/x11/app.cpp +++ b/src/x11/app.cpp @@ -518,6 +518,7 @@ void wxApp::ProcessXEvent(WXEvent* _event) win->GetEventHandler()->ProcessEvent( sizeEvent ); } + break; } #if !wxUSE_NANOX case PropertyNotify: diff --git a/src/x11/toplevel.cpp b/src/x11/toplevel.cpp index 645a179f70..d3a09042d0 100644 --- a/src/x11/toplevel.cpp +++ b/src/x11/toplevel.cpp @@ -163,7 +163,6 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent, FocusChangeMask | ColormapChangeMask | StructureNotifyMask | - ConfigureNotify | PropertyChangeMask ); -- 2.45.2