Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 08-02-2026, 04:56 PM   #1
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,887
Karma: 7500000
Join Date: Nov 2009
Device: many
Advanced TOC editing - details and others

@icearch,

One question, if you have a TOC list like the following for a start.

Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6

And the user multi-selects chapters 2 through 4 and hits the MoveRight (indent) button.

Should Chapters 2 through 4 all be direct first children of Chapter one in that case? Or what?


Next assume the same starting chapter list in the TOC, but this time select chapters 2 and 4 (non-contiguous) and hit MoveRight, what would the final list look like?

Can you see the ambiguity here? When multi-selecting (contiguous and non-contiguous examples) how would the parent of each be chosen? It is not clear and in many ways it is contradictory.

Obviously, this is not an issue given the original single selection model.

Until issues like this are ironed out, there really is no test implementation I can make.

Would your work case be consistent with only contiguous multi-selection?

Last edited by KevinH; 08-02-2026 at 05:01 PM.
KevinH is offline   Reply With Quote
Old 08-02-2026, 07:10 PM   #2
icearch
Groupie
icearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it is
 
Posts: 190
Karma: 2000
Join Date: Nov 2025
Device: none
Advanced TOC editing - details and others

I am starting a new thread here to talk about the tech detail of how advanced TOC editing should work, so that the main new feature thread would not be flooded.

I need some testing, so it's just a placeholder now.

Anyone with questions or solutions or thoughts can post here.
icearch is offline   Reply With Quote
Old 08-02-2026, 08:45 PM   #3
icearch
Groupie
icearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it is
 
Posts: 190
Karma: 2000
Join Date: Nov 2025
Device: none
I have some work in my hands so it may take several days for me to have free time to do this.
icearch is offline   Reply With Quote
Old 08-02-2026, 09:24 PM   #4
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,887
Karma: 7500000
Join Date: Nov 2009
Device: many
Oh, no worries. I thought you had previously said you used some other software (calibre?) that allowed multiple selection for editing a TOC so I thought you might have ideas on how it worked based on that software. If not, I can wait.
KevinH is offline   Reply With Quote
Old 08-02-2026, 10:08 PM   #5
icearch
Groupie
icearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it is
 
Posts: 190
Karma: 2000
Join Date: Nov 2025
Device: none
Yes, I have some basic ideas, but need some testing to be sure. And to clarify some border conditions. Let's not hurry, I will come to a more rounded solution.
icearch is offline   Reply With Quote
Old 08-05-2026, 02:47 AM   #6
icearch
Groupie
icearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it is
 
Posts: 190
Karma: 2000
Join Date: Nov 2025
Device: none
And I finally have some free time to do some test.

Next Are five segments.

1 is I tested how TOC editing works in Sigil.

2 is the conclusions I get.

3 is I tested how TOC editing works in Calibre. It's pretty messy.

4 is the conclusions I get.

5 is the new set of rules I come up with about how Sigil should accomplish advanced TOC editing.

If you are not interested in how I comes to these conclusions or think the testing part is messy (it is), just jump to the last.

I am not a CS professional and English is not my native language, so bear with me if I say some terms wrong. I post with lots of pic so it should help.

Last edited by icearch; 08-05-2026 at 03:05 AM.
icearch is offline   Reply With Quote
Old 08-05-2026, 02:51 AM   #7
icearch
Groupie
icearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it is
 
Posts: 190
Karma: 2000
Join Date: Nov 2025
Device: none
First of all, we already agreed that changing NAV or TOC should NOT affect what’s in the actual text, which is just how it works now, both in Sigil and Calibre.

So let’s see how entries moves in Sigil.

First of all, I created a file that contains 8 h1 tags.

Click image for larger version

Name:	s1.png
Views:	20
Size:	93.3 KB
ID:	224869

And the TOC looks like this:

Click image for larger version

Name:	s2.png
Views:	21
Size:	118.6 KB
ID:	224870

Lets move B to the right (indent it).

Click image for larger version

Name:	s3.png
Views:	15
Size:	117.8 KB
ID:	224871

No problem, and continue clicking Right does nothing. That means the level must be continuous.

Then move C to right once, it becomes sub-level of A, Twice and it becomes sub-level of B.

Lets move D to the farest right for the next setp.

Click image for larger version

Name:	s4.png
Views:	16
Size:	119.5 KB
ID:	224872

Now, move C to the left,

Click image for larger version

Name:	s5.png
Views:	15
Size:	118.0 KB
ID:	224873

We can see D moved with C, it’s parent-level, as a whole.

Let’s say we have a configuration like this:

Click image for larger version

Name:	s6.png
Views:	15
Size:	118.6 KB
ID:	224874

And move C to left:

Click image for larger version

Name:	s7.png
Views:	16
Size:	119.3 KB
ID:	224875

So D and E moved with C.
And move C to right again:

Click image for larger version

Name:	s8.png
Views:	16
Size:	119.6 KB
ID:	224876

We can see D/E/F/G all moved with C. Because we make C be the parent-level to all of these.

You can also make it past 6 levels

Click image for larger version

Name:	s9.png
Views:	15
Size:	120.4 KB
ID:	224877

Click image for larger version

Name:	s10.png
Views:	14
Size:	56.8 KB
ID:	224878

As to move up or down, it can only happens between entries with the same level, so not important.
icearch is offline   Reply With Quote
Old 08-05-2026, 02:51 AM   #8
icearch
Groupie
icearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it is
 
Posts: 190
Karma: 2000
Join Date: Nov 2025
Device: none
So we can comes to conclusion below:

1. Moving an entry means moving all it’s current sub-level entries.

2. Moving an entry to right makes it sub-level of the entry above it, if already that, then right does nothing.

3. Moving an entry to left makes it goes up a level, until the top.

4. Moving an entry up or down switches with the entry above or below.

5. You can make as many levels as you want, up to the each entry a level.
icearch is offline   Reply With Quote
Old 08-05-2026, 02:56 AM   #9
icearch
Groupie
icearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it is
 
Posts: 190
Karma: 2000
Join Date: Nov 2025
Device: none
Let’s see what Calibre do:

Click image for larger version

Name:	c1.png
Views:	17
Size:	87.5 KB
ID:	224879

To my test, moving single entry works just like Sigil so no more repetition.

Let’s move multiple entries.



1. Continuous and same level:

Click image for larger version

Name:	c2.png
Views:	20
Size:	87.5 KB
ID:	224880

Click image for larger version

Name:	c3.png
Views:	21
Size:	87.6 KB
ID:	224881

Moves as if you move it one by one.



2. Non-continuous and same level:

Click image for larger version

Name:	c4.png
Views:	22
Size:	87.6 KB
ID:	224882

Click image for larger version

Name:	c5.png
Views:	20
Size:	87.9 KB
ID:	224883

Still, moves as if you move it one by one.




3. With sub level, select all and only entries within.

Click image for larger version

Name:	c6.png
Views:	14
Size:	87.5 KB
ID:	224884

Click image for larger version

Name:	c7.png
Views:	14
Size:	87.6 KB
ID:	224885





4. With sub level, select only parent entries

Click image for larger version

Name:	c8.png
Views:	14
Size:	87.8 KB
ID:	224886

Click image for larger version

Name:	c9.png
Views:	13
Size:	87.8 KB
ID:	224887

Works just like 3, and it auto select Sub-level entries for some reason. More movement show no difference with 3.




5. Here is the fun part:

Click image for larger version

Name:	c10.png
Views:	22
Size:	91.6 KB
ID:	224888

Click image for larger version

Name:	c11.png
Views:	23
Size:	88.1 KB
ID:	224889

This is caused by also moving entries one by one, but from bottom to top. If you move F, D, and B, you get the same result.




6. But if you select it continuously:

Click image for larger version

Name:	c12.png
Views:	14
Size:	87.3 KB
ID:	224890

Click image for larger version

Name:	c13.png
Views:	16
Size:	87.5 KB
ID:	224891

It moves like a single block.



And I will call it a day now, since I didn’t read the source code, does not know how it actually works. Mabe ask kovidgoyal for help.
icearch is offline   Reply With Quote
Old 08-05-2026, 02:56 AM   #10
icearch
Groupie
icearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it is
 
Posts: 190
Karma: 2000
Join Date: Nov 2025
Device: none
But we can come to conclusions below:

1. Move continuous entries works like I’s a single block, retaining it’s inner structure.

2. Moving non-continuous entries works like moving them one by one, bottom to top.
icearch is offline   Reply With Quote
Old 08-05-2026, 02:57 AM   #11
icearch
Groupie
icearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it is
 
Posts: 190
Karma: 2000
Join Date: Nov 2025
Device: none
And we can see it’s pretty messy here, lot’s of confusion.

So I think we can meet our need with a more clean and neat approach, with these set of rules:

1. Move entries means move all it’s sub-level entries, retaining all structures inside.

2. That means you can NOT select entries with different level.
2.1. Using Ctrl to select one by one of course have no problem( of not let user select entries with different level ).
2.2. Using Shift can only select the highest level ones the user chooses.

3. With rule 1 and 2, there is no difference between continuous and non.

4. Treat it like a automate queue, move each selected entries as user demands.

4.1. Moving them left or right can cause some issiue of becoming sub of each other.
4.1.1. If user demands right, work each entries T2B, so the below ones does not become sub of the above ones.
4.1.2. If user demands left, work each entries B2T, as the below one can break free first.

4.2. Moving them up or down can cause some issues in order. We need different directions
4.2.1. If user demands up, work each entries B2T, so it will float to top and not changing order.
4.2.2. If user demands down, work each entries T2B, so it will sink to bottom and not changing order.
4.2.3. Continuous or non have no difference, at the end it will bunch up and gather together with the same order within them.

5. Work it out and print the result to nav.xhtml.

I think that’s it, I think you do not need too much change in the code where it process movement, may need some hard work in the selecting part. Hope for the best.

Last edited by icearch; 08-05-2026 at 03:45 AM.
icearch is offline   Reply With Quote
Old 08-05-2026, 03:47 AM   #12
icearch
Groupie
icearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it is
 
Posts: 190
Karma: 2000
Join Date: Nov 2025
Device: none
After some second thought, maybe if we apply rule 4 strictly, we can let user select entries with different levels? Need more testing.

But better not for good measure. If user need to do different level editing, just do it in seperate steps.

Last edited by icearch; 08-05-2026 at 12:13 PM.
icearch is offline   Reply With Quote
Old 08-05-2026, 04:10 PM   #13
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,887
Karma: 7500000
Join Date: Nov 2009
Device: many
I will take a look at creating a demo build that acts similarly for testing things. But no promises.

Luckily based on a github there is QItemSelection and QItemSelectionRange classes in Qt that convert mixed and non-contiguous selections piecewise into a list of contiguous selection ranges. That should be useful for a MoveRight (indent). But for a MoveLeft (unindent) siblings have to be dealt with too which complicates things.

Since MoveUp and MoveDown only work for top level items and they carry their children they are much simpler.

What about multi-selections with Delete? The safest would probably be to limit it to single selection at a time as it wipes out children, grandchildren, great-grandchildren, etc so a lot could be lost.
KevinH is offline   Reply With Quote
Old 08-05-2026, 08:13 PM   #14
icearch
Groupie
icearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it is
 
Posts: 190
Karma: 2000
Join Date: Nov 2025
Device: none
MoveUp and MoveDown does not only apply to top level entries, they apply to every level, carring the childern.

As to delete, I really didn't thought of that.

After some test, both Sigil and Calibre delete items with all of it's childern. So I think maybe just make it be.

For avoiding big progess loss, maybe add Undo button? Calibre have Undo. Since if we are applying multi-item editing, adding Undo is a good idea.
icearch is offline   Reply With Quote
Old 08-05-2026, 10:20 PM   #15
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,887
Karma: 7500000
Join Date: Nov 2009
Device: many
Not sure about Undo. Just cancel and reopen if you mess up. Nothing is applied until you save the result.

Yes, move up and down only works on top level items (and their children all come along) when we move them. To see this in Sigil try selecting a single second level toc row and try to use move up or move down, nothing happens. TOC is a QTreeView with row selection. Operations are done on rows.
KevinH is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
TOC editing tohdao Editor 2 10-27-2021 11:37 AM
Editing TOC Text phossler Editor 3 05-22-2020 10:55 AM
Content server: Allow editing the metadata of books from the book details page Divingduck Calibre 2 03-23-2018 11:10 AM
Editing toc exaltedwombat Sigil 4 10-14-2012 01:57 PM
Editing posts --- Go Advanced won't go GrannyGrump Feedback 4 05-25-2012 01:50 AM


All times are GMT -4. The time now is 04:14 AM.


MobileRead.com is a privately owned, operated and funded community.