From c778f093ea51c0e5089543573ad7b431f9c310e8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Mon, 28 Apr 2008 05:12:28 +0000 Subject: [PATCH] basic context menu for InsetExternal. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24531 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/ui/stdcontext.inc | 10 ++ src/frontends/qt4/GuiExternal.cpp | 17 --- src/frontends/qt4/GuiExternal.h | 3 - src/frontends/qt4/ui/ExternalUi.ui | 193 ++++++++++++++--------------- src/insets/InsetExternal.cpp | 6 + src/insets/InsetExternal.h | 2 + 6 files changed, 114 insertions(+), 117 deletions(-) diff --git a/lib/ui/stdcontext.inc b/lib/ui/stdcontext.inc index 73f79fd930..69ae783a4b 100644 --- a/lib/ui/stdcontext.inc +++ b/lib/ui/stdcontext.inc @@ -276,6 +276,16 @@ Menuset Item "Edit externally...|x" "inset-edit" End +# +# InsetExternal context menu +# + + Menu "context-external" + Item "Settings...|S" "next-inset-toggle" + Separator + Item "Edit externally...|x" "inset-edit" + End + # # InsetTabular context menu # diff --git a/src/frontends/qt4/GuiExternal.cpp b/src/frontends/qt4/GuiExternal.cpp index 8bbf4f5313..9bcf779077 100644 --- a/src/frontends/qt4/GuiExternal.cpp +++ b/src/frontends/qt4/GuiExternal.cpp @@ -109,8 +109,6 @@ GuiExternal::GuiExternal(GuiView & lv) this, SLOT(change_adaptor())); connect(browsePB, SIGNAL(clicked()), this, SLOT(browseClicked())); - connect(editPB, SIGNAL(clicked()), - this, SLOT(editClicked())); connect(externalCO, SIGNAL(activated(QString)), this, SLOT(templateChanged())); connect(extraED, SIGNAL(textChanged(QString)), @@ -166,7 +164,6 @@ GuiExternal::GuiExternal(GuiView & lv) bc().addReadOnly(fileED); bc().addReadOnly(browsePB); - bc().addReadOnly(editPB); bc().addReadOnly(externalCO); bc().addReadOnly(draftCB); bc().addReadOnly(displayscaleED); @@ -268,12 +265,6 @@ void GuiExternal::change_adaptor() } -void GuiExternal::editClicked() -{ - editExternal(); -} - - void GuiExternal::extraChanged(const QString & text) { extra_[extraFormatCO->currentText()] = text; @@ -698,14 +689,6 @@ void GuiExternal::dispatchParams() } -void GuiExternal::editExternal() -{ - applyView(); - string const lfun = InsetExternal::params2string(params_, buffer()); - dispatch(FuncRequest(LFUN_INSET_EDIT, lfun)); -} - - static QStringList templateFilters(QString const & template_name) { /// Determine the template file extension diff --git a/src/frontends/qt4/GuiExternal.h b/src/frontends/qt4/GuiExternal.h index f7fc31fe2d..19d730f0bb 100644 --- a/src/frontends/qt4/GuiExternal.h +++ b/src/frontends/qt4/GuiExternal.h @@ -35,7 +35,6 @@ private Q_SLOTS: void bbChanged(); void browseClicked(); void change_adaptor(); - void editClicked(); void extraChanged(const QString &); void formatChanged(const QString &); void getbbClicked(); @@ -65,8 +64,6 @@ private: /// bool isBufferDependent() const { return true; } - /// - void editExternal(); /// QString browse(QString const & input_file, QString const & template_name) const; diff --git a/src/frontends/qt4/ui/ExternalUi.ui b/src/frontends/qt4/ui/ExternalUi.ui index 664f9d20d3..65788a7c29 100644 --- a/src/frontends/qt4/ui/ExternalUi.ui +++ b/src/frontends/qt4/ui/ExternalUi.ui @@ -6,7 +6,7 @@ 0 0 390 - 367 + 346 @@ -23,25 +23,68 @@ 6 - - - Qt::Horizontal - - - QSizePolicy::Expanding + + + 0 - - - 20 - 20 - + + 6 - + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + &OK + + + true + + + + + + + &Apply + + + false + + + + + + + &Close + + + false + + + false + + + + - + - 0 + 2 @@ -54,54 +97,7 @@ 6 - - - - &Draft - - - - - - - Edit the file externally - - - &Edit File... - - - - - - - Select a file - - - &Browse... - - - - - - - Filename - - - &File: - - - fileED - - - - - - - Filename - - - - + Template @@ -150,6 +146,43 @@ + + + + Filename + + + + + + + Filename + + + &File: + + + fileED + + + + + + + Select a file + + + &Browse... + + + + + + + &Draft + + + @@ -660,39 +693,6 @@ - - - - &OK - - - true - - - - - - - &Apply - - - false - - - - - - - &Close - - - false - - - false - - - @@ -706,7 +706,6 @@ tab fileED browsePB - editPB externalCO externalTB draftCB diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index 29eded4ab9..63f7b7d96a 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -840,6 +840,12 @@ void InsetExternal::addPreview(graphics::PreviewLoader & ploader) const } +docstring InsetExternal::contextMenu(BufferView const &, int, int) const +{ + return from_ascii("context-external"); +} + + void InsetExternal::string2params(string const & in, Buffer const & buffer, InsetExternalParams & params) { diff --git a/src/insets/InsetExternal.h b/src/insets/InsetExternal.h index 1d1d0d4be5..22a9318a47 100644 --- a/src/insets/InsetExternal.h +++ b/src/insets/InsetExternal.h @@ -120,6 +120,8 @@ public: void setParams(InsetExternalParams const &); /// \returns the number of rows (\n's) of generated code. int latex(odocstream &, OutputParams const &) const; + /// + docstring contextMenu(BufferView const & bv, int x, int y) const; private: /// -- 2.39.2