+2003-03-12 Angus Leeming <leeming@lyx.org>
+
+ * images/font-free.xpm: renamed as font-free-apply.xpm.
+
+ * ui/default.ui: s/font-free/font-free-apply/
+
2003-03-12 Dekel Tsur <dekelts@tau.ac.il>
* lyx2lyx/lyx2lyx (main): Print error messages to stderr.
--- /dev/null
+/* XPM */
+static char const * free_xpm[] = {
+"20 20 2 1",
+" c None",
+". c #000000000000",
+" ",
+" ",
+" ",
+"...... . ",
+". . ",
+". ... . .. ...",
+". . . .. . . ",
+".... . . . . . ",
+". . . . . . ",
+". . . . . . ",
+". . . . . . ",
+". ... . . ..",
+" ",
+" ",
+" . ",
+" . ",
+" ..... ",
+" ... ",
+" . ",
+" "};
+
+
+++ /dev/null
-/* XPM */
-static char const * free_xpm[] = {
-"20 20 2 1",
-" c None",
-". c #000000000000",
-" ",
-" ",
-" ",
-"...... . ",
-". . ",
-". ... . .. ...",
-". . . .. . . ",
-".... . . . . . ",
-". . . . . . ",
-". . . . . . ",
-". . . . . . ",
-". ... . . ..",
-" ",
-" ",
-" . ",
-" . ",
-" ..... ",
-" ... ",
-" . ",
-" "};
-
-
End
Menu "insert_special"
- Item "Superscript|S" "command-sequence math-mode ; math-superscript ; font-free; "
- Item "Subscript|u" "command-sequence math-mode ; math-subscript ; font-free; "
+ Item "Superscript|S" "command-sequence math-mode ; math-superscript ; font-free-apply; "
+ Item "Subscript|u" "command-sequence math-mode ; math-subscript ; font-free-apply; "
Item "HFill|H" "hfill-insert"
Item "Hyphenation Point|P" "hyphenation-point-insert"
Item "Ligature Break|k" "ligature-break-insert"
Separator
Icon "font-emph"
Icon "font-noun"
- Icon "font-free"
+ Icon "font-free-apply"
Separator
Icon "ert-insert"
Icon "math-mode"
switchKeyMap();
break;
- case LFUN_DEPTH_MIN:
- changeDepth(bv_, bv_->getLyXText(), -1);
- break;
-
- case LFUN_DEPTH_PLUS:
- changeDepth(bv_, bv_->getLyXText(), 1);
- break;
-
- case LFUN_FREE:
- owner_->getDialogs().setUserFreeFont();
- break;
-
case LFUN_FILE_INSERT:
MenuInsertLyXFile(ev.argument);
break;
+2003-03-12 Angus Leeming <leeming@lyx.org>
+
+ * BufferView_pimpl.C (dispatch): remove LFUNs from switch as they
+ duplicate those in LyXFunc::dispatch.
+
+ * commandtags.h:
+ * LyXAction.C:
+ * ToolbarDefaults.C:
+ rename LFUN_FREE as LFUN_FONTFREE_APPLY.
+ Add LFUN_FONTFREE_UPDATE.
+
+ * lyxfunc.C (dispatch): code for LFUN_FREEFONT_APPLY,
+ LFUN_FREEFONT_UPDATE, LFUN_LAYOUT_CHARACTER.
+
+ * bufferview_func.[Ch]: several new functions to facilliate
+ transfer of data to and from the character dialog.
+
2003-03-12 John Levon <levon@movementarian.org>
* buffer.C:
{ LFUN_DEFAULT, "font-default", N_("Default font style"),
Noop },
{ LFUN_EMPH, "font-emph", N_("Toggle emphasize"), Noop },
- { LFUN_FREE, "font-free", N_("Toggle user defined style"),
- Noop },
+ { LFUN_FREEFONT_APPLY, "font-free-apply",
+ N_("Toggle user defined style"), Noop },
+ { LFUN_FREEFONT_UPDATE, "font-free-update", "", Noop },
{ LFUN_NOUN, "font-noun", N_("Toggle noun style"), Noop },
{ LFUN_ROMAN, "font-roman", N_("Toggle roman font style"),
Noop },
add(LFUN_EMPH);
add(LFUN_NOUN);
- add(LFUN_FREE);
+ add(LFUN_FREEFONT_APPLY);
add(SEPARATOR);
add(LFUN_INSET_FOOTNOTE);
-/* This file is part of
- * ======================================================
+/**
+ * \file bufferview_funcs.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * LyX, The Document Processor
+ * \author Lars Gullik Bjønnes
+ * \author Jean-Marc Lasgouttes
+ * \author John Levon
+ * \author Angus Leeming
*
- * Copyright 1995 Matthias Ettrich
- * Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS
+ */
#include <config.h>
#include "BufferView.h"
#include "paragraph.h"
#include "lyxfont.h"
+#include "lyxlex.h"
#include "lyxtext.h"
#include "buffer.h"
#include "lyx_cb.h"
#include "frontends/Alert.h"
#include "support/lstrings.h"
+#include "Lsstream.h"
#include "insets/updatableinset.h"
#include "BoostFormat.h"
+namespace {
+LyXFont freefont(LyXFont::ALL_IGNORE);
+bool toggleall(false);
+}
+
+
+// Set data using font and toggle
+// If successful, returns true
+bool font2string(LyXFont const & font, bool toggle, string & data)
+{
+ string lang = "ignore";
+ if (font.language())
+ lang = font.language()->lang();
+
+ ostringstream os;
+ os << "family " << font.family() << '\n'
+ << "series " << font.series() << '\n'
+ << "shape " << font.shape() << '\n'
+ << "size " << font.size() << '\n'
+ << "emph " << font.emph() << '\n'
+ << "underbar " << font.underbar() << '\n'
+ << "noun " << font.noun() << '\n'
+ << "number " << font.number() << '\n'
+ << "color " << font.color() << '\n'
+ << "language " << lang << '\n'
+ << "toggleall " << tostr(toggle);
+ data = os.str();
+ return true;
+}
+
+
+// Set font and toggle using data
+// If successful, returns true
+bool string2font(string const & data, LyXFont & font, bool & toggle)
+{
+ istringstream is(data);
+ LyXLex lex(0,0);
+ lex.setStream(is);
+
+ int Int = 0;
+ bool Bool = false;
+ string String;
+
+ int nset = 0;
+ while (lex.isOK()) {
+ lex.next();
+ string const token = lex.getString();
+
+ if (token == "family" ||
+ token == "series" ||
+ token == "shape" ||
+ token == "size" ||
+ token == "emph" ||
+ token == "underbar" ||
+ token == "noun" ||
+ token == "number" ||
+ token == "color") {
+ lex.next();
+ Int = lex.getInteger();
+ } else if (token == "language") {
+ lex.next();
+ String = lex.getString();
+ } else if (token == "toggleall") {
+ lex.next();
+ Bool = lex.getBool();
+ } else {
+ // Unrecognised token
+ break;
+ }
+
+ if (!lex.isOK())
+ break;
+ ++nset;
+
+ if (token == "family") {
+ font.setFamily(static_cast<LyXFont::FONT_FAMILY>(Int));
+
+ } else if (token == "series") {
+ font.setSeries(static_cast<LyXFont::FONT_SERIES>(Int));
+
+ } else if (token == "shape") {
+ font.setShape(static_cast<LyXFont::FONT_SHAPE>(Int));
+
+ } else if (token == "size") {
+ font.setSize(static_cast<LyXFont::FONT_SIZE>(Int));
+
+ } else if (token == "emph") {
+ font.setEmph(static_cast<LyXFont::FONT_MISC_STATE>(Int));
+
+ } else if (token == "underbar") {
+ font.setUnderbar(static_cast<LyXFont::FONT_MISC_STATE>(Int));
+
+ } else if (token == "noun") {
+ font.setNoun(static_cast<LyXFont::FONT_MISC_STATE>(Int));
+
+ } else if (token == "number") {
+ font.setNumber(static_cast<LyXFont::FONT_MISC_STATE>(Int));
+
+ } else if (token == "color") {
+ font.setColor(static_cast<LColor::color>(Int));
+
+ } else if (token == "language") {
+ if (String == "ignore")
+ font.setLanguage(ignore_language);
+ else
+ font.setLanguage(languages.getLanguage(String));
+
+ } else if (token == "toggleall") {
+ toggle = Bool;
+ }
+ }
+ return (nset > 0);
+}
+
+
+string const freefont2string()
+{
+ string data;
+ if (font2string(freefont, toggleall, data))
+ return data;
+ return string();
+}
+
+
+void update_and_apply_freefont(BufferView * bv, string const & data)
+{
+ LyXFont font;
+ bool toggle;
+ if (string2font(data, font, toggle)) {
+ freefont = font;
+ toggleall = toggle;
+ apply_freefont(bv);
+ }
+}
+
+
+void apply_freefont(BufferView * bv)
+{
+ toggleAndShow(bv, freefont, toggleall);
+ bv->owner()->view_state_changed();
+ bv->buffer()->markDirty();
+ bv->owner()->message(_("Character set"));
+}
+
+
void emph(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
// Change environment depth.
// if decInc >= 0, increment depth
-// if decInc < 0, decrement depth
+// if decInc < 0, decrement depth
void changeDepth(BufferView * bv, LyXText * text, int decInc)
{
if (!bv->available() || !text)
// -*- C++ -*-
-/* This file is part of
- * ======================================================
+/**
+ * \file bufferview_funcs.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * LyX, The Document Processor
+ * \author Lars Gullik Bjønnes
+ * \author Jean-Marc Lasgouttes
+ * \author Angus Leeming
*
- * Copyright 1995 Matthias Ettrich
- * Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS
+ */
#ifndef BUFFERVIEW_FUNCS_H
#define BUFFERVIEW_FUNCS_H
class LyXFont;
class LyXText;
+/** Set \param data using \param font and \param toggle.
+ * If successful, returns true.
+ */
+bool font2string(LyXFont const & font, bool toggle, string & data);
+/** Set \param font and \param toggle using \param data.
+ * If successful, returns true.
+ */
+bool string2font(string const & data, LyXFont & font, bool & toggle);
+/** Returns the current freefont, encoded as a string to be passed to the
+ * frontends.
+ */
+string const freefont2string();
+/** Set the freefont using the contents of \param data dispatched from
+ * the frontends and apply it at the current cursor location.
+ */
+void update_and_apply_freefont(BufferView * bv, string const & data);
+/** Apply the contents of freefont at the current cursor location.
+ */
+void apply_freefont(BufferView * bv);
+
+
///
extern void emph(BufferView *);
///
LFUN_HYPHENATION,
LFUN_LIGATURE_BREAK,
LFUN_HFILL,
- LFUN_FREE, // 30
+ LFUN_FREEFONT_APPLY,
+ LFUN_FREEFONT_UPDATE,
#if 0
LFUN_FOOTMELT, // schedule for deletion
LFUN_MARGINMELT, // schedule for deletion
+2003-03-12 Angus Leeming <leeming@lyx.org>
+
+ * Dialogs.[Ch] (hide): rejig as a static method. Hide the signal
+ away.
+ (show): add a string arg.
+
+ * Dialogs.h: remove showCharacter and setUserFreeFont.
+ * guiapi.[Ch]: remove gui_ShowCharacter and gui_SetUserFreeFont.
+
2003-03-10 Angus Leeming <leeming@lyx.org>
* Dialogs.h (hide): make it a static method that returns a
#include "Dialogs.h"
#include "controllers/Dialog.h"
+#include <boost/signals/signal2.hpp>
#include <boost/bind.hpp>
}
-boost::signal2<void, string const &, InsetBase*> & Dialogs::hide()
+namespace {
+
+BugfixSignal<boost::signal2<void, string const &, InsetBase*> > hideSignal;
+
+}
+
+
+void Dialogs::hide(string const & name, InsetBase* inset)
{
- static BugfixSignal<boost::signal2<void, string const &, InsetBase*> >
- thesignal;
- return thesignal();
+ hideSignal()(name, inset);
}
{
// Connect signals
redrawGUI().connect(boost::bind(&Dialogs::redraw, this));
- hide().connect(boost::bind(&Dialogs::hideSlot, this, _1, _2));
+ hideSignal().connect(boost::bind(&Dialogs::hideSlot, this, _1, _2));
// All this is slated to go
init_pimpl();
}
-void Dialogs::show(string const & name)
+void Dialogs::show(string const & name, string const & data)
{
Dialog * dialog = find(name);
if (!dialog)
return;
- dialog->show();
+ dialog->show(data);
}
#include <boost/scoped_ptr.hpp>
#include <boost/signals/signal0.hpp>
#include <boost/signals/signal1.hpp>
-#include <boost/signals/signal2.hpp>
+
class Dialog;
class InsetBase;
Put into some sort of alphabetical order */
//@{
///
- void showCharacter();
- /// connected to the character dialog also
- void setUserFreeFont();
- ///
void showDocument();
/// show the contents of a file.
void showFile(string const &);
void showVCLogFile();
//@}
- ///name == "about" etc
- void show(string const & name);
- /** name == "bibtex", "citation" etc
- data is generated by the Inset::write method, to be read by the
- Inset::read method in the frontends.
- inset is stored. On a subsequent Apply from the frontends, the
- stored inset will be modified. If no inset is stored, then a
- new one will be created at the current cursor position.
- */
+ /** \param name == "about" etc; an identifier used to
+ launch a particular dialog.
+ \param data is a string encoding of the data used to populate
+ the dialog. Several of these dialogs do not need any data,
+ so it defaults to string().
+ */
+ void show(string const & name, string const & data = string());
+
+ /** \param name == "bibtex", "citation" etc; an identifier used to
+ launch a particular dialog.
+ \param data is a string representation of the Inset contents.
+ It is often little more than the output from Inset::write.
+ It is passed to, and parsed by, the frontend dialog.
+ \param inset is _not_ passed to the frontend dialog.
+ It is stored internally and used by the kernel to ascertain
+ what to do with the FuncRequest dispatched from the frontend
+ dialog on 'Apply'; should it be used to create a new inset at
+ the current cursor position or modify an existing, 'open' inset?
+ */
void show(string const & name, string const & data, InsetBase * inset);
- /** name == "citation", "bibtex" etc.
- Update the contents of the dialog.
- */
+
+ /** \param name == "citation", "bibtex" etc; an identifier used
+ to update the contents of a particular dialog with \param data .
+ See the comments to 'show', above.
+ */
void update(string const & name, string const & data);
- /** All Dialogs of the given 'name' will be closed if they are
- connected to the given 'inset'.
- */
- static boost::signal2<void, string const &, InsetBase*> & hide();
+
+ /** All Dialogs of the given \param name will be closed if they are
+ connected to the given \param inset.
+ */
+ static void hide(string const & name, InsetBase * inset);
///
void disconnect(string const & name);
///
+2003-03-12 Angus Leeming <leeming@lyx.org>
+
+ * ControlCharacter.[Ch]: rewrite to use the Dialog-based scheme and
+ the new dispatch lfuns.
+
2003-03-09 Angus Leeming <leeming@lyx.org>
Flatten the ButtonController tree by splitting it into a Controller
#include <config.h>
-
#include "ControlCharacter.h"
-
-#include "ViewBase.h"
#include "ButtonController.h"
#include "buffer.h"
-#include "bufferview_funcs.h" // ToggleAndShow
+#include "bufferview_funcs.h"
+#include "funcrequest.h"
#include "gettext.h"
#include "language.h"
-#include "frontends/LyXView.h"
-
-ControlCharacter::ControlCharacter(LyXView & lv, Dialogs & d)
- : ControlDialogBD(lv, d),
+ControlCharacter::ControlCharacter(Dialog & parent)
+ : Dialog::Controller(parent),
font_(0), toggleall_(false)
{}
-void ControlCharacter::setParams()
+void ControlCharacter::initialiseParams(string const &)
{
- // Do this the first time only. Used as a flag for whether or not the
- // view has been built
+ // Do this the first time only.
if (!font_.get())
font_.reset(new LyXFont(LyXFont::ALL_IGNORE));
getBar() != frnt::IGNORE ||
getColor() != LColor::ignore ||
font_->language() != ignore_language)
- bc().valid();
+ dialog().bc().valid();
}
-void ControlCharacter::apply()
+void ControlCharacter::clearParams()
+{}
+
+
+void ControlCharacter::dispatchParams()
{
- // Nothing to apply. (Can be called from the Toolbar.)
+ // Nothing to dispatch. (Can be called from the Toolbar.)
if (!font_.get())
return;
- // Apply from the view if it's visible. Otherwise, use the stored values
- if (bufferIsAvailable())
- view().apply();
-
- toggleAndShow(bufferview(), *(font_.get()), toggleall_);
- lv_.view_state_changed();
- buffer()->markDirty();
- lv_.message(_("Character set"));
+ string data;
+ if (font2string(*font_.get(), toggleall_, data)) {
+ kernel().dispatch(FuncRequest(LFUN_FREEFONT_UPDATE, data));
+ }
}
font_->setLanguage(ignore_language);
else if (val == "reset")
- font_->setLanguage(buffer()->params.language);
+ font_->setLanguage(kernel().buffer()->params.language);
else
font_->setLanguage(languages.getLanguage(val));
#define CONTROLCHARACTER_H
-#include "ControlDialog_impl.h"
+#include "Dialog.h"
#include "character.h"
-#include <boost/scoped_ptr.hpp>
-/** A controller for Character dialogs.
- */
-class ControlCharacter : public ControlDialogBD {
+class ControlCharacter : public Dialog::Controller {
public:
///
- ControlCharacter(LyXView &, Dialogs &);
+ ControlCharacter(Dialog &);
+ ///
+ virtual void initialiseParams(string const &);
+ ///
+ virtual void clearParams();
+ ///
+ virtual void dispatchParams();
+ ///
+ virtual bool isBufferDependent() const { return true; }
///
void setFamily(LyXFont::FONT_FAMILY);
string getLanguage() const;
///
bool getToggleAll() const;
-
- /// Get changed parameters and Dispatch them to the kernel.
- virtual void apply();
private:
- /// set the params before show or update.
- virtual void setParams();
-
///
boost::scoped_ptr<LyXFont> font_;
///
d->show(name, data, 0);
}
-void gui_ShowCharacter(Dialogs & d)
-{
- d.showCharacter();
-}
-
-
-void gui_SetUserFreeFont(Dialogs & d)
-{
- d.setUserFreeFont();
-}
-
-
void gui_ShowDocument(Dialogs & d)
{
d.showDocument();
void gui_show_dialog(Dialogs *, char const * name, char const * data);
-void gui_ShowCharacter(Dialogs &);
-void gui_SetUserFreeFont(Dialogs &);
void gui_ShowDocument(Dialogs &);
void gui_ShowFile(string const &, Dialogs &);
void gui_ShowForks(Dialogs &);
+2003-03-12 Angus Leeming <leeming@lyx.org>
+
+ * Dialogs.C:
+ * Dialogs2.C:
+ * Dialogs_impl.h: remove character dialog.
+
+ * Dialogs3.C: add character dialog.
+
+ * QCharacter.[Ch]: changes to use the new Dialog-based scheme.
+
2003-03-12 John Levon <levon@movementarian.org>
* QSearch.C: don't disable checkboxes on RO doc (bug 937)
Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
- : character(lv, d),
- document(lv, d),
+ : document(lv, d),
file(lv, d),
logfile(lv, d),
paragraph(lv, d),
#include "Dialogs_impl.h"
-void Dialogs::showCharacter()
-{
- pimpl_->character.controller().show();
-}
-
-
-void Dialogs::setUserFreeFont()
-{
- pimpl_->character.controller().apply();
-}
-
-
void Dialogs::showDocument()
{
pimpl_->document.controller().show();
#include "ControlAboutlyx.h"
#include "ControlBibtex.h"
#include "ControlChanges.h"
+#include "ControlCharacter.h"
#include "ControlCitation.h"
#include "ControlError.h"
#include "ControlERT.h"
#include "QBibtexDialog.h"
#include "QChanges.h"
#include "QChangesDialog.h"
+#include "QCharacter.h"
+#include "QCharacterDialog.h"
#include "QCitation.h"
#include "QCitationDialog.h"
#include "QError.h"
namespace {
char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes",
- "citation", "error", "ert", "external",
- "float", "graphics", "include", "index",
- "label", "minipage", "ref", "tabular",
- "tabularcreate", "toc", "url", "wrap" };
+"character", "citation", "error", "ert", "external", "float", "graphics",
+"include", "index", "label", "minipage", "ref", "tabular", "tabularcreate",
+"toc", "url", "wrap" };
char const * const * const end_dialognames =
dialognames + (sizeof(dialognames) / sizeof(char *));
dialog->setController(new ControlChanges(*dialog));
dialog->setView(new QChanges(*dialog));
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+ } else if (name == "character") {
+ dialog->setController(new ControlCharacter(*dialog));
+ dialog->setView(new QCharacter(*dialog));
+ dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
} else if (name == "citation") {
dialog->setController(new ControlCitation(*dialog));
dialog->setView(new QCitation(*dialog));
#include "Dialogs.h"
#include "controllers/GUI.h"
-#include "ControlCharacter.h"
#include "ControlDocument.h"
#include "ControlForks.h"
#include "ControlLog.h"
-typedef GUI<ControlCharacter, QCharacter, OkApplyCancelReadOnlyPolicy, Qt2BC>
-CharacterDialog;
-
typedef GUI<ControlDocument, QDocument, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
DocumentDialog;
struct Dialogs::Impl {
Impl(LyXView & lv, Dialogs & d);
- CharacterDialog character;
DocumentDialog document;
FileDialog file;
LogFileDialog logfile;
using namespace frnt;
using std::vector;
-typedef Qt2CB<ControlCharacter, Qt2DB<QCharacterDialog> > base_class;
+typedef QController<ControlCharacter, QView<QCharacterDialog> > base_class;
-QCharacter::QCharacter()
- : base_class(qt_("LyX: Change Character Settings"))
+QCharacter::QCharacter(Dialog & parent)
+ : base_class(parent, qt_("LyX: Change Character Settings"))
{
}
#define QCHARACTER_H
-#include "Qt2Base.h"
+#include "QDialogView.h"
#include "controllers/character.h"
#include "controllers/frnt_lang.h"
class QCharacter
- : public Qt2CB<ControlCharacter, Qt2DB<QCharacterDialog> >
+ : public QController<ControlCharacter, QView<QCharacterDialog> >
{
public:
friend class QCharacterDialog;
- QCharacter();
+ QCharacter(Dialog &);
private:
/// Apply changes
virtual void apply();
+2003-03-12 Angus Leeming <leeming@lyx.org>
+
+ * Dialogs.C:
+ * Dialogs2.C:
+ * Dialogs_impl.h: remove character dialog.
+
+ * Dialogs3.C: add character dialog.
+
+ * FormCharacter.[Ch]:
+ * forms/form_character.[Ch]: changes to use the new Dialog-based
+ scheme.
+
2003-03-10 Angus Leeming <leeming@lyx.org>
* Dialogs3.C (build): the "tabularcreate" dialog is always valid.
Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
- : character(lv, d),
- document(lv, d),
+ : document(lv, d),
file(lv, d),
forks(lv, d),
logfile(lv, d),
#include "Dialogs_impl.h"
-void Dialogs::showCharacter()
-{
- pimpl_->character.controller().show();
-}
-
-
-void Dialogs::setUserFreeFont()
-{
- pimpl_->character.controller().apply();
-}
-
-
void Dialogs::showDocument()
{
pimpl_->document.controller().show();
#include "ControlAboutlyx.h"
#include "ControlBibtex.h"
#include "ControlChanges.h"
+#include "ControlCharacter.h"
#include "ControlCitation.h"
#include "ControlCommand.h"
#include "ControlError.h"
#include "forms/form_bibtex.h"
#include "FormChanges.h"
#include "forms/form_changes.h"
+#include "FormCharacter.h"
+#include "forms/form_character.h"
#include "FormCitation.h"
#include "forms/form_citation.h"
#include "FormError.h"
namespace {
char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes",
- "citation", "error", "ert", "external",
- "float", "graphics", "include", "index",
- "label", "minipage", "ref", "tabular",
- "tabularcreate", "toc", "url", "wrap" };
+"character", "citation", "error", "ert", "external", "float", "graphics",
+"include", "index", "label", "minipage", "ref", "tabular", "tabularcreate",
+"toc", "url", "wrap" };
char const * const * const end_dialognames =
dialognames + (sizeof(dialognames) / sizeof(char *));
dialog->setController(new ControlBibtex(*dialog));
dialog->setView(new FormBibtex(*dialog));
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+ } else if (name == "character") {
+ dialog->setController(new ControlCharacter(*dialog));
+ dialog->setView(new FormCharacter(*dialog));
+ dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
} else if (name == "changes") {
dialog->setController(new ControlChanges(*dialog));
dialog->setView(new FormChanges(*dialog));
#include "FormBrowser.h"
#include "forms/form_browser.h"
-#include "ControlCharacter.h"
-#include "FormCharacter.h"
-#include "forms/form_character.h"
-
#include "ControlDocument.h"
#include "FormDocument.h"
#include "forms/form_document.h"
#include "ControlVCLog.h"
#include "FormVCLog.h"
-typedef GUI<ControlCharacter, FormCharacter, OkApplyCancelReadOnlyPolicy, xformsBC>
-CharacterDialog;
-
typedef GUI<ControlDocument, FormDocument, NoRepeatedApplyReadOnlyPolicy, xformsBC>
DocumentDialog;
struct Dialogs::Impl {
Impl(LyXView & lv, Dialogs & d);
- CharacterDialog character;
DocumentDialog document;
FileDialog file;
ForksDialog forks;
using namespace frnt;
-typedef FormCB<ControlCharacter, FormDB<FD_character> > base_class;
+typedef FormController<ControlCharacter, FormView<FD_character> > base_class;
-FormCharacter::FormCharacter()
- : base_class(_("Character Layout"), false)
+FormCharacter::FormCharacter(Dialog & parent)
+ : base_class(parent, _("Character Layout"), false)
{}
#define FORM_CHARACTER_H
-#include "FormBase.h"
+#include "FormDialogView.h"
#include "lyxfont.h" // for LyXFont enums
#include "ControlCharacter.h" // for ControlCharacter enum
#include "LColor.h" // for LColor enum
* in their documents.
*/
class FormCharacter
- : public FormCB<ControlCharacter, FormDB<FD_character> > {
+ : public FormController<ControlCharacter, FormView<FD_character> > {
public:
///
- FormCharacter();
+ FormCharacter(Dialog &);
private:
/// Apply from dialog
kb_action latex_mathfontcmds[] = {
LFUN_BOLD, LFUN_SANS, LFUN_ROMAN, LFUN_ITAL, LFUN_CODE,
- LFUN_NOUN, LFUN_FRAK, LFUN_EMPH, LFUN_FREE, LFUN_DEFAULT
+ LFUN_NOUN, LFUN_FRAK, LFUN_EMPH, LFUN_FREEFONT_APPLY, LFUN_DEFAULT
};
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
name: choice_family
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
name: choice_series
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
name: choice_shape
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
name: choice_size
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
name: choice_bar
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: button_apply
-callback: C_FormBaseApplyCB
+callback: C_FormDialogView_ApplyCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: button_close
-callback: C_FormBaseCancelCB
+callback: C_FormDialogView_CancelCB
argument: 0
--------------------
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
name: choice_color
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
name: check_toggle_all
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
name: choice_language
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
InsetError::~InsetError()
{
- Dialogs::hide()("error", this);
+ Dialogs::hide("error", this);
}
void MailInset::hideDialog() const
{
- Dialogs::hide()(name(), &inset());
+ Dialogs::hide(name(), &inset());
}
changeDepth(view(), TEXT(false), 1);
break;
- case LFUN_FREE:
- owner->getDialogs().setUserFreeFont();
- break;
+ case LFUN_FREEFONT_APPLY:
+ apply_freefont(view());
+ break;
+
+ case LFUN_FREEFONT_UPDATE:
+ update_and_apply_freefont(view(), argument);
+ break;
case LFUN_RECONFIGURE:
Reconfigure(view());
owner->getDialogs().showParagraph();
break;
- case LFUN_LAYOUT_CHARACTER:
- owner->getDialogs().showCharacter();
- break;
+ case LFUN_LAYOUT_CHARACTER: {
+ string data = freefont2string();
+ if (!data.empty())
+ owner->getDialogs().show("character", data);
+ break;
+ }
case LFUN_LAYOUT_TABULAR:
if (view()->theLockingInset()) {
break;
case LFUN_DIALOG_HIDE:
- Dialogs::hide()(argument, 0);
+ Dialogs::hide(argument, 0);
break;
case LFUN_DIALOG_DISCONNECT_INSET:
case LFUN_FRAK: handleFont(bv, cmd.argument, "mathfrak"); break;
case LFUN_ITAL: handleFont(bv, cmd.argument, "mathit"); break;
case LFUN_NOUN: handleFont(bv, cmd.argument, "mathbb"); break;
- case LFUN_FREE: handleFont(bv, cmd.argument, "textrm"); break;
+ case LFUN_FREEFONT_APPLY: handleFont(bv, cmd.argument, "textrm"); break;
case LFUN_DEFAULT: handleFont(bv, cmd.argument, "textnormal"); break;
//case LFUN_GREEK: