public static string CreateFile (string name, int size) { using (Gdk.Pixbuf test = new Gdk.Pixbuf (null, "f-spot-32.png")) { using (Gdk.Pixbuf tmp = test.ScaleSimple (size, size, Gdk.InterpType.Bilinear)) { string path = System.IO.Path.GetTempPath (); path = System.IO.Path.Combine (path, name); Console.WriteLine (path); string extension = System.IO.Path.GetExtension (path); string type = "null"; switch (extension.ToLower ()) { case ".jpg": case ".jpeg": type = "jpeg"; break; case ".png": type = "png"; break; case ".tiff": type = "tiff"; break; } tmp.Save (path, type); return path; } } }
/// <summary> /// this function modifies a window shape /// </summary> /// <param name="bmp"> /// the bitmap that has the shape of the window. <see cref="System.Drawing.Bitmap"/> /// </param> /// <param name="window"> /// the window to apply the shape change <see cref="Gtk.Window"/> /// </param> /// <returns> /// true if it succeded, either return false <see cref="System.Boolean"/> /// </returns> public static bool ModifyWindowShape( System.Drawing.Bitmap bmp, Gtk.Window window ) { bool ret = false; try { //save bitmap to stream System.IO.MemoryStream stream = new System.IO.MemoryStream(); bmp.Save( stream, System.Drawing.Imaging.ImageFormat.Png ); //verry important: put stream on position 0 stream.Position = 0; //get the pixmap mask Gdk.Pixbuf buf = new Gdk.Pixbuf( stream, bmp.Width, bmp.Height ); Gdk.Pixmap map1, map2; buf.RenderPixmapAndMask( out map1, out map2, 255 ); //shape combine window window.ShapeCombineMask( map2, 0, 0 ); //dispose buf.Dispose(); map1.Dispose(); map2.Dispose(); bmp.Dispose(); //if evrything is ok return true; ret = true; } catch(Exception ex) { Console.WriteLine( ex.Message + "\r\n" + ex.StackTrace ); } return ret; }
static VersionControlService () { try { overlay_modified = Gdk.Pixbuf.LoadFromResource("overlay_modified.png"); overlay_removed = Gdk.Pixbuf.LoadFromResource("overlay_removed.png"); overlay_conflicted = Gdk.Pixbuf.LoadFromResource("overlay_conflicted.png"); overlay_added = Gdk.Pixbuf.LoadFromResource("overlay_added.png"); overlay_controled = Gdk.Pixbuf.LoadFromResource("overlay_controled.png"); overlay_unversioned = Gdk.Pixbuf.LoadFromResource("overlay_unversioned.png"); overlay_protected = Gdk.Pixbuf.LoadFromResource("overlay_lock_required.png"); overlay_unlocked = Gdk.Pixbuf.LoadFromResource("overlay_unlocked.png"); overlay_locked = Gdk.Pixbuf.LoadFromResource("overlay_locked.png"); // overlay_normal = Gdk.Pixbuf.LoadFromResource("overlay_normal.png"); icon_modified = ImageService.GetPixbuf ("gtk-edit", Gtk.IconSize.Menu); icon_removed = ImageService.GetPixbuf (Gtk.Stock.Remove, Gtk.IconSize.Menu); icon_conflicted = ImageService.GetPixbuf (Gtk.Stock.DialogWarning, Gtk.IconSize.Menu); icon_added = ImageService.GetPixbuf (Gtk.Stock.Add, Gtk.IconSize.Menu); icon_controled = Gdk.Pixbuf.LoadFromResource("overlay_controled.png"); } catch (Exception e) { LoggingService.LogError ("Error while loading icons.", e); } IdeApp.Workspace.FileAddedToProject += OnFileAdded; //IdeApp.Workspace.FileChangedInProject += OnFileChanged; //IdeApp.Workspace.FileRemovedFromProject += OnFileRemoved; //IdeApp.Workspace.FileRenamedInProject += OnFileRenamed; IdeApp.Workspace.ItemAddedToSolution += OnEntryAdded; IdeApp.Exiting += delegate { DelayedSaveComments (null); }; AddinManager.AddExtensionNodeHandler ("/MonoDevelop/VersionControl/VersionControlSystems", OnExtensionChanged); }
public WelcomePageBarButton (string title, string href, string iconResource = null) { FontFamily = Platform.IsMac ? Styles.WelcomeScreen.FontFamilyMac : Styles.WelcomeScreen.FontFamilyWindows; HoverColor = Styles.WelcomeScreen.Links.HoverColor; Color = Styles.WelcomeScreen.Links.Color; FontSize = Styles.WelcomeScreen.Links.FontSize; VisibleWindow = false; this.Text = GettextCatalog.GetString (title); this.actionLink = href; if (!string.IsNullOrEmpty (iconResource)) { imageHover = Gdk.Pixbuf.LoadFromResource (iconResource); imageNormal = ImageService.MakeTransparent (imageHover, 0.7); } HBox box = new HBox (); box.Spacing = Styles.WelcomeScreen.Links.IconTextSpacing; image = new Image (); label = new Label (); box.PackStart (image, false, false, 0); if (imageNormal == null) image.NoShowAll = true; box.PackStart (label, false, false, 0); box.ShowAll (); Add (box); Update (); Events |= (Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonReleaseMask); }
//this is a popup so it behaves like other splashes on Windows, i.e. doesn't show up as a second window in the taskbar. public SplashScreenForm () : base (Gtk.WindowType.Popup) { AppPaintable = true; this.Decorated = false; this.WindowPosition = WindowPosition.Center; this.TypeHint = Gdk.WindowTypeHint.Splashscreen; try { using (var stream = BrandingService.GetStream ("SplashScreen.png", true)) bitmap = new Gdk.Pixbuf (stream); } catch (Exception e) { LoggingService.LogError ("Can't load splash screen pixbuf 'SplashScreen.png'.", e); } progress = new ProgressBar(); progress.Fraction = 0.00; progress.HeightRequest = 6; vbox = new VBox(); vbox.BorderWidth = 12; label = new Gtk.Label (); label.UseMarkup = true; label.Xalign = 0; vbox.PackEnd (progress, false, true, 0); vbox.PackEnd (label, false, true, 3); this.Add (vbox); if (bitmap != null) this.Resize (bitmap.Width, bitmap.Height); }
public AboutDialog(Gtk.Window parent) { if (parent == null) { throw new ArgumentNullException("parent"); } TransientFor = parent; Name = Frontend.Name; Version = "\n Frontend: " + Frontend.UIName + " " + Frontend.Version + "\n Engine: " + Frontend.EngineVersion; Copyright = "Copyright © 2005-2010 Mirco Bauer <*****@*****.**>"; Authors = new string[] { "Mirco Bauer <*****@*****.**>", "David Paleino <*****@*****.**>", "Clément Bourgeois <*****@*****.**>", "Chris Le Sueur <*****@*****.**>", "Tuukka Hastrup <*****@*****.**>" }; Artists = new string[] { "Jakub Steiner <*****@*****.**>", "Rodney Dawes <*****@*****.**>", "Lapo Calamandrei <*****@*****.**>", "Ahmed Abdellah <*****@*****.**>" }; TranslatorCredits = _("translator-credits"); Logo = new Gdk.Pixbuf(null, "icon.svg", 256, 256); Website = "http://www.smuxi.org/"; WebsiteLabel = _("Smuxi Website"); }
public static Gdk.Pixbuf ToPixbuf(ArtworkFormat format, byte[] data) { Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8, format.Width, format.Height); Gdk.Pixbuf rotated = null; switch (format.PixelFormat) { case PixelFormat.Rgb565: UnpackRgb565 (data, pixbuf, false); break; case PixelFormat.Rgb565BE: UnpackRgb565 (data, pixbuf, true); break; case PixelFormat.IYUV: UnpackIYUV (data, pixbuf); break; default: throw new ApplicationException ("Unknown pixel format: " + format.PixelFormat); } if (format.Rotation > 0) { rotated = Rotate (pixbuf, format.Rotation); pixbuf.Dispose (); pixbuf = rotated; } return pixbuf; }
public ProjectFileSelectorDialog (Project project, string defaultFilterName, string defaultFilterPattern, string [] buildActions) { this.project = project; this.defaultFilter = new SelectFileDialogFilter (defaultFilterName, defaultFilterPattern ?? "*"); this.buildActions = buildActions; this.Build(); projBuf = ImageService.GetPixbuf (project.StockIcon, IconSize.Menu); dirClosedBuf = ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.ClosedFolder, IconSize.Menu); dirOpenBuf = ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.OpenFolder, IconSize.Menu); TreeViewColumn projectCol = new TreeViewColumn (); projectCol.Title = GettextCatalog.GetString ("Project Folders"); var pixRenderer = new CellRendererPixbuf (); CellRendererText txtRenderer = new CellRendererText (); projectCol.PackStart (pixRenderer, false); projectCol.PackStart (txtRenderer, true); projectCol.SetCellDataFunc (pixRenderer, new TreeCellDataFunc (PixDataFunc)); projectCol.SetCellDataFunc (txtRenderer, new TreeCellDataFunc (TxtDataFunc)); projectTree.Model = dirStore; projectTree.AppendColumn (projectCol); TreeIter projectIter = dirStore.AppendValues ("", FilePath.Empty); InitDirs (projectIter); projectTree.ExpandAll (); projectTree.RowActivated += delegate { fileList.GrabFocus (); }; projectTree.KeyPressEvent += ProjectListKeyPressEvent; TreeViewColumn fileCol = new TreeViewColumn (); var filePixRenderer = new CellRendererPixbuf (); fileCol.Title = GettextCatalog.GetString ("Files"); fileCol.PackStart (filePixRenderer, false); fileCol.PackStart (txtRenderer, true); fileCol.AddAttribute (filePixRenderer, "pixbuf", 1); fileCol.SetCellDataFunc (txtRenderer, new TreeCellDataFunc (TxtFileDataFunc)); fileList.Model = fileStore; fileList.AppendColumn (fileCol); fileList.RowActivated += delegate { TreeIter iter; if (fileList.Selection.GetSelected (out iter)) Respond (ResponseType.Ok); }; fileList.KeyPressEvent += FileListKeyPressEvent; fileList.KeyReleaseEvent += FileListKeyReleaseEvent; TreeIter root; if (dirStore.GetIterFirst (out root)) projectTree.Selection.SelectIter (root); UpdateFileList (null, null); projectTree.Selection.Changed += UpdateFileList; fileList.Selection.Changed += UpdateSensitivity; this.DefaultResponse = ResponseType.Cancel; this.Modal = true; }
/// <summary> /// Loads the pdf. This is the function you call when you want to display a pdf. /// </summary> /// <param name='pdfFileName'> /// Pdf file name. /// </param> public void LoadPdf(string pdfFileName) { pdf = Poppler.Document.NewFromFile(pdfFileName, ""); PageCountLabel.Text = @"/" + (pdf.NPages - 1).ToString(); CurrentPage.Value = 0; CurrentPage.Adjustment.Upper = pdf.NPages-1; foreach (Gtk.Widget w in vboxImages.AllChildren) { vboxImages.Remove(w); } for (this.pageIndex = 0; this.pageIndex < pdf.NPages; this.pageIndex++) { Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8, 0, 0); Gtk.Image img = new Gtk.Image(); img.Pixbuf = pixbuf; img.Name = "image1"; //vboxImages.Add (img); RenderPage(ref img); } this.ShowAll(); }
public ButtonConfirm() { this.Build (); pixbufNormal = image.Pixbuf; pixbufConfirming = Gdk.Pixbuf.LoadFromResource ("IMRpatient.img.trash_delete.png"); }
void Load () { var monitor = loadMonitor; System.Threading.ThreadPool.QueueUserWorkItem (delegate { try { HttpWebRequest req = (HttpWebRequest) HttpWebRequest.Create (url); WebResponse resp = req.GetResponse (); MemoryStream ms = new MemoryStream (); using (var s = resp.GetResponseStream ()) { s.CopyTo (ms); } var data = ms.ToArray (); MonoDevelop.Ide.DispatchService.GuiSyncDispatch (delegate { Gdk.PixbufLoader l = new Gdk.PixbufLoader (resp.ContentType); l.Write (data); image = l.Pixbuf; l.Close (); monitor.Dispose (); }); // Replace the async operation to avoid holding references to all // objects that subscribed the Completed event. loadOperation = NullAsyncOperation.Success; } catch (Exception ex) { loadMonitor.ReportError (null, ex); Gtk.Application.Invoke (delegate { monitor.Dispose (); }); loadOperation = NullAsyncOperation.Failure; } loadMonitor = null; }); }
public FolderChooserDialog( HComboFolder father ) : base(Gtk.WindowType.Popup) { Gtk.IconTheme theme = Gtk.IconTheme.Default; folder_icon = new Gdk.Pixbuf( this.GetType().Assembly, "folder.png"); drive_icon = new Gdk.Pixbuf( this.GetType().Assembly, "drive.png"); if( theme.HasIcon("folder") ) folder_icon = theme.LoadIcon( "folder", 24, Gtk.IconLookupFlags.ForceSvg ); if( theme.HasIcon("harddrive") ) drive_icon = theme.LoadIcon( "harddrive", 24, Gtk.IconLookupFlags.ForceSvg ); this.father = father; this.Build(); //incarca baza DriveInfo[] difs = DriveInfo.GetDrives(); foreach( DriveInfo di in difs ) { // adauga doar discurile fixe if( di.DriveType == DriveType.Fixed ) FolderTree.Nodes.Add( new HTreeNode( di.Name, drive_icon ) ); } //add dummy childs foreach( HTreeNode node in FolderTree.Nodes ) { node.Nodes.Add( new HTreeNode("dummy") ); } }
// Constructor private NoteBookLabel(DI.Diagram diagram) : base(1, 3, false) { _parent = null; _diagram = diagram; //this must change depending of the diagram's type string diagramType = ((DI.SimpleSemanticModelElement)diagram.SemanticModel).TypeInfo; _icon = GetIcon(diagramType); //_icon = new Gdk.Pixbuf (new Gdk.Colorspace(), false, 8, 15, 15); //_icon.Fill (0xffff0000); // Attach(new Gtk.Image(_icon), 0, 1, 0, 1); // _label = new Label(_diagram.Name); Attach(_label, 1, 2, 0, 1); // Image image = new Image(); image.Stock = Gtk.Stock.Close; _close_button = new Button(); _close_button.Add(image); _close_button.HeightRequest = 20; _close_button.WidthRequest = 20; _close_button.Relief = Gtk.ReliefStyle.None; _close_button.Clicked += OnCloseButtonClicked; Tooltips ttips = new Tooltips (); ttips.SetTip (_close_button, GettextCatalog.GetString ("Close diagram"), GettextCatalog.GetString ("Close diagram")); //_close_button. Attach(_close_button, 2, 3, 0, 1); ShowAll(); }
public ExtensionEditorWidget() { this.Build(); pixAddin = ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Addin, IconSize.Menu); pixLocalAddin = ImageService.GetPixbuf ("md-addinauthoring-current-addin", IconSize.Menu); pixExtensionPoint = ImageService.GetPixbuf ("md-extension-point", IconSize.Menu); pixExtensionNode = ImageService.GetPixbuf ("md-extension-node", IconSize.Menu); store = new TreeStore (typeof(string), typeof(string), typeof(Extension), typeof(ExtensionNodeDescription), typeof(Gdk.Pixbuf), typeof(bool), typeof(ExtensionPoint)); state = new TreeViewState (tree, 0); TreeViewColumn col = new TreeViewColumn (); CellRendererPixbuf cpix = new CellRendererPixbuf (); col.PackStart (cpix, false); col.AddAttribute (cpix, "pixbuf", ColIcon); col.AddAttribute (cpix, "visible", ColShowIcon); CellRendererExtension crt = new CellRendererExtension (); crt.Yalign = 0; col.PackStart (crt, true); col.AddAttribute (crt, "markup", ColLabel); tree.AppendColumn (col); tree.Model = store; tree.HeadersVisible = false; tree.Selection.Changed += OnSelectionChanged; IdeApp.ProjectOperations.EndBuild += OnEndBuild; }
public static Gdk.Pixbuf DesaturateIcon(Gdk.Pixbuf source) { Gdk.Pixbuf dest = new Gdk.Pixbuf (source.Colorspace, source.HasAlpha, source.BitsPerSample, source.Width, source.Height); dest.Fill (0); source.SaturateAndPixelate (dest, 0, false); return dest; }
//TODO Add the proxy /// <summary> /// Téléchargement d'image /// </summary> /// <param name="imageUrl"> /// A <see cref="System.String"/> /// </param> /// <param name="login"> /// A <see cref="System.String"/> /// </param> /// <param name="pass"> /// A <see cref="System.String"/> /// </param> /// <returns> /// A <see cref="Gdk.Pixbuf"/> /// </returns> public static Gdk.Pixbuf DonwloadImage(string imageUrl,string login,string pass) { Gdk.Pixbuf pix1 ; try { HttpWebRequest req = (HttpWebRequest) WebRequest.Create (imageUrl); //login, mot de passe if (login != null && pass != null) { req.Credentials = new NetworkCredential(login, pass); } req.KeepAlive = false; req.Timeout = 10000; WebResponse resp = null; resp = req.GetResponse (); Stream s = resp.GetResponseStream (); pix1 = new Gdk.Pixbuf (s); resp.Close (); return pix1; } catch(Exception ex) { Console.WriteLine("Get user image exception: GetTwitterData.cs - GetUserImage()"); Console.WriteLine(ex.StackTrace); return null; } }
public SparkleSpinner(int size) : base() { int current_frame = 0; Gdk.Pixbuf spinner_gallery = SparkleUIHelpers.GetIcon ("process-working", size); int frames_in_width = spinner_gallery.Width / size; int frames_in_height = spinner_gallery.Height / size; int frame_count = (frames_in_width * frames_in_height) - 1; Gdk.Pixbuf [] frames = new Gdk.Pixbuf [frame_count]; int i = 0; for (int y = 0; y < frames_in_height; y++) { for (int x = 0; x < frames_in_width; x++) { if (!(y == 0 && x == 0)) { frames [i] = new Gdk.Pixbuf (spinner_gallery, x * size, y * size, size, size); i++; } } } timer = new Timer () { Interval = 600 / frame_count }; timer.Elapsed += delegate { if (current_frame < frame_count - 1) current_frame++; else current_frame = 0; Application.Invoke (delegate { Pixbuf = frames [current_frame]; }); }; }
public Gdk.Pixbuf GetIcon(Gdk.Color gcolor) { uint color = (((uint)gcolor.Red >> 8) << 24) | (((uint)gcolor.Green >> 8) << 16) | (((uint)gcolor.Blue >> 8) << 8) | 0xff; Gdk.Pixbuf icon = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, 16, 16); icon.Fill (color); return icon; }
static Gdk.Pixbuf GetPixbufFromNSBitmapImageRep (NSBitmapImageRep bitmap, int width, int height) { byte[] data; using (var tiff = bitmap.TiffRepresentation) { data = new byte[tiff.Length]; System.Runtime.InteropServices.Marshal.Copy (tiff.Bytes, data, 0, data.Length); } int pw = bitmap.PixelsWide, ph = bitmap.PixelsHigh; var pixbuf = new Gdk.Pixbuf (data, pw, ph); // if one dimension matches, and the other is same or smaller, use as-is if ((pw == width && ph <= height) || (ph == height && pw <= width)) return pixbuf; // otherwise scale proportionally such that the largest dimension matches the desired size if (pw == ph) { pw = width; ph = height; } else if (pw > ph) { ph = (int) (width * ((float) ph / pw)); pw = width; } else { pw = (int) (height * ((float) pw / ph)); ph = height; } var scaled = pixbuf.ScaleSimple (pw, ph, Gdk.InterpType.Bilinear); pixbuf.Dispose (); return scaled; }
static NoteRecentChanges () { note_icon = GuiUtils.GetIcon ("note", 22); all_notes_icon = GuiUtils.GetIcon ("filter-note-all", 22); unfiled_notes_icon = GuiUtils.GetIcon ("filter-note-unfiled", 22); notebook_icon = GuiUtils.GetIcon ("notebook", 22); }
public static Gdk.Pixbuf CreatePixbufFromResource( Bitmap bitmap ) { // creates a Gdk.Pixbuf from a Bitmap object // thanks to bratsche (Cody Russell) on #mono for the help! BitmapData data = bitmap.LockBits( new Rectangle( 0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb ); IntPtr scan = data.Scan0; int size = bitmap.Width * bitmap.Height * 4; byte[] bdata = new byte[ size ]; Gdk.Pixbuf pixbuf = null; unsafe { byte* p = (byte*)scan; for (int i = 0; i < size; i+=4) { // iterate through bytes. // Bitmap stores it's data in RGBA order. // Pixbuf stores it's data in BGRA order. bdata[ i ] = p[ i+2 ]; // blue bdata[ i+1 ] = p[ i+1 ]; // green bdata[ i+2 ] = p[ i ]; // red bdata[ i+3 ] = p[ i+3 ]; // alpha } } pixbuf = new Gdk.Pixbuf( bdata, true, 8, bitmap.Width, bitmap.Height, data.Stride, null ); bitmap.UnlockBits( data ); return pixbuf; }
public override Gtk.Widget GetVisualizerWidget (ObjectValue val) { var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone (); string file = Path.GetTempFileName (); Gdk.Pixbuf pixbuf; ops.AllowTargetInvoke = true; try { var pix = (RawValue) val.GetRawValue (ops); pix.CallMethod ("Save", file, "png"); pixbuf = new Gdk.Pixbuf (file); } finally { File.Delete (file); } var sc = new Gtk.ScrolledWindow (); sc.ShadowType = Gtk.ShadowType.In; sc.HscrollbarPolicy = Gtk.PolicyType.Automatic; sc.VscrollbarPolicy = Gtk.PolicyType.Automatic; var image = new Gtk.Image (pixbuf); sc.AddWithViewport (image); sc.ShowAll (); return sc; }
static WelcomePageListButton () { starNormal = Gdk.Pixbuf.LoadFromResource ("star-normal.png"); starNormalHover = Gdk.Pixbuf.LoadFromResource ("star-normal-hover.png"); starPinned = Gdk.Pixbuf.LoadFromResource ("star-pinned.png"); starPinnedHover = Gdk.Pixbuf.LoadFromResource ("star-pinned-hover.png"); }
public WebViewer() : base(WindowType.Toplevel) { xml = new XML (null, "MainWindow.glade", "mainBox", null); xml.Autoconnect (this); Gdk.Pixbuf pix = new Gdk.Pixbuf (null, "webnotes-16.png"); //Window settings Title = "WebNotes"; WindowPosition = WindowPosition.Center; Icon = pix; Resize (650,600); //Trayicon stuff trayIcon = new TrayIcon ("WebNotes"); EventBox ebox = new EventBox (); ebox.ButtonPressEvent += ButtonPressed; Image image = new Image (pix); ebox.Add (image); trayIcon.Add (ebox); trayIcon.ShowAll (); //Gecko webcontrol wc = new WebControl (); wc.LoadUrl ("http://localhost:8000"); geckoBox.Add (wc); optionMenu.Changed += OptionChanged; BuildMenu (); int firstPage = list.IndexOf ("WikiHome"); if (firstPage != -1) optionMenu.SetHistory ((uint)firstPage); Add (mainBox); }
protected override void OnChanged() { name = null; icon = null; label = null; base.OnChanged (); }
public ColorPaletteWidget() { // Insert initialization code here. this.AddEvents ((int)Gdk.EventMask.ButtonPressMask); swap_icon = PintaCore.Resources.GetIcon ("ColorPalette.SwapIcon.png"); palette = new List<Color> (); palette.Add (new Color (255 / 255f, 255 / 255f, 255 / 255f)); palette.Add (new Color (128 / 255f, 128 / 255f, 128 / 255f)); palette.Add (new Color (127 / 255f, 0 / 255f, 0 / 255f)); palette.Add (new Color (127 / 255f, 51 / 255f, 0 / 255f)); palette.Add (new Color (127 / 255f, 106 / 255f, 0 / 255f)); palette.Add (new Color (91 / 255f, 127 / 255f, 0 / 255f)); palette.Add (new Color (38 / 255f, 127 / 255f, 0 / 255f)); palette.Add (new Color (0 / 255f, 127 / 255f, 14 / 255f)); palette.Add (new Color (0 / 255f, 127 / 255f, 70 / 255f)); palette.Add (new Color (0 / 255f, 127 / 255f, 127 / 255f)); palette.Add (new Color (0 / 255f, 74 / 255f, 127 / 255f)); palette.Add (new Color (0 / 255f, 19 / 255f, 127 / 255f)); palette.Add (new Color (33 / 255f, 0 / 255f, 127 / 255f)); palette.Add (new Color (87 / 255f, 0 / 255f, 127 / 255f)); palette.Add (new Color (127 / 255f, 0 / 255f, 110 / 255f)); palette.Add (new Color (127 / 255f, 0 / 255f, 55 / 255f)); palette.Add (new Color (0 / 255f, 0 / 255f, 0 / 255f)); palette.Add (new Color (64 / 255f, 64 / 255f, 64 / 255f)); palette.Add (new Color (255 / 255f, 0 / 255f, 0 / 255f)); palette.Add (new Color (255 / 255f, 106 / 255f, 0 / 255f)); palette.Add (new Color (255 / 255f, 216 / 255f, 0 / 255f)); palette.Add (new Color (182 / 255f, 255 / 255f, 0 / 255f)); palette.Add (new Color (76 / 255f, 255 / 255f, 0 / 255f)); palette.Add (new Color (0 / 255f, 255 / 255f, 33 / 255f)); palette.Add (new Color (0 / 255f, 255 / 255f, 144 / 255f)); palette.Add (new Color (0 / 255f, 255 / 255f, 255 / 255f)); palette.Add (new Color (0 / 255f, 148 / 255f, 255 / 255f)); palette.Add (new Color (0 / 255f, 38 / 255f, 255 / 255f)); palette.Add (new Color (72 / 255f, 0 / 255f, 255 / 255f)); palette.Add (new Color (178 / 255f, 0 / 255f, 255 / 255f)); palette.Add (new Color (255 / 255f, 0 / 255f, 220 / 255f)); palette.Add (new Color (255 / 255f, 0 / 255f, 110 / 255f)); palette.Add (new Color (160 / 255f, 160 / 255f, 160 / 255f)); palette.Add (new Color (48 / 255f, 48 / 255f, 48 / 255f)); palette.Add (new Color (255 / 255f, 127 / 255f, 127 / 255f)); palette.Add (new Color (255 / 255f, 178 / 255f, 127 / 255f)); palette.Add (new Color (255 / 255f, 233 / 255f, 127 / 255f)); palette.Add (new Color (218 / 255f, 255 / 255f, 127 / 255f)); palette.Add (new Color (165 / 255f, 255 / 255f, 127 / 255f)); palette.Add (new Color (127 / 255f, 255 / 255f, 142 / 255f)); palette.Add (new Color (127 / 255f, 255 / 255f, 197 / 255f)); palette.Add (new Color (127 / 255f, 255 / 255f, 255 / 255f)); palette.Add (new Color (127 / 255f, 201 / 255f, 255 / 255f)); palette.Add (new Color (127 / 255f, 146 / 255f, 255 / 255f)); palette.Add (new Color (161 / 255f, 127 / 255f, 255 / 255f)); palette.Add (new Color (214 / 255f, 127 / 255f, 255 / 255f)); palette.Add (new Color (255 / 255f, 127 / 255f, 237 / 255f)); palette.Add (new Color (255 / 255f, 127 / 255f, 182 / 255f)); }
protected override void OnDestroyed () { base.OnDestroyed (); if (bitmap != null) { bitmap.Dispose (); bitmap = null; } }
public void SetImage (Gdk.Pixbuf pbuf) { this.pbuf = pbuf; SetPreferedSize (pbuf.Width, pbuf.Height); if (surfaceCache != null) surfaceCache.Dispose (); surfaceCache = null; }
// this constructor is automatically called during deserialization public Image(SerializationInfo info, StreamingContext context) { try { image = Deserialize ((byte[]) info.GetValue ("pngbuf", typeof (byte[]))).Value; } catch { image = null; } }
// ============================================ // PUBLIC Constructors // ============================================ public UpdateNotifier() { // Initialize Stock Gdk.Pixbuf pixbuf; pixbuf = new Gdk.Pixbuf(null, "UpdateNotifier.png"); StockIcons.AddToStock("UpdateNotifier", pixbuf); StockIcons.AddToStockImages("UpdateNotifier", pixbuf); }
void DrawList() { int winWidth, winHeight; this.GdkWindow.GetSize(out winWidth, out winHeight); int ypos = margin; int lineWidth = winWidth - margin * 2; int xpos = margin + padding; int n = (int)(vadj.Value / rowHeight); while (ypos < winHeight - margin && n < win.DataProvider.IconCount) { string text = win.DataProvider.GetMarkup(n) ?? "<null>"; layout.SetMarkup(text); Gdk.Pixbuf icon = win.DataProvider.GetIcon(n); int iconHeight = icon != null ? icon.Height : 24; int iconWidth = icon != null ? icon.Width : 0; int wi, he, typos, iypos; layout.GetPixelSize(out wi, out he); if (wi > Allocation.Width) { int idx, trail; if (layout.XyToIndex( (int)((Allocation.Width - xpos - iconWidth - 2) * Pango.Scale.PangoScale), 0, out idx, out trail ) && idx > 3) { text = AmbienceService.UnescapeText(text); text = text.Substring(0, idx - 3) + "..."; text = AmbienceService.EscapeText(text); layout.SetMarkup(text); layout.GetPixelSize(out wi, out he); } } typos = he < rowHeight ? ypos + (rowHeight - he) / 2 : ypos; iypos = iconHeight < rowHeight ? ypos + (rowHeight - iconHeight) / 2 : ypos; if (n == selection) { if (!disableSelection) { this.GdkWindow.DrawRectangle(this.Style.BaseGC(StateType.Selected), true, margin, ypos, lineWidth, he + padding); this.GdkWindow.DrawLayout(this.Style.TextGC(StateType.Selected), xpos + iconWidth + 2, typos, layout); } else { this.GdkWindow.DrawRectangle(this.Style.BaseGC(StateType.Selected), false, margin, ypos, lineWidth, he + padding); this.GdkWindow.DrawLayout(this.Style.TextGC(StateType.Normal), xpos + iconWidth + 2, typos, layout); } } else { this.GdkWindow.DrawLayout(this.Style.TextGC(StateType.Normal), xpos + iconWidth + 2, typos, layout); } if (icon != null) { this.GdkWindow.DrawPixbuf(this.Style.ForegroundGC(StateType.Normal), icon, 0, 0, xpos, iypos, iconWidth, iconHeight, Gdk.RgbDither.None, 0, 0); } ypos += rowHeight; n++; //reset the markup or it carries over to the next SetText layout.SetMarkup(string.Empty); } }
public Widget CreateLabel(Orientation orientation) { Gtk.Box box; if (orientation == Orientation.Horizontal) { box = new HBox(); } else { box = new VBox(); } box.Spacing = 3; Gdk.Pixbuf errorIcon = ImageService.GetPixbuf(MonoDevelop.Ide.Gui.Stock.Error, IconSize.Menu); Gdk.Pixbuf noErrorIcon = ImageService.MakeGrayscale(errorIcon); // creates a new pixbuf instance Gdk.Pixbuf warningIcon = ImageService.GetPixbuf(MonoDevelop.Ide.Gui.Stock.Warning, IconSize.Menu); Gdk.Pixbuf noWarningIcon = ImageService.MakeGrayscale(warningIcon); // creates a new pixbuf instance Gtk.Image errorImage = new Gtk.Image(errorIcon); Gtk.Image warningImage = new Gtk.Image(warningIcon); box.PackStart(errorImage, false, false, 0); Label errors = new Gtk.Label(); box.PackStart(errors, false, false, 0); box.PackStart(warningImage, false, false, 0); Label warnings = new Gtk.Label(); box.PackStart(warnings, false, false, 0); TaskEventHandler updateHandler = delegate { int ec = 0, wc = 0; foreach (Task t in TaskService.Errors) { if (t.Severity == TaskSeverity.Error) { ec++; } else if (t.Severity == TaskSeverity.Warning) { wc++; } } errors.Text = ec.ToString(); errorImage.Pixbuf = ec > 0 ? errorIcon : noErrorIcon; warnings.Text = wc.ToString(); warningImage.Pixbuf = wc > 0 ? warningIcon : noWarningIcon; }; updateHandler(null, null); TaskService.Errors.TasksAdded += updateHandler; TaskService.Errors.TasksRemoved += updateHandler; box.Destroyed += delegate { noErrorIcon.Dispose(); noWarningIcon.Dispose(); TaskService.Errors.TasksAdded -= updateHandler; TaskService.Errors.TasksRemoved -= updateHandler; }; return(box); }
public static void Icon(Gtk.StyleContext context, Cairo.Context cr, Gdk.Pixbuf pixbuf, double x, double y) { gtk_render_icon(context == null ? IntPtr.Zero : context.Handle, cr == null ? IntPtr.Zero : cr.Handle, pixbuf == null ? IntPtr.Zero : pixbuf.Handle, x, y); }
void DrawImage(Gdk.Pixbuf image, double X, double Y, bool highlight) { int x = (int)X - image.Width / 2; int y = (int)Y - image.Height / 2; #if !SYSTEM_DRAWING if (drawer is CairoDrawer) { Cairo.Context context = ((CairoDrawer)drawer).Context; if (highlight) { List <Drawer.Point> points = new List <Drawer.Point>(); points.Add(new Drawer.Point(x - 2.5, y - 2.5)); points.Add(new Drawer.Point(x + image.Width + 1.5, y - 2.5)); points.Add(new Drawer.Point(x + image.Width + 1.5, y + image.Height + 1.5)); points.Add(new Drawer.Point(x - 2.5, y + image.Height + 1.5)); drawer.FillPolygon(new Drawer.Color(1, 1, 0), points); } Gdk.CairoHelper.SetSourcePixbuf(context, image, x, y); context.Paint(); } else { #else { #endif if (highlight) { Gdk.GC gc = new Gdk.GC(GdkWindow); Gdk.Pixmap mask = new Gdk.Pixmap(null, image.Width, image.Height, 1); image.RenderThresholdAlpha(mask, 0, 0, 0, 0, -1, -1, 1); gc.ClipMask = mask; for (int i = -2; i <= 2; ++i) { for (int j = -2; j <= 2; ++j) { gc.SetClipOrigin(x + i, y + j); gc.RgbFgColor = new Gdk.Color(255, 255, 0); GdkWindow.DrawRectangle(gc, true, x + i, y + j, image.Width, image.Height); } } } GdkWindow.DrawPixbuf(new Gdk.GC(GdkWindow), image, 0, 0, x, y, -1, -1, Gdk.RgbDither.Normal, 0, 0); } } void DrawObject(MapObject obj, bool highlight) { if (obj.Type == ObjectType.Player) { if (ShowPlayers) { DrawTriangle(playerColor, Transform.ToScreenX(obj.X), Transform.ToScreenY(obj.Y), obj.Facing, highlight, false); } } else if (obj.Type == ObjectType.Monster) { if (ShowMonsters) { Drawer.Color color; if ((obj.Index >= 12 && obj.Index <= 15) || (obj.Index >= 43 && obj.Index <= 46)) { color = civilianColor; } else { color = monsterColor; } DrawTriangle(color, Transform.ToScreenX(obj.X), Transform.ToScreenY(obj.Y), obj.Facing, highlight, obj.Invisible); } } else if (obj.Type == ObjectType.Scenery) { if (ShowScenery) { DrawImage(sceneryImage, Transform.ToScreenX(obj.X), Transform.ToScreenY(obj.Y), highlight); } } else if (obj.Type == ObjectType.Sound) { if (ShowSounds) { DrawImage(soundImage, Transform.ToScreenX(obj.X), Transform.ToScreenY(obj.Y), highlight); } } else if (obj.Type == ObjectType.Goal) { if (ShowGoals) { DrawImage(goalImage, Transform.ToScreenX(obj.X), Transform.ToScreenY(obj.Y), highlight); } } else if (obj.Type == ObjectType.Item) { if (ShowObjects) { if (itemImages.ContainsKey((ItemType)obj.Index) && itemImages[(ItemType)obj.Index] != null) { DrawImage(itemImages[(ItemType)obj.Index], Transform.ToScreenX(obj.X), Transform.ToScreenY(obj.Y), highlight); } else { drawer.DrawPoint(objectColor, new Drawer.Point(Transform.ToScreenX(obj.X), Transform.ToScreenY(obj.Y))); } } } } void DrawAnnotation(Annotation note, bool selected) { int X = (int)Transform.ToScreenX(note.X); int Y = (int)Transform.ToScreenY(note.Y); Layout layout = new Pango.Layout(this.PangoContext); layout.SetMarkup(note.Text); int width, height; layout.GetPixelSize(out width, out height); this.GdkWindow.DrawLayout(this.Style.TextGC(Gtk.StateType.Normal), X, Y - height, layout); if (selected) { DrawFatPoint(selectedLineColor, new Point(note.X, note.Y)); } else { DrawFatPoint(annotationColor, new Point(note.X, note.Y)); } } Drawer.Color LoadColor(string xPath, Drawer.Color defaultColor) { Drawer.Color c; c.R = Weland.Settings.GetSetting(xPath + "/Red", defaultColor.R); c.G = Weland.Settings.GetSetting(xPath + "/Green", defaultColor.G); c.B = Weland.Settings.GetSetting(xPath + "/Blue", defaultColor.B); return(c); } void SaveColor(string xPath, Drawer.Color c) { Weland.Settings.PutSetting(xPath + "/Red", c.R); Weland.Settings.PutSetting(xPath + "/Green", c.G); Weland.Settings.PutSetting(xPath + "/Blue", c.B); }
public void Create(Stream stream) { Pixbuf = new Gdk.Pixbuf(stream); Control = new Gtk.IconSet(Pixbuf); }
public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { IType type = (IType)dataObject; label = Ambience.GetString(type, OutputFlags.ClassBrowserEntries | OutputFlags.IncludeMarkup); if (type.IsPrivate || type.IsInternal) { label = DomMethodNodeBuilder.FormatPrivate(label); } icon = ImageService.GetPixbuf(type.StockIcon, Gtk.IconSize.Menu); }
public GeneralWidget(Project project, Gtk.Window parent) { parentWindow = parent; this.Build(); feOutput = new FileMaskEntry(MainClass.Settings.WorkspaceMaskDirectory, this.project, parentWindow); feOutput.IsFolder = true; Pango.FontDescription fd = PangoContext.FontDescription.Copy(); fd.Weight = Pango.Weight.Bold; //Pango.FontDescription customFont = Pango.FontDescription.FromString("Courier 16");//Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont); //customFont.Weight = Pango.Weight.Bold; //checkbutton1.ModifyFont(customFont ); this.project = project; if (MainClass.Workspace != null) { worksName.LabelProp = MainClass.Workspace.Name; worksDir.LabelProp = MainClass.Workspace.RootDirectory; prjName.LabelProp = this.project.ProjectName; prjDir.LabelProp = this.project.RelativeAppFilePath; prjFullPath.LabelProp = this.project.AbsolutProjectDir; } if (!this.project.NewSkin) { foreach (Devices.Device d in this.project.DevicesSettings) { d.Includes.Skin.Name = ""; d.Includes.Skin.Theme = ""; } this.project.NewSkin = true; } //checkbutton1.Active =this.project.NewSkin; //checkbutton1.Visible =false; //checkbutton1.HideAll();//ShowAll() Gdk.Pixbuf default_pixbuf = null; string file = System.IO.Path.Combine(MainClass.Paths.ResDir, "stock-menu.png"); popupCondition = new Gtk.Menu(); if (System.IO.File.Exists(file)) { default_pixbuf = new Gdk.Pixbuf(file); btnPopUp = new Gtk.Button(new Gtk.Image(default_pixbuf)); btnPopUp.TooltipText = MainClass.Languages.Translate("insert_condition_name"); btnPopUp.Relief = Gtk.ReliefStyle.None; btnPopUp.CanFocus = false; btnPopUp.WidthRequest = btnPopUp.HeightRequest = 22; btnPopUp.Clicked += delegate { popupCondition.Popup(null, null, new Gtk.MenuPositionFunc(GetPosition), 3, Gtk.Global.CurrentEventTime); //popupCondition.Popup(); }; hbox1.PackEnd(btnPopUp, false, false, 0); //table1.Attach(btnPopUp,2, 3, 3, 4, AttachOptions.Shrink, AttachOptions.Shrink,0,0); } ReloadPanel(); /*AddMenuItem(MainClass.Settings.Platform.Name); * AddMenuItem(MainClass.Settings.Resolution.Name); * * if (project.ConditoinsDefine != null){ * foreach (Condition cd in project.ConditoinsDefine) { * * AddMenuItem(cd.Name); * } * } * * popupCondition.ShowAll();*/ table1.Attach(feOutput, 1, 3, 4, 5, AttachOptions.Fill, AttachOptions.Fill, 0, 0); if (String.IsNullOrEmpty(project.ProjectOutput)) { if (!String.IsNullOrEmpty(MainClass.Workspace.OutputDirectory)) { string fullOutput = MainClass.Workspace.OutputMaskToFullPath; if (!System.IO.Directory.Exists(fullOutput)) { try { System.IO.Directory.CreateDirectory(fullOutput); }catch { } } feOutput.DefaultPath = fullOutput; feOutput.VisiblePath = MainClass.Workspace.OutputDirectory; } else { feOutput.DefaultPath = project.AbsolutProjectDir; } } else { string fullProjectOutput = project.OutputMaskToFullPath; feOutput.DefaultPath = fullProjectOutput; feOutput.VisiblePath = project.ProjectOutput; } if (String.IsNullOrEmpty(project.ProjectArtefac)) { string name = System.IO.Path.GetFileNameWithoutExtension(project.RelativeAppFilePath); projectArtefact = String.Format("{0}_$({1})_$({2})", name, MainClass.Settings.Platform.Name, MainClass.Settings.Resolution.Name); project.ProjectArtefac = projectArtefact; } else { projectArtefact = project.ProjectArtefac; } entrName.Text = projectArtefact; entrFacebookApi.Text = project.FacebookAppID; entrFacebookApi.KeyPressEvent += delegate(object o, KeyPressEventArgs args) { if (!MainClass.LicencesSystem.CheckFunction("facebook", parentWindow)) { entrFacebookApi.Text = project.FacebookAppID; return; } }; entrName.Changed += delegate(object sender, EventArgs e) { if (checkChange) { CheckMessage(); } }; }
private void SetupDialog() { this.Title = Util.GS("Change password"); this.Icon = new Gdk.Pixbuf(Util.ImagesPath("ifolder16.png")); this.HasSeparator = false; // this.BorderWidth = 10; this.SetDefaultSize(450, 100); // this.Resizable = false; this.Modal = true; this.DefaultResponse = ResponseType.Ok; //----------------------------- // Add iFolderGraphic //----------------------------- HBox imagebox = new HBox(); imagebox.Spacing = 0; iFolderBanner = new Image( new Gdk.Pixbuf(Util.ImagesPath("ifolder-banner.png"))); imagebox.PackStart(iFolderBanner, false, false, 0); ScaledPixbuf = new Gdk.Pixbuf(Util.ImagesPath("ifolder-banner-scaler.png")); iFolderScaledBanner = new Image(ScaledPixbuf); iFolderScaledBanner.ExposeEvent += new ExposeEventHandler(OnBannerExposed); imagebox.PackStart(iFolderScaledBanner, true, true, 0); this.VBox.PackStart(imagebox, false, true, 0); Table table = new Table(6, 2, false); this.VBox.PackStart(table, false, false, 0); table.ColumnSpacing = 6; table.RowSpacing = 6; table.BorderWidth = 12; // Row 1 Label lbl = new Label(Util.GS("_iFolder Account") + ":"); table.Attach(lbl, 0, 1, 0, 1, AttachOptions.Fill | AttachOptions.Expand, 0, 0, 0); lbl.LineWrap = true; lbl.Xalign = 0.0F; domainComboBox = ComboBox.NewText(); table.Attach(domainComboBox, 1, 2, 0, 1, AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0); // Row 2 lbl = new Label(Util.GS("_Current password") + ":"); table.Attach(lbl, 0, 1, 1, 2, AttachOptions.Fill | AttachOptions.Expand, 0, 0, 0); lbl.LineWrap = true; lbl.Xalign = 0.0F; oldPassword = new Entry(); oldPassword.Visibility = false; table.Attach(oldPassword, 1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, 0, 0, 0); lbl.MnemonicWidget = oldPassword; oldPassword.Changed += new EventHandler(UpdateSensitivity); // Row 3 lbl = new Label(Util.GS("_New password") + ":"); table.Attach(lbl, 0, 1, 2, 3, AttachOptions.Fill | AttachOptions.Expand, 0, 0, 0); lbl.LineWrap = true; lbl.Xalign = 0.0F; newPassword = new Entry(); newPassword.Visibility = false; table.Attach(newPassword, 1, 2, 2, 3, AttachOptions.Fill | AttachOptions.Expand, 0, 0, 0); lbl.MnemonicWidget = newPassword; newPassword.Changed += new EventHandler(UpdateSensitivity); // Row 4 lbl = new Label(Util.GS("Confirm new _password") + ":"); table.Attach(lbl, 0, 1, 3, 4, AttachOptions.Fill | AttachOptions.Expand, 0, 0, 0); lbl.LineWrap = true; lbl.Xalign = 0.0F; confirmPassword = new Entry(); confirmPassword.Visibility = false; table.Attach(confirmPassword, 1, 2, 3, 4, AttachOptions.Fill | AttachOptions.Expand, 0, 0, 0); lbl.MnemonicWidget = confirmPassword; confirmPassword.Changed += new EventHandler(UpdateSensitivity); // Row 5 // Row 6 savePassword = new CheckButton(Util.GS("_Remember password")); table.Attach(savePassword, 1, 2, 5, 6, AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0); this.VBox.ShowAll(); Button helpbutton = (Button)this.AddButton(Stock.Help, ResponseType.Help); helpbutton.Sensitive = true; helpbutton.Clicked += new EventHandler(OnHelpButtonClicked); this.AddButton(Stock.Cancel, ResponseType.Cancel); Button but = (Button)this.AddButton(Util.GS("Reset"), ResponseType.Ok); but.Clicked += new EventHandler(OnResetClicked); but.Image = new Image(Stock.Undo, Gtk.IconSize.Menu); //new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder-download16.png"))); this.SetResponseSensitive(ResponseType.Ok, false); this.DefaultResponse = ResponseType.Ok; this.Realized += new EventHandler(OnResetPasswordLoad); domainComboBox.Changed += new EventHandler(OnDomainChangedEvent); }
void CreateControl() { control = new HPaned(); store = new Gtk.ListStore(typeof(Gdk.Pixbuf), // image - type typeof(bool), // read? typeof(Task)); // read? -- use Pango weight TreeModelFilterVisibleFunc filterFunct = new TreeModelFilterVisibleFunc(FilterTaskTypes); filter = new TreeModelFilter(store, null); filter.VisibleFunc = filterFunct; sort = new TreeModelSort(filter); sort.SetSortFunc(VisibleColumns.Type, SeverityIterSort); sort.SetSortFunc(VisibleColumns.Project, ProjectIterSort); sort.SetSortFunc(VisibleColumns.File, FileIterSort); view = new MonoDevelop.Ide.Gui.Components.PadTreeView(sort); view.RulesHint = true; view.DoPopupMenu = (evnt) => IdeApp.CommandService.ShowContextMenu(view, evnt, CreateMenu()); AddColumns(); LoadColumnsVisibility(); view.Columns[VisibleColumns.Type].SortColumnId = VisibleColumns.Type; view.Columns[VisibleColumns.Project].SortColumnId = VisibleColumns.Project; view.Columns[VisibleColumns.File].SortColumnId = VisibleColumns.File; sw = new MonoDevelop.Components.CompactScrolledWindow(); sw.ShadowType = ShadowType.None; sw.Add(view); TaskService.Errors.TasksRemoved += DispatchService.GuiDispatch <TaskEventHandler> (ShowResults); TaskService.Errors.TasksAdded += DispatchService.GuiDispatch <TaskEventHandler> (TaskAdded); TaskService.Errors.TasksChanged += DispatchService.GuiDispatch <TaskEventHandler> (TaskChanged); TaskService.Errors.CurrentLocationTaskChanged += HandleTaskServiceErrorsCurrentLocationTaskChanged; IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpen; IdeApp.Workspace.LastWorkspaceItemClosed += OnCombineClosed; view.RowActivated += new RowActivatedHandler(OnRowActivated); iconWarning = sw.RenderIcon(Stock.Warning, Gtk.IconSize.Menu, ""); iconError = sw.RenderIcon(Stock.Error, Gtk.IconSize.Menu, ""); iconInfo = sw.RenderIcon(Gtk.Stock.DialogInfo, Gtk.IconSize.Menu, ""); control.Add1(sw); outputView = new LogView(); control.Add2(outputView); Control.ShowAll(); control.SizeAllocated += HandleControlSizeAllocated; bool outputVisible = PropertyService.Get <bool> (outputViewVisiblePropertyName, false); if (outputVisible) { outputView.Visible = true; logBtn.Active = true; } else { outputView.Hide(); } sw.SizeAllocated += HandleSwSizeAllocated; // Load existing tasks foreach (Task t in TaskService.Errors) { AddTask(t); } control.FocusChain = new Gtk.Widget [] { sw }; }
public override void Work() { ICommResult r = _in[0] as ICommResult; itest = new Gdk.Pixbuf[r.Length]; ibase = new Gdk.Pixbuf[r.OriginalBaseImages.Length]; double scale; for (int i = 0; i < itest.Length; i++) { IImage img = r.OriginalTestImages[i]; if (img.W > img.H) { scale = img.W / 32.0; } else { scale = img.H / 32.0; } Gdk.Pixbuf tmp = img.CreatePixbuf(); itest[i] = tmp.ScaleSimple(Scale(img.W, scale), Scale(img.H, scale), Gdk.InterpType.Bilinear); } for (int i = 0; i < ibase.Length; i++) { IImage img = r.OriginalBaseImages[i]; if (img.W > img.H) { scale = img.W / 32.0; } else { scale = img.H / 32.0; } Gdk.Pixbuf tmp = img.CreatePixbuf(); ibase[i] = tmp.ScaleSimple(Scale(img.W, scale), Scale(img.H, scale), Gdk.InterpType.Bilinear); } res = new IResult[r.Length]; for (int i = 0; i < r.Length; i++) { res[i] = r[i]; } match = r.FindResultsSimple(); for (int i = 0; i < r.Length; i++) { if (!r.Match[i]) { match[i] = -1; } } _workdone = true; }
private MainWindow(Builder builder) : base(builder.GetObject("_mainWin").Handle) { builder.Autoconnect(this); // Apply custom theme if needed. ThemeHelper.ApplyTheme(); // Sets overridden fields. int monitorWidth = Display.PrimaryMonitor.Geometry.Width * Display.PrimaryMonitor.ScaleFactor; int monitorHeight = Display.PrimaryMonitor.Geometry.Height * Display.PrimaryMonitor.ScaleFactor; DefaultWidth = monitorWidth < 1280 ? monitorWidth : 1280; DefaultHeight = monitorHeight < 760 ? monitorHeight : 760; Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.Resources.Logo_Ryujinx.png"); Title = $"Ryujinx {Program.Version}"; // Hide emulation context status bar. _statusBar.Hide(); // Instanciate HLE objects. _virtualFileSystem = VirtualFileSystem.CreateInstance(); _contentManager = new ContentManager(_virtualFileSystem); _userChannelPersistence = new UserChannelPersistence(); // Instanciate GUI objects. _applicationLibrary = new ApplicationLibrary(_virtualFileSystem); _uiHandler = new GtkHostUiHandler(this); _deviceExitStatus = new AutoResetEvent(false); WindowStateEvent += WindowStateEvent_Changed; DeleteEvent += Window_Close; _applicationLibrary.ApplicationAdded += Application_Added; _applicationLibrary.ApplicationCountUpdated += ApplicationCount_Updated; _gameTable.ButtonReleaseEvent += Row_Clicked; _fullScreen.Activated += FullScreen_Toggled; GlRenderer.StatusUpdatedEvent += Update_StatusBar; if (ConfigurationState.Instance.Ui.StartFullscreen) { _startFullScreen.Active = true; } _stopEmulation.Sensitive = false; _simulateWakeUpMessage.Sensitive = false; if (ConfigurationState.Instance.Ui.GuiColumns.FavColumn) { _favToggle.Active = true; } if (ConfigurationState.Instance.Ui.GuiColumns.IconColumn) { _iconToggle.Active = true; } if (ConfigurationState.Instance.Ui.GuiColumns.AppColumn) { _appToggle.Active = true; } if (ConfigurationState.Instance.Ui.GuiColumns.DevColumn) { _developerToggle.Active = true; } if (ConfigurationState.Instance.Ui.GuiColumns.VersionColumn) { _versionToggle.Active = true; } if (ConfigurationState.Instance.Ui.GuiColumns.TimePlayedColumn) { _timePlayedToggle.Active = true; } if (ConfigurationState.Instance.Ui.GuiColumns.LastPlayedColumn) { _lastPlayedToggle.Active = true; } if (ConfigurationState.Instance.Ui.GuiColumns.FileExtColumn) { _fileExtToggle.Active = true; } if (ConfigurationState.Instance.Ui.GuiColumns.FileSizeColumn) { _fileSizeToggle.Active = true; } if (ConfigurationState.Instance.Ui.GuiColumns.PathColumn) { _pathToggle.Active = true; } _favToggle.Toggled += Fav_Toggled; _iconToggle.Toggled += Icon_Toggled; _appToggle.Toggled += App_Toggled; _developerToggle.Toggled += Developer_Toggled; _versionToggle.Toggled += Version_Toggled; _timePlayedToggle.Toggled += TimePlayed_Toggled; _lastPlayedToggle.Toggled += LastPlayed_Toggled; _fileExtToggle.Toggled += FileExt_Toggled; _fileSizeToggle.Toggled += FileSize_Toggled; _pathToggle.Toggled += Path_Toggled; _gameTable.Model = _tableStore = new ListStore( typeof(bool), typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(BlitStruct <ApplicationControlProperty>)); _tableStore.SetSortFunc(5, SortHelper.TimePlayedSort); _tableStore.SetSortFunc(6, SortHelper.LastPlayedSort); _tableStore.SetSortFunc(8, SortHelper.FileSizeSort); int columnId = ConfigurationState.Instance.Ui.ColumnSort.SortColumnId; bool ascending = ConfigurationState.Instance.Ui.ColumnSort.SortAscending; _tableStore.SetSortColumnId(columnId, ascending ? SortType.Ascending : SortType.Descending); _gameTable.EnableSearch = true; _gameTable.SearchColumn = 2; UpdateColumns(); UpdateGameTable(); ConfigurationState.Instance.Ui.GameDirs.Event += (sender, args) => { if (args.OldValue != args.NewValue) { UpdateGameTable(); } }; Task.Run(RefreshFirmwareLabel); }
public void Load(Uri uri) { this.uri = uri; delay.Stop(); if (!done_reading) { Close(); } done_reading = false; area_prepared = false; damage = Gdk.Rectangle.Zero; using (ImageFile img = ImageFile.Create(uri)) { orientation = Accelerometer.GetViewOrientation(img.Orientation); try { PixbufOrientation thumb_orientation = Accelerometer.GetViewOrientation(PixbufOrientation.TopLeft); thumb = new Gdk.Pixbuf(ThumbnailGenerator.ThumbnailPath(uri)); thumb = PixbufUtils.TransformOrientation(thumb, thumb_orientation); } catch (System.Exception e) { //FSpot.ThumbnailGenerator.Default.Request (uri.ToString (), 0, 256, 256); if (!(e is GLib.GException)) { System.Console.WriteLine(e.ToString()); } } System.IO.Stream nstream = img.PixbufStream(); if (nstream == null) { FileLoad(img); return; } else { stream = new StreamWrapper(nstream); } loader = new Gdk.PixbufLoader(); loader.AreaPrepared += ap; loader.AreaUpdated += au; loader.Closed += ev; if (AreaPrepared != null && thumb != null) { pixbuf = thumb; AreaPrepared(this, new AreaPreparedArgs(true)); } ThumbnailGenerator.Default.PushBlock(); //AsyncIORead (null); if (nstream is IOChannel) { ((IOChannel)nstream).DataReady += IOChannelRead; } else { delay.Start(); } } }
public void Create(string fileName) { Pixbuf = new Gdk.Pixbuf(fileName); Control = new Gtk.IconSet(Pixbuf); }
public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { Mono.Cecil.Resource resource = (Mono.Cecil.Resource)dataObject; label = resource.Name; icon = Context.GetIcon(Stock.ResourceFileIcon); }
private MenuItem ConstructSubmenu(string menuLabel, IEnumerable <WebsiteLink> links, Gdk.Pixbuf linkIcon) { ImageMenuItem onlineResources = new ImageMenuItem(menuLabel); onlineResources.Image = new Image(linkIcon); onlineResources.ExposeEvent += GtkMenuHelper.DrawImageMenuItemImage; Menu onlineResourcesSubmenu = new Menu(); onlineResources.Submenu = onlineResourcesSubmenu; foreach (WebsiteLink websiteLink in links) { WebsiteLinkMenuItem linkItem = new WebsiteLinkMenuItem(websiteLink); linkItem.Image = new Image(linkIcon); linkItem.ExposeEvent += GtkMenuHelper.DrawImageMenuItemImage; linkItem.Activated += OpenLinkActivated; onlineResourcesSubmenu.Append(linkItem); } return(onlineResources); }
void PopulateListView() { store.Clear(); Solution openSolution = configureProject.ParentSolution; if (openSolution == null) { return; } Dictionary <DotNetProject, bool> references = new Dictionary <DotNetProject, bool> (); foreach (Project projectEntry in openSolution.GetAllSolutionItems <Project>()) { if (projectEntry == configureProject) { continue; } string txt; int matchRank = 0; if (stringMatcher != null) { if (!stringMatcher.CalcMatchRank(projectEntry.Name, out matchRank)) { continue; } int[] match = stringMatcher.GetMatch(projectEntry.Name); txt = PackageReferencePanel.GetMatchMarkup(treeView, projectEntry.Name, match, 0); } else { txt = GLib.Markup.EscapeText(projectEntry.Name); } bool selected = selection.Contains(projectEntry.Name); bool allowSelecting = true; DotNetProject netProject = projectEntry as DotNetProject; if (netProject != null) { if (ProjectReferencesProject(references, null, netProject, configureProject.Name)) { txt += " " + GLib.Markup.EscapeText(GettextCatalog.GetString("(Cyclic dependencies not allowed)")); allowSelecting = false; } else if (!configureProject.TargetFramework.IsCompatibleWithFramework(netProject.TargetFramework.Id)) { txt += " " + GLib.Markup.EscapeText(GettextCatalog.GetString("(Incompatible target framework: v{0})", netProject.TargetFramework.Id)); allowSelecting = false; } } Gdk.Pixbuf icon = ImageService.GetPixbuf(projectEntry.StockIcon, IconSize.Menu); if (!allowSelecting) { // Don't show unselectable projects if there is a filter if (stringMatcher != null) { continue; } icon = ImageService.MakeTransparent(icon, 0.5); } Gtk.TreeIter it = store.AppendValues(txt, projectEntry.BaseDirectory.ToString(), projectEntry, selected, icon, allowSelecting); if (!allowSelecting) { store.SetValue(it, ColColor, "dimgrey"); } } }
public NewSearchItem() { icon = Gui.LoadIcon(24, "system-search"); }
public override void DrawEditor(IBitmapView view) { if (view.Image == null || view.Image.Width == 0 || view.Image.Height == 0) { return; } Gdk.Drawable target = ((FloatPixmapViewWidget)view).GdkWindow; Gdk.Rectangle image_position = ((FloatPixmapViewWidget)view).CurrentImagePosition; CrotateStageOperationParameters pm = ((CrotateStageOperationParameters)Parameters); Gdk.GC gc = new Gdk.GC(target); // Draw center square dot Point C = new Point(pm.Center.X, pm.Center.Y); int scr_c_x = image_position.X + (int)(image_position.Width * C.X); int scr_c_y = image_position.Y + (int)(image_position.Height * C.Y); // Calculating new picture's real dimensions int trueWidth = image_position.Width, trueHeight = image_position.Height; double w1, h1; w1 = pm.CropWidth * image_position.Width; h1 = pm.CropHeight * image_position.Height; double asp_rat; if (pm.AspectRatioCustom) { asp_rat = pm.AspectRatio; } else { asp_rat = pm.PresetAspectRatioValues[pm.AspectRatioPreset]; } switch (pm.Mode) { case CatEye.Core.CrotateStageOperation.Mode.Disproportional: trueWidth = (int)w1; trueHeight = (int)h1; break; case CatEye.Core.CrotateStageOperation.Mode.ProportionalWidthFixed: trueWidth = (int)w1; trueHeight = (int)(w1 / asp_rat); break; case CatEye.Core.CrotateStageOperation.Mode.ProportionalHeightFixed: trueWidth = (int)(h1 * asp_rat); trueHeight = (int)h1; break; } // Calculating new corners positions and "round" dot position double ang = pm.Angle / 180 * Math.PI; CatEye.Core.Point lt_corner = new CatEye.Core.Point( -trueWidth / 2, -trueHeight / 2); lt_corner_rot = CatEye.Core.Point.Rotate(lt_corner, ang, new Point(0, 0)); Gdk.Point scr_lt = new Gdk.Point( (int)(scr_c_x + lt_corner_rot.X), (int)(scr_c_y + lt_corner_rot.Y)); CatEye.Core.Point rt_corner = new CatEye.Core.Point( +trueWidth / 2, -trueHeight / 2); rt_corner_rot = CatEye.Core.Point.Rotate(rt_corner, ang, new Point(0, 0)); Gdk.Point scr_rt = new Gdk.Point( (int)(scr_c_x + rt_corner_rot.X), (int)(scr_c_y + rt_corner_rot.Y)); CatEye.Core.Point rb_corner = new CatEye.Core.Point( +trueWidth / 2, +trueHeight / 2); rb_corner_rot = CatEye.Core.Point.Rotate(rb_corner, ang, new Point(0, 0)); Gdk.Point scr_rb = new Gdk.Point( (int)(scr_c_x + rb_corner_rot.X), (int)(scr_c_y + rb_corner_rot.Y)); CatEye.Core.Point lb_corner = new CatEye.Core.Point( -trueWidth / 2, +trueHeight / 2); lb_corner_rot = CatEye.Core.Point.Rotate(lb_corner, ang, new Point(0, 0)); Gdk.Point scr_lb = new Gdk.Point( (int)(scr_c_x + lb_corner_rot.X), (int)(scr_c_y + lb_corner_rot.Y)); Gdk.Point scr_rnd = new Gdk.Point( (int)(scr_c_x + (rt_corner_rot.X + rb_corner_rot.X) / 2), (int)(scr_c_y + (rt_corner_rot.Y + rb_corner_rot.Y) / 2)); // Drawing frame using (Cairo.Context cc = Gdk.CairoHelper.Create(target)) { cc.LineCap = Cairo.LineCap.Round; cc.LineJoin = Cairo.LineJoin.Round; cc.Color = new Cairo.Color(0, 0, 0, 0.5); cc.LineWidth = 3; cc.MoveTo(scr_lt.X, scr_lt.Y); cc.LineTo(scr_lb.X, scr_lb.Y); cc.LineTo(scr_rb.X, scr_rb.Y); cc.LineTo(scr_rt.X, scr_rt.Y); cc.LineTo(scr_lt.X, scr_lt.Y); cc.ClosePath(); cc.Stroke(); cc.Color = new Cairo.Color(1, 1, 1, 1); cc.LineWidth = 1; cc.SetDash(new double[] { 3, 3 }, 0); cc.MoveTo(scr_lt.X, scr_lt.Y); cc.LineTo(scr_lb.X, scr_lb.Y); cc.LineTo(scr_rb.X, scr_rb.Y); cc.LineTo(scr_rt.X, scr_rt.Y); cc.LineTo(scr_lt.X, scr_lt.Y); cc.ClosePath(); cc.Stroke(); } // Drawing center "triangle" dot. using (Gdk.Pixbuf buf = Gdk.Pixbuf.LoadFromResource("CatEye.UI.Gtk.Widgets.res.triangle_dot.png")) { target.DrawPixbuf(gc, buf, 0, 0, (int)(scr_c_x - buf.Width / 2), (int)(scr_c_y - buf.Height / 2), buf.Width, buf.Height, Gdk.RgbDither.None, 0, 0); } // Drawing side "round" dot. using (Gdk.Pixbuf buf = Gdk.Pixbuf.LoadFromResource("CatEye.UI.Gtk.Widgets.res.round_dot.png")) { target.DrawPixbuf(gc, buf, 0, 0, (int)(scr_rnd.X - buf.Width / 2), (int)(scr_rnd.Y - buf.Height / 2), buf.Width, buf.Height, Gdk.RgbDither.None, 0, 0); } // Drawing corner "square" dot. using (Gdk.Pixbuf buf = Gdk.Pixbuf.LoadFromResource("CatEye.UI.Gtk.Widgets.res.square_dot.png")) { target.DrawPixbuf(gc, buf, 0, 0, (int)(scr_rb.X - buf.Width / 2), (int)(scr_rb.Y - buf.Height / 2), buf.Width, buf.Height, Gdk.RgbDither.None, 0, 0); } }
public static Gdk.Pixbuf GetMiniIcon(string resource_name) { Gdk.Pixbuf noicon = new Gdk.Pixbuf(null, resource_name); return(noicon.ScaleSimple(24, 24, Gdk.InterpType.Nearest)); }
public ObjectValueTreeView() { store = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(ObjectValue), typeof(bool), typeof(bool), typeof(bool), typeof(string), typeof(string), typeof(string), typeof(bool), typeof(string), typeof(Gdk.Pixbuf), typeof(bool)); Model = store; RulesHint = true; Selection.Mode = SelectionMode.Multiple; ResetColumnSizes(); Pango.FontDescription newFont = this.Style.FontDescription.Copy(); newFont.Size = (newFont.Size * 8) / 10; liveIcon = ImageService.GetPixbuf(Gtk.Stock.Execute, IconSize.Menu); noLiveIcon = ImageService.MakeTransparent(liveIcon, 0.5); expCol = new TreeViewColumn(); expCol.Title = GettextCatalog.GetString("Name"); CellRendererIcon crp = new CellRendererIcon(); expCol.PackStart(crp, false); expCol.AddAttribute(crp, "stock_id", IconCol); crtExp = new CellRendererText(); expCol.PackStart(crtExp, true); expCol.AddAttribute(crtExp, "text", NameCol); expCol.AddAttribute(crtExp, "editable", NameEditableCol); expCol.AddAttribute(crtExp, "foreground", NameColorCol); expCol.Resizable = true; expCol.Sizing = TreeViewColumnSizing.Fixed; expCol.MinWidth = 15; expCol.AddNotification("width", OnColumnWidthChanged); // expCol.Expand = true; AppendColumn(expCol); valueCol = new TreeViewColumn(); valueCol.Title = GettextCatalog.GetString("Value"); crpViewer = new CellRendererIcon(); crpViewer.IconId = Gtk.Stock.ZoomIn; valueCol.PackStart(crpViewer, false); valueCol.AddAttribute(crpViewer, "visible", ViewerButtonVisibleCol); crpButton = new CellRendererIcon(); crpButton.StockSize = (uint)Gtk.IconSize.Menu; crpButton.IconId = Gtk.Stock.Refresh; valueCol.PackStart(crpButton, false); valueCol.AddAttribute(crpButton, "visible", ValueButtonVisibleCol); crtValue = new CellRendererText(); valueCol.PackStart(crtValue, true); valueCol.AddAttribute(crtValue, "text", ValueCol); valueCol.AddAttribute(crtValue, "editable", ValueEditableCol); valueCol.AddAttribute(crtValue, "foreground", ValueColorCol); valueCol.Resizable = true; valueCol.MinWidth = 15; valueCol.AddNotification("width", OnColumnWidthChanged); // valueCol.Expand = true; valueCol.Sizing = TreeViewColumnSizing.Fixed; AppendColumn(valueCol); typeCol = new TreeViewColumn(); typeCol.Title = GettextCatalog.GetString("Type"); crtType = new CellRendererText(); typeCol.PackStart(crtType, true); typeCol.AddAttribute(crtType, "text", TypeCol); typeCol.Resizable = true; typeCol.Sizing = TreeViewColumnSizing.Fixed; typeCol.MinWidth = 15; typeCol.AddNotification("width", OnColumnWidthChanged); // typeCol.Expand = true; AppendColumn(typeCol); pinCol = new TreeViewColumn(); crpPin = new CellRendererIcon(); pinCol.PackStart(crpPin, false); pinCol.AddAttribute(crpPin, "stock_id", PinIconCol); crpLiveUpdate = new CellRendererIcon(); pinCol.PackStart(crpLiveUpdate, false); pinCol.AddAttribute(crpLiveUpdate, "pixbuf", LiveUpdateIconCol); pinCol.Resizable = false; pinCol.Visible = false; pinCol.Expand = false; AppendColumn(pinCol); state = new TreeViewState(this, NameCol); crtExp.Edited += OnExpEdited; crtExp.EditingStarted += OnExpEditing; crtExp.EditingCanceled += OnEditingCancelled; crtValue.EditingStarted += OnValueEditing; crtValue.Edited += OnValueEdited; crtValue.EditingCanceled += OnEditingCancelled; this.EnableAutoTooltips(); createMsg = GettextCatalog.GetString("Click here to add a new watch"); }
private ControllerWindow(Builder builder, PlayerIndex controllerId) : base(builder.GetObject("_controllerWin").Handle) { Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.Resources.Logo_Ryujinx.png"); builder.Autoconnect(this); _playerIndex = controllerId; _inputConfig = ConfigurationState.Instance.Hid.InputConfig.Value.Find(inputConfig => inputConfig.PlayerIndex == _playerIndex); Title = $"Ryujinx - Controller Settings - {_playerIndex}"; if (_playerIndex == PlayerIndex.Handheld) { _controllerType.Append(ControllerType.Handheld.ToString(), "Handheld"); _controllerType.Sensitive = false; } else { _controllerType.Append(ControllerType.ProController.ToString(), "Pro Controller"); _controllerType.Append(ControllerType.JoyconPair.ToString(), "Joycon Pair"); _controllerType.Append(ControllerType.JoyconLeft.ToString(), "Joycon Left"); _controllerType.Append(ControllerType.JoyconRight.ToString(), "Joycon Right"); } _controllerType.Active = 0; // Set initial value to first in list. // Bind Events. _lStickX.Clicked += Button_Pressed; _lStickY.Clicked += Button_Pressed; _lStickUp.Clicked += Button_Pressed; _lStickDown.Clicked += Button_Pressed; _lStickLeft.Clicked += Button_Pressed; _lStickRight.Clicked += Button_Pressed; _lStickButton.Clicked += Button_Pressed; _dpadUp.Clicked += Button_Pressed; _dpadDown.Clicked += Button_Pressed; _dpadLeft.Clicked += Button_Pressed; _dpadRight.Clicked += Button_Pressed; _minus.Clicked += Button_Pressed; _l.Clicked += Button_Pressed; _zL.Clicked += Button_Pressed; _lSl.Clicked += Button_Pressed; _lSr.Clicked += Button_Pressed; _rStickX.Clicked += Button_Pressed; _rStickY.Clicked += Button_Pressed; _rStickUp.Clicked += Button_Pressed; _rStickDown.Clicked += Button_Pressed; _rStickLeft.Clicked += Button_Pressed; _rStickRight.Clicked += Button_Pressed; _rStickButton.Clicked += Button_Pressed; _a.Clicked += Button_Pressed; _b.Clicked += Button_Pressed; _x.Clicked += Button_Pressed; _y.Clicked += Button_Pressed; _plus.Clicked += Button_Pressed; _r.Clicked += Button_Pressed; _zR.Clicked += Button_Pressed; _rSl.Clicked += Button_Pressed; _rSr.Clicked += Button_Pressed; // Setup current values. UpdateInputDeviceList(); SetAvailableOptions(); ClearValues(); if (_inputDevice.ActiveId != null) { SetCurrentValues(); } }
public void InitObject(String name, System.Drawing.Color color, String labelText, String font, System.Drawing.Color colorFont, String icon, System.Drawing.Size sizeIcon, int width, int height, bool leftImg) { if (!leftImg) { VBox vbox = new VBox(false, 0); vbox.BorderWidth = 2; System.Drawing.Image imageIcon; _label = new Label(labelText); ChangeFont(font, colorFont); if (icon != string.Empty && File.Exists(icon)) { try { imageIcon = System.Drawing.Image.FromFile(icon); imageIcon = Utils.ResizeAndCrop(imageIcon, sizeIcon); Gdk.Pixbuf pixBuf = Utils.ImageToPixbuf(imageIcon); Image gtkimageButton = new Image(pixBuf); vbox.PackStart(gtkimageButton); imageIcon.Dispose(); pixBuf.Dispose(); } catch (Exception ex) { _log.Error(string.Format("InitObject(): Error load icon from file [{0}]: {1}", icon, ex.Message), ex); } } vbox.PackStart(_label); _widget = vbox; } else { String fontPosBackOfficeParent = GlobalFramework.Settings["fontPosBackOfficeParent"]; String fontPosBackOfficeParentLowRes = GlobalFramework.Settings["fontPosBackOfficeParentLowRes"]; Pango.FontDescription fontDescription = Pango.FontDescription.FromString(fontPosBackOfficeParent); if (GlobalApp.ScreenSize.Height == 800) { fontDescription = Pango.FontDescription.FromString(fontPosBackOfficeParentLowRes); } //tmpFont.Weight = Pango.Weight.Bold; //tmpFont.Size = 2; HBox hbox = new HBox(false, 0); System.Drawing.Image imageIcon; _label = new Label(labelText); ChangeFont(font, colorFont); if (icon != string.Empty && File.Exists(icon)) { try { imageIcon = System.Drawing.Image.FromFile(icon); imageIcon = Utils.ResizeAndCrop(imageIcon, sizeIcon); Gdk.Pixbuf pixBuf = Utils.ImageToPixbuf(imageIcon); Image gtkimageButton = new Image(pixBuf); if (GlobalApp.ScreenSize.Height == 800) { hbox.PackStart(gtkimageButton, false, false, 4); } else { hbox.PackStart(gtkimageButton, false, false, 5); } imageIcon.Dispose(); pixBuf.Dispose(); } catch (Exception ex) { _log.Error(string.Format("InitObject(): Error load icon from file [{0}]: {1}", icon, ex.Message), ex); } } _label.ModifyFont(fontDescription); _label.ModifyFg(StateType.Active, Utils.ColorToGdkColor(FrameworkUtils.StringToColor("0, 0, 0"))); _label.SetAlignment(0.0f, 0.5f); hbox.PackStart(_label, true, true, 0); _widget = hbox; } }
public GtkImage(Gdk.Pixbuf img) { this.frames = new ImageFrame [] { new ImageFrame(img, true) }; }
internal static Gdk.Pixbuf CreateBitmap(string stockId, double width, double height, double scaleFactor) { Gdk.Pixbuf result = null; Gtk.IconSet iconset = Gtk.IconFactory.LookupDefault(stockId); if (iconset != null) { // Find the size that better fits the requested size Gtk.IconSize gsize = Util.GetBestSizeFit(width); result = iconset.RenderIcon(Gtk.Widget.DefaultStyle, Gtk.TextDirection.Ltr, Gtk.StateType.Normal, gsize, null, null, scaleFactor); if (result == null || result.Width < width * scaleFactor) { var gsize2x = Util.GetBestSizeFit(width * scaleFactor, iconset.Sizes); if (gsize2x != Gtk.IconSize.Invalid && gsize2x != gsize) { // Don't dispose the previous result since the icon is owned by the IconSet result = iconset.RenderIcon(Gtk.Widget.DefaultStyle, Gtk.TextDirection.Ltr, Gtk.StateType.Normal, gsize2x, null, null); } } } if (result == null && Gtk.IconTheme.Default.HasIcon(stockId)) { result = Gtk.IconTheme.Default.LoadIcon(stockId, (int)width, (Gtk.IconLookupFlags) 0); } if (result == null) { // render a custom gtk-missing-image icon // if Gtk.Stock.MissingImage is not found int w = (int)width; int h = (int)height; #if XWT_GTK3 Cairo.ImageSurface s = new Cairo.ImageSurface(Cairo.Format.ARGB32, w, h); Cairo.Context cr = new Cairo.Context(s); cr.SetSourceRGB(255, 255, 255); cr.Rectangle(0, 0, w, h); cr.Fill(); cr.SetSourceRGB(0, 0, 0); cr.LineWidth = 1; cr.Rectangle(0.5, 0.5, w - 1, h - 1); cr.Stroke(); cr.SetSourceRGB(255, 0, 0); cr.LineWidth = 3; cr.LineCap = Cairo.LineCap.Round; cr.LineJoin = Cairo.LineJoin.Round; cr.MoveTo(w / 4, h / 4); cr.LineTo((w - 1) - w / 4, (h - 1) - h / 4); cr.MoveTo(w / 4, (h - 1) - h / 4); cr.LineTo((w - 1) - w / 4, h / 4); cr.Stroke(); result = Gtk3Extensions.GetFromSurface(s, 0, 0, w, h); #else using (Gdk.Pixmap pmap = new Gdk.Pixmap(Gdk.Screen.Default.RootWindow, w, h)) using (Gdk.GC gc = new Gdk.GC(pmap)) { gc.RgbFgColor = new Gdk.Color(255, 255, 255); pmap.DrawRectangle(gc, true, 0, 0, w, h); gc.RgbFgColor = new Gdk.Color(0, 0, 0); pmap.DrawRectangle(gc, false, 0, 0, (w - 1), (h - 1)); gc.SetLineAttributes(3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round); gc.RgbFgColor = new Gdk.Color(255, 0, 0); pmap.DrawLine(gc, (w / 4), (h / 4), ((w - 1) - (w / 4)), ((h - 1) - (h / 4))); pmap.DrawLine(gc, ((w - 1) - (w / 4)), (h / 4), (w / 4), ((h - 1) - (h / 4))); result = Gdk.Pixbuf.FromDrawable(pmap, pmap.Colormap, 0, 0, 0, 0, w, h); } #endif } return(result); }
static void Set2xIconVariant(Gdk.Pixbuf px, Gdk.Pixbuf variant2x) { Mono.TextEditor.GtkWorkarounds.Set2xVariant(px, variant2x); }
public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { ProjectFile file = (ProjectFile)dataObject; label = file.Link.IsNullOrEmpty ? file.FilePath.FileName : file.Link.FileName; if (!File.Exists(file.FilePath)) { label = "<span foreground='red'>" + label + "</span>"; } icon = DesktopService.GetPixbufForFile(file.FilePath, Gtk.IconSize.Menu); if (file.IsLink && icon != null) { icon = icon.Copy(); using (Gdk.Pixbuf overlay = Gdk.Pixbuf.LoadFromResource("Icons.16x16.LinkOverlay.png")) { overlay.Composite(icon, 0, 0, icon.Width, icon.Width, 0, 0, 1, 1, Gdk.InterpType.Bilinear, 255); } } }
static void LoadStockIcon(StockIconCodon iconCodon, bool forceWildcard) { try { Gdk.Pixbuf pixbuf = null, pixbuf2x = null; AnimatedIcon animatedIcon = null; if (!string.IsNullOrEmpty(iconCodon.Resource) || !string.IsNullOrEmpty(iconCodon.File)) { // using the stream directly produces a gdk warning. byte[] buffer; Stream stream, stream2x = null; if (iconCodon.Resource != null) { stream = iconCodon.Addin.GetResource(iconCodon.Resource); stream2x = iconCodon.Addin.GetResource2x(iconCodon.Resource); } else { var file = iconCodon.Addin.GetFilePath(iconCodon.File); stream = File.OpenRead(file); var file2x = Path.Combine(Path.GetDirectoryName(file), Path.GetFileNameWithoutExtension(file) + "@2x" + Path.GetExtension(file)); if (File.Exists(file2x)) { stream2x = File.OpenRead(file2x); } else { file2x = file + "@2x"; if (File.Exists(file2x)) { stream2x = File.OpenRead(file2x); } } } using (stream) { if (stream == null || stream.Length < 0) { LoggingService.LogError("Did not find resource '{0}' in addin '{1}' for icon '{2}'", iconCodon.Resource, iconCodon.Addin.Id, iconCodon.StockId); return; } buffer = new byte [stream.Length]; stream.Read(buffer, 0, (int)stream.Length); } pixbuf = new Gdk.Pixbuf(buffer); using (stream2x) { if (stream2x != null && stream2x.Length >= 0) { buffer = new byte [stream2x.Length]; stream2x.Read(buffer, 0, (int)stream2x.Length); pixbuf2x = new Gdk.Pixbuf(buffer); } } } else if (!string.IsNullOrEmpty(iconCodon.IconId)) { var id = GetStockIdForImageSpec(iconCodon.Addin, iconCodon.IconId, iconCodon.IconSize); pixbuf = GetPixbuf(id, iconCodon.IconSize); pixbuf2x = Get2xIconVariant(pixbuf); // This may be an animation, get it animationFactory.TryGetValue(id, out animatedIcon); } else if (!string.IsNullOrEmpty(iconCodon.Animation)) { string id = GetStockIdForImageSpec(iconCodon.Addin, "animation:" + iconCodon.Animation, iconCodon.IconSize); pixbuf = GetPixbuf(id, iconCodon.IconSize); // This *should* be an animation animationFactory.TryGetValue(id, out animatedIcon); } Gtk.IconSize size = forceWildcard? Gtk.IconSize.Invalid : iconCodon.IconSize; if (pixbuf != null) { AddToIconFactory(iconCodon.StockId, pixbuf, pixbuf2x, size); } if (animatedIcon != null) { AddToAnimatedIconFactory(iconCodon.StockId, animatedIcon); } } catch (Exception ex) { LoggingService.LogError(string.Format("Error loading icon '{0}'", iconCodon.StockId), ex); } }
public SettingPlatformDialog(bool isRequired) { this.Build(); //this.isRequired = isRequired; if (isRequired) { button34.Visible = false; } if (MainClass.Settings.BackgroundColor == null) { MainClass.Settings.BackgroundColor = new Option.Settings.BackgroundColors(218, 218, 218); /*if(MainClass.Platform.IsMac) * MainClass.Settings.BackgroundColor = new Moscrif.IDE.Settings.Settings.BackgroundColors(218,218,218); * else * MainClass.Settings.BackgroundColor = new Moscrif.IDE.Settings.Settings.BackgroundColors(224,41,47); */ } if (!isRequired) { cbKeyBinding.AppendText(NOTHING); cbKeyBinding.Active = 0; } cbKeyBinding.AppendText(WIN); cbKeyBinding.AppendText(MACOSX); cbKeyBinding.AppendText(JAVA); cbKeyBinding.AppendText(VisualC); if (isRequired) { if (MainClass.Platform.IsMac) { cbKeyBinding.Active = 1; } else { cbKeyBinding.Active = 0; } } Gdk.Pixbuf default_pixbuf = null; string file = System.IO.Path.Combine(MainClass.Paths.ResDir, "stock-menu.png"); if (System.IO.File.Exists(file)) { default_pixbuf = new Gdk.Pixbuf(file); popupColor = new Gtk.Menu(); CreateMenu(); Gtk.Button btnClose = new Gtk.Button(new Gtk.Image(default_pixbuf)); btnClose.TooltipText = MainClass.Languages.Translate("select_color"); btnClose.Relief = Gtk.ReliefStyle.None; btnClose.CanFocus = false; btnClose.WidthRequest = btnClose.HeightRequest = 22; popupColor.AttachToWidget(btnClose, new Gtk.MenuDetachFunc(DetachWidget)); btnClose.Clicked += delegate { popupColor.Popup(null, null, new Gtk.MenuPositionFunc(GetPosition), 3, Gtk.Global.CurrentEventTime); }; table1.Attach(btnClose, 2, 3, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); table1.ShowAll(); popupColor.ShowAll(); } cbBackground.Color = new Gdk.Color(MainClass.Settings.BackgroundColor.Red, MainClass.Settings.BackgroundColor.Green, MainClass.Settings.BackgroundColor.Blue); }
public override void BuildNode(ITreeBuilder builder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { label = GettextCatalog.GetString("History"); icon = Context.GetIcon("md-prof-history"); }
static Gdk.Pixbuf Get2xIconVariant(Gdk.Pixbuf px) { return(Mono.TextEditor.GtkWorkarounds.Get2xVariant(px)); }