]> git.lyx.org Git - features.git/commitdiff
Added Minipage-Dialog, small fix in LyXTabular::l_getline (removing \r).
authorJürgen Vigna <jug@sad.it>
Fri, 16 Mar 2001 15:15:32 +0000 (15:15 +0000)
committerJürgen Vigna <jug@sad.it>
Fri, 16 Mar 2001 15:15:32 +0000 (15:15 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1787 a592a061-630c-0410-9148-cb99ea01b6c8

19 files changed:
po/POTFILES.in
src/BufferView_pimpl.C
src/ChangeLog
src/buffer.C
src/frontends/ChangeLog
src/frontends/Dialogs.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/Dialogs.C
src/frontends/xforms/FormMinipage.C [new file with mode: 0644]
src/frontends/xforms/FormMinipage.h [new file with mode: 0644]
src/frontends/xforms/Makefile.am
src/frontends/xforms/form_minipage.C [new file with mode: 0644]
src/frontends/xforms/form_minipage.h [new file with mode: 0644]
src/frontends/xforms/forms/form_minipage.fd [new file with mode: 0644]
src/frontends/xforms/forms/makefile
src/insets/ChangeLog
src/insets/insetminipage.C
src/insets/insetminipage.h
src/tabular.C

index 0c36832d51f8f1d5f8aec5252057cbd59e274ed6..a74ea7b366215f80d15a874b6dec12f8748f1250 100644 (file)
@@ -101,6 +101,9 @@ src/frontends/xforms/form_include.C
 src/frontends/xforms/FormIndex.C
 src/frontends/xforms/form_index.C
 src/frontends/xforms/FormLog.C
+src/frontends/xforms/form_minipage.C
+src/frontends/xforms/FormMinipage.C
+src/frontends/xforms/form_paragraph.C
 src/frontends/xforms/FormMaths.C
 src/frontends/xforms/form_maths.C
 src/frontends/xforms/FormParagraph.C
index d146aa499dc54557c94e2ac6d3c3f0946d131b30..ca9cea4c94725b671f7f9ec377d268dcf6baa5eb 100644 (file)
@@ -763,7 +763,8 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
        
        selection_possible = false;
        
-       if (button >= 2) return;
+       if (button == 2)
+               return;
 
        bv_->setState();
        owner_->showState();
index 94604ce796551295e00af5c2288b843df61980fb..84fd6d6aae8fe0c5344452e6e2248cdf4925dae5 100644 (file)
@@ -1,3 +1,12 @@
+2001-03-16  Juergen Vigna  <jug@sad.it>
+
+       * BufferView_pimpl.C (workAreaButtonRelease): return only on button==2
+       otherwise it won't open options-dialogs.
+
+       * buffer.C: honor pextraWidth(p) on converting minipages.
+
+       * tabular.C (l_getline): changed the functions to strip trailing \r.
+
 2001-03-16  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * BufferView_pimpl.C:
index 362c97391b3dea7fba1caac61e4d289255abbb0d..28f6059e033d2e3140dfdf6fe59f9bb4cad11e8b 100644 (file)
@@ -512,6 +512,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
                                        // parameters to set options in the
                                        // minipage inset.
                                        InsetMinipage::Position imp = static_cast<InsetMinipage::Position>(minipar->params.pextraAlignment());
+                                       string pextraWidth = minipar->params.pextraWidth();
+                                       string pextraWidthp = minipar->params.pextraWidthp();
+                                       bool pextraHfill = minipar->params.pextraHfill();
                                        LyXParagraph * tmp = minipar;
                                        while (tmp) {
                                                tmp->params.pextraType(0);
@@ -525,10 +528,13 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
                                        
                                        InsetMinipage * mini = new InsetMinipage;
                                        mini->pos(imp);
+                                       mini->width(pextraWidth);
+                                       mini->widthp(pextraWidthp);
                                        mini->inset->par = minipar;
                                        // Insert the minipage last in the
                                        // previous paragraph.
                                        par->previous()->InsertInset(par->previous()->size(), mini);
+#warning insert a hfill-character here if pextraHfill == true
                                        minipar = par;
                                } else {
                                        lyxerr << "new minipage par" << endl;
@@ -568,6 +574,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
                                // do want to use some of these parameters
                                // to set options in the minipage inset.
                                InsetMinipage::Position imp = static_cast<InsetMinipage::Position>(minipar->params.pextraAlignment());
+                               string pextraWidth = minipar->params.pextraWidth();
+                               string pextraWidthp = minipar->params.pextraWidthp();
+                               bool pextraHfill = minipar->params.pextraHfill();
                                LyXParagraph * tmp = minipar;
                                while (tmp) {
                                        tmp->params.pextraType(0);
@@ -581,8 +590,11 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
                                
                                InsetMinipage * mini = new InsetMinipage;
                                mini->pos(imp);
+                               mini->width(pextraWidth);
+                               mini->widthp(pextraWidthp);
                                mini->inset->par = minipar;
                                par->previous()->InsertInset(par->previous()->size(), mini);
+#warning insert a hfill-character here if pextraHfill == true
                                minipar = 0;
                        } else if (par->params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE) {
                                
index c61bedf4f0b389dbdff6af9f6998d5ac62ce9d38..2044533b07eadc654acb2c71c45ec82e254d36d4 100644 (file)
@@ -1,3 +1,7 @@
+2001-03-16  Juergen Vigna  <jug@sad.it>
+
+       * Dialogs.h (noncopyable): added minipage signals.
+
 2001-03-15  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
 
        * several files: remove CXX_WORKING_NAMESPACES
index f90f652c63e2ec87159bcad0da5dd6f006ff72c8..28db300368ee22abf7c72da19a5a41548b3b6e6a 100644 (file)
@@ -44,6 +44,7 @@ class InsetInclude;
 class InsetInfo;
 class InsetTabular;
 class InsetCommand;
+class InsetMinipage;
 
 /** Container of all dialogs and signals a LyXView needs or uses to access them
     The list of dialog signals isn't comprehensive but should be a good guide
@@ -149,6 +150,10 @@ public:
        ///
        SigC::Signal0<void> showTabularCreate;
        ///
+       SigC::Signal1<void, InsetMinipage *> showMinipage;
+       ///
+       SigC::Signal1<void, InsetMinipage *> updateMinipage;
+       ///
        SigC::Signal1<void, InsetCommand *> showTOC;
        ///
        SigC::Signal1<void, string const &> createTOC;
index 7cfd3587348306270ffdd5cf71bb3536ec27dbb2..5c72b5fdbc1a7189fe23398452146acb7dd4039c 100644 (file)
@@ -1,3 +1,13 @@
+2001-03-16  Juergen Vigna  <jug@sad.it>
+
+       * Dialogs.C (Dialogs): create minipage options dialog.
+
+       * forms/form_minipage.fd: 
+       * form_minipage.C: 
+       * form_minipage.h: 
+       * FormMinipage.C: 
+       * FormMinipage.h: new files for the minipage options dialog.
+
 2001-03-16  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * FormMaths.[Ch]: make the FD_ structs to private. Create appropriate
index 96981e55659e77473666f1adb713f1a8d8e55c67..7e27ca071fd5b142a0ec9f2f8e1ac732958e97d1 100644 (file)
@@ -48,6 +48,7 @@
 #include "FormToc.h"
 #include "FormUrl.h"
 #include "FormVCLog.h"
+#include "FormMinipage.h"
 
 // Signal enabling all visible popups to be redrawn if so desired.
 // E.g., when the GUI colours have been remapped.
@@ -84,6 +85,7 @@ Dialogs::Dialogs(LyXView * lv)
        add(new FormToc(lv, this));
        add(new FormUrl(lv, this));
        add(new FormVCLog(lv, this));
+       add(new FormMinipage(lv, this));
        
        // reduce the number of connections needed in
        // dialogs by a simple connection here.
diff --git a/src/frontends/xforms/FormMinipage.C b/src/frontends/xforms/FormMinipage.C
new file mode 100644 (file)
index 0000000..8c94bc5
--- /dev/null
@@ -0,0 +1,135 @@
+// -*- C++ -*-
+/* This file is part of
+ * ====================================================== 
+ *
+ *           LyX, The Document Processor
+ *
+ *           Copyright 2000 The LyX Team.
+ *
+ * ======================================================
+ */
+/* FormMinipage.C
+ * FormMinipage Interface Class Implementation
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "FormMinipage.h"
+#include "form_minipage.h"
+#include "Dialogs.h"
+#include "LyXView.h"
+#include "buffer.h"
+#include "insets/insetminipage.h"
+#include "support/lstrings.h"
+
+FormMinipage::FormMinipage(LyXView * lv, Dialogs * d)
+       : FormInset(lv, d, _("Minipage Options")),
+         inset_(0)
+{
+    // let the dialog be shown
+    // This is a permanent connection so we won't bother
+    // storing a copy because we won't be disconnecting.
+    d->showMinipage.connect(slot(this, &FormMinipage::showInset));
+    d->updateMinipage.connect(slot(this, &FormMinipage::updateInset));
+}
+
+
+FL_FORM * FormMinipage::form() const
+{
+    if (dialog_.get())
+       return dialog_->form;
+    return 0;
+}
+
+
+void FormMinipage::connect()
+{
+    bc().valid(true);
+    FormBaseBD::connect();
+}
+
+
+void FormMinipage::showInset(InsetMinipage * inset)
+{
+    if (inset == 0) return;
+
+    // If connected to another inset, disconnect from it.
+    if (inset_ != inset) {
+       ih_.disconnect();
+       ih_ = inset->hideDialog.connect(slot(this, &FormMinipage::hide));
+       inset_ = inset;
+    }
+
+    show();
+}
+
+
+void FormMinipage::updateInset(InsetMinipage * inset)
+{
+    if (inset == 0 || inset_ == 0) return;
+
+    // If connected to another inset, disconnect from it.
+    if (inset_ != inset) {
+       ih_.disconnect();
+       ih_ = inset->hideDialog.connect(slot(this, &FormMinipage::hide));
+       inset_ = inset;
+    }
+
+    update();
+}
+
+void FormMinipage::build()
+{
+    dialog_.reset(build_minipage());
+
+    // Workaround dumb xforms sizing bug
+    minw_ = form()->w;
+    minh_ = form()->h;
+
+    fl_set_input_return(dialog_->input_width, FL_RETURN_CHANGED);
+    fl_set_input_return(dialog_->input_widthp, FL_RETURN_CHANGED);
+
+    // Manage the ok, apply and cancel/close buttons
+    bc().setOK(dialog_->button_ok);
+    bc().setApply(dialog_->button_apply);
+    bc().setCancel(dialog_->button_cancel);
+    bc().refresh();
+}
+
+
+void FormMinipage::apply()
+{
+#if 0
+    int ysize = int(fl_get_slider_value(dialog_->slider_columns) + 0.5);
+    int xsize = int(fl_get_slider_value(dialog_->slider_rows) + 0.5);
+
+    string tmp = tostr(xsize) + " " + tostr(ysize);
+    lv_->getLyXFunc()->Dispatch(LFUN_INSET_TABULAR, tmp);
+#endif
+}
+
+
+void FormMinipage::update()
+{
+    if (!inset_)
+       return;
+    fl_set_input(dialog_->input_width, inset_->width().c_str());
+    fl_set_input(dialog_->input_widthp, tostr(inset_->widthp()).c_str());
+                
+    switch (inset_->pos()) {
+    case InsetMinipage::top:
+       fl_set_button(dialog_->radio_top, 1);
+       break;
+    case InsetMinipage::center:
+       fl_set_button(dialog_->radio_middle, 1);
+       break;
+    case InsetMinipage::bottom:
+       fl_set_button(dialog_->radio_bottom, 1);
+       break;
+    }
+    bc().readOnly(lv_->buffer()->isReadonly());
+}
diff --git a/src/frontends/xforms/FormMinipage.h b/src/frontends/xforms/FormMinipage.h
new file mode 100644 (file)
index 0000000..bba936b
--- /dev/null
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+/* This file is part of
+ * ======================================================
+ * 
+ *           LyX, The Document Processor
+ *      
+ *         Copyright 1995 Matthias Ettrich
+ *          Copyright 1995-2000 The LyX Team.
+ *
+ *======================================================*/
+/* FormMinipage.h
+ * FormMinipage Interface Class
+ */
+
+#ifndef FORMMINIPAGE_H
+#define FORMMINIPAGE_H
+
+#include <boost/smart_ptr.hpp>
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "FormInset.h"
+#include "xformsBC.h"
+
+class LyXView;
+class Dialogs;
+class InsetMinipage;
+struct FD_form_minipage;
+
+/** This class provides an XForms implementation of the FormMinipage
+    Dialog.
+ */
+class FormMinipage : public FormInset {
+public:
+       /// #FormMinipage x(LyXView ..., Dialogs ...);#
+       FormMinipage(LyXView *, Dialogs *);
+
+private:
+       /// Pointer to the actual instantiation of the ButtonController.
+       virtual xformsBC & bc();
+       /// Connect signals etc.
+       virtual void connect();
+
+       /// Slot launching dialog to an existing inset
+       void showInset(InsetMinipage *);
+       /// Slot launching dialog to an existing inset
+       void updateInset(InsetMinipage *);
+       /// Apply from dialog
+       virtual void apply();
+       /// Update dialog before showing it
+       virtual void update();
+       /// Pointer to the actual instantiation of the xforms form
+       virtual FL_FORM * form() const;
+       /// Build the dialog
+       virtual void build();
+
+       ///
+       FD_form_minipage * build_minipage();
+       
+       /// Real GUI implementation.
+       boost::scoped_ptr<FD_form_minipage> dialog_;
+       /// The ButtonController
+       ButtonController<OkApplyCancelReadOnlyPolicy, xformsBC> bc_;
+
+       /// pointer to the inset passed through showInset
+       InsetMinipage * inset_;
+};
+
+
+inline
+xformsBC & FormMinipage::bc()
+{
+       return bc_;
+}
+#endif
index a32ff683c97334990416e9ee203d54be0a7a9d6f..3c8e487e366625611f4f408bdec44764ef7b2998 100644 (file)
@@ -90,6 +90,10 @@ libxforms_la_SOURCES = \
        FormMaths.h \
        form_maths.C \
        form_maths.h \
+       FormMinipage.C \
+       FormMinipage.h \
+       form_minipage.C \
+       form_minipage.h \
        FormParagraph.C \
        FormParagraph.h \
        form_paragraph.C \
diff --git a/src/frontends/xforms/form_minipage.C b/src/frontends/xforms/form_minipage.C
new file mode 100644 (file)
index 0000000..25c0ab0
--- /dev/null
@@ -0,0 +1,111 @@
+// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
+#include <config.h>
+#include "lyx_gui_misc.h"
+#include "gettext.h"
+
+/* Form definition file generated with fdesign. */
+
+#include FORMS_H_LOCATION
+#include <stdlib.h>
+#include "form_minipage.h"
+#include "FormMinipage.h"
+
+FD_form_minipage::~FD_form_minipage()
+{
+  if ( form->visible ) fl_hide_form( form );
+  fl_free_form( form );
+}
+
+
+FD_form_minipage * FormMinipage::build_minipage()
+{
+  FL_OBJECT *obj;
+  FD_form_minipage *fdui = new FD_form_minipage;
+
+  fdui->form = fl_bgn_form(FL_NO_BOX, 430, 170);
+  fdui->form->u_vdata = this;
+  obj = fl_add_box(FL_FLAT_BOX, 0, 0, 430, 170, "");
+  obj = fl_add_frame(FL_ENGRAVED_FRAME, 230, 20, 190, 100, "");
+    fl_set_object_color(obj, FL_COL1, FL_COL1);
+  obj = fl_add_frame(FL_ENGRAVED_FRAME, 20, 20, 200, 100, "");
+    fl_set_object_color(obj, FL_COL1, FL_COL1);
+  {
+    char const * const dummy = N_("Length|#L");
+    fdui->input_width = obj = fl_add_input(FL_NORMAL_INPUT, 100, 30, 110, 30, idex(_(dummy)));
+    fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+  }
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
+  {
+    // xgettext:no-c-format
+    char const * const dummy = N_("or %|#o");
+    fdui->input_widthp = obj = fl_add_input(FL_INT_INPUT, 100, 70, 110, 30, idex(_(dummy)));
+    fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+  }
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
+  obj = fl_add_text(FL_NORMAL_TEXT, 30, 10, 100, 20, _("Width"));
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+    fl_set_object_lstyle(obj, FL_BOLD_STYLE);
+  obj = fl_add_text(FL_NORMAL_TEXT, 240, 10, 140, 20, _("Alignment"));
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+    fl_set_object_lstyle(obj, FL_BOLD_STYLE);
+
+  fdui->group_alignment = fl_bgn_group();
+  {
+    char const * const dummy = N_("Top|#T");
+    fdui->radio_top = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 249, 30, 152, 30, idex(_(dummy)));
+    fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+  }
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
+  {
+    char const * const dummy = N_("Middle|#d");
+    fdui->radio_middle = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 249, 60, 152, 30, idex(_(dummy)));
+    fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+  }
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
+  {
+    char const * const dummy = N_("Bottom|#B");
+    fdui->radio_bottom = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 249, 90, 152, 30, idex(_(dummy)));
+    fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+  }
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
+  fl_end_group();
+
+  {
+    char const * const dummy = N_("Cancel|^[");
+    fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 330, 130, 90, 30, idex(_(dummy)));
+    fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+  }
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedCancelCB, 0);
+  {
+    char const * const dummy = N_("Apply|#A");
+    fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 230, 130, 90, 30, idex(_(dummy)));
+    fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+  }
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedApplyCB, 0);
+  fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 130, 130, 90, 30, _("OK"));
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedOKCB, 0);
+  {
+    char const * const dummy = N_("Restore|#R");
+    fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 130, 90, 30, idex(_(dummy)));
+    fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+  }
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_callback(obj, C_FormBaseDeprecatedRestoreCB, 0);
+  fl_end_form();
+
+  fdui->form->fdui = fdui;
+
+  return fdui;
+}
+/*---------------------------------------*/
+
diff --git a/src/frontends/xforms/form_minipage.h b/src/frontends/xforms/form_minipage.h
new file mode 100644 (file)
index 0000000..e9f9349
--- /dev/null
@@ -0,0 +1,32 @@
+// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
+/** Header file generated with fdesign **/
+
+#ifndef FD_form_minipage_h_
+#define FD_form_minipage_h_
+
+/** Callbacks, globals and object handlers **/
+extern  "C" void C_FormBaseDeprecatedInputCB(FL_OBJECT *, long);
+extern  "C" void C_FormBaseDeprecatedCancelCB(FL_OBJECT *, long);
+extern  "C" void C_FormBaseDeprecatedApplyCB(FL_OBJECT *, long);
+extern  "C" void C_FormBaseDeprecatedOKCB(FL_OBJECT *, long);
+extern  "C" void C_FormBaseDeprecatedRestoreCB(FL_OBJECT *, long);
+
+
+/**** Forms and Objects ****/
+struct FD_form_minipage {
+       ~FD_form_minipage();
+
+       FL_FORM *form;
+       FL_OBJECT *input_width;
+       FL_OBJECT *input_widthp;
+       FL_OBJECT *group_alignment;
+       FL_OBJECT *radio_top;
+       FL_OBJECT *radio_middle;
+       FL_OBJECT *radio_bottom;
+       FL_OBJECT *button_cancel;
+       FL_OBJECT *button_apply;
+       FL_OBJECT *button_ok;
+       FL_OBJECT *button_restore;
+};
+
+#endif /* FD_form_minipage_h_ */
diff --git a/src/frontends/xforms/forms/form_minipage.fd b/src/frontends/xforms/forms/form_minipage.fd
new file mode 100644 (file)
index 0000000..5875aa9
--- /dev/null
@@ -0,0 +1,304 @@
+Magic: 13000
+
+Internal Form Definition File
+    (do not change)
+
+Number of forms: 1
+Unit of measure: FL_COORD_PIXEL
+
+=============== FORM ===============
+Name: form_minipage
+Width: 430
+Height: 170
+Number of Objects: 16
+
+--------------------
+class: FL_BOX
+type: FLAT_BOX
+box: 0 0 430 170
+boxtype: FL_FLAT_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_FRAME
+type: ENGRAVED_FRAME
+box: 230 20 190 100
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_FRAME
+type: ENGRAVED_FRAME
+box: 20 20 200 100
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 100 30 110 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Length|#L
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_width
+callback: C_FormBaseDeprecatedInputCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: INT_INPUT
+box: 100 70 110 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: or %|#o
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_widthp
+callback: C_FormBaseDeprecatedInputCB
+argument: 0
+
+--------------------
+class: FL_TEXT
+type: NORMAL_TEXT
+box: 30 10 100 20
+boxtype: FL_FLAT_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
+style: FL_BOLD_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Width
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_TEXT
+type: NORMAL_TEXT
+box: 240 10 140 20
+boxtype: FL_FLAT_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
+style: FL_BOLD_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Alignment
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_BEGIN_GROUP
+type: 0
+box: 0 0 0 0
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: group_alignment
+callback: 
+argument: 
+
+--------------------
+class: FL_CHECKBUTTON
+type: RADIO_BUTTON
+box: 249 30 152 30
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Top|#T
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: radio_top
+callback: C_FormBaseDeprecatedInputCB
+argument: 0
+
+--------------------
+class: FL_CHECKBUTTON
+type: RADIO_BUTTON
+box: 249 60 152 30
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Middle|#d
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: radio_middle
+callback: C_FormBaseDeprecatedInputCB
+argument: 0
+
+--------------------
+class: FL_CHECKBUTTON
+type: RADIO_BUTTON
+box: 249 90 152 30
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Bottom|#B
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: radio_bottom
+callback: C_FormBaseDeprecatedInputCB
+argument: 0
+
+--------------------
+class: FL_END_GROUP
+type: 0
+box: 0 0 0 0
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 330 130 90 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Cancel|^[
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_cancel
+callback: C_FormBaseDeprecatedCancelCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 230 130 90 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Apply|#A
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_apply
+callback: C_FormBaseDeprecatedApplyCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: RETURN_BUTTON
+box: 130 130 90 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: OK
+shortcut: ^M
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_ok
+callback: C_FormBaseDeprecatedOKCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 10 130 90 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Restore|#R
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_restore
+callback: C_FormBaseDeprecatedRestoreCB
+argument: 0
+
+==============================
+create_the_forms
index b1d1b80ddab8528a737d76398158aea67dc7d9e9..03cb90f9038aa72b620d0055013a320ee538335e 100644 (file)
@@ -42,7 +42,8 @@ SRCS := form_bibitem.fd \
        form_tabular.fd \
        form_tabular_create.fd \
        form_toc.fd \
-       form_url.fd
+       form_url.fd \
+       form_minipage.fd
 
 OBJS := $(SRCS:.fd=.C)
 
index 513fa422feae37d040cc13003ffe367bc1bca8a9..735435c327c8b40b036c2c882555a667009bca7a 100644 (file)
@@ -1,3 +1,12 @@
+2001-03-16  Juergen Vigna  <jug@sad.it>
+
+       * insetminipage.C (width): modified with to be a string
+       (widthp): added widthp (for % width) support functions.
+       (InsetButtonRelease): added to open the options dialog on button==3.
+       (~InsetMinipage): added to hide the dialog.
+
+       * insetminipage.h: added hideDialog signal
+
 2001-03-15  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
 
        * insetminipage.h: change the order or Position to match
index aafab15c0e4579e9ef3405ddcea7eba1bdce1116..5429119f52d69f996d509f9b107f9461ffccb868 100644 (file)
 #include "gettext.h"
 #include "lyxfont.h"
 #include "BufferView.h"
+#include "LyXView.h"
+#include "frontends/Dialogs.h"
 #include "lyxtext.h"
 #include "insets/insettext.h"
 #include "support/LOstream.h"
+#include "support/lstrings.h"
 #include "debug.h"
 
 using std::ostream;
@@ -69,6 +72,12 @@ InsetMinipage::InsetMinipage()
 }
 
 
+InsetMinipage::~InsetMinipage()
+{
+       hideDialog();
+}
+
+
 void InsetMinipage::Write(Buffer const * buf, ostream & os) const 
 {
        os << getInsetName() << "\n";
@@ -150,13 +159,52 @@ void InsetMinipage::height(LyXLength const & ll)
 }
 
 
-LyXLength const & InsetMinipage::width() const
+string const & InsetMinipage::width() const
 {
        return width_;
 }
 
 
-void InsetMinipage::width(LyXLength const & ll)
+void InsetMinipage::width(string const & ll)
 {
        width_ = ll;
 }
+
+int InsetMinipage::widthp() const
+{
+       return widthp_;
+}
+
+
+void InsetMinipage::widthp(int ll)
+{
+       widthp_ = ll;
+}
+
+
+void InsetMinipage::widthp(string const & ll)
+{
+       widthp_ = strToInt(ll);
+}
+
+
+void InsetMinipage::InsetButtonRelease(BufferView * bv, int x, int y,
+                                      int button)
+{
+    if (button == 3) {
+#if 0
+// we have to check first if we have a locking inset and if this locking inset
+// has a popup menu with the 3rd button
+       if (the_locking_inset) {
+           UpdatableInset * i;
+           if ((i=the_locking_inset->GetFirstLockingInsetOfType(TABULAR_CODE))) {
+               i->InsetButtonRelease(bv, x, y, button);
+               return;
+           }
+       }
+#endif
+       bv->owner()->getDialogs()->showMinipage(this);
+       return;
+    }
+    InsetCollapsable::InsetButtonRelease(bv, x, y, button);
+}
index c8a270dd4592b4b5fc22b2f50e350a762c2cae04..54f9d23d0c981bdba2227086d8ba38a700913f6c 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "insetcollapsable.h"
 #include "vspace.h"
+#include <sigc++/signal_system.h>
 
 /** The minipage inset
   
@@ -40,6 +41,8 @@ public:
        ///
        InsetMinipage();
        ///
+       ~InsetMinipage();
+       ///
        void Write(Buffer const * buf, std::ostream & os) const;
        ///
        Inset * Clone(Buffer const &) const;
@@ -64,9 +67,20 @@ public:
        ///
        void height(LyXLength const &);
        ///
-       LyXLength const & width() const;
+       string const & width() const;
+       ///
+       void width(string const &);
+       ///
+       int widthp() const;
+       ///
+       void widthp(int);
        ///
-       void width(LyXLength const &);
+       void widthp(string const &);
+       ///
+       SigC::Signal0<void> hideDialog;
+       ///
+       void InsetButtonRelease(BufferView * bv, int x, int y, int button);
+
 private:
        ///
        Position pos_;
@@ -75,7 +89,9 @@ private:
        ///
        LyXLength height_;
        ///
-       LyXLength width_;
+       string width_;
+       ///
+       int widthp_;
 };
 
 #endif
index f8988a18fd94ccaefa973e235b8570243f014efb..217be601a1d24f61120948764ebb8155cd16ab96 100644 (file)
@@ -1225,9 +1225,12 @@ bool getTokenValue(string const & str, const char * token, bool & flag)
 static inline
 void l_getline(istream & is, string & str)
 {
-    getline(is, str);
-    while(str.empty() || ((str.length()==1) && (str[0] == '\r')))
+    str = string();
+    while(str.empty()) {
        getline(is, str);
+       if (!str.empty() && str[str.length()-1] == '\r')
+           str.erase(str.length()-1);
+    }
 }