mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +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:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
lyx_view_->showMiniBuffer(true);
|
||||
lyx_view_->dispatch(cmd);
|
||||
break;
|
||||
|
||||
case LFUN_CANCEL:
|
||||
@ -1085,7 +1085,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
case LFUN_BUFFER_EXPORT:
|
||||
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
|
||||
if (argument == "custom")
|
||||
lyx_view_->getDialogs().show("sendto");
|
||||
lyx_view_->showDialog("sendto");
|
||||
else
|
||||
lyx_view_->buffer()->doExport(argument, false);
|
||||
break;
|
||||
@ -1439,7 +1439,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
if (name == "character") {
|
||||
data = freefont2string();
|
||||
if (!data.empty())
|
||||
lyx_view_->getDialogs().show("character", data);
|
||||
lyx_view_->showDialogWithData("character", data);
|
||||
} else if (name == "latexlog") {
|
||||
Buffer::LogType type;
|
||||
string const logfile = lyx_view_->buffer()->logName(&type);
|
||||
@ -1452,13 +1452,13 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
}
|
||||
data += Lexer::quoteString(logfile);
|
||||
lyx_view_->getDialogs().show("log", data);
|
||||
lyx_view_->showDialogWithData("log", data);
|
||||
} else if (name == "vclog") {
|
||||
string const data = "vc " +
|
||||
Lexer::quoteString(lyx_view_->buffer()->lyxvc().getLogFile());
|
||||
lyx_view_->getDialogs().show("log", data);
|
||||
lyx_view_->showDialogWithData("log", data);
|
||||
} else
|
||||
lyx_view_->getDialogs().show(name, data);
|
||||
lyx_view_->showDialogWithData(name, data);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1570,7 +1570,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
} else if (name == "paragraph") {
|
||||
dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
|
||||
} else if (name == "prefs") {
|
||||
lyx_view_->getDialogs().update(name, string());
|
||||
lyx_view_->updateDialog(name, string());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -100,7 +100,6 @@ public:
|
||||
///
|
||||
virtual bool isToolbarVisible(std::string const & id) = 0;
|
||||
///
|
||||
virtual void showMiniBuffer(bool visible) = 0;
|
||||
virtual void openMenu(docstring const & name) = 0;
|
||||
|
||||
/// get access to the dialogs
|
||||
|
@ -12,10 +12,10 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "GuiView.h"
|
||||
|
||||
#include "GuiCommandBuffer.h"
|
||||
|
||||
#include "GuiCommandEdit.h"
|
||||
#include "GuiView.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "BufferView.h"
|
||||
@ -87,7 +87,7 @@ protected:
|
||||
|
||||
|
||||
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(),
|
||||
back_inserter(commands_), firster());
|
||||
@ -266,13 +266,13 @@ string const GuiCommandBuffer::historyDown()
|
||||
|
||||
docstring const GuiCommandBuffer::getCurrentState() const
|
||||
{
|
||||
return lv_.view()->cursor().currentState();
|
||||
return view_->view()->cursor().currentState();
|
||||
}
|
||||
|
||||
|
||||
void GuiCommandBuffer::hide() const
|
||||
{
|
||||
lv_.showMiniBuffer(false);
|
||||
view_->showMiniBuffer(false);
|
||||
}
|
||||
|
||||
|
||||
@ -324,7 +324,7 @@ void GuiCommandBuffer::dispatch(string const & str)
|
||||
history_pos_ = history_.end();
|
||||
FuncRequest func = lyxaction.lookupFunc(str);
|
||||
func.origin = FuncRequest::COMMANDBUFFER;
|
||||
lv_.dispatch(func);
|
||||
view_->dispatch(func);
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
|
@ -25,7 +25,6 @@ class QListWidgetItem;
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class LyXView;
|
||||
class GuiView;
|
||||
class GuiCommandEdit;
|
||||
|
||||
@ -54,8 +53,6 @@ public Q_SLOTS:
|
||||
private:
|
||||
/// owning view
|
||||
GuiView * view_;
|
||||
///
|
||||
LyXView & lv_;
|
||||
/// command widget
|
||||
GuiCommandEdit * edit_;
|
||||
|
||||
|
@ -684,12 +684,6 @@ void GuiView::updateStatusBar()
|
||||
}
|
||||
|
||||
|
||||
void GuiView::activated(FuncRequest const & func)
|
||||
{
|
||||
dispatch(func);
|
||||
}
|
||||
|
||||
|
||||
bool GuiView::hasFocus() const
|
||||
{
|
||||
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)
|
||||
{
|
||||
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
|
||||
{
|
||||
return d.current_work_area_;
|
||||
@ -1225,11 +1205,15 @@ void GuiView::resetAutosaveTimers()
|
||||
|
||||
void GuiView::dispatch(FuncRequest const & cmd)
|
||||
{
|
||||
string const argument = to_utf8(cmd.argument());
|
||||
switch(cmd.action) {
|
||||
case LFUN_BUFFER_SWITCH:
|
||||
setBuffer(theBufferList().getBuffer(to_utf8(cmd.argument())));
|
||||
break;
|
||||
|
||||
case LFUN_COMMAND_EXECUTE:
|
||||
showMiniBuffer(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
theLyXFunc().setLyXView(this);
|
||||
lyx::dispatch(cmd);
|
||||
|
@ -81,19 +81,9 @@ public:
|
||||
void updateToolbars();
|
||||
ToolbarInfo * getToolbarInfo(std::string const & name);
|
||||
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();
|
||||
|
||||
///
|
||||
void addTabWorkArea();
|
||||
|
||||
/// dispatch to current BufferView
|
||||
void dispatch(FuncRequest const & cmd);
|
||||
|
||||
@ -103,34 +93,45 @@ public:
|
||||
/// set a buffer to the current workarea.
|
||||
void setBuffer(Buffer * b); ///< \c Buffer to set.
|
||||
|
||||
Q_SIGNALS:
|
||||
void closing(int);
|
||||
/// GuiBufferDelegate.
|
||||
///@{
|
||||
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();
|
||||
////
|
||||
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);
|
||||
|
||||
/// 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
|
||||
void smallSizedIcons();
|
||||
void normalSizedIcons();
|
||||
void bigSizedIcons();
|
||||
/// 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?
|
||||
|
||||
private:
|
||||
friend class GuiWorkArea;
|
||||
|
||||
/// make sure we quit cleanly
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
/** 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 *);
|
||||
///
|
||||
virtual void resizeEvent(QResizeEvent * e);
|
||||
///
|
||||
virtual void moveEvent(QMoveEvent * e);
|
||||
void restartCursor();
|
||||
|
||||
/// \return the \c Workarea associated to \p Buffer
|
||||
/// \retval 0 if no \c WorkArea is found.
|
||||
@ -146,17 +147,30 @@ private:
|
||||
void removeWorkArea(GuiWorkArea * work_area);
|
||||
/// return the current WorkArea (the one that has the focus).
|
||||
GuiWorkArea const * currentWorkArea() const;
|
||||
/// FIXME: This non-const access is needed because of
|
||||
/// a mis-designed \c ControlSpellchecker.
|
||||
GuiWorkArea * currentWorkArea();
|
||||
|
||||
/// GuiBufferDelegate.
|
||||
///@{
|
||||
void resetAutosaveTimers();
|
||||
void errors(std::string const &);
|
||||
void structureChanged() { updateToc(); }
|
||||
///@}
|
||||
Q_SIGNALS:
|
||||
void closing(int);
|
||||
|
||||
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
|
||||
void connectBufferView(BufferView & bv);
|
||||
@ -166,57 +180,27 @@ private:
|
||||
void connectBuffer(Buffer & buf);
|
||||
/// disconnect from signals in the given buffer
|
||||
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 dragEnterEvent(QDragEnterEvent * 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.
|
||||
bool event(QEvent * e);
|
||||
bool focusNextPrevChild(bool);
|
||||
///
|
||||
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;
|
||||
GuiViewPrivate & d;
|
||||
@ -230,8 +214,6 @@ private:
|
||||
///
|
||||
QRect floatingGeometry_;
|
||||
|
||||
void setIconSize(unsigned int size);
|
||||
|
||||
struct ToolbarSize {
|
||||
int top_width;
|
||||
int bottom_width;
|
||||
|
Loading…
Reference in New Issue
Block a user