mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 09:49:19 +02:00
fixed toc items order
This commit is contained in:
parent
b3790dfcad
commit
1378c40a2c
1 changed files with 6 additions and 1 deletions
|
@ -237,8 +237,13 @@ static jobject createTextModel(JNIEnv *env, jobject javaModel, ZLTextModel &mode
|
||||||
return env->PopLocalFrame(textModel);
|
return env->PopLocalFrame(textModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool ct_compare(const shared_ptr<ContentsTree> &first, const shared_ptr<ContentsTree> &second) {
|
||||||
|
return first->reference() < second->reference();
|
||||||
|
}
|
||||||
|
|
||||||
static void initTOC(JNIEnv *env, jobject javaModel, const ContentsTree &tree) {
|
static void initTOC(JNIEnv *env, jobject javaModel, const ContentsTree &tree) {
|
||||||
const std::vector<shared_ptr<ContentsTree> > &children = tree.children();
|
std::vector<shared_ptr<ContentsTree> > children = tree.children();
|
||||||
|
std::sort(children.begin(), children.end(), ct_compare);
|
||||||
for (std::vector<shared_ptr<ContentsTree> >::const_iterator it = children.begin(); it != children.end(); ++it) {
|
for (std::vector<shared_ptr<ContentsTree> >::const_iterator it = children.begin(); it != children.end(); ++it) {
|
||||||
const ContentsTree &child = **it;
|
const ContentsTree &child = **it;
|
||||||
JString text(env, child.text());
|
JString text(env, child.text());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue