mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Yesterday's character dialog patch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6472 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
47432f0259
commit
4a842aeb20
@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
@ -219,8 +219,8 @@ Menuset
|
||||
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"
|
||||
@ -423,7 +423,7 @@ Toolbar
|
||||
Separator
|
||||
Icon "font-emph"
|
||||
Icon "font-noun"
|
||||
Icon "font-free"
|
||||
Icon "font-free-apply"
|
||||
Separator
|
||||
Icon "ert-insert"
|
||||
Icon "math-mode"
|
||||
|
@ -997,18 +997,6 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
|
||||
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;
|
||||
|
@ -1,3 +1,20 @@
|
||||
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:
|
||||
|
@ -191,8 +191,9 @@ void LyXAction::init()
|
||||
{ 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 },
|
||||
|
@ -73,7 +73,7 @@ void ToolbarDefaults::init()
|
||||
|
||||
add(LFUN_EMPH);
|
||||
add(LFUN_NOUN);
|
||||
add(LFUN_FREE);
|
||||
add(LFUN_FREEFONT_APPLY);
|
||||
add(SEPARATOR);
|
||||
|
||||
add(LFUN_INSET_FOOTNOTE);
|
||||
|
@ -1,12 +1,15 @@
|
||||
/* 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>
|
||||
|
||||
@ -14,6 +17,7 @@
|
||||
#include "BufferView.h"
|
||||
#include "paragraph.h"
|
||||
#include "lyxfont.h"
|
||||
#include "lyxlex.h"
|
||||
#include "lyxtext.h"
|
||||
#include "buffer.h"
|
||||
#include "lyx_cb.h"
|
||||
@ -27,11 +31,157 @@
|
||||
#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);
|
||||
@ -77,7 +227,7 @@ void lang(BufferView * bv, string const & l)
|
||||
|
||||
// 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)
|
||||
|
@ -1,13 +1,15 @@
|
||||
// -*- 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
|
||||
@ -18,6 +20,27 @@ class BufferView;
|
||||
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 *);
|
||||
///
|
||||
|
@ -46,7 +46,8 @@ enum kb_action {
|
||||
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
|
||||
|
@ -1,3 +1,12 @@
|
||||
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
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "Dialogs.h"
|
||||
#include "controllers/Dialog.h"
|
||||
#include <boost/signals/signal2.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
|
||||
@ -43,11 +44,16 @@ boost::signal0<void> & Dialogs::redrawGUI()
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -56,7 +62,7 @@ Dialogs::Dialogs(LyXView & lyxview)
|
||||
{
|
||||
// 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();
|
||||
@ -83,13 +89,13 @@ Dialog * Dialogs::find(string const & name)
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/signals/signal0.hpp>
|
||||
#include <boost/signals/signal1.hpp>
|
||||
#include <boost/signals/signal2.hpp>
|
||||
|
||||
|
||||
class Dialog;
|
||||
class InsetBase;
|
||||
@ -73,10 +73,6 @@ public:
|
||||
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 &);
|
||||
@ -110,24 +106,37 @@ public:
|
||||
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);
|
||||
///
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -10,30 +10,25 @@
|
||||
|
||||
#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));
|
||||
|
||||
@ -45,24 +40,24 @@ void ControlCharacter::setParams()
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -220,7 +215,7 @@ void ControlCharacter::setLanguage(string const & val)
|
||||
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));
|
||||
|
@ -13,17 +13,22 @@
|
||||
#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);
|
||||
@ -58,13 +63,7 @@ public:
|
||||
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_;
|
||||
///
|
||||
|
@ -21,18 +21,6 @@ void gui_show_dialog(Dialogs * d, char const * name, char const * data)
|
||||
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();
|
||||
|
@ -21,8 +21,6 @@ extern "C" {
|
||||
|
||||
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 &);
|
||||
|
@ -1,3 +1,13 @@
|
||||
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)
|
||||
|
@ -27,8 +27,7 @@ Dialogs::~Dialogs()
|
||||
|
||||
|
||||
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),
|
||||
|
@ -15,18 +15,6 @@
|
||||
#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();
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "ControlAboutlyx.h"
|
||||
#include "ControlBibtex.h"
|
||||
#include "ControlChanges.h"
|
||||
#include "ControlCharacter.h"
|
||||
#include "ControlCitation.h"
|
||||
#include "ControlError.h"
|
||||
#include "ControlERT.h"
|
||||
@ -38,6 +39,8 @@
|
||||
#include "QBibtexDialog.h"
|
||||
#include "QChanges.h"
|
||||
#include "QChangesDialog.h"
|
||||
#include "QCharacter.h"
|
||||
#include "QCharacterDialog.h"
|
||||
#include "QCitation.h"
|
||||
#include "QCitationDialog.h"
|
||||
#include "QError.h"
|
||||
@ -81,10 +84,9 @@
|
||||
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 *));
|
||||
@ -133,6 +135,10 @@ Dialog * Dialogs::build(string const & name)
|
||||
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));
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "Dialogs.h"
|
||||
#include "controllers/GUI.h"
|
||||
|
||||
#include "ControlCharacter.h"
|
||||
#include "ControlDocument.h"
|
||||
#include "ControlForks.h"
|
||||
#include "ControlLog.h"
|
||||
@ -69,9 +68,6 @@
|
||||
|
||||
|
||||
|
||||
typedef GUI<ControlCharacter, QCharacter, OkApplyCancelReadOnlyPolicy, Qt2BC>
|
||||
CharacterDialog;
|
||||
|
||||
typedef GUI<ControlDocument, QDocument, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
DocumentDialog;
|
||||
|
||||
@ -114,7 +110,6 @@ VCLogFileDialog;
|
||||
struct Dialogs::Impl {
|
||||
Impl(LyXView & lv, Dialogs & d);
|
||||
|
||||
CharacterDialog character;
|
||||
DocumentDialog document;
|
||||
FileDialog file;
|
||||
LogFileDialog logfile;
|
||||
|
@ -29,11 +29,11 @@
|
||||
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"))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#define QCHARACTER_H
|
||||
|
||||
|
||||
#include "Qt2Base.h"
|
||||
#include "QDialogView.h"
|
||||
#include "controllers/character.h"
|
||||
#include "controllers/frnt_lang.h"
|
||||
|
||||
@ -28,12 +28,12 @@ class QCharacterDialog;
|
||||
|
||||
|
||||
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();
|
||||
|
@ -1,3 +1,15 @@
|
||||
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.
|
||||
|
@ -27,8 +27,7 @@ Dialogs::~Dialogs()
|
||||
|
||||
|
||||
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),
|
||||
|
@ -15,18 +15,6 @@
|
||||
#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();
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "ControlAboutlyx.h"
|
||||
#include "ControlBibtex.h"
|
||||
#include "ControlChanges.h"
|
||||
#include "ControlCharacter.h"
|
||||
#include "ControlCitation.h"
|
||||
#include "ControlCommand.h"
|
||||
#include "ControlError.h"
|
||||
@ -41,6 +42,8 @@
|
||||
#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"
|
||||
@ -79,10 +82,9 @@
|
||||
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 *));
|
||||
@ -127,6 +129,10 @@ Dialog * Dialogs::build(string const & name)
|
||||
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));
|
||||
|
@ -21,10 +21,6 @@
|
||||
#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"
|
||||
@ -84,9 +80,6 @@
|
||||
#include "ControlVCLog.h"
|
||||
#include "FormVCLog.h"
|
||||
|
||||
typedef GUI<ControlCharacter, FormCharacter, OkApplyCancelReadOnlyPolicy, xformsBC>
|
||||
CharacterDialog;
|
||||
|
||||
typedef GUI<ControlDocument, FormDocument, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
DocumentDialog;
|
||||
|
||||
@ -137,7 +130,6 @@ VCLogFileDialog;
|
||||
struct Dialogs::Impl {
|
||||
Impl(LyXView & lv, Dialogs & d);
|
||||
|
||||
CharacterDialog character;
|
||||
DocumentDialog document;
|
||||
FileDialog file;
|
||||
ForksDialog forks;
|
||||
|
@ -34,10 +34,10 @@ using std::find;
|
||||
|
||||
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)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#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
|
||||
@ -31,10 +31,10 @@ struct FD_character;
|
||||
* 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
|
||||
|
@ -33,7 +33,7 @@ char const * latex_mathstyle[] = {
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
|
||||
|
@ -64,7 +64,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: choice_family
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -82,7 +82,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: choice_series
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -100,7 +100,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: choice_shape
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -118,7 +118,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: choice_size
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -136,7 +136,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: choice_bar
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -154,7 +154,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: button_apply
|
||||
callback: C_FormBaseApplyCB
|
||||
callback: C_FormDialogView_ApplyCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -172,7 +172,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: button_close
|
||||
callback: C_FormBaseCancelCB
|
||||
callback: C_FormDialogView_CancelCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -190,7 +190,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: choice_color
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -208,7 +208,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: check_toggle_all
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -226,7 +226,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: choice_language
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
|
@ -35,7 +35,7 @@ InsetError::InsetError(string const & str, bool)
|
||||
|
||||
InsetError::~InsetError()
|
||||
{
|
||||
Dialogs::hide()("error", this);
|
||||
Dialogs::hide("error", this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,5 +36,5 @@ void MailInset::updateDialog(BufferView * bv) const
|
||||
|
||||
void MailInset::hideDialog() const
|
||||
{
|
||||
Dialogs::hide()(name(), &inset());
|
||||
Dialogs::hide(name(), &inset());
|
||||
}
|
||||
|
@ -1101,9 +1101,13 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
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());
|
||||
@ -1232,9 +1236,12 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
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()) {
|
||||
@ -1409,7 +1416,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
break;
|
||||
|
||||
case LFUN_DIALOG_HIDE:
|
||||
Dialogs::hide()(argument, 0);
|
||||
Dialogs::hide(argument, 0);
|
||||
break;
|
||||
|
||||
case LFUN_DIALOG_DISCONNECT_INSET:
|
||||
|
@ -661,7 +661,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user