]> git.lyx.org Git - features.git/commitdiff
citation patch from Angus
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 4 Sep 2000 13:22:22 +0000 (13:22 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 4 Sep 2000 13:22:22 +0000 (13:22 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@998 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/buffer.C
src/exporter.h
src/frontends/xforms/FormCitation.C
src/frontends/xforms/Menubar_pimpl.C

index bcd5384391cab6de35baef39f2564d46e04c6a78..eec202f974fe0063bafc7a053befdd74cb071daa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2000-09-04  Angus Leeming  <a.leeming@ic.ac.uk> +
+
+       * src/frontends/xforms/Menubar_pimpl.C: added two using directives
+       so that code compiles with DEC cxx.
+       
+       * src/frontends/xforms/FormCitation.C (setSize): code re-writtenn
+       to work correctly! Also now supports the additional elements
+       neeeded by natbib.
+       
 2000-09-01  Allan Rae  <rae@lyx.org>
 
        * src/frontends/ButtonPolicies.C: renamed all the references to
index 0f30d09da4165e66f203b74e1ba15326d5f93b0e..82d8255cf675beb996882ae77a1decab3281231e 100644 (file)
@@ -3381,6 +3381,8 @@ int Buffer::runLaTeX()
         AllowInput(users);
  
         return latex.getNumErrors();
+#else
+       return 0;
 #endif
 }
 
index 3ca20c1e227912a021b07bb87e4d99950988a10c..fb286f7a2d29b333633cc300a65185bbabe6246e 100644 (file)
@@ -44,6 +44,6 @@ public:
        string const BufferExtension(Buffer const * buffer);
 };
 
-//#define NEW_EXPORT 1
+#define NEW_EXPORT 1
 
 #endif
index 4b891c445e8e5645b255ce253d0984b9aab98e70..ac650b59022eb0c8017ed7a9fb36f94347bc3b5d 100644 (file)
@@ -35,6 +35,8 @@ using std::max;
 using std::min;
 using std::find;
 
+static int min_wform;
+
 FormCitation::FormCitation(LyXView * lv, Dialogs * d)
        : FormCommand(lv, d, _("Citation")), dialog_(0)
 {
@@ -64,6 +66,7 @@ void FormCitation::clearStore()
 void FormCitation::build()
 {
        dialog_ = build_citation();
+       min_wform = dialog_->form->w;
 }
 
 
@@ -196,54 +199,94 @@ void FormCitation::setCiteButtons( State status ) const
 
 void FormCitation::setSize( int hbrsr, bool bibPresent ) const
 {
-       int const hinfo  = dialog_->infoBrsr->h;
-       int const hother = 140;
-       hbrsr = max( hbrsr, 175 );
-       int wform = dialog_->form->w;
-       int hform = hbrsr + hother;
-
-       if( bibPresent ) hform += hinfo + 30;
-       fl_set_form_size( dialog_->form, wform, hform );
-
-       // No resizing is allowed in the y-direction
-       fl_set_form_minsize( dialog_->form, wform,   hform );
-       fl_set_form_maxsize( dialog_->form, 3*wform, hform );
-
+       bool const natbib = false; // will eventually be input
+       hbrsr = max( hbrsr, 175 ); // limit max size of cite/bib brsrs
+
+       // dh1, dh2, dh3 are the vertical separation between elements.
+       // These can be specified because the browser height is fixed
+       // so they are not changed by dynamic resizing
+       static int const dh1 = 30; // top of form to top of cite/bib brsrs;
+                                  // bottom of cite/bib brsrs to top of info;
+                                  // bottom of info to top next element;
+                                  // bottom of style to top textBefore;
+                                  // bottom of text to top ok/cancel buttons.
+       static int const dh2 = 10; // bottom of textBefore to top textAftr;
+                                  // bottom of ok/cancel buttons to bottom form
+       static int const dh3 = 5;  // spacing between add/delete/... buttons.
+
+       int const wbrsr  = dialog_->citeBrsr->w;
+       static int const hinfo  = dialog_->infoBrsr->h;
+       static int const hstyle = dialog_->style->h;
+       static int const htext  = dialog_->textAftr->h;
+       static int const hok    = dialog_->ok->h;
+
+       int const wform = dialog_->form->w;
+       int hform = dh1 + hbrsr + dh1;
+       if( bibPresent ) hform += hinfo + dh1;
+       if( natbib ) hform += hstyle + dh1 + htext + dh2;
+       hform += htext + dh1 + hok + dh2;
+
+       bool const sizeSet = ( hform != dialog_->form->h );
+       if( sizeSet ) fl_set_form_size( dialog_->form, wform, hform );
+
+       // No vertical resizing is allowed
+       // min_wform set in build()
+       fl_set_form_minsize( dialog_->form, min_wform,   hform );
+       fl_set_form_maxsize( dialog_->form, 3*min_wform, hform );
+
+       if( !sizeSet ) return;
+
+       int x = 0;
        int y = 0;
-       fl_set_object_geometry( dialog_->box, 0, y, wform, hform );
-       y += 30;
-       fl_set_object_geometry( dialog_->citeBrsr, 10, y, 180, hbrsr );
-       fl_set_object_geometry( dialog_->bibBrsr, 240, y, 180, hbrsr );
+       fl_set_object_geometry( dialog_->box, x, y, wform, hform );
 
-       fl_set_object_position( dialog_->addBtn,  200, y );
-       y += 5 + dialog_->addBtn->h;
-       fl_set_object_position( dialog_->delBtn,  200, y );
-       y += 5 + dialog_->delBtn->h;
-       fl_set_object_position( dialog_->upBtn,   200, y );
-       y += 5 + dialog_->upBtn->h;
-       fl_set_object_position( dialog_->downBtn, 200, y );
+       x = dialog_->citeBrsr->x;
+       y += dh1; 
+       fl_set_object_geometry( dialog_->citeBrsr, x, y, wbrsr, hbrsr );
+       x = dialog_->bibBrsr->x;
+       fl_set_object_geometry( dialog_->bibBrsr,  x, y, wbrsr, hbrsr );
 
-       y = dialog_->bibBrsr->y + dialog_->bibBrsr->h;
+       x = dialog_->addBtn->x;
+       fl_set_object_position( dialog_->addBtn,  x, y );
+       y += dh3 + dialog_->addBtn->h;
+       fl_set_object_position( dialog_->delBtn,  x, y );
+       y += dh3 + dialog_->delBtn->h;
+       fl_set_object_position( dialog_->upBtn,   x, y );
+       y += dh3 + dialog_->upBtn->h;
+       fl_set_object_position( dialog_->downBtn, x, y );
 
-       // awaiting natbib support
-       fl_hide_object( dialog_->style );
+       y = dh1 + hbrsr + dh1; // in position for next element
 
        if( bibPresent ) {
-               y += 30;
-               fl_set_object_position( dialog_->infoBrsr, 10, y );
+               x = dialog_->infoBrsr->x;
+               fl_set_object_position( dialog_->infoBrsr, x, y );
                fl_show_object( dialog_->infoBrsr );
-               y += hinfo;
-       }
-       else
+               y += hinfo + dh1;
+       } else
                fl_hide_object( dialog_->infoBrsr );
 
-       y += 20;
-       // awaiting natbib support
-       fl_hide_object( dialog_->textBefore );
+       if( natbib ) {
+               x = dialog_->style->x;
+               fl_set_object_position( dialog_->style, x, y );
+               fl_show_object( dialog_->style );
+               x = dialog_->textBefore->x;
+               y += hstyle + dh1;
+               fl_set_object_position( dialog_->textBefore, x, y );
+               fl_show_object( dialog_->textBefore );
+               y += htext + dh2;
+       } else {
+               fl_hide_object( dialog_->style );
+               fl_hide_object( dialog_->textBefore );
+       }
+
+       x = dialog_->textAftr->x;
+       fl_set_object_position( dialog_->textAftr, x, y );
 
-       fl_set_object_position( dialog_->textAftr, 100, y );
-       fl_set_object_position( dialog_->ok,       230, y+50 );
-       fl_set_object_position( dialog_->cancel,   330, y+50 );
+       x = dialog_->ok->x;
+       y += htext + dh1;
+       fl_set_object_position( dialog_->ok,       x, y );
+       x = dialog_->cancel->x;
+       fl_set_object_position( dialog_->cancel,   x, y );
 }
 
 
index 9f01bd3348d24d9b7f6a6f4fd850579ff0c01f45..a7f002431b82118cecf616acace8760e88ce883f 100644 (file)
@@ -32,6 +32,8 @@
 using std::pair;
 using std::endl;
 using std::vector;
+using std::max;
+using std::min;
 
 typedef vector<int>::size_type size_type;