Example #1
0
        protected virtual void MakeRootInternal()
        {
            // Setting this result too low can result in moving a cursor from an editable field
            // to a non-editable field (e.g. with Control-Right and Control-Left cursor
            // commands).  Normally we could set this to only a few (e.g. 4). but in
            // Interlinearizer we may want to jump from one sentence annotation to the next over
            // several read-only paragraphs  contained in a word bundle.  Make sure that
            // procedures that use this limit do not move the cursor from an editable to a
            // non-editable field.
            m_rootb.MaxParasToScan = 2000;

            EnsureVc();

            // We want to get notified when anything changes.
            m_sda = m_cache.MainCacheAccessor;
            m_sda.AddNotification(this);

            m_vc.ShowMorphBundles = m_propertyTable.GetBoolProperty("ShowMorphBundles", true);
            m_vc.LineChoices      = LineChoices;
            m_vc.ShowDefaultSense = true;

            m_rootb.DataAccess = m_cache.MainCacheAccessor;
            m_rootb.SetRootObject(m_hvoRoot, m_vc, InterlinVc.kfragStText, m_styleSheet);
            m_objRepo = m_cache.ServiceLocator.GetInstance <ICmObjectRepository>();
        }
Example #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// If a test overrides this, it should call this base implementation.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override void TestSetup()
        {
            base.TestSetup();

            m_notifiee = new Notifiee();
            m_sda.AddNotification(m_notifiee);
        }
Example #3
0
		/// <summary>
		/// Create one.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="appGuid"></param>
		public SyncWatcher(FdoCache cache, Guid appGuid)
		{
			m_cache = cache;
			m_appGuid = appGuid;

			m_sda = m_cache.MainCacheAccessor;
			m_sda.AddNotification(this);
		}
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="AtomicReferenceSlice"/> class.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		public AtomicReferenceSlice(FdoCache cache, ICmObject obj, int flid,
			XmlNode configurationNode, IPersistenceProvider persistenceProvider,
			Mediator mediator, StringTable stringTbl)
			: base(cache, obj, flid, configurationNode, persistenceProvider, mediator, stringTbl)
		{
			m_sda = m_cache.MainCacheAccessor;
			m_sda.AddNotification(this);
		}
Example #5
0
        /// <summary>
        /// Create one.
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="appGuid"></param>
        public SyncWatcher(FdoCache cache, Guid appGuid)
        {
            m_cache   = cache;
            m_appGuid = appGuid;

            m_sda = m_cache.MainCacheAccessor;
            m_sda.AddNotification(this);
        }
Example #6
0
 /// -----------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="AtomicReferenceSlice"/> class.
 /// </summary>
 /// -----------------------------------------------------------------------------------
 public AtomicReferenceSlice(FdoCache cache, ICmObject obj, int flid,
                             XmlNode configurationNode, IPersistenceProvider persistenceProvider,
                             Mediator mediator, StringTable stringTbl)
     : base(cache, obj, flid, configurationNode, persistenceProvider, mediator, stringTbl)
 {
     m_sda = m_cache.MainCacheAccessor;
     m_sda.AddNotification(this);
 }
Example #7
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializer
		/// </summary>
		/// <param name="cache">The instance of the DB connection representing the channel
		/// through which notifications come</param>
		/// <param name="tag">The property tag that the caller wants to be notified about
		/// </param>
		/// ------------------------------------------------------------------------------------
		internal void Init(FdoCache cache, int tag)
		{
			m_cache = cache;
			if (cache.AddChangeWatcher(this))
			{
				m_sda = m_cache.MainCacheAccessor;
				m_sda.AddNotification(this); // register this in the ISilDataAccess
			}
			m_Tag = tag;
		}
Example #8
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializer
 /// </summary>
 /// <param name="cache">The instance of the DB connection representing the channel
 /// through which notifications come</param>
 /// <param name="tag">The property tag that the caller wants to be notified about
 /// </param>
 /// ------------------------------------------------------------------------------------
 internal void Init(FdoCache cache, int tag)
 {
     m_cache = cache;
     if (cache.AddChangeWatcher(this))
     {
         m_sda = m_cache.MainCacheAccessor;
         m_sda.AddNotification(this);                 // register this in the ISilDataAccess
     }
     m_Tag = tag;
 }
        public void Init(Mediator mediator, IFsFeatStruc fs)
        {
            CheckDisposed();

            m_fs       = fs;
            m_fdoCache = (FdoCache)mediator.PropertyTable.GetValue("cache");

            UpdateRootObject();
            m_sda = m_fdoCache.MainCacheAccessor;
            m_sda.AddNotification(this);
        }
Example #10
0
		public void Init(Mediator mediator, XmlNode configurationParameters)
		{
			CheckDisposed();

			m_mediator = mediator;
			m_cache = (FdoCache) m_mediator.PropertyTable.GetValue("cache");
			mediator.AddColleague(this);

			m_sda = m_cache.MainCacheAccessor;
			m_sda.AddNotification(this);
		}
        /// <summary>
        /// Create one and install it to work on a particular cache.
        /// </summary>
        /// <param name="cache"></param>
        public CreateModifyTimeManager(FdoCache cache)
        {
            m_cache = cache;
            Debug.Assert(cache.CreateModifyManager == null);
            cache.CreateModifyManager = this;

            m_sda = cache.MainCacheAccessor;
            m_sda.AddNotification(this);

            m_mdc = cache.MetaDataCacheAccessor;
        }
		public void Init(Mediator mediator, IFsFeatStruc fs)
		{
			CheckDisposed();

			m_fs = fs;
			m_fdoCache = (FdoCache)mediator.PropertyTable.GetValue("cache");

			UpdateRootObject();
			m_sda = m_fdoCache.MainCacheAccessor;
			m_sda.AddNotification(this);
		}
        public void Init(Mediator mediator, XmlNode configurationParameters)
        {
            CheckDisposed();

            m_mediator = mediator;
            m_cache    = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
            mediator.AddColleague(this);

            m_sda = m_cache.MainCacheAccessor;
            m_sda.AddNotification(this);
        }
		/// <summary>
		/// Create one and install it to work on a particular cache.
		/// </summary>
		/// <param name="cache"></param>
		public CreateModifyTimeManager(FdoCache cache)
		{
			m_cache = cache;
			Debug.Assert(cache.CreateModifyManager == null);
			cache.CreateModifyManager = this;

			m_sda = cache.MainCacheAccessor;
			m_sda.AddNotification(this);

			m_mdc = cache.MetaDataCacheAccessor;
		}
Example #15
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public FwLabel()
        {
            m_innerFwTextBox = new InnerFwTextBox();
            m_innerFwTextBox.ReadOnlyView = true;

            Padding = new Padding(1, 2, 1, 1);
            Controls.Add(m_innerFwTextBox);

            // This causes us to get a notification when the string gets changed,
            // so we can fire our TextChanged event.
            m_sda = m_innerFwTextBox.DataAccess;
            m_sda.AddNotification(this);
            m_innerFwTextBox.AdjustStringHeight = false;
        }
Example #16
0
		/// <summary>
		/// Called when the slice is first created, but also when it is
		/// "reused" (e.g. refresh or new target object)
		/// </summary>
		/// <param name="parent"></param>
		public override void Install(DataTree parent)
		{
			CheckDisposed();

			base.Install(parent);

			if (m_cb.Dock != DockStyle.Left)
				m_cb.Dock = System.Windows.Forms.DockStyle.Left;
			if (m_cb.Width != 20)
				m_cb.Width = 20; // was taking whole length of slice

			m_sda = Cache.DomainDataByFlid;
			m_sda.AddNotification(this);
		}
Example #17
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Default Constructor
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public FwLabel()
		{
			m_innerFwTextBox = new InnerFwTextBox();
			m_innerFwTextBox.ReadOnlyView = true;

			Padding = new Padding(1, 2, 1, 1);
			Controls.Add(m_innerFwTextBox);

			// This causes us to get a notification when the string gets changed,
			// so we can fire our TextChanged event.
			m_sda = m_innerFwTextBox.DataAccess;
			m_sda.AddNotification(this);
			m_innerFwTextBox.AdjustStringHeight = false;
		}
Example #18
0
		/// <summary>
		/// Constructor invoked via the editor="customWithParams" slice XML configuration
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="editor"></param>
		/// <param name="flid"></param>
		/// <param name="node"></param>
		/// <param name="obj"></param>
		/// <param name="stringTbl"></param>
		/// <param name="persistenceProvider"></param>
		/// <param name="ws"></param>
		public BasicIPASymbolSlice(FdoCache cache, string editor, int flid,
						System.Xml.XmlNode node, ICmObject obj, StringTable stringTbl,
						IPersistenceProvider persistenceProvider, int ws)
			: base(obj.Hvo, flid, ws)
		{
			m_obj = obj; // is PhPhoneme
			//m_persistenceProvider = persistenceProvider;
			m_ws = ws;
			//m_node = node;
			m_configurationNode = node;
			m_sda = cache.MainCacheAccessor;
			m_sda.AddNotification(this);
			this.Disposed += new EventHandler(BasicIPASymbolSlice_Disposed);
			m_IPAMapperDocument = new XmlDocument();
			string sIPAMapper = Path.Combine(DirectoryFinder.TemplateDirectory, PhPhoneme.ksBasicIPAInfoFile);
			m_IPAMapperDocument.Load(sIPAMapper);
		}
Example #19
0
        /// <summary>
        /// Called when the slice is first created, but also when it is
        /// "reused" (e.g. refresh or new target object)
        /// </summary>
        /// <param name="parent"></param>
        public override void Install(DataTree parent)
        {
            CheckDisposed();

            base.Install(parent);

            if (m_cb.Dock != DockStyle.Left)
            {
                m_cb.Dock = System.Windows.Forms.DockStyle.Left;
            }
            if (m_cb.Width != 20)
            {
                m_cb.Width = 20;                 // was taking whole length of slice
            }
            m_sda = Cache.DomainDataByFlid;
            m_sda.AddNotification(this);
        }
Example #20
0
        /// <summary>
        /// Constructor invoked via the editor="customWithParams" slice XML configuration
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="editor"></param>
        /// <param name="flid"></param>
        /// <param name="node"></param>
        /// <param name="obj"></param>
        /// <param name="stringTbl"></param>
        /// <param name="persistenceProvider"></param>
        /// <param name="ws"></param>
        public BasicIPASymbolSlice(FdoCache cache, string editor, int flid,
                                   System.Xml.XmlNode node, ICmObject obj, StringTable stringTbl,
                                   IPersistenceProvider persistenceProvider, int ws)
            : base(obj.Hvo, flid, ws)
        {
            m_obj = obj;             // is PhPhoneme
            //m_persistenceProvider = persistenceProvider;
            m_ws = ws;
            //m_node = node;
            m_configurationNode = node;
            m_sda = cache.MainCacheAccessor;
            m_sda.AddNotification(this);
            this.Disposed      += new EventHandler(BasicIPASymbolSlice_Disposed);
            m_IPAMapperDocument = new XmlDocument();
            string sIPAMapper = Path.Combine(DirectoryFinder.TemplateDirectory, PhPhoneme.ksBasicIPAInfoFile);

            m_IPAMapperDocument.Load(sIPAMapper);
        }
Example #21
0
        /// <summary>
        /// Construct one.
        /// </summary>
        public TreeCombo()
        {
            this.SuspendLayout();
            // Set this box's own properties (first, as we use some of them in figuring the
            // size of other things).

            // Make and install the ComboTextBox
            m_comboTextBox = new ComboTextBox(this);
            m_comboTextBox.AccessibleName = "TextBox";
            m_comboTextBox.Dock           = DockStyle.Fill;
            m_comboTextBox.Visible        = true;
            // Don't allow typing or pasting into the text box: see LT-6595.
            m_comboTextBox.ReadOnlyView = true;

            // These two lines causes us to get a notification when the string gets changed,
            // so we can fire our TextChanged event.
            m_sda = m_comboTextBox.DataAccess;
            m_sda.AddNotification(this);

            m_comboTextBox.MouseDown += new MouseEventHandler(m_comboTextBox_MouseDown);
            m_comboTextBox.KeyPress  += new KeyPressEventHandler(m_comboTextBox_KeyPress);
            m_comboTextBox.KeyDown   += new KeyEventHandler(m_comboTextBox_KeyDown);
            m_comboTextBox.GotFocus  += new EventHandler(m_comboTextBox_GotFocus);
            m_comboTextBox.LostFocus += new EventHandler(m_comboTextBox_LostFocus);

            m_textBoxPanel = new Panel();
            m_textBoxPanel.AccessibleName = "TextBoxPanel";
            m_textBoxPanel.Dock           = DockStyle.Fill;
            m_textBoxPanel.BackColor      = Color.Transparent;
            m_textBoxPanel.Controls.Add(m_comboTextBox);
            this.Controls.Add(m_textBoxPanel);

            // Make and install the button that pops up the list.
            m_button = new DropDownButton(this);
            m_button.AccessibleName = "DropDownButton";
            m_button.Dock           = DockStyle.Right;   // Enhance JohnT: Left if RTL language?

            //m_button.FlatStyle = FlatStyle.Flat; // no raised edges etc for this button.
            m_button.MouseDown += new MouseEventHandler(m_button_MouseDown);
            m_button.GotFocus  += new EventHandler(m_button_GotFocus);
            m_button.LostFocus += new EventHandler(m_button_LostFocus);
            m_button.TabStop    = false;

            m_buttonPanel = new Panel();
            m_buttonPanel.AccessibleName = "DropDownButtonPanel";
            m_buttonPanel.Dock           = DockStyle.Right;
            m_buttonPanel.BackColor      = Color.Transparent;
            m_buttonPanel.Controls.Add(m_button);
            this.Controls.Add(m_buttonPanel);

            HasBorder      = true;
            Padding        = new Padding(Application.RenderWithVisualStyles ? 2 : 1);
            base.BackColor = SystemColors.Window;

            m_buttonPanel.Width = m_button.PreferredWidth + m_buttonPanel.Padding.Horizontal;

            // Create the list.
            m_popupTree = new PopupTree();
            m_popupTree.TabStopControl = m_comboTextBox;
            //m_tree.SelectedIndexChanged += new EventHandler(m_listBox_SelectedIndexChanged);
            //m_listBox.SameItemSelected += new EventHandler(m_listBox_SameItemSelected);
            m_popupTree.AfterSelect     += new TreeViewEventHandler(m_tree_AfterSelect);
            m_popupTree.BeforeSelect    += new TreeViewCancelEventHandler(m_popupTree_BeforeSelect);
            m_popupTree.Load            += new EventHandler(m_tree_Load);
            m_popupTree.PopupTreeClosed += new TreeViewEventHandler(m_popupTree_PopupTreeClosed);
            m_popupTree.VisibleChanged  += new EventHandler(m_popupTree_VisibleChanged);

            this.ResumeLayout();
        }
Example #22
0
		internal MorphManager(SandboxBase sandbox)
		{
			m_sandbox = sandbox;
			m_sda = sandbox.Caches.DataAccess;
			m_hvoSbWord = m_sandbox.RootWordHvo;
			m_sda.AddNotification(this);
			m_hasBeenAdded = true;
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="AtomicReferenceSlice"/> class.
		/// Used by slices that extend this class.
		/// </summary>
		/// <param name="control">The control.</param>
		/// <param name="cache">The cache.</param>
		/// <param name="obj">The obj.</param>
		/// <param name="flid">The flid.</param>
		protected AtomicReferenceSlice(Control control, FdoCache cache, ICmObject obj, int flid)
			: base(control, cache, obj, flid)
		{
			m_sda = m_cache.MainCacheAccessor;
			m_sda.AddNotification(this);
		}
		protected override void UpdateDisplayFromDatabase()
		{
			m_sda = m_cache.MainCacheAccessor;
			m_sda.RemoveNotification(this);	// Just in case...
			m_sda.AddNotification(this);
		}
Example #25
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Default Constructor.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public FwListBox()
		{
			m_items = new ObjectCollection(this);
			m_innerFwListBox = new InnerFwListBox(this);
			m_innerFwListBox.Dock = DockStyle.Fill;
			m_innerFwListBox.ReadOnlyView = true;		// ComboBoxStyle is always DropDownList.
			this.BorderStyle = BorderStyle.Fixed3D;
			this.Controls.Add(m_innerFwListBox);
			// This causes us to get a notification when the string gets changed.
			m_sda = m_innerFwListBox.DataAccess;
			m_sda.AddNotification(this);

			// This makes it, by default if the container's initialization doesn't change it,
			// the same default size as a standard list box.
			this.Size = new Size(120,84);
			// And, if not changed, it's background color is white.
			this.BackColor = SystemColors.Window;
			m_SelectedIndex = -1; // initially nothing selected.
			m_HighlightedIndex = -1; // nor highlighted.
		}
Example #26
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="cache">FDO cache.</param>
        /// <param name="obj">CmObject that is being displayed.</param>
        /// <param name="flid">The field identifier for the attribute we are displaying.</param>
        public MSAReferenceComboBoxSlice(FdoCache cache, ICmObject obj, int flid,
                                         IPersistenceProvider persistenceProvider, Mediator mediator)
            : base(new UserControl(), cache, obj, flid)
        {
            m_mediator                  = mediator;
            m_persistProvider           = persistenceProvider;
            m_tree                      = new TreeCombo();
            m_tree.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor;
            m_tree.Font                 = new System.Drawing.Font(cache.LangProject.DefaultAnalysisWritingSystemFont, 10);
            if (!Application.RenderWithVisualStyles)
            {
                m_tree.HasBorder = false;
            }

            //Set the stylesheet and writing system information so that the font size for the
            IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator);

            m_tree.WritingSystemCode = cache.LangProject.DefaultAnalysisWritingSystem;
            m_tree.StyleSheet        = stylesheet;

            // We embed the tree combo in a layer of UserControl, so it can have a fixed width
            // while the parent window control is, as usual, docked 'fill' to work with the splitter.
            m_tree.Dock      = DockStyle.Left;
            m_tree.Width     = 240;
            m_tree.DropDown += new EventHandler(m_tree_DropDown);

            Control.Controls.Add(m_tree);
            m_tree.SizeChanged += new EventHandler(m_tree_SizeChanged);
            if (m_MSAPopupTreeManager == null)
            {
                ICmPossibilityList list = m_cache.LangProject.PartsOfSpeechOA;
                int ws = m_cache.LangProject.DefaultAnalysisWritingSystem;
                m_tree.WritingSystemCode = ws;
                m_MSAPopupTreeManager    = new MSAPopupTreeManager(m_tree, m_cache, list, ws, true,
                                                                   mediator, (Form)mediator.PropertyTable.GetValue("window"));
                m_MSAPopupTreeManager.AfterSelect        += new TreeViewEventHandler(m_MSAPopupTreeManager_AfterSelect);
                m_MSAPopupTreeManager.Sense               = m_obj as ILexSense;
                m_MSAPopupTreeManager.PersistenceProvider = m_persistProvider;
            }
            try
            {
                m_handlingMessage = true;
                m_MSAPopupTreeManager.MakeTargetMenuItem();
                //m_MSAPopupTreeManager.LoadPopupTree(0);
            }
            finally
            {
                m_handlingMessage = false;
            }

            if (m_cache != null)
            {
                m_sda = m_cache.MainCacheAccessor;
                m_sda.AddNotification(this);
            }
            m_treeBaseWidth = m_tree.Width;

            Control.Height = m_tree.PreferredHeight;
            // m_tree has sensible PreferredHeight once the text is set, UserControl does not.
            //we need to set the Height after m_tree.Text has a value set to it.
        }
		protected virtual void MakeRootInternal()
		{
			m_rootb = VwRootBoxClass.Create();
			m_rootb.SetSite(this);
			// Setting this result too low can result in moving a cursor from an editable field
			// to a non-editable field (e.g. with Control-Right and Control-Left cursor
			// commands).  Normally we could set this to only a few (e.g. 4). but in
			// Interlinearizer we may want to jump from one sentence annotation to the next over
			// several read-only paragraphs  contained in a word bundle.  Make sure that
			// procedures that use this limit do not move the cursor from an editable to a
			// non-editable field.
			m_rootb.MaxParasToScan = 2000;

			EnsureVc();

			// We want to get notified when anything changes.
			m_sda = m_fdoCache.MainCacheAccessor;
			m_sda.AddNotification(this);

			m_vc.ShowMorphBundles = m_mediator.PropertyTable.GetBoolProperty("ShowMorphBundles", true);
			m_vc.LineChoices = LineChoices;
			m_vc.ShowDefaultSense = true;

			m_rootb.DataAccess = m_fdoCache.MainCacheAccessor;
			m_rootb.SetRootObject(m_hvoRoot, m_vc, InterlinVc.kfragStText, m_styleSheet);
			m_objRepo = m_fdoCache.ServiceLocator.GetInstance<ICmObjectRepository>();
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="AtomicReferenceSlice"/> class.
 /// Used by slices that extend this class.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="cache">The cache.</param>
 /// <param name="obj">The obj.</param>
 /// <param name="flid">The flid.</param>
 protected AtomicReferenceSlice(Control control, FdoCache cache, ICmObject obj, int flid)
     : base(control, cache, obj, flid)
 {
     m_sda = m_cache.MainCacheAccessor;
     m_sda.AddNotification(this);
 }
Example #29
0
 public NotifyChangeSpy(ISilDataAccess sda)
 {
     m_sda = sda;
     m_sda.AddNotification(this);
 }
Example #30
0
		public virtual void InitLoad()
		{
			CheckDisposed();

			ComputeInsertableClasses();
			m_currentIndex = -1;
			m_hvoCurrent = 0;

			m_sda = m_cache.MainCacheAccessor;
			m_sda.AddNotification(this);

			ReloadList();
		}
Example #31
0
 protected override void UpdateDisplayFromDatabase()
 {
     m_sda = m_cache.DomainDataByFlid;
     m_sda.RemoveNotification(this);             // Just in case...
     m_sda.AddNotification(this);
 }
Example #32
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make the root box.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void MakeRoot()
		{
			if (m_fdoCache == null || DesignMode)
				return;

			// for reference
			//plpi = m_fdoCache.LangProject;
			//qode = m_fdoCache.DatabaseAccessor;

			//			int cannotations = LoadAnnotations();
			//			if (cannotations == 0)
			//			{
			//				DoInitialParse(m_para);
			//				LoadAnnotations();
			//			}

			if (m_lineChoices == null)
				m_lineChoices = SetupLineChoices(null, InterlinLineChoices.InterlinMode.Analyze);

			m_rootb = VwRootBoxClass.Create();
			m_rootb.SetSite(this);
			// Setting this result too low can result in moving a cursor from an editable field
			// to a non-editable field (e.g. with Control-Right and Control-Left cursor
			// commands).  Normally we could set this to only a few (e.g. 4). but in
			// Interlinearizer we may want to jump from one sentence annotation to the next over
			// several read-only paragraphs  contained in a word bundle.  Make sure that
			// procedures that use this limit do not move the cursor from an editable to a
			// non-editable field.
			m_rootb.MaxParasToScan = 2000;

			EnsureVc();

			// We want to get notified when anything changes.
			m_sda = m_fdoCache.MainCacheAccessor;
			m_sda.AddNotification(this);

			m_vc.ShowMorphBundles = m_mediator.PropertyTable.GetBoolProperty("ShowMorphBundles", true);
			m_vc.LineChoices = m_lineChoices;
			m_vc.ShowDefaultSense = true;

			m_rootb.DataAccess = m_fdoCache.MainCacheAccessor;

			m_rootb.SetRootObject(m_hvoRoot, m_vc, (int)InterlinVc.kfragStText, m_styleSheet);

			base.MakeRoot();

			SetSandboxSize(); // in case we already have a current annotation.

			//TODO:
			//ptmw->RegisterRootBox(qrootb);
		}
Example #33
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Default Constructor
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public FwTextBox()
		{
			HasBorder = true;
			Padding = Application.RenderWithVisualStyles ? new Padding(2) : new Padding(1, 2, 1, 1);
			m_innerFwTextBox = new InnerFwTextBox();
			m_innerFwTextBox.Dock = DockStyle.Fill;
			this.Controls.Add(m_innerFwTextBox);
			// This causes us to get a notification when the string gets changed,
			// so we can fire our TextChanged event.
			m_sda = m_innerFwTextBox.DataAccess;
			m_sda.AddNotification(this);

			m_innerFwTextBox.LostFocus += new EventHandler(OnInnerTextBoxLostFocus);
			m_innerFwTextBox.GotFocus += new EventHandler(m_innerFwTextBox_GotFocus);
			m_innerFwTextBox.MouseEnter += new EventHandler(m_innerFwTextBox_MouseEnter);
			m_innerFwTextBox.MouseLeave += new EventHandler(m_innerFwTextBox_MouseLeave);

			// This makes it, by default if the container's initialization doesn't change it,
			// the same default size as a standard text box.
			this.Size = new Size(100,22);
			// And, if not changed, it's background color is white.
			this.BackColor = SystemColors.Window;
			// Since the TE team put a limit on the text height based on the control's Font,
			// we want a default font size that is big enough never to limit things.
			this.Font = new Font(Font.Name, 100.0f);
		}
Example #34
0
		public NotifyChangeSpy(ISilDataAccess sda)
		{
			m_sda = sda;
			m_sda.AddNotification(this);
		}
Example #35
0
        public void TestLexSenseSideEffects()
        {
            var       senseFactory = Cache.ServiceLocator.GetInstance <ILexSenseFactory>();
            ILexEntry entry = null;
            ILexSense sense, sense2 = null, sense3 = null, sense2_1 = null, sense2_2 = null, sense2_1_1 = null, sense2_2_1 = null;

            UndoableUnitOfWorkHelper.Do("Undo add senses", "Redo add senses", m_actionHandler, () =>
            {
                entry = Cache.ServiceLocator.GetInstance <ILexEntryFactory>().Create();
                sense = senseFactory.Create();
                entry.SensesOS.Add(sense);
                Assert.AreEqual("1", sense.LexSenseOutline.Text);
                sense2 = senseFactory.Create();
                entry.SensesOS.Add(sense2);
                Assert.AreEqual("2", sense2.LexSenseOutline.Text);
                sense3 = senseFactory.Create();
                entry.SensesOS.Add(sense3);
                Assert.AreEqual("3", sense3.LexSenseOutline.Text);

                sense2_1 = senseFactory.Create();
                sense2.SensesOS.Add(sense2_1);
                Assert.AreEqual("2.1", sense2_1.LexSenseOutline.Text);

                sense2_2 = senseFactory.Create();
                sense2.SensesOS.Add(sense2_2);
                Assert.AreEqual("2.2", sense2_2.LexSenseOutline.Text);

                sense2_1_1 = senseFactory.Create();
                sense2_1.SensesOS.Add(sense2_1_1);
                Assert.AreEqual("2.1.1", sense2_1_1.LexSenseOutline.Text);

                sense2_2_1 = senseFactory.Create();
                sense2_2.SensesOS.Add(sense2_2_1);
                Assert.AreEqual("2.2.1", sense2_2_1.LexSenseOutline.Text);
            });

            m_notifiee = new Notifiee();
            var mdc = m_sda.MetaDataCache;
            var lsoFlid = mdc.GetFieldId("LexSense", "LexSenseOutline", false);

            m_sda.AddNotification(m_notifiee);
            ILexSense senseInserted = null;

            UndoableUnitOfWorkHelper.Do("Undo add another sense", "Redo add another sense", m_actionHandler, () =>
            {
                senseInserted = senseFactory.Create();
                entry.SensesOS.Insert(1, senseInserted);
                Assert.AreEqual("2", senseInserted.LexSenseOutline.Text);
            });
            int nosFlid = mdc.GetFieldId("LexEntry", "NumberOfSensesForEntry", false);

            m_notifiee.CheckChangesWeaker(new[]
            {
                new ChangeInformationTest(entry.Hvo, nosFlid, 0, 0, 0),
                new ChangeInformationTest(entry.Hvo, LexEntryTags.kflidSenses, 1, 1, 0),
                new ChangeInformationTest(sense2.Hvo, lsoFlid, 0, "2".Length, "3".Length),
                new ChangeInformationTest(sense3.Hvo, lsoFlid, 0, "3".Length, "4".Length),
                new ChangeInformationTest(sense2_1.Hvo, lsoFlid, 0, "2.1".Length, "3.1".Length),
                new ChangeInformationTest(sense2_2.Hvo, lsoFlid, 0, "2.1".Length, "3.1".Length),
                new ChangeInformationTest(sense2_1_1.Hvo, lsoFlid, 0, "2.1.1".Length, "3.1.1".Length),
                new ChangeInformationTest(sense2_2_1.Hvo, lsoFlid, 0, "2.2.1".Length, "3.2.1".Length),
            }, "insert second sense in entry");
            m_sda.RemoveNotification(m_notifiee);
            Assert.AreEqual("3.1.1", sense2_1_1.LexSenseOutline.Text);

            m_notifiee = new Notifiee();
            m_sda.AddNotification(m_notifiee);
            UndoableUnitOfWorkHelper.Do("Undo remove sense", "Redo remove sense", m_actionHandler, () =>
                                        entry.SensesOS.Remove(senseInserted));
            m_notifiee.CheckChangesWeaker(new[]
            {
                new ChangeInformationTest(entry.Hvo, nosFlid, 0, 0, 0),
                new ChangeInformationTest(entry.Hvo, LexEntryTags.kflidSenses, 1, 0, 1),
                new ChangeInformationTest(sense2.Hvo, lsoFlid, 0, "2".Length, "3".Length),
                new ChangeInformationTest(sense3.Hvo, lsoFlid, 0, "3".Length, "4".Length),
                new ChangeInformationTest(sense2_1.Hvo, lsoFlid, 0, "2.1".Length, "3.1".Length),
                new ChangeInformationTest(sense2_2.Hvo, lsoFlid, 0, "2.1".Length, "3.1".Length),
                new ChangeInformationTest(sense2_1_1.Hvo, lsoFlid, 0, "2.1.1".Length, "3.1.1".Length),
                new ChangeInformationTest(sense2_2_1.Hvo, lsoFlid, 0, "2.2.1".Length, "3.2.1".Length),
            }, "delete second sense in entry");
            m_sda.RemoveNotification(m_notifiee);
            Assert.AreEqual("2.1.1", sense2_1_1.LexSenseOutline.Text);

            m_notifiee = new Notifiee();
            m_sda.AddNotification(m_notifiee);
            UndoableUnitOfWorkHelper.Do("Undo add another sense", "Redo add another sense", m_actionHandler, () =>
            {
                senseInserted = senseFactory.Create();
                sense2.SensesOS.Insert(1, senseInserted);
                Assert.AreEqual("2.2", senseInserted.LexSenseOutline.Text);
            });
            m_notifiee.CheckChangesWeaker(new[]
            {
                new ChangeInformationTest(entry.Hvo, nosFlid, 0, 0, 0),
                new ChangeInformationTest(sense2.Hvo, LexSenseTags.kflidSenses, 1, 1, 0),
                new ChangeInformationTest(sense2_2.Hvo, lsoFlid, 0, "2.2".Length, "2.3".Length),
                new ChangeInformationTest(sense2_2_1.Hvo, lsoFlid, 0, "2.2.1".Length, "2.3.1".Length),
            }, "insert subsense in sense");
            m_sda.RemoveNotification(m_notifiee);
            Assert.AreEqual("2.3.1", sense2_2_1.LexSenseOutline.Text);

            m_notifiee = new Notifiee();
            m_sda.AddNotification(m_notifiee);
            UndoableUnitOfWorkHelper.Do("Undo get rid of sense", "Redo get rid of sense", m_actionHandler, () =>
                                        sense2.SensesOS.Remove(senseInserted));
            m_notifiee.CheckChangesWeaker(new[]
            {
                new ChangeInformationTest(entry.Hvo, nosFlid, 0, 0, 0),
                new ChangeInformationTest(sense2.Hvo, LexSenseTags.kflidSenses, 1, 0, 1),
                new ChangeInformationTest(sense2_2.Hvo, lsoFlid, 0, "2.2".Length, "2.3".Length),
                new ChangeInformationTest(sense2_2_1.Hvo, lsoFlid, 0, "2.2.1".Length, "2.3.1".Length),
            }, "remove subsense from sense");
            m_sda.RemoveNotification(m_notifiee);
            Assert.AreEqual("2.2.1", sense2_2_1.LexSenseOutline.Text);
        }
Example #36
0
		protected void InitializeComponentBasic()
		{
			// Set up property change notification.
			m_sda = m_cache.MainCacheAccessor;
			m_sda.AddNotification(this);

			// Currently we inherit from UserControl, which doesn't have a border. If we
			// need one various things will have to change to Panel.
			//this.BorderStyle = BorderStyle.FixedSingle;
			this.BackColor = Color.FromKnownColor(KnownColor.Window);
		}
Example #37
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Default Constructor
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public FwTextBox()
		{
			m_innerFwTextBox = new InnerFwTextBox();

			if (Application.RenderWithVisualStyles)
				DoubleBuffered = true;

			HasBorder = true;
			Padding = Application.RenderWithVisualStyles ? new Padding(2) : new Padding(1, 2, 1, 1);
			m_innerFwTextBox.Dock = DockStyle.Fill;
			Controls.Add(m_innerFwTextBox);
			// This causes us to get a notification when the string gets changed,
			// so we can fire our TextChanged event.
			m_sda = m_innerFwTextBox.DataAccess;
			m_sda.AddNotification(this);

			m_innerFwTextBox.LostFocus += OnInnerTextBoxLostFocus;
			m_innerFwTextBox.GotFocus += m_innerFwTextBox_GotFocus;
			m_innerFwTextBox.MouseEnter += m_innerFwTextBox_MouseEnter;
			m_innerFwTextBox.MouseLeave += m_innerFwTextBox_MouseLeave;

			// This makes it, by default if the container's initialization doesn't change it,
			// the same default size as a standard text box.
			Size = new Size(100, 22);

			// And, if not changed, it's background color is white.
			BackColor = SystemColors.Window;
			// Since the TE team put a limit on the text height based on the control's Font,
			// we want a default font size that is big enough never to limit things.
			Font = new Font(Font.Name, 100.0f);

			// We don't want to auto scale because that messes up selections. You can see this
			// by commenting this line. If FwFindReplaceDlg.AutoScaleMode is set to Font the test
			// SIL.FieldWorks.FwCoreDlgs.FwFindReplaceDlgTests.ApplyWS_ToSelectedString will
			// fail because it didn't make a range selection.
			AutoScaleMode = AutoScaleMode.None;
		}
		protected override void UpdateDisplayFromDatabase()
		{
			m_sda = m_cache.DomainDataByFlid;
			m_sda.RemoveNotification(this);	// Just in case...
			m_sda.AddNotification(this);
		}
Example #39
0
		/// <summary>
		/// Construct one.
		/// </summary>
		public FwComboBoxBase()
		{
			if (Application.RenderWithVisualStyles)
				DoubleBuffered = true;

			SuspendLayout();
			// Set this box's own properties (first, as we use some of them in figuring the
			// size of other things).

			// Make and install the ComboTextBox
			m_comboTextBox = new ComboTextBox(this);
			m_comboTextBox.AccessibleName = "TextBox";
			m_comboTextBox.Dock = DockStyle.Fill;
			m_comboTextBox.Visible = true;

			// This causes us to get a notification when the string gets changed, so we can fire our
			// TextChanged event.
			m_sda = m_comboTextBox.DataAccess;
			m_sda.AddNotification(this);

			m_comboTextBox.KeyDown += m_comboTextBox_KeyDown;
			m_comboTextBox.MouseDown += m_comboTextBox_MouseDown;
			m_comboTextBox.GotFocus += m_comboTextBox_GotFocus;
			m_comboTextBox.LostFocus += m_comboTextBox_LostFocus;
			m_comboTextBox.TabIndex = 1;
			m_comboTextBox.TabStop = true;

			m_textBoxPanel = new Panel();
			m_textBoxPanel.AccessibleName = "TextBoxPanel";
			m_textBoxPanel.Dock = DockStyle.Fill;
			m_textBoxPanel.BackColor = Color.Transparent;
			m_textBoxPanel.Controls.Add(m_comboTextBox);
			Controls.Add(m_textBoxPanel);

			// Make and install the button that pops up the list.
			m_button = new DropDownButton(this);
			m_button.AccessibleName = "DropDownButton";
			m_button.Dock = DockStyle.Right; // Enhance JohnT: Left if RTL language?
			m_button.TabStop = false;

			//m_button.FlatStyle = FlatStyle.Flat; // no raised edges etc for this button.
			////			m_button.Click += new EventHandler(m_button_Click);

			m_button.MouseDown += m_button_MouseDown;
			m_button.KeyDown += m_button_KeyDown;
			m_button.GotFocus += m_button_GotFocus;
			m_button.LostFocus += m_button_LostFocus;

			m_buttonPanel = new Panel();
			m_buttonPanel.AccessibleName = "DropDownButtonPanel";
			m_buttonPanel.Dock = DockStyle.Right;
			m_buttonPanel.BackColor = Color.Transparent;
			m_buttonPanel.Controls.Add(m_button);
			Controls.Add(m_buttonPanel);

			HasBorder = true;
			Padding = new Padding(Application.RenderWithVisualStyles ? 2 : 1);
			base.BackColor = SystemColors.Window;

			m_buttonPanel.Width = m_button.PreferredWidth + m_buttonPanel.Padding.Horizontal;

			m_dropDownBox = CreateDropDownBox();
			m_dropDownBox.Form.VisibleChanged += Form_VisibleChanged;

			ResumeLayout();
		}
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="cache">FDO cache.</param>
		/// <param name="obj">CmObject that is being displayed.</param>
		/// <param name="flid">The field identifier for the attribute we are displaying.</param>
		public MSAReferenceComboBoxSlice(FdoCache cache, ICmObject obj, int flid,
			IPersistenceProvider persistenceProvider, Mediator mediator)
			: base(new UserControl(), cache, obj, flid)
		{
			m_mediator = mediator;
			m_persistProvider = persistenceProvider;
			m_tree = new TreeCombo();
			m_tree.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor;
			m_tree.Font = new System.Drawing.Font(cache.LangProject.DefaultAnalysisWritingSystemFont, 10);
			if (!Application.RenderWithVisualStyles)
				m_tree.HasBorder = false;

			//Set the stylesheet and writing system information so that the font size for the
			IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator);
			m_tree.WritingSystemCode = cache.LangProject.DefaultAnalysisWritingSystem;
			m_tree.StyleSheet = stylesheet;

			// We embed the tree combo in a layer of UserControl, so it can have a fixed width
			// while the parent window control is, as usual, docked 'fill' to work with the splitter.
			m_tree.Dock = DockStyle.Left;
			m_tree.Width = 240;
			m_tree.DropDown += new EventHandler(m_tree_DropDown);

			Control.Controls.Add(m_tree);
			m_tree.SizeChanged += new EventHandler(m_tree_SizeChanged);
			if (m_MSAPopupTreeManager == null)
			{
				ICmPossibilityList list = m_cache.LangProject.PartsOfSpeechOA;
				int ws = m_cache.LangProject.DefaultAnalysisWritingSystem;
				m_tree.WritingSystemCode = ws;
				m_MSAPopupTreeManager = new MSAPopupTreeManager(m_tree, m_cache, list, ws, true,
					mediator, (Form)mediator.PropertyTable.GetValue("window"));
				m_MSAPopupTreeManager.AfterSelect += new TreeViewEventHandler(m_MSAPopupTreeManager_AfterSelect);
				m_MSAPopupTreeManager.Sense = m_obj as ILexSense;
				m_MSAPopupTreeManager.PersistenceProvider = m_persistProvider;
			}
			try
			{
				m_handlingMessage = true;
				m_MSAPopupTreeManager.MakeTargetMenuItem();
				//m_MSAPopupTreeManager.LoadPopupTree(0);
			}
			finally
			{
				m_handlingMessage = false;
			}

			if (m_cache != null)
			{
				m_sda = m_cache.MainCacheAccessor;
				m_sda.AddNotification(this);
			}
			m_treeBaseWidth = m_tree.Width;

			Control.Height = m_tree.PreferredHeight;
						// m_tree has sensible PreferredHeight once the text is set, UserControl does not.
						//we need to set the Height after m_tree.Text has a value set to it.
		}
		internal SandboxEditMonitor(SandboxBase sandbox)
		{
			m_sandbox = sandbox;
			m_sda = sandbox.Caches.DataAccess;
			m_hvoSbWord = m_sandbox.RootWordHvo;
			m_sda.AddNotification(this);
		}
 public override void Initialize(FdoCache cache, ICmObject obj, int flid, string fieldName, IPersistenceProvider persistProvider, XCore.Mediator mediator, string displayNameProperty, string displayWs)
 {
     base.Initialize(cache, obj, flid, fieldName, persistProvider, mediator, displayNameProperty, displayWs);
     m_sda = m_cache.MainCacheAccessor;
     m_sda.AddNotification(this);
 }
		public override void Initialize(FdoCache cache, ICmObject obj, int flid, string fieldName, IPersistenceProvider persistProvider, XCore.Mediator mediator, string displayNameProperty, string displayWs)
		{
			base.Initialize(cache, obj, flid, fieldName, persistProvider, mediator, displayNameProperty, displayWs);
			m_sda = m_cache.MainCacheAccessor;
			m_sda.AddNotification(this);
		}
Example #44
0
 /// <summary>
 /// Request notification when properties change. The ${IVwNotifyChange#PropChanged}
 /// method will be called when the property changes (provided the client making the
 /// change properly calls ${#PropChanged}.
 ///</summary>
 /// <param name='nchng'> </param>
 public void AddNotification(IVwNotifyChange nchng)
 {
     m_baseSda.AddNotification(nchng);
 }
		/// <summary>
		/// Therefore this method, called once we have a cache and object, is our first chance to
		/// actually create the embedded control.
		/// </summary>
		public override void FinishInit()
		{
			CheckDisposed();
			ReversalIndexEntrySliceView ctrl = new ReversalIndexEntrySliceView(Object.Hvo);
			ctrl.Cache = (FdoCache)Mediator.PropertyTable.GetValue("cache");
			Control = ctrl;
			//m_menuHandler = InflAffixTemplateMenuHandler.Create(ctrl, ConfigurationNode["deParams"]);
#if !Want
			//m_menuHandler.Init(this.Mediator, null);
#else
			//m_menuHandler.Init(null, null);
#endif
			//ctrl.SetContextMenuHandler(new InflAffixTemplateEventHandler(m_menuHandler.ShowSliceContextMenu));
			ctrl.Mediator = Mediator;
			m_sda = ctrl.Cache.MainCacheAccessor;
			m_sda.AddNotification(this);

			if (ctrl.RootBox == null)
				ctrl.MakeRoot();
		}
 /// <summary>
 ///
 /// </summary>
 /// <param name="_nchng"></param>
 public void AddNotification(IVwNotifyChange _nchng)
 {
     m_sda.AddNotification(_nchng);
 }
 protected override void UpdateDisplayFromDatabase()
 {
     m_sda = m_cache.MainCacheAccessor;
     m_sda.RemoveNotification(this);             // Just in case...
     m_sda.AddNotification(this);
 }
Example #48
0
		/// <summary>
		/// Construct one.
		/// </summary>
		public TreeCombo()
		{
			this.SuspendLayout();
			// Set this box's own properties (first, as we use some of them in figuring the
			// size of other things).

			// Make and install the ComboTextBox
			m_comboTextBox = new ComboTextBox(this);
			m_comboTextBox.AccessibleName = "TextBox";
			m_comboTextBox.Dock = DockStyle.Fill;
			m_comboTextBox.Visible = true;
			// Don't allow typing or pasting into the text box: see LT-6595.
			m_comboTextBox.ReadOnlyView = true;

			// These two lines causes us to get a notification when the string gets changed,
			// so we can fire our TextChanged event.
			m_sda = m_comboTextBox.DataAccess;
			m_sda.AddNotification(this);

			m_comboTextBox.MouseDown += new MouseEventHandler(m_comboTextBox_MouseDown);
			m_comboTextBox.KeyPress += new KeyPressEventHandler(m_comboTextBox_KeyPress);
			m_comboTextBox.KeyDown += new KeyEventHandler(m_comboTextBox_KeyDown);
			m_comboTextBox.GotFocus += new EventHandler(m_comboTextBox_GotFocus);
			m_comboTextBox.LostFocus += new EventHandler(m_comboTextBox_LostFocus);

			m_textBoxPanel = new Panel();
			m_textBoxPanel.AccessibleName = "TextBoxPanel";
			m_textBoxPanel.Dock = DockStyle.Fill;
			m_textBoxPanel.BackColor = Color.Transparent;
			m_textBoxPanel.Controls.Add(m_comboTextBox);
			this.Controls.Add(m_textBoxPanel);

			// Make and install the button that pops up the list.
			m_button = new DropDownButton(this);
			m_button.AccessibleName = "DropDownButton";
			m_button.Dock = DockStyle.Right; // Enhance JohnT: Left if RTL language?

			//m_button.FlatStyle = FlatStyle.Flat; // no raised edges etc for this button.
			m_button.MouseDown += new MouseEventHandler(m_button_MouseDown);
			m_button.GotFocus += new EventHandler(m_button_GotFocus);
			m_button.LostFocus += new EventHandler(m_button_LostFocus);
			m_button.TabStop = false;

			m_buttonPanel = new Panel();
			m_buttonPanel.AccessibleName = "DropDownButtonPanel";
			m_buttonPanel.Dock = DockStyle.Right;
			m_buttonPanel.BackColor = Color.Transparent;
			m_buttonPanel.Controls.Add(m_button);
			this.Controls.Add(m_buttonPanel);

			HasBorder = true;
			Padding = new Padding(Application.RenderWithVisualStyles ? 2 : 1);
			base.BackColor = SystemColors.Window;

			m_buttonPanel.Width = m_button.PreferredWidth + m_buttonPanel.Padding.Horizontal;

			// Create the list.
			m_popupTree = new PopupTree();
			m_popupTree.TabStopControl = m_comboTextBox;
			//m_tree.SelectedIndexChanged += new EventHandler(m_listBox_SelectedIndexChanged);
			//m_listBox.SameItemSelected += new EventHandler(m_listBox_SameItemSelected);
			m_popupTree.AfterSelect += new TreeViewEventHandler(m_tree_AfterSelect);
			m_popupTree.BeforeSelect += new TreeViewCancelEventHandler(m_popupTree_BeforeSelect);
			m_popupTree.Load += new EventHandler(m_tree_Load);
			m_popupTree.PopupTreeClosed += new TreeViewEventHandler(m_popupTree_PopupTreeClosed);
			m_popupTree.VisibleChanged += new EventHandler(m_popupTree_VisibleChanged);

			this.ResumeLayout();
		}