patch from Dekel

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@772 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-05-26 00:00:02 +00:00
parent a11982d114
commit 988613eac8
10 changed files with 79 additions and 41 deletions

View File

@ -1,3 +1,11 @@
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

View File

@ -590,7 +590,7 @@ label: Insert Reference|#I^M
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_SouthWest FL_SouthWest
name:
name: ref
callback: RefSelectCB
argument: 0
@ -608,7 +608,7 @@ label: Insert Page Number|#P
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_SouthWest FL_SouthWest
name:
name: pageref
callback: RefSelectCB
argument: 1
@ -626,7 +626,7 @@ label: Go to Reference|#G
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_SouthWest FL_SouthWest
name:
name: gotoref
callback: RefSelectCB
argument: 5

View File

@ -298,8 +298,6 @@ void LyXAction::init()
{ 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 },
@ -323,7 +321,7 @@ void LyXAction::init()
{ 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 },

View File

@ -3906,7 +3906,7 @@ void Buffer::markDepClean(string const & name)
item = new DEPCLEAN;
item->clean = true;
item->master = name;
item->next = 0;;
item->next = 0;
}
}
}

View File

@ -245,7 +245,6 @@ enum kb_action {
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

View File

@ -159,15 +159,15 @@ FD_form_ref *create_form_form_ref(void)
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);

View File

@ -73,6 +73,9 @@ typedef struct {
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;

View File

@ -3256,40 +3256,59 @@ extern "C" void RefUpdateCB(FL_OBJECT *, long)
}
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);
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);
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_name);
fl_set_object_lcol(fd_form_ref->ref_name, FL_BLACK);
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);
}
if (sgml) {
fl_activate_object(fd_form_ref->ref_name);
fl_set_object_lcol(fd_form_ref->ref_name, FL_BLACK);
} else {
fl_deactivate_object(fd_form_ref->ref_name);
fl_set_object_lcol(fd_form_ref->ref_name, FL_INACTIVE);
}
fl_show_object(brow);
}

View File

@ -665,7 +665,7 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
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());
@ -816,7 +816,7 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
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());
@ -1454,7 +1454,9 @@ void Menus::ShowRefsMenu(FL_OBJECT * ob, long)
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
@ -1462,21 +1464,30 @@ void Menus::ShowRefsMenu(FL_OBJECT * ob, long)
//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,

View File

@ -187,7 +187,7 @@ LyXTable & LyXTable::operator=(LyXTable const & lt)
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) {