示例#1
0
    private void NoteTitleEdited(object o, Gtk.EditedArgs args)
    {
        Logger.Write("edited");
        NoteTreeNode node = store.GetNode(new TreePath(args.Path)) as NoteTreeNode;
        Note         note = node.GetNote();

        note.title = args.NewText;
        clientActivated.UpdateRecord(note);
    }
示例#2
0
        public ITreeNode GetNodeAtPos(int x, int y)
        {
            Gtk.TreePath nodePath;
            ITreeNode    node = null;

            if (this.GetPathAtPos(x, y, out nodePath))
            {
                node = store.GetNode(nodePath);
            }

            return(node);
        }
        public void NativeCallback(IntPtr tree_column, IntPtr cell, IntPtr tree_model, IntPtr iter_ptr, IntPtr data)
        {
            TreeViewColumn col      = (Gtk.TreeViewColumn)GLib.Object.GetObject(tree_column);
            CellRenderer   renderer = (Gtk.CellRenderer)GLib.Object.GetObject(cell);
            NodeStore      store    = (NodeStore)GLib.Object.GetObject(tree_model);
            TreeIter       iter     = TreeIter.New(iter_ptr);

            managed(col, renderer, store.GetNode(iter));
        }
        public MeadowDeviceExecutionTarget GetSelection()
        {
            TreePath       treePath;
            TreeViewColumn treeViewColumn;

            nodeview1.GetCursor(out treePath, out treeViewColumn);
            var node = (MyTreeNode)Store.GetNode(treePath);

            return(node.Target);
        }
示例#5
0
        void OnRingToggled(object sender, ToggledArgs e)
        {
            RingTreeNode node = _ringStore.GetNode(new Gtk.TreePath(e.Path)) as RingTreeNode;

            node.IsChecked = !node.IsChecked;
            if (node.IsChecked)
            {
                _info.Rings |= node.RingValue;
            }
            else
            {
                _info.Rings ^= node.RingValue;
            }
        }
示例#6
0
        private void SetIOInfo()
        {
            //set columns in input and output views
            Gtk.NodeStore inputStore  = new Gtk.NodeStore(typeof(IOItemNode));
            Gtk.NodeStore outputStore = new Gtk.NodeStore(typeof(IOItemNode));

            Gtk.CellRendererText textRenderer = new Gtk.CellRendererText();

            //inputs
            TreeViewColumn mappedToColumn = CreateInputMappingColumnWithComboBox(inputStore);

            this.inputView.AppendColumn("Input", textRenderer, "text", 0);
            this.inputView.AppendColumn(mappedToColumn);
            this.inputView.AppendColumn("Type", textRenderer, "text", 2);

            //outputs
            Gtk.CellRendererText editableTextRenderer = new CellRendererText();
            editableTextRenderer.Editable = true;
            editableTextRenderer.Edited  += delegate(object o, EditedArgs args) {
                IOItemNode n = (IOItemNode)outputStore.GetNode(new TreePath(args.Path));
                n.MappedTo = args.NewText;
            };

            this.outputView.AppendColumn("Output", textRenderer, "text", 0);
            this.outputView.AppendColumn("Output as", editableTextRenderer, "text", 1);
            this.outputView.AppendColumn("Type", textRenderer, "text", 2);

            //prepare input and output store
            foreach (IOItem item in m_metadata.IOSpec.Input.Values)
            {
                inputStore.AddNode(new IOItemNode(item));
            }

            foreach (IOItem item in m_metadata.IOSpec.Output.Values)
            {
                outputStore.AddNode(new IOItemNode(item));
            }

            inputView.NodeStore  = inputStore;
            outputView.NodeStore = outputStore;
        }
示例#7
0
        private void SetOutputInfo(bool isEditable)
        {
            if (m_metadata.IOSpec.Output.Count > 0)
            {
                //set columns in input and output views
                Gtk.NodeStore outputStore = new Gtk.NodeStore(typeof(IOItemNode));

                Gtk.CellRendererText textRenderer = new Gtk.CellRendererText();

                Gtk.CellRendererText editableTextRenderer = new CellRendererText();
                editableTextRenderer.Editable = isEditable;
                editableTextRenderer.Edited  += delegate(object o, EditedArgs args) {
                    IOItemNode n = (IOItemNode)outputStore.GetNode(new TreePath(args.Path));
                    n.MappedTo = args.NewText;
                    RefreshIOHighlightInExperiment(n.MappedTo);
                };

                this.outputView.AppendColumn("Output", textRenderer, "text", 0);
                this.outputView.AppendColumn("Output as", editableTextRenderer, "text", 1);
                this.outputView.AppendColumn("Type", textRenderer, "text", 2);

                foreach (IOItem item in m_metadata.IOSpec.Output.Values)
                {
                    outputStore.AddNode(new IOItemNode(item));
                }

                outputView.NodeStore = outputStore;

                //disables/enables the controls
                outputView.Sensitive = isEditable;

                outputView.HoverSelection         = true;
                outputView.NodeSelection.Changed += SelectionHandleChanged;
            }
            else
            {
                outputView.Visible = false;
            }
        }
示例#8
0
        // END HERZUM BUG FIX: alignment input-output TLAB-255
        private void SetOutputInfo(bool isEditable)
        {
            if (m_metadata.IOSpec.Output.Count > 0)
            {
                //set columns in input and output views
                Gtk.NodeStore        outputStore  = new Gtk.NodeStore(typeof(IOItemNode));
                Gtk.CellRendererText textRenderer = new Gtk.CellRendererText();

                Gtk.CellRendererText editableTextRenderer = new CellRendererText();
                editableTextRenderer.Editable = isEditable;
                editableTextRenderer.Edited  += delegate(object o, EditedArgs args) {
                    IOItemNode n = (IOItemNode)outputStore.GetNode(new TreePath(args.Path));
                    n.MappedTo = args.NewText;
                    RefreshIOHighlightInExperiment(n.MappedTo);
                };

                // HERZUM SPRINT 4.2: TLAB-226
                //textRenderer.CellBackground = "grey";
                // HERZUM SPRINT 5: TLAB-242
                Gdk.Color colorBack = new  Gdk.Color(245, 245, 245);
                textRenderer.CellBackgroundGdk = colorBack;
                // END HERZUM SPRINT 5: TLAB-242
                // END HERZUM SPRINT 4.2: TLAB-226

                // HERZUM BUG FIX: alignment input-output TLAB-255
                //HERZUM SPRINT 5.4 TLAB-241
                t_Output           = this.outputView.AppendColumn(Convert.ToChar(171) + " Output", textRenderer, "text", 0);
                t_Output.Resizable = true;
                //END HERZUM SPRINT 5.4 TLAB-241
                t_OutputAs             = this.outputView.AppendColumn("Output as", editableTextRenderer, "text", 1);
                t_OutputAs.Resizable   = true;
                t_OutputType           = this.outputView.AppendColumn("Type", textRenderer, "text", 2);
                t_OutputType.Resizable = true;
                // END HERZUM BUG FIX: alignment input-output TLAB-255

                int currentLengthOutput;
                int currentLengthOutputAs;
                foreach (IOItem item in m_metadata.IOSpec.Output.Values)
                {
                    outputStore.AddNode(new IOItemNode(item));
                    // HERZUM BUG FIX: alignment input-output TLAB-255
                    currentLengthOutput   = item.IOItemDefinition.Name.Length;
                    currentLengthOutputAs = item.MappedTo.Length;
                    if (currentLengthOutput > maxLengthOutput)
                    {
                        maxLengthOutput = currentLengthOutput;
                    }
                    if (currentLengthOutputAs > maxLengthOutputAs)
                    {
                        maxLengthOutputAs = currentLengthOutputAs;
                    }
                    // END HERZUM BUG FIX: alignment input-output TLAB-255
                }

                outputView.NodeStore = outputStore;

                //disables/enables the controls
                outputView.Sensitive = isEditable;

                outputView.HoverSelection         = true;
                outputView.NodeSelection.Changed += SelectionHandleChanged;
            }
            else
            {
                outputView.Visible = false;
            }
        }
        /// <summary>
        /// Creates the input mapping column with combo box.
        /// TODO improve the input mapping combo box:
        /// 1. it doesn't set values until combo box loses focus within table view confirm change - Edited event is raised only then
        /// 2. there is no indication that the field can be modified - render combo box always, OR show some icon that it can be modified
        /// </summary>
        /// <returns>
        /// The input mapping column with combo box.
        /// </returns>
        /// <param name='inputStore'>
        /// Input store.
        /// </param>
        private TreeViewColumn CreateInputMappingColumnWithComboBox(NodeStore inputStore, string columntTitle)
        {
            Gtk.CellRendererCombo comboRenderer = new Gtk.CellRendererCombo();
            
            comboRenderer.HasEntry = false;
            comboRenderer.Mode = CellRendererMode.Editable;
            comboRenderer.TextColumn = 0;
            comboRenderer.Editable = true;

            ListStore comboBoxStore = new ListStore (typeof(string));
            comboRenderer.Model = comboBoxStore;

            //when user activates combo box, refresh combobox store with available input mapping per node
            comboRenderer.EditingStarted += delegate (object o, EditingStartedArgs args) 
            {
                comboBoxStore.Clear ();
                IOItemNode currentItem = (IOItemNode)inputStore.GetNode (new TreePath (args.Path));
                ExperimentNode currentNode = m_component.ExperimentNode;
                string currentType = currentItem.Type;
                InputMappings availableInputMappingsPerNode = new InputMappings (currentNode.Owner);
                if (currentNode != null && availableInputMappingsPerNode.ContainsMappingsForNode (currentNode)) {
                    foreach (string incomingOutput in availableInputMappingsPerNode [currentNode].Keys) {
                        if (string.Equals (currentType, availableInputMappingsPerNode [currentNode] [incomingOutput])) {
                            comboBoxStore.AppendValues (Mono.Unix.Catalog.GetString (incomingOutput));
                        }
                    }
                }
            };

            //when edition has been completed set current item node with proper mapping
            comboRenderer.Edited += delegate (object o, EditedArgs args) {
                IOItemNode n = (IOItemNode)inputStore.GetNode (new TreePath (args.Path));
                n.MappedTo = args.NewText;
                RefreshIOHighlightInExperiment(n.MappedTo);
            };

            //finally create the column with above combo renderer
            var mappedToColumn = new TreeViewColumn ();
            mappedToColumn.Title = columntTitle;
            mappedToColumn.PackStart (comboRenderer, true);

            //this method sets the text view to current mapping, when combo box is not active
            mappedToColumn.SetCellDataFunc (comboRenderer, delegate (TreeViewColumn tree_column, CellRenderer cell, ITreeNode node) {
                IOItemNode currentItem = (IOItemNode)node;
                comboRenderer.Text = currentItem.MappedTo;
            });

            return mappedToColumn;
        }
        private void SetOutputInfo(bool isEditable) 
        {
            if(m_metadata.IOSpec.Output.Count > 0)
            {
                //set columns in input and output views
                Gtk.NodeStore outputStore = new Gtk.NodeStore(typeof(IOItemNode));
                
                Gtk.CellRendererText textRenderer = new Gtk.CellRendererText();

                Gtk.CellRendererText editableTextRenderer = new CellRendererText();
                editableTextRenderer.Editable = isEditable;
                editableTextRenderer.Edited += delegate(object o, EditedArgs args) {
                    IOItemNode n = (IOItemNode)outputStore.GetNode (new TreePath (args.Path));
                    n.MappedTo = args.NewText;
                    RefreshIOHighlightInExperiment(n.MappedTo);
                };
                
                this.outputView.AppendColumn("Output", textRenderer, "text", 0);
                this.outputView.AppendColumn("Output as", editableTextRenderer, "text", 1);
                this.outputView.AppendColumn("Type", textRenderer, "text", 2);

                foreach(IOItem item in m_metadata.IOSpec.Output.Values) 
                {
                    outputStore.AddNode(new IOItemNode(item));
                }

                outputView.NodeStore = outputStore;
                
                //disables/enables the controls
                outputView.Sensitive = isEditable;

                outputView.HoverSelection = true;
                outputView.NodeSelection.Changed += SelectionHandleChanged;
            }
            else
            {
                outputView.Visible = false;
            }
        }
        private void SetIOInfo() 
        {
            //set columns in input and output views
            Gtk.NodeStore inputStore = new Gtk.NodeStore(typeof(IOItemNode));
            Gtk.NodeStore outputStore = new Gtk.NodeStore(typeof(IOItemNode));
            
            Gtk.CellRendererText textRenderer = new Gtk.CellRendererText();

            //inputs
            TreeViewColumn mappedToColumn = CreateInputMappingColumnWithComboBox(inputStore);
            this.inputView.AppendColumn("Input", textRenderer, "text", 0);
            this.inputView.AppendColumn(mappedToColumn);
            this.inputView.AppendColumn("Type", textRenderer, "text", 2);

            //outputs
            Gtk.CellRendererText editableTextRenderer = new CellRendererText();
            editableTextRenderer.Editable = true;
            editableTextRenderer.Edited += delegate(object o, EditedArgs args) {
                IOItemNode n = (IOItemNode)outputStore.GetNode (new TreePath (args.Path));
                n.MappedTo = args.NewText;
            };

            this.outputView.AppendColumn("Output", textRenderer, "text", 0);
            this.outputView.AppendColumn("Output as", editableTextRenderer, "text", 1);
            this.outputView.AppendColumn("Type", textRenderer, "text", 2);
            
            //prepare input and output store
            foreach(IOItem item in m_metadata.IOSpec.Input.Values) {
                inputStore.AddNode(new IOItemNode(item));
            }
            
            foreach(IOItem item in m_metadata.IOSpec.Output.Values) {
                outputStore.AddNode(new IOItemNode(item));
            }
            
            inputView.NodeStore = inputStore;
            outputView.NodeStore = outputStore;
        }
示例#12
0
        public MovieEditor(iMetaLibrary.Metadata.MovieMeta Meta)
        {
            this.Build ();
            this.Meta = Meta;
            #region setup the actors datagrid
            store = new NodeStore(typeof(ActorNode));

            CellRendererText nameRender = new CellRendererText(){ Editable = true, };
            nameRender.Edited += delegate(object o, EditedArgs args) {
                // update the text
                ActorNode node = (ActorNode)store.GetNode(new Gtk.TreePath(args.Path));
                node.Name = args.NewText;
            };
            nvActors.AppendColumn("Name", nameRender, "text", 0);
            CellRendererText roleRender = new CellRendererText(){ Editable = true, };
            roleRender.Edited += delegate(object o, EditedArgs args) {
                // update the text
                ActorNode node = (ActorNode)store.GetNode(new Gtk.TreePath(args.Path));
                node.Role = args.NewText;
            };
            nvActors.AppendColumn("Role", roleRender, "text", 1);

            nvActors.NodeStore = store;

            btnActorsRemove.Clicked += delegate
            {
                ActorNode node = nvActors.NodeSelection.SelectedNode as ActorNode;
                if(node != null)
                    store.RemoveNode(node);
            };
            btnActorsAdd.Clicked += delegate {
                var node = new ActorNode();
                store.AddNode(node);
                nvActors.NodeSelection.SelectNode(node);
                int _n = 0;
                var enumerator = store.GetEnumerator();
                while(enumerator.MoveNext()) _n++;
                nvActors.ScrollToCell(new TreePath(new int[] {_n-1}), null, false, 0, 0);
            };
            #endregion

            if(Meta.Actors != null){
                foreach(var actor in Meta.Actors)
                    store.AddNode(new ActorNode() { Name = actor.Key, Role = actor.Value});
            }

            txtTitle.Text = Meta.Title ?? "";
            txtSortTitle.Text = Meta.SortTitle ?? "";
            txtSet.Text = Meta.Set ?? "";
            txtTagline.Text = Meta.TagLine ?? "";
            txtGenres.Text = String.Join(", ", Meta.Genres ?? new string[] {});
            txtDirectors.Text = String.Join(", ", Meta.Directors ?? new string[] {});
            txtWriters.Text = String.Join(", ", Meta.Writers ?? new string[] {});
            txtTrailer.Text = Meta.Trailer ?? "";
            txtImdbId.Text = Meta.Id ?? "";
            txtMpaa.Text = Meta.Mpaa ?? "";
            txtReleaseDate.Text = Meta.ReleaseDate > new DateTime(1850, 1,1) ? Meta.ReleaseDate.ToString("yyyy-MM-dd") : "";
            txtPlot.Buffer.Text = Meta.Plot ?? "";
            numRuntime.Value = Meta.Runtime / 60; // convert seconds to minutes
            ratingwidget.Value = (int)Meta.Rating;

            Poster = GuiHelper.ImageToPixbuf(Meta.LoadThumbnail(290, 1000));

            //ratingwidget.Visible  = false;

            buttonOk.Clicked += delegate {
                Save ();
            };

            eventPoster.ButtonPressEvent +=	delegate{
                BrowseForNewPoster();
            };
        }
示例#13
0
        // END HERZUM BUG FIX: alignment input-output TLAB-255
        private void SetOutputInfo(bool isEditable) 
        {
            if(m_metadata.IOSpec.Output.Count > 0)
            {
                //set columns in input and output views
                Gtk.NodeStore outputStore = new Gtk.NodeStore(typeof(IOItemNode));
                Gtk.CellRendererText textRenderer = new Gtk.CellRendererText();

                Gtk.CellRendererText editableTextRenderer = new CellRendererText();
                editableTextRenderer.Editable = isEditable;
                editableTextRenderer.Edited += delegate(object o, EditedArgs args) {
                    IOItemNode n = (IOItemNode)outputStore.GetNode (new TreePath (args.Path));
                    n.MappedTo = args.NewText;
                    RefreshIOHighlightInExperiment(n.MappedTo);
                };

                // HERZUM SPRINT 4.2: TLAB-226
                //textRenderer.CellBackground = "grey";
                // HERZUM SPRINT 5: TLAB-242
                Gdk.Color colorBack = new  Gdk.Color (245, 245, 245);
                textRenderer.CellBackgroundGdk = colorBack;
                // END HERZUM SPRINT 5: TLAB-242
                // END HERZUM SPRINT 4.2: TLAB-226 

                // HERZUM BUG FIX: alignment input-output TLAB-255
                //HERZUM SPRINT 5.4 TLAB-241
                t_Output = this.outputView.AppendColumn(Convert.ToChar(171) + " Output", textRenderer, "text", 0);
                t_Output.Resizable = true;
                //END HERZUM SPRINT 5.4 TLAB-241
                t_OutputAs=this.outputView.AppendColumn("Output as", editableTextRenderer, "text", 1);
                t_OutputAs.Resizable = true;
                t_OutputType=this.outputView.AppendColumn("Type", textRenderer, "text", 2);
                t_OutputType.Resizable = true;
                // END HERZUM BUG FIX: alignment input-output TLAB-255

                int currentLengthOutput;
                int currentLengthOutputAs;
                foreach(IOItem item in m_metadata.IOSpec.Output.Values) 
                {
                    outputStore.AddNode(new IOItemNode(item));
                    // HERZUM BUG FIX: alignment input-output TLAB-255
                    currentLengthOutput = item.IOItemDefinition.Name.Length;
                    currentLengthOutputAs = item.MappedTo.Length;
                    if (currentLengthOutput>maxLengthOutput)
                        maxLengthOutput = currentLengthOutput;
                    if (currentLengthOutputAs>maxLengthOutputAs)
                        maxLengthOutputAs = currentLengthOutputAs;
                    // END HERZUM BUG FIX: alignment input-output TLAB-255
                }

                outputView.NodeStore = outputStore;
                
                //disables/enables the controls
                outputView.Sensitive = isEditable;

                outputView.HoverSelection = true;
                outputView.NodeSelection.Changed += SelectionHandleChanged;
            }
            else
            {
                outputView.Visible = false;
            }
        }
示例#14
0
文件: main.cs 项目: mono/msdn-browse
    public MsdnView()
        : base("Msdn View")
    {
        DefaultSize = new Gdk.Size (1024,1024);

        HPaned hb = new HPaned ();

        Store = new NodeStore (typeof (TreeNode));
        WebControl wc = new WebControl ();
        ScrolledWindow sw = new ScrolledWindow ();
        NodeView view = new NodeView (Store);
        view.HeadersVisible = false;
        view.AppendColumn ("Name", new CellRendererText (), "text", 0);
        sw.WidthRequest = 300;
        InitTree ();
        Add (hb);
        hb.Add (sw);
        hb.Add (wc);
        sw.Add (view);

        // Events
        DeleteEvent += delegate {
            Application.Quit ();
        };

        view.NodeSelection.Changed += delegate {
            TreeNode n = (TreeNode) view.NodeSelection.SelectedNode;
            if (n == null)
                return;

            //
            // Fool msdn's code that tries to detect if it
            // is in a frame
            //
            string html = @"
        <frameset>
          <frame src='" + n.Href + @"?frame=true' />
        </frameset>";

            wc.OpenStream (MsdnClient.BaseUrl, "text/html");
            wc.AppendData (html);
            wc.CloseStream ();

        };
        view.RowExpanded += delegate (object o, RowExpandedArgs args) {
            TreeNode n = (TreeNode) Store.GetNode (args.Path);
            n.PopulateChildrenAsync ();
        };
    }