mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Some more cosmetics and removal of unused methods in GuiView.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21582 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f111a8e322
commit
fcdc4f8a6b
@ -951,7 +951,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
|
|
||||||
case LFUN_COMMAND_EXECUTE:
|
case LFUN_COMMAND_EXECUTE:
|
||||||
BOOST_ASSERT(lyx_view_);
|
BOOST_ASSERT(lyx_view_);
|
||||||
lyx_view_->showMiniBuffer(true);
|
lyx_view_->dispatch(cmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_CANCEL:
|
case LFUN_CANCEL:
|
||||||
@ -1085,7 +1085,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
case LFUN_BUFFER_EXPORT:
|
case LFUN_BUFFER_EXPORT:
|
||||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||||
if (argument == "custom")
|
if (argument == "custom")
|
||||||
lyx_view_->getDialogs().show("sendto");
|
lyx_view_->showDialog("sendto");
|
||||||
else
|
else
|
||||||
lyx_view_->buffer()->doExport(argument, false);
|
lyx_view_->buffer()->doExport(argument, false);
|
||||||
break;
|
break;
|
||||||
@ -1439,7 +1439,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
if (name == "character") {
|
if (name == "character") {
|
||||||
data = freefont2string();
|
data = freefont2string();
|
||||||
if (!data.empty())
|
if (!data.empty())
|
||||||
lyx_view_->getDialogs().show("character", data);
|
lyx_view_->showDialogWithData("character", data);
|
||||||
} else if (name == "latexlog") {
|
} else if (name == "latexlog") {
|
||||||
Buffer::LogType type;
|
Buffer::LogType type;
|
||||||
string const logfile = lyx_view_->buffer()->logName(&type);
|
string const logfile = lyx_view_->buffer()->logName(&type);
|
||||||
@ -1452,13 +1452,13 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
data += Lexer::quoteString(logfile);
|
data += Lexer::quoteString(logfile);
|
||||||
lyx_view_->getDialogs().show("log", data);
|
lyx_view_->showDialogWithData("log", data);
|
||||||
} else if (name == "vclog") {
|
} else if (name == "vclog") {
|
||||||
string const data = "vc " +
|
string const data = "vc " +
|
||||||
Lexer::quoteString(lyx_view_->buffer()->lyxvc().getLogFile());
|
Lexer::quoteString(lyx_view_->buffer()->lyxvc().getLogFile());
|
||||||
lyx_view_->getDialogs().show("log", data);
|
lyx_view_->showDialogWithData("log", data);
|
||||||
} else
|
} else
|
||||||
lyx_view_->getDialogs().show(name, data);
|
lyx_view_->showDialogWithData(name, data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1570,7 +1570,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
} else if (name == "paragraph") {
|
} else if (name == "paragraph") {
|
||||||
dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
|
dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
|
||||||
} else if (name == "prefs") {
|
} else if (name == "prefs") {
|
||||||
lyx_view_->getDialogs().update(name, string());
|
lyx_view_->updateDialog(name, string());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,6 @@ public:
|
|||||||
///
|
///
|
||||||
virtual bool isToolbarVisible(std::string const & id) = 0;
|
virtual bool isToolbarVisible(std::string const & id) = 0;
|
||||||
///
|
///
|
||||||
virtual void showMiniBuffer(bool visible) = 0;
|
|
||||||
virtual void openMenu(docstring const & name) = 0;
|
virtual void openMenu(docstring const & name) = 0;
|
||||||
|
|
||||||
/// get access to the dialogs
|
/// get access to the dialogs
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "GuiView.h"
|
|
||||||
|
|
||||||
#include "GuiCommandBuffer.h"
|
#include "GuiCommandBuffer.h"
|
||||||
|
|
||||||
#include "GuiCommandEdit.h"
|
#include "GuiCommandEdit.h"
|
||||||
|
#include "GuiView.h"
|
||||||
#include "qt_helpers.h"
|
#include "qt_helpers.h"
|
||||||
|
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
@ -87,7 +87,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
GuiCommandBuffer::GuiCommandBuffer(GuiView * view)
|
GuiCommandBuffer::GuiCommandBuffer(GuiView * view)
|
||||||
: view_(view), lv_(*view), history_pos_(history_.end())
|
: view_(view), history_pos_(history_.end())
|
||||||
{
|
{
|
||||||
transform(lyxaction.func_begin(), lyxaction.func_end(),
|
transform(lyxaction.func_begin(), lyxaction.func_end(),
|
||||||
back_inserter(commands_), firster());
|
back_inserter(commands_), firster());
|
||||||
@ -266,13 +266,13 @@ string const GuiCommandBuffer::historyDown()
|
|||||||
|
|
||||||
docstring const GuiCommandBuffer::getCurrentState() const
|
docstring const GuiCommandBuffer::getCurrentState() const
|
||||||
{
|
{
|
||||||
return lv_.view()->cursor().currentState();
|
return view_->view()->cursor().currentState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiCommandBuffer::hide() const
|
void GuiCommandBuffer::hide() const
|
||||||
{
|
{
|
||||||
lv_.showMiniBuffer(false);
|
view_->showMiniBuffer(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ void GuiCommandBuffer::dispatch(string const & str)
|
|||||||
history_pos_ = history_.end();
|
history_pos_ = history_.end();
|
||||||
FuncRequest func = lyxaction.lookupFunc(str);
|
FuncRequest func = lyxaction.lookupFunc(str);
|
||||||
func.origin = FuncRequest::COMMANDBUFFER;
|
func.origin = FuncRequest::COMMANDBUFFER;
|
||||||
lv_.dispatch(func);
|
view_->dispatch(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
|
@ -25,7 +25,6 @@ class QListWidgetItem;
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
class LyXView;
|
|
||||||
class GuiView;
|
class GuiView;
|
||||||
class GuiCommandEdit;
|
class GuiCommandEdit;
|
||||||
|
|
||||||
@ -54,8 +53,6 @@ public Q_SLOTS:
|
|||||||
private:
|
private:
|
||||||
/// owning view
|
/// owning view
|
||||||
GuiView * view_;
|
GuiView * view_;
|
||||||
///
|
|
||||||
LyXView & lv_;
|
|
||||||
/// command widget
|
/// command widget
|
||||||
GuiCommandEdit * edit_;
|
GuiCommandEdit * edit_;
|
||||||
|
|
||||||
|
@ -684,12 +684,6 @@ void GuiView::updateStatusBar()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiView::activated(FuncRequest const & func)
|
|
||||||
{
|
|
||||||
dispatch(func);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool GuiView::hasFocus() const
|
bool GuiView::hasFocus() const
|
||||||
{
|
{
|
||||||
return qApp->activeWindow() == this;
|
return qApp->activeWindow() == this;
|
||||||
@ -785,14 +779,6 @@ bool GuiView::focusNextPrevChild(bool /*next*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiView::showView()
|
|
||||||
{
|
|
||||||
setWindowTitle(qt_("LyX"));
|
|
||||||
show();
|
|
||||||
updateFloatingGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GuiView::setBusy(bool yes)
|
void GuiView::setBusy(bool yes)
|
||||||
{
|
{
|
||||||
if (d.current_work_area_) {
|
if (d.current_work_area_) {
|
||||||
@ -900,12 +886,6 @@ void GuiView::addTabWorkArea()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GuiWorkArea * GuiView::currentWorkArea()
|
|
||||||
{
|
|
||||||
return d.current_work_area_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GuiWorkArea const * GuiView::currentWorkArea() const
|
GuiWorkArea const * GuiView::currentWorkArea() const
|
||||||
{
|
{
|
||||||
return d.current_work_area_;
|
return d.current_work_area_;
|
||||||
@ -1225,11 +1205,15 @@ void GuiView::resetAutosaveTimers()
|
|||||||
|
|
||||||
void GuiView::dispatch(FuncRequest const & cmd)
|
void GuiView::dispatch(FuncRequest const & cmd)
|
||||||
{
|
{
|
||||||
string const argument = to_utf8(cmd.argument());
|
|
||||||
switch(cmd.action) {
|
switch(cmd.action) {
|
||||||
case LFUN_BUFFER_SWITCH:
|
case LFUN_BUFFER_SWITCH:
|
||||||
setBuffer(theBufferList().getBuffer(to_utf8(cmd.argument())));
|
setBuffer(theBufferList().getBuffer(to_utf8(cmd.argument())));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LFUN_COMMAND_EXECUTE:
|
||||||
|
showMiniBuffer(true);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
theLyXFunc().setLyXView(this);
|
theLyXFunc().setLyXView(this);
|
||||||
lyx::dispatch(cmd);
|
lyx::dispatch(cmd);
|
||||||
|
@ -81,19 +81,9 @@ public:
|
|||||||
void updateToolbars();
|
void updateToolbars();
|
||||||
ToolbarInfo * getToolbarInfo(std::string const & name);
|
ToolbarInfo * getToolbarInfo(std::string const & name);
|
||||||
void toggleToolbarState(std::string const & name, bool allowauto);
|
void toggleToolbarState(std::string const & name, bool allowauto);
|
||||||
|
|
||||||
/// show - display the top-level window
|
|
||||||
void showView();
|
|
||||||
|
|
||||||
/// menu item has been selected
|
|
||||||
void activated(FuncRequest const &);
|
|
||||||
|
|
||||||
///
|
///
|
||||||
QMenu * createPopupMenu();
|
QMenu * createPopupMenu();
|
||||||
|
|
||||||
///
|
|
||||||
void addTabWorkArea();
|
|
||||||
|
|
||||||
/// dispatch to current BufferView
|
/// dispatch to current BufferView
|
||||||
void dispatch(FuncRequest const & cmd);
|
void dispatch(FuncRequest const & cmd);
|
||||||
|
|
||||||
@ -103,34 +93,45 @@ public:
|
|||||||
/// set a buffer to the current workarea.
|
/// set a buffer to the current workarea.
|
||||||
void setBuffer(Buffer * b); ///< \c Buffer to set.
|
void setBuffer(Buffer * b); ///< \c Buffer to set.
|
||||||
|
|
||||||
Q_SIGNALS:
|
/// GuiBufferDelegate.
|
||||||
void closing(int);
|
///@{
|
||||||
|
void resetAutosaveTimers();
|
||||||
|
void errors(std::string const &);
|
||||||
|
void structureChanged() { updateToc(); }
|
||||||
|
///@}
|
||||||
|
|
||||||
public Q_SLOTS:
|
////
|
||||||
/// idle timeout.
|
void showDialog(std::string const & name);
|
||||||
/// clear any temporary message and replace with current status.
|
void showDialogWithData(std::string const & name,
|
||||||
void clearMessage();
|
std::string const & data);
|
||||||
|
void showInsetDialog(std::string const & name,
|
||||||
|
std::string const & data, Inset * inset);
|
||||||
|
void updateDialog(std::string const & name,
|
||||||
|
std::string const & data);
|
||||||
|
|
||||||
|
/// called on timeout
|
||||||
|
void autoSave();
|
||||||
///
|
///
|
||||||
void updateWindowTitle(GuiWorkArea * wa);
|
void updateEmbeddedFiles();
|
||||||
|
|
||||||
|
/// \return the current buffer view.
|
||||||
|
BufferView * view();
|
||||||
|
|
||||||
|
/// get access to the dialogs
|
||||||
|
Dialogs & getDialogs() { return *dialogs_; }
|
||||||
///
|
///
|
||||||
void on_currentWorkAreaChanged(GuiWorkArea *);
|
Dialogs const & getDialogs() const { return *dialogs_; }
|
||||||
|
|
||||||
/// slots to change the icon size
|
/// load a buffer into the current workarea.
|
||||||
void smallSizedIcons();
|
Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
|
||||||
void normalSizedIcons();
|
bool tolastfiles = true); ///< append to the "Open recent" menu?
|
||||||
void bigSizedIcons();
|
|
||||||
|
|
||||||
private:
|
/** redraw \c inset in all the BufferViews in which it is currently
|
||||||
friend class GuiWorkArea;
|
* visible. If successful return a pointer to the owning Buffer.
|
||||||
|
*/
|
||||||
/// make sure we quit cleanly
|
Buffer const * updateInset(Inset const *);
|
||||||
virtual void closeEvent(QCloseEvent * e);
|
|
||||||
///
|
///
|
||||||
virtual void resizeEvent(QResizeEvent * e);
|
void restartCursor();
|
||||||
///
|
|
||||||
virtual void moveEvent(QMoveEvent * e);
|
|
||||||
|
|
||||||
/// \return the \c Workarea associated to \p Buffer
|
/// \return the \c Workarea associated to \p Buffer
|
||||||
/// \retval 0 if no \c WorkArea is found.
|
/// \retval 0 if no \c WorkArea is found.
|
||||||
@ -146,17 +147,30 @@ private:
|
|||||||
void removeWorkArea(GuiWorkArea * work_area);
|
void removeWorkArea(GuiWorkArea * work_area);
|
||||||
/// return the current WorkArea (the one that has the focus).
|
/// return the current WorkArea (the one that has the focus).
|
||||||
GuiWorkArea const * currentWorkArea() const;
|
GuiWorkArea const * currentWorkArea() const;
|
||||||
/// FIXME: This non-const access is needed because of
|
|
||||||
/// a mis-designed \c ControlSpellchecker.
|
|
||||||
GuiWorkArea * currentWorkArea();
|
|
||||||
|
|
||||||
/// GuiBufferDelegate.
|
Q_SIGNALS:
|
||||||
///@{
|
void closing(int);
|
||||||
void resetAutosaveTimers();
|
|
||||||
void errors(std::string const &);
|
|
||||||
void structureChanged() { updateToc(); }
|
|
||||||
///@}
|
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
/// idle timeout.
|
||||||
|
/// clear any temporary message and replace with current status.
|
||||||
|
void clearMessage();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
///
|
||||||
|
void updateWindowTitle(GuiWorkArea * wa);
|
||||||
|
|
||||||
|
///
|
||||||
|
void on_currentWorkAreaChanged(GuiWorkArea *);
|
||||||
|
|
||||||
|
/// slots to change the icon size
|
||||||
|
void smallSizedIcons();
|
||||||
|
void normalSizedIcons();
|
||||||
|
void bigSizedIcons();
|
||||||
|
|
||||||
|
private:
|
||||||
|
///
|
||||||
|
void addTabWorkArea();
|
||||||
|
|
||||||
/// connect to signals in the given BufferView
|
/// connect to signals in the given BufferView
|
||||||
void connectBufferView(BufferView & bv);
|
void connectBufferView(BufferView & bv);
|
||||||
@ -166,57 +180,27 @@ private:
|
|||||||
void connectBuffer(Buffer & buf);
|
void connectBuffer(Buffer & buf);
|
||||||
/// disconnect from signals in the given buffer
|
/// disconnect from signals in the given buffer
|
||||||
void disconnectBuffer();
|
void disconnectBuffer();
|
||||||
|
|
||||||
////
|
|
||||||
void showDialog(std::string const & name);
|
|
||||||
void showDialogWithData(std::string const & name,
|
|
||||||
std::string const & data);
|
|
||||||
void showInsetDialog(std::string const & name,
|
|
||||||
std::string const & data, Inset * inset);
|
|
||||||
void updateDialog(std::string const & name,
|
|
||||||
std::string const & data);
|
|
||||||
|
|
||||||
///
|
///
|
||||||
void updateToc();
|
void updateToc();
|
||||||
|
|
||||||
///
|
///
|
||||||
void dragEnterEvent(QDragEnterEvent * ev);
|
void dragEnterEvent(QDragEnterEvent * ev);
|
||||||
///
|
///
|
||||||
void dropEvent(QDropEvent * ev);
|
void dropEvent(QDropEvent * ev);
|
||||||
|
/// make sure we quit cleanly
|
||||||
|
virtual void closeEvent(QCloseEvent * e);
|
||||||
|
///
|
||||||
|
virtual void resizeEvent(QResizeEvent * e);
|
||||||
|
///
|
||||||
|
virtual void moveEvent(QMoveEvent * e);
|
||||||
|
|
||||||
/// in order to catch Tab key press.
|
/// in order to catch Tab key press.
|
||||||
bool event(QEvent * e);
|
bool event(QEvent * e);
|
||||||
bool focusNextPrevChild(bool);
|
bool focusNextPrevChild(bool);
|
||||||
///
|
///
|
||||||
QRect updateFloatingGeometry();
|
QRect updateFloatingGeometry();
|
||||||
/// called on timeout
|
|
||||||
void autoSave();
|
|
||||||
///
|
///
|
||||||
void updateEmbeddedFiles();
|
void setIconSize(unsigned int size);
|
||||||
|
|
||||||
/// \return the current buffer view.
|
|
||||||
BufferView * view();
|
|
||||||
|
|
||||||
/// get access to the dialogs
|
|
||||||
Dialogs & getDialogs() { return *dialogs_; }
|
|
||||||
///
|
|
||||||
Dialogs const & getDialogs() const { return *dialogs_; }
|
|
||||||
|
|
||||||
//@}
|
|
||||||
|
|
||||||
/// load a buffer into the current workarea.
|
|
||||||
Buffer * loadLyXFile(support::FileName const & name, ///< File to load.
|
|
||||||
bool tolastfiles = true); ///< append to the "Open recent" menu?
|
|
||||||
|
|
||||||
/** redraw \c inset in all the BufferViews in which it is currently
|
|
||||||
* visible. If successful return a pointer to the owning Buffer.
|
|
||||||
*/
|
|
||||||
Buffer const * updateInset(Inset const *);
|
|
||||||
///
|
|
||||||
void restartCursor();
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
///
|
///
|
||||||
struct GuiViewPrivate;
|
struct GuiViewPrivate;
|
||||||
GuiViewPrivate & d;
|
GuiViewPrivate & d;
|
||||||
@ -230,8 +214,6 @@ private:
|
|||||||
///
|
///
|
||||||
QRect floatingGeometry_;
|
QRect floatingGeometry_;
|
||||||
|
|
||||||
void setIconSize(unsigned int size);
|
|
||||||
|
|
||||||
struct ToolbarSize {
|
struct ToolbarSize {
|
||||||
int top_width;
|
int top_width;
|
||||||
int bottom_width;
|
int bottom_width;
|
||||||
|
Loading…
Reference in New Issue
Block a user