Angus patch + small insetfloat->Write-bug fix.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@898 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2000-07-19 08:37:26 +00:00
parent d59d3eb51a
commit 48c9e70559
13 changed files with 136 additions and 88 deletions

View File

@ -1,3 +1,27 @@
2000-07-19 Juergen Vigna <jug@sad.it>
* src/insets/insetfloat.C (Write): small fix because we use the
insetname for the type now!
2000-07-18 Angus Leeming <a.leeming@ic.ac.uk>
* src/frontends/xforms/forms/form_citation.fd: object sizes are
now set here
* src/frontends/Dialogs.h: removed hideCitation signal
* src/insets/insetcite.h: added hide signal
* src/insets/insetcite.C (~InsetCitation): emits new signal
(getScreenLabel): "intelligent" label should now fit on the screen!
* src/frontends/xforms/FormCitation.[Ch] (hideInset): removed
* src/frontends/xforms/FormCitation.C (showInset): connects
hide() to the inset's hide signal
(show): modified to use fl_set_object_position rather than
fl_set_object_geometry wherever possible
2000-07-18 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/insets/lyxinset.h: add caption code

View File

@ -113,8 +113,6 @@ public:
///
Signal1<void, string const &> createCitation;
///
Signal1<void, InsetCitation *> hideCitation;
///
Signal1<void, InsetBibtex *> showBibtex;
///
Signal1<void, InsetInfo *> showInfo;

View File

@ -48,7 +48,6 @@ FormCitation::FormCitation(LyXView * lv, Dialogs * d)
// storing a copy because we won't be disconnecting.
d->showCitation.connect(slot(this, &FormCitation::showInset));
d->createCitation.connect(slot(this, &FormCitation::createInset));
d->hideCitation.connect(slot(this, &FormCitation::hideInset));
}
@ -69,6 +68,7 @@ void FormCitation::showInset( InsetCitation * inset )
if( dialogIsOpen || inset == 0 ) return;
inset_ = inset;
ih_ = inset_->hide.connect(slot(this, &FormCitation::hide));
textAfter = inset->getOptions();
updateCitekeys(inset->getContents());
@ -94,15 +94,6 @@ void FormCitation::createInset( string const & arg )
}
void FormCitation::hideInset(InsetCitation * ti)
{
if (inset_ == ti) {
inset_ = 0;
hide();
}
}
void FormCitation::show()
{
if (!dialog_) {
@ -277,13 +268,14 @@ void FormCitation::setSize( int brsrHeight, bool bibPresent ) const
ypos += 30;
fl_set_object_geometry( dialog_->citeBrsr, 10, ypos, 180, brsrHeight );
fl_set_object_geometry( dialog_->bibBrsr, 240, ypos, 180, brsrHeight );
fl_set_object_geometry( dialog_->addBtn, 200, ypos, 30, 30 );
fl_set_object_position( dialog_->addBtn, 200, ypos );
ypos += 35;
fl_set_object_geometry( dialog_->delBtn, 200, ypos, 30, 30 );
fl_set_object_position( dialog_->delBtn, 200, ypos );
ypos += 35;
fl_set_object_geometry( dialog_->upBtn, 200, ypos, 30, 30 );
fl_set_object_position( dialog_->upBtn, 200, ypos );
ypos += 35;
fl_set_object_geometry( dialog_->downBtn, 200, ypos, 30, 30 );
fl_set_object_position( dialog_->downBtn, 200, ypos );
ypos = brsrHeight+30; // base of Citation/Bibliography browsers
@ -292,7 +284,7 @@ void FormCitation::setSize( int brsrHeight, bool bibPresent ) const
if( bibPresent ) {
ypos += 30;
fl_set_object_geometry( dialog_->infoBrsr, 10, ypos, 410, infoHeight );
fl_set_object_position( dialog_->infoBrsr, 10, ypos );
fl_show_object( dialog_->infoBrsr );
ypos += infoHeight;
}
@ -304,9 +296,8 @@ void FormCitation::setSize( int brsrHeight, bool bibPresent ) const
fl_hide_object( dialog_->textBefore );
fl_set_object_position( dialog_->textAftr, 100, ypos );
// fl_set_object_geometry( dialog_->textAftr, 100, ypos, 250, 30 );
fl_set_object_geometry( dialog_->ok, 230, ypos+50, 90, 30 );
fl_set_object_geometry( dialog_->cancel, 330, ypos+50, 90, 30 );
fl_set_object_position( dialog_->ok, 230, ypos+50 );
fl_set_object_position( dialog_->cancel, 330, ypos+50 );
}
@ -490,6 +481,7 @@ void FormCitation::hide()
// free up the dialog for another inset
inset_ = 0;
ih_.disconnect();
dialogIsOpen = false;
}

View File

@ -64,8 +64,6 @@ private:
///
void showInset( InsetCitation * );
///
void hideInset( InsetCitation * );
///
void show();
/// Hide the dialog.
void hide();
@ -114,6 +112,8 @@ private:
Connection u_;
/// Hide connection.
Connection h_;
/// inset::hide connection.
Connection ih_;
///
InsetCitation * inset_;
///

View File

@ -17,29 +17,29 @@ FD_form_citation * FormCitation::build_citation()
fdui->form_citation = fl_bgn_form(FL_NO_BOX, 450, 780);
fdui->form_citation->u_vdata = this;
fdui->box = obj = fl_add_box(FL_UP_BOX, 0, 0, 450, 780, "");
fdui->box = obj = fl_add_box(FL_UP_BOX, 0, 0, 430, 780, "");
fl_set_object_resize(obj, FL_RESIZE_X);
fdui->citeBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 20, 40, 170, 370, _("Inset keys"));
fdui->citeBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 30, 180, 370, _("Inset keys"));
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
fl_set_object_resize(obj, FL_RESIZE_X);
fl_set_object_callback(obj, C_FormCitationInputCB, CITEBRSR);
fdui->bibBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 250, 40, 170, 370, _("Bibliography keys"));
fdui->bibBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 240, 30, 180, 370, _("Bibliography keys"));
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
fl_set_object_resize(obj, FL_RESIZE_X);
fl_set_object_callback(obj, C_FormCitationInputCB, BIBBRSR);
fdui->addBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 40, 40, 40, _("@4->"));
fdui->addBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 30, 30, 30, _("@4->"));
fl_set_object_resize(obj, FL_RESIZE_NONE);
fl_set_object_callback(obj, C_FormCitationInputCB, ADD);
fdui->delBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 90, 40, 40, _("@9+"));
fdui->delBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 65, 30, 30, _("@9+"));
fl_set_object_resize(obj, FL_RESIZE_NONE);
fl_set_object_callback(obj, C_FormCitationInputCB, DELETE);
fdui->upBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 140, 40, 40, _("@8->"));
fdui->upBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 100, 30, 30, _("@8->"));
fl_set_object_resize(obj, FL_RESIZE_NONE);
fl_set_object_callback(obj, C_FormCitationInputCB, UP);
fdui->downBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 190, 40, 40, _("@2->"));
fdui->downBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 135, 30, 30, _("@2->"));
fl_set_object_resize(obj, FL_RESIZE_NONE);
fl_set_object_callback(obj, C_FormCitationInputCB, DOWN);
fdui->infoBrsr = obj = fl_add_browser(FL_NORMAL_BROWSER, 20, 440, 400, 110, _("Info"));
fdui->infoBrsr = obj = fl_add_browser(FL_NORMAL_BROWSER, 10, 440, 430, 110, _("Info"));
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
fl_set_object_resize(obj, FL_RESIZE_X);
fdui->style = obj = fl_add_choice(FL_NORMAL_CHOICE, 160, 570, 130, 30, _("Citation style"));
@ -49,10 +49,10 @@ FD_form_citation * FormCitation::build_citation()
fl_set_object_resize(obj, FL_RESIZE_X);
fdui->textAftr = obj = fl_add_input(FL_NORMAL_INPUT, 100, 660, 250, 30, _("Text after"));
fl_set_object_resize(obj, FL_RESIZE_X);
fdui->ok = obj = fl_add_button(FL_RETURN_BUTTON, 190, 730, 110, 40, _("OK"));
fdui->ok = obj = fl_add_button(FL_RETURN_BUTTON, 230, 730, 90, 30, _("OK"));
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, C_FormCitationOKCB, 0);
fdui->cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 730, 110, 40, _("Cancel"));
fdui->cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 330, 730, 90, 30, _("Cancel"));
fl_set_button_shortcut(obj, _("^["), 1);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, C_FormCitationCancelCB, 0);

View File

@ -1,4 +1,4 @@
/** Header file generated with fdesign on Fri Jul 14 09:35:06 2000.**/
/** Header file generated with fdesign on Wed Jul 19 09:20:42 2000.**/
#ifndef FD_form_citation_h_
#define FD_form_citation_h_

View File

@ -15,7 +15,7 @@ Number of Objects: 13
--------------------
class: FL_BOX
type: UP_BOX
box: 0 0 450 780
box: 0 0 430 780
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -33,7 +33,7 @@ argument:
--------------------
class: FL_BROWSER
type: HOLD_BROWSER
box: 20 40 170 370
box: 10 30 180 370
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_TOP_LEFT
@ -51,7 +51,7 @@ argument: CITEBRSR
--------------------
class: FL_BROWSER
type: HOLD_BROWSER
box: 250 40 170 370
box: 240 30 180 370
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_TOP_LEFT
@ -69,7 +69,7 @@ argument: BIBBRSR
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 200 40 40 40
box: 200 30 30 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -87,7 +87,7 @@ argument: ADD
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 200 90 40 40
box: 200 65 30 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -105,7 +105,7 @@ argument: DELETE
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 200 140 40 40
box: 200 100 30 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -123,7 +123,7 @@ argument: UP
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 200 190 40 40
box: 200 135 30 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -141,7 +141,7 @@ argument: DOWN
--------------------
class: FL_BROWSER
type: NORMAL_BROWSER
box: 20 440 400 110
box: 10 440 430 110
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_TOP_LEFT
@ -213,7 +213,7 @@ argument:
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
box: 190 730 110 40
box: 230 730 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -231,7 +231,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 310 730 110 40
box: 330 730 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER

View File

@ -18,34 +18,51 @@
#include "LyXView.h"
#include "BufferView.h"
#include "frontends/Dialogs.h"
#include "support/lstrings.h"
InsetCitation::InsetCitation(string const & key, string const & note)
: InsetCommand("cite", key, note), dialogs_(0)
: InsetCommand("cite", key, note)
{}
InsetCitation::~InsetCitation()
{
if( dialogs_ != 0 )
dialogs_->hideCitation( this );
hide();
}
string InsetCitation::getScreenLabel() const
{
string temp("[");
temp += getContents();
string keys(getContents());
if( !getOptions().empty() ) {
temp += ", " + getOptions();
// If keys is "too long" then only print out the first few tokens
string label;
if( contains( keys, "," ) ) {
// Final comma allows while loop to cover all keys
keys = frontStrip( split( keys, label, ',' ) ) + ",";
const int maxSize( 40 );
while( contains( keys, "," ) ) {
string key;
keys = frontStrip( split( keys, key, ',' ) );
int size = label.size() + 2 + key.size();
if( size >= maxSize ) {
label += ", ...";
break;
}
label += ", " + key;
}
} else {
label = keys;
}
return temp + ']';
if( !getOptions().empty() )
label += ", " + getOptions();
return '[' + label + ']';
}
void InsetCitation::Edit(BufferView * bv, int, int, unsigned int)
{
dialogs_ = bv->owner()->getDialogs();
dialogs_->showCitation( this );
bv->owner()->getDialogs()->showCitation( this );
}

View File

@ -16,6 +16,8 @@
#endif
#include "insetcommand.h"
#include <sigc++/signal_system.h>
class Dialogs;
/** Used to insert citations
@ -37,11 +39,8 @@ public:
EDITABLE Editable() const { return IS_EDITABLE; }
///
void Edit(BufferView *, int, int, unsigned int);
private:
///
//InsetCitation() : InsetCommand("cite"), dialogs_(0) {}
///
Dialogs * dialogs_;
SigC::Signal0<void> hide;
};
#endif // INSET_CITE_H

View File

@ -90,7 +90,7 @@ InsetFloat::InsetFloat(string const & type)
font.setColor(LColor::footnote);
setLabelFont(font);
setAutoCollapse(false);
setInsetName("Float");
// setInsetName("Float");
floatType = type;
setInsetName(type.c_str());
//floatPlacement = "H";
@ -99,8 +99,8 @@ InsetFloat::InsetFloat(string const & type)
void InsetFloat::Write(Buffer const * buf, ostream & os) const
{
os << getInsetName()
<< " " << floatType << '\n';
os << "Float " // getInsetName()
<< floatType << '\n';
if (floatPlacement.empty()) {
os << "placement "

View File

@ -1425,3 +1425,10 @@ void InsetTabular::resizeLyXText(BufferView *) const
{
need_update = FULL;
}
LyXText * InsetTabular::getLyXText(BufferView * bv) const
{
if (the_locking_inset)
return the_locking_inset->getLyXText(bv);
return Inset::getLyXText(bv);
}

View File

@ -158,6 +158,7 @@ public:
///
Buffer * BufferOwner() const { return buffer; }
///
LyXText * getLyXText(BufferView *) const;
void resizeLyXText(BufferView *) const;
///

View File

@ -1404,18 +1404,23 @@ bool UpdateLayoutParagraph()
}
Buffer * buf = current_view->buffer();
LyXText * text = 0;
if (current_view->the_locking_inset)
text = current_view->the_locking_inset->getLyXText(current_view);
if (!text)
text = current_view->text;
fl_set_input(fd_form_paragraph->input_labelwidth,
current_view->text->cursor.par()->GetLabelWidthString().c_str());
text->cursor.par()->GetLabelWidthString().c_str());
fl_set_button(fd_form_paragraph->radio_align_right, 0);
fl_set_button(fd_form_paragraph->radio_align_left, 0);
fl_set_button(fd_form_paragraph->radio_align_center, 0);
fl_set_button(fd_form_paragraph->radio_align_block, 0);
int align = current_view->text->cursor.par()->GetAlign();
int align = text->cursor.par()->GetAlign();
if (align == LYX_ALIGN_LAYOUT)
align = textclasslist.Style(buf->params.textclass,
current_view->text->cursor.par()->GetLayout()).align;
text->cursor.par()->GetLayout()).align;
switch (align) {
case LYX_ALIGN_RIGHT:
@ -1433,18 +1438,18 @@ bool UpdateLayoutParagraph()
}
fl_set_button(fd_form_paragraph->check_lines_top,
current_view->text->cursor.par()->FirstPhysicalPar()->line_top);
text->cursor.par()->FirstPhysicalPar()->line_top);
fl_set_button(fd_form_paragraph->check_lines_bottom,
current_view->text->cursor.par()->FirstPhysicalPar()->line_bottom);
text->cursor.par()->FirstPhysicalPar()->line_bottom);
fl_set_button(fd_form_paragraph->check_pagebreaks_top,
current_view->text->cursor.par()->FirstPhysicalPar()->pagebreak_top);
text->cursor.par()->FirstPhysicalPar()->pagebreak_top);
fl_set_button(fd_form_paragraph->check_pagebreaks_bottom,
current_view->text->cursor.par()->FirstPhysicalPar()->pagebreak_bottom);
text->cursor.par()->FirstPhysicalPar()->pagebreak_bottom);
fl_set_button(fd_form_paragraph->check_noindent,
current_view->text->cursor.par()->FirstPhysicalPar()->noindent);
text->cursor.par()->FirstPhysicalPar()->noindent);
fl_set_input (fd_form_paragraph->input_space_above, "");
switch (current_view->text->cursor.par()->FirstPhysicalPar()->added_space_top.kind()) {
switch (text->cursor.par()->FirstPhysicalPar()->added_space_top.kind()) {
case VSpace::NONE:
fl_set_choice (fd_form_paragraph->choice_space_above, 1);
break;
@ -1466,13 +1471,13 @@ bool UpdateLayoutParagraph()
case VSpace::LENGTH:
fl_set_choice (fd_form_paragraph->choice_space_above, 7);
fl_set_input (fd_form_paragraph->input_space_above,
current_view->text->cursor.par()->FirstPhysicalPar()->added_space_top.length().asString().c_str());
text->cursor.par()->FirstPhysicalPar()->added_space_top.length().asString().c_str());
break;
}
fl_set_button (fd_form_paragraph->check_space_above,
current_view->text->cursor.par()->FirstPhysicalPar()->added_space_top.keep());
text->cursor.par()->FirstPhysicalPar()->added_space_top.keep());
fl_set_input (fd_form_paragraph->input_space_below, "");
switch (current_view->text->cursor.par()->FirstPhysicalPar()->added_space_bottom.kind()) {
switch (text->cursor.par()->FirstPhysicalPar()->added_space_bottom.kind()) {
case VSpace::NONE:
fl_set_choice (fd_form_paragraph->choice_space_below,
1);
@ -1501,14 +1506,14 @@ bool UpdateLayoutParagraph()
fl_set_choice (fd_form_paragraph->choice_space_below,
7);
fl_set_input (fd_form_paragraph->input_space_below,
current_view->text->cursor.par()->FirstPhysicalPar()->added_space_bottom.length().asString().c_str());
text->cursor.par()->FirstPhysicalPar()->added_space_bottom.length().asString().c_str());
break;
}
fl_set_button (fd_form_paragraph->check_space_below,
current_view->text->cursor.par()->FirstPhysicalPar()->added_space_bottom.keep());
text->cursor.par()->FirstPhysicalPar()->added_space_bottom.keep());
fl_set_button(fd_form_paragraph->check_noindent,
current_view->text->cursor.par()->FirstPhysicalPar()->noindent);
text->cursor.par()->FirstPhysicalPar()->noindent);
if (current_view->buffer()->isReadonly()) {
DisableParagraphLayout();
@ -2130,7 +2135,12 @@ extern "C" void ParagraphApplyCB(FL_OBJECT *, long)
labelwidthstring = fl_get_input(fd_form_paragraph->input_labelwidth);
noindent = fl_get_button(fd_form_paragraph->check_noindent);
current_view->text->SetParagraph(current_view,
LyXText * text = 0;
if (current_view->the_locking_inset)
text = current_view->the_locking_inset->getLyXText(current_view);
if (!text)
text = current_view->text;
text->SetParagraph(current_view,
line_top,
line_bottom,
pagebreak_top,