Adobe Adam 和 Eve (C++ ASL):如何绑定 Eve 变量以便在 C++ 内更新它应用?
所以我们知道如何编译它,我们看过它的演示并且喜欢它。我们可能只见过一个基于它的现实生活中的开源项目。因此,我查看了示例,只看到了 3 个相当长的 C++ 应用程序,这些应用程序可能是我感兴趣的 ASL\test\adam_tutorial\
、ASL\test\adam_smoke\
、ASL\test\eve_smoke\
。但我仍然不明白如何使用简单的 Eve 文件:
dialog(name: "Clipping Path")
{
column(child_horizontal: align_fill)
{
popup(name: "Path:", bind: @path, items:
[
{ name: "None", value: empty },
{ name: "Path 1", value: 1 },
{ name: "Path 2", value: 2 }
]);
edit_number(name: "Flatness:", digits: 9, bind: @flatness);
}
button(name: "OK", default: true, bind: @result);
}
在其中,将 Adam 文件绑定到它(理论上,因为我不太明白如何将 Eve 绑定到 adam,并且没有看到有关如何执行此操作的教程),在
sheet clipping_path
{
output:
result <== { path: path, flatness: flatness };
interface:
unlink flatness : 0.0 <== (path == empty) ? 0.0 : flatness;
path : 1;
}
其中,每次flatness
变量改变我的一些C++函数(例如,一个简单的计算新flatness
值的函数)
那么如何使用Adobe Adam和Eve以及Boost来实现这样的事情 当然?
更新
我们已尝试这样做此处 它有效,但不是以实时反馈方式 - 仅在对话框关闭操作上。比 在这里但是由于我们的在 Linux 上编译 evrething 我们我们暂停了 ASL 编程的开发,并开始投入时间在 Linux 操作系统上进行 ASL 编译。
So we know how to compile it, we have seen its demos and loved it. We have seen probably only one real life opensource project based on it. So I look at the samples and see only 3 quite long C++ applications that can be ofmy intrest ASL\test\adam_tutorial\
, ASL\test\adam_smoke\
, ASL\test\eve_smoke\
. But I still do not get how htving simple Eve file with:
dialog(name: "Clipping Path")
{
column(child_horizontal: align_fill)
{
popup(name: "Path:", bind: @path, items:
[
{ name: "None", value: empty },
{ name: "Path 1", value: 1 },
{ name: "Path 2", value: 2 }
]);
edit_number(name: "Flatness:", digits: 9, bind: @flatness);
}
button(name: "OK", default: true, bind: @result);
}
in it, Adam file bound to it (theoretically, because I do not quite get how to bind Eve to adam and see no tutorialon how to do this), with
sheet clipping_path
{
output:
result <== { path: path, flatness: flatness };
interface:
unlink flatness : 0.0 <== (path == empty) ? 0.0 : flatness;
path : 1;
}
in it, make each time flatness
variableis changed some C++ function of mine called (A simple one couting new flatness
value for example)
So How to implement such thing with Adobe Adam and Eve and Boost ofcourse?
Update
We have tried to do it here and it worked but not in a live feedback way - only on dialog close action. And than here but due to our compile evrething on linux absession we have paused our development in ASL programming and started investing time into ASL compilation on Linux OS.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ASL 开发者邮件列表是询问有关 ASL 问题的好地方:http://sourceforge.net/邮件/?group_id=132417。
您可能想查看“开始”测试应用程序。虽然它只运行 Mac 和 Win,但它确实演示了如何连接。
基本思想是,当解析布局描述(Eve)时,它将调用您的 add_view_proc http://stlab.adobe.com/structadobe_1_1eve__callback__suite__t.html#a964b55af7417ae24aacbf552d1efbda4 与参数表达式。通常,您使用 bind_layout_proc 进行回调,它将处理您的参数评估,并调用一个简化的回调,该回调采用带有参数的字典。
当调用回调时,您通常会创建一个适当的小部件并将字典与该小部件关联,或者从字典中提取感兴趣的参数并将它们存储在结构中。使用绑定参数,您可以使用sheet_t 上的monitor_xxxx 函数设置与关联工作表(Adam) 的回调。通常您将使用monitor_value 和monitor_enabled。调用时,您可以在小部件上设置值或启用状态。当用户更改小部件值并调用小部件时(可能是通过事件处理程序、回调或 UI 工具包支持的任何机制),您可以调用sheet_t::set() 来设置单元格的值然后sheet_t::update() 导致工作表重新计算。
就是这样 - 当试图让 Adam/Eve 使用新的 UI 框架时 - 从小处开始。我通常从一个包含两个复选框的窗口开始,然后首先连接 Eve。一旦添加 Adam 和一个连接两个布尔单元格的简单工作表,这样您就可以看到事情是否正确发生。一旦你这样做了,你就会发现连接更复杂的 UI 是非常简单的。
A good place to ask questions about ASL is on the ASL developer mailing list: http://sourceforge.net/mail/?group_id=132417.
You might want to look at the "Begin" test app . Although this only runs Mac and Win it does demonstrate how to wire things up.
The basic idea is that when a layout description (Eve) is parsed it will call your add_view_proc http://stlab.adobe.com/structadobe_1_1eve__callback__suite__t.html#a964b55af7417ae24aacbf552d1efbda4 with the arguments expression. Normally you use bind_layout_proc for the callback which will handle the argument evaluation for your and call a simplified callback that takes a dictionary with the arguments.
When your callback is invoked, you would typically create an appropriate widget and associate the dictionary to the widget or extract the arguments of interest from the dictionary and store them in a struct. Using the bind argument, you can setup callbacks with the associated sheet (Adam), using the monitor_xxxx functions on sheet_t. Usually you'll use monitor_value and monitor_enabled. When called, you set the value or enabled state on the widget. When the widgets value is changed by the user, and widget is invoked (it may be through an event handler, or a callback, or whatever mechanism your UI toolkit supports) you call sheet_t::set() to set the value of the cell and then sheet_t::update() to cause the sheet to recalculate.
That's about it - When trying to get Adam/Eve going with a new UI framework - start small. I usually start with just a window containing two checkboxs and wire up Eve first. Once that is going add Adam and a simple sheet connecting two boolean cells so you can see if things are happening correctly. Once you have that going you'll find it's pretty simple to get much more complex UIs wired up.