fix up build (also need patch sent to list), bring back doc/par dialogs,

add alert_pimpl


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3634 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-03-01 18:47:56 +00:00
parent 8fc0d78659
commit a032e389e3
12 changed files with 390 additions and 61 deletions

View File

@ -0,0 +1,66 @@
/**
* \file Alert_pimpl.C
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#include <config.h>
#include <qmessagebox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include "ui/QAskForTextDialog.h"
#include FORMS_H_LOCATION
#include <algorithm>
#include <gettext.h>
#include "Alert.h"
#include "Alert_pimpl.h"
#include "xforms_helpers.h"
using std::pair;
using std::make_pair;
void alert_pimpl(string const & s1, string const & s2, string const & s3)
{
QMessageBox::warning(0, "LyX", (s1 + "\n" + "\n" + s2 + "\n" + s3).c_str());
}
bool askQuestion_pimpl(string const & s1, string const & s2, string const & s3)
{
return !(QMessageBox::information(0, "LyX", (s1 + "\n" + s2 + "\n" + s3).c_str(),
_("&Yes"), _("&No"), 0, 1));
}
int askConfirmation_pimpl(string const & s1, string const & s2, string const & s3)
{
return (QMessageBox::information(0, "LyX", (s1 + "\n" + s2 + "\n" + s3).c_str(),
_("&Yes"), _("&No"), _("&Cancel"), 0, 2)) + 1;
}
pair<bool, string> const askForText_pimpl(string const & msg, string const & dflt)
{
string title = _("LyX: ");
title += msg;
QAskForTextDialog d(0, msg.c_str(), true);
// less than ideal !
d.askLA->setText((string("&") + msg).c_str());
d.askLE->setText(dflt.c_str());
int ret = d.exec();
d.hide();
if (ret)
return make_pair<bool, string>(true, d.askLE->text().latin1());
else
return make_pair<bool, string>(false, string());
}

View File

@ -1,12 +1,19 @@
2002-02-18 John Levon <moz@compsoc.man.ac.uk>
2002-03-01 John Levon <moz@compsoc.man.ac.uk>
* Makefile.am:
* moc/Makefile.am:
* ui/Makefile.am:
* ui/moc/Makefile.am: use .o for libs
* ui/moc/Makefile.am: fix compile
* xforms/: compile the necessary files via symlinks
* QPreambleDialog.C: new systemcall interface
* Timeout_pimpl.h:
* Timeout_pimpl.C: add running()
* Dialogs.C: add init graphics, and doc/par xforms forms
2002-02-06 John Levon <moz@compsoc.man.ac.uk>
* QToc.C: fix crash

View File

@ -73,13 +73,15 @@
#include "Qt2BC.h"
// xforms stuff
//#include "xforms/FormDocument.h"
#include "xforms/FormDocument.h"
#include "xforms/FormMathsPanel.h"
//#include "xforms/FormParagraph.h"
#include "xforms/FormParagraph.h"
#include "xforms/FormPreferences.h"
#include "xforms/FormShowFile.h"
#include "xforms/FormTabular.h"
#include "graphics/GraphicsImageXPM.h"
#include "GUI.h"
// this makes no real sense for Qt2
@ -117,9 +119,9 @@ Dialogs::Dialogs(LyXView * lv)
add(new GUIVCLog<QVCLog, Qt2BC>(*lv, *this));
// dialogs not yet MVCd
// add(new FormDocument(lv, this));
add(new FormDocument(lv, this));
add(new FormMathsPanel(lv, this));
// add(new FormParagraph(lv, this));
add(new FormParagraph(lv, this));
add(new FormPreferences(lv, this));
add(new FormTabular(lv, this));
@ -127,3 +129,16 @@ Dialogs::Dialogs(LyXView * lv)
// dialogs by a simple connection here.
hideAll.connect(hideBufferDependent.slot());
}
// Called bu the graphics cache to connect the approriate frontend
// image loading routines to the LyX kernel.
void Dialogs::initialiseGraphics()
{
using namespace grfx;
using SigC::slot;
// connect the image loader based on the XPM library
GImage::newImage.connect(slot(&GImageXPM::newImage));
GImage::loadableFormats.connect(slot(&GImageXPM::loadableFormats));
}

View File

@ -2,9 +2,9 @@ AUTOMAKE_OPTIONS = foreign 1.4
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
noinst_LTLIBRARIES = libqt2.la
BOOST_INCLUDES = -I$(top_srcdir)/boost
SUBDIRS=ui moc
SUBDIRS=xforms ui moc
INCLUDES = -I${top_srcdir}/src/ -I${top_srcdir}/src/frontends/ \
${SIGC_CFLAGS} ${FRONTEND_INCLUDES} $(BOOST_INCLUDES) \
${SIGC_CFLAGS} -I$(top_srcdir)/images ${FRONTEND_INCLUDES} $(BOOST_INCLUDES) \
-I$(top_srcdir)/src/frontends/controllers
AM_CXXFLAGS = -DQT_CLEAN_NAMESPACE -DQT_GENUINE_STR
@ -15,14 +15,18 @@ ETAGS_ARGS = --lang=c++
include Makefile.dialogs
ETAGS_ARGS = --lang=c++
libqt2_la_LIBADD = \
ui/libqt2ui.o \
moc/libqt2moc.o \
ui/moc/libqt2uimoc.o \
xforms/libqt2xforms.la \
ui/libqt2ui.la \
moc/libqt2moc.la \
ui/moc/libqt2uimoc.la \
@LYX_LIBS@ @FRONTEND_LDFLAGS@ @FRONTEND_LIBS@
libqt2_la_SOURCES = \
$(DIALOGSOURCES) \
Alert_pimpl.C \
Dialogs.C \
GUIRunTime.C \
FileDialog.C \
@ -40,41 +44,4 @@ libqt2_la_SOURCES = \
qttableview.h \
qttableview.C
xforms_objects = \
../xforms/combox.o \
../xforms/Alert_pimpl.o \
../xforms/Color.o \
../xforms/DropDown.o \
../xforms/FormBase.o \
../xforms/FormBaseDeprecated.o \
../xforms/FormMathsBitmap.o \
../xforms/FormMathsDeco.o \
../xforms/FormMathsDelim.o \
../xforms/FormMathsMatrix.o \
../xforms/FormMathsPanel.o \
../xforms/FormMathsStyle.o \
../xforms/FormMathsSpace.o \
../xforms/FormPreferences.o \
../xforms/FormTabular.o \
../xforms/FormInset.o \
../xforms/MathsSymbols.o \
../xforms/Menubar_pimpl.o \
../xforms/RadioButtonGroup.o \
../xforms/Toolbar_pimpl.o \
../xforms/bmtable.o \
../xforms/form_preferences.o \
../xforms/form_tabular.o \
../xforms/form_maths_deco.o \
../xforms/form_maths_delim.o \
../xforms/form_maths_matrix.o \
../xforms/form_maths_panel.o \
../xforms/form_maths_space.o \
../xforms/form_maths_style.o \
../xforms/input_validators.o \
../xforms/xformsBC.o \
../xforms/xforms_helpers.o
libqt2.la: xforms.lo $(libqt2_la_OBJECTS) $(libqt2_la_DEPENDENCIES)
xforms.lo: $(xforms_objects)
$(CXXLINK) $(xforms_objects)
libqt2.la: $(libqt2_la_OBJECTS) $(libqt2_la_DEPENDENCIES)

View File

@ -2,6 +2,7 @@
DIALOGS = \
QAbout \
QAskForText \
QBibitem \
QBibtex \
QCharacter \
@ -113,6 +114,8 @@ MOCDIALOGS = \
UIDIALOGS = \
QAboutDialogBase.h \
QAboutDialogBase.C \
QAskForTextDialog.h \
QAskForTextDialog.C \
QBibitemDialogBase.h \
QBibitemDialogBase.C \
QBibtexDialogBase.h \
@ -166,6 +169,7 @@ UIDIALOGS = \
UIMOCDIALOGS = \
QAboutDialogBase_moc.C \
QAskForTextDialog_moc.C \
QBibitemDialogBase_moc.C \
QBibtexDialogBase_moc.C \
QCharacterDialogBase_moc.C \
@ -191,9 +195,3 @@ UIMOCDIALOGS = \
QTocDialogBase_moc.C \
QURLDialogBase_moc.C \
QVCLogDialogBase_moc.C

View File

@ -18,7 +18,7 @@
#include "QPreamble.h"
#include "support/lyxlib.h"
#include "support/syscall.h"
#include "support/forkedcall.h"
#include "support/filetools.h"
#include "gettext.h"
@ -81,10 +81,10 @@ void QPreambleDialog::editClicked()
editor += " " + filename;
Systemcalls sys;
Forkedcall call;
// FIXME: synchronous, ugh. Make async when moved to controllers ?
if (sys.startscript(Systemcalls::Wait, editor)) {
// FIXME: make async
if (call.startscript(Forkedcall::Wait, editor)) {
lyx::unlink(filename);
return;
}

View File

@ -36,9 +36,15 @@ void Timeout::Pimpl::reset()
}
bool Timeout::Pimpl::running() const
{
return timeout_id != -1;
}
void Timeout::Pimpl::start()
{
if (timeout_id != -1)
if (running())
lyxerr << "Timeout::start: already running!" << endl;
timeout_id = startTimer(owner_->timeout_ms);
}
@ -46,6 +52,6 @@ void Timeout::Pimpl::start()
void Timeout::Pimpl::stop()
{
if (timeout_id != -1)
if (running())
reset();
}

View File

@ -36,6 +36,8 @@ public:
void stop();
/// reset
void reset();
/// is the timer running ?
bool running() const;
protected:
/// slot

View File

@ -22,6 +22,12 @@ libqt2ui.la: $(libqt2ui_la_OBJECTS) $(libqt2ui_la_DEPENDENCIES)
SED=sed
SEDREPLACETR=s,[^A-Za-z]tr[ ]*(,_(,g
SEDREMOVEEMPTY=s,_[ ]*([ ]*""[ ]*),"",g
QAskForTextDialog.h: QAskForTextDialog.ui
$(UIC) $< -o $@
QAskForTextDialog.C: QAskForTextDialog.h QAskForTextDialog.ui
$(UIC) -impl $^ | $(SED) '$(SEDREPLACETR);$(SEDREMOVEEMPTY)' > $@
%Base.h: %.ui
$(UIC) $< -o $@
%Base.C: %Base.h %.ui

View File

@ -0,0 +1,160 @@
<!DOCTYPE UI><UI>
<class>QAskForTextDialog</class>
<include location="global">config.h</include>
<include location="local">gettext.h</include>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>QAskForTextDialog</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>277</width>
<height>116</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>LyX: Enter text</string>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<spacer>
<property>
<name>name</name>
<cstring>Spacer5</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>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>askLA</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Dummy</string>
</property>
<property>
<name>buddy</name>
<cstring>askLE</cstring>
</property>
</widget>
<widget>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>askLE</cstring>
</property>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer6</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>Layout2</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>okPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>OK</string>
</property>
<property stdset="1">
<name>default</name>
<bool>true</bool>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>cancelPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Cancel</string>
</property>
<property stdset="1">
<name>default</name>
<bool>false</bool>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
<connections>
<connection>
<sender>okPB</sender>
<signal>clicked()</signal>
<receiver>QAskForTextDialog</receiver>
<slot>accept()</slot>
</connection>
<connection>
<sender>cancelPB</sender>
<signal>clicked()</signal>
<receiver>QAskForTextDialog</receiver>
<slot>reject()</slot>
</connection>
</connections>
</UI>

View File

@ -0,0 +1,8 @@
Makefile.in
Makefile
*.deps
*.lo
.libs
libqt2.la
moc_*.C
*_moc.C

View File

@ -0,0 +1,94 @@
AUTOMAKE_OPTIONS = foreign 1.4
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
noinst_LTLIBRARIES = libqt2xforms.la
BOOST_INCLUDES = -I$(top_srcdir)/boost
INCLUDES = -I${top_srcdir}/src/ -I${top_srcdir}/src/frontends/ \
${SIGC_CFLAGS} -I$(top_srcdir)/images ${FRONTEND_INCLUDES} $(BOOST_INCLUDES) \
-I$(top_srcdir)/src/frontends/controllers
DISTCLEANFILES = $(XFORMS_SOURCES) $(BUILTSOURCES) *.orig *.rej *~ *.bak core
LIBS=
ETAGS_ARGS = --lang=c++
XFORMS_SOURCES = \
bmtable.h \
bmtable.c \
combox.h \
combox.C \
Color.h \
Color.C \
DropDown.h \
DropDown.C \
FormBase.h \
FormBase.C \
FormBaseDeprecated.h \
FormBaseDeprecated.C \
FormDocument.h \
FormDocument.C \
FormParagraph.h \
FormParagraph.C \
FormMathsBitmap.h \
FormMathsBitmap.C \
FormMathsDeco.h \
FormMathsDeco.C \
FormMathsDelim.h \
FormMathsDelim.C \
FormMathsMatrix.h \
FormMathsMatrix.C \
FormMathsPanel.h \
FormMathsPanel.C \
FormMathsStyle.h \
FormMathsStyle.C \
FormMathsSpace.h \
FormMathsSpace.C \
FormPreferences.h \
FormPreferences.C \
FormTabular.h \
FormTabular.C \
FormInset.h \
FormInset.C \
MathsSymbols.h \
MathsSymbols.C \
Menubar_pimpl.h \
Menubar_pimpl.C \
RadioButtonGroup.h \
RadioButtonGroup.C \
Toolbar_pimpl.h \
Toolbar_pimpl.C \
Tooltips.h \
Tooltips.C \
form_document.h \
form_document.C \
form_paragraph.h \
form_paragraph.C \
form_preferences.h \
form_preferences.C \
form_tabular.h \
form_tabular.C \
form_maths_deco.h \
form_maths_deco.C \
form_maths_delim.h \
form_maths_delim.C \
form_maths_matrix.h \
form_maths_matrix.C \
form_maths_panel.h \
form_maths_panel.C \
form_maths_space.h \
form_maths_space.C \
form_maths_style.h \
form_maths_style.C \
input_validators.h \
input_validators.C \
xformsBC.h \
xformsBC.C \
xforms_helpers.h \
xforms_helpers.C
$(XFORMS_SOURCES):
for i in $(XFORMS_SOURCES); do ln -sf "${top_srcdir}/src/frontends/xforms/$$i" . ; done
ETAGS_ARGS = --lang=c++
libqt2xforms_la_SOURCES = \
$(XFORMS_SOURCES)