projects
/
ardour.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8002b2d
)
improve luawindow save/load/revert
author
Robin Gareus
<robin@gareus.org>
Mon, 11 Apr 2016 22:32:18 +0000
(
00:32
+0200)
committer
Robin Gareus
<robin@gareus.org>
Mon, 11 Apr 2016 22:32:18 +0000
(
00:32
+0200)
gtk2_ardour/luawindow.cc
patch
|
blob
|
history
diff --git
a/gtk2_ardour/luawindow.cc
b/gtk2_ardour/luawindow.cc
index 155c6908acb8d8507493795a99948629b28c62db..b841b3b6ead3e612658a86c17cce4d78360d4280 100644
(file)
--- a/
gtk2_ardour/luawindow.cc
+++ b/
gtk2_ardour/luawindow.cc
@@
-605,7
+605,7
@@
LuaWindow::script_selection_changed (ScriptBufferPtr n, bool force)
Glib::RefPtr<Gtk::TextBuffer> tb (entry.get_buffer());
Glib::RefPtr<Gtk::TextBuffer> tb (entry.get_buffer());
- if (
(n->flags & Buffer_Valid)
) {
+ if (
_current_buffer->flags & Buffer_Valid
) {
_current_buffer->script = tb->get_text();
}
_current_buffer->script = tb->get_text();
}
@@
-671,6
+671,7
@@
LuaWindow::ScriptBuffer::ScriptBuffer (const std::string& n)
, flags (Buffer_Scratch | Buffer_Valid)
{
script =
, flags (Buffer_Scratch | Buffer_Valid)
{
script =
+ "---- this header is (only) required to save the script\n"
"-- ardour { [\"type\"] = \"Snippet\", name = \"\" }\n"
"-- function factory () return function () -- -- end end\n";
}
"-- ardour { [\"type\"] = \"Snippet\", name = \"\" }\n"
"-- function factory () return function () -- -- end end\n";
}
@@
-708,11
+709,12
@@
LuaWindow::ScriptBuffer::~ScriptBuffer ()
bool
LuaWindow::ScriptBuffer::load ()
{
bool
LuaWindow::ScriptBuffer::load ()
{
+ assert (!(flags & Buffer_Valid));
if (!(flags & Buffer_HasFile)) return false;
if (!(flags & Buffer_HasFile)) return false;
- if (flags & Buffer_Valid) return true;
try {
script = Glib::file_get_contents (path);
flags |= Buffer_Valid;
try {
script = Glib::file_get_contents (path);
flags |= Buffer_Valid;
+ flags &= BufferFlags(~Buffer_Dirty);
} catch (Glib::FileError e) {
return false;
}
} catch (Glib::FileError e) {
return false;
}