mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
use NEW_TABULAR�to controll all insettabler usage and code
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@912 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f23a147fe1
commit
69c9c901ac
20
ChangeLog
20
ChangeLog
@ -1,5 +1,25 @@
|
|||||||
2000-07-21 Lars Gullik Bjønnes <larsbj@lyx.org>
|
2000-07-21 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* src/toolbar.h: include commandtags.h instead of lyxfunc.h,
|
||||||
|
forward decl of LyXView.
|
||||||
|
|
||||||
|
* src/toolbar.C (toolbarItem): moved from toolbar.h
|
||||||
|
(toolbarItem::clean): ditto
|
||||||
|
(toolbarItem::~toolbarItem): ditto
|
||||||
|
(toolbarItem::operator): ditto
|
||||||
|
|
||||||
|
* src/text2.C (SetLayout): commetn out USE_OLD_SETUP_LAYOUT stuff
|
||||||
|
|
||||||
|
* src/paragraph.h: control the NEW_TABULAR define from here
|
||||||
|
|
||||||
|
* src/buffer.C: remove define USE_PARSE_FUNCTION, change
|
||||||
|
USE_TABULAR_INSETS to NEW_TABULAR
|
||||||
|
|
||||||
|
* src/ToolbarDefaults.C: add include "lyxlex.h"
|
||||||
|
|
||||||
|
* files using the old table/tabular: use NEW_TABULAR to control
|
||||||
|
compilation of old tabular stuff.
|
||||||
|
|
||||||
* src/paragraph.C (SimpleTeXOnePar): NEW_INSETS: move some #ifdef
|
* src/paragraph.C (SimpleTeXOnePar): NEW_INSETS: move some #ifdef
|
||||||
to correct place.
|
to correct place.
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "insets/lyxinset.h"
|
#include "insets/lyxinset.h"
|
||||||
|
|
||||||
|
|
||||||
// Prototypes
|
// Prototypes
|
||||||
extern FD_form_table_options * fd_form_table_options;
|
extern FD_form_table_options * fd_form_table_options;
|
||||||
extern FD_form_table_extra * fd_form_table_extra;
|
extern FD_form_table_extra * fd_form_table_extra;
|
||||||
@ -42,7 +41,8 @@ bool UpdateLayoutTable(int flag)
|
|||||||
bool update = true;
|
bool update = true;
|
||||||
if (!current_view->available())
|
if (!current_view->available())
|
||||||
update = false;
|
update = false;
|
||||||
|
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
if (update && current_view->text->cursor.par()->table) {
|
if (update && current_view->text->cursor.par()->table) {
|
||||||
char buf[12];
|
char buf[12];
|
||||||
string pwidth, special;
|
string pwidth, special;
|
||||||
@ -212,7 +212,9 @@ bool UpdateLayoutTable(int flag)
|
|||||||
table->RotateTable());
|
table->RotateTable());
|
||||||
fl_set_focus_object(fd_form_table_options->form_table_options,
|
fl_set_focus_object(fd_form_table_options->form_table_options,
|
||||||
fd_form_table_options->button_table_delete);
|
fd_form_table_options->button_table_delete);
|
||||||
} else if (fd_form_table_options->form_table_options->visible) {
|
} else
|
||||||
|
#endif
|
||||||
|
if (fd_form_table_options->form_table_options->visible) {
|
||||||
fl_set_focus_object(fd_form_table_options->form_table_options,
|
fl_set_focus_object(fd_form_table_options->form_table_options,
|
||||||
fd_form_table_options->button_table_delete);
|
fd_form_table_options->button_table_delete);
|
||||||
fl_hide_form(fd_form_table_options->form_table_options);
|
fl_hide_form(fd_form_table_options->form_table_options);
|
||||||
@ -257,6 +259,7 @@ void MenuLayoutTable(int flag)
|
|||||||
|
|
||||||
void TableOptionsCB(FL_OBJECT * ob, long)
|
void TableOptionsCB(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
LyXTable * table = 0;
|
LyXTable * table = 0;
|
||||||
int s, num = 0;
|
int s, num = 0;
|
||||||
string special, str;
|
string special, str;
|
||||||
@ -438,6 +441,7 @@ void TableOptionsCB(FL_OBJECT * ob, long)
|
|||||||
} else
|
} else
|
||||||
UpdateLayoutTable(true);
|
UpdateLayoutTable(true);
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -459,6 +463,7 @@ void TableSpeCloseCB(FL_OBJECT *, long)
|
|||||||
|
|
||||||
void SetPWidthCB(FL_OBJECT * ob, long)
|
void SetPWidthCB(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
fl_set_object_label(fd_form_table_options->text_warning, "");
|
fl_set_object_label(fd_form_table_options->text_warning, "");
|
||||||
Confirmed = false;
|
Confirmed = false;
|
||||||
if (ob == fd_form_table_options->input_column_width) {
|
if (ob == fd_form_table_options->input_column_width) {
|
||||||
@ -480,4 +485,5 @@ void SetPWidthCB(FL_OBJECT * ob, long)
|
|||||||
}
|
}
|
||||||
MenuLayoutTable(0); // update for alignment
|
MenuLayoutTable(0); // update for alignment
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "LyXAction.h"
|
#include "LyXAction.h"
|
||||||
#include "toolbar.h"
|
#include "toolbar.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "lyxlex.h"
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
|
19
src/buffer.C
19
src/buffer.C
@ -235,8 +235,6 @@ void Buffer::fileName(string const & newfile)
|
|||||||
// if par = 0 normal behavior
|
// if par = 0 normal behavior
|
||||||
// else insert behavior
|
// else insert behavior
|
||||||
// Returns false if "\the_end" is not read for formats >= 2.13. (Asger)
|
// Returns false if "\the_end" is not read for formats >= 2.13. (Asger)
|
||||||
#define USE_PARSE_FUNCTION 1
|
|
||||||
//#define USE_TABULAR_INSETS 1
|
|
||||||
bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
|
bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
|
||||||
{
|
{
|
||||||
string tmptok;
|
string tmptok;
|
||||||
@ -1027,7 +1025,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
|||||||
par->InsertChar(pos, LyXParagraph::META_NEWLINE, font);
|
par->InsertChar(pos, LyXParagraph::META_NEWLINE, font);
|
||||||
++pos;
|
++pos;
|
||||||
} else if (token == "\\LyXTable") {
|
} else if (token == "\\LyXTable") {
|
||||||
#ifdef USE_TABULAR_INSETS
|
#ifdef NEW_TABULAR
|
||||||
Inset * inset = new InsetTabular(this);
|
Inset * inset = new InsetTabular(this);
|
||||||
inset->Read(this, lex);
|
inset->Read(this, lex);
|
||||||
par->InsertInset(pos, inset, font);
|
par->InsertInset(pos, inset, font);
|
||||||
@ -1291,9 +1289,18 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
|
|||||||
char c, footnoteflag = 0, depth = 0;
|
char c, footnoteflag = 0, depth = 0;
|
||||||
string tmp;
|
string tmp;
|
||||||
LyXParagraph::size_type i;
|
LyXParagraph::size_type i;
|
||||||
int j, h, ltype = 0, ltype_depth = 0,
|
int j;
|
||||||
* clen = 0, actcell = 0, actpos = 0, cell = 0, cells = 0,
|
int ltype = 0;
|
||||||
currlinelen = 0;
|
int ltype_depth = 0;
|
||||||
|
int * actcell = 0;
|
||||||
|
int actpos = 0;
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
|
int h;
|
||||||
|
int * clen = 0;
|
||||||
|
int cell = 0;
|
||||||
|
int cells = 0;
|
||||||
|
#endif
|
||||||
|
int currlinelen = 0;
|
||||||
long fpos = 0;
|
long fpos = 0;
|
||||||
bool ref_printed = false;
|
bool ref_printed = false;
|
||||||
|
|
||||||
|
14
src/lyx_cb.C
14
src/lyx_cb.C
@ -2629,7 +2629,8 @@ void TableApplyCB(FL_OBJECT *, long)
|
|||||||
{
|
{
|
||||||
if (!current_view->available())
|
if (!current_view->available())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
// check for tables in tables
|
// check for tables in tables
|
||||||
if (current_view->text->cursor.par()->table){
|
if (current_view->text->cursor.par()->table){
|
||||||
WriteAlert(_("Impossible Operation!"),
|
WriteAlert(_("Impossible Operation!"),
|
||||||
@ -2637,7 +2638,7 @@ void TableApplyCB(FL_OBJECT *, long)
|
|||||||
_("Sorry."));
|
_("Sorry."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
current_view->owner()->getMiniBuffer()->Set(_("Inserting table..."));
|
current_view->owner()->getMiniBuffer()->Set(_("Inserting table..."));
|
||||||
|
|
||||||
int ysize = int(fl_get_slider_value(fd_form_table->slider_columns) + 0.5);
|
int ysize = int(fl_get_slider_value(fd_form_table->slider_columns) + 0.5);
|
||||||
@ -2693,10 +2694,10 @@ void TableApplyCB(FL_OBJECT *, long)
|
|||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
current_view->text->cursor.par()->table =
|
current_view->text->cursor.par()->table =
|
||||||
new LyXTable(xsize, ysize);
|
new LyXTable(xsize, ysize);
|
||||||
|
#endif
|
||||||
Language const * lang =
|
Language const * lang =
|
||||||
current_view->text->cursor.par()->getParLanguage(current_view->buffer()->params);
|
current_view->text->cursor.par()->getParLanguage(current_view->buffer()->params);
|
||||||
LyXFont font(LyXFont::ALL_INHERIT, lang);
|
LyXFont font(LyXFont::ALL_INHERIT, lang);
|
||||||
@ -2766,7 +2767,10 @@ void FigureApplyCB(FL_OBJECT *, long)
|
|||||||
|
|
||||||
current_view->owner()->getMiniBuffer()->Set(_("Inserting figure..."));
|
current_view->owner()->getMiniBuffer()->Set(_("Inserting figure..."));
|
||||||
if (fl_get_button(fd_form_figure->radio_inline)
|
if (fl_get_button(fd_form_figure->radio_inline)
|
||||||
|| current_view->text->cursor.par()->table) {
|
#ifndef NEW_TABULAR
|
||||||
|
|| current_view->text->cursor.par()->table
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
InsetFig * new_inset = new InsetFig(100, 20, buffer);
|
InsetFig * new_inset = new InsetFig(100, 20, buffer);
|
||||||
current_view->insertInset(new_inset);
|
current_view->insertInset(new_inset);
|
||||||
current_view->owner()->getMiniBuffer()->Set(_("Figure inserted"));
|
current_view->owner()->getMiniBuffer()->Set(_("Figure inserted"));
|
||||||
|
@ -404,9 +404,11 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
|
|||||||
case LFUN_RUNCHKTEX:
|
case LFUN_RUNCHKTEX:
|
||||||
disable = lyxrc.chktex_command == "none";
|
disable = lyxrc.chktex_command == "none";
|
||||||
break;
|
break;
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
case LFUN_LAYOUT_TABLE:
|
case LFUN_LAYOUT_TABLE:
|
||||||
disable = ! owner->view()->text->cursor.par()->table;
|
disable = ! owner->view()->text->cursor.par()->table;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,10 @@ class BufferView;
|
|||||||
// up. (Lgb)
|
// up. (Lgb)
|
||||||
//#define NEW_INSETS 1
|
//#define NEW_INSETS 1
|
||||||
|
|
||||||
|
// I dare you to try this one too. It is ortogonal with NEW_INSETS so you
|
||||||
|
// can try both or just one of them.
|
||||||
|
//#define NEW_TABULAR 1
|
||||||
|
|
||||||
/// A LyXParagraph holds all text, attributes and insets in a text paragraph
|
/// A LyXParagraph holds all text, attributes and insets in a text paragraph
|
||||||
class LyXParagraph {
|
class LyXParagraph {
|
||||||
public:
|
public:
|
||||||
@ -329,11 +333,12 @@ public:
|
|||||||
///
|
///
|
||||||
LyXParagraph * previous;
|
LyXParagraph * previous;
|
||||||
|
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
/* table stuff -- begin*/
|
/* table stuff -- begin*/
|
||||||
///
|
///
|
||||||
LyXTable * table;
|
LyXTable * table;
|
||||||
/* table stuff -- end*/
|
/* table stuff -- end*/
|
||||||
|
#endif
|
||||||
///
|
///
|
||||||
InsetBibKey * bibkey; // ale970302
|
InsetBibKey * bibkey; // ale970302
|
||||||
|
|
||||||
@ -534,6 +539,7 @@ public:
|
|||||||
void UnsetPExtraType(BufferParams const &);
|
void UnsetPExtraType(BufferParams const &);
|
||||||
///
|
///
|
||||||
bool linuxDocConvertChar(char c, string & sgml_string);
|
bool linuxDocConvertChar(char c, string & sgml_string);
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
///
|
///
|
||||||
void DocBookContTableRows(Buffer const *,
|
void DocBookContTableRows(Buffer const *,
|
||||||
std::ostream &, string & extra,
|
std::ostream &, string & extra,
|
||||||
@ -543,6 +549,7 @@ public:
|
|||||||
void SimpleDocBookOneTablePar(Buffer const *,
|
void SimpleDocBookOneTablePar(Buffer const *,
|
||||||
std::ostream &, string & extra,
|
std::ostream &, string & extra,
|
||||||
int & desc_on, int depth);
|
int & desc_on, int depth);
|
||||||
|
#endif
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
struct InsetTable {
|
struct InsetTable {
|
||||||
@ -623,6 +630,7 @@ private:
|
|||||||
int & foot_count,
|
int & foot_count,
|
||||||
bool parent_is_rtl);
|
bool parent_is_rtl);
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
///
|
///
|
||||||
bool SimpleTeXOneTablePar(Buffer const *, BufferParams const &,
|
bool SimpleTeXOneTablePar(Buffer const *, BufferParams const &,
|
||||||
std::ostream &, TexRow & texrow);
|
std::ostream &, TexRow & texrow);
|
||||||
@ -631,6 +639,7 @@ private:
|
|||||||
std::ostream &, size_type i,
|
std::ostream &, size_type i,
|
||||||
int current_cell_number,
|
int current_cell_number,
|
||||||
int & column, TexRow & texrow);
|
int & column, TexRow & texrow);
|
||||||
|
#endif
|
||||||
///
|
///
|
||||||
void SimpleTeXBlanks(std::ostream &, TexRow & texrow,
|
void SimpleTeXBlanks(std::ostream &, TexRow & texrow,
|
||||||
size_type const i,
|
size_type const i,
|
||||||
|
15
src/menus.C
15
src/menus.C
@ -909,6 +909,7 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
|||||||
|
|
||||||
// Table submenu
|
// Table submenu
|
||||||
int SubEditTable = fl_newpup(FL_ObjWin(ob));
|
int SubEditTable = fl_newpup(FL_ObjWin(ob));
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
if (men->currentView()->available() &&
|
if (men->currentView()->available() &&
|
||||||
men->currentView()->text->cursor.par()->table &&
|
men->currentView()->text->cursor.par()->table &&
|
||||||
!tmpbuffer->isReadonly()){
|
!tmpbuffer->isReadonly()){
|
||||||
@ -1005,7 +1006,9 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
|||||||
// xgettext:no-c-format
|
// xgettext:no-c-format
|
||||||
fl_addtopup(SubEditTable, _("|Delete Table%x43"));
|
fl_addtopup(SubEditTable, _("|Delete Table%x43"));
|
||||||
fl_setpup_shortcut(SubEditTable, 43, scex(_("EMT|Dd#d#D")));
|
fl_setpup_shortcut(SubEditTable, 43, scex(_("EMT|Dd#d#D")));
|
||||||
} else if (men->currentView()->the_locking_inset &&
|
} else
|
||||||
|
#endif
|
||||||
|
if (men->currentView()->the_locking_inset &&
|
||||||
(men->currentView()->the_locking_inset->LyxCode() ==
|
(men->currentView()->the_locking_inset->LyxCode() ==
|
||||||
Inset::TABULAR_CODE) &&
|
Inset::TABULAR_CODE) &&
|
||||||
!tmpbuffer->isReadonly()) {
|
!tmpbuffer->isReadonly()) {
|
||||||
@ -1250,11 +1253,14 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
|||||||
static_cast<InsetTabular *>
|
static_cast<InsetTabular *>
|
||||||
(men->currentView()->the_locking_inset);
|
(men->currentView()->the_locking_inset);
|
||||||
inset->TabularFeatures(men->currentView(), choice - 32);
|
inset->TabularFeatures(men->currentView(), choice - 32);
|
||||||
} else {
|
}
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
|
else {
|
||||||
men->currentView()->text->
|
men->currentView()->text->
|
||||||
TableFeatures(men->currentView(), choice - 32);
|
TableFeatures(men->currentView(), choice - 32);
|
||||||
men->currentView()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
men->currentView()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// version control sub-menu
|
// version control sub-menu
|
||||||
@ -1632,11 +1638,12 @@ void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
|
|||||||
fl_setpup_mode(LayoutMenu, 9, FL_PUP_CHECK);
|
fl_setpup_mode(LayoutMenu, 9, FL_PUP_CHECK);
|
||||||
if (font.latex() == LyXFont::ON)
|
if (font.latex() == LyXFont::ON)
|
||||||
fl_setpup_mode(LayoutMenu, 10, FL_PUP_CHECK);
|
fl_setpup_mode(LayoutMenu, 10, FL_PUP_CHECK);
|
||||||
|
|
||||||
// Grey out unavailable entries
|
// Grey out unavailable entries
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
if (!men->currentView()->text->cursor.par()->table)
|
if (!men->currentView()->text->cursor.par()->table)
|
||||||
fl_setpup_mode(LayoutMenu, 5, FL_PUP_GREY);
|
fl_setpup_mode(LayoutMenu, 5, FL_PUP_GREY);
|
||||||
|
#endif
|
||||||
if (tmpbuffer->isReadonly()) {
|
if (tmpbuffer->isReadonly()) {
|
||||||
fl_setpup_mode(LayoutMenu, 1, FL_PUP_GREY);
|
fl_setpup_mode(LayoutMenu, 1, FL_PUP_GREY);
|
||||||
fl_setpup_mode(LayoutMenu, 6, FL_PUP_GREY);
|
fl_setpup_mode(LayoutMenu, 6, FL_PUP_GREY);
|
||||||
|
@ -397,8 +397,10 @@ void LyXParagraph::validate(LaTeXFeatures & features) const
|
|||||||
(*cit).inset->Validate(features);
|
(*cit).inset->Validate(features);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
if (table && table->IsLongTable())
|
if (table && table->IsLongTable())
|
||||||
features.longtable = true;
|
features.longtable = true;
|
||||||
|
#endif
|
||||||
if (pextra_type == PEXTRA_INDENT)
|
if (pextra_type == PEXTRA_INDENT)
|
||||||
features.LyXParagraphIndent = true;
|
features.LyXParagraphIndent = true;
|
||||||
if (pextra_type == PEXTRA_FLOATFLT)
|
if (pextra_type == PEXTRA_FLOATFLT)
|
||||||
@ -411,8 +413,10 @@ void LyXParagraph::validate(LaTeXFeatures & features) const
|
|||||||
if (params.paragraph_separation == BufferParams::PARSEP_INDENT
|
if (params.paragraph_separation == BufferParams::PARSEP_INDENT
|
||||||
&& pextra_type == LyXParagraph::PEXTRA_MINIPAGE)
|
&& pextra_type == LyXParagraph::PEXTRA_MINIPAGE)
|
||||||
features.NeedLyXMinipageIndent = true;
|
features.NeedLyXMinipageIndent = true;
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
if (table && table->NeedRotating())
|
if (table && table->NeedRotating())
|
||||||
features.rotating = true;
|
features.rotating = true;
|
||||||
|
#endif
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
if (footnoteflag != NO_FOOTNOTE && footnotekind == ALGORITHM)
|
if (footnoteflag != NO_FOOTNOTE && footnotekind == ALGORITHM)
|
||||||
features.algorithm = true;
|
features.algorithm = true;
|
||||||
@ -1572,7 +1576,12 @@ int LyXParagraph::StripLeadingSpaces(LyXTextClassList::size_type tclass)
|
|||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
!IsDummy() &&
|
!IsDummy() &&
|
||||||
#endif
|
#endif
|
||||||
!table){
|
#ifndef NEW_TABULAR
|
||||||
|
!table
|
||||||
|
#else
|
||||||
|
true
|
||||||
|
#endif
|
||||||
|
){
|
||||||
while (Last()
|
while (Last()
|
||||||
&& (IsNewline(0) || IsLineSeparator(0))){
|
&& (IsNewline(0) || IsLineSeparator(0))){
|
||||||
Erase(0);
|
Erase(0);
|
||||||
@ -2388,15 +2397,17 @@ LyXParagraph * LyXParagraph::TeXOnePar(Buffer const * buf,
|
|||||||
default:
|
default:
|
||||||
// we don't need it for the last paragraph!!!
|
// we don't need it for the last paragraph!!!
|
||||||
if (next
|
if (next
|
||||||
&& !(
|
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
footnoteflag != LyXParagraph::NO_FOOTNOTE
|
&& !( footnoteflag != LyXParagraph::NO_FOOTNOTE
|
||||||
&& footnotekind != LyXParagraph::FOOTNOTE
|
&& footnotekind != LyXParagraph::FOOTNOTE
|
||||||
&& footnotekind != LyXParagraph::MARGIN &&
|
&& footnotekind != LyXParagraph::MARGIN)
|
||||||
#endif
|
#endif
|
||||||
(table
|
#ifndef NEW_TABULAR
|
||||||
|
&& !(table
|
||||||
|| (par
|
|| (par
|
||||||
&& par->table)))) {
|
&& par->table))
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
// don't insert this if we would be adding it
|
// don't insert this if we would be adding it
|
||||||
// before or after a table in a float. This
|
// before or after a table in a float. This
|
||||||
// little trick is needed in order to allow
|
// little trick is needed in order to allow
|
||||||
@ -2682,6 +2693,7 @@ bool LyXParagraph::SimpleTeXOnePar(Buffer const * buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
// This one spits out the text of a table paragraph
|
// This one spits out the text of a table paragraph
|
||||||
bool LyXParagraph::SimpleTeXOneTablePar(Buffer const * buf,
|
bool LyXParagraph::SimpleTeXOneTablePar(Buffer const * buf,
|
||||||
BufferParams const & bparams,
|
BufferParams const & bparams,
|
||||||
@ -2866,8 +2878,10 @@ bool LyXParagraph::SimpleTeXOneTablePar(Buffer const * buf,
|
|||||||
lyxerr[Debug::LATEX] << "SimpleTeXOneTablePar...done " << this << endl;
|
lyxerr[Debug::LATEX] << "SimpleTeXOneTablePar...done " << this << endl;
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
// This one spits out the text off ContRows in tables
|
// This one spits out the text off ContRows in tables
|
||||||
bool LyXParagraph::TeXContTableRows(Buffer const * buf,
|
bool LyXParagraph::TeXContTableRows(Buffer const * buf,
|
||||||
BufferParams const & bparams,
|
BufferParams const & bparams,
|
||||||
@ -2978,6 +2992,7 @@ bool LyXParagraph::TeXContTableRows(Buffer const * buf,
|
|||||||
lyxerr[Debug::LATEX] << "TeXContTableRows...done " << this << endl;
|
lyxerr[Debug::LATEX] << "TeXContTableRows...done " << this << endl;
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool LyXParagraph::linuxDocConvertChar(char c, string & sgml_string)
|
bool LyXParagraph::linuxDocConvertChar(char c, string & sgml_string)
|
||||||
@ -3044,6 +3059,7 @@ bool LyXParagraph::linuxDocConvertChar(char c, string & sgml_string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
void LyXParagraph::SimpleDocBookOneTablePar(Buffer const * buffer,
|
void LyXParagraph::SimpleDocBookOneTablePar(Buffer const * buffer,
|
||||||
ostream & os, string & extra,
|
ostream & os, string & extra,
|
||||||
int & desc_on, int depth)
|
int & desc_on, int depth)
|
||||||
@ -3228,8 +3244,10 @@ void LyXParagraph::SimpleDocBookOneTablePar(Buffer const * buffer,
|
|||||||
lyxerr[Debug::LATEX] << "SimpleDocbookOneTablePar...done "
|
lyxerr[Debug::LATEX] << "SimpleDocbookOneTablePar...done "
|
||||||
<< this << endl;
|
<< this << endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
void LyXParagraph::DocBookContTableRows(Buffer const * buffer,
|
void LyXParagraph::DocBookContTableRows(Buffer const * buffer,
|
||||||
ostream & os, string & extra,
|
ostream & os, string & extra,
|
||||||
int & desc_on,
|
int & desc_on,
|
||||||
@ -3378,6 +3396,7 @@ void LyXParagraph::DocBookContTableRows(Buffer const * buffer,
|
|||||||
}
|
}
|
||||||
lyxerr[Debug::LATEX] << "DocBookContTableRows...done " << this << endl;
|
lyxerr[Debug::LATEX] << "DocBookContTableRows...done " << this << endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void LyXParagraph::SimpleTeXBlanks(ostream & os, TexRow & texrow,
|
void LyXParagraph::SimpleTeXBlanks(ostream & os, TexRow & texrow,
|
||||||
@ -3894,7 +3913,9 @@ LyXParagraph * LyXParagraph::TeXEnvironment(Buffer const * buf,
|
|||||||
if (par && par->depth > depth) {
|
if (par && par->depth > depth) {
|
||||||
if (textclasslist.Style(bparams.textclass,
|
if (textclasslist.Style(bparams.textclass,
|
||||||
par->layout).isParagraph()
|
par->layout).isParagraph()
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
&& !par->table
|
&& !par->table
|
||||||
|
#endif
|
||||||
// Thinko!
|
// Thinko!
|
||||||
// How to handle this? (Lgb)
|
// How to handle this? (Lgb)
|
||||||
//&& !suffixIs(os, "\n\n")
|
//&& !suffixIs(os, "\n\n")
|
||||||
@ -4509,14 +4530,17 @@ LyXParagraph::getParLanguage(BufferParams const & bparams) const
|
|||||||
#endif
|
#endif
|
||||||
else if (previous)
|
else if (previous)
|
||||||
return previous->getParLanguage(bparams);
|
return previous->getParLanguage(bparams);
|
||||||
else
|
//else
|
||||||
return bparams.language_info;
|
return bparams.language_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LyXParagraph::isRightToLeftPar(BufferParams const & bparams) const
|
bool LyXParagraph::isRightToLeftPar(BufferParams const & bparams) const
|
||||||
{
|
{
|
||||||
return lyxrc.rtl_support && !table
|
return lyxrc.rtl_support
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
|
&& !table
|
||||||
|
#endif
|
||||||
&& getParLanguage(bparams)->RightToLeft();
|
&& getParLanguage(bparams)->RightToLeft();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4598,9 +4622,9 @@ string LyXParagraph::String(Buffer const * buffer,
|
|||||||
LyXParagraph::size_type end)
|
LyXParagraph::size_type end)
|
||||||
{
|
{
|
||||||
string s;
|
string s;
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
int actcell = 0;
|
int actcell = 0;
|
||||||
int cell = 1;
|
int cell = 1;
|
||||||
#ifndef NEW_TABULAR
|
|
||||||
if (table)
|
if (table)
|
||||||
for (LyXParagraph::size_type i = 0; i < beg; ++i)
|
for (LyXParagraph::size_type i = 0; i < beg; ++i)
|
||||||
if (IsNewline(i)) {
|
if (IsNewline(i)) {
|
||||||
@ -4633,7 +4657,9 @@ string LyXParagraph::String(Buffer const * buffer,
|
|||||||
ost << '\0';
|
ost << '\0';
|
||||||
#endif
|
#endif
|
||||||
s += ost.str();
|
s += ost.str();
|
||||||
} else if (table && IsNewlineChar(c)) {
|
}
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
|
else if (table && IsNewlineChar(c)) {
|
||||||
if (cell >= table->NumberOfCellsInRow(actcell)) {
|
if (cell >= table->NumberOfCellsInRow(actcell)) {
|
||||||
s += '\n';
|
s += '\n';
|
||||||
cell = 1;
|
cell = 1;
|
||||||
@ -4643,6 +4669,7 @@ string LyXParagraph::String(Buffer const * buffer,
|
|||||||
}
|
}
|
||||||
++actcell;
|
++actcell;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
53
src/text.C
53
src/text.C
@ -260,8 +260,11 @@ void LyXText::ComputeBidiTables(Buffer const * buf, Row * row) const
|
|||||||
LyXParagraph::size_type pos =
|
LyXParagraph::size_type pos =
|
||||||
(is_space && lpos + 1 <= bidi_end &&
|
(is_space && lpos + 1 <= bidi_end &&
|
||||||
!row->par()->IsLineSeparator(lpos + 1) &&
|
!row->par()->IsLineSeparator(lpos + 1) &&
|
||||||
(!row->par()->table
|
(
|
||||||
|| !row->par()->IsNewline(lpos + 1)) )
|
#ifndef NEW_TABULAR
|
||||||
|
!row->par()->table ||
|
||||||
|
#endif
|
||||||
|
!row->par()->IsNewline(lpos + 1)) )
|
||||||
? lpos + 1 : lpos;
|
? lpos + 1 : lpos;
|
||||||
LyXFont font = row->par()->GetFontSettings(buf->params, pos);
|
LyXFont font = row->par()->GetFontSettings(buf->params, pos);
|
||||||
bool new_rtl = font.isVisibleRightToLeft();
|
bool new_rtl = font.isVisibleRightToLeft();
|
||||||
@ -342,14 +345,20 @@ bool LyXText::IsBoundary(Buffer const * buf, LyXParagraph * par,
|
|||||||
if (!lyxrc.rtl_support)
|
if (!lyxrc.rtl_support)
|
||||||
return false; // This is just for speedup
|
return false; // This is just for speedup
|
||||||
|
|
||||||
if (!bidi_InRange(pos - 1) ||
|
if (!bidi_InRange(pos - 1)
|
||||||
(par->table && par->IsNewline(pos-1)) )
|
#ifndef NEW_TABULAR
|
||||||
|
|| (par->table && par->IsNewline(pos-1))
|
||||||
|
#endif
|
||||||
|
)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool rtl = bidi_level(pos - 1) % 2;
|
bool rtl = bidi_level(pos - 1) % 2;
|
||||||
bool rtl2 = rtl;
|
bool rtl2 = rtl;
|
||||||
if (pos == par->Last() ||
|
if (pos == par->Last()
|
||||||
(par->table && par->IsNewline(pos)))
|
#ifndef NEW_TABULAR
|
||||||
|
|| (par->table && par->IsNewline(pos))
|
||||||
|
#endif
|
||||||
|
)
|
||||||
rtl2 = par->isRightToLeftPar(buf->params);
|
rtl2 = par->isRightToLeftPar(buf->params);
|
||||||
else if (bidi_InRange(pos))
|
else if (bidi_InRange(pos))
|
||||||
rtl2 = bidi_level(pos) % 2;
|
rtl2 = bidi_level(pos) % 2;
|
||||||
@ -366,8 +375,11 @@ bool LyXText::IsBoundary(Buffer const * buf, LyXParagraph * par,
|
|||||||
|
|
||||||
bool rtl = font.isVisibleRightToLeft();
|
bool rtl = font.isVisibleRightToLeft();
|
||||||
bool rtl2 = rtl;
|
bool rtl2 = rtl;
|
||||||
if (pos == par->Last() ||
|
if (pos == par->Last()
|
||||||
(par->table && par->IsNewline(pos)))
|
#ifndef NEW_TABULAR
|
||||||
|
|| (par->table && par->IsNewline(pos))
|
||||||
|
#endif
|
||||||
|
)
|
||||||
rtl2 = par->isRightToLeftPar(buf->params);
|
rtl2 = par->isRightToLeftPar(buf->params);
|
||||||
else if (bidi_InRange(pos))
|
else if (bidi_InRange(pos))
|
||||||
rtl2 = bidi_level(pos) % 2;
|
rtl2 = bidi_level(pos) % 2;
|
||||||
@ -1921,7 +1933,11 @@ void LyXText::BreakParagraph(BufferView * bview, char keep_layout)
|
|||||||
|
|
||||||
SetHeightOfRow(bview, cursor.row());
|
SetHeightOfRow(bview, cursor.row());
|
||||||
|
|
||||||
while (!cursor.par()->Next()->table && cursor.par()->Next()->Last()
|
while (
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
|
!cursor.par()->Next()->table &&
|
||||||
|
#endif
|
||||||
|
cursor.par()->Next()->Last()
|
||||||
&& cursor.par()->Next()->IsNewline(0))
|
&& cursor.par()->Next()->IsNewline(0))
|
||||||
cursor.par()->Next()->Erase(0);
|
cursor.par()->Next()->Erase(0);
|
||||||
|
|
||||||
@ -3962,8 +3978,8 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
} else if (sel_start_cursor.row() == row_ptr ||
|
} else if (sel_start_cursor.row() == row_ptr ||
|
||||||
sel_end_cursor.row() == row_ptr) {
|
sel_end_cursor.row() == row_ptr) {
|
||||||
float tmpx = x;
|
float tmpx = x;
|
||||||
int cell = 0;
|
|
||||||
#ifndef NEW_TABULAR
|
#ifndef NEW_TABULAR
|
||||||
|
int cell = 0;
|
||||||
if (row_ptr->par()->table) {
|
if (row_ptr->par()->table) {
|
||||||
cell = NumberOfCell(row_ptr->par(), row_ptr->pos());
|
cell = NumberOfCell(row_ptr->par(), row_ptr->pos());
|
||||||
tmpx += row_ptr->par()->table->GetBeginningOfTextInCell(cell);
|
tmpx += row_ptr->par()->table->GetBeginningOfTextInCell(cell);
|
||||||
@ -4888,9 +4904,12 @@ int LyXText::GetColumnNearX(BufferView * bview, Row * row, int & x,
|
|||||||
(!rtl && vc == last + 1 && x > tmpx + 5) ))
|
(!rtl && vc == last + 1 && x > tmpx + 5) ))
|
||||||
c = last + 1;
|
c = last + 1;
|
||||||
#endif
|
#endif
|
||||||
else if (vc == row->pos() ||
|
else if (vc == row->pos()
|
||||||
(row->par()->table
|
#ifndef NEW_TABULAR
|
||||||
&& vc <= last && row->par()->IsNewline(vc-1)) ) {
|
|| (row->par()->table
|
||||||
|
&& vc <= last && row->par()->IsNewline(vc-1))
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
c = vis2log(vc);
|
c = vis2log(vc);
|
||||||
if (bidi_level(c) % 2 == 1)
|
if (bidi_level(c) % 2 == 1)
|
||||||
++c;
|
++c;
|
||||||
@ -4903,8 +4922,12 @@ int LyXText::GetColumnNearX(BufferView * bview, Row * row, int & x,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!row->par()->table && row->pos() <= last && c > last
|
if (
|
||||||
&& row->par()->IsNewline(last)) {
|
#ifndef NEW_TABULAR
|
||||||
|
!row->par()->table &&
|
||||||
|
#endif
|
||||||
|
row->pos() <= last && c > last
|
||||||
|
&& row->par()->IsNewline(last)) {
|
||||||
if (bidi_level(last) % 2 == 0)
|
if (bidi_level(last) % 2 == 0)
|
||||||
tmpx -= SingleWidth(bview, row->par(), last);
|
tmpx -= SingleWidth(bview, row->par(), last);
|
||||||
else
|
else
|
||||||
|
185
src/text2.C
185
src/text2.C
@ -44,12 +44,11 @@
|
|||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "FloatList.h"
|
#include "FloatList.h"
|
||||||
|
|
||||||
//#define USE_OLD_CUT_AND_PASTE 1
|
|
||||||
|
|
||||||
using std::copy;
|
using std::copy;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::pair;
|
using std::pair;
|
||||||
|
|
||||||
|
|
||||||
LyXText::LyXText(BufferView * bv)
|
LyXText::LyXText(BufferView * bv)
|
||||||
{
|
{
|
||||||
bv_owner = bv;
|
bv_owner = bv;
|
||||||
@ -627,83 +626,82 @@ LyXParagraph * LyXText::SetLayout(BufferView * bview,
|
|||||||
// set layout over selection and make a total rebreak of those paragraphs
|
// set layout over selection and make a total rebreak of those paragraphs
|
||||||
void LyXText::SetLayout(BufferView * bview, LyXTextClass::size_type layout)
|
void LyXText::SetLayout(BufferView * bview, LyXTextClass::size_type layout)
|
||||||
{
|
{
|
||||||
LyXCursor
|
LyXCursor tmpcursor = cursor; /* store the current cursor */
|
||||||
tmpcursor = cursor; /* store the current cursor */
|
|
||||||
|
|
||||||
#ifdef USE_OLD_SET_LAYOUT
|
// #ifdef USE_OLD_SET_LAYOUT
|
||||||
// if there is no selection just set the layout
|
// // if there is no selection just set the layout
|
||||||
// of the current paragraph */
|
// // of the current paragraph */
|
||||||
if (!selection) {
|
// if (!selection) {
|
||||||
sel_start_cursor = cursor; // dummy selection
|
// sel_start_cursor = cursor; // dummy selection
|
||||||
sel_end_cursor = cursor;
|
// sel_end_cursor = cursor;
|
||||||
}
|
// }
|
||||||
|
|
||||||
LyXParagraph * endpar = sel_end_cursor.par()->LastPhysicalPar()->Next();
|
// LyXParagraph * endpar = sel_end_cursor.par()->LastPhysicalPar()->Next();
|
||||||
LyXParagraph * undoendpar = endpar;
|
// LyXParagraph * undoendpar = endpar;
|
||||||
|
|
||||||
if (endpar && endpar->GetDepth()) {
|
// if (endpar && endpar->GetDepth()) {
|
||||||
while (endpar && endpar->GetDepth()) {
|
// while (endpar && endpar->GetDepth()) {
|
||||||
endpar = endpar->LastPhysicalPar()->Next();
|
// endpar = endpar->LastPhysicalPar()->Next();
|
||||||
undoendpar = endpar;
|
// undoendpar = endpar;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if (endpar) {
|
// else if (endpar) {
|
||||||
endpar = endpar->Next(); // because of parindents etc.
|
// endpar = endpar->Next(); // because of parindents etc.
|
||||||
}
|
// }
|
||||||
|
|
||||||
SetUndo(Undo::EDIT,
|
// SetUndo(Undo::EDIT,
|
||||||
sel_start_cursor.par()->ParFromPos(sel_start_cursor.pos())->previous,
|
// sel_start_cursor.par()->ParFromPos(sel_start_cursor.pos())->previous,
|
||||||
undoendpar);
|
// undoendpar);
|
||||||
|
|
||||||
/* ok we have a selection. This is always between sel_start_cursor
|
// /* ok we have a selection. This is always between sel_start_cursor
|
||||||
* and sel_end cursor */
|
// * and sel_end cursor */
|
||||||
cursor = sel_start_cursor;
|
// cursor = sel_start_cursor;
|
||||||
|
|
||||||
LyXLayout const & lyxlayout =
|
// LyXLayout const & lyxlayout =
|
||||||
textclasslist.Style(bview->buffer()->params.textclass, layout);
|
// textclasslist.Style(bview->buffer()->params.textclass, layout);
|
||||||
|
|
||||||
while (cursor.par() != sel_end_cursor.par()) {
|
// while (cursor.par() != sel_end_cursor.par()) {
|
||||||
if (cursor.par()->footnoteflag ==
|
// if (cursor.par()->footnoteflag ==
|
||||||
sel_start_cursor.par()->footnoteflag) {
|
// sel_start_cursor.par()->footnoteflag) {
|
||||||
cursor.par()->SetLayout(layout);
|
// cursor.par()->SetLayout(layout);
|
||||||
MakeFontEntriesLayoutSpecific(cursor.par());
|
// MakeFontEntriesLayoutSpecific(cursor.par());
|
||||||
LyXParagraph* fppar = cursor.par()->FirstPhysicalPar();
|
// LyXParagraph* fppar = cursor.par()->FirstPhysicalPar();
|
||||||
fppar->added_space_top = lyxlayout.fill_top ?
|
// fppar->added_space_top = lyxlayout.fill_top ?
|
||||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
// VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
||||||
fppar->added_space_bottom = lyxlayout.fill_bottom ?
|
// fppar->added_space_bottom = lyxlayout.fill_bottom ?
|
||||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
// VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
||||||
if (lyxlayout.margintype == MARGIN_MANUAL)
|
// if (lyxlayout.margintype == MARGIN_MANUAL)
|
||||||
cursor.par()->SetLabelWidthString(lyxlayout.labelstring());
|
// cursor.par()->SetLabelWidthString(lyxlayout.labelstring());
|
||||||
if (lyxlayout.labeltype != LABEL_BIBLIO
|
// if (lyxlayout.labeltype != LABEL_BIBLIO
|
||||||
&& fppar->bibkey) {
|
// && fppar->bibkey) {
|
||||||
delete fppar->bibkey;
|
// delete fppar->bibkey;
|
||||||
fppar->bibkey = 0;
|
// fppar->bibkey = 0;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
cursor.par() = cursor.par()->Next();
|
// cursor.par() = cursor.par()->Next();
|
||||||
}
|
// }
|
||||||
if (cursor.par()->footnoteflag ==
|
// if (cursor.par()->footnoteflag ==
|
||||||
sel_start_cursor.par()->footnoteflag) {
|
// sel_start_cursor.par()->footnoteflag) {
|
||||||
cursor.par()->SetLayout(layout);
|
// cursor.par()->SetLayout(layout);
|
||||||
MakeFontEntriesLayoutSpecific(cursor.par());
|
// MakeFontEntriesLayoutSpecific(cursor.par());
|
||||||
#ifndef NEW_INSETS
|
// #ifndef NEW_INSETS
|
||||||
LyXParagraph* fppar = cursor.par()->FirstPhysicalPar();
|
// LyXParagraph* fppar = cursor.par()->FirstPhysicalPar();
|
||||||
#else
|
// #else
|
||||||
LyXParagraph* fppar = cursor.par();
|
// LyXParagraph* fppar = cursor.par();
|
||||||
#endif
|
// #endif
|
||||||
fppar->added_space_top = lyxlayout.fill_top ?
|
// fppar->added_space_top = lyxlayout.fill_top ?
|
||||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
// VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
||||||
fppar->added_space_bottom = lyxlayout.fill_bottom ?
|
// fppar->added_space_bottom = lyxlayout.fill_bottom ?
|
||||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
// VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
||||||
if (lyxlayout.margintype == MARGIN_MANUAL)
|
// if (lyxlayout.margintype == MARGIN_MANUAL)
|
||||||
cursor.par()->SetLabelWidthString(lyxlayout.labelstring());
|
// cursor.par()->SetLabelWidthString(lyxlayout.labelstring());
|
||||||
if (lyxlayout.labeltype != LABEL_BIBLIO
|
// if (lyxlayout.labeltype != LABEL_BIBLIO
|
||||||
&& fppar->bibkey) {
|
// && fppar->bibkey) {
|
||||||
delete fppar->bibkey;
|
// delete fppar->bibkey;
|
||||||
fppar->bibkey = 0;
|
// fppar->bibkey = 0;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
#else
|
// #else
|
||||||
// if there is no selection just set the layout
|
// if there is no selection just set the layout
|
||||||
// of the current paragraph */
|
// of the current paragraph */
|
||||||
if (!selection) {
|
if (!selection) {
|
||||||
@ -713,11 +711,11 @@ void LyXText::SetLayout(BufferView * bview, LyXTextClass::size_type layout)
|
|||||||
LyXParagraph *
|
LyXParagraph *
|
||||||
endpar = SetLayout(bview, cursor, sel_start_cursor,
|
endpar = SetLayout(bview, cursor, sel_start_cursor,
|
||||||
sel_end_cursor, layout);
|
sel_end_cursor, layout);
|
||||||
#endif
|
//#endif
|
||||||
RedoParagraphs(bview, sel_start_cursor, endpar);
|
RedoParagraphs(bview, sel_start_cursor, endpar);
|
||||||
|
|
||||||
// we have to reset the selection, because the
|
// we have to reset the selection, because the
|
||||||
// geometry could have changed */
|
// geometry could have changed
|
||||||
SetCursor(bview, sel_start_cursor.par(),
|
SetCursor(bview, sel_start_cursor.par(),
|
||||||
sel_start_cursor.pos(), false);
|
sel_start_cursor.pos(), false);
|
||||||
sel_cursor = cursor;
|
sel_cursor = cursor;
|
||||||
@ -2554,7 +2552,6 @@ void LyXText::InsertStringA(BufferView * bview, string const & str)
|
|||||||
LyXParagraph * par = cursor.par();
|
LyXParagraph * par = cursor.par();
|
||||||
LyXParagraph::size_type pos = cursor.pos();
|
LyXParagraph::size_type pos = cursor.pos();
|
||||||
LyXParagraph::size_type a = 0;
|
LyXParagraph::size_type a = 0;
|
||||||
int cell = 0;
|
|
||||||
LyXParagraph * endpar = cursor.par()->Next();
|
LyXParagraph * endpar = cursor.par()->Next();
|
||||||
|
|
||||||
SetCursorParUndo(bview->buffer());
|
SetCursorParUndo(bview->buffer());
|
||||||
@ -2574,7 +2571,7 @@ void LyXText::InsertStringA(BufferView * bview, string const & str)
|
|||||||
&& pos && par->GetChar(pos - 1)!= ' ') {
|
&& pos && par->GetChar(pos - 1)!= ' ') {
|
||||||
par->InsertChar(pos, ' ', current_font);
|
par->InsertChar(pos, ' ', current_font);
|
||||||
++pos;
|
++pos;
|
||||||
#ifndef NEW_TABLAR
|
#ifndef NEW_TABULAR
|
||||||
} else if (par->table) {
|
} else if (par->table) {
|
||||||
if (str[i] == '\t') {
|
if (str[i] == '\t') {
|
||||||
while((pos < par->size()) &&
|
while((pos < par->size()) &&
|
||||||
@ -2631,7 +2628,7 @@ void LyXText::InsertStringA(BufferView * bview, string const & str)
|
|||||||
(par->GetChar(pos) != LyXParagraph::META_NEWLINE))
|
(par->GetChar(pos) != LyXParagraph::META_NEWLINE))
|
||||||
++pos;
|
++pos;
|
||||||
++pos;
|
++pos;
|
||||||
cell = NumberOfCell(par, pos);
|
int cell = NumberOfCell(par, pos);
|
||||||
while((pos < par->size()) &&
|
while((pos < par->size()) &&
|
||||||
!(par->table->IsFirstCell(cell))) {
|
!(par->table->IsFirstCell(cell))) {
|
||||||
|
|
||||||
@ -2683,14 +2680,24 @@ void LyXText::InsertStringA(BufferView * bview, string const & str)
|
|||||||
void LyXText::InsertStringB(BufferView * bview, string const & s)
|
void LyXText::InsertStringB(BufferView * bview, string const & s)
|
||||||
{
|
{
|
||||||
string str(s);
|
string str(s);
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
LyXParagraph * par = cursor.par();
|
LyXParagraph * par = cursor.par();
|
||||||
|
#endif
|
||||||
string::size_type i = 1;
|
string::size_type i = 1;
|
||||||
while (i < str.length()) {
|
while (i < str.length()) {
|
||||||
if (str[i] == '\t' && !par->table)
|
if (str[i] == '\t'
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
|
&& !par->table
|
||||||
|
#endif
|
||||||
|
)
|
||||||
str[i] = ' ';
|
str[i] = ' ';
|
||||||
if (str[i] == ' ' && i + 1 < str.length() && str[i + 1] == ' ')
|
if (str[i] == ' ' && i + 1 < str.length() && str[i + 1] == ' ')
|
||||||
str[i] = 13;
|
str[i] = 13;
|
||||||
if (str[i] == '\n' && i + 1 < str.length() && !par->table){
|
if (str[i] == '\n' && i + 1 < str.length()
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
|
&& !par->table
|
||||||
|
#endif
|
||||||
|
){
|
||||||
if (str[i + 1] != '\n') {
|
if (str[i + 1] != '\n') {
|
||||||
if (str[i - 1] != ' ')
|
if (str[i - 1] != ' ')
|
||||||
str[i] = ' ';
|
str[i] = ' ';
|
||||||
@ -2950,8 +2957,11 @@ void LyXText::SetCursor(BufferView *bview, LyXCursor & cur, LyXParagraph * par,
|
|||||||
cursor_vpos = (row->par()->isRightToLeftPar(bview->buffer()->params))
|
cursor_vpos = (row->par()->isRightToLeftPar(bview->buffer()->params))
|
||||||
? row->pos() : last + 1;
|
? row->pos() : last + 1;
|
||||||
else if (pos > row->pos() &&
|
else if (pos > row->pos() &&
|
||||||
(pos > last || boundary ||
|
(pos > last || boundary
|
||||||
(row->par()->table && row->par()->IsNewline(pos))))
|
#ifndef NEW_TABULAR
|
||||||
|
|| (row->par()->table && row->par()->IsNewline(pos))
|
||||||
|
#endif
|
||||||
|
))
|
||||||
/// Place cursor after char at (logical) position pos - 1
|
/// Place cursor after char at (logical) position pos - 1
|
||||||
cursor_vpos = (bidi_level(pos - 1) % 2 == 0)
|
cursor_vpos = (bidi_level(pos - 1) % 2 == 0)
|
||||||
? log2vis(pos - 1) + 1 : log2vis(pos - 1);
|
? log2vis(pos - 1) + 1 : log2vis(pos - 1);
|
||||||
@ -3040,8 +3050,11 @@ void LyXText::SetCurrentFont(BufferView * bview) const
|
|||||||
--pos;
|
--pos;
|
||||||
|
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
if (pos == cursor.par()->Last() ||
|
if (pos == cursor.par()->Last()
|
||||||
(cursor.par()->table && cursor.par()->IsNewline(pos)))
|
#ifndef NEW_TABULAR
|
||||||
|
|| (cursor.par()->table && cursor.par()->IsNewline(pos))
|
||||||
|
#endif
|
||||||
|
)
|
||||||
--pos;
|
--pos;
|
||||||
else if (cursor.par()->IsSeparator(pos)) {
|
else if (cursor.par()->IsSeparator(pos)) {
|
||||||
if (pos > cursor.row()->pos() &&
|
if (pos > cursor.row()->pos() &&
|
||||||
@ -3155,7 +3168,11 @@ void LyXText::CursorRight(BufferView * bview, bool internal) const
|
|||||||
void LyXText::CursorRightIntern(BufferView * bview, bool internal) const
|
void LyXText::CursorRightIntern(BufferView * bview, bool internal) const
|
||||||
{
|
{
|
||||||
if (!internal && cursor.boundary() &&
|
if (!internal && cursor.boundary() &&
|
||||||
(!cursor.par()->table || !cursor.par()->IsNewline(cursor.pos())))
|
(
|
||||||
|
#ifndef NEW_TABULAR
|
||||||
|
!cursor.par()->table ||
|
||||||
|
#endif
|
||||||
|
!cursor.par()->IsNewline(cursor.pos())))
|
||||||
SetCursor(bview, cursor.par(), cursor.pos(), true, false);
|
SetCursor(bview, cursor.par(), cursor.pos(), true, false);
|
||||||
else if (cursor.pos() < cursor.par()->Last()) {
|
else if (cursor.pos() < cursor.par()->Last()) {
|
||||||
SetCursor(bview, cursor.par(), cursor.pos() + 1, true, false);
|
SetCursor(bview, cursor.par(), cursor.pos() + 1, true, false);
|
||||||
|
@ -41,6 +41,40 @@ extern char const ** get_pixmap_from_symbol(char const * arg, int, int);
|
|||||||
extern LyXAction lyxaction;
|
extern LyXAction lyxaction;
|
||||||
|
|
||||||
|
|
||||||
|
Toolbar::toolbarItem::toolbarItem()
|
||||||
|
{
|
||||||
|
action = LFUN_NOACTION;
|
||||||
|
icon = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Toolbar::toolbarItem::clean()
|
||||||
|
{
|
||||||
|
if (icon) {
|
||||||
|
fl_delete_object(icon);
|
||||||
|
fl_free_object(icon);
|
||||||
|
icon = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Toolbar::toolbarItem::~toolbarItem()
|
||||||
|
{
|
||||||
|
clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Toolbar::toolbarItem &
|
||||||
|
Toolbar::toolbarItem::operator=(Toolbar::toolbarItem const & ti)
|
||||||
|
{
|
||||||
|
// do we have to check icon and IsBitmap too?
|
||||||
|
action = ti.action;
|
||||||
|
icon = 0; // locally we need to get the icon anew
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Toolbar::Toolbar(LyXView * o, int x, int y)
|
Toolbar::Toolbar(LyXView * o, int x, int y)
|
||||||
: owner(o), sxpos(x), sypos(y)
|
: owner(o), sxpos(x), sypos(y)
|
||||||
{
|
{
|
||||||
|
@ -20,9 +20,11 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
#include "lyxfunc.h"
|
#include "commandtags.h"
|
||||||
#include "combox.h"
|
#include "combox.h"
|
||||||
|
|
||||||
|
class LyXView;
|
||||||
|
|
||||||
/** The LyX toolbar class
|
/** The LyX toolbar class
|
||||||
This class {\em is} the LyX toolbar, and is not likely to be enhanced
|
This class {\em is} the LyX toolbar, and is not likely to be enhanced
|
||||||
further until we begin the move to Qt. We will probably have to make our
|
further until we begin the move to Qt. We will probably have to make our
|
||||||
@ -92,30 +94,13 @@ private:
|
|||||||
///
|
///
|
||||||
FL_OBJECT * icon;
|
FL_OBJECT * icon;
|
||||||
///
|
///
|
||||||
toolbarItem() {
|
toolbarItem();
|
||||||
action = LFUN_NOACTION;
|
|
||||||
icon = 0;
|
|
||||||
}
|
|
||||||
///
|
///
|
||||||
void clean() {
|
void clean();
|
||||||
if (icon) {
|
|
||||||
fl_delete_object(icon);
|
|
||||||
fl_free_object(icon);
|
|
||||||
icon = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
///
|
///
|
||||||
~toolbarItem() {
|
~toolbarItem();
|
||||||
clean();
|
///
|
||||||
}
|
toolbarItem & operator=(toolbarItem const & ti);
|
||||||
|
|
||||||
toolbarItem & operator=(const toolbarItem & ti) {
|
|
||||||
// do we have to check icon and IsBitmap too?
|
|
||||||
action = ti.action;
|
|
||||||
icon = 0; // locally we need to get the icon anew
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// typedef to simplify things
|
/// typedef to simplify things
|
||||||
@ -152,12 +137,7 @@ private:
|
|||||||
|
|
||||||
/** more...
|
/** more...
|
||||||
*/
|
*/
|
||||||
void reset();// {
|
void reset();
|
||||||
// toollist = 0;
|
|
||||||
// cleaned = false;
|
|
||||||
//
|
|
||||||
// lightReset();
|
|
||||||
// }
|
|
||||||
|
|
||||||
/** more...
|
/** more...
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user