mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 05:01:49 +00:00
Support full screen in BufferView
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22899 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
24fdfc7d5e
commit
6cdf6bd6ab
@ -257,7 +257,7 @@ struct BufferView::Private
|
||||
|
||||
|
||||
BufferView::BufferView(Buffer & buf)
|
||||
: width_(0), height_(0), buffer_(buf), d(new Private(*this))
|
||||
: width_(0), height_(0), full_screen_(false), buffer_(buf), d(new Private(*this))
|
||||
{
|
||||
d->xsel_cache_.set = false;
|
||||
d->intl_.initKeyMapper(lyxrc.use_kbmap);
|
||||
@ -287,6 +287,18 @@ BufferView::~BufferView()
|
||||
}
|
||||
|
||||
|
||||
int BufferView::rightMargin() const
|
||||
{
|
||||
return full_screen_? width_ / 4 : 10;
|
||||
}
|
||||
|
||||
|
||||
int BufferView::leftMargin() const
|
||||
{
|
||||
return full_screen_? width_ / 4 : 10;
|
||||
}
|
||||
|
||||
|
||||
Intl & BufferView::getIntl()
|
||||
{
|
||||
return d->intl_;
|
||||
|
@ -79,7 +79,7 @@ struct ScrollbarParameters
|
||||
class BufferView {
|
||||
public:
|
||||
///
|
||||
BufferView(Buffer & buffer);
|
||||
explicit BufferView(Buffer & buffer);
|
||||
///
|
||||
~BufferView();
|
||||
|
||||
@ -87,6 +87,15 @@ public:
|
||||
Buffer & buffer();
|
||||
Buffer const & buffer() const;
|
||||
|
||||
///
|
||||
void setFullScreen(bool full_screen) { full_screen_ = full_screen; }
|
||||
|
||||
/// right margin
|
||||
int rightMargin() const;
|
||||
|
||||
/// left margin
|
||||
int leftMargin() const;
|
||||
|
||||
/// perform pending metrics updates.
|
||||
/** \c Update::FitCursor means first to do a FitCursor, and to
|
||||
* force an update if screen position changes.
|
||||
@ -282,6 +291,8 @@ private:
|
||||
///
|
||||
int height_;
|
||||
///
|
||||
bool full_screen_;
|
||||
///
|
||||
Buffer & buffer_;
|
||||
|
||||
struct Private;
|
||||
@ -294,9 +305,6 @@ inline int nestMargin() { return 15; }
|
||||
/// margin for changebar
|
||||
inline int changebarMargin() { return 12; }
|
||||
|
||||
/// right margin
|
||||
inline int rightMargin() { return 10; }
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
#endif // BUFFERVIEW_H
|
||||
|
@ -195,13 +195,13 @@ void ParagraphMetrics::dump() const
|
||||
}
|
||||
}
|
||||
|
||||
int ParagraphMetrics::rightMargin(Buffer const & buffer) const
|
||||
int ParagraphMetrics::rightMargin(BufferView const & bv) const
|
||||
{
|
||||
BufferParams const & params = buffer.params();
|
||||
BufferParams const & params = bv.buffer().params();
|
||||
TextClass const & tclass = params.getTextClass();
|
||||
frontend::FontMetrics const & fm = theFontMetrics(params.getFont());
|
||||
int const r_margin =
|
||||
lyx::rightMargin()
|
||||
bv.rightMargin()
|
||||
+ fm.signedWidth(tclass.rightmargin())
|
||||
+ fm.signedWidth(par_->layout()->rightmargin)
|
||||
* 4 / (par_->getDepth() + 4);
|
||||
|
@ -33,6 +33,7 @@ namespace lyx {
|
||||
typedef std::vector<Row> RowList;
|
||||
|
||||
class Buffer;
|
||||
class BufferView;
|
||||
class BufferParams;
|
||||
class Font;
|
||||
class Inset;
|
||||
@ -76,7 +77,7 @@ public:
|
||||
/// The painter and others use this
|
||||
RowList const & rows() const { return rows_; }
|
||||
///
|
||||
int rightMargin(Buffer const & buffer) const;
|
||||
int rightMargin(BufferView const & bv) const;
|
||||
///
|
||||
int singleWidth(pos_type pos, Font const & Font) const;
|
||||
|
||||
|
@ -220,13 +220,13 @@ bool TextMetrics::metrics(MetricsInfo & mi, Dimension & dim, int min_width)
|
||||
|
||||
int TextMetrics::rightMargin(ParagraphMetrics const & pm) const
|
||||
{
|
||||
return main_text_? pm.rightMargin(bv_->buffer()) : 0;
|
||||
return main_text_? pm.rightMargin(*bv_) : 0;
|
||||
}
|
||||
|
||||
|
||||
int TextMetrics::rightMargin(pit_type const pit) const
|
||||
{
|
||||
return main_text_? par_metrics_[pit].rightMargin(bv_->buffer()) : 0;
|
||||
return main_text_? par_metrics_[pit].rightMargin(*bv_) : 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1697,7 +1697,7 @@ int TextMetrics::leftMargin(int max_width,
|
||||
int l_margin = 0;
|
||||
|
||||
if (text_->isMainText(buffer))
|
||||
l_margin += changebarMargin();
|
||||
l_margin += bv_->leftMargin();
|
||||
|
||||
l_margin += theFontMetrics(buffer.params().getFont()).signedWidth(
|
||||
tclass.leftmargin());
|
||||
|
@ -1827,12 +1827,14 @@ bool GuiView::dispatch(FuncRequest const & cmd)
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
#endif
|
||||
d.current_work_area_->setFrameStyle(QFrame::NoFrame);
|
||||
d.current_work_area_->bufferView().setFullScreen(false);
|
||||
menuBar()->show();
|
||||
statusBar()->show();
|
||||
} else {
|
||||
statusBar()->hide();
|
||||
menuBar()->hide();
|
||||
d.current_work_area_->setFrameStyle(QFrame::NoFrame);
|
||||
d.current_work_area_->bufferView().setFullScreen(true);
|
||||
#if QT_VERSION >= 0x040300
|
||||
setContentsMargins(-2, -2, -2, -2);
|
||||
#endif
|
||||
|
@ -908,7 +908,7 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e)
|
||||
rLength = 0;
|
||||
}
|
||||
|
||||
int const right_margin = rightMargin();
|
||||
int const right_margin = buffer_view_->rightMargin();
|
||||
Painter::preedit_style ps;
|
||||
// Most often there would be only one line:
|
||||
preedit_lines_ = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user