mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
John Spray's gtk search dialog.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9004 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
29c177a282
commit
e5982ba00f
@ -1,3 +1,12 @@
|
||||
2004-09-24 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* GSearch.[Ch]: new files
|
||||
* Dialogs.C: move from formsearch to gsearch
|
||||
* Makefile.am: move from formsearch to gsearch, alphabetically
|
||||
sort list of libgtk_la_SOURCES
|
||||
* glade/search.glade: s/Backwords/Backwards/, accelerator escape
|
||||
for close button, gtk stock buttons for find and replace.
|
||||
|
||||
2004-09-23 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* GWorkArea.[Ch]: Add GWorkArea::onScrollWheel to implement
|
||||
|
@ -78,7 +78,7 @@
|
||||
#include "FormPreferences.h"
|
||||
#include "FormPrint.h"
|
||||
#include "FormRef.h"
|
||||
#include "FormSearch.h"
|
||||
#include "GSearch.h"
|
||||
#include "FormSendto.h"
|
||||
#include "FormTabular.h"
|
||||
#include "FormTexinfo.h"
|
||||
@ -226,8 +226,9 @@ Dialogs::DialogPtr Dialogs::build(string const & name)
|
||||
dialog->setView(new FormShowFile(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "findreplace") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlSearch(*dialog));
|
||||
dialog->setView(new FormSearch(*dialog));
|
||||
dialog->setView(new GSearch(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "float") {
|
||||
dialog->setController(new ControlFloat(*dialog));
|
||||
|
105
src/frontends/gtk/GSearch.C
Normal file
105
src/frontends/gtk/GSearch.C
Normal file
@ -0,0 +1,105 @@
|
||||
/**
|
||||
* \file GSearch.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <gtkmm.h>
|
||||
|
||||
#include "GSearch.h"
|
||||
#include "ControlSearch.h"
|
||||
#include "ghelpers.h"
|
||||
#include <libglademm.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef GViewCB<ControlSearch, GViewGladeB> base_class;
|
||||
|
||||
GSearch::GSearch(Dialog & parent)
|
||||
: base_class(parent, _("Find and Replace"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GSearch::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("search");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * cancelbutton;
|
||||
xml_->get_widget("Cancel", cancelbutton);
|
||||
setCancel(cancelbutton);
|
||||
|
||||
xml_->get_widget("FindNext", findnextbutton);
|
||||
xml_->get_widget("Replace", replacebutton);
|
||||
xml_->get_widget("ReplaceAll", replaceallbutton);
|
||||
xml_->get_widget("FindEntry", findentry);
|
||||
xml_->get_widget("ReplaceEntry", replaceentry);
|
||||
xml_->get_widget("CaseSensitive", casecheck);
|
||||
xml_->get_widget("MatchWord", matchwordcheck);
|
||||
xml_->get_widget("SearchBackwards", backwardscheck);
|
||||
|
||||
findnextbutton->signal_clicked().connect(
|
||||
SigC::slot(*this, &GSearch::onFindNext));
|
||||
replacebutton->signal_clicked().connect(
|
||||
SigC::slot(*this, &GSearch::onReplace));
|
||||
replaceallbutton->signal_clicked().connect(
|
||||
SigC::slot(*this, &GSearch::onReplaceAll));
|
||||
findentry->signal_changed().connect(
|
||||
SigC::slot(*this,&GSearch::onFindEntryChanged));
|
||||
|
||||
bcview().addReadOnly(replaceentry);
|
||||
bcview().addReadOnly(replacebutton);
|
||||
bcview().addReadOnly(replaceallbutton);
|
||||
}
|
||||
|
||||
void GSearch::onFindNext()
|
||||
{
|
||||
controller().find(findentry->get_text(),
|
||||
casecheck->get_active(),
|
||||
matchwordcheck->get_active(),
|
||||
!backwardscheck->get_active());
|
||||
}
|
||||
|
||||
void GSearch::onReplace()
|
||||
{
|
||||
controller().replace(findentry->get_text(),
|
||||
replaceentry->get_text(),
|
||||
casecheck->get_active(),
|
||||
matchwordcheck->get_active(),
|
||||
!backwardscheck->get_active(),
|
||||
false);
|
||||
}
|
||||
|
||||
void GSearch::onReplaceAll()
|
||||
{
|
||||
controller().replace(findentry->get_text(),
|
||||
replaceentry->get_text(),
|
||||
casecheck->get_active(),
|
||||
matchwordcheck->get_active(),
|
||||
!backwardscheck->get_active(),
|
||||
true);
|
||||
}
|
||||
|
||||
void GSearch::onFindEntryChanged()
|
||||
{
|
||||
if (findentry->get_text().empty()) {
|
||||
findnextbutton->set_sensitive(false);
|
||||
replacebutton->set_sensitive(false);
|
||||
replaceallbutton->set_sensitive(false);
|
||||
} else {
|
||||
findnextbutton->set_sensitive(true);
|
||||
replacebutton->set_sensitive(true);
|
||||
replaceallbutton->set_sensitive(true);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
51
src/frontends/gtk/GSearch.h
Normal file
51
src/frontends/gtk/GSearch.h
Normal file
@ -0,0 +1,51 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GSearch.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GSEARCH_H
|
||||
#define GSEARCH_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlSearch;
|
||||
|
||||
/** This class provides a GTK+ implementation of the FormSearch Dialog.
|
||||
*/
|
||||
class GSearch : public GViewCB<ControlSearch, GViewGladeB>
|
||||
{
|
||||
public:
|
||||
GSearch(Dialog & parent);
|
||||
private:
|
||||
virtual void apply() {}
|
||||
virtual void doBuild();
|
||||
virtual void update() {}
|
||||
|
||||
void onFindNext();
|
||||
void onReplace();
|
||||
void onReplaceAll();
|
||||
void onFindEntryChanged();
|
||||
|
||||
Gtk::Button * findnextbutton;
|
||||
Gtk::Button * replacebutton;
|
||||
Gtk::Button * replaceallbutton;
|
||||
Gtk::Entry * findentry;
|
||||
Gtk::Entry * replaceentry;
|
||||
Gtk::CheckButton * casecheck;
|
||||
Gtk::CheckButton * matchwordcheck;
|
||||
Gtk::CheckButton * backwardscheck;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GSEARCH_H
|
@ -15,62 +15,65 @@ libgtk_la_LIBADD = $(xforms_objects) ../xforms/forms/*.lo @GTK_FRONTEND_LIBS@ @X
|
||||
|
||||
# Alphabetical order please. It makes it easier to figure out what's missing.
|
||||
libgtk_la_SOURCES = \
|
||||
ghelpers.C \
|
||||
ghelpers.h \
|
||||
lyx_gui.C \
|
||||
GtkmmX.h \
|
||||
xftFontLoader.C \
|
||||
xftFontLoader.h \
|
||||
codeConvert.h \
|
||||
xftFontMetrics.C \
|
||||
GScreen.C \
|
||||
GScreen.h \
|
||||
LyXScreenFactory.C \
|
||||
Alert_pimpl.C \
|
||||
Dialogs.C \
|
||||
FileDialog.C \
|
||||
FileDialogPrivate.C \
|
||||
FileDialogPrivate.h \
|
||||
GAboutlyx.C \
|
||||
GAboutlyx.h \
|
||||
GBC.C \
|
||||
GBC.h \
|
||||
GLyXKeySym.C \
|
||||
GLyXKeySym.h \
|
||||
GMathDelim.C \
|
||||
GMathDelim.h \
|
||||
GMathPanel.C \
|
||||
GMathPanel.h \
|
||||
GMenubar.C \
|
||||
GMenubar.h \
|
||||
GTimeout.C \
|
||||
GTimeout.h \
|
||||
GToolbar.C \
|
||||
GToolbar.h \
|
||||
WorkAreaFactory.C \
|
||||
GMiniBuffer.C \
|
||||
GMiniBuffer.h \
|
||||
GPainter.C \
|
||||
GPainter.h \
|
||||
GWorkArea.h \
|
||||
GWorkArea.C \
|
||||
GLyXKeySym.h \
|
||||
GLyXKeySym.C \
|
||||
LyXKeySymFactory.C \
|
||||
Alert_pimpl.C \
|
||||
GView.h \
|
||||
GView.C \
|
||||
IdSc.h \
|
||||
IdSc.C \
|
||||
io_callback.h \
|
||||
io_callback.C \
|
||||
Dialogs.C \
|
||||
GAboutlyx.h \
|
||||
GAboutlyx.C \
|
||||
GViewBase.h \
|
||||
GViewBase.C \
|
||||
GBC.h \
|
||||
GBC.C \
|
||||
FileDialogPrivate.h \
|
||||
FileDialogPrivate.C \
|
||||
FileDialog.C \
|
||||
GText.h \
|
||||
GText.C \
|
||||
GUrl.h \
|
||||
GUrl.C \
|
||||
GTableCreate.h \
|
||||
GScreen.C \
|
||||
GScreen.h \
|
||||
GSearch.C \
|
||||
GSearch.h \
|
||||
GTableCreate.C \
|
||||
GMathPanel.h \
|
||||
GMathPanel.C \
|
||||
GXpmBtnTbl.h \
|
||||
GTableCreate.h \
|
||||
GText.C \
|
||||
GText.h \
|
||||
GTimeout.C \
|
||||
GTimeout.h \
|
||||
GToolbar.C \
|
||||
GToolbar.h \
|
||||
GUrl.C \
|
||||
GUrl.h \
|
||||
GView.C \
|
||||
GView.h \
|
||||
GViewBase.C \
|
||||
GViewBase.h \
|
||||
GWorkArea.C \
|
||||
GWorkArea.h \
|
||||
GXpmBtnTbl.C \
|
||||
GMathDelim.h \
|
||||
GMathDelim.C
|
||||
GXpmBtnTbl.h \
|
||||
GtkmmX.h \
|
||||
IdSc.C \
|
||||
IdSc.h \
|
||||
LyXKeySymFactory.C \
|
||||
LyXScreenFactory.C \
|
||||
WorkAreaFactory.C \
|
||||
codeConvert.h \
|
||||
ghelpers.C \
|
||||
ghelpers.h \
|
||||
io_callback.C \
|
||||
io_callback.h \
|
||||
lyx_gui.C \
|
||||
xftFontLoader.C \
|
||||
xftFontLoader.h \
|
||||
xftFontMetrics.C
|
||||
|
||||
|
||||
# GPrint.h
|
||||
# GPrint.C
|
||||
@ -111,7 +114,6 @@ xforms_objects = \
|
||||
../xforms/FormPreferences.lo \
|
||||
../xforms/FormPrint.lo \
|
||||
../xforms/FormRef.lo \
|
||||
../xforms/FormSearch.lo \
|
||||
../xforms/FormSendto.lo \
|
||||
../xforms/forms_gettext.lo \
|
||||
../xforms/FormShowFile.lo \
|
||||
|
@ -5,12 +5,18 @@
|
||||
|
||||
<widget class="GtkWindow" id="dialog">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">LyX: Find and Replace</property>
|
||||
<property name="title" translatable="yes">Find and Replace</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="default_width">450</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTable" id="table1">
|
||||
@ -20,12 +26,12 @@
|
||||
<property name="n_columns">3</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">2</property>
|
||||
<property name="column_spacing">2</property>
|
||||
<property name="column_spacing">4</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Find:</property>
|
||||
<property name="label" translatable="yes">Find what:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_RIGHT</property>
|
||||
@ -80,7 +86,7 @@
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
<property name="activates_default">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
@ -115,12 +121,14 @@
|
||||
<child>
|
||||
<widget class="GtkButton" id="FindNext">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Find next</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="label">gtk-find</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
@ -135,10 +143,12 @@
|
||||
<child>
|
||||
<widget class="GtkButton" id="Replace">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">_Replace</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="label">gtk-find-and-replace</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
@ -150,31 +160,15 @@
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="ReplaceAll">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Repl_ace all</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="Cancel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Cancel</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<accelerator key="Escape" modifiers="0" signal="clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
@ -199,6 +193,7 @@
|
||||
<property name="label" translatable="yes">_Case sensitive</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
@ -217,6 +212,7 @@
|
||||
<property name="label" translatable="yes">_Match word</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
@ -245,12 +241,13 @@
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="SearchBackwords">
|
||||
<widget class="GtkCheckButton" id="SearchBackwards">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">_Search backwards</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
@ -271,6 +268,26 @@
|
||||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="ReplaceAll">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Repl_ace all</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
Loading…
Reference in New Issue
Block a user