protected override void OnDestroyed() { if (bindingRenderer != null) { bindingRenderer.KeyBindingSelected -= BindingRenderer_KeyBindingSelected; bindingRenderer = null; } base.OnDestroyed(); }
public KeyBindingsPanel() { this.Build(); keyStore = new TreeStore(typeof(Command), typeof(string), typeof(string), typeof(string), typeof(int), typeof(string), typeof(bool), typeof(bool)); keyTreeView.Model = filterModel = new TreeModelFilter(keyStore, null); filterModel.VisibleColumn = visibleCol; TreeViewColumn col = new TreeViewColumn(); col.Title = GettextCatalog.GetString("Command"); col.Spacing = 4; CellRendererImage crp = new CellRendererImage(); col.PackStart(crp, false); col.AddAttribute(crp, "stock-id", iconCol); col.AddAttribute(crp, "visible", iconVisibleCol); CellRendererText crt = new CellRendererText(); col.PackStart(crt, true); col.AddAttribute(crt, "text", labelCol); col.AddAttribute(crt, "weight", boldCol); keyTreeView.AppendColumn(col); bindingTVCol = new TreeViewColumn(); bindingTVCol.Title = GettextCatalog.GetString("Key Binding"); bindingRenderer = new CellRendererKeyButtons(this); bindingRenderer.KeyBindingSelected += BindingRenderer_KeyBindingSelected; bindingTVCol.PackStart(bindingRenderer, false); bindingTVCol.AddAttribute(bindingRenderer, "text", bindingCol); bindingTVCol.AddAttribute(bindingRenderer, "command", commandCol); keyTreeView.AppendColumn(bindingTVCol); keyTreeView.AppendColumn(GettextCatalog.GetString("Description"), new CellRendererText(), "text", descCol); keyTreeView.Selection.Changed += OnKeysTreeViewSelectionChange; accelEntry.KeyPressEvent += OnAccelEntryKeyPress; accelEntry.KeyReleaseEvent += OnAccelEntryKeyRelease; accelEntry.Changed += delegate { UpdateWarningLabel(); }; updateButton.Clicked += OnUpdateButtonClick; addButton.Clicked += OnAddRemoveButtonClick; currentBindings = KeyBindingService.CurrentKeyBindingSet.Clone(); schemes = new List <KeyBindingScheme> (KeyBindingService.Schemes); foreach (KeyBindingScheme s in schemes) { schemeCombo.AppendText(s.Name); } if (schemes.Count > 0) { schemeCombo.RowSeparatorFunc = (TreeModel model, TreeIter iter) => { if (model.GetValue(iter, 0) as string == "---") { return(true); } return(false); }; schemeCombo.AppendText("---"); } schemeCombo.AppendText(GettextCatalog.GetString("Custom")); SelectCurrentScheme(); schemeCombo.Changed += OnKeyBindingSchemeChanged; searchEntry.Ready = true; searchEntry.Visible = true; searchEntry.Changed += delegate { processedFilterTerms = searchEntry.Entry.Text.ToLower().Split(new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); filterChanged = true; if (!filterTimeoutRunning) { filterTimeoutRunning = true; GLib.Timeout.Add(50, delegate { if (!filterChanged) { if (filterTimeoutRunning) { Refilter(); } filterTimeoutRunning = false; return(false); } filterChanged = false; return(true); }); } ; }; keyTreeView.SearchColumn = -1; // disable the interactive search //HACK: workaround for MD Bug 608021: Stetic loses values assigned to "new" properties of custom widget conflicButton.Label = GettextCatalog.GetString("_View Conflicts"); conflicButton.UseUnderline = true; SetupAccessibility(); }
public KeyBindingsPanel () { this.Build (); keyStore = new TreeStore (typeof (Command), typeof (string), typeof (string), typeof (string), typeof (int), typeof(string), typeof(bool), typeof (bool)); keyTreeView.Model = filterModel = new TreeModelFilter (keyStore, null); filterModel.VisibleColumn = visibleCol; TreeViewColumn col = new TreeViewColumn (); col.Title = GettextCatalog.GetString ("Command"); col.Spacing = 4; CellRendererImage crp = new CellRendererImage (); col.PackStart (crp, false); col.AddAttribute (crp, "stock-id", iconCol); col.AddAttribute (crp, "visible", iconVisibleCol); CellRendererText crt = new CellRendererText (); col.PackStart (crt, true); col.AddAttribute (crt, "text", labelCol); col.AddAttribute (crt, "weight", boldCol); keyTreeView.AppendColumn (col); bindingTVCol = new TreeViewColumn (); bindingTVCol.Title = GettextCatalog.GetString ("Key Binding"); CellRendererKeyButtons bindingRenderer = new CellRendererKeyButtons (this); bindingRenderer.KeyBindingSelected += BindingRenderer_KeyBindingSelected; bindingTVCol.PackStart (bindingRenderer, false); bindingTVCol.AddAttribute (bindingRenderer, "text", bindingCol); bindingTVCol.AddAttribute (bindingRenderer, "command", commandCol); keyTreeView.AppendColumn (bindingTVCol); keyTreeView.AppendColumn (GettextCatalog.GetString ("Description"), new CellRendererText (), "text", descCol); keyTreeView.Selection.Changed += OnKeysTreeViewSelectionChange; accelEntry.KeyPressEvent += OnAccelEntryKeyPress; accelEntry.KeyReleaseEvent += OnAccelEntryKeyRelease; accelEntry.Changed += delegate { UpdateWarningLabel (); }; updateButton.Clicked += OnUpdateButtonClick; addButton.Clicked += OnAddRemoveButtonClick; currentBindings = KeyBindingService.CurrentKeyBindingSet.Clone (); schemes = new List<KeyBindingScheme> (KeyBindingService.Schemes); foreach (KeyBindingScheme s in schemes) schemeCombo.AppendText (s.Name); if (schemes.Count > 0) { schemeCombo.RowSeparatorFunc = (TreeModel model, TreeIter iter) => { if (model.GetValue (iter, 0) as string == "---") return true; return false; }; schemeCombo.AppendText ("---"); } schemeCombo.AppendText (GettextCatalog.GetString ("Custom")); SelectCurrentScheme (); schemeCombo.Changed += OnKeyBindingSchemeChanged; searchEntry.Ready = true; searchEntry.Visible = true; searchEntry.Changed += delegate { processedFilterTerms = searchEntry.Entry.Text.Split (new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) .Select (s => s.ToLower ()).ToArray ();; filterChanged = true; if (!filterTimeoutRunning) { filterTimeoutRunning = true; GLib.Timeout.Add (50, delegate { if (!filterChanged) { if (filterTimeoutRunning) Refilter (); filterTimeoutRunning = false; return false; } filterChanged = false; return true; }); }; }; keyTreeView.SearchColumn = -1; // disable the interactive search //HACK: workaround for MD Bug 608021: Stetic loses values assigned to "new" properties of custom widget conflicButton.Label = GettextCatalog.GetString ("_View Conflicts"); conflicButton.UseUnderline = true; }