private void buttonAufAb_Click(object sender, EventArgs e) { if (SelectedMakroKey == null) { return; } int oldIndex = MakroKeyList.IndexOf(SelectedMakroKey); int newIndex; if (sender == buttonAuf) { newIndex = oldIndex - 1; } else if (sender == buttonAb) { newIndex = oldIndex + 1; } else { return; } int thisIndex = 0; MakroKeyItem[] newItemList = new MakroKeyItem[MakroKeyList.Count]; foreach (MakroKeyItem thisItem in MakroKeyList) { if (thisIndex == newIndex) { newItemList[oldIndex] = thisItem; } else if (thisIndex == oldIndex) { newItemList[newIndex] = thisItem; } else { newItemList[thisIndex] = thisItem; } thisIndex++; } MakroKeyList.Clear(); MakroKeyList.AddRange(newItemList); buttonAuf.Enabled = false; buttonAb.Enabled = false; if (MakroKeyList.Count > 1) { if (MakroKeyList.IndexOf(SelectedMakroKey) > 0) { buttonAuf.Enabled = true; } if (MakroKeyList.IndexOf(SelectedMakroKey) < MakroKeyList.Count - 1) { buttonAb.Enabled = true; } } buttonOK.Enabled = true; changesUnsaved = true; keyBox.Invalidate(); }
private void buttonLöschen_Click(object sender, EventArgs e) { if (SelectedMakroKey == null) { return; } MakroKeyList.Remove(SelectedMakroKey); SelectedMakroKey = null; txtKeyName.Focus(); buttonOK.Enabled = true; changesUnsaved = true; keyBox.Invalidate(); }
private void keyBox_MouseClick(object sender, MouseEventArgs e) { SelectedMakroKey = null; foreach (KeyValuePair <Rectangle, MakroKeyItem> thisItem in MakroKeyPosition) { if (thisItem.Key.Contains(e.Location)) { SelectedMakroKey = thisItem.Value; keyBox.Invalidate(); return; } } keyBox.Invalidate(); }
private void buttonHinzu_Click(object sender, EventArgs e) { foreach (MakroKeyItem thisItem in MakroKeyList) { if (thisItem.KeyName == txtKeyName.Text) { MessageBox.Show(mainForm.programmStrings.GetString("buttonHinzuExistsMsg"), mainForm.programmStrings.GetString("buttonHinzuExistsCaption"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } MakroKeyItem newItem = new MakroKeyItem(txtKeyName.Text, "", mainForm.programmStrings.GetString("makroTargetRepeated")); MakroKeyList.Add(newItem); SelectedMakroKey = newItem; keyBox.Invalidate(); }
private void keyBoxKeyUp(bool flip) { if (MakroKeyList.Count == 0) { return; } if (SelectedMakroKey == null) { if (flip) { SelectedMakroKey = MakroKeyList[0]; } else { SelectedMakroKey = MakroKeyList[MakroKeyList.Count - 1]; } } else { for (int i = 0; i < MakroKeyList.Count; i++) { if (SelectedMakroKey == MakroKeyList[i]) { if (flip && i > 0) { SelectedMakroKey = MakroKeyList[i - 1]; } else if (!flip && i < MakroKeyList.Count - 1) { SelectedMakroKey = MakroKeyList[i + 1]; } break; } } } keyBox.Invalidate(); }
public optionsForm(mainForm mainForm) { InitializeComponent(); bool languageMayBeSet = true; this.MakroKeyList = new List <MakroKeyItem>(); this.MakroKeyPosition = new Dictionary <Rectangle, MakroKeyItem>(); panelBasic.Location = new Point(129, 2); panelMakroKeys.Location = new Point(129, 2); panelBrowseDialogs.Location = new Point(129, 2); this.mainForm = mainForm; this.comboTargetTextBox.Items.AddRange(new object[] { mainForm.programmStrings.GetString("makroTargetDefine"), //"Wie in Makrodatei definiert", mainForm.programmStrings.GetString("makroTargetTable"), //"Tabelle", mainForm.programmStrings.GetString("makroTargetSimple"), //"Einfach (Header, Footer)", mainForm.programmStrings.GetString("makroTargetRepeated") }); //"Wiederholt (Body)"}); //foreach (KeyValuePair<string, string> thisPair in mainForm.programmStrings.Cultures) // this.cboLanguage.Items.Add(thisPair.Value); if (this.mainForm.programOptions.GetOptions("Language") != null) { cboLanguage.SelectedItem = this.mainForm.programOptions.GetOptions("Language").Value; } else { cboLanguage.SelectedItem = "Deutsch"; } if (this.mainForm.programOptions.GetOptions("VariableMarker") != null) { txtVariableMarker.Text = this.mainForm.programOptions.GetOptions("VariableMarker").Value; } else { txtVariableMarker.Text = "%"; } if (this.mainForm.programOptions.GetOptions("DokuPath") != null) { txtDokuPath.Text = this.mainForm.programOptions.GetOptions("DokuPath").Value; } else { txtDokuPath.Text = ""; } if (this.mainForm.programOptions.GetOptions("StartPathType") != null) { switch (this.mainForm.programOptions.GetOptions("StartPathType").Value) { case "GroupsLast": radGroupsLast.Checked = true; break; case "AlwaysSame": radAlwaysSame.Checked = true; break; default: radAnybodysLast.Checked = true; break; } } else { radAnybodysLast.Checked = true; } if (this.mainForm.programOptions.GetOptions("StartPath") != null) { txtStartPath.Text = this.mainForm.programOptions.GetOptions("StartPath").Value; } else { txtStartPath.Text = Application.StartupPath; } if (this.mainForm.programOptions.GetOptions("WriteStartPathOnEnd") != null) { switch (this.mainForm.programOptions.GetOptions("WriteStartPathOnEnd").Value) { case "True": chkSaveStartPath.CheckState = CheckState.Checked; break; case "Intermediate": chkSaveStartPath.CheckState = CheckState.Indeterminate; break; default: chkSaveStartPath.CheckState = CheckState.Unchecked; break; } } foreach (makroKeys thisKey in this.mainForm.programOptions.orderKeyList(this.mainForm.programOptions.makroList)) { MakroKeyItem newItem = new MakroKeyItem(thisKey.KeyName, thisKey.KeyTarget, ""); switch (thisKey.TargetTextBox.ToUpper()) { case "TABLE": newItem.TargetLocation = mainForm.programmStrings.GetString("makroTargetTable"); //"Tabelle"; break; case "SIMPLE": newItem.TargetLocation = mainForm.programmStrings.GetString("makroTargetSimple"); //"Einfach (Header, Footer)"; break; case "REPEATED": newItem.TargetLocation = mainForm.programmStrings.GetString("makroTargetRepeated"); //"Wiederholt (Body)"; break; default: newItem.TargetLocation = mainForm.programmStrings.GetString("makroTargetDefine"); //"Wie in Makrodatei definiert"; break; } MakroKeyList.Add(newItem); } if (this.mainForm.programOptions.GetOptions("Debugging") != null) { if (this.mainForm.programOptions.GetOptions("Debugging").Value == "On") { chkDebugging.Checked = true; } else { chkDebugging.Checked = false; } } else { chkDebugging.Checked = false; } changesUnsaved = false; languageSet = false; buttonOK.Enabled = false; if (languageMayBeSet) { cboLanguage.Enabled = true; } else { cboLanguage.Enabled = false; } }