public void Fill (SolutionFolder parentCombine, SolutionItem entry, ISolutionItemFeature[] features) { selectedFeatures.Clear (); selectedEditors.Clear (); this.entry = entry; this.parentCombine = parentCombine; foreach (Gtk.Widget w in box.Children) { box.Remove (w); w.Destroy (); } // Show enabled features at the beginning foreach (ISolutionItemFeature feature in features) if (feature.GetSupportLevel (parentCombine, entry) == FeatureSupportLevel.Enabled) { Gtk.Widget editor = AddFeature (feature); selectedFeatures.Add (feature); selectedEditors.Add (editor); } foreach (ISolutionItemFeature feature in features) if (feature.GetSupportLevel (parentCombine, entry) != FeatureSupportLevel.Enabled) AddFeature (feature); if (box.Children.Length == 0) { // No features Label lab = new Label (); lab.Xalign = 0; lab.Text = GettextCatalog.GetString ("There are no additional features available for this project."); box.PackStart (lab, false, false, 0); lab.Show (); } scrolled.AddWithViewport (box); }
public void ApplyFeatures() { for (int n = 0; n < selectedFeatures.Count; n++) { try { ISolutionItemFeature pf = selectedFeatures [n]; pf.ApplyFeature(parentCombine, entry, selectedEditors [n]); } catch (Exception ex) { LoggingService.LogInternalError(ex); } } }
public void ApplyFeatures() { for (int n = 0; n < selectedFeatures.Count; n++) { try { ISolutionItemFeature pf = selectedFeatures [n]; pf.ApplyFeature(parentCombine, entry, selectedEditors [n]); } catch (Exception ex) { MessageService.ShowException(ex); } } }
public bool Validate() { for (int n = 0; n < selectedFeatures.Count; n++) { ISolutionItemFeature pf = selectedFeatures [n]; string msg = pf.Validate(parentCombine, entry, selectedEditors [n]); if (!string.IsNullOrEmpty(msg)) { msg = pf.Title + ": " + msg; MessageService.ShowError((Gtk.Window) this.Toplevel, msg); return(false); } } return(true); }
void OnClickFeature(ISolutionItemFeature feature, CheckButton check, HBox fbox, Gtk.Widget editor) { if (editor != null) { fbox.Visible = check.Active; } if (check.Active) { selectedFeatures.Add(feature); selectedEditors.Add(editor); } else { selectedFeatures.Remove(feature); selectedEditors.Remove(editor); } }
Gtk.Widget AddFeature(ISolutionItemFeature feature) { Gtk.HBox cbox = new Gtk.HBox(); CheckButton check = null; Label fl = new Label(); fl.Wrap = true; fl.WidthRequest = 630; fl.Markup = "<b>" + feature.Title + "</b>\n<small>" + feature.Description + "</small>"; bool enabledByDefault = feature.GetSupportLevel(parentCombine, entry) == FeatureSupportLevel.Enabled; if (enabledByDefault) { Alignment al = new Alignment(0, 0, 0, 0); al.SetPadding(6, 6, 6, 6); al.Add(fl); cbox.PackStart(al, false, false, 0); } else { check = new CheckButton(); check.Image = fl; cbox.PackStart(check, false, false, 0); check.ModifyBg(StateType.Prelight, Style.MidColors [(int)StateType.Normal]); check.BorderWidth = 3; } EventBox eb = new EventBox(); if (!enabledByDefault) { eb.Realized += delegate { eb.GdkWindow.Cursor = handCursor; }; } eb.ModifyBg(StateType.Normal, Style.MidColors[(int)StateType.Normal]); eb.Add(cbox); eb.ShowAll(); box.PackStart(eb, false, false, 0); HBox fbox = new HBox(); Gtk.Widget editor = feature.CreateFeatureEditor(parentCombine, entry); if (editor != null) { Label sp = new Label(""); sp.WidthRequest = 24; sp.Show(); fbox.PackStart(sp, false, false, 0); editor.Show(); fbox.PackStart(editor, false, false, 0); box.PackStart(fbox, false, false, 0); } if (check != null) { ISolutionItemFeature f = feature; check.Toggled += delegate { OnClickFeature(f, check, fbox, editor); }; } else { fbox.Show(); } return(editor); }
Gtk.Widget AddFeature (ISolutionItemFeature feature) { Gtk.HBox cbox = new Gtk.HBox (); CheckButton check = null; Label fl = new Label (); fl.Wrap = true; fl.WidthRequest = 630; fl.Markup = "<b>" + feature.Title + "</b>\n<small>" + feature.Description + "</small>"; bool enabledByDefault = feature.GetSupportLevel (parentCombine, entry) == FeatureSupportLevel.Enabled; if (enabledByDefault) { Alignment al = new Alignment (0,0,0,0); al.SetPadding (6,6,6,6); al.Add (fl); cbox.PackStart (al, false, false, 0); } else { check = new CheckButton (); check.Image = fl; cbox.PackStart (check, false, false, 0); check.ModifyBg (StateType.Prelight, Style.MidColors [(int)StateType.Normal]); check.BorderWidth = 3; } EventBox eb = new EventBox (); if (!enabledByDefault) { eb.Realized += delegate { eb.GdkWindow.Cursor = handCursor; }; } eb.ModifyBg (StateType.Normal, Style.MidColors[(int)StateType.Normal]); eb.Add (cbox); eb.ShowAll (); box.PackStart (eb, false, false, 0); HBox fbox = new HBox (); Gtk.Widget editor = feature.CreateFeatureEditor (parentCombine, entry); if (editor != null) { Label sp = new Label (""); sp.WidthRequest = 24; sp.Show (); fbox.PackStart (sp, false, false, 0); editor.Show (); fbox.PackStart (editor, false, false, 0); box.PackStart (fbox, false, false, 0); } if (check != null) { ISolutionItemFeature f = feature; check.Toggled += delegate { OnClickFeature (f, check, fbox, editor); }; } else { fbox.Show (); } return editor; }
void OnClickFeature (ISolutionItemFeature feature, CheckButton check, HBox fbox, Gtk.Widget editor) { if (editor != null) fbox.Visible = check.Active; if (check.Active) { selectedFeatures.Add (feature); selectedEditors.Add (editor); } else { selectedFeatures.Remove (feature); selectedEditors.Remove (editor); } }