コード例 #1
0
ファイル: Cheats.cs プロジェクト: TechnoTaff/BizHawk
        private void MoveUpMenuItem_Click(object sender, EventArgs e)
        {
            var indices = SelectedIndices.ToList();

            if (indices.Count == 0 || indices[0] == 0)
            {
                return;
            }

            foreach (var index in indices)
            {
                var cheat = Global.CheatList[index];
                Global.CheatList.Remove(cheat);
                Global.CheatList.Insert(index - 1, cheat);
            }

            var newindices = indices.Select(t => t - 1).ToList();

            CheatListView.SelectedIndices.Clear();
            foreach (var newi in newindices)
            {
                CheatListView.SelectItem(newi, true);
            }

            UpdateMessageLabel();
            UpdateDialog();
        }
コード例 #2
0
ファイル: RamWatch.cs プロジェクト: lenalia/BizHawk
        private void MoveDownMenuItem_Click(object sender, EventArgs e)
        {
            var indices = SelectedIndices.ToList();

            if (indices.Count == 0 || indices.Last() == _watches.Count - 1)
            {
                return;
            }

            for (var i = indices.Count - 1; i >= 0; i--)
            {
                var watch = _watches[indices[i]];
                _watches.RemoveAt(indices[i]);
                _watches.Insert(indices[i] + 1, watch);
            }

            var newindices = indices.Select(t => t + 1).ToList();

            WatchListView.SelectedIndices.Clear();
            foreach (var t in newindices)
            {
                WatchListView.SelectItem(t, true);
            }

            Changes();
            WatchListView.ItemCount = _watches.Count;
        }
コード例 #3
0
ファイル: RamWatch.cs プロジェクト: mrjnumber1/BizHawk
        private void MoveBottomMenuItem_Click(object sender, EventArgs e)
        {
            var indices = SelectedIndices.ToList();

            if (indices.Count == 0)
            {
                return;
            }

            for (var i = 0; i < indices.Count; i++)
            {
                var watch = _watches[indices[i] - i];
                _watches.RemoveAt(indices[i] - i);
                _watches.Insert(_watches.Count, watch);
            }

            var newInd = new List <int>();

            for (int i = 0, x = _watches.Count - indices.Count; i < indices.Count; i++, x++)
            {
                newInd.Add(x);
            }

            WatchListView.SelectedIndices.Clear();
            foreach (var t in newInd)
            {
                WatchListView.SelectItem(t, true);
            }

            Changes();
            WatchListView.ItemCount = _watches.Count;
        }
コード例 #4
0
ファイル: Cheats.cs プロジェクト: konkers/BizHawk
        private void MoveUpMenuItem_Click(object sender, EventArgs e)
        {
            var indices = SelectedIndices.ToList();

            if (indices.Count == 0 || indices[0] == 0)
            {
                return;
            }

            foreach (var index in indices)
            {
                var cheat = MainForm.CheatList[index];
                MainForm.CheatList.Remove(cheat);
                MainForm.CheatList.Insert(index - 1, cheat);
            }

            var newIndices = indices.Select(t => t - 1);

            CheatListView.DeselectAll();
            foreach (var index in newIndices)
            {
                CheatListView.SelectRow(index, true);
            }

            UpdateMessageLabel();
            GeneralUpdate();
        }
コード例 #5
0
ファイル: Cheats.cs プロジェクト: konkers/BizHawk
        private void MoveDownMenuItem_Click(object sender, EventArgs e)
        {
            var indices = SelectedIndices.ToList();

            if (indices.Count == 0 || indices.Last() == MainForm.CheatList.Count - 1)
            {
                return;
            }

            for (var i = indices.Count - 1; i >= 0; i--)
            {
                var cheat = MainForm.CheatList[indices[i]];
                MainForm.CheatList.Remove(cheat);
                MainForm.CheatList.Insert(indices[i] + 1, cheat);
            }

            UpdateMessageLabel();

            var newIndices = indices.Select(t => t + 1);

            CheatListView.DeselectAll();
            foreach (var index in newIndices)
            {
                CheatListView.SelectRow(index, true);
            }

            GeneralUpdate();
        }
コード例 #6
0
ファイル: RamWatch.cs プロジェクト: lenalia/BizHawk
        private void MoveUpMenuItem_Click(object sender, EventArgs e)
        {
            var indexes = SelectedIndices.ToList();

            if (!indexes.Any() || indexes[0] == 0)
            {
                return;
            }

            foreach (var index in indexes)
            {
                var watch = _watches[index];
                _watches.RemoveAt(index);
                _watches.Insert(index - 1, watch);
            }

            Changes();

            var indices = indexes.Select(t => t - 1).ToList();

            WatchListView.SelectedIndices.Clear();
            foreach (var t in indices)
            {
                WatchListView.SelectItem(t, true);
            }

            WatchListView.ItemCount = _watches.Count;
        }
コード例 #7
0
ファイル: RamWatch.cs プロジェクト: stuff2600/RAEmus
        private void EditWatch(bool duplicate = false)
        {
            var indexes = SelectedIndices.ToList();

            if (SelectedWatches.Any())
            {
                var we = new WatchEditor
                {
                    InitialLocation = this.ChildPointToScreen(WatchListView)
                };

                we.SetWatch(_watches.Domain, SelectedWatches, duplicate ? WatchEditor.Mode.Duplicate : WatchEditor.Mode.Edit);

                var result = we.ShowHawkDialog();
                if (result == DialogResult.OK)
                {
                    Changes();
                    if (duplicate)
                    {
                        _watches.AddRange(we.Watches);
                        WatchListView.ItemCount = _watches.ItemCount;
                    }
                    else
                    {
                        for (var i = 0; i < we.Watches.Count; i++)
                        {
                            _watches[indexes[i]] = we.Watches[i];
                        }
                    }
                }

                UpdateValues();
            }
        }
コード例 #8
0
ファイル: RamWatch.cs プロジェクト: mrjnumber1/BizHawk
        private void MoveTopMenuItem_Click(object sender, EventArgs e)
        {
            var indexes = SelectedIndices.ToList();

            if (!indexes.Any())
            {
                return;
            }

            for (int i = 0; i < indexes.Count; i++)
            {
                var watch = _watches[indexes[i]];
                _watches.RemoveAt(indexes[i]);
                _watches.Insert(i, watch);
                indexes[i] = i;
            }

            Changes();

            WatchListView.SelectedIndices.Clear();
            foreach (var t in indexes)
            {
                WatchListView.SelectItem(t, true);
            }

            WatchListView.ItemCount = _watches.Count;
        }
コード例 #9
0
ファイル: Cheats.cs プロジェクト: TechnoTaff/BizHawk
        private void MoveDownMenuItem_Click(object sender, EventArgs e)
        {
            var indices = SelectedIndices.ToList();

            if (indices.Count == 0 || indices.Last() == Global.CheatList.Count - 1)
            {
                return;
            }

            for (var i = indices.Count - 1; i >= 0; i--)
            {
                var cheat = Global.CheatList[indices[i]];
                Global.CheatList.Remove(cheat);
                Global.CheatList.Insert(indices[i] + 1, cheat);
            }

            UpdateMessageLabel();

            var newindices = indices.Select(t => t + 1).ToList();

            CheatListView.SelectedIndices.Clear();
            foreach (var newi in newindices)
            {
                CheatListView.SelectItem(newi, true);
            }

            UpdateDialog();
        }
コード例 #10
0
        private void EditWatch(bool duplicate = false)
        {
            var indexes = SelectedIndices.ToList();

            if (SelectedWatches.Any())
            {
                var we = new WatchEditor
                {
                    InitialLocation = this.ChildPointToScreen(WatchListView),
                    MemoryDomains   = MemoryDomains
                };

                we.SetWatch(SelectedWatches.First().Domain, SelectedWatches, duplicate ? WatchEditor.Mode.Duplicate : WatchEditor.Mode.Edit);

                if (this.ShowDialogWithTempMute(we) == DialogResult.OK)
                {
                    if (duplicate)
                    {
                        _watches.AddRange(we.Watches);
                        WatchListView.RowCount = _watches.Count;
                        UpdateWatchCount();
                    }
                    else
                    {
                        for (var i = 0; i < we.Watches.Count; i++)
                        {
                            _watches[indexes[i]] = we.Watches[i];
                        }
                    }
                    Changes();
                }

                GeneralUpdate();
            }
            else if (SelectedSeparators.Any() && !duplicate)
            {
                var inputPrompt = new InputPrompt
                {
                    Text          = "Edit Separator",
                    StartLocation = this.ChildPointToScreen(WatchListView),
                    Message       = "Separator Text:",
                    TextInputType = InputPrompt.InputType.Text
                };

                if (this.ShowDialogWithTempMute(inputPrompt) == DialogResult.OK)
                {
                    Changes();

                    for (int i = 0; i < SelectedSeparators.Count(); i++)
                    {
                        var sep = SelectedSeparators.ToList()[i];
                        sep.Notes            = inputPrompt.PromptText;
                        _watches[indexes[i]] = sep;
                    }
                }

                GeneralUpdate();
            }
        }
コード例 #11
0
ファイル: FDesktop.cs プロジェクト: allanmukhwana/naps2
 private void customRotationToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (SelectedIndices.Any())
     {
         var form = FormFactory.Create <FRotate>();
         form.Image = SelectedImages.First();
         form.ShowDialog();
         UpdateThumbnails(SelectedIndices.ToList());
     }
 }
コード例 #12
0
ファイル: FDesktop.cs プロジェクト: allanmukhwana/naps2
 private void tsContrast_Click(object sender, EventArgs e)
 {
     if (SelectedIndices.Any())
     {
         var form = FormFactory.Create <FContrast>();
         form.Image = SelectedImages.First();
         form.ShowDialog();
         UpdateThumbnails(SelectedIndices.ToList());
     }
 }
コード例 #13
0
 private void PreviewImage()
 {
     if (SelectedIndices.Any())
     {
         var viewer = FormFactory.Create <FViewer>();
         viewer.ImageList  = imageList;
         viewer.ImageIndex = SelectedIndices.First();
         viewer.ShowDialog();
         UpdateThumbnails(SelectedIndices.ToList());
     }
 }
コード例 #14
0
		private void RemoveAddresses()
		{
			var indices = SelectedIndices.ToList();
			if (indices.Any())
			{
				SetRemovedMessage(indices.Count);
				_searches.RemoveRange(indices);

				WatchListView.DeselectAll();
				UpdateList();
				ToggleSearchDependentToolBarItems();
			}
		}
コード例 #15
0
        public void Deselect(int index = -1)
        {
            if (index == -1)
            {
                SelectedIndices = new int[] { };
                return;
            }

            var l = SelectedIndices.ToList();

            l.Remove(index);
            SelectedIndices = l.ToArray();
        }
コード例 #16
0
ファイル: RamWatch.cs プロジェクト: lenalia/BizHawk
        private void InsertSeparatorMenuItem_Click(object sender, EventArgs e)
        {
            var indexes = SelectedIndices.ToList();

            if (indexes.Any())
            {
                _watches.Insert(indexes[0], SeparatorWatch.Instance);
            }
            else
            {
                _watches.Add(SeparatorWatch.Instance);
            }

            WatchListView.ItemCount = _watches.Count;
            Changes();
            UpdateWatchCount();
        }
コード例 #17
0
ファイル: RamWatch.cs プロジェクト: lenalia/BizHawk
        private void EditWatch(bool duplicate = false)
        {
            var indexes = SelectedIndices.ToList();

            if (SelectedWatches.Any())
            {
                foreach (var sw in SelectedWatches)
                {
                    if (sw.Domain != SelectedWatches.First().Domain)
                    {
                        throw new InvalidOperationException("Can't edit multiple watches on varying memorydomains");
                    }
                }

                var we = new WatchEditor
                {
                    InitialLocation = this.ChildPointToScreen(WatchListView),
                    MemoryDomains   = _memoryDomains
                };

                we.SetWatch(SelectedWatches.First().Domain, SelectedWatches, duplicate ? WatchEditor.Mode.Duplicate : WatchEditor.Mode.Edit);

                var result = we.ShowHawkDialog(this);
                if (result == DialogResult.OK)
                {
                    Changes();
                    if (duplicate)
                    {
                        _watches.AddRange(we.Watches);
                        WatchListView.ItemCount = _watches.Count;
                    }
                    else
                    {
                        for (var i = 0; i < we.Watches.Count; i++)
                        {
                            _watches[indexes[i]] = we.Watches[i];
                        }
                    }
                }

                UpdateValues();
            }
        }
コード例 #18
0
        public void Select(int index, bool add = false)
        {
            if (add)
            {
                if (!SelectedIndices.Contains(index))
                {
                    var l = SelectedIndices.ToList();
                    l.Add(index);
                    SelectedIndices = l.ToArray();
                }
                return;
            }

            if (index == -1)
            {
                Deselect();
            }

            SelectedIndices = new[] { index };
        }
コード例 #19
0
ファイル: RamWatch.cs プロジェクト: stuff2600/RAEmus
        private void CopyWatchesToClipBoard()
        {
            var indexes = SelectedIndices.ToList();

            if (indexes.Any())
            {
                var sb = new StringBuilder();
                foreach (var index in indexes)
                {
                    foreach (ColumnHeader column in WatchListView.Columns)
                    {
                        sb.Append(GetColumnValue(column.Name, index)).Append('\t');
                    }

                    sb.Remove(sb.Length - 1, 1);
                    sb.AppendLine();
                }

                if (sb.Length > 0)
                {
                    Clipboard.SetDataObject(sb.ToString());
                }
            }
        }
コード例 #20
0
ファイル: RamWatch.cs プロジェクト: mrjnumber1/BizHawk
        private void EditWatch(bool duplicate = false)
        {
            var indexes = SelectedIndices.ToList();

            if (SelectedWatches.Any())
            {
                foreach (var sw in SelectedWatches)
                {
                    if (sw.Domain != SelectedWatches.First().Domain)
                    {
                        throw new InvalidOperationException("Can't edit multiple watches on varying memory domains");
                    }
                }

                var we = new WatchEditor
                {
                    InitialLocation = this.ChildPointToScreen(WatchListView),
                    MemoryDomains   = MemoryDomains
                };

                we.SetWatch(SelectedWatches.First().Domain, SelectedWatches, duplicate ? WatchEditor.Mode.Duplicate : WatchEditor.Mode.Edit);

                var result = we.ShowHawkDialog(this);
                if (result == DialogResult.OK)
                {
                    Changes();
                    if (duplicate)
                    {
                        _watches.AddRange(we.Watches);
                        WatchListView.ItemCount = _watches.Count;
                        UpdateWatchCount();
                    }
                    else
                    {
                        for (var i = 0; i < we.Watches.Count; i++)
                        {
                            _watches[indexes[i]] = we.Watches[i];
                        }
                    }
                }

                UpdateValues();
            }
            else if (SelectedSeparators.Any() && !duplicate)
            {
                var inputPrompt = new InputPrompt
                {
                    Text          = "Edit Separator",
                    StartLocation = this.ChildPointToScreen(WatchListView),
                    Message       = "Separator Text:",
                    TextInputType = InputPrompt.InputType.Text
                };

                var result = inputPrompt.ShowHawkDialog();

                if (result == DialogResult.OK)
                {
                    Changes();

                    for (int i = 0; i < SelectedSeparators.Count(); i++)
                    {
                        var sep = SelectedSeparators.ToList()[i];
                        sep.Notes            = inputPrompt.PromptText;
                        _watches[indexes[i]] = sep;
                    }
                }

                UpdateValues();
            }
        }