From d70f607a374b9146d4d4769a539f5cce18ad9eb4 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 26 Jun 2000 09:31:14 +0000 Subject: [PATCH] Insetcite updates from Angus git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@833 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 11 ++++ forms/cite.fd | 86 ++++++++++++++--------------- src/insets/insetcite.C | 120 +++++++++++++++++++++++------------------ 3 files changed, 121 insertions(+), 96 deletions(-) diff --git a/ChangeLog b/ChangeLog index fea55f7875..72a4793fda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2000-06-23 Angus Leeming + + * forms/cite.fd: modified to allow resizing without messing + up the dialog. + + * src/insetcite.C: Uses code from cite.fd almost without + tweaking. ;-) + User can now resize dialog in the x-direction. + Resizing the dialog in the y-direction is prevented, as the + code does this intelligently already. + 2000-06-22 Jean-Marc Lasgouttes * INSTALL: remove obsolete entry in "problems" section. diff --git a/forms/cite.fd b/forms/cite.fd index e547a6dce9..74cfed86de 100644 --- a/forms/cite.fd +++ b/forms/cite.fd @@ -24,9 +24,9 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity -name: +name: box callback: argument: @@ -42,11 +42,11 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: Inset keys shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: +name: citeBrsr +callback: citation_cb +argument: InsetCitation::CITEBRSR -------------------- class: FL_BROWSER @@ -60,11 +60,11 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: Bibliography keys shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: +name: bibBrsr +callback: citation_cb +argument: InsetCitation::BIBBRSR -------------------- class: FL_BUTTON @@ -78,11 +78,11 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: @4-> shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: +name: addBtn +callback: citation_cb +argument: InsetCitation::ADD -------------------- class: FL_BUTTON @@ -96,11 +96,11 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: @9+ shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: +name: delBtn +callback: citation_cb +argument: InsetCitation::DELETE -------------------- class: FL_BUTTON @@ -114,11 +114,11 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: @8-> shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: +name: upBtn +callback: citation_cb +argument: InsetCitation::UP -------------------- class: FL_BUTTON @@ -132,11 +132,11 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: @2-> shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: +name: downBtn +callback: citation_cb +argument: InsetCitation::DOWN -------------------- class: FL_BROWSER @@ -150,9 +150,9 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: Info shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity -name: +name: infoBrsr callback: argument: @@ -168,9 +168,9 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: Citation style shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity -name: +name: style callback: argument: @@ -186,9 +186,9 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: Text before shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity -name: +name: textBefore callback: argument: @@ -204,9 +204,9 @@ size: FL_DEFAULT_SIZE lcol: FL_BLACK label: Text after shortcut: -resize: FL_RESIZE_ALL +resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity -name: +name: textAftr callback: argument: @@ -223,10 +223,10 @@ lcol: FL_BLACK label: OK shortcut: ^M resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: +gravity: FL_SouthEast FL_SouthEast +name: ok +callback: citation_cb +argument: InsetCitation::OK -------------------- class: FL_BUTTON @@ -239,12 +239,12 @@ style: FL_NORMAL_STYLE size: FL_DEFAULT_SIZE lcol: FL_BLACK label: Cancel -shortcut: +shortcut: ^[ resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: +gravity: FL_SouthEast FL_SouthEast +name: cancel +callback: citation_cb +argument: InsetCitation::CANCEL ============================== create_the_forms diff --git a/src/insets/insetcite.C b/src/insets/insetcite.C index 3e657546d3..7117bd9063 100644 --- a/src/insets/insetcite.C +++ b/src/insets/insetcite.C @@ -43,71 +43,81 @@ extern "C" void citation_cb( FL_OBJECT *, long data ) } -FD_citation_form * create_form_citation_form(void) +FD_citation_form *create_form_citation_form(void) { - FL_OBJECT * obj; - FD_citation_form * fdui = (FD_citation_form *) fl_calloc(1, sizeof(*fdui)); + FL_OBJECT *obj; + FD_citation_form *fdui = (FD_citation_form *) fl_calloc(1, sizeof(*fdui)); - // NOTE: dialog geometry is set in setSize(). - // Initial size is simply non-zero. - fdui->form = fl_bgn_form(FL_NO_BOX, 10, 10); - fdui->box = obj = fl_add_box(FL_UP_BOX, 0, 0, 10, 10, ""); + fdui->form = fl_bgn_form(FL_NO_BOX, 440, 790); + fdui->box = obj = fl_add_box(FL_UP_BOX,0,0,440,790,""); + fl_set_object_resize(obj, FL_RESIZE_X); - fdui->citeBrsr = obj = - fl_add_browser(FL_HOLD_BROWSER, 0, 0, 10, 10, _("Citation keys")); - fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, citation_cb, InsetCitation::CITEBRSR); + fdui->citeBrsr = obj = + fl_add_browser(FL_HOLD_BROWSER,20,40,170,370,_("Inset keys")); + fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT); + fl_set_object_resize(obj, FL_RESIZE_X); + fl_set_object_callback(obj,citation_cb,InsetCitation::CITEBRSR); - fdui->bibBrsr = obj = - fl_add_browser(FL_HOLD_BROWSER, 0, 0, 10, 10, _("Bibliography keys")); - fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, citation_cb, InsetCitation::BIBBRSR); + fdui->bibBrsr = obj = + fl_add_browser(FL_HOLD_BROWSER,250,40,170,370,_("Bibliography keys")); + fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT); + fl_set_object_resize(obj, FL_RESIZE_X); + fl_set_object_callback(obj,citation_cb,InsetCitation::BIBBRSR); - fdui->addBtn = obj = - fl_add_button(FL_NORMAL_BUTTON, 0, 0, 10, 10, "@4->"); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, citation_cb, InsetCitation::ADD); + fdui->addBtn = obj = + fl_add_button(FL_NORMAL_BUTTON,200,40,40,40,"@4->"); + fl_set_object_resize(obj, FL_RESIZE_NONE); + fl_set_object_callback(obj,citation_cb,InsetCitation::ADD); - fdui->delBtn = obj = - fl_add_button(FL_NORMAL_BUTTON, 0, 0, 10, 10, "@9+"); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, citation_cb, InsetCitation::DELETE); + fdui->delBtn = obj = + fl_add_button(FL_NORMAL_BUTTON,200,90,40,40,"@9+"); + fl_set_object_resize(obj, FL_RESIZE_NONE); + fl_set_object_callback(obj,citation_cb,InsetCitation::DELETE); - fdui->upBtn = obj = - fl_add_button(FL_NORMAL_BUTTON, 0, 0, 10, 10, "@8->"); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, citation_cb, InsetCitation::UP); - - fdui->downBtn = obj = - fl_add_button(FL_NORMAL_BUTTON, 0, 0, 10, 10, "@2->"); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, citation_cb, InsetCitation::DOWN); + fdui->upBtn = obj = + fl_add_button(FL_NORMAL_BUTTON,200,140,40,40,"@8->"); + fl_set_object_resize(obj, FL_RESIZE_NONE); + fl_set_object_callback(obj,citation_cb,InsetCitation::UP); - fdui->infoBrsr = obj = - fl_add_browser(FL_NORMAL_BROWSER, 0, 0, 10, 10, _("Info")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE) ; - fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fdui->downBtn = obj = + fl_add_button(FL_NORMAL_BUTTON,200,190,40,40,"@2->"); + fl_set_object_resize(obj, FL_RESIZE_NONE); + fl_set_object_callback(obj,citation_cb,InsetCitation::DOWN); - fdui->textAftr = obj = - fl_add_input(FL_NORMAL_INPUT, 0, 0, 10, 10, _("Text after")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->infoBrsr = obj = + fl_add_browser(FL_NORMAL_BROWSER,20,440,400,110,_("Info")); + fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT); + fl_set_object_resize(obj, FL_RESIZE_X); - fdui->ok = obj = - fl_add_button(FL_RETURN_BUTTON, 0, 0, 10, 10, _("OK")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, citation_cb, InsetCitation::OK); + /* + fdui->style = obj = + fl_add_choice(FL_NORMAL_CHOICE,160,570,130,30,_("Citation style")); + fl_set_object_boxtype(obj,FL_DOWN_BOX); + fl_set_object_resize(obj, FL_RESIZE_X); - fdui->cancel = obj = - fl_add_button(FL_NORMAL_BUTTON, 0, 0, 10, 10, idex(_("Cancel|^["))); - fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, citation_cb, InsetCitation::CANCEL); + fdui->textBefore = obj = + fl_add_input(FL_NORMAL_INPUT,100,620,250,30,_("Text before")); + fl_set_object_resize(obj, FL_RESIZE_X); + */ - fl_end_form(); - - return fdui; + fdui->textAftr = obj = + fl_add_input(FL_NORMAL_INPUT,100,660,250,30,_("Text after")); + fl_set_object_resize(obj, FL_RESIZE_X); + + fdui->ok = obj = + fl_add_button(FL_RETURN_BUTTON,190,730,110,40,_("OK")); + fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); + fl_set_object_callback(obj,citation_cb,InsetCitation::OK); + + fdui->cancel = obj = + fl_add_button(FL_NORMAL_BUTTON,310,730,110,40,idex(_("Cancel|^["))); + fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); + fl_set_object_callback(obj,citation_cb,InsetCitation::CANCEL); + + fl_end_form(); + + return fdui; } @@ -373,6 +383,10 @@ void InsetCitation::setSize( FD_citation_form * form, if( bibPresent ) formHeight += infoHeight + 30; fl_set_form_size( form->form, 430, formHeight ); + // No resizing is alowed in the y-direction + fl_set_form_minsize( form->form, 300, formHeight ); + fl_set_form_maxsize( form->form, 1000, formHeight ); + int ypos = 0; fl_set_object_geometry( form->box, 0, ypos, 430, formHeight ); ypos += 30;