<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: Text Editor without dirty bit</title>
		<atom:link href="http://cycling74.com/forums/topic/text-editor-without-dirty-bit/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/text-editor-without-dirty-bit/feed</link>
		<description></description>
		<pubDate>Wed, 19 Jun 2013 17:52:55 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/text-editor-without-dirty-bit/#post-58481</guid>
					<title><![CDATA[Text Editor without dirty bit]]></title>
					<link>http://cycling74.com/forums/topic/text-editor-without-dirty-bit/#post-58481</link>
					<pubDate>Tue, 16 Aug 2011 08:41:19 +0000</pubDate>
					<dc:creator>Siska Ádám</dc:creator>

					<description>
						<![CDATA[
						<p>Dear Developers,</p>
<p>I&#8217;m developing a non-UI external that extracts the spectral peaks and does envelope following based on the content of a given buffer. During this process, I&#8217;d like to show a text editor window with the actual analysis and let the user refine the results manually before proceeding. My problem is that by using the suggested way of the SDK (creating a text editor with <code>object_new(CLASS_NOBOX, gensym("jed"), (t_object *)x, 0)</code> and then implementing the <code>edclose</code> method), if I modify the content of the window (so that I set the dirty bit) I&#8217;m always getting a popup window asking me whether I wanted to save the text file or not when I close the text editor. Is there a way to create a text editor that wouldn&#8217;t care for the dirty bit?</p>
<p>Thanks,<br />
Ádám</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/text-editor-without-dirty-bit/#post-210164</guid>
					<title><![CDATA[Re: Text Editor without dirty bit]]></title>
					<link>http://cycling74.com/forums/topic/text-editor-without-dirty-bit/#post-210164</link>
					<pubDate>Wed, 17 Aug 2011 15:08:07 +0000</pubDate>
					<dc:creator>danieleghisi</dc:creator>

					<description>
						<![CDATA[
						<p>I&#8217;m doing this by adding an okclose method, like this:</p>
<p>void yourobj_okclose(t_yourobj *x, char *s, short *result)<br />
{<br />
	*result = 3;<br />
} </p>
<p>Don&#8217;t ask me the reason for the 3: I probably found it somewhere in the sdk, but I don&#8217;t remember where :-)</p>
<p>Daniele</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/text-editor-without-dirty-bit/#post-210165</guid>
					<title><![CDATA[Re: Text Editor without dirty bit]]></title>
					<link>http://cycling74.com/forums/topic/text-editor-without-dirty-bit/#post-210165</link>
					<pubDate>Wed, 17 Aug 2011 17:50:44 +0000</pubDate>
					<dc:creator>Luigi Castelli</dc:creator>

					<description>
						<![CDATA[
						<p>Here is the code that calls the &#8216;okclose&#8217; method.</p>
<p>JKC was nice enough to post it in some other thread.</p>
<pre><code>sprintf(msg, "Save changes to "%s" before closing?", filename->s_name);
// give our owner a chance to take control
okclose = zgetfn(p->v_owner, gensym("okclose"));
if (okclose) {
	short result = 0;	// changed from long to short to fix ppc bug
	object_method(p->v_owner, gensym("okclose"), msg, &#038;result);
	switch (result) {
		case 0:		/* normal thing */
		case 1:		/* they changed the string */
			break;
		case 2:		/* don&#39;t put up a dialog, clear dirty bit */
			object_attr_setchar(p->v_owner, ps_dirty, 0);
		case 3:		/* don&#39;t put up a dialog */
			goto skipalert;
		case 4:		/* act as though user "cancelled" */
			return (void*) -1;
		default:
			break;
	}
}
res = wind_advise((t_object*) p, msg);
switch (res) {
	case ADVISE_SAVE:
		if (jwind_save(p))
			return (void*) -1;		// error saving, treat as cancel
		break;
	case ADVISE_CANCEL:
		return (void*) -1;
	case ADVISE_DISCARD:
		object_attr_setchar(p->v_owner, ps_dirty, 0);
		break;
}</code></pre><p>Cheers.</p>
<p>- Luigi</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

