ComboMakeActive() public static method

public static ComboMakeActive ( ComboBox myCombo, string searched ) : int
myCombo ComboBox
searched string
return int
Beispiel #1
0
    private void on_combo_continents_changed(object o, EventArgs args)
    {
        if (UtilGtk.ComboGetActive(combo_continents) == Catalog.GetString(Constants.ContinentUndefined))
        {
            countries [0]             = Constants.CountryUndefinedID + ":" + Constants.CountryUndefined + ":" + Catalog.GetString(Constants.CountryUndefined);
            countriesTranslated       = new String[1];
            countriesTranslated [0]   = Catalog.GetString(Constants.CountryUndefined);
            combo_countries.Sensitive = false;
        }
        else
        {
            //get the active continent
            string continentEnglish = Util.FindOnArray(':', 1, 0, UtilGtk.ComboGetActive(combo_continents), continents);
            countries = SqliteCountry.SelectCountriesOfAContinent(continentEnglish, true);             //put undefined first

            //create countries translated, only with translated stuff
            countriesTranslated = new String[countries.Length];
            int i = 0;
            foreach (string row in countries)
            {
                string [] myStrFull = row.Split(new char[] { ':' });
                countriesTranslated[i++] = myStrFull[2];
            }
        }
        //sort array (except first row)
        System.Array.Sort(countriesTranslated, 1, countriesTranslated.Length - 1);

        UtilGtk.ComboUpdate(combo_countries, countriesTranslated, "");
        combo_countries.Active = UtilGtk.ComboMakeActive(countriesTranslated,
                                                         Catalog.GetString(Constants.CountryUndefined));

        combo_countries.Sensitive = true;

        on_entries_required_changed(new object(), new EventArgs());
    }
    private void ItemToggled(object o, ToggledArgs args)
    {
        int      column = 1;
        TreeIter iter;

        if (store.GetIter(out iter, new TreePath(args.Path)))
        {
            //Log.WriteLine(args.Path);
            if (!Util.FoundInArrayList(nonSensitiveRows,
                                       Convert.ToInt32(args.Path)))
            {
                bool val = (bool)store.GetValue(iter, column);
                //Log.WriteLine (string.Format("toggled {0} with value {1}", args.Path, !val));

                store.SetValue(iter, column, !val);

                combo_all_none_selected.Active =
                    UtilGtk.ComboMakeActive(
                        comboCheckBoxesOptions, Catalog.GetString("Selected"));

                //check if there are rows checked for having sensitive or not
                //buttonRecuperateChangeSensitiveness();

                hbox_error.Hide();
            }
            else
            {
                label_error.Text = "Cannot select rows without data";
                hbox_error.Show();
            }
        }
    }
Beispiel #3
0
    private void createComboSpeciallities(int sportID)
    {
        combo_speciallities = ComboBox.NewText();
        speciallities       = SqliteSpeciallity.SelectAll(true, sportID);   //show undefined, filter by sport

        //first value has to be any
        speciallities[0] = "-1:" + Constants.Any + ":" + Catalog.GetString(Constants.Any);

        //create speciallities translated, only with translated stuff
        speciallitiesTranslated = new String[speciallities.Length];
        int i = 0;

        foreach (string row in speciallities)
        {
            string [] myStrFull = row.Split(new char[] { ':' });
            speciallitiesTranslated[i++] = myStrFull[2];
        }

        //sort array (except first row)
        System.Array.Sort(speciallities, 1, speciallities.Length - 1);

        UtilGtk.ComboUpdate(combo_speciallities, speciallitiesTranslated, "");
        combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                             Catalog.GetString(Constants.Any));

        hbox_combo_speciallities.PackStart(combo_speciallities, true, true, 0);
        hbox_combo_speciallities.ShowAll();
        combo_speciallities.Sensitive = true;
        combo_speciallities.Changed  += new EventHandler(on_combo_other_changed);
        UtilGtk.ComboPackShowAndSensitive(hbox_combo_speciallities, combo_speciallities);
    }
Beispiel #4
0
    private void createComboSports()
    {
        combo_sports = ComboBox.NewText();
        sports       = SqliteSport.SelectAll();

        //first value has to be any
        sports[0] = Constants.SportUndefinedID + ":" +                                //no problem using the undefinedID
                    Constants.SportAny + ":" + Catalog.GetString(Constants.SportAny); //is "--Any" to be the first in sort

        //create sports translated, only with translated stuff
        sportsTranslated = new String[sports.Length];
        int i = 0;

        foreach (string row in sports)
        {
            string [] myStrFull = row.Split(new char[] { ':' });
            sportsTranslated[i++] = myStrFull[2];
        }

        //sort array (except second row)
        System.Array.Sort(sportsTranslated, 2, sportsTranslated.Length - 2);

        UtilGtk.ComboUpdate(combo_sports, sportsTranslated, "");
        combo_sports.Active = UtilGtk.ComboMakeActive(sportsTranslated,
                                                      Catalog.GetString(Constants.SportAny));

        combo_sports.Changed += new EventHandler(on_combo_sports_changed);

        UtilGtk.ComboPackShowAndSensitive(hbox_combo_sports, combo_sports);
    }
Beispiel #5
0
 private void createComboSexes()
 {
     combo_sexes = ComboBox.NewText();
     UtilGtk.ComboUpdate(combo_sexes, sexes, "");
     combo_sexes.Active   = UtilGtk.ComboMakeActive(sexes, Catalog.GetString(Constants.Any));
     combo_sexes.Changed += new EventHandler(on_combo_other_changed);
     UtilGtk.ComboPackShowAndSensitive(hbox_combo_sexes, combo_sexes);
 }
Beispiel #6
0
 private void createComboTestTypes()
 {
     combo_test_types = ComboBox.NewText();
     UtilGtk.ComboUpdate(combo_test_types, testTypes, "");
     combo_test_types.Active   = UtilGtk.ComboMakeActive(testTypes, Catalog.GetString(Constants.UndefinedDefault));
     combo_test_types.Changed += new EventHandler(on_combo_test_types_changed);
     UtilGtk.ComboPackShowAndSensitive(hbox_combo_test_types, combo_test_types);
 }
Beispiel #7
0
 private void createComboVariables()
 {
     combo_variables = ComboBox.NewText();
     variables       = Util.StringToStringArray(Constants.UndefinedDefault);
     UtilGtk.ComboUpdate(combo_variables, variables, "");
     combo_variables.Active   = UtilGtk.ComboMakeActive(variables, Catalog.GetString(Constants.UndefinedDefault));
     combo_variables.Changed += new EventHandler(on_combo_other_changed);
     UtilGtk.ComboPackShowAndSensitive(hbox_combo_variables, combo_variables);
 }
Beispiel #8
0
 private void createComboAges1()
 {
     combo_ages1 = ComboBox.NewText();
     UtilGtk.ComboUpdate(combo_ages1, ages1, "");
     combo_ages1.Active   = UtilGtk.ComboMakeActive(ages1, Catalog.GetString(Constants.Any));
     combo_ages1.Changed += new EventHandler(on_combo_ages1_changed);
     UtilGtk.ComboPackShowAndSensitive(hbox_combo_ages1, combo_ages1);
     spin_ages1.Sensitive    = false;
     label_age_and.Sensitive = false;
 }
Beispiel #9
0
 public void MakeActive(string nameEnglish)
 {
     foreach (SelectTypes type in l_types)
     {
         if (type.NameTranslated == nameEnglish)
         {
             combo.Active = UtilGtk.ComboMakeActive(combo, type.NameTranslated);
         }
     }
 }
    public void SetComboValues(string [] values, string current)
    {
        combo = ComboBox.NewText();
        UtilGtk.ComboUpdate(combo, values, "");

        hbox_combo.PackStart(combo, true, true, 0);
        hbox_combo.ShowAll();
        combo.Sensitive = true;

        combo.Active = UtilGtk.ComboMakeActive(values, current);
    }
Beispiel #11
0
    protected void createComboEventType(Event myEvent)
    {
        combo_eventType = ComboBox.NewText();
        string [] myTypes = findTypes(myEvent);
        UtilGtk.ComboUpdate(combo_eventType, myTypes, "");
        combo_eventType.Active = UtilGtk.ComboMakeActive(myTypes, myEvent.Type);
        hbox_combo_eventType.PackStart(combo_eventType, true, true, 0);
        hbox_combo_eventType.ShowAll();

        createSignal();
    }
Beispiel #12
0
 private void createComboAges2()
 {
     combo_ages2 = ComboBox.NewText();
     string [] ages2 = Util.StringToStringArray(Constants.Any);
     UtilGtk.ComboUpdate(combo_ages2, ages2, "");
     combo_ages2.Active   = UtilGtk.ComboMakeActive(ages2, Catalog.GetString(Constants.Any));
     combo_ages2.Changed += new EventHandler(on_combo_ages2_changed);
     UtilGtk.ComboPackShowAndSensitive(hbox_combo_ages2, combo_ages2);
     combo_ages2.Sensitive = false;
     spin_ages2.Sensitive  = false;
 }
    private void createComboEncoderAutomaticVariable()
    {
        combo_encoder_variable_automatic = ComboBox.NewText();
        string [] values = { Constants.MeanSpeed, Constants.MaxSpeed, Constants.MeanForce, Constants.MaxForce, Constants.MeanPower, Constants.PeakPower };
        UtilGtk.ComboUpdate(combo_encoder_variable_automatic, values, "");
        combo_encoder_variable_automatic.Active = UtilGtk.ComboMakeActive(combo_encoder_variable_automatic, "Mean power");

        hbox_combo_encoder_variable_automatic.PackStart(combo_encoder_variable_automatic, false, false, 0);
        hbox_combo_encoder_variable_automatic.ShowAll();
        combo_encoder_variable_automatic.Sensitive = true;
    }
Beispiel #14
0
    private void createComboEvaluators()
    {
        combo_evaluators = ComboBox.NewText();

        //first value (any) should be translated
        evaluators[0] = Constants.AnyID.ToString() + ":" + Catalog.GetString(Constants.Any);

        UtilGtk.ComboUpdate(combo_evaluators, evaluators, "");
        combo_evaluators.Active   = UtilGtk.ComboMakeActive(combo_evaluators, Catalog.GetString(Constants.Any));
        combo_evaluators.Changed += new EventHandler(on_combo_other_changed);
        UtilGtk.ComboPackShowAndSensitive(hbox_combo_evaluators, combo_evaluators);
    }
    void showWidgets(Constants.BellModes bellMode, Constants.EncoderVariablesCapture encoderMainVariable, EncoderRhythm encoderRhythm)
    {
        frame_best_and_worst.Hide();
        frame_conditions.Hide();
        hbox_jump_best_worst.Hide();
        hbox_run_best_worst.Hide();
        hbox_jump_conditions.Hide();
        hbox_run_conditions.Hide();
        frame_encoder_automatic_conditions.Hide();
        vbox_encoder_manual.Hide();
        notebook_encoder_conditions.Hide();
        vbox_encoder_stuff.Hide();

        notebook_main.GetNthPage(RHYTHMPAGE).Hide();
        notebook_main.ShowTabs = false;

        if (bellMode == Constants.BellModes.JUMPS)
        {
            frame_best_and_worst.Show();
            hbox_jump_best_worst.Show();
            hbox_jump_conditions.Show();
            frame_conditions.Show();
        }
        else if (bellMode == Constants.BellModes.RUNS)
        {
            frame_best_and_worst.Show();
            hbox_run_best_worst.Show();
            hbox_run_conditions.Show();
            frame_conditions.Show();
        }
        else             //encoder (grav and inertial)
        {
            vbox_encoder_stuff.Show();
            frame_encoder_automatic_conditions.Show();
            notebook_main.ShowTabs = true;

            vbox_encoder_manual.Show();
            if (checkbutton_encoder_show_manual_feedback.Active)
            {
                notebook_encoder_conditions.Show();
            }

            combo_encoder_main_variable.Active = UtilGtk.ComboMakeActive(combo_encoder_main_variable,
                                                                         Constants.GetEncoderVariablesCapture(encoderMainVariable));

            notebook_main.GetNthPage(RHYTHMPAGE).Show();
            encoder_rhythm_set_values(encoderRhythm);
        }

        label_test_sound_result.Text = "";
    }
Beispiel #16
0
    private void on_combo_ages1_changed(object o, EventArgs args)
    {
        string age1 = UtilGtk.ComboGetActive(combo_ages1);

        string [] ages2;

        //if (age1 == Catalog.GetString(Constants.Any) ||	age1 == equalThan) {
        if (age1 == Catalog.GetString(Constants.Any))
        {
            if (age1 == Catalog.GetString(Constants.Any))              //zero values
            {
                spin_ages1.Sensitive = false;
            }
            else
            {
                spin_ages1.Sensitive = true;
            }

            //no value 2
            label_age_and.Sensitive = false;
            combo_ages2.Sensitive   = false;
            spin_ages2.Sensitive    = false;

            ages2 = Util.StringToStringArray(Constants.Any);
        }
        else
        {
            spin_ages1.Sensitive    = true;
            label_age_and.Sensitive = true;
            combo_ages2.Sensitive   = true;
            spin_ages2.Sensitive    = true;
            //if (age1 == lowerThan || age1 == lowerOrEqualThan)
            if (age1 == lowerThan)
            {
                ages2 = ages2Higher;
            }
            else
            {
                ages2 = ages2Lower;
            }
        }

        UtilGtk.ComboUpdate(combo_ages2, ages2, "");
        combo_ages2.Active = UtilGtk.ComboMakeActive(ages2, Catalog.GetString(Constants.Any));

        on_entries_required_changed(new object(), new EventArgs());
    }
Beispiel #17
0
    private void createComboCountries()
    {
        combo_countries = ComboBox.NewText();

        countries = new String[1];
        //record countries with id:english name:translatedName
        countries [0] = Constants.CountryUndefinedID + ":" + Constants.CountryUndefined + ":" + Catalog.GetString(Constants.CountryUndefined);

        string [] myCountries = new String[1];
        myCountries [0] = Catalog.GetString(Constants.CountryUndefined);
        UtilGtk.ComboUpdate(combo_countries, myCountries, "");
        combo_countries.Active = UtilGtk.ComboMakeActive(myCountries,
                                                         Catalog.GetString(Constants.CountryUndefined));

        combo_countries.Changed += new EventHandler(on_combo_other_changed);
        UtilGtk.ComboPackShowAndSensitive(hbox_combo_countries, combo_countries);
    }
    private void putValuesStoredPreviously(double d, List <double> list_d, double D, int anglePush, int angleWeight,
                                           int inertia, int extraWeightGrams, double extraWeightLength,
                                           bool has_gearedDown, string gearedUpDisplay)
    {
        if (d != -1)
        {
            spin_d.Value = d;
        }
        if (list_d != null && list_d.Count > 0)
        {
            //when there's 1 value in list_d, first value (0) in combo should be selected
            combo_d_num.Active = list_d.Count - 1;            //this will perform a reset on spinbuttons

            int i = 0;
            foreach (Gtk.SpinButton sp in hbox_list_d.Children)
            {
                sp.Value = list_d[i++];
            }
        }

        if (D != -1)
        {
            spin_D.Value = D;
        }
        if (anglePush != -1)
        {
            spin_angle_push.Value = anglePush;
        }
        if (angleWeight != -1)
        {
            spin_angle_weight.Value = angleWeight;
        }
        if (inertia != -1)
        {
            spin_inertia_machine.Value = inertia;
        }
        if (has_gearedDown)
        {
            combo_gearedUp.Active = UtilGtk.ComboMakeActive(combo_gearedUp, gearedUpDisplay);
        }

        spin_inertia_mass.Value   = extraWeightGrams;
        spin_inertia_length.Value = extraWeightLength;
    }
Beispiel #19
0
    private void createComboLevels()
    {
        combo_levels = ComboBox.NewText();
        levels       = Constants.Levels;

        //first value has to be any (but is ok to put the id value of the LevelUndefinedID)
        levels[0] = Constants.LevelUndefinedID.ToString() + ":" + Catalog.GetString(Constants.Any);

        UtilGtk.ComboUpdate(combo_levels, levels, "");
        combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                      Constants.LevelUndefinedID.ToString() + ":" +
                                                      Catalog.GetString(Constants.Any));

        hbox_combo_levels.PackStart(combo_levels, true, true, 0);
        hbox_combo_levels.ShowAll();
        combo_levels.Sensitive = false;         //level is shown when sport is not "undefined" and not "none"
        combo_levels.Changed  += new EventHandler(on_combo_other_changed);
        UtilGtk.ComboPackShowAndSensitive(hbox_combo_levels, combo_levels);
    }
    public void CreateComboCheckBoxes()
    {
        if (hbox_combo_all_none_selected.Children.Length > 0)
        {
            hbox_combo_all_none_selected.Remove(combo_all_none_selected);
        }

        combo_all_none_selected = ComboBox.NewText();
        UtilGtk.ComboUpdate(combo_all_none_selected, comboCheckBoxesOptions, "");

        //combo_all_none_selected.DisableActivate ();
        combo_all_none_selected.Changed += new EventHandler(on_combo_all_none_selected_changed);

        hbox_combo_all_none_selected.PackStart(combo_all_none_selected, true, true, 0);
        hbox_combo_all_none_selected.ShowAll();
        combo_all_none_selected.Sensitive = true;

        combo_all_none_selected.Active =
            UtilGtk.ComboMakeActive(comboCheckBoxesOptions, Catalog.GetString("Selected"));
    }
Beispiel #21
0
    private void createComboCamera(string [] devices, int current)
    {
        combo_camera = ComboBox.NewText();

        if (devices.Length == 0)
        {
            devices = Util.StringToStringArray(Constants.CameraNotFound);
            current = 0;
        }

        UtilGtk.ComboUpdate(combo_camera, devices, "");
        hbox_combo_camera.PackStart(combo_camera, true, true, 0);
        hbox_combo_camera.ShowAll();

        if (current >= devices.Length)
        {
            current = 0;
        }

        combo_camera.Active = UtilGtk.ComboMakeActive(devices, devices[current]);
    }
Beispiel #22
0
    private void createComboContinents()
    {
        combo_continents = ComboBox.NewText();
        continents       = Constants.Continents;
        //first value has to be any
        continents[0] = Constants.Any + ":" + Catalog.GetString(Constants.Any);

        //create continentsTranslated, only with translated stuff
        continentsTranslated = new String[Constants.Continents.Length];
        int i = 0;

        foreach (string continent in continents)
        {
            continentsTranslated[i++] = Util.FetchName(continent);
        }

        UtilGtk.ComboUpdate(combo_continents, continentsTranslated, "");
        combo_continents.Active = UtilGtk.ComboMakeActive(continentsTranslated,
                                                          Catalog.GetString(Constants.Any));

        combo_continents.Changed += new EventHandler(on_combo_continents_changed);
        UtilGtk.ComboPackShowAndSensitive(hbox_combo_continents, combo_continents);
    }
    private void selectedModeChanged()
    {
        EncoderConfiguration ec = (EncoderConfiguration)list[listCurrent];

        pixbuf = new Pixbuf(null, Util.GetImagePath(false) + ec.image);
        image_encoder_configuration.Pixbuf = pixbuf;

        TextBuffer tb1 = new TextBuffer(new TextTagTable());

        tb1.Text        = "[" + ec.code + "]\n" + ec.text;
        textview.Buffer = tb1;

        hbox_d.Visible = (ec.has_d && !ec.has_inertia);
        vbox_d.Visible = (ec.has_d && ec.has_inertia);

        hbox_D.Visible               = ec.has_D;
        hbox_angle_push.Visible      = ec.has_angle_push;
        hbox_angle_weight.Visible    = ec.has_angle_weight;
        hbox_inertia.Visible         = ec.has_inertia;
        hbox_inertia_mass.Visible    = ec.has_inertia;
        hbox_inertia_length.Visible  = ec.has_inertia;
        vbox_inertia_calcule.Visible = ec.has_inertia;

        hbox_gearedUp.Visible = ec.has_gearedDown;
        if (ec.has_gearedDown)
        {
            combo_gearedUp.Active = UtilGtk.ComboMakeActive(combo_gearedUp, "2");
        }

        label_count.Text = (listCurrent + 1).ToString() + " / " + list.Count.ToString();

        //hide inertia moment calculation options when change mode
        if (sideMode == sideModes.CAPTUREINERTIAL)
        {
            showHideSide(sideModes.HIDDEN);
        }
    }
    private void selectedModeChanged()
    {
        EncoderConfiguration ec = (EncoderConfiguration)list[listCurrent];

        pixbuf = new Pixbuf(null, Util.GetImagePath(false) + ec.image);
        image_encoder_configuration.Pixbuf = pixbuf;

        TextBuffer tb1 = new TextBuffer(new TextTagTable());

        tb1.Text        = "[" + ec.code + "]\n" + ec.text;
        textview.Buffer = tb1;

        hbox_d.Visible = (ec.has_d && !ec.has_inertia);
        vbox_d.Visible = (ec.has_d && ec.has_inertia);

        hbox_D.Visible               = ec.has_D;
        hbox_angle_push.Visible      = ec.has_angle_push;
        hbox_angle_weight.Visible    = ec.has_angle_weight;
        hbox_inertia.Visible         = ec.has_inertia;
        hbox_inertia_mass.Visible    = ec.has_inertia;
        hbox_inertia_length.Visible  = ec.has_inertia;
        vbox_inertia_calcule.Visible = (ec.has_inertia && !definedInConfig);

        hbox_gearedUp.Visible = ec.has_gearedDown;
        if (ec.has_gearedDown)
        {
            combo_gearedUp.Active = UtilGtk.ComboMakeActive(combo_gearedUp, "2");
        }

        label_count.Text = (listCurrent + 1).ToString() + " / " + list.Count.ToString();

        //hide inertia moment calculation options when change mode
        if (show_calcule_im)
        {
            on_button_encoder_capture_inertial_show_clicked(new object(), new EventArgs());
        }
    }
Beispiel #25
0
    private void createComboContinents()
    {
        combo_continents = ComboBox.NewText();
        continents       = Constants.Continents;

        //create continentsTranslated, only with translated stuff
        continentsTranslated = new String[Constants.Continents.Length];
        int i = 0;

        foreach (string continent in continents)
        {
            continentsTranslated[i++] = Util.FetchName(continent);
        }

        UtilGtk.ComboUpdate(combo_continents, continentsTranslated, "");
        combo_continents.Active = UtilGtk.ComboMakeActive(continentsTranslated,
                                                          Catalog.GetString(Constants.ContinentUndefined));

        combo_continents.Changed += new EventHandler(on_combo_continents_changed);

        hbox_combo_continents.PackStart(combo_continents, true, true, 0);
        hbox_combo_continents.ShowAll();
        combo_continents.Sensitive = true;
    }
Beispiel #26
0
    private void createComboLinux()
    {
        //string [] serial = Directory.GetFiles("/dev/", "ttyS*");
        string [] usbSerial    = Directory.GetFiles("/dev/", "ttyUSB*");
        string [] usbSerialMac = Directory.GetFiles("/dev/", "tty.usbserial*");
        string [] all          = Util.AddArrayString(usbSerial, usbSerialMac);

        string [] def = Util.StringToStringArray(Constants.ChronopicDefaultPortLinux);

        string [] allWithDef = Util.AddArrayString(def, all);

        UtilGtk.ComboUpdate(combo_linux1, allWithDef, Constants.ChronopicDefaultPortLinux);
        UtilGtk.ComboUpdate(combo_linux2, allWithDef, Constants.ChronopicDefaultPortLinux);
        UtilGtk.ComboUpdate(combo_linux3, allWithDef, Constants.ChronopicDefaultPortLinux);
        UtilGtk.ComboUpdate(combo_linux4, allWithDef, Constants.ChronopicDefaultPortLinux);

        foreach (ChronopicPortData a in cpd)
        {
            if (a.Num == 1)
            {
                combo_linux1.Active   = UtilGtk.ComboMakeActive(combo_linux1, a.Port);
                combo_linux1.Changed += new EventHandler(on_combo_changed);
                if (a.Connected)
                {
                    UtilGtk.ComboDelThisValue(combo_linux2, a.Port);
                    UtilGtk.ComboDelThisValue(combo_linux3, a.Port);
                    UtilGtk.ComboDelThisValue(combo_linux4, a.Port);
                }
            }
            else if (a.Num == 2)
            {
                combo_linux2.Active   = UtilGtk.ComboMakeActive(combo_linux2, a.Port);
                combo_linux2.Changed += new EventHandler(on_combo_changed);
                if (a.Connected)
                {
                    UtilGtk.ComboDelThisValue(combo_linux3, a.Port);
                    UtilGtk.ComboDelThisValue(combo_linux4, a.Port);
                }
            }
            else if (a.Num == 3)
            {
                combo_linux3.Active   = UtilGtk.ComboMakeActive(combo_linux3, a.Port);
                combo_linux3.Changed += new EventHandler(on_combo_changed);
                if (a.Connected)
                {
                    UtilGtk.ComboDelThisValue(combo_linux4, a.Port);
                }
            }
            else                 //4
            {
                combo_linux4.Active   = UtilGtk.ComboMakeActive(combo_linux4, a.Port);
                combo_linux4.Changed += new EventHandler(on_combo_changed);
            }
        }

        //encoder
        //this reduces the callbacks of combo change
        combo_linux_encoder.Sensitive = false;

        UtilGtk.ComboUpdate(combo_linux_encoder, allWithDef, encoderPort);

        combo_linux_encoder.Changed += new EventHandler(on_combo_changed);

        combo_linux_encoder.Active = UtilGtk.ComboMakeActive(allWithDef, encoderPort);

        combo_linux_encoder.Sensitive = true;
    }
Beispiel #27
0
    protected void fillDialog(Event myEvent)
    {
        fillWindowTitleAndLabelHeader();

        string id = myEvent.UniqueID.ToString();

        if (myEvent.Simulated == Constants.Simulated)
        {
            label_simulated.Show();
        }

        label_event_id_value.Text      = id;
        label_event_id_value.UseMarkup = true;

        if (showTv)
        {
            fillTv(myEvent);
        }
        else
        {
            label_tv_title.Hide();
            entry_tv_value.Hide();
            label_tv_units.Hide();
        }

        if (showTc)
        {
            fillTc(myEvent);
        }
        else
        {
            label_tc_title.Hide();
            entry_tc_value.Hide();
            label_tc_units.Hide();
        }

        if (showFall)
        {
            fillFall(myEvent);
        }
        else
        {
            label_fall_title.Hide();
            entry_fall_value.Hide();
            label_fall_units.Hide();
        }

        if (showDistance)
        {
            fillDistance(myEvent);
        }
        else
        {
            label_distance_title.Hide();
            entry_distance_value.Hide();
            label_distance_units.Hide();
        }

        if (showTime)
        {
            fillTime(myEvent);
        }
        else
        {
            label_time_title.Hide();
            entry_time_value.Hide();
            label_time_units.Hide();
        }

        if (showSpeed)
        {
            fillSpeed(myEvent);
        }
        else
        {
            label_speed_title.Hide();
            label_speed_value.Hide();
            label_speed_units.Hide();
        }

        if (showWeight)
        {
            fillWeight(myEvent);
        }
        else
        {
            label_weight_title.Hide();
            entry_weight_value.Hide();
            label_weight_units.Hide();
        }

        if (showLimited)
        {
            fillLimited(myEvent);
        }
        else
        {
            label_limited_title.Hide();
            label_limited_value.Hide();
        }

        if (showAngle)
        {
            fillAngle(myEvent);
        }
        else
        {
            label_angle_title.Hide();
            entry_angle_value.Hide();
            label_angle_units.Hide();
        }

        if (!showMistakes)
        {
            label_mistakes.Hide();
            spin_mistakes.Hide();
        }


        //also remove new line for old descriptions that used a textview
        string temp = Util.RemoveTildeAndColonAndDot(myEvent.Description);

        entry_description.Text = Util.RemoveNewLine(temp, true);

        createComboEventType(myEvent);

        if (!showType)
        {
            label_type_title.Hide();
            combo_eventType.Hide();
        }

        if (showRunStart)
        {
            fillRunStart(myEvent);
        }
        else
        {
            label_run_start_title.Hide();
            label_run_start_value.Hide();
        }

        ArrayList persons = SqlitePersonSession.SelectCurrentSessionPersons(
            myEvent.SessionID,
            false);                     //means: do not returnPersonAndPSlist

        string [] personsStrings = new String[persons.Count];
        int       i = 0;

        foreach (Person person in persons)
        {
            personsStrings[i++] = person.IDAndName(":");
        }

        combo_persons = ComboBox.NewText();
        UtilGtk.ComboUpdate(combo_persons, personsStrings, "");
        combo_persons.Active = UtilGtk.ComboMakeActive(personsStrings, myEvent.PersonID + ":" + myEvent.PersonName);

        oldPersonID = myEvent.PersonID;

        hbox_combo_person.PackStart(combo_persons, true, true, 0);
        hbox_combo_person.ShowAll();

        //show video if available
        videoFileName = Util.GetVideoFileName(myEvent.SessionID, typeOfTest, myEvent.UniqueID);
        if (File.Exists(videoFileName))
        {
            label_video_yes.Visible      = true;
            label_video_no.Visible       = false;
            button_video_watch.Sensitive = true;
            button_video_url.Sensitive   = true;
        }
        else
        {
            label_video_yes.Visible      = false;
            label_video_no.Visible       = true;
            button_video_watch.Sensitive = false;
            button_video_url.Sensitive   = false;
        }
    }
Beispiel #28
0
    private void on_combo_sports_changed(object o, EventArgs args)
    {
        if (o == null)
        {
            return;
        }

        //LogB.Information("changed");
        try {
            int sportID = Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_sports), sports));
            sport = SqliteSport.Select(false, sportID);

            if (Catalog.GetString(sport.Name) == Catalog.GetString(Constants.SportAny))
            {
                //if sport is undefined, level should be undefined, and unsensitive
                try {
                    combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                                  Constants.LevelUndefinedID.ToString() + ":" +
                                                                  Catalog.GetString(Constants.LevelUndefined));
                    combo_levels.Sensitive     = false;
                    combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                                         Catalog.GetString(Constants.SpeciallityUndefined));
                    label_speciallity.Hide();
                    combo_speciallities.Hide();
                }
                catch { LogB.Warning("do later"); }
            }
            else if (Catalog.GetString(sport.Name) == Catalog.GetString(Constants.SportNone))
            {
                //if sport is none, level should be sedentary and unsensitive
                try {
                    combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                                  Constants.LevelSedentaryID.ToString() + ":" +
                                                                  Catalog.GetString(Constants.LevelSedentary));
                    combo_levels.Sensitive = false;

                    combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                                         Catalog.GetString(Constants.SpeciallityUndefined));

                    label_speciallity.Hide();
                    combo_speciallities.Hide();
                }
                catch { LogB.Warning("do later"); }
            }
            else
            {
                //sport is not undefined and not none

                //if level is "sedentary", then change level to "undefined"
                if (UtilGtk.ComboGetActive(combo_levels) ==
                    Constants.LevelSedentaryID.ToString() + ":" +
                    Catalog.GetString(Constants.LevelSedentary))
                {
                    combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                                  Constants.LevelUndefinedID.ToString() + ":" +
                                                                  Catalog.GetString(Constants.LevelUndefined));
                }

                //show level
                combo_levels.Sensitive = true;

                if (sport.HasSpeciallities)
                {
                    combo_speciallities.Destroy();
                    createComboSpeciallities(sport.UniqueID);
                    label_speciallity.Show();
                    combo_speciallities.Show();
                }
                else
                {
                    LogB.Information("hide");
                    combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                                         Catalog.GetString(Constants.SpeciallityUndefined));
                    label_speciallity.Hide();
                    combo_speciallities.Hide();
                }
            }
        } catch {
            //LogB.Warning("do later");
        }

        on_entries_required_changed(new object(), new EventArgs());
        LogB.Information(sport.ToString());
    }
Beispiel #29
0
    static public PreferencesWindow Show(Preferences preferences)
    {
        if (PreferencesWindowBox == null)
        {
            PreferencesWindowBox = new PreferencesWindow();
        }

        PreferencesWindowBox.preferences = preferences;

        PreferencesWindowBox.createComboLanguage();

        PreferencesWindowBox.createComboCamera(UtilVideo.GetVideoDevices(), preferences.videoDeviceNum);

        string [] decs = { "1", "2", "3" };
        PreferencesWindowBox.combo_decimals.Active = UtilGtk.ComboMakeActive(
            decs, preferences.digitsNumber.ToString());

        if (preferences.showPower)
        {
            PreferencesWindowBox.checkbutton_power.Active = true;
        }
        else
        {
            PreferencesWindowBox.checkbutton_power.Active = false;
        }

        if (preferences.showStiffness)
        {
            PreferencesWindowBox.checkbutton_stiffness.Active = true;
        }
        else
        {
            PreferencesWindowBox.checkbutton_stiffness.Active = false;
        }

        if (preferences.showInitialSpeed)
        {
            PreferencesWindowBox.checkbutton_initial_speed.Active = true;
        }
        else
        {
            PreferencesWindowBox.checkbutton_initial_speed.Active = false;
        }

        if (preferences.showAngle)
        {
            PreferencesWindowBox.checkbutton_angle.Active = true;
        }
        else
        {
            PreferencesWindowBox.checkbutton_angle.Active = false;
        }


        if (preferences.showQIndex || preferences.showDjIndex)
        {
            PreferencesWindowBox.checkbutton_show_tv_tc_index.Active = true;
            if (preferences.showQIndex)
            {
                PreferencesWindowBox.radiobutton_show_q_index.Active  = true;
                PreferencesWindowBox.radiobutton_show_dj_index.Active = false;
            }
            else
            {
                PreferencesWindowBox.radiobutton_show_q_index.Active  = false;
                PreferencesWindowBox.radiobutton_show_dj_index.Active = true;
            }
        }
        else
        {
            PreferencesWindowBox.checkbutton_show_tv_tc_index.Active = false;
            PreferencesWindowBox.hbox_indexes.Hide();
        }

        if (preferences.askDeletion)
        {
            PreferencesWindowBox.checkbutton_ask_deletion.Active = true;
        }
        else
        {
            PreferencesWindowBox.checkbutton_ask_deletion.Active = false;
        }


        if (preferences.weightStatsPercent)
        {
            PreferencesWindowBox.radio_weight_percent.Active = true;
        }
        else
        {
            PreferencesWindowBox.radio_weight_kg.Active = true;
        }


        if (preferences.heightPreferred)
        {
            PreferencesWindowBox.radio_elevation_height.Active = true;
        }
        else
        {
            PreferencesWindowBox.radio_elevation_tf.Active = true;
        }


        if (preferences.metersSecondsPreferred)
        {
            PreferencesWindowBox.radio_speed_ms.Active = true;
        }
        else
        {
            PreferencesWindowBox.radio_speed_km.Active = true;
        }


        if (preferences.runSpeedStartArrival)
        {
            PreferencesWindowBox.radio_runs_speed_start_arrival.Active = true;
        }
        else
        {
            PreferencesWindowBox.radio_runs_speed_start_leaving.Active = true;
        }


        //start of double contacts stuff ----
        PreferencesWindowBox.checkbutton_runs_prevent_double_contact.Active =
            (preferences.runDoubleContactsMode != Constants.DoubleContact.NONE);
        PreferencesWindowBox.checkbutton_runs_i_prevent_double_contact.Active =
            (preferences.runIDoubleContactsMode != Constants.DoubleContact.NONE);

        PreferencesWindowBox.spinbutton_runs_prevent_double_contact.Value =
            preferences.runDoubleContactsMS;
        PreferencesWindowBox.spinbutton_runs_i_prevent_double_contact.Value =
            preferences.runIDoubleContactsMS;

        if (preferences.runDoubleContactsMode != Constants.DoubleContact.NONE)
        {
            if (preferences.runDoubleContactsMode == Constants.DoubleContact.FIRST)
            {
                PreferencesWindowBox.radio_runs_prevent_double_contact_first.Active = true;
            }
            else if (preferences.runDoubleContactsMode == Constants.DoubleContact.AVERAGE)
            {
                PreferencesWindowBox.radio_runs_prevent_double_contact_average.Active = true;
            }
            else             // Constants.DoubleContact.LAST  DEFAULT
            {
                PreferencesWindowBox.radio_runs_prevent_double_contact_last.Active = true;
            }
        }
        if (preferences.runIDoubleContactsMode != Constants.DoubleContact.NONE)
        {
            if (preferences.runIDoubleContactsMode == Constants.DoubleContact.FIRST)
            {
                PreferencesWindowBox.radio_runs_i_prevent_double_contact_first.Active = true;
            }
            else if (preferences.runIDoubleContactsMode == Constants.DoubleContact.LAST)
            {
                PreferencesWindowBox.radio_runs_i_prevent_double_contact_last.Active = true;
            }
            else             //Constants.DoubleContact.AVERAGE  DEFAULT
            {
                PreferencesWindowBox.radio_runs_i_prevent_double_contact_average.Active = true;
            }
        }
        //---- end of double contacts stuff


        if (preferences.CSVExportDecimalSeparator == "COMMA")
        {
            PreferencesWindowBox.radio_export_latin.Active = true;
        }
        else
        {
            PreferencesWindowBox.radio_export_non_latin.Active = true;
        }


        //encoder
        PreferencesWindowBox.checkbutton_encoder_propulsive.Active = preferences.encoderPropulsive;
        PreferencesWindowBox.spin_encoder_smooth_con.Value         = preferences.encoderSmoothCon;

        if (preferences.encoder1RMMethod == Constants.Encoder1RMMethod.NONWEIGHTED)
        {
            PreferencesWindowBox.radio_encoder_1RM_nonweighted.Active = true;
        }
        else if (preferences.encoder1RMMethod == Constants.Encoder1RMMethod.WEIGHTED)
        {
            PreferencesWindowBox.radio_encoder_1RM_weighted.Active = true;
        }
        else if (preferences.encoder1RMMethod == Constants.Encoder1RMMethod.WEIGHTED2)
        {
            PreferencesWindowBox.radio_encoder_1RM_weighted2.Active = true;
        }
        else         //(preferences.encoder1RMMethod == Constants.Encoder1RMMethod.WEIGHTED3)
        {
            PreferencesWindowBox.radio_encoder_1RM_weighted3.Active = true;
        }

        //done here and not in glade to be shown with the decimal point of user language
        PreferencesWindowBox.label_encoder_con.Text = (0.7).ToString();

        if (preferences.language == "")
        {
            PreferencesWindowBox.radio_language_detected.Active = true;
        }
        else
        {
            PreferencesWindowBox.radio_language_force.Active = true;
        }

        if (preferences.RGraphsTranslate)
        {
            PreferencesWindowBox.radio_graphs_translate.Active = true;
        }
        else
        {
            PreferencesWindowBox.radio_graphs_no_translate.Active = true;
        }

        //allow signal to be called
        PreferencesWindowBox.hbox_language_signalOn = true;

        if (preferences.useHeightsOnJumpIndexes)
        {
            PreferencesWindowBox.radio_use_heights_on_jump_indexes.Active = true;
        }
        else
        {
            PreferencesWindowBox.radio_do_not_use_heights_on_jump_indexes.Active = true;
        }

        if (preferences.encoderAutoSaveCurve == Constants.EncoderAutoSaveCurve.BEST)
        {
            PreferencesWindowBox.radio_encoder_auto_save_curve_best.Active = true;
        }
        else if (preferences.encoderAutoSaveCurve == Constants.EncoderAutoSaveCurve.ALL)
        {
            PreferencesWindowBox.radio_encoder_auto_save_curve_all.Active = true;
        }
        else
        {
            PreferencesWindowBox.radio_encoder_auto_save_curve_none.Active = true;
        }


        PreferencesWindowBox.preferences_win.Show();
        return(PreferencesWindowBox);
    }
Beispiel #30
0
    private void fillDialog()
    {
        entry_name.Text  = eval.Name;
        entry_email.Text = eval.Email;

        Console.Write(creating.ToString());
        if (creating)
        {
            label_date.Text = Catalog.GetString(Constants.UndefinedDefault);
        }
        else
        {
            dateTime = eval.DateBorn;
            if (dateTime == DateTime.MinValue)
            {
                label_date.Text = Catalog.GetString(Constants.UndefinedDefault);
            }
            else
            {
                label_date.Text = dateTime.ToLongDateString();
            }
        }

        if (!creating)
        {
            //country stuff
            if (eval.CountryID != Constants.CountryUndefinedID)
            {
                string [] countryString = SqliteCountry.Select(eval.CountryID);
                combo_continents.Active = UtilGtk.ComboMakeActive(continentsTranslated,
                                                                  Catalog.GetString(countryString[3]));
                combo_countries.Active = UtilGtk.ComboMakeActive(countriesTranslated,
                                                                 Catalog.GetString(countryString[1]));
            }

            label_confiable.Text = eval.Confiable.ToString();

            TextBuffer tb = new TextBuffer(new TextTagTable());
            tb.Text = eval.Comments;
            textview_comments.Buffer = tb;

            switch (eval.Chronometer)
            {
            case "":
            case Constants.UndefinedDefault:
                radio_cp_undef.Active = true;
                break;

            case Constants.ChronometerCp1:
                radio_cp1.Active = true;
                break;

            case Constants.ChronometerCp2:
                radio_cp2.Active = true;
                break;

            case Constants.ChronometerCp3:
                radio_cp3.Active = true;
                break;

            default:
                radio_cp_other.Active = true;
                entry_cp_other.Text   = eval.Chronometer;
                break;
            }

            switch (eval.Device)
            {
            case "":
            case Constants.UndefinedDefault:
                radio_device_undef.Active = true;
                break;

            case Constants.DeviceContactSteel:
                radio_contact_steel.Active = true;
                break;

            case Constants.DeviceContactCircuit:
                radio_contact_modular.Active = true;
                break;

            case Constants.DeviceInfrared:
                radio_infrared.Active = true;
                break;

            default:
                radio_device_other.Active = true;
                entry_device_other.Text   = eval.Device;
                break;
            }
        }

        //show or hide button_accept
        on_entries_required_changed(new object(), new EventArgs());
    }