+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
///
Signal1<void, string const &> createCitation;
///
- Signal1<void, InsetCitation *> hideCitation;
- ///
Signal1<void, InsetBibtex *> showBibtex;
///
Signal1<void, InsetInfo *> showInfo;
// 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));
}
if( dialogIsOpen || inset == 0 ) return;
inset_ = inset;
+ ih_ = inset_->hide.connect(slot(this, &FormCitation::hide));
textAfter = inset->getOptions();
updateCitekeys(inset->getContents());
}
-void FormCitation::hideInset(InsetCitation * ti)
-{
- if (inset_ == ti) {
- inset_ = 0;
- hide();
- }
-}
-
-
void FormCitation::show()
{
if (!dialog_) {
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
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;
}
// awaiting natbib support
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_->textAftr, 100, ypos );
+ fl_set_object_position( dialog_->ok, 230, ypos+50 );
+ fl_set_object_position( dialog_->cancel, 330, ypos+50 );
}
// free up the dialog for another inset
inset_ = 0;
+ ih_.disconnect();
dialogIsOpen = false;
}
///
void showInset( InsetCitation * );
///
- void hideInset( InsetCitation * );
- ///
void show();
/// Hide the dialog.
void hide();
Connection u_;
/// Hide connection.
Connection h_;
+ /// inset::hide connection.
+ Connection ih_;
///
InsetCitation * inset_;
///
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"));
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);
-/** 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_
--------------------
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
--------------------
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
--------------------
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
--------------------
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
--------------------
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
--------------------
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
--------------------
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
--------------------
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
--------------------
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
--------------------
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
#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 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, ',' ) ) + ",";
- if( !getOptions().empty() ) {
- temp += ", " + getOptions();
+ 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 );
}
#endif
#include "insetcommand.h"
+#include <sigc++/signal_system.h>
+
class Dialogs;
/** Used to insert citations
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
font.setColor(LColor::footnote);
setLabelFont(font);
setAutoCollapse(false);
- setInsetName("Float");
+// setInsetName("Float");
floatType = type;
setInsetName(type.c_str());
//floatPlacement = "H";
void InsetFloat::Write(Buffer const * buf, ostream & os) const
{
- os << getInsetName()
- << " " << floatType << '\n';
+ os << "Float " // getInsetName()
+ << floatType << '\n';
if (floatPlacement.empty()) {
os << "placement "
{
need_update = FULL;
}
+
+LyXText * InsetTabular::getLyXText(BufferView * bv) const
+{
+ if (the_locking_inset)
+ return the_locking_inset->getLyXText(bv);
+ return Inset::getLyXText(bv);
+}
///
Buffer * BufferOwner() const { return buffer; }
///
+ LyXText * getLyXText(BufferView *) const;
void resizeLyXText(BufferView *) const;
///
}
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:
}
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;
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);
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();
labelwidthstring = fl_get_input(fd_form_paragraph->input_labelwidth);
noindent = fl_get_button(fd_form_paragraph->check_noindent);
- current_view->text->SetParagraph(current_view,
- line_top,
- line_bottom,
- pagebreak_top,
- pagebreak_bottom,
- space_top,
- space_bottom,
- align,
- labelwidthstring,
- noindent);
+ 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,
+ pagebreak_bottom,
+ space_top,
+ space_bottom,
+ align,
+ labelwidthstring,
+ noindent);
current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
current_view->owner()->getMiniBuffer()->Set(_("Paragraph layout set"));
}