2009-11-06 18:06:12 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2005-2007 Gerald Schmidt.
|
|
|
|
*
|
|
|
|
* This file is part of Xml Copy Editor.
|
|
|
|
*
|
2014-06-09 16:19:51 +02:00
|
|
|
* Xml Copy Editor is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2009-11-06 18:06:12 +01:00
|
|
|
*
|
|
|
|
* Xml Copy Editor is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Xml Copy Editor; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FINDREPLACEPANEL_H
|
|
|
|
#define FINDREPLACEPANEL_H
|
|
|
|
|
|
|
|
#include <wx/wx.h>
|
|
|
|
#include <iostream>
|
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
class wxFindReplaceData;
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
ID_FINDREPLACE_FIND_NEXT,
|
|
|
|
ID_FINDREPLACE_REPLACE,
|
|
|
|
ID_FINDREPLACE_REPLACE_ALL,
|
|
|
|
ID_FINDREPLACE_MATCH_CASE,
|
2014-04-13 17:30:09 +02:00
|
|
|
ID_FINDREPLACE_REGEX,
|
|
|
|
ID_FINDREPLACE_CLOSE
|
2009-11-06 18:06:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class FindReplacePanel : public wxPanel
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FindReplacePanel (
|
|
|
|
wxWindow *parent,
|
|
|
|
int id,
|
|
|
|
wxFindReplaceData *findDataParameter,
|
|
|
|
bool isReplacePanel = true,
|
|
|
|
bool isRegex = true );
|
|
|
|
~FindReplacePanel();
|
|
|
|
void OnFindNext ( wxCommandEvent& event );
|
|
|
|
void OnReplace ( wxCommandEvent& event );
|
|
|
|
void OnReplaceAll ( wxCommandEvent& event );
|
2014-04-13 17:30:09 +02:00
|
|
|
void OnClose ( wxCommandEvent& event );
|
2009-11-06 18:06:12 +01:00
|
|
|
void focusOnFind();
|
2013-12-20 15:22:03 +01:00
|
|
|
bool getIncrementalFind();
|
2009-11-06 18:06:12 +01:00
|
|
|
bool getRegex();
|
|
|
|
void refresh();
|
|
|
|
void setReplaceVisible ( bool b );
|
|
|
|
void setMatchCase ( bool b );
|
|
|
|
void setRegex ( bool b );
|
|
|
|
void flagNotFound ( bool b );
|
|
|
|
void enableButtons ( bool b );
|
|
|
|
private:
|
|
|
|
wxTextCtrl *findEdit, *replaceEdit;
|
|
|
|
wxStaticText *label1, *label2, *spacer1, *spacer2;
|
|
|
|
wxButton *findNextButton, *replaceButton, *replaceAllButton;
|
|
|
|
wxCheckBox *matchCaseBox, *regexBox;
|
|
|
|
wxFindReplaceData *findData;
|
|
|
|
wxBoxSizer *sizer;
|
|
|
|
wxWindow *parent;
|
|
|
|
size_t findEditLength;
|
|
|
|
bool matchCaseMemory, regexMemory;
|
2013-12-20 15:22:03 +01:00
|
|
|
bool incrementalFind, isReplaceDialog, notFoundSet, isRegex;
|
2009-11-06 18:06:12 +01:00
|
|
|
|
2014-02-28 13:09:08 +01:00
|
|
|
void OnCharHook ( wxKeyEvent& event );
|
2009-11-06 18:06:12 +01:00
|
|
|
void OnIdle ( wxIdleEvent& event );
|
|
|
|
void sendFindEvent ( size_t flags );
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|