+2003-10-07 Martin Vermeer <martin.vermeer@hut.fi>
+
+ * ui/stdmenus.ui: The Box patch. Fancybox support, minipage,
+ parbox
+
2003-10-06 José Matoa <jamatos@lyx.org>
* lyxrevert_223.py: finish support for change tracking revert.
OptItem "TeX Code Settings...|C" "inset-settings ert"
# 'a' shortcut to match Insert entry, shouldn't clash with Table Settings
OptItem "Float Settings...|a" "inset-settings float"
- OptItem "Minipage Settings...|M" "inset-settings minipage"
OptItem "Text Wrap Settings...|W" "inset-settings wrap"
OptItem "Note Settings...|N" "inset-settings note"
OptItem "Branch Settings...|B" "inset-settings branch"
+ OptItem "Box Settings...|x" "inset-settings box"
# Hey, guess what's broken ? Surprise surprise, it's tabular stuff
# This is in the Table submenu instead for now.
# OptItem "Table Settings...|a" "inset-settings tabular"
Submenu "Float|a" "insert_float"
# YUCK
Submenu "Note|N" "insert_note"
+ Submenu "Box" "insert_box"
Submenu "Branch|B" "branches"
Submenu "File|e" "insert_file"
Separator
Item "URL...|U" "url-insert"
Item "Footnote|F" "footnote-insert"
Item "Marginal Note|M" "marginalnote-insert"
- Item "Minipage|p" "minipage-insert"
Item "Short Title" "optional-insert"
Item "TeX|X" "ert-insert"
End
Item "Greyed Out|G" "note-insert Greyedout"
End
+ Menu "insert_box"
+ Item "Frameless|F" "box-insert Frameless"
+ Item "Boxed|B" "box-insert Boxed"
+ Item "Oval Box|O" "box-insert ovalbox"
+ Item "Oval Box, Thick|T" "box-insert Ovalbox"
+ Item "Shadow Box|S" "box-insert Shadowbox"
+ Item "Double Box|D" "box-insert Doublebox"
+ End
+
Menu "branches"
Branches
End
src/frontends/LyXView.C
src/frontends/controllers/ControlAboutlyx.C
src/frontends/controllers/ControlBibtex.C
+src/frontends/controllers/ControlBox.C
src/frontends/controllers/ControlDocument.C
src/frontends/controllers/ControlExternal.C
src/frontends/controllers/ControlGraphics.C
src/frontends/xforms/FormBase.C
src/frontends/xforms/FormBibitem.C
src/frontends/xforms/FormBibtex.C
+src/frontends/xforms/FormBox.C
src/frontends/xforms/FormBranch.C
src/frontends/xforms/FormChanges.C
src/frontends/xforms/FormCharacter.C
src/importer.C
src/insets/inset.C
src/insets/insetbibtex.C
+src/insets/insetbox.C
src/insets/insetbranch.C
src/insets/insetcaption.C
src/insets/insetenv.C
src/paragraph.C
src/paragraph_funcs.C
src/rowpainter.C
+src/support/path_defines.C
src/text.C
src/text2.C
src/text3.C
-<<<<<<< ChangeLog
+
+2003-10-07 Martin Vermeer <martin.vermeer@hut.fi>
+
+ * LaTeXFeatures.C:
+ * LyXAction.C:
+ * factory.C:
+ * lfuns.h:
+ * lyxfunc.C:
+ * text3.C: The Box patch. Fancybox support, minipage, parbox
+
2003-10-07 Martin Vermeer <martin.vermeer@hut.fi>
* CutAndPaste.h:
"prettyref",
"float",
"wasy",
- "dvipost"
+ "dvipost",
+ "fancybox",
+ "calc"
};
int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
{ LFUN_INSET_MINIPAGE, "minipage-insert", Noop },
{ LFUN_INSERT_BRANCH, "branch-insert", Noop },
{ LFUN_INSERT_NOTE, "note-insert", Noop },
+ { LFUN_INSERT_BOX, "box-insert", Noop },
{ LFUN_GOTONOTE, "note-next", ReadOnly },
{ LFUN_INSET_TOGGLE, "inset-toggle", ReadOnly },
{ LFUN_DOWN_PARAGRAPH, "paragraph-down", ReadOnly },
#include "insets/insetmarginal.h"
#include "insets/insetminipage.h"
#include "insets/insetnote.h"
+#include "insets/insetbox.h"
#include "insets/insetbranch.h"
#include "insets/insetoptarg.h"
#include "insets/insetref.h"
arg = "Note";
return new InsetNote(params, arg);
}
+ case LFUN_INSERT_BOX:
+ {
+ string arg = cmd.getArg(0);
+ if (arg.empty())
+ arg = "Boxed";
+ return new InsetBox(params, arg);
+ }
case LFUN_INSERT_BRANCH:
{
string arg = cmd.getArg(0);
} else if (tmptok == "Note" || tmptok == "Comment"
|| tmptok == "Greyedout") {
inset = new InsetNote(buf.params(), tmptok);
+ } else if (tmptok == "Boxed" || tmptok == "ovalbox"
+ || tmptok == "Shadowbox" || tmptok == "Doublebox"
+ || tmptok == "Ovalbox" || tmptok == "Frameless") {
+ inset = new InsetBox(buf.params(), tmptok);
} else if (tmptok == "Branch") {
inset = new InsetBranch(buf.params(), string());
} else if (tmptok == "Include") {
+2003-10-07 Martin Vermeer <martin.vermeer@hut.fi>
+
+ * ControlBox.C:
+ * ControlBox.h:
+ * Makefile.am: The Box patch. Fancybox support, minipage, parbox
+
2003-10-07 Martin Vermeer <martin.vermeer@hut.fi>
* BCView.h:
--- /dev/null
+/**
+ * \file ControlBox.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Martin Vermeer (with useful hints from Angus Leeming)
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "ControlBox.h"
+#include "funcrequest.h"
+#include "insets/insetbox.h"
+#include "gettext.h"
+
+
+using std::string;
+using std::vector;
+
+
+ControlBox::ControlBox(Dialog & parent)
+ : Dialog::Controller(parent)
+{}
+
+
+bool ControlBox::initialiseParams(string const & data)
+{
+ InsetBoxParams params("");
+ InsetBoxMailer::string2params(data, params);
+ params_.reset(new InsetBoxParams(params));
+
+ return true;
+
+}
+
+
+void ControlBox::clearParams()
+{
+ params_.reset();
+}
+
+
+void ControlBox::dispatchParams()
+{
+ string const lfun = InsetBoxMailer::params2string(params());
+ kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
+}
+
+
+void box_gui_tokens(vector<string> & ids, vector<string> & gui_names)
+{
+ char const * const ids_[] = {
+ "Frameless", "Boxed", "ovalbox",
+ "Ovalbox", "Shadowbox", "Doublebox"};
+ size_t const ids_size = sizeof(ids_) / sizeof(char *);
+ ids = vector<string>(ids_, ids_ + ids_size);
+ gui_names.clear();
+ gui_names.push_back(_("No frame drawn"));
+ gui_names.push_back(_("Rectangular box"));
+ gui_names.push_back(_("Oval box, thin"));
+ gui_names.push_back(_("Oval box, thick"));
+ gui_names.push_back(_("Shadow box"));
+ gui_names.push_back(_("Double box"));
+}
+
+void box_gui_tokens_special_length(vector<string> & ids,
+ vector<string> & gui_names)
+{
+ char const * const ids_[] = {
+ "none", "height", "depth",
+ "totalheight", "width"};
+ size_t const ids_size = sizeof(ids_) / sizeof(char *);
+ ids = vector<string>(ids_, ids_ + ids_size);
+ gui_names.clear();
+ gui_names.push_back(_("None"));
+ gui_names.push_back(_("Height"));
+ gui_names.push_back(_("Depth"));
+ gui_names.push_back(_("Total Height"));
+ gui_names.push_back(_("Width"));
+}
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file ControlBox.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Martin Vermeer (with useful hints from Angus Leeming)
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef CONTROLBOX_H
+#define CONTROLBOX_H
+
+
+#include "Dialog.h"
+#include <vector>
+
+class InsetBoxParams;
+
+class ControlBox : public Dialog::Controller {
+public:
+ ///
+ ControlBox(Dialog &);
+ ///
+ virtual bool initialiseParams(std::string const & data);
+ ///
+ virtual void clearParams();
+ ///
+ virtual void dispatchParams();
+ ///
+ virtual bool isBufferDependent() const { return true; }
+ ///
+ InsetBoxParams & params() { return *params_.get(); }
+ ///
+ InsetBoxParams const & params() const { return *params_.get(); }
+ ///
+private:
+ ///
+ boost::scoped_ptr<InsetBoxParams> params_;
+};
+
+///
+void box_gui_tokens(std::vector<std::string> &, std::vector<std::string> &);
+///
+void box_gui_tokens_special_length(std::vector<std::string> &,
+ std::vector<std::string> &);
+
+#endif // CONTROLBOX_H
ControlBibtex.h \
ControlButtons.C \
ControlButtons.h \
+ ControlBox.C \
+ ControlBox.h \
ControlBranch.C \
ControlBranch.h \
ControlCharacter.C \
+2003-10-07 Martin Vermeer <martin.vermeer@hut.fi>
+
+ * Dialogs.C:
+ * FormBox.C:
+ * FormBox.h:
+ * Makefile.am:
+ * forms/Makefile.am:
+ * forms/form_box.fd: The Box patch. Fancybox support, minipage,
+ parbox
+
2003-10-01 Angus Leeming <leeming@lyx.org>
* FormExternal.C (updateComboChange): changes due to the
#include "ControlAboutlyx.h"
#include "ControlBibtex.h"
+#include "ControlBox.h"
#include "ControlBranch.h"
#include "ControlChanges.h"
#include "ControlCitation.h"
#include "FormAboutlyx.h"
#include "FormBibitem.h"
#include "FormBibtex.h"
+#include "FormBox.h"
#include "FormBranch.h"
#include "FormChanges.h"
#include "FormCharacter.h"
}
-char const * const dialognames[] = { "aboutlyx", "bibitem", "bibtex", "branch", "changes",
+char const * const dialognames[] = {
+"aboutlyx", "bibitem", "bibtex", "branch", "box", "changes",
"character", "citation", "error", "errorlist" , "ert", "external", "file",
"float", "graphics", "include", "index", "label", "latexlog", "mathpanel",
"mathaccents", "matharrows", "mathoperators", "mathrelations", "mathgreek",
dialog->setController(new ControlNote(*dialog));
dialog->setView(new FormNote(*dialog));
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
+ } else if (name == "box") {
+ dialog->setController(new ControlBox(*dialog));
+ dialog->setView(new FormBox(*dialog));
+ dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
} else if (name == "branch") {
dialog->setController(new ControlBranch(*dialog));
dialog->setView(new FormBranch(*dialog));
--- /dev/null
+/**
+ * \file FormBox.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Jürgen Vigna (Minipage stuff)
+ * \author Martin Vermeer
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "FormBox.h"
+#include "ControlBox.h"
+#include "forms/form_box.h"
+#include "controllers/ButtonPolicies.h"
+#include "controllers/helper_funcs.h"
+#include "support/lstrings.h"
+#include "support/tostr.h"
+
+#include "Tooltips.h"
+#include "xforms_helpers.h"
+#include "xformsBC.h"
+
+#include "insets/insetbox.h"
+
+#include "lyx_forms.h"
+#include "debug.h"
+
+#include <vector>
+
+using lyx::support::getStringFromVector;
+using lyx::support::isStrDbl;
+using lyx::support::subst;
+using std::string;
+
+
+typedef FormController<ControlBox, FormView<FD_box> > base_class;
+
+FormBox::FormBox(Dialog & parent)
+ : base_class(parent, _("Box"))
+{}
+
+
+void FormBox::build()
+{
+ dialog_.reset(build_box(this));
+
+ box_gui_tokens(ids_, gui_names_);
+
+ for (unsigned int i = 0; i < gui_names_.size(); ++i) {
+ fl_addto_choice(dialog_->choice_type, gui_names_[i].c_str());
+ }
+
+ string str = _("Frameless: No border\n"
+ "Boxed: Rectangular\n"
+ "ovalbox: Oval, thin border\n"
+ "Ovalbox: Oval, thick border\n"
+ "Shadowbox: Box casting shadow\n"
+ "Doublebox: Double line border");
+ tooltips().init(dialog_->choice_type, str);
+
+ bcview().addReadOnly(dialog_->check_inner_box);
+
+ str = _("The inner box may be a parbox or a minipage,\n"
+ "with appropriate arguments from this dialog.");
+ tooltips().init(dialog_->check_inner_box, str);
+
+ bcview().addReadOnly(dialog_->radio_parbox);
+ bcview().addReadOnly(dialog_->radio_minipage);
+
+ bcview().addReadOnly(dialog_->choice_pos);
+ fl_addto_choice(dialog_->choice_pos, _("top").c_str());
+ fl_addto_choice(dialog_->choice_pos, _("middle").c_str());
+ fl_addto_choice(dialog_->choice_pos, _("bottom").c_str());
+
+ bcview().addReadOnly(dialog_->choice_inner_pos);
+ fl_addto_choice(dialog_->choice_inner_pos, _("top").c_str());
+ fl_addto_choice(dialog_->choice_inner_pos, _("middle").c_str());
+ fl_addto_choice(dialog_->choice_inner_pos, _("bottom").c_str());
+ fl_addto_choice(dialog_->choice_inner_pos, _("stretch").c_str());
+
+ bcview().addReadOnly(dialog_->choice_hor_pos);
+ fl_addto_choice(dialog_->choice_hor_pos, _("left").c_str());
+ fl_addto_choice(dialog_->choice_hor_pos, _("center").c_str());
+ fl_addto_choice(dialog_->choice_hor_pos, _("right").c_str());
+ fl_addto_choice(dialog_->choice_hor_pos, _("stretch").c_str());
+
+ bcview().addReadOnly(dialog_->input_width);
+ bcview().addReadOnly(dialog_->choice_width_unit);
+ bcview().addReadOnly(dialog_->choice_special);
+
+ box_gui_tokens_special_length(ids_spec_, gui_names_spec_);
+ for (unsigned int i = 0; i < gui_names_spec_.size(); ++i) {
+ fl_addto_choice(dialog_->choice_special, gui_names_spec_[i].c_str());
+ }
+
+ string choice = getStringFromVector(getLatexUnits(), "|");
+ fl_addto_choice(dialog_->choice_width_unit,
+ subst(choice, "%", "%%").c_str());
+
+ bcview().addReadOnly(dialog_->input_height);
+ bcview().addReadOnly(dialog_->choice_height_unit);
+ bcview().addReadOnly(dialog_->choice_height_special);
+ for (unsigned int i = 0; i < gui_names_spec_.size(); ++i) {
+ fl_addto_choice(dialog_->choice_height_special,
+ gui_names_spec_[i].c_str());
+ }
+
+ choice = getStringFromVector(getLatexUnits(), "|");
+ fl_addto_choice(dialog_->choice_height_unit,
+ subst(choice, "%", "%%").c_str());
+
+ bcview().setOK(dialog_->button_ok);
+ bcview().setApply(dialog_->button_apply);
+ bcview().setCancel(dialog_->button_cancel);
+}
+
+
+void FormBox::update()
+{
+ string type(controller().params().type);
+ for (unsigned int i = 0; i < gui_names_.size(); ++i) {
+ if (type == ids_[i])
+ fl_set_choice_text(dialog_->choice_type, gui_names_[i].c_str());
+ }
+
+ fl_set_button(dialog_->check_inner_box, controller().params().inner_box);
+ if (controller().params().type == "Frameless")
+ setEnabled(dialog_->check_inner_box, false);
+
+ char c = controller().params().pos;
+ fl_set_choice(dialog_->choice_pos, string("tcb").find(c, 0) + 1);
+ c = controller().params().inner_pos;
+ fl_set_choice(dialog_->choice_inner_pos, string("tcbs").find(c, 0) + 1);
+ c = controller().params().hor_pos;
+ fl_set_choice(dialog_->choice_hor_pos, string("lcrs").find(c, 0) + 1);
+ setEnabled(dialog_->choice_pos, controller().params().inner_box);
+ setEnabled(dialog_->choice_inner_pos, controller().params().inner_box);
+ setEnabled(dialog_->choice_hor_pos, !controller().params().inner_box);
+
+ fl_set_button(dialog_->radio_parbox, controller().params().use_parbox);
+ fl_set_button(dialog_->radio_minipage, !controller().params().use_parbox);
+ setEnabled(dialog_->radio_parbox, controller().params().inner_box);
+ setEnabled(dialog_->radio_minipage, controller().params().inner_box);
+
+ LyXLength len(controller().params().width);
+ fl_set_input(dialog_->input_width, tostr(len.value()).c_str());
+ fl_set_choice(dialog_->choice_width_unit, len.unit() + 1);
+ string special(controller().params().special);
+ for (unsigned int i = 0; i < gui_names_spec_.size(); ++i) {
+ if (special == ids_spec_[i])
+ fl_set_choice_text(dialog_->choice_special,
+ gui_names_spec_[i].c_str());
+ }
+ // Special width unit must be default for general units to be enabled
+ if(controller().params().special != "none")
+ setEnabled(dialog_->choice_width_unit, false);
+ setEnabled(dialog_->choice_special, !controller().params().inner_box);
+
+ LyXLength ht(controller().params().height);
+ fl_set_input(dialog_->input_height, tostr(ht.value()).c_str());
+ fl_set_choice(dialog_->choice_height_unit, ht.unit() + 1);
+ string const height_special(controller().params().height_special);
+ for (unsigned int i = 0; i < gui_names_spec_.size(); ++i) {
+ if (height_special == ids_spec_[i])
+ fl_set_choice_text(dialog_->choice_height_special,
+ gui_names_spec_[i].c_str());
+ }
+ setEnabled(dialog_->input_height, controller().params().inner_box);
+ setEnabled(dialog_->choice_height_unit, controller().params().inner_box);
+ setEnabled(dialog_->choice_height_special, controller().params().inner_box);
+ // Same here
+ if(height_special != "none")
+ setEnabled(dialog_->choice_height_unit, false);
+}
+
+
+void FormBox::apply()
+{
+ int i = fl_get_choice(dialog_->choice_type);
+ controller().params().type = ids_[i - 1];
+
+ controller().params().inner_box = fl_get_button(dialog_->check_inner_box);
+ controller().params().use_parbox =
+ fl_get_button(dialog_->radio_parbox);
+ controller().params().width =
+ LyXLength(getLengthFromWidgets(dialog_->input_width,
+ dialog_->choice_width_unit));
+
+ controller().params().pos =
+ "tcb"[fl_get_choice(dialog_->choice_pos) - 1];
+ controller().params().inner_pos =
+ "tcbs"[fl_get_choice(dialog_->choice_inner_pos) - 1];
+ controller().params().hor_pos =
+ "lcrs"[fl_get_choice(dialog_->choice_hor_pos) - 1];
+
+ i = fl_get_choice(dialog_->choice_special);
+ controller().params().special = ids_spec_[i - 1];
+
+ controller().params().height =
+ LyXLength(getLengthFromWidgets(dialog_->input_height,
+ dialog_->choice_height_unit));
+ i = fl_get_choice(dialog_->choice_height_special);
+ controller().params().height_special = ids_spec_[i - 1];
+}
+
+ButtonPolicy::SMInput FormBox::input(FL_OBJECT * ob, long)
+{
+ if (ob == dialog_->check_inner_box) {
+ setEnabled(dialog_->choice_pos,
+ fl_get_button(dialog_->check_inner_box));
+ setEnabled(dialog_->radio_parbox,
+ fl_get_button(dialog_->check_inner_box));
+ setEnabled(dialog_->radio_minipage,
+ fl_get_button(dialog_->check_inner_box));
+ setEnabled(dialog_->choice_width_unit, true);
+ setEnabled(dialog_->choice_special,
+ !fl_get_button(dialog_->check_inner_box));
+ setEnabled(dialog_->input_height,
+ fl_get_button(dialog_->check_inner_box));
+ setEnabled(dialog_->choice_height_unit,
+ fl_get_button(dialog_->check_inner_box));
+ setEnabled(dialog_->choice_height_special,
+ fl_get_button(dialog_->check_inner_box));
+ setEnabled(dialog_->choice_hor_pos,
+ !fl_get_button(dialog_->check_inner_box));
+ setEnabled(dialog_->choice_inner_pos,
+ fl_get_button(dialog_->check_inner_box));
+
+ // Reset to defaults to not confuse users:
+ if (fl_get_button(dialog_->check_inner_box))
+ fl_set_choice(dialog_->choice_special, NONE);
+ else
+ fl_set_choice(dialog_->choice_height_special, NONE);
+ }
+
+ if (ob == dialog_->choice_special || ob == dialog_->check_inner_box)
+ setEnabled(dialog_->choice_width_unit,
+ fl_get_choice(dialog_->choice_special) == NONE);
+ if (ob == dialog_->choice_height_special || ob == dialog_->check_inner_box)
+ if (fl_get_choice(dialog_->choice_height_special) != NONE)
+ setEnabled(dialog_->choice_height_unit, false);
+ else
+ setEnabled(dialog_->choice_height_unit,
+ fl_get_button(dialog_->check_inner_box));
+
+ // An inner box (parbox, minipage) is mandatory if no outer box
+ if (ob == dialog_->choice_type) {
+ int i = fl_get_choice(dialog_->choice_type);
+ if (ids_[i - 1] == "Frameless") {
+ setEnabled(dialog_->check_inner_box, false);
+ fl_set_button(dialog_->check_inner_box, true);
+ } else {
+ setEnabled(dialog_->check_inner_box, true);
+ }
+ }
+ // disallow senseless data, warnings if input is senseless
+ if (ob == dialog_->input_width) {
+ string const input = getString(dialog_->input_width);
+ bool const invalid = !isValidLength(input) && !isStrDbl(input);
+ if (invalid) {
+ postWarning(_("Invalid Length!"));
+ return ButtonPolicy::SMI_INVALID;
+ }
+ }
+ if (ob == dialog_->input_height) {
+ string const input = getString(dialog_->input_height);
+ bool const invalid = !isValidLength(input) && !isStrDbl(input);
+ if (invalid) {
+ postWarning(_("Invalid Length!"));
+ return ButtonPolicy::SMI_INVALID;
+ }
+ }
+ if (ob == dialog_->button_defaults) {
+ fl_set_button(dialog_->check_inner_box, true);
+ fl_set_button(dialog_->radio_parbox, false);
+ fl_set_input(dialog_->input_width, "100");
+ fl_set_choice(dialog_->choice_width_unit, LyXLength::PCW + 1);
+ fl_set_choice(dialog_->choice_special, NONE);
+ fl_set_input(dialog_->input_height, "1");
+ fl_set_choice(dialog_->choice_height_special, TOTALHEIGHT);
+ }
+
+ return ButtonPolicy::SMI_VALID;
+}
+
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file FormBox.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Martin Vermeer
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef FORMBOX_H
+#define FORMBOX_H
+
+
+#include "FormDialogView.h"
+
+
+class ControlBox;
+struct FD_box;
+
+/** This class provides an XForms implementation of the Box Dialog.
+ */
+class FormBox : public FormController<ControlBox, FormView<FD_box> > {
+public:
+ /// Constructor
+ FormBox(Dialog &);
+private:
+ ///
+ virtual void apply();
+ /// Build the dialog
+ virtual void build();
+ /// Update dialog before showing it
+ virtual void update();
+ ///
+ virtual ButtonPolicy::SMInput input( FL_OBJECT *, long);
+ ///
+ std::vector<std::string> ids_;
+ ///
+ std::vector<std::string> gui_names_;
+ ///
+ std::vector<std::string> ids_spec_;
+ ///
+ std::vector<std::string> gui_names_spec_;
+ ///
+ enum Specials {
+ NONE = 1,
+ HEIGHT,
+ DEPTH,
+ TOTALHEIGHT,
+ WIDTH
+ };
+};
+
+#endif // FORMBOX_H
FormBibitem.h \
FormBibtex.C \
FormBibtex.h \
+ FormBox.C \
+ FormBox.h \
FormBrowser.C \
FormBrowser.h \
FormBranch.C \
SRCS = form_aboutlyx.fd \
form_bibitem.fd \
form_bibtex.fd \
+ form_box.fd \
form_browser.fd \
form_branch.fd \
form_changes.fd \
--- /dev/null
+Magic: 13000
+
+Internal Form Definition File
+ (do not change)
+
+Number of forms: 1
+Unit of measure: FL_COORD_PIXEL
+SnapGrid: 7
+
+=============== FORM ===============
+Name: form_box
+Width: 442
+Height: 379
+Number of Objects: 19
+
+--------------------
+class: FL_BOX
+type: UP_BOX
+box: 0 0 442 379
+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:
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name:
+callback:
+argument:
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 175 21 231 28
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Box Type|#T
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_type
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: RETURN_BUTTON
+box: 56 322 84 28
+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_FormDialogView_OKCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: RETURN_BUTTON
+box: 147 322 98 28
+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: ^M
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_apply
+callback: C_FormDialogView_ApplyCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: RETURN_BUTTON
+box: 252 322 105 28
+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: ^M
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_cancel
+callback: C_FormDialogView_CancelCB
+argument: 0
+
+--------------------
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 21 70 35 28
+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: Has Inner Box
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: check_inner_box
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE2
+box: 315 77 91 28
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Vertical Position
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_pos
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE2
+box: 203 210 91 28
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_TOP
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Width Unit
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_width_unit
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 126 210 77 28
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_TOP
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Width
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_width
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE2
+box: 294 210 112 28
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_TOP
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Special
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_special
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_ROUND3DBUTTON
+type: RADIO_BUTTON
+box: 21 112 35 28
+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: Parbox
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: radio_parbox
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_ROUND3DBUTTON
+type: RADIO_BUTTON
+box: 21 140 35 28
+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: Minipage
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: radio_minipage
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_FRAME
+type: ENGRAVED_FRAME
+box: 14 112 112 63
+boxtype: FL_NO_BOX
+colors: FL_BLACK 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_CHOICE
+type: NORMAL_CHOICE2
+box: 315 112 91 28
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Inner Position (Vert.)
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_inner_pos
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE2
+box: 315 147 91 28
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Horizontal Position
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_hor_pos
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 126 266 77 28
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_TOP
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Height
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_height
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE2
+box: 203 266 91 28
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_TOP
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Height Unit
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_height_unit
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE2
+box: 294 266 112 28
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_TOP
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Special
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: choice_height_special
+callback: C_FormDialogView_InputCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 28 238 77 28
+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: Reset
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_defaults
+callback: C_FormDialogView_InputCB
+argument: 0
+
+==============================
+create_the_forms
+2003-10-07 Martin Vermeer <martin.vermeer@hut.fi>
+
+ * Makefile.am:
+ * inset.h:
+ * insetbox.C:
+ * insetbox.h: The Box patch. Fancybox support, minipage, parbox
+
2003-10-02 André Pönitz <poenitz@gmx.net>
* insettext.C (read): make sure there is at least one par
insetbibitem.h \
insetbibtex.C \
insetbibtex.h \
+ insetbox.C \
+ insetbox.h \
insetbranch.C \
insetbranch.h \
insetcaption.C \
///
NEWLINE_CODE,
///
- BRANCH_CODE
+ BRANCH_CODE,
+ ///
+ BOX_CODE
};
///
--- /dev/null
+/**
+ * \file insetbox.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Angus Leeming
+ * \author Martin Vermeer
+ * \author Jürgen Spitzmüller
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "insetbox.h"
+#include "debug.h"
+
+#include "BufferView.h"
+#include "funcrequest.h"
+#include "gettext.h"
+#include "LaTeXFeatures.h"
+#include "LColor.h"
+#include "lyxlex.h"
+#include "metricsinfo.h"
+#include "paragraph.h"
+
+#include "support/std_sstream.h"
+
+using std::auto_ptr;
+using std::string;
+using std::istringstream;
+using std::ostream;
+using std::ostringstream;
+using std::endl;
+
+
+namespace {
+
+BoxTranslator const init_boxtranslator() {
+ BoxTranslator translator("Boxed", InsetBox::Boxed);
+ translator.addPair("Frameless", InsetBox::Frameless);
+ translator.addPair("ovalbox", InsetBox::ovalbox);
+ translator.addPair("Ovalbox", InsetBox::Ovalbox);
+ translator.addPair("Shadowbox", InsetBox::Shadowbox);
+ translator.addPair("Doublebox",InsetBox::Doublebox);
+ return translator;
+}
+
+
+BoxTranslator const init_boxtranslator_loc() {
+ BoxTranslator translator(_("Boxed"), InsetBox::Boxed);
+ translator.addPair(_("Frameless"), InsetBox::Frameless);
+ translator.addPair(_("ovalbox"), InsetBox::ovalbox);
+ translator.addPair(_("Ovalbox"), InsetBox::Ovalbox);
+ translator.addPair(_("Shadowbox"), InsetBox::Shadowbox);
+ translator.addPair(_("Doublebox"), InsetBox::Doublebox);
+ return translator;
+}
+
+
+BoxTranslator const & boxtranslator() {
+ static BoxTranslator translator = init_boxtranslator();
+ return translator;
+}
+
+
+BoxTranslator const & boxtranslator_loc() {
+ static BoxTranslator translator = init_boxtranslator_loc();
+ return translator;
+}
+
+} // anon
+
+
+void InsetBox::init()
+{
+ setInsetName("Box");
+ setButtonLabel();
+}
+
+
+InsetBox::InsetBox(BufferParams const & bp, string const & label)
+ : InsetCollapsable(bp), params_(label)
+{
+ init();
+}
+
+
+InsetBox::InsetBox(InsetBox const & in)
+ : InsetCollapsable(in), params_(in.params_)
+{
+ init();
+}
+
+
+InsetBox::~InsetBox()
+{
+ InsetBoxMailer mailer(*this);
+ mailer.hideDialog();
+}
+
+
+auto_ptr<InsetBase> InsetBox::clone() const
+{
+ return auto_ptr<InsetBase>(new InsetBox(*this));
+}
+
+
+string const InsetBox::editMessage() const
+{
+ return _("Opened Box Inset");
+}
+
+
+void InsetBox::write(Buffer const & buf, ostream & os) const
+{
+ params_.write(os);
+ InsetCollapsable::write(buf, os);
+}
+
+
+void InsetBox::read(Buffer const & buf, LyXLex & lex)
+{
+ params_.read(lex);
+ InsetCollapsable::read(buf, lex);
+ setButtonLabel();
+}
+
+
+void InsetBox::setButtonLabel()
+{
+ LyXFont font(LyXFont::ALL_SANE);
+ font.decSize();
+ font.decSize();
+
+ BoxType btype = boxtranslator().find(params_.type);
+ if (btype == Frameless) {
+ if (params_.use_parbox)
+ setLabel(_("Parbox"));
+ else
+ setLabel(_("Minipage"));
+ } else
+ setLabel(boxtranslator_loc().find(btype));
+
+ font.setColor(LColor::foreground);
+ setBackgroundColor(LColor::background);
+ setLabelFont(font);
+}
+
+
+void InsetBox::metrics(MetricsInfo & mi, Dimension & dim) const
+{
+ InsetCollapsable::metrics(mi, dim);
+ if (params_.inner_box && isOpen())
+ dim.wid = mi.base.textwidth;
+ dim_ = dim;
+}
+
+
+bool InsetBox::showInsetDialog(BufferView * bv) const
+{
+ InsetBoxMailer(const_cast<InsetBox &>(*this)).showDialog(bv);
+ return true;
+}
+
+
+dispatch_result InsetBox::localDispatch(FuncRequest const & cmd)
+{
+ BufferView * bv = cmd.view();
+
+ switch (cmd.action) {
+
+ case LFUN_INSET_MODIFY: {
+ InsetBoxMailer::string2params(cmd.argument, params_);
+ setButtonLabel();
+ bv->updateInset(this);
+ return DISPATCHED;
+ }
+ case LFUN_INSET_DIALOG_UPDATE:
+ InsetBoxMailer(*this).updateDialog(bv);
+ return DISPATCHED;
+
+ case LFUN_MOUSE_RELEASE:
+ if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
+ InsetBoxMailer(*this).showDialog(bv);
+ return DISPATCHED;
+ }
+ // fallthrough:
+
+ default:
+ return InsetCollapsable::localDispatch(cmd);
+ }
+}
+
+
+int InsetBox::latex(Buffer const & buf, ostream & os,
+ LatexRunParams const & runparams) const
+{
+ BoxType btype = boxtranslator().find(params_.type);
+
+ string width_string = params_.width.asLatexString();
+ bool stdwidth(false);
+ if (params_.inner_box &&
+ (width_string.find("1.0\\columnwidth") != string::npos
+ || width_string.find("1.0\\textwidth") != string::npos)) {
+ stdwidth = true;
+ switch (btype) {
+ case Frameless:
+ break;
+ case Boxed:
+ width_string += " - 2\\fboxsep - 2\\fboxrule";
+ break;
+ case ovalbox:
+ width_string += " - 2\\fboxsep - 0.8pt";
+ break;
+ case Ovalbox:
+ width_string += " - 2\\fboxsep - 1.6pt";
+ break;
+ case Shadowbox:
+ // Shadow falls outside right margin... opinions?
+ width_string += " - 2\\fboxsep - 2\\fboxrule"/* "-\\shadowsize"*/;
+ break;
+ case Doublebox:
+ width_string += " - 2\\fboxsep - 7.5\\fboxrule - 1.0pt";
+ break;
+ }
+ }
+
+ int i = 0;
+ os << "%\n";
+ // Adapt to column/text width correctly also if paragraphs indented:
+ if (stdwidth)
+ os << "\\noindent";
+
+ switch (btype) {
+ case Frameless:
+ break;
+ case Boxed:
+ os << "\\framebox";
+ if (!params_.inner_box) {
+ os << "{\\makebox";
+ // Special widths, see usrguide §3.5
+ if (params_.special != "none") {
+ os << "[" << params_.width.value()
+ << "\\" << params_.special << "]";
+ } else
+ os << "[" << width_string << "]";
+ if (params_.hor_pos != 'c')
+ os << "[" << params_.hor_pos << "]";
+ }
+
+ os << "{";
+ break;
+ case ovalbox:
+ os << "\\ovalbox{";
+ break;
+ case Ovalbox:
+ os << "\\Ovalbox{";
+ break;
+ case Shadowbox:
+ os << "\\shadowbox{";
+ break;
+ case Doublebox:
+ os << "\\doublebox{";
+ break;
+ }
+
+ if (params_.inner_box) {
+ if (params_.use_parbox)
+ os << "\\parbox";
+ else
+ os << "\\begin{minipage}";
+
+ os << "[" << params_.pos << "]";
+ if (params_.height_special == "none") {
+ os << "[" << params_.height.asLatexString() << "]";
+ } else {
+ // Special heights
+ os << "[" << params_.height.value()
+ << "\\" << params_.height_special << "]";
+ }
+ if (params_.inner_pos != params_.pos)
+ os << "[" << params_.inner_pos << "]";
+
+ os << "{" << width_string << "}";
+
+ if (params_.use_parbox)
+ os << "{";
+ os << "%\n";
+ i += 1;
+ }
+
+ i += inset.latex(buf, os, runparams);
+
+ if (params_.inner_box) {
+ if (params_.use_parbox)
+ os << "%\n}";
+ else
+ os << "%\n\\end{minipage}";
+ }
+
+ switch (btype) {
+ case Frameless:
+ break;
+ case Boxed:
+ if (!params_.inner_box)
+ os << "}"; // for makebox
+ os << "}";
+ break;
+ case ovalbox:
+ case Ovalbox:
+ case Doublebox:
+ case Shadowbox:
+ os << "}";
+ break;
+ }
+ os << "%\n";
+
+ i += 3;
+
+ return i;
+}
+
+
+int InsetBox::linuxdoc(Buffer const & buf, std::ostream & os) const
+{
+ return inset.linuxdoc(buf, os);
+}
+
+
+int InsetBox::docbook(Buffer const & buf, std::ostream & os, bool mixcont) const
+{
+ return inset.docbook(buf, os, mixcont);
+}
+
+
+int InsetBox::ascii(Buffer const & buf, std::ostream & os, int ll) const
+{
+ int i = 0;
+ string const pt = params_.type;
+ BoxType btype = boxtranslator().find(params_.type);
+ switch (btype) {
+ case Frameless:
+ break;
+ case Boxed:
+ os << "[";
+ break;
+ case ovalbox:
+ os << "(";
+ break;
+ case Ovalbox:
+ os << "((";
+ break;
+ case Shadowbox:
+ os << "[";
+ break;
+ case Doublebox:
+ os << "[[";
+ break;
+ }
+
+ i = inset.ascii(buf, os, ll);
+
+ switch (btype) {
+ case Frameless:
+ break;
+ case Boxed:
+ os << "]";
+ break;
+ case ovalbox:
+ os << ")";
+ break;
+ case Ovalbox:
+ os << "))";
+ break;
+ case Shadowbox:
+ os << "]/";
+ break;
+ case Doublebox:
+ os << "]]";
+ break;
+ }
+
+ return i;
+}
+
+
+void InsetBox::validate(LaTeXFeatures & features) const
+{
+ features.require("calc");
+ BoxType btype = boxtranslator().find(params_.type);
+ switch (btype) {
+ case Frameless:
+ case Boxed:
+ break;
+ case ovalbox:
+ case Ovalbox:
+ case Shadowbox:
+ case Doublebox:
+ features.require("fancybox");
+ break;
+ }
+ inset.validate(features);
+}
+
+
+InsetBoxMailer::InsetBoxMailer(InsetBox & inset)
+ : inset_(inset)
+{
+}
+
+
+string const InsetBoxMailer::name_ = "box";
+
+
+string const InsetBoxMailer::inset2string(Buffer const &) const
+{
+ return params2string(inset_.params());
+}
+
+
+string const InsetBoxMailer::params2string(InsetBoxParams const & params)
+{
+ ostringstream data;
+ data << "box" << ' ';
+ params.write(data);
+ return data.str();
+}
+
+
+void InsetBoxMailer::string2params(string const & in,
+ InsetBoxParams & params)
+{
+ params = InsetBoxParams(string());
+
+ if (in.empty())
+ return;
+
+ istringstream data(in);
+ LyXLex lex(0,0);
+ lex.setStream(data);
+
+ string token;
+ lex.next();
+ token = lex.getString();
+ lex.next();
+
+ params.read(lex);
+}
+
+
+InsetBoxParams::InsetBoxParams(string const & label)
+ : type(label),
+ use_parbox(false),
+ inner_box(true),
+ width(LyXLength("100col%")),
+ special("none"),
+ pos('t'),
+ hor_pos('c'),
+ inner_pos('t'),
+ height(LyXLength("1in")),
+ height_special("totalheight") // default is 1\\totalheight
+{}
+
+
+void InsetBoxParams::write(ostream & os) const
+{
+ os << type << "\n";
+ os << "position \"" << pos << "\"\n";
+ os << "hor_pos \"" << hor_pos << "\"\n";
+ os << "has_inner_box " << inner_box << "\n";
+ os << "inner_pos \"" << inner_pos << "\"\n";
+ os << "use_parbox " << use_parbox << "\n";
+ os << "width \"" << width.asString() << "\"\n";
+ os << "special \"" << special << "\"\n";
+ os << "height \"" << height.asString() << "\"\n";
+ os << "height_special \"" << height_special << "\"\n";
+}
+
+
+void InsetBoxParams::read(LyXLex & lex)
+{
+ if (lex.isOK()) {
+ type = lex.getString();
+ }
+ string token;
+ if (!lex.isOK())
+ return;
+ lex.next();
+ token = lex.getString();
+ if (token == "position") {
+ lex.next();
+ // The [0] is needed. We need the first and only char in
+ // this string -- MV
+ pos = lex.getString()[0];
+ } else {
+ lyxerr << "InsetBox::Read: Missing 'position'-tag!" << token << endl;
+ lex.pushToken(token);
+ }
+ if (!lex.isOK())
+ return;
+ lex.next();
+ token = lex.getString();
+ if (token == "hor_pos") {
+ lex.next();
+ hor_pos = lex.getString()[0];
+ } else {
+ lyxerr << "InsetBox::Read: Missing 'hor_pos'-tag!" << token << endl;
+ lex.pushToken(token);
+ }
+ if (!lex.isOK())
+ return;
+ lex.next();
+ token = lex.getString();
+ if (token == "has_inner_box") {
+ lex.next();
+ inner_box = lex.getInteger();
+ } else {
+ lyxerr << "InsetBox::Read: Missing 'has_inner_box'-tag!" << endl;
+ lex.pushToken(token);
+ }
+
+ if (!lex.isOK())
+ return;
+ lex.next();
+ token = lex.getString();
+ if (token == "inner_pos") {
+ lex.next();
+ inner_pos = lex.getString()[0];
+ } else {
+ lyxerr << "InsetBox::Read: Missing 'inner_pos'-tag!"
+ << token << endl;
+ lex.pushToken(token);
+ }
+ if (!lex.isOK())
+ return;
+ lex.next();
+ token = lex.getString();
+ if (token == "use_parbox") {
+ lex.next();
+ use_parbox = lex.getInteger();
+ } else {
+ lyxerr << "InsetBox::Read: Missing 'use_parbox'-tag!" << endl;
+ lex.pushToken(token);
+ }
+ if (!lex.isOK())
+ return;
+ lex.next();
+ token = lex.getString();
+ if (token == "width") {
+ lex.next();
+ width = LyXLength(lex.getString());
+ } else {
+ lyxerr << "InsetBox::Read: Missing 'width'-tag!" << endl;
+ lex.pushToken(token);
+ }
+ if (!lex.isOK())
+ return;
+ lex.next();
+ token = lex.getString();
+ if (token == "special") {
+ lex.next();
+ special = lex.getString();
+ } else {
+ lyxerr << "InsetBox::Read: Missing 'special'-tag!" << endl;
+ lex.pushToken(token);
+ }
+ if (!lex.isOK())
+ return;
+ lex.next();
+ token = lex.getString();
+ if (token == "height") {
+ lex.next();
+ height = LyXLength(lex.getString());
+ } else {
+ lyxerr << "InsetBox::Read: Missing 'height'-tag!" << endl;
+ lex.pushToken(token);
+ }
+ if (!lex.isOK())
+ return;
+ lex.next();
+ token = lex.getString();
+ if (token == "height_special") {
+ lex.next();
+ height_special = lex.getString();
+ } else {
+ lyxerr << "InsetBox::Read: Missing 'height_special'-tag!" << endl;
+ lex.pushToken(token);
+ }
+}
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file insetbox.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Angus Leeming
+ * \author Martin Vermeer
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef INSETBOX_H
+#define INSETBOX_H
+
+
+#include "insetcollapsable.h"
+#include "lyxlength.h"
+#include "support/translator.h"
+
+
+struct InsetBoxParams {
+ ///
+ InsetBoxParams(std::string const &);
+ ///
+ void write(std::ostream & os) const;
+ ///
+ void read(LyXLex & lex);
+ ///
+ std::string type;
+ /// Use a parbox (true) or minipage (false)
+ bool use_parbox;
+ /// Do we have an inner parbox or minipage to format paragraphs to
+ /// columnwidth?
+ bool inner_box;
+ ///
+ LyXLength width;
+ /// "special" widths, see usrguide.dvi §3.5
+ std::string special;
+ ///
+ char pos;
+ ///
+ char hor_pos;
+ ///
+ char inner_pos;
+ ///
+ LyXLength height;
+ ///
+ std::string height_special;
+};
+
+
+/** The fbox/fancybox inset
+
+*/
+class InsetBox : public InsetCollapsable {
+public:
+ ///
+ InsetBox(BufferParams const &, std::string const &);
+ /// Copy constructor
+ InsetBox(InsetBox const &);
+ ///
+ ~InsetBox();
+ ///
+ virtual std::auto_ptr<InsetBase> clone() const;
+ ///
+ std::string const editMessage() const;
+ ///
+ InsetOld::Code lyxCode() const { return InsetOld::BOX_CODE; }
+ ///
+ void write(Buffer const &, std::ostream &) const;
+ ///
+ void read(Buffer const & buf, LyXLex & lex);
+ ///
+ void setButtonLabel();
+ ///
+ dispatch_result InsetBox::localDispatch(FuncRequest const &);
+ ///
+ void metrics(MetricsInfo &, Dimension &) const;
+ /// show the Box dialog
+ bool showInsetDialog(BufferView * bv) const;
+ ///
+ int latex(Buffer const &, std::ostream &,
+ LatexRunParams const &) const;
+ ///
+ int linuxdoc(Buffer const &, std::ostream &) const;
+ ///
+ int docbook(Buffer const &, std::ostream &, bool) const;
+ ///
+ int ascii(Buffer const &, std::ostream &, int) const;
+ ///
+ void validate(LaTeXFeatures &) const;
+ ///
+ InsetBoxParams const & params() const { return params_; }
+ ///
+ enum BoxType {
+ Frameless,
+ Boxed,
+ ovalbox,
+ Ovalbox,
+ Shadowbox,
+ Doublebox
+ };
+
+private:
+ friend class InsetBoxParams;
+
+ /// used by the constructors
+ void init();
+ ///
+ InsetBoxParams params_;
+};
+
+
+namespace {
+
+typedef Translator<std::string, InsetBox::BoxType> BoxTranslator;
+BoxTranslator const & boxtranslator();
+BoxTranslator const & boxtranslator_loc();
+
+} // anon
+
+
+#include "mailinset.h"
+
+class InsetBoxMailer : public MailInset {
+public:
+ ///
+ InsetBoxMailer(InsetBox & inset);
+ ///
+ virtual InsetBase & inset() const { return inset_; }
+ ///
+ virtual std::string const & name() const { return name_; }
+ ///
+ virtual std::string const inset2string(Buffer const &) const;
+ ///
+ static std::string const params2string(InsetBoxParams const &);
+ ///
+ static void string2params(std::string const &, InsetBoxParams &);
+
+private:
+ ///
+ static std::string const name_;
+ ///
+ InsetBox & inset_;
+};
+
+#endif // INSET_BOX_H
// 245
LFUN_INSERT_BRANCH,
LFUN_INSET_DIALOG_SHOW,
+ LFUN_INSERT_BOX,
LFUN_LASTACTION // end of the table
};
case InsetOld::BRANCH_CODE:
disable = ev.argument != "branch";
break;
+ case InsetOld::BOX_CODE:
+ disable = ev.argument != "box";
+ break;
default:
break;
}
case LFUN_INSERT_NOTE:
code = InsetOld::NOTE_CODE;
break;
+ case LFUN_INSERT_BOX:
+ code = InsetOld::BOX_CODE;
+ break;
case LFUN_INSERT_BRANCH:
code = InsetOld::BRANCH_CODE;
if (buf->params().branchlist().empty())
case LFUN_INSET_CAPTION:
#endif
case LFUN_INSERT_NOTE:
+ case LFUN_INSERT_BOX:
case LFUN_INSERT_BRANCH:
case LFUN_INSERT_BIBITEM:
case LFUN_INSET_ERT: