示例#1
1
		public static bool SetActiveText (ComboBox cbox, string text) 
		{
			// returns true if found, false if not found

			string tvalue;
			TreeIter iter;
			ListStore store = (ListStore) cbox.Model;

			store.IterChildren (out iter);
			tvalue  = store.GetValue (iter, 0).ToString();
			if (tvalue.Equals (text)) {
				cbox.SetActiveIter (iter);
				return true;
			}
			else {
				bool found = store.IterNext (ref iter);
				while (found == true) {
					tvalue = store.GetValue (iter, 0).ToString();
					if (tvalue.Equals (text)) {
						cbox.SetActiveIter (iter);
						return true;
					}
					else
						found = store.IterNext (ref iter);
				}
			}

			return false; // not found
		}
        void llenacombo_contrato()
        {
            combo_tipocontrato.Clear();
            CellRendererText cell = new CellRendererText();

            combo_tipocontrato.PackStart(cell, true);
            combo_tipocontrato.AddAttribute(cell, "text", 0);

            ListStore store = new ListStore(typeof(string));

            combo_tipocontrato.Model = store;

            store.AppendValues((string)"");
            store.AppendValues((string)"DETERMINADO (1 MES)");
            store.AppendValues((string)"DETERMINADO (2 MESES)");
            store.AppendValues((string)"DETERMINADO (3 MESES)");
            store.AppendValues((string)"INDETERMINADO");
            store.AppendValues((string)"HONORARIOS (ASIMILABLES)");
            store.AppendValues((string)"PRACTICAS");

            TreeIter iter;

            if (store.GetIterFirst(out iter))
            {
                combo_tipocontrato.SetActiveIter(iter);
            }
            combo_tipocontrato.Changed += new EventHandler(onComboBoxChanged_tipocontrato);
        }
示例#3
0
        public static void ComboAccrualYearsFill(ComboBox combo, params string[] firstItems)
        {
            try {
                logger.Info ("Запрос лет для начислений...");
                TreeIter iter;
                string sql = "SELECT DISTINCT year FROM accrual ORDER BY year DESC";
                MySqlCommand cmd = new MySqlCommand (sql, QSMain.connectionDB);
                MySqlDataReader rdr = cmd.ExecuteReader ();

                ((ListStore)combo.Model).Clear ();

                foreach(var item in firstItems)
                {
                    combo.AppendText (item);
                }

                combo.AppendText (Convert.ToString (DateTime.Now.AddYears (1).Year));
                combo.AppendText (Convert.ToString (DateTime.Now.Year));
                while (rdr.Read ()) {
                    if (rdr.GetUInt32 ("year") == DateTime.Now.Year || rdr.GetUInt32 ("year") == DateTime.Now.AddYears (1).Year)
                        continue;
                    combo.AppendText (rdr ["year"].ToString ());
                }
                rdr.Close ();
                ((ListStore)combo.Model).SetSortColumnId (0, SortType.Descending);
                ListStoreWorks.SearchListStore ((ListStore)combo.Model, Convert.ToString (DateTime.Now.Year), out iter);
                combo.SetActiveIter (iter);
                logger.Info ("Ok");
            } catch (Exception ex) {
                logger.Warn (ex, "Ошибка получения списка лет!");
            }
        }
示例#4
0
        public ComboBoxHelper(
			ComboBox comboBox, 
			IDbConnection dbConnection, 
			string keyFieldName, 
			string valueFieldName, 
			string tableName, 
			int id)
        {
            this.comboBox = comboBox;

            CellRendererText cellRendererText = new CellRendererText();
            comboBox.PackStart (cellRendererText, true);
            comboBox.AddAttribute (cellRendererText, "text", 1);

            listStore = new ListStore(typeof(int), typeof(string));
            TreeIter initialTreeIter = listStore.AppendValues(0, "<sin asignar>");
            IDbCommand dbCommand = dbConnection.CreateCommand ();
            dbCommand.CommandText = string.Format(selectFormat, keyFieldName, valueFieldName, tableName);
            IDataReader dataReader = dbCommand.ExecuteReader ();
            while (dataReader.Read ()) {
                int key = (int)dataReader[keyFieldName];
                string value = (string)dataReader[valueFieldName];
                TreeIter treeIter = listStore.AppendValues (key, value);
                if (key == id)
                    initialTreeIter = treeIter;
            }
            dataReader.Close ();

            comboBox.Model = listStore;
            comboBox.SetActiveIter (initialTreeIter);
        }
示例#5
0
        public ApplicationWidget(Project project,Gtk.Window parent)
        {
            parentWindow =parent;
            this.Build();
            this.project = project;

            cbType = new ComboBox();

            ListStore projectModel = new ListStore(typeof(string), typeof(string));
            CellRendererText textRenderer = new CellRendererText();
            cbType.PackStart(textRenderer, true);
            cbType.AddAttribute(textRenderer, "text", 0);

            cbType.Model= projectModel;

            TreeIter ti = new TreeIter();
            foreach(SettingValue ds in MainClass.Settings.ApplicationType){// MainClass.Settings.InstallLocations){
                if(ds.Value == this.project.ApplicationType){
                    ti = projectModel.AppendValues(ds.Display,ds.Value);
                    cbType.SetActiveIter(ti);
                } else  projectModel.AppendValues(ds.Display,ds.Value);
            }
            if(cbType.Active <0)
                cbType.Active =0;

            tblGlobal.Attach(cbType, 1, 2, 0,1, AttachOptions.Fill|AttachOptions.Expand, AttachOptions.Fill|AttachOptions.Expand, 0, 0);

            afc = new ApplicationFileControl(project.AppFile,ApplicationFileControl.Mode.EditNoSaveButton,parentWindow);
            vbox2.PackEnd(afc, true, true, 0);
        }
示例#6
0
        public static void Fill(ComboBox comboBox, QueryResult queryResult)
        {
            CellRendererText cellRenderText = new CellRendererText ();

            comboBox.PackStart (cellRenderText, false);
            comboBox.SetCellDataFunc(cellRenderText,
                delegate(CellLayout Cell_layout, CellRenderer CellView, TreeModel tree_model, TreeIter iter) {
                IList row = (IList)tree_model.GetValue(iter, 0);
                cellRenderText.Text = row[1].ToString();

                //Vamos a ver el uso de los parámetros para acceder a SQL

            });

            ListStore listStore = new ListStore (typeof(IList));

            //TODO localización de "Sin Asignar".
            IList first = new object[] { null, "<sin asignar>" };
            TreeIter treeIterFirst = listStore.AppendValues (first);
            //TreeIter treeIterFirst = ListStore.AppendValues(first);
            foreach (IList row in queryResult.Rows)
                listStore.AppendValues (row);
            comboBox.Model = listStore;
            //Por defecto vale -1 (para el indice de categoría)
            comboBox.Active = 0;
            comboBox.SetActiveIter(treeIterFirst);
        }
示例#7
0
        public ComboBoxHelper(IDbConnection dbConnection,ComboBox comboBox,string nombre, string id,int elementoInicial,string tabla)
        {
            this.comboBox=comboBox;

            IDbCommand dbCommand= dbConnection.CreateCommand();
            dbCommand.CommandText = string.Format(selectFormat,id,nombre,tabla);

            IDataReader dbDataReader= dbCommand.ExecuteReader();

            //			CellRendererText cell1=new CellRendererText();
            //			comboBox.PackStart(cell1,false);
            //			comboBox.AddAttribute(cell1,"text",0);

            CellRendererText cell2=new CellRendererText();
            comboBox.PackStart(cell2,false);
            comboBox.AddAttribute(cell2,"text",1);//añadimos columnas
            liststore=new ListStore(typeof(int),typeof(string));

            TreeIter initialIter= liststore.AppendValues(0,"<sin asignar>");//si el elemento inicial no existe se selecciona esta opcion
            while(dbDataReader.Read()){
                int id2=(int)dbDataReader[id];
                string nombre2=dbDataReader[nombre].ToString();
                TreeIter iter=liststore.AppendValues(id2,nombre2);
                if(elementoInicial==id2)
                    initialIter=iter;
            }
            dbDataReader.Close();
            comboBox.Model=liststore;
            comboBox.SetActiveIter(initialIter);
        }
示例#8
0
        public ComboBoxHelper(ComboBox comboBox, object id, string selectSql)
        {
            CellRendererText cellRendererText = new CellRendererText ();
            comboBox.PackStart (cellRendererText, false);
            comboBox.SetCellDataFunc (cellRendererText, new CellLayoutDataFunc (delegate(CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter) {
                cellRendererText.Text = ((object[])tree_model.GetValue(iter, 0))[1].ToString();
            }));

            ListStore listStore = new ListStore (typeof(object));
            object[] initial = new object[] { null, "<sin asignar>" };
            TreeIter initialTreeIter = listStore.AppendValues ((object)initial);

            IDbCommand dbCommand = App.Instance.DbConnection.CreateCommand ();
            dbCommand.CommandText = selectSql;
            IDataReader dataReader = dbCommand.ExecuteReader ();
            while (dataReader.Read()) {
                object currentId = dataReader [0];
                object currentName = dataReader [1];
                object[] values = new object[] { currentId, currentName };
                TreeIter treeIter = listStore.AppendValues ((object)values);
                if (currentId.Equals (id))
                    initialTreeIter = treeIter;
            }
            dataReader.Close ();
            comboBox.Model = listStore;
            comboBox.SetActiveIter (initialTreeIter);
        }
示例#9
0
        public PreferencesDialog(ITranslations translations, PlayerHistory history) : base(translations, "PreferencesDialog.ui", "preferences")
        {
            this.history                     = history;
            prefspinbutton.Value             = Preferences.Get <int> (Preferences.MemQuestionTimeKey);
            prefcheckbutton.Active           = Preferences.Get <bool> (Preferences.MemQuestionWarnKey);
            maxstoredspinbutton.Value        = Preferences.Get <int> (Preferences.MaxStoredGamesKey);
            minplayedspinbutton.Value        = Preferences.Get <int> (Preferences.MinPlayedGamesKey);
            colorblindcheckbutton.Active     = Preferences.Get <bool> (Preferences.ColorBlindKey);
            englishcheckbutton.Active        = Preferences.Get <bool> (Preferences.EnglishKey);
            loadextensionscheckbutton.Active = Preferences.Get <bool> (Preferences.LoadPlugginsKey);
            usesoundscheckbutton.Active      = Preferences.Get <bool> (Preferences.SoundsKey);

            switch ((GameDifficulty)Preferences.Get <int> (Preferences.DifficultyKey))
            {
            case GameDifficulty.Easy:
                rb_easy.Active = rb_easy.HasFocus = true;
                break;

            case GameDifficulty.Medium:
                rb_medium.Active = rb_medium.HasFocus = true;
                break;

            case GameDifficulty.Master:
                rb_master.Active = rb_master.HasFocus = true;
                break;
            }

            ListStore    store       = new ListStore(typeof(string), typeof(Theme));       // DisplayName, theme reference
            CellRenderer layout_cell = new CellRendererText();

            themes_combobox.Model = store;
            themes_combobox.PackStart(layout_cell, true);
            themes_combobox.SetCellDataFunc(layout_cell, ComboBoxCellFunc);

            foreach (Theme theme in ThemeManager.Themes)
            {
                store.AppendValues(Catalog.GetString(theme.LocalizedName), theme);
            }

            // Default value
            TreeIter iter;
            bool     more = store.GetIterFirst(out iter);

            while (more)
            {
                Theme theme = (Theme)store.GetValue(iter, COLUMN_VALUE);

                if (String.Compare(theme.Name, Preferences.Get <string> (Preferences.ThemeKey), true) == 0)
                {
                    themes_combobox.SetActiveIter(iter);
                    break;
                }
                more = store.IterNext(ref iter);
            }

                        #if !MONO_ADDINS
            loadextensionscheckbutton.Visible = false;
                        #endif
        }
示例#10
0
        public static void SetComboBoxValue(ComboBox comboBox, string text)
        {
            comboBox.Model.Foreach(delegate(TreeModel model, TreePath path, TreeIter iter)
            {
                if (string.Equals(text, (string)model.GetValue(iter, 0)))
                {
                    comboBox.SetActiveIter(iter);
                    return (true);
                }

                return (false);
            });
        }
示例#11
0
 // HERZUM SPRINT 5.5: TLAB-242
 private void setActiveComboBoxValue(Gtk.ComboBox cb, string s)
 {
     Gtk.TreeIter iter;
     cb.Model.GetIterFirst(out iter);
     do
     {
         GLib.Value thisRow = new GLib.Value();
         cb.Model.GetValue(iter, 0, ref thisRow);
         if ((thisRow.Val as string).Equals(s))
         {
             cb.SetActiveIter(iter);
             break;
         }
     } while (cb.Model.IterNext(ref iter));
 }
示例#12
0
        void llenado_combobox_tipo_paciente()
        {
            // Llenado de combobox
            combobox_tipo_admision.Clear();
            CellRendererText cell2 = new CellRendererText();

            combobox_tipo_admision.PackStart(cell2, true);
            combobox_tipo_admision.AddAttribute(cell2, "text", 0);

            ListStore store2 = new ListStore(typeof(string), typeof(int));

            combobox_tipo_admision.Model = store2;

            // lleno de la tabla de his_tipo_de_admisiones
            NpgsqlConnection conexion;

            conexion = new NpgsqlConnection(connectionString + nombrebd);
            // Verifica que la base de datos este conectada
            try{
                conexion.Open();
                NpgsqlCommand comando;
                comando             = conexion.CreateCommand();
                comando.CommandText = "SELECT * FROM osiris_his_tipo_admisiones " +
                                      "WHERE cuenta_mayor = 4000 " +
                                      "ORDER BY descripcion_admisiones;";

                NpgsqlDataReader lector = comando.ExecuteReader();
                store2.AppendValues("", 0);
                while (lector.Read())
                {
                    store2.AppendValues((string)lector["descripcion_admisiones"], (int)lector["id_tipo_admisiones"]);
                }
            }catch (NpgsqlException ex) {
                MessageDialog msgBoxError = new MessageDialog(MyWinError, DialogFlags.DestroyWithParent,
                                                              MessageType.Error, ButtonsType.Close, "PostgresSQL error: {0}", ex.Message);
                msgBoxError.Run();                             msgBoxError.Destroy();
            }
            conexion.Close();

            TreeIter iter2;

            if (store2.GetIterFirst(out iter2))
            {
                //Console.WriteLine(iter2);
                combobox_tipo_admision.SetActiveIter(iter2);
            }
            combobox_tipo_admision.Changed += new EventHandler(onComboBoxChanged_tipo_admision);
        }
示例#13
0
        private void PopulateComboBox(ComboBox combobox, string active,
            IEnumerable<string> enumerable)
        {
            ListStore model = new ListStore (typeof (string));
            combobox.Model = model;

            foreach (string s in enumerable) {
                TreeIter iter = model.AppendValues (s);
                if (s == active)
                    combobox.SetActiveIter (iter);
            }

            CellRendererText cr = new CellRendererText ();
            combobox.PackStart (cr, false);
            combobox.AddAttribute (cr, "text", 0);
        }
示例#14
0
        void llenado_municipios(string tipo_, string descripcionmunicipio_)
        {
            combobox_municipios.Clear();
            CellRendererText cell3 = new CellRendererText();

            combobox_municipios.PackStart(cell3, true);
            combobox_municipios.AddAttribute(cell3, "text", 0);

            ListStore store3 = new ListStore(typeof(string));

            combobox_municipios.Model = store3;

            if (tipo_ == "selecciona")
            {
                store3.AppendValues((string)descripcionmunicipio_);
            }
            NpgsqlConnection conexion;

            conexion = new NpgsqlConnection(connectionString + nombrebd);
            // Verifica que la base de datos este conectada
            try{
                conexion.Open();
                NpgsqlCommand comando;
                comando             = conexion.CreateCommand();
                comando.CommandText = "SELECT descripcion_municipio FROM osiris_municipios WHERE id_estado = '" + idestado.ToString() + "' " +
                                      "ORDER BY descripcion_municipio;";

                NpgsqlDataReader lector = comando.ExecuteReader();
                while (lector.Read())
                {
                    store3.AppendValues((string)lector["descripcion_municipio"]);
                }
            }catch (NpgsqlException ex) {
                MessageDialog msgBoxError = new MessageDialog(MyWinError, DialogFlags.DestroyWithParent,
                                                              MessageType.Error, ButtonsType.Close, "PostgresSQL error: {0}", ex.Message);
                msgBoxError.Run();                             msgBoxError.Destroy();
            }
            conexion.Close();

            TreeIter iter3;

            if (store3.GetIterFirst(out iter3))
            {
                combobox_municipios.SetActiveIter(iter3);
            }
            combobox_municipios.Changed += new EventHandler(onComboBoxChanged_municipios);
        }
示例#15
0
        public ComboBoxHelper(ComboBox comboBox, IDbConnection dbConnection, string keyFieldName,
		                       string valueFieldName,string tableName,int initialId)
        {
            this.comboBox = comboBox;
            //this.initalId = initialId;

            CellRendererText cellRenderText1 = new CellRendererText();
            comboBox.PackStart(cellRenderText1,false);
            comboBox.AddAttribute(cellRenderText1,"text",0);//el ultimo parametro el 0 sirve para elegir la columna a visualizar

            CellRendererText cellRenderText = new CellRendererText();
            comboBox.PackStart(cellRenderText,false);
            comboBox.AddAttribute(cellRenderText,"text",1);//el ultimo parametro el 1 sirve para elegir la columna a visualizar

            listStore = new ListStore(typeof(int),typeof(string));

            TreeIter initialTreeIter;/* = listStore.AppendValues(0, "Sin asignar");*/
            IDbCommand dbCommand = dbConnection.CreateCommand();
            dbCommand.CommandText = string.Format(selectFormat, keyFieldName,valueFieldName,tableName);
            IDataReader dataReader = dbCommand.ExecuteReader();

            //Recorre el dataReader para insertar los valores en el comboBox
            while(dataReader.Read())
            {
                int id =(int) dataReader["id"];
                string nombre = (string)dataReader["nombre"];
                treeIter = listStore.AppendValues(id,nombre);
                if (id == initialId)
                    initialTreeIter = treeIter;
            }

            dataReader.Close();
            comboBox.Model = listStore;
            comboBox.SetActiveIter(initialTreeIter);

            comboBox.Changed += delegate {
                TreeIter treeIter;
                comboBox.GetActiveIter(out treeIter);
                int id = (int) listStore.GetValue(treeIter,0);

                Console.WriteLine("ID = "+ id);
            };
        }
示例#16
0
 public static void Fill(ComboBox comboBox, QueryResult queryResult, object id)
 {
     CellRendererText cellRendererText = new CellRendererText ();
     comboBox.PackStart (cellRendererText, false);
     comboBox.SetCellDataFunc (cellRendererText,
                               delegate(CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter) {
         IList row = (IList)tree_model.GetValue(iter, 0);
         cellRendererText.Text = row[1].ToString();
     });
     ListStore listStore = new ListStore (typeof(IList));
     //TODO localización de "sin asignar"
     IList first = new object[]{null, "<sin asignar>"};
     TreeIter treeIterFirst = listStore.AppendValues (first);
     foreach (IList row in queryResult.Rows)
         listStore.AppendValues (row);
     comboBox.Model = listStore;
     //comboBox.Active = 0;
     comboBox.SetActiveIter (treeIterFirst);
 }
示例#17
0
 public static void Fill(ComboBox comboBox,QueryResult queryResult, object id)
 {
     CellRendererText cellRendererText = new CellRendererText ();
     comboBox.PackStart (cellRendererText, false);
     comboBox.SetCellDataFunc (cellRendererText, delegate(CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter) {	//ESTA Y LA ANTERIOR CREAN LA CAJA PARA DIBUJAR
         IList row =(IList)tree_model.GetValue(iter,0);
         cellRendererText.Text = /*row[0] +" - "+*/ row[1].ToString();       // Id - Categoria
     });
     ListStore listStore = new ListStore (typeof(IList));
     IList first = new object[] {null, "<sin asignar>"};
     TreeIter treeIterAsignado =listStore.AppendValues (first); // lo guardo en un treeIter Para utilizarlo como activo en el comboiBox
     foreach (IList row in queryResult.Rows) {
         TreeIter treeIter = listStore.AppendValues (row);
         if (row[0].Equals(id))
             treeIterAsignado = treeIter;
     }
     comboBox.Model = listStore;
     comboBox.SetActiveIter(treeIterAsignado);
 }
示例#18
0
        public static void Fill(ComboBox combobox1, QueryResult queryresult, object id)
        {
            CellRendererText cellRendererText = new CellRendererText ();
            combobox1.PackStart (cellRendererText, false);

            combobox1.SetCellDataFunc (cellRendererText,
                            delegate(CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter) {
                IList row = (IList)tree_model.GetValue (iter, 0);
                cellRendererText.Text = row[1].ToString();
                    });
            ListStore listStore = new ListStore (typeof(IList));
            IList first=new object[]{null,"<sin asignar>"};
            TreeIter treeiterId=listStore.AppendValues (first);
            foreach (IList row in queryresult.Rows) {
                TreeIter treeiter=listStore.AppendValues (row);
                if (row[0].Equals(id))
                    treeiterId = treeiter;
            }
            combobox1.Model = listStore;
            //combobox1.Active = 0;
            combobox1.SetActiveIter (treeiterId);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="service">
        /// The <see cref="StreamrecorderService"/> that is being configured
        /// </param>
        /// <param name="previous_output_folder">
        /// A <see cref="System.String"/> containing the previously configured output directory
        /// </param>
        /// <param name="previous_encoder">
        /// A <see cref="System.String"/> containing the previously configured encoder
        /// </param>
        /// <param name="is_importing_enabled">
        /// A <see cref="System.Boolean"/> indicating whether file scanning was previously enabled
        /// </param>
        /// <param name="is_splitting_enabled">
        /// A <see cref="System.Boolean"/> indicating whether file splitting was previously enabled
        /// </param>
        public StreamrecorderConfigDialog(StreamrecorderService service, string previous_output_folder, string previous_encoder, bool is_importing_enabled, bool is_splitting_enabled)
        {
            streamrecorder_service = service;
            encoderbox.IdColumn    = 0;

            preferences_image.Yalign   = 0f;
            preferences_image.IconName = "gtk-preferences";
            preferences_image.IconSize = (int)IconSize.Dialog;
            preferences_image.Show();
            header_label.Text                 = String.Format(AddinManager.CurrentLocalizer.GetString("{0}Streamrecorder configuration\n{1}"), "<span weight=\"bold\" size=\"larger\">", "</span>");
            header_label.UseMarkup            = true;
            header_label.Wrap                 = true;
            header_label.Yalign               = 0f;
            header_label.Xalign               = 0f;
            description_label.Text            = AddinManager.CurrentLocalizer.GetString("Please select output folder for ripped files and if ripped\n" + "files should be imported to media library.\n");
            description_label.Yalign          = 0f;
            description_label.Xalign          = 0f;
            choose_folder_label.Text          = AddinManager.CurrentLocalizer.GetString("Output folder:");
            choose_encoder_label.Text         = AddinManager.CurrentLocalizer.GetString("Encoder:");
            output_folder.Text                = previous_output_folder;
            choose_output_folder_button.Label = AddinManager.CurrentLocalizer.GetString("_Browse");
            choose_output_folder_button.Image = new Image("gtk-directory", IconSize.Button);
            choose_output_folder_button.ShowAll();
            cancel_button.Label = AddinManager.CurrentLocalizer.GetString("_Cancel");
            cancel_button.Image = new Image("gtk-cancel", IconSize.Button);
            save_button.Label   = AddinManager.CurrentLocalizer.GetString("_Save");
            save_button.Image   = new Image("gtk-save", IconSize.Button);
            enable_import_ripped_songs.Label  = AddinManager.CurrentLocalizer.GetString("Import files to media library");
            enable_import_ripped_songs.Active = StreamrecorderService.IsImportingEnabledEntry.Get().Equals("True") ? true : false;
            enable_automatic_splitting.Label  = AddinManager.CurrentLocalizer.GetString("Enable automatic files splitting by Metadata");
            enable_automatic_splitting.Active = StreamrecorderService.IsFileSplittingEnabledEntry.Get().Equals("True") ? true : false;

            encoderbox.Clear();
            CellRendererText cell = new CellRendererText();

            encoderbox.PackStart(cell, false);
            encoderbox.AddAttribute(cell, "text", 0);
            ListStore store = new ListStore(typeof(string));

            encoderbox.Model = store;

            int row        = -1;
            int chosen_row = -1;

            foreach (string encoder in streamrecorder_service.GetEncoders())
            {
                row++;
                store.AppendValues(encoder);
                if (encoder.Equals(previous_encoder))
                {
                    chosen_row = row;
                    Hyena.Log.DebugFormat("[StreamrecorderConfigDialog] found active encoder in row {1}: {0}", encoder, chosen_row);
                }
            }

            if (chosen_row > -1)
            {
                Gtk.TreeIter iter;
                encoderbox.Model.IterNthChild(out iter, chosen_row);
                encoderbox.SetActiveIter(iter);
            }
            else
            {
                Gtk.TreeIter iter;
                encoderbox.Model.GetIterFirst(out iter);
                encoderbox.SetActiveIter(iter);
            }

            HBox main_container   = new HBox();
            VBox action_container = new VBox();

            main_container.Spacing     = 12;
            main_container.BorderWidth = 6;

            action_container.PackStart(header_label, true, true, 0);
            action_container.PackStart(description_label, true, true, 0);
            VBox choosing_labels = new VBox();

            choosing_labels.PackStart(choose_folder_label, true, true, 5);
            choosing_labels.PackStart(choose_encoder_label, true, true, 5);
            HBox folder_choosing = new HBox();

            folder_choosing.PackStart(output_folder, true, true, 5);
            folder_choosing.PackStart(choose_output_folder_button, true, true, 0);
            VBox box_choosing = new VBox();

            box_choosing.PackStart(folder_choosing, true, true, 0);
            box_choosing.PackStart(encoderbox, true, true, 5);
            HBox all_choosing = new HBox();

            all_choosing.PackStart(choosing_labels, true, true, 0);
            all_choosing.PackStart(box_choosing, true, true, 0);

            action_container.PackStart(all_choosing, true, true, 5);
            action_container.PackStart(enable_automatic_splitting, true, true, 5);
            action_container.PackStart(enable_import_ripped_songs, true, true, 5);

            main_container.PackStart(preferences_image, true, true, 5);
            main_container.PackEnd(action_container, true, true, 5);
            this.ContentArea.PackStart(main_container, true, true, 5);

            AddActionWidget(cancel_button, 0);
            AddActionWidget(save_button, 0);

            choose_output_folder_button.Clicked += new EventHandler(OnChooseOutputFolderButtonClicked);
            cancel_button.Clicked += new EventHandler(OnCancelButtonClicked);
            save_button.Clicked   += new EventHandler(OnSaveButtonClicked);

            Title       = "Streamrecorder configuration";
            IconName    = "gtk-preferences";
            Resizable   = false;
            BorderWidth = 6;
//            HasSeparator = false;
            this.ContentArea.Spacing = 12;

            ShowAll();
        }
示例#20
0
        public requisicion_materiales_compras(string LoginEmp_, string NomEmpleado_, string AppEmpleado_, string ApmEmpleado_, string _nombrebd_)
        {
            LoginEmpleado = LoginEmp_;
            NomEmpleado   = NomEmpleado_;
            AppEmpleado   = AppEmpleado_;
            ApmEmpleado   = ApmEmpleado_;
            nombrebd      = _nombrebd_;

            Glade.XML gxml = new Glade.XML(null, "almacen_costos_compras.glade", "requisicion_materiales", null);
            gxml.Autoconnect(this);
            ////// Muestra ventana de Glade
            requisicion_materiales.Show();

            // Creacion de una Nueva Requisicion
            entry_requisicion.KeyPressEvent += onKeyPressEvent_enter_requisicion;

            checkbutton_nueva_requisicion.Clicked += new EventHandler(on_checkbutton_nueva_requisicion_clicked);

            // Asignando valores de Fechas
            this.entry_fecha_solicitud.Text = (string)DateTime.Now.ToString("yyyy-MM-dd");
            this.entry_fecha_requerida.Text = (string)DateTime.Now.ToString("yyyy-MM-dd");

            // Llenado de combobox1
            combobox_tipo_admision.Clear();
            CellRendererText cell1 = new CellRendererText();

            combobox_tipo_admision.PackStart(cell1, true);
            combobox_tipo_admision.AddAttribute(cell1, "text", 0);

            combobox_tipo_admision2.Clear();
            CellRendererText cell2 = new CellRendererText();

            combobox_tipo_admision2.PackStart(cell2, true);
            combobox_tipo_admision2.AddAttribute(cell2, "text", 0);

            ListStore store2 = new ListStore(typeof(string), typeof(int));

            combobox_tipo_admision.Model  = store2;
            combobox_tipo_admision2.Model = store2;

            // lleno de la tabla de his_tipo_de_admisiones
            NpgsqlConnection conexion;

            conexion = new NpgsqlConnection(connectionString + nombrebd);
            // Verifica que la base de datos este conectada
            try{
                conexion.Open();
                NpgsqlCommand comando;
                comando             = conexion.CreateCommand();
                comando.CommandText = "SELECT * FROM hscmty_his_tipo_admisiones " +
                                      //"WHERE cuenta_mayor = 4000  "+
                                      " ORDER BY descripcion_admisiones;";

                NpgsqlDataReader lector = comando.ExecuteReader();
                while (lector.Read())
                {
                    store2.AppendValues((string)lector["descripcion_admisiones"], (int)lector["id_tipo_admisiones"]);
                }
            }catch (NpgsqlException ex) {
                MessageDialog msgBoxError = new MessageDialog(MyWinError, DialogFlags.DestroyWithParent,
                                                              MessageType.Error, ButtonsType.Close, "PostgresSQL error: {0}", ex.Message);
                msgBoxError.Run();                             msgBoxError.Destroy();
            }
            conexion.Close();

            TreeIter iter2;

            if (store2.GetIterFirst(out iter2))
            {
                //Console.WriteLine(iter2);
                combobox_tipo_admision.SetActiveIter(iter2);
            }
            combobox_tipo_admision.Changed  += new EventHandler(onComboBoxChanged_tipo_admision);
            combobox_tipo_admision2.Changed += new EventHandler(onComboBoxChanged_tipo_admision2);

            // Sale de la ventana
            button_salir.Clicked += new EventHandler(on_cierraventanas_clicked);

            // Activacion de boton de busqueda
            button_busca_producto.Clicked += new EventHandler(on_button_busca_producto_clicked);

            // Desactivando Entrys y Combobox
            this.entry_fecha_solicitud.Sensitive      = false;
            this.entry_fecha_requerida.Sensitive      = false;
            this.combobox_tipo_admision.Sensitive     = false;
            this.combobox_tipo_admision2.Sensitive    = false;
            this.entry_observaciones.Sensitive        = false;
            this.button_guardar_requisicion.Sensitive = false;

            statusbar_almacen_requi.Pop(0);
            statusbar_almacen_requi.Push(1, "login: "******"  |Usuario: " + NomEmpleado + " " + AppEmpleado + " " + ApmEmpleado);
            statusbar_almacen_requi.HasResizeGrip = false;

            // Creacion del treeview
            crea_treeview_requisicion();
        }
        private void BuildWidget()
        {
            Spacing = 10;

            Label title = new Label();
            title.Markup = String.Format("<big><b>{0}</b></big>",
                             GLib.Markup.EscapeText(Catalog.GetString("iTunes Music Store")));
            title.Xalign = 0.0f;

            Label label = new Label(plugin.Description);
            label.Wrap = true;

            Alignment alignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
            alignment.LeftPadding = 10;
            alignment.RightPadding = 10;

            Frame frame = new Frame();
            Alignment frame_alignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
            frame_alignment.BorderWidth = 5;
            frame_alignment.LeftPadding = 10;
            frame_alignment.RightPadding = 10;
            frame_alignment.BottomPadding = 10;

            frame.LabelWidget = new Label (Catalog.GetString ("Account Information"));
            frame.ShadowType = ShadowType.EtchedIn;

            table = new PropertyTable();
            table.RowSpacing = 5;

            user_entry = table.AddEntry(Catalog.GetString("Username"), "", false);
            pass_entry = table.AddEntry(Catalog.GetString("Password"), "", false);
            pass_entry.Visibility = false;

            user_entry.Text = plugin.Username;
            pass_entry.Text = plugin.Password;
            user_entry.Changed += OnUserPassChanged;
            pass_entry.Changed += OnUserPassChanged;

            country_combo = ComboBox.NewText ();
            country_combo.Changed += OnCountryChanged;

            TreeIter loaded_iter = TreeIter.Zero;
            foreach (string country in FairStore.Countries.AllKeys) {
                TreeIter iter = ((ListStore)country_combo.Model).AppendValues (country);
                if (country == plugin.Country)
                    loaded_iter = iter;
            }
            country_combo.SetActiveIter (loaded_iter);

            table.AddWidget (Catalog.GetString ("Country"), country_combo, false);

            frame_alignment.Add(table);
            frame.Add(frame_alignment);

            Label copyright = new Label (Catalog.GetString ("Apple and iTunes Music Store are registered trademarks of Apple Computer, Inc."));

            PackStart(title, false, false, 0);
            PackStart(label, false, false, 0);
            PackStart(alignment, false, false, 0);
            PackStart(frame, true, false, 0);
            PackStart(copyright, false, false, 0);

            ShowAll();
        }
示例#22
0
            public FilterWidgetRow(FileSearchFilter filter)
                : base(0, 0, 1, 1)
            {
                TreeIter iter;
                CellRendererText textCell;
                ListStore store;

                this.filter = filter;

                matchTypeStore = new ListStore(typeof(string), typeof(FileSearchFilterComparison));

                textCell = new CellRendererText();

                matchTypeComboBox = new ComboBox();
                matchTypeComboBox.Model = matchTypeStore;
                matchTypeComboBox.PackStart(textCell, true);
                matchTypeComboBox.AddAttribute(textCell, "text", 0);
                matchTypeComboBox.RowSeparatorFunc = ComboSeparatorFunc;
                matchTypeComboBox.Changed += MatchTypeChanged;

                textCell = new CellRendererText();
                store = new ListStore(typeof(string), typeof(FilterEntryMode), typeof(FileSearchFilterField));

                filterTextEntry = new FilterEntry(filter);
                filterTextEntry.Changed += FilterTextChanged;

                fieldComboBox = new ComboBox();
                fieldComboBox.PackStart(textCell, true);
                fieldComboBox.AddAttribute(textCell, "text", 0);
                fieldComboBox.SetCellDataFunc(textCell, FieldComboDataFunc);
                store.AppendValues("File Name", FilterEntryMode.String, FileSearchFilterField.FileName);
                store.AppendValues("Size", FilterEntryMode.Size, FileSearchFilterField.Size);
                store.AppendValues("-");
                store.AppendValues("(Audio)", null);
                store.AppendValues("Artist", FilterEntryMode.String, FileSearchFilterField.Artist);
                store.AppendValues("Album", FilterEntryMode.String, FileSearchFilterField.Album);
                store.AppendValues("Bitrate", FilterEntryMode.Speed, FileSearchFilterField.Bitrate);
                store.AppendValues("-");
                store.AppendValues("(Video)", null);
                store.AppendValues("Resolution", FilterEntryMode.Dimentions, FileSearchFilterField.Resolution);
                store.AppendValues("-");
                store.AppendValues("(Images)", null);
                store.AppendValues("Dimentions", FilterEntryMode.Dimentions, FileSearchFilterField.Dimentions);
                fieldComboBox.Model = store;
                fieldComboBox.RowSeparatorFunc = ComboSeparatorFunc;
                fieldComboBox.Changed += FieldChanged;
                /*
                if (fieldComboBox.Model.GetIterFirst(out iter)) {
                    fieldComboBox.SetActiveIter(iter);
                }
                */

                addButton = new Button();
                addButton.Relief = ReliefStyle.None;
                addButton.Image = new Image(Gui.LoadIcon(16, "list-add"));
                addButton.Clicked += AddButtonClicked;

                removeButton = new Button();
                removeButton.Relief = ReliefStyle.None;
                removeButton.Image = new Image(Gui.LoadIcon(16, "list-remove"));
                removeButton.Clicked += RemoveButtonClicked;

                box = new HBox();
                box.PackStart(fieldComboBox, false, false, 0);
                box.PackStart(matchTypeComboBox, false, false, 3);
                box.PackStart(filterTextEntry, true, true, 0);
                box.PackStart(removeButton, false, false, 0);
                box.PackStart(addButton, false, false, 0);

                this.TopPadding = 3;
                this.BottomPadding = 3;
                this.Add(box);

                fieldComboBox.Model.GetIterFirst(out iter);
                do {
                    FileSearchFilterField field = (FileSearchFilterField)fieldComboBox.Model.GetValue(iter, 2);
                    if (field == filter.Field) {
                        fieldComboBox.SetActiveIter(iter);
                        break;
                    }
                } while (fieldComboBox.Model.IterNext(ref iter));

                matchTypeComboBox.Model.GetIterFirst(out iter);
                do {
                    FileSearchFilterComparison comp = (FileSearchFilterComparison)matchTypeComboBox.Model.GetValue(iter, 1);
                    if (comp == filter.Comparison) {
                        matchTypeComboBox.SetActiveIter(iter);
                        break;
                    }
                } while (matchTypeComboBox.Model.IterNext(ref iter));

                filterTextEntry.Text = filter.Text;
            }
示例#23
0
        public ProjectPropertyWidget(Project project)
        {
            this.project = project;

            Table mainTable = new Table(2,1,false);
            Table propertyTable = new Table(5,2,false);

            Label lblFN = new Label(System.IO.Path.GetFileName(project.ProjectName));
            lblFN.UseUnderline = false;
            lblFN.Selectable = true;
            lblFN.Xalign = 0;

            /*prjDir.LabelProp = this.project.RelativeAppFilePath;
            prjFullPath.LabelProp  = this.project.AbsolutProjectDir;*/

            Entry entr = new Entry(this.project.RelativeAppFilePath);
            entr.ModifyBg(StateType.Normal,this.Style.Background(StateType.Normal));
            entr.IsEditable = false;

            Entry entrFullPath = new Entry(this.project.AbsolutProjectDir);
            entrFullPath.IsEditable = false;

            Entry entrFacebookApi = new Entry(this.project.FacebookAppID);
            entrFacebookApi.Changed+= delegate(object sender, EventArgs e)
            {
                this.project.FacebookAppID = entrFacebookApi.Text;
            };

            Entry entrTitle = new Entry(this.project.AppFile.Title);
            entrTitle.Changed+= delegate(object sender, EventArgs e)
            {
                try{
                    this.project.AppFile.Title = entrTitle.Text;
                } catch (Exception ex){
                    Moscrif.IDE.Tool.Logger.Error(ex.Message);
                }
            };

            ComboBox cbType = new ComboBox();
            ListStore projectModel = new ListStore(typeof(string), typeof(string));
            CellRendererText textRenderer = new CellRendererText();
            cbType.PackStart(textRenderer, true);
            cbType.AddAttribute(textRenderer, "text", 0);
            cbType.Model= projectModel;
            TreeIter ti = new TreeIter();
            foreach(SettingValue ds in MainClass.Settings.ApplicationType){// MainClass.Settings.InstallLocations){
                if(ds.Value == this.project.ApplicationType){
                    ti = projectModel.AppendValues(ds.Display,ds.Value);
                    cbType.SetActiveIter(ti);
                } else  projectModel.AppendValues(ds.Display,ds.Value);
            }
            if(cbType.Active <0)
                cbType.Active =0;
            cbType.Changed+= delegate(object sender, EventArgs e) {
                TreeIter tiSelect = new TreeIter();
                cbType.GetActiveIter(out tiSelect);
                string text = cbType.Model.GetValue(tiSelect,1).ToString();
                project.ApplicationType =text;
            };

            AddControl(ref propertyTable,0,lblFN,"Project ");
            AddControl(ref propertyTable,1,entr,"Project App ");
            AddControl(ref propertyTable,2,entrFullPath,"Project Path ");
            AddControl(ref propertyTable,3,entrTitle,"Title ");
            AddControl(ref propertyTable,4,cbType,"Type ");
            AddControl(ref propertyTable,5,entrFacebookApi,"Facebook ID ");

            mainTable.Attach(propertyTable,0,1,0,1,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Fill,0,0);

            /*int rowCount = project.ConditoinsDefine.Count;
            Table conditionsTable = new Table((uint)(rowCount + 3),(uint)2,false);

            GenerateContent(ref conditionsTable, MainClass.Settings.Platform.Name, 1, MainClass.Settings.Platform,false);//tableSystem
            GenerateContent(ref conditionsTable, MainClass.Settings.Resolution.Name, 2,MainClass.Settings.Resolution,true); //project.Resolution);//tableSystem
            int i = 3;
            foreach (Condition cd in project.ConditoinsDefine) {
                GenerateContent(ref conditionsTable, cd.Name, i, cd,false);
                i++;
            }
            mainTable.Attach(conditionsTable,0,1,1,2,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Fill,0,0);
            */
            this.PackStart(mainTable,true,true,0);
            this.ShowAll();
        }
示例#24
0
        public override Gtk.Widget GetEditWidget()
        {
            namestore = new ListStore (typeof(string));
            ComboBox combo = new ComboBox (namestore);
            CellRenderer rdr = new CellRendererText ();
            combo.PackStart (rdr, true);
            combo.AddAttribute (rdr, "text", 0);

            Array values = System.Enum.GetValues (parentRow.PropertyDescriptor.PropertyType);

            foreach (object s in values) {
                string str = parentRow.PropertyDescriptor.Converter.ConvertToString (s);
                TreeIter t = namestore.AppendValues (str);
                if (str == parentRow.PropertyDescriptor.Converter.ConvertToString (parentRow.PropertyValue))
                    combo.SetActiveIter (t);
            }

            combo.Changed += new EventHandler (combo_Changed);
            combo.Destroyed += new EventHandler (combo_Destroyed);
            return combo;
        }
示例#25
0
		public MainToolbar ()
		{
			WidgetFlags |= Gtk.WidgetFlags.AppPaintable;

			AddWidget (button);
			AddSpace (8);

			configurationCombo = new Gtk.ComboBox ();
			configurationCombo.Model = configurationStore;
			var ctx = new Gtk.CellRendererText ();
			configurationCombo.PackStart (ctx, true);
			configurationCombo.AddAttribute (ctx, "text", 0);

			configurationCombosBox = new HBox (false, 8);

			var configurationComboVBox = new VBox ();
			configurationComboVBox.PackStart (configurationCombo, true, false, 0);
			configurationCombosBox.PackStart (configurationComboVBox, false, false, 0);

			// bold attributes for running runtime targets / (emulators)
			boldAttributes.Insert (new Pango.AttrWeight (Pango.Weight.Bold));

			runtimeCombo = new Gtk.ComboBox ();
			runtimeCombo.Model = runtimeStore;
			ctx = new Gtk.CellRendererText ();
			if (Platform.IsWindows)
				ctx.Ellipsize = Pango.EllipsizeMode.Middle;
			runtimeCombo.PackStart (ctx, true);
			runtimeCombo.SetCellDataFunc (ctx, RuntimeRenderCell);
			runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator;

			var runtimeComboVBox = new VBox ();
			runtimeComboVBox.PackStart (runtimeCombo, true, false, 0);
			configurationCombosBox.PackStart (runtimeComboVBox, false, false, 0);
			AddWidget (configurationCombosBox);

			buttonBarBox = new Alignment (0.5f, 0.5f, 0, 0);
			buttonBarBox.LeftPadding = (uint) 7;
			buttonBarBox.Add (buttonBar);
			buttonBarBox.NoShowAll = true;
			AddWidget (buttonBarBox);
			AddSpace (24);

			statusArea = new StatusArea ();
			statusArea.ShowMessage (BrandingService.ApplicationName);

			var statusAreaAlign = new Alignment (0, 0, 1, 1);
			statusAreaAlign.Add (statusArea);
			contentBox.PackStart (statusAreaAlign, true, true, 0);
			AddSpace (24);

			statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => {
				Gtk.Widget toplevel = this.Toplevel;
				if (toplevel == null)
					return;

				int windowWidth = toplevel.Allocation.Width;
				int center = windowWidth / 2;
				int left = Math.Max (center - 300, args.Allocation.Left);
				int right = Math.Min (left + 600, args.Allocation.Right);
				uint left_padding = (uint) (left - args.Allocation.Left);
				uint right_padding = (uint) (args.Allocation.Right - right);

				if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding)
					statusAreaAlign.SetPadding (0, 0, (uint) left_padding, (uint) right_padding);
			};

			matchEntry = new SearchEntry ();

			matchEntry.ForceFilterButtonVisible = true;
			matchEntry.Entry.FocusOutEvent += (o, e) => {
				if (SearchEntryLostFocus != null)
					SearchEntryLostFocus (o, e);
			};

			matchEntry.Ready = true;
			matchEntry.Visible = true;
			matchEntry.IsCheckMenu = true;
			matchEntry.WidthRequest = 240;
			if (!Platform.IsMac && !Platform.IsWindows)
				matchEntry.Entry.ModifyFont (Pango.FontDescription.FromString ("Sans 9")); // TODO: VV: "Segoe UI 9"
			matchEntry.RoundedShape = true;
			matchEntry.Entry.Changed += HandleSearchEntryChanged;
			matchEntry.Activated += HandleSearchEntryActivated;
			matchEntry.Entry.KeyPressEvent += HandleSearchEntryKeyPressed;
			SizeAllocated += (o, e) => {
				if (SearchEntryResized != null)
					SearchEntryResized (o, e);
			};

			contentBox.PackStart (matchEntry, false, false, 0);

			var align = new Gtk.Alignment (0, 0, 1f, 1f);
			align.Show ();
			align.TopPadding = (uint) 5;
			align.LeftPadding = (uint) 9;
			align.RightPadding = (uint) 18;
			align.BottomPadding = (uint) 10;
			align.Add (contentBox);

			Add (align);
			SetDefaultSizes (-1, 21);

			configurationCombo.Changed += (o, e) => {
				if (ConfigurationChanged != null)
					ConfigurationChanged (o, e);
			};
			runtimeCombo.Changed += (o, e) => {
				var ea = new HandledEventArgs ();
				if (RuntimeChanged != null)
					RuntimeChanged (o, ea);

				TreeIter it;
				if (runtimeCombo.GetActiveIter (out it)) {
					if (ea.Handled) {
						runtimeCombo.SetActiveIter (lastSelection);
						return;
					}
					lastSelection = it;
				}
			};

			button.Clicked += HandleStartButtonClicked;

			IdeApp.CommandService.ActiveWidgetChanged += (sender, e) => {
				lastCommandTarget = new WeakReference (e.OldActiveWidget);
			};

			this.ShowAll ();
			this.statusArea.statusIconBox.HideAll ();
		}
示例#26
0
        // creates the media engine window
        public EnginesWindow(FuseApp fuse)
            : base(fuse.Window, "Media Engines")
        {
            this.fuse = fuse;

            // main widgets
            VBox backbone = new VBox (false, 2);
            backbone.BorderWidth = 10;

            Table details = new Table (5, 4, false);
            details.ColumnSpacing = 5;
            combo = new ComboBox (store);

            Button cancel = new Button (Stock.Cancel);
            Button save = new Button (Stock.Save);
            HBox button_box = new HBox (false, 2);

            // basic setup
            button_box.PackEnd (save);
            button_box.PackEnd (cancel);

            CellRendererText renderer = new CellRendererText ();
            combo.PackStart (renderer, true);
            combo.AddAttribute (renderer, "text", 1);

            // header labels
            Label instruction = new Label ("Select a media engine from the list below:");
            Label title_header = new Label ();
            Label version_header = new Label ();
            Label description_header = new Label ();
            Label author_header = new Label ();
            Label website_header = new Label ();

            // add header content and styles
            title_header.Markup = "<small><b>Title:</b></small>";
            version_header.Markup = "<small><b>Version:</b></small>";
            description_header.Markup = "<small><b>Description:</b></small>";
            author_header.Markup = "<small><b>Author:</b></small>";
            website_header.Markup = "<small><b>Website:</b></small>";

            // change label alignment
            title_header.Xalign = 0;
            version_header.Xalign = 0;
            description_header.Xalign = 0;
            author_header.Xalign = 0;
            website_header.Xalign = 0;

            title.Xalign = 0;
            version.Xalign = 0;
            description.Xalign = 0;
            author.Xalign = 0;
            website.Xalign = 0;

            // attach the labels to the details table
            details.Attach (title_header, 0, 1, 0, 1);
            details.Attach (version_header, 0, 1, 1, 2);
            details.Attach (author_header, 0, 1, 2, 3);
            details.Attach (website_header, 0, 1, 3, 4);
            details.Attach (description_header, 0, 1, 4, 5);

            details.Attach (title, 1, 2, 0, 1);
            details.Attach (version, 1, 2, 1, 2);
            details.Attach (author, 1, 2, 2, 3);
            details.Attach (website, 1, 2, 3, 4);
            details.Attach (description, 1, 2, 4, 5);

            // widget events
            combo.Changed += combo_changed;
            save.Clicked += save_clicked;
            cancel.Clicked += cancel_clicked;

            // add main widgets to the backbone
            backbone.PackStart (instruction, false, false, 5);
            backbone.PackStart (combo, false, false, 0);
            backbone.PackStart (details, false, false, 5);
            backbone.PackStart (button_box, false, false, 0);

            this.Resizable = false;
            this.SkipTaskbarHint = true;
            this.SkipPagerHint = true;
            this.Add (backbone);

            loadEngineList ();

            TreeIter first_iter;
            bool not_empty = combo.Model.GetIterFirst (out first_iter);
            combo.Sensitive = not_empty;
            if (not_empty) combo.SetActiveIter (first_iter);

            // select the previously selected engine
            store.Foreach (delegate (TreeModel model, TreePath path, TreeIter iter) {
                MediaEngine engine = (MediaEngine) model.GetValue (iter, 0);
                if (engine.Path == fuse.ChosenEngine)
                {
                    combo.SetActiveIter (iter);
                    return true;
                }
                return false;
            });
        }
示例#27
0
        private void GenerateContent(ref Gtk.Table tableSystem, string label, int xPos, Condition cd,bool isResolution)
        {
            ListStore lstorePlatform = new ListStore(typeof(int),typeof(int),typeof(string));

            int selectRule = 0;
            if (conditionRules_Old.Count > 0) {
                ConditionRule cr = conditionRules_Old.Find(x => x.ConditionId == cd.Id);
                if (cr != null)
                    selectRule = cr.RuleId;
            }

            Label lblPlatform = new Label(label);
            lblPlatform.Name = "lbl_" + label;
            lblPlatform.Xalign = 1;
            lblPlatform.Yalign = 0.5F;

            ComboBox cboxPlatform = new ComboBox();
            cboxPlatform.Name = "cd_" + label;

            CellRendererText textRenderer = new CellRendererText();
            cboxPlatform.PackStart(textRenderer, true);
            cboxPlatform.AddAttribute(textRenderer, "text", 2);

            cboxPlatform.WidthRequest = 200;
            cboxPlatform.Model = lstorePlatform;
            cboxPlatform.Changed += delegate(object sender, EventArgs e) {

                    if (sender == null)
                        return;

                    ComboBox combo = sender as ComboBox;

                    TreeIter iter;
                    if (combo.GetActiveIter(out iter)) {
                        int ruleId = (int)combo.Model.GetValue(iter, 0);
                        int condId = (int)combo.Model.GetValue(iter, 1);
                            if (ruleId != 0){
                            ConditionRule cr = conditionRules.Find(x => x.ConditionId == condId);//cd.Id);
                            if (cr != null)
                                cr.RuleId = ruleId;
                            else
                                conditionRules.Add(new ConditionRule(condId,ruleId));
                        }
                        else {
                            ConditionRule cr = conditionRules.Find(x => x.ConditionId == condId);//cd.Id);
                            if (cr != null){
                                conditionRules.Remove(cr);
                            }
                        }
                    }

                };

            tableSystem.Attach(lblPlatform, 0, 1, (uint)(xPos - 1), (uint)xPos, AttachOptions.Shrink, AttachOptions.Shrink, 2, 2);
            tableSystem.Attach(cboxPlatform, 1, 2, (uint)(xPos - 1), (uint)xPos, AttachOptions.Shrink, AttachOptions.Shrink, 2, 2);

            TreeIter selectIter = lstorePlatform.AppendValues(0, cd.Id, "Unset");

            foreach (Rule rl in cd.Rules){

                if(!isResolution){

                    if (rl.Id == selectRule)
                        selectIter = lstorePlatform.AppendValues(rl.Id, cd.Id, rl.Name);
                    else
                        lstorePlatform.AppendValues(rl.Id, cd.Id, rl.Name);
                } else {
                    string name  = String.Format("{0} ({1}x{2})",rl.Name,rl.Width,rl.Height);
                    if (rl.Id == selectRule)
                        selectIter = lstorePlatform.AppendValues(rl.Id, cd.Id, name);
                    else
                        lstorePlatform.AppendValues(rl.Id, cd.Id, name);
                }
            }

            cboxPlatform.SetActiveIter(selectIter);
        }
示例#28
0
		public Gtk.Widget MakeSyncPane ()
		{
			Gtk.VBox vbox = new Gtk.VBox (false, 0);
			vbox.Spacing = 4;
			vbox.BorderWidth = 8;

			Gtk.HBox hbox = new Gtk.HBox (false, 4);

			Gtk.Label label = new Gtk.Label (Catalog.GetString ("Ser_vice:"));
			label.Xalign = 0;
			label.Show ();
			hbox.PackStart (label, false, false, 0);

			// Populate the store with all the available SyncServiceAddins
			syncAddinStore = new Gtk.ListStore (typeof (SyncServiceAddin));
			syncAddinIters = new Dictionary<string,Gtk.TreeIter> ();
			SyncServiceAddin [] addins = Tomboy.DefaultNoteManager.AddinManager.GetSyncServiceAddins ();
			Array.Sort (addins, CompareSyncAddinsByName);
			foreach (SyncServiceAddin addin in addins) {
				Gtk.TreeIter iter = syncAddinStore.Append ();
				syncAddinStore.SetValue (iter, 0, addin);
				syncAddinIters [addin.Id] = iter;
			}

			syncAddinCombo = new Gtk.ComboBox (syncAddinStore);
			label.MnemonicWidget = syncAddinCombo;
			Gtk.CellRendererText crt = new Gtk.CellRendererText ();
			syncAddinCombo.PackStart (crt, true);
			syncAddinCombo.SetCellDataFunc (crt,
			                                new Gtk.CellLayoutDataFunc (ComboBoxTextDataFunc));

			// Read from Preferences which service is configured and select it
			// by default.  Otherwise, just select the first one in the list.
			string addin_id = Preferences.Get (
			                          Preferences.SYNC_SELECTED_SERVICE_ADDIN) as String;

			Gtk.TreeIter active_iter;
			if (addin_id != null && syncAddinIters.ContainsKey (addin_id)) {
				active_iter = syncAddinIters [addin_id];
				syncAddinCombo.SetActiveIter (active_iter);
			} else {
				if (syncAddinStore.GetIterFirst (out active_iter) == true) {
					syncAddinCombo.SetActiveIter (active_iter);
				}
			}

			syncAddinCombo.Changed += OnSyncAddinComboChanged;

			syncAddinCombo.Show ();
			hbox.PackStart (syncAddinCombo, true, true, 0);

			hbox.Show ();
			vbox.PackStart (hbox, false, false, 0);

			// Get the preferences GUI for the Sync Addin
			if (active_iter.Stamp != Gtk.TreeIter.Zero.Stamp)
				selectedSyncAddin = syncAddinStore.GetValue (active_iter, 0) as SyncServiceAddin;

			if (selectedSyncAddin != null)
				syncAddinPrefsWidget = selectedSyncAddin.CreatePreferencesControl (OnSyncAddinPrefsChanged);
			if (syncAddinPrefsWidget == null) {
				Gtk.Label l = new Gtk.Label (Catalog.GetString ("Not configurable"));
				l.Yalign = 0.5f;
				l.Yalign = 0.5f;
				syncAddinPrefsWidget = l;
			}
			if (syncAddinPrefsWidget != null && addin_id != null &&
			                syncAddinIters.ContainsKey (addin_id) && selectedSyncAddin.IsConfigured)
				syncAddinPrefsWidget.Sensitive = false;

			syncAddinPrefsWidget.Show ();
			syncAddinPrefsContainer = new Gtk.VBox (false, 0);
			syncAddinPrefsContainer.PackStart (syncAddinPrefsWidget, false, false, 0);
			syncAddinPrefsContainer.Show ();
			vbox.PackStart (syncAddinPrefsContainer, true, true, 10);

			// Autosync preference
			int timeout = (int) Preferences.Get (Preferences.SYNC_AUTOSYNC_TIMEOUT);
			if (timeout > 0 && timeout < 5) {
				timeout = 5;
				Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT, 5);
			}
			Gtk.HBox autosyncBox = new Gtk.HBox (false, 5);
			// Translators: This is and the next string go together.
			// Together they look like "Automatically Sync in Background Every [_] Minutes",
			// where "[_]" is a GtkSpinButton.
			autosyncCheck =
				new Gtk.CheckButton (Catalog.GetString ("Automaticall_y Sync in Background Every"));
			autosyncSpinner = new Gtk.SpinButton (5, 1000, 1);
			autosyncSpinner.Value = timeout >= 5 ? timeout : 10;
			Gtk.Label autosyncExtraText =
				// Translators: See above comment for details on
				// this string.
				new Gtk.Label (Catalog.GetString ("Minutes"));
			autosyncCheck.Active = autosyncSpinner.Sensitive = timeout >= 5;
			EventHandler updateTimeoutPref = (o, e) => {
				Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT,
				                 autosyncCheck.Active ? (int) autosyncSpinner.Value : -1);
			};
			autosyncCheck.Toggled += (o, e) => {
				autosyncSpinner.Sensitive = autosyncCheck.Active;
				updateTimeoutPref (o, e);
			};
			autosyncSpinner.ValueChanged += updateTimeoutPref;

			autosyncBox.PackStart (autosyncCheck);
			autosyncBox.PackStart (autosyncSpinner);
			autosyncBox.PackStart (autosyncExtraText);
			vbox.PackStart (autosyncBox, false, true, 0);

			Gtk.HButtonBox bbox = new Gtk.HButtonBox ();
			bbox.Spacing = 4;
			bbox.LayoutStyle = Gtk.ButtonBoxStyle.End;

			// "Advanced..." button to bring up extra sync config dialog
			Gtk.Button advancedConfigButton = new Gtk.Button (Catalog.GetString ("_Advanced..."));
			advancedConfigButton.Clicked += OnAdvancedSyncConfigButton;
			advancedConfigButton.Show ();
			bbox.PackStart (advancedConfigButton, false, false, 0);
			bbox.SetChildSecondary (advancedConfigButton, true);

			resetSyncAddinButton = new Gtk.Button (Gtk.Stock.Clear);
			resetSyncAddinButton.Clicked += OnResetSyncAddinButton;
			resetSyncAddinButton.Sensitive =
			        (selectedSyncAddin != null &&
			         addin_id == selectedSyncAddin.Id &&
			         selectedSyncAddin.IsConfigured);
			resetSyncAddinButton.Show ();
			bbox.PackStart (resetSyncAddinButton, false, false, 0);

			// TODO: Tabbing should go directly from sync prefs widget to here
			// TODO: Consider connecting to "Enter" pressed in sync prefs widget
			saveSyncAddinButton = new Gtk.Button (Gtk.Stock.Save);
			saveSyncAddinButton.Clicked += OnSaveSyncAddinButton;
			saveSyncAddinButton.Sensitive =
			        (selectedSyncAddin != null &&
			         (addin_id != selectedSyncAddin.Id || !selectedSyncAddin.IsConfigured));
			saveSyncAddinButton.Show ();
			bbox.PackStart (saveSyncAddinButton, false, false, 0);

			syncAddinCombo.Sensitive =
			        (selectedSyncAddin == null ||
			         addin_id != selectedSyncAddin.Id ||
			         !selectedSyncAddin.IsConfigured);

			bbox.Show ();
			vbox.PackStart (bbox, false, false, 0);

			vbox.ShowAll ();
			return vbox;
		}
示例#29
0
 private void BindComboboxValue(ComboBox d, 
     string value)
 {
     TreeIter iter;
     d.Model.GetIterFirst (out iter);
     do {
         var thisRow = new GLib.Value ();
         d.Model.GetValue (iter, 0, ref thisRow);
         var cur = thisRow.Val as string;
         if (cur != null && cur.Equals (value)) {
             d.SetActiveIter (iter);
             break;
         }
     } while(d.Model.IterNext (ref iter));
 }
示例#30
0
        private void GenerateComboBox(ref Table table, string name, string label, string selectVal,int xPos,List<SettingValue> list,bool isAndroidSupportDevice)
        {
            xPos = xPos+3;
            Label lblApp = new Label(label);
            lblApp.Xalign = 1;
            lblApp.Yalign = 0.5F;
            lblApp.WidthRequest = 115;
            if(table.Name != "table1")
                lblApp.WidthRequest = 114;

            CellRendererText textRenderer = new CellRendererText();

            ComboBox cbe = new ComboBox();//(val);

            ListStore cbModel = new ListStore(typeof(string), typeof(string));

            cbe.PackStart(textRenderer, true);
            cbe.AddAttribute(textRenderer, "text", 0);

            cbe.Name = name;
            cbe.Model= cbModel;
            cbe.Active = 0;

            TreeIter ti = new TreeIter();

            foreach(SettingValue ds in list){// MainClass.Settings.InstallLocations){
                if(ds.Value == selectVal){
                    ti = cbModel.AppendValues(ds.Display,ds.Value);
                    cbe.SetActiveIter(ti);
                } else  cbModel.AppendValues(ds.Display,ds.Value);
            }
            if(cbe.Active <0)
                cbe.Active =0;
            if(isAndroidSupportDevice){
                cbe.Changed+= delegate(object sender, EventArgs e) {
                    if(cbe.Active !=0){
                        if(!MainClass.LicencesSystem.CheckFunction("androidsupporteddevices",parentWindow)){
                            cbe.Active =0;
                            return;
                        }
                    }
                };
            }

            table.Attach(lblApp,0,1,(uint)(xPos-1),(uint)xPos,AttachOptions.Fill,AttachOptions.Shrink,0,0);
            table.Attach(cbe,1,2,(uint)(xPos-1),(uint)xPos,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Expand,0,0);
        }
        private void SetItem(ref ComboBox combo, string itemValue)
        {
            Gtk.TreeIter iter;
            bool existsItem = combo.Model.GetIterFirst (out iter);
            combo.SetActiveIter(iter);

            while (existsItem)
            {
                // check for item
                if ( (string)combo.Model.GetValue(iter, 0) == itemValue)
                {
                    // select item
                    combo.SetActiveIter(iter);
                    break;
                }

                existsItem = combo.Model.IterNext (ref iter);
            }
        }
示例#32
0
        private void GenerateComboBoxSigning(ref Table table, string name, string label, string selectVal,int xPos,List<SettingValue> list)
        {
            xPos = xPos+3;
            Label lblApp = new Label(label);
            lblApp.Xalign = 1;
            lblApp.Yalign = 0.5F;
            lblApp.WidthRequest = 115;
            if(table.Name != "table1")
                lblApp.WidthRequest = 114;

            CellRendererText textRenderer = new CellRendererText();

            ComboBox cbe = new ComboBox();//(val);

            ListStore cbModel = new ListStore(typeof(string), typeof(string));

            cbe.PackStart(textRenderer, true);
            cbe.AddAttribute(textRenderer, "text", 0);

            cbe.Name = name;
            cbe.Model= cbModel;
            cbe.Active = 0;

            if(MainClass.Platform.IsMac){
                TreeIter ti = new TreeIter();

                foreach(SettingValue ds in list){// MainClass.Settings.InstallLocations){
                    if(ds.Value == selectVal){
                        ti = cbModel.AppendValues(ds.Display,ds.Value);
                        cbe.SetActiveIter(ti);
                    } else  cbModel.AppendValues(ds.Display,ds.Value);
                }
                if(cbe.Active <0)
                    cbe.Active =0;
            } else {
                cbe.Sensitive = false;
                if(!String.IsNullOrEmpty(selectVal)){
                    cbModel.AppendValues(selectVal,selectVal);
                    cbe.Active =0;
                } else {
                    Pango.FontDescription customFont =  Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont);
                    customFont.Weight = Pango.Weight.Bold;
                    cbe.ModifyFont(customFont);

                    cbModel.AppendValues("Please, don´t forget set the provisioning","");
                    cbe.Active =0;
                }
            }

            table.Attach(lblApp,0,1,(uint)(xPos-1),(uint)xPos,AttachOptions.Fill,AttachOptions.Shrink,0,0);
            table.Attach(cbe,1,2,(uint)(xPos-1),(uint)xPos,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Expand,0,0);
        }
示例#33
0
        public PdfExportDialog(GameManager manager, ITranslations translations) : base(translations, "PdfExportDialog.ui", "pdfexportbox")
        {
            pdfExporter            = new PdfExporter(translations);
            this.manager           = manager;
            games_spinbutton.Value = 10;
            checkbox_logic.Active  = checkbox_calculation.Active = checkbox_verbal.Active = true;

            // Use defaults from Preferences
            switch ((GameDifficulty)Preferences.Get <int> (Preferences.DifficultyKey))
            {
            case GameDifficulty.Easy:
                rb_easy.Active = rb_easy.HasFocus = true;
                break;

            case GameDifficulty.Medium:
                rb_medium.Active = rb_medium.HasFocus = true;
                break;

            case GameDifficulty.Master:
                rb_master.Active = rb_master.HasFocus = true;
                break;
            }
            // File selection
            string def_file;

            def_file = System.IO.Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                // Translators: default file name used when exporting PDF files (keep the pdf extension please)
                Catalog.GetString("games.pdf"));

            file = new BrowseFile(hbox_file, def_file, true);

            FileFilter[] filters = new FileFilter [2];
            filters[0] = new FileFilter();
            filters[0].AddPattern("*.pdf");
            filters[0].Name = Catalog.GetString("PDF files");

            filters[1] = new FileFilter();
            filters[1].AddPattern("*.*");
            filters[1].Name = Catalog.GetString("All files");

            file.Filters = filters;

            ListStore    layout_store = new ListStore(typeof(string), typeof(int));             // DisplayName, index to array
            CellRenderer layout_cell  = new CellRendererText();

            layout_combo.Model = layout_store;
            layout_combo.PackStart(layout_cell, true);
            layout_combo.SetCellDataFunc(layout_cell, ComboBoxCellFunc);

            int [] per_side = pdfExporter.PagesPerSide;

            for (int i = 0; i < per_side.Length; i++)
            {
                layout_store.AppendValues(per_side[i].ToString(), per_side[i]);
            }

            // Default value
            TreeIter iter;
            bool     more = layout_store.GetIterFirst(out iter);

            while (more)
            {
                if ((int)layout_store.GetValue(iter, COLUMN_VALUE) == DEF_SIDEVALUE)
                {
                    layout_combo.SetActiveIter(iter);
                    break;
                }
                more = layout_store.IterNext(ref iter);
            }
        }
示例#34
0
 // Utility functions
 private void SetComboBoxIndex(ref ComboBox cb, int index)
 {
     Gtk.TreeIter Iter;
     cb.Model.IterNthChild(out Iter, index);
     cb.SetActiveIter(Iter);
 }