]> git.saurik.com Git - wxWidgets.git/commitdiff
Got dialog sizing to work, downsized fonts a bit (though it always returns
authorJulian Smart <julian@anthemion.co.uk>
Tue, 26 Feb 2002 21:58:07 +0000 (21:58 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 26 Feb 2002 21:58:07 +0000 (21:58 +0000)
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
include/wx/x11/nanox/X11/Xlib.h
src/univ/dialog.cpp
src/unix/fontutil.cpp
src/x11/app.cpp
src/x11/toplevel.cpp

index 536ceafa8fa0f753dea6030f8c37a1c82ab49caf..d9735b4200fe09f1c4a51aea6e21efe05979c339 100644 (file)
@@ -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
index 3a4fb63db28e52887c04efe7d4d382d4631d4e5e..01ebd461b2ba2e313e07285a5409789e56ed979d 100644 (file)
@@ -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
index 6b42e73d02c72a13fdaf3bea6cd218871fa235f7..cf1d19793b044fddfcdcb01debd13092609ae960 100644 (file)
@@ -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 ) 
index dd8903996211034f47ddb544f275049375c51c69..6ac7550395029ac3a3f61ba9f952e65ebee0e8ad 100644 (file)
@@ -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;
index fe76481c957503b7f0b7988ba97a18023279c466..9dc4c4243bf980352c384690dd03e7723d7504ee 100644 (file)
@@ -518,6 +518,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
                 
                 win->GetEventHandler()->ProcessEvent( sizeEvent );
             }
+            break;
         }
 #if !wxUSE_NANOX
         case PropertyNotify:
index 645a179f70830a7558ac4991e9e42fc94069c2a1..d3a09042d0f0dde28b7cc5477063fef308ecf30a 100644 (file)
@@ -163,7 +163,6 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
                   FocusChangeMask |
                   ColormapChangeMask |
                   StructureNotifyMask |
-                  ConfigureNotify |
                   PropertyChangeMask
                   );