Exemplo n.º 1
0
 public GameDescriptionHeader()
 {
     this.Build();
     SetStyle();
     namesGroup = new SizeGroup(SizeGroupMode.Horizontal);
     namesGroup.AddWidget(homenamelabel);
     namesGroup.AddWidget(awaynamelabel);
     scoreGroup = new SizeGroup(SizeGroupMode.Horizontal);
     scoreGroup.AddWidget(homescorelabel);
     scoreGroup.AddWidget(awayscorelabel);
 }
Exemplo n.º 2
0
        public EditPlaylistElementProperties()
        {
            this.Build();

            sizegroupLeft = new SizeGroup(SizeGroupMode.Horizontal);
            sizegroupLeft.IgnoreHidden = false;
            foreach (Widget w in vbox2.Children)
            {
                foreach (Widget t in (w as Table).Children)
                {
                    if ((t is Label))
                    {
                        t.ModifyFont(FontDescription.FromString(App.Current.Style.Font + " 10"));
                        sizegroupLeft.AddWidget(t);
                    }
                }
            }

            sizegroupRight = new SizeGroup(SizeGroupMode.Horizontal);
            sizegroupRight.IgnoreHidden = false;
            foreach (Widget w in vbox2.Children)
            {
                foreach (Widget t in (w as Table).Children)
                {
                    if (!(t is Label))
                    {
                        sizegroupRight.AddWidget(t);
                    }
                }
            }
            buttonOk.Clicked += HandleButtonOkClicked;
            Bind();
        }
Exemplo n.º 3
0
        Widget CreateButton(WelcomeButton b)
        {
            Button button;
            VBox   box;

            Gtk.Image     image;
            Gtk.Alignment alignment;
            Label         label;

            image = new Gtk.Image(
                Helpers.Misc.LoadIcon(b.name, StyleConf.WelcomeIconImageSize, 0));

            button               = new Button();
            button.Clicked      += (sender, e) => (b.func());
            button.HeightRequest = StyleConf.WelcomeIconSize;
            button.WidthRequest  = StyleConf.WelcomeIconSize;
            button.Add(image);

            alignment = new Alignment(0.5f, 0.5f, 0.0f, 0.0f);
            alignment.Add(button);

            label              = new Label(b.text);
            label.LineWrap     = true;
            label.LineWrapMode = Pango.WrapMode.Word;
            label.Justify      = Justification.Center;
            sizegroup.AddWidget(label);

            box = new VBox(false, StyleConf.WelcomeIconsTextSpacing);
            box.PackStart(alignment, false, false, 0);
            box.PackStart(label, false, false, 0);
            box.ShowAll();
            box.Name = b.name + "roundedbutton";
            return(box);
        }
Exemplo n.º 4
0
        void AddTagsGroup(LMTimelineEvent evt, string grp, List <Tag> tags, SizeGroup sgroup)
        {
            HBox        box       = new HBox();
            Label       label     = new Label(String.IsNullOrEmpty(grp) ? Catalog.GetString("Common tags") : grp);
            Table       tagstable = new Table((uint)(tags.Count / TAGS_PER_ROW), TAGS_PER_ROW, true);
            RadioButton first     = null;
            Tag         noneTag   = new Tag(Catalog.GetString("None"));

            label.WidthRequest = 200;
            if (!String.IsNullOrEmpty(grp))
            {
                tags.Insert(0, noneTag);
            }
            for (int i = 0; i < tags.Count; i++)
            {
                uint        row_top, row_bottom, col_left, col_right;
                Tag         t = tags [i];
                CheckButton tb;
                if (String.IsNullOrEmpty(grp))
                {
                    tb = new CheckButton(t.Value);
                }
                else
                {
                    if (first == null)
                    {
                        tb = first = new RadioButton(t.Value);
                    }
                    else
                    {
                        tb = new RadioButton(first, t.Value);
                    }
                }
                tb.Active   = evt.Tags.Contains(t);
                tb.Toggled += (sender, e) => {
                    if (tb.Active && t != noneTag)
                    {
                        evt.Tags.Add(t);
                    }
                    else
                    {
                        evt.Tags.Remove(t);
                    }
                };
                row_top    = (uint)(i / tagstable.NColumns);
                row_bottom = (uint)row_top + 1;
                col_left   = (uint)i % tagstable.NColumns;
                col_right  = (uint)col_left + 1;
                tagstable.Attach(tb, col_left, col_right, row_top, row_bottom);
            }
            sgroup.AddWidget(label);
            box.PackStart(label, false, true, 0);
            box.PackEnd(tagstable, true, true, 0);
            box.Spacing = 5;
            tagsvbox.PackStart(box, false, true, 0);
            tagsvbox.PackStart(new HSeparator());
        }
Exemplo n.º 5
0
        public CategoryProperties()
        {
            this.Build();
            nameentry.Changed           += HandleNameentryChanged;
            colorbutton1.ColorSet       += HandleColorSet;
            textcolorbutton.ColorSet    += HandleColorSet;
            tagmodecombobox.Changed     += HandleTagModeChanged;
            tagscheckbutton.Toggled     += HandleTagsToggled;
            tprbutton.ValueChanged      += HandleTagsPerRowValueChanged;
            leadtimebutton.ValueChanged += HandleLeadTimeChanged;
            lagtimebutton.ValueChanged  += HandleLagTimeChanged;
            changebuton.Clicked         += HandleChangeHotkey;
            sortmethodcombobox.Changed  += HandleSortMethodChanged;
            fieldcombobox.Changed       += HandlePositionChanged;
            hfieldcombobox.Changed      += HandlePositionChanged;
            goalcombobox.Changed        += HandlePositionChanged;
            shapecombobox.Changed       += HandleShapeChanged;
            pointsbutton.Changed        += HandlePointsChanged;
            teamcombobox.Changed        += HandleTeamChanged;
            groupentry.Changed          += HandleGroupChanged;

            postable.NoShowAll   = true;
            cattable.NoShowAll   = true;
            scoretable.NoShowAll = true;

            sizegroupLeft = new SizeGroup(SizeGroupMode.Horizontal);
            sizegroupLeft.IgnoreHidden = false;
            foreach (Widget w in vbox3.Children)
            {
                foreach (Widget t in (w as Table).Children)
                {
                    if ((t is Label))
                    {
                        t.ModifyFont(FontDescription.FromString(Config.Style.Font + " 10"));
                        sizegroupLeft.AddWidget(t);
                    }
                }
            }

            sizegroupRight = new SizeGroup(SizeGroupMode.Horizontal);
            sizegroupRight.IgnoreHidden = false;
            foreach (Widget w in vbox3.Children)
            {
                foreach (Widget t in (w as Table).Children)
                {
                    if (!(t is Label))
                    {
                        sizegroupRight.AddWidget(t);
                    }
                }
            }

            Tagger = null;

            UpdateGui();
        }
Exemplo n.º 6
0
        void ApplyStyle()
        {
            /* Keep the central box aligned in the center of the widget */
            SizeGroup grp = new SizeGroup(SizeGroupMode.Horizontal);

            grp.AddWidget(lefttable);
            grp.AddWidget(righttable);

            centerbox.WidthRequest          = StyleConf.NewTeamsComboWidth * 2 + StyleConf.NewTeamsSpacing;
            lefttable.RowSpacing            = outputfiletable.RowSpacing =
                righttable.RowSpacing       = StyleConf.NewTableHSpacing;
            lefttable.ColumnSpacing         = righttable.ColumnSpacing = StyleConf.NewTableHSpacing;
            vsimage.WidthRequest            = StyleConf.NewTeamsSpacing;
            hometeamscombobox.WidthRequest  = awayteamscombobox.WidthRequest = StyleConf.NewTeamsComboWidth;
            hometeamscombobox.HeightRequest = awayteamscombobox.HeightRequest = StyleConf.NewTeamsComboHeight;
            hometeamscombobox.WrapWidth     = awayteamscombobox.WrapWidth = 1;
            homealignment.Xscale            = awayalignment.Xscale = 0;
            homealignment.Xalign            = 0.8f;
            awayalignment.Xalign            = 0.2f;
        }
Exemplo n.º 7
0
 void GroupLabels()
 {
     sg = new SizeGroup(SizeGroupMode.Horizontal);
     sg.AddWidget(urilabel);
     sg.AddWidget(outputfilelabel);
     sg.AddWidget(device);
     sg.AddWidget(userlabel);
     sg.AddWidget(videoformatlabel);
     sg.AddWidget(deviceformatlabel);
     sg.AddWidget(outputsizelabel);
 }
Exemplo n.º 8
0
        public void AddWidget(KeyAction action, string desc, HotKey key, int position)
        {
            uint   row_top, row_bottom, col_left, col_right;
            HBox   box;
            Label  descLabel, keyLabel;
            Button edit;

            Gtk.Image editImage;

            box              = new HBox();
            box.Spacing      = 5;
            descLabel        = new Label();
            descLabel.Markup = String.Format("<b>{0}</b>", desc);
            keyLabel         = new Label();
            keyLabel.Markup  = GLib.Markup.EscapeText(key.ToString());
            edit             = new Button();
            editImage        = new Gtk.Image(Helpers.Misc.LoadIcon("vas-pencil", 24));
            edit.Add(editImage);
            box.PackStart(descLabel, true, true, 0);
            box.PackStart(keyLabel, false, true, 0);
            box.PackStart(edit, false, true, 0);
            box.ShowAll();

            sgroup.AddWidget(keyLabel);
            descLabel.Justify = Justification.Left;
            descLabel.SetAlignment(0f, 0.5f);
            edit.Clicked += (sender, e) => {
                HotKey hotkey = App.Current.GUIToolkit.SelectHotkey(key);
                if (hotkey != null)
                {
                    if (App.Current.Config.Hotkeys.ActionsHotkeys.ContainsValue(hotkey))
                    {
                        App.Current.Dialogs.ErrorMessage(Catalog.GetString("Hotkey already in use: ") +
                                                         GLib.Markup.EscapeText(hotkey.ToString()), this);
                    }
                    else
                    {
                        App.Current.Config.Hotkeys.ActionsHotkeys [action] = hotkey;
                        App.Current.Config.Save();
                        keyLabel.Markup = GLib.Markup.EscapeText(hotkey.ToString());
                    }
                }
            };

            row_top    = (uint)(position / table.NColumns);
            row_bottom = (uint)row_top + 1;
            col_left   = (uint)position % table.NColumns;
            col_right  = (uint)col_left + 1;
            table.Attach(box, col_left, col_right, row_top, row_bottom);
        }
Exemplo n.º 9
0
        Widget CreateButton(WelcomeButton b)
        {
            Button    button;
            VBox      box;
            ImageView image;

            Gtk.Alignment alignment;
            Label         label;

            if (b.Icon == null)
            {
                image = new ImageView(App.Current.ResourcesLocator.LoadIcon(b.Name, Sizes.WelcomeIconImageSize));
            }
            else
            {
                image = new ImageView(b.Icon);
            }
            image.SetSize(Sizes.WelcomeIconImageSize, Sizes.WelcomeIconImageSize);

            button               = new Button();
            button.Clicked      += (sender, e) => b.Func();
            button.HeightRequest = Sizes.WelcomeIconSize;
            button.WidthRequest  = Sizes.WelcomeIconSize;
            button.Add(image);
            if (buttonWidgets.Count == 0)
            {
                button.Realized += (sender, e) => button.GrabFocus();
            }

            alignment = new Alignment(0.5f, 0.5f, 0.0f, 0.0f);
            alignment.Add(button);

            label = new Label(b.Text);
            label.ModifyFont(Pango.FontDescription.FromString("Ubuntu 12"));
            label.LineWrap     = true;
            label.LineWrapMode = Pango.WrapMode.Word;
            label.Justify      = Justification.Center;
            sizegroup.AddWidget(label);

            box = new VBox(false, Sizes.WelcomeIconsTextSpacing);
            box.PackStart(alignment, false, false, 0);
            box.PackStart(label, false, false, 0);

            box.Name = b.Name + "roundedbutton";

            return(box);
        }
Exemplo n.º 10
0
        static void Add_Row(Table table, uint row, SizeGroup size_group,
                            string label_text, string [] options)
        {
            Label label = new Label(label_text);

            label.SetAlignment(0, 1);

            table.Attach(label,
                         0, 1, row, row + 1,
                         AttachOptions.Expand, AttachOptions.Fill,
                         0, 0);

            ComboBox combo_box = Create_ComboBox(options);

            size_group.AddWidget(combo_box);
            table.Attach(combo_box,
                         1, 2, row, row + 1,
                         AttachOptions.Expand, AttachOptions.Expand,
                         0, 0);
        }
Exemplo n.º 11
0
        private void AddRow(Table table, uint row, SizeGroup sizeGroup, string labelText, string [] options)
        {
            Label label = new Label(labelText);

            label.SetAlignment(0, 1);

            table.Attach(label,
                         0, 1, row, row + 1,
                         AttachOptions.Expand | AttachOptions.Fill, 0,
                         0, 0);

            ComboBox combo = CreateComboBox(options);

            label.MnemonicWidget = combo;

            sizeGroup.AddWidget(combo);
            table.Attach(combo,
                         1, 2, row, row + 1,
                         0, 0,
                         0, 0);
        }
        public EditPlaylistElementProperties(Window parent, IPlaylistElement element)
        {
            TransientFor = parent;
            this.Build();

            sizegroupLeft = new SizeGroup(SizeGroupMode.Horizontal);
            sizegroupLeft.IgnoreHidden = false;
            foreach (Widget w in vbox2.Children)
            {
                foreach (Widget t in (w as Table).Children)
                {
                    if ((t is Label))
                    {
                        t.ModifyFont(FontDescription.FromString(App.Current.Style.Font + " 10"));
                        sizegroupLeft.AddWidget(t);
                    }
                }
            }

            sizegroupRight = new SizeGroup(SizeGroupMode.Horizontal);
            sizegroupRight.IgnoreHidden = false;
            foreach (Widget w in vbox2.Children)
            {
                foreach (Widget t in (w as Table).Children)
                {
                    if (!(t is Label))
                    {
                        sizegroupRight.AddWidget(t);
                    }
                }
            }

            PlaylistElement = element;
            durationspinbutton.ValueChanged += HandleDurationChanged;
            nameentry.Changed += HandleNameChanged;
        }
Exemplo n.º 13
0
        protected virtual void OnActionGenerateActivated(object sender, System.EventArgs e)
        {
            #region

            // TODO: Do not correct entered name, just normalize it internally

            // TODO: Valid name regex (culture- or option- dependent)

            // TODO: Name normalization regex (remove spaces, ё => e)

            var sName = cbeName.ActiveText.ToLower().Trim();

            // remove duplicate whitespace
            sName = Regex.Replace(sName, @"\s+", " ");


            // filter invalid symbols
            // [^а-я-\s] - with "-"
            sName = Regex.Replace(sName, @"[^а-яё\s]", "", RegexOptions.IgnoreCase);

            if (!UserInfo.IsValidName(sName))
            {
                statusMessage.Message(
                    Catalog.GetString("Name was entered incorrectly!"),
                    Catalog.GetString("Name must consists from three parts - lastname (family name), firstname and othername, separated with spaces."),
                    Stock.DialogError
                    );

                cbeName.ErrorBell();
                return;
            }

            var sNameParts = sName.Split(' ');

            sName = CharToUpper(sNameParts [0], 0) + " " + CharToUpper(sNameParts [1], 0) + " " + CharToUpper(sNameParts [2], 0);

            RememberUser(sName);

            // THINK: RU locale-specific
            // replace 'Ё' after remember, so it is equivalent to 'Е'
            sName = sName.Replace("ё", "е").Replace("Ё", "Е");

            sNameParts = sName.ToUpper().Split(' ');
            //cbeName.Entry.Text = sName;

            //sName = sName.ToUpper();

            #endregion

            var uniqueInt = UniqueInt(
                Mix(sNameParts [0], sNameParts [1], sNameParts [2]));

            var rnd = new Random(uniqueInt);

            // roll dice three times
            rnd.Next();
            rnd.Next();
            rnd.Next();              // new version

            //int nTasksToSelect = 10;
            //int iGrouping = 2;
            //int ToSumComplexity = 10 * 5 - 3; // примерно 10 задач средней сложности (5) минус 5 (чуть меньше половинной сложности)

            if (comboTheme.Active == 0)
            {
                statusMessage.Message(
                    Catalog.GetString("You must choose a theme!"),
                    Catalog.GetString("You must choose a theme of work to generate variant for it."),
                    Stock.DialogError
                    );

                comboTheme.ErrorBell();
                return;
            }

            lsTasks         = new List <TaskInfo> (100);
            lsTasksSelected = new List <TaskInfo> (10);

            ThemeInfo theme = null;
            foreach (ThemeInfo t in lsThemes)
            {
                if (t.Title == comboTheme.ActiveText)
                {
                    theme = t;
                    break;
                }
            }

            if (theme == null)
            {
                statusMessage.Message(
                    Catalog.GetString("Unexpected error!"),
                    Catalog.GetString("Unexpected error occured! Application restart recommended."),
                    Stock.DialogError
                    );

                comboTheme.ErrorBell();
                return;
            }

            lsTasks = DataProvider.Database.Fetch <TaskInfo, ProblemBookSectionInfo, ProblemBookInfo> (
                "SELECT TA.*, PBS.*, PB.* FROM Tasks AS TA " +
                "INNER JOIN ThemeSectionPairs AS TSP " +
                "ON TA.ProblemBookSectionID = TSP.ProblemBookSectionID " +
                "INNER JOIN ProblemBookSections AS PBS " +
                "ON TA.ProblemBookSectionID = PBS.ProblemBookSectionID " +
                "INNER JOIN ProblemBooks AS PB " +
                "ON PBS.ProblemBookID = PB.ProblemBookID " +
                "WHERE TSP.ThemeID = @0 ORDER BY TA.[Order] ASC", theme.ThemeID);

            var nTasks = lsTasks.Count;

            if (nTasks == 0)
            {
                statusMessage.Message(
                    Catalog.GetString("No tasks for choosen theme!"),
                    Catalog.GetString("No tasks for choosen theme found in the database"),
                    Stock.DialogWarning
                    );

                comboTheme.ErrorBell();
                return;
            }

            // массив маски выбранных задач
            // если taskMask[i] = true, задача выбрана
            var taskMask = new bool[nTasks];
            for (var i = 0; i < taskMask.Length; i++)
            {
                taskMask [i] = false;
            }

            var easyTasks    = SelectTasks(2, 1, 3, taskMask, rnd);
            var hardTasks    = SelectTasks(2, 9, 10, taskMask, rnd);
            var complexTasks = SelectTasks(2, 7, 8, taskMask, rnd);
            var commonTasks  = SelectTasks(
                10 - complexTasks.Count - hardTasks.Count - easyTasks.Count,
                4, 6, taskMask, rnd);

            lsTasksSelected.AddRange(easyTasks);
            lsTasksSelected.AddRange(hardTasks);
            lsTasksSelected.AddRange(complexTasks);
            lsTasksSelected.AddRange(commonTasks);

            lsTasksSelected.Sort(new TaskOrderComparer());

            while (table2.Children.Length > 0)
            {
                table2.Remove(table2.Children [0]);
            }

            // CHECK: what is it for?
            if (table2.Children.Length < lsTasksSelected.Count)
            {
                for (var i = 0; i < lsTasksSelected.Count; i++)
                {
                    var button = new Button();
                    table2.Add(button);

                    var tableChild = table2 [button] as Table.TableChild;
                    tableChild.XOptions = tableChild.YOptions = AttachOptions.Expand | AttachOptions.Fill;

                    var x = (uint)(i % 5) * 2 + 1;
                    var y = (uint)(i / 5);

                    tableChild.LeftAttach   = x;
                    tableChild.RightAttach  = tableChild.LeftAttach + 1;
                    tableChild.TopAttach    = y;
                    tableChild.BottomAttach = tableChild.TopAttach + 1;

                    // add label
                    var label = new Label();
                    table2.Add(label);

                    tableChild = table2 [label] as Table.TableChild;

                    label.UseMarkup = true;
                    label.LabelProp = string.Format("<b>{0,2}:</b>", i + 1);
                    label.SetAlignment(1, 0.5f);

                    tableChild.LeftAttach   = x - 1;
                    tableChild.RightAttach  = tableChild.LeftAttach + 1;
                    tableChild.TopAttach    = y;
                    tableChild.BottomAttach = tableChild.TopAttach + 1;

                    label.Show();
                    button.Show();
                }                 // for
            }

            statusMessage.Message(
                string.Format(Catalog.GetString("{0} tasks choosen"), lsTasksSelected.Count),
                Stock.DialogInfo
                );

            sizegroupButtons = new SizeGroup(SizeGroupMode.Horizontal);

            // fill task buttons
            var ti = 0;
            foreach (var w in table2.Children)
            {
                if (w is Button)
                {
                    // FIXME: Sort order is inverse!
                    // must be: TaskInfo t = lsTasksSelected [ti++];

                    var task = lsTasksSelected [lsTasksSelected.Count - ++ti];

                    var button = w as Button;
                    button.Label        = task.ToString();
                    button.TooltipText  = task.ToDetailString();
                    button.BorderWidth  = 2;
                    button.WidthRequest = 100;
                    button.FocusOnClick = true;
                    button.Clicked     += new EventHandler(OnTaskButtonClicked);

                    sizegroupButtons.AddWidget(button);

                    #region Button coloring (disabled)

                    // Button coloring is disabled - not supported by all GTK themes

                    /* // color by complexity
                     * Gdk.Color color = new Gdk.Color (192, 255, 192);
                     * if (t.ComplexityLevel == TaskComplexity.Low)
                     *      color = new Gdk.Color (255, 255, 255);
                     * else if (t.ComplexityLevel == TaskComplexity.Higher)
                     *      color = new Gdk.Color (255, 255, 192);
                     * else if (t.ComplexityLevel == TaskComplexity.High)
                     *      color = new Gdk.Color (255, 192, 192);
                     * ModifyButtonBg (b, color);
                     */

                    /* // color by taskbook
                     * Gdk.Color color = new Gdk.Color (200, 255, 200);
                     * if (t.Designation == "Зл")
                     *      color = new Gdk.Color (200, 255, 200);
                     * else if (t.Designation == "Аб")
                     *      color = new Gdk.Color (255, 255, 255);
                     * else if (t.Designation == "Юр")
                     *      color = new Gdk.Color (200, 200, 255);
                     *
                     * ModifyWidgetBg (rb, color);
                     */

                    #endregion
                }
            }

            // display theme description on label and make label visible
            labelThemeDesc.LabelProp   = "<i>" + theme.Description + "</i>";
            labelThemeDesc.TooltipText = theme.Description;
            labelThemeDesc.Visible     = true;

            // make task table and checkbutton visible
            table2.Visible      = true;
            chkOpenBook.Visible = true;

            // dump generated varian to textview
            textview1.Buffer.Text =
                string.Format(Catalog.GetString("Variant for:\n{0}\n{1}"), sName, TasksToText(lsTasksSelected));
        }
Exemplo n.º 14
0
        public VideoPreferencesPanel()
        {
            this.Build();

            if (App.Current.Config.FPS_N == 30)
            {
                fpscombobox.Active = 1;
            }
            else if (App.Current.Config.FPS_N == 50)
            {
                fpscombobox.Active = 2;
            }
            else if (App.Current.Config.FPS_N == 60)
            {
                fpscombobox.Active = 3;
            }
            else
            {
                fpscombobox.Active = 0;
            }
            fpscombobox.Changed += HandleFPSChanged;
            Misc.FillImageFormat(renderimagecombo, VideoStandards.Rendering, App.Current.Config.RenderVideoStandard);
            Misc.FillEncodingFormat(renderenccombo, App.Current.Config.RenderEncodingProfile);
            Misc.FillQuality(renderqualcombo, App.Current.Config.RenderEncodingQuality);

            Misc.FillImageFormat(captureimagecombo, VideoStandards.Capture, App.Current.Config.CaptureVideoStandard);
            Misc.FillEncodingFormat(captureenccombo, App.Current.Config.CaptureEncodingProfile);
            Misc.FillQuality(capturequalcombo, App.Current.Config.CaptureEncodingQuality);

            renderimagecombo.Changed  += HandleImageChanged;
            captureimagecombo.Changed += HandleImageChanged;

            renderenccombo.Changed  += HandleEncodingChanged;
            captureenccombo.Changed += HandleEncodingChanged;

            renderqualcombo.Changed  += HandleQualityChanged;
            capturequalcombo.Changed += HandleQualityChanged;

            enableSound = new CheckButton();
            rendertable.Attach(enableSound, 1, 2, 3, 4,
                               AttachOptions.Fill,
                               AttachOptions.Fill, 0, 0);
            enableSound.CanFocus = false;
            enableSound.Show();
            enableSound.Active   = App.Current.Config.EnableAudio;
            enableSound.Toggled += (sender, e) => {
                App.Current.Config.EnableAudio = enableSound.Active;
            };

            overlayTitle = new CheckButton();
            rendertable.Attach(overlayTitle, 1, 2, 4, 5,
                               AttachOptions.Fill,
                               AttachOptions.Fill, 0, 0);
            overlayTitle.CanFocus = false;
            overlayTitle.Show();
            overlayTitle.Active   = App.Current.Config.OverlayTitle;
            overlayTitle.Toggled += (sender, e) => {
                App.Current.Config.OverlayTitle = overlayTitle.Active;
            };

            addWatermark = new CheckButton();
            rendertable.Attach(addWatermark, 1, 2, 5, 6,
                               AttachOptions.Fill,
                               AttachOptions.Fill, 0, 0);
            addWatermark.CanFocus = false;
            addWatermark.Show();
            addWatermark.Active   = App.Current.Config.AddWatermark;
            addWatermark.Toggled += (sender, e) => {
                App.Current.Config.AddWatermark = addWatermark.Active;
            };

            SizeGroup sgroup  = new SizeGroup(SizeGroupMode.Horizontal);
            SizeGroup sgroup2 = new SizeGroup(SizeGroupMode.Horizontal);

            foreach (Widget w in generaltable)
            {
                if (w is Label)
                {
                    sgroup.AddWidget(w);
                }
                else
                {
                    sgroup2.AddWidget(w);
                }
            }
            foreach (Widget w in capturetable)
            {
                if (w is Label)
                {
                    sgroup.AddWidget(w);
                }
                else
                {
                    sgroup2.AddWidget(w);
                }
            }
            foreach (Widget w in rendertable)
            {
                if (w is Label)
                {
                    sgroup.AddWidget(w);
                }
                else
                {
                    sgroup2.AddWidget(w);
                }
            }
        }
Exemplo n.º 15
0
        public VideoPreferencesPanel()
        {
            this.Build();

            if (App.Current.Config.FPS_N == 30)
            {
                fpscombobox.Active = 1;
            }
            else if (App.Current.Config.FPS_N == 50)
            {
                fpscombobox.Active = 2;
            }
            else if (App.Current.Config.FPS_N == 60)
            {
                fpscombobox.Active = 3;
            }
            else
            {
                fpscombobox.Active = 0;
            }
            fpscombobox.Changed += HandleFPSChanged;
            Misc.FillImageFormat(renderimagecombo, VideoStandards.Rendering, App.Current.Config.RenderVideoStandard);
            Misc.FillEncodingFormat(renderenccombo, App.Current.Config.RenderEncodingProfile);
            Misc.FillQuality(renderqualcombo, App.Current.Config.RenderEncodingQuality);

            Misc.FillImageFormat(captureimagecombo, VideoStandards.Capture, App.Current.Config.CaptureVideoStandard);
            Misc.FillEncodingFormat(captureenccombo, App.Current.Config.CaptureEncodingProfile);
            Misc.FillQuality(capturequalcombo, App.Current.Config.CaptureEncodingQuality);

            renderimagecombo.Changed  += HandleImageChanged;
            captureimagecombo.Changed += HandleImageChanged;

            renderenccombo.Changed  += HandleEncodingChanged;
            captureenccombo.Changed += HandleEncodingChanged;

            renderqualcombo.Changed  += HandleQualityChanged;
            capturequalcombo.Changed += HandleQualityChanged;

            enableSound = new CheckButton();
            rendertable.Attach(enableSound, 1, 2, 3, 4,
                               AttachOptions.Fill,
                               AttachOptions.Fill, 0, 0);
            enableSound.CanFocus = false;
            enableSound.Show();
            enableSound.Active   = App.Current.Config.EnableAudio;
            enableSound.Toggled += (sender, e) => {
                App.Current.Config.EnableAudio = enableSound.Active;
            };

            overlayTitle = new CheckButton();
            rendertable.Attach(overlayTitle, 1, 2, 4, 5,
                               AttachOptions.Fill,
                               AttachOptions.Fill, 0, 0);
            overlayTitle.CanFocus = false;
            overlayTitle.Show();
            overlayTitle.Active   = App.Current.Config.OverlayTitle;
            overlayTitle.Toggled += (sender, e) => {
                App.Current.Config.OverlayTitle = overlayTitle.Active;
            };

            addWatermark = new CheckButton();
            rendertable.Attach(addWatermark, 1, 2, 5, 6,
                               AttachOptions.Fill,
                               AttachOptions.Fill, 0, 0);
            addWatermark.CanFocus = false;
            addWatermark.Show();

            watermarkSelector.ResetButtonHeight      = RESET_BUTTON_HEIGHT;
            watermarkSelector.ImageButtonPressEvent += HandleChangeWatermarkClicked;
            watermarkSelector.ResetButton.Clicked   += (sender, e) => ResetWatermark();
            if (App.Current.Config.Watermark != null)
            {
                SetWatermarkPreview();
            }
            else
            {
                ResetWatermark();
            }

            if (App.Current.LicenseManager != null)
            {
                bool canRemoveWatermark = App.Current.LicenseLimitationsService.CanExecute(VASFeature.Watermark.ToString());
                addWatermark.Sensitive = canRemoveWatermark;
                if (!canRemoveWatermark)
                {
                    addWatermark.Active    = true;
                    watermarkLabel.Visible = watermarkSelector.Visible = false;
                }
                else
                {
                    addWatermark.Active    = App.Current.Config.AddWatermark;
                    watermarkLabel.Visible = watermarkSelector.Visible = addWatermark.Active;
                }
            }

            addWatermark.Toggled += (sender, e) => {
                App.Current.Config.AddWatermark = addWatermark.Active;
                watermarkLabel.Visible          = watermarkSelector.Visible = addWatermark.Active;
            };

            SizeGroup sgroup  = new SizeGroup(SizeGroupMode.Horizontal);
            SizeGroup sgroup2 = new SizeGroup(SizeGroupMode.Horizontal);

            foreach (Widget w in generaltable)
            {
                if (w is Label)
                {
                    sgroup.AddWidget(w);
                }
                else
                {
                    sgroup2.AddWidget(w);
                }
            }
            foreach (Widget w in capturetable)
            {
                if (w is Label)
                {
                    sgroup.AddWidget(w);
                }
                else
                {
                    sgroup2.AddWidget(w);
                }
            }
            foreach (Widget w in rendertable)
            {
                if (w is Label)
                {
                    sgroup.AddWidget(w);
                }
                else
                {
                    sgroup2.AddWidget(w);
                }
            }
        }
Exemplo n.º 16
0
        void FillTags(Project project, TimelineEvent evt)
        {
            Dictionary <string, List <Tag> > tagsByGroup;
            SizeGroup sgroup = new SizeGroup(SizeGroupMode.Horizontal);

            if (evt.EventType is AnalysisEventType)
            {
                tagsByGroup = (evt.EventType as AnalysisEventType).TagsByGroup;
            }
            else
            {
                tagsByGroup = new Dictionary <string, List <Tag> > ();
            }

            tagsByGroup = tagsByGroup.Concat(project.Dashboard.CommonTagsByGroup)
                          .ToDictionary(x => x.Key, x => x.Value);

            tagsvbox.PackStart(new HSeparator());
            foreach (string grp in tagsByGroup.Keys)
            {
                HBox        box       = new HBox();
                Label       label     = new Label(String.IsNullOrEmpty(grp) ? Catalog.GetString("Common tags") : grp);
                List <Tag>  tags      = tagsByGroup [grp];
                Table       tagstable = new Table((uint)(tags.Count / TAGS_PER_ROW), TAGS_PER_ROW, true);
                RadioButton first     = null;
                Tag         noneTag   = new Tag(Catalog.GetString("None"));

                label.WidthRequest = 200;
                if (!String.IsNullOrEmpty(grp))
                {
                    tags.Insert(0, noneTag);
                }

                for (int i = 0; i < tags.Count; i++)
                {
                    uint        row_top, row_bottom, col_left, col_right;
                    Tag         t = tags [i];
                    CheckButton tb;

                    if (String.IsNullOrEmpty(grp))
                    {
                        tb = new CheckButton(t.Value);
                    }
                    else
                    {
                        if (first == null)
                        {
                            tb = first = new RadioButton(t.Value);
                        }
                        else
                        {
                            tb = new RadioButton(first, t.Value);
                        }
                    }
                    tb.Active   = evt.Tags.Contains(t);
                    tb.Toggled += (sender, e) => {
                        if (tb.Active && t != noneTag)
                        {
                            evt.Tags.Add(t);
                        }
                        else
                        {
                            evt.Tags.Remove(t);
                        }
                    };
                    row_top    = (uint)(i / tagstable.NColumns);
                    row_bottom = (uint)row_top + 1;
                    col_left   = (uint)i % tagstable.NColumns;
                    col_right  = (uint)col_left + 1;
                    tagstable.Attach(tb, col_left, col_right, row_top, row_bottom);
                }
                sgroup.AddWidget(label);
                box.PackStart(label, false, true, 0);
                box.PackEnd(tagstable, true, true, 0);
                box.Spacing = 5;
                tagsvbox.PackStart(box, false, true, 0);
                tagsvbox.PackStart(new HSeparator());
            }
            tagsvbox.ShowAll();
        }