1 /* 2 * "GEDKeeper", the personal genealogical database editor. 3 * Copyright (C) 2009-2018 by Sergey V. Zhdanovskih. 4 * 5 * This file is part of "GEDKeeper". 6 * 7 * This program is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 using System; 22 using BSLib.Design.MVP.Controls; 23 using GKCore; 24 using GKCore.Controllers; 25 using GKCore.Interfaces; 26 using GKCore.MVP.Views; 27 using GKUI.Components; 28 29 namespace GKUI.Forms 30 { 31 public sealed partial class TTPatSearchDlg : CommonDialog, IPatriarchsSearchDlg 32 { 33 private readonly PatriarchsSearchController fController; 34 35 private GKListView ListPatriarchs; 36 37 #region View Interface 38 39 INumericBox IPatriarchsSearchDlg.MinGensNum 40 { 41 get { return GetControlHandler<INumericBox>(edMinGens); } 42 } 43 44 ICheckBox IPatriarchsSearchDlg.WithoutDatesCheck 45 { 46 get { return GetControlHandler<ICheckBox>(chkWithoutDates); } 47 } 48 49 IListView IPatriarchsSearchDlg.PatriarchsList 50 { 51 get { return ListPatriarchs; } 52 } 53 54 #endregion 55 TTPatSearchDlg(IBaseWindow baseWin)56 public TTPatSearchDlg(IBaseWindow baseWin) 57 { 58 InitializeComponent(); 59 60 btnClose.Image = UIHelper.LoadResourceImage("Resources.btn_cancel.gif"); 61 62 fController = new PatriarchsSearchController(this); 63 fController.Init(baseWin); 64 65 ListPatriarchs = UIHelper.CreateListView(Panel3); 66 ListPatriarchs.DoubleClick += ListPatriarchs_DblClick; 67 ListPatriarchs.AddColumn(LangMan.LS(LSID.LSID_Patriarch), 400, false); 68 ListPatriarchs.AddColumn(LangMan.LS(LSID.LSID_Birth), 90, false); 69 ListPatriarchs.AddColumn(LangMan.LS(LSID.LSID_Descendants), 90, false); 70 ListPatriarchs.AddColumn(LangMan.LS(LSID.LSID_Generations), 90, false); 71 72 SetLocale(); 73 } 74 SetLocale()75 public void SetLocale() 76 { 77 Title = LangMan.LS(LSID.LSID_ToolOp_8); 78 pagePatSearch.Text = LangMan.LS(LSID.LSID_ToolOp_8); 79 btnClose.Text = LangMan.LS(LSID.LSID_DlgClose); 80 lblMinGenerations.Text = LangMan.LS(LSID.LSID_MinGenerations); 81 btnSetPatriarch.Text = LangMan.LS(LSID.LSID_SetPatFlag); 82 btnPatSearch.Text = LangMan.LS(LSID.LSID_Search); 83 chkWithoutDates.Text = LangMan.LS(LSID.LSID_WithoutDates); 84 btnPatriarchsDiagram.Text = LangMan.LS(LSID.LSID_PatriarchsDiagram); 85 } 86 ListPatriarchs_DblClick(object sender, EventArgs e)87 private void ListPatriarchs_DblClick(object sender, EventArgs e) 88 { 89 fController.SelectPatriarch(); 90 } 91 btnPatSearch_Click(object sender, EventArgs e)92 private void btnPatSearch_Click(object sender, EventArgs e) 93 { 94 fController.Search(); 95 } 96 btnSetPatriarch_Click(object sender, EventArgs e)97 private void btnSetPatriarch_Click(object sender, EventArgs e) 98 { 99 fController.SetPatriarch(); 100 } 101 btnPatriarchsDiagram_Click(object sender, EventArgs e)102 private void btnPatriarchsDiagram_Click(object sender, EventArgs e) 103 { 104 fController.ShowPatriarchsDiagram(); 105 } 106 } 107 } 108