mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
small stuff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3231 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f70513fe19
commit
8ddb8f993b
@ -1,3 +1,11 @@
|
||||
2001-12-18 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* insettabular.C: move includes around a bit, add a couple of
|
||||
consts.
|
||||
|
||||
* insettext.[Ch]: move includes around a bit, other ws changes and
|
||||
small stuff.
|
||||
|
||||
2001-12-17 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||
|
||||
* insettext.C (insetButtonRelease): fix compile problem
|
||||
|
@ -10,12 +10,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <map>
|
||||
//#include <signal.h>
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
@ -33,17 +27,26 @@
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "LyXView.h"
|
||||
#include "insets/insettext.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "frontends/Alert.h"
|
||||
#include "debug.h"
|
||||
#include "WorkArea.h"
|
||||
#include "gettext.h"
|
||||
#include "language.h"
|
||||
#include "BufferView.h"
|
||||
#include "undo_funcs.h"
|
||||
#include "lyxlength.h"
|
||||
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "frontends/Alert.h"
|
||||
|
||||
#include "support/LAssert.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <map>
|
||||
//#include <signal.h>
|
||||
|
||||
using std::ostream;
|
||||
using std::ifstream;
|
||||
using std::max;
|
||||
@ -53,8 +56,9 @@ using std::max;
|
||||
|
||||
namespace {
|
||||
|
||||
const int ADD_TO_HEIGHT = 2;
|
||||
const int ADD_TO_TABULAR_WIDTH = 2;
|
||||
int const ADD_TO_HEIGHT = 2;
|
||||
int const ADD_TO_TABULAR_WIDTH = 2;
|
||||
|
||||
///
|
||||
LyXTabular * paste_tabular = 0;
|
||||
|
||||
@ -64,7 +68,6 @@ struct TabularFeature {
|
||||
string feature;
|
||||
};
|
||||
|
||||
//tabular_features * tabularFeatures = 0;
|
||||
|
||||
TabularFeature tabularFeature[] =
|
||||
{
|
||||
@ -183,9 +186,6 @@ void InsetTabular::read(Buffer const * buf, LyXLex & lex)
|
||||
{
|
||||
bool const old_format = (lex.getString() == "\\LyXTable");
|
||||
|
||||
//if (tabular)
|
||||
//delete tabular;
|
||||
//tabular = new LyXTabular(buf, this, lex);
|
||||
tabular.reset(new LyXTabular(buf, this, lex));
|
||||
|
||||
need_update = INIT;
|
||||
@ -400,7 +400,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
||||
x += width(bv, font);
|
||||
if (bv->text->status() == LyXText::CHANGED_IN_DRAW) {
|
||||
int i = 0;
|
||||
for(Inset * inset=owner(); inset; ++i)
|
||||
for(Inset * inset = owner(); inset; ++i)
|
||||
inset = inset->owner();
|
||||
if (calculate_dimensions_of_cells(bv, font, false))
|
||||
need_update = INIT;
|
||||
@ -460,7 +460,8 @@ void InsetTabular::drawCellSelection(Painter & pain, int x, int baseline,
|
||||
|
||||
int rs = tabular->row_of_cell(sel_cell_start);
|
||||
int re = tabular->row_of_cell(sel_cell_end);
|
||||
if (rs > re) swap(rs, re);
|
||||
if (rs > re)
|
||||
swap(rs, re);
|
||||
|
||||
if ((column >= cs) && (column <= ce) && (row >= rs) && (row <= re)) {
|
||||
int w = tabular->GetWidthOfColumn(cell);
|
||||
@ -903,7 +904,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
|
||||
}
|
||||
|
||||
hideInsetCursor(bv);
|
||||
result=DISPATCHED;
|
||||
result = DISPATCHED;
|
||||
switch (action) {
|
||||
// --- Cursor Movements ----------------------------------
|
||||
case LFUN_RIGHTSEL: {
|
||||
@ -1053,10 +1054,8 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
|
||||
case LFUN_ENDSEL:
|
||||
break;
|
||||
case LFUN_LAYOUT_TABULAR:
|
||||
{
|
||||
bv->owner()->getDialogs()->showTabular(this);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case LFUN_TABULAR_FEATURE:
|
||||
if (!tabularFeatures(bv, arg))
|
||||
result = UNDISPATCHED;
|
||||
@ -1729,9 +1728,11 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
||||
switch (feature) {
|
||||
case LyXTabular::SET_PWIDTH:
|
||||
{
|
||||
LyXLength const vallen = LyXLength(value);
|
||||
bool const update = (tabular->GetColumnPWidth(actcell) != vallen);
|
||||
tabular->SetColumnPWidth(actcell,vallen);
|
||||
LyXLength const vallen(value);
|
||||
LyXLength const & tmplen = tabular->GetColumnPWidth(actcell);
|
||||
|
||||
bool const update = (tmplen != vallen);
|
||||
tabular->SetColumnPWidth(actcell, vallen);
|
||||
if (update) {
|
||||
for (int i = 0; i < tabular->rows(); ++i) {
|
||||
tabular->GetCellInset(tabular->GetCellNumber(i, column))->
|
||||
@ -1743,9 +1744,11 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
||||
break;
|
||||
case LyXTabular::SET_MPWIDTH:
|
||||
{
|
||||
LyXLength const vallen = LyXLength(value);
|
||||
bool const update = (tabular->GetPWidth(actcell) != vallen);
|
||||
tabular->SetMColumnPWidth(actcell,vallen);
|
||||
LyXLength const vallen(value);
|
||||
LyXLength const & tmplen = tabular->GetPWidth(actcell);
|
||||
|
||||
bool const update = (tmplen != vallen);
|
||||
tabular->SetMColumnPWidth(actcell, vallen);
|
||||
if (update) {
|
||||
for (int i = 0; i < tabular->rows(); ++i) {
|
||||
tabular->GetCellInset(tabular->GetCellNumber(i, column))->
|
||||
@ -2408,7 +2411,7 @@ bool InsetTabular::copySelection(BufferView * bv)
|
||||
while (paste_tabular->rows() > rows)
|
||||
paste_tabular->DeleteRow(rows);
|
||||
paste_tabular->SetTopLine(0, true, true);
|
||||
paste_tabular->SetBottomLine(paste_tabular->GetFirstCellInRow(rows-1),
|
||||
paste_tabular->SetBottomLine(paste_tabular->GetFirstCellInRow(rows - 1),
|
||||
true, true);
|
||||
for (int i = 0; i < sel_col_start; ++i)
|
||||
paste_tabular->DeleteColumn(0);
|
||||
@ -2519,7 +2522,8 @@ bool InsetTabular::doClearArea() const
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::getSelection(int & srow, int & erow, int & scol, int & ecol) const
|
||||
void InsetTabular::getSelection(int & srow, int & erow,
|
||||
int & scol, int & ecol) const
|
||||
{
|
||||
int const start = hasSelection() ? sel_cell_start : actcell;
|
||||
int const end = hasSelection() ? sel_cell_end : actcell;
|
||||
@ -2583,8 +2587,8 @@ Inset * InsetTabular::getInsetFromID(int id_arg) const
|
||||
return const_cast<InsetTabular *>(this);
|
||||
|
||||
Inset * result;
|
||||
for(int i=0; i < tabular->rows(); ++i) {
|
||||
for(int j=0; j < tabular->columns(); ++j) {
|
||||
for(int i = 0; i < tabular->rows(); ++i) {
|
||||
for(int j = 0; j < tabular->columns(); ++j) {
|
||||
if ((result = tabular->GetCellInset(i, j)->getInsetFromID(id_arg)))
|
||||
return result;
|
||||
}
|
||||
@ -2593,7 +2597,8 @@ Inset * InsetTabular::getInsetFromID(int id_arg) const
|
||||
}
|
||||
|
||||
|
||||
string const InsetTabular::selectNextWordToSpellcheck(BufferView * bv, float & value) const
|
||||
string const
|
||||
InsetTabular::selectNextWordToSpellcheck(BufferView * bv, float & value) const
|
||||
{
|
||||
if (the_locking_inset) {
|
||||
string const str(the_locking_inset->selectNextWordToSpellcheck(bv, value));
|
||||
|
@ -10,12 +10,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
|
||||
#include <cstdlib>
|
||||
//#include <signal.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
@ -32,15 +26,11 @@
|
||||
#include "layout.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "Painter.h"
|
||||
#include "frontends/Alert.h"
|
||||
#include "lyxtext.h"
|
||||
#include "lyxcursor.h"
|
||||
#include "CutAndPaste.h"
|
||||
#include "font.h"
|
||||
#include "LColor.h"
|
||||
#include "support/textutils.h"
|
||||
#include "support/LAssert.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "lyxrow.h"
|
||||
#include "lyxrc.h"
|
||||
#include "intl.h"
|
||||
@ -53,6 +43,17 @@
|
||||
#include "undo_funcs.h"
|
||||
#include "lyxfind.h"
|
||||
|
||||
#include "frontends/Alert.h"
|
||||
|
||||
#include "support/textutils.h"
|
||||
#include "support/LAssert.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
//#include <csignal>
|
||||
|
||||
using std::ostream;
|
||||
using std::ifstream;
|
||||
using std::endl;
|
||||
@ -919,7 +920,10 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
|
||||
hideInsetCursor(bv);
|
||||
if (the_locking_inset) {
|
||||
if (the_locking_inset == inset) {
|
||||
the_locking_inset->insetButtonPress(bv,x-inset_x,y-inset_y,button);
|
||||
the_locking_inset->insetButtonPress(bv,
|
||||
x - inset_x,
|
||||
y - inset_y,
|
||||
button);
|
||||
no_selection = false;
|
||||
return;
|
||||
} else if (inset) {
|
||||
@ -928,7 +932,8 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
|
||||
inset_x = cx(bv) - top_x + drawTextXOffset;
|
||||
inset_y = cy(bv) + drawTextYOffset;
|
||||
the_locking_inset = static_cast<UpdatableInset*>(inset);
|
||||
inset->insetButtonPress(bv, x - inset_x, y - inset_y, button);
|
||||
inset->insetButtonPress(bv, x - inset_x,
|
||||
y - inset_y, button);
|
||||
inset->edit(bv, x - inset_x, y - inset_y, button);
|
||||
if (the_locking_inset)
|
||||
updateLocal(bv, CURSOR, false);
|
||||
@ -968,10 +973,13 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
|
||||
lt = getLyXText(bv);
|
||||
clear = true;
|
||||
}
|
||||
lt->setCursorFromCoordinates(bv, x-drawTextXOffset, y + insetAscent);
|
||||
|
||||
lt->setCursorFromCoordinates(bv, x - drawTextXOffset,
|
||||
y + insetAscent);
|
||||
// set the selection cursor!
|
||||
lt->selection.cursor = lt->cursor;
|
||||
lt->cursor.x_fix(lt->cursor.x());
|
||||
|
||||
if (lt->selection.set()) {
|
||||
lt->clearSelection();
|
||||
updateLocal(bv, FULL, false);
|
||||
@ -2540,7 +2548,7 @@ void InsetText::toggleSelection(BufferView * bv, bool kill_selection)
|
||||
|
||||
|
||||
bool InsetText::searchForward(BufferView * bv, string const & str,
|
||||
bool const & cs, bool const & mw)
|
||||
bool cs, bool mw)
|
||||
{
|
||||
if (the_locking_inset) {
|
||||
if (the_locking_inset->searchForward(bv, str, cs, mw))
|
||||
@ -2578,7 +2586,7 @@ bool InsetText::searchForward(BufferView * bv, string const & str,
|
||||
}
|
||||
|
||||
bool InsetText::searchBackward(BufferView * bv, string const & str,
|
||||
bool const & cs, bool const & mw)
|
||||
bool cs, bool mw)
|
||||
{
|
||||
if (the_locking_inset)
|
||||
if (the_locking_inset->searchBackward(bv, str, cs, mw))
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "LColor.h"
|
||||
#include "paragraph.h"
|
||||
#include "lyxcursor.h"
|
||||
|
||||
#include <boost/smart_ptr.hpp>
|
||||
|
||||
class Painter;
|
||||
@ -99,7 +100,7 @@ public:
|
||||
///
|
||||
void draw(BufferView *, LyXFont const &, int , float &, bool) const;
|
||||
///
|
||||
void update(BufferView *, LyXFont const &, bool =false);
|
||||
void update(BufferView *, LyXFont const &, bool = false);
|
||||
///
|
||||
void setUpdateStatus(BufferView *, int what) const;
|
||||
///
|
||||
@ -152,7 +153,7 @@ public:
|
||||
///
|
||||
void toggleInsetCursor(BufferView *);
|
||||
///
|
||||
void showInsetCursor(BufferView *, bool show=true);
|
||||
void showInsetCursor(BufferView *, bool show = true);
|
||||
///
|
||||
void hideInsetCursor(BufferView *);
|
||||
///
|
||||
@ -201,19 +202,19 @@ public:
|
||||
///
|
||||
bool nodraw() const;
|
||||
///
|
||||
int scroll(bool recursive=true) const;
|
||||
int scroll(bool recursive = true) const;
|
||||
///
|
||||
void scroll(BufferView *bv, float sx) const {
|
||||
void scroll(BufferView * bv, float sx) const {
|
||||
UpdatableInset::scroll(bv, sx);
|
||||
}
|
||||
///
|
||||
void scroll(BufferView *bv, int offset) const {
|
||||
void scroll(BufferView * bv, int offset) const {
|
||||
UpdatableInset::scroll(bv, offset);
|
||||
}
|
||||
///
|
||||
void selectAll(BufferView *bv);
|
||||
void selectAll(BufferView * bv);
|
||||
///
|
||||
void clearSelection(BufferView *bv);
|
||||
void clearSelection(BufferView * bv);
|
||||
///
|
||||
Paragraph * getParFromID(int id) const;
|
||||
///
|
||||
@ -230,14 +231,18 @@ public:
|
||||
void paragraph(Paragraph *);
|
||||
///
|
||||
bool allowSpellcheck() { return true; }
|
||||
string const selectNextWordToSpellcheck(BufferView *, float & value) const;
|
||||
///
|
||||
string const selectNextWordToSpellcheck(BufferView *,
|
||||
float & value) const;
|
||||
void selectSelectedWord(BufferView *);
|
||||
///
|
||||
void toggleSelection(BufferView *, bool kill_selection);
|
||||
///
|
||||
bool searchForward(BufferView *, string const &,
|
||||
bool const & = true, bool const & = false);
|
||||
bool = true, bool = false);
|
||||
///
|
||||
bool searchBackward(BufferView *, string const &,
|
||||
bool const & = true, bool const & = false);
|
||||
bool = true, bool = false);
|
||||
///
|
||||
bool checkInsertChar(LyXFont &);
|
||||
///
|
||||
@ -263,14 +268,17 @@ protected:
|
||||
LColor::color frame_color;
|
||||
|
||||
private:
|
||||
///
|
||||
struct InnerCache {
|
||||
///
|
||||
InnerCache(boost::shared_ptr<LyXText>);
|
||||
|
||||
///
|
||||
boost::shared_ptr<LyXText> text;
|
||||
///
|
||||
bool remove;
|
||||
};
|
||||
///
|
||||
typedef std::map<BufferView *, struct InnerCache > Cache;
|
||||
typedef std::map<BufferView *, InnerCache> Cache;
|
||||
///
|
||||
typedef Cache::value_type value_type;
|
||||
///
|
||||
@ -325,6 +333,7 @@ private:
|
||||
void clearInset(BufferView *, int baseline, bool & cleared) const;
|
||||
///
|
||||
void saveLyXTextState(LyXText *) const;
|
||||
///
|
||||
void restoreLyXTextState(BufferView *, LyXText *) const;
|
||||
///
|
||||
void reinitLyXText() const;
|
||||
@ -373,7 +382,7 @@ private:
|
||||
///
|
||||
mutable boost::shared_ptr<LyXText> cached_text;
|
||||
///
|
||||
mutable struct save_state {
|
||||
struct save_state {
|
||||
Paragraph * lpar;
|
||||
Paragraph * selstartpar;
|
||||
Paragraph * selendpar;
|
||||
@ -386,7 +395,10 @@ private:
|
||||
bool selection;
|
||||
bool mark_set;
|
||||
bool refresh;
|
||||
} sstate;
|
||||
};
|
||||
///
|
||||
mutable save_state sstate;
|
||||
|
||||
///
|
||||
// this is needed globally so we know that we're using it actually and
|
||||
// so the LyXText-Cache is not erased until used!
|
||||
|
Loading…
Reference in New Issue
Block a user