public static void ResizeIfNeeded(Gtk.Window win) { int winX, winY; win.GetSize(out winX, out winY); int maxY = ScreenHeightFitted(true); if(winY > maxY) win.Resize(winX, maxY); }
public void SetupViewerGeometry(Gtk.Window w) { int width = (int) gconfClient. Get ("/apps/csboard/viewer/session/width"); int height = (int) gconfClient. Get ("/apps/csboard/viewer/session/height"); w.Resize (width, height); }
private static void ApplyNewSize(Gtk.Window window, int width, int height) { if ( width > MinWidth && height > MinHeight ) { window.Resize( width, height ); } }
private void Rebuild(Gtk.Table table, uint[][][] positions, GedcomIndividualRecord activePerson, GedcomFamilyLink[] lst) { foreach (Gtk.Widget child in table.Children) { child.Destroy(); } table.Resize(1,1); uint xmax = 0; uint ymax = 0; for (int i = 0; i < positions.Length; i ++) { uint x = positions[i][0][0] + 1; uint y = positions[i][0][1] + 1; uint w = positions[i][0][2]; uint h = positions[i][0][3]; GedcomFamilyLink famLink = (GedcomFamilyLink)lst[i]; if (famLink == null) { PedigreeBox pw = new PedigreeBox(null, 0, null); if (i > 0 && lst[((i+1)/2)-1] != null) { GedcomFamilyLink missingFamLink = (GedcomFamilyLink)lst[((i+1)/2)-1]; // missing parent button pw.ForceMouseOver = true; } // FIXME: both conditions do the same thing, double checking // the gramps code it doesn't appear to be a mistake in porting if (positions[i][0][2] > 1) { table.Attach(pw,x, x+w, y, y+h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0); } else { table.Attach(pw,x, x+w, y, y+h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0); } xmax = (uint)Math.Max(xmax, x + w); ymax = (uint)Math.Max(ymax, y + h); } else { GedcomIndividualRecord indi = (GedcomIndividualRecord)_database[famLink.Indi]; if (_showImages && i < ((positions.Length - 1) / 2) && positions[i][0][3] > 1) { } PedigreeBox pw = new PedigreeBox(indi, positions[i][0][3], null); pw.SelectIndividual += PedigreeBox_SelectIndividual; if (positions[i][0][3] < 7) { pw.TooltipMarkup = pw.FormatPerson(11, true); } if (positions[i][0][2] > 1) { table.Attach(pw, x, x+w, y, y+h, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0); } else { table.Attach(pw, x, x+w, y, y+h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0); } xmax = (uint)Math.Max(xmax, x + w); ymax = (uint)Math.Max(ymax, y + h); } // connection lines if (positions[i].Length > 1) { // separate boxes for father and mother x = positions[i][1][0] + 1; y = positions[i][1][1] + 1; w = 1; h = positions[i][1][2]; Gtk.DrawingArea line = new Gtk.DrawingArea(); line.ExposeEvent += Line_Expose; bool rela = false; if (famLink != null && (famLink.Pedigree == PedegreeLinkageType.Birth || famLink.Pedigree == PedegreeLinkageType.Unknown)) { line.AddEvents((int)Gdk.EventMask.ButtonPressMask); rela = true; } Utility.Pair<int, bool> lineData = new Pair<int,bool>(); lineData.First = i * 2 + 1; lineData.Second = rela; _lines[line] = lineData; table.Attach(line, x, x + w, y, y + h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0); xmax = (uint)Math.Max(xmax, x + w); ymax = (uint)Math.Max(ymax, y + h); x = positions[i][2][0] + 1; y = positions[i][2][1] + 1; w = 1; h = positions[i][2][2]; line = new Gtk.DrawingArea(); line.ExposeEvent += Line_Expose; rela = false; if (famLink != null && (famLink.Pedigree == PedegreeLinkageType.Birth || famLink.Pedigree == PedegreeLinkageType.Unknown)) { line.AddEvents((int)Gdk.EventMask.ButtonPressMask); rela = true; } lineData = new Pair<int,bool>(); lineData.First = i * 2 + 2; lineData.Second = rela; _lines[line] = lineData; table.Attach(line, x, x + w, y, y + h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0); xmax = (uint)Math.Max(xmax, x + w); ymax = (uint)Math.Max(ymax, y + h); } // marriage data if (_showMarriageData && positions[i].Length > 3) { string text = string.Empty; if (famLink != null && (famLink.Pedigree == PedegreeLinkageType.Birth || famLink.Pedigree == PedegreeLinkageType.Unknown)) { text = "foo"; } Gtk.Label label = new Gtk.Label(text); label.Justify = Gtk.Justification.Left; label.LineWrap = true; label.SetAlignment(0.1F, 0.5F); x = positions[i][3][0] + 1; y = positions[i][3][1] + 1; w = positions[i][3][2]; h = positions[i][3][3]; table.Attach(label, x, x + w, y, y + h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0); } } // nav arrows if (lst[0] != null) { Gtk.Button arrowButton = new Gtk.Button(); arrowButton.Add(new Gtk.Arrow(Gtk.ArrowType.Left, Gtk.ShadowType.In)); arrowButton.Sensitive = (_dummyFam.Children.Count > 0); arrowButton.Clicked += ArrowButton_Click; if (arrowButton.Sensitive) { arrowButton.TooltipText = "Jump to child..."; } uint ymid = (uint)Math.Floor(ymax / 2.0F); table.Attach(arrowButton, 0, 1, ymid, ymid + 1, 0, 0, 0, 0); // father arrowButton = new Gtk.Button(); arrowButton.Add(new Gtk.Arrow(Gtk.ArrowType.Right, Gtk.ShadowType.In)); arrowButton.Sensitive = (lst[1] != null); arrowButton.Clicked += FatherButton_Click; if (arrowButton.Sensitive) { arrowButton.TooltipText = "Jump to father"; } ymid = (uint)Math.Floor(ymax / 4.0F); table.Attach(arrowButton, xmax, xmax + 1, ymid - 1, ymid + 2, 0, 0, 0, 0); // mother arrowButton = new Gtk.Button(); arrowButton.Add(new Gtk.Arrow(Gtk.ArrowType.Right, Gtk.ShadowType.In)); arrowButton.Sensitive = (lst[2] != null); arrowButton.Clicked += MotherButton_Click; if (arrowButton.Sensitive) { arrowButton.TooltipText = "Jump to mother"; } ymid = (uint)Math.Floor(ymax / 4.0F * 3); table.Attach(arrowButton, xmax, xmax + 1, ymid - 1, ymid + 2, 0, 0, 0, 0); // dummy widgets to allow pedigree to be centred Gtk.Label l = new Gtk.Label(string.Empty); table.Attach(l, 0, 1, 0, 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0); l = new Gtk.Label(string.Empty); table.Attach(l, xmax, xmax + 1, ymax, ymax + 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0); table.ShowAll(); } }
internal virtual void PlaceWindow (Gtk.Window window, int x, int y, int width, int height) { window.Move (x, y); window.Resize (width, height); }
// Pinta TODO: This may need to be overridden for Mac? private void PlaceWindow (Gtk.Window window, int x, int y, int width, int height) { window.Move (x, y); window.Resize (width, height); }