]> git.lyx.org Git - lyx.git/commitdiff
qt command buffer stuff, some image fixes
authorJohn Levon <levon@movementarian.org>
Fri, 19 Jul 2002 23:04:55 +0000 (23:04 +0000)
committerJohn Levon <levon@movementarian.org>
Fri, 19 Jul 2002 23:04:55 +0000 (23:04 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4718 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/Makefile.am
src/frontends/qt2/QLImage.C
src/frontends/qt2/QMiniBuffer.C [deleted file]
src/frontends/qt2/QMiniBuffer.h [deleted file]
src/frontends/qt2/QWorkArea.C
src/frontends/qt2/QtView.C
src/frontends/qt2/QtView.h
src/frontends/qt2/TODO
src/frontends/qt2/moc/Makefile.am
src/frontends/qt2/qscreen.C

index 3f75f43b0a292f7d38fbd29865cb0ed3a04e49d4..cb22d895aafe1c0b81fd483a9fc148fd848dc526 100644 (file)
@@ -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>
 
        * QWorkArea.C: remove unnecessary include
index 0a33a817819f4c627869a11b0822d4eb11332854..c8b138c3bb9be23e6047d6fcdc225d99c064e743 100644 (file)
@@ -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 \
index 6b2b78124af0467ab39ef709a90530fc90c8e779..c17d1572477cff64789fd04dbd57cbb1b420c1f8 100644 (file)
@@ -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() << ", " <<xformed_pixmap_.isNull() << endl; 
+       if (xformed_pixmap_.isNull())
                return;
 
        if (params.bb.empty())
@@ -219,6 +227,7 @@ void QLImage::clip(Params const & params)
 
 void QLImage::rotate(Params const & params)
 {
+       lyxerr << "rotate isNull " << pixmap_.isNull() << ", " <<xformed_pixmap_.isNull() << endl; 
        if (xformed_pixmap_.isNull())
                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
        // degree units.
 
+       lyxerr[Debug::GRAPHICS] << "rotating image by " << params.angle << " degrees" << endl;
        QWMatrix m;
-       m.rotate(params.angle / 10.0);
-       xformed_pixmap_.xForm(m);
+       m.rotate(params.angle);
+       xformed_pixmap_ = xformed_pixmap_.xForm(m);
 }
 
 
 void QLImage::scale(Params const & params)
 {
+       lyxerr << "scale isNull " << pixmap_.isNull() << ", " <<xformed_pixmap_.isNull() << endl; 
        if (xformed_pixmap_.isNull())
                return;
 
@@ -246,7 +258,12 @@ void QLImage::scale(Params const & params)
        if (width == getWidth() && height == getHeight())
                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
diff --git a/src/frontends/qt2/QMiniBuffer.C b/src/frontends/qt2/QMiniBuffer.C
deleted file mode 100644 (file)
index 15adc15..0000000
+++ /dev/null
@@ -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 &)
-{
-}
diff --git a/src/frontends/qt2/QMiniBuffer.h b/src/frontends/qt2/QMiniBuffer.h
deleted file mode 100644 (file)
index b4a0fe2..0000000
+++ /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 <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
index 37a83d54a83af3150d1b05d0b61f8108a32af91c..cb1aef11ec6fcb77471980595d0bf6aed48a626b 100644 (file)
@@ -45,6 +45,8 @@ QWorkArea::QWorkArea(int, int, int, int)
 
        (static_cast<QMainWindow*>(qApp->mainWidget()))->setCentralWidget(this);
  
+       setFocusProxy(content_);
        content_->show();
 
        content_->setBackgroundColor(lcolor.getX11Name(LColor::background).c_str());
index 975ba9b3f3852665cfe138de9ce30bf80677e75b..06786a16eda74ea215f66cc36e0cedf4728038cf 100644 (file)
@@ -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"
 #include "frontends/Dialogs.h"
 #include "frontends/Timeout.h"
  
+#include <boost/bind.hpp>
 #include "QtView.h"
 #include "qfont_loader.h"
+#include "QCommandBuffer.h"
  
 #include <qapplication.h>
 #include <qpixmap.h>
 #include <qmenubar.h>
 #include <qstatusbar.h>
  
-#include <boost/bind.hpp>
 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()));
 }
 
  
index 247bed896a2960d9117721bd63d33a0750ade8e4..8b07c4cb3fd0658d89c544790ff44a7bff013254 100644 (file)
@@ -20,6 +20,9 @@
 #include "frontends/LyXView.h"
  
 #include <qmainwindow.h>
+#include <qtimer.h>
+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
index 614897804b5c2f22f2df357b0bda2daa47e7564a..424e7b7bd9fa457b85d0af2fd4934e8970aa0335 100644 (file)
@@ -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 (*)
index 954c6eafa8aab265abf3f06f93f14d556e1ad9e1..da3753fde18adb63d91ea0a6755bfb6a224443a8 100644 (file)
@@ -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 \
index 3e9dbc32be7741505aa88ba403674b2942a747d5..28d8589e550da3a63d055db51ebd0cafe0267409 100644 (file)
@@ -24,6 +24,8 @@
 #include "insets/insettext.h"
 #include "debug.h"
 
+#include <qapplication.h>
 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());