<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Richedit... Text formatiert abspeichern(schnellstmöglich)]]></title><description><![CDATA[<p>Hey all.</p>
<p>Ich Programmiere gerade an einem Texteditor Namens &quot;myNote - Write in your style&quot;, der ein <strong>MINI</strong>-Word werden soll. Also die betonung liegt auf <em>mini</em>.</p>
<p>Aber darum geht es -in diesem Thread- nicht.</p>
<p>Hier soll es um das Speichern des formatierten Textes aus dem Richedit gehen.</p>
<p>Ich habe einen Algorithmuss der immer 2 Buchstaben auf deren Formatierung vergleicht, das geht bei kurzen Texten gut, bei mehr als (WORD) 1 Seite dauert es schon 5 - 10 Sekunden bei (WORD) 6 Seiten dauert es schon rund 20 Sekunden.<br />
Wie kann das beschleunigt werden?<br />
Soll der Text, der im Richedit angezeigt wird, parallel noch im RAM gespeichert sein, so dass ich dann nur die verkettete Liste speichern muss?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/211193/richedit-text-formatiert-abspeichern-schnellstmöglich</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 15:25:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/211193.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 20 Apr 2008 10:26:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Richedit... Text formatiert abspeichern(schnellstmöglich) on Sun, 20 Apr 2008 10:26:58 GMT]]></title><description><![CDATA[<p>Hey all.</p>
<p>Ich Programmiere gerade an einem Texteditor Namens &quot;myNote - Write in your style&quot;, der ein <strong>MINI</strong>-Word werden soll. Also die betonung liegt auf <em>mini</em>.</p>
<p>Aber darum geht es -in diesem Thread- nicht.</p>
<p>Hier soll es um das Speichern des formatierten Textes aus dem Richedit gehen.</p>
<p>Ich habe einen Algorithmuss der immer 2 Buchstaben auf deren Formatierung vergleicht, das geht bei kurzen Texten gut, bei mehr als (WORD) 1 Seite dauert es schon 5 - 10 Sekunden bei (WORD) 6 Seiten dauert es schon rund 20 Sekunden.<br />
Wie kann das beschleunigt werden?<br />
Soll der Text, der im Richedit angezeigt wird, parallel noch im RAM gespeichert sein, so dass ich dann nur die verkettete Liste speichern muss?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1494954</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1494954</guid><dc:creator><![CDATA[lippoliv]]></dc:creator><pubDate>Sun, 20 Apr 2008 10:26:58 GMT</pubDate></item><item><title><![CDATA[Reply to Richedit... Text formatiert abspeichern(schnellstmöglich) on Sun, 20 Apr 2008 11:19:46 GMT]]></title><description><![CDATA[<p>Zeig code</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1494981</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1494981</guid><dc:creator><![CDATA[linuxfreak]]></dc:creator><pubDate>Sun, 20 Apr 2008 11:19:46 GMT</pubDate></item><item><title><![CDATA[Reply to Richedit... Text formatiert abspeichern(schnellstmöglich) on Sun, 20 Apr 2008 19:46:59 GMT]]></title><description><![CDATA[<p>Von der aktuellen Methode?</p>
<pre><code class="language-cpp">void saveMnd( void )
{
	int 		i,
				aktPos,
				tmp						= 0;
	bool 		isEnd					= false;
	CHARRANGE 	myRange;
	CHARFORMAT 	nextFormat				= { 0 },
				actuallyFormat			= { 0 };
	TEXTRANGE 	myTextRange;
	char		buff[buffSize]			= { 0 },
				formString[buffSize*22]	= { 0 };
	FILE 		*myFile					= NULL;

	myTextRange.lpstrText = buff;
	myTextRange.chrg.cpMax = -1;
	myTextRange.chrg.cpMin = 0;

	if( NULL != ( myFile = fopen( &quot;./myFile.mnd&quot;, &quot;w+&quot; ) ) )	//datei öffnen
	{
		i = aktPos = 0;
		tmp = SendMessage( myPaper, EM_GETTEXTRANGE, 0, (LPARAM)&amp;myTextRange );
		myRange.cpMin = aktPos;
		myRange.cpMax = aktPos+1;

		tmp = GetWindowTextLength( myPaper );	//die anzahl der vorhandenen Buchstaben erhalten

		while( aktPos &lt; tmp )	//bis zum letzten Buchstaben alle kopieren
		{
			memset( buff, 0, sizeof(buff) );
			isEnd = false;
			i = 0;

			while( aktPos &lt; tmp &amp;&amp; !isEnd &amp;&amp; i &lt; buffSize )
			{
				myRange.cpMin = aktPos;		//den zu selektierenden Bereich setzen
				myRange.cpMax = aktPos+1;

				actuallyFormat.cbSize = sizeof(CHARFORMAT);
				nextFormat.cbSize = sizeof(CHARFORMAT);

				SendMessage( myPaper, EM_EXSETSEL, 0, (LPARAM)&amp;myRange );	//text selektieren
				SendMessage( myPaper, EM_GETSELTEXT, 0, (LPARAM)(buff+i) );	//selektierten text auslesen
				SendMessage( myPaper, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&amp;actuallyFormat );//Charformat auslesen

				aktPos++;

				myRange.cpMin = aktPos;		//den zu selektierenden Bereich setzen
				myRange.cpMax = aktPos+1;
				SendMessage( myPaper, EM_EXSETSEL, 0, (LPARAM)&amp;myRange );		//text selektieren
				SendMessage( myPaper, EM_GETSELTEXT, 0, (LPARAM)(buff+i+1) );	//selektierten text auslesen
				SendMessage( myPaper, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&amp;nextFormat );	//Charformat auslesen

				if( isEqualCharFormat( &amp;actuallyFormat, &amp;nextFormat ) ) //wenn beide Charformate gleich sind
				{
					if( 0 == buff[i] &amp;&amp; 13 == buff[i+1] ) //RETURN ersetzen
					{
						buff[i] = 11;
						buff[i+1] = 12;
						i += 2;
						aktPos += 2;
					}
					else if( 0 != buff[i] || 0 != buff[i+1] )
						i++; //i inkrementieren damit dieser Buchstabe nicht mehr überschrieben wird
				}
				else
					isEnd = true;
			}

			if( '\0' != buff[0] ) //wenn das array nicht leer ist
			{
				getFormatString( buff, formString, &amp;actuallyFormat ); 	//Text formatieren
				fprintf( myFile, &quot;%s\n&quot;, formString );					//formatierten Text in Datei schreiben
			}
		}

		fclose( myFile );
	}
}
</code></pre>
<p>isEqualCharFormat:</p>
<pre><code class="language-cpp">bool isEqualCharFormat( CHARFORMAT *form1, CHARFORMAT *form2 )
//this function checks if the tho CHARFORMATs are equal
{
	bool sameBold 		= false,
		 sameUnderline 	= false,
		 sameItalic 	= false,
		 sameColor 		= false;

	sameBold = (form1-&gt;dwEffects &amp; CFE_BOLD ) == (form2-&gt;dwEffects &amp; CFE_BOLD);					//check if the both are BOLD or not BOLD
	sameItalic = (form1-&gt;dwEffects &amp; CFE_ITALIC) == (form2-&gt;dwEffects &amp; CFE_ITALIC);			//check if the both are ITALIC or not ITALIC
	sameUnderline = (form1-&gt;dwEffects &amp; CFE_UNDERLINE) == (form2-&gt;dwEffects &amp; CFE_UNDERLINE);	//check if the both are UNDERLINE or not UNDERLINE
	sameColor = form1-&gt;crTextColor  == form2-&gt;crTextColor;										//check if the textcolor is the same

	if( sameBold &amp;&amp; sameItalic &amp;&amp; sameUnderline &amp;&amp; sameColor )	//if everything is the same
		return true;

	return false;
}
</code></pre>
<p>getFormatString</p>
<pre><code class="language-cpp">void getFormatString( char *text, char *formatText, CHARFORMAT *theFormat )
//This function translate the formated text into normal text, with format-informations
{
	bool isItalic		= false,
		 isBold			= false,
		 isUnderline	= false;

	int R				= 0,
		G				= 0,
		B				= 0;

	R = (int)GetRValue( theFormat-&gt;crTextColor );	//Get the red colorvalue of the color
	G = (int)GetGValue( theFormat-&gt;crTextColor );	//Get the yellow colorvalue of the color
	B = (int)GetBValue( theFormat-&gt;crTextColor );	//Get the blue colorvalue of the color

	isItalic = !( !( theFormat-&gt;dwMask &amp; CFM_ITALIC ) || !( theFormat-&gt;dwEffects &amp; CFE_ITALIC ) );			//check if its italic

	isBold = !( !( theFormat-&gt;dwMask &amp; CFM_BOLD ) || !( theFormat-&gt;dwEffects &amp; CFE_BOLD ) );				//check if its bold

	isUnderline = !( !( theFormat-&gt;dwMask &amp; CFM_UNDERLINE ) || !( theFormat-&gt;dwEffects &amp; CFM_UNDERLINE ) );	//check if its underline

	//set the format-informations in the text
}
</code></pre>
<p>Da dieser Code warscheinlich &quot;worst-case&quot; ist brauch ich wohl nciht sagen dass ich ihn selbst geschrieben habe xD</p>
<p>MFG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1495275</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1495275</guid><dc:creator><![CDATA[lippoliv]]></dc:creator><pubDate>Sun, 20 Apr 2008 19:46:59 GMT</pubDate></item></channel></rss>