예제 #1
0
        public TextController(string bossName)
            : base(NSObject.AllocAndInitInstance("TextController"))
        {
            m_boss = ObjectModel.Create(bossName);
            Unused.Value = NSBundle.loadNibNamed_owner(NSString.Create("text-editor"), this);

            m_textView = new IBOutlet<NSTextView>(this, "textView");
            m_lineLabel = new IBOutlet<NSButton>(this, "lineLabel");
            m_decPopup = new IBOutlet<NSPopUpButton>(this, "decsPopup");
            m_scrollView = new IBOutlet<NSScrollView>(this, "scrollView");
            m_restorer = new RestoreViewState(this);

            var wind = m_boss.Get<IWindow>();
            wind.Window = window();

            m_applier = new ApplyStyles(this, m_textView.Value);
            DoSetTextOptions();

            Broadcaster.Register("text default color changed", this);
            Broadcaster.Register("languages changed", this);
            Broadcaster.Register("directory prefs changed", this);
            DoUpdateDefaultColor(string.Empty, null);

            m_textView.Value.Call("onOpened:", this);

            ActiveObjects.Add(this);
        }
예제 #2
0
        // We can't restore the scoller until layout has completed (because the scroller
        // doesn't know how many lines there are until this happens).
        public void layoutManager_didCompleteLayoutForTextContainer_atEnd(NSLayoutManager layout, NSTextContainer container, bool atEnd)
        {
            if (!m_closed)
            {
                if (m_restorer != null && (m_applier.Applied || m_language == null))
                    if (m_restorer.OnCompletedLayout(layout, atEnd))
                        m_restorer = null;

                if (atEnd)
                {
                    Broadcaster.Invoke("layout completed", m_boss);
                    DoPruneRanges();
                }
            }
        }