mirror of https://github.com/KLayout/klayout.git
Fixed #79 (Macro Editor: Replace function enabled also for read-only macros)
This commit is contained in:
parent
594d090fb8
commit
eea53b3091
|
|
@ -1621,6 +1621,8 @@ MacroEditorDialog::current_tab_changed (int index)
|
||||||
|
|
||||||
// clear the search
|
// clear the search
|
||||||
searchEditBox->clear ();
|
searchEditBox->clear ();
|
||||||
|
replaceFrame->setEnabled (page && page->macro () && !page->macro ()->is_readonly ());
|
||||||
|
|
||||||
apply_search ();
|
apply_search ();
|
||||||
|
|
||||||
do_update_ui_to_run_mode ();
|
do_update_ui_to_run_mode ();
|
||||||
|
|
|
||||||
|
|
@ -971,6 +971,10 @@ static QString interpolate_string (const QString &replace, const QRegExp &re)
|
||||||
void
|
void
|
||||||
MacroEditorPage::replace_and_find_next (const QString &replace)
|
MacroEditorPage::replace_and_find_next (const QString &replace)
|
||||||
{
|
{
|
||||||
|
if (! mp_macro || mp_macro->is_readonly ()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QTextCursor c = mp_text->textCursor ();
|
QTextCursor c = mp_text->textCursor ();
|
||||||
if (c.hasSelection ()) {
|
if (c.hasSelection ()) {
|
||||||
c.insertText (interpolate_string (replace, m_current_search));
|
c.insertText (interpolate_string (replace, m_current_search));
|
||||||
|
|
@ -982,6 +986,10 @@ MacroEditorPage::replace_and_find_next (const QString &replace)
|
||||||
void
|
void
|
||||||
MacroEditorPage::replace_all (const QString &replace)
|
MacroEditorPage::replace_all (const QString &replace)
|
||||||
{
|
{
|
||||||
|
if (! mp_macro || mp_macro->is_readonly ()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const QTextDocument *doc = mp_text->document ();
|
const QTextDocument *doc = mp_text->document ();
|
||||||
|
|
||||||
QTextCursor c = mp_text->textCursor ();
|
QTextCursor c = mp_text->textCursor ();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue