You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{ if (wxTheApp == NULL) { //not already initialized
925
-
if (!wxInitialize()) {
926
-
std::cerr << "WARNING: wxWidgets not initializing, widget-related commands will not be available." << std::endl;
927
-
returnfalse;
928
-
}
929
-
#ifndef __WXMAC__
930
-
wxAppGDL* app = newwxAppGDL();
931
-
app->SetInstance(app);
932
-
#endif
933
-
} else {std::cerr << "INFO: wxWidgets already initialized (in 3rd party library?), pursue with fingers crossed" << std::endl; }
928
+
boolGDLWidget::InitWx() {
929
+
// this hack enables to have a GUI on Mac OSX even if the
930
+
// program was called from the command line (and isn't a bundle)
931
+
#ifdef __WXMAC__
932
+
ProcessSerialNumber psn;
933
+
934
+
GetCurrentProcess( &psn );
935
+
CPSEnableForegroundOperation( &psn );
936
+
SetFrontProcess( &psn );
937
+
#endif
938
+
try{
939
+
wxInitialize();
940
+
} catch (...) {returnfalse;}
941
+
//avoid using if no Display is present!
942
+
wxDisplay *d= newwxDisplay();
943
+
if(d->GetCount()<1) returnfalse;
934
944
wxInitAllImageHandlers(); //do it here once for all
935
945
returntrue;
936
946
}
@@ -940,7 +950,7 @@ void GDLWidget::Init()
940
950
//set system font to something sensible now that wx is ON:
941
951
if (forceWxWidgetsUglyFonts)
942
952
systemFont = wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL) ;// identical for me to GDLWidget::setDefaultFont(wxFont("Monospace 8"));
943
-
#if __WXMSW__ //update for windows:
953
+
#ifdef __WXMSW__ //update for windows:
944
954
bool ok=systemFont.SetNativeFontInfoUserDesc(wxString("consolas 8")); //consolas 8 is apparently the one most identical to linux courier 8 and IDL X11 default font.
945
955
if (!ok) systemFont = wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL) ;
946
956
#endif
@@ -949,9 +959,6 @@ void GDLWidget::Init()
949
959
//initially defaultFont and systemFont are THE SAME.
wxClientDC dc(this); //is a scrolled window: needed
6111
-
DoPrepareDC(dc); //you probably do not want to call wxScrolled::PrepareDC() on wxAutoBufferedPaintDC as it already does this internally for the real underlying wxPaintDC.
6112
-
// dc.SetDeviceClippingRegion(GetUpdateRegion());
6123
+
// DoPrepareDC(dc); //you probably do not want to call wxScrolled::PrepareDC() on wxAutoBufferedPaintDC as it already does this internally for the real underlying wxPaintDC.
0 commit comments