mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
put namespace toc inside namespace lxy
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7384 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b4a7936882
commit
20b42535af
@ -1,5 +1,10 @@
|
||||
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
|
||||
|
@ -521,12 +521,14 @@ void expandFloatInsert(Menu & tomenu, LyXView const * view)
|
||||
|
||||
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);
|
||||
@ -537,9 +539,9 @@ void expandToc2(Menu & tomenu, toc::Toc const & toc_list,
|
||||
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;
|
||||
@ -581,9 +583,9 @@ void expandToc(Menu & tomenu, LyXView const * view)
|
||||
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")
|
||||
@ -591,8 +593,8 @@ void expandToc(Menu & tomenu, LyXView const * view)
|
||||
|
||||
// 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,
|
||||
|
@ -1,5 +1,9 @@
|
||||
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
|
||||
|
@ -23,7 +23,7 @@ ControlToc::ControlToc(Dialog & d)
|
||||
{}
|
||||
|
||||
|
||||
void ControlToc::goTo(toc::TocItem const & item)
|
||||
void ControlToc::goTo(lyx::toc::TocItem const & item)
|
||||
{
|
||||
item.goTo(kernel().lyxview());
|
||||
}
|
||||
@ -31,21 +31,21 @@ void ControlToc::goTo(toc::TocItem const & item)
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -25,13 +25,13 @@ public:
|
||||
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
|
||||
|
@ -1,14 +1,19 @@
|
||||
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:
|
||||
@ -18,7 +23,7 @@
|
||||
|
||||
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* XFormsToolbar.h:
|
||||
* XFormsToolbar.h:
|
||||
* XFormsToolbar.C: derives from Toolbar (replaces Toolbar::Pimpl)
|
||||
|
||||
* Toolbar_pimpl.C:
|
||||
|
@ -88,7 +88,7 @@ void FormToc::updateType()
|
||||
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());
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ void FormToc::updateContents()
|
||||
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) {
|
||||
@ -129,8 +129,8 @@ void FormToc::updateContents()
|
||||
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());
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
void updateContents();
|
||||
|
||||
///
|
||||
toc::Toc toc_;
|
||||
lyx::toc::Toc toc_;
|
||||
};
|
||||
|
||||
#endif // FORMTOC_H
|
||||
|
@ -1,3 +1,11 @@
|
||||
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.
|
||||
|
@ -400,7 +400,7 @@ void InsetFloat::wide(bool w, BufferParams const & bp)
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
@ -412,7 +412,7 @@ void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
///
|
||||
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;
|
||||
///
|
||||
|
@ -143,7 +143,7 @@ int InsetFloatList::ascii(Buffer const * buffer, ostream & os, int) const
|
||||
{
|
||||
os << getScreenLabel(buffer) << "\n\n";
|
||||
|
||||
toc::asciiTocList(getCmdName(), buffer, os);
|
||||
lyx::toc::asciiTocList(getCmdName(), buffer, os);
|
||||
|
||||
os << "\n";
|
||||
return 0;
|
||||
|
@ -70,7 +70,7 @@ int InsetTOC::ascii(Buffer const * buffer, ostream & os, int) const
|
||||
{
|
||||
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;
|
||||
|
@ -234,7 +234,7 @@ bool InsetWrap::showInsetDialog(BufferView * bv) const
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
@ -246,7 +246,7 @@ void InsetWrap::addToToc(toc::TocList & toclist, Buffer const * buf) const
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
///
|
||||
bool insetAllowed(InsetOld::Code) const;
|
||||
///
|
||||
void addToToc(toc::TocList &, Buffer const *) const;
|
||||
void addToToc(lyx::toc::TocList &, Buffer const *) const;
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
///
|
||||
|
@ -34,8 +34,8 @@ using std::max;
|
||||
using std::endl;
|
||||
using std::ostream;
|
||||
|
||||
namespace toc
|
||||
{
|
||||
namespace lyx {
|
||||
namespace toc {
|
||||
|
||||
string const TocItem::asString() const
|
||||
{
|
||||
@ -104,6 +104,7 @@ TocList const getTocList(Buffer const * buf)
|
||||
} else if (it->inset->lyxCode() == InsetOld::WRAP_CODE) {
|
||||
InsetWrap * il =
|
||||
static_cast<InsetWrap*>(it->inset);
|
||||
|
||||
il->addToToc(toclist, buf);
|
||||
}
|
||||
}
|
||||
@ -143,3 +144,4 @@ void asciiTocList(string const & type, Buffer const * buffer, ostream & os)
|
||||
|
||||
|
||||
} // namespace toc
|
||||
} // namespace lyx
|
||||
|
@ -30,8 +30,8 @@ class Paragraph;
|
||||
|
||||
/** Nice functions and objects to handle TOCs
|
||||
*/
|
||||
namespace toc
|
||||
{
|
||||
namespace lyx {
|
||||
namespace toc {
|
||||
|
||||
///
|
||||
struct TocItem {
|
||||
@ -85,5 +85,6 @@ bool operator!=(TocItem const & a, TocItem const & b)
|
||||
|
||||
|
||||
} // namespace toc
|
||||
} // namespace lyx
|
||||
|
||||
#endif // CONTROLTOC_H
|
||||
|
Loading…
Reference in New Issue
Block a user