Пример #1
0
 public ControlWithMenu(EntityManager MathMLEntityManager, FontCollection FontCollection) 
     : base(MathMLEntityManager, FontCollection)
 {
     this.designMode = false;
     this.InitializeComponent();
     this.CreateMenu();
 }
Пример #2
0
        public FontCollection LoadAll()
        {
            FontCollection r = null;

            r = new FontCollection();

            Load("ESSTIXOne", "ESSTIX1_.TTF", r);
            Load("ESSTIXTwo", "ESSTIX2_.TTF", r);
            Load("ESSTIXThree", "ESSTIX3_.TTF", r);
            Load("ESSTIXFour", "ESSTIX4_.TTF", r);
            Load("ESSTIXFive", "ESSTIX5_.TTF", r);
            Load("ESSTIXSix", "ESSTIX6_.TTF", r);
            Load("ESSTIXSeven", "ESSTIX7_.TTF", r);
            Load("ESSTIXEight", "ESSTIX8_.TTF", r);
            Load("ESSTIXNine", "ESSTIX9_.TTF", r);
            Load("ESSTIXTen", "ESSTIX10.TTF", r);
            Load("ESSTIXEleven", "ESSTIX11.TTF", r);
            Load("ESSTIXTwelve", "ESSTIX12.TTF", r);
            Load("ESSTIXThirteen", "ESSTIX13.TTF", r);
            Load("ESSTIXFourteen", "ESSTIX14.TTF", r);
            Load("ESSTIXFifteen", "ESSTIX15.TTF", r);
            Load("ESSTIXSixteen", "ESSTIX16.TTF", r);
            Load("ESSTIXSeventeen", "ESSTIX17.TTF", r);

            return(r);
        }
Пример #3
0
        public FontCollection LoadAll()
        {
            FontCollection r = null;
            r = new FontCollection();

            Load("ESSTIXOne", "ESSTIX1_.TTF", r);
            Load("ESSTIXTwo", "ESSTIX2_.TTF", r);
            Load("ESSTIXThree", "ESSTIX3_.TTF", r);
            Load("ESSTIXFour", "ESSTIX4_.TTF", r);
            Load("ESSTIXFive", "ESSTIX5_.TTF", r);
            Load("ESSTIXSix", "ESSTIX6_.TTF", r);
            Load("ESSTIXSeven", "ESSTIX7_.TTF", r);
            Load("ESSTIXEight", "ESSTIX8_.TTF", r);
            Load("ESSTIXNine", "ESSTIX9_.TTF", r);
            Load("ESSTIXTen", "ESSTIX10.TTF", r);
            Load("ESSTIXEleven", "ESSTIX11.TTF", r);
            Load("ESSTIXTwelve", "ESSTIX12.TTF", r);
            Load("ESSTIXThirteen", "ESSTIX13.TTF", r);
            Load("ESSTIXFourteen", "ESSTIX14.TTF", r);
            Load("ESSTIXFifteen", "ESSTIX15.TTF", r);
            Load("ESSTIXSixteen", "ESSTIX16.TTF", r);
            Load("ESSTIXSeventeen", "ESSTIX17.TTF", r);

            return r;
        }
Пример #4
0
 private void Load(string sFontName, string sFontFileName, FontCollection FontCollection)
 {
     try
     {
         Stream stream = Facade.ResourceLoader.GetStream("Binary", sFontFileName);
         byte[] buffer = new byte[stream.Length];
         stream.Read(buffer, 0, (int)stream.Length);
         FontCollection.Put(sFontName, buffer);
         buffer = null;
         stream.Close();
     }
     catch
     {
     }
 }
Пример #5
0
 private void Load(string sFontName, string sFontFileName, FontCollection FontCollection)
 {
     try
     {
         Stream stream = Facade.ResourceLoader.GetStream("Binary", sFontFileName);
         byte[] buffer = new byte[stream.Length];
         stream.Read(buffer, 0, (int) stream.Length);
         FontCollection.Put(sFontName, buffer);
         buffer = null;
         stream.Close();
     }
     catch
     {
     }
 }
        public IdentifierDictionaryDialog(EntityManager EntityManager, FontCollection FontCollection, bool bIdentifier)
        {
            this.container = null;
            this.curEntityIndex_ = 0;
            this.numEntities_ = 0;
            this.success_ = false;
            this.ready_ = false;
            this.fonts_ = null;
            this.InitializeComponent();

            this.fonts_ = FontCollection;
            this.entManager_ = EntityManager;

            this.entities_.DoubleClick += new EventHandler(this.OnEntitiesDoubleClick);
            this.uniCats_   .ItemCheck += new ItemCheckEventHandler(this.OnUniItemCheck);
            if (bIdentifier)
            {
                this.isitalic_.Visible = true;
                this.isbold_.Visible = true;
                this.isitalic_.Checked = true;
                this.isbold_.Checked = false;
                
                this.Text = "Insert Identifier";
                this.items_ = this.entManager_.ids_;
                this.isID_.Checked = true;
                this.mo_.Checked = false;
            }
            else
            {
                this.isitalic_.Visible = false;
                this.isbold_.Visible = false;
                
                this.Text = "Insert Operator";
                this.items_ = this.entManager_.ops_;
                this.isID_.Checked = false;
                this.mo_.Checked = true;
            }
            this.cheader.Width = this.uniCats_.Size.Width - 20;
            this.FillEntities();
            this.FillCats();
            this.ready_ = true;
        }
Пример #7
0
        public Entity2FontMapper(FontCollection FontCollection, bool bRuntime)
        {
            this.mapFilename = "";
            this.fonts_ = null;
            this.fonts_ = FontCollection;

            try
            {
                this.uniCats_ = new UnicodeCategories("Binary");
                
                this.MasterFile = "FontMapping.xml";
                this.list_ = new ArrayList(0x834);
                this.codes_ = new Hashtable(0x834, 0.5f);
                this.names_ = new Hashtable(0x834, 0.5f);
                this.fontTablesHash_ = new Hashtable(10, 0.5f);
                this.fontTables_ = new ArrayList(10);

                this.ParseFontTables("Binary", "FontMapping.xml");
                this.ParseEntities("Binary", "FontMapping.xml");
            }
            catch
            {
            }
        }
Пример #8
0
        public Entity2FontMapper(FontCollection FontCollection, bool bRuntime)
        {
            this.mapFilename = "";
            this.fonts_      = null;
            this.fonts_      = FontCollection;

            try
            {
                this.uniCats_ = new UnicodeCategories("Binary");

                this.MasterFile      = "FontMapping.xml";
                this.list_           = new ArrayList(0x834);
                this.codes_          = new Hashtable(0x834, 0.5f);
                this.names_          = new Hashtable(0x834, 0.5f);
                this.fontTablesHash_ = new Hashtable(10, 0.5f);
                this.fontTables_     = new ArrayList(10);

                this.ParseFontTables("Binary", "FontMapping.xml");
                this.ParseEntities("Binary", "FontMapping.xml");
            }
            catch
            {
            }
        }
Пример #9
0
 //
 public void setFonts (FontCollection FontCollection)
 {
     this.fonts_ = FontCollection;
     if (this.painter_ != null)
     {
         this.painter_.setFonts (this.fonts_);
     }
 }
Пример #10
0
 private void Init (EntityManager MathMLEntityManager, FontCollection FontCollection)
 {
     try
     {
         SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler (UserPrefChanged);
     }
     catch
     {
     }
     fonts_ = FontCollection;
     selectionBrush_ = new SolidBrush (Color.Gray);
         
     operators_ = new OperatorDictionary ();
     builder_ = new NodesBuilder (base.ClientRectangle.Width - 20, operators_);
    
     builder_.setFonts (fonts_);
     builder_.SetOrigin (lMargin - OffsetX, tMargin - OffsetY);
     if (MathMLEntityManager == null)
     {
         entityManager = new EntityManager (fonts_);
     }
     else
     {
         entityManager = MathMLEntityManager;
     }
     builder_.SetEntityManager (entityManager);
     builder_.UndoRedo += new EventHandler (UndoRedoHandler);
     
     builder_.InvalidXML += new InvalidXMLFile (OnInvalidXML);
     
     builder_.InsertHappened += new InsertionHappenned (OnInsert);
     base.SetStyle (ControlStyles.UserPaint, true);
     base.SetStyle (ControlStyles.AllPaintingInWmPaint, true);
     base.SetStyle (ControlStyles.DoubleBuffer, true);
     caretBlackPen = new Pen (Color.Black);
     caretBluePen = new Pen (Color.Blue);
     caretThread = new Thread (new ThreadStart (CaretThreadProc));
     caretThread.Start ();
     canvasWidth = 0;
     canvasHeight = 0;
     ResizeScrollbars ();
     horScroller_.Visible = false;
     vertScroller_.Visible = false;
     vertScroller_.TabStop = false;
     horScroller_.TabStop = false;
     vertScroller_.GotFocus += new EventHandler (VertGotFocusHandler);
     horScroller_.GotFocus += new EventHandler (HorzGotFocusHandler);
     builder_.PropogateEntityManager ();
     types = new Types ();
     builder_.SetTypes (types);
     
     SetAntialias (true);
     
     try
     {
         UpdateMargins ();
     }
     catch
     {
     }
     DoResize (base.ClientRectangle.Width, base.ClientRectangle.Height, true, false);
     if (base.ClientRectangle.Width > 50)
     {
         SetWidth ((base.ClientRectangle.Width - vertScroller_.Width) - 2);
     }
     else
     {
         SetWidth (50);
     }
 }
Пример #11
0
 //
 public void SetFonts (FontCollection FontCollection)
 {
     try
     {
         fonts_ = FontCollection;
         builder_.setFonts (fonts_);
     }
     catch
     {
     }
 }
Пример #12
0
 public CoreControl (EntityManager MathMLEntityManager, FontCollection FontCollection)
 {
     needUpdate = false;
     needCheckIsPaletted = true;
     isPaletted = false;
     selectionInfo = null;
     fonts_ = null;
     panel_ = null;
     operators_ = null;
     autoCloseBrackets_ = true;
     isInitialized_ = false;
     types = null;
     canvasWidth = 0;
     canvasHeight = 0;
     lMargin = 0;
     rMargin = 0;
     tMargin = 0;
     bMargin = 0;
     bbox = new BBox ();
     markX = 0;
     markY = 0;
     caretHeight = 0;
     showCaret = false;
     offsetY = 0;
     offsetX = 0;
     isAntiAlias = true;
     haveScrollbars_ = false;
     try
     {
         InitializeComponent ();
         Init (MathMLEntityManager, FontCollection);
         isInitialized_ = true;
     }
     catch
     {
     }
 }
Пример #13
0
        public EntityManager(FontCollection FontCollection)
        {
            this.fonts_ = null;

            this.fonts_           = FontCollection;
            this.mapper_          = new Entity2FontMapper(this.fonts_, true);
            this.list_            = new ArrayList(5);
            this.fontFamilyInfos_ = new Hashtable(5, 0.5f);
            for (int i = 0; i < this.mapper_.FontTable_Count; i++)
            {
                FontFamilyInfo fontFamilyInfo = new FontFamilyInfo();
                FontTable      fontTable      = this.mapper_.GetFontTable(i);
                fontFamilyInfo.FontFamily = fontTable.FontFamily;
                fontFamilyInfo.Name       = fontTable.Name;
                fontFamilyInfo.CorrectB   = fontTable.CorrectB;
                fontFamilyInfo.CorrectH   = fontTable.CorrectH;
                fontFamilyInfo.CorrectW   = fontTable.CorrectW;
                fontFamilyInfo.CorrectY   = fontTable.CorrectY;
                fontFamilyInfo.CorrectX   = fontTable.CorrectX;
                this.list_.Add(fontFamilyInfo);
                this.fontFamilyInfos_.Add(fontFamilyInfo.FontFamily, fontFamilyInfo);
            }
            this.mapper_.ClearFontTables();
            this.ids_ = new MapItems();
            this.ops_ = new MapItems();
            try
            {
                for (int i = 0; i < this.mapper_.uniCats_.Count; i++)
                {
                    bool            isActive        = false;
                    UnicodeCategory unicodeCategory = this.mapper_.uniCats_.Indexer(i);
                    isActive = false;
                    switch (unicodeCategory.ID)
                    {
                    case 1:
                    case 3:
                    case 4:
                    case 7:
                    case 9:
                    case 11:
                    case 12:
                    case 14:
                    case 0x16:
                    case 0x1d:
                    case 0x1f:
                    case 0x20:
                        isActive = true;
                        break;
                    }
                    this.ids_.Put(unicodeCategory.ID, unicodeCategory.Name, isActive);

                    isActive = false;
                    switch (unicodeCategory.ID)
                    {
                    case 1:
                    case 11:
                    case 12:
                    case 0x10:
                    case 0x11:
                    case 0x12:
                    case 0x18:
                    case 0x19:
                    case 0x1d:
                    case 0x20:
                        isActive = true;
                        break;
                    }
                    this.ops_.Put(unicodeCategory.ID, unicodeCategory.Name, isActive);
                }
                for (int g = 0; g < this.Count; g++)
                {
                    Glyph glyph = this.Get(g);
                    if ((glyph != null) && glyph.IsVisible)
                    {
                        this.ops_.Ref(glyph.Category.ID, true);
                        this.ids_.Ref(glyph.Category.ID, true);
                        if (glyph.FontFamily.Length > 0)
                        {
                            this.ops_.Ref(glyph.Category.ID, false);
                            this.ids_.Ref(glyph.Category.ID, false);
                        }
                    }
                }
            }
            catch
            {
            }
        }
Пример #14
0
 public EntityManager(FontCollection FontCollection)
 {
     this.fonts_ = null;
     
     this.fonts_ = FontCollection;
     this.mapper_ = new Entity2FontMapper(this.fonts_, true);
     this.list_ = new ArrayList(5);
     this.fontFamilyInfos_ = new Hashtable(5, 0.5f);
     for (int i = 0; i < this.mapper_.FontTable_Count; i++)
     {
         FontFamilyInfo fontFamilyInfo = new FontFamilyInfo();
         FontTable fontTable = this.mapper_.GetFontTable(i);
         fontFamilyInfo.FontFamily = fontTable.FontFamily;
         fontFamilyInfo.Name = fontTable.Name;
         fontFamilyInfo.CorrectB = fontTable.CorrectB;
         fontFamilyInfo.CorrectH = fontTable.CorrectH;
         fontFamilyInfo.CorrectW = fontTable.CorrectW;
         fontFamilyInfo.CorrectY = fontTable.CorrectY;
         fontFamilyInfo.CorrectX = fontTable.CorrectX;
         this.list_.Add(fontFamilyInfo);
         this.fontFamilyInfos_.Add(fontFamilyInfo.FontFamily, fontFamilyInfo);
     }
     this.mapper_.ClearFontTables();
     this.ids_ = new MapItems();
     this.ops_ = new MapItems();
     try
     {
         for (int i = 0; i < this.mapper_.uniCats_.Count; i++)
         {
             bool isActive = false;
             UnicodeCategory unicodeCategory = this.mapper_.uniCats_.Indexer(i);
             isActive = false;
             switch (unicodeCategory.ID)
             {
                 case 1:
                 case 3:
                 case 4:
                 case 7:
                 case 9:
                 case 11:
                 case 12:
                 case 14:
                 case 0x16:
                 case 0x1d:
                 case 0x1f:
                 case 0x20:
                     isActive = true;
                     break;
             }
             this.ids_.Put(unicodeCategory.ID, unicodeCategory.Name, isActive);
             
             isActive = false;
             switch (unicodeCategory.ID)
             {
                 case 1:
                 case 11:
                 case 12:
                 case 0x10:
                 case 0x11:
                 case 0x12:
                 case 0x18:
                 case 0x19:
                 case 0x1d:
                 case 0x20:
                     isActive = true;
                     break;
             }
             this.ops_.Put(unicodeCategory.ID, unicodeCategory.Name, isActive);
         }
         for (int g = 0; g < this.Count; g++)
         {
             Glyph glyph = this.Get(g);
             if ((glyph != null) && glyph.IsVisible)
             {
                 this.ops_.Ref(glyph.Category.ID, true);
                 this.ids_.Ref(glyph.Category.ID, true);
                 if (glyph.FontFamily.Length > 0)
                 {
                     this.ops_.Ref(glyph.Category.ID, false);
                     this.ids_.Ref(glyph.Category.ID, false);
                 }
             }
         }
     }
     catch
     {
     }
 }