So now we have a TabularLayoutMenu for inset-tabulars too!

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@725 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2000-05-08 13:39:45 +00:00
parent ba08201457
commit 7fd69b7307
5 changed files with 553 additions and 76 deletions

View File

@ -1,3 +1,12 @@
2000-05-08 Juergen Vigna <jug@sad.it>
* src/insets/insettabular.C (InsetButtonRelease): Now opens the
TabularLayoutMenu with mouse-button-3
(LocalDispatch): added LFUN_MENU_LAYOUT to open the Tabular-Layout.
* src/TabularLayout.C: added this file for having a Layout for
tabular-insets.
2000-05-05 Juergen Vigna <jug@sad.it>
* src/insets/insettabular.C (UpdateLocal): resetCursorPos when

View File

@ -59,6 +59,7 @@ lyx_SOURCES = \
Spacing.C \
Spacing.h \
TableLayout.C \
TabularLayout.C \
TextCache.C \
TextCache.h \
ToolbarDefaults.C \

View File

@ -22,6 +22,11 @@ extern FD_form_table_options * fd_form_table_options;
extern FD_form_table_extra * fd_form_table_extra;
extern BufferView * current_view;
extern bool UpdateLayoutTabular(int);
extern void TabularOptionsCB(FL_OBJECT * ob, long l);
extern void SetPWidthTabularCB(FL_OBJECT * ob, long l);
static int Confirmed = false;
static int ActCell;
@ -35,6 +40,9 @@ static int extra_col_cursor_x; // need no y's, one-line input fields
static int extra_multicol_cursor_x;
// Joacim
#define IS_TABULAR (current_view->the_locking_inset && \
(current_view->the_locking_inset->LyxCode() == \
Inset::TABULAR_CODE))
bool UpdateLayoutTable(int flag)
{
@ -211,6 +219,8 @@ bool UpdateLayoutTable(int flag)
table->RotateTable());
fl_set_focus_object(fd_form_table_options->form_table_options,
fd_form_table_options->button_table_delete);
} else if (update && IS_TABULAR) {
UpdateLayoutTabular(flag);
} else if (fd_form_table_options->form_table_options->visible) {
fl_set_focus_object(fd_form_table_options->form_table_options,
fd_form_table_options->button_table_delete);
@ -255,8 +265,13 @@ void MenuLayoutTable(int flag)
}
void TableOptionsCB(FL_OBJECT * ob, long)
void TableOptionsCB(FL_OBJECT * ob, long l)
{
if (IS_TABULAR) {
TabularOptionsCB(ob, l);
return;
}
LyXTable * table = 0;
int s, num = 0;
string special, str;
@ -457,8 +472,13 @@ void TableSpeCloseCB(FL_OBJECT *, long)
return;
}
void SetPWidthCB(FL_OBJECT * ob, long)
void SetPWidthCB(FL_OBJECT * ob, long l)
{
if (IS_TABULAR) {
SetPWidthCB(ob, l);
return;
}
fl_set_object_label(fd_form_table_options->text_warning, "");
Confirmed = false;
if (ob == fd_form_table_options->input_column_width) {

433
src/TabularLayout.C Normal file
View File

@ -0,0 +1,433 @@
#include <config.h>
#include <cstdlib>
#include FORMS_H_LOCATION
#include "layout_forms.h"
#include "lyx_main.h"
#include "lyxrc.h"
#include "LString.h"
#include "support/filetools.h"
#include "buffer.h"
#include "vspace.h"
#include "lyx_gui_misc.h"
#include "BufferView.h"
#include "gettext.h"
#include "layout.h"
#include "tabular.h"
#include "insets/insettabular.h"
// Prototypes
extern FD_form_table_options * fd_form_table_options;
extern FD_form_table_extra * fd_form_table_extra;
extern BufferView * current_view;
extern void OpenLayoutTableExtra();
static int Confirmed = false;
static int ActCell;
// hack to keep the cursor from jumping to the end of the text in the Extra
// form input fields during editing. The values in LyXTabular itself is
// changed in real-time, but we have no callbacks for the input fields,
// so I simply store and restore the cursor position for now.
// (too much of a hazzle to do it proper; we'll trash all this code
// in 1.1 anyway)
static int extra_col_cursor_x; // need no y's, one-line input fields
static int extra_multicol_cursor_x;
// Joacim
bool UpdateLayoutTabular(int flag)
{
bool update = true;
if (!current_view->available())
update = false;
if (update && current_view->the_locking_inset &&
(current_view->the_locking_inset->LyxCode() == Inset::TABULAR_CODE)) {
char buf[12];
string pwidth, special;
InsetTabular * inset = static_cast<InsetTabular *>
(current_view->the_locking_inset);
LyXTabular * table = inset->tabular;
int cell = inset->GetActCell();
ActCell = cell;
int column = table->column_of_cell(cell)+1;
fl_set_object_label(fd_form_table_options->text_warning, "");
Confirmed = false;
fl_activate_object(fd_form_table_extra->input_special_alignment);
fl_activate_object(fd_form_table_extra->input_special_multialign);
fl_activate_object(fd_form_table_options->input_column_width);
sprintf(buf, "%d", column);
fl_set_input(fd_form_table_options->input_table_column, buf);
fl_deactivate_object(fd_form_table_options->input_table_column);
int row = table->row_of_cell(cell)+1;
sprintf(buf, "%d", row);
fl_set_input(fd_form_table_options->input_table_row, buf);
fl_deactivate_object(fd_form_table_options->input_table_row);
if (table->IsMultiColumn(cell))
fl_set_button(fd_form_table_options->radio_multicolumn, 1);
else
fl_set_button(fd_form_table_options->radio_multicolumn, 0);
if (table->GetRotateCell(cell))
fl_set_button(fd_form_table_options->radio_rotate_cell, 1);
else
fl_set_button(fd_form_table_options->radio_rotate_cell, 0);
if (table->TopLine(cell))
fl_set_button(fd_form_table_options->radio_border_top, 1);
else
fl_set_button(fd_form_table_options->radio_border_top, 0);
if (table->BottomLine(cell))
fl_set_button(fd_form_table_options->radio_border_bottom, 1);
else
fl_set_button(fd_form_table_options->radio_border_bottom, 0);
if (table->LeftLine(cell))
fl_set_button(fd_form_table_options->radio_border_left, 1);
else
fl_set_button(fd_form_table_options->radio_border_left, 0);
if (table->RightLine(cell))
fl_set_button(fd_form_table_options->radio_border_right, 1);
else
fl_set_button(fd_form_table_options->radio_border_right, 0);
int align = table->GetAlignment(cell);
fl_set_button(fd_form_table_options->radio_align_left, 0);
fl_set_button(fd_form_table_options->radio_align_right, 0);
fl_set_button(fd_form_table_options->radio_align_center, 0);
special = table->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
if (flag)
{
fl_set_input(fd_form_table_extra->input_special_alignment,
special.c_str());
fl_set_input_cursorpos(fd_form_table_extra->input_special_alignment,
extra_col_cursor_x, 0); // restore the cursor
}
if (current_view->buffer()->isReadonly())
fl_deactivate_object(fd_form_table_extra->input_special_alignment);
special = table->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
if (flag)
{
fl_set_input(fd_form_table_extra->input_special_multialign,
special.c_str());
fl_set_input_cursorpos(fd_form_table_extra->input_special_multialign,
extra_multicol_cursor_x, 0); // restore the cursor
}
if (current_view->buffer()->isReadonly())
fl_deactivate_object(fd_form_table_extra->input_special_multialign);
pwidth = table->GetPWidth(cell);
if (flag)
fl_set_input(fd_form_table_options->input_column_width, pwidth.c_str());
if (current_view->buffer()->isReadonly())
fl_deactivate_object(fd_form_table_options->input_column_width);
if (!pwidth.empty()) {
fl_activate_object(fd_form_table_options->radio_linebreak_cell);
fl_set_object_lcol(fd_form_table_options->radio_linebreak_cell,
FL_BLACK);
fl_set_button(fd_form_table_options->radio_linebreak_cell,
table->GetLinebreaks(cell));
} else {
fl_deactivate_object(fd_form_table_options->radio_linebreak_cell);
fl_set_object_lcol(fd_form_table_options->radio_linebreak_cell,
FL_INACTIVE);
fl_set_button(fd_form_table_options->radio_linebreak_cell, 0);
}
if ((!pwidth.empty() && !table->IsMultiColumn(cell)) ||
(align == LYX_ALIGN_LEFT))
fl_set_button(fd_form_table_options->radio_align_left, 1);
else if (align == LYX_ALIGN_RIGHT)
fl_set_button(fd_form_table_options->radio_align_right, 1);
else
fl_set_button(fd_form_table_options->radio_align_center, 1);
if (!pwidth.empty() && !table->IsMultiColumn(cell)) {
fl_deactivate_object(fd_form_table_options->radio_align_left);
fl_deactivate_object(fd_form_table_options->radio_align_right);
fl_deactivate_object(fd_form_table_options->radio_align_center);
fl_set_object_lcol(fd_form_table_options->radio_align_left,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_align_right,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_align_center,
FL_INACTIVE);
} else {
fl_activate_object(fd_form_table_options->radio_align_left);
fl_activate_object(fd_form_table_options->radio_align_right);
fl_activate_object(fd_form_table_options->radio_align_center);
fl_set_object_lcol(fd_form_table_options->radio_align_left,
FL_BLACK);
fl_set_object_lcol(fd_form_table_options->radio_align_right,
FL_BLACK);
fl_set_object_lcol(fd_form_table_options->radio_align_center,
FL_BLACK);
}
fl_set_button(fd_form_table_options->radio_longtable, table->IsLongTabular());
if (table->IsLongTabular()) {
fl_activate_object(fd_form_table_options->radio_lt_firsthead);
fl_activate_object(fd_form_table_options->radio_lt_head);
fl_activate_object(fd_form_table_options->radio_lt_foot);
fl_activate_object(fd_form_table_options->radio_lt_lastfoot);
fl_activate_object(fd_form_table_options->radio_lt_newpage);
fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead,
FL_BLACK);
fl_set_object_lcol(fd_form_table_options->radio_lt_head,
FL_BLACK);
fl_set_object_lcol(fd_form_table_options->radio_lt_foot,
FL_BLACK);
fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot,
FL_BLACK);
fl_set_object_lcol(fd_form_table_options->radio_lt_newpage,
FL_BLACK);
fl_set_button(fd_form_table_options->radio_lt_firsthead,
table->GetRowOfLTFirstHead(cell));
fl_set_button(fd_form_table_options->radio_lt_head,
table->GetRowOfLTHead(cell));
fl_set_button(fd_form_table_options->radio_lt_foot,
table->GetRowOfLTFoot(cell));
fl_set_button(fd_form_table_options->radio_lt_lastfoot,
table->GetRowOfLTLastFoot(cell));
fl_set_button(fd_form_table_options->radio_lt_newpage,
table->GetLTNewPage(cell));
} else {
fl_deactivate_object(fd_form_table_options->radio_lt_firsthead);
fl_deactivate_object(fd_form_table_options->radio_lt_head);
fl_deactivate_object(fd_form_table_options->radio_lt_foot);
fl_deactivate_object(fd_form_table_options->radio_lt_lastfoot);
fl_deactivate_object(fd_form_table_options->radio_lt_newpage);
fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
fl_set_button(fd_form_table_options->radio_lt_head, 0);
fl_set_button(fd_form_table_options->radio_lt_foot, 0);
fl_set_button(fd_form_table_options->radio_lt_lastfoot, 0);
fl_set_button(fd_form_table_options->radio_lt_newpage, 0);
fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_lt_head,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_lt_foot,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_lt_newpage,
FL_INACTIVE);
}
fl_set_button(fd_form_table_options->radio_rotate_table,
table->GetRotateTabular());
fl_set_focus_object(fd_form_table_options->form_table_options,
fd_form_table_options->button_table_delete);
} else if (fd_form_table_options->form_table_options->visible) {
fl_set_focus_object(fd_form_table_options->form_table_options,
fd_form_table_options->button_table_delete);
fl_hide_form(fd_form_table_options->form_table_options);
}
return update;
}
void TabularOptionsCB(FL_OBJECT * ob, long)
{
if (!current_view->available() || !current_view->the_locking_inset ||
(current_view->the_locking_inset->LyxCode() != Inset::TABULAR_CODE)) {
MenuLayoutTable(0);
return;
}
int s, num = 0;
string special, str;
InsetTabular * inset = static_cast<InsetTabular *>
(current_view->the_locking_inset);
LyXTabular * table = inset->tabular;
int cell = inset->GetActCell();
if (ActCell != cell) {
MenuLayoutTable(0);
fl_set_object_label(fd_form_table_options->text_warning,
_("Warning: Wrong Cursor position, updated window"));
fl_show_object(fd_form_table_options->text_warning);
extra_col_cursor_x = 0; // would rather place it at the end, but...
extra_multicol_cursor_x = 0;
return;
}
// No point in processing directives that you can't do anything with
// anyhow, so exit now if the buffer is read-only.
if (current_view->buffer()->isReadonly()) {
MenuLayoutTable(0);
return;
}
if (ob != fd_form_table_options->button_table_delete) {
fl_set_object_label(fd_form_table_options->text_warning, "");
Confirmed = false;
}
str = fl_get_input(fd_form_table_options->input_column_width);
if (!str.empty() && !isValidLength(str)) {
fl_set_object_label(fd_form_table_options->text_warning,
_("Warning: Invalid Length (valid example: 10mm)"));
fl_show_object(fd_form_table_options->text_warning);
return;
}
if (((ob==fd_form_table_options->button_delete_row)&&(table->rows()<=1)) ||
((ob==fd_form_table_options->button_delete_column)&&(table->columns()<=1)))
ob = fd_form_table_options->button_table_delete;
if (ob == fd_form_table_options->button_append_row)
num = LyXTabular::APPEND_ROW;
else if (ob == fd_form_table_options->button_append_column)
num = LyXTabular::APPEND_COLUMN;
else if (ob == fd_form_table_options->button_delete_row)
num = LyXTabular::DELETE_ROW;
else if (ob == fd_form_table_options->button_delete_column)
num = LyXTabular::DELETE_COLUMN;
else if (ob == fd_form_table_options->button_set_borders)
num = LyXTabular::SET_ALL_LINES;
else if (ob == fd_form_table_options->button_unset_borders)
num = LyXTabular::UNSET_ALL_LINES;
else if (ob == fd_form_table_options->radio_border_top)
num = LyXTabular::TOGGLE_LINE_TOP;
else if (ob == fd_form_table_options->radio_border_bottom)
num = LyXTabular::TOGGLE_LINE_BOTTOM;
else if (ob == fd_form_table_options->radio_border_left)
num = LyXTabular::TOGGLE_LINE_LEFT;
else if (ob == fd_form_table_options->radio_border_right)
num = LyXTabular::TOGGLE_LINE_RIGHT;
else if (ob == fd_form_table_options->radio_align_left)
num = LyXTabular::ALIGN_LEFT;
else if (ob == fd_form_table_options->radio_align_right)
num = LyXTabular::ALIGN_RIGHT;
else if (ob == fd_form_table_options->radio_align_center)
num = LyXTabular::ALIGN_CENTER;
else if ((ob == fd_form_table_options->button_table_delete) && !Confirmed) {
fl_set_object_label(fd_form_table_options->text_warning,
_("Confirm: press Delete-Button again"));
Confirmed = true;
return;
} else if ((ob == fd_form_table_options->button_table_delete)
&& Confirmed) {
num = LyXTabular::DELETE_TABULAR;
Confirmed = false;
} else if (ob == fd_form_table_options->radio_multicolumn)
num = LyXTabular::MULTICOLUMN;
else if (ob == fd_form_table_options->radio_longtable) {
s = fl_get_button(fd_form_table_options->radio_longtable);
if (s) {
num = LyXTabular::SET_LONGTABULAR;
fl_activate_object(fd_form_table_options->radio_lt_firsthead);
fl_activate_object(fd_form_table_options->radio_lt_head);
fl_activate_object(fd_form_table_options->radio_lt_foot);
fl_activate_object(fd_form_table_options->radio_lt_lastfoot);
fl_activate_object(fd_form_table_options->radio_lt_newpage);
fl_set_button(fd_form_table_options->radio_lt_firsthead,
table->GetRowOfLTFirstHead(cell));
fl_set_button(fd_form_table_options->radio_lt_head,
table->GetRowOfLTHead(cell));
fl_set_button(fd_form_table_options->radio_lt_foot,
table->GetRowOfLTFoot(cell));
fl_set_button(fd_form_table_options->radio_lt_lastfoot,
table->GetRowOfLTLastFoot(cell));
fl_set_button(fd_form_table_options->radio_lt_firsthead,
table->GetLTNewPage(cell));
} else {
num = LyXTabular::UNSET_LONGTABULAR;
fl_deactivate_object(fd_form_table_options->radio_lt_firsthead);
fl_deactivate_object(fd_form_table_options->radio_lt_head);
fl_deactivate_object(fd_form_table_options->radio_lt_foot);
fl_deactivate_object(fd_form_table_options->radio_lt_lastfoot);
fl_deactivate_object(fd_form_table_options->radio_lt_newpage);
fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_lt_head,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_lt_foot,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_lt_newpage,
FL_INACTIVE);
}
} else if (ob == fd_form_table_options->radio_rotate_table) {
s = fl_get_button(fd_form_table_options->radio_rotate_table);
if (s)
num = LyXTabular::SET_ROTATE_TABULAR;
else
num = LyXTabular::UNSET_ROTATE_TABULAR;
} else if (ob == fd_form_table_options->radio_rotate_cell) {
s = fl_get_button(fd_form_table_options->radio_rotate_cell);
if (s)
num = LyXTabular::SET_ROTATE_CELL;
else
num = LyXTabular::UNSET_ROTATE_CELL;
} else if (ob == fd_form_table_options->radio_linebreak_cell) {
num = LyXTabular::SET_LINEBREAKS;
} else if (ob == fd_form_table_options->radio_lt_firsthead) {
num = LyXTabular::SET_LTFIRSTHEAD;
} else if (ob == fd_form_table_options->radio_lt_head) {
num = LyXTabular::SET_LTHEAD;
} else if (ob == fd_form_table_options->radio_lt_foot) {
num = LyXTabular::SET_LTFOOT;
} else if (ob == fd_form_table_options->radio_lt_lastfoot) {
num = LyXTabular::SET_LTLASTFOOT;
} else if (ob == fd_form_table_options->radio_lt_newpage) {
num = LyXTabular::SET_LTNEWPAGE;
} else if (ob == fd_form_table_options->button_table_extra) {
OpenLayoutTableExtra();
return;
} else if (ob == fd_form_table_extra->input_special_alignment) {
special = fl_get_input(fd_form_table_extra->input_special_alignment);
int dummy;
fl_get_input_cursorpos(ob, &extra_col_cursor_x, &dummy);
num = LyXTabular::SET_SPECIAL_COLUMN;
} else if (ob == fd_form_table_extra->input_special_multialign) {
special = fl_get_input(fd_form_table_extra->input_special_multialign);
int dummy;
fl_get_input_cursorpos(ob, &extra_multicol_cursor_x, &dummy);
num = LyXTabular::SET_SPECIAL_MULTI;
} else
return;
if (current_view->available()) {
current_view->hideCursor();
// if ((num == LyXTabular::SET_SPECIAL_COLUMN) ||
// (num == LyXTabular::SET_SPECIAL_MULTI))
inset->TabularFeatures(current_view, num, special);
// else
// inset->TabularFeatures(num);
}
if (num == LyXTabular::DELETE_TABULAR) {
fl_set_focus_object(fd_form_table_options->form_table_options,
fd_form_table_options->button_table_delete);
fl_hide_form(fd_form_table_options->form_table_options);
} else
UpdateLayoutTabular(true);
return;
}
void SetPWidthTabularCB(FL_OBJECT * ob, long)
{
if (!current_view->available() || !current_view->the_locking_inset ||
(current_view->the_locking_inset->LyxCode() != Inset::TABULAR_CODE)) {
return;
}
InsetTabular * inset = static_cast<InsetTabular *>
(current_view->the_locking_inset);
fl_set_object_label(fd_form_table_options->text_warning, "");
Confirmed = false;
if (ob == fd_form_table_options->input_column_width) {
string str = fl_get_input(ob);
if (!str.empty() && !isValidLength(str)) {
fl_set_object_label(fd_form_table_options->text_warning,
_("Warning: Invalid Length (valid example: 10mm)"));
fl_show_object(fd_form_table_options->text_warning);
return;
}
if (current_view->available()){
current_view->hideCursor();
inset->TabularFeatures(current_view, LyXTabular::SET_PWIDTH, str);
}
MenuLayoutTable(0); // update for alignment
}
}

View File

@ -28,8 +28,12 @@
#include "font.h"
#include "lyxtext.h"
#include "lyx_gui_misc.h"
#include "LyXView.h"
#include "lyxfunc.h"
#include "insets/insettext.h"
extern bool MenuLayoutTable(int);
const int ADD_TO_HEIGHT = 2;
const int ADD_TO_TABULAR_WIDTH = 2;
@ -327,6 +331,10 @@ int InsetTabular::InsetInInsetY()
void InsetTabular::InsetButtonRelease(BufferView * bv,
int x, int y, int button)
{
if (button == 3) {
LocalDispatch(bv, LFUN_LAYOUT_TABLE, "true");
return;
}
if (the_locking_inset) {
the_locking_inset->InsetButtonRelease(bv, x-inset_x, y-inset_y,button);
return;
@ -450,81 +458,87 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
HideInsetCursor(bv);
switch (action) {
// Normal chars not handled here
case -1:
break;
// --- Cursor Movements ---------------------------------------------
case LFUN_RIGHTSEL:
moveRight(bv, false);
sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
break;
case LFUN_RIGHT:
result = moveRight(bv);
if (hasCharSelection()) {
sel_pos_start = sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
} else
sel_pos_start = sel_pos_end = cursor.pos;
break;
case LFUN_LEFTSEL:
moveLeft(bv, false);
sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
break;
case LFUN_LEFT:
result = moveLeft(bv);
if (hasCharSelection()) {
sel_pos_start = sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
} else
sel_pos_start = sel_pos_end = cursor.pos;
break;
case LFUN_DOWNSEL:
moveDown();
sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
break;
case LFUN_DOWN:
result= moveDown();
if (hasCharSelection()) {
sel_pos_start = sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
} else
sel_pos_start = sel_pos_end = cursor.pos;
break;
case LFUN_UPSEL:
moveUp();
sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
break;
case LFUN_UP:
result= moveUp();
if (hasCharSelection()) {
sel_pos_start = sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
} else
sel_pos_start = sel_pos_end = cursor.pos;
break;
case LFUN_BACKSPACE:
break;
case LFUN_DELETE:
break;
case LFUN_HOME:
break;
case LFUN_END:
break;
case LFUN_TAB:
if (hasCharSelection()) {
sel_pos_start = sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
}
sel_pos_start = sel_pos_end = cursor.pos;
moveNextCell();
break;
default:
result = UNDISPATCHED;
// Normal chars not handled here
case -1:
break;
// --- Cursor Movements ---------------------------------------------
case LFUN_RIGHTSEL:
moveRight(bv, false);
sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
break;
case LFUN_RIGHT:
result = moveRight(bv);
if (hasCharSelection()) {
sel_pos_start = sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
} else
sel_pos_start = sel_pos_end = cursor.pos;
break;
case LFUN_LEFTSEL:
moveLeft(bv, false);
sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
break;
case LFUN_LEFT:
result = moveLeft(bv);
if (hasCharSelection()) {
sel_pos_start = sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
} else
sel_pos_start = sel_pos_end = cursor.pos;
break;
case LFUN_DOWNSEL:
moveDown();
sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
break;
case LFUN_DOWN:
result= moveDown();
if (hasCharSelection()) {
sel_pos_start = sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
} else
sel_pos_start = sel_pos_end = cursor.pos;
break;
case LFUN_UPSEL:
moveUp();
sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
break;
case LFUN_UP:
result= moveUp();
if (hasCharSelection()) {
sel_pos_start = sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
} else
sel_pos_start = sel_pos_end = cursor.pos;
break;
case LFUN_BACKSPACE:
break;
case LFUN_DELETE:
break;
case LFUN_HOME:
break;
case LFUN_END:
break;
case LFUN_TAB:
if (hasCharSelection()) {
sel_pos_start = sel_pos_end = cursor.pos;
UpdateLocal(bv, false);
}
sel_pos_start = sel_pos_end = cursor.pos;
moveNextCell();
break;
case LFUN_LAYOUT_TABLE:
{
int flag = (arg == "true");
MenuLayoutTable(flag);
}
break;
default:
result = UNDISPATCHED;
break;
}
if (result!=FINISHED) {
if (!the_locking_inset) {