lyx_mirror/src/frontends/qt4
Bo Peng 48f9225e27 Embed: allow the use of embedded layout and class (.cls, .sty) files.
* src/EmbeddedFiles.h|cpp: add validate() function to validate loaded .lyx file.
	* src/LayoutFile.h|cpp: add Layout_Type parameter to addLayoutFile to load an embedded layout.
	* src/BufferParams.h|cpp: read layout from temp directory, then local directory.
	* src/frontends/qt4/GuiDocument.cpp: handle embedded layout type
	* src/LyXFunc.cpp: handle embedded layout when a layout is re-read.
	* src/Buffer.cpp: validate after a buffer is read. handle exceptions properly.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23667 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-11 18:31:38 +00:00
..
ui Allow selection of a local layout file from the document->settings dialog. 2008-03-10 21:31:22 +00:00
Action.cpp header cleanup 2008-02-18 07:14:42 +00:00
Action.h
BulletsModule.cpp
BulletsModule.h
ButtonController.cpp header cleanup 2008-02-18 07:14:42 +00:00
ButtonController.h Factorize out the way window titles are handled. 2008-02-05 12:43:19 +00:00
ButtonPolicy.cpp header cleanup 2008-02-18 07:14:42 +00:00
ButtonPolicy.h
ColorCache.cpp
ColorCache.h
CustomizedWidgets.cpp more compile fixes 2008-02-18 09:55:14 +00:00
CustomizedWidgets.h
Dialog.cpp more of that 2008-03-06 00:07:19 +00:00
Dialog.h more of that 2008-03-06 00:07:19 +00:00
DialogView.h do what the FIXME suggested 2008-03-05 20:11:47 +00:00
DockView.h do what the FIXME suggested 2008-03-05 20:11:47 +00:00
EmptyTable.cpp
EmptyTable.h
FileDialog.cpp compile fixes 2008-03-06 09:07:41 +00:00
FileDialog.h a few more docstring<->QString conversions 2008-03-05 23:10:53 +00:00
FloatPlacement.cpp *** Support for generic sideways floats *** 2008-01-11 18:56:53 +00:00
FloatPlacement.h *** Support for generic sideways floats *** 2008-01-11 18:56:53 +00:00
GuiAbout.cpp Factorize out the way window titles are handled. 2008-02-05 12:43:19 +00:00
GuiAbout.h
GuiAlert.cpp disable annoying debug messages 2008-02-22 10:30:46 +00:00
GuiApplication.cpp Encapsulate all menu related stuff inside Menu.cpp and simplify a few things. 2008-03-08 15:33:52 +00:00
GuiApplication.h merge MenuBackend into frontend/Menus 2008-03-07 00:21:23 +00:00
GuiBibitem.cpp Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiBibitem.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiBibtex.cpp less string conversions as long as we stay in the frontend 2008-03-08 07:59:47 +00:00
GuiBibtex.h less string conversions as long as we stay in the frontend 2008-03-08 07:59:47 +00:00
GuiBox.cpp shorter code.. 2008-03-08 13:02:52 +00:00
GuiBox.h shorter code.. 2008-03-08 13:02:52 +00:00
GuiBranch.cpp header cleanup 2008-02-17 20:47:04 +00:00
GuiBranch.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiBranches.cpp
GuiBranches.h
GuiChanges.cpp header cleanup 2008-02-17 20:47:04 +00:00
GuiChanges.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiCharacter.cpp less string conversions as long as we stay in the frontend 2008-03-08 07:59:47 +00:00
GuiCharacter.h less string conversions as long as we stay in the frontend 2008-03-08 07:59:47 +00:00
GuiCitation.cpp header cleanup 2008-02-18 07:14:42 +00:00
GuiCitation.h
GuiClipboard.cpp a few more docstring<->QString conversions 2008-03-05 23:10:53 +00:00
GuiClipboard.h * Support for graphics pasting (with most code in the frontend's GuiClipboard) 2008-02-03 10:43:03 +00:00
GuiCommandBuffer.cpp * completion infrastructure 2008-02-21 19:42:34 +00:00
GuiCommandBuffer.h
GuiCommandEdit.cpp
GuiCommandEdit.h
GuiCompleter.cpp * fix wrong slot name 2008-03-05 20:34:09 +00:00
GuiCompleter.h * even setModel can trigger focus events. So move also those into 2008-03-04 12:44:48 +00:00
GuiDelimiter.cpp remove unused macro 2008-02-07 14:22:41 +00:00
GuiDelimiter.h
GuiDialog.cpp do what the FIXME suggested 2008-03-05 20:11:47 +00:00
GuiDialog.h do what the FIXME suggested 2008-03-05 20:11:47 +00:00
GuiDocument.cpp Embed: allow the use of embedded layout and class (.cls, .sty) files. 2008-03-11 18:31:38 +00:00
GuiDocument.h Allow selection of a local layout file from the document->settings dialog. 2008-03-10 21:31:22 +00:00
GuiErrorList.cpp more compile fixes 2008-02-18 09:55:14 +00:00
GuiErrorList.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiERT.cpp header cleanup 2008-02-17 20:47:04 +00:00
GuiERT.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiExternal.cpp more of that 2008-03-06 00:07:19 +00:00
GuiExternal.h more of that 2008-03-06 00:07:19 +00:00
GuiFloat.cpp header cleanup 2008-02-17 20:47:04 +00:00
GuiFloat.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiFontExample.cpp
GuiFontExample.h
GuiFontLoader.cpp header cleanup 2008-02-18 07:14:42 +00:00
GuiFontLoader.h
GuiFontMetrics.cpp Hopefully fix monolithic build. 2008-03-02 10:20:13 +00:00
GuiFontMetrics.h
GuiGraphics.cpp cosmetics 2008-03-08 08:20:36 +00:00
GuiGraphics.h more of that 2008-03-06 00:07:19 +00:00
GuiGraphicsUi.h
GuiHyperlink.cpp header cleanup 2008-02-17 20:47:04 +00:00
GuiHyperlink.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiIdListModel.cpp More work towards type safety regarding TextClass's. A couple bugs have been fixed here, too, discovered along the way. 2008-02-28 21:04:55 +00:00
GuiIdListModel.h More work towards type safety regarding TextClass's. A couple bugs have been fixed here, too, discovered along the way. 2008-02-28 21:04:55 +00:00
GuiImage.cpp
GuiImage.h
GuiInclude.cpp more of that 2008-03-06 00:07:19 +00:00
GuiInclude.h more of that 2008-03-06 00:07:19 +00:00
GuiKeySymbol.cpp merge qlkey.h into the only .cpp file #including it 2008-03-05 20:31:49 +00:00
GuiKeySymbol.h
GuiLabel.cpp header cleanup 2008-02-18 07:14:42 +00:00
GuiLabel.h header cleanup 2008-02-17 20:47:04 +00:00
GuiListings.cpp header cleanup 2008-02-18 07:14:42 +00:00
GuiListings.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiLog.cpp header cleanup 2008-02-17 20:47:04 +00:00
GuiLog.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiMath.cpp do what the FIXME suggested 2008-03-05 20:11:47 +00:00
GuiMath.h do what the FIXME suggested 2008-03-05 20:11:47 +00:00
GuiMathMatrix.cpp Factorize out the way window titles are handled. 2008-02-05 12:43:19 +00:00
GuiMathMatrix.h
GuiNomencl.cpp header cleanup 2008-02-18 07:14:42 +00:00
GuiNomencl.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiNote.cpp header cleanup 2008-02-17 20:47:04 +00:00
GuiNote.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiPainter.cpp Hopefully fix monolithic build. 2008-03-02 10:20:13 +00:00
GuiPainter.h
GuiParagraph.cpp Change the interface to a paragraph's layout. We still store a LayoutPtr, but now privately, and make a Layout const & available to clients. 2008-03-06 21:31:27 +00:00
GuiParagraph.h header cleanup 2008-02-18 07:14:42 +00:00
GuiPrefs.cpp * center the line in the layout category headers in the middle of the lowercase chars 2008-03-10 13:02:57 +00:00
GuiPrefs.h less string conversions as long as we stay in the frontend 2008-03-08 07:59:47 +00:00
GuiPrint.cpp less string conversions as long as we stay in the frontend 2008-03-08 07:59:47 +00:00
GuiPrint.h more of that 2008-03-06 00:07:19 +00:00
GuiRef.cpp Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiRef.h
GuiSearch.cpp header cleanup 2008-02-17 20:47:04 +00:00
GuiSearch.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiSelection.cpp header cleanup 2008-02-18 07:14:42 +00:00
GuiSelection.h
GuiSelectionManager.cpp remove duplicated code, (fix cmake merge) 2008-01-14 19:52:16 +00:00
GuiSelectionManager.h 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
GuiSendto.cpp header cleanup 2008-02-17 20:47:04 +00:00
GuiSendto.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiSetBorder.cpp
GuiSetBorder.h
GuiShowFile.cpp a few more docstring<->QString conversions 2008-03-05 23:10:53 +00:00
GuiShowFile.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiSpellchecker.cpp header cleanup 2008-02-18 07:14:42 +00:00
GuiSpellchecker.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiSymbols.cpp Encapsulate all menu related stuff inside Menu.cpp and simplify a few things. 2008-03-08 15:33:52 +00:00
GuiSymbols.h * GuiSymbols.{cpp,h}: 2008-02-08 16:43:02 +00:00
GuiTabular.cpp header cleanup 2008-02-17 20:47:04 +00:00
GuiTabular.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiTabularCreate.cpp header cleanup 2008-02-17 20:47:04 +00:00
GuiTabularCreate.h
GuiTexinfo.cpp ...and clean up headers 2008-03-08 21:55:03 +00:00
GuiTexinfo.h less string conversions as long as we stay in the frontend 2008-03-08 07:59:47 +00:00
GuiThesaurus.cpp header cleanup 2008-02-17 20:47:04 +00:00
GuiThesaurus.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiToc.cpp Navigator: default to table of contents. 2008-03-11 10:34:20 +00:00
GuiToc.h frontend cosmetics 2008-03-06 19:39:52 +00:00
GuiToolbar.cpp * use base color for layout list background. Qt docs say: 2008-03-11 10:29:14 +00:00
GuiToolbar.h * center the line in the layout category headers in the middle of the lowercase chars 2008-03-10 13:02:57 +00:00
GuiToolbars.cpp fix some compiler warnings 2008-03-04 14:04:59 +00:00
GuiToolbars.h Remove TextClassPtr without losing the type safety it provided. 2008-02-28 01:42:02 +00:00
GuiView.cpp General support for InsetCommand context menu. For this to work properly I had to disable all actions triggered by mouse right-clicking. This was bad ui in any case. 2008-03-09 11:22:39 +00:00
GuiView.h * bug fix to only do paragraph redraws, not fullscreen 2008-02-29 09:18:46 +00:00
GuiViewSource.cpp Factorize out the way window titles are handled. 2008-02-05 12:43:19 +00:00
GuiViewSource.h
GuiVSpace.cpp header cleanup 2008-02-17 20:47:04 +00:00
GuiVSpace.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
GuiWorkArea.cpp General support for InsetCommand context menu. For this to work properly I had to disable all actions triggered by mouse right-clicking. This was bad ui in any case. 2008-03-09 11:22:39 +00:00
GuiWorkArea.h * completion cursor 2008-02-28 12:41:43 +00:00
GuiWrap.cpp fileformat incremented to 317: 2008-03-02 17:12:22 +00:00
GuiWrap.h Factorize closeEvent() for GuiDialog based dialogs. 2008-02-17 20:16:14 +00:00
IconPalette.cpp don't update parent and make sure the icon sizes on the palette are correct 2008-01-16 20:51:00 +00:00
IconPalette.h don't update parent and make sure the icon sizes on the palette are correct 2008-01-16 20:51:00 +00:00
InsertTableWidget.cpp
InsertTableWidget.h
LaTeXHighlighter.cpp Use a less verbose form for warnings in the view source window 2007-12-30 21:28:38 +00:00
LaTeXHighlighter.h * src/Buffer.cpp: 2007-12-24 13:55:01 +00:00
LengthCombo.cpp
LengthCombo.h
LyXFileDialog.cpp a few more docstring<->QString conversions 2008-03-05 23:10:53 +00:00
LyXFileDialog.h a few more docstring<->QString conversions 2008-03-05 23:10:53 +00:00
Makefile.am Small Menu code reorg: 2008-03-09 20:38:03 +00:00
Menus.cpp * add "List of Graphics" 2008-03-11 10:27:33 +00:00
Menus.h Small Menu code reorg: 2008-03-09 20:38:03 +00:00
PanelStack.cpp extend the idea of the previous patch a bit... 2008-03-05 20:48:19 +00:00
PanelStack.h extend the idea of the previous patch a bit... 2008-03-05 20:48:19 +00:00
pch.h
qt_helpers.cpp more fixes (correct filename, and repair view file) 2008-03-08 09:54:48 +00:00
qt_helpers.h less string conversions as long as we stay in the frontend 2008-03-08 07:59:47 +00:00
README
TocModel.cpp Patch to please gcc 4.3. Less bloat in the include headers means that 2008-02-07 17:04:06 +00:00
TocModel.h
TocWidget.cpp frontend cosmetics 2008-03-06 19:39:52 +00:00
TocWidget.h Comments from Andre'. 2008-03-04 21:45:54 +00:00
Validator.cpp
Validator.h

This file contains some do's and dont's for the Qt4 frontend.

General rules
-------------

Every editable field that affects the state of the dialog contents
from LyX's point of view should connect its xxxChanged() signal to
a the dialog's changed_adaptor() slot, which in turn should call
changed(). If you are using a more complicated thing anyway,
then remember to call changed() at the end (if it has changed!)

Every non-trivial widget should have a tooltip. If you don't know
what to write, write "FIXME", and it can fixed later. Don't be afraid
to use QWhatsThis too, but this must be done in the derived class's
constructor, and use _("..."). Non-trivial means that things like "OK"
/must not/ have a tooltip.

moc needs a fully qualified "std::string" for .connect() statements
to work. Be very, very careful.

Remember to check tab order on a dialog (third icon, with blue bars in
designer).

Remember to check sensible resizing behaviour on a dialog. This is
usually done by adding a top-level layout to the dialog in Designer.

Remember to use Edit->Check Accelerators

If necessary, you should override Qt2Base::isValid() for determining the
validity of the current dialog's contents.

OK/Apply/Restore/Close should be connected in the derived class's
constructor to call slotOK() etc. Refer to close/cancel as close in the
source.

Override update_contents() to update the dialog, not update().  Only
these functions may change dialog widgets that may emit changed() during
initialisation, to prevent the button controller from changing its
state.

Never call buttoncontroller functions directly from dialogs. In general,
you should use Qt2Base::changed() in all circumstances. However, if you
must call the buttoncontroller, make sure to respect Qt2Base::updating_

Naming conventions
------------------

QFoo.{cpp,h}     The file that interacts with the controller _and_
the implementation of the dialog, derived from the generated files
ui/FooDialog.ui  The designer file
ui_FooDialog.h   Generated files from FooDialog.ui

slots should be named e.g. slotFooClicked(), slotFooSelected(), where
foo is the name of the widget.

Widgets should be named like "fooXX", where XX is one of the following
widget types :

CB - check box
CO - combo box
ED - line edit
GB - group box
LA - label
LC - LengthCombo
LV - QListView
ML - QTextBrowser
PB - push button
RB - radio button
SB - spin box
SL - slider
TE - text edit
TW - tree widget (FIXME: also TV in some files)


Qt, Unicode, and LyX
--------------------

LyX uses a different encoding (UCS4) than Qt (UTF16), therefore there are a
number of conversion functions in qt_helpers.{cpp,h}. Read the doxygen
documentation for details when to use which function.

Additionally, you should follow these simple rules :

o Use qt_() not _() in code
o Use the conversion functions of qt_helpers.h, NOT .latin1() / .c_str() etc.