+2001-05-09 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * paragraph.C (String): use stringstream
+
2001-05-08 Lars Gullik Bjønnes <larsbj@birdstep.com>
* paragraph.C (writeFile): remove footflag arg
if (! tclass.provides(LyXTextClass::makeidx)
&& params.language->babel() != "french") // french provides
// \index !
+ // French should not be hardcoded. (Lgb)
packages << "\\usepackage{makeidx}\n";
packages << "\\makeindex\n";
}
// floats
getFloatDefinitions(macros);
-#if 0
- // Here we will output the code to create the needed float styles.
- // We will try to do this as minimal as possible.
- // \floatstyle{ruled}
- // \newfloat{algorithm}{htbp}{loa}
- // \floatname{algorithm}{Algorithm}
- UsedFloats::const_iterator cit = usedFloats.begin();
- UsedFloats::const_iterator end = usedFloats.end();
- ostringstream floats;
- for (; cit != end; ++cit) {
- Floating const & fl = floatList.getType((*cit));
-
- // For builtin floats we do nothing.
- if (fl.builtin()) continue;
-
- // We have to special case "table" and "figure"
- if (fl.type() == "tabular" || fl.type() == "figure") {
- // Output code to modify "table" or "figure"
- // but only if builtin == false
- } else {
- // The other non builtin floats.
-
- string type = fl.type();
- string placement = fl.placement();
- string ext = fl.ext();
- string within = fl.within();
- string style = fl.style();
- string name = fl.name();
- floats << "\\floatstyle{" << style << "}\n"
- << "\\newfloat{" << type << "}{" << placement
- << "}{" << ext << "}";
- if (!within.empty())
- floats << "[" << within << "]";
- floats << "\n"
- << "\\floatname{" << type << "}{"
- << name << "}\n";
-
- // What missing here is to code to minimalize the code
- // outputted so that the same flotastyle will not be
- // used several times. when the same style is still in
- // effect. (Lgb)
- }
- }
- macros += floats.str().c_str();
-#endif
-
for (LanguageList::const_iterator cit = UsedLanguages.begin();
cit != UsedLanguages.end(); ++cit)
if (!(*cit)->latex_options().empty())
fi != end; ++fi)
sgmlpreamble << "\n<!ENTITY " << fi->first
<< (IsSGMLFilename(fi->second) ? " SYSTEM \"" : " \"" )
- << MakeRelPath(fi->second,basename) << "\">";
+ << MakeRelPath(fi->second, basename) << "\">";
return sgmlpreamble.str().c_str();
}
-void LaTeXFeatures::showStruct() const{
+void LaTeXFeatures::showStruct() const {
lyxerr << "LyX needs the following commands when LaTeXing:"
<< "\n***** Packages:" << getPackages()
<< "\n***** Macros:" << getMacros()
if (tokenPos(tclass.opt_fontsize(),
'|', params.fontsize) >= 0) {
// only write if existing in list (and not default)
- options << params.fontsize;
- options << "pt,";
+ options << params.fontsize << "pt,";
}
void markDepClean(string const & name);
///
- void setUnnamed(bool flag=true);
+ void setUnnamed(bool flag = true);
///
bool isUnnamed();
// No need to compare depth.
}
+
///
inline
bool operator==(Buffer::inset_iterator const & iter1,
&& (iter1.par == 0 || iter1.it == iter2.it);
}
+
///
inline
bool operator!=(Buffer::inset_iterator const & iter1,
return !(iter1 == iter2);
}
#endif
-
+2001-05-09 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * FormParagraph.C: remove !NEW_INSETS and !NO_PEXTRA cruft
+ * paradlg.[Ch]: ditto
+
2001-04-17 Lars Gullik Bjønnes <larsbj@birdstep.com>
* dlg/emptytable.h: C++ mode, inhrit privately from noncopyable
if (align==LYX_ALIGN_LAYOUT)
align = textclasslist.Style(buf->params.textclass, par->GetLayout()).align;
-#ifndef NEW_INSETS
- LyXParagraph const * physpar = par->FirstPhysicalPar();
-#else
LyXParagraph const * physpar = par;
-#endif
if (physpar->params.spaceTop().kind() == VSpace::LENGTH) {
LyXGlueLength above = physpar->params.spaceTop().length();
physpar->params.spaceBottom().kind(),
physpar->params.spaceTop().keep(),
physpar->params.spaceBottom().keep());
-
-#ifndef NO_PEXTRA
- // now the extras page
-
- LyXLength extrawidth;
- float val = 0.0;
- LyXLength::UNIT unit = LyXLength::CM;
-
- if (isValidLength(par->params.pextraWidth(), &extrawidth)) {
- lyxerr[Debug::GUI] << "Reading extra width \"" << extrawidth.asString() << "\"" << endl;
- val = extrawidth.value();
- unit = extrawidth.unit();
- }
-
- lyxerr[Debug::GUI] << "Reading widthp \"" << par->params.pextraWidthp() << "\"" << endl;
-
- dialog_->setExtra(val, unit, par->params.pextraWidthp(),
- par->params.pextraAlignment(),
- par->params.pextraHfill(),
- par->params.pextraStartMinipage(),
- static_cast<LyXParagraph::PEXTRA_TYPE>
- (par->params.pextraType()));
-#endif // NO_PEXTRA
}
spaceabove, spacebelow, dialog_->getAlign(),
dialog_->getLabelWidth(), dialog_->getNoIndent());
-#ifndef NO_PEXTRA
- // extra stuff
-
- string width("");
- string widthp("");
-
- LyXLength extrawidth(dialog_->getExtraWidth());
- if (extrawidth.unit() == LyXLength::UNIT_NONE) {
- widthp = dialog_->getExtraWidthPercent();
- } else
- width = extrawidth.asString();
-
- lyxerr[Debug::GUI] << "Setting extrawidth \"" << width << "\"" << endl;
- lyxerr[Debug::GUI] << "Setting percent extrawidth \"" << widthp << "\"" << endl;
-
- lv_->view()->text->SetParagraphExtraOpt(lv_->view(),
- dialog_->getExtraType(), width, widthp,
- dialog_->getExtraAlign(),
- dialog_->getHfillBetween(),
- dialog_->getStartNewMinipage());
-#endif // NO_PEXTRA
-
lv_->view()->update(lv_->view()->text,
BufferView::SELECT |
BufferView::FITCUR |
void FormParagraph::show()
{
if (!dialog_)
- dialog_ = new ParaDialog(this, 0, _("LyX: Paragraph Options"), false);
+ dialog_ = new ParaDialog(this, 0,
+ _("LyX: Paragraph Options"), false);
if (!dialog_->isVisible())
- h_ = d_->hideBufferDependent.connect(slot(this, &FormParagraph::hide));
+ h_ = d_->hideBufferDependent
+ .connect(slot(this, &FormParagraph::hide));
dialog_->raise();
dialog_->setActiveWindow();
generalpage = new ParaGeneralDialog(this, "generalpage");
tabstack->addTabPage(generalpage, _("&General"));
-#ifndef NO_PEXTRA
- extrapage = new ParaExtraDialog(this, "extrapage");
- tabstack->addTabPage(extrapage, _("&Extra"));
-#endif
setUpdatesEnabled(true);
update();
}
-#ifndef NO_PEXTRA
-void ParaDialog::setExtra(float widthval, LyXLength::UNIT units, const string percent, int align,
- bool hfill, bool startminipage, LyXParagraph::PEXTRA_TYPE type)
-{
- if (type!=LyXParagraph::PEXTRA_NONE) {
- lyxerr[Debug::GUI] << "percent : $" << percent << "$ widthval " << widthval << " unit " << long(units) << endl;
- if (percent != "") {
- extrapage->line_widthvalue->setText(percent.c_str());
- extrapage->combo_widthvalueunits->setCurrentItem(11);
- } else {
- int unit = 0;
- extrapage->line_widthvalue->setText(tostr(widthval).c_str());
- switch (units) {
- case LyXLength::CM: unit = 0; break;
- case LyXLength::IN: unit = 1; break;
- case LyXLength::PT: unit = 2; break;
- case LyXLength::MM: unit = 3; break;
- case LyXLength::PC: unit = 4; break;
- case LyXLength::EX: unit = 5; break;
- case LyXLength::EM: unit = 6; break;
- case LyXLength::SP: unit = 7; break;
- case LyXLength::BP: unit = 8; break;
- case LyXLength::DD: unit = 9; break;
- case LyXLength::CC: unit = 10; break;
- case LyXLength::MU: unit = 0; break;
- case LyXLength::UNIT_NONE: unit = 0; break;
- default:
- lyxerr[Debug::GUI] << "Unknown unit " << long(units) << endl;
- }
- extrapage->combo_widthvalueunits->setCurrentItem(unit);
- }
- } else
- extrapage->line_widthvalue->setText("");
-
- switch (align) {
- case LyXParagraph::MINIPAGE_ALIGN_TOP:
- extrapage->radio_top->setChecked(true);
- break;
- case LyXParagraph::MINIPAGE_ALIGN_MIDDLE:
- extrapage->radio_middle->setChecked(true);
- break;
- case LyXParagraph::MINIPAGE_ALIGN_BOTTOM:
- extrapage->radio_bottom->setChecked(true);
- break;
- }
-
- extrapage->check_hfillbetween->setChecked(hfill);
- extrapage->check_startnewminipage->setChecked(startminipage);
-
- extrapage->specialalignment->setEnabled(type==LyXParagraph::PEXTRA_MINIPAGE);
- extrapage->radio_top->setEnabled(type==LyXParagraph::PEXTRA_MINIPAGE);
- extrapage->radio_middle->setEnabled(type==LyXParagraph::PEXTRA_MINIPAGE);
- extrapage->radio_bottom->setEnabled(type==LyXParagraph::PEXTRA_MINIPAGE);
- extrapage->line_widthvalue->setEnabled(type!=LyXParagraph::PEXTRA_NONE);
- extrapage->combo_widthvalueunits->setEnabled(type!=LyXParagraph::PEXTRA_NONE);
- extrapage->check_hfillbetween->setEnabled(type==LyXParagraph::PEXTRA_MINIPAGE);
- extrapage->check_startnewminipage->setEnabled(type==LyXParagraph::PEXTRA_MINIPAGE);
-
- switch (type) {
- case LyXParagraph::PEXTRA_NONE:
- extrapage->combo_type->setCurrentItem(0);
- break;
- case LyXParagraph::PEXTRA_INDENT:
- extrapage->combo_type->setCurrentItem(1);
- break;
- case LyXParagraph::PEXTRA_MINIPAGE:
- extrapage->combo_type->setCurrentItem(2);
- break;
- case LyXParagraph::PEXTRA_FLOATFLT:
- extrapage->combo_type->setCurrentItem(3);
- break;
- }
-}
-#endif // NO_PEXTRA
-
-
LyXGlueLength ParaDialog::getAboveLength() const
{
LyXGlueLength len(
return len;
}
-
-
-#ifndef NO_PEXTRA
-LyXLength ParaDialog::getExtraWidth() const
-{
-
- if (extrapage->combo_widthvalueunits->currentItem() != 11) {
- LyXLength::UNIT unit = LyXLength::CM;
- switch (extrapage->combo_widthvalueunits->currentItem()) {
- case 0: unit = LyXLength::CM; break;
- case 1: unit = LyXLength::IN; break;
- case 2: unit = LyXLength::PT; break;
- case 3: unit = LyXLength::MM; break;
- case 4: unit = LyXLength::PC; break;
- case 5: unit = LyXLength::EX; break;
- case 6: unit = LyXLength::EM; break;
- case 7: unit = LyXLength::SP; break;
- case 8: unit = LyXLength::BP; break;
- case 9: unit = LyXLength::DD; break;
- case 10: unit = LyXLength::CC; break;
- case 11: unit = LyXLength::CM; break;
- default:
- lyxerr[Debug::GUI] << "Unknown unit " << extrapage->combo_widthvalueunits->currentItem() << endl;
- }
- LyXLength len(strToDbl(extrapage->line_widthvalue->text()), unit);
- return len;
- } else {
- LyXLength len(0.0, LyXLength::UNIT_NONE);
- return len;
- }
-}
-
-
-string ParaDialog::getExtraWidthPercent() const
-{
- double val = strToDbl(extrapage->line_widthvalue->text());
- if (val > 100.0)
- val = 100.0;
- if (val < 0.0)
- val = 0.0;
- return tostr(val);
-}
-#endif // NO_PEXTRA
void setSpace(VSpace::vspace_kind, VSpace::vspace_kind, bool, bool);
void setAboveLength(float, float, float, LyXGlueLength::UNIT, LyXGlueLength::UNIT, LyXGlueLength::UNIT);
void setBelowLength(float, float, float, LyXGlueLength::UNIT, LyXGlueLength::UNIT, LyXGlueLength::UNIT);
-#ifndef NO_PEXTRA
- void setExtra(float, LyXGlueLength::UNIT, const string, int, bool, bool, LyXParagraph::PEXTRA_TYPE);
-#endif
char const * getLabelWidth() const {
return generalpage->line_labelwidth->text();
LyXGlueLength getAboveLength() const;
LyXGlueLength getBelowLength() const;
-#ifndef NO_PEXTRA
- LyXLength getExtraWidth() const;
-
- string getExtraWidthPercent() const;
-
- LyXParagraph::PEXTRA_TYPE getExtraType() const {
- switch (extrapage->combo_type->currentItem()) {
- case 0: return LyXParagraph::PEXTRA_NONE;
- case 1: return LyXParagraph::PEXTRA_INDENT;
- case 2: return LyXParagraph::PEXTRA_MINIPAGE;
- case 3: return LyXParagraph::PEXTRA_FLOATFLT;
- }
- return LyXParagraph::PEXTRA_NONE;
- }
-
- LyXParagraph::MINIPAGE_ALIGNMENT getExtraAlign() const {
- if (extrapage->radio_top->isChecked())
- return LyXParagraph::MINIPAGE_ALIGN_TOP;
- if (extrapage->radio_middle->isChecked())
- return LyXParagraph::MINIPAGE_ALIGN_MIDDLE;
- return LyXParagraph::MINIPAGE_ALIGN_BOTTOM;
- }
-
- bool getHfillBetween() const {
- return extrapage->check_hfillbetween->isChecked();
- }
-
- bool getStartNewMinipage() const {
- return extrapage->check_startnewminipage->isChecked();
- }
-#endif
-
protected:
void closeEvent(QCloseEvent * e);
/// the general tab page
ParaGeneralDialog * generalpage;
-#ifndef NO_PEXTRA
- /// the extra options tab page
- ParaExtraDialog * extrapage;
-#endif
VSpace::vspace_kind getSpaceKind(int val) const {
switch (val) {
+2001-05-09 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * FormParagraph.C: remove !NEW_INSETS and !NO_PEXTRA cruft
+
2001-04-03 John Levon <moz@compsoc.man.ac.uk>
* FormCharacter.C:
using Liason::setMinibuffer;
using std::endl;
+
FormParagraph::FormParagraph(LyXView *v, Dialogs *d)
: dialog_(0), lv_(v), d_(d), h_(0)
{
d->showLayoutParagraph.connect(slot(this, &FormParagraph::show));
}
+
FormParagraph::~FormParagraph()
{
delete dialog_;
}
+
void FormParagraph::update(bool switched)
{
if (switched) {
if (!lv_->view()->available())
return;
- Buffer *buf = lv_->view()->buffer();
+ Buffer * buf = lv_->view()->buffer();
if (readonly!=buf->isReadonly()) {
readonly = buf->isReadonly();
dialog_->setReadOnly(readonly);
}
- LyXText *text = 0;
+ LyXText * text = 0;
if (lv_->view()->theLockingInset())
text = lv_->view()->theLockingInset()->getLyXText(lv_->view());
if (!text)
text = lv_->view()->text;
- LyXParagraph *par = text->cursor.par();
+ LyXParagraph * par = text->cursor.par();
int align = par->GetAlign();
if (align==LYX_ALIGN_LAYOUT)
align = textclasslist.Style(buf->params.textclass, par->GetLayout()).align;
-#ifndef NEW_INSETS
- ParagraphParameters *params = &(par->FirstPhysicalPar()->params);
-#else
ParagraphParameters *params = &(par->params);
-#endif
if (params->spaceTop().kind() == VSpace::LENGTH) {
LyXGlueLength above = params->spaceTop().length();
static_cast<LyXParagraph::PEXTRA_TYPE>(params->pextraType()));
}
+
void FormParagraph::apply()
{
if (readonly)
lyxerr[Debug::GUI] << "Setting extrawidth \"" << width << "\"" << endl;
lyxerr[Debug::GUI] << "Setting percent extrawidth \"" << widthp << "\"" << endl;
-#ifndef NO_PEXTRA
- lv_->view()->text->SetParagraphExtraOpt(lv_->view(),
- dialog_->getExtraType(), width, widthp,
- dialog_->getExtraAlign(),
- dialog_->getHfillBetween(),
- dialog_->getStartNewMinipage());
-#endif
lv_->view()->update(lv_->view()->text,
BufferView::SELECT |
BufferView::FITCUR |
setMinibuffer(lv_, _("Paragraph layout set"));
}
+
void FormParagraph::show()
{
if (!dialog_)
- dialog_ = new ParagraphDlgImpl(this, 0, _("LyX: Paragraph Options"), false);
+ dialog_ = new ParagraphDlgImpl(this, 0,
+ _("LyX: Paragraph Options"),
+ false);
if (!dialog_->isVisible())
- h_ = d_->hideBufferDependent.connect(slot(this, &FormParagraph::hide));
-
+ h_ = d_->hideBufferDependent
+ .connect(slot(this, &FormParagraph::hide));
dialog_->raise();
dialog_->setActiveWindow();
dialog_->show();
}
+
void FormParagraph::close()
{
h_.disconnect();
}
+
void FormParagraph::hide()
{
dialog_->hide();
LyXLayout const & style =
textclasslist.Style(bparams.textclass,
GetLayout());
- LyXFont basefont, last_font;
+ LyXFont basefont;
// Maybe we have to create a optional argument.
size_type main_body;
// Fully instantiated font
LyXFont font = getFont(bparams, i);
- last_font = running_font;
+ LyXFont last_font = running_font;
// Spaces at end of font change are simulated to be
// outside font change, i.e. we write "\textXX{text} "
LyXParagraph::size_type beg,
LyXParagraph::size_type end)
{
- string s;
+ std::ostringstream ost;
if (beg == 0 && !params.labelString().empty())
- s += params.labelString() + ' ';
+ ost << params.labelString() << ' ';
for (LyXParagraph::size_type i = beg; i < end; ++i) {
- value_type c = GetUChar(buffer->params, i);
+ value_type const c = GetUChar(buffer->params, i);
if (IsPrintable(c))
- s += c;
+ ost << c;
else if (c == META_INSET) {
- std::ostringstream ost;
GetInset(i)->Ascii(buffer, ost);
- s += ost.str().c_str();
}
}
- return s;
+ return ost.str().c_str();
}
LyXParagraph * tmppar = start;
LyXParagraph * tmppar2 = new LyXParagraph(*tmppar);
tmppar2->id(tmppar->id());
-
+
// a memory optimization: Just store the layout information
// when only edit
if (kind == Undo::EDIT){