vymmodel.cpp
changeset 811 c79486b7cb4b
parent 808 b163492fda17
child 813 82ebfc46233b
     1.1 --- a/vymmodel.cpp	Thu Nov 26 14:55:23 2009 +0000
     1.2 +++ b/vymmodel.cpp	Fri Nov 27 13:31:21 2009 +0000
     1.3 @@ -120,9 +120,7 @@
     1.4  	selectionBlocked=false;
     1.5  
     1.6  	// find routine
     1.7 -	findCurrent=NULL;				
     1.8 -	findPrevious=NULL;				
     1.9 -	EOFind=false;
    1.10 +	findReset();
    1.11  
    1.12  	// animations	// FIXME-3 switch to new animation system 
    1.13  	animationUse=settings.readBoolEntry("/animation/use",false);	// FIXME-3 add options to control _what_ is animated
    1.14 @@ -1139,6 +1137,7 @@
    1.15  		return;
    1.16  	}
    1.17  
    1.18 +
    1.19  	if (debug)
    1.20  	{
    1.21  		cout << "VymModel::undo() begin\n";
    1.22 @@ -1156,7 +1155,7 @@
    1.23  
    1.24  	bool noErr;
    1.25  	QString errMsg;
    1.26 -	parseAtom (redoCommand,noErr,errMsg);
    1.27 +	parseAtom (undoCommand,noErr,errMsg);
    1.28  
    1.29  	undosAvail--;
    1.30  	curStep--; 
    1.31 @@ -1568,6 +1567,12 @@
    1.32  
    1.33  BranchItem* VymModel::findText (QString s, bool cs)   
    1.34  {
    1.35 +	if (!s.isEmpty() && s!=findString)
    1.36 +	{
    1.37 +		findReset();
    1.38 +		findString=s;
    1.39 +	}
    1.40 +
    1.41  	QTextDocument::FindFlags flags=0;
    1.42  	if (cs) flags=QTextDocument::FindCaseSensitively;
    1.43  
    1.44 @@ -1587,7 +1592,7 @@
    1.45  		if (findCurrent)
    1.46  		{
    1.47  			// Searching in Note
    1.48 -			if (findCurrent->getNote().contains(s,cs))
    1.49 +			if (findCurrent->getNote().contains(findString,cs))
    1.50  			{
    1.51  				select (findCurrent);
    1.52  				/*
    1.53 @@ -1597,14 +1602,14 @@
    1.54  					emitShowSelection();
    1.55  				}
    1.56  				*/
    1.57 -				if (textEditor->findText(s,flags)) 
    1.58 +				if (textEditor->findText(findString,flags)) 
    1.59  				{
    1.60  					searching=false;
    1.61  					foundNote=true;
    1.62  				}	
    1.63  			}
    1.64  			// Searching in Heading
    1.65 -			if (searching && findCurrent->getHeading().contains (s,cs) ) 
    1.66 +			if (searching && findCurrent->getHeading().contains (findString,cs) ) 
    1.67  			{
    1.68  				select(findCurrent);
    1.69  				searching=false;
    1.70 @@ -1625,6 +1630,7 @@
    1.71  
    1.72  void VymModel::findReset()
    1.73  {	// Necessary if text to find changes during a find process
    1.74 +	findString.clear();
    1.75  	findCurrent=NULL;
    1.76  	findPrevious=NULL;
    1.77  	EOFind=false;