Ejemplo n.º 1
0
        public void GoForward(DataGridViewCell aCell, string strNewValue, Font fontSource, Font fontTarget)
        {
            if (strNewValue == null)
            {
                return;
            }
            m_aCells.Add(aCell);
            m_astrNewValues.Add(strNewValue);

            string strOldValue = (string)aCell.Value;

            m_astrOldValues.Add(strOldValue);

            // first check for ambiguities
            int nIndex;

            if ((nIndex = strNewValue.IndexOf('%')) != -1)
            {
                PickAmbiguity aPicker = new PickAmbiguity(strNewValue, fontSource, fontTarget);
                if (aPicker.ShowDialog() == DialogResult.OK)
                {
                    strNewValue = aPicker.SelectedWord;
                }
            }

            if (strOldValue != null)
            {
                strNewValue = strOldValue + ' ' + strNewValue;
            }
            aCell.Value = strNewValue;
        }
Ejemplo n.º 2
0
		public void GoForward(DataGridViewCell aCell, string strNewValue, Font fontSource, Font fontTarget)
		{
			if (strNewValue == null)
				return;
			m_aCells.Add(aCell);
			m_astrNewValues.Add(strNewValue);

			string strOldValue = (string)aCell.Value;
			m_astrOldValues.Add(strOldValue);

			// first check for ambiguities
			int nIndex;
			if( (nIndex = strNewValue.IndexOf('%')) != -1 )
			{
				PickAmbiguity aPicker = new PickAmbiguity(strNewValue, fontSource, fontTarget);
				if (aPicker.ShowDialog() == DialogResult.OK)
					strNewValue = aPicker.SelectedWord;
			}

			if (strOldValue != null)
				strNewValue = strOldValue + ' ' + strNewValue;
			aCell.Value = strNewValue;
		}
Ejemplo n.º 3
0
        public void GoForward(DataGridViewCell aCell, string strNewValue, Font fontSource, Font fontTarget)
        {
            System.Diagnostics.Debug.WriteLine("UndoDetails.GoForward BEGIN");
            if (strNewValue == null)
            {
                return;
            }
            m_aCells.Add(aCell);
            m_astrNewValues.Add(strNewValue);

            string strOldValue = (string)aCell.Value;

            System.Diagnostics.Debug.WriteLine("Old value '" + strOldValue + "'");
            m_astrOldValues.Add(strOldValue);

            // first check for ambiguities
            int nIndex;

            if ((nIndex = strNewValue.IndexOf('%')) != -1)
            {
                PickAmbiguity aPicker = new PickAmbiguity(strNewValue, fontSource, fontTarget);
                if (aPicker.ShowDialog() == DialogResult.OK)
                {
                    strNewValue = aPicker.SelectedWord;
                }
            }

            System.Diagnostics.Debug.WriteLine("New value '" + strNewValue + "'");
            if (strOldValue != null)
            {
                strNewValue = strOldValue + ' ' + strNewValue;
            }
            System.Diagnostics.Debug.WriteLine("Setting value '" + strNewValue + "'");
            aCell.Value = strNewValue;
            System.Diagnostics.Debug.WriteLine("Cell value is '" + aCell.Value + "'");
            System.Diagnostics.Debug.WriteLine("UndoDetails.GoForward END");
        }
Ejemplo n.º 4
0
		private void dataGridViewChart_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
		{
			// prevent the false click that occurs when the user chooses a menu item
			if ((DateTime.Now - m_dtStarted) < m_timeMinStartup)
				return;

			if ((e.RowIndex < 0) || (e.RowIndex >= dataGridViewChart.Rows.Count)
				|| (e.ColumnIndex < 0) || (e.ColumnIndex >= dataGridViewChart.Columns.Count))
				return;

			if (this.lockChartToolStripMenuItem.Checked)
				return;

			m_bModified = true;
			if (e.ColumnIndex == 0)
			{
				// for the reference row, this just means switch to the next reference
				DataGridViewCell theRefCell = dataGridViewChart.Rows[e.RowIndex].Cells[0];
				string strExistingReference = (string)theRefCell.Value;
				if ((strExistingReference == null) || (e.Button == MouseButtons.Right))
				{
					if ((e.Button == MouseButtons.Right) && (e.RowIndex > 0))
						strExistingReference = (string)dataGridViewChart.Rows[e.RowIndex - 1].Cells[0].Value;
					if ((strExistingReference == " ") && (e.RowIndex > 1))
						strExistingReference = (string)dataGridViewChart.Rows[e.RowIndex - 2].Cells[0].Value;

					theRefCell.Value = NextRef(strExistingReference);
				}
				else if( strExistingReference != " ")
					theRefCell.Value = CycleReference(strExistingReference);
			}
			else
			{
				string strWord = null;
				if (e.Button == MouseButtons.Left)
				{
					if (e.RowIndex > m_nCurrRow)
					{
						// add a new extra one.
						m_nCurrRow = e.RowIndex;
						int nIndex = this.dataGridViewChart.Rows.Add();
						DataGridViewRow theRow = dataGridViewChart.Rows[nIndex];
						theRow.Height = m_fontVernacular.Height + CnExtraHeight;
						theRow.Tag = new GlossTranslations();
						foreach (DataGridViewCell aCell in theRow.Cells)
						{
							aCell.Value = null;
							aCell.Selected = false;
						}
					}

					// get the word from the text box
					strWord = richTextBoxText.GetCurrentWord();
					DataGridViewCell aCurrCell = dataGridViewChart.Rows[e.RowIndex].Cells[e.ColumnIndex];
					m_undoDetails.GoForward(aCurrCell, strWord, m_fontVernacular, m_fontGloss);

					// help out with the reference number
					DataGridViewCell theRefCell = dataGridViewChart.Rows[e.RowIndex].Cells[0];
					string strValue = (string)theRefCell.Value;
					if ((strValue == null) || (strValue.Length == 0))
					{
						if (e.RowIndex > 0)
							strValue = (string)dataGridViewChart.Rows[e.RowIndex - 1].Cells[0].Value;

						if ((strValue == " ") && (e.RowIndex > 1))
							strValue = (string)dataGridViewChart.Rows[e.RowIndex - 2].Cells[0].Value;

						theRefCell.Value = NextRef(strValue);
					}
				}
				else
				{
					// dataGridViewChart.EndEdit();    // just in case
					m_undoDetails.Undo(out strWord);
					if (strWord != null)
						richTextBoxText.SetCurrentWord(strWord);
					else
					{
						DataGridViewCell theCell = dataGridViewChart.Rows[e.RowIndex].Cells[e.ColumnIndex];
						if (theCell.Value != null)
						{
							PickAmbiguity dlg = new PickAmbiguity(theCell.Value,
								(e.Button == MouseButtons.Left) ? null : GetMeaningLookupConverter,
								m_fontVernacular, m_fontGloss);
							if (dlg.ShowDialog() == DialogResult.OK)
							{

							}
						}
					}
				}
			}
		}
Ejemplo n.º 5
0
		private void dataGridViewGloss_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
		{
			// prevent the false click that occurs when the user chooses a menu item
			if ((DateTime.Now - m_dtStarted) < m_timeMinStartup)
				return;

			if ((e.RowIndex < 0) || (e.RowIndex >= dataGridViewGloss.Rows.Count)
				|| (e.ColumnIndex < 1) || (e.ColumnIndex >= dataGridViewGloss.Columns.Count))
				return;

			DataGridViewRow theRow = dataGridViewGloss.Rows[e.RowIndex];
			DataGridViewCell theCell = theRow.Cells[e.ColumnIndex];

			if (String.IsNullOrEmpty((string)theCell.Value))
				return;

			// if we're showing only transliterations...
			Debug.Assert(theRow.Tag != null);
			DataGridViewRow theOrigChartRow = (DataGridViewRow)theRow.Tag;
			Debug.Assert(theOrigChartRow.Tag != null);
			GlossTranslations gts = (GlossTranslations)theOrigChartRow.Tag;

			DirectableEncConverter theEC;
			GlossTranslationInfo gi;
			if (showTransToolStripMenuItem.Checked && !showToolStripMenuItem.Checked)
			{
				gi = gts.TransInfo;
				theEC = GetTransliterator;
			}
			else if (!showTransToolStripMenuItem.Checked && showToolStripMenuItem.Checked)
			{
				// or if we showing only glosses...
				gi = gts.GlossInfo;
				theEC = GetMeaningLookupConverter;
			}
			else if (showTransToolStripMenuItem.Checked && showToolStripMenuItem.Checked)
			{
				// or we're showing both...
				if ((e.RowIndex % 2) == 0)
				{
					gi = gts.TransInfo;
					theEC = GetTransliterator;
				}
				else
				{
					gi = gts.GlossInfo;
					theEC = GetMeaningLookupConverter;
				}
			}
			else
			{
				Debug.Assert(false);
				return; // ignore
			}

			if (gi == null)
			{
				Debug.Assert(false);
				gi = new GlossTranslationInfo();
			}

			PickAmbiguity dlg = new PickAmbiguity(theCell.Value,
				(e.Button == MouseButtons.Left) ? null : theEC,
				m_fontVernacular, m_fontGloss);
			dlg.Location = e.Location;
			if (dlg.ShowDialog() == DialogResult.OK)
			{
				theCell.Value = dlg.DisambiguatedPhrase;
				switch (e.ColumnIndex)
				{
					case 1:
						gi.PreS = (string)theCell.Value;
						break;
					case 2:
						gi.Subject = (string)theCell.Value;
						break;
					case 3:
						gi.X1 = (string)theCell.Value;
						break;
					case 4:
						gi.X2 = (string)theCell.Value;
						break;
					case 5:
						gi.Verb = (string)theCell.Value;
						break;
					case 6:
						gi.PostS = (string)theCell.Value;
						break;
				}
				/*
				object[] aoGlossValues = (object[]);
				aoGlossValues[e.ColumnIndex] = theCell.Value;
				 */
			}
		}