mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
2002-03-12 Lars Gullik Bj�nnes <larsbj@birdstep.com>
bufferlist.h: doxy changes bufferlist.C: ws changes DepTable.[Ch] (ext_exist): place const in the right spot. BufferView_pimpl.C (resizeCurrentBuffer): further refine when to resizeInsets. call resizeInsets when the with BufferView changes. adjust for protectedBlank removal call updateInset if the insert went ok. BufferView_pimpl.[Ch] (protectedBlank): remove func, use instead. BufferView2.C (ChangeInsets): remove warning add FIXME comment BufferView.h: doxy change Makefile.am (INCLUDES): remove @FRONTEND_INCLUDES@ lyxtextclass.C (operator[]): remove non-const version out): remove non-const version git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3733 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
82121d83da
commit
bae36d14f7
@ -1,13 +1,10 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
/** \file
|
||||
* Copyright 2002 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2001 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
* \author Lars Gullik Bjønnes
|
||||
*/
|
||||
|
||||
#ifndef BUFFER_VIEW_H
|
||||
#define BUFFER_VIEW_H
|
||||
@ -19,7 +16,9 @@
|
||||
#include "LString.h"
|
||||
#include "undo.h"
|
||||
#include "commandtags.h"
|
||||
|
||||
#include "insets/inset.h"
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
class LyXView;
|
||||
@ -160,7 +159,7 @@ public:
|
||||
// bool no_table = false);
|
||||
bool insertInset(Inset * inset, string const & lout = string());
|
||||
/** Inserts a lyx file at cursor position.
|
||||
@return #false# if it fails.
|
||||
\return #false# if it fails.
|
||||
*/
|
||||
bool insertLyXFile(string const & file);
|
||||
///
|
||||
@ -216,6 +215,7 @@ public:
|
||||
///
|
||||
bool Dispatch(kb_action action, string const & argument);
|
||||
private:
|
||||
///
|
||||
struct Pimpl;
|
||||
///
|
||||
friend struct BufferView::Pimpl;
|
||||
|
@ -658,9 +658,9 @@ bool BufferView::ChangeInsets(Inset::Code code,
|
||||
}
|
||||
if (changed_inset) {
|
||||
need_update = true;
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning FIXME
|
||||
#endif
|
||||
|
||||
// FIXME
|
||||
|
||||
// The test it.size()==1 was needed to prevent crashes.
|
||||
// How to set the cursor corretly when it.size()>1 ??
|
||||
if (it.size() == 1) {
|
||||
|
@ -311,7 +311,6 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
||||
pos_type selendpos = 0;
|
||||
bool selection = false;
|
||||
bool mark_set = false;
|
||||
bool text_found = false;
|
||||
|
||||
owner_->prohibitInput();
|
||||
|
||||
@ -330,12 +329,12 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
||||
delete bv_->text;
|
||||
bv_->text = new LyXText(bv_);
|
||||
bv_->text->init(bv_);
|
||||
buffer_->resizeInsets(bv_);
|
||||
} else {
|
||||
// See if we have a text in TextCache that fits
|
||||
// the new buffer_ with the correct width.
|
||||
bv_->text = textcache.findFit(buffer_, workarea_.workWidth());
|
||||
if (bv_->text) {
|
||||
text_found = true;
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "Found a LyXText that fits:\n";
|
||||
textcache.show(lyxerr, make_pair(buffer_, make_pair(workarea_.workWidth(), bv_->text)));
|
||||
@ -347,14 +346,16 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
||||
} else {
|
||||
bv_->text = new LyXText(bv_);
|
||||
bv_->text->init(bv_);
|
||||
//buffer_->resizeInsets(bv_);
|
||||
}
|
||||
}
|
||||
|
||||
updateScreen();
|
||||
|
||||
if (par) {
|
||||
bv_->text->selection.set(true);
|
||||
/* at this point just to avoid the Delete-Empty-Paragraph
|
||||
* Mechanism when setting the cursor */
|
||||
// At this point just to avoid the Delete-Empty-Paragraph-
|
||||
// Mechanism when setting the cursor.
|
||||
bv_->text->selection.mark(mark_set);
|
||||
if (selection) {
|
||||
bv_->text->setCursor(bv_, selstartpar, selstartpos);
|
||||
@ -370,13 +371,9 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
||||
// remake the inset locking
|
||||
bv_->theLockingInset(the_locking_inset);
|
||||
}
|
||||
|
||||
bv_->text->first_y = screen_->topCursorVisible(bv_->text);
|
||||
// please tell me WHY the heck you deactivated this code, whoever
|
||||
// 'you' are (Jug 20020311)
|
||||
#if 1
|
||||
if (!text_found)
|
||||
buffer_->resizeInsets(bv_);
|
||||
#endif
|
||||
|
||||
// this will scroll the screen such that the cursor becomes visible
|
||||
updateScrollbar();
|
||||
redraw();
|
||||
@ -1002,6 +999,7 @@ void BufferView::Pimpl::workAreaExpose()
|
||||
if (lyxerr.debugging())
|
||||
textcache.show(lyxerr, "Expose delete all");
|
||||
textcache.clear();
|
||||
buffer_->resizeInsets(bv_);
|
||||
} else if (heightChange) {
|
||||
// Rebuild image of current screen
|
||||
updateScreen();
|
||||
@ -2358,7 +2356,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
| BufferView::FITCUR
|
||||
| BufferView::CHANGE);
|
||||
} else {
|
||||
protectedBlank(lt);
|
||||
specialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
|
||||
}
|
||||
moveCursorUpdate(false);
|
||||
}
|
||||
@ -3264,27 +3262,6 @@ void BufferView::Pimpl::hfill()
|
||||
}
|
||||
|
||||
|
||||
void BufferView::Pimpl::protectedBlank(LyXText * lt)
|
||||
{
|
||||
if (available()) {
|
||||
hideCursor();
|
||||
update(lt, BufferView::SELECT|BufferView::FITCUR);
|
||||
InsetSpecialChar * new_inset =
|
||||
new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Why is this code different from specialChar() below? (JMarc)
|
||||
// the code in specialChar is a generic version of what used to exist
|
||||
// for other special chars. I did not merge this case because of the
|
||||
// call to updateInset(), but what does it do?
|
||||
#endif
|
||||
if (!insertInset(new_inset))
|
||||
delete new_inset;
|
||||
else
|
||||
updateInset(new_inset, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BufferView::Pimpl::specialChar(InsetSpecialChar::Kind kind)
|
||||
{
|
||||
if (available()) {
|
||||
@ -3296,6 +3273,8 @@ void BufferView::Pimpl::specialChar(InsetSpecialChar::Kind kind)
|
||||
new InsetSpecialChar(kind);
|
||||
if (!insertInset(new_inset))
|
||||
delete new_inset;
|
||||
else
|
||||
updateInset(new_inset, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,8 +149,6 @@ private:
|
||||
/// open and lock an updatable inset
|
||||
bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
|
||||
///
|
||||
void protectedBlank(LyXText * lt);
|
||||
///
|
||||
void specialChar(InsetSpecialChar::Kind);
|
||||
///
|
||||
void newline();
|
||||
|
@ -1,3 +1,29 @@
|
||||
2002-03-12 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* bufferlist.h: doxy changes
|
||||
|
||||
* bufferlist.C: ws changes
|
||||
|
||||
* DepTable.[Ch] (ext_exist): place const in the right spot.
|
||||
|
||||
* BufferView_pimpl.C (resizeCurrentBuffer): further refine when to
|
||||
call resizeInsets.
|
||||
(workAreaExpose): call resizeInsets when the with BufferView changes.
|
||||
(Dispatch): adjust for protectedBlank removal
|
||||
(specialChar): call updateInset if the insert went ok.
|
||||
|
||||
* BufferView_pimpl.[Ch] (protectedBlank): remove func, use
|
||||
specialChar instead.
|
||||
|
||||
* BufferView2.C (ChangeInsets): remove warning add FIXME comment
|
||||
|
||||
* BufferView.h: doxy change
|
||||
|
||||
* Makefile.am (INCLUDES): remove @FRONTEND_INCLUDES@
|
||||
|
||||
* lyxtextclass.C (operator[]): remove non-const version
|
||||
(defaultLayout): remove non-const version
|
||||
|
||||
2002-03-12 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* BufferView_pimpl.C (resizeCurrentBuffer): only resize insets if we
|
||||
|
@ -152,7 +152,7 @@ bool DepTable::extchanged(string const & ext) const
|
||||
}
|
||||
|
||||
|
||||
bool DepTable::ext_exist(const string& ext) const
|
||||
bool DepTable::ext_exist(string const & ext) const
|
||||
{
|
||||
DepList::const_iterator cit = deplist.begin();
|
||||
DepList::const_iterator end = deplist.end();
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
///
|
||||
bool exist(string const & fil) const;
|
||||
/// returns true if any files with ext exist
|
||||
bool ext_exist(string const& ext) const;
|
||||
bool ext_exist(string const & ext) const;
|
||||
///
|
||||
void remove_files_with_extension(string const &);
|
||||
///
|
||||
|
@ -9,10 +9,12 @@ lyx_DEPENDENCIES = mathed/libmathed.o insets/libinsets.o \
|
||||
frontends/libfrontends.o \
|
||||
support/libsupport.o \
|
||||
@INCLUDED_SIGC@
|
||||
|
||||
lyx_LDADD = $(lyx_DEPENDENCIES) @INTLLIBS@ $(SIGC_LIBS) \
|
||||
$(PSPELL_LIBS) @AIKSAURUS_LIBS@ @FRONTEND_LDFLAGS@ @FRONTEND_LIBS@
|
||||
|
||||
#lyx_LDFLAGS=-Wl,-O1
|
||||
|
||||
EXTRA_DIST = config.h.in stamp-h.in cheaders ext_l10n.h version.C.in \
|
||||
Sectioning.h \
|
||||
Sectioning.C \
|
||||
@ -23,7 +25,7 @@ EXTRA_DIST = config.h.in stamp-h.in cheaders ext_l10n.h version.C.in \
|
||||
|
||||
ETAGS_ARGS = --lang=c++
|
||||
BOOST_INCLUDES = -I$(top_srcdir)/boost
|
||||
INCLUDES = $(SIGC_CFLAGS) $(BOOST_INCLUDES) $(PSPELL_INCLUDES) @FRONTEND_INCLUDES@
|
||||
INCLUDES = $(SIGC_CFLAGS) $(BOOST_INCLUDES) $(PSPELL_INCLUDES)
|
||||
localedir = $(datadir)/locale
|
||||
BUILT_SOURCES = version.C
|
||||
lyx_SOURCES = \
|
||||
|
@ -243,14 +243,16 @@ vector<string> const BufferList::getFileNames() const
|
||||
|
||||
Buffer * BufferList::first()
|
||||
{
|
||||
if (bstore.empty()) return 0;
|
||||
if (bstore.empty())
|
||||
return 0;
|
||||
return bstore.front();
|
||||
}
|
||||
|
||||
|
||||
Buffer * BufferList::getBuffer(unsigned int choice)
|
||||
{
|
||||
if (choice >= bstore.size()) return 0;
|
||||
if (choice >= bstore.size())
|
||||
return 0;
|
||||
return bstore[choice];
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,10 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
/** \file
|
||||
* Copyright 2002 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2001 The LyX Team
|
||||
*
|
||||
* This file is Copyright 1996-2001
|
||||
* Lars Gullik Bjønnes
|
||||
*
|
||||
* ====================================================== */
|
||||
* \author Lars Gullik Bjønnes
|
||||
*/
|
||||
|
||||
#ifndef BUFFER_LIST_H
|
||||
#define BUFFER_LIST_H
|
||||
@ -18,12 +13,14 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
class Buffer;
|
||||
class UpdatableInset;
|
||||
#include <vector>
|
||||
#include "LString.h"
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#include "LString.h"
|
||||
#include <vector>
|
||||
|
||||
class Buffer;
|
||||
class UpdatableInset;
|
||||
|
||||
/** A class to hold all the buffers in a structure
|
||||
The point of this class is to hide from bufferlist what kind
|
||||
@ -43,12 +40,23 @@ public:
|
||||
typedef Container::const_iterator const_iterator;
|
||||
///
|
||||
typedef Container::size_type size_type;
|
||||
///
|
||||
/**
|
||||
Is the container empty or not.
|
||||
\return True if the container is empty, False otherwise.
|
||||
*/
|
||||
bool empty() const { return container.empty(); }
|
||||
///
|
||||
/**
|
||||
Releases the passed buffer from the storage and deletes
|
||||
all resources.
|
||||
\param buf The buffer to release.
|
||||
*/
|
||||
void release(Buffer * buf);
|
||||
///
|
||||
Buffer * newBuffer(string const & s, bool = false);
|
||||
/**
|
||||
\param s The name of the file to base the buffer on.
|
||||
\param ronly If the buffer should be created read only of not.
|
||||
\return The newly created buffer.
|
||||
*/
|
||||
Buffer * newBuffer(string const & s, bool ronly = false);
|
||||
///
|
||||
Container::iterator begin() { return container.begin(); }
|
||||
///
|
||||
@ -61,7 +69,10 @@ public:
|
||||
Buffer * front() { return container.front(); }
|
||||
///
|
||||
Buffer * operator[](int c) { return container[c]; }
|
||||
///
|
||||
/**
|
||||
What is the size of the container.
|
||||
\return The size of the container.
|
||||
*/
|
||||
size_type size() const { return container.size(); }
|
||||
private:
|
||||
///
|
||||
@ -69,7 +80,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
/** The class govern all open buffers.
|
||||
/**
|
||||
The class holds all all open buffers, and handles construction
|
||||
and deletions of new ones.
|
||||
*/
|
||||
class BufferList : boost::noncopyable {
|
||||
public:
|
||||
@ -87,10 +100,13 @@ public:
|
||||
/// returns the state of the bufferlist
|
||||
list_state getState() const { return state_; }
|
||||
|
||||
/** loads a LyX file or...
|
||||
If the optional argument tolastfiles is false (default is
|
||||
true), the file name will not be added to the last opened
|
||||
files list
|
||||
/**
|
||||
Loads a LyX file or...
|
||||
|
||||
\param filename The filename to read from.
|
||||
\param tolastfiles Wether the file should be put in the
|
||||
last opened files list or not.
|
||||
\return The newly loaded LyX file.
|
||||
*/
|
||||
Buffer * loadLyXFile(string const & filename,
|
||||
bool tolastfiles = true);
|
||||
@ -104,7 +120,10 @@ public:
|
||||
/// Close all open buffers.
|
||||
void closeAll();
|
||||
|
||||
/// Read a file into a buffer readonly or not.
|
||||
/**
|
||||
Read a file into a buffer readonly or not.
|
||||
\return
|
||||
*/
|
||||
Buffer * readFile(string const &, bool ro);
|
||||
|
||||
/// Make a new file (buffer) using a template
|
||||
@ -121,9 +140,10 @@ public:
|
||||
///
|
||||
void emergencyWriteAll();
|
||||
|
||||
/** Close buffer.
|
||||
@param buf the buffer that should be closed
|
||||
@return #false# if operation was canceled
|
||||
/**
|
||||
Close buffer.
|
||||
\param buf the buffer that should be closed
|
||||
\return #false# if operation was canceled
|
||||
*/
|
||||
bool close(Buffer * buf);
|
||||
|
||||
@ -140,10 +160,10 @@ public:
|
||||
Buffer * getBuffer(string const &);
|
||||
/// returns a pointer to the buffer with the given number.
|
||||
Buffer * getBuffer(unsigned int);
|
||||
|
||||
private:
|
||||
/// ask to save a buffer on quit
|
||||
bool qwriteOne(Buffer * buf, string const & fname, string & unsaved_list);
|
||||
bool qwriteOne(Buffer * buf, string const & fname,
|
||||
string & unsaved_list);
|
||||
|
||||
///
|
||||
BufferStorage bstore;
|
||||
|
@ -183,7 +183,8 @@ bool LyXTextClass::Read(string const & filename, bool merge)
|
||||
string const name = subst(lexrc.getString(),
|
||||
'_', ' ');
|
||||
if (hasLayout(name)) {
|
||||
LyXLayout & lay = operator[](name);
|
||||
LyXLayout & lay =
|
||||
const_cast<LyXLayout &>(operator[](name));
|
||||
error = do_readStyle(lexrc, lay);
|
||||
} else {
|
||||
LyXLayout lay;
|
||||
@ -530,33 +531,6 @@ LyXLayout const & LyXTextClass::operator[](string const & n) const
|
||||
}
|
||||
|
||||
|
||||
LyXLayout & LyXTextClass::operator[](string const & n)
|
||||
{
|
||||
lyx::Assert(!n.empty());
|
||||
|
||||
if (n.empty())
|
||||
lyxerr << "Operator[] called with empty n" << endl;
|
||||
|
||||
string const name = (n.empty() ? defaultLayoutName() : n);
|
||||
|
||||
LayoutList::iterator it =
|
||||
find_if(layoutlist.begin(),
|
||||
layoutlist.end(),
|
||||
lyx::compare_memfun(&LyXLayout::name, name));
|
||||
|
||||
if (it == layoutlist.end()) {
|
||||
lyxerr << "We failed to find the layout '" << name
|
||||
<< "' in the layout list. You MUST investigate!"
|
||||
<< endl;
|
||||
|
||||
// we require the name to exist
|
||||
lyx::Assert(false);
|
||||
}
|
||||
|
||||
return *it;
|
||||
}
|
||||
|
||||
|
||||
bool LyXTextClass::delete_layout(string const & name)
|
||||
{
|
||||
if (name == defaultLayoutName())
|
||||
@ -608,12 +582,6 @@ LyXLayout const & LyXTextClass::defaultLayout() const
|
||||
}
|
||||
|
||||
|
||||
LyXLayout & LyXTextClass::defaultLayout()
|
||||
{
|
||||
return operator[](defaultLayoutName());
|
||||
}
|
||||
|
||||
|
||||
string const & LyXTextClass::name() const
|
||||
{
|
||||
return name_;
|
||||
|
@ -60,9 +60,6 @@ public:
|
||||
///
|
||||
LyXLayout const & operator[](string const & vname) const;
|
||||
|
||||
///
|
||||
LyXLayout & operator[](string const & vname);
|
||||
|
||||
/// Sees to that the textclass structure has been loaded
|
||||
bool load() const;
|
||||
|
||||
@ -71,8 +68,6 @@ public:
|
||||
///
|
||||
LyXLayout const & defaultLayout() const;
|
||||
///
|
||||
LyXLayout & defaultLayout();
|
||||
///
|
||||
string const & name() const;
|
||||
///
|
||||
string const & latexname() const;
|
||||
|
Loading…
Reference in New Issue
Block a user