2003-07-27 Lars Gullik Bjønnes <larsbj@gullik.net>
+ * toc.[Ch]: put namespace toc inside namespace lyx
+
+ * MenuBackend.C (expandToc2): adjust for lyx::toc
+ (expandToc): ditto
+
* lyxfunc.C (dispatch): adjust for lyx::find
* lyxfind.[hC]: get rid of namespace lyxfind introduce namespace
Menu::size_type const max_number_of_items = 25;
-void expandToc2(Menu & tomenu, toc::Toc const & toc_list,
- toc::Toc::size_type from, toc::Toc::size_type to, int depth)
+void expandToc2(Menu & tomenu,
+ lyx::toc::Toc const & toc_list,
+ lyx::toc::Toc::size_type from,
+ lyx::toc::Toc::size_type to, int depth)
{
int shortcut_count = 0;
if (to - from <= max_number_of_items) {
- for (toc::Toc::size_type i = from; i < to; ++i) {
+ for (lyx::toc::Toc::size_type i = from; i < to; ++i) {
int const action = toc_list[i].action();
string label(4 * max(0, toc_list[i].depth - depth),' ');
label += limit_string_length(toc_list[i].str);
tomenu.add(MenuItem(MenuItem::Command, label, action));
}
} else {
- toc::Toc::size_type pos = from;
+ lyx::toc::Toc::size_type pos = from;
while (pos < to) {
- toc::Toc::size_type new_pos = pos + 1;
+ lyx::toc::Toc::size_type new_pos = pos + 1;
while (new_pos < to &&
toc_list[new_pos].depth > depth)
++new_pos;
return;
}
- toc::TocList toc_list = toc::getTocList(view->buffer());
- toc::TocList::const_iterator cit = toc_list.begin();
- toc::TocList::const_iterator end = toc_list.end();
+ lyx::toc::TocList toc_list = lyx::toc::getTocList(view->buffer());
+ lyx::toc::TocList::const_iterator cit = toc_list.begin();
+ lyx::toc::TocList::const_iterator end = toc_list.end();
for (; cit != end; ++cit) {
// Handle this later
if (cit->first == "TOC")
// All the rest is for floats
Menu * menu = new Menu;
- toc::Toc::const_iterator ccit = cit->second.begin();
- toc::Toc::const_iterator eend = cit->second.end();
+ lyx::toc::Toc::const_iterator ccit = cit->second.begin();
+ lyx::toc::Toc::const_iterator eend = cit->second.end();
for (; ccit != eend; ++ccit) {
string const label = limit_string_length(ccit->str);
menu->add(MenuItem(MenuItem::Command,
2003-07-27 Lars Gullik Bjønnes <larsbj@gullik.net>
+ * ControlToc.C (goTo): adjust for lyx::toc
+ (getTypes): ditto
+ (getContents): ditto
+
* ControlThesaurus.C (replace): adjust for lyx::find
* ControlSearch.C (find): adjust for lyx::find
{}
-void ControlToc::goTo(toc::TocItem const & item)
+void ControlToc::goTo(lyx::toc::TocItem const & item)
{
item.goTo(kernel().lyxview());
}
vector<string> const ControlToc::getTypes() const
{
- return toc::getTypes(kernel().buffer());
+ return lyx::toc::getTypes(kernel().buffer());
}
-toc::Toc const ControlToc::getContents(string const & type) const
+lyx::toc::Toc const ControlToc::getContents(string const & type) const
{
- toc::Toc empty_list;
+ lyx::toc::Toc empty_list;
// This shouldn't be possible...
if (!kernel().isBufferAvailable()) {
return empty_list;
}
- toc::TocList tmp = toc::getTocList(kernel().buffer());
- toc::TocList::iterator it = tmp.find(type);
+ lyx::toc::TocList tmp = lyx::toc::getTocList(kernel().buffer());
+ lyx::toc::TocList::iterator it = tmp.find(type);
if (it == tmp.end()) {
return empty_list;
}
ControlToc(Dialog &);
/// Goto this paragraph id
- void goTo(toc::TocItem const &);
+ void goTo(lyx::toc::TocItem const &);
/// Return the list of types available
std::vector<string> const getTypes() const;
/// Given a type, returns the contents
- toc::Toc const getContents(string const & type) const;
+ lyx::toc::Toc const getContents(string const & type) const;
};
#endif // CONTROLTOC_H
+2003-07-27 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * FormToc.C (updateType): adjust for lyx::toc
+ (updateContents): ditto
+
2003-07-27 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* XPainter.C: include lyxfont.h
- * FormParagraph.C:
+ * FormParagraph.C:
* FormGraphics.C:
* FormDocument.C: adapt PAPER_* enums
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
- * XFormsMenubar.h:
+ * XFormsMenubar.h:
* XFormsMenubar.C: derives from Menubar (replaces Menubar::Pimpl)
* Menubar_pimpl.C:
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
- * XFormsToolbar.h:
+ * XFormsToolbar.h:
* XFormsToolbar.C: derives from Toolbar (replaces Toolbar::Pimpl)
* Toolbar_pimpl.C:
fl_addto_choice(dialog_->choice_toc_type, choice.c_str());
// And select the correct one
- string const type = toc::getType(controller().params().getCmdName());
+ string const type = lyx::toc::getType(controller().params().getCmdName());
fl_set_choice_text(dialog_->choice_toc_type, type.c_str());
}
return;
}
- toc::Toc const contents = controller().getContents(type);
+ lyx::toc::Toc const contents = controller().getContents(type);
// Check if all elements are the same.
if (toc_ == contents) {
fl_clear_browser(dialog_->browser_toc);
setEnabled(dialog_->browser_toc, true);
- toc::Toc::const_iterator cit = contents.begin();
- toc::Toc::const_iterator end = contents.end();
+ lyx::toc::Toc::const_iterator cit = contents.begin();
+ lyx::toc::Toc::const_iterator end = contents.end();
for (; cit != end; ++cit) {
fl_add_browser_line(dialog_->browser_toc,
cit->asString().c_str());
void updateContents();
///
- toc::Toc toc_;
+ lyx::toc::Toc toc_;
};
#endif // FORMTOC_H
+2003-07-27 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * insetwrap.C (addToToc): adjust for lyx::toc
+
+ * insetfloatlist.C (ascii): adjust for lyx::toc
+
+ * insetfloat.C (addToToc): adjust for lyx::toc
+
2003-07-27 José Matos <jamatos@fep.up.pt>
* insetnote.h (linuxdoc,docbook): update support.
}
-void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const
+void InsetFloat::addToToc(lyx::toc::TocList & toclist, Buffer const * buf) const
{
ParIterator pit(inset.paragraphs.begin(), inset.paragraphs);
ParIterator end(inset.paragraphs.end(), inset.paragraphs);
string const str =
tostr(toclist[name].size() + 1)
+ ". " + pit->asString(buf, false);
- toc::TocItem const item(pit->id(), 0 , str);
+ lyx::toc::TocItem const item(pit->id(), 0 , str);
toclist[name].push_back(item);
}
}
///
void wide(bool w, BufferParams const &);
///
- void addToToc(toc::TocList &, Buffer const *) const;
+ void addToToc(lyx::toc::TocList &, Buffer const *) const;
///
bool showInsetDialog(BufferView *) const;
///
{
os << getScreenLabel(buffer) << "\n\n";
- toc::asciiTocList(getCmdName(), buffer, os);
+ lyx::toc::asciiTocList(getCmdName(), buffer, os);
os << "\n";
return 0;
{
os << getScreenLabel(buffer) << "\n\n";
- toc::asciiTocList(toc::getType(getCmdName()), buffer, os);
+ lyx::toc::asciiTocList(lyx::toc::getType(getCmdName()), buffer, os);
os << "\n";
return 0;
}
-void InsetWrap::addToToc(toc::TocList & toclist, Buffer const * buf) const
+void InsetWrap::addToToc(lyx::toc::TocList & toclist, Buffer const * buf) const
{
// Now find the caption in the float...
ParagraphList::iterator tmp = inset.paragraphs.begin();
string const str =
tostr(toclist[name].size() + 1)
+ ". " + tmp->asString(buf, false);
- toc::TocItem const item(tmp->id(), 0 , str);
+ lyx::toc::TocItem const item(tmp->id(), 0 , str);
toclist[name].push_back(item);
}
}
///
bool insetAllowed(InsetOld::Code) const;
///
- void addToToc(toc::TocList &, Buffer const *) const;
+ void addToToc(lyx::toc::TocList &, Buffer const *) const;
///
bool showInsetDialog(BufferView *) const;
///
using std::endl;
using std::ostream;
-namespace toc
-{
+namespace lyx {
+namespace toc {
string const TocItem::asString() const
{
} else if (it->inset->lyxCode() == InsetOld::WRAP_CODE) {
InsetWrap * il =
static_cast<InsetWrap*>(it->inset);
+
il->addToToc(toclist, buf);
}
}
} // namespace toc
+} // namespace lyx
/** Nice functions and objects to handle TOCs
*/
-namespace toc
-{
+namespace lyx {
+namespace toc {
///
struct TocItem {
} // namespace toc
+} // namespace lyx
#endif // CONTROLTOC_H