| 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), |
| 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 |
{ |
{ |
| 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 |
|
|