Danh mục

Appendix B. Development Tools- P1

Số trang: 17      Loại file: pdf      Dung lượng: 45.24 KB      Lượt xem: 14      Lượt tải: 0    
10.10.2023

Hỗ trợ phí lưu trữ khi tải xuống: 10,000 VND Tải xuống file đầy đủ (17 trang) 0
Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Appendix B. Development Tools- P1Cuốn sách này mô tả cách tạo ra các ứng dụng bằng cách sử dụng Mozilla. Nói chung, tất cả các phần đó đi vào một ứng dụng (bao gồm cả XUL, CSS, XBL, và DTD tập tin) cần phải được xây dựng bởi bàn tay kể từ khi không có công cụ phát triển làm sẵn hoặc các ứng dụng phát triển hoàn chỉnh có sẵn mà có thể làm cho các quy trình hướng dẫn sử dụng dễ dàng hơn. Tạo tất cả những tập tin này bằng tay là một cách tuyệt vời...
Nội dung trích xuất từ tài liệu:
Appendix B. Development Tools- P1Appendix B. Development Tools- P1This book describes how to create applications using Mozilla. Generally, allparts that go into an application (including XUL, CSS, XBL, and DTD files)need to be built by hand since no complete ready-made development tools ordevelopment applications are available that would make these manualprocesses easier.Creating all these files by hand is a great way to familiarize yourself with theway Mozilla works, and becoming more familiar with the inner workings ofa Mozilla application certainly helps you see how the various parts fittogether. Once you are comfortable creating these files by hand, using theplatform becomes much easier and Mozilla fulfills its promise as a richapplication development framework.Development tools are important, though, and platforms like Mozilla cantobtain the sort of developer base they deserve until tools that makeapplication creation easier are available. Although some people want to learneverything there is to know about creating applications with Mozilla, manysimply want to create something without a lot of fuss.Mozilla does not yet have a full set of development tools, but currentlyseveral development projects help with part of the application creationprocess. These tools dont make up a full-featured developmentenvironment, but they are useful. They also point the way to an area inMozilla development that has a bright future and is worth watching.This appendix describes some of the new tools -- including XULKit, PatchMaker, the DOM Inspector, the JavaScript Debugger, and MozillaTranslator-- that are already becoming a part of the regular repertoire of Mozilladevelopers. By learning about how to use these tools for your own project,you can radically simplify the application development process, especiallywhen you combine these tools.B.1. XULKitMuch of the manual editing described in Chapters Chapter 6, Chapter 7, andChapter 8 can be automated with special scripts and templates beingdeveloped in the Mozilla source trees tools/wizards section (thesefiles are referred to collectively as the XULKit and can be found athttp://www.hacksrus.com/~ginda/xulkit/doc/).These tools help you develop your Mozilla application by generating asmuch of the basic content, structure, and packaging of an application aspossible, leaving you free to work only on the aspects of your applicationthat you care about. We mention XULKit first because it can make settingup new Mozilla applications a snap.XULKit is essentially a set of two scripts: new-from-template.pl,which creates a new application framework, and makexpi.pl, whichpackages your application once you finish developing it.B.1.1. new-from-template.pl ScriptThough its not named very elegantly, the new-from-template.pl Perlscript takes information you provide in the form of a simple text file anduses it to create various parts of a Mozilla application. These parts includethe XUL content, which has a basic menubar you can add to; an overlay thatputs an item for your application into the Tools menu in the Mozillabrowser; CSS for your XUL; and an installation script for the applicationpackage. You can base your application off of a couple of differenttemplates, including a sophisticated one that lets you generate XPCOMinterfaces for components you wish to use in your application, describedbelow.Using these scripts, you can add content and logic to your application,restyle it, or build your application however you would like. You can alsoregister the resulting directory with the chrome registry to see it working inyour local copy of Mozilla, and when you finish developing it, theapplication directory is already structured in exactly the way it must be to bechecked into the Mozilla source trees extensions directory (if you want tocheck it into this common location for applications that become a part ofMozilla). When you want to distribute your application as described inChapter 6, you can use the other script in the XULKit, makexpi.pl, topackage your application files into a cross-platform archive that can beinstalled from a regular web page.To use the new-from-template.pl script, point it at a template thatyou filled out with your own information. It then generates the basicapplication code in the appropriate subdirectory structure:new-from-template.pl -t FILE [-o DIRECTORY] [-f[d]] [-h] [-?]When you run the script, the XULKit creates a new top-level applicationdirectory. In this directory, the script creates the three main packagedirectories, and it places some basic content in each one: a CSS file calledmozreg.css in the skins subdirectory, a few XUL files in thecontent directory (including the overlay that defines a new menu item forthe main browser that opens this new application), and localizable data in themozref.dtd file in the locale subdirectory.In addition to these files, the XULKit script creates contents.rdf filesthat describe each package, some Makefiles that instruct the Mozilla buildprocess how to integrate this application into the build (which is a later stepand not necessary to run the application), and an install.js file thatexecutes the installation of this application when it appears in a XPI. (SeeChapter 6 for more information about XPI, Mozillas cross-platforminstallation file format.)If you look at Example B-1 -- xul-app.tpl, which comes with thedistribution of new-from-template.pl -- you can see how easy it is tofill out the basic information and create your own template.Example B-1. Sample application template# load default template for a XUL appinclude ${top_wizard_dir}templates/xul-app.tpl# short app name (can not contain spaces.)# untilhttp://bugzilla.mozilla.org/show_bug.cgi?id=75670is fixed, this needs# to be all lowercase.app_name_short=xulsample# long app na ...

Tài liệu được xem nhiều: