mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
qt command buffer stuff, some image fixes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4718 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dfbd4a3a9a
commit
f502480182
@ -1,3 +1,22 @@
|
|||||||
|
2002-07-20 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* QLImage.C: various fixes
|
||||||
|
|
||||||
|
* QWorkArea.C: set focus proxy
|
||||||
|
|
||||||
|
* qscreen.C: don't show cursor when in command buffer
|
||||||
|
|
||||||
|
* Makefile.am:
|
||||||
|
* moc/Makefile.am:
|
||||||
|
* QMiniBuffer.h:
|
||||||
|
* QMiniBuffer.C:
|
||||||
|
* QCommandBuffer.h:
|
||||||
|
* QCommandBuffer.C:
|
||||||
|
* QCommandEdit.h:
|
||||||
|
* QCommandEdit.C:
|
||||||
|
* QtView.h:
|
||||||
|
* QtView.C: Rudimentary command buffer
|
||||||
|
|
||||||
2002-07-19 John Levon <moz@compsoc.man.ac.uk>
|
2002-07-19 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
* QWorkArea.C: remove unnecessary include
|
* QWorkArea.C: remove unnecessary include
|
||||||
|
@ -29,6 +29,10 @@ libqt2_la_SOURCES = \
|
|||||||
Timeout_pimpl.h \
|
Timeout_pimpl.h \
|
||||||
Toolbar_pimpl.C \
|
Toolbar_pimpl.C \
|
||||||
Toolbar_pimpl.h \
|
Toolbar_pimpl.h \
|
||||||
|
QCommandBuffer.C \
|
||||||
|
QCommandBuffer.h \
|
||||||
|
QCommandEdit.C \
|
||||||
|
QCommandEdit.h \
|
||||||
QContentPane.C \
|
QContentPane.C \
|
||||||
QContentPane.h \
|
QContentPane.h \
|
||||||
QLImage.C \
|
QLImage.C \
|
||||||
@ -37,8 +41,6 @@ libqt2_la_SOURCES = \
|
|||||||
QLPainter.h \
|
QLPainter.h \
|
||||||
QLyXKeySym.C \
|
QLyXKeySym.C \
|
||||||
QLyXKeySym.h \
|
QLyXKeySym.h \
|
||||||
QMiniBuffer.C \
|
|
||||||
QMiniBuffer.h \
|
|
||||||
Qt2Base.C \
|
Qt2Base.C \
|
||||||
Qt2Base.h \
|
Qt2Base.h \
|
||||||
Qt2BC.C \
|
Qt2BC.C \
|
||||||
|
@ -97,7 +97,7 @@ QLImage::QLImage()
|
|||||||
|
|
||||||
|
|
||||||
QLImage::QLImage(QLImage const & other)
|
QLImage::QLImage(QLImage const & other)
|
||||||
: Image(other), pixmap_(other.pixmap_)
|
: Image(other), pixmap_(other.pixmap_), xformed_pixmap_(other.xformed_pixmap_)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,13 +115,13 @@ Image * QLImage::clone() const
|
|||||||
|
|
||||||
unsigned int QLImage::getWidth() const
|
unsigned int QLImage::getWidth() const
|
||||||
{
|
{
|
||||||
return pixmap_.width();
|
return xformed_pixmap_.width();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int QLImage::getHeight() const
|
unsigned int QLImage::getHeight() const
|
||||||
{
|
{
|
||||||
return pixmap_.height();
|
return xformed_pixmap_.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -140,15 +140,23 @@ void QLImage::load(string const & filename)
|
|||||||
finishedLoading(false);
|
finishedLoading(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
lyxerr[Debug::GRAPHICS] << "just Loaded." << endl;
|
||||||
|
xformed_pixmap_ = pixmap_;
|
||||||
|
lyxerr[Debug::GRAPHICS] << "pixmap isNull " << pixmap_.isNull()
|
||||||
|
<< " xformed_pixmap_ isNull " << xformed_pixmap_.isNull() << endl;
|
||||||
finishedLoading(true);
|
finishedLoading(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool QLImage::setPixmap(Params const & params)
|
bool QLImage::setPixmap(Params const & params)
|
||||||
{
|
{
|
||||||
|
lyxerr[Debug::GRAPHICS] << "pixmap isNull " << pixmap_.isNull()
|
||||||
|
<< " xformed_pixmap_ isNull " << xformed_pixmap_.isNull() << endl;
|
||||||
if (pixmap_.isNull() || params.display == NoDisplay)
|
if (pixmap_.isNull() || params.display == NoDisplay)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
lyxerr[Debug::GRAPHICS] << "setPixmap()" << endl;
|
||||||
|
|
||||||
// FIXME
|
// FIXME
|
||||||
#if 0
|
#if 0
|
||||||
int color_key;
|
int color_key;
|
||||||
@ -179,14 +187,14 @@ bool QLImage::setPixmap(Params const & params)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
xformed_pixmap_ = pixmap_;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QLImage::clip(Params const & params)
|
void QLImage::clip(Params const & params)
|
||||||
{
|
{
|
||||||
if (pixmap_.isNull())
|
lyxerr << "clip isNull " << pixmap_.isNull() << ", " <<xformed_pixmap_.isNull() << endl;
|
||||||
|
if (xformed_pixmap_.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (params.bb.empty())
|
if (params.bb.empty())
|
||||||
@ -219,6 +227,7 @@ void QLImage::clip(Params const & params)
|
|||||||
|
|
||||||
void QLImage::rotate(Params const & params)
|
void QLImage::rotate(Params const & params)
|
||||||
{
|
{
|
||||||
|
lyxerr << "rotate isNull " << pixmap_.isNull() << ", " <<xformed_pixmap_.isNull() << endl;
|
||||||
if (xformed_pixmap_.isNull())
|
if (xformed_pixmap_.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -228,14 +237,17 @@ void QLImage::rotate(Params const & params)
|
|||||||
// The angle passed to flimage_rotate is the angle in one-tenth of a
|
// The angle passed to flimage_rotate is the angle in one-tenth of a
|
||||||
// degree units.
|
// degree units.
|
||||||
|
|
||||||
|
lyxerr[Debug::GRAPHICS] << "rotating image by " << params.angle << " degrees" << endl;
|
||||||
|
|
||||||
QWMatrix m;
|
QWMatrix m;
|
||||||
m.rotate(params.angle / 10.0);
|
m.rotate(params.angle);
|
||||||
xformed_pixmap_.xForm(m);
|
xformed_pixmap_ = xformed_pixmap_.xForm(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QLImage::scale(Params const & params)
|
void QLImage::scale(Params const & params)
|
||||||
{
|
{
|
||||||
|
lyxerr << "scale isNull " << pixmap_.isNull() << ", " <<xformed_pixmap_.isNull() << endl;
|
||||||
if (xformed_pixmap_.isNull())
|
if (xformed_pixmap_.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -246,7 +258,12 @@ void QLImage::scale(Params const & params)
|
|||||||
if (width == getWidth() && height == getHeight())
|
if (width == getWidth() && height == getHeight())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xformed_pixmap_.resize(width, height);
|
lyxerr[Debug::GRAPHICS] << "resizing image to " << width << "(" <<
|
||||||
|
(double(width)/getWidth()) << ")," << height << "(" <<
|
||||||
|
(double(height)/getHeight()) << ")" << endl;
|
||||||
|
QWMatrix m;
|
||||||
|
m.scale(double(width) / getWidth(), double(height) / getHeight());
|
||||||
|
xformed_pixmap_ = xformed_pixmap_.xForm(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace grfx
|
} // namespace grfx
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
/**
|
|
||||||
* \file QMiniBuffer.C
|
|
||||||
* Copyright 1995-2002 the LyX Team
|
|
||||||
* Read the file COPYING
|
|
||||||
*
|
|
||||||
* \author Lars
|
|
||||||
* \author Asger and Juergen
|
|
||||||
* \author John Levon <moz@compsoc.man.ac.uk>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
|
||||||
#pragma implementation
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "QMiniBuffer.h"
|
|
||||||
|
|
||||||
QMiniBuffer::QMiniBuffer(LyXView * o)
|
|
||||||
: MiniBuffer(o)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QMiniBuffer::~QMiniBuffer()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool QMiniBuffer::isEditingMode() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void QMiniBuffer::editingMode()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void QMiniBuffer::messageMode()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void QMiniBuffer::set_input(string const &)
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
/**
|
|
||||||
* \file QMiniBuffer.h
|
|
||||||
* Copyright 1995-2002 the LyX Team
|
|
||||||
* Read the file COPYING
|
|
||||||
*
|
|
||||||
* \author Lars
|
|
||||||
* \author Asger and Juergen
|
|
||||||
* \author John Levon <moz@compsoc.man.ac.uk>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef QMINIBUFFER_H
|
|
||||||
#define QMINIBUFFER_H
|
|
||||||
|
|
||||||
#include "LString.h"
|
|
||||||
|
|
||||||
#include "frontends/MiniBuffer.h"
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
|
||||||
#pragma interface
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// FIXME: place holder only
|
|
||||||
class QMiniBuffer : public MiniBuffer {
|
|
||||||
public:
|
|
||||||
///
|
|
||||||
QMiniBuffer(LyXView *);
|
|
||||||
|
|
||||||
/// destructor
|
|
||||||
virtual ~QMiniBuffer();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/// Are we in editing mode?
|
|
||||||
virtual bool isEditingMode() const;
|
|
||||||
/// enter editing mode
|
|
||||||
virtual void editingMode();
|
|
||||||
/// enter message display mode
|
|
||||||
virtual void messageMode();
|
|
||||||
|
|
||||||
/// set the minibuffer content in editing mode
|
|
||||||
virtual void set_input(string const &);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QMINIBUFFER_H
|
|
@ -45,6 +45,8 @@ QWorkArea::QWorkArea(int, int, int, int)
|
|||||||
|
|
||||||
(static_cast<QMainWindow*>(qApp->mainWidget()))->setCentralWidget(this);
|
(static_cast<QMainWindow*>(qApp->mainWidget()))->setCentralWidget(this);
|
||||||
|
|
||||||
|
setFocusProxy(content_);
|
||||||
|
|
||||||
content_->show();
|
content_->show();
|
||||||
|
|
||||||
content_->setBackgroundColor(lcolor.getX11Name(LColor::background).c_str());
|
content_->setBackgroundColor(lcolor.getX11Name(LColor::background).c_str());
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "lyx_cb.h"
|
#include "lyx_cb.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "MenuBackend.h"
|
#include "MenuBackend.h"
|
||||||
#include "QMiniBuffer.h"
|
|
||||||
#include "ToolbarDefaults.h"
|
#include "ToolbarDefaults.h"
|
||||||
#include "lyxfunc.h"
|
#include "lyxfunc.h"
|
||||||
#include "bufferview_funcs.h"
|
#include "bufferview_funcs.h"
|
||||||
@ -29,16 +28,17 @@
|
|||||||
#include "frontends/Dialogs.h"
|
#include "frontends/Dialogs.h"
|
||||||
#include "frontends/Timeout.h"
|
#include "frontends/Timeout.h"
|
||||||
|
|
||||||
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
#include "QtView.h"
|
#include "QtView.h"
|
||||||
#include "qfont_loader.h"
|
#include "qfont_loader.h"
|
||||||
|
#include "QCommandBuffer.h"
|
||||||
|
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
#include <qpixmap.h>
|
#include <qpixmap.h>
|
||||||
#include <qmenubar.h>
|
#include <qmenubar.h>
|
||||||
#include <qstatusbar.h>
|
#include <qstatusbar.h>
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
// FIXME: this has to go away
|
// FIXME: this has to go away
|
||||||
@ -63,12 +63,19 @@ QtView::QtView(unsigned int width, unsigned int height)
|
|||||||
|
|
||||||
statusBar()->setSizeGripEnabled(false);
|
statusBar()->setSizeGripEnabled(false);
|
||||||
|
|
||||||
minibuffer_.reset(new QMiniBuffer(this));
|
|
||||||
|
|
||||||
bufferview_.reset(new BufferView(this, 0, 0, width, height));
|
bufferview_.reset(new BufferView(this, 0, 0, width, height));
|
||||||
::current_view = bufferview_.get();
|
::current_view = bufferview_.get();
|
||||||
|
|
||||||
view_state_changed.connect(boost::bind(&QtView::update_view_state, this));
|
view_state_changed.connect(boost::bind(&QtView::update_view_state, this));
|
||||||
|
connect(&idle_timer_, SIGNAL(timeout()), this, SLOT(update_view_state_qt()));
|
||||||
|
|
||||||
|
idle_timer_.start(3000);
|
||||||
|
|
||||||
|
focus_command_buffer.connect(boost::bind(&QtView::focus_command_widget, this));
|
||||||
|
|
||||||
|
commandbuffer_ = new QCommandBuffer(this, *controlcommand_);
|
||||||
|
|
||||||
|
addToolBar(commandbuffer_, Bottom, true);
|
||||||
|
|
||||||
// FIXME: move
|
// FIXME: move
|
||||||
// FIXME autosave_timeout_->timeout.connect(SigC::slot(this, &QtView::autoSave));
|
// FIXME autosave_timeout_->timeout.connect(SigC::slot(this, &QtView::autoSave));
|
||||||
@ -89,9 +96,27 @@ QtView::~QtView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QtView::message(string const & str)
|
||||||
|
{
|
||||||
|
statusBar()->message(str.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QtView::focus_command_widget()
|
||||||
|
{
|
||||||
|
commandbuffer_->focus_command();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QtView::update_view_state_qt()
|
||||||
|
{
|
||||||
|
message(currentState(view()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void QtView::update_view_state()
|
void QtView::update_view_state()
|
||||||
{
|
{
|
||||||
statusBar()->message(currentState(view()).c_str());
|
message(currentState(view()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
#include "frontends/LyXView.h"
|
#include "frontends/LyXView.h"
|
||||||
|
|
||||||
#include <qmainwindow.h>
|
#include <qmainwindow.h>
|
||||||
|
#include <qtimer.h>
|
||||||
|
|
||||||
|
class QCommandBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* QtView - Qt implementation of LyXView
|
* QtView - Qt implementation of LyXView
|
||||||
@ -47,15 +50,24 @@ public:
|
|||||||
/// end modal operation
|
/// end modal operation
|
||||||
virtual void allowInput() const;
|
virtual void allowInput() const;
|
||||||
|
|
||||||
|
/// display a status message
|
||||||
|
virtual void message(string const & str);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/// menu item has been selected
|
/// menu item has been selected
|
||||||
void activated(int id);
|
void activated(int id);
|
||||||
|
|
||||||
|
/// idle timeout
|
||||||
|
void update_view_state_qt();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// make sure we quit cleanly
|
/// make sure we quit cleanly
|
||||||
virtual void closeEvent(QCloseEvent * e);
|
virtual void closeEvent(QCloseEvent * e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/// focus the command buffer widget
|
||||||
|
void focus_command_widget();
|
||||||
|
|
||||||
/// update status bar
|
/// update status bar
|
||||||
void update_view_state();
|
void update_view_state();
|
||||||
|
|
||||||
@ -68,6 +80,12 @@ private:
|
|||||||
setCaption(t.c_str());
|
setCaption(t.c_str());
|
||||||
setIconText(it.c_str());
|
setIconText(it.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// idle timer
|
||||||
|
QTimer idle_timer_;
|
||||||
|
|
||||||
|
/// command buffer
|
||||||
|
QCommandBuffer * commandbuffer_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QTVIEW_H
|
#endif // QTVIEW_H
|
||||||
|
@ -37,6 +37,10 @@ QCitation
|
|||||||
|
|
||||||
- loop round searching not working perhaps ??
|
- loop round searching not working perhaps ??
|
||||||
|
|
||||||
|
QCommandBuffer
|
||||||
|
|
||||||
|
- finish off, use listview etc.
|
||||||
|
|
||||||
QContentPane
|
QContentPane
|
||||||
|
|
||||||
- triple click
|
- triple click
|
||||||
@ -61,7 +65,7 @@ QForks
|
|||||||
|
|
||||||
QGraphics
|
QGraphics
|
||||||
|
|
||||||
- UI cleanups. Maybe not vital
|
- UI cleanups and fixes
|
||||||
|
|
||||||
QInclude
|
QInclude
|
||||||
|
|
||||||
@ -74,7 +78,6 @@ qlkey
|
|||||||
QLImage
|
QLImage
|
||||||
|
|
||||||
- get jpeg etc. to work
|
- get jpeg etc. to work
|
||||||
- get rotation etc. to work
|
|
||||||
- get mono/color to work
|
- get mono/color to work
|
||||||
- get bgcolor and clipping to work
|
- get bgcolor and clipping to work
|
||||||
|
|
||||||
@ -88,11 +91,6 @@ QLyXKeySym
|
|||||||
- isOK() - meaningful or not ?
|
- isOK() - meaningful or not ?
|
||||||
- getISOEncoded - get this to work (*)
|
- getISOEncoded - get this to work (*)
|
||||||
|
|
||||||
QMiniBuffer
|
|
||||||
|
|
||||||
- implement as a QStatusBar and a separate QToolbar containing a QComboBox (*)
|
|
||||||
- make the necessary GUII API changes for this to work (*)
|
|
||||||
|
|
||||||
QPreferences
|
QPreferences
|
||||||
|
|
||||||
- implement me (*)
|
- implement me (*)
|
||||||
|
@ -22,6 +22,8 @@ nodist_libqt2moc_la_SOURCES = \
|
|||||||
lengthcombo_moc.C \
|
lengthcombo_moc.C \
|
||||||
qttableview_moc.C \
|
qttableview_moc.C \
|
||||||
Toolbar_pimpl_moc.C \
|
Toolbar_pimpl_moc.C \
|
||||||
|
QCommandBuffer_moc.C \
|
||||||
|
QCommandEdit_moc.C \
|
||||||
QContentPane_moc.C \
|
QContentPane_moc.C \
|
||||||
Qt2Base_moc.C \
|
Qt2Base_moc.C \
|
||||||
QtView_moc.C \
|
QtView_moc.C \
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include "insets/insettext.h"
|
#include "insets/insettext.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
#include <qapplication.h>
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::max;
|
using std::max;
|
||||||
using std::min;
|
using std::min;
|
||||||
@ -57,6 +59,15 @@ QScreen::~QScreen()
|
|||||||
void QScreen::showManualCursor(LyXText const * text, int x, int y,
|
void QScreen::showManualCursor(LyXText const * text, int x, int y,
|
||||||
int asc, int desc, Cursor_Shape shape)
|
int asc, int desc, Cursor_Shape shape)
|
||||||
{
|
{
|
||||||
|
if (!qApp->focusWidget())
|
||||||
|
return;
|
||||||
|
|
||||||
|
string const focusname(qApp->focusWidget()->name());
|
||||||
|
|
||||||
|
// Probably a hack
|
||||||
|
if (focusname != "content_pane")
|
||||||
|
return;
|
||||||
|
|
||||||
int const y1 = max(y - text->first_y - asc, 0);
|
int const y1 = max(y - text->first_y - asc, 0);
|
||||||
int const y_tmp = min(y - text->first_y + desc, owner_.height());
|
int const y_tmp = min(y - text->first_y + desc, owner_.height());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user