+2000-05-25 Dekel Tsur <dekel@math.tau.ac.il>
+
+ * src/lyx_cb.C (RefUpdateCB): disable appropriate buttons when
+ there are no labels, or when buffer is readonly.
+
+ * src/menus.C (ShowRefsMenu) disable appropriate menu items when
+ there are no labels, buffer is SGML, or when buffer is readonly.
+
2000-05-25 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/LColor.C (LColor): change a couple of grey40 to grey60
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_SouthWest FL_SouthWest
-name:
+name: ref
callback: RefSelectCB
argument: 0
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_SouthWest FL_SouthWest
-name:
+name: pageref
callback: RefSelectCB
argument: 1
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_SouthWest FL_SouthWest
-name:
+name: gotoref
callback: RefSelectCB
argument: 5
{ LFUN_META_FAKE, "meta-prefix", "", NoBuffer },
{ LFUN_INSERT_NOTE, "note-insert", "", Noop },
{ LFUN_GOTONOTE, "note-next", "", ReadOnly },
- { LFUN_INSET_NUMBER , "number-inset-insert",
- N_("Insert a new Number Inset"), Noop },
{ LFUN_OPENSTUFF, "open-stuff", "", ReadOnly },
{ LFUN_DOWN_PARAGRAPH, "paragraph-down",
N_("Go one paragraph down"), ReadOnly },
{ LFUN_REFBACK, "reference-back", "", ReadOnly },
{ LFUN_REFGOTO, "reference-goto", "", ReadOnly },
{ LFUN_INSERT_REF, "reference-insert",
- N_("Insert cross reference"), Noop },
+ N_("Insert cross reference"), ReadOnly },
{ LFUN_REFTOGGLE, "reference-toggle", "", Noop },
{ LFUN_NEXT, "screen-down", "", ReadOnly },
{ LFUN_NEXTSEL, "screen-down-select", "", ReadOnly },
item = new DEPCLEAN;
item->clean = true;
item->master = name;
- item->next = 0;;
+ item->next = 0;
}
}
}
LFUN_INSET_ERT, // Jug 20000218
LFUN_INSERT_GRAPHICS, // Lgb 20000226
LFUN_INSET_FOOTNOTE, // Jug 20000307
- LFUN_INSET_NUMBER, // Dekel 20000402
LFUN_PARAGRAPH_SPACING, // Lgb 20000411
LFUN_INSET_TABULAR, // Jug 20000412
LFUN_LOFVIEW, // Dekel 20000519
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, RefHideCB, 0);
- obj = fl_add_button(FL_NORMAL_BUTTON, 310, 60, 160, 30, idex(_("Insert Reference|#I^M")));fl_set_button_shortcut(obj, scex(_("Insert Reference|#I^M")), 1);
+ fdui->ref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 60, 160, 30, idex(_("Insert Reference|#I^M")));fl_set_button_shortcut(obj, scex(_("Insert Reference|#I^M")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
fl_set_object_callback(obj, RefSelectCB, 0);
- obj = fl_add_button(FL_NORMAL_BUTTON, 310, 100, 160, 30, idex(_("Insert Page Number|#P")));fl_set_button_shortcut(obj, scex(_("Insert Page Number|#P")), 1);
+ fdui->pageref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 100, 160, 30, idex(_("Insert Page Number|#P")));fl_set_button_shortcut(obj, scex(_("Insert Page Number|#P")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
fl_set_object_callback(obj, RefSelectCB, 1);
- obj = fl_add_button(FL_NORMAL_BUTTON, 310, 280, 160, 30, idex(_("Go to Reference|#G")));fl_set_button_shortcut(obj, scex(_("Go to Reference|#G")), 1);
+ fdui->gotoref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 280, 160, 30, idex(_("Go to Reference|#G")));fl_set_button_shortcut(obj, scex(_("Go to Reference|#G")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
fl_set_object_callback(obj, RefSelectCB, 5);
char *cdata;
long ldata;
FL_OBJECT *browser_ref;
+ FL_OBJECT *ref;
+ FL_OBJECT *pageref;
+ FL_OBJECT *gotoref;
FL_OBJECT *ref_name;
FL_OBJECT *sort;
FL_OBJECT *vref;
}
fl_set_browser_topline(brow, topline);
- if (!fl_get_browser_maxline(brow)) {
+ bool empty = refs.empty();
+ bool sgml = current_view->buffer()->isSGML();
+ bool readonly = current_view->buffer()->isReadonly();
+
+ if (empty) {
fl_add_browser_line(brow,
_("*** No labels found in document ***"));
fl_deactivate_object(brow);
+ fl_deactivate_object(fd_form_ref->gotoref);
+ fl_set_object_lcol(fd_form_ref->gotoref, FL_INACTIVE);
} else {
fl_select_browser_line(brow, topline);
fl_activate_object(brow);
+ fl_activate_object(fd_form_ref->gotoref);
+ fl_set_object_lcol(fd_form_ref->gotoref, FL_BLACK);
}
- if (current_view->buffer()->isReadonly()) {
- // would be better to de/activate insert buttons
- // but that's more work... besides this works. ARRae
- fl_hide_form(fd_form_ref->form_ref);
- }
- if (!current_view->buffer()->isSGML()) {
- fl_deactivate_object(fd_form_ref->ref_name);
- fl_set_object_lcol(fd_form_ref->ref_name, FL_INACTIVE);
+ if (empty || readonly) {
+ fl_deactivate_object(fd_form_ref->ref);
+ fl_set_object_lcol(fd_form_ref->ref, FL_INACTIVE);
+ fl_deactivate_object(fd_form_ref->pageref);
+ fl_set_object_lcol(fd_form_ref->pageref, FL_INACTIVE);
+ } else {
+ fl_activate_object(fd_form_ref->ref);
+ fl_set_object_lcol(fd_form_ref->ref, FL_BLACK);
+ fl_activate_object(fd_form_ref->pageref);
+ fl_set_object_lcol(fd_form_ref->pageref, FL_BLACK);
+ }
+
+ if (empty || readonly || sgml) {
+ fl_deactivate_object(fd_form_ref->vref);
+ fl_set_object_lcol(fd_form_ref->vref, FL_INACTIVE);
+ fl_deactivate_object(fd_form_ref->vpageref);
+ fl_set_object_lcol(fd_form_ref->vpageref, FL_INACTIVE);
+ fl_deactivate_object(fd_form_ref->prettyref);
+ fl_set_object_lcol(fd_form_ref->prettyref, FL_INACTIVE);
+ } else {
fl_activate_object(fd_form_ref->vref);
fl_set_object_lcol(fd_form_ref->vref, FL_BLACK);
fl_activate_object(fd_form_ref->vpageref);
fl_set_object_lcol(fd_form_ref->vpageref, FL_BLACK);
fl_activate_object(fd_form_ref->prettyref);
fl_set_object_lcol(fd_form_ref->prettyref, FL_BLACK);
- } else {
+ }
+
+ if (sgml) {
fl_activate_object(fd_form_ref->ref_name);
fl_set_object_lcol(fd_form_ref->ref_name, FL_BLACK);
-
- fl_deactivate_object(fd_form_ref->vref);
- fl_set_object_lcol(fd_form_ref->vref, FL_INACTIVE);
- fl_deactivate_object(fd_form_ref->vpageref);
- fl_set_object_lcol(fd_form_ref->vpageref, FL_INACTIVE);
- fl_deactivate_object(fd_form_ref->prettyref);
- fl_set_object_lcol(fd_form_ref->prettyref, FL_INACTIVE);
+ } else {
+ fl_deactivate_object(fd_form_ref->ref_name);
+ fl_set_object_lcol(fd_form_ref->ref_name, FL_INACTIVE);
}
+
fl_show_object(brow);
}
for (LastFiles::const_iterator cit = lastfiles->begin();
cit != lastfiles->end() && ii < 10; ++cit, ++ii) {
string tmp = tostr(ii);
- string tmp2 = tmp + "#" + tmp;;
+ string tmp2 = tmp + "#" + tmp;
tmp += ". " + MakeDisplayPath((*cit), 30);
fl_addtopup(FileMenu, tmp.c_str());
fl_setpup_shortcut(FileMenu, 18 - 1 + ii, tmp2.c_str());
for (LastFiles::const_iterator cit = lastfiles->begin();
cit != lastfiles->end() && ii < 10; ++cit, ++ii) {
string tmp = tostr(ii);
- string tmp2 = tmp + "#" + tmp;;
+ string tmp2 = tmp + "#" + tmp;
tmp += ". " + MakeDisplayPath((*cit), 30);
fl_addtopup(FileMenu, tmp.c_str());
fl_setpup_shortcut(FileMenu, 18 - 1 + ii, tmp2.c_str());
sort(label_list.begin(), label_list.end());
//xgettext:no-c-format
- static char const * MenuNames[5] = { N_("Insert Page Number%m"),
+ static char const * MenuNames[6] = { N_("Insert Reference%m"),
+ //xgettext:no-c-format
+ N_("Insert Page Number%m"),
//xgettext:no-c-format
N_("Insert vref%m"),
//xgettext:no-c-format
//xgettext:no-c-format
N_("Insert Pretty Ref%m"),
//xgettext:no-c-format
- N_("Goto Reference%m%l") };
+ N_("Goto Reference%m") };
- for (int j = 1; j <= 5; ++j) {
+ for (int j = 0; j < 6; ++j) {
int menu2 = fl_newpup(FL_ObjWin(ob));
menus.push_back(menu2);
Add_to_refs_menu(label_list, 1+j*BIG_NUM, menu2, menus, ob);
- fl_addtopup(RefsMenu, _(MenuNames[j-1]), menu2);
+ fl_addtopup(RefsMenu, _(MenuNames[j]), menu2);
}
- fl_addtopup(RefsMenu, _("Insert Reference:%d%x0"));
- Add_to_refs_menu(label_list, 1, RefsMenu, menus, ob);
+ bool empty = label_list.empty();
+ bool sgml = buffer->isSGML();
+ bool readonly = buffer->isReadonly();
- if (label_list.empty())
- for (int j = 1; j <= 5; ++j)
- fl_setpup_mode(RefsMenu, j, FL_PUP_GREY);
+ if (empty)
+ fl_setpup_mode(RefsMenu, 6, FL_PUP_GREY);
+ if (empty || readonly) {
+ fl_setpup_mode(RefsMenu, 1, FL_PUP_GREY);
+ fl_setpup_mode(RefsMenu, 2, FL_PUP_GREY);
+ }
+ if (empty || readonly || sgml) {
+ fl_setpup_mode(RefsMenu, 3, FL_PUP_GREY);
+ fl_setpup_mode(RefsMenu, 4, FL_PUP_GREY);
+ fl_setpup_mode(RefsMenu, 5, FL_PUP_GREY);
+ }
fl_setpup_position(
men->_view->getForm()->x + ob->x,
LyXTable * LyXTable::Clone()
{
LyXTable * result = new LyXTable(rows, columns);
- int row, column;;
+ int row, column;
for (row = 0; row < rows; ++row) {
for (column = 0; column < columns; ++column) {