Exemple #1
0
        public void BindActor()
        {
            fActorStore = new ListStore(typeof(int), typeof(string));
            cbActor.Clear();
            foreach (DataRow row in ActorSource.Tables["Actor"].Rows)
            {
                fActorStore.AppendValues((int)row["ID"], (string)row["Name"]);
            }

            cbActor.Model = fActorStore;
            CellRendererText actorText = new CellRendererText();

            actorText.Style = Pango.Style.Oblique;

            //actorText.BackgroundGdk = new Gdk.Color(0x63,0,0);
            cbActor.PackStart(actorText, true);
            cbActor.AddAttribute(actorText, "text", 1);
            TreeIter iter;

            if (fActorStore.GetIterFirst(out iter))
            {
                cbActor.SetActiveIter(iter);
                fActorID = (int)ActorSource.Tables["Actor"].Rows[0]["ID"];
            }
        }
        public void BindStateOut()
        {
            if (TaskStateSource != null)
            {
                fStateOutStore = new ListStore(typeof(int), typeof(string));
                cbStateOut.Clear();
                foreach (DataRow row in TaskStateSource.Tables["TaskState"].Rows)
                {
                    fStateOutStore.AppendValues((int)row["ID"], (string)row["Name"]);
                }

                cbStateOut.Model = fStateOutStore;
                CellRendererText stateText = new CellRendererText();
                stateText.Style = Pango.Style.Oblique;
                cbStateOut.PackStart(stateText, true);
                cbStateOut.AddAttribute(stateText, "text", 1);
                TreeIter iter;
                if (fStateOutStore.GetIterFirst(out iter))
                {
                    cbStateOut.SetActiveIter(iter);
                }
            }
            else
            {
                throw new ManagementException(ExceptionType.NotAllowed, "TaskStateSource not set to instance");
            }
        }
Exemple #3
0
        public void BindState()
        {
            fStateStore = new ListStore(typeof(int), typeof(string));
            cbState.Clear();
            foreach (DataRow row in StateSource.Tables["TaskState"].Rows)
            {
                fStateStore.AppendValues((int)row["ID"], (string)row["Name"]);
            }

            cbState.Model = fStateStore;
            CellRendererText stateText = new CellRendererText();

            cbState.PackStart(stateText, true);
            cbState.AddAttribute(stateText, "text", 1);
            TreeIter iter;

            if (fStateStore.GetIterFirst(out iter))
            {
                cbState.SetActiveIter(iter);
                fStateID = (int)StateSource.Tables["TaskState"].Rows[0]["ID"];
            }
        }
Exemple #4
0
        void PopulateHostEntry()
        {
            var devs   = Env.Discovery.Devices;
            var active = hostEntry.ActiveText;

            hostEntry.Clear();
            var cell = new CellRendererText();

            hostEntry.PackStart(cell, false);
            hostEntry.AddAttribute(cell, "text", 0);
            hostEntry.TextColumn = 0;
            var store = new ListStore(typeof(string));

            if (!string.IsNullOrWhiteSpace(active) && !devs.Contains(active))
            {
                store.AppendValues(active);
            }
            store.AppendValues(devs);

            hostEntry.Model = store;
            Console.WriteLine(devs);
        }
Exemple #5
0
        public ConnectDialog() : base(Gui.MainWindow.Window, "ConnectDialog")
        {
            store              = new ListStore(typeof(object), typeof(string));
            ipCombo.Model      = store;
            ipCombo.TextColumn = 1;

            CellRendererPixbuf imageCell = new CellRendererPixbuf();
            CellRendererText   textCell  = new CellRendererText();

            ipCombo.Clear();
            ipCombo.PackStart(imageCell, false);
            ipCombo.PackStart(textCell, true);
            ipCombo.SetCellDataFunc(imageCell, ShowImage);
            ipCombo.SetCellDataFunc(textCell, ShowText);
            ipCombo.WrapWidth = 3;
            ipCombo.Entry.ActivatesDefault = true;
            PopulateAddressCombo();

            networksListStore = new ListStore(typeof(object));
            networksListStore.AppendValues(new object());
            foreach (Network network in Runtime.Core.Networks)
            {
                networksListStore.AppendValues(network);
            }

            networksComboBox.Clear();

            CellRendererText networkNameCell = new CellRendererText();

            networksComboBox.PackStart(networkNameCell, false);
            networksComboBox.SetCellDataFunc(networkNameCell, new CellLayoutDataFunc(NetworkTextFunc));
            networksComboBox.Model    = networksListStore;
            networksComboBox.Changed += delegate { PopulateAddressCombo(); };
            networksComboBox.Active   = Math.Min(networksListStore.IterNChildren(), 1);

            notImage   = Gui.LoadIcon(16, "dialog-warning");
            localImage = Gui.LoadIcon(16, "stock_channel");
        }
Exemple #6
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; });
        }