Changed KDE FormIndex to use qtarch generated dialog, added FromParagraph

in the GUII xforms tree, small memory leak fix.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1038 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2000-09-25 15:59:27 +00:00
parent 1d37337a2e
commit e1cd54a1a2
22 changed files with 2693 additions and 146 deletions

View File

@ -1,5 +1,28 @@
2000-09-25 Juergen Vigna <jug@sad.it>
* src/frontends/kde/Dialogs.C (Dialogs):
* src/frontends/gnome/Dialogs.C (Dialogs):
* src/frontends/kde/Makefile.am:
* src/frontends/gnome/Makefile.am: added FormParagraph from xforms.
* src/frontends/xforms/forms/makefile: added form_paragraph.fd.
* src/frontends/xforms/Dialogs.C (Dialogs): added FormParagraph.
* src/frontends/xforms/Makefile.am: added files for FormParagraph.
* src/frontends/xforms/FormParagraph.C:
* src/frontends/xforms/FormParagraph.h:
* src/frontends/xforms/form_paragraph.C:
* src/frontends/xforms/form_paragraph.h:
* src/frontends/xforms/forms/form_paragraph.fd: new files for the new
paragraph layout.
* src/lyxfunc.C (Dispatch): call the new layout paragraph.
* src/tabular.C (OldFormatRead): forgot to delete the temporary
Paragraph-Data after use.
* src/insets/insettext.C (LocalDispatch): don't set the layout on
non breakable paragraphs.

View File

@ -106,9 +106,9 @@ public:
///
Signal0<void> showLayoutDocument;
///
Signal0<void> showLogFile;
Signal0<void> showLayoutParagraph;
///
Signal0<void> showParagraph;
Signal0<void> showLogFile;
///
Signal0<void> showPreamble;
///

View File

@ -8,6 +8,7 @@
#include "FormError.h"
#include "FormGraphics.h"
#include "FormIndex.h"
#include "FormParagraph.h"
#include "FormPreferences.h"
#include "FormPrint.h"
#include "FormRef.h"
@ -32,6 +33,7 @@ Dialogs::Dialogs(LyXView * lv)
dialogs_.push_back(new FormGraphics(lv, this));
dialogs_.push_back(new FormIndex(lv, this));
dialogs_.push_back(new FormPreferences(lv, this));
dialogs_.push_back(new FormParagraph(lv, this));
dialogs_.push_back(new FormPrint(lv, this));
dialogs_.push_back(new FormRef(lv, this));
dialogs_.push_back(new FormTabular(lv, this));

View File

@ -18,6 +18,8 @@ libgnome_la_OBJADD = \
../xforms/form_graphics.lo \
../xforms/FormIndex.lo \
../xforms/form_index.lo \
../xforms/FormParagraph.lo \
../xforms/form_paragraph.lo \
../xforms/FormPreferences.lo \
../xforms/form_preferences.lo \
../xforms/FormRef.lo \

View File

@ -8,6 +8,7 @@
#include "FormError.h"
#include "FormGraphics.h"
#include "FormIndex.h"
#include "FormParagraph.h"
#include "FormPreferences.h"
#include "FormPrint.h"
#include "FormRef.h"
@ -31,6 +32,7 @@ Dialogs::Dialogs(LyXView * lv)
dialogs_.push_back(new FormError(lv, this));
dialogs_.push_back(new FormGraphics(lv, this));
dialogs_.push_back(new FormIndex(lv, this));
dialogs_.push_back(new FormParagraph(lv, this));
dialogs_.push_back(new FormPreferences(lv, this));
dialogs_.push_back(new FormPrint(lv, this));
dialogs_.push_back(new FormRef(lv, this));

View File

@ -65,18 +65,8 @@ void FormIndex::createIndex(string const & arg)
void FormIndex::update()
{
dialog_->index->setText(params.getContents().c_str());
if (readonly) {
dialog_->index->setFocusPolicy(QWidget::NoFocus);
dialog_->buttonOk->setEnabled(false);
dialog_->buttonCancel->setText(_("Close"));
} else {
dialog_->index->setFocusPolicy(QWidget::StrongFocus);
dialog_->index->setFocus();
dialog_->buttonOk->setEnabled(true);
dialog_->buttonCancel->setText(_("Cancel"));
}
dialog_->setIndexText(params.getContents().c_str());
// dialog_->setReadOnly(readonly);
}
void FormIndex::apply()
@ -84,7 +74,7 @@ void FormIndex::apply()
if (readonly)
return;
params.setContents(dialog_->index->text());
params.setContents(dialog_->getIndexText());
if (inset_ != 0) {
if (params != inset_->params()) {
@ -98,7 +88,11 @@ void FormIndex::apply()
void FormIndex::show()
{
if (!dialog_)
#if 1
dialog_ = new FormIndexDialog(this, 0, _("LyX: Index"));
#else
dialog_ = new FormIndexDialog(this, 0, _("LyX: Index"), false);
#endif
if (!dialog_->isVisible()) {
h_ = d_->hideBufferDependent.connect(slot(this, &FormIndex::hide));

View File

@ -24,6 +24,8 @@ libkde_la_OBJADD = \
../xforms/form_error.lo \
../xforms/FormGraphics.lo \
../xforms/form_graphics.lo \
../xforms/FormParagraph.lo \
../xforms/form_paragraph.lo \
../xforms/FormPreferences.lo \
../xforms/form_preferences.lo \
../xforms/FormPrint.lo \
@ -56,6 +58,8 @@ libkde_la_SOURCES = \
FormIndex.h \
formindexdialog.C \
formindexdialog.h \
formindexdialogdata.C \
formindexdialogdata.h \
FormCitation.C \
FormCitation.h \
formcitationdialog.C \

View File

@ -0,0 +1,170 @@
DlgEdit:v1.2:Dialog:
Dialog {
ClassHeader {formindexdialog.h}
ClassSource {formindexdialog.C}
ClassName {FormIndexDialog}
DataHeader {formindexdialogdata.h}
DataSource {formindexdialogdata.C}
DataName {FormIndexDialogData}
WindowBaseClass {QWidget}
WindowFlags {53248}
}
WidgetLayout {
InitialPos {-1 -1}
Size {200 65}
MinSize {200 65}
MaxSize {32767 65}
Grid {5}
Label {
Text {Keyword:}
Alignment {289}
AutoResize {FALSE}
Margin {-1}
Style {0}
LineWidth {1}
MidLineWidth {0}
FrameMargin {0}
Rect {5 5 60 25}
Name {Label_1}
Variable {labelindex}
MinimumSize {60 25}
MaximumSize {60 25}
BackgroundPixmap {}
UseBackgroundPixmap {FALSE}
AdjustSize {FALSE}
ReadPixmapFromData {FALSE}
DataVarName {}
DataLenName {}
FocusPolicy {NoFocus}
BackgroundMode {PaletteBackground}
FontPropagation {NoChildren}
PalettePropagation {NoChildren}
}
LineEdit {
Text {}
EchoMode {Normal}
MaxLength {32767}
FrameShown {TRUE}
Rect {70 5 125 25}
Name {LineEdit_1}
Variable {index}
MinimumSize {125 25}
MaximumSize {32767 25}
BackgroundPixmap {}
UseBackgroundPixmap {FALSE}
AdjustSize {FALSE}
ReadPixmapFromData {FALSE}
DataVarName {}
DataLenName {}
FocusPolicy {StrongFocus}
BackgroundMode {PaletteBase}
FontPropagation {NoChildren}
PalettePropagation {NoChildren}
}
PushButton {
ToggleButton {FALSE}
Default {FALSE}
AutoDefault {TRUE}
IsMenuButton {FALSE}
Text {OK}
AutoRepeat {FALSE}
AutoResize {FALSE}
Rect {30 35 80 25}
Name {PushButton_OK}
Variable {buttonOk}
Signal {[Protected] clicked --> clickedOK ()}
MinimumSize {80 25}
MaximumSize {80 25}
BackgroundPixmap {}
UseBackgroundPixmap {FALSE}
AdjustSize {FALSE}
ReadPixmapFromData {FALSE}
DataVarName {}
DataLenName {}
FocusPolicy {TabFocus}
BackgroundMode {PaletteBackground}
FontPropagation {NoChildren}
PalettePropagation {NoChildren}
}
PushButton {
ToggleButton {FALSE}
Default {FALSE}
AutoDefault {FALSE}
IsMenuButton {FALSE}
Text {&Cancel}
AutoRepeat {FALSE}
AutoResize {FALSE}
Rect {115 35 80 25}
Name {PushButton_Cancel}
Variable {buttonCancel}
Signal {[Protected] clicked --> clickedCancel ()}
MinimumSize {80 25}
MaximumSize {80 25}
BackgroundPixmap {}
UseBackgroundPixmap {FALSE}
AdjustSize {FALSE}
ReadPixmapFromData {FALSE}
DataVarName {}
DataLenName {}
FocusPolicy {TabFocus}
BackgroundMode {PaletteBackground}
FontPropagation {NoChildren}
PalettePropagation {NoChildren}
}
Grid_Layout-1{
Border {5}
AutoBorder {5}
Name {}
ColumnInfo {5 1}
BoxStretch {1}
}
Grid_Row-1.1{
Stretch {0}
Spacing {0}
}
Box_Layout-1.1.1{
Direction {LeftToRight}
Border {5}
AutoBorder {5}
Name {}
Strut {0}
Stretch {1}
}
Layout_Widget-1.1.1.1{
Widget {Label_1}
BoxStretch {0}
Alignment {36}
}
Layout_Widget-1.1.1.2{
Widget {LineEdit_1}
BoxStretch {1}
Alignment {36}
}
Grid_Row-1.2{
Stretch {0}
Spacing {0}
}
Box_Layout-1.2.1{
Direction {LeftToRight}
Border {5}
AutoBorder {5}
Name {}
Strut {0}
Stretch {0}
}
Box_Stretch-1.2.1.1{
Stretch {1}
}
Layout_Widget-1.2.1.2{
Widget {PushButton_OK}
BoxStretch {1}
Alignment {36}
}
Layout_Widget-1.2.1.3{
Widget {PushButton_Cancel}
BoxStretch {1}
Alignment {36}
}
}

View File

@ -1,88 +1,67 @@
/*
* formindexdialog.C
* (C) 2000 LyX Team
* John Levon, moz@compsoc.man.ac.uk
*/
/**********************************************************************
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
--- Qt Architect generated file ---
File: formindexdialog.C
Last generated: Thu Sep 14 12:08:37 2000
*********************************************************************/
#include <config.h>
#include <gettext.h>
#include "formindexdialog.h"
#include "FormIndex.h"
FormIndexDialog::FormIndexDialog(FormIndex *form, QWidget *parent, const char *name, bool, WFlags)
: QDialog(parent,name,false), form_(form)
#include <qtooltip.h>
#define Inherited FormIndexDialogData
FormIndexDialog::FormIndexDialog(FormIndex * f, QWidget *p, const char* name)
: Inherited( p, name ), form_(f)
{
setCaption(name);
// widgets
index = new QLineEdit(this);
index->setMinimumSize(index->sizeHint());
labelindex = new QLabel(this);
labelindex->setText(_("Keyword :"));
labelindex->setMargin(5);
labelindex->setMinimumSize(labelindex->sizeHint());
labelindex->setMaximumSize(labelindex->sizeHint());
buttonOk = new QPushButton(this);
buttonOk->setMinimumSize(buttonOk->sizeHint());
buttonOk->setMaximumSize(buttonOk->sizeHint());
buttonOk->setText(_("&OK"));
buttonOk->setDefault(true);
buttonCancel = new QPushButton(this);
buttonCancel->setMinimumSize(buttonCancel->sizeHint());
buttonCancel->setMaximumSize(buttonCancel->sizeHint());
buttonCancel->setText(_("&Cancel"));
// tooltips
QToolTip::add(labelindex,_("Index entry"));
QToolTip::add(index,_("Index entry"));
// layouts
topLayout = new QHBoxLayout(this,10);
layout = new QVBoxLayout();
topLayout->addLayout(layout);
layout->addSpacing(10);
indexLayout = new QHBoxLayout();
layout->addLayout(indexLayout);
indexLayout->addWidget(labelindex, 0);
indexLayout->addWidget(index, 1);
layout->addStretch(1);
buttonLayout = new QHBoxLayout();
layout->addLayout(buttonLayout);
buttonLayout->addStretch(1);
buttonLayout->addWidget(buttonOk, 1);
buttonLayout->addStretch(2);
buttonLayout->addWidget(buttonCancel, 1);
buttonLayout->addStretch(1);
// connections
connect(buttonOk, SIGNAL(clicked()), this, SLOT(apply_adaptor()));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(close_adaptor()));
setMinimumSize( 200, 65 );
setMaximumSize( 32767, 65 );
}
void FormIndexDialog::closeEvent(QCloseEvent *e)
{
form_->close();
e->accept();
}
FormIndexDialog::~FormIndexDialog()
{
}
void FormIndexDialog::clickedOK()
{
form_->apply();
form_->close();
hide();
}
void FormIndexDialog::clickedCancel()
{
form_->close();
hide();
}
void FormIndexDialog::setReadOnly(bool readonly)
{
if (readonly) {
index->setFocusPolicy(QWidget::NoFocus);
buttonOk->setEnabled(false);
buttonCancel->setText(_("Close"));
} else {
index->setFocusPolicy(QWidget::StrongFocus);
index->setFocus();
buttonOk->setEnabled(true);
buttonCancel->setText(_("Cancel"));
}
}

View File

@ -1,75 +1,43 @@
/*
* formindexdialog.h
* (C) 2000 LyX Team
* John Levon, moz@compsoc.man.ac.uk
*/
/**********************************************************************
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
--- Qt Architect generated file ---
#ifndef FORMINDEXDIALOG_H
#define FORMINDEXDIALOG_H
File: formindexdialog.h
Last generated: Thu Sep 14 12:08:37 2000
#include <config.h>
#include <gettext.h>
*********************************************************************/
// to connect apply() and hide()
#include "FormIndex.h"
#ifndef FormIndexDialog_included
#define FormIndexDialog_included
#include <qdialog.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qtooltip.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include "formindexdialogdata.h"
class FormIndexDialog : public QDialog {
class FormIndex;
class FormIndexDialog : public FormIndexDialogData
{
Q_OBJECT
public:
FormIndexDialog(FormIndex *form, QWidget *parent=0, const char *name=0,
bool modal=false, WFlags f=0);
~FormIndexDialog();
// widgets
FormIndexDialog
(
FormIndex *, QWidget* parent = NULL,
const char* name = NULL
);
QLabel *labelindex;
QLineEdit *index;
QPushButton *buttonOk;
QPushButton *buttonCancel;
virtual ~FormIndexDialog();
void setIndexText(const char * str) { index->setText(str); }
const char * getIndexText() { return index->text(); }
void setReadOnly(bool);
protected:
void closeEvent(QCloseEvent *e);
private slots:
void clickedOK();
void clickedCancel();
private:
FormIndex *form_;
// layouts
QHBoxLayout *topLayout;
QVBoxLayout *layout;
QHBoxLayout *indexLayout;
QHBoxLayout *buttonLayout;
private slots:
/// adaptor to FormIndex::apply
void apply_adaptor(void) {
form_->apply();
form_->close();
hide();
}
/// adaptor to FormIndex::close
void close_adaptor(void) {
form_->close();
hide();
}
};
#endif
#endif // FormIndexDialog_included

View File

@ -0,0 +1,123 @@
/**********************************************************************
--- Qt Architect generated file ---
File: formindexdialogdata.C
Last generated: Thu Sep 14 15:35:19 2000
DO NOT EDIT!!! This file will be automatically
regenerated by qtarch. All changes will be lost.
*********************************************************************/
#include <qpixmap.h>
#include <qlayout.h>
#include "formindexdialogdata.h"
#define Inherited QWidget
FormIndexDialogData::FormIndexDialogData
(
QWidget* parent,
const char* name
)
:
Inherited( parent, name, 53248 )
{
labelindex = new QLabel( this, "Label_1" );
labelindex->setGeometry( 5, 5, 60, 25 );
labelindex->setMinimumSize( 60, 25 );
labelindex->setMaximumSize( 60, 25 );
labelindex->setFocusPolicy( QWidget::NoFocus );
labelindex->setBackgroundMode( QWidget::PaletteBackground );
labelindex->setFontPropagation( QWidget::NoChildren );
labelindex->setPalettePropagation( QWidget::NoChildren );
labelindex->setFrameStyle( 0 );
labelindex->setLineWidth( 1 );
labelindex->setMidLineWidth( 0 );
labelindex->QFrame::setMargin( 0 );
labelindex->setText( "Keyword:" );
labelindex->setAlignment( 289 );
labelindex->setMargin( -1 );
index = new QLineEdit( this, "LineEdit_1" );
index->setGeometry( 70, 5, 125, 25 );
index->setMinimumSize( 125, 25 );
index->setMaximumSize( 32767, 25 );
index->setFocusPolicy( QWidget::StrongFocus );
index->setBackgroundMode( QWidget::PaletteBase );
index->setFontPropagation( QWidget::NoChildren );
index->setPalettePropagation( QWidget::NoChildren );
index->setText( "" );
index->setMaxLength( 32767 );
index->setFrame( QLineEdit::Normal );
index->setFrame( TRUE );
buttonOk = new QPushButton( this, "PushButton_OK" );
buttonOk->setGeometry( 30, 35, 80, 25 );
buttonOk->setMinimumSize( 80, 25 );
buttonOk->setMaximumSize( 80, 25 );
connect( buttonOk, SIGNAL(clicked()), SLOT(clickedOK()) );
buttonOk->setFocusPolicy( QWidget::TabFocus );
buttonOk->setBackgroundMode( QWidget::PaletteBackground );
buttonOk->setFontPropagation( QWidget::NoChildren );
buttonOk->setPalettePropagation( QWidget::NoChildren );
buttonOk->setText( "OK" );
buttonOk->setAutoRepeat( FALSE );
buttonOk->setAutoResize( FALSE );
buttonOk->setToggleButton( FALSE );
buttonOk->setDefault( FALSE );
buttonOk->setAutoDefault( TRUE );
buttonOk->setIsMenuButton( FALSE );
buttonCancel = new QPushButton( this, "PushButton_Cancel" );
buttonCancel->setGeometry( 115, 35, 80, 25 );
buttonCancel->setMinimumSize( 80, 25 );
buttonCancel->setMaximumSize( 80, 25 );
connect( buttonCancel, SIGNAL(clicked()), SLOT(clickedCancel()) );
buttonCancel->setFocusPolicy( QWidget::TabFocus );
buttonCancel->setBackgroundMode( QWidget::PaletteBackground );
buttonCancel->setFontPropagation( QWidget::NoChildren );
buttonCancel->setPalettePropagation( QWidget::NoChildren );
buttonCancel->setText( "&Cancel" );
buttonCancel->setAutoRepeat( FALSE );
buttonCancel->setAutoResize( FALSE );
buttonCancel->setToggleButton( FALSE );
buttonCancel->setDefault( FALSE );
buttonCancel->setAutoDefault( FALSE );
buttonCancel->setIsMenuButton( FALSE );
QGridLayout* qtarch_layout_1 = new QGridLayout( this, 2, 1, 5, 5, NULL );
qtarch_layout_1->addColSpacing( 0, 5 );
qtarch_layout_1->setColStretch( 0, 1 );
qtarch_layout_1->addRowSpacing( 0, 0 );
qtarch_layout_1->setRowStretch( 0, 0 );
QBoxLayout* qtarch_layout_1_1_1 = new QBoxLayout( QBoxLayout::LeftToRight, 5, NULL );
qtarch_layout_1->addLayout( qtarch_layout_1_1_1, 0, 0 );
qtarch_layout_1_1_1->addStrut( 0 );
qtarch_layout_1_1_1->addWidget( labelindex, 0, 36 );
qtarch_layout_1_1_1->addWidget( index, 1, 36 );
qtarch_layout_1->addRowSpacing( 1, 0 );
qtarch_layout_1->setRowStretch( 1, 0 );
QBoxLayout* qtarch_layout_1_2_1 = new QBoxLayout( QBoxLayout::LeftToRight, 5, NULL );
qtarch_layout_1->addLayout( qtarch_layout_1_2_1, 1, 0 );
qtarch_layout_1_2_1->addStrut( 0 );
qtarch_layout_1_2_1->addStretch( 1 );
qtarch_layout_1_2_1->addWidget( buttonOk, 1, 36 );
qtarch_layout_1_2_1->addWidget( buttonCancel, 1, 36 );
resize( 200,65 );
setMinimumSize( 200, 65 );
setMaximumSize( 32767, 65 );
}
FormIndexDialogData::~FormIndexDialogData()
{
}
void FormIndexDialogData::clickedOK()
{
}
void FormIndexDialogData::clickedCancel()
{
}

View File

@ -0,0 +1,51 @@
/**********************************************************************
--- Qt Architect generated file ---
File: formindexdialogdata.h
Last generated: Thu Sep 14 15:35:19 2000
DO NOT EDIT!!! This file will be automatically
regenerated by qtarch. All changes will be lost.
*********************************************************************/
#ifndef FormIndexDialogData_included
#define FormIndexDialogData_included
#include <qwidget.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlineedit.h>
class FormIndexDialogData : public QWidget
{
Q_OBJECT
public:
FormIndexDialogData
(
QWidget* parent = NULL,
const char* name = NULL
);
virtual ~FormIndexDialogData();
public slots:
protected slots:
virtual void clickedCancel();
virtual void clickedOK();
protected:
QLabel* labelindex;
QLineEdit* index;
QPushButton* buttonOk;
QPushButton* buttonCancel;
};
#endif // FormIndexDialogData_included

View File

@ -8,6 +8,7 @@
#include "FormError.h"
#include "FormGraphics.h"
#include "FormIndex.h"
#include "FormParagraph.h"
#include "FormPreferences.h"
#include "FormPrint.h"
#include "FormRef.h"
@ -31,6 +32,7 @@ Dialogs::Dialogs(LyXView * lv)
dialogs_.push_back(new FormError(lv, this));
dialogs_.push_back(new FormGraphics(lv, this));
dialogs_.push_back(new FormIndex(lv, this));
dialogs_.push_back(new FormParagraph(lv, this));
dialogs_.push_back(new FormPreferences(lv, this));
dialogs_.push_back(new FormPrint(lv, this));
dialogs_.push_back(new FormRef(lv, this));

View File

@ -0,0 +1,706 @@
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2000 The LyX Team.
*
* @author Jürgen Vigna
*
*======================================================*/
#include <config.h>
#ifdef __GNUG_
#pragma implementation
#endif
#include "lyx_gui_misc.h"
#include "gettext.h"
#include FORMS_H_LOCATION
#include XPM_H_LOCATION
#include "FormParagraph.h"
#include "form_paragraph.h"
#include "xform_macros.h"
#include "Dialogs.h"
#include "ButtonController.h"
#include "Liason.h"
#include "LyXView.h"
#include "BufferView.h"
#include "buffer.h"
#include "lyxtext.h"
#ifdef SIGC_CXX_NAMESPACES
using SigC::slot;
#endif
#ifdef CXX_WORKING_NAMESPACES
using Liason::setMinibuffer;
#endif
C_RETURNCB(FormParagraph, WMHideCB)
C_GENERICCB(FormParagraph, InputCB)
C_GENERICCB(FormParagraph, OKCB)
C_GENERICCB(FormParagraph, ApplyCB)
C_GENERICCB(FormParagraph, CancelCB)
C_GENERICCB(FormParagraph, RestoreCB)
C_GENERICCB(FormParagraph, VSpaceCB)
FormParagraph::FormParagraph(LyXView * lv, Dialogs * d)
: dialog_(0), general_(0), extra_(0),
lv_(lv), d_(d), u_(0), h_(0),
status(POPUP_UNMODIFIED) ,
bc_(new ButtonController<NoRepeatedApplyReadOnlyPolicy>(_("Cancel"),
_("Close")))
{
// let the popup be shown
// This is a permanent connection so we won't bother
// storing a copy because we won't be disconnecting.
d->showLayoutParagraph.connect(slot(this, &FormParagraph::show));
}
FormParagraph::~FormParagraph()
{
free();
delete bc_;
}
void FormParagraph::build()
{
// the tabbed folder
dialog_ = build_tabbed_paragraph();
// manage the restore, ok, apply and cancel/close buttons
bc_->setOK(dialog_->button_ok);
bc_->setApply(dialog_->button_apply);
bc_->setCancel(dialog_->button_cancel);
bc_->setUndoAll(dialog_->button_restore);
bc_->refresh();
// the general paragraph data form
general_ = build_paragraph_general();
fl_addto_choice(general_->choice_space_above,
_(" None | Defskip | Smallskip "
"| Medskip | Bigskip | VFill | Length "));
fl_addto_choice(general_->choice_space_below,
_(" None | Defskip | Smallskip "
"| Medskip | Bigskip | VFill | Length "));
fl_set_input_return(general_->input_space_above, FL_RETURN_CHANGED);
fl_set_input_return(general_->input_space_below, FL_RETURN_CHANGED);
fl_set_input_return(general_->input_labelwidth, FL_RETURN_CHANGED);
bc_->addReadOnly (general_->radio_align_right);
bc_->addReadOnly (general_->radio_align_left);
bc_->addReadOnly (general_->radio_align_block);
bc_->addReadOnly (general_->radio_align_center);
bc_->addReadOnly (general_->check_lines_top);
bc_->addReadOnly (general_->check_lines_bottom);
bc_->addReadOnly (general_->check_pagebreaks_top);
bc_->addReadOnly (general_->check_pagebreaks_bottom);
bc_->addReadOnly (general_->choice_space_above);
bc_->addReadOnly (general_->input_space_above);
bc_->addReadOnly (general_->check_space_above);
bc_->addReadOnly (general_->choice_space_below);
bc_->addReadOnly (general_->input_space_below);
bc_->addReadOnly (general_->check_space_below);
bc_->addReadOnly (general_->check_noindent);
bc_->addReadOnly (general_->input_labelwidth);
// the document class form
extra_ = build_paragraph_extra();
fl_set_input_return(extra_->input_pextra_width, FL_RETURN_CHANGED);
fl_set_input_return(extra_->input_pextra_widthp, FL_RETURN_CHANGED);
bc_->addReadOnly (extra_->radio_pextra_indent);
bc_->addReadOnly (extra_->radio_pextra_minipage);
bc_->addReadOnly (extra_->radio_pextra_floatflt);
bc_->addReadOnly (extra_->input_pextra_width);
bc_->addReadOnly (extra_->input_pextra_widthp);
bc_->addReadOnly (extra_->radio_pextra_top);
bc_->addReadOnly (extra_->radio_pextra_middle);
bc_->addReadOnly (extra_->radio_pextra_bottom);
bc_->addReadOnly (extra_->radio_pextra_hfill);
bc_->addReadOnly (extra_->radio_pextra_startmp);
// now make them fit together
fl_set_form_atclose(dialog_->form, C_FormParagraphWMHideCB, 0);
fl_addto_tabfolder(dialog_->tabbed_folder,_("General"), general_->form);
fl_addto_tabfolder(dialog_->tabbed_folder,_("Extra"), extra_->form);
}
void FormParagraph::show()
{
if (!dialog_)
build();
update(); // make sure its up-to-date
if (dialog_->form->visible) {
fl_raise_form(dialog_->form);
} else {
fl_show_form(dialog_->form, FL_PLACE_MOUSE | FL_FREE_SIZE,
FL_TRANSIENT, _("Paragraph Layout"));
u_ = d_->updateBufferDependent.connect(
slot(this, &FormParagraph::update));
h_ = d_->hideBufferDependent.connect(
slot(this, &FormParagraph::hide));
}
}
void FormParagraph::hide()
{
if (dialog_->form->visible) {
fl_hide_form(dialog_->form);
u_.disconnect();
h_.disconnect();
}
}
void FormParagraph::apply()
{
if (!lv_->view()->available() || !dialog_)
return;
general_apply();
extra_apply();
lv_->view()->update(BufferView::SELECT | BufferView::FITCUR |
BufferView::CHANGE);
lv_->buffer()->markDirty();
setMinibuffer(lv_, _("Paragraph layout set"));
}
void FormParagraph::general_apply()
{
VSpace space_top, space_bottom;
LyXAlignment align;
string labelwidthstring;
bool noindent;
// If a vspace kind is "Length" but there's no text in
// the input field, reset the kind to "None".
if ((fl_get_choice (general_->choice_space_above) == 7) &&
!*(fl_get_input (general_->input_space_above)))
{
fl_set_choice (general_->choice_space_above, 1);
}
if ((fl_get_choice (general_->choice_space_below) == 7) &&
!*(fl_get_input (general_->input_space_below)))
{
fl_set_choice (general_->choice_space_below, 1);
}
bool line_top = fl_get_button(general_->check_lines_top);
bool line_bottom = fl_get_button(general_->check_lines_bottom);
bool pagebreak_top = fl_get_button(general_->check_pagebreaks_top);
bool pagebreak_bottom = fl_get_button(general_->check_pagebreaks_bottom);
switch (fl_get_choice (general_->choice_space_above)) {
case 1:
space_top = VSpace(VSpace::NONE);
break;
case 2:
space_top = VSpace(VSpace::DEFSKIP);
break;
case 3:
space_top = VSpace(VSpace::SMALLSKIP);
break;
case 4:
space_top = VSpace(VSpace::MEDSKIP);
break;
case 5:
space_top = VSpace(VSpace::BIGSKIP);
break;
case 6:
space_top = VSpace(VSpace::VFILL);
break;
case 7:
space_top = VSpace(LyXGlueLength(fl_get_input(general_->input_space_above)));
break;
}
if (fl_get_button (general_->check_space_above))
space_top.setKeep (true);
switch (fl_get_choice (general_->choice_space_below)) {
case 1:
space_bottom = VSpace(VSpace::NONE);
break;
case 2:
space_bottom = VSpace(VSpace::DEFSKIP);
break;
case 3:
space_bottom = VSpace(VSpace::SMALLSKIP);
break;
case 4:
space_bottom = VSpace(VSpace::MEDSKIP);
break;
case 5:
space_bottom = VSpace(VSpace::BIGSKIP);
break;
case 6:
space_bottom = VSpace(VSpace::VFILL);
break;
case 7:
space_bottom = VSpace(LyXGlueLength(fl_get_input(general_->input_space_below)));
break;
}
if (fl_get_button (general_->check_space_below))
space_bottom.setKeep (true);
if (fl_get_button(general_->radio_align_left))
align = LYX_ALIGN_LEFT;
else if (fl_get_button(general_->radio_align_right))
align = LYX_ALIGN_RIGHT;
else if (fl_get_button(general_->radio_align_center))
align = LYX_ALIGN_CENTER;
else
align = LYX_ALIGN_BLOCK;
labelwidthstring = fl_get_input(general_->input_labelwidth);
noindent = fl_get_button(general_->check_noindent);
LyXText * text = 0;
if (lv_->view()->the_locking_inset)
text = lv_->view()->the_locking_inset->getLyXText(lv_->view());
if (!text)
text = lv_->view()->text;
text->SetParagraph(lv_->view(), line_top, line_bottom, pagebreak_top,
pagebreak_bottom, space_top, space_bottom, align,
labelwidthstring, noindent);
}
void FormParagraph::extra_apply()
{
char const * width = fl_get_input(extra_->input_pextra_width);
char const * widthp = fl_get_input(extra_->input_pextra_widthp);
LyXText * text = lv_->view()->text;
int type = LyXParagraph::PEXTRA_NONE;
LyXParagraph::MINIPAGE_ALIGNMENT
alignment = LyXParagraph::MINIPAGE_ALIGN_TOP;
bool
hfill = false,
start_minipage = false;
if (fl_get_button(extra_->radio_pextra_indent)) {
type = LyXParagraph::PEXTRA_INDENT;
} else if (fl_get_button(extra_->radio_pextra_minipage)) {
type = LyXParagraph::PEXTRA_MINIPAGE;
hfill = fl_get_button(extra_->radio_pextra_hfill);
start_minipage = fl_get_button(extra_->radio_pextra_startmp);
if (fl_get_button(extra_->radio_pextra_top))
alignment = LyXParagraph::MINIPAGE_ALIGN_TOP;
else if (fl_get_button(extra_->radio_pextra_middle))
alignment = LyXParagraph::MINIPAGE_ALIGN_MIDDLE;
else if (fl_get_button(extra_->radio_pextra_bottom))
alignment = LyXParagraph::MINIPAGE_ALIGN_BOTTOM;
} else if (fl_get_button(extra_->radio_pextra_floatflt)) {
type = LyXParagraph::PEXTRA_FLOATFLT;
}
text->SetParagraphExtraOpt(lv_->view(), type, width, widthp, alignment,
hfill, start_minipage);
}
void FormParagraph::cancel()
{
}
void FormParagraph::update()
{
if (!dialog_)
return;
general_update();
extra_update();
}
void FormParagraph::general_update()
{
if (!general_)
return;
Buffer * buf = lv_->view()->buffer();
LyXText * text = 0;
if (lv_->view()->the_locking_inset)
text = lv_->view()->the_locking_inset->getLyXText(lv_->view());
if (!text)
text = lv_->view()->text;
fl_set_input(general_->input_labelwidth,
text->cursor.par()->GetLabelWidthString().c_str());
fl_set_button(general_->radio_align_right, 0);
fl_set_button(general_->radio_align_left, 0);
fl_set_button(general_->radio_align_center, 0);
fl_set_button(general_->radio_align_block, 0);
int align = text->cursor.par()->GetAlign();
if (align == LYX_ALIGN_LAYOUT)
align = textclasslist.Style(buf->params.textclass,
text->cursor.par()->GetLayout()).align;
switch (align) {
case LYX_ALIGN_RIGHT:
fl_set_button(general_->radio_align_right, 1);
break;
case LYX_ALIGN_LEFT:
fl_set_button(general_->radio_align_left, 1);
break;
case LYX_ALIGN_CENTER:
fl_set_button(general_->radio_align_center, 1);
break;
default:
fl_set_button(general_->radio_align_block, 1);
break;
}
#ifndef NEW_INSETS
fl_set_button(general_->check_lines_top,
text->cursor.par()->FirstPhysicalPar()->line_top);
fl_set_button(general_->check_lines_bottom,
text->cursor.par()->FirstPhysicalPar()->line_bottom);
fl_set_button(general_->check_pagebreaks_top,
text->cursor.par()->FirstPhysicalPar()->pagebreak_top);
fl_set_button(general_->check_pagebreaks_bottom,
text->cursor.par()->FirstPhysicalPar()->pagebreak_bottom);
fl_set_button(general_->check_noindent,
text->cursor.par()->FirstPhysicalPar()->noindent);
#else
fl_set_button(general_->check_lines_top,
text->cursor.par()->line_top);
fl_set_button(general_->check_lines_bottom,
text->cursor.par()->line_bottom);
fl_set_button(general_->check_pagebreaks_top,
text->cursor.par()->pagebreak_top);
fl_set_button(general_->check_pagebreaks_bottom,
text->cursor.par()->pagebreak_bottom);
fl_set_button(general_->check_noindent,
text->cursor.par()->noindent);
#endif
fl_set_input (general_->input_space_above, "");
#ifndef NEW_INSETS
switch (text->cursor.par()->FirstPhysicalPar()->added_space_top.kind()) {
#else
switch (text->cursor.par()->added_space_top.kind()) {
#endif
case VSpace::NONE:
fl_set_choice (general_->choice_space_above, 1);
break;
case VSpace::DEFSKIP:
fl_set_choice (general_->choice_space_above, 2);
break;
case VSpace::SMALLSKIP:
fl_set_choice (general_->choice_space_above, 3);
break;
case VSpace::MEDSKIP:
fl_set_choice (general_->choice_space_above, 4);
break;
case VSpace::BIGSKIP:
fl_set_choice (general_->choice_space_above, 5);
break;
case VSpace::VFILL:
fl_set_choice (general_->choice_space_above, 6);
break;
case VSpace::LENGTH:
fl_set_choice (general_->choice_space_above, 7);
#ifndef NEW_INSETS
fl_set_input (general_->input_space_above,
text->cursor.par()->FirstPhysicalPar()->
added_space_top.length().asString().c_str());
#else
fl_set_input (general_->input_space_above, text->cursor.par()->
added_space_top.length().asString().c_str());
#endif
break;
}
#ifndef NEW_INSETS
fl_set_button(general_->check_space_above,
text->cursor.par()->FirstPhysicalPar()->
added_space_top.keep());
fl_set_input(general_->input_space_below, "");
switch (text->cursor.par()->FirstPhysicalPar()->
added_space_bottom.kind()) {
#else
fl_set_button (general_->check_space_above,
text->cursor.par()->added_space_top.keep());
fl_set_input (general_->input_space_below, "");
switch (text->cursor.par()->added_space_bottom.kind()) {
#endif
case VSpace::NONE:
fl_set_choice (general_->choice_space_below, 1);
break;
case VSpace::DEFSKIP:
fl_set_choice (general_->choice_space_below, 2);
break;
case VSpace::SMALLSKIP:
fl_set_choice (general_->choice_space_below, 3);
break;
case VSpace::MEDSKIP:
fl_set_choice (general_->choice_space_below, 4);
break;
case VSpace::BIGSKIP:
fl_set_choice (general_->choice_space_below, 5);
break;
case VSpace::VFILL:
fl_set_choice (general_->choice_space_below, 6);
break;
case VSpace::LENGTH:
fl_set_choice (general_->choice_space_below, 7);
#ifndef NEW_INSETS
fl_set_input (general_->input_space_below,
text->cursor.par()->FirstPhysicalPar()->
added_space_bottom.length().asString().c_str());
break;
}
fl_set_button(general_->check_space_below,
text->cursor.par()->FirstPhysicalPar()->
added_space_bottom.keep());
fl_set_button(general_->check_noindent,
text->cursor.par()->FirstPhysicalPar()->noindent);
#else
fl_set_input(general_->input_space_below, text->cursor.par()->
added_space_bottom.length().asString().c_str());
break;
}
fl_set_button(general_->check_space_below,
text->cursor.par()->added_space_bottom.keep());
fl_set_button(general_->check_noindent,
text->cursor.par()->noindent);
#endif
}
void FormParagraph::extra_update()
{
if (!lv_->view()->available() || !extra_)
return;
LyXParagraph * par = lv_->view()->text->cursor.par();
fl_activate_object(extra_->input_pextra_width);
fl_activate_object(extra_->input_pextra_widthp);
fl_set_input(extra_->input_pextra_width,
par->pextra_width.c_str());
fl_set_input(extra_->input_pextra_widthp,
par->pextra_widthp.c_str());
switch(par->pextra_alignment) {
case LyXParagraph::MINIPAGE_ALIGN_TOP:
fl_set_button(extra_->radio_pextra_top, 1);
break;
case LyXParagraph::MINIPAGE_ALIGN_MIDDLE:
fl_set_button(extra_->radio_pextra_middle, 1);
break;
case LyXParagraph::MINIPAGE_ALIGN_BOTTOM:
fl_set_button(extra_->radio_pextra_bottom, 1);
break;
}
fl_set_button(extra_->radio_pextra_hfill,
par->pextra_hfill);
fl_set_button(extra_->radio_pextra_startmp,
par->pextra_start_minipage);
// CheckInputWidth();
if (par->pextra_type == LyXParagraph::PEXTRA_INDENT) {
fl_set_button(extra_->radio_pextra_indent, 1);
fl_set_button(extra_->radio_pextra_minipage, 0);
fl_set_button(extra_->radio_pextra_floatflt, 0);
fl_deactivate_object(extra_->radio_pextra_top);
fl_deactivate_object(extra_->radio_pextra_middle);
fl_deactivate_object(extra_->radio_pextra_bottom);
} else if (par->pextra_type == LyXParagraph::PEXTRA_MINIPAGE) {
fl_set_button(extra_->radio_pextra_indent, 0);
fl_set_button(extra_->radio_pextra_minipage, 1);
fl_set_button(extra_->radio_pextra_floatflt, 0);
fl_activate_object(extra_->radio_pextra_top);
fl_activate_object(extra_->radio_pextra_middle);
fl_activate_object(extra_->radio_pextra_bottom);
} else if (par->pextra_type == LyXParagraph::PEXTRA_FLOATFLT) {
fl_set_button(extra_->radio_pextra_indent, 0);
fl_set_button(extra_->radio_pextra_minipage, 0);
fl_set_button(extra_->radio_pextra_floatflt, 1);
fl_deactivate_object(extra_->radio_pextra_top);
fl_deactivate_object(extra_->radio_pextra_middle);
fl_deactivate_object(extra_->radio_pextra_bottom);
} else {
fl_set_button(extra_->radio_pextra_indent, 0);
fl_set_button(extra_->radio_pextra_minipage, 0);
fl_deactivate_object(extra_->input_pextra_width);
fl_deactivate_object(extra_->input_pextra_widthp);
fl_deactivate_object(extra_->radio_pextra_top);
fl_deactivate_object(extra_->radio_pextra_middle);
fl_deactivate_object(extra_->radio_pextra_bottom);
}
// if (par->pextra_type == LyXParagraph::PEXTRA_NONE)
// ActivateParagraphExtraButtons();
fl_hide_object(extra_->text_warning);
}
void FormParagraph::free()
{
if (dialog_) {
hide();
if (general_) {
// fl_free_form(general_->form);
delete general_;
general_ = 0;
}
if (extra_) {
// fl_free_form(extra_->form);
delete extra_;
extra_ = 0;
}
// fl_free_form(dialog_->form);
delete dialog_;
dialog_ = 0;
}
}
int FormParagraph::WMHideCB(FL_FORM * form, void *)
{
// Ensure that the signals (u and h) are disconnected even if the
// window manager is used to close the popup.
FormParagraph * pre = static_cast<FormParagraph*>(form->u_vdata);
pre->hide();
pre->bc_->hide();
return FL_CANCEL;
}
void FormParagraph::OKCB(FL_OBJECT * ob, long)
{
FormParagraph * pre = static_cast<FormParagraph*>(ob->form->u_vdata);
pre->apply();
pre->hide();
pre->bc_->ok();
}
void FormParagraph::ApplyCB(FL_OBJECT * ob, long)
{
FormParagraph * pre = static_cast<FormParagraph*>(ob->form->u_vdata);
pre->apply();
pre->bc_->apply();
}
void FormParagraph::CancelCB(FL_OBJECT * ob, long)
{
FormParagraph * pre = static_cast<FormParagraph*>(ob->form->u_vdata);
pre->cancel();
pre->hide();
pre->bc_->cancel();
}
void FormParagraph::RestoreCB(FL_OBJECT * ob, long)
{
FormParagraph * pre = static_cast<FormParagraph*>(ob->form->u_vdata);
pre->update();
pre->bc_->undoAll();
}
void FormParagraph::InputCB(FL_OBJECT * ob, long)
{
FormParagraph * pre = static_cast<FormParagraph*>(ob->form->u_vdata);
pre->bc_->valid(pre->CheckParagraphInput(ob,0));
}
void FormParagraph::VSpaceCB(FL_OBJECT * ob, long)
{
FormParagraph * pre = static_cast<FormParagraph*>(ob->form->u_vdata);
pre->bc_->valid(pre->CheckParagraphInput(ob,0));
}
bool FormParagraph::CheckParagraphInput(FL_OBJECT * ob, long)
{
bool ret = true;
fl_hide_object(extra_->text_warning);
//
// first the general form
//
// "Synchronize" the choices and input fields, making it
// impossible to commit senseless data.
if (ob == general_->choice_space_above) {
if (fl_get_choice (general_->choice_space_above) != 7)
fl_set_input (general_->input_space_above, "");
} else if (ob == general_->choice_space_below) {
if (fl_get_choice (general_->choice_space_below) != 7)
fl_set_input (general_->input_space_below, "");
}
string input = fl_get_input (general_->input_space_above);
if (input.empty()) {
fl_set_choice (general_->choice_space_above, 1);
} else if (isValidGlueLength (input)) {
fl_set_choice (general_->choice_space_above, 7);
} else {
fl_set_choice (general_->choice_space_above, 7);
ret = false;
}
input = fl_get_input (general_->input_space_below);
if (input.empty()) {
fl_set_choice (general_->choice_space_below, 1);
} else if (isValidGlueLength (input)) {
fl_set_choice (general_->choice_space_below, 7);
} else {
fl_set_choice (general_->choice_space_below, 7);
ret = false;
}
//
// then the extra form
//
string s1 = fl_get_input(extra_->input_pextra_width);
string s2 = fl_get_input(extra_->input_pextra_widthp);
if (s1.empty() && s2.empty()) {
fl_activate_object(extra_->input_pextra_width);
fl_activate_object(extra_->input_pextra_widthp);
fl_hide_object(extra_->text_warning);
ret = false;
}
if (!s1.empty()) { // LyXLength parameter
fl_activate_object(extra_->input_pextra_width);
fl_deactivate_object(extra_->input_pextra_widthp);
if (!isValidLength(s1)) {
fl_set_object_label(extra_->text_warning,
_("Warning: Invalid Length (valid example: 10mm)"));
fl_show_object(extra_->text_warning);
ret = false;
}
} else { // !s2.empty() % parameter
fl_deactivate_object(extra_->input_pextra_width);
fl_activate_object(extra_->input_pextra_widthp);
if ((atoi(s2.c_str()) < 0 ) || (atoi(s2.c_str()) > 100)) {
ret = false;
fl_set_object_label(extra_->text_warning,
_("Warning: Invalid percent value (0-100)"));
fl_show_object(extra_->text_warning);
}
}
return ret;
}

View File

@ -0,0 +1,116 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright (C) 2000 The LyX Team.
*
* @author Jürgen Vigna
*
*======================================================*/
#ifndef FORM_PARAGRAPH_H
#define FORM_PARAGRAPH_H
#include "DialogBase.h"
#include "support/utility.hpp"
#include <vector>
#ifdef __GNUG_
#pragma interface
#endif
class LyXView;
class Dialogs;
class NoRepeatedApplyReadOnlyPolicy;
template <class x> class ButtonController;
struct FD_form_tabbed_paragraph;
struct FD_form_paragraph_general;
struct FD_form_paragraph_extra;
#ifdef SIGC_CXX_NAMESPACES
using SigC::Connection;
#endif
/** This class provides an XForms implementation of the FormParagraph Popup.
The table-layout-form here changes values for latex-tabulars
*/
class FormParagraph : public DialogBase, public noncopyable {
public:
FormParagraph(LyXView *, Dialogs *);
~FormParagraph();
///
static int WMHideCB(FL_FORM *, void *);
static void OKCB(FL_OBJECT *, long);
static void ApplyCB(FL_OBJECT *, long);
static void CancelCB(FL_OBJECT *, long);
static void RestoreCB(FL_OBJECT *, long);
static void InputCB(FL_OBJECT *, long);
static void VSpaceCB(FL_OBJECT *, long);
///
enum EnumPopupStatus {
///
POPUP_UNMODIFIED,
///
POPUP_MODIFIED,
///
POPUP_READONLY
};
private:
/// Create the popup if necessary, update it and display it.
void show();
/// Hide the popup.
void hide();
/// Update the popup.
void update();
///
void general_update();
///
void extra_update();
/// Apply from popup
void apply();
///
void general_apply();
///
void extra_apply();
/// Cancel from popup
void cancel();
/// Build the popup
void build();
/// Explicitly free the popup.
void free();
///
bool CheckParagraphInput(FL_OBJECT * ob, long);
/// Typedefinitions from the fdesign produced Header file
FD_form_tabbed_paragraph * build_tabbed_paragraph();
///
FD_form_paragraph_general * build_paragraph_general();
///
FD_form_paragraph_extra * build_paragraph_extra();
/// Real GUI implementation.
FD_form_tabbed_paragraph * dialog_;
///
FD_form_paragraph_general * general_;
///
FD_form_paragraph_extra * extra_;
/// Which LyXView do we belong to?
LyXView * lv_;
///
Dialogs * d_;
/// Update connection.
Connection u_;
/// Hide connection.
Connection h_;
/// has form contents changed? Used to control OK/Apply
EnumPopupStatus status;
///
ButtonController<NoRepeatedApplyReadOnlyPolicy> * bc_;
};
#endif

View File

@ -42,6 +42,10 @@ libxforms_la_SOURCES = \
FormIndex.h \
form_index.C \
form_index.h \
FormParagraph.C \
FormParagraph.h \
form_paragraph.C \
form_paragraph.h \
FormPreferences.C \
FormPreferences.h \
form_preferences.C \

View File

@ -0,0 +1,269 @@
// 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"
/* Form definition file generated with fdesign. */
#include FORMS_H_LOCATION
#include <stdlib.h>
#include "form_paragraph.h"
#include "FormParagraph.h"
FD_form_paragraph_general::~FD_form_paragraph_general()
{
if( form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_paragraph_general * FormParagraph::build_paragraph_general()
{
FL_OBJECT *obj;
FD_form_paragraph_general *fdui = new FD_form_paragraph_general;
fdui->form = fl_bgn_form(FL_NO_BOX, 490, 260);
fdui->form->u_vdata = this;
obj = fl_add_box(FL_UP_BOX, 0, 0, 490, 260, "");
obj = fl_add_frame(FL_ENGRAVED_FRAME, 360, 110, 120, 50, "");
fl_set_object_color(obj, FL_COL1, FL_COL1);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 110, 340, 90, "");
fl_set_object_color(obj, FL_COL1, FL_COL1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 360, 20, 120, 70, "");
fl_set_object_color(obj, FL_COL1, FL_COL1);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 210, 20, 140, 70, "");
fl_set_object_color(obj, FL_COL1, FL_COL1);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 190, 70, "");
fl_set_object_color(obj, FL_COL1, FL_COL1);
fdui->input_labelwidth = obj = fl_add_input(FL_NORMAL_INPUT, 100, 210, 360, 30, idex(_("Label Width:|#d")));
fl_set_button_shortcut(obj, scex(_("Label Width:|#d")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_West, FL_East);
fl_set_object_resize(obj, FL_RESIZE_X);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
obj = fl_add_text(FL_NORMAL_TEXT, 370, 100, 60, 20, _("Indent"));
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->check_lines_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 230, 30, 120, 30, idex(_("Above|#b")));
fl_set_button_shortcut(obj, scex(_("Above|#b")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->check_lines_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 230, 60, 120, 30, idex(_("Below|#E")));
fl_set_button_shortcut(obj, scex(_("Below|#E")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->check_pagebreaks_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 360, 30, 120, 30, idex(_("Above|#o")));
fl_set_button_shortcut(obj, scex(_("Above|#o")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->check_pagebreaks_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 360, 60, 120, 30, idex(_("Below|#l")));
fl_set_button_shortcut(obj, scex(_("Below|#l")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->check_noindent = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 360, 120, 120, 30, idex(_("No Indent|#I")));
fl_set_button_shortcut(obj, scex(_("No Indent|#I")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->group_radio_alignment = fl_bgn_group();
fdui->radio_align_right = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 30, 80, 30, idex(_("Right|#R")));
fl_set_button_shortcut(obj, scex(_("Right|#R")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->radio_align_left = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 60, 80, 30, idex(_("Left|#f")));
fl_set_button_shortcut(obj, scex(_("Left|#f")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->radio_align_block = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 100, 30, 80, 30, idex(_("Block|#c")));
fl_set_button_shortcut(obj, scex(_("Block|#c")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->radio_align_center = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 100, 60, 80, 30, idex(_("Center|#n")));
fl_set_button_shortcut(obj, scex(_("Center|#n")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fl_end_group();
fdui->input_space_above = obj = fl_add_input(FL_NORMAL_INPUT, 180, 120, 90, 30, "");
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphVSpaceCB, 0);
fdui->input_space_below = obj = fl_add_input(FL_NORMAL_INPUT, 180, 160, 90, 30, "");
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphVSpaceCB, 0);
fdui->choice_space_above = obj = fl_add_choice(FL_NORMAL_CHOICE, 70, 120, 100, 30, idex(_("Above:|#v")));
fl_set_button_shortcut(obj, scex(_("Above:|#v")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphVSpaceCB, 0);
fdui->choice_space_below = obj = fl_add_choice(FL_NORMAL_CHOICE, 70, 160, 100, 30, idex(_("Below:|#w")));
fl_set_button_shortcut(obj, scex(_("Below:|#w")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphVSpaceCB, 0);
obj = fl_add_text(FL_NORMAL_TEXT, 370, 10, 100, 20, _("Pagebreaks"));
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);
obj = fl_add_text(FL_NORMAL_TEXT, 230, 10, 50, 20, _("Lines"));
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);
obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 80, 20, _("Alignment"));
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);
obj = fl_add_text(FL_NORMAL_TEXT, 20, 100, 130, 20, _("Vertical Spaces"));
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->check_space_above = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 270, 120, 40, 30, idex(_("Keep|#K")));
fl_set_button_shortcut(obj, scex(_("Keep|#K")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->check_space_below = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 270, 160, 40, 30, idex(_("Keep|#p")));
fl_set_button_shortcut(obj, scex(_("Keep|#p")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fl_end_form();
fdui->form->fdui = fdui;
return fdui;
}
/*---------------------------------------*/
FD_form_paragraph_extra::~FD_form_paragraph_extra()
{
if( form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_paragraph_extra * FormParagraph::build_paragraph_extra()
{
FL_OBJECT *obj;
FD_form_paragraph_extra *fdui = new FD_form_paragraph_extra;
fdui->form = fl_bgn_form(FL_NO_BOX, 490, 260);
fdui->form->u_vdata = this;
obj = fl_add_box(FL_UP_BOX, 0, 0, 490, 260, "");
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 170, 100, "");
fl_set_object_color(obj, FL_COL1, FL_COL1);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 350, 20, 100, 100, "");
fl_set_object_color(obj, FL_COL1, FL_COL1);
obj = fl_add_frame(FL_ENGRAVED_FRAME, 190, 20, 150, 100, "");
fl_set_object_color(obj, FL_COL1, FL_COL1);
obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 120, 20, _("Extra Options"));
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_pextra_width = obj = fl_add_input(FL_NORMAL_INPUT, 240, 30, 90, 30, idex(_("Length|#L")));
fl_set_button_shortcut(obj, scex(_("Length|#L")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->input_pextra_widthp = obj = fl_add_input(FL_INT_INPUT, 240, 70, 90, 30, idex(_("or %|#o")));
fl_set_button_shortcut(obj, scex(_("or %|#o")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
obj = fl_add_text(FL_NORMAL_TEXT, 200, 10, 60, 20, _("Width"));
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);
obj = fl_add_text(FL_NORMAL_TEXT, 350, 10, 90, 20, _("Alignment"));
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->group_alignment = fl_bgn_group();
fdui->radio_pextra_top = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 360, 30, 80, 30, idex(_("Top|#T")));
fl_set_button_shortcut(obj, scex(_("Top|#T")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->radio_pextra_middle = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 360, 60, 80, 30, idex(_("Middle|#d")));
fl_set_button_shortcut(obj, scex(_("Middle|#d")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->radio_pextra_bottom = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 360, 90, 80, 30, idex(_("Bottom|#B")));
fl_set_button_shortcut(obj, scex(_("Bottom|#B")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fl_end_group();
fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 10, 190, 470, 30, "");
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->radio_pextra_hfill = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 130, 300, 30, idex(_("HFill between Minipage paragraphs|#H")));
fl_set_button_shortcut(obj, scex(_("HFill between Minipage paragraphs|#H")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->radio_pextra_startmp = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 160, 260, 30, idex(_("Start new Minipage|#S")));
fl_set_button_shortcut(obj, scex(_("Start new Minipage|#S")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->group_extraopt = fl_bgn_group();
fdui->radio_pextra_indent = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 30, 160, 30, idex(_("Indented Paragraph|#I")));
fl_set_button_shortcut(obj, scex(_("Indented Paragraph|#I")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->radio_pextra_minipage = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 60, 160, 30, idex(_("Minipage|#M")));
fl_set_button_shortcut(obj, scex(_("Minipage|#M")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fdui->radio_pextra_floatflt = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 90, 160, 30, idex(_("Floatflt|#F")));
fl_set_button_shortcut(obj, scex(_("Floatflt|#F")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphInputCB, 0);
fl_end_group();
fl_end_form();
fdui->form->fdui = fdui;
return fdui;
}
/*---------------------------------------*/
FD_form_tabbed_paragraph::~FD_form_tabbed_paragraph()
{
if( form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_tabbed_paragraph * FormParagraph::build_tabbed_paragraph()
{
FL_OBJECT *obj;
FD_form_tabbed_paragraph *fdui = new FD_form_tabbed_paragraph;
fdui->form = fl_bgn_form(FL_NO_BOX, 510, 340);
fdui->form->u_vdata = this;
obj = fl_add_box(FL_UP_BOX, 0, 0, 510, 340, "");
fdui->tabbed_folder = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 10, 10, 490, 280, _("Tabbed folder"));
fl_set_object_resize(obj, FL_RESIZE_ALL);
fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 400, 300, 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, C_FormParagraphCancelCB, 0);
fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 290, 300, 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, C_FormParagraphApplyCB, 0);
fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 180, 300, 100, 30, _("OK"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphOKCB, 0);
fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 300, 100, 30, idex(_("Restore|#R")));
fl_set_button_shortcut(obj, scex(_("Restore|#R")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormParagraphRestoreCB, 0);
fl_end_form();
fdui->form->fdui = fdui;
return fdui;
}
/*---------------------------------------*/

View File

@ -0,0 +1,71 @@
// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
/** Header file generated with fdesign **/
#ifndef FD_form_paragraph_general_h_
#define FD_form_paragraph_general_h_
/** Callbacks, globals and object handlers **/
extern "C" void C_FormParagraphInputCB(FL_OBJECT *, long);
extern "C" void C_FormParagraphVSpaceCB(FL_OBJECT *, long);
extern "C" void C_FormParagraphInputCB(FL_OBJECT *, long);
extern "C" void C_FormParagraphCancelCB(FL_OBJECT *, long);
extern "C" void C_FormParagraphApplyCB(FL_OBJECT *, long);
extern "C" void C_FormParagraphOKCB(FL_OBJECT *, long);
extern "C" void C_FormParagraphRestoreCB(FL_OBJECT *, long);
/**** Forms and Objects ****/
struct FD_form_paragraph_general {
~FD_form_paragraph_general();
FL_FORM *form;
FL_OBJECT *input_labelwidth;
FL_OBJECT *check_lines_top;
FL_OBJECT *check_lines_bottom;
FL_OBJECT *check_pagebreaks_top;
FL_OBJECT *check_pagebreaks_bottom;
FL_OBJECT *check_noindent;
FL_OBJECT *group_radio_alignment;
FL_OBJECT *radio_align_right;
FL_OBJECT *radio_align_left;
FL_OBJECT *radio_align_block;
FL_OBJECT *radio_align_center;
FL_OBJECT *input_space_above;
FL_OBJECT *input_space_below;
FL_OBJECT *choice_space_above;
FL_OBJECT *choice_space_below;
FL_OBJECT *check_space_above;
FL_OBJECT *check_space_below;
};
struct FD_form_paragraph_extra {
~FD_form_paragraph_extra();
FL_FORM *form;
FL_OBJECT *input_pextra_width;
FL_OBJECT *input_pextra_widthp;
FL_OBJECT *group_alignment;
FL_OBJECT *radio_pextra_top;
FL_OBJECT *radio_pextra_middle;
FL_OBJECT *radio_pextra_bottom;
FL_OBJECT *text_warning;
FL_OBJECT *radio_pextra_hfill;
FL_OBJECT *radio_pextra_startmp;
FL_OBJECT *group_extraopt;
FL_OBJECT *radio_pextra_indent;
FL_OBJECT *radio_pextra_minipage;
FL_OBJECT *radio_pextra_floatflt;
};
struct FD_form_tabbed_paragraph {
~FD_form_tabbed_paragraph();
FL_FORM *form;
FL_OBJECT *tabbed_folder;
FL_OBJECT *button_cancel;
FL_OBJECT *button_apply;
FL_OBJECT *button_ok;
FL_OBJECT *button_restore;
};
#endif /* FD_form_paragraph_general_h_ */

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,7 @@ SRCS := form_citation.fd \
form_error.fd \
form_graphics.fd \
form_index.fd \
form_paragraph.fd \
form_preferences.fd \
form_print.fd \
form_ref.fd \

View File

@ -1436,7 +1436,11 @@ string const LyXFunc::Dispatch(int ac,
break;
case LFUN_LAYOUT_PARAGRAPH:
#ifdef USE_OLD_PARAGRAPH_LAYOUT
MenuLayoutParagraph();
#else
owner->getDialogs()->showLayoutParagraph();
#endif
break;
case LFUN_LAYOUT_CHARACTER:

View File

@ -1312,6 +1312,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
lyxerr << "Some error in reading old table format occured!" <<
endl << "Terminating when reading cell[" << cell << "]!" <<
endl;
delete par;
return;
}
row = row_of_cell(cell);
@ -1335,6 +1336,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
par->CopyIntoMinibuffer(current_view->buffer()->params, i);
inset->par->InsertFromMinibuffer(inset->par->Last());
}
delete par;
Reinit();
}