bool CanUseNewName(string newName)
        {
            if (!System.Text.RegularExpressions.Regex.IsMatch(newName, "[\\w-]+"))
            {
                MessageService.ShowError("Compiler configuration", "Compiler name can only contain letters/digits/'-'");

                return(false);
            }

            Gtk.TreeIter iter;
            compilerStore.GetIterFirst(out iter);

            do
            {
                var virtCmp = compilerStore.GetValue(iter, 1) as DCompilerConfiguration;

                if (virtCmp.Vendor == newName)
                {
                    MessageService.ShowError("Compiler configuration", "Compiler name already taken");
                    return(false);
                }
            } while (compilerStore.IterNext(ref iter));

            return(true);
        }
        public void NotificationUpdated(CustomNotification notification)
        {
            TreeIter iter;
            Boolean  searchMore = NotificationListStore.GetIterFirst(out iter);

            while (searchMore)
            {
                if (NotificationListStore.GetValue(iter, 0) == notification)
                {
                    NotificationListStore.EmitRowChanged(NotificationListStore.GetPath(iter), iter);
                }

                searchMore = NotificationListStore.IterNext(ref iter);
            }
        }
Exemple #3
0
        private void manager_FileTransferRemoved(object sender, FileTransferEventArgs e)
        {
            try {
                // Remove transfer from list
                Gtk.TreeIter iter;
                transferListStore.GetIterFirst(out iter);
                if (transferListStore.IterIsValid(iter))
                {
                    do
                    {
                        IFileTransfer currentItem = (IFileTransfer)transferListStore.GetValue(iter, 0);
                        if (currentItem == e.Transfer)
                        {
                            transferListStore.Remove(ref iter);
                            return;
                        }
                    }  while (transferListStore.IterNext(ref iter));
                }

                Gui.MainWindow.RefreshCounts();
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
                Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
            }
        }
Exemple #4
0
        // load the phone book
        // Since we have SelectionMode.Multiple turned on we have to
        // jump through these hoops in GTK-2.0 to get a selection
        private void on_book_treeview_selection(object o, EventArgs args)
        {
            Gtk.TreeIter iter = new Gtk.TreeIter();
            //Value value = new Value(); delete me
            string selectionText = null;

            book_store.GetIterFirst(out iter);
            if (book.Selection.IterIsSelected(iter))
            {
                selectionText = (string)book_store.GetValue(iter, 0);
            }

            while (book_store.IterNext(ref iter))
            {
                if (book.Selection.IterIsSelected(iter))
                {
                    selectionText = (string)book_store.GetValue(iter, 0);
                }
            }

            // Ok now we can finally load the phone book
            foreach (Phonebook p in myPhoneBooks)
            {
                if (p.Name == selectionText)
                {
                    load_phone_book(p);
                }
            }
        }
Exemple #5
0
        // returns a list of arrays of columns size
        public ArrayList GetAllRows()
        {
            ArrayList rows = new ArrayList();

            // Really get the whole row.
            string[] col = new string[store.NColumns];
            store.GetIterFirst(out iter);

            for (int i = 0; i < store.NColumns; i++)
            {
                try {
                    col[i] = (string)store.GetValue(iter, i);
                    //Console.WriteLine("Column {0}",col[i]);
                }
                catch (Exception e) {
                    Console.WriteLine("[newphonebook.GetAllRows] Exception: {0}", e);
                }
            }
            rows.Add(col);

                        #if DEBUG
            Console.WriteLine("got columns");
                        #endif

            while (store.IterNext(ref iter))
            {
                string[] coln = new string[store.NColumns];
                for (int i = 0; i < store.NColumns; i++)
                {
                    coln[i] = (string)store.GetValue(iter, i);
                }
                rows.Add(coln);
            }
            return(rows);
        }
Exemple #6
0
        protected void OnButtonOrdinalDownClicked(object sender, EventArgs e)
        {
            TreeIter SelectIter, NextIter;

            treeviewref.Selection.GetSelected(out SelectIter);
            NextIter = SelectIter = filter.ConvertIterToChildIter(SelectIter);
            RefListStore.IterNext(ref NextIter);
            RefListStore.Swap(SelectIter, NextIter);
            OnTreeviewrefCursorChanged(treeviewref, EventArgs.Empty);
            TestOrdinalChanged();
        }
        private void AddPattern(Pattern pattern)
        {
            PatternListStore.AppendValues("icon-dark-play", pattern, "icon-dark-pencil-square-o", "icon-dark-clone", "icon-dark-trash");
            pattern.Animations.Add(new Animation());
            DataModel.Patterns.Add(pattern);

            TreeIter iterator;

            PatternListStore.GetIterFirst(out iterator);

            do
            {
                if (pattern == (Pattern)PatternListStore.GetValue(iterator, PatternColumn))
                {
                    ignoreNextClick = true;
                    treeviewPatterns.SetCursor(PatternListStore.GetPath(iterator), treeviewPatterns.Columns[PatternColumn], false);
                    break;
                }
            }while (PatternListStore.IterNext(ref iterator));
        }
Exemple #8
0
        TreeIter FindJob(JobInfo job)
        {
            TreeIter iter;

            for (bool ok = listStore.GetIterFirst(out iter); ok; ok = listStore.IterNext(ref iter))
            {
                if (listStore.GetValue(iter, COLUMN_JOB_INFORMATION) == job)
                {
                    return(iter);
                }
            }
            return(TreeIter.Zero);
        }
Exemple #9
0
        private void on_NewPhoneBookDruidEdge_finish(object o, Gnome.FinishClickedArgs args)
        {
            if (GfaxRadioButton.Active)
            {
                phonebooktype = "gfax";
                booknames.Add(NewPhoneBookNameEntry.Text);
            }
            else if (EvolutionRadioButton.Active)
            {
                phonebooktype = "evolution";

                Gtk.TreeIter iter = new Gtk.TreeIter();

                // Get the first row.
                store.GetIterFirst(out iter);

                try {
                    if ((bool)store.GetValue(iter, 0))                          // if use is true (toggle set)
                    {
                        booknames.Add((string)store.GetValue(iter, 1));
                    }
                } catch (Exception e) {
                    Console.WriteLine("[newphonebook.NewPhoneBookDruidPage_finish] Exception: {0}", e);
                }

                // get the rest of the rows
                while (store.IterNext(ref iter))
                {
                    try {
                        if ((bool)store.GetValue(iter, 0))
                        {
                            booknames.Add((string)store.GetValue(iter, 1));
                        }
                    }
                    catch (Exception e) {
                        Console.WriteLine("[newphonebook.NewPhoneBookDruidPage_finish] Exception: {0}", e);
                    }
                }
            }
            else if (DatabaseRadioButton.Active)
            {
                phonebooktype = "sql";
            }
            else if (LDAPRadioButton.Active)
            {
                phonebooktype = "ldap";
            }

            NewPhoneBookDialog.Hide();
            NewPhoneBookDialog.Dispose();
        }
        public void UpdateCurrentFrame()
        {
            TreeIter iter;

            if (!store.GetIterFirst(out iter))
            {
                return;
            }

            do
            {
                int frame = (int)store.GetValue(iter, FrameIndexColumn);

                if (frame == DebuggingService.CurrentFrameIndex)
                {
                    store.SetValue(iter, IconColumn, Gtk.Stock.GoForward);
                }
                else
                {
                    store.SetValue(iter, IconColumn, null);
                }
            } while (store.IterNext(ref iter));
        }
Exemple #11
0
        public void UpdateCurrentFrame()
        {
            TreeIter it;
            int      n = 0;

            if (!store.GetIterFirst(out it))
            {
                return;
            }

            do
            {
                if (n == DebuggingService.CurrentFrameIndex)
                {
                    store.SetValue(it, 0, Gtk.Stock.GoForward);
                }
                else
                {
                    store.SetValue(it, 0, null);
                }
                n++;
            } while (store.IterNext(ref it));
        }
 void SelectPad(Pad pad)
 {
     Gtk.TreeIter iter;
     if (padListStore.GetIterFirst(out iter))
     {
         do
         {
             Pad curPad = padListStore.GetValue(iter, 2) as Pad;
             if (pad == curPad)
             {
                 treeviewPads.Selection.SelectIter(iter);
                 return;
             }
         } while (padListStore.IterNext(ref iter));
     }
 }
 void SelectDocument(Document doc)
 {
     Gtk.TreeIter iter;
     if (documentListStore.GetIterFirst(out iter))
     {
         do
         {
             Document curDocument = documentListStore.GetValue(iter, 2) as Document;
             if (doc == curDocument)
             {
                 treeviewDocuments.Selection.SelectIter(iter);
                 return;
             }
         } while (documentListStore.IterNext(ref iter));
     }
 }
Exemple #14
0
        public bool Store()
        {
            ApplyToVirtConfiguration();

            DCompilerService.Instance.Compilers.Clear();

            Gtk.TreeIter iter;
            compilerStore.GetIterFirst(out iter);
            do
            {
                var virtCmp = compilerStore.GetValue(iter, 1) as DCompilerConfiguration;

                DCompilerService.Instance.Compilers.Add(virtCmp);
            } while (compilerStore.IterNext(ref iter));

            DCompilerService.Instance.DefaultCompiler = defaultCompilerVendor;

            return(true);
        }
 void OnExecuteCommand(bool Delete)
 {
     if (ConfirmRemove(Delete))
     {
         MusicLibrarySource Library = ServiceManager.SourceManager.MusicLibrary;
         if (Library.CanRemoveTracks && Library.CanDeleteTracks)
         {
             Gtk.TreeIter Iter = new Gtk.TreeIter();
             if (MusicListStore.GetIterFirst(out Iter))
             {
                 do
                 {
                     if (Delete && (bool)MusicListStore.GetValue(Iter, 0))
                     {
                         //delete
                         string Uri = (string)MusicListStore.GetValue(Iter, 5);
                         Uri = Uri.Replace("file://", "");
                         RemoveTrack((int)MusicListStore.GetValue(Iter, 7));
                         DeleteTrack(Uri);
                     }
                     else if ((bool)MusicListStore.GetValue(Iter, 0))
                     {
                         RemoveTrack((int)MusicListStore.GetValue(Iter, 7));
                     }
                 } while (MusicListStore.IterNext(ref Iter));
                 Library.Reload();
             }
             else
             {
                 Log.Warning("Please Don't Click Execute with nothing selected");
             }
         }
         else
         {
             Log.Warning("Can not remove or delete any tracks");
         }
         ReloadWindow();
     }
 }
Exemple #16
0
        private void StoreSearch(string query)
        {
            Gtk.TreeIter iter;

            if (history.GetIterFirst(out iter))
            {
                string val;

                do
                {
                    val = (string)history.GetValue(iter, 0);

                    if (val == query)
                    {
                        history.Remove(ref iter);
                    }
                } while (val != query && history.IterNext(ref iter));
            }

            iter = history.Insert(0);
            history.SetValue(iter, 0, query);
        }
		static TreeIter FindTask (ListStore store, Task task)
		{
			TreeIter iter;
			if (!store.GetIterFirst (out iter))
				return TreeIter.Zero;
			
			do {
				Task t = store.GetValue (iter, (int)Columns.Task) as Task;
				if (t == task)
					return iter;
			}
			while (store.IterNext (ref iter));
			
			return TreeIter.Zero;
		}
Exemple #18
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();

        List<Categoria> categorias = new List<Categoria> ();
        categorias.Add (new Categoria (1, "Uno"));
        categorias.Add (new Categoria (2, "Dos"));
        categorias.Add (new Categoria (3, "Tres"));
        categorias.Add (new Categoria (4, "Cuatro"));

        int categoriaId = -1;

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

        //		CellRendererText cellRendererText2 = new CellRendererText ();
        //		comboBox.PackStart (cellRendererText2, false);
        //		comboBox.AddAttribute (cellRendererText2, "text", 1);

        ListStore listStore = new ListStore (typeof(int), typeof(string));
        TreeIter treeIterInicial = listStore.AppendValues ((ulong)0, "<sin asignar>");

        IDbCommand dbCommand = AppDomain.Instance.DvConnection.CreateCommand ();
        dbCommand.CommandText = "selected id, nombre from categoria";
        IDataReader dataReader = dbCommand.ExecuteReader ();

        while (dataReader.Read()) {
            object id = dataReader ["id"];
            object nombre = dataReader ["nombre"];

        foreach (Categoria categoria in categorias) {
            TreeIter currentIter = listStore.AppendValues (categoria.Id, categoria.Nombre);
            if (categoria.Id == categoriaId)
                treeIterInicial = currentIter;
        }
        //		listStore.AppendValues (1, "Uno");
        //		listStore.AppendValues (2, "Dos");

        comboBox.Model = listStore;

        comboBox.SetActiveIter (treeIterInicial);

        TreeIter currentTreeIter;
        listStore.GetIterFirst (out currentTreeIter);
        listStore.GetIterFirst (out currentTreeIter);
        do {
            if(categoriaId.Equals(listStore.GetValue(treeIterInicial, 0))) {
                comboBox.SetActiveIter(currentTreeIter);
                break;
            }
        }
            while (listStore.IterNext (ref currentTreeIter));
        //listStore.GetValue (currentTreeIter, 0);

        propertiesAction.Activated += delegate {
            TreeIter treeIter;
            bool activeIter = comboBox.GetActiveIter (out treeIter);
            object id = activeIter ? listStore.GetValue (treeIter, 0) : null;
            // ? significa el boolean si tiene algo dentro ejecuta la primera orden y sino, es null.
            Console.WriteLine ("id={0}", id);

        };
        }
		public InspectionPanelWidget (string mimeType)
		{
			this.Build ();
//			this.mimeType = mimeType;
			
			
			treeviewInspections.AppendColumn ("Title", new CellRendererText (), "text", 0);
			
			
			var comboRenderer = new CellRendererCombo ();
			var col = treeviewInspections.AppendColumn ("Severity", comboRenderer);
			
			var comboBoxStore = new ListStore (typeof(string), typeof(QuickTaskSeverity));
			comboBoxStore.AppendValues (GetDescription (QuickTaskSeverity.None), QuickTaskSeverity.None);
			comboBoxStore.AppendValues (GetDescription (QuickTaskSeverity.Error), QuickTaskSeverity.Error);
			comboBoxStore.AppendValues (GetDescription (QuickTaskSeverity.Warning), QuickTaskSeverity.Warning);
			comboBoxStore.AppendValues (GetDescription (QuickTaskSeverity.Hint), QuickTaskSeverity.Hint);
			comboBoxStore.AppendValues (GetDescription (QuickTaskSeverity.Suggestion), QuickTaskSeverity.Suggestion);
			comboRenderer.Model = comboBoxStore;
			comboRenderer.Mode = CellRendererMode.Activatable;
			comboRenderer.TextColumn = 0;
			comboRenderer.Editable = true;
			comboRenderer.HasEntry = false;
			
			comboRenderer.Edited += delegate(object o, Gtk.EditedArgs args) {
				Gtk.TreeIter iter;
				if (!treeStore.GetIterFromString (out iter, args.Path))
					return;
				
				Gtk.TreeIter storeIter;
				if (!comboBoxStore.GetIterFirst (out storeIter))
					return;
				Console.WriteLine ("new text:" + args.NewText);
				do {
					if ((string)comboBoxStore.GetValue (storeIter, 0) == args.NewText) {
						treeStore.SetValue (iter, 1, (QuickTaskSeverity)comboBoxStore.GetValue (storeIter, 1));
						return;
					}
				} while (comboBoxStore.IterNext (ref storeIter));
			};
			
			col.SetCellDataFunc (comboRenderer, delegate (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) {
				var severity = (QuickTaskSeverity)treeStore.GetValue (iter, 1);
				comboRenderer.Text = GetDescription (severity);
			});
			treeviewInspections.HeadersVisible = false;
			treeviewInspections.Model = treeStore;
			treeviewInspections.Selection.Changed += HandleSelectionChanged;

			foreach (var node in RefactoringService.GetInspectors (mimeType)) {
				treeStore.AppendValues (node.Title, node.GetSeverity (), node);
			}
		}
		public override void LaunchDialogue ()
		{
			//the Type in the collection
			IList collection = (IList) Value;
			string displayName = Property.DisplayName;

			//populate list with existing items
			ListStore itemStore = new ListStore (typeof (object), typeof (int), typeof (string));
			for (int i=0; i<collection.Count; i++)
				itemStore.AppendValues(collection [i], i, collection [i].ToString ());

			#region Building Dialogue
			
			TreeView itemTree;
			PropertyGrid grid;
			TreeIter previousIter = TreeIter.Zero;

			//dialogue and buttons
			Dialog dialog = new Dialog () {
				Title = displayName + " Editor",
				Modal = true,
				AllowGrow = true,
				AllowShrink = true,
			};
			var toplevel = this.Container.Toplevel as Window;
			if (toplevel != null)
				dialog.TransientFor = toplevel;
			
			dialog.AddActionWidget (new Button (Stock.Cancel), ResponseType.Cancel);
			dialog.AddActionWidget (new Button (Stock.Ok), ResponseType.Ok);
			
			//three columns for items, sorting, PropGrid
			HBox hBox = new HBox ();
			dialog.VBox.PackStart (hBox, true, true, 5);

			//propGrid at end
			grid = new PropertyGrid (base.EditorManager) {
				CurrentObject = null,
				WidthRequest = 200,
				ShowHelp = false
			};
			hBox.PackEnd (grid, true, true, 5);

			//followed by a ButtonBox
			VBox buttonBox = new VBox ();
			buttonBox.Spacing = 6;
			hBox.PackEnd (buttonBox, false, false, 5);
			
			//add/remove buttons
			Button addButton = new Button (new Image (Stock.Add, IconSize.Button));
			buttonBox.PackStart (addButton, false, false, 0);
			if (types [0].IsAbstract)
				addButton.Sensitive = false;
			Button removeButton = new Button (new Gtk.Image (Stock.Remove, IconSize.Button));
			buttonBox.PackStart (removeButton, false, false, 0);
			
			//sorting buttons
			Button upButton = new Button (new Image (Stock.GoUp, IconSize.Button));
			buttonBox.PackStart (upButton, false, false, 0);
			Button downButton = new Button (new Image (Stock.GoDown, IconSize.Button));
			buttonBox.PackStart (downButton, false, false, 0);

			//Third column has list (TreeView) in a ScrolledWindow
			ScrolledWindow listScroll = new ScrolledWindow ();
			listScroll.WidthRequest = 200;
			listScroll.HeightRequest = 320;
			hBox.PackStart (listScroll, false, false, 5);
			
			itemTree = new TreeView (itemStore);
			itemTree.Selection.Mode = SelectionMode.Single;
			itemTree.HeadersVisible = false;
			listScroll.AddWithViewport (itemTree);

			//renderers and attribs for TreeView
			CellRenderer rdr = new CellRendererText ();
			itemTree.AppendColumn (new TreeViewColumn ("Index", rdr, "text", 1));
			rdr = new CellRendererText ();
			itemTree.AppendColumn (new TreeViewColumn ("Object", rdr, "text", 2));

			#endregion

			#region Events

			addButton.Clicked += delegate {
				//create the object
				object instance = System.Activator.CreateInstance (types[0]);
				
				//get existing selection and insert after it
				TreeIter oldIter, newIter;
				if (itemTree.Selection.GetSelected (out oldIter))
					newIter = itemStore.InsertAfter (oldIter);
				//or append if no previous selection 
				else
					newIter = itemStore.Append ();
				itemStore.SetValue (newIter, 0, instance);
				
				//select, set name and update all the indices
				itemTree.Selection.SelectIter (newIter);
				UpdateName (itemStore, newIter);
				UpdateIndices (itemStore);
			};
			
			removeButton.Clicked += delegate {
				//get selected iter and the replacement selection
				TreeIter iter, newSelection;
				if (!itemTree.Selection.GetSelected (out iter))
					return;
				
				newSelection = iter;
				if (!IterPrev (itemStore, ref newSelection)) {
					newSelection = iter;
					if (!itemStore.IterNext (ref newSelection))
						newSelection = TreeIter.Zero;
				}
				
				//new selection. Zeroing previousIter prevents trying to update name of deleted iter.
				previousIter = TreeIter.Zero;
				if (itemStore.IterIsValid (newSelection))
					itemTree.Selection.SelectIter (newSelection);
				
				//and the removal and index update
				itemStore.Remove (ref iter);
				UpdateIndices (itemStore);
			};
			
			upButton.Clicked += delegate {
				TreeIter iter, prev;
				if (!itemTree.Selection.GetSelected (out iter))
					return;
	
				//get previous iter
				prev = iter;
				if (!IterPrev (itemStore, ref prev))
					return;
	
				//swap the two
				itemStore.Swap (iter, prev);
	
				//swap indices too
				object prevVal = itemStore.GetValue (prev, 1);
				object iterVal = itemStore.GetValue (iter, 1);
				itemStore.SetValue (prev, 1, iterVal);
				itemStore.SetValue (iter, 1, prevVal);
			};
			
			downButton.Clicked += delegate {
				TreeIter iter, next;
				if (!itemTree.Selection.GetSelected (out iter))
					return;
	
				//get next iter
				next = iter;
				if (!itemStore.IterNext (ref next))
					return;
				
				//swap the two
				itemStore.Swap (iter, next);
	
				//swap indices too
				object nextVal = itemStore.GetValue (next, 1);
				object iterVal = itemStore.GetValue (iter, 1);
				itemStore.SetValue (next, 1, iterVal);
				itemStore.SetValue (iter, 1, nextVal);
			};
			
			itemTree.Selection.Changed += delegate {
				TreeIter iter;
				if (!itemTree.Selection.GetSelected (out iter)) {
					removeButton.Sensitive = false;
					return;
				}
				removeButton.Sensitive = true;
	
				//update grid
				object obj = itemStore.GetValue (iter, 0);
				grid.CurrentObject = obj;
				
				//update previously selected iter's name
				UpdateName (itemStore, previousIter);
				
				//update current selection so we can update
				//name next selection change
				previousIter = iter;
			};
			
			grid.Changed += delegate {
				TreeIter iter;
				if (itemTree.Selection.GetSelected (out iter))
					UpdateName (itemStore, iter);
			};
			
			TreeIter selectionIter;
			removeButton.Sensitive = itemTree.Selection.GetSelected (out selectionIter);
			
			dialog.ShowAll ();
			grid.ShowToolbar = false;
			
			#endregion
			
			//if 'OK' put items back in collection
			//if (MonoDevelop.Ide.MessageService.ShowCustomDialog (dialog, toplevel) == (int)ResponseType.Ok)
			{
				DesignerTransaction tran = CreateTransaction (Instance);
				object old = collection;
			
				try {
					collection.Clear();
					foreach (object[] o in itemStore)
						collection.Add (o[0]);
					EndTransaction (Instance, tran, old, collection, true);
				}
				catch {
					EndTransaction (Instance, tran, old, collection, false);
					throw;
				}
			}
		}
		static void UpdateIndices (ListStore itemStore)
		{
			TreeIter iter;
			int i = 0;
			if (!itemStore.GetIterFirst (out iter))
				return;
			
			do {
				itemStore.SetValue (iter, 1, i);
				i++;
			} while (itemStore.IterNext (ref iter));
		}
Exemple #22
0
        void ejecutar_consulta_reporte(PrintContext context)
        {
            Cairo.Context         cr     = context.CairoContext;
            Pango.Layout          layout = context.CreatePangoLayout();
            Pango.FontDescription desc   = Pango.FontDescription.FromString("Sans");
            // cr.Rotate(90)  Imprimir Orizontalmente rota la hoja cambian las posiciones de las lineas y columna
            fontSize  = 8.0;                 layout = null;                  layout = context.CreatePangoLayout();
            desc.Size = (int)(fontSize * pangoScale);               layout.FontDescription = desc;

            imprime_encabezado(cr, layout);
            comienzo_linea += separacion_linea;
            //cr.Rotate(90);  //Imprimir Orizontalmente rota la hoja cambian las posiciones de las lineas y columna
            fontSize  = 9.0;
            desc.Size = (int)(fontSize * pangoScale);                                       layout.FontDescription = desc;
            layout.FontDescription.Weight = Weight.Bold;                        // Letra negrita
            cr.MoveTo(05 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows);                   layout.SetText(this.nombre_estudio);            Pango.CairoHelper.ShowLayout(cr, layout);
            layout.FontDescription.Weight = Weight.Normal;                      // Letra negrita

            cr.MoveTo(570 * escala_en_linux_windows, (comienzo_linea + separacion_linea) * escala_en_linux_windows);
            cr.LineTo(05, comienzo_linea + separacion_linea);                   // Linea Horizontal 4
            cr.Stroke();

            fontSize        = 8.0;
            desc.Size       = (int)(fontSize * pangoScale);                                       layout.FontDescription = desc;
            comienzo_linea += separacion_linea;
            comienzo_linea += separacion_linea;
            cr.MoveTo(100 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows);                  layout.SetText("PARAMETROS");           Pango.CairoHelper.ShowLayout(cr, layout);
            cr.MoveTo(250 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows);                  layout.SetText("RESULTADOS");           Pango.CairoHelper.ShowLayout(cr, layout);
            cr.MoveTo(400 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows);                  layout.SetText("V.R.");         Pango.CairoHelper.ShowLayout(cr, layout);
            comienzo_linea += separacion_linea;
            comienzo_linea += separacion_linea;

            int lineahorizontal = comienzo_linea;

            TreeIter iter;

            if (this.treeViewEngineresultados.GetIterFirst(out iter))
            {
                if ((bool)this.lista_de_resultados.Model.GetValue(iter, 5) == true)
                {
                    if ((string)this.lista_de_resultados.Model.GetValue(iter, 0) != "")
                    {
                        cr.MoveTo(570 * escala_en_linux_windows, (comienzo_linea) * escala_en_linux_windows);
                        cr.LineTo(05, comienzo_linea);                                  // Linea Horizontal 4
                        cr.LineWidth = 0.1;
                        cr.Stroke();
                    }
                    cr.MoveTo(25 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows);                   layout.SetText((string)this.lista_de_resultados.Model.GetValue(iter, 0));              Pango.CairoHelper.ShowLayout(cr, layout);
                    cr.MoveTo(230 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows);                  layout.SetText((string)this.lista_de_resultados.Model.GetValue(iter, 1));              Pango.CairoHelper.ShowLayout(cr, layout);
                    cr.MoveTo(360 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows);                  layout.SetText((string)this.lista_de_resultados.Model.GetValue(iter, 2));              Pango.CairoHelper.ShowLayout(cr, layout);
                    cr.MoveTo(570 * escala_en_linux_windows, (comienzo_linea + separacion_linea) * escala_en_linux_windows);
                    cr.LineTo(05, comienzo_linea + separacion_linea);                           // Linea Horizontal 4
                    cr.Stroke();
                    comienzo_linea += separacion_linea;
                }
                while (treeViewEngineresultados.IterNext(ref iter))
                {
                    if ((bool)this.lista_de_resultados.Model.GetValue(iter, 5) == true)
                    {
                        if ((string)this.lista_de_resultados.Model.GetValue(iter, 0) != "")
                        {
                            cr.MoveTo(570 * escala_en_linux_windows, (comienzo_linea) * escala_en_linux_windows);
                            cr.LineTo(05, comienzo_linea);                                      // Linea Horizontal 4
                            cr.LineWidth = 0.1;
                            cr.Stroke();
                        }
                        cr.MoveTo(25 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows);                   layout.SetText((string)this.lista_de_resultados.Model.GetValue(iter, 0));              Pango.CairoHelper.ShowLayout(cr, layout);
                        cr.MoveTo(230 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows);                  layout.SetText((string)this.lista_de_resultados.Model.GetValue(iter, 1));              Pango.CairoHelper.ShowLayout(cr, layout);
                        cr.MoveTo(360 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows);                  layout.SetText((string)this.lista_de_resultados.Model.GetValue(iter, 2));              Pango.CairoHelper.ShowLayout(cr, layout);
                        comienzo_linea += separacion_linea;
                    }
                }
            }
            cr.MoveTo(570 * escala_en_linux_windows, (comienzo_linea) * escala_en_linux_windows);
            cr.LineTo(05, comienzo_linea);
            cr.LineWidth = 0.1;

            cr.MoveTo(05 * escala_en_linux_windows, lineahorizontal * escala_en_linux_windows);
            cr.LineTo(05, comienzo_linea);

            cr.MoveTo(570 * escala_en_linux_windows, lineahorizontal * escala_en_linux_windows);
            cr.LineTo(570, comienzo_linea);

            cr.Stroke();
            comienzo_linea += separacion_linea;
            comienzo_linea += separacion_linea;
            cr.MoveTo(05 * escala_en_linux_windows, comienzo_linea * escala_en_linux_windows);           layout.SetText("Observaciones: " + observa);              Pango.CairoHelper.ShowLayout(cr, layout);

            cr.MoveTo(300 * escala_en_linux_windows, 660 * escala_en_linux_windows);             layout.SetText("Quimico: ");            Pango.CairoHelper.ShowLayout(cr, layout);
            cr.MoveTo(300 * escala_en_linux_windows, 670 * escala_en_linux_windows);             layout.SetText(quimicoautorizado);      Pango.CairoHelper.ShowLayout(cr, layout);
            cr.MoveTo(300 * escala_en_linux_windows, 680 * escala_en_linux_windows);             layout.SetText("Ced.Prof. " + cedulaquimico);             Pango.CairoHelper.ShowLayout(cr, layout);

            Gtk.Image image5 = new Gtk.Image();
            image5.Name = "image5";
            //image5.Pixbuf = new Gdk.Pixbuf(System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "osiris.jpg"));
            image5.Pixbuf = new Gdk.Pixbuf("/opt/osiris/bin/firma_quimica.jpg");               // en Linux
            //image5.Pixbuf.ScaleSimple(128, 128, Gdk.InterpType.Bilinear);
            //Gdk.CairoHelper.SetSourcePixbuf(cr,image5.Pixbuf,05,comienzo_linea*escala_en_linux_windows);
            //Gdk.CairoHelper.SetSourcePixbuf(cr,image5.Pixbuf.ScaleSimple(145, 50, Gdk.InterpType.Bilinear),1,1);
            //Gdk.CairoHelper.SetSourcePixbuf(cr,image5.Pixbuf.ScaleSimple(130, 91, Gdk.InterpType.Bilinear),300*escala_en_linux_windows,570*escala_en_linux_windows);
            Gdk.CairoHelper.SetSourcePixbuf(cr, image5.Pixbuf, 300 * escala_en_linux_windows, 570 * escala_en_linux_windows);
            cr.Fill();
            cr.Paint();
            cr.Restore();
        }
        public PreferencesDialog(PlayerHistory history)
            : base("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);
            english_checkbutton.Active = Preferences.Get <bool> (Preferences.EnglishKey);

            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);
            }
        }
        public ProjectPropertiesDialog(Project project)
            : base("ProjectPropertiesDialog.ui", "projectproperties")
        {
            Gtk.Box.BoxChild child;
            TreeIter iter;
            bool more;

            this.project = project;
            dvd_project = project.Details.Type == ProjectType.DVD;

            // General tab
            name.Text = project.Details.Name;
            output_dir.Text = project.Details.OutputDir;

            fontslides_button.FontName = project.Details.SlideshowsFontName;

            backslides_button.UseAlpha = foreslides_button.UseAlpha = true;
            foreslides_button.Alpha = (ushort) (project.Details.SlideshowsForeColor.A * 65535);
            backslides_button.Alpha = (ushort) (project.Details.SlideshowsBackColor.A * 65535);

            foreslides_button.Color = Utils.CairoToGdkColor (project.Details.SlideshowsForeColor);
            backslides_button.Color = Utils.CairoToGdkColor (project.Details.SlideshowsBackColor);

            if (dvd_project == true) // DVD tab
            {
                notebook.RemovePage (PAGE_THEORA);

                fontbuttons_button.FontName = project.Details.ButtonsFontName;

                forebuttons_button.UseAlpha = backbuttons_button.UseAlpha = true;
                forebuttons_button.Alpha = (ushort) (project.Details.ButtonsForeColor.A * 65535);
                backbuttons_button.Alpha = (ushort) (project.Details.ButtonsBackColor.A * 65535);

                forebuttons_button.Color = Utils.CairoToGdkColor (project.Details.ButtonsForeColor);
                backbuttons_button.Color = Utils.CairoToGdkColor (project.Details.ButtonsBackColor);

                pal_radio.Active = project.Details.Format == VideoFormat.PAL;
                ntsc_radio.Active = project.Details.Format == VideoFormat.NTSC;

                fourbythree_radio.Active = project.Details.AspectRatio == AspectRatio.FourByThree;
                sixteenbynine_radio.Active = project.Details.AspectRatio == AspectRatio.SixteenByNine;

                thumbnail_store = new ListStore (typeof (string), typeof (int)); // DisplayName, int
                CellRenderer thumbnail_cell = new CellRendererText ();
                thumbnail_combo.Model = thumbnail_store;
                thumbnail_combo.PackStart (thumbnail_cell, true);
                thumbnail_combo.SetCellDataFunc (thumbnail_cell, Utils.ComboBoxCellFunc);
                LoadThumbnailsIntoCombo ();

                // Default thumbnail size
                int thumbnail = project.Details.ButtonThumbnailSize;
                int current;

                more = thumbnail_store.GetIterFirst (out iter);
                while (more)
                {
                    current = (int) thumbnail_store.GetValue (iter, COLUMN_ID);
                    if (thumbnail == current) {
                        thumbnail_combo.SetActiveIter (iter);
                        break;
                    }
                    more = thumbnail_store.IterNext (ref iter);
                }

                // Margins
                child = (Gtk.Box.BoxChild) (fourbythree_hbox [fourbythree_radio]);
                child.Padding = PADDING + OFFSET;

                child = (Gtk.Box.BoxChild) (sixteenbynine_hbox [sixteenbynine_radio]);
                child.Padding = PADDING + OFFSET;

                child = (Gtk.Box.BoxChild) (pal_hbox [pal_radio]);
                child.Padding = PADDING + OFFSET;

                child = (Gtk.Box.BoxChild) (ntsc_hbox [ntsc_radio]);
                child.Padding = PADDING + OFFSET;

            } else { // Theora tab

                notebook.RemovePage (PAGE_DVD);

                resolution_store = new ListStore (typeof (string), typeof (int)); // DisplayName, index to array
                CellRenderer resolution_cell = new CellRendererText ();
                resolution_combobox.Model = resolution_store;
                resolution_combobox.PackStart (resolution_cell, true);
                resolution_combobox.SetCellDataFunc (resolution_cell, Utils.ComboBoxCellFunc);
                LoadResolutionIntoCombo ();

                // Select default item in the combobox list
                more = resolution_store.GetIterFirst (out iter);
                while (more)
                {
                    int idx = (int) resolution_store.GetValue (iter, COL_INDEX);
                    if (ResolutionManager.List[idx].Width == project.Details.Width &&
                        ResolutionManager.List[idx].Height == project.Details.Height) {
                        resolution_combobox.SetActiveIter (iter);
                        break;
                    }
                    more = resolution_store.IterNext (ref iter);
                }

                child = (Gtk.Box.BoxChild) (resolution_hbox [resolution_label]);
                child.Padding = PADDING + OFFSET;
            }

            // Top margin for the General tab
            child = (Gtk.Box.BoxChild) (general_vbox [vbox25]);
            child.Padding = PADDING;

            // Left margin for controls
            child = (Gtk.Box.BoxChild) (name_hbox [name]);
            child.Padding = PADDING;

            child = (Gtk.Box.BoxChild) (output_dir_hbox [output_dir]);
            child.Padding = PADDING;
        }
		public CodeIssuePanelWidget (string mimeType)
		{
			this.mimeType = mimeType;
			Build ();

			var col1 = treeviewInspections.AppendColumn ("Title", new CellRendererText (), "markup", 0);
			col1.Expand = true;

			searchentryFilter.Ready = true;
			searchentryFilter.Visible = true;
			searchentryFilter.Entry.Changed += ApplyFilter;

			var comboRenderer = new CellRendererCombo ();
			comboRenderer.Alignment = Pango.Alignment.Center;
			var col = treeviewInspections.AppendColumn ("Severity", comboRenderer);
			col.Sizing = TreeViewColumnSizing.GrowOnly;
			col.MinWidth = 100;
			col.Expand = false;

			var comboBoxStore = new ListStore (typeof(string), typeof(Severity));
			comboBoxStore.AppendValues (GetDescription (Severity.None), Severity.None);
			comboBoxStore.AppendValues (GetDescription (Severity.Error), Severity.Error);
			comboBoxStore.AppendValues (GetDescription (Severity.Warning), Severity.Warning);
			comboBoxStore.AppendValues (GetDescription (Severity.Hint), Severity.Hint);
			comboBoxStore.AppendValues (GetDescription (Severity.Suggestion), Severity.Suggestion);
			comboRenderer.Model = comboBoxStore;
			comboRenderer.Mode = CellRendererMode.Activatable;
			comboRenderer.TextColumn = 0;

			comboRenderer.Editable = true;
			comboRenderer.HasEntry = false;
			
			comboRenderer.Edited += delegate(object o, Gtk.EditedArgs args) {
				Gtk.TreeIter iter;
				if (!treeStore.GetIterFromString (out iter, args.Path))
					return;

				Gtk.TreeIter storeIter;
				if (!comboBoxStore.GetIterFirst (out storeIter))
					return;
				do {
					if ((string)comboBoxStore.GetValue (storeIter, 0) == args.NewText) {
						var provider = (BaseCodeIssueProvider)treeStore.GetValue (iter, 1);
						var severity = (Severity)comboBoxStore.GetValue (storeIter, 1);
						severities[provider] = severity;
						return;
					}
				} while (comboBoxStore.IterNext (ref storeIter));
			};
			
			col.SetCellDataFunc (comboRenderer, delegate (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) {
				var provider = (BaseCodeIssueProvider)model.GetValue (iter, 1);
				if (provider == null) {
					comboRenderer.Visible = false;
					return;
				}
				var severity = severities[provider];
				comboRenderer.Visible = true;
				comboRenderer.Text = GetDescription (severity);
				comboRenderer.BackgroundGdk = GetColor (severity);
			});
			treeviewInspections.HeadersVisible = false;
			treeviewInspections.Model = treeStore;
			treeviewInspections.Selection.Changed += HandleSelectionChanged;
			GetAllSeverities ();
			FillInspectors (null);
		}
Exemple #26
0
        // When finished gfax.Destinations will contain a list of contacts
        // of Phonebook.Contact type.
        private void on_SendfaxButton_clicked(object o, EventArgs args)
        {
            Gtk.TreeIter iter = new Gtk.TreeIter();
            ArrayList    rows = new ArrayList();

            if (includeFilename == "do_filename")
            {
                filename = FilenameEntry.Text;
            }

            if (!File.Exists(filename))
            {
                MessageDialog md;
                md = new MessageDialog(null, DialogFlags.DestroyWithParent,
                                       MessageType.Info, ButtonsType.Ok,
                                       Catalog.GetString(
                                           @"
The file you have entered does not exist.
Please check the name and try again.")
                                       );
                md.Run();
                md.Destroy();
                return;
            }

            // clear all the distinations, it's a little wierd yup
            gfax.Destinations.Clear();

            // Get the first row.
            ItemStore.GetIterFirst(out iter);

            try {
                if ((bool)ItemStore.GetValue(iter, 0))                                  // if send is true (toggle set)

                {
                    GfaxContact c = new GfaxContact();
                    c.PhoneNumber   = (string)ItemStore.GetValue(iter, 1);                      // number
                    c.Organization  = (string)ItemStore.GetValue(iter, 2);                      // organization
                    c.ContactPerson = (string)ItemStore.GetValue(iter, 3);                      // contact

                    rows.Add(c);
                }
            }
            catch (Exception e) {
                Console.WriteLine("[guitools.on_faxsendbutton_clicked] Exception: {0}", e);
                MessageDialog md;
                md = new MessageDialog(
                    null,
                    DialogFlags.DestroyWithParent,
                    MessageType.Info,
                    ButtonsType.Ok,
                    Catalog.GetString(
                        @"
You have not entered a facsimile number!
Please enter a number and press the <i><b>Enter</b></i> key or
click the <i><b>Phone Book</b></i> button to select numbers or
entire phone books.")
                    );
                md.Run();
                md.Destroy();
                return;
            }

            // get the rest of the rows
            while (ItemStore.IterNext(ref iter))
            {
                try {
                    if ((bool)ItemStore.GetValue(iter, 0))                                      // if send is true (toggle set)

                    {
                        GfaxContact c = new GfaxContact();
                        c.PhoneNumber   = (string)ItemStore.GetValue(iter, 1);                          // number
                        c.Organization  = (string)ItemStore.GetValue(iter, 2);                          // organization
                        c.ContactPerson = (string)ItemStore.GetValue(iter, 3);                          // contact

                        rows.Add(c);
                    }
                }
                catch (Exception e) {
                    Console.WriteLine("[guitools.onfaxsendbutton_clicked] Exception: {0}", e);
                }
            }


            if (SendCheckbutton.Active)
            {
                gfax.timeToSend = DateTime.UtcNow;
            }
            else
            {
                // Convert to UTC for Hylafax
                gfax.timeToSend = (SendDateedit.Time).ToUniversalTime();
            }

            gfax.Destinations = rows;

            //get the fine resolution status
            gfax.sendWizardResolution = ResolutionCheckbutton.Active;
            //get the email flag and email address
            gfax.sendWizardEmailNotify  = EmailCheckbutton.Active;
            gfax.sendWizardEmailAddress = EmailEntry.Text;

            if (gfax.Destinations.Count > 0)
            {
                dosend = true;                  // yes send the fax
            }
            //((Gtk.Window) gxml["NewFaxDialog"]).Hide();
            NewFaxDialog.Hide();
            Application.Quit();
        }
Exemple #27
0
        public NewProjectDialog()
            : base("NewProjectDialog.ui", "newproject")
        {
            TreeIter iter;

            // Comboboxes are added with a HBox to be able to align them
            pal_radio = new Gtk.RadioButton (Catalog.GetString ("PAL (Europe)"));
            AddRadioButton (videoformat_vbox, pal_radio, 24);

            ntsc_radio = new Gtk.RadioButton (pal_radio, Catalog.GetString ("NTSC"));
            AddRadioButton (videoformat_vbox, ntsc_radio, 24);

            fourbythree_radio = new Gtk.RadioButton (Catalog.GetString ("4:3 (TV)"));
            AddRadioButton (aspectratio_vbox, fourbythree_radio, 10);

            sixteenbynine_radio = new Gtk.RadioButton (fourbythree_radio, Catalog.GetString ("16:9 (Widescreen)"));
            AddRadioButton (aspectratio_vbox, sixteenbynine_radio, 10);

            resolution_store = new ListStore (typeof (string), typeof (int)); // DisplayName, index to array
            CellRenderer resolution_combocell = new CellRendererText ();
            resolution_combobox.Model = resolution_store;
            resolution_combobox.PackStart (resolution_combocell, true);
            resolution_combobox.SetCellDataFunc (resolution_combocell, Utils.ComboBoxCellFunc);

            LoadResolutionIntoCombo ();

            // Select default item in the combobox list
            bool more = resolution_store.GetIterFirst (out iter);
            while (more)
            {
                int idx = (int) resolution_store.GetValue (iter, COL_INDEX);
                if (ResolutionManager.List[idx].Width == ResolutionManager.Default.Width &&
                    ResolutionManager.List[idx].Height == ResolutionManager.Default.Height) {
                    resolution_combobox.SetActiveIter (iter);
                    break;
                }
                more = resolution_store.IterNext (ref iter);
            }

            // Translators: This is the default project name for a new project
            name.Text = Catalog.GetString ("Project");
            output_dir.Text = OutputDirFromName ();
            name.Changed += OnChangedProjectName;
            output_dir.Changed += OnChangedOutputDir;
            changed = false;
            slideshows_radio.Toggled += new EventHandler (OnProjectTypeToggled);
            ProjectTypeSensitive ();
        }
Exemple #28
0
        public void Load(DProject proj, DProjectConfiguration config)
        {
            project       = proj;
            configuration = config;

            cbUseDefaultCompiler.Active       = proj.UseDefaultCompilerVendor;
            cbPreferOneStepCompilation.Active = proj.PreferOneStepBuild;

            OnUseDefaultCompilerChanged();
            Gtk.TreeIter iter;
            if (cmbCompiler.Model.GetIterFirst(out iter))
            {
                do
                {
                    if (proj.UsedCompilerVendor == cmbCompiler.Model.GetValue(iter, 0) as string)
                    {
                        cmbCompiler.SetActiveIter(iter);
                        break;
                    }
                } while (cmbCompiler.Model.IterNext(ref iter));
            }

            extraCompilerTextView.Buffer.Text = config.ExtraCompilerArguments;
            extraLinkerTextView.Buffer.Text   = config.ExtraLinkerArguments;

            text_BinDirectory.Text     = config.OutputDirectory;
            text_TargetFile.Text       = config.Output;
            text_ObjectsDirectory.Text = config.ObjectDirectory;
            text_DDocDir.Text          = config.DDocDirectory;

            if (config.CustomDebugIdentifiers == null)
            {
                text_debugConstants.Text = "";
            }
            else
            {
                text_debugConstants.Text = string.Join(";", config.CustomDebugIdentifiers);
            }
            if (config.CustomVersionIdentifiers == null)
            {
                text_versionConstants.Text = "";
            }
            else
            {
                text_versionConstants.Text = string.Join(";", config.CustomVersionIdentifiers);
            }
            spin_debugLevel.Value = (double)config.DebugLevel;

            // Disable debug-specific fields on non-debug configurations
            text_debugConstants.Sensitive = spin_debugLevel.Sensitive = config.DebugMode;

            if (model_compileTarget.GetIterFirst(out iter))
            {
                do
                {
                    if (config.CompileTarget == (DCompileTarget)model_compileTarget.GetValue(iter, 1))
                    {
                        combo_ProjectType.SetActiveIter(iter);
                        break;
                    }
                } while (model_compileTarget.IterNext(ref iter));
            }

            text_Libraries.Buffer.Text = string.Join("\n", config.ExtraLibraries);
            text_Includes.Buffer.Text  = string.Join("\n", proj.LocalIncludeCache.ParsedDirectories);

            // Remove old children list
            var depsChildren = ((ArrayList)vbox_ProjectDeps.AllChildren);

            for (int k = depsChildren.Count - 1; k >= 0; k--)
            {
                vbox_ProjectDeps.Remove((Widget)depsChildren[k]);
            }

            // Init new project dep list
            int i = 0;

            foreach (var prj in proj.ParentSolution.GetAllProjects())
            {
                if (prj == proj)
                {
                    continue;
                }

                var cb = new Gtk.CheckButton(prj.Name)
                {
                    CanFocus      = true,
                    DrawIndicator = true,
                    UseUnderline  = false,
                    Active        = proj.ProjectDependencies.Contains(prj.ItemId)
                };

                cb.Data.Add("prj", prj);

                vbox_ProjectDeps.Add(cb);

                var bc = (Box.BoxChild)vbox_ProjectDeps[cb];
                bc.Expand   = false;
                bc.Fill     = false;
                bc.Position = i++;
            }
            vbox_ProjectDeps.ShowAll();
        }
		public CodeIssuePanelWidget (string mimeType)
		{
			this.mimeType = mimeType;
			// ReSharper disable once DoNotCallOverridableMethodsInConstructor
			Build ();

			// ensure selected row remains visible
			treeviewInspections.SizeAllocated += (o, args) => {
				TreeIter iter;
				if (treeviewInspections.Selection.GetSelected (out iter)) {
					var path = treeviewInspections.Model.GetPath (iter);
					treeviewInspections.ScrollToCell (path, treeviewInspections.Columns[0], false, 0f, 0f);
				}
			};
			treeviewInspections.TooltipColumn = 2;
			treeviewInspections.HasTooltip = true;

			var toggleRenderer = new CellRendererToggle ();
			toggleRenderer.Toggled += delegate(object o, ToggledArgs args) {
				TreeIter iter;
				if (treeStore.GetIterFromString (out iter, args.Path)) {
					var provider = (BaseCodeIssueProvider)treeStore.GetValue (iter, 1);
					enableState[provider] = !enableState[provider];
				}
			};

			var titleCol = new TreeViewColumn ();
			treeviewInspections.AppendColumn (titleCol);
			titleCol.PackStart (toggleRenderer, false);
			titleCol.Sizing = TreeViewColumnSizing.Autosize;
			titleCol.SetCellDataFunc (toggleRenderer, delegate (TreeViewColumn treeColumn, CellRenderer cell, TreeModel model, TreeIter iter) {
				var provider = (BaseCodeIssueProvider)model.GetValue (iter, 1);
				if (provider == null) {
					toggleRenderer.Visible = false;
					return;
				}
				toggleRenderer.Visible = true;
				toggleRenderer.Active = enableState[provider];
			});


			var cellRendererText = new CellRendererText {
				Ellipsize = Pango.EllipsizeMode.End
			};
			titleCol.PackStart (cellRendererText, true);
			titleCol.AddAttribute (cellRendererText, "markup", 0);
			titleCol.Expand = true;

			searchentryFilter.ForceFilterButtonVisible = true;
			searchentryFilter.RoundedShape = true;
			searchentryFilter.HasFrame = true;
			searchentryFilter.Ready = true;
			searchentryFilter.Visible = true;
			searchentryFilter.Entry.Changed += ApplyFilter;


			var comboRenderer = new CellRendererCombo {
				Alignment = Pango.Alignment.Center
			};
			var col = treeviewInspections.AppendColumn ("Severity", comboRenderer);
			col.Sizing = TreeViewColumnSizing.GrowOnly;
			col.MinWidth = 100;
			col.Expand = false;

			var comboBoxStore = new ListStore (typeof(string), typeof(Severity));
//			comboBoxStore.AppendValues (GetDescription (Severity.None), Severity.None);
			comboBoxStore.AppendValues (GetDescription (Severity.Error), Severity.Error);
			comboBoxStore.AppendValues (GetDescription (Severity.Warning), Severity.Warning);
			comboBoxStore.AppendValues (GetDescription (Severity.Hint), Severity.Hint);
			comboBoxStore.AppendValues (GetDescription (Severity.Suggestion), Severity.Suggestion);
			comboRenderer.Model = comboBoxStore;
			comboRenderer.Mode = CellRendererMode.Activatable;
			comboRenderer.TextColumn = 0;

			comboRenderer.Editable = true;
			comboRenderer.HasEntry = false;
			
			comboRenderer.Edited += delegate(object o, EditedArgs args) {
				TreeIter iter;
				if (!treeStore.GetIterFromString (out iter, args.Path))
					return;

				TreeIter storeIter;
				if (!comboBoxStore.GetIterFirst (out storeIter))
					return;
				do {
					if ((string)comboBoxStore.GetValue (storeIter, 0) == args.NewText) {
						var provider = (BaseCodeIssueProvider)treeStore.GetValue (iter, 1);
						var severity = (Severity)comboBoxStore.GetValue (storeIter, 1);
						severities[provider] = severity;
						return;
					}
				} while (comboBoxStore.IterNext (ref storeIter));
			};
			
			col.SetCellDataFunc (comboRenderer, delegate (TreeViewColumn treeColumn, CellRenderer cell, TreeModel model, TreeIter iter) {
				var provider = (BaseCodeIssueProvider)model.GetValue (iter, 1);
				if (provider == null) {
					comboRenderer.Visible = false;
					return;
				}
				var severity = severities[provider];
				comboRenderer.Visible = true;
				comboRenderer.Text = GetDescription (severity);
				comboRenderer.BackgroundGdk = GetColor (severity);
			});
			treeviewInspections.HeadersVisible = false;
			treeviewInspections.Model = treeStore;
			GetAllSeverities ();
			FillInspectors (null);
		}
Exemple #30
0
        public PreferencesDialog()
            : base("PreferencesDialog.ui", "preferences")
        {
            bool more;
            TreeIter iter;
            string effect, selected;

            transition_store = new ListStore (typeof (string), typeof (string)); // DisplayName, Name
            CellRenderer transition_cell = new CellRendererText ();
            transition_combo.Model = transition_store;
            transition_combo.PackStart (transition_cell, true);
            transition_combo.SetCellDataFunc (transition_cell, Utils.ComboBoxCellFunc);
            LoadTransitionsIntoCombo ();

            thumbnail_store = new ListStore (typeof (string), typeof (int)); // DisplayName, int
            CellRenderer thumbnail_cell = new CellRendererText ();
            thumbnail_combo.Model = thumbnail_store;
            thumbnail_combo.PackStart (thumbnail_cell, true);
            thumbnail_combo.SetCellDataFunc (thumbnail_cell, Utils.ComboBoxCellFunc);
            LoadThumbnailsIntoCombo ();

            textposition_store = new ListStore (typeof (string), typeof (int)); // DisplayName, int
            CellRenderer textposition_cell = new CellRendererText ();
            textposition_combo.Model = textposition_store;
            textposition_combo.PackStart (textposition_cell, true);
            textposition_combo.SetCellDataFunc (textposition_cell, Utils.ComboBoxCellFunc);
            LoadTextPositionsIntoCombo ();

            projectsdir = new BrowseFile (projectsdir_hbox, Mistelix.Preferences.GetStringValue (Preferences.ProjectsDirectoryKey), false);
            videosdir = new BrowseFile (videosdir_hbox, Mistelix.Preferences.GetStringValue (Preferences.VideosDirectoryKey), false);
            imagesdir = new BrowseFile (imagesdir_hbox, Mistelix.Preferences.GetStringValue (Preferences.ImagesDirectoryKey), false);
            audiodir = new BrowseFile (audiodir_hbox, Mistelix.Preferences.GetStringValue (Preferences.AudioDirectoryKey), false);

            duration_spin.Value = Mistelix.Preferences.GetIntValue (Preferences.DefaultDurationKey);

            // Default Transition effect
            selected = Mistelix.Preferences.GetStringValue (Preferences.DefaultTransitionKey);
            more = transition_store.GetIterFirst (out iter);
            while (more)
            {
                effect = (string) transition_store.GetValue (iter, (int) ColumnsCombo.Column_Name);
                if (effect.Equals (selected)) {
                    transition_combo.SetActiveIter (iter);
                    break;
                }
                more = transition_store.IterNext (ref iter);
            }

            // Default thumbnail size
            int thumbnail = Mistelix.Preferences.GetIntValue (Preferences.ThumbnailSizeKey);
            int current;

            more = thumbnail_store.GetIterFirst (out iter);
            while (more)
            {
                current = (int) thumbnail_store.GetValue (iter, (int) ColumnsCombo.Column_Name);
                if (thumbnail == current) {
                    thumbnail_combo.SetActiveIter (iter);
                    break;
                }
                more = thumbnail_store.IterNext (ref iter);
            }

            // Default text position box
            int position = Mistelix.Preferences.GetIntValue (Preferences.DefaultTextPositionKey);

            more = textposition_store.GetIterFirst (out iter);
            while (more)
            {
                current = (int) textposition_store.GetValue (iter, (int) ColumnsCombo.Column_Name);
                if (position == current) {
                    textposition_combo.SetActiveIter (iter);
                    break;
                }
                more = textposition_store.IterNext (ref iter);
            }
        }
Exemple #31
0
 protected void UpdateCombo()
 {
     ListStore store = new ListStore (typeof(string));
     comboboxConnections.Model = store;
     foreach (Connection c in Connections)
         store.AppendValues (c.ConnectionName);
     SelectedConnection = (String)MachineConfig.ConfigSource.Configs ["Default"].Get ("ConnectionName", String.Empty);
     if (SelectedConnection != String.Empty) {
         if (Connections.Find (m => m.ConnectionName == SelectedConnection) == null) {
             MachineConfig.ConfigSource.Configs ["Default"].Set ("ConnectionName", String.Empty);
             MachineConfig.ConfigSource.Save ();
             SelectedConnection = String.Empty;
         } else {
             TreeIter tempIter;
             store.GetIterFirst (out tempIter);
             do {
                 if ((string)store.GetValue (tempIter, 0) == SelectedConnection) {
                     comboboxConnections.SetActiveIter (tempIter);
                     break;
                 }
             } while (store.IterNext (ref tempIter));
         }
     } else
         comboboxConnections.Active = 0;
     if (comboboxConnections.Active == -1)
         server = entryUser.Text = entryPassword.Text = "";
 }
        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);
            }
        }
		void MoveItem (TreeView sourceList, ListStore sourceStore, TreeView targetList, ListStore targetStore)
		{
			TreeModel model;
			TreeIter iter;
			
			if (sourceList.Selection.GetSelected (out model, out iter)) {
				TreeIter newiter = targetStore.AppendValues (sourceStore.GetValue (iter, 0), sourceStore.GetValue (iter, 1));
				targetList.Selection.SelectIter (newiter);
				
				TreeIter oldIter = iter;
				if (sourceStore.IterNext (ref iter))
					sourceList.Selection.SelectIter (iter);
				sourceStore.Remove (ref oldIter);
			}
		}
Exemple #34
0
        public void Load(DProject proj, DProjectConfiguration config)
        {
            project       = proj;
            configuration = config;

            cbUseDefaultCompiler.Active       = proj.UseDefaultCompilerVendor;
            cbPreferOneStepCompilation.Active = proj.PreferOneStepBuild;

            OnUseDefaultCompilerChanged();
            Gtk.TreeIter iter;
            if (cmbCompiler.Model.GetIterFirst(out iter))
            {
                do
                {
                    if (proj.UsedCompilerVendor == cmbCompiler.Model.GetValue(iter, 0) as string)
                    {
                        cmbCompiler.SetActiveIter(iter);
                        break;
                    }
                } while (cmbCompiler.Model.IterNext(ref iter));
            }

            extraCompilerTextView.Buffer.Text = config.ExtraCompilerArguments;
            extraLinkerTextView.Buffer.Text   = config.ExtraLinkerArguments;

            text_BinDirectory.Text     = config.OutputDirectory;
            text_TargetFile.Text       = config.Output;
            text_ObjectsDirectory.Text = config.ObjectDirectory;
            text_DDocDir.Text          = config.DDocDirectory;

            if (config.CustomDebugIdentifiers == null)
            {
                text_debugConstants.Text = "";
            }
            else
            {
                text_debugConstants.Text = string.Join(";", config.CustomDebugIdentifiers);
            }
            if (config.CustomVersionIdentifiers == null)
            {
                text_versionConstants.Text = "";
            }
            else
            {
                text_versionConstants.Text = string.Join(";", config.CustomVersionIdentifiers);
            }
            spin_debugLevel.Value = (double)config.DebugLevel;

            // Disable debug-specific fields on non-debug configurations
            text_debugConstants.Sensitive = spin_debugLevel.Sensitive = config.DebugMode;

            if (model_compileTarget.GetIterFirst(out iter))
            {
                do
                {
                    if (config.CompileTarget == (DCompileTarget)model_compileTarget.GetValue(iter, 1))
                    {
                        combo_ProjectType.SetActiveIter(iter);
                        break;
                    }
                } while (model_compileTarget.IterNext(ref iter));
            }

            text_Libraries.Buffer.Text = string.Join("\n", config.ExtraLibraries);
        }