1 /*
2  *  "GEDKeeper", the personal genealogical database editor.
3  *  Copyright (C) 2009-2021 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 System.Collections.Generic;
23 using System.IO;
24 using BSLib;
25 using BSLib.Design.Graphics;
26 using GDModel;
27 using GKCore.Types;
28 
29 namespace GKCore.Interfaces
30 {
31     public interface IBaseContext : IDisposable
32     {
33         ICulture Culture { get; }
34         string FileName { get; }
35         GDMTree Tree { get; }
36         ValuesCollection ValuesCollection { get; }
37         ShieldState ShieldState { get; set; }
38         bool Modified { get; set; }
39         IBaseWindow Viewer { get; }
40         List<GDMLanguageID> LangsList { get; }
41 
IsUnknown()42         bool IsUnknown();
Clear()43         void Clear();
FileLoad(string fileName)44         bool FileLoad(string fileName);
FileSave(string fileName)45         bool FileSave(string fileName);
SetFileName(string fileName)46         void SetFileName(string fileName);
CriticalSave()47         void CriticalSave();
48 
49         // Data manipulation
CreateEventEx(GDMRecordWithEvents aRec, string evSign, string evDate, string evPlace)50         GDMCustomEvent CreateEventEx(GDMRecordWithEvents aRec, string evSign, string evDate, string evPlace);
CreateEventEx(GDMRecordWithEvents aRec, string evSign, GDMCustomDate evDate, string evPlace)51         GDMCustomEvent CreateEventEx(GDMRecordWithEvents aRec, string evSign, GDMCustomDate evDate, string evPlace);
CreatePersonEx(string iName, string iPatronymic, string iSurname, GDMSex iSex, bool birthEvent)52         GDMIndividualRecord CreatePersonEx(string iName, string iPatronymic, string iSurname, GDMSex iSex, bool birthEvent);
DeleteRecord(GDMRecord record)53         bool DeleteRecord(GDMRecord record);
IsRecordAccess(GDMRestriction restriction)54         bool IsRecordAccess(GDMRestriction restriction);
55 
56         // Individual utils
GetMarriageFamily(GDMIndividualRecord iRec, bool canCreate = false)57         GDMFamilyRecord GetMarriageFamily(GDMIndividualRecord iRec, bool canCreate = false);
GetParentsFamily(GDMIndividualRecord iRec, bool canCreate = false)58         GDMFamilyRecord GetParentsFamily(GDMIndividualRecord iRec, bool canCreate = false);
IsChildless(GDMIndividualRecord iRec)59         bool IsChildless(GDMIndividualRecord iRec);
FindBirthYear(GDMIndividualRecord iRec)60         int FindBirthYear(GDMIndividualRecord iRec);
FindDeathYear(GDMIndividualRecord iRec)61         int FindDeathYear(GDMIndividualRecord iRec);
CollectEventValues(GDMCustomEvent evt)62         void CollectEventValues(GDMCustomEvent evt);
CollectNameLangs(GDMPersonalName persName)63         void CollectNameLangs(GDMPersonalName persName);
CollectTips(StringList tipsList)64         void CollectTips(StringList tipsList);
ImportNames(GDMIndividualRecord iRec)65         void ImportNames(GDMIndividualRecord iRec);
FindAll(GDMRecordType recordType, string searchPattern)66         IList<ISearchResult> FindAll(GDMRecordType recordType, string searchPattern);
67 
68         // Multimedia support
GetArcFileName()69         string GetArcFileName();
GetStgFolder(bool create)70         string GetStgFolder(bool create);
CheckBasePath()71         bool CheckBasePath();
GetStoreType(GDMFileReference fileReference)72         MediaStore GetStoreType(GDMFileReference fileReference);
MediaLoad(GDMFileReference fileReference, bool throwException)73         Stream MediaLoad(GDMFileReference fileReference, bool throwException);
MediaLoad(GDMFileReference fileReference)74         string MediaLoad(GDMFileReference fileReference);
MediaSave(GDMFileReference fileReference, string fileName, MediaStoreType storeType)75         bool MediaSave(GDMFileReference fileReference, string fileName, MediaStoreType storeType);
VerifyMediaFile(GDMFileReference fileReference, out string fileName)76         MediaStoreStatus VerifyMediaFile(GDMFileReference fileReference, out string fileName);
77 
78         // Used only in MediaViewer and Slideshow
LoadMediaImage(GDMFileReference fileReference, bool throwException)79         IImage LoadMediaImage(GDMFileReference fileReference, bool throwException);
LoadMediaImage(GDMFileReference fileReference, int thumbWidth, int thumbHeight, ExtRect cutoutArea, bool throwException)80         IImage LoadMediaImage(GDMFileReference fileReference, int thumbWidth, int thumbHeight, ExtRect cutoutArea, bool throwException);
81         // Used in FamilyBookExporter, TreeChart and PersonEdit
GetPrimaryBitmap(GDMIndividualRecord iRec, int thumbWidth, int thumbHeight, bool throwException)82         IImage GetPrimaryBitmap(GDMIndividualRecord iRec, int thumbWidth, int thumbHeight, bool throwException);
GetPrimaryBitmapUID(GDMIndividualRecord iRec)83         string GetPrimaryBitmapUID(GDMIndividualRecord iRec);
84 
IsUpdated()85         bool IsUpdated();
BeginUpdate()86         void BeginUpdate();
EndUpdate()87         void EndUpdate();
SwitchShieldState()88         void SwitchShieldState();
89 
DoUndo()90         void DoUndo();
DoRedo()91         void DoRedo();
DoCommit()92         void DoCommit();
DoRollback()93         void DoRollback();
94 
LockRecord(GDMRecord record)95         void LockRecord(GDMRecord record);
UnlockRecord(GDMRecord record)96         void UnlockRecord(GDMRecord record);
IsAvailableRecord(GDMRecord record)97         bool IsAvailableRecord(GDMRecord record);
98 
FindSource(string sourceName)99         GDMSourceRecord FindSource(string sourceName);
GetSourcesList(StringList sources)100         void GetSourcesList(StringList sources);
101 
DefinePatronymic(string name, GDMSex sex, bool confirm)102         string DefinePatronymic(string name, GDMSex sex, bool confirm);
DefineSex(string iName, string iPatr)103         GDMSex DefineSex(string iName, string iPatr);
CheckPersonSex(GDMIndividualRecord iRec)104         void CheckPersonSex(GDMIndividualRecord iRec);
105 
SelectFamily(GDMIndividualRecord target)106         GDMFamilyRecord SelectFamily(GDMIndividualRecord target);
SelectPerson(GDMIndividualRecord target, TargetMode targetMode, GDMSex needSex)107         GDMIndividualRecord SelectPerson(GDMIndividualRecord target, TargetMode targetMode, GDMSex needSex);
SelectRecord(GDMRecordType mode, params object[] args)108         GDMRecord SelectRecord(GDMRecordType mode, params object[] args);
GetChildFamily(GDMIndividualRecord iChild, bool canCreate, GDMIndividualRecord newParent)109         GDMFamilyRecord GetChildFamily(GDMIndividualRecord iChild,
110                                           bool canCreate,
111                                           GDMIndividualRecord newParent);
AddFamilyForSpouse(GDMIndividualRecord spouse)112         GDMFamilyRecord AddFamilyForSpouse(GDMIndividualRecord spouse);
AddChildForParent(GDMIndividualRecord parent, GDMSex needSex)113         GDMIndividualRecord AddChildForParent(GDMIndividualRecord parent, GDMSex needSex);
SelectSpouseFor(GDMIndividualRecord iRec)114         GDMIndividualRecord SelectSpouseFor(GDMIndividualRecord iRec);
115 
ProcessFamily(GDMFamilyRecord famRec)116         void ProcessFamily(GDMFamilyRecord famRec);
ProcessIndividual(GDMIndividualRecord indiRec)117         void ProcessIndividual(GDMIndividualRecord indiRec);
118     }
119 }
120