+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>
* src/lyx_cb.C (MakeLaTeXOutput): we run MakeLaTeXOutput regard
Name: form_ref
Width: 590
Height: 400
-Number of Objects: 12
+Number of Objects: 13
--------------------
class: FL_BOX
callback: RefSelectCB
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
}
+bool BufferView::NoSavedPositions()
+{
+ return pimpl_->NoSavedPositions();
+}
+
+
void BufferView::update(signed char f)
{
pimpl_->update(f);
void savePosition();
///
void restorePosition();
+ ///
+ bool NoSavedPositions();
/** This holds the mapping between buffer paragraphs and screen rows.
This should be private...but not yet. (Lgb)
*/
bool a = false;
while (par) {
// this has to be done before the delete
- text->SetCursor(cursor, par, 0);
+ if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
+ text->SetCursor(cursor, par, 0);
if (par->AutoDeleteInsets()){
a = true;
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
update(0);
}
+bool BufferView::Pimpl::NoSavedPositions()
+{
+ return backstack.empty();
+}
+
void BufferView::Pimpl::setState()
{
///
void restorePosition();
///
+ bool NoSavedPositions();
+ ///
void setState();
///
void insetSleep();
void InsetLabel::Edit(BufferView * bv, int, int, unsigned int)
{
- if(bv->buffer()->isReadonly()) {
+ if (bv->buffer()->isReadonly()) {
WarnReadonly(bv->buffer()->fileName());
return;
}
string new_contents = frontStrip(strip(result.second));
if (!new_contents.empty() &&
contents != new_contents) {
+ bv->buffer()->markDirty();
bool flag = bv->ChangeRefs(contents,new_contents);
contents = new_contents;
bv->text->RedoParagraph();
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
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();
//fdui->form_ref->fdui = fdui;
FL_OBJECT *vref;
FL_OBJECT *vpageref;
FL_OBJECT *prettyref;
+ FL_OBJECT *back;
} FD_form_ref;
extern FD_form_ref * create_form_form_ref(void);
if (s.empty())
return;
- if (data >= 5) {
+ if (data == 5) {
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;
+ }
static string const commands[5]
= { "\\ref", "\\pageref", "\\vref", "\\vpageref",
bool sgml = current_view->buffer()->isSGML();
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) {
fl_add_browser_line(brow,
_("*** No labels found in document ***"));
if (fd_form_table->form_table->visible) {
fl_hide_form(fd_form_table->form_table);
}
+
+#ifndef ALWAYS_UPDATE_REF
+ // We must update the popup in order to make the
+ // insert ref buttons insactive
+ 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->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
}
// 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);
fl_hide_form(fd_matrix->matrix);
}
}
+#endif
if (citation_form) {
if (citation_form->citation_form->visible) {
fl_hide_form(citation_form->citation_form);
typedef vector<string>::size_type size_type;
size_type const max_number_of_items = 25;
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)
- for (size_type i = 0; i < label_list.size(); ++i)
- fl_addtopup(menu,
- (label_list[i] + "%x"
- +tostr(i+offset)).c_str());
+ for (size_type i = 0; i < label_list.size(); ++i) {
+ string entry = label_list[i];
+ if (entry.size() > max_item_length)
+ entry = entry.substr(0, max_item_length-1) + "$";
+ entry += "%x" + tostr(i+offset);
+ fl_addtopup(menu, entry.c_str());
+ }
else {
size_type count = 0;
for (size_type i = 0; i < label_list.size();
}
size_type j = std::min(label_list.size(),
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) {
int menu2 = fl_newpup(FL_ObjWin(ob));
menus.push_back(menu2);
- for (size_type k = i; k < j; ++k)
- fl_addtopup(menu2,
- (label_list[k] + "%x"
- + tostr(k+offset)).c_str());
+ for (size_type k = i; k < j; ++k) {
+ string entry2 = label_list[k];
+ if (entry2.size() > max_item_length)
+ entry2 = entry2.substr(0, max_item_length-1) + "$";
+ entry2 += "%x" + tostr(k+offset);
+ fl_addtopup(menu2, entry2.c_str());
+ }
entry += "%m";
fl_addtopup(menu, entry.c_str(), menu2);
} else {
if (menus.size() < max_number_of_menus) {
int menu2 = fl_newpup(FL_ObjWin(ob));
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);
} else {
string tmp = _(MenuNames[j]);
fl_addtopup(RefsMenu, tmp.c_str());
}
}
+ fl_addtopup(RefsMenu, _("Go Back"));
bool empty = label_list.empty();
bool sgml = buffer->isSGML();
fl_setpup_mode(RefsMenu, 4, 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(
men->_view->getForm()->x + ob->x,
fl_set_object_boxtype(ob, FL_FLAT_BOX);
fl_redraw_object(ob);
- if (choice > 0) {
- int type = choice / BIG_NUM;
- int num = (choice % BIG_NUM) - 1;
+ if (choice == 7)
+ men->_view->getLyXFunc()->Dispatch(LFUN_REFBACK);
+ else if (choice >= BIG_NUM) {
+ int type = (choice / BIG_NUM) - 1;
+ int num = choice % BIG_NUM;
if (type >= 5)
men->_view->getLyXFunc()->Dispatch(LFUN_REFGOTO,
label_list[num].c_str());
if (pos > last + 1) // This shouldn't happen.
pos = last+1;
+ else if (pos < row->pos)
+ pos = row->pos;
if (last < row->pos)
- cursor_vpos = 0;
+ cursor_vpos = row->pos;
else if (pos > last && !boundary)
cursor_vpos = (row->par->isRightToLeftPar())
? row->pos : last+1;