/[ghosts]/ghosts/gedcomviewer/src/BakeryGateway/ViewIndividualRecord.cpp
ViewVC logotype

Diff of /ghosts/gedcomviewer/src/BakeryGateway/ViewIndividualRecord.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by cpcp, Sat Mar 1 12:04:26 2003 UTC revision 1.6 by cpcp, Mon Dec 1 20:11:00 2003 UTC
# Line 23  Line 23 
23  #include "options/Options.hh"  #include "options/Options.hh"
24  #include <gtk--/menu.h>  #include <gtk--/menu.h>
25  #include <gtk--/menushell.h>  #include <gtk--/menushell.h>
26  #include <iostream>  #include <algorithm>
27    #include "GEDCOMParser/Predicates/HasChild.hh"
28    #include "GEDCOMParser/Predicates/PredicateIndividualRecordsAdapter.hh"
29    #include "GEDCOMParser/Predicates/GenericPredicateIndividualRecords.hh"
30    #include "GEDCOMParser/Predicates/PredicateIndividualRecords.hh"
31    
32    
33  BakeryGateway::ViewIndividualRecord::ViewIndividualRecord(MMIIndividualRecord * mmi) :  BakeryGateway::ViewIndividualRecord::ViewIndividualRecord(MMIIndividualRecord * mmi) :
34    _mmi_individual_record(mmi),    _mmi_individual_record(mmi),
# Line 88  void BakeryGateway::ViewIndividualRecord Line 93  void BakeryGateway::ViewIndividualRecord
93                
94        _local_document = get_document();        _local_document = get_document();
95        _individuals = get_document()->getIndividualRecords();        _individuals = get_document()->getIndividualRecords();
96        GEDCOMParser::IndividualRecords_t roots = get_document()->getRootIndividuals();        
97        GEDCOMParser::IndividualRecords_t::const_iterator root =  roots.begin();        GEDCOMParser::Predicates::PredicateIndividualRecords * predicate;
98        if (root != roots.end())        
99          predicate = GEDCOMParser::Predicates::getGenericPredicateIndividualRecords(std::compose1(std::logical_not<bool>(), std::bind1st(GEDCOMParser::Predicates::HasChild(), _local_document)));
100          GEDCOMParser::Predicates::PredicateIndividualRecordsAdapter adapter(predicate);
101          GEDCOMParser::IndividualRecords_t::const_iterator root = std::find_if(_individuals.begin(), _individuals.end(), adapter);
102          if (root != _individuals.end())
103          {          {
104            std::string root_id = root->first;            _current_individu = root;
           _current_individu = _individuals.find(root_id);  
105          }          }
106        else        else
107          {          {
108            _current_individu = _individuals.begin();            _current_individu = _individuals.begin();
109          }          }
110          delete predicate; predicate = 0;
111      }      }
112    if (_current_individu != _individuals.end())    if (_current_individu != _individuals.end())
113      {      {
# Line 143  void BakeryGateway::ViewIndividualRecord Line 152  void BakeryGateway::ViewIndividualRecord
152    
153  void BakeryGateway::ViewIndividualRecord::Goto(std::string const &key)  void BakeryGateway::ViewIndividualRecord::Goto(std::string const &key)
154  {  {
   std::cerr << "BakeryGateway::ViewIndividualRecord::Goto START" << std::endl;  
155    if (_individuals.size() != 0)    if (_individuals.size() != 0)
156      {      {
157        GEDCOMParser::IndividualRecords_t::const_iterator iter = _individuals.find(key);        GEDCOMParser::IndividualRecords_t::const_iterator iter = _individuals.find(key);
158        if (iter != _individuals.end())        if (iter != _individuals.end())
159          {          {
           std::cerr << "BakeryGateway::ViewIndividualRecord::Goto ITER FOUND" << std::endl;  
160            SetCurrentIndividu(iter);            SetCurrentIndividu(iter);
           std::cerr << "BakeryGateway::ViewIndividualRecord::Goto SetCurrentIndividu DONE" << std::endl;  
161          }          }
162      }      }
   std::cerr << "BakeryGateway::ViewIndividualRecord::Goto END" << std::endl;  
163    return;    return;
164  }  }
165    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26