/// <summary> /// Set all controls to appropriate states for the current list selections. /// </summary> void EnableControls() { addButton.Enabled = optionsList.SelectedIndex >= 0; // We could use OkToRemove here, but we'd rather be able to display the message // if there is some reason not to. int listIndex = CurrentListIndex; removeButton.Enabled = listIndex >= 0; //Enhance: && m_choices.OkToRemove(listIndex); moveDownButton.Enabled = listIndex >= 0 && m_choices.OkToMoveDown(listIndex); moveUpButton.Enabled = listIndex >= 0 && m_choices.OkToMoveUp(listIndex); UpdateWsComboValue(); wsCombo.Enabled = listIndex >= 0 && m_choices.OkToChangeWritingSystem(listIndex); }
public void MoveDown() { InterlinLineChoices choices = new InterlinLineChoices(m_lp, kwsVernInPara, kwsAnalysis); // To make it less confusing, here we add them in an order that does not produce // reordering. MakeStandardState(choices); // lit trans can move up Assert.IsTrue(choices.OkToMoveDown(0)); // most moves are OK in non-edit mode Assert.IsTrue(choices.OkToMoveDown(1)); Assert.IsTrue(choices.OkToMoveDown(2)); Assert.IsTrue(choices.OkToMoveDown(3)); Assert.IsTrue(choices.OkToMoveDown(4)); // whole morph bundle will move down Assert.IsTrue(choices.OkToMoveDown(5)); Assert.IsFalse(choices.OkToMoveDown(6)); // Would put FF out of order Assert.IsTrue(choices.OkToMoveDown(7)); Assert.IsFalse(choices.OkToMoveDown(8)); choices.MoveDown(0); // morphemes is now top Assert.AreEqual(InterlinLineChoices.kflidMorphemes, choices[0].Flid); // Word moved down to position 4 Assert.AreEqual(InterlinLineChoices.kflidWord, choices[4].Flid); // Lex Gloss (to pick just one) also moved up Assert.AreEqual(InterlinLineChoices.kflidLexGloss, choices[2].Flid); choices = new InterlinLineChoices(m_lp, kwsVernInPara, kwsAnalysis); MakeStandardState(choices); choices.MoveDown(1); // nothing complicated, two items changed place. Assert.AreEqual(InterlinLineChoices.kflidLexEntries, choices[1].Flid); Assert.AreEqual(InterlinLineChoices.kflidMorphemes, choices[2].Flid); choices = new InterlinLineChoices(m_lp, kwsVernInPara, kwsAnalysis); MakeStandardState(choices); choices.MoveDown(4); // Moves past whole morpheme bundle Assert.AreEqual(InterlinLineChoices.kflidWordGloss, choices[1].Flid); Assert.AreEqual(InterlinLineChoices.kflidMorphemes, choices[2].Flid); Assert.AreEqual(InterlinLineChoices.kflidLexEntries, choices[3].Flid); choices = new InterlinLineChoices(m_lp, kwsVernInPara, kwsAnalysis); MakeStandardState(choices); choices.MoveDown(5); // nothing complicated, two items changed place. Assert.AreEqual(InterlinLineChoices.kflidWordPos, choices[5].Flid); Assert.AreEqual(InterlinLineChoices.kflidWordGloss, choices[6].Flid); choices = new InterlinLineChoices(m_lp, kwsVernInPara, kwsAnalysis); MakeStandardState(choices); choices.MoveDown(7); // nothing complicated, two items changed place. Assert.AreEqual(InterlinLineChoices.kflidLitTrans, choices[7].Flid); Assert.AreEqual(InterlinLineChoices.kflidFreeTrans, choices[8].Flid); }
public void MoveDown() { InterlinLineChoices choices = new InterlinLineChoices(0, kwsAnalysis); // To make it less confusing, here we add them in an order that does not produce // reordering. MakeStandardState(choices); // lit trans can move up Assert.IsTrue(choices.OkToMoveDown(0)); // most moves are OK in non-edit mode Assert.IsTrue(choices.OkToMoveDown(1)); Assert.IsTrue(choices.OkToMoveDown(2)); Assert.IsTrue(choices.OkToMoveDown(3)); Assert.IsTrue(choices.OkToMoveDown(4)); // whole morph bundle will move down Assert.IsTrue(choices.OkToMoveDown(5)); Assert.IsFalse(choices.OkToMoveDown(6)); // Would put FF out of order Assert.IsTrue(choices.OkToMoveDown(7)); Assert.IsFalse(choices.OkToMoveDown(8)); choices.MoveDown(0); // morphemes is now top Assert.AreEqual(InterlinLineChoices.kflidMorphemes, choices[0].Flid); // Word moved down to position 4 Assert.AreEqual(InterlinLineChoices.kflidWord, choices[4].Flid); // Lex Gloss (to pick just one) also moved up Assert.AreEqual(InterlinLineChoices.kflidLexGloss, choices[2].Flid); choices = new InterlinLineChoices(0, kwsAnalysis); MakeStandardState(choices); choices.MoveDown(1); // nothing complicated, two items changed place. Assert.AreEqual(InterlinLineChoices.kflidLexEntries, choices[1].Flid); Assert.AreEqual(InterlinLineChoices.kflidMorphemes, choices[2].Flid); choices = new InterlinLineChoices(0, kwsAnalysis); MakeStandardState(choices); choices.MoveDown(4); // Moves past whole morpheme bundle Assert.AreEqual(InterlinLineChoices.kflidWordGloss, choices[1].Flid); Assert.AreEqual(InterlinLineChoices.kflidMorphemes, choices[2].Flid); Assert.AreEqual(InterlinLineChoices.kflidLexEntries, choices[3].Flid); choices = new InterlinLineChoices(0, kwsAnalysis); MakeStandardState(choices); choices.MoveDown(5); // nothing complicated, two items changed place. Assert.AreEqual(InterlinLineChoices.kflidWordPos, choices[5].Flid); Assert.AreEqual(InterlinLineChoices.kflidWordGloss, choices[6].Flid); choices = new InterlinLineChoices(0, kwsAnalysis); MakeStandardState(choices); choices.MoveDown(7); // nothing complicated, two items changed place. Assert.AreEqual(InterlinLineChoices.kflidLitTrans, choices[7].Flid); Assert.AreEqual(InterlinLineChoices.kflidFreeTrans, choices[8].Flid); }