mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
port the graphics dialog to the new scheme and get rid of the ControlInset
template. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6382 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f7ec787f03
commit
120c89f24f
@ -1,3 +1,8 @@
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ui/default.ui: use 'dialog-show-new-inset "graphics"' instead
|
||||
of graphics-insert'.
|
||||
|
||||
2003-03-06 Serge Winitzki <serge@cosmos.phy.tufts.edu>
|
||||
|
||||
* bind/sciword.bind: update for 1.3.x
|
||||
|
@ -209,7 +209,7 @@ Menuset
|
||||
Separator
|
||||
Item "TeX|T" "ert-insert"
|
||||
Item "Minipage|p" "minipage-insert"
|
||||
Item "Graphics...|G" "graphics-insert"
|
||||
Item "Graphics...|G" "dialog-show-new-inset graphics"
|
||||
Item "Tabular Material...|b" "tabular-insert"
|
||||
Submenu "Floats|a" "insert_floats"
|
||||
Separator
|
||||
@ -433,6 +433,6 @@ Toolbar
|
||||
Icon "marginalnote-insert"
|
||||
Icon "depth-increment"
|
||||
Separator
|
||||
Icon "graphics-insert"
|
||||
Icon "dialog-show-new-inset graphics"
|
||||
Icon "tabular-insert"
|
||||
End
|
||||
|
@ -988,19 +988,6 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
|
||||
// a tabular-inset
|
||||
break;
|
||||
|
||||
case LFUN_INSET_GRAPHICS:
|
||||
{
|
||||
Inset * new_inset = new InsetGraphics;
|
||||
if (!insertInset(new_inset)) {
|
||||
delete new_inset;
|
||||
} else {
|
||||
// this is need because you don't use a inset->Edit()
|
||||
updateInset(new_inset, true);
|
||||
new_inset->edit(bv_);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_LAYOUT_COPY:
|
||||
bv_->copyEnvironment();
|
||||
break;
|
||||
|
@ -1,4 +1,15 @@
|
||||
2003-03-05 Angus Leeming <leeming@lyx.org>
|
||||
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* BufferView_pimpl.C (dispatch):
|
||||
* LyXAction.C (init):
|
||||
* ToolbarDefaults.C (init):
|
||||
* commandtags.h:
|
||||
* lyxfunc.C (getStatus):
|
||||
remove LFUN_INSET_GRAPHICS.
|
||||
|
||||
* factory.C (createInset): add "graphics" to LFUN_INSET_APPLY.
|
||||
|
||||
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* commandtags.h:
|
||||
* LyXAction.C (init):
|
||||
|
@ -174,8 +174,6 @@ void LyXAction::init()
|
||||
N_("Remove all error boxes"), ReadOnly },
|
||||
{ LFUN_INSET_ERT, "ert-insert",
|
||||
N_("Insert a new ERT Inset"), Noop },
|
||||
{ LFUN_INSET_GRAPHICS, "graphics-insert",
|
||||
N_("Insert Graphics"), Noop },
|
||||
{ LFUN_FILE_INSERT, "file-insert", "", Noop },
|
||||
{ LFUN_FILE_INSERT_ASCII, "file-insert-ascii", _("Insert ASCII files as lines"), Noop },
|
||||
{ LFUN_FILE_INSERT_ASCII_PARA, "file-insert-ascii-para", _("Insert ASCII file as a paragraph"), Noop },
|
||||
|
@ -85,7 +85,7 @@ void ToolbarDefaults::init()
|
||||
add(LFUN_MATH_MODE);
|
||||
add(SEPARATOR);
|
||||
|
||||
add(LFUN_INSET_GRAPHICS);
|
||||
// add(LFUN_INSET_GRAPHICS);
|
||||
add(LFUN_TABULAR_INSERT);
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,6 @@ enum kb_action {
|
||||
LFUN_DATE_INSERT, // jdblair 20000131
|
||||
LFUN_LANGUAGE, // Dekel 20000203
|
||||
LFUN_INSET_ERT, // Jug 20000218
|
||||
LFUN_INSET_GRAPHICS, // Lgb 20000226
|
||||
LFUN_INSET_FOOTNOTE, // Jug 20000307
|
||||
LFUN_PARAGRAPH_SPACING, // Lgb 20000411
|
||||
LFUN_TABULAR_INSERT, // Jug 20000412
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "insets/insetexternal.h"
|
||||
#include "insets/insetfloat.h"
|
||||
#include "insets/insetfoot.h"
|
||||
#include "insets/insetgraphics.h"
|
||||
#include "insets/insetinclude.h"
|
||||
#include "insets/insetindex.h"
|
||||
#include "insets/insetlabel.h"
|
||||
@ -192,6 +193,14 @@ Inset * createInset(FuncRequest const & cmd)
|
||||
inset->setFromParams(iep);
|
||||
return inset;
|
||||
|
||||
} else if (name == "graphics") {
|
||||
InsetGraphicsParams igp;
|
||||
InsetGraphicsMailer::string2params(cmd.argument, igp);
|
||||
InsetGraphics * inset = new InsetGraphics;
|
||||
string const fpath = cmd.view()->buffer()->filePath();
|
||||
inset->setParams(igp, fpath);
|
||||
return inset;
|
||||
|
||||
} else if (name == "include") {
|
||||
InsetInclude::Params iip;
|
||||
InsetIncludeMailer::string2params(cmd.argument, iip);
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.h: remove showGraphics.
|
||||
* guiapi.[Ch]: remove gui_showGraphics.
|
||||
|
||||
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.h: remove showMinipage, updateMinipage.
|
||||
|
@ -23,7 +23,6 @@ class Dialog;
|
||||
class InsetBase;
|
||||
class LyXView;
|
||||
|
||||
class InsetGraphics;
|
||||
class InsetInfo;
|
||||
class Paragraph;
|
||||
class InsetTabular;
|
||||
@ -86,8 +85,6 @@ public:
|
||||
void showFile(string const &);
|
||||
/// show all forked child processes
|
||||
void showForks();
|
||||
///
|
||||
void showGraphics(InsetGraphics *);
|
||||
/// show the LaTeX log or build file
|
||||
void showLogFile();
|
||||
/// display the top-level maths panel
|
||||
|
@ -1,3 +1,10 @@
|
||||
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlGraphics.[Ch]: rewrite to use the Dialog-based scheme.
|
||||
|
||||
* ControlInset.{h, tmpl}: remove.
|
||||
* Makefile.am: remove files.
|
||||
|
||||
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlBibitem.[Ch]:
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "funcrequest.h"
|
||||
#include "gettext.h"
|
||||
#include "lyxrc.h"
|
||||
|
||||
@ -41,40 +42,32 @@ extern string system_lyxdir;
|
||||
extern string user_lyxdir;
|
||||
|
||||
|
||||
ControlGraphics::ControlGraphics(LyXView & lv, Dialogs & d)
|
||||
: ControlInset<InsetGraphics, InsetGraphicsParams>(lv, d)
|
||||
ControlGraphics::ControlGraphics(Dialog & parent)
|
||||
: Dialog::Controller(parent)
|
||||
{}
|
||||
|
||||
|
||||
InsetGraphicsParams const ControlGraphics::getParams(string const &)
|
||||
void ControlGraphics::initialiseParams(string const & data)
|
||||
{
|
||||
return InsetGraphicsParams();
|
||||
InsetGraphicsParams params;
|
||||
InsetGraphicsMailer::string2params(data, params);
|
||||
params_.reset(new InsetGraphicsParams(params));
|
||||
}
|
||||
|
||||
|
||||
InsetGraphicsParams const
|
||||
ControlGraphics::getParams(InsetGraphics const & inset)
|
||||
void ControlGraphics::clearParams()
|
||||
{
|
||||
return inset.params();
|
||||
params_.reset();
|
||||
}
|
||||
|
||||
|
||||
void ControlGraphics::applyParamsToInset()
|
||||
void ControlGraphics::dispatchParams()
|
||||
{
|
||||
// Set the parameters in the inset, it also returns true if the new
|
||||
// parameters are different from what was in the inset already.
|
||||
bool changed = inset()->setParams(params(), buffer()->filePath());
|
||||
|
||||
// Tell LyX we've got a change, and mark the document dirty,
|
||||
// if it changed.
|
||||
bufferview()->updateInset(inset(), changed);
|
||||
string const lfun = InsetGraphicsMailer::params2string(params());
|
||||
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
|
||||
}
|
||||
|
||||
|
||||
void ControlGraphics::applyParamsNoInset()
|
||||
{}
|
||||
|
||||
|
||||
string const ControlGraphics::Browse(string const & in_name)
|
||||
{
|
||||
string const title = _("Select graphics file");
|
||||
@ -88,14 +81,15 @@ string const ControlGraphics::Browse(string const & in_name)
|
||||
pair<string, string> dir1(_("Clipart|#C#c"), clipdir);
|
||||
pair<string, string> dir2(_("Documents|#o#O"), string(lyxrc.document_path));
|
||||
// Show the file browser dialog
|
||||
return browseRelFile(in_name, buffer()->filePath(),
|
||||
return browseRelFile(in_name, kernel().buffer()->filePath(),
|
||||
title, "*.*", false, dir1, dir2);
|
||||
}
|
||||
|
||||
|
||||
string const ControlGraphics::readBB(string const & file)
|
||||
{
|
||||
string const abs_file = MakeAbsPath(file, buffer()->filePath());
|
||||
string const abs_file =
|
||||
MakeAbsPath(file, kernel().buffer()->filePath());
|
||||
|
||||
// try to get it from the file, if possible. Zipped files are
|
||||
// unzipped in the readBB_from_PSFile-Function
|
||||
@ -124,7 +118,7 @@ string const ControlGraphics::readBB(string const & file)
|
||||
bool ControlGraphics::isFilenameValid(string const & fname) const
|
||||
{
|
||||
// It may be that the filename is relative.
|
||||
string const name = MakeAbsPath(fname, buffer()->filePath());
|
||||
string const name = MakeAbsPath(fname, kernel().buffer()->filePath());
|
||||
return IsFileReadable(name);
|
||||
}
|
||||
|
||||
|
@ -15,11 +15,7 @@
|
||||
#define CONTROLGRAPHICS_H
|
||||
|
||||
|
||||
#include "ControlInset.h"
|
||||
|
||||
// needed to instatiate inset->hideDialog in ControlInset
|
||||
#include "insets/insetgraphics.h"
|
||||
|
||||
#include "Dialog.h"
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@ -30,11 +26,22 @@ class LyXView;
|
||||
/** A controller for Graphics dialogs.
|
||||
*/
|
||||
|
||||
class ControlGraphics
|
||||
: public ControlInset<InsetGraphics, InsetGraphicsParams> {
|
||||
class ControlGraphics : public Dialog::Controller {
|
||||
public:
|
||||
///
|
||||
ControlGraphics(LyXView &, Dialogs &);
|
||||
ControlGraphics(Dialog &);
|
||||
///
|
||||
virtual void initialiseParams(string const & data);
|
||||
/// clean-up on hide.
|
||||
virtual void clearParams();
|
||||
/// clean-up on hide.
|
||||
virtual void dispatchParams();
|
||||
///
|
||||
virtual bool isBufferDependent() const { return true; }
|
||||
///
|
||||
InsetGraphicsParams & params() { return *params_.get(); }
|
||||
///
|
||||
InsetGraphicsParams const & params() const { return *params_.get(); }
|
||||
|
||||
/// Browse for a file
|
||||
string const Browse(string const &);
|
||||
@ -46,14 +53,8 @@ public:
|
||||
bool isFilenameValid(string const & fname) const;
|
||||
|
||||
private:
|
||||
/// Dispatch the changed parameters to the kernel.
|
||||
virtual void applyParamsToInset();
|
||||
///
|
||||
virtual void applyParamsNoInset();
|
||||
/// get the parameters from the string passed to createInset.
|
||||
virtual InsetGraphicsParams const getParams(string const &);
|
||||
/// get the parameters from the inset passed to showInset.
|
||||
virtual InsetGraphicsParams const getParams(InsetGraphics const &);
|
||||
boost::scoped_ptr<InsetGraphicsParams> params_;
|
||||
};
|
||||
|
||||
namespace frnt {
|
||||
|
@ -1,104 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file ControlInset.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Angus Leeming
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*
|
||||
* ControlInset is to be used as a parent class for dialogs that display and
|
||||
* can perhaps modify the contents of an individual inset. An example being the
|
||||
* ubiquitous Citation dialog.
|
||||
*/
|
||||
|
||||
#ifndef CONTROLINSET_H
|
||||
#define CONTROLINSET_H
|
||||
|
||||
#include "ControlConnections.h"
|
||||
#include "LString.h"
|
||||
|
||||
#include <boost/signals/connection.hpp>
|
||||
|
||||
class Inset;
|
||||
|
||||
template <class Inset, class Params>
|
||||
class ControlInset : public ControlConnectBD {
|
||||
public:
|
||||
///
|
||||
ControlInset(LyXView &, Dialogs &);
|
||||
/// Allow the View access to the local copy.
|
||||
Params & params();
|
||||
///
|
||||
Params const & params() const;
|
||||
|
||||
/// Slots connected in the daughter classes c-tor.
|
||||
/// Slot launching dialog to (possibly) create a new inset.
|
||||
void createInset(string const &);
|
||||
/// Slot launching dialog to an existing inset.
|
||||
void showInset(Inset *);
|
||||
protected:
|
||||
/// Allow the daughter methods to access the inset.
|
||||
Inset * inset() const;
|
||||
private:
|
||||
/** These 7 methods are all that the individual daughter classes
|
||||
should need to instantiate. */
|
||||
|
||||
/// if the inset exists then do this...
|
||||
virtual void applyParamsToInset() = 0;
|
||||
/// else this...
|
||||
virtual void applyParamsNoInset() = 0;
|
||||
|
||||
/// get the parameters from the string passed to createInset.
|
||||
virtual Params const getParams(string const &) = 0;
|
||||
/// get the parameters from the inset passed to showInset.
|
||||
virtual Params const getParams(Inset const &) = 0;
|
||||
|
||||
/** Most derived classes won't need these two, so they default to empty.
|
||||
*/
|
||||
|
||||
/// set any daughter class-particular data on show().
|
||||
virtual void setDaughterParams() {}
|
||||
/// clean-up any daughter class-particular data on hide().
|
||||
virtual void clearDaughterParams() {}
|
||||
|
||||
/** Some dialogs may find it beneficial to disconnect from the inset
|
||||
when the Apply button is pressed. E.g., doing this with the citation
|
||||
dialog allows multiple citiations to be inserted easily. */
|
||||
virtual bool disconnectOnApply() { return false; }
|
||||
|
||||
/// Instantiation of ControlButtons virtual methods.
|
||||
|
||||
/// Get changed parameters and Dispatch them to the kernel.
|
||||
virtual void apply();
|
||||
/// Disconnect signals and hide View.
|
||||
virtual void hide();
|
||||
/// Update the dialog.
|
||||
virtual void update();
|
||||
|
||||
/** Instantiation of ControlConnectBD private virtual method.
|
||||
Slot connected to update signal. */
|
||||
virtual void updateSlot(bool);
|
||||
|
||||
/// Show the dialog.
|
||||
void show(Params const &);
|
||||
/// Connect signals
|
||||
void connectInset(Inset * = 0);
|
||||
|
||||
/// pointer to the inset passed through connectInset
|
||||
Inset * inset_;
|
||||
/// inset::hide connection.
|
||||
boost::signals::connection ih_;
|
||||
/** A local copy of the inset's params.
|
||||
Memory is allocated only whilst the dialog is visible.
|
||||
*/
|
||||
Params * params_;
|
||||
|
||||
/// is the dialog built ?
|
||||
bool dialog_built_;
|
||||
};
|
||||
|
||||
#include "ControlInset.tmpl"
|
||||
|
||||
#endif // CONTROLINSET_H
|
@ -1,196 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file ControlInset.tmpl
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Angus Leeming
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*
|
||||
* ControlInset is a base class and so these templatised methods will be
|
||||
* instantiated if this file is #included in the derived classes' .C file.
|
||||
*/
|
||||
|
||||
#include "ControlInset.h"
|
||||
|
||||
#include "ButtonControllerBase.h"
|
||||
#include "ViewBase.h"
|
||||
#include "support/LAssert.h"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
template <class Inset, class Params>
|
||||
ControlInset<Inset, Params>::ControlInset(LyXView & lv, Dialogs & d)
|
||||
: ControlConnectBD(lv, d),
|
||||
inset_(0), params_(0), dialog_built_(false)
|
||||
{}
|
||||
|
||||
|
||||
template <class Inset, class Params>
|
||||
void ControlInset<Inset, Params>::showInset(Inset * inset)
|
||||
{
|
||||
if (inset == 0) return; // maybe we should Assert this?
|
||||
|
||||
connectInset(inset);
|
||||
show(getParams(*inset));
|
||||
|
||||
// The widgets may not be valid, so refresh the button controller
|
||||
bc().refresh();
|
||||
}
|
||||
|
||||
|
||||
template <class Inset, class Params>
|
||||
void ControlInset<Inset, Params>::createInset(string const & arg)
|
||||
{
|
||||
connectInset();
|
||||
|
||||
if (!arg.empty())
|
||||
bc().valid(); // so that the user can press Ok
|
||||
|
||||
show(getParams(arg));
|
||||
}
|
||||
|
||||
|
||||
template <class Inset, class Params>
|
||||
void ControlInset<Inset, Params>::show(Params const & params)
|
||||
{
|
||||
// paranoia check
|
||||
if (params_) delete params_;
|
||||
|
||||
params_ = new Params(params);
|
||||
setDaughterParams();
|
||||
|
||||
if (emergency_exit_) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dialog_built_) {
|
||||
view().build();
|
||||
dialog_built_ = true;
|
||||
}
|
||||
|
||||
bc().readOnly(bufferIsReadonly());
|
||||
view().show();
|
||||
}
|
||||
|
||||
|
||||
template <class Inset, class Params>
|
||||
void ControlInset<Inset, Params>::update()
|
||||
{
|
||||
// paranoia check
|
||||
if (params_) delete params_;
|
||||
|
||||
if (inset_)
|
||||
params_ = new Params(getParams(*inset_));
|
||||
else
|
||||
params_ = new Params();
|
||||
|
||||
if (emergency_exit_) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
bc().readOnly(bufferIsReadonly());
|
||||
view().update();
|
||||
|
||||
// The widgets may not be valid, so refresh the button controller
|
||||
bc().refresh();
|
||||
}
|
||||
|
||||
|
||||
template <class Inset, class Params>
|
||||
void ControlInset<Inset, Params>::hide()
|
||||
{
|
||||
emergency_exit_ = false;
|
||||
if (params_) {
|
||||
delete params_;
|
||||
params_ = 0;
|
||||
}
|
||||
inset_ = 0;
|
||||
|
||||
clearDaughterParams();
|
||||
|
||||
ih_.disconnect();
|
||||
disconnect();
|
||||
view().hide();
|
||||
}
|
||||
|
||||
|
||||
template <class Inset, class Params>
|
||||
void ControlInset<Inset, Params>::apply()
|
||||
{
|
||||
if (bufferIsReadonly())
|
||||
return;
|
||||
|
||||
view().apply();
|
||||
|
||||
if (inset_) {
|
||||
if (params() != getParams(*inset_)) {
|
||||
applyParamsToInset();
|
||||
}
|
||||
} else {
|
||||
applyParamsNoInset();
|
||||
}
|
||||
|
||||
if (disconnectOnApply() && !isClosing()) {
|
||||
*params_ = getParams(string());
|
||||
inset_ = 0;
|
||||
ih_.disconnect();
|
||||
|
||||
view().update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class Inset, class Params>
|
||||
Params & ControlInset<Inset, Params>::params()
|
||||
{
|
||||
lyx::Assert(params_);
|
||||
return *params_;
|
||||
}
|
||||
|
||||
|
||||
template <class Inset, class Params>
|
||||
Params const & ControlInset<Inset, Params>::params() const
|
||||
{
|
||||
lyx::Assert(params_);
|
||||
return *params_;
|
||||
}
|
||||
|
||||
|
||||
template <class Inset, class Params>
|
||||
Inset * ControlInset<Inset, Params>::inset() const
|
||||
{
|
||||
lyx::Assert(inset_);
|
||||
return inset_;
|
||||
}
|
||||
|
||||
|
||||
template <class Inset, class Params>
|
||||
void ControlInset<Inset, Params>::updateSlot(bool switched)
|
||||
{
|
||||
if (switched)
|
||||
hide();
|
||||
else
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
template <class Inset, class Params>
|
||||
void ControlInset<Inset, Params>::connectInset(Inset * inset)
|
||||
{
|
||||
// If connected to another inset, disconnect from it.
|
||||
if (inset_) {
|
||||
ih_.disconnect();
|
||||
inset_ = 0;
|
||||
}
|
||||
|
||||
if (inset) {
|
||||
inset_ = inset;
|
||||
ih_ = inset->hideDialog.connect(
|
||||
boost::bind(&ControlInset::hide, this));
|
||||
}
|
||||
connect();
|
||||
}
|
@ -5,7 +5,7 @@ noinst_LTLIBRARIES = libcontrollers.la
|
||||
INCLUDES = -I$(top_srcdir)/src \
|
||||
$(BOOST_INCLUDES)
|
||||
|
||||
EXTRA_DIST = ButtonController.tmpl ControlDialog.tmpl ControlInset.tmpl
|
||||
EXTRA_DIST = ButtonController.tmpl ControlDialog.tmpl
|
||||
|
||||
libcontrollers_la_SOURCES= \
|
||||
Dialog.C \
|
||||
@ -62,7 +62,6 @@ libcontrollers_la_SOURCES= \
|
||||
ControlGraphics.h \
|
||||
ControlInclude.C \
|
||||
ControlInclude.h \
|
||||
ControlInset.h \
|
||||
ControlLog.C \
|
||||
ControlLog.h \
|
||||
ControlMath.C \
|
||||
|
@ -57,12 +57,6 @@ void gui_ShowForks(Dialogs & d)
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowGraphics(InsetGraphics * ig, Dialogs & d)
|
||||
{
|
||||
d.showGraphics(ig);
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowLogFile(Dialogs & d)
|
||||
{
|
||||
d.showLogFile();
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "LString.h"
|
||||
|
||||
class Dialogs;
|
||||
class InsetGraphics;
|
||||
class InsetTabular;
|
||||
|
||||
extern "C" {
|
||||
@ -29,7 +28,6 @@ void gui_SetUserFreeFont(Dialogs &);
|
||||
void gui_ShowDocument(Dialogs &);
|
||||
void gui_ShowFile(string const &, Dialogs &);
|
||||
void gui_ShowForks(Dialogs &);
|
||||
void gui_ShowGraphics(InsetGraphics *, Dialogs &);
|
||||
void gui_ShowLogFile(Dialogs &);
|
||||
void gui_ShowMathPanel(Dialogs &);
|
||||
void gui_ShowParagraph(Dialogs &);
|
||||
|
@ -3,6 +3,16 @@
|
||||
* QPrefs.C:
|
||||
* QPrefSpellcheckerModule.ui: Add 'hspell' option.
|
||||
|
||||
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C:
|
||||
* Dialogs2.C:
|
||||
* Dialogs_impl.h: remove graphics dialog.
|
||||
|
||||
* Dialogs3.C: add graphics dialog.
|
||||
|
||||
* QGraphics.[Ch]: changes to use the new Dialog-based scheme.
|
||||
|
||||
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C:
|
||||
|
@ -31,7 +31,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
character(lv, d),
|
||||
document(lv, d),
|
||||
file(lv, d),
|
||||
graphics(lv, d),
|
||||
logfile(lv, d),
|
||||
paragraph(lv, d),
|
||||
prefs(lv, d),
|
||||
|
@ -55,12 +55,6 @@ void Dialogs::showForks()
|
||||
{}
|
||||
|
||||
|
||||
void Dialogs::showGraphics(InsetGraphics * ig)
|
||||
{
|
||||
pimpl_->graphics.controller().showInset(ig);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showLogFile()
|
||||
{
|
||||
pimpl_->logfile.controller().show();
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ControlERT.h"
|
||||
#include "ControlExternal.h"
|
||||
#include "ControlFloat.h"
|
||||
#include "ControlGraphics.h"
|
||||
#include "ControlInclude.h"
|
||||
#include "ControlMinipage.h"
|
||||
#include "ControlRef.h"
|
||||
@ -43,6 +44,8 @@
|
||||
// of the Qt headers, those most fucked up of disgusting ratholes.
|
||||
// But I won't.
|
||||
#undef signals
|
||||
#include "QGraphics.h"
|
||||
#include "QGraphicsDialog.h"
|
||||
#include "QInclude.h"
|
||||
#include "QIncludeDialog.h"
|
||||
#include "QIndex.h"
|
||||
@ -79,8 +82,8 @@ namespace {
|
||||
|
||||
char const * const dialognames[] = { "bibitem", "bibtex", "citation",
|
||||
"error", "ert", "external", "float",
|
||||
"include", "index", "label", "minipage",
|
||||
"ref", "toc", "url", "wrap" };
|
||||
"graphics", "include", "index", "label",
|
||||
"minipage", "ref", "toc", "url", "wrap" };
|
||||
|
||||
char const * const * const end_dialognames =
|
||||
dialognames + (sizeof(dialognames) / sizeof(char *));
|
||||
@ -140,6 +143,10 @@ Dialog * Dialogs::build(string const & name)
|
||||
dialog->setController(new ControlFloat(*dialog));
|
||||
dialog->setView(new QFloat(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "graphics") {
|
||||
dialog->setController(new ControlGraphics(*dialog));
|
||||
dialog->setView(new QGraphics(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "include") {
|
||||
dialog->setController(new ControlInclude(*dialog));
|
||||
dialog->setView(new QInclude(*dialog));
|
||||
|
@ -19,8 +19,6 @@
|
||||
#include "ControlCharacter.h"
|
||||
#include "ControlDocument.h"
|
||||
#include "ControlForks.h"
|
||||
#include "ControlGraphics.h"
|
||||
#include "insets/insetgraphicsParams.h"
|
||||
#include "ControlLog.h"
|
||||
#include "ControlParagraph.h"
|
||||
#include "ControlPrefs.h"
|
||||
@ -47,8 +45,6 @@
|
||||
// of the Qt headers, those most fucked up of disgusting ratholes.
|
||||
// But I won't.
|
||||
#undef signals
|
||||
#include "QGraphics.h"
|
||||
#include "QGraphicsDialog.h"
|
||||
#include "QLog.h"
|
||||
#include "QLogDialog.h"
|
||||
#include "QParagraph.h"
|
||||
@ -100,9 +96,6 @@ DocumentDialog;
|
||||
typedef GUI<ControlShowFile, QShowFile, OkCancelPolicy, Qt2BC>
|
||||
FileDialog;
|
||||
|
||||
typedef GUI<ControlGraphics, QGraphics, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
GraphicsDialog;
|
||||
|
||||
typedef GUI<ControlLog, QLog, OkCancelPolicy, Qt2BC>
|
||||
LogFileDialog;
|
||||
|
||||
@ -150,7 +143,6 @@ struct Dialogs::Impl {
|
||||
CharacterDialog character;
|
||||
DocumentDialog document;
|
||||
FileDialog file;
|
||||
GraphicsDialog graphics;
|
||||
LogFileDialog logfile;
|
||||
ParagraphDialog paragraph;
|
||||
PrefsDialog prefs;
|
||||
|
@ -43,11 +43,11 @@
|
||||
using std::vector;
|
||||
using std::endl;
|
||||
|
||||
typedef Qt2CB<ControlGraphics, Qt2DB<QGraphicsDialog> > base_class;
|
||||
typedef QController<ControlGraphics, QView<QGraphicsDialog> > base_class;
|
||||
|
||||
|
||||
QGraphics::QGraphics()
|
||||
: base_class(qt_("LyX: Insert Graphics"))
|
||||
QGraphics::QGraphics(Dialog & parent)
|
||||
: base_class(parent, qt_("LyX: Insert Graphics"))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -14,21 +14,21 @@
|
||||
#define QGRAPHICS_H
|
||||
|
||||
|
||||
#include "insets/insetgraphics.h"
|
||||
#include "Qt2Base.h"
|
||||
#include "QDialogView.h"
|
||||
|
||||
|
||||
class ControlGraphics;
|
||||
class QGraphicsDialog;
|
||||
|
||||
///
|
||||
class QGraphics
|
||||
: public Qt2CB<ControlGraphics, Qt2DB<QGraphicsDialog> >
|
||||
: public QController<ControlGraphics, QView<QGraphicsDialog> >
|
||||
{
|
||||
public:
|
||||
///
|
||||
friend class QGraphicsDialog;
|
||||
///
|
||||
QGraphics();
|
||||
QGraphics(Dialog &);
|
||||
protected:
|
||||
virtual bool isValid();
|
||||
private:
|
||||
|
@ -1,3 +1,14 @@
|
||||
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C:
|
||||
* Dialogs2.C:
|
||||
* Dialogs_impl.h: remove graphics dialog.
|
||||
|
||||
* Dialogs3.C: add graphics dialog.
|
||||
|
||||
* FormGraphics.[Ch]:
|
||||
* forms/form_graphics.fd: changes to use the new Dialog-based scheme.
|
||||
|
||||
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C:
|
||||
|
@ -32,7 +32,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
document(lv, d),
|
||||
file(lv, d),
|
||||
forks(lv, d),
|
||||
graphics(lv, d),
|
||||
logfile(lv, d),
|
||||
mathpanel(lv, d),
|
||||
paragraph(lv, d),
|
||||
|
@ -57,12 +57,6 @@ void Dialogs::showForks()
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showGraphics(InsetGraphics * ig)
|
||||
{
|
||||
pimpl_->graphics.controller().showInset(ig);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showLogFile()
|
||||
{
|
||||
pimpl_->logfile.controller().show();
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "ControlERT.h"
|
||||
#include "ControlExternal.h"
|
||||
#include "ControlFloat.h"
|
||||
#include "ControlGraphics.h"
|
||||
#include "ControlInclude.h"
|
||||
#include "ControlMinipage.h"
|
||||
#include "ControlRef.h"
|
||||
@ -42,6 +43,8 @@
|
||||
#include "forms/form_external.h"
|
||||
#include "FormFloat.h"
|
||||
#include "forms/form_float.h"
|
||||
#include "FormGraphics.h"
|
||||
#include "forms/form_graphics.h"
|
||||
#include "FormInclude.h"
|
||||
#include "forms/form_include.h"
|
||||
#include "FormMinipage.h"
|
||||
@ -76,15 +79,11 @@ typedef ButtonController<NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
|
||||
namespace {
|
||||
|
||||
// char const * const dialognames[] = { "bibitem", "bibtex", "citation",
|
||||
// "error", "ert", "external", "float",
|
||||
// "graphics", "include", "index",
|
||||
// "minipage", "ref", "tabular", "toc",
|
||||
// "url", "wrap" };
|
||||
char const * const dialognames[] = { "bibitem", "bibtex", "citation",
|
||||
"error", "ert", "external", "float",
|
||||
"include", "index", "label", "minipage",
|
||||
"ref", "toc", "url", "wrap" };
|
||||
"graphics", "include", "index", "label",
|
||||
"minipage", "ref", "toc", "url", "wrap" };
|
||||
|
||||
|
||||
char const * const * const end_dialognames =
|
||||
dialognames + (sizeof(dialognames) / sizeof(char *));
|
||||
@ -144,6 +143,10 @@ Dialog * Dialogs::build(string const & name)
|
||||
dialog->setController(new ControlFloat(*dialog));
|
||||
dialog->setView(new FormFloat(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "graphics") {
|
||||
dialog->setController(new ControlGraphics(*dialog));
|
||||
dialog->setView(new FormGraphics(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "include") {
|
||||
dialog->setController(new ControlInclude(*dialog));
|
||||
dialog->setView(new FormInclude(*dialog));
|
||||
|
@ -41,10 +41,6 @@
|
||||
#include "FormForks.h"
|
||||
#include "forms/form_forks.h"
|
||||
|
||||
#include "ControlGraphics.h"
|
||||
#include "FormGraphics.h"
|
||||
#include "forms/form_graphics.h"
|
||||
|
||||
#include "ControlLog.h"
|
||||
#include "FormLog.h"
|
||||
|
||||
@ -122,9 +118,6 @@ FileDialog;
|
||||
typedef GUI<ControlForks, FormForks, OkApplyCancelPolicy, xformsBC>
|
||||
ForksDialog;
|
||||
|
||||
typedef GUI<ControlGraphics, FormGraphics, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
GraphicsDialog;
|
||||
|
||||
typedef GUI<ControlLog, FormLog, OkCancelPolicy, xformsBC>
|
||||
LogFileDialog;
|
||||
|
||||
@ -178,7 +171,6 @@ struct Dialogs::Impl {
|
||||
DocumentDialog document;
|
||||
FileDialog file;
|
||||
ForksDialog forks;
|
||||
GraphicsDialog graphics;
|
||||
LogFileDialog logfile;
|
||||
MathPanelDialog mathpanel;
|
||||
ParagraphDialog paragraph;
|
||||
|
@ -55,10 +55,10 @@ string defaultUnit("cm");
|
||||
} // namespace anon
|
||||
|
||||
|
||||
typedef FormCB<ControlGraphics, FormDB<FD_graphics> > base_class;
|
||||
typedef FormController<ControlGraphics, FormView<FD_graphics> > base_class;
|
||||
|
||||
FormGraphics::FormGraphics()
|
||||
: base_class(_("Graphics"), false)
|
||||
FormGraphics::FormGraphics(Dialog & parent)
|
||||
: base_class(parent, _("Graphics"), false)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#define FORMGRAPHICS_H
|
||||
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "FormDialogView.h"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
@ -28,10 +28,11 @@ struct FD_graphics_extra;
|
||||
|
||||
/** This class provides an XForms implementation of the Graphics Dialog.
|
||||
*/
|
||||
class FormGraphics : public FormCB<ControlGraphics, FormDB<FD_graphics> > {
|
||||
class FormGraphics
|
||||
: public FormController<ControlGraphics, FormView<FD_graphics> > {
|
||||
public:
|
||||
///
|
||||
FormGraphics();
|
||||
FormGraphics(Dialog &);
|
||||
private:
|
||||
|
||||
/** Redraw the form (on receipt of a Signal indicating, for example,
|
||||
|
@ -64,7 +64,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthWest FL_SouthWest
|
||||
name: button_restore
|
||||
callback: C_FormBaseRestoreCB
|
||||
callback: C_FormDialogView_RestoreCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -82,7 +82,7 @@ shortcut: ^M
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_ok
|
||||
callback: C_FormBaseOKCB
|
||||
callback: C_FormDialogView_OKCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -100,7 +100,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_close
|
||||
callback: C_FormBaseCancelCB
|
||||
callback: C_FormDialogView_CancelCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -118,7 +118,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_apply
|
||||
callback: C_FormBaseApplyCB
|
||||
callback: C_FormDialogView_ApplyCB
|
||||
argument: 0
|
||||
|
||||
=============== FORM ===============
|
||||
@ -178,7 +178,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_North FL_NorthEast
|
||||
name: input_filename
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -196,7 +196,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NorthEast FL_NorthEast
|
||||
name: button_browse
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -232,7 +232,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_East FL_East
|
||||
name: check_draft
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -250,7 +250,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_East FL_East
|
||||
name: check_nounzip
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -268,7 +268,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_West FL_East
|
||||
name: input_lyxscale
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -286,7 +286,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_West FL_East
|
||||
name: input_width
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -304,7 +304,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_East FL_East
|
||||
name: choice_width
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -322,7 +322,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_East FL_East
|
||||
name: choice_height
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -340,7 +340,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_West FL_West
|
||||
name: check_aspectratio
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -358,7 +358,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_West FL_East
|
||||
name: input_height
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -394,7 +394,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_East FL_East
|
||||
name: choice_display
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
=============== FORM ===============
|
||||
@ -436,7 +436,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_North FL_North
|
||||
name: input_bb_x1
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -454,7 +454,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_North FL_North
|
||||
name: input_bb_y1
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -472,7 +472,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_North FL_North
|
||||
name: input_bb_x0
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -490,7 +490,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_North FL_North
|
||||
name: input_bb_y0
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -544,7 +544,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_North FL_North
|
||||
name: choice_bb_units
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -562,7 +562,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NorthWest FL_NorthWest
|
||||
name: check_clip
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -580,7 +580,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NorthWest FL_NorthWest
|
||||
name: button_getBB
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
=============== FORM ===============
|
||||
@ -640,7 +640,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_West FL_East
|
||||
name: input_special
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -676,7 +676,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_North FL_North
|
||||
name: choice_origin
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -694,7 +694,7 @@ shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_West FL_West
|
||||
name: check_subcaption
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -712,7 +712,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_North FL_North
|
||||
name: input_rotate_angle
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -730,7 +730,7 @@ shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_West FL_East
|
||||
name: input_subcaption
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
==============================
|
||||
|
@ -1,5 +1,10 @@
|
||||
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insetgraphics.[Ch]: define a new class InsetGraphicsMailer and use
|
||||
it to communicate with the frontend dialogs.
|
||||
|
||||
cd src2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insetexternal.C: remove operator== and operator!= for
|
||||
InsetExternal::Params. They were used only by the old controller
|
||||
scheme.
|
||||
|
@ -64,20 +64,19 @@ TODO
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "converter.h"
|
||||
#include "format.h"
|
||||
#include "frontends/Painter.h"
|
||||
#include "lyxrc.h"
|
||||
#include "frontends/font_metrics.h"
|
||||
#include "debug.h"
|
||||
#include "format.h"
|
||||
#include "funcrequest.h"
|
||||
#include "gettext.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "lyxlex.h"
|
||||
#include "lyxrc.h"
|
||||
|
||||
#include "frontends/Alert.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "frontends/font_metrics.h"
|
||||
#include "frontends/LyXView.h"
|
||||
|
||||
#include "frontends/controllers/helper_funcs.h" // getVectorFromString
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
#include "support/LAssert.h"
|
||||
#include "support/filetools.h"
|
||||
@ -213,8 +212,41 @@ Inset * InsetGraphics::clone(Buffer const & buffer, bool same_id) const
|
||||
|
||||
InsetGraphics::~InsetGraphics()
|
||||
{
|
||||
// Emits the hide signal to the dialog connected (if any)
|
||||
hideDialog();
|
||||
InsetGraphicsMailer mailer(*this);
|
||||
mailer.hideDialog();
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetGraphics::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
dispatch_result result = UNDISPATCHED;
|
||||
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetGraphicsParams p;
|
||||
InsetGraphicsMailer::string2params(cmd.argument, p);
|
||||
if (p.filename.empty())
|
||||
break;
|
||||
|
||||
string const filepath = cmd.view()->buffer()->filePath();
|
||||
setParams(p, filepath);
|
||||
cmd.view()->updateInset(this, true);
|
||||
result = DISPATCHED;
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_INSET_DIALOG_UPDATE: {
|
||||
InsetGraphicsMailer mailer(*this);
|
||||
mailer.updateDialog();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
result = DISPATCHED;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -301,6 +333,12 @@ int InsetGraphics::width(BufferView *, LyXFont const & font) const
|
||||
}
|
||||
|
||||
|
||||
BufferView * InsetGraphics::view() const
|
||||
{
|
||||
return cache_->view.lock().get();
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
||||
int baseline, float & x, bool) const
|
||||
{
|
||||
@ -394,9 +432,10 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphics::edit(BufferView *bv, int, int, mouse_button::state)
|
||||
void InsetGraphics::edit(BufferView *, int, int, mouse_button::state)
|
||||
{
|
||||
bv->owner()->getDialogs().showGraphics(this);
|
||||
InsetGraphicsMailer mailer(*this);
|
||||
mailer.showDialog();
|
||||
}
|
||||
|
||||
|
||||
@ -833,3 +872,50 @@ InsetGraphicsParams const & InsetGraphics::params() const
|
||||
{
|
||||
return params_;
|
||||
}
|
||||
|
||||
|
||||
string const InsetGraphicsMailer::name_("graphics");
|
||||
|
||||
InsetGraphicsMailer::InsetGraphicsMailer(InsetGraphics & inset)
|
||||
: inset_(inset)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetGraphicsMailer::inset2string() const
|
||||
{
|
||||
return params2string(inset_.params());
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphicsMailer::string2params(string const & in,
|
||||
InsetGraphicsParams & params)
|
||||
{
|
||||
params = InsetGraphicsParams();
|
||||
|
||||
istringstream data(in);
|
||||
LyXLex lex(0,0);
|
||||
lex.setStream(data);
|
||||
|
||||
if (lex.isOK()) {
|
||||
lex.next();
|
||||
string const token = lex.getString();
|
||||
if (token != name_)
|
||||
return;
|
||||
}
|
||||
|
||||
InsetGraphics inset;
|
||||
inset.readInsetGraphics(lex);
|
||||
params = inset.params();
|
||||
}
|
||||
|
||||
|
||||
string const
|
||||
InsetGraphicsMailer::params2string(InsetGraphicsParams const & params)
|
||||
{
|
||||
ostringstream data;
|
||||
data << name_ << ' ';
|
||||
params.Write(data);
|
||||
data << "\\end_inset\n";
|
||||
|
||||
return data.str();
|
||||
}
|
||||
|
@ -18,8 +18,6 @@
|
||||
#include "insets/inset.h"
|
||||
#include "insets/insetgraphicsParams.h"
|
||||
|
||||
// We need a signal here to hide an active dialog when we are deleted.
|
||||
#include <boost/signals/signal0.hpp>
|
||||
#include <boost/signals/trackable.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
@ -37,6 +35,8 @@ public:
|
||||
///
|
||||
~InsetGraphics();
|
||||
///
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
int ascent(BufferView *, LyXFont const &) const;
|
||||
///
|
||||
int descent(BufferView *, LyXFont const &) const;
|
||||
@ -88,12 +88,13 @@ public:
|
||||
/// Get the inset parameters, used by the GUIndependent dialog.
|
||||
InsetGraphicsParams const & params() const;
|
||||
|
||||
/** This signal is connected by our dialog and called when the inset
|
||||
is deleted.
|
||||
*/
|
||||
boost::signal0<void> hideDialog;
|
||||
|
||||
private:
|
||||
/// Returns the cached BufferView.
|
||||
BufferView * view() const;
|
||||
|
||||
///
|
||||
friend class InsetGraphicsMailer;
|
||||
|
||||
/// Is the image ready to draw, or should we display a message instead?
|
||||
bool imageIsDrawable() const;
|
||||
|
||||
@ -125,4 +126,28 @@ private:
|
||||
boost::scoped_ptr<Cache> const cache_;
|
||||
};
|
||||
|
||||
|
||||
#include "mailinset.h"
|
||||
|
||||
class InsetGraphicsMailer : public MailInset {
|
||||
public:
|
||||
///
|
||||
InsetGraphicsMailer(InsetGraphics & inset);
|
||||
///
|
||||
virtual Inset & inset() const { return inset_; }
|
||||
///
|
||||
virtual string const & name() const { return name_; }
|
||||
///
|
||||
virtual string const inset2string() const;
|
||||
///
|
||||
static void string2params(string const &, InsetGraphicsParams &);
|
||||
///
|
||||
static string const params2string(InsetGraphicsParams const &);
|
||||
private:
|
||||
///
|
||||
static string const name_;
|
||||
///
|
||||
InsetGraphics & inset_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -543,9 +543,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
|
||||
case LFUN_INSET_ERT:
|
||||
code = Inset::ERT_CODE;
|
||||
break;
|
||||
case LFUN_INSET_GRAPHICS:
|
||||
code = Inset::GRAPHICS_CODE;
|
||||
break;
|
||||
case LFUN_INSET_FOOTNOTE:
|
||||
code = Inset::FOOT_CODE;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user