private void AttachWidgets (TextView textView) { // This is really different from the C version, but the // C versions seems a little pointless. Button button = new Button ("Click Me"); button.Clicked += new EventHandler(EasterEggCB); textView.AddChildAtAnchor (button, buttonAnchor); button.ShowAll (); ComboBox combo = ComboBox.NewText (); combo.AppendText ("Option 1"); combo.AppendText ("Option 2"); combo.AppendText ("Option 3"); textView.AddChildAtAnchor (combo, menuAnchor); HScale scale = new HScale (null); scale.SetRange (0,100); scale.SetSizeRequest (70, -1); textView.AddChildAtAnchor (scale, scaleAnchor); scale.ShowAll (); Gtk.Image image = Gtk.Image.LoadFromResource ("floppybuddy.gif"); textView.AddChildAtAnchor (image, animationAnchor); image.ShowAll (); Entry entry = new Entry (); textView.AddChildAtAnchor (entry, entryAnchor); entry.ShowAll (); }
/// <summary> /// On frame actuator scale change event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> protected void OnFrameActuatorScaleChanged(object sender, EventArgs e) { //If is loading frame, return. if (this.isLoadingFrame) { return; } //Get sender name. string senderName = ((Gtk.Widget)sender).Name; //Check what scale to update. for (int i = 0; i < this.actuatorScales.Count; i++) { Gtk.HScale actuatorScale = this.actuatorScales[i]; //If actuator name not sender name, continue. if (actuatorScale.Name != senderName) { continue; } //Update servo connected to actuator. this.robot.SetServoAngle(i, (float)actuatorScale.Adjustment.Value); break; } //Update selected keyframe. this.UpdateSelectedKeyframe(); }
public override Widget ConfigurationWidget() { VBox h = new VBox (); r = new HScale (0, 100, 1); r.ModifyBg (StateType.Selected, new Color (0xff, 0, 0)); r.Value = 80; r.ValueChanged += SettingsChanged; h.Add (r); g = new HScale (0, 100, 1); g.ModifyBg (StateType.Selected, new Color (0, 0xff, 0)); g.Value = 10; g.ValueChanged += SettingsChanged; h.Add (g); b = new HScale (0, 100, 1); b.ModifyBg (StateType.Selected, new Color (0, 0, 0xff)); b.Value = 10; b.ValueChanged += SettingsChanged; h.Add (b); c = new Curve (); c.CurveType = CurveType.Spline; c.SetRange (0, 255, 0, 255); h.Add (c); Button btn = new Button (Gtk.Stock.Refresh); btn.Clicked += delegate {UpdatePreview ();}; h.Add (btn); return h; }
public VideoPosition (Player player) { slider = Base.GetWidget(WidgetNames.VideoSlider) as HScale; positionLabel = Base.GetWidget(WidgetNames.VideoPositionLabel) as Label; positionValueLabel = Base.GetWidget(WidgetNames.VideoPositionValueLabel) as Label; lengthValueLabel = Base.GetWidget(WidgetNames.VideoLengthValueLabel) as Label; this.player = player; Base.InitFinished += OnBaseInitFinished; }
public ColorScales(HScale redScale, HScale greenScale, HScale blueScale, HScale alphaScale) { this.redScale = redScale; this.greenScale = greenScale; this.blueScale = blueScale; this.alphaScale = alphaScale; inst = this; }
public MainWindow_Widget2() : base("Widget2") { SetDefaultSize(800, 600); SetPosition(WindowPosition.Center); BorderWidth = 7; DeleteEvent += delegate { Application.Quit(); }; _label = new Label("..."); Entry entry = new Entry(); entry.Changed += OnChangedEntry; // scale and image HScale scale = new HScale(0, 100, 1); { scale.SetSizeRequest(160, 35); scale.ValueChanged += OnChangeScale; LoadImage(); _image = new Image(img1); } // Color ToggleButton red = new ToggleButton("red"); { red.SetSizeRequest(80, 35); red.Clicked += OnRed; _area = new DrawingArea(); _area.SetSizeRequest(150, 150); } Calendar calendar = new Calendar(); { calendar.DaySelected += OnDaySelected; } Fixed fix = new Fixed(); fix.Put(entry, 60, 100); fix.Put(_label, 60, 40); fix.Put(scale, 60, 200); fix.Put(_image, 10, 240); fix.Put(red, 300, 250); fix.Put(_area, 300, 500); fix.Put(calendar, 500, 300); Add(fix); ShowAll(); }
public void Initialize (Xwt.Backends.Orientation dir) { if (dir == Xwt.Backends.Orientation.Horizontal) Widget = new Gtk.HScale (0, 1.0, 0.1); else Widget = new Gtk.VScale (0, 1.0, 0.1); Widget.DrawValue = false; Widget.Show (); }
public ToolBarSlider (int min, int max, int step, int value) { hscale = new HScale (min, max, step); hscale.WidthRequest = 150; hscale.Value = value; hscale.ValuePos = PositionType.Left; hscale.Show (); Add (hscale); Show (); }
static void SetUpGui () { Window w = new Window ("Scale Test"); HScale hscale = new HScale (1, 100, 10); hscale.ValueChanged += hscale_value_changed_cb; hscale.Value = 50; w.Add (hscale); w.SetDefaultSize (160, 120); w.ShowAll (); }
public void Initialize(Xwt.Backends.Orientation dir) { if (dir == Xwt.Backends.Orientation.Horizontal) { Widget = new Gtk.HScale(0, 1.0, 0.1); } else { Widget = new Gtk.VScale(0, 1.0, 0.1); } Widget.DrawValue = false; Widget.Show(); }
public MainWindow() : base("Overlaytest") { VBox vBox = new VBox (); _da = new DrawingArea (); _da.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0, 0, 0)); _da.SetSizeRequest (400, 300); _da.DoubleBuffered = false; vBox.PackStart (_da, false, false, 0); _scale = new HScale (0, 1, 0.01); _scale.DrawValue = false; _scale.ValueChanged += ScaleValueChanged; vBox.PackStart (_scale, false, false, 0); HBox hBox = new HBox (); Button btnOpen = new Button (); btnOpen.Label = "Open"; btnOpen.Clicked += ButtonOpenClicked; hBox.PackStart (btnOpen, false, false, 0); Button btnPlay = new Button (); btnPlay.Label = "Play"; btnPlay.Clicked += ButtonPlayClicked; hBox.PackStart (btnPlay, false, false, 0); Button btnPause = new Button (); btnPause.Label = "Pause"; btnPause.Clicked += ButtonPauseClicked; hBox.PackStart (btnPause, false, false, 0); _lbl = new Label (); _lbl.Text = "00:00 / 00:00"; hBox.PackEnd (_lbl, false, false, 0); vBox.PackStart (hBox, false, false, 3); Add (vBox); WindowPosition = Gtk.WindowPosition.Center; DeleteEvent += OnDeleteEvent; GLib.Timeout.Add (1000, new GLib.TimeoutHandler (UpdatePos)); }
public ZoomWidget(ScaleRange range, double startScale) { _range = range; _scale = startScale; zoomSlider = new HScale (range.Minimum, range.Maximum, range.Step); zoomEntry = new Entry (startScale.ToString ()); seperator = new SeparatorMenuItem (); zoomSlider.Value = startScale; zoomSlider.ValueChanged += OnSliderChangeValue;; zoomEntry.TextInserted += OnEntryTextInserted; Add (zoomSlider); Add (seperator); Add (zoomEntry); }
public SpotFunctionPanel() : base(4, 2, false) { // TODO: use degrees instead of radians angleHScale = new HScale(0, 2, 0.01); distanceSpinButton = new SpinButton(1, 1000, 1); presets = new List<SpotFunction>(SpotFunction.Samples.list()); presetsNames = (from preset in presets select preset.Name).ToList(); presetComboBox = new ComboBox(presetsNames.ToArray()); presetComboBox.Changed += delegate { int active = presetComboBox.Active; if (active >= 0) { module = (SpotFunction)presets[active].deepCopy(); } }; ColumnSpacing = RowSpacing = BorderWidth = 5; Attach(new Label("Preset:") { Xalign = 0.0f }, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); Attach(presetComboBox, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); Attach(new Label("Screen angle (rad):") { Xalign = 0.0f }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); Attach(angleHScale, 1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); Attach(new Label("Screen line distance (px):") { Xalign = 0.0f }, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); Attach(distanceSpinButton, 1, 2, 2, 3, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); ShowAll(); }
public ZoomSlider (Client app) : base (1f, 0.5f, 0f, 0f) { RightPadding = 16; var box = new HBox () { Spacing = 2 }; // Zoom in/out buttons var zoom_out = new Button (new Image (Stock.ZoomOut, IconSize.Button)) { Relief = ReliefStyle.None }; app.Actions["ZoomOut"].ConnectProxy (zoom_out); var zoom_in = new Button (new Image (Stock.ZoomIn, IconSize.Button)) { Relief = ReliefStyle.None }; app.Actions["ZoomIn"].ConnectProxy (zoom_in); // Slider var slider = new HScale (DocumentIconView.MIN_WIDTH, DocumentIconView.MAX_WIDTH, 1) { WidthRequest = 100, DrawValue = false, Sensitive = false }; bool setting_via_slider = false; slider.ValueChanged += (o, a) => { if (!setting_via_slider) { setting_via_slider = true; app.IconView.Zoom ((int)slider.Value, true); setting_via_slider = false; } }; app.IconView.ZoomChanged += () => { if (!setting_via_slider) { setting_via_slider = true; slider.Value = app.IconView.ItemSize; setting_via_slider = false; } }; app.DocumentLoaded += (o, a) => slider.Sensitive = app.Document != null; box.PackStart (zoom_out, false, false, 0); box.PackStart (slider, false, false, 0); box.PackStart (zoom_in, false, false, 0); Child = box; }
public PerturbedErrorFilterDialog( PerturbedErrorFilter existingModule) : base(existingModule) { module = modifiedModule as PerturbedErrorFilter; if (module == null) { modifiedModule = new PerturbedErrorFilter(); module = modifiedModule as PerturbedErrorFilter; } childFilterSelector = new SubmoduleSelector<MatrixErrorFilter>( module.ChildFilter); childFilterSelector.ModuleChanged += delegate { module.ChildFilter = childFilterSelector.Module; }; perturbationAmplitudeHScale = new HScale(0.0, 1.0, 0.01); perturbationAmplitudeHScale.Value = module.PerturbationAmplitude; perturbationAmplitudeHScale.ValueChanged += delegate { module.PerturbationAmplitude = perturbationAmplitudeHScale.Value; }; table = new Table(2, 2, false) { ColumnSpacing = 5, RowSpacing = 5, BorderWidth = 5 }; table.Attach(new Label("Child filter:") { Xalign = 0.0f}, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(childFilterSelector, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); table.Attach(new Label("Perturbation amplitude:") { Xalign = 0.0f }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(perturbationAmplitudeHScale, 1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); table.ShowAll(); VBox.PackStart(table); }
public ColorEditor(object @object, PropertyInfo info) : base(@object, info) { HBox box = new HBox(); box.Spacing = 6; box.Show(); this.mColorButton = new ColorButton(); this.mColorButton.Show(); box.PackStart(this.mColorButton, false, true, 0); this.mAlphaScale = new HScale(0, 1, 0.0001); this.mAlphaScale.Show(); box.PackStart(this.mAlphaScale, true, true, 0); this.Add(box); this.Revert(); this.mColorButton.ColorSet += this.OnDirtyAction; this.mAlphaScale.ValueChanged += this.OnDirtyAction; }
public JpegCompressionDialog(int defaultQuality) : base(Catalog.GetString ("JPEG Quality"), Pinta.Core.PintaCore.Chrome.MainWindow, DialogFlags.Modal | DialogFlags.DestroyWithParent, Stock.Cancel, ResponseType.Cancel, Stock.Ok, ResponseType.Ok) { this.BorderWidth = 6; this.VBox.Spacing = 3; VBox content = new VBox (); content.Spacing = 5; Label label = new Label (Catalog.GetString ("Quality: ")); label.Xalign = 0; content.PackStart (label, false, false, 0); compressionLevel = new HScale (1, 100, 1); compressionLevel.Value = defaultQuality; content.PackStart (compressionLevel, false, false, 0); content.ShowAll (); this.VBox.Add (content); AlternativeButtonOrder = new int[] { (int) ResponseType.Ok, (int) ResponseType.Cancel }; }
protected void OnPwmPinSlider3ValueChanged(object sender, EventArgs e) { Gtk.HScale slider = (Gtk.HScale)sender; int sliderNumber = int.Parse(slider.Name.Substring(slider.Name.LastIndexOf('r') + 1)); switch (sliderNumber) { case 3: pwmValue3.Text = "" + (int)slider.Value; break; case 5: pwmValue5.Text = "" + (int)slider.Value; break; case 6: pwmValue6.Text = "" + (int)slider.Value; break; case 9: pwmValue9.Text = "" + (int)slider.Value; break; case 10: pwmValue10.Text = "" + (int)slider.Value; break; case 11: pwmValue11.Text = "" + (int)slider.Value; break; default: break; } if (comPort.IsOpen) { SendSerialCommand("S" + sliderNumber + "A" + (int)slider.Value); } }
private void BindToWidget() { foreach (var p in GetObjectProperties(m_objectType)) { var hbox = new HBox(); var label = new Label(p.Name); hbox.Add(label); var value = p.GetValue(ObjectInstance, null); Widget input = null; if (p.PropertyType == typeof(int)) { var spinButton = new SpinButton(0, int.MaxValue, 1); spinButton.Value = Convert.ToDouble(value); input = spinButton; } if (p.PropertyType == typeof(bool)) { var toggle = new ToggleButton(); toggle.Active = Convert.ToBoolean(value); input = toggle; } else if (p.PropertyType == typeof(float) || p.PropertyType == typeof(double)) { var horizontalScale = new HScale(0, 1, 0.05); if (ObjectInstance != null) { horizontalScale.Value = Convert.ToDouble(value); } input = horizontalScale; } else if (p.PropertyType == typeof(TimeSpan)) { var secondsHBox = new HBox(); var seconds = new SpinButton(0, int.MaxValue, 1); seconds.Value = ((TimeSpan)value).TotalSeconds; secondsHBox.Add(seconds); var secondsLabel = new Label("seconds"); secondsHBox.Add(secondsLabel); input = secondsHBox; } if (input != null) { m_widgetMap.Add(p, input); hbox.Add(input); } VBox.Add(hbox); } }
public HorizontalSlider() { _scale = new HScale(0, 1, 0.1); }
private void AllowinternalAccess() { _tvShares = tvShares; _tvArtists = tvArtists; _tvGenres = tvGenres; _tvAlbums = tvAlbums; _tvPlaylist = tvPlaylist; _tvFiles = tvFiles; _MainWindow = MainWindow; _nbLeft = nbLeft; _nbRight = nbRight; _hsVolume = hsVolume; _hsProgress = hsProgress; _iConnectionStatus = iConnectionStatus; _lStatus = lStatus; _tbMute = tbMute; _ibPlay = ibPlay; _bStop = bStop; //Configuration tab _eIpAddress = eIpAddress; _eUsername = eUsername; _ePassword = ePassword; _sbUpdateInterval = sbUpdateInterval; _sbConnectionTimeout = sbConnectionTimeout; _chbShowInTaskbar = chbShowInTaskbar; _chbShowInSystemTray = chbShowInSystemTray; }
private void Build () { // Section label + line var hbox1 = new HBox (false, 6); label = new Label (); hbox1.PackStart (label, false, false, 0); hbox1.PackStart (new HSeparator (), true, true, 0); // Slider + spinner + reset button var hbox2 = new HBox (false, 6); hscale = new HScale (2, 64, 1); hscale.CanFocus = true; hscale.DrawValue = false; hscale.Digits = 0; hscale.ValuePos = PositionType.Top; hbox2.PackStart (hscale, true, true, 0); spin = new SpinButton (0, 100, 1); spin.CanFocus = true; spin.Adjustment.PageIncrement = 10; spin.ClimbRate = 1; spin.Numeric = true; hbox2.PackStart (spin, false, false, 0); // Reset button button = new Button (); button.WidthRequest = 28; button.HeightRequest = 24; button.CanFocus = true; button.UseUnderline = true; var button_image = new Image (PintaCore.Resources.GetIcon (Stock.GoBack, 16)); button.Add (button_image); var alignment2 = new Alignment (0.5F, 0F, 1F, 0F); alignment2.Add (button); hbox2.PackStart (alignment2, false, false, 0); // Main layout var vbox = new VBox (false, 6); vbox.Add (hbox1); vbox.Add (hbox2); Add (vbox); vbox.ShowAll (); }
public static Gtk.Window Create () { window = new Window ("GtkRange"); window.SetDefaultSize (250, 200); VBox box1 = new VBox (false, 0); window.Add (box1); VBox box2 = new VBox (false, 0); box2.BorderWidth = 10; box1.PackStart (box2, true, true, 0); Adjustment adjustment = new Adjustment (0.0, 0.0, 101.0, 0.1, 1.0, 1.0); HScale hscale = new HScale (adjustment); hscale.SetSizeRequest (150, -1); hscale.Digits = 1; hscale.DrawValue = true; box2.PackStart (hscale, true, true, 0); HScrollbar hscrollbar = new HScrollbar (adjustment); box2.PackStart (hscrollbar, true, true, 0); hscale = new HScale (adjustment); hscale.DrawValue = true; hscale.FormatValue += new FormatValueHandler (reformat_value); box2.PackStart (hscale, true, true, 0); HBox hbox = new HBox (false, 0); VScale vscale = new VScale (adjustment); vscale.SetSizeRequest (-1, 200); vscale.Digits = 2; vscale.DrawValue = true; hbox.PackStart (vscale, true, true, 0); vscale = new VScale (adjustment); vscale.SetSizeRequest (-1, 200); vscale.Digits = 2; vscale.DrawValue = true; ((Range) vscale).Inverted = true; hbox.PackStart (vscale, true, true, 0); vscale = new VScale (adjustment); vscale.DrawValue = true; vscale.FormatValue += new FormatValueHandler (reformat_value); hbox.PackStart (vscale, true, true, 0); box2.PackStart (hbox, true, true, 0); box1.PackStart (new HSeparator (), false, true, 0); box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, false, true, 0); Button button = new Button (Stock.Close); button.Clicked += new EventHandler (Close_Button); box2.PackStart (button, true, true, 0); button.CanDefault = true; button.GrabDefault (); window.ShowAll (); return window; }
private void AllowStaticAccess() { _tvShareBrowser = this.tvShareBrowser; _tvPlaylist = this.tvPlaylist; _cbShareType = this.cbShareType; _hsVolume = this.hsVolume; _hsProgress = this.hsProgress; _tbMute = this.tbMute; _bPrevious = this.bPrevious; _tbPlay = this.tbPlay; _tbStop = this.tbStop; _bNext = this.bNext; _imgNowPlaying = this.imgNowPlaying; _imgLoading = this.imgLoading; _fixedNowPlaying= this.fixedNowPlaying; _lArtist = this.lArtist; _lSong = this.lSong; _lAlbum = this.lAlbum; _lGenre = this.lGenre; _lProgress = this.lProgress; _lDuration = this.lDuration; _lYear = this.lYear; _nbDataContainer= this.nbDataContainer; }
/// <summary> /// Create and show a slider (HScale) that will allow the user to /// customize how far in the past to show completed items. /// </summary> private void CreateRangeSlider() { // There are five (5) different values allowed here: // "Yesterday", "Last7Days", "LastMonth", "LastYear", or "All" // Create the slider with 5 distinct "stops" rangeSlider = new HScale (0, 4, 1); rangeSlider.SetIncrements (1, 1); rangeSlider.WidthRequest = 100; rangeSlider.DrawValue = true; // TODO: Set the initial value and range string rangeStr = Application.Preferences.Get (Preferences.CompletedTasksRange); if (rangeStr == null) { // Set a default value of All rangeStr = ShowCompletedRange.All.ToString (); Application.Preferences.Set (Preferences.CompletedTasksRange, rangeStr); } currentRange = ParseRange (rangeStr); rangeSlider.Value = (double)currentRange; rangeSlider.FormatValue += OnFormatRangeSliderValue; rangeSlider.ValueChanged += OnRangeSliderChanged; rangeSlider.Show (); this.ExtraWidget = rangeSlider; }
public void ShowControlBox( Gtk.VBox labels, Gtk.VBox widgets ) { Label label = new Label( "Target height:" ); heightscale = new HScale( minheight, maxheight, (maxheight - minheight) / 20 ); heightscale.Value = lastheight; heightscale.ValueChanged += new EventHandler( heightscale_ValueChanged ); labels.PackEnd( label ); widgets.PackEnd( heightscale ); labels.ShowAll(); widgets.ShowAll(); }
/// <summary> /// Create a new halftone algorithm configuration panel using an /// existing halftone algorithm. /// </summary> /// <param name="existingModule"></param> public HalftoneAlgorithmPanel(HalftoneAlgorithm existingModule) { BorderWidth = 3; VBox preProcessingVBox = new VBox(); Frame preResizeFrame = new Frame("Resize") { BorderWidth = 3 }; Frame preDotGainFrame = new Frame("Dot gain correction") { BorderWidth = 3 }; Frame preSharpenFrame = new Frame("Sharpen") { BorderWidth = 3 }; Frame halftoneMethodFrame = new Frame("Halftone method") { BorderWidth = 3 }; VBox postProcessingVBox = new VBox(); Frame postResizeFrame = new Frame("Resize") { BorderWidth = 3 }; Frame postSmoothenFrame = new Frame("Smoothen") { BorderWidth = 3 }; // -------- pre-processing -------- // ---- resize ---- preResizePanel = new ResizePanel(); preResizePanel.ModuleChanged += delegate { Module.PreResize = preResizePanel.Module; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; preResizeFrame.Add(preResizePanel); preProcessingVBox.PackStart(preResizeFrame); // ---- dot gain ---- preDotGainEnabledCheckButton = new CheckButton("Enabled"); preDotGainEnabledCheckButton.Toggled += delegate { bool enabled = preDotGainEnabledCheckButton.Active; if (!enabled) { Module.PreDotGain = null; } else if (Module.PreDotGain == null) { Module.PreDotGain = new HalftoneAlgorithm.GammaCorrection(); } if (Module.PreDotGain != null) { preDotGainGammaSpinButton.Value = ((HalftoneAlgorithm.GammaCorrection) Module.PreDotGain).Gamma; } preDotGainGammaSpinButton.Sensitive = enabled; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; preDotGainGammaSpinButton = new SpinButton(0.1, 10, 0.1); preDotGainGammaSpinButton.Changed += delegate { ((HalftoneAlgorithm.GammaCorrection)Module.PreDotGain).Gamma = preDotGainGammaSpinButton.Value; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; Table preDotGainTable = new Table(2, 2, false) { ColumnSpacing = 3, RowSpacing = 3, BorderWidth = 5 }; preDotGainTable.Attach(preDotGainEnabledCheckButton, 0, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); preDotGainTable.Attach(new Label("Gamma:") { Xalign = 0.0f }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); preDotGainTable.Attach(preDotGainGammaSpinButton, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); preDotGainFrame.Add(preDotGainTable); preProcessingVBox.PackStart(preDotGainFrame); // ---- sharpen ---- preSharpenEnabledCheckButton = new CheckButton("Enabled"); preSharpenEnabledCheckButton.Toggled += delegate { bool enabled = preSharpenEnabledCheckButton.Active; if (!enabled) { Module.PreSharpen = null; } else if (Module.PreSharpen == null) { Module.PreSharpen = new HalftoneAlgorithm.Sharpen(); } if (Module.PreSharpen != null) { preSharpenAmountHScale.Value = Module.PreSharpen.Amount; } preSharpenAmountHScale.Sensitive = enabled; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; preSharpenAmountHScale = new HScale(0, 1, 0.01); preSharpenAmountHScale.ChangeValue += delegate { Module.PreSharpen.Amount = preSharpenAmountHScale.Value; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; Table preSharpenTable = new Table(2, 2, false) { ColumnSpacing = 3, RowSpacing = 3, BorderWidth = 5 }; preSharpenTable.Attach(preSharpenEnabledCheckButton, 0, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); preSharpenTable.Attach(new Label("Amount:") { Xalign = 0.0f }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); preSharpenTable.Attach(preSharpenAmountHScale, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); preSharpenFrame.Add(preSharpenTable); preProcessingVBox.PackStart(preSharpenFrame); AppendPage(preProcessingVBox, new Label("Pre-processing")); // -------- halftone method -------- halftoneMethodSelector = new SubmoduleSelector<HalftoneMethod>(HalftoneMethod.createDefault()) { BorderWidth = 5 }; halftoneMethodSelector.ModuleChanged += delegate { if (Module != null) { Module.Method = halftoneMethodSelector.Module; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } } }; halftoneMethodFrame.Add(halftoneMethodSelector); AppendPage(halftoneMethodFrame, new Label("Halftone method")); // -------- post-processing -------- // ---- resize ---- postResizePanel = new ResizePanel(); postResizePanel.ModuleChanged += delegate { Module.PostResize = postResizePanel.Module; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; supersamplingCheckButton = new CheckButton("Supersampling"); supersamplingCheckButton.Toggled += delegate { Module.SupersamplingEnabled = supersamplingCheckButton.Active; postResizePanel.Sensitive = !supersamplingCheckButton.Active; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; Table postResizeTable = new Table(2, 1, false); postResizeTable.Attach(supersamplingCheckButton, 0, 1, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); postResizeTable.Attach(postResizePanel, 0, 1, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 0, 0); postResizeFrame.Add(postResizeTable); postProcessingVBox.PackStart(postResizeFrame); // ---- smoothen ---- postSmoothenEnabledCheckButton = new CheckButton("Enabled"); postSmoothenEnabledCheckButton.Toggled += delegate { bool enabled = postSmoothenEnabledCheckButton.Active; if (!enabled) { Module.PostSmoothen = null; } else if (Module.PostSmoothen == null) { Module.PostSmoothen = new HalftoneAlgorithm.Smoothen(); } if (Module.PostSmoothen != null) { postSmoothenRadiusSpinButton.Value = Module.PostSmoothen.Radius; } postSmoothenRadiusSpinButton.Sensitive = enabled; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; postSmoothenRadiusSpinButton = new SpinButton(1, 20, 0.5); postSmoothenRadiusSpinButton.Changed += delegate { Module.PostSmoothen.Radius = postSmoothenRadiusSpinButton.Value; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; Table postSmoothenTable = new Table(2, 2, false) { ColumnSpacing = 3, RowSpacing = 3, BorderWidth = 5 }; postSmoothenTable.Attach(postSmoothenEnabledCheckButton, 0, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); postSmoothenTable.Attach(new Label("Radius:") { Xalign = 0.0f }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); postSmoothenTable.Attach(postSmoothenRadiusSpinButton, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); postSmoothenFrame.Add(postSmoothenTable); postProcessingVBox.PackStart(postSmoothenFrame); AppendPage(postProcessingVBox, new Label("Post-processing")); Module = existingModule; ShowAll(); Page = 1; }
private void Build () { DefaultWidth = 349; DefaultHeight = 224; BorderWidth = 6; VBox.Spacing = 10; // Layer name var box1 = new HBox (); box1.Spacing = 6; box1.PackStart (new Label (Mono.Unix.Catalog.GetString ("Name:")), false, false, 0); layerNameEntry = new Entry (); box1.PackStart (layerNameEntry); VBox.PackStart (box1, false, false, 0); // Visible checkbox visibilityCheckbox = new CheckButton (Mono.Unix.Catalog.GetString ("Visible")); VBox.PackStart (visibilityCheckbox, false, false, 0); // Horizontal separator VBox.PackStart (new HSeparator (), false, false, 0); // Blend mode var box2 = new HBox (); box2.Spacing = 6; box2.PackStart (new Label (Mono.Unix.Catalog.GetString ("Blend Mode") + ":"), false, false, 0); blendComboBox = new ComboBox (UserBlendOps.GetAllBlendModeNames ().ToArray ()); box2.PackStart (blendComboBox); VBox.PackStart (box2, false, false, 0); // Opacity var box3 = new HBox (); box3.Spacing = 6; box3.PackStart (new Label (Mono.Unix.Catalog.GetString ("Opacity:")), false, false, 0); opacitySpinner = new SpinButton (0, 100, 1); opacitySpinner.Adjustment.PageIncrement = 10; opacitySpinner.ClimbRate = 1; box3.PackStart (opacitySpinner, false, false, 0); opacitySlider = new HScale (0, 100, 1); opacitySlider.Digits = 0; opacitySlider.Adjustment.PageIncrement = 10; box3.PackStart (opacitySlider, true, true, 0); VBox.PackStart (box3, false, false, 0); // Finish up VBox.ShowAll (); AlternativeButtonOrder = new int[] { (int)ResponseType.Ok, (int)ResponseType.Cancel }; DefaultResponse = ResponseType.Ok; }
public ThresholdTableRecordDialog(DynamicMatrixThresholdFilter.ThresholdRecord editedRecord) { Title = "Threshold record editing"; Modal = true; AddButton("OK", ResponseType.Ok); AddButton("Cancel", ResponseType.Cancel); record = editedRecord; if (record == null) { record = new DynamicMatrixThresholdFilter.ThresholdRecord(); } intensitySpinButton = new SpinButton(0, 255, 1); intensitySpinButton.Value = record.keyRangeStart; matrixPanel = new ThresholdMatrixPanel((uint)record.matrix.Height, (uint)record.matrix.Width); matrixPanel.Matrix = record.matrix.DefinitionMatrix; matrixPanel.Scaled = !record.matrix.Incremental; noiseHScale = new HScale(0, 1, 0.01); noiseHScale.Value = record.noiseAmplitude; table = new Table(4, 2, false) { ColumnSpacing = 5, RowSpacing = 5, BorderWidth = 5 }; table.Attach(new Label("Intensity range start:") { Xalign = 0.0f }, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(intensitySpinButton, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(new Label("Threshold matrix:") { Xalign = 0.0f }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(matrixPanel, 0, 2, 2, 3, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 0, 0); table.Attach(new Label("Noise amplitude:") { Xalign = 0.0f }, 0, 1, 3, 4, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(noiseHScale, 1, 2, 3, 4, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.ShowAll(); VBox.PackStart(table); }
private Widget CreateBottomBar() { HButtonBox buttonBox = new HButtonBox (); buttonBox.Layout = ButtonBoxStyle.Edge; toggleSidebarButton = new Button (); toggleSidebarButton.Label = Catalog.GetString ("Close Sidebar"); toggleSidebarButton.Relief = ReliefStyle.None; toggleSidebarButton.Clicked += OnToggleSidebarButtonClicked; toggleSidebarButton.Show (); buttonBox.PackStart (toggleSidebarButton, false, false, 0); personHScale = new HScale (1, 3, 1); personHScale.DrawValue = false; personHScale.ValueChanged += OnPersonHScaledValueChanged; personHScale.Show (); buttonBox.PackEnd (personHScale, false, false, 0); buttonBox.Show (); return buttonBox; }
public void ShowSettingsPage() { SetSizeRequest (680, 470); Header = CmisSync.Properties_Resources.Settings; string localfoldername = Controller.saved_address.ToString(); string username = Controller.saved_user; Label url_label = new Label() { Xalign = 0, UseMarkup = true, Markup = "<b>"+CmisSync.Properties_Resources.WebAddress+"</b>" }; Entry url_entry = new Entry() { Text = localfoldername, IsEditable = false, Sensitive=false }; Label user_label = new Label() { Xalign = 0, UseMarkup = true, Markup = "<b>"+CmisSync.Properties_Resources.User+"</b>" }; Entry user_entry = new Entry() { Text = username, IsEditable = false, Sensitive=false }; Label password_label = new Label() { Xalign = 0, UseMarkup = true, Markup = "<b>"+CmisSync.Properties_Resources.Password+"</b>", }; Label authentification_error_label = new Label() { Xalign = 0, UseMarkup = true, Visible = false }; Entry password_entry = new Entry() { Text = "", ActivatesDefault = false }; String password = ""; password_entry.TextInserted+=delegate { password+=password_entry.Text[password_entry.Text.Length-1]; password_entry.Text=password_entry.Text.Replace(password_entry.Text[password_entry.Text.Length-1],'*'); }; CheckButton launcAtStartup = new CheckButton (CmisSync.Properties_Resources.SyncAtStartup); if (Controller.saved_syncatstartup) launcAtStartup.Active = true; Label syncInterval_label = new Label() { Xalign = 0, UseMarkup = true, Markup = "<b>"+CmisSync.Properties_Resources.SyncInterval+"(Secondes)"+"</b>" }; //sync interval is between 5s and 1day HScale syncInterval_hscale = new HScale(new Adjustment(0,5,86401,5,5,1)); syncInterval_hscale.DrawValue = true; // syncinterval is converted in secondes syncInterval_hscale.Value=Controller.saved_sync_interval/1000; syncInterval_hscale.Digits = 0; syncInterval_hscale.ValueChanged += delegate { Application.Invoke (delegate { syncInterval_hscale.TooltipText=syncInterval_hscale.Value+" s"; }); }; Button cancel_button = new Button(cancelText); cancel_button.Clicked += delegate { Controller.PageCancelled(); }; Button save_button = new Button( CmisSync.Properties_Resources.Save ); VBox layout_vertical = new VBox (false, 10); layout_vertical.PackStart (new Label(""), false, false, 0); layout_vertical.PackStart (url_label, false, false, 0); layout_vertical.PackStart (url_entry, false, false, 0); layout_vertical.PackStart (user_label, false, false, 0); layout_vertical.PackStart (user_entry, false, false, 0); layout_vertical.PackStart (password_label, false, false, 0); layout_vertical.PackStart (password_entry, false, false, 0); layout_vertical.PackStart (authentification_error_label, false, false, 0); layout_vertical.PackStart (launcAtStartup, false, false, 0); layout_vertical.PackStart (syncInterval_label, false, false, 0); layout_vertical.PackStart (syncInterval_hscale, false, false, 0); //layout_vertical.PackStart (scale2, false, false, 0); ScrolledWindow scrolledWindow = new ScrolledWindow(); scrolledWindow.SetPolicy(PolicyType.Never, PolicyType.Automatic); scrolledWindow.AddWithViewport(layout_vertical); scrolledWindow.ShadowType=ShadowType.None; Add(scrolledWindow); AddButton(save_button); AddButton(cancel_button); save_button.Clicked += delegate { //save password not masked String verypassword=""; for (int i=0;i<password.Length;i++){ if (!password[i].Equals('*')) verypassword+=password[i]; } //reset password=""; if (!String.IsNullOrEmpty(verypassword)) { // Show wait cursor this.GdkWindow.Cursor = wait_cursor; // Try to find the CMIS server (asynchronous using a delegate) GetRepositoriesFuzzyDelegate dlgt = new GetRepositoriesFuzzyDelegate(CmisUtils.GetRepositoriesFuzzy); ServerCredentials credentials = new ServerCredentials() { UserName = user_entry.Text, Password = verypassword, Address = new Uri(url_entry.Text) }; IAsyncResult ar = dlgt.BeginInvoke(credentials, null, null); while (!ar.AsyncWaitHandle.WaitOne(100)) { while (Application.EventsPending()) { Application.RunIteration(); } } Tuple<CmisServer, Exception> result = dlgt.EndInvoke(ar); CmisServer cmisServer = result.Item1; if(cmisServer != null) { Controller.repositories = cmisServer.Repositories; url_entry.Text = cmisServer.Url.ToString(); } else { Controller.repositories = null; } // Hide wait cursor this.GdkWindow.Cursor = default_cursor; if (Controller.repositories == null) { // Show warning string warning = ""; string message = result.Item2.Message; Exception e = result.Item2; if (e is CmisPermissionDeniedException) { warning = Properties_Resources.LoginFailedForbidden; } else if (e.Message == "SendFailure" && cmisServer.Url.Scheme.StartsWith("https")) { warning = Properties_Resources.SendFailureHttps; } else if (e.Message == "TrustFailure") { warning = Properties_Resources.TrustFailure; } else { warning = message + Environment.NewLine + Properties_Resources.Sorry; } authentification_error_label.Markup = "<span foreground=\"red\">" + warning + "</span>"; authentification_error_label.Show(); } else { // update settings // syncinterval is converted in millisecondes Controller.SettingsPageCompleted(verypassword,(int)(syncInterval_hscale.Value*1000),launcAtStartup.Active); } } else { Controller.SettingsPageCompleted(null, (int)syncInterval_hscale.Value*1000, launcAtStartup.Active); } }; }
static void Main() { Application.Init(); // Gtk# init Console.WriteLine("Application starting up"); // Create HScale slider before Button, but add them in opposite order // see http://www.gtk.org/tutorial1.2/gtk_tut-7.html // http://inti.sourceforge.net/tutorial/libinti/rangewidgets.html // http://www.mono-project.com/docs/gui/gtksharp/widgets/range-widgets/ Adjustment adj = new Adjustment( 5.0d, // Initial value 0.0d, // Lower limit 10.0d, // Upper limit 0.5, // Step increment 2.0d, // Page increment 0.0d // Page size, seems like it should be 0 for a slider, // as it's non-panning, and it avoid surprising subtraction ); HScale hs = new HScale(adj); var p = new PositionType(); hs.AddMark(0.1, p, null); // breaks build in Windows! // hs.addMark SHOULD BE AVAILABLE! Old GTK# library? Label label = new Label("Start timer threads"); Button btn = new Button(label); btn.Clicked += new EventHandler( (object obj, EventArgs args) => { hello(hs,label); } ); Window window = new Window("Timer Thread Demo"); // when this window is deleted, run delete_event() window.DeleteEvent += delete_event; Box box = new VBox(); box.Add(btn); box.Add(hs); window.Add(box); window.ShowAll(); Application.Run(); }
private Widget BuildSlider(PipelineVariable variable) { if(variable.StepValue <= 0.0) { return null; } HBox box = new HBox(); HScale slider = new HScale(variable.MinValue, variable.MaxValue, variable.StepValue); slider.DrawValue = true; slider.Digits = variable.StepPrecision; if(variable.DefaultValueNumeric != null) { slider.Value = (double)variable.DefaultValueNumeric; } if(variable.CurrentValueNumeric != null) { slider.Value = (double)variable.CurrentValueNumeric; } slider.ChangeValue += delegate { variable.CurrentValue = slider.Value.ToString(); }; if(variable.MinLabel != null) { Label min_label = new Label(); min_label.Yalign = 0.9f; min_label.Markup = String.Format("<small>{0}</small>", GLib.Markup.EscapeText(variable.MinLabel)); box.PackStart(min_label, false, false, 0); box.Spacing = 5; } box.PackStart(slider, true, true, 0); if(variable.MaxLabel != null) { Label max_label = new Label(); max_label.Yalign = 0.9f; max_label.Markup = String.Format("<small>{0}</small>", GLib.Markup.EscapeText(variable.MaxLabel)); box.PackStart(max_label, false, false, 0); box.Spacing = 5; } box.ShowAll(); return box; }
void BuildLayout () { primary_vbox = new VBox (); var shell = action_manager.UIManager.GetWidget ("/MainMenu"); primary_vbox.PackStart (shell, false, false, 0); photo_view = new PhotoGridView (); photo_view.Show (); var photo_view_scrolled = new ScrolledWindow (); photo_view_scrolled.Add (photo_view); photo_view_scrolled.Show (); primary_vbox.PackStart (photo_view_scrolled, true, true, 8); var model = PhotoModelFactory.GetModel (Core.MainPhotoSourceCache.AllPhotos); model.Reload (); Hyena.Log.DebugFormat ("Model count: {0}", model.Count); photo_view.SetModel (model); var hbox = new HBox (false, 5); hbox.Add (new Label ("Size")); var scale = new HScale (50, 800, 10); scale.Value = 140; scale.ValueChanged += (s, a) => { photo_view.ThumbnailSize = (int) scale.Value; }; hbox.Add (scale); hbox.ShowAll (); primary_vbox.PackEnd (hbox, false, true, 0); primary_vbox.Show (); Add (primary_vbox); }