主题:  Dreamweaver插件开发指南--配置篇

机器猫 5D精英

职务:普通成员
等级:3
金币:10.5
发贴:1197
注册:2000/9/15 9:06:40
#12003/4/18 17:07:31
Dreamweaver插件开发指南
最近下了本专门讲Dreamweaver插件开发的书,现翻译一个文章的头,供想做Dw插件开发的朋友参考

Dreamweaver是如何配置的

像其他商业应用程序一样,Dreamweaver程序的核心是用 C 语言写成的。不像其他程序U,Dreamweaver核心允许调用外部文件组建他的诸多界面和功能.这些外部文件用HTML, javascript和XML混合编写而成. 存放在Dreamweaver程序目录,在其中一个叫做Configuration子目录中. 不像核心模块, configuration文件可以非常方便并完全地被一个文本编辑器编辑,因此他们是开放的便于检查和更改。


Configuration文件结构
Configuration目录包含四种主要的文件: HTML, JS (javascript), GIF,和. 每种文件在Dreamweaver的呈现和工作中有着特定的作用。

Dreamweaver可以做的每一件事情,每个可插入的object或者behavior, 可执行的command , 要显示的inspector, 等等都被编写进一个HTML插件文件. 每个元素中的可视的部分,例如对话框和面板等都写在HTML的标签中,包括一个表单和表单元素用于接收用户输入. 如果可视化界面使用了任何图像元素,他们都用GIF格式的图像并被连接到HTML文件. 插件的功能部分用javascript来写, 可以写在那个HTML文件内或者保存成为独立的JS文件连接到HTML文件当中.

Dreamweaver界面如何把所有这些插件整合在一起主要取决于Configuration目录中的XML文件.例如, menus.xml文件(可以在Configuration/Menus目录找到) 定义了哪个菜单会出现, 每个菜单包含那些菜单条, 并且一个菜单挑选中以后做哪些事情. insertbar.xml文件(Configuration/Objects)定义了哪些按钮会出现在Insert面板并且当他们被按下的时候如何运行. Configuration/ ExtensionData 目录中的多个XML文件定义了Dreamweaver live data 对象插入哪些代码.

一个简单的例子是Table.htm是如何运行的, 这个文件位于 Objects/Common目录. T这个文件每次在Dreamweaver每次在用户在Insert面板中单击了Table对象或者Insert菜单中选择Table时启动. 在文本编辑其中打开Table.htm你会看到这个文件包含了一个HTML 叶面的标准代码. 这个HTML文件包含一个表单用于建立我们在Dreamweaver中插入表格时看到的对话框。 文件的功能,也就是当用户单击对话框的OK按钮时让Dreamweaver在用户叶面中插入表格代码 的功能包含在一个外部的JS文件中,并且在这个HTML文档中有一个连接指向他.

如果你打开Table.js文件观察他的javascript代码, 你会看到一些你不熟悉的javascript函数, 例如objectTag() 和isDomRequired(). 这些是Dreamweaver javascript API的函数; 我们将在这本书中具体的学习他们.

多个Configuration目录

在你的机器上有多少个Dreamweaver Configuration目录?如果你用Dreamweaver MX (不是该程序的旧版本),你也许会有2-3个甚至更多的Configuration目录. 想要成功地扩展你的Dreamweaver 程序,你需要完全的了解他们.

剩下的不高兴翻译了:)凑合着看看吧 反正也不是重点

Previously Installed Versions
If you already had Dreamweaver installed on your computer when you installed Dreamweaver MX梖or instance, if you upgraded from an earlier version or if you've re-installed Dreamweaver MX梱our Dreamweaver application folder will include an extra Configuration folder called Configuration-1, containing the configuration files from the previous installation. If you've upgraded or re-installed a number of times, you might even have a Configuration-2 and even a Configuration-3 folder.

These are inactive folders. They're present in case you want to access any special configuration information, such as custom extensions, from your previous installation. For purposes of doing the exercises in this book, you can ignore these folders.

User-Specific Configuration Files
If your computer's operating system supports multiple user setups (Windows, Mac OS X), Dreamweaver creates two sets of configuration files: In addition to the main Configuration folder located in the Dreamweaver application folder, it also creates a Configuration folder for each user that contains a personalized set of files that will be used only when that user launches Dreamweaver. For Dreamweaver/Windows, each user's personal Configuration folder is stored in:

c:\documents and settings\username\application data\macromedia\dreamweaver mx\
configuration\
For Dreamweaver/Mac OS X, they're stored in:

/users/username/library/application support/dreamweaver mx/configuration
(For each user, substitute the correct user name for username .) This folder is created the first time the user launches Dreamweaver.

Examine one of these extra folders, and you'll see that it isn't a complete duplicate of the main Configuration folder. It contains only certain files, representing interface elements that individual users may want to customize only for their own use. Application preferences such as code coloring, menus that can be customized with keyboard shortcuts, commands recorded using the History panel, and objects that save their dialog box settings from one work session to another, are all saved as files in the individual user's Configuration folder.

How does Dreamweaver determine which configuration files to use? It always begins by checking to see whether a certain file is present in the user's Configuration folder. If not, it looks for the file in the main Configuration folder.

How does this affect you as an extension developer? If your extension project involves editing menus.xml or some other user-customizable extension file, you'll need to know which version of the file to open and edit. You can also create your own extensions that include user-specific features by telling Dreamweaver to save them to the user's Configuration folder. If you like, you can also isolate your extension files in progress by storing them in a user-specific Configuration folder. If you create a special Dreamweaver Developer user for your computer, you can log on as that user to do your developing and then log on as another user when you need to use Dreamweaver for your day-to-day web authoring jobs. That way, you won't risk compromising your program's stability as you develop your extensions.

For the exercises in this book, it's assumed you're working on the main Configuration folder unless otherwise specified.



我佛山人

职务:版主
等级:4
金币:16.0
发贴:2269
注册:2002/8/7 15:09:27
#22003/4/18 21:06:27
最主要是DW的API那部分,机器猫不能藏私啊~~