FillComboBox() public static method

Fills the combo box.
public static FillComboBox ( Gtk combo, List items, bool editable, string currentValue ) : void
combo Gtk /// Combo. ///
items List /// Items. ///
editable bool /// Editable. ///
currentValue string /// Current value. ///
return void
コード例 #1
0
        public void Fill()
        {
            if (_eventLock.Lock())
            {
                if (Info != null)
                {
                    if (Editable)
                    {
                        SupportMethods.FillComboBox(comboContainer, MediaConvertGUIConfiguration.ContainersAsList(true), Editable, Info.TargetContainer.Name);
                    }
                    else
                    {
                        SupportMethods.FillComboBox(comboContainer, new List <string>()
                        {
                            Info.TargetContainer.Name
                        }, Editable, Info.TargetContainer.Name);
                    }
                }
                else
                {
                    SupportMethods.ClearCombo(comboContainer);
                }

                imageContainer.Visible = comboContainer.Active > 0;
                _eventLock.Unlock();
            }
        }
コード例 #2
0
        public void Fill()
        {
            if (_eventLock.Lock())
            {
                var activeTrack         = SelectedTrack;
                var activeTrackAsString = String.Empty;

                // filling tracks combo
                var trackStrings = new List <string>();
                if (Info != null && Info.AudioTracks.Count > 0)
                {
                    foreach (var kvp in Info.AudioTracks)
                    {
                        trackStrings.Add(kvp.Key.ToString());
                        if ((activeTrack == kvp.Value))
                        {
                            activeTrackAsString = kvp.Key.ToString();
                        }
                    }
                }
                SupportMethods.FillComboBox(comboTracks, trackStrings, true, activeTrackAsString);

                // filling selected track
                if (activeTrack != null)
                {
                    // channels
                    var channelsStrings = new List <string>()
                    {
                        "1", "2"
                    };
                    var activeChannelAsString = "";

                    if ((activeTrack.Channels == 1) || (activeTrack.Channels == 2))
                    {
                        activeChannelAsString = activeTrack.Channels.ToString();
                    }
                    SupportMethods.FillComboBox(comboChannels, channelsStrings, Editable, activeChannelAsString);

                    // codec
                    if (Editable)
                    {
                        frameAudioOptions.Visible = (activeTrack.TargetAudioCodec.Name != "none") &&
                                                    (activeTrack.TargetAudioCodec.Name != "copy");

                        SupportMethods.FillComboBox(comboCodec, MediaConvertGUIConfiguration.AudioCodecsAsList(true), true, activeTrack.TargetAudioCodec.Name);
                    }
                    else
                    {
                        frameAudioOptions.Visible = true;
                        SupportMethods.FillComboBox(comboCodec, new List <string>()
                        {
                            activeTrack.Codec
                        }, false, activeTrack.Codec);
                    }

                    SupportMethods.FillComboBoxEntry(comboSampleRate, MediaConvertGUIConfiguration.DefaultSamplingRates, activeTrack.SamplingRateHz, Editable);
                    SupportMethods.FillComboBoxEntry(comboBitrate, MediaConvertGUIConfiguration.DefaultAudioBitrates, activeTrack.BitrateKbps, Editable);

                    labelTrackSze.Text = activeTrack.HumanReadableStreamSize;
                }
                else
                {
                    SupportMethods.ClearCombo(comboChannels);
                    SupportMethods.ClearCombo(comboCodec);

                    SupportMethods.ClearCombo(comboBitrate);
                    SupportMethods.ClearCombo(comboSampleRate);

                    frameAudioOptions.Visible = false;

                    labelTrackSze.Text = String.Empty;
                }

                image.Visible = comboCodec.Active > 0;

                _eventLock.Unlock();
            }
        }
コード例 #3
0
        public void Fill()
        {
            if (_eventLock.Lock())
            {
                var defaultAspects = new List <string> {
                    "16:9", "4:3"
                };
                var frameRates = new List <string> {
                    "23.976", "25"
                };

                var chBoxesVisible = false;

                //textviewRawOutput.Buffer.Text = MovieInfo.RawMediaInfoOutput;
                if (MovieInfo != null && MovieInfo.FirstVideoTrack != null)
                {
                    var m = MovieInfo.FirstVideoTrack;

                    chBoxResolution.Active = MovieInfo.EditResolution;
                    chBoxAspect.Active     = MovieInfo.EditAspect;
                    chBoxBitRate.Active    = MovieInfo.EditBitRate;
                    chBoxFrameRate.Active  = MovieInfo.EditFrameRate;
                    chBoxRotation.Active   = MovieInfo.EditRotation;

                    if (MovieInfo.EditResolution)
                    {
                        entryWidth.Text       = m.Width.ToString();
                        entryHeight.Text      = m.Height.ToString();
                        entryPixelAspect.Text = m.PixelAspect.ToString();
                        entryRealWidth.Text   = m.RealWidth.ToString();
                    }
                    else
                    {
                        entryHeight.Text      = String.Empty;
                        entryPixelAspect.Text = String.Empty;
                        entryWidth.Text       = String.Empty;
                        entryRealWidth.Text   = String.Empty;
                    }
                    entryWidth.Sensitive = entryHeight.Sensitive = MovieInfo.EditResolution;

                    if (MovieInfo.EditAspect)
                    {
                        // fill aspect ratio combo
                        SupportMethods.FillComboBoxEntry(comboAspect, defaultAspects, m.Aspect, false, Editable);
                    }
                    else
                    {
                        SupportMethods.ClearCombo(comboAspect);
                    }
                    comboAspect.Sensitive = MovieInfo.EditAspect;

                    if (MovieInfo.EditFrameRate)
                    {
                        // fill frame rate combo
                        SupportMethods.FillComboBoxEntry(comboFrameRate, frameRates, m.FrameRate.ToString(), true, Editable);
                    }
                    else
                    {
                        SupportMethods.ClearCombo(comboFrameRate);
                    }
                    comboFrameRate.Sensitive = MovieInfo.EditFrameRate;


                    if (MovieInfo.EditBitRate)
                    {
                        SupportMethods.FillComboBoxEntry(comboBitRate, MediaConvertGUIConfiguration.DefaultVideoBitRates, m.BitrateKbps, Editable);
                    }
                    else
                    {
                        SupportMethods.ClearCombo(comboBitRate);
                    }
                    comboBitRate.Sensitive = MovieInfo.EditBitRate;


                    if (MovieInfo.EditRotation)
                    {
                        SupportMethods.FillComboBoxEntry(comboRotation, MediaInfo.DefaultRotationAngles, MovieInfo.FirstVideoTrack.RotatationAngle, Editable);
                    }
                    else
                    {
                        SupportMethods.ClearCombo(comboRotation);
                    }
                    comboRotation.Sensitive = MovieInfo.EditRotation && !MovieInfo.AutoRotate;
                    checkAutorotate.Active  = MovieInfo.AutoRotate;
                    chBoxRotation.Active    = MovieInfo.EditRotation;

                    if (Editable)
                    {
                        chBoxesVisible = true;

                        SupportMethods.FillComboBox(comboCodec, MediaConvertGUIConfiguration.VideoCodecsAsList(true), Editable, MovieInfo.TargetVideoCodec.Name);
                    }
                    else
                    {
                        SupportMethods.FillComboBox(comboCodec, new List <string>()
                        {
                            m.Codec
                        }, Editable, m.Codec);
                    }

                    m.ReComputeStreamSizeByBitrate();
                    labelTrackSize.Text = m.HumanReadableStreamSize;
                }
                else
                {
                    entryWidth.Text       = String.Empty;
                    entryRealWidth.Text   = String.Empty;
                    entryHeight.Text      = String.Empty;
                    entryPixelAspect.Text = String.Empty;


                    SupportMethods.ClearCombo(comboCodec);
                    labelTrackSize.Text = String.Empty;

                    SupportMethods.ClearCombo(comboBitRate);
                    SupportMethods.ClearCombo(comboAspect);
                    SupportMethods.ClearCombo(comboFrameRate);
                    SupportMethods.ClearCombo(comboRotation);
                }

                imageCodec.Visible = comboCodec.Active > 0;

                frameVideooptions.Visible =
                    (MovieInfo != null) &&
                    (MovieInfo.FirstVideoTrack != null) &&
                    (((Editable) && (comboCodec.Active > 0)) || !Editable);

                chBoxAspect.Visible = chBoxResolution.Visible = chBoxBitRate.Visible = chBoxFrameRate.Visible = chBoxRotation.Visible = checkAutorotate.Visible = chBoxesVisible;

                _eventLock.Unlock();
            }
        }