Thread: Sigil 0.2.1
View Single Post
Old 06-19-2010, 05:41 PM   #13
Valloric
Created Sigil, FlightCrew
Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.
 
Valloric's Avatar
 
Posts: 1,982
Karma: 350515
Join Date: Feb 2008
Device: Kobo Clara HD
Quote:
Originally Posted by theducks View Post
BTW I just tried a file I had trouble with on Windows on Ubuntu. No problem doing a task I tried many times to do on Windows version.

Got to be my system
I was just about to say that it must be your system, for several reasons:
  1. Nothing changed in the way CV -> BV transition is preformed (or the other way around) between 0.2.0 and 0.2.1.
  2. I've been staring at the relevant pieces of code for the past hour, and there's just no way that you could make a change in CV, switch to BV and not have the changes applied there.
There are three content caches for HTML tabs, for performance reasons. There's the QWebPage which holds the rendered state of the HTML and is the main cache for Book View. When you type in BV, this is what you're changing. Then there's the QTextDocument which holds the syntax highlighted text for the Code View, and is its main cache. Again, you're editing this in CV. And then there's QDomDocument, which is the central, "neutral", DOM cache which represents the actual state of the HTML resource.

When you edit in a View and then leave the tab, Sigil catches the loss of focus on the tab and saves the changes from one of the secondary caches (QWebPage, QTextDocument) to the primary one (QDomDocument). When the tab regains focus or the user switches to it without giving it focus, the secondary cache of the current View is updated.

Now, when you switch between the Views, the primary cache is circumvented, and the changes are applied directly between the two secondaries (again, performance).

The absolutely only way that you could edit in CV, switch to BV and not have the changes transfer... well several things would need to happen:
  1. You'd have to find some unimaginable way of circumventing the secondary cache sync algos. Normally I'd say that was impossible: you can't click a button or the shortcut for switching views without invoking them. No way, period.
  2. Then you'd have to enter BV without being in CV before it... again, how exactly if you just pushed a button do it? But let's say you did, you'd now be entering BV as if the tab was just opened or the focus was in, say, the Book Browser and now the BV syncs from the primary cache.
  3. And then, the primary cache would need to out of date for the BV to sync to the "old" content. Again, impossible. Even if step 2 worked, and you left CV and entered BV by some freaky way, CV would still update the primary cache on losing focus.
Bottom line? The only way all of this could maybe (and that's a ridiculous maybe) happen is if your OS isn't sending focus events the way it should... or QtWebKit exploded... or whatever.

If you're seeing this behavior on one machine and not the other, then the first machine has more serious problems than Sigil.
Valloric is offline   Reply With Quote