From: Lars Gullik Bjønnes Date: Wed, 29 Nov 2000 15:06:42 +0000 (+0000) Subject: update patch from Angus X-Git-Tag: 1.6.10~21795 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=037d17588d4661d0b4302180f0cb2915c935f947;p=features.git update patch from Angus git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1245 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/ChangeLog b/ChangeLog index 46d2dc2357..71873d1a59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +2000-11-29 Angus Leeming + + * src/combox.[Ch] )(add, Show): workaround xforms bug when Show()ing + the browser form for a combox in a tabbed folder. Bug fix courtesy of + Steve Lamont . + + * src/frontends/xforms/FormDocument.C (build): + * src/frontends/xforms/FormPreferences.C (Language::build): + pass tabfolders to Combox::add() in order to use this work around. + + * src/frontends/xforms/FormCitation.C (connect): remove max size + limitation. + (update): sort list of bibliography keys. + + * src/frontends/xforms/FormRef.[Ch] (connect, showBrowser, hideBrowser, + setSize): removed. + No max size limitation. Same popup for new and existing insets. Fixes + bugs reported by Rob Lahaye. + + * src/frontends/xforms/FormCitation.C (c-tor): + * src/frontends/xforms/FormCopyright.C (c-tor): + * src/frontends/xforms/FormError.C (c-tor): + * src/frontends/xforms/FormGraphics.C (c-tor): + * src/frontends/xforms/FormIndex.C (c-tor): + * src/frontends/xforms/FormRef.C (c-tor): + * src/frontends/xforms/FormToc.C (c-tor): + * src/frontends/xforms/FormUrl.C (c-tor): + use correct policy for ButtonController. + + * src/frontends/xforms/FormPreferences.[Ch]: cleaned up a little more. + + * src/frontends/xforms/Menubar_pimpl.C (create_submenu): modified lyxerr + call a little. + + * src/frontends/xforms/forms/form_citation.fd: some resizing changes. + + * src/frontends/xforms/forms/form_ref.fd: new Restore, Apply buutons. + Some resizing changes. + 2000-11-28 Lars Gullik Bjønnes * configure.in: fix typo diff --git a/src/combox.C b/src/combox.C index b472f8628d..02e31059b1 100644 --- a/src/combox.C +++ b/src/combox.C @@ -49,7 +49,7 @@ extern "C" void C_Combox_combo_cb(FL_OBJECT *ob, long data) ; extern "C" int C_Combox_peek_event(FL_FORM * form, void *xev); Combox::Combox(combox_type t) - : type(t) + : type(t), tabfolder1(0), tabfolder2(0) { browser = button = 0; callback = 0; @@ -156,8 +156,13 @@ void Combox::select(int i) } -void Combox::add(int x, int y, int w, int hmin, int hmax) -{ +void Combox::add(int x, int y, int w, int hmin, int hmax, + FL_OBJECT * tabfolder1_, FL_OBJECT * tabfolder2_) +{ + // Store these for later use in working round an xforms bug in Show() + tabfolder1 = tabfolder1_; + tabfolder2 = tabfolder2_; + FL_OBJECT * obj; switch (type) { @@ -253,8 +258,38 @@ void Combox::Show() fl_set_object_label(button, "@2<-"); fl_redraw_object(button); } - int x = label->form->x + label->x, y = label->form->y + label->y; - fl_set_form_position(form, x, y + label->h); + + int x = label->x; + int y = label->y + label->h; + if (tabfolder1) { + // This is a bug work around suggested by Steve Lamont on the + // xforms mailing list. It correctly positions the browser form + // after the main window has been moved. + // The bug only occurs in tabbed folders. + int folder_x, folder_y, folder_w, folder_h; + fl_get_folder_area( tabfolder1, + &folder_x, &folder_y, + &folder_w, &folder_h ); + x += folder_x; + y += folder_y; + + if (tabfolder2) { + fl_get_folder_area( tabfolder2, + &folder_x, &folder_y, + &folder_w, &folder_h ); + x += tabfolder2->form->x + folder_x; + y += tabfolder2->form->y + folder_y; + } else { + x += tabfolder1->form->x; + y += tabfolder1->form->y; + } + + } else { + x += label->form->x; + y += label->form->y; + } + + fl_set_form_position(form, x, y); fl_show_form(form, FL_PLACE_POSITION, FL_NOBORDER, ""); if (sel>0) { fl_set_browser_topline(browser, sel); diff --git a/src/combox.h b/src/combox.h index b4f78df680..c948c1895f 100644 --- a/src/combox.h +++ b/src/combox.h @@ -59,9 +59,15 @@ public: ~Combox(); /** To add this object to a form. Note that there are two heights - for normal (button) and expanded (browser) mode each. + for normal (button) and expanded (browser) mode each. + The optional tabfolder arguments are needed to overcome an + xforms bug when repositioning a combox in a tab folder. + tabfolder1_ is the folder holding the combox. + If using nested tabfolders, tabfolder2_ is the "base" folder + holding tabfolder1_. */ - void add(int x, int y, int w, int hmin, int hmax); + void add(int x, int y, int w, int hmin, int hmax, + FL_OBJECT * tabfolder1_ = 0, FL_OBJECT * tabfolder2_ = 0); /// Add lines. Same as for fl_browser object void addline(string const &); @@ -146,6 +152,10 @@ public: FL_OBJECT * label; /// FL_FORM* form; + /// + FL_OBJECT * tabfolder1; + /// + FL_OBJECT * tabfolder2; }; diff --git a/src/frontends/xforms/FormCitation.C b/src/frontends/xforms/FormCitation.C index be032e8b08..a6694383f2 100644 --- a/src/frontends/xforms/FormCitation.C +++ b/src/frontends/xforms/FormCitation.C @@ -25,15 +25,16 @@ #include "lyxfunc.h" #include "support/filetools.h" -using std::vector; -using std::pair; +using std::find; using std::max; using std::min; -using std::find; +using std::pair; +using std::sort; +using std::vector; FormCitation::FormCitation(LyXView * lv, Dialogs * d) - : FormCommand(lv, d, _("Citation"), new OkApplyCancelReadOnlyPolicy), + : FormCommand(lv, d, _("Citation"), new NoRepeatedApplyReadOnlyPolicy), dialog_(0) { // let the dialog be shown @@ -59,7 +60,7 @@ FL_FORM * FormCitation::form() const void FormCitation::connect() { - fl_set_form_maxsize( dialog_->form, 3*minw_, minh_ ); + //fl_set_form_maxsize( dialog_->form, 3*minw_, minh_ ); FormCommand::connect(); } @@ -105,6 +106,7 @@ void FormCitation::update() vector > blist = lv_->buffer()->getBibkeyList(); + sort(blist.begin(), blist.end()); for (unsigned int i = 0; i < blist.size(); ++i) { bibkeys.push_back(blist[i].first); diff --git a/src/frontends/xforms/FormCopyright.C b/src/frontends/xforms/FormCopyright.C index 067ffd170f..441d245625 100644 --- a/src/frontends/xforms/FormCopyright.C +++ b/src/frontends/xforms/FormCopyright.C @@ -17,8 +17,7 @@ #include "xform_helpers.h" FormCopyright::FormCopyright( LyXView * lv, Dialogs * d ) - : FormBaseBI(lv, d, _("Copyright and Warranty"), - new OkApplyCancelPolicy), + : FormBaseBI(lv, d, _("Copyright and Warranty"), new OkCancelPolicy), dialog_(0) { // let the dialog be shown diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index eab1a51c67..6f28e14685 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -156,7 +156,8 @@ void FormDocument::build() obj = class_->choice_doc_class; fl_addto_form(class_->form); combo_doc_class = new Combox(FL_COMBOX_DROPLIST); - combo_doc_class->add(obj->x, obj->y, obj->w, obj->h, 400); + combo_doc_class->add(obj->x, obj->y, obj->w, obj->h, 400, + dialog_->tabbed_folder); combo_doc_class->shortcut("#C",1); combo_doc_class->setcallback(ComboInputCB, this); fl_end_form(); @@ -215,7 +216,8 @@ void FormDocument::build() obj = language_->choice_language; fl_addto_form(language_->form); combo_language = new Combox(FL_COMBOX_DROPLIST); - combo_language->add(obj->x, obj->y, obj->w, obj->h, 400); + combo_language->add(obj->x, obj->y, obj->w, obj->h, 400, + dialog_->tabbed_folder); combo_language->shortcut("#L",1); combo_language->setcallback(ComboInputCB, this); fl_end_form(); diff --git a/src/frontends/xforms/FormError.C b/src/frontends/xforms/FormError.C index 23be1cf4ca..a5a9fe7f2e 100644 --- a/src/frontends/xforms/FormError.C +++ b/src/frontends/xforms/FormError.C @@ -23,7 +23,7 @@ FormError::FormError(LyXView * lv, Dialogs * d) - : FormInset( lv, d, _("LaTeX Error"), new OkApplyCancelPolicy), + : FormInset( lv, d, _("LaTeX Error"), new OkCancelPolicy), dialog_(0), inset_(0) { Assert(lv && d); diff --git a/src/frontends/xforms/FormGraphics.C b/src/frontends/xforms/FormGraphics.C index fb8e4ec841..e53be71957 100644 --- a/src/frontends/xforms/FormGraphics.C +++ b/src/frontends/xforms/FormGraphics.C @@ -40,7 +40,7 @@ using std::endl; FormGraphics::FormGraphics(LyXView * lv, Dialogs * d) - : FormInset(lv, d, _("Graphics"), new OkApplyCancelReadOnlyPolicy), + : FormInset(lv, d, _("Graphics"), new NoRepeatedApplyReadOnlyPolicy), dialog_(0), inset_(0), // The buttons c-tor values are the number of buttons we use // This is only to reduce memory waste. diff --git a/src/frontends/xforms/FormIndex.C b/src/frontends/xforms/FormIndex.C index 0e95018740..c817ddb169 100644 --- a/src/frontends/xforms/FormIndex.C +++ b/src/frontends/xforms/FormIndex.C @@ -26,7 +26,7 @@ #include "lyxfunc.h" FormIndex::FormIndex(LyXView * lv, Dialogs * d) - : FormCommand(lv, d, _("Index"), new OkApplyCancelReadOnlyPolicy), + : FormCommand(lv, d, _("Index"), new NoRepeatedApplyPolicy), dialog_(0) { // let the dialog be shown diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index 8db20d82d2..57c2cfc3ee 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -446,7 +446,14 @@ void FormPreferences::Colors::apply() AdjustVal(FL_RIGHT_BCOL, FL_COL1, -0.5); AdjustVal(FL_BOTTOM_BCOL, FL_COL1, -0.5); - } + } + + if ((*cit).colorID == GUI_COLOR_CURSOR) { + fl_mapcolor(GUI_COLOR_CURSOR, + (*cit).r, (*cit).g, (*cit).b); + fl_set_cursor_color(FL_DEFAULT_CURSOR, + GUI_COLOR_CURSOR, FL_WHITE); + } } Dialogs::redrawGUI(); } @@ -464,11 +471,12 @@ void FormPreferences::Colors::apply() if (cit2 == colorDB.end()) continue; if (lcolor.getX11Name(lc) != (*cit2).getname()) { - lyxerr << "FormPreferences::Colors::apply: " - << "resetting LColor " << lcolor.getGUIName(lc) - << " from \"" << lcolor.getX11Name(lc) - << "\" to \"" << (*cit2).getname() << "\"." - << endl; + lyxerr[Debug::GUI] + << "FormPreferences::Colors::apply: " + << "resetting LColor " << lcolor.getGUIName(lc) + << " from \"" << lcolor.getX11Name(lc) + << "\" to \"" << (*cit2).getname() << "\"." + << endl; string const arg = lcolor.getLyXName(lc) + string(" ") + @@ -484,9 +492,10 @@ void FormPreferences::Colors::build() { dialog_ = parent_.build_colors(); - fl_set_object_color(dialog_->button_color, FL_FREE_COL1, FL_FREE_COL1); + fl_set_object_color(dialog_->button_color, + GUI_COLOR_CHOICE, GUI_COLOR_CHOICE); - fl_set_object_color(dialog_->dial_hue, FL_FREE_COL2, FL_BLACK); + fl_set_object_color(dialog_->dial_hue, GUI_COLOR_HUE_DIAL, FL_BLACK); fl_set_dial_return(dialog_->dial_hue, FL_RETURN_CHANGED); fl_set_dial_bounds(dialog_->dial_hue, 0.0, 360.0); @@ -640,7 +649,7 @@ void FormPreferences::Colors::InputBrowserLyX() const vector::const_iterator cit = find(colorDB.begin(), colorDB.end(), color); - if (cit == colorDB.end()) return; + if (cit == colorDB.end()) return; int const j = static_cast(cit - colorDB.begin()); @@ -661,7 +670,7 @@ void FormPreferences::Colors::InputBrowserX11() const fl_freeze_form(dialog_->form); RGBColor const & col = colorDB[i-1].color(); - fl_mapcolor(FL_FREE_COL1, col.r, col.g, col.b); + fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b); fl_redraw_object(dialog_->button_color); HSVColor hsv(col); @@ -671,7 +680,7 @@ void FormPreferences::Colors::InputBrowserX11() const fl_set_slider_value(dialog_->slider_value, hsv.v); RGBColor col2 = HSVColor(hsv.h, 1.0, 1.0); - fl_mapcolor(FL_FREE_COL2, col2.r, col2.g, col2.b); + fl_mapcolor(GUI_COLOR_HUE_DIAL, col2.r, col2.g, col2.b); fl_redraw_object(dialog_->dial_hue); // Is it valid to activate the "Modify" button? @@ -704,7 +713,7 @@ void FormPreferences::Colors::InputHSV() fl_set_browser_topline(dialog_->browser_x11, max(i-5, 1)); fl_select_browser_line(dialog_->browser_x11, i+1); - fl_mapcolor(FL_FREE_COL1, col.r, col.g, col.b); + fl_mapcolor(GUI_COLOR_CHOICE, col.r, col.g, col.b); fl_redraw_object(dialog_->button_color); // Only activate the "Modify" button if the browser and slider colors @@ -724,7 +733,7 @@ void FormPreferences::Colors::InputHSV() // Finally, modify the color of the dial. col = HSVColor(hue, 1.0, 1.0); - fl_mapcolor(FL_FREE_COL2, col.r, col.g, col.b); + fl_mapcolor(GUI_COLOR_HUE_DIAL, col.r, col.g, col.b); fl_redraw_object(dialog_->dial_hue); fl_unfreeze_form(dialog_->form); @@ -749,14 +758,10 @@ void FormPreferences::Colors::LoadBrowserLyX() xcol.colorID = FL_BLACK; fl_getmcolor(FL_BLACK, &xcol.r, &xcol.g, &xcol.b); - xformColorDB.push_back(xcol); + fl_mapcolor(GUI_COLOR_CURSOR, xcol.r, xcol.g, xcol.b); + fl_set_cursor_color(FL_DEFAULT_CURSOR, GUI_COLOR_CURSOR, FL_WHITE); - // FL_LIGHTER_COL1 does not exist in xforms 0.88 - // xcol.name = "GUI active tab"; - // xcol.colorID = FL_LIGHTER_COL1; - // fl_getmcolor(FL_LIGHTER_COL1, &xcol.r, &xcol.g, &xcol.b); - // - // xformColorDB.push_back(xcol); + xformColorDB.push_back(xcol); xcol.name = "GUI selection"; xcol.colorID = FL_YELLOW; @@ -764,6 +769,12 @@ void FormPreferences::Colors::LoadBrowserLyX() xformColorDB.push_back(xcol); + xcol.name = "GUI pointer"; + xcol.colorID = GUI_COLOR_CURSOR; + fl_getmcolor(GUI_COLOR_CURSOR, &xcol.r, &xcol.g, &xcol.b); + + xformColorDB.push_back(xcol); + // Now create the the LyX LColors database lyxColorDB.clear(); for (int i=0; ichoice_default_lang; fl_deactivate_object(dialog_->choice_default_lang); combo_default_lang = new Combox(FL_COMBOX_DROPLIST); - combo_default_lang->add(obj->x, obj->y, obj->w, obj->h, 400); + combo_default_lang->add(obj->x, obj->y, obj->w, obj->h, 400, + parent_.lang_opts_tab_->tabfolder_outer, + parent_.dialog_->tabfolder_prefs); combo_default_lang->shortcut("#L",1); combo_default_lang->setcallback(ComboCB, &parent_); @@ -1845,6 +1858,7 @@ void FormPreferences::Language::build() // This is safe, as nothing is done to the pointer, other than // to use its address in a block-if statement. + // No it's not! Leads to crash. // setPreHandler( // reinterpret_cast(combo_default_lang), // C_FormPreferencesFeedbackCB); diff --git a/src/frontends/xforms/FormPreferences.h b/src/frontends/xforms/FormPreferences.h index c9f452cc77..ae44e160ed 100644 --- a/src/frontends/xforms/FormPreferences.h +++ b/src/frontends/xforms/FormPreferences.h @@ -149,6 +149,12 @@ private: class Colors { public: + /// + enum GuiColors { + GUI_COLOR_CHOICE = FL_FREE_COL1, + GUI_COLOR_HUE_DIAL = FL_FREE_COL2, + GUI_COLOR_CURSOR = FL_FREE_COL3 + }; /// Colors( FormPreferences & p ) : parent_(p), dialog_(0) {} /// diff --git a/src/frontends/xforms/FormRef.C b/src/frontends/xforms/FormRef.C index 39a02f6341..5772e668a2 100644 --- a/src/frontends/xforms/FormRef.C +++ b/src/frontends/xforms/FormRef.C @@ -27,14 +27,13 @@ #include +using std::find; +using std::max; using std::sort; using std::vector; -static int const minw_hb = 250; -static int minw_sb; - FormRef::FormRef(LyXView * lv, Dialogs * d) - : FormCommand(lv, d, _("Reference"), new OkCancelReadOnlyPolicy), + : FormCommand(lv, d, _("Reference"), new NoRepeatedApplyPolicy), toggle(GOBACK), dialog_(0) { // let the dialog be shown @@ -58,13 +57,6 @@ FL_FORM * FormRef::form() const } -void FormRef::connect() -{ - fl_set_form_maxsize(form(), 2 * minw_, minh_); - FormCommand::connect(); -} - - void FormRef::disconnect() { refs.clear(); @@ -82,23 +74,19 @@ void FormRef::build() // Workaround dumb xforms sizing bug minw_ = form()->w; minh_ = form()->h; - minw_sb = minw_; - // Name is irrelevant to LaTeX documents - if (lv_->buffer()->isLatex()) { - fl_deactivate_object(dialog_->name); - fl_set_object_lcol(dialog_->name, FL_INACTIVE); - } - - // Can change reference only through browser + // Force the user to use the browser to change refs. fl_deactivate_object(dialog_->ref); // Manage the ok and cancel/close buttons bc_.setOK(dialog_->button_ok); + bc_.setApply(dialog_->button_apply); bc_.setCancel(dialog_->button_cancel); + bc_.setUndoAll(dialog_->button_restore); bc_.refresh(); bc_.addReadOnly(dialog_->type); + bc_.addReadOnly(dialog_->name); } @@ -108,19 +96,24 @@ void FormRef::update() fl_set_input(dialog_->name, params.getOptions().c_str()); Type type = getType(); - fl_set_choice(dialog_->type, type + 1); + fl_set_choice(dialog_->type, type+1); toggle = GOBACK; fl_set_object_label(dialog_->button_go, _("Goto reference")); - refs.clear(); + // Name is irrelevant to LaTeX documents + if (lv_->buffer()->isLatex()) { + fl_deactivate_object(dialog_->name); + fl_set_object_lcol(dialog_->name, FL_INACTIVE); + } + + refs = lv_->buffer()->getLabelList(); + updateBrowser(refs); + if (inset_ == 0) { - refs = lv_->buffer()->getLabelList(); - updateBrowser(refs); - showBrowser(); } else { - hideBrowser(); } + bc_.readOnly(lv_->buffer()->isReadonly()); } @@ -154,81 +147,17 @@ void FormRef::updateBrowser(vector const & akeys) const fl_set_object_lcol(dialog_->button_update, FL_BLACK); fl_activate_object(dialog_->sort); fl_set_object_lcol(dialog_->sort, FL_BLACK); - } -} - - -void FormRef::showBrowser() const -{ - fl_show_object(dialog_->browser); - fl_show_object(dialog_->button_update); - fl_show_object(dialog_->sort); - - setSize(minw_sb, 0); - - fl_deactivate_object(dialog_->type); - fl_set_object_lcol(dialog_->type, FL_INACTIVE); - fl_deactivate_object(dialog_->button_go); - fl_set_object_lcol(dialog_->button_go, FL_INACTIVE); - fl_set_object_lcol(dialog_->ref, FL_INACTIVE); - bc_.valid(false); -} + string ref = fl_get_input(dialog_->ref); + vector::const_iterator cit = + find(refs.begin(), refs.end(), ref); -void FormRef::hideBrowser() const -{ - fl_hide_object(dialog_->browser); - fl_hide_object(dialog_->button_update); - fl_hide_object(dialog_->sort); - - setSize(minw_hb, 280); - - fl_activate_object(dialog_->type); - fl_set_object_lcol(dialog_->type, FL_BLACK); - fl_activate_object(dialog_->button_go); - fl_set_object_lcol(dialog_->button_go, FL_BLACK); - fl_set_object_lcol(dialog_->ref, FL_BLACK); - bc_.invalid(); -} - - -void FormRef::setSize(int w, int dx) const -{ - static int x1 = dialog_->name->x; - static int y1 = dialog_->name->y; - static int x2 = dialog_->ref->x; - static int y2 = dialog_->ref->y; - static int x3 = dialog_->type->x; - static int y3 = dialog_->type->y; - static int x4 = dialog_->button_go->x; - static int y4 = dialog_->button_go->y; - static int x5 = dialog_->button_ok->x; - static int y5 = dialog_->button_ok->y; - static int x6 = dialog_->button_cancel->x; - static int y6 = dialog_->button_cancel->y; - - if (form()->w != w) { - minw_ = w; - fl_set_form_size(form(), minw_, minh_); - } else - return; - - fl_set_object_position(dialog_->name, x1 - dx, y1); - fl_set_object_position(dialog_->ref, x2 - dx, y2); - fl_set_object_position(dialog_->type, x3 - dx, y3); - fl_set_object_position(dialog_->button_go, x4 - dx, y4); - fl_set_object_position(dialog_->button_ok, x5 - dx, y5); - fl_set_object_position(dialog_->button_cancel, x6 - dx, y6); - - // These two must be reset apparently - // Name is irrelevant to LaTeX documents - if (lv_->buffer()->isLatex()) { - fl_deactivate_object(dialog_->name); - fl_set_object_lcol(dialog_->name, FL_INACTIVE); + if (cit != refs.end()) { + int const i = static_cast(cit - refs.begin()); + fl_set_browser_topline(dialog_->browser, max(i-5, 1)); + fl_select_browser_line(dialog_->browser, i+1); + } } - - // Can change reference only through browser - fl_deactivate_object(dialog_->ref); } @@ -241,6 +170,7 @@ void FormRef::apply() params.setCmdName(getName(type)); params.setOptions(fl_get_input(dialog_->name)); + params.setContents(fl_get_input(dialog_->ref)); if (inset_ != 0) { // Only update if contents have changed @@ -255,11 +185,6 @@ void FormRef::apply() } -#ifdef WITH_WARNINGS -#warning check use of buttoncontroller -// Seems okay except that goref and goback shouldn't -// affect the status of ok. -#endif bool FormRef::input(FL_OBJECT *, long data) { bool activate(true); @@ -267,6 +192,9 @@ bool FormRef::input(FL_OBJECT *, long data) // goto reference / go back case 1: { + // No change to data + activate = false; + toggle = static_cast(toggle + 1); if (toggle == GOFIRST ) toggle = GOREF; @@ -300,9 +228,10 @@ bool FormRef::input(FL_OBJECT *, long data) unsigned int sel = fl_get_browser(dialog_->browser); if (sel < 1 || sel > refs.size()) break; - string s = fl_get_browser_line(dialog_->browser, sel); - fl_set_input(dialog_->ref, s.c_str()); - params.setContents(s); + if (!lv_->buffer()->isReadonly()) { + string s = fl_get_browser_line(dialog_->browser, sel); + fl_set_input(dialog_->ref, s.c_str()); + } toggle = GOBACK; lv_->getLyXFunc()->Dispatch(LFUN_REF_BACK); @@ -340,6 +269,7 @@ bool FormRef::input(FL_OBJECT *, long data) default: break; } + return activate; } diff --git a/src/frontends/xforms/FormRef.h b/src/frontends/xforms/FormRef.h index b6913abd73..ca20230114 100644 --- a/src/frontends/xforms/FormRef.h +++ b/src/frontends/xforms/FormRef.h @@ -51,8 +51,6 @@ private: GOFIRST }; - /// Connect signals etc. Set form's max size. - virtual void connect(); /// Disconnect signals. Also perform any necessary housekeeping. virtual void disconnect(); @@ -70,12 +68,6 @@ private: /// void updateBrowser(std::vector const &) const; /// - void showBrowser() const; - /// - void hideBrowser() const; - /// - void setSize(int, int) const; - /// FD_form_ref * build_ref(); /// Type getType() const; diff --git a/src/frontends/xforms/FormToc.C b/src/frontends/xforms/FormToc.C index 5e8a118b8f..39805699de 100644 --- a/src/frontends/xforms/FormToc.C +++ b/src/frontends/xforms/FormToc.C @@ -32,7 +32,7 @@ // confusing to the button controller so I've made an IgnorantPolicy to cover // this situation since the dialog doesn't care about buttons. ARRae 20001013 FormToc::FormToc(LyXView * lv, Dialogs * d) - : FormCommand(lv, d, _("Table of Contents"), new OkApplyCancelPolicy), + : FormCommand(lv, d, _("Table of Contents"), new OkCancelPolicy), dialog_(0) { // let the dialog be shown diff --git a/src/frontends/xforms/FormUrl.C b/src/frontends/xforms/FormUrl.C index fc39ce6a11..f14e326339 100644 --- a/src/frontends/xforms/FormUrl.C +++ b/src/frontends/xforms/FormUrl.C @@ -26,7 +26,7 @@ #include "lyxfunc.h" FormUrl::FormUrl(LyXView * lv, Dialogs * d) - : FormCommand(lv, d, _("Url"), new OkApplyCancelReadOnlyPolicy), + : FormCommand(lv, d, _("Url"), new NoRepeatedApplyReadOnlyPolicy), dialog_(0) { // let the dialog be shown diff --git a/src/frontends/xforms/Menubar_pimpl.C b/src/frontends/xforms/Menubar_pimpl.C index cbc3174269..4daf1de29d 100644 --- a/src/frontends/xforms/Menubar_pimpl.C +++ b/src/frontends/xforms/Menubar_pimpl.C @@ -562,11 +562,9 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view, lyxerr[Debug::GUI] << "Command: \"" << lyxaction.getActionName(item.action()) - << "\", Binding " << accel - << ", shortcut " << shortcut - << endl; - - + << "\", binding \"" << accel + << "\", shortcut \"" << shortcut + << "\"" << endl; break; } diff --git a/src/frontends/xforms/form_citation.C b/src/frontends/xforms/form_citation.C index c5f69e335c..cbd1861a0c 100644 --- a/src/frontends/xforms/form_citation.C +++ b/src/frontends/xforms/form_citation.C @@ -25,46 +25,55 @@ FD_form_citation * FormCitation::build_citation() fdui->form = fl_bgn_form(FL_NO_BOX, 435, 665); fdui->form->u_vdata = this; fdui->box = obj = fl_add_box(FL_UP_BOX, 0, 0, 435, 665, ""); - fl_set_object_resize(obj, FL_RESIZE_X); fdui->citeBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 30, 180, 300, idex(_("Inset keys|#I"))); fl_set_button_shortcut(obj, scex(_("Inset keys|#I")), 1); fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fl_set_object_gravity(obj, FL_NorthWest, FL_South); fl_set_object_resize(obj, FL_RESIZE_X); fl_set_object_callback(obj, C_FormBaseInputCB, CITEBRSR); fdui->bibBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 240, 30, 180, 300, idex(_("Bibliography keys|#B"))); fl_set_button_shortcut(obj, scex(_("Bibliography keys|#B")), 1); fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fl_set_object_gravity(obj, FL_North, FL_SouthEast); fl_set_object_resize(obj, FL_RESIZE_X); fl_set_object_callback(obj, C_FormBaseInputCB, BIBBRSR); fdui->addBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 30, 30, 30, _("@4->")); fl_set_button_shortcut(obj, _("#&D"), 1); + fl_set_object_gravity(obj, FL_North, FL_North); fl_set_object_resize(obj, FL_RESIZE_NONE); fl_set_object_callback(obj, C_FormBaseInputCB, ADD); fdui->delBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 65, 30, 30, _("@9+")); fl_set_button_shortcut(obj, _("#X"), 1); + fl_set_object_gravity(obj, FL_North, FL_North); fl_set_object_resize(obj, FL_RESIZE_NONE); fl_set_object_callback(obj, C_FormBaseInputCB, DELETE); fdui->upBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 100, 30, 30, _("@8->")); fl_set_button_shortcut(obj, _("#&A"), 1); + fl_set_object_gravity(obj, FL_North, FL_North); fl_set_object_resize(obj, FL_RESIZE_NONE); fl_set_object_callback(obj, C_FormBaseInputCB, UP); fdui->downBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 135, 30, 30, _("@2->")); fl_set_button_shortcut(obj, _("#&B"), 1); + fl_set_object_gravity(obj, FL_North, FL_North); fl_set_object_resize(obj, FL_RESIZE_NONE); fl_set_object_callback(obj, C_FormBaseInputCB, DOWN); fdui->infoBrsr = obj = fl_add_browser(FL_NORMAL_BROWSER, 10, 360, 410, 80, _("Info")); fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); - fl_set_object_resize(obj, FL_RESIZE_X); + fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast); + fl_set_object_resize(obj, FL_RESIZE_NONE); fdui->style = obj = fl_add_choice(FL_NORMAL_CHOICE, 160, 470, 130, 30, idex(_("Citation style|#s"))); fl_set_button_shortcut(obj, scex(_("Citation style|#s")), 1); fl_set_object_boxtype(obj, FL_DOWN_BOX); - fl_set_object_resize(obj, FL_RESIZE_X); + fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast); + fl_set_object_resize(obj, FL_RESIZE_NONE); fdui->textBefore = obj = fl_add_input(FL_NORMAL_INPUT, 100, 520, 250, 30, idex(_("Text before|#T"))); fl_set_button_shortcut(obj, scex(_("Text before|#T")), 1); - fl_set_object_resize(obj, FL_RESIZE_X); + fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast); + fl_set_object_resize(obj, FL_RESIZE_NONE); fdui->textAftr = obj = fl_add_input(FL_NORMAL_INPUT, 100, 570, 250, 30, idex(_("Text after|#e"))); fl_set_button_shortcut(obj, scex(_("Text after|#e")), 1); - fl_set_object_resize(obj, FL_RESIZE_X); + fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast); + fl_set_object_resize(obj, FL_RESIZE_NONE); fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 630, 90, 30, idex(_("Restore|#R"))); fl_set_button_shortcut(obj, scex(_("Restore|#R")), 1); fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest); diff --git a/src/frontends/xforms/form_ref.C b/src/frontends/xforms/form_ref.C index 9b2051e3dc..998a672d54 100644 --- a/src/frontends/xforms/form_ref.C +++ b/src/frontends/xforms/form_ref.C @@ -25,19 +25,18 @@ FD_form_ref * FormRef::build_ref() fdui->form = fl_bgn_form(FL_NO_BOX, 530, 340); fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 530, 340, ""); - fdui->browser = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 10, 270, 280, ""); + fdui->browser = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 10, 270, 240, ""); fl_set_object_lalign(obj, FL_ALIGN_TOP); - fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); - fl_set_object_resize(obj, FL_RESIZE_X); + fl_set_object_gravity(obj, FL_NorthWest, FL_South); fl_set_object_callback(obj, C_FormBaseInputCB, 2); - fdui->button_update = obj = fl_add_button(FL_NORMAL_BUTTON, 40, 300, 90, 30, idex(_("Update|#U"))); + fdui->button_update = obj = fl_add_button(FL_NORMAL_BUTTON, 40, 260, 90, 30, idex(_("Update|#U"))); fl_set_button_shortcut(obj, scex(_("Update|#U")), 1); - fl_set_object_resize(obj, FL_RESIZE_NONE); + fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest); fl_set_object_callback(obj, C_FormBaseInputCB, 3); - fdui->sort = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 170, 300, 30, 30, idex(_("Sort|#S"))); + fdui->sort = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 170, 260, 30, 30, idex(_("Sort|#S"))); fl_set_button_shortcut(obj, scex(_("Sort|#S")), 1); fl_set_object_lalign(obj, FL_ALIGN_RIGHT); - fl_set_object_resize(obj, FL_RESIZE_NONE); + fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest); fl_set_object_callback(obj, C_FormBaseInputCB, 3); fdui->name = obj = fl_add_input(FL_NORMAL_INPUT, 370, 10, 150, 40, idex(_("Name:|#N"))); fl_set_button_shortcut(obj, scex(_("Name:|#N")), 1); @@ -54,13 +53,21 @@ FD_form_ref * FormRef::build_ref() fl_set_button_shortcut(obj, scex(_("Goto reference|#G")), 1); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); fl_set_object_callback(obj, C_FormBaseInputCB, 1); - fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 330, 300, 90, 30, _("OK")); + fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 230, 300, 90, 30, _("OK")); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); fl_set_object_callback(obj, C_FormBaseOKCB, 0); fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 430, 300, 90, 30, idex(_("Cancel|#C^["))); fl_set_button_shortcut(obj, scex(_("Cancel|#C^[")), 1); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); fl_set_object_callback(obj, C_FormBaseCancelCB, 0); + fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 330, 300, 90, 30, idex(_("Apply|#A"))); + fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); + fl_set_object_callback(obj, C_FormBaseApplyCB, 0); + fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 300, 90, 30, idex(_("Restore|#R"))); + fl_set_button_shortcut(obj, scex(_("Restore|#R")), 1); + fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); + fl_set_object_callback(obj, C_FormBaseRestoreCB, 0); fl_end_form(); fdui->form->fdui = fdui; diff --git a/src/frontends/xforms/form_ref.h b/src/frontends/xforms/form_ref.h index 91bfaf3497..e37f57ff18 100644 --- a/src/frontends/xforms/form_ref.h +++ b/src/frontends/xforms/form_ref.h @@ -8,6 +8,8 @@ extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); extern "C" void C_FormBaseOKCB(FL_OBJECT *, long); extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long); +extern "C" void C_FormBaseApplyCB(FL_OBJECT *, long); +extern "C" void C_FormBaseRestoreCB(FL_OBJECT *, long); /**** Forms and Objects ****/ @@ -24,6 +26,8 @@ struct FD_form_ref { FL_OBJECT *button_go; FL_OBJECT *button_ok; FL_OBJECT *button_cancel; + FL_OBJECT *button_apply; + FL_OBJECT *button_restore; }; #endif /* FD_form_ref_h_ */ diff --git a/src/frontends/xforms/forms/form_citation.fd b/src/frontends/xforms/forms/form_citation.fd index 7cae476100..29ea49335c 100644 --- a/src/frontends/xforms/forms/form_citation.fd +++ b/src/frontends/xforms/forms/form_citation.fd @@ -24,7 +24,7 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: shortcut: -resize: FL_RESIZE_X +resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: box callback: @@ -43,7 +43,7 @@ lcol: FL_BLACK label: Inset keys|#I shortcut: resize: FL_RESIZE_X -gravity: FL_NoGravity FL_NoGravity +gravity: FL_NorthWest FL_South name: citeBrsr callback: C_FormBaseInputCB argument: CITEBRSR @@ -61,7 +61,7 @@ lcol: FL_BLACK label: Bibliography keys|#B shortcut: resize: FL_RESIZE_X -gravity: FL_NoGravity FL_NoGravity +gravity: FL_North FL_SouthEast name: bibBrsr callback: C_FormBaseInputCB argument: BIBBRSR @@ -79,7 +79,7 @@ lcol: FL_BLACK label: @4-> shortcut: #&D resize: FL_RESIZE_NONE -gravity: FL_NoGravity FL_NoGravity +gravity: FL_North FL_North name: addBtn callback: C_FormBaseInputCB argument: ADD @@ -97,7 +97,7 @@ lcol: FL_BLACK label: @9+ shortcut: #X resize: FL_RESIZE_NONE -gravity: FL_NoGravity FL_NoGravity +gravity: FL_North FL_North name: delBtn callback: C_FormBaseInputCB argument: DELETE @@ -115,7 +115,7 @@ lcol: FL_BLACK label: @8-> shortcut: #&A resize: FL_RESIZE_NONE -gravity: FL_NoGravity FL_NoGravity +gravity: FL_North FL_North name: upBtn callback: C_FormBaseInputCB argument: UP @@ -133,7 +133,7 @@ lcol: FL_BLACK label: @2-> shortcut: #&B resize: FL_RESIZE_NONE -gravity: FL_NoGravity FL_NoGravity +gravity: FL_North FL_North name: downBtn callback: C_FormBaseInputCB argument: DOWN @@ -150,8 +150,8 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: Info shortcut: -resize: FL_RESIZE_X -gravity: FL_NoGravity FL_NoGravity +resize: FL_RESIZE_NONE +gravity: FL_SouthWest FL_SouthEast name: infoBrsr callback: argument: @@ -168,8 +168,8 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: Citation style|#s shortcut: -resize: FL_RESIZE_X -gravity: FL_NoGravity FL_NoGravity +resize: FL_RESIZE_NONE +gravity: FL_SouthWest FL_SouthEast name: style callback: argument: @@ -186,8 +186,8 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: Text before|#T shortcut: -resize: FL_RESIZE_X -gravity: FL_NoGravity FL_NoGravity +resize: FL_RESIZE_NONE +gravity: FL_SouthWest FL_SouthEast name: textBefore callback: argument: @@ -204,8 +204,8 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: Text after|#e shortcut: -resize: FL_RESIZE_X -gravity: FL_NoGravity FL_NoGravity +resize: FL_RESIZE_NONE +gravity: FL_SouthWest FL_SouthEast name: textAftr callback: argument: diff --git a/src/frontends/xforms/forms/form_ref.fd b/src/frontends/xforms/forms/form_ref.fd index 1852217867..05dd9eaa4c 100644 --- a/src/frontends/xforms/forms/form_ref.fd +++ b/src/frontends/xforms/forms/form_ref.fd @@ -10,7 +10,7 @@ Unit of measure: FL_COORD_PIXEL Name: form_ref Width: 530 Height: 340 -Number of Objects: 10 +Number of Objects: 12 -------------------- class: FL_BOX @@ -33,7 +33,7 @@ argument: -------------------- class: FL_BROWSER type: HOLD_BROWSER -box: 10 10 270 280 +box: 10 10 270 240 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_TOP @@ -42,8 +42,8 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: shortcut: -resize: FL_RESIZE_X -gravity: FL_NorthWest FL_NoGravity +resize: FL_RESIZE_ALL +gravity: FL_NorthWest FL_South name: browser callback: C_FormBaseInputCB argument: 2 @@ -51,7 +51,7 @@ argument: 2 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 40 300 90 30 +box: 40 260 90 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -61,7 +61,7 @@ lcol: FL_BLACK label: Update|#U shortcut: resize: FL_RESIZE_NONE -gravity: FL_NoGravity FL_NoGravity +gravity: FL_SouthWest FL_SouthWest name: button_update callback: C_FormBaseInputCB argument: 3 @@ -69,7 +69,7 @@ argument: 3 -------------------- class: FL_CHECKBUTTON type: PUSH_BUTTON -box: 170 300 30 30 +box: 170 260 30 30 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_RIGHT @@ -79,7 +79,7 @@ lcol: FL_BLACK label: Sort|#S shortcut: resize: FL_RESIZE_NONE -gravity: FL_NoGravity FL_NoGravity +gravity: FL_SouthWest FL_SouthWest name: sort callback: C_FormBaseInputCB argument: 3 @@ -159,7 +159,7 @@ argument: 1 -------------------- class: FL_BUTTON type: RETURN_BUTTON -box: 330 300 90 30 +box: 230 300 90 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -192,5 +192,41 @@ name: button_cancel callback: C_FormBaseCancelCB argument: 0 +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 330 300 90 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Apply|#A +shortcut: +resize: FL_RESIZE_NONE +gravity: FL_SouthEast FL_SouthEast +name: button_apply +callback: C_FormBaseApplyCB +argument: 0 + +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 10 300 90 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Restore|#R +shortcut: +resize: FL_RESIZE_NONE +gravity: FL_SouthEast FL_SouthEast +name: button_restore +callback: C_FormBaseRestoreCB +argument: 0 + ============================== create_the_forms