lyx_mirror/development
Richard Heck d5d665482e This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are.
The changes that accomplish this part are in ModuleList.{h,cpp}, configure.py, and the *.module files themselves. This is a format change, and the lyx2lyx is in those files.

By itself, that change would not be major, except for the fact that we do not want the module to be represented in the UI by its filename---e.g., theorems-std---but rather by a descriptive name, such as "Theorems". But that change turns out to be wholly non-trivial. The mechanism for choosing modules was the same as---indeed, was borrowed from---that in GuiCitation: You get a list of modules, and choosing them involves moving strings from one QListView to another. The models underlying these views are just QStringListModels, which means that, when you want to know what modules have been selected, you see what strings are in the "selected" QListView. But these are just the descriptive names, and we can't look up a module by its descriptive name if it's been translated. That, indeed, was the whole point of the change to the new representation.

So, we need a more complicated model underlying the QListView, one that will pair an identifying string---the filename minus the extension, in this case---with each item. This turns out not to be terribly difficult, though it took rather a while for me to understand why it's not difficult. There are two parts:
(i)  GuiSelectionManger gets re-written to use any QAbstractListModel, not just a QStringListModel. This actually seems to improve the code, independently.
(ii) We then subclass QAbstractListModel to get the associated ID string, using the Qt::UserRole slot associated with each item to store its ID. This would be almost completely trivial if QAbstractListItem::itemData() included the QVariant associated with this role, but it doesn't, so there are some additional hoops through which to jump.

The new model, a GuiIdListModel, is defined in the files by that name. The changes in GuiSelectionManger.{h,cpp} make it more abstract; the changes in GuiDocument.{h,cpp} adapt it to the new framework. 

I've also updated the module documenation to accord with this change.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22501 a592a061-630c-0410-9148-cb99ea01b6c8
2008-01-12 04:28:12 +00:00
..
attic I'll find a solution for the 'dirList problem', Abdel. 2007-11-30 20:57:53 +00:00
cmake cmake: enable lyxserver on linux 2008-01-05 13:12:37 +00:00
coding Add uncrustify.cfg to development/coding. Further adjustments will be needed. Developers are recommended to run 'uncrustify -c development/coding/uncrustify.cfg' against new code to detect format problems 2007-11-06 15:35:38 +00:00
lyxserver Whitespace, only whitespace. Part II. 2004-10-28 14:35:53 +00:00
MacOSX use mkdir -p directly since (1) we know darwin supports it and (2) we do not know whether to use $(mkdir_p) (automake 1.10) or $(MKDIR_P) (automake 1.9) (bug 4216) 2007-09-12 10:30:25 +00:00
scons This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are. 2008-01-12 04:28:12 +00:00
tools I'll find a solution for the 'dirList problem', Abdel. 2007-11-30 20:57:53 +00:00
Win32 update list with available translations 2008-01-02 16:12:21 +00:00
boostworkaround.txt a couple of useful files 2002-05-21 23:58:52 +00:00
FORMAT This commit changes the way individual LyXModule's are represented, both internally and in the .lyx files. The earlier version represented them by their `descriptive name', e.g., "Endnote" or "Theorems (AMS)", these being the same names used in the UI. This was a mistake, as becomes readily apparent when one starts to think about translating these strings. The modules ought to be represented by their filename, without the extension, just as TextClass's are. 2008-01-12 04:28:12 +00:00
gettext.patch update to gettext 0.10.40 2001-10-08 14:36:39 +00:00
lazy_lyxtext.txt Ensure that the last line of text files ends with a newline. 2006-01-19 00:40:38 +00:00
lyx.rpm.README * README: 2007-09-25 11:05:05 +00:00
lyx.spec.in remove more traces of changelogs 2007-10-01 10:58:20 +00:00
Makefile.am do not pack part of the working copy... 2007-10-17 20:23:50 +00:00
Seminar.txt Ensure that the last line of text files ends with a newline. 2006-01-19 00:40:38 +00:00