UseMultiStringCaption() public method

Convert the text box for the caption to a multilingual string control.
public UseMultiStringCaption ( SIL.FieldWorks.FDO.FdoCache cache, int wsMagic, IVwStylesheet stylesheet ) : void
cache SIL.FieldWorks.FDO.FdoCache
wsMagic int
stylesheet IVwStylesheet
return void
Esempio n. 1
0
		public void showProperties()
		{
			CheckDisposed();
			var pic = (ICmPicture)Object;
			var app = (IApp)m_mediator.PropertyTable.GetValue("App");
			using (var dlg = new PicturePropertiesDialog(m_cache, pic, m_mediator.HelpTopicProvider, app, true))
			{
				if (dlg.Initialize())
				{
					var stylesheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator);
					dlg.UseMultiStringCaption(m_cache, WritingSystemServices.kwsVernAnals, stylesheet);
					dlg.SetMultilingualCaptionValues(pic.Caption);
					if (dlg.ShowDialog() == DialogResult.OK)
					{
						UndoableUnitOfWorkHelper.Do(DetailControlsStrings.ksUndoUpdatePicture, DetailControlsStrings.ksRedoUpdatePicture, m_obj, () =>
						{
							string strLocalPictures = CmFolderTags.DefaultPictureFolder;
							dlg.GetMultilingualCaptionValues(pic.Caption);
							pic.UpdatePicture(dlg.CurrentFile, null, strLocalPictures, 0);
						});
						InstallPicture(m_picBox);
						m_lastSize = new Size(0, 0); // forces OnSizeChanged to do something (we need to adjust to new aspect ratio).
						OnSizeChanged(new EventArgs());
					}
				}
			}
		}
Esempio n. 2
0
		/// <summary>
		/// Called by reflection based on menu item InsertPicture.
		/// </summary>
		/// <param name="cmd"></param>
		/// <returns></returns>
		public bool OnInsertPicture(object cmd)
		{
			int flid;
			if (!CanInsertPictureOrMediaFile(cmd, out flid))
				return false; // should not happen, but play safe
			var obj = m_dataEntryForm.CurrentSlice.Object;
			int chvo = obj.Cache.DomainDataByFlid.get_VecSize(obj.Hvo, flid);
			IApp app = (IApp)m_mediator.PropertyTable.GetValue("App");
			using (PicturePropertiesDialog dlg = new PicturePropertiesDialog(obj.Cache, null,
				m_mediator.HelpTopicProvider, app, true))
			{
				if (dlg.Initialize())
				{
					var stylesheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator);
					dlg.UseMultiStringCaption(obj.Cache, WritingSystemServices.kwsVernAnals, stylesheet);
					if (dlg.ShowDialog() == DialogResult.OK)
					{
						UndoableUnitOfWorkHelper.Do(xWorksStrings.ksUndoInsertPicture, xWorksStrings.ksRedoInsertPicture, obj, () =>
						{
							string strLocalPictures = CmFolderTags.DefaultPictureFolder;
							int hvoPic = obj.Cache.DomainDataByFlid.MakeNewObject(CmPictureTags.kClassId, obj.Hvo, flid, chvo);
							var picture = Cache.ServiceLocator.GetInstance<ICmPictureRepository>().GetObject(hvoPic);
							dlg.GetMultilingualCaptionValues(picture.Caption);
							picture.UpdatePicture(dlg.CurrentFile, null, strLocalPictures, 0);
						});
					}
				}
			}
			return true;
		}