[EMAIL PROTECTED] wrote:
Author: younes
Date: Sun Mar 25 03:32:12 2007
New Revision: 17539

URL: http://www.lyx.org/trac/changeset/17539
Log:
Cleanup and polish of the Citation dialog:
- now simple citation insertion can be done with the keyboard only (enter key 
will close the dialog and insert the chosen key).
- now search also within bib entry information (very fast)
- new case sensitive option
- new regex option.
- QCitation: code simplified, some code went to ControlCitation.
- QCitationDialog: code simplified
- lots of polish in the dialogs...

Sorry Jose, I didn't wait for your approval here because I won't have much time in the next days and I am sure this commit is a clear improvement over what we had...

Last time I do that, promise.

Abdel.



Modified:
    lyx-devel/trunk/src/frontends/controllers/ControlCitation.C
    lyx-devel/trunk/src/frontends/controllers/ControlCitation.h
    lyx-devel/trunk/src/frontends/qt4/QCitation.C
    lyx-devel/trunk/src/frontends/qt4/QCitation.h
    lyx-devel/trunk/src/frontends/qt4/QCitationDialog.C
    lyx-devel/trunk/src/frontends/qt4/QCitationDialog.h
    lyx-devel/trunk/src/frontends/qt4/ui/QCitationUi.ui

Modified: lyx-devel/trunk/src/frontends/controllers/ControlCitation.C
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/controllers/ControlCitation.C?rev=17539
==============================================================================
--- lyx-devel/trunk/src/frontends/controllers/ControlCitation.C (original)
+++ lyx-devel/trunk/src/frontends/controllers/ControlCitation.C Sun Mar 25 
03:32:12 2007
@@ -4,6 +4,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Angus Leeming
+ * \author Abdelrazak Younes
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -16,6 +17,11 @@
 #include "bufferparams.h"
 #include "debug.h" // temporary
+#include "support/lstrings.h"
+
+#include <boost/regex.hpp>
+
+#include <algorithm>
using std::string;
 using std::vector;
@@ -34,22 +40,19 @@
bool ControlCitation::initialiseParams(string const & data)
 {
-       ControlCommand::initialiseParams(data);
+       if (!ControlCommand::initialiseParams(data))
+               return false;
+
+       biblio::CiteEngine const engine =
+               kernel().buffer().params().getEngine();
+
+       bool use_styles = engine != biblio::ENGINE_BASIC;
vector<pair<string, docstring> > blist;
        kernel().buffer().fillWithBibKeys(blist);
-
-       biblio::CiteEngine const engine = 
kernel().buffer().params().getEngine();
-
-       bool use_styles = engine != biblio::ENGINE_BASIC;
-
-       typedef std::map<string, docstring>::value_type InfoMapValue;
-
-       for (vector<pair<string,string> >::size_type i = 0;
-            i < blist.size(); ++i) {
-               bibkeysInfo_.insert(InfoMapValue(blist[i].first,
-                                                blist[i].second));
-       }
+       bibkeysInfo_.clear();
+       for (size_t i = 0; i < blist.size(); ++i)
+               bibkeysInfo_[blist[i].first] = blist[i].second;
if (citeStyles_.empty())
                citeStyles_ = biblio::getCiteStyles(engine);
@@ -71,15 +74,94 @@
 }
-biblio::InfoMap const & ControlCitation::bibkeysInfo() const
+vector<string> const ControlCitation::availableKeys() const
 {
-       return bibkeysInfo_;
+       return biblio::getKeys(bibkeysInfo_);
 }
-biblio::CiteEngine_enum ControlCitation::getEngine() const
+biblio::CiteEngine const ControlCitation::getEngine() const
 {
        return kernel().buffer().params().getEngine();
+}
+
+
+docstring const ControlCitation::getInfo(std::string const & key) const
+{
+       if (bibkeysInfo_.empty())
+               return docstring();
+
+       return biblio::getInfo(bibkeysInfo_, key);
+}
+
+namespace {
+
+
+// Escape special chars.
+// All characters are literals except: '.|*?+(){}[]^$\'
+// These characters are literals when preceded by a "\", which is done here
+// @todo: This function should be moved to support, and then the test in tests
+//        should be moved there as well.
+docstring const escape_special_chars(docstring const & expr)
+{
+       // Search for all chars '.|*?+(){}[^$]\'
+       // Note that '[' and '\' must be escaped.
+       // This is a limitation of boost::regex, but all other chars in BREs
+       // are assumed literal.
+       boost::regex reg("[].|*?+(){}^$\\[\\\\]");
+
+       // $& is a perl-like expression that expands to all
+       // of the current match
+       // The '$' must be prefixed with the escape character '\' for
+       // boost to treat it as a literal.
+       // Thus, to prefix a matched expression with '\', we use:
+       // FIXME: UNICODE
+       return from_utf8(boost::regex_replace(to_utf8(expr), reg, "\\\\$&"));
+}
+
+} // namespace anon
+
+vector<string> ControlCitation::searchKeys(
+       vector<string> const & keys_to_search,
+       docstring const & search_expression,
+       bool case_sensitive, bool regex)
+{
+       vector<string> foundKeys;
+
+       docstring expr = support::trim(search_expression);
+       if (expr.empty())
+               return foundKeys;
+
+       if (!regex)
+               // We must escape special chars in the search_expr so that
+               // it is treated as a simple string by boost::regex.
+               expr = escape_special_chars(expr);
+
+       boost::regex reg_exp(to_utf8(expr), case_sensitive?
+               boost::regex_constants::normal : boost::regex_constants::icase);
+
+       vector<string>::const_iterator it = keys_to_search.begin();
+       vector<string>::const_iterator end = keys_to_search.end();
+       for (; it != end; ++it ) {
+               biblio::InfoMap::const_iterator info = bibkeysInfo_.find(*it);
+               if (info == bibkeysInfo_.end())
+                       continue;
+
+               string data = *it;
+               // FIXME UNICODE
+               data += ' ' + to_utf8(info->second);
+
+               try {
+                       // Attempts to find a match for the current RE
+                       // somewhere in data.
+                       if (boost::regex_search(data, reg_exp))
+                               foundKeys.push_back(*it);
+               }
+               catch (boost::regex_error &) {
+                       return vector<string>();
+               }
+       }
+       return foundKeys;
 }
Modified: lyx-devel/trunk/src/frontends/controllers/ControlCitation.h
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/controllers/ControlCitation.h?rev=17539
==============================================================================
--- lyx-devel/trunk/src/frontends/controllers/ControlCitation.h (original)
+++ lyx-devel/trunk/src/frontends/controllers/ControlCitation.h Sun Mar 25 
03:32:12 2007
@@ -5,6 +5,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Angus Leeming
+ * \author Abdelrazak Younes
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -25,9 +26,9 @@
 public:
        ///
        ControlCitation(Dialog &);
+       virtual ~ControlCitation() {}
+       virtual bool initialiseParams(std::string const & data);
- ///
-       virtual bool initialiseParams(std::string const & data);
        /// clean-up on hide.
        virtual void clearParams();
@@ -36,13 +37,24 @@
         */
        virtual bool disconnectOnApply() const { return true; }
- /// Returns a reference to the map of stored keys
-       biblio::InfoMap const & bibkeysInfo() const;
+       /// \return the list of all available bibliography keys.
+       std::vector<std::string> const availableKeys() const;
+       ///
+       biblio::CiteEngine const getEngine() const;
- ///
-       biblio::CiteEngine_enum getEngine() const;
+       /// \return information for this key.
+       docstring const getInfo(std::string const & key) const;
- /// Possible citations based on this key
+       /// Search a given string within the passed keys.
+       /// \return the vector of matched keys.
+       std::vector<std::string> searchKeys(
+               std::vector<std::string> const & keys_to_search, //< Keys to 
search.
+               docstring const & search_expression, //< Search expression 
(regex possible)
+               bool case_sensitive = false, // set to true is the search 
should be case sensitive
+               bool regex = false /// \set to true if \c search_expression is 
a regex
+               ); //
+
+       /// \return possible citations based on this key.
        std::vector<docstring> const getCiteStrings(std::string const & key) 
const;
/// available CiteStyle-s (depends on availability of Natbib/Jurabib)

Modified: lyx-devel/trunk/src/frontends/qt4/QCitation.C
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/QCitation.C?rev=17539
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/QCitation.C (original)
+++ lyx-devel/trunk/src/frontends/qt4/QCitation.C Sun Mar 25 03:32:12 2007
@@ -5,23 +5,20 @@
  *
  * \author Angus Leeming
  * \author Kalle Dalheimer
+ * \author Abdelrazak Younes
  *
  * Full author contact details are available in file CREDITS.
  */
#include <config.h> -#include "ControlCitation.h"
 #include "QCitation.h"
-#include "Qt2BC.h"
+
 #include "qt_helpers.h"
-#include "bufferparams.h"
-
-#include "controllers/ButtonController.h"
-#include "controllers/ControlCitation.h"
-
 #include "support/lstrings.h"
+
+#include "debug.h"
#include <vector>
 #include <string>
@@ -32,7 +29,7 @@
namespace { -template<typename String> static QStringList toQStringList(vector<String> const & v)
+template<typename String> static QStringList to_qstring_list(vector<String> const 
& v)
 {
        QStringList qlist;
@@ -44,6 +41,18 @@
        return qlist;
 }
+
+vector<string> const to_string_vector(QStringList const & qlist)
+{
+       vector<string> v;
+       for (size_t i=0; i != qlist.size(); ++i) {
+               if (qlist[i].isEmpty())
+                       continue;
+               v.push_back(lyx::fromqstr(qlist[i]));
+       }
+       return v;
+}
+
 }
@@ -60,7 +69,7 @@
 void QCitation::apply(int const choice, bool const full, bool const force,
                       QString before, QString after)
 {
-       if (selected_keys_.rowCount() == 0)
+       if (cited_keys_.isEmpty())
                return;
vector<biblio::CiteStyle> const & styles =
@@ -71,7 +80,7 @@
                .asLatexStr();
params().setCmdName(command);
-       params()["key"] = 
qstring_to_ucs4(selected_keys_.stringList().join(","));
+       params()["key"] = qstring_to_ucs4(cited_keys_.join(","));
        params()["before"] = qstring_to_ucs4(before);
        params()["after"] = qstring_to_ucs4(after);
        dispatchParams();
@@ -80,7 +89,8 @@
void QCitation::clearSelection()
 {
-       selected_keys_.setStringList(QStringList());
+       cited_keys_.clear();
+       selected_model_.setStringList(cited_keys_);
 }
@@ -96,75 +106,122 @@
 }
-void QCitation::updateModel()
+bool QCitation::initialiseParams(std::string const & data)
+{
+       if (!ControlCitation::initialiseParams(data))
+               return false;
+       init();
+       return true;
+}
+
+
+void QCitation::init()
 {
        // Make the list of all available bibliography keys
-       QStringList keys = toQStringList(biblio::getKeys(bibkeysInfo()));
-       available_keys_.setStringList(keys);
+       all_keys_ = to_qstring_list(availableKeys());
+       available_model_.setStringList(all_keys_);
// Ditto for the keys cited in this inset
        QString str = toqstr(params()["key"]);
-       if (!str.isEmpty()) {
-               keys = str.split(",");
-               selected_keys_.setStringList(keys);
-       }
-}
-
-
-void QCitation::findKey(QString const & str)
-{
-       QStringList sl = available_keys_.stringList().filter(str, 
Qt::CaseInsensitive);
-       found_keys_.setStringList(sl);
+       if (str.isEmpty())
+               cited_keys_.clear();
+       else
+               cited_keys_ = str.split(",");
+
+       selected_model_.setStringList(cited_keys_);
+}
+
+
+void QCitation::findKey(QString const & str, bool only_keys,
+               bool case_sensitive, bool reg_exp)
+{
+       if (str.isEmpty()) {
+               available_model_.setStringList(all_keys_);
+               return;
+       }
+
+       // Used for optimisation: store last searched string.
+       static QString last_searched_string;
+       // Used to disable the above optimisation.
+       static bool last_case_sensitive;
+       static bool last_reg_exp;
+       // Reset last_searched_string in case of changed option.
+       if (last_case_sensitive != case_sensitive
+               || last_reg_exp != reg_exp) {
+                       lyxerr[Debug::GUI] << "QCitation::findKey: optimisation 
disabled!" << std::endl;
+               last_searched_string.clear();
+       }
+       // save option for next search.
+       last_case_sensitive = case_sensitive;
+       last_reg_exp = reg_exp;
+
+       Qt::CaseSensitivity qtcase = case_sensitive?
+                       Qt::CaseSensitive: Qt::CaseInsensitive;
+       QStringList keys;
+       // If new string (str) contains the last searched one...
+ if (!last_searched_string.isEmpty() && str.size() > 1 + && str.contains(last_searched_string, qtcase))
+               // ... then only search within already found list.
+               keys = available_model_.stringList();
+       else
+               // ... else search all keys.
+               keys = all_keys_;
+       // save searched string for next search.
+       last_searched_string = str;
+
+       QStringList result;
+       if (only_keys)
+               // Search only within the matching keys:
+               result = keys.filter(str, qtcase);
+       else
+               // Search within matching keys and associated info.
+               result = to_qstring_list(searchKeys(to_string_vector(keys),
+                       qstring_to_ucs4(str), case_sensitive, reg_exp));
+
+       available_model_.setStringList(result);
 }
void QCitation::addKey(QModelIndex const & index)
 {
-       QStringList keys = selected_keys_.stringList();
-       keys.append(index.data().toString());
-       selected_keys_.setStringList(keys);
+       cited_keys_.append(index.data().toString());
+       selected_model_.setStringList(cited_keys_);
 }
void QCitation::deleteKey(QModelIndex const & index)
 {
-       QStringList keys = selected_keys_.stringList();
-       keys.removeAt(index.row());
-       selected_keys_.setStringList(keys);
+       cited_keys_.removeAt(index.row());
+       selected_model_.setStringList(cited_keys_);
 }
void QCitation::upKey(QModelIndex const & index)
 {
-       QStringList keys = selected_keys_.stringList();
        int pos = index.row();
-       keys.swap(pos, pos - 1);
-       selected_keys_.setStringList(keys);
+       cited_keys_.swap(pos, pos - 1);
+       selected_model_.setStringList(cited_keys_);
 }
void QCitation::downKey(QModelIndex const & index)
 {
-       QStringList keys = selected_keys_.stringList();
        int pos = index.row();
-       keys.swap(pos, pos + 1);
-       selected_keys_.setStringList(keys);
+       cited_keys_.swap(pos, pos + 1);
+       selected_model_.setStringList(cited_keys_);
 }
QStringList QCitation::citationStyles(int sel)
 {
-       string const key = fromqstr(selected_keys_.stringList()[sel]);
-       return toQStringList(getCiteStrings(key));
+       string const key = fromqstr(cited_keys_[sel]);
+       return to_qstring_list(getCiteStrings(key));
 }
QString QCitation::getKeyInfo(QString const & sel)
 {
-       if (!bibkeysInfo().empty())
-               return toqstr(biblio::getInfo(bibkeysInfo(), fromqstr(sel) ));
-
-       return QString();
+       return toqstr(getInfo(fromqstr(sel)));
 }
Modified: lyx-devel/trunk/src/frontends/qt4/QCitation.h
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/QCitation.h?rev=17539
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/QCitation.h (original)
+++ lyx-devel/trunk/src/frontends/qt4/QCitation.h Sun Mar 25 03:32:12 2007
@@ -6,6 +6,7 @@
  *
  * \author Angus Leeming
  * \author Kalle Dalheimer
+ * \author Abdelrazak Younes
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -13,8 +14,9 @@
 #ifndef QCITATION_H
 #define QCITATION_H
-#include "ControlCitation.h"
+#include "frontends/controllers/ControlCitation.h"
+#include <QStringList>
 #include <QStringListModel>
namespace lyx {
@@ -25,14 +27,17 @@
 public:
        ///
        QCitation(Dialog &);
+       virtual ~QCitation() {}
+       virtual bool initialiseParams(std::string const & data);
+
+       ///
+       void init();
+
        /// Available keys
-       QStringListModel * available() { return &available_keys_; }
+       QStringListModel * available() { return &available_model_; }
/// Selected keys
-       QStringListModel * selected() { return &selected_keys_; }
-
-       /// Found keys
-       QStringListModel * found() { return &found_keys_; }
+       QStringListModel * selected() { return &selected_model_; }
/// Text before cite
        QString textBefore();
@@ -46,8 +51,13 @@
        /// Clear selected keys
        void clearSelection();
- /// Find keys containing the string (not case-sens)
-       void findKey(QString const &);
+       /// Find keys containing a string.
+       void findKey(
+               QString const & str, //< string expression
+               bool only_keys, //< set to true if only keys shall be searched.
+               bool case_sensitive, //< set to true for case sensitive search.
+               bool reg_exp //< set to true if \c str is a regular expression.
+               );
/// Add key to selected keys
        void addKey(QModelIndex const &);
@@ -68,18 +78,18 @@
        virtual void apply(int const choice, bool const full, bool const force,
                                          QString before, QString after);
- /// Update dialog before/whilst showing it.
-       virtual void updateModel();
+private:       
+       /// available keys.
+       QStringListModel available_model_;
-private:
-       /// available keys
-       QStringListModel available_keys_;
+       /// selected keys.
+       QStringListModel selected_model_;
- /// selected keys
-       QStringListModel selected_keys_;
+       /// All keys.
+       QStringList all_keys_;
- /// found keys
-       QStringListModel found_keys_;
+       /// Cited keys.
+       QStringList cited_keys_;
 };
Modified: lyx-devel/trunk/src/frontends/qt4/QCitationDialog.C
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/QCitationDialog.C?rev=17539
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/QCitationDialog.C (original)
+++ lyx-devel/trunk/src/frontends/qt4/QCitationDialog.C Sun Mar 25 03:32:12 2007
@@ -6,6 +6,7 @@
  * \author Kalle Dalheimer
  * \author John Levon
  * \author Jürgen Spitzmüller
+ * \author Abdelrazak Younes
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -13,15 +14,14 @@
 #include <config.h>
#include "QCitationDialog.h"
+
 #include "QCitation.h"
-#include "qt_helpers.h"
-
-#include "bufferparams.h"
+
+#include "frontends/controllers/biblio.h"
+#include "frontends/controllers/ControlCitation.h"
+
+#include "debug.h"
 #include "gettext.h"
-
-#include "controllers/ControlCitation.h"
-
-#include "support/lstrings.h"
#include <vector>
 #include <string>
@@ -33,10 +33,6 @@
 using std::string;
namespace lyx {
-
-using support::getStringFromVector;
-using support::getVectorFromString;
-
 namespace frontend {
@@ -119,6 +115,8 @@ void QCitationDialog::show()
 {
+       findLE->clear();
+       availableLV->setFocus();
        QDialog::show();
 }
@@ -152,24 +150,20 @@ void QCitationDialog::on_restorePB_clicked()
 {
+       form_->init();
        update();
 }
void QCitationDialog::update()
 {
-       form_->updateModel();
-
-       QModelIndex const idxa = availableLV->currentIndex();
-       if (form_->available()->rowCount() > 0 && !idxa.isValid())
-               availableLV->setCurrentIndex(availableLV->model()->index(0,0));
-
-       QModelIndex const idx = selectedLV->currentIndex();
-       if (form_->selected()->rowCount() > 0 && !idx.isValid()) {
-               selectedLV->setCurrentIndex(selectedLV->model()->index(0,0));
+       if (selectedLV->selectionModel()->selectedIndexes().isEmpty()) {
+ if (availableLV->selectionModel()->selectedIndexes().isEmpty() + && availableLV->model()->rowCount() > 0)
+                               
availableLV->setCurrentIndex(availableLV->model()->index(0,0));
+               updateInfo(availableLV->currentIndex());
+       } else
                updateInfo(selectedLV->currentIndex());
-       } else
-               updateInfo(availableLV->currentIndex());
setButtons(); @@ -294,10 +288,8 @@ void QCitationDialog::on_selectedLV_clicked(const QModelIndex & idx)
 {
-       availableLV->selectionModel()->clear();
-
-       updateInfo(idx);
-       changed();
+       availableLV->selectionModel()->reset();
+       update();
 }
@@ -306,17 +298,15 @@
        if (!idx.isValid())
                return;
- updateInfo(idx);
-       changed();
+       availableLV->selectionModel()->reset();
+       update();
 }
void QCitationDialog::on_availableLV_clicked(const QModelIndex & idx)
 {
-       selectedLV->selectionModel()->clear();
-
-       updateInfo(idx);
-       setButtons();
+       selectedLV->selectionModel()->reset();
+       update();
 }
@@ -325,8 +315,8 @@
        if (!idx.isValid())
                return;
                
-       updateInfo(idx);
-       setButtons();
+       selectedLV->selectionModel()->reset();
+       update();
 }
@@ -335,7 +325,15 @@
        if (isSelected(idx))
                return;
- on_addPB_clicked();
+       selectedLV->selectionModel()->reset();
+       on_addPB_clicked();
+       if (selectedLV->model()->rowCount() == 1)
+               on_okPB_clicked();
+}
+
+
+void QCitationDialog::on_availableLV_entered(const QModelIndex & idx)
+{
 }
@@ -345,7 +343,8 @@
        form_->addKey(availableLV->currentIndex());
        if (idx.isValid())
                selectedLV->setCurrentIndex(idx);
-       changed();
+       selectedLV->selectionModel()->reset();
+       update();
 }
@@ -362,8 +361,8 @@
        if (nrows>1)
                selectedLV->setCurrentIndex(idx);
- updateInfo(selectedLV->currentIndex());
-       changed();
+       availableLV->selectionModel()->reset();
+       update();
 }
@@ -372,7 +371,8 @@
        QModelIndex idx = selectedLV->currentIndex();
        form_->upKey(idx);
        selectedLV->setCurrentIndex(idx.sibling(idx.row() - 1, idx.column()));
-       changed();
+       availableLV->selectionModel()->reset();
+       update();
 }
@@ -381,7 +381,18 @@
        QModelIndex idx = selectedLV->currentIndex();
        form_->downKey(idx);
        selectedLV->setCurrentIndex(idx.sibling(idx.row() + 1, idx.column()));
-       changed();
+       availableLV->selectionModel()->reset();
+       update();
+}
+
+
+void QCitationDialog::findText(QString const & text)
+{
+       bool const case_sentitive = caseCB->checkState();
+       bool const reg_exp = regexCB->checkState();
+       form_->findKey(text, false, case_sentitive, reg_exp);
+       selectedLV->selectionModel()->reset();
+       update();
 }
@@ -390,14 +401,19 @@
        clearPB->setDisabled(text.isEmpty());
        if (text.isEmpty())
                findLE->setFocus();
-
-       form_->findKey(text);
-       if (form_->found()->rowCount() == 0) {
-               findLE->backspace();
-               return;
-       }
-       availableLV->setModel(form_->found());
-       changed();
+       findText(text);
+}
+
+
+void QCitationDialog::on_caseCB_stateChanged(int)
+{
+       findText(findLE->text());
+}
+
+
+void QCitationDialog::on_regexCB_stateChanged(int)
+{
+       findText(findLE->text());
 }
Modified: lyx-devel/trunk/src/frontends/qt4/QCitationDialog.h
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/QCitationDialog.h?rev=17539
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/QCitationDialog.h (original)
+++ lyx-devel/trunk/src/frontends/qt4/QCitationDialog.h Sun Mar 25 03:32:12 2007
@@ -5,6 +5,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Kalle Dalheimer
+ * \author Abdelrazak Younes
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -51,6 +52,7 @@
 protected:
        void closeEvent (QCloseEvent * e);
        void keyPressEvent (QKeyEvent * event);
+       void findText(QString const & text);
protected Q_SLOTS: @@ -63,10 +65,13 @@
        void on_upPB_clicked();
        void on_downPB_clicked();
        void on_findLE_textChanged(const QString & text);
+       void on_caseCB_stateChanged(int);
+       void on_regexCB_stateChanged(int);
        void on_selectedLV_clicked(const QModelIndex &);
        void selectedChanged(const QModelIndex &, const QModelIndex &);
        void on_availableLV_clicked(const QModelIndex &);
        void on_availableLV_activated(const QModelIndex &);
+       void on_availableLV_entered(const QModelIndex &);
        void availableChanged(const QModelIndex &, const QModelIndex &);
        virtual void changed();
        /// check whether key is already selected

Modified: lyx-devel/trunk/src/frontends/qt4/ui/QCitationUi.ui
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/ui/QCitationUi.ui?rev=17539
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/ui/QCitationUi.ui (original)
+++ lyx-devel/trunk/src/frontends/qt4/ui/QCitationUi.ui Sun Mar 25 03:32:12 2007
@@ -31,100 +31,201 @@
     <number>6</number>
    </property>
    <item row="1" column="0" >
-    <layout class="QHBoxLayout" >
+    <widget class="QTextBrowser" name="infoML" />
+   </item>
+   <item row="2" column="0" >
+    <widget class="QGroupBox" name="groupBox" >
+     <property name="title" >
+      <string>Search Citation</string>
+     </property>
+     <layout class="QGridLayout" >
+      <property name="margin" >
+       <number>9</number>
+      </property>
+      <property name="spacing" >
+       <number>6</number>
+      </property>
+      <item row="1" column="0" >
+       <layout class="QHBoxLayout" >
+        <property name="margin" >
+         <number>0</number>
+        </property>
+        <property name="spacing" >
+         <number>6</number>
+        </property>
+        <item>
+         <widget class="QCheckBox" name="caseCB" >
+          <property name="text" >
+           <string>Case Sensitive</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QCheckBox" name="regexCB" >
+          <property name="text" >
+           <string>Regular Expression</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item row="0" column="0" >
+       <layout class="QHBoxLayout" >
+        <property name="margin" >
+         <number>0</number>
+        </property>
+        <property name="spacing" >
+         <number>6</number>
+        </property>
+        <item>
+         <widget class="QLabel" name="findKeysLA" >
+          <property name="text" >
+           <string>&amp;Find:</string>
+          </property>
+          <property name="alignment" >
+           <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+          </property>
+          <property name="buddy" >
+           <cstring>findLE</cstring>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLineEdit" name="findLE" >
+          <property name="text" >
+           <string/>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="clearPB" >
+          <property name="enabled" >
+           <bool>false</bool>
+          </property>
+          <property name="text" >
+           <string>&lt;- Clear</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="0" column="0" >
+    <layout class="QGridLayout" >
      <property name="margin" >
       <number>0</number>
      </property>
      <property name="spacing" >
       <number>6</number>
      </property>
-     <item>
-      <widget class="QLabel" name="findKeysLA" >
-       <property name="text" >
-        <string>&amp;Find:</string>
-       </property>
-       <property name="alignment" >
-        <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+     <item row="0" column="0" colspan="2" >
+      <widget class="QLabel" name="availableKeysLA" >
+       <property name="text" >
+        <string>&amp;Available Citations:</string>
        </property>
        <property name="buddy" >
-        <cstring>findLE</cstring>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QLineEdit" name="findLE" >
-       <property name="text" >
+        <cstring>availableLV</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="1" >
+      <widget class="QPushButton" name="addPB" >
+       <property name="toolTip" >
         <string/>
        </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QPushButton" name="clearPB" >
-       <property name="enabled" >
-        <bool>false</bool>
-       </property>
-       <property name="text" >
-        <string>&lt;- Clear</string>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item row="4" column="0" >
-    <layout class="QHBoxLayout" >
-     <property name="margin" >
-      <number>0</number>
-     </property>
-     <property name="spacing" >
-      <number>6</number>
-     </property>
-     <item>
-      <widget class="QPushButton" name="restorePB" >
-       <property name="text" >
-        <string>&amp;Restore</string>
-       </property>
-      </widget>
-     </item>
-     <item>
+       <property name="text" >
+        <string>&amp;Add</string>
+       </property>
+       <property name="autoDefault" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="2" >
+      <widget class="QLabel" name="selectedKeysLA" >
+       <property name="text" >
+        <string>&amp;Selected Citations:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>selectedLV</cstring>
+       </property>
+      </widget>
+     </item>
+     <item row="4" column="1" >
+      <widget class="QPushButton" name="upPB" >
+       <property name="sizePolicy" >
+        <sizepolicy>
+         <hsizetype>0</hsizetype>
+         <vsizetype>0</vsizetype>
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="toolTip" >
+        <string>Move the selected citation up</string>
+       </property>
+       <property name="text" >
+        <string>&amp;Up</string>
+       </property>
+       <property name="icon" >
+        <iconset/>
+       </property>
+      </widget>
+     </item>
+     <item rowspan="5" row="1" column="2" >
+      <widget class="QListView" name="selectedLV" >
+       <property name="editTriggers" >
+        <set>QAbstractItemView::NoEditTriggers</set>
+       </property>
+      </widget>
+     </item>
+     <item row="3" column="1" >
       <spacer>
        <property name="orientation" >
-        <enum>Qt::Horizontal</enum>
+        <enum>Qt::Vertical</enum>
        </property>
        <property name="sizeHint" >
         <size>
-         <width>40</width>
-         <height>20</height>
+         <width>20</width>
+         <height>16</height>
         </size>
        </property>
       </spacer>
      </item>
-     <item>
-      <widget class="QPushButton" name="okPB" >
-       <property name="text" >
-        <string>&amp;OK</string>
-       </property>
-       <property name="autoDefault" >
-        <bool>true</bool>
-       </property>
-       <property name="default" >
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QPushButton" name="applyPB" >
-       <property name="text" >
-        <string>A&amp;pply</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QPushButton" name="cancelPB" >
-       <property name="text" >
-        <string>&amp;Cancel</string>
-       </property>
-       <property name="autoDefault" >
-        <bool>false</bool>
+     <item rowspan="5" row="1" column="0" >
+      <widget class="QListView" name="availableLV" >
+       <property name="editTriggers" >
+        <set>QAbstractItemView::NoEditTriggers</set>
+       </property>
+      </widget>
+     </item>
+     <item row="5" column="1" >
+      <widget class="QPushButton" name="downPB" >
+       <property name="sizePolicy" >
+        <sizepolicy>
+         <hsizetype>0</hsizetype>
+         <vsizetype>0</vsizetype>
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="toolTip" >
+        <string>Move the selected citation down</string>
+       </property>
+       <property name="text" >
+        <string>&amp;Down</string>
+       </property>
+       <property name="icon" >
+        <iconset/>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="1" >
+      <widget class="QPushButton" name="deletePB" >
+       <property name="text" >
+        <string>D&amp;elete</string>
        </property>
       </widget>
      </item>
@@ -243,123 +344,61 @@
      </layout>
     </widget>
    </item>
-   <item row="2" column="0" >
-    <widget class="QTextBrowser" name="infoML" />
-   </item>
-   <item row="0" column="0" >
-    <layout class="QGridLayout" >
+   <item row="4" column="0" >
+    <layout class="QHBoxLayout" >
      <property name="margin" >
       <number>0</number>
      </property>
      <property name="spacing" >
       <number>6</number>
      </property>
-     <item row="0" column="0" colspan="2" >
-      <widget class="QLabel" name="availableKeysLA" >
-       <property name="text" >
-        <string>&amp;Available Citations:</string>
-       </property>
-       <property name="buddy" >
-        <cstring>availableLV</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="1" >
-      <widget class="QPushButton" name="addPB" >
-       <property name="toolTip" >
-        <string/>
-       </property>
-       <property name="text" >
-        <string>&amp;Add</string>
+     <item>
+      <widget class="QPushButton" name="restorePB" >
+       <property name="text" >
+        <string>&amp;Restore</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="okPB" >
+       <property name="text" >
+        <string>&amp;OK</string>
        </property>
        <property name="autoDefault" >
         <bool>true</bool>
        </property>
-      </widget>
-     </item>
-     <item row="0" column="2" >
-      <widget class="QLabel" name="selectedKeysLA" >
-       <property name="text" >
-        <string>&amp;Selected Citations:</string>
-       </property>
-       <property name="buddy" >
-        <cstring>selectedLV</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="4" column="1" >
-      <widget class="QPushButton" name="upPB" >
-       <property name="sizePolicy" >
-        <sizepolicy>
-         <hsizetype>0</hsizetype>
-         <vsizetype>0</vsizetype>
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="toolTip" >
-        <string>Move the selected citation up</string>
-       </property>
-       <property name="text" >
-        <string>&amp;Up</string>
-       </property>
-       <property name="icon" >
-        <iconset/>
-       </property>
-      </widget>
-     </item>
-     <item rowspan="5" row="1" column="2" >
-      <widget class="QListView" name="selectedLV" >
-       <property name="editTriggers" >
-        <set>QAbstractItemView::NoEditTriggers</set>
-       </property>
-      </widget>
-     </item>
-     <item row="3" column="1" >
-      <spacer>
-       <property name="orientation" >
-        <enum>Qt::Vertical</enum>
-       </property>
-       <property name="sizeHint" >
-        <size>
-         <width>20</width>
-         <height>16</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item rowspan="5" row="1" column="0" >
-      <widget class="QListView" name="availableLV" >
-       <property name="editTriggers" >
-        <set>QAbstractItemView::NoEditTriggers</set>
-       </property>
-      </widget>
-     </item>
-     <item row="5" column="1" >
-      <widget class="QPushButton" name="downPB" >
-       <property name="sizePolicy" >
-        <sizepolicy>
-         <hsizetype>0</hsizetype>
-         <vsizetype>0</vsizetype>
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="toolTip" >
-        <string>Move the selected citation down</string>
-       </property>
-       <property name="text" >
-        <string>&amp;Down</string>
-       </property>
-       <property name="icon" >
-        <iconset/>
-       </property>
-      </widget>
-     </item>
-     <item row="2" column="1" >
-      <widget class="QPushButton" name="deletePB" >
-       <property name="text" >
-        <string>D&amp;elete</string>
+       <property name="default" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="applyPB" >
+       <property name="text" >
+        <string>A&amp;pply</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="cancelPB" >
+       <property name="text" >
+        <string>&amp;Cancel</string>
+       </property>
+       <property name="autoDefault" >
+        <bool>false</bool>
        </property>
       </widget>
      </item>
@@ -374,7 +413,6 @@
   <tabstop>deletePB</tabstop>
   <tabstop>upPB</tabstop>
   <tabstop>downPB</tabstop>
-  <tabstop>findLE</tabstop>
   <tabstop>infoML</tabstop>
   <tabstop>citationStyleCO</tabstop>
   <tabstop>textBeforeED</tabstop>




Reply via email to