Ejemplo n.º 1
0
        public RenderingQueueWindow(RenderingQueue renderingQueue) :
            base(WindowType.Toplevel)
        {
            this.Build();

            title_Label.ModifyFont(FontHelpers.ScaleFontSize(title_Label, 1.4));

            // Adding queue event handlers
            mRenderingQueue = renderingQueue;
            mRenderingQueue.QueueProgressMessageReport += HandleRenderingQueueProgressMessageReport;
            mRenderingQueue.ItemAdded                   += HandleRenderingQueueItemAdded;
            mRenderingQueue.ItemIndexChanged            += HandleRenderingQueueItemIndexChanged;
            mRenderingQueue.ItemRemoved                 += HandleRenderingQueueItemRemoved;
            mRenderingQueue.BeforeItemProcessingStarted += HandleRenderingQueueBeforeItemProcessingStarted;
            mRenderingQueue.AfterItemProcessingFinished += HandleRenderingQueueAfterItemProcessingFinished;
            mRenderingQueue.ThreadStarted               += HandleRenderingQueueThreadStarted;
            mRenderingQueue.ThreadStopped               += HandleRenderingQueueThreadStopped;
            mRenderingQueue.QueueEmpty                  += HandleRenderingQueueQueueEmpty;
            mRenderingQueue.ItemRendering               += HandleRenderingQueueItemRendering;

            // Creating status icon

            string icon_res;

            if (System.Environment.OSVersion.Platform == PlatformID.Unix)
            {
                icon_res = "CatEye.UI.Gtk.res.svg-inkscape.cateye-small.svg";
            }
            else
            {
                // Windows, I hope.
                icon_res = "CatEye.UI.Gtk.res.png.cateye-small-16x16.png";
            }

            mProcessingStatusIcon           = new StatusIcon(Gdk.Pixbuf.LoadFromResource(icon_res));
            mProcessingStatusIcon.Visible   = false;            // In Windows status icon appears visible by default
            mProcessingStatusIcon.Activate += HandleProcessingStatusIconActivate;

            // Preparing queue list
            mQueueNodeStore          = new NodeStore(typeof(RenderingTaskTreeNode));
            queue_nodeview.NodeStore = mQueueNodeStore;

            queue_nodeview.AppendColumn("Source", new CellRendererText(), "text", 0);
            queue_nodeview.AppendColumn("Destination", new CellRendererText(), "text", 1);

            expander1.Expanded    = false;
            queue_GtkLabel.Markup = "<b>Queue (" + mRenderingQueue.Queue.Length + " left)</b>";
        }
Ejemplo n.º 2
0
        public AboutBox()
        {
            this.Build();

            title_label.ModifyFont(FontHelpers.ScaleFontSize(title_label, 2));
        }
Ejemplo n.º 3
0
    protected void OnTogglebuttonToggled(object sender, System.EventArgs e)
    {
        if (addNewOperation_togglebutton.Active)
        {
            Menu menu = new Menu();
            int  w, h;
            menu.GetSizeRequest(out w, out h);
            int menu_width = left_vbox.Allocation.Width;

            menu.SetSizeRequest(menu_width, h);

            Dictionary <MenuItem, Type> stage_operation_types = new Dictionary <MenuItem, Type>();

            for (int i = 0; i < mStageOperationTypes.Length; i++)
            {
                string name = StageOperationDescriptionAttribute.GetName(mStageOperationTypes[i]);
                if (name == null)
                {
                    name = mStageOperationTypes[i].Name;
                }
                string description = StageOperationDescriptionAttribute.GetDescription(mStageOperationTypes[i]);

                MenuItem item = new MenuItem();

                VBox item_vbox = new VBox();
                item_vbox.BorderWidth = 4;
                item_vbox.Show();


                Label lbl_name = new Label();
                lbl_name.Text    = name;
                lbl_name.Justify = Justification.Left;
                lbl_name.Xalign  = 0;

                // Setting the name font
                double name_size_k            = 1.1;
                Pango.FontDescription name_fd = FontHelpers.ScaleFontSize(lbl_name, name_size_k);
                name_fd.Weight = Pango.Weight.Bold;
                lbl_name.ModifyFont(name_fd);

                item_vbox.Add(lbl_name);
                lbl_name.Show();

                if (description != null && description != "")
                {
                    Label lbl_desc = new Label(description);
                    lbl_desc.LineWrapMode = Pango.WrapMode.Word;
                    lbl_desc.LineWrap     = true;
                    lbl_desc.Wrap         = true;

                    // Setting the description font
                    double desc_size_k            = 0.9;
                    Pango.FontDescription desc_fd = FontHelpers.ScaleFontSize(lbl_desc, desc_size_k);
                    lbl_desc.ModifyFont(desc_fd);

                    item_vbox.Add(lbl_desc);
                    lbl_desc.Show();
                    item_vbox.SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
                        lbl_desc.WidthRequest = args.Allocation.Width - 10;
                    };
                }

                item.Child = item_vbox;
                stage_operation_types.Add(item, mStageOperationTypes[i]);

                item.Activated += delegate(object s, EventArgs ea) {
                    mStage.CreateAndAddNewItem(stage_operation_types[(MenuItem)s]).Active = true;
                    GtkScrolledWindow.HscrollbarPolicy  = PolicyType.Never;
                    GtkScrolledWindow.Vadjustment.Value = GtkScrolledWindow.Vadjustment.Upper;
                    ArrangeVBoxes();
                };

                menu.Append(item);
                item_vbox.CheckResize();
                //lbl_desc.WidthRequest = ww;
            }
            menu.Deactivated += delegate {
                addNewOperation_togglebutton.Active = false;
            };

            menu.ShowAll();
            menu.Popup(null, null, delegate(Menu m, out int x, out int y, out bool push_in) {
                int x1, y1, x0, y0;
                GdkWindow.GetOrigin(out x0, out y0);
                left_vbox.TranslateCoordinates(this, 0, 0, out x1, out y1);
                x       = x0 + x1;
                y       = y0 + y1;
                push_in = false;
            }, 0, 0);
        }
    }