Angus Custom Export patch and removal of unused files from repository.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3688 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2002-03-07 15:06:57 +00:00
parent 06e5b9c0fb
commit cedd9c91a2
27 changed files with 628 additions and 724 deletions

View File

@ -1,60 +0,0 @@
2002-02-26 John Levon <moz@compsoc.man.ac.uk>
* figure_form.fd: ding dong, the witch is dead
2002-01-17 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* print_form.fd: change these radio buttons to
round3dbutton, too. One never knows ;-)
2001-07-20 Angus Leeming <a.leeming@ic.ac.uk>
* sp_form.fd: actually remove it!
* makefile: delete all reference to sp_form.*
2001-07-13 Edwin Leuven <leuven@fee.uva.nl>
* sp_form.fd: remove completely
2001-06-27 John Levon <moz@compsoc.man.ac.uk>
* sp_form.fd: remove duplicate spell options
2001-03-26 Angus Leeming <a.leeming@ic.ac.uk>
* form1.fd:
* lyx.fd: contents merged into new file figure_form.fd
* makefile: cleaned-up.
2001-03-15 John Levon <moz@compsoc.man.ac.uk>
* form1.fd: remove KeyMap and FileDlg
2001-03-13 John Levon <moz@compsoc.man.ac.uk>
* math_forms.C.patch:
* math_forms.fd: deleted
2001-03-09 John Levon <moz@compsoc.man.ac.uk>
* lyx.fd: strip external form
2001-03-05 Edwin Leuven <leuven@fee.uva.nl>
* form1.fd: search_form deleted
2001-02-26 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
* layout_forms.fd: delete
* layout_forms.h.patch: delete
* makefile: remove layout_forms.fd and layout_forms.h.patch
2001-02-20 Angus Leeming <a.leeming@ic.ac.uk>
* layout_forms.[fd,h.patch]: strip out preamble form.
2001-02-06 John Levon <moz@compsoc.man.ac.uk>
* log_form.fd: deleted

View File

@ -1,106 +0,0 @@
#! /bin/sh
if [ "$1" = "$2" ]; then
echo "Input and Output file can not be the same."
exit 1
fi
if [ -f $2 ]; then
echo "Output file already exists, overwrite?"
read
if [ "$REPLY" != "y" ]; then
exit 0
fi
fi
if [ ! -f $1 ]; then
echo "Input file does not exist, can not continue"
exit 1
fi
# If there is a patch for the outputfile patch the input file with it.
if [ -f "$2.patch" ]; then
echo "Patching $1 with $2.patch"
patch -s $1 < "$2.patch"
fi
echo "// File modified by fdfix.sh for use by lyx (with xforms > 0.88) and gettext" > $2
echo "#include <config.h>" >> $2
echo "#include \"lyx_gui_misc.h\"" >> $2
echo "#include \"gettext.h\"" >> $2
echo >> $2
# The commands to sed does this:
#
# -e 's/#include "forms\.h"/#include FORMS_H_LOCATION/'
#
# Replace "forms.h" by FORMS_H_LOCATION in #include directives. This
# macro is defined in config.h and is either <forms.h> or
# <X11/forms.h>.
#
# -e '/fl_/ s/".[^|]*"/_(&)/'
#
# For all lines containing "fl_" and a string _not_ containging |,
# replace the string with _(string)
#
# -e '/shortcut/ s/".*[|].*"/scex(_(&))/'
#
# For all lines containing "shortcut" and a string containing |, replace
# the string with scex(_(string))
#
# -e '/fl_add/ s/".*[|].*"/idex(_(&))/'
# For all lines containing "fl_add" and a string containing |, replace
# the string with idex(_(string))
#
# -e '/fl_add/ s/idex("\(.*\)").*$/&fl_set_button_shortcut(obj,"\1",1);/'
# For all lines containing "fl_add" and a string containing |, add the
# shortcut command after the end of this line
#
# -e 's/\(\(FD_[^ ]*\) \*fdui.*\)sizeof(\*fdui)/\1sizeof(\2)/'
#
# Some picky/broken compilers (eg AIX's xlC) don't like evaluating
# sizeof(*fdui) before fdui has been given a value and output a warning.
# This will not be needed anymore as soon as fdesign is fixed (already
# reported to its authors).
#
# -e 's/,\([^ ]\)/, \1/g' \
# -e 's/\("[^"][^"]*,\) \("\)/\1\2/g'
#
# Someone got busy and put spaces in after commas but didn't allow for the
# autogeneration of the files so their pretty formatting got lost. Not anymore.
# The second rule cleans up one special case where a comma appears at the end
# of a string while ensuring "...", "..." isn't affected. Update: this seems
# to have not been fixed in fdesign 0.56 (xforms 0.89), we should probably
# report it once more. (Lgb)
#
# -e 's/stdlib.h/cstdlib/'
#
# Include the right C header. Another one of those changes made by someone
# who forgot that these files are regenerated.
#
# -e '/fl_.*"[^"]*%.*"/i\
# //xgettext:no-c-format'
#
# Something else someone got busy adding only to have them removed by the
# autogeneration. Maybe someday I won't have to clean up after everyone else
# and will be able to spend my time working on what I want to work on.
#
# -e 's/NULL/0/'
#
# Hopefully the last thing that I'll ever have to merge in because in future
# everyone will do their own merging when they decide they want to modify a
# generated file.
#
cat $1 | sed \
-e 's/#include "forms\.h"/#include FORMS_H_LOCATION/' \
-e '/fl_/ s/".[^|]*"/_(&)/' \
-e '/shortcut/ s/".*[|].*"/scex(_(&))/' \
-e '/fl_add/ s/".*[|].*"/idex(_(&))/' \
-e '/fl_add/ s/idex(\(.*\)").*$/&fl_set_button_shortcut(obj,scex(\1")),1);/' \
-e 's/\(\(FD_[^ ]*\) \*fdui.*\)sizeof(\*fdui)/\1sizeof(\2)/' \
-e 's/,\([^ ]\)/, \1/g' \
-e 's/\("[^"][^"]*,\) \("\)/\1\2/g' \
-e '/fl_.*"[^"]*%.*"/i\
// xgettext:no-c-format' \
-e 's/NULL/0/' \
-e 's/stdlib.h/cstdlib/' >> $2

View File

@ -1,76 +0,0 @@
###/* This file is part of
###* ======================================================
###*
###* LyX, the High Level Word Processor
###*
###* Copyright (C) 1995-99 The LyX Team
###*
###*======================================================*/
###
###
### Makefile by Lars Gullik Bjønnes (larsbj@ifi.uio.no)
###
SHELL = /bin/sh
.SUFFIXES: .fd .c
# Various commands
FDESIGN = fdesign
SRCS = figure_form.fd print_form.fd
OBJS = figure_form.c print_form.c
COBJS = figure_form.C print_form.C
all:
@echo "This is a makefile intended for the maintainer only."
@echo "Only run it if you are absolutely sure about what you"
@echo "are doing."
c: $(OBJS)
d: c $(COBJS)
#
# -e 's/\(extern\) \(void.*FL_OBJECT\)/\1 "C" \2/'
#
# We need the callbacks to all be declared as: extern "C" void
#
# -e 's,\(generated with fdesign\)\(.*\)\(\*\*/\),\1 \3,';\
#
# Clean up the line with the date in it. This means we'll have fewer false
# updates (where the only thing that changed was the date).
#
e: c
for hfil in *.h ; do \
if [ -f "$$hfil.patch" ] ; then \
(echo "Patching $$hfil with $$hfil.patch" ; \
patch $$hfil < $$hfil.patch) \
fi; \
sed < $$hfil > $$hfil.tmp \
-e 's/\(extern\) \(void.*FL_OBJECT\)/\1 "C" \2/' \
-e 's,\(generated with fdesign\)\(.*\)\(\*\*/\),\1 \3,';\
mv $$hfil.tmp $$hfil; \
done
updatesrc: d e
@echo
@echo "Be careful with gui-indep forms. Make sure they have been">&2
@echo "removed from the files here otherwise we'll get junk code ">&2
@echo "and errors at compile time.">&2
for fil in *.C *.h ; do \
cmp -s $$fil ../src/$$fil || cp $$fil ../src ; \
done
.fd.c:
$(FDESIGN) -convert $<
.c.C:
./fdfix.sh $< $@
clean:
rm -f *.[hcC] *.bak
distclean: clean
rm -f *.orig *.rej *~

View File

@ -1,269 +0,0 @@
Magic: 13000
Internal Form Definition File
(do not change)
Number of forms: 1
Unit of measure: FL_COORD_PIXEL
=============== FORM ===============
Name: form_sendto
Width: 340
Height: 210
Number of Objects: 14
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 340 210
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
box: 10 20 310 80
boxtype: FL_NO_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_TEXT
type: NORMAL_TEXT
box: 20 10 80 20
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
style: FL_BOLD_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: File Type
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 10 130 320 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Command:|#C
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: input_cmd
callback:
argument:
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
box: 10 170 100 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: OK
shortcut: ^M
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback: SendtoOKCB
argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 120 170 100 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Apply|#A
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback: SendtoApplyCB
argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 230 170 100 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Cancel|^[
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback: SendtoCancelCB
argument: 0
--------------------
class: FL_BEGIN_GROUP
type: 0
box: 0 0 0 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: group_ftype
callback:
argument:
--------------------
class: FL_ROUND3DBUTTON
type: RADIO_BUTTON
box: 110 30 110 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: DVI|#D
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_ftype_dvi
callback:
argument:
--------------------
class: FL_ROUND3DBUTTON
type: RADIO_BUTTON
box: 110 60 110 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Postscript|#P
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_ftype_ps
callback:
argument:
--------------------
class: FL_ROUND3DBUTTON
type: RADIO_BUTTON
box: 10 60 100 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: LaTeX|#T
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_ftype_latex
callback:
argument:
value: 1
--------------------
class: FL_ROUND3DBUTTON
type: RADIO_BUTTON
box: 10 30 100 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: LyX|#L
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_ftype_lyx
callback:
argument:
--------------------
class: FL_ROUND3DBUTTON
type: RADIO_BUTTON
box: 220 30 90 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Ascii|#s
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_ftype_ascii
callback:
argument:
--------------------
class: FL_END_GROUP
type: 0
box: 0 0 0 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
==============================
create_the_forms

View File

@ -133,6 +133,8 @@ src/frontends/xforms/form_ref.C
src/frontends/xforms/FormRef.C
src/frontends/xforms/form_search.C
src/frontends/xforms/FormSearch.C
src/frontends/xforms/form_sendto.C
src/frontends/xforms/FormSendto.C
src/frontends/xforms/form_spellchecker.C
src/frontends/xforms/FormSpellchecker.C
src/frontends/xforms/form_tabular.C
@ -201,7 +203,6 @@ src/mathed/math_cursor.C
src/MenuBackend.C
src/minibuffer.C
src/paragraph.C
src/print_form.C
src/support/filetools.C
src/support/getUserName.C
src/support/path.C

View File

@ -23,7 +23,6 @@
#include "lyxtext.h"
#include "buffer.h"
#include "MenuBackend.h"
#include "lyx_gui_misc.h" // [update,Close,Redraw]AllBufferRelatedDialogs
#include "bufferview_funcs.h" // CurrentState()
#include "gettext.h"
#include "lyxfunc.h"
@ -59,10 +58,12 @@ LyXView::LyXView()
autosave_timeout = new Timeout(5000);
dialogs_ = new Dialogs(this);
#if 0
dialogs_->hideBufferDependent
.connect(SigC::slot(&CloseAllBufferRelatedDialogs));
Dialogs::redrawGUI.connect(SigC::slot(this, &LyXView::redraw));
Dialogs::redrawGUI.connect(SigC::slot(&RedrawAllBufferRelatedDialogs));
#endif
}

View File

@ -62,7 +62,6 @@ lyx_SOURCES = \
Lsstream.h \
LyXAction.C \
LyXAction.h \
LyXSendto.C \
LyXView.C \
LyXView.h \
Makefile.in \
@ -137,8 +136,6 @@ lyx_SOURCES = \
lyx_cb.h \
lyx_gui.C \
lyx_gui.h \
lyx_gui_misc.C \
lyx_gui_misc.h \
lyx_main.C \
lyx_main.h \
lyx_sty.C \
@ -184,8 +181,6 @@ lyx_SOURCES = \
paragraph.h \
paragraph_pimpl.C \
paragraph_pimpl.h \
print_form.C \
print_form.h \
screen.C \
sp_base.h \
sp_spell.C \
@ -226,7 +221,7 @@ lyx_SOURCES = \
vspace.h
lyx_main.o: lyx_main.C lyx_main.h config.h version.h lyx_gui.h \
lyx_gui_misc.h lyxrc.h support/path.h support/filetools.h \
lyxrc.h support/path.h support/filetools.h \
bufferlist.h debug.h support/FileInfo.h lastfiles.h intl.h \
lyxserver.h layout.h gettext.h kbmap.h commandtags.h language.h
$(CXXCOMPILE) -DLYX_DIR=\"$(pkgdatadir)\" \

View File

@ -151,6 +151,8 @@ public:
SigC::Signal1<void, string const &> createRef;
///
SigC::Signal0<void> showSearch;
///
SigC::Signal0<void> showSendto;
/// bring up the spellchecker
SigC::Signal0<void> showSpellchecker;
/// bring up the spellchecker tab in preferences

View File

@ -23,7 +23,6 @@
#include "buffer.h"
#include "exporter.h"
#include "converter.h"
#include "lyx_gui_misc.h"
#include "support/LAssert.h"
#include "support/lstrings.h"

View File

@ -0,0 +1,114 @@
/**
* \file ControlSendto.C
* Copyright 2002 The LyX Team.
* See the file COPYING.
*
* \author Angus Leeming, a.leeming@.ac.uk
*/
#include <config.h>
#include <fstream>
#ifdef __GNUG__
#pragma implementation
#endif
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlSendto.h"
#include "Dialogs.h"
#include "LyXView.h"
#include "BufferView.h"
#include "buffer.h"
#include "converter.h"
#include "exporter.h"
#include "gettext.h"
#include "lyxrc.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/systemcall.h"
using std::vector;
ControlSendto::ControlSendto(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d),
format_(0),
command_(lyxrc.custom_export_command)
{
d_.showSendto.connect(SigC::slot(this, &ControlSendto::show));
}
vector<Format const *> const ControlSendto::allFormats() const
{
// Well, we can start with "lyx"
vector<Format const *> lyx_formats;
lyx_formats.push_back(formats.getFormat("lyx"));
// lyx can export to latex, what formats can be reached from latex?
Formats::const_iterator it = formats.begin();
Formats::const_iterator end = formats.end();
vector<Format const *>::const_iterator lbegin = lyx_formats.begin();
for (; it != end; ++it) {
if (converters.isReachable("latex", it->name())) {
vector<Format const *>::const_iterator lend =
lyx_formats.end();
if (std::find(lbegin, lend, it) == lend)
lyx_formats.push_back(it);
}
}
return lyx_formats;
}
void ControlSendto::setFormat(Format const * fmt)
{
format_ = fmt;
}
void ControlSendto::setCommand(string const & cmd)
{
command_ = strip(frontStrip(cmd));
}
void ControlSendto::apply()
{
if (!lv_.view()->available())
return;
view().apply();
if (command_.empty() || !format_)
return;
// The name of the file created by the conversion process
string filename = lv_.buffer()->getLatexName(false);
if (!lv_.buffer()->tmppath.empty())
filename = AddName(lv_.buffer()->tmppath, filename);
filename = ChangeExtension(filename, format_->extension());
// Output to filename
if (format_->name() == "lyx") {
lv_.buffer()->writeFile(filename, true);
} else {
Exporter::Export(lv_.buffer(), format_->name(), true,
filename);
}
// Substitute $$FName for filename
string command = command_;
if (!contains(command, "$$FName"))
command = "( " + command + " ) < $$FName";
command = subst(command, "$$FName", filename);
// Execute the command in the background
Systemcall call;
call.startscript(Systemcall::DontWait, command);
}

View File

@ -0,0 +1,49 @@
// -*- C++ -*-
/**
* \file ControlSendto.h
* Copyright 2002 The LyX Team.
* See the file COPYING.
*
* \author Angus Leeming <a.leeming@ic.ac.uk>
*/
#ifndef CONTROLSENDTO_H
#define CONTROLSENDTO_H
#ifdef __GNUG__
#pragma interface
#endif
#include "ControlDialog_impl.h"
#include <vector>
class Format;
/** A controller for the Custom Export dialogs.
*/
class ControlSendto : public ControlDialogBD {
public:
///
ControlSendto(LyXView &, Dialogs &);
/// Return a vector of those formats that can be exported from "lyx".
std::vector<Format const *> const allFormats() const;
/// The format to export to
Format const * getFormat() { return format_; }
void setFormat(Format const *);
/// The command to be executed
string const getCommand() const { return command_; };
void setCommand(string const &);
private:
///
virtual void apply();
///
Format const * format_;
///
string command_;
};
#endif // CONTROLSENDTO_H

View File

@ -33,6 +33,7 @@
#include "ControlPrint.h"
#include "ControlRef.h"
#include "ControlSearch.h"
#include "ControlSendto.h"
#include "ControlShowFile.h"
#include "ControlSpellchecker.h"
#include "ControlTabularCreate.h"
@ -292,6 +293,19 @@ public:
: GUI<ControlSearch, GUIview, NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
};
/** Specialization for Sendto dialog
*/
template <class GUIview, class GUIbc>
class GUISendto :
public GUI<ControlSendto, GUIview, OkApplyCancelPolicy, GUIbc> {
public:
///
GUISendto(LyXView & lv, Dialogs & d)
: GUI<ControlSendto, GUIview, OkApplyCancelPolicy, GUIbc>(lv, d) {}
};
/** Specialization for ShowFile dialog
*/
template <class GUIview, class GUIbc>

View File

@ -69,6 +69,8 @@ libcontrollers_la_SOURCES= \
ControlRef.h \
ControlSearch.C \
ControlSearch.h \
ControlSendto.C \
ControlSendto.h \
ControlShowFile.C \
ControlShowFile.h \
ControlSpellchecker.C \

View File

@ -40,6 +40,7 @@
#include "form_print.h"
#include "form_ref.h"
#include "form_search.h"
#include "form_sendto.h"
#include "form_spellchecker.h"
#include "form_tabular_create.h"
#include "form_texinfo.h"
@ -66,6 +67,7 @@
#include "FormPrint.h"
#include "FormRef.h"
#include "FormSearch.h"
#include "FormSendto.h"
#include "FormShowFile.h"
#include "FormSpellchecker.h"
#include "FormTabularCreate.h"
@ -103,6 +105,7 @@ Dialogs::Dialogs(LyXView * lv)
add(new GUIPrint<FormPrint, xformsBC>(*lv, *this));
add(new GUIRef<FormRef, xformsBC>(*lv, *this));
add(new GUISearch<FormSearch, xformsBC>(*lv, *this));
add(new GUISendto<FormSendto, xformsBC>(*lv, *this));
add(new GUIShowFile<FormShowFile, xformsBC>(*lv, *this));
add(new GUISpellchecker<FormSpellchecker, xformsBC>(*lv, *this));
add(new GUITabularCreate<FormTabularCreate, xformsBC>(*lv, *this));

View File

@ -0,0 +1,131 @@
/*
* \file FormSendto.C
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Angus Leeming <a.leeming@ic.ac.uk>
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "FormSendto.h"
#include "form_sendto.h"
#include "ControlSendto.h"
#include "xformsBC.h"
#include "xforms_helpers.h"
#include "converter.h"
#include "gettext.h"
using std::vector;
typedef FormCB<ControlSendto, FormDB<FD_form_sendto> > base_class;
FormSendto::FormSendto(ControlSendto & c)
: base_class(c, _("Send document to command"))
{}
void FormSendto::build()
{
dialog_.reset(build_sendto());
fl_set_input_return(dialog_->input_command, FL_RETURN_CHANGED);
// The help choice
fillTooltipChoice(dialog_->choice_help);
// Set up the tooltip mechanism
setTooltipHandler(dialog_->browser_formats);
setTooltipHandler(dialog_->input_command);
// Manage the ok, apply, restore and cancel/close buttons
bc().setOK(dialog_->button_ok);
bc().setApply(dialog_->button_apply);
bc().setCancel(dialog_->button_cancel);
}
void FormSendto::update()
{
all_formats_ = controller().allFormats();
// Check whether the current contents of the browser will be
// changed by loading the contents of formats
vector<string> keys;
keys.resize(all_formats_.size());
vector<string>::iterator result = keys.begin();
vector<Format const *>::const_iterator it = all_formats_.begin();
vector<Format const *>::const_iterator end = all_formats_.end();
for (; it != end; ++it, ++result) {
*result = (*it)->prettyname();
}
vector<string> const browser_keys =
getVectorFromBrowser(dialog_->browser_formats);
if (browser_keys == keys)
return;
// Reload the browser
fl_clear_browser(dialog_->browser_formats);
for (vector<string>::const_iterator it = keys.begin();
it < keys.end(); ++it) {
fl_add_browser_line(dialog_->browser_formats, it->c_str());
}
fl_set_input(dialog_->input_command, controller().getCommand().c_str());
}
ButtonPolicy::SMInput FormSendto::input(FL_OBJECT * ob, long)
{
if (ob == dialog_->choice_help) {
setTooltipLevel(dialog_->choice_help);
return ButtonPolicy::SMI_NOOP;
}
int const line = fl_get_browser(dialog_->browser_formats);
if (line < 1 || line > fl_get_browser_maxline(dialog_->browser_formats))
return ButtonPolicy::SMI_INVALID;
string cmd = getStringFromInput(dialog_->input_command);
cmd = strip(frontStrip(cmd));
if (cmd.empty())
return ButtonPolicy::SMI_INVALID;
return ButtonPolicy::SMI_VALID;
}
void FormSendto::apply()
{
int const line = fl_get_browser(dialog_->browser_formats);
if (line < 1 || line > fl_get_browser_maxline(dialog_->browser_formats))
return;
string const cmd = getStringFromInput(dialog_->input_command);
controller().setFormat(all_formats_[line-1]);
controller().setCommand(cmd);
}
string const FormSendto::getVerboseTooltip(FL_OBJECT const * ob) const
{
string str;
if (ob == dialog_->browser_formats) {
str = N_("Export the buffer to this format before running the command below on it.");
} else if (ob == dialog_->input_command) {
str = N_("Run this command on the buffer exported to the chosen format. $$FName will be replaced by the name of this file.");
}
return str;
}

View File

@ -0,0 +1,50 @@
// -*- C++ -*-
/*
* \file FormSendto.h
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Angus Leeming <a.leeming@ic.ac.uk>
*/
#ifndef FORMSENDTO_H
#define FORMSENDTO_H
#ifdef __GNUG__
#pragma interface
#endif
#include "FormBase.h"
#include <vector>
class ControlSendto;
class Format;
struct FD_form_sendto;
/** This class provides an XForms implementation of the Custom Export Dialog.
*/
class FormSendto : public FormCB<ControlSendto, FormDB<FD_form_sendto> > {
public:
///
FormSendto(ControlSendto &);
private:
/// Apply from dialog (modify or create inset)
virtual void apply();
/// Build the dialog
virtual void build();
/// Update the dialog
virtual void update();
/// Filter the inputs on callback from xforms
virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
/// tooltips
string const getVerboseTooltip(FL_OBJECT const *) const;
/// Fdesign generated method
FD_form_sendto * build_sendto();
std::vector<Format const *> all_formats_;
};
#endif // FORMSENDTO_H

View File

@ -158,6 +158,10 @@ libxforms_la_SOURCES = \
FormSearch.h \
form_search.C \
form_search.h \
FormSendto.C \
FormSendto.h \
form_sendto.C \
form_sendto.h \
FormShowFile.C \
FormShowFile.h \
FormSpellchecker.C \

View File

@ -0,0 +1,81 @@
// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
#include <config.h>
#include "xforms_helpers.h"
#include "gettext.h"
/* Form definition file generated with fdesign. */
#include FORMS_H_LOCATION
#include <stdlib.h>
#include "form_sendto.h"
#include "FormSendto.h"
FD_form_sendto::~FD_form_sendto()
{
if ( form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_sendto * FormSendto::build_sendto()
{
FL_OBJECT *obj;
FD_form_sendto *fdui = new FD_form_sendto;
fdui->form = fl_bgn_form(FL_NO_BOX, 360, 410);
fdui->form->u_vdata = this;
obj = fl_add_box(FL_UP_BOX, 0, 0, 360, 410, "");
{
char const * const dummy = N_("Export format|#E");
fdui->browser_formats = obj = fl_add_browser(FL_HOLD_BROWSER, 15, 30, 145, 250, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
char const * const dummy = N_("Command|#C");
fdui->input_command = obj = fl_add_input(FL_NORMAL_INPUT, 10, 315, 335, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
{
char const * const dummy = N_("Help:|#H");
fdui->choice_help = obj = fl_add_choice(FL_NORMAL_CHOICE, 215, 250, 130, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 65, 370, 90, 30, _("OK"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseOKCB, 0);
{
char const * const dummy = N_("Apply|#A");
fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 160, 370, 90, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseApplyCB, 0);
{
char const * const dummy = N_("Cancel|^[");
fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 255, 370, 90, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1);
}
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseCancelCB, 0);
fl_end_form();
fdui->form->fdui = fdui;
return fdui;
}
/*---------------------------------------*/

View File

@ -0,0 +1,27 @@
// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
/** Header file generated with fdesign **/
#ifndef FD_form_sendto_h_
#define FD_form_sendto_h_
/** Callbacks, globals and object handlers **/
extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
extern "C" void C_FormBaseOKCB(FL_OBJECT *, long);
extern "C" void C_FormBaseApplyCB(FL_OBJECT *, long);
extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long);
/**** Forms and Objects ****/
struct FD_form_sendto {
~FD_form_sendto();
FL_FORM *form;
FL_OBJECT *browser_formats;
FL_OBJECT *input_command;
FL_OBJECT *choice_help;
FL_OBJECT *button_ok;
FL_OBJECT *button_apply;
FL_OBJECT *button_cancel;
};
#endif /* FD_form_sendto_h_ */

View File

@ -0,0 +1,142 @@
Magic: 13000
Internal Form Definition File
(do not change)
Number of forms: 1
Unit of measure: FL_COORD_PIXEL
=============== FORM ===============
Name: form_sendto
Width: 360
Height: 410
Number of Objects: 7
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 360 410
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label:
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name:
callback:
argument:
--------------------
class: FL_BROWSER
type: HOLD_BROWSER
box: 15 30 145 250
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Export format|#E
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NorthWest FL_SouthEast
name: browser_formats
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 10 315 335 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Command|#C
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_SouthWest FL_SouthEast
name: input_command
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 215 250 130 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Help:|#H
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: choice_help
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
box: 65 370 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: OK
shortcut: ^M
resize: FL_RESIZE_ALL
gravity: FL_SouthEast FL_SouthEast
name: button_ok
callback: C_FormBaseOKCB
argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 160 370 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Apply|#A
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_SouthEast FL_SouthEast
name: button_apply
callback: C_FormBaseApplyCB
argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 255 370 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Cancel|^[
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_SouthEast FL_SouthEast
name: button_cancel
callback: C_FormBaseCancelCB
argument: 0
==============================
create_the_forms

View File

@ -47,6 +47,7 @@ SRCS = form_aboutlyx.fd \
form_print.fd \
form_ref.fd \
form_search.fd \
form_sendto.fd \
form_spellchecker.fd \
form_tabular.fd \
form_tabular_create.fd \

View File

@ -16,7 +16,6 @@
#include "lyx_gui.h"
#include FORMS_H_LOCATION
#include "print_form.h"
#include "tex-strings.h"
#include "lyx_main.h"
#include "debug.h"
@ -27,7 +26,6 @@
#include "lyxserver.h"
#include "lyxrc.h"
#include "gettext.h"
#include "lyx_gui_misc.h"
#if FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)
#include "lyxlookup.h"
#endif
@ -46,8 +44,6 @@
using std::endl;
FD_form_sendto * fd_form_sendto;
extern LyXServer * lyxserver;
extern bool finished; // flag, that we are quitting the program
extern BufferList bufferlist;
@ -245,23 +241,8 @@ void LyXGUI::init()
fl_set_tooltip_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE);
#endif
// all lyxrc settings has to be done here as lyxrc has not yet
// been read when the GUI is created (Jug)
// the sendto form
if (!lyxrc.custom_export_command.empty())
fl_set_input(fd_form_sendto->input_cmd,
lyxrc.custom_export_command.c_str());
if (lyxrc.custom_export_format == "lyx")
fl_set_button(fd_form_sendto->radio_ftype_lyx, 1);
else if (lyxrc.custom_export_format == "tex")
fl_set_button(fd_form_sendto->radio_ftype_latex, 1);
else if (lyxrc.custom_export_format == "dvi")
fl_set_button(fd_form_sendto->radio_ftype_dvi, 1);
else if (lyxrc.custom_export_format == "ps")
fl_set_button(fd_form_sendto->radio_ftype_ps, 1);
else if (lyxrc.custom_export_format == "ascii")
fl_set_button(fd_form_sendto->radio_ftype_ascii, 1);
// all lyxrc settings has to be done here as lyxrc has not yet
// been read when the GUI is created (Jug)
// Update parameters.
lyxViews->redraw();
@ -287,10 +268,6 @@ void LyXGUI::create_forms()
// Create forms
//
// the sendto form
fd_form_sendto = create_form_form_sendto();
fl_set_form_atclose(fd_form_sendto->form_sendto, CancelCloseBoxCB, 0);
// This is probably as good a time as any to map the xform colours,
// should a mapping exist.
string const filename = AddName(user_lyxdir, "preferences.xform");

View File

@ -1,46 +0,0 @@
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
* ====================================================== */
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include FORMS_H_LOCATION
#include "lyx_gui_misc.h"
#include "print_form.h"
extern FD_form_sendto * fd_form_sendto;
// The code below is just waiting to go away really ...
// I think it is Juergen's responsibility to port print_form,
// since he wants it :)
extern "C"
int CancelCloseBoxCB(FL_FORM *, void *)
{
return FL_CANCEL;
}
void RedrawAllBufferRelatedDialogs()
{
if (fd_form_sendto->form_sendto->visible) {
fl_redraw_form(fd_form_sendto->form_sendto);
}
}
void CloseAllBufferRelatedDialogs()
{
if (fd_form_sendto->form_sendto->visible) {
fl_hide_form(fd_form_sendto->form_sendto);
}
}

View File

@ -1,34 +0,0 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 1996 Matthias Ettrich
* Copyright 1995-2001 The LyX Team
*
* ====================================================== */
// Misc. GUI specific routines
#ifndef LYX_GUI_MISC_H
#define LYX_GUI_MISC_H
#ifdef __GNUG__
#pragma interface
#endif
#include FORMS_H_LOCATION
/// Prevents LyX from being killed when the close box is pressed in a popup.
extern "C"
int CancelCloseBoxCB(FL_FORM *, void *);
/** Redraw the form (on receipt of a Signal indicating, for example,
that the xform colors have been re-mapped). */
void RedrawAllBufferRelatedDialogs();
/// Prevents LyX from crashing when no buffers available
void CloseAllBufferRelatedDialogs();
#endif

View File

@ -1118,7 +1118,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
case LFUN_EXPORT:
if (argument == "custom")
MenuSendto();
owner->getDialogs()->showSendto();//MenuSendto();
else
Exporter::Export(owner->buffer(), argument, false);
break;

View File

@ -1,69 +0,0 @@
// File modified by fdfix.sh for use by lyx (with xforms > 0.88) and gettext
#include <config.h>
#include "lyx_gui_misc.h"
#include "gettext.h"
#include "frontends/xforms/xforms_helpers.h"
/* Form definition file generated with fdesign. */
#include FORMS_H_LOCATION
#include <cstdlib>
#include "print_form.h"
FD_form_sendto *create_form_form_sendto(void)
{
FL_OBJECT *obj;
FD_form_sendto *fdui = (FD_form_sendto *) fl_calloc(1, sizeof(FD_form_sendto));
fdui->form_sendto = fl_bgn_form(FL_NO_BOX, 340, 210);
obj = fl_add_box(FL_UP_BOX, 0, 0, 340, 210, "");
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 310, 80, "");
fl_set_object_color(obj, FL_COL1, FL_COL1);
obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 80, 20, _("File Type"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
fdui->input_cmd = obj = fl_add_input(FL_NORMAL_INPUT, 10, 130, 320, 30, idex(_("Command:|#C")));fl_set_button_shortcut(obj, scex(_("Command:|#C")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
obj = fl_add_button(FL_RETURN_BUTTON, 10, 170, 100, 30, _("OK"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, SendtoOKCB, 0);
obj = fl_add_button(FL_NORMAL_BUTTON, 120, 170, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, SendtoApplyCB, 0);
obj = fl_add_button(FL_NORMAL_BUTTON, 230, 170, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, SendtoCancelCB, 0);
fdui->group_ftype = fl_bgn_group();
fdui->radio_ftype_dvi = obj = fl_add_round3dbutton(FL_RADIO_BUTTON, 110, 30, 110, 30, idex(_("DVI|#D")));fl_set_button_shortcut(obj, scex(_("DVI|#D")), 1);
fl_set_object_color(obj, FL_COL1, FL_YELLOW);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fdui->radio_ftype_ps = obj = fl_add_round3dbutton(FL_RADIO_BUTTON, 110, 60, 110, 30, idex(_("Postscript|#P")));fl_set_button_shortcut(obj, scex(_("Postscript|#P")), 1);
fl_set_object_color(obj, FL_COL1, FL_YELLOW);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fdui->radio_ftype_latex = obj = fl_add_round3dbutton(FL_RADIO_BUTTON, 10, 60, 100, 30, idex(_("LaTeX|#T")));fl_set_button_shortcut(obj, scex(_("LaTeX|#T")), 1);
fl_set_object_color(obj, FL_COL1, FL_YELLOW);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_button(obj, 1);
fdui->radio_ftype_lyx = obj = fl_add_round3dbutton(FL_RADIO_BUTTON, 10, 30, 100, 30, idex(_("LyX|#L")));fl_set_button_shortcut(obj, scex(_("LyX|#L")), 1);
fl_set_object_color(obj, FL_COL1, FL_YELLOW);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fdui->radio_ftype_ascii = obj = fl_add_round3dbutton(FL_RADIO_BUTTON, 220, 30, 90, 30, idex(_("Ascii|#s")));fl_set_button_shortcut(obj, scex(_("Ascii|#s")), 1);
fl_set_object_color(obj, FL_COL1, FL_YELLOW);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_end_group();
fl_end_form();
fdui->form_sendto->fdui = fdui;
return fdui;
}
/*---------------------------------------*/

View File

@ -1,29 +0,0 @@
/** Header file generated with fdesign **/
#ifndef FD_form_sendto_h_
#define FD_form_sendto_h_
/** Callbacks, globals and object handlers **/
extern "C" void SendtoOKCB(FL_OBJECT *, long);
extern "C" void SendtoApplyCB(FL_OBJECT *, long);
extern "C" void SendtoCancelCB(FL_OBJECT *, long);
/**** Forms and Objects ****/
typedef struct {
FL_FORM *form_sendto;
void *vdata;
char *cdata;
long ldata;
FL_OBJECT *input_cmd;
FL_OBJECT *group_ftype;
FL_OBJECT *radio_ftype_dvi;
FL_OBJECT *radio_ftype_ps;
FL_OBJECT *radio_ftype_latex;
FL_OBJECT *radio_ftype_lyx;
FL_OBJECT *radio_ftype_ascii;
} FD_form_sendto;
extern FD_form_sendto * create_form_form_sendto(void);
#endif /* FD_form_sendto_h_ */