+2002-09-28 Juergen Spitzmueller <j.spitzmueller@gmx.de>
+
+ * ui/QWrapDialog.ui:
+ * QWrapDialog.[Ch]:
+ * QWrap.[Ch]:
+ * Makefile.dialogs:
+ * Dialogs.C:
+ * Dialogs2.C:
+ * Dialogs_impl.h: Implement Wrap figure dialog
+
2002-09-25 Angus Leeming <leeming@lyx.org>
* Dialogs2.C:
toc(lv, d),
url(lv, d),
- vclogfile(lv, d)
+ vclogfile(lv, d),
+ wrap(lv, d)
{}
}
-void Dialogs::showWrap(InsetWrap * i)
+void Dialogs::showWrap(InsetWrap * iw)
{
- // FIXME
-}
+ pimpl_->wrap.controller().showInset(iw);
+}
#include "QURLDialog.h"
#include "QVCLog.h"
#include "QVCLogDialog.h"
+#include "QWrap.h"
+#include "QWrapDialog.h"
#include "Qt2BC.h"
typedef GUI<ControlVCLog, QVCLog, OkCancelPolicy, Qt2BC>
VCLogFileDialog;
+typedef GUI<ControlWrap, QWrap, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
+WrapDialog;
+
struct Dialogs::Impl {
Impl(LyXView & lv, Dialogs & d);
TocDialog toc;
UrlDialog url;
VCLogFileDialog vclogfile;
+ WrapDialog wrap;
};
#endif // DIALOGS_IMPL_H
QThesaurus \
QToc \
QURL \
- QVCLog
+ QVCLog \
+ QWrap
DIALOGSOURCES = \
QAbout.h QAboutDialog.h \
QURL.h QURLDialog.h \
QURL.C QURLDialog.C \
QVCLog.h QVCLogDialog.h \
- QVCLog.C QVCLogDialog.C
+ QVCLog.C QVCLogDialog.C \
+ QWrap.h QWrapDialog.h \
+ QWrap.C QWrapDialog.C
MOCDIALOGS = \
QAboutDialog_moc.C \
QThesaurusDialog_moc.C \
QTocDialog_moc.C \
QURLDialog_moc.C \
- QVCLogDialog_moc.C
+ QVCLogDialog_moc.C \
+ QWrapDialog_moc.C
UIDIALOGS = \
QAboutDialogBase.h \
QURLDialogBase.h \
QURLDialogBase.C \
QVCLogDialogBase.h \
- QVCLogDialogBase.C
+ QVCLogDialogBase.C \
+ QWrapDialogBase.h \
+ QWrapDialogBase.C
UIMOCDIALOGS = \
QAboutDialogBase_moc.C \
QThesaurusDialogBase_moc.C \
QTocDialogBase_moc.C \
QURLDialogBase_moc.C \
- QVCLogDialogBase_moc.C
+ QVCLogDialogBase_moc.C \
+ QWrapDialogBase_moc.C
--- /dev/null
+/**
+ * \file QWrap.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Juergen Spitzmueller
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "debug.h"
+#include "gettext.h"
+#include "support/lstrings.h"
+#include "LyXView.h"
+#include "ControlWrap.h"
+
+#include "QWrap.h"
+#include "QWrapDialog.h"
+#include "Qt2BC.h"
+#include "lengthcombo.h"
+
+#include <qpushbutton.h>
+#include <qcombobox.h>
+#include <qlineedit.h>
+
+typedef Qt2CB<ControlWrap, Qt2DB<QWrapDialog> > base_class;
+
+QWrap::QWrap()
+ : base_class(_("Wrap Options"))
+{
+}
+
+
+void QWrap::build_dialog()
+{
+ dialog_.reset(new QWrapDialog(this));
+
+ bc().setRestore(dialog_->restorePB);
+ bc().setOK(dialog_->okPB);
+ bc().setApply(dialog_->applyPB);
+ bc().setCancel(dialog_->closePB);
+
+ bc().addReadOnly(dialog_->widthED);
+ bc().addReadOnly(dialog_->unitsLC);
+ bc().addReadOnly(dialog_->valignCO);
+}
+
+
+void QWrap::apply()
+{
+ double const value = strToDbl(dialog_->widthED->text().latin1());
+ LyXLength::UNIT unit = dialog_->unitsLC->currentLengthItem();
+ if (string(dialog_->widthED->text().latin1()).empty())
+ unit = LyXLength::UNIT_NONE;
+
+ controller().params().pageWidth = LyXLength(value, unit);
+
+ switch (dialog_->valignCO->currentItem()) {
+ case 0:
+ controller().params().placement.erase();
+ break;
+ case 1:
+ controller().params().placement = "l";
+ break;
+ case 2:
+ controller().params().placement = "r";
+ break;
+ case 3:
+ controller().params().placement = "p";
+ break;
+ }
+}
+
+
+namespace {
+ string const numtostr(double val) {
+ string a(tostr(val));
+ if (a == "0")
+ a = "";
+ return a;
+ }
+} // namespace anon
+
+
+void QWrap::update_contents()
+{
+ LyXLength len(controller().params().pageWidth);
+ dialog_->widthED->setText(numtostr(len.value()).c_str());
+ dialog_->unitsLC->setCurrentItem(len.unit());
+
+ int item = 0;
+ if (controller().params().placement == "l")
+ item = 1;
+ else if (controller().params().placement == "r")
+ item = 2;
+ else if (controller().params().placement == "p")
+ item = 3;
+
+ dialog_->valignCO->setCurrentItem(item);
+}
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file QWrap.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Juergen Spitzmueller
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#ifndef QWRAP_H
+#define QWRAP_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "Qt2Base.h"
+
+class ControlWrap;
+class QWrapDialog;
+
+
+class QWrap
+ : public Qt2CB<ControlWrap, Qt2DB<QWrapDialog> >
+{
+public:
+
+ friend class QWrapDialog;
+
+ QWrap();
+
+private:
+ /// Apply changes
+ virtual void apply();
+ /// update
+ virtual void update_contents();
+ /// build the dialog
+ virtual void build_dialog();
+};
+
+#endif // QWRAP_H
--- /dev/null
+/**
+ * \file QWrapDialog.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Juergen Spitzmueller
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <vector>
+
+#include "ControlWrap.h"
+
+#include "QWrap.h"
+#include "QWrapDialog.h"
+
+#include <qpushbutton.h>
+#include <qtextview.h>
+#include "lengthcombo.h"
+
+QWrapDialog::QWrapDialog(QWrap * form)
+ : QWrapDialogBase(0, 0, false, 0),
+ form_(form)
+{
+ connect(restorePB, SIGNAL(clicked()),
+ form, SLOT(slotRestore()));
+ connect(okPB, SIGNAL(clicked()),
+ form, SLOT(slotOK()));
+ connect(applyPB, SIGNAL(clicked()),
+ form, SLOT(slotApply()));
+ connect(closePB, SIGNAL(clicked()),
+ form, SLOT(slotClose()));
+}
+
+
+void QWrapDialog::closeEvent(QCloseEvent * e)
+{
+ form_->slotWMHide();
+ e->accept();
+}
+
+
+void QWrapDialog::change_adaptor()
+{
+ form_->changed();
+}
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file QWrapDialog.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Juergen Spitzmueller
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#ifndef QWRAPDIALOG_H
+#define QWRAPDIALOG_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "ui/QWrapDialogBase.h"
+
+class QWrap;
+
+class QWrapDialog : public QWrapDialogBase
+{ Q_OBJECT
+
+public:
+ QWrapDialog(QWrap * form);
+
+protected slots:
+ virtual void change_adaptor();
+
+protected:
+ virtual void closeEvent(QCloseEvent * e);
+
+private:
+ QWrap * form_;
+};
+
+#endif // QWRAPDIALOG_H
--- /dev/null
+<!DOCTYPE UI><UI>
+<class>QWrapDialogBase</class>
+<include location="global">config.h</include>
+<include location="local">gettext.h</include>
+<include location="local">vspace.h</include>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>QWrapDialogBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>369</width>
+ <height>111</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Wrap Options</string>
+ </property>
+ <property stdset="1">
+ <name>sizeGripEnabled</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout3</cstring>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>widthLA</cstring>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>MShape</enum>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>MShadow</enum>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Width:</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>widthED</cstring>
+ </property>
+ </widget>
+ <widget row="1" column="2" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Default (outer)</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Left</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Right</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Outer</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>valignCO</cstring>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Vertical alignment</string>
+ </property>
+ </widget>
+ <widget row="0" column="2" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>valignLA</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Placement:</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>valignCO</cstring>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>LengthCombo</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>unitsLC</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>minimumSize</name>
+ <size>
+ <width>40</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>focusPolicy</name>
+ <enum>StrongFocus</enum>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Units of width value</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>widthED</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Width value</string>
+ </property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>unitsLA</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Units:</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>unitsLC</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout17</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>restorePB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Restore</string>
+ </property>
+ <property stdset="1">
+ <name>default</name>
+ <bool>false</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string></string>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer1</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>okPB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&OK</string>
+ </property>
+ <property stdset="1">
+ <name>default</name>
+ <bool>false</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string></string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>applyPB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Apply</string>
+ </property>
+ <property stdset="1">
+ <name>default</name>
+ <bool>false</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string></string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>closePB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Close</string>
+ </property>
+ <property stdset="1">
+ <name>default</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>LengthCombo</class>
+ <header location="local">lengthcombo.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ <signal>selectionChanged(LyXLength::UNIT)</signal>
+ </customwidget>
+</customwidgets>
+<images>
+ <image>
+ <name>image0</name>
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>widthED</sender>
+ <signal>textChanged(const QString&)</signal>
+ <receiver>QWrapDialogBase</receiver>
+ <slot>change_adaptor()</slot>
+ </connection>
+ <connection>
+ <sender>unitsLC</sender>
+ <signal>selectionChanged(LyXLength::UNIT)</signal>
+ <receiver>QWrapDialogBase</receiver>
+ <slot>change_adaptor()</slot>
+ </connection>
+ <connection>
+ <sender>valignCO</sender>
+ <signal>highlighted(const QString&)</signal>
+ <receiver>QWrapDialogBase</receiver>
+ <slot>change_adaptor()</slot>
+ </connection>
+ <slot access="public">change_adaptor()</slot>
+</connections>
+<tabstops>
+ <tabstop>widthED</tabstop>
+ <tabstop>unitsLC</tabstop>
+ <tabstop>valignCO</tabstop>
+ <tabstop>restorePB</tabstop>
+ <tabstop>applyPB</tabstop>
+ <tabstop>okPB</tabstop>
+ <tabstop>closePB</tabstop>
+</tabstops>
+</UI>