mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 14:04:25 +00:00
Three patches from Dekel. Read ChangeLog
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@791 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
aafafa8dd7
commit
609a11852e
29
ChangeLog
29
ChangeLog
@ -1,3 +1,32 @@
|
|||||||
|
2000-06-02 Dekel Tsur <dekel@math.tau.ac.il>
|
||||||
|
|
||||||
|
* src/BufferView2.C (removeAutoInsets): Fix a bug:
|
||||||
|
Do not call to SetCursor when the paragraph is a closed footnote!
|
||||||
|
|
||||||
|
2000-06-01 Dekel Tsur <dekel@math.tau.ac.il>
|
||||||
|
|
||||||
|
* src/insets/insetlabel.C (Edit): Mark buffer as dirty when a
|
||||||
|
label is changed.
|
||||||
|
|
||||||
|
* src/text.C (SetCursor): Made the computation of cursor_vpos safer.
|
||||||
|
|
||||||
|
2000-05-31 Dekel Tsur <dekel@math.tau.ac.il>
|
||||||
|
|
||||||
|
* forms/lyx.fd
|
||||||
|
* src/lyx_cb.C (RefSelectCB): Added "Go Back" button in the insert
|
||||||
|
reference popup, that activates the reference-back action
|
||||||
|
|
||||||
|
* src/menus.C (ShowRefsMenu): Added "Go Back" menu item.
|
||||||
|
|
||||||
|
* src/menus.C (Add_to_refs_menu): Limit the size of each item in
|
||||||
|
the menus. Also fixed a bug.
|
||||||
|
|
||||||
|
* src/lyx_cb.C (updateAllVisibleBufferRelatedPopups): Do not close
|
||||||
|
the math panels when switching buffers (unless new buffer is readonly).
|
||||||
|
|
||||||
|
* src/BufferView.C (NoSavedPositions)
|
||||||
|
* src/BufferView_pimpl.C (NoSavedPositions): New methods
|
||||||
|
|
||||||
2000-06-01 Lars Gullik Bjønnes <larsbj@lyx.org>
|
2000-06-01 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
* src/lyx_cb.C (MakeLaTeXOutput): we run MakeLaTeXOutput regard
|
* src/lyx_cb.C (MakeLaTeXOutput): we run MakeLaTeXOutput regard
|
||||||
|
20
forms/lyx.fd
20
forms/lyx.fd
@ -502,7 +502,7 @@ argument: 0
|
|||||||
Name: form_ref
|
Name: form_ref
|
||||||
Width: 590
|
Width: 590
|
||||||
Height: 400
|
Height: 400
|
||||||
Number of Objects: 12
|
Number of Objects: 13
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
class: FL_BOX
|
class: FL_BOX
|
||||||
@ -721,5 +721,23 @@ name: prettyref
|
|||||||
callback: RefSelectCB
|
callback: RefSelectCB
|
||||||
argument: 4
|
argument: 4
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
class: FL_BUTTON
|
||||||
|
type: NORMAL_BUTTON
|
||||||
|
box: 310 320 160 30
|
||||||
|
boxtype: FL_UP_BOX
|
||||||
|
colors: FL_COL1 FL_COL1
|
||||||
|
alignment: FL_ALIGN_CENTER
|
||||||
|
style: FL_NORMAL_STYLE
|
||||||
|
size: FL_NORMAL_SIZE
|
||||||
|
lcol: FL_BLACK
|
||||||
|
label: Go Back|#B
|
||||||
|
shortcut:
|
||||||
|
resize: FL_RESIZE_NONE
|
||||||
|
gravity: FL_SouthWest FL_SouthWest
|
||||||
|
name: back
|
||||||
|
callback: RefSelectCB
|
||||||
|
argument: 6
|
||||||
|
|
||||||
==============================
|
==============================
|
||||||
create_the_forms
|
create_the_forms
|
||||||
|
@ -237,6 +237,12 @@ void BufferView::restorePosition()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool BufferView::NoSavedPositions()
|
||||||
|
{
|
||||||
|
return pimpl_->NoSavedPositions();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::update(signed char f)
|
void BufferView::update(signed char f)
|
||||||
{
|
{
|
||||||
pimpl_->update(f);
|
pimpl_->update(f);
|
||||||
|
@ -73,6 +73,8 @@ public:
|
|||||||
void savePosition();
|
void savePosition();
|
||||||
///
|
///
|
||||||
void restorePosition();
|
void restorePosition();
|
||||||
|
///
|
||||||
|
bool NoSavedPositions();
|
||||||
/** This holds the mapping between buffer paragraphs and screen rows.
|
/** This holds the mapping between buffer paragraphs and screen rows.
|
||||||
This should be private...but not yet. (Lgb)
|
This should be private...but not yet. (Lgb)
|
||||||
*/
|
*/
|
||||||
|
@ -102,6 +102,7 @@ bool BufferView::removeAutoInsets()
|
|||||||
bool a = false;
|
bool a = false;
|
||||||
while (par) {
|
while (par) {
|
||||||
// this has to be done before the delete
|
// this has to be done before the delete
|
||||||
|
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
|
||||||
text->SetCursor(cursor, par, 0);
|
text->SetCursor(cursor, par, 0);
|
||||||
if (par->AutoDeleteInsets()){
|
if (par->AutoDeleteInsets()){
|
||||||
a = true;
|
a = true;
|
||||||
|
@ -1380,6 +1380,11 @@ void BufferView::Pimpl::restorePosition()
|
|||||||
update(0);
|
update(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BufferView::Pimpl::NoSavedPositions()
|
||||||
|
{
|
||||||
|
return backstack.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::Pimpl::setState()
|
void BufferView::Pimpl::setState()
|
||||||
{
|
{
|
||||||
|
@ -89,6 +89,8 @@ struct BufferView::Pimpl {
|
|||||||
///
|
///
|
||||||
void restorePosition();
|
void restorePosition();
|
||||||
///
|
///
|
||||||
|
bool NoSavedPositions();
|
||||||
|
///
|
||||||
void setState();
|
void setState();
|
||||||
///
|
///
|
||||||
void insetSleep();
|
void insetSleep();
|
||||||
|
@ -59,6 +59,7 @@ void InsetLabel::Edit(BufferView * bv, int, int, unsigned int)
|
|||||||
string new_contents = frontStrip(strip(result.second));
|
string new_contents = frontStrip(strip(result.second));
|
||||||
if (!new_contents.empty() &&
|
if (!new_contents.empty() &&
|
||||||
contents != new_contents) {
|
contents != new_contents) {
|
||||||
|
bv->buffer()->markDirty();
|
||||||
bool flag = bv->ChangeRefs(contents,new_contents);
|
bool flag = bv->ChangeRefs(contents,new_contents);
|
||||||
contents = new_contents;
|
contents = new_contents;
|
||||||
bv->text->RedoParagraph();
|
bv->text->RedoParagraph();
|
||||||
|
@ -190,6 +190,10 @@ FD_form_ref *create_form_form_ref(void)
|
|||||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||||
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
|
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
|
||||||
fl_set_object_callback(obj, RefSelectCB, 4);
|
fl_set_object_callback(obj, RefSelectCB, 4);
|
||||||
|
fdui->back = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 320, 160, 30, idex(_("Go Back|#B")));fl_set_button_shortcut(obj,scex(_("Go Back|#B")), 1);
|
||||||
|
fl_set_object_lsize(obj,FL_NORMAL_SIZE);
|
||||||
|
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
|
||||||
|
fl_set_object_callback(obj,RefSelectCB, 6);
|
||||||
fl_end_form();
|
fl_end_form();
|
||||||
|
|
||||||
//fdui->form_ref->fdui = fdui;
|
//fdui->form_ref->fdui = fdui;
|
||||||
|
@ -81,6 +81,7 @@ typedef struct {
|
|||||||
FL_OBJECT *vref;
|
FL_OBJECT *vref;
|
||||||
FL_OBJECT *vpageref;
|
FL_OBJECT *vpageref;
|
||||||
FL_OBJECT *prettyref;
|
FL_OBJECT *prettyref;
|
||||||
|
FL_OBJECT *back;
|
||||||
} FD_form_ref;
|
} FD_form_ref;
|
||||||
|
|
||||||
extern FD_form_ref * create_form_form_ref(void);
|
extern FD_form_ref * create_form_form_ref(void);
|
||||||
|
21
src/lyx_cb.C
21
src/lyx_cb.C
@ -3203,8 +3203,19 @@ extern "C" void RefSelectCB(FL_OBJECT *, long data)
|
|||||||
if (s.empty())
|
if (s.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (data >= 5) {
|
if (data == 5) {
|
||||||
current_view->owner()->getLyXFunc()->Dispatch(LFUN_REFGOTO, s.c_str());
|
current_view->owner()->getLyXFunc()->Dispatch(LFUN_REFGOTO, s.c_str());
|
||||||
|
if (!current_view->NoSavedPositions()) {
|
||||||
|
fl_activate_object(fd_form_ref->back);
|
||||||
|
fl_set_object_lcol(fd_form_ref->back, FL_BLACK);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else if (data >= 6) {
|
||||||
|
current_view->owner()->getLyXFunc()->Dispatch(LFUN_REFBACK);
|
||||||
|
if (current_view->NoSavedPositions()) {
|
||||||
|
fl_deactivate_object(fd_form_ref->back);
|
||||||
|
fl_set_object_lcol(fd_form_ref->back, FL_INACTIVE);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3262,6 +3273,14 @@ extern "C" void RefUpdateCB(FL_OBJECT *, long)
|
|||||||
bool sgml = current_view->buffer()->isSGML();
|
bool sgml = current_view->buffer()->isSGML();
|
||||||
bool readonly = current_view->buffer()->isReadonly();
|
bool readonly = current_view->buffer()->isReadonly();
|
||||||
|
|
||||||
|
if (current_view->NoSavedPositions()) {
|
||||||
|
fl_deactivate_object(fd_form_ref->back);
|
||||||
|
fl_set_object_lcol(fd_form_ref->back, FL_INACTIVE);
|
||||||
|
} else {
|
||||||
|
fl_activate_object(fd_form_ref->back);
|
||||||
|
fl_set_object_lcol(fd_form_ref->back, FL_BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
if (empty) {
|
if (empty) {
|
||||||
fl_add_browser_line(brow,
|
fl_add_browser_line(brow,
|
||||||
_("*** No labels found in document ***"));
|
_("*** No labels found in document ***"));
|
||||||
|
@ -251,12 +251,18 @@ void updateAllVisibleBufferRelatedPopups()
|
|||||||
if (fd_form_table->form_table->visible) {
|
if (fd_form_table->form_table->visible) {
|
||||||
fl_hide_form(fd_form_table->form_table);
|
fl_hide_form(fd_form_table->form_table);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// We have either changed buffers or changed the readonly status
|
#ifndef ALWAYS_UPDATE_REF
|
||||||
// so the safest thing to do is hide all inset popups that
|
// We must update the popup in order to make the
|
||||||
// are editting insets from the previous buffer or aren't
|
// insert ref buttons insactive
|
||||||
// allowed in readonly docs.
|
if (fd_form_ref->form_ref->visible) {
|
||||||
|
RefUpdateCB(0, 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ALWAYS_CLOSE_MATH_PANELS
|
||||||
|
// The math popups should be closed only if we switch
|
||||||
|
// to a readonly buffer
|
||||||
if (fd_panel) {
|
if (fd_panel) {
|
||||||
if (fd_panel->panel->visible) {
|
if (fd_panel->panel->visible) {
|
||||||
fl_hide_form(fd_panel->panel);
|
fl_hide_form(fd_panel->panel);
|
||||||
@ -282,6 +288,40 @@ void updateAllVisibleBufferRelatedPopups()
|
|||||||
fl_hide_form(fd_matrix->matrix);
|
fl_hide_form(fd_matrix->matrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// We have either changed buffers or changed the readonly status
|
||||||
|
// so the safest thing to do is hide all inset popups that
|
||||||
|
// are editting insets from the previous buffer or aren't
|
||||||
|
// allowed in readonly docs.
|
||||||
|
#ifdef ALWAYS_CLOSE_MATH_PANELS
|
||||||
|
if (fd_panel) {
|
||||||
|
if (fd_panel->panel->visible) {
|
||||||
|
fl_hide_form(fd_panel->panel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fd_delim) {
|
||||||
|
if (fd_delim->delim->visible) {
|
||||||
|
fl_hide_form(fd_delim->delim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fd_deco) {
|
||||||
|
if (fd_deco->deco->visible) {
|
||||||
|
fl_hide_form(fd_deco->deco);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fd_space) {
|
||||||
|
if (fd_space->space->visible) {
|
||||||
|
fl_hide_form(fd_space->space);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fd_matrix) {
|
||||||
|
if (fd_matrix->matrix->visible) {
|
||||||
|
fl_hide_form(fd_matrix->matrix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (citation_form) {
|
if (citation_form) {
|
||||||
if (citation_form->citation_form->visible) {
|
if (citation_form->citation_form->visible) {
|
||||||
fl_hide_form(citation_form->citation_form);
|
fl_hide_form(citation_form->citation_form);
|
||||||
|
49
src/menus.C
49
src/menus.C
@ -1417,12 +1417,17 @@ void Add_to_refs_menu(vector<string> const & label_list, int offset,
|
|||||||
typedef vector<string>::size_type size_type;
|
typedef vector<string>::size_type size_type;
|
||||||
size_type const max_number_of_items = 25;
|
size_type const max_number_of_items = 25;
|
||||||
size_type const max_number_of_items2 = 20;
|
size_type const max_number_of_items2 = 20;
|
||||||
|
string::size_type const max_item_length = 40;
|
||||||
|
string::size_type const max_item_length2 = 20;
|
||||||
|
|
||||||
if (label_list.size() <= max_number_of_items)
|
if (label_list.size() <= max_number_of_items)
|
||||||
for (size_type i = 0; i < label_list.size(); ++i)
|
for (size_type i = 0; i < label_list.size(); ++i) {
|
||||||
fl_addtopup(menu,
|
string entry = label_list[i];
|
||||||
(label_list[i] + "%x"
|
if (entry.size() > max_item_length)
|
||||||
+tostr(i+offset)).c_str());
|
entry = entry.substr(0, max_item_length-1) + "$";
|
||||||
|
entry += "%x" + tostr(i+offset);
|
||||||
|
fl_addtopup(menu, entry.c_str());
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
size_type count = 0;
|
size_type count = 0;
|
||||||
for (size_type i = 0; i < label_list.size();
|
for (size_type i = 0; i < label_list.size();
|
||||||
@ -1434,15 +1439,28 @@ void Add_to_refs_menu(vector<string> const & label_list, int offset,
|
|||||||
}
|
}
|
||||||
size_type j = std::min(label_list.size(),
|
size_type j = std::min(label_list.size(),
|
||||||
i+max_number_of_items2);
|
i+max_number_of_items2);
|
||||||
string entry = label_list[i]+".."+label_list[j-1];
|
|
||||||
|
string entry;
|
||||||
|
if (label_list[i].size() > max_item_length2)
|
||||||
|
entry += label_list[i].substr(0, max_item_length2-1) + "$";
|
||||||
|
else
|
||||||
|
entry += label_list[i];
|
||||||
|
entry += "..";
|
||||||
|
if (label_list[j-1].size() > max_item_length2)
|
||||||
|
entry += label_list[j-1].substr(0, max_item_length2-1) + "$";
|
||||||
|
else
|
||||||
|
entry += label_list[j-1];
|
||||||
|
|
||||||
if (menus.size() < max_number_of_menus) {
|
if (menus.size() < max_number_of_menus) {
|
||||||
int menu2 = fl_newpup(FL_ObjWin(ob));
|
int menu2 = fl_newpup(FL_ObjWin(ob));
|
||||||
menus.push_back(menu2);
|
menus.push_back(menu2);
|
||||||
for (size_type k = i; k < j; ++k)
|
for (size_type k = i; k < j; ++k) {
|
||||||
fl_addtopup(menu2,
|
string entry2 = label_list[k];
|
||||||
(label_list[k] + "%x"
|
if (entry2.size() > max_item_length)
|
||||||
+ tostr(k+offset)).c_str());
|
entry2 = entry2.substr(0, max_item_length-1) + "$";
|
||||||
|
entry2 += "%x" + tostr(k+offset);
|
||||||
|
fl_addtopup(menu2, entry2.c_str());
|
||||||
|
}
|
||||||
entry += "%m";
|
entry += "%m";
|
||||||
fl_addtopup(menu, entry.c_str(), menu2);
|
fl_addtopup(menu, entry.c_str(), menu2);
|
||||||
} else {
|
} else {
|
||||||
@ -1487,7 +1505,7 @@ void Menus::ShowRefsMenu(FL_OBJECT * ob, long)
|
|||||||
if (menus.size() < max_number_of_menus) {
|
if (menus.size() < max_number_of_menus) {
|
||||||
int menu2 = fl_newpup(FL_ObjWin(ob));
|
int menu2 = fl_newpup(FL_ObjWin(ob));
|
||||||
menus.push_back(menu2);
|
menus.push_back(menu2);
|
||||||
Add_to_refs_menu(label_list, 1+j*BIG_NUM, menu2, menus, ob);
|
Add_to_refs_menu(label_list, (j+1)*BIG_NUM, menu2, menus, ob);
|
||||||
fl_addtopup(RefsMenu, _(MenuNames[j]), menu2);
|
fl_addtopup(RefsMenu, _(MenuNames[j]), menu2);
|
||||||
} else {
|
} else {
|
||||||
string tmp = _(MenuNames[j]);
|
string tmp = _(MenuNames[j]);
|
||||||
@ -1495,6 +1513,7 @@ void Menus::ShowRefsMenu(FL_OBJECT * ob, long)
|
|||||||
fl_addtopup(RefsMenu, tmp.c_str());
|
fl_addtopup(RefsMenu, tmp.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fl_addtopup(RefsMenu, _("Go Back"));
|
||||||
|
|
||||||
bool empty = label_list.empty();
|
bool empty = label_list.empty();
|
||||||
bool sgml = buffer->isSGML();
|
bool sgml = buffer->isSGML();
|
||||||
@ -1511,6 +1530,8 @@ void Menus::ShowRefsMenu(FL_OBJECT * ob, long)
|
|||||||
fl_setpup_mode(RefsMenu, 4, FL_PUP_GREY);
|
fl_setpup_mode(RefsMenu, 4, FL_PUP_GREY);
|
||||||
fl_setpup_mode(RefsMenu, 5, FL_PUP_GREY);
|
fl_setpup_mode(RefsMenu, 5, FL_PUP_GREY);
|
||||||
}
|
}
|
||||||
|
if (men->currentView()->NoSavedPositions())
|
||||||
|
fl_setpup_mode(RefsMenu, 7, FL_PUP_GREY);
|
||||||
|
|
||||||
fl_setpup_position(
|
fl_setpup_position(
|
||||||
men->_view->getForm()->x + ob->x,
|
men->_view->getForm()->x + ob->x,
|
||||||
@ -1522,9 +1543,11 @@ void Menus::ShowRefsMenu(FL_OBJECT * ob, long)
|
|||||||
fl_set_object_boxtype(ob, FL_FLAT_BOX);
|
fl_set_object_boxtype(ob, FL_FLAT_BOX);
|
||||||
fl_redraw_object(ob);
|
fl_redraw_object(ob);
|
||||||
|
|
||||||
if (choice > 0) {
|
if (choice == 7)
|
||||||
int type = choice / BIG_NUM;
|
men->_view->getLyXFunc()->Dispatch(LFUN_REFBACK);
|
||||||
int num = (choice % BIG_NUM) - 1;
|
else if (choice >= BIG_NUM) {
|
||||||
|
int type = (choice / BIG_NUM) - 1;
|
||||||
|
int num = choice % BIG_NUM;
|
||||||
if (type >= 5)
|
if (type >= 5)
|
||||||
men->_view->getLyXFunc()->Dispatch(LFUN_REFGOTO,
|
men->_view->getLyXFunc()->Dispatch(LFUN_REFGOTO,
|
||||||
label_list[num].c_str());
|
label_list[num].c_str());
|
||||||
|
@ -3175,9 +3175,11 @@ void LyXText::SetCursor(LyXCursor & cur, LyXParagraph * par,
|
|||||||
|
|
||||||
if (pos > last + 1) // This shouldn't happen.
|
if (pos > last + 1) // This shouldn't happen.
|
||||||
pos = last+1;
|
pos = last+1;
|
||||||
|
else if (pos < row->pos)
|
||||||
|
pos = row->pos;
|
||||||
|
|
||||||
if (last < row->pos)
|
if (last < row->pos)
|
||||||
cursor_vpos = 0;
|
cursor_vpos = row->pos;
|
||||||
else if (pos > last && !boundary)
|
else if (pos > last && !boundary)
|
||||||
cursor_vpos = (row->par->isRightToLeftPar())
|
cursor_vpos = (row->par->isRightToLeftPar())
|
||||||
? row->pos : last+1;
|
? row->pos : last+1;
|
||||||
|
Loading…
Reference in New Issue
Block a user