r20574 by jghali -
scribus-commit
scribus-commit at lists.scribus.net
Tue Nov 24 12:43:56 UTC 2015
Author: jghali
Date: Tue Nov 24 12:43:56 2015
New Revision: 20574
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20574
Log:
#13225: "Replace All" in Search/Replace dialog freezes Scribus in determined condition <aliyousuf+additional fix by scribus team>
Modified:
branches/Version14x/Scribus/scribus/search.cpp
branches/Version14x/Scribus/scribus/search.h
Modified: branches/Version14x/Scribus/scribus/search.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20574&path=/branches/Version14x/Scribus/scribus/search.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/search.cpp (original)
+++ branches/Version14x/Scribus/scribus/search.cpp Tue Nov 24 12:43:56 2015
@@ -288,6 +288,7 @@
connect( DoSearch, SIGNAL( clicked() ), this, SLOT( slotSearch() ) );
connect( DoReplace, SIGNAL( clicked() ), this, SLOT( slotReplace() ) );
connect( AllReplace, SIGNAL( clicked() ), this, SLOT( slotReplaceAll() ) );
+ connect( STextVal, SIGNAL( textChanged(QString) ), this, SLOT( updateSearchButtonState() ) );
connect( SText, SIGNAL( clicked() ), this, SLOT( enableTxSearch() ) );
connect( SStyle, SIGNAL( clicked() ), this, SLOT( enableStyleSearch() ) );
connect( SAlign, SIGNAL( clicked() ), this, SLOT( enableAlignSearch() ) );
@@ -391,12 +392,17 @@
int sEff = 0;
int sFillSh = 100;
int sStrokeSh = 100;
+ bool searchForReplace = false;
bool rep = false;
bool found = true;
if ((RFill->isChecked()) || (RStroke->isChecked()) || (RStyle->isChecked()) || (RFont->isChecked())
|| (RStrokeS->isChecked()) || (RFillS->isChecked()) || (RSize->isChecked()) || (RText->isChecked())
- || (REffect->isChecked()))
+ || (REffect->isChecked()) || (RAlign->isChecked()))
rep = true;
+ if ((SFill->isChecked()) || (SStroke->isChecked()) || (SStyle->isChecked()) || (SFont->isChecked())
+ || (SStrokeS->isChecked()) || (SFillS->isChecked()) || (SSize->isChecked()) || (SText->isChecked())
+ || (SEffect->isChecked()) || (SAlign->isChecked()))
+ searchForReplace = true;
if (SText->isChecked())
sText = STextVal->text();
if (CaseIgnore->isChecked())
@@ -496,7 +502,7 @@
if (Item->itemText.charStyle(a).fillColor() != fCol)
found = false;
}
- if (found)
+ if (found && searchForReplace)
{
Item->itemText.select(a, sText.length());
Item->HasSel = true;
@@ -631,7 +637,7 @@
storyTextEdit->setTextCursor(cursor);
}
}
- if (found)
+ if (found && searchForReplace)
{
// Doc->scMW()->CurrStED->updateProps(); FIXME
if (rep)
@@ -838,51 +844,61 @@
CaseIgnore->setEnabled(setter);
if (setter)
STextVal->setFocus();
+ updateSearchButtonState();
}
void SearchReplace::enableStyleSearch()
{
SStyleVal->setEnabled(SStyleVal->count() ? SStyle->isChecked() : false);
+ updateSearchButtonState();
}
void SearchReplace::enableAlignSearch()
{
SAlignVal->setEnabled(SAlign->isChecked());
+ updateSearchButtonState();
}
void SearchReplace::enableFontSearch()
{
SFontVal->setEnabled(SFont->isChecked());
+ updateSearchButtonState();
}
void SearchReplace::enableSizeSearch()
{
SSizeVal->setEnabled(SSize->isChecked());
+ updateSearchButtonState();
}
void SearchReplace::enableEffSearch()
{
SEffVal->setEnabled(SEffect->isChecked());
+ updateSearchButtonState();
}
void SearchReplace::enableFillSearch()
{
SFillVal->setEnabled(SFill->isChecked());
+ updateSearchButtonState();
}
void SearchReplace::enableFillSSearch()
{
SFillSVal->setEnabled(SFillS->isChecked());
+ updateSearchButtonState();
}
void SearchReplace::enableStrokeSearch()
{
SStrokeVal->setEnabled(SStroke->isChecked());
+ updateSearchButtonState();
}
void SearchReplace::enableStrokeSSearch()
{
SStrokeSVal->setEnabled(SStrokeS->isChecked());
+ updateSearchButtonState();
}
void SearchReplace::enableTxReplace()
@@ -890,51 +906,61 @@
RTextVal->setEnabled(RText->isChecked());
if (RText->isChecked())
RTextVal->setFocus();
+ updateReplaceButtonsState();
}
void SearchReplace::enableStyleReplace()
{
RStyleVal->setEnabled(RStyle->isChecked());
+ updateReplaceButtonsState();
}
void SearchReplace::enableAlignReplace()
{
RAlignVal->setEnabled(RAlign->isChecked());
+ updateReplaceButtonsState();
}
void SearchReplace::enableFontReplace()
{
RFontVal->setEnabled(RFont->isChecked());
+ updateReplaceButtonsState();
}
void SearchReplace::enableSizeReplace()
{
RSizeVal->setEnabled(RSize->isChecked());
+ updateReplaceButtonsState();
}
void SearchReplace::enableEffReplace()
{
REffVal->setEnabled(REffect->isChecked());
+ updateReplaceButtonsState();
}
void SearchReplace::enableFillReplace()
{
RFillVal->setEnabled(RFill->isChecked());
+ updateReplaceButtonsState();
}
void SearchReplace::enableFillSReplace()
{
RFillSVal->setEnabled(RFillS->isChecked());
+ updateReplaceButtonsState();
}
void SearchReplace::enableStrokeReplace()
{
RStrokeVal->setEnabled(RStroke->isChecked());
+ updateReplaceButtonsState();
}
void SearchReplace::enableStrokeSReplace()
{
RStrokeSVal->setEnabled(RStrokeS->isChecked());
+ updateReplaceButtonsState();
}
void SearchReplace::clear()
@@ -993,6 +1019,40 @@
enableFillSReplace();
enableStrokeReplace();
enableStrokeSReplace();
+}
+
+void SearchReplace::updateReplaceButtonsState()
+{
+ bool replaceEnabled = false;
+ if (RFill->isChecked() || RStroke->isChecked() || RStyle->isChecked() || RFont->isChecked() ||
+ RStrokeS->isChecked() || RFillS->isChecked() || RSize->isChecked() || REffect->isChecked() ||
+ RAlign->isChecked())
+ {
+ replaceEnabled = true;
+ }
+ replaceEnabled |= RText->isChecked();
+ if (SMode)
+ replaceEnabled &= (Item->itemText.lengthOfSelection() > 0);
+ else if (Doc->scMW()->CurrStED != NULL)
+ replaceEnabled &= Doc->scMW()->CurrStED->Editor->textCursor().hasSelection();
+ else
+ replaceEnabled = false;
+ replaceEnabled &= NotFound;
+ DoReplace->setEnabled(replaceEnabled);
+ AllReplace->setEnabled(replaceEnabled);
+}
+
+void SearchReplace::updateSearchButtonState()
+{
+ bool searchEnabled = false;
+ if (SFill->isChecked() || SStroke->isChecked() || SStyle->isChecked() || SFont->isChecked() ||
+ SStrokeS->isChecked() || SFillS->isChecked() || SSize->isChecked() || SEffect->isChecked() ||
+ SAlign->isChecked())
+ {
+ searchEnabled = true;
+ }
+ searchEnabled |= (SText->isChecked() && !STextVal->text().isEmpty());
+ DoSearch->setEnabled(searchEnabled);
}
void SearchReplace::readPrefs()
Modified: branches/Version14x/Scribus/scribus/search.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20574&path=/branches/Version14x/Scribus/scribus/search.h
==============================================================================
--- branches/Version14x/Scribus/scribus/search.h (original)
+++ branches/Version14x/Scribus/scribus/search.h Tue Nov 24 12:43:56 2015
@@ -121,6 +121,8 @@
virtual void enableFillSReplace();
virtual void enableStrokeReplace();
virtual void enableStrokeSReplace();
+ virtual void updateReplaceButtonsState();
+ virtual void updateSearchButtonState();
virtual void writePrefs();
virtual void clear();
More information about the scribus-commit
mailing list