From 3573488ef227bd7719eae892c72784cace95ffd4 Mon Sep 17 00:00:00 2001 From: "N.N." Date: Sat, 12 Mar 2005 00:19:13 +0000 Subject: cyclone alpha54 and toxy alpha16 (see notes.txt for cyclone, toxy and shared) svn path=/trunk/externals/miXed/; revision=2618 --- shared/hammer/file.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'shared/hammer/file.c') diff --git a/shared/hammer/file.c b/shared/hammer/file.c index c671946..eec3ad3 100644 --- a/shared/hammer/file.c +++ b/shared/hammer/file.c @@ -82,7 +82,7 @@ static void hammereditor_guidefs(void) sys_gui("}\n"); sys_gui("proc hammereditor_dodirty {name} {\n"); - sys_gui(" if {[catch {$name.text edit modified} dirty]} {set dirty 0}\n"); + sys_gui(" if {[catch {$name.text edit modified} dirty]} {set dirty 1}\n"); sys_gui(" set title [wm title $name]\n"); sys_gui(" set dt [string equal -length 1 $title \"*\"]\n"); sys_gui(" if {$dirty} {\n"); @@ -129,7 +129,7 @@ static void hammereditor_guidefs(void) sys_gui("proc hammereditor_close {name ask} {\n"); sys_gui(" if {[winfo exists $name]} {\n"); - sys_gui(" if {[catch {$name.text edit modified} dirty]} {set dirty 0}\n"); + sys_gui(" if {[catch {$name.text edit modified} dirty]} {set dirty 1}\n"); sys_gui(" if {$ask && $dirty} {\n"); sys_gui(" set title [wm title $name]\n"); sys_gui(" if {[string equal -length 1 $title \"*\"]} {\n"); @@ -137,7 +137,7 @@ static void hammereditor_guidefs(void) sys_gui(" }\n"); sys_gui(" set answer [tk_messageBox \\-type yesnocancel \\\n"); sys_gui(" \\-icon question \\\n"); - sys_gui(" \\-message [concat Save changes to $title?]]\n"); + sys_gui(" \\-message [concat Save changes to \\\"$title\\\"?]]\n"); sys_gui(" if {$answer == \"yes\"} {hammereditor_send $name}\n"); sys_gui(" if {$answer != \"cancel\"} {hammereditor_doclose $name}\n"); sys_gui(" } else {hammereditor_doclose $name}\n"); @@ -183,8 +183,24 @@ void hammereditor_close(t_hammerfile *f, int ask) void hammereditor_append(t_hammerfile *f, char *contents) { - if (!contents) contents = ""; - sys_vgui("hammereditor_append .%x {%s}\n", (int)f, contents); + if (contents) + { + char *ptr; + for (ptr = contents; *ptr; ptr++) + { + if (*ptr == '{' || *ptr == '}') + { + char c = *ptr; + *ptr = 0; + sys_vgui("hammereditor_append .%x {%s}\n", (int)f, contents); + sys_vgui("hammereditor_append .%x \"%c\"\n", (int)f, c); + *ptr = c; + contents = ptr + 1; + } + } + if (*contents) + sys_vgui("hammereditor_append .%x {%s}\n", (int)f, contents); + } } void hammereditor_setdirty(t_hammerfile *f, int flag) -- cgit v1.2.1