2006-03-05 17:24:44 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
|
* \file GuiToolbar.h
|
2006-03-05 17:24:44 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
|
* \author Angus Leeming
|
|
|
|
|
* \author Abdelrazak Younes
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
|
#ifndef GUITOOLBAR_H
|
|
|
|
|
#define GUITOOLBAR_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-08-14 09:54:59 +00:00
|
|
|
|
#include "Session.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-28 22:53:00 +00:00
|
|
|
|
#include <QList>
|
2006-09-10 11:03:21 +00:00
|
|
|
|
#include <QToolBar>
|
2007-10-01 22:19:39 +00:00
|
|
|
|
#include <QComboBox>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
2007-08-31 05:53:55 +00:00
|
|
|
|
|
Fix bug 4037 and related problems. The patch has been cleaned up a bit
from the one posted to the list.
The basic idea has two parts. First, we hard code an "empty layout"
(called PlainLayout, for want of a better name) in TextClass and read it
before doing anything else. It can therefore be customized by classes,
if they want---say, to make it left-aligned. Second, InsetText's are
divided into three types: (i) normal ones, that use the "default" layout
defined by the text class; (ii) highly restrictive ones, such as ERT and
(not quite an inset) table cells, which demand the empty layout; (iii)
middling ones, which default to an empty layout and use the empty layout
in place of the default. (This is so we don't get the same problem we
had with ERT in e.g. footnotes.) The type of inset is signaled by new
methods InsetText::forceEmptyLayout() and InsetText::useEmptyLayout().
(The latter might better be called: useEmptyLayoutInsteadOfDefault(),
but that's silly.) The old InsetText::forceDefaultParagraphs() has been
split into these, plus a new method InsetText::allowParagraphCustomization().
A lot of the changes just adapt to this change.
The other big change is in GuiToolbar: We want to show LyXDefault and
the "default" layout only when they're active.
There are a handful of places where I'm not entirely sure whether we
should be using forceEmptyLayout or !allowParagraphCustomization() or
both. The InsetCaption is one of these. These places, and some others,
are marked with FIXMEs, so I'd appreciate it if people would search
through the patch and let me know whether these need changing. If they
don't, the FIXMEs can be deleted.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22966 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-12 17:31:07 +00:00
|
|
|
|
class Inset;
|
2007-11-20 22:03:56 +00:00
|
|
|
|
class TextClass;
|
2007-10-01 21:51:06 +00:00
|
|
|
|
class ToolbarItem;
|
2007-08-31 05:53:55 +00:00
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
namespace frontend {
|
|
|
|
|
|
2007-10-15 22:43:55 +00:00
|
|
|
|
class GuiCommandBuffer;
|
2007-11-05 13:52:37 +00:00
|
|
|
|
class GuiView;
|
2006-06-17 09:14:58 +00:00
|
|
|
|
class Action;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
|
2007-10-01 21:26:25 +00:00
|
|
|
|
class GuiLayoutBox : public QComboBox
|
2007-09-05 20:33:29 +00:00
|
|
|
|
{
|
2006-03-05 17:24:44 +00:00
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2007-11-05 13:52:37 +00:00
|
|
|
|
GuiLayoutBox(GuiView &);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-28 21:41:56 +00:00
|
|
|
|
/// select the right layout in the combobox.
|
2007-07-11 13:39:08 +00:00
|
|
|
|
void set(docstring const & layout);
|
2007-10-15 22:43:55 +00:00
|
|
|
|
/// Populate the layout combobox.
|
2007-11-20 22:03:56 +00:00
|
|
|
|
void updateContents(bool reset);
|
2007-11-10 00:21:42 +00:00
|
|
|
|
/// Add Item to Layout box according to sorting settings from preferences
|
|
|
|
|
void addItemSort(QString const & item, bool sorted);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-06-30 14:37:33 +00:00
|
|
|
|
private Q_SLOTS:
|
2006-03-05 17:24:44 +00:00
|
|
|
|
void selected(const QString & str);
|
|
|
|
|
|
|
|
|
|
private:
|
2007-11-05 13:52:37 +00:00
|
|
|
|
GuiView & owner_;
|
2007-11-20 22:03:56 +00:00
|
|
|
|
TextClass const * text_class_;
|
Fix bug 4037 and related problems. The patch has been cleaned up a bit
from the one posted to the list.
The basic idea has two parts. First, we hard code an "empty layout"
(called PlainLayout, for want of a better name) in TextClass and read it
before doing anything else. It can therefore be customized by classes,
if they want---say, to make it left-aligned. Second, InsetText's are
divided into three types: (i) normal ones, that use the "default" layout
defined by the text class; (ii) highly restrictive ones, such as ERT and
(not quite an inset) table cells, which demand the empty layout; (iii)
middling ones, which default to an empty layout and use the empty layout
in place of the default. (This is so we don't get the same problem we
had with ERT in e.g. footnotes.) The type of inset is signaled by new
methods InsetText::forceEmptyLayout() and InsetText::useEmptyLayout().
(The latter might better be called: useEmptyLayoutInsteadOfDefault(),
but that's silly.) The old InsetText::forceDefaultParagraphs() has been
split into these, plus a new method InsetText::allowParagraphCustomization().
A lot of the changes just adapt to this change.
The other big change is in GuiToolbar: We want to show LyXDefault and
the "default" layout only when they're active.
There are a handful of places where I'm not entirely sure whether we
should be using forceEmptyLayout or !allowParagraphCustomization() or
both. The InsetCaption is one of these. These places, and some others,
are marked with FIXMEs, so I'd appreciate it if people would search
through the patch and let me know whether these need changing. If they
don't, the FIXMEs can be deleted.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22966 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-12 17:31:07 +00:00
|
|
|
|
Inset const * inset_;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2007-10-01 20:45:50 +00:00
|
|
|
|
class GuiToolbar : public QToolBar
|
2007-09-05 20:33:29 +00:00
|
|
|
|
{
|
2006-03-05 17:24:44 +00:00
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2007-11-05 13:52:37 +00:00
|
|
|
|
GuiToolbar(ToolbarInfo const &, GuiView &);
|
2006-04-05 23:56:29 +00:00
|
|
|
|
|
2007-10-01 20:45:50 +00:00
|
|
|
|
/// Add a button to the bar.
|
2007-04-19 19:43:15 +00:00
|
|
|
|
void add(ToolbarItem const & item);
|
2007-10-01 20:45:50 +00:00
|
|
|
|
/** update toolbar information
|
|
|
|
|
* ToolbarInfo will then be saved by session
|
|
|
|
|
*/
|
2006-11-02 16:01:36 +00:00
|
|
|
|
void saveInfo(ToolbarSection::ToolbarInfo & info);
|
2007-10-01 20:45:50 +00:00
|
|
|
|
/// Refresh the contents of the bar.
|
|
|
|
|
void updateContents();
|
2007-10-02 06:59:02 +00:00
|
|
|
|
///
|
|
|
|
|
GuiCommandBuffer * commandBuffer() { return command_buffer_; }
|
2006-09-10 11:03:21 +00:00
|
|
|
|
|
2008-01-16 18:27:24 +00:00
|
|
|
|
Action * addItem(ToolbarItem const & item);
|
|
|
|
|
|
2006-06-30 14:37:33 +00:00
|
|
|
|
Q_SIGNALS:
|
2006-05-31 12:53:05 +00:00
|
|
|
|
void updated();
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
private:
|
2006-04-05 23:56:29 +00:00
|
|
|
|
|
2007-09-28 22:53:00 +00:00
|
|
|
|
QList<Action *> actions_;
|
2007-11-05 13:52:37 +00:00
|
|
|
|
GuiView & owner_;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-28 22:53:00 +00:00
|
|
|
|
GuiLayoutBox * layout_;
|
|
|
|
|
GuiCommandBuffer * command_buffer_;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
|
#endif // GUITOOLBAR_H
|