private void UpdateFamily(FamilyClass family, TreeViewLayout layout, ref FamilyButton familyButton, IndividualButton parentButton = null) { trace.TraceInformation("UpdateFamily(" + family.GetXrefName() + "):" + familyButton.bLayout.generation); if (familyButton.family == null) { familyButton.family = family; familyButton.Refresh(); } if (!familyButton.Visible) { if (!familyButton.SetLayout(layout, parentButton)) { trace.TraceInformation("UpdateFamily(" + family.GetXrefName() + ")-aborted"); return; } //familyButton.Refresh(); } if (layout.VisibleButton(familyButton.bLayout)) { if (layout.SearchChildren()) { UpdateIndividualList(family.GetChildList(), familyButton); } if (layout.SearchParents()) { UpdateIndividualList(family.GetParentList(), familyButton); } trace.TraceInformation("UpdateFamily(" + family.GetXrefName() + ")-done"); } else { trace.TraceInformation("UpdateFamily(" + family.GetXrefName() + "," + familyButton.bLayout.generation + ") not visible generation => stop!"); } }
private void UpdateIndividual(IndividualClass person, TreeViewLayout layout, ref IndividualButton personButton, FamilyButton parentButton = null) { trace.TraceInformation("UpdateIndividual(" + person.GetXrefName() + "),gen:" + personButton.bLayout.generation + ",name:" + person.GetPersonalName().GetName()); if (personButton.individual == null) { personButton.individual = person; personButton.Refresh(); } if (!personButton.Visible) { if (!personButton.SetLayout(layout, parentButton)) { trace.TraceInformation("UpdateIndividual(" + person.GetXrefName() + "),gen:" + personButton.bLayout.generation + ")-aborted,hidden"); return; } } if (layout.VisibleButton(personButton.bLayout)) { if (layout.SearchChildren()) { UpdateFamilyList(person.GetFamilySpouseList(), personButton); } if (layout.SearchParents()) { UpdateFamilyList(person.GetFamilyChildList(), personButton); } trace.TraceInformation("UpdateIndividual(" + person.GetXrefName() + ", " + personButton.bLayout.generation + ")-done"); } else { trace.TraceInformation("UpdateIndividual(" + person.GetXrefName() + ", " + personButton.bLayout.generation + ") not visible generation => stop!"); } }
public bool SetLayout(TreeViewLayout layout, IndividualButton parentButton) { if (Visible) { return(true); } if (this.parentButton == null) { this.parentButton = parentButton; } if (this.parentButton != null) { ButtonLayout parentButtonLayout = this.parentButton.bLayout; if (!layout.AddChildFamilyButton(parentButtonLayout, bLayout)) { trace.TraceInformation("SetLayout()-family" + xref + " " + bLayout.generation + " abort, max gen "); return(false); } SetPosition(bLayout.position); Size = bLayout.size; trace.TraceInformation("SetLayout()-family:" + xref + " " + bLayout.generation + " " + bLayout.position + " " + bLayout.size); this.Visible = true; return(true); } return(false); }
public bool SetLayout(TreeViewLayout layout, FamilyButton parentButton) { if (Visible) { return(true); } if (this.parentButton == null) { this.parentButton = parentButton; } ButtonLayout parentLayout = null; if (parentButton != null) { parentLayout = parentButton.bLayout; } if (!layout.AddChildPersonButton(parentLayout, bLayout)) { trace.TraceData(TraceEventType.Error, 0, "warning: AddChildPersonButton failed!"); return(false); } SetPosition(bLayout.position); Size = bLayout.size; trace.TraceInformation("SetLayout()-person:" + xref + " " + bLayout.generation + " " + bLayout.position + " " + bLayout.size); this.Visible = true; return(true); }
public bool IsEqual(TreeViewLayout layout) { if (layout == null) { return(false); } return((this.type == layout.type) && (this.GetGenerations() == layout.GetGenerations())); }
private void ShowActiveFamily() { bool clear = false; trace.TraceInformation("ShowActiveFamily (start)"); if (!this.CanFocus) { trace.TraceInformation("ShowActiveFamily (end:hidden->shown=>refresh)"); return; } if (generationNoCtrl.SelectedItem == null) { trace.TraceInformation("ShowActiveFamily (selecteditem == null)"); return; } if (generationNoCtrl.SelectedItem.ToString() != layout.GetGenerations().ToString()) { layout.SetGenerations(Convert.ToInt32(generationNoCtrl.SelectedItem)); } if (!layout.IsEqual(prevLayout)) { //lastSize.Height = this.Height; //lastSize.Width = this.Width; //layout.Init(lastSize); //ClearButtonLayout(); clear = true; prevLayout = layout.Clone(); } if (selectedIndividual != null) { if ((prevSelectedIndividual == null) || (prevSelectedIndividual != selectedIndividual.GetXrefName())) { //ClearButtonLayout(); clear = true; //prevLayout = layout; prevSelectedIndividual = selectedIndividual.GetXrefName(); } if (clear) { ClearButtonLayout(); trace.TraceData(TraceEventType.Warning, 0, " scrollv:" + mainPanel.VerticalScroll.Value + " " + mainPanel.VerticalScroll.Maximum + " " + mainPanel.VerticalScroll.Minimum + " scrollh:" + mainPanel.HorizontalScroll.Value + " " + mainPanel.HorizontalScroll.Maximum + " " + mainPanel.HorizontalScroll.Minimum); mainPanel.Width += 100; mainPanel.Height += 100; mainPanel.VerticalScroll.Value = mainPanel.VerticalScroll.Maximum; mainPanel.HorizontalScroll.Value = mainPanel.HorizontalScroll.Maximum; trace.TraceData(TraceEventType.Warning, 0, " scrollv:" + mainPanel.VerticalScroll.Value + " " + mainPanel.VerticalScroll.Maximum + " " + mainPanel.VerticalScroll.Minimum + " scrollh:" + mainPanel.HorizontalScroll.Value + " " + mainPanel.HorizontalScroll.Maximum + " " + mainPanel.HorizontalScroll.Minimum); } if (!personControlList.ContainsKey(selectedIndividual.GetXrefName())) { IndividualButton selectedButton = new IndividualButton(selectedIndividual.GetXrefName(), selectedIndividual); selectedButton.SetParent(this); personControlList.Add(selectedIndividual.GetXrefName(), selectedButton); mainPanel.Controls.Add(selectedButton); } IndividualButton personControl = personControlList[selectedIndividual.GetXrefName()]; UpdateIndividual(selectedIndividual, layout, ref personControl); CheckLayout(selectedIndividual.GetXrefName(), false); } else { if (prevSelectedIndividual != null) { ClearButtonLayout(); prevSelectedIndividual = null; } } //Refresh(); trace.TraceInformation("ShowActiveFamily (end-done) "); }
public AsyncTreePanel1() { scaleFactorVertical = (float)(0.0); personControlList = new Dictionary <string, IndividualButton>(); familyControlList = new Dictionary <string, FamilyButton>(); personThreadList = new Dictionary <string, FindPersonThread>(); familyThreadList = new Dictionary <string, FindFamilyThread>(); generationNoCtrl = new ComboBox(); layout = new TreeViewLayout(); for (int i = 9; i >= 2; i--) { generationNoCtrl.Items.Add(i.ToString()); } //generationNoCtrl.Font = new System.Drawing.Font("Segue UI", 9F); //scaleFactorVertical = (float)generationNoCtrl.Font.Height / (float)generationNoCtrl.Font.Size; generationNoCtrl.SelectedItem = layout.GetGenerations().ToString(); //generationNoCtrl.Width = (int)(40 * scaleFactorVertical); //generationNoCtrl.Height = (int)(generationNoCtrl.Font.Height * 1.5); font = new System.Drawing.Font("Segue UI", 9F); SetControlSize(generationNoCtrl, 25, font); //generationNoCtrl.SelectedItemChanged += GenerationNoCtrl_SelectedItemChanged; this.Controls.Add(generationNoCtrl); generationNoChange = new Button(); generationNoChange.Text = "Go"; generationNoChange.Left = generationNoCtrl.Right; //generationNoChange.Font = new System.Drawing.Font("Segue UI", 9F); //Debug.WriteLine("fontsize " + generationNoChange.Font.Height + " sz " + generationNoChange.Font.Size + " sz-pt " + generationNoChange.Font.SizeInPoints); //generationNoChange.Width = (int)(30 * scaleFactorVertical); generationNoChange.MouseClick += generationNoChange_MouseClick; //generationNoChange.Height = (int)(generationNoChange.Font.Height * 1.5); SetControlSize(generationNoChange, 20, font); this.Controls.Add(generationNoChange); /*Button check = new Button(); * check.Text = "Check"; * check.Left = generationNoChange.Right; * //check.Width = (int)(50 * scaleFactorVertical); * check.MouseClick += check_MouseClick; * //check.Font = new System.Drawing.Font("Segue UI", 9F); * //check.Height = (int)(check.Font.Height * 1.5); * SetControlSize(check, 40, font); * this.Controls.Add(check); */ /*Button force = new Button(); * force.Text = "Force"; * force.Left = check.Right; * //force.Width = (int)(50 * scaleFactorVertical); * force.MouseClick += force_MouseClick; * //force.Font = new System.Drawing.Font("Segue UI", 9F); * //force.Height = (int)(force.Font.Height * 1.5); * SetControlSize(force, 40, font); * this.Controls.Add(force); */ mainPanel = new Panel(); //mainPanel.VerticalScroll.Visible = true; //mainPanel.HorizontalScroll.Visible = true; mainPanel.AutoScroll = true; mainPanel.Dock = DockStyle.Fill; mainPanel.Top = generationNoCtrl.Bottom; //SetStyle(ControlStyles.FixedHeight | ControlStyles.FixedWidth, true); //ScrollBars = //AutoScroll = true; mainPanel.Font = font;// new System.Drawing.Font("Segue UI", 9F); this.Controls.Add(mainPanel); parentForm = null; trace.TraceInformation("AsyncTreePanel1::AsyncTreePanel1()"); handleNewIndividual = new HandleNewIndividual(HandleNewIndividual_Function); handleNewFamily = new HandleNewFamily(HandleNewFamily_Function); //this.VScroll = true; //this.HScroll = true; //SetStyle(ControlStyles.FixedHeight | ControlStyles.FixedWidth, true); //ScrollBars = //AutoScroll = true; this.Dock = DockStyle.Fill; updateDelay = null; this.VisibleChanged += TreeViewPanel_VisibleChanged; }