Beispiel #1
0
        private void LoadHistory()
        {
            string [] history_array = OpenLocationHistorySchema.Get();
            if (history_array == null || history_array.Length == 0)
            {
                return;
            }

            foreach (string uri in history_array)
            {
                history.Add(uri);
                address_entry.AppendText(uri);
            }
        }
Beispiel #2
0
        public StationDialog(Stations stations, Station station)
        {
            glade = new Glade.XML(null, "radio.glade", "StationDialog", "banshee");
            glade.Autoconnect(this);
            dialog = (Dialog)glade.GetWidget("StationDialog");
            Banshee.Base.IconThemeUtils.SetWindowIcon(dialog);

            if (station == null)
            {
                is_new  = true;
                station = new Station();
            }

            this.stations = stations;
            this.station  = station;

            link_store          = new LinkStore(station);
            view                = new NodeView(link_store);
            view.HeadersVisible = true;

            CellRendererToggle active_renderer = new CellRendererToggle();

            active_renderer.Activatable = true;
            active_renderer.Radio       = true;
            active_renderer.Toggled    += OnLinkToggled;

            view.AppendColumn(Catalog.GetString("Active"), active_renderer, ActiveDataFunc);
            view.AppendColumn(Catalog.GetString("Type"), new CellRendererText(), TypeDataFunc);
            view.AppendColumn(Catalog.GetString("Title"), EditTextRenderer(), "text", 1);
            view.AppendColumn(Catalog.GetString("URI"), EditTextRenderer(), "text", 2);
            view.Show();

            (glade["link_view_container"] as ScrolledWindow).Add(view);

            group_combo = ComboBoxEntry.NewText();
            group_combo.Show();
            (glade["group_combo_container"] as Box).PackStart(group_combo, true, true, 0);

            title_entry.Text       = station.Title == null ? String.Empty : station.Title;
            description_entry.Text = station.Description == null ? String.Empty : station.Description;
            group_combo.Entry.Text = station.Group == null ? String.Empty : station.Group;

            foreach (string group in stations.Groups)
            {
                group_combo.AppendText(group);
            }
        }
Beispiel #3
0
        private void SelIterCmb(ComboBoxEntry cmb, string itemtoselect)
        {
            Boolean  isSelected = false;
            TreeIter cmbiter;

            cmb.Model.GetIterFirst(out cmbiter);
            do
            {
                GLib.Value value = new GLib.Value();
                cmb.Model.GetValue(cmbiter, 0, ref value);
                if ((value.Val as string).Equals(itemtoselect, StringComparison.CurrentCultureIgnoreCase))
                {
                    cmb.SetActiveIter(cmbiter);
                    isSelected = true;
                }
            } while (cmb.Model.IterNext(ref cmbiter));
            if (!isSelected)
            {
                cmb.AppendText(itemtoselect);
                this.SelIterCmb(cmb, itemtoselect);
            }
        }
 private void SelIterCmb(ComboBoxEntry cmb, string itemtoselect)
 {
     Boolean isSelected = false;
     TreeIter cmbiter;
     cmb.Model.GetIterFirst (out cmbiter);
     do {
         GLib.Value value = new GLib.Value();
         cmb.Model.GetValue(cmbiter,0,ref value);
         if ((value.Val as string).Equals(itemtoselect, StringComparison.CurrentCultureIgnoreCase)){
             cmb.SetActiveIter(cmbiter);
             isSelected = true;
         }
     } while (cmb.Model.IterNext(ref cmbiter));
     if (!isSelected) {
         cmb.AppendText (itemtoselect);
         this.SelIterCmb (cmb, itemtoselect);
     }
 }
Beispiel #5
0
        public StationEditor (DatabaseTrackInfo track) : base()
        {
            AccelGroup accel_group = new AccelGroup ();
            AddAccelGroup (accel_group);

            Title = String.Empty;
            SkipTaskbarHint = true;
            Modal = true;

            this.track = track;

            string title = track == null
                ? Catalog.GetString ("Add new radio station")
                : Catalog.GetString ("Edit radio station");

            BorderWidth = 6;
            HasSeparator = false;
            DefaultResponse = ResponseType.Ok;
            Modal = true;

            VBox.Spacing = 6;

            HBox split_box = new HBox ();
            split_box.Spacing = 12;
            split_box.BorderWidth = 6;

            Image image = new Image ();
            image.IconSize = (int)IconSize.Dialog;
            image.IconName = "radio";
            image.Yalign = 0.0f;
            image.Show ();

            VBox main_box = new VBox ();
            main_box.BorderWidth = 5;
            main_box.Spacing = 10;

            Label header = new Label ();
            header.Markup = String.Format ("<big><b>{0}</b></big>", GLib.Markup.EscapeText (title));
            header.Xalign = 0.0f;
            header.Show ();

            Label message = new Label ();
            message.Text = Catalog.GetString ("Enter the Genre, Title and URL of the radio station you wish to add. A description is optional.");
            message.Xalign = 0.0f;
            message.Wrap = true;
            message.Show ();

            table = new Table (5, 2, false);
            table.RowSpacing = 6;
            table.ColumnSpacing = 6;

            genre_entry = ComboBoxEntry.NewText ();

            foreach (string genre in ServiceManager.DbConnection.QueryEnumerable<string> ("SELECT DISTINCT Genre FROM CoreTracks ORDER BY Genre")) {
                if (!String.IsNullOrEmpty (genre)) {
                    genre_entry.AppendText (genre);
                }
            }

            if (track != null && !String.IsNullOrEmpty (track.Genre)) {
                genre_entry.Entry.Text = track.Genre;
            }

            AddRow (Catalog.GetString ("Station Genre:"), genre_entry);

            name_entry        = AddEntryRow (Catalog.GetString ("Station Name:"));
            stream_entry      = AddEntryRow (Catalog.GetString ("Stream URL:"));
            creator_entry     = AddEntryRow (Catalog.GetString ("Station Creator:"));
            description_entry = AddEntryRow (Catalog.GetString ("Description:"));

            rating_entry = new RatingEntry ();
            HBox rating_box = new HBox ();
            rating_box.PackStart (rating_entry, false, false, 0);
            AddRow (Catalog.GetString ("Rating:"), rating_box);

            table.ShowAll ();

            main_box.PackStart (header, false, false, 0);
            main_box.PackStart (message, false, false, 0);
            main_box.PackStart (table, false, false, 0);
            main_box.Show ();

            split_box.PackStart (image, false, false, 0);
            split_box.PackStart (main_box, true, true, 0);
            split_box.Show ();

            VBox.PackStart (split_box, true, true, 0);

            Button cancel_button = new Button (Stock.Cancel);
            cancel_button.CanDefault = false;
            cancel_button.UseStock = true;
            cancel_button.Show ();
            AddActionWidget (cancel_button, ResponseType.Close);

            cancel_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Escape,
                0, Gtk.AccelFlags.Visible);

            save_button = new Button (Stock.Save);
            save_button.CanDefault = true;
            save_button.UseStock = true;
            save_button.Sensitive = false;
            save_button.Show ();
            AddActionWidget (save_button, ResponseType.Ok);

            save_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Return,
                0, Gtk.AccelFlags.Visible);

            name_entry.HasFocus = true;

            if (track != null) {
                if (!String.IsNullOrEmpty (track.TrackTitle)) {
                    name_entry.Text = track.TrackTitle;
                }

                if (!String.IsNullOrEmpty (track.Uri.AbsoluteUri)) {
                    stream_entry.Text = track.Uri.AbsoluteUri;
                }

                if (!String.IsNullOrEmpty (track.Comment)) {
                    description_entry.Text = track.Comment;
                }

                if (!String.IsNullOrEmpty (track.ArtistName)) {
                    creator_entry.Text = track.ArtistName;
                }

                rating_entry.Value = track.Rating;
            }

            error_container = new Alignment (0.0f, 0.0f, 1.0f, 1.0f);
            error_container.TopPadding = 6;
            HBox error_box = new HBox ();
            error_box.Spacing = 4;

            Image error_image = new Image ();
            error_image.Stock = Stock.DialogError;
            error_image.IconSize = (int)IconSize.Menu;
            error_image.Show ();

            error = new Label ();
            error.Xalign = 0.0f;
            error.Show ();

            error_box.PackStart (error_image, false, false, 0);
            error_box.PackStart (error, true, true, 0);
            error_box.Show ();

            error_container.Add (error_box);

            table.Attach (error_container, 0, 2, 4, 5, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            genre_entry.Entry.Changed += OnFieldsChanged;
            name_entry.Changed += OnFieldsChanged;
            stream_entry.Changed += OnFieldsChanged;

            OnFieldsChanged (this, EventArgs.Empty);
        }
Beispiel #6
0
        public StationEditor(DatabaseTrackInfo track) : base()
        {
            AccelGroup accel_group = new AccelGroup();

            AddAccelGroup(accel_group);

            Title           = String.Empty;
            SkipTaskbarHint = true;
            Modal           = true;

            this.track = track;

            string title = track == null
                ? Catalog.GetString("Add new radio station")
                : Catalog.GetString("Edit radio station");

            BorderWidth     = 6;
            HasSeparator    = false;
            DefaultResponse = ResponseType.Ok;
            Modal           = true;

            VBox.Spacing = 6;

            HBox split_box = new HBox();

            split_box.Spacing     = 12;
            split_box.BorderWidth = 6;

            Image image = new Image();

            image.IconSize = (int)IconSize.Dialog;
            image.IconName = "radio";
            image.Yalign   = 0.0f;
            image.Show();

            VBox main_box = new VBox();

            main_box.BorderWidth = 5;
            main_box.Spacing     = 10;

            Label header = new Label();

            header.Markup = String.Format("<big><b>{0}</b></big>", GLib.Markup.EscapeText(title));
            header.Xalign = 0.0f;
            header.Show();

            Label message = new Label();

            message.Text   = Catalog.GetString("Enter the Genre, Title and URL of the radio station you wish to add. A description is optional.");
            message.Xalign = 0.0f;
            message.Wrap   = true;
            message.Show();

            table               = new Table(5, 2, false);
            table.RowSpacing    = 6;
            table.ColumnSpacing = 6;

            genre_entry = ComboBoxEntry.NewText();

            foreach (string genre in ServiceManager.DbConnection.QueryEnumerable <string> ("SELECT DISTINCT Genre FROM CoreTracks ORDER BY Genre"))
            {
                if (!String.IsNullOrEmpty(genre))
                {
                    genre_entry.AppendText(genre);
                }
            }

            if (track != null && !String.IsNullOrEmpty(track.Genre))
            {
                genre_entry.Entry.Text = track.Genre;
            }

            AddRow(Catalog.GetString("Station Genre:"), genre_entry);

            name_entry        = AddEntryRow(Catalog.GetString("Station Name:"));
            stream_entry      = AddEntryRow(Catalog.GetString("Stream URL:"));
            creator_entry     = AddEntryRow(Catalog.GetString("Station Creator:"));
            description_entry = AddEntryRow(Catalog.GetString("Description:"));

            rating_entry = new RatingEntry();
            HBox rating_box = new HBox();

            rating_box.PackStart(rating_entry, false, false, 0);
            AddRow(Catalog.GetString("Rating:"), rating_box);

            table.ShowAll();

            main_box.PackStart(header, false, false, 0);
            main_box.PackStart(message, false, false, 0);
            main_box.PackStart(table, false, false, 0);
            main_box.Show();

            split_box.PackStart(image, false, false, 0);
            split_box.PackStart(main_box, true, true, 0);
            split_box.Show();

            VBox.PackStart(split_box, true, true, 0);

            Button cancel_button = new Button(Stock.Cancel);

            cancel_button.CanDefault = false;
            cancel_button.UseStock   = true;
            cancel_button.Show();
            AddActionWidget(cancel_button, ResponseType.Close);

            cancel_button.AddAccelerator("activate", accel_group, (uint)Gdk.Key.Escape,
                                         0, Gtk.AccelFlags.Visible);

            save_button            = new Button(Stock.Save);
            save_button.CanDefault = true;
            save_button.UseStock   = true;
            save_button.Sensitive  = false;
            save_button.Show();
            AddActionWidget(save_button, ResponseType.Ok);

            save_button.AddAccelerator("activate", accel_group, (uint)Gdk.Key.Return,
                                       0, Gtk.AccelFlags.Visible);

            name_entry.HasFocus = true;

            if (track != null)
            {
                if (!String.IsNullOrEmpty(track.TrackTitle))
                {
                    name_entry.Text = track.TrackTitle;
                }

                if (!String.IsNullOrEmpty(track.Uri.AbsoluteUri))
                {
                    stream_entry.Text = track.Uri.AbsoluteUri;
                }

                if (!String.IsNullOrEmpty(track.Comment))
                {
                    description_entry.Text = track.Comment;
                }

                if (!String.IsNullOrEmpty(track.ArtistName))
                {
                    creator_entry.Text = track.ArtistName;
                }

                rating_entry.Value = track.Rating;
            }

            error_container            = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
            error_container.TopPadding = 6;
            HBox error_box = new HBox();

            error_box.Spacing = 4;

            Image error_image = new Image();

            error_image.Stock    = Stock.DialogError;
            error_image.IconSize = (int)IconSize.Menu;
            error_image.Show();

            error        = new Label();
            error.Xalign = 0.0f;
            error.Show();

            error_box.PackStart(error_image, false, false, 0);
            error_box.PackStart(error, true, true, 0);
            error_box.Show();

            error_container.Add(error_box);

            table.Attach(error_container, 0, 2, 4, 5, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            genre_entry.Entry.Changed += OnFieldsChanged;
            name_entry.Changed        += OnFieldsChanged;
            stream_entry.Changed      += OnFieldsChanged;

            OnFieldsChanged(this, EventArgs.Empty);
        }
Beispiel #7
0
        /// <summary>
        /// Wire controls to viewmodels (etc).
        /// </summary>
        void SetupBindings()
        {
            cmbEdgeStyle.Changed += (s, e) => TheVM.TheDocument.EdgeStyle = cmbEdgeStyle.ActiveText;
            cmbNodeStyle.Changed += (s, e) => TheVM.TheDocument.NodeStyle = cmbNodeStyle.ActiveText;
            // todo!!
            cmbEdgeStyle.PopupMenu += (s, e) => { cmbEdgeStyle.Clear(); TheVM.TheDocument.TikzStyles.Each((s2, i) => cmbEdgeStyle.AppendText(s2)); };
            cmbNodeStyle.PopupMenu += (s, e) => { cmbNodeStyle.Clear(); TheVM.TheDocument.TikzStyles.Each((s2, i) => cmbNodeStyle.AppendText(s2)); };


            /*splitContainer2.Panel2.ClientSizeChanged += new EventHandler(Panel2_Resize);
             *
             * //rasterControl1.Resize += new EventHandler(Panel2_Resize);
             * rasterControl1.SizeChanged += new EventHandler(Panel2_Resize);
             * rasterControl1.MouseMove += new MouseEventHandler(rasterControl1_MouseMove);
             * rasterControl1.MouseWheel += new MouseEventHandler(rasterControl1_MouseWheel);
             *
             * rasterControl1.JumpToSource += new EventHandler<RasterControl.JumpToSourceEventArgs>(rasterControl1_JumpToSource);
             * rasterControl1.ReplaceText += new EventHandler<TikzEdt.Overlay.ReplaceTextEventArgs>(rasterControl1_ReplaceText);
             *
             *
             *
             *
             * dynamicPreamble.PreambleChanged += (s, e) => TheVM.DynamicPreamble = dynamicPreamble.Preamble;
             * TheVM.DynamicPreamble = dynamicPreamble.Preamble;
             *
             * //TheVM.NewCommandHandler(this, new System.Windows.Input.ExecutedRoutedEventArgs()) ;
             *
             *
             * // add bindings
             * rasterControl1.DataBindings.Add("ShowOverlay", cmdShowOverlay, "Checked");
             * rasterControl1.DataBindings.Add("UsePolarCoordinates", chkUsePolar, "Checked");
             *
             * // Note that the TheDocument.Document property is bound "automatically" by the hack described in the TextEditorDocumentWrapper class.
             * var sp = BindingFactory.CreateProvider(TheVM, "TheDocument", vm => vm.TheDocument);
             * BindingFactory.CreateBindingSP(sp, "ParseTree", doc => rasterControl1.ParseTree = doc.ParseTree, () => rasterControl1.ParseTree = null);
             *
             * BindingFactory.CreateBindingSP(sp, "PdfPath", doc => rasterControl1.PdfPath = doc.PdfPath, () => rasterControl1.PdfPath = "");
             * BindingFactory.CreateBindingSP(sp, "ReloadPdf", doc => rasterControl1.ReloadPdf = doc.ReloadPdf, null);
             * BindingFactory.CreateBindingSP(sp, "Resolution", doc => rasterControl1.Resolution = doc.Resolution, null);
             * BindingFactory.CreateBindingSP(sp, "CurrentBB", doc => rasterControl1.BB = doc.CurrentBB, null);
             * BindingFactory.CreateBindingSP(sp, "AllowEditing", doc => rasterControl1.AllowEditing = doc.AllowEditing, null);
             * BindingFactory.CreateBindingSP(sp, "EdgeStyle", doc => rasterControl1.EdgeStyle = doc.EdgeStyle, null);
             * BindingFactory.CreateBindingSP(sp, "NodeStyle", doc => rasterControl1.NodeStyle = doc.NodeStyle, null);
             * BindingFactory.CreateBindingSP(sp, "Resolution", doc => toolStripZoomCtrlItem1.ZoomCtrl.Value = Convert.ToInt32(doc.Resolution), null);
             * toolStripZoomCtrlItem1.ZoomCtrl.ValueChanged += (s, e) => TheVM.TheDocument.Resolution = toolStripZoomCtrlItem1.ZoomCtrl.Value;
             * BindingFactory.CreateBindingSP(sp, "DisplayString", doc => this.Text = "TikzEdt - " + doc.DisplayString, () => this.Text = "TikzEdt");
             * BindingFactory.CreateBindingSP(sp, "IsStandAlone", doc => lblStandAlone.Visible = doc.IsStandAlone, () => lblStandAlone.Visible = false);
             *
             *
             * BindingFactory.CreateBinding(TheVM, "RasterRadialOffset", vm =>
             * { txtRadialOffset.TextBox.Text = vm.RasterRadialOffset.ToString(); rasterControl1.RadialOffset = vm.RasterRadialOffset; }, null);
             * BindingFactory.CreateBinding(TheVM, "RasterSteps", vm =>
             * { txtRadialSteps.TextBox.Text = vm.RasterSteps.ToString(); rasterControl1.RasterRadialSteps = (uint)vm.RasterSteps; }, null);
             * BindingFactory.CreateBinding(TheVM, "RasterWidth", vm =>
             * { cmbGrid.ComboBox.Text = vm.RasterWidth.ToString(); rasterControl1.RasterWidth = vm.RasterWidth; }, null);
             * txtRadialOffset.TextChanged += (s, e) =>
             * {
             *  double d;
             *  if (Double.TryParse(txtRadialOffset.TextBox.Text, out d))
             *      TheVM.RasterRadialOffset = d;
             * };
             * txtRadialSteps.TextChanged += (s, e) =>
             * {
             *  uint d;
             *  if (UInt32.TryParse(txtRadialSteps.TextBox.Text, out d))
             *      TheVM.RasterSteps = (int)d;
             * };
             * cmbGrid.ComboBox.TextChanged += (s, e) =>
             * {
             *  double d;
             *  if (Double.TryParse(cmbGrid.ComboBox.Text, out d))
             *      TheVM.RasterWidth = d;
             * };
             *
             * rasterControl1.ToolChanged += (sender, e) => TheVM.CurrentTool = rasterControl1.Tool;
             *
             * BindingFactory.CreateBinding(TheVM, "EditorMode", vm =>
             * {
             *  wYSIWYGToolStripMenuItem.Checked = vm.EditorMode == TEMode.Wysiwyg;
             *  productionToolStripMenuItem.Checked = vm.EditorMode == TEMode.Production;
             *  previewToolStripMenuItem.Checked = vm.EditorMode == TEMode.Preview;
             * }, null);
             *
             * var errlistsp = BindingFactory.CreateProviderSP(sp, "TexErrors", doc => doc.TexErrors);
             * BindingFactory.CreateCollectionBindingSP(errlistsp, (s, e) => FillErrorsList());
             *
             * BindingFactory.CreateBinding(TheVM, "CurrentTool",
             *  vm =>
             *  {
             *      ToolButtons.Each((tsb, i) => tsb.Checked = ((int)vm.CurrentTool == i));
             *      rasterControl1.Tool = vm.CurrentTool;
             *  }, null);
             *
             * BindingFactory.CreateBinding(TheCompiler.Instance, "Compiling",
             *  (c) => { cmdAbortCompile.Enabled = abortCompilationToolStripMenuItem.Enabled = c.Compiling; },
             *  () => { cmdAbortCompile.Enabled = abortCompilationToolStripMenuItem.Enabled = true; });
             *
             *
             * // load settings
             * var S = Properties.Settings.Default;
             * Width = S.Window_Width;
             * Height = S.Window_Height;
             * SizeChanged += (s, e) => { Properties.Settings.Default.Window_Height = Height; Properties.Settings.Default.Window_Width = Width; };
             *
             * this.Left = S.Window_Left;
             * this.Top = S.Window_Top;
             * LocationChanged += (s, e) => { Properties.Settings.Default.Window_Top = Top; Properties.Settings.Default.Window_Left = Left; };
             *
             * WindowState = S.Window_State;
             * ClientSizeChanged += (s, e) => Properties.Settings.Default.Window_State = this.WindowState;
             *
             * try
             * {
             *  splitContainer2.SplitterDistance = S.OverlayCanvasCol2WidthSetting;
             *  splitContainer1.SplitterDistance = S.LeftToolsColWidthSetting;
             * }
             * catch (Exception) { }
             * splitContainer2.SplitterMoved += (s, e) => Properties.Settings.Default.OverlayCanvasCol2WidthSetting = splitContainer2.SplitterDistance;
             * splitContainer1.SplitterMoved += (s, e) => Properties.Settings.Default.LeftToolsColWidthSetting = splitContainer1.SplitterDistance;
             *
             * BindingFactory.CreateBinding(S, "Editor_ShowLineNumbers", s => txtCode.ShowLineNumbers = s.Editor_ShowLineNumbers, null);
             * BindingFactory.CreateBinding(S, "Editor_Font", s => txtCode.Font = s.Editor_Font, null);
             * BindingFactory.CreateBinding(S, "Snippets_ShowThumbs", s => snippetList1.ShowThumbnails = s.Snippets_ShowThumbs, null);
             *
             * BindingFactory.CreateBinding(S, "Snippets_ShowThumbs", s =>
             * {
             *  autoCompilationOnChangeToolStripMenuItem.Checked = s.AutoCompileOnDocumentChange;
             *  TheVM.AutoCompileOnDocumentChange = s.AutoCompileOnDocumentChange;
             * }, null);
             * autoCompilationOnChangeToolStripMenuItem.CheckedChanged += (s, e) =>
             * {
             *  S.AutoCompileOnDocumentChange = TheVM.AutoCompileOnDocumentChange = autoCompilationOnChangeToolStripMenuItem.Checked;
             * };*/

            // Note that the TheDocument.Document property is bound "automatically" by the hack described in the TextEditorDocumentWrapper class.
            var sp = BindingFactory.CreateProvider(TheVM, "TheDocument", vm => vm.TheDocument);

            BindingFactory.CreateBindingSP(sp, "ParseTree", doc => rasterControl1.ParseTree = doc.ParseTree, () => rasterControl1.ParseTree = null);

            BindingFactory.CreateBindingSP(sp, "PdfPath", doc => rasterControl1.PdfPath           = doc.PdfPath, () => rasterControl1.PdfPath = "");
            BindingFactory.CreateBindingSP(sp, "ReloadPdf", doc => rasterControl1.ReloadPdf       = doc.ReloadPdf, null);
            BindingFactory.CreateBindingSP(sp, "Resolution", doc => rasterControl1.Resolution     = doc.Resolution, null);
            BindingFactory.CreateBindingSP(sp, "CurrentBB", doc => rasterControl1.BB              = doc.CurrentBB, null);
            BindingFactory.CreateBindingSP(sp, "AllowEditing", doc => rasterControl1.AllowEditing = doc.AllowEditing, null);
            BindingFactory.CreateBindingSP(sp, "EdgeStyle", doc => rasterControl1.EdgeStyle       = doc.EdgeStyle, null);
            BindingFactory.CreateBindingSP(sp, "NodeStyle", doc => rasterControl1.NodeStyle       = doc.NodeStyle, null);
            BindingFactory.CreateBindingSP(sp, "Resolution", doc => scZoom.Value = Convert.ToInt32(doc.Resolution), null);
            scZoom.ValueChanged += (s, e) => TheVM.TheDocument.Resolution = scZoom.Value;
            BindingFactory.CreateBindingSP(sp, "DisplayString", doc => this.Title           = "TikzEdt - " + doc.DisplayString, () => this.Title = "TikzEdt");
            BindingFactory.CreateBindingSP(sp, "IsStandAlone", doc => lblStandAlone.Visible = doc.IsStandAlone, () => lblStandAlone.Visible = false);


            BindingFactory.CreateBinding(TheVM, "RasterRadialOffset", vm =>
                                         { txtRadialOffset.Value = vm.RasterRadialOffset; rasterControl1.RadialOffset = vm.RasterRadialOffset; }, null);
            BindingFactory.CreateBinding(TheVM, "RasterSteps", vm =>
                                         { txtRadialSteps.Value = vm.RasterSteps; rasterControl1.RasterRadialSteps = (uint)vm.RasterSteps; }, null);
            BindingFactory.CreateBinding(TheVM, "RasterWidth", vm =>
                                         { cmbGrid.Entry.Text = vm.RasterWidth.ToString(); rasterControl1.RasterWidth = vm.RasterWidth; }, null);
            txtRadialOffset.ValueChanged += (s, e) =>
            {
                //double d;
                //if (Double.TryParse(txtRadialOffset.TextBox.Text, out d))
                TheVM.RasterRadialOffset = txtRadialOffset.Value;
            };
            txtRadialSteps.ValueChanged += (s, e) =>
            {
                //uint d;
                //if (UInt32.TryParse(txtRadialSteps.TextBox.Text, out d))
                TheVM.RasterSteps = txtRadialSteps.ValueAsInt;
            };
            cmbGrid.Changed += (s, e) =>
            {
                double d;
                if (Double.TryParse(cmbGrid.ActiveText, out d))
                {
                    TheVM.RasterWidth = d;
                }
            };

            rasterControl1.ToolChanged += (sender, e) => TheVM.CurrentTool = rasterControl1.Tool;

            BindingFactory.CreateBinding(TheVM, "CurrentTool",
                                         vm =>
            {
                ToolButtons.Each((tsb, i) => tsb.SetChecked((int)vm.CurrentTool == i));
                rasterControl1.Tool = vm.CurrentTool;
            }, null);

            BindingFactory.CreateBinding(TheCompiler.Instance, "Compiling",
                                         (c) => { cmdAbortCompile.Sensitive = abortCompilationToolStripMenuItem.Sensitive = c.Compiling; },
                                         () => { cmdAbortCompile.Sensitive = abortCompilationToolStripMenuItem.Sensitive = true; });
        }
Beispiel #8
0
    private void OnSignupEvent(Hashtable form)
    {
        if (((string)form["action"]).Equals("msg"))
        {
            new AlertDialog(this.MainWindow, AlertType.Info,
                            (string)form["title"],
                            (string)form["msg"]);
        }
        else
        {
            this.signupdata = form;

            Dialog dlg = new Dialog();
            dlg.Modal = true;
            dlg.Title = (string)form["title"];
            dlg.SetSizeRequest(500, -1);

            HBox split = new HBox();
            dlg.VBox.Add(split);
            VBox left  = new VBox(true, 0);
            VBox right = new VBox(true, 0);
            split.PackStart(left, false, false, 5);
            split.PackEnd(right, true, true, 10);

            NameValueCollection fields =
                (NameValueCollection)form["fields"];
            Hashtable data = (Hashtable)form["data"];

            foreach (string Key in fields.AllKeys)
            {
                Hashtable fd = (Hashtable)data[Key];

                string Name = Key.Substring(0, 1).ToUpper() +
                              Key.Substring(1) + ":";

                Label lbl = new Label(Name);
                lbl.SetAlignment(0, (float)0.5);
                left.PackStart(lbl, false, false, 5);

                if (fields[Key].Equals("TextEditView"))
                {
                    Entry ent = new Entry();
                    ent.Name             = Key;
                    ent.ActivatesDefault = true;
                    if (fd["isPassword"] != null)
                    {
                        ent.Visibility = false;
                    }
                    if (fd["value"] != null)
                    {
                        ent.Text = (string)fd["value"];
                    }
                    right.PackStart(ent, false, false, 5);
                }
                else if (fields[Key].Equals("PopupButtonView"))
                {
                    ComboBox cbox = ComboBox.NewText();
                    cbox.WrapWidth = 5;
                    cbox.Name      = Key;
                    if (fd["menuItems"] != null)
                    {
                        string menuItems = (string)fd["menuItems"];
                        foreach (string Value in menuItems.Split(','))
                        {
                            cbox.AppendText(Value);
                        }
                        if (fd["value"] != null &&
                            (string)fd["value"] != String.Empty)
                        {
                            cbox.Active = Convert.ToInt32(fd["value"]) - 1;
                        }
                        else
                        {
                            cbox.Active = 0;
                        }
                    }
                    right.PackStart(cbox, false, false, 5);
                }
                else if (fields[Key].Equals("ComboControlView"))
                {
                    ComboBoxEntry cboxe = ComboBoxEntry.NewText();
                    cboxe.WrapWidth = 5;
                    cboxe.Name      = Key;
                    if (fd["menuItems"] != null)
                    {
                        string menuItems = (string)fd["menuItems"];
                        foreach (string Value in menuItems.Split(','))
                        {
                            cboxe.AppendText(Value);
                        }
                    }
                    if (fd["value"] != null)
                    {
                        ((Entry)cboxe.Child).Text = (string)fd["value"];
                    }
                    right.PackStart(cboxe, false, false, 5);
                }
                else if (fields[Key].Equals("CheckboxView"))
                {
                    CheckButton cbtn = new CheckButton();
                    cbtn.Name = Key;
                    if (fd["value"] != null &&
                        (string)fd["value"] != String.Empty)
                    {
                        int v = Convert.ToInt32((string)fd["value"]);
                        cbtn.Active = v == 1;
                    }
                    right.PackStart(cbtn, false, false, 5);
                }
            }

            dlg.AddActionWidget(new Button("Cancel"),
                                ResponseType.Cancel);

            Button btn = new Button("Next");
            btn.CanDefault = true;
            dlg.AddActionWidget(btn, ResponseType.Ok);

            dlg.DefaultResponse = ResponseType.Ok;
            dlg.Response       += new ResponseHandler(OnSignupResponse);

            dlg.TransientFor = this.MainWindow;
            dlg.SetPosition(WindowPosition.CenterOnParent);

            dlg.ShowAll();

            if (form["redtext"] != null)
            {
                new AlertDialog(dlg, AlertType.Warning,
                                (string)form["title"],
                                (string)form["redtext"]);
            }
        }
    }
        public StationDialog(Stations stations, Station station)
        {
            glade = new Glade.XML(null, "radio.glade", "StationDialog", "banshee");
            glade.Autoconnect(this);
            dialog = (Dialog)glade.GetWidget("StationDialog");
            Banshee.Base.IconThemeUtils.SetWindowIcon(dialog);

            if(station == null) {
                is_new = true;
                station = new Station();
            }

            this.stations = stations;
            this.station = station;

            link_store = new LinkStore(station);
            view = new NodeView(link_store);
            view.HeadersVisible = true;

            CellRendererToggle active_renderer = new CellRendererToggle();
            active_renderer.Activatable = true;
            active_renderer.Radio = true;
            active_renderer.Toggled += OnLinkToggled;

            view.AppendColumn(Catalog.GetString("Active"), active_renderer, ActiveDataFunc);
            view.AppendColumn(Catalog.GetString("Type"), new CellRendererText(), TypeDataFunc);
            view.AppendColumn(Catalog.GetString("Title"), EditTextRenderer(), "text", 1);
            view.AppendColumn(Catalog.GetString("URI"), EditTextRenderer(), "text", 2);
            view.Show();

            (glade["link_view_container"] as ScrolledWindow).Add(view);

            group_combo = ComboBoxEntry.NewText();
            group_combo.Show();
            (glade["group_combo_container"] as Box).PackStart(group_combo, true, true, 0);

            title_entry.Text = station.Title == null ? String.Empty : station.Title;
            description_entry.Text = station.Description == null ? String.Empty : station.Description;
            group_combo.Entry.Text = station.Group == null ? String.Empty : station.Group;

            foreach(string group in stations.Groups) {
                group_combo.AppendText(group);
            }
        }