예제 #1
0
    private void _initNodeStore()
    {
        CellRendererToggle colorToggle = new Gtk.CellRendererToggle();

        colorToggle.Toggled += (object o, ToggledArgs args) =>
        {
            VectorFile vf = (VectorFile)(NodeFileList.NodeStore.GetNode(new TreePath(args.Path)));
            vf.ExportColorArt = !vf.ExportColorArt;
        };

        CellRendererToggle lineToggle = new Gtk.CellRendererToggle();

        lineToggle.Toggled += (object o, ToggledArgs args) =>
        {
            VectorFile vf = (VectorFile)(NodeFileList.NodeStore.GetNode(new TreePath(args.Path)));
            vf.ExportLineArt = !vf.ExportLineArt;
        };

        CellRendererToggle mergedToggle = new Gtk.CellRendererToggle();

        mergedToggle.Toggled += (object o, ToggledArgs args) =>
        {
            VectorFile vf = (VectorFile)(NodeFileList.NodeStore.GetNode(new TreePath(args.Path)));
            vf.ExportMerged = !vf.ExportMerged;
        };

        CellRendererText optionsRenderer = new CellRendererText();

        optionsRenderer.Editable = true;
        optionsRenderer.Edited  += (object o, EditedArgs args) =>
        {
            VectorFile vf = (VectorFile)(NodeFileList.NodeStore.GetNode(new TreePath(args.Path)));
            vf.Options = args.NewText;
        };

        CellRendererText nameRenderer = new CellRendererText();

        nameRenderer.Editable = true;
        nameRenderer.Edited  += (object o, EditedArgs args) =>
        {
            VectorFile vf = (VectorFile)(NodeFileList.NodeStore.GetNode(new TreePath(args.Path)));
            vf.Name = args.NewText;
        };

        TreeViewColumn nameCol = NodeFileList.AppendColumn("Name", nameRenderer, "text", 5);

        nameCol.Resizable = true;

        NodeFileList.AppendColumn("Color", colorToggle, "active", 3);
        NodeFileList.AppendColumn("Line", lineToggle, "active", 2);
        NodeFileList.AppendColumn("Merged", mergedToggle, "active", 1);

        TreeViewColumn optionsCol = NodeFileList.AppendColumn("Options", optionsRenderer, "text", 4);

        optionsCol.Resizable = true;

        NodeFileList.AppendColumn("Path", new Gtk.CellRendererText(), "text", 0);


        NodeFileList.NodeStore = exportSettingsController.GetListStore();

        NodeFileList.CursorChanged += RowSelected;
    }
예제 #2
0
        private void _initNodeStore()
        {
            nodestore = new NodeStore(typeof(ElementExportSettings));

            CellRendererText optionsRenderer = new CellRendererText();

            optionsRenderer.Editable = true;
            optionsRenderer.Edited  += (object o, EditedArgs args) => {
                ElementExportSettings vf = (ElementExportSettings)(NodeFileList.NodeStore.GetNode(new TreePath(args.Path)));
                vf.Options = args.NewText;
            };

            CellRendererText nameRenderer = new CellRendererText();

            nameRenderer.Editable = true;
            nameRenderer.Edited  += (object o, EditedArgs args) => {
                ElementExportSettings vf = (ElementExportSettings)(NodeFileList.NodeStore.GetNode(new TreePath(args.Path)));
                vf.Name = args.NewText;
            };

            NodeFileList.AppendColumn("Path", new Gtk.CellRendererText(), "text", 0);

            TreeViewColumn nameCol = NodeFileList.AppendColumn("Name", nameRenderer, "text", 1);

            nameCol.Resizable = true;

            CellRendererCombo cropRenderer = new CellRendererCombo();
            ListStore         model        = new ListStore(typeof(string), typeof(ElementExportSettings.CropSetting));

            foreach (object enumVal in Enum.GetValues(typeof(ElementExportSettings.CropSetting)))
            {
                model.AppendValues(enumVal.ToString(), enumVal);
            }
            cropRenderer.HasEntry   = false;
            cropRenderer.Editable   = true;
            cropRenderer.Model      = model;
            cropRenderer.TextColumn = 0;
            cropRenderer.Edited    += (o, args) => {
                ElementExportSettings vf = (ElementExportSettings)(NodeFileList.NodeStore.GetNode(new TreePath(args.Path)));
                vf.CropMode = (ElementExportSettings.CropSetting)Enum.Parse(typeof(ElementExportSettings.CropSetting), args.NewText);
            };
            TreeViewColumn cropCol = NodeFileList.AppendColumn("Crop Mode", cropRenderer, "text", 4);

            TreeViewColumn optionsCol = NodeFileList.AppendColumn("Options", optionsRenderer, "text", 2);

            optionsCol.Resizable = true;

            CellRendererPixbuf pixbufRenderer = new CellRendererPixbuf();

            TreeViewColumn pixCol = NodeFileList.AppendColumn("Export", pixbufRenderer, "stock-id", 5);

            NodeFileList.RowActivated += (o, args) => {
                if (args.Column == pixCol)
                {
                    ElementExportSettings tvg    = ((ElementExportSettings)NodeFileList.NodeStore.GetNode(args.Path));
                    ExportResultDialog    dialog = new ExportResultDialog(tvg.ExportLog);
                    dialog.Run();
                    dialog.Destroy();
                }
            };
            pixCol.Clicked += (sender, e) => {
            };

            NodeFileList.AppendColumn("", new CellRendererText());

            NodeFileList.Selection.Mode = SelectionMode.Multiple;

            NodeFileList.NodeStore = nodestore;
        }