From: John Levon Date: Fri, 19 Jul 2002 23:04:55 +0000 (+0000) Subject: qt command buffer stuff, some image fixes X-Git-Tag: 1.6.10~18809 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=f5024801820ba897be6c48ec31fafab320b1ba49;p=lyx.git qt command buffer stuff, some image fixes git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4718 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 3f75f43b0a..cb22d895aa 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,22 @@ +2002-07-20 John Levon + + * 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 * QWorkArea.C: remove unnecessary include diff --git a/src/frontends/qt2/Makefile.am b/src/frontends/qt2/Makefile.am index 0a33a81781..c8b138c3bb 100644 --- a/src/frontends/qt2/Makefile.am +++ b/src/frontends/qt2/Makefile.am @@ -29,6 +29,10 @@ libqt2_la_SOURCES = \ Timeout_pimpl.h \ Toolbar_pimpl.C \ Toolbar_pimpl.h \ + QCommandBuffer.C \ + QCommandBuffer.h \ + QCommandEdit.C \ + QCommandEdit.h \ QContentPane.C \ QContentPane.h \ QLImage.C \ @@ -37,8 +41,6 @@ libqt2_la_SOURCES = \ QLPainter.h \ QLyXKeySym.C \ QLyXKeySym.h \ - QMiniBuffer.C \ - QMiniBuffer.h \ Qt2Base.C \ Qt2Base.h \ Qt2BC.C \ diff --git a/src/frontends/qt2/QLImage.C b/src/frontends/qt2/QLImage.C index 6b2b78124a..c17d157247 100644 --- a/src/frontends/qt2/QLImage.C +++ b/src/frontends/qt2/QLImage.C @@ -97,7 +97,7 @@ QLImage::QLImage() 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 { - return pixmap_.width(); + return xformed_pixmap_.width(); } unsigned int QLImage::getHeight() const { - return pixmap_.height(); + return xformed_pixmap_.height(); } @@ -140,15 +140,23 @@ void QLImage::load(string const & filename) finishedLoading(false); 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); } 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) return false; + lyxerr[Debug::GRAPHICS] << "setPixmap()" << endl; + // FIXME #if 0 int color_key; @@ -179,14 +187,14 @@ bool QLImage::setPixmap(Params const & params) } #endif - xformed_pixmap_ = pixmap_; return true; } void QLImage::clip(Params const & params) { - if (pixmap_.isNull()) + lyxerr << "clip isNull " << pixmap_.isNull() << ", " < - */ - -#include - -#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 &) -{ -} diff --git a/src/frontends/qt2/QMiniBuffer.h b/src/frontends/qt2/QMiniBuffer.h deleted file mode 100644 index b4a0fe2bb8..0000000000 --- a/src/frontends/qt2/QMiniBuffer.h +++ /dev/null @@ -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 - */ - -#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 diff --git a/src/frontends/qt2/QWorkArea.C b/src/frontends/qt2/QWorkArea.C index 37a83d54a8..cb1aef11ec 100644 --- a/src/frontends/qt2/QWorkArea.C +++ b/src/frontends/qt2/QWorkArea.C @@ -45,6 +45,8 @@ QWorkArea::QWorkArea(int, int, int, int) (static_cast(qApp->mainWidget()))->setCentralWidget(this); + setFocusProxy(content_); + content_->show(); content_->setBackgroundColor(lcolor.getX11Name(LColor::background).c_str()); diff --git a/src/frontends/qt2/QtView.C b/src/frontends/qt2/QtView.C index 975ba9b3f3..06786a16ed 100644 --- a/src/frontends/qt2/QtView.C +++ b/src/frontends/qt2/QtView.C @@ -18,7 +18,6 @@ #include "lyx_cb.h" #include "support/filetools.h" #include "MenuBackend.h" -#include "QMiniBuffer.h" #include "ToolbarDefaults.h" #include "lyxfunc.h" #include "bufferview_funcs.h" @@ -29,16 +28,17 @@ #include "frontends/Dialogs.h" #include "frontends/Timeout.h" +#include + #include "QtView.h" #include "qfont_loader.h" +#include "QCommandBuffer.h" #include #include #include #include -#include - using std::endl; // FIXME: this has to go away @@ -63,12 +63,19 @@ QtView::QtView(unsigned int width, unsigned int height) statusBar()->setSizeGripEnabled(false); - minibuffer_.reset(new QMiniBuffer(this)); - bufferview_.reset(new BufferView(this, 0, 0, width, height)); ::current_view = bufferview_.get(); 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 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() { - statusBar()->message(currentState(view()).c_str()); + message(currentState(view())); } diff --git a/src/frontends/qt2/QtView.h b/src/frontends/qt2/QtView.h index 247bed896a..8b07c4cb3f 100644 --- a/src/frontends/qt2/QtView.h +++ b/src/frontends/qt2/QtView.h @@ -20,6 +20,9 @@ #include "frontends/LyXView.h" #include +#include + +class QCommandBuffer; /** * QtView - Qt implementation of LyXView @@ -47,15 +50,24 @@ public: /// end modal operation virtual void allowInput() const; + /// display a status message + virtual void message(string const & str); + public slots: /// menu item has been selected void activated(int id); + /// idle timeout + void update_view_state_qt(); + protected: /// make sure we quit cleanly virtual void closeEvent(QCloseEvent * e); private: + /// focus the command buffer widget + void focus_command_widget(); + /// update status bar void update_view_state(); @@ -68,6 +80,12 @@ private: setCaption(t.c_str()); setIconText(it.c_str()); } + + /// idle timer + QTimer idle_timer_; + + /// command buffer + QCommandBuffer * commandbuffer_; }; #endif // QTVIEW_H diff --git a/src/frontends/qt2/TODO b/src/frontends/qt2/TODO index 614897804b..424e7b7bd9 100644 --- a/src/frontends/qt2/TODO +++ b/src/frontends/qt2/TODO @@ -37,6 +37,10 @@ QCitation - loop round searching not working perhaps ?? +QCommandBuffer + + - finish off, use listview etc. + QContentPane - triple click @@ -61,7 +65,7 @@ QForks QGraphics - - UI cleanups. Maybe not vital + - UI cleanups and fixes QInclude @@ -74,7 +78,6 @@ qlkey QLImage - get jpeg etc. to work - - get rotation etc. to work - get mono/color to work - get bgcolor and clipping to work @@ -88,11 +91,6 @@ QLyXKeySym - isOK() - meaningful or not ? - 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 - implement me (*) diff --git a/src/frontends/qt2/moc/Makefile.am b/src/frontends/qt2/moc/Makefile.am index 954c6eafa8..da3753fde1 100644 --- a/src/frontends/qt2/moc/Makefile.am +++ b/src/frontends/qt2/moc/Makefile.am @@ -22,6 +22,8 @@ nodist_libqt2moc_la_SOURCES = \ lengthcombo_moc.C \ qttableview_moc.C \ Toolbar_pimpl_moc.C \ + QCommandBuffer_moc.C \ + QCommandEdit_moc.C \ QContentPane_moc.C \ Qt2Base_moc.C \ QtView_moc.C \ diff --git a/src/frontends/qt2/qscreen.C b/src/frontends/qt2/qscreen.C index 3e9dbc32be..28d8589e55 100644 --- a/src/frontends/qt2/qscreen.C +++ b/src/frontends/qt2/qscreen.C @@ -24,6 +24,8 @@ #include "insets/insettext.h" #include "debug.h" +#include + using std::endl; using std::max; using std::min; @@ -57,6 +59,15 @@ QScreen::~QScreen() void QScreen::showManualCursor(LyXText const * text, int x, int y, 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 y_tmp = min(y - text->first_y + desc, owner_.height());