Exemplo n.º 1
0
        private void GenerateTabs()
        {
            VBox tab = new VBox();
             Image img = new Image();
             img.Pixbuf = Images.GetPixbuf("options-general.png");
             tab.PackStart(img, false, false, 2);
             tab.PackEnd(new Label("General"), false, false, 0);
             tab.SetSizeRequest(60,50);
             tab.ShowAll();
             optionTabs.AppendPage(GenerateGeneral(), tab);

             tab = new VBox();
             img = new Image();
             img.Pixbuf = Images.GetPixbuf("options-text-editors.png");
             tab.PackStart(img, false, false, 2);
             tab.PackEnd(new Label("Text Editors"), false, false, 0);
             tab.SetSizeRequest(60,50);
             tab.ShowAll();
             optionTabs.AppendPage(GenerateTextEditors(), tab);

             tab = new VBox();
             img = new Image();
             img.Pixbuf = Images.GetPixbuf("options-results.png");
             tab.PackStart(img, false, false, 2);
             tab.PackEnd(new Label("Results"), false, false, 0);
             tab.SetSizeRequest(60,50);
             tab.ShowAll();
             optionTabs.AppendPage(GenerateResults(), tab);

             tab = new VBox();
             img = new Image();
             img.Pixbuf = Images.GetPixbuf("options-plugins.png");
             tab.PackStart(img, false, false, 2);
             tab.PackEnd(new Label("Plugins"), false, false, 0);
             tab.SetSizeRequest(60,50);
             tab.ShowAll();
             optionTabs.AppendPage(GeneratePlugins(), tab);

             tab.Dispose();
             img.Dispose();

             optionTabs.SwitchPage += new SwitchPageHandler(optionTabs_SwitchPage);
        }
Exemplo n.º 2
0
    public static void Main(string[] args)
    {
        Application.Init();

        Gtk.Window w = new Gtk.Window("Encodroyd");
        HBox mainHBox = new HBox();
        HBox dropHBox = new HBox();
        HBox spinVideoHBox = new HBox();
        HBox spinAudioHBox = new HBox();
        HBox statusButtonHBox = new HBox();
        VBox mainVBox = new VBox();
        VBox leftVBox = new VBox();
        VBox rightVBox = new VBox();
        VBox prefVBox = new VBox();
        VBox statusVBox = new VBox();
        MenuBar mb = new MenuBar ();
        //Gtk.Frame dndFrame = new Gtk.Frame();
        Gtk.Frame prefFrame = new Gtk.Frame("Preferences");
        Gtk.Frame statusFrame = new Gtk.Frame("Status");
        icon = new Pixbuf(null, "encodroyd.png");
        Gtk.EventBox image = new Gtk.EventBox();
        Gtk.Label dropLabel = new Gtk.Label("Drop videos here\nto convert");

        highQualityRadio = new RadioButton(null, "High Quality (H.264)");
        prefVBox.PackStart(highQualityRadio, true, true, 0);
        lowQualityRadio = new RadioButton(highQualityRadio, "Low Quality (MPEG4)");
        lowQualityRadio.Active = true;
        prefVBox.PackStart(lowQualityRadio, true, true, 0);

        statusLabel = new Gtk.Label("Idle");
        pBar = new ProgressBar();
        skipCurrentButton = new Gtk.Button();

        Gtk.ScrolledWindow scrollWin = new Gtk.ScrolledWindow();
        Gtk.TreeView tree = new TreeView();
        listStore = new ListStore(typeof (String));

        // set properties
        w.Icon = icon;

        // transparence
        //if (w.Screen.RgbaColormap != null)
        //  Gtk.Widget.DefaultColormap = w.Screen.RgbaColormap;

        mainHBox.BorderWidth = 6;
        mainHBox.Spacing = 6;
        dropHBox.BorderWidth = 6;
        dropHBox.Spacing = 6;
        spinVideoHBox.BorderWidth = 6;
        spinVideoHBox.Spacing = 6;
        spinAudioHBox.BorderWidth = 6;
        spinAudioHBox.Spacing = 6;
        statusButtonHBox.BorderWidth = 0;
        statusButtonHBox.Spacing = 6;
        leftVBox.BorderWidth = 6;
        leftVBox.Spacing = 6;
        rightVBox.BorderWidth = 6;
        rightVBox.Spacing = 6;
        prefVBox.BorderWidth = 6;
        prefVBox.Spacing = 6;
        statusVBox.BorderWidth = 6;
        statusVBox.Spacing = 6;
        statusLabel.Ellipsize = Pango.EllipsizeMode.Middle;
        scrollWin.ShadowType = ShadowType.In;
        statusLabel.SetSizeRequest(120,-1);
        skipCurrentButton.Sensitive = false;
        skipCurrentButton.Label = "Skip";

        // first hbox
        image.Add(new Gtk.Image(icon));
        dropHBox.Add(image);
        dropHBox.Add(dropLabel);

        // preferences frame
        prefFrame.Add(prefVBox);
        prefVBox.Add(spinVideoHBox);
        prefVBox.Add(spinAudioHBox);

        // status frame
        statusFrame.Add(statusVBox);
        statusVBox.Add(statusButtonHBox);
        statusVBox.Add(pBar);
        statusButtonHBox.Add(statusLabel);
        statusButtonHBox.Add(skipCurrentButton);

        // leftvbox
        leftVBox.Add(dropHBox);
        leftVBox.Add(prefFrame);
        leftVBox.Add(statusFrame);

        // right
        tree.Model = listStore;
        tree.HeadersVisible = true;
        tree.AppendColumn ("Queue", new CellRendererText (), "text", 0);

        // scrolledwindow
        scrollWin.Add(tree);

        // rightvbox
        rightVBox.Add(scrollWin);
        rightVBox.SetSizeRequest(200,-1);

        // menubar
        Menu fileMenu = new Menu ();
        MenuItem exitItem = new MenuItem("Exit");
        exitItem.Activated += new EventHandler (OnExitItemActivate);
        fileMenu.Append (exitItem);
        MenuItem fileItem = new MenuItem("File");
        fileItem.Submenu = fileMenu;
        mb.Append (fileItem);
        Menu helpMenu = new Menu ();
        MenuItem aboutItem = new MenuItem("About");
        aboutItem.Activated += new EventHandler (OnAboutItemActivate);
        helpMenu.Append (aboutItem);
        MenuItem helpItem = new MenuItem("Help");
        helpItem.Submenu = helpMenu;
        mb.Append (helpItem);

        // mainHBox
        mainVBox.Add(mb);
        mainVBox.Add(mainHBox);
        mainHBox.Add(leftVBox);
        mainHBox.Add(rightVBox);

        // window
        w.Add(mainVBox);
        w.ShowAll();

        // events
        Gtk.Drag.DestSet(dropHBox, DestDefaults.All, targetTable, Gdk.DragAction.Copy);
        dropHBox.DragDataReceived += DataReceived;
        skipCurrentButton.Clicked += new EventHandler(OnSkipOneButtonClicked);
        w.DeleteEvent += OnWindowDelete;

        Application.Run();
    }
Exemplo n.º 3
0
        Widget createDiffWidget(AspectFrame af, AspectFrame af2, PixbufDiff diff)
        {
            VBox sumbox = new VBox ();

            sumbox.Add (createAspectFrame( diff.Diff ));

            Label infotext = new Label (diff.diffstring);
            infotext.LineWrap = true;
            sumbox.Add (infotext);
            Box.BoxChild infotextbc = ((Box.BoxChild)(sumbox [infotext]));
            infotextbc.Expand = false;
            sumbox.Add (new VBox ());

            int mywidth = 24;

            Image arrow = new Image ();
            arrow.Pixbuf = Stetic.IconLoader.LoadIcon (this, "gtk-go-forward", IconSize.LargeToolbar);
            Button button = new Button ();
            button.SetSizeRequest (mywidth, 15);
            button.Add (arrow);
            button.Clicked += (object sender, EventArgs e) => validateImage (diff.Path, af2);
            sumbox.Add (button);
            sumbox.Add (new VBox ());
            Gdk.Pixbuf pixbuf;
            if (af2.Child.Data ["pixbuf"] != null)
                pixbuf = af2.Child.Data ["pixbuf"] as Gdk.Pixbuf;
            else
                pixbuf = af.Child.Data ["pixbuf"] as Gdk.Pixbuf;
            int height = pixbuf.Height;
            int width = pixbuf.Width;
            this.SizeAllocated += (o, args) => {
                int scrollbarwidth = 20;
                sumbox.SetSizeRequest (mywidth, (this.Allocation.Width - mywidth - scrollbarwidth) / 2 * height / width);
            };
            return sumbox;
        }
Exemplo n.º 4
0
		public void SetItems (MenuList items)
		{
			if (Container.Child != null) {
				foreach (Gtk.Widget widget in (Container.Child as VBox).Children) {
					if (widget is MenuItemWidget)
						(widget as MenuItemWidget).SelectedChanged -= HandleSelectedChanged;
					widget.Dispose ();
					widget.Destroy ();
				}
				Container.Remove (Container.Child);
			}
			
			VBox vbox = new VBox ();
			Container.Add (vbox);
			
			Cairo.Color textColor;
			if (IsLight) {
				textColor = new Cairo.Color (0.1, 0.1, 0.1);
			} else {
				textColor = new Cairo.Color (1, 1, 1);
			}
			
			bool hasIcon = false;
			foreach (MenuItem item in items.DisplayItems) {
				if (item.ShowIcons) {
					hasIcon = true;
					break;
				}
			}
			
			bool first = true;
			int width = 1;
			foreach (MenuItem item in items.DisplayItems) {
				if (item is SeparatorMenuItem) {
					SeparatorWidget widget = new SeparatorWidget ((item as SeparatorMenuItem).Title);
					widget.TextColor = textColor;
					
					if (first)
						widget.DrawLine = false;
					
					first = false;
					vbox.PackStart (widget);
				} else {
					MenuItemWidget menuItem = new MenuItemWidget (item);
					menuItem.SelectedChanged += HandleSelectedChanged;
					menuItem.TextColor = textColor;
					menuItem.MenuShowingIcons = hasIcon;
					
					first = false;
					vbox.PackStart (menuItem, false, false, 0);
					
					width = Math.Max (width, menuItem.RequestedWidth);
				}
			}
			vbox.SetSizeRequest (width, -1);
			
			Container.ShowAll ();
		}
Exemplo n.º 5
0
    private void buildWindow()
    {
        //prevent resize on screen
        this.Resizable = false;

        //initialize the colors
        MakeColors ();

        //initialize styles
        makeLabelStyle ();

        masterContainer = new VBox ();
        masterContainer.SetSizeRequest (Constants.Constants.APPLICATION_WIDTH, Constants.Constants.APPLICATION_HEIGHT);

        buildMenu ();

        //add in the header
        mainContainer = new HBox ();
        mainContainer.SetSizeRequest (Constants.Constants.APPLICATION_WIDTH, Constants.Constants.APPLICATION_HEIGHT - 400);
        addHeader ();

        //add in the main data and side bar
        sidePanel = new VBox ();

        //add main and side panel to frame
        addMainPanel ();
        addSidePanel ();

        //create link panel
        addLinkPanel ();

        mainContainer.PackStart (graphFrame, false, false, 42);
        mainContainer.PackStart (midPanel, false, false, 42);
        mainContainer.PackStart (sidePanel, false, false, 42);

        masterContainer.PackStart (mainContainer, false, false, 50);
        this.Add (masterContainer);
    }
Exemplo n.º 6
0
    /**
     * Creates the "link" panel, which shows links between free blocks
     * */
    private void addLinkPanel()
    {
        //master mid panel container
        midPanel = new VBox ();

        //will store links between free blocks
        linkPanel = new VBox ();
        linkPanel.SetSizeRequest(Constants.Constants.LINK_PANEL_WIDTH, Constants.Constants.LINK_PANEL_HEIGHT);

        Label linkHeader = new Label (Constants.Constants.LinkHeader);
        linkHeader.Style = subHeaderLabelStyle.Copy ();

        linkPanel.PackStart (linkHeader, false, false, 10);

        //get the address link and insert values in form list[i] -> list[i + 1]
        List<int> addresses = FileParser.FileParser.AddressList;

        String link = "";
        for (int i = 0; i < addresses.Count; i++)
        {
            //make the link string
            link += "0x";
            link += addresses [i].ToString ("X");
            link += " -> ";

            if (i < addresses.Count - 1)
                link += ("0x" + addresses [i + 1].ToString ("X"));
            else
                link += "NULL";

            //insert it into thepanel
            Label linkInfoLabel = new Label (link);
            linkInfoLabel.Style = linkInfoStyle.Copy ();
            linkPanel.PackStart (linkInfoLabel, false, false, 5);

            //reset link
            link = "";
        }

        Viewport linkViewPort = new Viewport ();
        linkViewPort.SetSizeRequest(Constants.Constants.LINK_PANEL_WIDTH, Constants.Constants.LINK_PANEL_HEIGHT);
        linkViewPort.Add (linkPanel);

        //add the window for the graph frame
        linkWindow = new ScrolledWindow ();
        linkViewPort.SetSizeRequest(Constants.Constants.LINK_PANEL_WIDTH, Constants.Constants.LINK_PANEL_HEIGHT);
        linkWindow.Add (linkViewPort);

        //give border to legend container
        Frame f = new Frame ();
        f.Add (linkWindow);

        midPanel.PackStart (f, false, false, 10);
    }
Exemplo n.º 7
0
    /**
     * Adds in the fragmentation information to the side panel directly below free/alloc legend
     * */
    private void AddFragInfo()
    {
        fragInfoContainer = new VBox ();
        fragInfoContainer.SetSizeRequest (Constants.Constants.FRAG_INFO_HOLDER_WIDTH, Constants.Constants.FRAG_INFO_HOLDER_HEIGHT);

        Label fragInfoLabel = new Label (Constants.Constants.FRAG_INFO_HOLDER_TITLE);
        fragInfoLabel.Style = sidePanelLabelStyle.Copy ();

        //get the amount of external fragmentation
        int externalFragAsPercent = FileParser.FileParser.getAmountExternalFragmentation();

        //get % free and occupied
        float percentFree = FileParser.FileParser.GetPercentFree ();
        float percentOccupied = FileParser.FileParser.GetPercentOccupied ();

        Label totalFreePercentHolder = new Label (percentFree.ToString("N2") + Constants.Constants.FREE_LABEL_END);
        totalFreePercentHolder.Style = sidePanelLabelStyle.Copy ();

        Label totalOccupiedPercentHolder = new Label (percentOccupied.ToString("N2") + Constants.Constants.OCCUPIED_LABEL_END);
        totalOccupiedPercentHolder.Style = sidePanelLabelStyle.Copy ();

        Label externalFragLabel = new Label (externalFragAsPercent + Constants.Constants.EXTERNAL_FRAG_LABEL_END);
        externalFragLabel.Style = externalFragLabelStyle.Copy ();

        fragInfoContainer.PackStart (fragInfoLabel, false, false, 50);
        fragInfoContainer.PackStart (totalFreePercentHolder, false, false, 0);
        fragInfoContainer.PackStart (totalOccupiedPercentHolder, false, false, 0);
        fragInfoContainer.PackStart (externalFragLabel, false, false, 50);

        Frame f = new Frame ();
        f.Add (fragInfoContainer);

        sidePanel.PackStart (f, false, false, 10);
    }