0023418: Crash on the object displaying when running DRAW on remote station. OpenGL...
[occt.git] / src / OpenGl / OpenGl_Display_1.cxx
index 3e0d48c..482c780 100644 (file)
@@ -1,9 +1,24 @@
-// File:      OpenGl_Display_1.cxx
-// Created:   25 October 2011
-// Author:    Sergey ZERCHANINOV
-// Copyright: OPEN CASCADE 2011
-
-#include <OpenGl_tgl_all.hxx>
+// Created on: 2011-10-25
+// Created by: Sergey ZERCHANINOV
+// Copyright (c) 2011-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+#include <InterfaceGraphic.hxx>
 #include <OpenGl_Display.hxx>
 
 #include <TCollection_AsciiString.hxx>
 #include <OpenGl_PrinterContext.hxx>
 #include <OpenGl_AspectText.hxx>
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #ifdef HAVE_GL2PS
 #include <gl2ps.h>
 #endif
@@ -26,7 +45,7 @@ struct FontMapNode
 {
   const char *    EnumName;
   const char *    FontName;
-  OSD_FontAspect  FontAspect;
+  Font_FontAspect FontAspect;
 };
 
 static const FontMapNode myFontMap[] =
@@ -34,30 +53,30 @@ static const FontMapNode myFontMap[] =
 
 #ifdef WNT
 
-  { "Courier"                  , "Courier New"    , OSD_FA_Regular },
-  { "Times-Roman"              , "Times New Roman", OSD_FA_Regular  },
-  { "Times-Bold"               , "Times New Roman", OSD_FA_Bold },
-  { "Times-Italic"             , "Times New Roman", OSD_FA_Italic  },
-  { "Times-BoldItalic"         , "Times New Roman", OSD_FA_BoldItalic  },
-  { "ZapfChancery-MediumItalic", "Script"         , OSD_FA_Regular  },
-  { "Symbol"                   , "Symbol"         , OSD_FA_Regular  },
-  { "ZapfDingbats"             , "WingDings"      , OSD_FA_Regular  },
-  { "Rock"                     , "Arial"          , OSD_FA_Regular  },
-  { "Iris"                     , "Lucida Console" , OSD_FA_Regular  }
+  { "Courier"                  , "Courier New"    , Font_FA_Regular },
+  { "Times-Roman"              , "Times New Roman", Font_FA_Regular  },
+  { "Times-Bold"               , "Times New Roman", Font_FA_Bold },
+  { "Times-Italic"             , "Times New Roman", Font_FA_Italic  },
+  { "Times-BoldItalic"         , "Times New Roman", Font_FA_BoldItalic  },
+  { "ZapfChancery-MediumItalic", "Script"         , Font_FA_Regular  },
+  { "Symbol"                   , "Symbol"         , Font_FA_Regular  },
+  { "ZapfDingbats"             , "WingDings"      , Font_FA_Regular  },
+  { "Rock"                     , "Arial"          , Font_FA_Regular  },
+  { "Iris"                     , "Lucida Console" , Font_FA_Regular  }
 
 #else   //X11
 
-  { "Courier"                  , "Courier"      , OSD_FA_Regular },
-  { "Times-Roman"              , "Times"        , OSD_FA_Regular  },
-  { "Times-Bold"               , "Times"        , OSD_FA_Bold },
-  { "Times-Italic"             , "Times"        , OSD_FA_Italic  },
-  { "Times-BoldItalic"         , "Times"        , OSD_FA_BoldItalic  },
-  { "Arial"                    , "Helvetica"    , OSD_FA_Regular  }, 
-  { "ZapfChancery-MediumItalic", "-adobe-itc zapf chancery-medium-i-normal--*-*-*-*-*-*-iso8859-1"              , OSD_FA_Regular  },
-  { "Symbol"                   , "-adobe-symbol-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific"                , OSD_FA_Regular  },
-  { "ZapfDingbats"             , "-adobe-itc zapf dingbats-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific"     , OSD_FA_Regular  },
-  { "Rock"                     , "-sgi-rock-medium-r-normal--*-*-*-*-p-*-iso8859-1"                             , OSD_FA_Regular  },
-  { "Iris"                     , "--iris-medium-r-normal--*-*-*-*-m-*-iso8859-1"                                , OSD_FA_Regular  }
+  { "Courier"                  , "Courier"      , Font_FA_Regular },
+  { "Times-Roman"              , "Times"        , Font_FA_Regular  },
+  { "Times-Bold"               , "Times"        , Font_FA_Bold },
+  { "Times-Italic"             , "Times"        , Font_FA_Italic  },
+  { "Times-BoldItalic"         , "Times"        , Font_FA_BoldItalic  },
+  { "Arial"                    , "Helvetica"    , Font_FA_Regular  }, 
+  { "ZapfChancery-MediumItalic", "-adobe-itc zapf chancery-medium-i-normal--*-*-*-*-*-*-iso8859-1"              , Font_FA_Regular  },
+  { "Symbol"                   , "-adobe-symbol-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific"                , Font_FA_Regular  },
+  { "ZapfDingbats"             , "-adobe-itc zapf dingbats-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific"     , Font_FA_Regular  },
+  { "Rock"                     , "-sgi-rock-medium-r-normal--*-*-*-*-p-*-iso8859-1"                             , Font_FA_Regular  },
+  { "Iris"                     , "--iris-medium-r-normal--*-*-*-*-m-*-iso8859-1"                                , Font_FA_Regular  }
 #endif
 
 };
@@ -135,7 +154,7 @@ void OpenGl_Display::getGL2PSFontName (const char *src_font, char *ps_font)
 
 /*-----------------------------------------------------------------------------*/
 
-int OpenGl_Display::FindFont (const char* AFontName, const OSD_FontAspect AFontAspect,
+int OpenGl_Display::FindFont (const char* AFontName, const Font_FontAspect AFontAspect,
                              const int ABestSize, const float AXScale, const float AYScale)
 {   
   if (!AFontName)
@@ -175,7 +194,7 @@ int OpenGl_Display::FindFont (const char* AFontName, const OSD_FontAspect AFontA
   // The last resort: trying to use ANY font available in the system
   if ( myFont == -1 )
   {
-    myFont = mgr->request_font( family_name, OSD_FA_Undefined, -1 );
+    myFont = mgr->request_font( family_name, Font_FA_Undefined, -1 );
   }
 
   if ( myFont != -1 )
@@ -240,7 +259,7 @@ class MultilineTextRenderer
       myNewStr        (0),
       myStrPtr        (&theStr[0])
   {
-    const Standard_Integer  aStrLen       = wcslen(theStr); // Length of the original string
+    const Standard_Integer  aStrLen       = (Standard_Integer) wcslen(theStr); // Length of the original string
     Standard_Integer        aNextCRChar   = 0;  // Character after '\r' (Carriage Return)        '\x00\x0D'
     Standard_Integer        aHTNum        = 0;  // Number of       '\t' (Horizontal Tabulation)  '\x00\x09'
     Standard_Integer        aDumpNum      = 0;  // Number of '\a', '\b', '\v' and '\f'